31 lines
853 B
Java
31 lines
853 B
Java
package net.paladrill.paladrillmod.procedure;
|
|
|
|
import net.paladrill.paladrillmod.ElementsPaladrillmodMod;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import java.util.Random;
|
|
import java.util.Map;
|
|
|
|
@ElementsPaladrillmodMod.ModElement.Tag
|
|
public class ProcedureDurability extends ElementsPaladrillmodMod.ModElement {
|
|
public ProcedureDurability(ElementsPaladrillmodMod instance) {
|
|
super(instance, 169);
|
|
}
|
|
|
|
public static void executeProcedure(Map<String, Object> dependencies) {
|
|
if (dependencies.get("itemstack") == null) {
|
|
System.err.println("Failed to load dependency itemstack for procedure Durability!");
|
|
return;
|
|
}
|
|
ItemStack itemstack = (ItemStack) dependencies.get("itemstack");
|
|
{
|
|
ItemStack _ist = (itemstack);
|
|
if (_ist.attemptDamageItem((int) 1, new Random(), null)) {
|
|
_ist.shrink(1);
|
|
_ist.setItemDamage(0);
|
|
}
|
|
}
|
|
}
|
|
}
|