diff --git a/gradle.properties b/gradle.properties index 642a9fd..8694e87 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ version_major=2 -version_minor=1 -version_rev=24 +version_minor=2 +version_rev=0 version_forestry=3.4.0.7 version_bloodmagic=1.3.1-7 diff --git a/src/main/java/magicbees/main/utils/CraftingManager.java b/src/main/java/magicbees/main/utils/CraftingManager.java index aec19fd..07165d6 100644 --- a/src/main/java/magicbees/main/utils/CraftingManager.java +++ b/src/main/java/magicbees/main/utils/CraftingManager.java @@ -378,15 +378,6 @@ public class CraftingManager 'C', Blocks.chest }); } - - output = new ItemStack(Config.visAuraProvider); - GameRegistry.addRecipe(output, new Object[] { - "ngn", "gvg", "npn", - 'n', Items.gold_nugget, - 'g', new ItemStack(Config.tcWooden, 1, ThaumcraftHelper.WoodenDeviceType.PLANKS_GREATWOOD.ordinal()), - 'v', new ItemStack(Config.tcMetal, 1, ThaumcraftHelper.MetalDeviceType.VIS_RELAY.ordinal()), - 'p', Config.pollen.getStackForType(PollenType.UNUSUAL) - }); } if (ArsMagicaHelper.isActive()) diff --git a/src/main/java/magicbees/main/utils/compat/ThaumcraftHelper.java b/src/main/java/magicbees/main/utils/compat/ThaumcraftHelper.java index 3dd321a..80a5761 100644 --- a/src/main/java/magicbees/main/utils/compat/ThaumcraftHelper.java +++ b/src/main/java/magicbees/main/utils/compat/ThaumcraftHelper.java @@ -191,6 +191,20 @@ public class ThaumcraftHelper { private static Object aspectTime; + private static Object frameMagic; + private static Object thaumScoop; + private static Object thaumGrafter; + private static Object singularityA; + private static Object singularityB; + private static Object essenceLife; + private static Object essenceDeath; + private static Object essenceArmor; + private static Object essenceUnstableA; + private static Object essenceUnstableB; + private static Object essenceTime; + private static Object essenceOblivion; + private static Object visAuraProvider; + private static void getBlocks() { Config.tcPlant = BlockInterface.getBlock(Name, "blockCustomPlant"); Config.tcCandle = BlockInterface.getBlock(Name, "blockCandle"); @@ -252,49 +266,36 @@ public class ThaumcraftHelper { output = new ItemStack(Config.tcShard, 1, ShardType.CHAOS.ordinal()); GameRegistry.addShapelessRecipe(output, input, input, input, input); - thaumScoop = ThaumcraftApi.addArcaneCraftingRecipe("MB_Scoop", - new ItemStack(Config.thaumiumScoop), + thaumScoop = ThaumcraftApi.addArcaneCraftingRecipe("MB_Scoop", new ItemStack(Config.thaumiumScoop), new AspectList().add(Aspect.ORDER, 2), new Object[] { - "sWs", - "sTs", - " T ", - 's', - Items.stick, - 'W', - Blocks.wool, - 'T', - new ItemStack(Config.tcMiscResource, 1, - MiscResource.THAUMIUM.ordinal()) }); + "sWs", "sTs", " T ", + 's', Items.stick, + 'W', Blocks.wool, + 'T', new ItemStack(Config.tcMiscResource, 1, MiscResource.THAUMIUM.ordinal()) }); thaumGrafter = ThaumcraftApi.addArcaneCraftingRecipe("MB_Grafter", new ItemStack(Config.thaumiumGrafter), new AspectList().add(Aspect.ORDER, 5), new Object[] { - " T", - " s ", - "s ", - 's', - Items.stick, - 'T', - new ItemStack(Config.tcMiscResource, 1, - MiscResource.THAUMIUM.ordinal()) }); + " T", " s ", "s ", + 's', Items.stick, + 'T', new ItemStack(Config.tcMiscResource, 1, MiscResource.THAUMIUM.ordinal()) }); - frameMagic = ThaumcraftApi.addArcaneCraftingRecipe( - "MB_FrameMagic", - new ItemStack(Config.hiveFrameMagic), - new AspectList().add(Aspect.ORDER, 5).add(Aspect.AIR, 2) - .add(Aspect.EARTH, 2), new Object[] { - "sss", - "sCs", - "sss", - 's', - Items.stick, - 'C', - new ItemStack(Config.tcMiscResource, 1, - MiscResource.ENCHANTED_FABRIC.ordinal()) }); + frameMagic = ThaumcraftApi.addArcaneCraftingRecipe("MB_FrameMagic", new ItemStack(Config.hiveFrameMagic), + new AspectList().add(Aspect.ORDER, 5).add(Aspect.AIR, 2).add(Aspect.EARTH, 2), new Object[] { + "sss", "sCs", "sss", + 's', Items.stick, + 'C', new ItemStack(Config.tcMiscResource, 1, MiscResource.ENCHANTED_FABRIC.ordinal()) }); + + visAuraProvider = ThaumcraftApi.addArcaneCraftingRecipe("MB_VisAuraProvider", new ItemStack(Config.visAuraProvider), + new AspectList().add(Aspect.ORDER, 60).add(Aspect.AIR, 60).add(Aspect.ENTROPY, 60).add(Aspect.WATER, 60), + new Object[] { + "ngn", "gvg", "npn", + 'n', Items.gold_nugget, + 'g', new ItemStack(Config.tcWooden, 1, ThaumcraftHelper.WoodenDeviceType.PLANKS_GREATWOOD.ordinal()), + 'v', new ItemStack(Config.tcMetal, 1, ThaumcraftHelper.MetalDeviceType.VIS_RELAY.ordinal()), + 'p', Config.pollen.getStackForType(PollenType.UNUSUAL)}); - essenceLife = ThaumcraftApi.addCrucibleRecipe("MB_EssenceLife", - Config.miscResources - .getStackForType(ResourceType.ESSENCE_FALSE_LIFE), + essenceLife = ThaumcraftApi.addCrucibleRecipe("MB_EssenceLife", Config.miscResources.getStackForType(ResourceType.ESSENCE_FALSE_LIFE), new ItemStack(Blocks.red_flower), new AspectList().add(Aspect.EXCHANGE, 4).add(Aspect.PLANT, 4)); @@ -304,86 +305,47 @@ public class ThaumcraftHelper { new ItemStack(Items.rotten_flesh), new AspectList().add(Aspect.DEATH, 4).add(Aspect.ENTROPY, 4)); - essenceArmor = ThaumcraftApi - .addCrucibleRecipe( - "MB_EssenceArmor", - Config.miscResources - .getStackForType(ResourceType.ESSENCE_EVERLASTING_DURABILITY), + essenceArmor = ThaumcraftApi.addCrucibleRecipe("MB_EssenceArmor", Config.miscResources.getStackForType(ResourceType.ESSENCE_EVERLASTING_DURABILITY), new ItemStack(Items.leather), - new AspectList().add(Aspect.ARMOR, 4).add(Aspect.MAGIC, - 2)); + new AspectList().add(Aspect.ARMOR, 4).add(Aspect.MAGIC, 2)); - output = Config.miscResources - .getStackForType(ResourceType.ESSENCE_FICKLE_PERMANENCE); - essenceUnstableA = ThaumcraftApi - .addCrucibleRecipe( - "MB_EssenceUnstable", - output, + output = Config.miscResources.getStackForType(ResourceType.ESSENCE_FICKLE_PERMANENCE); + essenceUnstableA = ThaumcraftApi.addCrucibleRecipe("MB_EssenceUnstable", output, Config.propolis.getStackForType(PropolisType.UNSTABLE), - new AspectList().add(Aspect.ENTROPY, 2).add( - Aspect.EXCHANGE, 1)); + new AspectList().add(Aspect.ENTROPY, 2).add(Aspect.EXCHANGE, 1)); - essenceUnstableB = ThaumcraftApi - .addCrucibleRecipe( - "MB_EssenceUnstable", - output, + essenceUnstableB = ThaumcraftApi.addCrucibleRecipe("MB_EssenceUnstable",output, new ItemStack(Blocks.netherrack), - new AspectList().add(Aspect.ENTROPY, 8).add( - Aspect.EXCHANGE, 5)); + new AspectList().add(Aspect.ENTROPY, 8).add(Aspect.EXCHANGE, 5)); - essenceTime = ThaumcraftApi.addCrucibleRecipe("MB_EssenceTime", - Config.miscResources - .getStackForType(ResourceType.ESSENCE_LOST_TIME), + essenceTime = ThaumcraftApi.addCrucibleRecipe("MB_EssenceTime", Config.miscResources.getStackForType(ResourceType.ESSENCE_LOST_TIME), new ItemStack(Items.clock), - new AspectList().add(Aspect.ORDER, 10).add(Aspect.VOID, 10) - .add(Aspect.TRAP, 4)); + new AspectList().add(Aspect.ORDER, 10).add(Aspect.VOID, 10).add(Aspect.TRAP, 4)); input = new ItemStack(Items.ender_pearl); - singularityA = ThaumcraftApi.addInfusionCraftingRecipe( - "MB_DimensionalSingularity", Config.miscResources - .getStackForType(ResourceType.DIMENSIONAL_SINGULARITY, - 3), 5, new AspectList() - .add(Aspect.ELDRITCH, 10).add(Aspect.EXCHANGE, 20), + singularityA = ThaumcraftApi.addInfusionCraftingRecipe("MB_DimensionalSingularity", + Config.miscResources.getStackForType(ResourceType.DIMENSIONAL_SINGULARITY,3), + 5, + new AspectList().add(Aspect.ELDRITCH, 10).add(Aspect.EXCHANGE, 20), new ItemStack(Blocks.gold_block), new ItemStack[] { input, input }); ItemStack in2 = new ItemStack(Items.diamond); - singularityB = ThaumcraftApi.addInfusionCraftingRecipe( - "MB_DimensionalSingularity", - Config.miscResources.getStackForType( - ResourceType.DIMENSIONAL_SINGULARITY, 3), + singularityB = ThaumcraftApi.addInfusionCraftingRecipe("MB_DimensionalSingularity", + Config.miscResources.getStackForType(ResourceType.DIMENSIONAL_SINGULARITY, 3), 6, - new AspectList().add(Aspect.ELDRITCH, 10) - .add(Aspect.EXCHANGE, 20).add(Aspect.VOID, 15), + new AspectList().add(Aspect.ELDRITCH, 10).add(Aspect.EXCHANGE, 20).add(Aspect.VOID, 15), Config.propolis.getStackForType(PropolisType.UNSTABLE), new ItemStack[] { input, input, in2 }); - essenceOblivion = ThaumcraftApi - .addShapelessArcaneCraftingRecipe( - "MB_EssenceOblivion", - Config.miscResources - .getStackForType(ResourceType.ESSENCE_SCORNFUL_OBLIVION), - new AspectList().add(Aspect.ENTROPY, 25) - .add(Aspect.AIR, 40).add(Aspect.ORDER, 15), - new Object[] { - Config.miscResources - .getStackForType(ResourceType.DIMENSIONAL_SINGULARITY), - Blocks.dragon_egg, }); + essenceOblivion = ThaumcraftApi.addShapelessArcaneCraftingRecipe("MB_EssenceOblivion", + Config.miscResources.getStackForType(ResourceType.ESSENCE_SCORNFUL_OBLIVION), + new AspectList().add(Aspect.ENTROPY, 25).add(Aspect.AIR, 40).add(Aspect.ORDER, 15), + new Object[] { + Config.miscResources.getStackForType(ResourceType.DIMENSIONAL_SINGULARITY), + Blocks.dragon_egg, }); } - private static Object frameMagic; - private static Object thaumScoop; - private static Object thaumGrafter; - private static Object singularityA; - private static Object singularityB; - private static Object essenceLife; - private static Object essenceDeath; - private static Object essenceArmor; - private static Object essenceUnstableA; - private static Object essenceUnstableB; - private static Object essenceTime; - private static Object essenceOblivion; - private static void setupResearch() { ArrayList list; @@ -413,7 +375,7 @@ public class ThaumcraftHelper { ResearchItem researchFragment = new ResearchItem("MB_LoreFragment", category, new AspectList(), - 0, -3, 0, + 0, -3, 1, Config.miscResources.getStackForType(ResourceType.LORE_FRAGMENT)) .setPages(getResearchPage("MB_LoreFragment.1"), new ResearchPage(recipe)).setParents("MB_Root") .setStub().setAutoUnlock().setRound().registerResearchItem(); @@ -426,15 +388,15 @@ public class ThaumcraftHelper { .setParentsHidden("THAUMIUM").registerResearchItem(); ResearchItem thaumiumGrafterR = new ResearchItem("MB_Grafter", category, - new AspectList().add(Aspect.TOOL, 2).add(Aspect.TREE, 1).add(Aspect.GREED, 1), - -2, -1, 4, + new AspectList().add(Aspect.TOOL, 1).add(Aspect.TREE, 1).add(Aspect.GREED, 1), + -2, -1, 2, new ItemStack(Config.thaumiumGrafter)) .setPages(getResearchPage("MB_Grafter.1"), new ResearchPage((IArcaneRecipe) thaumGrafter)) .setParents("MB_Scoop").registerResearchItem(); ResearchItem frameMagicR = new ResearchItem("MB_FrameMagic", category, - new AspectList().add(Aspect.TOOL, 2).add(Aspect.ARMOR, 1), - -2, 1, 2, + new AspectList().add(Aspect.TOOL, 1).add(Aspect.ARMOR, 1), + -2, 1, 1, new ItemStack(Config.hiveFrameMagic)) .setPages(getResearchPage("MB_FrameMagic"), new ResearchPage((IArcaneRecipe) frameMagic)) .registerResearchItem(); @@ -446,8 +408,8 @@ public class ThaumcraftHelper { recipe = new ShapelessRecipes(new ItemStack(Config.hiveFrameGentle), list); ResearchItem essenceFalseLifeR = new ResearchItem("MB_EssenceLife", category, - new AspectList().add(Aspect.LIFE, 2).add(Aspect.MAGIC, 1), - 2, -1, 2, + new AspectList().add(Aspect.LIFE, 1).add(Aspect.MAGIC, 1), + 2, -1, 1, Config.miscResources.getStackForType(ResourceType.ESSENCE_FALSE_LIFE)) .setPages(getResearchPage("MB_EssenceLife.1"), new ResearchPage((CrucibleRecipe) essenceLife), @@ -461,7 +423,7 @@ public class ThaumcraftHelper { ResearchItem essenceDurabilityR = new ResearchItem("MB_EssenceArmor", category, new AspectList().add(Aspect.ARMOR, 1).add(Aspect.MAGIC, 1), - 5, 0, 3, + 5, 0, 2, Config.miscResources.getStackForType(ResourceType.ESSENCE_EVERLASTING_DURABILITY)) .setPages(getResearchPage("MB_EssenceArmor.1"), new ResearchPage((CrucibleRecipe) essenceArmor), @@ -474,14 +436,16 @@ public class ThaumcraftHelper { recipe = new ShapelessRecipes(new ItemStack(Config.hiveFrameMetabolic), list); ResearchItem essenceUnstableR = new ResearchItem( "MB_EssenceUnstable", category, - new AspectList().add(Aspect.ENTROPY, 2).add(Aspect.ORDER, 1), - 3, 1, 4, + new AspectList().add(Aspect.ENTROPY, 1).add(Aspect.ORDER, 1), + 3, 1, 2, Config.miscResources.getStackForType(ResourceType.ESSENCE_FICKLE_PERMANENCE)) - .setPages(getResearchPage("MB_EssenceUnstable.1"), - new ResearchPage((CrucibleRecipe) essenceUnstableA), - new ResearchPage((CrucibleRecipe) essenceUnstableB), - new ResearchPage(recipe)).setParents("MB_EssenceLife") - .setConcealed().registerResearchItem(); + .setPages(getResearchPage("MB_EssenceUnstable.1"), + new ResearchPage((CrucibleRecipe) essenceUnstableA), + new ResearchPage((CrucibleRecipe) essenceUnstableB), + new ResearchPage(recipe)) + .setParents("MB_EssenceLife") + .setConcealed() + .registerResearchItem(); list = new ArrayList(2); list.add(Config.miscResources .getStackForType(ResourceType.ESSENCE_SHALLOW_GRAVE)); @@ -489,14 +453,15 @@ public class ThaumcraftHelper { recipe = new ShapelessRecipes(new ItemStack(Config.hiveFrameNecrotic), list); ResearchItem essenceShallowGraveR = new ResearchItem("MB_EssenceDeath", category, - new AspectList().add(Aspect.DEATH, 2).add(Aspect.MAGIC, 1), - 2, 3, 2, + new AspectList().add(Aspect.DEATH, 1).add(Aspect.MAGIC, 1), + 2, 3, 1, Config.miscResources .getStackForType(ResourceType.ESSENCE_SHALLOW_GRAVE)) - .setPages(getResearchPage("MB_EssenceDeath.1"), - new ResearchPage((CrucibleRecipe) essenceDeath), - new ResearchPage(recipe)) - .setParents("MB_EssenceUnstable").setConcealed() - .registerResearchItem(); + .setPages(getResearchPage("MB_EssenceDeath.1"), + new ResearchPage((CrucibleRecipe) essenceDeath), + new ResearchPage(recipe)) + .setParents("MB_EssenceUnstable") + .setConcealed() + .registerResearchItem(); list = new ArrayList(2); list.add(Config.miscResources.getStackForType(ResourceType.ESSENCE_LOST_TIME)); @@ -504,23 +469,26 @@ public class ThaumcraftHelper { recipe = new ShapelessRecipes(new ItemStack(Config.hiveFrameTemporal), list); ResearchItem essenceTimeR = new ResearchItem("MB_EssenceTime", category, - new AspectList().add((Aspect) aspectTime, 2).add(Aspect.MAGIC, 1), - 0, 2, 5, + new AspectList().add((Aspect) aspectTime, 1).add(Aspect.MAGIC, 1), + 0, 2, 2, Config.miscResources.getStackForType(ResourceType.ESSENCE_LOST_TIME)) .setPages(getResearchPage("MB_EssenceTime.1"), new ResearchPage((CrucibleRecipe) essenceTime), new ResearchPage(recipe)) - .setParents("MB_EssenceUnstable").setConcealed() + .setParents("MB_EssenceUnstable") + .setConcealed() .registerResearchItem(); ResearchItem singularityR = new ResearchItem("MB_DimensionalSingularity", category, - new AspectList().add(Aspect.ELDRITCH, 2).add((Aspect) aspectTime, 1).add(Aspect.VOID, 1), - -1, 4, 5, + new AspectList().add(Aspect.ELDRITCH, 1).add((Aspect) aspectTime, 1).add(Aspect.VOID, 1), + -1, 4, 3, Config.miscResources.getStackForType(ResourceType.DIMENSIONAL_SINGULARITY)) .setPages(getResearchPage("MB_DimensionalSingularity.1"), new ResearchPage((InfusionRecipe) singularityA), new ResearchPage((InfusionRecipe) singularityB)) - .setParents("MB_FrameMagic", "MB_EssenceTime", "MB_EssenceDeath").setConcealed().setSpecial() + .setParents("MB_FrameMagic", "MB_EssenceTime", "MB_EssenceDeath") + .setConcealed() + .setSpecial() .registerResearchItem(); list = new ArrayList(2); @@ -529,14 +497,23 @@ public class ThaumcraftHelper { recipe = new ShapelessRecipes(new ItemStack(Config.hiveFrameOblivion), list); ResearchItem essenceOblivionR = new ResearchItem("MB_EssenceOblivion", category, - new AspectList().add(Aspect.VOID, 2).add(Aspect.HUNGER, 1).add((Aspect) aspectTime, 1), - -3, 3, 5, + new AspectList().add(Aspect.VOID, 1).add(Aspect.HUNGER, 1).add((Aspect) aspectTime, 1), + -3, 3, 3, Config.miscResources.getStackForType(ResourceType.ESSENCE_SCORNFUL_OBLIVION)) .setPages(getResearchPage("MB_EssenceOblivion.1"), new ResearchPage((IArcaneRecipe) essenceOblivion), new ResearchPage(recipe)) .setParents("MB_DimensionalSingularity").setConcealed() .registerResearchItem(); + + ResearchItem visAuraProviderR = new ResearchItem("MB_VisAuraProvider", category, + new AspectList().add(Aspect.MAGIC, 1).add(Aspect.ENERGY, 1).add(Aspect.AURA, 1), + -5, 5, 3, + new ItemStack(Config.visAuraProvider)) + .setPages(getResearchPage("MB_VisAuraProvider.1"), + new ResearchPage((IArcaneRecipe) visAuraProvider)) + .setParentsHidden("NodeRelay") + .registerResearchItem(); } private static ResearchPage getResearchPage(String ident) { diff --git a/src/main/java/magicbees/tileentity/TileEntityMagicApiary.java b/src/main/java/magicbees/tileentity/TileEntityMagicApiary.java index 8ccd674..b4ebbd1 100644 --- a/src/main/java/magicbees/tileentity/TileEntityMagicApiary.java +++ b/src/main/java/magicbees/tileentity/TileEntityMagicApiary.java @@ -10,6 +10,7 @@ import magicbees.main.CommonProxy; import magicbees.main.MagicBees; import magicbees.main.utils.ChunkCoords; import magicbees.main.utils.ItemStackUtils; +import magicbees.main.utils.LogHelper; import magicbees.main.utils.net.NetworkEventHandler; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; @@ -54,7 +55,6 @@ public class TileEntityMagicApiary extends TileEntity implements ISidedInventory private static final int SLOT_PRODUCTS_COUNT = 7; private static final int AURAPROVIDER_SEARCH_RADIUS = 6; - private static int MAX_BLOCKS_SEARCH_PER_CHECK = (AURAPROVIDER_SEARCH_RADIUS * 2 + 1) * 8; private static int CHARGE_TIME_MUTATION = 850; private static int CHARGE_TIME_DEATH = 400; private static int CHARGE_TIME_PRODUCTION = 300; @@ -602,6 +602,7 @@ public class TileEntityMagicApiary extends TileEntity implements ISidedInventory else { updateAuraProvider(); } + tickCharges(); logic.update(); @@ -649,79 +650,80 @@ public class TileEntityMagicApiary extends TileEntity implements ISidedInventory public boolean isMutationBoosted() { return (flags & FLAG_MUTATIONCHARGE) == FLAG_MUTATIONCHARGE; } + + @Override + public void validate() { + super.validate(); + if (!worldObj.isRemote) { + NetworkEventHandler.getInstance().sendFlagsUpdate(this, new int[] {flags}); + } + } private void updateAuraProvider() { - if (worldObj.getTotalWorldTime() % 15 == 0 && locationHasAuraProvider(auraProviderPosition)) { - + if (worldObj.getTotalWorldTime() % 10 != 0) { + return; + } + if (!locationHasAuraProvider(auraProviderPosition)) { + this.auraProvider = null; + this.auraProviderPosition = null; + return; } int oldFlags = flags; - if (!isMutationBoosted()) { - if (this.auraProvider.getMutationCharge()) { - flags |= FLAG_MUTATIONCHARGE; - chargeTimestamps[OFFSET_MUTATION] = worldObj.getTotalWorldTime(); - } - } - else { - if (chargeTimestamps[OFFSET_MUTATION] + CHARGE_TIME_MUTATION <= worldObj.getTotalWorldTime()) { - if (!this.auraProvider.getMutationCharge()) { - flags = flags & ~FLAG_MUTATIONCHARGE; - } - } + if (!isMutationBoosted() && this.auraProvider.getMutationCharge()) { + flags |= FLAG_MUTATIONCHARGE; + chargeTimestamps[OFFSET_MUTATION] = worldObj.getTotalWorldTime(); } - if (!isDeathRateBoosted()) { - if (this.auraProvider.getDeathRateCharge()) { - flags |= FLAG_DEATHCHARGE; - chargeTimestamps[OFFSET_DEATH] = worldObj.getTotalWorldTime(); - } - } - else { - if (chargeTimestamps[OFFSET_DEATH] + CHARGE_TIME_DEATH <= worldObj.getTotalWorldTime()) { - if (!this.auraProvider.getDeathRateCharge()) { - flags = flags & ~FLAG_DEATHCHARGE; - } - } + if (!isDeathRateBoosted() && this.auraProvider.getDeathRateCharge()) { + flags |= FLAG_DEATHCHARGE; + chargeTimestamps[OFFSET_DEATH] = worldObj.getTotalWorldTime(); } - if (!isProductionBoosted()) { - if (this.auraProvider.getProductionCharge()) { - flags |= FLAG_PRODUCTIONCHARGE; - chargeTimestamps[OFFSET_PRODUCTION] = worldObj.getTotalWorldTime(); - } - } - else { - if (chargeTimestamps[OFFSET_PRODUCTION] + CHARGE_TIME_PRODUCTION <= worldObj.getTotalWorldTime()) { - if (!this.auraProvider.getProductionCharge()) { - flags = flags & ~FLAG_PRODUCTIONCHARGE; - } - } + if (!isProductionBoosted() && this.auraProvider.getProductionCharge()) { + flags |= FLAG_PRODUCTIONCHARGE; + chargeTimestamps[OFFSET_PRODUCTION] = worldObj.getTotalWorldTime(); } if (oldFlags != flags) { NetworkEventHandler.getInstance().sendFlagsUpdate(this, new int[] {flags}); } } + + private void tickCharges() { + int oldFlags = flags; + if (isMutationBoosted()) { + if (chargeTimestamps[OFFSET_MUTATION] + CHARGE_TIME_MUTATION <= worldObj.getTotalWorldTime()) { + if (auraProvider == null || !this.auraProvider.getMutationCharge()) { + flags = flags & ~FLAG_MUTATIONCHARGE; + } + } + } + if (isDeathRateBoosted()) { + if (chargeTimestamps[OFFSET_DEATH] + CHARGE_TIME_DEATH <= worldObj.getTotalWorldTime()) { + if (auraProvider == null || !this.auraProvider.getDeathRateCharge()) { + flags = flags & ~FLAG_DEATHCHARGE; + } + } + } + if (isProductionBoosted()) { + if (chargeTimestamps[OFFSET_PRODUCTION] + CHARGE_TIME_PRODUCTION <= worldObj.getTotalWorldTime()) { + if (auraProvider == null || !this.auraProvider.getProductionCharge()) { + flags = flags & ~FLAG_PRODUCTIONCHARGE; + } + } + } + if (oldFlags != flags) { + NetworkEventHandler.getInstance().sendFlagsUpdate(this, new int[] {flags}); + } + } private void findAuraProvider() { - if (worldObj.getTotalWorldTime() % 10 != 0) { + if (worldObj.getTotalWorldTime() % 5 != 0) { return; } - if (this.auraProviderPosition != null) { - // Will end up here after loading from save with a valid auraProvider. - if (locationHasAuraProvider(auraProviderPosition)) { - IMagicApiaryAuraProvider provider = (IMagicApiaryAuraProvider)(worldObj.getTileEntity(auraProviderPosition.x, - auraProviderPosition.y, - auraProviderPosition.x)); - if (provider == null) { - // ... well, it WAS here... - this.auraProviderPosition = null; - } - return; - } - } - else { + if (this.auraProviderPosition == null) { List chunks = getChunksInSearchRange(); for (Chunk chunk : chunks) { if (searchChunkForBooster(chunk)) { @@ -729,6 +731,11 @@ public class TileEntityMagicApiary extends TileEntity implements ISidedInventory } } } + else { + if (!locationHasAuraProvider(auraProviderPosition)) { + this.auraProviderPosition = null; + } + } } private List getChunksInSearchRange() { @@ -758,6 +765,8 @@ public class TileEntityMagicApiary extends TileEntity implements ISidedInventory Vec3 result = apiaryPos.subtract(tePos); if (result.lengthVector() <= AURAPROVIDER_SEARCH_RADIUS) { saveAuraProviderPosition(entity.xCoord, entity.yCoord, entity.zCoord); + this.auraProvider = (IMagicApiaryAuraProvider)entity; + return true; } } } diff --git a/src/main/resources/assets/magicbees/lang/en_US.lang b/src/main/resources/assets/magicbees/lang/en_US.lang index 20de959..e2a52d8 100644 --- a/src/main/resources/assets/magicbees/lang/en_US.lang +++ b/src/main/resources/assets/magicbees/lang/en_US.lang @@ -514,3 +514,7 @@ tc.research_page.MB_DimensionalSingularity.1=While it may appear similar to the tc.research_name.MB_EssenceOblivion=Essence of Scornful Oblivion tc.research_text.MB_EssenceOblivion=[MB] Cast aside with malice tc.research_page.MB_EssenceOblivion.1=Breeding bees for mutations can be aggrivating, especially whith long-lived species. With a little cleverness and only the slightest hint of smugness, you have found a way to utilize the Dimensional Singularity in a manner that only sucks away the life force of your tiny flying friends, bit by bit. Well, maybe significant amounts all at once. It's probably not going to affect them too badly.
It may be somewhat tricky to obtain more than one of the §5Dragon Eggs§0 nessecary to obtain more than one of these. Perhaps there is a bee species that can assist with the limitation. + +tc.research_name.MB_VisAuraProvider=Vis Apiary Booster +tc.research_text.MB_VisAuraProvider=[MB]Vis? What about Bis? +tc.research_page.MB_VisAuraProvider.1=Blah blah blah. \ No newline at end of file