I need to know how to open the crafting gui when I right click an item. I don't want to modify any base classes. here is my item:
@Override
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int x, int y, int z, int par7, float par8, float par9, float par10)
{
if (par3World.isRemote)
{
return true;
}
else
{
par2EntityPlayer.displayGUIWorkbench(x, y, z);
return true;
}
}
this doesn't work... well it does but only for like half a second.
Ok i did that it works but when I pick up an item it moves back to its original place. and if I pick up an item in the bottom right corner of the gui I get this crash:
---- Minecraft Crash Report ----
// Hey, that tickles! Hehehe!
Time: 4/4/13 1:08 AM
Description: Ticking memory connection
java.lang.IndexOutOfBoundsException: Index: 45, Size: 45
at java.util.ArrayList.rangeCheck(Unknown Source)
at java.util.ArrayList.get(Unknown Source)
at rq.a(SourceFile:136)
at iv.a(NetServerHandler.java:908)
at dc.a(SourceFile:31)
at cf.b(MemoryConnection.java:80)
at iv.d(NetServerHandler.java:136)
at iw.b(NetworkListenThread.java:57)
at bec.b(IntegratedServerListenThread.java:108)
at net.minecraft.server.MinecraftServer.r(MinecraftServer.java:703)
at net.minecraft.server.MinecraftServer.q(MinecraftServer.java:599)
at bdz.q(IntegratedServer.java:170)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:497)
at fy.run(SourceFile:849)
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- System Details --
Details:
Minecraft Version: 1.4.7
Operating System: Windows 8 (x86) version 6.2
Java Version: 1.7.0_15, Oracle Corporation
Java VM Version: Java HotSpot(TM) Client VM (mixed mode), Oracle Corporation
Memory: 335169384 bytes (319 MB) / 519110656 bytes (495 MB) up to 1037959168 bytes (989 MB)
JVM Flags: 2 total; -Xms512m -Xmx1024m
AABB Pool Size: 4517 (252952 bytes; 0 MB) allocated, 4089 (228984 bytes; 0 MB) used
Suspicious classes: FML and Forge are installed
IntCache: cache: 0, tcache: 0, allocated: 3, tallocated: 63
FML: MCP v7.26 FML v4.7.4.520 Minecraft Forge 6.6.0.497 Optifine OptiFine_1.4.6_HD_U_D5 4 mods loaded, 4 mods active
mcp [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
FML [Forge Mod Loader] (coremods) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
Forge [Minecraft Forge] (coremods) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
Xemplar [XemplarIndustry] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
Profiler Position: N/A (disabled)
Vec3 Pool Size: 1341 (75096 bytes; 0 MB) allocated, 1043 (58408 bytes; 0 MB) used
Player Count: 1 / 8; [iq['Roxas240'/341, l='World', x=-35.66, y=77.00, z=250.59]]
Type: Integrated Server (map_client.txt)
Is Modded: Definitely; Client brand changed to 'forge,fml'
GUI opening needs stuff done on both client and server (the Container) so try getting rid of the isRemote check. the display gui methods take x,y,z as params because it assumes youre using it on a TileEntity. If you don't have a TE to reference then this is a problem and you'll have to make your own GUI handler... I think... Try just getting rid of the isRemote check first.
Based off your crash report it looks like you're using obfuscated classes? wut?
GUI opening needs stuff done on both client and server (the Container) so try getting rid of the isRemote check. the display gui methods take x,y,z as params because it assumes youre using it on a TileEntity. If you don't have a TE to reference then this is a problem and you'll have to make your own GUI handler... I think... Try just getting rid of the isRemote check first.
Based off your crash report it looks like you're using obfuscated classes? wut?
You're 100% wrong. All rendering is done on THE CLIENT ONLY. The server runs the world, updates ticks and the like, the client renders.
Yep, you need your own Handler. It's simple to do.
No, you don't. If you're using ModLoader or forge, any how. ModLoader.openGUI will suffice. If you're using forge then try checking out the forge wiki, it has a tutorial on how to use MinecraftForgeClient.displayGui
You're 100% wrong. All rendering is done on THE CLIENT ONLY. The server runs the world, updates ticks and the like, the client renders.
No, you don't. If you're using ModLoader or forge, any how. ModLoader.openGUI will suffice. If you're using forge then try checking out the forge wiki, it has a tutorial on how to use MinecraftForgeClient.displayGui
Rendering something on the screen is one thing, having a gui with an inventory is another. If it is taking and storing data(the items in the crafting matrix) then the server needs to know about it. A handler is required.
Rollback Post to RevisionRollBack
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
You're 100% wrong. All rendering is done on THE CLIENT ONLY. The server runs the world, updates ticks and the like, the client renders.
No, you don't. If you're using ModLoader or forge, any how. ModLoader.openGUI will suffice. If you're using forge then try checking out the forge wiki, it has a tutorial on how to use MinecraftForgeClient.displayGui
All the rendering goes on with the client but all operations involving the placement of the items in the chest happen on the server to limit the possibility of hacking.
All the rendering goes on with the client but all operations involving the placement of the items in the chest happen on the server to limit the possibility of hacking.
Yes, but he was stating that the render method should of been called on the server. This is wrong, but I never said the client handled storing items, if you're just using a workbench GUI, then forge and ModLoader have pre-built methods.(Built I was wrong - you WOULD also need a handler)
This is because all rendering is done client side, and you were telling the server to render a gui.
the display gui methods take x,y,z as params because it assumes youre using it on a TileEntity. If you don't have a TE to reference then this is a problem and you'll have to make your own GUI handler... I think... Try just getting rid of the isRemote check first.
Based off your crash report it looks like you're using obfuscated classes? wut?
No, you don't. If you're using ModLoader or forge, any how. ModLoader.openGUI will suffice. If you're using forge then try checking out the forge wiki, it has a tutorial on how to use MinecraftForgeClient.displayGui
Rendering something on the screen is one thing, having a gui with an inventory is another. If it is taking and storing data(the items in the crafting matrix) then the server needs to know about it. A handler is required.
together they are powerful beyond imagination."
All the rendering goes on with the client but all operations involving the placement of the items in the chest happen on the server to limit the possibility of hacking.