From 322772a184106a33b1b619dd31e91e4545e123cb Mon Sep 17 00:00:00 2001 From: cakeGit <65340665+cakeGit@users.noreply.github.com> Date: Tue, 13 Aug 2024 20:35:33 +0100 Subject: [PATCH] Bugfix --- changelog.yaml | 2 ++ .../mixin/BlockHelperMixin.java | 29 +++++++++++++++++++ .../pattern_schematics.common.mixins.json | 1 + gradle.properties | 2 +- 4 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 common/src/main/java/com/cak/pattern_schematics/mixin/BlockHelperMixin.java diff --git a/changelog.yaml b/changelog.yaml index c859f58..10f2b9f 100644 --- a/changelog.yaml +++ b/changelog.yaml @@ -11,5 +11,7 @@ 1.20.1-1.1.9: | - Reduced visual clutter on schematic clone highlights [Example of new system](https://media.discordapp.net/attachments/1267781614591676426/1272539875136114820/2024-08-12_13.56.54.png?ex=66bb589c&is=66ba071c&hm=7870a62f2b19ea94babd9fd1c250ee8eaecfb8827f0b1c4dfaa08f7d3080d299&=&format=webp&quality=lossless&width=1168&height=614) - This also should help to improve performance +1.20.1-1.1.10: | + - Fixed signal placement bug ... \ No newline at end of file diff --git a/common/src/main/java/com/cak/pattern_schematics/mixin/BlockHelperMixin.java b/common/src/main/java/com/cak/pattern_schematics/mixin/BlockHelperMixin.java new file mode 100644 index 0000000..074472c --- /dev/null +++ b/common/src/main/java/com/cak/pattern_schematics/mixin/BlockHelperMixin.java @@ -0,0 +1,29 @@ +package com.cak.pattern_schematics.mixin; + +import com.simibubi.create.content.trains.track.TrackTargetingBehaviour; +import com.simibubi.create.foundation.blockEntity.SmartBlockEntity; +import com.simibubi.create.foundation.utility.BlockHelper; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +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(BlockHelper.class) +public class BlockHelperMixin { + + /**Fix to issue, thanks to @zetttabyte on Discord*/ + @Inject(method = "prepareBlockEntityData", at = @At(value = "RETURN"), remap = false, cancellable = true) + private static void trainTargeting_prepareBlockEntityData(BlockState blockState, BlockEntity blockEntity, CallbackInfoReturnable cir) { + if (blockEntity instanceof SmartBlockEntity smartBlockEntity) { + if (smartBlockEntity.getBehaviour(TrackTargetingBehaviour.TYPE) != null) { + CompoundTag tag = cir.getReturnValue(); + tag.remove("Id"); + cir.setReturnValue(tag); + } + } + } + +} diff --git a/common/src/main/resources/pattern_schematics.common.mixins.json b/common/src/main/resources/pattern_schematics.common.mixins.json index 2531fdc..fd10856 100644 --- a/common/src/main/resources/pattern_schematics.common.mixins.json +++ b/common/src/main/resources/pattern_schematics.common.mixins.json @@ -7,6 +7,7 @@ ], "mixins": [ "AbstractContraptionEntityMixin", + "BlockHelperMixin", "CreateClientMixin", "DeployBaseMixin", "DeployerMovementBehaviorMixin", diff --git a/gradle.properties b/gradle.properties index e66d91b..cc7ee4b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,7 @@ org.gradle.jvmargs = -Xmx2G # Mod Info archives_base_name = pattern_schematics -mod_version = 1.1.9 +mod_version = 1.1.10 maven_group = com.cak.pattern_schematics minecraft_version = 1.20.1