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

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/item/ItemArmorStand.java
+++ b/net/minecraft/world/item/ItemArmorStand.java
@@ -55,6 +55,11 @@
@@ -57,6 +57,11 @@
entityarmorstand.moveTo(entityarmorstand.getX(), entityarmorstand.getY(), entityarmorstand.getZ(), f, 0.0F);
this.randomizePose(entityarmorstand, world.random);

View File

@@ -13,8 +13,8 @@
+
public class ItemBlock extends Item {
private static final String BLOCK_ENTITY_TAG = "BlockEntityTag";
@@ -69,6 +76,12 @@
public static final String BLOCK_ENTITY_TAG = "BlockEntityTag";
@@ -71,6 +78,12 @@
return EnumInteractionResult.FAIL;
} else {
IBlockData iblockdata = this.getPlacementState(blockactioncontext1);
@@ -27,7 +27,7 @@
if (iblockdata == null) {
return EnumInteractionResult.FAIL;
@@ -85,6 +98,19 @@
@@ -87,6 +100,19 @@
iblockdata1 = this.updateBlockStateFromTag(blockposition, world, itemstack, iblockdata1);
this.updateCustomBlockEntityTag(blockposition, world, entityhuman, itemstack, iblockdata1);
iblockdata1.getBlock().setPlacedBy(world, blockposition, iblockdata1, entityhuman, itemstack);
@@ -47,7 +47,7 @@
if (entityhuman instanceof EntityPlayer) {
CriterionTriggers.PLACED_BLOCK.trigger((EntityPlayer) entityhuman, blockposition, itemstack);
}
@@ -92,9 +118,9 @@
@@ -94,9 +120,9 @@
SoundEffectType soundeffecttype = iblockdata1.getSoundType();
@@ -59,7 +59,7 @@
itemstack.shrink(1);
}
@@ -130,6 +156,21 @@
@@ -132,6 +158,21 @@
if (nbttagcompound != null) {
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("BlockStateTag");
@@ -81,7 +81,7 @@
BlockStateList<Block, IBlockData> blockstatelist = iblockdata.getBlock().getStateDefinition();
Iterator iterator = nbttagcompound1.getAllKeys().iterator();
@@ -144,11 +185,6 @@
@@ -146,11 +187,6 @@
}
}
}
@@ -93,7 +93,7 @@
return iblockdata1;
}
@@ -161,8 +197,15 @@
@@ -163,8 +199,15 @@
protected boolean canPlace(BlockActionContext blockactioncontext, IBlockData iblockdata) {
EntityHuman entityhuman = blockactioncontext.getPlayer();
VoxelShapeCollision voxelshapecollision = entityhuman == null ? VoxelShapeCollision.empty() : VoxelShapeCollision.of(entityhuman);
@@ -110,7 +110,7 @@
}
protected boolean mustSurvive() {
@@ -245,7 +288,7 @@
@@ -239,7 +282,7 @@
if (nbttagcompound != null && nbttagcompound.contains("Items", 9)) {
NBTTagList nbttaglist = nbttagcompound.getList("Items", 10);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/item/ItemBlockWallable.java
+++ b/net/minecraft/world/item/ItemBlockWallable.java
@@ -9,6 +9,12 @@
@@ -10,6 +10,12 @@
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@@ -13,7 +13,7 @@
public class ItemBlockWallable extends ItemBlock {
@@ -42,7 +48,19 @@
@@ -49,7 +55,19 @@
}
}

View File

@@ -13,7 +13,7 @@
+ // CraftBukkit end
EntityBoat entityboat = this.getBoat(world, movingobjectpositionblock);
entityboat.setType(this.type);
entityboat.setVariant(this.type);
@@ -66,7 +73,15 @@
return InteractionResultWrapper.fail(itemstack);
} else {

View File

@@ -11,9 +11,9 @@
}
if (!loadProjectile(entityliving, itemstack, itemstack1, k > 0, flag)) {
@@ -236,11 +240,27 @@
vector3fa.transform(quaternion);
((IProjectile) object).shoot((double) vector3fa.x(), (double) vector3fa.y(), (double) vector3fa.z(), f1, f2);
@@ -235,11 +239,27 @@
((IProjectile) object).shoot((double) vector3f.x(), (double) vector3f.y(), (double) vector3f.z(), f1, f2);
}
+ // CraftBukkit start
+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(entityliving, itemstack, itemstack1, (Entity) object, entityliving.getUsedItemHand(), f, true);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/item/ItemMonsterEgg.java
+++ b/net/minecraft/world/item/ItemMonsterEgg.java
@@ -181,7 +181,7 @@
@@ -186,7 +186,7 @@
return Optional.empty();
} else {
((EntityInsentient) object).moveTo(vec3d.x(), vec3d.y(), vec3d.z(), 0.0F, 0.0F);
@@ -9,7 +9,7 @@
if (itemstack.hasCustomHoverName()) {
((EntityInsentient) object).setCustomName(itemstack.getHoverName());
}
@@ -190,7 +190,7 @@
@@ -195,7 +195,7 @@
itemstack.shrink(1);
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/item/ItemPotion.java
+++ b/net/minecraft/world/item/ItemPotion.java
@@ -63,7 +63,7 @@
@@ -60,7 +60,7 @@
if (mobeffect.getEffect().isInstantenous()) {
mobeffect.getEffect().applyInstantenousEffect(entityhuman, entityhuman, entityliving, mobeffect.getAmplifier(), 1.0D);
} else {

View File

@@ -1,15 +1,15 @@
--- a/net/minecraft/world/item/ItemSign.java
+++ b/net/minecraft/world/item/ItemSign.java
@@ -10,6 +10,8 @@
@@ -11,6 +11,8 @@
public class ItemSign extends ItemBlockWallable {
+ public static BlockPosition openSign; // CraftBukkit
+
public ItemSign(Item.Info item_info, Block block, Block block1) {
super(block, block1, item_info);
super(block, block1, item_info, EnumDirection.DOWN);
}
@@ -19,7 +21,10 @@
@@ -20,7 +22,10 @@
boolean flag = super.updateCustomBlockEntityTag(blockposition, world, entityhuman, itemstack, iblockdata);
if (!world.isClientSide && !flag && entityhuman != null) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/item/ItemSkullPlayer.java
+++ b/net/minecraft/world/item/ItemSkullPlayer.java
@@ -50,6 +50,16 @@
@@ -51,6 +51,16 @@
TileEntitySkull.updateGameprofile(gameprofile, (gameprofile1) -> {
nbttagcompound.put("SkullOwner", GameProfileSerializer.writeGameProfile(new NBTTagCompound(), gameprofile1));
});

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/item/ItemStack.java
+++ b/net/minecraft/world/item/ItemStack.java
@@ -71,6 +71,40 @@
@@ -74,6 +74,40 @@
import net.minecraft.world.level.block.state.pattern.ShapeDetectorBlock;
import org.slf4j.Logger;
@@ -41,7 +41,7 @@
public final class ItemStack {
public static final Codec<ItemStack> CODEC = RecordCodecBuilder.create((instance) -> {
@@ -146,16 +180,30 @@
@@ -150,16 +184,30 @@
this.updateEmptyCacheFlag();
}
@@ -64,7 +64,7 @@
- private ItemStack(NBTTagCompound nbttagcompound) {
+ // CraftBukkit - break into own method
+ private void load(NBTTagCompound nbttagcompound) {
this.item = (Item) IRegistry.ITEM.get(new MinecraftKey(nbttagcompound.getString("id")));
this.item = (Item) BuiltInRegistries.ITEM.get(new MinecraftKey(nbttagcompound.getString("id")));
this.count = nbttagcompound.getByte("Count");
if (nbttagcompound.contains("tag", 10)) {
- this.tag = nbttagcompound.getCompound("tag");
@@ -74,7 +74,7 @@
this.getItem().verifyTagAfterLoad(this.tag);
}
@@ -163,6 +211,11 @@
@@ -167,6 +215,11 @@
this.setDamageValue(this.getDamageValue());
}
@@ -86,7 +86,7 @@
this.updateEmptyCacheFlag();
}
@@ -216,7 +269,7 @@
@@ -224,7 +277,7 @@
return this.getItem().builtInRegistryHolder().tags();
}
@@ -95,8 +95,8 @@
EntityHuman entityhuman = itemactioncontext.getPlayer();
BlockPosition blockposition = itemactioncontext.getClickedPos();
ShapeDetectorBlock shapedetectorblock = new ShapeDetectorBlock(itemactioncontext.getLevel(), blockposition, false);
@@ -224,12 +277,157 @@
if (entityhuman != null && !entityhuman.getAbilities().mayBuild && !this.hasAdventureModePlaceTagForBlock(itemactioncontext.getLevel().registryAccess().registryOrThrow(IRegistry.BLOCK_REGISTRY), shapedetectorblock)) {
@@ -232,12 +285,157 @@
if (entityhuman != null && !entityhuman.getAbilities().mayBuild && !this.hasAdventureModePlaceTagForBlock(itemactioncontext.getLevel().registryAccess().registryOrThrow(Registries.BLOCK), shapedetectorblock)) {
return EnumInteractionResult.PASS;
} else {
+ // CraftBukkit start - handle all block place event logic here
@@ -254,7 +254,7 @@
return enuminteractionresult;
}
@@ -310,6 +508,21 @@
@@ -318,6 +516,21 @@
}
i -= k;
@@ -276,7 +276,7 @@
if (i <= 0) {
return false;
}
@@ -331,6 +544,11 @@
@@ -339,6 +552,11 @@
if (this.hurt(i, t0.getRandom(), t0 instanceof EntityPlayer ? (EntityPlayer) t0 : null)) {
consumer.accept(t0);
Item item = this.getItem();
@@ -288,7 +288,7 @@
this.shrink(1);
if (t0 instanceof EntityHuman) {
@@ -486,6 +704,17 @@
@@ -493,6 +711,17 @@
return this.tag;
}
@@ -306,16 +306,7 @@
public NBTTagCompound getOrCreateTag() {
if (this.tag == null) {
this.setTag(new NBTTagCompound());
@@ -782,7 +1011,7 @@
private static Collection<IChatBaseComponent> expandBlockState(String s) {
try {
- return (Collection) ArgumentBlock.parseForTesting((IRegistry) IRegistry.BLOCK, s, true).map((argumentblock_a) -> {
+ return (Collection) ArgumentBlock.parseForTesting(IRegistry.BLOCK, s, true).map((argumentblock_a) -> { // CraftBukkit - decompile error
return Lists.newArrayList(new IChatBaseComponent[]{argumentblock_a.blockState().getBlock().getName().withStyle(EnumChatFormat.DARK_GRAY)});
}, (argumentblock_b) -> {
return (List) argumentblock_b.tag().stream().map((holder) -> {
@@ -848,6 +1077,12 @@
@@ -859,6 +1088,12 @@
}
public void setRepairCost(int i) {
@@ -328,7 +319,7 @@
this.getOrCreateTag().putInt("RepairCost", i);
}
@@ -897,6 +1132,13 @@
@@ -908,6 +1143,13 @@
nbttaglist.add(nbttagcompound);
}

View File

@@ -12,7 +12,7 @@
public class ItemWorldMap extends ItemWorldMapBase {
public static final int IMAGE_WIDTH = 128;
@@ -67,7 +72,7 @@
@@ -69,7 +74,7 @@
public static Integer getMapId(ItemStack itemstack) {
NBTTagCompound nbttagcompound = itemstack.getTag();
@@ -21,7 +21,7 @@
}
public static int createNewSavedData(World world, int i, int j, int k, boolean flag, boolean flag1, ResourceKey<World> resourcekey) {
@@ -75,6 +80,10 @@
@@ -77,6 +82,10 @@
int l = world.getFreeMapId();
world.setMapData(makeKey(l), worldmap);

View File

@@ -22,7 +22,7 @@
- Map<Recipes<?>, Builder<MinecraftKey, IRecipe<?>>> map1 = Maps.newHashMap();
+ // CraftBukkit start - SPIGOT-5667 make sure all types are populated and mutable
+ Map<Recipes<?>, Object2ObjectLinkedOpenHashMap<MinecraftKey, IRecipe<?>>> map1 = Maps.newHashMap();
+ for (Recipes<?> recipeType : IRegistry.RECIPE_TYPE) {
+ for (Recipes<?> recipeType : BuiltInRegistries.RECIPE_TYPE) {
+ map1.put(recipeType, new Object2ObjectLinkedOpenHashMap<>());
+ }
+ // CraftBukkit end
@@ -153,7 +153,7 @@
+ public void clearRecipes() {
+ this.recipes = Maps.newHashMap();
+
+ for (Recipes<?> recipeType : IRegistry.RECIPE_TYPE) {
+ for (Recipes<?> recipeType : BuiltInRegistries.RECIPE_TYPE) {
+ this.recipes.put(recipeType, new Object2ObjectLinkedOpenHashMap<>());
+ }
+

View File

@@ -14,19 +14,22 @@
+
public class FurnaceRecipe extends RecipeCooking {
public FurnaceRecipe(MinecraftKey minecraftkey, String s, RecipeItemStack recipeitemstack, ItemStack itemstack, float f, int i) {
@@ -19,4 +27,14 @@
public FurnaceRecipe(MinecraftKey minecraftkey, String s, CookingBookCategory cookingbookcategory, RecipeItemStack recipeitemstack, ItemStack itemstack, float f, int i) {
@@ -19,4 +27,17 @@
public RecipeSerializer<?> getSerializer() {
return RecipeSerializer.SMELTING_RECIPE;
}
+
+ // CraftBukkit start
+ @Override
+ public Recipe toBukkitRecipe() {
+ CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
+
+ CraftFurnaceRecipe recipe = new CraftFurnaceRecipe(CraftNamespacedKey.fromMinecraft(this.id), result, CraftRecipe.toBukkit(this.ingredient), this.experience, this.cookingTime);
+ recipe.setGroup(this.group);
+ recipe.setCategory(CraftRecipe.getCategory(this.category()));
+
+ return recipe;
+ }
+ // CraftBukkit end
}

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/item/crafting/IRecipeComplex.java
+++ b/net/minecraft/world/item/crafting/IRecipeComplex.java
@@ -25,4 +25,11 @@
public ItemStack getResultItem() {
return ItemStack.EMPTY;
@@ -32,4 +32,11 @@
public CraftingBookCategory category() {
return this.category;
}
+
+ // CraftBukkit start

View File

@@ -14,8 +14,8 @@
+
public class RecipeBlasting extends RecipeCooking {
public RecipeBlasting(MinecraftKey minecraftkey, String s, RecipeItemStack recipeitemstack, ItemStack itemstack, float f, int i) {
@@ -19,4 +27,16 @@
public RecipeBlasting(MinecraftKey minecraftkey, String s, CookingBookCategory cookingbookcategory, RecipeItemStack recipeitemstack, ItemStack itemstack, float f, int i) {
@@ -19,4 +27,17 @@
public RecipeSerializer<?> getSerializer() {
return RecipeSerializer.BLASTING_RECIPE;
}
@@ -27,6 +27,7 @@
+
+ CraftBlastingRecipe recipe = new CraftBlastingRecipe(CraftNamespacedKey.fromMinecraft(this.id), result, CraftRecipe.toBukkit(this.ingredient), this.experience, this.cookingTime);
+ recipe.setGroup(this.group);
+ recipe.setCategory(CraftRecipe.getCategory(this.category()));
+
+ return recipe;
+ }

View File

@@ -14,8 +14,8 @@
+
public class RecipeCampfire extends RecipeCooking {
public RecipeCampfire(MinecraftKey minecraftkey, String s, RecipeItemStack recipeitemstack, ItemStack itemstack, float f, int i) {
@@ -19,4 +27,16 @@
public RecipeCampfire(MinecraftKey minecraftkey, String s, CookingBookCategory cookingbookcategory, RecipeItemStack recipeitemstack, ItemStack itemstack, float f, int i) {
@@ -19,4 +27,17 @@
public RecipeSerializer<?> getSerializer() {
return RecipeSerializer.CAMPFIRE_COOKING_RECIPE;
}
@@ -27,6 +27,7 @@
+
+ CraftCampfireRecipe recipe = new CraftCampfireRecipe(CraftNamespacedKey.fromMinecraft(this.id), result, CraftRecipe.toBukkit(this.ingredient), this.experience, this.cookingTime);
+ recipe.setGroup(this.group);
+ recipe.setCategory(CraftRecipe.getCategory(this.category()));
+
+ return recipe;
+ }

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/item/crafting/RecipeItemStack.java
+++ b/net/minecraft/world/item/crafting/RecipeItemStack.java
@@ -37,6 +37,7 @@
@@ -38,6 +38,7 @@
public ItemStack[] itemStacks;
@Nullable
private IntList stackingIds;
@@ -8,19 +8,19 @@
public RecipeItemStack(Stream<? extends RecipeItemStack.Provider> stream) {
this.values = (RecipeItemStack.Provider[]) stream.toArray((i) -> {
@@ -74,6 +75,15 @@
for (int j = 0; j < i; ++j) {
ItemStack itemstack1 = aitemstack[j];
@@ -69,6 +70,15 @@
for (int j = 0; j < i; ++j) {
ItemStack itemstack1 = aitemstack[j];
+ // CraftBukkit start
+ if (exact) {
+ if (itemstack1.getItem() == itemstack.getItem() && ItemStack.tagMatches(itemstack, itemstack1)) {
+ return true;
+ }
+
+ continue;
+ // CraftBukkit start
+ if (exact) {
+ if (itemstack1.getItem() == itemstack.getItem() && ItemStack.tagMatches(itemstack, itemstack1)) {
+ return true;
+ }
+ // CraftBukkit end
if (itemstack1.is(itemstack.getItem())) {
return true;
}
+
+ continue;
+ }
+ // CraftBukkit end
if (itemstack1.is(itemstack.getItem())) {
return true;
}

View File

@@ -14,8 +14,8 @@
+
public class RecipeSmoking extends RecipeCooking {
public RecipeSmoking(MinecraftKey minecraftkey, String s, RecipeItemStack recipeitemstack, ItemStack itemstack, float f, int i) {
@@ -19,4 +27,16 @@
public RecipeSmoking(MinecraftKey minecraftkey, String s, CookingBookCategory cookingbookcategory, RecipeItemStack recipeitemstack, ItemStack itemstack, float f, int i) {
@@ -19,4 +27,17 @@
public RecipeSerializer<?> getSerializer() {
return RecipeSerializer.SMOKING_RECIPE;
}
@@ -27,6 +27,7 @@
+
+ CraftSmokingRecipe recipe = new CraftSmokingRecipe(CraftNamespacedKey.fromMinecraft(this.id), result, CraftRecipe.toBukkit(this.ingredient), this.experience, this.cookingTime);
+ recipe.setGroup(this.group);
+ recipe.setCategory(CraftRecipe.getCategory(this.category()));
+
+ return recipe;
+ }

View File

@@ -14,7 +14,7 @@
public class ShapedRecipes implements RecipeCrafting {
final int width;
@@ -41,6 +48,66 @@
@@ -43,6 +50,67 @@
this.result = itemstack;
}
@@ -23,6 +23,7 @@
+ CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
+ CraftShapedRecipe recipe = new CraftShapedRecipe(result, this);
+ recipe.setGroup(this.group);
+ recipe.setCategory(CraftRecipe.getCategory(this.category()));
+
+ switch (this.height) {
+ case 1:

View File

@@ -13,7 +13,7 @@
public class ShapelessRecipes implements RecipeCrafting {
private final MinecraftKey id;
@@ -28,6 +34,20 @@
@@ -30,6 +36,21 @@
this.ingredients = nonnulllist;
}
@@ -23,6 +23,7 @@
+ CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
+ CraftShapelessRecipe recipe = new CraftShapelessRecipe(result, this);
+ recipe.setGroup(this.group);
+ recipe.setCategory(CraftRecipe.getCategory(this.category()));
+
+ for (RecipeItemStack list : this.ingredients) {
+ recipe.addIngredient(CraftRecipe.toBukkit(list));

View File

@@ -1,17 +1,14 @@
--- a/net/minecraft/world/item/enchantment/Enchantments.java
+++ b/net/minecraft/world/item/enchantment/Enchantments.java
@@ -46,6 +46,14 @@
public static final Enchantment MENDING = register("mending", new EnchantmentMending(Enchantment.Rarity.RARE, EnumItemSlot.values()));
public static final Enchantment VANISHING_CURSE = register("vanishing_curse", new EnchantmentVanishing(Enchantment.Rarity.VERY_RARE, EnumItemSlot.values()));
+ // CraftBukkit start
+ static {
+ for (Object enchantment : IRegistry.ENCHANTMENT) {
+ org.bukkit.enchantments.Enchantment.registerEnchantment(new org.bukkit.craftbukkit.enchantments.CraftEnchantment((Enchantment) enchantment));
+ }
+ }
+ // CraftBukkit end
+
@@ -50,6 +50,10 @@
public Enchantments() {}
private static Enchantment register(String s, Enchantment enchantment) {
- return (Enchantment) IRegistry.register(BuiltInRegistries.ENCHANTMENT, s, enchantment);
+ // CraftBukkit start
+ enchantment = (Enchantment) IRegistry.register(BuiltInRegistries.ENCHANTMENT, s, enchantment);
+ org.bukkit.enchantments.Enchantment.registerEnchantment(new org.bukkit.craftbukkit.enchantments.CraftEnchantment(enchantment));
+ return enchantment;
+ // CraftBukkit end
}
}