Class AbstractMinecartEntity

All Implemented Interfaces:
ICommandSource, INameable, ICapabilityProvider, ICapabilitySerializable<CompoundNBT>, IForgeEntity, IForgeEntityMinecart, INBTSerializable<CompoundNBT>
Direct Known Subclasses:
CommandBlockMinecartEntity, ContainerMinecartEntity, FurnaceMinecartEntity, MinecartEntity, SpawnerMinecartEntity, TNTMinecartEntity

public abstract class AbstractMinecartEntity extends Entity implements IForgeEntityMinecart
  • Field Details

    • DATA_ID_HURT

      private static final DataParameter<Integer> DATA_ID_HURT
    • DATA_ID_HURTDIR

      private static final DataParameter<Integer> DATA_ID_HURTDIR
    • DATA_ID_DAMAGE

      private static final DataParameter<Float> DATA_ID_DAMAGE
    • DATA_ID_DISPLAY_BLOCK

      private static final DataParameter<Integer> DATA_ID_DISPLAY_BLOCK
    • DATA_ID_DISPLAY_OFFSET

      private static final DataParameter<Integer> DATA_ID_DISPLAY_OFFSET
    • DATA_ID_CUSTOM_DISPLAY

      private static final DataParameter<Boolean> DATA_ID_CUSTOM_DISPLAY
    • POSE_DISMOUNT_HEIGHTS

      private static final com.google.common.collect.ImmutableMap<Pose,com.google.common.collect.ImmutableList<Integer>> POSE_DISMOUNT_HEIGHTS
    • flipped

      private boolean flipped
    • EXITS

      private static final Map<RailShape,com.mojang.datafixers.util.Pair<Vector3i,Vector3i>> EXITS
    • COLLISIONS

      private static IMinecartCollisionHandler COLLISIONS
    • lSteps

      private int lSteps
    • lx

      private double lx
    • ly

      private double ly
    • lz

      private double lz
    • lyr

      private double lyr
    • lxr

      private double lxr
    • lxd

      private double lxd
    • lyd

      private double lyd
    • lzd

      private double lzd
    • canBePushed

      private boolean canBePushed
    • canUseRail

      private boolean canUseRail
    • currentSpeedCapOnRail

      private float currentSpeedCapOnRail
    • maxSpeedAirLateral

      private float maxSpeedAirLateral
    • maxSpeedAirVertical

      private float maxSpeedAirVertical
    • dragAir

      private double dragAir
  • Constructor Details

    • AbstractMinecartEntity

      protected AbstractMinecartEntity(EntityType<?> p_i48538_1_, World p_i48538_2_)
    • AbstractMinecartEntity

      protected AbstractMinecartEntity(EntityType<?> p_i48539_1_, World p_i48539_2_, double p_i48539_3_, double p_i48539_5_, double p_i48539_7_)
  • Method Details

    • getCollisionHandler

      public IMinecartCollisionHandler getCollisionHandler()
      Description copied from interface: IForgeEntityMinecart
      Gets the current global Minecart Collision handler if none is registered, returns null TODO: remove 1.17
      Specified by:
      getCollisionHandler in interface IForgeEntityMinecart
      Returns:
      The collision handler or null
    • registerCollisionHandler

      public static void registerCollisionHandler(@Nullable IMinecartCollisionHandler handler)
    • createMinecart

      public static AbstractMinecartEntity createMinecart(World p_184263_0_, double p_184263_1_, double p_184263_3_, double p_184263_5_, AbstractMinecartEntity.Type p_184263_7_)
    • isMovementNoisy

      protected boolean isMovementNoisy()
      Overrides:
      isMovementNoisy in class Entity
    • defineSynchedData

      protected void defineSynchedData()
      Specified by:
      defineSynchedData in class Entity
    • canCollideWith

      public boolean canCollideWith(Entity p_241849_1_)
      Overrides:
      canCollideWith in class Entity
    • isPushable

      public boolean isPushable()
      Overrides:
      isPushable in class Entity
    • getRelativePortalPosition

      protected Vector3d getRelativePortalPosition(Direction.Axis p_241839_1_, TeleportationRepositioner.Result p_241839_2_)
      Overrides:
      getRelativePortalPosition in class Entity
    • getPassengersRidingOffset

      public double getPassengersRidingOffset()
      Overrides:
      getPassengersRidingOffset in class Entity
    • getDismountLocationForPassenger

      public Vector3d getDismountLocationForPassenger(LivingEntity p_230268_1_)
      Overrides:
      getDismountLocationForPassenger in class Entity
    • hurt

      public boolean hurt(DamageSource p_70097_1_, float p_70097_2_)
      Overrides:
      hurt in class Entity
    • getBlockSpeedFactor

      protected float getBlockSpeedFactor()
      Overrides:
      getBlockSpeedFactor in class Entity
    • destroy

      public void destroy(DamageSource p_94095_1_)
    • animateHurt

      public void animateHurt()
      Overrides:
      animateHurt in class Entity
    • isPickable

      public boolean isPickable()
      Overrides:
      isPickable in class Entity
    • exits

      private static com.mojang.datafixers.util.Pair<Vector3i,Vector3i> exits(RailShape p_226573_0_)
    • getMotionDirection

      public Direction getMotionDirection()
      Overrides:
      getMotionDirection in class Entity
    • tick

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

      protected double getMaxSpeed()
    • activateMinecart

      public void activateMinecart(int p_96095_1_, int p_96095_2_, int p_96095_3_, boolean p_96095_4_)
    • comeOffTrack

      protected void comeOffTrack()
    • moveAlongTrack

      protected void moveAlongTrack(BlockPos p_180460_1_, BlockState p_180460_2_)
    • isRedstoneConductor

      private boolean isRedstoneConductor(BlockPos p_213900_1_)
    • applyNaturalSlowdown

      protected void applyNaturalSlowdown()
    • getPosOffs

      @Nullable public Vector3d getPosOffs(double p_70495_1_, double p_70495_3_, double p_70495_5_, double p_70495_7_)
    • getPos

      @Nullable public Vector3d getPos(double p_70489_1_, double p_70489_3_, double p_70489_5_)
    • getBoundingBoxForCulling

      public AxisAlignedBB getBoundingBoxForCulling()
      Overrides:
      getBoundingBoxForCulling in class Entity
    • readAdditionalSaveData

      protected void readAdditionalSaveData(CompoundNBT p_70037_1_)
      Specified by:
      readAdditionalSaveData in class Entity
    • addAdditionalSaveData

      protected void addAdditionalSaveData(CompoundNBT p_213281_1_)
      Specified by:
      addAdditionalSaveData in class Entity
    • push

      public void push(Entity p_70108_1_)
      Overrides:
      push in class Entity
    • lerpTo

      public void lerpTo(double p_180426_1_, double p_180426_3_, double p_180426_5_, float p_180426_7_, float p_180426_8_, int p_180426_9_, boolean p_180426_10_)
      Overrides:
      lerpTo in class Entity
    • lerpMotion

      public void lerpMotion(double p_70016_1_, double p_70016_3_, double p_70016_5_)
      Overrides:
      lerpMotion in class Entity
    • setDamage

      public void setDamage(float p_70492_1_)
    • getDamage

      public float getDamage()
    • setHurtTime

      public void setHurtTime(int p_70497_1_)
    • getHurtTime

      public int getHurtTime()
    • setHurtDir

      public void setHurtDir(int p_70494_1_)
    • getHurtDir

      public int getHurtDir()
    • getMinecartType

      public abstract AbstractMinecartEntity.Type getMinecartType()
    • getDisplayBlockState

      public BlockState getDisplayBlockState()
    • getDefaultDisplayBlockState

      public BlockState getDefaultDisplayBlockState()
    • getDisplayOffset

      public int getDisplayOffset()
    • getDefaultDisplayOffset

      public int getDefaultDisplayOffset()
    • setDisplayBlockState

      public void setDisplayBlockState(BlockState p_174899_1_)
    • setDisplayOffset

      public void setDisplayOffset(int p_94086_1_)
    • hasCustomDisplay

      public boolean hasCustomDisplay()
    • setCustomDisplay

      public void setCustomDisplay(boolean p_94096_1_)
    • getAddEntityPacket

      public IPacket<?> getAddEntityPacket()
      Specified by:
      getAddEntityPacket in class Entity
    • canUseRail

      public boolean canUseRail()
      Description copied from interface: IForgeEntityMinecart
      Returns true if this cart can currently use rails. This function is mainly used to gracefully detach a minecart from a rail.
      Specified by:
      canUseRail in interface IForgeEntityMinecart
      Returns:
      True if the minecart can use rails.
    • setCanUseRail

      public void setCanUseRail(boolean value)
      Description copied from interface: IForgeEntityMinecart
      Set whether the minecart can use rails. This function is mainly used to gracefully detach a minecart from a rail.
      Specified by:
      setCanUseRail in interface IForgeEntityMinecart
      Parameters:
      value - Whether the minecart can currently use rails.
    • getCurrentCartSpeedCapOnRail

      public float getCurrentCartSpeedCapOnRail()
      Description copied from interface: IForgeEntityMinecart
      Returns the current speed cap for the cart when traveling on rails. This functions differs from getMaxCartSpeedOnRail() in that it controls current movement and cannot be overridden. The value however can never be higher than getMaxCartSpeedOnRail().
      Specified by:
      getCurrentCartSpeedCapOnRail in interface IForgeEntityMinecart
      Returns:
    • setCurrentCartSpeedCapOnRail

      public void setCurrentCartSpeedCapOnRail(float value)
      Specified by:
      setCurrentCartSpeedCapOnRail in interface IForgeEntityMinecart
    • getMaxSpeedAirLateral

      public float getMaxSpeedAirLateral()
      Specified by:
      getMaxSpeedAirLateral in interface IForgeEntityMinecart
    • setMaxSpeedAirLateral

      public void setMaxSpeedAirLateral(float value)
      Specified by:
      setMaxSpeedAirLateral in interface IForgeEntityMinecart
    • getMaxSpeedAirVertical

      public float getMaxSpeedAirVertical()
      Specified by:
      getMaxSpeedAirVertical in interface IForgeEntityMinecart
    • setMaxSpeedAirVertical

      public void setMaxSpeedAirVertical(float value)
      Specified by:
      setMaxSpeedAirVertical in interface IForgeEntityMinecart
    • getDragAir

      public double getDragAir()
      Specified by:
      getDragAir in interface IForgeEntityMinecart
    • setDragAir

      public void setDragAir(double value)
      Specified by:
      setDragAir in interface IForgeEntityMinecart
    • getMaxSpeedWithRail

      public double getMaxSpeedWithRail()
      Specified by:
      getMaxSpeedWithRail in interface IForgeEntityMinecart
    • moveMinecartOnRail

      public void moveMinecartOnRail(BlockPos pos)
      Description copied from interface: IForgeEntityMinecart
      Moved to allow overrides. This code handles minecart movement and speed capping when on a rail.
      Specified by:
      moveMinecartOnRail in interface IForgeEntityMinecart