Applied-Energistics-2-tiler.../items/tools/quartz/ToolQuartzCuttingKnife.java

76 lines
1.8 KiB
Java
Raw Normal View History

package appeng.items.tools.quartz;
import java.util.EnumSet;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.implementations.guiobjects.IGuiItem;
import appeng.api.implementations.guiobjects.IGuiItemObject;
import appeng.core.features.AEFeature;
import appeng.core.sync.GuiBridge;
import appeng.items.AEBaseItem;
import appeng.items.contents.QuartzKnifeObj;
import appeng.util.Platform;
public class ToolQuartzCuttingKnife extends AEBaseItem implements IGuiItem
{
public ToolQuartzCuttingKnife(AEFeature type) {
super( ToolQuartzCuttingKnife.class, type.name() );
setfeature( EnumSet.of( type, AEFeature.QuartzKnife ) );
setMaxDamage( 50 );
setMaxStackSize( 1 );
}
@Override
public boolean isRepairable()
{
return false;
}
@Override
public boolean doesContainerItemLeaveCraftingGrid(ItemStack par1ItemStack)
{
return false;
}
@Override
public boolean hasContainerItem()
{
return true;
}
@Override
public ItemStack onItemRightClick(ItemStack it, World w, EntityPlayer p)
{
if ( Platform.isServer() )
Platform.openGUI( p, null, ForgeDirection.UNKNOWN, GuiBridge.GUI_QUARTZ_KNIFE );
p.swingItem();
return it;
}
@Override
public boolean onItemUse(ItemStack is, EntityPlayer p, World w, int x, int y, int z, int s, float hitx, float hity, float hitz)
{
if ( Platform.isServer() )
Platform.openGUI( p, null, ForgeDirection.UNKNOWN, GuiBridge.GUI_QUARTZ_KNIFE );
return true;
}
@Override
2014-02-09 02:34:52 +01:00
public ItemStack getContainerItem(ItemStack itemStack)
{
itemStack.setItemDamage( itemStack.getItemDamage() + 1 );
return itemStack;
}
@Override
public IGuiItemObject getGuiObject(ItemStack is, World world, int x, int y, int z)
{
return new QuartzKnifeObj( is );
}
}