entity = new EntityEnderman(world); else if(world.rand.nextInt(10) == 0) { entity = new EntityCreeper(world); if(world.rand.nextInt(200) == 0) entity.onStruckByLightning(null); } else switch(world.rand.nextInt(3)) { case 0: if(world.rand.nextInt(10) == 0) entity = new EntityHusk(world); else entity = new EntityZombie(world); break; case 1: if(world.rand.nextInt(10) == 0) entity = new EntityStray(world); else entity = new EntitySkeleton(world); break; case 2: if(world.rand.nextInt(10) == 0) entity = new EntityCaveSpider(world); else entity = new EntitySpider(world); break; entity.setPositionAndRotation(x, y, z, world.rand.nextFloat() * 360F, 0); entity.motionX = entity.motionY = entity.motionZ = 0; map.put(SharedMonsterAttributes.MAX_HEALTH.getName(), new AttributeModifier("Loonium Modififer Health", 2, 1)); map.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier("Loonium Modififer Damage", 1.5, 1)); entity.getAttributeMap().applyAttributeModifiers(map);
switch (world.rand.nextInt(2)) { case 0: { entity = new EntityZombie(world); if(world.rand.nextInt(hardMode ? 3 : 12) == 0) { entity = new EntityWitch(world); entity = new EntitySkeleton(world); if(world.rand.nextInt(8) == 0) { entity = new EntityWitherSkeleton(world);
@Override public boolean attackEntityFrom(DamageSource source, float amount) { if(source == DamageSource.FALL) return false; return super.attackEntityFrom(source, amount); }
@Override protected void entityInit() { super.entityInit(); isImmuneToFire = true; }
@Override public void writeEntityToNBT(NBTTagCompound compound) { super.writeEntityToNBT(compound); } }
@Override public void readEntityFromNBT(NBTTagCompound compound) { super.readEntityFromNBT(compound); }
@Override public void onUpdate() { super.onUpdate(); if(ticksExisted % 5 == 0) { List<EntitySlime> slimes = supertile.getWorld().getEntitiesWithinAABB(EntitySlime.class, new AxisAlignedBB(supertile.getPos().add(-RANGE, -RANGE, -RANGE), supertile.getPos().add(RANGE + 1, RANGE + 1, RANGE + 1))); for(EntitySlime slime : slimes) { if(slime.getEntityData().getBoolean(TAG_WORLD_SPAWNED) && !slime.isDead) { int size = slime.getSlimeSize(); int mul = (int) Math.pow(2, size); int mana = 1200 * mul; if(!slime.world.isRemote) { slime.setDead(); slime.playSound(size > 1 ? SoundEvents.ENTITY_SLIME_SQUISH : SoundEvents.ENTITY_SMALL_SLIME_SQUISH, 1, 0.02F); this.mana = Math.min(getMaxMana(), this.mana + mana); sync(); } for (int j = 0; j < mul * 8; ++j) { float f = slime.world.rand.nextFloat() * (float)Math.PI * 2.0F; float f1 = slime.world.rand.nextFloat() * 0.5F + 0.5F; float f2 = MathHelper.sin(f) * size * 0.5F * f1; float f3 = MathHelper.cos(f) * size * 0.5F * f1; float f4 = slime.world.rand.nextFloat() * size * 0.5F * f1; slime.world.spawnParticle(EnumParticleTypes.SLIME, slime.posX + f2, slime.getEntityBoundingBox().minY + f4, slime.posZ + f3, 0.0D, 0.0D, 0.0D); } break; } } } }
@Override public boolean attackEntityAsMob(Entity e) { if (e instanceof ReplicatorEntity) { this.hunger -= 0.4; ((ReplicatorEntity) e).hunger += 0.4; } return super.attackEntityAsMob(e); }
break; if(!shulker.isDead && shulker.getDistanceSq(pos) < RADIUS * RADIUS) { EntityLivingBase target = shulker.getAttackTarget(); if(target != null && target instanceof IMob && !target.isDead && target.getDistanceSq(pos) < RADIUS * RADIUS && target.getActivePotionEffect(MobEffects.LEVITATION) != null) { target.setDead(); shulker.setDead();
@Override public void onBlockAdded(World world, BlockPos pos, IBlockState state) { super.onBlockAdded(world, pos, state); if(!world.isRemote && world.getBlockState(pos.down()).getBlock() == Blocks.IRON_BARS && world.getBlockState(pos.down(2)).getBlock() == Blocks.IRON_BARS) { world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2); world.setBlockState(pos.down(), Blocks.AIR.getDefaultState(), 2); world.setBlockState(pos.down(2), Blocks.AIR.getDefaultState(), 2); EntityBlaze blaze = new EntityBlaze(world); blaze.setLocationAndAngles(pos.getX() + 0.5D, pos.getY() - 1.95D, pos.getZ() + 0.5D, 0.0F, 0.0F); blaze.deathLootTable = LOOT_TABLE; blaze.onInitialSpawn(world.getDifficultyForLocation(pos), null); world.spawnEntity(blaze); world.notifyNeighborsOfStateChange(pos, Blocks.AIR, false); world.notifyNeighborsOfStateChange(pos.down(), Blocks.AIR, false); world.notifyNeighborsOfStateChange(pos.down(2), Blocks.AIR, false); } }
@Override protected float getSoundPitch() { return super.getSoundPitch() * 3.95F; }
@Override public boolean getCanSpawnHere() { return super.getCanSpawnHere() && posY < DepthMobs.upperBound; }
entity = new EntityShulker(world); } else if(Math.random() < villagerChance) { EntityVillager villager = new EntityVillager(world);
private static String GetOverlayMessageForWitherSkeleton(EntitySkeleton witherSkeleton, float distanceFromMe) { String overlayMessage = "Wither " + witherSkeleton.getCommandSenderName(); //add distance to this wither skeleton into the message if (ShowDistanceToPlayers) { overlayMessage = EnumChatFormatting.GRAY + "[" + (int)distanceFromMe + "] " + EnumChatFormatting.RESET + overlayMessage; } return overlayMessage; }
@Override protected int getAttackStrength() { return super.getAttackStrength() + 2; }
@Override public boolean getCanSpawnHere() { return super.getCanSpawnHere() && posY < DepthMobs.upperBound; }
@Override protected int getJumpDelay() { return super.getJumpDelay() * 4; }
@Override public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer player, EntityLivingBase entity, EnumHand hand) { if(entity instanceof EntityLiving) { EntityLiving living = (EntityLiving) entity; SoundEvent sound = null; if(living instanceof EntityCreeper) sound = SoundEvents.ENTITY_CREEPER_PRIMED; else if(living instanceof EntitySlime) sound = ((EntitySlime) living).isSmallSlime() ? SoundEvents.ENTITY_SMALL_SLIME_SQUISH : SoundEvents.ENTITY_SLIME_SQUISH; else { try { sound = (SoundEvent) ReflectionHelper.findMethod(EntityLiving.class, LibObfuscation.GET_LIVING_SOUND[0], LibObfuscation.GET_LIVING_SOUND[1]).invoke(living); } catch (InvocationTargetException | IllegalAccessException ignored) { Botania.LOGGER.debug("Couldn't get living sound"); } } if(sound != null) { String s = EntityList.getEntityString(entity); if(s == null) s = "generic"; ItemNBTHelper.setString(stack, TAG_SOUND, sound.getRegistryName().toString()); ItemNBTHelper.setString(stack, TAG_SOUND_NAME, "entity." + s + ".name"); player.setHeldItem(hand, stack); if(player.world.isRemote) player.swingArm(hand); return true; } } return false; }
@Override public boolean attackEntityAsMob(Entity entity) { return super.attackEntityAsMob(entity); // I know this does nothing! - But it may soon! }
@Override protected float getSoundPitch() { return super.getSoundPitch() * 0.75F; }