Backwards-compatibility for IGasHandler. #2267

This commit is contained in:
Ben Spiers 2015-03-22 14:36:21 +00:00
parent 050f3351e2
commit 0064f09d8c
20 changed files with 212 additions and 2 deletions

View file

@ -16,6 +16,9 @@ public interface IGasHandler
*/ */
public int receiveGas(ForgeDirection side, GasStack stack, boolean doTransfer); public int receiveGas(ForgeDirection side, GasStack stack, boolean doTransfer);
@Deprecated
public int receiveGas(ForgeDirection side, GasStack stack);
/** /**
* Draws a certain amount of gas from this block. * Draws a certain amount of gas from this block.
* @param amount - amount to draw * @param amount - amount to draw
@ -23,6 +26,9 @@ public interface IGasHandler
*/ */
public GasStack drawGas(ForgeDirection side, int amount, boolean doTransfer); public GasStack drawGas(ForgeDirection side, int amount, boolean doTransfer);
@Deprecated
public GasStack drawGas(ForgeDirection side, int amount);
/** /**
* Whether or not this block can accept gas from a certain side. * Whether or not this block can accept gas from a certain side.
* @param side - side to check * @param side - side to check

View file

@ -81,12 +81,24 @@ public class SharedInventory implements IStrictEnergyStorage, IFluidHandler, IGa
return storedGas.receive(stack, doTransfer); return storedGas.receive(stack, doTransfer);
} }
@Override
public int receiveGas(ForgeDirection side, GasStack stack)
{
return receiveGas(side, stack, true);
}
@Override @Override
public GasStack drawGas(ForgeDirection side, int amount, boolean doTransfer) public GasStack drawGas(ForgeDirection side, int amount, boolean doTransfer)
{ {
return storedGas.draw(amount, doTransfer); return storedGas.draw(amount, doTransfer);
} }
@Override
public GasStack drawGas(ForgeDirection side, int amount)
{
return drawGas(side, amount, true);
}
@Override @Override
public boolean canReceiveGas(ForgeDirection side, Gas type) public boolean canReceiveGas(ForgeDirection side, Gas type)
{ {

View file

@ -296,12 +296,24 @@ public class PartPressurizedTube extends PartTransmitter<GasNetwork> implements
return 0; return 0;
} }
@Override
public int receiveGas(ForgeDirection side, GasStack stack)
{
return receiveGas(side, stack, true);
}
@Override @Override
public GasStack drawGas(ForgeDirection side, int amount, boolean doTransfer) public GasStack drawGas(ForgeDirection side, int amount, boolean doTransfer)
{ {
return null; return null;
} }
@Override
public GasStack drawGas(ForgeDirection side, int amount)
{
return drawGas(side, amount, true);
}
@Override @Override
public boolean canReceiveGas(ForgeDirection side, Gas type) public boolean canReceiveGas(ForgeDirection side, Gas type)
{ {

View file

@ -391,12 +391,24 @@ public abstract class TileEntityAdvancedElectricMachine<RECIPE extends AdvancedM
return 0; return 0;
} }
@Override
public int receiveGas(ForgeDirection side, GasStack stack)
{
return receiveGas(side, stack, true);
}
@Override @Override
public GasStack drawGas(ForgeDirection side, int amount, boolean doTransfer) public GasStack drawGas(ForgeDirection side, int amount, boolean doTransfer)
{ {
return null; return null;
} }
@Override
public GasStack drawGas(ForgeDirection side, int amount)
{
return drawGas(side, amount, true);
}
@Override @Override
public boolean canReceiveGas(ForgeDirection side, Gas type) public boolean canReceiveGas(ForgeDirection side, Gas type)
{ {

View file

@ -57,12 +57,24 @@ public class TileEntityAmbientAccumulator extends TileEntityContainerBlock imple
return 0; return 0;
} }
@Override
public int receiveGas(ForgeDirection side, GasStack stack)
{
return receiveGas(side, stack, true);
}
@Override @Override
public GasStack drawGas(ForgeDirection side, int amount, boolean doTransfer) public GasStack drawGas(ForgeDirection side, int amount, boolean doTransfer)
{ {
return collectedGas.draw(amount, doTransfer); return collectedGas.draw(amount, doTransfer);
} }
@Override
public GasStack drawGas(ForgeDirection side, int amount)
{
return drawGas(side, amount, true);
}
@Override @Override
public boolean canReceiveGas(ForgeDirection side, Gas type) public boolean canReceiveGas(ForgeDirection side, Gas type)
{ {

View file

@ -376,12 +376,24 @@ public class TileEntityChemicalCrystallizer extends TileEntityNoisyElectricBlock
return 0; return 0;
} }
@Override
public int receiveGas(ForgeDirection side, GasStack stack)
{
return receiveGas(side, stack, true);
}
@Override @Override
public GasStack drawGas(ForgeDirection side, int amount, boolean doTransfer) public GasStack drawGas(ForgeDirection side, int amount, boolean doTransfer)
{ {
return null; return null;
} }
@Override
public GasStack drawGas(ForgeDirection side, int amount)
{
return drawGas(side, amount, true);
}
@Override @Override
public boolean canDrawGas(ForgeDirection side, Gas type) public boolean canDrawGas(ForgeDirection side, Gas type)
{ {

View file

@ -415,12 +415,24 @@ public class TileEntityChemicalDissolutionChamber extends TileEntityNoisyElectri
return 0; return 0;
} }
@Override
public int receiveGas(ForgeDirection side, GasStack stack)
{
return receiveGas(side, stack, true);
}
@Override @Override
public GasStack drawGas(ForgeDirection side, int amount, boolean doTransfer) public GasStack drawGas(ForgeDirection side, int amount, boolean doTransfer)
{ {
return null; return null;
} }
@Override
public GasStack drawGas(ForgeDirection side, int amount)
{
return drawGas(side, amount, true);
}
@Override @Override
public boolean canReceiveGas(ForgeDirection side, Gas type) public boolean canReceiveGas(ForgeDirection side, Gas type)
{ {

View file

@ -429,6 +429,12 @@ public class TileEntityChemicalInfuser extends TileEntityNoisyElectricBlock impl
return 0; return 0;
} }
@Override
public int receiveGas(ForgeDirection side, GasStack stack)
{
return receiveGas(side, stack, true);
}
@Override @Override
public GasStack drawGas(ForgeDirection side, int amount, boolean doTransfer) public GasStack drawGas(ForgeDirection side, int amount, boolean doTransfer)
{ {
@ -440,6 +446,12 @@ public class TileEntityChemicalInfuser extends TileEntityNoisyElectricBlock impl
return null; return null;
} }
@Override
public GasStack drawGas(ForgeDirection side, int amount)
{
return drawGas(side, amount, true);
}
@Override @Override
public boolean canDrawGas(ForgeDirection side, Gas type) public boolean canDrawGas(ForgeDirection side, Gas type)
{ {

View file

@ -23,7 +23,7 @@ import net.minecraft.block.Block;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityChemicalInjectionChamber extends TileEntityAdvancedElectricMachine<InjectionRecipe> implements IGasHandler, ITubeConnection public class TileEntityChemicalInjectionChamber extends TileEntityAdvancedElectricMachine<InjectionRecipe>
{ {
public TileEntityChemicalInjectionChamber() public TileEntityChemicalInjectionChamber()
{ {

View file

@ -484,6 +484,12 @@ public class TileEntityChemicalWasher extends TileEntityNoisyElectricBlock imple
return 0; return 0;
} }
@Override
public int receiveGas(ForgeDirection side, GasStack stack)
{
return receiveGas(side, stack, true);
}
@Override @Override
public GasStack drawGas(ForgeDirection side, int amount, boolean doTransfer) public GasStack drawGas(ForgeDirection side, int amount, boolean doTransfer)
{ {
@ -495,6 +501,12 @@ public class TileEntityChemicalWasher extends TileEntityNoisyElectricBlock imple
return null; return null;
} }
@Override
public GasStack drawGas(ForgeDirection side, int amount)
{
return drawGas(side, amount, true);
}
@Override @Override
public boolean canDrawGas(ForgeDirection side, Gas type) public boolean canDrawGas(ForgeDirection side, Gas type)
{ {

View file

@ -691,6 +691,12 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
return 0; return 0;
} }
@Override
public int receiveGas(ForgeDirection side, GasStack stack)
{
return receiveGas(side, stack, true);
}
@Override @Override
public GasStack drawGas(ForgeDirection side, int amount, boolean doTransfer) public GasStack drawGas(ForgeDirection side, int amount, boolean doTransfer)
{ {
@ -706,6 +712,12 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp
return null; return null;
} }
@Override
public GasStack drawGas(ForgeDirection side, int amount)
{
return drawGas(side, amount, true);
}
@Override @Override
public boolean canReceiveGas(ForgeDirection side, Gas type) public boolean canReceiveGas(ForgeDirection side, Gas type)
{ {

View file

@ -161,12 +161,24 @@ public class TileEntityEntangledBlock extends TileEntityElectricBlock implements
return sharedInventory == null ? 0 : sharedInventory.receiveGas(side, stack, doTransfer); return sharedInventory == null ? 0 : sharedInventory.receiveGas(side, stack, doTransfer);
} }
@Override
public int receiveGas(ForgeDirection side, GasStack stack)
{
return receiveGas(side, stack, true);
}
@Override @Override
public GasStack drawGas(ForgeDirection side, int amount, boolean doTransfer) public GasStack drawGas(ForgeDirection side, int amount, boolean doTransfer)
{ {
return sharedInventory == null ? null : sharedInventory.drawGas(side, amount, doTransfer); return sharedInventory == null ? null : sharedInventory.drawGas(side, amount, doTransfer);
} }
@Override
public GasStack drawGas(ForgeDirection side, int amount)
{
return drawGas(side, amount, true);
}
@Override @Override
public boolean canReceiveGas(ForgeDirection side, Gas type) public boolean canReceiveGas(ForgeDirection side, Gas type)
{ {

View file

@ -993,6 +993,12 @@ public class TileEntityFactory extends TileEntityNoisyElectricBlock implements I
return 0; return 0;
} }
@Override
public int receiveGas(ForgeDirection side, GasStack stack)
{
return receiveGas(side, stack, true);
}
@Override @Override
public boolean canReceiveGas(ForgeDirection side, Gas type) public boolean canReceiveGas(ForgeDirection side, Gas type)
{ {
@ -1021,6 +1027,12 @@ public class TileEntityFactory extends TileEntityNoisyElectricBlock implements I
return null; return null;
} }
@Override
public GasStack drawGas(ForgeDirection side, int amount)
{
return drawGas(side, amount, true);
}
@Override @Override
public boolean canDrawGas(ForgeDirection side, Gas type) public boolean canDrawGas(ForgeDirection side, Gas type)
{ {

View file

@ -151,12 +151,24 @@ public class TileEntityGasTank extends TileEntityContainerBlock implements IGasH
return gasTank.receive(stack, doTransfer); return gasTank.receive(stack, doTransfer);
} }
@Override
public int receiveGas(ForgeDirection side, GasStack stack)
{
return receiveGas(side, stack, true);
}
@Override @Override
public GasStack drawGas(ForgeDirection side, int amount, boolean doTransfer) public GasStack drawGas(ForgeDirection side, int amount, boolean doTransfer)
{ {
return null; return null;
} }
@Override
public GasStack drawGas(ForgeDirection side, int amount)
{
return drawGas(side, amount, true);
}
@Override @Override
public boolean canDrawGas(ForgeDirection side, Gas type) public boolean canDrawGas(ForgeDirection side, Gas type)
{ {

View file

@ -397,6 +397,12 @@ public class TileEntityPRC extends TileEntityBasicMachine<PressurizedInput, Pres
return 0; return 0;
} }
@Override
public int receiveGas(ForgeDirection side, GasStack stack)
{
return receiveGas(side, stack, true);
}
@Override @Override
public GasStack drawGas(ForgeDirection side, int amount, boolean doTransfer) public GasStack drawGas(ForgeDirection side, int amount, boolean doTransfer)
{ {
@ -408,6 +414,12 @@ public class TileEntityPRC extends TileEntityBasicMachine<PressurizedInput, Pres
return null; return null;
} }
@Override
public GasStack drawGas(ForgeDirection side, int amount)
{
return drawGas(side, amount, true);
}
@Override @Override
public boolean canReceiveGas(ForgeDirection side, Gas type) public boolean canReceiveGas(ForgeDirection side, Gas type)
{ {

View file

@ -20,7 +20,7 @@ import net.minecraft.init.Items;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityPurificationChamber extends TileEntityAdvancedElectricMachine<PurificationRecipe> implements IGasHandler, ITubeConnection public class TileEntityPurificationChamber extends TileEntityAdvancedElectricMachine<PurificationRecipe>
{ {
public TileEntityPurificationChamber() public TileEntityPurificationChamber()
{ {

View file

@ -519,12 +519,24 @@ public class TileEntityRotaryCondensentrator extends TileEntityElectricBlock imp
return gasTank.receive(stack, doTransfer); return gasTank.receive(stack, doTransfer);
} }
@Override
public int receiveGas(ForgeDirection side, GasStack stack)
{
return receiveGas(side, stack, true);
}
@Override @Override
public GasStack drawGas(ForgeDirection side, int amount, boolean doTransfer) public GasStack drawGas(ForgeDirection side, int amount, boolean doTransfer)
{ {
return gasTank.draw(amount, doTransfer); return gasTank.draw(amount, doTransfer);
} }
@Override
public GasStack drawGas(ForgeDirection side, int amount)
{
return drawGas(side, amount, true);
}
@Override @Override
public boolean canDrawGas(ForgeDirection side, Gas type) public boolean canDrawGas(ForgeDirection side, Gas type)
{ {

View file

@ -282,6 +282,12 @@ public class TileEntitySolarNeutronActivator extends TileEntityContainerBlock im
return 0; return 0;
} }
@Override
public int receiveGas(ForgeDirection side, GasStack stack)
{
return receiveGas(side, stack, true);
}
@Override @Override
public GasStack drawGas(ForgeDirection side, int amount, boolean doTransfer) public GasStack drawGas(ForgeDirection side, int amount, boolean doTransfer)
{ {
@ -293,6 +299,12 @@ public class TileEntitySolarNeutronActivator extends TileEntityContainerBlock im
return null; return null;
} }
@Override
public GasStack drawGas(ForgeDirection side, int amount)
{
return drawGas(side, amount, true);
}
@Override @Override
public boolean canReceiveGas(ForgeDirection side, Gas type) public boolean canReceiveGas(ForgeDirection side, Gas type)
{ {

View file

@ -260,6 +260,12 @@ public class TileEntityGasGenerator extends TileEntityGenerator implements IGasH
return 0; return 0;
} }
@Override
public int receiveGas(ForgeDirection side, GasStack stack)
{
return receiveGas(side, stack, true);
}
@Override @Override
public void readFromNBT(NBTTagCompound nbtTags) public void readFromNBT(NBTTagCompound nbtTags)
{ {
@ -296,6 +302,12 @@ public class TileEntityGasGenerator extends TileEntityGenerator implements IGasH
return null; return null;
} }
@Override
public GasStack drawGas(ForgeDirection side, int amount)
{
return drawGas(side, amount, true);
}
@Override @Override
public boolean canDrawGas(ForgeDirection side, Gas type) public boolean canDrawGas(ForgeDirection side, Gas type)
{ {

View file

@ -128,6 +128,12 @@ public class TileEntityReactorPort extends TileEntityReactorBlock implements IFl
return 0; return 0;
} }
@Override
public int receiveGas(ForgeDirection side, GasStack stack)
{
return receiveGas(side, stack, true);
}
@Override @Override
public GasStack drawGas(ForgeDirection side, int amount, boolean doTransfer) public GasStack drawGas(ForgeDirection side, int amount, boolean doTransfer)
{ {
@ -142,6 +148,12 @@ public class TileEntityReactorPort extends TileEntityReactorBlock implements IFl
return null; return null;
} }
@Override
public GasStack drawGas(ForgeDirection side, int amount)
{
return drawGas(side, amount, true);
}
@Override @Override
public boolean canReceiveGas(ForgeDirection side, Gas type) public boolean canReceiveGas(ForgeDirection side, Gas type)
{ {