Adapted from @proven pagoda's 'entity.tick' implementation
const LivingEntity = Java.loadClass('net.minecraft.world.entity.LivingEntity')
function updateEntity(entity, level) {
//check if the entity is removed; if the entity is a LivingEntity, optionally check if it is dying
if (entity.removed || (typeof entity == LivingEntity && entity.deadOrDying)) {
return;
} else {
//set scheduleDelay equal to the amount of time in ticks you would like a loop to take
scheduleDelay = 20
//RUN CODE HERE
// Loops in scheduleDelay ticks
Utils.server.scheduleInTicks(scheduleDelay,_ => {
updateEntity(entity, level)
})
}
}
EntityEvents.spawned((e) => {
//replace entityType with the entity/entities you want to "tick"
if (e.entity.getType().includes('entityType')) {
updateEntity(e.entity, e.level)
}
})
