mirror of
https://github.com/GTNewHorizons/Mantle.git
synced 2026-11-19 11:49:08 +00:00
Cleaned up and updated forge version.
This commit is contained in:
1 parent
6a363b3981
commit
812ef0bf2d
107 files changed
+15
-31
No files matched your search
@@ -0,0 +1,101 @@
|
||||
package mantle.client;
|
||||
|
||||
import static mantle.lib.CoreRepo.logger;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import mantle.Mantle;
|
||||
import mantle.books.BookData;
|
||||
import mantle.books.BookDataStore;
|
||||
import mantle.client.gui.GuiManual;
|
||||
import mantle.client.pages.BlankPage;
|
||||
import mantle.client.pages.BookPage;
|
||||
import mantle.client.pages.ContentsTablePage;
|
||||
import mantle.client.pages.CraftingPage;
|
||||
import mantle.client.pages.FurnacePage;
|
||||
import mantle.client.pages.PicturePage;
|
||||
import mantle.client.pages.SectionPage;
|
||||
import mantle.client.pages.SidebarPage;
|
||||
import mantle.client.pages.TextPage;
|
||||
import mantle.client.pages.TitlePage;
|
||||
import mantle.common.MProxyCommon;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class MProxyClient extends MProxyCommon
|
||||
{
|
||||
|
||||
public static final String MINECRAFT_ASCII_PATH = "minecraft:textures/font/ascii.png";
|
||||
|
||||
/* Registers any rendering code. */
|
||||
@Override
|
||||
public void registerRenderer()
|
||||
{
|
||||
ModelHelper.registerItem(Mantle.mantleBook, "mantleBook");
|
||||
}
|
||||
|
||||
public static Map<String, Class<? extends BookPage>> pageClasses = new HashMap<String, Class<? extends BookPage>>();
|
||||
|
||||
public static void registerManualPage(String type, Class<? extends BookPage> clazz)
|
||||
{
|
||||
pageClasses.put(type, clazz);
|
||||
}
|
||||
|
||||
public static Class<? extends BookPage> getPageClass(String type)
|
||||
{
|
||||
return pageClasses.get(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readManuals()
|
||||
{
|
||||
this.initManualPages();
|
||||
}
|
||||
|
||||
void initManualPages()
|
||||
{
|
||||
MProxyClient.registerManualPage("crafting", CraftingPage.class);
|
||||
MProxyClient.registerManualPage("picture", PicturePage.class);
|
||||
MProxyClient.registerManualPage("text", TextPage.class);
|
||||
MProxyClient.registerManualPage("intro", TextPage.class);
|
||||
MProxyClient.registerManualPage("sectionpage", SectionPage.class);
|
||||
MProxyClient.registerManualPage("intro", TitlePage.class);
|
||||
MProxyClient.registerManualPage("contents", ContentsTablePage.class);
|
||||
MProxyClient.registerManualPage("furnace", FurnacePage.class);
|
||||
MProxyClient.registerManualPage("sidebar", SidebarPage.class);
|
||||
MProxyClient.registerManualPage("blank", BlankPage.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
|
||||
{
|
||||
if (ID == manualGuiID)
|
||||
{
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
if (stack == null)
|
||||
{
|
||||
logger.error("Null stack in book.");
|
||||
}
|
||||
if (stack != null && stack.getItem() == null)
|
||||
{
|
||||
logger.error("Null item in book.");
|
||||
}
|
||||
if (stack != null && stack.getItem() != null && stack.getItem().getUnlocalizedName() == null)
|
||||
{
|
||||
logger.error("Null unlocalized name in book.");
|
||||
}
|
||||
else
|
||||
{
|
||||
return new GuiManual(stack, MProxyClient.getBookDataFromStack(stack));
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static BookData getBookDataFromStack(ItemStack stack)
|
||||
{
|
||||
return BookDataStore.getBookFromName(stack.getItem().getUnlocalizedName(stack));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user