Made default CacheLayer add method insert before 'normal'
This commit is contained in:
@@ -18,8 +18,16 @@ public class CacheLayer{
|
||||
|
||||
public int id;
|
||||
|
||||
/** Register a new CacheLayer. */
|
||||
/** Registers cache layers that will render before the 'normal' layer. */
|
||||
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;
|
||||
var prev = all;
|
||||
//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);
|
||||
|
||||
all[index] = layer;
|
||||
|
||||
for(int i = 0; i < all.length; i++){
|
||||
all[i].id = i;
|
||||
}
|
||||
}
|
||||
|
||||
/** Loads default cache layers. */
|
||||
public static void init(){
|
||||
add(
|
||||
addLast(
|
||||
water = new ShaderLayer(Shaders.water),
|
||||
mud = new ShaderLayer(Shaders.mud),
|
||||
tar = new ShaderLayer(Shaders.tar),
|
||||
|
||||
Reference in New Issue
Block a user