use of net.minecraft.network.PacketByteBuf in project MCDoom by AzureDoom.
the class C2SMessageSelectCraft method send.
public static void send(int index) {
PacketByteBuf buf = new PacketByteBuf(Unpooled.buffer());
buf.writeInt(index);
ClientPlayNetworking.send(PacketHandler.lock_slot, buf);
}
use of net.minecraft.network.PacketByteBuf in project MCDoom by AzureDoom.
the class EntityPacket method createPacket.
public static Packet<?> createPacket(Entity entity) {
PacketByteBuf buf = createBuffer();
buf.writeVarInt(Registry.ENTITY_TYPE.getRawId(entity.getType()));
buf.writeUuid(entity.getUuid());
buf.writeVarInt(entity.getId());
buf.writeDouble(entity.getX());
buf.writeDouble(entity.getY());
buf.writeDouble(entity.getZ());
buf.writeByte(MathHelper.floor(entity.getPitch() * 256.0F / 360.0F));
buf.writeByte(MathHelper.floor(entity.getYaw() * 256.0F / 360.0F));
buf.writeFloat(entity.getPitch());
buf.writeFloat(entity.getYaw());
return ServerPlayNetworking.createS2CPacket(ID, buf);
}
use of net.minecraft.network.PacketByteBuf in project MCDoom by AzureDoom.
the class AxeMarauderItem method inventoryTick.
@Override
public void inventoryTick(ItemStack stack, World world, Entity entity, int slot, boolean selected) {
PlayerEntity playerentity = (PlayerEntity) entity;
if (world.isClient) {
if (playerentity.getMainHandStack().getItem() instanceof AxeMarauderItem && ClientInit.reload.isPressed() && selected) {
PacketByteBuf passedData = new PacketByteBuf(Unpooled.buffer());
passedData.writeBoolean(true);
ClientPlayNetworking.send(DoomMod.MARAUDERAXE, passedData);
}
}
}
use of net.minecraft.network.PacketByteBuf in project Polymorph by TheIllusiveC4.
the class PolymorphPacketDistributorImpl method sendStackRecipeSelectionC2S.
@Override
public void sendStackRecipeSelectionC2S(Identifier pIdentifier) {
PacketByteBuf buf = PacketByteBufs.create();
buf.writeIdentifier(pIdentifier);
ClientPlayNetworking.send(PolymorphPackets.STACK_SELECT, buf);
}
use of net.minecraft.network.PacketByteBuf in project Polymorph by TheIllusiveC4.
the class PolymorphPacketDistributorImpl method sendPlayerSyncS2C.
@Override
public void sendPlayerSyncS2C(ServerPlayerEntity pPlayer, SortedSet<RecipePair> pRecipesList, Identifier pSelected) {
PacketByteBuf buf = PacketByteBufs.create();
if (!pRecipesList.isEmpty()) {
buf.writeInt(pRecipesList.size());
for (RecipePair data : pRecipesList) {
buf.writeIdentifier(data.getIdentifier());
buf.writeItemStack(data.getOutput());
}
if (pSelected != null) {
buf.writeIdentifier(pSelected);
}
}
ServerPlayNetworking.send(pPlayer, PolymorphPackets.RECIPE_SYNC, buf);
}
Aggregations