/
Belyash5
/
Flu
Обзор
Документация
Войти
/
Belyash5
/
Flu
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/main/java/com/hbm/items/machine/ItemFuelRod.java
41 строка
1 KB
Boblet
re-did mini nuke code, cleaned up unused imports
02 мар 2023, 11:54
02 мар 2023, 11:54
c775bb7
Код
Авторство
О чём код?
package com.hbm.items.machine; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; public class ItemFuelRod extends Item { public int lifeTime; public ItemFuelRod(int life) { this.lifeTime = life; this.canRepair = false; } public static void setLifeTime(ItemStack stack, int time) { if(!stack.hasTagCompound()) stack.stackTagCompound = new NBTTagCompound(); stack.stackTagCompound.setInteger("life", time); } public static int getLifeTime(ItemStack stack) { if(!stack.hasTagCompound()) { stack.stackTagCompound = new NBTTagCompound(); return 0; } return stack.stackTagCompound.getInteger("life"); } public boolean showDurabilityBar(ItemStack stack) { return getDurabilityForDisplay(stack) > 0D; } public double getDurabilityForDisplay(ItemStack stack) { return (double)getLifeTime(stack) / (double)((ItemFuelRod)stack.getItem()).lifeTime; } }