src/main/java/mezz/jei/util/Commands.java
private static void giveStackVanilla(ItemStack itemStack, int amount) {
		Item item = itemStack.getItem();
		if (item == null) {
			String stackInfo = ErrorUtil.getItemStackInfo(itemStack);
			Log.error("Null item in itemStack: " + stackInfo, new NullPointerException());
			return;
		}

		ResourceLocation itemResourceLocation = item.getRegistryName();
		if (itemResourceLocation == null) {
			String stackInfo = ErrorUtil.getItemStackInfo(itemStack);
			Log.error("item.getRegistryName() returned null for: " + stackInfo, new NullPointerException());
			return;
		}

		EntityPlayerSP sender = Minecraft.getMinecraft().thePlayer;
		String senderName = sender.getName();

		List<String> commandStrings = new ArrayList<String>();
		commandStrings.add("/give");
		commandStrings.add(senderName);
		commandStrings.add(itemResourceLocation.toString());
		commandStrings.add(String.valueOf(amount));
		commandStrings.add(String.valueOf(itemStack.getMetadata()));

		NBTTagCompound tagCompound = itemStack.getTagCompound();
		if (tagCompound != null) {
			commandStrings.add(tagCompound.toString());
		}

		String fullCommand = StringUtils.join(commandStrings, " ");
		sendChatMessage(sender, fullCommand);
	}
/**
	 * Fallback for when JEI is not on the server, tries to use the /give command.
	 */
Fallback for when JEI is not on the server, tries to use the /give command.
Fallback for when JEI is not on the server tries to use the / give command .
private static void giveStackVanilla(ItemStack itemStack, int amount) {
		Item item = itemStack.getItem();
		if (item == null) {
			String stackInfo = ErrorUtil.getItemStackInfo(itemStack);
			Log.error("Null item in itemStack: " + stackInfo, new NullPointerException());
			return;
		}
		ResourceLocation itemResourceLocation = item.getRegistryName();
		if (itemResourceLocation == null) {
			String stackInfo = ErrorUtil.getItemStackInfo(itemStack);
			Log.error("item.getRegistryName() returned null for: " + stackInfo, new NullPointerException());
			return;
		}
		EntityPlayerSP sender = Minecraft.getMinecraft().thePlayer;
		String senderName = sender.getName();
		List<String> commandStrings = new ArrayList<String>();
		commandStrings.add("/give");
		commandStrings.add(senderName);
		commandStrings.add(itemResourceLocation.toString());
		commandStrings.add(String.valueOf(amount));
		commandStrings.add(String.valueOf(itemStack.getMetadata()));
		NBTTagCompound tagCompound = itemStack.getTagCompound();
		if (tagCompound != null) {
			commandStrings.add(tagCompound.toString());
		}
		String fullCommand = StringUtils.join(commandStrings, " ");
		sendChatMessage(sender, fullCommand);
	}
private static void giveStackVanilla ( ItemStack itemStack , int amount ) { Item item = itemStack . getItem ( ) ; if ( item == null ) { String stackInfo = ErrorUtil . getItemStackInfo ( itemStack ) ; Log . error ( "Null item in itemStack: " + stackInfo , new NullPointerException ( ) ) ; return ; } ResourceLocation itemResourceLocation = item . getRegistryName ( ) ; if ( itemResourceLocation == null ) { String stackInfo = ErrorUtil . getItemStackInfo ( itemStack ) ; Log . error ( "item.getRegistryName() returned null for: " + stackInfo , new NullPointerException ( ) ) ; return ; } EntityPlayerSP sender = Minecraft . getMinecraft ( ) . thePlayer ; String senderName = sender . getName ( ) ; List < String > commandStrings = new ArrayList < String > ( ) ; commandStrings . add ( "/give" ) ; commandStrings . add ( senderName ) ; commandStrings . add ( itemResourceLocation . toString ( ) ) ; commandStrings . add ( String . valueOf ( amount ) ) ; commandStrings . add ( String . valueOf ( itemStack . getMetadata ( ) ) ) ; NBTTagCompound tagCompound = itemStack . getTagCompound ( ) ; if ( tagCompound != null ) { commandStrings . add ( tagCompound . toString ( ) ) ; } String fullCommand = StringUtils . join ( commandStrings , " " ) ; sendChatMessage ( sender , fullCommand ) ; }
Fallback for when JEI is not on the server, tries to use the /give command.
Fallback for when JEI is not on the server tries to use the / give command .