Implemented NBT for the Locked Fluid
This commit is contained in:
parent
cbcb04d117
commit
a63730107b
2 changed files with 22 additions and 10 deletions
|
@ -98,12 +98,15 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch {
|
|||
public void saveNBTData(NBTTagCompound aNBT) {
|
||||
super.saveNBTData(aNBT);
|
||||
aNBT.setByte("mMode", mMode);
|
||||
aNBT.setString("lockedFluidName", lockedFluidName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadNBTData(NBTTagCompound aNBT) {
|
||||
super.loadNBTData(aNBT);
|
||||
mMode = aNBT.getByte("mMode");
|
||||
lockedFluidName = aNBT.getString("lockedFluidName");
|
||||
lockedFluidName = lockedFluidName.length() == 0 ? null : lockedFluidName;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -160,6 +163,7 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch {
|
|||
} else {
|
||||
mMode = (byte) ((mMode + 1) % 10);
|
||||
}
|
||||
String inBrackets;
|
||||
switch (mMode) {
|
||||
case 0:
|
||||
GT_Utility.sendChatToPlayer(aPlayer, trans("108","Outputs misc. Fluids, Steam and Items"));
|
||||
|
@ -186,15 +190,22 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch {
|
|||
GT_Utility.sendChatToPlayer(aPlayer, trans("115","Outputs nothing"));
|
||||
break;
|
||||
case 8:
|
||||
this.setLockedFluidName(this.getDrainableStack().getUnlocalizedName());
|
||||
GT_Utility.sendChatToPlayer(aPlayer, trans("115.1", String.format("Outputs items and 1 specific Fluid (%s)", mFluid == null ?
|
||||
trans("115.3","currently none, will be locked to the next that is put in"):
|
||||
mFluid.getLocalizedName())));
|
||||
if (mFluid == null) {
|
||||
inBrackets = trans("115.3","currently none, will be locked to the next that is put in");
|
||||
} else {
|
||||
this.setLockedFluidName(this.getDrainableStack().getUnlocalizedName());
|
||||
inBrackets = this.getDrainableStack().getLocalizedName();
|
||||
}
|
||||
GT_Utility.sendChatToPlayer(aPlayer, String.format("%s (%s)", trans("151.1", "Outputs items and 1 specific Fluid"), inBrackets));
|
||||
break;
|
||||
case 9:
|
||||
GT_Utility.sendChatToPlayer(aPlayer, trans("115.2", String.format("Outputs 1 specific Fluid (%s)", mFluid == null ?
|
||||
trans("115.3","currently none, will be locked to the next that is put in"):
|
||||
mFluid.getLocalizedName())));
|
||||
if (mFluid == null) {
|
||||
inBrackets = trans("115.3","currently none, will be locked to the next that is put in");
|
||||
} else {
|
||||
this.setLockedFluidName(this.getDrainableStack().getUnlocalizedName());
|
||||
inBrackets = this.getDrainableStack().getLocalizedName();
|
||||
}
|
||||
GT_Utility.sendChatToPlayer(aPlayer, String.format("%s (%s)", trans("151.2", "Outputs 1 specific Fluid"), inBrackets));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -545,7 +545,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
|
|||
if (!tHatch.outputsLiquids()) {
|
||||
continue;
|
||||
}
|
||||
if (tHatch.isFluidLocked() && tHatch.getLockedFluidName() != null && tHatch.getLockedFluidName() != copiedFluidStack.getUnlocalizedName()) {
|
||||
if (tHatch.isFluidLocked() && tHatch.getLockedFluidName() != null && !tHatch.getLockedFluidName().equals(copiedFluidStack.getUnlocalizedName())) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -564,8 +564,9 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
|
|||
public boolean addOutput(FluidStack aLiquid) {
|
||||
if (aLiquid == null) return false;
|
||||
FluidStack copiedFluidStack = aLiquid.copy();
|
||||
dumpFluid(copiedFluidStack, true);
|
||||
dumpFluid(copiedFluidStack, false);
|
||||
if (!dumpFluid(copiedFluidStack, true)){
|
||||
dumpFluid(copiedFluidStack, false);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue