Is there some way that I can save player potion effects after death? I have already tried this command: /gamerule keepInventory True but it doesn't work. Is there any way to save player potion effects after death?
-
Do you mean after you respawn?– BitNinjaApr 19, 2014 at 15:58
-
@codeNinja What I means is, let's say that you have a potion effect, then you did. Then you lose the effect. What I am asking is: is there any way to retain this potion effect with a command?– DatEpicCoderGuyWhoProgramsApr 19, 2014 at 16:26
-
Hrm... I don't think so. It would be tricky at best to do, anyway. I'll think about it, though, and see what I can come up with. It wouldn't be easy to do, certainly, and would involve a lot of command blocks (so if your intended application is a pure survival world the answer is no)– Unionhawk ♦Apr 19, 2014 at 18:19
-
@Unionhawk it is just fine that it would invoke command blocks. In fact, that would be my preferred method.– DatEpicCoderGuyWhoProgramsApr 19, 2014 at 18:27
-
2If you've solved your problem, then please post an answer so that others can benefit from what you've learned.– MBraedleyApr 21, 2014 at 2:09
4 Answers
This problem can be solved like this:
If they obtain the potion effect via redstone switch or button, then have that switch or button set off a redstone signal leading to command block, as shown in this picture:
The Command block branching off to the right of the button will give the player the effect, and the one branching off to the left will place the block of redstone shown above it. This will cause an extremely rapid redstone clock updating the command block thats connected to the clock. This will check for player death. If a player death is detected, it will cause the comparator to send a signal to the connected command block and will give the player their effect back. This method works as of minecraft 1.7.10.
I found a way to accomplish this, just make an extremely fast redstone clock feeding into a command block with this command running inside of it:
/effect @a 14 240 372000
Well, for my 1.12.2 map, I just made a redstone clock out of observer blocks (new 1.12.2 redstone things) and I wired it to a command block constantly giving saturation to @a (all players). In the rules section of the map I just told the players to disable the chat so they wouldn't see the constant spam, but I'm still looking for a better way.
-
By the way, saturation makes it so your hunger bar recharges, much like regeneration, except with the hunger bar. Apr 15, 2018 at 0:44
I'm not very good when it comes to redstone but I have a map I'm making with a character select and each character has their own effect that last's forever I've done this by making the button lead to a structure block that spawns a command block with the effect already typed into it connected to this command block is a daylight sensor this way the effect is restored daily if you change characters the command block is replaced with the character's effect. I know this isn't exactly what you might be looking for but it works and I've used it in my map.
-
1Some punctuation and formatting would make this much better. As it is, it's extremely hard to read or understand.– FrankMar 4, 2018 at 15:22