mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-19 02:36:59 +00:00
Fixes
This commit is contained in:
parent
468448ff6e
commit
6b8610b72d
@ -33,7 +33,6 @@ public class Iris extends VolmitPlugin
|
||||
public static Iris instance;
|
||||
public static ProjectManager proj;
|
||||
public static ConversionManager convert;
|
||||
public static IrisHotloadManager hotloader;
|
||||
public static WandManager wand;
|
||||
public static StructureManager struct;
|
||||
public static EditManager edit;
|
||||
@ -151,7 +150,6 @@ public class Iris extends VolmitPlugin
|
||||
instance = this;
|
||||
compat = IrisCompat.configured(getDataFile("compat.json"));
|
||||
proj = new ProjectManager();
|
||||
hotloader = new IrisHotloadManager();
|
||||
convert = new ConversionManager();
|
||||
wand = new WandManager();
|
||||
struct = new StructureManager();
|
||||
|
@ -1,84 +0,0 @@
|
||||
package com.volmit.iris.generator.legacy.scaffold;
|
||||
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.generator.ChunkGenerator.ChunkData;
|
||||
import org.bukkit.material.MaterialData;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class ChunkWrapper implements ChunkData
|
||||
{
|
||||
private final Chunk chunk;
|
||||
|
||||
public ChunkWrapper(Chunk chunk)
|
||||
{
|
||||
this.chunk = chunk;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxHeight()
|
||||
{
|
||||
return chunk.getWorld().getMaxHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlock(int x, int y, int z, Material material)
|
||||
{
|
||||
chunk.getBlock(x, y, z).setType(material, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlock(int x, int y, int z, MaterialData material)
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlock(int x, int y, int z, BlockData blockData)
|
||||
{
|
||||
chunk.getBlock(x, y, z).setBlockData(blockData, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRegion(int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, Material material)
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRegion(int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, MaterialData material)
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRegion(int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, BlockData blockData)
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Material getType(int x, int y, int z)
|
||||
{
|
||||
return chunk.getBlock(x, y, z).getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public MaterialData getTypeAndData(int x, int y, int z)
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockData getBlockData(int x, int y, int z)
|
||||
{
|
||||
return chunk.getBlock(x, y, z).getBlockData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte getData(int x, int y, int z)
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
package com.volmit.iris.generator.legacy.scaffold;
|
||||
|
||||
import com.volmit.iris.object.IrisBiome;
|
||||
import com.volmit.iris.object.IrisDimension;
|
||||
import com.volmit.iris.object.IrisRegion;
|
||||
import com.volmit.iris.util.KMap;
|
||||
|
||||
public interface IrisContext
|
||||
{
|
||||
static KMap<TerrainTarget, IrisContext> contexts = new KMap<>();
|
||||
|
||||
public static void pushContext(IrisContext context)
|
||||
{
|
||||
contexts.put(context.getTarget(), context);
|
||||
}
|
||||
|
||||
public static IrisContext of(TerrainTarget world)
|
||||
{
|
||||
return contexts.get(world);
|
||||
}
|
||||
|
||||
public TerrainTarget getTarget();
|
||||
|
||||
public IrisBiome getBiome(int x, int z);
|
||||
|
||||
public IrisDimension getDimension();
|
||||
|
||||
public IrisRegion getRegion(int x, int z);
|
||||
|
||||
public IrisMetrics getMetrics();
|
||||
|
||||
public int getHeight(int x, int z);
|
||||
|
||||
public void onHotloaded();
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
package com.volmit.iris.generator.legacy.scaffold;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.util.RollingSequence;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class IrisMetrics
|
||||
{
|
||||
private final RollingSequence parallax;
|
||||
private final RollingSequence terrain;
|
||||
private final RollingSequence post;
|
||||
private final RollingSequence update;
|
||||
private final RollingSequence deposits;
|
||||
private final RollingSequence spawns;
|
||||
private final RollingSequence total;
|
||||
private final RollingSequence perSecond;
|
||||
public int generators = 0;
|
||||
public int noiseHits = 0;
|
||||
|
||||
public IrisMetrics(int memory)
|
||||
{
|
||||
parallax = new RollingSequence(memory);
|
||||
spawns = new RollingSequence(memory);
|
||||
terrain = new RollingSequence(memory);
|
||||
post = new RollingSequence(memory);
|
||||
update = new RollingSequence(memory);
|
||||
deposits = new RollingSequence(memory);
|
||||
total = new RollingSequence(memory);
|
||||
perSecond = new RollingSequence(5);
|
||||
}
|
||||
|
||||
public double getSpeed()
|
||||
{
|
||||
return (double) Iris.board.hits.getAverage() / (double) total.getAverage();
|
||||
}
|
||||
}
|
@ -1,97 +0,0 @@
|
||||
package com.volmit.iris.generator.legacy.scaffold;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.volmit.iris.util.KList;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
public class TerrainTarget
|
||||
{
|
||||
private long seed;
|
||||
private Environment environment;
|
||||
private String name;
|
||||
private File folder;
|
||||
private static final KList<Player> emptyPlayers = new KList<>();
|
||||
private World realWorld;
|
||||
|
||||
public void setRealWorld(World realWorld)
|
||||
{
|
||||
if(this.realWorld == null || realWorld != this.realWorld)
|
||||
{
|
||||
this.realWorld = realWorld;
|
||||
this.seed = realWorld.getSeed();
|
||||
this.folder = realWorld.getWorldFolder();
|
||||
this.environment = realWorld.getEnvironment();
|
||||
this.name = realWorld.getName();
|
||||
}
|
||||
}
|
||||
|
||||
public static TerrainTarget from(World world)
|
||||
{
|
||||
// @NoArgsConstructor
|
||||
return new TerrainTargetBuilder().environment(world.getEnvironment()).seed(world.getSeed()).folder(world.getWorldFolder()).name(world.getName()).realWorld(world).build();
|
||||
//@done
|
||||
}
|
||||
|
||||
public List<Player> getPlayers()
|
||||
{
|
||||
return realWorld != null ? realWorld.getPlayers() : emptyPlayers;
|
||||
}
|
||||
|
||||
public boolean isWorld(World world)
|
||||
{
|
||||
return world.getName().equals(getName()) && world.getSeed() == getSeed() && getEnvironment().equals(world.getEnvironment()) && world.getWorldFolder().equals(getFolder());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if(this == obj)
|
||||
return true;
|
||||
if(obj == null)
|
||||
return false;
|
||||
if(getClass() != obj.getClass())
|
||||
return false;
|
||||
TerrainTarget other = (TerrainTarget) obj;
|
||||
if(environment != other.environment)
|
||||
return false;
|
||||
if(folder == null)
|
||||
{
|
||||
if(other.folder != null)
|
||||
return false;
|
||||
}
|
||||
else if(!folder.equals(other.folder))
|
||||
return false;
|
||||
if(name == null)
|
||||
{
|
||||
if(other.name != null)
|
||||
return false;
|
||||
}
|
||||
else if(!name.equals(other.name))
|
||||
return false;
|
||||
if(seed != other.seed)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((environment == null) ? 0 : environment.hashCode());
|
||||
result = prime * result + ((folder == null) ? 0 : folder.hashCode());
|
||||
result = prime * result + ((name == null) ? 0 : name.hashCode());
|
||||
result = prime * result + (int) (seed ^ (seed >>> 32));
|
||||
return result;
|
||||
}
|
||||
}
|
@ -1,173 +0,0 @@
|
||||
package com.volmit.iris.manager;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.IrisSettings;
|
||||
import com.volmit.iris.generator.legacy.scaffold.IrisContext;
|
||||
import com.volmit.iris.util.ChronoLatch;
|
||||
import com.volmit.iris.util.FolderWatcher;
|
||||
import com.volmit.iris.util.J;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class IrisHotloadManager
|
||||
{
|
||||
private ChronoLatch latch;
|
||||
private volatile boolean busy = false;
|
||||
private FolderWatcher w;
|
||||
|
||||
public IrisHotloadManager()
|
||||
{
|
||||
if(!IrisSettings.get().studio)
|
||||
{
|
||||
w = null;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
w = new FolderWatcher(Iris.proj.getWorkspaceFolder());
|
||||
}
|
||||
|
||||
latch = new ChronoLatch(3000);
|
||||
}
|
||||
|
||||
public void check(IrisContext ch)
|
||||
{
|
||||
if(!IrisSettings.get().isStudio())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(!latch.flip())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(busy)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
busy = true;
|
||||
J.attemptAsync(() ->
|
||||
{
|
||||
boolean modified = false;
|
||||
int c = 0;
|
||||
|
||||
try
|
||||
{
|
||||
if(w.checkModified())
|
||||
{
|
||||
for(File i : w.getCreated())
|
||||
{
|
||||
if(i.isDirectory())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if(i.getPath().contains(".git"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if(i.getPath().contains("_docs"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if(i.getName().endsWith(".code-workspace"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
modified = true;
|
||||
c++;
|
||||
Iris.verbose("File Created: " + i.getPath());
|
||||
}
|
||||
|
||||
for(File i : w.getDeleted())
|
||||
{
|
||||
if(i.isDirectory())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if(i.getPath().contains("_docs"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if(i.getPath().contains(".git"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if(i.getName().endsWith(".code-workspace"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
modified = true;
|
||||
c++;
|
||||
Iris.verbose("File Deleted: " + i.getPath());
|
||||
}
|
||||
|
||||
for(File i : w.getChanged())
|
||||
{
|
||||
if(i.isDirectory())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if(i.getPath().contains(".git"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if(i.getPath().contains("_docs"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if(i.getName().endsWith(".code-workspace"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
modified = true;
|
||||
c++;
|
||||
Iris.verbose("File Modified: " + i.getPath());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
catch(Throwable e)
|
||||
{
|
||||
|
||||
}
|
||||
int cc = c;
|
||||
if(modified)
|
||||
{
|
||||
J.s(() ->
|
||||
{
|
||||
String m = "Hotloaded " + cc + " File" + (cc == 1 ? "" : "s");
|
||||
|
||||
for(Player i : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
i.sendMessage(Iris.instance.getTag("Studio") + m);
|
||||
}
|
||||
|
||||
Bukkit.getConsoleSender().sendMessage(Iris.instance.getTag("Studio") + m);
|
||||
ch.onHotloaded();
|
||||
busy = false;
|
||||
});
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
busy = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
package com.volmit.iris.manager.command;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.generator.legacy.scaffold.IrisMetrics;
|
||||
import com.volmit.iris.scaffold.IrisWorlds;
|
||||
import com.volmit.iris.scaffold.engine.IrisAccess;
|
||||
import com.volmit.iris.util.*;
|
||||
@ -37,15 +36,7 @@ public class CommandIrisMetrics extends MortarCommand
|
||||
}
|
||||
|
||||
IrisAccess g = IrisWorlds.access(world);
|
||||
IrisMetrics m = new IrisMetrics(20); // TODO: BROKEN
|
||||
sender.sendMessage("Thread Count: " + C.BOLD + "" + C.WHITE + g.getThreadCount());
|
||||
sender.sendMessage("Total : " + C.BOLD + "" + C.WHITE + Form.duration(m.getTotal().getAverage(), 2));
|
||||
sender.sendMessage(" Terrain : " + C.BOLD + "" + C.WHITE + Form.duration(m.getTerrain().getAverage(), 2));
|
||||
sender.sendMessage(" Deposits : " + C.BOLD + "" + C.WHITE + Form.duration(m.getDeposits().getAverage(), 2));
|
||||
sender.sendMessage(" Parallax: " + C.BOLD + "" + C.WHITE + Form.duration(m.getParallax().getAverage(), 2));
|
||||
sender.sendMessage(" Post : " + C.BOLD + "" + C.WHITE + Form.duration(m.getPost().getAverage(), 2));
|
||||
sender.sendMessage("Lighting : " + C.BOLD + "" + C.WHITE + Form.duration(m.getUpdate().getAverage(), 2));
|
||||
sender.sendMessage("Spawns : " + C.BOLD + "" + C.WHITE + Form.duration(m.getSpawns().getAverage(), 2));
|
||||
// TODO: METRICS
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package com.volmit.iris.scaffold.engine;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.generator.IrisEngineCompound;
|
||||
import com.volmit.iris.generator.legacy.scaffold.TerrainChunk;
|
||||
import com.volmit.iris.util.TerrainChunk;
|
||||
import com.volmit.iris.manager.IrisDataManager;
|
||||
import com.volmit.iris.object.IrisBiome;
|
||||
import com.volmit.iris.object.IrisDimension;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.volmit.iris.generator.legacy.scaffold;
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Collection;
|
@ -1,10 +1,8 @@
|
||||
package com.volmit.iris.generator.legacy.scaffold;
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.generator.ChunkGenerator.BiomeGrid;
|
||||
|
||||
import com.volmit.iris.util.IrisMathHelper;
|
||||
|
||||
public class IrisBiomeStorage
|
||||
{
|
||||
private static final int e;
|
@ -1,4 +1,4 @@
|
||||
package com.volmit.iris.generator.legacy.scaffold;
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
@ -1,4 +1,4 @@
|
||||
package com.volmit.iris.generator.legacy.scaffold;
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Biome;
|
Loading…
x
Reference in New Issue
Block a user