2015-02-18 16:47:59 +01:00
|
|
|
package com.pahimar.ee3.command;
|
|
|
|
|
2015-02-20 04:09:10 +01:00
|
|
|
import com.pahimar.ee3.knowledge.TransmutationKnowledgeRegistry;
|
2015-02-18 16:47:59 +01:00
|
|
|
import com.pahimar.ee3.reference.Messages;
|
|
|
|
import com.pahimar.ee3.reference.Names;
|
|
|
|
import net.minecraft.command.CommandBase;
|
|
|
|
import net.minecraft.command.ICommandSender;
|
2015-02-20 04:09:10 +01:00
|
|
|
import net.minecraft.command.WrongUsageException;
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
import net.minecraft.item.ItemStack;
|
2015-02-18 16:47:59 +01:00
|
|
|
|
|
|
|
public class CommandTemplateForgetCurrentItem extends CommandBase
|
|
|
|
{
|
|
|
|
@Override
|
|
|
|
public String getCommandName()
|
|
|
|
{
|
|
|
|
return Names.Commands.TEMPLATE_FORGET_CURRENT_ITEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getRequiredPermissionLevel()
|
|
|
|
{
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String getCommandUsage(ICommandSender commandSender)
|
|
|
|
{
|
|
|
|
return Messages.Commands.TEMPLATE_FORGET_CURRENT_ITEM_USAGE;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void processCommand(ICommandSender commandSender, String[] args)
|
|
|
|
{
|
2015-02-20 04:09:10 +01:00
|
|
|
if (args.length < 1)
|
|
|
|
{
|
|
|
|
throw new WrongUsageException(Messages.Commands.TEMPLATE_FORGET_CURRENT_ITEM_USAGE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ItemStack itemStack = ((EntityPlayer) commandSender).getCurrentEquippedItem();
|
2015-02-18 16:47:59 +01:00
|
|
|
|
2015-02-20 04:09:10 +01:00
|
|
|
if (itemStack != null)
|
|
|
|
{
|
|
|
|
TransmutationKnowledgeRegistry.getInstance().makeTemplateForget(itemStack);
|
|
|
|
func_152373_a(commandSender, this, Messages.Commands.TEMPLATE_FORGET_CURRENT_ITEM_SUCCESS, new Object[]{commandSender.getCommandSenderName(), itemStack.func_151000_E()});
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
throw new WrongUsageException(Messages.Commands.NO_ITEM);
|
|
|
|
}
|
|
|
|
}
|
2015-02-18 16:47:59 +01:00
|
|
|
}
|
|
|
|
}
|