diff --git a/build.gradle b/build.gradle
index fe1ca5d0b..6c87ec1b2 100644
--- a/build.gradle
+++ b/build.gradle
@@ -24,11 +24,11 @@ plugins {
id "de.undercouch.download" version "5.0.1"
}
-version '2.6.2-1.19.4'
-def nmsVersion = "1.19.4" //[NMS]
-def apiVersion = '1.19'
+version '2.7.0-1.20.0'
+def nmsVersion = "1.20" //[NMS]
+def apiVersion = '1.20'
def specialSourceVersion = '1.11.0' //[NMS]
-def spigotJarVersion = '1.19.4-R0.1-SNAPSHOT' //[NMS]
+def spigotJarVersion = '1.20-R0.1-SNAPSHOT' //[NMS]
def name = getRootProject().getName() // Defined in settings.gradle
def main = 'com.volmit.iris.Iris'
@@ -129,8 +129,8 @@ dependencies {
// Provided or Classpath
compileOnly 'org.projectlombok:lombok:1.18.24'
annotationProcessor 'org.projectlombok:lombok:1.18.24'
- implementation 'org.spigotmc:spigot-api:1.19.4-R0.1-SNAPSHOT'
- implementation 'org.bukkit:craftbukkit:1.19.4-R0.1-SNAPSHOT:remapped-mojang' //[NMS]
+ implementation 'org.spigotmc:spigot-api:1.20-R0.1-SNAPSHOT'
+ implementation 'org.bukkit:craftbukkit:1.20-R0.1-SNAPSHOT:remapped-mojang' //[NMS]
// Third Party Integrations
implementation 'com.github.oraxen:oraxen:1.152.5'
diff --git a/src/main/java/com/volmit/iris/Iris.java b/src/main/java/com/volmit/iris/Iris.java
index f494c91ea..28eba4ec8 100644
--- a/src/main/java/com/volmit/iris/Iris.java
+++ b/src/main/java/com/volmit/iris/Iris.java
@@ -28,7 +28,7 @@
import com.volmit.iris.core.link.MythicMobsLink;
import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.core.nms.INMS;
-import com.volmit.iris.core.nms.v19_4.NMSBinding19_4;
+import com.volmit.iris.core.nms.v20.NMSBinding19_4;
import com.volmit.iris.core.pregenerator.LazyPregenerator;
import com.volmit.iris.core.service.StudioSVC;
import com.volmit.iris.core.tools.IrisToolbelt;
diff --git a/src/main/java/com/volmit/iris/core/nms/INMS.java b/src/main/java/com/volmit/iris/core/nms/INMS.java
index 37df3ddef..7ce535e77 100644
--- a/src/main/java/com/volmit/iris/core/nms/INMS.java
+++ b/src/main/java/com/volmit/iris/core/nms/INMS.java
@@ -1,77 +1,77 @@
-/*
- * Iris is a World Generator for Minecraft Bukkit Servers
- * Copyright (c) 2022 Arcane Arts (Volmit Software)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-package com.volmit.iris.core.nms;
-
-import com.volmit.iris.Iris;
-import com.volmit.iris.core.IrisSettings;
-import com.volmit.iris.core.nms.v19_4.NMSBinding19_4;
-import com.volmit.iris.core.nms.v1X.NMSBinding1X;
-import com.volmit.iris.util.collection.KMap;
-import org.bukkit.Bukkit;
-
-public class INMS {
- //@builder
- private static final KMap> bindings = new KMap>()
- .qput("v1_19_R3", NMSBinding19_4.class);
- //@done
- private static final INMSBinding binding = bind();
-
- public static INMSBinding get() {
- return binding;
- }
-
- public static String getNMSTag() {
- if (IrisSettings.get().getGeneral().isDisableNMS()) {
- return "BUKKIT";
- }
-
- try {
- return Bukkit.getServer().getClass().getCanonicalName().split("\\Q.\\E")[3];
- } catch (Throwable e) {
- Iris.reportError(e);
- Iris.error("Failed to determine server nms version!");
- e.printStackTrace();
- }
-
- return "BUKKIT";
- }
-
- private static INMSBinding bind() {
- String code = getNMSTag();
- Iris.info("Locating NMS Binding for " + code);
-
- if (bindings.containsKey(code)) {
- try {
- INMSBinding b = bindings.get(code).getConstructor().newInstance();
- Iris.info("Craftbukkit " + code + " <-> " + b.getClass().getSimpleName() + " Successfully Bound");
-
- return b;
- } catch (Throwable e) {
- Iris.reportError(e);
- e.printStackTrace();
- }
- }
-
- Iris.info("Craftbukkit " + code + " <-> " + NMSBinding1X.class.getSimpleName() + " Successfully Bound");
- Iris.warn("Note: Some features of Iris may not work the same since you are on an unsupported version of Minecraft.");
- Iris.warn("Note: If this is a new version, expect an update soon.");
-
- return new NMSBinding1X();
- }
-}
+/*
+ * Iris is a World Generator for Minecraft Bukkit Servers
+ * Copyright (c) 2022 Arcane Arts (Volmit Software)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.volmit.iris.core.nms;
+
+import com.volmit.iris.Iris;
+import com.volmit.iris.core.IrisSettings;
+import com.volmit.iris.core.nms.v20.NMSBinding19_4;
+import com.volmit.iris.core.nms.v1X.NMSBinding1X;
+import com.volmit.iris.util.collection.KMap;
+import org.bukkit.Bukkit;
+
+public class INMS {
+ //@builder
+ private static final KMap> bindings = new KMap>()
+ .qput("v1_19_R3", NMSBinding19_4.class);
+ //@done
+ private static final INMSBinding binding = bind();
+
+ public static INMSBinding get() {
+ return binding;
+ }
+
+ public static String getNMSTag() {
+ if (IrisSettings.get().getGeneral().isDisableNMS()) {
+ return "BUKKIT";
+ }
+
+ try {
+ return Bukkit.getServer().getClass().getCanonicalName().split("\\Q.\\E")[3];
+ } catch (Throwable e) {
+ Iris.reportError(e);
+ Iris.error("Failed to determine server nms version!");
+ e.printStackTrace();
+ }
+
+ return "BUKKIT";
+ }
+
+ private static INMSBinding bind() {
+ String code = getNMSTag();
+ Iris.info("Locating NMS Binding for " + code);
+
+ if (bindings.containsKey(code)) {
+ try {
+ INMSBinding b = bindings.get(code).getConstructor().newInstance();
+ Iris.info("Craftbukkit " + code + " <-> " + b.getClass().getSimpleName() + " Successfully Bound");
+
+ return b;
+ } catch (Throwable e) {
+ Iris.reportError(e);
+ e.printStackTrace();
+ }
+ }
+
+ Iris.info("Craftbukkit " + code + " <-> " + NMSBinding1X.class.getSimpleName() + " Successfully Bound");
+ Iris.warn("Note: Some features of Iris may not work the same since you are on an unsupported version of Minecraft.");
+ Iris.warn("Note: If this is a new version, expect an update soon.");
+
+ return new NMSBinding1X();
+ }
+}
diff --git a/src/main/java/com/volmit/iris/core/nms/v19_4/CustomBiomeSource.java b/src/main/java/com/volmit/iris/core/nms/v20/CustomBiomeSource.java
similarity index 94%
rename from src/main/java/com/volmit/iris/core/nms/v19_4/CustomBiomeSource.java
rename to src/main/java/com/volmit/iris/core/nms/v20/CustomBiomeSource.java
index 53753e936..67fb169e6 100644
--- a/src/main/java/com/volmit/iris/core/nms/v19_4/CustomBiomeSource.java
+++ b/src/main/java/com/volmit/iris/core/nms/v20/CustomBiomeSource.java
@@ -1,4 +1,4 @@
-package com.volmit.iris.core.nms.v19_4;
+package com.volmit.iris.core.nms.v20;
import com.mojang.serialization.Codec;
import com.volmit.iris.Iris;
@@ -18,10 +18,9 @@
import net.minecraft.world.level.biome.Climate;
import org.bukkit.Bukkit;
import org.bukkit.World;
-import org.bukkit.craftbukkit.v1_19_R3.CraftServer;
-import org.bukkit.craftbukkit.v1_19_R3.CraftWorld;
-import org.bukkit.craftbukkit.v1_19_R3.block.CraftBlock;
-
+import org.bukkit.craftbukkit.v1_20_R1.CraftServer;
+import org.bukkit.craftbukkit.v1_20_R1.CraftWorld;
+import org.bukkit.craftbukkit.v1_20_R1.block.CraftBlock;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
diff --git a/src/main/java/com/volmit/iris/core/nms/v19_4/NMSBinding19_4.java b/src/main/java/com/volmit/iris/core/nms/v20/NMSBinding19_4.java
similarity index 95%
rename from src/main/java/com/volmit/iris/core/nms/v19_4/NMSBinding19_4.java
rename to src/main/java/com/volmit/iris/core/nms/v20/NMSBinding19_4.java
index 1a4c41f5c..e73bf51dc 100644
--- a/src/main/java/com/volmit/iris/core/nms/v19_4/NMSBinding19_4.java
+++ b/src/main/java/com/volmit/iris/core/nms/v20/NMSBinding19_4.java
@@ -1,453 +1,454 @@
-/*
- * Iris is a World Generator for Minecraft Bukkit Servers
- * Copyright (c) 2022 Arcane Arts (Volmit Software)
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-package com.volmit.iris.core.nms.v19_4;
-
-
-import com.volmit.iris.Iris;
-import com.volmit.iris.core.nms.INMSBinding;
-import com.volmit.iris.engine.data.cache.AtomicCache;
-import com.volmit.iris.util.collection.KMap;
-import com.volmit.iris.util.hunk.Hunk;
-import com.volmit.iris.util.mantle.Mantle;
-import com.volmit.iris.util.matter.MatterBiomeInject;
-import com.volmit.iris.util.nbt.io.NBTUtil;
-import com.volmit.iris.util.nbt.mca.NBTWorld;
-import com.volmit.iris.util.nbt.mca.palette.*;
-import com.volmit.iris.util.nbt.tag.CompoundTag;
-import it.unimi.dsi.fastutil.objects.Object2IntMap;
-import net.minecraft.core.BlockPos;
-import net.minecraft.core.Holder;
-import net.minecraft.core.Registry;
-import net.minecraft.core.RegistryAccess;
-import net.minecraft.core.registries.Registries;
-import net.minecraft.nbt.NbtIo;
-import net.minecraft.resources.ResourceLocation;
-import net.minecraft.world.level.block.Block;
-import net.minecraft.world.level.block.entity.BlockEntity;
-import net.minecraft.world.level.block.state.BlockState;
-import net.minecraft.world.level.chunk.ChunkAccess;
-import net.minecraft.world.level.chunk.ChunkStatus;
-import net.minecraft.world.level.chunk.LevelChunk;
-import org.bukkit.*;
-import org.bukkit.block.Biome;
-import org.bukkit.block.data.BlockData;
-import org.bukkit.craftbukkit.v1_19_R3.CraftChunk;
-import org.bukkit.craftbukkit.v1_19_R3.CraftServer;
-import org.bukkit.craftbukkit.v1_19_R3.CraftWorld;
-import org.bukkit.craftbukkit.v1_19_R3.block.CraftBlock;
-import org.bukkit.craftbukkit.v1_19_R3.block.data.CraftBlockData;
-import org.bukkit.entity.Entity;
-import org.bukkit.generator.ChunkGenerator;
-import org.jetbrains.annotations.NotNull;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.util.Iterator;
-import java.util.List;
-import java.util.concurrent.atomic.AtomicInteger;
-
-public class NMSBinding19_4 implements INMSBinding {
-
- public static final String NMS_VERSION = "1.19.4";
- private final KMap baseBiomeCache = new KMap<>();
- private final BlockData AIR = Material.AIR.createBlockData();
- private final AtomicCache> biomeMapCache = new AtomicCache<>();
- private final AtomicCache> registryCache = new AtomicCache<>();
- private final AtomicCache> globalCache = new AtomicCache<>();
- private final AtomicCache registryAccess = new AtomicCache<>();
- private final AtomicCache byIdRef = new AtomicCache<>();
- private Field biomeStorageCache = null;
-
- private static Object getFor(Class> type, Object source) {
- Object o = fieldFor(type, source);
-
- if (o != null) {
- return o;
- }
-
- return invokeFor(type, source);
- }
-
- private static Object invokeFor(Class> returns, Object in) {
- for (Method i : in.getClass().getMethods()) {
- if (i.getReturnType().equals(returns)) {
- i.setAccessible(true);
- try {
- Iris.debug("[NMS] Found " + returns.getSimpleName() + " in " + in.getClass().getSimpleName() + "." + i.getName() + "()");
- return i.invoke(in);
- } catch (Throwable e) {
- e.printStackTrace();
- }
- }
- }
-
- return null;
- }
-
- private static Object fieldFor(Class> returns, Object in) {
- return fieldForClass(returns, in.getClass(), in);
- }
-
- @SuppressWarnings("unchecked")
- private static T fieldForClass(Class returnType, Class> sourceType, Object in) {
- for (Field i : sourceType.getDeclaredFields()) {
- if (i.getType().equals(returnType)) {
- i.setAccessible(true);
- try {
- Iris.debug("[NMS] Found " + returnType.getSimpleName() + " in " + sourceType.getSimpleName() + "." + i.getName());
- return (T) i.get(in);
- } catch (IllegalAccessException e) {
- e.printStackTrace();
- }
- }
- }
- return null;
- }
-
- private static Class> getClassType(Class> type, int ordinal) {
- return type.getDeclaredClasses()[ordinal];
- }
-
- @Override
- public boolean hasTile(Location l) {
- return ((CraftWorld) l.getWorld()).getHandle().getBlockEntity(new BlockPos(l.getBlockX(), l.getBlockY(), l.getBlockZ()), false) != null;
- }
-
- @Override
- public CompoundTag serializeTile(Location location) {
- BlockEntity e = ((CraftWorld) location.getWorld()).getHandle().getBlockEntity(new BlockPos(location.getBlockX(), location.getBlockY(), location.getBlockZ()), true);
-
- if (e == null) {
- return null;
- }
-
- net.minecraft.nbt.CompoundTag tag = e.saveWithFullMetadata();
- return convert(tag);
- }
-
- private CompoundTag convert(net.minecraft.nbt.CompoundTag tag) {
- try {
- ByteArrayOutputStream boas = new ByteArrayOutputStream();
- DataOutputStream dos = new DataOutputStream(boas);
- tag.write(dos);
- dos.close();
- return (CompoundTag) NBTUtil.read(new ByteArrayInputStream(boas.toByteArray()), false).getTag();
- } catch (Throwable ex) {
- ex.printStackTrace();
- }
-
- return null;
- }
-
- private net.minecraft.nbt.CompoundTag convert(CompoundTag tag) {
- try {
- ByteArrayOutputStream boas = new ByteArrayOutputStream();
- NBTUtil.write(tag, boas, false);
- DataInputStream din = new DataInputStream(new ByteArrayInputStream(boas.toByteArray()));
- net.minecraft.nbt.CompoundTag c = NbtIo.read(din);
- din.close();
- return c;
- } catch (Throwable e) {
- e.printStackTrace();
- }
-
- return null;
- }
-
- @Override
- public void deserializeTile(CompoundTag c, Location pos) {
- ((CraftWorld) pos.getWorld()).getHandle().getChunkAt(new BlockPos(pos.getBlockX(), 0, pos.getBlockZ())).setBlockEntityNbt(convert(c));
- }
-
- @Override
- public CompoundTag serializeEntity(Entity location) {
- return null;// TODO:
- }
-
- @Override
- public Entity deserializeEntity(CompoundTag s, Location newPosition) {
- return null;// TODO:
- }
-
- @Override
- public boolean supportsCustomHeight() {
- return true;
- }
-
- private RegistryAccess registry() {
- return registryAccess.aquire(() -> (RegistryAccess) getFor(RegistryAccess.Frozen.class, ((CraftServer) Bukkit.getServer()).getHandle().getServer()));
- }
-
- private Registry getCustomBiomeRegistry() {
- return registry().registry(Registries.BIOME).orElse(null);
- }
-
- private Registry getBlockRegistry() {
- return registry().registry(Registries.BLOCK).orElse(null);
- }
-
- @Override
- public Object getBiomeBaseFromId(int id) {
- return getCustomBiomeRegistry().getHolder(id);
- }
-
- @Override
- public int getMinHeight(World world) {
- return world.getMinHeight();
- }
-
- @Override
- public boolean supportsCustomBiomes() {
- return true;
- }
-
- @Override
- public int getTrueBiomeBaseId(Object biomeBase) {
- return getCustomBiomeRegistry().getId(((Holder) biomeBase).value());
- }
-
- @Override
- public Object getTrueBiomeBase(Location location) {
- return ((CraftWorld) location.getWorld()).getHandle().getBiome(new BlockPos(location.getBlockX(), location.getBlockY(), location.getBlockZ()));
- }
-
- @Override
- public String getTrueBiomeBaseKey(Location location) {
- return getKeyForBiomeBase(getTrueBiomeBase(location));
- }
-
- @Override
- public Object getCustomBiomeBaseFor(String mckey) {
- return getCustomBiomeRegistry().get(new ResourceLocation(mckey));
- }
-
- @Override
- public Object getCustomBiomeBaseHolderFor(String mckey) {
- return getCustomBiomeRegistry().getHolder(getTrueBiomeBaseId(getCustomBiomeRegistry().get(new ResourceLocation(mckey)))).get();
- }
-
- public int getBiomeBaseIdForKey(String key) {
- return getCustomBiomeRegistry().getId(getCustomBiomeRegistry().get(new ResourceLocation(key)));
- }
-
- @Override
- public String getKeyForBiomeBase(Object biomeBase) {
- return getCustomBiomeRegistry().getKey((net.minecraft.world.level.biome.Biome) biomeBase).getPath(); // something, not something:something
- }
-
- @Override
- public Object getBiomeBase(World world, Biome biome) {
- return CraftBlock.biomeToBiomeBase(((CraftWorld) world).getHandle()
- .registryAccess().registry(Registries.BIOME).orElse(null), biome);
- }
-
- @Override
- public Object getBiomeBase(Object registry, Biome biome) {
- Object v = baseBiomeCache.get(biome);
-
- if (v != null) {
- return v;
- }
- //noinspection unchecked
- v = CraftBlock.biomeToBiomeBase((Registry) registry, biome);
- if (v == null) {
- // Ok so there is this new biome name called "CUSTOM" in Paper's new releases.
- // But, this does NOT exist within CraftBukkit which makes it return an error.
- // So, we will just return the ID that the plains biome returns instead.
- //noinspection unchecked
- return CraftBlock.biomeToBiomeBase((Registry) registry, Biome.PLAINS);
- }
- baseBiomeCache.put(biome, v);
- return v;
- }
-
- @Override
- public boolean isBukkit() {
- return true;
- }
-
- @Override
- public int getBiomeId(Biome biome) {
- for (World i : Bukkit.getWorlds()) {
- if (i.getEnvironment().equals(World.Environment.NORMAL)) {
- Registry registry = ((CraftWorld) i).getHandle().registryAccess().registry(Registries.BIOME).orElse(null);
- return registry.getId((net.minecraft.world.level.biome.Biome) getBiomeBase(registry, biome));
- }
- }
-
- return biome.ordinal();
- }
-
- private MCAIdMap getBiomeMapping() {
- return biomeMapCache.aquire(() -> new MCAIdMap<>() {
- @NotNull
- @Override
- public Iterator iterator() {
- return getCustomBiomeRegistry().iterator();
- }
-
- @Override
- public int getId(net.minecraft.world.level.biome.Biome paramT) {
- return getCustomBiomeRegistry().getId(paramT);
- }
-
- @Override
- public net.minecraft.world.level.biome.Biome byId(int paramInt) {
- return (net.minecraft.world.level.biome.Biome) getBiomeBaseFromId(paramInt);
- }
- });
- }
-
- @NotNull
- private MCABiomeContainer getBiomeContainerInterface(MCAIdMap biomeMapping, MCAChunkBiomeContainer base) {
- return new MCABiomeContainer() {
- @Override
- public int[] getData() {
- return base.writeBiomes();
- }
-
- @Override
- public void setBiome(int x, int y, int z, int id) {
- base.setBiome(x, y, z, biomeMapping.byId(id));
- }
-
- @Override
- public int getBiome(int x, int y, int z) {
- return biomeMapping.getId(base.getBiome(x, y, z));
- }
- };
- }
-
- @Override
- public MCABiomeContainer newBiomeContainer(int min, int max) {
- MCAChunkBiomeContainer base = new MCAChunkBiomeContainer<>(getBiomeMapping(), min, max);
- return getBiomeContainerInterface(getBiomeMapping(), base);
- }
-
- @Override
- public MCABiomeContainer newBiomeContainer(int min, int max, int[] data) {
- MCAChunkBiomeContainer base = new MCAChunkBiomeContainer<>(getBiomeMapping(), min, max, data);
- return getBiomeContainerInterface(getBiomeMapping(), base);
- }
-
- @Override
- public int countCustomBiomes() {
- AtomicInteger a = new AtomicInteger(0);
-
- getCustomBiomeRegistry().keySet().forEach((i) -> {
- if (i.getNamespace().equals("minecraft")) {
- return;
- }
-
- a.incrementAndGet();
- Iris.debug("Custom Biome: " + i);
- });
-
- return a.get();
- }
-
- public boolean supportsDataPacks() {
- return true;
- }
-
- public void setBiomes(int cx, int cz, World world, Hunk