package uk.co.wehavecookies56.kk.common.item; import java.util.List; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumHand; import net.minecraft.world.World; import uk.co.wehavecookies56.kk.common.lib.GuiIDs; import uk.co.wehavecookies56.kk.common.lib.Strings; import uk.co.wehavecookies56.kk.common.network.packet.PacketDispatcher; import uk.co.wehavecookies56.kk.common.network.packet.server.OpenGui; import uk.co.wehavecookies56.kk.common.util.Utils; public class ItemSynthesisBagM extends Item { public ItemSynthesisBagM () { setMaxStackSize(1); } @Override public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand) { if (world.isRemote) PacketDispatcher.sendToServer(new OpenGui(GuiIDs.GUI_SYNTHESISBAGM_INV)); return super.onItemRightClick(stack, world, player, hand); } @Override public void addInformation (ItemStack stack, EntityPlayer playerIn, List tooltip, boolean advanced) { int x = 30; String s = Utils.translateToLocal(Strings.SynthesisBagDesc); s = s.replaceAll("(.{" + x + ",}?)\\s+", "$1\n"); String[] splitS = s.split("\n"); for (String element : splitS) tooltip.add(element); } }