diff options
| author | OnyxDarkKnight <sor1n.iliutza16@gmail.com> | 2014-03-30 22:59:36 +0300 |
|---|---|---|
| committer | OnyxDarkKnight <sor1n.iliutza16@gmail.com> | 2014-03-30 22:59:36 +0300 |
| commit | 9d0d74a3ba0aeca9f1130d1228fa4b9ef08d19d6 (patch) | |
| tree | 86c2e6f3fc80cb4473b9044bdc00d0a2a082ad1b /common/darkknight/jewelrycraft/container | |
| parent | 5fce447142b3c0f4a214ca7eb208d9e5c25e6377 (diff) | |
Added a gui! Yaaay!
Diffstat (limited to 'common/darkknight/jewelrycraft/container')
10 files changed, 1023 insertions, 3 deletions
diff --git a/common/darkknight/jewelrycraft/container/ContainerGuide.java b/common/darkknight/jewelrycraft/container/ContainerGuide.java new file mode 100644 index 0000000..ef05cc4 --- /dev/null +++ b/common/darkknight/jewelrycraft/container/ContainerGuide.java @@ -0,0 +1,18 @@ +package darkknight.jewelrycraft.container; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; + +/** + * User: joel / Date: 16.12.13 / Time: 22:36 + */ +public class ContainerGuide extends Container { + + public ContainerGuide() { + } + + @Override + public boolean canInteractWith(EntityPlayer entityplayer) { + return true; + } +}
\ No newline at end of file diff --git a/common/darkknight/jewelrycraft/container/GuiHandler.java b/common/darkknight/jewelrycraft/container/GuiHandler.java index a0afc3f..6e1a78a 100644 --- a/common/darkknight/jewelrycraft/container/GuiHandler.java +++ b/common/darkknight/jewelrycraft/container/GuiHandler.java @@ -6,25 +6,57 @@ import net.minecraft.world.World; import cpw.mods.fml.common.network.IGuiHandler; import cpw.mods.fml.common.network.NetworkRegistry; import darkknight.jewelrycraft.JewelrycraftMod; +import darkknight.jewelrycraft.client.GuiGuide; import darkknight.jewelrycraft.client.GuiRingChest; public class GuiHandler implements IGuiHandler { + public static enum GuiId { + ringChest, + guide; + + public static final GuiId[] VALUES = GuiId.values(); + } + public GuiHandler() { NetworkRegistry.instance().registerGuiHandler(JewelrycraftMod.instance, this); } - + @Override public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { - return new ContainerRingChest(player.inventory, (TileEntityChest) world.getBlockTileEntity(x, y, z)); + final GuiId guiId = getGuiId(ID); + if (guiId == null) return null; + switch(guiId) + { + case ringChest: return new ContainerRingChest(player.inventory, (TileEntityChest) world.getBlockTileEntity(x, y, z)); + case guide: return new ContainerGuide(); + default: return null; + } } @Override public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { - return new GuiRingChest((ContainerRingChest) getServerGuiElement(ID, player, world, x, y, z)); + final GuiId guiId = getGuiId(ID); + if (guiId == null) return null; + switch(guiId) + { + case ringChest: return new GuiRingChest((ContainerRingChest) getServerGuiElement(ID, player, world, x, y, z)); + case guide: return new GuiGuide((ContainerGuide) getServerGuiElement(ID, player, world, x, y, z), world); + default: return null; + } } + private static GuiId getGuiId(int id) { + try + { + return GuiId.VALUES[id]; + } + catch (ArrayIndexOutOfBoundsException e) + { + return null; + } + } } diff --git a/common/darkknight/jewelrycraft/container/GuiRectangle.java b/common/darkknight/jewelrycraft/container/GuiRectangle.java new file mode 100644 index 0000000..76dee04 --- /dev/null +++ b/common/darkknight/jewelrycraft/container/GuiRectangle.java @@ -0,0 +1,66 @@ +package darkknight.jewelrycraft.container; + +import java.util.Arrays; + +import net.minecraft.item.ItemStack; + +import darkknight.jewelrycraft.client.GuiGuide; + +public class GuiRectangle +{ + + private int x; + private int y; + private int w; + private int h; + + public GuiRectangle(int x, int y, int w, int h) + { + this.x = x; + this.y = y; + this.w = w; + this.h = h; + } + + public boolean inRect(GuiGuide gui, int mouseX, int mouseY) + { + mouseX -= gui.getLeft(); + mouseY -= gui.getTop(); + + return x <= mouseX && mouseX <= x + w && y <= mouseY && mouseY <= y + h; + } + + public void setX(int x) + { + this.x = x; + } + + public void setY(int y) + { + this.y = y; + } + + + public void draw(GuiGuide gui, int srcX, int srcY) + { + gui.drawTexturedModalRect(gui.getLeft() + x, gui.getTop() + y, srcX, srcY, w, h); + } + + + public void draw(GuiGuide gui, int srcX, int srcY, int width, int height) + { + gui.drawTexturedModalRect(gui.getLeft() + x, gui.getTop() + y, srcX, srcY, width, height); + } + + public void drawString(GuiGuide gui, int mouseX, int mouseY, String str) + { + if (inRect(gui, mouseX, mouseY)) { + gui.drawHoverString(Arrays.asList(str.split("\n")), mouseX - gui.getLeft(), mouseY - gui.getTop()); + } + } + + public ItemStack getIcon() + { + return null; + } +} diff --git a/common/darkknight/jewelrycraft/container/GuiTab.java b/common/darkknight/jewelrycraft/container/GuiTab.java new file mode 100644 index 0000000..c092ba6 --- /dev/null +++ b/common/darkknight/jewelrycraft/container/GuiTab.java @@ -0,0 +1,37 @@ +package darkknight.jewelrycraft.container; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import darkknight.jewelrycraft.client.GuiGuide; + +@SideOnly(Side.CLIENT) +public abstract class GuiTab extends GuiRectangle +{ + int values, del; + private String name; + + public GuiTab(String name, int id) + { + super(-62, 10 + 19*id, 19, 18); + this.name = name; + values = 0; + del = 0; + } + + public String getName() + { + return name; + } + + public abstract void drawBackground(GuiGuide gui, int x, int y, int page); + public abstract void drawForeground(GuiGuide gui, int x, int y, int page); + public void mouseClick(GuiGuide gui, int x, int y, int button) {} + public void mouseMoveClick(GuiGuide gui, int x, int y, int button, long timeSinceClicked) {} + public void mouseReleased(GuiGuide gui, int x, int y, int button) {} + + public int getMaxPages() + { + return 1; + } + +} diff --git a/common/darkknight/jewelrycraft/container/GuiTabBlocks.java b/common/darkknight/jewelrycraft/container/GuiTabBlocks.java new file mode 100644 index 0000000..614b6d4 --- /dev/null +++ b/common/darkknight/jewelrycraft/container/GuiTabBlocks.java @@ -0,0 +1,294 @@ +package darkknight.jewelrycraft.container; + +import java.util.ArrayList; + +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import darkknight.jewelrycraft.block.BlockList; +import darkknight.jewelrycraft.client.GuiGuide; +import darkknight.jewelrycraft.item.ItemList; + +public class GuiTabBlocks extends GuiTab +{ + + public GuiTabBlocks(int id) + { + super("Blocks", id); + } + + public ItemStack getIcon() + { + return new ItemStack(BlockList.jewelAltar); + } + + @Override + public void drawBackground(GuiGuide gui, int x, int y, int page) + { + ArrayList<String> text = new ArrayList<String>(); + ArrayList<ItemStack> items = new ArrayList<ItemStack>(); + int xPos = (page%2==0)?107:-35; + switch(page) + { + case 1: + text.add(" This ore is extremely"); + text.add("rare and can be found"); + text.add("only between Y level 5"); + text.add("and 8. It can only be"); + text.add("mined using a diamond"); + text.add("pickaxe."); + Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop(), new ItemStack(BlockList.shadowOre), text, 90f); + break; + case 2: + text.add(" The Shadow Block is"); + text.add("crafted using 9 shadow"); + text.add("ingots. It has been"); + text.add("discovered that it"); + text.add("poseses abnormal"); + text.add("properties in the"); + text.add("shadow. The darker it"); + items.add(new ItemStack(BlockList.shadowBlock)); + for(int i = 1; i <= 9; i++) items.add(new ItemStack(ItemList.shadowIngot)); + Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, items, x, y); + break; + case 3: + text.add("is, the more"); + text.add("transparent it will be,"); + text.add("until it becomes"); + text.add("walkable through. If a"); + text.add("comparator is attached"); + text.add("to it, the output"); + text.add("strength will be equal"); + text.add("to the value of"); + text.add("darkness it is in."); + Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text); + break; + case 4: + text.add(" The smelter is one of"); + text.add("the first blocks needed"); + text.add("to get started with"); + text.add("Jewelrycraft. Requiring"); + text.add("just some cobble and"); + text.add("a couple buckets, it's"); + text.add("the most important"); + items.add(new ItemStack(BlockList.smelter)); + items.add(new ItemStack(Block.cobblestone)); + items.add(new ItemStack(Item.bucketEmpty)); + items.add(new ItemStack(Block.cobblestone)); + items.add(new ItemStack(Block.cobblestone)); + items.add(null); + items.add(new ItemStack(Block.cobblestone)); + items.add(new ItemStack(Block.cobblestone)); + items.add(new ItemStack(Item.bucketLava)); + items.add(new ItemStack(Block.cobblestone)); + Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, items, x, y); + break; + case 5: + text.add("block as it can melt"); + text.add("ingots which can be"); + text.add("made into pieces of"); + text.add("jewellery, like rings"); + text.add("or necklaces. To use"); + text.add("the block all you need"); + text.add("to do is right click"); + text.add("on it with any ingot."); + text.add("If left clicked while"); + text.add("smelting, a message"); + text.add("will appear saying the"); + text.add("percentage it is done."); + Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text); + break; + case 6: + text.add("If left clicked when"); + text.add("it's done smelting,"); + text.add("a message will be"); + text.add("displayed, mentioning"); + text.add("the contents of the"); + text.add("block."); + Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text); + break; + case 7: + text.add(" The molder is a key"); + text.add("piece in creating"); + text.add("jewellery. You need"); + text.add("to pour the molten"); + text.add("metal out of the"); + text.add("smelter somewhere."); + text.add("That somewhere is the"); + + items.add(new ItemStack(BlockList.molder)); + items.add(new ItemStack(Block.cobblestone)); + items.add(null); + items.add(new ItemStack(Block.cobblestone)); + for(int i = 1; i <= 3; i++) items.add(new ItemStack(Block.cobblestone)); + Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, items, x, y); + break; + case 8: + text.add("molder. But before"); + text.add("pouring the molten"); + text.add("metal in it, you must"); + text.add("first add a mold."); + text.add("You can do that by"); + text.add("simply right clicking"); + text.add("the block with the"); + text.add("mold of your choice."); + text.add("If you want to get the"); + text.add("mold out, simply crouch"); + text.add("and right click it with"); + text.add("an empty hand."); + Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text); + break; + case 9: + text.add(" Once you have a mold"); + text.add("inside, left click on"); + text.add("the smelter and wait"); + text.add("for the metal to cool"); + text.add("down. When it's done,"); + text.add("left click on the"); + text.add("molder to get the"); + text.add("jewellery. §4Be aware"); + text.add("§4that this block must be"); + text.add("§4placed directly in front"); + text.add("§4of the smelter,"); + text.add("§4otherwise it won't work!"); + Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text); + break; + case 10: + text.add(" Your jewellery on"); + text.add("their own don't do"); + text.add("much. They need to be"); + text.add("modified a bit and the"); + text.add("only way to do that is"); + text.add("by using this block."); + text.add("Simply right click the"); + if(del == 0) values++; + del++; + if(del >= 300) del = 0; + if(values >= 4) values = 0; + items.add(new ItemStack(BlockList.jewelCraftingTable)); + for(int i = 1; i <= 3; i++)items.add(new ItemStack(Block.planks, 1, values)); + items.add(new ItemStack(Block.cobblestone)); + items.add(null); + items.add(new ItemStack(Block.cobblestone)); + items.add(new ItemStack(Block.cobblestone)); + items.add(null); + items.add(new ItemStack(Block.cobblestone)); + Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, items, x, y); + break; + case 11: + text.add("block while holding the"); + text.add("jewellery to place it in."); + text.add("After that just add in"); + text.add("a jewel or a modifier,"); + text.add("or even both, to the"); + text.add("block. To do that simply"); + text.add("right click with them on"); + text.add("the block. Once it's"); + text.add("done modifying, left"); + text.add("click on it to retrieve"); + text.add("the modified item. If"); + text.add("you wish to know how"); + Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text); + break; + case 12: + text.add("much is left before the"); + text.add("transformation is done,"); + text.add("simply left click on the"); + text.add("table in the process."); + text.add(" A list with all the"); + text.add("possible modifiers is"); + text.add("located in a separate"); + text.add("tab."); + Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text); + break; + case 13: + text.add(" This block can store"); + text.add("any jewellery in it"); + text.add("and activate their"); + text.add("effects as it were a"); + text.add("player. However, it"); + text.add("does not work with"); + text.add("everything. You can"); + items.add(new ItemStack(BlockList.jewelAltar)); + items.add(new ItemStack(Block.whiteStone)); + items.add(new ItemStack(Block.cloth, 1, 5)); + items.add(new ItemStack(Block.whiteStone)); + items.add(new ItemStack(Block.netherBrick)); + items.add(new ItemStack(Block.cloth, 1, 5)); + items.add(new ItemStack(Block.netherBrick)); + items.add(new ItemStack(Block.netherBrick)); + items.add(new ItemStack(Block.netherBrick)); + items.add(new ItemStack(Block.netherBrick)); + Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, items, x, y); + break; + case 14: + text.add("find out which jewellery"); + text.add("works by looking in"); + text.add("their apropriate tab."); + text.add(" Each item will have a"); + text.add("note where it is"); + text.add("mentioned their effect"); + text.add("when placed in this"); + text.add("block."); + Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text); + break; + case 15: + text.add(" The Storage"); + text.add("Displayer, as the"); + text.add("name suggests, can"); + text.add("store a large amount"); + text.add("of a single item/block"); + text.add("placed in it. This will"); + text.add("display all possible"); + items.add(new ItemStack(BlockList.displayer)); + items.add(null); + items.add(new ItemStack(Item.ingotIron)); + items.add(null); + items.add(new ItemStack(Item.ingotIron)); + items.add(new ItemStack(Item.ingotIron)); + items.add(new ItemStack(Item.ingotIron)); + items.add(new ItemStack(Block.blockEmerald)); + items.add(new ItemStack(Block.blockEmerald)); + items.add(new ItemStack(Block.blockEmerald)); + Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, items, x, y); + break; + case 16: + text.add("infromation about the"); + text.add("object in it, such as"); + text.add("the name, durability,"); + text.add("enchantments and many"); + text.add("more. Below the name"); + text.add("is shown the amount"); + text.add("stored. To store"); + text.add("something in it simply"); + text.add("right click with that"); + text.add("object on it and the"); + text.add("whole amount of items"); + text.add("or blocks will be"); + Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text); + break; + case 17: + text.add("immediately stored"); + text.add("inside. To retrieve"); + text.add("a single item just"); + text.add("left click the block."); + text.add("If you wish to get"); + text.add("a whole stack, just"); + text.add("crouch and left click."); + Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text); + break; + default:; + } + } + + public int getMaxPages() + { + return 17; + } + + @Override + public void drawForeground(GuiGuide gui, int x, int y, int page) + { + } + +} diff --git a/common/darkknight/jewelrycraft/container/GuiTabItems.java b/common/darkknight/jewelrycraft/container/GuiTabItems.java new file mode 100644 index 0000000..78ab2dc --- /dev/null +++ b/common/darkknight/jewelrycraft/container/GuiTabItems.java @@ -0,0 +1,227 @@ +package darkknight.jewelrycraft.container; + +import java.util.ArrayList; + +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import darkknight.jewelrycraft.block.BlockList; +import darkknight.jewelrycraft.client.GuiGuide; +import darkknight.jewelrycraft.item.ItemList; + +public class GuiTabItems extends GuiTab +{ + + public GuiTabItems(int id) + { + super("Items", id); + } + + public ItemStack getIcon() + { + return new ItemStack(ItemList.thiefGloves); + } + + @Override + public void drawBackground(GuiGuide gui, int x, int y, int page) + { + ArrayList<String> text = new ArrayList<String>(); + ArrayList<ItemStack> items = new ArrayList<ItemStack>(); + int xPos = (page%2==0)?107:-35; + switch(page) + { + case 1: + text.add(" Shadow ingots are"); + text.add("obtained by smelting"); + text.add("shadow ore. They are"); + text.add("used in a few recipes"); + text.add("and an important key"); + text.add("for making some"); + text.add("jewellery work."); + items.add(new ItemStack(BlockList.shadowOre)); + items.add(new ItemStack(ItemList.shadowIngot)); + Page.addSmeltingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text, items, x, y); + break; + case 2: + text.add(" These gloves allow"); + text.add("you to steal the trades"); + text.add("the pesky Testificates"); + text.add("have to offer."); + text.add(" To use these simply"); + text.add("open their gui at least"); + text.add("once, then crouch and"); + items.add(new ItemStack(ItemList.thiefGloves)); + items.add(new ItemStack(ItemList.shadowIngot)); + items.add(null); + items.add(new ItemStack(ItemList.shadowIngot)); + items.add(new ItemStack(Block.cloth, 1, 15)); + items.add(new ItemStack(ItemList.shadowIngot)); + items.add(new ItemStack(Block.cloth, 1, 15)); + items.add(new ItemStack(Block.cloth, 1, 15)); + items.add(new ItemStack(ItemList.shadowIngot)); + items.add(new ItemStack(Block.cloth, 1, 15)); + Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, items, x, y); + break; + case 3: + text.add("right click on the them"); + text.add("to steal the trades."); + text.add("A villager has 7 of the"); + text.add("same trade item. So, for"); + text.add("example, if he wants 2"); + text.add("emeralds in exchange"); + text.add("for 4 diamonds, you will"); + text.add("get 28 diamonds from"); + text.add("him, because 7*4=28."); + text.add("However, if you have"); + text.add("traded with him before,"); + text.add("then he will have that"); + Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text); + break; + case 4: + text.add("many times less of the"); + text.add("item. This has a maximum"); + text.add("of 10 uses before it"); + text.add("breaks."); + Page.addTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text); + break; + case 5: + text.add(" In order to get the"); + text.add("ingot back from the"); + text.add("smelter you need a"); + text.add("mold for it. However,"); + text.add("this mold can't be used."); + text.add("It is too soft. It needs"); + text.add("to be hardened in"); + text.add("order for it to be used."); + items.add(new ItemStack(ItemList.clayMolds, 1, 0)); + items.add(new ItemStack(Item.clay)); + items.add(new ItemStack(Item.clay)); + Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), true, text, items, x, y); + break; + case 6: + text.add(" By smelting the clay"); + text.add("mold you get a harder"); + text.add("version which can be"); + text.add("used to create ingots."); + text.add("Simply right click with"); + text.add("this on a molder to"); + text.add("attach it and you're"); + text.add("ready to go."); + items.add(new ItemStack(ItemList.clayMolds, 1, 0)); + items.add(new ItemStack(ItemList.molds, 1, 0)); + Page.addSmeltingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text, items, x, y); + break; + case 7: + text.add(" In order to create a"); + text.add("ring you need a mold"); + text.add("for it. However, this"); + text.add("one can't be used. It is"); + text.add("too soft. It needs to be"); + text.add("hardened in order for"); + text.add("it to be used."); + items.add(new ItemStack(ItemList.clayMolds, 1, 1)); + items.add(null); + items.add(new ItemStack(Item.clay)); + items.add(null); + items.add(new ItemStack(Item.clay)); + items.add(null); + items.add(new ItemStack(Item.clay)); + items.add(null); + items.add(new ItemStack(Item.clay)); + items.add(null); + Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, items, x, y); + break; + case 8: + text.add(" By smelting the clay"); + text.add("mold you get a harder"); + text.add("version which can be"); + text.add("used to create rings."); + text.add("Simply right click with"); + text.add("this on a molder to"); + text.add("attach it and you're"); + text.add("ready to go."); + items.add(new ItemStack(ItemList.clayMolds, 1, 1)); + items.add(new ItemStack(ItemList.molds, 1, 1)); + Page.addSmeltingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text, items, x, y); + break; + case 9: + text.add(" In order to create a"); + text.add("necklace you need a"); + text.add("mold for it. However,"); + text.add("this one can't be used."); + text.add("It is too soft. It needs"); + text.add("to be hardened in"); + text.add("order for it to be used."); + items.add(new ItemStack(ItemList.clayMolds, 1, 2)); + items.add(new ItemStack(Item.clay)); + items.add(null); + items.add(new ItemStack(Item.clay)); + items.add(new ItemStack(Item.clay)); + items.add(null); + items.add(new ItemStack(Item.clay)); + items.add(null); + items.add(new ItemStack(Item.clay)); + items.add(null); + Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, items, x, y); + break; + case 10: + text.add(" By smelting the clay"); + text.add("mold you get a harder"); + text.add("version which can be"); + text.add("used to create"); + text.add("necklaces. Simply right"); + text.add("click with this on a"); + text.add("molder to attach it and"); + text.add("you're ready to go."); + items.add(new ItemStack(ItemList.clayMolds, 1, 2)); + items.add(new ItemStack(ItemList.molds, 1, 2)); + Page.addSmeltingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), text, items, x, y); + break; + case 11: + text.add(" Crystals don't do"); + text.add("much. They can be dyed"); + text.add("in any color and used"); + text.add("as jewels to create a"); + text.add("nice jewellery."); + items.add(new ItemStack(ItemList.crystal, 1, 15)); + items.add(null); + items.add(new ItemStack(Block.glass)); + items.add(null); + items.add(new ItemStack(Block.glass)); + items.add(null); + items.add(new ItemStack(Block.glass)); + items.add(null); + items.add(new ItemStack(Block.glass)); + items.add(null); + Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), false, text, items, x, y); + break; + case 12: + if(del == 0) values++; + del++; + if(del >= 300) del = 0; + if(values >= 15) values = 0; + items.add(new ItemStack(ItemList.crystal, 1, values)); + items.add(new ItemStack(Item.dyePowder, 1, values)); + items.add(new ItemStack(ItemList.crystal, 1, 15)); + Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop(), true, text, items, x, y); + items.removeAll(items); + items.add(new ItemStack(ItemList.crystal, 1, 15)); + items.add(new ItemStack(Item.dyePowder, 1, 15)); + items.add(new ItemStack(ItemList.crystal, 1, values)); + Page.addCraftingRecipeTextPage(gui, gui.getLeft() + xPos, gui.getTop() + 60, true, text, items, x, y); + break; + default:; + } + } + + public int getMaxPages() + { + return 11; + } + + @Override + public void drawForeground(GuiGuide gui, int x, int y, int page) + { + } + +} diff --git a/common/darkknight/jewelrycraft/container/GuiTabJewelsAndModifiers.java b/common/darkknight/jewelrycraft/container/GuiTabJewelsAndModifiers.java new file mode 100644 index 0000000..e755b14 --- /dev/null +++ b/common/darkknight/jewelrycraft/container/GuiTabJewelsAndModifiers.java @@ -0,0 +1,85 @@ +package darkknight.jewelrycraft.container; + +import org.lwjgl.opengl.GL11; + +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import darkknight.jewelrycraft.client.GuiGuide; +import darkknight.jewelrycraft.util.JewelrycraftUtil; + +public class GuiTabJewelsAndModifiers extends GuiTab +{ + public GuiTabJewelsAndModifiers(int id) + { + super("Jewels and modifiers", id); + } + + public ItemStack getIcon() + { + return new ItemStack(Item.emerald); + } + + @Override + public void drawBackground(GuiGuide gui, int x, int y, int page) + { + int xPos = (page%2==0)?107:-35; + switch(page) + { + case 1: + gui.getFont().drawString("§1§n" + "Jewels", gui.getLeft() + xPos + 40, gui.getTop(), 0); + for(int i = 0; i <= 8; i++){ + gui.renderItem(JewelrycraftUtil.jewel.get(i), gui.getLeft() + xPos + 10, gui.getTop() + 22 + 16*i, 30f); + gui.getFont().drawString(JewelrycraftUtil.jewel.get(i).getDisplayName(), gui.getLeft() + xPos + 20, gui.getTop() + 12 + 16*i, 0); + } + break; + case 2: + gui.getFont().drawString("§1§n" + "Jewels", gui.getLeft() + xPos + 40, gui.getTop(), 0); + for(int i = 0; i <= 8; i++){ + gui.renderItem(JewelrycraftUtil.jewel.get(i+9), gui.getLeft() + xPos + 10, gui.getTop() + 22 + 16*i, 30f); + gui.getFont().drawString(JewelrycraftUtil.jewel.get(i+9).getDisplayName(), gui.getLeft() + xPos + 20, gui.getTop() + 12 + 16*i, 0); + } + break; + case 3: + gui.getFont().drawString("§1§n" + "Jewels", gui.getLeft() + xPos + 40, gui.getTop(), 0); + for(int i = 0; i <= 8; i++) + if(i+18 < JewelrycraftUtil.jewel.size()){ + gui.renderItem(JewelrycraftUtil.jewel.get(i+18), gui.getLeft() + xPos + 10, gui.getTop() + 22 + 16*i, 30f); + gui.getFont().drawString(JewelrycraftUtil.jewel.get(i+18).getDisplayName(), gui.getLeft() + xPos + 20, gui.getTop() + 12 + 16*i, 0); + GL11.glDisable(GL11.GL_LIGHTING); + } + break; + case 4: + gui.getFont().drawString("§1§n" + "Modifiers", gui.getLeft() + xPos + 40, gui.getTop(), 0); + for(int i = 0; i <= 8; i++){ + if(i < JewelrycraftUtil.modifiers.size()) + { + gui.renderItem(JewelrycraftUtil.modifiers.get(i), gui.getLeft() + xPos + 10, gui.getTop() + 22 + 16*i, 30f); + gui.getFont().drawString(JewelrycraftUtil.modifiers.get(i).getDisplayName(), gui.getLeft() + xPos + 20, gui.getTop() + 12 + 16*i, 0); + } + } + break; + case 5: + gui.getFont().drawString("§1§n" + "Modifiers", gui.getLeft() + xPos + 40, gui.getTop(), 0); + for(int i = 0; i <= 8; i++){ + if(i+9 < JewelrycraftUtil.modifiers.size()){ + gui.renderItem(JewelrycraftUtil.modifiers.get(i + 9), gui.getLeft() + xPos + 10, gui.getTop() + 22 + 16*i, 30f); + gui.getFont().drawString(JewelrycraftUtil.modifiers.get(i + 9).getDisplayName(), gui.getLeft() + xPos + 20, gui.getTop() + 12 + 16*i, 0); + GL11.glDisable(GL11.GL_LIGHTING); + } + } + break; + default:; + } + } + + public int getMaxPages() + { + return 5; + } + + @Override + public void drawForeground(GuiGuide gui, int x, int y, int page) + { + } + +} diff --git a/common/darkknight/jewelrycraft/container/GuiTabNecklaces.java b/common/darkknight/jewelrycraft/container/GuiTabNecklaces.java new file mode 100644 index 0000000..c42ea92 --- /dev/null +++ b/common/darkknight/jewelrycraft/container/GuiTabNecklaces.java @@ -0,0 +1,36 @@ +package darkknight.jewelrycraft.container; + +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import darkknight.jewelrycraft.client.GuiGuide; +import darkknight.jewelrycraft.item.ItemList; +import darkknight.jewelrycraft.util.JewelryNBT; + +public class GuiTabNecklaces extends GuiTab +{ + public GuiTabNecklaces(int id) + { + super("Necklaces", id); + } + + public ItemStack getIcon() + { + ItemStack it = new ItemStack(ItemList.necklace); + JewelryNBT.addMetal(it, new ItemStack(Item.ingotIron)); + JewelryNBT.addJewel(it, new ItemStack(Block.blockRedstone)); + return it; + } + + @Override + public void drawBackground(GuiGuide gui, int x, int y, int page) + { + gui.getFont().drawString(this.getName(), gui.getLeft() + 4, gui.getTop() + 5, 3432135); + } + + @Override + public void drawForeground(GuiGuide gui, int x, int y, int page) + { + } + +} diff --git a/common/darkknight/jewelrycraft/container/GuiTabRings.java b/common/darkknight/jewelrycraft/container/GuiTabRings.java new file mode 100644 index 0000000..1982fee --- /dev/null +++ b/common/darkknight/jewelrycraft/container/GuiTabRings.java @@ -0,0 +1,67 @@ +package darkknight.jewelrycraft.container; + +import java.util.ArrayList; + +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import darkknight.jewelrycraft.client.GuiGuide; +import darkknight.jewelrycraft.item.ItemList; +import darkknight.jewelrycraft.util.JewelryNBT; +import darkknight.jewelrycraft.util.JewelrycraftUtil; + +public class GuiTabRings extends GuiTab +{ + + public GuiTabRings(int id) + { + super("Rings", id); + } + + public ItemStack getIcon() + { + ItemStack it = new ItemStack(ItemList.ring); + JewelryNBT.addMetal(it, new ItemStack(Item.ingotGold)); + JewelryNBT.addJewel(it, new ItemStack(Item.enderPearl)); + return it; + } + + @Override + public void drawBackground(GuiGuide gui, int x, int y, int page) + { + ArrayList<String> text = new ArrayList<String>(); + ItemStack item = new ItemStack(ItemList.ring); + int xPos = (page%2==0)?107:-35; + switch(page) + { + case 1: + if(del == 0) values++; + del++; + if(del >= 300) del = 0; + if(values > JewelrycraftUtil.metal.size() - 1) values = 0; + + JewelryNBT.addMetal(item, JewelrycraftUtil.metal.get(values)); + JewelryNBT.addJewel(item, new ItemStack(Item.enderPearl)); + + text.add("§2Jewel: §0Ender Pearl"); + text.add("§2Modifier: §0None"); + text.add("§2Ingot: §0Any"); + text.add(" This ring allows you"); + text.add("to teleport in any"); + text.add("location from the same"); + text.add("dimension. Simply right"); + text.add("click once in a location"); + text.add("to se the position. Then"); + text.add("right click any time you"); + text.add("want to teleport there."); + Page.addImageTextPage(gui, gui.getLeft() + xPos, gui.getTop(), item, text, 50f, 0, -10); + break; + default:; + } + } + + @Override + public void drawForeground(GuiGuide gui, int x, int y, int page) + { + } + +} diff --git a/common/darkknight/jewelrycraft/container/Page.java b/common/darkknight/jewelrycraft/container/Page.java new file mode 100644 index 0000000..f3b9622 --- /dev/null +++ b/common/darkknight/jewelrycraft/container/Page.java @@ -0,0 +1,158 @@ +package darkknight.jewelrycraft.container; + +import java.util.ArrayList; + +import org.lwjgl.opengl.GL11; + +import net.minecraft.client.Minecraft; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import darkknight.jewelrycraft.client.GuiGuide; + +public class Page +{ + public static void addCraftingRecipeTextPage(GuiGuide gui, int x, int y, boolean isSmall, ArrayList<String> text, ArrayList<ItemStack> items, int mouseX, int mouseY) + { + y+=5; + gui.getFont().drawString("§1§n" + items.get(0).getDisplayName(), x + Math.abs(70 - gui.getFont().getStringWidth(items.get(0).getDisplayName())/2) - 10, y - 2, 0); + GL11.glColor4f(1, 1, 1, 1); + Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("jewelrycraft", "textures/gui/guidePageFlip1.png")); + ArrayList<String> name = new ArrayList<String>(); + if(isSmall){ + gui.drawTexturedModalRect(x, y + 10, 145, 54, 111, 46); + gui.renderItem(items.get(0), x + 89, y + 22 + 10, 30f); +// gui.drawRect(x, y + 10, x + 111, y + 46, 325325); + if(items.size() > 1 && items.get(1) != null){ + gui.renderItem(items.get(1), x + 8, y + 16 + 10, 30f); + if(x - gui.getLeft() >= x + 8) gui.drawHoverString(text, x, y); + name.add(items.get(1).getDisplayName()); + if(mouseX >= x && mouseX <= x + 16 && mouseY >= y + 10 && mouseY <= y + 26) gui.drawHoverString(name, x - 8, y + 10); + name.removeAll(name); + } + if(items.size() > 2 && items.get(2) != null){ + gui.renderItem(items.get(2), x + 30, y + 16 + 10, 30f); + name.add(items.get(2).getDisplayName()); + if(mouseX >= x + 20 && mouseX <= x + 16 + 20 && mouseY >= y + 10 && mouseY <= y + 26) gui.drawHoverString(name, x + 15, y + 10); + name.removeAll(name); + } + if(items.size() > 3 && items.get(3) != null){ + gui.renderItem(items.get(3), x + 8, y + 40 + 10, 30f); + name.add(items.get(3).getDisplayName()); + if(mouseX >= x && mouseX <= x + 16 && mouseY >= y + 36 && mouseY <= y + 36 + 16) gui.drawHoverString(name, x - 8, y + 35); + name.removeAll(name); + } + if(items.size() > 4 && items.get(4) != null){ + gui.renderItem(items.get(4), x + 30, y + 40 + 10, 30f); + name.add(items.get(4).getDisplayName()); + if(mouseX >= x + 20 && mouseX <= x + 16 + 20 && mouseY >= y + 36 && mouseY <= y + 36 + 16) gui.drawHoverString(name, x + 15, y + 35); + name.removeAll(name); + } + for(int i = 0; i < text.size(); i++) gui.getFont().drawString(text.get(i), x, y + 55 + i*12, 0); + } + else{ + gui.drawTexturedModalRect(x, y + 10, 145, 0, 111, 54); + gui.renderItem(items.get(0), x + 91, y + 28 + 10, 30f); + if(items.size() > 1 && items.get(1) != null){ + gui.renderItem(items.get(1), x + 8, y + 20, 30f); + name.add(items.get(1).getDisplayName()); + if(mouseX >= x && mouseX <= x + 16 && mouseY >= y + 10 && mouseY <= y + 26) gui.drawHoverString(name, x + 8, y + 10); + name.removeAll(name); + } + if(items.size() > 2 && items.get(2) != null){ + gui.renderItem(items.get(2), x + 28, y + 20, 30f); + name.add(items.get(2).getDisplayName()); + if(mouseX >= x + 20 && mouseX <= x + 16 + 20 && mouseY >= y + 10 && mouseY <= y + 26) gui.drawHoverString(name, x + 28, y + 10); + name.removeAll(name); + } + if(items.size() > 3 && items.get(3) != null){ + gui.renderItem(items.get(3), x + 45, y + 20, 30f); + name.add(items.get(3).getDisplayName()); + if(mouseX >= x + 40 && mouseX <= x + 16 + 40 && mouseY >= y + 10 && mouseY <= y + 26) gui.drawHoverString(name, x + 45, y + 10); + name.removeAll(name); + } + if(items.size() > 4 && items.get(4) != null){ + gui.renderItem(items.get(4), x + 8, y + 37, 30f); + name.add(items.get(4).getDisplayName()); + if(mouseX >= x && mouseX <= x + 16 && mouseY >= y + 27 && mouseY <= y + 27 + 16) gui.drawHoverString(name, x + 8, y + 27); + name.removeAll(name); + } + if(items.size() > 5 && items.get(5) != null){ + gui.renderItem(items.get(5), x + 28, y + 37, 30f); + name.add(items.get(5).getDisplayName()); + if(mouseX >= x + 20 && mouseX <= x + 16 + 20 && mouseY >= y + 27 && mouseY <= y + 27 + 16) gui.drawHoverString(name, x + 28, y + 27); + name.removeAll(name); + } + if(items.size() > 6 && items.get(6) != null){ + gui.renderItem(items.get(6), x + 45, y + 37, 30f); + name.add(items.get(6).getDisplayName()); + if(mouseX >= x + 40 && mouseX <= x + 16 + 40 && mouseY >= y + 27 && mouseY <= y + 27 + 16) gui.drawHoverString(name, x + 45, y + 27); + name.removeAll(name); + } + if(items.size() > 7 && items.get(7) != null){ + gui.renderItem(items.get(7), x + 8, y + 57, 30f); + name.add(items.get(7).getDisplayName()); + if(mouseX >= x && mouseX <= x + 16 && mouseY >= y + 47 && mouseY <= y + 47 + 16) gui.drawHoverString(name, x + 8, y + 47); + name.removeAll(name); + } + if(items.size() > 8 && items.get(8) != null){ + gui.renderItem(items.get(8), x + 28, y + 57, 30f); + name.add(items.get(8).getDisplayName()); + if(mouseX >= x + 20 && mouseX <= x + 16 + 20 && mouseY >= y + 47 && mouseY <= y + 47 + 16) gui.drawHoverString(name, x + 28, y + 47); + name.removeAll(name); + } + if(items.size() > 9 && items.get(9) != null){ + gui.renderItem(items.get(9), x + 45, y + 57, 30f); + name.add(items.get(9).getDisplayName()); + if(mouseX >= x + 40 && mouseX <= x + 16 + 40 && mouseY >= y + 47 && mouseY <= y + 47 + 16) gui.drawHoverString(name, x + 45, y + 47); + name.removeAll(name); + } + for(int i = 0; i < text.size(); i++) gui.getFont().drawString(text.get(i), x, y + 62 + i*12, 0); + GL11.glColor4f(1, 1, 1, 1); + } + } + + public static void addSmeltingRecipeTextPage(GuiGuide gui, int x, int y, ArrayList<String> text, ArrayList<ItemStack> items, int mouseX, int mouseY) + { + ArrayList<String> name = new ArrayList<String>(); + gui.getFont().drawString("§1§n" + items.get(1).getDisplayName(), x + Math.abs(70 - gui.getFont().getStringWidth(items.get(0).getDisplayName())/2), y + 2, 0); + GL11.glColor4f(1, 1, 1, 1); + Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("jewelrycraft", "textures/gui/guidePageFlip1" + + ".png")); + gui.drawTexturedModalRect(x, y + 10, 145, 100, 111, 46); + + gui.renderItem(items.get(0), x + 13, y + 20 + 10, 50f); + name.add(items.get(0).getDisplayName()); + if(mouseX >= x && mouseX <= x + 20 && mouseY >= y + 20 && mouseY <= y + 20 + 16) gui.drawHoverString(name, x, y + 20); + name.removeAll(name); + + gui.renderItem(items.get(1), x + 77, y + 28 + 10, 50f); + + for(int i = 0; i < text.size(); i++) gui.getFont().drawString(text.get(i), x, y + 60 + i*12, 0); + GL11.glColor4f(1, 1, 1, 1); + } + + public static void addImageTextPage(GuiGuide gui, int x, int y, ItemStack item, ArrayList<String> text, float size) + { + y+=5; + gui.getFont().drawString("§1§n" + item.getDisplayName(), x + Math.abs(70 - gui.getFont().getStringWidth(item.getDisplayName())/2) - 10, y + 2, 0); + GL11.glColor4f(1, 1, 1, 1); + gui.renderItem(item, x + 13, y + 18, size); + for(int i = 0; i < text.size(); i++) gui.getFont().drawString(text.get(i), x, y + 30 + i*12, 0); + } + + public static void addImageTextPage(GuiGuide gui, int x, int y, ItemStack item, ArrayList<String> text, float size, int txtX, int txtY) + { + y+=5; + gui.getFont().drawString("§1§n" + item.getDisplayName(), x + Math.abs(70 - gui.getFont().getStringWidth(item.getDisplayName())/2) - 10, y + 2, 0); + GL11.glColor4f(1, 1, 1, 1); + gui.renderItem(item, x + 13, y + 18, size); + for(int i = 0; i < text.size(); i++) gui.getFont().drawString(text.get(i), x + txtX, y + 30 + txtY + i*12, 0); + } + + public static void addTextPage(GuiGuide gui, int x, int y, ArrayList<String> text) + { + y-=25; + for(int i = 0; i < text.size(); i++) gui.getFont().drawString(text.get(i), x, y + 30 + i*12, 0); + GL11.glColor4f(1, 1, 1, 1); + } +} |
