use of net.minecraft.network.PacketByteBuf in project BleachHack by BleachDrinker420.
the class PlayerInteractEntityC2SUtils method getInteractType.
public static InteractType getInteractType(PlayerInteractEntityC2SPacket packet) {
PacketByteBuf packetBuf = new PacketByteBuf(Unpooled.buffer());
packet.write(packetBuf);
packetBuf.readVarInt();
return packetBuf.readEnumConstant(InteractType.class);
}
use of net.minecraft.network.PacketByteBuf in project BleachHack by BleachDrinker420.
the class MixinPacketInflater method decode.
@Inject(method = "decode", at = @At("HEAD"), cancellable = true)
private void decode(ChannelHandlerContext channelHandlerContext, ByteBuf byteBuf, List<Object> list, CallbackInfo info) throws Exception {
if (ModuleManager.getModule(AntiChunkBan.class).isEnabled()) {
info.cancel();
if (byteBuf.readableBytes() != 0) {
PacketByteBuf packetByteBuf_1 = new PacketByteBuf(byteBuf);
int i = packetByteBuf_1.readVarInt();
if (i == 0) {
list.add(packetByteBuf_1.readBytes(packetByteBuf_1.readableBytes()));
} else {
if (i > 51200000) {
throw new DecoderException("Badly compressed packet - size of " + i / 1000000 + "MB is larger than protocol maximum of 50 MB");
}
byte[] bs = new byte[packetByteBuf_1.readableBytes()];
packetByteBuf_1.readBytes(bs);
this.inflater.setInput(bs);
byte[] cs = new byte[i];
this.inflater.inflate(cs);
list.add(Unpooled.wrappedBuffer(cs));
this.inflater.reset();
}
}
}
}
use of net.minecraft.network.PacketByteBuf in project bewitchment by MoriyaShiine.
the class TogglePressingForwardPacket method send.
public static void send(boolean pressingForward) {
PacketByteBuf buf = new PacketByteBuf(Unpooled.buffer());
buf.writeBoolean(pressingForward);
ClientPlayNetworking.send(ID, buf);
}
use of net.minecraft.network.PacketByteBuf in project bewitchment by MoriyaShiine.
the class SpawnSmokeParticlesPacket 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 SyncContractsPacket method send.
public static void send(PlayerEntity player) {
PacketByteBuf buf = new PacketByteBuf(Unpooled.buffer());
NbtCompound contracts = new NbtCompound();
contracts.put("Contracts", BWComponents.CONTRACTS_COMPONENT.get(player).toNbtContract());
buf.writeNbt(contracts);
ServerPlayNetworking.send((ServerPlayerEntity) player, ID, buf);
}
Aggregations