mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-31 21:37:39 +01:00
#621: Add HumanEntity#getItemInUse and Material#getSlipperiness
By: konsolas <vincentyntang@gmail.com>
This commit is contained in:
parent
e1c30137fb
commit
b29d02153d
@ -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
|
||||
* ingredient.
|
||||
|
@ -293,6 +293,16 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder
|
||||
*/
|
||||
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
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user