mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
Fixes
This commit is contained in:
parent
fff7cd53cc
commit
ef5ba0f1d1
@ -47,7 +47,7 @@ import java.util.List;
|
|||||||
|
|
||||||
public class IrisBoardManager implements BoardProvider, Listener {
|
public class IrisBoardManager implements BoardProvider, Listener {
|
||||||
|
|
||||||
private BossBar energyBar;
|
private final BossBar energyBar;
|
||||||
private final BoardManager manager;
|
private final BoardManager manager;
|
||||||
private String mem = "...";
|
private String mem = "...";
|
||||||
public final RollingSequence hits = new RollingSequence(20);
|
public final RollingSequence hits = new RollingSequence(20);
|
||||||
|
@ -24,7 +24,6 @@ import com.volmit.iris.engine.object.objects.IrisObject;
|
|||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.data.Cuboid;
|
import com.volmit.iris.util.data.Cuboid;
|
||||||
import com.volmit.iris.util.format.C;
|
import com.volmit.iris.util.format.C;
|
||||||
import com.volmit.iris.util.hunk.storage.MappedHunk;
|
|
||||||
import com.volmit.iris.util.math.M;
|
import com.volmit.iris.util.math.M;
|
||||||
import com.volmit.iris.util.matter.IrisMatter;
|
import com.volmit.iris.util.matter.IrisMatter;
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
import com.volmit.iris.util.plugin.VolmitSender;
|
||||||
|
@ -25,12 +25,9 @@ import com.volmit.iris.core.command.studio.CommandIrisStudio;
|
|||||||
import com.volmit.iris.core.command.what.CommandIrisWhat;
|
import com.volmit.iris.core.command.what.CommandIrisWhat;
|
||||||
import com.volmit.iris.core.command.world.*;
|
import com.volmit.iris.core.command.world.*;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.hunk.Hunk;
|
|
||||||
import com.volmit.iris.util.plugin.Command;
|
import com.volmit.iris.util.plugin.Command;
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
import com.volmit.iris.util.plugin.MortarCommand;
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
import com.volmit.iris.util.plugin.VolmitSender;
|
||||||
import com.volmit.iris.util.scheduling.J;
|
|
||||||
import org.bukkit.util.Vector;
|
|
||||||
|
|
||||||
public class CommandIris extends MortarCommand {
|
public class CommandIris extends MortarCommand {
|
||||||
@Command
|
@Command
|
||||||
|
@ -20,35 +20,25 @@ package com.volmit.iris.core.command.object;
|
|||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.IrisSettings;
|
import com.volmit.iris.core.IrisSettings;
|
||||||
import com.volmit.iris.core.ProjectManager;
|
|
||||||
import com.volmit.iris.core.WandManager;
|
|
||||||
import com.volmit.iris.core.project.loader.IrisData;
|
import com.volmit.iris.core.project.loader.IrisData;
|
||||||
import com.volmit.iris.core.tools.IrisWorlds;
|
import com.volmit.iris.core.tools.IrisWorlds;
|
||||||
import com.volmit.iris.engine.object.common.IObjectPlacer;
|
import com.volmit.iris.engine.object.common.IObjectPlacer;
|
||||||
import com.volmit.iris.engine.object.objects.IrisObject;
|
|
||||||
import com.volmit.iris.engine.object.objects.IrisObjectPlacement;
|
|
||||||
import com.volmit.iris.engine.object.objects.IrisObjectPlacementScaleInterpolator;
|
|
||||||
import com.volmit.iris.engine.object.objects.IrisObjectRotation;
|
|
||||||
import com.volmit.iris.engine.object.tile.TileData;
|
import com.volmit.iris.engine.object.tile.TileData;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.math.RNG;
|
|
||||||
import com.volmit.iris.util.matter.IrisMatter;
|
|
||||||
import com.volmit.iris.util.matter.Matter;
|
import com.volmit.iris.util.matter.Matter;
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
import com.volmit.iris.util.plugin.MortarCommand;
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
import com.volmit.iris.util.plugin.VolmitSender;
|
||||||
import org.bukkit.*;
|
import org.bukkit.HeightMap;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.block.TileState;
|
import org.bukkit.block.TileState;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
public class CommandIrisObjectPasteMatter extends MortarCommand {
|
public class CommandIrisObjectPasteMatter extends MortarCommand {
|
||||||
|
|
||||||
|
@ -21,13 +21,10 @@ package com.volmit.iris.core.command.object;
|
|||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.IrisSettings;
|
import com.volmit.iris.core.IrisSettings;
|
||||||
import com.volmit.iris.core.WandManager;
|
import com.volmit.iris.core.WandManager;
|
||||||
import com.volmit.iris.engine.object.objects.IrisObject;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.format.Form;
|
|
||||||
import com.volmit.iris.util.matter.IrisMatter;
|
import com.volmit.iris.util.matter.IrisMatter;
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
import com.volmit.iris.util.plugin.MortarCommand;
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
import com.volmit.iris.util.plugin.VolmitSender;
|
||||||
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
@ -34,7 +34,7 @@ import java.util.*;
|
|||||||
|
|
||||||
public class CommandIrisObjectUndo extends MortarCommand {
|
public class CommandIrisObjectUndo extends MortarCommand {
|
||||||
|
|
||||||
private static Map<UUID, Deque<Map<Block, BlockData>>> undos = new HashMap<>();
|
private static final Map<UUID, Deque<Map<Block, BlockData>>> undos = new HashMap<>();
|
||||||
|
|
||||||
public CommandIrisObjectUndo() {
|
public CommandIrisObjectUndo() {
|
||||||
super("undo", "u", "revert");
|
super("undo", "u", "revert");
|
||||||
|
@ -21,9 +21,19 @@ package com.volmit.iris.core.command.studio;
|
|||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.IrisSettings;
|
import com.volmit.iris.core.IrisSettings;
|
||||||
import com.volmit.iris.core.project.IrisProject;
|
import com.volmit.iris.core.project.IrisProject;
|
||||||
|
import com.volmit.iris.core.project.loader.IrisData;
|
||||||
|
import com.volmit.iris.engine.object.objects.IrisObject;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
|
import com.volmit.iris.util.format.Form;
|
||||||
|
import com.volmit.iris.util.parallel.BurstExecutor;
|
||||||
|
import com.volmit.iris.util.parallel.MultiBurst;
|
||||||
import com.volmit.iris.util.plugin.MortarCommand;
|
import com.volmit.iris.util.plugin.MortarCommand;
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
import com.volmit.iris.util.plugin.VolmitSender;
|
||||||
|
import com.volmit.iris.util.scheduling.ChronoLatch;
|
||||||
|
import com.volmit.iris.util.scheduling.J;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
public class CommandIrisStudioUpdate extends MortarCommand {
|
public class CommandIrisStudioUpdate extends MortarCommand {
|
||||||
public CommandIrisStudioUpdate() {
|
public CommandIrisStudioUpdate() {
|
||||||
@ -50,6 +60,58 @@ public class CommandIrisStudioUpdate extends MortarCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(String i : args)
|
||||||
|
{
|
||||||
|
if(i.equals("--rewrite-objects"))
|
||||||
|
{
|
||||||
|
IrisData data = new IrisData(Iris.proj.getWorkspaceFolder(args[0]));
|
||||||
|
int t = data.getObjectLoader().getPossibleKeys().length;
|
||||||
|
ChronoLatch cl = new ChronoLatch(250, false);
|
||||||
|
MultiBurst bx = new MultiBurst("Object Rewriter",Thread.MIN_PRIORITY, Runtime.getRuntime().availableProcessors());
|
||||||
|
BurstExecutor b = bx.burst();
|
||||||
|
int g = 0;
|
||||||
|
for(String f : data.getObjectLoader().getPossibleKeys())
|
||||||
|
{
|
||||||
|
int finalG1 = g;
|
||||||
|
b.queue(() -> {
|
||||||
|
|
||||||
|
if(cl.flip())
|
||||||
|
{
|
||||||
|
Iris.info("Rewriting: " + Form.f(t - finalG1) + " Objects Left");
|
||||||
|
}
|
||||||
|
File ff = data.getObjectLoader().findFile(f);
|
||||||
|
IrisObject oo = new IrisObject(0,0,0);
|
||||||
|
try {
|
||||||
|
oo.read(ff);
|
||||||
|
} catch (Throwable e) {
|
||||||
|
Iris.error("FAILER TO READ: " + f);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(oo == null)
|
||||||
|
{
|
||||||
|
Iris.error("FAILER TO READ: " + f);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
oo.write(ff);
|
||||||
|
} catch (IOException e) {
|
||||||
|
Iris.error("FAILURE TO WRITE: " + oo.getLoadFile());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
g++;
|
||||||
|
}
|
||||||
|
|
||||||
|
int finalG = g;
|
||||||
|
J.a(() -> {
|
||||||
|
b.complete();
|
||||||
|
bx.shutdownNow();
|
||||||
|
sender.sendMessage("Done! Rewrote " + Form.f(finalG) + " Objects!");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (new IrisProject(Iris.proj.getWorkspaceFolder(args[0])).updateWorkspace()) {
|
if (new IrisProject(Iris.proj.getWorkspaceFolder(args[0])).updateWorkspace()) {
|
||||||
sender.sendMessage("Updated Code Workspace for " + args[0]);
|
sender.sendMessage("Updated Code Workspace for " + args[0]);
|
||||||
} else {
|
} else {
|
||||||
@ -61,6 +123,6 @@ public class CommandIrisStudioUpdate extends MortarCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getArgsUsage() {
|
protected String getArgsUsage() {
|
||||||
return "[dimension]";
|
return "[dimension] [--rewrite-objects]";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,10 +23,14 @@ import org.bukkit.Location;
|
|||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.WorldCreator;
|
import org.bukkit.WorldCreator;
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.block.TileState;
|
||||||
import org.bukkit.generator.ChunkGenerator;
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
|
|
||||||
public interface INMSBinding {
|
public interface INMSBinding {
|
||||||
|
CompoundTag serializeTile(Location location);
|
||||||
|
|
||||||
|
void deserializeTile(CompoundTag s, Location newPosition);
|
||||||
|
|
||||||
boolean supportsCustomHeight();
|
boolean supportsCustomHeight();
|
||||||
|
|
||||||
Object getBiomeBaseFromId(int id);
|
Object getBiomeBaseFromId(int id);
|
||||||
|
@ -21,18 +21,25 @@ package com.volmit.iris.core.nms.v17_1;
|
|||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.nms.INMSBinding;
|
import com.volmit.iris.core.nms.INMSBinding;
|
||||||
import com.volmit.iris.util.collection.KMap;
|
import com.volmit.iris.util.collection.KMap;
|
||||||
|
import com.volmit.iris.util.nbt.tag.CompoundTag;
|
||||||
|
import net.minecraft.core.BlockPosition;
|
||||||
import net.minecraft.core.IRegistry;
|
import net.minecraft.core.IRegistry;
|
||||||
import net.minecraft.core.IRegistryWritable;
|
import net.minecraft.core.IRegistryWritable;
|
||||||
import net.minecraft.resources.MinecraftKey;
|
import net.minecraft.resources.MinecraftKey;
|
||||||
import net.minecraft.resources.ResourceKey;
|
import net.minecraft.resources.ResourceKey;
|
||||||
import net.minecraft.world.level.biome.BiomeBase;
|
import net.minecraft.world.level.biome.BiomeBase;
|
||||||
|
import net.minecraft.world.level.block.BlockChest;
|
||||||
|
import net.minecraft.world.level.block.entity.TileEntity;
|
||||||
import net.minecraft.world.level.chunk.BiomeStorage;
|
import net.minecraft.world.level.chunk.BiomeStorage;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
|
import org.bukkit.block.TileState;
|
||||||
|
import org.bukkit.craftbukkit.v1_16_R1.block.impl.CraftBamboo;
|
||||||
import org.bukkit.craftbukkit.v1_17_R1.CraftServer;
|
import org.bukkit.craftbukkit.v1_17_R1.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_17_R1.CraftWorld;
|
import org.bukkit.craftbukkit.v1_17_R1.CraftWorld;
|
||||||
|
import org.bukkit.craftbukkit.v1_17_R1.block.impl.CraftChest;
|
||||||
import org.bukkit.generator.ChunkGenerator;
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
@ -58,6 +65,16 @@ public class NMSBinding17_1 implements INMSBinding {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CompoundTag serializeTile(Location location) {
|
||||||
|
TileEntity e = ((CraftWorld)location.getWorld()).getHandle().getTileEntity(new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deserializeTile(CompoundTag s, Location newPosition) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean supportsCustomHeight() {
|
public boolean supportsCustomHeight() {
|
||||||
return false;
|
return false;
|
||||||
|
@ -69,11 +69,11 @@ public class SyndicatePregenMethod implements PregeneratorMethod {
|
|||||||
ready = false;
|
ready = false;
|
||||||
try {
|
try {
|
||||||
connect().command(SyndicateInstallPack
|
connect().command(SyndicateInstallPack
|
||||||
.builder()
|
.builder()
|
||||||
.dimension(dimension)
|
.dimension(dimension)
|
||||||
.pack(pack)
|
.pack(pack)
|
||||||
.seed(seed)
|
.seed(seed)
|
||||||
.build())
|
.build())
|
||||||
.output((o) -> {
|
.output((o) -> {
|
||||||
File to = new File(Iris.getTemp(), "send-" + pack + ".zip");
|
File to = new File(Iris.getTemp(), "send-" + pack + ".zip");
|
||||||
ZipUtil.pack(dimension.getLoader().getDataFolder(), to);
|
ZipUtil.pack(dimension.getLoader().getDataFolder(), to);
|
||||||
@ -87,12 +87,12 @@ public class SyndicatePregenMethod implements PregeneratorMethod {
|
|||||||
to.deleteOnExit();
|
to.deleteOnExit();
|
||||||
})
|
})
|
||||||
.build().go((response, data) -> {
|
.build().go((response, data) -> {
|
||||||
if (response instanceof SyndicateBusy) {
|
if (response instanceof SyndicateBusy) {
|
||||||
throw new RuntimeException("Service is busy, will try later");
|
throw new RuntimeException("Service is busy, will try later");
|
||||||
}
|
}
|
||||||
|
|
||||||
ready = true;
|
ready = true;
|
||||||
});
|
});
|
||||||
ready = true;
|
ready = true;
|
||||||
} catch (Throwable throwable) {
|
} catch (Throwable throwable) {
|
||||||
if (throwable instanceof RuntimeException) {
|
if (throwable instanceof RuntimeException) {
|
||||||
@ -156,21 +156,21 @@ public class SyndicatePregenMethod implements PregeneratorMethod {
|
|||||||
connect()
|
connect()
|
||||||
.command(SyndicateGetProgress.builder()
|
.command(SyndicateGetProgress.builder()
|
||||||
.pack(pack).build()).output((i) -> {
|
.pack(pack).build()).output((i) -> {
|
||||||
}).build().go((response, o) -> {
|
}).build().go((response, o) -> {
|
||||||
if (response instanceof SyndicateSendProgress) {
|
if (response instanceof SyndicateSendProgress) {
|
||||||
if (((SyndicateSendProgress) response).isAvailable()) {
|
if (((SyndicateSendProgress) response).isAvailable()) {
|
||||||
progress.set(((SyndicateSendProgress) response).getProgress());
|
progress.set(((SyndicateSendProgress) response).getProgress());
|
||||||
File f = new File(worldFolder, "region/r." + x + "." + z + ".mca");
|
File f = new File(worldFolder, "region/r." + x + "." + z + ".mca");
|
||||||
try {
|
try {
|
||||||
f.getParentFile().mkdirs();
|
f.getParentFile().mkdirs();
|
||||||
IO.writeAll(f, o);
|
IO.writeAll(f, o);
|
||||||
progress.set(1000);
|
progress.set(1000);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
|
||||||
});
|
|
||||||
} catch (Throwable throwable) {
|
} catch (Throwable throwable) {
|
||||||
throwable.printStackTrace();
|
throwable.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -186,64 +186,64 @@ public class SyndicatePregenMethod implements PregeneratorMethod {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
connect().command(SyndicateGenerate
|
connect().command(SyndicateGenerate
|
||||||
.builder()
|
.builder()
|
||||||
.x(x).z(z).pack(pack)
|
.x(x).z(z).pack(pack)
|
||||||
.build())
|
.build())
|
||||||
.build().go((response, data) -> {
|
.build().go((response, data) -> {
|
||||||
if (response instanceof SyndicateOK) {
|
if (response instanceof SyndicateOK) {
|
||||||
listener.onNetworkStarted(x, z);
|
listener.onNetworkStarted(x, z);
|
||||||
J.a(() -> {
|
J.a(() -> {
|
||||||
double lastp = 0;
|
double lastp = 0;
|
||||||
int calls = 0;
|
int calls = 0;
|
||||||
boolean installed = false;
|
boolean installed = false;
|
||||||
while (true) {
|
while (true) {
|
||||||
J.sleep(100);
|
J.sleep(100);
|
||||||
double progress = checkProgress(x, z);
|
double progress = checkProgress(x, z);
|
||||||
|
|
||||||
if (progress == 1000) {
|
if (progress == 1000) {
|
||||||
installed = true;
|
installed = true;
|
||||||
AtomicInteger a = new AtomicInteger(calls);
|
AtomicInteger a = new AtomicInteger(calls);
|
||||||
PregenTask.iterateRegion(x, z, (xx, zz) -> {
|
PregenTask.iterateRegion(x, z, (xx, zz) -> {
|
||||||
if (a.decrementAndGet() < 0) {
|
if (a.decrementAndGet() < 0) {
|
||||||
listener.onNetworkGeneratedChunk(xx, zz);
|
listener.onNetworkGeneratedChunk(xx, zz);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
calls = 1024;
|
||||||
|
} else if (progress < 0) {
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
});
|
|
||||||
calls = 1024;
|
|
||||||
} else if (progress < 0) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
int change = (int) Math.floor((progress - lastp) * 1024D);
|
int change = (int) Math.floor((progress - lastp) * 1024D);
|
||||||
change = change == 0 ? 1 : change;
|
change = change == 0 ? 1 : change;
|
||||||
|
|
||||||
AtomicInteger a = new AtomicInteger(calls);
|
AtomicInteger a = new AtomicInteger(calls);
|
||||||
AtomicInteger b = new AtomicInteger(change);
|
AtomicInteger b = new AtomicInteger(change);
|
||||||
PregenTask.iterateRegion(x, z, (xx, zz) -> {
|
PregenTask.iterateRegion(x, z, (xx, zz) -> {
|
||||||
if (a.decrementAndGet() < 0) {
|
if (a.decrementAndGet() < 0) {
|
||||||
if (b.decrementAndGet() >= 0) {
|
if (b.decrementAndGet() >= 0) {
|
||||||
listener.onNetworkGeneratedChunk(xx, zz);
|
listener.onNetworkGeneratedChunk(xx, zz);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
calls += change;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!installed) {
|
||||||
|
// TODO RETRY REGION
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
listener.onNetworkDownloaded(x, z);
|
||||||
});
|
});
|
||||||
calls += change;
|
} else if (response instanceof SyndicateInstallFirst) {
|
||||||
|
ready = false;
|
||||||
|
throw new RuntimeException();
|
||||||
|
} else if (response instanceof SyndicateBusy) {
|
||||||
|
throw new RuntimeException();
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!installed) {
|
|
||||||
// TODO RETRY REGION
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
listener.onNetworkDownloaded(x, z);
|
|
||||||
});
|
});
|
||||||
} else if (response instanceof SyndicateInstallFirst) {
|
|
||||||
ready = false;
|
|
||||||
throw new RuntimeException();
|
|
||||||
} else if (response instanceof SyndicateBusy) {
|
|
||||||
throw new RuntimeException();
|
|
||||||
} else {
|
|
||||||
throw new RuntimeException();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} catch (Throwable throwable) {
|
} catch (Throwable throwable) {
|
||||||
|
|
||||||
if (throwable instanceof RuntimeException) {
|
if (throwable instanceof RuntimeException) {
|
||||||
|
@ -184,21 +184,21 @@ public class IrisComplex implements DataProvider {
|
|||||||
).convertAware2D(ProceduralStream::get).cache2D(cacheSize);
|
).convertAware2D(ProceduralStream::get).cache2D(cacheSize);
|
||||||
inferredStreams.put(InferredType.CAVE, caveBiomeStream);
|
inferredStreams.put(InferredType.CAVE, caveBiomeStream);
|
||||||
landBiomeStream = regionStream.convert((r)
|
landBiomeStream = regionStream.convert((r)
|
||||||
-> engine.getDimension().getLandBiomeStyle().create(rng.nextParallelRNG(InferredType.LAND.ordinal()), getData()).stream()
|
-> engine.getDimension().getLandBiomeStyle().create(rng.nextParallelRNG(InferredType.LAND.ordinal()), getData()).stream()
|
||||||
.zoom(r.getLandBiomeZoom())
|
.zoom(r.getLandBiomeZoom())
|
||||||
.selectRarity(r.getLandBiomes(), (i) -> data.getBiomeLoader().load(i))
|
.selectRarity(r.getLandBiomes(), (i) -> data.getBiomeLoader().load(i))
|
||||||
.convertCached((s) -> data.getBiomeLoader().load(s)
|
.convertCached((s) -> data.getBiomeLoader().load(s)
|
||||||
.setInferredType(InferredType.LAND))
|
.setInferredType(InferredType.LAND))
|
||||||
).convertAware2D(ProceduralStream::get)
|
).convertAware2D(ProceduralStream::get)
|
||||||
.cache2D(cacheSize);
|
.cache2D(cacheSize);
|
||||||
inferredStreams.put(InferredType.LAND, landBiomeStream);
|
inferredStreams.put(InferredType.LAND, landBiomeStream);
|
||||||
seaBiomeStream = regionStream.convert((r)
|
seaBiomeStream = regionStream.convert((r)
|
||||||
-> engine.getDimension().getSeaBiomeStyle().create(rng.nextParallelRNG(InferredType.SEA.ordinal()), getData()).stream()
|
-> engine.getDimension().getSeaBiomeStyle().create(rng.nextParallelRNG(InferredType.SEA.ordinal()), getData()).stream()
|
||||||
.zoom(r.getSeaBiomeZoom())
|
.zoom(r.getSeaBiomeZoom())
|
||||||
.selectRarity(r.getSeaBiomes(), (i) -> data.getBiomeLoader().load(i))
|
.selectRarity(r.getSeaBiomes(), (i) -> data.getBiomeLoader().load(i))
|
||||||
.convertCached((s) -> data.getBiomeLoader().load(s)
|
.convertCached((s) -> data.getBiomeLoader().load(s)
|
||||||
.setInferredType(InferredType.SEA))
|
.setInferredType(InferredType.SEA))
|
||||||
).convertAware2D(ProceduralStream::get)
|
).convertAware2D(ProceduralStream::get)
|
||||||
.cache2D(cacheSize);
|
.cache2D(cacheSize);
|
||||||
inferredStreams.put(InferredType.SEA, seaBiomeStream);
|
inferredStreams.put(InferredType.SEA, seaBiomeStream);
|
||||||
shoreBiomeStream = regionStream.convert((r)
|
shoreBiomeStream = regionStream.convert((r)
|
||||||
@ -240,18 +240,18 @@ public class IrisComplex implements DataProvider {
|
|||||||
return 1D;
|
return 1D;
|
||||||
});
|
});
|
||||||
trueBiomeStream = focus != null ? ProceduralStream.of((x, y) -> focus, Interpolated.of(a -> 0D,
|
trueBiomeStream = focus != null ? ProceduralStream.of((x, y) -> focus, Interpolated.of(a -> 0D,
|
||||||
b -> focus)).convertAware2D((b, x, z) -> {
|
b -> focus)).convertAware2D((b, x, z) -> {
|
||||||
for (IrisFeaturePositional i : engine.getFramework().getEngineParallax().forEachFeature(x, z)) {
|
for (IrisFeaturePositional i : engine.getFramework().getEngineParallax().forEachFeature(x, z)) {
|
||||||
IrisBiome bx = i.filter(x, z, b, rng);
|
IrisBiome bx = i.filter(x, z, b, rng);
|
||||||
|
|
||||||
if (bx != null) {
|
if (bx != null) {
|
||||||
bx.setInferredType(b.getInferredType());
|
bx.setInferredType(b.getInferredType());
|
||||||
return bx;
|
return bx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return b;
|
return b;
|
||||||
})
|
})
|
||||||
.cache2D(cacheSize) : heightStream
|
.cache2D(cacheSize) : heightStream
|
||||||
.convertAware2D((h, x, z) ->
|
.convertAware2D((h, x, z) ->
|
||||||
fixBiomeType(h, baseBiomeStream.get(x, z),
|
fixBiomeType(h, baseBiomeStream.get(x, z),
|
||||||
@ -270,18 +270,18 @@ public class IrisComplex implements DataProvider {
|
|||||||
})
|
})
|
||||||
.cache2D(cacheSize);
|
.cache2D(cacheSize);
|
||||||
trueBiomeStream = focus != null ? ProceduralStream.of((x, y) -> focus, Interpolated.of(a -> 0D,
|
trueBiomeStream = focus != null ? ProceduralStream.of((x, y) -> focus, Interpolated.of(a -> 0D,
|
||||||
b -> focus)).convertAware2D((b, x, z) -> {
|
b -> focus)).convertAware2D((b, x, z) -> {
|
||||||
for (IrisFeaturePositional i : engine.getFramework().getEngineParallax().forEachFeature(x, z)) {
|
for (IrisFeaturePositional i : engine.getFramework().getEngineParallax().forEachFeature(x, z)) {
|
||||||
IrisBiome bx = i.filter(x, z, b, rng);
|
IrisBiome bx = i.filter(x, z, b, rng);
|
||||||
|
|
||||||
if (bx != null) {
|
if (bx != null) {
|
||||||
bx.setInferredType(b.getInferredType());
|
bx.setInferredType(b.getInferredType());
|
||||||
return bx;
|
return bx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return b;
|
return b;
|
||||||
})
|
})
|
||||||
.cache2D(cacheSize) : heightStream
|
.cache2D(cacheSize) : heightStream
|
||||||
.convertAware2D((h, x, z) ->
|
.convertAware2D((h, x, z) ->
|
||||||
fixBiomeType(h, baseBiomeStream.get(x, z),
|
fixBiomeType(h, baseBiomeStream.get(x, z),
|
||||||
@ -357,10 +357,10 @@ public class IrisComplex implements DataProvider {
|
|||||||
return m;
|
return m;
|
||||||
}, Interpolated.INT).cache2D(cacheSize);
|
}, Interpolated.INT).cache2D(cacheSize);
|
||||||
baseBiomeIDStream = trueBiomeStream.convertAware2D((b, x, z) -> {
|
baseBiomeIDStream = trueBiomeStream.convertAware2D((b, x, z) -> {
|
||||||
UUID d = regionIDStream.get(x, z);
|
UUID d = regionIDStream.get(x, z);
|
||||||
return new UUID(b.getLoadKey().hashCode() * 818223L,
|
return new UUID(b.getLoadKey().hashCode() * 818223L,
|
||||||
d.hashCode());
|
d.hashCode());
|
||||||
})
|
})
|
||||||
.cache2D(cacheSize);
|
.cache2D(cacheSize);
|
||||||
islandTopStream = islandStream.convertAware2D((i, x, z) ->
|
islandTopStream = islandStream.convertAware2D((i, x, z) ->
|
||||||
i ? heightStream.round()
|
i ? heightStream.round()
|
||||||
|
@ -179,23 +179,23 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
|
|||||||
|
|
||||||
//@builder
|
//@builder
|
||||||
spawnRandomly(Stream.concat(Stream.concat(
|
spawnRandomly(Stream.concat(Stream.concat(
|
||||||
getData().getSpawnerLoader()
|
getData().getSpawnerLoader()
|
||||||
.loadAll(getDimension().getEntitySpawners())
|
.loadAll(getDimension().getEntitySpawners())
|
||||||
.shuffleCopy(RNG.r).stream().filter(this::canSpawn),
|
.shuffleCopy(RNG.r).stream().filter(this::canSpawn),
|
||||||
getData().getSpawnerLoader().streamAll(getEngine().getFramework().getEngineParallax()
|
getData().getSpawnerLoader().streamAll(getEngine().getFramework().getEngineParallax()
|
||||||
.getFeaturesInChunk(c).stream()
|
.getFeaturesInChunk(c).stream()
|
||||||
.flatMap((o) -> o.getFeature().getEntitySpawners().stream()))
|
.flatMap((o) -> o.getFeature().getEntitySpawners().stream()))
|
||||||
.filter(this::canSpawn))
|
.filter(this::canSpawn))
|
||||||
.filter((i) -> i.isValid(biome))
|
.filter((i) -> i.isValid(biome))
|
||||||
.flatMap(this::stream),
|
|
||||||
Stream.concat(getData().getSpawnerLoader()
|
|
||||||
.loadAll(getEngine().getRegion(c.getX() << 4, c.getZ() << 4).getEntitySpawners())
|
|
||||||
.shuffleCopy(RNG.r).stream().filter(this::canSpawn)
|
|
||||||
.flatMap(this::stream),
|
.flatMap(this::stream),
|
||||||
getData().getSpawnerLoader()
|
Stream.concat(getData().getSpawnerLoader()
|
||||||
.loadAll(getEngine().getSurfaceBiome(c.getX() << 4, c.getZ() << 4).getEntitySpawners())
|
.loadAll(getEngine().getRegion(c.getX() << 4, c.getZ() << 4).getEntitySpawners())
|
||||||
.shuffleCopy(RNG.r).stream().filter(this::canSpawn)
|
.shuffleCopy(RNG.r).stream().filter(this::canSpawn)
|
||||||
.flatMap(this::stream)))
|
.flatMap(this::stream),
|
||||||
|
getData().getSpawnerLoader()
|
||||||
|
.loadAll(getEngine().getSurfaceBiome(c.getX() << 4, c.getZ() << 4).getEntitySpawners())
|
||||||
|
.shuffleCopy(RNG.r).stream().filter(this::canSpawn)
|
||||||
|
.flatMap(this::stream)))
|
||||||
.collect(Collectors.toList()))
|
.collect(Collectors.toList()))
|
||||||
.popRandom(RNG.r, max).forEach((i) -> spawn(c, i));
|
.popRandom(RNG.r, max).forEach((i) -> spawn(c, i));
|
||||||
//@done
|
//@done
|
||||||
|
@ -109,7 +109,7 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
|
|||||||
lastHotloadTime += p.getMilliseconds();
|
lastHotloadTime += p.getMilliseconds();
|
||||||
lastHotloadTime /= 2;
|
lastHotloadTime /= 2;
|
||||||
|
|
||||||
return 120 + (long) (lastHotloadTime / 2) + Math.min(hotloaderMisses * 125, 1375);
|
return 120 + (lastHotloadTime / 2) + Math.min(hotloaderMisses * 125, 1375);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
ticker.setPriority(Thread.MIN_PRIORITY);
|
ticker.setPriority(Thread.MIN_PRIORITY);
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
package com.volmit.iris.engine.jigsaw;
|
package com.volmit.iris.engine.jigsaw;
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.core.project.loader.IrisData;
|
import com.volmit.iris.core.project.loader.IrisData;
|
||||||
import com.volmit.iris.core.tools.IrisWorlds;
|
import com.volmit.iris.core.tools.IrisWorlds;
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
|
@ -75,8 +75,7 @@ public class PlannedStructure {
|
|||||||
|
|
||||||
generateTerminators();
|
generateTerminators();
|
||||||
|
|
||||||
for(PlannedPiece i : pieces)
|
for (PlannedPiece i : pieces) {
|
||||||
{
|
|
||||||
Iris.debug("Place: " + i.getObject().getLoadKey() + " at @ relative " + i.getPosition().toString());
|
Iris.debug("Place: " + i.getObject().getLoadKey() + " at @ relative " + i.getPosition().toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -74,14 +74,14 @@ public class IrisCaverns {
|
|||||||
public ProceduralStream<Double> stream(RNG rng, IrisData data) {
|
public ProceduralStream<Double> stream(RNG rng, IrisData data) {
|
||||||
if (preThresholdInterpolation) {
|
if (preThresholdInterpolation) {
|
||||||
return streamCache.aquire(() -> ProceduralStream.of((xx, yy, zz)
|
return streamCache.aquire(() -> ProceduralStream.of((xx, yy, zz)
|
||||||
-> (getZone(xx, yy, zz, rng, data)
|
-> (getZone(xx, yy, zz, rng, data)
|
||||||
.getCarved(rng, data, xx, yy, zz)), Interpolated.DOUBLE)
|
.getCarved(rng, data, xx, yy, zz)), Interpolated.DOUBLE)
|
||||||
.cache3D(65535));
|
.cache3D(65535));
|
||||||
}
|
}
|
||||||
|
|
||||||
return streamCache.aquire(() -> ProceduralStream.of((xx, yy, zz)
|
return streamCache.aquire(() -> ProceduralStream.of((xx, yy, zz)
|
||||||
-> (getZone(xx, yy, zz, rng, data)
|
-> (getZone(xx, yy, zz, rng, data)
|
||||||
.isCarved(rng, data, xx, yy, zz) ? 1D : 0D), Interpolated.DOUBLE)
|
.isCarved(rng, data, xx, yy, zz) ? 1D : 0D), Interpolated.DOUBLE)
|
||||||
.cache3D(65535));
|
.cache3D(65535));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ public class IrisDecorator {
|
|||||||
public CNG getVarianceGenerator(RNG rng, IrisData data) {
|
public CNG getVarianceGenerator(RNG rng, IrisData data) {
|
||||||
return varianceGenerator.aquire(() ->
|
return varianceGenerator.aquire(() ->
|
||||||
variance.create(
|
variance.create(
|
||||||
rng.nextParallelRNG(getBlockData(data).size()), data)
|
rng.nextParallelRNG(getBlockData(data).size()), data)
|
||||||
.scale(1D / variance.getZoom()));
|
.scale(1D / variance.getZoom()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -348,7 +348,11 @@ public class IrisObject extends IrisRegistrant {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void write(File file) throws IOException {
|
public void write(File file) throws IOException {
|
||||||
file.getParentFile().mkdirs();
|
if(file == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
FileOutputStream out = new FileOutputStream(file);
|
FileOutputStream out = new FileOutputStream(file);
|
||||||
write(out);
|
write(out);
|
||||||
out.close();
|
out.close();
|
||||||
|
@ -32,23 +32,17 @@ public class IrisContext {
|
|||||||
private static ChronoLatch cl = new ChronoLatch(60000);
|
private static ChronoLatch cl = new ChronoLatch(60000);
|
||||||
private static KMap<Thread, IrisContext> context = new KMap<>();
|
private static KMap<Thread, IrisContext> context = new KMap<>();
|
||||||
|
|
||||||
public static IrisContext get()
|
public static IrisContext get() {
|
||||||
{
|
|
||||||
return context.get(Thread.currentThread());
|
return context.get(Thread.currentThread());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void touch(IrisContext c)
|
public static void touch(IrisContext c) {
|
||||||
{
|
synchronized (context) {
|
||||||
synchronized (context)
|
|
||||||
{
|
|
||||||
context.put(Thread.currentThread(), c);
|
context.put(Thread.currentThread(), c);
|
||||||
|
|
||||||
if(cl.flip())
|
if (cl.flip()) {
|
||||||
{
|
for (Thread i : context.k()) {
|
||||||
for(Thread i : context.k())
|
if (!i.isAlive()) {
|
||||||
{
|
|
||||||
if(!i.isAlive())
|
|
||||||
{
|
|
||||||
context.remove(i);
|
context.remove(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -58,18 +52,15 @@ public class IrisContext {
|
|||||||
|
|
||||||
private final Engine engine;
|
private final Engine engine;
|
||||||
|
|
||||||
public void touch()
|
public void touch() {
|
||||||
{
|
|
||||||
IrisContext.touch(this);
|
IrisContext.touch(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IrisData getData()
|
public IrisData getData() {
|
||||||
{
|
|
||||||
return engine.getData();
|
return engine.getData();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IrisComplex getComplex()
|
public IrisComplex getComplex() {
|
||||||
{
|
|
||||||
return engine.getFramework().getComplex();
|
return engine.getFramework().getComplex();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
package com.volmit.iris.util.hunk;
|
package com.volmit.iris.util.hunk;
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.engine.object.basic.IrisPosition;
|
import com.volmit.iris.engine.object.basic.IrisPosition;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.function.*;
|
import com.volmit.iris.util.function.*;
|
||||||
@ -29,8 +28,6 @@ import com.volmit.iris.util.interpolation.InterpolationMethod;
|
|||||||
import com.volmit.iris.util.interpolation.InterpolationMethod3D;
|
import com.volmit.iris.util.interpolation.InterpolationMethod3D;
|
||||||
import com.volmit.iris.util.interpolation.IrisInterpolation;
|
import com.volmit.iris.util.interpolation.IrisInterpolation;
|
||||||
import com.volmit.iris.util.math.BlockPosition;
|
import com.volmit.iris.util.math.BlockPosition;
|
||||||
import com.volmit.iris.util.math.M;
|
|
||||||
import com.volmit.iris.util.math.MathHelper;
|
|
||||||
import com.volmit.iris.util.oldnbt.ByteArrayTag;
|
import com.volmit.iris.util.oldnbt.ByteArrayTag;
|
||||||
import com.volmit.iris.util.parallel.BurstExecutor;
|
import com.volmit.iris.util.parallel.BurstExecutor;
|
||||||
import com.volmit.iris.util.parallel.MultiBurst;
|
import com.volmit.iris.util.parallel.MultiBurst;
|
||||||
@ -40,7 +37,6 @@ import org.bukkit.block.Biome;
|
|||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
import org.bukkit.generator.ChunkGenerator.BiomeGrid;
|
import org.bukkit.generator.ChunkGenerator.BiomeGrid;
|
||||||
import org.bukkit.generator.ChunkGenerator.ChunkData;
|
import org.bukkit.generator.ChunkGenerator.ChunkData;
|
||||||
import org.bukkit.util.Vector;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -1273,24 +1269,23 @@ public interface Hunk<T> {
|
|||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
static IrisPosition rotatedBounding(int w, int h, int d, double x, double y, double z)
|
static IrisPosition rotatedBounding(int w, int h, int d, double x, double y, double z) {
|
||||||
{
|
int[] iii = {0, 0, 0};
|
||||||
int[] iii = {0,0,0};
|
int[] aaa = {w, h, d};
|
||||||
int[] aaa = {w,h,d};
|
int[] aai = {w, h, 0};
|
||||||
int[] aai = {w,h,0};
|
int[] iaa = {0, h, d};
|
||||||
int[] iaa = {0,h,d};
|
int[] aia = {w, 0, d};
|
||||||
int[] aia = {w,0,d};
|
int[] iai = {0, h, 0};
|
||||||
int[] iai = {0,h,0};
|
int[] iia = {0, 0, d};
|
||||||
int[] iia = {0,0,d};
|
int[] aii = {w, 0, 0};
|
||||||
int[] aii = {w,0,0};
|
rotate(x, y, z, iii);
|
||||||
rotate(x,y,z,iii);
|
rotate(x, y, z, aaa);
|
||||||
rotate(x,y,z,aaa);
|
rotate(x, y, z, aai);
|
||||||
rotate(x,y,z,aai);
|
rotate(x, y, z, iaa);
|
||||||
rotate(x,y,z,iaa);
|
rotate(x, y, z, aia);
|
||||||
rotate(x,y,z,aia);
|
rotate(x, y, z, iai);
|
||||||
rotate(x,y,z,iai);
|
rotate(x, y, z, iia);
|
||||||
rotate(x,y,z,iia);
|
rotate(x, y, z, aii);
|
||||||
rotate(x,y,z,aii);
|
|
||||||
int maxX = max(iii[0], aaa[0], aai[0], iaa[0], aia[0], iai[0], iia[0], aii[0]);
|
int maxX = max(iii[0], aaa[0], aai[0], iaa[0], aia[0], iai[0], iia[0], aii[0]);
|
||||||
int minX = min(iii[0], aaa[0], aai[0], iaa[0], aia[0], iai[0], iia[0], aii[0]);
|
int minX = min(iii[0], aaa[0], aai[0], iaa[0], aia[0], iai[0], iia[0], aii[0]);
|
||||||
int maxY = max(iii[1], aaa[1], aai[1], iaa[1], aia[1], iai[1], iia[1], aii[1]);
|
int maxY = max(iii[1], aaa[1], aai[1], iaa[1], aia[1], iai[1], iia[1], aii[1]);
|
||||||
@ -1300,30 +1295,29 @@ public interface Hunk<T> {
|
|||||||
return new IrisPosition(maxX - minX, maxY - minY, maxZ - minZ);
|
return new IrisPosition(maxX - minX, maxY - minY, maxZ - minZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
default Hunk<T> rotate(double x, double y, double z, Supplier3R<Integer, Integer, Integer, Hunk<T>> builder)
|
default Hunk<T> rotate(double x, double y, double z, Supplier3R<Integer, Integer, Integer, Hunk<T>> builder) {
|
||||||
{
|
|
||||||
int w = getWidth();
|
int w = getWidth();
|
||||||
int h = getHeight();
|
int h = getHeight();
|
||||||
int d = getDepth();
|
int d = getDepth();
|
||||||
int i,j,k;
|
int i, j, k;
|
||||||
int[] c = {w/2,h/2,d/2};
|
int[] c = {w / 2, h / 2, d / 2};
|
||||||
int[] b = {0,0,0};
|
int[] b = {0, 0, 0};
|
||||||
int[] iii = {0,0,0};
|
int[] iii = {0, 0, 0};
|
||||||
int[] aaa = {w,h,d};
|
int[] aaa = {w, h, d};
|
||||||
int[] aai = {w,h,0};
|
int[] aai = {w, h, 0};
|
||||||
int[] iaa = {0,h,d};
|
int[] iaa = {0, h, d};
|
||||||
int[] aia = {w,0,d};
|
int[] aia = {w, 0, d};
|
||||||
int[] iai = {0,h,0};
|
int[] iai = {0, h, 0};
|
||||||
int[] iia = {0,0,d};
|
int[] iia = {0, 0, d};
|
||||||
int[] aii = {w,0,0};
|
int[] aii = {w, 0, 0};
|
||||||
rotate(x,y,z,iii);
|
rotate(x, y, z, iii);
|
||||||
rotate(x,y,z,aaa);
|
rotate(x, y, z, aaa);
|
||||||
rotate(x,y,z,aai);
|
rotate(x, y, z, aai);
|
||||||
rotate(x,y,z,iaa);
|
rotate(x, y, z, iaa);
|
||||||
rotate(x,y,z,aia);
|
rotate(x, y, z, aia);
|
||||||
rotate(x,y,z,iai);
|
rotate(x, y, z, iai);
|
||||||
rotate(x,y,z,iia);
|
rotate(x, y, z, iia);
|
||||||
rotate(x,y,z,aii);
|
rotate(x, y, z, aii);
|
||||||
int maxX = max(iii[0], aaa[0], aai[0], iaa[0], aia[0], iai[0], iia[0], aii[0]);
|
int maxX = max(iii[0], aaa[0], aai[0], iaa[0], aia[0], iai[0], iia[0], aii[0]);
|
||||||
int minX = min(iii[0], aaa[0], aai[0], iaa[0], aia[0], iai[0], iia[0], aii[0]);
|
int minX = min(iii[0], aaa[0], aai[0], iaa[0], aia[0], iai[0], iia[0], aii[0]);
|
||||||
int maxY = max(iii[1], aaa[1], aai[1], iaa[1], aia[1], iai[1], iia[1], aii[1]);
|
int maxY = max(iii[1], aaa[1], aai[1], iaa[1], aia[1], iai[1], iia[1], aii[1]);
|
||||||
@ -1331,26 +1325,19 @@ public interface Hunk<T> {
|
|||||||
int maxZ = max(iii[2], aaa[2], aai[2], iaa[2], aia[2], iai[2], iia[2], aii[2]);
|
int maxZ = max(iii[2], aaa[2], aai[2], iaa[2], aia[2], iai[2], iia[2], aii[2]);
|
||||||
int minZ = min(iii[2], aaa[2], aai[2], iaa[2], aia[2], iai[2], iia[2], aii[2]);
|
int minZ = min(iii[2], aaa[2], aai[2], iaa[2], aia[2], iai[2], iia[2], aii[2]);
|
||||||
Hunk<T> r = builder.get(maxX - minX, maxY - minY, maxZ - minZ);
|
Hunk<T> r = builder.get(maxX - minX, maxY - minY, maxZ - minZ);
|
||||||
int[] cr = {(maxX - minX)/2,(maxY - minY)/2,(maxZ - minZ)/2};
|
int[] cr = {(maxX - minX) / 2, (maxY - minY) / 2, (maxZ - minZ) / 2};
|
||||||
|
|
||||||
for(i = 0; i < w; i++)
|
for (i = 0; i < w; i++) {
|
||||||
{
|
for (j = 0; j < h; j++) {
|
||||||
for(j = 0; j < h; j++)
|
for (k = 0; k < d; k++) {
|
||||||
{
|
|
||||||
for(k = 0; k < d; k++)
|
|
||||||
{
|
|
||||||
b[0] = i - c[0];
|
b[0] = i - c[0];
|
||||||
b[1] = j - c[1];
|
b[1] = j - c[1];
|
||||||
b[2] = k - c[2];
|
b[2] = k - c[2];
|
||||||
rotate(x, y, z, b);
|
rotate(x, y, z, b);
|
||||||
|
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
r.set(b[0] + cr[0], b[1] + cr[1], b[2] + cr[2], get(i, j, k));
|
r.set(b[0] + cr[0], b[1] + cr[1], b[2] + cr[2], get(i, j, k));
|
||||||
}
|
} catch (Throwable e) {
|
||||||
|
|
||||||
catch(Throwable e)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1360,30 +1347,24 @@ public interface Hunk<T> {
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int max(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8)
|
static int max(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) {
|
||||||
{
|
|
||||||
return Math.max(Math.max(Math.max(a5, a6), Math.max(a7, a8)), Math.max(Math.max(a1, a2), Math.max(a3, a4)));
|
return Math.max(Math.max(Math.max(a5, a6), Math.max(a7, a8)), Math.max(Math.max(a1, a2), Math.max(a3, a4)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int min(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8)
|
static int min(int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8) {
|
||||||
{
|
|
||||||
return Math.min(Math.min(Math.min(a5, a6), Math.min(a7, a8)), Math.min(Math.min(a1, a2), Math.min(a3, a4)));
|
return Math.min(Math.min(Math.min(a5, a6), Math.min(a7, a8)), Math.min(Math.min(a1, a2), Math.min(a3, a4)));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rotate(double x, double y, double z, int[] c)
|
static void rotate(double x, double y, double z, int[] c) {
|
||||||
{
|
if (x % 360 != 0) {
|
||||||
if(x % 360 != 0)
|
|
||||||
{
|
|
||||||
rotateAroundX(Math.toRadians(x), c);
|
rotateAroundX(Math.toRadians(x), c);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(y % 360 != 0)
|
if (y % 360 != 0) {
|
||||||
{
|
|
||||||
rotateAroundY(Math.toRadians(y), c);
|
rotateAroundY(Math.toRadians(y), c);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(z % 360 != 0)
|
if (z % 360 != 0) {
|
||||||
{
|
|
||||||
rotateAroundZ(Math.toRadians(z), c);
|
rotateAroundZ(Math.toRadians(z), c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1393,8 +1374,8 @@ public interface Hunk<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void rotateAroundX(double cos, double sin, int[] c) {
|
static void rotateAroundX(double cos, double sin, int[] c) {
|
||||||
int y = (int) Math.floor(cos * (double)(c[1]+0.5) - sin * (double)(c[2]+0.5));
|
int y = (int) Math.floor(cos * (double) (c[1] + 0.5) - sin * (double) (c[2] + 0.5));
|
||||||
int z = (int) Math.floor(sin * (double)(c[1]+0.5) + cos * (double)(c[2]+0.5));
|
int z = (int) Math.floor(sin * (double) (c[1] + 0.5) + cos * (double) (c[2] + 0.5));
|
||||||
c[1] = y;
|
c[1] = y;
|
||||||
c[2] = z;
|
c[2] = z;
|
||||||
}
|
}
|
||||||
@ -1404,8 +1385,8 @@ public interface Hunk<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void rotateAroundY(double cos, double sin, int[] c) {
|
static void rotateAroundY(double cos, double sin, int[] c) {
|
||||||
int x = (int) Math.floor(cos * (double)(c[0]+0.5) + sin * (double)(c[2]+0.5));
|
int x = (int) Math.floor(cos * (double) (c[0] + 0.5) + sin * (double) (c[2] + 0.5));
|
||||||
int z = (int) Math.floor(-sin * (double)(c[0]+0.5) + cos * (double)(c[2]+0.5));
|
int z = (int) Math.floor(-sin * (double) (c[0] + 0.5) + cos * (double) (c[2] + 0.5));
|
||||||
c[0] = x;
|
c[0] = x;
|
||||||
c[2] = z;
|
c[2] = z;
|
||||||
}
|
}
|
||||||
@ -1415,8 +1396,8 @@ public interface Hunk<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void rotateAroundZ(double cos, double sin, int[] c) {
|
static void rotateAroundZ(double cos, double sin, int[] c) {
|
||||||
int x = (int) Math.floor(cos * (double)(c[0]+0.5) - sin * (double)(c[1]+0.5));
|
int x = (int) Math.floor(cos * (double) (c[0] + 0.5) - sin * (double) (c[1] + 0.5));
|
||||||
int y = (int) Math.floor(sin * (double)(c[0]+0.5) + cos * (double)(c[1]+0.5));
|
int y = (int) Math.floor(sin * (double) (c[0] + 0.5) + cos * (double) (c[1] + 0.5));
|
||||||
c[0] = x;
|
c[0] = x;
|
||||||
c[1] = y;
|
c[1] = y;
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
package com.volmit.iris.util.hunk.storage;
|
package com.volmit.iris.util.hunk.storage;
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.util.collection.KMap;
|
import com.volmit.iris.util.collection.KMap;
|
||||||
import com.volmit.iris.util.function.Consumer4;
|
import com.volmit.iris.util.function.Consumer4;
|
||||||
import com.volmit.iris.util.hunk.Hunk;
|
import com.volmit.iris.util.hunk.Hunk;
|
||||||
|
@ -22,8 +22,6 @@ import com.volmit.iris.Iris;
|
|||||||
import com.volmit.iris.util.collection.KMap;
|
import com.volmit.iris.util.collection.KMap;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
|
|
||||||
public class IrisMatter implements Matter {
|
public class IrisMatter implements Matter {
|
||||||
private static final KMap<Class<?>, MatterSlice<?>> slicers = buildSlicers();
|
private static final KMap<Class<?>, MatterSlice<?>> slicers = buildSlicers();
|
||||||
|
|
||||||
@ -40,7 +38,7 @@ public class IrisMatter implements Matter {
|
|||||||
private final int depth;
|
private final int depth;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private KMap<Class<?>, MatterSlice<?>> sliceMap;
|
private final KMap<Class<?>, MatterSlice<?>> sliceMap;
|
||||||
|
|
||||||
public IrisMatter(int width, int height, int depth) {
|
public IrisMatter(int width, int height, int depth) {
|
||||||
this.width = width;
|
this.width = width;
|
||||||
|
@ -181,20 +181,19 @@ public interface Matter {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Rotate a matter object into a new object
|
* Rotate a matter object into a new object
|
||||||
|
*
|
||||||
* @param x the x rotation (degrees)
|
* @param x the x rotation (degrees)
|
||||||
* @param y the y rotation (degrees)
|
* @param y the y rotation (degrees)
|
||||||
* @param z the z rotation (degrees)
|
* @param z the z rotation (degrees)
|
||||||
* @return the new rotated matter object
|
* @return the new rotated matter object
|
||||||
*/
|
*/
|
||||||
default Matter rotate(double x, double y, double z)
|
default Matter rotate(double x, double y, double z) {
|
||||||
{
|
|
||||||
IrisPosition rs = Hunk.rotatedBounding(getWidth(), getHeight(), getDepth(), x, y, z);
|
IrisPosition rs = Hunk.rotatedBounding(getWidth(), getHeight(), getDepth(), x, y, z);
|
||||||
Matter n = new IrisMatter(rs.getX(), rs.getY(), rs.getZ());
|
Matter n = new IrisMatter(rs.getX(), rs.getY(), rs.getZ());
|
||||||
n.getHeader().setAuthor(getHeader().getAuthor());
|
n.getHeader().setAuthor(getHeader().getAuthor());
|
||||||
n.getHeader().setCreatedAt(getHeader().getCreatedAt());
|
n.getHeader().setCreatedAt(getHeader().getCreatedAt());
|
||||||
|
|
||||||
for(Class<?> i : getSliceTypes())
|
for (Class<?> i : getSliceTypes()) {
|
||||||
{
|
|
||||||
getSlice(i).rotateSliceInto(n, x, y, z);
|
getSlice(i).rotateSliceInto(n, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,8 +233,7 @@ public interface Matter {
|
|||||||
*/
|
*/
|
||||||
Map<Class<?>, MatterSlice<?>> getSliceMap();
|
Map<Class<?>, MatterSlice<?>> getSliceMap();
|
||||||
|
|
||||||
default void write(File f) throws IOException
|
default void write(File f) throws IOException {
|
||||||
{
|
|
||||||
FileOutputStream out = new FileOutputStream(f);
|
FileOutputStream out = new FileOutputStream(f);
|
||||||
GZIPOutputStream gzo = new GZIPOutputStream(out);
|
GZIPOutputStream gzo = new GZIPOutputStream(out);
|
||||||
write(gzo);
|
write(gzo);
|
||||||
@ -265,8 +263,7 @@ public interface Matter {
|
|||||||
dos.flush();
|
dos.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
static Matter read(File f) throws IOException, ClassNotFoundException
|
static Matter read(File f) throws IOException, ClassNotFoundException {
|
||||||
{
|
|
||||||
FileInputStream in = new FileInputStream(f);
|
FileInputStream in = new FileInputStream(f);
|
||||||
GZIPInputStream gzi = new GZIPInputStream(in);
|
GZIPInputStream gzi = new GZIPInputStream(in);
|
||||||
Matter m = read(gzi);
|
Matter m = read(gzi);
|
||||||
@ -274,8 +271,7 @@ public interface Matter {
|
|||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Matter read(InputStream in) throws IOException, ClassNotFoundException
|
static Matter read(InputStream in) throws IOException, ClassNotFoundException {
|
||||||
{
|
|
||||||
return read(in, (b) -> new IrisMatter(b.getX(), b.getY(), b.getZ()));
|
return read(in, (b) -> new IrisMatter(b.getX(), b.getY(), b.getZ()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,6 @@ import com.volmit.iris.util.hunk.storage.MappedHunk;
|
|||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.objectweb.asm.ClassWriter;
|
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
@ -42,39 +41,30 @@ public interface MatterSlice<T> extends Hunk<T> {
|
|||||||
|
|
||||||
<W> MatterReader<W, T> readFrom(Class<W> mediumType);
|
<W> MatterReader<W, T> readFrom(Class<W> mediumType);
|
||||||
|
|
||||||
default Class<?> getClass(Object w)
|
default Class<?> getClass(Object w) {
|
||||||
{
|
|
||||||
Class<?> c = w.getClass();
|
Class<?> c = w.getClass();
|
||||||
|
|
||||||
if(w instanceof World)
|
if (w instanceof World) {
|
||||||
{
|
|
||||||
c = World.class;
|
c = World.class;
|
||||||
}else if(w instanceof BlockData)
|
} else if (w instanceof BlockData) {
|
||||||
{
|
|
||||||
c = BlockData.class;
|
c = BlockData.class;
|
||||||
}else if(w instanceof Entity)
|
} else if (w instanceof Entity) {
|
||||||
{
|
|
||||||
c = Entity.class;
|
c = Entity.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
default <W> boolean writeInto(W w, int x, int y, int z)
|
default <W> boolean writeInto(W w, int x, int y, int z) {
|
||||||
{
|
|
||||||
MatterWriter<W, T> injector = (MatterWriter<W, T>) writeInto(getClass(w));
|
MatterWriter<W, T> injector = (MatterWriter<W, T>) writeInto(getClass(w));
|
||||||
|
|
||||||
if(injector == null)
|
if (injector == null) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = x; i < x + getWidth(); i++)
|
for (int i = x; i < x + getWidth(); i++) {
|
||||||
{
|
for (int j = y; j < y + getHeight(); j++) {
|
||||||
for(int j = y; j < y + getHeight(); j++)
|
for (int k = z; k < z + getDepth(); k++) {
|
||||||
{
|
|
||||||
for(int k = z; k < z + getDepth(); k++)
|
|
||||||
{
|
|
||||||
injector.writeMatter(w, get(i - x, j - y, k - z), i, j, k);
|
injector.writeMatter(w, get(i - x, j - y, k - z), i, j, k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -83,21 +73,16 @@ public interface MatterSlice<T> extends Hunk<T> {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
default <W> boolean readFrom(W w, int x, int y, int z)
|
default <W> boolean readFrom(W w, int x, int y, int z) {
|
||||||
{
|
|
||||||
MatterReader<W, T> ejector = (MatterReader<W, T>) readFrom(getClass(w));
|
MatterReader<W, T> ejector = (MatterReader<W, T>) readFrom(getClass(w));
|
||||||
|
|
||||||
if(ejector == null)
|
if (ejector == null) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = x; i < x + getWidth(); i++)
|
for (int i = x; i < x + getWidth(); i++) {
|
||||||
{
|
for (int j = y; j < y + getHeight(); j++) {
|
||||||
for(int j = y; j < y + getHeight(); j++)
|
for (int k = z; k < z + getDepth(); k++) {
|
||||||
{
|
|
||||||
for(int k = z; k < z + getDepth(); k++)
|
|
||||||
{
|
|
||||||
set(i - x, j - y, k - z, ejector.readMatter(w, i, j, k));
|
set(i - x, j - y, k - z, ejector.readMatter(w, i, j, k));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -110,18 +95,15 @@ public interface MatterSlice<T> extends Hunk<T> {
|
|||||||
// RawMatter<T> ex MappedHunk<T>
|
// RawMatter<T> ex MappedHunk<T>
|
||||||
// IMatterSlice<T> ex Hunk<T>
|
// IMatterSlice<T> ex Hunk<T>
|
||||||
|
|
||||||
default int getCount()
|
default int getCount() {
|
||||||
{
|
return ((MappedHunk<?>) this).getEntryCount();
|
||||||
return ((MappedHunk<?>)this).getEntryCount();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
default boolean canWrite(Class<?> mediumType)
|
default boolean canWrite(Class<?> mediumType) {
|
||||||
{
|
|
||||||
return writeInto(mediumType) != null;
|
return writeInto(mediumType) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
default boolean canRead(Class<?> mediumType)
|
default boolean canRead(Class<?> mediumType) {
|
||||||
{
|
|
||||||
return readFrom(mediumType) != null;
|
return readFrom(mediumType) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,8 +135,7 @@ public interface MatterSlice<T> extends Hunk<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
default void rotateSliceInto(Matter n, double x, double y, double z)
|
default void rotateSliceInto(Matter n, double x, double y, double z) {
|
||||||
{
|
rotate(x, y, z, (_x, _y, _z) -> n.slice(getType()));
|
||||||
rotate(x,y,z, (_x, _y, _z) -> n.slice(getType()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,15 +18,9 @@
|
|||||||
|
|
||||||
package com.volmit.iris.util.matter.slices;
|
package com.volmit.iris.util.matter.slices;
|
||||||
|
|
||||||
import com.volmit.iris.core.project.loader.IrisRegistrant;
|
|
||||||
import com.volmit.iris.engine.object.biome.IrisBiome;
|
import com.volmit.iris.engine.object.biome.IrisBiome;
|
||||||
import com.volmit.iris.util.context.IrisContext;
|
|
||||||
import com.volmit.iris.util.matter.Sliced;
|
import com.volmit.iris.util.matter.Sliced;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
|
||||||
import java.io.DataOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
@Sliced
|
@Sliced
|
||||||
public class BiomeMatter extends RegistryMatter<IrisBiome> {
|
public class BiomeMatter extends RegistryMatter<IrisBiome> {
|
||||||
public BiomeMatter() {
|
public BiomeMatter() {
|
||||||
|
@ -22,9 +22,6 @@ import com.volmit.iris.engine.parallax.ParallaxAccess;
|
|||||||
import com.volmit.iris.engine.parallax.ParallaxWorld;
|
import com.volmit.iris.engine.parallax.ParallaxWorld;
|
||||||
import com.volmit.iris.util.data.B;
|
import com.volmit.iris.util.data.B;
|
||||||
import com.volmit.iris.util.matter.Sliced;
|
import com.volmit.iris.util.matter.Sliced;
|
||||||
import com.volmit.iris.util.nbt.io.NBTUtil;
|
|
||||||
import com.volmit.iris.util.nbt.mca.NBTWorld;
|
|
||||||
import com.volmit.iris.util.nbt.tag.CompoundTag;
|
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
|
|
||||||
@ -40,9 +37,9 @@ public class BlockMatter extends RawMatter<BlockData> {
|
|||||||
|
|
||||||
public BlockMatter(int width, int height, int depth) {
|
public BlockMatter(int width, int height, int depth) {
|
||||||
super(width, height, depth, BlockData.class);
|
super(width, height, depth, BlockData.class);
|
||||||
registerWriter(World.class, ((w, d, x, y, z) -> w.getBlockAt(x,y,z).setBlockData(d)));
|
registerWriter(World.class, ((w, d, x, y, z) -> w.getBlockAt(x, y, z).setBlockData(d)));
|
||||||
registerWriter(ParallaxWorld.class, (w, d, x, y, z) -> w.setBlock(x,y,z,d));
|
registerWriter(ParallaxWorld.class, (w, d, x, y, z) -> w.setBlock(x, y, z, d));
|
||||||
registerReader(World.class, (w, x, y, z) -> w.getBlockAt(x,y,z).getBlockData());
|
registerReader(World.class, (w, x, y, z) -> w.getBlockAt(x, y, z).getBlockData());
|
||||||
registerReader(ParallaxWorld.class, ParallaxAccess::getBlock);
|
registerReader(ParallaxWorld.class, ParallaxAccess::getBlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,8 +21,8 @@ package com.volmit.iris.util.matter.slices;
|
|||||||
import com.volmit.iris.util.collection.KMap;
|
import com.volmit.iris.util.collection.KMap;
|
||||||
import com.volmit.iris.util.hunk.storage.MappedHunk;
|
import com.volmit.iris.util.hunk.storage.MappedHunk;
|
||||||
import com.volmit.iris.util.matter.MatterReader;
|
import com.volmit.iris.util.matter.MatterReader;
|
||||||
import com.volmit.iris.util.matter.MatterWriter;
|
|
||||||
import com.volmit.iris.util.matter.MatterSlice;
|
import com.volmit.iris.util.matter.MatterSlice;
|
||||||
|
import com.volmit.iris.util.matter.MatterWriter;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
@ -42,25 +42,21 @@ public abstract class RawMatter<T> extends MappedHunk<T> implements MatterSlice<
|
|||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected <W> void registerWriter(Class<W> mediumType, MatterWriter<W, T> injector)
|
protected <W> void registerWriter(Class<W> mediumType, MatterWriter<W, T> injector) {
|
||||||
{
|
|
||||||
injectors.put(mediumType, injector);
|
injectors.put(mediumType, injector);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected <W> void registerReader(Class<W> mediumType, MatterReader<W, T> injector)
|
protected <W> void registerReader(Class<W> mediumType, MatterReader<W, T> injector) {
|
||||||
{
|
|
||||||
ejectors.put(mediumType, injector);
|
ejectors.put(mediumType, injector);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <W> MatterWriter<W, T> writeInto(Class<W> mediumType)
|
public <W> MatterWriter<W, T> writeInto(Class<W> mediumType) {
|
||||||
{
|
|
||||||
return (MatterWriter<W, T>) injectors.get(mediumType);
|
return (MatterWriter<W, T>) injectors.get(mediumType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <W> MatterReader<W, T> readFrom(Class<W> mediumType)
|
public <W> MatterReader<W, T> readFrom(Class<W> mediumType) {
|
||||||
{
|
|
||||||
return (MatterReader<W, T>) ejectors.get(mediumType);
|
return (MatterReader<W, T>) ejectors.get(mediumType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
package com.volmit.iris.util.matter.slices;
|
package com.volmit.iris.util.matter.slices;
|
||||||
|
|
||||||
import com.volmit.iris.core.project.loader.IrisRegistrant;
|
import com.volmit.iris.core.project.loader.IrisRegistrant;
|
||||||
import com.volmit.iris.engine.object.biome.IrisBiome;
|
|
||||||
import com.volmit.iris.util.matter.Sliced;
|
import com.volmit.iris.util.matter.Sliced;
|
||||||
|
|
||||||
@Sliced
|
@Sliced
|
||||||
@ -27,6 +26,7 @@ public class RegionMatter extends RegistryMatter<IrisRegistrant> {
|
|||||||
public RegionMatter() {
|
public RegionMatter() {
|
||||||
this(1, 1, 1);
|
this(1, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public RegionMatter(int width, int height, int depth) {
|
public RegionMatter(int width, int height, int depth) {
|
||||||
super(width, height, depth, IrisRegistrant.class);
|
super(width, height, depth, IrisRegistrant.class);
|
||||||
}
|
}
|
||||||
|
@ -20,8 +20,6 @@ package com.volmit.iris.util.matter.slices;
|
|||||||
|
|
||||||
import com.volmit.iris.core.project.loader.IrisRegistrant;
|
import com.volmit.iris.core.project.loader.IrisRegistrant;
|
||||||
import com.volmit.iris.util.context.IrisContext;
|
import com.volmit.iris.util.context.IrisContext;
|
||||||
import com.volmit.iris.util.nbt.io.NBTUtil;
|
|
||||||
import com.volmit.iris.util.nbt.tag.Tag;
|
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
package com.volmit.iris.util.matter.slices;
|
package com.volmit.iris.util.matter.slices;
|
||||||
|
|
||||||
import com.volmit.iris.engine.object.biome.IrisBiome;
|
|
||||||
import com.volmit.iris.engine.object.spawners.IrisSpawner;
|
import com.volmit.iris.engine.object.spawners.IrisSpawner;
|
||||||
import com.volmit.iris.util.matter.Sliced;
|
import com.volmit.iris.util.matter.Sliced;
|
||||||
|
|
||||||
@ -27,6 +26,7 @@ public class SpawnerMatter extends RegistryMatter<IrisSpawner> {
|
|||||||
public SpawnerMatter() {
|
public SpawnerMatter() {
|
||||||
this(1, 1, 1);
|
this(1, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SpawnerMatter(int width, int height, int depth) {
|
public SpawnerMatter(int width, int height, int depth) {
|
||||||
super(width, height, depth, IrisSpawner.class);
|
super(width, height, depth, IrisSpawner.class);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,54 @@
|
|||||||
|
/*
|
||||||
|
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||||
|
* Copyright (c) 2021 Arcane Arts (Volmit Software)
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.volmit.iris.util.matter.slices;
|
||||||
|
|
||||||
|
import com.volmit.iris.engine.parallax.ParallaxAccess;
|
||||||
|
import com.volmit.iris.engine.parallax.ParallaxWorld;
|
||||||
|
import com.volmit.iris.util.data.B;
|
||||||
|
import com.volmit.iris.util.matter.Sliced;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.block.Chest;
|
||||||
|
import org.bukkit.block.TileState;
|
||||||
|
import org.bukkit.block.data.BlockData;
|
||||||
|
|
||||||
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@Sliced
|
||||||
|
public class TileMatter extends RawMatter<TileState> {
|
||||||
|
public TileMatter() {
|
||||||
|
this(1, 1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TileMatter(int width, int height, int depth) {
|
||||||
|
super(width, height, depth, TileState.class);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeNode(TileState b, DataOutputStream dos) throws IOException {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TileState readNode(DataInputStream din) throws IOException {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user