diff --git a/thaumicbees_res/lang/thaumicbees/en_US.xml b/thaumicbees_res/lang/thaumicbees/en_US.xml index 31bec94..b52e7fd 100644 --- a/thaumicbees_res/lang/thaumicbees/en_US.xml +++ b/thaumicbees_res/lang/thaumicbees/en_US.xml @@ -160,7 +160,9 @@ Mining Swiftness Time Warp - Aura Attract + Aura Attract + Purify Aura + Aura Flux Brainy Batty Wispy @@ -168,8 +170,6 @@ Books Magic Flowers Node - Purify Node - Fluxify Node Arcane diff --git a/thaumicbees_src/thaumicbees/bees/Allele.java b/thaumicbees_src/thaumicbees/bees/Allele.java index 723ca8f..272e1b0 100644 --- a/thaumicbees_src/thaumicbees/bees/Allele.java +++ b/thaumicbees_src/thaumicbees/bees/Allele.java @@ -13,7 +13,9 @@ public class Allele implements IAllele public static AlleleFlower flowerBookshelf; public static AlleleFlower flowerThaumcraft; public static AlleleFlower flowerAuraNode; + @Deprecated public static AlleleFlower flowerNodePurify; + @Deprecated public static AlleleFlower flowerNodeFluxify; public static AlleleEffectCure cleansingEffect; @@ -24,7 +26,9 @@ public class Allele implements IAllele public static AlleleEffectSpawnMob spawnWisp; public static AlleleEffectSpawnMob spawnBats; public static AlleleEffectSpawnMob spawnGhast; - public static AlleleEffectAuraNodeGrow nodeGen; + public static AlleleEffectAuraNodeAttract effectNodeAttract; + public static AlleleEffectAuraNodePurify effectNodePurify; + public static AlleleEffectAuraNodeFlux effectNodeFlux; public static void setupAdditionalAlleles() { @@ -33,15 +37,17 @@ public class Allele implements IAllele Allele.flowerBookshelf = new AlleleFlower("flowerBookshelf", new FlowerProviderBookshelf(), true); Allele.flowerThaumcraft = new AlleleFlower("flowerThaumcraftPlant", new FlowerProviderThaumcraftFlower(), false); Allele.flowerAuraNode = new AlleleFlower("flowerAuraNode", new FlowerProviderAuraNode(), true); - Allele.flowerNodePurify = new AlleleFlower("flowerAuraNodePurify", new FlowerProviderAuraNodePurify(), false); - Allele.flowerNodeFluxify = new AlleleFlower("flowerAuraNodeFlux", new FlowerProviderAuraNodeFlux(), false); + Allele.flowerNodePurify = new AlleleFlower("flowerAuraNodePurify", new FlowerProviderAuraNode(), false); + Allele.flowerNodeFluxify = new AlleleFlower("flowerAuraNodeFlux", new FlowerProviderAuraNode(), false); Allele.cleansingEffect = new AlleleEffectCure("effectCurative", false); Allele.digSpeed = new AlleleEffectPotion("effectDigSpeed", Potion.digSpeed, 15, false); Allele.moveSpeed = new AlleleEffectPotion("effectMoveSpeed", Potion.moveSpeed, 10, false); Allele.slowSpeed = new AlleleEffectPotion("effectSlowSpeed", Potion.moveSlowdown, 3, false); - Allele.nodeGen = new AlleleEffectAuraNodeGrow("effectNodeGeneration", false, 400); + Allele.effectNodeAttract = new AlleleEffectAuraNodeAttract("effectNodeGeneration", false, 400); + Allele.effectNodePurify = new AlleleEffectAuraNodePurify("effectNodePurify", false, 600, 150); + Allele.effectNodeFlux = new AlleleEffectAuraNodeFlux("effectNodeFlux", true, 300, 300); Allele.spawnBrainyZombie = new AlleleEffectSpawnMob("effectBrainy", false, ThaumcraftHelper.Entity.BRAINY_ZOMBIE.entityID); Allele.spawnBrainyZombie.setAggrosPlayerOnSpawn().setThrottle(800).setSpawnsOnPlayerNear(null).setMaxMobsInSpawnZone(2); diff --git a/thaumicbees_src/thaumicbees/bees/AlleleEffectAuraNodeGrow.java b/thaumicbees_src/thaumicbees/bees/AlleleEffectAuraNodeAttract.java similarity index 92% rename from thaumicbees_src/thaumicbees/bees/AlleleEffectAuraNodeGrow.java rename to thaumicbees_src/thaumicbees/bees/AlleleEffectAuraNodeAttract.java index ef6af74..ff3ca94 100644 --- a/thaumicbees_src/thaumicbees/bees/AlleleEffectAuraNodeGrow.java +++ b/thaumicbees_src/thaumicbees/bees/AlleleEffectAuraNodeAttract.java @@ -11,12 +11,12 @@ import forestry.api.apiculture.IBeeGenome; import forestry.api.apiculture.IBeeHousing; import forestry.api.genetics.IEffectData; -public class AlleleEffectAuraNodeGrow extends AlleleEffect +public class AlleleEffectAuraNodeAttract extends AlleleEffect { private int throttle; - public AlleleEffectAuraNodeGrow(String id, boolean isDominant, int timeout) + public AlleleEffectAuraNodeAttract(String id, boolean isDominant, int timeout) { super(id, isDominant); this.throttle = timeout; diff --git a/thaumicbees_src/thaumicbees/bees/AlleleEffectAuraNodeFlux.java b/thaumicbees_src/thaumicbees/bees/AlleleEffectAuraNodeFlux.java new file mode 100644 index 0000000..9586835 --- /dev/null +++ b/thaumicbees_src/thaumicbees/bees/AlleleEffectAuraNodeFlux.java @@ -0,0 +1,65 @@ +package thaumicbees.bees; + +import net.minecraft.world.World; +import thaumcraft.api.EnumTag; +import thaumcraft.api.ObjectTags; +import thaumcraft.api.ThaumcraftApi; +import forestry.api.apiculture.IBeeGenome; +import forestry.api.apiculture.IBeeHousing; +import forestry.api.genetics.IEffectData; + +public class AlleleEffectAuraNodeFlux extends AlleleEffect +{ + private int effectTimeout; + private int nodeRange; + + AlleleEffectAuraNodeFlux(String id, boolean dominant, int timeout, int range) + { + super(id, dominant); + this.effectTimeout = timeout; + this.nodeRange = range; + } + + @Override + public IEffectData validateStorage(IEffectData storedData) + { + if (storedData == null) + { + storedData = new EffectData(1, 0, 0); + } + return storedData; + } + + @Override + public IEffectData doEffect(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) + { + int timeout = storedData.getInteger(0); + if (timeout >= this.effectTimeout) + { + World world = housing.getWorld(); + int x = housing.getXCoord(); + int y = housing.getYCoord(); + int z = housing.getZCoord(); + + EnumTag tag; + do + { + tag = EnumTag.values()[world.rand.nextInt(EnumTag.values().length)]; + } + while (tag == EnumTag.UNKNOWN || tag == EnumTag.WEATHER); + + int nodeId = ThaumcraftApi.getClosestAuraWithinRange(world, x, y, z, this.nodeRange); + if (nodeId != -1) + { + int quantity = world.rand.nextInt(2) + 1; + ThaumcraftApi.queueNodeChanges(nodeId, 0, 0, false, new ObjectTags().add(tag, quantity), 0f, 0f, 0f); + } + } + else + { + storedData.setInteger(0, timeout + 1); + } + return storedData; + } + +} diff --git a/thaumicbees_src/thaumicbees/bees/AlleleEffectAuraNodePurify.java b/thaumicbees_src/thaumicbees/bees/AlleleEffectAuraNodePurify.java new file mode 100644 index 0000000..0af67ed --- /dev/null +++ b/thaumicbees_src/thaumicbees/bees/AlleleEffectAuraNodePurify.java @@ -0,0 +1,75 @@ +package thaumicbees.bees; + +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import thaumcraft.api.AuraNode; +import thaumcraft.api.EnumTag; +import thaumcraft.api.ObjectTags; +import thaumcraft.api.ThaumcraftApi; +import thaumicbees.main.Config; +import forestry.api.apiculture.IBeeGenome; +import forestry.api.apiculture.IBeeHousing; +import forestry.api.genetics.IEffectData; + +public class AlleleEffectAuraNodePurify extends AlleleEffect +{ + private int effectTimeout; + private int nodeRange; + + public AlleleEffectAuraNodePurify(String id, boolean dominant, int timeout, int range) + { + super(id, dominant); + this.effectTimeout = timeout; + this.nodeRange = range; + } + + @Override + public IEffectData validateStorage(IEffectData storedData) + { + if (storedData == null) + { + storedData = new EffectData(1, 0, 0); + } + return storedData; + } + + @Override + public IEffectData doEffect(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) + { + int timeout = storedData.getInteger(0); + if (timeout >= this.effectTimeout) + { + World world = housing.getWorld(); + int x = housing.getXCoord(); + int y = housing.getYCoord(); + int z = housing.getZCoord(); + + int nodeId = ThaumcraftApi.getClosestAuraWithinRange(world, x, y, z, this.nodeRange); + if (nodeId >= 0) + { + AuraNode node = ThaumcraftApi.getNodeCopy(nodeId); + if (node != null) + { + int aspectCount = node.flux.tags.size(); + if (aspectCount > 0) + { + EnumTag selectedTag = node.flux.getAspectsSorted()[world.rand.nextInt(node.flux.tags.size())]; + if (selectedTag != null && housing.addProduct(new ItemStack(Config.solidFlux, 1, selectedTag.id), true)) + { + node.flux.remove(selectedTag, 1); + ThaumcraftApi.queueNodeChanges(node.key, 0, 0, false, new ObjectTags().remove(selectedTag, 1), 0, 0, 0); + } + } + } + } + storedData.setInteger(0, 0); + } + else + { + storedData.setInteger(0, timeout + 1); + } + + return storedData; + } + +} diff --git a/thaumicbees_src/thaumicbees/bees/BeeGenomeManager.java b/thaumicbees_src/thaumicbees/bees/BeeGenomeManager.java index eb1155a..d0d5383 100644 --- a/thaumicbees_src/thaumicbees/bees/BeeGenomeManager.java +++ b/thaumicbees_src/thaumicbees/bees/BeeGenomeManager.java @@ -302,7 +302,8 @@ public class BeeGenomeManager genome[EnumBeeChromosome.HUMIDITY_TOLERANCE.ordinal()] = Allele.getBaseAllele("toleranceNone"); genome[EnumBeeChromosome.TEMPERATURE_TOLERANCE.ordinal()] = Allele.getBaseAllele("toleranceNone"); genome[EnumBeeChromosome.FLOWERING.ordinal()] = Allele.getBaseAllele("floweringAverage"); - genome[EnumBeeChromosome.FLOWER_PROVIDER.ordinal()] = Allele.flowerNodePurify; + genome[EnumBeeChromosome.FLOWER_PROVIDER.ordinal()] = Allele.flowerAuraNode; + genome[EnumBeeChromosome.EFFECT.ordinal()] = Allele.effectNodePurify; return genome; } @@ -314,7 +315,8 @@ public class BeeGenomeManager genome[EnumBeeChromosome.SPECIES.ordinal()] = BeeSpecies.FLUX; genome[EnumBeeChromosome.HUMIDITY_TOLERANCE.ordinal()] = Allele.getBaseAllele("toleranceNone"); genome[EnumBeeChromosome.TEMPERATURE_TOLERANCE.ordinal()] = Allele.getBaseAllele("toleranceNone"); - genome[EnumBeeChromosome.FLOWER_PROVIDER.ordinal()] = Allele.flowerNodeFluxify; + genome[EnumBeeChromosome.FLOWER_PROVIDER.ordinal()] = Allele.flowerAuraNode; + genome[EnumBeeChromosome.EFFECT.ordinal()] = Allele.effectNodeFlux; return genome; } @@ -326,7 +328,7 @@ public class BeeGenomeManager genome[EnumBeeChromosome.SPECIES.ordinal()] = BeeSpecies.NODE; genome[EnumBeeChromosome.FLOWERING.ordinal()] = Allele.getBaseAllele("floweringSlowest"); genome[EnumBeeChromosome.FLOWER_PROVIDER.ordinal()] = Allele.flowerAuraNode; - genome[EnumBeeChromosome.EFFECT.ordinal()] = Allele.nodeGen; + genome[EnumBeeChromosome.EFFECT.ordinal()] = Allele.effectNodeAttract; return genome; } diff --git a/thaumicbees_src/thaumicbees/block/BlockMagicApiary.java b/thaumicbees_src/thaumicbees/block/BlockMagicApiary.java deleted file mode 100644 index 02a23ef..0000000 --- a/thaumicbees_src/thaumicbees/block/BlockMagicApiary.java +++ /dev/null @@ -1,73 +0,0 @@ -package thaumicbees.block; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import thaumicbees.main.CommonProxy; -import thaumicbees.block.TileEntityMagicApiary; -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.entity.EntityLiving; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; -import forestry.api.apiculture.IBee; -import forestry.api.apiculture.IBeeGenome; -import forestry.api.apiculture.IBeeHousing; -import forestry.api.core.EnumHumidity; -import forestry.api.core.EnumTemperature; - -public class BlockMagicApiary extends Block -{ - public BlockMagicApiary(int par1) - { - super(par1, Material.wood); - this.setTextureFile(CommonProxy.TCBEES_ITEMS_IMAGE); - this.setBlockName("Magic Apiary"); - this.blockIndexInTexture = 50; - this.setHardness(2f); - this.setResistance(5f); - } - - @Override - @SideOnly(Side.CLIENT) - public int getBlockTexture(IBlockAccess worldAccess, int x, int y, int z, int side) - { - int texture = 50; - if (side == 0) - { - texture = 51; - } - else if (side == 1) - { - TileEntityMagicApiary tileInfo = (TileEntityMagicApiary)worldAccess.getBlockTileEntity(x, y, z); - if (tileInfo != null && tileInfo.isMaster()) - { - texture = 52; - } - else - { - texture = 51; - } - } - return texture; - } - - public int getBlockTextureFromSideAndMetadata(int side, int meta) - { - int texture = 50; - if (side == 0 || side == 1) - { - texture = 51; - } - return texture; - } - - @Override - public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving entity) - { - super.onBlockPlacedBy(world, x, y, z, entity); - - // Validate block arrangement - } -} diff --git a/thaumicbees_src/thaumicbees/block/LogicMagicApiary.java b/thaumicbees_src/thaumicbees/block/LogicMagicApiary.java deleted file mode 100644 index 21e4f91..0000000 --- a/thaumicbees_src/thaumicbees/block/LogicMagicApiary.java +++ /dev/null @@ -1,275 +0,0 @@ -package thaumicbees.block; - -import java.util.ArrayList; -import java.util.LinkedList; -import java.util.Queue; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.world.World; -import net.minecraft.world.biome.BiomeGenBase; -import net.mysteriousages.utils.GenericInventory; -import forestry.api.apiculture.BeeManager; -import forestry.api.apiculture.IBee; -import forestry.api.apiculture.IBeeGenome; -import forestry.api.apiculture.IBeeHousing; -import forestry.api.apiculture.IBeekeepingLogic; -import forestry.api.apiculture.IHiveFrame; -import forestry.api.core.EnumHumidity; -import forestry.api.core.EnumTemperature; -import thaumicbees.main.utils.compat.ForestryHelper; - -public class LogicMagicApiary implements IBeeHousing -{ - private TileEntityMagicApiary parent; - private String ownerName; - private BiomeGenBase biome; - private IBeekeepingLogic beeLogic; - private GenericInventory tileInventory; - private LinkedList inventoryOverflow; - - private static final int SLOT_ID_QUEEN = 0; - private static final int SLOT_ID_DRONE = 1; - private static final int SLOT_ID_FRAME = 2; - private static final int SLOT_LENGTH_FRAME = 2; - private static final int SLOT_ID_PRODUCE = 4; - private static final int SLOT_LENGTH_PRODUCE = 6; - - public LogicMagicApiary(TileEntityMagicApiary master) - { - this.parent = master; - this.beeLogic = BeeManager.breedingManager.createBeekeepingLogic(this); - this.tileInventory = new GenericInventory("MagicApiary", 11); - this.inventoryOverflow = new LinkedList(); - } - - public TileEntityMagicApiary getParent() - { - return parent; - } - - public void setOwner(EntityPlayer player) - { - this.ownerName = player.username; - } - - public String getOwner() - { - return this.ownerName; - } - - public void writeToNBT(NBTTagCompound tag) - { - NBTTagCompound beeTag = new NBTTagCompound(); - this.beeLogic.writeToNBT(beeTag); - tag.setTag("BeeLogic", beeTag); - tag.setString("Owner", this.ownerName); - NBTTagCompound inventory = new NBTTagCompound(); - this.tileInventory.writeToNBT(inventory); - tag.setTag("Inventory", inventory); - - if (this.inventoryOverflow.size() > 0) - { - NBTTagList overflow = new NBTTagList(); - for (int i = 0; i < this.inventoryOverflow.size(); ++i) - { - NBTTagCompound itemTag = new NBTTagCompound(); - this.inventoryOverflow.get(i).writeToNBT(itemTag); - overflow.appendTag(itemTag); - } - } - - } - - public void readFromNBT(NBTTagCompound tag) - { - - } - - @Override - public float getTerritoryModifier(IBeeGenome genome) - { - return 1f; - } - - @Override - public float getMutationModifier(IBeeGenome genome, IBeeGenome mate) - { - return 1f; - } - - @Override - public float getLifespanModifier(IBeeGenome genome, IBeeGenome mate) - { - return 1f; - } - - @Override - public float getProductionModifier(IBeeGenome genome) - { - return 2f; - } - - @Override - public float getFloweringModifier(IBeeGenome genome) - { - return 1f; - } - - @Override - public boolean isSealed() - { - return false; - } - - @Override - public boolean isSelfLighted() - { - return false; - } - - @Override - public boolean isSunlightSimulated() - { - return false; - } - - @Override - public boolean isHellish() - { - return false; - } - - @Override - public void onQueenChange(ItemStack queen) - { - // TODO Requires Network shenanegans. - } - - @Override - public void wearOutEquipment(int amount) - { - for (int i = SLOT_ID_FRAME; i < SLOT_ID_FRAME + SLOT_LENGTH_FRAME; ++i) - { - ItemStack e = this.tileInventory.getStackInSlot(i); - if (e != null && e.getItem() instanceof IHiveFrame) - { - this.tileInventory.setInventorySlotContents(i, - ((IHiveFrame) e.getItem()).frameUsed(this, e, - BeeManager.beeInterface.getBee(this.tileInventory.getStackInSlot(SLOT_ID_QUEEN)), - amount)); - } - } - - } - - // Does nothing in Forestry. - @Override - public void onQueenDeath(IBee queen) { } - - // Does nothing in Forestry. - @Override - public void onPostQueenDeath(IBee queen) { } - - @Override - public int getXCoord() - { - return parent.xCoord; - } - - @Override - public int getYCoord() - { - return parent.yCoord; - } - - @Override - public int getZCoord() - { - return parent.zCoord; - } - - @Override - public ItemStack getQueen() - { - return this.tileInventory.getStackInSlot(SLOT_ID_QUEEN); - } - - @Override - public ItemStack getDrone() - { - return this.tileInventory.getStackInSlot(SLOT_ID_DRONE); - } - - @Override - public void setQueen(ItemStack itemStack) - { - this.tileInventory.setInventorySlotContents(SLOT_ID_QUEEN, itemStack); - } - - @Override - public void setDrone(ItemStack itemStack) - { - this.tileInventory.setInventorySlotContents(SLOT_ID_DRONE, itemStack); - } - - @Override - public int getBiomeId() - { - return this.biome.biomeID; - } - - @Override - public EnumTemperature getTemperature() - { - return ForestryHelper.getEnumTemperatureFromValue(this.biome.temperature); - } - - @Override - public EnumHumidity getHumidity() - { - return ForestryHelper.getEnumHumidityFromValue(this.biome.rainfall); - } - - @Override - public World getWorld() - { - return this.getWorld(); - } - - @Override - public String getOwnerName() - { - return parent.getOwner(); - } - - @Override - public void setErrorState(int state) - { - // TODO Auto-generated method stub - - } - - @Override - public int getErrorOrdinal() - { - // TODO Auto-generated method stub - return 0; - } - - @Override - public boolean canBreed() - { - return true; - } - - @Override - public boolean addProduct(ItemStack product, boolean all) - { - // TODO Auto-generated method stub - return false; - } - -} diff --git a/thaumicbees_src/thaumicbees/block/TileEntityMagicApiary.java b/thaumicbees_src/thaumicbees/block/TileEntityMagicApiary.java deleted file mode 100644 index 73d1635..0000000 --- a/thaumicbees_src/thaumicbees/block/TileEntityMagicApiary.java +++ /dev/null @@ -1,97 +0,0 @@ -package thaumicbees.block; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import forestry.api.apiculture.IBee; -import forestry.api.apiculture.IBeeGenome; -import forestry.api.apiculture.IBeeHousing; -import forestry.api.core.EnumHumidity; -import forestry.api.core.EnumTemperature; - -public class TileEntityMagicApiary extends TileEntity -{ - private String owner; - private LogicMagicApiary logic; - private int masterX; - private int masterY; - private int masterZ; - - public TileEntityMagicApiary(World w) - { - this.setWorldObj(w); - } - - public void setValid(TileEntityMagicApiary masterEntity) - { - this.logic = masterEntity.logic; - this.masterX = masterEntity.xCoord; - this.masterY = masterEntity.yCoord; - this.masterZ = masterEntity.zCoord; - } - - public String getOwner() - { - return this.owner; - } - - public boolean isValidStructure() - { - return false; - } - - public boolean isMaster() - { - boolean flag = false; - - if (this.logic != null) - { - flag = this.logic.getParent() == this; - } - - return flag; - } - - public LogicMagicApiary getLogic() - { - return this.logic; - } - - @Override - public void readFromNBT(NBTTagCompound tagRoot) - { - super.readFromNBT(tagRoot); - this.owner = tagRoot.getString("Owner"); - if (tagRoot.hasKey("Logic")) - { - this.logic = new LogicMagicApiary(this); - this.logic.readFromNBT(tagRoot.getCompoundTag("Logic")); - } - else - { - this.masterX = tagRoot.getInteger("MasterX"); - this.masterY = tagRoot.getInteger("MasterY"); - this.masterZ = tagRoot.getInteger("MasterZ"); - } - } - - @Override - public void writeToNBT(NBTTagCompound tagRoot) - { - super.writeToNBT(tagRoot); - tagRoot.setString("Owner", this.owner); - if (this.isMaster()) - { - NBTTagCompound logicTag = new NBTTagCompound(); - this.logic.writeToNBT(logicTag); - tagRoot.setTag("Logic", logicTag); - } - else - { - tagRoot.setInteger("MasterX", this.masterX); - tagRoot.setInteger("MasterY", this.masterY); - tagRoot.setInteger("MasterZ", this.masterZ); - } - } -} diff --git a/thaumicbees_src/thaumicbees/main/Config.java b/thaumicbees_src/thaumicbees/main/Config.java index 0f879b5..ae508b5 100644 --- a/thaumicbees_src/thaumicbees/main/Config.java +++ b/thaumicbees_src/thaumicbees/main/Config.java @@ -208,7 +208,7 @@ public class Config catch (Exception e) { FMLLog.severe("ThaumicBees encountered a problem during loading!"); - throw new RuntimeException("Could not register backpacks via Forestry. Check your FML Client log and see if Forestry crashed silently.", e); + FMLLog.severe("Could not register backpacks via Forestry. Check your FML Client log and see if Forestry crashed silently."); }