Class AbstractMinecartEntity
- java.lang.Object
-
- net.minecraftforge.common.capabilities.CapabilityProvider<Entity>
-
- net.minecraft.entity.Entity
-
- net.minecraft.entity.item.minecart.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AbstractMinecartEntity.Type
-
Nested classes/interfaces inherited from class net.minecraft.entity.Entity
Entity.IMoveCallback
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
canBePushed
private boolean
canUseRail
private static IMinecartCollisionHandler
COLLISIONS
private float
currentSpeedCapOnRail
private static DataParameter<java.lang.Boolean>
DATA_ID_CUSTOM_DISPLAY
private static DataParameter<java.lang.Float>
DATA_ID_DAMAGE
private static DataParameter<java.lang.Integer>
DATA_ID_DISPLAY_BLOCK
private static DataParameter<java.lang.Integer>
DATA_ID_DISPLAY_OFFSET
private static DataParameter<java.lang.Integer>
DATA_ID_HURT
private static DataParameter<java.lang.Integer>
DATA_ID_HURTDIR
private double
dragAir
private static java.util.Map<RailShape,com.mojang.datafixers.util.Pair<Vector3i,Vector3i>>
EXITS
private boolean
flipped
private int
lSteps
private double
lx
private double
lxd
private double
lxr
private double
ly
private double
lyd
private double
lyr
private double
lz
private double
lzd
private float
maxSpeedAirLateral
private float
maxSpeedAirVertical
private static com.google.common.collect.ImmutableMap<Pose,com.google.common.collect.ImmutableList<java.lang.Integer>>
POSE_DISMOUNT_HEIGHTS
-
Fields inherited from class net.minecraft.entity.Entity
blocksBuilding, boardingCooldown, DATA_POSE, DATA_SHARED_FLAGS_ID, ENTITY_COUNTER, entityData, fallDistance, firstTick, fluidHeight, fluidOnEyes, forcedLoading, glowing, hasImpulse, horizontalCollision, hurtMarked, inChunk, invulnerableTime, isInsidePortal, level, LOGGER, maxUpStep, moveDist, noCulling, noPhysics, onGround, portalEntrancePos, portalTime, pushthrough, random, removed, stringUUID, stuckSpeedMultiplier, tickCount, uuid, verticalCollision, walkDist, walkDistO, wasEyeInWater, wasTouchingWater, xChunk, xo, xOld, xRot, xRotO, yChunk, yo, yOld, yRot, yRotO, zChunk, zo, zOld
-
Fields inherited from interface net.minecraft.command.ICommandSource
NULL
-
Fields inherited from interface net.minecraftforge.common.extensions.IForgeEntityMinecart
DEFAULT_AIR_DRAG, DEFAULT_MAX_SPEED_AIR_LATERAL, DEFAULT_MAX_SPEED_AIR_VERTICAL
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractMinecartEntity(EntityType<?> p_i48538_1_, World p_i48538_2_)
protected
AbstractMinecartEntity(EntityType<?> p_i48539_1_, World p_i48539_2_, double p_i48539_3_, double p_i48539_5_, double p_i48539_7_)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
activateMinecart(int p_96095_1_, int p_96095_2_, int p_96095_3_, boolean p_96095_4_)
protected void
addAdditionalSaveData(CompoundNBT p_213281_1_)
void
animateHurt()
protected void
applyNaturalSlowdown()
boolean
canCollideWith(Entity p_241849_1_)
boolean
canUseRail()
Returns true if this cart can currently use rails.protected void
comeOffTrack()
static AbstractMinecartEntity
createMinecart(World p_184263_0_, double p_184263_1_, double p_184263_3_, double p_184263_5_, AbstractMinecartEntity.Type p_184263_7_)
protected void
defineSynchedData()
void
destroy(DamageSource p_94095_1_)
private static com.mojang.datafixers.util.Pair<Vector3i,Vector3i>
exits(RailShape p_226573_0_)
IPacket<?>
getAddEntityPacket()
protected float
getBlockSpeedFactor()
AxisAlignedBB
getBoundingBoxForCulling()
IMinecartCollisionHandler
getCollisionHandler()
Gets the current global Minecart Collision handler if none is registered, returns null TODO: remove 1.17float
getCurrentCartSpeedCapOnRail()
Returns the current speed cap for the cart when traveling on rails.float
getDamage()
BlockState
getDefaultDisplayBlockState()
int
getDefaultDisplayOffset()
Vector3d
getDismountLocationForPassenger(LivingEntity p_230268_1_)
BlockState
getDisplayBlockState()
int
getDisplayOffset()
double
getDragAir()
int
getHurtDir()
int
getHurtTime()
protected double
getMaxSpeed()
float
getMaxSpeedAirLateral()
float
getMaxSpeedAirVertical()
double
getMaxSpeedWithRail()
abstract AbstractMinecartEntity.Type
getMinecartType()
Direction
getMotionDirection()
double
getPassengersRidingOffset()
Vector3d
getPos(double p_70489_1_, double p_70489_3_, double p_70489_5_)
Vector3d
getPosOffs(double p_70495_1_, double p_70495_3_, double p_70495_5_, double p_70495_7_)
protected Vector3d
getRelativePortalPosition(Direction.Axis p_241839_1_, TeleportationRepositioner.Result p_241839_2_)
boolean
hasCustomDisplay()
boolean
hurt(DamageSource p_70097_1_, float p_70097_2_)
protected boolean
isMovementNoisy()
boolean
isPickable()
boolean
isPushable()
private boolean
isRedstoneConductor(BlockPos p_213900_1_)
void
lerpMotion(double p_70016_1_, double p_70016_3_, double p_70016_5_)
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_)
protected void
moveAlongTrack(BlockPos p_180460_1_, BlockState p_180460_2_)
void
moveMinecartOnRail(BlockPos pos)
Moved to allow overrides.void
push(Entity p_70108_1_)
protected void
readAdditionalSaveData(CompoundNBT p_70037_1_)
static void
registerCollisionHandler(IMinecartCollisionHandler handler)
void
setCanUseRail(boolean value)
Set whether the minecart can use rails.void
setCurrentCartSpeedCapOnRail(float value)
void
setCustomDisplay(boolean p_94096_1_)
void
setDamage(float p_70492_1_)
void
setDisplayBlockState(BlockState p_174899_1_)
void
setDisplayOffset(int p_94086_1_)
void
setDragAir(double value)
void
setHurtDir(int p_70494_1_)
void
setHurtTime(int p_70497_1_)
void
setMaxSpeedAirLateral(float value)
void
setMaxSpeedAirVertical(float value)
void
tick()
-
Methods inherited from class net.minecraft.entity.Entity
absMoveTo, absMoveTo, acceptsFailure, acceptsSuccess, addPassenger, addTag, awardKillScore, baseTick, blockPosition, broadcastToPlayer, calculateUpVector, calculateViewVector, canAddPassenger, canBeCollidedWith, canChangeDimensions, canEnterPose, canRide, canSpawnSprintParticle, canTrample, canUpdate, canUpdate, captureDrops, captureDrops, causeFallDamage, changeDimension, changeDimension, checkAndResetForcedChunkAdditionFlag, checkAndResetUpdateChunkPos, checkDespawn, checkFallDamage, checkInsideBlocks, clearFire, closerThan, collideBoundingBox, collideBoundingBoxHeuristically, collideBoundingBoxLegacy, copyPosition, createCommandSourceStack, createHoverEvent, displayFireAnimation, distanceTo, distanceToSqr, distanceToSqr, distanceToSqr, doEnchantDamageEffects, doWaterSplashEffect, ejectPassengers, equals, fillCrashReportCategory, findDimensionEntryPoint, fireImmune, getAirSupply, getAllSlots, getArmorSlots, getBbHeight, getBbWidth, getBlockExplosionResistance, getBlockJumpFactor, getBlockPosBelowThatAffectsMyMovement, getBlockStateOn, getBoundingBox, getBoundingBoxForPose, getBrightness, getCollisionHorizontalEscapeVector, getCommandSenderWorld, getControllingPassenger, getCustomName, getDeltaMovement, getDimensionChangingDelay, getDimensions, getDirection, getDisplayName, getEncodeId, getEntityData, getExitPortal, getEyeHeight, getEyeHeight, getEyeHeight, getEyeHeightAccess, getEyePosition, getEyeY, getFireImmuneTicks, getFluidHeight, getFluidJumpThreshold, getForward, getHandSlots, getHorizontalDistanceSqr, getId, getIndirectPassengers, getLeashOffset, getLightProbePosition, getLookAngle, getMaxAirSupply, getMaxFallDistance, getMyRidingOffset, getName, getOnPos, getPacketCoordinates, getPassengers, getPermissionLevel, getPersistentData, getPickRadius, getPistonPushReaction, getPortalWaitTime, getPose, getPosition, getRandomX, getRandomY, getRandomZ, getRemainingFireTicks, getRootVehicle, getRopeHoldPosition, getRotationVector, getScoreboardName, getSelfAndPassengers, getServer, getSharedFlag, getSoundSource, getStringUUID, getSwimHighSpeedSplashSound, getSwimSound, getSwimSplashSound, getTags, getTeam, getTeamColor, getType, getTypeName, getUpVector, getUUID, getVehicle, getViewScale, getViewVector, getViewXRot, getViewYRot, getX, getX, getY, getY, getYHeadRot, getZ, getZ, handleEntityEvent, handleInsidePortal, handleNetherPortal, hasCustomName, hashCode, hasIndirectPassenger, hasOnePlayerPassenger, hasPassenger, hasPassenger, hasPermissions, ignoreExplosion, interact, interactAt, is, isAddedToWorld, isAlive, isAlliedTo, isAlliedTo, isAttackable, isColliding, isControlledByLocalInstance, isCrouching, isCustomNameVisible, isDescending, isDiscrete, isEyeInFluid, isFree, isGlowing, isIgnoringBlockTriggers, isInLava, isInvisible, isInvisibleTo, isInvulnerable, isInvulnerableTo, isInWall, isInWater, isInWaterOrBubble, isInWaterOrRain, isInWaterRainOrBubble, isNoGravity, isOnFire, isOnGround, isOnPortalCooldown, isPassenger, isPassengerOfSameVehicle, isPushedByFluid, isShiftKeyDown, isSilent, isSpectator, isSprinting, isSteppingCarefully, isSuppressingBounce, isSwimming, isUnderWater, isVehicle, isVisuallyCrawling, isVisuallySwimming, kill, killed, lavaHurt, lerpHeadTo, limitPistonMovement, load, lookAt, makeFlySound, makeStuckInBlock, markHurt, maybeBackOffFromEdge, mirror, move, moveRelative, moveTo, moveTo, moveTo, moveTo, moveTowardsClosestSpace, newDoubleList, newFloatList, nextStep, onAboveBubbleCol, onAddedToWorld, onInsideBlock, onInsideBubbleColumn, onlyOpCanSetNbt, onPassengerTurned, onRemovedFromWorld, onSyncedDataUpdated, outOfWorld, pick, playerTouch, playFlySound, playSound, playStepSound, playSwimSound, position, positionRider, processPortalCooldown, push, reapplyPosition, refreshDimensions, remove, remove, removeAfterChangingDimensions, removePassenger, removeTag, removeVehicle, repositionEntityAfterLoad, resetPos, restoreFrom, revive, rideableUnderWater, rideTick, rotate, save, saveAsPassenger, saveWithoutId, sendMessage, setAirSupply, setBoundingBox, setCustomName, setCustomNameVisible, setDeltaMovement, setDeltaMovement, setGlowing, setId, setInvisible, setInvulnerable, setItemSlot, setLevel, setLocationFromBoundingbox, setNoGravity, setOnGround, setPacketCoordinates, setPacketCoordinates, setPortalCooldown, setPos, setPosAndOldPos, setPose, setPosRaw, setRemainingFireTicks, setRot, setSecondsOnFire, setSharedFlag, setShiftKeyDown, setSilent, setSlot, setSprinting, setSwimming, setUUID, setViewScale, setYBodyRot, setYHeadRot, shouldBlockExplode, shouldInformAdmins, shouldRender, shouldRenderAtSqrDistance, shouldShowName, showVehicleHealth, skipAttackInteraction, spawnAtLocation, spawnAtLocation, spawnAtLocation, spawnAtLocation, spawnSprintParticle, startRiding, startRiding, startSeenByPlayer, stopRiding, stopSeenByPlayer, teleportTo, teleportToWithTicket, thunderHit, toString, turn, unRide, updateFluidHeightAndDoFluidPushing, updateInWaterStateAndDoFluidPushing, updateSwimming
-
Methods inherited from class net.minecraftforge.common.capabilities.CapabilityProvider
areCapsCompatible, areCapsCompatible, deserializeCaps, gatherCapabilities, gatherCapabilities, gatherCapabilities, getCapabilities, getCapability, invalidateCaps, reviveCaps, serializeCaps
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.minecraftforge.common.capabilities.ICapabilityProvider
getCapability, getCapability
-
Methods inherited from interface net.minecraftforge.common.extensions.IForgeEntity
canBeRiddenInWater, canRiderInteract, deserializeNBT, getClassification, getDimensionsForge, getEntity, getEyeHeightForge, getParts, getPickedResult, isMultipartEntity, serializeNBT, shouldRiderSit
-
Methods inherited from interface net.minecraftforge.common.extensions.IForgeEntityMinecart
canBeRidden, getCartItem, getComparatorLevel, getCurrentRailPosition, getMaxCartSpeedOnRail, getMinecart, getSlopeAdjustment, isPoweredCart, shouldDoRailFunctions
-
-
-
-
Field Detail
-
DATA_ID_HURT
private static final DataParameter<java.lang.Integer> DATA_ID_HURT
-
DATA_ID_HURTDIR
private static final DataParameter<java.lang.Integer> DATA_ID_HURTDIR
-
DATA_ID_DAMAGE
private static final DataParameter<java.lang.Float> DATA_ID_DAMAGE
-
DATA_ID_DISPLAY_BLOCK
private static final DataParameter<java.lang.Integer> DATA_ID_DISPLAY_BLOCK
-
DATA_ID_DISPLAY_OFFSET
private static final DataParameter<java.lang.Integer> DATA_ID_DISPLAY_OFFSET
-
DATA_ID_CUSTOM_DISPLAY
private static final DataParameter<java.lang.Boolean> DATA_ID_CUSTOM_DISPLAY
-
POSE_DISMOUNT_HEIGHTS
private static final com.google.common.collect.ImmutableMap<Pose,com.google.common.collect.ImmutableList<java.lang.Integer>> POSE_DISMOUNT_HEIGHTS
-
flipped
private boolean flipped
-
EXITS
private static final java.util.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 Detail
-
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 Detail
-
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 interfaceIForgeEntityMinecart
- 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 classEntity
-
defineSynchedData
protected void defineSynchedData()
- Specified by:
defineSynchedData
in classEntity
-
canCollideWith
public boolean canCollideWith(Entity p_241849_1_)
- Overrides:
canCollideWith
in classEntity
-
isPushable
public boolean isPushable()
- Overrides:
isPushable
in classEntity
-
getRelativePortalPosition
protected Vector3d getRelativePortalPosition(Direction.Axis p_241839_1_, TeleportationRepositioner.Result p_241839_2_)
- Overrides:
getRelativePortalPosition
in classEntity
-
getPassengersRidingOffset
public double getPassengersRidingOffset()
- Overrides:
getPassengersRidingOffset
in classEntity
-
getDismountLocationForPassenger
public Vector3d getDismountLocationForPassenger(LivingEntity p_230268_1_)
- Overrides:
getDismountLocationForPassenger
in classEntity
-
hurt
public boolean hurt(DamageSource p_70097_1_, float p_70097_2_)
-
getBlockSpeedFactor
protected float getBlockSpeedFactor()
- Overrides:
getBlockSpeedFactor
in classEntity
-
destroy
public void destroy(DamageSource p_94095_1_)
-
animateHurt
public void animateHurt()
- Overrides:
animateHurt
in classEntity
-
isPickable
public boolean isPickable()
- Overrides:
isPickable
in classEntity
-
exits
private static com.mojang.datafixers.util.Pair<Vector3i,Vector3i> exits(RailShape p_226573_0_)
-
getMotionDirection
public Direction getMotionDirection()
- Overrides:
getMotionDirection
in classEntity
-
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 classEntity
-
readAdditionalSaveData
protected void readAdditionalSaveData(CompoundNBT p_70037_1_)
- Specified by:
readAdditionalSaveData
in classEntity
-
addAdditionalSaveData
protected void addAdditionalSaveData(CompoundNBT p_213281_1_)
- Specified by:
addAdditionalSaveData
in classEntity
-
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_)
-
lerpMotion
public void lerpMotion(double p_70016_1_, double p_70016_3_, double p_70016_5_)
- Overrides:
lerpMotion
in classEntity
-
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 classEntity
-
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 interfaceIForgeEntityMinecart
- 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 interfaceIForgeEntityMinecart
- 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 interfaceIForgeEntityMinecart
- Returns:
-
setCurrentCartSpeedCapOnRail
public void setCurrentCartSpeedCapOnRail(float value)
- Specified by:
setCurrentCartSpeedCapOnRail
in interfaceIForgeEntityMinecart
-
getMaxSpeedAirLateral
public float getMaxSpeedAirLateral()
- Specified by:
getMaxSpeedAirLateral
in interfaceIForgeEntityMinecart
-
setMaxSpeedAirLateral
public void setMaxSpeedAirLateral(float value)
- Specified by:
setMaxSpeedAirLateral
in interfaceIForgeEntityMinecart
-
getMaxSpeedAirVertical
public float getMaxSpeedAirVertical()
- Specified by:
getMaxSpeedAirVertical
in interfaceIForgeEntityMinecart
-
setMaxSpeedAirVertical
public void setMaxSpeedAirVertical(float value)
- Specified by:
setMaxSpeedAirVertical
in interfaceIForgeEntityMinecart
-
getDragAir
public double getDragAir()
- Specified by:
getDragAir
in interfaceIForgeEntityMinecart
-
setDragAir
public void setDragAir(double value)
- Specified by:
setDragAir
in interfaceIForgeEntityMinecart
-
getMaxSpeedWithRail
public double getMaxSpeedWithRail()
- Specified by:
getMaxSpeedWithRail
in interfaceIForgeEntityMinecart
-
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 interfaceIForgeEntityMinecart
-
-