Pressure plates can be placed on top of fences

master
Wynd 2024-09-11 16:12:57 +03:00
parent 7494d3e514
commit fb3ca6bdfe
2 changed files with 34 additions and 1 deletions

View File

@ -0,0 +1,32 @@
package xyz.pixelatedw.finalbeta.mixin;
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.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import net.minecraft.level.Level;
import net.minecraft.tile.PressurePlateTile;
import net.minecraft.tile.Tile;
@Mixin(PressurePlateTile.class)
public class PressurePlateTileMixin {
@Inject(method = "canPlaceAt", at = @At("HEAD"), cancellable = true)
public void canPlaceAt(Level level, int x, int y, int z, CallbackInfoReturnable<Boolean> cir) {
int tileId = level.getTileId(x, y - 1, z);
if (tileId == Tile.FENCE.id) {
cir.setReturnValue(true);
return;
}
}
@Inject(method = "method_1609", at = @At("HEAD"), cancellable = true)
public void canSurviveAt(Level level, int x, int y, int z, int i1, CallbackInfo ci) {
int tileId = level.getTileId(x, y - 1, z);
if (tileId == Tile.FENCE.id) {
ci.cancel();
return;
}
}
}

View File

@ -46,7 +46,8 @@
"TranslationStorageMixin",
"RecipeRegistryAccessor",
"FoodItemMixin",
"ItemTypeAccessor"
"ItemTypeAccessor",
"PressurePlateTileMixin"
],
"injectors": {
"defaultRequire": -1