I”m making a map and there”s gonna be a lot of blasting going on and I don”t want it to damage blocks.
I”ve done /gamerule mobGriefing false but there”s still gonna be TNT block damage.
Đang xem: How to disable explosions in minecraft
Is there a way I can turn that off too?
So this is complicated, but not much worse than preventing a player from crafting a diamond sword. The biggest difference here is that everything must happen on the same tick, and it must happen every tick. This precludes the strategy I used in the linked answer; a 20hz fill clock is pretty much a necessity, whereas I could use a slower, simpler clock in that other answer. For this to work, you”re still going to want to disable mob griefing, as I”m using ghast fireballs to create the actual explosion. It”s also possible to have the effect, but cause 0 damage to players or other entities, and I”ll add the commands for that at the end.
The first step is to set up a scoreboard objective to track TNT that”s about to explode:
/scoreboard objectives add TNTGoBoom dummyNext, we need to set up a fill clock. You”ll need two command blocks in a column with an air block separating them. In the bottom, enter the following command:
fill ~ ~1 ~ ~3 ~1 ~ airand in the top one, enter this command:
fill ~ ~-1 ~ ~3 ~-1 ~ redstone_blockPut a redstone block between the two, and you have your fill clock. Ideally, this won”t be near a chunk boundary, but mine was and it still worked fine. Funny stuff can start happening if part of a fill clock gets unloaded from memory, but if it”s a spawn chunk or you”re always near the clock, you don”t have to worry.
Read more: wow and then there were two
You should see three more redstone blocks out one side. You”re going to put down three more command blocks adjacent to the redstone blocks (preferably above or below). In order of closest to the first two command blocks, the commands you want to use are:
scoreboard players set
Now if you want to still have the explosion effect without causing any damage, then you need to replace the fireball summon command with 2 command blocks (and therefore extend your fill clock by one more block):
a ~ ~ ~These two commands create the particle effect and sound of TNT exploding, but that”s it. There”s no damage to the world, players, or entities if you use this instead of the fireball method.
Addendum: So this is really going to mess up things like TNT cannons. I had this running in my creative world where I was previously testing an infinite TNT cannon, and while it kinda works (the projectile TNT still shoots out a bit), it has a tendency to send a fireball into the sky. Also, using this means that each TNT block needs to be lit individually, since with mob-griefing off, the fireball won”t light others nearby. I”m sure there”s a way around this with a little more command-block-fu. Actually, I know there”s a way to do this, I”m just not 100% on the details yet.