Posted August 27, 201510 yr im trying to create a custom block with the default gui for crafting but every time i open it it flashes closed. is there any way i can open the GUI or fix my problem. this is the code i used: parPlayer.displayGui(new BlockWorkbench.InterfaceCraftingTable(parPlayer.worldObj, new BlockPos((int)parPlayer.posX, (int)parPlayer.posY, (int)parPlayer.posZ)));
August 27, 201510 yr Author for the player.openGui what is the mod for the mod.instance parPlayer.openGui(.instance, 0, parPlayer.worldObj, (int)parPlayer.posX, (int)parPlayer.posY, (int)parPlayer.posZ);
August 28, 201510 yr That's the instance of your main mod class (the class with the @Mod ) annotation. If you have a static field in the mod class of the same type, you can add the @Instance annotation to it and FML will fill it with your mod's instance. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
August 28, 201510 yr Post your main mod class, your IGuiHandler class and the class where you call player.openGUI on Gist (use the .java file extension so syntax highlighting works) and link them here. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
August 28, 201510 yr Author heres the link: https://gist.github.com/anonymous/319cc3b412de59c7f363 Thanks!
August 28, 201510 yr You haven't added an @Instance field to your tutmod class. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
August 28, 201510 yr Add a static field of type tutmod to your tutmod class and give it the @Instance annotation. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
August 28, 201510 yr Author now i just get this error: ---- Minecraft Crash Report ---- // You're mean. Time: 8/27/15 10:02 PM Description: Unexpected error java.lang.NullPointerException: Unexpected error at net.minecraftforge.fml.common.network.NetworkRegistry.getLocalGuiContainer(NetworkRegistry.java:266) at net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:97) at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2577) at frenchtoaster.test.blocks.foodcraftingtable1.onBlockActivated(foodcraftingtable1.java:37) at net.minecraft.client.multiplayer.PlayerControllerMP.func_178890_a(PlayerControllerMP.java:416) at net.minecraft.client.Minecraft.rightClickMouse(Minecraft.java:1571) at net.minecraft.client.Minecraft.runTick(Minecraft.java:2131) at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1087) at net.minecraft.client.Minecraft.run(Minecraft.java:376) at net.minecraft.client.main.Main.main(Main.java:117) 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 net.minecraftforge.fml.common.network.NetworkRegistry.getLocalGuiContainer(NetworkRegistry.java:266) at net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:97) at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2577) at frenchtoaster.test.blocks.foodcraftingtable1.onBlockActivated(foodcraftingtable1.java:37) at net.minecraft.client.multiplayer.PlayerControllerMP.func_178890_a(PlayerControllerMP.java:416) at net.minecraft.client.Minecraft.rightClickMouse(Minecraft.java:1571) -- Affected level -- Details: Level name: MpServer All players: 1 total; [EntityPlayerSP['Player406'/33, l='MpServer', x=-1449.43, y=77.00, z=-626.31]] Chunk stats: MultiplayerChunkCache: 260, 260 Level seed: 0 Level generator: ID 00 - default, ver 1. Features enabled: false Level generator options: Level spawn location: -272.00,64.00,47.00 - World: (-272,64,47), Chunk: (at 0,4,15 in -17,2; contains blocks -272,0,32 to -257,255,47), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511) Level time: 115868 game time, 115868 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: 69 total; [EntitySheep['Sheep'/129, l='MpServer', x=-1472.41, y=74.00, z=-565.44], EntitySheep['Sheep'/130, l='MpServer', x=-1473.59, y=74.00, z=-572.88], EntityChicken['Chicken'/131, l='MpServer', x=-1480.31, y=75.00, z=-572.41], EntitySquid['Squid'/138, l='MpServer', x=-1392.59, y=56.72, z=-565.68], EntityPig['Pig'/143, l='MpServer', x=-1464.47, y=75.00, z=-694.19], EntityBat['Bat'/145, l='MpServer', x=-1376.52, y=30.15, z=-697.49], EntityBat['Bat'/146, l='MpServer', x=-1384.18, y=32.06, z=-695.31], EntitySheep['Sheep'/149, l='MpServer', x=-1415.96, y=77.03, z=-688.53], EntitySheep['Sheep'/150, l='MpServer', x=-1406.37, y=74.00, z=-693.91], EntityBat['Bat'/154, l='MpServer', x=-1510.25, y=26.10, z=-582.25], EntityChicken['Chicken'/155, l='MpServer', x=-1508.44, y=81.00, z=-591.53], EntitySheep['Sheep'/156, l='MpServer', x=-1498.50, y=81.00, z=-683.19], EntityBat['Bat'/34, l='MpServer', x=-1412.91, y=20.10, z=-629.56], EntityBat['Bat'/35, l='MpServer', x=-1409.59, y=19.03, z=-631.88], EntityChicken['Chicken'/36, l='MpServer', x=-1444.31, y=76.00, z=-593.44], EntityChicken['Chicken'/37, l='MpServer', x=-1474.66, y=81.00, z=-618.06], EntityPig['Pig'/38, l='MpServer', x=-1431.59, y=78.00, z=-669.41], EntitySheep['Sheep'/39, l='MpServer', x=-1424.53, y=77.00, z=-665.41], EntityItem['item.tile.sapling.oak'/40, l='MpServer', x=-1415.12, y=69.00, z=-612.12], EntitySheep['Sheep'/41, l='MpServer', x=-1411.53, y=69.00, z=-623.50], EntitySheep['Sheep'/169, l='MpServer', x=-1384.97, y=75.00, z=-645.75], EntitySheep['Sheep'/42, l='MpServer', x=-1426.00, y=64.00, z=-598.88], EntitySheep['Sheep'/170, l='MpServer', x=-1389.47, y=77.57, z=-647.65], EntityChicken['Chicken'/43, l='MpServer', x=-1472.53, y=77.00, z=-600.31], EntityItem['item.item.egg'/44, l='MpServer', x=-1474.53, y=76.00, z=-596.88], EntityChicken['Chicken'/45, l='MpServer', x=-1474.44, y=76.00, z=-594.06], EntityChicken['Chicken'/46, l='MpServer', x=-1402.31, y=71.00, z=-624.41], EntityChicken['Chicken'/47, l='MpServer', x=-1460.44, y=74.00, z=-581.69], EntitySheep['Sheep'/48, l='MpServer', x=-1465.47, y=75.00, z=-592.94], EntityChicken['Chicken'/176, l='MpServer', x=-1504.06, y=81.00, z=-642.78], EntityItem['item.item.egg'/49, l='MpServer', x=-1460.66, y=74.00, z=-582.38], EntityItem['item.item.egg'/177, l='MpServer', x=-1505.72, y=81.12, z=-644.22], EntityItem['item.item.egg'/50, l='MpServer', x=-1502.06, y=81.00, z=-620.44], EntitySheep['Sheep'/178, l='MpServer', x=-1407.59, y=84.00, z=-676.47], EntityChicken['Chicken'/51, l='MpServer', x=-1489.66, y=82.00, z=-611.56], EntityChicken['Chicken'/52, l='MpServer', x=-1497.38, y=82.00, z=-617.53], EntityBat['Bat'/53, l='MpServer', x=-1458.41, y=33.10, z=-684.25], EntityPig['Pig'/54, l='MpServer', x=-1458.16, y=74.00, z=-686.63], EntityItem['item.item.egg'/55, l='MpServer', x=-1393.88, y=78.00, z=-643.65], EntityBat['Bat'/183, l='MpServer', x=-1503.65, y=23.82, z=-577.48], EntitySheep['Sheep'/56, l='MpServer', x=-1435.50, y=75.00, z=-590.56], EntitySheep['Sheep'/184, l='MpServer', x=-1489.34, y=77.00, z=-587.16], EntitySheep['Sheep'/57, l='MpServer', x=-1473.78, y=76.00, z=-589.50], EntitySheep['Sheep'/58, l='MpServer', x=-1486.25, y=76.00, z=-592.00], EntityItem['item.item.egg'/59, l='MpServer', x=-1478.72, y=75.00, z=-584.97], EntitySheep['Sheep'/60, l='MpServer', x=-1481.06, y=76.00, z=-588.09], EntityChicken['Chicken'/61, l='MpServer', x=-1496.22, y=79.00, z=-592.47], EntityItem['item.item.egg'/829, l='MpServer', x=-1495.59, y=78.00, z=-591.25], EntitySheep['Sheep'/62, l='MpServer', x=-1472.03, y=77.00, z=-674.91], EntityPig['Pig'/63, l='MpServer', x=-1484.97, y=79.00, z=-683.97], EntityBat['Bat'/64, l='MpServer', x=-1408.38, y=46.10, z=-679.50], EntityChicken['Chicken'/65, l='MpServer', x=-1394.69, y=62.69, z=-593.03], EntitySheep['Sheep'/66, l='MpServer', x=-1451.31, y=73.00, z=-697.22], EntityItem['item.item.egg'/67, l='MpServer', x=-1388.63, y=75.00, z=-635.41], EntityChicken['Chicken'/68, l='MpServer', x=-1382.81, y=76.00, z=-633.28], EntitySheep['Sheep'/196, l='MpServer', x=-1372.84, y=74.00, z=-618.28], EntityChicken['Chicken'/69, l='MpServer', x=-1468.19, y=75.00, z=-562.40], EntityItem['item.item.egg'/70, l='MpServer', x=-1470.47, y=74.00, z=-575.72], EntitySheep['Sheep'/198, l='MpServer', x=-1427.41, y=85.00, z=-694.06], EntityChicken['Chicken'/71, l='MpServer', x=-1470.16, y=75.00, z=-564.31], EntityChicken['Chicken'/72, l='MpServer', x=-1516.75, y=84.00, z=-615.50], EntityChicken['Chicken'/76, l='MpServer', x=-1507.66, y=76.00, z=-553.53], EntitySheep['Sheep'/77, l='MpServer', x=-1494.63, y=80.00, z=-705.47], EntitySquid['Squid'/99, l='MpServer', x=-1393.51, y=59.00, z=-573.52], EntityPlayerSP['Player406'/33, l='MpServer', x=-1449.43, y=77.00, z=-626.31], EntityChicken['Chicken'/105, l='MpServer', x=-1374.59, y=85.00, z=-661.22], EntityItem['item.item.egg'/115, l='MpServer', x=-1507.00, y=80.11, z=-594.25], EntityChicken['Chicken'/121, l='MpServer', x=-1370.56, y=73.00, z=-606.34], EntitySquid['Squid'/125, l='MpServer', x=-1388.36, y=58.57, z=-589.67]] Retry entities: 0 total; [] Server brand: fml,forge Server type: Integrated singleplayer server Stacktrace: at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:392) at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2614) at net.minecraft.client.Minecraft.run(Minecraft.java:405) at net.minecraft.client.main.Main.main(Main.java:117) 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.8 Operating System: Windows 8 (amd64) version 6.2 Java Version: 1.8.0_25, Oracle Corporation Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 769397632 bytes (733 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M IntCache: cache: 0, tcache: 0, allocated: 13, tallocated: 95 FML: MCP v9.10 FML v8.0.99.99 Minecraft Forge 11.14.3.1450 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{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.8-11.14.3.1450.jar) UCHIJAAAA Forge{11.14.3.1450} [Minecraft Forge] (forgeSrc-1.8-11.14.3.1450.jar) UCHIJAAAA tm{1.0} [NinjaToastCraft] (bin) Loaded coremods (and transformers): GL info: ' Vendor: 'Intel' Version: '4.0.0 - Build 9.17.10.2828' Renderer: 'Intel® HD Graphics 4000' Launched Version: 1.8 LWJGL: 2.9.1 OpenGL: Intel® HD Graphics 4000 GL version 4.0.0 - Build 9.17.10.2828, Intel GL Caps: Using GL 1.3 multitexturing. Using GL 1.3 texture combiners. Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported. Shaders are available because OpenGL 2.1 is supported. VBOs are available because OpenGL 1.5 is supported. Using VBOs: No 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) heres the code: @Instance public static Object tutmod; Sorry if I'm doing something stupid.
August 28, 201510 yr java.lang.NullPointerException: Unexpected error at net.minecraftforge.fml.common.network.NetworkRegistry.getLocalGuiContainer(NetworkRegistry.java:266) Ah, you need to register your IGuiHandler in the init phase with NetworkRegistry#registerGuiHandler . Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
August 28, 201510 yr Author so like this? NetworkRegistry.instance().registerGuiHandler(instance, guiHandler);
August 28, 201510 yr Author ok got it its not crashing anymore but it still has the flashing problem.
August 28, 201510 yr Author heres the link for gui and main class: https://gist.github.com/anonymous/319cc3b412de59c7f363
August 28, 201510 yr Author not even if i Override this? @Override public boolean canInteractWith(EntityPlayer playerIn){ return true; }
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.