mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-19 11:59:14 +00:00
Fix JABBA-related issues with crafting station slots (#54)
* Fix shift-merging tools voiding items fixes <https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/11392> * Change 0-sized ItemStacks into null stacks in crafting station attached slots Fixes <https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/10425> * Update buildscript * spotlessApply
This commit is contained in:
1 parent
18bfeaff32
commit
39be06c23b
571 files changed
+25959
-28223
No files matched your search
@@ -11,12 +11,10 @@ import tconstruct.tools.TinkerTools;
|
||||
|
||||
/**
|
||||
* A registry to store any relevant API work
|
||||
*
|
||||
*
|
||||
* @author mDiyo
|
||||
*/
|
||||
|
||||
public class TConstructRegistry
|
||||
{
|
||||
public class TConstructRegistry {
|
||||
public static TConstructRegistry instance = new TConstructRegistry();
|
||||
|
||||
public static Logger logger = LogManager.getLogger("TCon-API");
|
||||
@@ -34,13 +32,13 @@ public class TConstructRegistry
|
||||
|
||||
/**
|
||||
* A directory of crafting items and tools used by the mod.
|
||||
*
|
||||
*
|
||||
* Tools: pickaxe, shovel, hatchet, broadsword, longsword, rapier, dagger,
|
||||
* cutlass frypan, battlesign, mattock, chisel lumberaxe, cleaver, scythe,
|
||||
* excavator, hammer, battleaxe
|
||||
*
|
||||
*
|
||||
* Patterns: blankPattern, woodPattern, metalPattern, clayPattern
|
||||
*
|
||||
*
|
||||
* Tool crafting parts: toolRod, toolShard, binding, toughBinding, toughRod,
|
||||
* heavyPlate pickaxeHead, shovelhead, hatchetHead, swordBlade, wideguard,
|
||||
* handGuard, crossbar, knifeBlade, fullGuard, frypanHead, signHead,
|
||||
@@ -51,42 +49,36 @@ public class TConstructRegistry
|
||||
|
||||
/**
|
||||
* Adds an item to the directory
|
||||
*
|
||||
*
|
||||
* @param name
|
||||
* Associates the name with the stack
|
||||
* @param itemstack
|
||||
* The stack to add to the directory
|
||||
*/
|
||||
|
||||
public static void addItemToDirectory (String name, Item itemstack)
|
||||
{
|
||||
public static void addItemToDirectory(String name, Item itemstack) {
|
||||
Item add = itemDirectory.get(name);
|
||||
if (add != null)
|
||||
logger.warn(name + " is already present in the Item directory");
|
||||
if (add != null) logger.warn(name + " is already present in the Item directory");
|
||||
|
||||
itemDirectory.put(name, itemstack);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves an itemstack from the directory
|
||||
*
|
||||
*
|
||||
* @param name
|
||||
* The name of the item to get
|
||||
* @return Item associated with the name, or null if not present.
|
||||
*/
|
||||
|
||||
public static Item getItem (String name)
|
||||
{
|
||||
public static Item getItem(String name) {
|
||||
Item ret = itemDirectory.get(name);
|
||||
if (ret == null)
|
||||
logger.warn("Could not find " + name + " in the Item directory");
|
||||
if (ret == null) logger.warn("Could not find " + name + " in the Item directory");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* A directory of ItemStacks. Contains mostly crafting items
|
||||
*
|
||||
*
|
||||
* Materials: paperStack, greenSlimeCrystal, blueSlimeCrystal, searedBrick,
|
||||
* mossBall, lavaCrystal, necroticBone, silkyCloth, silkyJewel ingotCobalt,
|
||||
* ingotArdite, ingotManyullyn, ingotCopper, ingotTin, ingotAluminum,
|
||||
@@ -95,7 +87,7 @@ public class TConstructRegistry
|
||||
* nuggetSilver, nuggetAluminumBrass oreberryIron, oreberryGold,
|
||||
* oreberryCopper, oreberryTin, oreberryTin, oreberrySilver, diamondApple,
|
||||
* blueSlimeFood, canisterEmpty, miniRedHeart, canisterRedHeart
|
||||
*
|
||||
*
|
||||
* Patterns - These have a suffix of Pattern or Cast. ex: hatchetHeadPattern
|
||||
* ingot, toolRod, pickaxeHead, shovelHead, hatchetHead, swordBlade,
|
||||
* wideGuard, handGuard, crossbar, binding, frypanHead, signHead,
|
||||
@@ -107,35 +99,29 @@ public class TConstructRegistry
|
||||
|
||||
/**
|
||||
* Adds an itemstack to the directory
|
||||
*
|
||||
*
|
||||
* @param name
|
||||
* Associates the name with the stack
|
||||
* @param itemstack
|
||||
* The stack to add to the directory
|
||||
*/
|
||||
|
||||
public static void addItemStackToDirectory (String name, ItemStack itemstack)
|
||||
{
|
||||
public static void addItemStackToDirectory(String name, ItemStack itemstack) {
|
||||
ItemStack add = itemstackDirectory.get(name);
|
||||
if (add != null)
|
||||
logger.warn(name + " is already present in the ItemStack directory");
|
||||
if (add != null) logger.warn(name + " is already present in the ItemStack directory");
|
||||
|
||||
itemstackDirectory.put(name, itemstack);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves an itemstack from the directory
|
||||
*
|
||||
*
|
||||
* @param name
|
||||
* The name of the item to get
|
||||
* @return Item associated with the name, or null if not present.
|
||||
*/
|
||||
|
||||
public static ItemStack getItemStack (String name)
|
||||
{
|
||||
public static ItemStack getItemStack(String name) {
|
||||
ItemStack ret = itemstackDirectory.get(name);
|
||||
if (ret == null)
|
||||
logger.warn("Could not find " + name + " in the ItemStack directory");
|
||||
if (ret == null) logger.warn("Could not find " + name + " in the ItemStack directory");
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -152,7 +138,7 @@ public class TConstructRegistry
|
||||
|
||||
/**
|
||||
* Maps an item and a material ID to an output part
|
||||
*
|
||||
*
|
||||
* @param woodPattern
|
||||
* ID to check against
|
||||
* @param patternMeta
|
||||
@@ -162,16 +148,13 @@ public class TConstructRegistry
|
||||
* @param output
|
||||
* The resulting part
|
||||
*/
|
||||
public static void addPartMapping (Item woodPattern, int patternMeta, int materialID, ItemStack output)
|
||||
{
|
||||
public static void addPartMapping(Item woodPattern, int patternMeta, int materialID, ItemStack output) {
|
||||
patternPartMapping.put(Arrays.asList(woodPattern, patternMeta, materialID), output);
|
||||
}
|
||||
|
||||
public static ItemStack getPartMapping (Item item, int metadata, int materialID)
|
||||
{
|
||||
public static ItemStack getPartMapping(Item item, int metadata, int materialID) {
|
||||
ItemStack stack = patternPartMapping.get(Arrays.asList(item, metadata, materialID));
|
||||
if (stack != null)
|
||||
return stack.copy();
|
||||
if (stack != null) return stack.copy();
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -179,23 +162,19 @@ public class TConstructRegistry
|
||||
|
||||
/**
|
||||
* Internal tool mapping, used for adding textures
|
||||
*
|
||||
*
|
||||
* @param tool
|
||||
*/
|
||||
|
||||
public static void addToolMapping (ToolCore tool)
|
||||
{
|
||||
public static void addToolMapping(ToolCore tool) {
|
||||
tools.add(tool);
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal tool mapping, used for adding textures
|
||||
*
|
||||
*
|
||||
* @return List of tools
|
||||
*/
|
||||
|
||||
public static ArrayList<ToolCore> getToolMapping ()
|
||||
{
|
||||
public static ArrayList<ToolCore> getToolMapping() {
|
||||
return tools;
|
||||
}
|
||||
|
||||
@@ -203,18 +182,16 @@ public class TConstructRegistry
|
||||
* Registers a tool to its crafting parts. If an output is registered
|
||||
* multiple times the parts are added to the recipe's input list Valid part
|
||||
* amounts are 2, 3, and 4.
|
||||
*
|
||||
*
|
||||
* @see ToolBuilder
|
||||
* @param output
|
||||
* The ToolCore to craft
|
||||
* @param parts
|
||||
* Pieces to make the tool with
|
||||
*/
|
||||
public static void addToolRecipe (ToolCore output, Item... parts)
|
||||
{
|
||||
public static void addToolRecipe(ToolCore output, Item... parts) {
|
||||
ToolBuilder tb = ToolBuilder.instance;
|
||||
if (parts.length < 2 || parts.length > 4)
|
||||
logger.warn("Wrong amount of items to craft into a tool");
|
||||
if (parts.length < 2 || parts.length > 4) logger.warn("Wrong amount of items to craft into a tool");
|
||||
|
||||
tb.addToolRecipe(output, parts);
|
||||
}
|
||||
@@ -225,25 +202,21 @@ public class TConstructRegistry
|
||||
public static List<Integer> defaultToolPartMaterials = new LinkedList<Integer>();
|
||||
public static List<Integer> defaultShardMaterials = new LinkedList<Integer>();
|
||||
|
||||
public static void addDefaultToolPartMaterial(int materialID)
|
||||
{
|
||||
if(!toolMaterials.containsKey(materialID))
|
||||
public static void addDefaultToolPartMaterial(int materialID) {
|
||||
if (!toolMaterials.containsKey(materialID))
|
||||
logger.error("[TCon API] Can't add default toolpart: Material ID " + materialID + " is unknown.");
|
||||
else
|
||||
defaultToolPartMaterials.add(materialID);
|
||||
else defaultToolPartMaterials.add(materialID);
|
||||
}
|
||||
|
||||
public static void addDefaultShardMaterial(int materialID)
|
||||
{
|
||||
if(!toolMaterials.containsKey(materialID))
|
||||
public static void addDefaultShardMaterial(int materialID) {
|
||||
if (!toolMaterials.containsKey(materialID))
|
||||
logger.error("[TCon API] Can't add default shard: Material ID " + materialID + " is unknown.");
|
||||
else
|
||||
defaultShardMaterials.add(materialID);
|
||||
else defaultShardMaterials.add(materialID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a tool material to the registry
|
||||
*
|
||||
*
|
||||
* @param materialID
|
||||
* Unique ID, stored for each part
|
||||
* @param materialName
|
||||
@@ -266,18 +239,36 @@ public class TConstructRegistry
|
||||
* Amount of Stonebound to put on the tool. Negative numbers are
|
||||
* Spiny.
|
||||
*/
|
||||
|
||||
public static void addToolMaterial (int materialID, String materialName, int harvestLevel, int durability, int miningspeed, int attack, float handleModifier, int reinforced, float stonebound, String style, int primaryColor)
|
||||
{
|
||||
public static void addToolMaterial(
|
||||
int materialID,
|
||||
String materialName,
|
||||
int harvestLevel,
|
||||
int durability,
|
||||
int miningspeed,
|
||||
int attack,
|
||||
float handleModifier,
|
||||
int reinforced,
|
||||
float stonebound,
|
||||
String style,
|
||||
int primaryColor) {
|
||||
ToolMaterial mat = toolMaterials.get(materialID);
|
||||
if (mat == null)
|
||||
{
|
||||
mat = new ToolMaterial(materialName, harvestLevel, durability, miningspeed, attack, handleModifier, reinforced, stonebound, style, primaryColor);
|
||||
if (mat == null) {
|
||||
mat = new ToolMaterial(
|
||||
materialName,
|
||||
harvestLevel,
|
||||
durability,
|
||||
miningspeed,
|
||||
attack,
|
||||
handleModifier,
|
||||
reinforced,
|
||||
stonebound,
|
||||
style,
|
||||
primaryColor);
|
||||
toolMaterials.put(materialID, mat);
|
||||
toolMaterialStrings.put(materialName, mat);
|
||||
}
|
||||
else
|
||||
throw new IllegalArgumentException("[TCon API] Material ID " + materialID + " is already occupied by " + mat.materialName);
|
||||
} else
|
||||
throw new IllegalArgumentException(
|
||||
"[TCon API] Material ID " + materialID + " is already occupied by " + mat.materialName);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -307,74 +298,153 @@ public class TConstructRegistry
|
||||
* Amount of Stonebound to put on the tool. Negative numbers are
|
||||
* Spiny.
|
||||
*/
|
||||
public static void addToolMaterial (int materialID, String materialName, String localizationName, int harvestLevel, int durability, int miningspeed, int attack, float handleModifier, int reinforced, float stonebound, String style, int primaryColor)
|
||||
{
|
||||
public static void addToolMaterial(
|
||||
int materialID,
|
||||
String materialName,
|
||||
String localizationName,
|
||||
int harvestLevel,
|
||||
int durability,
|
||||
int miningspeed,
|
||||
int attack,
|
||||
float handleModifier,
|
||||
int reinforced,
|
||||
float stonebound,
|
||||
String style,
|
||||
int primaryColor) {
|
||||
ToolMaterial mat = toolMaterials.get(materialID);
|
||||
if (mat == null)
|
||||
{
|
||||
mat = new ToolMaterial(materialName, localizationName, harvestLevel, durability, miningspeed, attack, handleModifier, reinforced, stonebound, style, primaryColor);
|
||||
if (mat == null) {
|
||||
mat = new ToolMaterial(
|
||||
materialName,
|
||||
localizationName,
|
||||
harvestLevel,
|
||||
durability,
|
||||
miningspeed,
|
||||
attack,
|
||||
handleModifier,
|
||||
reinforced,
|
||||
stonebound,
|
||||
style,
|
||||
primaryColor);
|
||||
toolMaterials.put(materialID, mat);
|
||||
toolMaterialStrings.put(materialName, mat);
|
||||
}
|
||||
else
|
||||
throw new IllegalArgumentException("[TCon API] Material ID " + materialID + " is already occupied by " + mat.materialName);
|
||||
} else
|
||||
throw new IllegalArgumentException(
|
||||
"[TCon API] Material ID " + materialID + " is already occupied by " + mat.materialName);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static void addToolMaterial (int materialID, String materialName, int harvestLevel, int durability, int miningspeed, int attack, float handleModifier, int reinforced, float stonebound, String style)
|
||||
{
|
||||
logger.warn("[TCon API] Using deprecated addToolMaterial with no primary color. A fallback of white will be used.");
|
||||
addToolMaterial(materialID, materialName, harvestLevel, durability, miningspeed, attack, handleModifier, reinforced, stonebound, style, 0xFFFFFF);
|
||||
public static void addToolMaterial(
|
||||
int materialID,
|
||||
String materialName,
|
||||
int harvestLevel,
|
||||
int durability,
|
||||
int miningspeed,
|
||||
int attack,
|
||||
float handleModifier,
|
||||
int reinforced,
|
||||
float stonebound,
|
||||
String style) {
|
||||
logger.warn(
|
||||
"[TCon API] Using deprecated addToolMaterial with no primary color. A fallback of white will be used.");
|
||||
addToolMaterial(
|
||||
materialID,
|
||||
materialName,
|
||||
harvestLevel,
|
||||
durability,
|
||||
miningspeed,
|
||||
attack,
|
||||
handleModifier,
|
||||
reinforced,
|
||||
stonebound,
|
||||
style,
|
||||
0xFFFFFF);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static void addToolMaterial (int materialID, String materialName, int harvestLevel, int durability, int miningspeed, int attack, float handleModifier, int reinforced, float stonebound, String style, String ability)
|
||||
{
|
||||
logger.warn("[TCon API] Using deprecated addToolMaterial with ability name. ability will be ignored, use languages files for that.");
|
||||
addToolMaterial(materialID, materialName, harvestLevel, durability, miningspeed, attack, handleModifier, reinforced, stonebound, style);
|
||||
public static void addToolMaterial(
|
||||
int materialID,
|
||||
String materialName,
|
||||
int harvestLevel,
|
||||
int durability,
|
||||
int miningspeed,
|
||||
int attack,
|
||||
float handleModifier,
|
||||
int reinforced,
|
||||
float stonebound,
|
||||
String style,
|
||||
String ability) {
|
||||
logger.warn(
|
||||
"[TCon API] Using deprecated addToolMaterial with ability name. ability will be ignored, use languages files for that.");
|
||||
addToolMaterial(
|
||||
materialID,
|
||||
materialName,
|
||||
harvestLevel,
|
||||
durability,
|
||||
miningspeed,
|
||||
attack,
|
||||
handleModifier,
|
||||
reinforced,
|
||||
stonebound,
|
||||
style);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static void addToolMaterial (int materialID, String materialName, String displayName, int harvestLevel, int durability, int miningspeed, int attack, float handleModifier, int reinforced, float stonebound, String style, String ability)
|
||||
{
|
||||
logger.warn("[TCon API] Using deprecated addToolMaterial with display and ability name. displayName and ability will be ignored, use languages files for that.");
|
||||
addToolMaterial(materialID, materialName, harvestLevel, durability, miningspeed, attack, handleModifier, reinforced, stonebound, style);
|
||||
public static void addToolMaterial(
|
||||
int materialID,
|
||||
String materialName,
|
||||
String displayName,
|
||||
int harvestLevel,
|
||||
int durability,
|
||||
int miningspeed,
|
||||
int attack,
|
||||
float handleModifier,
|
||||
int reinforced,
|
||||
float stonebound,
|
||||
String style,
|
||||
String ability) {
|
||||
logger.warn(
|
||||
"[TCon API] Using deprecated addToolMaterial with display and ability name. displayName and ability will be ignored, use languages files for that.");
|
||||
addToolMaterial(
|
||||
materialID,
|
||||
materialName,
|
||||
harvestLevel,
|
||||
durability,
|
||||
miningspeed,
|
||||
attack,
|
||||
handleModifier,
|
||||
reinforced,
|
||||
stonebound,
|
||||
style);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a tool material to the registry
|
||||
*
|
||||
*
|
||||
* @param materialID
|
||||
* Unique ID, stored for each part
|
||||
* @param material
|
||||
* Complete tool material to add. Uses the name in the material
|
||||
* for lookup purposes.
|
||||
*/
|
||||
|
||||
public static void addtoolMaterial (int materialID, ToolMaterial material)
|
||||
{
|
||||
public static void addtoolMaterial(int materialID, ToolMaterial material) {
|
||||
ToolMaterial mat = toolMaterials.get(materialID);
|
||||
if (mat == null)
|
||||
{
|
||||
if (mat == null) {
|
||||
toolMaterials.put(materialID, material);
|
||||
toolMaterialStrings.put(material.name(), material);
|
||||
}
|
||||
else
|
||||
throw new IllegalArgumentException("[TCon API] Material ID " + materialID + " is already occupied by " + mat.materialName);
|
||||
} else
|
||||
throw new IllegalArgumentException(
|
||||
"[TCon API] Material ID " + materialID + " is already occupied by " + mat.materialName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Looks up a tool material by ID
|
||||
*
|
||||
*
|
||||
* @param key
|
||||
* The ID to look up
|
||||
* @return Tool Material
|
||||
*/
|
||||
|
||||
public static ToolMaterial getMaterial (int key)
|
||||
{
|
||||
if (toolMaterials.containsKey(key))
|
||||
{
|
||||
public static ToolMaterial getMaterial(int key) {
|
||||
if (toolMaterials.containsKey(key)) {
|
||||
return (toolMaterials.get(key));
|
||||
}
|
||||
|
||||
@@ -385,14 +455,12 @@ public class TConstructRegistry
|
||||
|
||||
/**
|
||||
* Looks up a tool material by name
|
||||
*
|
||||
*
|
||||
* @param key
|
||||
* the name to look up
|
||||
* @return Tool Material
|
||||
*/
|
||||
|
||||
public static ToolMaterial getMaterial (String key)
|
||||
{
|
||||
public static ToolMaterial getMaterial(String key) {
|
||||
return (toolMaterialStrings.get(key));
|
||||
}
|
||||
|
||||
@@ -400,115 +468,123 @@ public class TConstructRegistry
|
||||
public static HashMap<Integer, BowMaterial> bowMaterials = new HashMap<Integer, BowMaterial>(40);
|
||||
|
||||
@Deprecated
|
||||
public static void addBowMaterial (int materialID, int durability, int drawSpeed, float speedMax)
|
||||
{
|
||||
public static void addBowMaterial(int materialID, int durability, int drawSpeed, float speedMax) {
|
||||
addBowMaterial(materialID, drawSpeed, speedMax);
|
||||
}
|
||||
|
||||
public static void addBowMaterial (int materialID, int drawSpeed, float speedMax)
|
||||
{
|
||||
public static void addBowMaterial(int materialID, int drawSpeed, float speedMax) {
|
||||
BowMaterial mat = bowMaterials.get(materialID);
|
||||
if (mat == null)
|
||||
{
|
||||
if (mat == null) {
|
||||
mat = new BowMaterial(drawSpeed, speedMax);
|
||||
bowMaterials.put(materialID, mat);
|
||||
}
|
||||
else
|
||||
throw new IllegalArgumentException("[TCon API] Bow Material ID " + materialID + " is already occupied");
|
||||
} else throw new IllegalArgumentException("[TCon API] Bow Material ID " + materialID + " is already occupied");
|
||||
}
|
||||
|
||||
public static boolean validBowMaterial (int materialID)
|
||||
{
|
||||
public static boolean validBowMaterial(int materialID) {
|
||||
return bowMaterials.containsKey(materialID);
|
||||
}
|
||||
|
||||
public static BowMaterial getBowMaterial (int materialID)
|
||||
{
|
||||
public static BowMaterial getBowMaterial(int materialID) {
|
||||
return bowMaterials.get(materialID);
|
||||
}
|
||||
|
||||
public static HashMap<Integer, ArrowMaterial> arrowMaterials = new HashMap<Integer, ArrowMaterial>(40);
|
||||
|
||||
@Deprecated
|
||||
public static void addArrowMaterial (int materialID, float mass, float breakChance, float accuracy)
|
||||
{
|
||||
public static void addArrowMaterial(int materialID, float mass, float breakChance, float accuracy) {
|
||||
addArrowMaterial(materialID, mass, breakChance);
|
||||
}
|
||||
|
||||
public static void addArrowMaterial (int materialID, float mass, float breakChance)
|
||||
{
|
||||
public static void addArrowMaterial(int materialID, float mass, float breakChance) {
|
||||
ArrowMaterial mat = arrowMaterials.get(materialID);
|
||||
if (mat == null)
|
||||
{
|
||||
if (mat == null) {
|
||||
mat = new ArrowMaterial(mass, breakChance);
|
||||
arrowMaterials.put(materialID, mat);
|
||||
}
|
||||
else
|
||||
} else
|
||||
throw new IllegalArgumentException("[TCon API] Arrow Material ID " + materialID + " is already occupied");
|
||||
}
|
||||
|
||||
public static boolean validArrowMaterial (int materialID)
|
||||
{
|
||||
public static boolean validArrowMaterial(int materialID) {
|
||||
return arrowMaterials.containsKey(materialID);
|
||||
}
|
||||
|
||||
public static ArrowMaterial getArrowMaterial (int materialID)
|
||||
{
|
||||
public static ArrowMaterial getArrowMaterial(int materialID) {
|
||||
return arrowMaterials.get(materialID);
|
||||
}
|
||||
|
||||
// Custom materials - bowstrings, fletching, etc
|
||||
public static ArrayList<CustomMaterial> customMaterials = new ArrayList<CustomMaterial>();
|
||||
|
||||
public static void addCustomMaterial (CustomMaterial mat)
|
||||
{
|
||||
if (mat != null)
|
||||
customMaterials.add(mat);
|
||||
public static void addCustomMaterial(CustomMaterial mat) {
|
||||
if (mat != null) customMaterials.add(mat);
|
||||
}
|
||||
|
||||
|
||||
public static void addBowstringMaterial (int materialID, int value, ItemStack input, ItemStack craftingMaterial, float durability, float drawSpeed, float flightSpeed, int color)
|
||||
{
|
||||
BowstringMaterial mat = new BowstringMaterial(materialID, value, input, craftingMaterial, durability, drawSpeed, flightSpeed, color);
|
||||
public static void addBowstringMaterial(
|
||||
int materialID,
|
||||
int value,
|
||||
ItemStack input,
|
||||
ItemStack craftingMaterial,
|
||||
float durability,
|
||||
float drawSpeed,
|
||||
float flightSpeed,
|
||||
int color) {
|
||||
BowstringMaterial mat = new BowstringMaterial(
|
||||
materialID, value, input, craftingMaterial, durability, drawSpeed, flightSpeed, color);
|
||||
customMaterials.add(mat);
|
||||
}
|
||||
|
||||
public static void addFletchingMaterial (int materialID, int value, ItemStack input, ItemStack craftingMaterial, float accuracy, float breakChance, float durabilityModifier, int color)
|
||||
{
|
||||
FletchingMaterial mat = new FletchingMaterial(materialID, value, input, craftingMaterial, accuracy, breakChance, durabilityModifier, color);
|
||||
public static void addFletchingMaterial(
|
||||
int materialID,
|
||||
int value,
|
||||
ItemStack input,
|
||||
ItemStack craftingMaterial,
|
||||
float accuracy,
|
||||
float breakChance,
|
||||
float durabilityModifier,
|
||||
int color) {
|
||||
FletchingMaterial mat = new FletchingMaterial(
|
||||
materialID, value, input, craftingMaterial, accuracy, breakChance, durabilityModifier, color);
|
||||
customMaterials.add(mat);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static void addBowstringMaterial (int materialID, int value, ItemStack input, ItemStack craftingMaterial, float durability, float drawSpeed, float flightSpeed)
|
||||
{
|
||||
BowstringMaterial mat = new BowstringMaterial(materialID, value, input, craftingMaterial, durability, drawSpeed, flightSpeed);
|
||||
public static void addBowstringMaterial(
|
||||
int materialID,
|
||||
int value,
|
||||
ItemStack input,
|
||||
ItemStack craftingMaterial,
|
||||
float durability,
|
||||
float drawSpeed,
|
||||
float flightSpeed) {
|
||||
BowstringMaterial mat =
|
||||
new BowstringMaterial(materialID, value, input, craftingMaterial, durability, drawSpeed, flightSpeed);
|
||||
customMaterials.add(mat);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static void addFletchingMaterial (int materialID, int value, ItemStack input, ItemStack craftingMaterial, float accuracy, float breakChance, float mass)
|
||||
{
|
||||
FletchingMaterial mat = new FletchingMaterial(materialID, value, input, craftingMaterial, accuracy, breakChance, mass);
|
||||
public static void addFletchingMaterial(
|
||||
int materialID,
|
||||
int value,
|
||||
ItemStack input,
|
||||
ItemStack craftingMaterial,
|
||||
float accuracy,
|
||||
float breakChance,
|
||||
float mass) {
|
||||
FletchingMaterial mat =
|
||||
new FletchingMaterial(materialID, value, input, craftingMaterial, accuracy, breakChance, mass);
|
||||
customMaterials.add(mat);
|
||||
}
|
||||
|
||||
public static CustomMaterial getCustomMaterial (int materialID, Class<? extends CustomMaterial> clazz)
|
||||
{
|
||||
for (CustomMaterial mat : customMaterials)
|
||||
{
|
||||
if (mat.getClass().equals(clazz) && mat.materialID == materialID)
|
||||
return mat;
|
||||
public static CustomMaterial getCustomMaterial(int materialID, Class<? extends CustomMaterial> clazz) {
|
||||
for (CustomMaterial mat : customMaterials) {
|
||||
if (mat.getClass().equals(clazz) && mat.materialID == materialID) return mat;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static CustomMaterial getCustomMaterial (ItemStack input, Class<? extends CustomMaterial> clazz)
|
||||
{
|
||||
for (CustomMaterial mat : customMaterials)
|
||||
{
|
||||
if (mat.getClass().equals(clazz) && mat.matches(input))
|
||||
return mat;
|
||||
public static CustomMaterial getCustomMaterial(ItemStack input, Class<? extends CustomMaterial> clazz) {
|
||||
for (CustomMaterial mat : customMaterials) {
|
||||
if (mat.getClass().equals(clazz) && mat.matches(input)) return mat;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -522,76 +598,61 @@ public class TConstructRegistry
|
||||
/*
|
||||
* public static ItemStack craftBowString(ItemStack stack) { if
|
||||
* (stack.stackSize < 3) return null;
|
||||
*
|
||||
*
|
||||
* for (BowstringMaterial mat : bowstringMaterials) { if
|
||||
* (stack.isItemEqual(mat.input)) return mat.craftingItem.copy(); } return
|
||||
* null; }
|
||||
*
|
||||
*
|
||||
* public static BowstringMaterial getBowstringMaterial(ItemStack stack) {
|
||||
* if (stack.stackSize < 3) return null;
|
||||
*
|
||||
*
|
||||
* for (BowstringMaterial mat : bowstringMaterials) { if
|
||||
* (stack.isItemEqual(mat.input)) return mat; } return null; }
|
||||
*/
|
||||
|
||||
public static LiquidCasting getTableCasting ()
|
||||
{
|
||||
public static LiquidCasting getTableCasting() {
|
||||
return instance.tableCasting();
|
||||
}
|
||||
|
||||
LiquidCasting tableCasting ()
|
||||
{
|
||||
try
|
||||
{
|
||||
LiquidCasting tableCasting() {
|
||||
try {
|
||||
Class clazz = Class.forName("tconstruct.TConstruct");
|
||||
Method method = clazz.getMethod("getTableCasting");
|
||||
LiquidCasting lc = (LiquidCasting) method.invoke(this);
|
||||
return lc;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
logger.warn("Could not find casting table recipes.");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static LiquidCasting getBasinCasting ()
|
||||
{
|
||||
public static LiquidCasting getBasinCasting() {
|
||||
return instance.basinCasting();
|
||||
}
|
||||
|
||||
LiquidCasting basinCasting ()
|
||||
{
|
||||
try
|
||||
{
|
||||
LiquidCasting basinCasting() {
|
||||
try {
|
||||
Class clazz = Class.forName("tconstruct.TConstruct");
|
||||
Method method = clazz.getMethod("getBasinCasting");
|
||||
LiquidCasting lc = (LiquidCasting) method.invoke(this);
|
||||
return lc;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
logger.warn("Could not find casting basin recipes.");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static Detailing getChiselDetailing ()
|
||||
{
|
||||
public static Detailing getChiselDetailing() {
|
||||
return instance.chiselDetailing();
|
||||
}
|
||||
|
||||
Detailing chiselDetailing ()
|
||||
{
|
||||
try
|
||||
{
|
||||
Detailing chiselDetailing() {
|
||||
try {
|
||||
Class clazz = Class.forName("tconstruct.TConstruct");
|
||||
Method method = clazz.getMethod("getChiselDetailing");
|
||||
Detailing lc = (Detailing) method.invoke(this);
|
||||
return lc;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
logger.warn("Could not find chisel detailing recipes.");
|
||||
return null;
|
||||
}
|
||||
@@ -600,13 +661,11 @@ public class TConstructRegistry
|
||||
public static ArrayList<ActiveToolMod> activeModifiers = new ArrayList<ActiveToolMod>();
|
||||
public static LinkedList<ActiveArmorMod> activeArmorModifiers = new LinkedList<ActiveArmorMod>();
|
||||
|
||||
public static void registerActiveToolMod (ActiveToolMod mod)
|
||||
{
|
||||
public static void registerActiveToolMod(ActiveToolMod mod) {
|
||||
activeModifiers.add(mod);
|
||||
}
|
||||
|
||||
public static void registerActiveArmorMod (ActiveArmorMod mod)
|
||||
{
|
||||
public static void registerActiveArmorMod(ActiveArmorMod mod) {
|
||||
activeArmorModifiers.add(mod);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user