Update to Minecraft 1.19.3

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2022-12-08 03:00:00 +11:00
parent a13136ada2
commit 8b26bb8f3e
305 changed files with 3331 additions and 2864 deletions

View File

@@ -0,0 +1,66 @@
--- a/net/minecraft/world/level/block/entity/ChiseledBookShelfBlockEntity.java
+++ b/net/minecraft/world/level/block/entity/ChiseledBookShelfBlockEntity.java
@@ -17,12 +17,54 @@
import net.minecraft.world.level.block.state.properties.BlockStateBoolean;
import org.slf4j.Logger;
+// CraftBukkit start
+import java.util.List;
+import org.bukkit.Location;
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
+import org.bukkit.entity.HumanEntity;
+// CraftBukkit end
+
public class ChiseledBookShelfBlockEntity extends TileEntity implements IInventory {
public static final int MAX_BOOKS_IN_STORAGE = 6;
private static final Logger LOGGER = LogUtils.getLogger();
private final NonNullList<ItemStack> items;
public int lastInteractedSlot;
+ // 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 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 ChiseledBookShelfBlockEntity(BlockPosition blockposition, IBlockData iblockdata) {
super(TileEntityTypes.CHISELED_BOOKSHELF, blockposition, iblockdata);
@@ -113,7 +155,7 @@
@Override
public int getMaxStackSize() {
- return 1;
+ return maxStack; // CraftBukkit
}
@Override

View File

@@ -48,5 +48,5 @@
+ }
+ // CraftBukkit end
private NonNullList<ItemStack> items;
public ContainerOpenersCounter openersCounter;
public final ContainerOpenersCounter openersCounter;

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/entity/TileEntityBeacon.java
+++ b/net/minecraft/world/level/block/entity/TileEntityBeacon.java
@@ -37,6 +37,11 @@
@@ -38,6 +38,11 @@
import net.minecraft.world.level.levelgen.HeightMap;
import net.minecraft.world.phys.AxisAlignedBB;
@@ -9,10 +9,10 @@
+import org.bukkit.potion.PotionEffect;
+// CraftBukkit end
+
public class TileEntityBeacon extends TileEntity implements ITileInventory {
public class TileEntityBeacon extends TileEntity implements ITileInventory, INamableTileEntity {
private static final int MAX_LEVELS = 4;
@@ -59,6 +64,15 @@
@@ -61,6 +66,15 @@
public IChatBaseComponent name;
public ChestLock lockKey;
private final IContainerProperties dataAccess;
@@ -28,7 +28,7 @@
public TileEntityBeacon(BlockPosition blockposition, IBlockData iblockdata) {
super(TileEntityTypes.BEACON, blockposition, iblockdata);
@@ -234,39 +248,78 @@
@@ -236,39 +250,78 @@
super.setRemoved();
}
@@ -117,7 +117,7 @@
public static void playSound(World world, BlockPosition blockposition, SoundEffect soundeffect) {
world.playSound((EntityHuman) null, blockposition, soundeffect, SoundCategory.BLOCKS, 1.0F, 1.0F);
}
@@ -295,8 +348,11 @@
@@ -297,8 +350,11 @@
@Override
public void load(NBTTagCompound nbttagcompound) {
super.load(nbttagcompound);

View File

@@ -13,24 +13,24 @@
public class TileEntityCampfire extends TileEntity implements Clearable {
private static final int BURN_COOL_SPEED = 2;
@@ -58,6 +64,20 @@
return recipecampfire.assemble(inventorysubcontainer);
@@ -59,6 +65,20 @@
}).orElse(itemstack);
+ // CraftBukkit start - fire BlockCookEvent
+ CraftItemStack source = CraftItemStack.asCraftMirror(itemstack);
+ org.bukkit.inventory.ItemStack result = CraftItemStack.asBukkitCopy(itemstack1);
if (itemstack1.isItemEnabled(world.enabledFeatures())) {
+ // CraftBukkit start - fire BlockCookEvent
+ CraftItemStack source = CraftItemStack.asCraftMirror(itemstack);
+ org.bukkit.inventory.ItemStack result = CraftItemStack.asBukkitCopy(itemstack1);
+
+ BlockCookEvent blockCookEvent = new BlockCookEvent(CraftBlock.at(world, blockposition), source, result);
+ world.getCraftServer().getPluginManager().callEvent(blockCookEvent);
+ BlockCookEvent blockCookEvent = new BlockCookEvent(CraftBlock.at(world, blockposition), source, result);
+ world.getCraftServer().getPluginManager().callEvent(blockCookEvent);
+
+ if (blockCookEvent.isCancelled()) {
+ return;
+ }
+ if (blockCookEvent.isCancelled()) {
+ return;
+ }
+
+ result = blockCookEvent.getResult();
+ itemstack1 = CraftItemStack.asNMSCopy(result);
+ // CraftBukkit end
InventoryUtils.dropItemStack(world, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), itemstack1);
tileentitycampfire.items.set(i, ItemStack.EMPTY);
world.sendBlockUpdated(blockposition, iblockdata, iblockdata, 3);
+ result = blockCookEvent.getResult();
+ itemstack1 = CraftItemStack.asNMSCopy(result);
+ // CraftBukkit end
InventoryUtils.dropItemStack(world, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), itemstack1);
tileentitycampfire.items.set(i, ItemStack.EMPTY);
world.sendBlockUpdated(blockposition, iblockdata, iblockdata, 3);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/entity/TileEntityContainer.java
+++ b/net/minecraft/world/level/block/entity/TileEntityContainer.java
@@ -88,4 +88,12 @@
@@ -89,4 +89,12 @@
}
protected abstract Container createMenu(int i, PlayerInventory playerinventory);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/entity/TileEntityEndGateway.java
+++ b/net/minecraft/world/level/block/entity/TileEntityEndGateway.java
@@ -32,6 +32,14 @@
@@ -33,6 +33,14 @@
import net.minecraft.world.phys.Vec3D;
import org.slf4j.Logger;
@@ -15,7 +15,7 @@
public class TileEntityEndGateway extends TileEntityEnderPortal {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -168,7 +176,7 @@
@@ -169,7 +177,7 @@
tileentityendgateway.teleportCooldown = 100;
BlockPosition blockposition1;
@@ -24,7 +24,7 @@
blockposition1 = findOrCreateValidTeleportPos(worldserver, blockposition);
blockposition1 = blockposition1.above(10);
TileEntityEndGateway.LOGGER.debug("Creating portal at {}", blockposition1);
@@ -197,6 +205,27 @@
@@ -198,6 +206,27 @@
entity1 = entity.getRootVehicle();
}

View File

@@ -30,7 +30,7 @@
}
public static Map<Item, Integer> getFuel() {
@@ -188,6 +202,40 @@
@@ -182,6 +196,40 @@
return map;
}
@@ -71,7 +71,7 @@
private static boolean isNeverAFurnaceFuel(Item item) {
return item.builtInRegistryHolder().is(TagsItem.NON_FLAMMABLE_WOOD);
}
@@ -276,7 +324,7 @@
@@ -270,7 +318,7 @@
IRecipe irecipe;
if (flag2) {
@@ -80,7 +80,7 @@
} else {
irecipe = null;
}
@@ -284,9 +332,20 @@
@@ -278,9 +326,20 @@
int i = tileentityfurnace.getMaxStackSize();
if (!tileentityfurnace.isLit() && canBurn(irecipe, tileentityfurnace.items, i)) {
@@ -103,7 +103,7 @@
flag1 = true;
if (flag3) {
Item item = itemstack.getItem();
@@ -302,11 +361,23 @@
@@ -296,11 +355,23 @@
}
if (tileentityfurnace.isLit() && canBurn(irecipe, tileentityfurnace.items, i)) {
@@ -128,7 +128,7 @@
tileentityfurnace.setRecipeUsed(irecipe);
}
@@ -345,17 +416,44 @@
@@ -339,17 +410,44 @@
}
}
@@ -174,7 +174,7 @@
if (itemstack.is(Blocks.WET_SPONGE.asItem()) && !((ItemStack) nonnulllist.get(1)).isEmpty() && ((ItemStack) nonnulllist.get(1)).is(Items.BUCKET)) {
nonnulllist.set(1, new ItemStack(Items.WATER_BUCKET));
@@ -379,7 +477,7 @@
@@ -373,7 +471,7 @@
}
private static int getTotalCookTime(World world, TileEntityFurnace tileentityfurnace) {
@@ -183,7 +183,7 @@
}
public static boolean isFuel(ItemStack itemstack) {
@@ -498,14 +596,20 @@
@@ -492,14 +590,20 @@
@Override
public void awardUsedRecipes(EntityHuman entityhuman) {}
@@ -206,7 +206,7 @@
List<IRecipe<?>> list = Lists.newArrayList();
ObjectIterator objectiterator = this.recipesUsed.object2IntEntrySet().iterator();
@@ -514,14 +618,14 @@
@@ -508,14 +612,14 @@
worldserver.getRecipeManager().byKey((MinecraftKey) entry.getKey()).ifPresent((irecipe) -> {
list.add(irecipe);
@@ -223,7 +223,7 @@
int j = MathHelper.floor((float) i * f);
float f1 = MathHelper.frac((float) i * f);
@@ -529,6 +633,17 @@
@@ -523,6 +627,17 @@
++j;
}

View File

@@ -60,7 +60,7 @@
this.level.gameEvent((Entity) entityhuman, GameEvent.CONTAINER_OPEN, this.worldPosition);
@@ -175,6 +212,7 @@
public void stopOpen(EntityHuman entityhuman) {
if (!entityhuman.isSpectator()) {
if (!this.remove && !entityhuman.isSpectator()) {
--this.openCount;
+ if (opened) return; // CraftBukkit - only animate if the ShulkerBox hasn't been forced open already by an API call.
this.level.blockEvent(this.worldPosition, this.getBlockState().getBlock(), 1, this.openCount);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/entity/TileEntitySign.java
+++ b/net/minecraft/world/level/block/entity/TileEntitySign.java
@@ -24,7 +24,7 @@
@@ -25,7 +25,7 @@
import net.minecraft.world.phys.Vec2F;
import net.minecraft.world.phys.Vec3D;
@@ -8,8 +8,8 @@
+public class TileEntitySign extends TileEntity implements ICommandListener { // CraftBukkit - implements
public static final int LINES = 4;
private static final String[] RAW_TEXT_FIELD_NAMES = new String[]{"Text1", "Text2", "Text3", "Text4"};
@@ -64,6 +64,12 @@
private static final int MAX_TEXT_LINE_WIDTH = 90;
@@ -83,6 +83,12 @@
}
}
@@ -22,7 +22,7 @@
nbttagcompound.putString("Color", this.color.getName());
nbttagcompound.putBoolean("GlowingText", this.hasGlowingText);
}
@@ -74,8 +80,24 @@
@@ -93,8 +99,24 @@
super.load(nbttagcompound);
this.color = EnumColor.byName(nbttagcompound.getString("Color"), EnumColor.BLACK);
@@ -47,7 +47,7 @@
IChatBaseComponent ichatbasecomponent = this.loadLine(s);
this.messages[i] = ichatbasecomponent;
@@ -113,6 +135,10 @@
@@ -132,6 +154,10 @@
if (ichatmutablecomponent != null) {
return ichatmutablecomponent;
}
@@ -58,7 +58,7 @@
} catch (Exception exception) {
;
}
@@ -204,11 +230,37 @@
@@ -240,11 +266,37 @@
return true;
}
@@ -97,7 +97,7 @@
}
public EnumColor getColor() {
@@ -241,6 +293,6 @@
@@ -277,6 +329,6 @@
private void markUpdated() {
this.setChanged();