3

I'm working on adding some custom tools using commands. I would like one tool to allow the player to "fly", but after some research I've decided to try and settle for just allowing the player to freeze his y coord. I've tried tp-ing the player up just a little bit to counter the gravity, but couldn't find the right amount to keep the player at a constant level. I have also tried using effects such as levitation, which didn't work even at its lowest level, and slow falling, which seems to have no difference with an amplifier of 1 or 255. When I looked into it, I found a post made on the minecraft bug site with a response that they don't support effects achieved only by commands. I've heard about putting a barrier under the player which would be ok, but I don't know what I'd do if there is lava or water below the player.

I'm using Java Edition PC in minecraft 1.13.

  • 2
    I think - THINK - that giving a player levitation with an amplifier of 255 still lets the player hover in mid-air in 1.13. Have you tried it? – SpiceWeasel Jan 29 at 17:29
  • 1
    That works! Thanks. If you nake that as an answer, I will accept it. – Jack Stoller Jan 30 at 1:08
  • 1
    Could I ask about all the downvotes? Is there somhing that I am missing? – Jack Stoller Jan 30 at 1:08
  • 1
    I don't know about the downvotes, since I didn't downvote. Maybe the typos, which I can fix for you. – SpiceWeasel Jan 30 at 1:32
  • 1
    Yeah, sorry I am really bad with English and I was typing this on a phone without auto correct. – Jack Stoller Jan 30 at 1:43
3

You can grant players with levitation that keeps them hovered in the air with this command:

/effect give @p levitation <seconds, goes up to 1000000> 255 true

To remove the effect:

/effect clear @p levitation
  • why is this the case though...? integer overflow? "its not a bug, its a feature?" – Alexander Day Feb 7 at 15:37
  • @AlexanderDay I'm not it has to do with something about going past 128, then it does the reverse. I think on the minecraft wiki it says it's a feature, or maybe it was originally a bug but now a feature, I don't remember. It also does the same with a few other effects, such as jump boost, which will actually take away your jumping ability at 128. – SpiceWeasel Feb 7 at 16:06
0

You could try setting a repeating command block to:

execute at @p[nbt={SelectedItem:{id:"minecraft:blaze_rod"}}] if block ~ ~-1 ~ air run setblock ~ ~-1 ~ minecraft:barrier

And have one repeating command block:

execute at @p[nbt={SelectedItem:{id:"minecraft:blaze_rod"}}] if block ~ ~-1 ~ barrier run setblock ~ ~-1 ~ minecraft:air

I haven't tried this yet but I think it might work. The idea is that before the barrier block is turned into air the player steps on it and stays in the air. I don't know if this will work though. It only works if the player is holding a blaze rod. If this does'nt work you could just have:

execute at @p[nbt={SelectedItem:{id:"minecraft:blaze_rod"}}] if block ~ ~-1 ~ air run setblock ~ ~-1 ~ minecraft:oak_leaves

Even though this leaves a path of leaves behind the player they'll eventually disapear.

  • The player can't move down though – IHaveQuistion Mar 16 at 17:43
  • You could detect a player sneaking and remove the block and put it two blocks below the player. – Jack Stoller Mar 16 at 20:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.