Search in sources :

Example 1 with FireworkRocketEntity

use of net.minecraft.entity.projectile.FireworkRocketEntity in project BluePower by Qmunity.

the class DateEventHandler method spawnFirework.

public static void spawnFirework(World world, double x, double y, double z) {
    ItemStack rocket = new ItemStack(Items.FIREWORK_ROCKET);
    ItemStack itemstack1 = getFireworkCharge();
    CompoundNBT nbttagcompound = new CompoundNBT();
    CompoundNBT nbttagcompound1 = new CompoundNBT();
    ListNBT nbttaglist = new ListNBT();
    if (!itemstack1.isEmpty() && itemstack1.getItem() == Items.FIREWORK_STAR && itemstack1.hasTag() && itemstack1.getTag().hasUUID("Explosion")) {
        nbttaglist.add(itemstack1.getTag().getCompound("Explosion"));
    }
    nbttagcompound1.put("Explosions", nbttaglist);
    nbttagcompound1.putByte("Flight", (byte) 2);
    nbttagcompound.put("Fireworks", nbttagcompound1);
    rocket.setTag(nbttagcompound);
    FireworkRocketEntity entity = new FireworkRocketEntity(world, x, y, z, rocket);
    world.addFreshEntity(entity);
}
Also used : ListNBT(net.minecraft.nbt.ListNBT) CompoundNBT(net.minecraft.nbt.CompoundNBT) FireworkRocketEntity(net.minecraft.entity.projectile.FireworkRocketEntity) ItemStack(net.minecraft.item.ItemStack)

Aggregations

FireworkRocketEntity (net.minecraft.entity.projectile.FireworkRocketEntity)1 ItemStack (net.minecraft.item.ItemStack)1 CompoundNBT (net.minecraft.nbt.CompoundNBT)1 ListNBT (net.minecraft.nbt.ListNBT)1