Update to Minecraft 1.18.2

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2022-03-01 02:00:00 +11:00
parent bd40300a4f
commit 9ee989ea81
184 changed files with 1785 additions and 1785 deletions

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/item/ItemStack.java
+++ b/net/minecraft/world/item/ItemStack.java
@@ -72,6 +72,40 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -73,6 +73,40 @@
import net.minecraft.world.level.block.state.pattern.ShapeDetectorBlock;
import org.slf4j.Logger;
+// CraftBukkit start
+import com.mojang.serialization.Dynamic;
@@ -41,7 +41,7 @@
public final class ItemStack {
public static final Codec<ItemStack> CODEC = RecordCodecBuilder.create((instance) -> {
@@ -139,16 +173,30 @@
@@ -144,16 +178,30 @@
this.updateEmptyCacheFlag();
}
@@ -74,7 +74,7 @@
this.getItem().verifyTagAfterLoad(this.tag);
}
@@ -156,6 +204,11 @@
@@ -161,6 +209,11 @@
this.setDamageValue(this.getDamageValue());
}
@@ -86,8 +86,8 @@
this.updateEmptyCacheFlag();
}
@@ -193,7 +246,7 @@
return this.getItem() == item;
@@ -202,7 +255,7 @@
return this.getItem().builtInRegistryHolder().tags();
}
- public EnumInteractionResult useOn(ItemActionContext itemactioncontext) {
@@ -95,8 +95,8 @@
EntityHuman entityhuman = itemactioncontext.getPlayer();
BlockPosition blockposition = itemactioncontext.getClickedPos();
ShapeDetectorBlock shapedetectorblock = new ShapeDetectorBlock(itemactioncontext.getLevel(), blockposition, false);
@@ -201,12 +254,157 @@
if (entityhuman != null && !entityhuman.getAbilities().mayBuild && !this.hasAdventureModePlaceTagForBlock(itemactioncontext.getLevel().getTagManager(), shapedetectorblock)) {
@@ -210,12 +263,157 @@
if (entityhuman != null && !entityhuman.getAbilities().mayBuild && !this.hasAdventureModePlaceTagForBlock(itemactioncontext.getLevel().registryAccess().registryOrThrow(IRegistry.BLOCK_REGISTRY), shapedetectorblock)) {
return EnumInteractionResult.PASS;
} else {
+ // CraftBukkit start - handle all block place event logic here
@@ -254,7 +254,7 @@
return enuminteractionresult;
}
@@ -287,6 +485,21 @@
@@ -296,6 +494,21 @@
}
i -= k;
@@ -276,7 +276,7 @@
if (i <= 0) {
return false;
}
@@ -308,6 +521,11 @@
@@ -317,6 +530,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) {
@@ -463,6 +681,17 @@
@@ -472,6 +690,17 @@
return this.tag;
}
@@ -306,7 +306,7 @@
public NBTTagCompound getOrCreateTag() {
if (this.tag == null) {
this.setTag(new NBTTagCompound());
@@ -843,6 +1072,12 @@
@@ -850,6 +1079,12 @@
}
public void setRepairCost(int i) {
@@ -319,7 +319,7 @@
this.getOrCreateTag().putInt("RepairCost", i);
}
@@ -892,6 +1127,13 @@
@@ -899,6 +1134,13 @@
nbttaglist.add(nbttagcompound);
}