Nothing actually changing, but some things are
This commit is contained in:
parent
393d9ff1b8
commit
a4d401b1e1
15 changed files with 166 additions and 99 deletions
|
|
@ -7,6 +7,7 @@ import com.oitsjustjose.tinkers_addons.lib.LibModifiers;
|
|||
import com.oitsjustjose.tinkers_addons.modifiers.ModAutoRepair;
|
||||
import com.oitsjustjose.tinkers_addons.util.ClientProxy;
|
||||
import com.oitsjustjose.tinkers_addons.util.CommonProxy;
|
||||
import com.oitsjustjose.tinkers_addons.util.ModRecipes;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
|
|
@ -17,7 +18,7 @@ import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
|||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
|
||||
@Mod(modid = Lib.MODID, name = Lib.NAME, version = Lib.VERSION, guiFactory = Lib.GUI_FACTORY, acceptedMinecraftVersions = "1.9.4", dependencies = "required-after:tconstruct@[1.9.4-2.3.1,);" + "required-after:mantle@[1.9.4-0.10.1,)")
|
||||
@Mod(modid = Lib.MODID, name = Lib.NAME, version = Lib.VERSION, guiFactory = Lib.GUI_FACTORY, dependencies = "required-after:tconstruct@[1.10-2.3.3,);" + "required-after:mantle@[1.10-0.10.3,)")
|
||||
public class TinkersAddons
|
||||
{
|
||||
@Instance(Lib.MODID)
|
||||
|
|
@ -28,6 +29,7 @@ public class TinkersAddons
|
|||
public static Config modConfig;
|
||||
public static LibItems modItems;
|
||||
public static LibModifiers modModifiers;
|
||||
public ModRecipes recipes;
|
||||
|
||||
@EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event)
|
||||
|
|
@ -53,5 +55,6 @@ public class TinkersAddons
|
|||
{
|
||||
if (event.getSide().isClient())
|
||||
ClientProxy.init();
|
||||
recipes = new ModRecipes();
|
||||
}
|
||||
}
|
||||
|
|
@ -2,37 +2,34 @@ package com.oitsjustjose.tinkers_addons.items;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import com.oitsjustjose.tinkers_addons.TinkersAddons;
|
||||
import com.oitsjustjose.tinkers_addons.lib.Lib;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
import slimeknights.tconstruct.library.TinkerRegistry;
|
||||
|
||||
public class ItemModMaterial extends Item
|
||||
{
|
||||
String[] materials = new String[] { "MOSS_BALL", "EXTRA_MODIFIER_LVL1", "EXTRA_MODIFIER_LVL2", "EXTRA_MODIFIER_LVL3" };
|
||||
String[] materials = new String[] { "AMELIORATION_KIT", "EXTRA_MODIFIER_LVL1", "EXTRA_MODIFIER_LVL2", "EXTRA_MODIFIER_LVL3" };
|
||||
|
||||
public ItemModMaterial()
|
||||
{
|
||||
this.setHasSubtypes(true);
|
||||
this.setCreativeTab(TinkerRegistry.tabGeneral);
|
||||
GameRegistry.register(this, new ResourceLocation(Lib.MODID.toLowerCase(), "modifier_item"));
|
||||
registerRecipes();
|
||||
Lib.MOD_ITEMS.add(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasEffect(ItemStack itemstack)
|
||||
{
|
||||
return itemstack.getItemDamage() >= 2 ? true : false;
|
||||
return (itemstack.getItemDamage() == 0 && TinkersAddons.modConfig.autoRepairRecipeType == 2) ? true : itemstack.getItemDamage() >= 2 ? true : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -48,12 +45,4 @@ public class ItemModMaterial extends Item
|
|||
for (int i = 0; i < materials.length; i++)
|
||||
list.add(new ItemStack(item, 1, i));
|
||||
}
|
||||
|
||||
void registerRecipes()
|
||||
{
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(this, 1, 0), Blocks.MOSSY_COBBLESTONE, Blocks.MOSSY_COBBLESTONE, Blocks.MOSSY_COBBLESTONE, Blocks.MOSSY_COBBLESTONE, Blocks.MOSSY_COBBLESTONE, Blocks.MOSSY_COBBLESTONE, Blocks.MOSSY_COBBLESTONE, Blocks.MOSSY_COBBLESTONE, Blocks.MOSSY_COBBLESTONE));
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(this, 1, 1), "gemDiamond", "blockGold"));
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(this, 1, 2), "blockDiamond", new ItemStack(Items.GOLDEN_APPLE, 1, 1)));
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(this, 1, 3), Items.NETHER_STAR, new ItemStack(Items.SKULL, 1, Short.MAX_VALUE)));
|
||||
}
|
||||
}
|
||||
|
|
@ -11,7 +11,7 @@ public class Config
|
|||
{
|
||||
public Configuration config;
|
||||
|
||||
public boolean enableAutoRepair;
|
||||
public int autoRepairRecipeType;
|
||||
public boolean enableExtraModifierLvl1;
|
||||
public boolean enableExtraModifierLvl2;
|
||||
public boolean enableExtraModifierLvl3;
|
||||
|
|
@ -26,9 +26,9 @@ public class Config
|
|||
{
|
||||
Property property;
|
||||
|
||||
property = config.get(Configuration.CATEGORY_GENERAL, "Enable Auto-Repair", true).setRequiresMcRestart(true);
|
||||
property.setComment("Allows you to enable or disable the auto-repair trait");
|
||||
enableAutoRepair = property.getBoolean();
|
||||
property = config.get(Configuration.CATEGORY_GENERAL, "Auto-Repair Recipe Type", 2).setRequiresMcRestart(true);
|
||||
property.setComment("Allows you to modify the auto-repair recipe. 0 disables the feature, 1 enables the easier recipe, 2 enables a harder one.");
|
||||
autoRepairRecipeType = property.getInt();
|
||||
|
||||
property = config.get(Configuration.CATEGORY_GENERAL, "Enable 1st bonus modifier mod for tools", true).setRequiresMcRestart(true);
|
||||
property.setComment("Re-adds the diamond + gold block recipe to increase modifiers on a tool if enabled");
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ public class LibModifiers
|
|||
|
||||
public LibModifiers()
|
||||
{
|
||||
if (TinkersAddons.modConfig.enableAutoRepair)
|
||||
if (TinkersAddons.modConfig.autoRepairRecipeType > 0)
|
||||
{
|
||||
auto_repair = new ModAutoRepair();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,90 @@
|
|||
package com.oitsjustjose.tinkers_addons.util;
|
||||
|
||||
import com.oitsjustjose.tinkers_addons.TinkersAddons;
|
||||
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemEnchantedBook;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.RecipesMapCloning;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ModRecipeAmelioration extends RecipesMapCloning
|
||||
{
|
||||
@Override
|
||||
public boolean matches(InventoryCrafting invCraft, World world)
|
||||
{
|
||||
boolean mending = false;
|
||||
int numMoss = 0;
|
||||
|
||||
for (int x = 0; x < 3; x++)
|
||||
{
|
||||
for (int y = 0; y < 3; y++)
|
||||
{
|
||||
ItemStack temp = invCraft.getStackInRowAndColumn(x, y);
|
||||
if (temp == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Checks for center item slot
|
||||
if (x == 1 && y == 1)
|
||||
{
|
||||
if (temp.getItem() instanceof ItemEnchantedBook)
|
||||
{
|
||||
if (temp.getTagCompound() != null)
|
||||
{
|
||||
NBTTagCompound comp = temp.getTagCompound();
|
||||
mending = comp.getTag("StoredEnchantments").toString().contains("id:70s");
|
||||
|
||||
if (!world.isRemote)
|
||||
System.out.println(comp.getTag("StoredEnchantments").toString());
|
||||
|
||||
}
|
||||
}
|
||||
// Checks if the center item slot has mending on it
|
||||
if (EnchantmentHelper.getEnchantmentLevel(Enchantment.getEnchantmentByID(70), temp) > 0)
|
||||
mending = true;
|
||||
}
|
||||
// Else not the center slot it drops out if the block isn't mossy cobble
|
||||
else if ((temp.getItem() == Item.getItemFromBlock(Blocks.MOSSY_COBBLESTONE)))
|
||||
{
|
||||
++numMoss;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return mending && numMoss == 8;
|
||||
}
|
||||
|
||||
// DONE
|
||||
@Override
|
||||
public ItemStack getCraftingResult(InventoryCrafting invCraft)
|
||||
{
|
||||
return new ItemStack(TinkersAddons.modItems.materials, 1, 0);
|
||||
}
|
||||
|
||||
// DONE
|
||||
@Override
|
||||
public int getRecipeSize()
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
|
||||
// DONE
|
||||
@Override
|
||||
public ItemStack getRecipeOutput()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack[] getRemainingItems(InventoryCrafting invCraft)
|
||||
{
|
||||
return new ItemStack[] { null, null, null, null, null, null, null, null, null };
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
package com.oitsjustjose.tinkers_addons.util;
|
||||
|
||||
import com.oitsjustjose.tinkers_addons.TinkersAddons;
|
||||
import com.oitsjustjose.tinkers_addons.lib.Lib;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.oredict.RecipeSorter;
|
||||
import net.minecraftforge.oredict.RecipeSorter.Category;
|
||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
|
||||
public class ModRecipes
|
||||
{
|
||||
public ModRecipes()
|
||||
{
|
||||
registerAutoRepairRecipe();
|
||||
registerBonusModRecipes();
|
||||
}
|
||||
|
||||
public void registerAutoRepairRecipe()
|
||||
{
|
||||
if (TinkersAddons.modConfig.autoRepairRecipeType == 1)
|
||||
{
|
||||
GameRegistry.addRecipe(new ItemStack(TinkersAddons.modItems.materials, 1, 0), new Object[] { "MMM", "MEM", "MMM", 'M', Blocks.MOSSY_COBBLESTONE, 'E', Items.BOOK });
|
||||
}
|
||||
else if (TinkersAddons.modConfig.autoRepairRecipeType == 2)
|
||||
{
|
||||
CraftingManager.getInstance().getRecipeList().add(new ModRecipeAmelioration());
|
||||
RecipeSorter.register(Lib.MODID + ":Amelioration", ModRecipeAmelioration.class, Category.SHAPED, "");
|
||||
}
|
||||
}
|
||||
|
||||
public void registerBonusModRecipes()
|
||||
{
|
||||
if (TinkersAddons.modConfig.enableExtraModifierLvl1)
|
||||
{
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(TinkersAddons.modItems.materials, 1, 1), "gemDiamond", "blockGold"));
|
||||
}
|
||||
if (TinkersAddons.modConfig.enableExtraModifierLvl2)
|
||||
{
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(TinkersAddons.modItems.materials, 1, 2), "blockDiamond", new ItemStack(Items.GOLDEN_APPLE, 1, 1)));
|
||||
}
|
||||
if (TinkersAddons.modConfig.enableExtraModifierLvl3)
|
||||
{
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(TinkersAddons.modItems.materials, 1, 3), Items.NETHER_STAR, new ItemStack(Items.SKULL, 1, Short.MAX_VALUE)));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue