From 6caab353523583b7e9fa8cd4a53ef33c1e7680e6 Mon Sep 17 00:00:00 2001 From: Daniel Mendes Date: Thu, 4 Jan 2024 13:06:33 +0100 Subject: [PATCH] Removed Pattern Book while keep crashing on servers --- CHANGELOG.md | 4 +++- .../caterpillar/Caterpillar.java | 6 +++++- .../caterpillar/event/ClientModEvents.java | 19 ++++++++++++------- .../caterpillar/network/PacketHandler.java | 14 +++++++++----- .../registry/CreativeModeTabRegistry.java | 8 ++++++-- 5 files changed, 35 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 18e61fe1..2a065f64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,9 @@ All notable changes to this project will be documented in this file. ## [Unreleased] -## [1.20.1-8.0.2] - 2024-01-03 +## [1.20.1-8.0.2] - 2024-01-04 + +Removed the `Pattern Book` item, while keep crashing on servers. ### Fixed diff --git a/src/main/java/dev/the_fireplace/caterpillar/Caterpillar.java b/src/main/java/dev/the_fireplace/caterpillar/Caterpillar.java index d6661834..9574e122 100644 --- a/src/main/java/dev/the_fireplace/caterpillar/Caterpillar.java +++ b/src/main/java/dev/the_fireplace/caterpillar/Caterpillar.java @@ -31,7 +31,11 @@ public Caterpillar() { CreativeModeTabRegistry.register(bus); BlockRegistry.BLOCKS.register(bus); BlockEntityRegistry.BLOCK_ENTITY_TYPES.register(bus); - ItemRegistry.ITEMS.register(bus); + /** + * TODO: Re-enable when fixed + * + * ItemRegistry.ITEMS.register(bus); + */ MenuRegistry.MENU_TYPES.register(bus); EntityRegistry.ENTITY_TYPES.register(bus); RecipeRegistry.RECIPE_SERIALIZERS.register(bus); diff --git a/src/main/java/dev/the_fireplace/caterpillar/event/ClientModEvents.java b/src/main/java/dev/the_fireplace/caterpillar/event/ClientModEvents.java index e3b54599..8a438cf9 100644 --- a/src/main/java/dev/the_fireplace/caterpillar/event/ClientModEvents.java +++ b/src/main/java/dev/the_fireplace/caterpillar/event/ClientModEvents.java @@ -7,6 +7,7 @@ import dev.the_fireplace.caterpillar.client.screen.*; import dev.the_fireplace.caterpillar.config.ConfigHelper; import dev.the_fireplace.caterpillar.config.ConfigHolder; +import dev.the_fireplace.caterpillar.network.packet.server.OpenBookGuiS2CPacket; import dev.the_fireplace.caterpillar.registry.EntityRegistry; import dev.the_fireplace.caterpillar.registry.MenuRegistry; import net.minecraft.client.gui.screens.MenuScreens; @@ -63,12 +64,16 @@ public static void onKeyRegister(RegisterKeyMappingsEvent event) { @SubscribeEvent public static void onInitialize(FMLCommonSetupEvent event) { - MinecraftForge.EVENT_BUS.addListener((PlayerInteractEvent.RightClickBlock e) -> { - var result = LecternEventHandler.rightClick(e.getEntity(), e.getLevel(), e.getHand(), e.getHitVec()); - if (result.consumesAction()) { - e.setCanceled(true); - e.setCancellationResult(result); - } - }); + /** + * TODO: Re-enable when fixed + * + * MinecraftForge.EVENT_BUS.addListener((PlayerInteractEvent.RightClickBlock e) -> { + * var result = LecternEventHandler.rightClick(e.getEntity(), e.getLevel(), e.getHand(), e.getHitVec()); + * if (result.consumesAction()) { + * e.setCanceled(true); + * e.setCancellationResult(result); + * } + * }); + */ } } \ No newline at end of file diff --git a/src/main/java/dev/the_fireplace/caterpillar/network/PacketHandler.java b/src/main/java/dev/the_fireplace/caterpillar/network/PacketHandler.java index 9a94c9f3..775fb9ee 100644 --- a/src/main/java/dev/the_fireplace/caterpillar/network/PacketHandler.java +++ b/src/main/java/dev/the_fireplace/caterpillar/network/PacketHandler.java @@ -144,11 +144,15 @@ public static void register() { .consumerMainThread(PatternBookEditC2SPacket::handle) .add(); - CHANNEL.messageBuilder(OpenBookGuiS2CPacket.class, index++, NetworkDirection.PLAY_TO_CLIENT) - .decoder(OpenBookGuiS2CPacket::new) - .encoder(OpenBookGuiS2CPacket::toBytes) - .consumerMainThread(OpenBookGuiS2CPacket::handle) - .add(); + /** + * TODO: Re-enable when fixed + * + * CHANNEL.messageBuilder(OpenBookGuiS2CPacket.class, index++, NetworkDirection.PLAY_TO_CLIENT) + * .decoder(OpenBookGuiS2CPacket::new) + * .encoder(OpenBookGuiS2CPacket::toBytes) + * .consumerMainThread(OpenBookGuiS2CPacket::handle) + * .add(); + */ Caterpillar.LOGGER.info("Registered {} packets!", index); } diff --git a/src/main/java/dev/the_fireplace/caterpillar/registry/CreativeModeTabRegistry.java b/src/main/java/dev/the_fireplace/caterpillar/registry/CreativeModeTabRegistry.java index 1ac5928a..75713553 100644 --- a/src/main/java/dev/the_fireplace/caterpillar/registry/CreativeModeTabRegistry.java +++ b/src/main/java/dev/the_fireplace/caterpillar/registry/CreativeModeTabRegistry.java @@ -14,7 +14,7 @@ public class CreativeModeTabRegistry { public static final DeferredRegister CREATIVE_MODE_TABS = DeferredRegister.create(Registries.CREATIVE_MODE_TAB, Caterpillar.MOD_ID); - public static final RegistryObject CATERPILLAR_TAB = CREATIVE_MODE_TABS.register("tutorial_tab", + public static final RegistryObject CATERPILLAR_TAB = CREATIVE_MODE_TABS.register(Caterpillar.MOD_ID, () -> CreativeModeTab.builder() .icon(() -> new ItemStack(BlockRegistry.DRILL_HEAD.get())) .title(Component.translatable("itemGroup." + Caterpillar.MOD_ID)) @@ -28,7 +28,11 @@ public class CreativeModeTabRegistry { output.accept(BlockRegistry.STORAGE.get()); output.accept(BlockRegistry.DECORATION.get()); output.accept(BlockRegistry.TRANSPORTER.get()); - output.accept(ItemRegistry.WRITABLE_PATTERN_BOOK.get()); + /** + * TODO: Re-enable when fixed + * + * output.accept(ItemRegistry.WRITABLE_PATTERN_BOOK.get()); + */ }) .build());