mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
42 lines
1005 B
Java
42 lines
1005 B
Java
package com.hbm.items.tool;
|
|
|
|
import com.hbm.main.MainRegistry;
|
|
|
|
import api.hbm.block.IToolable;
|
|
import api.hbm.block.IToolable.ToolType;
|
|
import net.minecraft.block.Block;
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
import net.minecraft.item.Item;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.world.World;
|
|
|
|
public class ItemTooling extends ItemCraftingDegradation {
|
|
|
|
ToolType type;
|
|
|
|
public ItemTooling(ToolType type, int durability) {
|
|
super(durability);
|
|
this.type = type;
|
|
this.setFull3D();
|
|
this.setCreativeTab(MainRegistry.controlTab);
|
|
}
|
|
|
|
@Override
|
|
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float fX, float fY, float fZ) {
|
|
|
|
Block b = world.getBlock(x, y, z);
|
|
|
|
if(b instanceof IToolable) {
|
|
if(((IToolable)b).onScrew(world, player, x, y, z, side, fX, fY, fZ, this.type)) {
|
|
|
|
if(this.getMaxDamage() > 0)
|
|
stack.damageItem(1, player);
|
|
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}
|