Compare commits

...

39 Commits

Author SHA1 Message Date
Brian Fopiano
5b3918fcb1 Merge pull request #782 from VolmitSoftware/Development
Development
2022-04-13 16:49:22 -07:00
cyberpwn
d315e99b63 Drop oraxen support 2022-04-13 19:17:25 -04:00
cyberpwn
8090ba0259 Fix object placement 2022-04-13 19:11:31 -04:00
cyberpwn
584400d011 Revert "This is to prevent warnings for weird objects, (revert)"
This reverts commit 124ad23a95.
2022-04-13 18:50:08 -04:00
cyberpwn
124ad23a95 This is to prevent warnings for weird objects, (revert) 2022-04-13 18:47:31 -04:00
cyberpwn
6b59aa38ae Allow terrain to use the world height 2022-04-13 18:46:19 -04:00
Brian Fopiano
03554eb372 Merge pull request #778 from VolmitSoftware/Development
Development
2022-04-03 01:41:16 -07:00
Brian Fopiano
dabfe41f29 Merge branch 'master' into Development 2022-04-03 01:40:24 -07:00
Brian Fopiano
6e2c6fc51e V+ 2022-04-03 01:36:31 -07:00
Brian Fopiano
d81986bcc5 255 & no more flying objects
lol why does this happen
2022-04-03 01:34:43 -07:00
Brian Fopiano
ea17e916b8 Gradle updates 2022-04-02 14:14:59 -07:00
Brian Fopiano
ce56224038 Merge pull request #777 from Vatuu/Development
Fixed MythicMobs api change
2022-04-02 13:11:13 -07:00
Vatuu
9978932391 Fixed MythicMobs api change 2022-04-02 22:03:27 +02:00
Brian Fopiano
2ebc9e0deb V+
2.0.3-1.18.2
2022-03-27 18:06:00 -07:00
Brian Fopiano
7ddc621009 Merge pull request #769 from VolmitSoftware/Development
Updated PAPI Support
Temp Disabled Oraxen Support
Temp Disabled Ascync Tp
updated NMS (Colors and binds etc...)
Fixed my registry oopsie (thx Vatuu)
removed Debug Prints
/iris Height works now
Colors Fixed
2022-03-27 13:51:27 -07:00
cyberpwn
aa4e574eef Fix 1.18.2 Biomes 2022-03-27 14:42:13 -04:00
Brian Fopiano
15bc964fcc Ascync tp is disabled for now
Ascync TP is done in 1.18 already, and this is just a dirty fix to stop crashing/ lol
2022-03-18 16:05:38 -07:00
Brian Fopiano
99713ac964 Need to be version specific now 2022-03-18 15:18:35 -07:00
Brian Fopiano
f9a6bd1343 Readding Oraxen Link for Texting 2022-03-17 14:52:40 -07:00
Brian Fopiano
f4bee872e1 Merge pull request #768 from Vatuu/Development
Fixes
2022-03-17 14:49:13 -07:00
Vatuu
be99b286b3 Fixed Brian's mistake. 2022-03-17 22:43:59 +01:00
Brian Fopiano
c7d5212f82 Oraxen link, and NMS WORKING, but not working
Jar loads, Color Borked, ill look at it tomorrow
2022-03-17 00:46:42 -07:00
Brian Fopiano
75726b3d34 Updating PAPI 2022-03-17 00:37:03 -07:00
Brian Fopiano
8d7e76ed81 Attempting to update NMS
(Part 1 of ...)
2022-03-17 00:36:49 -07:00
Brian Fopiano
01b08b2297 Revert "Partial For Vatuu to look at NMS"
This reverts commit cf51581ac1.
2022-03-16 19:38:17 -07:00
Brian Fopiano
cf51581ac1 Partial For Vatuu to look at NMS 2022-03-16 19:31:43 -07:00
Brian Fopiano
d99fd56995 Debug/height fixed/removed
Small fixes.
2022-03-15 22:18:22 -07:00
Vatuu
d149051c27 Fixed wrong description for /iris height. 2022-03-14 18:22:04 +01:00
Vatuu
660aaa87ca Removed debug printout. 2022-03-14 18:20:04 +01:00
DanMB
4010f03b05 ff 2022-03-14 09:52:23 -07:00
DanMB
e2d2dcf337 f 2022-03-14 09:47:57 -07:00
DanMB
b11aaf3f0c Desperate times 2022-03-14 09:27:50 -07:00
DanMB
30ae065cb4 Drop 255 hardcode checks 2022-03-14 09:26:31 -07:00
Brian Fopiano
7f5b0559aa V+ 2022-03-12 15:52:14 -08:00
Brian Fopiano
851954efb2 Merge pull request #763 from VolmitSoftware/Development
Development Changes (WIP)
2022-03-12 15:50:44 -08:00
Brian Fopiano
b8c6a459a6 Merge pull request #761 from Vatuu/Development
Worldheight preperations and absolute fluid height
2022-03-11 16:07:02 -08:00
Vatuu
4523089440 Added customNbt property to IrisLoot objects. 2022-03-12 01:05:28 +01:00
Vatuu
217fe47878 Made fluidHeight in dimension config refer to a static y value. 2022-03-09 23:05:33 +01:00
Vatuu
525e3db24a Working on supporting custom heights per world. 2022-03-09 22:42:20 +01:00
24 changed files with 162 additions and 206 deletions

View File

@@ -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.4-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,9 @@ 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 'io.th0rgal:oraxen:1.94.0'
implementation 'org.bukkit:craftbukkit:1.18.1-R0.1-SNAPSHOT:remapped-mojang'
implementation 'org.spigotmc:spigot-api:1.18.2-R0.1-SNAPSHOT'
implementation 'me.clip:placeholderapi:2.11.1'
implementation 'org.bukkit:craftbukkit:1.18.2-R0.1-SNAPSHOT:remapped-mojang'
// Shaded
implementation 'com.dfsek:Paralithic:0.4.0'
@@ -137,15 +135,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'
}

View File

@@ -23,7 +23,6 @@ import com.volmit.iris.core.ServerConfigurator;
import com.volmit.iris.core.link.IrisPapiExpansion;
import com.volmit.iris.core.link.MultiverseCoreLink;
import com.volmit.iris.core.link.MythicMobsLink;
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;
@@ -65,7 +64,6 @@ import org.bukkit.World;
import org.bukkit.WorldCreator;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
@@ -95,7 +93,6 @@ public class Iris extends VolmitPlugin implements Listener {
public static Iris instance;
public static BukkitAudiences audiences;
public static MultiverseCoreLink linkMultiverseCore;
public static OraxenLink linkOraxen;
public static MythicMobsLink linkMythicMobs;
public static IrisCompat compat;
public static FileWatcher configWatcher;
@@ -401,7 +398,6 @@ public class Iris extends VolmitPlugin implements Listener {
instance = this;
compat = IrisCompat.configured(getDataFile("compat.json"));
linkMultiverseCore = new MultiverseCoreLink();
linkOraxen = new OraxenLink();
linkMythicMobs = new MythicMobsLink();
configWatcher = new FileWatcher(getDataFile("settings.json"));
services.values().forEach(IrisService::onEnable);

View File

@@ -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()));

View File

@@ -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);

View File

@@ -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");

View File

@@ -1,113 +0,0 @@
/*
* 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 <https://www.gnu.org/licenses/>.
*/
package com.volmit.iris.core.link;
import com.volmit.iris.util.collection.KList;
import io.th0rgal.oraxen.items.OraxenItems;
import io.th0rgal.oraxen.mechanics.Mechanic;
import io.th0rgal.oraxen.mechanics.MechanicFactory;
import io.th0rgal.oraxen.mechanics.MechanicsManager;
import io.th0rgal.oraxen.mechanics.provided.gameplay.block.BlockMechanic;
import io.th0rgal.oraxen.mechanics.provided.gameplay.block.BlockMechanicFactory;
import io.th0rgal.oraxen.mechanics.provided.gameplay.noteblock.NoteBlockMechanicFactory;
import io.th0rgal.oraxen.utils.Utils;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.MultipleFacing;
import org.bukkit.plugin.Plugin;
import java.lang.reflect.Field;
import java.util.Map;
public class OraxenLink {
private static final String[] EMPTY = new String[0];
public boolean supported() {
return getOraxen() != null;
}
public BlockData getBlockDataFor(String id) {
if(!supported()) {
return null;
}
MechanicFactory f = getFactory(id);
if(f == null) {
return null;
}
Mechanic m = f.getMechanic(id);
// TODO: Why isnt there a simple getBlockData() function?
if(m.getFactory() instanceof NoteBlockMechanicFactory) {
return ((NoteBlockMechanicFactory) m.getFactory()).createNoteBlockData(id);
} else if(m.getFactory() instanceof BlockMechanicFactory) {
MultipleFacing newBlockData = (MultipleFacing) Bukkit.createBlockData(Material.MUSHROOM_STEM);
Utils.setBlockFacing(newBlockData, ((BlockMechanic) m).getCustomVariation());
return newBlockData;
}
return null;
}
public MechanicFactory getFactory(String id) {
if(!supported()) {
return null;
}
try {
Field f = MechanicsManager.class.getDeclaredField("FACTORIES_BY_MECHANIC_ID");
f.setAccessible(true);
Map<String, MechanicFactory> map = (Map<String, MechanicFactory>) f.get(null);
for(MechanicFactory i : map.values()) {
if(i.getItems().contains(id)) {
return i;
}
}
} catch(Throwable e) {
e.printStackTrace();
}
return null;
}
public String[] getItemTypes() {
if(!supported()) {
return EMPTY;
}
KList<String> v = new KList<>();
for(String i : OraxenItems.getItemNames()) {
if(getBlockDataFor(i) != null) {
v.add(i);
}
}
return v.toArray(new String[0]);
}
public Plugin getOraxen() {
return Bukkit.getPluginManager().getPlugin("Oraxen");
}
}

View File

@@ -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();

View File

@@ -54,6 +54,7 @@ public interface INMSBinding {
String getTrueBiomeBaseKey(Location location);
Object getCustomBiomeBaseFor(String mckey);
Object getCustomBiomeBaseHolderFor(String mckey);
String getKeyForBiomeBase(Object biomeBase);

View File

@@ -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;
}

View File

@@ -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();

View File

@@ -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;

View File

@@ -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) {

View File

@@ -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!");

View File

@@ -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;

View File

@@ -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) {

View File

@@ -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() {

View File

@@ -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;
}

View File

@@ -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)));
}

View File

@@ -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"
}""";
}

View File

@@ -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);
}
}

View File

@@ -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;

View File

@@ -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;

View File

@@ -462,10 +462,6 @@ public class B {
BlockData bx = null;
if(!ix.startsWith("minecraft:")) {
if(ix.startsWith("oraxen:") && Iris.linkOraxen.supported()) {
bx = Iris.linkOraxen.getBlockDataFor(ix.split("\\Q:\\E")[1]);
}
if(bx == null) {
try {
if(ix.contains(":")) {
@@ -652,14 +648,6 @@ public class B {
}
}
try {
for(String i : Iris.linkOraxen.getItemTypes()) {
bt.add("oraxen:" + i);
}
} catch(Throwable e) {
e.printStackTrace();
}
try {
bt.addAll(Iris.service(RegistrySVC.class).getCustomBlockRegistry().compile());
} catch(Throwable e) {

View File

@@ -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];
}
}