mirror of
https://github.com/PaperMC/Paper.git
synced 2025-03-13 11:18:23 +01:00
SPIGOT-6587: Update documentation/error of drop chance API
By: md_5 <git@md-5.net>
This commit is contained in:
parent
66df1397b3
commit
690c8b65a1
1 changed files with 6 additions and 0 deletions
|
@ -247,6 +247,8 @@ public class CraftEntityEquipment implements EntityEquipment {
|
|||
}
|
||||
|
||||
private void setDropChance(EnumItemSlot slot, float chance) {
|
||||
Preconditions.checkArgument(entity.getHandle() instanceof EntityInsentient, "Cannot set drop chance for non-Mob entity");
|
||||
|
||||
if (slot == EnumItemSlot.MAINHAND || slot == EnumItemSlot.OFFHAND) {
|
||||
((EntityInsentient) entity.getHandle()).handDropChances[slot.b()] = chance;
|
||||
} else {
|
||||
|
@ -255,6 +257,10 @@ public class CraftEntityEquipment implements EntityEquipment {
|
|||
}
|
||||
|
||||
private float getDropChance(EnumItemSlot slot) {
|
||||
if (!(entity.getHandle() instanceof EntityInsentient)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (slot == EnumItemSlot.MAINHAND || slot == EnumItemSlot.OFFHAND) {
|
||||
return ((EntityInsentient) entity.getHandle()).handDropChances[slot.b()];
|
||||
} else {
|
||||
|
|
Loading…
Add table
Reference in a new issue