fix ILaserTarget deprecation and add ILaserTargetBlock as a major optimization for laser lookups, closes #2027
This commit is contained in:
parent
249caf7e21
commit
06ab6e09c6
2 changed files with 12 additions and 11 deletions
|
@ -20,18 +20,17 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import buildcraft.BuildCraftSilicon;
|
||||
import buildcraft.api.events.BlockInteractionEvent;
|
||||
import buildcraft.api.power.ILaserTargetBlock;
|
||||
import buildcraft.core.BlockBuildCraft;
|
||||
import buildcraft.core.CreativeTabBuildCraft;
|
||||
import buildcraft.core.utils.Utils;
|
||||
|
||||
public class BlockLaserTable extends BlockBuildCraft {
|
||||
public class BlockLaserTable extends BlockBuildCraft implements ILaserTargetBlock {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon[][] icons;
|
||||
|
|
|
@ -23,6 +23,7 @@ import buildcraft.api.core.SafeTimeTracker;
|
|||
import buildcraft.api.gates.IAction;
|
||||
import buildcraft.api.gates.IActionReceptor;
|
||||
import buildcraft.api.power.ILaserTarget;
|
||||
import buildcraft.api.power.ILaserTargetBlock;
|
||||
import buildcraft.core.Box;
|
||||
import buildcraft.core.EntityLaser;
|
||||
import buildcraft.core.IMachine;
|
||||
|
@ -184,16 +185,17 @@ public class TileLaser extends TileBuildCraft implements IActionReceptor, IMachi
|
|||
for (int x = minX; x <= maxX; ++x) {
|
||||
for (int y = minY; y <= maxY; ++y) {
|
||||
for (int z = minZ; z <= maxZ; ++z) {
|
||||
|
||||
TileEntity tile = worldObj.getTileEntity(x, y, z);
|
||||
if (tile instanceof ILaserTarget) {
|
||||
|
||||
ILaserTarget table = (ILaserTarget) tile;
|
||||
if (table.requiresLaserEnergy()) {
|
||||
targets.add(table);
|
||||
if (worldObj.getBlock(x, y, z) instanceof ILaserTargetBlock) {
|
||||
TileEntity tile = worldObj.getTileEntity(x, y, z);
|
||||
|
||||
if (tile instanceof ILaserTarget) {
|
||||
ILaserTarget table = (ILaserTarget) tile;
|
||||
|
||||
if (table.requiresLaserEnergy()) {
|
||||
targets.add(table);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue