From 3afc30d20ff4762b726f3e5af3e3c3c35687a349 Mon Sep 17 00:00:00 2001 From: Des Herriott Date: Sat, 2 Nov 2024 09:46:22 +0000 Subject: [PATCH] TickCounter should only increment server side! --- .../block/tile/ModularRouterBlockEntity.java | 8 +------- .../me/desht/modularrouters/event/TickEventHandler.java | 2 +- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/main/java/me/desht/modularrouters/block/tile/ModularRouterBlockEntity.java b/src/main/java/me/desht/modularrouters/block/tile/ModularRouterBlockEntity.java index c72832ef..ab4409a7 100644 --- a/src/main/java/me/desht/modularrouters/block/tile/ModularRouterBlockEntity.java +++ b/src/main/java/me/desht/modularrouters/block/tile/ModularRouterBlockEntity.java @@ -288,11 +288,6 @@ public void saveAdditional(CompoundTag nbt, HolderLookup.Provider provider) { .ifPresent(tag -> nbt.put(NBT_OWNER_PROFILE, tag)); } if (!getExtensionData().isEmpty()) nbt.put(NBT_EXTRA, getExtensionData()); -// nbt.put(NBT_EXTRA, Util.make(new CompoundTag(), tag -> { -// CompoundTag ext1 = getExtensionData(); -// //noinspection ConstantConditions -// ext1.getAllKeys().forEach(key -> tag.put(key, ext1.get(key))); -// })); } @Override @@ -652,8 +647,7 @@ private int calculateSyncCounter() { int tuning = tunedSyncValue % tickRate; int delta = tuning - compileTime; if (delta <= 0) delta += tickRate; - - ModularRouters.LOGGER.info("sync counter for {}: tc={} ct={} tuning={} delta={} counter={}", getBlockPos(), TickEventHandler.TickCounter, compileTime,tuning, delta, tickRate - delta); +// ModularRouters.LOGGER.info("sync counter for {}: tc={} ct={} tuning={} delta={} counter={}", getBlockPos(), TickEventHandler.TickCounter, compileTime,tuning, delta, tickRate - delta); return tickRate - delta; } diff --git a/src/main/java/me/desht/modularrouters/event/TickEventHandler.java b/src/main/java/me/desht/modularrouters/event/TickEventHandler.java index 93a556f3..c9458451 100644 --- a/src/main/java/me/desht/modularrouters/event/TickEventHandler.java +++ b/src/main/java/me/desht/modularrouters/event/TickEventHandler.java @@ -13,7 +13,7 @@ public class TickEventHandler { @SubscribeEvent public static void onWorldTick(LevelTickEvent.Post event) { - if (event.getLevel().dimension() == Level.OVERWORLD) { + if (event.getLevel().dimension() == Level.OVERWORLD && !event.getLevel().isClientSide) { TickCounter++; } }