Search in sources :

Example 1 with CustomPayloadC2SPacket

use of net.minecraft.network.packet.c2s.play.CustomPayloadC2SPacket 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 2 with CustomPayloadC2SPacket

use of net.minecraft.network.packet.c2s.play.CustomPayloadC2SPacket in project FallingAttackFabric by hamusuke0323.

the class ClientPlayerEntityMixin method sendFallingAttackPacket.

public void sendFallingAttackPacket(boolean start) {
    PacketByteBuf packetByteBuf = PacketByteBufs.create();
    packetByteBuf.writeBoolean(start);
    this.networkHandler.sendPacket(new CustomPayloadC2SPacket(NetworkManager.FALLING_ATTACK_C2S_PACKET_ID, packetByteBuf));
}
Also used : PacketByteBuf(net.minecraft.network.PacketByteBuf) CustomPayloadC2SPacket(net.minecraft.network.packet.c2s.play.CustomPayloadC2SPacket)

Example 3 with CustomPayloadC2SPacket

use of net.minecraft.network.packet.c2s.play.CustomPayloadC2SPacket in project Paradise-Lost by devs-immortal.

the class PoisonDartEntity method onHit.

@Override
protected void onHit(LivingEntity entityIn) {
    super.onHit(entityIn);
    if (entityIn instanceof ServerPlayerEntity) {
        // AetherAPI.get((PlayerEntity) entityIn).inflictPoison(500);
        PacketByteBuf byteBuf = new PacketByteBuf(Unpooled.buffer());
        byteBuf.writeInt(500);
        ((ServerPlayerEntity) entityIn).networkHandler.sendPacket(new CustomPayloadC2SPacket(Aether.locate("poison"), byteBuf));
    } else {
        this.victim = entityIn;
        this.poison = new AetherPoisonMovement(this.victim);
        this.poison.inflictPoison(500);
        this.removed = false;
    }
}
Also used : PacketByteBuf(net.minecraft.network.PacketByteBuf) CustomPayloadC2SPacket(net.minecraft.network.packet.c2s.play.CustomPayloadC2SPacket) ServerPlayerEntity(net.minecraft.server.network.ServerPlayerEntity) AetherPoisonMovement(com.aether.entities.util.AetherPoisonMovement)

Example 4 with CustomPayloadC2SPacket

use of net.minecraft.network.packet.c2s.play.CustomPayloadC2SPacket in project MasaGadget by plusls.

the class BborProtocol method bborInitializeHandler.

private static void bborInitializeHandler(ClientPlayNetworkHandler clientPlayNetworkHandler, PacketByteBuf data) {
    long seed = data.readLong();
    int spawnX = data.readInt();
    int spawnZ = data.readInt();
    BborProtocol.seedCache = seed;
    BborProtocol.spawnPos = new BlockPos(spawnX, 0, spawnZ);
    // 因此无需对是否加载 MiniHUD 进行特判
    if (!BborProtocol.carpetOrServux) {
        BborProtocol.enable = true;
        if (Configs.Minihud.COMPACT_BBOR_PROTOCOL.getBooleanValue()) {
            initMetaData();
        }
        ModInfo.LOGGER.info("init seed: {}", BborProtocol.seedCache);
        if (!ModInfo.isModLoaded(ModInfo.BBOR_MOD_ID)) {
            ModInfo.LOGGER.debug("SUBSCRIBE BBOR.");
            clientPlayNetworkHandler.sendPacket(new CustomPayloadC2SPacket(SUBSCRIBE, new PacketByteBuf(Unpooled.buffer())));
        }
    }
}
Also used : CustomPayloadC2SPacket(net.minecraft.network.packet.c2s.play.CustomPayloadC2SPacket) PacketByteBuf(net.minecraft.network.PacketByteBuf) BlockPos(net.minecraft.util.math.BlockPos)

Example 5 with CustomPayloadC2SPacket

use of net.minecraft.network.packet.c2s.play.CustomPayloadC2SPacket 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)

Aggregations

PacketByteBuf (net.minecraft.network.PacketByteBuf)5 CustomPayloadC2SPacket (net.minecraft.network.packet.c2s.play.CustomPayloadC2SPacket)5 AetherPoisonMovement (com.aether.entities.util.AetherPoisonMovement)1 ServerPlayerEntity (net.minecraft.server.network.ServerPlayerEntity)1 BlockPos (net.minecraft.util.math.BlockPos)1