Bringing the Cheat

- Clipboards now validate their data item #6928
- Backport #6911
This commit is contained in:
simibubi 2024-10-08 12:48:36 +02:00
parent 4d466efe80
commit 5905e8bc93
4 changed files with 5 additions and 3 deletions

View file

@ -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

View file

@ -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();

View file

@ -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));

View file

@ -21,7 +21,7 @@ public class BlockItemMixin {
@Inject(method = "place", at = @At("HEAD"), cancellable = true)
private void create$fixDeployerPlacement(BlockPlaceContext pContext, CallbackInfoReturnable<InteractionResult> 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);
}
}