Jump to content

[1.11.2] Block not updating other blocks properly and being removed on world reload


That_Martin_Guy

Recommended Posts

I have a block of type BlockWire (which inherits from BlockHideable) that has a tile entity of type TileEntityWire (which in turn inherits from TileEntityHideable). The block mostly works like redstone, and should therefore be able to power redstone. My problem is that the wire doesn't update blocks properly. Redstone can only be turned on, while other wire blocks don't update at all. Also, if I click on the bottom on the block, it becomes visible (even though it shouldn't). I'm suspecting it is because BlockHideable sets the bounding box to AxisAligned(0, 0, 0, 0, 0, 0) instead of NULL_AABB, but if I return that the game crashes with a NullPointerException.

Link to comment
Share on other sites

4 minutes ago, That_Martin_Guy said:

but if I return that the game crashes with a NullPointerException.

> No crash posted

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.

Link to comment
Share on other sites

  • 2 weeks later...
6 minutes ago, diesieben07 said:

Put a breakpoint where it crashes and check what is null, and why.

	@Override
	public AxisAlignedBB getSelectedBoundingBox(IBlockState state, World worldIn, BlockPos pos)
	{
		return state.getValue(HIDDEN) ? NULL_AABB : FULL_BLOCK_AABB;
	}
	
	@Override
	public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
	{
		return state.getValue(HIDDEN) ? NULL_AABB : FULL_BLOCK_AABB;
	}

If I have a new AxisAlignedBB with 0 as all of its parameters instead of NULL_AABB it works.

 

EDIT: I had initally thought this made a problem where the block became visible when right clicked, but later realised it couldn't be because of this since it also becomes visible when receiving a block update.

Edited by That_Martin_Guy
Link to comment
Share on other sites

9 minutes ago, diesieben07 said:

So the code on your Github is not up to date... How are we supposed to help you then?

getBoundingBox must not return null.

 

It is up to date. I mentioned in the post an experiment I made where I returned NULL_AABB in those methods, instead of a new AxisAlignedBB with 0 as all of its parameters, which resulted in a NullPointerException. I did this experiment because I thought having this empty object had an unintended side effect where the block became visible when right clicked. I realize now, however, that it can't be because of that since it also becomes visible when receiving any block update (from a lever, for example). I thought I could "fix" this by making the hitbox null, but again, the hitbox is most likely not the problem.

 

EDIT: Sorry for being unclear and editing my posts a lot, but I was pretty excited that someone would be able to help me (hopefully)

Edited by That_Martin_Guy
Link to comment
Share on other sites

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.