Jump to content

Recommended Posts

Posted

I call it from onKeyPressed() event. Now i can see my GUI and items, but I can't edit it.  Items just go back in their slots when I try to take them. Is it GUI problem or I need to fully setup my messages and message handlers first? I have class GUICustomPlayerInventory extends GuiContainer and separate inventory stored in extendedProperties of player. I want to fully replace standart player inventory with mine. What's simplier: to overriding player.inventory or using my current method?

Posted

I made message and message handler, but I can't open inventory again. Server receives message (it logs it) and then executes EntityPlayer.openGui method

  Reveal hidden contents

 

Here's message class:

 

  Reveal hidden contents

 

Posted

full handler class:

 

  Reveal hidden contents

 

Posted

Here's GUI handler:

 

  Reveal hidden contents

,

message handler:

 

  Reveal hidden contents

 

Registration of handlers:

 

networkWrapper = NetworkRegistry.INSTANCE.newSimpleChannel("customPlayerChannel");

networkWrapper.registerMessage(CustomPlayerOpenInventoryHandler.class, CustomPlayerOpenInventoryMessage.class, 1, Side.SERVER);

NetworkRegistry.INSTANCE.registerGuiHandler(this, new CustomPlayerGUIHandler());

 

It receives message, but GUI doesn't work

Posted

Here's key listener:

 

  Reveal hidden contents

 

I don't close GUI, and problem is not in it, because it was working earlier.

 

GUI:

  Reveal hidden contents

 

Posted

Only thing I can see is you are sending the message twice - once when the key is pressed, and again when it is released. You should add ' && isDown' to your condition.

 

You're not getting any error messages at all in your console log?

 

Show your Container class, then, since that is the only other thing that has been added since it stopped working.

Posted

Container:

 

  Reveal hidden contents

 

 

All I get when press key is

 

  Reveal hidden contents

 

Posted

I register it from

@EventHandler

public void preInit(FMLInitializationEvent event)

with NetworkRegistry.INSTANCE.registerGuiHandler(this, new CustomPlayerGUIHandler());

Posted
  On 4/9/2016 at 4:38 PM, IamMaxim said:

I register it from

@EventHandler

public void preInit(FMLInitializationEvent event)

with NetworkRegistry.INSTANCE.registerGuiHandler(this, new CustomPlayerGUIHandler());

Why is your FMLInitializationEvent handled in a method named 'preInit'? Is that an accident?

 

Anyway, can you show your entire Main class? Something in there is not right.

Posted

Main class:

 

  Reveal hidden contents

 

Posted

Your mod instance is missing its annotation; it should be like this:

@Mod.Instance(TESItems.MODID,)
public static TESItems instance;

 

Also, you are handling the FMLInitializationEvent THREE times... you should only do so once. There are also FMLPreInitializationEvent and FMLPostInitializationEvent events which you can use.

 

Do NOT use @SideOnly in your Main class. Ever. Use the proxy system, which you do not have at all in your mod...

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.