Update to Minecraft 1.19.4

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2023-03-15 03:30:00 +11:00
parent 90a887a912
commit 40076782ed
227 changed files with 2788 additions and 1621 deletions

View File

@@ -9,10 +9,10 @@
+import org.bukkit.event.block.BlockDispenseArmorEvent;
+// CraftBukkit end
+
public class ItemArmor extends Item implements ItemWearable {
public class ItemArmor extends Item implements Equipable {
private static final UUID[] ARMOR_MODIFIER_UUID_PER_SLOT = new UUID[]{UUID.fromString("845DB27C-C624-495F-8C9F-6020A9A58B6B"), UUID.fromString("D8499B04-0E66-4726-AB29-64469D734E0D"), UUID.fromString("9F3D476D-C118-4544-8365-64846904B48E"), UUID.fromString("2AD3F246-FEE1-4E67-B886-69FD380BB150")};
@@ -53,8 +58,34 @@
private static final EnumMap<ItemArmor.a, UUID> ARMOR_MODIFIER_UUID_PER_TYPE = (EnumMap) SystemUtils.make(new EnumMap(ItemArmor.a.class), (enummap) -> {
@@ -58,8 +63,34 @@
EntityLiving entityliving = (EntityLiving) list.get(0);
EnumItemSlot enumitemslot = EntityInsentient.getEquipmentSlotForItem(itemstack);
ItemStack itemstack1 = itemstack.split(1);

View File

@@ -1,9 +1,9 @@
--- a/net/minecraft/world/item/ItemArmorStand.java
+++ b/net/minecraft/world/item/ItemArmorStand.java
@@ -57,6 +57,11 @@
@@ -53,6 +53,11 @@
float f = (float) MathHelper.floor((MathHelper.wrapDegrees(itemactioncontext.getRotation() - 180.0F) + 22.5F) / 45.0F) * 45.0F;
entityarmorstand.moveTo(entityarmorstand.getX(), entityarmorstand.getY(), entityarmorstand.getZ(), f, 0.0F);
this.randomizePose(entityarmorstand, world.random);
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPlaceEvent(itemactioncontext, entityarmorstand).isCancelled()) {
+ return EnumInteractionResult.FAIL;

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/item/ItemCrossbow.java
+++ b/net/minecraft/world/item/ItemCrossbow.java
@@ -112,6 +112,10 @@
@@ -113,6 +113,10 @@
if (itemstack1.isEmpty() && flag) {
itemstack1 = new ItemStack(Items.ARROW);
itemstack2 = itemstack1.copy();
@@ -11,7 +11,7 @@
}
if (!loadProjectile(entityliving, itemstack, itemstack1, k > 0, flag)) {
@@ -235,11 +239,27 @@
@@ -236,11 +240,27 @@
((IProjectile) object).shoot((double) vector3f.x(), (double) vector3f.y(), (double) vector3f.z(), f1, f2);
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/item/ItemHanging.java
+++ b/net/minecraft/world/item/ItemHanging.java
@@ -16,6 +16,11 @@
@@ -22,6 +22,11 @@
import net.minecraft.world.level.World;
import net.minecraft.world.level.gameevent.GameEvent;
@@ -11,8 +11,8 @@
+
public class ItemHanging extends Item {
private final EntityTypes<? extends EntityHanging> type;
@@ -65,6 +70,19 @@
private static final IChatBaseComponent TOOLTIP_RANDOM_VARIANT = IChatBaseComponent.translatable("painting.random").withStyle(EnumChatFormat.GRAY);
@@ -72,6 +77,19 @@
if (((EntityHanging) object).survives()) {
if (!world.isClientSide) {

View File

@@ -20,8 +20,8 @@
+ bindPlayerMobs(entityhuman, world, blockposition, itemactioncontext.getHand()); // CraftBukkit - Pass hand
}
world.gameEvent(GameEvent.BLOCK_ATTACH, blockposition, GameEvent.a.of((Entity) entityhuman));
@@ -41,7 +46,7 @@
return EnumInteractionResult.sidedSuccess(world.isClientSide);
@@ -40,7 +45,7 @@
}
}
@@ -30,7 +30,7 @@
EntityLeash entityleash = null;
boolean flag = false;
double d0 = 7.0D;
@@ -57,9 +62,26 @@
@@ -56,9 +61,26 @@
if (entityinsentient.getLeashHolder() == entityhuman) {
if (entityleash == null) {
entityleash = EntityLeash.getOrCreateKnot(world, blockposition);
@@ -57,7 +57,7 @@
entityinsentient.setLeashedTo(entityleash, true);
flag = true;
}
@@ -67,4 +89,10 @@
@@ -70,4 +92,10 @@
return flag ? EnumInteractionResult.SUCCESS : EnumInteractionResult.PASS;
}

View File

@@ -1,10 +1,10 @@
--- a/net/minecraft/world/item/ItemRecord.java
+++ b/net/minecraft/world/item/ItemRecord.java
@@ -43,6 +43,7 @@
@@ -46,6 +46,7 @@
ItemStack itemstack = itemactioncontext.getItemInHand();
if (!world.isClientSide) {
+ if (true) return EnumInteractionResult.SUCCESS; // CraftBukkit - handled in ItemStack
((BlockJukeBox) Blocks.JUKEBOX).setRecord(itemactioncontext.getPlayer(), world, blockposition, iblockdata, itemstack);
world.levelEvent((EntityHuman) null, 1010, blockposition, Item.getId(this));
itemstack.shrink(1);
EntityHuman entityhuman = itemactioncontext.getPlayer();
TileEntity tileentity = world.getBlockEntity(blockposition);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/item/ItemStack.java
+++ b/net/minecraft/world/item/ItemStack.java
@@ -74,6 +74,40 @@
@@ -75,6 +75,40 @@
import net.minecraft.world.level.block.state.pattern.ShapeDetectorBlock;
import org.slf4j.Logger;
@@ -16,15 +16,15 @@
+import net.minecraft.server.level.WorldServer;
+import net.minecraft.sounds.SoundCategory;
+import net.minecraft.util.datafix.fixes.DataConverterTypes;
+import net.minecraft.world.level.block.BlockJukeBox;
+import net.minecraft.world.level.block.BlockSapling;
+import net.minecraft.world.level.block.BlockTileEntity;
+import net.minecraft.world.level.block.BlockWitherSkull;
+import net.minecraft.world.level.block.Blocks;
+import net.minecraft.world.level.block.SoundEffectType;
+import net.minecraft.world.level.block.entity.TileEntity;
+import net.minecraft.world.level.block.entity.TileEntityJukeBox;
+import net.minecraft.world.level.block.entity.TileEntitySign;
+import net.minecraft.world.level.block.entity.TileEntitySkull;
+import net.minecraft.world.level.gameevent.GameEvent;
+import org.bukkit.Location;
+import org.bukkit.TreeType;
+import org.bukkit.block.BlockState;
@@ -41,7 +41,7 @@
public final class ItemStack {
public static final Codec<ItemStack> CODEC = RecordCodecBuilder.create((instance) -> {
@@ -150,16 +184,30 @@
@@ -151,16 +185,30 @@
this.updateEmptyCacheFlag();
}
@@ -74,7 +74,7 @@
this.getItem().verifyTagAfterLoad(this.tag);
}
@@ -167,6 +215,11 @@
@@ -168,6 +216,11 @@
this.setDamageValue(this.getDamageValue());
}
@@ -86,7 +86,7 @@
this.updateEmptyCacheFlag();
}
@@ -224,7 +277,7 @@
@@ -225,7 +278,7 @@
return this.getItem().builtInRegistryHolder().tags();
}
@@ -95,7 +95,7 @@
EntityHuman entityhuman = itemactioncontext.getPlayer();
BlockPosition blockposition = itemactioncontext.getClickedPos();
ShapeDetectorBlock shapedetectorblock = new ShapeDetectorBlock(itemactioncontext.getLevel(), blockposition, false);
@@ -232,12 +285,158 @@
@@ -233,12 +286,171 @@
if (entityhuman != null && !entityhuman.getAbilities().mayBuild && !this.hasAdventureModePlaceTagForBlock(itemactioncontext.getLevel().registryAccess().registryOrThrow(Registries.BLOCK), shapedetectorblock)) {
return EnumInteractionResult.PASS;
} else {
@@ -208,8 +208,21 @@
+ // Special case juke boxes as they update their tile entity. Copied from ItemRecord.
+ // PAIL: checkme on updates.
+ if (this.item instanceof ItemRecord) {
+ ((BlockJukeBox) Blocks.JUKEBOX).setRecord(entityhuman, world, blockposition, world.getBlockState(blockposition), this);
+ world.levelEvent((EntityHuman) null, 1010, blockposition, Item.getId(this.item));
+ TileEntity tileentity = world.getBlockEntity(blockposition);
+
+ if (tileentity instanceof TileEntityJukeBox) {
+ TileEntityJukeBox tileentityjukebox = (TileEntityJukeBox) tileentity;
+
+ // There can only be one
+ ItemStack record = this.copy();
+ if (!record.isEmpty()) {
+ record.setCount(1);
+ }
+
+ tileentityjukebox.setFirstItem(record);
+ world.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.a.of(entityhuman, world.getBlockState(blockposition)));
+ }
+
+ this.shrink(1);
+ entityhuman.awardStat(StatisticList.PLAY_RECORD);
+ }
@@ -255,7 +268,7 @@
return enuminteractionresult;
}
@@ -318,6 +517,21 @@
@@ -319,6 +531,21 @@
}
i -= k;
@@ -277,7 +290,7 @@
if (i <= 0) {
return false;
}
@@ -339,6 +553,11 @@
@@ -340,6 +567,11 @@
if (this.hurt(i, t0.getRandom(), t0 instanceof EntityPlayer ? (EntityPlayer) t0 : null)) {
consumer.accept(t0);
Item item = this.getItem();
@@ -289,7 +302,7 @@
this.shrink(1);
if (t0 instanceof EntityHuman) {
@@ -493,6 +712,17 @@
@@ -494,6 +726,17 @@
return this.tag;
}
@@ -307,7 +320,7 @@
public NBTTagCompound getOrCreateTag() {
if (this.tag == null) {
this.setTag(new NBTTagCompound());
@@ -859,6 +1089,12 @@
@@ -864,6 +1107,12 @@
}
public void setRepairCost(int i) {
@@ -320,7 +333,7 @@
this.getOrCreateTag().putInt("RepairCost", i);
}
@@ -908,6 +1144,13 @@
@@ -913,6 +1162,13 @@
nbttaglist.add(nbttagcompound);
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/item/crafting/IRecipe.java
+++ b/net/minecraft/world/item/crafting/IRecipe.java
@@ -61,4 +61,6 @@
@@ -66,4 +66,6 @@
return recipeitemstack.getItems().length == 0;
});
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/item/crafting/IRecipeComplex.java
+++ b/net/minecraft/world/item/crafting/IRecipeComplex.java
@@ -32,4 +32,11 @@
@@ -33,4 +33,11 @@
public CraftingBookCategory category() {
return this.category;
}

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/item/crafting/RecipeSmithing.java
+++ b/net/minecraft/world/item/crafting/RecipeSmithing.java
--- a/net/minecraft/world/item/crafting/LegacyUpgradeRecipe.java
+++ b/net/minecraft/world/item/crafting/LegacyUpgradeRecipe.java
@@ -11,6 +11,14 @@
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.World;
import net.minecraft.world.level.block.Blocks;
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
@@ -12,10 +12,10 @@
+import org.bukkit.inventory.Recipe;
+// CraftBukkit end
+
public class RecipeSmithing implements IRecipe<IInventory> {
final RecipeItemStack base;
@@ -83,6 +91,17 @@
/** @deprecated */
@Deprecated(forRemoval = true)
public class LegacyUpgradeRecipe implements SmithingRecipe {
@@ -86,6 +94,17 @@
});
}
@@ -30,6 +30,6 @@
+ }
+ // CraftBukkit end
+
public static class a implements RecipeSerializer<RecipeSmithing> {
public static class a implements RecipeSerializer<LegacyUpgradeRecipe> {
public a() {}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/item/crafting/ShapedRecipes.java
+++ b/net/minecraft/world/item/crafting/ShapedRecipes.java
@@ -23,6 +23,13 @@
@@ -24,6 +24,13 @@
import net.minecraft.world.item.Items;
import net.minecraft.world.level.World;
@@ -14,8 +14,8 @@
public class ShapedRecipes implements RecipeCrafting {
final int width;
@@ -43,6 +50,67 @@
this.result = itemstack;
@@ -50,6 +57,67 @@
this(minecraftkey, s, craftingbookcategory, i, j, nonnulllist, itemstack, true);
}
+ // CraftBukkit start

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/item/crafting/ShapelessRecipes.java
+++ b/net/minecraft/world/item/crafting/ShapelessRecipes.java
@@ -14,6 +14,12 @@
@@ -15,6 +15,12 @@
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.World;
@@ -13,7 +13,7 @@
public class ShapelessRecipes implements RecipeCrafting {
private final MinecraftKey id;
@@ -30,6 +36,21 @@
@@ -31,6 +37,21 @@
this.ingredients = nonnulllist;
}

View File

@@ -0,0 +1,35 @@
--- a/net/minecraft/world/item/crafting/SmithingTransformRecipe.java
+++ b/net/minecraft/world/item/crafting/SmithingTransformRecipe.java
@@ -11,6 +11,14 @@
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.World;
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
+import org.bukkit.craftbukkit.inventory.CraftRecipe;
+import org.bukkit.craftbukkit.inventory.CraftSmithingTransformRecipe;
+import org.bukkit.craftbukkit.util.CraftNamespacedKey;
+import org.bukkit.inventory.Recipe;
+// CraftBukkit end
+
public class SmithingTransformRecipe implements SmithingRecipe {
private final MinecraftKey id;
@@ -79,6 +87,17 @@
return Stream.of(this.template, this.base, this.addition).anyMatch(RecipeItemStack::isEmpty);
}
+ // CraftBukkit start
+ @Override
+ public Recipe toBukkitRecipe() {
+ CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
+
+ CraftSmithingTransformRecipe recipe = new CraftSmithingTransformRecipe(CraftNamespacedKey.fromMinecraft(this.id), result, CraftRecipe.toBukkit(this.template), CraftRecipe.toBukkit(this.base), CraftRecipe.toBukkit(this.addition));
+
+ return recipe;
+ }
+ // CraftBukkit end
+
public static class a implements RecipeSerializer<SmithingTransformRecipe> {
public a() {}

View File

@@ -0,0 +1,30 @@
--- a/net/minecraft/world/item/crafting/SmithingTrimRecipe.java
+++ b/net/minecraft/world/item/crafting/SmithingTrimRecipe.java
@@ -19,6 +19,13 @@
import net.minecraft.world.item.armortrim.TrimPatterns;
import net.minecraft.world.level.World;
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftRecipe;
+import org.bukkit.craftbukkit.inventory.CraftSmithingTrimRecipe;
+import org.bukkit.craftbukkit.util.CraftNamespacedKey;
+import org.bukkit.inventory.Recipe;
+// CraftBukkit end
+
public class SmithingTrimRecipe implements SmithingRecipe {
private final MinecraftKey id;
@@ -115,6 +122,13 @@
return Stream.of(this.template, this.base, this.addition).anyMatch(RecipeItemStack::isEmpty);
}
+ // CraftBukkit start
+ @Override
+ public Recipe toBukkitRecipe() {
+ return new CraftSmithingTrimRecipe(CraftNamespacedKey.fromMinecraft(this.id), CraftRecipe.toBukkit(this.template), CraftRecipe.toBukkit(this.base), CraftRecipe.toBukkit(this.addition));
+ }
+ // CraftBukkit end
+
public static class a implements RecipeSerializer<SmithingTrimRecipe> {
public a() {}