Class EntityMinecartAbstract

All Implemented Interfaces:
EntityInteractable, EntityRideable, Metadatable, Cloneable
Direct Known Subclasses:
EntityMinecartChest, EntityMinecartEmpty, EntityMinecartHopper, EntityMinecartTNT

public abstract class EntityMinecartAbstract extends EntityVehicle
Since:
2017/6/26
Author:
larryTheCoder (Nukkit Project, Minecart and Riding Project)
  • Constructor Details

  • Method Details

    • getType

      public abstract MinecartType getType()
    • isRideable

      public abstract boolean isRideable()
    • getHeight

      public float getHeight()
      Overrides:
      getHeight in class Entity
    • getWidth

      public float getWidth()
      Overrides:
      getWidth in class Entity
    • getDrag

      protected float getDrag()
      Overrides:
      getDrag in class Entity
    • getBaseOffset

      public float getBaseOffset()
      Overrides:
      getBaseOffset in class Entity
    • canDoInteraction

      public boolean canDoInteraction()
      Specified by:
      canDoInteraction in interface EntityInteractable
      Overrides:
      canDoInteraction in class EntityVehicle
    • initEntity

      public void initEntity()
      Overrides:
      initEntity in class Entity
    • onUpdate

      @PowerNukkitDifference(since="1.3.1.2-PN", info="Will despawn instantly after being \'killed\'") public boolean onUpdate(int currentTick)
      Overrides:
      onUpdate in class EntityVehicle
    • attack

      public boolean attack(EntityDamageEvent source)
      Description copied from class: Entity
      当一个实体被攻击时(即接受一个实体伤害事件 这个事件可以是由其他实体攻击导致,也可能是自然伤害)调用.

      Called when an entity is attacked (i.e. receives an entity damage event. This event can be caused by an attack by another entity, or it can be a natural damage).

      Overrides:
      attack in class EntityVehicle
      Parameters:
      source - 记录伤害源的事件
      Record the event of the source of the attack
      Returns:
      是否攻击成功
      Whether the attack was successful
    • dropItem

      public void dropItem()
    • kill

      @PowerNukkitDifference(info="Fixes a dupe issue when attacking too quickly", since="1.3.1.2-PN") public void kill()
      Overrides:
      kill in class Entity
    • close

      @PowerNukkitDifference(info="Will not make a smoke particle and will do a proper dismount on the entities", since="1.3.1.2-PN") public void close()
      Overrides:
      close in class Entity
    • onInteract

      public boolean onInteract(Player p, Item item, Vector3 clickedPos)
      Overrides:
      onInteract in class Entity
    • applyEntityCollision

      public void applyEntityCollision(Entity entity)
      Overrides:
      applyEntityCollision in class Entity
    • saveNBT

      public void saveNBT()
      Overrides:
      saveNBT in class Entity
    • getMaxSpeed

      public double getMaxSpeed()
    • activate

      protected void activate(int x, int y, int z, boolean flag)
    • setCurrentSpeed

      public void setCurrentSpeed(double speed)
      Used to multiply the minecart current speed
      Parameters:
      speed - The speed of the minecart that will be calculated
    • setDisplayBlock

      public boolean setDisplayBlock(Block block)
      Set the minecart display block
      Parameters:
      block - The block that will changed. Set null for BlockAir
      Returns:
      true if the block is normal block
    • setDisplayBlock

      public boolean setDisplayBlock(Block block, boolean update)
      Set the minecart display block
      Parameters:
      block - The block that will changed. Set null for BlockAir
      update - Do update for the block. (This state changes if you want to show the block)
      Returns:
      true if the block is normal block
    • getDisplayBlock

      public Block getDisplayBlock()
      Get the minecart display block
      Returns:
      Block of minecart display block
    • getDisplayBlockOffset

      public int getDisplayBlockOffset()
      Get the block display offset
      Returns:
      integer
    • setDisplayBlockOffset

      public void setDisplayBlockOffset(int offset)
      Set the block offset.
      Parameters:
      offset - The offset
    • isSlowWhenEmpty

      public boolean isSlowWhenEmpty()
      Is the minecart can be slowed when empty?
      Returns:
      boolean
    • setSlowWhenEmpty

      public void setSlowWhenEmpty(boolean slow)
      Set the minecart slowdown flag
      Parameters:
      slow - The slowdown flag
    • getFlyingVelocityMod

      public Vector3 getFlyingVelocityMod()
    • setFlyingVelocityMod

      public void setFlyingVelocityMod(Vector3 flying)
    • getDerailedVelocityMod

      public Vector3 getDerailedVelocityMod()
    • setDerailedVelocityMod

      public void setDerailedVelocityMod(Vector3 derailed)
    • setMaximumSpeed

      public void setMaximumSpeed(double speed)