Package net.jcm.vsch.blocks.thruster
Class ThrusterEngine
java.lang.Object
net.jcm.vsch.blocks.thruster.ThrusterEngine
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedThrusterEngine(int tanks, int energyConsumeRate, float maxThrottle) -
Method Summary
Modifier and TypeMethodDescriptionintfloatintgetTanks()booleanisValidFuel(int tank, net.minecraft.world.level.material.Fluid fluid) isValidFuel checks if the fluid can be uses as fuel.static voidsimpleTickBurningObjects(ThrusterEngineContext context, List<net.minecraft.core.BlockPos> thrusters, net.minecraft.core.Direction direction, double maxDistance, int maxBurnDamage, double maxPushVel) simpleTickBurningObjects do some basic operations on the entities / blocks the thruster facing.voidtick(ThrusterEngineContext context) ticks the engine with given power, which consumes energy and fuel, and update the actual achieved power based on available energy and fuel.abstract voidtickBurningObjects(ThrusterEngineContext context, List<net.minecraft.core.BlockPos> thrusters, net.minecraft.core.Direction direction) tickBurningObjects sets on fire entities/blocks that should be burned by the thruster
-
Constructor Details
-
ThrusterEngine
protected ThrusterEngine(int tanks, int energyConsumeRate, float maxThrottle)
-
-
Method Details
-
getTanks
public int getTanks() -
getEnergyConsumeRate
public int getEnergyConsumeRate() -
getMaxThrottle
public float getMaxThrottle() -
isValidFuel
public boolean isValidFuel(int tank, net.minecraft.world.level.material.Fluid fluid) isValidFuel checks if the fluid can be uses as fuel. same fluid must NOT be able to fill in two different tanks.- Parameters:
tank- The tank the fuel is going to transfer influid- The fuel's fluid stack- Returns:
trueif the fluid is consumable,falseotherwise
-
tick
ticks the engine with given power, which consumes energy and fuel, and update the actual achieved power based on available energy and fuel.- Parameters:
context- AThrusterEngineContext- See Also:
-
tickBurningObjects
public abstract void tickBurningObjects(ThrusterEngineContext context, List<net.minecraft.core.BlockPos> thrusters, net.minecraft.core.Direction direction) tickBurningObjects sets on fire entities/blocks that should be burned by the thruster- Parameters:
context- AThrusterEngineContext, should never be modifiedthrusters- Thrusters' positionsdirection- Thrusters' facing direction
-
simpleTickBurningObjects
public static void simpleTickBurningObjects(ThrusterEngineContext context, List<net.minecraft.core.BlockPos> thrusters, net.minecraft.core.Direction direction, double maxDistance, int maxBurnDamage, double maxPushVel) simpleTickBurningObjects do some basic operations on the entities / blocks the thruster facing.
Implement details:
- It does a ray detection from middle of a thruster, find the maximum distance flame can go before it hits a block.
-
If the ray hits a block:
- If the block (or its super class) is a TNT, ignite it.
- Otherwise, set the block on fire on each side.
- It collects all entity in the flame collision box.
- If an entity is pushable, push it based on its distance from the thruster
-
If an entity is not
fireImmuneignite the entity up to 15s based on the its distance from thruster - Hurt the entity due fire with at least 1 damage, which increase linearly if the entity is closer than 10% of the thruster's max distance.
- Parameters:
context- AThrusterEngineContextthrusters- Thrusters' positionsdirection- Thrusters' facing directionmaxDistance- Thrusters' max flame lengthmaxBurnDamage- Thrusters' flame's max burn damagemaxPushVel- Thrusters' flame's max push accleration
-