mirror of
https://github.com/GTNewHorizons/Mantle.git
synced 2026-11-19 19:49:41 +00:00
guimanual now uses bookdata not hardcoded defaults
This commit is contained in:
1 parent
e6f40ed8e2
commit
2b1e20e02c
4 files changed
+27
-12
No files matched your search
@@ -1,5 +1,7 @@
|
||||
package mantle.books;
|
||||
|
||||
import mantle.client.block.SmallFontRenderer;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
|
||||
public class BookData
|
||||
@@ -7,10 +9,11 @@ public class BookData
|
||||
public final String unlocalizedName = new String();
|
||||
public final String toolTip = new String();
|
||||
public final String modID = new String();
|
||||
public final String LeftImageLocation = new String();
|
||||
public final String rightImageLocation = new String();
|
||||
public final Document doc = ManualReader.readManual("/assets/mantle/manuals/test.xml");
|
||||
|
||||
public final String leftImageLocation = new String("textures/gui/bookleft.png");
|
||||
public final String rightImageLocation = new String("textures/gui/bookright.png");
|
||||
private final Document doc = ManualReader.readManual("/assets/mantle/manuals/test.xml");
|
||||
//font can be left null if so, the default from mantle will be used
|
||||
public SmallFontRenderer font;
|
||||
public Document getDoc ()
|
||||
{
|
||||
return this.doc;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package mantle.client;
|
||||
|
||||
import mantle.books.BookData;
|
||||
import mantle.books.BookDataStore;
|
||||
import mantle.common.MProxyCommon;
|
||||
|
||||
@@ -60,13 +61,13 @@ public class MProxyClient extends MProxyCommon
|
||||
if (ID == manualGuiID)
|
||||
{
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
return new GuiManual(stack, MProxyClient.getManualFromStack(stack));
|
||||
return new GuiManual(stack, MProxyClient.getBookDataFromStack(stack));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static Document getManualFromStack (ItemStack stack)
|
||||
private static BookData getBookDataFromStack (ItemStack stack)
|
||||
{
|
||||
return BookDataStore.getBookFromName(stack.getItem().getUnlocalizedName()).getDoc();
|
||||
return BookDataStore.getBookFromName(stack.getItem().getUnlocalizedName());
|
||||
}
|
||||
}
|
||||
@@ -12,11 +12,11 @@ import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import mantle.books.BookData;
|
||||
import mantle.client.RenderItemCopy;
|
||||
import mantle.client.MProxyClient;
|
||||
import mantle.client.block.SmallFontRenderer;
|
||||
import mantle.client.pages.BookPage;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -34,18 +34,25 @@ public class GuiManual extends GuiScreen
|
||||
|
||||
private TurnPageButton buttonNextPage;
|
||||
private TurnPageButton buttonPreviousPage;
|
||||
private static ResourceLocation bookRight;// = new ResourceLocation("mantle", "textures/gui/bookright.png");
|
||||
private static ResourceLocation bookLeft;// = new ResourceLocation("mantle", "textures/gui/bookleft.png");
|
||||
|
||||
BookPage pageLeft;
|
||||
BookPage pageRight;
|
||||
|
||||
public SmallFontRenderer fonts = MProxyClient.smallFontRenderer;
|
||||
|
||||
public GuiManual(ItemStack stack, Document doc)
|
||||
public GuiManual(ItemStack stack, BookData data)
|
||||
{
|
||||
this.field_146297_k = Minecraft.getMinecraft();
|
||||
this.itemstackBook = stack;
|
||||
currentPage = 0; //Stack page
|
||||
manual = doc;
|
||||
manual = data.getDoc();
|
||||
if (data.font != null)
|
||||
this.fonts = data.font;
|
||||
bookLeft = new ResourceLocation(data.modID, data.leftImageLocation);
|
||||
bookRight = new ResourceLocation(data.modID, data.rightImageLocation);
|
||||
|
||||
//renderitem.renderInFrame = true;
|
||||
}
|
||||
|
||||
@@ -155,8 +162,6 @@ public class GuiManual extends GuiScreen
|
||||
}
|
||||
}
|
||||
|
||||
private static final ResourceLocation bookRight = new ResourceLocation("mantle", "textures/gui/bookright.png");
|
||||
private static final ResourceLocation bookLeft = new ResourceLocation("mantle", "textures/gui/bookleft.png");
|
||||
|
||||
public void drawScreen (int par1, int par2, float par3)
|
||||
{
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.util.List;
|
||||
import mantle.Mantle;
|
||||
import mantle.books.BookDataStore;
|
||||
import mantle.items.abstracts.CraftingItem;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
@@ -22,6 +23,11 @@ public class Manual extends CraftingItem
|
||||
super(name, textureName, "", "mantle", null);
|
||||
setUnlocalizedName("tconstruct.manual");
|
||||
}
|
||||
public Manual(String[] name, String[] textureName, String folder, String modTexturePrefix, CreativeTabs tab)
|
||||
{
|
||||
super(name, textureName, "", "mantle", null);
|
||||
setUnlocalizedName("tconstruct.manual");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick (ItemStack stack, World world, EntityPlayer player)
|
||||
|
||||
Reference in new issue
Block a user