over 10k less objects per second
This commit is contained in:
parent
6d1130d2c3
commit
f25786635b
@ -39,6 +39,8 @@ import java.util.*;
|
|||||||
*/
|
*/
|
||||||
public final class ChunkPacker {
|
public final class ChunkPacker {
|
||||||
|
|
||||||
|
private static final Map<String, Block> resourceCache = new HashMap<>();
|
||||||
|
|
||||||
private ChunkPacker() {}
|
private ChunkPacker() {}
|
||||||
|
|
||||||
public static CachedChunk pack(Chunk chunk) {
|
public static CachedChunk pack(Chunk chunk) {
|
||||||
@ -120,7 +122,7 @@ public final class ChunkPacker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Block stringToBlock(String name) {
|
public static Block stringToBlock(String name) {
|
||||||
return Block.getBlockFromName(name.contains(":") ? name : "minecraft:" + name);
|
return resourceCache.computeIfAbsent(name, n -> Block.getBlockFromName(n.contains(":") ? n : "minecraft:" + n));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static PathingBlockType getPathingBlockType(IBlockState state) {
|
private static PathingBlockType getPathingBlockType(IBlockState state) {
|
||||||
|
Loading…
Reference in New Issue
Block a user