Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.10.2] Create floating Gravel


Adversarius13293
 Share

Recommended Posts

I want to create floating gravel islands, and broke my problem down to this:

I want to place a floating block of gravel. But it always starts falling immediately.

 

world.setBlockState(pos, Blocks.GRAVEL.getDefaultState(), 2)

 

Sadly this method doesn't work. I can place floating lava this way without updating, but not gravel (or sand/anvils).

 

I even tried to place a solid block below the gravel before placing the gravel, and then remove the supporting block right after. But the gravel still starts falling down.

 

Is there a way to create floating gravel, just like it still generates in the nether while normal world generation?

Link to comment
Share on other sites

I think you have to turn

FallInstantly

off in BlockFalling.

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

Ok, in which case I don't know.

 

You can also try the method that works even during creative mode:

Put down GRASS, then on top of it put TALL_GRASS (the two-block-tall variant), put your gravel on top, then remove the GRASS block.  The lower half of the TALL_GRASS will remove the upper half without causing a block update.

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

The solution depends on what you're really trying to do. For instance, you could create an extension of dirt that is textured to look like gravel, and it could even drop vanilla gravel (act like gravel ore, and it could randomly drop flint too). Would that achieve your goals?

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Link to comment
Share on other sites

This works for other entities. Such as thrown things. Don't know why it wouldn't work on a falling block entity.

 

protected float getGravityVelocity()
    {
        return 0.0F;
    }

He doesn't have access to that, as he would need to modify the FallingGravelEntity.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

Even the tall grass method in creative doesnt work for me on the forge build...

Changing the block state directly in the chunks doesnt work for me either.

I dont have(when placing it) and I dont want the gravel as an entity, so I dont think the gravityVelocity can help me.

 

What I want to do more precisely:

In the DecorateBiomeEvent.Post replace all Netherrack with air (works). And replace all Soul Sand with Gravel. This way I will have more floating Gravel islands generated than by just removing Netherrack.

Link to comment
Share on other sites

When you call World#setBlockState() - or Chunk#setBlockState() - Block#onBlockAdded() is called for the block you've set, if the block has actually changed.  BlockFalling#onBlockAdded() calls World#scheduleUpdate(), which leads eventually to BlockFalling#updateTick(), and that method will turn the block into an EntityFallingBlock (via BlockFalling#checkFallable) if the block isn't supported from beneath.

 

So... it doesn't seem directly possible to spawn gravel/sand/anvils in the air and not have them fall, even if you don't see the block update flag, i.e. bitmask 1 in the flags argument to setBlockState().

 

However, you should be able to do as @Draco18s said with the tall grass trick, or possibly even temporarily placing any solid block under your gravel before placing it, and removing the temporary block afterwards.  As long as the block update flag (bitmask 1) isn't set, that shouldn't notify the gravel of a physics update, and leave it in place.  E.g.:

 

BlockPos below = pos.down();
// flags=0: no update notification, don't send to client
world.setBlockState(below, Blocks.STONE.getDefaultState(), 0);
// flags=2: no update notification, do send to client
world.setBlockState(pos, Blocks.GRAVEL.getDefaultState(), 2);
world.setBlockState(below, Blocks.AIR.getDefaultState(), 0);

 

In reply to a couple of other comments in this thread:

  • getGravityVelocity() is an entity method, and we don't want an EntityFallingBlock being created at all.
  • BlockFalling.fallInstantly is false by default anyway.  If true, it stops the smooth falling effect, and just "teleports" the falling block directly to its final location.  So not relevant here.

Link to comment
Share on other sites

I'm pretty sure if you pre-gen structures with gravel in them at world gen or chunk gen then they stay there and when you update neighbour on any gravel block they start falling. See nether gravel for example you can walk on 1 layer thin and is  fine until you break one block and they will all start falling .

Disclaimer:  I been told to keep my opinions to myself, to shut up and that I am spreading lies and misinformation or even that my methods are unorthodox and or too irregular. Here are my suggestions take it or leave it.

Link to comment
Share on other sites

But the OP wants to do this via the DecorateBiomeEvent.Post event, which is fired after the chunk has been generated.  Gravel stays where it is during chunk generation because it's placed via a ChunkPrimer object, which is not affected by block physics in any way.

 

Given that this is part of chunk generation, it sounds like some custom world gen might be a better option here?  Making big terrain changes via the post event can't be good for chunk generation performance, and as the event name suggests, it's really intended for biome decoration, not terrain modification.

Link to comment
Share on other sites

I don' think you can do it post due to gravel physics.

 

You either need a custom  chunk gen or biome gen/world gen??.

 

Or you wold have to place fake gravel  (your own gravel) that you can turn off physics at place time.

 

Or place that non falling gravel a chunk generation but not after. 

 

Ruins spawn modby AtomicStryker can place ruins and various structures including non falling gravel because it does it whenever chunk is being generated whenever you venture to new land.

 

Or you need some sort of system to disable block update at place time. There's no block update when you gen chunk but once you break a block then the chunk starts updating which is why gravel stays floating.  But when you place the block there is block update because you just updated the chunk so all the blocks nearby including the placed block will update making your gravel fall.

Disclaimer:  I been told to keep my opinions to myself, to shut up and that I am spreading lies and misinformation or even that my methods are unorthodox and or too irregular. Here are my suggestions take it or leave it.

Link to comment
Share on other sites

Yeah, as Desht states, DecorateBiomeEvent is not to actively alter medium-to-large parts of a chunk.

When I developed Underworld, I had to do make use of some tricks to spawn what I wanted, where I wanted it, how I wanted it, without it actively killing the computer generating the terrain.

Dealing with possibly 100 or more blockstates in one chunk at once, through world#getBlockState & world#setBlockState, will have similar issues, no matter how you do it.

Compared to how ChunkProvider's generate terrain, world#getBlockState & world#setBlockState are quite inefficient (ChunkProvider's get a double-array with the size of 16x16xWorldHeight from NoiseOctaves|Perlin directly, and simply fills it instantaneously, creating the "chunk" without any features like trees, flowers etc)

 

Bar ASM, you cannot stop gravel from falling. On every random update tick, it checks if it can fall in

BlockFalling#checkFallable

.

Because it sounds like you are trying to do some major WorldGen changes, I would recommend you create your own ChunkProvider entirely, that places your own pseudo gravel (looks like gravel, drops gravel, sounds like gravel, but doesnt fall), with a following WorldProvider, and re-register the dimension in the DimensionManager.

Or you could do as you want right now, but likely have some major lagspikes during worldgen.

Also previously known as eAndPi.

"Pi, is there a station coming up where we can board your train of thought?" -Kronnn

Published Mods: Underworld

Handy links: Vic_'s Forge events Own WIP Tutorials.

Link to comment
Share on other sites

The only way I can think you would be able to do this is a your own fake gravel block without physics (that looks identical to MC one) that replaces itself with a regular MC gravel block with physics when certain conditions are met. To the player the gravel block will never change but in fact there would be 2 different blocks. 

 

So whenever you make your structure you would make it out of fake gravel and whenever a block gets updated after structure gen say cooldown of 2 sec then block automatically turns intself into MC gravel. So that way the fake gravel will stay floating until you break one and then every fake gravel around it will start turning into regular gravel and start falling.

Disclaimer:  I been told to keep my opinions to myself, to shut up and that I am spreading lies and misinformation or even that my methods are unorthodox and or too irregular. Here are my suggestions take it or leave it.

Link to comment
Share on other sites

Bar ASM, you cannot stop gravel from falling. On every random update tick, it checks if it can fall in BlockFalling#checkFallable.

 

Gravel doesn't tick randomly, so that shouldn't be an issue.  As @trollworkout mentioned, unsupported gravel appears regularly in the Nether, and stays where it is until it gets a block physics update, then cascading physics updates bring the whole lot down.

 

But I agree - use a custom ChunkProvider here; it'll solve both the falling block problem and the likely performance problems.

 

So whenever you make your structure you would make it out of fake gravel and whenever a block gets updated after structure gen say cooldown of 2 sec then block automatically turns intself into MC gravel.

 

Shouldn't be necessary (as you yourself stated in your first post).  As long as the gravel is pre-generated, it won't fall until it gets a physics update by a neighbouring block being changed.  At that point, the falling gravel itself causes a physics update, and any neighbouring gravel will fall, and so on.

 

Link to comment
Share on other sites

BlockPos below = pos.down();
// flags=0: no update notification, don't send to client
world.setBlockState(below, Blocks.STONE.getDefaultState(), 0);
// flags=2: no update notification, do send to client
world.setBlockState(pos, Blocks.GRAVEL.getDefaultState(), 2);
world.setBlockState(below, Blocks.AIR.getDefaultState(), 0);

 

Like I already wrote in my first post, I also tried exactly this, and sadly it doesnt work.

 

But since it seems I should do this in world generation, and also have some other changes that would fit in there, i will try to create my own world generation.

 

I will probably be back later with a new thread, but thank you all so far.

 

Link to comment
Share on other sites

What you need to do is disable chunk updates PLACE gravel re-enable chunk updates. UNFORTUNATELY  as far as i know this is impossible atm.

Disclaimer:  I been told to keep my opinions to myself, to shut up and that I am spreading lies and misinformation or even that my methods are unorthodox and or too irregular. Here are my suggestions take it or leave it.

Link to comment
Share on other sites

What you need to do is disable chunk updates PLACE gravel re-enable chunk updates. UNFORTUNATELY  as far as i know this is impossible atm.

 

Stop suggesting ASM.  It is not needed.  In fact, discussing ASM can get you banned.

 

You can also try the method that works even during creative mode:

Put down GRASS, then on top of it put TALL_GRASS (the two-block-tall variant), put your gravel on top, then remove the GRASS block.  The lower half of the TALL_GRASS will remove the upper half without causing a block update.

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

What is ASM?

 

Draco may be correct about the tallgrass mechanic. Because block updates are caused only to neighbours. If you have a tallgrass or sugarcane when you remove bot sugarcane/grass all will fall but top block stays. But you still need to be able to place a gravel block on top of the grass/sugarcane

Disclaimer:  I been told to keep my opinions to myself, to shut up and that I am spreading lies and misinformation or even that my methods are unorthodox and or too irregular. Here are my suggestions take it or leave it.

Link to comment
Share on other sites

If I try the tallgrass/double flower/sugar cane mechanic in creative in my forge build, it doesnt work. On the vanilla client it works, meaning the block then floats. Is this a bug, intended, or just me?

 

Are you removing the base of the tall grass, or are you removing the supporting grass block?

When I was doing it I had to remove the supporting block from below.

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

I would recommend you create your own ChunkProvider entirely, that places your own pseudo gravel (looks like gravel, drops gravel, sounds like gravel, but doesn't fall), with a following WorldProvider, and re-register the dimension in the DimensionManager.

 

Matryoshika has reached the point I was aiming at several messages earlier. Create imitation gravel that doesn't fall, but make sure it drops the vanilla gravel item-block when broken.

 

And, if you're going to be as radical as eliminating all netherrack from the nether, then I like the idea of designing your own chunk-provider that never creates netherrack in the first place.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Link to comment
Share on other sites

Or, what you COULD do is just remove the update tick from the world's list and do nothing with it.

Like I did and it works fine.

 

:o

Disclaimer:  I been told to keep my opinions to myself, to shut up and that I am spreading lies and misinformation or even that my methods are unorthodox and or too irregular. Here are my suggestions take it or leave it.

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.

Guest
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.

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.