This commit is contained in:
gnembon committed 2023-03-22 18:27:44 +01:00
1 parent 4e94d1bc15
commit f1586b3809
9 files changed
+33 -43

No files matched your search

@@ -3,11 +3,11 @@ package carpet.helpers;
import carpet.CarpetSettings;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.SignalGetter;
public class QuasiConnectivity {
public static boolean hasQuasiSignal(Level level, BlockPos pos) {
public static boolean hasQuasiSignal(SignalGetter level, BlockPos pos) {
for (int i = 1; i <= CarpetSettings.quasiConnectivity; i++) {
BlockPos above = pos.above(i);
@@ -1,5 +1,6 @@
package carpet.mixins;
import net.minecraft.world.level.SignalGetter;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
@@ -9,7 +10,6 @@ import carpet.helpers.QuasiConnectivity;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.piston.PistonBaseBlock;
@Mixin(PistonBaseBlock.class)
@@ -23,7 +23,7 @@ public class PistonBaseBlock_qcMixin {
target = "Lnet/minecraft/core/BlockPos;above()Lnet/minecraft/core/BlockPos;"
)
)
private void carpet_checkQuasiSignal(Level level, BlockPos pos, Direction facing, CallbackInfoReturnable<Boolean> cir) {
private void carpet_checkQuasiSignal(SignalGetter level, BlockPos pos, Direction facing, CallbackInfoReturnable<Boolean> cir) {
cir.setReturnValue(QuasiConnectivity.hasQuasiSignal(level, pos));
}
}
@@ -4,6 +4,7 @@ import carpet.fakes.PistonBlockInterface;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.SignalGetter;
import net.minecraft.world.level.block.piston.PistonBaseBlock;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@@ -11,7 +12,7 @@ import org.spongepowered.asm.mixin.Shadow;
@Mixin(PistonBaseBlock.class)
public abstract class PistonBaseBlock_rotatorBlockMixin implements PistonBlockInterface
{
@Shadow protected abstract boolean getNeighborSignal(Level world_1, BlockPos blockPos_1, Direction direction_1);
@Shadow protected abstract boolean getNeighborSignal(SignalGetter world_1, BlockPos blockPos_1, Direction direction_1);
@Override
public boolean publicShouldExtend(Level world_1, BlockPos blockPos_1, Direction direction_1)
@@ -0,0 +1,21 @@
package carpet.mixins;
import carpet.CarpetSettings;
import net.minecraft.world.level.block.entity.SculkSensorBlockEntity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(SculkSensorBlockEntity.VibrationConfig.class)
public class SculkSensorBlockEntityVibrationConfig_sculkSensorRangeMixin
{
@Inject(method = "getListenerRadius", at = @At("HEAD"), cancellable = true)
private void sculkSensorRange(CallbackInfoReturnable<Integer> cir)
{
if (CarpetSettings.sculkSensorRange != SculkSensorBlockEntity.VibrationConfig.LISTENER_RANGE) {
cir.setReturnValue(CarpetSettings.sculkSensorRange);
}
}
}
@@ -1,30 +0,0 @@
package carpet.mixins;
import carpet.CarpetSettings;
import net.minecraft.world.level.block.SculkSensorBlock;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(SculkSensorBlock.class)
public class SculkSensorBlock_rangeMixin {
@Shadow
@Final
private int listenerRange;
@Inject(
method = "getListenerRange()I",
at = @At("HEAD"),
cancellable = true
)
public void getListenerRange(CallbackInfoReturnable<Integer> cir) {
if (CarpetSettings.sculkSensorRange != this.listenerRange) {
cir.setReturnValue(CarpetSettings.sculkSensorRange);
}
}
}
@@ -45,7 +45,6 @@ import net.minecraft.world.inventory.FurnaceMenu;
import net.minecraft.world.inventory.GrindstoneMenu;
import net.minecraft.world.inventory.HopperMenu;
import net.minecraft.world.inventory.LecternMenu;
import net.minecraft.world.inventory.LegacySmithingMenu;
import net.minecraft.world.inventory.LoomMenu;
import net.minecraft.world.inventory.MerchantMenu;
import net.minecraft.world.inventory.ShulkerBoxMenu;
@@ -99,7 +98,6 @@ public class ScreenValue extends Value
screenHandlerFactories.put("loom", LoomMenu::new);
screenHandlerFactories.put("merchant", MerchantMenu::new);
screenHandlerFactories.put("shulker_box", (syncId, playerInventory) -> new ShulkerBoxMenu(syncId, playerInventory, new SimpleContainer(9 * 3)));
screenHandlerFactories.put("smithing_legacy", LegacySmithingMenu::new);
screenHandlerFactories.put("smithing", SmithingMenu::new);
screenHandlerFactories.put("smoker", SmokerMenu::new);
screenHandlerFactories.put("stonecutter", StonecutterMenu::new);