mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 10:12:53 +00:00
V+
This commit is contained in:
parent
d52d70a014
commit
3f730ead84
@ -32,7 +32,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group 'com.volmit.iris'
|
group 'com.volmit.iris'
|
||||||
version '1.7.8-Dumpy'
|
version '1.7.9'
|
||||||
def apiVersion = '1.17'
|
def apiVersion = '1.17'
|
||||||
def name = getRootProject().getName() // See settings.gradle
|
def name = getRootProject().getName() // See settings.gradle
|
||||||
def main = 'com.volmit.iris.Iris'
|
def main = 'com.volmit.iris.Iris'
|
||||||
|
@ -48,40 +48,30 @@ import com.volmit.iris.util.io.InstanceState;
|
|||||||
import com.volmit.iris.util.io.JarScanner;
|
import com.volmit.iris.util.io.JarScanner;
|
||||||
import com.volmit.iris.util.math.M;
|
import com.volmit.iris.util.math.M;
|
||||||
import com.volmit.iris.util.math.RNG;
|
import com.volmit.iris.util.math.RNG;
|
||||||
import com.volmit.iris.util.nbt.mca.*;
|
|
||||||
import com.volmit.iris.util.nbt.mca.palette.BiomeContainer;
|
|
||||||
import com.volmit.iris.util.parallel.MultiBurst;
|
import com.volmit.iris.util.parallel.MultiBurst;
|
||||||
import com.volmit.iris.util.plugin.*;
|
import com.volmit.iris.util.plugin.*;
|
||||||
import com.volmit.iris.util.reflect.ShadeFix;
|
import com.volmit.iris.util.reflect.ShadeFix;
|
||||||
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.Queue;
|
import com.volmit.iris.util.scheduling.Queue;
|
||||||
import com.volmit.iris.util.scheduling.ShurikenQueue;
|
import com.volmit.iris.util.scheduling.ShurikenQueue;
|
||||||
import io.papermc.lib.PaperLib;
|
import io.papermc.lib.PaperLib;
|
||||||
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
||||||
import net.kyori.adventure.text.serializer.ComponentSerializer;
|
import net.kyori.adventure.text.serializer.ComponentSerializer;
|
||||||
import net.minecraft.world.level.chunk.storage.RegionFile;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.data.BlockData;
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.BlockDamageEvent;
|
|
||||||
import org.bukkit.generator.ChunkGenerator;
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.checkerframework.checker.units.qual.K;
|
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
@SuppressWarnings("CanBeFinal")
|
@SuppressWarnings("CanBeFinal")
|
||||||
public class Iris extends VolmitPlugin implements Listener {
|
public class Iris extends VolmitPlugin implements Listener {
|
||||||
@ -118,14 +108,6 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
IO.delete(new File("iris"));
|
IO.delete(new File("iris"));
|
||||||
installDataPacks();
|
installDataPacks();
|
||||||
fixShading();
|
fixShading();
|
||||||
(new Looper() {
|
|
||||||
protected long loop() {
|
|
||||||
File ff = Iris.instance.getDataFolderNoCreate("dump");
|
|
||||||
if (ff.exists() && ff.isDirectory() && ff.listFiles().length == 0)
|
|
||||||
Iris.dump();
|
|
||||||
return 10000L;
|
|
||||||
}
|
|
||||||
}).start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enable() {
|
private void enable() {
|
||||||
|
@ -118,7 +118,6 @@ public class DecIris implements DecreeExecutor {
|
|||||||
case ">>" -> v = value1 >> value2;
|
case ">>" -> v = value1 >> value2;
|
||||||
case "<<" -> v = value1 << value2;
|
case "<<" -> v = value1 << value2;
|
||||||
}
|
}
|
||||||
;
|
|
||||||
if (v == null) {
|
if (v == null) {
|
||||||
sender().sendMessage(C.RED + "The operator you entered: (" + operator + ") is invalid!");
|
sender().sendMessage(C.RED + "The operator you entered: (" + operator + ") is invalid!");
|
||||||
return;
|
return;
|
||||||
|
@ -386,8 +386,7 @@ public class NMSBinding17_1 implements INMSBinding{
|
|||||||
return biome.ordinal();
|
return biome.ordinal();
|
||||||
}
|
}
|
||||||
|
|
||||||
private IdMap<BiomeBase> getBiomeMapping()
|
private IdMap<BiomeBase> getBiomeMapping() {
|
||||||
{
|
|
||||||
return biomeMapCache.aquire(() -> new IdMap<>() {
|
return biomeMapCache.aquire(() -> new IdMap<>() {
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
|
@ -113,7 +113,7 @@ public class AsyncPregenMethod implements PregeneratorMethod {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void generateChunk(int x, int z, PregenListener listener) {
|
public void generateChunk(int x, int z, PregenListener listener) {
|
||||||
if (future.size() > IrisSettings.getThreadCount((int) IrisSettings.get().getConcurrency().getParallelism())) { // TODO: FIX
|
if (future.size() > IrisSettings.getThreadCount(IrisSettings.get().getConcurrency().getParallelism())) { // TODO: FIX
|
||||||
waitForChunks();
|
waitForChunks();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ public class MedievalPregenMethod implements PregeneratorMethod {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void generateChunk(int x, int z, PregenListener listener) {
|
public void generateChunk(int x, int z, PregenListener listener) {
|
||||||
if (futures.size() > IrisSettings.getThreadCount((int) IrisSettings.get().getConcurrency().getParallelism())) {
|
if (futures.size() > IrisSettings.getThreadCount(IrisSettings.get().getConcurrency().getParallelism())) {
|
||||||
waitForChunks();
|
waitForChunks();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -337,7 +337,7 @@ public class IrisData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String ff = g.toString().substring(1).split("\\Q.\\E")[0];
|
String ff = g.substring(1).split("\\Q.\\E")[0];
|
||||||
return ff;
|
return ff;
|
||||||
} else {
|
} else {
|
||||||
Iris.error("Forign file from loader " + f.getPath() + " (loader realm: " + getDataFolder().getPath() + ")");
|
Iris.error("Forign file from loader " + f.getPath() + " (loader realm: " + getDataFolder().getPath() + ")");
|
||||||
|
@ -29,8 +29,8 @@ import com.volmit.iris.util.scheduling.Looper;
|
|||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
|
|
||||||
public class PreservationSVC implements IrisService {
|
public class PreservationSVC implements IrisService {
|
||||||
private KList<Thread> threads = new KList<>();
|
private final KList<Thread> threads = new KList<>();
|
||||||
private KList<ExecutorService> services = new KList<>();
|
private final KList<ExecutorService> services = new KList<>();
|
||||||
private Looper dereferencer;
|
private Looper dereferencer;
|
||||||
|
|
||||||
public void register(Thread t) {
|
public void register(Thread t) {
|
||||||
|
@ -129,7 +129,7 @@ public class IrisToolbelt {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return pregenerate(task, new HybridPregenMethod(gen.getEngine().getWorld().realWorld(),
|
return pregenerate(task, new HybridPregenMethod(gen.getEngine().getWorld().realWorld(),
|
||||||
IrisSettings.getThreadCount((int) IrisSettings.get().getConcurrency().getParallelism())));
|
IrisSettings.getThreadCount(IrisSettings.get().getConcurrency().getParallelism())));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -145,7 +145,7 @@ public class IrisToolbelt {
|
|||||||
return pregenerate(task, access(world));
|
return pregenerate(task, access(world));
|
||||||
}
|
}
|
||||||
|
|
||||||
return pregenerate(task, new HybridPregenMethod(world, IrisSettings.getThreadCount((int) IrisSettings.get().getConcurrency().getParallelism())));
|
return pregenerate(task, new HybridPregenMethod(world, IrisSettings.getThreadCount(IrisSettings.get().getConcurrency().getParallelism())));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -400,17 +400,13 @@ public class IrisEngine implements Engine {
|
|||||||
PrecisionStopwatch p = PrecisionStopwatch.start();
|
PrecisionStopwatch p = PrecisionStopwatch.start();
|
||||||
Hunk<BlockData> blocks = vblocks.listen((xx, y, zz, t) -> catchBlockUpdates(x + xx, y + getMinHeight(), z + zz, t));
|
Hunk<BlockData> blocks = vblocks.listen((xx, y, zz, t) -> catchBlockUpdates(x + xx, y + getMinHeight(), z + zz, t));
|
||||||
|
|
||||||
if(getDimension().isDebugChunkCrossSections() && ((x >> 4) % getDimension().getDebugCrossSectionsMod() == 0 || (z >> 4) % getDimension().getDebugCrossSectionsMod() == 0))
|
if (getDimension().isDebugChunkCrossSections() && ((x >> 4) % getDimension().getDebugCrossSectionsMod() == 0 || (z >> 4) % getDimension().getDebugCrossSectionsMod() == 0)) {
|
||||||
{
|
|
||||||
for (int i = 0; i < 16; i++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
for (int j = 0; j < 16; j++) {
|
for (int j = 0; j < 16; j++) {
|
||||||
blocks.set(i, 0, j, Material.CRYING_OBSIDIAN.createBlockData());
|
blocks.set(i, 0, j, Material.CRYING_OBSIDIAN.createBlockData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
getMantle().generateMatter(x >> 4, z >> 4, true);
|
getMantle().generateMatter(x >> 4, z >> 4, true);
|
||||||
burst().burst(multicore,
|
burst().burst(multicore,
|
||||||
() -> getTerrainActuator().actuate(x, z, vblocks, multicore),
|
() -> getTerrainActuator().actuate(x, z, vblocks, multicore),
|
||||||
|
@ -51,16 +51,11 @@ public class AtomicCache<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public T aquireNasty(NastySupplier<T> t)
|
public T aquireNasty(NastySupplier<T> t) {
|
||||||
{
|
|
||||||
return aquire(() -> {
|
return aquire(() -> {
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
return t.get();
|
return t.get();
|
||||||
}
|
} catch (Throwable e) {
|
||||||
|
|
||||||
catch(Throwable e)
|
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -44,7 +44,6 @@ import com.volmit.iris.engine.object.spawners.IrisSpawner;
|
|||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.collection.KMap;
|
import com.volmit.iris.util.collection.KMap;
|
||||||
import com.volmit.iris.util.collection.KSet;
|
import com.volmit.iris.util.collection.KSet;
|
||||||
import com.volmit.iris.util.context.IrisContext;
|
|
||||||
import com.volmit.iris.util.data.B;
|
import com.volmit.iris.util.data.B;
|
||||||
import com.volmit.iris.util.data.DataProvider;
|
import com.volmit.iris.util.data.DataProvider;
|
||||||
import com.volmit.iris.util.data.VanillaBiomeMap;
|
import com.volmit.iris.util.data.VanillaBiomeMap;
|
||||||
@ -372,10 +371,8 @@ public class IrisBiome extends IrisRegistrant implements IRare {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(dim.isExplodeBiomePalettes())
|
if (dim.isExplodeBiomePalettes()) {
|
||||||
{
|
for (int j = 0; j < dim.getExplodeBiomePaletteSize(); j++) {
|
||||||
for(int j = 0; j < dim.getExplodeBiomePaletteSize(); j++)
|
|
||||||
{
|
|
||||||
data.add(BARRIER);
|
data.add(BARRIER);
|
||||||
|
|
||||||
if (data.size() >= maxDepth) {
|
if (data.size() >= maxDepth) {
|
||||||
|
@ -26,7 +26,6 @@ import org.bukkit.craftbukkit.libs.org.apache.commons.lang3.math.NumberUtils;
|
|||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.function.Consumer;
|
|
||||||
import java.util.function.IntPredicate;
|
import java.util.function.IntPredicate;
|
||||||
|
|
||||||
public class MathHelper {
|
public class MathHelper {
|
||||||
@ -44,7 +43,7 @@ public class MathHelper {
|
|||||||
public static final float f = 1.0E-5F;
|
public static final float f = 1.0E-5F;
|
||||||
public static final float g = c(2.0F);
|
public static final float g = c(2.0F);
|
||||||
private static final float n = 10430.378F;
|
private static final float n = 10430.378F;
|
||||||
private static final float[] o = (float[]) SystemUtils.a(new float[65536], (var0x) -> {
|
private static final float[] o = SystemUtils.a(new float[65536], (var0x) -> {
|
||||||
for (int var1 = 0; var1 < var0x.length; ++var1) {
|
for (int var1 = 0; var1 < var0x.length; ++var1) {
|
||||||
var0x[var1] = (float) Math.sin((double) var1 * 3.141592653589793D * 2.0D / 65536.0D);
|
var0x[var1] = (float) Math.sin((double) var1 * 3.141592653589793D * 2.0D / 65536.0D);
|
||||||
}
|
}
|
||||||
@ -71,7 +70,7 @@ public class MathHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static float c(float var0) {
|
public static float c(float var0) {
|
||||||
return (float) Math.sqrt((double) var0);
|
return (float) Math.sqrt(var0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int d(float var0) {
|
public static int d(float var0) {
|
||||||
@ -607,7 +606,7 @@ public class MathHelper {
|
|||||||
|
|
||||||
int var2;
|
int var2;
|
||||||
for (var2 = 0; var2 < var0.length; ++var2) {
|
for (var2 = 0; var2 < var0.length; ++var2) {
|
||||||
var0[var2] /= (double) var1;
|
var0[var2] /= var1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var2 = 0; var2 < var0.length; ++var2) {
|
for (var2 = 0; var2 < var0.length; ++var2) {
|
||||||
@ -658,7 +657,7 @@ public class MathHelper {
|
|||||||
int var7 = 0;
|
int var7 = 0;
|
||||||
|
|
||||||
for (int var8 = var4; var8 <= var5; ++var8) {
|
for (int var8 = var4; var8 <= var5; ++var8) {
|
||||||
var6[var7] = Math.max(var0 * StrictMath.log((double) var8) + var2, 0.0D);
|
var6[var7] = Math.max(var0 * StrictMath.log(var8) + var2, 0.0D);
|
||||||
++var7;
|
++var7;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -773,7 +772,7 @@ public class MathHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static double n(double var0) {
|
public static double n(double var0) {
|
||||||
return var0 + (2.0D * (new Random((long) floor(var0 * 3000.0D))).nextDouble() - 1.0D) * 1.0E-7D / 2.0D;
|
return var0 + (2.0D * (new Random(floor(var0 * 3000.0D))).nextDouble() - 1.0D) * 1.0E-7D / 2.0D;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int d(int var0, int var1) {
|
public static int d(int var0, int var1) {
|
||||||
|
@ -20,17 +20,14 @@ package com.volmit.iris.util.nbt.mca;
|
|||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.nms.INMS;
|
import com.volmit.iris.core.nms.INMS;
|
||||||
import com.volmit.iris.util.io.IO;
|
|
||||||
import com.volmit.iris.util.nbt.io.NBTDeserializer;
|
import com.volmit.iris.util.nbt.io.NBTDeserializer;
|
||||||
import com.volmit.iris.util.nbt.io.NBTSerializer;
|
import com.volmit.iris.util.nbt.io.NBTSerializer;
|
||||||
import com.volmit.iris.util.nbt.io.NamedTag;
|
import com.volmit.iris.util.nbt.io.NamedTag;
|
||||||
import com.volmit.iris.util.nbt.mca.palette.BiomeContainer;
|
import com.volmit.iris.util.nbt.mca.palette.BiomeContainer;
|
||||||
import com.volmit.iris.util.nbt.tag.CompoundTag;
|
import com.volmit.iris.util.nbt.tag.CompoundTag;
|
||||||
import com.volmit.iris.util.nbt.tag.ListTag;
|
import com.volmit.iris.util.nbt.tag.ListTag;
|
||||||
import com.volmit.iris.util.nbt.tag.Tag;
|
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.concurrent.atomic.AtomicReferenceArray;
|
import java.util.concurrent.atomic.AtomicReferenceArray;
|
||||||
|
|
||||||
import static com.volmit.iris.util.nbt.mca.LoadFlags.*;
|
import static com.volmit.iris.util.nbt.mca.LoadFlags.*;
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
package com.volmit.iris.util.nbt.mca;
|
package com.volmit.iris.util.nbt.mca;
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.math.Position2;
|
import com.volmit.iris.util.math.Position2;
|
||||||
import com.volmit.iris.util.nbt.tag.CompoundTag;
|
import com.volmit.iris.util.nbt.tag.CompoundTag;
|
||||||
|
@ -73,8 +73,7 @@ public class Section {
|
|||||||
* @return The block state data of this block.
|
* @return The block state data of this block.
|
||||||
*/
|
*/
|
||||||
public synchronized CompoundTag getBlockStateAt(int blockX, int blockY, int blockZ) {
|
public synchronized CompoundTag getBlockStateAt(int blockX, int blockY, int blockZ) {
|
||||||
synchronized (palette)
|
synchronized (palette) {
|
||||||
{
|
|
||||||
return palette.getBlock(blockX & 15, blockY & 15, blockZ & 15);
|
return palette.getBlock(blockX & 15, blockY & 15, blockZ & 15);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -88,8 +87,7 @@ public class Section {
|
|||||||
* @param state The block state to be set
|
* @param state The block state to be set
|
||||||
*/
|
*/
|
||||||
public synchronized void setBlockStateAt(int blockX, int blockY, int blockZ, CompoundTag state, boolean cleanup) {
|
public synchronized void setBlockStateAt(int blockX, int blockY, int blockZ, CompoundTag state, boolean cleanup) {
|
||||||
synchronized (palette)
|
synchronized (palette) {
|
||||||
{
|
|
||||||
palette.setBlock(blockX & 15, blockY & 15, blockZ & 15, state);
|
palette.setBlock(blockX & 15, blockY & 15, blockZ & 15, state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -167,8 +165,7 @@ public class Section {
|
|||||||
data.putByte("Y", (byte) y);
|
data.putByte("Y", (byte) y);
|
||||||
|
|
||||||
if (palette != null) {
|
if (palette != null) {
|
||||||
synchronized (palette)
|
synchronized (palette) {
|
||||||
{
|
|
||||||
palette.writeToSection(data);
|
palette.writeToSection(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,8 +18,7 @@
|
|||||||
|
|
||||||
package com.volmit.iris.util.nbt.mca.palette;
|
package com.volmit.iris.util.nbt.mca.palette;
|
||||||
|
|
||||||
public interface BiomeContainer
|
public interface BiomeContainer {
|
||||||
{
|
|
||||||
int[] getData();
|
int[] getData();
|
||||||
|
|
||||||
void setBiome(int x, int y, int z, int id);
|
void setBiome(int x, int y, int z, int id);
|
||||||
|
@ -18,12 +18,8 @@
|
|||||||
|
|
||||||
package com.volmit.iris.util.nbt.mca.palette;
|
package com.volmit.iris.util.nbt.mca.palette;
|
||||||
|
|
||||||
import net.minecraft.world.level.LevelHeightAccessor;
|
|
||||||
import net.minecraft.world.level.biome.BiomeBase;
|
|
||||||
import net.minecraft.world.level.biome.BiomeManager;
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.bukkit.block.Biome;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
@ -51,8 +47,7 @@ public class ChunkBiomeContainer<T> {
|
|||||||
this.quartHeight = QuartPos.fromBlock(maxHeight) - 1;
|
this.quartHeight = QuartPos.fromBlock(maxHeight) - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ChunkBiomeContainer(IdMap<T> registry, int min, int max)
|
public ChunkBiomeContainer(IdMap<T> registry, int min, int max) {
|
||||||
{
|
|
||||||
this(registry, min, max, new int[(1 << WIDTH_BITS + WIDTH_BITS) * ceilDiv(max - min, 4)]);
|
this(registry, min, max, new int[(1 << WIDTH_BITS + WIDTH_BITS) * ceilDiv(max - min, 4)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,7 +60,7 @@ public class ChunkBiomeContainer<T> {
|
|||||||
if (biomebase == null) {
|
if (biomebase == null) {
|
||||||
if (i == -1)
|
if (i == -1)
|
||||||
i = j;
|
i = j;
|
||||||
this.biomes[j] = (T)registry.byId(0);
|
this.biomes[j] = registry.byId(0);
|
||||||
} else {
|
} else {
|
||||||
this.biomes[j] = biomebase;
|
this.biomes[j] = biomebase;
|
||||||
}
|
}
|
||||||
|
@ -151,12 +151,12 @@ public class CrudeIncrementalIntIdentityHashBiMap<K> implements IdMap<K> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Iterator<K> iterator() {
|
public Iterator<K> iterator() {
|
||||||
return (Iterator<K>) Iterators.filter((Iterator)Iterators.forArray((Object[])this.byId), Predicates.notNull());
|
return (Iterator<K>) Iterators.filter(Iterators.forArray((Object[]) this.byId), Predicates.notNull());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clear() {
|
public void clear() {
|
||||||
Arrays.fill((Object[])this.keys, (Object)null);
|
Arrays.fill(this.keys, null);
|
||||||
Arrays.fill((Object[])this.byId, (Object)null);
|
Arrays.fill(this.byId, null);
|
||||||
this.nextId = 0;
|
this.nextId = 0;
|
||||||
this.size = 0;
|
this.size = 0;
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ public class GlobalPalette<T> implements Palette<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public T valueFor(int var0) {
|
public T valueFor(int var0) {
|
||||||
T var1 = (T)this.registry.byId(var0);
|
T var1 = this.registry.byId(var0);
|
||||||
return (var1 == null) ? this.defaultValue : var1;
|
return (var1 == null) ? this.defaultValue : var1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,5 +50,6 @@ public class GlobalPalette<T> implements Palette<T> {
|
|||||||
return this.registry.size();
|
return this.registry.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void read(ListTag var0) {}
|
public void read(ListTag var0) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -58,14 +58,14 @@ public class HashMapPalette<T> implements Palette<T> {
|
|||||||
|
|
||||||
public boolean maybeHas(Predicate<T> var0) {
|
public boolean maybeHas(Predicate<T> var0) {
|
||||||
for (int var1 = 0; var1 < getSize(); var1++) {
|
for (int var1 = 0; var1 < getSize(); var1++) {
|
||||||
if (var0.test((T)this.values.byId(var1)))
|
if (var0.test(this.values.byId(var1)))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public T valueFor(int var0) {
|
public T valueFor(int var0) {
|
||||||
return (T)this.values.byId(var0);
|
return this.values.byId(var0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSize() {
|
public int getSize() {
|
||||||
@ -80,6 +80,6 @@ public class HashMapPalette<T> implements Palette<T> {
|
|||||||
|
|
||||||
public void write(ListTag var0) {
|
public void write(ListTag var0) {
|
||||||
for (int var1 = 0; var1 < getSize(); var1++)
|
for (int var1 = 0; var1 < getSize(); var1++)
|
||||||
var0.add(this.writer.apply((T)this.values.byId(var1)));
|
var0.add(this.writer.apply(this.values.byId(var1)));
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -75,7 +75,7 @@ public class IdMapper<T> implements IdMap<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Iterator<T> iterator() {
|
public Iterator<T> iterator() {
|
||||||
return (Iterator<T>) Iterators.filter(this.idToT.iterator(), Predicates.notNull());
|
return Iterators.filter(this.idToT.iterator(), Predicates.notNull());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean contains(int var0) {
|
public boolean contains(int var0) {
|
||||||
|
@ -55,7 +55,7 @@ public class Mth {
|
|||||||
private static final float[] SIN;
|
private static final float[] SIN;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
SIN = (float[])make(new float[65536], var0 -> {
|
SIN = make(new float[65536], var0 -> {
|
||||||
for (int var1 = 0; var1 < var0.length; var1++)
|
for (int var1 = 0; var1 < var0.length; var1++)
|
||||||
var0[var1] = (float) Math.sin(var1 * Math.PI * 2.0D / 65536.0D);
|
var0[var1] = (float) Math.sin(var1 * Math.PI * 2.0D / 65536.0D);
|
||||||
});
|
});
|
||||||
|
@ -21,11 +21,11 @@ package com.volmit.iris.util.nbt.mca.palette;
|
|||||||
import com.volmit.iris.util.nbt.tag.CompoundTag;
|
import com.volmit.iris.util.nbt.tag.CompoundTag;
|
||||||
|
|
||||||
public interface PaletteAccess {
|
public interface PaletteAccess {
|
||||||
public void setBlock(int x, int y, int z, CompoundTag data);
|
void setBlock(int x, int y, int z, CompoundTag data);
|
||||||
|
|
||||||
public CompoundTag getBlock(int x, int y, int z);
|
CompoundTag getBlock(int x, int y, int z);
|
||||||
|
|
||||||
public void writeToSection(CompoundTag tag);
|
void writeToSection(CompoundTag tag);
|
||||||
|
|
||||||
public void readFromSection(CompoundTag tag);
|
void readFromSection(CompoundTag tag);
|
||||||
}
|
}
|
||||||
|
@ -164,8 +164,7 @@ public class PalettedContainer<T> implements PaletteResize<T> {
|
|||||||
var0.put(var1, paletteList);
|
var0.put(var1, paletteList);
|
||||||
int var8 = Math.max(4, Mth.ceillog2(paletteList.size()));
|
int var8 = Math.max(4, Mth.ceillog2(paletteList.size()));
|
||||||
BitStorage var9 = new BitStorage(var8, 4096);
|
BitStorage var9 = new BitStorage(var8, 4096);
|
||||||
for (int var10 = 0; var10 < var6.length; var10++)
|
for (int var10 = 0; var10 < var6.length; var10++) {
|
||||||
{
|
|
||||||
var9.set(var10, var6[var10]);
|
var9.set(var10, var6[var10]);
|
||||||
}
|
}
|
||||||
var0.putLongArray(var2, var9.getRaw());
|
var0.putLongArray(var2, var9.getRaw());
|
||||||
|
@ -29,23 +29,19 @@ public class WrappedPalettedContainer<T> implements PaletteAccess {
|
|||||||
private final Function<T, CompoundTag> reader;
|
private final Function<T, CompoundTag> reader;
|
||||||
private final Function<CompoundTag, T> writer;
|
private final Function<CompoundTag, T> writer;
|
||||||
|
|
||||||
public void setBlock(int x, int y, int z, CompoundTag data)
|
public void setBlock(int x, int y, int z, CompoundTag data) {
|
||||||
{
|
|
||||||
container.set(x, y, z, writer.apply(data));
|
container.set(x, y, z, writer.apply(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
public CompoundTag getBlock(int x, int y, int z)
|
public CompoundTag getBlock(int x, int y, int z) {
|
||||||
{
|
|
||||||
return reader.apply(container.get(x, y, z));
|
return reader.apply(container.get(x, y, z));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeToSection(CompoundTag tag)
|
public void writeToSection(CompoundTag tag) {
|
||||||
{
|
|
||||||
container.write(tag, "Palette", "BlockStates");
|
container.write(tag, "Palette", "BlockStates");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void readFromSection(CompoundTag tag)
|
public void readFromSection(CompoundTag tag) {
|
||||||
{
|
|
||||||
container.read(tag.getListTag("Palette"), tag.getLongArrayTag("BlockStates").getValue());
|
container.read(tag.getListTag("Palette"), tag.getLongArrayTag("BlockStates").getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -127,13 +127,9 @@ public class J {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static <T> T attemptResult(NastySupplier<T> r) {
|
public static <T> T attemptResult(NastySupplier<T> r) {
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
return r.get();
|
return r.get();
|
||||||
}
|
} catch (Throwable e) {
|
||||||
|
|
||||||
catch(Throwable e)
|
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
public abstract class QueueJob<T> implements Job {
|
public abstract class QueueJob<T> implements Job {
|
||||||
final KList<T> queue;
|
final KList<T> queue;
|
||||||
protected int totalWork;
|
protected int totalWork;
|
||||||
private AtomicInteger completed;
|
private final AtomicInteger completed;
|
||||||
|
|
||||||
public QueueJob() {
|
public QueueJob() {
|
||||||
totalWork = 0;
|
totalWork = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user