Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9de1f3fc5b |
32 changed files with 662 additions and 625 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
|
@ -7,10 +7,6 @@
|
||||||
*.ipr
|
*.ipr
|
||||||
*.launch
|
*.launch
|
||||||
*.iws
|
*.iws
|
||||||
bin/**
|
|
||||||
org.eclipse.*
|
|
||||||
.project
|
|
||||||
.classpath
|
|
||||||
|
|
||||||
# Ignore Gradle GUI config
|
# Ignore Gradle GUI config
|
||||||
gradle-app.setting
|
gradle-app.setting
|
||||||
|
|
|
||||||
18
build.gradle
18
build.gradle
|
|
@ -1,10 +1,13 @@
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
jcenter()
|
jcenter()
|
||||||
maven { url = "http://files.minecraftforge.net/maven" }
|
maven {
|
||||||
|
name = "forge"
|
||||||
|
url = "http://files.minecraftforge.net/maven"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
|
classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
apply plugin: 'net.minecraftforge.gradle.forge'
|
apply plugin: 'net.minecraftforge.gradle.forge'
|
||||||
|
|
@ -13,10 +16,6 @@ repositories {
|
||||||
maven {
|
maven {
|
||||||
url = "http://dvs1.progwml6.com/files/maven"
|
url = "http://dvs1.progwml6.com/files/maven"
|
||||||
}
|
}
|
||||||
maven {
|
|
||||||
name = "CurseForge"
|
|
||||||
url = "https://minecraft.curseforge.com/api/maven/"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
version = mod_version
|
version = mod_version
|
||||||
|
|
@ -35,14 +34,13 @@ minecraft {
|
||||||
replaceIn "lib/Lib.java"
|
replaceIn "lib/Lib.java"
|
||||||
replace "@VERSION@", mod_version
|
replace "@VERSION@", mod_version
|
||||||
|
|
||||||
mappings = "${mappings_version}"
|
mappings = "snapshot_20160518"
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
deobfCompile "mezz.jei:jei_${minecraft_version}:${jei_version}"
|
deobfCompile "mezz.jei:jei_${minecraft_version}:${jei_version}"
|
||||||
deobfCompile "slimeknights.mantle:Mantle:1.12-${mantle_version}"
|
deobfCompile "slimeknights.mantle:Mantle:1.10-${mantle_version}"
|
||||||
deobfCompile "slimeknights:TConstruct:${minecraft_version}-${ticon_version}"
|
deobfCompile "slimeknights:TConstruct:1.10-${ticon_version}"
|
||||||
deobfCompile "constructs-armory:conarm:${conarm_version}"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
task deobfJar(type: Jar) {
|
task deobfJar(type: Jar) {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,3 @@
|
||||||
1.0.6:
|
|
||||||
* Fixed: Duplicate creation of amelioration modifier
|
|
||||||
|
|
||||||
1.0.6:
|
1.0.6:
|
||||||
* Fixed: Recipes being NBT insensitive.
|
* Fixed: Recipes being NBT insensitive.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
mod_version=1.0.7
|
mod_version=1.0.6
|
||||||
minecraft_version=1.12.2
|
minecraft_version=1.10.2
|
||||||
forge_version=14.23.3.2670
|
forge_version=12.18.2.2125
|
||||||
mappings_version=snapshot_20180420
|
|
||||||
|
|
||||||
jei_version=4.9.1.165
|
jei_version=3.14.7.416
|
||||||
mantle_version=1.3.2.25
|
mantle_version=0.10.3.jenkins158
|
||||||
ticon_version=2.9.1.70
|
ticon_version=2.3.3a.jenkins289
|
||||||
conarm_version=1.12.2:1.2.5.4
|
|
||||||
|
|
|
||||||
0
gradlew
vendored
Executable file → Normal file
0
gradlew
vendored
Executable file → Normal file
|
|
@ -4,34 +4,57 @@ import com.oitsjustjose.tinkers_addons.lib.Config;
|
||||||
import com.oitsjustjose.tinkers_addons.lib.Lib;
|
import com.oitsjustjose.tinkers_addons.lib.Lib;
|
||||||
import com.oitsjustjose.tinkers_addons.lib.LibItems;
|
import com.oitsjustjose.tinkers_addons.lib.LibItems;
|
||||||
import com.oitsjustjose.tinkers_addons.lib.LibModifiers;
|
import com.oitsjustjose.tinkers_addons.lib.LibModifiers;
|
||||||
import com.oitsjustjose.tinkers_addons.util.ClientRegistry;
|
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.Recipes;
|
||||||
|
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.fml.common.Mod;
|
import net.minecraftforge.fml.common.Mod;
|
||||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||||
import net.minecraftforge.fml.common.Mod.Instance;
|
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;
|
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.12-2.7.3.30,);"
|
@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")
|
||||||
+ "required-after:mantle@[1.12-1.3.1.21,)")
|
|
||||||
public class TinkersAddons
|
public class TinkersAddons
|
||||||
{
|
{
|
||||||
@Instance(Lib.MODID)
|
@Instance(Lib.MODID)
|
||||||
public static TinkersAddons instance;
|
public static TinkersAddons instance;
|
||||||
|
|
||||||
public static Config modConfig;
|
@SidedProxy(clientSide = Lib.CLIENT_PROXY, serverSide = Lib.COMMON_PROXY, modId = Lib.MODID)
|
||||||
public static LibItems modItems;
|
public static CommonProxy proxy;
|
||||||
public static LibModifiers modModifiers;
|
public static Config modConfig;
|
||||||
public static ClientRegistry clientRegistry;
|
public static LibItems modItems;
|
||||||
|
public static LibModifiers modModifiers;
|
||||||
|
public Recipes recipes;
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void preInit(FMLPreInitializationEvent event)
|
public void preInit(FMLPreInitializationEvent event)
|
||||||
{
|
{
|
||||||
modConfig = new Config(event.getSuggestedConfigurationFile());
|
CommonProxy.preInit();
|
||||||
MinecraftForge.EVENT_BUS.register(modConfig);
|
|
||||||
clientRegistry = new ClientRegistry();
|
modConfig = new Config(event.getSuggestedConfigurationFile());
|
||||||
MinecraftForge.EVENT_BUS.register(clientRegistry);
|
modItems = new LibItems();
|
||||||
modItems = new LibItems();
|
modModifiers = new LibModifiers();
|
||||||
modModifiers = new LibModifiers();
|
|
||||||
}
|
MinecraftForge.EVENT_BUS.register(modConfig);
|
||||||
|
MinecraftForge.EVENT_BUS.register(new ModAutoRepair());
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void init(FMLInitializationEvent event)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void postInit(FMLPostInitializationEvent event)
|
||||||
|
{
|
||||||
|
if (event.getSide().isClient())
|
||||||
|
ClientProxy.init();
|
||||||
|
recipes = new Recipes();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -14,38 +14,35 @@ import net.minecraftforge.fml.client.config.GuiConfig;
|
||||||
|
|
||||||
public class ConfigGUI extends GuiConfig
|
public class ConfigGUI extends GuiConfig
|
||||||
{
|
{
|
||||||
public ConfigGUI(GuiScreen guiScreen)
|
public ConfigGUI(GuiScreen guiScreen)
|
||||||
{
|
{
|
||||||
super(guiScreen,
|
super(guiScreen, new ConfigElement(TinkersAddons.modConfig.config.getCategory(Configuration.CATEGORY_GENERAL)).getChildElements(), Lib.MODID, false, true, GuiConfig.getAbridgedConfigPath(TinkersAddons.modConfig.config.toString()));
|
||||||
new ConfigElement(TinkersAddons.modConfig.config.getCategory(Configuration.CATEGORY_GENERAL))
|
}
|
||||||
.getChildElements(),
|
|
||||||
Lib.MODID, false, true, GuiConfig.getAbridgedConfigPath(TinkersAddons.modConfig.config.toString()));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class GUIFactory implements IModGuiFactory
|
public static class GUIFactory implements IModGuiFactory
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void initialize(Minecraft minecraftInstance)
|
public void initialize(Minecraft minecraftInstance)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories()
|
public Class<? extends GuiScreen> mainConfigGuiClass()
|
||||||
{
|
{
|
||||||
return null;
|
return ConfigGUI.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasConfigGui()
|
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories()
|
||||||
{
|
{
|
||||||
return true;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GuiScreen createConfigGui(GuiScreen parentScreen)
|
public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element)
|
||||||
{
|
{
|
||||||
return new ConfigGUI(parentScreen);
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2,21 +2,15 @@ package com.oitsjustjose.tinkers_addons.items;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
import com.oitsjustjose.tinkers_addons.TinkersAddons;
|
|
||||||
import com.oitsjustjose.tinkers_addons.lib.Lib;
|
import com.oitsjustjose.tinkers_addons.lib.Lib;
|
||||||
|
|
||||||
import net.minecraft.client.util.ITooltipFlag;
|
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.IStringSerializable;
|
|
||||||
import net.minecraft.util.NonNullList;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.text.translation.I18n;
|
import net.minecraft.util.text.translation.I18n;
|
||||||
import net.minecraft.world.World;
|
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||||
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
import slimeknights.tconstruct.library.TinkerRegistry;
|
import slimeknights.tconstruct.library.TinkerRegistry;
|
||||||
|
|
@ -24,107 +18,56 @@ import slimeknights.tconstruct.library.TinkerRegistry;
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public class ItemModifier extends Item
|
public class ItemModifier extends Item
|
||||||
{
|
{
|
||||||
public ItemModifier()
|
private final String[] TYPES = new String[] { "AMELIORATION_TOME", "IRON_TOOLKIT", "GOLD_TOOLKIT", "DIAMOND_TOOLKIT", "ENDER_TOOLKIT" };
|
||||||
{
|
|
||||||
this.setHasSubtypes(true);
|
|
||||||
this.setCreativeTab(TinkerRegistry.tabGeneral);
|
|
||||||
this.setRegistryName(new ResourceLocation(Lib.MODID, "modifier_item"));
|
|
||||||
this.setUnlocalizedName(this.getRegistryName().toString().replaceAll(":", "."));
|
|
||||||
ForgeRegistries.ITEMS.register(this);
|
|
||||||
this.registerModels();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void registerModels()
|
public ItemModifier()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < EnumType.values().length; i++)
|
this.setHasSubtypes(true);
|
||||||
{
|
this.setCreativeTab(TinkerRegistry.tabGeneral);
|
||||||
TinkersAddons.clientRegistry.register(new ItemStack(this, 1, i),
|
GameRegistry.register(this, new ResourceLocation(Lib.MODID.toLowerCase(), "modifier_item"));
|
||||||
new ResourceLocation(Lib.MODID, EnumType.byMetadata(i).getName()), "inventory");
|
Lib.MOD_ITEMS.add(this);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasEffect(ItemStack itemstack)
|
public boolean hasEffect(ItemStack itemstack)
|
||||||
{
|
{
|
||||||
return itemstack.getItemDamage() == 0;
|
return itemstack.getItemDamage() == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUnlocalizedName(ItemStack stack)
|
public String getUnlocalizedName(ItemStack itemStack)
|
||||||
{
|
{
|
||||||
return Lib.MODID + "." + EnumType.byMetadata(stack.getMetadata()).getName();
|
return "item." + Lib.MODID + "." + TYPES[itemStack.getItemDamage()];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> items)
|
public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> list)
|
||||||
{
|
{
|
||||||
if (this.isInCreativeTab(tab))
|
for (int i = 0; i < TYPES.length; i++)
|
||||||
{
|
list.add(new ItemStack(item, 1, i));
|
||||||
for (int i = 0; i < EnumType.values().length; i++)
|
}
|
||||||
{
|
|
||||||
items.add(new ItemStack(this, 1, i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@SideOnly(Side.CLIENT)
|
||||||
@SideOnly(Side.CLIENT)
|
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced)
|
||||||
public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn)
|
{
|
||||||
{
|
switch (stack.getItemDamage())
|
||||||
tooltip.add(
|
{
|
||||||
I18n.translateToLocal(Lib.MODID + "." + EnumType.byMetadata(stack.getItemDamage()) + ".description"));
|
case 0:
|
||||||
}
|
tooltip.add(I18n.translateToLocal("item.TinkersAddons.AMELIORATION_TOME.description"));
|
||||||
|
return;
|
||||||
public enum EnumType implements IStringSerializable
|
case 1:
|
||||||
{
|
tooltip.add(I18n.translateToLocal("item.TinkersAddons.IRON_TOOLKIT.description"));
|
||||||
AMELIORATION_TOME(0, "amelioration_tome"), IRON_TOOLKIT(1, "iron_toolkit"), GOLD_TOOLKIT(2, "gold_toolkit"),
|
return;
|
||||||
DIAMOND_TOOLKIT(3, "diamond_toolkit"), ENDER_TOOLKIT(4, "ender_toolkit");
|
case 2:
|
||||||
|
tooltip.add(I18n.translateToLocal("item.TinkersAddons.GOLD_TOOLKIT.description"));
|
||||||
private static final EnumType[] META_LOOKUP = new EnumType[values().length];
|
return;
|
||||||
|
case 3:
|
||||||
static
|
tooltip.add(I18n.translateToLocal("item.TinkersAddons.DIAMOND_TOOLKIT.description"));
|
||||||
{
|
return;
|
||||||
for (EnumType type : values())
|
case 4:
|
||||||
{
|
tooltip.add(I18n.translateToLocal("item.TinkersAddons.ENDER_TOOLKIT.description"));
|
||||||
META_LOOKUP[type.getMetadata()] = type;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final int meta;
|
|
||||||
private final String serializedName;
|
|
||||||
private final String unlocalizedName;
|
|
||||||
|
|
||||||
EnumType(int meta, String name)
|
|
||||||
{
|
|
||||||
this.meta = meta;
|
|
||||||
this.serializedName = name;
|
|
||||||
this.unlocalizedName = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static EnumType byMetadata(int meta)
|
|
||||||
{
|
|
||||||
if (meta < 0 || meta >= META_LOOKUP.length)
|
|
||||||
{
|
|
||||||
meta = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return META_LOOKUP[meta];
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getMetadata()
|
|
||||||
{
|
|
||||||
return this.meta;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
return this.unlocalizedName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName()
|
|
||||||
{
|
|
||||||
return this.serializedName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -2,66 +2,59 @@ package com.oitsjustjose.tinkers_addons.lib;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import net.minecraftforge.common.config.Configuration;
|
|
||||||
import net.minecraftforge.common.config.Property;
|
import net.minecraftforge.common.config.Property;
|
||||||
|
import net.minecraftforge.common.config.Configuration;
|
||||||
import net.minecraftforge.fml.client.event.ConfigChangedEvent;
|
import net.minecraftforge.fml.client.event.ConfigChangedEvent;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
|
||||||
public class Config
|
public class Config
|
||||||
{
|
{
|
||||||
public Configuration config;
|
public Configuration config;
|
||||||
|
|
||||||
public boolean enableAmelioration;
|
public boolean enableAmelioration;
|
||||||
public boolean enableExtraModifierLvl1;
|
public boolean enableExtraModifierLvl1;
|
||||||
public boolean enableExtraModifierLvl2;
|
public boolean enableExtraModifierLvl2;
|
||||||
public boolean enableExtraModifierLvl3;
|
public boolean enableExtraModifierLvl3;
|
||||||
public boolean enableExtraModifierLvl4;
|
public boolean enableExtraModifierLvl4;
|
||||||
|
|
||||||
public Config(File file)
|
public Config(File file)
|
||||||
{
|
{
|
||||||
config = new Configuration(file);
|
config = new Configuration(file);
|
||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void initialize()
|
void initialize()
|
||||||
{
|
{
|
||||||
Property property;
|
Property property;
|
||||||
|
|
||||||
property = config.get(Configuration.CATEGORY_GENERAL, "Enable Amelioration Kit mod for tools", true)
|
property = config.get(Configuration.CATEGORY_GENERAL, "Enable Amelioration Kit mod for tools", true).setRequiresMcRestart(true);
|
||||||
.setRequiresMcRestart(true);
|
property.setComment("Amelioration Kits are the method of getting Pre-TiCon 2 auto-repair");
|
||||||
property.setComment("Amelioration Kits are the method of getting Pre-TiCon 2 auto-repair");
|
enableAmelioration = property.getBoolean();
|
||||||
enableAmelioration = property.getBoolean();
|
|
||||||
|
|
||||||
property = config.get(Configuration.CATEGORY_GENERAL, "Enable 1st bonus modifier mod for tools", true)
|
property = config.get(Configuration.CATEGORY_GENERAL, "Enable 1st bonus modifier mod for tools", true).setRequiresMcRestart(true);
|
||||||
.setRequiresMcRestart(true);
|
property.setComment("Re-adds the diamond + gold block recipe to increase modifiers on a tool if enabled");
|
||||||
property.setComment("Re-adds the diamond + gold block recipe to increase modifiers on a tool if enabled");
|
enableExtraModifierLvl1 = property.getBoolean();
|
||||||
enableExtraModifierLvl1 = property.getBoolean();
|
|
||||||
|
|
||||||
property = config.get(Configuration.CATEGORY_GENERAL, "Enable 2nd bonus modifier mod for tools", true)
|
property = config.get(Configuration.CATEGORY_GENERAL, "Enable 2nd bonus modifier mod for tools", true).setRequiresMcRestart(true);
|
||||||
.setRequiresMcRestart(true);
|
property.setComment("Re-adds the diamond block + gold apple recipe to increase modifiers on a tool if enabled");
|
||||||
property.setComment("Re-adds the diamond block + gold apple recipe to increase modifiers on a tool if enabled");
|
enableExtraModifierLvl2 = property.getBoolean();
|
||||||
enableExtraModifierLvl2 = property.getBoolean();
|
|
||||||
|
|
||||||
property = config.get(Configuration.CATEGORY_GENERAL, "Enable 3rd bonus modifier mod for tools", true)
|
property = config.get(Configuration.CATEGORY_GENERAL, "Enable 3rd bonus modifier mod for tools", true).setRequiresMcRestart(true);
|
||||||
.setRequiresMcRestart(true);
|
property.setComment("Re-adds the nether star recipe to increase modifiers on a tool if enabled");
|
||||||
property.setComment("Re-adds the nether star recipe to increase modifiers on a tool if enabled");
|
enableExtraModifierLvl3 = property.getBoolean();
|
||||||
enableExtraModifierLvl3 = property.getBoolean();
|
|
||||||
|
|
||||||
property = config.get(Configuration.CATEGORY_GENERAL, "Enable 4th bonus modifier mod for tools", true)
|
property = config.get(Configuration.CATEGORY_GENERAL, "Enable 4th bonus modifier mod for tools", true).setRequiresMcRestart(true);
|
||||||
.setRequiresMcRestart(true);
|
property.setComment("Adds a new Dragon Egg based Bonus Modifier if enabled");
|
||||||
property.setComment("Adds a new Dragon Egg based Bonus Modifier if enabled");
|
enableExtraModifierLvl4 = property.getBoolean();
|
||||||
enableExtraModifierLvl4 = property.getBoolean();
|
|
||||||
|
|
||||||
if (config.hasChanged())
|
if (config.hasChanged())
|
||||||
config.save();
|
config.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onConfigurationChangedEvent(ConfigChangedEvent.OnConfigChangedEvent event)
|
public void onConfigurationChangedEvent(ConfigChangedEvent.OnConfigChangedEvent event)
|
||||||
{
|
{
|
||||||
if (event.getModID().equalsIgnoreCase(Lib.MODID))
|
if (event.getModID().equalsIgnoreCase(Lib.MODID))
|
||||||
{
|
initialize();
|
||||||
initialize();
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,21 @@
|
||||||
package com.oitsjustjose.tinkers_addons.lib;
|
package com.oitsjustjose.tinkers_addons.lib;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
|
||||||
public class Lib
|
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 NAME = "Tinkers' Addons";
|
||||||
public static final String VERSION = "@VERSION@";
|
public static final String VERSION = "@VERSION@";
|
||||||
public static final String GUI_FACTORY = "com.oitsjustjose.tinkers_addons.gui.ConfigGUI$GUIFactory";
|
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 GUI_FACTORY = "com.oitsjustjose.tinkers_addons.gui.ConfigGUI$GUIFactory";
|
||||||
|
|
||||||
public static final String TAG_AUTO_REPAIR_COOLDOWN = "Last Auto-Repair";
|
public static final String TAG_AUTO_REPAIR = "Auto-Repair";
|
||||||
|
public static final String TAG_AUTO_REPAIR_COOLDOWN = "Last Auto-Repair";
|
||||||
|
public static final String TAG_REDSTONE_FLUX = "Redstone Flux";
|
||||||
|
|
||||||
|
public static final ArrayList<Item> MOD_ITEMS = new ArrayList<Item>();
|
||||||
}
|
}
|
||||||
|
|
@ -6,10 +6,10 @@ import net.minecraft.item.Item;
|
||||||
|
|
||||||
public class LibItems
|
public class LibItems
|
||||||
{
|
{
|
||||||
public Item MODIFIERS;
|
public Item materials;
|
||||||
|
|
||||||
public LibItems()
|
public LibItems()
|
||||||
{
|
{
|
||||||
MODIFIERS = new ItemModifier();
|
materials = new ItemModifier();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,33 +8,33 @@ import slimeknights.tconstruct.library.modifiers.Modifier;
|
||||||
|
|
||||||
public class LibModifiers
|
public class LibModifiers
|
||||||
{
|
{
|
||||||
public Modifier auto_repair;
|
public Modifier auto_repair;
|
||||||
public Modifier extra_modifier_lvl1;
|
public Modifier extra_modifier_lvl1;
|
||||||
public Modifier extra_modifier_lvl2;
|
public Modifier extra_modifier_lvl2;
|
||||||
public Modifier extra_modifier_lvl3;
|
public Modifier extra_modifier_lvl3;
|
||||||
public Modifier extra_modifier_lvl4;
|
public Modifier extra_modifier_lvl4;
|
||||||
|
|
||||||
public LibModifiers()
|
public LibModifiers()
|
||||||
{
|
{
|
||||||
if (TinkersAddons.modConfig.enableAmelioration)
|
if (TinkersAddons.modConfig.enableAmelioration)
|
||||||
{
|
{
|
||||||
auto_repair = new ModAutoRepair();
|
auto_repair = new ModAutoRepair();
|
||||||
}
|
}
|
||||||
if (TinkersAddons.modConfig.enableExtraModifierLvl1)
|
if (TinkersAddons.modConfig.enableExtraModifierLvl1)
|
||||||
{
|
{
|
||||||
extra_modifier_lvl1 = new ModExtraModifier(1);
|
extra_modifier_lvl1 = new ModExtraModifier(1);
|
||||||
}
|
}
|
||||||
if (TinkersAddons.modConfig.enableExtraModifierLvl2)
|
if (TinkersAddons.modConfig.enableExtraModifierLvl2)
|
||||||
{
|
{
|
||||||
extra_modifier_lvl2 = new ModExtraModifier(2);
|
extra_modifier_lvl2 = new ModExtraModifier(2);
|
||||||
}
|
}
|
||||||
if (TinkersAddons.modConfig.enableExtraModifierLvl3)
|
if (TinkersAddons.modConfig.enableExtraModifierLvl3)
|
||||||
{
|
{
|
||||||
extra_modifier_lvl3 = new ModExtraModifier(3);
|
extra_modifier_lvl3 = new ModExtraModifier(3);
|
||||||
}
|
}
|
||||||
if (TinkersAddons.modConfig.enableExtraModifierLvl4)
|
if (TinkersAddons.modConfig.enableExtraModifierLvl4)
|
||||||
{
|
{
|
||||||
extra_modifier_lvl4 = new ModExtraModifier(4);
|
extra_modifier_lvl4 = new ModExtraModifier(4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -10,7 +10,6 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.nbt.NBTTagList;
|
import net.minecraft.nbt.NBTTagList;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
|
||||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||||
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
|
@ -22,96 +21,79 @@ import slimeknights.tconstruct.library.utils.ToolHelper;
|
||||||
|
|
||||||
public class ModAutoRepair extends Modifier
|
public class ModAutoRepair extends Modifier
|
||||||
{
|
{
|
||||||
public ModAutoRepair()
|
public ModAutoRepair()
|
||||||
{
|
{
|
||||||
super("auto-repair");
|
super("auto-repair");
|
||||||
this.addAspects(new ModifierAspect.LevelAspect(this, 5), new ModifierAspect.DataAspect(this, 0x2CA401),
|
this.addAspects(new ModifierAspect.LevelAspect(this, 5), new ModifierAspect.DataAspect(this, 0x2CA401), ModifierAspect.freeModifier);
|
||||||
ModifierAspect.freeModifier);
|
this.addItem(new ItemStack(TinkersAddons.modItems.materials, 1, 0), 1, 1);
|
||||||
this.addItem(new ItemStack(TinkersAddons.modItems.MODIFIERS, 1, 0), 1, 1);
|
}
|
||||||
MinecraftForge.EVENT_BUS.register(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTooltip(NBTTagCompound modifierTag, boolean detailed)
|
public String getTooltip(NBTTagCompound modifierTag, boolean detailed)
|
||||||
{
|
{
|
||||||
return super.getTooltip(modifierTag, detailed);
|
return super.getTooltip(modifierTag, detailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void applyEffect(NBTTagCompound rootCompound, NBTTagCompound modifierTag)
|
public void applyEffect(NBTTagCompound rootCompound, NBTTagCompound modifierTag)
|
||||||
{
|
{
|
||||||
// Nothing special to do here
|
// Nothing special to do here
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
||||||
public void onUpdate(PlayerEvent event)
|
public void onUpdate(PlayerEvent event)
|
||||||
{
|
{
|
||||||
if (event.getEntityPlayer() == null)
|
if (event.getEntityPlayer() == null)
|
||||||
{
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
EntityPlayer player = event.getEntityPlayer();
|
EntityPlayer player = event.getEntityPlayer();
|
||||||
ArrayList<ItemStack> tinkersTools = new ArrayList<ItemStack>();
|
ArrayList<ItemStack> tinkersTools = new ArrayList<ItemStack>();
|
||||||
int autoRepairLevel;
|
int autoRepairLevel;
|
||||||
for (ItemStack iterStack : player.inventory.mainInventory)
|
for (ItemStack iterStack : player.inventory.mainInventory)
|
||||||
{
|
if (iterStack != null && iterStack.getItem() instanceof ToolCore)
|
||||||
if (iterStack != null && iterStack.getItem() instanceof ToolCore)
|
tinkersTools.add(iterStack);
|
||||||
{
|
|
||||||
tinkersTools.add(iterStack);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Works to include items held in the second hand
|
// Works to include items held in the second hand
|
||||||
if (player.getHeldItemOffhand() != null && player.getHeldItemOffhand().getItem() instanceof ToolCore)
|
if (player.getHeldItemOffhand() != null && player.getHeldItemOffhand().getItem() instanceof ToolCore)
|
||||||
{
|
tinkersTools.add(player.getHeldItemOffhand());
|
||||||
tinkersTools.add(player.getHeldItemOffhand());
|
|
||||||
}
|
|
||||||
|
|
||||||
for (ItemStack iterStack : tinkersTools)
|
for (ItemStack iterStack : tinkersTools)
|
||||||
{
|
{
|
||||||
autoRepairLevel = 0;
|
autoRepairLevel = 0;
|
||||||
NBTTagCompound tag = TagUtil.getToolTag(iterStack.getTagCompound());
|
NBTTagCompound tag = TagUtil.getToolTag(iterStack.getTagCompound());
|
||||||
NBTTagList tagList = TagUtil.getModifiersTagList(iterStack);
|
NBTTagList tagList = TagUtil.getModifiersTagList(iterStack);
|
||||||
for (int i = 0; i < tagList.tagCount(); i++)
|
for (int i = 0; i < tagList.tagCount(); i++)
|
||||||
{
|
{
|
||||||
if (tagList.get(i) instanceof NBTTagCompound)
|
if (tagList.get(i) instanceof NBTTagCompound)
|
||||||
{
|
{
|
||||||
NBTTagCompound currTag = (NBTTagCompound) tagList.get(i);
|
NBTTagCompound currTag = (NBTTagCompound) tagList.get(i);
|
||||||
if (currTag.getString("identifier").contains("auto-repair"))
|
if (currTag.getString("identifier").contains("auto-repair"))
|
||||||
{
|
{
|
||||||
autoRepairLevel = currTag.getInteger("level");
|
autoRepairLevel = currTag.getInteger("level");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
long lastRepairTime = tag.getLong(Lib.TAG_AUTO_REPAIR_COOLDOWN);
|
long lastRepairTime = tag.getLong(Lib.TAG_AUTO_REPAIR_COOLDOWN);
|
||||||
|
|
||||||
if (autoRepairLevel > 0 && (System.currentTimeMillis() - lastRepairTime) >= (getRepairCooldown(player))
|
if (autoRepairLevel > 0 && (System.currentTimeMillis() - lastRepairTime) >= (getRepairCooldown(player)) && !player.isSwingInProgress)
|
||||||
&& !player.isSwingInProgress)
|
{
|
||||||
{
|
ToolHelper.healTool(iterStack, autoRepairLevel, player);
|
||||||
ToolHelper.healTool(iterStack, autoRepairLevel, player);
|
tag.setLong(Lib.TAG_AUTO_REPAIR_COOLDOWN, System.currentTimeMillis());
|
||||||
tag.setLong(Lib.TAG_AUTO_REPAIR_COOLDOWN, System.currentTimeMillis());
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
int getRepairCooldown(EntityPlayer player)
|
int getRepairCooldown(EntityPlayer player)
|
||||||
{
|
{
|
||||||
World world = player.getEntityWorld();
|
World world = player.getEntityWorld();
|
||||||
int rand = world.rand.nextInt(999);
|
int rand = world.rand.nextInt(999);
|
||||||
if (player.dimension == -1)
|
if (player.dimension == -1)
|
||||||
{
|
return 10000 + rand;
|
||||||
return 10000 + rand;
|
if (world.canSeeSky(player.getPosition()) && !world.isRaining())
|
||||||
}
|
if ((world.getWorldTime() % 24000) >= 0 && (world.getWorldTime() % 24000) <= 13000)
|
||||||
if (world.canSeeSky(player.getPosition()) && !world.isRaining())
|
return 12500 + rand;
|
||||||
{
|
|
||||||
if ((world.getWorldTime() % 24000) >= 0 && (world.getWorldTime() % 24000) <= 13000)
|
|
||||||
{
|
|
||||||
return 12500 + rand;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 15000 + rand;
|
return 15000 + rand;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,25 +11,25 @@ import slimeknights.tconstruct.library.utils.TagUtil;
|
||||||
|
|
||||||
public class ModExtraModifier extends Modifier
|
public class ModExtraModifier extends Modifier
|
||||||
{
|
{
|
||||||
public ModExtraModifier(int level)
|
public ModExtraModifier(int level)
|
||||||
{
|
{
|
||||||
super("bonus-modifier_" + level);
|
super("bonus-modifier_" + level);
|
||||||
this.addAspects(new ModifierAspect.SingleAspect(this), new ModifierAspect.DataAspect(this, 0x8cf4e2));
|
this.addAspects(new ModifierAspect.SingleAspect(this), new ModifierAspect.DataAspect(this, 0x8cf4e2));
|
||||||
this.addItem(new ItemStack(TinkersAddons.modItems.MODIFIERS, 1, level), 1, 1);
|
this.addItem(new ItemStack(TinkersAddons.modItems.materials, 1, level), 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isHidden()
|
public boolean isHidden()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void applyEffect(NBTTagCompound rootCompound, NBTTagCompound modifierTag)
|
public void applyEffect(NBTTagCompound rootCompound, NBTTagCompound modifierTag)
|
||||||
{
|
{
|
||||||
ToolNBT data = TagUtil.getToolStats(rootCompound);
|
ToolNBT data = TagUtil.getToolStats(rootCompound);
|
||||||
data.modifiers++;
|
data.modifiers++;
|
||||||
|
|
||||||
TagUtil.setToolTag(rootCompound, data.get());
|
TagUtil.setToolTag(rootCompound, data.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,102 @@
|
||||||
|
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,45 +0,0 @@
|
||||||
package com.oitsjustjose.tinkers_addons.util;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
import net.minecraftforge.client.event.ModelRegistryEvent;
|
|
||||||
import net.minecraftforge.client.model.ModelLoader;
|
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
public class ClientRegistry
|
|
||||||
{
|
|
||||||
private HashMap<ItemStack, ModelResourceLocation> LOCATIONS = new HashMap<>();
|
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void handleModels(ModelRegistryEvent event)
|
|
||||||
{
|
|
||||||
for (Map.Entry<ItemStack, ModelResourceLocation> entry : LOCATIONS.entrySet())
|
|
||||||
{
|
|
||||||
ModelLoader.setCustomModelResourceLocation(entry.getKey().getItem(), entry.getKey().getItemDamage(),
|
|
||||||
entry.getValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void register(Block block, String variant)
|
|
||||||
{
|
|
||||||
LOCATIONS.put(new ItemStack(block), new ModelResourceLocation(block.getRegistryName(), variant));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void register(ItemStack itemstack, ResourceLocation resLoc, String variant)
|
|
||||||
{
|
|
||||||
LOCATIONS.put(itemstack, new ModelResourceLocation(resLoc, variant));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void register(ItemStack stack, String variant)
|
|
||||||
{
|
|
||||||
LOCATIONS.put(stack, new ModelResourceLocation(stack.getItem().getRegistryName(), variant));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.oitsjustjose.tinkers_addons.util;
|
||||||
|
|
||||||
|
public class CommonProxy
|
||||||
|
{
|
||||||
|
public static void preInit()
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
public static void init()
|
||||||
|
{
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -1,31 +1,31 @@
|
||||||
package com.oitsjustjose.tinkers_addons.util;
|
package com.oitsjustjose.tinkers_addons.util;
|
||||||
|
|
||||||
import com.oitsjustjose.tinkers_addons.lib.Lib;
|
|
||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
import com.oitsjustjose.tinkers_addons.lib.Lib;
|
||||||
|
|
||||||
public class Log
|
public class Log
|
||||||
{
|
{
|
||||||
private static Logger LOGGER = LogManager.getLogger(Lib.MODID);
|
private static Logger LOGGER = LogManager.getLogger(Lib.MODID);
|
||||||
|
|
||||||
public static void warn(String msg)
|
public static void warn(String msg)
|
||||||
{
|
{
|
||||||
LOGGER.warn(msg);
|
LOGGER.warn(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void error(String msg)
|
public static void error(String msg)
|
||||||
{
|
{
|
||||||
LOGGER.error(msg);
|
LOGGER.error(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void info(String msg)
|
public static void info(String msg)
|
||||||
{
|
{
|
||||||
LOGGER.info(msg);
|
LOGGER.info(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void debug(String msg)
|
public static void debug(String msg)
|
||||||
{
|
{
|
||||||
LOGGER.debug(msg);
|
LOGGER.debug(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
158
src/main/java/com/oitsjustjose/tinkers_addons/util/Recipes.java
Normal file
158
src/main/java/com/oitsjustjose/tinkers_addons/util/Recipes.java
Normal file
|
|
@ -0,0 +1,158 @@
|
||||||
|
package com.oitsjustjose.tinkers_addons.util;
|
||||||
|
|
||||||
|
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.ShapelessOreRecipe;
|
||||||
|
import slimeknights.tconstruct.shared.TinkerCommons;
|
||||||
|
import slimeknights.tconstruct.tools.TinkerMaterials;
|
||||||
|
import slimeknights.tconstruct.tools.TinkerTools;
|
||||||
|
|
||||||
|
public class Recipes
|
||||||
|
{
|
||||||
|
public Recipes()
|
||||||
|
{
|
||||||
|
registerBonusModRecipes();
|
||||||
|
}
|
||||||
|
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
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 = null;
|
||||||
|
|
||||||
|
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 != null || itemStackRecipe != null)
|
||||||
|
{
|
||||||
|
if ((input == null) != (itemStackRecipe == null))
|
||||||
|
{
|
||||||
|
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,19 +1,19 @@
|
||||||
#Items
|
#Items
|
||||||
tinkersaddons.amelioration_tome.name=Amelioration Tome
|
item.TinkersAddons.AMELIORATION_TOME.name=Amelioration Tome
|
||||||
tinkersaddons.amelioration_tome.description=§2Auto-Repair Modifier§r
|
item.TinkersAddons.AMELIORATION_TOME.description=§2Auto-Repair Modifier§r
|
||||||
tinkersaddons.iron_toolkit.name=Iron Toolkit
|
item.TinkersAddons.IRON_TOOLKIT.name=Iron Toolkit
|
||||||
tinkersaddons.iron_toolkit.description=§3Grants an Extra Modifier§r
|
item.TinkersAddons.IRON_TOOLKIT.description=§3Grants an Extra Modifier§r
|
||||||
tinkersaddons.gold_toolkit.name=Gold Toolkit
|
item.TinkersAddons.GOLD_TOOLKIT.name=Gold Toolkit
|
||||||
tinkersaddons.gold_toolkit.description=§3Grants an Extra Modifier§r
|
item.TinkersAddons.GOLD_TOOLKIT.description=§3Grants an Extra Modifier§r
|
||||||
tinkersaddons.diamond_toolkit.name=Diamond Toolkit
|
item.TinkersAddons.DIAMOND_TOOLKIT.name=Diamond Toolkit
|
||||||
tinkersaddons.diamond_toolkit.description=§3Grants an Extra Modifier§r
|
item.TinkersAddons.DIAMOND_TOOLKIT.description=§3Grants an Extra Modifier§r
|
||||||
tinkersaddons.ender_toolkit.name=Ender Toolkit
|
item.TinkersAddons.ENDER_TOOLKIT.name=Ender Toolkit
|
||||||
tinkersaddons.ender_toolkit.description=§3Grants an Extra Modifier§r
|
item.TinkersAddons.ENDER_TOOLKIT.description=§3Grants an Extra Modifier§r
|
||||||
|
|
||||||
#Modifiers
|
#Modifiers
|
||||||
modifier.auto-repair.name=Amelioration
|
modifier.auto-repair.name=Amelioration
|
||||||
modifier.bonus-modifier_1.name=Bonus Modifier Toolkit
|
modifier.bonus-modifier_1.name=This Modifier Toolkit
|
||||||
modifier.bonus-modifier_2.name=Bonus Modifier Toolkit
|
modifier.bonus-modifier_2.name=This Modifier Toolkit
|
||||||
modifier.bonus-modifier_3.name=Bonus Modifier Toolkit
|
modifier.bonus-modifier_3.name=This Modifier Toolkit
|
||||||
modifier.bonus-modifier_4.name=Bonus Modifier Toolkit
|
modifier.bonus-modifier_4.name=This Modifier Toolkit
|
||||||
modifier.auto-repair.desc=§oAuto-Repair Like the Old Days §r\nYou didn't realize you missed this, did you?
|
modifier.auto-repair.desc=§oAuto-Repair Like the Old Days §r\nYou didn't realize you missed this, did you?
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"parent": "item/handheld",
|
"parent": "item/handheld",
|
||||||
"textures": {
|
"textures": {
|
||||||
"layer0": "tinkersaddons:items/amelioration_tome"
|
"layer0": "tinkersaddons:items/amelioration_tome"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"parent": "item/handheld",
|
"parent": "item/handheld",
|
||||||
"textures": {
|
"textures": {
|
||||||
"layer0": "tinkersaddons:items/diamond_toolkit"
|
"layer0": "tinkersaddons:items/diamond_toolkit"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"parent": "item/handheld",
|
"parent": "item/handheld",
|
||||||
"textures": {
|
"textures": {
|
||||||
"layer0": "tinkersaddons:items/ender_toolkit"
|
"layer0": "tinkersaddons:items/ender_toolkit"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"parent": "item/handheld",
|
"parent": "item/handheld",
|
||||||
"textures": {
|
"textures": {
|
||||||
"layer0": "tinkersaddons:items/gold_toolkit"
|
"layer0": "tinkersaddons:items/gold_toolkit"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"parent": "item/handheld",
|
"parent": "item/handheld",
|
||||||
"textures": {
|
"textures": {
|
||||||
"layer0": "tinkersaddons:items/iron_toolkit"
|
"layer0": "tinkersaddons:items/iron_toolkit"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
{
|
|
||||||
"type": "minecraft:crafting_shapeless",
|
|
||||||
"ingredients": [
|
|
||||||
{
|
|
||||||
"item": "tconstruct:materials",
|
|
||||||
"data": 19
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"item": "tconstruct:materials",
|
|
||||||
"data": 19
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"item": "tconstruct:materials",
|
|
||||||
"data": 19
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"item": "minecraft:book"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"result": {
|
|
||||||
"item": "tinkersaddons:modifier_item",
|
|
||||||
"data": 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
{
|
|
||||||
"type": "minecraft:crafting_shaped",
|
|
||||||
"group": "Modifier Kits",
|
|
||||||
"pattern": [
|
|
||||||
"PIP",
|
|
||||||
"PPP"
|
|
||||||
],
|
|
||||||
"key": {
|
|
||||||
"P": {
|
|
||||||
"type": "minecraft:item_nbt",
|
|
||||||
"item": "tconstruct:large_plate",
|
|
||||||
"data": 0,
|
|
||||||
"nbt": {
|
|
||||||
"Material": "prismarine"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"I": {
|
|
||||||
"item": "minecraft:diamond_block"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"result": {
|
|
||||||
"item": "tinkersaddons:modifier_item",
|
|
||||||
"data": 3
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
{
|
|
||||||
"type": "minecraft:crafting_shaped",
|
|
||||||
"group": "Modifier Kits",
|
|
||||||
"pattern": [
|
|
||||||
"PIP",
|
|
||||||
"PPP"
|
|
||||||
],
|
|
||||||
"key": {
|
|
||||||
"P": {
|
|
||||||
"type": "minecraft:item_nbt",
|
|
||||||
"item": "tconstruct:large_plate",
|
|
||||||
"data": 0,
|
|
||||||
"nbt": {
|
|
||||||
"Material": "obsidian"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"I": {
|
|
||||||
"item": "minecraft:ender_pearl"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"result": {
|
|
||||||
"item": "tinkersaddons:modifier_item",
|
|
||||||
"data": 4
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
{
|
|
||||||
"type": "minecraft:crafting_shaped",
|
|
||||||
"group": "Modifier Kits",
|
|
||||||
"pattern": [
|
|
||||||
"PIP",
|
|
||||||
"PPP"
|
|
||||||
],
|
|
||||||
"key": {
|
|
||||||
"P": {
|
|
||||||
"type": "minecraft:item_nbt",
|
|
||||||
"item": "tconstruct:large_plate",
|
|
||||||
"data": 0,
|
|
||||||
"nbt": {
|
|
||||||
"Material": "ardite"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"I": {
|
|
||||||
"item": "minecraft:gold_block"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"result": {
|
|
||||||
"item": "tinkersaddons:modifier_item",
|
|
||||||
"data": 2
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
||||||
{
|
|
||||||
"type": "minecraft:crafting_shaped",
|
|
||||||
"group": "Modifier Kits",
|
|
||||||
"pattern": [
|
|
||||||
"PIP",
|
|
||||||
"PPP"
|
|
||||||
],
|
|
||||||
"key": {
|
|
||||||
"P": {
|
|
||||||
"type": "minecraft:item_nbt",
|
|
||||||
"item": "tconstruct:large_plate",
|
|
||||||
"data": 0,
|
|
||||||
"nbt": {
|
|
||||||
"Material": "iron"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"I": {
|
|
||||||
"item": "tconstruct:metal",
|
|
||||||
"data": 4
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"result": {
|
|
||||||
"item": "tinkersaddons:modifier_item",
|
|
||||||
"data": 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
|
|
@ -1,18 +1,16 @@
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"modid": "TinkersAddons",
|
"modid": "TinkersAddons",
|
||||||
"name": "Tinkers' Addons",
|
"name": "Tinkers' Addons",
|
||||||
"description": "Adding back old modifiers to Tinkers' Construct 2.0",
|
"description": "Adding back old modifiers to Tinkers' Construct 2.0",
|
||||||
"version": "${version}",
|
"version": "${version}",
|
||||||
"mcversion": "${mcversion}",
|
"mcversion": "${mcversion}",
|
||||||
"url": "",
|
"url": "",
|
||||||
"updateUrl": "",
|
"updateUrl": "",
|
||||||
"authorList": [
|
"authorList": ["oitsjustjose"],
|
||||||
"oitsjustjose"
|
"credits": "",
|
||||||
],
|
"logoFile": "",
|
||||||
"credits": "",
|
"screenshots": [],
|
||||||
"logoFile": "",
|
"dependencies": []
|
||||||
"screenshots": [],
|
}
|
||||||
"dependencies": []
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue