if(world.rand.nextInt(10) == 0) entity = new EntityCaveSpider(world); else entity = new EntitySpider(world); break;
@Override protected void entityInit() { super.entityInit(); dataManager.register(TYPE, new Integer(rand.nextInt(3))); }
@Override public boolean getCanSpawnHere() { float light = getBrightness(); if (light >= 0F) return isNotColliding(); return super.getCanSpawnHere(); }
spider = new EntitySpider(world); spider.setLocationAndAngles(posX, posY, posZ, rotationYaw, 0.0F); spider.onInitialSpawn(world.getDifficultyForLocation(new BlockPos(spider)), null); world.spawnEntity(spider);
@Override public void writeEntityToNBT(NBTTagCompound nbt) { super.writeEntityToNBT(nbt); nbt.setInteger("skin", getSkin()); }
@Override public void readEntityFromNBT(NBTTagCompound nbt) { super.readEntityFromNBT(nbt); if (nbt.hasKey("skin")) setSkin(nbt.getInteger("skin")); else setSkin(rand.nextInt(3)); } }
@Override protected void applyEntityAttributes() { super.applyEntityAttributes(); getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(ConfigHandler.INSTANCE.mobHealthMultipier < 2 ? 25D : 25D * ConfigHandler.INSTANCE.mobHealthMultipier); getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(ConfigHandler.INSTANCE.mobAttackDamageMultiplier < 2 ? 1D : 1D * ConfigHandler.INSTANCE.mobAttackDamageMultiplier); }
@Override public boolean attackEntityAsMob(Entity entity) { if (canEntityBeSeen(entity)) { if (super.attackEntityAsMob(entity)) { if (entity instanceof EntityLivingBase) { byte duration = 0; if (getEntityWorld().getDifficulty().ordinal() > EnumDifficulty.EASY.ordinal()) if (getEntityWorld().getDifficulty() == EnumDifficulty.NORMAL) duration = 3; else if (getEntityWorld().getDifficulty() == EnumDifficulty.HARD) duration = 5; if (duration > 0) ((EntityLivingBase) entity).addPotionEffect(new PotionEffect(MobEffects.POISON, duration * 20, 0)); } } return true; } else return false; }