@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/world/inventory/ContainerPlayer.java
|
||||
+++ b/net/minecraft/world/inventory/ContainerPlayer.java
|
||||
@@ -13,6 +13,12 @@
|
||||
import net.minecraft.world.item.crafting.RecipeCrafting;
|
||||
import net.minecraft.world.item.crafting.RecipeHolder;
|
||||
import net.minecraft.world.level.World;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.network.chat.IChatBaseComponent;
|
||||
@@ -10,52 +10,38 @@
|
||||
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class ContainerPlayer extends ContainerRecipeBook<CraftingInput, RecipeCrafting> {
|
||||
public class ContainerPlayer extends AbstractCraftingMenu {
|
||||
|
||||
public static final int CONTAINER_ID = 0;
|
||||
@@ -36,15 +42,28 @@
|
||||
public static final MinecraftKey EMPTY_ARMOR_SLOT_SHIELD = MinecraftKey.withDefaultNamespace("item/empty_armor_slot_shield");
|
||||
private static final Map<EnumItemSlot, MinecraftKey> TEXTURE_EMPTY_SLOTS = Map.of(EnumItemSlot.FEET, ContainerPlayer.EMPTY_ARMOR_SLOT_BOOTS, EnumItemSlot.LEGS, ContainerPlayer.EMPTY_ARMOR_SLOT_LEGGINGS, EnumItemSlot.CHEST, ContainerPlayer.EMPTY_ARMOR_SLOT_CHESTPLATE, EnumItemSlot.HEAD, ContainerPlayer.EMPTY_ARMOR_SLOT_HELMET);
|
||||
@@ -40,9 +46,15 @@
|
||||
private static final EnumItemSlot[] SLOT_IDS = new EnumItemSlot[]{EnumItemSlot.HEAD, EnumItemSlot.CHEST, EnumItemSlot.LEGS, EnumItemSlot.FEET};
|
||||
- private final InventoryCrafting craftSlots = new TransientCraftingContainer(this, 2, 2);
|
||||
- private final InventoryCraftResult resultSlots = new InventoryCraftResult();
|
||||
+ // CraftBukkit start
|
||||
+ private final TransientCraftingContainer craftSlots;
|
||||
+ private final InventoryCraftResult resultSlots;
|
||||
+ // CraftBukkit end
|
||||
public final boolean active;
|
||||
private final EntityHuman owner;
|
||||
+ // CraftBukkit start
|
||||
+ private CraftInventoryView bukkitEntity = null;
|
||||
+ private PlayerInventory player;
|
||||
+ // CraftBukkit end
|
||||
|
||||
public ContainerPlayer(PlayerInventory playerinventory, boolean flag, final EntityHuman entityhuman) {
|
||||
super((Containers) null, 0);
|
||||
this.active = flag;
|
||||
this.owner = entityhuman;
|
||||
- super((Containers) null, 0, 2, 2);
|
||||
+ // CraftBukkit start
|
||||
+ this.resultSlots = new InventoryCraftResult(); // CraftBukkit - moved to before InventoryCrafting construction
|
||||
+ this.craftSlots = new TransientCraftingContainer(this, 2, 2, playerinventory.player); // CraftBukkit - pass player
|
||||
+ this.craftSlots.resultInventory = this.resultSlots; // CraftBukkit - let InventoryCrafting know about its result slot
|
||||
+ this.player = playerinventory; // CraftBukkit - save player
|
||||
+ super((Containers) null, 0, 2, 2, playerinventory); // CraftBukkit - save player
|
||||
+ setTitle(IChatBaseComponent.translatable("container.crafting")); // SPIGOT-4722: Allocate title for player inventory
|
||||
+ // CraftBukkit end
|
||||
this.addSlot(new SlotResult(playerinventory.player, this.craftSlots, this.resultSlots, 0, 154, 28));
|
||||
|
||||
int i;
|
||||
@@ -73,7 +92,7 @@
|
||||
this.addSlot(new Slot(playerinventory, i, 8 + i * 18, 142));
|
||||
this.active = flag;
|
||||
this.owner = entityhuman;
|
||||
this.addResultSlot(entityhuman, 154, 28);
|
||||
@@ -56,7 +68,7 @@
|
||||
}
|
||||
|
||||
this.addStandardInventorySlots(playerinventory, 8, 84);
|
||||
- this.addSlot(new Slot(this, playerinventory, 40, 77, 62) {
|
||||
+ this.addSlot(new Slot(playerinventory, 40, 77, 62) { // CraftBukkit - decompile error
|
||||
@Override
|
||||
public void setByPlayer(ItemStack itemstack, ItemStack itemstack1) {
|
||||
entityhuman.onEquipItem(EnumItemSlot.OFFHAND, itemstack1, itemstack);
|
||||
@@ -230,4 +249,17 @@
|
||||
public boolean shouldMoveToInventory(int i) {
|
||||
return i != this.getResultSlotIndex();
|
||||
@@ -192,4 +204,17 @@
|
||||
protected EntityHuman owner() {
|
||||
return this.owner;
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
@@ -66,7 +52,7 @@
|
||||
+ }
|
||||
+
|
||||
+ CraftInventoryCrafting inventory = new CraftInventoryCrafting(this.craftSlots, this.resultSlots);
|
||||
+ bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
|
||||
+ bukkitEntity = new CraftInventoryView(this.owner.getBukkitEntity(), inventory, this);
|
||||
+ return bukkitEntity;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
Reference in New Issue
Block a user