Pressure plates can be placed on top of fences
parent
7494d3e514
commit
fb3ca6bdfe
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -46,7 +46,8 @@
|
|||
"TranslationStorageMixin",
|
||||
"RecipeRegistryAccessor",
|
||||
"FoodItemMixin",
|
||||
"ItemTypeAccessor"
|
||||
"ItemTypeAccessor",
|
||||
"PressurePlateTileMixin"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": -1
|
||||
|
|
Loading…
Reference in New Issue