Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bde8a80d5c | ||
|
|
b85ec11df1 | ||
|
|
75f2952908 | ||
|
|
6126e9b1c6 | ||
|
|
b4a4e6e2f6 | ||
|
|
db0aa92331 | ||
|
|
338cabfd4a | ||
|
|
0558c0bcf6 | ||
|
|
2993bb56d4 | ||
|
|
9b68ac8303 | ||
|
|
6d6632c183 | ||
|
|
55a8bd06f6 |
23 changed files with 297 additions and 193 deletions
7
.gitignore
vendored
7
.gitignore
vendored
|
|
@ -1,5 +1,12 @@
|
|||
.gradle
|
||||
/build/
|
||||
/run/
|
||||
/out/
|
||||
*.DS_STORE
|
||||
*.iml
|
||||
*.ipr
|
||||
*.launch
|
||||
*.iws
|
||||
|
||||
# Ignore Gradle GUI config
|
||||
gradle-app.setting
|
||||
|
|
|
|||
12
build.gradle
12
build.gradle
|
|
@ -20,7 +20,7 @@ repositories {
|
|||
|
||||
version = mod_version
|
||||
group= "com.oitsjustjose.tinkers_addons"
|
||||
archivesBaseName = "Tinkers' Addons-1.10.x"
|
||||
archivesBaseName = "Tinkers' Addons-${minecraft_version}"
|
||||
|
||||
minecraft {
|
||||
version = "${minecraft_version}-${forge_version}"
|
||||
|
|
@ -34,13 +34,13 @@ minecraft {
|
|||
replaceIn "lib/Lib.java"
|
||||
replace "@VERSION@", mod_version
|
||||
|
||||
mappings = "snapshot_20160518"
|
||||
mappings = "${mappings_version}"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
deobfCompile "mezz.jei:jei_${minecraft_version}:${jei_version}"
|
||||
deobfCompile "slimeknights.mantle:Mantle:1.10-${mantle_version}"
|
||||
deobfCompile "slimeknights:TConstruct:1.10-${ticon_version}"
|
||||
deobfCompile "slimeknights.mantle:Mantle:${mantle_version}"
|
||||
deobfCompile "slimeknights:TConstruct:${ticon_version}"
|
||||
}
|
||||
|
||||
task deobfJar(type: Jar) {
|
||||
|
|
@ -54,16 +54,12 @@ artifacts{
|
|||
|
||||
processResources
|
||||
{
|
||||
// this will ensure that this task is redone when the versions change.
|
||||
inputs.property "version", project.version
|
||||
inputs.property "mcversion", project.minecraft.version
|
||||
|
||||
// replace stuff in mcmod.info, nothing else
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
include 'mcmod.info'
|
||||
expand 'version':project.version, 'mcversion':project.minecraft.version
|
||||
}
|
||||
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
exclude 'mcmod.info'
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
1.0.6:
|
||||
* Fixed: Recipes being NBT insensitive.
|
||||
|
||||
1.0.5:
|
||||
* Added: Modifier Item Tooltips
|
||||
* Changed: New Textures!!
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
mod_version=1.0.5
|
||||
minecraft_version=1.10.2
|
||||
forge_version=12.18.2.2125
|
||||
mod_version=1.0.6
|
||||
minecraft_version=1.11.2
|
||||
forge_version=13.20.0.2299
|
||||
mappings_version=snapshot_20170504
|
||||
|
||||
jei_version=3.14.7.416
|
||||
mantle_version=0.10.3.jenkins158
|
||||
ticon_version=2.3.3a.jenkins289
|
||||
jei_version=4.3.5.277
|
||||
mantle_version=1.11.2-1.2.0.27
|
||||
ticon_version=1.11.2-2.7.0.9
|
||||
|
|
|
|||
|
|
@ -5,20 +5,19 @@ import com.oitsjustjose.tinkers_addons.lib.Lib;
|
|||
import com.oitsjustjose.tinkers_addons.lib.LibItems;
|
||||
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.proxy.CommonProxy;
|
||||
import com.oitsjustjose.tinkers_addons.util.Recipes;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||
import net.minecraftforge.fml.common.Mod.Instance;
|
||||
import net.minecraftforge.fml.common.SidedProxy;
|
||||
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, dependencies = "required-after:tconstruct@[1.10-2.3.3,);" + "required-after:mantle@[1.10-0.10.3,)", acceptedMinecraftVersions = "1.9.4")
|
||||
@Mod(modid = Lib.MODID, name = Lib.NAME, version = Lib.VERSION, guiFactory = Lib.GUI_FACTORY, dependencies = "required-after:tconstruct@[1.11-2.7.0.9,);", acceptedMinecraftVersions = "1.11")
|
||||
public class TinkersAddons
|
||||
{
|
||||
@Instance(Lib.MODID)
|
||||
|
|
@ -26,6 +25,7 @@ public class TinkersAddons
|
|||
|
||||
@SidedProxy(clientSide = Lib.CLIENT_PROXY, serverSide = Lib.COMMON_PROXY, modId = Lib.MODID)
|
||||
public static CommonProxy proxy;
|
||||
|
||||
public static Config modConfig;
|
||||
public static LibItems modItems;
|
||||
public static LibModifiers modModifiers;
|
||||
|
|
@ -34,8 +34,6 @@ public class TinkersAddons
|
|||
@EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event)
|
||||
{
|
||||
CommonProxy.preInit();
|
||||
|
||||
modConfig = new Config(event.getSuggestedConfigurationFile());
|
||||
modItems = new LibItems();
|
||||
modModifiers = new LibModifiers();
|
||||
|
|
@ -44,17 +42,11 @@ public class TinkersAddons
|
|||
MinecraftForge.EVENT_BUS.register(new ModAutoRepair());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void init(FMLInitializationEvent event)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void postInit(FMLPostInitializationEvent event)
|
||||
{
|
||||
if (event.getSide().isClient())
|
||||
ClientProxy.init();
|
||||
for (Item i : Lib.MOD_ITEMS)
|
||||
proxy.register(i);
|
||||
recipes = new Recipes();
|
||||
}
|
||||
}
|
||||
|
|
@ -40,9 +40,22 @@ public class ConfigGUI extends GuiConfig
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasConfigGui()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuiScreen createConfigGui(GuiScreen parentScreen)
|
||||
{
|
||||
return new ConfigGUI(parentScreen);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -8,6 +8,7 @@ import net.minecraft.creativetab.CreativeTabs;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
|
@ -24,7 +25,9 @@ public class ItemModifier extends Item
|
|||
{
|
||||
this.setHasSubtypes(true);
|
||||
this.setCreativeTab(TinkerRegistry.tabGeneral);
|
||||
GameRegistry.register(this, new ResourceLocation(Lib.MODID.toLowerCase(), "modifier_item"));
|
||||
this.setRegistryName(new ResourceLocation(Lib.MODID, "modifier_item"));
|
||||
this.setUnlocalizedName(Lib.MODID + ".modifier_item");
|
||||
GameRegistry.register(this);
|
||||
Lib.MOD_ITEMS.add(this);
|
||||
}
|
||||
|
||||
|
|
@ -42,7 +45,7 @@ public class ItemModifier extends Item
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> list)
|
||||
public void getSubItems(Item item, CreativeTabs tab, NonNullList<ItemStack> list)
|
||||
{
|
||||
for (int i = 0; i < TYPES.length; i++)
|
||||
list.add(new ItemStack(item, 1, i));
|
||||
|
|
@ -54,19 +57,19 @@ public class ItemModifier extends Item
|
|||
switch (stack.getItemDamage())
|
||||
{
|
||||
case 0:
|
||||
tooltip.add(I18n.translateToLocal("item.TinkersAddons.AMELIORATION_TOME.description"));
|
||||
tooltip.add(I18n.translateToLocal("item.tinkersaddons.AMELIORATION_TOME.description"));
|
||||
return;
|
||||
case 1:
|
||||
tooltip.add(I18n.translateToLocal("item.TinkersAddons.IRON_TOOLKIT.description"));
|
||||
tooltip.add(I18n.translateToLocal("item.tinkersaddons.IRON_TOOLKIT.description"));
|
||||
return;
|
||||
case 2:
|
||||
tooltip.add(I18n.translateToLocal("item.TinkersAddons.GOLD_TOOLKIT.description"));
|
||||
tooltip.add(I18n.translateToLocal("item.tinkersaddons.GOLD_TOOLKIT.description"));
|
||||
return;
|
||||
case 3:
|
||||
tooltip.add(I18n.translateToLocal("item.TinkersAddons.DIAMOND_TOOLKIT.description"));
|
||||
tooltip.add(I18n.translateToLocal("item.tinkersaddons.DIAMOND_TOOLKIT.description"));
|
||||
return;
|
||||
case 4:
|
||||
tooltip.add(I18n.translateToLocal("item.TinkersAddons.ENDER_TOOLKIT.description"));
|
||||
tooltip.add(I18n.translateToLocal("item.tinkersaddons.ENDER_TOOLKIT.description"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,11 +6,11 @@ import net.minecraft.item.Item;
|
|||
|
||||
public class Lib
|
||||
{
|
||||
public static final String MODID = "TinkersAddons";
|
||||
public static final String MODID = "tinkersaddons";
|
||||
public static final String NAME = "Tinkers' Addons";
|
||||
public static final String VERSION = "@VERSION@";
|
||||
public static final String CLIENT_PROXY = "com.oitsjustjose.tinkers_addons.util.ClientProxy";
|
||||
public static final String COMMON_PROXY = "com.oitsjustjose.tinkers_addons.util.CommonProxy";
|
||||
public static final String CLIENT_PROXY = "com.oitsjustjose.tinkers_addons.proxy.ClientProxy";
|
||||
public static final String COMMON_PROXY = "com.oitsjustjose.tinkers_addons.proxy.CommonProxy";
|
||||
public static final String GUI_FACTORY = "com.oitsjustjose.tinkers_addons.gui.ConfigGUI$GUIFactory";
|
||||
|
||||
public static final String TAG_AUTO_REPAIR = "Auto-Repair";
|
||||
|
|
|
|||
|
|
@ -17,24 +17,19 @@ public class LibModifiers
|
|||
public LibModifiers()
|
||||
{
|
||||
if (TinkersAddons.modConfig.enableAmelioration)
|
||||
{
|
||||
auto_repair = new ModAutoRepair();
|
||||
}
|
||||
|
||||
if (TinkersAddons.modConfig.enableExtraModifierLvl1)
|
||||
{
|
||||
extra_modifier_lvl1 = new ModExtraModifier(1);
|
||||
}
|
||||
|
||||
if (TinkersAddons.modConfig.enableExtraModifierLvl2)
|
||||
{
|
||||
extra_modifier_lvl2 = new ModExtraModifier(2);
|
||||
}
|
||||
|
||||
if (TinkersAddons.modConfig.enableExtraModifierLvl3)
|
||||
{
|
||||
extra_modifier_lvl3 = new ModExtraModifier(3);
|
||||
}
|
||||
|
||||
if (TinkersAddons.modConfig.enableExtraModifierLvl4)
|
||||
{
|
||||
extra_modifier_lvl4 = new ModExtraModifier(4);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -13,17 +13,17 @@ import net.minecraft.world.World;
|
|||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import slimeknights.tconstruct.library.modifiers.Modifier;
|
||||
import slimeknights.tconstruct.library.modifiers.ModifierAspect;
|
||||
import slimeknights.tconstruct.library.tools.ToolCore;
|
||||
import slimeknights.tconstruct.library.utils.TagUtil;
|
||||
import slimeknights.tconstruct.library.utils.ToolHelper;
|
||||
import slimeknights.tconstruct.tools.modifiers.ToolModifier;
|
||||
|
||||
public class ModAutoRepair extends Modifier
|
||||
public class ModAutoRepair extends ToolModifier
|
||||
{
|
||||
public ModAutoRepair()
|
||||
{
|
||||
super("auto-repair");
|
||||
super("auto-repair", 0x2CA401);
|
||||
this.addAspects(new ModifierAspect.LevelAspect(this, 5), new ModifierAspect.DataAspect(this, 0x2CA401), ModifierAspect.freeModifier);
|
||||
this.addItem(new ItemStack(TinkersAddons.modItems.materials, 1, 0), 1, 1);
|
||||
}
|
||||
|
|
@ -50,11 +50,11 @@ public class ModAutoRepair extends Modifier
|
|||
ArrayList<ItemStack> tinkersTools = new ArrayList<ItemStack>();
|
||||
int autoRepairLevel;
|
||||
for (ItemStack iterStack : player.inventory.mainInventory)
|
||||
if (iterStack != null && iterStack.getItem() instanceof ToolCore)
|
||||
if (!iterStack.isEmpty() && iterStack.getItem() instanceof ToolCore)
|
||||
tinkersTools.add(iterStack);
|
||||
|
||||
// Works to include items held in the second hand
|
||||
if (player.getHeldItemOffhand() != null && player.getHeldItemOffhand().getItem() instanceof ToolCore)
|
||||
if (!player.getHeldItemOffhand().isEmpty() && player.getHeldItemOffhand().getItem() instanceof ToolCore)
|
||||
tinkersTools.add(player.getHeldItemOffhand());
|
||||
|
||||
for (ItemStack iterStack : tinkersTools)
|
||||
|
|
|
|||
|
|
@ -4,16 +4,16 @@ import com.oitsjustjose.tinkers_addons.TinkersAddons;
|
|||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import slimeknights.tconstruct.library.modifiers.Modifier;
|
||||
import slimeknights.tconstruct.library.modifiers.ModifierAspect;
|
||||
import slimeknights.tconstruct.library.tools.ToolNBT;
|
||||
import slimeknights.tconstruct.library.utils.TagUtil;
|
||||
import slimeknights.tconstruct.tools.modifiers.ToolModifier;
|
||||
|
||||
public class ModExtraModifier extends Modifier
|
||||
public class ModExtraModifier extends ToolModifier
|
||||
{
|
||||
public ModExtraModifier(int level)
|
||||
{
|
||||
super("bonus-modifier_" + level);
|
||||
super("bonus-modifier_" + level, 0x8cf4e2);
|
||||
this.addAspects(new ModifierAspect.SingleAspect(this), new ModifierAspect.DataAspect(this, 0x8cf4e2));
|
||||
this.addItem(new ItemStack(TinkersAddons.modItems.materials, 1, level), 1, 1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,77 @@
|
|||
package com.oitsjustjose.tinkers_addons.proxy;
|
||||
|
||||
import com.oitsjustjose.tinkers_addons.lib.Lib;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.block.model.ModelBakery;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ClientProxy extends CommonProxy
|
||||
{
|
||||
CreativeTabs tab;
|
||||
String MODID = Lib.MODID;
|
||||
|
||||
/**
|
||||
* @param item
|
||||
* The Item to register a model registry for. You still have to make the model file, but now MC will know where to look
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void register(Item item)
|
||||
{
|
||||
tab = item.getCreativeTab();
|
||||
int meta = 0;
|
||||
|
||||
NonNullList<ItemStack> subItems = NonNullList.create();
|
||||
item.getSubItems(item, tab, subItems);
|
||||
for (ItemStack sub : subItems)
|
||||
{
|
||||
String name = item.getUnlocalizedName(sub).substring(MODID.length() + 6).toLowerCase();
|
||||
ModelBakery.registerItemVariants(item, new ResourceLocation(MODID, name));
|
||||
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, meta, new ModelResourceLocation(MODID + ":" + name, "inventory"));
|
||||
meta++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param block
|
||||
* The Item to register a model registry for. You still have to make the model file, but now MC will know where to look
|
||||
*/
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void register(Block block)
|
||||
{
|
||||
int meta = 0;
|
||||
ItemBlock itemBlock = new ItemBlock(block);
|
||||
// Checks if the block has metadata / subtypes
|
||||
if (itemBlock.getHasSubtypes())
|
||||
{
|
||||
NonNullList<ItemStack> subItems = NonNullList.create();
|
||||
itemBlock.getSubItems(itemBlock, tab, subItems);
|
||||
for (ItemStack sub : subItems)
|
||||
{
|
||||
String name = itemBlock.getUnlocalizedName(sub).toLowerCase().replace(MODID + ".", "").replace("tile.", "");
|
||||
ModelBakery.registerItemVariants(itemBlock, new ResourceLocation(MODID, name));
|
||||
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(itemBlock, meta, getLocation(block));
|
||||
meta++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(itemBlock, 0, getLocation(block));
|
||||
}
|
||||
}
|
||||
|
||||
private ModelResourceLocation getLocation(Block block)
|
||||
{
|
||||
return new ModelResourceLocation(MODID + ":" + block.getUnlocalizedName().substring(6).toLowerCase(), "inventory");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package com.oitsjustjose.tinkers_addons.proxy;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
/**
|
||||
* @author oitsjustjose
|
||||
*
|
||||
* Mostly a dummy class - not really used for anything in this mod's case
|
||||
*/
|
||||
|
||||
public class CommonProxy
|
||||
{
|
||||
public void register(Item item)
|
||||
{
|
||||
}
|
||||
|
||||
public void register(Block block)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
@ -1,102 +0,0 @@
|
|||
package com.oitsjustjose.tinkers_addons.util;
|
||||
|
||||
/**
|
||||
* @author oitsjustjose with asiekierka's help (and others)
|
||||
*
|
||||
* This code is free to be used to help you out. Just change the assignment of the variables
|
||||
* MODID and tab to be your proper MODID and CreativeTab, then this class will work for you!
|
||||
*
|
||||
* NOTE: It is assumed that you initialize your items' / blocks' unlocalized names using
|
||||
* .setUnlocalizedName(MODID + ".<youDesiredNameHere>"); - this is critical for function below
|
||||
*
|
||||
* Item models will need to be placed in assets/<your_modid_all_lowercase_no_spaces>/models/items
|
||||
* Block models will need to be placed in assets/<your_modid_all_lowercase_no_spaces>/models/blocks
|
||||
* Block models will need BlockState files too, in assets/<your_modid_all_lowercase_no_spaces>/blockstates
|
||||
*
|
||||
*/
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.oitsjustjose.tinkers_addons.lib.Lib;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.block.model.ModelBakery;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import slimeknights.tconstruct.library.TinkerRegistry;
|
||||
import slimeknights.tconstruct.library.client.model.ModifierModelLoader;
|
||||
|
||||
public class ClientProxy extends CommonProxy
|
||||
{
|
||||
static CreativeTabs tab = TinkerRegistry.tabParts;
|
||||
static String MODID = Lib.MODID;
|
||||
static ModifierModelLoader modifierLoader;
|
||||
|
||||
/**
|
||||
* Grabs all the items from my stored arraylist and registers them Super convenient, I'd suggest doing similar things, and adding a similar block variant if you need it (I didn't)
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void init()
|
||||
{
|
||||
ArrayList<Item> items = Lib.MOD_ITEMS;
|
||||
|
||||
for (Item i : items)
|
||||
register(i);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param item
|
||||
* The Item to register a model registry for. You still have to make the model file, but now MC will know where to look
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void register(Item item)
|
||||
{
|
||||
int meta = 0;
|
||||
|
||||
List<ItemStack> subItems = new ArrayList<ItemStack>();
|
||||
item.getSubItems(item, tab, subItems);
|
||||
for (ItemStack sub : subItems)
|
||||
{
|
||||
String name = item.getUnlocalizedName(sub).substring(MODID.length() + 6).toLowerCase();
|
||||
ModelBakery.registerItemVariants(item, new ResourceLocation(MODID.toLowerCase(), name));
|
||||
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, meta, new ModelResourceLocation(MODID.toLowerCase() + ":" + name, "inventory"));
|
||||
meta++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param block
|
||||
* The Item to register a model registry for. You still have to make the model file, but now MC will know where to look
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void register(Block block)
|
||||
{
|
||||
int meta = 0;
|
||||
Item itemBlock = Item.getItemFromBlock(block);
|
||||
// Checks if the block has metadata / subtypes
|
||||
if (itemBlock.getHasSubtypes())
|
||||
{
|
||||
List<ItemStack> subItems = new ArrayList<ItemStack>();
|
||||
itemBlock.getSubItems(itemBlock, tab, subItems);
|
||||
for (ItemStack sub : subItems)
|
||||
{
|
||||
String name = itemBlock.getUnlocalizedName(sub).toLowerCase().replace(MODID.toLowerCase() + ".", "").replace("tile.", "");
|
||||
ModelBakery.registerItemVariants(itemBlock, new ResourceLocation(MODID.toLowerCase(), name));
|
||||
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(itemBlock, meta, new ModelResourceLocation(MODID.toLowerCase() + ":" + name, "inventory"));
|
||||
meta++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(itemBlock, 0, new ModelResourceLocation(MODID.toLowerCase() + ":" + block.getUnlocalizedName().substring(MODID.length() + 6).toLowerCase(), "inventory"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
package com.oitsjustjose.tinkers_addons.util;
|
||||
|
||||
public class CommonProxy
|
||||
{
|
||||
public static void preInit()
|
||||
{
|
||||
};
|
||||
|
||||
public static void init()
|
||||
{
|
||||
};
|
||||
}
|
||||
|
|
@ -4,9 +4,11 @@ import com.oitsjustjose.tinkers_addons.TinkersAddons;
|
|||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.ShapedRecipes;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
import slimeknights.tconstruct.shared.TinkerCommons;
|
||||
import slimeknights.tconstruct.tools.TinkerMaterials;
|
||||
|
|
@ -21,28 +23,136 @@ public class Recipes
|
|||
|
||||
public void registerBonusModRecipes()
|
||||
{
|
||||
ItemStack plateItem = null;
|
||||
ItemStack centerItem = null;
|
||||
|
||||
if (TinkersAddons.modConfig.enableAmelioration)
|
||||
{
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(TinkersAddons.modItems.materials, 1, 0), new Object[] { new ItemStack(TinkerCommons.materials, 1, 19), new ItemStack(TinkerCommons.materials, 1, 19), new ItemStack(TinkerCommons.materials, 1, 19), Items.BOOK }));
|
||||
}
|
||||
if (TinkersAddons.modConfig.enableExtraModifierLvl1)
|
||||
{
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TinkersAddons.modItems.materials, 1, 1), new Object[] { "#S#", "###", '#', TinkerTools.largePlate.getItemstackWithMaterial(TinkerMaterials.iron), 'S', TinkerCommons.blockPigIron }));
|
||||
plateItem = TinkerTools.largePlate.getItemstackWithMaterial(TinkerMaterials.iron);
|
||||
centerItem = TinkerCommons.blockPigIron;
|
||||
GameRegistry.addRecipe(new NBTShapedRecipe(3, 2, new ItemStack[] { plateItem, centerItem, plateItem, plateItem, plateItem, plateItem }, new ItemStack(TinkersAddons.modItems.materials, 1, 1)));
|
||||
}
|
||||
if (TinkersAddons.modConfig.enableExtraModifierLvl2)
|
||||
{
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TinkersAddons.modItems.materials, 1, 2), new Object[] { "#S#", "###", '#', TinkerTools.largePlate.getItemstackWithMaterial(TinkerMaterials.ardite), 'S', Blocks.GOLD_BLOCK }));
|
||||
|
||||
plateItem = TinkerTools.largePlate.getItemstackWithMaterial(TinkerMaterials.ardite);
|
||||
centerItem = new ItemStack(Blocks.GOLD_BLOCK);
|
||||
GameRegistry.addRecipe(new NBTShapedRecipe(3, 2, new ItemStack[] { plateItem, centerItem, plateItem, plateItem, plateItem, plateItem }, new ItemStack(TinkersAddons.modItems.materials, 1, 2)));
|
||||
}
|
||||
if (TinkersAddons.modConfig.enableExtraModifierLvl3)
|
||||
{
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TinkersAddons.modItems.materials, 1, 3), new Object[] { "#S#", "###", '#', TinkerTools.largePlate.getItemstackWithMaterial(TinkerMaterials.prismarine), 'S', Blocks.DIAMOND_BLOCK }));
|
||||
|
||||
plateItem = TinkerTools.largePlate.getItemstackWithMaterial(TinkerMaterials.prismarine);
|
||||
centerItem = new ItemStack(Blocks.DIAMOND_BLOCK);
|
||||
GameRegistry.addRecipe(new NBTShapedRecipe(3, 2, new ItemStack[] { plateItem, centerItem, plateItem, plateItem, plateItem, plateItem }, new ItemStack(TinkersAddons.modItems.materials, 1, 3)));
|
||||
}
|
||||
if (TinkersAddons.modConfig.enableExtraModifierLvl4)
|
||||
{
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TinkersAddons.modItems.materials, 1, 4), new Object[] { "#S#", "###", '#', TinkerTools.largePlate.getItemstackWithMaterial(TinkerMaterials.obsidian), 'S', Items.ENDER_PEARL }));
|
||||
plateItem = TinkerTools.largePlate.getItemstackWithMaterial(TinkerMaterials.obsidian);
|
||||
centerItem = new ItemStack(Items.ENDER_PEARL);
|
||||
GameRegistry.addRecipe(new NBTShapedRecipe(3, 2, new ItemStack[] { plateItem, centerItem, plateItem, plateItem, plateItem, plateItem }, new ItemStack(TinkersAddons.modItems.materials, 1, 4)));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BloodWorkXGaming : https://github.com/BloodWorkXGaming
|
||||
*
|
||||
* An inner class for adding NBT-Sensitive recipes. All credit to BloodWorkXGaming for finding and fixing this bug for me. ORIGINAL CLASS: https://github.com/AllTheMods/OreExcavationIntegration/blob/master/src/main/java/atm/bloodworkxgaming/oei/Crafting/NBTShapedRecipe.java
|
||||
*
|
||||
*/
|
||||
public class NBTShapedRecipe extends ShapedRecipes
|
||||
{
|
||||
|
||||
public NBTShapedRecipe(int width, int height, ItemStack[] IngredientArray, ItemStack output)
|
||||
{
|
||||
super(width, height, IngredientArray, output);
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to check if a recipe matches current crafting inventory
|
||||
*/
|
||||
@Override
|
||||
public boolean matches(InventoryCrafting inv, World worldIn)
|
||||
{
|
||||
for (int i = 0; i <= 3 - this.recipeWidth; ++i)
|
||||
{
|
||||
for (int j = 0; j <= 3 - this.recipeHeight; ++j)
|
||||
{
|
||||
if (this.checkMatch(inv, i, j, true))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (this.checkMatch(inv, i, j, false))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the region of a crafting inventory is match for the recipe.
|
||||
*/
|
||||
private boolean checkMatch(InventoryCrafting inventoryCrafting, int horizontal, int vertical, boolean p_77573_4_)
|
||||
{
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
for (int j = 0; j < 3; ++j)
|
||||
{
|
||||
int k = i - horizontal;
|
||||
int l = j - vertical;
|
||||
ItemStack itemStackRecipe = ItemStack.EMPTY;
|
||||
|
||||
if (k >= 0 && l >= 0 && k < this.recipeWidth && l < this.recipeHeight)
|
||||
{
|
||||
if (p_77573_4_)
|
||||
{
|
||||
itemStackRecipe = this.recipeItems[this.recipeWidth - k - 1 + l * this.recipeWidth];
|
||||
}
|
||||
else
|
||||
{
|
||||
itemStackRecipe = this.recipeItems[k + l * this.recipeWidth];
|
||||
}
|
||||
}
|
||||
|
||||
ItemStack input = inventoryCrafting.getStackInRowAndColumn(i, j);
|
||||
|
||||
if (!input.isEmpty() || !itemStackRecipe.isEmpty())
|
||||
{
|
||||
if (input.isEmpty() != itemStackRecipe.isEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (itemStackRecipe.getItem() != input.getItem())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (itemStackRecipe.getMetadata() != 32767 && itemStackRecipe.getMetadata() != input.getMetadata())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (itemStackRecipe.hasTagCompound() && input.hasTagCompound())
|
||||
{
|
||||
if (!itemStackRecipe.getTagCompound().equals(input.getTagCompound()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,14 +1,14 @@
|
|||
#Items
|
||||
item.TinkersAddons.AMELIORATION_TOME.name=Amelioration Tome
|
||||
item.TinkersAddons.AMELIORATION_TOME.description=§2Auto-Repair Modifier§r
|
||||
item.TinkersAddons.IRON_TOOLKIT.name=Iron Toolkit
|
||||
item.TinkersAddons.IRON_TOOLKIT.description=§3Grants an Extra Modifier§r
|
||||
item.TinkersAddons.GOLD_TOOLKIT.name=Gold Toolkit
|
||||
item.TinkersAddons.GOLD_TOOLKIT.description=§3Grants an Extra Modifier§r
|
||||
item.TinkersAddons.DIAMOND_TOOLKIT.name=Diamond Toolkit
|
||||
item.TinkersAddons.DIAMOND_TOOLKIT.description=§3Grants an Extra Modifier§r
|
||||
item.TinkersAddons.ENDER_TOOLKIT.name=Ender Toolkit
|
||||
item.TinkersAddons.ENDER_TOOLKIT.description=§3Grants an Extra Modifier§r
|
||||
item.tinkersaddons.AMELIORATION_TOME.name=Amelioration Tome
|
||||
item.tinkersaddons.AMELIORATION_TOME.description=§2Auto-Repair Modifier§r
|
||||
item.tinkersaddons.IRON_TOOLKIT.name=Iron Toolkit
|
||||
item.tinkersaddons.IRON_TOOLKIT.description=§3Grants an Extra Modifier§r
|
||||
item.tinkersaddons.GOLD_TOOLKIT.name=Gold Toolkit
|
||||
item.tinkersaddons.GOLD_TOOLKIT.description=§3Grants an Extra Modifier§r
|
||||
item.tinkersaddons.DIAMOND_TOOLKIT.name=Diamond Toolkit
|
||||
item.tinkersaddons.DIAMOND_TOOLKIT.description=§3Grants an Extra Modifier§r
|
||||
item.tinkersaddons.ENDER_TOOLKIT.name=Ender Toolkit
|
||||
item.tinkersaddons.ENDER_TOOLKIT.description=§3Grants an Extra Modifier§r
|
||||
|
||||
#Modifiers
|
||||
modifier.auto-repair.name=Amelioration
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"parent": "item/handheld",
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "tinkersaddons:items/amelioration_tome"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"parent": "item/handheld",
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "tinkersaddons:items/diamond_toolkit"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"parent": "item/handheld",
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "tinkersaddons:items/ender_toolkit"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"parent": "item/handheld",
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "tinkersaddons:items/gold_toolkit"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"parent": "item/handheld",
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "tinkersaddons:items/iron_toolkit"
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
Loading…
Reference in a new issue