Skip to content

Custom gas behaviour for your entities

Pyrofab edited this page Feb 10, 2018 · 1 revision

There are 2 main ways of making Gaspunk's gases affect your entities differently.

1- The easy way

If you just want to make your entities immune to gas, simply override the decreaseAirSupply method in your entity, like iron golems do. This will also prevent your entity from drowning. You can also use this to make your entity's air supply drop faster both in water and in gases.

2- The flexible way

If you want more control, your entity can offer a custom IBreathingHandler. This capability handles everything gas-related on the entity's side. The default one is attached through the AttachCapabilitiesEvent so any instance returned by an overriden getCapability method in your entity will take precedence. This allows you full control over gas affecting your entities but requires that you setuo Gaspunk in your workspace.

Clone this wiki locally