Search in sources :

Example 46 with PacketByteBuf

use of net.minecraft.network.PacketByteBuf in project Biome-Makeover by Lemonszz.

the class EntityUtil method WriteEntitySpawn.

public static PacketByteBuf WriteEntitySpawn(Entity entity) {
    PacketByteBuf buf = new PacketByteBuf(Unpooled.buffer());
    buf.writeVarInt(Registry.ENTITY_TYPE.getRawId(entity.getType()));
    buf.writeUuid(entity.getUuid());
    buf.writeVarInt(entity.getEntityId());
    buf.writeDouble(entity.getX());
    buf.writeDouble(entity.getY());
    buf.writeDouble(entity.getZ());
    buf.writeFloat(entity.pitch);
    buf.writeFloat(entity.yaw);
    return buf;
}
Also used : PacketByteBuf(net.minecraft.network.PacketByteBuf)

Example 47 with PacketByteBuf

use of net.minecraft.network.PacketByteBuf in project Biome-Makeover by Lemonszz.

the class NetworkUtil method doLightningEntity.

public static void doLightningEntity(World world, LivingEntity entity, int count) {
    if (world.isClient)
        return;
    PacketByteBuf buf = new PacketByteBuf(Unpooled.buffer());
    buf.writeInt(entity.getEntityId());
    buf.writeInt(count);
    serverSendTracking(world, entity.getBlockPos(), BMNetwork.SPAWN_LIGHTNING_ENTITY_PARTICLES, buf);
}
Also used : PacketByteBuf(net.minecraft.network.PacketByteBuf)

Example 48 with PacketByteBuf

use of net.minecraft.network.PacketByteBuf in project Biome-Makeover by Lemonszz.

the class NetworkUtil method doEntityParticle.

public static void doEntityParticle(World world, ParticleEffect effect, Entity e, int count, float offset) {
    if (world.isClient)
        return;
    PacketByteBuf buf = new PacketByteBuf(Unpooled.buffer());
    buf.writeInt(e.getEntityId());
    buf.writeInt(Registry.PARTICLE_TYPE.getRawId((ParticleType<?>) effect));
    buf.writeInt(count);
    buf.writeFloat(offset);
    buf.writeDouble(world.random.nextGaussian() * 0.02D);
    buf.writeDouble(world.random.nextGaussian() * 0.02D);
    buf.writeDouble(world.random.nextGaussian() * 0.02D);
    serverSendTracking(world, e.getBlockPos(), BMNetwork.ENTITY_PARTICLE, buf);
}
Also used : PacketByteBuf(net.minecraft.network.PacketByteBuf) ParticleType(net.minecraft.particle.ParticleType)

Example 49 with PacketByteBuf

use of net.minecraft.network.PacketByteBuf in project Biome-Makeover by Lemonszz.

the class NetworkUtil method sendSlideTime.

public static void sendSlideTime(PlayerEntity player, int time) {
    if (player.world.isClient())
        return;
    PacketByteBuf buf = new PacketByteBuf(Unpooled.buffer());
    buf.writeVarInt(time);
    ServerPlayNetworking.send((ServerPlayerEntity) player, BMNetwork.SET_SLIDE_TIME, buf);
}
Also used : PacketByteBuf(net.minecraft.network.PacketByteBuf)

Example 50 with PacketByteBuf

use of net.minecraft.network.PacketByteBuf in project Biome-Makeover by Lemonszz.

the class NetworkUtil method doLightningSplash.

public static void doLightningSplash(World world, boolean doBottle, BlockPos pos) {
    if (world.isClient)
        return;
    PacketByteBuf buf = new PacketByteBuf(Unpooled.buffer());
    buf.writeBoolean(doBottle);
    buf.writeBlockPos(pos);
    serverSendTracking(world, pos, BMNetwork.SPAWN_LIGHTNING_BOTTLE_PARTICLES, buf);
}
Also used : PacketByteBuf(net.minecraft.network.PacketByteBuf)

Aggregations

PacketByteBuf (net.minecraft.network.PacketByteBuf)117 PlayerEntity (net.minecraft.entity.player.PlayerEntity)21 ServerPlayerEntity (net.minecraft.server.network.ServerPlayerEntity)14 Identifier (net.minecraft.util.Identifier)8 NbtCompound (net.minecraft.nbt.NbtCompound)7 Environment (net.fabricmc.api.Environment)5 CustomPayloadC2SPacket (net.minecraft.network.packet.c2s.play.CustomPayloadC2SPacket)5 CustomPayloadS2CPacket (net.minecraft.network.packet.s2c.play.CustomPayloadS2CPacket)4 Nullable (org.jetbrains.annotations.Nullable)4 Inject (org.spongepowered.asm.mixin.injection.Inject)4 ArrayList (java.util.ArrayList)3 UUID (java.util.UUID)3 JSONSource (de.modprog.blockmeter.util.JSONSource)2 Map (java.util.Map)2 ServerPlayNetworking (net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking)2 LivingEntity (net.minecraft.entity.LivingEntity)2 CompoundTag (net.minecraft.nbt.CompoundTag)2 ListTag (net.minecraft.nbt.ListTag)2 ParticleType (net.minecraft.particle.ParticleType)2 LiteralText (net.minecraft.text.LiteralText)2