public static boolean checkBoundingBoxSize(Entity entity, AxisAlignedBB aabb) { if (entity instanceof EntityLivingBase && (!(entity instanceof IBossDisplayData) || !(entity instanceof IEntityMultiPart)) && !(entity instanceof EntityPlayer)) { int logSize = MinecraftServer.cauldronConfig.largeBoundingBoxLogSize.getValue(); if (logSize <= 0 || !MinecraftServer.cauldronConfig.checkEntityBoundingBoxes.getValue()) return false; int x = MathHelper.floor_double(aabb.minX); int x1 = MathHelper.floor_double(aabb.maxX + 1.0D); int y = MathHelper.floor_double(aabb.minY); int y1 = MathHelper.floor_double(aabb.maxY + 1.0D); int z = MathHelper.floor_double(aabb.minZ); int z1 = MathHelper.floor_double(aabb.maxZ + 1.0D); int size = Math.abs(x1 - x) * Math.abs(y1 - y) * Math.abs(z1 - z); if (size > MinecraftServer.cauldronConfig.largeBoundingBoxLogSize.getValue()) { logWarning("Entity being removed for bounding box restrictions"); logWarning("BB Size: {0} > {1} avg edge: {2}", size, logSize, aabb.getAverageEdgeLength()); logWarning("Motion: ({0}, {1}, {2})", entity.motionX, entity.motionY, entity.motionZ); logWarning("Calculated bounding box: {0}", aabb); logWarning("Entity bounding box: {0}", entity.getBoundingBox()); logWarning("Entity: {0}", entity); NBTTagCompound tag = new NBTTagCompound(); entity.writeToNBT(tag); logWarning("Entity NBT: {0}", tag); logStack(); entity.setDead(); return true; } } return false; }
@Override public void doRender(EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9) { BossStatus.setBossStatus((IBossDisplayData) par1EntityLiving, false); super.doRender(par1EntityLiving, par2, par4, par6, par8, par9); }
public static List<String> getAllRegisteredMobNames(boolean excludeBosses) { List<String> result = new ArrayList<String>(); Set<Map.Entry<Class, String>> entries = EntityList.classToStringMapping.entrySet(); for (Map.Entry<Class, String> entry : entries) { if (EntityLiving.class.isAssignableFrom(entry.getKey())) { if (!excludeBosses || !IBossDisplayData.class.isAssignableFrom(entry.getKey())) { result.add(entry.getValue()); } } } return result; }
@SubscribeEvent public void on(EnderTeleportEvent e) { if (!(e.entityLiving instanceof EntityPlayer) && !(e.entityLiving instanceof IBossDisplayData)) { if (TileBlockProtector.isSpotProtected(e.entityLiving.worldObj, e.entityLiving)) { e.setCanceled(true); } } }
@Override public Object getMeta(IBossDisplayData target, Vec3 relativePos) { Map<String, Object> map = Maps.newHashMap(); map.put("name", target.func_145748_c_().getUnformattedText()); map.put("health", target.getHealth()); map.put("maxHealth", target.getMaxHealth()); return map; }
@Override public void applyToMob(EntityPlayer player, IPlayerSession session, Entity target, int boost, int cost) { if (!player.getEntityWorld().isRemote) { if (player.getCurrentEquippedItem().getTagCompound() != null && (target instanceof EntityLivingBase && !(target instanceof EntityPlayer) && !(target instanceof IBossDisplayData)) && session.hasEnoughMana(cost())) { if (!player.getCurrentEquippedItem().getTagCompound().hasKey("EntityData")) { NBTTagCompound tag = new NBTTagCompound(); ((EntityLivingBase) target).writeEntityToNBT(tag); Rings.pktHandler.sendToServer(new PacketStoreEntity(player, true, target.getClass().getName(), tag)); target.setDead(); session.adjustMana(-cost(), false); } } } }
@Override public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer player, EntityLivingBase target) { if (FarragoMod.config.getBoolean("kahur.allowPickingUpMobs") && player.isSneaking()) { if (stack.hasTagCompound() && stack.getTagCompound().hasKey("KahurEntityName")) { return true; } if (!stack.hasTagCompound() || !stack.getTagCompound().getBoolean("KahurCanPickUpMobs")) return true; if (target instanceof EntityPlayer) return true; if (target instanceof IBossDisplayData) return true; if (stack.getMaxDamage()-stack.getItemDamage() < 12) { stack.damageItem(2000, player); } else { NBTTagCompound tag = stack.getTagCompound(); if (tag == null) { tag = new NBTTagCompound(); stack.setTagCompound(tag); } tag.setString("KahurEntityName", EntityList.getEntityString(target)); NBTTagCompound entityTag = new NBTTagCompound(); target.writeToNBT(entityTag); tag.setTag("KahurEntity", entityTag); target.setDead(); player.worldObj.playSoundAtEntity(player, "tile.piston.in", 1.0F, (itemRand.nextFloat() * 0.4F + 1.2F)); stack.damageItem(10, player); } return true; } return false; }
/** * Returns true if the light arrow can kill this entity in one hit (endermen and wither skeletons) */ private boolean canOneHitKill(Entity entity) { if (entity instanceof IEntityEvil) { return ((IEntityEvil) entity).isLightArrowFatal(); } boolean flag = (entity instanceof EntitySkeleton && ((EntitySkeleton) entity).getSkeletonType() == 1); return (!(entity instanceof IBossDisplayData)) && (flag || entity instanceof EntityEnderman); }
@Override public void doRender(EntityLiving entity, double dx, double dy, double dz, float yaw, float partialTick) { if (entity instanceof IBossDisplayData) { BossStatus.setBossStatus((IBossDisplayData) entity, true); } super.doRender(entity, dx, dy, dz, yaw, partialTick); }
@Override public void doRender(EntityWizzrobe entity, double dx, double dy, double dz, float yaw, float partialTick) { if (entity instanceof IBossDisplayData) { BossStatus.setBossStatus((IBossDisplayData) entity, true); } super.doRender(entity, dx, dy, dz, yaw, partialTick); if (model.atPeak) { renderSpell(entity, dx, dy, dz, yaw, partialTick); } }
private static String getEntityTypeNonCache(Entity e) { if (e instanceof EntityGolem) { return "Golem"; } else if (e instanceof IBossDisplayData) { return "Boss"; } else if (e instanceof IAnimals) { return "Animal"; } else if (e instanceof IMob) { return "Monster"; } else if (e instanceof IProjectile) { return "Projectile"; } else if (e instanceof INpc) { return "NPC"; } else if (e instanceof EntityItem) { return "Item"; } else if (e instanceof EntityMob) { return "Monster"; } else if (e instanceof EntityPlayer) { return "Player"; } else if (e instanceof EntityFireball) { return "Projectile"; } else if (e instanceof EntityTNTPrimed) { return "TNT"; } else { return "Unknown"; // e.getClass().getName(); } }
private boolean isBossOrValidMob(Entity entity) { return entity != null ? (entity instanceof IBossDisplayData || mobWhiteList.contains(entity.getClass().getName())) : false; }
public void beginSpell(World world, int x, int y, int z, EntityPlayer player, Entity entity) { if ((!(entity instanceof IBossDisplayData) && !(entity instanceof INotKillCurseable)) || entity instanceof IMurderable) { super.beginSpell(world, x, y, z, player, entity); } }
/** * Returns true if this property's entity is immune to stun effects */ public boolean isImmuneToStun() { // TODO make a public list that other mods can add entities to return ((entity instanceof EntityPlayer && !Config.canPlayersBeStunned()) || entity instanceof IBossDisplayData); }
@SubscribeEvent public void onLivingDrops(LivingDropsEvent event) { if (event.source.getEntity() instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) event.source.getEntity(); EntityLivingBase mob = event.entityLiving; boolean isBoss = mob instanceof IBossDisplayData; boolean flag = ZSSPlayerSkills.get(player).getSkillLevel(SkillBase.mortalDraw) == SkillBase.mortalDraw.getMaxLevel(); ItemStack orb = (isBoss && !flag ? new ItemStack(ZSSItems.skillOrb,1,SkillBase.mortalDraw.getId()) : getOrbDrop(mob, isBoss)); if (orb != null && Config.areOrbDropsEnabled()) { ItemStack helm = (player).getCurrentArmor(ArmorIndex.WORN_HELM); float f = (helm != null && helm.getItem() == ZSSItems.maskTruth ? 0.01F : 0.0F); float baseChance = Config.getDropChance(orb.getItem() == ZSSItems.heartPiece ? SkillBase.bonusHeart.getId() : orb.getItemDamage()); if (baseChance > 0.0F && (isBoss || mob.worldObj.rand.nextFloat() < (baseChance + f + (0.005F * event.lootingLevel)))) { event.drops.add(new EntityItem(mob.worldObj, mob.posX, mob.posY, mob.posZ, orb.copy())); mob.worldObj.playSoundEffect(mob.posX, mob.posY, mob.posZ, Sounds.SPECIAL_DROP, 1.0F, 1.0F); player.triggerAchievement(ZSSAchievements.skillGain); if (isBoss) { player.triggerAchievement(ZSSAchievements.skillMortal); } } } if (mob instanceof EntityCreeper && mob.worldObj.rand.nextFloat() < Config.getCreeperDropChance()) { event.drops.add(new EntityItem(mob.worldObj, mob.posX, mob.posY, mob.posZ, new ItemStack(ZSSItems.bomb))); } if (mob instanceof IMob && mob.worldObj.rand.nextInt(Config.getPowerDropRate()) == 0) { event.drops.add(new EntityItem(mob.worldObj, mob.posX, mob.posY, mob.posZ, new ItemStack(ZSSItems.powerPiece))); } // Check for heart and magic jar drops if (mob instanceof IMob) { // High-HP mobs have a better chance of dropping a Large Magic Jar; // as a base line, Dark Nuts (50 HP) should have a 5-10% drop rate (caps at 25%) float hp = mob.getMaxHealth(); float chance = MathHelper.clamp_float(((hp - 40F) / 100F), 0F, 0.25F); if (hp > 100) { // add 5% per additional 100 HP to a max of 50% for a 500+ HP critter chance = MathHelper.clamp_float(chance + (hp - 100F) / 2000F, 0F, 0.5F); } if (mob.worldObj.rand.nextFloat() < chance) { event.drops.add(new EntityItem(mob.worldObj, mob.posX, mob.posY, mob.posZ, new ItemStack(ZSSItems.magicJarBig))); } int consumable_chance = Config.getMobConsumableFrequency(); if (consumable_chance > 0 && mob.worldObj.rand.nextInt((event.drops.size() + 1) * (12 - consumable_chance)) == 0) { ItemStack stack = new ItemStack(mob.worldObj.rand.nextInt(4) == 0 ? ZSSItems.magicJar : ZSSItems.smallHeart); event.drops.add(new EntityItem(mob.worldObj, mob.posX, mob.posY, mob.posZ, stack)); } } } }
public static void func_82824_a(IBossDisplayData p_82824_0_, boolean p_82824_1_) { field_82828_a = p_82824_0_.func_110143_aJ() / p_82824_0_.func_110138_aP(); field_82826_b = 100; field_82827_c = p_82824_0_.func_70023_ak(); field_82825_d = p_82824_1_; }