3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-21 05:50:05 +01:00
Paper/nms-patches/ContainerFurnace.patch

71 Zeilen
2.6 KiB
Diff

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/ContainerFurnace.java
+++ b/net/minecraft/server/ContainerFurnace.java
2019-04-23 04:00:00 +02:00
@@ -1,5 +1,10 @@
package net.minecraft.server;
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftInventoryFurnace;
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
+// CraftBukkit end
2019-04-23 04:00:00 +02:00
+
public abstract class ContainerFurnace extends ContainerRecipeBook<IInventory> {
2019-04-23 04:00:00 +02:00
private final IInventory furnace;
2020-08-11 23:00:00 +02:00
@@ -8,6 +13,22 @@
2019-04-23 04:00:00 +02:00
private final Recipes<? extends RecipeCooking> f;
2020-08-11 23:00:00 +02:00
private final RecipeBookType g;
2015-02-26 23:41:06 +01:00
+ // CraftBukkit start
+ private CraftInventoryView bukkitEntity = null;
+ private PlayerInventory player;
+
+ @Override
+ public CraftInventoryView getBukkitView() {
+ if (bukkitEntity != null) {
+ return bukkitEntity;
+ }
+
+ CraftInventoryFurnace inventory = new CraftInventoryFurnace((TileEntityFurnace) this.furnace);
+ bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
+ return bukkitEntity;
+ }
2015-02-26 23:41:06 +01:00
+ // CraftBukkit end
+
2020-08-11 23:00:00 +02:00
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));
2019-04-23 04:00:00 +02:00
}
2020-08-11 23:00:00 +02:00
@@ -24,6 +45,7 @@
this.a(new Slot(iinventory, 0, 56, 17));
2019-04-23 04:00:00 +02:00
this.a((Slot) (new SlotFurnaceFuel(this, iinventory, 1, 56, 53)));
this.a((Slot) (new SlotFurnaceResult(playerinventory.player, iinventory, 2, 116, 35)));
+ this.player = playerinventory; // CraftBukkit - save player
2019-04-23 04:00:00 +02:00
int j;
2020-08-11 23:00:00 +02:00
@@ -55,7 +77,7 @@
2019-04-23 04:00:00 +02:00
@Override
public void a(boolean flag, IRecipe<?> irecipe, EntityPlayer entityplayer) {
- (new AutoRecipeFurnace<>(this)).a(entityplayer, irecipe, flag);
+ (new AutoRecipeFurnace(this)).a(entityplayer, irecipe, flag); // CraftBukkit - decompile error
}
2019-04-23 04:00:00 +02:00
@Override
2020-08-11 23:00:00 +02:00
@@ -80,6 +102,7 @@
2019-04-23 04:00:00 +02:00
@Override
2017-09-18 12:00:00 +02:00
public boolean canUse(EntityHuman entityhuman) {
+ if (!this.checkReachable) return true; // CraftBukkit
return this.furnace.a(entityhuman);
}
2020-08-11 23:00:00 +02:00
@@ -135,7 +158,7 @@
2019-04-23 04:00:00 +02:00
}
protected boolean a(ItemStack itemstack) {
2019-05-27 22:30:00 +02:00
- return this.c.getCraftingManager().craft(this.f, new InventorySubcontainer(new ItemStack[]{itemstack}), this.c).isPresent();
+ return this.c.getCraftingManager().craft((Recipes<RecipeCooking>) this.f, new InventorySubcontainer(new ItemStack[]{itemstack}), this.c).isPresent(); // Eclipse fail
2019-04-23 04:00:00 +02:00
}
protected boolean b(ItemStack itemstack) {