Skip to content

Commit

Permalink
Fixed production-only issues for version 0.5.
Browse files Browse the repository at this point in the history
  • Loading branch information
FamroFexl committed Dec 12, 2024
1 parent 6bf7619 commit d35ac73
Showing 1 changed file with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import com.fexl.circumnavigate.processing.BlockPosWrapped;
import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.SignalGetter;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
Expand All @@ -17,22 +18,28 @@ public interface SignalGetterMixin {
@ModifyVariable(method = "getControlInputSignal", at = @At("HEAD"), index = 1, argsOnly = true)
default BlockPos modifyBlockPos(BlockPos blockPos) {
SignalGetter thiz = (SignalGetter) (Object) this;
if(thiz.isClientSide()) return blockPos;
return new BlockPosWrapped(blockPos, thiz.getTransformer());
if(thiz instanceof ServerLevel serverLevel) {
return new BlockPosWrapped(blockPos, serverLevel.getTransformer());
}
return blockPos;
}

@ModifyVariable(method = "getSignal", at = @At("HEAD"), index = 1, argsOnly = true)
default BlockPos modifyBlockPos2(BlockPos blockPos) {
SignalGetter thiz = (SignalGetter) (Object) this;
if(thiz.isClientSide()) return blockPos;
return new BlockPosWrapped(blockPos, thiz.getTransformer());
if(thiz instanceof ServerLevel serverLevel) {
return new BlockPosWrapped(blockPos, serverLevel.getTransformer());
}
return blockPos;
}

@ModifyVariable(method = "hasNeighborSignal", at = @At("HEAD"), index = 1, argsOnly = true)
default BlockPos modifyBlockPos3(BlockPos blockPos) {
SignalGetter thiz = (SignalGetter) (Object) this;
if(thiz.isClientSide()) return blockPos;
return new BlockPosWrapped(blockPos, thiz.getTransformer());
if(thiz instanceof ServerLevel serverLevel) {
return new BlockPosWrapped(blockPos, serverLevel.getTransformer());
}
return blockPos;
}


Expand Down

0 comments on commit d35ac73

Please sign in to comment.