Fixed a sneaky and game-breaking bug that caused quite a lot of fluids
to no longer have recipes for filling cells. The reason for the bug was that the bit flag 256 is already in use to designate something as empty. Since only bit flags up to 128 were documented I had unwittingly used the 256 bit flag for fluid creation. The documentation now informs about the function of 256. Automatic fluid and gas creation are now controlled via booleans. Big thanks to Techlone for helping me debug.
This commit is contained in:
parent
bf414f1c99
commit
17bf0dd960
3 changed files with 33 additions and 8 deletions
|
@ -31,6 +31,8 @@ public class MaterialBuilder {
|
|||
private int extraData = 0;
|
||||
private List<MaterialStack> materialList = new ArrayList<MaterialStack>();
|
||||
private List<TC_Aspects.TC_AspectStack> aspects = new ArrayList<TC_Aspects.TC_AspectStack>();
|
||||
private boolean hasCorrespondingFluid = false;
|
||||
private boolean hasCorrespondingGas = false;
|
||||
|
||||
public MaterialBuilder(int metaItemSubID, TextureSet iconSet, String defaultLocalName) {
|
||||
this.metaItemSubID = metaItemSubID;
|
||||
|
@ -41,7 +43,9 @@ public class MaterialBuilder {
|
|||
|
||||
public Materials constructMaterial() {
|
||||
return new Materials(metaItemSubID, iconSet, toolSpeed, durability, toolQuality, types, r, g, b, a, name, defaultLocalName, fuelType, fuelPower, meltingPoint, blastFurnaceTemp,
|
||||
blastFurnaceRequired, transparent, oreValue, densityMultiplier, densityDivider, color, extraData, materialList, aspects);
|
||||
blastFurnaceRequired, transparent, oreValue, densityMultiplier, densityDivider, color, extraData, materialList, aspects)
|
||||
.setHasCorrespondingFluid(hasCorrespondingFluid)
|
||||
.setHasCorrespondingGas(hasCorrespondingGas);
|
||||
}
|
||||
|
||||
public MaterialBuilder setName(String name){
|
||||
|
@ -95,12 +99,12 @@ public class MaterialBuilder {
|
|||
}
|
||||
|
||||
public MaterialBuilder addFluid(){
|
||||
types = types | 256;
|
||||
this.hasCorrespondingFluid = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MaterialBuilder addGas(){
|
||||
types = types | 512;
|
||||
this.hasCorrespondingGas = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -786,6 +786,8 @@ public class Materials implements IColorModulationContainer, ISubTagContainer {
|
|||
public boolean mHasParentMod = true, mHasPlasma = false, mHasGas = false, mCustomOre = false;
|
||||
public Fluid mSolid = null, mFluid = null, mGas = null, mPlasma = null;
|
||||
|
||||
private boolean hasCorrespondingFluid = false, hasCorrespondingGas = false;
|
||||
|
||||
/**
|
||||
* This Fluid is used as standard Unit for Molten Materials. 1296 is a Molten Block, that means 144 is one Material Unit worth of fluid.
|
||||
*/
|
||||
|
@ -1534,8 +1536,7 @@ public class Materials implements IColorModulationContainer, ISubTagContainer {
|
|||
* 32 = Plasma Cells
|
||||
* 64 = Tool Heads
|
||||
* 128 = Gears
|
||||
* 256 = Automatically create a corresponding fluid for this material
|
||||
* 512 = Automatically create a corresponding gas for this material
|
||||
* 256 = Designates something as empty (only used for the Empty material)
|
||||
* @param aR, aG, aB Color of the Material 0-255 each.
|
||||
* @param aA transparency of the Material Texture. 0 = fully visible, 255 = Invisible.
|
||||
* @param aName The Name used as Default for localization.
|
||||
|
@ -1719,7 +1720,7 @@ public class Materials implements IColorModulationContainer, ISubTagContainer {
|
|||
}
|
||||
return mChemicalFormula;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds a Class implementing IMaterialRegistrator to the master list
|
||||
*/
|
||||
|
@ -1936,4 +1937,24 @@ public class Materials implements IColorModulationContainer, ISubTagContainer {
|
|||
public static Collection<Materials> getAll(){
|
||||
return MATERIALS_MAP.values();
|
||||
}
|
||||
|
||||
|
||||
public boolean hasCorrespondingFluid() {
|
||||
return hasCorrespondingFluid;
|
||||
}
|
||||
|
||||
|
||||
public Materials setHasCorrespondingFluid(boolean hasCorrespondingFluid) {
|
||||
this.hasCorrespondingFluid = hasCorrespondingFluid;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean hasCorrespondingGas() {
|
||||
return hasCorrespondingGas;
|
||||
}
|
||||
|
||||
public Materials setHasCorrespondingGas(boolean hasCorrespondingGas) {
|
||||
this.hasCorrespondingGas = hasCorrespondingGas;
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -494,10 +494,10 @@ public class GT_Loader_Item_Block_And_Fluid
|
|||
if (tMaterial.mElement != null) {
|
||||
GT_Mod.gregtechproxy.addAutogeneratedPlasmaFluid(tMaterial);
|
||||
}
|
||||
if ((tMaterial.mTypes & 256) != 0) {
|
||||
if (tMaterial.hasCorrespondingFluid()) {
|
||||
GT_Mod.gregtechproxy.addAutoGeneratedCorrespondingFluid(tMaterial);
|
||||
}
|
||||
if ((tMaterial.mTypes & 512) != 0) {
|
||||
if (tMaterial.hasCorrespondingGas()) {
|
||||
GT_Mod.gregtechproxy.addAutoGeneratedCorrespondingGas(tMaterial);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue