- 14
- 0
Всем привет!
Создаю Gui, майнкрафт включается, но после клика по блоку - краш.
Скидываю код и краш
Сам гуи
Gui Handler
Если что-то ещё нужно - напишите.
Если что учился по этому:
[youtube]9w71MUms1IE[/youtube]
Создаю Gui, майнкрафт включается, но после клика по блоку - краш.
Скидываю код и краш
Код:
---- Minecraft Crash Report ----
// Why did you do that?
Time: 30.08.15 15:40
Description: Unexpected error
java.lang.NullPointerException: Unexpected error
at cpw.mods.fml.common.network.NetworkRegistry.getLocalGuiContainer(NetworkRegistry.java:265)
at cpw.mods.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:93)
at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2501)
at com.dgrayman888.nmt.blocks.BlastFurnace.onBlockActivated(BlastFurnace.java:45)
at net.minecraft.client.multiplayer.PlayerControllerMP.onPlayerRightClick(PlayerControllerMP.java:376)
at net.minecraft.client.Minecraft.func_147121_ag(Minecraft.java:1529)
at net.minecraft.client.Minecraft.runTick(Minecraft.java:2044)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1039)
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 cpw.mods.fml.common.network.NetworkRegistry.getLocalGuiContainer(NetworkRegistry.java:265)
at cpw.mods.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:93)
at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2501)
at com.dgrayman888.nmt.blocks.BlastFurnace.onBlockActivated(BlastFurnace.java:45)
at net.minecraft.client.multiplayer.PlayerControllerMP.onPlayerRightClick(PlayerControllerMP.java:376)
at net.minecraft.client.Minecraft.func_147121_ag(Minecraft.java:1529)
-- Affected level --
Details:
Level name: MpServer
All players: 1 total; [EntityClientPlayerMP['Player551'/37, l='MpServer', x=61,78, y=62,94, z=-1480,71]]
Chunk stats: MultiplayerChunkCache: 170, 170
Level seed: 0
Level generator: ID 01 - flat, ver 0. Features enabled: false
Level generator options:
Level spawn location: World: (86,4,-1398), Chunk: (at 6,0,10 in 5,-88; contains blocks 80,0,-1408 to 95,255,-1393), Region: (0,-3; contains chunks 0,-96 to 31,-65, blocks 0,0,-1536 to 511,255,-1025)
Level time: 13635 game time, 2162 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: 33 total; [EntityVillager['Villager'/34, l='MpServer', x=65,41, y=61,00, z=-1525,78], EntityVillager['Villager'/35, l='MpServer', x=65,88, y=62,00, z=-1518,50], EntityVillager['Villager'/32, l='MpServer', x=65,66, y=61,00, z=-1524,06], EntityVillager['Villager'/33, l='MpServer', x=65,47, y=61,00, z=-1530,25], EntityClientPlayerMP['Player551'/37, l='MpServer', x=61,78, y=62,94, z=-1480,71], EntityVillager['Villager'/5, l='MpServer', x=31,08, y=61,00, z=-1530,09], EntityVillager['Villager'/36, l='MpServer', x=65,50, y=62,00, z=-1514,06], EntityVillager['Villager'/6, l='MpServer', x=28,53, y=61,00, z=-1512,22], EntityVillager['Villager'/7, l='MpServer', x=30,75, y=62,00, z=-1508,50], EntityVillager['Villager'/8, l='MpServer', x=17,34, y=62,00, z=-1496,38], EntityVillager['Villager'/9, l='MpServer', x=32,50, y=62,00, z=-1523,50], EntityVillager['Villager'/10, l='MpServer', x=37,52, y=61,41, z=-1534,65], EntityVillager['Villager'/11, l='MpServer', x=33,50, y=63,00, z=-1521,78], EntityVillager['Villager'/12, l='MpServer', x=45,25, y=61,00, z=-1528,41], EntityVillager['Villager'/13, l='MpServer', x=41,22, y=62,00, z=-1532,63], EntityZombie['Zombie'/14, l='MpServer', x=38,50, y=62,00, z=-1522,50], EntityVillager['Villager'/15, l='MpServer', x=37,06, y=61,00, z=-1530,50], EntityVillager['Villager'/17, l='MpServer', x=43,78, y=61,00, z=-1509,31], EntityVillager['Villager'/16, l='MpServer', x=35,31, y=61,00, z=-1523,88], EntitySquid['Squid'/19, l='MpServer', x=37,51, y=51,00, z=-1499,51], EntitySquid['Squid'/18, l='MpServer', x=37,53, y=51,00, z=-1498,47], EntitySquid['Squid'/21, l='MpServer', x=37,47, y=51,39, z=-1499,50], EntitySquid['Squid'/20, l='MpServer', x=36,48, y=51,00, z=-1498,52], EntitySquid['Squid'/23, l='MpServer', x=36,52, y=51,00, z=-1498,49], EntitySquid['Squid'/22, l='MpServer', x=36,50, y=51,40, z=-1499,50], EntityVillager['Villager'/25, l='MpServer', x=48,50, y=62,00, z=-1530,50], EntityVillager['Villager'/24, l='MpServer', x=56,31, y=61,00, z=-1541,50], EntityVillager['Villager'/27, l='MpServer', x=62,34, y=62,00, z=-1523,75], EntityVillager['Villager'/26, l='MpServer', x=60,28, y=61,00, z=-1533,44], EntityVillager['Villager'/29, l='MpServer', x=53,59, y=61,00, z=-1529,22], EntityVillager['Villager'/28, l='MpServer', x=59,34, y=61,00, z=-1533,31], EntityVillager['Villager'/31, l='MpServer', x=49,31, y=61,00, z=-1517,13], EntityVillager['Villager'/30, l='MpServer', x=53,44, y=61,00, z=-1522,34]]
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:991)
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 XP (x86) version 5.1
Java Version: 1.7.0_80, Oracle Corporation
Java VM Version: Java HotSpot(TM) Client VM (mixed mode), Oracle Corporation
Memory: 922472080 bytes (879 MB) / 1060372480 bytes (1011 MB) up to 1060372480 bytes (1011 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
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.1448 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.1448-1.7.10.jar)
UCHIJAAAA Forge{10.13.4.1448} [Minecraft Forge] (forgeSrc-1.7.10-10.13.4.1448-1.7.10.jar)
UCHIJAAAA nmt{0.0.1} [New Minecraft Technologies] (bin)
GL info: ' Vendor: 'NVIDIA Corporation' Version: '3.2.0' Renderer: 'GeForce GT 240/PCI/SSE2'
Launched Version: 1.7.10
LWJGL: 2.9.1
OpenGL: GeForce GT 240/PCI/SSE2 GL version 3.2.0, 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: English (US)
Profiler Position: N/A (disabled)
Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Anisotropic Filtering: Off (1)
Код:
package com.dgrayman888.nmt.gui;
import java.io.IOException;
import org.lwjgl.opengl.GL11;
import com.dgrayman888.nmt.tileentities.BlastFurnaceTileEntity;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.inventory.Container;
public class BlastFurnaceGui extends GuiContainer {
public static final ResourceLocation texture = new ResourceLocation("nmt:/");
public BlastFurnaceGui(InventoryPlayer playerinv, BlastFurnaceTileEntity tileentity) {
super(new BlastFurnaceContaiter(playerinv, tileentity));
this.xSize = 300;
this.ySize = 200;
}
@Override
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
GL11.glColor4f(1F, 1F, 1F, 1F);
try{
Minecraft.getMinecraft().getResourceManager().getResource(texture);
}catch (IOException e){
System.out.println("Texture Has not been loaded yet");
e.printStackTrace();
}
drawTexturedModalRect (guiLeft, guiTop, 0, 0, this.xSize, this.ySize);
}
}
Код:
package com.dgrayman888.nmt.gui;
import com.dgrayman888.nmt.tileentities.BlastFurnaceTileEntity;
import cpw.mods.fml.common.network.IGuiHandler;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public class BlastFurnaceGuiHandler implements IGuiHandler{
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
TileEntity entity = world.getTileEntity(x, y, z);
switch (ID){
case 0:
if(entity != null && entity instanceof BlastFurnaceTileEntity){
return new BlastFurnaceContaiter(player.inventory, (BlastFurnaceTileEntity) entity);
}else{
return null;
}
}
return null;
}
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
TileEntity entity = world.getTileEntity(x, y, z);
switch(ID){
case 0:
if(entity != null && entity instanceof BlastFurnaceTileEntity){
return new BlastFurnaceGui(player.inventory, (BlastFurnaceTileEntity) entity);
}
}
return null;
}
}
Если что учился по этому:
[youtube]9w71MUms1IE[/youtube]