Track codec writing
This commit is contained in:
@@ -1,5 +1,13 @@
|
||||
--- a/net/minecraft/world/item/component/BundleContents.java
|
||||
+++ b/net/minecraft/world/item/component/BundleContents.java
|
||||
@@ -25,6 +_,7 @@
|
||||
.flatXmap(BundleContents::checkAndCreate, bundleContents -> DataResult.success(bundleContents.items));
|
||||
public static final StreamCodec<RegistryFriendlyByteBuf, BundleContents> STREAM_CODEC = ItemStack.STREAM_CODEC
|
||||
.apply(ByteBufCodecs.list())
|
||||
+ .apply(ByteBufCodecs::increaseDepth) // Paper - Track codec depth
|
||||
.map(BundleContents::new, contents -> contents.items);
|
||||
private static final Fraction BUNDLE_IN_BUNDLE_WEIGHT = Fraction.getFraction(1, 16);
|
||||
private static final int NO_STACK_INDEX = -1;
|
||||
@@ -76,6 +_,12 @@
|
||||
return !stack.isEmpty() && stack.getItem().canFitInsideContainerItems();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
--- a/net/minecraft/world/item/component/ChargedProjectiles.java
|
||||
+++ b/net/minecraft/world/item/component/ChargedProjectiles.java
|
||||
@@ -16,6 +_,7 @@
|
||||
.xmap(ChargedProjectiles::new, chargedProjectiles -> chargedProjectiles.items);
|
||||
public static final StreamCodec<RegistryFriendlyByteBuf, ChargedProjectiles> STREAM_CODEC = ItemStack.STREAM_CODEC
|
||||
.apply(ByteBufCodecs.list())
|
||||
+ .apply(ByteBufCodecs::increaseDepth) // Paper - Track codec depth
|
||||
.map(ChargedProjectiles::new, chargedProjectiles -> chargedProjectiles.items);
|
||||
private final List<ItemStack> items;
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
--- a/net/minecraft/world/item/component/ItemContainerContents.java
|
||||
+++ b/net/minecraft/world/item/component/ItemContainerContents.java
|
||||
@@ -22,6 +_,7 @@
|
||||
.xmap(ItemContainerContents::fromSlots, ItemContainerContents::asSlots);
|
||||
public static final StreamCodec<RegistryFriendlyByteBuf, ItemContainerContents> STREAM_CODEC = ItemStack.OPTIONAL_STREAM_CODEC
|
||||
.apply(ByteBufCodecs.list(256))
|
||||
+ .apply(ByteBufCodecs::increaseDepth) // Paper - Track codec depth
|
||||
.map(ItemContainerContents::new, contents -> contents.items);
|
||||
public final NonNullList<ItemStack> items;
|
||||
private final int hashCode;
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/net/minecraft/world/item/component/UseRemainder.java
|
||||
+++ b/net/minecraft/world/item/component/UseRemainder.java
|
||||
@@ -8,7 +_,7 @@
|
||||
public record UseRemainder(ItemStack convertInto) {
|
||||
public static final Codec<UseRemainder> CODEC = ItemStack.CODEC.xmap(UseRemainder::new, UseRemainder::convertInto);
|
||||
public static final StreamCodec<RegistryFriendlyByteBuf, UseRemainder> STREAM_CODEC = StreamCodec.composite(
|
||||
- ItemStack.STREAM_CODEC, UseRemainder::convertInto, UseRemainder::new
|
||||
+ ItemStack.STREAM_CODEC.apply(net.minecraft.network.codec.ByteBufCodecs::increaseDepth), UseRemainder::convertInto, UseRemainder::new // Paper - Track codec depth
|
||||
);
|
||||
|
||||
public ItemStack convertIntoRemainder(ItemStack stack, int count, boolean hasInfiniteMaterials, UseRemainder.OnExtraCreatedRemainder onExtraCreated) {
|
||||
Reference in New Issue
Block a user