- 382
- 2
- 24
Вот класс, в котором, вроде бы, ошибка:
Майнкрафт ругается, вроде бы, на выделенную строчку (82).
В чём у меня проблема? -- 1.7.10
Код:
package merlin.seriousmodssthefe;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.resources.I18n;
import net.minecraft.util.ResourceLocation;
import cpw.mods.fml.relauncher.SideOnly;
public class NetricsaInfo extends GuiScreen
{
private final int bookImageHeight = 192;
private final int bookImageWidth = 192;
private int currPage = 0;
private static final int bookTotalPages = 4;
private static ResourceLocation[] bookPageTextures =
new ResourceLocation[bookTotalPages];
private static String[] stringPageText = new String[bookTotalPages];
private GuiButton buttonDone;
private NextPageButton buttonNextPage;
private NextPageButton buttonPreviousPage;
public void NetricsaInfo()
{
bookPageTextures[0] = new ResourceLocation(
Main.MODID+":textures/gui/black.png");
bookPageTextures[1] = new ResourceLocation(
Main.MODID+":textures/gui/black.png");
bookPageTextures[2] = new ResourceLocation(
Main.MODID+":textures/gui/black.png");
stringPageText[0] = "";
stringPageText[1] = "The Mysterious Stranger admired your family cow and asked if it was for sale.\n\nWhen you nodded, he offered to trade some Magic Beans, that (if planted in tilled dirt) would lead to more wealth than you could imagine.";
stringPageText[2]="So you handed him your cow, and grabbed the Magic Beans.\n\nPleased with yourself, you hurried away, looking for tilled dirt in which to plant the Magic Beans.\n\nYou couldn't wait to see how proud your mother would be for";
stringPageText[3]="being so shrewd! Untold wealth in return for an old, milkless cow; what a good deal you made!\n\nSo off you went, looking for a place to plant the Magic Beans with room to grow...";
}
/**
* Adds the buttons (and other controls) to the screen in question.
*/
@Override
public void initGui()
{
// DEBUG
System.out.println("NetricsaInfo initGUI()");
buttonList.clear();
Keyboard.enableRepeatEvents(true);
buttonDone = new GuiButton(0, width / 2 + 2, 4 + bookImageHeight,
98, 20, I18n.format("gui.done", new Object[0]));
buttonList.add(buttonDone);
int offsetFromScreenLeft = (width - bookImageWidth) / 2;
buttonList.add(buttonNextPage = new NextPageButton(1,
offsetFromScreenLeft + 120, 156, true));
buttonList.add(buttonPreviousPage = new NextPageButton(2,
offsetFromScreenLeft + 38, 156, false));
}
/**
* Called from the main game loop to update the screen.
*/
@Override
public void updateScreen()
{
buttonDone.visible = (currPage == bookTotalPages - 1);
buttonNextPage.visible = (currPage < bookTotalPages - 1);
buttonPreviousPage.visible = currPage > 0;
}
/**
* Draws the screen and all the components in it.
*/
@Override
public void drawScreen(int parWidth, int parHeight, float p_73863_3_)
{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
if (currPage == 0)
{
[B]mc.getTextureManager().bindTexture(bookPageTextures[0]);[/B]
}
else
{
mc.getTextureManager().bindTexture(bookPageTextures[1]);
}
int offsetFromScreenLeft = (width - bookImageWidth ) / 2;
drawTexturedModalRect(offsetFromScreenLeft, 2, 0, 0, bookImageWidth,
bookImageHeight);
int widthOfString;
String stringPageIndicator = I18n.format("book.pageIndicator",
new Object[] {Integer.valueOf(currPage + 1), bookTotalPages});
widthOfString = fontRendererObj.getStringWidth(stringPageIndicator);
fontRendererObj.drawString(stringPageIndicator,
offsetFromScreenLeft - widthOfString + bookImageWidth - 44,
18, 0);
fontRendererObj.drawSplitString(stringPageText[currPage],
offsetFromScreenLeft + 36, 34, 116, 0);
super.drawScreen(parWidth, parHeight, p_73863_3_);
}
/**
* Called when a mouse button is pressed and the mouse is moved around.
* Parameters are : mouseX, mouseY, lastButtonClicked &
* timeSinceMouseClick.
*/
@Override
protected void mouseClickMove(int parMouseX, int parMouseY,
int parLastButtonClicked, long parTimeSinceMouseClick)
{
}
@Override
protected void actionPerformed(GuiButton parButton)
{
if (parButton == buttonDone)
{
// You can send a packet to server here if you need server to do
// something
mc.displayGuiScreen((GuiScreen)null);
}
else if (parButton == buttonNextPage)
{
if (currPage < bookTotalPages - 1)
{
++currPage;
}
}
else if (parButton == buttonPreviousPage)
{
if (currPage > 0)
{
--currPage;
}
}
}
/**
* Called when the screen is unloaded. Used to disable keyboard repeat
* events
*/
@Override
public void onGuiClosed()
{
}
/**
* Returns true if this GUI should pause the game when it is displayed in
* single-player
*/
@Override
public boolean doesGuiPauseGame()
{
return true;
}
@SideOnly(Side.CLIENT)
static class NextPageButton extends GuiButton
{
private final boolean isNextButton;
public NextPageButton(int parButtonId, int parPosX, int parPosY,
boolean parIsNextButton)
{
super(parButtonId, parPosX, parPosY, 23, 13, "");
isNextButton = parIsNextButton;
}
/**
* Draws this button to the screen.
*/
@Override
public void drawButton(Minecraft mc, int parX, int parY)
{
if (visible)
{
boolean isButtonPressed = (parX >= xPosition
&& parY >= yPosition
&& parX < xPosition + width
&& parY < yPosition + height);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.getTextureManager().bindTexture(bookPageTextures[1]);
int textureX = 0;
int textureY = 192;
if (isButtonPressed)
{
textureX += 23;
}
if (!isNextButton)
{
textureY += 13;
}
drawTexturedModalRect(xPosition, yPosition,
textureX, textureY,
23, 13);
}
}
}
}
Майнкрафт ругается, вроде бы, на выделенную строчку (82).
В чём у меня проблема? -- 1.7.10
- Краш-лог
-
---- Minecraft Crash Report ----
// You're mean.
Time: 12/02/19 18:21
Description: Rendering screen
java.lang.NullPointerException: Rendering screen
at merlin.seriousmodssthefe.NetricsaInfo.drawScreen(NetricsaInfo.java:82)
at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1137)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1067)
at net.minecraft.client.Minecraft.run(Minecraft.java:962)
at net.minecraft.client.main.Main.main(Main.java:164)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
at GradleStart.main(Unknown Source)
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- Head --
Stacktrace:
at merlin.seriousmodssthefe.NetricsaInfo.drawScreen(NetricsaInfo.java:82)
-- Screen render details --
Details:
Screen name: merlin.seriousmodssthefe.NetricsaInfo
Mouse location: Scaled: (135, 158). Absolute: (640, 512)
Screen size: Scaled: (320, 256). Absolute: (1280, 1024). Scale factor of 4
-- Affected level --
Details:
Level name: MpServer
All players: 1 total; [EntityClientPlayerMP['Player668'/142, l='MpServer', x=1626,92, y=5,62, z=491,53]]
Chunk stats: MultiplayerChunkCache: 25, 25
Level seed: 0
Level generator: ID 01 - flat, ver 0. Features enabled: false
Level generator options:
Level spawn location: World: (1623,4,478), Chunk: (at 7,0,14 in 101,29; contains blocks 1616,0,464 to 1631,255,479), Region: (3,0; contains chunks 96,0 to 127,31, blocks 1536,0,0 to 2047,255,511)
Level time: 61340 game time, 8618 day time
Level dimension: 0
Level storage version: 0x00000 - Unknown?
Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false
Forced entities: 3 total; [EntityChicken['Курица'/66, l='MpServer', x=1590,47, y=4,00, z=452,53], EntityChicken['Курица'/67, l='MpServer', x=1584,81, y=4,00, z=472,03], EntityClientPlayerMP['Player668'/142, l='MpServer', x=1626,92, y=5,62, z=491,53]]
Retry entities: 0 total; []
Server brand: fml,forge
Server type: Integrated singleplayer server
Stacktrace:
at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:415)
at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2566)
at net.minecraft.client.Minecraft.run(Minecraft.java:984)
at net.minecraft.client.main.Main.main(Main.java:164)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
at GradleStart.main(Unknown Source)
-- System Details --
Details:
Minecraft Version: 1.7.10
Operating System: Windows 10 (amd64) version 10.0
Java Version: 1.8.0_171, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 187437256 bytes (178 MB) / 469237760 bytes (447 MB) up to 947388416 bytes (903 MB)
JVM Flags: 0 total;
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v9.05 FML v7.10.99.99 Minecraft Forge 10.13.4.1558 4 mods loaded, 4 mods active
States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
UCHIJAAAA mcp{9.05} [Minecraft Coder Pack] (minecraft.jar)
UCHIJAAAA FML{7.10.99.99} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.4.1558-1.7.10.jar)
UCHIJAAAA Forge{10.13.4.1558} [Minecraft Forge] (forgeSrc-1.7.10-10.13.4.1558-1.7.10.jar)
UCHIJAAAA ssthefe{1.0.0} [Serious Mod SStheFE] (bin)
GL info: ' Vendor: 'NVIDIA Corporation' Version: '4.6.0 NVIDIA 388.13' Renderer: 'GeForce GTX 750 Ti/PCIe/SSE2'
Launched Version: 1.7.10
LWJGL: 2.9.1
OpenGL: GeForce GTX 750 Ti/PCIe/SSE2 GL version 4.6.0 NVIDIA 388.13, NVIDIA Corporation
GL Caps: Using GL 1.3 multitexturing.
Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
Anisotropic filtering is supported and maximum anisotropy is 16.
Shaders are available because OpenGL 2.1 is supported.
Is Modded: Definitely; Client brand changed to 'fml,forge'
Type: Client (map_client.txt)
Resource Packs: []
Current Language: Русский (Россия)
Profiler Position: N/A (disabled)
Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Anisotropic Filtering: Off (1)
Краш-лог:
---- Minecraft Crash Report ----
// You're mean.
Time: 12/02/19 18:21
Description: Rendering screen
java.lang.NullPointerException: Rendering screen
at merlin.seriousmodssthefe.NetricsaInfo.drawScreen(NetricsaInfo.java:82)
at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1137)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1067)
at net.minecraft.client.Minecraft.run(Minecraft.java:962)
at net.minecraft.client.main.Main.main(Main.java:164)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
at GradleStart.main(Unknown Source)
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- Head --
Stacktrace:
at merlin.seriousmodssthefe.NetricsaInfo.drawScreen(NetricsaInfo.java:82)
-- Screen render details --
Details:
Screen name: merlin.seriousmodssthefe.NetricsaInfo
Mouse location: Scaled: (135, 158). Absolute: (640, 512)
Screen size: Scaled: (320, 256). Absolute: (1280, 1024). Scale factor of 4
-- Affected level --
Details:
Level name: MpServer
All players: 1 total; [EntityClientPlayerMP['Player668'/142, l='MpServer', x=1626,92, y=5,62, z=491,53]]
Chunk stats: MultiplayerChunkCache: 25, 25
Level seed: 0
Level generator: ID 01 - flat, ver 0. Features enabled: false
Level generator options:
Level spawn location: World: (1623,4,478), Chunk: (at 7,0,14 in 101,29; contains blocks 1616,0,464 to 1631,255,479), Region: (3,0; contains chunks 96,0 to 127,31, blocks 1536,0,0 to 2047,255,511)
Level time: 61340 game time, 8618 day time
Level dimension: 0
Level storage version: 0x00000 - Unknown?
Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false
Forced entities: 3 total; [EntityChicken['Курица'/66, l='MpServer', x=1590,47, y=4,00, z=452,53], EntityChicken['Курица'/67, l='MpServer', x=1584,81, y=4,00, z=472,03], EntityClientPlayerMP['Player668'/142, l='MpServer', x=1626,92, y=5,62, z=491,53]]
Retry entities: 0 total; []
Server brand: fml,forge
Server type: Integrated singleplayer server
Stacktrace:
at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:415)
at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2566)
at net.minecraft.client.Minecraft.run(Minecraft.java:984)
at net.minecraft.client.main.Main.main(Main.java:164)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
at GradleStart.main(Unknown Source)
-- System Details --
Details:
Minecraft Version: 1.7.10
Operating System: Windows 10 (amd64) version 10.0
Java Version: 1.8.0_171, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 187437256 bytes (178 MB) / 469237760 bytes (447 MB) up to 947388416 bytes (903 MB)
JVM Flags: 0 total;
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v9.05 FML v7.10.99.99 Minecraft Forge 10.13.4.1558 4 mods loaded, 4 mods active
States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
UCHIJAAAA mcp{9.05} [Minecraft Coder Pack] (minecraft.jar)
UCHIJAAAA FML{7.10.99.99} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.4.1558-1.7.10.jar)
UCHIJAAAA Forge{10.13.4.1558} [Minecraft Forge] (forgeSrc-1.7.10-10.13.4.1558-1.7.10.jar)
UCHIJAAAA ssthefe{1.0.0} [Serious Mod SStheFE] (bin)
GL info: ' Vendor: 'NVIDIA Corporation' Version: '4.6.0 NVIDIA 388.13' Renderer: 'GeForce GTX 750 Ti/PCIe/SSE2'
Launched Version: 1.7.10
LWJGL: 2.9.1
OpenGL: GeForce GTX 750 Ti/PCIe/SSE2 GL version 4.6.0 NVIDIA 388.13, NVIDIA Corporation
GL Caps: Using GL 1.3 multitexturing.
Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
Anisotropic filtering is supported and maximum anisotropy is 16.
Shaders are available because OpenGL 2.1 is supported.
Is Modded: Definitely; Client brand changed to 'fml,forge'
Type: Client (map_client.txt)
Resource Packs: []
Current Language: Русский (Россия)
Profiler Position: N/A (disabled)
Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Anisotropic Filtering: Off (1)