entity = new EntityEnderman(world); else if(world.rand.nextInt(10) == 0) { entity = new EntityCreeper(world); if(world.rand.nextInt(200) == 0) entity.onStruckByLightning(null);
@Override protected void applyEntityAttributes() { super.applyEntityAttributes(); applyAttributes(this, ZooConfig.creeperHealth, NO_ATTACK); }
@SubtargetedModuleObjectMethod.Inject( module = PlethoraModules.KINETIC_S, target = EntityCreeper.class, doc = "function() -- Explode this creeper" ) public static Object[] explode(@Nonnull EntityCreeper target, @Nonnull IContext<IModuleContainer> context, @Nonnull Object[] args) { target.explode(); return null; }
@Override protected ResourceLocation getEntityTexture(EntityCreeper entity) { if(entity.getCreeperState() == 1) { float antired = 1F - (entity.getCreeperFlashIntensity(0F) / 1.17F + 0.1F); GL11.glColor3f(1F, antired, antired); } return super.getEntityTexture(entity); }
creeper = new EntityCreeper(world); creeper.setLocationAndAngles(posX, posY, posZ, rotationYaw, 0.0F); creeper.onInitialSpawn(world.getDifficultyForLocation(new BlockPos(creeper)), null); world.spawnEntity(creeper);
if(!creeper.getPowered()) creeper.setFire(1); creeper.onStruckByLightning(lightning);
@Override public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) { if (entity instanceof EntityCreeper) { ((EntityCreeper) entity).ignite(); useItemDurability(player, EnumHand.MAIN_HAND, stack, ItemStack.EMPTY); return true; } return false; }
@Override public void onUpdate() { if (isEntityAlive()) { int timeSinceIgnited = getTimeSinceIgnited(); int fuseTime = getFuseTime(); if (timeSinceIgnited >= fuseTime - 1) { setTimeSinceIgnited(0); 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(); int range = ZooConfig.explosionRange.get(); 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.isDead) { if (!world.isRemote) { RandomTeleportUtil.teleportEntity(ent.world, ent, false, true, ZooConfig.teleportRange.get()); } if (ent instanceof EntityPlayer) { EnderIOZoo.proxy.setInstantConfusionOnPlayer((EntityPlayer) ent, ZooConfig.confusionDuration.get()); } } } } } super.onUpdate(); }