mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-19 11:59:17 +00:00
#981 Performance decrease using redstone conduits.
This commit is contained in:
1 parent
ac8e5d633c
commit
8329fc1eef
6 files changed
+31
-1
No files matched your search
@@ -14,6 +14,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import crazypants.enderio.EnderIO;
|
||||
@@ -477,6 +478,11 @@ public abstract class AbstractConduit implements IConduit {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onNeighborChange(IBlockAccess world, int x, int y, int z, int tileX, int tileY, int tileZ) {
|
||||
return onNeighborBlockChange(world.getBlock(tileX, tileY, tileZ));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<CollidableComponent> createCollidables(CacheKey key) {
|
||||
|
||||
@@ -613,7 +613,7 @@ public class BlockConduitBundle extends BlockEio implements IGuiHandler {
|
||||
public void onNeighborChange(IBlockAccess world, int x, int y, int z, int tileX, int tileY, int tileZ) {
|
||||
TileEntity conduit = world.getTileEntity(x, y, z);
|
||||
if(conduit instanceof IConduitBundle) {
|
||||
((IConduitBundle) conduit).onNeighborBlockChange(world.getBlock(tileX, tileY, tileZ));
|
||||
((IConduitBundle) conduit).onNeighborChange(world, x, y, z, tileX, tileY, tileZ);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import crazypants.enderio.conduit.geom.CollidableCache.CacheKey;
|
||||
@@ -122,5 +123,7 @@ public interface IConduit {
|
||||
void updateEntity(World worldObj);
|
||||
|
||||
boolean onNeighborBlockChange(Block blockId);
|
||||
|
||||
boolean onNeighborChange(IBlockAccess world, int x, int y, int z, int tileX, int tileY, int tileZ);
|
||||
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import java.util.Set;
|
||||
import mekanism.api.gas.IGasHandler;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
@@ -57,6 +58,8 @@ public interface IConduitBundle extends IInternalPowerReceptor, IFluidHandler, I
|
||||
// events
|
||||
|
||||
void onNeighborBlockChange(Block blockId);
|
||||
|
||||
void onNeighborChange(IBlockAccess world, int x, int y, int z, int tileX, int tileY, int tileZ);
|
||||
|
||||
void onBlockRemoved();
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
@@ -285,6 +286,17 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
|
||||
dirty();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborChange(IBlockAccess world, int x, int y, int z, int tileX, int tileY, int tileZ) {
|
||||
boolean needsUpdate = false;
|
||||
for (IConduit conduit : conduits) {
|
||||
needsUpdate |= conduit.onNeighborChange(world, x, y, z, tileX, tileY, tileZ);
|
||||
}
|
||||
if(needsUpdate) {
|
||||
dirty();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileConduitBundle getEntity() {
|
||||
|
||||
@@ -11,6 +11,7 @@ import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@@ -243,5 +244,10 @@ public class RedstoneConduit extends AbstractConduit implements IRedstoneConduit
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onNeighborChange(IBlockAccess world, int x, int y, int z, int tileX, int tileY, int tileZ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user