|
21 | 21 |
|
22 | 22 | public record EmiTransferRecipePayload(ResourceLocation recipeId, ResourceLocation recipeTypeId, int action, List<Integer> slots, List<Integer> crafting, |
23 | 23 | int output, List<ItemStack> stacks, boolean maxTransfer) implements CustomPacketPayload { |
| 24 | + private static final int MAX_CRAFTING_SLOTS = 9; |
| 25 | + private static final int MAX_INVENTORY_SLOTS = 512; |
24 | 26 | public static final Type<EmiTransferRecipePayload> TYPE = new Type<>(SophisticatedCore.getRL("emi_transfer_recipe")); |
25 | 27 | public static final StreamCodec<RegistryFriendlyByteBuf, EmiTransferRecipePayload> STREAM_CODEC = StreamCodecHelper.composite(ResourceLocation.STREAM_CODEC, |
26 | 28 | EmiTransferRecipePayload::recipeId, ResourceLocation.STREAM_CODEC, EmiTransferRecipePayload::recipeTypeId, ByteBufCodecs.INT, |
27 | | - EmiTransferRecipePayload::action, ByteBufCodecs.INT.apply(ByteBufCodecs.list()), EmiTransferRecipePayload::slots, |
28 | | - ByteBufCodecs.INT.apply(ByteBufCodecs.list()), EmiTransferRecipePayload::crafting, ByteBufCodecs.INT, EmiTransferRecipePayload::output, |
29 | | - ItemStack.OPTIONAL_LIST_STREAM_CODEC, EmiTransferRecipePayload::stacks, ByteBufCodecs.BOOL, EmiTransferRecipePayload::maxTransfer, |
30 | | - EmiTransferRecipePayload::new); |
| 29 | + EmiTransferRecipePayload::action, ByteBufCodecs.INT.apply(ByteBufCodecs.list(MAX_INVENTORY_SLOTS)), EmiTransferRecipePayload::slots, |
| 30 | + ByteBufCodecs.INT.apply(ByteBufCodecs.list(MAX_CRAFTING_SLOTS)), EmiTransferRecipePayload::crafting, ByteBufCodecs.INT, |
| 31 | + EmiTransferRecipePayload::output, ItemStack.OPTIONAL_STREAM_CODEC.apply(ByteBufCodecs.list(MAX_CRAFTING_SLOTS)), EmiTransferRecipePayload::stacks, |
| 32 | + ByteBufCodecs.BOOL, EmiTransferRecipePayload::maxTransfer, EmiTransferRecipePayload::new); |
31 | 33 |
|
32 | 34 | @Override |
33 | 35 | public Type<? extends CustomPacketPayload> type() { |
|
0 commit comments