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 classAbstractMinecartEntity.Type-
Nested classes/interfaces inherited from class net.minecraft.entity.Entity
Entity.IMoveCallback
-
-
Field Summary
Fields Modifier and Type Field Description private booleancanBePushedprivate booleancanUseRailprivate static IMinecartCollisionHandlerCOLLISIONSprivate floatcurrentSpeedCapOnRailprivate static DataParameter<java.lang.Boolean>DATA_ID_CUSTOM_DISPLAYprivate static DataParameter<java.lang.Float>DATA_ID_DAMAGEprivate static DataParameter<java.lang.Integer>DATA_ID_DISPLAY_BLOCKprivate static DataParameter<java.lang.Integer>DATA_ID_DISPLAY_OFFSETprivate static DataParameter<java.lang.Integer>DATA_ID_HURTprivate static DataParameter<java.lang.Integer>DATA_ID_HURTDIRprivate doubledragAirprivate static java.util.Map<RailShape,com.mojang.datafixers.util.Pair<Vector3i,Vector3i>>EXITSprivate booleanflippedprivate intlStepsprivate doublelxprivate doublelxdprivate doublelxrprivate doublelyprivate doublelydprivate doublelyrprivate doublelzprivate doublelzdprivate floatmaxSpeedAirLateralprivate floatmaxSpeedAirVerticalprivate 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 protectedAbstractMinecartEntity(EntityType<?> p_i48538_1_, World p_i48538_2_)protectedAbstractMinecartEntity(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 voidactivateMinecart(int p_96095_1_, int p_96095_2_, int p_96095_3_, boolean p_96095_4_)protected voidaddAdditionalSaveData(CompoundNBT p_213281_1_)voidanimateHurt()protected voidapplyNaturalSlowdown()booleancanCollideWith(Entity p_241849_1_)booleancanUseRail()Returns true if this cart can currently use rails.protected voidcomeOffTrack()static AbstractMinecartEntitycreateMinecart(World p_184263_0_, double p_184263_1_, double p_184263_3_, double p_184263_5_, AbstractMinecartEntity.Type p_184263_7_)protected voiddefineSynchedData()voiddestroy(DamageSource p_94095_1_)private static com.mojang.datafixers.util.Pair<Vector3i,Vector3i>exits(RailShape p_226573_0_)IPacket<?>getAddEntityPacket()protected floatgetBlockSpeedFactor()AxisAlignedBBgetBoundingBoxForCulling()IMinecartCollisionHandlergetCollisionHandler()Gets the current global Minecart Collision handler if none is registered, returns null TODO: remove 1.17floatgetCurrentCartSpeedCapOnRail()Returns the current speed cap for the cart when traveling on rails.floatgetDamage()BlockStategetDefaultDisplayBlockState()intgetDefaultDisplayOffset()Vector3dgetDismountLocationForPassenger(LivingEntity p_230268_1_)BlockStategetDisplayBlockState()intgetDisplayOffset()doublegetDragAir()intgetHurtDir()intgetHurtTime()protected doublegetMaxSpeed()floatgetMaxSpeedAirLateral()floatgetMaxSpeedAirVertical()doublegetMaxSpeedWithRail()abstract AbstractMinecartEntity.TypegetMinecartType()DirectiongetMotionDirection()doublegetPassengersRidingOffset()Vector3dgetPos(double p_70489_1_, double p_70489_3_, double p_70489_5_)Vector3dgetPosOffs(double p_70495_1_, double p_70495_3_, double p_70495_5_, double p_70495_7_)protected Vector3dgetRelativePortalPosition(Direction.Axis p_241839_1_, TeleportationRepositioner.Result p_241839_2_)booleanhasCustomDisplay()booleanhurt(DamageSource p_70097_1_, float p_70097_2_)protected booleanisMovementNoisy()booleanisPickable()booleanisPushable()private booleanisRedstoneConductor(BlockPos p_213900_1_)voidlerpMotion(double p_70016_1_, double p_70016_3_, double p_70016_5_)voidlerpTo(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 voidmoveAlongTrack(BlockPos p_180460_1_, BlockState p_180460_2_)voidmoveMinecartOnRail(BlockPos pos)Moved to allow overrides.voidpush(Entity p_70108_1_)protected voidreadAdditionalSaveData(CompoundNBT p_70037_1_)static voidregisterCollisionHandler(IMinecartCollisionHandler handler)voidsetCanUseRail(boolean value)Set whether the minecart can use rails.voidsetCurrentCartSpeedCapOnRail(float value)voidsetCustomDisplay(boolean p_94096_1_)voidsetDamage(float p_70492_1_)voidsetDisplayBlockState(BlockState p_174899_1_)voidsetDisplayOffset(int p_94086_1_)voidsetDragAir(double value)voidsetHurtDir(int p_70494_1_)voidsetHurtTime(int p_70497_1_)voidsetMaxSpeedAirLateral(float value)voidsetMaxSpeedAirVertical(float value)voidtick()-
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:IForgeEntityMinecartGets the current global Minecart Collision handler if none is registered, returns null TODO: remove 1.17- Specified by:
getCollisionHandlerin 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:
isMovementNoisyin classEntity
-
defineSynchedData
protected void defineSynchedData()
- Specified by:
defineSynchedDatain classEntity
-
canCollideWith
public boolean canCollideWith(Entity p_241849_1_)
- Overrides:
canCollideWithin classEntity
-
isPushable
public boolean isPushable()
- Overrides:
isPushablein classEntity
-
getRelativePortalPosition
protected Vector3d getRelativePortalPosition(Direction.Axis p_241839_1_, TeleportationRepositioner.Result p_241839_2_)
- Overrides:
getRelativePortalPositionin classEntity
-
getPassengersRidingOffset
public double getPassengersRidingOffset()
- Overrides:
getPassengersRidingOffsetin classEntity
-
getDismountLocationForPassenger
public Vector3d getDismountLocationForPassenger(LivingEntity p_230268_1_)
- Overrides:
getDismountLocationForPassengerin classEntity
-
hurt
public boolean hurt(DamageSource p_70097_1_, float p_70097_2_)
-
getBlockSpeedFactor
protected float getBlockSpeedFactor()
- Overrides:
getBlockSpeedFactorin classEntity
-
destroy
public void destroy(DamageSource p_94095_1_)
-
animateHurt
public void animateHurt()
- Overrides:
animateHurtin classEntity
-
isPickable
public boolean isPickable()
- Overrides:
isPickablein classEntity
-
exits
private static com.mojang.datafixers.util.Pair<Vector3i,Vector3i> exits(RailShape p_226573_0_)
-
getMotionDirection
public Direction getMotionDirection()
- Overrides:
getMotionDirectionin 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:
getBoundingBoxForCullingin classEntity
-
readAdditionalSaveData
protected void readAdditionalSaveData(CompoundNBT p_70037_1_)
- Specified by:
readAdditionalSaveDatain classEntity
-
addAdditionalSaveData
protected void addAdditionalSaveData(CompoundNBT p_213281_1_)
- Specified by:
addAdditionalSaveDatain 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:
lerpMotionin 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:
getAddEntityPacketin classEntity
-
canUseRail
public boolean canUseRail()
Description copied from interface:IForgeEntityMinecartReturns true if this cart can currently use rails. This function is mainly used to gracefully detach a minecart from a rail.- Specified by:
canUseRailin interfaceIForgeEntityMinecart- Returns:
- True if the minecart can use rails.
-
setCanUseRail
public void setCanUseRail(boolean value)
Description copied from interface:IForgeEntityMinecartSet whether the minecart can use rails. This function is mainly used to gracefully detach a minecart from a rail.- Specified by:
setCanUseRailin interfaceIForgeEntityMinecart- Parameters:
value- Whether the minecart can currently use rails.
-
getCurrentCartSpeedCapOnRail
public float getCurrentCartSpeedCapOnRail()
Description copied from interface:IForgeEntityMinecartReturns 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:
getCurrentCartSpeedCapOnRailin interfaceIForgeEntityMinecart- Returns:
-
setCurrentCartSpeedCapOnRail
public void setCurrentCartSpeedCapOnRail(float value)
- Specified by:
setCurrentCartSpeedCapOnRailin interfaceIForgeEntityMinecart
-
getMaxSpeedAirLateral
public float getMaxSpeedAirLateral()
- Specified by:
getMaxSpeedAirLateralin interfaceIForgeEntityMinecart
-
setMaxSpeedAirLateral
public void setMaxSpeedAirLateral(float value)
- Specified by:
setMaxSpeedAirLateralin interfaceIForgeEntityMinecart
-
getMaxSpeedAirVertical
public float getMaxSpeedAirVertical()
- Specified by:
getMaxSpeedAirVerticalin interfaceIForgeEntityMinecart
-
setMaxSpeedAirVertical
public void setMaxSpeedAirVertical(float value)
- Specified by:
setMaxSpeedAirVerticalin interfaceIForgeEntityMinecart
-
getDragAir
public double getDragAir()
- Specified by:
getDragAirin interfaceIForgeEntityMinecart
-
setDragAir
public void setDragAir(double value)
- Specified by:
setDragAirin interfaceIForgeEntityMinecart
-
getMaxSpeedWithRail
public double getMaxSpeedWithRail()
- Specified by:
getMaxSpeedWithRailin interfaceIForgeEntityMinecart
-
moveMinecartOnRail
public void moveMinecartOnRail(BlockPos pos)
Description copied from interface:IForgeEntityMinecartMoved to allow overrides. This code handles minecart movement and speed capping when on a rail.- Specified by:
moveMinecartOnRailin interfaceIForgeEntityMinecart
-
-