Made default CacheLayer add method insert before 'normal'
This commit is contained in:
@@ -173,6 +173,7 @@ public interface Platform{
|
|||||||
|
|
||||||
String result = OS.exec(args.toArray(String.class));
|
String result = OS.exec(args.toArray(String.class));
|
||||||
|
|
||||||
|
//cancelled selection, ignore result
|
||||||
if(result.isEmpty() || result.equals("\n")) return;
|
if(result.isEmpty() || result.equals("\n")) return;
|
||||||
|
|
||||||
if(result.endsWith("\n")) result = result.substring(0, result.length() - 1);
|
if(result.endsWith("\n")) result = result.substring(0, result.length() - 1);
|
||||||
|
|||||||
@@ -44,6 +44,11 @@ public abstract class Content implements Comparable<Content>{
|
|||||||
return minfo.mod == null;
|
return minfo.mod == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @return whether this content is from a mod. */
|
||||||
|
public boolean isModded(){
|
||||||
|
return !isVanilla();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(Content c){
|
public int compareTo(Content c){
|
||||||
return Integer.compare(id, c.id);
|
return Integer.compare(id, c.id);
|
||||||
|
|||||||
@@ -18,8 +18,16 @@ public class CacheLayer{
|
|||||||
|
|
||||||
public int id;
|
public int id;
|
||||||
|
|
||||||
/** Register a new CacheLayer. */
|
/** Registers cache layers that will render before the 'normal' layer. */
|
||||||
public static void add(CacheLayer... layers){
|
public static void add(CacheLayer... layers){
|
||||||
|
for(var layer : layers){
|
||||||
|
//7 = 'normal' index
|
||||||
|
add(7, layer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Register CacheLayers at the end of the array. This will render over "normal" tiles. This is likely not the method you want to use. */
|
||||||
|
public static void addLast(CacheLayer... layers){
|
||||||
int newSize = all.length + layers.length;
|
int newSize = all.length + layers.length;
|
||||||
var prev = all;
|
var prev = all;
|
||||||
//reallocate the array and copy everything over; performance matters very little here anyway
|
//reallocate the array and copy everything over; performance matters very little here anyway
|
||||||
@@ -43,11 +51,15 @@ public class CacheLayer{
|
|||||||
System.arraycopy(prev, index, all, index + 1, prev.length - index);
|
System.arraycopy(prev, index, all, index + 1, prev.length - index);
|
||||||
|
|
||||||
all[index] = layer;
|
all[index] = layer;
|
||||||
|
|
||||||
|
for(int i = 0; i < all.length; i++){
|
||||||
|
all[i].id = i;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Loads default cache layers. */
|
/** Loads default cache layers. */
|
||||||
public static void init(){
|
public static void init(){
|
||||||
add(
|
addLast(
|
||||||
water = new ShaderLayer(Shaders.water),
|
water = new ShaderLayer(Shaders.water),
|
||||||
mud = new ShaderLayer(Shaders.mud),
|
mud = new ShaderLayer(Shaders.mud),
|
||||||
tar = new ShaderLayer(Shaders.tar),
|
tar = new ShaderLayer(Shaders.tar),
|
||||||
|
|||||||
@@ -116,6 +116,11 @@ public class Stat implements Comparable<Stat>{
|
|||||||
return Core.bundle.get("stat." + name.toLowerCase(Locale.ROOT));
|
return Core.bundle.get("stat." + name.toLowerCase(Locale.ROOT));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString(){
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(Stat o){
|
public int compareTo(Stat o){
|
||||||
return id - o.id;
|
return id - o.id;
|
||||||
|
|||||||
@@ -30,6 +30,11 @@ public class StatCat implements Comparable<StatCat>{
|
|||||||
return Core.bundle.get("category." + name);
|
return Core.bundle.get("category." + name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString(){
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(StatCat o){
|
public int compareTo(StatCat o){
|
||||||
return id - o.id;
|
return id - o.id;
|
||||||
|
|||||||
Reference in New Issue
Block a user