use of net.minecraft.network.PacketByteBuf in project BlockMeter by ModProg.
the class BlockMeterClient method sendBoxList.
/**
* Sends BoxList to Server if enabled in the config
*/
private void sendBoxList() {
if (!AutoConfig.getConfigHolder(ModConfig.class).getConfig().sendBoxes)
return;
PacketByteBuf passedData = new PacketByteBuf(Unpooled.buffer());
passedData.writeInt(boxes.size());
for (int i = 0; i < boxes.size(); i++) {
boxes.get(i).writePacketBuf(passedData);
}
ClientPlayNetworking.send(BlockMeter.C2SPacketIdentifier, passedData);
}
use of net.minecraft.network.PacketByteBuf in project BlockMeter by ModProg.
the class MeasureBoxTest method testPacketByteBuf.
@ParameterizedTest
@JSONSource(classes = { ParseBlockPos.class, ParseBlockPos.class, ParseIdentifier.class, ParseDyeColor.class, Boolean.class }, jsons = { "(11|2|-50), (0|0|0), overworld, red, true", "(10020|45|130), (10000|99|203), end, blue, false", "(17|0|40), (40|256|70), overworld, red, true", "(-1455|2|-6000), (-1455|32|-5000), overworld, red, true" })
void testPacketByteBuf(BlockPos bp1, BlockPos bp2, Identifier dimension, DyeColor color, boolean finished) {
final PacketByteBuf expectedBuf = new PacketByteBuf(Unpooled.buffer());
expectedBuf.writeBlockPos(bp1);
expectedBuf.writeBlockPos(bp2);
expectedBuf.writeIdentifier(dimension);
expectedBuf.writeInt(color.getId());
expectedBuf.writeBoolean(finished);
expectedBuf.writeInt(0);
expectedBuf.writeInt(0);
final MeasureBox mb = MeasureBox.fromPacketByteBuf(expectedBuf);
final PacketByteBuf actualBuf = new PacketByteBuf(Unpooled.buffer());
mb.writePacketBuf(actualBuf);
expectedBuf.resetReaderIndex();
assertThat(expectedBuf).isEqualTo(actualBuf);
}
use of net.minecraft.network.PacketByteBuf in project bewitchment by MoriyaShiine.
the class TransformationAbilityPacket method send.
public static void send() {
PacketByteBuf buf = new PacketByteBuf(Unpooled.buffer());
ClientPlayNetworking.send(ID, buf);
}
use of net.minecraft.network.PacketByteBuf in project bewitchment by MoriyaShiine.
the class SpawnExplosionParticlesPacket method send.
public static void send(PlayerEntity player, Entity entity) {
PacketByteBuf buf = new PacketByteBuf(Unpooled.buffer());
buf.writeInt(entity.getId());
ServerPlayNetworking.send((ServerPlayerEntity) player, ID, buf);
}
use of net.minecraft.network.PacketByteBuf in project bewitchment by MoriyaShiine.
the class SpawnPortalParticlesPacket method send.
public static void send(PlayerEntity player, Entity entity) {
PacketByteBuf buf = new PacketByteBuf(Unpooled.buffer());
buf.writeInt(entity.getId());
ServerPlayNetworking.send((ServerPlayerEntity) player, ID, buf);
}
Aggregations