diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 03ea15674..031e801c2 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -30,7 +30,7 @@ jobs: if: endswith(github.ref_name, 'master') && github.ref_protected && github.ref_type == 'branch' runs-on: ubuntu-latest env: - APPVEYOR_BUILD_VERSION: '3.0.1' + APPVEYOR_BUILD_VERSION: '3.0.2' CURSETOKEN: ${{ secrets.CURSETOKEN }} steps: - uses: actions/checkout@v3 diff --git a/changelog.md b/changelog.md index fc874e8a7..6e5ec4782 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,9 @@ # Changelog +## [1.16.5 - 3.0.2] + +fix: linking crash + ## [1.16.5 - 3.0.1] fix: ServerStartup issue diff --git a/src/main/java/com/troblecodings/signals/init/OSItems.java b/src/main/java/com/troblecodings/signals/init/OSItems.java index 8d4d712a6..ce06153a0 100644 --- a/src/main/java/com/troblecodings/signals/init/OSItems.java +++ b/src/main/java/com/troblecodings/signals/init/OSItems.java @@ -21,6 +21,7 @@ import net.minecraft.item.Item.Properties; import net.minecraft.item.ItemGroup; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.registries.IForgeRegistry; @@ -39,7 +40,7 @@ private OSItems() { }, _u -> true, (level, pos, tag) -> { final BlockState state = level.getBlockState(pos); final NBTWrapper wrapper = new NBTWrapper(tag); - wrapper.putString(pos.toShortString(), state.getBlock().getRegistryName().getPath()); + wrapper.putString(readStringFromPos(pos), state.getBlock().getRegistryName().getPath()); }); public static final MultiLinkingTool MULTI_LINKING_TOOL = new MultiLinkingTool(OSTabs.TAB, (world, pos) -> { @@ -52,7 +53,7 @@ private OSItems() { }, _u -> true, (level, pos, tag) -> { final BlockState state = level.getBlockState(pos); final NBTWrapper wrapper = new NBTWrapper(tag); - wrapper.putString(pos.toShortString(), + wrapper.putString(readStringFromPos(pos), state.getBlock().getRegistryName().getPath()); }); public static final Item CONDUCTOR_TROWEL_GREEN = new Item( @@ -158,4 +159,7 @@ public static void registerItem(final RegistryEvent.Register event) { registeredItems.forEach(registry::register); } + public static String readStringFromPos(final BlockPos pos) { + return "[x=" + pos.getX() + ",y=" + pos.getY() + ",z=" + pos.getZ() + "]"; + } } diff --git a/src/main/java/com/troblecodings/signals/signalbox/SignalBoxTileEntity.java b/src/main/java/com/troblecodings/signals/signalbox/SignalBoxTileEntity.java index 3a6dbdc41..ab83619e9 100644 --- a/src/main/java/com/troblecodings/signals/signalbox/SignalBoxTileEntity.java +++ b/src/main/java/com/troblecodings/signals/signalbox/SignalBoxTileEntity.java @@ -13,6 +13,7 @@ import com.troblecodings.signals.handler.SignalStateHandler; import com.troblecodings.signals.handler.SignalStateInfo; import com.troblecodings.signals.init.OSBlocks; +import com.troblecodings.signals.init.OSItems; import com.troblecodings.signals.signalbox.debug.SignalBoxFactory; import com.troblecodings.signals.tileentitys.SyncableTileEntity; @@ -70,8 +71,8 @@ public boolean hasLink() { @Override public boolean link(final BlockPos pos, final CompoundNBT tag) { @SuppressWarnings("deprecation") - final Block block = Registry.BLOCK.get( - new ResourceLocation(OpenSignalsMain.MODID, tag.getString(pos.toShortString()))); + final Block block = Registry.BLOCK.get(new ResourceLocation(OpenSignalsMain.MODID, + tag.getString(OSItems.readStringFromPos(pos)))); if (block == null || block instanceof AirBlock) return false; LinkType type = LinkType.SIGNAL; diff --git a/src/main/java/com/troblecodings/signals/tileentitys/SignalControllerTileEntity.java b/src/main/java/com/troblecodings/signals/tileentitys/SignalControllerTileEntity.java index 585f23374..44cedfa0b 100644 --- a/src/main/java/com/troblecodings/signals/tileentitys/SignalControllerTileEntity.java +++ b/src/main/java/com/troblecodings/signals/tileentitys/SignalControllerTileEntity.java @@ -20,6 +20,7 @@ import com.troblecodings.signals.enums.EnumState; import com.troblecodings.signals.handler.SignalStateHandler; import com.troblecodings.signals.handler.SignalStateInfo; +import com.troblecodings.signals.init.OSItems; import net.minecraft.block.Block; import net.minecraft.entity.player.PlayerEntity; @@ -259,7 +260,7 @@ public boolean hasLink() { public boolean link(final BlockPos pos, final CompoundNBT tag) { @SuppressWarnings("deprecation") final Block block = Registry.BLOCK.get( - new ResourceLocation(OpenSignalsMain.MODID, tag.getString(pos.toShortString()))); + new ResourceLocation(OpenSignalsMain.MODID, tag.getString(OSItems.readStringFromPos(pos)))); if (block != null && block instanceof Signal) { unlink(); linkedSignalPosition = pos;