mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-12 18:55:51 -07:00
#621: Add HumanEntity#getItemInUse and Material#getSlipperiness
By: konsolas <vincentyntang@gmail.com>
This commit is contained in:
@@ -9652,6 +9652,36 @@ public enum Material implements Keyed {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a value that represents how 'slippery' the block is.
|
||||||
|
*
|
||||||
|
* Blocks with higher slipperiness, like {@link Material#ICE} can be slid on
|
||||||
|
* further by the player and other entities.
|
||||||
|
*
|
||||||
|
* Most blocks have a default slipperiness of {@code 0.6f}.
|
||||||
|
*
|
||||||
|
* Only available when {@link #isBlock()} is true.
|
||||||
|
*
|
||||||
|
* @return the slipperiness of this block
|
||||||
|
*/
|
||||||
|
public float getSlipperiness() {
|
||||||
|
Validate.isTrue(isBlock(), "The Material is not a block!");
|
||||||
|
switch (this) {
|
||||||
|
// <editor-fold defaultstate="collapsed" desc="getSlipperiness">
|
||||||
|
default:
|
||||||
|
return 0.6F;
|
||||||
|
case SLIME_BLOCK:
|
||||||
|
return 0.8F;
|
||||||
|
case FROSTED_ICE:
|
||||||
|
case ICE:
|
||||||
|
case PACKED_ICE:
|
||||||
|
return 0.98F;
|
||||||
|
case BLUE_ICE:
|
||||||
|
return 0.989F;
|
||||||
|
// </editor-fold>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines the remaining item in a crafting grid after crafting with this
|
* Determines the remaining item in a crafting grid after crafting with this
|
||||||
* ingredient.
|
* ingredient.
|
||||||
|
@@ -293,6 +293,16 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
|
|||||||
*/
|
*/
|
||||||
public boolean isHandRaised();
|
public boolean isHandRaised();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the item that the player is using (eating food, drawing back a bow,
|
||||||
|
* blocking, etc.)
|
||||||
|
*
|
||||||
|
* @return the item being used by the player, or null if they are not using
|
||||||
|
* an item
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
public ItemStack getItemInUse();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the total amount of experience required for the player to level
|
* Get the total amount of experience required for the player to level
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user