@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/net/minecraft/world/item/ItemStack.java
|
||||
@@ -96,17 +96,51 @@
|
||||
@@ -96,18 +96,52 @@
|
||||
import org.apache.commons.lang3.mutable.MutableBoolean;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
+
|
||||
public final class ItemStack implements DataComponentHolder {
|
||||
|
||||
private static final List<IChatBaseComponent> OP_NBT_WARNING = List.of(IChatBaseComponent.translatable("item.op_warning.line1").withStyle(EnumChatFormat.RED, EnumChatFormat.BOLD), IChatBaseComponent.translatable("item.op_warning.line2").withStyle(EnumChatFormat.RED), IChatBaseComponent.translatable("item.op_warning.line3").withStyle(EnumChatFormat.RED));
|
||||
public static final Codec<ItemStack> CODEC = Codec.lazyInitialized(() -> {
|
||||
- return RecordCodecBuilder.create((instance) -> {
|
||||
+ return RecordCodecBuilder.<ItemStack>create((instance) -> { // CraftBukkit - decompile error
|
||||
@@ -54,7 +55,7 @@
|
||||
return instance.group(Item.CODEC.fieldOf("id").forGetter(ItemStack::getItemHolder), DataComponentPatch.CODEC.optionalFieldOf("components", DataComponentPatch.EMPTY).forGetter((itemstack) -> {
|
||||
return itemstack.components.asPatch();
|
||||
})).apply(instance, (holder, datacomponentpatch) -> {
|
||||
@@ -131,19 +165,25 @@
|
||||
@@ -132,19 +166,25 @@
|
||||
if (i <= 0) {
|
||||
return ItemStack.EMPTY;
|
||||
} else {
|
||||
@@ -84,7 +85,7 @@
|
||||
DataComponentPatch.STREAM_CODEC.encode(registryfriendlybytebuf, itemstack.components.asPatch());
|
||||
}
|
||||
}
|
||||
@@ -186,7 +226,7 @@
|
||||
@@ -187,7 +227,7 @@
|
||||
|
||||
return dataresult.isError() ? dataresult.map((unit) -> {
|
||||
return itemstack;
|
||||
@@ -93,7 +94,7 @@
|
||||
int i = itemstack.getCount();
|
||||
|
||||
return "Item stack with stack size of " + i + " was larger than maximum: " + itemstack.getMaxStackSize();
|
||||
@@ -289,8 +329,9 @@
|
||||
@@ -294,8 +334,9 @@
|
||||
j = itemstack.getMaxStackSize();
|
||||
} while (i <= j);
|
||||
|
||||
@@ -104,7 +105,7 @@
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -372,15 +413,173 @@
|
||||
@@ -377,15 +418,173 @@
|
||||
return EnumInteractionResult.PASS;
|
||||
} else {
|
||||
Item item = this.getItem();
|
||||
@@ -280,7 +281,7 @@
|
||||
|
||||
return enuminteractionresult;
|
||||
}
|
||||
@@ -487,6 +686,21 @@
|
||||
@@ -492,6 +691,21 @@
|
||||
|
||||
public void hurtAndBreak(int i, WorldServer worldserver, @Nullable EntityPlayer entityplayer, Consumer<Item> consumer) {
|
||||
int j = this.processDurabilityChange(i, worldserver, entityplayer);
|
||||
@@ -302,7 +303,7 @@
|
||||
|
||||
if (j != 0) {
|
||||
this.applyDamage(this.getDamageValue() + j, entityplayer, consumer);
|
||||
@@ -506,6 +720,11 @@
|
||||
@@ -511,6 +725,11 @@
|
||||
this.setDamageValue(i);
|
||||
if (this.isBroken()) {
|
||||
Item item = this.getItem();
|
||||
@@ -314,7 +315,7 @@
|
||||
|
||||
this.shrink(1);
|
||||
consumer.accept(item);
|
||||
@@ -765,6 +984,12 @@
|
||||
@@ -770,6 +989,12 @@
|
||||
return this.getItem().useOnRelease(this);
|
||||
}
|
||||
|
||||
@@ -327,7 +328,7 @@
|
||||
@Nullable
|
||||
public <T> T set(DataComponentType<? super T> datacomponenttype, @Nullable T t0) {
|
||||
return this.components.set(datacomponenttype, t0);
|
||||
@@ -846,7 +1071,7 @@
|
||||
@@ -858,7 +1083,7 @@
|
||||
}
|
||||
|
||||
private <T extends TooltipProvider> void addToTooltip(DataComponentType<T> datacomponenttype, Item.b item_b, Consumer<IChatBaseComponent> consumer, TooltipFlag tooltipflag) {
|
||||
@@ -336,7 +337,7 @@
|
||||
|
||||
if (t0 != null) {
|
||||
t0.addToTooltip(item_b, consumer, tooltipflag);
|
||||
@@ -1073,6 +1298,13 @@
|
||||
@@ -1091,6 +1316,13 @@
|
||||
EnchantmentManager.forEachModifier(this, enumitemslot, biconsumer);
|
||||
}
|
||||
|
||||
@@ -350,7 +351,7 @@
|
||||
public IChatBaseComponent getDisplayName() {
|
||||
IChatMutableComponent ichatmutablecomponent = IChatBaseComponent.empty().append(this.getHoverName());
|
||||
|
||||
@@ -1135,7 +1367,7 @@
|
||||
@@ -1153,7 +1385,7 @@
|
||||
}
|
||||
|
||||
public void consume(int i, @Nullable EntityLiving entityliving) {
|
||||
|
||||
Reference in New Issue
Block a user