net.minecraft.entity.item

## Class EntityMinecart

- java.lang.Object
- - net.minecraft.entity.Entity
  - - net.minecraft.entity.item.EntityMinecart

- Direct Known Subclasses:
    EntityMinecartCommandBlock, EntityMinecartContainer, EntityMinecartEmpty, EntityMinecartFurnace, EntityMinecartMobSpawner, EntityMinecartTNT

      public abstract class EntityMinecart
      extends Entity

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class net.minecraft.entity.Entity

      `Entity.EnumEntitySize`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected boolean` | `canBePushed`
    `protected boolean` | `canUseRail`
    `static double` | `defaultDragAir`
    `static float` | `defaultMaxSpeedAirLateral`
    `static float` | `defaultMaxSpeedAirVertical`
    `protected double` | `dragAir`
    `protected float` | `maxSpeedAirLateral`
    `protected float` | `maxSpeedAirVertical`

    - ### Fields inherited from class net.minecraft.entity.Entity

      `addedToChunk, boundingBox, capturedDrops, captureDrops, chunkCoordX, chunkCoordY, chunkCoordZ, dataWatcher, dimension, distanceWalkedModified, distanceWalkedOnStepModified, entityCollisionReduction, entityUniqueID, extendedProperties, fallDistance, field_70135_K, fireResistance, forceSpawn, height, hurtResistantTime, ignoreFrustumCheck, inPortal, inWater, isAirBorne, isCollided, isCollidedHorizontally, isCollidedVertically, isDead, isImmuneToFire, isInWeb, lastTickPosX, lastTickPosY, lastTickPosZ, motionX, motionY, motionZ, myEntitySize, noClip, onGround, portalCounter, posX, posY, posZ, prevDistanceWalkedModified, preventEntitySpawning, prevPosX, prevPosY, prevPosZ, prevRotationPitch, prevRotationYaw, rand, renderDistanceWeight, riddenByEntity, ridingEntity, rotationPitch, rotationYaw, serverPosX, serverPosY, serverPosZ, stepHeight, teleportDirection, ticksExisted, timeUntilPortal, velocityChanged, width, worldObj, yOffset, ySize`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `EntityMinecart(World par1World)`
    `EntityMinecart(World par1World, double par2, double par4, double par6)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `applyDrag()`
    `void` | `applyEntityCollision(Entity par1Entity)`
    `boolean` | `attackEntityFrom(DamageSource par1DamageSource, float par2)`
    `boolean` | `canBeCollidedWith()`
    `boolean` | `canBePushed()`
    `boolean` | `canBeRidden()` Returns true if this cart can be ridden by an Entity.
    `protected boolean` | `canTriggerWalking()`
    `boolean` | `canUseRail()` Returns true if this cart can currently use rails.
    `static EntityMinecart` | `createMinecart(World par0World, double par1, double par3, double par5, int par7)`
    `protected void` | `entityInit()`
    `Block` | `func_145817_o()`
    `void` | `func_145819_k(int p_145819_1_)`
    `Block` | `func_145820_n()`
    `protected void` | `func_145821_a(int p_145821_1_, int p_145821_2_, int p_145821_3_, double p_145821_4_, double p_145821_6_, Block p_145821_8_, int p_145821_9_)`
    `Vec3` | `func_70489_a(double par1, double par3, double par5)`
    `Vec3` | `func_70495_a(double par1, double par3, double par5, double par7)`
    `protected void` | `func_94088_b(double par1)`
    `java.lang.String` | `func_95999_t()`
    `AxisAlignedBB` | `getBoundingBox()`
    `ItemStack` | `getCartItem()` This function returns an ItemStack that represents this cart.
    `AxisAlignedBB` | `getCollisionBox(Entity par1Entity)`
    `static IMinecartCollisionHandler` | `getCollisionHandler()` Gets the current global Minecart Collision handler if none is registered, returns null
    `java.lang.String` | `getCommandSenderName()`
    `float` | `getCurrentCartSpeedCapOnRail()` Returns the current speed cap for the cart when traveling on rails.
    `float` | `getDamage()`
    `int` | `getDefaultDisplayTileData()`
    `int` | `getDefaultDisplayTileOffset()`
    `int` | `getDisplayTileData()`
    `int` | `getDisplayTileOffset()`
    `double` | `getDragAir()`
    `float` | `getMaxCartSpeedOnRail()` Returns the carts max speed when traveling on rails.
    `float` | `getMaxSpeedAirLateral()`
    `float` | `getMaxSpeedAirVertical()`
    `abstract int` | `getMinecartType()`
    `double` | `getMountedYOffset()`
    `int` | `getRollingAmplitude()`
    `int` | `getRollingDirection()`
    `float` | `getShadowSize()`
    `double` | `getSlopeAdjustment()`
    `boolean` | `hasCustomInventoryName()`
    `boolean` | `hasDisplayTile()`
    `boolean` | `isPoweredCart()` Returns true if this cart is self propelled.
    `void` | `killMinecart(DamageSource par1DamageSource)`
    `void` | `moveMinecartOnRail(int x, int y, int z, double par4)` Moved to allow overrides.
    `void` | `onActivatorRailPass(int par1, int par2, int par3, boolean par4)`
    `void` | `onUpdate()`
    `void` | `performHurtAnimation()`
    `protected void` | `readEntityFromNBT(NBTTagCompound par1NBTTagCompound)`
    `void` | `setCanUseRail(boolean use)` Set whether the minecart can use rails.
    `static void` | `setCollisionHandler(IMinecartCollisionHandler handler)` Sets the global Minecart Collision handler, overwrites any that is currently set.
    `void` | `setCurrentCartSpeedCapOnRail(float value)`
    `void` | `setDamage(float par1)`
    `void` | `setDead()`
    `void` | `setDisplayTileData(int par1)`
    `void` | `setDisplayTileOffset(int par1)`
    `void` | `setDragAir(double value)`
    `void` | `setHasDisplayTile(boolean par1)`
    `void` | `setMaxSpeedAirLateral(float value)`
    `void` | `setMaxSpeedAirVertical(float value)`
    `void` | `setMinecartName(java.lang.String par1Str)`
    `void` | `setPositionAndRotation2(double par1, double par3, double par5, float par7, float par8, int par9)`
    `void` | `setRollingAmplitude(int par1)`
    `void` | `setRollingDirection(int par1)`
    `void` | `setVelocity(double par1, double par3, double par5)`
    `boolean` | `shouldDoRailFunctions()` Return false if this cart should not call onMinecartPass() and should ignore Powered Rails.
    `protected void` | `writeEntityToNBT(NBTTagCompound par1NBTTagCompound)`

    - ### Methods inherited from class net.minecraft.entity.Entity

      `addEntityCrashInfo, addToPlayerScore, addVelocity, canAttackWithItem, canRenderOnFire, canRiderInteract, copyDataFrom, copyLocationAndAnglesFrom, dealFireDamage, doesEntityNotTriggerPressurePlate, dropItem, entityDropItem, equals, extinguish, fall, func_145748_c_, func_145771_j, func_145772_a, func_145774_a, func_145775_I, func_145778_a, func_145780_a, func_145781_i, getAir, getBrightness, getBrightnessForRender, getCollisionBorderSize, getDataWatcher, getDistance, getDistanceSq, getDistanceSqToEntity, getDistanceToEntity, getEntityData, getEntityId, getEntityString, getExtendedProperties, getEyeHeight, getFlag, getLastActiveItems, getLookVec, getMaxInPortalTime, getMaxSafePointTries, getParts, getPersistentID, getPickedResult, getPortalCooldown, getRotationYawHead, getSplashSound, getSwimSound, getTeleportDirection, getUniqueID, getYOffset, handleHealthUpdate, handleLavaMovement, handleWaterMovement, hashCode, hitByEntity, interactFirst, isBurning, isCreatureType, isEating, isEntityAlive, isEntityEqual, isEntityInsideOpaqueBlock, isEntityInvulnerable, isImmuneToFire, isInRangeToRender3d, isInRangeToRenderDist, isInsideOfMaterial, isInvisible, isInvisibleToPlayer, isInWater, isOffsetPositionInLiquid, isPushedByWater, isRiding, isSneaking, isSprinting, isWet, kill, mountEntity, moveEntity, moveFlying, newDoubleNBTList, newFloatNBTList, onChunkLoad, onCollideWithPlayer, onEntityUpdate, onKillEntity, onStruckByLightning, playSound, preparePlayerToSpawn, readFromNBT, registerExtendedProperties, resetEntityId, setAir, setAngles, setBeenAttacked, setCurrentItemOrArmor, setEating, setEntityId, setFire, setFlag, setInPortal, setInvisible, setInWeb, setLocationAndAngles, setOnFireFromLava, setPosition, setPositionAndRotation, setRotation, setRotationYawHead, setSize, setSneaking, setSprinting, setWorld, shouldDismountInWater, shouldRenderInPass, shouldRiderSit, shouldSetPosAfterLoading, toString, travelToDimension, updateFallState, updateRidden, updateRiderPosition, writeMountToNBT, writeToNBT, writeToNBTOptional`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### defaultMaxSpeedAirLateral

          public static float defaultMaxSpeedAirLateral

    - #### defaultMaxSpeedAirVertical

          public static float defaultMaxSpeedAirVertical

    - #### defaultDragAir

          public static double defaultDragAir

    - #### canUseRail

          protected boolean canUseRail

    - #### canBePushed

          protected boolean canBePushed

    - #### maxSpeedAirLateral

          protected float maxSpeedAirLateral

    - #### maxSpeedAirVertical

          protected float maxSpeedAirVertical

    - #### dragAir

          protected double dragAir

  - ### Constructor Detail

    - #### EntityMinecart

          public EntityMinecart(World par1World)

    - #### EntityMinecart

          public EntityMinecart(World par1World,
                        double par2,
                        double par4,
                        double par6)

  - ### Method Detail

    - #### createMinecart

          public static EntityMinecart createMinecart(World par0World,
                                      double par1,
                                      double par3,
                                      double par5,
                                      int par7)

    - #### canTriggerWalking

          protected boolean canTriggerWalking()

      Overrides:
        `canTriggerWalking` in class `Entity`

    - #### entityInit

          protected void entityInit()

      Specified by:
        `entityInit` in class `Entity`

    - #### getCollisionBox

          public AxisAlignedBB getCollisionBox(Entity par1Entity)

      Overrides:
        `getCollisionBox` in class `Entity`

    - #### getBoundingBox

          public AxisAlignedBB getBoundingBox()

      Overrides:
        `getBoundingBox` in class `Entity`

    - #### canBePushed

          public boolean canBePushed()

      Overrides:
        `canBePushed` in class `Entity`

    - #### getMountedYOffset

          public double getMountedYOffset()

      Overrides:
        `getMountedYOffset` in class `Entity`

    - #### attackEntityFrom

          public boolean attackEntityFrom(DamageSource par1DamageSource,
                                 float par2)

      Overrides:
        `attackEntityFrom` in class `Entity`

    - #### killMinecart

          public void killMinecart(DamageSource par1DamageSource)

    - #### performHurtAnimation

          public void performHurtAnimation()

      Overrides:
        `performHurtAnimation` in class `Entity`

    - #### canBeCollidedWith

          public boolean canBeCollidedWith()

      Overrides:
        `canBeCollidedWith` in class `Entity`

    - #### setDead

          public void setDead()

      Overrides:
        `setDead` in class `Entity`

    - #### onUpdate

          public void onUpdate()

      Overrides:
        `onUpdate` in class `Entity`

    - #### onActivatorRailPass

          public void onActivatorRailPass(int par1,
                                 int par2,
                                 int par3,
                                 boolean par4)

    - #### func_94088_b

          protected void func_94088_b(double par1)

    - #### func_145821_a

          protected void func_145821_a(int p_145821_1_,
                           int p_145821_2_,
                           int p_145821_3_,
                           double p_145821_4_,
                           double p_145821_6_,
                           Block p_145821_8_,
                           int p_145821_9_)

    - #### applyDrag

          protected void applyDrag()

    - #### func_70495_a

          public Vec3 func_70495_a(double par1,
                          double par3,
                          double par5,
                          double par7)

    - #### func_70489_a

          public Vec3 func_70489_a(double par1,
                          double par3,
                          double par5)

    - #### readEntityFromNBT

          protected void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)

      Specified by:
        `readEntityFromNBT` in class `Entity`

    - #### writeEntityToNBT

          protected void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)

      Specified by:
        `writeEntityToNBT` in class `Entity`

    - #### getShadowSize

          public float getShadowSize()

      Overrides:
        `getShadowSize` in class `Entity`

    - #### applyEntityCollision

          public void applyEntityCollision(Entity par1Entity)

      Overrides:
        `applyEntityCollision` in class `Entity`

    - #### setPositionAndRotation2

          public void setPositionAndRotation2(double par1,
                                     double par3,
                                     double par5,
                                     float par7,
                                     float par8,
                                     int par9)

      Overrides:
        `setPositionAndRotation2` in class `Entity`

    - #### setDamage

          public void setDamage(float par1)

    - #### setVelocity

          public void setVelocity(double par1,
                         double par3,
                         double par5)

      Overrides:
        `setVelocity` in class `Entity`

    - #### getDamage

          public float getDamage()

    - #### setRollingAmplitude

          public void setRollingAmplitude(int par1)

    - #### getRollingAmplitude

          public int getRollingAmplitude()

    - #### setRollingDirection

          public void setRollingDirection(int par1)

    - #### getRollingDirection

          public int getRollingDirection()

    - #### getMinecartType

          public abstract int getMinecartType()

    - #### func_145820_n

          public Block func_145820_n()

    - #### func_145817_o

          public Block func_145817_o()

    - #### getDisplayTileData

          public int getDisplayTileData()

    - #### getDefaultDisplayTileData

          public int getDefaultDisplayTileData()

    - #### getDisplayTileOffset

          public int getDisplayTileOffset()

    - #### getDefaultDisplayTileOffset

          public int getDefaultDisplayTileOffset()

    - #### func_145819_k

          public void func_145819_k(int p_145819_1_)

    - #### setDisplayTileData

          public void setDisplayTileData(int par1)

    - #### setDisplayTileOffset

          public void setDisplayTileOffset(int par1)

    - #### hasDisplayTile

          public boolean hasDisplayTile()

    - #### setHasDisplayTile

          public void setHasDisplayTile(boolean par1)

    - #### setMinecartName

          public void setMinecartName(java.lang.String par1Str)

    - #### getCommandSenderName

          public java.lang.String getCommandSenderName()

      Overrides:
        `getCommandSenderName` in class `Entity`

    - #### hasCustomInventoryName

          public boolean hasCustomInventoryName()

    - #### func_95999_t

          public java.lang.String func_95999_t()

    - #### moveMinecartOnRail

          public void moveMinecartOnRail(int x,
                                int y,
                                int z,
                                double par4)

      Moved to allow overrides. This code handles minecart movement and speed capping when on a rail.

    - #### getCollisionHandler

          public static IMinecartCollisionHandler getCollisionHandler()

      Gets the current global Minecart Collision handler if none is registered, returns null
      Returns:
        The collision handler or null

    - #### setCollisionHandler

          public static void setCollisionHandler(IMinecartCollisionHandler handler)

      Sets the global Minecart Collision handler, overwrites any that is currently set.
      Parameters:
        `handler` - The new handler

    - #### getCartItem

          public ItemStack getCartItem()

      This function returns an ItemStack that represents this cart. This should be an ItemStack that can be used by the player to place the cart, but is not necessary the item the cart drops when destroyed.
      Returns:
        An ItemStack that can be used to place the cart.

    - #### canUseRail

          public boolean canUseRail()

      Returns true if this cart can currently use rails. This function is mainly used to gracefully detach a minecart from a rail.
      Returns:
        True if the minecart can use rails.

    - #### setCanUseRail

          public void setCanUseRail(boolean use)

      Set whether the minecart can use rails. This function is mainly used to gracefully detach a minecart from a rail.
      Parameters:
        `use` - Whether the minecart can currently use rails.

    - #### shouldDoRailFunctions

          public boolean shouldDoRailFunctions()

      Return false if this cart should not call onMinecartPass() and should ignore Powered Rails.
      Returns:
        True if this cart should call onMinecartPass().

    - #### isPoweredCart

          public boolean isPoweredCart()

      Returns true if this cart is self propelled.
      Returns:
        True if powered.

    - #### canBeRidden

          public boolean canBeRidden()

      Returns true if this cart can be ridden by an Entity.
      Returns:
        True if this cart can be ridden.

    - #### getMaxCartSpeedOnRail

          public float getMaxCartSpeedOnRail()

      Returns the carts max speed when traveling on rails. Carts going faster than 1.1 cause issues with chunk loading. Carts cant traverse slopes or corners at greater than 0.5 - 0.6. This value is compared with the rails max speed and the carts current speed cap to determine the carts current max speed. A normal rail's max speed is 0.4.
      Returns:
        Carts max speed.

    - #### getCurrentCartSpeedCapOnRail

          public final float getCurrentCartSpeedCapOnRail()

      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().
      Returns:

    - #### setCurrentCartSpeedCapOnRail

          public final void setCurrentCartSpeedCapOnRail(float value)

    - #### getMaxSpeedAirLateral

          public float getMaxSpeedAirLateral()

    - #### setMaxSpeedAirLateral

          public void setMaxSpeedAirLateral(float value)

    - #### getMaxSpeedAirVertical

          public float getMaxSpeedAirVertical()

    - #### setMaxSpeedAirVertical

          public void setMaxSpeedAirVertical(float value)

    - #### getDragAir

          public double getDragAir()

    - #### setDragAir

          public void setDragAir(double value)

    - #### getSlopeAdjustment

          public double getSlopeAdjustment()