- 117
- 7
Скопировал код из EntityMob, думал так должно получится, но что-то не сработало. Я посмотрел кучу модов с мобами, но нигде не нашел метода addSpawn. А как его правильно юзать не знаю. Подскажите, чего тут не хватает?
Java:
protected boolean isValidLightLevel()
{
BlockPos blockpos = new BlockPos(this.posX, this.getEntityBoundingBox().minY, this.posZ);
if (this.world.getLightFor(EnumSkyBlock.SKY, blockpos) > this.rand.nextInt(32))
{
return false;
}
else
{
int i = this.world.getLightFromNeighbors(blockpos);
if (this.world.isThundering())
{
int j = this.world.getSkylightSubtracted();
this.world.setSkylightSubtracted(10);
i = this.world.getLightFromNeighbors(blockpos);
this.world.setSkylightSubtracted(j);
}
return i <= this.rand.nextInt(8);
}
}
public boolean getCanSpawnHere()
{
return this.world.getDifficulty() != EnumDifficulty.PEACEFUL && this.isValidLightLevel() && super.getCanSpawnHere();
}