aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity')
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeTank.java418
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaCondensor.java301
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaEnergyBuffer.java563
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntityFluid.java563
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntity_Cable.java460
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntity_SuperConductor.java466
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaSafeBlock.java110
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaSuperConductorNodeBase.java614
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaPipeEntityBase_Cable.java559
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTileEntity.java85
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java1849
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechDoubleFuelGeneratorBase.java601
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechMetaBoilerBase.java625
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechMetaSolarGenerator.java376
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechRocketFuelGeneratorBase.java558
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/lossless/GregtechBaseMetaTileEntityLossless.java4189
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/lossless/GregtechMetaPipeEntity_BaseSuperConductor.java1312
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/lossless/GregtechMetaTileEntityLossless.java85
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/lossless/GregtechMetaTileEntityLosslessBasicTank.java494
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/lossless/GregtechMetaTileEntityLosslessTieredMachineBlock.java110
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/lossless/MetaTileEntityLossless.java1779
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/machines/GregtechMetaSafeBlockBase.java483
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/creative/GregtechMetaCreativeEnergyBuffer.java388
23 files changed, 7486 insertions, 9502 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeTank.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeTank.java
index 800f6cf875..2effc58f9a 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeTank.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_DeluxeTank.java
@@ -16,303 +16,207 @@ import net.minecraftforge.fluids.FluidStack;
/**
* NEVER INCLUDE THIS FILE IN YOUR MOD!!!
* <p/>
- * This is the main construct for my generic Tanks. Filling and emptying
- * behavior have to be implemented manually
+ * This is the main construct for my generic Tanks. Filling and emptying behavior have to be implemented manually
*/
public abstract class GT_MetaTileEntity_DeluxeTank extends GT_MetaTileEntity_BasicTank {
- public FluidStack mFluid;
- public FluidStack mFluid2;
+ public FluidStack mFluid;
+ public FluidStack mFluid2;
/**
- * @param aInvSlotCount
- * should be 3
+ * @param aInvSlotCount should be 3
*/
- public GT_MetaTileEntity_DeluxeTank(final int aID, final String aName, final String aNameRegional, final int aTier,
- final int aInvSlotCount, final String aDescription, final ITexture... aTextures) {
+ public GT_MetaTileEntity_DeluxeTank(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String aDescription, ITexture... aTextures) {
super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription, aTextures);
}
- public GT_MetaTileEntity_DeluxeTank(final String aName, final int aTier, final int aInvSlotCount,
- final String aDescription, final ITexture[][][] aTextures) {
+ public GT_MetaTileEntity_DeluxeTank(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) {
super(aName, aTier, aInvSlotCount, aDescription, aTextures);
}
@Override
- public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide,
- final ItemStack aStack) {
- return aIndex == this.getOutputSlot();
+ public boolean isSimpleMachine() {
+ return false;
}
@Override
- public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide,
- final ItemStack aStack) {
- return aIndex == this.getInputSlot();
+ public boolean isValidSlot(int aIndex) {
+ return aIndex != getStackDisplaySlot();
}
@Override
- public abstract boolean canTankBeEmptied();
-
- @Override
- public abstract boolean canTankBeFilled();
+ public void saveNBTData(NBTTagCompound aNBT) {
+ if (mFluid != null) aNBT.setTag("mFluid", mFluid.writeToNBT(new NBTTagCompound()));
+ if (mFluid2 != null) aNBT.setTag("mFluid2", mFluid2.writeToNBT(new NBTTagCompound()));
+ }
@Override
- public abstract boolean displaysItemStack();
+ public void loadNBTData(NBTTagCompound aNBT) {
+ mFluid = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid"));
+ mFluid2 = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid2"));
+ }
@Override
- public abstract boolean displaysStackSize();
+ public abstract boolean doesFillContainers();
@Override
public abstract boolean doesEmptyContainers();
@Override
- public abstract boolean doesFillContainers();
+ public abstract boolean canTankBeFilled();
@Override
- public FluidStack drain(final int maxDrain, final boolean doDrain) {
- if (this.getDrainableStack() == null || !this.canTankBeEmptied()) {
- return null;
- }
- if (this.getDrainableStack().amount <= 0 && this.isFluidChangingAllowed()) {
- this.setDrainableStack(null);
- this.getBaseMetaTileEntity().markDirty();
- return null;
- }
-
- int used = maxDrain;
- if (this.getDrainableStack().amount < used) {
- used = this.getDrainableStack().amount;
- }
-
- if (doDrain) {
- this.getDrainableStack().amount -= used;
- this.getBaseMetaTileEntity().markDirty();
- }
-
- final FluidStack drained = this.getDrainableStack().copy();
- drained.amount = used;
-
- if (this.getDrainableStack().amount <= 0 && this.isFluidChangingAllowed()) {
- this.setDrainableStack(null);
- this.getBaseMetaTileEntity().markDirty();
- }
-
- return drained;
- }
+ public abstract boolean canTankBeEmptied();
@Override
- public int fill(final FluidStack aFluid, final boolean doFill) {
- if (aFluid == null || aFluid.getFluid().getID() <= 0 || aFluid.amount <= 0 || !this.canTankBeFilled()
- || !this.isFluidInputAllowed(aFluid)) {
- return 0;
- }
-
- if (this.getFillableStack() == null || this.getFillableStack().getFluid().getID() <= 0) {
- if (aFluid.amount <= this.getCapacity()) {
- if (doFill) {
- this.setFillableStack(aFluid.copy());
- this.getBaseMetaTileEntity().markDirty();
- }
- return aFluid.amount;
- }
- if (doFill) {
- this.setFillableStack(aFluid.copy());
- this.getFillableStack().amount = this.getCapacity();
- this.getBaseMetaTileEntity().markDirty();
- }
- return this.getCapacity();
- }
-
- if (!this.getFillableStack().isFluidEqual(aFluid)) {
- return 0;
- }
-
- final int space = this.getCapacity() - this.getFillableStack().amount;
- if (aFluid.amount <= space) {
- if (doFill) {
- this.getFillableStack().amount += aFluid.amount;
- this.getBaseMetaTileEntity().markDirty();
- }
- return aFluid.amount;
- }
- if (doFill) {
- this.getFillableStack().amount = this.getCapacity();
- }
- return space;
- }
+ public abstract boolean displaysItemStack();
@Override
- public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory,
- final IGregTechTileEntity aBaseMetaTileEntity) {
- return new GUI_DeluxeTank(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName());
- }
+ public abstract boolean displaysStackSize();
@Override
- public FluidStack getDisplayedFluid() {
- return this.getDrainableStack();
+ public int getInputSlot() {
+ return 0;
}
@Override
- public FluidStack getDrainableStack() {
- return this.getDrainableStackEx(1);
- }
-
- public FluidStack getDrainableStackEx(final int stackID) {
- if (stackID <= 1) {
- return this.mFluid;
- }
- return this.mFluid2;
+ public int getOutputSlot() {
+ return 1;
}
@Override
- public FluidStack getFillableStack() {
- return this.getFillableStackEx(1);
+ public int getStackDisplaySlot() {
+ return 2;
}
- public FluidStack getFillableStackEx(final int stackID) {
- if (stackID <= 1) {
- return this.mFluid;
- }
- return this.mFluid2;
+ public int getStackDisplaySlot2() {
+ return 3;
}
@Override
- public FluidStack getFluid() {
- return this.getDrainableStack();
+ public boolean isFluidInputAllowed(FluidStack aFluid) {
+ return true;
}
@Override
- public int getFluidAmount() {
- return this.getDrainableStack() != null ? this.getDrainableStack().amount : 0;
+ public boolean isFluidChangingAllowed() {
+ return true;
}
@Override
- public int getInputSlot() {
- return 0;
+ public FluidStack getFillableStack() {
+ return getFillableStackEx(1);
}
- @Override
- public int getOutputSlot() {
- return 1;
+ public FluidStack getFillableStackEx(int stackID) {
+ if (stackID <= 1){
+ return mFluid;
+ }
+ return mFluid2;
}
@Override
- public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory,
- final IGregTechTileEntity aBaseMetaTileEntity) {
- return new CONTAINER_DeluxeTank(aPlayerInventory, aBaseMetaTileEntity);
+ public FluidStack setFillableStack(FluidStack aFluid) {
+ mFluid = aFluid;
+ return mFluid;
}
-
- @Override
- public int getStackDisplaySlot() {
- return 2;
+
+ public FluidStack setFillableStack2(FluidStack aFluid) {
+ mFluid2 = aFluid;
+ return mFluid2;
}
- public int getStackDisplaySlot2() {
- return 3;
+ @Override
+ public FluidStack getDrainableStack() {
+ return getDrainableStackEx(1);
}
- @Override
- public boolean isFluidChangingAllowed() {
- return true;
+ public FluidStack getDrainableStackEx(int stackID) {
+ if (stackID <= 1){
+ return mFluid;
+ }
+ return mFluid2;
}
@Override
- public boolean isFluidInputAllowed(final FluidStack aFluid) {
- return true;
+ public FluidStack setDrainableStack(FluidStack aFluid) {
+ mFluid = aFluid;
+ return mFluid;
}
@Override
- public boolean isSimpleMachine() {
- return false;
+ public FluidStack getDisplayedFluid() {
+ return getDrainableStack();
}
@Override
- public boolean isValidSlot(final int aIndex) {
- return aIndex != this.getStackDisplaySlot();
+ public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new CONTAINER_DeluxeTank(aPlayerInventory, aBaseMetaTileEntity);
}
@Override
- public void loadNBTData(final NBTTagCompound aNBT) {
- this.mFluid = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid"));
- this.mFluid2 = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid2"));
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GUI_DeluxeTank(aPlayerInventory, aBaseMetaTileEntity, getLocalName());
}
@Override
- public void onPreTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) {
+ public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
if (aBaseMetaTileEntity.isServerSide()) {
- if (this.isFluidChangingAllowed() && this.getFillableStack() != null
- && this.getFillableStack().amount <= 0) {
- this.setFillableStack(null);
- }
-
- if (this.displaysItemStack() && this.getStackDisplaySlot() >= 0
- && this.getStackDisplaySlot() < this.mInventory.length) {
- if (this.getDisplayedFluid() == null) {
- if (ItemList.Display_Fluid.isStackEqual(this.mInventory[this.getStackDisplaySlot()], true, true)) {
- this.mInventory[this.getStackDisplaySlot()] = null;
- }
- }
- else {
- this.mInventory[this.getStackDisplaySlot()] = GT_Utility
- .getFluidDisplayStack(this.getDisplayedFluid(), this.displaysStackSize());
+ if (isFluidChangingAllowed() && getFillableStack() != null && getFillableStack().amount <= 0)
+ setFillableStack(null);
+
+ if (displaysItemStack() && getStackDisplaySlot() >= 0 && getStackDisplaySlot() < mInventory.length) {
+ if (getDisplayedFluid() == null) {
+ if (ItemList.Display_Fluid.isStackEqual(mInventory[getStackDisplaySlot()], true, true))
+ mInventory[getStackDisplaySlot()] = null;
+ } else {
+ mInventory[getStackDisplaySlot()] = GT_Utility.getFluidDisplayStack(getDisplayedFluid(), displaysStackSize());
}
}
- if (this.displaysItemStack() && this.getStackDisplaySlot2() >= 0
- && this.getStackDisplaySlot2() < this.mInventory.length) {
- if (this.getDrainableStackEx(2) == null) {
- if (ItemList.Display_Fluid.isStackEqual(this.mInventory[this.getStackDisplaySlot2()], true, true)) {
- this.mInventory[this.getStackDisplaySlot2()] = null;
- }
- }
- else {
- this.mInventory[this.getStackDisplaySlot2()] = GT_Utility
- .getFluidDisplayStack(this.getDrainableStackEx(2), this.displaysStackSize());
+ if (displaysItemStack() && getStackDisplaySlot2() >= 0 && getStackDisplaySlot2() < mInventory.length) {
+ if (getDrainableStackEx(2) == null) {
+ if (ItemList.Display_Fluid.isStackEqual(mInventory[getStackDisplaySlot2()], true, true))
+ mInventory[getStackDisplaySlot2()] = null;
+ } else {
+ mInventory[getStackDisplaySlot2()] = GT_Utility.getFluidDisplayStack(getDrainableStackEx(2), displaysStackSize());
}
}
- if (this.doesEmptyContainers()) {
- final FluidStack tFluid = GT_Utility.getFluidForFilledItem(this.mInventory[this.getInputSlot()], true);
- if (tFluid != null && this.isFluidInputAllowed(tFluid)) {
-
- if (tFluid.isFluidEqual(this.getDrainableStackEx(1)) || this.getDrainableStackEx(1) == null) {
- if (this.getFillableStackEx(1) == null) {
- if (this.isFluidInputAllowed(tFluid) && tFluid.amount <= this.getCapacity()) {
- if (aBaseMetaTileEntity.addStackToSlot(this.getOutputSlot(),
- GT_Utility.getContainerItem(this.mInventory[this.getInputSlot()], true), 1)) {
- this.setFillableStack(tFluid.copy());
- aBaseMetaTileEntity.decrStackSize(this.getInputSlot(), 1);
+ if (doesEmptyContainers()) {
+ FluidStack tFluid = GT_Utility.getFluidForFilledItem(mInventory[getInputSlot()], true);
+ if (tFluid != null && isFluidInputAllowed(tFluid)) {
+
+ if (tFluid.isFluidEqual(getDrainableStackEx(1)) || getDrainableStackEx(1) == null){
+ if (getFillableStackEx(1) == null) {
+ if (isFluidInputAllowed(tFluid) && tFluid.amount <= getCapacity()) {
+ if (aBaseMetaTileEntity.addStackToSlot(getOutputSlot(), GT_Utility.getContainerItem(mInventory[getInputSlot()], true), 1)) {
+ setFillableStack(tFluid.copy());
+ aBaseMetaTileEntity.decrStackSize(getInputSlot(), 1);
}
}
- }
- else {
- if (tFluid.isFluidEqual(this.getFillableStack())
- && tFluid.amount + this.getFillableStack().amount <= this.getCapacity()) {
- if (aBaseMetaTileEntity.addStackToSlot(this.getOutputSlot(),
- GT_Utility.getContainerItem(this.mInventory[this.getInputSlot()], true), 1)) {
- this.getFillableStack().amount += tFluid.amount;
- aBaseMetaTileEntity.decrStackSize(this.getInputSlot(), 1);
+ } else {
+ if (tFluid.isFluidEqual(getFillableStack()) && tFluid.amount + getFillableStack().amount <= getCapacity()) {
+ if (aBaseMetaTileEntity.addStackToSlot(getOutputSlot(), GT_Utility.getContainerItem(mInventory[getInputSlot()], true), 1)) {
+ getFillableStack().amount += tFluid.amount;
+ aBaseMetaTileEntity.decrStackSize(getInputSlot(), 1);
}
}
}
}
- else if (tFluid.isFluidEqual(this.getDrainableStackEx(2)) || this.getDrainableStackEx(2) == null) {
- if (this.getFillableStackEx(2) == null) {
- if (this.isFluidInputAllowed(tFluid) && tFluid.amount <= this.getCapacity()) {
- if (aBaseMetaTileEntity.addStackToSlot(this.getOutputSlot(),
- GT_Utility.getContainerItem(this.mInventory[this.getInputSlot()], true), 1)) {
- this.setFillableStack2(tFluid.copy());
- aBaseMetaTileEntity.decrStackSize(this.getInputSlot(), 1);
+ else if (tFluid.isFluidEqual(getDrainableStackEx(2)) || (getDrainableStackEx(2) == null)){
+ if (getFillableStackEx(2) == null) {
+ if (isFluidInputAllowed(tFluid) && tFluid.amount <= getCapacity()) {
+ if (aBaseMetaTileEntity.addStackToSlot(getOutputSlot(), GT_Utility.getContainerItem(mInventory[getInputSlot()], true), 1)) {
+ setFillableStack2(tFluid.copy());
+ aBaseMetaTileEntity.decrStackSize(getInputSlot(), 1);
}
}
- }
- else {
- if (tFluid.isFluidEqual(this.getFillableStackEx(2))
- && tFluid.amount + this.getFillableStackEx(2).amount <= this.getCapacity()) {
- if (aBaseMetaTileEntity.addStackToSlot(this.getOutputSlot(),
- GT_Utility.getContainerItem(this.mInventory[this.getInputSlot()], true), 1)) {
- this.getFillableStackEx(2).amount += tFluid.amount;
- aBaseMetaTileEntity.decrStackSize(this.getInputSlot(), 1);
+ } else {
+ if (tFluid.isFluidEqual(getFillableStackEx(2)) && tFluid.amount + getFillableStackEx(2).amount <= getCapacity()) {
+ if (aBaseMetaTileEntity.addStackToSlot(getOutputSlot(), GT_Utility.getContainerItem(mInventory[getInputSlot()], true), 1)) {
+ getFillableStackEx(2).amount += tFluid.amount;
+ aBaseMetaTileEntity.decrStackSize(getInputSlot(), 1);
}
}
}
@@ -323,47 +227,101 @@ public abstract class GT_MetaTileEntity_DeluxeTank extends GT_MetaTileEntity_Bas
}
}
- if (this.doesFillContainers()) {
- final ItemStack tOutput = GT_Utility.fillFluidContainer(this.getDrainableStack(),
- this.mInventory[this.getInputSlot()], false, true);
- if (tOutput != null && aBaseMetaTileEntity.addStackToSlot(this.getOutputSlot(), tOutput, 1)) {
- final FluidStack tFluid = GT_Utility.getFluidForFilledItem(tOutput, true);
- aBaseMetaTileEntity.decrStackSize(this.getInputSlot(), 1);
- if (tFluid != null) {
- this.getDrainableStack().amount -= tFluid.amount;
- }
- if (this.getDrainableStack().amount <= 0 && this.isFluidChangingAllowed()) {
- this.setDrainableStack(null);
- }
+ if (doesFillContainers()) {
+ ItemStack tOutput = GT_Utility.fillFluidContainer(getDrainableStack(), mInventory[getInputSlot()], false, true);
+ if (tOutput != null && aBaseMetaTileEntity.addStackToSlot(getOutputSlot(), tOutput, 1)) {
+ FluidStack tFluid = GT_Utility.getFluidForFilledItem(tOutput, true);
+ aBaseMetaTileEntity.decrStackSize(getInputSlot(), 1);
+ if (tFluid != null) getDrainableStack().amount -= tFluid.amount;
+ if (getDrainableStack().amount <= 0 && isFluidChangingAllowed()) setDrainableStack(null);
}
}
}
}
@Override
- public void saveNBTData(final NBTTagCompound aNBT) {
- if (this.mFluid != null) {
- aNBT.setTag("mFluid", this.mFluid.writeToNBT(new NBTTagCompound()));
+ public FluidStack getFluid() {
+ return getDrainableStack();
+ }
+
+ @Override
+ public int getFluidAmount() {
+ return getDrainableStack() != null ? getDrainableStack().amount : 0;
+ }
+
+ @Override
+ public int fill(FluidStack aFluid, boolean doFill) {
+ if (aFluid == null || aFluid.getFluid().getID() <= 0 || aFluid.amount <= 0 || !canTankBeFilled() || !isFluidInputAllowed(aFluid))
+ return 0;
+
+ if (getFillableStack() == null || getFillableStack().getFluid().getID() <= 0) {
+ if (aFluid.amount <= getCapacity()) {
+ if (doFill) {
+ setFillableStack(aFluid.copy());
+ getBaseMetaTileEntity().markDirty();
+ }
+ return aFluid.amount;
+ }
+ if (doFill) {
+ setFillableStack(aFluid.copy());
+ getFillableStack().amount = getCapacity();
+ getBaseMetaTileEntity().markDirty();
+ }
+ return getCapacity();
}
- if (this.mFluid2 != null) {
- aNBT.setTag("mFluid2", this.mFluid2.writeToNBT(new NBTTagCompound()));
+
+ if (!getFillableStack().isFluidEqual(aFluid))
+ return 0;
+
+ int space = getCapacity() - getFillableStack().amount;
+ if (aFluid.amount <= space) {
+ if (doFill) {
+ getFillableStack().amount += aFluid.amount;
+ getBaseMetaTileEntity().markDirty();
+ }
+ return aFluid.amount;
}
+ if (doFill)
+ getFillableStack().amount = getCapacity();
+ return space;
}
@Override
- public FluidStack setDrainableStack(final FluidStack aFluid) {
- this.mFluid = aFluid;
- return this.mFluid;
+ public FluidStack drain(int maxDrain, boolean doDrain) {
+ if (getDrainableStack() == null || !canTankBeEmptied()) return null;
+ if (getDrainableStack().amount <= 0 && isFluidChangingAllowed()) {
+ setDrainableStack(null);
+ getBaseMetaTileEntity().markDirty();
+ return null;
+ }
+
+ int used = maxDrain;
+ if (getDrainableStack().amount < used)
+ used = getDrainableStack().amount;
+
+ if (doDrain) {
+ getDrainableStack().amount -= used;
+ getBaseMetaTileEntity().markDirty();
+ }
+
+ FluidStack drained = getDrainableStack().copy();
+ drained.amount = used;
+
+ if (getDrainableStack().amount <= 0 && isFluidChangingAllowed()) {
+ setDrainableStack(null);
+ getBaseMetaTileEntity().markDirty();
+ }
+
+ return drained;
}
@Override
- public FluidStack setFillableStack(final FluidStack aFluid) {
- this.mFluid = aFluid;
- return this.mFluid;
+ public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return aIndex == getOutputSlot();
}
- public FluidStack setFillableStack2(final FluidStack aFluid) {
- this.mFluid2 = aFluid;
- return this.mFluid2;
+ @Override
+ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return aIndex == getInputSlot();
}
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaCondensor.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaCondensor.java
index 4836ee0e42..dcecc3ff34 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaCondensor.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaCondensor.java
@@ -18,165 +18,148 @@ import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidHandler;
-public class GregtechMetaCondensor extends GregtechMetaBoilerBase {
+public class GregtechMetaCondensor extends GregtechMetaBoilerBase{
- public GregtechMetaCondensor(final int aID, final String aName, final String aNameRegional) {
- super(aID, aName, aNameRegional, "A Steam condenser - [IC2->Steam]", new ITexture[0]);
- }
-
- public GregtechMetaCondensor(final String aName, final int aTier, final String aDescription,
- final ITexture[][][] aTextures) {
- super(aName, aTier, aDescription, aTextures);
- }
-
- @Override
- public final int fill(final FluidStack aFluid, final boolean doFill) {
- if (Utils.isIC2Steam(aFluid) && this.mProcessingEnergy < 50) {
- final int tFilledAmount = Math.min(50, aFluid.amount);
- if (doFill) {
- this.mProcessingEnergy += tFilledAmount;
- }
- return tFilledAmount;
- }
- return super.fill(aFluid, doFill);
- }
-
- @Override
- public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory,
- final IGregTechTileEntity aBaseMetaTileEntity) {
- return new GUI_SteamCondenser(aPlayerInventory, aBaseMetaTileEntity, "SteelBoiler.png", 32000);
- }
-
- @Override
- public String[] getDescription() {
- return new String[] {
- this.mDescription, CORE.GT_Tooltip
- };
- }
-
- @Override
- public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory,
- final IGregTechTileEntity aBaseMetaTileEntity) {
- return new CONTAINER_SteamCondenser(aPlayerInventory, aBaseMetaTileEntity, 32000);
- }
-
- @Override
- public ITexture[][][] getTextureSet(final ITexture[] aTextures) {
- final ITexture[][][] rTextures = new ITexture[5][17][];
- for (byte i = -1; i < 16; i++) {
- rTextures[0][i + 1] = new ITexture[] {
- new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_VENT,
- Dyes.getModulation(i, Dyes.MACHINE_METAL.mRGBa))
- };
- rTextures[1][i + 1] = new ITexture[] {
- new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_VENT,
- Dyes.getModulation(i, Dyes.MACHINE_METAL.mRGBa)),
- new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE)
- };
- rTextures[2][i + 1] = new ITexture[] {
- new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_VENT,
- Dyes.getModulation(i, Dyes.MACHINE_METAL.mRGBa)),
- new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE)
- };
- rTextures[3][i + 1] = new ITexture[] {
- new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_VENT,
- Dyes.getModulation(i, Dyes.MACHINE_METAL.mRGBa)),
- new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_POTIONBREWER)
- };
- rTextures[4][i + 1] = new ITexture[] {
- new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_VENT,
- Dyes.getModulation(i, Dyes.MACHINE_METAL.mRGBa)),
- new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_POTIONBREWER_ACTIVE)
- };
- }
- return rTextures;
- }
-
- @Override
- public int maxProgresstime() {
- return 1000;
- }
-
- @Override
- public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
- return new GregtechMetaCondensor(this.mName, this.mTier, this.mDescription, this.mTextures);
- }
-
- @Override
- public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) {
- this.RI = MathUtils.randLong(5L, 30L);
- if (aBaseMetaTileEntity.isServerSide() && aTick > 20L) {
- if (this.mTemperature <= 5) {
- this.mTemperature = 5;
- this.mLossTimer = 0;
- }
- if (++this.mLossTimer > 10) {
- this.mTemperature -= 1;
- this.mLossTimer = 0;
- }
- for (byte i = 1; this.mSteam != null && i < 6; i = (byte) (i + 1)) {
- if (i != aBaseMetaTileEntity.getFrontFacing()) {
- final IFluidHandler tTileEntity = aBaseMetaTileEntity.getITankContainerAtSide(i);
- if (tTileEntity != null) {
- final FluidStack tDrained = aBaseMetaTileEntity.drain(ForgeDirection.getOrientation(i),
- Math.max(1, this.mSteam.amount / 2), false);
- if (tDrained != null) {
- final int tFilledAmount = tTileEntity.fill(ForgeDirection.getOrientation(i).getOpposite(),
- tDrained, false);
- if (tFilledAmount > 0) {
- tTileEntity.fill(ForgeDirection.getOrientation(i).getOpposite(), aBaseMetaTileEntity
- .drain(ForgeDirection.getOrientation(i), tFilledAmount, true), true);
- }
- }
- }
- }
- }
- if (aTick % 10L == 0L) {
- if (this.mTemperature > 5) {
- if (this.mFluid == null || !GT_ModHandler.isWater(this.mFluid) || this.mFluid.amount <= 0) {
- this.mHadNoWater = true;
- }
- else {
- if (this.mHadNoWater) {
- aBaseMetaTileEntity.doExplosion(2048L);
- return;
- }
- this.mFluid.amount -= 1;
- if (this.mSteam == null) {
- this.mSteam = GT_ModHandler.getSteam(30L);
- }
- else if (GT_ModHandler.isSteam(this.mSteam)) {
- this.mSteam.amount += 30;
- }
- else {
- this.mSteam = GT_ModHandler.getSteam(30L);
- }
- }
- }
- else {
- this.mHadNoWater = false;
- }
- }
- if (this.mSteam != null && this.mSteam.amount > 32000) {
- this.sendSound((byte) 1);
- this.mSteam.amount = 24000;
- }
- /*
- * if ((this.mProcessingEnergy <= 0) &&
- * (aBaseMetaTileEntity.isAllowedToWork()) &&
- * (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2],
- * OrePrefixes.bucket.get(IC2.getItemFromBlock(p_150898_0_))))) {
- * this.mProcessingEnergy += 1000;
- * aBaseMetaTileEntity.decrStackSize(2, 1);
- * aBaseMetaTileEntity.addStackToSlot(3,
- * GT_OreDictUnificator.get(OrePrefixes.bucket, Materials.Empty,
- * 1L)); }
- */
- if (this.mTemperature < 1000 && this.mProcessingEnergy > 0 && aTick % this.RI == 0L) {
- this.mProcessingEnergy -= 40;
- this.mTemperature += 2;
- }
- aBaseMetaTileEntity.setActive(this.mProcessingEnergy > 0);
+ public GregtechMetaCondensor(int aID, String aName, String aNameRegional)
+ {
+ super(aID, aName, aNameRegional, "A Steam condenser - [IC2->Steam]", new ITexture[0]);
+ }
+
+ public GregtechMetaCondensor(String aName, int aTier, String aDescription, ITexture[][][] aTextures)
+ {
+ super(aName, aTier, aDescription, aTextures);
+ }
+
+ @Override
+ public String[] getDescription() {
+ re