Search in sources :

Example 6 with ClientboundEntityEventPacket

use of net.minecraft.network.protocol.game.ClientboundEntityEventPacket in project UltraCosmetics by iSach.

the class CustomEntityFirework method tick.

@Override
public void tick() {
    if (gone) {
        return;
    }
    if (!this.level.isClientSide) {
        gone = true;
        if (players != null)
            if (players.length > 0)
                for (Player player : players) (((CraftPlayer) player).getHandle()).connection.send(new ClientboundEntityEventPacket(this, (byte) 17));
            else
                level.broadcastEntityEvent(this, (byte) 17);
        ((Entity) this).discard();
    }
}
Also used : FireworkRocketEntity(net.minecraft.world.entity.projectile.FireworkRocketEntity) Entity(net.minecraft.world.entity.Entity) CraftPlayer(org.bukkit.craftbukkit.v1_17_R1.entity.CraftPlayer) Player(org.bukkit.entity.Player) CraftPlayer(org.bukkit.craftbukkit.v1_17_R1.entity.CraftPlayer) ClientboundEntityEventPacket(net.minecraft.network.protocol.game.ClientboundEntityEventPacket)

Example 7 with ClientboundEntityEventPacket

use of net.minecraft.network.protocol.game.ClientboundEntityEventPacket in project UltraCosmetics by iSach.

the class CustomEntityFirework method tick.

@Override
public void tick() {
    if (gone) {
        return;
    }
    if (!this.level.isClientSide) {
        gone = true;
        if (players != null)
            if (players.length > 0)
                for (Player player : players) (((CraftPlayer) player).getHandle()).connection.send(new ClientboundEntityEventPacket(this, (byte) 17));
            else
                level.broadcastEntityEvent(this, (byte) 17);
        ((Entity) this).discard();
    }
}
Also used : FireworkRocketEntity(net.minecraft.world.entity.projectile.FireworkRocketEntity) Entity(net.minecraft.world.entity.Entity) CraftPlayer(org.bukkit.craftbukkit.v1_18_R2.entity.CraftPlayer) Player(org.bukkit.entity.Player) CraftPlayer(org.bukkit.craftbukkit.v1_18_R2.entity.CraftPlayer) ClientboundEntityEventPacket(net.minecraft.network.protocol.game.ClientboundEntityEventPacket)

Aggregations

ClientboundEntityEventPacket (net.minecraft.network.protocol.game.ClientboundEntityEventPacket)7 FireworkRocketEntity (net.minecraft.world.entity.projectile.FireworkRocketEntity)7 ClientboundAddEntityPacket (net.minecraft.network.protocol.game.ClientboundAddEntityPacket)5 ClientboundSetEntityDataPacket (net.minecraft.network.protocol.game.ClientboundSetEntityDataPacket)5 SynchedEntityData (net.minecraft.network.syncher.SynchedEntityData)5 ServerLevel (net.minecraft.server.level.ServerLevel)5 HangingEntity (net.minecraft.world.entity.decoration.HangingEntity)5 FallingBlockEntity (net.minecraft.world.entity.item.FallingBlockEntity)5 ItemEntity (net.minecraft.world.entity.item.ItemEntity)5 BlockEntity (net.minecraft.world.level.block.entity.BlockEntity)5 SignBlockEntity (net.minecraft.world.level.block.entity.SignBlockEntity)5 Vec3 (net.minecraft.world.phys.Vec3)5 Entity (org.bukkit.entity.Entity)5 HumanEntity (org.bukkit.entity.HumanEntity)5 LivingEntity (org.bukkit.entity.LivingEntity)5 ItemStack (org.bukkit.inventory.ItemStack)5 FireworkMeta (org.bukkit.inventory.meta.FireworkMeta)5 ClientboundRemoveEntitiesPacket (net.minecraft.network.protocol.game.ClientboundRemoveEntitiesPacket)4 Entity (net.minecraft.world.entity.Entity)2 CraftWorld (org.bukkit.craftbukkit.v1_17_R1.CraftWorld)2