diff --git a/src/main/java/com/dreammaster/command/ItemInHandInfoCommand.java b/src/main/java/com/dreammaster/command/ItemInHandInfoCommand.java deleted file mode 100644 index 3dc99b037..000000000 --- a/src/main/java/com/dreammaster/command/ItemInHandInfoCommand.java +++ /dev/null @@ -1,125 +0,0 @@ -package com.dreammaster.command; - -import java.util.Collections; -import java.util.List; - -import net.minecraft.command.ICommand; -import net.minecraft.command.ICommandSender; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.IFluidContainerItem; - -import cpw.mods.fml.common.registry.GameRegistry; -import eu.usrv.yamcore.auxiliary.PlayerChatHelper; - -public class ItemInHandInfoCommand implements ICommand { - - @Override - public int compareTo(Object arg0) { - return 0; - } - - @Override - public String getCommandName() { - return "iteminhand"; - } - - @Override - public String getCommandUsage(ICommandSender p_71518_1_) { - return "/iih"; - } - - @Override - public List getCommandAliases() { - return Collections.singletonList("iih"); - } - - @Override - public void processCommand(ICommandSender pCmdSender, String[] pArgs) { - try { - if (!InGame(pCmdSender)) { - PlayerChatHelper.SendPlain(pCmdSender, "You have to execute this command ingame"); - return; - } - - EntityPlayer tEp = (EntityPlayer) pCmdSender; - ItemStack inHand = null; - if (tEp != null) { - inHand = tEp.getCurrentEquippedItem(); - if (inHand == null) { - PlayerChatHelper.SendPlain(pCmdSender, "Pickup an item first"); - return; - } - } - - GameRegistry.UniqueIdentifier UID = GameRegistry.findUniqueIdentifierFor(inHand.getItem()); - - PlayerChatHelper.SendPlain(pCmdSender, "== Item info"); - PlayerChatHelper.SendPlain(pCmdSender, String.format("Unloc.Name: [%s]", inHand.getUnlocalizedName())); - PlayerChatHelper.SendPlain(pCmdSender, String.format("ItemName: [%s]", UID.toString())); - PlayerChatHelper.SendPlain(pCmdSender, String.format("ItemMeta: [%s]", inHand.getItemDamage())); - PlayerChatHelper - .SendPlain(pCmdSender, String.format("FluidContainer: [%s]", getFluidContainerContents(inHand))); - PlayerChatHelper - .SendPlain(pCmdSender, String.format("ClassName: [%s]", inHand.getItem().getClass().toString())); - PlayerChatHelper.SendPlain( - pCmdSender, - String.format( - "ItemNBT: [%s]", - inHand.stackTagCompound == null ? "null" : inHand.stackTagCompound.toString())); - - } catch (Exception e) { - e.printStackTrace(); - PlayerChatHelper.SendError(pCmdSender, "Unknown error occoured"); - } - } - - private String getFluidContainerContents(ItemStack pItemInQuestion) { - String tResult = "No fluid container"; - - if (pItemInQuestion.getItem() instanceof IFluidContainerItem) { - IFluidContainerItem tFluidContainer = IFluidContainerItem.class.cast(pItemInQuestion.getItem()); - FluidStack tContents = tFluidContainer.getFluid(pItemInQuestion); - if (tContents != null) { - tResult = String.format( - "FluidID: [%d], UnlocName: [%s], Name: [%s]", - tContents.getFluid().getID(), - tContents.getFluid().getUnlocalizedName(), - tContents.getFluid().getName()); - } - } - - return tResult; - } - - private boolean InGame(ICommandSender pCmdSender) { - return pCmdSender instanceof EntityPlayer; - } - - private void SendHelpToPlayer(ICommandSender pCmdSender) { - if (!InGame(pCmdSender)) { - PlayerChatHelper.SendPlain(pCmdSender, "Command can only be executed ingame"); - } else { - PlayerChatHelper.SendInfo(pCmdSender, "/iih"); - } - } - - /* - * As it is a clientside thing, everyone should be allowed to do this - */ - @Override - public boolean canCommandSenderUseCommand(ICommandSender pCommandSender) { - return true; - } - - @Override - public List addTabCompletionOptions(ICommandSender p_71516_1_, String[] p_71516_2_) { - return null; - } - - @Override - public boolean isUsernameIndex(String[] p_82358_1_, int p_82358_2_) { - return false; - } -} diff --git a/src/main/java/com/dreammaster/config/CoreModConfig.java b/src/main/java/com/dreammaster/config/CoreModConfig.java index a4414826e..56b8d5c38 100644 --- a/src/main/java/com/dreammaster/config/CoreModConfig.java +++ b/src/main/java/com/dreammaster/config/CoreModConfig.java @@ -21,7 +21,6 @@ public CoreModConfig(File pConfigBaseDirectory, String pModCollectionDirectory, public boolean ModHazardousItems_Enabled; public boolean ModDebugVersionDisplay_Enabled; public boolean ModCustomToolTips_Enabled; - public boolean ModItemInHandInfo_Enabled; public boolean ModCustomFuels_Enabled; public boolean ModCustomDrops_Enabled; public boolean ModAdminErrorLogs_Enabled; @@ -62,7 +61,6 @@ protected void PreInit() { ModDebugVersionDisplay_Enabled = true; ModHazardousItems_Enabled = false; ModCustomToolTips_Enabled = false; - ModItemInHandInfo_Enabled = false; ModCustomFuels_Enabled = false; ModCustomDrops_Enabled = false; ModAdminErrorLogs_Enabled = true; @@ -122,11 +120,6 @@ protected void Init() { "Modules", ModCustomToolTips_Enabled, "Set to true to enable CustomToolTips module. This needs a separate config file which is created once you start with this setting enabled"); - ModItemInHandInfo_Enabled = _mainConfig.getBoolean( - "ItemInHandInfo", - "Modules", - ModItemInHandInfo_Enabled, - "Set to true to enable ItemInHandInfo module. If enabled, type /iih to display the item's name-info"); ModCustomDrops_Enabled = _mainConfig.getBoolean( "CustomDrops", "Modules", diff --git a/src/main/java/com/dreammaster/main/MainRegistry.java b/src/main/java/com/dreammaster/main/MainRegistry.java index b714125c1..918bc736b 100644 --- a/src/main/java/com/dreammaster/main/MainRegistry.java +++ b/src/main/java/com/dreammaster/main/MainRegistry.java @@ -42,7 +42,6 @@ import com.dreammaster.command.CustomFuelsCommand; import com.dreammaster.command.CustomToolTipsCommand; import com.dreammaster.command.HazardousItemsCommand; -import com.dreammaster.command.ItemInHandInfoCommand; import com.dreammaster.config.CoreModConfig; import com.dreammaster.creativetab.ModTabList; import com.dreammaster.detrav.ScannerTools; @@ -560,9 +559,6 @@ public void serverLoad(FMLServerStartingEvent pEvent) { if (CoreConfig.ModCustomToolTips_Enabled) { pEvent.registerServerCommand(new CustomToolTipsCommand()); } - if (CoreConfig.ModItemInHandInfo_Enabled) { - pEvent.registerServerCommand(new ItemInHandInfoCommand()); - } if (CoreConfig.ModCustomFuels_Enabled) { pEvent.registerServerCommand(new CustomFuelsCommand()); }