mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 02:03:59 +00:00
Cleanup
This commit is contained in:
parent
90f0a5eac6
commit
8e16b8e4a8
@ -172,17 +172,15 @@ public class CommandIris implements DecreeExecutor {
|
||||
@Decree(name = "regen", description = "Regenerate nearby chunks.", aliases = "rg", sync = true, origin = DecreeOrigin.PLAYER)
|
||||
public void regen(
|
||||
@Param(name = "radius", description = "The radius of nearby cunks", defaultValue = "5")
|
||||
int radius
|
||||
int radius
|
||||
) {
|
||||
if(IrisToolbelt.isIrisWorld(player().getWorld()))
|
||||
{
|
||||
if (IrisToolbelt.isIrisWorld(player().getWorld())) {
|
||||
VolmitSender sender = sender();
|
||||
J.a(() -> {
|
||||
DecreeContext.touch(sender);
|
||||
PlatformChunkGenerator plat = IrisToolbelt.access(player().getWorld());
|
||||
Engine engine = plat.getEngine();
|
||||
try
|
||||
{
|
||||
try {
|
||||
int vd = radius;
|
||||
int rg = 0;
|
||||
Chunk cx = player().getLocation().getChunk();
|
||||
@ -190,21 +188,18 @@ public class CommandIris implements DecreeExecutor {
|
||||
BurstExecutor b = MultiBurst.burst.burst();
|
||||
b.setMulticore(false);
|
||||
int rad = engine.getMantle().getRealRadius();
|
||||
for(int i = -(vd+rad); i <= vd+rad; i++) {
|
||||
for (int j = -(vd+rad); j <= vd+rad; j++) {
|
||||
for (int i = -(vd + rad); i <= vd + rad; i++) {
|
||||
for (int j = -(vd + rad); j <= vd + rad; j++) {
|
||||
engine.getMantle().getMantle().deleteChunk(i + cx.getX(), j + cx.getZ());
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = -vd; i <= vd; i++)
|
||||
{
|
||||
for(int j = -vd; j <= vd; j++)
|
||||
{
|
||||
for (int i = -vd; i <= vd; i++) {
|
||||
for (int j = -vd; j <= vd; j++) {
|
||||
int finalJ = j;
|
||||
int finalI = i;
|
||||
b.queue(() -> plat.injectChunkReplacement(player().getWorld(), finalI + cx.getX(), finalJ + cx.getZ(), (f) -> {
|
||||
synchronized (js)
|
||||
{
|
||||
synchronized (js) {
|
||||
js.add(f);
|
||||
}
|
||||
}));
|
||||
@ -220,10 +215,8 @@ public class CommandIris implements DecreeExecutor {
|
||||
public void execute(Runnable runnable) {
|
||||
futures.add(J.sfut(runnable));
|
||||
|
||||
if(futures.size() > 64)
|
||||
{
|
||||
while(futures.isNotEmpty())
|
||||
{
|
||||
if (futures.size() > 64) {
|
||||
while (futures.isNotEmpty()) {
|
||||
try {
|
||||
futures.remove(0).get();
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
@ -240,17 +233,11 @@ public class CommandIris implements DecreeExecutor {
|
||||
};
|
||||
r.queue(js);
|
||||
r.execute(sender());
|
||||
}
|
||||
|
||||
catch(Throwable e)
|
||||
{
|
||||
} catch (Throwable e) {
|
||||
sender().sendMessage("Unable to parse view-distance");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
} else {
|
||||
sender().sendMessage(C.RED + "You must be in an Iris World to use regen!");
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,13 @@
|
||||
package com.volmit.iris.core.commands;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.IrisSettings;
|
||||
import com.volmit.iris.core.edit.JigsawEditor;
|
||||
import com.volmit.iris.core.loader.IrisData;
|
||||
import com.volmit.iris.core.service.ObjectSVC;
|
||||
import com.volmit.iris.core.service.StudioSVC;
|
||||
import com.volmit.iris.core.service.WandSVC;
|
||||
import com.volmit.iris.engine.jigsaw.PlannedStructure;
|
||||
import com.volmit.iris.engine.object.*;
|
||||
import com.volmit.iris.util.data.Cuboid;
|
||||
import com.volmit.iris.engine.object.IrisJigsawPiece;
|
||||
import com.volmit.iris.engine.object.IrisJigsawStructure;
|
||||
import com.volmit.iris.engine.object.IrisObject;
|
||||
import com.volmit.iris.engine.object.IrisPosition;
|
||||
import com.volmit.iris.util.decree.DecreeExecutor;
|
||||
import com.volmit.iris.util.decree.DecreeOrigin;
|
||||
import com.volmit.iris.util.decree.annotations.Decree;
|
||||
@ -17,23 +15,10 @@ import com.volmit.iris.util.decree.annotations.Param;
|
||||
import com.volmit.iris.util.decree.specialhandlers.ObjectHandler;
|
||||
import com.volmit.iris.util.format.C;
|
||||
import com.volmit.iris.util.format.Form;
|
||||
import com.volmit.iris.util.math.Direction;
|
||||
import com.volmit.iris.util.math.RNG;
|
||||
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
||||
import com.volmit.iris.util.scheduling.Queue;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.TileState;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Decree(name = "jigsaw", origin = DecreeOrigin.PLAYER, studio = true, description = "Iris jigsaw commands")
|
||||
public class CommandJigsaw implements DecreeExecutor {
|
||||
@ -82,30 +67,28 @@ public class CommandJigsaw implements DecreeExecutor {
|
||||
}
|
||||
|
||||
@Decree(description = "Exit the current jigsaw editor")
|
||||
public void exit()
|
||||
{
|
||||
public void exit() {
|
||||
JigsawEditor editor = JigsawEditor.editors.get(player());
|
||||
|
||||
if (editor == null) {
|
||||
sender().sendMessage(C.GOLD +"You don't have any pieces open to exit!");
|
||||
sender().sendMessage(C.GOLD + "You don't have any pieces open to exit!");
|
||||
return;
|
||||
}
|
||||
|
||||
editor.exit();
|
||||
sender().sendMessage(C.GREEN +"Exited Jigsaw Editor");
|
||||
sender().sendMessage(C.GREEN + "Exited Jigsaw Editor");
|
||||
}
|
||||
|
||||
@Decree(description = "Save & Exit the current jigsaw editor")
|
||||
public void save()
|
||||
{
|
||||
public void save() {
|
||||
JigsawEditor editor = JigsawEditor.editors.get(player());
|
||||
|
||||
if (editor == null) {
|
||||
sender().sendMessage(C.GOLD +"You don't have any pieces open to save!");
|
||||
sender().sendMessage(C.GOLD + "You don't have any pieces open to save!");
|
||||
return;
|
||||
}
|
||||
|
||||
editor.close();
|
||||
sender().sendMessage(C.GREEN +"Saved & Exited Jigsaw Editor");
|
||||
sender().sendMessage(C.GREEN + "Saved & Exited Jigsaw Editor");
|
||||
}
|
||||
}
|
||||
|
@ -357,11 +357,7 @@ public class IrisData implements ExclusionStrategy, TypeAdapterFactory {
|
||||
public boolean shouldSkipClass(Class<?> c) {
|
||||
if (c.equals(AtomicCache.class)) {
|
||||
return true;
|
||||
} else if (c.equals(ChronoLatch.class)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
} else return c.equals(ChronoLatch.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -291,10 +291,8 @@ public class ResourceLoader<T extends IrisRegistrant> {
|
||||
|
||||
lock.unlock();
|
||||
|
||||
if(folderCache == null)
|
||||
{
|
||||
synchronized (this)
|
||||
{
|
||||
if (folderCache == null) {
|
||||
synchronized (this) {
|
||||
return getFolderCache();
|
||||
}
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ public class CommandSVC implements IrisService, DecreeSystem {
|
||||
}
|
||||
}
|
||||
|
||||
if ((msg.startsWith("locate ") || msg.startsWith("locatebiome ")) && IrisToolbelt.isIrisWorld(e.getPlayer().getWorld())){
|
||||
if ((msg.startsWith("locate ") || msg.startsWith("locatebiome ")) && IrisToolbelt.isIrisWorld(e.getPlayer().getWorld())) {
|
||||
new VolmitSender(e.getPlayer()).sendMessage(C.RED + "Locating biomes & objects is disabled in Iris Worlds. Use /iris studio goto <biome>");
|
||||
e.setCancelled(true);
|
||||
}
|
||||
|
@ -40,7 +40,6 @@ import org.bukkit.util.Vector;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@Data
|
||||
public class MantleWriter implements IObjectPlacer {
|
||||
@ -67,8 +66,7 @@ public class MantleWriter implements IObjectPlacer {
|
||||
}
|
||||
|
||||
public <T> void setData(int x, int y, int z, T t) {
|
||||
if(t == null)
|
||||
{
|
||||
if (t == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -168,7 +166,7 @@ public class MantleWriter implements IObjectPlacer {
|
||||
}
|
||||
|
||||
public <T> void setElipsoid(int cx, int cy, int cz, double rx, double ry, double rz, boolean fill, T data) {
|
||||
setElipsoidFunction(cx, cy, cz, rx, ry, rz, fill, (a,b,c)->data);
|
||||
setElipsoidFunction(cx, cy, cz, rx, ry, rz, fill, (a, b, c) -> data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -103,10 +103,9 @@ public class IrisCarveModifier extends EngineAssignedModifier<BlockData> {
|
||||
|
||||
if (c.isWater()) {
|
||||
output.set(rx, yy, rz, WATER);
|
||||
} else if(c.isLava()) {
|
||||
} else if (c.isLava()) {
|
||||
output.set(rx, yy, rz, LAVA);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
output.set(rx, yy, rz, AIR);
|
||||
}
|
||||
};
|
||||
@ -171,13 +170,11 @@ public class IrisCarveModifier extends EngineAssignedModifier<BlockData> {
|
||||
int thickness = zone.airThickness();
|
||||
String customBiome = "";
|
||||
|
||||
if(B.isDecorant(output.get(rx, zone.ceiling+1, rz)))
|
||||
{
|
||||
output.set(rx, zone.ceiling+1, rz, AIR);
|
||||
if (B.isDecorant(output.get(rx, zone.ceiling + 1, rz))) {
|
||||
output.set(rx, zone.ceiling + 1, rz, AIR);
|
||||
}
|
||||
|
||||
if(B.isDecorant(output.get(rx, zone.ceiling, rz)))
|
||||
{
|
||||
if (B.isDecorant(output.get(rx, zone.ceiling, rz))) {
|
||||
output.set(rx, zone.ceiling, rz, AIR);
|
||||
}
|
||||
|
||||
|
@ -121,8 +121,7 @@ public class IrisDepositModifier extends EngineAssignedModifier<BlockData> {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!getEngine().getMantle().isCarved((cx << 4) + nx, ny, (cz << 4) + nz))
|
||||
{
|
||||
if (!getEngine().getMantle().isCarved((cx << 4) + nx, ny, (cz << 4) + nz)) {
|
||||
data.set(nx, ny, nz, B.toDeepSlateOre(data.get(nx, ny, nz), clump.getBlocks().get(j)));
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,6 @@
|
||||
|
||||
package com.volmit.iris.engine.object;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.loader.IrisData;
|
||||
import com.volmit.iris.core.loader.IrisRegistrant;
|
||||
import com.volmit.iris.engine.framework.Engine;
|
||||
@ -73,7 +72,8 @@ public class IrisCave extends IrisRegistrant {
|
||||
public void generate(MantleWriter writer, RNG rng, Engine engine, int x, int y, int z, int waterHint) {
|
||||
|
||||
double girth = getWorm().getGirth().get(rng, x, z, engine.getData());
|
||||
KList<IrisPosition> points = getWorm().generate(rng, engine.getData(), writer, verticalRange, x, y, z, (at) -> {});
|
||||
KList<IrisPosition> points = getWorm().generate(rng, engine.getData(), writer, verticalRange, x, y, z, (at) -> {
|
||||
});
|
||||
int highestWater = Math.max(waterHint, -1);
|
||||
|
||||
if (highestWater == -1) {
|
||||
|
@ -287,7 +287,7 @@ public class IrisDimension extends IrisRegistrant {
|
||||
int jump = strongholdJumpDistance;
|
||||
RNG rng = new RNG((seed * 223) + 12945);
|
||||
|
||||
for (int i = 0; i < maxStrongholds+1; i++) {
|
||||
for (int i = 0; i < maxStrongholds + 1; i++) {
|
||||
int m = i + 1;
|
||||
pos.add(new Position2(
|
||||
(int) ((rng.i(jump * i) + (jump * i)) * (rng.b() ? -1D : 1D)),
|
||||
|
@ -73,8 +73,7 @@ public class IrisLake implements IRare {
|
||||
double[] surfaces = new double[pos.size()];
|
||||
int i = 0;
|
||||
|
||||
for(IrisPosition p : pos)
|
||||
{
|
||||
for (IrisPosition p : pos) {
|
||||
surfaces[i] = engine.getComplex().getHeightStream().get(x, z);
|
||||
ax += p.getX();
|
||||
ay += surfaces[i];
|
||||
@ -92,11 +91,9 @@ public class IrisLake implements IRare {
|
||||
double depth = dg.fitDouble(depthStyle.getMin(), depthStyle.getMax(), p.getX(), p.getZ()) + (surface - avg.getY());
|
||||
double width = bw.fitDouble(widthStyle.getMin(), widthStyle.getMax(), p.getX(), p.getZ());
|
||||
|
||||
if(depth > 1)
|
||||
{
|
||||
writer.setElipsoidFunction(p.getX(), avg.getY(), p.getZ(), width, depth, width, true, (xx,yy,zz) -> {
|
||||
if(yy > avg.getY())
|
||||
{
|
||||
if (depth > 1) {
|
||||
writer.setElipsoidFunction(p.getX(), avg.getY(), p.getZ(), width, depth, width, true, (xx, yy, zz) -> {
|
||||
if (yy > avg.getY()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,6 @@
|
||||
|
||||
package com.volmit.iris.engine.object;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.loader.IrisData;
|
||||
import com.volmit.iris.core.loader.IrisRegistrant;
|
||||
import com.volmit.iris.engine.framework.Engine;
|
||||
@ -150,13 +149,9 @@ public class IrisRavine extends IrisRegistrant {
|
||||
break;
|
||||
}
|
||||
|
||||
if(lavaLevel >= 0 && i <= lavaLevel + (surface - depthStyle.getMid()))
|
||||
{
|
||||
if (lavaLevel >= 0 && i <= lavaLevel + (surface - depthStyle.getMid())) {
|
||||
writer.setElipsoid(p.getX(), i, p.getZ(), v, ribThickness, v, true, l);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
} else {
|
||||
writer.setElipsoid(p.getX(), i, p.getZ(), v, ribThickness, v, true, c);
|
||||
}
|
||||
}
|
||||
@ -174,13 +169,9 @@ public class IrisRavine extends IrisRegistrant {
|
||||
break;
|
||||
}
|
||||
|
||||
if(lavaLevel >= 0 && i <= lavaLevel + (surface - depthStyle.getMid()))
|
||||
{
|
||||
if (lavaLevel >= 0 && i <= lavaLevel + (surface - depthStyle.getMid())) {
|
||||
writer.setElipsoid(p.getX(), i, p.getZ(), v, ribThickness, v, true, l);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
} else {
|
||||
writer.setElipsoid(p.getX(), i, p.getZ(), v, ribThickness, v, true, c);
|
||||
}
|
||||
}
|
||||
|
@ -18,9 +18,7 @@
|
||||
|
||||
package com.volmit.iris.engine.object;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.loader.IrisData;
|
||||
import com.volmit.iris.engine.data.cache.AtomicCache;
|
||||
import com.volmit.iris.engine.framework.Engine;
|
||||
import com.volmit.iris.engine.mantle.MantleWriter;
|
||||
import com.volmit.iris.engine.object.annotations.*;
|
||||
@ -30,8 +28,6 @@ import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
@Snippet("river")
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
|
@ -104,8 +104,7 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
|
||||
}
|
||||
} : null;
|
||||
|
||||
if(studio)
|
||||
{
|
||||
if (studio) {
|
||||
hotloader.setPriority(Thread.MIN_PRIORITY);
|
||||
hotloader.start();
|
||||
hotloader.setName(getTarget().getWorld().name() + " Hotloader");
|
||||
@ -236,8 +235,7 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
|
||||
@Override
|
||||
public void close() {
|
||||
withExclusiveControl(() -> {
|
||||
if(isStudio())
|
||||
{
|
||||
if (isStudio()) {
|
||||
hotloader.interrupt();
|
||||
}
|
||||
|
||||
@ -252,8 +250,7 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
|
||||
|
||||
@Override
|
||||
public void hotload() {
|
||||
if(!isStudio())
|
||||
{
|
||||
if (!isStudio()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,6 @@ import com.volmit.iris.core.IrisSettings;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.scheduling.ChronoLatch;
|
||||
import it.unimi.dsi.fastutil.ints.*;
|
||||
import net.minecraft.world.level.levelgen.OreVeinifier;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
@ -269,18 +268,12 @@ public class B {
|
||||
public static BlockData toDeepSlateOre(BlockData block, BlockData ore) {
|
||||
int key = ore.getMaterial().ordinal();
|
||||
|
||||
if(isDeepSlate(block))
|
||||
{
|
||||
if(normal2DeepslateCache.containsKey(key))
|
||||
{
|
||||
if (isDeepSlate(block)) {
|
||||
if (normal2DeepslateCache.containsKey(key)) {
|
||||
return Material.values()[normal2DeepslateCache.get(key)].createBlockData();
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if(deepslate2NormalCache.containsKey(key))
|
||||
{
|
||||
} else {
|
||||
if (deepslate2NormalCache.containsKey(key)) {
|
||||
return Material.values()[deepslate2NormalCache.get(key)].createBlockData();
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,6 @@ package com.volmit.iris.util.decree.handlers;
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.loader.IrisData;
|
||||
import com.volmit.iris.engine.object.IrisJigsawPiece;
|
||||
import com.volmit.iris.engine.object.IrisJigsawStructure;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.collection.KMap;
|
||||
import com.volmit.iris.util.decree.DecreeParameterHandler;
|
||||
|
@ -21,7 +21,6 @@ package com.volmit.iris.util.decree.handlers;
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.loader.IrisData;
|
||||
import com.volmit.iris.engine.object.IrisJigsawStructure;
|
||||
import com.volmit.iris.engine.object.IrisRegion;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.collection.KMap;
|
||||
import com.volmit.iris.util.decree.DecreeParameterHandler;
|
||||
|
@ -28,18 +28,15 @@ public class MatterCavern {
|
||||
private final String customBiome;
|
||||
private final byte liquid; // 0 none 1 water 2 lava
|
||||
|
||||
public boolean isAir()
|
||||
{
|
||||
public boolean isAir() {
|
||||
return liquid == 0;
|
||||
}
|
||||
|
||||
public boolean isWater()
|
||||
{
|
||||
public boolean isWater() {
|
||||
return liquid == 1;
|
||||
}
|
||||
|
||||
public boolean isLava()
|
||||
{
|
||||
public boolean isLava() {
|
||||
return liquid == 2;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user