mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-27 02:59:06 +00:00
Optimizations
This commit is contained in:
@@ -30,7 +30,7 @@ public class Chunk {
|
||||
private int[] biomes;
|
||||
private CompoundTag heightMaps;
|
||||
private CompoundTag carvingMasks;
|
||||
private Section[] sections = new Section[16]; //always initialized with size = 16 for fast access
|
||||
private final Section[] sections = new Section[16];
|
||||
private ListTag<CompoundTag> entities;
|
||||
private ListTag<CompoundTag> tileEntities;
|
||||
private ListTag<CompoundTag> tileTicks;
|
||||
|
||||
@@ -63,6 +63,11 @@ public class MCAFile {
|
||||
}
|
||||
}
|
||||
|
||||
public Chunk[] getChunks()
|
||||
{
|
||||
return chunks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls {@link MCAFile#serialize(RandomAccessFile, boolean)} without updating any timestamps.
|
||||
* @see MCAFile#serialize(RandomAccessFile, boolean)
|
||||
|
||||
@@ -1,19 +1,24 @@
|
||||
package net.querz.mca;
|
||||
|
||||
import static net.querz.mca.LoadFlags.*;
|
||||
import io.timeandspace.smoothie.OptimizationObjective;
|
||||
import io.timeandspace.smoothie.SmoothieMap;
|
||||
import net.querz.nbt.tag.ByteArrayTag;
|
||||
import net.querz.nbt.tag.CompoundTag;
|
||||
import net.querz.nbt.tag.ListTag;
|
||||
import net.querz.nbt.tag.LongArrayTag;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static net.querz.mca.LoadFlags.*;
|
||||
|
||||
public class Section {
|
||||
|
||||
private CompoundTag data;
|
||||
private Map<String, List<PaletteIndex>> valueIndexedPalette = new HashMap<>();
|
||||
private Map<String, List<PaletteIndex>> valueIndexedPalette = SmoothieMap.<String, List<PaletteIndex>>newBuilder()
|
||||
.optimizeFor(OptimizationObjective.FOOTPRINT).build();
|
||||
private ListTag<CompoundTag> palette;
|
||||
private byte[] blockLight;
|
||||
private long[] blockStates;
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
package net.querz.nbt.tag;
|
||||
|
||||
import com.volmit.iris.util.KMap;
|
||||
import net.querz.io.MaxDepthIO;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
public class CompoundTag extends Tag<Map<String, Tag<?>>> implements Iterable<Map.Entry<String, Tag<?>>>, Comparable<CompoundTag>, MaxDepthIO {
|
||||
@@ -24,7 +20,7 @@ public class CompoundTag extends Tag<Map<String, Tag<?>>> implements Iterable<Ma
|
||||
}
|
||||
|
||||
private static Map<String, Tag<?>> createEmptyValue() {
|
||||
return new HashMap<>(8);
|
||||
return new KMap<>();
|
||||
}
|
||||
|
||||
public int size() {
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
package net.querz.nbt.tag;
|
||||
|
||||
import com.volmit.iris.util.KList;
|
||||
import net.querz.io.MaxDepthIO;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
@@ -52,10 +48,10 @@ public class ListTag<T extends Tag<?>> extends Tag<List<T>> implements Iterable<
|
||||
*
|
||||
* @param <T> Type of the list elements
|
||||
* @param initialCapacity The initial capacity of the returned List
|
||||
* @return An instance of {@link java.util.List} with an initial capacity of 3
|
||||
* @return An instance of {@link List} with an initial capacity of 3
|
||||
* */
|
||||
private static <T> List<T> createEmptyValue(int initialCapacity) {
|
||||
return new ArrayList<>(initialCapacity);
|
||||
return new KList<>(initialCapacity);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user