SPIGOT-1622: Add drop chance methods for off hand.

This commit is contained in:
md_5 2016-03-02 17:03:20 +11:00
parent 912dfae454
commit b0411e8799
2 changed files with 46 additions and 2 deletions

View file

@ -113,14 +113,36 @@ public class CraftEntityEquipment implements EntityEquipment {
return entity;
}
@Override
public float getItemInHandDropChance() {
return getItemInMainHandDropChance();
}
@Override
public void setItemInHandDropChance(float chance) {
setItemInMainHandDropChance(chance);
}
@Override
public float getItemInMainHandDropChance() {
return getDropChance(EnumItemSlot.MAINHAND);
}
public void setItemInHandDropChance(float chance) {
@Override
public void setItemInMainHandDropChance(float chance) {
setDropChance(EnumItemSlot.MAINHAND, chance);
}
@Override
public float getItemInOffHandDropChance() {
return getDropChance(EnumItemSlot.OFFHAND);
}
@Override
public void setItemInOffHandDropChance(float chance) {
setDropChance(EnumItemSlot.OFFHAND, chance);
}
public float getHelmetDropChance() {
return getDropChance(EnumItemSlot.HEAD);
}

View file

@ -191,11 +191,33 @@ public class CraftInventoryPlayer extends CraftInventory implements org.bukkit.i
return (HumanEntity) inventory.getOwner();
}
@Override
public float getItemInHandDropChance() {
return getItemInMainHandDropChance();
}
@Override
public void setItemInHandDropChance(float chance) {
setItemInMainHandDropChance(chance);
}
@Override
public float getItemInMainHandDropChance() {
return 1;
}
public void setItemInHandDropChance(float chance) {
@Override
public void setItemInMainHandDropChance(float chance) {
throw new UnsupportedOperationException();
}
@Override
public float getItemInOffHandDropChance() {
return 1;
}
@Override
public void setItemInOffHandDropChance(float chance) {
throw new UnsupportedOperationException();
}