Search in sources :

Example 16 with PacketByteBuf

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

the class PolymorphPacketDistributorImpl method sendPlayerRecipeSelectionC2S.

@Override
public void sendPlayerRecipeSelectionC2S(Identifier pIdentifier) {
    PacketByteBuf buf = PacketByteBufs.create();
    buf.writeIdentifier(pIdentifier);
    ClientPlayNetworking.send(PolymorphPackets.PLAYER_SELECT, buf);
}
Also used : PacketByteBuf(net.minecraft.network.PacketByteBuf)

Example 17 with PacketByteBuf

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

the class PolymorphPacketDistributorImpl method sendHighlightRecipeS2C.

@Override
public void sendHighlightRecipeS2C(ServerPlayerEntity pPlayer, Identifier pIdentifier) {
    PacketByteBuf buf = PacketByteBufs.create();
    buf.writeIdentifier(pIdentifier);
    ServerPlayNetworking.send(pPlayer, PolymorphPackets.HIGHLIGHT_RECIPE, buf);
}
Also used : PacketByteBuf(net.minecraft.network.PacketByteBuf)

Example 18 with PacketByteBuf

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

the class RoughlyEnoughItemsModule method selectRecipe.

public static void selectRecipe(Display pRecipeDisplay) {
    pRecipeDisplay.getDisplayLocation().ifPresent(recipe -> {
        PacketByteBuf buf = PacketByteBufs.create();
        buf.writeIdentifier(recipe);
        ClientPlayNetworking.send(PolymorphPackets.PLAYER_SELECT, buf);
    });
}
Also used : PacketByteBuf(net.minecraft.network.PacketByteBuf)

Example 19 with PacketByteBuf

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

the class TimerPacketHandler method sendCompleteC2S.

/*
    Timer complete packets
     */
public static void sendCompleteC2S(InGameTimer timer) {
    if (!SpeedRunOption.getOption(SpeedRunOptions.AUTOMATIC_COOP_MODE))
        return;
    PacketByteBuf passedData = new PacketByteBuf(Unpooled.buffer());
    passedData.writeLong(timer.endTime);
    if (client.getNetworkHandler() != null)
        client.getNetworkHandler().getConnection().send(new CustomPayloadC2SPacket(PACKET_TIMER_COMPLETE_ID, passedData));
}
Also used : PacketByteBuf(net.minecraft.network.PacketByteBuf) CustomPayloadC2SPacket(net.minecraft.network.packet.c2s.play.CustomPayloadC2SPacket)

Example 20 with PacketByteBuf

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

the class TimerPacketHandler method sendInitS2C.

public static void sendInitS2C(List<ServerPlayerEntity> players, long startTime, RunCategory category) {
    PacketByteBuf passedData = new PacketByteBuf(Unpooled.buffer());
    passedData.writeLong(startTime);
    passedData.writeString(category.getID());
    CustomPayloadS2CPacket s2CPacket = new CustomPayloadS2CPacket(PACKET_TIMER_INIT_ID, passedData);
    for (ServerPlayerEntity player : players) {
        player.networkHandler.sendPacket(s2CPacket);
    }
}
Also used : CustomPayloadS2CPacket(net.minecraft.network.packet.s2c.play.CustomPayloadS2CPacket) PacketByteBuf(net.minecraft.network.PacketByteBuf) ServerPlayerEntity(net.minecraft.server.network.ServerPlayerEntity)

Aggregations

PacketByteBuf (net.minecraft.network.PacketByteBuf)158 PlayerEntity (net.minecraft.entity.player.PlayerEntity)40 ServerPlayerEntity (net.minecraft.server.network.ServerPlayerEntity)18 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