From 09c806e5cfc683d453eb7a3c10c853d3da5c9e38 Mon Sep 17 00:00:00 2001 From: jiink Date: Thu, 18 Apr 2024 16:35:37 -0700 Subject: [PATCH] Make screen name more general --- ...FurnaceScreen.java => DisposableFurnaceScreen.java} | 4 ++-- .../jiink/smeltinginapinch/SmeltingInAPinchClient.java | 2 +- ...andler.java => DisposableFurnaceScreenHandler.java} | 10 +++++----- .../java/jiink/smeltinginapinch/SmeltingInAPinch.java | 6 +++--- .../smeltinginapinch/WoodenFurnaceBlockEntity.java | 4 +--- 5 files changed, 12 insertions(+), 14 deletions(-) rename src/client/java/jiink/smeltinginapinch/{WoodenFurnaceScreen.java => DisposableFurnaceScreen.java} (91%) rename src/main/java/jiink/smeltinginapinch/{WoodenFurnaceScreenHandler.java => DisposableFurnaceScreenHandler.java} (91%) diff --git a/src/client/java/jiink/smeltinginapinch/WoodenFurnaceScreen.java b/src/client/java/jiink/smeltinginapinch/DisposableFurnaceScreen.java similarity index 91% rename from src/client/java/jiink/smeltinginapinch/WoodenFurnaceScreen.java rename to src/client/java/jiink/smeltinginapinch/DisposableFurnaceScreen.java index 785d5f0..f7eaa6c 100644 --- a/src/client/java/jiink/smeltinginapinch/WoodenFurnaceScreen.java +++ b/src/client/java/jiink/smeltinginapinch/DisposableFurnaceScreen.java @@ -9,11 +9,11 @@ import net.minecraft.text.Text; import net.minecraft.util.Identifier; -public class WoodenFurnaceScreen extends HandledScreen { +public class DisposableFurnaceScreen extends HandledScreen { private static final Identifier TEXTURE = new Identifier(SmeltingInAPinch.MOD_ID, "textures/gui/wooden_furnace_gui.png"); - public WoodenFurnaceScreen(WoodenFurnaceScreenHandler handler, PlayerInventory inventory, Text title) { + public DisposableFurnaceScreen(DisposableFurnaceScreenHandler handler, PlayerInventory inventory, Text title) { super(handler, inventory, title); } diff --git a/src/client/java/jiink/smeltinginapinch/SmeltingInAPinchClient.java b/src/client/java/jiink/smeltinginapinch/SmeltingInAPinchClient.java index 58ea806..07f68de 100644 --- a/src/client/java/jiink/smeltinginapinch/SmeltingInAPinchClient.java +++ b/src/client/java/jiink/smeltinginapinch/SmeltingInAPinchClient.java @@ -13,6 +13,6 @@ public void onInitializeClient() { // This entrypoint is suitable for setting up client-specific logic, such as rendering. // Make sure screen handler and screen are linked together - HandledScreens.register(SmeltingInAPinch.WOODEN_FURNACE_SCREEN_HANDLER, WoodenFurnaceScreen::new); + HandledScreens.register(SmeltingInAPinch.DISPOSABLE_FURNACE_SCREEN_HANDLER, DisposableFurnaceScreen::new); } } \ No newline at end of file diff --git a/src/main/java/jiink/smeltinginapinch/WoodenFurnaceScreenHandler.java b/src/main/java/jiink/smeltinginapinch/DisposableFurnaceScreenHandler.java similarity index 91% rename from src/main/java/jiink/smeltinginapinch/WoodenFurnaceScreenHandler.java rename to src/main/java/jiink/smeltinginapinch/DisposableFurnaceScreenHandler.java index 332ab22..7ee73a4 100644 --- a/src/main/java/jiink/smeltinginapinch/WoodenFurnaceScreenHandler.java +++ b/src/main/java/jiink/smeltinginapinch/DisposableFurnaceScreenHandler.java @@ -15,7 +15,7 @@ import net.minecraft.screen.slot.Slot; import net.minecraft.world.World; -public class WoodenFurnaceScreenHandler extends ScreenHandler { +public class DisposableFurnaceScreenHandler extends ScreenHandler { private final Inventory inventory; private final PropertyDelegate propertyDelegate; @@ -23,14 +23,14 @@ public class WoodenFurnaceScreenHandler extends ScreenHandler { protected final World world; private final RecipeType recipeType = RecipeType.SMELTING; - public WoodenFurnaceScreenHandler(int syncId, PlayerInventory inventory, PacketByteBuf buf) { + public DisposableFurnaceScreenHandler(int syncId, PlayerInventory inventory, PacketByteBuf buf) { this(syncId, inventory, inventory.player.getWorld().getBlockEntity(buf.readBlockPos()), new ArrayPropertyDelegate(5)); } - public WoodenFurnaceScreenHandler(int syncId, PlayerInventory playerInventory, BlockEntity blockEntity, - PropertyDelegate arrayPropertyDelegate) { - super(SmeltingInAPinch.WOODEN_FURNACE_SCREEN_HANDLER, syncId); + public DisposableFurnaceScreenHandler(int syncId, PlayerInventory playerInventory, BlockEntity blockEntity, + PropertyDelegate arrayPropertyDelegate) { + super(SmeltingInAPinch.DISPOSABLE_FURNACE_SCREEN_HANDLER, syncId); checkSize(((Inventory) blockEntity), 2); this.inventory = ((Inventory) blockEntity); playerInventory.onOpen(playerInventory.player); diff --git a/src/main/java/jiink/smeltinginapinch/SmeltingInAPinch.java b/src/main/java/jiink/smeltinginapinch/SmeltingInAPinch.java index a929a23..ee79e08 100644 --- a/src/main/java/jiink/smeltinginapinch/SmeltingInAPinch.java +++ b/src/main/java/jiink/smeltinginapinch/SmeltingInAPinch.java @@ -64,13 +64,13 @@ public class SmeltingInAPinch implements ModInitializer { new Identifier(MOD_ID, "wooden_furnace_block_entity"), FabricBlockEntityTypeBuilder.create(WoodenFurnaceBlockEntity::new, WOODEN_FURNACE_BLOCK).build() ); - public static final ScreenHandlerType WOODEN_FURNACE_SCREEN_HANDLER; + public static final ScreenHandlerType DISPOSABLE_FURNACE_SCREEN_HANDLER; static { - WOODEN_FURNACE_SCREEN_HANDLER = Registry.register( + DISPOSABLE_FURNACE_SCREEN_HANDLER = Registry.register( Registries.SCREEN_HANDLER, new Identifier(MOD_ID, "wooden_furnace_screen_handler"), - new ExtendedScreenHandlerType<>(WoodenFurnaceScreenHandler::new) + new ExtendedScreenHandlerType<>(DisposableFurnaceScreenHandler::new) ); } diff --git a/src/main/java/jiink/smeltinginapinch/WoodenFurnaceBlockEntity.java b/src/main/java/jiink/smeltinginapinch/WoodenFurnaceBlockEntity.java index f07c0a3..0dae146 100644 --- a/src/main/java/jiink/smeltinginapinch/WoodenFurnaceBlockEntity.java +++ b/src/main/java/jiink/smeltinginapinch/WoodenFurnaceBlockEntity.java @@ -13,7 +13,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NbtCompound; import net.minecraft.network.PacketByteBuf; -import net.minecraft.particle.ParticleTypes; import net.minecraft.recipe.RecipeEntry; import net.minecraft.recipe.RecipeType; import net.minecraft.recipe.SmeltingRecipe; @@ -28,7 +27,6 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.world.World; -import net.minecraft.server.world.ServerWorld; import net.minecraft.world.WorldEvents; import java.util.Optional; @@ -87,7 +85,7 @@ public Text getDisplayName() { @Override public ScreenHandler createMenu(int syncId, PlayerInventory playerInventory, PlayerEntity player) { - return new WoodenFurnaceScreenHandler(syncId, playerInventory, this, this.propertyDelegate); + return new DisposableFurnaceScreenHandler(syncId, playerInventory, this, this.propertyDelegate); } @Override