Update TileConduitBundle.java

Greatly increase Client Side ItemConduit performance. (20% fps increase if have 100 - 200 item conduit in render area, these are lag-spikes.)

EnderIO Conduits are very laggy, partly because Redstone/fluid/gas Conduits causing RenderChunks re-render back and forth. But if there is only one ItemConduit in the bundle, it is pretty sure that we only need to re-render ItemConduit near the player , because only player's behavior range (5) can change the shape of ItemConduit. 
But if there is another conduit in the bundle, the re-render is not sure because Redstone conduit in the bundle might needs to re-render in any time. So in this case I left to default.
This commit is contained in:
TataTawa authored and GitHub committed 2020-08-28 17:59:14 +08:00
1 parent f492c45f50
commit 983a76dd1d
1 file changed
+15 -1
@@ -19,6 +19,8 @@ import mods.immibis.microblocks.api.IMicroblockSystem;
import mods.immibis.microblocks.api.MicroblockAPIUtils;
import mods.immibis.microblocks.api.Part;
import mods.immibis.microblocks.api.PartType;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@@ -162,7 +164,19 @@ public class TileConduitBundle extends TileEntityEio implements IConduitBundle {
facadeMeta = nbtRoot.getInteger("facadeMeta");
if(worldObj != null && worldObj.isRemote) {
clientUpdated = true;
if (conduits.size() == 1 && conduits.get(0) instanceof ItemConduit) {
boolean itemConduitClientUpdated = false;
for (Object o : Minecraft.getMinecraft().theWorld.playerEntities) {
Entity e = ((Entity) o);
if (e.getDistanceSq(this.xCoord, yCoord, zCoord) < 36) {
itemConduitClientUpdated = true;
break;
}
}
if (itemConduitClientUpdated) clientUpdated = true;
} else {
clientUpdated = true;
}
}
if (MicroblocksUtil.supportMicroblocks()) {