Adding save handle to get Entities Within AABB Excluding Entity

This commit is contained in:
thatsIch
2014-11-04 02:18:37 +01:00
parent 0622b8bb83
commit 83262093eb
3 changed files with 47 additions and 12 deletions
@@ -0,0 +1,43 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.entity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import java.util.List;
public abstract class AEBaseEntityItem extends EntityItem
{
public AEBaseEntityItem( World p_i1710_1_, double p_i1710_2_, double p_i1710_4_, double p_i1710_6_, ItemStack p_i1710_8_ )
{
super( p_i1710_1_, p_i1710_2_, p_i1710_4_, p_i1710_6_, p_i1710_8_ );
}
@SuppressWarnings( "unchecked" )
public List<Entity> getCheckedEntitiesWithinAABBExcludingEntity( AxisAlignedBB region )
{
return this.worldObj.getEntitiesWithinAABBExcludingEntity( this, region );
}
}
@@ -18,16 +18,12 @@ import appeng.core.CommonHelper;
import appeng.core.features.AEFeature;
import appeng.util.Platform;
final public class EntityChargedQuartz extends EntityItem
final public class EntityChargedQuartz extends AEBaseEntityItem
{
int delay = 0;
int transformTime = 0;
public EntityChargedQuartz(World w) {
super( w );
}
public EntityChargedQuartz(World w, double x, double y, double z, ItemStack is) {
super( w, x, y, z, is );
}
@@ -70,7 +66,7 @@ final public class EntityChargedQuartz extends EntityItem
if ( AEApi.instance().materials().materialCertusQuartzCrystalCharged.sameAsStack( item ) )
{
AxisAlignedBB region = AxisAlignedBB.getBoundingBox( posX - 1, posY - 1, posZ - 1, posX + 1, posY + 1, posZ + 1 );
List<Entity> l = worldObj.getEntitiesWithinAABBExcludingEntity( this, region );
List<Entity> l = this.getCheckedEntitiesWithinAABBExcludingEntity( region );
EntityItem redstone = null;
EntityItem netherQuartz = null;
@@ -16,15 +16,11 @@ import appeng.core.AEConfig;
import appeng.core.features.AEFeature;
import appeng.util.Platform;
final public class EntitySingularity extends EntityItem
final public class EntitySingularity extends AEBaseEntityItem
{
static private int randTickSeed = 0;
public EntitySingularity(World w) {
super( w );
}
public EntitySingularity(World w, double x, double y, double z, ItemStack is) {
super( w, x, y, z, is );
}
@@ -53,7 +49,7 @@ final public class EntitySingularity extends EntityItem
if ( AEApi.instance().materials().materialSingularity.sameAsStack( item ) )
{
AxisAlignedBB region = AxisAlignedBB.getBoundingBox( posX - 4, posY - 4, posZ - 4, posX + 4, posY + 4, posZ + 4 );
List<Entity> l = worldObj.getEntitiesWithinAABBExcludingEntity( this, region );
List<Entity> l = this.getCheckedEntitiesWithinAABBExcludingEntity( region );
for (Entity e : l)
{