Class ThrusterEngine

java.lang.Object
net.jcm.vsch.blocks.thruster.ThrusterEngine

public abstract class ThrusterEngine extends Object
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    ThrusterEngine(int tanks, int energyConsumeRate, float maxThrottle)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
     
    float
     
    int
     
    boolean
    isValidFuel(int tank, net.minecraft.world.level.material.Fluid fluid)
    isValidFuel checks if the fluid can be uses as fuel.
    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.
    void
    ticks the engine with given power, which consumes energy and fuel, and update the actual achieved power based on available energy and fuel.
    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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 in
      fluid - The fuel's fluid stack
      Returns:
      true if the fluid is consumable, false otherwise
    • tick

      public void tick(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.
      Parameters:
      context - A ThrusterEngineContext
      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 - A ThrusterEngineContext, should never be modified
      thrusters - Thrusters' positions
      direction - 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:
      1. It does a ray detection from middle of a thruster, find the maximum distance flame can go before it hits a block.
      2. If the ray hits a block:
        1. If the block (or its super class) is a TNT, ignite it.
        2. Otherwise, set the block on fire on each side.
      3. It collects all entity in the flame collision box.
      4. If an entity is pushable, push it based on its distance from the thruster
      5. If an entity is not fireImmune ignite the entity up to 15s based on the its distance from thruster
      6. 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 - A ThrusterEngineContext
      thrusters - Thrusters' positions
      direction - Thrusters' facing direction
      maxDistance - Thrusters' max flame length
      maxBurnDamage - Thrusters' flame's max burn damage
      maxPushVel - Thrusters' flame's max push accleration