Better Cooking, More Compat, Swordier Sword

This commit is contained in:
Jeremy Diamond committed 2015-07-20 01:22:04 -07:00
1 parent c300542805
commit ad9903c1a7
6 files changed
+173 -20

No files matched your search

@@ -11,6 +11,7 @@ import fox.spiteful.avaritia.crafting.Grinder;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import org.apache.logging.log4j.Level;
public class Compat {
@@ -30,6 +31,11 @@ public class Compat {
public static boolean pe = false;
public static boolean tweak = false;
public static boolean mfr = false;
public static boolean twilight = false;
public static boolean natura = false;
public static boolean magicrops = false;
public static boolean ganyland = false;
public static boolean pams = false;
public static void census(){
nei = Loader.isModLoaded("NotEnoughItems");
@@ -47,6 +53,11 @@ public class Compat {
pe = Loader.isModLoaded("ProjectE");
tweak = Loader.isModLoaded("MineTweaker3");
mfr = Loader.isModLoaded("MineFactoryReloaded");
twilight = Loader.isModLoaded("TwilightForest");
natura = Loader.isModLoaded("Natura");
magicrops = Loader.isModLoaded("magicalcrops");
ganyland = Loader.isModLoaded("ganyssurface");
pams = Loader.isModLoaded("harvestcraft");
}
public static void compatify(){
@@ -249,6 +260,82 @@ public class Compat {
}
}
if(twilight){
try {
Item ironwood = getItem("TwilightForest", "item.ironwoodIngot");
ItemStack wood = new ItemStack(ironwood, 1);
Grinder.catalyst.getInput().add(wood);
}
catch (Throwable e){
Lumberjack.log(Level.INFO, "Avaritia was killed by a hydra.");
e.printStackTrace();
twilight = false;
}
}
if(magicrops){
try {
Item essence = getItem("magicalcrops", "magicalcrops_MagicEssence");
Item meat = getItem("magicalcrops", "magicalcrops_RawMeat");
Item crop = getItem("magicalcrops", "magicalcrops_CropProduce");
ItemStack extreme = new ItemStack(essence, 1, 4);
Grinder.catalyst.getInput().add(extreme);
OreDictionary.registerOre("cropBlackberry", new ItemStack(crop, 1, 0));
OreDictionary.registerOre("cropBlueberry", new ItemStack(crop, 1, 1));
OreDictionary.registerOre("cropChilipepper", new ItemStack(crop, 1, 2));
OreDictionary.registerOre("cropCucumber", new ItemStack(crop, 1, 3));
OreDictionary.registerOre("cropGrape", new ItemStack(crop, 1, 4));
OreDictionary.registerOre("cropRaspberry", new ItemStack(crop, 1, 5));
OreDictionary.registerOre("cropStrawberry", new ItemStack(crop, 1, 6));
OreDictionary.registerOre("cropCorn", new ItemStack(crop, 1, 7));
OreDictionary.registerOre("cropTomato", new ItemStack(crop, 1, 8));
OreDictionary.registerOre("rawMutton", new ItemStack(meat, 1, 0));
}
catch (Throwable e){
Lumberjack.log(Level.INFO, "Avaritia got bored of waiting for magical crops to grow.");
e.printStackTrace();
magicrops = false;
}
}
if(ganyland){
try {
Item mutton = getItem("ganyssurface", "mutton_raw");
OreDictionary.registerOre("rawMutton", new ItemStack(mutton, 1, 0));
}
catch (Throwable e){
Lumberjack.log(Level.INFO, "Avaritia forgot which Gany's mod it was dealing with.");
e.printStackTrace();
ganyland = false;
}
}
if(pams){
try {
Item mutton = getItem("harvestcraft", "muttonrawItem");
Item beet = getItem("harvestcraft", "beetItem");
OreDictionary.registerOre("rawMutton", new ItemStack(mutton, 1, 0));
OreDictionary.registerOre("cropBeetroot", new ItemStack(beet, 1, 0));
}
catch (Throwable e){
Lumberjack.log(Level.INFO, "Avaritia got overwhelmed by all the food choices. D:");
e.printStackTrace();
pams = false;
}
}
if(natura){
try {
Item barley = getItem("Natura", "barleyFood");
OreDictionary.registerOre("cropBarley", new ItemStack(barley, 1, 0));
}
catch (Throwable e){
Lumberjack.log(Level.INFO, "Avaritia got overwhelmed by all the food choices. D:");
e.printStackTrace();
pams = false;
}
}
}
public static Block getBlock(String mod, String block) throws ItemNotFoundException {
@@ -134,8 +134,18 @@ public class Grinder {
ExtremeCraftingManager.getInstance().addOreSingularityRecipe(new ItemStack(LudicrousItems.singularity, 1, 8), "blockSilver");
catalyst.getInput().add(new ItemStack(LudicrousItems.singularity, 1, 8));
}
if(!OreDictionary.getOres("blockPlatinum").isEmpty()){
catalyst.getInput().add(OreDictionary.getOres("blockPlatinum"));
if(!OreDictionary.getOres("blockNickel").isEmpty()){
ExtremeCraftingManager.getInstance().addOreSingularityRecipe(new ItemStack(LudicrousItems.singularity, 1, 9), "blockNickel");
catalyst.getInput().add(new ItemStack(LudicrousItems.singularity, 1, 9));
}
if(!OreDictionary.getOres("blockEnderium").isEmpty()){
catalyst.getInput().add(OreDictionary.getOres("blockEnderium"));
}
if(!OreDictionary.getOres("blockSteel").isEmpty()){
catalyst.getInput().add(OreDictionary.getOres("blockSteel"));
}
if(!OreDictionary.getOres("ingotTartarite").isEmpty()){
catalyst.getInput().add(OreDictionary.getOres("ingotTartarite"));
}
ExtremeCraftingManager.getInstance().addExtremeShapedOreRecipe(new ItemStack(LudicrousItems.endest_pearl), new Object[]{
@@ -1,24 +1,27 @@
package fox.spiteful.avaritia.crafting;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Random;
import java.util.*;
import fox.spiteful.avaritia.Lumberjack;
import fox.spiteful.avaritia.compat.Compat;
import fox.spiteful.avaritia.items.LudicrousItems;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapelessOreRecipe;
public class Mincer {
public static ShapelessOreRecipe meatballRecipe;
// here's where all the food magic goes on
private static String[] sacredCropNames = new String[]{"cropWheat", "cropCarrot", "cropPotato", "cropApple", "cropMelon", "cropPumpkin"};
private static String[] knownMeatEntries = new String[]{"nuggetMeat", "ingotMeat", "dustMeat"};
private static String[] sacredCropNames = new String[]{"cropWheat", "cropCarrot", "cropPotato", "cropApple", "cropMelon", "cropPumpkin", "cropCactus"};
private static String[] forbiddenCropNames = new String[] {"cropEdibleroot", "cropWhitemushroom", "cropBeet", "cropCotton"};
private static String[] knownMeatEntries = new String[]{"nuggetMeat", "ingotMeat", "dustMeat", "rawMutton"};
private static List<ItemStack> knownMeats = new ArrayList<ItemStack>();
static {
static {
knownMeats.add(new ItemStack(Items.beef));
knownMeats.add(new ItemStack(Items.chicken));
knownMeats.add(new ItemStack(Items.porkchop));
@@ -27,12 +30,13 @@ public class Mincer {
knownMeats.add(new ItemStack(Items.fish, 1, i));
}*/
knownMeats.add(new ItemStack(Items.fish));
OreDictionary.registerOre("cropCactus", new ItemStack(Blocks.cactus));
}
private static Random randy;
public static void countThoseCalories() {
String[] orenames = OreDictionary.getOreNames();
String[] orenames = OreDictionary.getOreNames();
List<String> rawCrops = new ArrayList<String>();
List<String> crops = new ArrayList<String>();
@@ -43,14 +47,14 @@ public class Mincer {
String orename;
for (int i=0; i<orenames.length; i++) {
orename = orenames[i];
if (orename.startsWith("crop")) {
if (orename.startsWith("crop") && !bannedCrop(orename)) {
rawCrops.add(orename);
}
if ((!orename.startsWith("food"))
/*if ((!orename.startsWith("food"))
&& (!(orename.contains("cooked") || orename.contains("Cooked")))
&& (orename.contains("raw") || orename.contains("Raw"))
&& (orename.contains("meat")
|| orename.contains("fish")
|| orename.contains("fish")
|| orename.contains("lamb")
|| orename.contains("chicken")
|| orename.contains("beef")
@@ -58,7 +62,7 @@ public class Mincer {
|| orename.contains("mutton")
|| orename.contains("venison"))) {
meatNames.add(orename);
}
}*/
}
//Lumberjack.info("End of ore crop names: "+rawCrops.size()+" names found.");
@@ -157,7 +161,7 @@ public class Mincer {
// Cosmic Meatball recipe
List<FoodInfo> meatSortingList = new ArrayList<FoodInfo>();
randy = new Random(54321);
for (int i=0; i<knownMeatEntries.length; i++) {
if(OreDictionary.doesOreNameExist(knownMeatEntries[i])) {
List<ItemStack> meatstacks = OreDictionary.getOres(knownMeatEntries[i]);
@@ -176,6 +180,26 @@ public class Mincer {
}
}
}
if(Compat.twilight){
try {
Item venison = Compat.getItem("TwilightForest", "item.venisonRaw");
Item meef = Compat.getItem("TwilightForest", "item.meefRaw");
knownMeats.add(new ItemStack(venison));
knownMeats.add(new ItemStack(meef));
}
catch(Exception e){}
}
if(Compat.natura){
try {
Item imp = Compat.getItem("Natura", "impmeat");
knownMeats.add(new ItemStack(imp));
}
catch(Exception e){
Compat.natura = false;
}
}
Lumberjack.info("rawMeats: "+rawMeats);
Lumberjack.info("knownMeats: "+knownMeats);
@@ -234,7 +258,7 @@ public class Mincer {
// time to actually MAKE the damn thing...
ShapelessOreRecipe meatballRecipe = ExtremeCraftingManager.getInstance().addShapelessOreRecipe(new ItemStack(LudicrousItems.cosmic_meatballs, makesmeatballs), new ItemStack(LudicrousItems.resource, 1, 2));
meatballRecipe = ExtremeCraftingManager.getInstance().addShapelessOreRecipe(new ItemStack(LudicrousItems.cosmic_meatballs, makesmeatballs), new ItemStack(LudicrousItems.resource, 1, 2));
List<Object> meatballInputs = meatballRecipe.getInput();
@@ -262,5 +286,13 @@ public class Mincer {
return this.orename+": "+this.count;
}
}
private static boolean bannedCrop(String crop){
for(String ban : forbiddenCropNames){
if(ban.equals(crop))
return true;
}
return false;
}
}
@@ -17,11 +17,11 @@ import java.util.List;
public class ItemSingularity extends Item implements IHaloRenderItem {
public static final String[] types = new String[]{"iron", "gold", "lapis", "redstone", "quartz", "copper",
"tin", "lead", "silver"};
"tin", "lead", "silver", "nickel"};
public static final int[] colors = new int[]{0xBFBFBF, 0xE8EF23, 0x5a82e2, 0xDF0000, 0xeeebe6, 0xE47200,
0xA5C7DE, 0x444072, 0xF9F9F9};
0xA5C7DE, 0x444072, 0xF9F9F9, 0xDEE187};
public static final int[] colors2 = new int[]{0x7F7F7F, 0xdba213, 0x224baf, 0x900000, 0x94867d, 0x89511A,
0x9BA9B2, 0x3E3D4E, 0xD5D5D5};
0x9BA9B2, 0x3E3D4E, 0xD5D5D5, 0xC4C698};
public static IIcon background;
public static IIcon foreground;
@@ -1,9 +1,11 @@
package fox.spiteful.avaritia.items.tools;
import cpw.mods.fml.relauncher.ReflectionHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import fox.spiteful.avaritia.Avaritia;
import fox.spiteful.avaritia.DamageSourceInfinitySword;
import fox.spiteful.avaritia.Lumberjack;
import fox.spiteful.avaritia.achievements.Achievements;
import fox.spiteful.avaritia.items.LudicrousItems;
import fox.spiteful.avaritia.render.ICosmicRenderItem;
@@ -18,6 +20,9 @@ import net.minecraft.util.DamageSource;
import net.minecraft.util.EntityDamageSource;
import net.minecraft.util.IIcon;
import net.minecraftforge.common.util.EnumHelper;
import org.apache.logging.log4j.Level;
import java.lang.reflect.Field;
public class ItemSwordInfinity extends ItemSword implements ICosmicRenderItem {
@@ -25,6 +30,17 @@ public class ItemSwordInfinity extends ItemSword implements ICosmicRenderItem {
private IIcon cosmicMask;
private IIcon pommel;
public static Field stupidMojangProtectedVariable;
static {
try {
stupidMojangProtectedVariable = ReflectionHelper.findField(EntityLivingBase.class, "recentlyHit", "field_70718_bc");
}
catch(Exception e){
Lumberjack.log(Level.ERROR, e);
}
}
public ItemSwordInfinity(){
super(opSword);
setUnlocalizedName("infinity_sword");
@@ -37,6 +53,12 @@ public class ItemSwordInfinity extends ItemSword implements ICosmicRenderItem {
{
if(player.worldObj.isRemote)
return true;
try {
stupidMojangProtectedVariable.setInt(victim, 60);
}
catch(Exception e){
Lumberjack.log(Level.ERROR, e);
}
victim.func_110142_aN().func_94547_a(new DamageSourceInfinitySword(player), victim.getHealth(), victim.getHealth());
victim.setHealth(0);
victim.onDeath(new EntityDamageSource("infinity", player));
@@ -98,4 +120,5 @@ public class ItemSwordInfinity extends ItemSword implements ICosmicRenderItem {
{
return true;
}
}