DustMaterialBuilder, DustMaterial finish
This commit is contained in:
parent
d9b7dff00a
commit
c4913ef87c
11 changed files with 433 additions and 143 deletions
|
@ -10,7 +10,6 @@ import java.util.ArrayList;
|
|||
*/
|
||||
public enum Element {
|
||||
|
||||
_NULL(0, 0, -1, null, "", false),
|
||||
H(1, 0, -1, null, "Hydrogen", false),
|
||||
D(1, 1, -1, "H", "Deuterium", true),
|
||||
T(1, 2, -1, "D", "Tritium", true),
|
||||
|
@ -132,13 +131,10 @@ public enum Element {
|
|||
Fl(114, 175, -1, null, "Flerovium", false),
|
||||
Uup(115, 173, -1, null, "Ununpentium", false),
|
||||
Lv(116, 177, -1, null, "Livermorium", false),
|
||||
Fa(117, 177, -1, null, "Farnsium", false), // Uus, Ununseptium
|
||||
Uuo(118, 176, -1, null, "Ununoctium", false),
|
||||
Fa(117, 177, -1, null, "Farnsium", false),
|
||||
Uuo(118, 176, -1, null, "Ununoctium", false);
|
||||
|
||||
Ma(0, 100, -1, null, "Magic", false),
|
||||
Nt(0, 100000, -1, null, "Neutronium", false),
|
||||
|
||||
$H(-1, -0, -1, null, "Anti-Hydrogen", false),
|
||||
/*$H(-1, -0, -1, null, "Anti-Hydrogen", false),
|
||||
$D(-1, -1, -1, "H", "Anti-Deuterium", true),
|
||||
$T(-1, -2, -1, "D", "Anti-Tritium", true),
|
||||
$He(-2, -2, -1, null, "Anti-Helium", false),
|
||||
|
@ -259,15 +255,12 @@ public enum Element {
|
|||
$Fl(-114, -175, -1, null, "Anti-Flerovium", false),
|
||||
$Uup(-115, -173, -1, null, "Anti-Ununpentium", false),
|
||||
$Lv(-116, -177, -1, null, "Anti-Livermorium", false),
|
||||
$Uus(-117, -177, -1, null, "Anti-Ununseptium", false),
|
||||
$Uuo(-118, -176, -1, null, "Anti-Ununoctium", false),
|
||||
$Fa(-117, -177, -1, null, "Anti-Ununseptium", false),
|
||||
$Uuo(-118, -176, -1, null, "Anti-Ununoctium", false);*/
|
||||
|
||||
$Ma(0, -100, -1, null, "Anti-Magic", false),
|
||||
$Nt(0, -10000, -1, null, "Anti-Neutronium", false);
|
||||
|
||||
public final long mProtons, mNeutrons, mHalfLifeSeconds;
|
||||
public final String mName, mDecayTo;
|
||||
public final boolean mIsIsotope;
|
||||
public final long protons, neutrons, halfLifeSeconds;
|
||||
public final String name, decayTo;
|
||||
public final boolean isIsotope;
|
||||
|
||||
/**
|
||||
* Links to every pure Material containing just this Element.
|
||||
|
@ -275,37 +268,37 @@ public enum Element {
|
|||
public ArrayList<Materials> mLinkedMaterials = new ArrayList<Materials>();
|
||||
|
||||
/**
|
||||
* @param protons Amount of Protons. Antiprotons if negative.
|
||||
* @param neutrons Amount of Neutrons. Antineutrons if negative. (I could have made mistakes with the Neutron amount calculation, please tell me if I did something wrong)
|
||||
* @param halfLifeSeconds Amount of Half Life this Material has in Seconds. -1 for stable Materials.
|
||||
* @param decayTo String representing the Elements it decays to. Separated by an '&' Character.
|
||||
* @param protons Amount of Protons
|
||||
* @param neutrons Amount of Neutrons (I could have made mistakes with the Neutron amount calculation, please tell me if I did something wrong)
|
||||
* @param halfLifeSeconds Amount of Half Life this Material has in Seconds. -1 for stable Materials
|
||||
* @param decayTo String representing the Elements it decays to. Separated by an '&' Character
|
||||
* @param name Name of the Element
|
||||
*/
|
||||
private Element(long protons, long neutrons, long halfLifeSeconds, String decayTo, String name, boolean isIsotope) {
|
||||
mProtons = protons;
|
||||
mNeutrons = neutrons;
|
||||
mHalfLifeSeconds = halfLifeSeconds;
|
||||
mDecayTo = decayTo;
|
||||
mName = name;
|
||||
mIsIsotope = isIsotope;
|
||||
this.protons = protons;
|
||||
this.neutrons = neutrons;
|
||||
this.halfLifeSeconds = halfLifeSeconds;
|
||||
this.decayTo = decayTo;
|
||||
this.name = name;
|
||||
this.isIsotope = isIsotope;
|
||||
}
|
||||
|
||||
public static Element get(String materialName) {
|
||||
Object tObject = GT_Utility.getFieldContent(Element.class, materialName, false, false);
|
||||
if (tObject != null && tObject instanceof Element) return (Element) tObject;
|
||||
return _NULL;
|
||||
return H;
|
||||
}
|
||||
|
||||
public long getProtons() {
|
||||
return mProtons;
|
||||
return protons;
|
||||
}
|
||||
|
||||
public long getNeutrons() {
|
||||
return mNeutrons;
|
||||
return neutrons;
|
||||
}
|
||||
|
||||
public long getMass() {
|
||||
return mProtons + mNeutrons;
|
||||
return protons + neutrons;
|
||||
}
|
||||
|
||||
}
|
|
@ -62,7 +62,6 @@ public enum OrePrefixes {
|
|||
|
||||
ingotQuintuple("5x Ingots", "Quintuple ", " Ingot", true, true, false, false, false, false, true, true, false, false, B[1], M * 5, 12, 16), // A quintuple Ingot.
|
||||
ingotQuadruple("4x Ingots", "Quadruple ", " Ingot", true, true, false, false, false, false, true, true, false, false, B[1], M * 4, 16, 15), // A quadruple Ingot.
|
||||
@Deprecated ingotQuad("4x Ingots", "Quadruple ", " Ingot", false, false, false, false, false, false, false, false, false, false, B[1], -1, 16, 15),
|
||||
ingotTriple("3x Ingots", "Triple ", " Ingot", true, true, false, false, false, false, true, false, false, false, B[1], M * 3, 21, 14), // A triple Ingot.
|
||||
ingotDouble("2x Ingots", "Double ", " Ingot", true, true, false, false, false, false, true, true, false, false, B[1], M * 2, 32, 13), // A double Ingot. Introduced by TerraFirmaCraft
|
||||
ingotHot("Hot Ingots", "Hot ", " Ingot", true, true, false, false, false, false, false, true, false, false, B[1], M * 1, 16, 12), // A hot Ingot, which has to be cooled down by a Vacuum Freezer.
|
||||
|
@ -74,7 +73,6 @@ public enum OrePrefixes {
|
|||
gemExquisite("Exquisite Gemstones", "Exquisite ", "", true, true, true, false, false, false, true, true, false, false, B[2], M * 4, 16, 62), // A regular Gem worth four Dusts. Introduced by TerraFirmaCraft
|
||||
gem("Gemstones", "", "", true, true, true, false, false, false, true, true, false, false, B[2], M * 1, 64, 8), // A regular Gem worth one Dust. Introduced by Eloraam
|
||||
|
||||
@Deprecated dustDirty("Impure Dusts", "", "", false, false, false, false, false, false, false, false, false, true, B[3], -1, 64, 3),
|
||||
dustTiny("Tiny Dusts", "Tiny Pile of ", " Dust", true, true, false, false, false, false, false, true, false, false, B[0] | B[1] | B[2] | B[3], M / 9, 64, 0), // 1/9th of a Dust.
|
||||
dustSmall("Small Dusts", "Small Pile of ", " Dust", true, true, false, false, false, false, false, true, false, false, B[0] | B[1] | B[2] | B[3], M / 4, 64, 1), // 1/4th of a Dust.
|
||||
dustImpure("Impure Dusts", "Impure Pile of ", " Dust", true, true, false, false, false, false, false, true, false, true, B[3], M * 1, 64, 3), // Dust with impurities. 1 Unit of Main Material and 1/9 - 1/4 Unit of secondary Material
|
||||
|
|
|
@ -48,6 +48,31 @@ public abstract class Material implements ISubTagContainer, Comparable<Material
|
|||
public static final int DECOMPOSITION_BY_ELECTROLYZING = createFlag(1);
|
||||
public static final int DECOMPOSITION_BY_CENTRIFUGING = createFlag(2);
|
||||
|
||||
/**
|
||||
* If this Material is some kind of Magical
|
||||
*/
|
||||
public static final SubTag MAGICAL = getNewSubTag("MAGICAL");
|
||||
|
||||
/**
|
||||
* If this Material is having a constantly burning Aura
|
||||
*/
|
||||
public static final SubTag BURNING = getNewSubTag("BURNING");
|
||||
|
||||
/**
|
||||
* If this Material is some kind of flammable
|
||||
*/
|
||||
public static final SubTag FLAMMABLE = getNewSubTag("FLAMMABLE");
|
||||
|
||||
/**
|
||||
* If this Material is not burnable at all
|
||||
*/
|
||||
public static final SubTag UNBURNABLE = getNewSubTag("UNBURNABLE");
|
||||
|
||||
/**
|
||||
* If this Material is some kind of explosive
|
||||
*/
|
||||
public static final SubTag EXPLOSIVE = getNewSubTag("EXPLOSIVE");
|
||||
|
||||
/**
|
||||
* This Material cannot be unificated
|
||||
*/
|
||||
|
@ -119,10 +144,23 @@ public abstract class Material implements ISubTagContainer, Comparable<Material
|
|||
*/
|
||||
public final Element element;
|
||||
|
||||
public Material(String defaultLocalName, int materialRGB, String chemicalFormula, MaterialIconSet materialIconSet, ImmutableList<MaterialStack> materialComponents, ImmutableList<Material> oreReRegistrations, ImmutableList<SubTag> subTags, int materialGenerationFlags, float densityMultiplier, Element element) {
|
||||
private String calculateChemicalFormula() {
|
||||
if(element != null) {
|
||||
return element.name();
|
||||
}
|
||||
if(!materialComponents.isEmpty()) {
|
||||
StringBuilder components = new StringBuilder();
|
||||
for(MaterialStack component : materialComponents)
|
||||
components.append(component.toString());
|
||||
return components.toString();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public Material(String defaultLocalName, int materialRGB, MaterialIconSet materialIconSet, ImmutableList<MaterialStack> materialComponents, ImmutableList<Material> oreReRegistrations, ImmutableList<SubTag> subTags, int materialGenerationFlags, float densityMultiplier, Element element) {
|
||||
this.defaultLocalName = defaultLocalName;
|
||||
this.materialRGB = materialRGB;
|
||||
this.chemicalFormula = chemicalFormula;
|
||||
this.chemicalFormula = calculateChemicalFormula();
|
||||
this.materialIconSet = materialIconSet;
|
||||
this.materialComponents = materialComponents;
|
||||
this.oreReRegistrations = oreReRegistrations;
|
||||
|
@ -141,7 +179,7 @@ public abstract class Material implements ISubTagContainer, Comparable<Material
|
|||
|
||||
public boolean isRadioactive() {
|
||||
if (element != null)
|
||||
return element.mHalfLifeSeconds >= 0;
|
||||
return element.halfLifeSeconds >= 0;
|
||||
for (MaterialStack tMaterial : materialComponents)
|
||||
if (tMaterial.mMaterial.isRadioactive()) return true;
|
||||
return false;
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
package gregtech.api.enums.material;
|
||||
|
||||
public enum SolderingMaterialQuality {
|
||||
|
||||
BAD,
|
||||
NORMAL,
|
||||
GOOD
|
||||
|
||||
}
|
|
@ -0,0 +1,188 @@
|
|||
package gregtech.api.enums.material.builder;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Lists;
|
||||
import gregtech.api.enums.SubTag;
|
||||
import gregtech.api.enums.material.FluidMaterial;
|
||||
import gregtech.api.enums.material.Material;
|
||||
import gregtech.api.enums.material.types.AbstractSolidMaterial;
|
||||
import gregtech.api.enums.material.types.DustMaterial;
|
||||
import gregtech.api.enums.material.types.MetalMaterial;
|
||||
import gregtech.api.objects.MaterialStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class DustMaterialBuilder<T extends DustMaterial, Self extends DustMaterialBuilder<T, Self>> extends MaterialBuilder<T, Self> {
|
||||
|
||||
protected int oreValue = 0;
|
||||
protected int oreMultiplier = 1;
|
||||
protected int byProductMultiplier = 1;
|
||||
protected int smeltingMultiplier = 1;
|
||||
protected ArrayList<DustMaterial> oreByProducts = new ArrayList<>();
|
||||
protected AbstractSolidMaterial oreDirectSmelting = null;
|
||||
protected AbstractSolidMaterial smeltInto = null;
|
||||
protected MetalMaterial arcSmeltInto = null;
|
||||
protected FluidMaterial washedIn = null;
|
||||
protected DustMaterial separatedOnto = null;
|
||||
|
||||
public DustMaterialBuilder(String name, String defaultLocalizedName) {
|
||||
super(name, defaultLocalizedName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables ore and all ore components for material
|
||||
* @param oreValue ore quality number (used for IC2 miner)
|
||||
* @return this
|
||||
*/
|
||||
public Self enableOre(int oreValue) {
|
||||
Preconditions.checkArgument(oreValue > 0, "Ore value must be positive!");
|
||||
this.materialGenerationBits |= DustMaterial.MatFlags.GENERATE_ORE;
|
||||
this.oreValue = oreValue;
|
||||
return (Self) this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies maceration (1-st step of processing) ore multiplier
|
||||
* By default, it is 1 (2 crushed ores from 1 ore block)
|
||||
* @param oreMultiplier maceration ore multiplier
|
||||
* @return this
|
||||
*/
|
||||
public Self oreMultiplier(int oreMultiplier) {
|
||||
Preconditions.checkArgument(oreMultiplier > 0, "Ore multiplier must be positive!");
|
||||
this.oreMultiplier = oreMultiplier;
|
||||
return (Self) this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies byproducts obtained in processing chain of this material's ore
|
||||
* TODO: specify which indexes delegates to which processing steps
|
||||
* @param byProducts byproducts list. Indexes are used for different processing steps.
|
||||
* @return this
|
||||
*/
|
||||
public Self oreByProducts(DustMaterial... byProducts) {
|
||||
Preconditions.checkNotNull(byProducts);
|
||||
Preconditions.checkArgument(byProducts.length > 0, "Cannot add empty byproducts array!");
|
||||
this.oreByProducts = Lists.newArrayList(byProducts);
|
||||
return (Self) this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies a primary byproduct multiplier obtained during ore maceration
|
||||
* @param byProductMultiplier primary byproduct multiplier
|
||||
* @return this
|
||||
*/
|
||||
public Self byProductMultiplier(int byProductMultiplier) {
|
||||
Preconditions.checkArgument(byProductMultiplier > 0, "Byproducts multiplier must be positive!");
|
||||
this.byProductMultiplier = byProductMultiplier;
|
||||
return (Self) this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies ore block smelting (and induction smelting) multiplier
|
||||
* @param smeltingMultiplier ore smelting multiplier
|
||||
* @return this
|
||||
*/
|
||||
public Self smeltingMultiplier(int smeltingMultiplier) {
|
||||
Preconditions.checkArgument(smeltingMultiplier > 0, "Smelting multiplier must be positive!");
|
||||
this.smeltingMultiplier = smeltingMultiplier;
|
||||
return (Self) this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies a solid material into which this ore smelts. Material should have ingot or gem
|
||||
* @param oreDirectSmelting smelting material
|
||||
* @return this
|
||||
*/
|
||||
public Self oreDirectSmelting(AbstractSolidMaterial oreDirectSmelting) {
|
||||
Preconditions.checkNotNull(oreDirectSmelting);
|
||||
this.oreDirectSmelting = oreDirectSmelting;
|
||||
return (Self) this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies a fluid in which this material's ore can be washed
|
||||
* @param washedIn washing liquid
|
||||
* @return this
|
||||
*/
|
||||
public Self washedIn(FluidMaterial washedIn) {
|
||||
Preconditions.checkNotNull(washedIn);
|
||||
this.washedIn = washedIn;
|
||||
return (Self) this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies a material which is given during this material's ore electromagnetic separation
|
||||
* @param separatedOnto separated material
|
||||
* @return this
|
||||
*/
|
||||
public Self separatedOnto(DustMaterial separatedOnto) {
|
||||
Preconditions.checkNotNull(separatedOnto);
|
||||
this.separatedOnto = separatedOnto;
|
||||
return (Self) this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies a material into this material's ore smelted
|
||||
* Specified material SHOULD have ingot or gem
|
||||
* @param smeltInto smelted material
|
||||
* @return this
|
||||
*/
|
||||
public Self smeltInto(AbstractSolidMaterial smeltInto) {
|
||||
Preconditions.checkNotNull(smeltInto);
|
||||
this.smeltInto = smeltInto;
|
||||
return (Self) this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies a material into this material's part will be melted in arc furnace
|
||||
* @param smeltInto arc furnace material
|
||||
* @return this
|
||||
*/
|
||||
public Self arcSmeltInto(MetalMaterial smeltInto) {
|
||||
Preconditions.checkNotNull(smeltInto);
|
||||
this.arcSmeltInto = smeltInto;
|
||||
return (Self) this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Marks material as low-outputting in induction smelter from TE
|
||||
* @return this
|
||||
*/
|
||||
public Self inductionSmeltingLowOutput() {
|
||||
this.subTags.add(DustMaterial.MatFlags.INDUCTION_SMELTING_LOW_OUTPUT);
|
||||
return (Self) this;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected T build() {
|
||||
//java, fuck off, please
|
||||
ImmutableList<MaterialStack> materialStacks1 = ImmutableList.copyOf(materialCompounds);
|
||||
ImmutableList<SubTag> subTags1 = ImmutableList.copyOf(subTags);
|
||||
ImmutableList<Material> reRegistrations = ImmutableList.of();
|
||||
ImmutableList<DustMaterial> byProducts = ImmutableList.copyOf(oreByProducts);
|
||||
|
||||
return (T) new DustMaterial(
|
||||
defaultLocalizedName,
|
||||
rgbColor,
|
||||
iconSet,
|
||||
materialStacks1,
|
||||
reRegistrations,
|
||||
subTags1,
|
||||
materialGenerationBits,
|
||||
densityMultiplier,
|
||||
directElement,
|
||||
oreValue,
|
||||
byProducts,
|
||||
oreMultiplier,
|
||||
byProductMultiplier,
|
||||
smeltingMultiplier,
|
||||
oreDirectSmelting,
|
||||
smeltInto,
|
||||
arcSmeltInto,
|
||||
washedIn,
|
||||
separatedOnto
|
||||
);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,121 @@
|
|||
package gregtech.api.enums.material.builder;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.Lists;
|
||||
import gregtech.api.enums.Element;
|
||||
import gregtech.api.enums.SubTag;
|
||||
import gregtech.api.enums.material.Material;
|
||||
import gregtech.api.enums.material.MaterialIconSet;
|
||||
import gregtech.api.objects.MaterialStack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public abstract class MaterialBuilder<T extends Material, Self extends MaterialBuilder<T, Self>> {
|
||||
|
||||
protected final String name;
|
||||
protected final String defaultLocalizedName;
|
||||
protected MaterialIconSet iconSet = MaterialIconSet.NONE;
|
||||
protected int rgbColor = 0xFFFFFF;
|
||||
protected ArrayList<SubTag> subTags = new ArrayList<>();
|
||||
protected int materialGenerationBits = 0;
|
||||
protected float densityMultiplier = 1.0f;
|
||||
protected Element directElement = null;
|
||||
protected ArrayList<MaterialStack> materialCompounds = new ArrayList<>();
|
||||
protected int metaItemSubId = -1;
|
||||
|
||||
public MaterialBuilder(String name, String defaultLocalizedName) {
|
||||
this.name = name;
|
||||
this.defaultLocalizedName = defaultLocalizedName;
|
||||
}
|
||||
|
||||
public Self metaItemSubId(int metaItemSubId) {
|
||||
this.metaItemSubId = metaItemSubId;
|
||||
return (Self) this;
|
||||
}
|
||||
|
||||
public Self enableDecompositionByCentrifuging() {
|
||||
this.materialGenerationBits |= Material.MatFlags.GENERATE_DECOMPOSITION_RECIPES;
|
||||
this.materialGenerationBits |= Material.MatFlags.DECOMPOSITION_BY_CENTRIFUGING;
|
||||
return (Self) this;
|
||||
}
|
||||
|
||||
public Self enableDecompositionByElectrolyzing() {
|
||||
this.materialGenerationBits |= Material.MatFlags.GENERATE_DECOMPOSITION_RECIPES;
|
||||
this.materialGenerationBits |= Material.MatFlags.DECOMPOSITION_BY_ELECTROLYZING;
|
||||
return (Self) this;
|
||||
}
|
||||
|
||||
public Self markMagical() {
|
||||
this.subTags.add(Material.MatFlags.MAGICAL);
|
||||
return (Self) this;
|
||||
}
|
||||
|
||||
public Self markExplosive() {
|
||||
this.subTags.add(Material.MatFlags.EXPLOSIVE);
|
||||
return (Self) this;
|
||||
}
|
||||
|
||||
public Self markUnburnable() {
|
||||
Preconditions.checkState(!subTags.contains(Material.MatFlags.FLAMMABLE), "Cannot mark flammable material as unburnable!");
|
||||
this.subTags.add(Material.MatFlags.UNBURNABLE);
|
||||
return (Self) this;
|
||||
}
|
||||
|
||||
public Self markFlammable() {
|
||||
Preconditions.checkState(!subTags.contains(Material.MatFlags.UNBURNABLE), "Cannot mark unburnable material as flammable!");
|
||||
this.subTags.add(Material.MatFlags.FLAMMABLE);
|
||||
return (Self) this;
|
||||
}
|
||||
|
||||
public Self markBurning() {
|
||||
Preconditions.checkState(!subTags.contains(Material.MatFlags.UNBURNABLE), "Cannot mark unburnable material as burning!");
|
||||
this.subTags.add(Material.MatFlags.FLAMMABLE);
|
||||
this.subTags.add(Material.MatFlags.BURNING);
|
||||
return (Self) this;
|
||||
}
|
||||
|
||||
public Self disableUnification() {
|
||||
this.subTags.add(Material.MatFlags.NO_UNIFICATION);
|
||||
return (Self) this;
|
||||
}
|
||||
|
||||
public Self disableRecycling() {
|
||||
this.subTags.add(Material.MatFlags.NO_RECYCLING);
|
||||
return (Self) this;
|
||||
}
|
||||
|
||||
public Self color(int color) {
|
||||
this.rgbColor = color;
|
||||
return (Self) this;
|
||||
}
|
||||
|
||||
public Self densityMultiplier(float densityMultiplier) {
|
||||
this.densityMultiplier = densityMultiplier;
|
||||
return (Self) this;
|
||||
}
|
||||
|
||||
public Self directElement(Element element) {
|
||||
Preconditions.checkNotNull(element);
|
||||
Preconditions.checkState(materialCompounds.isEmpty(), "Cannot specify direct element for compound material!");
|
||||
this.directElement = element;
|
||||
return (Self) this;
|
||||
}
|
||||
|
||||
public Self compounds(MaterialStack... compounds) {
|
||||
Preconditions.checkNotNull(compounds);
|
||||
Preconditions.checkArgument(compounds.length > 0, "Cannot add empty compounds array!");
|
||||
Preconditions.checkState(directElement == null, "Cannot specify compounds for direct element material!");
|
||||
this.materialCompounds = Lists.newArrayList(compounds);
|
||||
return (Self) this;
|
||||
}
|
||||
|
||||
protected abstract T build();
|
||||
|
||||
public final T buildAndRegister() {
|
||||
T material = build();
|
||||
if(metaItemSubId > 0) {
|
||||
Material.MATERIAL_REGISTRY.register(metaItemSubId, name, material);
|
||||
} else Material.MATERIAL_REGISTRY.putObject(name, material);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
package gregtech.api.enums.material.types;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import gregtech.api.enums.Element;
|
||||
import gregtech.api.enums.SubTag;
|
||||
import gregtech.api.enums.material.*;
|
||||
|
@ -10,6 +9,8 @@ import net.minecraft.enchantment.Enchantment;
|
|||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static gregtech.api.enums.SubTag.getNewSubTag;
|
||||
import static gregtech.api.enums.material.Material.MatFlags.createFlag;
|
||||
|
||||
|
@ -127,8 +128,8 @@ public class AbstractSolidMaterial extends DustMaterial implements gregtech.api.
|
|||
private Fluid materialFluid;
|
||||
private Fluid materialPlasma;
|
||||
|
||||
public AbstractSolidMaterial(String defaultLocalName, int materialRGB, String chemicalFormula, MaterialIconSet materialIconSet, ImmutableList<MaterialStack> materialComponents, ImmutableList<Material> oreReRegistrations, ImmutableList<SubTag> subTags, int materialGenerationFlags, float densityMultiplier, Element element, int mOreValue, int oreMultiplier, int mByProductMultiplier, int mSmeltingMultiplier, AbstractSolidMaterial directSmelting, AbstractSolidMaterial smeltInto, AbstractSolidMaterial arcSmeltInto, float toolSpeed, byte toolQuality, int toolDurability, Enchantment toolEnchantment, int toolEnchantmentLevel, int blastFurnaceTemp, AbstractSolidMaterial handleMaterial, DustMaterial macerateInto) {
|
||||
super(defaultLocalName, materialRGB, chemicalFormula, materialIconSet, materialComponents, oreReRegistrations, subTags, materialGenerationFlags, densityMultiplier, element, mOreValue, oreMultiplier, mByProductMultiplier, mSmeltingMultiplier, directSmelting, smeltInto, arcSmeltInto);
|
||||
public AbstractSolidMaterial(String defaultLocalName, int materialRGB, MaterialIconSet materialIconSet, List<MaterialStack> materialComponents, List<Material> oreReRegistrations, List<SubTag> subTags, int materialGenerationFlags, float densityMultiplier, Element element, int mOreValue, int oreMultiplier, int mByProductMultiplier, int mSmeltingMultiplier, AbstractSolidMaterial directSmelting, AbstractSolidMaterial smeltInto, AbstractSolidMaterial arcSmeltInto, float toolSpeed, byte toolQuality, int toolDurability, Enchantment toolEnchantment, int toolEnchantmentLevel, int blastFurnaceTemp, AbstractSolidMaterial handleMaterial, DustMaterial macerateInto) {
|
||||
super(defaultLocalName, materialRGB, materialIconSet, materialComponents, oreReRegistrations, subTags, materialGenerationFlags, densityMultiplier, element, mOreValue, oreMultiplier, mByProductMultiplier, mSmeltingMultiplier, directSmelting, smeltInto, arcSmeltInto);
|
||||
this.toolSpeed = toolSpeed;
|
||||
this.toolQuality = toolQuality;
|
||||
this.toolDurability = toolDurability;
|
||||
|
|
|
@ -3,6 +3,7 @@ package gregtech.api.enums.material.types;
|
|||
import com.google.common.collect.ImmutableList;
|
||||
import gregtech.api.enums.Element;
|
||||
import gregtech.api.enums.SubTag;
|
||||
import gregtech.api.enums.material.FluidMaterial;
|
||||
import gregtech.api.enums.material.Material;
|
||||
import gregtech.api.enums.material.MaterialIconSet;
|
||||
import gregtech.api.objects.MaterialStack;
|
||||
|
@ -19,105 +20,11 @@ public class DustMaterial extends Material {
|
|||
*/
|
||||
public static final int GENERATE_ORE = createFlag(9);
|
||||
|
||||
/**
|
||||
* If this Material is some kind of Wood
|
||||
*/
|
||||
public static final SubTag WOOD = getNewSubTag("WOOD");
|
||||
/**
|
||||
* If this Material is some kind of Food (or edible at all)
|
||||
*/
|
||||
public static final SubTag FOOD = getNewSubTag("FOOD");
|
||||
/**
|
||||
* If this Material is some kind of Stone
|
||||
*/
|
||||
public static final SubTag STONE = getNewSubTag("STONE");
|
||||
/**
|
||||
* If this Material is some kind of Pearl
|
||||
*/
|
||||
public static final SubTag PEARL = getNewSubTag("PEARL");
|
||||
/**
|
||||
* If this Material is some kind of Quartz
|
||||
*/
|
||||
public static final SubTag QUARTZ = getNewSubTag("QUARTZ");
|
||||
/**
|
||||
* If this Material is Crystallisable
|
||||
*/
|
||||
public static final SubTag CRYSTALLISABLE = getNewSubTag("CRYSTALLISABLE");
|
||||
|
||||
/**
|
||||
* If this Material is some kind of Magical
|
||||
*/
|
||||
public static final SubTag MAGICAL = getNewSubTag("MAGICAL");
|
||||
|
||||
/**
|
||||
* If this Material is some kind of Paper
|
||||
*/
|
||||
public static final SubTag PAPER = getNewSubTag("PAPER");
|
||||
/**
|
||||
* If this Material is having a constantly burning Aura
|
||||
*/
|
||||
public static final SubTag BURNING = getNewSubTag("BURNING");
|
||||
/**
|
||||
* If this Material is some kind of flammable
|
||||
*/
|
||||
public static final SubTag FLAMMABLE = getNewSubTag("FLAMMABLE");
|
||||
/**
|
||||
* If this Material is not burnable at all
|
||||
*/
|
||||
public static final SubTag UNBURNABLE = getNewSubTag("UNBURNABLE");
|
||||
/**
|
||||
* If this Material is some kind of explosive
|
||||
*/
|
||||
public static final SubTag EXPLOSIVE = getNewSubTag("EXPLOSIVE");
|
||||
/**
|
||||
* If this Material is bouncy
|
||||
*/
|
||||
public static final SubTag BOUNCY = getNewSubTag("BOUNCY");
|
||||
|
||||
/**
|
||||
* This Material cannot be used in any Furnace alike Structure. Already listed are:
|
||||
* Paper, Wood, Gunpowder, Stone
|
||||
*/
|
||||
public static final SubTag NO_SMELTING = getNewSubTag("NO_SMELTING");
|
||||
|
||||
/**
|
||||
* Materials which are outputting less in an Induction Smelter. Already listed are:
|
||||
* Pyrite, Tetrahedrite, Sphalerite, Cinnabar
|
||||
*/
|
||||
public static final SubTag INDUCTIONSMELTING_LOW_OUTPUT = getNewSubTag("INDUCTIONSMELTING_LOW_OUTPUT");
|
||||
|
||||
/**
|
||||
* Add this to your Material if you want to have its Ore Sodium Persulfate washed. Already listed are:
|
||||
* Zinc, Nickel, Copper, Cobalt, Cobaltite and Tetrahedrite.
|
||||
*/
|
||||
public static final SubTag WASHING_SODIUMPERSULFATE = getNewSubTag("WASHING_SODIUMPERSULFATE");
|
||||
|
||||
/**
|
||||
* Add this to your Material if you want to have its Ore Mercury washed. Already listed are:
|
||||
* Gold, Silver, Osmium, Platinum, Cooperite.
|
||||
*/
|
||||
public static final SubTag WASHING_MERCURY = getNewSubTag("WASHING_MERCURY");
|
||||
|
||||
/**
|
||||
* Add this to your Material if you want to have its Ore electromagnetically separated to give Gold.
|
||||
*/
|
||||
public static final SubTag ELECTROMAGNETIC_SEPERATION_GOLD = getNewSubTag("ELECTROMAGNETIC_SEPERATION_GOLD");
|
||||
|
||||
/**
|
||||
* Add this to your Material if you want to have its Ore electromagnetically separated to give Iron.
|
||||
*/
|
||||
public static final SubTag ELECTROMAGNETIC_SEPERATION_IRON = getNewSubTag("ELECTROMAGNETIC_SEPERATION_IRON");
|
||||
|
||||
/**
|
||||
* Add this to your Material if you want to have its Ore electromagnetically separated to give Neodymium.
|
||||
*/
|
||||
public static final SubTag ELECTROMAGNETIC_SEPERATION_NEODYMIUM = getNewSubTag("ELECTROMAGNETIC_SEPERATION_NEODYMIUM");
|
||||
|
||||
/**
|
||||
* Add this to your Material if you want to have its Ore giving Cinnabar Crystals on Pulverization. Already listed are:
|
||||
* Redstone
|
||||
*/
|
||||
public static final SubTag PULVERIZING_CINNABAR = getNewSubTag("PULVERIZING_CINNABAR");
|
||||
public static final SubTag INDUCTION_SMELTING_LOW_OUTPUT = getNewSubTag("INDUCTIONSMELTING_LOW_OUTPUT");
|
||||
|
||||
}
|
||||
|
||||
|
@ -127,6 +34,11 @@ public class DustMaterial extends Material {
|
|||
*/
|
||||
public final int mOreValue;
|
||||
|
||||
/**
|
||||
* List of ore by products
|
||||
*/
|
||||
public final ImmutableList<DustMaterial> oreByProducts;
|
||||
|
||||
/**
|
||||
* Crushed ore output amount multiplier during maceration
|
||||
*/
|
||||
|
@ -145,30 +57,48 @@ public class DustMaterial extends Material {
|
|||
/**
|
||||
* Material to which smelting of this material ORE will result
|
||||
* Can point to this, and then material ore will just smelt into this material
|
||||
* Can be null
|
||||
*/
|
||||
public final AbstractSolidMaterial directSmelting;
|
||||
|
||||
/**
|
||||
* Smelting any item of this material will result material
|
||||
* specified in this field
|
||||
* Can be null
|
||||
*/
|
||||
public final AbstractSolidMaterial smeltInto;
|
||||
|
||||
/**
|
||||
* Arc Smelting any item of this material will result material
|
||||
* specified in this field
|
||||
* Can be null
|
||||
*/
|
||||
public final AbstractSolidMaterial arcSmeltInto;
|
||||
|
||||
public DustMaterial(String defaultLocalName, int materialRGB, String chemicalFormula, MaterialIconSet materialIconSet, ImmutableList<MaterialStack> materialComponents, ImmutableList<Material> oreReRegistrations, ImmutableList<SubTag> subTags, int materialGenerationFlags, float densityMultiplier, Element element, int mOreValue, int oreMultiplier, int mByProductMultiplier, int mSmeltingMultiplier, AbstractSolidMaterial directSmelting, AbstractSolidMaterial smeltInto, AbstractSolidMaterial arcSmeltInto) {
|
||||
super(defaultLocalName, materialRGB, chemicalFormula, materialIconSet, materialComponents, oreReRegistrations, subTags, materialGenerationFlags, densityMultiplier, element);
|
||||
/**
|
||||
* Material in which this material's ore should be washed to give additional output
|
||||
* Can be null
|
||||
*/
|
||||
public final FluidMaterial washedIn;
|
||||
|
||||
/**
|
||||
* During electromagnetic separation, this material ore will be separated onto this material and material specified by this field
|
||||
* Can be null
|
||||
*/
|
||||
public final DustMaterial separatedOnto;
|
||||
|
||||
public DustMaterial(String defaultLocalName, int materialRGB, MaterialIconSet materialIconSet, ImmutableList<MaterialStack> materialComponents, ImmutableList<Material> oreReRegistrations, ImmutableList<SubTag> subTags, int materialGenerationFlags, float densityMultiplier, Element element, int mOreValue, ImmutableList<DustMaterial> oreByProducts, int oreMultiplier, int mByProductMultiplier, int mSmeltingMultiplier, AbstractSolidMaterial directSmelting, AbstractSolidMaterial smeltInto, AbstractSolidMaterial arcSmeltInto, FluidMaterial washedIn, DustMaterial separatedOnto) {
|
||||
super(defaultLocalName, materialRGB, materialIconSet, materialComponents, oreReRegistrations, subTags, materialGenerationFlags, densityMultiplier, element);
|
||||
this.mOreValue = mOreValue;
|
||||
this.oreByProducts = oreByProducts;
|
||||
this.oreMultiplier = oreMultiplier;
|
||||
this.mByProductMultiplier = mByProductMultiplier;
|
||||
this.mSmeltingMultiplier = mSmeltingMultiplier;
|
||||
this.directSmelting = directSmelting;
|
||||
this.smeltInto = smeltInto;
|
||||
this.arcSmeltInto = arcSmeltInto;
|
||||
this.washedIn = washedIn;
|
||||
this.separatedOnto = separatedOnto;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package gregtech.api.enums.material.types;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import gregtech.api.enums.Element;
|
||||
import gregtech.api.enums.SubTag;
|
||||
import gregtech.api.enums.material.Material;
|
||||
|
@ -10,13 +9,15 @@ import gregtech.api.objects.MaterialStack;
|
|||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public class FluidMaterial extends Material implements gregtech.api.enums.material.FluidMaterial {
|
||||
import java.util.List;
|
||||
|
||||
public class FluidMaterialType extends Material implements gregtech.api.enums.material.FluidMaterial {
|
||||
|
||||
private Fluid materialFluid;
|
||||
private Fluid materialPlasma;
|
||||
|
||||
public FluidMaterial(String defaultLocalName, int materialRGB, String chemicalFormula, MaterialIconSet materialIconSet, ImmutableList<MaterialStack> materialComponents, ImmutableList<Material> oreReRegistrations, ImmutableList<SubTag> subTags, int materialGenerationFlags, float densityMultiplier, Element element) {
|
||||
super(defaultLocalName, materialRGB, chemicalFormula, materialIconSet, materialComponents, oreReRegistrations, subTags, materialGenerationFlags, densityMultiplier, element);
|
||||
public FluidMaterialType(String defaultLocalName, int materialRGB, MaterialIconSet materialIconSet, List<MaterialStack> materialComponents, List<Material> oreReRegistrations, List<SubTag> subTags, int materialGenerationFlags, float densityMultiplier, Element element) {
|
||||
super(defaultLocalName, materialRGB, materialIconSet, materialComponents, oreReRegistrations, subTags, materialGenerationFlags, densityMultiplier, element);
|
||||
}
|
||||
|
||||
/**
|
|
@ -8,10 +8,17 @@ import gregtech.api.enums.material.MaterialIconSet;
|
|||
import gregtech.api.objects.MaterialStack;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
|
||||
import static gregtech.api.enums.SubTag.getNewSubTag;
|
||||
|
||||
public class GemMaterial extends AbstractSolidMaterial {
|
||||
|
||||
public GemMaterial(String defaultLocalName, int materialRGB, String chemicalFormula, MaterialIconSet materialIconSet, ImmutableList<MaterialStack> materialComponents, ImmutableList<Material> oreReRegistrations, ImmutableList<SubTag> subTags, int materialGenerationFlags, float densityMultiplier, Element element, int mOreValue, int oreMultiplier, int mByProductMultiplier, int mSmeltingMultiplier, AbstractSolidMaterial directSmelting, AbstractSolidMaterial smeltInto, AbstractSolidMaterial arcSmeltInto, float toolSpeed, byte toolQuality, int toolDurability, Enchantment toolEnchantment, int toolEnchantmentLevel, int blastFurnaceTemp, AbstractSolidMaterial handleMaterial, DustMaterial macerateInto) {
|
||||
super(defaultLocalName, materialRGB, chemicalFormula, materialIconSet, materialComponents, oreReRegistrations, subTags, materialGenerationFlags, densityMultiplier, element, mOreValue, oreMultiplier, mByProductMultiplier, mSmeltingMultiplier, directSmelting, smeltInto, arcSmeltInto, toolSpeed, toolQuality, toolDurability, toolEnchantment, toolEnchantmentLevel, blastFurnaceTemp, handleMaterial, macerateInto);
|
||||
/**
|
||||
* If this Material is Crystallisable
|
||||
*/
|
||||
public static final SubTag CRYSTALLISABLE = getNewSubTag("CRYSTALLISABLE");
|
||||
|
||||
public GemMaterial(String defaultLocalName, int materialRGB, MaterialIconSet materialIconSet, ImmutableList<MaterialStack> materialComponents, ImmutableList<Material> oreReRegistrations, ImmutableList<SubTag> subTags, int materialGenerationFlags, float densityMultiplier, Element element, int mOreValue, int oreMultiplier, int mByProductMultiplier, int mSmeltingMultiplier, AbstractSolidMaterial directSmelting, AbstractSolidMaterial smeltInto, AbstractSolidMaterial arcSmeltInto, float toolSpeed, byte toolQuality, int toolDurability, Enchantment toolEnchantment, int toolEnchantmentLevel, int blastFurnaceTemp, AbstractSolidMaterial handleMaterial, DustMaterial macerateInto) {
|
||||
super(defaultLocalName, materialRGB, materialIconSet, materialComponents, oreReRegistrations, subTags, materialGenerationFlags, densityMultiplier, element, mOreValue, oreMultiplier, mByProductMultiplier, mSmeltingMultiplier, directSmelting, smeltInto, arcSmeltInto, toolSpeed, toolQuality, toolDurability, toolEnchantment, toolEnchantmentLevel, blastFurnaceTemp, handleMaterial, macerateInto);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,11 +7,15 @@ import gregtech.api.enums.material.Material;
|
|||
import gregtech.api.enums.material.MaterialIconSet;
|
||||
import gregtech.api.objects.MaterialStack;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MetalMaterial extends AbstractSolidMaterial {
|
||||
|
||||
public MetalMaterial(String defaultLocalName, int materialRGB, String chemicalFormula, MaterialIconSet materialIconSet, ImmutableList<MaterialStack> materialComponents, ImmutableList<Material> oreReRegistrations, ImmutableList<SubTag> subTags, int materialGenerationFlags, float densityMultiplier, Element element, int mOreValue, int oreMultiplier, int mByProductMultiplier, int mSmeltingMultiplier, AbstractSolidMaterial directSmelting, AbstractSolidMaterial smeltInto, AbstractSolidMaterial arcSmeltInto, float toolSpeed, byte toolQuality, int toolDurability, Enchantment toolEnchantment, int toolEnchantmentLevel, int blastFurnaceTemp, AbstractSolidMaterial handleMaterial, DustMaterial macerateInto) {
|
||||
super(defaultLocalName, materialRGB, chemicalFormula, materialIconSet, materialComponents, oreReRegistrations, subTags, materialGenerationFlags, densityMultiplier, element, mOreValue, oreMultiplier, mByProductMultiplier, mSmeltingMultiplier, directSmelting, smeltInto, arcSmeltInto, toolSpeed, toolQuality, toolDurability, toolEnchantment, toolEnchantmentLevel, blastFurnaceTemp, handleMaterial, macerateInto);
|
||||
public MetalMaterial(String defaultLocalName, int materialRGB, MaterialIconSet materialIconSet, List<MaterialStack> materialComponents, List<Material> oreReRegistrations, List<SubTag> subTags, int materialGenerationFlags, float densityMultiplier, Element element, int mOreValue, int oreMultiplier, int mByProductMultiplier, int mSmeltingMultiplier, AbstractSolidMaterial directSmelting, AbstractSolidMaterial smeltInto, AbstractSolidMaterial arcSmeltInto, float toolSpeed, byte toolQuality, int toolDurability, Enchantment toolEnchantment, int toolEnchantmentLevel, int blastFurnaceTemp, AbstractSolidMaterial handleMaterial, DustMaterial macerateInto) {
|
||||
super(defaultLocalName, materialRGB, materialIconSet, materialComponents, oreReRegistrations, subTags, materialGenerationFlags, densityMultiplier, element, mOreValue, oreMultiplier, mByProductMultiplier, mSmeltingMultiplier, directSmelting, smeltInto, arcSmeltInto, toolSpeed, toolQuality, toolDurability, toolEnchantment, toolEnchantmentLevel, blastFurnaceTemp, handleMaterial, macerateInto);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue