Search in sources :

Example 31 with PacketByteBuf

use of net.minecraft.network.PacketByteBuf in project bewitchment by MoriyaShiine.

the class SyncDemonTradesPacket method send.

public static void send(PlayerEntity player, DemonMerchant merchant, int syncId) {
    PacketByteBuf buf = new PacketByteBuf(Unpooled.buffer());
    buf.writeInt(syncId);
    DemonEntity.DemonTradeOffer.toPacket(merchant.getOffers(), buf);
    buf.writeInt(merchant.getDemonTrader().getId());
    buf.writeBoolean(merchant.isDiscount());
    ServerPlayNetworking.send((ServerPlayerEntity) player, ID, buf);
}
Also used : PacketByteBuf(net.minecraft.network.PacketByteBuf)

Example 32 with PacketByteBuf

use of net.minecraft.network.PacketByteBuf in project WK by witches-kitchen.

the class ParticlePacketHandler method send.

public static void send(ServerPlayerEntity player, final BlockPos pos, final Identifier particle, @Nullable final Identifier sound, final byte range) {
    final PacketByteBuf data = PacketByteBufs.create();
    data.writeBlockPos(pos);
    data.writeIdentifier(particle);
    data.writeIdentifier(sound == null ? new Identifier("") : sound);
    data.writeByte(range);
    ServerPlayNetworking.send(player, CHANNEL, data);
}
Also used : Identifier(net.minecraft.util.Identifier) PacketByteBuf(net.minecraft.network.PacketByteBuf)

Example 33 with PacketByteBuf

use of net.minecraft.network.PacketByteBuf in project WK by witches-kitchen.

the class SplashParticlePacketHandler method send.

public static void send(ServerPlayerEntity player, BlockPos pos, double r, double g, double b, double offsetX, double offsetY, double offsetZ, byte amount) {
    PacketByteBuf data = PacketByteBufs.create();
    data.writeBlockPos(pos);
    data.writeDouble(r);
    data.writeDouble(g);
    data.writeDouble(b);
    data.writeDouble(offsetX);
    data.writeDouble(offsetY);
    data.writeDouble(offsetZ);
    data.writeByte(amount);
    ServerPlayNetworking.send(player, SPLASH_PARTICLE_CHANNEL, data);
}
Also used : PacketByteBuf(net.minecraft.network.PacketByteBuf)

Example 34 with PacketByteBuf

use of net.minecraft.network.PacketByteBuf in project frame-fabric by moddingplayground.

the class SynchronizedBooleanGameRuleRegistryImpl method synchronize.

public void synchronize(ServerPlayerEntity player, String id, boolean value) {
    PacketByteBuf buf = PacketByteBufs.create();
    buf.writeString(id);
    buf.writeBoolean(value);
    ServerPlayNetworking.send(player, PACKET_ID, buf);
}
Also used : PacketByteBuf(net.minecraft.network.PacketByteBuf)

Example 35 with PacketByteBuf

use of net.minecraft.network.PacketByteBuf in project VeinMining by TheIllusiveC4.

the class VeinMiningNetwork method sendState.

public static void sendState(boolean state) {
    PacketByteBuf buf = PacketByteBufs.create();
    buf.writeBoolean(state);
    ClientPlayNetworking.send(SEND_STATE, buf);
}
Also used : PacketByteBuf(net.minecraft.network.PacketByteBuf)

Aggregations

PacketByteBuf (net.minecraft.network.PacketByteBuf)156 PlayerEntity (net.minecraft.entity.player.PlayerEntity)40 ServerPlayerEntity (net.minecraft.server.network.ServerPlayerEntity)17 Identifier (net.minecraft.util.Identifier)12 CustomPayloadS2CPacket (net.minecraft.network.packet.s2c.play.CustomPayloadS2CPacket)9 NbtCompound (net.minecraft.nbt.NbtCompound)7 CustomPayloadC2SPacket (net.minecraft.network.packet.c2s.play.CustomPayloadC2SPacket)7 Inject (org.spongepowered.asm.mixin.injection.Inject)6 Environment (net.fabricmc.api.Environment)5 UUID (java.util.UUID)4 LivingEntity (net.minecraft.entity.LivingEntity)4 Nullable (org.jetbrains.annotations.Nullable)4 ArrayList (java.util.ArrayList)3 Map (java.util.Map)3 LiteralText (net.minecraft.text.LiteralText)3 GenderPlayer (com.wildfire.main.GenderPlayer)2 JSONSource (de.modprog.blockmeter.util.JSONSource)2 IHungerManager (de.siphalor.spiceoffabric.util.IHungerManager)2 HWGEntity (mod.azure.hwg.entity.HWGEntity)2 ServerPlayNetworking (net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking)2