Package me.desht.pneumaticcraft.api.item
Interface ICustomDurabilityBar
- All Known Implementing Classes:
EmptyPCBItem,PneumaticArmorItem
public interface ICustomDurabilityBar
Implement on items which can show a custom durability bar *in addition to* any regular bar.
-
Method Summary
Modifier and TypeMethodDescriptionfloatgetCustomDurability(net.minecraft.world.item.ItemStack stack) Get the actual value for the custom durability of the item, which controls the width of the drawn bar.intgetCustomDurabilityColour(net.minecraft.world.item.ItemStack stack) Get the colour of the custom durability bar for this item, in RGB format (alpha will always be full)default booleanisShowingOtherBar(net.minecraft.world.item.ItemStack stack) Is this item already showing a regular durability bar? This controls if the custom bar needs a small Y offset so both bars can be seen.booleanshouldShowCustomDurabilityBar(net.minecraft.world.item.ItemStack stack) Check if this item should be showing its custom bar at this time.
-
Method Details
-
shouldShowCustomDurabilityBar
boolean shouldShowCustomDurabilityBar(net.minecraft.world.item.ItemStack stack) Check if this item should be showing its custom bar at this time.- Parameters:
stack- the item stack- Returns:
- true if the custom durability bar should be displayed, false otherwise
-
getCustomDurabilityColour
int getCustomDurabilityColour(net.minecraft.world.item.ItemStack stack) Get the colour of the custom durability bar for this item, in RGB format (alpha will always be full)- Parameters:
stack- the item stack- Returns:
- the colour to draw the custom durability bar
-
getCustomDurability
float getCustomDurability(net.minecraft.world.item.ItemStack stack) Get the actual value for the custom durability of the item, which controls the width of the drawn bar.- Parameters:
stack- the item stack- Returns:
- a durability value in the range 0.0F to 1.0F
-
isShowingOtherBar
default boolean isShowingOtherBar(net.minecraft.world.item.ItemStack stack) Is this item already showing a regular durability bar? This controls if the custom bar needs a small Y offset so both bars can be seen. If the regular bar is being shown, the custom bar will be directly above it; if it is not being shown, the custom bar will be drawn in its place.- Parameters:
stack- the item stack- Returns:
- true if the item will already be showing a normal durability bar
-