#Is there a way to make items blast resistant?
14 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
https://kubejs.com/wiki/ref/BlockBuilder
From here, probably set .resistance to MAX_VALUE
Can also copy obsidians resistance value of 1,200 if that doesn't work
Wait block resistances also apply to items?
oh i cant read :3
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
an easier method is just using https://www.curseforge.com/minecraft/mc-mods/lychee
Wats this
you can set the item entity to be invulnerable
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")
})
})