private void DispatchEntity(Chunk chunk, int x, int z, EntityParam entityParam) { int height = entityParam.maxEntityHeight < heightCap ? entityParam.maxEntityHeight : heightCap; for (int y = height - 1; y >= entityParam.minEntityHeight; y--) { BlockType curType = chunk.GetBlock(x, y, z).BlockType; if (curType != BlockType.Air && curType != BlockType.StillWater) { List <CheckCondition> conditions = entityParam.checkConditions; bool canDecorate = CheckConditionMeet(chunk, conditions, x, y, z); //bool lightCondiciont = CheckLightCondition(chunk, entityParam.lightCondition, x, y, z); if (canDecorate) { EntityData data = new EntityData(); data.id = entityParam.entityId; data.type = EntityType.MONSTER; data.pos = new Vector3(chunk.worldPos.x + x, chunk.worldPos.y + y + 1, chunk.worldPos.z + z); chunk.AddEntityData(data); return; } } } }