Refactored MaterialAdapter to MaterialBuilder to better represent the
class functionality.
This commit is contained in:
parent
9906c39720
commit
72c55d5726
2 changed files with 49 additions and 49 deletions
|
@ -6,7 +6,7 @@ import java.util.List;
|
|||
|
||||
import gregtech.api.objects.MaterialStack;
|
||||
|
||||
public class MaterialAdapter {
|
||||
public class MaterialBuilder {
|
||||
public static final int DIESEL = 0, GAS = 1, THERMAL = 2, SEMIFLUID = 3, PLASMA = 4, MAGIC = 5;
|
||||
|
||||
private int metaItemSubID;
|
||||
|
@ -32,7 +32,7 @@ public class MaterialAdapter {
|
|||
private List<MaterialStack> materialList = new ArrayList<MaterialStack>();
|
||||
private List<TC_Aspects.TC_AspectStack> aspects = new ArrayList<TC_Aspects.TC_AspectStack>();
|
||||
|
||||
public MaterialAdapter(int metaItemSubID, TextureSet iconSet, String defaultLocalName) {
|
||||
public MaterialBuilder(int metaItemSubID, TextureSet iconSet, String defaultLocalName) {
|
||||
this.metaItemSubID = metaItemSubID;
|
||||
this.iconSet = iconSet;
|
||||
this.name = defaultLocalName.replace(" ", "");
|
||||
|
@ -44,68 +44,68 @@ public class MaterialAdapter {
|
|||
blastFurnaceRequired, transparent, oreValue, densityMultiplier, densityDivider, color, extraData, materialList, aspects);
|
||||
}
|
||||
|
||||
public MaterialAdapter setName(String name){
|
||||
public MaterialBuilder setName(String name){
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MaterialAdapter setTypes(int types){
|
||||
public MaterialBuilder setTypes(int types){
|
||||
this.types = types;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MaterialAdapter addDustItems(){
|
||||
public MaterialBuilder addDustItems(){
|
||||
types = types | 1;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MaterialAdapter addMetalItems(){
|
||||
public MaterialBuilder addMetalItems(){
|
||||
types = types | 2;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MaterialAdapter addGemItems(){
|
||||
public MaterialBuilder addGemItems(){
|
||||
types = types | 4;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MaterialAdapter addOreItems(){
|
||||
public MaterialBuilder addOreItems(){
|
||||
types = types | 8;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MaterialAdapter addCell(){
|
||||
public MaterialBuilder addCell(){
|
||||
types = types | 16;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MaterialAdapter addPlasma(){
|
||||
public MaterialBuilder addPlasma(){
|
||||
types = types | 32;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MaterialAdapter addToolHeadItems(){
|
||||
public MaterialBuilder addToolHeadItems(){
|
||||
types = types | 64;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MaterialAdapter addGearItems(){
|
||||
public MaterialBuilder addGearItems(){
|
||||
types = types | 128;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MaterialAdapter addFluid(){
|
||||
public MaterialBuilder addFluid(){
|
||||
types = types | 256;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MaterialAdapter addGas(){
|
||||
public MaterialBuilder addGas(){
|
||||
types = types | 512;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public MaterialAdapter setRGBA(int r, int g, int b, int a){
|
||||
public MaterialBuilder setRGBA(int r, int g, int b, int a){
|
||||
this.r = r;
|
||||
this.g = g;
|
||||
this.b = b;
|
||||
|
@ -113,106 +113,106 @@ public class MaterialAdapter {
|
|||
return this;
|
||||
}
|
||||
|
||||
public MaterialAdapter setRGB(int r, int g, int b){
|
||||
public MaterialBuilder setRGB(int r, int g, int b){
|
||||
this.r = r;
|
||||
this.g = g;
|
||||
this.b = b;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MaterialAdapter setTransparent(boolean transparent){
|
||||
public MaterialBuilder setTransparent(boolean transparent){
|
||||
this.transparent = transparent;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MaterialAdapter setColor(Dyes color){
|
||||
public MaterialBuilder setColor(Dyes color){
|
||||
this.color = color;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public MaterialAdapter setToolSpeed(float toolSpeed) {
|
||||
public MaterialBuilder setToolSpeed(float toolSpeed) {
|
||||
this.toolSpeed = toolSpeed;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MaterialAdapter setDurability(int durability) {
|
||||
public MaterialBuilder setDurability(int durability) {
|
||||
this.durability = durability;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MaterialAdapter setToolQuality(int toolQuality) {
|
||||
public MaterialBuilder setToolQuality(int toolQuality) {
|
||||
this.toolQuality = toolQuality;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public MaterialAdapter setFuelType(int fuelType) {
|
||||
public MaterialBuilder setFuelType(int fuelType) {
|
||||
this.fuelType = fuelType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MaterialAdapter setFuelPower(int fuelPower) {
|
||||
public MaterialBuilder setFuelPower(int fuelPower) {
|
||||
this.fuelPower = fuelPower;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MaterialAdapter setMeltingPoint(int meltingPoint) {
|
||||
public MaterialBuilder setMeltingPoint(int meltingPoint) {
|
||||
this.meltingPoint = meltingPoint;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MaterialAdapter setBlastFurnaceTemp(int blastFurnaceTemp) {
|
||||
public MaterialBuilder setBlastFurnaceTemp(int blastFurnaceTemp) {
|
||||
this.blastFurnaceTemp = blastFurnaceTemp;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MaterialAdapter setBlastFurnaceRequired(boolean blastFurnaceRequired) {
|
||||
public MaterialBuilder setBlastFurnaceRequired(boolean blastFurnaceRequired) {
|
||||
this.blastFurnaceRequired = blastFurnaceRequired;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MaterialAdapter setOreValue(int oreValue) {
|
||||
public MaterialBuilder setOreValue(int oreValue) {
|
||||
this.oreValue = oreValue;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MaterialAdapter setDensityMultiplier(int densityMultiplier) {
|
||||
public MaterialBuilder setDensityMultiplier(int densityMultiplier) {
|
||||
this.densityMultiplier = densityMultiplier;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MaterialAdapter setDensityDivider(int densityDivider) {
|
||||
public MaterialBuilder setDensityDivider(int densityDivider) {
|
||||
this.densityDivider = densityDivider;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MaterialAdapter setExtraData(int extraData) {
|
||||
public MaterialBuilder setExtraData(int extraData) {
|
||||
this.extraData = extraData;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MaterialAdapter addElectrolyzerRecipe(){
|
||||
public MaterialBuilder addElectrolyzerRecipe(){
|
||||
extraData = extraData | 1;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MaterialAdapter addCentrifugeRecipe(){
|
||||
public MaterialBuilder addCentrifugeRecipe(){
|
||||
extraData = extraData | 2;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MaterialAdapter setMaterialList(List<MaterialStack> materialList) {
|
||||
public MaterialBuilder setMaterialList(List<MaterialStack> materialList) {
|
||||
this.materialList = materialList;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MaterialAdapter setMaterialList(MaterialStack ... materials) {
|
||||
public MaterialBuilder setMaterialList(MaterialStack ... materials) {
|
||||
this.materialList = Arrays.asList(materials);
|
||||
return this;
|
||||
}
|
||||
|
||||
public MaterialAdapter setAspects(List<TC_Aspects.TC_AspectStack> aspects) {
|
||||
public MaterialBuilder setAspects(List<TC_Aspects.TC_AspectStack> aspects) {
|
||||
this.aspects = aspects;
|
||||
return this;
|
||||
}
|
|
@ -381,7 +381,7 @@ public class Materials implements IColorModulationContainer, ISubTagContainer {
|
|||
public static Materials Coffee = new Materials(888, TextureSet.SET_FINE, 1.0F, 0, 0, 1, 150, 75, 0, 0, "Coffee", "Coffee", 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeBrown);
|
||||
public static Materials Creosote = new Materials(712, TextureSet.SET_FLUID, 1.0F, 0, 0, 16, 128, 64, 0, 0, "Creosote", "Creosote", 3, 8, -1, 0, false, false, 1, 1, 1, Dyes.dyeBrown);
|
||||
public static Materials Ethanol = new Materials(706, TextureSet.SET_FLUID, 1.0F, 0, 0, 16, 255, 128, 0, 0, "Ethanol", "Ethanol", 0, 128, -1, 0, false, false, 1, 1, 1, Dyes.dyePurple);
|
||||
public static Materials FermentedBiomass = new MaterialAdapter(691, TextureSet.SET_FLUID, "Fermented Biomass").addCell().addFluid().setRGB(68, 85, 0).setColor(Dyes.dyeBrown).constructMaterial();
|
||||
public static Materials FermentedBiomass = new MaterialBuilder(691, TextureSet.SET_FLUID, "Fermented Biomass").addCell().addFluid().setRGB(68, 85, 0).setColor(Dyes.dyeBrown).constructMaterial();
|
||||
public static Materials FishOil = new Materials(711, TextureSet.SET_FLUID, 1.0F, 0, 0, 16, 255, 196, 0, 0, "FishOil", "Fish Oil", 3, 2, -1, 0, false, false, 1, 1, 1, Dyes.dyeYellow, Arrays.asList(new TC_Aspects.TC_AspectStack(TC_Aspects.CORPUS, 2)));
|
||||
public static Materials Fuel = new Materials(708, TextureSet.SET_FLUID, 1.0F, 0, 0, 16, 255, 255, 0, 0, "Fuel", "Diesel", 0, 128, -1, 0, false, false, 1, 1, 1, Dyes.dyeYellow);
|
||||
public static Materials Glue = new Materials(726, TextureSet.SET_FLUID, 1.0F, 0, 0, 16, 200, 196, 0, 0, "Glue", "Glue", 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeOrange, Arrays.asList(new TC_Aspects.TC_AspectStack(TC_Aspects.LIMUS, 2)));
|
||||
|
@ -410,7 +410,7 @@ public class Materials implements IColorModulationContainer, ISubTagContainer {
|
|||
public static Materials TNT = new Materials(-1, TextureSet.SET_NONE, 1.0F, 0, 0, 0, 255, 255, 255, 0, "TNT", "TNT", 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeRed, Arrays.asList(new TC_Aspects.TC_AspectStack(TC_Aspects.PERDITIO, 7), new TC_AspectStack(TC_Aspects.IGNIS, 4)));
|
||||
public static Materials Unstable = new Materials(-1, TextureSet.SET_NONE, 1.0F, 0, 4, 0, 255, 255, 255, 127, "Unstable", "Unstable", 0, 0, -1, 0, false, true, 1, 1, 1, Dyes.dyeWhite, Arrays.asList(new TC_Aspects.TC_AspectStack(TC_Aspects.PERDITIO, 4)));
|
||||
public static Materials Unstableingot = new Materials(-1, TextureSet.SET_NONE, 1.0F, 0, 4, 0, 255, 255, 255, 127, "Unstableingot", "Unstable", 0, 0, -1, 0, false, true, 1, 1, 1, Dyes.dyeWhite, Arrays.asList(new TC_Aspects.TC_AspectStack(TC_Aspects.PERDITIO, 4)));
|
||||
public static Materials Vinegar = new MaterialAdapter(690, TextureSet.SET_FLUID, "Vinegar").setColor(Dyes.dyeBrown).constructMaterial();
|
||||
public static Materials Vinegar = new MaterialBuilder(690, TextureSet.SET_FLUID, "Vinegar").setColor(Dyes.dyeBrown).constructMaterial();
|
||||
public static Materials Wheat = new Materials(881, TextureSet.SET_POWDER, 1.0F, 0, 0, 1, 255, 255, 196, 0, "Wheat", "Wheat", 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeYellow, Arrays.asList(new TC_Aspects.TC_AspectStack(TC_Aspects.MESSIS, 2)));
|
||||
|
||||
/**
|
||||
|
@ -535,18 +535,18 @@ public class Materials implements IColorModulationContainer, ISubTagContainer {
|
|||
public static Materials CrackedLightFuel = new Materials(743, TextureSet.SET_FLUID, 1.0F, 0, 0, 16, 255, 255, 0, 0, "CrackedLightFuel", "Cracked Light Fuel", 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeYellow);
|
||||
public static Materials CrackedHeavyFuel = new Materials(744, TextureSet.SET_FLUID, 1.0F, 0, 0, 16, 255, 255, 0, 0, "CrackedHeavyFuel", "Cracked Heavy Fuel", 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeBlack);
|
||||
|
||||
public static Materials AceticAcid = new MaterialAdapter(670, TextureSet.SET_FLUID, "Acetic Acid").addCell().addFluid().setRGB(200, 180, 160).setColor(Dyes.dyeWhite).setMaterialList(new MaterialStack(Carbon, 2), new MaterialStack(Hydrogen, 4), new MaterialStack(Oxygen, 2)).addElectrolyzerRecipe().constructMaterial();
|
||||
public static Materials CalciumAcetate = new MaterialAdapter(671, TextureSet.SET_RUBY, "Calcium Acetate").addDustItems().addCell().setRGB(255, 255, 255).setColor(Dyes.dyeWhite).setMaterialList(new MaterialStack(Calcium, 1), new MaterialStack(AceticAcid, 2)).addElectrolyzerRecipe().constructMaterial();
|
||||
public static Materials Acetone = new MaterialAdapter(672, TextureSet.SET_FLUID, "Acetone").addCell().addFluid().setRGB(175, 175, 175).setColor(Dyes.dyeWhite).setMaterialList(new MaterialStack(Carbon, 3), new MaterialStack(Hydrogen, 6), new MaterialStack(Oxygen, 1)).addElectrolyzerRecipe().constructMaterial();
|
||||
public static Materials Methanol = new MaterialAdapter(673, TextureSet.SET_FLUID, "Methanol").addCell().addFluid().setRGB(170, 136, 0).setColor(Dyes.dyeBrown).setFuelPower(96).setMaterialList(new MaterialStack(Carbon, 1), new MaterialStack(Hydrogen, 4), new MaterialStack(Oxygen, 1)).addElectrolyzerRecipe().constructMaterial();
|
||||
public static Materials CarbonMonoxide = new MaterialAdapter(674, TextureSet.SET_FLUID, "Carbon Monoxide").addCell().addGas().setRGB(14, 72, 128).setColor(Dyes.dyeBrown).setFuelType(MaterialAdapter.GAS).setFuelPower(8).setMaterialList(new MaterialStack(Carbon, 1), new MaterialStack(Oxygen, 1)).addElectrolyzerRecipe().constructMaterial();
|
||||
public static Materials CharcoalByproducts = new MaterialAdapter(675, TextureSet.SET_FLUID, "Charcoal Byproducts").addCell().setRGB(40, 23, 11).setColor(Dyes.dyeBrown).constructMaterial();
|
||||
public static Materials SulfuricEthylene = new MaterialAdapter(676, TextureSet.SET_FLUID, "Sulfuric Ethylene").addCell().addGas().setRGB(225, 225, 225).setColor(Dyes.dyeWhite).setFuelType(MaterialAdapter.GAS).setFuelPower(18).constructMaterial();
|
||||
public static Materials Ethylene = new MaterialAdapter(677, TextureSet.SET_FLUID, "Ethylene").addCell().addGas().setRGB(225, 225, 225).setColor(Dyes.dyeWhite).setFuelType(MaterialAdapter.GAS).setFuelPower(288).constructMaterial();
|
||||
public static Materials Propene = new MaterialAdapter(678, TextureSet.SET_FLUID, "Propene").addCell().addGas().setRGB(255, 221, 85).setColor(Dyes.dyeYellow).setFuelType(MaterialAdapter.GAS).setFuelPower(144).constructMaterial();
|
||||
public static Materials VinylAcetate = new MaterialAdapter(679, TextureSet.SET_FLUID, "Vinyl Acetate").addCell().addFluid().setRGB(255, 179, 128).setColor(Dyes.dyeOrange).constructMaterial();
|
||||
public static Materials PolyvinylAcetate = new MaterialAdapter(680, TextureSet.SET_FLUID, "Polyvinyl Acetate").addCell().addFluid().setRGB(255, 153, 85).setColor(Dyes.dyeOrange).constructMaterial();
|
||||
public static Materials MethylAcetate = new MaterialAdapter(681, TextureSet.SET_FLUID, "Methyl Acetate").addCell().addFluid().setRGB(238, 198, 175).setColor(Dyes.dyeOrange).constructMaterial();
|
||||
public static Materials AceticAcid = new MaterialBuilder(670, TextureSet.SET_FLUID, "Acetic Acid").addCell().addFluid().setRGB(200, 180, 160).setColor(Dyes.dyeWhite).setMaterialList(new MaterialStack(Carbon, 2), new MaterialStack(Hydrogen, 4), new MaterialStack(Oxygen, 2)).addElectrolyzerRecipe().constructMaterial();
|
||||
public static Materials CalciumAcetate = new MaterialBuilder(671, TextureSet.SET_RUBY, "Calcium Acetate").addDustItems().addCell().setRGB(255, 255, 255).setColor(Dyes.dyeWhite).setMaterialList(new MaterialStack(Calcium, 1), new MaterialStack(AceticAcid, 2)).addElectrolyzerRecipe().constructMaterial();
|
||||
public static Materials Acetone = new MaterialBuilder(672, TextureSet.SET_FLUID, "Acetone").addCell().addFluid().setRGB(175, 175, 175).setColor(Dyes.dyeWhite).setMaterialList(new MaterialStack(Carbon, 3), new MaterialStack(Hydrogen, 6), new MaterialStack(Oxygen, 1)).addElectrolyzerRecipe().constructMaterial();
|
||||
public static Materials Methanol = new MaterialBuilder(673, TextureSet.SET_FLUID, "Methanol").addCell().addFluid().setRGB(170, 136, 0).setColor(Dyes.dyeBrown).setFuelPower(96).setMaterialList(new MaterialStack(Carbon, 1), new MaterialStack(Hydrogen, 4), new MaterialStack(Oxygen, 1)).addElectrolyzerRecipe().constructMaterial();
|
||||
public static Materials CarbonMonoxide = new MaterialBuilder(674, TextureSet.SET_FLUID, "Carbon Monoxide").addCell().addGas().setRGB(14, 72, 128).setColor(Dyes.dyeBrown).setFuelType(MaterialBuilder.GAS).setFuelPower(8).setMaterialList(new MaterialStack(Carbon, 1), new MaterialStack(Oxygen, 1)).addElectrolyzerRecipe().constructMaterial();
|
||||
public static Materials CharcoalByproducts = new MaterialBuilder(675, TextureSet.SET_FLUID, "Charcoal Byproducts").addCell().setRGB(40, 23, 11).setColor(Dyes.dyeBrown).constructMaterial();
|
||||
public static Materials SulfuricEthylene = new MaterialBuilder(676, TextureSet.SET_FLUID, "Sulfuric Ethylene").addCell().addGas().setRGB(225, 225, 225).setColor(Dyes.dyeWhite).setFuelType(MaterialBuilder.GAS).setFuelPower(18).constructMaterial();
|
||||
public static Materials Ethylene = new MaterialBuilder(677, TextureSet.SET_FLUID, "Ethylene").addCell().addGas().setRGB(225, 225, 225).setColor(Dyes.dyeWhite).setFuelType(MaterialBuilder.GAS).setFuelPower(288).constructMaterial();
|
||||
public static Materials Propene = new MaterialBuilder(678, TextureSet.SET_FLUID, "Propene").addCell().addGas().setRGB(255, 221, 85).setColor(Dyes.dyeYellow).setFuelType(MaterialBuilder.GAS).setFuelPower(144).constructMaterial();
|
||||
public static Materials VinylAcetate = new MaterialBuilder(679, TextureSet.SET_FLUID, "Vinyl Acetate").addCell().addFluid().setRGB(255, 179, 128).setColor(Dyes.dyeOrange).constructMaterial();
|
||||
public static Materials PolyvinylAcetate = new MaterialBuilder(680, TextureSet.SET_FLUID, "Polyvinyl Acetate").addCell().addFluid().setRGB(255, 153, 85).setColor(Dyes.dyeOrange).constructMaterial();
|
||||
public static Materials MethylAcetate = new MaterialBuilder(681, TextureSet.SET_FLUID, "Methyl Acetate").addCell().addFluid().setRGB(238, 198, 175).setColor(Dyes.dyeOrange).constructMaterial();
|
||||
|
||||
public static Materials SolderingAlloy = new Materials(314, TextureSet.SET_DULL, 1.0F, 0, 1, 1|2, 220, 220, 230, 0, "SolderingAlloy", "Soldering Alloy", 0, 0, 400, 400, false, false, 1, 1, 1, Dyes.dyeWhite, 2, Arrays.asList(new MaterialStack(Tin, 9), new MaterialStack(Antimony, 1)));
|
||||
public static Materials GalliumArsenide = new Materials(980, TextureSet.SET_DULL, 1.0F, 0, 1, 1|2, 160, 160, 160, 0, "GalliumArsenide", "Gallium Arsenide", 0, 0, -1, 1200, true, false, 1, 1, 1, Dyes.dyeGray, 2, Arrays.asList(new MaterialStack(Arsenic, 1), new MaterialStack(Gallium, 1)));
|
||||
|
|
Loading…
Reference in a new issue