mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-03 08:26:11 +00:00
commit
e90e3901f5
@ -74,6 +74,7 @@ import java.util.zip.GZIPOutputStream;
|
|||||||
@Decree(name = "Developer", origin = DecreeOrigin.BOTH, description = "Iris World Manager", aliases = {"dev"})
|
@Decree(name = "Developer", origin = DecreeOrigin.BOTH, description = "Iris World Manager", aliases = {"dev"})
|
||||||
public class CommandDeveloper implements DecreeExecutor {
|
public class CommandDeveloper implements DecreeExecutor {
|
||||||
private CommandTurboPregen turboPregen;
|
private CommandTurboPregen turboPregen;
|
||||||
|
private CommandUpdater updater;
|
||||||
|
|
||||||
@Decree(description = "Get Loaded TectonicPlates Count", origin = DecreeOrigin.BOTH, sync = true)
|
@Decree(description = "Get Loaded TectonicPlates Count", origin = DecreeOrigin.BOTH, sync = true)
|
||||||
public void EngineStatus() {
|
public void EngineStatus() {
|
||||||
@ -165,18 +166,6 @@ public class CommandDeveloper implements DecreeExecutor {
|
|||||||
sender().sendMessage(C.GREEN + "Done upgrading! You can now update your server version to " + version.getVersion());
|
sender().sendMessage(C.GREEN + "Done upgrading! You can now update your server version to " + version.getVersion());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Decree(description = "Test")
|
|
||||||
public void updater(
|
|
||||||
@Param(description = "Updater for chunks")
|
|
||||||
World world
|
|
||||||
) {
|
|
||||||
Iris.info("test");
|
|
||||||
ChunkUpdater updater = new ChunkUpdater(world);
|
|
||||||
updater.start();
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Decree(description = "test")
|
@Decree(description = "test")
|
||||||
public void mca (
|
public void mca (
|
||||||
@Param(description = "String") String world) {
|
@Param(description = "String") String world) {
|
||||||
|
@ -30,13 +30,13 @@ import com.volmit.iris.util.decree.annotations.Param;
|
|||||||
import com.volmit.iris.util.format.C;
|
import com.volmit.iris.util.format.C;
|
||||||
import com.volmit.iris.util.format.Form;
|
import com.volmit.iris.util.format.Form;
|
||||||
|
|
||||||
@Decree(name = "Updater", origin = DecreeOrigin.BOTH, description = "Iris World Updater")
|
@Decree(name = "updater", origin = DecreeOrigin.BOTH, description = "Iris World Updater")
|
||||||
public class CommandUpdater implements DecreeExecutor {
|
public class CommandUpdater implements DecreeExecutor {
|
||||||
private ChunkUpdater chunkUpdater;
|
private ChunkUpdater chunkUpdater;
|
||||||
|
|
||||||
@Decree(description = "Updates all chunk in the specified world")
|
@Decree(description = "Updates all chunk in the specified world")
|
||||||
public void start(
|
public void start(
|
||||||
@Param(description = "World to update chunks at")
|
@Param(description = "World to update chunks at", contextual = true)
|
||||||
World world
|
World world
|
||||||
) {
|
) {
|
||||||
if (!IrisToolbelt.isIrisWorld(world)) {
|
if (!IrisToolbelt.isIrisWorld(world)) {
|
||||||
|
@ -1,12 +1,19 @@
|
|||||||
package com.volmit.iris.core.link;
|
package com.volmit.iris.core.link;
|
||||||
|
|
||||||
|
import com.volmit.iris.Iris;
|
||||||
|
import com.volmit.iris.engine.data.cache.AtomicCache;
|
||||||
import com.volmit.iris.util.data.Cuboid;
|
import com.volmit.iris.util.data.Cuboid;
|
||||||
|
import com.volmit.iris.util.data.KCache;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.time.Duration;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public class WorldEditLink {
|
public class WorldEditLink {
|
||||||
private static Boolean enabled = null;
|
private static final AtomicCache<Boolean> active = new AtomicCache<>();
|
||||||
|
|
||||||
public static Cuboid getSelection(Player p) {
|
public static Cuboid getSelection(Player p) {
|
||||||
if (!hasWorldEdit())
|
if (!hasWorldEdit())
|
||||||
@ -15,29 +22,38 @@ public class WorldEditLink {
|
|||||||
try {
|
try {
|
||||||
Object instance = Class.forName("com.sk89q.worldedit.WorldEdit").getDeclaredMethod("getInstance").invoke(null);
|
Object instance = Class.forName("com.sk89q.worldedit.WorldEdit").getDeclaredMethod("getInstance").invoke(null);
|
||||||
Object sessionManager = instance.getClass().getDeclaredMethod("getSessionManager").invoke(instance);
|
Object sessionManager = instance.getClass().getDeclaredMethod("getSessionManager").invoke(instance);
|
||||||
Object player = Class.forName("com.sk89q.worldedit.bukkit.BukkitAdapter").getDeclaredMethod("adapt", Player.class).invoke(null, p);
|
Class<?> bukkitAdapter = Class.forName("com.sk89q.worldedit.bukkit.BukkitAdapter");
|
||||||
|
Object world = bukkitAdapter.getDeclaredMethod("adapt", World.class).invoke(null, p.getWorld());
|
||||||
|
Object player = bukkitAdapter.getDeclaredMethod("adapt", Player.class).invoke(null, p);
|
||||||
Object localSession = sessionManager.getClass().getDeclaredMethod("getIfPresent", Class.forName("com.sk89q.worldedit.session.SessionOwner")).invoke(sessionManager, player);
|
Object localSession = sessionManager.getClass().getDeclaredMethod("getIfPresent", Class.forName("com.sk89q.worldedit.session.SessionOwner")).invoke(sessionManager, player);
|
||||||
Object world = Class.forName("com.sk89q.worldedit.bukkit.BukkitAdapter").getDeclaredMethod("adapt", World.class).invoke(null, p.getWorld());
|
if (localSession == null) return null;
|
||||||
Object region = localSession.getClass().getDeclaredMethod("getSelection", world.getClass()).invoke(localSession, world);
|
|
||||||
|
Object region = null;
|
||||||
|
try {
|
||||||
|
region = localSession.getClass().getDeclaredMethod("getSelection", Class.forName("com.sk89q.worldedit.world.World")).invoke(localSession, world);
|
||||||
|
} catch (InvocationTargetException ignored) {}
|
||||||
|
if (region == null) return null;
|
||||||
|
|
||||||
Object min = region.getClass().getDeclaredMethod("getMinimumPoint").invoke(region);
|
Object min = region.getClass().getDeclaredMethod("getMinimumPoint").invoke(region);
|
||||||
Object max = region.getClass().getDeclaredMethod("getMaximumPoint").invoke(region);
|
Object max = region.getClass().getDeclaredMethod("getMaximumPoint").invoke(region);
|
||||||
return new Cuboid(p.getWorld(),
|
return new Cuboid(p.getWorld(),
|
||||||
(int) min.getClass().getDeclaredMethod("getX").invoke(min),
|
(int) min.getClass().getDeclaredMethod("x").invoke(min),
|
||||||
(int) min.getClass().getDeclaredMethod("getY").invoke(min),
|
(int) min.getClass().getDeclaredMethod("y").invoke(min),
|
||||||
(int) min.getClass().getDeclaredMethod("getZ").invoke(min),
|
(int) min.getClass().getDeclaredMethod("z").invoke(min),
|
||||||
(int) min.getClass().getDeclaredMethod("getX").invoke(max),
|
(int) min.getClass().getDeclaredMethod("x").invoke(max),
|
||||||
(int) min.getClass().getDeclaredMethod("getY").invoke(max),
|
(int) min.getClass().getDeclaredMethod("y").invoke(max),
|
||||||
(int) min.getClass().getDeclaredMethod("getZ").invoke(max)
|
(int) min.getClass().getDeclaredMethod("z").invoke(max)
|
||||||
);
|
);
|
||||||
} catch (Throwable ignored) {
|
} catch (Throwable e) {
|
||||||
|
Iris.error("Could not get selection");
|
||||||
|
e.printStackTrace();
|
||||||
|
active.reset();
|
||||||
|
active.aquire(() -> false);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean hasWorldEdit() {
|
public static boolean hasWorldEdit() {
|
||||||
if (enabled == null)
|
return active.aquire(() -> Bukkit.getPluginManager().isPluginEnabled("WorldEdit"));
|
||||||
enabled = Bukkit.getPluginManager().isPluginEnabled("WorldEdit");
|
|
||||||
return enabled;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -240,7 +240,7 @@ public class TreeSVC implements IrisService {
|
|||||||
boolean isUseAll = worldAccess.getEngine().getDimension().getTreeSettings().getMode().equals(IrisTreeModes.ALL);
|
boolean isUseAll = worldAccess.getEngine().getDimension().getTreeSettings().getMode().equals(IrisTreeModes.ALL);
|
||||||
|
|
||||||
// Retrieve objectPlacements of type `species` from biome
|
// Retrieve objectPlacements of type `species` from biome
|
||||||
IrisBiome biome = worldAccess.getEngine().getBiome(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
IrisBiome biome = worldAccess.getEngine().getBiome(location.getBlockX(), location.getBlockY()-worldAccess.getTarget().getWorld().minHeight(), location.getBlockZ());
|
||||||
placements.addAll(matchObjectPlacements(biome.getObjects(), size, type));
|
placements.addAll(matchObjectPlacements(biome.getObjects(), size, type));
|
||||||
|
|
||||||
// Add more or find any in the region
|
// Add more or find any in the region
|
||||||
|
@ -318,7 +318,7 @@ public class WandSVC implements IrisService {
|
|||||||
Vector gx = Vector.getRandom().subtract(Vector.getRandom()).normalize().clone().multiply(0.65);
|
Vector gx = Vector.getRandom().subtract(Vector.getRandom()).normalize().clone().multiply(0.65);
|
||||||
d[0].getWorld().spawnParticle(CRIT_MAGIC, d[0], 1, 0.5 + gx.getX(), 0.5 + gx.getY(), 0.5 + gx.getZ(), 0, null, false);
|
d[0].getWorld().spawnParticle(CRIT_MAGIC, d[0], 1, 0.5 + gx.getX(), 0.5 + gx.getY(), 0.5 + gx.getZ(), 0, null, false);
|
||||||
Vector gxx = Vector.getRandom().subtract(Vector.getRandom()).normalize().clone().multiply(0.65);
|
Vector gxx = Vector.getRandom().subtract(Vector.getRandom()).normalize().clone().multiply(0.65);
|
||||||
d[1].getWorld().spawnParticle(Particle.CRIT, d[1], 1, 0.5 + gxx.getX(), 0.5 + gxx.getY(), 0.5 + gxx.getZ(), 0, null, false);
|
d[1].getWorld().spawnParticle(CRIT_MAGIC, d[1], 1, 0.5 + gxx.getX(), 0.5 + gxx.getY(), 0.5 + gxx.getZ(), 0, null, false);
|
||||||
|
|
||||||
if (!d[0].getWorld().equals(d[1].getWorld())) {
|
if (!d[0].getWorld().equals(d[1].getWorld())) {
|
||||||
return;
|
return;
|
||||||
@ -388,7 +388,7 @@ public class WandSVC implements IrisService {
|
|||||||
if (e.getHand() != EquipmentSlot.HAND)
|
if (e.getHand() != EquipmentSlot.HAND)
|
||||||
return;
|
return;
|
||||||
try {
|
try {
|
||||||
if (isHoldingWand(e.getPlayer())) {
|
if (isHoldingIrisWand(e.getPlayer())) {
|
||||||
if (e.getAction().equals(Action.LEFT_CLICK_BLOCK)) {
|
if (e.getAction().equals(Action.LEFT_CLICK_BLOCK)) {
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
e.getPlayer().getInventory().setItemInMainHand(update(true, Objects.requireNonNull(e.getClickedBlock()).getLocation(), e.getPlayer().getInventory().getItemInMainHand()));
|
e.getPlayer().getInventory().setItemInMainHand(update(true, Objects.requireNonNull(e.getClickedBlock()).getLocation(), e.getPlayer().getInventory().getItemInMainHand()));
|
||||||
|
@ -124,6 +124,7 @@ public class IrisComplex implements DataProvider {
|
|||||||
ProceduralStream.of((x, z) -> focusRegion,
|
ProceduralStream.of((x, z) -> focusRegion,
|
||||||
Interpolated.of(a -> 0D, a -> focusRegion))
|
Interpolated.of(a -> 0D, a -> focusRegion))
|
||||||
: regionStyleStream
|
: regionStyleStream
|
||||||
|
.zoom(engine.getDimension().getRegionZoom())
|
||||||
.selectRarity(data.getRegionLoader().loadAll(engine.getDimension().getRegions()))
|
.selectRarity(data.getRegionLoader().loadAll(engine.getDimension().getRegions()))
|
||||||
.cache2D("regionStream", engine, cacheSize).waste("Region Stream");
|
.cache2D("regionStream", engine, cacheSize).waste("Region Stream");
|
||||||
regionIDStream = regionIdentityStream.convertCached((i) -> new UUID(Double.doubleToLongBits(i),
|
regionIDStream = regionIdentityStream.convertCached((i) -> new UUID(Double.doubleToLongBits(i),
|
||||||
@ -131,6 +132,7 @@ public class IrisComplex implements DataProvider {
|
|||||||
caveBiomeStream = regionStream.contextInjecting((c, x, z) -> IrisContext.getOr(engine).getChunkContext().getRegion().get(x, z))
|
caveBiomeStream = regionStream.contextInjecting((c, x, z) -> IrisContext.getOr(engine).getChunkContext().getRegion().get(x, z))
|
||||||
.convert((r)
|
.convert((r)
|
||||||
-> engine.getDimension().getCaveBiomeStyle().create(rng.nextParallelRNG(InferredType.CAVE.ordinal()), getData()).stream()
|
-> engine.getDimension().getCaveBiomeStyle().create(rng.nextParallelRNG(InferredType.CAVE.ordinal()), getData()).stream()
|
||||||
|
.zoom(engine.getDimension().getBiomeZoom())
|
||||||
.zoom(r.getCaveBiomeZoom())
|
.zoom(r.getCaveBiomeZoom())
|
||||||
.selectRarity(data.getBiomeLoader().loadAll(r.getCaveBiomes()))
|
.selectRarity(data.getBiomeLoader().loadAll(r.getCaveBiomes()))
|
||||||
.onNull(emptyBiome)
|
.onNull(emptyBiome)
|
||||||
@ -139,6 +141,8 @@ public class IrisComplex implements DataProvider {
|
|||||||
landBiomeStream = regionStream.contextInjecting((c, x, z) -> IrisContext.getOr(engine).getChunkContext().getRegion().get(x, z))
|
landBiomeStream = regionStream.contextInjecting((c, x, z) -> IrisContext.getOr(engine).getChunkContext().getRegion().get(x, z))
|
||||||
.convert((r)
|
.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(engine.getDimension().getBiomeZoom())
|
||||||
|
.zoom(engine.getDimension().getLandZoom())
|
||||||
.zoom(r.getLandBiomeZoom())
|
.zoom(r.getLandBiomeZoom())
|
||||||
.selectRarity(data.getBiomeLoader().loadAll(r.getLandBiomes(), (t) -> t.setInferredType(InferredType.LAND)))
|
.selectRarity(data.getBiomeLoader().loadAll(r.getLandBiomes(), (t) -> t.setInferredType(InferredType.LAND)))
|
||||||
).convertAware2D(ProceduralStream::get)
|
).convertAware2D(ProceduralStream::get)
|
||||||
@ -147,6 +151,8 @@ public class IrisComplex implements DataProvider {
|
|||||||
seaBiomeStream = regionStream.contextInjecting((c, x, z) -> IrisContext.getOr(engine).getChunkContext().getRegion().get(x, z))
|
seaBiomeStream = regionStream.contextInjecting((c, x, z) -> IrisContext.getOr(engine).getChunkContext().getRegion().get(x, z))
|
||||||
.convert((r)
|
.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(engine.getDimension().getBiomeZoom())
|
||||||
|
.zoom(engine.getDimension().getSeaZoom())
|
||||||
.zoom(r.getSeaBiomeZoom())
|
.zoom(r.getSeaBiomeZoom())
|
||||||
.selectRarity(data.getBiomeLoader().loadAll(r.getSeaBiomes(), (t) -> t.setInferredType(InferredType.SEA)))
|
.selectRarity(data.getBiomeLoader().loadAll(r.getSeaBiomes(), (t) -> t.setInferredType(InferredType.SEA)))
|
||||||
).convertAware2D(ProceduralStream::get)
|
).convertAware2D(ProceduralStream::get)
|
||||||
@ -155,6 +161,7 @@ public class IrisComplex implements DataProvider {
|
|||||||
shoreBiomeStream = regionStream.contextInjecting((c, x, z) -> IrisContext.getOr(engine).getChunkContext().getRegion().get(x, z))
|
shoreBiomeStream = regionStream.contextInjecting((c, x, z) -> IrisContext.getOr(engine).getChunkContext().getRegion().get(x, z))
|
||||||
.convert((r)
|
.convert((r)
|
||||||
-> engine.getDimension().getShoreBiomeStyle().create(rng.nextParallelRNG(InferredType.SHORE.ordinal()), getData()).stream()
|
-> engine.getDimension().getShoreBiomeStyle().create(rng.nextParallelRNG(InferredType.SHORE.ordinal()), getData()).stream()
|
||||||
|
.zoom(engine.getDimension().getBiomeZoom())
|
||||||
.zoom(r.getShoreBiomeZoom())
|
.zoom(r.getShoreBiomeZoom())
|
||||||
.selectRarity(data.getBiomeLoader().loadAll(r.getShoreBiomes(), (t) -> t.setInferredType(InferredType.SHORE)))
|
.selectRarity(data.getBiomeLoader().loadAll(r.getShoreBiomes(), (t) -> t.setInferredType(InferredType.SHORE)))
|
||||||
).convertAware2D(ProceduralStream::get).cache2D("shoreBiomeStream", engine, cacheSize).waste("Shore Biome Stream");
|
).convertAware2D(ProceduralStream::get).cache2D("shoreBiomeStream", engine, cacheSize).waste("Shore Biome Stream");
|
||||||
|
@ -39,6 +39,10 @@ public class IrisSeaFloorDecorator extends IrisEngineDecorator {
|
|||||||
|
|
||||||
if (decorator != null) {
|
if (decorator != null) {
|
||||||
if (!decorator.isStacking()) {
|
if (!decorator.isStacking()) {
|
||||||
|
if (!decorator.isForcePlace() && !decorator.getSlopeCondition().isDefault()
|
||||||
|
&& !decorator.getSlopeCondition().isValid(getComplex().getSlopeStream().get(realX, realZ))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (height >= 0 || height < getEngine().getHeight()) {
|
if (height >= 0 || height < getEngine().getHeight()) {
|
||||||
if (null != decorator.getBlockDataForTop(biome, getRng(), realX, height, realZ, getData())) {
|
if (null != decorator.getBlockDataForTop(biome, getRng(), realX, height, realZ, getData())) {
|
||||||
data.set(x, height, z, decorator.getBlockData100(biome, getRng(), realX, height, realZ, getData()));
|
data.set(x, height, z, decorator.getBlockData100(biome, getRng(), realX, height, realZ, getData()));
|
||||||
|
@ -45,6 +45,11 @@ public class IrisShoreLineDecorator extends IrisEngineDecorator {
|
|||||||
IrisDecorator decorator = getDecorator(biome, realX, realZ);
|
IrisDecorator decorator = getDecorator(biome, realX, realZ);
|
||||||
|
|
||||||
if (decorator != null) {
|
if (decorator != null) {
|
||||||
|
if (!decorator.isForcePlace() && !decorator.getSlopeCondition().isDefault()
|
||||||
|
&& !decorator.getSlopeCondition().isValid(getComplex().getSlopeStream().get(realX, realZ))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!decorator.isStacking()) {
|
if (!decorator.isStacking()) {
|
||||||
if (null != decorator.getBlockDataForTop(biome, getRng(), realX, height, realZ, getData())) {
|
if (null != decorator.getBlockDataForTop(biome, getRng(), realX, height, realZ, getData())) {
|
||||||
data.set(x, height, z, decorator.getBlockData100(biome, getRng(), realX, height, realZ, getData()));
|
data.set(x, height, z, decorator.getBlockData100(biome, getRng(), realX, height, realZ, getData()));
|
||||||
|
@ -53,6 +53,11 @@ public class IrisSurfaceDecorator extends IrisEngineDecorator {
|
|||||||
boolean underwater = height < getDimension().getFluidHeight();
|
boolean underwater = height < getDimension().getFluidHeight();
|
||||||
|
|
||||||
if (decorator != null) {
|
if (decorator != null) {
|
||||||
|
if (!decorator.isForcePlace() && !decorator.getSlopeCondition().isDefault()
|
||||||
|
&& !decorator.getSlopeCondition().isValid(getComplex().getSlopeStream().get(realX, realZ))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!decorator.isStacking()) {
|
if (!decorator.isStacking()) {
|
||||||
bd = decorator.getBlockData100(biome, getRng(), realX, height, realZ, getData());
|
bd = decorator.getBlockData100(biome, getRng(), realX, height, realZ, getData());
|
||||||
|
|
||||||
|
@ -269,77 +269,80 @@ public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdat
|
|||||||
@ChunkCoordinates
|
@ChunkCoordinates
|
||||||
@Override
|
@Override
|
||||||
default void updateChunk(Chunk c) {
|
default void updateChunk(Chunk c) {
|
||||||
if (c.getWorld().isChunkLoaded(c.getX() + 1, c.getZ() + 1)
|
for (int x = -1; x <= 1; x++) {
|
||||||
&& c.getWorld().isChunkLoaded(c.getX(), c.getZ() + 1)
|
for (int z = -1; z <= 1; z++) {
|
||||||
&& c.getWorld().isChunkLoaded(c.getX() + 1, c.getZ())
|
if (c.getWorld().isChunkLoaded(c.getX() + x, c.getZ() + z))
|
||||||
&& c.getWorld().isChunkLoaded(c.getX() - 1, c.getZ() - 1)
|
continue;
|
||||||
&& c.getWorld().isChunkLoaded(c.getX(), c.getZ() - 1)
|
Iris.debug("Chunk %s, %s [%s, %s] is not loaded".formatted(c.getX() + x, c.getZ() + z, x, z));
|
||||||
&& c.getWorld().isChunkLoaded(c.getX() - 1, c.getZ())
|
return;
|
||||||
&& c.getWorld().isChunkLoaded(c.getX() + 1, c.getZ() - 1)
|
}
|
||||||
&& c.getWorld().isChunkLoaded(c.getX() - 1, c.getZ() + 1) && getMantle().getMantle().isLoaded(c)) {
|
|
||||||
|
|
||||||
getMantle().getMantle().raiseFlag(c.getX(), c.getZ(), MantleFlag.TILE, () -> J.s(() -> {
|
|
||||||
getMantle().getMantle().iterateChunk(c.getX(), c.getZ(), TileWrapper.class, (x, y, z, tile) -> {
|
|
||||||
int betterY = y + getWorld().minHeight();
|
|
||||||
if (!TileData.setTileState(c.getBlock(x, betterY, z), tile.getData()))
|
|
||||||
Iris.warn("Failed to set tile entity data at [%d %d %d | %s] for tile %s!", x, betterY, z, c.getBlock(x, betterY, z).getBlockData().getMaterial().getKey(), tile.getData().getTileId());
|
|
||||||
});
|
|
||||||
}));
|
|
||||||
getMantle().getMantle().raiseFlag(c.getX(), c.getZ(), MantleFlag.CUSTOM, () -> J.s(() -> {
|
|
||||||
getMantle().getMantle().iterateChunk(c.getX(), c.getZ(), Identifier.class, (x, y, z, v) -> {
|
|
||||||
Iris.service(ExternalDataSVC.class).processUpdate(this, c.getBlock(x & 15, y + getWorld().minHeight(), z & 15), v);
|
|
||||||
});
|
|
||||||
}));
|
|
||||||
|
|
||||||
getMantle().getMantle().raiseFlag(c.getX(), c.getZ(), MantleFlag.UPDATE, () -> J.s(() -> {
|
|
||||||
PrecisionStopwatch p = PrecisionStopwatch.start();
|
|
||||||
KMap<Long, Integer> updates = new KMap<>();
|
|
||||||
RNG r = new RNG(Cache.key(c.getX(), c.getZ()));
|
|
||||||
getMantle().getMantle().iterateChunk(c.getX(), c.getZ(), MatterCavern.class, (x, yf, z, v) -> {
|
|
||||||
int y = yf + getWorld().minHeight();
|
|
||||||
if (!B.isFluid(c.getBlock(x & 15, y, z & 15).getBlockData())) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
boolean u = false;
|
|
||||||
if (B.isAir(c.getBlock(x & 15, y, z & 15).getRelative(BlockFace.DOWN).getBlockData())) {
|
|
||||||
u = true;
|
|
||||||
} else if (B.isAir(c.getBlock(x & 15, y, z & 15).getRelative(BlockFace.WEST).getBlockData())) {
|
|
||||||
u = true;
|
|
||||||
} else if (B.isAir(c.getBlock(x & 15, y, z & 15).getRelative(BlockFace.EAST).getBlockData())) {
|
|
||||||
u = true;
|
|
||||||
} else if (B.isAir(c.getBlock(x & 15, y, z & 15).getRelative(BlockFace.SOUTH).getBlockData())) {
|
|
||||||
u = true;
|
|
||||||
} else if (B.isAir(c.getBlock(x & 15, y, z & 15).getRelative(BlockFace.NORTH).getBlockData())) {
|
|
||||||
u = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (u) {
|
|
||||||
updates.compute(Cache.key(x & 15, z & 15), (k, vv) -> {
|
|
||||||
if (vv != null) {
|
|
||||||
return Math.max(vv, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
return y;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
updates.forEach((k, v) -> update(Cache.keyX(k), v, Cache.keyZ(k), c, r));
|
|
||||||
getMantle().getMantle().iterateChunk(c.getX(), c.getZ(), MatterUpdate.class, (x, yf, z, v) -> {
|
|
||||||
int y = yf + getWorld().minHeight();
|
|
||||||
if (v != null && v.isUpdate()) {
|
|
||||||
int vx = x & 15;
|
|
||||||
int vz = z & 15;
|
|
||||||
update(x, y, z, c, new RNG(Cache.key(c.getX(), c.getZ())));
|
|
||||||
if (vx > 0 && vx < 15 && vz > 0 && vz < 15) {
|
|
||||||
updateLighting(x, y, z, c);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
getMantle().getMantle().deleteChunkSlice(c.getX(), c.getZ(), MatterUpdate.class);
|
|
||||||
getMetrics().getUpdates().put(p.getMilliseconds());
|
|
||||||
}, RNG.r.i(0, 20)));
|
|
||||||
}
|
}
|
||||||
|
if (!getMantle().getMantle().isLoaded(c)) {
|
||||||
|
Iris.debug("Mantle Chunk " + c.getX() + c.getX() + " is not loaded");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
getMantle().getMantle().raiseFlag(c.getX(), c.getZ(), MantleFlag.TILE, () -> J.s(() -> {
|
||||||
|
getMantle().getMantle().iterateChunk(c.getX(), c.getZ(), TileWrapper.class, (x, y, z, tile) -> {
|
||||||
|
int betterY = y + getWorld().minHeight();
|
||||||
|
if (!TileData.setTileState(c.getBlock(x, betterY, z), tile.getData()))
|
||||||
|
Iris.warn("Failed to set tile entity data at [%d %d %d | %s] for tile %s!", x, betterY, z, c.getBlock(x, betterY, z).getBlockData().getMaterial().getKey(), tile.getData().getTileId());
|
||||||
|
});
|
||||||
|
}));
|
||||||
|
getMantle().getMantle().raiseFlag(c.getX(), c.getZ(), MantleFlag.CUSTOM, () -> J.s(() -> {
|
||||||
|
getMantle().getMantle().iterateChunk(c.getX(), c.getZ(), Identifier.class, (x, y, z, v) -> {
|
||||||
|
Iris.service(ExternalDataSVC.class).processUpdate(this, c.getBlock(x & 15, y + getWorld().minHeight(), z & 15), v);
|
||||||
|
});
|
||||||
|
}));
|
||||||
|
|
||||||
|
getMantle().getMantle().raiseFlag(c.getX(), c.getZ(), MantleFlag.UPDATE, () -> J.s(() -> {
|
||||||
|
PrecisionStopwatch p = PrecisionStopwatch.start();
|
||||||
|
KMap<Long, Integer> updates = new KMap<>();
|
||||||
|
RNG r = new RNG(Cache.key(c.getX(), c.getZ()));
|
||||||
|
getMantle().getMantle().iterateChunk(c.getX(), c.getZ(), MatterCavern.class, (x, yf, z, v) -> {
|
||||||
|
int y = yf + getWorld().minHeight();
|
||||||
|
if (!B.isFluid(c.getBlock(x & 15, y, z & 15).getBlockData())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
boolean u = false;
|
||||||
|
if (B.isAir(c.getBlock(x & 15, y, z & 15).getRelative(BlockFace.DOWN).getBlockData())) {
|
||||||
|
u = true;
|
||||||
|
} else if (B.isAir(c.getBlock(x & 15, y, z & 15).getRelative(BlockFace.WEST).getBlockData())) {
|
||||||
|
u = true;
|
||||||
|
} else if (B.isAir(c.getBlock(x & 15, y, z & 15).getRelative(BlockFace.EAST).getBlockData())) {
|
||||||
|
u = true;
|
||||||
|
} else if (B.isAir(c.getBlock(x & 15, y, z & 15).getRelative(BlockFace.SOUTH).getBlockData())) {
|
||||||
|
u = true;
|
||||||
|
} else if (B.isAir(c.getBlock(x & 15, y, z & 15).getRelative(BlockFace.NORTH).getBlockData())) {
|
||||||
|
u = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (u) {
|
||||||
|
updates.compute(Cache.key(x & 15, z & 15), (k, vv) -> {
|
||||||
|
if (vv != null) {
|
||||||
|
return Math.max(vv, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
return y;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
updates.forEach((k, v) -> update(Cache.keyX(k), v, Cache.keyZ(k), c, r));
|
||||||
|
getMantle().getMantle().iterateChunk(c.getX(), c.getZ(), MatterUpdate.class, (x, yf, z, v) -> {
|
||||||
|
int y = yf + getWorld().minHeight();
|
||||||
|
if (v != null && v.isUpdate()) {
|
||||||
|
int vx = x & 15;
|
||||||
|
int vz = z & 15;
|
||||||
|
update(x, y, z, c, new RNG(Cache.key(c.getX(), c.getZ())));
|
||||||
|
if (vx > 0 && vx < 15 && vz > 0 && vz < 15) {
|
||||||
|
updateLighting(x, y, z, c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
getMantle().getMantle().deleteChunkSlice(c.getX(), c.getZ(), MatterUpdate.class);
|
||||||
|
getMetrics().getUpdates().put(p.getMilliseconds());
|
||||||
|
}, RNG.r.i(0, 20)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@BlockCoordinates
|
@BlockCoordinates
|
||||||
|
@ -55,6 +55,8 @@ public class IrisDecorator {
|
|||||||
@ArrayType(min = 1, type = IrisBlockData.class)
|
@ArrayType(min = 1, type = IrisBlockData.class)
|
||||||
@Desc("When set, the decorator will never place onto any of these blocks.")
|
@Desc("When set, the decorator will never place onto any of these blocks.")
|
||||||
private KList<IrisBlockData> blacklist;
|
private KList<IrisBlockData> blacklist;
|
||||||
|
@Desc("The slope at which this decorator can be placed. Range from 0 to 10 by default. Calculated from a 3-block radius from the center of the decorator placement.")
|
||||||
|
private IrisSlopeClip slopeCondition = new IrisSlopeClip();
|
||||||
@DependsOn({"scaleStack", "stackMin", "stackMax"})
|
@DependsOn({"scaleStack", "stackMin", "stackMax"})
|
||||||
@Desc("If stackMax is set to true, use this to limit its max height for large caverns")
|
@Desc("If stackMax is set to true, use this to limit its max height for large caverns")
|
||||||
private int absoluteMaxStack = 30;
|
private int absoluteMaxStack = 30;
|
||||||
|
@ -244,7 +244,7 @@ public class IrisDimension extends IrisRegistrant {
|
|||||||
@MinNumber(0.0001)
|
@MinNumber(0.0001)
|
||||||
@MaxNumber(512)
|
@MaxNumber(512)
|
||||||
@Desc("Zoom in or out the biome size. Higher = bigger biomes")
|
@Desc("Zoom in or out the biome size. Higher = bigger biomes")
|
||||||
private double biomeZoom = 5D;
|
private double biomeZoom = 1D;
|
||||||
@MinNumber(0)
|
@MinNumber(0)
|
||||||
@MaxNumber(360)
|
@MaxNumber(360)
|
||||||
@Desc("You can rotate the input coordinates by an angle. This can make terrain appear more natural (less sharp corners and lines). This literally rotates the entire dimension by an angle. Hint: Try 12 degrees or something not on a 90 or 45 degree angle.")
|
@Desc("You can rotate the input coordinates by an angle. This can make terrain appear more natural (less sharp corners and lines). This literally rotates the entire dimension by an angle. Hint: Try 12 degrees or something not on a 90 or 45 degree angle.")
|
||||||
|
@ -59,6 +59,10 @@ public class IrisLootTable extends IrisRegistrant {
|
|||||||
@Desc("The minimum amount of loot that can be picked in this table at a time.")
|
@Desc("The minimum amount of loot that can be picked in this table at a time.")
|
||||||
private int minPicked = 1;
|
private int minPicked = 1;
|
||||||
|
|
||||||
|
@MinNumber(1)
|
||||||
|
@Desc("The maximum amount of tries to generate loot")
|
||||||
|
private int maxTries = 10;
|
||||||
|
|
||||||
@Desc("The loot in this table")
|
@Desc("The loot in this table")
|
||||||
@ArrayType(min = 1, type = IrisLoot.class)
|
@ArrayType(min = 1, type = IrisLoot.class)
|
||||||
private KList<IrisLoot> loot = new KList<>();
|
private KList<IrisLoot> loot = new KList<>();
|
||||||
@ -67,9 +71,10 @@ public class IrisLootTable extends IrisRegistrant {
|
|||||||
KList<ItemStack> lootf = new KList<>();
|
KList<ItemStack> lootf = new KList<>();
|
||||||
|
|
||||||
int m = 0;
|
int m = 0;
|
||||||
|
int c = 0;
|
||||||
int mx = rng.i(getMinPicked(), getMaxPicked());
|
int mx = rng.i(getMinPicked(), getMaxPicked());
|
||||||
|
|
||||||
while (m < mx) {
|
while (m < mx && c++ < getMaxTries()) {
|
||||||
int num = rng.i(loot.size());
|
int num = rng.i(loot.size());
|
||||||
|
|
||||||
IrisLoot l = loot.get(num);
|
IrisLoot l = loot.get(num);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user