#Is there a way to make items blast resistant?

14 messages · Page 1 of 1 (latest)

sharp canopy
#

title

blissful orbitBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

minor viper
#

Can also copy obsidians resistance value of 1,200 if that doesn't work

sharp canopy
minor viper
#

oh i cant read :3

sharp canopy
#

I thought they were only for blocks as it said

#

No worries

minor viper
#

you can prob just use the LevelEvents.afterExplosion or LevelEvents.beforeExplosion and just copy the item that is exploded

#

if not, let me look around rq

sharp canopy
#

Wats this

proven gulch
#

you can set the item entity to be invulnerable

proven gulch
# sharp canopy title
const invulnerableItem = "minecraft:diamond_block"
EntityEvents.spawned("minecraft:item", event => {
    const {entity, entity:{item}, server} = event
    if(item.id != invulnerableItem) return
    entity.setInvulnerable(true)
    const checkFireAndCactus = server.scheduleRepeatingInTicks(4, _ => {
        if(!entity.alive) {
            checkFireAndCactus.clear()
            delete checkFireAndCactus
            return
        }
        if(entity.onFire){
            entity.remove("discarded")
        }
        let {eyePosition} = entity
        let blockPoses = [1, -1].map(i => ["x", "y", "z"].map(c => eyePosition[c]() + i * 0.1).map(n => Math.floor(n)))
        let touchCactus = blockPoses.map(pos => entity.level.getBlock(pos[0], pos[1], pos[2]).blockState.is(Block.getBlock("minecraft:cactus"))).some(b => b)
        if(touchCactus) entity.remove("discarded")
    })
})