Skip to content

Commit 8272d28

Browse files
committed
Updated for Thaumcraft 4.1
1 parent e85734d commit 8272d28

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1440
-343
lines changed

forge2/src/main/java/flaxbeard/thaumicexploration/ThaumicExploration.java

+41-11
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,13 @@
1919
import net.minecraft.entity.EnumCreatureType;
2020
import net.minecraft.item.EnumArmorMaterial;
2121
import net.minecraft.item.Item;
22+
import net.minecraft.item.ItemReed;
2223
import net.minecraft.item.ItemStack;
2324
import net.minecraft.potion.Potion;
2425
import net.minecraft.util.ResourceLocation;
2526
import net.minecraft.world.biome.BiomeGenBase;
26-
import net.minecraftforge.client.event.sound.SoundLoadEvent;
2727
import net.minecraftforge.common.Configuration;
2828
import net.minecraftforge.common.MinecraftForge;
29-
import net.minecraftforge.event.ForgeSubscribe;
3029
import net.minecraftforge.oredict.OreDictionary;
3130

3231
import org.apache.commons.lang3.tuple.MutablePair;
@@ -79,6 +78,8 @@
7978
import flaxbeard.thaumicexploration.item.ItemFoodTalisman;
8079
import flaxbeard.thaumicexploration.item.ItemTXArmorSpecial;
8180
import flaxbeard.thaumicexploration.item.ItemTXArmorSpecialDiscount;
81+
import flaxbeard.thaumicexploration.item.ItemTXRuneCometBoots;
82+
import flaxbeard.thaumicexploration.item.ItemTXRuneMeteorBoots;
8283
import flaxbeard.thaumicexploration.item.ItemTaintSeedFood;
8384
import flaxbeard.thaumicexploration.item.focus.ItemFocusNecromancy;
8485
import flaxbeard.thaumicexploration.misc.FauxAspect;
@@ -97,6 +98,8 @@
9798
import flaxbeard.thaumicexploration.tile.TileEntityReplicator;
9899
import flaxbeard.thaumicexploration.tile.TileEntityThinkTank;
99100
import flaxbeard.thaumicexploration.wand.WandRodAmberOnUpdate;
101+
import flaxbeard.thaumicexploration.wand.WandRodBreadOnUpdate;
102+
import flaxbeard.thaumicexploration.wand.WandRodNecromancerOnUpdate;
100103
import flaxbeard.thaumicexploration.wand.WandRodTransmutationOnUpdate;
101104

102105

@@ -124,16 +127,26 @@ public class ThaumicExploration {
124127
public static int transmutationCoreID;
125128
public static Item amberCore;
126129
public static int amberCoreID;
130+
public static Item necroCore;
131+
public static int necroCoreID;
132+
public static Item breadCore;
133+
public static int breadCoreID;
127134

128135
public static EnumArmorMaterial armorMaterialCrystal;
129136
public static Item maskEvil;
130137
public static int maskEvilID;
131138
public static Item focusNecromancy;
132139
public static int focusNecromancyID;
140+
133141
public static Item bootsMeteor;
134142
public static int bootsMeteorID;
135143
public static Item bootsComet;
136144
public static int bootsCometID;
145+
public static Item runicBootsMeteor;
146+
public static int runicBootsMeteorID;
147+
public static Item runicBootsComet;
148+
public static int runicBootsCometID;
149+
137150
public static Item charmNoTaint;
138151
public static int charmNoTaintID;
139152
public static Item charmTaint;
@@ -144,6 +157,9 @@ public class ThaumicExploration {
144157
public static Item taintBerry;
145158
public static int taintBerryID;
146159

160+
public static Item itemAltar;
161+
public static int itemAltarID;
162+
147163
public static Block boundChest;
148164
public static int boundChestID;
149165
public static Block boundJar;
@@ -170,6 +186,8 @@ public class ThaumicExploration {
170186
public static int skullCandleID;
171187
public static WandRod WAND_ROD_CRYSTAL;
172188
public static WandRod WAND_ROD_AMBER;
189+
public static WandRod WAND_ROD_NECRO;
190+
public static WandRod WAND_ROD_BREAD;
173191

174192
public WorldGenTX worldGen;
175193

@@ -200,6 +218,7 @@ public class ThaumicExploration {
200218

201219
public static boolean brainsGolem;
202220
public static boolean taintBloom;
221+
public static boolean breadWand;
203222

204223
public static int potionBindingID;
205224
public static int potionTaintWithdrawlID;
@@ -271,6 +290,11 @@ public void preInit(FMLPreInitializationEvent event) {
271290
taintBerryID = config.getItem("Taintberry", 11015).getInt();
272291
talismanFoodID = config.getItem("Talisman of Nourishment", 11013).getInt();
273292
focusNecromancyID = config.getItem("Focus of Necromancy", 11009).getInt();
293+
necroCoreID = config.getItem("Necromancer's Wand Core", 11016).getInt();
294+
breadCoreID = config.getItem("Baguette Wand Core", 11020).getInt();
295+
itemAltarID = config.getItem("Necromantic Pedestal (Item)", 11017).getInt();
296+
runicBootsMeteorID = config.getItem("Runic Boots of the Meteor", 11018).getInt();
297+
runicBootsCometID = config.getItem("Runic Boots of the Comet", 11019).getInt();
274298

275299
//Block IDs
276300
boundChestID = config.getBlock("Bound Chest", 700).getInt();
@@ -295,6 +319,7 @@ public void preInit(FMLPreInitializationEvent event) {
295319

296320
//allowOsmotic = config.get("Miscellaneous", "Add new enchantments to Thaumic Tinkerer's Osmotic Enchanter (Requires TT Build 72+)", true).getBoolean(true);
297321
prefix = config.get("Miscellaneous", "Display [TX] prefix before Thaumic Exploration research", true).getBoolean(true);
322+
breadWand = config.get("Easter Eggs", "Enable Thaumic Frenchurgy", false).getBoolean(true);
298323
brainsGolem = config.get("Miscellaneous", "Use Purified Brains in advanced golems", true).getBoolean(true);
299324
taintBloom = config.get("Miscellaneous", "Move the Etheral Bloom to the Tainturgy tab", true).getBoolean(true);
300325
allowBoundInventories = config.get("Miscellaneous", "Allow bound inventories", true).getBoolean(true);
@@ -350,7 +375,7 @@ public void load(FMLInitializationEvent event) {
350375
crucibleSouls = new BlockCrucibleSouls(crucibleSoulsID).setHardness(2.0F).setUnlocalizedName("thaumicexploration:crucibleSouls").setCreativeTab(tab).setTextureName("thaumicExploration:crucible3");
351376
replicator = new BlockReplicator(replicatorID).setHardness(4.0F).setUnlocalizedName("thaumicexploration:replicator").setCreativeTab(tab).setTextureName("thaumicexploration:replicatorBottom");
352377

353-
necroPedestal = new BlockNecroPedestal(necroPedestalID, Material.ground).setUnlocalizedName("thaumicexploration:necroPedestal");
378+
necroPedestal = new BlockNecroPedestal(necroPedestalID, Material.rock).setUnlocalizedName("thaumicexploration:necroPedestal");
354379

355380
necroFire = (BlockFire)(new BlockNecroFire(necroFireID)).setUnlocalizedName("thaumicexploration:necroFire").setTextureName("thaumicexploration:fire").setHardness(0.0F).setLightValue(1.0F).setStepSound(Block.soundWoodFootstep);
356381

@@ -378,6 +403,10 @@ public void load(FMLInitializationEvent event) {
378403
transmutationCore = (new Item(transmutationCoreID)).setUnlocalizedName("thaumicexploration:transmutationCore").setCreativeTab(tab).setTextureName("thaumicexploration:rodTransmutation");
379404
talismanFood = (new ItemFoodTalisman(talismanFoodID)).setUnlocalizedName("thaumicexploration:talismanFood").setCreativeTab(tab).setTextureName("thaumicexploration:talismanFood");
380405
amberCore = (new Item(amberCoreID)).setUnlocalizedName("thaumicexploration:amberCore").setCreativeTab(tab).setTextureName("thaumicexploration:rodAmber");
406+
necroCore = (new Item(necroCoreID)).setUnlocalizedName("thaumicexploration:necroCore").setCreativeTab(tab).setTextureName("thaumicexploration:rodNecro");
407+
if (this.breadWand) {
408+
breadCore = (new Item(breadCoreID)).setUnlocalizedName("thaumicexploration:breadCore").setCreativeTab(tab).setTextureName("thaumicexploration:rodBread");
409+
}
381410
pureZombieBrain = (new ItemBrain(pureZombieBrainID)).setUnlocalizedName("thaumicexploration:pureZombieBrain").setCreativeTab(tab).setTextureName("thaumicexploration:pureZombieBrain");
382411
blankSeal = (new ItemBlankSeal(blankSealID).setCreativeTab(tab).setTextureName("thaumicexploration:sealBlank"));
383412
chestSeal = (new ItemChestSeal(chestSealID).setCreativeTab(tab).setTextureName("thaumicexploration:sealChest").setUnlocalizedName("thaumicexploration:chestSeal"));
@@ -390,13 +419,20 @@ public void load(FMLInitializationEvent event) {
390419
maskEvil = (new ItemTXArmorSpecialDiscount(maskEvilID, ThaumcraftApi.armorMatSpecial, 2, 0)).setUnlocalizedName("thaumicexploration:maskEvil").setCreativeTab(tab).setTextureName("thaumicexploration:maskEvil");
391420
bootsMeteor = (new ItemTXArmorSpecial(bootsMeteorID, ThaumcraftApi.armorMatSpecial, 4, 3)).setUnlocalizedName("thaumicexploration:bootsMeteor").setCreativeTab(tab).setTextureName("thaumicexploration:bootsMeteor");
392421
bootsComet = (new ItemTXArmorSpecial(bootsCometID, ThaumcraftApi.armorMatSpecial, 4, 3)).setUnlocalizedName("thaumicexploration:bootsComet").setCreativeTab(tab).setTextureName("thaumicexploration:bootsComet");
422+
runicBootsMeteor = (new ItemTXRuneMeteorBoots(runicBootsMeteorID, ThaumcraftApi.armorMatSpecial, 0, 3)).setUnlocalizedName("thaumicexploration:runicBootsMeteor").setCreativeTab(tab).setTextureName("thaumicexploration:runicBootsMeteor");
423+
runicBootsComet = (new ItemTXRuneCometBoots(runicBootsCometID, ThaumcraftApi.armorMatSpecial, 0, 3)).setUnlocalizedName("thaumicexploration:runicBootsComet").setCreativeTab(tab).setTextureName("thaumicexploration:runicBootsComet");
393424
focusNecromancy = (new ItemFocusNecromancy(focusNecromancyID)).setUnlocalizedName("thaumicexploration:necromancy").setCreativeTab(tab).setTextureName("thaumicexploration:focusNecromancy");
394425
taintBerry = (new ItemTaintSeedFood(taintBerryID, 1, 0.3F, Block.tnt.blockID, ConfigBlocks.blockTaint.blockID)).setCreativeTab(tab).setUnlocalizedName("thaumicexploration:taintBerry").setTextureName("thaumicExploration:taintBerry");
395426
//Item skull = (new ItemSkullCandle(11016)).setUnlocalizedName("skull").setTextureName("skull");
427+
itemAltar = (new ItemReed(itemAltarID, necroPedestal)).setUnlocalizedName("thaumicexploration:necroAltar").setCreativeTab(tab).setTextureName("thaumicExploration:necroAltar");
396428

397429
//Wands
398-
WAND_ROD_AMBER = new WandRod("amber",10,new ItemStack(ThaumicExploration.amberCore),8,new WandRodAmberOnUpdate(), new ResourceLocation("thaumicexploration:textures/models/rodAmber.png"));
430+
WAND_ROD_AMBER = new WandRod("AMBER",10,new ItemStack(ThaumicExploration.amberCore),8,new WandRodAmberOnUpdate(), new ResourceLocation("thaumicexploration:textures/models/rodAmber.png"));
399431
WAND_ROD_CRYSTAL = new WandRod("transmutation",100,new ItemStack(ThaumicExploration.transmutationCore),1,new WandRodTransmutationOnUpdate());
432+
WAND_ROD_NECRO = new WandRod("NECROMANCER",100,new ItemStack(ThaumicExploration.necroCore),15,new WandRodNecromancerOnUpdate(), new ResourceLocation("thaumicexploration:textures/models/rodNecro.png"));
433+
if (this.breadWand) {
434+
WAND_ROD_BREAD = new WandRod("BREAD",39,new ItemStack(ThaumicExploration.breadCore),8,new WandRodBreadOnUpdate(), new ResourceLocation("thaumicexploration:textures/models/rodBread.png"));
435+
}
400436
//WandRod.rods.put("transmutation1", WAND_ROD_CRYSTAL1);
401437
enchantmentBinding = new EnchantmentBinding(enchantmentBindingID, 1);
402438
enchantmentNightVision = new EnchantmentNightVision(enchantmentNightVisionID, 1);
@@ -417,6 +453,7 @@ public void postInit(FMLPostInitializationEvent event) {
417453
//Researches, Thaumcraft Recipes
418454
ModRecipes.initRecipes();
419455
ModResearch.initResearch();
456+
//NecromanticAltarAPI.initNecromanticRecipes();
420457
proxy.setUnicode();
421458

422459
allowedItems.add(MutablePair.of(Block.stone.blockID,0));
@@ -589,13 +626,6 @@ private void addAchievementDesc(String ach, String desc)
589626
}
590627

591628

592-
593-
@ForgeSubscribe
594-
public void onSound(SoundLoadEvent event) {
595-
// You add them the same way as you add blocks.
596-
//event.manager.addSound("steamcraft:wobble.ogg");
597-
}
598-
599629
private class TXTab extends CreativeTabs {
600630

601631
public TXTab(int par1, String par2Str) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
package flaxbeard.thaumicexploration.api;
2+
3+
import java.util.ArrayList;
4+
import java.util.HashMap;
5+
6+
import net.minecraft.block.Block;
7+
import net.minecraft.entity.player.EntityPlayer;
8+
import net.minecraft.item.ItemStack;
9+
10+
import org.apache.commons.lang3.tuple.MutablePair;
11+
12+
import thaumcraft.api.aspects.AspectList;
13+
import thaumcraft.api.crafting.InfusionRecipe;
14+
import thaumcraft.common.config.ConfigResearch;
15+
import flaxbeard.thaumicexploration.ThaumicExploration;
16+
17+
public class NecromanticAltarAPI {
18+
19+
public static void addNecroRecipe(String string,
20+
NecromanticRecipe necromanticRecipe) {
21+
recipes.put(string, necromanticRecipe);
22+
}
23+
24+
public static void addNecroRecipeWithThaumnomiconDisplay(String string, NecromanticRecipe necromanticRecipe) {
25+
addNecroRecipe(string,necromanticRecipe);
26+
AspectList aspects = new AspectList();
27+
aspects.add(ThaumicExploration.fakeAspectNecro, necromanticRecipe.energyRequired);
28+
InfusionRecipe recipe = new InfusionRecipe(necromanticRecipe.researchRequired, necromanticRecipe.recipeOutput, getInstabilityFromRecipe(necromanticRecipe),aspects , new ItemStack(ThaumicExploration.itemAltar), necromanticRecipe.recipeInput);
29+
ConfigResearch.recipes.put(string, recipe);
30+
}
31+
32+
private static int getInstabilityFromRecipe(
33+
NecromanticRecipe necromanticRecipe) {
34+
// TODO Auto-generated method stub
35+
return 10*(necromanticRecipe.energyRequired/100);
36+
}
37+
38+
public static void addEnergyToItem(int id, int metadata, int energy) {
39+
necroEnergyItems.put(MutablePair.of(id,metadata), energy);
40+
}
41+
42+
public static void addEnergyToItem(int id, int energy) {
43+
44+
necroEnergyItems.put(MutablePair.of(id, -1), energy);
45+
}
46+
47+
public static NecromanticRecipe findMatchingNecromanticInfusionRecipe(ArrayList<ItemStack> items, EntityPlayer player)
48+
{
49+
50+
NecromanticRecipe var13 = null;
51+
NecromanticRecipe[] possibleRecipes = recipes.values().toArray(new NecromanticRecipe[0]);
52+
for (NecromanticRecipe var11 : possibleRecipes) {
53+
if ((var11.matches(items, player.worldObj, player)))
54+
{
55+
var13 = var11;
56+
break;
57+
}
58+
}
59+
return var13;
60+
}
61+
62+
public static HashMap<String, NecromanticRecipe> recipes = new HashMap();
63+
public static HashMap<MutablePair,Integer> necroEnergyItems = new HashMap();
64+
65+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
package flaxbeard.thaumicexploration.api;
2+
3+
import java.util.ArrayList;
4+
5+
import net.minecraft.entity.player.EntityPlayer;
6+
import net.minecraft.item.ItemStack;
7+
import net.minecraft.world.World;
8+
import net.minecraftforge.oredict.OreDictionary;
9+
import thaumcraft.api.ThaumcraftApiHelper;
10+
11+
public class NecromanticRecipe {
12+
public String researchRequired;
13+
public ItemStack recipeOutput;
14+
public ItemStack[] recipeInput;
15+
public int energyRequired;
16+
17+
public NecromanticRecipe(String researchKey, ItemStack result, ItemStack[] items, int energy) {
18+
this.researchRequired = researchKey;
19+
this.recipeOutput = result;
20+
this.recipeInput = items;
21+
this.energyRequired = energy;
22+
}
23+
public NecromanticRecipe(String researchKey, ItemStack result, ItemStack items, int energy) {
24+
this(researchKey, result, new ItemStack[]{items}, energy);
25+
}
26+
public boolean matches(ArrayList<ItemStack> input, World world, EntityPlayer player)
27+
{
28+
if ((this.researchRequired.length() > 0) && (!ThaumcraftApiHelper.isResearchComplete(player.username, this.researchRequired))) {
29+
return false;
30+
}
31+
32+
ArrayList<ItemStack> ii = new ArrayList();
33+
for (ItemStack is : input) {
34+
ii.add(is.copy());
35+
}
36+
for (ItemStack comp : this.recipeInput)
37+
{
38+
boolean b = false;
39+
for (int a = 0; a < ii.size(); a++)
40+
{
41+
ItemStack i2 = ((ItemStack)ii.get(a)).copy();
42+
if (comp.getItemDamage() == 32767) {
43+
i2.setItemDamage(32767);
44+
}
45+
if (areItemStacksEqual(i2, comp, true))
46+
{
47+
ii.remove(a);
48+
b = true;
49+
break;
50+
}
51+
}
52+
if (!b) {
53+
return false;
54+
}
55+
}
56+
return ii.size() == 0;
57+
}
58+
59+
private boolean areItemStacksEqual(ItemStack stack0, ItemStack stack1, boolean fuzzy)
60+
{
61+
if ((stack0 == null) && (stack1 != null)) {
62+
return false;
63+
}
64+
if ((stack0 != null) && (stack1 == null)) {
65+
return false;
66+
}
67+
if ((stack0 == null) && (stack1 == null)) {
68+
return true;
69+
}
70+
boolean t1 = false;
71+
if (fuzzy)
72+
{
73+
t1 = true;
74+
int od = OreDictionary.getOreID(stack0);
75+
if (od != -1)
76+
{
77+
ItemStack[] ores = (ItemStack[])OreDictionary.getOres(Integer.valueOf(od)).toArray(new ItemStack[0]);
78+
if (ThaumcraftApiHelper.containsMatch(false, new ItemStack[] { stack1 }, ores)) {
79+
return true;
80+
}
81+
}
82+
}
83+
else
84+
{
85+
t1 = ItemStack.areItemStackTagsEqual(stack0, stack1);
86+
}
87+
return stack0.stackSize > stack0.getMaxStackSize() ? false : stack0.getItemDamage() != stack1.getItemDamage() ? false : stack0.itemID != stack1.itemID ? false : t1;
88+
}
89+
}

forge2/src/main/java/flaxbeard/thaumicexploration/block/BlockNecroFire.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int p
5757
{
5858
entity.attackEntityFrom(DamageSource.onFire, 4.0F);
5959
entity.setFire(8);
60-
System.out.println("burning item " + entity.toString());
60+
6161
}
6262
}
6363

0 commit comments

Comments
 (0)