Reorganize all the classes and move them around to make more sense and be easier to navigate. Also removed/unwrapped the 'a7' temp package.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package com.seibel.lod.api;
|
||||
|
||||
import com.seibel.lod.core.ModInfo;
|
||||
import com.seibel.lod.core.a7.datatype.full.FullDataSource;
|
||||
import com.seibel.lod.core.datatype.full.FullDataSource;
|
||||
|
||||
/**
|
||||
* This holds API methods related to version numbers and other unchanging endpoints.
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
package com.seibel.lod.api.items.interfaces.override;
|
||||
|
||||
import com.seibel.lod.core.api.external.coreImplementations.interfaces.override.ICoreDhApiOverrideable;
|
||||
import com.seibel.lod.core.handlers.dependencyInjection.IBindable;
|
||||
import com.seibel.lod.core.handlers.dependencyInjection.OverrideInjector;
|
||||
import com.seibel.lod.core.dependencyInjection.IBindable;
|
||||
import com.seibel.lod.core.dependencyInjection.OverrideInjector;
|
||||
|
||||
/**
|
||||
* Implemented by all DhApi objects that can be overridden.
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
package com.seibel.lod.api.items.objects.math;
|
||||
|
||||
import com.seibel.lod.core.objects.math.Mat4f;
|
||||
import com.seibel.lod.core.util.math.Mat4f;
|
||||
|
||||
/**
|
||||
* A simple way to store a 4x4 array
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.seibel.lod.api.methods.events;
|
||||
|
||||
import com.seibel.lod.api.items.objects.DhApiResult;
|
||||
import com.seibel.lod.core.api.external.coreImplementations.interfaces.events.ICoreDhApiEvent;
|
||||
import com.seibel.lod.core.handlers.dependencyInjection.DhApiEventInjector;
|
||||
import com.seibel.lod.core.dependencyInjection.DhApiEventInjector;
|
||||
|
||||
/**
|
||||
* Handles adding/removing event handlers.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.seibel.lod.api.methods.events.interfaces;
|
||||
|
||||
import com.seibel.lod.core.api.external.coreImplementations.interfaces.events.ICoreDhApiEvent;
|
||||
import com.seibel.lod.core.handlers.dependencyInjection.IBindable;
|
||||
import com.seibel.lod.core.dependencyInjection.IBindable;
|
||||
|
||||
/**
|
||||
* A combination of all interfaces required by all
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ package com.seibel.lod.api.override;
|
||||
import com.seibel.lod.api.items.interfaces.world.IDhApiLevelWrapper;
|
||||
import com.seibel.lod.api.items.objects.DhApiResult;
|
||||
import com.seibel.lod.core.api.external.coreImplementations.interfaces.override.worldGenerator.ICoreDhApiWorldGenerator;
|
||||
import com.seibel.lod.core.handlers.dependencyInjection.WorldGeneratorInjector;
|
||||
import com.seibel.lod.core.dependencyInjection.WorldGeneratorInjector;
|
||||
|
||||
/**
|
||||
* Handles adding world generator overrides.
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
package tests;
|
||||
|
||||
import com.seibel.lod.core.api.external.coreImplementations.objects.events.abstractEvents.CoreDhApiTestEvent;
|
||||
import com.seibel.lod.core.handlers.dependencyInjection.*;
|
||||
import com.seibel.lod.core.dependencyInjection.DhApiEventInjector;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import testItems.events.abstractObjects.DhApiTestEvent;
|
||||
import testItems.events.objects.DhTestEvent;
|
||||
import testItems.events.objects.DhTestEventAlt;
|
||||
|
||||
+2
-2
@@ -17,10 +17,10 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.lod.core.handlers;
|
||||
package com.seibel.lod.core;
|
||||
|
||||
import com.seibel.lod.core.enums.rendering.EFogDrawMode;
|
||||
import com.seibel.lod.core.handlers.dependencyInjection.IBindable;
|
||||
import com.seibel.lod.core.dependencyInjection.IBindable;
|
||||
|
||||
/**
|
||||
* A singleton used to get variables from methods
|
||||
+4
-4
@@ -1,8 +1,8 @@
|
||||
package com.seibel.lod.core.a7;
|
||||
package com.seibel.lod.core;
|
||||
|
||||
import com.seibel.lod.core.a7.datatype.column.ColumnRenderLoader;
|
||||
import com.seibel.lod.core.a7.datatype.full.FullDataLoader;
|
||||
import com.seibel.lod.core.a7.datatype.full.SparseDataLoader;
|
||||
import com.seibel.lod.core.datatype.column.ColumnRenderLoader;
|
||||
import com.seibel.lod.core.datatype.full.FullDataLoader;
|
||||
import com.seibel.lod.core.datatype.full.SparseDataLoader;
|
||||
|
||||
public class Initializer {
|
||||
public static void init() {
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.lod.core.objects;
|
||||
package com.seibel.lod.core;
|
||||
|
||||
|
||||
/**
|
||||
+2
-2
@@ -17,12 +17,12 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.lod.core.handlers;
|
||||
package com.seibel.lod.core;
|
||||
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import com.seibel.lod.core.handlers.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.lod.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.lod.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -1,5 +0,0 @@
|
||||
package com.seibel.lod.core.a7.util;
|
||||
|
||||
public interface CombinableResult<T> {
|
||||
T combineWith(T b, T c, T d);
|
||||
}
|
||||
-347
@@ -1,347 +0,0 @@
|
||||
package com.seibel.lod.core.a7.util;
|
||||
|
||||
import com.seibel.lod.core.a7.pos.DhLodPos;
|
||||
import com.seibel.lod.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.lod.core.util.Atomics;
|
||||
import com.seibel.lod.core.util.LodUtil;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.concurrent.atomic.AtomicReferenceArray;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class ConcurrentQuadCombinableProviderTree<R extends CombinableResult<R>> {
|
||||
private static final Logger LOGGER = DhLoggerBuilder.getLogger();
|
||||
public static class Node<R> {
|
||||
private final DhLodPos pos;
|
||||
public final AtomicReference<CompletableFuture<R>> future;
|
||||
// The child node is stored as a weak reference so that it can be garbage collected when that node's future is completed
|
||||
// and which then releases the hold on that node, thus allowing automatic garbage collection.
|
||||
public final AtomicReferenceArray<WeakReference<Node<R>>> children = new AtomicReferenceArray<>(4);
|
||||
@SuppressWarnings("unused")
|
||||
AtomicReference<Node<R>> parent = null; // This is only used to ensure that the parent is not garbage collected before the child.
|
||||
private Node(DhLodPos pos, CompletableFuture<R> future) {
|
||||
this.pos = pos;
|
||||
this.future = new AtomicReference<>(future);
|
||||
}
|
||||
private Node(DhLodPos pos, CompletableFuture<R> future, Node<R> parent) {
|
||||
this.pos = pos;
|
||||
this.future = new AtomicReference<>(future);
|
||||
this.parent = new AtomicReference<>(parent);
|
||||
}
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
Node<R> node = (Node<R>) o;
|
||||
return pos.equals(node.pos);
|
||||
}
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return pos.hashCode();
|
||||
}
|
||||
public Node<R> setIfNullAndGet(int childIndex, Node<R> newChild) {
|
||||
WeakReference<Node<R>> newRef = new WeakReference<>(newChild);
|
||||
WeakReference<Node<R>> oldRef;
|
||||
do {
|
||||
oldRef = Atomics.compareAndExchange(children, childIndex, null, newRef);
|
||||
if (oldRef == null) return newChild; // CompareAndExchange succeeded
|
||||
Node<R> oldNode = oldRef.get();
|
||||
if (oldNode != null) return oldNode; // CompareAndExchange failed with old node not null
|
||||
// Otherwise, the old node weak reference is null.
|
||||
} while (!children.compareAndSet(childIndex, oldRef, newRef)); // If this cas fails, then try again. (Some other thread beat us to it.)
|
||||
return newChild; // If we get here, then we successfully replaced the old node weak reference with the new one.
|
||||
}
|
||||
}
|
||||
|
||||
static class RootMap<R> {
|
||||
private final ConcurrentHashMap<DhLodPos, WeakReference<Node<R>>> roots = new ConcurrentHashMap<>();
|
||||
private final int topLevel;
|
||||
|
||||
RootMap(int topLevel) {
|
||||
this.topLevel = topLevel;
|
||||
}
|
||||
|
||||
public int getTopLevel() {
|
||||
return topLevel;
|
||||
}
|
||||
public Node<R> get(DhLodPos pos) {
|
||||
WeakReference<Node<R>> ref = roots.get(pos);
|
||||
return ref == null ? null : ref.get();
|
||||
}
|
||||
public Node<R> compareNullAndExchange(DhLodPos pos, Node<R> newRoot) {
|
||||
WeakReference<Node<R>> newRef = new WeakReference<>(newRoot);
|
||||
WeakReference<Node<R>> oldRef;
|
||||
do {
|
||||
oldRef = roots.putIfAbsent(pos, newRef);
|
||||
if (oldRef == null) return null; // putIfAbsent succeeded
|
||||
Node<R> oldRoot = oldRef.get();
|
||||
if (oldRoot != null) return oldRoot; // putIfAbsent failed with old root not null
|
||||
// Otherwise, the old root weak reference is null.
|
||||
} while (!roots.replace(pos, oldRef, newRef)); // If this cas fails, then try again. (Some other thread beat us to it.)
|
||||
return null; // If we get here, then we successfully replaced the old root weak reference with the new one, so return null.
|
||||
}
|
||||
public boolean compareNullAndSet(DhLodPos pos, Node<R> newRoot) {
|
||||
WeakReference<Node<R>> newRef = new WeakReference<>(newRoot);
|
||||
WeakReference<Node<R>> oldRef;
|
||||
do {
|
||||
oldRef = roots.putIfAbsent(pos, newRef);
|
||||
if (oldRef == null) return true; // putIfAbsent succeeded
|
||||
Node<R> oldRoot = oldRef.get();
|
||||
if (oldRoot != null) return false; // putIfAbsent failed with old root not null
|
||||
// Otherwise, the old root weak reference is null.
|
||||
} while (!roots.replace(pos, oldRef, newRef)); // If this cas fails, then try again. (Some other thread beat us to it.)
|
||||
return true; // If we get here, then we successfully replaced the old root weak reference with the new one.
|
||||
}
|
||||
public Node<R> setIfNullAndGet(DhLodPos pos, Node<R> newRoot) {
|
||||
WeakReference<Node<R>> newRef = new WeakReference<>(newRoot);
|
||||
WeakReference<Node<R>> oldRef;
|
||||
do {
|
||||
oldRef = roots.putIfAbsent(pos, newRef);
|
||||
if (oldRef == null) return newRoot; // putIfAbsent succeeded
|
||||
Node<R> oldRoot = oldRef.get();
|
||||
if (oldRoot != null) return oldRoot; // putIfAbsent failed with old root not null
|
||||
// Otherwise, the old root weak reference is null.
|
||||
} while (!roots.replace(pos, oldRef, newRef)); // If this cas fails, then try again. (Some other thread beat us to it.)
|
||||
return newRoot; // If we get here, then we successfully replaced the old root weak reference with the new one.
|
||||
}
|
||||
public void clean() {
|
||||
roots.forEach((k,v) -> {
|
||||
if (v.get() == null) // Remove the entry if the root is null
|
||||
roots.remove(k, v); // But only if what we check is what we will be removing. (A CAS operation)
|
||||
// Otherwise, continue.
|
||||
// (It is not important that we must remove the entry if the root is null,
|
||||
// as this is just a cleanup op to shrink the map.)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private final ReentrantReadWriteLock rootMapGlobalLock = new ReentrantReadWriteLock();
|
||||
private final AtomicReference<RootMap<R>> rootMap = new AtomicReference<>(new RootMap<>(0));
|
||||
|
||||
|
||||
public ConcurrentQuadCombinableProviderTree() {}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CQCPT@" + rootMap.get().topLevel + "(~" + rootMap.get().roots.size() + ")";
|
||||
}
|
||||
|
||||
// Atomically update and get the generation future
|
||||
private CompletableFuture<R> checkAndMakeFuture(Node<R> node, Function<DhLodPos, CompletableFuture<R>> allNullCompleter) {
|
||||
CompletableFuture<R> future = new CompletableFuture<>();
|
||||
CompletableFuture<R> casValue = Atomics.compareAndExchange(node.future, null, future);
|
||||
if (casValue != null) { // cas failed. Existing future. Return it.
|
||||
return casValue;
|
||||
}
|
||||
|
||||
// Next, we need to make the future completable.
|
||||
// We first check for each child connection if it exists. If it does, we store it for a later 'allOf'.
|
||||
boolean allNull = true;
|
||||
@SuppressWarnings("unchecked")
|
||||
CompletableFuture<R>[] childFutures = new CompletableFuture[4];
|
||||
for (int i = 0; i < 4; i++) {
|
||||
WeakReference<Node<R>> childRef = node.children.get(i);
|
||||
Node<R> nextChild = childRef == null ? null : childRef.get();
|
||||
if (nextChild != null) { // child node exists. Recursively make or get the child's future.
|
||||
allNull = false;
|
||||
childFutures[i] = checkAndMakeFuture(nextChild, allNullCompleter);
|
||||
}
|
||||
}
|
||||
if (allNull) { // all children are null. We can then just run the allNullCompleter in this node.
|
||||
allNullCompleter.apply(node.pos).whenComplete((r, e) -> {
|
||||
// NOTE(*1): This *HAVE* to get the future via the node reference instead of directly capturing the future,
|
||||
// as otherwise the node will be garbage collected before the future is completed.
|
||||
// With this, we can guarantee that the node is garbage collected only when the future is (being) completed.
|
||||
// (The actual order is not important however as long as the node is still alive when the generation is in progress)
|
||||
CompletableFuture<R> f = node.future.get();
|
||||
LodUtil.assertTrue(f != null, "Future should not be null");
|
||||
if (e != null) {
|
||||
f.completeExceptionally(e);
|
||||
} else {
|
||||
f.complete(r);
|
||||
}
|
||||
});
|
||||
} else { // some children exist. We need to wait for some or all of them to complete.
|
||||
// But before that, we need to create the children node where they are missing.
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (childFutures[i] == null) {
|
||||
CompletableFuture<R> newChildFuture = new CompletableFuture<>();
|
||||
Node<R> newChild = new Node<>(node.pos.getChild(i), newChildFuture, node);
|
||||
node.children.set(i, new WeakReference<>(newChild));
|
||||
childFutures[i] = newChildFuture;
|
||||
// Since the child is new, we can be sure that it doesn't have any children.
|
||||
// So, we need to make the new child's future completable by running the allNullCompleter.
|
||||
// (The above relies on the fact that we did a CAS on the beginning of this method,
|
||||
// which means that we have unique access to the node and its links to the children, and that
|
||||
// no other thread can be concurrently modifying its links)
|
||||
allNullCompleter.apply(newChild.pos).whenComplete((r, e) -> {
|
||||
// NOTE: Same as 'NOTE(*1)', we *HAVE* to get the future via the node reference instead of directly capturing the future.
|
||||
CompletableFuture<R> f = newChild.future.get();
|
||||
LodUtil.assertTrue(f != null, "Future should not be null");
|
||||
if (e != null) {
|
||||
f.completeExceptionally(e);
|
||||
} else {
|
||||
f.complete(r);
|
||||
}
|
||||
});
|
||||
}
|
||||
LodUtil.assertTrue(childFutures[i] != null);
|
||||
}
|
||||
// Now, we can wait for all the child futures to complete, and then complete this node's future with
|
||||
// the combined result of all child futures.
|
||||
CompletableFuture.allOf(childFutures).handle((v, e) -> {
|
||||
// NOTE: Same as 'NOTE(*1)', we *HAVE* to get the future via the node reference instead of directly capturing the future.
|
||||
CompletableFuture<R> f = node.future.get();
|
||||
LodUtil.assertTrue(f != null, "Future should not be null");
|
||||
if (e != null) {
|
||||
f.completeExceptionally(e);
|
||||
} else {
|
||||
try {
|
||||
f.complete(childFutures[0].join().combineWith(
|
||||
childFutures[1].join(), childFutures[2].join(), childFutures[3].join()));
|
||||
} catch (Throwable e2) {
|
||||
f.completeExceptionally(e2);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
});
|
||||
}
|
||||
return future;
|
||||
}
|
||||
|
||||
public CompletableFuture<R> createOrUseExisting(DhLodPos pos, Function<DhLodPos, CompletableFuture<R>> completer) {
|
||||
LOGGER.info("Creating or using existing future for {}", pos);
|
||||
int cleanRng = ThreadLocalRandom.current().nextInt(0, 10);
|
||||
if (cleanRng == 0) cleanIfNeeded();
|
||||
// First, ensure that the root map is locked for reading. (The lock is for the structure of the map, not the values)
|
||||
rootMapGlobalLock.readLock().lock();
|
||||
RootMap<R> map = rootMap.get();
|
||||
// Next, do different thing depending on the top level of the map compared to the target position.
|
||||
if (map.topLevel == pos.detail) { // The target position is at the top level, meaning that we can directly use the root.
|
||||
// Make the future and node first for the later CAS on null.
|
||||
CompletableFuture<R> future = new CompletableFuture<>();
|
||||
Node<R> newNode = new Node<R>(pos, future); // No parent node as it's the root.
|
||||
Node<R> cas = map.compareNullAndExchange(pos, newNode); // CAS the node into the map.
|
||||
rootMapGlobalLock.readLock().unlock(); // We're done with the map, as following code no longer accesses it.
|
||||
|
||||
if (cas == null) { // cas succeeded. Which means no existing overlapping node in same detail level.
|
||||
// Reason: Since any lower level nodes should have upper level nodes as parent up to the top level,
|
||||
// and that there are no same level nodes, we can assume that the new node does not overlap any existing nodes.
|
||||
// Therefore, we can apply the completer function to the new node, and return the future.
|
||||
completer.apply(pos).whenComplete((r, e) -> {
|
||||
// See NOTE(*1) above.
|
||||
CompletableFuture<R> f = newNode.future.get();
|
||||
LodUtil.assertTrue(f != null, "Future should not be null");
|
||||
if (e != null) {
|
||||
f.completeExceptionally(e);
|
||||
} else {
|
||||
f.complete(r);
|
||||
}
|
||||
});
|
||||
return future;
|
||||
} else { // cas failed. Existing overlapping node.
|
||||
// Run the checkAndMakeFuture method on the existing node to update and get the generation future.
|
||||
return checkAndMakeFuture(cas, completer);
|
||||
}
|
||||
} else if (map.topLevel > pos.detail) {
|
||||
// We need to traverse down the tree with the following rules during the traversal:
|
||||
// 1. If the next node is not null and has a future, halt and return that future.
|
||||
// 2. If the next node is not null with no future, continue traversing down the tree.
|
||||
// 3. if the next node is null, create a new node and CompareExchange it into the current node, and run rule 1/2.
|
||||
// Note that DO NOT assume that all subsequent nodes will fall into case 3, as someone else can concurrently
|
||||
// use and modify the newly created node!
|
||||
|
||||
// To start, just treat the rootMap as the... well, root, and it's content as the children node.
|
||||
// We can then traverse down the tree until we reach the target node or hit the 1st case and return prematurely.
|
||||
|
||||
// First iteration:
|
||||
Node<R> currentNode;
|
||||
DhLodPos childPos = pos.convertUpwardsTo((byte) map.topLevel);
|
||||
Node<R> childNode = map.setIfNullAndGet( // rule 3: if null, create a new node.
|
||||
childPos, new Node<R>(childPos, null)); // No parent node as it's the root.
|
||||
rootMapGlobalLock.readLock().unlock(); // We're done with the map, as following code no longer accesses it.
|
||||
|
||||
CompletableFuture<R> future = childNode.future.get();
|
||||
if (future != null) { // rule 1: if future is not null, halt and return the future.
|
||||
return future;
|
||||
} else { // rule 2: if future is null, continue traversing down the tree.
|
||||
currentNode = childNode;
|
||||
|
||||
// Second and subsequent iterations:
|
||||
while (currentNode.pos.detail > pos.detail) {
|
||||
childPos = pos.convertUpwardsTo((byte) (currentNode.pos.detail - 1));
|
||||
// Note: It is important that child link is set and created before we check the child future,
|
||||
// so to avoid race conditions with checkAndMakeFuture.
|
||||
childNode = currentNode.setIfNullAndGet(childPos.getChildIndexOfParent(),
|
||||
new Node<R>(childPos, null, currentNode)); // rule 3: if null, create a new node.
|
||||
CompletableFuture<R> childFuture = childNode.future.get();
|
||||
if (childFuture != null) { // rule 1: if future is not null, halt and return the future.
|
||||
return childFuture;
|
||||
} else { // rule 2: if future is null, continue traversing down the tree.
|
||||
currentNode = childNode;
|
||||
}
|
||||
}
|
||||
}
|
||||
// At this point, we have reached the target node.
|
||||
LodUtil.assertTrue(currentNode.pos.equals(pos));
|
||||
// We can now run the checkAndMakeFuture method on the target node to update and get the generation future.
|
||||
return checkAndMakeFuture(currentNode, completer); // Technically, this will rerun the 1st rule. But code is cleaner this way.
|
||||
} else { // map.topLevel < pos.detail
|
||||
// Now, this is the complex case. We need to rebase the tree to the higher detail level.
|
||||
// For now, this implementation will do a lock based version. However, I will figure out a way to do this without a lock.
|
||||
|
||||
rootMapGlobalLock.readLock().unlock();
|
||||
while (map.topLevel < pos.detail) {
|
||||
map = rebaseUpward(pos.detail);
|
||||
}
|
||||
LodUtil.assertTrue(map.topLevel >= pos.detail);
|
||||
return createOrUseExisting(pos, completer); // After rebasing, we can just call the createOrUseExisting method again.
|
||||
}
|
||||
}
|
||||
|
||||
private RootMap<R> rebaseUpward(int targetLevel) {
|
||||
rootMapGlobalLock.writeLock().lock();
|
||||
try {
|
||||
RootMap<R> map = rootMap.get();
|
||||
if (map.topLevel >= targetLevel) {
|
||||
return map;
|
||||
}
|
||||
// At this point, we have exclusive access to the rootMap.
|
||||
map.clean(); // Clean the map. (Could actually be done with just readLock.)
|
||||
RootMap<R> newMap = new RootMap<>(map.topLevel + 1);
|
||||
map.roots.forEach((pos, nodeRef) -> {
|
||||
Node<R> node = nodeRef.get();
|
||||
if (node == null) return; // If null, ignore that node.
|
||||
LodUtil.assertTrue(pos.detail+1 == newMap.topLevel);
|
||||
LodUtil.assertTrue(node.parent.get() == null);
|
||||
LodUtil.assertTrue(node.pos.equals(pos));
|
||||
DhLodPos newPos = pos.convertUpwardsTo((byte) (pos.detail+1));
|
||||
|
||||
// Create the parent node, or if it already exists, use it to set the child node's parent.
|
||||
// NOTE: While this section is protected by the rootMapGlobalLock, we still need to use the normal
|
||||
// CAS methods to setAndGet the parent node, as the parent node may be GC'd concurrently by other threads
|
||||
// who have just completed the node's future, and caused the GC parent chain up to the new map.
|
||||
Node<R> newParentNode = newMap.setIfNullAndGet(newPos, new Node<R>(newPos, null));
|
||||
node.parent.set(newParentNode);
|
||||
});
|
||||
boolean casWorked = rootMap.compareAndSet(map, newMap);
|
||||
LodUtil.assertTrue(casWorked);
|
||||
return newMap;
|
||||
} finally {
|
||||
rootMapGlobalLock.writeLock().unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public void cleanIfNeeded() {
|
||||
if (rootMapGlobalLock.readLock().tryLock()) {
|
||||
rootMap.get().clean();
|
||||
rootMapGlobalLock.readLock().unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,514 +0,0 @@
|
||||
package com.seibel.lod.core.a7.util;
|
||||
|
||||
import com.seibel.lod.core.a7.pos.DhLodPos;
|
||||
import com.seibel.lod.core.util.LodUtil;
|
||||
import org.apache.commons.lang3.NotImplementedException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class LazySectionPosTree<T> implements ConcurrentMap<DhLodPos, T> {
|
||||
class Node implements Entry<DhLodPos, T> {
|
||||
private Node parent;
|
||||
private int child0to3;
|
||||
private final DhLodPos pos;
|
||||
private final AtomicInteger sizeCounter = size;
|
||||
private T value = null;
|
||||
private Node child0 = null;
|
||||
private Node child1 = null;
|
||||
private Node child2 = null;
|
||||
private Node child3 = null;
|
||||
private Node(Node parent, int child0to3, DhLodPos pos) {
|
||||
this.parent = parent;
|
||||
this.child0to3 = child0to3;
|
||||
this.pos = pos;
|
||||
}
|
||||
private Node(Node parent, int child0to3, DhLodPos pos, T value) {
|
||||
this.parent = parent;
|
||||
this.child0to3 = child0to3;
|
||||
this.pos = pos;
|
||||
this.value = value;
|
||||
}
|
||||
@Override
|
||||
public DhLodPos getKey() {
|
||||
return pos;
|
||||
}
|
||||
@Override
|
||||
public T getValue() {
|
||||
return value;
|
||||
}
|
||||
@Override
|
||||
public T setValue(T value) {
|
||||
T old = this.value;
|
||||
this.value = value;
|
||||
if (old == null && value != null) {
|
||||
sizeCounter.incrementAndGet();
|
||||
} else if (old != null && value == null) {
|
||||
sizeCounter.decrementAndGet();
|
||||
}
|
||||
return old;
|
||||
}
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
Node node = (Node) o;
|
||||
return pos.equals(node.pos);
|
||||
}
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return pos.hashCode();
|
||||
}
|
||||
private T setIfAbsent(T value) {
|
||||
T old = this.value;
|
||||
if (old == null) {
|
||||
this.value = value;
|
||||
sizeCounter.incrementAndGet();
|
||||
}
|
||||
return old;
|
||||
}
|
||||
private T computeIfAbsent(@NotNull Function<? super DhLodPos, ? extends T> mappingFunction) {
|
||||
if (value == null) {
|
||||
value = mappingFunction.apply(pos);
|
||||
sizeCounter.incrementAndGet();
|
||||
}
|
||||
return value;
|
||||
}
|
||||
private T computeIfPresent(@NotNull BiFunction<? super DhLodPos, ? super T, ? extends T> remappingFunction) {
|
||||
if (value != null) {
|
||||
T newValue = remappingFunction.apply(pos, value);
|
||||
if (newValue != null) {
|
||||
value = newValue;
|
||||
} else {
|
||||
sizeCounter.decrementAndGet();
|
||||
value = null;
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
private boolean noChildren() {
|
||||
return child0 == null && child1 == null && child2 == null && child3 == null;
|
||||
}
|
||||
|
||||
private Node makeOrGetChild(int child0to3) {
|
||||
LodUtil.assertTrue(child0to3 >= 0 && child0to3 <= 3);
|
||||
switch (child0to3) {
|
||||
case 0:
|
||||
return child0 == null ? child0 = new Node(this, 0, pos.getChild(0)) : child0;
|
||||
case 1:
|
||||
return child1 == null ? child1 = new Node(this, 1, pos.getChild(1)) : child1;
|
||||
case 2:
|
||||
return child2 == null ? child2 = new Node(this, 2, pos.getChild(2)) : child2;
|
||||
case 3:
|
||||
return child3 == null ? child3 = new Node(this, 3, pos.getChild(3)) : child3;
|
||||
}
|
||||
LodUtil.assertNotReach();
|
||||
return new Node(null, 0, pos.getChild(0)); // unreachable. Just hack to make contract happy.
|
||||
}
|
||||
private Node getChild(int child0to3) {
|
||||
LodUtil.assertTrue(child0to3 >= 0 && child0to3 <= 3);
|
||||
switch (child0to3) {
|
||||
case 0:
|
||||
return child0;
|
||||
case 1:
|
||||
return child1;
|
||||
case 2:
|
||||
return child2;
|
||||
case 3:
|
||||
return child3;
|
||||
}
|
||||
LodUtil.assertNotReach();
|
||||
return null;
|
||||
}
|
||||
private void removeChild(int child0to3) {
|
||||
LodUtil.assertTrue(child0to3 >= 0 && child0to3 <= 3);
|
||||
switch (child0to3) {
|
||||
case 0:
|
||||
child0 = null;
|
||||
break;
|
||||
case 1:
|
||||
child1 = null;
|
||||
break;
|
||||
case 2:
|
||||
child2 = null;
|
||||
break;
|
||||
case 3:
|
||||
child3 = null;
|
||||
break;
|
||||
}
|
||||
LodUtil.assertNotReach();
|
||||
}
|
||||
private void setChild(int child0to3, Node child) {
|
||||
LodUtil.assertTrue(child0to3 >= 0 && child0to3 <= 3);
|
||||
child.parent = this;
|
||||
switch (child0to3) {
|
||||
case 0:
|
||||
child0 = child;
|
||||
child.child0to3 = 0;
|
||||
break;
|
||||
case 1:
|
||||
child1 = child;
|
||||
child.child0to3 = 1;
|
||||
break;
|
||||
case 2:
|
||||
child2 = child;
|
||||
child.child0to3 = 2;
|
||||
break;
|
||||
case 3:
|
||||
child3 = child;
|
||||
child.child0to3 = 3;
|
||||
break;
|
||||
}
|
||||
LodUtil.assertNotReach();
|
||||
}
|
||||
}
|
||||
private ConcurrentSkipListMap<DhLodPos, Node> nodes = new ConcurrentSkipListMap<>();
|
||||
private byte topLevel = 0;
|
||||
private AtomicInteger size = new AtomicInteger(0);
|
||||
public LazySectionPosTree() {}
|
||||
@Override
|
||||
public int hashCode() {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
@Override
|
||||
protected Object clone() throws CloneNotSupportedException {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return size.get();
|
||||
}
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return size.get() == 0;
|
||||
}
|
||||
|
||||
private Node travel(Node from, DhLodPos pos) {
|
||||
if (from == null) return null;
|
||||
LodUtil.assertTrue(pos != null);
|
||||
LodUtil.assertTrue(from.pos.detail > pos.detail);
|
||||
LodUtil.assertTrue(from.pos.overlaps(pos));
|
||||
byte iterDetail = from.pos.detail;
|
||||
while (iterDetail > pos.detail) {
|
||||
from = from.getChild(pos.convertUpwardsTo(--iterDetail).getChildIndexOfParent());
|
||||
if (from == null) return null;
|
||||
}
|
||||
LodUtil.assertTrue(from.pos.equals(pos));
|
||||
return from;
|
||||
}
|
||||
private Node initTravel(Node from, DhLodPos pos) {
|
||||
LodUtil.assertTrue(from != null);
|
||||
LodUtil.assertTrue(pos != null);
|
||||
LodUtil.assertTrue(from.pos.detail > pos.detail);
|
||||
LodUtil.assertTrue(from.pos.overlaps(pos));
|
||||
byte iterDetail = from.pos.detail;
|
||||
while (iterDetail > pos.detail)
|
||||
from = from.makeOrGetChild(pos.convertUpwardsTo(--iterDetail).getChildIndexOfParent());
|
||||
LodUtil.assertTrue(from.pos.equals(pos));
|
||||
return from;
|
||||
}
|
||||
|
||||
private void upcastTreeBase() {
|
||||
|
||||
}
|
||||
private byte upcastSingeTreeBase() {
|
||||
byte nextLevel = (byte) (topLevel + 1);
|
||||
ConcurrentSkipListMap<DhLodPos, Node> newBase = new ConcurrentSkipListMap<>();
|
||||
nodes.forEach((pos, node) ->
|
||||
newBase.compute(pos.convertUpwardsTo(nextLevel), (key, old) -> {
|
||||
if (old == null) {
|
||||
old = new Node(null, 0, pos.convertUpwardsTo(nextLevel));
|
||||
}
|
||||
old.setChild(pos.getChildIndexOfParent(), node);
|
||||
return old;
|
||||
})
|
||||
);
|
||||
nodes = newBase; // todo: cas operation to here. (Will be block free but not wait free)
|
||||
topLevel = nextLevel; //todo: atomic???
|
||||
return nextLevel;
|
||||
}
|
||||
private void downcastTreeBase() {
|
||||
byte prevLevel = (byte) (topLevel - 1);
|
||||
ConcurrentSkipListMap<DhLodPos, Node> newBase = new ConcurrentSkipListMap<>();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean containsKey(Object key) {
|
||||
DhLodPos pos = (DhLodPos) key;
|
||||
if (pos.detail > topLevel) return false;
|
||||
if (pos.detail == topLevel) return nodes.containsKey(pos);
|
||||
Node node = travel(nodes.get(pos.convertUpwardsTo(topLevel)), pos);
|
||||
return node != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsValue(Object value) {
|
||||
throw new UnsupportedOperationException("Such operation is not supported in LazySectionPosTree");
|
||||
}
|
||||
|
||||
@Override
|
||||
public T get(Object key) {
|
||||
DhLodPos pos = (DhLodPos) key;
|
||||
if (pos.detail > topLevel) return null;
|
||||
if (pos.detail == topLevel) return nodes.get(pos).value;
|
||||
Node node = travel(nodes.get(pos.convertUpwardsTo(topLevel)), pos);
|
||||
return node == null ? null : node.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T getOrDefault(Object key, T defaultValue) {
|
||||
T value = get(key);
|
||||
return value == null ? defaultValue : value;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public T put(DhLodPos key, T value) {
|
||||
if (key.detail == topLevel) {
|
||||
return nodes.computeIfAbsent(key, k -> new Node(null, 0, key, value)).setValue(value);
|
||||
}
|
||||
if (key.detail < topLevel) {
|
||||
Node node = initTravel(nodes.get(key.convertUpwardsTo(topLevel)), key);
|
||||
return node.setValue(value);
|
||||
}
|
||||
// key.detail > topLevel:
|
||||
// Rebase the tree
|
||||
//upcastTreeBase(key.detail);
|
||||
return nodes.computeIfAbsent(key, k -> new Node(null, 0, key, value)).setValue(value);
|
||||
}
|
||||
|
||||
private void removeNode(Node node) {
|
||||
if (node.parent != null) {
|
||||
node.parent.removeChild(node.child0to3);
|
||||
if (node.parent.noChildren()) {
|
||||
removeNode(node.parent);
|
||||
}
|
||||
}
|
||||
else nodes.remove(node.pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T remove(Object key) {
|
||||
DhLodPos pos = (DhLodPos) key;
|
||||
if (pos.detail > topLevel) return null;
|
||||
Node node;
|
||||
if (pos.detail == topLevel) {
|
||||
node = nodes.remove(pos);
|
||||
} else {
|
||||
node = travel(nodes.get(pos.convertUpwardsTo(topLevel)), pos);
|
||||
}
|
||||
if (node == null) return null;
|
||||
// Pop the value
|
||||
T value = node.setValue(null);
|
||||
// Delete the node if there are no children
|
||||
if (node.noChildren()) {
|
||||
removeNode(node);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean remove(@NotNull Object key, Object value) {
|
||||
DhLodPos pos = (DhLodPos) key;
|
||||
if (pos.detail > topLevel) return false;
|
||||
Node node;
|
||||
if (pos.detail == topLevel) {
|
||||
node = nodes.get(pos);
|
||||
} else {
|
||||
node = travel(nodes.get(pos.convertUpwardsTo(topLevel)), pos);
|
||||
}
|
||||
if (node == null) return false;
|
||||
//TODO: Make this atomic
|
||||
if (node.value.equals(value)) {
|
||||
removeNode(node);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replace(@NotNull DhLodPos key, @NotNull T oldValue, @NotNull T newValue) {
|
||||
if (key.detail > topLevel) return false;
|
||||
Node node;
|
||||
if (key.detail == topLevel) {
|
||||
node = nodes.get(key);
|
||||
} else {
|
||||
node = travel(nodes.get(key.convertUpwardsTo(topLevel)), key);
|
||||
}
|
||||
if (node == null) return false;
|
||||
//TODO: Make this atomic
|
||||
if (node.value.equals(oldValue)) {
|
||||
node.setValue(newValue);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T replace(@NotNull DhLodPos key, @NotNull T value) {
|
||||
if (key.detail == topLevel) {
|
||||
Node n = nodes.get(key);
|
||||
//TODO: Make this atomic
|
||||
if (n == null || n.value==null) return null;
|
||||
return n.setValue(value);
|
||||
}
|
||||
if (key.detail < topLevel) {
|
||||
Node node = travel(nodes.get(key.convertUpwardsTo(topLevel)), key);
|
||||
//TODO: Make this atomic
|
||||
if (node == null || node.value==null) return null;
|
||||
return node.setValue(value);
|
||||
}
|
||||
// key.detail > topLevel: Does not exist
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public T putIfAbsent(@NotNull DhLodPos key, T value) {
|
||||
if (key.detail == topLevel) {
|
||||
return nodes.computeIfAbsent(key, k -> new Node(null, 0, key, null)).setIfAbsent(value);
|
||||
}
|
||||
if (key.detail < topLevel) {
|
||||
Node node = initTravel(nodes.get(key.convertUpwardsTo(topLevel)), key);
|
||||
return node.setIfAbsent(value);
|
||||
}
|
||||
// key.detail > topLevel:
|
||||
// Rebase the tree
|
||||
//upcastTreeBase(key.detail);
|
||||
return nodes.computeIfAbsent(key, k -> new Node(null, 0, key, null)).setIfAbsent(value);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public T computeIfAbsent(DhLodPos key, @NotNull Function<? super DhLodPos, ? extends T> mappingFunction) {
|
||||
if (key.detail == topLevel) {
|
||||
return nodes.computeIfAbsent(key, k -> new Node(null, 0, key, null)).computeIfAbsent(mappingFunction);
|
||||
}
|
||||
if (key.detail < topLevel) {
|
||||
Node node = initTravel(nodes.get(key.convertUpwardsTo(topLevel)), key);
|
||||
return node.computeIfAbsent(mappingFunction);
|
||||
}
|
||||
// key.detail > topLevel:
|
||||
// Rebase the tree
|
||||
//upcastTreeBase(key.detail);
|
||||
return nodes.computeIfAbsent(key, k -> new Node(null, 0, key, null)).computeIfAbsent(mappingFunction);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public T computeIfPresent(DhLodPos key, @NotNull BiFunction<? super DhLodPos, ? super T, ? extends T> remappingFunction) {
|
||||
if (key.detail == topLevel) {
|
||||
Node n = nodes.get(key);
|
||||
if (n == null) return null;
|
||||
T r = n.computeIfPresent(remappingFunction);
|
||||
if (r == null && n.noChildren()) {
|
||||
nodes.remove(key);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
if (key.detail < topLevel) {
|
||||
Node node = travel(nodes.get(key.convertUpwardsTo(topLevel)), key);
|
||||
if (node == null) return null;
|
||||
T r = node.computeIfPresent(remappingFunction);
|
||||
if (r == null && node.noChildren()) {
|
||||
removeNode(node);
|
||||
}
|
||||
}
|
||||
// key.detail > topLevel: Does not exist
|
||||
return null;
|
||||
}
|
||||
|
||||
// TODO: Improve this naive implementation of compute
|
||||
@Override
|
||||
public T compute(DhLodPos key, @NotNull BiFunction<? super DhLodPos, ? super T, ? extends T> remappingFunction) {
|
||||
T r = get(key);
|
||||
if (r == null) {
|
||||
r = remappingFunction.apply(key, null);
|
||||
if (r != null) {
|
||||
put(key, r);
|
||||
}
|
||||
} else {
|
||||
r = remappingFunction.apply(key, r);
|
||||
if (r != null) {
|
||||
put(key, r);
|
||||
} else {
|
||||
remove(key);
|
||||
}
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
// TODO: Optimize putAll
|
||||
@Override
|
||||
public void putAll(@NotNull Map<? extends DhLodPos, ? extends T> m) {
|
||||
for (Map.Entry<? extends DhLodPos, ? extends T> entry : m.entrySet()) {
|
||||
put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
nodes.clear();
|
||||
size = new AtomicInteger(0); // Do this to swap the counter obj so old nodes won't mess up the counter
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<DhLodPos> keySet() {
|
||||
//TODO
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<T> values() {
|
||||
//TODO
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<Entry<DhLodPos, T>> entrySet() {
|
||||
//TODO
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forEach(BiConsumer<? super DhLodPos, ? super T> action) {
|
||||
//TODO
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void replaceAll(BiFunction<? super DhLodPos, ? super T, ? extends T> function) {
|
||||
//TODO
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
// merge: Use default implementation
|
||||
//public T merge(DhLodPos key, @NotNull T value, @NotNull BiFunction<? super T, ? super T, ? extends T> remappingFunction);
|
||||
}
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package com.seibel.lod.core.api.external.coreImplementations.interfaces.events;
|
||||
|
||||
import com.seibel.lod.core.handlers.dependencyInjection.IBindable;
|
||||
import com.seibel.lod.core.dependencyInjection.IBindable;
|
||||
|
||||
/**
|
||||
* A combination of all interfaces required by all
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
package com.seibel.lod.core.api.external.coreImplementations.interfaces.override;
|
||||
|
||||
import com.seibel.lod.core.handlers.dependencyInjection.IBindable;
|
||||
import com.seibel.lod.core.handlers.dependencyInjection.OverrideInjector;
|
||||
import com.seibel.lod.core.dependencyInjection.IBindable;
|
||||
import com.seibel.lod.core.dependencyInjection.OverrideInjector;
|
||||
|
||||
/**
|
||||
* Implemented by all DhApi objects that can be overridden.
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package com.seibel.lod.core.api.external.coreImplementations.objects.events.sharedParameterObjects;
|
||||
|
||||
import com.seibel.lod.core.objects.math.Mat4f;
|
||||
import com.seibel.lod.core.util.math.Mat4f;
|
||||
|
||||
/**
|
||||
* Parameter passed into Render events.
|
||||
|
||||
+13
-11
@@ -17,26 +17,28 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.lod.core.api.internal.a7;
|
||||
package com.seibel.lod.core.api.internal;
|
||||
|
||||
import com.seibel.lod.core.a7.level.IClientLevel;
|
||||
import com.seibel.lod.core.a7.world.*;
|
||||
import com.seibel.lod.core.level.IClientLevel;
|
||||
import com.seibel.lod.core.api.external.coreImplementations.objects.events.abstractEvents.*;
|
||||
import com.seibel.lod.core.api.external.coreImplementations.objects.events.sharedParameterObjects.CoreDhApiRenderParam;
|
||||
import com.seibel.lod.core.api.external.coreImplementations.objects.wrappers.CoreDhApiLevelWrapper;
|
||||
import com.seibel.lod.core.config.Config;
|
||||
import com.seibel.lod.core.ModInfo;
|
||||
import com.seibel.lod.core.enums.rendering.EDebugMode;
|
||||
import com.seibel.lod.core.enums.rendering.ERendererMode;
|
||||
import com.seibel.lod.core.handlers.dependencyInjection.DhApiEventInjector;
|
||||
import com.seibel.lod.core.handlers.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.lod.core.dependencyInjection.DhApiEventInjector;
|
||||
import com.seibel.lod.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.lod.core.logging.ConfigBasedLogger;
|
||||
import com.seibel.lod.core.logging.ConfigBasedSpamLogger;
|
||||
import com.seibel.lod.core.logging.SpamReducedLogger;
|
||||
import com.seibel.lod.core.objects.math.Mat4f;
|
||||
import com.seibel.lod.core.render.GLProxy;
|
||||
import com.seibel.lod.core.render.RenderSystemTest;
|
||||
import com.seibel.lod.core.render.RenderUtil;
|
||||
import com.seibel.lod.core.util.math.Mat4f;
|
||||
import com.seibel.lod.core.render.glObject.GLProxy;
|
||||
import com.seibel.lod.core.render.renderer.TestRenderer;
|
||||
import com.seibel.lod.core.util.RenderUtil;
|
||||
import com.seibel.lod.core.world.DhClientWorld;
|
||||
import com.seibel.lod.core.world.DhWorld;
|
||||
import com.seibel.lod.core.world.IClientWorld;
|
||||
import com.seibel.lod.core.world.WorldEnvironment;
|
||||
import com.seibel.lod.core.wrapperInterfaces.chunk.IChunkWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftRenderWrapper;
|
||||
@@ -64,7 +66,7 @@ public class ClientApi
|
||||
public static boolean prefLoggerEnabled = false;
|
||||
|
||||
public static final ClientApi INSTANCE = new ClientApi();
|
||||
public static RenderSystemTest testRenderer = new RenderSystemTest();
|
||||
public static TestRenderer testRenderer = new TestRenderer();
|
||||
private static final IMinecraftClientWrapper MC = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class);
|
||||
private static final IMinecraftRenderWrapper MC_RENDER = SingletonInjector.INSTANCE.get(IMinecraftRenderWrapper.class);
|
||||
|
||||
+6
-6
@@ -17,13 +17,13 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.lod.core.api.internal.a7;
|
||||
package com.seibel.lod.core.api.internal;
|
||||
|
||||
import com.seibel.lod.core.a7.level.ILevel;
|
||||
import com.seibel.lod.core.a7.world.DhClientServerWorld;
|
||||
import com.seibel.lod.core.a7.world.DhServerWorld;
|
||||
import com.seibel.lod.core.a7.world.IServerWorld;
|
||||
import com.seibel.lod.core.handlers.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.lod.core.level.ILevel;
|
||||
import com.seibel.lod.core.world.DhClientServerWorld;
|
||||
import com.seibel.lod.core.world.DhServerWorld;
|
||||
import com.seibel.lod.core.world.IServerWorld;
|
||||
import com.seibel.lod.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.lod.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.lod.core.wrapperInterfaces.IVersionConstants;
|
||||
import com.seibel.lod.core.wrapperInterfaces.chunk.IChunkWrapper;
|
||||
+4
-6
@@ -1,11 +1,9 @@
|
||||
package com.seibel.lod.core.api.internal.a7;
|
||||
package com.seibel.lod.core.api.internal;
|
||||
|
||||
import com.seibel.lod.core.a7.Initializer;
|
||||
import com.seibel.lod.core.a7.world.WorldEnvironment;
|
||||
import com.seibel.lod.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.lod.core.a7.world.DhWorld;
|
||||
import com.seibel.lod.core.Initializer;
|
||||
import com.seibel.lod.core.world.WorldEnvironment;
|
||||
import com.seibel.lod.core.world.DhWorld;
|
||||
import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftSharedWrapper;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
public class SharedApi
|
||||
{
|
||||
@@ -1,18 +1,13 @@
|
||||
package com.seibel.lod.core.config.file;
|
||||
|
||||
import com.electronwill.nightconfig.core.file.CommentedFileConfig;
|
||||
import com.seibel.lod.core.ModInfo;
|
||||
import com.seibel.lod.core.config.ConfigBase;
|
||||
import com.seibel.lod.core.config.types.AbstractConfigType;
|
||||
import com.seibel.lod.core.config.types.ConfigEntry;
|
||||
import com.seibel.lod.core.handlers.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.lod.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftSharedWrapper;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
import org.json.simple.parser.ParseException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.seibel.lod.core.config.gui;
|
||||
|
||||
import com.seibel.lod.core.enums.config.EGpuUploadMethod;
|
||||
import com.seibel.lod.core.render.GLProxy;
|
||||
import com.seibel.lod.core.render.objects.GLState;
|
||||
import com.seibel.lod.core.render.objects.GLVertexBuffer;
|
||||
import com.seibel.lod.core.render.objects.ShaderProgram;
|
||||
import com.seibel.lod.core.render.objects.VertexAttribute;
|
||||
import com.seibel.lod.core.render.glObject.GLProxy;
|
||||
import com.seibel.lod.core.render.glObject.GLState;
|
||||
import com.seibel.lod.core.render.glObject.buffer.GLVertexBuffer;
|
||||
import com.seibel.lod.core.render.glObject.shader.ShaderProgram;
|
||||
import com.seibel.lod.core.render.glObject.vertexAttribute.VertexAttribute;
|
||||
import org.lwjgl.opengl.GL32;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
package com.seibel.lod.core.a7.datatype;
|
||||
package com.seibel.lod.core.datatype;
|
||||
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.seibel.lod.core.a7.level.ILevel;
|
||||
import com.seibel.lod.core.a7.save.io.file.DataMetaFile;
|
||||
import com.seibel.lod.core.level.ILevel;
|
||||
import com.seibel.lod.core.io.datafile.DataMetaFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
+5
-5
@@ -1,9 +1,9 @@
|
||||
package com.seibel.lod.core.a7.datatype;
|
||||
package com.seibel.lod.core.datatype;
|
||||
|
||||
import com.seibel.lod.core.a7.datatype.full.ChunkSizedData;
|
||||
import com.seibel.lod.core.a7.level.ILevel;
|
||||
import com.seibel.lod.core.a7.pos.DhSectionPos;
|
||||
import com.seibel.lod.core.a7.save.io.file.DataMetaFile;
|
||||
import com.seibel.lod.core.datatype.full.ChunkSizedData;
|
||||
import com.seibel.lod.core.level.ILevel;
|
||||
import com.seibel.lod.core.pos.DhSectionPos;
|
||||
import com.seibel.lod.core.io.datafile.DataMetaFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
+7
-8
@@ -1,12 +1,11 @@
|
||||
package com.seibel.lod.core.a7.datatype;
|
||||
package com.seibel.lod.core.datatype;
|
||||
|
||||
import com.seibel.lod.core.a7.datatype.full.ChunkSizedData;
|
||||
import com.seibel.lod.core.a7.level.IClientLevel;
|
||||
import com.seibel.lod.core.a7.level.ILevel;
|
||||
import com.seibel.lod.core.a7.pos.DhSectionPos;
|
||||
import com.seibel.lod.core.a7.render.LodQuadTree;
|
||||
import com.seibel.lod.core.a7.render.RenderBuffer;
|
||||
import com.seibel.lod.core.a7.save.io.render.RenderMetaFile;
|
||||
import com.seibel.lod.core.datatype.full.ChunkSizedData;
|
||||
import com.seibel.lod.core.level.IClientLevel;
|
||||
import com.seibel.lod.core.pos.DhSectionPos;
|
||||
import com.seibel.lod.core.render.LodQuadTree;
|
||||
import com.seibel.lod.core.render.RenderBuffer;
|
||||
import com.seibel.lod.core.io.renderfile.RenderMetaFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
+7
-7
@@ -1,11 +1,11 @@
|
||||
package com.seibel.lod.core.a7.datatype;
|
||||
package com.seibel.lod.core.datatype;
|
||||
|
||||
import com.seibel.lod.core.a7.datatype.full.ChunkSizedData;
|
||||
import com.seibel.lod.core.a7.level.IClientLevel;
|
||||
import com.seibel.lod.core.a7.pos.DhSectionPos;
|
||||
import com.seibel.lod.core.a7.render.LodQuadTree;
|
||||
import com.seibel.lod.core.a7.render.RenderBuffer;
|
||||
import com.seibel.lod.core.a7.save.io.render.RenderMetaFile;
|
||||
import com.seibel.lod.core.datatype.full.ChunkSizedData;
|
||||
import com.seibel.lod.core.level.IClientLevel;
|
||||
import com.seibel.lod.core.pos.DhSectionPos;
|
||||
import com.seibel.lod.core.render.LodQuadTree;
|
||||
import com.seibel.lod.core.render.RenderBuffer;
|
||||
import com.seibel.lod.core.io.renderfile.RenderMetaFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
+4
-4
@@ -1,9 +1,9 @@
|
||||
package com.seibel.lod.core.a7.datatype;
|
||||
package com.seibel.lod.core.datatype;
|
||||
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.seibel.lod.core.a7.level.IClientLevel;
|
||||
import com.seibel.lod.core.a7.level.ILevel;
|
||||
import com.seibel.lod.core.a7.save.io.render.RenderMetaFile;
|
||||
import com.seibel.lod.core.level.IClientLevel;
|
||||
import com.seibel.lod.core.level.ILevel;
|
||||
import com.seibel.lod.core.io.renderfile.RenderMetaFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
+10
-10
@@ -1,14 +1,14 @@
|
||||
package com.seibel.lod.core.a7.datatype.column;
|
||||
package com.seibel.lod.core.datatype.column;
|
||||
|
||||
import com.seibel.lod.core.a7.datatype.LodDataSource;
|
||||
import com.seibel.lod.core.a7.datatype.full.FullDataSource;
|
||||
import com.seibel.lod.core.a7.datatype.full.SparseDataSource;
|
||||
import com.seibel.lod.core.a7.datatype.transform.FullToColumnTransformer;
|
||||
import com.seibel.lod.core.a7.level.IClientLevel;
|
||||
import com.seibel.lod.core.a7.datatype.LodRenderSource;
|
||||
import com.seibel.lod.core.a7.datatype.RenderSourceLoader;
|
||||
import com.seibel.lod.core.a7.level.ILevel;
|
||||
import com.seibel.lod.core.a7.save.io.render.RenderMetaFile;
|
||||
import com.seibel.lod.core.datatype.LodDataSource;
|
||||
import com.seibel.lod.core.datatype.full.FullDataSource;
|
||||
import com.seibel.lod.core.datatype.full.SparseDataSource;
|
||||
import com.seibel.lod.core.datatype.transform.FullToColumnTransformer;
|
||||
import com.seibel.lod.core.level.IClientLevel;
|
||||
import com.seibel.lod.core.datatype.LodRenderSource;
|
||||
import com.seibel.lod.core.datatype.RenderSourceLoader;
|
||||
import com.seibel.lod.core.level.ILevel;
|
||||
import com.seibel.lod.core.io.renderfile.RenderMetaFile;
|
||||
import com.seibel.lod.core.util.LodUtil;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
+17
-17
@@ -1,21 +1,21 @@
|
||||
package com.seibel.lod.core.a7.datatype.column;
|
||||
package com.seibel.lod.core.datatype.column;
|
||||
|
||||
import com.seibel.lod.core.a7.datatype.column.accessor.*;
|
||||
import com.seibel.lod.core.a7.datatype.column.render.ColumnRenderBuffer;
|
||||
import com.seibel.lod.core.a7.datatype.full.ChunkSizedData;
|
||||
import com.seibel.lod.core.a7.datatype.transform.FullToColumnTransformer;
|
||||
import com.seibel.lod.core.a7.level.IClientLevel;
|
||||
import com.seibel.lod.core.a7.pos.DhSectionPos;
|
||||
import com.seibel.lod.core.a7.render.RenderBuffer;
|
||||
import com.seibel.lod.core.a7.render.a7LodRenderer;
|
||||
import com.seibel.lod.core.a7.save.io.render.RenderMetaFile;
|
||||
import com.seibel.lod.core.datatype.column.accessor.*;
|
||||
import com.seibel.lod.core.datatype.column.render.ColumnRenderBuffer;
|
||||
import com.seibel.lod.core.datatype.full.ChunkSizedData;
|
||||
import com.seibel.lod.core.datatype.transform.FullToColumnTransformer;
|
||||
import com.seibel.lod.core.level.IClientLevel;
|
||||
import com.seibel.lod.core.pos.DhSectionPos;
|
||||
import com.seibel.lod.core.render.RenderBuffer;
|
||||
import com.seibel.lod.core.render.renderer.LodRenderer;
|
||||
import com.seibel.lod.core.io.renderfile.RenderMetaFile;
|
||||
import com.seibel.lod.core.enums.ELodDirection;
|
||||
import com.seibel.lod.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.lod.core.a7.level.ILevel;
|
||||
import com.seibel.lod.core.a7.render.LodQuadTree;
|
||||
import com.seibel.lod.core.a7.render.LodRenderSection;
|
||||
import com.seibel.lod.core.a7.datatype.LodRenderSource;
|
||||
import com.seibel.lod.core.util.Reference;
|
||||
import com.seibel.lod.core.level.ILevel;
|
||||
import com.seibel.lod.core.render.LodQuadTree;
|
||||
import com.seibel.lod.core.render.LodRenderSection;
|
||||
import com.seibel.lod.core.datatype.LodRenderSource;
|
||||
import com.seibel.lod.core.util.objects.Reference;
|
||||
import com.seibel.lod.core.util.LodUtil;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -339,10 +339,10 @@ public class ColumnRenderSource implements LodRenderSource, IColumnDatatype {
|
||||
LodUtil.assertTrue(swapped == null);
|
||||
}
|
||||
|
||||
if(a7LodRenderer.transparencyEnabled) {
|
||||
if(LodRenderer.transparencyEnabled) {
|
||||
RenderBuffer oldBuffersTransparent = referenceSlotsTransparent.getAndSet(newBuffers[1]);
|
||||
|
||||
if (a7LodRenderer.transparencyEnabled) {
|
||||
if (LodRenderer.transparencyEnabled) {
|
||||
if (oldBuffersTransparent instanceof ColumnRenderBuffer) {
|
||||
swapped = usedBufferTransparent.swap((ColumnRenderBuffer) oldBuffersTransparent);
|
||||
LodUtil.assertTrue(swapped == null);
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.seibel.lod.core.a7.datatype.column.accessor;
|
||||
package com.seibel.lod.core.datatype.column.accessor;
|
||||
|
||||
|
||||
import java.util.Arrays;
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.lod.core.a7.datatype.column.accessor;
|
||||
package com.seibel.lod.core.datatype.column.accessor;
|
||||
|
||||
import com.seibel.lod.core.logging.SpamReducedLogger;
|
||||
import com.seibel.lod.core.util.ColorUtil;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.seibel.lod.core.a7.datatype.column.accessor;
|
||||
package com.seibel.lod.core.datatype.column.accessor;
|
||||
|
||||
public class ColumnQuadView implements IColumnDataView {
|
||||
private final long[] data;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.seibel.lod.core.a7.datatype.column.accessor;
|
||||
package com.seibel.lod.core.datatype.column.accessor;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.seibel.lod.core.a7.datatype.column.accessor;
|
||||
package com.seibel.lod.core.datatype.column.accessor;
|
||||
|
||||
public interface IColumnDatatype {
|
||||
byte getDetailOffset();
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.lod.core.builders.lodBuilding.bufferBuilding;
|
||||
package com.seibel.lod.core.datatype.column.render;
|
||||
|
||||
/**
|
||||
* EastWest <Br>
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.lod.core.builders.lodBuilding.bufferBuilding;
|
||||
package com.seibel.lod.core.datatype.column.render;
|
||||
|
||||
import com.seibel.lod.core.enums.ELodDirection;
|
||||
|
||||
+13
-14
@@ -17,14 +17,13 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.lod.core.a7.datatype.column.render;
|
||||
package com.seibel.lod.core.datatype.column.render;
|
||||
|
||||
import com.seibel.lod.core.a7.datatype.column.accessor.ColumnArrayView;
|
||||
import com.seibel.lod.core.a7.datatype.column.accessor.ColumnFormat;
|
||||
import com.seibel.lod.core.a7.render.a7LodRenderer;
|
||||
import com.seibel.lod.core.builders.lodBuilding.bufferBuilding.LodQuadBuilder;
|
||||
import com.seibel.lod.core.datatype.column.accessor.ColumnArrayView;
|
||||
import com.seibel.lod.core.datatype.column.accessor.ColumnFormat;
|
||||
import com.seibel.lod.core.render.renderer.LodRenderer;
|
||||
import com.seibel.lod.core.enums.ELodDirection;
|
||||
import com.seibel.lod.core.handlers.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.lod.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.lod.core.util.ColorUtil;
|
||||
import com.seibel.lod.core.util.LodUtil;
|
||||
import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
||||
@@ -42,9 +41,9 @@ public class ColumnBox
|
||||
byte skyLightTop = skyLight;
|
||||
byte skyLightBot = ColumnFormat.doesItExist(botData) ? ColumnFormat.getLightSky(botData) : 0;
|
||||
|
||||
boolean isTransparent = ColorUtil.getAlpha(color)<255 && a7LodRenderer.transparencyEnabled;
|
||||
boolean isTopTransparent = ColumnFormat.getAlpha(topData)<255 && a7LodRenderer.transparencyEnabled;
|
||||
boolean isBotTransparent = ColumnFormat.getAlpha(botData)<255 && a7LodRenderer.transparencyEnabled;
|
||||
boolean isTransparent = ColorUtil.getAlpha(color)<255 && LodRenderer.transparencyEnabled;
|
||||
boolean isTopTransparent = ColumnFormat.getAlpha(topData)<255 && LodRenderer.transparencyEnabled;
|
||||
boolean isBotTransparent = ColumnFormat.getAlpha(botData)<255 && LodRenderer.transparencyEnabled;
|
||||
|
||||
|
||||
// Up direction case
|
||||
@@ -53,7 +52,7 @@ public class ColumnBox
|
||||
|
||||
boolean skipTop = ColumnFormat.doesItExist(topData) && (ColumnFormat.getDepth(topData) == maxY) && !isTopTransparent;
|
||||
boolean skipBot = ColumnFormat.doesItExist(botData) && (ColumnFormat.getHeight(botData) == y) && !isBotTransparent;
|
||||
if(a7LodRenderer.transparencyEnabled && a7LodRenderer.fakeOceanFloor) {
|
||||
if(LodRenderer.transparencyEnabled && LodRenderer.fakeOceanFloor) {
|
||||
if (!isTransparent && isTopTransparent && ColumnFormat.doesItExist(topData)) {
|
||||
skyLightTop = (byte) LodUtil.clamp(0, 15 - (ColumnFormat.getHeight(topData) - y), 15);
|
||||
ySize = (short) (ColumnFormat.getHeight(topData) - y - 1);
|
||||
@@ -181,23 +180,23 @@ public class ColumnBox
|
||||
boolean allAbove = true;
|
||||
short previousDepth = -1;
|
||||
byte nextSkyLight = upSkyLight;
|
||||
boolean isTransparent = ColorUtil.getAlpha(color) < 255 && a7LodRenderer.transparencyEnabled;
|
||||
boolean isTransparent = ColorUtil.getAlpha(color) < 255 && LodRenderer.transparencyEnabled;
|
||||
boolean lastWasTransparent = false;
|
||||
for (i = 0; i < dataPoint.size() && ColumnFormat.doesItExist(adjData.get(i))
|
||||
&& !ColumnFormat.isVoid(adjData.get(i)); i++)
|
||||
{
|
||||
long adjPoint = adjData.get(i);
|
||||
|
||||
boolean isAdjTransparent = ColumnFormat.getAlpha(adjPoint) < 255 && a7LodRenderer.transparencyEnabled;
|
||||
boolean isAdjTransparent = ColumnFormat.getAlpha(adjPoint) < 255 && LodRenderer.transparencyEnabled;
|
||||
|
||||
if (!isTransparent && isAdjTransparent && a7LodRenderer.transparencyEnabled)
|
||||
if (!isTransparent && isAdjTransparent && LodRenderer.transparencyEnabled)
|
||||
continue;
|
||||
|
||||
|
||||
short height = ColumnFormat.getHeight(adjPoint);
|
||||
short depth = ColumnFormat.getDepth(adjPoint);
|
||||
|
||||
if(a7LodRenderer.transparencyEnabled && a7LodRenderer.fakeOceanFloor)
|
||||
if(LodRenderer.transparencyEnabled && LodRenderer.fakeOceanFloor)
|
||||
{
|
||||
|
||||
if(lastWasTransparent && !isAdjTransparent)
|
||||
+21
-21
@@ -1,25 +1,25 @@
|
||||
package com.seibel.lod.core.a7.datatype.column.render;
|
||||
package com.seibel.lod.core.datatype.column.render;
|
||||
|
||||
import com.seibel.lod.core.a7.datatype.column.ColumnRenderSource;
|
||||
import com.seibel.lod.core.a7.datatype.column.accessor.ColumnArrayView;
|
||||
import com.seibel.lod.core.a7.datatype.column.accessor.ColumnFormat;
|
||||
import com.seibel.lod.core.a7.level.IClientLevel;
|
||||
import com.seibel.lod.core.a7.render.a7LodRenderer;
|
||||
import com.seibel.lod.core.a7.util.UncheckedInterruptedException;
|
||||
import com.seibel.lod.core.a7.render.RenderBuffer;
|
||||
import com.seibel.lod.core.datatype.column.ColumnRenderSource;
|
||||
import com.seibel.lod.core.datatype.column.accessor.ColumnArrayView;
|
||||
import com.seibel.lod.core.datatype.column.accessor.ColumnFormat;
|
||||
import com.seibel.lod.core.level.IClientLevel;
|
||||
import com.seibel.lod.core.render.renderer.LodRenderer;
|
||||
import com.seibel.lod.core.util.objects.UncheckedInterruptedException;
|
||||
import com.seibel.lod.core.render.RenderBuffer;
|
||||
import com.seibel.lod.core.config.Config;
|
||||
import com.seibel.lod.core.builders.lodBuilding.bufferBuilding.CubicLodTemplate;
|
||||
import com.seibel.lod.core.builders.lodBuilding.bufferBuilding.LodQuadBuilder;
|
||||
import com.seibel.lod.core.enums.ELodDirection;
|
||||
import com.seibel.lod.core.enums.config.EGpuUploadMethod;
|
||||
import com.seibel.lod.core.enums.rendering.EDebugMode;
|
||||
import com.seibel.lod.core.enums.rendering.EGLProxyContext;
|
||||
import com.seibel.lod.core.logging.ConfigBasedLogger;
|
||||
import com.seibel.lod.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.lod.core.objects.DHBlockPos;
|
||||
import com.seibel.lod.core.render.GLProxy;
|
||||
import com.seibel.lod.core.render.objects.GLVertexBuffer;
|
||||
import com.seibel.lod.core.pos.DhBlockPos;
|
||||
import com.seibel.lod.core.render.glObject.GLProxy;
|
||||
import com.seibel.lod.core.render.glObject.buffer.GLVertexBuffer;
|
||||
import com.seibel.lod.core.util.*;
|
||||
import com.seibel.lod.core.util.objects.Reference;
|
||||
import com.seibel.lod.core.util.objects.StatsMap;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -28,7 +28,7 @@ import java.nio.ByteBuffer;
|
||||
import java.util.Iterator;
|
||||
import java.util.concurrent.*;
|
||||
|
||||
import static com.seibel.lod.core.render.GLProxy.GL_LOGGER;
|
||||
import static com.seibel.lod.core.render.glObject.GLProxy.GL_LOGGER;
|
||||
|
||||
|
||||
public class ColumnRenderBuffer extends RenderBuffer {
|
||||
@@ -42,9 +42,9 @@ public class ColumnRenderBuffer extends RenderBuffer {
|
||||
private static final Logger LOGGER = DhLoggerBuilder.getLogger(MethodHandles.lookup().lookupClass().getSimpleName());
|
||||
private static final long MAX_BUFFER_UPLOAD_TIMEOUT_NANOSECONDS = 1_000_000;
|
||||
GLVertexBuffer[] vbos;
|
||||
public final DHBlockPos pos;
|
||||
public final DhBlockPos pos;
|
||||
|
||||
public ColumnRenderBuffer(DHBlockPos pos) {
|
||||
public ColumnRenderBuffer(DhBlockPos pos) {
|
||||
this.pos = pos;
|
||||
vbos = new GLVertexBuffer[0];
|
||||
}
|
||||
@@ -135,7 +135,7 @@ public class ColumnRenderBuffer extends RenderBuffer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean render(a7LodRenderer renderContext) {
|
||||
public boolean render(LodRenderer renderContext) {
|
||||
boolean hasRendered = false;
|
||||
renderContext.setupOffset(pos);
|
||||
for (GLVertexBuffer vbo : vbos) {
|
||||
@@ -232,11 +232,11 @@ public class ColumnRenderBuffer extends RenderBuffer {
|
||||
|
||||
if (buffersSlotOpaque == null)
|
||||
buffersSlotOpaque = new ColumnRenderBuffer(
|
||||
new DHBlockPos(data.sectionPos.getCorner().getCorner(), clientLevel.getMinY())
|
||||
new DhBlockPos(data.sectionPos.getCorner().getCorner(), clientLevel.getMinY())
|
||||
);
|
||||
if (buffersSlotTransparent == null)
|
||||
buffersSlotTransparent = new ColumnRenderBuffer(
|
||||
new DHBlockPos(data.sectionPos.getCorner().getCorner(), clientLevel.getMinY())
|
||||
new DhBlockPos(data.sectionPos.getCorner().getCorner(), clientLevel.getMinY())
|
||||
);
|
||||
try {
|
||||
buffersSlotOpaque.uploadBuffer(builders[0], method);
|
||||
@@ -374,7 +374,7 @@ public class ColumnRenderBuffer extends RenderBuffer {
|
||||
|
||||
|
||||
// We send the call to create the vertices
|
||||
if(ColumnFormat.getAlpha(data) == 255 || !a7LodRenderer.transparencyEnabled)
|
||||
if(ColumnFormat.getAlpha(data) == 255 || !LodRenderer.transparencyEnabled)
|
||||
{
|
||||
CubicLodTemplate.addLodToBuffer(data, adjDataTop, adjDataBot, adjData, detailLevel,
|
||||
x, z, quadBuilderOpaque, debugMode);
|
||||
@@ -388,7 +388,7 @@ public class ColumnRenderBuffer extends RenderBuffer {
|
||||
}
|
||||
}
|
||||
quadBuilderOpaque.mergeQuads();
|
||||
if(a7LodRenderer.transparencyEnabled)
|
||||
if(LodRenderer.transparencyEnabled)
|
||||
quadBuilderTransparent.mergeQuads();
|
||||
}
|
||||
}
|
||||
+4
-5
@@ -17,13 +17,12 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.lod.core.builders.lodBuilding.bufferBuilding;
|
||||
package com.seibel.lod.core.datatype.column.render;
|
||||
|
||||
import com.seibel.lod.core.a7.datatype.column.accessor.ColumnFormat;
|
||||
import com.seibel.lod.core.datatype.column.accessor.ColumnFormat;
|
||||
import com.seibel.lod.core.enums.rendering.EDebugMode;
|
||||
import com.seibel.lod.core.handlers.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.lod.core.a7.datatype.column.accessor.ColumnArrayView;
|
||||
import com.seibel.lod.core.a7.datatype.column.render.ColumnBox;
|
||||
import com.seibel.lod.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.lod.core.datatype.column.accessor.ColumnArrayView;
|
||||
import com.seibel.lod.core.util.ColorUtil;
|
||||
import com.seibel.lod.core.util.LevelPosUtil;
|
||||
import com.seibel.lod.core.util.LodUtil;
|
||||
+3
-3
@@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.lod.core.builders.lodBuilding.bufferBuilding;
|
||||
package com.seibel.lod.core.datatype.column.render;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
@@ -25,12 +25,12 @@ import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.ListIterator;
|
||||
|
||||
import com.seibel.lod.core.a7.render.RenderBuffer;
|
||||
import com.seibel.lod.core.render.RenderBuffer;
|
||||
import com.seibel.lod.core.enums.ELodDirection;
|
||||
import com.seibel.lod.core.enums.ELodDirection.Axis;
|
||||
import com.seibel.lod.core.enums.config.EGpuUploadMethod;
|
||||
import com.seibel.lod.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.lod.core.render.objects.GLVertexBuffer;
|
||||
import com.seibel.lod.core.render.glObject.buffer.GLVertexBuffer;
|
||||
import com.seibel.lod.core.util.ColorUtil;
|
||||
import com.seibel.lod.core.util.LodUtil;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package com.seibel.lod.core.a7.datatype.full;
|
||||
package com.seibel.lod.core.datatype.full;
|
||||
|
||||
import com.seibel.lod.core.a7.datatype.full.accessor.FullArrayView;
|
||||
import com.seibel.lod.core.a7.pos.DhLodPos;
|
||||
import com.seibel.lod.core.datatype.full.accessor.FullArrayView;
|
||||
import com.seibel.lod.core.pos.DhLodPos;
|
||||
|
||||
public class ChunkSizedData extends FullArrayView {
|
||||
public final byte dataDetail;
|
||||
+6
-6
@@ -1,10 +1,10 @@
|
||||
package com.seibel.lod.core.a7.datatype.full;
|
||||
package com.seibel.lod.core.datatype.full;
|
||||
|
||||
import com.seibel.lod.core.a7.datatype.LodDataSource;
|
||||
import com.seibel.lod.core.a7.datatype.full.accessor.SingleFullArrayView;
|
||||
import com.seibel.lod.core.a7.pos.DhLodPos;
|
||||
import com.seibel.lod.core.a7.pos.DhSectionPos;
|
||||
import com.seibel.lod.core.a7.save.io.file.IDataSourceProvider;
|
||||
import com.seibel.lod.core.datatype.LodDataSource;
|
||||
import com.seibel.lod.core.datatype.full.accessor.SingleFullArrayView;
|
||||
import com.seibel.lod.core.pos.DhLodPos;
|
||||
import com.seibel.lod.core.pos.DhSectionPos;
|
||||
import com.seibel.lod.core.io.datafile.IDataSourceProvider;
|
||||
import com.seibel.lod.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.lod.core.util.LodUtil;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
+5
-6
@@ -1,11 +1,10 @@
|
||||
package com.seibel.lod.core.a7.datatype.full;
|
||||
package com.seibel.lod.core.datatype.full;
|
||||
|
||||
import com.seibel.lod.core.a7.datatype.DataSourceLoader;
|
||||
import com.seibel.lod.core.a7.datatype.LodDataSource;
|
||||
import com.seibel.lod.core.a7.level.ILevel;
|
||||
import com.seibel.lod.core.a7.save.io.file.DataMetaFile;
|
||||
import com.seibel.lod.core.datatype.DataSourceLoader;
|
||||
import com.seibel.lod.core.datatype.LodDataSource;
|
||||
import com.seibel.lod.core.level.ILevel;
|
||||
import com.seibel.lod.core.io.datafile.DataMetaFile;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
+10
-10
@@ -1,14 +1,14 @@
|
||||
package com.seibel.lod.core.a7.datatype.full;
|
||||
package com.seibel.lod.core.datatype.full;
|
||||
|
||||
import com.seibel.lod.core.a7.datatype.full.accessor.FullArrayView;
|
||||
import com.seibel.lod.core.a7.datatype.full.accessor.SingleFullArrayView;
|
||||
import com.seibel.lod.core.a7.level.ILevel;
|
||||
import com.seibel.lod.core.a7.pos.DhBlockPos2D;
|
||||
import com.seibel.lod.core.a7.pos.DhLodPos;
|
||||
import com.seibel.lod.core.a7.save.io.file.DataMetaFile;
|
||||
import com.seibel.lod.core.a7.datatype.LodDataSource;
|
||||
import com.seibel.lod.core.a7.pos.DhSectionPos;
|
||||
import com.seibel.lod.core.a7.util.UnclosableInputStream;
|
||||
import com.seibel.lod.core.datatype.full.accessor.FullArrayView;
|
||||
import com.seibel.lod.core.datatype.full.accessor.SingleFullArrayView;
|
||||
import com.seibel.lod.core.level.ILevel;
|
||||
import com.seibel.lod.core.pos.DhBlockPos2D;
|
||||
import com.seibel.lod.core.pos.DhLodPos;
|
||||
import com.seibel.lod.core.io.datafile.DataMetaFile;
|
||||
import com.seibel.lod.core.datatype.LodDataSource;
|
||||
import com.seibel.lod.core.pos.DhSectionPos;
|
||||
import com.seibel.lod.core.util.objects.UnclosableInputStream;
|
||||
import com.seibel.lod.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.lod.core.util.LodUtil;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.seibel.lod.core.a7.datatype.full;
|
||||
package com.seibel.lod.core.datatype.full;
|
||||
|
||||
// Static class for the data format:
|
||||
// ID: blockState id Y: Height(signed) DP: Depth(signed?) (Depth means the length of the block!)
|
||||
@@ -16,7 +16,7 @@ package com.seibel.lod.core.a7.datatype.full;
|
||||
import com.seibel.lod.core.util.LodUtil;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
|
||||
import static com.seibel.lod.core.a7.datatype.column.accessor.ColumnFormat.MAX_WORLD_Y_SIZE;
|
||||
import static com.seibel.lod.core.datatype.column.accessor.ColumnFormat.MAX_WORLD_Y_SIZE;
|
||||
|
||||
public class FullFormat {
|
||||
|
||||
+2
-3
@@ -1,7 +1,6 @@
|
||||
package com.seibel.lod.core.a7.datatype.full;
|
||||
package com.seibel.lod.core.datatype.full;
|
||||
|
||||
import com.seibel.lod.core.a7.util.UnclosableInputStream;
|
||||
import com.seibel.lod.core.handlers.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.lod.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.lod.core.wrapperInterfaces.IWrapperFactory;
|
||||
import com.seibel.lod.core.wrapperInterfaces.block.IBlockStateWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.world.IBiomeWrapper;
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package com.seibel.lod.core.a7.datatype.full;
|
||||
package com.seibel.lod.core.datatype.full;
|
||||
|
||||
import com.seibel.lod.core.a7.pos.DhSectionPos;
|
||||
import com.seibel.lod.core.pos.DhSectionPos;
|
||||
|
||||
public class SampledDataSource extends FullDataSource {
|
||||
private boolean[] isGenerated;
|
||||
+5
-6
@@ -1,11 +1,10 @@
|
||||
package com.seibel.lod.core.a7.datatype.full;
|
||||
package com.seibel.lod.core.datatype.full;
|
||||
|
||||
import com.seibel.lod.core.a7.datatype.DataSourceLoader;
|
||||
import com.seibel.lod.core.a7.datatype.LodDataSource;
|
||||
import com.seibel.lod.core.a7.level.ILevel;
|
||||
import com.seibel.lod.core.a7.save.io.file.DataMetaFile;
|
||||
import com.seibel.lod.core.datatype.DataSourceLoader;
|
||||
import com.seibel.lod.core.datatype.LodDataSource;
|
||||
import com.seibel.lod.core.level.ILevel;
|
||||
import com.seibel.lod.core.io.datafile.DataMetaFile;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
+8
-9
@@ -1,13 +1,12 @@
|
||||
package com.seibel.lod.core.a7.datatype.full;
|
||||
package com.seibel.lod.core.datatype.full;
|
||||
|
||||
import com.seibel.lod.core.a7.datatype.LodDataSource;
|
||||
import com.seibel.lod.core.a7.datatype.full.accessor.FullArrayView;
|
||||
import com.seibel.lod.core.a7.datatype.full.accessor.SingleFullArrayView;
|
||||
import com.seibel.lod.core.a7.level.ILevel;
|
||||
import com.seibel.lod.core.a7.pos.DhLodPos;
|
||||
import com.seibel.lod.core.a7.pos.DhSectionPos;
|
||||
import com.seibel.lod.core.a7.save.io.file.DataMetaFile;
|
||||
import com.seibel.lod.core.a7.util.UnclosableInputStream;
|
||||
import com.seibel.lod.core.datatype.LodDataSource;
|
||||
import com.seibel.lod.core.datatype.full.accessor.FullArrayView;
|
||||
import com.seibel.lod.core.datatype.full.accessor.SingleFullArrayView;
|
||||
import com.seibel.lod.core.level.ILevel;
|
||||
import com.seibel.lod.core.pos.DhLodPos;
|
||||
import com.seibel.lod.core.pos.DhSectionPos;
|
||||
import com.seibel.lod.core.io.datafile.DataMetaFile;
|
||||
import com.seibel.lod.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.lod.core.util.LodUtil;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package com.seibel.lod.core.a7.datatype.full.accessor;
|
||||
package com.seibel.lod.core.datatype.full.accessor;
|
||||
|
||||
import com.seibel.lod.core.a7.datatype.full.FullFormat;
|
||||
import com.seibel.lod.core.a7.datatype.full.IdBiomeBlockStateMap;
|
||||
import com.seibel.lod.core.datatype.full.FullFormat;
|
||||
import com.seibel.lod.core.datatype.full.IdBiomeBlockStateMap;
|
||||
import com.seibel.lod.core.util.LodUtil;
|
||||
|
||||
public class FullArrayView implements IFullDataView {
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.seibel.lod.core.a7.datatype.full.accessor;
|
||||
package com.seibel.lod.core.datatype.full.accessor;
|
||||
|
||||
public interface IFullDataType {
|
||||
byte getDetailOffset();
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package com.seibel.lod.core.a7.datatype.full.accessor;
|
||||
package com.seibel.lod.core.datatype.full.accessor;
|
||||
|
||||
import com.seibel.lod.core.a7.datatype.full.IdBiomeBlockStateMap;
|
||||
import com.seibel.lod.core.datatype.full.IdBiomeBlockStateMap;
|
||||
import com.seibel.lod.core.util.LodUtil;
|
||||
|
||||
import java.util.Iterator;
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package com.seibel.lod.core.a7.datatype.full.accessor;
|
||||
package com.seibel.lod.core.datatype.full.accessor;
|
||||
|
||||
import com.seibel.lod.core.a7.datatype.full.FullFormat;
|
||||
import com.seibel.lod.core.a7.datatype.full.IdBiomeBlockStateMap;
|
||||
import com.seibel.lod.core.datatype.full.FullFormat;
|
||||
import com.seibel.lod.core.datatype.full.IdBiomeBlockStateMap;
|
||||
|
||||
public class SingleFullArrayView implements IFullDataView {
|
||||
private final long[][] dataArrays;
|
||||
+6
-6
@@ -1,10 +1,10 @@
|
||||
package com.seibel.lod.core.a7.datatype.transform;
|
||||
package com.seibel.lod.core.datatype.transform;
|
||||
|
||||
import com.seibel.lod.core.a7.datatype.LodDataSource;
|
||||
import com.seibel.lod.core.a7.datatype.LodRenderSource;
|
||||
import com.seibel.lod.core.a7.datatype.column.ColumnRenderLoader;
|
||||
import com.seibel.lod.core.a7.datatype.column.ColumnRenderSource;
|
||||
import com.seibel.lod.core.a7.level.IClientLevel;
|
||||
import com.seibel.lod.core.datatype.LodDataSource;
|
||||
import com.seibel.lod.core.datatype.LodRenderSource;
|
||||
import com.seibel.lod.core.datatype.column.ColumnRenderLoader;
|
||||
import com.seibel.lod.core.datatype.column.ColumnRenderSource;
|
||||
import com.seibel.lod.core.level.IClientLevel;
|
||||
import com.seibel.lod.core.util.LodUtil;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
+13
-13
@@ -1,17 +1,17 @@
|
||||
package com.seibel.lod.core.a7.datatype.transform;
|
||||
package com.seibel.lod.core.datatype.transform;
|
||||
|
||||
import com.seibel.lod.core.a7.datatype.LodRenderSource;
|
||||
import com.seibel.lod.core.a7.datatype.column.accessor.ColumnFormat;
|
||||
import com.seibel.lod.core.a7.datatype.column.ColumnRenderSource;
|
||||
import com.seibel.lod.core.a7.datatype.column.accessor.ColumnArrayView;
|
||||
import com.seibel.lod.core.a7.datatype.column.accessor.ColumnQuadView;
|
||||
import com.seibel.lod.core.a7.datatype.full.*;
|
||||
import com.seibel.lod.core.a7.datatype.full.accessor.SingleFullArrayView;
|
||||
import com.seibel.lod.core.a7.level.IClientLevel;
|
||||
import com.seibel.lod.core.a7.pos.DhSectionPos;
|
||||
import com.seibel.lod.core.datatype.LodRenderSource;
|
||||
import com.seibel.lod.core.datatype.column.accessor.ColumnFormat;
|
||||
import com.seibel.lod.core.datatype.column.ColumnRenderSource;
|
||||
import com.seibel.lod.core.datatype.column.accessor.ColumnArrayView;
|
||||
import com.seibel.lod.core.datatype.column.accessor.ColumnQuadView;
|
||||
import com.seibel.lod.core.datatype.full.*;
|
||||
import com.seibel.lod.core.datatype.full.accessor.SingleFullArrayView;
|
||||
import com.seibel.lod.core.level.IClientLevel;
|
||||
import com.seibel.lod.core.pos.DhSectionPos;
|
||||
import com.seibel.lod.core.config.Config;
|
||||
import com.seibel.lod.core.handlers.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.lod.core.objects.DHBlockPos;
|
||||
import com.seibel.lod.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.lod.core.pos.DhBlockPos;
|
||||
import com.seibel.lod.core.util.LodUtil;
|
||||
import com.seibel.lod.core.wrapperInterfaces.IWrapperFactory;
|
||||
import com.seibel.lod.core.wrapperInterfaces.block.IBlockStateWrapper;
|
||||
@@ -172,7 +172,7 @@ public class FullToColumnTransformer {
|
||||
IBlockStateWrapper block = entry.blockState;
|
||||
if (block.equals(AIR)) continue;
|
||||
isVoid = false;
|
||||
int color = level.computeBaseColor(new DHBlockPos(blockX, y + level.getMinY(), blockZ), biome, block);
|
||||
int color = level.computeBaseColor(new DhBlockPos(blockX, y + level.getMinY(), blockZ), biome, block);
|
||||
long columnData = ColumnFormat.createDataPoint(y + blockLength, y, color, light, genMode);
|
||||
column.set(offset, columnData);
|
||||
offset++;
|
||||
+8
-8
@@ -1,14 +1,14 @@
|
||||
package com.seibel.lod.core.a7.datatype;
|
||||
package com.seibel.lod.core.datatype.transform;
|
||||
|
||||
import java.util.concurrent.*;
|
||||
|
||||
import com.seibel.lod.core.a7.datatype.full.ChunkSizedData;
|
||||
import com.seibel.lod.core.a7.datatype.transform.LodDataBuilder;
|
||||
import com.seibel.lod.core.a7.level.ILevel;
|
||||
import com.seibel.lod.core.datatype.full.ChunkSizedData;
|
||||
import com.seibel.lod.core.level.ILevel;
|
||||
import com.seibel.lod.core.config.Config;
|
||||
import com.seibel.lod.core.logging.ConfigBasedLogger;
|
||||
import com.seibel.lod.core.objects.DHChunkPos;
|
||||
import com.seibel.lod.core.pos.DhChunkPos;
|
||||
import com.seibel.lod.core.util.*;
|
||||
import com.seibel.lod.core.util.objects.EventLoop;
|
||||
import com.seibel.lod.core.wrapperInterfaces.chunk.IChunkWrapper;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
|
||||
@@ -17,14 +17,14 @@ public class LodBuilder {
|
||||
public static final ConfigBasedLogger LOGGER = new ConfigBasedLogger(LogManager.getLogger(),
|
||||
() -> Config.Client.Advanced.Debugging.DebugSwitch.logLodBuilderEvent.get());
|
||||
static class Task {
|
||||
final DHChunkPos chunkPos;
|
||||
final DhChunkPos chunkPos;
|
||||
final CompletableFuture<ChunkSizedData> future;
|
||||
Task(DHChunkPos chunkPos, CompletableFuture<ChunkSizedData> future) {
|
||||
Task(DhChunkPos chunkPos, CompletableFuture<ChunkSizedData> future) {
|
||||
this.chunkPos = chunkPos;
|
||||
this.future = future;
|
||||
}
|
||||
}
|
||||
private final ConcurrentHashMap<DHChunkPos, IChunkWrapper> latestChunkToBuild = new ConcurrentHashMap<>();
|
||||
private final ConcurrentHashMap<DhChunkPos, IChunkWrapper> latestChunkToBuild = new ConcurrentHashMap<>();
|
||||
private final ConcurrentLinkedDeque<Task> taskToBuild = new ConcurrentLinkedDeque<>();
|
||||
private final ExecutorService executor = LodUtil.makeSingleThreadPool(LodBuilder.class);
|
||||
private final EventLoop ticker = new EventLoop(executor, this::_tick);
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.lod.core.builders.lodBuilding;
|
||||
package com.seibel.lod.core.datatype.transform;
|
||||
|
||||
import com.seibel.lod.core.enums.config.EDistanceGenerationMode;
|
||||
|
||||
+4
-4
@@ -1,8 +1,8 @@
|
||||
package com.seibel.lod.core.a7.datatype.transform;
|
||||
package com.seibel.lod.core.datatype.transform;
|
||||
|
||||
import com.seibel.lod.core.a7.datatype.full.ChunkSizedData;
|
||||
import com.seibel.lod.core.a7.datatype.full.FullFormat;
|
||||
import com.seibel.lod.core.handlers.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.lod.core.datatype.full.ChunkSizedData;
|
||||
import com.seibel.lod.core.datatype.full.FullFormat;
|
||||
import com.seibel.lod.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.lod.core.util.LodUtil;
|
||||
import com.seibel.lod.core.wrapperInterfaces.IWrapperFactory;
|
||||
import com.seibel.lod.core.wrapperInterfaces.block.IBlockStateWrapper;
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.lod.core.handlers.dependencyInjection;
|
||||
package com.seibel.lod.core.dependencyInjection;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.lod.core.handlers.dependencyInjection;
|
||||
package com.seibel.lod.core.dependencyInjection;
|
||||
|
||||
import com.seibel.lod.core.api.external.coreImplementations.interfaces.events.ICoreDhApiEvent;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.lod.core.handlers.dependencyInjection;
|
||||
package com.seibel.lod.core.dependencyInjection;
|
||||
|
||||
/**
|
||||
* Necessary for all singletons that can be dependency injected.
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.lod.core.handlers.dependencyInjection;
|
||||
package com.seibel.lod.core.dependencyInjection;
|
||||
|
||||
import com.seibel.lod.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.lod.core.wrapperInterfaces.modAccessor.IModAccessor;
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.lod.core.handlers.dependencyInjection;
|
||||
package com.seibel.lod.core.dependencyInjection;
|
||||
|
||||
import com.seibel.lod.core.api.external.coreImplementations.interfaces.override.ICoreDhApiOverrideable;
|
||||
import com.seibel.lod.core.util.StringUtil;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.seibel.lod.core.handlers.dependencyInjection;
|
||||
package com.seibel.lod.core.dependencyInjection;
|
||||
|
||||
import com.seibel.lod.core.api.external.coreImplementations.interfaces.override.ICoreDhApiOverrideable;
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.lod.core.handlers.dependencyInjection;
|
||||
package com.seibel.lod.core.dependencyInjection;
|
||||
|
||||
/**
|
||||
* This class takes care of dependency injection
|
||||
+1
-2
@@ -17,12 +17,11 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.lod.core.handlers.dependencyInjection;
|
||||
package com.seibel.lod.core.dependencyInjection;
|
||||
|
||||
import com.seibel.lod.core.api.external.coreImplementations.interfaces.override.worldGenerator.ICoreDhApiWorldGenerator;
|
||||
import com.seibel.lod.core.api.external.coreImplementations.interfaces.wrappers.world.ICoreDhApiLevelWrapper;
|
||||
import com.seibel.lod.core.util.StringUtil;
|
||||
import com.seibel.lod.core.wrapperInterfaces.world.ILevelWrapper;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.Map;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.seibel.lod.core.objects.math.Vec3i;
|
||||
import com.seibel.lod.core.util.math.Vec3i;
|
||||
|
||||
/**
|
||||
* An (almost) exact copy of Minecraft's
|
||||
|
||||
+5
-6
@@ -17,15 +17,14 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.lod.core.builders.worldGeneration;
|
||||
package com.seibel.lod.core.generation;
|
||||
|
||||
import com.seibel.lod.core.a7.generation.IChunkGenerator;
|
||||
import com.seibel.lod.core.a7.level.ILevel;
|
||||
import com.seibel.lod.core.level.ILevel;
|
||||
import com.seibel.lod.core.config.Config;
|
||||
import com.seibel.lod.core.enums.config.EDistanceGenerationMode;
|
||||
import com.seibel.lod.core.handlers.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.lod.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.lod.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.lod.core.objects.DHChunkPos;
|
||||
import com.seibel.lod.core.pos.DhChunkPos;
|
||||
import com.seibel.lod.core.wrapperInterfaces.IWrapperFactory;
|
||||
import com.seibel.lod.core.wrapperInterfaces.chunk.IChunkWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
||||
@@ -260,7 +259,7 @@ public class BatchGenerator implements IChunkGenerator
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Void> generateChunks(DHChunkPos chunkPosMin, byte granularity, byte targetDataDetail, Consumer<IChunkWrapper> resultConsumer) {
|
||||
public CompletableFuture<Void> generateChunks(DhChunkPos chunkPosMin, byte granularity, byte targetDataDetail, Consumer<IChunkWrapper> resultConsumer) {
|
||||
EDistanceGenerationMode mode = Config.Client.WorldGenerator.distanceGenerationMode.get();
|
||||
Steps targetStep = null;
|
||||
switch (mode) {
|
||||
+7
-7
@@ -1,11 +1,11 @@
|
||||
package com.seibel.lod.core.a7.generation;
|
||||
package com.seibel.lod.core.generation;
|
||||
|
||||
import com.seibel.lod.core.a7.datatype.full.ChunkSizedData;
|
||||
import com.seibel.lod.core.a7.pos.DhBlockPos2D;
|
||||
import com.seibel.lod.core.a7.pos.DhLodPos;
|
||||
import com.seibel.lod.core.a7.util.UncheckedInterruptedException;
|
||||
import com.seibel.lod.core.datatype.full.ChunkSizedData;
|
||||
import com.seibel.lod.core.pos.DhBlockPos2D;
|
||||
import com.seibel.lod.core.pos.DhLodPos;
|
||||
import com.seibel.lod.core.util.objects.UncheckedInterruptedException;
|
||||
import com.seibel.lod.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.lod.core.objects.DHChunkPos;
|
||||
import com.seibel.lod.core.pos.DhChunkPos;
|
||||
import com.seibel.lod.core.util.LodUtil;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -355,7 +355,7 @@ public class GenerationQueue implements Closeable {
|
||||
LodUtil.assertTrue(granularity >= minGranularity && granularity <= maxGranularity);
|
||||
LodUtil.assertTrue(dataDetail >= minDataDetail && dataDetail <= maxDataDetail);
|
||||
|
||||
DHChunkPos chunkPosMin = new DHChunkPos(pos.getCorner());
|
||||
DhChunkPos chunkPosMin = new DhChunkPos(pos.getCorner());
|
||||
logger.info("Generating section {} with granularity {} at {}", pos, granularity, chunkPosMin);
|
||||
task.genFuture = generator.generate(
|
||||
chunkPosMin, granularity, dataDetail, task.group::accept);
|
||||
+6
-7
@@ -1,19 +1,18 @@
|
||||
package com.seibel.lod.core.a7.generation;
|
||||
package com.seibel.lod.core.generation;
|
||||
|
||||
import com.seibel.lod.core.a7.datatype.full.ChunkSizedData;
|
||||
import com.seibel.lod.core.a7.datatype.transform.LodDataBuilder;
|
||||
import com.seibel.lod.core.objects.DHChunkPos;
|
||||
import com.seibel.lod.core.util.gridList.ArrayGridList;
|
||||
import com.seibel.lod.core.datatype.full.ChunkSizedData;
|
||||
import com.seibel.lod.core.datatype.transform.LodDataBuilder;
|
||||
import com.seibel.lod.core.pos.DhChunkPos;
|
||||
import com.seibel.lod.core.wrapperInterfaces.chunk.IChunkWrapper;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public interface IChunkGenerator extends IGenerator {
|
||||
CompletableFuture<Void> generateChunks(DHChunkPos chunkPosMin, byte granularity, byte targetDataDetail, Consumer<IChunkWrapper> resultConsumer);
|
||||
CompletableFuture<Void> generateChunks(DhChunkPos chunkPosMin, byte granularity, byte targetDataDetail, Consumer<IChunkWrapper> resultConsumer);
|
||||
|
||||
@Override
|
||||
default CompletableFuture<Void> generate(DHChunkPos chunkPosMin, byte granularity, byte targetDataDetail, Consumer<ChunkSizedData> resultConsumer) {
|
||||
default CompletableFuture<Void> generate(DhChunkPos chunkPosMin, byte granularity, byte targetDataDetail, Consumer<ChunkSizedData> resultConsumer) {
|
||||
return generateChunks(chunkPosMin, granularity, targetDataDetail, (chunk) -> {
|
||||
resultConsumer.accept(LodDataBuilder.createChunkData(chunk));
|
||||
});
|
||||
+4
-5
@@ -1,8 +1,7 @@
|
||||
package com.seibel.lod.core.a7.generation;
|
||||
package com.seibel.lod.core.generation;
|
||||
|
||||
import com.seibel.lod.core.a7.datatype.full.ChunkSizedData;
|
||||
import com.seibel.lod.core.objects.DHChunkPos;
|
||||
import com.seibel.lod.core.util.gridList.ArrayGridList;
|
||||
import com.seibel.lod.core.datatype.full.ChunkSizedData;
|
||||
import com.seibel.lod.core.pos.DhChunkPos;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.function.Consumer;
|
||||
@@ -28,7 +27,7 @@ public interface IGenerator extends AutoCloseable {
|
||||
// Start a generation event
|
||||
// (Note that the chunkPos is always aligned to the granularity)
|
||||
// (For example, if the granularity is 4, data detail is 0, the chunkPos will be aligned to 16x16 blocks)
|
||||
CompletableFuture<Void> generate(DHChunkPos chunkPosMin, byte granularity, byte targetDataDetail, Consumer<ChunkSizedData> resultConsumer);
|
||||
CompletableFuture<Void> generate(DhChunkPos chunkPosMin, byte granularity, byte targetDataDetail, Consumer<ChunkSizedData> resultConsumer);
|
||||
|
||||
// Return whether the generator is currently busy and cannot accept new generation requests.
|
||||
boolean isBusy();
|
||||
+4
-6
@@ -1,11 +1,9 @@
|
||||
package com.seibel.lod.core.a7.save.io;
|
||||
package com.seibel.lod.core.io;
|
||||
|
||||
import com.seibel.lod.core.config.Config;
|
||||
import com.seibel.lod.core.handlers.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.lod.core.handlers.dimensionFinder.PlayerData;
|
||||
import com.seibel.lod.core.handlers.dimensionFinder.SubDimCompare;
|
||||
import com.seibel.lod.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.lod.core.logging.ConfigBasedLogger;
|
||||
import com.seibel.lod.core.objects.DHChunkPos;
|
||||
import com.seibel.lod.core.pos.DhChunkPos;
|
||||
import com.seibel.lod.core.util.LodUtil;
|
||||
import com.seibel.lod.core.wrapperInterfaces.chunk.IChunkWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
||||
@@ -97,7 +95,7 @@ public class LevelToFileMatcher implements AutoCloseable {
|
||||
}
|
||||
|
||||
// relevant positions
|
||||
DHChunkPos playerChunkPos = new DHChunkPos(playerData.playerBlockPos);
|
||||
DhChunkPos playerChunkPos = new DhChunkPos(playerData.playerBlockPos);
|
||||
int startingBlockPosX = playerChunkPos.getMinBlockX();
|
||||
int startingBlockPosZ = playerChunkPos.getMinBlockZ();
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
package com.seibel.lod.core.a7.save.io;
|
||||
package com.seibel.lod.core.io;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.ByteBuffer;
|
||||
@@ -12,8 +12,8 @@ import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.zip.Adler32;
|
||||
import java.util.zip.CheckedOutputStream;
|
||||
|
||||
import com.seibel.lod.core.a7.pos.DhSectionPos;
|
||||
import com.seibel.lod.core.a7.util.UnclosableOutputStream;
|
||||
import com.seibel.lod.core.pos.DhSectionPos;
|
||||
import com.seibel.lod.core.util.objects.UnclosableOutputStream;
|
||||
import com.seibel.lod.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.lod.core.util.LodUtil;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
+7
-7
@@ -17,12 +17,12 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.lod.core.handlers.dimensionFinder;
|
||||
package com.seibel.lod.core.io;
|
||||
|
||||
|
||||
import com.electronwill.nightconfig.core.file.CommentedFileConfig;
|
||||
import com.seibel.lod.core.handlers.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.lod.core.objects.DHBlockPos;
|
||||
import com.seibel.lod.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.lod.core.pos.DhBlockPos;
|
||||
import com.seibel.lod.core.wrapperInterfaces.IWrapperFactory;
|
||||
import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
||||
|
||||
@@ -45,7 +45,7 @@ public class PlayerData
|
||||
public static final String PLAYER_BLOCK_POS_X_PATH = "playerBlockPosX";
|
||||
public static final String PLAYER_BLOCK_POS_Y_PATH = "playerBlockPosY";
|
||||
public static final String PLAYER_BLOCK_POS_Z_PATH = "playerBlockPosZ";
|
||||
public DHBlockPos playerBlockPos;
|
||||
public DhBlockPos playerBlockPos;
|
||||
|
||||
// not implemented yet
|
||||
public static final String WORLD_SPAWN_POS_X_PATH = "worldSpawnBlockPosX";
|
||||
@@ -55,7 +55,7 @@ public class PlayerData
|
||||
* The client world has access to a spawn point, so this should be possible to fill in.
|
||||
* I'm not sure what this will look like for worlds that don't have a spawn point.
|
||||
*/
|
||||
public DHBlockPos worldSpawnPointBlockPos;
|
||||
public DhBlockPos worldSpawnPointBlockPos;
|
||||
@Nullable
|
||||
public static PlayerData tryGetPlayerData(IMinecraftClientWrapper mcClient) {
|
||||
if (!mcClient.playerExists()) return null;
|
||||
@@ -86,11 +86,11 @@ public class PlayerData
|
||||
int x = toml.getIntOrElse(PLAYER_BLOCK_POS_X_PATH, 0);
|
||||
int y = toml.getIntOrElse(PLAYER_BLOCK_POS_Y_PATH, 0);
|
||||
int z = toml.getIntOrElse(PLAYER_BLOCK_POS_Z_PATH, 0);
|
||||
this.playerBlockPos = new DHBlockPos(x, y, z);
|
||||
this.playerBlockPos = new DhBlockPos(x, y, z);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.playerBlockPos = new DHBlockPos(0, 0, 0);
|
||||
this.playerBlockPos = new DhBlockPos(0, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.lod.core.handlers.dimensionFinder;
|
||||
package com.seibel.lod.core.io;
|
||||
|
||||
import com.seibel.lod.core.config.Config;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
+8
-9
@@ -1,14 +1,13 @@
|
||||
package com.seibel.lod.core.a7.save.io.file;
|
||||
package com.seibel.lod.core.io.datafile;
|
||||
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.seibel.lod.core.a7.datatype.LodDataSource;
|
||||
import com.seibel.lod.core.a7.datatype.full.ChunkSizedData;
|
||||
import com.seibel.lod.core.a7.datatype.full.FullDataSource;
|
||||
import com.seibel.lod.core.a7.datatype.full.SparseDataSource;
|
||||
import com.seibel.lod.core.a7.level.ILevel;
|
||||
import com.seibel.lod.core.a7.pos.DhLodPos;
|
||||
import com.seibel.lod.core.a7.pos.DhSectionPos;
|
||||
import com.seibel.lod.core.a7.save.io.MetaFile;
|
||||
import com.seibel.lod.core.datatype.LodDataSource;
|
||||
import com.seibel.lod.core.datatype.full.ChunkSizedData;
|
||||
import com.seibel.lod.core.datatype.full.FullDataSource;
|
||||
import com.seibel.lod.core.datatype.full.SparseDataSource;
|
||||
import com.seibel.lod.core.level.ILevel;
|
||||
import com.seibel.lod.core.pos.DhLodPos;
|
||||
import com.seibel.lod.core.pos.DhSectionPos;
|
||||
import com.seibel.lod.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.lod.core.util.LodUtil;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
+8
-10
@@ -1,23 +1,21 @@
|
||||
package com.seibel.lod.core.a7.save.io.file;
|
||||
package com.seibel.lod.core.io.datafile;
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.ref.*;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.*;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
|
||||
import com.seibel.lod.core.a7.datatype.LodDataSource;
|
||||
import com.seibel.lod.core.a7.datatype.DataSourceLoader;
|
||||
import com.seibel.lod.core.a7.datatype.LodRenderSource;
|
||||
import com.seibel.lod.core.a7.datatype.full.ChunkSizedData;
|
||||
import com.seibel.lod.core.a7.pos.DhLodPos;
|
||||
import com.seibel.lod.core.a7.save.io.MetaFile;
|
||||
import com.seibel.lod.core.a7.level.ILevel;
|
||||
import com.seibel.lod.core.a7.pos.DhSectionPos;
|
||||
import com.seibel.lod.core.datatype.LodDataSource;
|
||||
import com.seibel.lod.core.datatype.DataSourceLoader;
|
||||
import com.seibel.lod.core.datatype.full.ChunkSizedData;
|
||||
import com.seibel.lod.core.pos.DhLodPos;
|
||||
import com.seibel.lod.core.io.MetaFile;
|
||||
import com.seibel.lod.core.level.ILevel;
|
||||
import com.seibel.lod.core.pos.DhSectionPos;
|
||||
import com.seibel.lod.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.lod.core.util.LodUtil;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
+8
-8
@@ -1,12 +1,12 @@
|
||||
package com.seibel.lod.core.a7.save.io.file;
|
||||
package com.seibel.lod.core.io.datafile;
|
||||
|
||||
import com.seibel.lod.core.a7.datatype.LodDataSource;
|
||||
import com.seibel.lod.core.a7.datatype.full.ChunkSizedData;
|
||||
import com.seibel.lod.core.a7.datatype.full.FullDataSource;
|
||||
import com.seibel.lod.core.a7.datatype.full.SparseDataSource;
|
||||
import com.seibel.lod.core.a7.generation.GenerationQueue;
|
||||
import com.seibel.lod.core.a7.level.IServerLevel;
|
||||
import com.seibel.lod.core.a7.pos.DhSectionPos;
|
||||
import com.seibel.lod.core.datatype.LodDataSource;
|
||||
import com.seibel.lod.core.datatype.full.ChunkSizedData;
|
||||
import com.seibel.lod.core.datatype.full.FullDataSource;
|
||||
import com.seibel.lod.core.datatype.full.SparseDataSource;
|
||||
import com.seibel.lod.core.generation.GenerationQueue;
|
||||
import com.seibel.lod.core.level.IServerLevel;
|
||||
import com.seibel.lod.core.pos.DhSectionPos;
|
||||
import com.seibel.lod.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.lod.core.util.LodUtil;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
+4
-10
@@ -1,17 +1,11 @@
|
||||
package com.seibel.lod.core.a7.save.io.file;
|
||||
package com.seibel.lod.core.io.datafile;
|
||||
|
||||
import com.seibel.lod.core.a7.datatype.LodDataSource;
|
||||
import com.seibel.lod.core.a7.datatype.full.ChunkSizedData;
|
||||
import com.seibel.lod.core.a7.datatype.full.FullFormat;
|
||||
import com.seibel.lod.core.a7.pos.DhLodPos;
|
||||
import com.seibel.lod.core.a7.pos.DhSectionPos;
|
||||
import com.seibel.lod.core.objects.DHChunkPos;
|
||||
import com.seibel.lod.core.datatype.LodDataSource;
|
||||
import com.seibel.lod.core.datatype.full.ChunkSizedData;
|
||||
import com.seibel.lod.core.pos.DhSectionPos;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.function.Consumer;
|
||||
+2
-3
@@ -1,7 +1,6 @@
|
||||
package com.seibel.lod.core.a7.save.io.file;
|
||||
package com.seibel.lod.core.io.datafile;
|
||||
|
||||
import com.seibel.lod.core.a7.level.ILevel;
|
||||
import com.seibel.lod.core.util.LodUtil;
|
||||
import com.seibel.lod.core.level.ILevel;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
+4
-4
@@ -1,8 +1,8 @@
|
||||
package com.seibel.lod.core.a7.save.io.render;
|
||||
package com.seibel.lod.core.io.renderfile;
|
||||
|
||||
import com.seibel.lod.core.a7.datatype.LodRenderSource;
|
||||
import com.seibel.lod.core.a7.datatype.full.ChunkSizedData;
|
||||
import com.seibel.lod.core.a7.pos.DhSectionPos;
|
||||
import com.seibel.lod.core.datatype.LodRenderSource;
|
||||
import com.seibel.lod.core.datatype.full.ChunkSizedData;
|
||||
import com.seibel.lod.core.pos.DhSectionPos;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Collection;
|
||||
+13
-13
@@ -1,18 +1,18 @@
|
||||
package com.seibel.lod.core.a7.save.io.render;
|
||||
package com.seibel.lod.core.io.renderfile;
|
||||
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.seibel.lod.core.a7.datatype.LodDataSource;
|
||||
import com.seibel.lod.core.a7.datatype.PlaceHolderRenderSource;
|
||||
import com.seibel.lod.core.a7.datatype.LodRenderSource;
|
||||
import com.seibel.lod.core.a7.datatype.RenderSourceLoader;
|
||||
import com.seibel.lod.core.a7.datatype.column.ColumnRenderSource;
|
||||
import com.seibel.lod.core.a7.datatype.full.ChunkSizedData;
|
||||
import com.seibel.lod.core.a7.datatype.transform.DataRenderTransformer;
|
||||
import com.seibel.lod.core.a7.level.IClientLevel;
|
||||
import com.seibel.lod.core.a7.pos.DhLodPos;
|
||||
import com.seibel.lod.core.a7.save.io.file.IDataSourceProvider;
|
||||
import com.seibel.lod.core.a7.pos.DhSectionPos;
|
||||
import com.seibel.lod.core.a7.util.UncheckedInterruptedException;
|
||||
import com.seibel.lod.core.datatype.LodDataSource;
|
||||
import com.seibel.lod.core.datatype.PlaceHolderRenderSource;
|
||||
import com.seibel.lod.core.datatype.LodRenderSource;
|
||||
import com.seibel.lod.core.datatype.RenderSourceLoader;
|
||||
import com.seibel.lod.core.datatype.column.ColumnRenderSource;
|
||||
import com.seibel.lod.core.datatype.full.ChunkSizedData;
|
||||
import com.seibel.lod.core.datatype.transform.DataRenderTransformer;
|
||||
import com.seibel.lod.core.level.IClientLevel;
|
||||
import com.seibel.lod.core.pos.DhLodPos;
|
||||
import com.seibel.lod.core.io.datafile.IDataSourceProvider;
|
||||
import com.seibel.lod.core.pos.DhSectionPos;
|
||||
import com.seibel.lod.core.util.objects.UncheckedInterruptedException;
|
||||
import com.seibel.lod.core.config.Config;
|
||||
import com.seibel.lod.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.lod.core.util.LodUtil;
|
||||
+10
-14
@@ -1,19 +1,15 @@
|
||||
package com.seibel.lod.core.a7.save.io.render;
|
||||
package com.seibel.lod.core.io.renderfile;
|
||||
|
||||
import com.seibel.lod.core.a7.datatype.DataSourceLoader;
|
||||
import com.seibel.lod.core.a7.datatype.LodDataSource;
|
||||
import com.seibel.lod.core.a7.datatype.LodRenderSource;
|
||||
import com.seibel.lod.core.a7.datatype.RenderSourceLoader;
|
||||
import com.seibel.lod.core.a7.datatype.full.ChunkSizedData;
|
||||
import com.seibel.lod.core.a7.datatype.transform.DataRenderTransformer;
|
||||
import com.seibel.lod.core.a7.level.IClientLevel;
|
||||
import com.seibel.lod.core.a7.level.ILevel;
|
||||
import com.seibel.lod.core.a7.pos.DhLodPos;
|
||||
import com.seibel.lod.core.a7.save.io.MetaFile;
|
||||
import com.seibel.lod.core.a7.pos.DhSectionPos;
|
||||
import com.seibel.lod.core.datatype.LodDataSource;
|
||||
import com.seibel.lod.core.datatype.LodRenderSource;
|
||||
import com.seibel.lod.core.datatype.RenderSourceLoader;
|
||||
import com.seibel.lod.core.datatype.full.ChunkSizedData;
|
||||
import com.seibel.lod.core.level.IClientLevel;
|
||||
import com.seibel.lod.core.level.ILevel;
|
||||
import com.seibel.lod.core.pos.DhLodPos;
|
||||
import com.seibel.lod.core.io.MetaFile;
|
||||
import com.seibel.lod.core.pos.DhSectionPos;
|
||||
import com.seibel.lod.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.lod.core.a7.save.io.file.DataMetaFile;
|
||||
import com.seibel.lod.core.a7.save.io.file.IDataSourceProvider;
|
||||
import com.seibel.lod.core.util.LodUtil;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
+4
-4
@@ -1,10 +1,10 @@
|
||||
package com.seibel.lod.core.a7.save.structure;
|
||||
package com.seibel.lod.core.io.structure;
|
||||
|
||||
import com.seibel.lod.core.a7.save.io.LevelToFileMatcher;
|
||||
import com.seibel.lod.core.io.LevelToFileMatcher;
|
||||
import com.seibel.lod.core.config.Config;
|
||||
import com.seibel.lod.core.enums.config.EServerFolderNameMode;
|
||||
import com.seibel.lod.core.handlers.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.lod.core.objects.ParsedIp;
|
||||
import com.seibel.lod.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.lod.core.ParsedIp;
|
||||
import com.seibel.lod.core.util.LodUtil;
|
||||
import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.world.ILevelWrapper;
|
||||
+1
-3
@@ -1,7 +1,5 @@
|
||||
package com.seibel.lod.core.a7.save.structure;
|
||||
package com.seibel.lod.core.io.structure;
|
||||
|
||||
import com.seibel.lod.core.handlers.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftSharedWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.world.ILevelWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.world.IServerLevelWrapper;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.seibel.lod.core.a7.save.structure;
|
||||
package com.seibel.lod.core.io.structure;
|
||||
|
||||
import com.seibel.lod.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.lod.core.wrapperInterfaces.world.ILevelWrapper;
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.seibel.lod.core.jar;
|
||||
|
||||
import com.seibel.lod.core.handlers.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.lod.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.lod.core.jar.wrapperInterfaces.config.ConfigWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.config.IConfigWrapper;
|
||||
|
||||
|
||||
@@ -3,8 +3,7 @@ package com.seibel.lod.core.jar.gui;
|
||||
import com.formdev.flatlaf.FlatDarkLaf;
|
||||
import com.formdev.flatlaf.FlatLightLaf;
|
||||
import com.formdev.flatlaf.extras.FlatSVGIcon;
|
||||
import com.seibel.lod.core.JarMain;
|
||||
import com.seibel.lod.core.handlers.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.lod.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.lod.core.jar.JarUtils;
|
||||
import com.seibel.lod.core.wrapperInterfaces.config.IConfigWrapper;
|
||||
|
||||
|
||||
+16
-16
@@ -1,18 +1,18 @@
|
||||
package com.seibel.lod.core.a7.level;
|
||||
package com.seibel.lod.core.level;
|
||||
|
||||
import com.seibel.lod.core.a7.render.LodQuadTree;
|
||||
import com.seibel.lod.core.a7.util.FileScanner;
|
||||
import com.seibel.lod.core.a7.save.io.file.RemoteDataFileHandler;
|
||||
import com.seibel.lod.core.a7.save.io.render.RenderFileHandler;
|
||||
import com.seibel.lod.core.a7.pos.DhBlockPos2D;
|
||||
import com.seibel.lod.core.a7.render.RenderBufferHandler;
|
||||
import com.seibel.lod.core.a7.save.structure.ClientOnlySaveStructure;
|
||||
import com.seibel.lod.core.render.LodQuadTree;
|
||||
import com.seibel.lod.core.util.FileScanUtil;
|
||||
import com.seibel.lod.core.io.datafile.RemoteDataFileHandler;
|
||||
import com.seibel.lod.core.io.renderfile.RenderFileHandler;
|
||||
import com.seibel.lod.core.pos.DhBlockPos2D;
|
||||
import com.seibel.lod.core.render.RenderBufferHandler;
|
||||
import com.seibel.lod.core.io.structure.ClientOnlySaveStructure;
|
||||
import com.seibel.lod.core.config.Config;
|
||||
import com.seibel.lod.core.handlers.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.lod.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.lod.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.lod.core.objects.DHBlockPos;
|
||||
import com.seibel.lod.core.objects.math.Mat4f;
|
||||
import com.seibel.lod.core.a7.render.a7LodRenderer;
|
||||
import com.seibel.lod.core.pos.DhBlockPos;
|
||||
import com.seibel.lod.core.util.math.Mat4f;
|
||||
import com.seibel.lod.core.render.renderer.LodRenderer;
|
||||
import com.seibel.lod.core.wrapperInterfaces.block.IBlockStateWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.minecraft.IProfilerWrapper;
|
||||
@@ -31,7 +31,7 @@ public class DhClientLevel implements IClientLevel {
|
||||
public final RenderFileHandler renderFileHandler;
|
||||
public final RenderBufferHandler renderBufferHandler; //TODO: Should this be owned by renderer?
|
||||
public final IClientLevelWrapper level;
|
||||
public a7LodRenderer renderer = null;
|
||||
public LodRenderer renderer = null;
|
||||
public LodQuadTree tree;
|
||||
|
||||
public DhClientLevel(ClientOnlySaveStructure save, IClientLevelWrapper level) {
|
||||
@@ -44,7 +44,7 @@ public class DhClientLevel implements IClientLevel {
|
||||
MC_CLIENT.getPlayerBlockPos().x, MC_CLIENT.getPlayerBlockPos().z, renderFileHandler);
|
||||
renderBufferHandler = new RenderBufferHandler(tree);
|
||||
this.level = level;
|
||||
FileScanner.scanFile(save, level, dataFileHandler, renderFileHandler);
|
||||
FileScanUtil.scanFile(save, level, dataFileHandler, renderFileHandler);
|
||||
LOGGER.info("Started DHLevel for {} with saves at {}", level, save);
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public class DhClientLevel implements IClientLevel {
|
||||
@Override
|
||||
public void render(Mat4f mcModelViewMatrix, Mat4f mcProjectionMatrix, float partialTicks, IProfilerWrapper profiler) {
|
||||
if (renderer == null) {
|
||||
renderer = new a7LodRenderer(this);
|
||||
renderer = new LodRenderer(this);
|
||||
}
|
||||
renderer.drawLODs(mcModelViewMatrix, mcProjectionMatrix, partialTicks, profiler);
|
||||
}
|
||||
@@ -74,7 +74,7 @@ public class DhClientLevel implements IClientLevel {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int computeBaseColor(DHBlockPos pos, IBiomeWrapper biome, IBlockStateWrapper block) {
|
||||
public int computeBaseColor(DhBlockPos pos, IBiomeWrapper biome, IBlockStateWrapper block) {
|
||||
return 0; //TODO
|
||||
}
|
||||
|
||||
+19
-19
@@ -1,21 +1,21 @@
|
||||
package com.seibel.lod.core.a7.level;
|
||||
package com.seibel.lod.core.level;
|
||||
|
||||
import com.seibel.lod.core.a7.generation.GenerationQueue;
|
||||
import com.seibel.lod.core.a7.render.LodQuadTree;
|
||||
import com.seibel.lod.core.a7.save.io.file.GeneratedDataFileHandler;
|
||||
import com.seibel.lod.core.a7.util.FileScanner;
|
||||
import com.seibel.lod.core.a7.save.io.render.RenderFileHandler;
|
||||
import com.seibel.lod.core.a7.pos.DhBlockPos2D;
|
||||
import com.seibel.lod.core.a7.render.RenderBufferHandler;
|
||||
import com.seibel.lod.core.a7.save.structure.LocalSaveStructure;
|
||||
import com.seibel.lod.core.builders.worldGeneration.BatchGenerator;
|
||||
import com.seibel.lod.core.generation.GenerationQueue;
|
||||
import com.seibel.lod.core.render.LodQuadTree;
|
||||
import com.seibel.lod.core.io.datafile.GeneratedDataFileHandler;
|
||||
import com.seibel.lod.core.util.FileScanUtil;
|
||||
import com.seibel.lod.core.io.renderfile.RenderFileHandler;
|
||||
import com.seibel.lod.core.pos.DhBlockPos2D;
|
||||
import com.seibel.lod.core.render.RenderBufferHandler;
|
||||
import com.seibel.lod.core.io.structure.LocalSaveStructure;
|
||||
import com.seibel.lod.core.generation.BatchGenerator;
|
||||
import com.seibel.lod.core.config.Config;
|
||||
import com.seibel.lod.core.handlers.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.lod.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.lod.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.lod.core.logging.f3.F3Screen;
|
||||
import com.seibel.lod.core.objects.DHBlockPos;
|
||||
import com.seibel.lod.core.objects.math.Mat4f;
|
||||
import com.seibel.lod.core.a7.render.a7LodRenderer;
|
||||
import com.seibel.lod.core.pos.DhBlockPos;
|
||||
import com.seibel.lod.core.util.math.Mat4f;
|
||||
import com.seibel.lod.core.render.renderer.LodRenderer;
|
||||
import com.seibel.lod.core.util.LodUtil;
|
||||
import com.seibel.lod.core.wrapperInterfaces.block.IBlockStateWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
||||
@@ -39,7 +39,7 @@ public class DhClientServerLevel implements IClientLevel, IServerLevel {
|
||||
public RenderBufferHandler renderBufferHandler = null; //TODO: Should this be owned by renderer?
|
||||
public final IServerLevelWrapper serverLevel;
|
||||
public IClientLevelWrapper clientLevel;
|
||||
public a7LodRenderer renderer = null;
|
||||
public LodRenderer renderer = null;
|
||||
public LodQuadTree tree = null;
|
||||
public volatile BatchGenerator worldGenerator = null;
|
||||
private final ReentrantLock renderStateLifecycleLock = new ReentrantLock();
|
||||
@@ -52,7 +52,7 @@ public class DhClientServerLevel implements IClientLevel, IServerLevel {
|
||||
save.getDataFolder(level).mkdirs();
|
||||
save.getRenderCacheFolder(level).mkdirs();
|
||||
dataFileHandler = new GeneratedDataFileHandler(this, save.getDataFolder(level));
|
||||
FileScanner.scanFile(save, serverLevel, dataFileHandler, null);
|
||||
FileScanUtil.scanFile(save, serverLevel, dataFileHandler, null);
|
||||
LOGGER.info("Started DHLevel for {} with saves at {}", level, save);
|
||||
f3Msg = new F3Screen.NestedMessage(this::f3Log);
|
||||
}
|
||||
@@ -108,7 +108,7 @@ public class DhClientServerLevel implements IClientLevel, IServerLevel {
|
||||
tree = new LodQuadTree(this, Config.Client.Graphics.Quality.lodChunkRenderDistance.get() * 16,
|
||||
MC_CLIENT.getPlayerBlockPos().x, MC_CLIENT.getPlayerBlockPos().z, renderFileHandler);
|
||||
renderBufferHandler = new RenderBufferHandler(tree);
|
||||
FileScanner.scanFile(save, serverLevel, null, renderFileHandler);
|
||||
FileScanUtil.scanFile(save, serverLevel, null, renderFileHandler);
|
||||
} finally {
|
||||
renderStateLifecycleLock.unlock();
|
||||
}
|
||||
@@ -123,7 +123,7 @@ public class DhClientServerLevel implements IClientLevel, IServerLevel {
|
||||
return;
|
||||
}
|
||||
if (renderer == null) {
|
||||
renderer = new a7LodRenderer(this);
|
||||
renderer = new LodRenderer(this);
|
||||
}
|
||||
renderer.drawLODs(mcModelViewMatrix, mcProjectionMatrix, partialTicks, profiler);
|
||||
} finally {
|
||||
@@ -172,7 +172,7 @@ public class DhClientServerLevel implements IClientLevel, IServerLevel {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int computeBaseColor(DHBlockPos pos, IBiomeWrapper biome, IBlockStateWrapper block) {
|
||||
public int computeBaseColor(DhBlockPos pos, IBiomeWrapper biome, IBlockStateWrapper block) {
|
||||
return clientLevel.computeBaseColor(pos, biome, block);
|
||||
}
|
||||
|
||||
+5
-6
@@ -1,9 +1,8 @@
|
||||
package com.seibel.lod.core.a7.level;
|
||||
package com.seibel.lod.core.level;
|
||||
|
||||
import com.seibel.lod.core.a7.save.io.file.RemoteDataFileHandler;
|
||||
import com.seibel.lod.core.a7.util.FileScanner;
|
||||
import com.seibel.lod.core.a7.save.io.file.DataFileHandler;
|
||||
import com.seibel.lod.core.a7.save.structure.LocalSaveStructure;
|
||||
import com.seibel.lod.core.util.FileScanUtil;
|
||||
import com.seibel.lod.core.io.datafile.DataFileHandler;
|
||||
import com.seibel.lod.core.io.structure.LocalSaveStructure;
|
||||
import com.seibel.lod.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.lod.core.wrapperInterfaces.world.ILevelWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.world.IServerLevelWrapper;
|
||||
@@ -24,7 +23,7 @@ public class DhServerLevel implements IServerLevel
|
||||
this.level = level;
|
||||
save.getDataFolder(level).mkdirs();
|
||||
dataFileHandler = new DataFileHandler(this, save.getDataFolder(level)); //FIXME: GenerationQueue
|
||||
FileScanner.scanFile(save, level, dataFileHandler, null);
|
||||
FileScanUtil.scanFile(save, level, dataFileHandler, null);
|
||||
LOGGER.info("Started DHLevel for {} with saves at {}", level, save);
|
||||
}
|
||||
|
||||
+5
-5
@@ -1,8 +1,8 @@
|
||||
package com.seibel.lod.core.a7.level;
|
||||
package com.seibel.lod.core.level;
|
||||
|
||||
import com.seibel.lod.core.a7.render.RenderBufferHandler;
|
||||
import com.seibel.lod.core.objects.DHBlockPos;
|
||||
import com.seibel.lod.core.objects.math.Mat4f;
|
||||
import com.seibel.lod.core.render.RenderBufferHandler;
|
||||
import com.seibel.lod.core.pos.DhBlockPos;
|
||||
import com.seibel.lod.core.util.math.Mat4f;
|
||||
import com.seibel.lod.core.wrapperInterfaces.block.IBlockStateWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.minecraft.IProfilerWrapper;
|
||||
import com.seibel.lod.core.wrapperInterfaces.world.IBiomeWrapper;
|
||||
@@ -18,7 +18,7 @@ public interface IClientLevel extends ILevel {
|
||||
|
||||
RenderBufferHandler getRenderBufferHandler();
|
||||
|
||||
int computeBaseColor(DHBlockPos pos, IBiomeWrapper biome, IBlockStateWrapper block);
|
||||
int computeBaseColor(DhBlockPos pos, IBiomeWrapper biome, IBlockStateWrapper block);
|
||||
|
||||
IClientLevelWrapper getClientLevelWrapper();
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.seibel.lod.core.a7.level;
|
||||
package com.seibel.lod.core.level;
|
||||
|
||||
import com.seibel.lod.core.wrapperInterfaces.world.ILevelWrapper;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.seibel.lod.core.a7.level;
|
||||
package com.seibel.lod.core.level;
|
||||
|
||||
import com.seibel.lod.core.wrapperInterfaces.world.IServerLevelWrapper;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
package com.seibel.lod.core.logging;
|
||||
|
||||
import com.seibel.lod.core.enums.config.ELoggerMode;
|
||||
import com.seibel.lod.core.handlers.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.lod.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
||||
import org.apache.logging.log4j.Level;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
package com.seibel.lod.core.logging;
|
||||
|
||||
import com.seibel.lod.core.enums.config.ELoggerMode;
|
||||
import com.seibel.lod.core.handlers.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.lod.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
||||
import org.apache.logging.log4j.Level;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.seibel.lod.core.logging.f3;
|
||||
|
||||
import com.seibel.lod.core.ModInfo;
|
||||
import com.seibel.lod.core.a7.datatype.column.accessor.ColumnArrayView;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.Arrays;
|
||||
|
||||
+12
-14
@@ -17,13 +17,11 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.lod.core.objects;
|
||||
|
||||
import com.seibel.lod.core.a7.pos.DhBlockPos2D;
|
||||
package com.seibel.lod.core.pos;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class DHBlockPos {
|
||||
public class DhBlockPos {
|
||||
public static final boolean DO_CHECKS = false;
|
||||
|
||||
// 26 bits wide as that just encompasses the maximum possible value
|
||||
@@ -46,19 +44,19 @@ public class DHBlockPos {
|
||||
public final int y;
|
||||
public final int z;
|
||||
|
||||
public DHBlockPos(int x, int y, int z) {
|
||||
public DhBlockPos(int x, int y, int z) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
public DHBlockPos() {
|
||||
public DhBlockPos() {
|
||||
this(0, 0, 0);
|
||||
}
|
||||
public DHBlockPos(DHBlockPos pos) {
|
||||
public DhBlockPos(DhBlockPos pos) {
|
||||
this(pos.x, pos.y, pos.z);
|
||||
}
|
||||
|
||||
public DHBlockPos(DhBlockPos2D pos, int y) {
|
||||
public DhBlockPos(DhBlockPos2D pos, int y) {
|
||||
this(pos.x, y, pos.z);
|
||||
}
|
||||
|
||||
@@ -104,7 +102,7 @@ public class DHBlockPos {
|
||||
public static int getZ(long packed) { // Z is at the middle
|
||||
return (int)(packed <<(64 - PACKED_Z_OFFSET - PACKED_Z_LENGTH) >> (64 - PACKED_Z_LENGTH));
|
||||
}
|
||||
public DHBlockPos(long packed) {
|
||||
public DhBlockPos(long packed) {
|
||||
this(getX(packed), getY(packed), getZ(packed));
|
||||
}
|
||||
|
||||
@@ -112,12 +110,12 @@ public class DHBlockPos {
|
||||
return asLong(x, y, z);
|
||||
}
|
||||
|
||||
public DHBlockPos offset(int x, int y, int z)
|
||||
public DhBlockPos offset(int x, int y, int z)
|
||||
{
|
||||
return new DHBlockPos(this.x + x, this.y + y, this.z + z);
|
||||
return new DhBlockPos(this.x + x, this.y + y, this.z + z);
|
||||
}
|
||||
|
||||
public int getManhattanDistance(DHBlockPos otherPos)
|
||||
public int getManhattanDistance(DhBlockPos otherPos)
|
||||
{
|
||||
return Math.abs(this.getX() - otherPos.getX()) + Math.abs(this.getY() - otherPos.getY()) + Math.abs(this.getZ() - otherPos.getZ());
|
||||
}
|
||||
@@ -126,7 +124,7 @@ public class DHBlockPos {
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
DHBlockPos that = (DHBlockPos) o;
|
||||
DhBlockPos that = (DhBlockPos) o;
|
||||
return x == that.x && y == that.y && z == that.z;
|
||||
}
|
||||
|
||||
@@ -148,7 +146,7 @@ public class DHBlockPos {
|
||||
if (packed != expected) {
|
||||
throw new IllegalArgumentException("Packed values don't match: " + packed + " != " + expected);
|
||||
}
|
||||
DHBlockPos pos = new DHBlockPos(packed);
|
||||
DhBlockPos pos = new DhBlockPos(packed);
|
||||
if (pos.getX() != x || pos.getY() != y || pos.getZ() != z) {
|
||||
throw new IllegalArgumentException("Values after decode don't match: " + pos + " != " + x + ", " + y + ", " + z);
|
||||
}
|
||||
+2
-6
@@ -1,11 +1,7 @@
|
||||
package com.seibel.lod.core.a7.pos;
|
||||
package com.seibel.lod.core.pos;
|
||||
|
||||
import com.seibel.lod.core.objects.DHBlockPos;
|
||||
import com.seibel.lod.core.objects.Pos2D;
|
||||
import com.seibel.lod.core.util.LodUtil;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class DhBlockPos2D {
|
||||
public final int x;
|
||||
public final int z;
|
||||
@@ -14,7 +10,7 @@ public class DhBlockPos2D {
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
public DhBlockPos2D(DHBlockPos blockPos) {
|
||||
public DhBlockPos2D(DhBlockPos blockPos) {
|
||||
this.x = blockPos.x;
|
||||
this.z = blockPos.z;
|
||||
}
|
||||
+12
-13
@@ -17,37 +17,36 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.lod.core.objects;
|
||||
package com.seibel.lod.core.pos;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import com.seibel.lod.core.a7.pos.DhBlockPos2D;
|
||||
import com.seibel.lod.core.util.LevelPosUtil;
|
||||
import com.seibel.lod.core.util.LodUtil;
|
||||
|
||||
public class DHChunkPos {
|
||||
public class DhChunkPos {
|
||||
public final int x; // Low 32 bits
|
||||
public final int z; // High 32 bits
|
||||
|
||||
public DHChunkPos(int x, int z) {
|
||||
public DhChunkPos(int x, int z) {
|
||||
this.x = x;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
public DHChunkPos(DHBlockPos blockPos) {
|
||||
public DhChunkPos(DhBlockPos blockPos) {
|
||||
this.x = blockPos.x >> 4; // Same as div 16
|
||||
this.z = blockPos.z >> 4; // Same as div 16
|
||||
}
|
||||
public DHChunkPos(DhBlockPos2D blockPos) {
|
||||
public DhChunkPos(DhBlockPos2D blockPos) {
|
||||
this.x = blockPos.x >> 4; // Same as div 16
|
||||
this.z = blockPos.z >> 4; // Same as div 16
|
||||
}
|
||||
|
||||
public DHBlockPos center() {
|
||||
return new DHBlockPos(8 + x << 4, 0, 8 + z << 4);
|
||||
public DhBlockPos center() {
|
||||
return new DhBlockPos(8 + x << 4, 0, 8 + z << 4);
|
||||
}
|
||||
public DHBlockPos corner() {
|
||||
return new DHBlockPos(x << 4, 0, z << 4);
|
||||
public DhBlockPos corner() {
|
||||
return new DhBlockPos(x << 4, 0, z << 4);
|
||||
}
|
||||
|
||||
public static long toLong(int x, int z) {
|
||||
@@ -61,7 +60,7 @@ public class DHChunkPos {
|
||||
return (int)(chunkPos & 0xFFFFFFFFL);
|
||||
}
|
||||
|
||||
public DHChunkPos(long packed) {
|
||||
public DhChunkPos(long packed) {
|
||||
this(getX(packed), getZ(packed));
|
||||
}
|
||||
|
||||
@@ -110,7 +109,7 @@ public class DHChunkPos {
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
DHChunkPos that = (DHChunkPos) o;
|
||||
DhChunkPos that = (DhChunkPos) o;
|
||||
return x == that.x && z == that.z;
|
||||
}
|
||||
|
||||
@@ -130,7 +129,7 @@ public class DHChunkPos {
|
||||
if (packed != expected) {
|
||||
throw new IllegalArgumentException("Packed values don't match: " + packed + " != " + expected);
|
||||
}
|
||||
DHChunkPos pos = new DHChunkPos(packed);
|
||||
DhChunkPos pos = new DhChunkPos(packed);
|
||||
if (pos.x != x || pos.z != z) {
|
||||
throw new IllegalArgumentException("Values after decode don't match: " + pos + " != " + x + ", " + z);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user