Update the world preview to respect the annotation ordering
import org.terasology.world.viewer.color.ColorModels;
import org.terasology.world.viewer.layers.FacetLayer;
import org.terasology.world.viewer.layers.FacetLayers;
+import org.terasology.world.viewer.layers.Renders;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.image.WritableRaster;
import java.math.RoundingMode;
import java.nio.ByteBuffer;
+import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicInteger;
+import java.util.stream.Collectors;
/**
* A world preview based on the facets that are generated by the {@link WorldGenerator}
public FacetLayerPreview(WorldGenerator worldGenerator, List<FacetLayer> facetLayers) {
this.worldGenerator = worldGenerator;
- this.facetLayers = facetLayers;
+ this.facetLayers = facetLayers.stream()
+ .sorted(Comparator.comparingInt(layer -> layer.getClass().getAnnotation(Renders.class).order()))
+ .collect(Collectors.toList());
}
public FacetLayerPreview(ModuleEnvironment environment, WorldGenerator worldGenerator) {
