net.minecraft.util.EnumParticleTypes Java Examples
The following examples show how to use
net.minecraft.util.EnumParticleTypes.
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: BlockEnderFurnace.java From enderutilities with GNU Lesser General Public License v3.0 | 6 votes |
@Override public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) { TileEntityEnderFurnace te = getTileEntitySafely(world, pos, TileEntityEnderFurnace.class); if (te != null && te.isBurningLast) { Effects.spawnParticlesAround(world, EnumParticleTypes.PORTAL, pos, 2, rand); if (rand.nextDouble() < 0.1D) { world.playSound((double)pos.getX() + 0.5D, (double)pos.getY(), (double)pos.getZ() + 0.5D, SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 1.0F, false); } } }
Example #2
Source File: EntityDireSlime.java From EnderZoo with Creative Commons Zero v1.0 Universal | 6 votes |
@Override protected boolean spawnCustomParticles() { int i = this.getSlimeSize(); for (int j = 0; j < i * 8; ++j) { float f = this.rand.nextFloat() * ((float) Math.PI * 2F); float f1 = this.rand.nextFloat() * 0.5F + 0.5F; float f2 = MathHelper.sin(f) * (float) i * 0.5F * f1; float f3 = MathHelper.cos(f) * (float) i * 0.5F * f1; World world = this.world; EnumParticleTypes enumparticletypes = this.getParticleType(); double d0 = this.posX + (double) f2; double d1 = this.posZ + (double) f3; world.spawnParticle(enumparticletypes, d0, this.getEntityBoundingBox().minY, d1, 0.0D, 0.0D, 0.0D, Block.getStateId(Blocks.DIRT.getDefaultState())); } return true; }
Example #3
Source File: MCNetworkStation.java From Signals with GNU General Public License v3.0 | 6 votes |
public boolean isCartApplicable(World world, EntityMinecart cart, Pattern destinationRegex){ for(EnumFacing dir : EnumFacing.VALUES) { BlockPos neighborPos = getPos().getPos().offset(dir); if(world.isBlockLoaded(neighborPos)) { TileEntity te = world.getTileEntity(neighborPos); if(te != null) { CapabilityDestinationProvider cap = te.getCapability(CapabilityDestinationProvider.INSTANCE, null); if(cap != null && cap.isCartApplicable(te, cart, destinationRegex)) { for(int i = 0; i < 10; i++) { double x = getPos().getPos().getX() + world.rand.nextDouble(); double z = getPos().getPos().getZ() + world.rand.nextDouble(); NetworkHandler.sendToAllAround(new PacketSpawnParticle(EnumParticleTypes.ENCHANTMENT_TABLE, x, getPos().getPos().getY() + 1, z, dir.getFrontOffsetX(), dir.getFrontOffsetY(), dir.getFrontOffsetZ()), world); } return true; } } } } return false; }
Example #4
Source File: Effects.java From enderutilities with GNU Lesser General Public License v3.0 | 6 votes |
public static void spawnParticlesAround(World world, EnumParticleTypes type, BlockPos pos, int count, Random rand) { for (int i = 0; i < count; ++i) { int i1 = rand.nextInt(2) * 2 - 1; int j1 = rand.nextInt(2) * 2 - 1; double x1 = (double)pos.getX() + 0.5D + 0.25D * (double)i1; double y1 = (double)((float)pos.getY() + rand.nextFloat()); double z1 = (double)pos.getZ() + 0.5D + 0.25D * (double)j1; double vx = (double)(rand.nextFloat() * 1.0F * (float)i1); double vy = ((double)rand.nextFloat() - 0.5D) * 0.125D; double vz = (double)(rand.nextFloat() * 1.0F * (float)j1); world.spawnParticle(type, x1, y1, z1, vx, vy, vz); } }
Example #5
Source File: EntityTippedChingerArrow.java From TofuCraftReload with MIT License | 6 votes |
/** * Handler for {@link World#setEntityState} */ @SideOnly(Side.CLIENT) public void handleStatusUpdate(byte id) { if (id == 0) { int i = this.getColor(); if (i != -1) { double d0 = (double) (i >> 16 & 255) / 255.0D; double d1 = (double) (i >> 8 & 255) / 255.0D; double d2 = (double) (i >> 0 & 255) / 255.0D; for (int j = 0; j < 20; ++j) { this.world.spawnParticle(EnumParticleTypes.SPELL_MOB, this.posX + (this.rand.nextDouble() - 0.5D) * (double) this.width, this.posY + this.rand.nextDouble() * (double) this.height, this.posZ + (this.rand.nextDouble() - 0.5D) * (double) this.width, d0, d1, d2); } } } else { super.handleStatusUpdate(id); } }
Example #6
Source File: ProjectileStone.java From ExNihiloAdscensio with MIT License | 6 votes |
@Override protected void onImpact(RayTraceResult result) { if (result.entityHit != null) { result.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, getThrower()), (int) (Math.random() * (4.0F / 3.0F))); } else if (!world.isRemote) { setDead(); if(stack != null) { world.spawnEntity(new EntityItem(world, posX, posY, posZ, stack)); } } for (int j = 0; j < 8; ++j) { world.spawnParticle(EnumParticleTypes.BLOCK_CRACK, posX, posY, posZ, 0.0D, 0.0D, 0.0D, new int[] { Block.getStateId(Blocks.STONE.getDefaultState()) }); } }
Example #7
Source File: EntityFukumame.java From TofuCraftReload with MIT License | 6 votes |
/** * Called when this EntityThrowable hits a block or entity. */ @Override protected void onImpact(RayTraceResult par1MovingObjectPosition) { Entity entityHit = par1MovingObjectPosition.entityHit; if (entityHit == this.ignoreEntity && this.age < 5) { return; } if (par1MovingObjectPosition.entityHit != null) { double d = this.getDamage(); d *= this.isCrit ? 2.5D : 1.0D; entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), (float) d); if (entityHit instanceof EntityLivingBase) { EntityLivingBase entityLivivng = (EntityLivingBase) entityHit; entityLivivng.hurtResistantTime = entityLivivng.maxHurtResistantTime / 2; } for (int i = 0; i < 3; ++i) { this.world.spawnParticle(EnumParticleTypes.SNOWBALL, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D); } } if (!this.world.isRemote) { this.setDead(); } }
Example #8
Source File: PythonCode.java From pycode-minecraft with MIT License | 6 votes |
private void ensureCompiled() { if (!this.codeChanged) return; FMLLog.fine("Eval my code: %s", this.code); // now execute the code try { PythonEngine.eval(this.code, this.context); if (!world.isRemote) { ((WorldServer)world).spawnParticle(EnumParticleTypes.CRIT, pos.getX() + .5, pos.getY() + 1, pos.getZ() + .5, 20, 0, 0, 0, .5, new int[0]); } } catch (ScriptException e) { failz0r(world, pos, "Error running code, traceback:\n%s", stackTraceToString(e)); } this.codeChanged = false; }
Example #9
Source File: EntityChristmasCow.java From Moo-Fluids with GNU General Public License v3.0 | 6 votes |
@Override public void onLivingUpdate() { super.onLivingUpdate(); for (int side = 0; side < 4; ++side) { int x = MathHelper.floor(posX + (double) ((float) (side % 2 * 2 - 1) * 0.25F)); int y = MathHelper.floor(posY); int z = MathHelper.floor(posZ + (double) ((float) (side / 2 % 2 * 2 - 1) * 0.25F)); BlockPos pos = new BlockPos(x, y, z); if (world.getBlockState(pos).getBlock() == Blocks.AIR && world.getBiome(pos).getTemperature(pos) < 2F && Blocks.SNOW_LAYER.canPlaceBlockAt(world, pos)) { double randX = (double) ((float) posX + rand.nextFloat()); double randY = (double) ((float) posY + rand.nextFloat()); double randZ = (double) ((float) posZ + rand.nextFloat()); world.spawnParticle(EnumParticleTypes.SNOWBALL, randX, randY, randZ, 0.0D, 0.0D, 0.0D); world.setBlockState(pos, Blocks.SNOW_LAYER.getDefaultState()); } } }
Example #10
Source File: EntityOwlEgg.java From EnderZoo with Creative Commons Zero v1.0 Universal | 6 votes |
@Override protected void onImpact(RayTraceResult impact) { if (impact.entityHit != null) { impact.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, getThrower()), 0.0F); } if (!world.isRemote && rand.nextInt(8) == 0) { EntityOwl entitychicken = new EntityOwl(world); entitychicken.setGrowingAge(-24000); entitychicken.setLocationAndAngles(posX, posY, posZ, rotationYaw, 0.0F); world.spawnEntity(entitychicken); } for (int i = 0; i < 8; ++i) { world.spawnParticle(EnumParticleTypes.ITEM_CRACK, posX, posY, posZ, (rand.nextFloat() - 0.5D) * 0.08D, (rand.nextFloat() - 0.5D) * 0.08D, (rand.nextFloat() - 0.5D) * 0.08D, new int[] { Item.getIdFromItem(EnderZoo.itemOwlEgg) }); } if (!world.isRemote) { setDead(); } }
Example #11
Source File: BlockBarrel.java From TofuCraftReload with MIT License | 6 votes |
@SideOnly(Side.CLIENT) @Override public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) { if (isUnderWeight(worldIn, pos)) { if (canFerm(stateIn)) { if (rand.nextInt(5) == 0) { double d4 = rand.nextBoolean() ? 0.8 : -0.8; double d0 = ((float) pos.getX() + 0.5 + (rand.nextFloat() * d4)); double d1 = (double) ((float) pos.getY() + rand.nextFloat()); double d2 = ((float) pos.getZ() + 0.5 + rand.nextFloat() * d4); worldIn.spawnParticle(EnumParticleTypes.DRIP_WATER, d0, d1, d2, 0.0D, 0.0D, 0.0D); } } } }
Example #12
Source File: BlockNattoBed.java From TofuCraftReload with MIT License | 6 votes |
@SideOnly(Side.CLIENT) @Override public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) { if (isUnderWeight(worldIn, pos)) { if (canFerm(stateIn)) { if (rand.nextInt(5) == 0) { double d4 = rand.nextBoolean() ? 0.8 : -0.8; double d0 = ((float) pos.getX() + 0.5 + (rand.nextFloat() * d4)); double d1 = (double) ((float) pos.getY() + rand.nextFloat()); double d2 = ((float) pos.getZ() + 0.5 + rand.nextFloat() * d4); worldIn.spawnParticle(EnumParticleTypes.DRIP_WATER, d0, d1, d2, 0.0D, 0.0D, 0.0D); } } } }
Example #13
Source File: GTTileCharcoalPit.java From GT-Classic with GNU Lesser General Public License v3.0 | 6 votes |
@SideOnly(Side.CLIENT) @Override public void randomTickDisplay(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) { if (this.isActive) { if (rand.nextInt(16) == 0) { worldIn.playSound((double) ((float) pos.getX() + 0.5F), (double) ((float) pos.getY() + 0.5F), (double) ((float) pos.getZ() + 0.5F), SoundEvents.BLOCK_FIRE_AMBIENT, SoundCategory.BLOCKS, 1.0F + rand.nextFloat(), rand.nextFloat() * 0.7F + 0.3F, false); } for (int i = 0; i < 3; ++i) { double d0 = (double) pos.getX() + rand.nextDouble(); double d1 = (double) pos.getY() + rand.nextDouble() * 0.5D + 0.5D; double d2 = (double) pos.getZ() + rand.nextDouble(); worldIn.spawnParticle(EnumParticleTypes.SMOKE_LARGE, d0, d1, d2, 0.0D, 0.0D, 0.0D); } } }
Example #14
Source File: BlockLeaves.java From TFC2 with GNU General Public License v3.0 | 5 votes |
@Override @SideOnly(Side.CLIENT) public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) { if ((worldIn.isRainingAt(pos.up())) && (!worldIn.getBlockState(pos.down()).isFullyOpaque()) && (rand.nextInt(15) == 1)) { double d0 = pos.getX() + rand.nextFloat(); double d1 = pos.getY() - 0.05D; double d2 = pos.getZ() + rand.nextFloat(); worldIn.spawnParticle(EnumParticleTypes.DRIP_WATER, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]); } }
Example #15
Source File: EntityMage.java From ToroQuest with GNU General Public License v3.0 | 5 votes |
private void spawnParticles(double xSpeed, double ySpeed, double zSpeed) { // TODO figure out how to spawn particles if (this.world.isRemote) { for (int i = 0; i < 32; ++i) { world.spawnParticle(EnumParticleTypes.PORTAL, posX, posY, posZ, xSpeed, ySpeed, zSpeed, new int[0]); } } else { this.world.setEntityState(this, (byte) 42); } }
Example #16
Source File: EntitySphere.java From YouTubeModdingTutorial with MIT License | 5 votes |
@Override public void onUpdate() { if (this.world.isRemote || this.world.isBlockLoaded(new BlockPos(this))) { super.onUpdate(); ++this.ticksInAir; RayTraceResult raytraceresult = ProjectileHelper.forwardsRaycast(this, true, this.ticksInAir >= 25, this.shootingEntity); if (raytraceresult != null && !net.minecraftforge.event.ForgeEventFactory.onProjectileImpact(this, raytraceresult)) { this.onImpact(raytraceresult); } this.posX += this.motionX; this.posY += this.motionY; this.posZ += this.motionZ; ProjectileHelper.rotateTowardsMovement(this, 0.2F); float f = this.getMotionFactor(); if (this.isInWater()) { for (int i = 0; i < 4; ++i) { this.world.spawnParticle(EnumParticleTypes.WATER_BUBBLE, this.posX - this.motionX * 0.25D, this.posY - this.motionY * 0.25D, this.posZ - this.motionZ * 0.25D, this.motionX, this.motionY, this.motionZ); } f = 0.8F; } this.motionX += this.accelerationX; this.motionY += this.accelerationY; this.motionZ += this.accelerationZ; this.motionX *= f; this.motionY *= f; this.motionZ *= f; this.setPosition(this.posX, this.posY, this.posZ); } else { this.setDead(); } }
Example #17
Source File: GTTileBedrockMiner.java From GT-Classic with GNU Lesser General Public License v3.0 | 5 votes |
@Override @SideOnly(Side.CLIENT) public void randomTickDisplay(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) { if (this.isActive) { for (int i = 0; i < 3; ++i) { double d0 = (double) pos.getX() + rand.nextDouble(); double d1 = (double) pos.getY() + .5D + rand.nextDouble() * 0.5D + 0.5D; double d2 = (double) pos.getZ() + rand.nextDouble(); worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0, d1, d2, 0.0D, 0.0D, 0.0D); } } }
Example #18
Source File: TaskPositionDebug.java From enderutilities with GNU Lesser General Public License v3.0 | 5 votes |
public TaskPositionDebug(World world, List<BlockPos> positions, IBlockState blockState, int blocksPerTick, boolean placeBlocks, boolean useParticles, EnumParticleTypes particle) { this.dimension = world.provider.getDimension(); this.positions = positions; this.blockState = blockState; this.blocksPerTick = blocksPerTick; this.placeBlocks = placeBlocks; this.useParticles = useParticles; this.particle = particle; this.listIndex = 0; this.count = 0; }
Example #19
Source File: TileEntityQuickStackerAdvanced.java From enderutilities with GNU Lesser General Public License v3.0 | 5 votes |
public static void quickStackToInventories(World world, EntityPlayer player, long enabledSlotsMask, List<BlockPosDistance> positions, FilterSettings filter) { IItemHandler playerInv = player.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null); boolean movedSome = false; for (BlockPosDistance posDist : positions) { TileEntity te = world.getTileEntity(posDist.pos); if (te != null && te.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.UP)) { IItemHandler inv = te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.UP); if (inv != null) { Result result = quickStackItems(playerInv, inv, enabledSlotsMask, player.isSneaking() == false, filter); if (result != Result.MOVED_NONE) { Effects.spawnParticlesFromServer(world.provider.getDimension(), posDist.pos, EnumParticleTypes.VILLAGER_HAPPY); movedSome = true; } if (result == Result.MOVED_ALL) { break; } } } } if (movedSome) { world.playSound(null, player.getPosition(), SoundEvents.ENTITY_ENDERMEN_TELEPORT, SoundCategory.MASTER, 0.5f, 1.8f); } }
Example #20
Source File: EntityMonolithEye.java From ToroQuest with GNU General Public License v3.0 | 5 votes |
private void spawnParticles(double xSpeed, double ySpeed, double zSpeed) { if (this.world.isRemote) { for (int i = 0; i < 32; ++i) { world.spawnParticle(EnumParticleTypes.PORTAL, posX, posY, posZ, xSpeed, ySpeed, zSpeed, new int[0]); } } else { this.world.setEntityState(this, (byte) 42); } }
Example #21
Source File: EntityMage.java From ToroQuest with GNU General Public License v3.0 | 5 votes |
@SideOnly(Side.CLIENT) protected void spawnWitchParticles() { for (int i = 0; i < this.rand.nextInt(35) + 10; ++i) { this.world.spawnParticle(EnumParticleTypes.SPELL_WITCH, this.posX + this.rand.nextGaussian() * 0.12999999523162842D, this.getEntityBoundingBox().maxY + 0.5D + this.rand.nextGaussian() * 0.12999999523162842D, this.posZ + this.rand.nextGaussian() * 0.12999999523162842D, 0.0D, 0.0D, 0.0D, new int[0]); } }
Example #22
Source File: EntityTofuGandlem.java From TofuCraftReload with MIT License | 5 votes |
@Override public void updateTask() { super.updateTask(); --this.shottick; if (this.shottick == 60 || this.shottick == 80) { EntityTofuGandlem.this.playSound(SoundEvents.BLOCK_IRON_TRAPDOOR_OPEN, 2.0F, 1.4F); ((WorldServer) EntityTofuGandlem.this.world).spawnParticle(EnumParticleTypes.CRIT, EntityTofuGandlem.this.posX, EntityTofuGandlem.this.posY, EntityTofuGandlem.this.posZ, 15, 0.2D, 0.2D, 0.2D, 0.0D); } if (this.shottick <= 20) { if (EntityTofuGandlem.this.ticksExisted % 5 == 0) { for (int i = 0; i < 6; i++) { EntityThrowable projectile = new EntityFukumame(EntityTofuGandlem.this.world, EntityTofuGandlem.this); Vec3d vec3d = EntityTofuGandlem.this.getLook(1.0F); playSound(SoundEvents.ENTITY_SNOWBALL_THROW, 3.0F, 1.0F / (EntityTofuGandlem.this.getRNG().nextFloat() * 0.4F + 0.8F)); projectile.setLocationAndAngles(EntityTofuGandlem.this.posX + vec3d.x * 1.3D, EntityTofuGandlem.this.posY + (EntityTofuGandlem.this.getEyeHeight() / 2), EntityTofuGandlem.this.posZ + vec3d.z * 1.2D, EntityTofuGandlem.this.rotationYaw, EntityTofuGandlem.this.rotationPitch); float d0 = (EntityTofuGandlem.this.rand.nextFloat() * 12.0F) - 6.0F; projectile.shoot(EntityTofuGandlem.this, EntityTofuGandlem.this.rotationPitch, EntityTofuGandlem.this.rotationYaw + d0, 0.0F, 1.5f, 0.8F); EntityTofuGandlem.this.world.spawnEntity(projectile); } } } }
Example #23
Source File: EntityEndermanFighter.java From enderutilities with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void updateTask() { if (++this.timer >= this.delay) { Random rand = this.fighter.getRNG(); if (rand.nextFloat() < 0.03f) { for (int i = 0; i < 16; ++i) { float vx = (rand.nextFloat() - 0.5f) * 0.2f; float vy = (rand.nextFloat() - 0.5f) * 0.2f; float vz = (rand.nextFloat() - 0.5f) * 0.2f; double x = this.fighter.posX + (rand.nextDouble() - 0.5d) * (double)this.fighter.width * 2.0d; double y = this.fighter.posY + rand.nextDouble() * (double)this.fighter.height; double z = this.fighter.posZ + (rand.nextDouble() - 0.5d) * (double)this.fighter.width * 2.0d; this.fighter.getEntityWorld().spawnParticle(EnumParticleTypes.PORTAL, x, y, z, vx, vy, vz); } this.fighter.getEntityWorld().playSound(null, this.fighter.posX, this.fighter.posY, this.fighter.posZ, SoundEvents.ENTITY_ENDERMEN_TELEPORT, this.fighter.getSoundCategory(), 0.7f, 1.0f); this.fighter.setDead(); } } }
Example #24
Source File: DodgePacket.java From Cyberware with MIT License | 5 votes |
@Override public Void call() throws Exception { Entity targetEntity = Minecraft.getMinecraft().theWorld.getEntityByID(entityId); if (targetEntity != null) { for (int i = 0; i < 25; i++) { Random rand = targetEntity.worldObj.rand; targetEntity.worldObj.spawnParticle(EnumParticleTypes.SPELL, targetEntity.posX, targetEntity.posY + rand.nextFloat() * targetEntity.height, targetEntity.posZ, (rand.nextFloat() - .5F) * .2F, 0, (rand.nextFloat() - .5F) * .2F, new int[] {255, 255, 255}); } targetEntity.playSound(SoundEvents.ENTITY_FIREWORK_SHOOT, 1F, 1F); if (targetEntity == Minecraft.getMinecraft().thePlayer) { HudHandler.addNotification(new NotificationInstance(targetEntity.ticksExisted, new DodgeNotification())); } } return null; }
Example #25
Source File: ParticlePacket.java From Cyberware with MIT License | 5 votes |
@Override public Void call() throws Exception { World world = Minecraft.getMinecraft().theWorld; if (world != null) { switch (effectId) { case 0: for (int i = 0; i < 5; i++) { world.spawnParticle(EnumParticleTypes.HEART, x + 1F * (world.rand.nextFloat() - .5F), y + 1F * (world.rand.nextFloat() - .5F), z + 1F * (world.rand.nextFloat() - .5F), 2F * (world.rand.nextFloat() - .5F), .5F, 2F * (world.rand.nextFloat() - .5F), new int[0]); } break; case 1: for (int i = 0; i < 5; i++) { world.spawnParticle(EnumParticleTypes.VILLAGER_ANGRY, x + 1F * (world.rand.nextFloat() - .5F), y + 1F * (world.rand.nextFloat() - .5F), z + 1F * (world.rand.nextFloat() - .5F), 2F * (world.rand.nextFloat() - .5F), .5F, 2F * (world.rand.nextFloat() - .5F), new int[0]); } break; } } return null; }
Example #26
Source File: TileEntityEngineeringTable.java From Cyberware with MIT License | 5 votes |
public void smashSounds() { int x = pos.getX(); int y = pos.getY(); int z = pos.getZ(); clickedTime = Minecraft.getMinecraft().thePlayer.ticksExisted + Minecraft.getMinecraft().getRenderPartialTicks(); worldObj.playSound(x, y, z, SoundEvents.BLOCK_PISTON_EXTEND, SoundCategory.BLOCKS, 1F, 1F, false); worldObj.playSound(x, y, z, SoundEvents.ENTITY_ITEM_BREAK, SoundCategory.BLOCKS, 1F, .5F, false); for (int i = 0; i < 10; i++) { worldObj.spawnParticle(EnumParticleTypes.ITEM_CRACK, x + .5F, y, z + .5F, .25F * (worldObj.rand.nextFloat() - .5F), .1F, .25F * (worldObj.rand.nextFloat() - .5F), new int[] { Item.getIdFromItem(slots.getStackInSlot(0).getItem()) } ); } }
Example #27
Source File: CapabilityMinecartDestination.java From Signals with GNU General Public License v3.0 | 5 votes |
/** * Tries to use fuel and returns true if succeeded. * @return */ public boolean useFuel(EntityMinecart cart){ if(motorized) { if(fuelLeft == 0) { for(int i = 0; i < fuelInv.getSizeInventory(); i++) { ItemStack fuel = fuelInv.getStackInSlot(i); if(!fuel.isEmpty()) { int fuelValue = TileEntityFurnace.getItemBurnTime(fuel); if(fuelValue > 0) { fuel.shrink(1); if(fuel.isEmpty()) { fuelInv.setInventorySlotContents(i, fuel.getItem().getContainerItem(fuel)); } fuelLeft += fuelValue; totalBurnTime = fuelValue; break; } } } } if(fuelLeft > 0) { fuelLeft--; double randX = cart.getPositionVector().x + (cart.world.rand.nextDouble() - 0.5) * 0.5; double randY = cart.getPositionVector().y + (cart.world.rand.nextDouble() - 0.5) * 0.5; double randZ = cart.getPositionVector().z + (cart.world.rand.nextDouble() - 0.5) * 0.5; NetworkHandler.sendToAllAround(new PacketSpawnParticle(EnumParticleTypes.SMOKE_LARGE, randX, randY, randZ, 0, 0, 0), cart.world); return true; } } return false; }
Example #28
Source File: EntityConcussionCreeper.java From EnderZoo with Creative Commons Zero v1.0 Universal | 5 votes |
@Override public void onUpdate() { if (isEntityAlive()) { int timeSinceIgnited = getTimeSinceIgnited(); int fuseTime = getFuseTime(); if (timeSinceIgnited >= fuseTime - 1) { setTimeSinceIgnited(0); int range = Config.concussionCreeperExplosionRange; AxisAlignedBB bb = new AxisAlignedBB(posX - range, posY - range, posZ - range, posX + range, posY + range, posZ + range); List<EntityLivingBase> ents = world.getEntitiesWithinAABB(EntityLivingBase.class, bb); for (EntityLivingBase ent : ents) { if (ent != this) { if (!world.isRemote) { boolean done = false; for (int i = 0; i < 20 && !done; i++) { done = TeleportHelper.teleportRandomly(ent, Config.concussionCreeperMaxTeleportRange); } } if (ent instanceof EntityPlayer) { world.playSound(ent.posX, ent.posY, ent.posZ, SoundEvents.ENTITY_ENDERMEN_TELEPORT, SoundCategory.HOSTILE, 1.0F, 1.0F, false); EnderZoo.proxy.setInstantConfusionOnPlayer((EntityPlayer) ent, Config.concussionCreeperConfusionDuration); } } } world.playSound(posX, posY, posZ, SoundEvents.ENTITY_GENERIC_EXPLODE, SoundCategory.HOSTILE, 4.0F, (1.0F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.2F) * 0.7F, false); world.spawnParticle(EnumParticleTypes.EXPLOSION_HUGE, posX, posY, posZ, 1.0D, 0.0D, 0.0D); setDead(); } } super.onUpdate(); }
Example #29
Source File: BlockTeleportRail.java From Signals with GNU General Public License v3.0 | 5 votes |
private void spawnParticle(EntityMinecart cart){ Random rand = cart.world.rand; float maxSpeed = 1; float f = (rand.nextFloat() - 0.5F) * maxSpeed; float f1 = (rand.nextFloat() - 0.5F) * maxSpeed; float f2 = (rand.nextFloat() - 0.5F) * maxSpeed; NetworkHandler.sendToAllAround(new PacketSpawnParticle(EnumParticleTypes.PORTAL, cart.posX, cart.posY, cart.posZ, f, f1, f2), cart.world); }
Example #30
Source File: EntityPrimedCharge.java From EnderZoo with Creative Commons Zero v1.0 Universal | 5 votes |
@Override public void onUpdate() { if(world.isRemote && isDead) { // System.out.println("EntityPrimedCharge.onUpdate: Dead"); } prevPosX = posX; prevPosY = posY; prevPosZ = posZ; motionY -= 0.03999999910593033D; addVelocity(motionX, motionY, motionZ); motionX *= 0.9800000190734863D; motionY *= 0.9800000190734863D; motionZ *= 0.9800000190734863D; if(onGround) { motionX *= 0.699999988079071D; motionZ *= 0.699999988079071D; motionY *= -0.5D; } if(fuse-- <= 0) { setDead(); if(!world.isRemote) { if(charge != null) { charge.explode(this); } } } else { world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, posX, posY + 0.5D, posZ, 0.0D, 0.0D, 0.0D); } }