Jump to content

Recommended Posts

Posted

I'm trying to get a custom mob to spawn regardless of light level, and for some reason the code isn't working. I've overridden the isValidLightLevel() method to always return true, but they still seem to only spawn at night. There's nothing else wrong with it other than what time it spawns at, and as far as I'm aware it should be working exactly as intended. Here's my code.

public class EntityCirno extends EntityMob {

	public EntityCirno(World worldIn) {
		super(worldIn);
	}

	@Override
	protected boolean isValidLightLevel() {
		return true;
	}
}

There is no AI implemented right now because the spawning should work fine without it, and it does, except that they still only spawn in the dark. I honestly, sincerely have no clue what I'm doing wrong. Other forum posts have said this is exactly what I need to do as well. I may just be missing something very obvious here.

Posted

Can anyone help me with this? I've tried absolutely everything to make this work and it still hasn't. I'm thinking that it's either a forge bug, or overriding the isValidLightLevel method is just an outdated way of doing it and no longer works, since every post that mentions it was from several years ago. It certainly would make sense for it to work though.

  • 7 months later...
Posted (edited)
On 8/27/2019 at 10:12 AM, Cerandior said:

Which version of Forge is this?

Oof, sort of forgot about this problem for a while but now I'm trying it again, and it's still the same problem. Not sure if it's against the rules to revive threads as old as this, but I haven't actually solved it yet, so.

 

The forge version is 14.23.5.2768

Minecraft 1.12.2

 

I have looked at the vanilla code, and low and behold, even the vanilla code uses the same method to override light level checks in its own mobs, specifically the blaze and silverfish. And obviously it works in vanilla.

Edited by NarwhelZhu
Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.