net.minecraft.entity.item

## Class EntityMinecart

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

- All Implemented Interfaces:
    IInventory

      public class EntityMinecart
      extends Entity
      implements IInventory

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static double` | `defaultDragAir`
    `static double` | `defaultDragEmpty`
    `static double` | `defaultDragRidden`
    `static float` | `defaultMaxSpeedAirLateral`
    `static float` | `defaultMaxSpeedAirVertical`
    `static float` | `defaultMaxSpeedGround`
    `static float` | `defaultMaxSpeedRail`
    `int` | `minecartType` The type of minecart, 2 for powered, 1 for storage.
    `double` | `pushX`
    `double` | `pushZ`

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

      `addedToChunk, boundingBox, capturedDrops, captureDrops, chunkCoordX, chunkCoordY, chunkCoordZ, cloakUrl, dimension, distanceWalkedModified, entityCollisionReduction, entityId, fallDistance, field_70135_K, field_82151_R, fireResistance, height, hurtResistantTime, ignoreFrustumCheck, isAirBorne, isCollided, isCollidedHorizontally, isCollidedVertically, isDead, lastTickPosX, lastTickPosY, lastTickPosZ, motionX, motionY, motionZ, myEntitySize, noClip, onGround, posX, posY, posZ, prevDistanceWalkedModified, preventEntitySpawning, prevPosX, prevPosY, prevPosZ, prevRotationPitch, prevRotationYaw, renderDistanceWeight, riddenByEntity, ridingEntity, rotationPitch, rotationYaw, serverPosX, serverPosY, serverPosZ, skinUrl, stepHeight, 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, int par8)`
    `EntityMinecart(World world, int type)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `applyEntityCollision(Entity par1Entity)` Applies a velocity to each of the entities pushing them away from each other.
    `boolean` | `attackEntityFrom(DamageSource par1DamageSource, int par2)` Called when the entity is attacked.
    `boolean` | `canBeCollidedWith()` Returns true if other Entities should be prevented from moving through this Entity.
    `boolean` | `canBePushed()` Returns true if this entity should push and be pushed by other entities when colliding.
    `boolean` | `canBeRidden()` Returns true if this cart can be ridden by an Entity.
    `boolean` | `canUseRail()` Returns true if this cart can currently use rails.
    `void` | `closeChest()`
    `ItemStack` | `decrStackSize(int par1, int par2)` Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a new stack.
    `void` | `dropCartAsItem()` Drops the cart as a item.
    `Vec3` | `func_70489_a(double par1, double par3, double par5)`
    `Vec3` | `func_70495_a(double par1, double par3, double par5, double par7)`
    `AxisAlignedBB` | `getBoundingBox()` returns the bounding box for this entity
    `ItemStack` | `getCartItem()` This function returns an ItemStack that represents this cart.
    `AxisAlignedBB` | `getCollisionBox(Entity par1Entity)` Returns a boundingBox used to collide the entity with other entities and blocks.
    `static IMinecartCollisionHandler` | `getCollisionHandler()` Gets the current global Minecart Collision handler if none is registered, returns null
    `int` | `getDamage()` Gets the current amount of damage the minecart has taken.
    `double` | `getDragAir()`
    `int` | `getInventoryStackLimit()` Returns the maximum stack size for a inventory slot.
    `String` | `getInvName()` Returns the name of the inventory.
    `List<ItemStack>` | `getItemsDropped()` Override this to define which items your cart drops when broken.
    `float` | `getMaxSpeedAirLateral()`
    `float` | `getMaxSpeedAirVertical()`
    `float` | `getMaxSpeedGround()`
    `float` | `getMaxSpeedRail()` Returns the carts max speed.
    `int` | `getMinecartType()` Simply returns the minecartType variable.
    `double` | `getMountedYOffset()` Returns the Y offset from the entity's position for any entity riding this one.
    `int` | `getRollingAmplitude()` Gets the rolling amplitude the cart rolls while being attacked.
    `int` | `getRollingDirection()` Gets the rolling direction the cart rolls while being attacked.
    `float` | `getShadowSize()`
    `int` | `getSizeInventory()` Returns the number of slots in the inventory.
    `ItemStack` | `getStackInSlot(int par1)` Returns the stack in slot i
    `ItemStack` | `getStackInSlotOnClosing(int par1)` When some containers are closed they call this on each slot, then drop whatever it returns as an EntityItem - like when you close a workbench GUI.
    `boolean` | `interact(EntityPlayer par1EntityPlayer)` Called when a player interacts with a mob.
    `boolean` | `isMinecartPowered()` Is this minecart powered (Fuel > 0)
    `boolean` | `isPoweredCart()` Returns true if this cart is self propelled.
    `boolean` | `isStorageCart()` Returns true if this cart is a storage cart Some carts may have inventories but not be storage carts and some carts without inventories may be storage carts.
    `boolean` | `isUseableByPlayer(EntityPlayer par1EntityPlayer)` Do not make give this method the name canInteractWith because it clashes with Container
    `void` | `onInventoryChanged()` Called when an the contents of an Inventory change, usually
    `void` | `onUpdate()` Called to update the entity's position/logic.
    `void` | `openChest()`
    `void` | `performHurtAnimation()`
    `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` | `setDamage(int par1)` Sets the current amount of damage the minecart has taken.
    `void` | `setDead()` Will get destroyed next tick.
    `void` | `setDragAir(double value)`
    `void` | `setInventorySlotContents(int par1, ItemStack par2ItemStack)` Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections).
    `void` | `setMaxSpeedAirLateral(float value)`
    `void` | `setMaxSpeedAirVertical(float value)`
    `void` | `setMaxSpeedGround(float value)`
    `void` | `setMaxSpeedRail(float value)`
    `void` | `setPositionAndRotation2(double par1, double par3, double par5, float par7, float par8, int par9)`
    `void` | `setRollingAmplitude(int par1)` Sets the rolling amplitude the cart rolls while being attacked.
    `void` | `setRollingDirection(int par1)` Sets the rolling direction the cart rolls while being attacked.
    `void` | `setVelocity(double par1, double par3, double par5)`
    `boolean` | `shouldDoRailFunctions()` Return false if this cart should not call IRail.onMinecartPass() and should ignore Powered Rails.
    `void` | `travelToDimension(int par1)` Teleports the entity to another dimension.

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

      `addEntityID, addToPlayerScore, addVelocity, canAttackWithItem, canRenderOnFire, copyDataFrom, doesEntityNotTriggerPressurePlate, dropItem, dropItemWithOffset, entityDropItem, equals, extinguish, func_82143_as, func_82146_a, func_82148_at, func_82149_j, func_85029_a, func_85031_j, generatePersistentID, getAir, getBrightness, getBrightnessForRender, getCollisionBorderSize, getDataWatcher, getDistance, getDistanceSq, getDistanceSqToEntity, getDistanceToEntity, getEntityData, getEntityName, getEyeHeight, getHasActivePotion, getLastActiveItems, getLookVec, getMaxInPortalTime, getParts, getPersistentID, getPickedResult, getPortalCooldown, getTexture, getYOffset, handleHealthUpdate, handleLavaMovement, handleWaterMovement, hashCode, isBurning, isEating, isEntityAlive, isEntityEqual, isEntityInsideOpaqueBlock, isEntityInvulnerable, isImmuneToFire, isInRangeToRenderDist, isInRangeToRenderVec3D, isInsideOfMaterial, isInWater, isOffsetPositionInLiquid, isRiding, isSneaking, isSprinting, isWet, mountEntity, moveEntity, moveFlying, onCollideWithPlayer, onEntityUpdate, onKillEntity, onStruckByLightning, playSound, readFromNBT, resetEntityId, setAir, setAngles, setCurrentItemOrArmor, setEating, setFire, setHasActivePotion, setHeadRotationYaw, setInPortal, setInWeb, setLocationAndAngles, setPosition, setPositionAndRotation, setRotationYawHead, setSneaking, setSprinting, setWorld, shouldRenderInPass, shouldRiderSit, toString, unmountEntity, updateCloak, updateRidden, updateRiderPosition, writeToNBT`

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

      `getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### minecartType

          public int minecartType

      The type of minecart, 2 for powered, 1 for storage.

    - #### pushX

          public double pushX

    - #### pushZ

          public double pushZ

    - #### defaultMaxSpeedRail

          public static float defaultMaxSpeedRail

    - #### defaultMaxSpeedGround

          public static float defaultMaxSpeedGround

    - #### defaultMaxSpeedAirLateral

          public static float defaultMaxSpeedAirLateral

    - #### defaultMaxSpeedAirVertical

          public static float defaultMaxSpeedAirVertical

    - #### defaultDragRidden

          public static double defaultDragRidden

    - #### defaultDragEmpty

          public static double defaultDragEmpty

    - #### defaultDragAir

          public static double defaultDragAir

  - ### Constructor Detail

    - #### EntityMinecart

          public EntityMinecart(World par1World)

    - #### EntityMinecart

          public EntityMinecart(World world,
                        int type)

    - #### EntityMinecart

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

  - ### Method Detail

    - #### getCollisionBox

          public AxisAlignedBB getCollisionBox(Entity par1Entity)

      Returns a boundingBox used to collide the entity with other entities and blocks. This enables the entity to be pushable on contact, like boats or minecarts.
      Overrides:
        `getCollisionBox` in class `Entity`

    - #### getBoundingBox

          public AxisAlignedBB getBoundingBox()

      returns the bounding box for this entity
      Overrides:
        `getBoundingBox` in class `Entity`

    - #### canBePushed

          public boolean canBePushed()

      Returns true if this entity should push and be pushed by other entities when colliding.
      Overrides:
        `canBePushed` in class `Entity`

    - #### getMountedYOffset

          public double getMountedYOffset()

      Returns the Y offset from the entity's position for any entity riding this one.
      Overrides:
        `getMountedYOffset` in class `Entity`

    - #### attackEntityFrom

          public boolean attackEntityFrom(DamageSource par1DamageSource,
                                 int par2)

      Called when the entity is attacked.
      Overrides:
        `attackEntityFrom` in class `Entity`

    - #### performHurtAnimation

          public void performHurtAnimation()

      Overrides:
        `performHurtAnimation` in class `Entity`

    - #### canBeCollidedWith

          public boolean canBeCollidedWith()

      Returns true if other Entities should be prevented from moving through this Entity.
      Overrides:
        `canBeCollidedWith` in class `Entity`

    - #### setDead

          public void setDead()

      Will get destroyed next tick.
      Overrides:
        `setDead` in class `Entity`

    - #### travelToDimension

          public void travelToDimension(int par1)

      Teleports the entity to another dimension. Params: Dimension number to teleport to
      Overrides:
        `travelToDimension` in class `Entity`

    - #### onUpdate

          public void onUpdate()

      Called to update the entity's position/logic.
      Overrides:
        `onUpdate` in class `Entity`

    - #### 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)

    - #### getShadowSize

          public float getShadowSize()

      Overrides:
        `getShadowSize` in class `Entity`

    - #### applyEntityCollision

          public void applyEntityCollision(Entity par1Entity)

      Applies a velocity to each of the entities pushing them away from each other. Args: entity
      Overrides:
        `applyEntityCollision` in class `Entity`

    - #### getSizeInventory

          public int getSizeInventory()

      Returns the number of slots in the inventory.
      Specified by:
        `getSizeInventory` in interface `IInventory`

    - #### getStackInSlot

          public ItemStack getStackInSlot(int par1)

      Returns the stack in slot i
      Specified by:
        `getStackInSlot` in interface `IInventory`

    - #### decrStackSize

          public ItemStack decrStackSize(int par1,
                                int par2)

      Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a new stack.
      Specified by:
        `decrStackSize` in interface `IInventory`

    - #### getStackInSlotOnClosing

          public ItemStack getStackInSlotOnClosing(int par1)

      When some containers are closed they call this on each slot, then drop whatever it returns as an EntityItem - like when you close a workbench GUI.
      Specified by:
        `getStackInSlotOnClosing` in interface `IInventory`

    - #### setInventorySlotContents

          public void setInventorySlotContents(int par1,
                                      ItemStack par2ItemStack)

      Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections).
      Specified by:
        `setInventorySlotContents` in interface `IInventory`

    - #### getInvName

          public String getInvName()

      Returns the name of the inventory.
      Specified by:
        `getInvName` in interface `IInventory`

    - #### getInventoryStackLimit

          public int getInventoryStackLimit()

      Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended. *Isn't this more of a set than a get?*
      Specified by:
        `getInventoryStackLimit` in interface `IInventory`

    - #### onInventoryChanged

          public void onInventoryChanged()

      Called when an the contents of an Inventory change, usually
      Specified by:
        `onInventoryChanged` in interface `IInventory`

    - #### interact

          public boolean interact(EntityPlayer par1EntityPlayer)

      Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig.
      Overrides:
        `interact` in class `Entity`

    - #### setPositionAndRotation2

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

      Overrides:
        `setPositionAndRotation2` in class `Entity`

    - #### setVelocity

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

      Overrides:
        `setVelocity` in class `Entity`

    - #### isUseableByPlayer

          public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer)

      Do not make give this method the name canInteractWith because it clashes with Container
      Specified by:
        `isUseableByPlayer` in interface `IInventory`

    - #### isMinecartPowered

          public boolean isMinecartPowered()

      Is this minecart powered (Fuel > 0)

    - #### openChest

          public void openChest()

      Specified by:
        `openChest` in interface `IInventory`

    - #### closeChest

          public void closeChest()

      Specified by:
        `closeChest` in interface `IInventory`

    - #### setDamage

          public void setDamage(int par1)

      Sets the current amount of damage the minecart has taken. Decreases over time. The cart breaks when this is over 40.

    - #### getDamage

          public int getDamage()

      Gets the current amount of damage the minecart has taken. Decreases over time. The cart breaks when this is over 40.

    - #### setRollingAmplitude

          public void setRollingAmplitude(int par1)

      Sets the rolling amplitude the cart rolls while being attacked.

    - #### getRollingAmplitude

          public int getRollingAmplitude()

      Gets the rolling amplitude the cart rolls while being attacked.

    - #### setRollingDirection

          public void setRollingDirection(int par1)

      Sets the rolling direction the cart rolls while being attacked. Can be 1 or -1.

    - #### getRollingDirection

          public int getRollingDirection()

      Gets the rolling direction the cart rolls while being attacked. Can be 1 or -1.

    - #### dropCartAsItem

          public void dropCartAsItem()

      Drops the cart as a item. The exact item dropped is defined by getItemDropped().

    - #### getItemsDropped

          public List<ItemStack> getItemsDropped()

      Override this to define which items your cart drops when broken. This does not include items contained in the inventory, that is handled elsewhere.
      Returns:
        A list of items dropped.

    - #### 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. This is the item that was registered with the cart via the registerMinecart function, but is not necessary the item the cart drops when destroyed.
      Returns:
        An ItemStack that can be used to place the cart.

    - #### isPoweredCart

          public boolean isPoweredCart()

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

    - #### isStorageCart

          public boolean isStorageCart()

      Returns true if this cart is a storage cart Some carts may have inventories but not be storage carts and some carts without inventories may be storage carts.
      Returns:
        True if this cart should be classified as a storage cart.

    - #### canBeRidden

          public boolean canBeRidden()

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

    - #### 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 IRail.onMinecartPass() and should ignore Powered Rails.
      Returns:
        True if this cart should call IRail.onMinecartPass().

    - #### getMinecartType

          public int getMinecartType()

      Simply returns the minecartType variable.
      Returns:
        minecartType

    - #### 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

    - #### getMaxSpeedRail

          public float getMaxSpeedRail()

      Returns the carts max speed. 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 to determine the carts current max speed. A normal rails max speed is 0.4.
      Returns:
        Carts max speed.

    - #### setMaxSpeedRail

          public void setMaxSpeedRail(float value)

    - #### getMaxSpeedGround

          public float getMaxSpeedGround()

    - #### setMaxSpeedGround

          public void setMaxSpeedGround(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)