Update to Minecraft 1.19

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2022-06-08 02:00:00 +10:00
parent 91d9aa9a89
commit 25f3b50f6b
332 changed files with 3628 additions and 2559 deletions

View File

@@ -65,16 +65,7 @@
public void removeSlotListener(ICrafting icrafting) {
this.containerListeners.remove(icrafting);
}
@@ -325,7 +369,7 @@
}
public ItemStack quickMoveStack(EntityHuman entityhuman, int i) {
- return ((Slot) this.slots.get(i)).getItem();
+ return ItemStack.EMPTY; // CraftBukkit - previous implementation was useless and broken
}
public void clicked(int i, int j, InventoryClickType inventoryclicktype, EntityHuman entityhuman) {
@@ -381,7 +425,7 @@
@@ -379,7 +423,7 @@
}
} else if (this.quickcraftStatus == 2) {
if (!this.quickcraftSlots.isEmpty()) {
@@ -83,7 +74,7 @@
k = ((Slot) this.quickcraftSlots.iterator().next()).index;
this.resetQuickCraft();
this.doClick(k, this.quickcraftType, InventoryClickType.PICKUP, entityhuman);
@@ -392,6 +436,7 @@
@@ -390,6 +434,7 @@
l = this.getCarried().getCount();
Iterator iterator = this.quickcraftSlots.iterator();
@@ -91,7 +82,7 @@
while (iterator.hasNext()) {
Slot slot1 = (Slot) iterator.next();
ItemStack itemstack2 = this.getCarried();
@@ -408,12 +453,48 @@
@@ -406,12 +451,48 @@
}
l -= itemstack3.getCount() - j1;
@@ -143,7 +134,7 @@
}
this.resetQuickCraft();
@@ -431,8 +512,11 @@
@@ -429,8 +510,11 @@
if (i == -999) {
if (!this.getCarried().isEmpty()) {
if (clickaction == ClickAction.PRIMARY) {
@@ -156,7 +147,7 @@
} else {
entityhuman.drop(this.getCarried().split(1), true);
}
@@ -495,6 +579,15 @@
@@ -493,6 +577,15 @@
}
slot.setChanged();
@@ -172,7 +163,7 @@
}
} else {
Slot slot2;
@@ -602,13 +695,14 @@
@@ -600,13 +693,14 @@
ItemStack itemstack = this.getCarried();
if (!itemstack.isEmpty()) {
@@ -188,7 +179,7 @@
}
}
@@ -822,6 +916,11 @@
@@ -820,6 +914,11 @@
}
public ItemStack getCarried() {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/inventory/ContainerAnvil.java
+++ b/net/minecraft/world/inventory/ContainerAnvil.java
@@ -17,12 +17,16 @@
@@ -17,6 +17,10 @@
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
@@ -11,13 +11,6 @@
public class ContainerAnvil extends ContainerAnvilAbstract {
private static final Logger LOGGER = LogUtils.getLogger();
private static final boolean DEBUG_COST = false;
public static final int MAX_NAME_LENGTH = 50;
- private int repairItemCountCost;
+ public int repairItemCountCost; // PAIL private -> public
public String itemName;
public final ContainerProperty cost;
private static final int COST_FAIL = 0;
@@ -32,6 +36,11 @@
private static final int COST_REPAIR_SACRIFICE = 2;
private static final int COST_INCOMPATIBLE_PENALTY = 1;

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/inventory/ContainerBeacon.java
+++ b/net/minecraft/world/inventory/ContainerBeacon.java
@@ -10,6 +10,11 @@
@@ -11,6 +11,11 @@
import net.minecraft.world.level.World;
import net.minecraft.world.level.block.Blocks;
@@ -12,7 +12,7 @@
public class ContainerBeacon extends Container {
private static final int PAYMENT_SLOT = 0;
@@ -23,6 +28,10 @@
@@ -24,6 +29,10 @@
private final ContainerBeacon.SlotBeacon paymentSlot;
private final ContainerAccess access;
private final IContainerProperties beaconData;
@@ -23,7 +23,7 @@
public ContainerBeacon(int i, IInventory iinventory) {
this(i, iinventory, new ContainerProperties(3), ContainerAccess.NULL);
@@ -30,6 +39,7 @@
@@ -31,6 +40,7 @@
public ContainerBeacon(int i, IInventory iinventory, IContainerProperties icontainerproperties, ContainerAccess containeraccess) {
super(Containers.BEACON, i);
@@ -31,7 +31,7 @@
this.beacon = new InventorySubcontainer(1) {
@Override
public boolean canPlaceItem(int j, ItemStack itemstack) {
@@ -79,6 +89,7 @@
@@ -80,6 +90,7 @@
@Override
public boolean stillValid(EntityHuman entityhuman) {
@@ -39,7 +39,7 @@
return stillValid(this.access, entityhuman, Blocks.BEACON);
}
@@ -179,4 +190,17 @@
@@ -180,4 +191,17 @@
return 1;
}
}

View File

@@ -45,7 +45,7 @@
+ }
+ // CraftBukkit end
};
this.random = new Random();
this.random = RandomSource.create();
this.enchantmentSeed = ContainerProperty.standalone();
@@ -94,6 +120,9 @@
this.addDataSlot(ContainerProperty.shared(this.levelClue, 0));

View File

@@ -73,7 +73,7 @@
ItemStack itemstack = this.lectern.removeItemNoUpdate(0);
this.lectern.setChanged();
@@ -81,6 +116,8 @@
@@ -86,6 +121,8 @@
@Override
public boolean stillValid(EntityHuman entityhuman) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/inventory/ContainerLoom.java
+++ b/net/minecraft/world/inventory/ContainerLoom.java
@@ -18,8 +18,30 @@
@@ -24,8 +24,30 @@
import net.minecraft.world.level.block.entity.EnumBannerPatternType;
import net.minecraft.world.level.block.entity.TileEntityTypes;
@@ -28,10 +28,10 @@
+ return bukkitEntity;
+ }
+ // CraftBukkit end
private static final int PATTERN_NOT_SET = -1;
private static final int INV_SLOT_START = 4;
private static final int INV_SLOT_END = 31;
private static final int USE_ROW_SLOT_START = 31;
@@ -51,6 +73,13 @@
@@ -60,6 +82,13 @@
ContainerLoom.this.slotsChanged(this);
ContainerLoom.this.slotUpdateListener.run();
}
@@ -45,7 +45,7 @@
};
this.outputContainer = new InventorySubcontainer(1) {
@Override
@@ -58,6 +87,13 @@
@@ -67,6 +96,13 @@
super.setChanged();
ContainerLoom.this.slotUpdateListener.run();
}
@@ -59,31 +59,28 @@
};
this.access = containeraccess;
this.bannerSlot = this.addSlot(new Slot(this.inputContainer, 0, 13, 26) {
@@ -118,6 +154,7 @@
@@ -127,10 +163,12 @@
}
this.addDataSlot(this.selectedBannerPatternIndex);
+ player = (Player) playerinventory.player.getBukkitEntity(); // CraftBukkit
}
public int getSelectedBannerPatternIndex() {
@@ -126,6 +163,7 @@
@Override
public boolean stillValid(EntityHuman entityhuman) {
+ if (!this.checkReachable) return true; // CraftBukkit
return stillValid(this.access, entityhuman, Blocks.LOOM);
}
@@ -248,6 +286,11 @@
@@ -304,6 +342,11 @@
if (nbttagcompound != null && nbttagcompound.contains("Patterns", 9)) {
nbttaglist = nbttagcompound.getList("Patterns", 10);
+ // CraftBukkit start
+ while (nbttaglist.size() > 20) {
+ nbttaglist.remove(20);
+ }
+ // CraftBukkit end
} else {
nbttaglist = new NBTTagList();
if (nbttagcompound == null) {
if (nbttagcompound != null && nbttagcompound.contains("Patterns", 9)) {
nbttaglist = nbttagcompound.getList("Patterns", 10);
+ // CraftBukkit start
+ while (nbttaglist.size() > 20) {
+ nbttaglist.remove(20);
+ }
+ // CraftBukkit end
} else {
nbttaglist = new NBTTagList();
if (nbttagcompound == null) {

View File

@@ -5,7 +5,7 @@
import net.minecraft.world.item.enchantment.EnchantmentManager;
+// CraftBukkit start
+import net.minecraft.network.chat.ChatMessage;
+import net.minecraft.network.chat.IChatBaseComponent;
+import org.bukkit.craftbukkit.inventory.CraftInventoryCrafting;
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
+// CraftBukkit end
@@ -30,7 +30,7 @@
+ private PlayerInventory player;
+ // CraftBukkit end
public ContainerPlayer(PlayerInventory playerinventory, boolean flag, EntityHuman entityhuman) {
public ContainerPlayer(PlayerInventory playerinventory, boolean flag, final EntityHuman entityhuman) {
super((Containers) null, 0);
this.active = flag;
this.owner = entityhuman;
@@ -39,12 +39,12 @@
+ this.craftSlots = new InventoryCrafting(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
+ setTitle(new ChatMessage("container.crafting")); // SPIGOT-4722: Allocate title for player inventory
+ 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;
@@ -242,4 +261,17 @@
@@ -250,4 +269,17 @@
public boolean shouldMoveToInventory(int i) {
return i != this.getResultSlotIndex();
}