From cab14538e9efe8d75b1b603aae5afb7eba4476fc Mon Sep 17 00:00:00 2001 From: Kino Date: Thu, 10 Aug 2017 16:10:15 -0400 Subject: [PATCH] #170 - Spawnrates modified --- .../ai/aerwhale/AerwhaleAITravelCourse.java | 10 +++-- .../entities/hostile/EntityAechorPlant.java | 23 +++------- .../entities/hostile/EntityCockatrice.java | 26 +++-------- .../common/entities/hostile/EntityZephyr.java | 25 ++--------- .../entities/passive/EntityAerwhale.java | 25 ++--------- .../passive/mountable/EntityFlyingCow.java | 1 - .../passive/mountable/EntityPhyg.java | 1 - .../passive/mountable/EntitySwet.java | 13 ------ .../TileEntityTreasureChest.java | 7 +-- .../common/world/ChunkProviderAether.java | 21 +-------- .../common/world/biome/AetherBiome.java | 44 +++++-------------- 11 files changed, 40 insertions(+), 156 deletions(-) diff --git a/src/main/java/com/legacy/aether/common/entities/ai/aerwhale/AerwhaleAITravelCourse.java b/src/main/java/com/legacy/aether/common/entities/ai/aerwhale/AerwhaleAITravelCourse.java index a2ebc20..5f4cff8 100644 --- a/src/main/java/com/legacy/aether/common/entities/ai/aerwhale/AerwhaleAITravelCourse.java +++ b/src/main/java/com/legacy/aether/common/entities/ai/aerwhale/AerwhaleAITravelCourse.java @@ -103,9 +103,9 @@ public class AerwhaleAITravelCourse extends EntityAIBase this.aerwhale.rotationPitch *= 0.99D; - this.aerwhale.motionX += 0.005D * Math.cos((this.aerwhale.rotationYaw / 180D) * 3.1415926535897931D ) * Math.cos ((this.aerwhale.rotationPitch / 180D) * 3.1415926535897931D); + this.aerwhale.motionX += 0.005D * Math.cos((this.aerwhale.rotationYaw / 180D) * 3.1415926535897931D ) * Math.cos((this.aerwhale.rotationPitch / 180D) * 3.1415926535897931D); this.aerwhale.motionY += 0.005D * Math.sin((this.aerwhale.rotationPitch / 180D) * 3.1415926535897931D ); - this.aerwhale.motionZ += 0.005D * Math.sin((this.aerwhale.rotationYaw / 180D) * 3.1415926535897931D ) * Math.cos ((this.aerwhale.rotationPitch / 180D) * 3.1415926535897931D); + this.aerwhale.motionZ += 0.005D * Math.sin((this.aerwhale.rotationYaw / 180D) * 3.1415926535897931D ) * Math.cos((this.aerwhale.rotationPitch / 180D) * 3.1415926535897931D); this.aerwhale.motionX *= 0.98D; this.aerwhale.motionY *= 0.98D; @@ -169,17 +169,19 @@ public class AerwhaleAITravelCourse extends EntityAIBase double standard = 50D; float yaw = this.aerwhale.rotationYaw + rotationYawOffset; - float pitch = this.aerwhale.rotationPitch + rotationPitchOffset; + float pitch = this.aerwhale.rotationYaw + rotationYawOffset; float f3 = MathHelper.cos(-yaw * 0.01745329F - 3.141593F); float f4 = MathHelper.sin(-yaw * 0.01745329F - 3.141593F); float f5 = MathHelper.cos(-pitch * 0.01745329F); + float f6 = MathHelper.sin(-pitch * 0.01745329F); float f7 = f4 * f5; + float f8 = f6; float f9 = f3 * f5; Vec3d vec3d = new Vec3d(this.aerwhale.getPosition()); - Vec3d vec3d1 = vec3d.addVector((double)f7 * standard, (double)MathHelper.sin(-pitch * 0.01745329F) * standard, (double)f9 * standard); + Vec3d vec3d1 = vec3d.addVector((double)f7 * standard, (double)f8 * standard, (double)f9 * standard); RayTraceResult movingobjectposition = this.worldObj.rayTraceBlocks(vec3d, vec3d1, false); diff --git a/src/main/java/com/legacy/aether/common/entities/hostile/EntityAechorPlant.java b/src/main/java/com/legacy/aether/common/entities/hostile/EntityAechorPlant.java index 8a86001..7f7ff48 100644 --- a/src/main/java/com/legacy/aether/common/entities/hostile/EntityAechorPlant.java +++ b/src/main/java/com/legacy/aether/common/entities/hostile/EntityAechorPlant.java @@ -2,7 +2,6 @@ package com.legacy.aether.common.entities.hostile; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityAgeable; -import net.minecraft.entity.EnumCreatureType; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.SoundEvents; @@ -54,11 +53,11 @@ public class EntityAechorPlant extends EntityAetherAnimal this.tasks.addTask(0, new AechorPlantAIShootPlayer(this)); } - @Override - public boolean isCreatureType(EnumCreatureType type, boolean forSpawnCount) - { - return type == EnumCreatureType.MONSTER; - } + @Override + public int getMaxSpawnedInChunk() + { + return 3; + } @Override public void onLivingUpdate() @@ -191,16 +190,4 @@ public class EntityAechorPlant extends EntityAetherAnimal return true; } - @Override - public int getMaxSpawnedInChunk() - { - return 2; - } - - @Override - public boolean getCanSpawnHere() - { - return this.getBlockPathWeight(new BlockPos(this.posX, this.getEntityBoundingBox().minY, this.posZ)) == 10.0F && this.worldObj.isDaytime(); - } - } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/common/entities/hostile/EntityCockatrice.java b/src/main/java/com/legacy/aether/common/entities/hostile/EntityCockatrice.java index 5ced0da..692e86e 100644 --- a/src/main/java/com/legacy/aether/common/entities/hostile/EntityCockatrice.java +++ b/src/main/java/com/legacy/aether/common/entities/hostile/EntityCockatrice.java @@ -1,6 +1,5 @@ package com.legacy.aether.common.entities.hostile; -import net.minecraft.entity.EnumCreatureType; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.EntityAILookIdle; import net.minecraft.entity.ai.EntityAINearestAttackableTarget; @@ -21,7 +20,6 @@ import net.minecraft.util.math.MathHelper; import net.minecraft.world.EnumDifficulty; import net.minecraft.world.World; -import com.legacy.aether.common.blocks.BlocksAether; import com.legacy.aether.common.entities.passive.mountable.EntityMoa; import com.legacy.aether.common.entities.projectile.EntityPoisonNeedle; import com.legacy.aether.common.registry.sounds.SoundsAether; @@ -62,24 +60,18 @@ public class EntityCockatrice extends EntityMob this.setHealth(10); } + @Override + public boolean getCanSpawnHere() + { + return this.rand.nextInt(25) == 0 && super.getCanSpawnHere(); + } + @Override public boolean isPotionApplicable(PotionEffect effect) { return effect.getPotion() == MobEffects.POISON ? false : super.isPotionApplicable(effect); } - @Override - public float getBlockPathWeight(BlockPos pos) - { - return this.worldObj.getBlockState(pos).getBlock() == BlocksAether.aether_grass ? 10.0F : 0.0F; - } - - @Override - public boolean isCreatureType(EnumCreatureType type, boolean forSpawnCount) - { - return type == EnumCreatureType.MONSTER; - } - @Override public void onUpdate() { @@ -201,12 +193,6 @@ public class EntityCockatrice extends EntityMob super.readEntityFromNBT(nbttagcompound); } - @Override - public int getMaxSpawnedInChunk() - { - return 1; - } - @Override protected SoundEvent getAmbientSound() { diff --git a/src/main/java/com/legacy/aether/common/entities/hostile/EntityZephyr.java b/src/main/java/com/legacy/aether/common/entities/hostile/EntityZephyr.java index 24c439c..ec9e009 100644 --- a/src/main/java/com/legacy/aether/common/entities/hostile/EntityZephyr.java +++ b/src/main/java/com/legacy/aether/common/entities/hostile/EntityZephyr.java @@ -1,7 +1,6 @@ package com.legacy.aether.common.entities.hostile; import net.minecraft.entity.EntityFlying; -import net.minecraft.entity.EnumCreatureType; import net.minecraft.entity.ai.EntityAILookIdle; import net.minecraft.entity.ai.EntityAIWatchClosest; import net.minecraft.entity.monster.IMob; @@ -33,18 +32,6 @@ public class EntityZephyr extends EntityFlying implements IMob this.tasks.addTask(1, this.shootingAI = new ZephyrAIShootTarget(this)); } - @Override - public void setLocationAndAngles(double x, double y, double z, float yaw, float pitch) - { - this.lastTickPosX = this.prevPosX = this.posX = x; - this.lastTickPosY = this.prevPosY = this.posY = y + 50; - this.lastTickPosZ = this.prevPosZ = this.posZ = z; - this.rotationYaw = yaw; - this.rotationPitch = pitch; - - this.setPosition(this.posX, this.posY, this.posZ); - } - @Override protected void initEntityAI() { @@ -59,13 +46,13 @@ public class EntityZephyr extends EntityFlying implements IMob { BlockPos pos = new BlockPos(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.getEntityBoundingBox().minY), MathHelper.floor_double(this.posZ)); - return this.worldObj.getLight(pos) > 8 && this.worldObj.checkNoEntityCollision(this.getEntityBoundingBox().expand(0D, 10D, 0D)) && this.worldObj.getCollisionBoxes(this, this.getEntityBoundingBox()).isEmpty() && !this.worldObj.containsAnyLiquid(this.getEntityBoundingBox()); + return this.rand.nextInt(85) == 0 && this.worldObj.getCollisionBoxes(this, this.getEntityBoundingBox()).size() == 0 && !this.worldObj.containsAnyLiquid(this.getEntityBoundingBox()) && this.worldObj.getLight(pos) > 8 && super.getCanSpawnHere(); } @Override - public boolean isCreatureType(EnumCreatureType type, boolean forSpawnCount) + public int getMaxSpawnedInChunk() { - return type == EnumCreatureType.AMBIENT; + return 1; } @Override @@ -130,10 +117,4 @@ public class EntityZephyr extends EntityFlying implements IMob return 1F; } - @Override - public int getMaxSpawnedInChunk() - { - return 1; - } - } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/common/entities/passive/EntityAerwhale.java b/src/main/java/com/legacy/aether/common/entities/passive/EntityAerwhale.java index f753b8c..68035e5 100644 --- a/src/main/java/com/legacy/aether/common/entities/passive/EntityAerwhale.java +++ b/src/main/java/com/legacy/aether/common/entities/passive/EntityAerwhale.java @@ -1,7 +1,6 @@ package com.legacy.aether.common.entities.passive; import net.minecraft.entity.EntityFlying; -import net.minecraft.entity.EnumCreatureType; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.EntityAILookIdle; import net.minecraft.entity.monster.IMob; @@ -28,18 +27,6 @@ public class EntityAerwhale extends EntityFlying implements IMob this.rotationPitch = 90F * this.getRNG().nextFloat() - 45F; } - @Override - public void setLocationAndAngles(double x, double y, double z, float yaw, float pitch) - { - this.lastTickPosX = this.prevPosX = this.posX = x; - this.lastTickPosY = this.prevPosY = this.posY = y + 30; - this.lastTickPosZ = this.prevPosZ = this.posZ = z; - this.rotationYaw = yaw; - this.rotationPitch = pitch; - - this.setPosition(this.posX, this.posY, this.posZ); - } - @Override protected void initEntityAI() { @@ -61,13 +48,13 @@ public class EntityAerwhale extends EntityFlying implements IMob { BlockPos pos = new BlockPos(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.getEntityBoundingBox().minY), MathHelper.floor_double(this.posZ)); - return this.worldObj.getLight(pos) > 8 && this.worldObj.checkNoEntityCollision(this.getEntityBoundingBox().expand(0D, 30D, 0D)) && this.worldObj.getCollisionBoxes(this, this.getEntityBoundingBox()).isEmpty() && !this.worldObj.containsAnyLiquid(this.getEntityBoundingBox()); + return this.rand.nextInt(65) == 0 && this.worldObj.getCollisionBoxes(this, this.getEntityBoundingBox()).size() == 0 && !this.worldObj.containsAnyLiquid(this.getEntityBoundingBox()) && this.worldObj.getLight(pos) > 8 && super.getCanSpawnHere(); } @Override - public boolean isCreatureType(EnumCreatureType type, boolean forSpawnCount) + public int getMaxSpawnedInChunk() { - return type == EnumCreatureType.AMBIENT; + return 1; } @Override @@ -96,12 +83,6 @@ public class EntityAerwhale extends EntityFlying implements IMob return SoundsAether.aerwhale_death; } - @Override - public int getMaxSpawnedInChunk() - { - return 1; - } - @Override public boolean canDespawn() { diff --git a/src/main/java/com/legacy/aether/common/entities/passive/mountable/EntityFlyingCow.java b/src/main/java/com/legacy/aether/common/entities/passive/mountable/EntityFlyingCow.java index 81c4f87..e310686 100644 --- a/src/main/java/com/legacy/aether/common/entities/passive/mountable/EntityFlyingCow.java +++ b/src/main/java/com/legacy/aether/common/entities/passive/mountable/EntityFlyingCow.java @@ -23,7 +23,6 @@ import net.minecraft.util.EnumHand; import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundEvent; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; import com.legacy.aether.common.entities.util.EntitySaddleMount; diff --git a/src/main/java/com/legacy/aether/common/entities/passive/mountable/EntityPhyg.java b/src/main/java/com/legacy/aether/common/entities/passive/mountable/EntityPhyg.java index 4eea79f..cd1330b 100644 --- a/src/main/java/com/legacy/aether/common/entities/passive/mountable/EntityPhyg.java +++ b/src/main/java/com/legacy/aether/common/entities/passive/mountable/EntityPhyg.java @@ -17,7 +17,6 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundEvent; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; import com.legacy.aether.common.entities.util.EntitySaddleMount; diff --git a/src/main/java/com/legacy/aether/common/entities/passive/mountable/EntitySwet.java b/src/main/java/com/legacy/aether/common/entities/passive/mountable/EntitySwet.java index 85db390..8900ed9 100644 --- a/src/main/java/com/legacy/aether/common/entities/passive/mountable/EntitySwet.java +++ b/src/main/java/com/legacy/aether/common/entities/passive/mountable/EntitySwet.java @@ -7,7 +7,6 @@ import javax.annotation.Nullable; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityAgeable; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.EnumCreatureType; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.monster.EntityMob; import net.minecraft.entity.player.EntityPlayer; @@ -65,12 +64,6 @@ public class EntitySwet extends EntityMountable this.slimeJumpDelay = this.rand.nextInt(20) + 10; } - @Override - public boolean isCreatureType(EnumCreatureType type, boolean forSpawnCount) - { - return type == EnumCreatureType.MONSTER; - } - @Override public void updateRidden() { @@ -706,10 +699,4 @@ public class EntitySwet extends EntityMountable return null; } - @Override - public int getMaxSpawnedInChunk() - { - return 6; - } - } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/common/tile_entities/TileEntityTreasureChest.java b/src/main/java/com/legacy/aether/common/tile_entities/TileEntityTreasureChest.java index 25ad249..c9cde80 100644 --- a/src/main/java/com/legacy/aether/common/tile_entities/TileEntityTreasureChest.java +++ b/src/main/java/com/legacy/aether/common/tile_entities/TileEntityTreasureChest.java @@ -2,9 +2,6 @@ package com.legacy.aether.common.tile_entities; import java.util.Random; -import com.legacy.aether.common.world.dungeon.*; - -import net.minecraft.block.BlockChest; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; @@ -13,6 +10,10 @@ import net.minecraft.server.management.PlayerList; import net.minecraft.tileentity.TileEntityChest; import net.minecraftforge.fml.common.FMLCommonHandler; +import com.legacy.aether.common.world.dungeon.BronzeDungeon; +import com.legacy.aether.common.world.dungeon.GoldenDungeon; +import com.legacy.aether.common.world.dungeon.SilverDungeon; + public class TileEntityTreasureChest extends TileEntityChest { diff --git a/src/main/java/com/legacy/aether/common/world/ChunkProviderAether.java b/src/main/java/com/legacy/aether/common/world/ChunkProviderAether.java index e6c38e6..97b7bff 100644 --- a/src/main/java/com/legacy/aether/common/world/ChunkProviderAether.java +++ b/src/main/java/com/legacy/aether/common/world/ChunkProviderAether.java @@ -258,26 +258,9 @@ public class ChunkProviderAether implements IChunkGenerator @Override public List getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) { - if (creatureType == EnumCreatureType.CREATURE) - { - return this.worldObj.getBiome(pos).getSpawnableList(EnumCreatureType.CREATURE); - } - else if (creatureType == EnumCreatureType.MONSTER) - { - if (this.rand.nextInt(18) == 0) - { - return this.worldObj.getBiome(pos).getSpawnableList(EnumCreatureType.MONSTER); - } - } - else if (creatureType == EnumCreatureType.AMBIENT) - { - if (this.rand.nextInt(35) == 0) - { - return this.worldObj.getBiome(pos).getSpawnableList(EnumCreatureType.AMBIENT); - } - } + Biome biome = this.worldObj.getBiomeProvider().getBiome(pos); - return null; + return biome != null ? biome.getSpawnableList(creatureType) : null; } @Override diff --git a/src/main/java/com/legacy/aether/common/world/biome/AetherBiome.java b/src/main/java/com/legacy/aether/common/world/biome/AetherBiome.java index 6d8c47e..6fc4113 100644 --- a/src/main/java/com/legacy/aether/common/world/biome/AetherBiome.java +++ b/src/main/java/com/legacy/aether/common/world/biome/AetherBiome.java @@ -1,11 +1,8 @@ package com.legacy.aether.common.world.biome; import java.util.ArrayList; -import java.util.Collections; -import java.util.List; import java.util.Random; -import net.minecraft.entity.EnumCreatureType; import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.BiomeDecorator; import net.minecraft.world.gen.feature.WorldGenAbstractTree; @@ -47,41 +44,26 @@ public class AetherBiome extends Biome this.spawnableMonsterList.addAll(list); - list.clear(); - - this.addFlyingEntry(list); - - this.spawnableCaveCreatureList.addAll(list); - this.topBlock = BlocksAether.aether_grass.getDefaultState(); this.fillerBlock = BlocksAether.holystone.getDefaultState(); } - public float getSpawningChance() - { - return 0.3F; - } - private void addCreatureEntry(ArrayList list) { - list.add(new SpawnListEntry(EntitySheepuff.class, 30, 4, 4)); - list.add(new SpawnListEntry(EntityPhyg.class, 39, 4, 4)); - list.add(new SpawnListEntry(EntityMoa.class, 40, 3, 3)); - list.add(new SpawnListEntry(EntityFlyingCow.class, 46, 4, 4)); - list.add(new SpawnListEntry(EntityAerbunny.class, 36, 3, 3)); + list.add(new SpawnListEntry(EntitySwet.class, 10, 4, 4)); + list.add(new SpawnListEntry(EntityAechorPlant.class, 8, 3, 3)); + list.add(new SpawnListEntry(EntitySheepuff.class, 10, 4, 4)); + list.add(new SpawnListEntry(EntityPhyg.class, 12, 4, 4)); + list.add(new SpawnListEntry(EntityMoa.class, 10, 3, 3)); + list.add(new SpawnListEntry(EntityFlyingCow.class, 10, 4, 4)); + list.add(new SpawnListEntry(EntityAerbunny.class, 11, 3, 3)); } private void addMobEntry(ArrayList list) { - list.add(new SpawnListEntry(EntitySwet.class, 20, 1, 2)); - list.add(new SpawnListEntry(EntityAechorPlant.class, 70, 1, 2)); - list.add(new SpawnListEntry(EntityCockatrice.class, 60, 1, 2)); - } - - private void addFlyingEntry(ArrayList list) - { - list.add(new SpawnListEntry(EntityAerwhale.class, 3, 1, 3)); - list.add(new SpawnListEntry(EntityZephyr.class, 5, 0, 1)); + list.add(new SpawnListEntry(EntityCockatrice.class, 3, 4, 4)); + list.add(new SpawnListEntry(EntityAerwhale.class, 8, 3, 3)); + list.add(new SpawnListEntry(EntityZephyr.class, 5, 1, 1)); } @Override @@ -90,16 +72,12 @@ public class AetherBiome extends Biome return 0xC0C0FF; // Lavender Blue } + @Override public boolean canRain() { return false; } - public Biome.TempCategory getTempCategory() - { - return TempCategory.COLD; - } - public BiomeDecorator createBiomeDecorator() { return new AetherBiomeDecorator();