Skip to content
This repository has been archived by the owner on Jan 18, 2021. It is now read-only.

Random crash when spawning mobs #153

Open
tomrhollis opened this issue Sep 27, 2020 · 0 comments
Open

Random crash when spawning mobs #153

tomrhollis opened this issue Sep 27, 2020 · 0 comments
Labels
bug Something isn't working

Comments

@tomrhollis
Copy link

Environment: Windows Server 2019
Official EZ release based on 1.16.20.03

The crash (screenshot below) has been happening rarely and randomly for a few versions now. It only seems to happen in my spawn area, where I have a script running which removes hostile mobs from existence as soon as they spawn. I'm guessing this is relevant based on the crash dump including something about spawning.

This is the crash message:
image

And the part of the script that might be triggering the crash, if it's relevant:

const spawnArea = {xnw: -318, znw: -286, xse: -124, zse: -67, ylo: 63, yhi: 255}; 
const hitList = ["minecraft:creeper", "minecraft:drowned", "minecraft:evocation_illager", "minecraft:husk",
			   "minecraft:phantom", "minecraft:pillager", "minecraft:ravager", "minecraft:silverfish",
			   "minecraft:slime", "minecraft:stray", "minecraft:vex", "minecraft:vindictor", "minecraft:witch", 
			   "minecraft:zombie", "minecraft:zombie_villager", "minecraft:cave_spider", "minecraft:spider", "minecraft:zombie_villager_v2"];

system.listenForEvent("minecraft:entity_created", (eventData) => applyMonsterRules(eventData.data.entity));

function applyMonsterRules(entity) {
	//if the new mob is a monster on the list and is inside the spawn area, remove it from existence
	let loc = (system.getComponent(entity, "minecraft:position")).data;
	
	if(hitList.includes(entity.__identifier__) && loc.x > spawnArea.xnw && loc.y > spawnArea.ylo && loc.z > spawnArea.znw &&
			loc.x < spawnArea.xse && loc.y < spawnArea.yhi && loc.z < spawnArea.zse) {

		system.destroyEntity(entity);
		return;
	}
}
@Weissnix4711 Weissnix4711 added the bug Something isn't working label Dec 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants