package net.minecraft.network.protocol.common.custom; import io.netty.buffer.ByteBuf; import java.util.List; import net.minecraft.core.BlockPos; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.codec.StreamCodec; import net.minecraft.world.level.redstone.Orientation; public record RedstoneWireOrientationsDebugPayload(long time, List wires) implements CustomPacketPayload { public static final CustomPacketPayload.Type TYPE = CustomPacketPayload.createType("debug/redstone_update_order"); public static final StreamCodec STREAM_CODEC = StreamCodec.composite( ByteBufCodecs.VAR_LONG, RedstoneWireOrientationsDebugPayload::time, RedstoneWireOrientationsDebugPayload.Wire.STREAM_CODEC.apply(ByteBufCodecs.list()), RedstoneWireOrientationsDebugPayload::wires, RedstoneWireOrientationsDebugPayload::new ); @Override public CustomPacketPayload.Type type() { return TYPE; } public record Wire(BlockPos pos, Orientation orientation) { public static final StreamCodec STREAM_CODEC = StreamCodec.composite( BlockPos.STREAM_CODEC, RedstoneWireOrientationsDebugPayload.Wire::pos, Orientation.STREAM_CODEC, RedstoneWireOrientationsDebugPayload.Wire::orientation, RedstoneWireOrientationsDebugPayload.Wire::new ); } }