Class BasicAirHandler

java.lang.Object
me.desht.pneumaticcraft.common.capabilities.BasicAirHandler
All Implemented Interfaces:
IAirHandler, net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
Direct Known Subclasses:
MachineAirHandler

public class BasicAirHandler extends Object implements IAirHandler, net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
A reference implementation. Subclass this or implement your own.
  • Constructor Details

    • BasicAirHandler

      public BasicAirHandler(int volume)
  • Method Details

    • getPressure

      public float getPressure()
      Description copied from interface: IAirHandler
      Get the current pressure for this handler.
      Specified by:
      getPressure in interface IAirHandler
      Returns:
      the current pressure
    • getAir

      public int getAir()
      Description copied from interface: IAirHandler
      Returns the amount of air in this handler. Note: amount of air = pressure * volume.
      Specified by:
      getAir in interface IAirHandler
      Returns:
      the air in this air handler
    • addAir

      public void addAir(int amount)
      Description copied from interface: IAirHandler
      Adds air to this handler.
      Specified by:
      addAir in interface IAirHandler
      Parameters:
      amount - amount of air to add in mL, may be negative.
    • getBaseVolume

      public int getBaseVolume()
      Description copied from interface: IAirHandler
      Gets the base volume of this handler, before any Volume Upgrades are taken into account. When the volume decreases, the pressure will remain the same, meaning air will be lost. When the volume increases, the air remains the same, meaning the pressure will drop.
      Specified by:
      getBaseVolume in interface IAirHandler
      Returns:
      the base volume
    • setBaseVolume

      public void setBaseVolume(int baseVolume)
      Description copied from interface: IAirHandler
      Set the base volume of this air handler. May be useful if the base volume depends on factors other than the number of volume upgrades.
      Specified by:
      setBaseVolume in interface IAirHandler
      Parameters:
      baseVolume - the new base volume
    • getVolume

      public int getVolume()
      Description copied from interface: IAirHandler
      Get the effective volume of this air handler. This may have been increased by Volume Upgrades, and also other external modifiers (see IItemRegistry.registerPneumaticVolumeModifier(ItemVolumeModifier)).
      Specified by:
      getVolume in interface IAirHandler
      Returns:
      the effective volume, in mL
    • maxPressure

      public float maxPressure()
      Description copied from interface: IAirHandler
      Get the maximum pressure this handler can take. Behaviour when more air is added is implementation-dependent (e.g. items tend to stop accepting air, while blocks/machine tend to explode)
      Specified by:
      maxPressure in interface IAirHandler
      Returns:
      the maximum pressure for this handler
    • serializeNBT

      public net.minecraft.nbt.CompoundTag serializeNBT()
      Specified by:
      serializeNBT in interface net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
    • deserializeNBT

      public void deserializeNBT(net.minecraft.nbt.CompoundTag nbt)
      Specified by:
      deserializeNBT in interface net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>