Class AbstractMinecart

All Implemented Interfaces:
DataComponentGetter, SyncedDataHolder, EntityAccess, UniquelyIdentifyable, Nameable, ScoreHolder, IAttachmentHolder, IEntityExtension
Direct Known Subclasses:
AbstractMinecartContainer, Minecart, MinecartCommandBlock, MinecartFurnace, MinecartSpawner, MinecartTNT

public abstract class AbstractMinecart extends VehicleEntity
  • Field Details

  • Constructor Details

    • AbstractMinecart

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

      protected AbstractMinecart(EntityType<?> pEntityType, Level pLevel, double pX, double pY, double pZ)
  • Method Details

    • setInitialPos

      public void setInitialPos(double pX, double pY, double pZ)
    • createMinecart

      @Nullable public static <T extends AbstractMinecart> T createMinecart(Level pLevel, double pX, double pY, double pZ, EntityType<T> pType, EntitySpawnReason pSpawnReason, ItemStack pSpawnedFrom, @Nullable Player pPlayer)
    • getBehavior

      public MinecartBehavior getBehavior()
    • getMovementEmission

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

      protected void defineSynchedData(SynchedEntityData.Builder p_326247_)
      Overrides:
      defineSynchedData in class VehicleEntity
    • canCollideWith

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

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

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

      protected Vec3 getPassengerAttachmentPoint(Entity p_294753_, EntityDimensions p_295251_, float p_296054_)
      Overrides:
      getPassengerAttachmentPoint in class Entity
    • getDismountLocationForPassenger

      public Vec3 getDismountLocationForPassenger(LivingEntity pLivingEntity)
      Overrides:
      getDismountLocationForPassenger in class Entity
    • getBlockSpeedFactor

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

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

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

      public static com.mojang.datafixers.util.Pair<Vec3i,Vec3i> exits(RailShape pShape)
    • getMotionDirection

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

      protected double getDefaultGravity()
      Overrides:
      getDefaultGravity in class Entity
    • tick

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

      public boolean isFirstTick()
    • getCurrentBlockPosOrRailBelow

      public BlockPos getCurrentBlockPosOrRailBelow()
    • getMaxSpeed

      protected double getMaxSpeed(ServerLevel pLevel)
    • activateMinecart

      public void activateMinecart(int pX, int pY, int pZ, boolean pPowered)
      Called every tick the minecart is on an activator rail.
    • lerpPositionAndRotationStep

      public void lerpPositionAndRotationStep(int p_364572_, double p_364337_, double p_362183_, double p_362957_, double p_363121_, double p_365178_)
      Overrides:
      lerpPositionAndRotationStep in class Entity
    • applyGravity

      public void applyGravity()
      Overrides:
      applyGravity in class Entity
    • reapplyPosition

      public void reapplyPosition()
      Overrides:
      reapplyPosition in class Entity
    • updateInWaterStateAndDoFluidPushing

      public boolean updateInWaterStateAndDoFluidPushing()
      Overrides:
      updateInWaterStateAndDoFluidPushing in class Entity
    • getKnownMovement

      public Vec3 getKnownMovement()
      Overrides:
      getKnownMovement in class Entity
    • getInterpolation

      public InterpolationHandler getInterpolation()
      Overrides:
      getInterpolation in class Entity
    • lerpMotion

      public void lerpMotion(double pX, double pY, double pZ)
      Updates the entity motion clientside, called by packets from the server
      Overrides:
      lerpMotion in class Entity
    • moveAlongTrack

      protected void moveAlongTrack(ServerLevel pLevel)
    • comeOffTrack

      protected void comeOffTrack(ServerLevel pLevel)
    • makeStepAlongTrack

      protected double makeStepAlongTrack(BlockPos pPos, RailShape pRailShape, double pSpeed)
    • move

      public void move(MoverType p_362087_, Vec3 p_363190_)
      Overrides:
      move in class Entity
    • applyEffectsFromBlocks

      public void applyEffectsFromBlocks()
      Overrides:
      applyEffectsFromBlocks in class Entity
    • isOnRails

      public boolean isOnRails()
      Overrides:
      isOnRails in class Entity
    • setOnRails

      public void setOnRails(boolean pOnRails)
    • isFlipped

      public boolean isFlipped()
    • setFlipped

      public void setFlipped(boolean pFlipped)
    • getRedstoneDirection

      public Vec3 getRedstoneDirection(BlockPos pPos)
    • isRedstoneConductor

      public boolean isRedstoneConductor(BlockPos pPos)
    • applyNaturalSlowdown

      protected Vec3 applyNaturalSlowdown(Vec3 pSpeed)
    • readAdditionalSaveData

      protected void readAdditionalSaveData(CompoundTag pCompound)
      (abstract) Protected helper method to read subclass entity data from NBT.
      Specified by:
      readAdditionalSaveData in class Entity
    • addAdditionalSaveData

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

      public void push(Entity pEntity)
      Applies a velocity to the entities, to push them away from each other.
      Overrides:
      push in class Entity
    • pushOtherMinecart

      private void pushOtherMinecart(AbstractMinecart pOtherMinecart, double pDeltaX, double pDeltaZ)
    • getDisplayBlockState

      public BlockState getDisplayBlockState()
    • getCustomDisplayBlockState

      private Optional<BlockState> getCustomDisplayBlockState()
    • getDefaultDisplayBlockState

      public BlockState getDefaultDisplayBlockState()
    • getDisplayOffset

      public int getDisplayOffset()
    • getDefaultDisplayOffset

      public int getDefaultDisplayOffset()
    • setCustomDisplayBlockState

      public void setCustomDisplayBlockState(Optional<BlockState> pCustomDisplayBlockState)
    • setDisplayOffset

      public void setDisplayOffset(int pDisplayOffset)
    • useExperimentalMovement

      public static boolean useExperimentalMovement(Level pLevel)
    • getPickResult

      public abstract ItemStack getPickResult()
      Overrides:
      getPickResult in class Entity
    • isRideable

      public boolean isRideable()
    • isFurnace

      public boolean isFurnace()