4

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.

5
  • 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? Jan 29, 2019 at 17:29
  • 1
    That works! Thanks. If you nake that as an answer, I will accept it.
    – Jack
    Jan 30, 2019 at 1:08
  • 1
    Could I ask about all the downvotes? Is there somhing that I am missing?
    – Jack
    Jan 30, 2019 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. Jan 30, 2019 at 1:32
  • 1
    Yeah, sorry I am really bad with English and I was typing this on a phone without auto correct.
    – Jack
    Jan 30, 2019 at 1:43

2 Answers 2

4

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
2
  • why is this the case though...? integer overflow? "its not a bug, its a feature?" Feb 7, 2019 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. Feb 7, 2019 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.

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .