Jump to content

Recommended Posts

Posted

Hey everyone,

 

I'm trying out  the basics of modding, however I've ran into a problem. I made a GUI but I can't move the blocks around. I've recorded a little clip where you can see what happens.

 

 

I've searched around and found a lot of other people with this problem, but it were mostly very old versions (1.4.3 and older), and they said the fix was to use @NetworkMod, which afaik doesn't exist anymore on 1.7.10.

 

I can provide code, just tell me where the problem probably occurs (proxies, main, entity, container, etc).

Posted

Problem may occur anywhere in listed classes :D

 

Proxy, GuiHandler, Container, Gui, if you are using custom slots - also might be useful and IInventory - if you implement one.

  Quote

1.7.10 is no longer supported by forge, you are on your own.

Posted

Okay, here is the code. Sorry if I missed something, in a hurry. Will be  back in the evening ;)

 

Proxy's

 

  Reveal hidden contents

 

 

Container

 

  Reveal hidden contents

 

 

Block

 

  Reveal hidden contents

 

 

TileEntity

 

  Reveal hidden contents

 

 

GUI

 

  Reveal hidden contents

 

 

Main

 

  Reveal hidden contents

 

Posted

The problem is that you are opening GUI only on client side.

 

Try something like this:

@Override
onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
        TileEntity te = world.getTileEntity(x, y, z);
        if (te != null && te instanceof TileEntityCarbonPressurizer)
                player.openGui(Main.instance, GUIs.carbon_pressurizer.ordinal(), world, x, y, z);

        return super.onBlockActivated(world, x, y, z, player, side, hitX, hitY, hitZ);
}

 

Posted
  On 5/17/2015 at 1:33 PM, Filipsi said:

The problem is that you are opening GUI only on client side.

 

Try something like this:

@Override
onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
        TileEntity te = world.getTileEntity(x, y, z);
        if (te != null && te instanceof TileEntityCarbonPressurizer)
                player.openGui(Main.instance, GUIs.carbon_pressurizer.ordinal(), world, x, y, z);

        return super.onBlockActivated(world, x, y, z, player, side, hitX, hitY, hitZ);
}

 

Hmm, when I changed  this I got the following  error when I open up the GUI

 

-- System Details --
Details:
Minecraft Version: 1.7.10
Operating System: Windows 8.1 (amd64) version 6.3
Java Version: 1.8.0_45, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 874221728 bytes (833 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 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: 13, tallocated: 95
FML: MCP v9.05 FML v7.10.141.1403 Minecraft Forge 10.13.3.1403 4 mods loaded, 4 mods active
mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
FML{7.10.141.1403} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.3.1403-1.7.10.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Forge{10.13.3.1403} [Minecraft Forge] (forgeSrc-1.7.10-10.13.3.1403-1.7.10.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
timmehutils{1.0} [Timmeh's Utilities] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
GL info: ~~ERROR~~ RuntimeException: No OpenGL context found in the current thread.
Profiler Position: N/A (disabled)
Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Player Count: 1 / 8; [EntityPlayerMP['Player83'/347, l='New World', x=208,95, y=79,00, z=246,07]]
Type: Integrated Server (map_client.txt)
Is Modded: Definitely; Client brand changed to 'fml,forge'
[18:14:29] [Client thread/INFO] [sTDOUT]: [net.minecraft.client.Minecraft:displayCrashReport:393]: #@!@# Game crashed! Crash report saved to: #@!@# .\crash-reports\crash-2015-05-17_18.14.29-server.txt
[18:14:29] [Client thread/INFO] [FML]: Waiting for the server to terminate/save.
[18:14:29] [server thread/INFO]: Saving worlds
[18:14:29] [server thread/INFO]: Saving chunks for level 'New World'/Overworld
[18:14:29] [server thread/ERROR] [FML]: A TileEntity type com.atimmeh33.timmehutils.blocks.TileEntityCarbonPressurizer has throw an exception trying to write state. It will not persist. Report this to the mod author
java.lang.RuntimeException: class com.atimmeh33.timmehutils.blocks.TileEntityCarbonPressurizer is missing a mapping! This is a bug!
at net.minecraft.tileentity.TileEntity.writeToNBT(TileEntity.java:96) ~[TileEntity.class:?]
at com.atimmeh33.timmehutils.blocks.TileEntityCarbonPressurizer.writeToNBT(TileEntityCarbonPressurizer.java:43) ~[TileEntityCarbonPressurizer.class:?]
at net.minecraft.world.chunk.storage.AnvilChunkLoader.writeChunkToNBT(AnvilChunkLoader.java:395) [AnvilChunkLoader.class:?]
at net.minecraft.world.chunk.storage.AnvilChunkLoader.saveChunk(AnvilChunkLoader.java:204) [AnvilChunkLoader.class:?]
at net.minecraft.world.gen.ChunkProviderServer.safeSaveChunk(ChunkProviderServer.java:287) [ChunkProviderServer.class:?]
at net.minecraft.world.gen.ChunkProviderServer.saveChunks(ChunkProviderServer.java:340) [ChunkProviderServer.class:?]
at net.minecraft.world.WorldServer.saveAllChunks(WorldServer.java:863) [WorldServer.class:?]
at net.minecraft.server.MinecraftServer.saveAllWorlds(MinecraftServer.java:370) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.stopServer(MinecraftServer.java:405) [MinecraftServer.class:?]
at net.minecraft.server.integrated.IntegratedServer.stopServer(IntegratedServer.java:266) [integratedServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:538) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752) [MinecraftServer$2.class:?]

Posted

Cough

java.lang.RuntimeException: class com.atimmeh33.timmehutils.blocks.TileEntityCarbonPressurizer is missing a mapping! This is a bug!

You didn't register your TE

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
  On 5/17/2015 at 4:23 PM, Draco18s said:

Cough

java.lang.RuntimeException: class com.atimmeh33.timmehutils.blocks.TileEntityCarbonPressurizer is missing a mapping! This is a bug!

You didn't register your TE

 

Oh shit, while I was writing the code I was even saying to myself when I finish this method I gotta register the tile entity, and still I forgot D:

Let me try and see if that fixes it.

 

Edit:

 

Still getting an error

 

java.lang.ClassCastException: com.atimmeh33.timmehutils.blocks.CarbonPressurizerGUI cannot be cast to net.minecraft.inventory.Container
at cpw.mods.fml.common.network.NetworkRegistry.getRemoteGuiContainer(NetworkRegistry.java:243)
at cpw.mods.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:75)
at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2501)
at com.atimmeh33.timmehutils.blocks.CarbonPressurizer.onBlockActivated(CarbonPressurizer.java:78)

 

Edit 2: Wasn't returning a container @ server-sided proxy. Fixed now. Thanks everyone.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.