Jump to content

Recommended Posts

Posted (edited)

I'm having another issue (actually this issue has been occurring for quite some time), this time with leaf decay. I've been looking at other mods' code for clues on how to get leaves to decay once the logs are mined away, but nothing has caught my eye. Is there something I'm missing?

 

Currently, I have the leaves set to not decay at all, so my custom trees don't go nude over time.

 

Here is the code for the leaves:  https://github.com/blahblahbal/Blah-s-Minecraft-Mod/blob/Structure-fix/src/main/java/blahblahbal/blahmod/blocks/ModBlockLeaves.java

Here is the code for the logs:  https://github.com/blahblahbal/Blah-s-Minecraft-Mod/blob/Structure-fix/src/main/java/blahblahbal/blahmod/blocks/ModBlockLog.java

 

EDIT: I just noticed that the indentation is all messed up. Please ignore that, I'll fix it.

EDIT2: Fixed the indentation.

Edited by blahblahbal
Posted

Just let default implementation of BlockLeaves do the checks for you. If you want your wood blocks to "support" leaves, preventing them from decaying there is a convinient Block::canSustainLeaves method that does exactly that. For some reason you are not overriding it in your log class thus the default implementation returns false and the leaves just decay as there is nothing to support them.

Posted

Is there a way to extend the range of the 'sustaining' function? My palm tree's foliage is too large to stay 'alive' with the default leaf code, and it'd look weird if I added wood to the foliage.

Posted

Something something copy the existing code into your leaf class as an override and change the values?

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.

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.