Bewitchment (Legacy)

Bewitchment (Legacy)

8M Downloads

Fix black dogs spawning

Sunconure11 opened this issue ยท 2 comments

commented

They attempt to spawn during the day on peaceful, but get removed, since they are not meant to spawn there. Ideally, this event should not fire at all, they are meant to spawn only at night, and disappear during the day, in any mode but peaceful.

commented

world.isDaytime() does not work. EDIT: Well, it does, just not very well (on the client)
I use something like this typically:

public boolean isDaytime() {
		long time = this.world.getWorldTime() % 24000L; // Time can go over values of 24000, so divide and take the remainder
		return !(time >= 13000L && time <= 23000L);
}
commented

Ah, I've discovered the actual issue.
Someone wrote this:

public boolean getCanSpawnHere() {
		return this.world.getDifficulty() != EnumDifficulty.PEACEFUL != this.world.isDaytime() && super.getCanSpawnHere();
	}

Which has been solved via:

public boolean getCanSpawnHere() {
		return this.world.getDifficulty() != EnumDifficulty.PEACEFUL && !this.isDaytime() && super.getCanSpawnHere();
	}
public boolean isDaytime() {
		long time = this.world.getWorldTime() % 24000L; // Time can go over values of 24000, so divide and take the remainder
		return !(time >= 13000L && time <= 23000L);
	}