Update to forestry 3.6 API.

Adds Aura node Recharge effect.
This commit is contained in:
MysteriousAges committed 2015-09-03 16:17:05 -07:00
1 parent 922a8fffd6
commit 4c93eb6bf4
16 files changed
+317 -83

No files matched your search

+4
View File
@@ -4,6 +4,7 @@ import magicbees.api.MagicBeesAPI;
import magicbees.bees.allele.effect.AlleleEffectCrumbling;
import magicbees.bees.allele.effect.AlleleEffectCure;
import magicbees.bees.allele.effect.AlleleEffectPotion;
import magicbees.bees.allele.effect.AlleleEffectRecharge;
import magicbees.bees.allele.effect.AlleleEffectSpawnMob;
import magicbees.bees.allele.effect.AlleleEffectSpawnMobWeighted;
import magicbees.bees.allele.effect.AlleleEffectSpawnWisp;
@@ -47,6 +48,7 @@ public class Allele implements IAllele {
public static IAlleleEffect effectMoveSpeed;
public static IAlleleEffect effectSlowSpeed;
public static IAlleleEffect effectWithering;
public static IAlleleEffect effectVisRecharge;
public static IAlleleEffect effectTransmuting;
public static IAlleleEffect effectCrumbling;
public static IAlleleEffect effectInvisibility;
@@ -73,6 +75,8 @@ public class Allele implements IAllele {
if (ThaumcraftHelper.isActive()) {
Allele.flowerThaumcraft = new AlleleFlower("ThaumcraftPlant", new FlowerProviderThaumcraftFlower(), false);
Allele.flowerAuraNode = new AlleleFlower("AuraNode", new FlowerProviderAuraNode(), true);
Allele.effectVisRecharge = new AlleleEffectRecharge("VisRecharge", false);
Allele.spawnBrainyZombie = new AlleleEffectSpawnMob("Brainy", false, ThaumcraftHelper.Entity.BRAINY_ZOMBIE.entityID)
.setAggrosPlayerOnSpawn()
@@ -894,7 +894,7 @@ public class BeeGenomeManager {
IAllele[] genome = getTemplateTCBaseVis();
genome[EnumBeeChromosome.SPECIES.ordinal()] = BeeSpecies.TC_REJUVENATING;
//genome[EnumBeeChromosome.EFFECT.ordinal()] = Allele.effectNodeCharge;
genome[EnumBeeChromosome.EFFECT.ordinal()] = Allele.effectVisRecharge;
genome[EnumBeeChromosome.FLOWER_PROVIDER.ordinal()] = Allele.flowerAuraNode;
genome[EnumBeeChromosome.HUMIDITY_TOLERANCE.ordinal()] = Allele.getBaseAllele("toleranceNone");
@@ -231,17 +231,17 @@ public class BeeMutation implements IBeeMutation {
if (ThaumcraftHelper.isActive()) {
new BeeMutation(BeeSpecies.WINDY, BeeSpecies.WINDY, BeeSpecies.TC_AIR, 8)
.setBlockAndMetaRequired(Config.tcCrystal, ThaumcraftHelper.ShardType.AIR.ordinal());
.setBlockAndMetaRequired(ThaumcraftHelper.crystal, ThaumcraftHelper.ShardType.AIR.ordinal());
new BeeMutation(BeeSpecies.FIREY, BeeSpecies.FIREY, BeeSpecies.TC_FIRE, 8)
.setBlockAndMetaRequired(Config.tcCrystal, ThaumcraftHelper.ShardType.FIRE.ordinal());
.setBlockAndMetaRequired(ThaumcraftHelper.crystal, ThaumcraftHelper.ShardType.FIRE.ordinal());
new BeeMutation(BeeSpecies.WATERY, BeeSpecies.WATERY, BeeSpecies.TC_WATER, 8)
.setBlockAndMetaRequired(Config.tcCrystal, ThaumcraftHelper.ShardType.WATER.ordinal());
.setBlockAndMetaRequired(ThaumcraftHelper.crystal, ThaumcraftHelper.ShardType.WATER.ordinal());
new BeeMutation(BeeSpecies.EARTHY, BeeSpecies.EARTHY, BeeSpecies.TC_EARTH, 8)
.setBlockAndMetaRequired(Config.tcCrystal, ThaumcraftHelper.ShardType.EARTH.ordinal());
.setBlockAndMetaRequired(ThaumcraftHelper.crystal, ThaumcraftHelper.ShardType.EARTH.ordinal());
new BeeMutation(BeeSpecies.ETHEREAL, BeeSpecies.ARCANE, BeeSpecies.TC_ORDER, 8)
.setBlockAndMetaRequired(Config.tcCrystal, ThaumcraftHelper.ShardType.ORDER.ordinal());
.setBlockAndMetaRequired(ThaumcraftHelper.crystal, ThaumcraftHelper.ShardType.ORDER.ordinal());
new BeeMutation(BeeSpecies.ETHEREAL, BeeSpecies.SUPERNATURAL, BeeSpecies.TC_CHAOS, 8)
.setBlockAndMetaRequired(Config.tcCrystal, ThaumcraftHelper.ShardType.CHAOS.ordinal());
.setBlockAndMetaRequired(ThaumcraftHelper.crystal, ThaumcraftHelper.ShardType.CHAOS.ordinal());
new BeeMutation(BeeSpecies.SKULKING, BeeSpecies.WINDY, BeeSpecies.TC_BATTY, 9);
new BeeMutation(BeeSpecies.SKULKING, BeeSpecies.PUPIL, BeeSpecies.TC_BRAINY, 9);
@@ -273,10 +273,10 @@ public class BeeProductHelper {
TC_ORDER.addSpecialty(Config.propolis.getStackForType(PropolisType.ORDER), 0.18f);
TC_CHAOS.addSpecialty(Config.propolis.getStackForType(PropolisType.CHAOS), 0.18f);
TC_BRAINY.addSpecialty(new ItemStack(Config.tcMiscResource, 1, ThaumcraftHelper.MiscResource.ZOMBIE_BRAIN.ordinal()), 0.2f);
TC_CHICKEN.addSpecialty(new ItemStack(Config.tcNuggetChicken, 1), 0.9f);
TC_BEEF.addSpecialty(new ItemStack(Config.tcNuggetBeef, 1), 0.9f);
TC_PORK.addSpecialty(new ItemStack(Config.tcNuggetPork, 1), 0.9f);
TC_BRAINY.addSpecialty(new ItemStack(ThaumcraftHelper.miscResource, 1, ThaumcraftHelper.MiscResource.ZOMBIE_BRAIN.ordinal()), 0.2f);
TC_CHICKEN.addSpecialty(new ItemStack(ThaumcraftHelper.nuggetChicken, 1), 0.9f);
TC_BEEF.addSpecialty(new ItemStack(ThaumcraftHelper.nuggetBeef, 1), 0.9f);
TC_PORK.addSpecialty(new ItemStack(ThaumcraftHelper.nuggetPork, 1), 0.9f);
}
}
+15 -7
View File
@@ -478,7 +478,7 @@ public enum BeeSpecies implements IAlleleBeeSpecies, IIconProvider
// These species should be fixed. ¯\_(ツ)_/¯
TC_TAINT.setInactive();
TC_ATTRACT.setInactive();
TC_REJUVENATING.setInactive();
//TC_REJUVENATING.setInactive();
BeeProductHelper.initEquivalentExchange3Species();
if (!EquivalentExchangeHelper.isActive()) {
@@ -556,7 +556,11 @@ public enum BeeSpecies implements IAlleleBeeSpecies, IIconProvider
private boolean isNocturnal;
private IClassification branch;
private HashMap<ItemStack, Float> products;
@Deprecated
private HashMap<ItemStack, Integer> oldProducts;
private HashMap<ItemStack, Float> specialties;
@Deprecated
private HashMap<ItemStack, Integer> oldSpecialties;
private IAllele genomeTemplate[];
private String uid;
private boolean dominant;
@@ -604,7 +608,9 @@ public enum BeeSpecies implements IAlleleBeeSpecies, IIconProvider
isSecret = isSpeciesSecret;
isCounted = isSpeciesCounted;
products = new HashMap<ItemStack, Float>();
oldProducts = new HashMap<ItemStack, Integer>();
specialties = new HashMap<ItemStack, Float>();
oldSpecialties = new HashMap<ItemStack, Integer>();
this.branch = classification;
this.branch.addMemberSpecies(this);
this.isNocturnal = isSpeciesNocturnal;
@@ -617,23 +623,25 @@ public enum BeeSpecies implements IAlleleBeeSpecies, IIconProvider
@Deprecated
public BeeSpecies addProduct(ItemStack produce, int percentChance) {
products.put(produce, percentChance / 100f);
return this;
// Don't use this plz.
return null;
}
public BeeSpecies addProduct(ItemStack produce, float chance) {
products.put(produce, chance);
oldProducts.put(produce, (int)(chance * 100));
return this;
}
@Deprecated
public BeeSpecies addSpecialty(ItemStack produce, int percentChance) {
specialties.put(produce, percentChance / 100f);
return this;
// Don't use this plz.
return null;
}
public BeeSpecies addSpecialty(ItemStack produce, float chance) {
specialties.put(produce, chance);
oldSpecialties.put(produce, (int)(chance * 100));
return this;
}
@@ -719,13 +727,13 @@ public enum BeeSpecies implements IAlleleBeeSpecies, IIconProvider
@Override
@Deprecated
public HashMap<ItemStack, Integer> getProducts() {
return null;
return oldProducts;
}
@Override
@Deprecated
public HashMap<ItemStack, Integer> getSpecialty() {
return null;
return oldSpecialties;
}
@Override
@@ -0,0 +1,45 @@
package magicbees.bees.allele.effect;
import java.util.List;
import magicbees.bees.AlleleEffect;
import magicbees.main.utils.BlockUtil;
import magicbees.main.utils.compat.thaumcraft.NodeHelper;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.genetics.IEffectData;
public class AlleleEffectRecharge extends AlleleEffect {
private int range;
public AlleleEffectRecharge(String id, boolean isDominant) {
super(id, isDominant, 10);
range = 20;
}
@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();
int xCoord = housing.getXCoord();
int yCoord = housing.getYCoord();
int zCoord = housing.getZCoord();
List<Chunk> chunks = BlockUtil.getChunksInSearchRange(world, xCoord, zCoord, range);
if (NodeHelper.rechargeNodeInRange(chunks, world, xCoord, yCoord, zCoord, range)) {
storedData.setInteger(0, storedData.getInteger(0) - throttle);
}
return storedData;
}
}
@@ -4,8 +4,11 @@ import java.util.ArrayList;
import java.util.List;
import magicbees.main.utils.LocalizationManager;
import magicbees.main.utils.compat.ThaumcraftHelper;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
import forestry.api.genetics.IFlower;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.IPollinatable;
@@ -13,11 +16,20 @@ import forestry.api.genetics.IPollinatable;
public class FlowerProviderAuraNode extends FlowerProvider {
public FlowerProviderAuraNode() {
super(0);
super(2);
flowers.add(new FlowerImpl(ThaumcraftHelper.airy, ThaumcraftHelper.AiryBlockType.NODE.ordinal(), 1, false));
flowers.add(new FlowerImpl(ThaumcraftHelper.airy, ThaumcraftHelper.AiryBlockType.ENERGIZED_NODE.ordinal(), 1, false));
}
@Override
public boolean isAcceptedFlower(World world, IIndividual genome, int x, int y, int z) {
Block block = world.getBlock(x, y, z);
int meta = world.getBlockMetadata(x, y, z);
for (IFlower flower : flowers) {
if (flower.getBlock() == block && (flower.getMeta() == OreDictionary.WILDCARD_VALUE || flower.getMeta() == meta)) {
return true;
}
}
return false;
}
@@ -1,6 +1,5 @@
package magicbees.bees.allele.flowerProvider;
import magicbees.main.Config;
import magicbees.main.utils.LocalizationManager;
import magicbees.main.utils.compat.ThaumcraftHelper;
import net.minecraft.block.Block;
@@ -14,13 +13,13 @@ public class FlowerProviderThaumcraftFlower extends FlowerProvider {
public FlowerProviderThaumcraftFlower() {
super(2);
flowers.add(new FlowerImpl(Config.tcPlant, ThaumcraftHelper.BlockPlant.SHIMMERLEAF.ordinal(), 1, true));
flowers.add(new FlowerImpl(Config.tcPlant, ThaumcraftHelper.BlockPlant.CINDERPEARL.ordinal(), 1, true));
flowers.add(new FlowerImpl(ThaumcraftHelper.plant, ThaumcraftHelper.BlockPlant.SHIMMERLEAF.ordinal(), 1, true));
flowers.add(new FlowerImpl(ThaumcraftHelper.plant, ThaumcraftHelper.BlockPlant.CINDERPEARL.ordinal(), 1, true));
}
@Override
public boolean isAcceptedFlower(World world, IIndividual genome, int x, int y, int z) {
if (world.getBlock(x, y, z) == Config.tcPlant) {
if (world.getBlock(x, y, z) == ThaumcraftHelper.plant) {
int meta = world.getBlockMetadata(x, y, z);
if (meta == ThaumcraftHelper.BlockPlant.SHIMMERLEAF.ordinal()
|| meta == ThaumcraftHelper.BlockPlant.CINDERPEARL.ordinal()) {
@@ -36,10 +35,10 @@ public class FlowerProviderThaumcraftFlower extends FlowerProvider {
Block blockDown = world.getBlock(x, y - 1, z);
if (world.getBlock(x, y, z).isAir(world, x, y, z)) {
if (blockDown == Blocks.dirt || blockDown == Blocks.grass) {
world.setBlock(x, y, z, Config.tcPlant, ThaumcraftHelper.BlockPlant.SHIMMERLEAF.ordinal(), 2);
world.setBlock(x, y, z, ThaumcraftHelper.plant, ThaumcraftHelper.BlockPlant.SHIMMERLEAF.ordinal(), 2);
flag = true;
} else if (blockDown == Blocks.sand) {
world.setBlock(x, y, z, Config.tcPlant, ThaumcraftHelper.BlockPlant.CINDERPEARL.ordinal(), 2);
world.setBlock(x, y, z, ThaumcraftHelper.plant, ThaumcraftHelper.BlockPlant.CINDERPEARL.ordinal(), 2);
flag = true;
}
}
@@ -29,7 +29,7 @@ public class ItemGrafter extends Item implements IToolGrafter {
public boolean onBlockDestroyed(ItemStack itemstack, World world, Block block, int x, int y, int z, EntityLivingBase entityLiving) {
int damage = 1;
if (ThaumcraftHelper.isActive()) {
if (block == Config.tcLeaf)
if (block == ThaumcraftHelper.leaf)
{
int meta = world.getBlockMetadata(x, y, z) & 1;
if (meta == 0 || meta == 1)
@@ -37,7 +37,7 @@ public class ItemGrafter extends Item implements IToolGrafter {
double chance = Math.random();
if (chance <= Config.thaumcraftSaplingDroprate)
{
this.dropItem(world, x, y, z, new ItemStack(Config.tcPlant, 1, meta));
this.dropItem(world, x, y, z, new ItemStack(ThaumcraftHelper.plant, 1, meta));
}
}
}
+1 -23
View File
@@ -157,29 +157,6 @@ public class Config
public static Item fHoneydew;
public static Item fHoneyDrop;
public static Item fPollen;
public static Item fCraftingResource;
//----- Thaumcraft Blocks ----------------------------------
public static Block tcPlant;
public static Block tcCandle;
public static Block tcCrystal;
public static Block tcMarker;
public static Block tcJar;
public static Block tcLog;
public static Block tcLeaf;
public static Block tcWarded;
public static Block tcWooden;
public static Block tcMetal;
//----- Thaumcraft Items -----------------------------------
public static Item tcFilledJar;
public static Item tcMiscResource;
//public static Item tcEssentiaBottle;
public static Item tcShard;
public static Item tcGolem;
//public static Item tcWispEssence;
public static Item tcNuggets;
public static Item tcNuggetChicken;
public static Item tcNuggetBeef;
public static Item tcNuggetPork;
//----- Equivalent Exchange Blocks -------------------------
//----- Equivalent Exchange Items --------------------------
public static Item eeMinuimShard;
@@ -217,6 +194,7 @@ public class Config
//----- Config State info ----------------------------------
public static Configuration configuration;
public static Item fCraftingResource;
public Config(File configFile)
{
@@ -1,7 +1,11 @@
package magicbees.main.utils;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
public class BlockUtil {
@@ -52,4 +56,21 @@ public class BlockUtil {
Block block = world.getBlock(x, y, z);
return block.isReplaceableOreGen(world, x, y, z, target);
}
public static List<Chunk> getChunksInSearchRange(World world, int xCoord, int zCoord, int searchRadius) {
List<Chunk> searchChunks = new ArrayList<Chunk>();
int chunkRange = (int)Math.ceil(searchRadius / 16.0);
int minChunkX = xCoord / 16 - chunkRange;
int maxChunkX = xCoord / 16 + chunkRange;
int minChunkZ = zCoord / 16 - chunkRange;
int maxChunkZ = zCoord / 16 + chunkRange;
for (int chunkX = minChunkX; chunkX <= maxChunkX; ++chunkX) {
for (int chunkZ = minChunkZ; chunkZ <= maxChunkZ; ++chunkZ) {
searchChunks.add(world.getChunkFromChunkCoords(chunkX, chunkZ));
}
}
return searchChunks;
}
}
@@ -373,7 +373,7 @@ public class CraftingManager {
if (ThaumcraftHelper.isActive()) {
input = Config.miscResources.getStackForType(ResourceType.LORE_FRAGMENT);
output = new ItemStack(Config.tcMiscResource, 1, ThaumcraftHelper.MiscResource.KNOWLEDGE_FRAGMENT.ordinal());
output = new ItemStack(ThaumcraftHelper.miscResource, 1, ThaumcraftHelper.MiscResource.KNOWLEDGE_FRAGMENT.ordinal());
GameRegistry.addShapelessRecipe(output,
input, input, input, input
);
@@ -384,7 +384,7 @@ public class CraftingManager {
"SWS", "NCN", "SWS",
'S', Items.string,
'W', Blocks.wool,
'N', new ItemStack(Config.tcMiscResource, 1, ThaumcraftHelper.MiscResource.AMBER.ordinal()),
'N', new ItemStack(ThaumcraftHelper.miscResource, 1, ThaumcraftHelper.MiscResource.AMBER.ordinal()),
'C', Blocks.chest
);
}
@@ -14,11 +14,14 @@ import magicbees.main.Config;
import magicbees.main.utils.BlockInterface;
import magicbees.main.utils.ItemInterface;
import magicbees.main.utils.LocalizationManager;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.ShapelessRecipes;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import thaumcraft.api.ThaumcraftApi;
import thaumcraft.api.aspects.Aspect;
@@ -106,6 +109,16 @@ public class ThaumcraftHelper {
BANNER,
;
}
public enum AiryBlockType {
NODE,
NITOR,
_2,
_3,
WARDING_STONE_FENCE,
ENERGIZED_NODE,
;
}
public enum Entity {
BRAINY_ZOMBIE("entBrainyZombie", "EntityBrainyZombie"),
@@ -145,6 +158,33 @@ public class ThaumcraftHelper {
;
}
public static Block plant;
public static Block candle;
public static Block crystal;
public static Block marker;
public static Block jar;
public static Block log;
public static Block leaf;
public static Block warded;
public static Block wooden;
public static Block metal;
public static Block airy;
public static Block fluxGas;
public static Block fluxGoo;
public static Item filledJar;
public static Item miscResource;
//public static Item tcEssentiaBottle;
public static Item shard;
public static Item golem;
//public static Item tcWispEssence;
public static Item nuggetMetal;
public static Item nuggetChicken;
public static Item nuggetBeef;
public static Item nuggetPork;
public static Class<? extends TileEntity> nodeClass;
public static final String Name = "Thaumcraft";
private static boolean isThaumcraftPresent = false;
@@ -184,6 +224,12 @@ public class ThaumcraftHelper {
setupItemAspects();
setupCrafting();
setupResearch();
try {
nodeClass = (Class<? extends TileEntity>) Class.forName("thaumcraft.common.tiles.TileNode");
} catch (Throwable e) {
e.printStackTrace();
}
}
}
@@ -204,64 +250,65 @@ public class ThaumcraftHelper {
private static Object visAuraProvider;
private static void getBlocks() {
Config.tcPlant = BlockInterface.getBlock(Name, "blockCustomPlant");
Config.tcCandle = BlockInterface.getBlock(Name, "blockCandle");
Config.tcCrystal = BlockInterface.getBlock(Name, "blockCrystal");
Config.tcMarker = BlockInterface.getBlock(Name, "blockMarker");
Config.tcJar = BlockInterface.getBlock(Name, "blockJar");
Config.tcLog = BlockInterface.getBlock(Name, "blockMagicalLog");
Config.tcLeaf = BlockInterface.getBlock(Name, "blockMagicalLeaves");
Config.tcWarded = BlockInterface.getBlock(Name, "blockWarded");
Config.tcWooden = BlockInterface.getBlock(Name, "blockWoodenDevice");
Config.tcMetal = BlockInterface.getBlock(Name, "blockMetalDevice");
plant = BlockInterface.getBlock(Name, "blockCustomPlant");
candle = BlockInterface.getBlock(Name, "blockCandle");
crystal = BlockInterface.getBlock(Name, "blockCrystal");
marker = BlockInterface.getBlock(Name, "blockMarker");
jar = BlockInterface.getBlock(Name, "blockJar");
log = BlockInterface.getBlock(Name, "blockMagicalLog");
leaf = BlockInterface.getBlock(Name, "blockMagicalLeaves");
warded = BlockInterface.getBlock(Name, "blockWarded");
wooden = BlockInterface.getBlock(Name, "blockWoodenDevice");
metal = BlockInterface.getBlock(Name, "blockMetalDevice");
airy = BlockInterface.getBlock(Name, "blockAiry");
}
private static void getItems() {
Config.tcFilledJar = ItemInterface.getItem(Name, "BlockJarFilledItem");
Config.tcMiscResource = ItemInterface.getItem(Name, "ItemResource");
filledJar = ItemInterface.getItem(Name, "BlockJarFilledItem");
miscResource = ItemInterface.getItem(Name, "ItemResource");
// Config.tcEssentiaBottle = ItemInterface.getItem(Name,
// "BlockJarFilledItem");
Config.tcShard = ItemInterface.getItem(Name, "ItemShard");
Config.tcGolem = ItemInterface.getItem(Name, "ItemGolemPlacer");
shard = ItemInterface.getItem(Name, "ItemShard");
golem = ItemInterface.getItem(Name, "ItemGolemPlacer");
// Config.tcWispEssence = ItemApi.getItem("itemWispEssence",
// 0).getItem();
Config.tcNuggets = ItemInterface.getItem(Name, "ItemNugget");
Config.tcShard = ItemInterface.getItem(Name, "ItemShard");
Config.tcNuggetChicken = ItemInterface.getItem(Name,
nuggetMetal = ItemInterface.getItem(Name, "ItemNugget");
shard = ItemInterface.getItem(Name, "ItemShard");
nuggetChicken = ItemInterface.getItem(Name,
"ItemNuggetChicken");
Config.tcNuggetBeef = ItemInterface.getItem(Name, "ItemNuggetBeef");
Config.tcNuggetPork = ItemInterface.getItem(Name, "ItemNuggetPork");
nuggetBeef = ItemInterface.getItem(Name, "ItemNuggetBeef");
nuggetPork = ItemInterface.getItem(Name, "ItemNuggetPork");
}
private static void setupCrafting() {
ItemStack input, output;
input = Config.miscResources.getStackForType(ResourceType.TC_DUST_AIR);
output = new ItemStack(Config.tcShard, 1, ShardType.AIR.ordinal());
output = new ItemStack(shard, 1, ShardType.AIR.ordinal());
GameRegistry.addShapelessRecipe(output, input, input, input, input);
input = Config.miscResources
.getStackForType(ResourceType.TC_DUST_WATER);
output = new ItemStack(Config.tcShard, 1, ShardType.WATER.ordinal());
output = new ItemStack(shard, 1, ShardType.WATER.ordinal());
GameRegistry.addShapelessRecipe(output, input, input, input, input);
input = Config.miscResources.getStackForType(ResourceType.TC_DUST_FIRE);
output = new ItemStack(Config.tcShard, 1, ShardType.FIRE.ordinal());
output = new ItemStack(shard, 1, ShardType.FIRE.ordinal());
GameRegistry.addShapelessRecipe(output, input, input, input, input);
input = Config.miscResources
.getStackForType(ResourceType.TC_DUST_EARTH);
output = new ItemStack(Config.tcShard, 1, ShardType.EARTH.ordinal());
output = new ItemStack(shard, 1, ShardType.EARTH.ordinal());
GameRegistry.addShapelessRecipe(output, input, input, input, input);
input = Config.miscResources
.getStackForType(ResourceType.TC_DUST_ORDER);
output = new ItemStack(Config.tcShard, 1, ShardType.ORDER.ordinal());
output = new ItemStack(shard, 1, ShardType.ORDER.ordinal());
GameRegistry.addShapelessRecipe(output, input, input, input, input);
input = Config.miscResources
.getStackForType(ResourceType.TC_DUST_CHAOS);
output = new ItemStack(Config.tcShard, 1, ShardType.CHAOS.ordinal());
output = new ItemStack(shard, 1, ShardType.CHAOS.ordinal());
GameRegistry.addShapelessRecipe(output, input, input, input, input);
thaumScoop = ThaumcraftApi.addArcaneCraftingRecipe("MB_Scoop", new ItemStack(Config.thaumiumScoop),
@@ -269,28 +316,28 @@ public class ThaumcraftHelper {
"sWs", "sTs", " T ",
's', Items.stick,
'W', Blocks.wool,
'T', new ItemStack(Config.tcMiscResource, 1, MiscResource.THAUMIUM.ordinal()) });
'T', new ItemStack(miscResource, 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', new ItemStack(miscResource, 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()) });
'C', new ItemStack(miscResource, 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()),
'g', new ItemStack(wooden, 1, WoodenDeviceType.PLANKS_GREATWOOD.ordinal()),
'v', new ItemStack(metal, 1, MetalDeviceType.VIS_RELAY.ordinal()),
'p', Config.pollen.getStackForType(PollenType.UNUSUAL)});
essenceLife = ThaumcraftApi.addCrucibleRecipe("MB_EssenceLife", Config.miscResources.getStackForType(ResourceType.ESSENCE_FALSE_LIFE),
@@ -368,7 +415,7 @@ public class ThaumcraftHelper {
list.add(Config.miscResources.getStackForType(ResourceType.LORE_FRAGMENT));
list.add(Config.miscResources.getStackForType(ResourceType.LORE_FRAGMENT));
list.add(Config.miscResources.getStackForType(ResourceType.LORE_FRAGMENT));
recipe = new ShapelessRecipes(new ItemStack(Config.tcMiscResource, 1,
recipe = new ShapelessRecipes(new ItemStack(miscResource, 1,
MiscResource.KNOWLEDGE_FRAGMENT.ordinal()), list);
new ResearchItem("MB_LoreFragment", category,
@@ -0,0 +1,114 @@
package magicbees.main.utils.compat.thaumcraft;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Vec3;
import net.minecraft.world.ChunkPosition;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.nodes.INode;
public class NodeHelper {
@SuppressWarnings("unchecked")
public static INode findNode(Chunk chunk, int x, int y, int z, int range) {
Vec3 apiaryPos = Vec3.createVectorHelper(x, y, z);
List<TileEntity> tileEntities = new ArrayList<TileEntity>(((Map<ChunkPosition, TileEntity>)chunk.chunkTileEntityMap).values());
Collections.shuffle(tileEntities);
for (TileEntity entity : tileEntities) {
if (entity instanceof INode) {
Vec3 tePos = Vec3.createVectorHelper(entity.xCoord, entity.yCoord, entity.zCoord);
Vec3 result = apiaryPos.subtract(tePos);
if (result.lengthVector() <= range) {
return (INode)entity;
}
}
}
return null;
}
public static boolean rechargeNodeInRange(List<Chunk> chunks, World world, int xCoord, int yCoord, int zCoord, int range) {
Collections.shuffle(chunks);
for (Chunk chunk : chunks) {
INode nearestNode = findNode(chunk, xCoord, yCoord, zCoord, range);
boolean nodeChanged = false;
if (nearestNode != null) {
AspectList baseAspects = nearestNode.getAspectsBase().copy();
AspectList currentAspects = nearestNode.getAspects().copy();
for (Aspect aspect : nearestNode.getAspects().getAspects()) {
int diff = baseAspects.getAmount(aspect) - currentAspects.getAmount(aspect);
if (1 < diff) {
nearestNode.addToContainer(aspect, world.rand.nextInt(diff - 1) + 1);
nodeChanged = true;
}
else if (diff == 1) {
nearestNode.addToContainer(aspect, 1);
nodeChanged = true;
}
}
if (nodeChanged) {
updateNode(nearestNode, world);
}
return true;
}
}
return false;
}
public static boolean growNodeInRange(List<Chunk> chunks, World world, int xCoord, int yCoord, int zCoord, int range) {
Collections.shuffle(chunks);
for (Chunk chunk : chunks) {
INode nearestNode = findNode(chunk, xCoord, yCoord, zCoord, range);
if (nearestNode != null) {
Aspect aspectToAdd;
if (0.55f <= world.rand.nextFloat()) {
List<Aspect> aspects = new ArrayList<Aspect>(Aspect.aspects.values());
aspectToAdd = aspects.get(world.rand.nextInt(aspects.size()));
}
else {
switch (world.rand.nextInt(6)) {
default:
case 0:
aspectToAdd = Aspect.EARTH;
break;
case 1:
aspectToAdd = Aspect.WATER;
break;
case 2:
aspectToAdd = Aspect.FIRE;
break;
case 3:
aspectToAdd = Aspect.AIR;
break;
case 4:
aspectToAdd = Aspect.ORDER;
break;
case 5:
aspectToAdd = Aspect.ENTROPY;
break;
}
}
nearestNode.setNodeVisBase(aspectToAdd, (short)(1 + world.rand.nextInt(2)));
updateNode(nearestNode, world);
return true;
}
}
return false;
}
private static void updateNode(INode nearestNode, World world) {
if (nearestNode instanceof TileEntity) {
TileEntity tile = (TileEntity)nearestNode;
tile.markDirty();
world.markBlockForUpdate(tile.xCoord, tile.yCoord, tile.zCoord);
}
}
}