All smithing inventories are now the new smithing inventory

This commit is contained in:
md_5 2023-07-01 09:35:39 +10:00
parent 9a919a1438
commit 31fe848d6e
No known key found for this signature in database
GPG Key ID: E8E901AC7C617C11
5 changed files with 4 additions and 51 deletions

View File

@ -51,7 +51,7 @@
+ return bukkitEntity; + return bukkitEntity;
+ } + }
+ +
+ org.bukkit.craftbukkit.inventory.CraftInventory inventory = new org.bukkit.craftbukkit.inventory.CraftInventorySmithingNew( + org.bukkit.craftbukkit.inventory.CraftInventory inventory = new org.bukkit.craftbukkit.inventory.CraftInventorySmithing(
+ access.getLocation(), this.inputSlots, this.resultSlots); + access.getLocation(), this.inputSlots, this.resultSlots);
+ bukkitEntity = new CraftInventoryView(this.player.getBukkitEntity(), inventory, this); + bukkitEntity = new CraftInventoryView(this.player.getBukkitEntity(), inventory, this);
+ return bukkitEntity; + return bukkitEntity;

View File

@ -198,7 +198,6 @@ public class CraftContainer extends Container {
delegate = new ContainerHopper(windowId, bottom, top); delegate = new ContainerHopper(windowId, bottom, top);
break; break;
case ANVIL: case ANVIL:
case SMITHING:
setupAnvil(top, bottom); // SPIGOT-6783 - manually set up slots so we can use the delegated inventory and not the automatically created one setupAnvil(top, bottom); // SPIGOT-6783 - manually set up slots so we can use the delegated inventory and not the automatically created one
break; break;
case BEACON: case BEACON:
@ -231,6 +230,7 @@ public class CraftContainer extends Container {
case MERCHANT: case MERCHANT:
delegate = new ContainerMerchant(windowId, bottom); delegate = new ContainerMerchant(windowId, bottom);
break; break;
case SMITHING:
case SMITHING_NEW: case SMITHING_NEW:
setupSmithing(top, bottom); // SPIGOT-6783 - manually set up slots so we can use the delegated inventory and not the automatically created one setupSmithing(top, bottom); // SPIGOT-6783 - manually set up slots so we can use the delegated inventory and not the automatically created one
break; break;

View File

@ -505,8 +505,6 @@ public class CraftInventory implements Inventory {
return InventoryType.COMPOSTER; return InventoryType.COMPOSTER;
} else if (inventory instanceof TileEntityJukeBox) { } else if (inventory instanceof TileEntityJukeBox) {
return InventoryType.JUKEBOX; return InventoryType.JUKEBOX;
} else if (this instanceof CraftInventorySmithingNew) {
return InventoryType.SMITHING_NEW;
} else { } else {
return InventoryType.CHEST; return InventoryType.CHEST;
} }

View File

@ -29,12 +29,12 @@ public class CraftInventorySmithing extends CraftResultInventory implements Smit
@Override @Override
public ItemStack getResult() { public ItemStack getResult() {
return getItem(2); return getItem(3);
} }
@Override @Override
public void setResult(ItemStack item) { public void setResult(ItemStack item) {
setItem(2, item); setItem(3, item);
} }
@Override @Override

View File

@ -1,45 +0,0 @@
package org.bukkit.craftbukkit.inventory;
import net.minecraft.world.IInventory;
import net.minecraft.world.inventory.InventoryCraftResult;
import net.minecraft.world.item.crafting.IRecipe;
import org.bukkit.Location;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.Recipe;
import org.bukkit.inventory.SmithingInventory;
public class CraftInventorySmithingNew extends CraftResultInventory implements SmithingInventory {
private final Location location;
public CraftInventorySmithingNew(Location location, IInventory inventory, InventoryCraftResult resultInventory) {
super(inventory, resultInventory);
this.location = location;
}
@Override
public InventoryCraftResult getResultInventory() {
return (InventoryCraftResult) super.getResultInventory();
}
@Override
public Location getLocation() {
return location;
}
@Override
public ItemStack getResult() {
return getItem(3);
}
@Override
public void setResult(ItemStack item) {
setItem(3, item);
}
@Override
public Recipe getRecipe() {
IRecipe recipe = getResultInventory().getRecipeUsed();
return (recipe == null) ? null : recipe.toBukkitRecipe();
}
}