|
11 | 11 | import net.minecraft.network.codec.StreamEncoder;
|
12 | 12 |
|
13 | 13 | public class MachineUpdatePacket {
|
14 |
| - public static final StreamCodec<RegistryFriendlyByteBuf, MachineUpdatePacket> CODEC = StreamCodec.of((buf, packet) -> { |
15 |
| - buf.writeBlockPos(packet.pos); |
16 |
| - packet.configuration.networkCodec().encode(buf, packet.configuration); |
17 |
| - MachineState.CODEC.encode(buf, packet.state); |
18 |
| - MachineEnergyStorage.CODEC.encode(buf, packet.energy); |
19 |
| - MachineItemStorage.CODEC.encode(buf, packet.items); |
20 |
| - MachineFluidStorage.CODEC.encode(buf, packet.fluids); |
21 |
| - }, MachineUpdatePacket::new); |
22 |
| - |
23 |
| - protected final BlockPos pos; |
24 |
| - protected final MachineConfiguration configuration; |
25 |
| - protected final MachineState state; |
26 |
| - protected final MachineEnergyStorage energy; |
27 |
| - protected final MachineItemStorage items; |
28 |
| - protected final MachineFluidStorage fluids; |
29 |
| - |
30 |
| - public MachineUpdatePacket(BlockPos pos, MachineConfiguration configuration, MachineState state, MachineEnergyStorage energy, MachineItemStorage items, MachineFluidStorage fluids) { |
31 |
| - this.pos = pos; |
32 |
| - this.configuration = configuration; |
33 |
| - this.state = state; |
34 |
| - this.energy = energy; |
35 |
| - this.items = items; |
36 |
| - this.fluids = fluids; |
37 |
| - } |
38 |
| - |
39 |
| - public MachineUpdatePacket(RegistryFriendlyByteBuf buf) { |
40 |
| - this.pos = buf.readBlockPos(); |
41 |
| - this.configuration = MachineConfiguration.CODEC.decode(buf); |
42 |
| - this.state = MachineState.CODEC.decode(buf); |
43 |
| - this.energy = MachineEnergyStorage.CODEC.decode(buf); |
44 |
| - this.items = MachineItemStorage.CODEC.decode(buf); |
45 |
| - this.fluids = MachineFluidStorage.CODEC.decode(buf); |
46 |
| - } |
47 |
| - |
48 |
| - public BlockPos getPos() { |
49 |
| - return pos; |
50 |
| - } |
51 |
| - |
52 |
| - public MachineConfiguration getConfiguration() { |
53 |
| - return configuration; |
54 |
| - } |
55 |
| - |
56 |
| - public MachineState getState() { |
57 |
| - return state; |
58 |
| - } |
59 |
| - |
60 |
| - public MachineEnergyStorage getEnergy() { |
61 |
| - return energy; |
62 |
| - } |
63 |
| - |
64 |
| - public MachineItemStorage getItems() { |
65 |
| - return items; |
66 |
| - } |
67 |
| - |
68 |
| - public MachineFluidStorage getFluids() { |
69 |
| - return fluids; |
70 |
| - } |
| 14 | +// public static final StreamCodec<RegistryFriendlyByteBuf, MachineUpdatePacket> CODEC = StreamCodec.ofMember((buf, packet) -> { |
| 15 | +// buf.writeBlockPos(packet.pos); |
| 16 | +// packet.configuration.networkCodec().encode(buf, packet.configuration); |
| 17 | +// MachineState.CODEC.encode(buf, packet.state); |
| 18 | +// MachineEnergyStorage.CODEC.encode(buf, packet.energy); |
| 19 | +// MachineItemStorage.CODEC.encode(buf, packet.items); |
| 20 | +// MachineFluidStorage.CODEC.encode(buf, packet.fluids); |
| 21 | +// }, MachineUpdatePacket::new); |
| 22 | +// |
| 23 | +// protected final BlockPos pos; |
| 24 | +// protected final MachineConfiguration configuration; |
| 25 | +// protected final MachineState state; |
| 26 | +// protected final MachineEnergyStorage energy; |
| 27 | +// protected final MachineItemStorage items; |
| 28 | +// protected final MachineFluidStorage fluids; |
| 29 | +// |
| 30 | +// public MachineUpdatePacket(BlockPos pos, MachineConfiguration configuration, MachineState state, MachineEnergyStorage energy, MachineItemStorage items, MachineFluidStorage fluids) { |
| 31 | +// this.pos = pos; |
| 32 | +// this.configuration = configuration; |
| 33 | +// this.state = state; |
| 34 | +// this.energy = energy; |
| 35 | +// this.items = items; |
| 36 | +// this.fluids = fluids; |
| 37 | +// } |
| 38 | +// |
| 39 | +// public MachineUpdatePacket(RegistryFriendlyByteBuf buf) { |
| 40 | +// this.pos = buf.readBlockPos(); |
| 41 | +// this.configuration = MachineConfiguration.CODEC.decode(buf); |
| 42 | +// this.state = MachineState.CODEC.decode(buf); |
| 43 | +// this.energy = MachineEnergyStorage.CODEC.decode(buf); |
| 44 | +// this.items = MachineItemStorage.CODEC.decode(buf); |
| 45 | +// this.fluids = MachineFluidStorage.CODEC.decode(buf); |
| 46 | +// } |
| 47 | +// |
| 48 | +// public BlockPos getPos() { |
| 49 | +// return pos; |
| 50 | +// } |
| 51 | +// |
| 52 | +// public MachineConfiguration getConfiguration() { |
| 53 | +// return configuration; |
| 54 | +// } |
| 55 | +// |
| 56 | +// public MachineState getState() { |
| 57 | +// return state; |
| 58 | +// } |
| 59 | +// |
| 60 | +// public MachineEnergyStorage getEnergy() { |
| 61 | +// return energy; |
| 62 | +// } |
| 63 | +// |
| 64 | +// public MachineItemStorage getItems() { |
| 65 | +// return items; |
| 66 | +// } |
| 67 | +// |
| 68 | +// public MachineFluidStorage getFluids() { |
| 69 | +// return fluids; |
| 70 | +// } |
71 | 71 | }
|
0 commit comments