mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-25 14:24:35 +00:00
44 lines
939 B
Java
44 lines
939 B
Java
package mekanism.common;
|
|
|
|
import net.minecraft.entity.Entity;
|
|
import net.minecraft.entity.EntityLiving;
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.world.World;
|
|
|
|
public class ItemStopwatch extends ItemMekanism
|
|
{
|
|
public ItemStopwatch(int i)
|
|
{
|
|
super(i);
|
|
setMaxStackSize(1);
|
|
setMaxDamage(5000);
|
|
setCreativeTab(Mekanism.tabMekanism);
|
|
}
|
|
|
|
@Override
|
|
public boolean hasEffect(ItemStack itemstack)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
|
|
{
|
|
if(itemstack.getItemDamage() == 0)
|
|
{
|
|
entityplayer.openGui(Mekanism.instance, 0, world, 0, 0, 0);
|
|
}
|
|
return itemstack;
|
|
}
|
|
|
|
@Override
|
|
public void onUpdate(ItemStack itemstack, World world, Entity entity, int i, boolean flag)
|
|
{
|
|
if(itemstack.getItemDamage() > 0)
|
|
{
|
|
itemstack.damageItem(-1, (EntityLiving)entity);
|
|
}
|
|
}
|
|
}
|