Fixed Pixie spawns (I think)

This commit is contained in:
Matt Caughey 2013-11-17 04:17:29 -05:00
parent 6659421f32
commit d749355ed5
3 changed files with 43 additions and 4 deletions

View file

@ -109,7 +109,7 @@ public class BOPEntities {
if (Biomes.promisedLandForest.isPresent() && Biomes.promisedLandSwamp.isPresent() && Biomes.promisedLandPlains.isPresent() && Biomes.promisedLandShrub.isPresent())
{
EntityRegistry.addSpawn(EntityBird.class, 10, 3, 5, EnumCreatureType.creature, Biomes.promisedLandForest.get(), Biomes.promisedLandSwamp.get(), Biomes.promisedLandPlains.get(), Biomes.promisedLandShrub.get());
EntityRegistry.addSpawn(EntityBird.class, 10, 3, 5, EnumCreatureType.ambient, Biomes.promisedLandForest.get(), Biomes.promisedLandSwamp.get(), Biomes.promisedLandPlains.get(), Biomes.promisedLandShrub.get());
}
}
@ -121,7 +121,7 @@ public class BOPEntities {
if (Biomes.promisedLandForest.isPresent() && Biomes.promisedLandSwamp.isPresent() && Biomes.promisedLandPlains.isPresent() && Biomes.promisedLandShrub.isPresent())
{
EntityRegistry.addSpawn(EntityPixie.class, 5, 1, 3, EnumCreatureType.monster, Biomes.promisedLandForest.get(), Biomes.promisedLandSwamp.get(), Biomes.promisedLandPlains.get(), Biomes.promisedLandShrub.get());
EntityRegistry.addSpawn(EntityPixie.class, 8, 1, 3, EnumCreatureType.monster, Biomes.promisedLandForest.get(), Biomes.promisedLandSwamp.get(), Biomes.promisedLandPlains.get(), Biomes.promisedLandShrub.get());
}
}
}

View file

@ -1,11 +1,11 @@
package biomesoplenty.entities;
import net.minecraft.block.Block;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.passive.EntityAmbientCreature;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
public class EntityFlyingCreature extends EntityLiving
public class EntityFlyingCreature extends EntityAmbientCreature
{
public EntityFlyingCreature(World par1World)
{

View file

@ -7,6 +7,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MathHelper;
import net.minecraft.world.EnumSkyBlock;
import net.minecraft.world.World;
public class EntityPixie extends EntityFlyingCreature
@ -104,6 +105,44 @@ public class EntityPixie extends EntityFlyingCreature
}
}
/**
* Checks to make sure the light is not too bright where the mob is spawning
*/
protected boolean isValidLightLevel()
{
int i = MathHelper.floor_double(this.posX);
int j = MathHelper.floor_double(this.boundingBox.minY);
int k = MathHelper.floor_double(this.posZ);
if (this.worldObj.getSavedLightValue(EnumSkyBlock.Sky, i, j, k) > this.rand.nextInt(32))
{
return false;
}
else
{
int l = this.worldObj.getBlockLightValue(i, j, k);
if (this.worldObj.isThundering())
{
int i1 = this.worldObj.skylightSubtracted;
this.worldObj.skylightSubtracted = 10;
l = this.worldObj.getBlockLightValue(i, j, k);
this.worldObj.skylightSubtracted = i1;
}
return l <= this.rand.nextInt(8);
}
}
/**
* Checks if the entity's current position is a valid location to spawn this entity.
*/
@Override
public boolean getCanSpawnHere()
{
return this.isValidLightLevel() && super.getCanSpawnHere();
}
@Override
protected String getLivingSound()
{