Mob tweaks (Still having spawning issues)
|
@ -4,10 +4,9 @@ import net.minecraft.block.BlockDoublePlant;
|
|||
import net.minecraft.block.BlockFlower;
|
||||
import net.minecraft.block.BlockPlanks;
|
||||
import net.minecraft.block.BlockTallGrass;
|
||||
import net.minecraft.entity.passive.EntityWolf;
|
||||
import net.minecraft.entity.passive.EntityBat;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.biome.BiomeGenBase.SpawnListEntry;
|
||||
import biomesoplenty.api.biome.BOPBiome;
|
||||
import biomesoplenty.api.biome.generation.GeneratorStage;
|
||||
import biomesoplenty.api.biome.generation.GeneratorWeighted;
|
||||
|
@ -21,7 +20,6 @@ import biomesoplenty.common.enums.BOPClimates;
|
|||
import biomesoplenty.common.enums.BOPFlowers;
|
||||
import biomesoplenty.common.enums.BOPGems;
|
||||
import biomesoplenty.common.enums.BOPPlants;
|
||||
import biomesoplenty.common.enums.BOPTrees;
|
||||
import biomesoplenty.common.util.biome.GeneratorUtils.ScatterYMethod;
|
||||
import biomesoplenty.common.world.BOPWorldSettings;
|
||||
import biomesoplenty.common.world.feature.GeneratorDoubleFlora;
|
||||
|
@ -29,7 +27,6 @@ import biomesoplenty.common.world.feature.GeneratorFlora;
|
|||
import biomesoplenty.common.world.feature.GeneratorGrass;
|
||||
import biomesoplenty.common.world.feature.GeneratorOreSingle;
|
||||
import biomesoplenty.common.world.feature.GeneratorWaterside;
|
||||
import biomesoplenty.common.world.feature.tree.GeneratorBasicTree;
|
||||
import biomesoplenty.common.world.feature.tree.GeneratorBush;
|
||||
import biomesoplenty.common.world.feature.tree.GeneratorTaigaTree;
|
||||
|
||||
|
@ -46,7 +43,7 @@ public class BiomeGenMeadow extends BOPBiome
|
|||
this.addWeight(BOPClimates.COOL_TEMPERATE, 10);
|
||||
|
||||
this.spawnableCreatureList.add(new SpawnListEntry(EntitySnail.class, 6, 1, 2));
|
||||
this.spawnableCreatureList.add(new SpawnListEntry(EntityButterfly.class, 12, 2, 4));
|
||||
this.spawnableCreatureList.add(new SpawnListEntry(EntityButterfly.class, 6, 2, 4));
|
||||
|
||||
// sand
|
||||
this.addGenerator("sand", GeneratorStage.SAND_PASS2, (new GeneratorWaterside.Builder()).amountPerChunk(3).maxRadius(7).with(Blocks.sand.getDefaultState()).create());
|
||||
|
|
|
@ -19,6 +19,7 @@ import net.minecraft.entity.SharedMonsterAttributes;
|
|||
import net.minecraft.entity.ai.EntityAIBase;
|
||||
import net.minecraft.entity.ai.EntityMoveHelper;
|
||||
import net.minecraft.entity.monster.IMob;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
@ -40,41 +41,49 @@ public class EntityButterfly extends EntityFlying implements IMob {
|
|||
protected void applyEntityAttributes()
|
||||
{
|
||||
super.applyEntityAttributes();
|
||||
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(2.0D);
|
||||
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(1.0D);
|
||||
}
|
||||
|
||||
// Checks to make sure the light is not too bright where the mob is spawning
|
||||
// This is same code as for EntitySkeleton
|
||||
protected boolean isValidLightLevel()
|
||||
@Override
|
||||
public boolean canBePushed()
|
||||
{
|
||||
BlockPos blockpos = new BlockPos(this.posX, this.getEntityBoundingBox().minY, this.posZ);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean allowLeashing()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.worldObj.getLightFor(EnumSkyBlock.SKY, blockpos) > this.rand.nextInt(32))
|
||||
{
|
||||
// TODO: not sure what's going on here...
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
int light = this.worldObj.getLightFromNeighbors(blockpos);
|
||||
|
||||
// if it's thundering, force getSkylightSubtracted to 10 before calculating getLightFromNeighbors, then restore it
|
||||
if (this.worldObj.isThundering())
|
||||
{
|
||||
int oldSkyLightSubtracted = this.worldObj.getSkylightSubtracted();
|
||||
this.worldObj.setSkylightSubtracted(5);
|
||||
light = this.worldObj.getLightFromNeighbors(blockpos);
|
||||
this.worldObj.setSkylightSubtracted(oldSkyLightSubtracted);
|
||||
}
|
||||
|
||||
return light >= 8;
|
||||
}
|
||||
@Override
|
||||
protected boolean interact(EntityPlayer player)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getCanSpawnHere()
|
||||
{
|
||||
return this.isValidLightLevel() && super.getCanSpawnHere();
|
||||
BlockPos blockpos = new BlockPos(this.posX, this.getEntityBoundingBox().minY, this.posZ);
|
||||
|
||||
if (blockpos.getY() <= this.worldObj.getSeaLevel())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (blockpos.getY() >= 90)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
int light = this.worldObj.getLightFromNeighbors(blockpos);
|
||||
|
||||
return light > 8 && super.getCanSpawnHere();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Helper class representing a point in space that the butterfly is targeting for some reason
|
||||
|
|
|
@ -20,6 +20,7 @@ import net.minecraft.entity.SharedMonsterAttributes;
|
|||
import net.minecraft.entity.ai.EntityAIBase;
|
||||
import net.minecraft.entity.ai.EntityMoveHelper;
|
||||
import net.minecraft.entity.monster.IMob;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.DamageSource;
|
||||
|
@ -39,41 +40,29 @@ public class EntitySnail extends EntityLiving implements IMob {
|
|||
protected void applyEntityAttributes()
|
||||
{
|
||||
super.applyEntityAttributes();
|
||||
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(2.0D);
|
||||
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(3.0D);
|
||||
}
|
||||
|
||||
// Checks to make sure the light is not too bright where the mob is spawning
|
||||
// This is same code as for EntitySkeleton
|
||||
protected boolean isValidLightLevel()
|
||||
@Override
|
||||
public boolean allowLeashing()
|
||||
{
|
||||
BlockPos blockpos = new BlockPos(this.posX, this.getEntityBoundingBox().minY, this.posZ);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.worldObj.getLightFor(EnumSkyBlock.SKY, blockpos) > this.rand.nextInt(32))
|
||||
{
|
||||
// TODO: not sure what's going on here...
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
int light = this.worldObj.getLightFromNeighbors(blockpos);
|
||||
|
||||
// if it's thundering, force getSkylightSubtracted to 10 before calculating getLightFromNeighbors, then restore it
|
||||
if (this.worldObj.isThundering())
|
||||
{
|
||||
int oldSkyLightSubtracted = this.worldObj.getSkylightSubtracted();
|
||||
this.worldObj.setSkylightSubtracted(10);
|
||||
light = this.worldObj.getLightFromNeighbors(blockpos);
|
||||
this.worldObj.setSkylightSubtracted(oldSkyLightSubtracted);
|
||||
}
|
||||
|
||||
return light >= 3;
|
||||
}
|
||||
@Override
|
||||
protected boolean interact(EntityPlayer player)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getCanSpawnHere()
|
||||
{
|
||||
return this.isValidLightLevel() && super.getCanSpawnHere();
|
||||
BlockPos blockpos = new BlockPos(this.posX, this.getEntityBoundingBox().minY, this.posZ);
|
||||
|
||||
int light = this.worldObj.getLightFromNeighbors(blockpos);
|
||||
|
||||
return light > 4 && super.getCanSpawnHere();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Before Width: | Height: | Size: 396 B After Width: | Height: | Size: 393 B |
After Width: | Height: | Size: 420 B |
After Width: | Height: | Size: 417 B |
Before Width: | Height: | Size: 311 B After Width: | Height: | Size: 297 B |
Before Width: | Height: | Size: 318 B After Width: | Height: | Size: 317 B |