Find a better way to handle those dusts

This commit is contained in:
Antifluxfield 2017-08-02 16:04:25 +08:00
parent 1fff7f2aa4
commit a1f0a213c4

View file

@ -9,6 +9,7 @@ import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.interfaces.internal.IGT_RecipeAdder;
import gregtech.api.objects.GT_FluidStack;
import gregtech.api.objects.ItemData;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Recipe;
@ -582,8 +583,13 @@ public class GT_RecipeAdder
aInput = new FluidStack(aInput.getFluid(), (aInput.amount + tScale - 1) / tScale);
aOutput = new FluidStack(aOutput.getFluid(), aOutput.amount / tScale);
if (aSolidOutput != null) {
if (aSolidOutput.stackSize / tScale == 0) aSolidOutput = GT_Values.NI;
else aSolidOutput = new ItemStack(aSolidOutput.getItem(), aSolidOutput.stackSize / tScale);
ItemData tData = GT_OreDictUnificator.getItemData(aSolidOutput);
if (tData != null && (tData.mPrefix == OrePrefixes.dust || OrePrefixes.dust.mFamiliarPrefixes.contains(tData.mPrefix)))
aSolidOutput = GT_OreDictUnificator.getDust(tData.mMaterial.mMaterial, tData.mMaterial.mAmount * aSolidOutput.stackSize / tScale);
else {
if (aSolidOutput.stackSize / tScale == 0) aSolidOutput = GT_Values.NI;
else aSolidOutput = new ItemStack(aSolidOutput.getItem(), aSolidOutput.stackSize / tScale);
}
}
aDuration = (aDuration + tScale - 1) / tScale;
}