PaperMC/paper-server/nms-patches/net/minecraft/world/inventory/ContainerFurnace.patch
CraftBukkit/Spigot eed041d629 Update to Minecraft 1.21
By: md_5 <git@md-5.net>
2024-06-14 01:05:00 +10:00

53 lines
2.1 KiB
Diff

--- a/net/minecraft/world/inventory/ContainerFurnace.java
+++ b/net/minecraft/world/inventory/ContainerFurnace.java
@@ -14,6 +14,11 @@
import net.minecraft.world.level.World;
import net.minecraft.world.level.block.entity.TileEntityFurnace;
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftInventoryFurnace;
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
+// CraftBukkit end
+
public abstract class ContainerFurnace extends ContainerRecipeBook<SingleRecipeInput, RecipeCooking> {
public static final int INGREDIENT_SLOT = 0;
@@ -31,6 +36,22 @@
private final Recipes<? extends RecipeCooking> recipeType;
private final RecipeBookType recipeBookType;
+ // CraftBukkit start
+ private CraftInventoryView bukkitEntity = null;
+ private PlayerInventory player;
+
+ @Override
+ public CraftInventoryView getBukkitView() {
+ if (bukkitEntity != null) {
+ return bukkitEntity;
+ }
+
+ CraftInventoryFurnace inventory = new CraftInventoryFurnace((TileEntityFurnace) this.container);
+ bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
+ return bukkitEntity;
+ }
+ // CraftBukkit end
+
protected ContainerFurnace(Containers<?> containers, Recipes<? extends RecipeCooking> recipes, RecipeBookType recipebooktype, int i, PlayerInventory playerinventory) {
this(containers, recipes, recipebooktype, i, playerinventory, new InventorySubcontainer(3), new ContainerProperties(4));
}
@@ -47,6 +68,7 @@
this.addSlot(new Slot(iinventory, 0, 56, 17));
this.addSlot(new SlotFurnaceFuel(this, iinventory, 1, 56, 53));
this.addSlot(new SlotFurnaceResult(playerinventory.player, iinventory, 2, 116, 35));
+ this.player = playerinventory; // CraftBukkit - save player
int j;
@@ -104,6 +126,7 @@
@Override
public boolean stillValid(EntityHuman entityhuman) {
+ if (!this.checkReachable) return true; // CraftBukkit
return this.container.stillValid(entityhuman);
}