mirror of
https://github.com/GTNewHorizons/MagicBees.git
synced 2026-11-20 12:20:03 +00:00
Added Botania Transmutation effect for Alfheim bees.
Refactored the Aura provider code to not depend on Thaumcraft & allow for other modes of providing aura to bees. Added Mana Apiary Booster. Added Botania lexicon integration for Alfheim bee, Mana apiary booster.
This commit is contained in:
1 parent
549433e445
commit
83f82decd8
20 files changed
+389
-84
No files matched your search
@@ -0,0 +1,8 @@
|
||||
package magicbees.api.bees;
|
||||
|
||||
public enum AuraChargeType {
|
||||
MUTATION,
|
||||
DEATH,
|
||||
PRODUCTION,
|
||||
;
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
package magicbees.api.bees;
|
||||
|
||||
public interface IAuraChargeType {
|
||||
}
|
||||
@@ -42,5 +42,5 @@ public interface IMagicApiaryAuraProvider {
|
||||
*
|
||||
* @return True if a charge is given; false otherwise.
|
||||
*/
|
||||
boolean getCharge(IAuraChargeType auraChargeType);
|
||||
boolean getCharge(AuraChargeType auraChargeType);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package magicbees.bees;
|
||||
|
||||
import magicbees.api.bees.AuraChargeType;
|
||||
|
||||
public enum AuraCharge {
|
||||
MUTATION(AuraChargeType.MUTATION, 850, 11),
|
||||
DEATH(AuraChargeType.DEATH, 400, 5),
|
||||
PRODUCTION(AuraChargeType.PRODUCTION, 300, 3),
|
||||
;
|
||||
|
||||
public final AuraChargeType type;
|
||||
public final int duration;
|
||||
/** The number of ticks to count between draining vis from the environment **/
|
||||
public final int tickRate;
|
||||
public final int flag;
|
||||
|
||||
AuraCharge(AuraChargeType chargeType, int duration, int tickRate) {
|
||||
this.type = chargeType;
|
||||
this.duration = duration;
|
||||
this.tickRate = tickRate;
|
||||
flag = 1 << ordinal();
|
||||
}
|
||||
|
||||
public static AuraCharge fromChargeType(AuraChargeType type) {
|
||||
for (AuraCharge charge : values()) {
|
||||
if (type == charge.type) {
|
||||
return charge;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package magicbees.bees;
|
||||
|
||||
import magicbees.api.bees.IAuraChargeType;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
|
||||
public enum AuraChargeType implements IAuraChargeType {
|
||||
MUTATION(Aspect.WATER, 850, 11),
|
||||
DEATH(Aspect.ENTROPY, 400, 5),
|
||||
PRODUCTION(Aspect.AIR, 300, 3);
|
||||
|
||||
public final int duration;
|
||||
public final Aspect aspect;
|
||||
/** The number of ticks to count between draining vis from the environment **/
|
||||
public final int tickRate;
|
||||
public final int flag = 1 << ordinal();
|
||||
|
||||
AuraChargeType(Aspect aspect, int duration, int tickRate) {
|
||||
this.aspect = aspect;
|
||||
this.duration = duration;
|
||||
this.tickRate = tickRate;
|
||||
}
|
||||
}
|
||||
@@ -1366,7 +1366,7 @@ public class BeeGenomeManager {
|
||||
public static IAllele[] getTemplateBotAelfheim() {
|
||||
IAllele[] genome = getTemplateBotDreaming();
|
||||
|
||||
genome[EnumBeeChromosome.SPECIES.ordinal()] = BeeSpecies.BOT_AELFHEIM;
|
||||
genome[EnumBeeChromosome.SPECIES.ordinal()] = BeeSpecies.BOT_ALFHEIM;
|
||||
genome[EnumBeeChromosome.EFFECT.ordinal()] = Allele.effectDreaming;
|
||||
|
||||
return genome;
|
||||
|
||||
@@ -318,10 +318,10 @@ public enum BeeSpecies implements IAlleleBeeSpecies, IIconProvider
|
||||
BOT_SOMNOLENT("BotSomnolent", "soporatus",
|
||||
BeeClassification.BOTANICAL, 0x2978C6, 0xFFB2BB, EnumTemperature.NORMAL, EnumHumidity.NORMAL, false, true),
|
||||
BOT_DREAMING("BotDreaming", "somnior",
|
||||
BeeClassification.BOTANICAL, 0x123456, 0xFFB2BB, EnumTemperature.NORMAL, EnumHumidity.NORMAL, true, true),
|
||||
BeeClassification.BOTANICAL, 0x123456, 0xFFB2BB, EnumTemperature.NORMAL, EnumHumidity.NORMAL, false, true),
|
||||
|
||||
BOT_AELFHEIM("BotAelfheim", "aelfheimis",
|
||||
BeeClassification.BOTANICAL, -1/*0x987654*/, -1/*0xFFB2BB*/, EnumTemperature.NORMAL, EnumHumidity.NORMAL, false, false),
|
||||
BOT_ALFHEIM("BotAlfheim", "alfheimis",
|
||||
BeeClassification.BOTANICAL, -1, -1, EnumTemperature.NORMAL, EnumHumidity.NORMAL, false, false),
|
||||
|
||||
;
|
||||
|
||||
@@ -1054,7 +1054,7 @@ public enum BeeSpecies implements IAlleleBeeSpecies, IIconProvider
|
||||
.setGenome(BeeGenomeManager.getTemplateBotDreaming())
|
||||
.register();
|
||||
|
||||
BOT_AELFHEIM
|
||||
BOT_ALFHEIM
|
||||
.setGenome(BeeGenomeManager.getTemplateBotAelfheim())
|
||||
.register();
|
||||
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package magicbees.bees.allele.effect;
|
||||
|
||||
import magicbees.api.bees.ITransmutationEffectLogic;
|
||||
import magicbees.main.utils.compat.BotaniaHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class TransmutationEffectLBotaniaLiving implements ITransmutationEffectLogic {
|
||||
|
||||
@Override
|
||||
public boolean tryTransmutation(World world, BiomeGenBase biome, ItemStack sourceBlock, int x, int y, int z) {
|
||||
int[] oreIDs = OreDictionary.getOreIDs(sourceBlock);
|
||||
for (int oreId : oreIDs) {
|
||||
if (oreId == OreDictionary.getOreID("logWood")) {
|
||||
world.setBlock(x, y, z, BotaniaHelper.blockLivingWood);
|
||||
return true;
|
||||
}
|
||||
else if (oreId == OreDictionary.getOreID("stone")) {
|
||||
world.setBlock(x, y, z, BotaniaHelper.blockLivingRock);
|
||||
return true;
|
||||
}
|
||||
else if (oreId == OreDictionary.getOreID("livingwood")) {
|
||||
world.setBlock(x, y, z, BotaniaHelper.blockDreamWood);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package magicbees.block;
|
||||
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.main.utils.TabMagicBees;
|
||||
import magicbees.tileentity.TileEntityManaAuraProvider;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockManaAuraProvider extends Block implements ITileEntityProvider {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon topIcon;
|
||||
|
||||
public BlockManaAuraProvider() {
|
||||
super(Material.rock);
|
||||
this.setCreativeTab(TabMagicBees.tabMagicBees);
|
||||
this.setBlockName("manaAuraProvider");
|
||||
this.setHardness(2f);
|
||||
this.setResistance(3f);
|
||||
this.setHarvestLevel("pickaxe", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityManaAuraProvider();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.blockIcon = iconRegister.registerIcon(CommonProxy.DOMAIN + ":manaApiaryBooster0");
|
||||
this.topIcon = iconRegister.registerIcon(CommonProxy.DOMAIN + ":manaApiaryBooster1");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta)
|
||||
{
|
||||
return (side == 0 || side == 1) ? this.topIcon : this.blockIcon;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import java.lang.reflect.Field;
|
||||
import magicbees.block.BlockEffectJar;
|
||||
import magicbees.block.BlockHive;
|
||||
import magicbees.block.BlockMagicApiary;
|
||||
import magicbees.block.BlockManaAuraProvider;
|
||||
import magicbees.block.BlockPlanks;
|
||||
import magicbees.block.BlockVisAuraProvider;
|
||||
import magicbees.block.BlockWoodSlab;
|
||||
@@ -40,6 +41,7 @@ import magicbees.main.utils.compat.ThaumcraftHelper;
|
||||
import magicbees.storage.BackpackDefinition;
|
||||
import magicbees.tileentity.TileEntityEffectJar;
|
||||
import magicbees.tileentity.TileEntityMagicApiary;
|
||||
import magicbees.tileentity.TileEntityManaAuraProvider;
|
||||
import magicbees.tileentity.TileEntityVisAuraProvider;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -103,6 +105,7 @@ public class Config
|
||||
public static BlockEffectJar effectJar;
|
||||
public static BlockHive hive;
|
||||
public static BlockMagicApiary magicApiary;
|
||||
public static BlockManaAuraProvider manaAuraProvider;
|
||||
public static BlockVisAuraProvider visAuraProvider;
|
||||
|
||||
public static ItemComb combs;
|
||||
@@ -258,6 +261,7 @@ public class Config
|
||||
setupHives();
|
||||
setupApiary();
|
||||
|
||||
setupBotaniaBlocks();
|
||||
setupThaumcraftBlocks();
|
||||
}
|
||||
|
||||
@@ -503,6 +507,14 @@ public class Config
|
||||
}
|
||||
}
|
||||
|
||||
private void setupBotaniaBlocks() {
|
||||
if (BotaniaHelper.isActive()) {
|
||||
manaAuraProvider = new BlockManaAuraProvider();
|
||||
GameRegistry.registerBlock(manaAuraProvider, "manaAuraProvider");
|
||||
GameRegistry.registerTileEntity(TileEntityManaAuraProvider.class, "manaAuraProvider");
|
||||
}
|
||||
}
|
||||
|
||||
private void setupThaumcraftBackpacks() {
|
||||
if (ThaumcraftHelper.isActive() && thaumaturgeBackpackActive) {
|
||||
try {
|
||||
|
||||
@@ -356,6 +356,7 @@ public class CraftingManager
|
||||
output = new ItemStack(Config.magicApiary);
|
||||
GameRegistry.addShapelessRecipe(output, new Object[] {
|
||||
Config.pollen.getStackForType(PollenType.UNUSUAL, 2),
|
||||
Config.drops.getStackForType(DropType.ENCHANTED, 2),
|
||||
new ItemStack(Config.fApicultureBlock, 1, ForestryHelper.ApicultureBlock.APIARY.ordinal())
|
||||
});
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package magicbees.main.utils.compat;
|
||||
|
||||
import magicbees.bees.BeeManager;
|
||||
import magicbees.item.types.PollenType;
|
||||
import magicbees.main.Config;
|
||||
import magicbees.main.utils.BlockInterface;
|
||||
import magicbees.main.utils.ItemInterface;
|
||||
@@ -15,6 +16,7 @@ import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import net.minecraftforge.common.config.Property;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import vazkii.botania.api.mana.ManaItemHandler;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
@@ -27,6 +29,7 @@ public class BotaniaHelper {
|
||||
public static IIcon subtileIcons[];
|
||||
|
||||
public static final String LEXICON_ENTRY_MANA_GEAR = "manaGear";
|
||||
public static final String LEXICON_ENTRY_ELF_RESOURCES = "elfResources";
|
||||
|
||||
public enum ManaResource {
|
||||
MANASTEEL,
|
||||
@@ -70,6 +73,7 @@ public class BotaniaHelper {
|
||||
|
||||
public static IRecipe manasteelGrafterRecipe;
|
||||
public static IRecipe manasteelScoopRecipe;
|
||||
public static IRecipe manaBoosterRecipe;
|
||||
|
||||
private static boolean isBotaniaActive = false;
|
||||
public static final String Name = "Botania";
|
||||
@@ -119,6 +123,15 @@ public class BotaniaHelper {
|
||||
});
|
||||
manasteelGrafterRecipe = (IRecipe) CraftingManager.getInstance().getRecipeList().get(CraftingManager.getInstance().getRecipeList().size() - 1);
|
||||
|
||||
GameRegistry.addRecipe(new ItemStack(Config.manaAuraProvider), new Object[] {
|
||||
"lsl", "pmp", "sss",
|
||||
's', blockLivingRock,
|
||||
'm', new ItemStack(itemManaResource, 1, ManaResource.MANASTEEL.ordinal()),
|
||||
'p', Config.pollen.getStackForType(PollenType.UNUSUAL),
|
||||
'l', new ItemStack(itemManaPetal, 1, OreDictionary.WILDCARD_VALUE)
|
||||
});
|
||||
manaBoosterRecipe = (IRecipe) CraftingManager.getInstance().getRecipeList().get(CraftingManager.getInstance().getRecipeList().size() - 1);
|
||||
|
||||
BotaniaAPIDistanceHelper.setupCraftingAndLexicon();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import magicbees.main.utils.compat.BotaniaHelper.ManaResource;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.lexicon.LexiconPage;
|
||||
import vazkii.botania.api.recipe.RecipeElvenTrade;
|
||||
import vazkii.botania.api.recipe.RecipeManaInfusion;
|
||||
import vazkii.botania.api.recipe.RecipePetals;
|
||||
@@ -20,6 +19,7 @@ public class BotaniaAPIDistanceHelper {
|
||||
|
||||
public static LexiconEntry entryBeegonia;
|
||||
public static LexiconEntry entryHiveacynth;
|
||||
public static LexiconEntry entryManaApiaryBooster;
|
||||
|
||||
public static RecipeManaInfusion infusionBeeBotanical;
|
||||
public static RecipeManaInfusion infusionBeeVazbee;
|
||||
@@ -44,26 +44,30 @@ public class BotaniaAPIDistanceHelper {
|
||||
infusionBeeVazbee.setAlchemy(true);
|
||||
BotaniaAPI.manaInfusionRecipes.add(infusionBeeVazbee);
|
||||
|
||||
tradeBeeAelfheim = new SpeciesRecipeElvenTrade(BeeSpecies.BOT_DREAMING, BeeSpecies.BOT_AELFHEIM);
|
||||
tradeBeeAelfheim = new SpeciesRecipeElvenTrade(BeeSpecies.BOT_DREAMING, BeeSpecies.BOT_ALFHEIM);
|
||||
BotaniaAPI.elvenTradeRecipes.add(tradeBeeAelfheim);
|
||||
|
||||
LexiconEntry manasteelEntry = getLexiconEntryForName(BotaniaHelper.LEXICON_ENTRY_MANA_GEAR);
|
||||
manasteelEntry.addPage(BotaniaAPI.internalHandler.craftingRecipePage("magicbees.botania.lexicon.manasteelScoop", BotaniaHelper.manasteelScoopRecipe));
|
||||
manasteelEntry.addPage(BotaniaAPI.internalHandler.craftingRecipePage("magicbees.botania.lexicon.manasteelGrafter", BotaniaHelper.manasteelGrafterRecipe));
|
||||
|
||||
LexiconEntry elfResourcesEntry = getLexiconEntryForName(BotaniaHelper.LEXICON_ENTRY_ELF_RESOURCES);
|
||||
elfResourcesEntry.addPage(BotaniaAPI.internalHandler.textPage("magicbees.botania.lexicon.beeAlfheim.0"));
|
||||
elfResourcesEntry.addPage(BotaniaAPI.internalHandler.elvenTradesPage("magicbees.botania.lexicon.beeAlfheim.trade", tradeBeeAelfheim));
|
||||
|
||||
RecipePetals beegoniaRecipe = BotaniaAPI.registerPetalRecipe(BotaniaAPI.internalHandler.getSubTileAsStack(SubTileBeegonia.NAME), new Object[] {
|
||||
new ItemStack(BotaniaHelper.itemPetal), new ItemStack(BotaniaHelper.itemManaPetal),
|
||||
new ItemStack(BotaniaHelper.itemPetal, 1, 4), new ItemStack(BotaniaHelper.itemPetal, 1, 4),
|
||||
new ItemStack(BotaniaHelper.itemPetal, 1, 4), new ItemStack(BotaniaHelper.itemManaPetal, 1, 4),
|
||||
new ItemStack(BotaniaHelper.itemManaPetal, 1, 15)
|
||||
});
|
||||
BotaniaAPIDistanceHelper.entryBeegonia = new BotaniaLexiconEntry(SubTileBeegonia.NAME, BotaniaAPI.categoryGenerationFlowers);
|
||||
BotaniaAPIDistanceHelper.entryBeegonia.setLexiconPages(new LexiconPage[] {
|
||||
entryBeegonia = new BotaniaLexiconEntry("tile.botania:flower." + SubTileBeegonia.NAME + ".name", BotaniaAPI.categoryGenerationFlowers);
|
||||
entryBeegonia.setLexiconPages(
|
||||
BotaniaAPI.internalHandler.textPage("magicbees.botania.lexicon.beegonia.0"),
|
||||
BotaniaAPI.internalHandler.textPage("magicbees.botania.lexicon.beegonia.1"),
|
||||
BotaniaAPI.internalHandler.petalRecipePage("magicbees.botania.lexicon.beegonia.crafting", beegoniaRecipe),
|
||||
BotaniaAPI.internalHandler.textPage("magicbees.botania.lexicon.beegonia.2")
|
||||
});
|
||||
);
|
||||
|
||||
RecipePetals hiveacynthRecipe = BotaniaAPI.registerPetalRecipe(BotaniaAPI.internalHandler.getSubTileAsStack(SubTileHiveacynth.NAME), new Object[] {
|
||||
new ItemStack(BotaniaHelper.itemPetal, 1, 3), new ItemStack(BotaniaHelper.itemPetal, 1, 9),
|
||||
@@ -72,12 +76,17 @@ public class BotaniaAPIDistanceHelper {
|
||||
new ItemStack(BotaniaHelper.itemManaPetal, 1, 11), new ItemStack(BotaniaHelper.itemManaPetal, 1, 11),
|
||||
new ItemStack(BotaniaHelper.itemManaResource, 1, ManaResource.REDSTONE_ROOT.ordinal())
|
||||
});
|
||||
BotaniaAPIDistanceHelper.entryHiveacynth = new BotaniaLexiconEntry(SubTileHiveacynth.NAME, BotaniaAPI.categoryFunctionalFlowers);
|
||||
BotaniaAPIDistanceHelper.entryHiveacynth.setLexiconPages(new LexiconPage[] {
|
||||
BotaniaAPI.internalHandler.textPage("magicbees.botania.lexicon.hiveacynth.0"),
|
||||
entryHiveacynth = new BotaniaLexiconEntry("tile.botania:flower." + SubTileHiveacynth.NAME + ".name", BotaniaAPI.categoryFunctionalFlowers);
|
||||
entryHiveacynth.setLexiconPages(BotaniaAPI.internalHandler.textPage("magicbees.botania.lexicon.hiveacynth.0"),
|
||||
BotaniaAPI.internalHandler.textPage("magicbees.botania.lexicon.hiveacynth.1"),
|
||||
BotaniaAPI.internalHandler.petalRecipePage("magicbees.botania.lexicon.hiveacynth.crafting", hiveacynthRecipe)
|
||||
});
|
||||
);
|
||||
|
||||
entryManaApiaryBooster = new BotaniaLexiconEntry("tile.manaAuraProvider.name", BotaniaAPI.categoryDevices);
|
||||
entryManaApiaryBooster.setLexiconPages(
|
||||
BotaniaAPI.internalHandler.textPage("magicbees.botania.lexicon.manaBooster.0"),
|
||||
BotaniaAPI.internalHandler.craftingRecipePage("magicbees.botania.lexicon.manaBooster.crafting", BotaniaHelper.manaBoosterRecipe)
|
||||
);
|
||||
}
|
||||
|
||||
public static LexiconEntry getLexiconEntryForName(String name) {
|
||||
|
||||
@@ -20,7 +20,7 @@ public class BotaniaLexiconEntry extends LexiconEntry implements IAddonEntry {
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
return "tile.botania:flower." + unlocalizedName + ".name";
|
||||
return unlocalizedName;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,33 +6,33 @@ import java.util.Map;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import magicbees.bees.AuraChargeType;
|
||||
import magicbees.bees.AuraCharge;
|
||||
|
||||
public class AuraCharges {
|
||||
private static final String auraChargesTagName = "AuraCharges";
|
||||
|
||||
private final Map<AuraChargeType, Long> charges = new HashMap<AuraChargeType, Long>(AuraChargeType.values().length);
|
||||
private final Map<AuraCharge, Long> charges = new HashMap<AuraCharge, Long>(AuraCharge.values().length);
|
||||
|
||||
public void start(AuraChargeType auraChargeType, World worldObj) {
|
||||
public void start(AuraCharge auraChargeType, World worldObj) {
|
||||
charges.put(auraChargeType, worldObj.getTotalWorldTime());
|
||||
}
|
||||
|
||||
public boolean isActive(AuraChargeType auraChargeType) {
|
||||
public boolean isActive(AuraCharge auraChargeType) {
|
||||
return charges.keySet().contains(auraChargeType);
|
||||
}
|
||||
|
||||
public boolean isExpired(AuraChargeType auraChargeType, World worldObj) {
|
||||
public boolean isExpired(AuraCharge auraChargeType, World worldObj) {
|
||||
Long chargeStart = charges.get(auraChargeType);
|
||||
return chargeStart == null || chargeStart + auraChargeType.duration <= worldObj.getTotalWorldTime();
|
||||
}
|
||||
|
||||
public void stop(AuraChargeType AuraChargeType) {
|
||||
public void stop(AuraCharge AuraChargeType) {
|
||||
charges.remove(AuraChargeType);
|
||||
}
|
||||
|
||||
public void writeToNBT(NBTTagCompound nbtTagCompound) {
|
||||
NBTTagCompound auraChargeTags = new NBTTagCompound();
|
||||
for (Map.Entry<AuraChargeType, Long> chargeEntry : charges.entrySet()) {
|
||||
for (Map.Entry<AuraCharge, Long> chargeEntry : charges.entrySet()) {
|
||||
String chargeName = chargeEntry.getKey().toString();
|
||||
Long chargeStart = chargeEntry.getValue();
|
||||
auraChargeTags.setLong(chargeName, chargeStart);
|
||||
@@ -42,7 +42,7 @@ public class AuraCharges {
|
||||
|
||||
public void readFromNBT(NBTTagCompound nbtTagCompound) {
|
||||
NBTTagCompound auraChargeTags = nbtTagCompound.getCompoundTag(auraChargesTagName);
|
||||
for (AuraChargeType auraCharge : AuraChargeType.values()) {
|
||||
for (AuraCharge auraCharge : AuraCharge.values()) {
|
||||
String chargeName = auraCharge.toString();
|
||||
Long chargeStart = auraChargeTags.getLong(chargeName);
|
||||
if (chargeStart > 0) {
|
||||
@@ -53,7 +53,7 @@ public class AuraCharges {
|
||||
|
||||
public int writeToFlags() {
|
||||
int flags = 0;
|
||||
for (AuraChargeType auraChargeType : charges.keySet()) {
|
||||
for (AuraCharge auraChargeType : charges.keySet()) {
|
||||
flags |= auraChargeType.flag;
|
||||
}
|
||||
return flags;
|
||||
@@ -61,7 +61,7 @@ public class AuraCharges {
|
||||
|
||||
public void readFromFlags(int flags) {
|
||||
charges.clear();
|
||||
for (AuraChargeType auraCharge : AuraChargeType.values()) {
|
||||
for (AuraCharge auraCharge : AuraCharge.values()) {
|
||||
if ((flags & auraCharge.flag) > 0) {
|
||||
charges.put(auraCharge, 0L);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import magicbees.bees.AuraChargeType;
|
||||
import magicbees.bees.AuraCharge;
|
||||
import magicbees.api.bees.IMagicApiaryAuraProvider;
|
||||
import magicbees.bees.BeeManager;
|
||||
import magicbees.main.CommonProxy;
|
||||
@@ -632,15 +632,15 @@ public class TileEntityMagicApiary extends TileEntity implements ISidedInventory
|
||||
}
|
||||
|
||||
public boolean isProductionBoosted() {
|
||||
return auraCharges.isActive(AuraChargeType.PRODUCTION);
|
||||
return auraCharges.isActive(AuraCharge.PRODUCTION);
|
||||
}
|
||||
|
||||
public boolean isDeathRateBoosted() {
|
||||
return auraCharges.isActive(AuraChargeType.DEATH);
|
||||
return auraCharges.isActive(AuraCharge.DEATH);
|
||||
}
|
||||
|
||||
public boolean isMutationBoosted() {
|
||||
return auraCharges.isActive(AuraChargeType.MUTATION);
|
||||
return auraCharges.isActive(AuraCharge.MUTATION);
|
||||
}
|
||||
|
||||
private void updateAuraProvider() {
|
||||
@@ -654,9 +654,9 @@ public class TileEntityMagicApiary extends TileEntity implements ISidedInventory
|
||||
}
|
||||
|
||||
boolean auraChargesChanged = false;
|
||||
for (AuraChargeType chargeType : AuraChargeType.values()) {
|
||||
if (!auraCharges.isActive(chargeType) && auraProvider.getCharge(chargeType)) {
|
||||
auraCharges.start(chargeType, worldObj);
|
||||
for (AuraCharge charge : AuraCharge.values()) {
|
||||
if (!auraCharges.isActive(charge) && auraProvider.getCharge(charge.type)) {
|
||||
auraCharges.start(charge, worldObj);
|
||||
auraChargesChanged = true;
|
||||
}
|
||||
}
|
||||
@@ -669,9 +669,9 @@ public class TileEntityMagicApiary extends TileEntity implements ISidedInventory
|
||||
private void tickCharges() {
|
||||
boolean auraChargesChanged = false;
|
||||
|
||||
for (AuraChargeType chargeType : AuraChargeType.values()) {
|
||||
if (auraCharges.isActive(chargeType) && auraCharges.isExpired(chargeType, worldObj) && (auraProvider == null || !auraProvider.getCharge(chargeType))) {
|
||||
auraCharges.stop(chargeType);
|
||||
for (AuraCharge charge : AuraCharge.values()) {
|
||||
if (auraCharges.isActive(charge) && auraCharges.isExpired(charge, worldObj) && (auraProvider == null || !auraProvider.getCharge(charge.type))) {
|
||||
auraCharges.stop(charge);
|
||||
auraChargesChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,161 @@
|
||||
package magicbees.tileentity;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import magicbees.api.bees.AuraChargeType;
|
||||
import magicbees.api.bees.IMagicApiaryAuraProvider;
|
||||
import magicbees.bees.AuraCharge;
|
||||
import magicbees.main.CommonProxy;
|
||||
import magicbees.main.utils.compat.BotaniaHelper;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import vazkii.botania.api.mana.IManaReceiver;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
|
||||
@Optional.InterfaceList({
|
||||
@Optional.Interface(iface = "vazkii.botania.api.mana.IManaReceiver", modid = BotaniaHelper.Name)
|
||||
})
|
||||
public class TileEntityManaAuraProvider extends TileEntity implements IMagicApiaryAuraProvider, IManaReceiver {
|
||||
|
||||
public static final String tileEntityName = CommonProxy.DOMAIN + ".manaAuraProvider";
|
||||
|
||||
private static final int MAX_CHARGES = 4;
|
||||
private static final int MANA_PER_CHARGE = 4000;
|
||||
private static final int MAX_MANA = MANA_PER_CHARGE * 4;
|
||||
|
||||
private static class ManaAuraCharge {
|
||||
int charges;
|
||||
int mana;
|
||||
|
||||
public int[] toArray() {
|
||||
return new int[]{charges, mana};
|
||||
}
|
||||
|
||||
public void fromArray(int[] array) {
|
||||
if (array.length == 2) {
|
||||
charges = array[0];
|
||||
mana = array[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private final Map<AuraCharge, ManaAuraCharge> currentCharges;
|
||||
private int currentMana;
|
||||
|
||||
public TileEntityManaAuraProvider() {
|
||||
super();
|
||||
|
||||
AuraCharge[] auraChargeTypes = AuraCharge.values();
|
||||
currentCharges = new HashMap<AuraCharge, ManaAuraCharge>(auraChargeTypes.length);
|
||||
for (AuraCharge auraChargeType : auraChargeTypes) {
|
||||
currentCharges.put(auraChargeType, new ManaAuraCharge());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
long tick = worldObj.getTotalWorldTime();
|
||||
int manaForCharge = currentMana / 5;
|
||||
|
||||
if (manaForCharge > 0) {
|
||||
for (Map.Entry<AuraCharge, ManaAuraCharge> currentCharge : currentCharges.entrySet()) {
|
||||
AuraCharge type = currentCharge.getKey();
|
||||
ManaAuraCharge auraCharge = currentCharge.getValue();
|
||||
|
||||
if (auraCharge.charges < MAX_CHARGES && (tick % type.tickRate) == 0 && currentMana > 0) {
|
||||
auraCharge.mana += manaForCharge;
|
||||
if (auraCharge.mana > MANA_PER_CHARGE) {
|
||||
auraCharge.mana -= MANA_PER_CHARGE;
|
||||
auraCharge.charges++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getMutationCharge() {
|
||||
return getCharge(AuraChargeType.MUTATION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getDeathRateCharge() {
|
||||
return getCharge(AuraChargeType.DEATH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getProductionCharge() {
|
||||
return getCharge(AuraChargeType.PRODUCTION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getCharge(AuraChargeType auraChargeType) {
|
||||
ManaAuraCharge charge = currentCharges.get(AuraCharge.fromChargeType(auraChargeType));
|
||||
if (charge == null) {
|
||||
return false;
|
||||
}
|
||||
if (charge.charges > 0) {
|
||||
charge.charges--;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = BotaniaHelper.Name)
|
||||
public int getCurrentMana() {
|
||||
return currentMana;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = BotaniaHelper.Name)
|
||||
public boolean canRecieveManaFromBursts() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = BotaniaHelper.Name)
|
||||
public boolean isFull() {
|
||||
return currentMana == MAX_MANA;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = BotaniaHelper.Name)
|
||||
public void recieveMana(int amount) {
|
||||
currentMana = (currentMana + amount > MAX_MANA) ? MAX_MANA : currentMana + amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
super.readFromNBT(tag);
|
||||
|
||||
for (Map.Entry<AuraCharge, ManaAuraCharge> charge : currentCharges.entrySet()) {
|
||||
String auraName = charge.getKey().toString();
|
||||
int[] array = tag.getIntArray(auraName);
|
||||
ManaAuraCharge auraCharge = charge.getValue();
|
||||
auraCharge.fromArray(array);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
super.writeToNBT(tag);
|
||||
|
||||
for (Map.Entry<AuraCharge, ManaAuraCharge> charge : currentCharges.entrySet()) {
|
||||
String auraName = charge.getKey().toString();
|
||||
ManaAuraCharge auraCharge = charge.getValue();
|
||||
int[] array = auraCharge.toArray();
|
||||
tag.setIntArray(auraName, array);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, compound);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,8 +3,8 @@ package magicbees.tileentity;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import magicbees.api.bees.IAuraChargeType;
|
||||
import magicbees.bees.AuraChargeType;
|
||||
import magicbees.api.bees.AuraChargeType;
|
||||
import magicbees.bees.AuraCharge;
|
||||
import magicbees.api.bees.IMagicApiaryAuraProvider;
|
||||
import magicbees.main.CommonProxy;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -18,8 +18,16 @@ public class TileEntityVisAuraProvider extends TileEntity implements IMagicApiar
|
||||
|
||||
private static final int MAX_CHARGES = 10;
|
||||
private static final int VIS_PER_CHARGE = 8;
|
||||
private static Map<AuraChargeType, Aspect> aspectMap;
|
||||
|
||||
static {
|
||||
aspectMap = new HashMap<AuraChargeType, Aspect>(AuraChargeType.values().length);
|
||||
aspectMap.put(AuraChargeType.MUTATION, Aspect.WATER);
|
||||
aspectMap.put(AuraChargeType.DEATH, Aspect.ENTROPY);
|
||||
aspectMap.put(AuraChargeType.PRODUCTION, Aspect.AIR);
|
||||
}
|
||||
|
||||
private static class AuraCharge {
|
||||
private static class VisAuraCharge {
|
||||
int charges;
|
||||
int vis;
|
||||
|
||||
@@ -35,15 +43,15 @@ public class TileEntityVisAuraProvider extends TileEntity implements IMagicApiar
|
||||
}
|
||||
}
|
||||
|
||||
private final Map<AuraChargeType, AuraCharge> currentCharges;
|
||||
private final Map<AuraCharge, VisAuraCharge> currentCharges;
|
||||
|
||||
public TileEntityVisAuraProvider() {
|
||||
super();
|
||||
|
||||
AuraChargeType[] auraChargeTypes = AuraChargeType.values();
|
||||
currentCharges = new HashMap<AuraChargeType, AuraCharge>(auraChargeTypes.length);
|
||||
for (AuraChargeType auraChargeType : auraChargeTypes) {
|
||||
currentCharges.put(auraChargeType, new AuraCharge());
|
||||
AuraCharge[] auraChargeTypes = AuraCharge.values();
|
||||
currentCharges = new HashMap<AuraCharge, VisAuraCharge>(auraChargeTypes.length);
|
||||
for (AuraCharge auraChargeType : auraChargeTypes) {
|
||||
currentCharges.put(auraChargeType, new VisAuraCharge());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,12 +60,12 @@ public class TileEntityVisAuraProvider extends TileEntity implements IMagicApiar
|
||||
|
||||
long tick = worldObj.getTotalWorldTime();
|
||||
|
||||
for (Map.Entry<AuraChargeType, AuraCharge> currentCharge : currentCharges.entrySet()) {
|
||||
AuraChargeType type = currentCharge.getKey();
|
||||
AuraCharge auraCharge = currentCharge.getValue();
|
||||
for (Map.Entry<AuraCharge, VisAuraCharge> currentCharge : currentCharges.entrySet()) {
|
||||
AuraCharge type = currentCharge.getKey();
|
||||
VisAuraCharge auraCharge = currentCharge.getValue();
|
||||
|
||||
if (auraCharge.charges < MAX_CHARGES && (tick % type.tickRate) == 0) {
|
||||
auraCharge.vis += getVisFromNet(type.aspect);
|
||||
auraCharge.vis += getVisFromNet(aspectMap.get(type));
|
||||
if (auraCharge.vis >= VIS_PER_CHARGE) {
|
||||
auraCharge.vis -= VIS_PER_CHARGE;
|
||||
auraCharge.charges++;
|
||||
@@ -86,8 +94,8 @@ public class TileEntityVisAuraProvider extends TileEntity implements IMagicApiar
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getCharge(IAuraChargeType auraChargeType) {
|
||||
AuraCharge auraCharge = currentCharges.get(auraChargeType);
|
||||
public boolean getCharge(AuraChargeType auraChargeType) {
|
||||
VisAuraCharge auraCharge = currentCharges.get(AuraCharge.fromChargeType(auraChargeType));
|
||||
if (auraCharge == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -103,10 +111,10 @@ public class TileEntityVisAuraProvider extends TileEntity implements IMagicApiar
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
super.readFromNBT(tag);
|
||||
|
||||
for (Map.Entry<AuraChargeType, AuraCharge> charge : currentCharges.entrySet()) {
|
||||
for (Map.Entry<AuraCharge, VisAuraCharge> charge : currentCharges.entrySet()) {
|
||||
String auraName = charge.getKey().toString();
|
||||
int[] array = tag.getIntArray(auraName);
|
||||
AuraCharge auraCharge = charge.getValue();
|
||||
VisAuraCharge auraCharge = charge.getValue();
|
||||
auraCharge.fromArray(array);
|
||||
}
|
||||
}
|
||||
@@ -115,9 +123,9 @@ public class TileEntityVisAuraProvider extends TileEntity implements IMagicApiar
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
super.writeToNBT(tag);
|
||||
|
||||
for (Map.Entry<AuraChargeType, AuraCharge> charge : currentCharges.entrySet()) {
|
||||
for (Map.Entry<AuraCharge, VisAuraCharge> charge : currentCharges.entrySet()) {
|
||||
String auraName = charge.getKey().toString();
|
||||
AuraCharge auraCharge = charge.getValue();
|
||||
VisAuraCharge auraCharge = charge.getValue();
|
||||
int[] array = auraCharge.toArray();
|
||||
tag.setIntArray(auraName, array);
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ item.moonDial.name=Jade Moon Dial
|
||||
tile.effectJar.name=Bee Collector's Jar
|
||||
tile.magicApiary.name=Magic Apiary
|
||||
tile.visAuraProvider.name=Vis Apiary Booster
|
||||
tile.manaAuraProvider.name=Mana Apiary Booster
|
||||
tile.hive.curious.name=Curious Hive
|
||||
tile.hive.unusual.name=Unusual Hive
|
||||
tile.hive.deep.name=Deep Hive
|
||||
@@ -428,8 +429,8 @@ magicbees.speciesBotSomnolent=Somnolent
|
||||
magicbees.speciesBotSomnolent.description=....
|
||||
magicbees.speciesBotDreaming=Dreaming
|
||||
magicbees.speciesBotDreaming.description=....
|
||||
magicbees.speciesBotAelfheim=Aelfheim
|
||||
magicbees.speciesBotAelfheim.description=....
|
||||
magicbees.speciesBotAlfheim=Alfheim
|
||||
magicbees.speciesBotAlfheim.description=....
|
||||
magicbees.species=
|
||||
magicbees.species.description=
|
||||
magicbees.speedBlinding=Blinding
|
||||
@@ -562,6 +563,9 @@ magicbees.botania.lexicon.subtitle=[Magic Bees]
|
||||
magicbees.botania.lexicon.manasteelScoop=The &1Manasteel Scoop&0
|
||||
magicbees.botania.lexicon.manasteelGrafter=The &1Manasteel Grafter&0
|
||||
|
||||
magicbees.botania.lexicon.beeAlfheim.trade=Trading for &bAlfheim Drones&0
|
||||
magicbees.botania.lexicon.beeAlfheim.0=&1Elven Beekeepers&0 are anxious to discover the delights of your world's bees, and are particularly interested in the &1Dreaming Drones&0 that you can provide. In return, they will trade &bAlfheim Drones&0, the only bees that exist in Alfheim.
|
||||
|
||||
magicbees.botania.lexicon.beegonia.0=Drones are the foundation of a healthy colony's future, but really, they can start just piling up to the point where you don't know what to do with them anymore. <br>The &1Beegonia&0 is a solution to the problem of overcrowding! Simply toss your spare drones in their vicinity, and they will reclaim the life force within the drone and convert it into mana! They aren't terribly picky, and will
|
||||
magicbees.botania.lexicon.beegonia.1=produce a constant amount of mana while they work, though it does seem more "complex" bees provide more mana than mundane bees, whatever that means.
|
||||
magicbees.botania.lexicon.beegonia.crafting=Syncrostrike's Elegant Solution
|
||||
@@ -569,4 +573,7 @@ magicbees.botania.lexicon.beegonia.2=Well. It was this or &2Beenus Fly Trap&0, b
|
||||
|
||||
magicbees.botania.lexicon.hiveacynth.0=Finding new bees for your stock can be a bit of a pain. Thankfully, we can tap into the memories of flowers to reproduce bees with up to 74% accuracy! Maybe.<br>The &1Hiveacynth&0 absorbs mana from a nearby mana pool, and once it has collected enough, it begins converting it into life essence and produces a bee! It seems the species is somewhat random, though only 'mundane' bees
|
||||
magicbees.botania.lexicon.hiveacynth.1=will ever be produced, and roughly in proportion to how they are found in the wild.<br>Occasionally, the flower will give itself airs, and produce a vaunted heiress rather than a vulgar drone. A redstone signal will prevent the &1Hiveacynth&0 from converting mana into life essence.
|
||||
magicbees.botania.lexicon.hiveacynth.crafting=> beesbeesbees.com
|
||||
magicbees.botania.lexicon.hiveacynth.crafting=> beesbeesbees.com
|
||||
|
||||
magicbees.botania.lexicon.manaBooster.0=The Magic Apiary is a natural way to keep bees working quickly, but its a bit... limited. Thankfully, the properties of living stone and petals have a way of apparently energizing bees, making them produce more. Simply provide the &1Mana Apiary Booster&0 with a constant supply of mana, and it will keep the apiaries working efficiently.
|
||||
magicbees.botania.lexicon.manaBooster.crafting=Abuzz with mana!
|
||||
@@ -5,7 +5,7 @@
|
||||
"mcversion": "${mcversion}",
|
||||
"name": "Magic Bees",
|
||||
"url": "http://bit.ly/XFDvLY",
|
||||
"description": "Magic themed bee expansion for Forestry. TC4, EE3, AM 2, TE 3",
|
||||
"description": "Magic themed bee expansion for Forestry. TC4, Botania, EE3, AM 2, TE 3",
|
||||
"authors": [ "MysteriousAges" ],
|
||||
"credits": "SirSengir, Azanor, Binnie & the Forestry Dev peeps",
|
||||
"logoFile": "/mods/magicbees/textures/logo.png"
|
||||
|
||||
Reference in new issue
Block a user