mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-26 10:39:07 +00:00
Cleanup
This commit is contained in:
@@ -19,7 +19,6 @@
|
||||
package com.volmit.iris.core.loader;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.engine.object.IrisObject;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.collection.KMap;
|
||||
import com.volmit.iris.util.collection.KSet;
|
||||
@@ -56,7 +55,7 @@ public class MatterResourceLoader extends ResourceLoader<IrisMatter> {
|
||||
}
|
||||
|
||||
public int getTotalStorage() {
|
||||
return getSize();
|
||||
return getSize();
|
||||
}
|
||||
|
||||
public void clean() {
|
||||
|
||||
@@ -187,7 +187,7 @@ public class IrisProject {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
updateWorkspace();
|
||||
if (!doOpenVSCode(f)){
|
||||
if (!doOpenVSCode(f)) {
|
||||
Iris.warn("Tried creating code workspace but failed a second time. Your project is likely corrupt.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,15 @@ import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.loader.IrisData;
|
||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||
import com.volmit.iris.engine.framework.Engine;
|
||||
import com.volmit.iris.engine.object.*;
|
||||
import com.volmit.iris.engine.object.IObjectPlacer;
|
||||
import com.volmit.iris.engine.object.IrisBiome;
|
||||
import com.volmit.iris.engine.object.IrisDimension;
|
||||
import com.volmit.iris.engine.object.IrisObject;
|
||||
import com.volmit.iris.engine.object.IrisObjectPlacement;
|
||||
import com.volmit.iris.engine.object.IrisRegion;
|
||||
import com.volmit.iris.engine.object.IrisTreeModes;
|
||||
import com.volmit.iris.engine.object.IrisTreeSize;
|
||||
import com.volmit.iris.engine.object.TileData;
|
||||
import com.volmit.iris.engine.platform.PlatformChunkGenerator;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.collection.KMap;
|
||||
|
||||
@@ -87,8 +87,7 @@ public class IrisToolbelt {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(world.getGenerator() instanceof PlatformChunkGenerator f)
|
||||
{
|
||||
if (world.getGenerator() instanceof PlatformChunkGenerator f) {
|
||||
f.touch(world);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ package com.volmit.iris.engine;
|
||||
import com.google.common.util.concurrent.AtomicDouble;
|
||||
import com.google.gson.Gson;
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.IrisSettings;
|
||||
import com.volmit.iris.core.events.IrisEngineHotloadEvent;
|
||||
import com.volmit.iris.core.project.IrisProject;
|
||||
import com.volmit.iris.core.service.PreservationSVC;
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
package com.volmit.iris.engine.mantle.components;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.engine.jigsaw.PlannedStructure;
|
||||
import com.volmit.iris.engine.mantle.EngineMantle;
|
||||
import com.volmit.iris.engine.mantle.IrisMantleComponent;
|
||||
|
||||
@@ -188,8 +188,7 @@ public class IrisEntity extends IrisRegistrant {
|
||||
AtomicReference<Location> f = new AtomicReference<>(at);
|
||||
try {
|
||||
J.sfut(() -> {
|
||||
if(Chunks.hasPlayersNearby(f.get()))
|
||||
{
|
||||
if (Chunks.hasPlayersNearby(f.get())) {
|
||||
Location b = f.get().clone();
|
||||
Location start = new Location(b.getWorld(), b.getX(), b.getY() - 5, b.getZ());
|
||||
f.set(start);
|
||||
|
||||
@@ -56,6 +56,7 @@ public class IrisFeaturePositional {
|
||||
private IrisFeature feature;
|
||||
|
||||
private transient AtomicCache<NoiseProvider> provider = new AtomicCache<>();
|
||||
|
||||
public IrisFeaturePositional(int x, int z, IrisFeature feature) {
|
||||
this.x = x;
|
||||
this.z = z;
|
||||
|
||||
@@ -21,7 +21,6 @@ package com.volmit.iris.util.api;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
@FunctionalInterface
|
||||
public interface APIAwareBlock
|
||||
{
|
||||
public interface APIAwareBlock {
|
||||
void onPlaced(BlockData block, String namespace, String key, int x, int y, int z);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ package com.volmit.iris.util.api;
|
||||
import org.bukkit.block.Block;
|
||||
|
||||
@FunctionalInterface
|
||||
public interface APIWorldBlock
|
||||
{
|
||||
public interface APIWorldBlock {
|
||||
void onWorldPlaced(Block block, String namespace, String key);
|
||||
}
|
||||
@@ -35,10 +35,8 @@ import org.bukkit.block.data.Waterlogged;
|
||||
import org.bukkit.block.data.type.Leaves;
|
||||
import org.bukkit.block.data.type.PointedDripstone;
|
||||
|
||||
import javax.imageio.spi.RegisterableService;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -436,34 +434,26 @@ public class B {
|
||||
try {
|
||||
BlockData bx = null;
|
||||
|
||||
if(!ix.startsWith("minecraft:"))
|
||||
{
|
||||
if (ix.startsWith("oraxen:") && Iris.linkOraxen.supported()) {
|
||||
bx = Iris.linkOraxen.getBlockDataFor(ix.split("\\Q:\\E")[1]);
|
||||
}
|
||||
if (!ix.startsWith("minecraft:")) {
|
||||
if (ix.startsWith("oraxen:") && Iris.linkOraxen.supported()) {
|
||||
bx = Iris.linkOraxen.getBlockDataFor(ix.split("\\Q:\\E")[1]);
|
||||
}
|
||||
|
||||
if(bx == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
if(ix.contains(":"))
|
||||
{
|
||||
String[] v = ix.toLowerCase().split("\\Q:\\E");
|
||||
Supplier<BlockData> b = Iris.service(RegistrySVC.class).getCustomBlockRegistry().resolve(v[0], v[1]);
|
||||
if (bx == null) {
|
||||
try {
|
||||
if (ix.contains(":")) {
|
||||
String[] v = ix.toLowerCase().split("\\Q:\\E");
|
||||
Supplier<BlockData> b = Iris.service(RegistrySVC.class).getCustomBlockRegistry().resolve(v[0], v[1]);
|
||||
|
||||
if(b != null)
|
||||
{
|
||||
bx = b.get();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
catch(Throwable e)
|
||||
{
|
||||
e.printStackTrace();// TODO: REMOVE
|
||||
}
|
||||
}
|
||||
}
|
||||
if (b != null) {
|
||||
bx = b.get();
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();// TODO: REMOVE
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (bx == null) {
|
||||
try {
|
||||
|
||||
@@ -754,7 +754,7 @@ public interface Hunk<T> {
|
||||
for (int i = 0; i < getWidth(); i++) {
|
||||
for (int j = 0; j < getHeight(); j++) {
|
||||
for (int k = 0; k < getDepth(); k++) {
|
||||
set(i,j,k,c.apply(i, j, k, get(i, j, k)));
|
||||
set(i, j, k, c.apply(i, j, k, get(i, j, k)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@ import com.volmit.iris.util.documentation.RegionCoordinates;
|
||||
import com.volmit.iris.util.format.C;
|
||||
import com.volmit.iris.util.format.Form;
|
||||
import com.volmit.iris.util.function.Consumer4;
|
||||
import com.volmit.iris.util.math.AxisAlignedBB;
|
||||
import com.volmit.iris.util.math.M;
|
||||
import com.volmit.iris.util.matter.Matter;
|
||||
import com.volmit.iris.util.matter.MatterSlice;
|
||||
@@ -508,11 +507,10 @@ public class Mantle {
|
||||
}
|
||||
|
||||
public <T> void set(int x, int y, int z, MatterSlice<T> slice) {
|
||||
if(slice.isEmpty())
|
||||
{
|
||||
if (slice.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
slice.iterateSync((xx,yy,zz,t) -> set(x+xx,y+yy,z+zz,t));
|
||||
slice.iterateSync((xx, yy, zz, t) -> set(x + xx, y + yy, z + zz, t));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,9 +21,7 @@ package com.volmit.iris.util.matter;
|
||||
import com.volmit.iris.engine.object.IrisObject;
|
||||
import com.volmit.iris.engine.object.IrisPosition;
|
||||
import com.volmit.iris.util.collection.KSet;
|
||||
import com.volmit.iris.util.data.B;
|
||||
import com.volmit.iris.util.data.Varint;
|
||||
import com.volmit.iris.util.decree.annotations.Param;
|
||||
import com.volmit.iris.util.hunk.Hunk;
|
||||
import com.volmit.iris.util.math.BlockPosition;
|
||||
import org.bukkit.World;
|
||||
@@ -40,7 +38,6 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
|
||||
@@ -62,8 +59,7 @@ import java.util.function.Function;
|
||||
public interface Matter {
|
||||
int VERSION = 1;
|
||||
|
||||
static Matter from(IrisObject object)
|
||||
{
|
||||
static Matter from(IrisObject object) {
|
||||
object.clean();
|
||||
object.shrinkwrap();
|
||||
BlockVector min = new BlockVector();
|
||||
@@ -89,10 +85,9 @@ public interface Matter {
|
||||
return m;
|
||||
}
|
||||
|
||||
default Matter copy()
|
||||
{
|
||||
default Matter copy() {
|
||||
Matter m = new IrisMatter(getWidth(), getHeight(), getDepth());
|
||||
getSliceMap().forEach((k,v) -> m.slice(k).forceInject(v));
|
||||
getSliceMap().forEach((k, v) -> m.slice(k).forceInject(v));
|
||||
return m;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,36 +25,29 @@ public interface MatterPlacer {
|
||||
|
||||
Mantle getMantle();
|
||||
|
||||
default <T> void set(int x, int y, int z, T t)
|
||||
{
|
||||
getMantle().set(x,y,z,t);
|
||||
default <T> void set(int x, int y, int z, T t) {
|
||||
getMantle().set(x, y, z, t);
|
||||
}
|
||||
|
||||
default <T> T get(int x, int y, int z, Class<T> t)
|
||||
{
|
||||
default <T> T get(int x, int y, int z, Class<T> t) {
|
||||
return getMantle().get(x, y, z, t);
|
||||
}
|
||||
|
||||
default void set(int x, int y, int z, Matter matter)
|
||||
{
|
||||
for(MatterSlice<?> i : matter.getSliceMap().values())
|
||||
{
|
||||
default void set(int x, int y, int z, Matter matter) {
|
||||
for (MatterSlice<?> i : matter.getSliceMap().values()) {
|
||||
set(x, y, z, i);
|
||||
}
|
||||
}
|
||||
|
||||
default <T> void set(int x, int y, int z, MatterSlice<T> slice)
|
||||
{
|
||||
default <T> void set(int x, int y, int z, MatterSlice<T> slice) {
|
||||
getMantle().set(x, y, z, slice);
|
||||
}
|
||||
|
||||
default int getHeight(int x, int z)
|
||||
{
|
||||
default int getHeight(int x, int z) {
|
||||
return getHeight(x, z, true);
|
||||
}
|
||||
|
||||
default int getHeightOrFluid(int x, int z)
|
||||
{
|
||||
default int getHeightOrFluid(int x, int z) {
|
||||
return getHeight(x, z, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,18 +34,15 @@ import java.io.IOException;
|
||||
public interface MatterSlice<T> extends Hunk<T> {
|
||||
Class<T> getType();
|
||||
|
||||
default void applyFilter(MatterFilter<T> filter)
|
||||
{
|
||||
default void applyFilter(MatterFilter<T> filter) {
|
||||
updateSync(filter::update);
|
||||
}
|
||||
|
||||
default void inject(MatterSlice<T> slice)
|
||||
{
|
||||
default void inject(MatterSlice<T> slice) {
|
||||
iterateSync(slice::set);
|
||||
}
|
||||
|
||||
default void forceInject(MatterSlice<?> slice)
|
||||
{
|
||||
default void forceInject(MatterSlice<?> slice) {
|
||||
inject((MatterSlice<T>) slice);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,39 +29,32 @@ public class PluginRegistry<T> {
|
||||
@Getter
|
||||
private final String namespace;
|
||||
|
||||
public void unregisterAll()
|
||||
{
|
||||
public void unregisterAll() {
|
||||
registry.clear();
|
||||
}
|
||||
|
||||
public KList<String> getRegistries()
|
||||
{
|
||||
public KList<String> getRegistries() {
|
||||
return registry.k();
|
||||
}
|
||||
|
||||
public T get(String s)
|
||||
{
|
||||
if(!registry.containsKey(s))
|
||||
{
|
||||
public T get(String s) {
|
||||
if (!registry.containsKey(s)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return registry.get(s);
|
||||
}
|
||||
|
||||
public void register(String s, T t)
|
||||
{
|
||||
public void register(String s, T t) {
|
||||
registry.put(s, t);
|
||||
}
|
||||
|
||||
public void unregister(String s)
|
||||
{
|
||||
public void unregister(String s) {
|
||||
registry.remove(s);
|
||||
}
|
||||
|
||||
public T resolve(String id) {
|
||||
if(registry.isEmpty())
|
||||
{
|
||||
if (registry.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,39 +20,32 @@ package com.volmit.iris.util.plugin;
|
||||
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.collection.KMap;
|
||||
import org.bukkit.Material;
|
||||
|
||||
public class PluginRegistryGroup<T> {
|
||||
private final KMap<String, PluginRegistry<T>> registries = new KMap<>();
|
||||
|
||||
public T resolve(String namespace, String id)
|
||||
{
|
||||
if(registries.isEmpty())
|
||||
{
|
||||
public T resolve(String namespace, String id) {
|
||||
if (registries.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
PluginRegistry<T> r = registries.get(namespace);
|
||||
if(r == null)
|
||||
{
|
||||
if (r == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return r.resolve(id);
|
||||
}
|
||||
|
||||
public void clearRegistries()
|
||||
{
|
||||
public void clearRegistries() {
|
||||
registries.clear();
|
||||
}
|
||||
|
||||
public void removeRegistry(String namespace)
|
||||
{
|
||||
public void removeRegistry(String namespace) {
|
||||
registries.remove(namespace);
|
||||
}
|
||||
|
||||
public PluginRegistry<T> getRegistry(String namespace)
|
||||
{
|
||||
public PluginRegistry<T> getRegistry(String namespace) {
|
||||
return registries.computeIfAbsent(namespace, PluginRegistry::new);
|
||||
}
|
||||
|
||||
|
||||
@@ -166,6 +166,7 @@ public class TaskExecutor {
|
||||
public final int tasksExecuted;
|
||||
public final int tasksFailed;
|
||||
public final int tasksCompleted;
|
||||
|
||||
public TaskResult(double timeElapsed, int tasksExecuted, int tasksFailed, int tasksCompleted) {
|
||||
this.timeElapsed = timeElapsed;
|
||||
this.tasksExecuted = tasksExecuted;
|
||||
|
||||
Reference in New Issue
Block a user