From e70175d8c69ff4d5c89f684ef7c207daa8b353ee Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Sat, 9 Nov 2024 18:35:06 +0100 Subject: Change stuff --- src/main/java/moe/nea/beacons/mixin/BeaconMixin.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/main/java/moe/nea/beacons/mixin') diff --git a/src/main/java/moe/nea/beacons/mixin/BeaconMixin.java b/src/main/java/moe/nea/beacons/mixin/BeaconMixin.java index 4602208..b92070f 100644 --- a/src/main/java/moe/nea/beacons/mixin/BeaconMixin.java +++ b/src/main/java/moe/nea/beacons/mixin/BeaconMixin.java @@ -45,8 +45,9 @@ public class BeaconMixin implements BeaconBlockEntityExtra { return this.checkingBeamSections; } - @Inject(method = "tick", at = @At(value = "FIELD", target = "Lnet/minecraft/world/level/block/entity/BeaconBlockEntity;beamSections:Ljava/util/List;", opcode = Opcodes.ASTORE)) + @Inject(method = "tick", at = @At(value = "FIELD", target = "Lnet/minecraft/world/level/block/entity/BeaconBlockEntity;beamSections:Ljava/util/List;", opcode = Opcodes.PUTFIELD)) private static void saveRangeExtender(Level level, BlockPos blockPos, BlockState blockState, BeaconBlockEntity beaconBlockEntity, CallbackInfo ci) { + if (level.isClientSide) return; var extra = BeaconBlockEntityExtra.cast(beaconBlockEntity); var accExtraRange = 0; for (var beaconBeamSection : extra.getCheckingBeamSections_nea()) { @@ -60,15 +61,14 @@ public class BeaconMixin implements BeaconBlockEntityExtra { private static BlockPos checkForRangeExtender( BlockPos oldBlockPos, Operation original, @Local BeaconBlockEntity.BeaconBeamSection lastSection, @Local(argsOnly = true) Level level) { - var newPos = original.call(oldBlockPos); var blockState = level.getBlockState(oldBlockPos); - if (blockState.getBlock() instanceof BeaconRangeExtender extender && lastSection != null) { + if (!level.isClientSide && blockState.getBlock() instanceof BeaconRangeExtender extender && lastSection != null) { var lastSectionExtra = BeaconBeamSectionExtra.cast(lastSection); lastSectionExtra.setRangeExtenders_nea( extender.extraBeaconRange_nea() + lastSectionExtra.getRangeExtenders_nea() ); } - return newPos; + return original.call(oldBlockPos); } @Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/entity/BeaconBlockEntity;applyEffects(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;ILnet/minecraft/core/Holder;Lnet/minecraft/core/Holder;)V")) -- cgit