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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAir(int amount) Adds air to this handler.voiddeserializeNBT(net.minecraft.nbt.CompoundTag nbt) intgetAir()Returns the amount of air in this handler.intGets the base volume of this handler, before any Volume Upgrades are taken into account.floatGet the current pressure for this handler.intGet the effective volume of this air handler.floatGet the maximum pressure this handler can take.net.minecraft.nbt.CompoundTagvoidsetBaseVolume(int baseVolume) Set the base volume of this air handler.
-
Constructor Details
-
BasicAirHandler
public BasicAirHandler(int volume)
-
-
Method Details
-
getPressure
public float getPressure()Description copied from interface:IAirHandlerGet the current pressure for this handler.- Specified by:
getPressurein interfaceIAirHandler- Returns:
- the current pressure
-
getAir
public int getAir()Description copied from interface:IAirHandlerReturns the amount of air in this handler. Note: amount of air = pressure * volume.- Specified by:
getAirin interfaceIAirHandler- Returns:
- the air in this air handler
-
addAir
public void addAir(int amount) Description copied from interface:IAirHandlerAdds air to this handler.- Specified by:
addAirin interfaceIAirHandler- Parameters:
amount- amount of air to add in mL, may be negative.
-
getBaseVolume
public int getBaseVolume()Description copied from interface:IAirHandlerGets 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:
getBaseVolumein interfaceIAirHandler- Returns:
- the base volume
-
setBaseVolume
public void setBaseVolume(int baseVolume) Description copied from interface:IAirHandlerSet 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:
setBaseVolumein interfaceIAirHandler- Parameters:
baseVolume- the new base volume
-
getVolume
public int getVolume()Description copied from interface:IAirHandlerGet the effective volume of this air handler. This may have been increased by Volume Upgrades, and also other external modifiers (seeIItemRegistry.registerPneumaticVolumeModifier(ItemVolumeModifier)).- Specified by:
getVolumein interfaceIAirHandler- Returns:
- the effective volume, in mL
-
maxPressure
public float maxPressure()Description copied from interface:IAirHandlerGet 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:
maxPressurein interfaceIAirHandler- Returns:
- the maximum pressure for this handler
-
serializeNBT
public net.minecraft.nbt.CompoundTag serializeNBT()- Specified by:
serializeNBTin interfacenet.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
-
deserializeNBT
public void deserializeNBT(net.minecraft.nbt.CompoundTag nbt) - Specified by:
deserializeNBTin interfacenet.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
-