diff --git a/src/main/java/magicbees/bees/Allele.java b/src/main/java/magicbees/bees/Allele.java index 18d5702..d9c3401 100644 --- a/src/main/java/magicbees/bees/Allele.java +++ b/src/main/java/magicbees/bees/Allele.java @@ -157,7 +157,7 @@ public class Allele implements IAllele { .setChanceToSpawn(60) .setMaxMobsInSpawnZone(2); Allele.spawnWolf = new AlleleEffectSpawnMob("Canine", false , "Wolf", "mob.wolf.panting") - .setThrottle(950) + .setThrottle(650) .setChanceToSpawn(40) .setMaxMobsInSpawnZone(2); } diff --git a/src/main/java/magicbees/bees/BeeGenomeManager.java b/src/main/java/magicbees/bees/BeeGenomeManager.java index 4ab91da..dcbf24b 100644 --- a/src/main/java/magicbees/bees/BeeGenomeManager.java +++ b/src/main/java/magicbees/bees/BeeGenomeManager.java @@ -331,7 +331,7 @@ public class BeeGenomeManager { genome[EnumBeeChromosome.SPECIES.ordinal()] = BeeSpecies.BIGBAD; genome[EnumBeeChromosome.CAVE_DWELLING.ordinal()] = Allele.getBaseAllele("boolTrue"); - genome[EnumBeeChromosome.EFFECT.ordinal()] = Allele.spawnWisp; + genome[EnumBeeChromosome.EFFECT.ordinal()] = Allele.spawnWolf; return genome; } diff --git a/src/main/java/magicbees/bees/allele/effect/AlleleEffectSpawnMob.java b/src/main/java/magicbees/bees/allele/effect/AlleleEffectSpawnMob.java index 26a6e7b..77615ce 100644 --- a/src/main/java/magicbees/bees/allele/effect/AlleleEffectSpawnMob.java +++ b/src/main/java/magicbees/bees/allele/effect/AlleleEffectSpawnMob.java @@ -49,80 +49,97 @@ public class AlleleEffectSpawnMob extends AlleleEffect { @Override public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) { // Check if we're ready to spawn the mob. + boolean didSpawn = false; if (storedData.getBoolean(0)) { World w = housing.getWorld(); - + int roll = w.rand.nextInt(100); - - if (roll <= this.chanceToSpawn) { - if (this.spawnsWhilePlayerNear) { - List entities = this.getEntitiesWithinRange(genome, housing); - EntityPlayer target = null; - for (Entity e : entities) { - if (e instanceof EntityPlayer) { - target = (EntityPlayer) e; - // Check for wearing armor & cancel - if (ItemArmorApiarist.getNumberPiecesWorn(target) >= 4) { - // Full armor suit is treated as "invisible." - target = null; - } else { - break; - } - } - } - + + if (roll <= chanceToSpawn) { + if (spawnsWhilePlayerNear) { + EntityPlayer target = findPlayerTarget(genome, housing); + // Let's spawn a mob. =D if (target != null) { - storedData.setBoolean(0, !this.spawnMob(genome, target, w, housing, false)); - } else if (this.alternateMob != null) { - storedData.setBoolean(0, !this.spawnMob(genome, null, w, housing, true)); + didSpawn = spawnMob(genome, target, w, housing, false); + } else if (alternateMob != null) { + didSpawn = spawnMob(genome, null, w, housing, true); } } else { storedData.setBoolean(0, !this.spawnMob(genome, null, w, housing, true)); } } else { - if (this.mobSound != null && w.rand.nextInt(100) < 35) { - int range = genome.getTerritory()[0]; - double x = housing.getXCoord() + w.rand.nextDouble() * (range * 2) - range; - range = genome.getTerritory()[1]; - double y = housing.getYCoord() + w.rand.nextDouble() * (range * 2) - range; - range = genome.getTerritory()[2]; - double z = housing.getZCoord() + w.rand.nextDouble() * (range * 2) - range; - w.playSoundEffect(x, y, z, this.mobSound, 0.5f, (w.rand.nextFloat() - w.rand.nextFloat()) * 0.2f + 1.0f); - } - storedData.setBoolean(0, true); + playMobLiveSound(genome, housing, w); + didSpawn = true; } + + if (didSpawn) { + storedData.setBoolean(0, !didSpawn); + storedData.setInteger(0, storedData.getInteger(0) - throttle); + } + } + else { + storedData.setBoolean(0, true); } return storedData; } + private void playMobLiveSound(IBeeGenome genome, IBeeHousing housing, World w) { + if (mobSound != null && w.rand.nextInt(100) < 35) { + int range = genome.getTerritory()[0]; + double x = housing.getXCoord() + w.rand.nextDouble() * (range * 2) - range; + range = genome.getTerritory()[1]; + double y = housing.getYCoord() + w.rand.nextDouble() * (range * 2) - range; + range = genome.getTerritory()[2]; + double z = housing.getZCoord() + w.rand.nextDouble() * (range * 2) - range; + w.playSoundEffect(x, y, z, this.mobSound, 0.5f, (w.rand.nextFloat() - w.rand.nextFloat()) * 0.2f + 1.0f); + } + } + + private EntityPlayer findPlayerTarget(IBeeGenome genome, IBeeHousing housing) { + List entities = getEntitiesWithinRange(genome, housing); + EntityPlayer target = null; + for (Entity e : entities) { + if (e instanceof EntityPlayer) { + target = (EntityPlayer) e; + // Check for wearing armor & cancel + if (ItemArmorApiarist.getNumberPiecesWorn(target) >= 4) { + // Full armor suit is treated as "invisible." + target = null; + } else { + break; + } + } + } + return target; + } + protected boolean spawnMob(IBeeGenome bee, EntityPlayer player, World world, IBeeHousing housing, boolean spawnAlternate) { boolean spawnedFlag = false; EntityLiving mob; - if (spawnAlternate && this.alternateMob != null) { - mob = (EntityLiving) EntityList.createEntityByName(this.alternateMob, world); + if (spawnAlternate && alternateMob != null) { + mob = (EntityLiving) EntityList.createEntityByName(alternateMob, world); } else { - mob = (EntityLiving) EntityList.createEntityByName(this.mobName, world); + mob = (EntityLiving) EntityList.createEntityByName(mobName, world); } if (mob != null) { double pos[] = this.randomMobSpawnCoords(world, bee, housing); - int entitiesCount = world.getEntitiesWithinAABB( - mob.getClass(), - AxisAlignedBB.getBoundingBox((int) pos[0], (int) pos[1], (int) pos[2], (int) pos[0] + 1, (int) pos[1] + 1, (int) pos[2] + 1).expand(8.0D, - 4.0D, 8.0D)).size(); + int entitiesCount = world.getEntitiesWithinAABB(mob.getClass(), + AxisAlignedBB.getBoundingBox((int) pos[0], (int) pos[1], (int) pos[2], + (int) pos[0] + 1, (int) pos[1] + 1, (int) pos[2] + 1) + .expand(8.0D,4.0D, 8.0D)).size(); mob.setPositionAndRotation(pos[0], pos[1], pos[2], world.rand.nextFloat() * 360f, 0f); - if (entitiesCount < this.maxMobsInArea && mob.getCanSpawnHere()) { + if (entitiesCount < maxMobsInArea && mob.getCanSpawnHere()) { spawnedFlag = world.spawnEntityInWorld(mob); - if (this.aggosOnPlayer && player != null) { + if (aggosOnPlayer && player != null) { if (ItemArmorApiarist.getNumberPiecesWorn(player) < 4) { - // Protect fully suited player from initial murder - // intent. + // Protect fully suited player from initial murder intent. mob.setAttackTarget(player); } } @@ -133,33 +150,28 @@ public class AlleleEffectSpawnMob extends AlleleEffect { } public AlleleEffectSpawnMob setSpawnsOnPlayerNear(String alternateMobToSpawn) { - this.spawnsWhilePlayerNear = true; - this.alternateMob = alternateMobToSpawn; - + spawnsWhilePlayerNear = true; + alternateMob = alternateMobToSpawn; return this; } public AlleleEffectSpawnMob setAggrosPlayerOnSpawn() { - this.aggosOnPlayer = true; - + aggosOnPlayer = true; return this; } public AlleleEffectSpawnMob setThrottle(int val) { - this.throttle = val; - + throttle = val; return this; } public AlleleEffectSpawnMob setChanceToSpawn(int value) { - this.chanceToSpawn = value; - + chanceToSpawn = value; return this; } public AlleleEffectSpawnMob setMaxMobsInSpawnZone(int value) { - this.maxMobsInArea = value; - + maxMobsInArea = value; return this; } diff --git a/src/main/java/magicbees/block/BlockMagicApiary.java b/src/main/java/magicbees/block/BlockMagicApiary.java index fba29bf..e60e73e 100644 --- a/src/main/java/magicbees/block/BlockMagicApiary.java +++ b/src/main/java/magicbees/block/BlockMagicApiary.java @@ -1,7 +1,5 @@ package magicbees.block; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import magicbees.client.gui.UIScreens; import magicbees.main.CommonProxy; import magicbees.main.MagicBees; @@ -18,8 +16,8 @@ import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.world.World; - -import javax.swing.*; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; public class BlockMagicApiary extends BlockContainer { diff --git a/src/main/java/magicbees/block/BlockPlanks.java b/src/main/java/magicbees/block/BlockPlanks.java index ec8cbee..a26fcb5 100644 --- a/src/main/java/magicbees/block/BlockPlanks.java +++ b/src/main/java/magicbees/block/BlockPlanks.java @@ -39,6 +39,7 @@ public class BlockPlanks extends Block return meta; } + @SuppressWarnings({ "unchecked", "rawtypes" }) @SideOnly(Side.CLIENT) @Override public void getSubBlocks(Item item, CreativeTabs tab, List itemsList) diff --git a/src/main/java/magicbees/block/BlockWoodSlab.java b/src/main/java/magicbees/block/BlockWoodSlab.java index 664e8ea..58a066b 100644 --- a/src/main/java/magicbees/block/BlockWoodSlab.java +++ b/src/main/java/magicbees/block/BlockWoodSlab.java @@ -8,7 +8,6 @@ import cpw.mods.fml.relauncher.SideOnly; import magicbees.block.types.PlankType; import magicbees.main.CommonProxy; import magicbees.main.Config; - import net.minecraft.block.Block; import net.minecraft.block.BlockSlab; import net.minecraft.block.material.Material; @@ -57,6 +56,7 @@ public class BlockWoodSlab extends BlockSlab return this.getUnlocalizedName() + "." + PlankType.getType(meta).name; } + @SuppressWarnings({ "rawtypes", "unchecked" }) @SideOnly(Side.CLIENT) @Override public void getSubBlocks(Item item, CreativeTabs tab, List itemsList) diff --git a/src/main/resources/assets/magicbees/lang/en_US.lang b/src/main/resources/assets/magicbees/lang/en_US.lang index af351a3..266d15b 100644 --- a/src/main/resources/assets/magicbees/lang/en_US.lang +++ b/src/main/resources/assets/magicbees/lang/en_US.lang @@ -435,6 +435,7 @@ magicbees.speciesBotAlfheim=Alfheim magicbees.speciesBotAlfheim.description=They recall their time in Alfheim, and yearn for a world infused with mana, and so seek to make it so.|Apinomicon magicbees.species= magicbees.species.description= + magicbees.speedBlinding=Blinding magicbees.effectCurative=Cleansing magicbees.effectDigSpeed=Mining @@ -454,6 +455,7 @@ magicbees.effectWispy=Wispy magicbees.effectGhastly=Ghastly magicbees.effectSpidery=Spidery magicbees.effectAblaze=Ablaze +magicbees.effectCanine=Howling magicbees.effectManaDrainer=Vortex magicbees.effectAMWisp=Spiritual magicbees.effectTEBlizzy=Blizzy