From ccc15472924fb9586dd7dc298fce5264fd9f7b15 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Wed, 29 Apr 2020 14:06:19 +0200 Subject: [PATCH] fixed some stuff unnecessarily happening on the client Closes #2 --- .../ellpeck/prettypipes/network/PipeItem.java | 2 ++ .../prettypipes/pipe/PipeTileEntity.java | 28 ++++++++++--------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/main/java/de/ellpeck/prettypipes/network/PipeItem.java b/src/main/java/de/ellpeck/prettypipes/network/PipeItem.java index f30c5f0..6d10b9f 100644 --- a/src/main/java/de/ellpeck/prettypipes/network/PipeItem.java +++ b/src/main/java/de/ellpeck/prettypipes/network/PipeItem.java @@ -153,6 +153,8 @@ public class PipeItem implements INBTSerializable, ILiquidContainer } private void onPathObstructed(PipeTileEntity currPipe, boolean tryReturn) { + if (currPipe.getWorld().isRemote) + return; if (!this.dropOnObstruction && tryReturn) { PipeNetwork network = PipeNetwork.get(currPipe.getWorld()); if (network.routeItemToLocation(currPipe.getPos(), this.destInventory, this.getStartPipe(), this.startInventory, speed -> this)) { diff --git a/src/main/java/de/ellpeck/prettypipes/pipe/PipeTileEntity.java b/src/main/java/de/ellpeck/prettypipes/pipe/PipeTileEntity.java index 723d71b..125b3aa 100644 --- a/src/main/java/de/ellpeck/prettypipes/pipe/PipeTileEntity.java +++ b/src/main/java/de/ellpeck/prettypipes/pipe/PipeTileEntity.java @@ -94,20 +94,22 @@ public class PipeTileEntity extends TileEntity implements INamedContainerProvide return; IProfiler profiler = this.world.getProfiler(); - profiler.startSection("ticking_modules"); - int prio = 0; - Iterator> modules = this.streamModules().iterator(); - while (modules.hasNext()) { - Pair module = modules.next(); - module.getRight().tick(module.getLeft(), this); - prio += module.getRight().getPriority(module.getLeft(), this); + if (!this.world.isRemote) { + profiler.startSection("ticking_modules"); + int prio = 0; + Iterator> modules = this.streamModules().iterator(); + while (modules.hasNext()) { + Pair module = modules.next(); + module.getRight().tick(module.getLeft(), this); + prio += module.getRight().getPriority(module.getLeft(), this); + } + if (prio != this.priority) { + this.priority = prio; + // clear the cache so that it's reevaluated based on priority + PipeNetwork.get(this.world).clearDestinationCache(this.pos); + } + profiler.endSection(); } - if (prio != this.priority) { - this.priority = prio; - // clear the cache so that it's reevaluated based on priority - PipeNetwork.get(this.world).clearDestinationCache(this.pos); - } - profiler.endSection(); profiler.startSection("ticking_items"); List items = this.getItems();