SPIGOT-6587: Update documentation/error of drop chance API
By: md_5 <git@md-5.net>
This commit is contained in:
@@ -247,6 +247,8 @@ public class CraftEntityEquipment implements EntityEquipment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setDropChance(EnumItemSlot slot, float chance) {
|
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) {
|
if (slot == EnumItemSlot.MAINHAND || slot == EnumItemSlot.OFFHAND) {
|
||||||
((EntityInsentient) entity.getHandle()).handDropChances[slot.b()] = chance;
|
((EntityInsentient) entity.getHandle()).handDropChances[slot.b()] = chance;
|
||||||
} else {
|
} else {
|
||||||
@@ -255,6 +257,10 @@ public class CraftEntityEquipment implements EntityEquipment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private float getDropChance(EnumItemSlot slot) {
|
private float getDropChance(EnumItemSlot slot) {
|
||||||
|
if (!(entity.getHandle() instanceof EntityInsentient)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (slot == EnumItemSlot.MAINHAND || slot == EnumItemSlot.OFFHAND) {
|
if (slot == EnumItemSlot.MAINHAND || slot == EnumItemSlot.OFFHAND) {
|
||||||
return ((EntityInsentient) entity.getHandle()).handDropChances[slot.b()];
|
return ((EntityInsentient) entity.getHandle()).handDropChances[slot.b()];
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user