Jump to content

Recommended Posts

Posted

Hi! I recently got into minecraft modding and I'm having a bit of trouble finding the right function to make the blocks behave as they normally do in the vanilla game. Basically I spawn the water block, however it will just sit there upon spawning. I want it to flow as a normal water block would (Similar to a water bucket when its clicked on a block).

 

Here's my current code:

BlockPos pos = new BlockPos((myChunk.xPosition * 16) + x + 1, y + 2, (myChunk.zPosition * 16) + z);
//Set block to current position and set it to flow.
//State 8 is flowing water, 9 is water. 
//TODO: Test differences between state 8 and 9.
world.setBlockState(pos, BlockLiquid.getFlowingBlock(Material.water).getDefaultState());

 

Right now the code obviously isn't correct. I was experimenting with a few different changes. The ones I stumbled across mentioned setBlockMetadataWithNotify, however that seems to be deprecated with IBlockStates, however I'm not sure what state to change it to to make it flow. I've also tried notify however I'm probably using it wrong. If there's any function to say "Hey world/chunk, you need to update this block according to vanilla water properties", that would be great.

 

Any advice/tips/response would be appreciated. -Thanks.

Posted

I don't know the answer off the top of my head.

I'd suggest you put a breakpoint into ItemBucket.tryPlaceContainedLiquid(), use a bucket to place some water, and see what vanilla does.

 

-TGG

I like that idea, a lot, its a little late tonight, so I'll play around with that tomorrow and see how that goes.

 

Thanks!

Posted

So a bit of progress and non progress. I can now raise the water and make it act dynamically, however the engine doesn't do this for me. I do it in my own code.

world.setBlockState(pos, BlockDynamicLiquid.getFlowingBlock(Material.water).getStateFromMeta(0x1), 3);

I've tried marking the block for update, and a couple of other things, but it still seems to just hover in the air and not fill in the gaps.

 

At this point I'm thinking of doing it in my own code, but any suggestions would be appreciated.

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.