Update to Minecraft 1.20.3

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2023-12-06 03:40:00 +11:00
parent afdb1d9bc3
commit 8398e12b34
256 changed files with 2745 additions and 1911 deletions

View File

@@ -0,0 +1,62 @@
--- a/net/minecraft/world/level/block/entity/CrafterBlockEntity.java
+++ b/net/minecraft/world/level/block/entity/CrafterBlockEntity.java
@@ -21,6 +21,12 @@
import net.minecraft.world.level.block.CrafterBlock;
import net.minecraft.world.level.block.state.IBlockData;
+// CraftBukkit start
+import org.bukkit.Location;
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
+import org.bukkit.entity.HumanEntity;
+// CraftBukkit end
+
public class CrafterBlockEntity extends TileEntityLootable implements InventoryCrafting {
public static final int CONTAINER_WIDTH = 3;
@@ -33,6 +39,46 @@
private NonNullList<ItemStack> items;
public int craftingTicksRemaining;
protected final IContainerProperties containerData;
+ // CraftBukkit start - add fields and methods
+ public List<HumanEntity> transaction = new java.util.ArrayList<>();
+ private int maxStack = 1;
+
+ @Override
+ public List<ItemStack> getContents() {
+ return this.items;
+ }
+
+ @Override
+ public void onOpen(CraftHumanEntity who) {
+ transaction.add(who);
+ }
+
+ @Override
+ public void onClose(CraftHumanEntity who) {
+ transaction.remove(who);
+ }
+
+ @Override
+ public List<HumanEntity> getViewers() {
+ return transaction;
+ }
+
+ @Override
+ public int getMaxStackSize() {
+ return maxStack;
+ }
+
+ @Override
+ public void setMaxStackSize(int size) {
+ maxStack = size;
+ }
+
+ @Override
+ public Location getLocation() {
+ if (level == null) return null;
+ return new org.bukkit.Location(level.getWorld(), worldPosition.getX(), worldPosition.getY(), worldPosition.getZ());
+ }
+ // CraftBukkit end
public CrafterBlockEntity(BlockPosition blockposition, IBlockData iblockdata) {
super(TileEntityTypes.CRAFTER, blockposition, iblockdata);

View File

@@ -1,10 +1,11 @@
--- a/net/minecraft/world/level/block/entity/TileEntityJukeBox.java
+++ b/net/minecraft/world/level/block/entity/TileEntityJukeBox.java
@@ -24,6 +24,13 @@
@@ -22,6 +22,14 @@
import net.minecraft.world.phys.Vec3D;
import net.minecraft.world.ticks.ContainerSingleItem;
+// CraftBukkit start
+import java.util.Collections;
+import java.util.List;
+import org.bukkit.Location;
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
@@ -14,7 +15,7 @@
public class TileEntityJukeBox extends TileEntity implements Clearable, ContainerSingleItem {
private static final int SONG_END_PADDING = 20;
@@ -32,6 +39,42 @@
@@ -30,6 +38,42 @@
public long tickCount;
public long recordStartedTick;
public boolean isPlaying;
@@ -25,7 +26,7 @@
+
+ @Override
+ public List<ItemStack> getContents() {
+ return this.items;
+ return Collections.singletonList(item);
+ }
+
+ @Override
@@ -57,7 +58,7 @@
public TileEntityJukeBox(BlockPosition blockposition, IBlockData iblockdata) {
super(TileEntityTypes.JUKEBOX, blockposition, iblockdata);
@@ -152,7 +195,7 @@
@@ -150,7 +194,7 @@
@Override
public int getMaxStackSize() {
@@ -66,10 +67,10 @@
}
@Override
@@ -205,7 +248,11 @@
@@ -203,7 +247,11 @@
@VisibleForTesting
public void setRecordWithoutPlaying(ItemStack itemstack) {
this.items.set(0, itemstack);
this.item = itemstack;
- this.level.updateNeighborsAt(this.getBlockPos(), this.getBlockState().getBlock());
+ // CraftBukkit start - add null check for level
+ if (level != null) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/entity/TileEntitySign.java
+++ b/net/minecraft/world/level/block/entity/TileEntitySign.java
@@ -31,7 +31,17 @@
@@ -33,7 +33,17 @@
import net.minecraft.world.phys.Vec3D;
import org.slf4j.Logger;
@@ -19,7 +19,7 @@
private static final Logger LOGGER = LogUtils.getLogger();
private static final int MAX_TEXT_LINE_WIDTH = 90;
@@ -100,7 +110,7 @@
@@ -98,7 +108,7 @@
@Override
protected void saveAdditional(NBTTagCompound nbttagcompound) {
super.saveAdditional(nbttagcompound);
@@ -28,7 +28,7 @@
Logger logger = TileEntitySign.LOGGER;
Objects.requireNonNull(logger);
@@ -119,7 +129,7 @@
@@ -117,7 +127,7 @@
@Override
public void load(NBTTagCompound nbttagcompound) {
super.load(nbttagcompound);
@@ -37,7 +37,7 @@
Logger logger;
if (nbttagcompound.contains("front_text")) {
@@ -173,12 +183,13 @@
@@ -171,12 +181,13 @@
public void updateSignText(EntityHuman entityhuman, boolean flag, List<FilteredText> list) {
if (!this.isWaxed() && entityhuman.getUUID().equals(this.getPlayerWhoMayEdit()) && this.level != null) {
this.updateText((signtext) -> {
@@ -52,7 +52,7 @@
}
}
@@ -188,7 +199,8 @@
@@ -186,7 +197,8 @@
return this.setText((SignText) unaryoperator.apply(signtext), flag);
}
@@ -62,7 +62,7 @@
for (int i = 0; i < list.size(); ++i) {
FilteredText filteredtext = (FilteredText) list.get(i);
ChatModifier chatmodifier = signtext.getMessage(i, entityhuman.isTextFilteringEnabled()).getStyle();
@@ -200,6 +212,29 @@
@@ -198,6 +210,29 @@
}
}
@@ -92,7 +92,7 @@
return signtext;
}
@@ -250,11 +285,37 @@
@@ -248,11 +283,37 @@
return flag1;
}
@@ -132,7 +132,7 @@
}
@Override
@@ -283,7 +344,7 @@
@@ -281,7 +342,7 @@
private void markUpdated() {
this.setChanged();

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/entity/TileEntitySkull.java
+++ b/net/minecraft/world/level/block/entity/TileEntitySkull.java
@@ -173,6 +173,16 @@
@@ -194,6 +194,16 @@
if (!SystemUtils.isBlank(s)) {
resolveGameProfile(nbttagcompound, s);