This is a datapack for Minecraft Java Edition. When the pack is loaded creeper explosions will not destroy blocks - but explosions will still harm players and mobs. Download the pack from the releases page.
The pack works by temporarily disabling the mobGriefing
game
rule whenever a player gets close enough to a creeper to cause it to explode.
mobGriefing
remains disabled for 60 ticks,
which is the time it takes for a creeper to explode,
and then it is re-enabled.
The advantage of disabling mobGriefing
temporarily vs permanently is that
mobGriefing
affects many other game features besides creeper explosions. For
example villagers cannot breed while mobGriefing
is disabled because they
cannot pick up food.
This datapack will override your /gamerule mobGriefing
commands. If you
want to disable mobGriefing
permanently you will need to disable this
datapack.