Search in sources :

Example 91 with PacketByteBuf

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

the class PolymorphPacketDistributorImpl method sendRecipesListS2C.

@Override
public void sendRecipesListS2C(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.RECIPES_LIST, buf);
}
Also used : RecipePair(top.theillusivec4.polymorph.api.common.base.RecipePair) PacketByteBuf(net.minecraft.network.PacketByteBuf)

Example 92 with PacketByteBuf

use of net.minecraft.network.PacketByteBuf in project SpeedRunIGT by RedLime.

the class TimerPacketHandler method sendInitC2S.

public static void sendInitC2S(long time, RunCategory category) {
    if (!SpeedRunOption.getOption(SpeedRunOptions.AUTOMATIC_COOP_MODE))
        return;
    PacketByteBuf passedData = new PacketByteBuf(Unpooled.buffer());
    passedData.writeLong(time);
    passedData.writeString(category.getID());
    if (client.getNetworkHandler() != null)
        client.getNetworkHandler().getConnection().send(new CustomPayloadC2SPacket(PACKET_TIMER_INIT_ID, passedData));
}
Also used : PacketByteBuf(net.minecraft.network.PacketByteBuf) CustomPayloadC2SPacket(net.minecraft.network.packet.c2s.play.CustomPayloadC2SPacket)

Example 93 with PacketByteBuf

use of net.minecraft.network.PacketByteBuf in project BleachHack by BleachDrinker420.

the class PlayerInteractEntityC2SUtils method getEntity.

public static Entity getEntity(PlayerInteractEntityC2SPacket packet) {
    PacketByteBuf packetBuf = new PacketByteBuf(Unpooled.buffer());
    packet.write(packetBuf);
    return MinecraftClient.getInstance().world.getEntityById(packetBuf.readVarInt());
}
Also used : PacketByteBuf(net.minecraft.network.PacketByteBuf)

Example 94 with PacketByteBuf

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

the class PoltergeistHandler method doParticles.

public static void doParticles(World world, BlockPos pos) {
    PacketByteBuf data = new PacketByteBuf(Unpooled.buffer());
    data.writeInt(pos.getX());
    data.writeInt(pos.getY());
    data.writeInt(pos.getZ());
    NetworkUtil.serverSendTracking(world, pos, BMNetwork.SPAWN_POLTERGEIGHT_PARTICLE, data);
}
Also used : PacketByteBuf(net.minecraft.network.PacketByteBuf)

Example 95 with PacketByteBuf

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

the class EffectHelper method doEffect.

public static void doEffect(World world, int effect, BlockPos pos) {
    if (world.isClient())
        return;
    PacketByteBuf buf = PacketByteBufs.create();
    buf.writeVarInt(effect);
    buf.writeBlockPos(pos);
    NetworkUtil.serverSendTracking(world, pos, BMNetwork.BM_EVENT, 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