mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-02-16 10:30:53 +00:00
Compare commits
46 Commits
2.0.1-1.18
...
2.0.6-1.18
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
609104cfa8 | ||
|
|
935d11b433 | ||
|
|
e9eeb8335d | ||
|
|
4a2f42437f | ||
|
|
51b0693c99 | ||
|
|
185b366d8d | ||
|
|
a40e533068 | ||
|
|
5b3918fcb1 | ||
|
|
d315e99b63 | ||
|
|
8090ba0259 | ||
|
|
584400d011 | ||
|
|
124ad23a95 | ||
|
|
6b59aa38ae | ||
|
|
03554eb372 | ||
|
|
dabfe41f29 | ||
|
|
6e2c6fc51e | ||
|
|
d81986bcc5 | ||
|
|
ea17e916b8 | ||
|
|
ce56224038 | ||
|
|
9978932391 | ||
|
|
2ebc9e0deb | ||
|
|
7ddc621009 | ||
|
|
aa4e574eef | ||
|
|
15bc964fcc | ||
|
|
99713ac964 | ||
|
|
f9a6bd1343 | ||
|
|
f4bee872e1 | ||
|
|
be99b286b3 | ||
|
|
c7d5212f82 | ||
|
|
75726b3d34 | ||
|
|
8d7e76ed81 | ||
|
|
01b08b2297 | ||
|
|
cf51581ac1 | ||
|
|
d99fd56995 | ||
|
|
d149051c27 | ||
|
|
660aaa87ca | ||
|
|
4010f03b05 | ||
|
|
e2d2dcf337 | ||
|
|
b11aaf3f0c | ||
|
|
30ae065cb4 | ||
|
|
7f5b0559aa | ||
|
|
851954efb2 | ||
|
|
b8c6a459a6 | ||
|
|
4523089440 | ||
|
|
217fe47878 | ||
|
|
525e3db24a |
23
build.gradle
23
build.gradle
@@ -24,11 +24,10 @@ plugins {
|
||||
id "de.undercouch.download" version "5.0.1"
|
||||
}
|
||||
|
||||
group 'com.volmit.iris'
|
||||
version '2.0.1-1.18.X'
|
||||
def nmsVersion = "1.18.1"
|
||||
version '2.0.5-1.18.2' // Needs to be version specific
|
||||
def nmsVersion = "1.18.2"
|
||||
def apiVersion = '1.18'
|
||||
def spigotJarVersion = '1.18.1-R0.1-SNAPSHOT'
|
||||
def spigotJarVersion = '1.18.2-R0.1-SNAPSHOT'
|
||||
def name = getRootProject().getName() // Defined in settings.gradle
|
||||
def main = 'com.volmit.iris.Iris'
|
||||
|
||||
@@ -39,7 +38,7 @@ registerCustomOutputTask('Psycho', 'D://Dan/MinecraftDevelopment/server/plugins'
|
||||
registerCustomOutputTask('ArcaneArts', 'C://Users/arcane/Documents/development/server/plugins')
|
||||
registerCustomOutputTask('Coco', 'D://Documents/MC/plugins')
|
||||
registerCustomOutputTask('Strange', 'D://Servers/1.17 Test Server/plugins')
|
||||
registerCustomOutputTask('Vatuu', 'D://Minecraft/Servers/1.18.1/plugins')
|
||||
registerCustomOutputTask('Vatuu', 'D://Minecraft/Servers/1.18.2/plugins')
|
||||
// ========================== UNIX ==============================
|
||||
registerCustomOutputTaskUnix('CyberpwnLT', '/Users/danielmills/Documents/development/server/plugins')
|
||||
registerCustomOutputTaskUnix('PsychoLT', '/Users/brianfopiano/Desktop/REMOTES/RemoteMinecraft/plugins')
|
||||
@@ -123,10 +122,10 @@ dependencies {
|
||||
// Provided or Classpath
|
||||
compileOnly 'org.projectlombok:lombok:1.18.22'
|
||||
annotationProcessor 'org.projectlombok:lombok:1.18.22'
|
||||
implementation 'org.spigotmc:spigot-api:1.18.1-R0.1-SNAPSHOT'
|
||||
implementation 'me.clip:placeholderapi:2.10.10'
|
||||
implementation 'org.spigotmc:spigot-api:1.18.2-R0.1-SNAPSHOT'
|
||||
implementation 'me.clip:placeholderapi:2.11.1'
|
||||
implementation 'io.th0rgal:oraxen:1.94.0'
|
||||
implementation 'org.bukkit:craftbukkit:1.18.1-R0.1-SNAPSHOT:remapped-mojang'
|
||||
implementation 'org.bukkit:craftbukkit:1.18.2-R0.1-SNAPSHOT:remapped-mojang'
|
||||
|
||||
// Shaded
|
||||
implementation 'com.dfsek:Paralithic:0.4.0'
|
||||
@@ -137,15 +136,15 @@ dependencies {
|
||||
|
||||
// Dynamically Loaded
|
||||
implementation 'io.timeandspace:smoothie-map:2.0.2'
|
||||
implementation 'it.unimi.dsi:fastutil:8.5.6'
|
||||
implementation 'it.unimi.dsi:fastutil:8.5.8'
|
||||
implementation 'com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:1.4.2'
|
||||
implementation 'org.zeroturnaround:zt-zip:1.14'
|
||||
implementation 'com.google.code.gson:gson:2.8.9'
|
||||
implementation 'com.google.code.gson:gson:2.9.0'
|
||||
implementation 'org.ow2.asm:asm:9.2'
|
||||
implementation 'com.google.guava:guava:31.0.1-jre'
|
||||
implementation 'com.google.guava:guava:31.1-jre'
|
||||
implementation 'bsf:bsf:2.4.0'
|
||||
implementation 'rhino:js:1.7R2'
|
||||
implementation 'com.github.ben-manes.caffeine:caffeine:3.0.5'
|
||||
implementation 'com.github.ben-manes.caffeine:caffeine:3.0.6'
|
||||
implementation 'org.apache.commons:commons-lang3:3.12.0'
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ import com.volmit.iris.core.link.OraxenLink;
|
||||
import com.volmit.iris.core.loader.IrisData;
|
||||
import com.volmit.iris.core.nms.INMS;
|
||||
import com.volmit.iris.core.service.StudioSVC;
|
||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||
import com.volmit.iris.engine.EnginePanic;
|
||||
import com.volmit.iris.engine.object.IrisBiome;
|
||||
import com.volmit.iris.engine.object.IrisCompat;
|
||||
|
||||
@@ -101,7 +101,7 @@ public class CommandIris implements DecreeExecutor {
|
||||
sender().sendMessage(C.GREEN + "Iris v" + Iris.instance.getDescription().getVersion() + " by Volmit Software");
|
||||
}
|
||||
|
||||
@Decree(description = "Print version information", origin = DecreeOrigin.PLAYER)
|
||||
@Decree(description = "Print world height information", origin = DecreeOrigin.PLAYER)
|
||||
public void height() {
|
||||
sender().sendMessage(C.GREEN + "" + sender().player().getWorld().getMinHeight() + " to " + sender().player().getWorld().getMaxHeight());
|
||||
sender().sendMessage(C.GREEN + "Total Height: " + (sender().player().getWorld().getMaxHeight() - sender().player().getWorld().getMinHeight()));
|
||||
|
||||
@@ -327,7 +327,11 @@ public class CommandObject implements DecreeExecutor {
|
||||
|
||||
Map<Block, BlockData> futureChanges = new HashMap<>();
|
||||
|
||||
o = o.scaled(scale, IrisObjectPlacementScaleInterpolator.TRICUBIC);
|
||||
if(scale != 1)
|
||||
{
|
||||
o = o.scaled(scale, IrisObjectPlacementScaleInterpolator.TRICUBIC);
|
||||
}
|
||||
|
||||
o.place(block.getBlockX(), block.getBlockY() + (int) o.getCenter().getY(), block.getBlockZ(), createPlacer(block.getWorld(), futureChanges), placement, new RNG(), null);
|
||||
|
||||
Iris.service(ObjectSVC.class).addChanges(futureChanges);
|
||||
|
||||
@@ -65,7 +65,7 @@ public class MythicMobsLink {
|
||||
}
|
||||
|
||||
try {
|
||||
Class<?> mythicMobClass = Class.forName("io.lumine.xikage.mythicmobs.MythicMobs");
|
||||
Class<?> mythicMobClass = Class.forName("io.lumine.mythic.bukkit.MythicBukkit");
|
||||
Method getInst = mythicMobClass.getDeclaredMethod("inst");
|
||||
Object inst = getInst.invoke(null);
|
||||
Method getAPIHelper = mythicMobClass.getDeclaredMethod("getAPIHelper");
|
||||
|
||||
@@ -20,7 +20,7 @@ package com.volmit.iris.core.nms;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.IrisSettings;
|
||||
import com.volmit.iris.core.nms.v18_1.NMSBinding18_1;
|
||||
import com.volmit.iris.core.nms.v18_2.NMSBinding18_2;
|
||||
import com.volmit.iris.core.nms.v1X.NMSBinding1X;
|
||||
import com.volmit.iris.util.collection.KMap;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -28,7 +28,7 @@ import org.bukkit.Bukkit;
|
||||
public class INMS {
|
||||
//@builder
|
||||
private static final KMap<String, Class<? extends INMSBinding>> bindings = new KMap<String, Class<? extends INMSBinding>>()
|
||||
.qput("v1_18_R1", NMSBinding18_1.class);
|
||||
.qput("v1_18_R2", NMSBinding18_2.class);
|
||||
//@done
|
||||
private static final INMSBinding binding = bind();
|
||||
|
||||
|
||||
@@ -54,6 +54,7 @@ public interface INMSBinding {
|
||||
String getTrueBiomeBaseKey(Location location);
|
||||
|
||||
Object getCustomBiomeBaseFor(String mckey);
|
||||
Object getCustomBiomeBaseHolderFor(String mckey);
|
||||
|
||||
String getKeyForBiomeBase(Object biomeBase);
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public enum NMSVersion {
|
||||
R1_18_2,
|
||||
R1_18,
|
||||
R1_17,
|
||||
R1_16,
|
||||
@@ -98,6 +99,9 @@ public enum NMSVersion {
|
||||
if(tryVersion("1_18_R1")) {
|
||||
return R1_18;
|
||||
}
|
||||
if(tryVersion("1_18_R2")) {
|
||||
return R1_18_2;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.volmit.iris.core.nms.v18_1;
|
||||
package com.volmit.iris.core.nms.v18_2;
|
||||
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
@@ -36,10 +36,7 @@ import com.volmit.iris.util.nbt.mca.palette.MCAPalettedContainer;
|
||||
import com.volmit.iris.util.nbt.mca.palette.MCAWrappedPalettedContainer;
|
||||
import com.volmit.iris.util.nbt.tag.CompoundTag;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.IdMap;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
import net.minecraft.core.*;
|
||||
import net.minecraft.nbt.NbtIo;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
@@ -52,9 +49,10 @@ import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.craftbukkit.v1_18_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_18_R1.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_18_R1.block.data.CraftBlockData;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_18_R2.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_18_R2.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_18_R2.block.data.CraftBlockData;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -70,7 +68,7 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public class NMSBinding18_1 implements INMSBinding {
|
||||
public class NMSBinding18_2 implements INMSBinding {
|
||||
|
||||
private final KMap<Biome, Object> baseBiomeCache = new KMap<>();
|
||||
private final BlockData AIR = Material.AIR.createBlockData();
|
||||
@@ -148,7 +146,7 @@ public class NMSBinding18_1 implements INMSBinding {
|
||||
}
|
||||
|
||||
private RegistryAccess registry() {
|
||||
return registryAccess.aquire(() -> (RegistryAccess) getFor(RegistryAccess.class, ((CraftServer) Bukkit.getServer()).getHandle().getServer()));
|
||||
return registryAccess.aquire(() -> (RegistryAccess) getFor(RegistryAccess.Frozen.class, ((CraftServer) Bukkit.getServer()).getHandle().getServer()));
|
||||
}
|
||||
|
||||
private Registry<net.minecraft.world.level.biome.Biome> getCustomBiomeRegistry() {
|
||||
@@ -210,6 +208,10 @@ public class NMSBinding18_1 implements INMSBinding {
|
||||
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();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getKeyForBiomeBase(Object biomeBase) {
|
||||
@@ -229,13 +231,13 @@ public class NMSBinding18_1 implements INMSBinding {
|
||||
return v;
|
||||
}
|
||||
//noinspection unchecked
|
||||
v = org.bukkit.craftbukkit.v1_18_R1.block.CraftBlock.biomeToBiomeBase((Registry<net.minecraft.world.level.biome.Biome>) registry, biome);
|
||||
v = org.bukkit.craftbukkit.v1_18_R2.block.CraftBlock.biomeToBiomeBase((Registry<net.minecraft.world.level.biome.Biome>) 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 org.bukkit.craftbukkit.v1_18_R1.block.CraftBlock.biomeToBiomeBase((Registry<net.minecraft.world.level.biome.Biome>) registry, Biome.PLAINS);
|
||||
return org.bukkit.craftbukkit.v1_18_R2.block.CraftBlock.biomeToBiomeBase((Registry<net.minecraft.world.level.biome.Biome>) registry, Biome.PLAINS);
|
||||
}
|
||||
baseBiomeCache.put(biome, v);
|
||||
return v;
|
||||
@@ -334,7 +336,7 @@ public class NMSBinding18_1 implements INMSBinding {
|
||||
public void forceBiomeInto(int x, int y, int z, Object somethingVeryDirty, ChunkGenerator.BiomeGrid chunk) {
|
||||
try {
|
||||
ChunkAccess s = (ChunkAccess) getFieldForBiomeStorage(chunk).get(chunk);
|
||||
s.setBiome(x, y, z, (net.minecraft.world.level.biome.Biome) somethingVeryDirty);
|
||||
s.setBiome(x, y, z, (Holder<net.minecraft.world.level.biome.Biome>) somethingVeryDirty); // probably not safe? it said it wanted a holder, so i made it a holder...
|
||||
} catch(IllegalAccessException e) {
|
||||
Iris.reportError(e);
|
||||
e.printStackTrace();
|
||||
@@ -112,6 +112,11 @@ public class NMSBinding1X implements INMSBinding {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getCustomBiomeBaseHolderFor(String mckey) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getKeyForBiomeBase(Object biomeBase) {
|
||||
return null;
|
||||
|
||||
@@ -32,15 +32,21 @@ import com.volmit.iris.engine.platform.PlatformChunkGenerator;
|
||||
import com.volmit.iris.util.plugin.VolmitSender;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Something you really want to wear if working on Iris. Shit gets pretty hectic down there.
|
||||
* Hope you packed snacks & road sodas.
|
||||
*/
|
||||
public class IrisToolbelt {
|
||||
public static Map<String, Boolean> toolbeltConfiguration = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Will find / download / search for the dimension or return null
|
||||
* <p>
|
||||
@@ -210,4 +216,64 @@ public class IrisToolbelt {
|
||||
public static boolean isStudio(World i) {
|
||||
return isIrisWorld(i) && access(i).isStudio();
|
||||
}
|
||||
|
||||
public static void retainMantleDataForSlice(String className)
|
||||
{
|
||||
toolbeltConfiguration.put("retain.mantle." + className, true);
|
||||
}
|
||||
|
||||
public static <T> T getMantleData(World world, int x, int y, int z, Class<T> of)
|
||||
{
|
||||
PlatformChunkGenerator e = access(world);
|
||||
if(e == null) {return null;}
|
||||
return e.getEngine().getMantle().getMantle().get(x, y - world.getMinHeight(), z, of);
|
||||
}
|
||||
|
||||
public static <T> void deleteMantleData(World world, int x, int y, int z, Class<T> of)
|
||||
{
|
||||
PlatformChunkGenerator e = access(world);
|
||||
if(e == null) {return;}
|
||||
e.getEngine().getMantle().getMantle().remove(x, y - world.getMinHeight(), z, of);
|
||||
}
|
||||
|
||||
/////////////////// REFLECTIVE METHODS //////////////////////////
|
||||
// Copy this stuff to your project, it's safe to use with a
|
||||
// bukkit api only.
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
public static void setup() throws Throwable {
|
||||
Method m = Class.forName("com.volmit.iris.core.tools.IrisToolbelt").getDeclaredMethod("retainMantleDataForSlice", String.class);
|
||||
m.invoke(null, String.class.getCanonicalName());
|
||||
m.invoke(null, BlockData.class.getCanonicalName());
|
||||
}
|
||||
|
||||
public static boolean hasMantleObject(World world, int x, int y, int z) {
|
||||
return getMantleIdentity(world, x, y, z) != -1;
|
||||
}
|
||||
|
||||
public static void deleteMantleBlock(World world, int x, int y, int z) {
|
||||
try {
|
||||
Method m = Class.forName("com.volmit.iris.core.tools.IrisToolbelt").getDeclaredMethod("deleteMantleData", World.class, int.class, int.class, int.class, Class.class);
|
||||
m.invoke(null, world, x, y, z, BlockData.class);
|
||||
m.invoke(null, world, x, y, z, String.class);
|
||||
} catch(Throwable ignored) {}
|
||||
}
|
||||
|
||||
public static BlockData getMantleBlock(World world, int x, int y, int z) {
|
||||
try {
|
||||
Method m = Class.forName("com.volmit.iris.core.tools.IrisToolbelt").getDeclaredMethod("getMantleData", World.class, int.class, int.class, int.class, Class.class);
|
||||
BlockData s = (BlockData) m.invoke(null, world, x, y, z, BlockData.class);
|
||||
if(s != null) {return s;}
|
||||
} catch(Throwable ignored) {}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static int getMantleIdentity(World world, int x, int y, int z) {
|
||||
try {
|
||||
Method m = Class.forName("com.volmit.iris.core.tools.IrisToolbelt").getDeclaredMethod("getMantleData", World.class, int.class, int.class, int.class, Class.class);
|
||||
String s = (String) m.invoke(null, world, x, y, z, String.class);
|
||||
if(s != null) {return Integer.parseInt(s.split("\\Q@\\E")[1]);}
|
||||
} catch(Throwable ignored) {}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -336,8 +336,7 @@ public class IrisComplex implements DataProvider {
|
||||
}
|
||||
|
||||
private double getHeight(Engine engine, IrisBiome b, double x, double z, long seed) {
|
||||
return Math.min(engine.getWorld().maxHeight(),
|
||||
Math.max(getInterpolatedHeight(engine, x, z, seed) + fluidHeight + overlayStream.get(x, z), engine.getWorld().minHeight()));
|
||||
return Math.max(Math.min(getInterpolatedHeight(engine, x, z, seed) + fluidHeight + overlayStream.get(x, z), engine.getHeight()), 0);
|
||||
}
|
||||
|
||||
private void registerGenerator(IrisGenerator cachedGenerator) {
|
||||
|
||||
@@ -57,7 +57,7 @@ public class IrisBiomeActuator extends EngineAssignedActuator<Biome> {
|
||||
return true;
|
||||
}
|
||||
} catch(Throwable e) {
|
||||
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -79,7 +79,7 @@ public class IrisBiomeActuator extends EngineAssignedActuator<Biome> {
|
||||
if(ib.isCustom()) {
|
||||
try {
|
||||
IrisBiomeCustom custom = ib.getCustomBiome(rng, x, 0, z);
|
||||
Object biomeBase = INMS.get().getCustomBiomeBaseFor(getDimension().getLoadKey() + ":" + custom.getId());
|
||||
Object biomeBase = INMS.get().getCustomBiomeBaseHolderFor(getDimension().getLoadKey() + ":" + custom.getId());
|
||||
//
|
||||
if(biomeBase == null || !injectBiome(h, x, 0, z, biomeBase)) {
|
||||
throw new RuntimeException("Cant inject biome!");
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package com.volmit.iris.engine.data.chunk;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.nms.BiomeBaseInjector;
|
||||
import com.volmit.iris.core.nms.INMS;
|
||||
import com.volmit.iris.util.data.IrisBiomeStorage;
|
||||
|
||||
@@ -69,24 +69,31 @@ public abstract class EngineAssignedWorldManager extends EngineAssignedComponent
|
||||
|
||||
protected AtomicBoolean ignoreTP = new AtomicBoolean(false);
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void on(PlayerTeleportEvent e) {
|
||||
if(ignoreTP.get()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(!PaperLib.isPaper() || e.getTo() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
if(e.getTo().getWorld().equals(getTarget().getWorld().realWorld())) {
|
||||
getEngine().getWorldManager().teleportAsync(e);
|
||||
}
|
||||
} catch(Throwable ex) {
|
||||
|
||||
}
|
||||
}
|
||||
// @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
// public void on(PlayerTeleportEvent e) {
|
||||
// if(ignoreTP.get()) {
|
||||
// System.out.println("IgTP1");
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if(!PaperLib.isPaper() || e.getTo() == null) {
|
||||
// System.out.println("IgTP2");
|
||||
//
|
||||
//// return;
|
||||
// }
|
||||
//
|
||||
//// try {
|
||||
//// System.out.println("IgTP3");
|
||||
////
|
||||
//// if(e.getTo().getWorld().equals(getTarget().getWorld().realWorld())) {
|
||||
//// System.out.println("IgTP4");
|
||||
////
|
||||
//// getEngine().getWorldManager().teleportAsync(e);
|
||||
//// }
|
||||
//// } catch(Throwable ex) {
|
||||
////
|
||||
//// }
|
||||
// }
|
||||
|
||||
@EventHandler
|
||||
public void on(WorldSaveEvent e) {
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.volmit.iris.core.loader.IrisData;
|
||||
import com.volmit.iris.engine.data.cache.Cache;
|
||||
import com.volmit.iris.engine.framework.Engine;
|
||||
import com.volmit.iris.engine.object.IObjectPlacer;
|
||||
import com.volmit.iris.engine.object.IrisGeneratorStyle;
|
||||
import com.volmit.iris.engine.object.IrisPosition;
|
||||
import com.volmit.iris.engine.object.TileData;
|
||||
import com.volmit.iris.util.collection.KMap;
|
||||
@@ -31,6 +32,7 @@ import com.volmit.iris.util.collection.KSet;
|
||||
import com.volmit.iris.util.function.Function3;
|
||||
import com.volmit.iris.util.mantle.Mantle;
|
||||
import com.volmit.iris.util.mantle.MantleChunk;
|
||||
import com.volmit.iris.util.math.RNG;
|
||||
import com.volmit.iris.util.matter.Matter;
|
||||
import lombok.Data;
|
||||
import org.bukkit.block.TileState;
|
||||
@@ -121,6 +123,13 @@ public class MantleWriter implements IObjectPlacer {
|
||||
return (x * x) + (z * z);
|
||||
}
|
||||
|
||||
public <T> void setDataWarped(int x, int y, int z, T t, RNG rng, IrisData data, IrisGeneratorStyle style)
|
||||
{
|
||||
setData((int)Math.round(style.warp(rng, data, x, x, y, -z)),
|
||||
(int)Math.round(style.warp(rng, data, y, z, -x, y)),
|
||||
(int)Math.round(style.warp(rng, data, z, -y, z, x)), t);
|
||||
}
|
||||
|
||||
public <T> void setData(int x, int y, int z, T t) {
|
||||
if(t == null) {
|
||||
return;
|
||||
@@ -233,6 +242,10 @@ public class MantleWriter implements IObjectPlacer {
|
||||
setElipsoidFunction(cx, cy, cz, rx, ry, rz, fill, (a, b, c) -> data);
|
||||
}
|
||||
|
||||
public <T> void setElipsoidWarped(int cx, int cy, int cz, double rx, double ry, double rz, boolean fill, T data, RNG rng, IrisData idata, IrisGeneratorStyle style) {
|
||||
setElipsoidFunctionWarped(cx, cy, cz, rx, ry, rz, fill, (a, b, c) -> data, rng, idata, style);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set an elipsoid into the mantle
|
||||
*
|
||||
@@ -312,6 +325,63 @@ public class MantleWriter implements IObjectPlacer {
|
||||
}
|
||||
}
|
||||
|
||||
public <T> void setElipsoidFunctionWarped(int cx, int cy, int cz, double rx, double ry, double rz, boolean fill, Function3<Integer, Integer, Integer, T> data, RNG rng, IrisData idata, IrisGeneratorStyle style) {
|
||||
rx += 0.5;
|
||||
ry += 0.5;
|
||||
rz += 0.5;
|
||||
final double invRadiusX = 1 / rx;
|
||||
final double invRadiusY = 1 / ry;
|
||||
final double invRadiusZ = 1 / rz;
|
||||
final int ceilRadiusX = (int) Math.ceil(rx);
|
||||
final int ceilRadiusY = (int) Math.ceil(ry);
|
||||
final int ceilRadiusZ = (int) Math.ceil(rz);
|
||||
double nextXn = 0;
|
||||
|
||||
forX:
|
||||
for(int x = 0; x <= ceilRadiusX; ++x) {
|
||||
final double xn = nextXn;
|
||||
nextXn = (x + 1) * invRadiusX;
|
||||
double nextYn = 0;
|
||||
forY:
|
||||
for(int y = 0; y <= ceilRadiusY; ++y) {
|
||||
final double yn = nextYn;
|
||||
nextYn = (y + 1) * invRadiusY;
|
||||
double nextZn = 0;
|
||||
for(int z = 0; z <= ceilRadiusZ; ++z) {
|
||||
final double zn = nextZn;
|
||||
nextZn = (z + 1) * invRadiusZ;
|
||||
|
||||
double distanceSq = lengthSq(xn, yn, zn);
|
||||
if(distanceSq > 1) {
|
||||
if(z == 0) {
|
||||
if(y == 0) {
|
||||
break forX;
|
||||
}
|
||||
break forY;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if(!fill) {
|
||||
if(lengthSq(nextXn, yn, zn) <= 1 && lengthSq(xn, nextYn, zn) <= 1 && lengthSq(xn, yn, nextZn) <= 1) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
setDataWarped(x + cx, y + cy, z + cz, data.apply(x + cx, y + cy, z + cz), rng, idata, style);
|
||||
setDataWarped(-x + cx, y + cy, z + cz, data.apply(-x + cx, y + cy, z + cz), rng, idata, style);
|
||||
setDataWarped(x + cx, -y + cy, z + cz, data.apply(x + cx, -y + cy, z + cz), rng, idata, style);
|
||||
setDataWarped(x + cx, y + cy, -z + cz, data.apply(x + cx, y + cy, -z + cz), rng, idata, style);
|
||||
setDataWarped(-x + cx, y + cy, -z + cz, data.apply(-x + cx, y + cy, -z + cz), rng, idata, style);
|
||||
setDataWarped(-x + cx, -y + cy, z + cz, data.apply(-x + cx, -y + cy, z + cz), rng, idata, style);
|
||||
setDataWarped(x + cx, -y + cy, -z + cz, data.apply(x + cx, -y + cy, -z + cz), rng, idata, style);
|
||||
setDataWarped(-x + cx, y + cy, -z + cz, data.apply(-x + cx, y + cy, -z + cz), rng, idata, style);
|
||||
setDataWarped(-x + cx, -y + cy, -z + cz, data.apply(-x + cx, -y + cy, -z + cz), rng, idata, style);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a cuboid of data in the mantle
|
||||
*
|
||||
|
||||
@@ -29,6 +29,7 @@ import com.volmit.iris.engine.object.IrisDecorator;
|
||||
import com.volmit.iris.engine.object.IrisPosition;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.collection.KMap;
|
||||
import com.volmit.iris.util.context.IrisContext;
|
||||
import com.volmit.iris.util.data.B;
|
||||
import com.volmit.iris.util.function.Consumer4;
|
||||
import com.volmit.iris.util.hunk.Hunk;
|
||||
@@ -148,7 +149,7 @@ public class IrisCarveModifier extends EngineAssignedModifier<BlockData> {
|
||||
int buf = v.get(0) - 1;
|
||||
|
||||
for(Integer i : v) {
|
||||
if(i < 0 || i > 255) {
|
||||
if(i < 0 || i > getEngine().getHeight()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -275,7 +276,7 @@ public class IrisCarveModifier extends EngineAssignedModifier<BlockData> {
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
return floor < ceiling && ceiling - floor >= 1 && floor >= 0 && ceiling <= 255 && airThickness() > 0;
|
||||
return floor < ceiling && ceiling - floor >= 1 && floor >= 0 && ceiling <= IrisContext.get().getEngine().getHeight() && airThickness() > 0;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
|
||||
@@ -101,7 +101,7 @@ public class IrisDepositModifier extends EngineAssignedModifier<BlockData> {
|
||||
|
||||
int i = Math.max(0, k.getMinHeight());
|
||||
// TODO: WARNING HEIGHT
|
||||
int a = Math.min(height, Math.min(256, k.getMaxHeight()));
|
||||
int a = Math.min(height, Math.min(getEngine().getHeight(), k.getMaxHeight()));
|
||||
|
||||
if(i >= a) {
|
||||
return;
|
||||
@@ -118,7 +118,7 @@ public class IrisDepositModifier extends EngineAssignedModifier<BlockData> {
|
||||
int ny = j.getBlockY() + h;
|
||||
int nz = j.getBlockZ() + z;
|
||||
|
||||
if(ny > height || nx > 15 || nx < 0 || ny > 255 || ny < 0 || nz < 0 || nz > 15) {
|
||||
if(ny > height || nx > 15 || nx < 0 || ny > getEngine().getHeight() || ny < 0 || nz < 0 || nz > 15) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -293,7 +293,7 @@ public class IrisBiome extends IrisRegistrant implements IRare {
|
||||
height += i.getHeight(xg, x, z, seed);
|
||||
}
|
||||
|
||||
return Math.max(0, Math.min(height, 255));
|
||||
return Math.max(0, Math.min(height, xg.getHeight()));
|
||||
}
|
||||
|
||||
public CNG getBiomeGenerator(RNG random) {
|
||||
@@ -448,7 +448,7 @@ public class IrisBiome extends IrisRegistrant implements IRare {
|
||||
}
|
||||
|
||||
for(int i = 0; i < maxDepth; i++) {
|
||||
int offset = (255 - height) - i;
|
||||
int offset = (512 - height) - i;
|
||||
int index = offset % data.size();
|
||||
real.add(data.get(Math.max(index, 0)));
|
||||
}
|
||||
|
||||
@@ -70,6 +70,10 @@ public class IrisDimension extends IrisRegistrant {
|
||||
@Required
|
||||
@Desc("The human readable name of this dimension")
|
||||
private String name = "A Dimension";
|
||||
@MinNumber(1)
|
||||
@MaxNumber(2032)
|
||||
@Desc("Maximum height at which players can be teleported to through gameplay.")
|
||||
private int logicalHeight = 256;
|
||||
@RegistryListResource(IrisJigsawStructure.class)
|
||||
@Desc("If defined, Iris will place the given jigsaw structure where minecraft should place the overworld stronghold.")
|
||||
private String stronghold;
|
||||
@@ -153,7 +157,7 @@ public class IrisDimension extends IrisRegistrant {
|
||||
private KList<IrisJigsawStructurePlacement> jigsawStructures = new KList<>();
|
||||
@Required
|
||||
@MinNumber(0)
|
||||
@MaxNumber(255)
|
||||
@MaxNumber(1024)
|
||||
@Desc("The fluid height for this dimension")
|
||||
private int fluidHeight = 63;
|
||||
@Desc("Define the min and max Y bounds of this dimension. Please keep in mind that Iris internally generates from 0 to (max - min). \n\nFor example at -64 to 320, Iris is internally generating to 0 to 384, then on outputting chunks, it shifts it down by the min height (64 blocks). The default is -64 to 320. \n\nThe fluid height is placed at (fluid height + min height). So a fluid height of 63 would actually show up in the world at 1.")
|
||||
@@ -238,13 +242,11 @@ public class IrisDimension extends IrisRegistrant {
|
||||
private int caveLavaHeight = 8;
|
||||
|
||||
public int getMaxHeight() {
|
||||
return 320;
|
||||
// return (int) getDimensionHeight().getMax();
|
||||
return (int) getDimensionHeight().getMax();
|
||||
}
|
||||
|
||||
public int getMinHeight() {
|
||||
return -64;
|
||||
// return (int) getDimensionHeight().getMin();
|
||||
return (int) getDimensionHeight().getMin();
|
||||
}
|
||||
|
||||
public BlockData generateOres(int x, int y, int z, RNG rng, IrisData data) {
|
||||
@@ -282,6 +284,10 @@ public class IrisDimension extends IrisRegistrant {
|
||||
});
|
||||
}
|
||||
|
||||
public int getFluidHeight() {
|
||||
return fluidHeight - (int)dimensionHeight.getMin();
|
||||
}
|
||||
|
||||
public CNG getCoordFracture(RNG rng, int signature) {
|
||||
return coordFracture.aquire(() ->
|
||||
{
|
||||
@@ -399,6 +405,20 @@ public class IrisDimension extends IrisRegistrant {
|
||||
}
|
||||
}
|
||||
|
||||
/* if(!dimensionHeight.equals(new IrisRange(-64, 320))) {
|
||||
File dimType = new File(datapacks, "iris/data/minecraft/dimension_type/" + getLoadKey().toLowerCase() + ".json");
|
||||
if(!dimType.exists())
|
||||
changed = true;
|
||||
|
||||
Iris.verbose(" Installing Data Pack Dimension Type: " + dimType.getPath());
|
||||
dimType.getParentFile().mkdirs();
|
||||
try {
|
||||
IO.writeAll(dimType, generateDatapackJson());
|
||||
} catch(IOException e) {
|
||||
Iris.reportError(e);
|
||||
e.printStackTrace();
|
||||
}*/
|
||||
|
||||
if(write) {
|
||||
File mcm = new File(datapacks, "iris/pack.mcmeta");
|
||||
try {
|
||||
@@ -406,7 +426,7 @@ public class IrisDimension extends IrisRegistrant {
|
||||
{
|
||||
"pack": {
|
||||
"description": "Iris Data Pack. This pack contains all installed Iris Packs' resources.",
|
||||
"pack_format": 7
|
||||
"pack_format": 9
|
||||
}
|
||||
}
|
||||
""");
|
||||
@@ -434,4 +454,30 @@ public class IrisDimension extends IrisRegistrant {
|
||||
public void scanForErrors(JSONObject p, VolmitSender sender) {
|
||||
|
||||
}
|
||||
|
||||
private String generateDatapackJson() {
|
||||
JSONObject obj = new JSONObject(DP_OVERWORLD_DEFAULT);
|
||||
obj.put("min_y", dimensionHeight.getMin());
|
||||
obj.put("height", dimensionHeight.getMax() - dimensionHeight.getMin());
|
||||
obj.put("logical_height", logicalHeight);
|
||||
return obj.toString(4);
|
||||
}
|
||||
|
||||
private static final String DP_OVERWORLD_DEFAULT = """
|
||||
{
|
||||
"name": "minecraft:overworld",
|
||||
"ultrawarm": false,
|
||||
"natural": true,
|
||||
"coordinate_scale": 1.0,
|
||||
"has_skylight": true,
|
||||
"has_ceiling": false,
|
||||
"ambient_light": 0,
|
||||
"fixed_time": false,
|
||||
"piglin_safe": false,
|
||||
"bed_works": true,
|
||||
"respawn_anchor_works": false,
|
||||
"has_raids": true,
|
||||
"infiniburn": "infiniburn_overworld",
|
||||
"effects": "minecraft:overworld"
|
||||
}""";
|
||||
}
|
||||
|
||||
@@ -128,6 +128,11 @@ public class IrisGeneratorStyle {
|
||||
return cng;
|
||||
}
|
||||
|
||||
public double warp(RNG rng, IrisData data, double value, double... coords)
|
||||
{
|
||||
return create(rng, data).noise(coords) + value;
|
||||
}
|
||||
|
||||
public CNG create(RNG rng, IrisData data) {
|
||||
return cng.aquire(() -> createNoCache(rng, data));
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package com.volmit.iris.engine.object;
|
||||
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.engine.data.cache.AtomicCache;
|
||||
import com.volmit.iris.engine.object.annotations.ArrayType;
|
||||
@@ -28,17 +29,22 @@ import com.volmit.iris.engine.object.annotations.RegistryListItemType;
|
||||
import com.volmit.iris.engine.object.annotations.Required;
|
||||
import com.volmit.iris.engine.object.annotations.Snippet;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.collection.KMap;
|
||||
import com.volmit.iris.util.data.B;
|
||||
import com.volmit.iris.util.format.C;
|
||||
import com.volmit.iris.util.format.Form;
|
||||
import com.volmit.iris.util.json.JSONObject;
|
||||
import com.volmit.iris.util.math.RNG;
|
||||
import com.volmit.iris.util.noise.CNG;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.TagParser;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_18_R2.inventory.CraftItemStack;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.Damageable;
|
||||
@@ -102,6 +108,8 @@ public class IrisLoot {
|
||||
private DyeColor dyeColor = null;
|
||||
@Desc("The leather armor color")
|
||||
private String leatherColor = null;
|
||||
@Desc("Defines a custom NBT Tag for the item.")
|
||||
private KMap<String, Object> customNbt;
|
||||
|
||||
public Material getType() {
|
||||
return B.getMaterial(type);
|
||||
@@ -173,7 +181,7 @@ public class IrisLoot {
|
||||
}
|
||||
|
||||
is.setItemMeta(m);
|
||||
return is;
|
||||
return applyCustomNbt(is);
|
||||
} catch(Throwable e) {
|
||||
Iris.reportError(e);
|
||||
|
||||
@@ -250,13 +258,22 @@ public class IrisLoot {
|
||||
|
||||
m.setLore(lore);
|
||||
is.setItemMeta(m);
|
||||
return is;
|
||||
return applyCustomNbt(is);
|
||||
} catch(Throwable e) {
|
||||
Iris.reportError(e);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private ItemStack applyCustomNbt(ItemStack stack) throws CommandSyntaxException {
|
||||
if(customNbt == null || customNbt.isEmpty())
|
||||
return stack;
|
||||
net.minecraft.world.item.ItemStack s = CraftItemStack.asNMSCopy(stack);
|
||||
CompoundTag tag = TagParser.parseTag(new JSONObject(customNbt).toString());
|
||||
tag.merge(s.getOrCreateTag());
|
||||
s.setTag(tag);
|
||||
return CraftItemStack.asBukkitCopy(s);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,12 +35,12 @@ import lombok.experimental.Accessors;
|
||||
@Data
|
||||
public class IrisObjectLimit {
|
||||
@MinNumber(0)
|
||||
@MaxNumber(255)
|
||||
@MaxNumber(1024)
|
||||
@Desc("The minimum height for placement (bottom of object)")
|
||||
private int minimumHeight = 0;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(255)
|
||||
@MaxNumber(1024)
|
||||
@Desc("The maximum height for placement (top of object)")
|
||||
private int maximumHeight = 255;
|
||||
|
||||
|
||||
@@ -35,12 +35,12 @@ import lombok.experimental.Accessors;
|
||||
@Data
|
||||
public class IrisSlopeClip {
|
||||
@MinNumber(0)
|
||||
@MaxNumber(255)
|
||||
@MaxNumber(1024)
|
||||
@Desc("The minimum slope for placement")
|
||||
private double minimumSlope = 0;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(255)
|
||||
@MaxNumber(1024)
|
||||
@Desc("The maximum slope for placement")
|
||||
private double maximumSlope = 10;
|
||||
|
||||
|
||||
@@ -21,18 +21,18 @@ package com.volmit.iris.util.data;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class HeightMap {
|
||||
private final byte[] height;
|
||||
private final int[] height;
|
||||
|
||||
public HeightMap() {
|
||||
height = new byte[256];
|
||||
Arrays.fill(height, Byte.MIN_VALUE);
|
||||
height = new int[256];
|
||||
Arrays.fill(height, 0);
|
||||
}
|
||||
|
||||
public void setHeight(int x, int z, int h) {
|
||||
height[x * 16 + z] = (byte) (h + Byte.MIN_VALUE);
|
||||
height[x * 16 + z] = (h);
|
||||
}
|
||||
|
||||
public int getHeight(int x, int z) {
|
||||
return height[x * 16 + z] - Byte.MIN_VALUE;
|
||||
return height[x * 16 + z];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ package com.volmit.iris.util.mantle;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.IrisSettings;
|
||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||
import com.volmit.iris.engine.data.cache.Cache;
|
||||
import com.volmit.iris.engine.framework.Engine;
|
||||
import com.volmit.iris.engine.mantle.EngineMantle;
|
||||
@@ -570,6 +571,11 @@ public class Mantle {
|
||||
}
|
||||
|
||||
public void deleteChunkSlice(int x, int z, Class<?> c) {
|
||||
if(!IrisToolbelt.toolbeltConfiguration.isEmpty() && IrisToolbelt.toolbeltConfiguration.getOrDefault("retain.mantle." + c.getCanonicalName(), false))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
getChunk(x, z).deleteSlices(c);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,8 @@ public enum MantleFlag {
|
||||
FLUID_BODIES,
|
||||
INITIAL_SPAWNED_MARKER,
|
||||
CLEANED,
|
||||
PLANNED;
|
||||
PLANNED,
|
||||
ETCHED;
|
||||
|
||||
static StateList getStateList() {
|
||||
return new StateList(MantleFlag.values());
|
||||
|
||||
@@ -29,6 +29,7 @@ import java.io.IOException;
|
||||
@Sliced
|
||||
public class CavernMatter extends RawMatter<MatterCavern> {
|
||||
public static final MatterCavern EMPTY = new MatterCavern(false, "", (byte) 0);
|
||||
public static final MatterCavern BASIC = new MatterCavern(true, "", (byte) 0);
|
||||
|
||||
public CavernMatter() {
|
||||
this(1, 1, 1);
|
||||
|
||||
Reference in New Issue
Block a user