mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-25 12:58:33 +01:00
Fixed aura cache not having a durability bar
This commit is contained in:
parent
75948872b7
commit
6a9f3675af
1 changed files with 8 additions and 2 deletions
|
@ -85,14 +85,20 @@ public class ItemAuraCache extends ItemImpl implements ITrinketItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getBarColor(ItemStack stack) {
|
public int getBarWidth(ItemStack stack) {
|
||||||
if (stack.getCapability(NaturesAuraAPI.capAuraContainer).isPresent()) {
|
if (stack.getCapability(NaturesAuraAPI.capAuraContainer).isPresent()) {
|
||||||
var container = stack.getCapability(NaturesAuraAPI.capAuraContainer).orElse(null);
|
var container = stack.getCapability(NaturesAuraAPI.capAuraContainer).orElse(null);
|
||||||
return (int) (1 - container.getStoredAura() / (double) container.getMaxAura());
|
return Math.round((container.getStoredAura() / (float) container.getMaxAura()) * 13);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getBarColor(ItemStack stack) {
|
||||||
|
var cap = stack.getCapability(NaturesAuraAPI.capAuraContainer).orElse(null);
|
||||||
|
return cap != null ? cap.getAuraColor() : super.getBarColor(stack);
|
||||||
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundTag nbt) {
|
public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundTag nbt) {
|
||||||
|
|
Loading…
Reference in a new issue