From 5905e8bc931434c7d178c83442f153eed315a2a7 Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Tue, 8 Oct 2024 12:48:36 +0200 Subject: [PATCH] Bringing the Cheat - Clipboards now validate their data item #6928 - Backport #6911 --- gradle.properties | 2 +- src/main/java/com/simibubi/create/Create.java | 2 +- .../content/equipment/clipboard/ClipboardBlockEntity.java | 2 ++ .../com/simibubi/create/foundation/mixin/BlockItemMixin.java | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/gradle.properties b/gradle.properties index 4c75a885b..6bb0ec39d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ org.gradle.jvmargs = -Xmx3G org.gradle.daemon = false # mod version info -mod_version = 0.5.1.h +mod_version = 0.5.1.i artifact_minecraft_version = 1.18.2 minecraft_version = 1.18.2 diff --git a/src/main/java/com/simibubi/create/Create.java b/src/main/java/com/simibubi/create/Create.java index b4657f70f..145b1c4db 100644 --- a/src/main/java/com/simibubi/create/Create.java +++ b/src/main/java/com/simibubi/create/Create.java @@ -61,7 +61,7 @@ public class Create { public static final String ID = "create"; public static final String NAME = "Create"; - public static final String VERSION = "0.5.1h"; + public static final String VERSION = "0.5.1i"; public static final Logger LOGGER = LogUtils.getLogger(); diff --git a/src/main/java/com/simibubi/create/content/equipment/clipboard/ClipboardBlockEntity.java b/src/main/java/com/simibubi/create/content/equipment/clipboard/ClipboardBlockEntity.java index 7d1afe661..2537f6a88 100644 --- a/src/main/java/com/simibubi/create/content/equipment/clipboard/ClipboardBlockEntity.java +++ b/src/main/java/com/simibubi/create/content/equipment/clipboard/ClipboardBlockEntity.java @@ -68,6 +68,8 @@ public class ClipboardBlockEntity extends SmartBlockEntity { protected void read(CompoundTag tag, boolean clientPacket) { super.read(tag, clientPacket); dataContainer = ItemStack.of(tag.getCompound("Item")); + if (!AllBlocks.CLIPBOARD.isIn(dataContainer)) + dataContainer = AllBlocks.CLIPBOARD.asStack(); if (clientPacket) DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> readClientSide(tag)); diff --git a/src/main/java/com/simibubi/create/foundation/mixin/BlockItemMixin.java b/src/main/java/com/simibubi/create/foundation/mixin/BlockItemMixin.java index f4031bcb2..afeaad404 100644 --- a/src/main/java/com/simibubi/create/foundation/mixin/BlockItemMixin.java +++ b/src/main/java/com/simibubi/create/foundation/mixin/BlockItemMixin.java @@ -21,7 +21,7 @@ public class BlockItemMixin { @Inject(method = "place", at = @At("HEAD"), cancellable = true) private void create$fixDeployerPlacement(BlockPlaceContext pContext, CallbackInfoReturnable cir) { BlockState state = pContext.getLevel().getBlockState(((UseOnContextAccessor) pContext).create$getHitResult().getBlockPos()); - if (!state.canBeReplaced() && pContext.getPlayer() instanceof DeployerFakePlayer) { + if (!state.getMaterial().isReplaceable() && pContext.getPlayer() instanceof DeployerFakePlayer) { cir.setReturnValue(InteractionResult.PASS); } }