Interface IForgeEntityMinecart
-
- All Known Implementing Classes:
AbstractMinecartEntity,ChestMinecartEntity,CommandBlockMinecartEntity,ContainerMinecartEntity,FurnaceMinecartEntity,HopperMinecartEntity,MinecartEntity,SpawnerMinecartEntity,TNTMinecartEntity
public interface IForgeEntityMinecart
-
-
Field Summary
Fields Modifier and Type Field Description static IMinecartCollisionHandlerCOLLISIONSTODO: Remove 1.17static doubleDEFAULT_AIR_DRAGstatic floatDEFAULT_MAX_SPEED_AIR_LATERALstatic floatDEFAULT_MAX_SPEED_AIR_VERTICAL
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default booleancanBeRidden()Returns true if this cart can be ridden by an Entity.booleancanUseRail()Returns true if this cart can currently use rails.default ItemStackgetCartItem()This function returns an ItemStack that represents this cart.default IMinecartCollisionHandlergetCollisionHandler()Gets the current global Minecart Collision handler if none is registered, returns null TODO: remove 1.17default intgetComparatorLevel()Called from Detector Rails to retrieve a redstone power level for comparators.floatgetCurrentCartSpeedCapOnRail()Returns the current speed cap for the cart when traveling on rails.default BlockPosgetCurrentRailPosition()Internal, returns the current spot to look for the attached rail.doublegetDragAir()default floatgetMaxCartSpeedOnRail()Returns the carts max speed when traveling on rails.floatgetMaxSpeedAirLateral()floatgetMaxSpeedAirVertical()doublegetMaxSpeedWithRail()default AbstractMinecartEntitygetMinecart()default doublegetSlopeAdjustment()default booleanisPoweredCart()Returns true if this cart is self propelled.voidmoveMinecartOnRail(BlockPos pos)Moved to allow overrides.voidsetCanUseRail(boolean use)Set whether the minecart can use rails.voidsetCurrentCartSpeedCapOnRail(float value)voidsetDragAir(double value)voidsetMaxSpeedAirLateral(float value)voidsetMaxSpeedAirVertical(float value)default booleanshouldDoRailFunctions()Return false if this cart should not call onMinecartPass() and should ignore Powered Rails.
-
-
-
Field Detail
-
DEFAULT_MAX_SPEED_AIR_LATERAL
static final float DEFAULT_MAX_SPEED_AIR_LATERAL
- See Also:
- Constant Field Values
-
DEFAULT_MAX_SPEED_AIR_VERTICAL
static final float DEFAULT_MAX_SPEED_AIR_VERTICAL
- See Also:
- Constant Field Values
-
DEFAULT_AIR_DRAG
static final double DEFAULT_AIR_DRAG
- See Also:
- Constant Field Values
-
COLLISIONS
static final IMinecartCollisionHandler COLLISIONS
TODO: Remove 1.17
-
-
Method Detail
-
getMinecart
default AbstractMinecartEntity getMinecart()
-
getCollisionHandler
default IMinecartCollisionHandler getCollisionHandler()
Gets the current global Minecart Collision handler if none is registered, returns null TODO: remove 1.17- Returns:
- The collision handler or null
-
getCurrentRailPosition
default BlockPos getCurrentRailPosition()
Internal, returns the current spot to look for the attached rail.
-
getMaxSpeedWithRail
double getMaxSpeedWithRail()
-
moveMinecartOnRail
void moveMinecartOnRail(BlockPos pos)
Moved to allow overrides. This code handles minecart movement and speed capping when on a rail.
-
getCartItem
default 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
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
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
default 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
default boolean isPoweredCart()
Returns true if this cart is self propelled.- Returns:
- True if powered.
-
canBeRidden
default boolean canBeRidden()
Returns true if this cart can be ridden by an Entity.- Returns:
- True if this cart can be ridden.
-
getMaxCartSpeedOnRail
default 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
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
void setCurrentCartSpeedCapOnRail(float value)
-
getMaxSpeedAirLateral
float getMaxSpeedAirLateral()
-
setMaxSpeedAirLateral
void setMaxSpeedAirLateral(float value)
-
getMaxSpeedAirVertical
float getMaxSpeedAirVertical()
-
setMaxSpeedAirVertical
void setMaxSpeedAirVertical(float value)
-
getDragAir
double getDragAir()
-
setDragAir
void setDragAir(double value)
-
getSlopeAdjustment
default double getSlopeAdjustment()
-
getComparatorLevel
default int getComparatorLevel()
Called from Detector Rails to retrieve a redstone power level for comparators.
-
-