I see that there are 4 modes:
"NONE""BLOCK""MOB""TNT"
nonedoes nothing to mobs or blocks as expected...
blockdestroys the terrain as expected (I'm assumingtntis similar)
But then when it comes to mob it's expected that it only damages mobs but in reality it also damages the terrain as well which is what I don't want
Code below:
ItemEvents.rightClicked(event => {
const { item, level, player, entity } = event
let myBoundingBox = AABB.of(
player.pos.x() - 20,
player.pos.y() - 10,
player.pos.z() - 20,
player.pos.x() + 20,
player.pos.y() + 10,
player.pos.z() + 20
)
if (item.getId() == 'kubejs:final_sword') {
level.getEntitiesWithin(myBoundingBox).forEach(entity => {
if (entity == null) { return }
if (entity.item) { return }
switch (entity.getType()) {
case 'minecraft:lightning_bolt': return
case 'minecraft:end_crystal': return
case 'minecraft:area_effect_cloud': return
case 'minecraft:falling_block': return
default:
break;
}
if (!entity.isPlayer()) {
entity.block.createExplosion()
.exploder(entity)
.explosionMode('mob')
.causesFire(false)
.strength(3)
.explode();
}
})
}
})
