Fixes #85
Fixes #73
This commit is contained in:
Jeremy Diamond committed 2015-11-14 00:52:57 -08:00
1 parent b61ed5716a
commit 495a7f754f
7 files changed
+57 -6

No files matched your search

@@ -1,6 +1,7 @@
package fox.spiteful.forbidden;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import net.minecraft.block.Block;
@@ -15,6 +16,7 @@ import thaumcraft.api.aspects.Aspect;
public class Config {
public static HashMap<String, Aspect> spawnerMobs = new HashMap<String, Aspect>();
public static ArrayList<String> trash = new ArrayList<String>();
public static int clusterEnchID;
public static int wrathEnchID;
@@ -105,6 +107,12 @@ public class Config {
gluttony = 0;
hereticID = conf.get("general", "Heretic Villager ID", hereticID).getInt(hereticID);
String trashlist = conf.get("general", "Garbage Blocks", "dirt;sand;gravel;cobblestone;netherrack", "List of OreDict names for garbage blocks, separated by semicolons, for the Consuming enchant to eat").getString();
String[] trashpile = trashlist.split(";");
for(String garbage : trashpile){
trash.add(garbage);
}
bloodSealPotionID = conf.get("potions", "Blood Seal", bloodSealPotionID).getInt(bloodSealPotionID);
crossMod = conf.get("compatibility", "Cross-Mod Interaction", crossMod, "Disable to keep mods segregated.").getBoolean(true);
@@ -119,8 +127,8 @@ public class Config {
emc = conf.get("compatibility", "Equivalent Exchange 3 EMC", emc, "Disable if you don't want Forbidden Magic to add EMC values to items.").getBoolean(true);
//eewand = conf.get("compatibility", "Equivalent Exchange 3 Wand", eewand, "Disable to specifically disable the EMC to Vis wand.").getBoolean(true);
bloodvis = conf.get("power converters", "LP to Vis", bloodvis).getInt(bloodvis);
manavis = conf.get("power converters", "Mana to Vis", manavis).getInt(manavis);
bloodvis = conf.get("power converters", "LP to Vis", bloodvis, "How much LP 0.01 Vis is worth").getInt(bloodvis);
manavis = conf.get("power converters", "Mana to Vis", manavis, "How much Mana 0.01 Vis is worth").getInt(manavis);
} catch (Exception e) {
LogHandler.log(Level.ERROR, e, "Had a problem loading its configuration.");
} finally {
@@ -48,6 +48,7 @@ import net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed;
import net.minecraftforge.event.entity.player.PlayerUseItemEvent;
import net.minecraftforge.event.world.BlockEvent.HarvestDropsEvent;
import net.minecraftforge.oredict.OreDictionary;
import org.apache.logging.log4j.Level;
import thaumcraft.api.aspects.Aspect;
@@ -67,6 +68,7 @@ public class FMEventHandler {
final Aspect[] primals = { Aspect.ENTROPY, Aspect.ORDER, Aspect.FIRE, Aspect.WATER, Aspect.EARTH, Aspect.AIR };
HashMap<String, Integer> lastLP = new HashMap<String, Integer>();
@SubscribeEvent
public void onPlayerBreaking(BreakSpeed event) {
if (event.entityPlayer.getCurrentEquippedItem() != null) {
@@ -153,7 +155,7 @@ public class FMEventHandler {
ItemStack head = new ItemStack(Items.skull, 1, 3);
NBTTagCompound nametag = new NBTTagCompound();
nametag.setString("SkullOwner", ((EntityPlayer) event.entityLiving).getCommandSenderName());
head.setTagInfo("SkullOwner", nametag);
head.setTagCompound(nametag);
addDrop(event, head);
}
}
@@ -319,7 +321,7 @@ public class FMEventHandler {
if (EnchantmentHelper.getEnchantmentLevel(DarkEnchantments.consuming.effectId, equip) > 0) {
for (int x = 0; x < event.drops.size(); x++) {
ItemStack drop = (ItemStack) event.drops.get(x);
if (drop != null && (drop.getItem() == Item.getItemFromBlock(Blocks.cobblestone) || drop.getItem() == Item.getItemFromBlock(Blocks.dirt) || drop.getItem() == Item.getItemFromBlock(Blocks.netherrack) || drop.getItem() == Item.getItemFromBlock(Blocks.gravel)))
if (drop != null && isGarbage(drop))
event.drops.remove(x);
}
}
@@ -355,6 +357,16 @@ public class FMEventHandler {
}
}
private boolean isGarbage(ItemStack drop) {
for(int id : OreDictionary.getOreIDs(drop)) {
for(String ore : Config.trash) {
if(OreDictionary.getOreName(id).equals(ore))
return true;
}
}
return false;
}
@SubscribeEvent
public void onEat(PlayerUseItemEvent.Finish event){
if(event.entityPlayer.worldObj.isRemote)
@@ -21,6 +21,7 @@ import thaumcraft.api.wands.WandCap;
import fox.spiteful.forbidden.blocks.ForbiddenBlocks;
import fox.spiteful.forbidden.enchantments.DarkEnchantments;
import fox.spiteful.forbidden.items.ForbiddenItems;
import thaumcraft.common.config.ConfigBlocks;
import thaumcraft.common.config.ConfigItems;
public class ForbiddenRecipes {
@@ -65,7 +66,11 @@ public class ForbiddenRecipes {
ForbiddenResearch.recipes.put("BlackFlower", ThaumcraftApi.addCrucibleRecipe("BLACKFLOWER", new ItemStack(ForbiddenBlocks.roseBush, 1, 0), new ItemStack(Blocks.double_plant, 1, 4), (new AspectList()).merge(Aspect.DARKNESS, 8).merge(Aspect.LIFE, 5)));
ForbiddenResearch.recipes.put("BlackInk", CraftingManager.getInstance().addRecipe(new ItemStack(ForbiddenItems.resource, 2, 1), new Object[]{"#", Character.valueOf('#'), new ItemStack(ForbiddenBlocks.blackFlower, 1, 0)}));
ForbiddenResearch.recipes.put("Crystalwell", ThaumcraftApi.addShapelessArcaneCraftingRecipe("CRYSTALWELL", new ItemStack(ForbiddenItems.crystalwell, 1, 0), (new AspectList()).add(Aspect.WATER, 1).add(Aspect.ORDER, 1), new Object[] { new ItemStack(ConfigItems.itemInkwell, 1, 32767), "dyeBlack", new ItemStack(ConfigItems.itemShard, 1, 32767), new ItemStack(ConfigItems.itemShard, 1, 32767) }));
if(thaumcraft.common.config.Config.researchDifficulty != -1)
ForbiddenResearch.recipes.put("Crystalwell", ThaumcraftApi.addShapelessArcaneCraftingRecipe("CRYSTALWELL", new ItemStack(ForbiddenItems.crystalwell, 1, 0), (new AspectList()).add(Aspect.WATER, 1).add(Aspect.ORDER, 1), new Object[] { new ItemStack(ConfigItems.itemInkwell, 1, 32767), "dyeBlack", new ItemStack(ConfigItems.itemShard, 1, 32767), new ItemStack(ConfigItems.itemShard, 1, 32767) }));
else
ForbiddenResearch.recipes.put("Crystalwell", ThaumcraftApi.addShapelessArcaneCraftingRecipe("CRYSTALWELL", new ItemStack(ForbiddenItems.crystalwell, 1, 0), (new AspectList()).add(Aspect.WATER, 1).add(Aspect.ORDER, 1), new Object[] { new ItemStack(ConfigItems.itemInkwell, 1, 32767), "dyeBlack", new ItemStack(ConfigBlocks.blockCrystal, 1, 6), new ItemStack(ConfigItems.itemShard, 1, 6), new ItemStack(ConfigItems.itemShard, 1, 6), new ItemStack(ConfigItems.itemShard, 1, 6) }));
ForbiddenResearch.recipes.put("Primewell", ThaumcraftApi.addShapelessArcaneCraftingRecipe("PRIMEWELL", new ItemStack(ForbiddenItems.primewell, 1, 0), (new AspectList()).add(Aspect.WATER, 50).add(Aspect.EARTH, 50).add(Aspect.FIRE, 50).add(Aspect.AIR, 50).add(Aspect.ORDER, 50).add(Aspect.ENTROPY, 50), new Object[] { new ItemStack(Items.feather, 1, 0), new ItemStack(ConfigItems.itemEldritchObject, 1, 3), new ItemStack(Items.glass_bottle, 1, 0) }));
if(Config.enchanting) {
@@ -100,5 +105,7 @@ public class ForbiddenRecipes {
}
});
OreDictionary.registerOre("logWood", new ItemStack(ConfigBlocks.blockMagicalLog, 1, OreDictionary.WILDCARD_VALUE));
}
}
@@ -29,7 +29,11 @@ public class ForbiddenResearch {
addInfernalism();
addTaint();
(new DarkResearchItem("CRYSTALWELL", "FORBIDDEN", (new AspectList()).add(Aspect.MIND, 3).add(Aspect.CRYSTAL, 2).add(Aspect.MAGIC, 1), -2, -8, 1, new ItemStack(ForbiddenItems.crystalwell, 1, 0))).setPages(new ResearchPage[] { new ResearchPage("forbidden.research_page.CRYSTALWELL.1"), new ResearchPage((IArcaneRecipe) recipes.get("Crystalwell")) }).setParents(new String[] { "RESEARCH" }).registerResearchItem();
if(thaumcraft.common.config.Config.researchDifficulty != -1)
(new DarkResearchItem("CRYSTALWELL", "FORBIDDEN", (new AspectList()).add(Aspect.MIND, 3).add(Aspect.CRYSTAL, 2).add(Aspect.MAGIC, 1), -2, -8, 1, new ItemStack(ForbiddenItems.crystalwell, 1, 0))).setPages(new ResearchPage[] { new ResearchPage("forbidden.research_page.CRYSTALWELL.1"), new ResearchPage((IArcaneRecipe) recipes.get("Crystalwell")) }).setParents(new String[] { "RESEARCH" }).registerResearchItem();
else
(new DarkResearchItem("CRYSTALWELL", "FORBIDDEN", (new AspectList()).add(Aspect.MIND, 3).add(Aspect.CRYSTAL, 2).add(Aspect.MAGIC, 1), -2, -8, 1, new ItemStack(ForbiddenItems.crystalwell, 1, 0))).setPages(new ResearchPage[] { new ResearchPage("forbidden.research_page.CRYSTALWELL.1b"), new ResearchPage((IArcaneRecipe) recipes.get("Crystalwell")) }).setParents(new String[] { "RESEARCH" }).registerResearchItem();
(new DarkResearchItem("PRIMEWELL", "FORBIDDEN", (new AspectList()).add(Aspect.MIND, 3).add(Aspect.ELDRITCH, 6).add(Aspect.CRAFT, 1), 2, -8, 1, new ItemStack(ForbiddenItems.primewell, 1, 0))).setPages(new ResearchPage[] { new ResearchPage("forbidden.research_page.PRIMEWELL.1"), new ResearchPage((IArcaneRecipe) recipes.get("Primewell")) }).setParents(new String[] { "PRIMPEARL" }).setConcealed().registerResearchItem();
if (Config.emeraldTrans)
(new DarkResearchItem("TRANSEMERALD", "FORBIDDEN", (new AspectList()).add(Aspect.CRYSTAL, 2).add(Aspect.EXCHANGE, 5).add(Aspect.GREED, 4), 0, -6, 3, new ItemStack(ForbiddenItems.resource, 1, 0))).setPages(new ResearchPage[] { new ResearchPage("forbidden.research_page.TRANSEMERALD.1"), new ResearchPage((CrucibleRecipe) recipes.get("TransEmerald")) }).setSecondary().setConcealed().setParents(new String[] { "TRANSGOLD" }).registerResearchItem();
@@ -3,16 +3,20 @@ package fox.spiteful.forbidden.items.scribes;
import java.util.Iterator;
import fox.spiteful.forbidden.Forbidden;
import fox.spiteful.forbidden.LogHandler;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import org.apache.logging.log4j.Level;
import thaumcraft.api.IScribeTools;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.common.Thaumcraft;
import thaumcraft.common.config.Config;
import thaumcraft.common.config.ConfigItems;
import thaumcraft.common.lib.network.PacketHandler;
import thaumcraft.common.lib.network.playerdata.PacketAspectPool;
@@ -67,6 +71,21 @@ public class ItemCrystalwell extends Item implements IScribeTools {
return stack;
}
@Override
public void onUpdate(ItemStack stack, World world, Entity entity, int wat, boolean isSelected) {
if(world.isRemote)
return;
if(Config.researchDifficulty == -1 && entity.ticksExisted % 200 == 0 && (entity instanceof EntityPlayer)){
EntityPlayer player = (EntityPlayer)entity;
Aspect aspect = (Aspect)Aspect.getPrimalAspects().get(world.rand.nextInt(6));
short amount = (short)(world.rand.nextInt(4) + 1);
Thaumcraft.proxy.playerKnowledge.addAspectPool(player.getCommandSenderName(), aspect, amount);
PacketHandler.INSTANCE.sendTo(new PacketAspectPool(aspect.getTag(), amount, Short.valueOf(Thaumcraft.proxy.playerKnowledge.getAspectPoolFor(player.getCommandSenderName(), aspect))), (EntityPlayerMP) player);
ResearchManager.scheduleSave(player);
}
}
/**
* Render Pass sensitive version of hasEffect()
*/