net.minecraft.entity.item.EntityFireworkRocket Java Examples
The following examples show how to use
net.minecraft.entity.item.EntityFireworkRocket.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ActivationRange.java From Kettle with GNU General Public License v3.0 | 6 votes |
/** * These entities are excluded from Activation range checks. * * @param entity * @return boolean If it should always tick. */ public static boolean initializeEntityActivationState(Entity entity, SpigotWorldConfig config) { if (config == null && DimensionManager.getWorld(0) != null) { config = DimensionManager.getWorld(0).spigotConfig; } else { return true; } return ((entity.activationType == 3 && config.miscActivationRange == 0) || (entity.activationType == 2 && config.animalActivationRange == 0) || (entity.activationType == 1 && config.monsterActivationRange == 0) || entity instanceof EntityPlayer || entity instanceof EntityThrowable || entity instanceof MultiPartEntityPart || entity instanceof EntityWither || entity instanceof EntityFireball || entity instanceof EntityFallingBlock || entity instanceof EntityWeatherEffect || entity instanceof EntityTNTPrimed || entity instanceof EntityEnderCrystal || entity instanceof EntityFireworkRocket || (entity.getClass().getSuperclass() == Entity.class && !entity.isCreatureType(EnumCreatureType.CREATURE, false)) && !entity.isCreatureType(EnumCreatureType.AMBIENT, false) && !entity.isCreatureType(EnumCreatureType.MONSTER, false) && !entity.isCreatureType(EnumCreatureType.WATER_CREATURE, false) ); }
Example #2
Source File: DateEventHandler.java From PneumaticCraft with GNU General Public License v3.0 | 6 votes |
public static void spawnFirework(World world, double x, double y, double z){ ItemStack rocket = new ItemStack(Items.fireworks); ItemStack itemstack1 = getFireworkCharge(); NBTTagCompound nbttagcompound = new NBTTagCompound(); NBTTagCompound nbttagcompound1 = new NBTTagCompound(); NBTTagList nbttaglist = new NBTTagList(); if(itemstack1 != null && itemstack1.getItem() == Items.firework_charge && itemstack1.hasTagCompound() && itemstack1.getTagCompound().hasKey("Explosion")) { nbttaglist.appendTag(itemstack1.getTagCompound().getCompoundTag("Explosion")); } nbttagcompound1.setTag("Explosions", nbttaglist); nbttagcompound1.setByte("Flight", (byte)2); nbttagcompound.setTag("Fireworks", nbttagcompound1); rocket.setTagCompound(nbttagcompound); EntityFireworkRocket entity = new EntityFireworkRocket(world, x, y, z, rocket); world.spawnEntityInWorld(entity); }
Example #3
Source File: CraftFirework.java From Kettle with GNU General Public License v3.0 | 5 votes |
@Override public void setFireworkMeta(FireworkMeta meta) { item.setItemMeta(meta); // Copied from EntityFireworks constructor, update firework lifetime/power getHandle().lifetime = 10 * (1 + meta.getPower()) + random.nextInt(6) + random.nextInt(7); getHandle().getDataManager().setDirty(EntityFireworkRocket.FIREWORK_ITEM); }
Example #4
Source File: ActivationRange.java From Kettle with GNU General Public License v3.0 | 5 votes |
/** * Checks if the entity is active for this tick. * * @param entity * @return */ public static boolean checkIfActive(Entity entity) { // Never safe to skip fireworks or entities not yet added to chunk // PAIL: inChunk - boolean under datawatchers if (!entity.addedToChunk || entity instanceof EntityFireworkRocket) { return true; } boolean isActive = entity.activatedTick >= MinecraftServer.currentTick || entity.defaultActivationState; // Should this entity tick? if (!isActive) { if ((MinecraftServer.currentTick - entity.activatedTick - 1) % 20 == 0) { // Check immunities every 20 ticks. if (checkEntityImmunities(entity)) { // Triggered some sort of immunity, give 20 full ticks before we check again. entity.activatedTick = MinecraftServer.currentTick + 20; } isActive = true; } // Add a little performance juice to active entities. Skip 1/4 if not immune. } else if (!entity.defaultActivationState && entity.ticksExisted % 4 == 0 && !checkEntityImmunities(entity)) { isActive = false; } int x = MathHelper.floor(entity.posX); int z = MathHelper.floor(entity.posZ); // Make sure not on edge of unloaded chunk Chunk chunk = entity.world.getChunkIfLoaded(x >> 4, z >> 4); if (isActive && !(chunk != null)) { isActive = false; } return isActive; }
Example #5
Source File: ActivationRange.java From Thermos with GNU General Public License v3.0 | 5 votes |
/** * These entities are excluded from Activation range checks. * * @param entity * @param world * @return boolean If it should always tick. */ public static boolean initializeEntityActivationState(Entity entity, SpigotWorldConfig config) { // Cauldron start - another fix for Proxy Worlds if (config == null && DimensionManager.getWorld(0) != null) { config = DimensionManager.getWorld(0).spigotConfig; } else { return true; } // Cauldron end if ( ( entity.activationType == 3 && config.miscActivationRange == 0 ) || ( entity.activationType == 2 && config.animalActivationRange == 0 ) || ( entity.activationType == 1 && config.monsterActivationRange == 0 ) || (entity instanceof EntityPlayer && !(entity instanceof FakePlayer)) // Cauldron || entity instanceof EntityThrowable || entity instanceof EntityDragon || entity instanceof EntityDragonPart || entity instanceof EntityWither || entity instanceof EntityFireball || entity instanceof EntityWeatherEffect || entity instanceof EntityTNTPrimed || entity instanceof EntityFallingBlock // PaperSpigot - Always tick falling blocks || entity instanceof EntityEnderCrystal || entity instanceof EntityFireworkRocket || entity instanceof EntityVillager // Cauldron start - force ticks for entities with superclass of Entity and not a creature/monster || (entity.getClass().getSuperclass() == Entity.class && !entity.isCreatureType(EnumCreatureType.creature, false) && !entity.isCreatureType(EnumCreatureType.ambient, false) && !entity.isCreatureType(EnumCreatureType.monster, false) && !entity.isCreatureType(EnumCreatureType.waterCreature, false))) { return true; } return false; }
Example #6
Source File: JetpackPotato.java From SimplyJetpacks with MIT License | 5 votes |
@Override public void flyUser(EntityLivingBase user, ItemStack stack, ItemPack item, boolean force) { if (this.isFired(stack)) { super.flyUser(user, stack, item, true); user.rotationYawHead += 37.5F; if (item.getFuelStored(stack) <= 0) { user.setCurrentItemOrArmor(3, null); if (!user.worldObj.isRemote) { user.worldObj.createExplosion(user, user.posX, user.posY, user.posZ, 4.0F, false); for (int i = 0; i <= MathHelper.RANDOM.nextInt(3) + 4; i++) { ItemStack firework = FireworksHelper.getRandomFireworks(0, 1, MathHelper.RANDOM.nextInt(6) + 1, 1); user.worldObj.spawnEntityInWorld(new EntityFireworkRocket(user.worldObj, user.posX + MathHelper.RANDOM.nextDouble() * 6.0D - 3.0D, user.posY, user.posZ + MathHelper.RANDOM.nextDouble() * 6.0D - 3.0D, firework)); } user.attackEntityFrom(new EntityDamageSource("jetpackpotato", user), 100.0F); if (user instanceof EntityPlayer) { user.dropItem(Items.baked_potato, 1); } } } } else { if (force || SyncHandler.isFlyKeyDown(user)) { if (this.isTimerSet(stack)) { this.decrementTimer(stack, user); } else { this.setTimer(stack, 50); } } } }
Example #7
Source File: DispenserBehaviorFireworks.java From Artifacts with MIT License | 5 votes |
/** * Dispense the specified stack, play the dispense sound and spawn particles. */ public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack) { EnumFacing enumfacing = BlockDispenser.func_149937_b/*getFacing*/(par1IBlockSource.getBlockMetadata()); double d0 = par1IBlockSource.getX() + (double)enumfacing.getFrontOffsetX(); double d1 = (double)((float)par1IBlockSource.getYInt() + 0.2F); double d2 = par1IBlockSource.getZ() + (double)enumfacing.getFrontOffsetZ(); EntityFireworkRocket entityfireworkrocket = new EntityFireworkRocket(par1IBlockSource.getWorld(), d0, d1, d2, par2ItemStack); par1IBlockSource.getWorld().spawnEntityInWorld(entityfireworkrocket); par2ItemStack.splitStack(1); return par2ItemStack; }
Example #8
Source File: CraftFirework.java From Kettle with GNU General Public License v3.0 | 4 votes |
@Override public EntityFireworkRocket getHandle() { return (EntityFireworkRocket) entity; }
Example #9
Source File: CraftEventFactory.java From Kettle with GNU General Public License v3.0 | 4 votes |
public static FireworkExplodeEvent callFireworkExplodeEvent(EntityFireworkRocket firework) { FireworkExplodeEvent event = new FireworkExplodeEvent((Firework) firework.getBukkitEntity()); firework.world.getServer().getPluginManager().callEvent(event); return event; }
Example #10
Source File: CraftFirework.java From Thermos with GNU General Public License v3.0 | 4 votes |
@Override public EntityFireworkRocket getHandle() { return (EntityFireworkRocket) entity; }
Example #11
Source File: ActivationRange.java From Thermos with GNU General Public License v3.0 | 4 votes |
/** * Checks if the entity is active for this tick. * * @param entity * @return */ public static boolean checkIfActive(Entity entity) { SpigotTimings.checkIfActiveTimer.startTiming(); boolean isActive = entity.activatedTick >= MinecraftServer.currentTick || entity.defaultActivationState; // Should this entity tick? if ( !isActive ) { if ( ( MinecraftServer.currentTick - entity.activatedTick - 1 ) % 20 == 0 ) { // Check immunities every 20 ticks. if ( checkEntityImmunities( entity ) ) { // Triggered some sort of immunity, give 20 full ticks before we check again. entity.activatedTick = MinecraftServer.currentTick + 20; } isActive = true; } // Add a little performance juice to active entities. Skip 1/4 if not immune. } else if ( !entity.defaultActivationState && entity.ticksExisted % 4 == 0 && !checkEntityImmunities( entity ) ) { isActive = false; } // Cauldron - we check for entities in forced chunks in World.updateEntityWithOptionalForce // Make sure not on edge of unloaded chunk int x = net.minecraft.util.MathHelper.floor_double( entity.posX ); int z = net.minecraft.util.MathHelper.floor_double( entity.posZ ); if ( isActive && !(entity.worldObj.isActiveBlockCoord(x, z) || entity.worldObj.doChunksNearChunkExist( x, 0, z, 16 ) )) { isActive = false; } if(entity instanceof EntityFireworkRocket || !entity.isAddedToChunk()) // Force continued activation for teleporting entities { isActive = true; } SpigotTimings.checkIfActiveTimer.stopTiming(); return isActive; }