My small script to disable dmg on spawn chunks.
Can I also disable player damage state and position change ? That players cant move each other by attack .
EntityEvents.beforeHurt((event)=>{
const entity = event.entity
if (!entity.isPlayer()) return
if (entity.level.dimension !== 'minecraft:overworld') return
const chunkX = Math.floor(entity.x) >> 4
const chunkZ = Math.floor(entity.z) >> 4
if (chunkX >= 1 && chunkX <= 20 && chunkZ >= 16 && chunkZ <= 32) {
event.cancel()
}
})