push NPE debug code for others to review

This commit is contained in:
Progwml6 committed 2014-01-29 04:16:58 -05:00
1 parent 76f5e1f4ce
commit 1b0fea41ff
6 files changed
+40 -9

No files matched your search

+7
View File
@@ -19,6 +19,7 @@ import mantle.client.block.SmallFontRenderer;
import mantle.client.gui.GuiManual;
import mantle.client.pages.*;
import mantle.common.MProxyCommon;
import static mantle.lib.CoreRepo.logger;
public class MProxyClient extends MProxyCommon
{
@@ -28,6 +29,10 @@ public class MProxyClient extends MProxyCommon
public void registerRenderer ()
{
Minecraft mc = Minecraft.getMinecraft();
if(mc.getTextureManager() == null)
logger.error("vanilla tex man is null");
if (mc.renderEngine == null)
logger.error("vanilla render engine is null");
smallFontRenderer = new SmallFontRenderer(mc.gameSettings, new ResourceLocation("minecraft:textures/font/ascii.png"), mc.renderEngine, false);
}
@@ -40,6 +45,8 @@ public class MProxyClient extends MProxyCommon
public static Class<? extends BookPage> getPageClass (String type)
{
// logger.info(type);
//logger.info(pageClasses.get(type).getName());
return pageClasses.get(type);
}
+26 -7
View File
@@ -51,7 +51,7 @@ public class SmallFontRenderer implements IResourceManagerReloadListener
private final ResourceLocation field_111273_g;
/** The RenderEngine used to load and setup glyph textures. */
private final TextureManager renderEngine;
private TextureManager renderEngine;
/** Current X coordinate at which to draw the next character. */
private float posX;
@@ -106,12 +106,14 @@ public class SmallFontRenderer implements IResourceManagerReloadListener
public SmallFontRenderer(GameSettings par1GameSettings, ResourceLocation par2ResourceLocation, TextureManager par3TextureManager, boolean par4)
{
this.field_111273_g = par2ResourceLocation;
logger.error(this.field_111273_g.toString() + " " + this.field_111273_g.getResourcePath());
//logger.error(this.field_111273_g.toString() + " " + this.field_111273_g.getResourcePath());
this.renderEngine = par3TextureManager;
this.unicodeFlag = true;
if (this.renderEngine != null)
this.renderEngine.bindTexture(par2ResourceLocation);
//Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation("textures/font/ascii.png"));
if (this.renderEngine == null)
logger.error("renderEngine is null");
//Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation("Minecraft", "textures/font/ascii.png"));
for (int i = 0; i < 32; ++i)
{
int j = (i >> 3 & 1) * 85;
@@ -267,9 +269,13 @@ public class SmallFontRenderer implements IResourceManagerReloadListener
{
if (field_111274_c[par1] == null)
{
field_111274_c[par1] = new ResourceLocation(String.format("textures/font/unicode_page_%02x.png", new Object[] { Integer.valueOf(par1) }));
logger.info(par1);
logger.info(String.format("textures/font/unicode_page_%02x.png", new Object[] { Integer.valueOf(par1) }));
field_111274_c[par1] = new ResourceLocation("minecraft", String.format("textures/font/unicode_page_%02x.png", new Object[] { Integer.valueOf(par1) }));
}
if (field_111274_c[par1] == null)
logger.error("resource location failded to initialize " + par1);
logger.info(field_111274_c[par1].getResourceDomain() +" " + field_111274_c[par1].getResourcePath() );
return field_111274_c[par1];
}
@@ -278,6 +284,10 @@ public class SmallFontRenderer implements IResourceManagerReloadListener
*/
private void loadGlyphTexture (int par1)
{
if(this.func_111271_a(par1) == null)
logger.error("resource location null");
if(this.renderEngine == null)
logger.error("renderengine null");
this.renderEngine.bindTexture(this.func_111271_a(par1));
}
@@ -293,6 +303,7 @@ public class SmallFontRenderer implements IResourceManagerReloadListener
else
{
int i = par1 / 256;
logger.info("loading texture for glyph " + par1 + " which is " + i);
this.loadGlyphTexture(i);
int j = this.glyphWidth[par1] >>> 4;
int k = this.glyphWidth[par1] & 15;
@@ -551,7 +562,7 @@ public class SmallFontRenderer implements IResourceManagerReloadListener
this.posX -= f;
this.posY -= f;
}
logger.info("rendering char " + c0);
float f1 = this.renderCharAtPos(j, c0, this.italicStyle);
if (flag1)
@@ -624,9 +635,11 @@ public class SmallFontRenderer implements IResourceManagerReloadListener
if (this.bidiFlag)
{
par1Str = this.bidiReorder(par1Str);
logger.info("bidi " + par1Str);
int i1 = this.getStringWidth(par1Str);
par2 = par2 + par4 - i1;
}
logger.info("renderStringAligned " + par1Str);
return this.renderString(par1Str, par2, par3, par5, par6);
}
@@ -730,7 +743,13 @@ public class SmallFontRenderer implements IResourceManagerReloadListener
}
else
{
int i = ChatAllowedCharacters.allowedCharactersArray[par1];
int i;
if(ChatAllowedCharacters.isAllowedCharacter(par1))
i = par1;
else{
i =69;
logger.error("dont send bad chat characters to my font renderer!");
}
if (i >= 0 && !this.unicodeFlag)
{
+1
View File
@@ -1,5 +1,6 @@
package mantle.client.gui;
import static mantle.lib.CoreRepo.logger;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
+1 -1
View File
@@ -9,7 +9,7 @@ import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import static mantle.lib.CoreRepo.logger;
@SideOnly(Side.CLIENT)
public class TurnPageButton extends GuiButton
{
+3 -1
View File
@@ -4,6 +4,7 @@ import net.minecraft.util.StatCollector;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import static mantle.lib.CoreRepo.logger;
public class TextPage extends BookPage
{
@@ -20,8 +21,9 @@ public class TextPage extends BookPage
@Override
public void renderContentLayer (int localWidth, int localHeight, boolean IsTranslatable)
{
if(IsTranslatable)
if (IsTranslatable)
text = StatCollector.translateToLocal(text);
logger.info("rendering text " + text);
manual.fonts.drawSplitString(text, localWidth, localHeight, 178, 0);
}
}
+2
View File
@@ -60,12 +60,14 @@ public class Manual extends CraftingItem
@Override
public String getUnlocalizedName ()
{
// logger.info("unloc: " + super.getUnlocalizedName());
return modID + ":" + super.getUnlocalizedName();
}
@Override
public String getUnlocalizedName (ItemStack par1ItemStack)
{
// logger.info("unloc IS " + super.getUnlocalizedName(par1ItemStack));
return super.getUnlocalizedName(par1ItemStack);
}
}