summaryrefslogtreecommitdiff
path: root/src/main/java/moe/nea/beacons/mixin
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-11-09 18:35:06 +0100
committerLinnea Gräf <nea@nea.moe>2024-11-09 18:35:06 +0100
commite70175d8c69ff4d5c89f684ef7c207daa8b353ee (patch)
treec9f41a4c91f73a438fe0f843997ed182f8cf0ee7 /src/main/java/moe/nea/beacons/mixin
parent94f12b5bc032aac26371bf5c086492436d92878c (diff)
downloadbeacon-range-extender-e70175d8c69ff4d5c89f684ef7c207daa8b353ee.tar.gz
beacon-range-extender-e70175d8c69ff4d5c89f684ef7c207daa8b353ee.tar.bz2
beacon-range-extender-e70175d8c69ff4d5c89f684ef7c207daa8b353ee.zip
Change stuff
Diffstat (limited to 'src/main/java/moe/nea/beacons/mixin')
-rw-r--r--src/main/java/moe/nea/beacons/mixin/BeaconMixin.java8
1 files changed, 4 insertions, 4 deletions
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<BlockPos> 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"))