Class AbstractMinecart

All Implemented Interfaces:
CommandSource, EntityAccess, Nameable, ICapabilityProvider, ICapabilityProviderImpl<Entity>, ICapabilitySerializable<CompoundTag>, IForgeAbstractMinecart, IForgeEntity, INBTSerializable<CompoundTag>
Direct Known Subclasses:
AbstractMinecartContainer, Minecart, MinecartCommandBlock, MinecartFurnace, MinecartSpawner, MinecartTNT

public abstract class AbstractMinecart extends Entity implements IForgeAbstractMinecart
  • Field Details

    • DATA_ID_HURT

      private static final EntityDataAccessor<Integer> DATA_ID_HURT
    • DATA_ID_HURTDIR

      private static final EntityDataAccessor<Integer> DATA_ID_HURTDIR
    • DATA_ID_DAMAGE

      private static final EntityDataAccessor<Float> DATA_ID_DAMAGE
    • DATA_ID_DISPLAY_BLOCK

      private static final EntityDataAccessor<Integer> DATA_ID_DISPLAY_BLOCK
    • DATA_ID_DISPLAY_OFFSET

      private static final EntityDataAccessor<Integer> DATA_ID_DISPLAY_OFFSET
    • DATA_ID_CUSTOM_DISPLAY

      private static final EntityDataAccessor<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
    • WATER_SLOWDOWN_FACTOR

      protected static final float WATER_SLOWDOWN_FACTOR
      See Also:
    • flipped

      private boolean flipped
    • EXITS

      private static final Map<RailShape,com.mojang.datafixers.util.Pair<Vec3i,Vec3i>> 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

      @Nullable private @Nullable Float maxSpeedAirLateral
    • maxSpeedAirVertical

      private float maxSpeedAirVertical
    • dragAir

      private double dragAir
  • Constructor Details

    • AbstractMinecart

      protected AbstractMinecart(EntityType<?> p_38087_, Level p_38088_)
    • AbstractMinecart

      protected AbstractMinecart(EntityType<?> p_38090_, Level p_38091_, double p_38092_, double p_38093_, double p_38094_)
  • Method Details

    • getCollisionHandler

      public IMinecartCollisionHandler getCollisionHandler()
    • registerCollisionHandler

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

      public static AbstractMinecart createMinecart(Level p_38120_, double p_38121_, double p_38122_, double p_38123_, AbstractMinecart.Type p_38124_)
    • getMovementEmission

      protected Entity.MovementEmission getMovementEmission()
      Overrides:
      getMovementEmission in class Entity
    • defineSynchedData

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

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

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

      protected Vec3 getRelativePortalPosition(Direction.Axis p_38132_, BlockUtil.FoundRectangle p_38133_)
      Overrides:
      getRelativePortalPosition in class Entity
    • getPassengersRidingOffset

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

      public Vec3 getDismountLocationForPassenger(LivingEntity p_38145_)
      Overrides:
      getDismountLocationForPassenger in class Entity
    • hurt

      public boolean hurt(DamageSource p_38117_, float p_38118_)
      Overrides:
      hurt in class Entity
    • getBlockSpeedFactor

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

      public void destroy(DamageSource p_38115_)
    • getDropItem

      protected abstract Item getDropItem()
    • 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<Vec3i,Vec3i> exits(RailShape p_38126_)
    • 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_38111_, int p_38112_, int p_38113_, boolean p_38114_)
    • comeOffTrack

      protected void comeOffTrack()
    • moveAlongTrack

      protected void moveAlongTrack(BlockPos p_38156_, BlockState p_38157_)
    • isRedstoneConductor

      private boolean isRedstoneConductor(BlockPos p_38130_)
    • applyNaturalSlowdown

      protected void applyNaturalSlowdown()
    • getPosOffs

      @Nullable public Vec3 getPosOffs(double p_38097_, double p_38098_, double p_38099_, double p_38100_)
    • getPos

      @Nullable public Vec3 getPos(double p_38180_, double p_38181_, double p_38182_)
    • getBoundingBoxForCulling

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

      protected void readAdditionalSaveData(CompoundTag p_38137_)
      Specified by:
      readAdditionalSaveData in class Entity
    • addAdditionalSaveData

      protected void addAdditionalSaveData(CompoundTag p_38151_)
      Specified by:
      addAdditionalSaveData in class Entity
    • push

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

      public void lerpTo(double p_38102_, double p_38103_, double p_38104_, float p_38105_, float p_38106_, int p_38107_, boolean p_38108_)
      Overrides:
      lerpTo in class Entity
    • lerpMotion

      public void lerpMotion(double p_38171_, double p_38172_, double p_38173_)
      Overrides:
      lerpMotion in class Entity
    • setDamage

      public void setDamage(float p_38110_)
    • getDamage

      public float getDamage()
    • setHurtTime

      public void setHurtTime(int p_38155_)
    • getHurtTime

      public int getHurtTime()
    • setHurtDir

      public void setHurtDir(int p_38161_)
    • getHurtDir

      public int getHurtDir()
    • getMinecartType

      public abstract AbstractMinecart.Type getMinecartType()
    • getDisplayBlockState

      public BlockState getDisplayBlockState()
    • getDefaultDisplayBlockState

      public BlockState getDefaultDisplayBlockState()
    • getDisplayOffset

      public int getDisplayOffset()
    • getDefaultDisplayOffset

      public int getDefaultDisplayOffset()
    • setDisplayBlockState

      public void setDisplayBlockState(BlockState p_38147_)
    • setDisplayOffset

      public void setDisplayOffset(int p_38175_)
    • hasCustomDisplay

      public boolean hasCustomDisplay()
    • setCustomDisplay

      public void setCustomDisplay(boolean p_38139_)
    • getAddEntityPacket

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

      public boolean canUseRail()
      Description copied from interface: IForgeAbstractMinecart
      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 IForgeAbstractMinecart
      Returns:
      True if the minecart can use rails.
    • setCanUseRail

      public void setCanUseRail(boolean value)
      Description copied from interface: IForgeAbstractMinecart
      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 IForgeAbstractMinecart
      Parameters:
      value - Whether the minecart can currently use rails.
    • getCurrentCartSpeedCapOnRail

      public float getCurrentCartSpeedCapOnRail()
      Description copied from interface: IForgeAbstractMinecart
      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 IForgeAbstractMinecart
    • setCurrentCartSpeedCapOnRail

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

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

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

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

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

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

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

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

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

      public ItemStack getPickResult()
      Overrides:
      getPickResult in class Entity