@author Gregorius Techneticies This is an example on how you can create a Tool ItemStack, in this case a Bismuth Wrench: gregapi.data.CS.ToolsGT.sMetaTool.getToolWithStats(CS.ToolIDs.WRENCH, 1, MT.Bismuth, MT.Bismuth, null);
| 75 | * gregapi.data.CS.ToolsGT.sMetaTool.getToolWithStats(CS.ToolIDs.WRENCH, 1, MT.Bismuth, MT.Bismuth, null); |
| 76 | */ |
| 77 | public class MultiItemTool extends MultiItem implements IItemGTHandTool, IItemGTContainerTool { |
| 78 | public final HashMap<Short, IToolStats> mToolStats = new HashMap<>(); |
| 79 | |
| 80 | public static ChunkCoordinates LAST_TOOL_COORDS_BEFORE_DAMAGE = null; |
| 81 | |
| 82 | /** |
| 83 | * Creates the Item using these Parameters. |
| 84 | * @param aUnlocalized The unlocalised Name of this Item. DO NOT START YOUR UNLOCALISED NAME WITH "gt."!!! |
| 85 | */ |
| 86 | public MultiItemTool(String aModID, String aUnlocalized) { |
| 87 | super(aModID, aUnlocalized); |
| 88 | setMaxStackSize(1); |
| 89 | /* |
| 90 | if (MD.BG2.mLoaded) try { |
| 91 | UT.Reflection.callPublicMethod(Class.forName("mods.battlegear2.api.weapons.WeaponRegistry"), "addTwoHanded", make(0)); |
| 92 | UT.Reflection.callPublicMethod(Class.forName("mods.battlegear2.api.weapons.WeaponRegistry"), "addTwoHanded", make(W)); |
| 93 | UT.Reflection.callPublicMethod(Class.forName("mods.battlegear2.api.weapons.WeaponRegistry"), "setWeapon", "MainHand", make(0)); |
| 94 | UT.Reflection.callPublicMethod(Class.forName("mods.battlegear2.api.weapons.WeaponRegistry"), "setWeapon", "MainHand", make(W)); |
| 95 | } catch(Throwable e) { |
| 96 | e.printStackTrace(ERR); |
| 97 | } |
| 98 | */ |
| 99 | } |
| 100 | |
| 101 | /** |
| 102 | * This adds a Custom Item to the ending Range. |
| 103 | * @param aID The Id of the assigned Tool Class [0 - 32765] (only even Numbers allowed! Uneven ID's are empty electric Items) |
| 104 | * @param aEnglish The Default Localized Name of the created Item |
| 105 | * @param aToolTip The Default ToolTip of the created Item, you can also insert null for having no ToolTip |
| 106 | * @param aToolStats The Food Value of this Item. Can be null as well. |
| 107 | * @param aRandomParameters The OreDict Names you want to give the Item. Also used to assign Thaumcraft Aspects. |
| 108 | * @return An ItemStack containing the newly created Item, but without specific Stats. |
| 109 | */ |
| 110 | public final ItemStack addTool(int aID, String aEnglish, String aToolTip, IToolStats aToolStats, Object... aRandomParameters) { |
| 111 | if (aToolTip == null) aToolTip = ""; |
| 112 | if (aID >= 0 && aID < 32766 && isUsableMeta((short)aID)) { |
| 113 | LH.add(getUnlocalizedName() + "." + aID , aEnglish); |
| 114 | LH.add(getUnlocalizedName() + "." + aID + ".tooltip", aToolTip); |
| 115 | LH.add(getUnlocalizedName() + "." + (aID+1) , aEnglish + " (Empty)"); |
| 116 | LH.add(getUnlocalizedName() + "." + (aID+1) + ".tooltip", "You need to recharge it"); |
| 117 | mToolStats.put((short) aID , aToolStats); |
| 118 | mToolStats.put((short)(aID+1), aToolStats); |
| 119 | aToolStats.onStatsAddedToTool(this, aID); |
| 120 | ItemStack rStack = ST.make(this, 1, aID); |
| 121 | List<TC_AspectStack> tAspects = new ArrayListNoNulls<>(); |
| 122 | for (Object tRandomParameter : aRandomParameters) { |
| 123 | if (tRandomParameter instanceof TC_AspectStack) |
| 124 | ((TC_AspectStack)tRandomParameter).addToAspectList(tAspects); |
| 125 | else if (tRandomParameter instanceof ItemStackSet) |
| 126 | ((ItemStackSet<?>)tRandomParameter).add(rStack.copy()); |
| 127 | else |
| 128 | OM.reg(tRandomParameter, rStack); |
| 129 | } |
| 130 | if (COMPAT_TC != null) COMPAT_TC.registerThaumcraftAspectsToItem(rStack, tAspects, F); |
| 131 | return rStack; |
| 132 | } |
| 133 | return null; |
| 134 | } |
nothing calls this directly
no outgoing calls
no test coverage detected