mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
material def using DictFrames
This commit is contained in:
parent
5a87f9be64
commit
c0cb5b3ebc
@ -526,7 +526,7 @@ public class OreDictManager {
|
||||
}
|
||||
|
||||
public static class DictFrame {
|
||||
String[] mats;
|
||||
public String[] mats;
|
||||
float hazMult = 1.0F;
|
||||
List<HazardEntry> hazards = new ArrayList();
|
||||
|
||||
|
||||
@ -4,7 +4,9 @@ public enum MaterialShapes {
|
||||
|
||||
QUANTUM(1), // 1/72 of an ingot, allows the ingot to be divisible through 2, 4, 6, 8, 9, 12, 24 and 36
|
||||
NUGGET(8, "nugget"),
|
||||
DUSTTINY(NUGGET.quantity, "dustTiny"),
|
||||
WIRE(9),
|
||||
BILLET(NUGGET.quantity * 6, "billet"),
|
||||
INGOT(NUGGET.quantity * 9, "ingot"),
|
||||
DUST(INGOT.quantity, "dust"),
|
||||
PLATE(INGOT.quantity, "plate"),
|
||||
@ -16,5 +18,9 @@ public enum MaterialShapes {
|
||||
private MaterialShapes(int quantity, String... prefixes) {
|
||||
this.quantity = quantity;
|
||||
this.prefixes = prefixes;
|
||||
|
||||
for(String prefix : prefixes) {
|
||||
Mats.prefixByName.put(prefix, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,17 +1,39 @@
|
||||
package com.hbm.inventory.material;
|
||||
|
||||
/* with every new rewrite, optimization and improvement, the code becomes more gregian */
|
||||
public class Mats {
|
||||
import static com.hbm.inventory.material.MaterialShapes.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import com.hbm.inventory.OreDictManager;
|
||||
import com.hbm.inventory.OreDictManager.DictFrame;
|
||||
import com.hbm.inventory.material.NTMMaterial.SmeltingBehavior;
|
||||
|
||||
/* with every new rewrite, optimization and improvement, the code becomes more gregian */
|
||||
/**
|
||||
* Defines materials that wrap around DictFrames to more accurately describe that material.
|
||||
* Direct uses are the crucible and possibly item auto-gen, depending on what traits are set.
|
||||
* @author hbm
|
||||
*/
|
||||
public class Mats {
|
||||
|
||||
public static HashMap<String, MaterialShapes> prefixByName = new HashMap();
|
||||
public static HashMap<String, NTMMaterial> matByName = new HashMap();
|
||||
|
||||
public static NTMMaterial
|
||||
IRON = makeSmeltable(OreDictManager.IRON, 0).omitAutoGen(),
|
||||
GOLD = makeSmeltable(OreDictManager.GOLD, 0).omitAutoGen(),
|
||||
STEEL = makeSmeltable(OreDictManager.STEEL, 0).setShapes(DUSTTINY, INGOT, DUST, PLATE, BLOCK),
|
||||
TUNGSTEN = makeSmeltable(OreDictManager.W, 0).setShapes(WIRE, INGOT, DUST, BLOCK),
|
||||
COPPER = makeSmeltable(OreDictManager.CU, 0).setShapes(WIRE, INGOT, DUST, PLATE, BLOCK),
|
||||
ALUMINIUM = makeSmeltable(OreDictManager.AL, 0).setShapes(WIRE, INGOT, DUST, PLATE, BLOCK),
|
||||
MINGRADE = makeSmeltable(OreDictManager.MINGRADE, 0).setShapes(WIRE, INGOT, DUST, BLOCK),
|
||||
ALLOY = makeSmeltable(OreDictManager.ALLOY, 0).setShapes(WIRE, INGOT, DUST, PLATE, BLOCK);
|
||||
|
||||
public static NTMMaterial make(DictFrame dict) {
|
||||
return new NTMMaterial(dict);
|
||||
}
|
||||
|
||||
IRON = make("Iron"),
|
||||
GOLD = make("Gold"),
|
||||
STEEL = make("Steel"),
|
||||
TUNGSTEN = make("Tungsten"),
|
||||
COPPER = make("Copper");
|
||||
|
||||
public static NTMMaterial make(String... names) {
|
||||
return new NTMMaterial(names);
|
||||
public static NTMMaterial makeSmeltable(DictFrame dict, int color) {
|
||||
return new NTMMaterial(dict).smeltable(SmeltingBehavior.SMELTABLE).setMoltenColor(color);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package com.hbm.inventory.material;
|
||||
|
||||
import com.hbm.inventory.OreDictManager.DictFrame;
|
||||
|
||||
/**
|
||||
* Encapsulates most materials that are currently listed as DictFrames, even vanilla ones.
|
||||
* @author hbm
|
||||
@ -7,14 +9,16 @@ package com.hbm.inventory.material;
|
||||
*/
|
||||
public class NTMMaterial {
|
||||
|
||||
public String[] names;
|
||||
public MaterialShapes[] shapes = new MaterialShapes[0];
|
||||
public boolean omitItemGen = false;
|
||||
public SmeltingBehavior smeltable = SmeltingBehavior.NOT_SMELTABLE;
|
||||
public int moltenColor = 0xFF4A00;
|
||||
|
||||
public NTMMaterial(String... names) {
|
||||
this.names = names;
|
||||
public NTMMaterial(DictFrame dict) {
|
||||
|
||||
for(String name : dict.mats) {
|
||||
Mats.matByName.put(name, this);
|
||||
}
|
||||
}
|
||||
|
||||
/** Shapes for autogen */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user