From 7513ba12553f18b1683d1de3a8fa6caec2b208e0 Mon Sep 17 00:00:00 2001 From: MysteriousAges Date: Mon, 26 Aug 2013 11:35:53 -0700 Subject: [PATCH 1/4] Fixing mutation rate on Iron bees. --- magicbees_src/magicbees/bees/BeeMutation.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/magicbees_src/magicbees/bees/BeeMutation.java b/magicbees_src/magicbees/bees/BeeMutation.java index e18ec4d..9eaedd2 100644 --- a/magicbees_src/magicbees/bees/BeeMutation.java +++ b/magicbees_src/magicbees/bees/BeeMutation.java @@ -126,7 +126,7 @@ public class BeeMutation implements IBeeMutation new BeeMutation(Allele.getBaseSpecies("Industrious"), Allele.getBaseSpecies("Forest"), BeeSpecies.TIN, 12) .setBlockRequired("blockTin"); } - new BeeMutation(Allele.getBaseSpecies("Common"), Allele.getBaseSpecies("Industrious"), BeeSpecies.IRON, 100) + new BeeMutation(Allele.getBaseSpecies("Common"), Allele.getBaseSpecies("Industrious"), BeeSpecies.IRON, 12) .setBlockRequired(Block.blockIron); if (BeeSpecies.LEAD.isActive()) { From 533d7d55a8260cddebc2e5fe7ad09cb87d6390d2 Mon Sep 17 00:00:00 2001 From: MysteriousAges Date: Wed, 28 Aug 2013 17:46:38 -0700 Subject: [PATCH 2/4] Crumbling, Transmuting bees & their (crappy) effects. --- magicbees_res/changelog.txt | 5 + magicbees_res/mods/magicbees/lang/en_US.xml | 11 ++ magicbees_src/magicbees/bees/Allele.java | 19 ++- .../magicbees/bees/AlleleEffectCrumbling.java | 75 +++++++++++ .../bees/AlleleEffectTransmuting.java | 118 ++++++++++++++++++ .../magicbees/bees/BeeClassification.java | 1 + .../magicbees/bees/BeeGenomeManager.java | 40 ++++++ magicbees_src/magicbees/bees/BeeMutation.java | 6 +- magicbees_src/magicbees/bees/BeeSpecies.java | 20 +++ .../client/render/BeeRenderEffect.java | 2 +- 10 files changed, 289 insertions(+), 8 deletions(-) create mode 100644 magicbees_src/magicbees/bees/AlleleEffectCrumbling.java create mode 100644 magicbees_src/magicbees/bees/AlleleEffectTransmuting.java diff --git a/magicbees_res/changelog.txt b/magicbees_res/changelog.txt index 9bbea56..4ada2c9 100644 --- a/magicbees_res/changelog.txt +++ b/magicbees_res/changelog.txt @@ -1,3 +1,8 @@ +2.1.3 +Added a new mini bee branch: Polymorphic. It is said Unusual bees can have some unusual effects on the world if they are advanced... +Crumbling effect ages the area around the hive. +Transmutation effect will turn blocks into other blocks. (It's still a bit rough though.) + 2.1.2 Fixed issue with mob spawning effects incorrectly checking for effect data variables. Updating localization files (RU, DE) diff --git a/magicbees_res/mods/magicbees/lang/en_US.xml b/magicbees_res/mods/magicbees/lang/en_US.xml index a17ad47..aaf77cd 100644 --- a/magicbees_res/mods/magicbees/lang/en_US.xml +++ b/magicbees_res/mods/magicbees/lang/en_US.xml @@ -266,6 +266,13 @@ It is said they have been to a land ruled by a Great Wizard, and have taken the aspect of his city.|Apinomicon Apatine Day and night the whining droned on. I barricaded the windows and hid in the cellar, but everywhere the high-pitched noise of the apatine bees penetrated the walls and drove me to distraction.|Beekeeping 101 + + Mutable + Changeable in nature, mercurial in personality.|Apinomicon + Transmuting + "I could've sworn this was made out of stone yesterday!"|Sengir, Mad Apiarist + Crumbling + They have a corrosive effect on their surroundings, rapidly aging them.|Apinomicon Stark "These are unusually attracted to shards. This warrents further investigation."|Azanor, Master Thaumaturge @@ -350,6 +357,8 @@ Swiftness Time Warp Withering + Transmuting + Crumbling Aura Attract Purify Aura Aura Flux @@ -392,6 +401,8 @@ They collect fragments of metal and combine them into larger portions.|Apinomicon Gem They collect fragments of precious gems in their combs.|Apinomicon + Polymorphic + Reality seems to be somewhat volatile around bees of this family.|Apinomicon Thaumic These bees have an increased affinity to magic and aura.|Apinomicon Fleshy diff --git a/magicbees_src/magicbees/bees/Allele.java b/magicbees_src/magicbees/bees/Allele.java index 393135e..cf0a904 100644 --- a/magicbees_src/magicbees/bees/Allele.java +++ b/magicbees_src/magicbees/bees/Allele.java @@ -26,6 +26,8 @@ public class Allele implements IAllele public static IAlleleEffect effectMoveSpeed; public static IAlleleEffect effectSlowSpeed; public static IAlleleEffect effectWithering; + public static IAlleleEffect effectTransmuting; + public static IAlleleEffect effectCrumbling; public static IAlleleEffect spawnBrainyZombie; public static IAlleleEffect spawnWisp; @@ -60,11 +62,18 @@ public class Allele implements IAllele Allele.spawnWisp = new AlleleEffectSpawnWisp("Wispy", false, ThaumcraftHelper.Entity.WISP.entityID, "thaumcraft.wisplive") .setThrottle(1800).setChanceToSpawn(79); + + Allele.effectNodeAttract = new AlleleEffectAuraNodeAttract("NodeAttract", false, 400); + Allele.effectNodePurify = new AlleleEffectAuraNodePurify("NodePurify", false, 600, 150); + Allele.effectNodeFlux = new AlleleEffectAuraNodeFlux("NodeFlux", true, 300, 300); + Allele.effectNodeCharge = new AlleleEffectAuraNodeCharge("NodeCharge", true, 1200); } else { Allele.flowerThaumcraft = Allele.flowerAuraNode = (IAlleleFlowers)Allele.getBaseAllele("flowersVanilla"); - Allele.spawnBrainyZombie = Allele.spawnBats = Allele.spawnWisp = (IAlleleEffect)Allele.getBaseAllele("effectNone"); + Allele.spawnBrainyZombie = Allele.spawnBats = Allele.spawnWisp = + Allele.effectNodeAttract = Allele.effectNodePurify = + Allele.effectNodeFlux = Allele.effectNodeCharge = (IAlleleEffect)Allele.getBaseAllele("effectNone"); } if (ArsMagicaHelper.isActive()) @@ -85,16 +94,14 @@ public class Allele implements IAllele Allele.spawnManaDrainer = Allele.spawnWispOrHecate = (IAlleleEffect)Allele.getBaseAllele("effectNone"); } - Allele.effectNodeAttract = new AlleleEffectAuraNodeAttract("NodeAttract", false, 400); - Allele.effectNodePurify = new AlleleEffectAuraNodePurify("NodePurify", false, 600, 150); - Allele.effectNodeFlux = new AlleleEffectAuraNodeFlux("NodeFlux", true, 300, 300); - Allele.effectNodeCharge = new AlleleEffectAuraNodeCharge("NodeCharge", true, 1200); - Allele.effectCleansing = new AlleleEffectCure("Curative", false); Allele.effectDigSpeed = new AlleleEffectPotion("DigSpeed", Potion.digSpeed, 15, false); Allele.effectMoveSpeed = new AlleleEffectPotion("MoveSpeed", Potion.moveSpeed, 10, false); Allele.effectSlowSpeed = new AlleleEffectPotion("SlowSpeed", Potion.moveSlowdown, 3, false).setMalicious(); Allele.effectWithering = new AlleleEffectPotion("Withering", Potion.wither, 10, false).setMalicious(); + + Allele.effectTransmuting = new AlleleEffectTransmuting("Transmuting", true); + Allele.effectCrumbling = new AlleleEffectCrumbling("Crumbling", true); Allele.spawnGhast = new AlleleEffectSpawnMob("Ghastly", false, "Ghast", "mob.ghast.moan") .setThrottle(2060).setChanceToSpawn(10).setMaxMobsInSpawnZone(1); diff --git a/magicbees_src/magicbees/bees/AlleleEffectCrumbling.java b/magicbees_src/magicbees/bees/AlleleEffectCrumbling.java new file mode 100644 index 0000000..496da02 --- /dev/null +++ b/magicbees_src/magicbees/bees/AlleleEffectCrumbling.java @@ -0,0 +1,75 @@ +package magicbees.bees; + +import java.util.HashMap; + +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import net.minecraftforge.oredict.OreDictionary; +import forestry.api.apiculture.IBeeGenome; +import forestry.api.apiculture.IBeeHousing; +import forestry.api.genetics.IEffectData; + +public class AlleleEffectCrumbling extends AlleleEffect +{ + private HashMap crumbleMap; + + public AlleleEffectCrumbling(String id, boolean isDominant) + { + super(id, isDominant, 200); + + crumbleMap = new HashMap(); + + crumbleMap.put(new ItemStack(Block.stone), new ItemStack(Block.cobblestone)); + crumbleMap.put(new ItemStack(Block.cobblestone), new ItemStack(Block.cobblestoneMossy)); + crumbleMap.put(new ItemStack(Block.stoneBrick, 1, 0), new ItemStack(Block.stoneBrick, 1, 2)); + crumbleMap.put(new ItemStack(Block.stoneBrick, 1, 2), new ItemStack(Block.stoneBrick, 1, 1)); + crumbleMap.put(new ItemStack(Block.cobblestoneWall), new ItemStack(Block.cobblestoneWall, 1, 1)); + crumbleMap.put(new ItemStack(Block.gravel), new ItemStack(Block.sand)); + } + + @Override + public IEffectData validateStorage(IEffectData storedData) + { + if (storedData == null || !(storedData instanceof magicbees.bees.EffectData)) + { + storedData = new magicbees.bees.EffectData(1, 0, 0); + } + return storedData; + } + + @Override + protected IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) + { + World world = housing.getWorld(); + // Get random coords within territory + int xCoord = (int)(housing.getTerritoryModifier(genome, 1f) * genome.getTerritory()[0]); + xCoord = housing.getXCoord() + world.rand.nextInt(xCoord) - xCoord / 2; + int yCoord = (int)(housing.getTerritoryModifier(genome, 1f) * genome.getTerritory()[1]); + yCoord = housing.getYCoord() + world.rand.nextInt(yCoord) - yCoord / 2; + int zCoord = (int)(housing.getTerritoryModifier(genome, 1f) * genome.getTerritory()[0]); + zCoord = housing.getZCoord() + world.rand.nextInt(zCoord) - zCoord / 2; + + boolean success = false; + Block block = Block.blocksList[world.getBlockId(xCoord, yCoord, zCoord)]; + if (block != null) + { + ItemStack source = new ItemStack(block, 1, world.getBlockMetadata(xCoord, yCoord, zCoord)); + for (ItemStack key : crumbleMap.keySet()) + { + if (OreDictionary.itemMatches(source, key, false)) + { + ItemStack target = crumbleMap.get(key); + world.setBlock(xCoord, yCoord, zCoord, target.itemID, target.getItemDamage(), 2); + + break; + } + } + } + + storedData.setInteger(0, 0); + + return storedData; + } + +} diff --git a/magicbees_src/magicbees/bees/AlleleEffectTransmuting.java b/magicbees_src/magicbees/bees/AlleleEffectTransmuting.java new file mode 100644 index 0000000..346a1df --- /dev/null +++ b/magicbees_src/magicbees/bees/AlleleEffectTransmuting.java @@ -0,0 +1,118 @@ +package magicbees.bees; + +import java.util.Locale; + +import cpw.mods.fml.common.registry.GameRegistry; + +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraftforge.common.BiomeDictionary; +import net.minecraftforge.oredict.OreDictionary; +import forestry.api.apiculture.IBeeGenome; +import forestry.api.apiculture.IBeeHousing; +import forestry.api.genetics.IEffectData; + +public class AlleleEffectTransmuting extends AlleleEffect +{ + public AlleleEffectTransmuting(String id, boolean isDominant) + { + super(id, isDominant, 200); + } + + @Override + public IEffectData validateStorage(IEffectData storedData) + { + if (storedData == null || !(storedData instanceof magicbees.bees.EffectData)) + { + storedData = new magicbees.bees.EffectData(1, 0, 0); + } + return storedData; + } + + @Override + protected IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) + { + World world = housing.getWorld(); + // Get random coords within territory + int xCoord = (int)(housing.getTerritoryModifier(genome, 1f) * genome.getTerritory()[0]); + xCoord = housing.getXCoord() + world.rand.nextInt(xCoord) - xCoord / 2; + int yCoord = (int)(housing.getTerritoryModifier(genome, 1f) * genome.getTerritory()[1]); + yCoord = housing.getYCoord() + world.rand.nextInt(yCoord) - yCoord / 2; + int zCoord = (int)(housing.getTerritoryModifier(genome, 1f) * genome.getTerritory()[0]); + zCoord = housing.getZCoord() + world.rand.nextInt(zCoord) - zCoord / 2; + + // Check if == stone + boolean doTransmute = false; + Block block = Block.blocksList[world.getBlockId(xCoord, yCoord, zCoord)]; + if (block == null || block == Block.stone || block == Block.cobblestone) + { + doTransmute = true; + } + else if (block != null) + { + ItemStack cobbleItem = new ItemStack(Block.cobblestone); + ItemStack stoneItem = new ItemStack(Block.stone); + ItemStack testItem = new ItemStack(block); + doTransmute = OreDictionary.itemMatches(cobbleItem, testItem, false) || OreDictionary.itemMatches(stoneItem, cobbleItem, false); + } + + // Transmute to something. + if (doTransmute) + { + BiomeGenBase biome = world.getBiomeGenForCoords(xCoord, zCoord); + // Gogo shortcutting logic operators! + boolean tryThis = trySpawnAbyssalStone(world, biome, xCoord, yCoord, zCoord) || + trySpawnQuarriedStone(world, biome, xCoord, yCoord, zCoord) || + trySpawnSandstone(world, biome, xCoord, yCoord, zCoord); + } + storedData.setInteger(0, 0); + + return storedData; + } + + private boolean trySpawnQuarriedStone(World world, BiomeGenBase biome, int x, int y, int z) + { + boolean flag = false; + if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.FOREST) && + !BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.FROZEN)) + { + ItemStack item = GameRegistry.findItemStack("Railcraft", "stone.abyssal", 1); + if (item != null) + { + world.setBlock(x, y, z, item.itemID, item.getItemDamage(), 2); + flag = true; + } + } + return flag; + } + + private boolean trySpawnAbyssalStone(World world, BiomeGenBase biome, int x, int y, int z) + { + boolean flag = false; + if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.WATER) && + biome.biomeName.toLowerCase(Locale.ENGLISH).contains("river")) + { + ItemStack item = GameRegistry.findItemStack("Railcraft", "stone.quarried", 1); + if (item != null) + { + world.setBlock(x, y, z, item.itemID, item.getItemDamage(), 2); + flag = true; + } + } + return flag; + } + + private boolean trySpawnSandstone(World world, BiomeGenBase biome, int x, int y, int z) + { + boolean flag = false; + if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.DESERT)) + { + world.setBlock(x, y, z, Block.sandStone.blockID); + flag = true; + } + return flag; + } + +} diff --git a/magicbees_src/magicbees/bees/BeeClassification.java b/magicbees_src/magicbees/bees/BeeClassification.java index fa4cf8a..0e61eb8 100644 --- a/magicbees_src/magicbees/bees/BeeClassification.java +++ b/magicbees_src/magicbees/bees/BeeClassification.java @@ -27,6 +27,7 @@ public enum BeeClassification implements IClassification METALLIC("Metallic", "Metalliapis"), GEM("Gem", "Lapidapis"), + TRANSMUTING("Transmuting", "Transmutapis"), THAUMIC("Thaumic", "Thaumiapis"), FLESHY("Fleshy", "Carnosapis"), diff --git a/magicbees_src/magicbees/bees/BeeGenomeManager.java b/magicbees_src/magicbees/bees/BeeGenomeManager.java index 847cb6e..fff0efc 100644 --- a/magicbees_src/magicbees/bees/BeeGenomeManager.java +++ b/magicbees_src/magicbees/bees/BeeGenomeManager.java @@ -718,6 +718,46 @@ public class BeeGenomeManager return genome; } + public static IAllele[] getTemplateMutableBase() + { + IAllele[] genome = getTemplateModBase(); + + genome[EnumBeeChromosome.LIFESPAN.ordinal()] = Allele.getBaseAllele("lifespanShortest"); + genome[EnumBeeChromosome.HUMIDITY_TOLERANCE.ordinal()] = Allele.getBaseAllele("toleranceUp1"); + genome[EnumBeeChromosome.TEMPERATURE_TOLERANCE.ordinal()] = Allele.getBaseAllele("toleranceDown2"); + + return genome; + } + + public static IAllele[] getTemplateMutable() + { + IAllele[] genome = getTemplateMutableBase(); + + genome[EnumBeeChromosome.SPECIES.ordinal()] = BeeSpecies.MUTABLE; + + return genome; + } + + public static IAllele[] getTemplateTransmuting() + { + IAllele[] genome = getTemplateMutableBase(); + + genome[EnumBeeChromosome.SPECIES.ordinal()] = BeeSpecies.TRANSMUTING; + genome[EnumBeeChromosome.EFFECT.ordinal()] = Allele.effectTransmuting; + + return genome; + } + + public static IAllele[] getTemplateCrumbling() + { + IAllele[] genome = getTemplateMutableBase(); + + genome[EnumBeeChromosome.SPECIES.ordinal()] = BeeSpecies.CRUMBLING; + genome[EnumBeeChromosome.EFFECT.ordinal()] = Allele.effectCrumbling; + + return genome; + } + private static IAllele[] getTemplateTCBase() { IAllele[] genome = getTemplateModBase(); diff --git a/magicbees_src/magicbees/bees/BeeMutation.java b/magicbees_src/magicbees/bees/BeeMutation.java index 9eaedd2..d76ef4a 100644 --- a/magicbees_src/magicbees/bees/BeeMutation.java +++ b/magicbees_src/magicbees/bees/BeeMutation.java @@ -116,6 +116,10 @@ public class BeeMutation implements IBeeMutation new BeeMutation(Allele.getBaseSpecies("Imperial"), BeeSpecies.ABANDONED, BeeSpecies.DRACONIC, 6) .setBiomeRequired(BiomeDictionary.Type.END); + new BeeMutation(BeeSpecies.UNUSUAL, BeeSpecies.ELDRITCH, BeeSpecies.MUTABLE, 12); + new BeeMutation(BeeSpecies.UNUSUAL, BeeSpecies.MUTABLE, BeeSpecies.TRANSMUTING, 9); + new BeeMutation(BeeSpecies.UNUSUAL, BeeSpecies.MUTABLE, BeeSpecies.CRUMBLING, 9); + if (BeeSpecies.COPPER.isActive()) { new BeeMutation(Allele.getBaseSpecies("Industrious"), Allele.getBaseSpecies("Meadows"), BeeSpecies.COPPER, 12) @@ -252,7 +256,7 @@ public class BeeMutation implements IBeeMutation if (EquivalentExchangeHelper.isActive()) { - new BeeMutation(Allele.getBaseSpecies("Frugal"), BeeSpecies.ELDRITCH, BeeSpecies.EE_MINIUM, 8); + new BeeMutation(Allele.getBaseSpecies("Frugal"), BeeSpecies.MUTABLE, BeeSpecies.EE_MINIUM, 8); } } diff --git a/magicbees_src/magicbees/bees/BeeSpecies.java b/magicbees_src/magicbees/bees/BeeSpecies.java index 41fc5e5..0a5f7b9 100644 --- a/magicbees_src/magicbees/bees/BeeSpecies.java +++ b/magicbees_src/magicbees/bees/BeeSpecies.java @@ -159,6 +159,13 @@ public enum BeeSpecies implements IAlleleBeeSpecies, IIconProvider BeeClassification.GEM, 0x005300, 0x17DD62, EnumTemperature.NORMAL, EnumHumidity.NORMAL, true, false), APATITE("Apatite", "apatite", BeeClassification.GEM, 0x2EA7EC, 0x001D51, EnumTemperature.NORMAL, EnumHumidity.NORMAL, false, false), + + MUTABLE("Mutable", "mutable", + BeeClassification.TRANSMUTING, 0xDBB24C, 0xE0D5A6, EnumTemperature.NORMAL, EnumHumidity.NORMAL, false, false), + TRANSMUTING("Transmuting", "transmuting", + BeeClassification.TRANSMUTING, 0xDBB24C, 0xA2D2D8, EnumTemperature.NORMAL, EnumHumidity.NORMAL, false, false), + CRUMBLING("Crumbling", "crumbling", + BeeClassification.TRANSMUTING, 0xDBB24C, 0xDBA4A4, EnumTemperature.HOT, EnumHumidity.ARID, false, false), // --------- Thaumcraft Bees --------------------------------------------------------------------------------------- TC_STARK("TCStark", "torridae", // Stark @@ -577,6 +584,19 @@ public enum BeeSpecies implements IAlleleBeeSpecies, IIconProvider .setGenome(BeeGenomeManager.getTemplateApatite()) .register(); + MUTABLE.addProduct(new ItemStack(Config.fBeeComb, 1, ForestryHelper.Comb.PARCHED.ordinal()), 30) + .setGenome(BeeGenomeManager.getTemplateMutable()) + .register(); + TRANSMUTING.addProduct(new ItemStack(Config.fBeeComb, 1, ForestryHelper.Comb.PARCHED.ordinal()), 10) + .addProduct(new ItemStack(Config.fBeeComb, 1, ForestryHelper.Comb.SILKY.ordinal()), 10) + .addProduct(new ItemStack(Config.fBeeComb, 1, ForestryHelper.Comb.SIMMERING.ordinal()), 10) + .setGenome(BeeGenomeManager.getTemplateTransmuting()) + .register(); + CRUMBLING.addProduct(new ItemStack(Config.fBeeComb, 1, ForestryHelper.Comb.POWDERY.ordinal()), 20) + .addProduct(new ItemStack(Config.fBeeComb, 1 , ForestryHelper.Comb.COCOA.ordinal()), 20) + .setGenome(BeeGenomeManager.getTemplateCrumbling()) + .register(); + TC_STARK.addProduct(Config.combs.getStackForType(CombType.HARMONIZING), 10) .setGenome(BeeGenomeManager.getTemplateTCStark()) diff --git a/magicbees_src/magicbees/client/render/BeeRenderEffect.java b/magicbees_src/magicbees/client/render/BeeRenderEffect.java index 1d2fa46..88abf99 100644 --- a/magicbees_src/magicbees/client/render/BeeRenderEffect.java +++ b/magicbees_src/magicbees/client/render/BeeRenderEffect.java @@ -18,7 +18,7 @@ import net.minecraftforge.client.ForgeHooksClient; public class BeeRenderEffect extends EntityFX { public int blendmode = 1; - private static String texture = "/mods/forestry/textures/items/particles/swarm_bee"; + private static String texture = "forestry:textures/items/particles/swarm_bee.png"; public BeeRenderEffect(World world, double x, double y, double z, float motionScaleX, float motionScaleY, float motionScaleZ, int color) { From 61e6b82bc372c648b44bf3df53e1cc06be036a27 Mon Sep 17 00:00:00 2001 From: MysteriousAges Date: Wed, 28 Aug 2013 23:44:38 -0700 Subject: [PATCH 3/4] Mutations for Crumbling & Mutable. --- magicbees_res/build.xml | 2 +- magicbees_src/magicbees/bees/BeeMutation.java | 2 +- magicbees_src/magicbees/bees/BeeSpecies.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/magicbees_res/build.xml b/magicbees_res/build.xml index c37206a..77b404a 100644 --- a/magicbees_res/build.xml +++ b/magicbees_res/build.xml @@ -16,7 +16,7 @@ - + diff --git a/magicbees_src/magicbees/bees/BeeMutation.java b/magicbees_src/magicbees/bees/BeeMutation.java index d76ef4a..b315704 100644 --- a/magicbees_src/magicbees/bees/BeeMutation.java +++ b/magicbees_src/magicbees/bees/BeeMutation.java @@ -117,7 +117,7 @@ public class BeeMutation implements IBeeMutation .setBiomeRequired(BiomeDictionary.Type.END); new BeeMutation(BeeSpecies.UNUSUAL, BeeSpecies.ELDRITCH, BeeSpecies.MUTABLE, 12); - new BeeMutation(BeeSpecies.UNUSUAL, BeeSpecies.MUTABLE, BeeSpecies.TRANSMUTING, 9); + //new BeeMutation(BeeSpecies.UNUSUAL, BeeSpecies.MUTABLE, BeeSpecies.TRANSMUTING, 9); new BeeMutation(BeeSpecies.UNUSUAL, BeeSpecies.MUTABLE, BeeSpecies.CRUMBLING, 9); if (BeeSpecies.COPPER.isActive()) diff --git a/magicbees_src/magicbees/bees/BeeSpecies.java b/magicbees_src/magicbees/bees/BeeSpecies.java index 0a5f7b9..6c1dbe6 100644 --- a/magicbees_src/magicbees/bees/BeeSpecies.java +++ b/magicbees_src/magicbees/bees/BeeSpecies.java @@ -591,7 +591,7 @@ public enum BeeSpecies implements IAlleleBeeSpecies, IIconProvider .addProduct(new ItemStack(Config.fBeeComb, 1, ForestryHelper.Comb.SILKY.ordinal()), 10) .addProduct(new ItemStack(Config.fBeeComb, 1, ForestryHelper.Comb.SIMMERING.ordinal()), 10) .setGenome(BeeGenomeManager.getTemplateTransmuting()) - .register(); + ;//.register(); CRUMBLING.addProduct(new ItemStack(Config.fBeeComb, 1, ForestryHelper.Comb.POWDERY.ordinal()), 20) .addProduct(new ItemStack(Config.fBeeComb, 1 , ForestryHelper.Comb.COCOA.ordinal()), 20) .setGenome(BeeGenomeManager.getTemplateCrumbling()) From 5090aa76ea4f6d2d1e9b1a71cd28214ad657e609 Mon Sep 17 00:00:00 2001 From: MysteriousAges Date: Mon, 2 Sep 2013 17:32:59 -0700 Subject: [PATCH 4/4] Stuff! (It's in the changelogs.) --- magicbees_res/changelog.txt | 7 +- magicbees_src/magicbees/bees/Allele.java | 8 +- .../magicbees/bees/AlleleEffect.java | 11 +- .../magicbees/bees/AlleleEffectCrumbling.java | 35 ++++-- .../bees/AlleleEffectTransmuting.java | 2 +- .../magicbees/bees/BeeGenomeManager.java | 2 +- .../client/render/BeeRenderEffect.java | 104 ------------------ magicbees_src/magicbees/main/ClientProxy.java | 37 +------ magicbees_src/magicbees/main/CommonProxy.java | 12 -- magicbees_src/magicbees/main/MagicBees.java | 8 ++ .../magicbees/main/utils/IMCManager.java | 64 +++++++++++ 11 files changed, 116 insertions(+), 174 deletions(-) delete mode 100644 magicbees_src/magicbees/client/render/BeeRenderEffect.java create mode 100644 magicbees_src/magicbees/main/utils/IMCManager.java diff --git a/magicbees_res/changelog.txt b/magicbees_res/changelog.txt index 4ada2c9..509cef0 100644 --- a/magicbees_res/changelog.txt +++ b/magicbees_res/changelog.txt @@ -1,7 +1,12 @@ 2.1.3 Added a new mini bee branch: Polymorphic. It is said Unusual bees can have some unusual effects on the world if they are advanced... +Altered mutation to get Minium bees to fit into the Polymorphic branch. Crumbling effect ages the area around the hive. -Transmutation effect will turn blocks into other blocks. (It's still a bit rough though.) +Added an IMC Handler to allow other mods to send an IMC message with key 'addCrumblePair" and a value containing two NBT tags + 'source' and 'target' for ItemStacks of the source block and target block. Blocks added on a first-come-first-serve basis. + Only one entry per source block is accepted. Several vanilla defaults are provided, can be overridden using IMC. +Changing humidity tolerance of Sorcerous bees to be actually useful. +Fixed issues with the bee effects rendering (the little bee icons that shoot out of the bee machine while they work) for custom effects. 2.1.2 Fixed issue with mob spawning effects incorrectly checking for effect data variables. diff --git a/magicbees_src/magicbees/bees/Allele.java b/magicbees_src/magicbees/bees/Allele.java index cf0a904..fc373fe 100644 --- a/magicbees_src/magicbees/bees/Allele.java +++ b/magicbees_src/magicbees/bees/Allele.java @@ -4,8 +4,8 @@ import magicbees.main.utils.LocalizationManager; import magicbees.main.utils.compat.ArsMagicaHelper; import magicbees.main.utils.compat.ThaumcraftHelper; import net.minecraft.potion.Potion; +import forestry.api.apiculture.IAlleleBeeEffect; import forestry.api.apiculture.IAlleleBeeSpecies; -import forestry.api.apiculture.IBeeRoot; import forestry.api.genetics.AlleleManager; import forestry.api.genetics.IAllele; import forestry.api.genetics.IAlleleEffect; @@ -16,6 +16,8 @@ public class Allele implements IAllele { public static AlleleFloat speedBlinding; + public static IAlleleBeeEffect forestryBaseEffect; + public static IAlleleFlowers flowerBookshelf; public static IAlleleFlowers flowerThaumcraft; public static IAlleleFlowers flowerArsMagica; @@ -44,7 +46,9 @@ public class Allele implements IAllele public static IAlleleEffect effectNodeCharge; public static void setupAdditionalAlleles() - { + { + forestryBaseEffect = (IAlleleBeeEffect)getBaseAllele("effectNone"); + Allele.speedBlinding = new AlleleFloat("speedBlinding", 2f, false); Allele.flowerBookshelf = new AlleleFlower("Bookshelf", new FlowerProviderBookshelf(), true); diff --git a/magicbees_src/magicbees/bees/AlleleEffect.java b/magicbees_src/magicbees/bees/AlleleEffect.java index c537acc..bbd5d5f 100644 --- a/magicbees_src/magicbees/bees/AlleleEffect.java +++ b/magicbees_src/magicbees/bees/AlleleEffect.java @@ -61,16 +61,7 @@ public abstract class AlleleEffect extends Allele implements IAlleleBeeEffect @Override public IEffectData doFX(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) { - int[] area = genome.getTerritory(); - float mod = housing.getTerritoryModifier(genome, 1f); - // Check to make sure territory is at least 1 with housing modifications - area[0] = Math.max((int)(area[0] * mod), 1); - area[1] = Math.max((int)(area[1] * mod), 1); - area[2] = Math.max((int)(area[2] * mod), 1); - - MagicBees.proxy.drawBeeEffects(housing.getWorld(), housing.getXCoord(), housing.getYCoord(), housing.getZCoord(), - genome.getPrimary().getIconColour(0), area[0], area[1], area[2]); - return storedData; + return Allele.forestryBaseEffect.doFX(genome, storedData, housing); } protected List getEntitiesWithinRange(IBeeGenome genome, IBeeHousing housing) diff --git a/magicbees_src/magicbees/bees/AlleleEffectCrumbling.java b/magicbees_src/magicbees/bees/AlleleEffectCrumbling.java index 496da02..37398d1 100644 --- a/magicbees_src/magicbees/bees/AlleleEffectCrumbling.java +++ b/magicbees_src/magicbees/bees/AlleleEffectCrumbling.java @@ -12,20 +12,35 @@ import forestry.api.genetics.IEffectData; public class AlleleEffectCrumbling extends AlleleEffect { - private HashMap crumbleMap; + private static HashMap crumbleMap = new HashMap(); + + public static void addPairToMap(ItemStack source, ItemStack target) + { + boolean add = true; + for (ItemStack i : crumbleMap.keySet()) + { + if (OreDictionary.itemMatches(i, source, false)) + { + add = false; + break; + } + } + if (add) + { + crumbleMap.put(source, target); + } + } public AlleleEffectCrumbling(String id, boolean isDominant) { - super(id, isDominant, 200); + super(id, isDominant, 600); - crumbleMap = new HashMap(); - - crumbleMap.put(new ItemStack(Block.stone), new ItemStack(Block.cobblestone)); - crumbleMap.put(new ItemStack(Block.cobblestone), new ItemStack(Block.cobblestoneMossy)); - crumbleMap.put(new ItemStack(Block.stoneBrick, 1, 0), new ItemStack(Block.stoneBrick, 1, 2)); - crumbleMap.put(new ItemStack(Block.stoneBrick, 1, 2), new ItemStack(Block.stoneBrick, 1, 1)); - crumbleMap.put(new ItemStack(Block.cobblestoneWall), new ItemStack(Block.cobblestoneWall, 1, 1)); - crumbleMap.put(new ItemStack(Block.gravel), new ItemStack(Block.sand)); + addPairToMap(new ItemStack(Block.stone), new ItemStack(Block.cobblestone)); + addPairToMap(new ItemStack(Block.cobblestone), new ItemStack(Block.cobblestoneMossy)); + addPairToMap(new ItemStack(Block.stoneBrick, 1, 0), new ItemStack(Block.stoneBrick, 1, 2)); + addPairToMap(new ItemStack(Block.stoneBrick, 1, 2), new ItemStack(Block.stoneBrick, 1, 1)); + addPairToMap(new ItemStack(Block.cobblestoneWall), new ItemStack(Block.cobblestoneWall, 1, 1)); + addPairToMap(new ItemStack(Block.gravel), new ItemStack(Block.sand)); } @Override diff --git a/magicbees_src/magicbees/bees/AlleleEffectTransmuting.java b/magicbees_src/magicbees/bees/AlleleEffectTransmuting.java index 346a1df..7666368 100644 --- a/magicbees_src/magicbees/bees/AlleleEffectTransmuting.java +++ b/magicbees_src/magicbees/bees/AlleleEffectTransmuting.java @@ -18,7 +18,7 @@ public class AlleleEffectTransmuting extends AlleleEffect { public AlleleEffectTransmuting(String id, boolean isDominant) { - super(id, isDominant, 200); + super(id, isDominant, 900); } @Override diff --git a/magicbees_src/magicbees/bees/BeeGenomeManager.java b/magicbees_src/magicbees/bees/BeeGenomeManager.java index fff0efc..805a154 100644 --- a/magicbees_src/magicbees/bees/BeeGenomeManager.java +++ b/magicbees_src/magicbees/bees/BeeGenomeManager.java @@ -62,7 +62,7 @@ public class BeeGenomeManager genome[EnumBeeChromosome.SPECIES.ordinal()] = BeeSpecies.SORCEROUS; genome[EnumBeeChromosome.FERTILITY.ordinal()] = Allele.getBaseAllele("fertilityHigh"); genome[EnumBeeChromosome.TEMPERATURE_TOLERANCE.ordinal()] = Allele.getBaseAllele("toleranceDown2"); - genome[EnumBeeChromosome.HUMIDITY_TOLERANCE.ordinal()] = Allele.getBaseAllele("toleranceDown1"); + genome[EnumBeeChromosome.HUMIDITY_TOLERANCE.ordinal()] = Allele.getBaseAllele("toleranceUp1"); return genome; } diff --git a/magicbees_src/magicbees/client/render/BeeRenderEffect.java b/magicbees_src/magicbees/client/render/BeeRenderEffect.java deleted file mode 100644 index 88abf99..0000000 --- a/magicbees_src/magicbees/client/render/BeeRenderEffect.java +++ /dev/null @@ -1,104 +0,0 @@ -package magicbees.client.render; - -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.client.FMLClientHandler; - - -import magicbees.main.CommonProxy; -import magicbees.main.MagicBees; -import net.minecraft.client.particle.EntityFX; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.world.World; -import net.minecraftforge.client.ForgeHooksClient; - -/** - * Borrowed from Forestry with some modifications. - */ -public class BeeRenderEffect extends EntityFX -{ - public int blendmode = 1; - private static String texture = "forestry:textures/items/particles/swarm_bee.png"; - - public BeeRenderEffect(World world, double x, double y, double z, float motionScaleX, float motionScaleY, float motionScaleZ, int color) - { - - super(world, x, y, z, 0.0D, 0.0D, 0.0D); - - // Colour is stored in 4-byte int: XXRRGGBB - particleRed = (color >> 16 & 255) / 255.0F; - particleGreen = (color >> 8 & 255) / 255.0F; - particleBlue = (color & 255) / 255.0F; - - this.setParticleTextureIndex(0); - this.setSize(0.1F, 0.1F); - this.particleScale *= 0.2F; - this.particleMaxAge = (int) (20.0D / (Math.random() * 0.8D + 0.2D)); - this.noClip = true; - - this.motionX *= 0.119999999552965164D; - this.motionY *= 0.119999999552965164D; - this.motionZ *= 0.119999999552965164D; - - } - - /** - * Called to update the entity's position/logic. - */ - public void onUpdate() - { - - this.prevPosX = this.posX; - this.prevPosY = this.posY; - this.prevPosZ = this.posZ; - this.moveEntity(this.motionX, this.motionY, this.motionZ); - this.motionX *= 1.08D; - this.motionY *= 1.08D; - this.motionZ *= 1.08D; - - if (this.particleMaxAge-- <= 0) - { - this.setDead(); - } - } - - public void renderParticle(Tessellator tessellator, float f, float f1, float f2, float f3, float f4, float f5) - { - - tessellator.draw(); - GL11.glPushMatrix(); - - GL11.glDepthMask(false); - GL11.glEnable(3042); - GL11.glBlendFunc(770, blendmode); - - FMLClientHandler.instance().getClient().renderEngine.bindTexture(texture); - - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - - float f10 = 0.1F * particleScale; - float f11 = (float) ((prevPosX + (posX - prevPosX) * f) - interpPosX); - float f12 = (float) ((prevPosY + (posY - prevPosY) * f) - interpPosY); - float f13 = (float) ((prevPosZ + (posZ - prevPosZ) * f) - interpPosZ); - - // GL11.glRotatef(this.rand.nextFloat(), 0.0F, 1.0F, 0.0F); - tessellator.startDrawingQuads(); - tessellator.setBrightness(0x0000f0); - - tessellator.setColorRGBA_F(particleRed, particleGreen, particleBlue, 1.0F); - tessellator.addVertexWithUV(f11 - f1 * f10 - f4 * f10, f12 - f2 * f10, f13 - f3 * f10 - f5 * f10, 0, 1); - tessellator.addVertexWithUV((f11 - f1 * f10) + f4 * f10, f12 + f2 * f10, (f13 - f3 * f10) + f5 * f10, 1, 1); - tessellator.addVertexWithUV(f11 + f1 * f10 + f4 * f10, f12 + f2 * f10, f13 + f3 * f10 + f5 * f10, 1, 0); - tessellator.addVertexWithUV((f11 + f1 * f10) - f4 * f10, f12 - f2 * f10, (f13 + f3 * f10) - f5 * f10, 0, 0); - - tessellator.draw(); - - GL11.glDisable(3042); - GL11.glDepthMask(true); - - GL11.glPopMatrix(); - GL11.glBindTexture(3553 /* GL_TEXTURE_2D *//* GL_TEXTURE_2D */, MagicBees.proxy.getClientInstance().renderEngine.getTexture("/particles.png")); - tessellator.startDrawingQuads(); - } - -} diff --git a/magicbees_src/magicbees/main/ClientProxy.java b/magicbees_src/magicbees/main/ClientProxy.java index 9d8cc81..6c7a630 100644 --- a/magicbees_src/magicbees/main/ClientProxy.java +++ b/magicbees_src/magicbees/main/ClientProxy.java @@ -1,22 +1,20 @@ package magicbees.main; -import magicbees.client.render.BeeRenderEffect; import magicbees.client.render.EffectJarRenderer; import magicbees.tileentity.TileEntityEffectJar; +import net.minecraft.client.Minecraft; +import net.minecraft.client.particle.EntityFX; import net.minecraft.world.World; import net.minecraftforge.client.MinecraftForgeClient; import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import forestry.core.render.TextureManager; @SideOnly(Side.CLIENT) public class ClientProxy extends CommonProxy -{ - - public ClientProxy() { } - - @Override +{ @Override public void registerRenderers() { super.registerRenderers(); @@ -25,31 +23,4 @@ public class ClientProxy extends CommonProxy MinecraftForgeClient.registerItemRenderer(Config.effectJar.blockID, EffectJarRenderer.instance); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityEffectJar.class, EffectJarRenderer.instance); } - - @Override - public void drawBeeEffects(World world, double xPos, double yPos, double zPos, int colour, int rangeX, int rangeY, int rangeZ) - { - // drawParticleEffects flag pulled from Forestry after configs - if (MagicBees.getConfig().DrawParticleEffects) - { - double spawnX; - double spawnY; - double spawnZ; - - if (world.rand.nextBoolean()) - { - spawnX = xPos + 0.5; - spawnY = yPos + 0.75; - spawnZ = zPos + 0.5; - } - else - { - spawnX = xPos + world.rand.nextInt(rangeX * 2) - rangeX; - spawnY = yPos + world.rand.nextInt(rangeY); - spawnZ = zPos + world.rand.nextInt(rangeZ * 2) - rangeZ; - } - - this.getClientInstance().effectRenderer.addEffect(new BeeRenderEffect(world, spawnX, spawnY, spawnZ, 0f, 0f, 0f, colour)); - } - } } diff --git a/magicbees_src/magicbees/main/CommonProxy.java b/magicbees_src/magicbees/main/CommonProxy.java index b8527b2..ece98d2 100644 --- a/magicbees_src/magicbees/main/CommonProxy.java +++ b/magicbees_src/magicbees/main/CommonProxy.java @@ -21,18 +21,6 @@ public class CommonProxy public static final String MODEL_TEXTURE_PATH = TEXTURE_PATH + "model/"; public static int RenderIdEffectJar; - - public CommonProxy() { } - - public void drawBeeEffects(World world, double xPos, double yPos, double zPos, int colour, int rangeX, int rangeY, int rangeZ) - { - // Does nothing in common. - } - - public Minecraft getClientInstance() - { - return FMLClientHandler.instance().getClient(); - } public void registerRenderers() { } diff --git a/magicbees_src/magicbees/main/MagicBees.java b/magicbees_src/magicbees/main/MagicBees.java index dd153b2..07590eb 100644 --- a/magicbees_src/magicbees/main/MagicBees.java +++ b/magicbees_src/magicbees/main/MagicBees.java @@ -4,6 +4,7 @@ import magicbees.bees.BeeManager; import magicbees.client.gui.GUIHandler; import magicbees.main.utils.CompatabilityManager; import magicbees.main.utils.CraftingManager; +import magicbees.main.utils.IMCManager; import magicbees.main.utils.LocalizationManager; import magicbees.main.utils.VersionInfo; import magicbees.main.utils.compat.ArsMagicaHelper; @@ -14,6 +15,7 @@ import magicbees.world.WorldGeneratorHandler; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; +import cpw.mods.fml.common.event.FMLInterModComms.IMCEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.network.NetworkMod; @@ -91,6 +93,12 @@ public class MagicBees VersionInfo.doVersionCheck(); } + @Mod.IMCCallback + public void handleIMCMessage(IMCEvent event) + { + IMCManager.handle(event); + } + public static Config getConfig() { return object.modConfig; diff --git a/magicbees_src/magicbees/main/utils/IMCManager.java b/magicbees_src/magicbees/main/utils/IMCManager.java new file mode 100644 index 0000000..bb80690 --- /dev/null +++ b/magicbees_src/magicbees/main/utils/IMCManager.java @@ -0,0 +1,64 @@ +package magicbees.main.utils; + +import magicbees.bees.AlleleEffectCrumbling; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTBase; +import net.minecraft.nbt.NBTTagCompound; +import cpw.mods.fml.common.FMLLog; +import cpw.mods.fml.common.event.FMLInterModComms.IMCEvent; +import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage; + +public class IMCManager +{ + public static void handle(IMCEvent event) + { + for (IMCMessage message : event.getMessages()) + { + try + { + if (message.key.equals("addCrumblePair")) + { + handleCrumbleBlock(message); + } + else + { + FMLLog.warning("Magic Bees recieved an IMC Message from a mod %s " + + "but does not support messages keyed with %s.", + message.getSender(), message.key); + } + } + catch (Exception e) + { + FMLLog.warning("Magic Bees recieved an invalid IMC Message from a mod %s! Please inform " + + "the author of %s that they may not be correctly implementing message for key '%s'. Error details follow.", + message.getSender(), message.key); + FMLLog.info(e.getMessage()); + } + } + } + + private static void handleCrumbleBlock(IMCMessage message) throws Exception + { + NBTTagCompound root = message.getNBTValue(); + NBTBase source = root.getTag("source"); + NBTBase target = root.getTag("target"); + + if (source != null && source instanceof NBTTagCompound) + { + ItemStack sourceItem = ItemStack.loadItemStackFromNBT((NBTTagCompound)source); + if (target instanceof NBTTagCompound) + { + ItemStack targetItem = ItemStack.loadItemStackFromNBT((NBTTagCompound)target); + AlleleEffectCrumbling.addPairToMap(sourceItem, targetItem); + } + else + { + throw new Exception("Required tag 'target' was either empty, or not a valid ItemStack."); + } + } + else + { + throw new Exception("Required tag 'source' was either empty, or not a valid ItemStack."); + } + } +}