Jump to content

Recommended Posts

Posted
  On 6/16/2017 at 8:36 AM, diesieben07 said:
  • Please, for the love of god, remove all that log spam. Nobody cares that your mod has now received it's preInit event, especially not at INFO level. Your main mod class contains more logging statements than anything else, for crying out loud.
  • Please remove your own (broken!) version checker. Forge already has one, use it.
  • You do not register your gui handler on the server. You must register it on both sides.
  • In general, why is all your code in the proxies? The proxies are for things that are specific to one physical side. Common code goes in your main mod class (or other classes if needed for organization).
Expand  

Ok, I clean my code and added GuiHandler in both sides, but it doesn't work! :|

  • Like 1
Posted
  On 6/16/2017 at 10:47 AM, diesieben07 said:

Define "doesn't work". Is your gui handler called?

Expand  

Yes, here is code where it called:

@Override
	public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn,
			EnumHand hand, EnumFacing heldItem, float side, float hitX, float hitY) {
		if (!worldIn.isRemote) {
			playerIn.openGui(ModCore.instance, GuiHandler.BLOCKBREAKER, worldIn, pos.getX(), pos.getY(), pos.getZ());
		}
		return true;
	}

 

  • Like 1
Posted
  On 6/16/2017 at 12:01 PM, IvanSteklow said:

Yes, here is code where it called:

Expand  

 

I believe diesieben07 meant "Is it actually called at runtime"? Set a breakpoint in each of the GuiHandler methods and try to open your GUI, are the breakpoints hit?

 

In the code on GitHub, GuiHandler#getClientGuiElement always returns null. It should return a new GuiBlockBreaker instance when the ID matches.

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.

Posted (edited)
  On 6/16/2017 at 12:09 PM, Choonster said:

 

I believe diesieben07 meant "Is it actually called at runtime"? Set a breakpoint in each of the GuiHandler methods and try to open your GUI, are the breakpoints hit?

 

In the code on GitHub, GuiHandler#getClientGuiElement always returns null. It should return a new GuiBlockBreaker instance when the ID matches.

Expand  

So, thank you, but now I got new problem... In this piece of code:

if (sync == 0)
PacketHandler.INSTANCE.sendToServer(new PacketGetWorker(this.te.getPos(), this.mc.player.getAdjustedHorizontalFacing(), "ivansteklow.vanillaex.client.gui.GuiBlockBreaker", "cooldown", "maxCooldown"));

There is an error:

Description: Rendering screen

java.lang.NullPointerException: Rendering screen
	at ivansteklow.vanillaex.client.gui.GuiBlockBreaker.drawGuiContainerForegroundLayer(GuiBlockBreaker.java:77)

What's wrong, why NullPointerException?

It's full error:

  Reveal hidden contents

 

Edited by IvanSteklow
  • Like 1
Posted
  On 6/16/2017 at 12:42 PM, diesieben07 said:

Set a breakpoint on that line and check what is null.

Expand  

It's crashes on this block of code:

public static SimpleNetworkWrapper INSTANCE;

This is all class:

  Reveal hidden contents

 

  • Like 1
Posted
  On 6/16/2017 at 12:09 PM, Choonster said:

 

I believe diesieben07 meant "Is it actually called at runtime"? Set a breakpoint in each of the GuiHandler methods and try to open your GUI, are the breakpoints hit?

 

In the code on GitHub, GuiHandler#getClientGuiElement always returns null. It should return a new GuiBlockBreaker instance when the ID matches.

Expand  

 

  On 6/16/2017 at 4:49 PM, diesieben07 said:

You never call registerMessages from anywhere.

Expand  

Thank you for all!

  • Like 1

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.