mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
Cleanup
This commit is contained in:
parent
3b61b87501
commit
44d75d9955
@ -24,14 +24,11 @@ import com.volmit.iris.engine.framework.Engine;
|
|||||||
import com.volmit.iris.engine.platform.PlatformChunkGenerator;
|
import com.volmit.iris.engine.platform.PlatformChunkGenerator;
|
||||||
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.format.Form;
|
||||||
import com.volmit.iris.util.math.RNG;
|
|
||||||
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;
|
||||||
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 com.volmit.iris.util.scheduling.J;
|
||||||
import com.volmit.iris.util.scheduling.jobs.Job;
|
|
||||||
import com.volmit.iris.util.scheduling.jobs.JobCollection;
|
|
||||||
import com.volmit.iris.util.scheduling.jobs.QueueJob;
|
import com.volmit.iris.util.scheduling.jobs.QueueJob;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
|
|
||||||
@ -53,18 +50,15 @@ public class CommandIrisRegen extends MortarCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(VolmitSender sender, String[] args) {
|
public boolean handle(VolmitSender sender, String[] args) {
|
||||||
if (!sender.isPlayer())
|
if (!sender.isPlayer()) {
|
||||||
{
|
|
||||||
sender.sendMessage("Must be in an iris world.");
|
sender.sendMessage("Must be in an iris world.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(IrisToolbelt.isIrisWorld(sender.player().getWorld()))
|
if (IrisToolbelt.isIrisWorld(sender.player().getWorld())) {
|
||||||
{
|
|
||||||
J.a(() -> {
|
J.a(() -> {
|
||||||
PlatformChunkGenerator plat = IrisToolbelt.access(sender.player().getWorld());
|
PlatformChunkGenerator plat = IrisToolbelt.access(sender.player().getWorld());
|
||||||
Engine engine = plat.getEngine();
|
Engine engine = plat.getEngine();
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
int vd = Integer.parseInt(args[0]);
|
int vd = Integer.parseInt(args[0]);
|
||||||
int rg = 0;
|
int rg = 0;
|
||||||
Chunk cx = sender.player().getLocation().getChunk();
|
Chunk cx = sender.player().getLocation().getChunk();
|
||||||
@ -78,15 +72,12 @@ public class CommandIrisRegen extends MortarCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = -vd; i <= vd; i++)
|
for (int i = -vd; i <= vd; i++) {
|
||||||
{
|
for (int j = -vd; j <= vd; j++) {
|
||||||
for(int j = -vd; j <= vd; j++)
|
|
||||||
{
|
|
||||||
int finalJ = j;
|
int finalJ = j;
|
||||||
int finalI = i;
|
int finalI = i;
|
||||||
b.queue(() -> plat.injectChunkReplacement(sender.player().getWorld(), finalI + cx.getX(), finalJ + cx.getZ(), (f) -> {
|
b.queue(() -> plat.injectChunkReplacement(sender.player().getWorld(), finalI + cx.getX(), finalJ + cx.getZ(), (f) -> {
|
||||||
synchronized (js)
|
synchronized (js) {
|
||||||
{
|
|
||||||
js.add(f);
|
js.add(f);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
@ -102,10 +93,8 @@ public class CommandIrisRegen extends MortarCommand {
|
|||||||
public void execute(Runnable runnable) {
|
public void execute(Runnable runnable) {
|
||||||
futures.add(J.sfut(runnable));
|
futures.add(J.sfut(runnable));
|
||||||
|
|
||||||
if(futures.size() > 64)
|
if (futures.size() > 64) {
|
||||||
{
|
while (futures.isNotEmpty()) {
|
||||||
while(futures.isNotEmpty())
|
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
futures.remove(0).get();
|
futures.remove(0).get();
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
@ -124,10 +113,7 @@ public class CommandIrisRegen extends MortarCommand {
|
|||||||
};
|
};
|
||||||
r.queue(js);
|
r.queue(js);
|
||||||
r.execute(sender);
|
r.execute(sender);
|
||||||
}
|
} catch (Throwable e) {
|
||||||
|
|
||||||
catch(Throwable e)
|
|
||||||
{
|
|
||||||
sender.sendMessage("Unable to parse view-distance");
|
sender.sendMessage("Unable to parse view-distance");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -58,7 +58,17 @@ import java.util.function.BiFunction;
|
|||||||
|
|
||||||
public class VisionGUI extends JPanel implements MouseWheelListener, KeyListener, MouseMotionListener, MouseInputListener {
|
public class VisionGUI extends JPanel implements MouseWheelListener, KeyListener, MouseMotionListener, MouseInputListener {
|
||||||
private static final long serialVersionUID = 2094606939770332040L;
|
private static final long serialVersionUID = 2094606939770332040L;
|
||||||
|
private final KList<LivingEntity> lastEntities = new KList<>();
|
||||||
|
private final KMap<String, Long> notifications = new KMap<>();
|
||||||
|
private final ChronoLatch centities = new ChronoLatch(1000);
|
||||||
|
private final RollingSequence rs = new RollingSequence(512);
|
||||||
|
private final O<Integer> m = new O<>();
|
||||||
|
private final KMap<BlockPosition, BufferedImage> positions = new KMap<>();
|
||||||
|
private final KMap<BlockPosition, BufferedImage> fastpositions = new KMap<>();
|
||||||
|
private final KSet<BlockPosition> working = new KSet<>();
|
||||||
|
private final KSet<BlockPosition> workingfast = new KSet<>();
|
||||||
|
double tfps = 240D;
|
||||||
|
int ltc = 3;
|
||||||
private RenderType currentType = RenderType.BIOME;
|
private RenderType currentType = RenderType.BIOME;
|
||||||
private boolean help = true;
|
private boolean help = true;
|
||||||
private boolean helpIgnored = false;
|
private boolean helpIgnored = false;
|
||||||
@ -82,7 +92,6 @@ public class VisionGUI extends JPanel implements MouseWheelListener, KeyListener
|
|||||||
private int h = 0;
|
private int h = 0;
|
||||||
private double lx = 0;
|
private double lx = 0;
|
||||||
private double lz = 0;
|
private double lz = 0;
|
||||||
private final KList<LivingEntity> lastEntities = new KList<>();
|
|
||||||
private double ox = 0;
|
private double ox = 0;
|
||||||
private double oz = 0;
|
private double oz = 0;
|
||||||
private double hx = 0;
|
private double hx = 0;
|
||||||
@ -90,17 +99,7 @@ public class VisionGUI extends JPanel implements MouseWheelListener, KeyListener
|
|||||||
private double oxp = 0;
|
private double oxp = 0;
|
||||||
private double ozp = 0;
|
private double ozp = 0;
|
||||||
private Engine engine;
|
private Engine engine;
|
||||||
private final KMap<String, Long> notifications = new KMap<>();
|
|
||||||
double tfps = 240D;
|
|
||||||
int ltc = 3;
|
|
||||||
private final ChronoLatch centities = new ChronoLatch(1000);
|
|
||||||
private final RollingSequence rs = new RollingSequence(512);
|
|
||||||
private final O<Integer> m = new O<>();
|
|
||||||
private int tid = 0;
|
private int tid = 0;
|
||||||
private final KMap<BlockPosition, BufferedImage> positions = new KMap<>();
|
|
||||||
private final KMap<BlockPosition, BufferedImage> fastpositions = new KMap<>();
|
|
||||||
private final KSet<BlockPosition> working = new KSet<>();
|
|
||||||
private final KSet<BlockPosition> workingfast = new KSet<>();
|
|
||||||
private final ExecutorService e = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors(), r -> {
|
private final ExecutorService e = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors(), r -> {
|
||||||
tid++;
|
tid++;
|
||||||
Thread t = new Thread(r);
|
Thread t = new Thread(r);
|
||||||
@ -153,6 +152,33 @@ public class VisionGUI extends JPanel implements MouseWheelListener, KeyListener
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void createAndShowGUI(Engine r, int s, IrisWorld world) {
|
||||||
|
JFrame frame = new JFrame("Vision");
|
||||||
|
VisionGUI nv = new VisionGUI(frame);
|
||||||
|
nv.world = world;
|
||||||
|
nv.engine = r;
|
||||||
|
nv.renderer = new IrisRenderer(r);
|
||||||
|
frame.add(nv);
|
||||||
|
frame.setSize(1440, 820);
|
||||||
|
frame.setVisible(true);
|
||||||
|
File file = Iris.getCached("Iris Icon", "https://raw.githubusercontent.com/VolmitSoftware/Iris/master/icon.png");
|
||||||
|
|
||||||
|
if (file != null) {
|
||||||
|
try {
|
||||||
|
nv.texture = ImageIO.read(file);
|
||||||
|
frame.setIconImage(ImageIO.read(file));
|
||||||
|
} catch (IOException e) {
|
||||||
|
Iris.reportError(e);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void launch(Engine g, int i) {
|
||||||
|
J.a(() ->
|
||||||
|
createAndShowGUI(g, i, g.getWorld()));
|
||||||
|
}
|
||||||
|
|
||||||
public boolean updateEngine() {
|
public boolean updateEngine() {
|
||||||
if (engine.isClosed()) {
|
if (engine.isClosed()) {
|
||||||
if (world.hasRealWorld()) {
|
if (world.hasRealWorld()) {
|
||||||
@ -755,33 +781,6 @@ public class VisionGUI extends JPanel implements MouseWheelListener, KeyListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void createAndShowGUI(Engine r, int s, IrisWorld world) {
|
|
||||||
JFrame frame = new JFrame("Vision");
|
|
||||||
VisionGUI nv = new VisionGUI(frame);
|
|
||||||
nv.world = world;
|
|
||||||
nv.engine = r;
|
|
||||||
nv.renderer = new IrisRenderer(r);
|
|
||||||
frame.add(nv);
|
|
||||||
frame.setSize(1440, 820);
|
|
||||||
frame.setVisible(true);
|
|
||||||
File file = Iris.getCached("Iris Icon", "https://raw.githubusercontent.com/VolmitSoftware/Iris/master/icon.png");
|
|
||||||
|
|
||||||
if (file != null) {
|
|
||||||
try {
|
|
||||||
nv.texture = ImageIO.read(file);
|
|
||||||
frame.setIconImage(ImageIO.read(file));
|
|
||||||
} catch (IOException e) {
|
|
||||||
Iris.reportError(e);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void launch(Engine g, int i) {
|
|
||||||
J.a(() ->
|
|
||||||
createAndShowGUI(g, i, g.getWorld()));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void mouseWheelMoved(MouseWheelEvent e) {
|
public void mouseWheelMoved(MouseWheelEvent e) {
|
||||||
int notches = e.getWheelRotation();
|
int notches = e.getWheelRotation();
|
||||||
if (e.isControlDown()) {
|
if (e.isControlDown()) {
|
||||||
|
@ -49,8 +49,7 @@ public class AsyncPregenMethod implements PregeneratorMethod {
|
|||||||
private void unloadAndSaveAllChunks() {
|
private void unloadAndSaveAllChunks() {
|
||||||
try {
|
try {
|
||||||
J.sfut(() -> {
|
J.sfut(() -> {
|
||||||
if(world == null)
|
if (world == null) {
|
||||||
{
|
|
||||||
Iris.warn("World was null somehow...");
|
Iris.warn("World was null somehow...");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -223,8 +223,7 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void spawnIn(Chunk c, boolean initial) {
|
private void spawnIn(Chunk c, boolean initial) {
|
||||||
if(initial)
|
if (initial) {
|
||||||
{
|
|
||||||
energy += 1.2;
|
energy += 1.2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -375,8 +374,7 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
|
|||||||
fixEnergy();
|
fixEnergy();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Mantle getMantle()
|
public Mantle getMantle() {
|
||||||
{
|
|
||||||
return getEngine().getMantle().getMantle();
|
return getEngine().getMantle().getMantle();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -392,37 +390,15 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
|
|||||||
Runnable drop = () -> J.s(() -> d.forEach((i) -> e.getBlock().getWorld().dropItemNaturally(e.getBlock().getLocation().clone().add(0.5, 0.5, 0.5), i)));
|
Runnable drop = () -> J.s(() -> d.forEach((i) -> e.getBlock().getWorld().dropItemNaturally(e.getBlock().getLocation().clone().add(0.5, 0.5, 0.5), i)));
|
||||||
IrisBiome b = getEngine().getBiome(e.getBlock().getLocation());
|
IrisBiome b = getEngine().getBiome(e.getBlock().getLocation());
|
||||||
|
|
||||||
for (IrisBlockDrops i : b.getBlockDrops()) {
|
if (dropItems(e, d, drop, b.getBlockDrops(), b)) {
|
||||||
if (i.shouldDropFor(e.getBlock().getBlockData(), getData())) {
|
|
||||||
if (i.isReplaceVanillaDrops()) {
|
|
||||||
e.setDropItems(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
i.fillDrops(false, d);
|
|
||||||
|
|
||||||
if (i.isSkipParents()) {
|
|
||||||
drop.run();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
IrisRegion r = getEngine().getRegion(e.getBlock().getLocation());
|
IrisRegion r = getEngine().getRegion(e.getBlock().getLocation());
|
||||||
|
|
||||||
for (IrisBlockDrops i : r.getBlockDrops()) {
|
if (dropItems(e, d, drop, r.getBlockDrops(), b)) {
|
||||||
if (i.shouldDropFor(e.getBlock().getBlockData(), getData())) {
|
|
||||||
if (i.isReplaceVanillaDrops()) {
|
|
||||||
e.setDropItems(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
i.fillDrops(false, d);
|
|
||||||
|
|
||||||
if (i.isSkipParents()) {
|
|
||||||
drop.run();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (IrisBlockDrops i : getEngine().getDimension().getBlockDrops()) {
|
for (IrisBlockDrops i : getEngine().getDimension().getBlockDrops()) {
|
||||||
if (i.shouldDropFor(e.getBlock().getBlockData(), getData())) {
|
if (i.shouldDropFor(e.getBlock().getBlockData(), getData())) {
|
||||||
@ -441,6 +417,24 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean dropItems(BlockBreakEvent e, KList<ItemStack> d, Runnable drop, KList<IrisBlockDrops> blockDrops, IrisBiome b) {
|
||||||
|
for (IrisBlockDrops i : blockDrops) {
|
||||||
|
if (i.shouldDropFor(e.getBlock().getBlockData(), getData())) {
|
||||||
|
if (i.isReplaceVanillaDrops()) {
|
||||||
|
e.setDropItems(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
i.fillDrops(false, d);
|
||||||
|
|
||||||
|
if (i.isSkipParents()) {
|
||||||
|
drop.run();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlace(BlockPlaceEvent e) {
|
public void onBlockPlace(BlockPlaceEvent e) {
|
||||||
|
|
||||||
|
@ -56,9 +56,9 @@ public class LinkedTerrainChunk implements TerrainChunk {
|
|||||||
@Override
|
@Override
|
||||||
public BiomeBaseInjector getBiomeBaseInjector() {
|
public BiomeBaseInjector getBiomeBaseInjector() {
|
||||||
|
|
||||||
if(unsafe)
|
if (unsafe) {
|
||||||
{
|
return (a, b, c, d) -> {
|
||||||
return (a,b,c,d) -> {};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
return (x, y, z, bb) -> INMS.get().forceBiomeInto(x, y, z, bb, storage);
|
return (x, y, z, bb) -> INMS.get().forceBiomeInto(x, y, z, bb, storage);
|
||||||
|
@ -147,8 +147,7 @@ public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdat
|
|||||||
double modifyZ(double z);
|
double modifyZ(double z);
|
||||||
|
|
||||||
@BlockCoordinates
|
@BlockCoordinates
|
||||||
default void generate(int x, int z, TerrainChunk tc, boolean multicore) throws WrongEngineBroException
|
default void generate(int x, int z, TerrainChunk tc, boolean multicore) throws WrongEngineBroException {
|
||||||
{
|
|
||||||
generate(x, z, Hunk.view((ChunkGenerator.ChunkData) tc), Hunk.view((ChunkGenerator.BiomeGrid) tc), multicore);
|
generate(x, z, Hunk.view((ChunkGenerator.ChunkData) tc), Hunk.view((ChunkGenerator.BiomeGrid) tc), multicore);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,6 @@ import com.volmit.iris.util.documentation.ChunkCoordinates;
|
|||||||
import com.volmit.iris.util.hunk.Hunk;
|
import com.volmit.iris.util.hunk.Hunk;
|
||||||
import com.volmit.iris.util.mantle.Mantle;
|
import com.volmit.iris.util.mantle.Mantle;
|
||||||
import com.volmit.iris.util.mantle.MantleChunk;
|
import com.volmit.iris.util.mantle.MantleChunk;
|
||||||
import com.volmit.iris.util.mantle.MantleFlag;
|
|
||||||
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;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
@ -193,8 +192,7 @@ public interface EngineMantle extends IObjectPlacer {
|
|||||||
burst.queue(() -> {
|
burst.queue(() -> {
|
||||||
MantleChunk mc = getMantle().getChunk(xx, zz);
|
MantleChunk mc = getMantle().getChunk(xx, zz);
|
||||||
|
|
||||||
for(MantleComponent k : getComponents())
|
for (MantleComponent k : getComponents()) {
|
||||||
{
|
|
||||||
generateMantleComponent(writer, xx, zz, k, c, mc);
|
generateMantleComponent(writer, xx, zz, k, c, mc);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -282,13 +280,11 @@ public interface EngineMantle extends IObjectPlacer {
|
|||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
default boolean queueRegenerate(int x, int z)
|
default boolean queueRegenerate(int x, int z) {
|
||||||
{
|
|
||||||
return false; // TODO:
|
return false; // TODO:
|
||||||
}
|
}
|
||||||
|
|
||||||
default boolean dequeueRegenerate(int x, int z)
|
default boolean dequeueRegenerate(int x, int z) {
|
||||||
{
|
|
||||||
return false;// TODO:
|
return false;// TODO:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,13 +40,11 @@ public enum StudioMode {
|
|||||||
|
|
||||||
private final Consumer<BukkitChunkGenerator> injector;
|
private final Consumer<BukkitChunkGenerator> injector;
|
||||||
|
|
||||||
StudioMode(Consumer<BukkitChunkGenerator> injector)
|
StudioMode(Consumer<BukkitChunkGenerator> injector) {
|
||||||
{
|
|
||||||
this.injector = injector;
|
this.injector = injector;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void inject(BukkitChunkGenerator c)
|
public void inject(BukkitChunkGenerator c) {
|
||||||
{
|
|
||||||
injector.accept(c);
|
injector.accept(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,6 @@ package com.volmit.iris.engine.object.entity;
|
|||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.project.loader.IrisRegistrant;
|
import com.volmit.iris.core.project.loader.IrisRegistrant;
|
||||||
import com.volmit.iris.core.service.WandSVC;
|
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
import com.volmit.iris.engine.object.annotations.*;
|
import com.volmit.iris.engine.object.annotations.*;
|
||||||
import com.volmit.iris.engine.object.common.IrisScript;
|
import com.volmit.iris.engine.object.common.IrisScript;
|
||||||
@ -46,10 +45,8 @@ import lombok.NoArgsConstructor;
|
|||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
import org.bukkit.attribute.Attributable;
|
import org.bukkit.attribute.Attributable;
|
||||||
import org.bukkit.block.data.BlockData;
|
|
||||||
import org.bukkit.entity.*;
|
import org.bukkit.entity.*;
|
||||||
import org.bukkit.entity.Panda.Gene;
|
import org.bukkit.entity.Panda.Gene;
|
||||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.loot.LootContext;
|
import org.bukkit.loot.LootContext;
|
||||||
@ -334,8 +331,7 @@ public class IrisEntity extends IrisRegistrant {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isSpawnEffectRiseOutOfGround() && e instanceof LivingEntity)
|
if (isSpawnEffectRiseOutOfGround() && e instanceof LivingEntity) {
|
||||||
{
|
|
||||||
Location start = at.clone();
|
Location start = at.clone();
|
||||||
e.setInvulnerable(true);
|
e.setInvulnerable(true);
|
||||||
((LivingEntity) e).setAI(false);
|
((LivingEntity) e).setAI(false);
|
||||||
@ -344,19 +340,14 @@ public class IrisEntity extends IrisRegistrant {
|
|||||||
|
|
||||||
AtomicInteger v = new AtomicInteger(0);
|
AtomicInteger v = new AtomicInteger(0);
|
||||||
v.set(J.sr(() -> {
|
v.set(J.sr(() -> {
|
||||||
if(e.getLocation().getBlock().getType().isSolid() || ((LivingEntity) e).getEyeLocation().getBlock().getType().isSolid())
|
if (e.getLocation().getBlock().getType().isSolid() || ((LivingEntity) e).getEyeLocation().getBlock().getType().isSolid()) {
|
||||||
{
|
|
||||||
e.teleport(start.add(new Vector(0, 0.1, 0)));
|
e.teleport(start.add(new Vector(0, 0.1, 0)));
|
||||||
ItemStack itemCrackData = new ItemStack(((LivingEntity) e).getEyeLocation().clone().subtract(0, 2, 0).getBlock().getBlockData().getMaterial());
|
ItemStack itemCrackData = new ItemStack(((LivingEntity) e).getEyeLocation().clone().subtract(0, 2, 0).getBlock().getBlockData().getMaterial());
|
||||||
e.getWorld().spawnParticle(Particle.ITEM_CRACK, ((LivingEntity) e).getEyeLocation(), 6, 0.2, 0.4, 0.2, 0.06f, itemCrackData);
|
e.getWorld().spawnParticle(Particle.ITEM_CRACK, ((LivingEntity) e).getEyeLocation(), 6, 0.2, 0.4, 0.2, 0.06f, itemCrackData);
|
||||||
if(M.r(0.2))
|
if (M.r(0.2)) {
|
||||||
{
|
|
||||||
e.getWorld().playSound(e.getLocation(), Sound.BLOCK_CHORUS_FLOWER_GROW, 0.8f, 0.1f);
|
e.getWorld().playSound(e.getLocation(), Sound.BLOCK_CHORUS_FLOWER_GROW, 0.8f, 0.1f);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
J.csr(v.get());
|
J.csr(v.get());
|
||||||
((LivingEntity) e).setNoDamageTicks(0);
|
((LivingEntity) e).setNoDamageTicks(0);
|
||||||
((LivingEntity) e).setCollidable(true);
|
((LivingEntity) e).setCollidable(true);
|
||||||
@ -369,17 +360,14 @@ public class IrisEntity extends IrisRegistrant {
|
|||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int surfaceY(Location l)
|
private int surfaceY(Location l) {
|
||||||
{
|
|
||||||
int m = l.getBlockY();
|
int m = l.getBlockY();
|
||||||
|
|
||||||
while(m-- > 0)
|
while (m-- > 0) {
|
||||||
{
|
|
||||||
Location ll = l.clone();
|
Location ll = l.clone();
|
||||||
ll.setY(m);
|
ll.setY(m);
|
||||||
|
|
||||||
if(ll.getBlock().getType().isSolid())
|
if (ll.getBlock().getType().isSolid()) {
|
||||||
{
|
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,6 @@ import com.volmit.iris.util.collection.KList;
|
|||||||
import com.volmit.iris.util.data.IrisBiomeStorage;
|
import com.volmit.iris.util.data.IrisBiomeStorage;
|
||||||
import com.volmit.iris.util.hunk.Hunk;
|
import com.volmit.iris.util.hunk.Hunk;
|
||||||
import com.volmit.iris.util.io.ReactiveFolder;
|
import com.volmit.iris.util.io.ReactiveFolder;
|
||||||
import com.volmit.iris.util.math.RNG;
|
|
||||||
import com.volmit.iris.util.scheduling.ChronoLatch;
|
import com.volmit.iris.util.scheduling.ChronoLatch;
|
||||||
import com.volmit.iris.util.scheduling.J;
|
import com.volmit.iris.util.scheduling.J;
|
||||||
import com.volmit.iris.util.scheduling.Looper;
|
import com.volmit.iris.util.scheduling.Looper;
|
||||||
@ -168,18 +167,14 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
|
|||||||
getEngine().generate(x << 4, z << 4, blocks, biomes, true);
|
getEngine().generate(x << 4, z << 4, blocks, biomes, true);
|
||||||
Iris.debug("Regenerated " + x + " " + z);
|
Iris.debug("Regenerated " + x + " " + z);
|
||||||
int t = 0;
|
int t = 0;
|
||||||
for(int i = getEngine().getHeight() >> 4; i >= 0; i--)
|
for (int i = getEngine().getHeight() >> 4; i >= 0; i--) {
|
||||||
{
|
if (!world.isChunkLoaded(x, z)) {
|
||||||
if(!world.isChunkLoaded(x, z))
|
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Chunk c = world.getChunkAt(x, z);
|
Chunk c = world.getChunkAt(x, z);
|
||||||
for(Entity ee : c.getEntities())
|
for (Entity ee : c.getEntities()) {
|
||||||
{
|
if (ee instanceof Player) {
|
||||||
if(ee instanceof Player)
|
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,14 +186,10 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
|
|||||||
int finalI = i;
|
int finalI = i;
|
||||||
jobs.accept(() -> {
|
jobs.accept(() -> {
|
||||||
|
|
||||||
for(int xx = 0; xx < 16; xx++)
|
for (int xx = 0; xx < 16; xx++) {
|
||||||
{
|
for (int yy = 0; yy < 16; yy++) {
|
||||||
for(int yy = 0; yy < 16; yy++)
|
for (int zz = 0; zz < 16; zz++) {
|
||||||
{
|
if (yy + (finalI << 4) >= engine.getHeight() || yy + (finalI << 4) < 0) {
|
||||||
for(int zz = 0; zz < 16; zz++)
|
|
||||||
{
|
|
||||||
if(yy + (finalI << 4) >= engine.getHeight() || yy + (finalI << 4) < 0)
|
|
||||||
{
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -284,13 +275,9 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
|
|||||||
TerrainChunk tc = TerrainChunk.create(world, biome);
|
TerrainChunk tc = TerrainChunk.create(world, biome);
|
||||||
this.world.bind(world);
|
this.world.bind(world);
|
||||||
|
|
||||||
if(studioGenerator != null)
|
if (studioGenerator != null) {
|
||||||
{
|
|
||||||
studioGenerator.generateChunk(getEngine(), tc, x, z);
|
studioGenerator.generateChunk(getEngine(), tc, x, z);
|
||||||
}
|
} else {
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Hunk<BlockData> blocks = Hunk.view((ChunkData) tc);
|
Hunk<BlockData> blocks = Hunk.view((ChunkData) tc);
|
||||||
Hunk<Biome> biomes = Hunk.view((BiomeGrid) tc);
|
Hunk<Biome> biomes = Hunk.view((BiomeGrid) tc);
|
||||||
getEngine().generate(x << 4, z << 4, blocks, biomes, true);
|
getEngine().generate(x << 4, z << 4, blocks, biomes, true);
|
||||||
@ -333,8 +320,7 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void computeStudioGenerator() {
|
private void computeStudioGenerator() {
|
||||||
if(!getEngine().getDimension().getStudioMode().equals(lastMode))
|
if (!getEngine().getDimension().getStudioMode().equals(lastMode)) {
|
||||||
{
|
|
||||||
lastMode = getEngine().getDimension().getStudioMode();
|
lastMode = getEngine().getDimension().getStudioMode();
|
||||||
getEngine().getDimension().getStudioMode().inject(this);
|
getEngine().getDimension().getStudioMode().inject(this);
|
||||||
}
|
}
|
||||||
|
@ -46,21 +46,17 @@ public class BiomeBuffetGenerator extends EnginedStudioGenerator {
|
|||||||
public void generateChunk(Engine engine, TerrainChunk tc, int x, int z) throws WrongEngineBroException {
|
public void generateChunk(Engine engine, TerrainChunk tc, int x, int z) throws WrongEngineBroException {
|
||||||
int id = Cache.to1D(x / biomeSize, 0, z / biomeSize, width, 1);
|
int id = Cache.to1D(x / biomeSize, 0, z / biomeSize, width, 1);
|
||||||
|
|
||||||
if(id >= 0 && id < biomes.length)
|
if (id >= 0 && id < biomes.length) {
|
||||||
{
|
|
||||||
IrisBiome biome = biomes[id];
|
IrisBiome biome = biomes[id];
|
||||||
String foc = engine.getDimension().getFocus();
|
String foc = engine.getDimension().getFocus();
|
||||||
|
|
||||||
if(!Objects.equals(foc, biome.getLoadKey()))
|
if (!Objects.equals(foc, biome.getLoadKey())) {
|
||||||
{
|
|
||||||
engine.getDimension().setFocus(biome.getLoadKey());
|
engine.getDimension().setFocus(biome.getLoadKey());
|
||||||
engine.hotloadComplex();
|
engine.hotloadComplex();
|
||||||
}
|
}
|
||||||
|
|
||||||
engine.generate(x << 4, z << 4, tc, true);
|
engine.generate(x << 4, z << 4, tc, true);
|
||||||
}
|
} else {
|
||||||
|
|
||||||
else {
|
|
||||||
tc.setRegion(0, 0, 0, 16, 1, 16, FLOOR);
|
tc.setRegion(0, 0, 0, 16, 1, 16, FLOOR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -432,8 +432,7 @@ public class Mantle {
|
|||||||
try {
|
try {
|
||||||
region = TectonicPlate.read(worldHeight, file);
|
region = TectonicPlate.read(worldHeight, file);
|
||||||
|
|
||||||
if(region.getX() != x || region.getZ() != z)
|
if (region.getX() != x || region.getZ() != z) {
|
||||||
{
|
|
||||||
Iris.warn("Loaded Tectonic Plate " + x + "," + z + " but read it as " + region.getX() + "," + region.getZ() + "... Assuming " + x + "," + z);
|
Iris.warn("Loaded Tectonic Plate " + x + "," + z + " but read it as " + region.getX() + "," + region.getZ() + "... Assuming " + x + "," + z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,8 +42,7 @@ public class BurstExecutor {
|
|||||||
|
|
||||||
@SuppressWarnings("UnusedReturnValue")
|
@SuppressWarnings("UnusedReturnValue")
|
||||||
public Future<?> queue(Runnable r) {
|
public Future<?> queue(Runnable r) {
|
||||||
if(!multicore)
|
if (!multicore) {
|
||||||
{
|
|
||||||
r.run();
|
r.run();
|
||||||
return CompletableFuture.completedFuture(null);
|
return CompletableFuture.completedFuture(null);
|
||||||
}
|
}
|
||||||
|
@ -256,13 +256,9 @@ public class J {
|
|||||||
* @param delay the delay to wait in ticks before running
|
* @param delay the delay to wait in ticks before running
|
||||||
*/
|
*/
|
||||||
public static void s(Runnable r, int delay) {
|
public static void s(Runnable r, int delay) {
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(Iris.instance, r, delay);
|
Bukkit.getScheduler().scheduleSyncDelayedTask(Iris.instance, r, delay);
|
||||||
}
|
} catch (Throwable e) {
|
||||||
|
|
||||||
catch(Throwable e)
|
|
||||||
{
|
|
||||||
Iris.reportError(e);
|
Iris.reportError(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user