[ci skip] spotlessApply with the new settings

This commit is contained in:
Jason Mitchell committed 2023-01-28 18:04:28 -08:00
1 parent 83698cb73c
commit 84c2239244
561 files changed
+8872 -9300

No files matched your search

@@ -2,8 +2,11 @@ package tconstruct.library;
import java.lang.reflect.Method;
import java.util.*;
import net.minecraft.item.*;
import org.apache.logging.log4j.*;
import tconstruct.library.crafting.*;
import tconstruct.library.modifier.ActiveArmorMod;
import tconstruct.library.tools.*;
@@ -15,6 +18,7 @@ import tconstruct.tools.TinkerTools;
* @author mDiyo
*/
public class TConstructRegistry {
public static TConstructRegistry instance = new TConstructRegistry();
public static Logger logger = LogManager.getLogger("TCon-API");
@@ -33,27 +37,22 @@ 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
* 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,
* chiselHead scytheBlade, broadAxeHead, excavatorHead, largeSwordBlade,
* hammerHead bowstring, fletching, arrowhead
* Tool crafting parts: toolRod, toolShard, binding, toughBinding, toughRod, heavyPlate pickaxeHead, shovelhead,
* hatchetHead, swordBlade, wideguard, handGuard, crossbar, knifeBlade, fullGuard, frypanHead, signHead, chiselHead
* scytheBlade, broadAxeHead, excavatorHead, largeSwordBlade, hammerHead bowstring, fletching, arrowhead
*/
public static HashMap<String, Item> itemDirectory = new HashMap<>();
/**
* Adds an item to the directory
*
* @param name
* Associates the name with the stack
* @param itemstack
* The stack to add 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) {
Item add = itemDirectory.get(name);
@@ -65,8 +64,7 @@ public class TConstructRegistry {
/**
* Retrieves an itemstack from the directory
*
* @param name
* The name of the item to get
* @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) {
@@ -79,31 +77,25 @@ public class TConstructRegistry {
/**
* A directory of ItemStacks. Contains mostly crafting items
*
* Materials: paperStack, greenSlimeCrystal, blueSlimeCrystal, searedBrick,
* mossBall, lavaCrystal, necroticBone, silkyCloth, silkyJewel ingotCobalt,
* ingotArdite, ingotManyullyn, ingotCopper, ingotTin, ingotAluminum,
* rawAluminum, ingotBronze, ingotAluminumBrass, ingotAlumite, ingotSteel,
* ingotObsidian nuggetIron, nuggetCopper, nuggetTin, nuggetAluminum,
* nuggetSilver, nuggetAluminumBrass oreberryIron, oreberryGold,
* oreberryCopper, oreberryTin, oreberryTin, oreberrySilver, diamondApple,
* blueSlimeFood, canisterEmpty, miniRedHeart, canisterRedHeart
* Materials: paperStack, greenSlimeCrystal, blueSlimeCrystal, searedBrick, mossBall, lavaCrystal, necroticBone,
* silkyCloth, silkyJewel ingotCobalt, ingotArdite, ingotManyullyn, ingotCopper, ingotTin, ingotAluminum,
* rawAluminum, ingotBronze, ingotAluminumBrass, ingotAlumite, ingotSteel, ingotObsidian nuggetIron, nuggetCopper,
* nuggetTin, nuggetAluminum, 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,
* knifeBlade, chiselHead, toughRod, toughBinding, largePlate, broadAxeHead,
* scytheHead, excavatorHead, largeBlade, hammerHead, fullGuard, bowString,
* fletching, arrowHead
* Patterns - These have a suffix of Pattern or Cast. ex: hatchetHeadPattern ingot, toolRod, pickaxeHead,
* shovelHead, hatchetHead, swordBlade, wideGuard, handGuard, crossbar, binding, frypanHead, signHead, knifeBlade,
* chiselHead, toughRod, toughBinding, largePlate, broadAxeHead, scytheHead, excavatorHead, largeBlade, hammerHead,
* fullGuard, bowString, fletching, arrowHead
*/
static HashMap<String, ItemStack> itemstackDirectory = new HashMap<>();
/**
* Adds an itemstack to the directory
*
* @param name
* Associates the name with the stack
* @param itemstack
* The stack to add 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) {
ItemStack add = itemstackDirectory.get(name);
@@ -115,8 +107,7 @@ public class TConstructRegistry {
/**
* Retrieves an itemstack from the directory
*
* @param name
* The name of the item to get
* @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) {
@@ -131,22 +122,17 @@ public class TConstructRegistry {
// Parts
/**
* List: Item ID, metadata, material ID ItemStack: Output. Ex: Cactus
* Binding
* List: Item ID, metadata, material ID ItemStack: Output. Ex: Cactus Binding
*/
public static HashMap<List, ItemStack> patternPartMapping = new HashMap<>();
/**
* Maps an item and a material ID to an output part
*
* @param woodPattern
* ID to check against
* @param patternMeta
* Metadata to check against
* @param materialID
* Material that goes with the item
* @param output
* The resulting part
* @param woodPattern ID to check against
* @param patternMeta Metadata to check against
* @param materialID Material that goes with the item
* @param output The resulting part
*/
public static void addPartMapping(Item woodPattern, int patternMeta, int materialID, ItemStack output) {
patternPartMapping.put(Arrays.asList(woodPattern, patternMeta, materialID), output);
@@ -179,15 +165,12 @@ 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.
* 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
* @param output The ToolCore to craft
* @param parts Pieces to make the tool with
*/
public static void addToolRecipe(ToolCore output, Item... parts) {
ToolBuilder tb = ToolBuilder.instance;
@@ -217,39 +200,19 @@ public class TConstructRegistry {
/**
* Adds a tool material to the registry
*
* @param materialID
* Unique ID, stored for each part
* @param materialName
* Unique name for data lookup purposes
* @param harvestLevel
* The materials which the tool can harvest. Pickaxe levels - 0:
* Wood, 1: Stone, 2: Redstone/Diamond, 3: Obsidian, 4:
* Cobalt/Ardite, 5: Manyullyn
* @param durability
* Base durability of the tool, affects tool heads.
* @param miningspeed
* Base mining speed, divided by 100 in use
* @param attack
* Base attack
* @param handleModifier
* Durability multiplier on the tool
* @param reinforced
* Reinforced level
* @param stonebound
* Amount of Stonebound to put on the tool. Negative numbers are
* Spiny.
* @param materialID Unique ID, stored for each part
* @param materialName Unique name for data lookup purposes
* @param harvestLevel The materials which the tool can harvest. Pickaxe levels - 0: Wood, 1: Stone, 2:
* Redstone/Diamond, 3: Obsidian, 4: Cobalt/Ardite, 5: Manyullyn
* @param durability Base durability of the tool, affects tool heads.
* @param miningspeed Base mining speed, divided by 100 in use
* @param attack Base attack
* @param handleModifier Durability multiplier on the tool
* @param reinforced Reinforced level
* @param stonebound 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,
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) {
@@ -266,51 +229,28 @@ public class TConstructRegistry {
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);
}
/**
* Adds a tool material to the registry
*
* @param materialID
* Unique ID, stored for each part
* @param materialName
* Unique name for data lookup purposes
* @param localizationName
* The string used to localize the material name
* @param harvestLevel
* The materials which the tool can harvest. Pickaxe levels - 0:
* Wood, 1: Stone, 2: Redstone/Diamond, 3: Obsidian, 4:
* Cobalt/Ardite, 5: Manyullyn
* @param durability
* Base durability of the tool, affects tool heads.
* @param miningspeed
* Base mining speed, divided by 100 in use
* @param attack
* Base attack
* @param handleModifier
* Durability multiplier on the tool
* @param reinforced
* Reinforced level
* @param stonebound
* Amount of Stonebound to put on the tool. Negative numbers are
* Spiny.
* @param materialID Unique ID, stored for each part
* @param materialName Unique name for data lookup purposes
* @param localizationName The string used to localize the material name
* @param harvestLevel The materials which the tool can harvest. Pickaxe levels - 0: Wood, 1: Stone, 2:
* Redstone/Diamond, 3: Obsidian, 4: Cobalt/Ardite, 5: Manyullyn
* @param durability Base durability of the tool, affects tool heads.
* @param miningspeed Base mining speed, divided by 100 in use
* @param attack Base attack
* @param handleModifier Durability multiplier on the tool
* @param reinforced Reinforced level
* @param stonebound 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(
@@ -327,23 +267,13 @@ public class TConstructRegistry {
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) {
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(
@@ -361,17 +291,8 @@ public class TConstructRegistry {
}
@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,
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.");
@@ -389,19 +310,9 @@ public class TConstructRegistry {
}
@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) {
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(
@@ -420,27 +331,22 @@ public class TConstructRegistry {
/**
* 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.
* @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) {
ToolMaterial mat = toolMaterials.get(materialID);
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
* @param key The ID to look up
* @return Tool Material
*/
public static ToolMaterial getMaterial(int key) {
@@ -456,8 +362,7 @@ public class TConstructRegistry {
/**
* Looks up a tool material by name
*
* @param key
* the name to look up
* @param key the name to look up
* @return Tool Material
*/
public static ToolMaterial getMaterial(String key) {
@@ -519,59 +424,59 @@ public class TConstructRegistry {
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) {
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);
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) {
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);
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);
}
@@ -590,24 +495,16 @@ public class TConstructRegistry {
}
/*
* public static CustomMaterial getCustomMaterial(ItemStack input, ItemStack
* pattern) { for (CustomMaterial mat : customMaterials) { if
* (mat.matches(input, pattern)) return mat; } return null; }
* public static CustomMaterial getCustomMaterial(ItemStack input, ItemStack pattern) { for (CustomMaterial mat :
* customMaterials) { if (mat.matches(input, pattern)) return mat; } return null; }
*/
/*
* 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 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() {
@@ -667,9 +564,7 @@ public class TConstructRegistry {
}
/**
* Default Material Index 0: Wood 1: Stone 2: Iron 3: Flint 4: Cactus 5:
* Bone 6: Obsidian 7: Netherrack 8: Green Slime 9: Paper 10: Cobalt 11:
* Ardite 12: Manyullyn 13: Copper 14: Bronze 15: Alumite 16: Steel 17: Blue
* Slime
* Default Material Index 0: Wood 1: Stone 2: Iron 3: Flint 4: Cactus 5: Bone 6: Obsidian 7: Netherrack 8: Green
* Slime 9: Paper 10: Cobalt 11: Ardite 12: Manyullyn 13: Copper 14: Bronze 15: Alumite 16: Steel 17: Blue Slime
*/
}