Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-20 21:40:06 +01:00
71 Zeilen
2.6 KiB
Diff
71 Zeilen
2.6 KiB
Diff
--- a/net/minecraft/server/ContainerFurnace.java
|
|
+++ b/net/minecraft/server/ContainerFurnace.java
|
|
@@ -1,5 +1,10 @@
|
|
package net.minecraft.server;
|
|
|
|
+// CraftBukkit start
|
|
+import org.bukkit.craftbukkit.inventory.CraftInventoryFurnace;
|
|
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
|
|
+// CraftBukkit end
|
|
+
|
|
public abstract class ContainerFurnace extends ContainerRecipeBook<IInventory> {
|
|
|
|
private final IInventory furnace;
|
|
@@ -8,6 +13,22 @@
|
|
private final Recipes<? extends RecipeCooking> f;
|
|
private final RecipeBookType g;
|
|
|
|
+ // 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;
|
|
+ }
|
|
+ // 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));
|
|
}
|
|
@@ -24,6 +45,7 @@
|
|
this.a(new Slot(iinventory, 0, 56, 17));
|
|
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
|
|
|
|
int j;
|
|
|
|
@@ -55,7 +77,7 @@
|
|
|
|
@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
|
|
}
|
|
|
|
@Override
|
|
@@ -80,6 +102,7 @@
|
|
|
|
@Override
|
|
public boolean canUse(EntityHuman entityhuman) {
|
|
+ if (!this.checkReachable) return true; // CraftBukkit
|
|
return this.furnace.a(entityhuman);
|
|
}
|
|
|
|
@@ -135,7 +158,7 @@
|
|
}
|
|
|
|
protected boolean a(ItemStack itemstack) {
|
|
- 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
|
|
}
|
|
|
|
protected boolean b(ItemStack itemstack) {
|