Skip to content

Commit

Permalink
Make screen name more general
Browse files Browse the repository at this point in the history
  • Loading branch information
jiink committed Apr 18, 2024
1 parent 448b9fa commit 09c806e
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;

public class WoodenFurnaceScreen extends HandledScreen<WoodenFurnaceScreenHandler> {
public class DisposableFurnaceScreen extends HandledScreen<DisposableFurnaceScreenHandler> {

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,22 @@
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;
public final WoodenFurnaceBlockEntity blockEntity;
protected final World world;
private final RecipeType<SmeltingRecipe> 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);
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/jiink/smeltinginapinch/SmeltingInAPinch.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<WoodenFurnaceScreenHandler> WOODEN_FURNACE_SCREEN_HANDLER;
public static final ScreenHandlerType<DisposableFurnaceScreenHandler> 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)
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 09c806e

Please sign in to comment.