9
0
mirror of https://github.com/VolmitSoftware/Iris.git synced 2025-12-26 18:49:06 +00:00

Compare commits

..

54 Commits

Author SHA1 Message Date
Brian Neumann-Fopiano
6ebcd02ae6 Fixed the pregen error! 2023-04-08 00:26:05 -04:00
Brian Fopiano
051015656a Merge pull request #986 from CocoTheOwner/re-slope-condition
Patches an issue with slope conditions when placing with commands
2023-04-04 14:00:19 -04:00
Sjoerd van de Goor
ee082762c6 Update object placer to ignore some stuff when using commands 2023-04-03 21:22:08 +02:00
Brian Fopiano
e967b5e052 Merge pull request #982 from CocoTheOwner/re-slope-condition
Reimplement slope condition
2023-04-02 15:39:42 -04:00
Brian Neumann-Fopiano
36505e2fa1 forgot v+ 2023-04-02 15:19:58 -04:00
Vatuu
502aa054f6 🧌 Fixed Color and Seed Issue. 2023-04-02 21:10:44 +02:00
Sjoerd van de Goor
cc5a880fd7 reimplement slope condition 2023-03-29 21:36:18 +02:00
Vatuu
6f9ad8b0eb Update to 1.19.4 2023-03-27 23:24:58 +02:00
Vatuu
ac6ab74d48 🧌 CustomItems support is pretty scuffed. Make it a gradle dependency already. 2023-03-27 23:22:15 +02:00
Brian Neumann-Fopiano
807ed2b247 gradelized patch
I'm not including this until it can be gradle-ized for sake of public compilation
2023-03-16 14:10:32 -04:00
Brian Neumann-Fopiano
367de5a8fd v+ 2023-03-16 14:03:54 -04:00
Vatuu
5bf2da714a Whoops. 2023-03-13 19:28:02 +01:00
Vatuu
cc90f42deb Implement CustomItems support. 2023-03-13 13:19:37 +01:00
Vatuu
20ceaead09 Fixed Oraxen and IA Integration. 2023-03-10 19:08:46 +01:00
Brian Fopiano
3ec2f8fb7b Merge pull request #962 from CocoTheOwner/render-continent-v2
Replace continent renderer with biomeStream
2023-03-05 19:18:54 -05:00
Brian Fopiano
6c5fac154e Merge pull request #975 from CocoTheOwner/mm-fix
Fixed mythicmobs and implements it properly.
2023-03-05 19:18:10 -05:00
Sjoerd van de Goor
540ab8f0d2 If special then unknown default should still be skipped 2023-03-03 23:57:37 +01:00
Brian Fopiano
17d2ac8d70 Merge pull request #973 from CocoTheOwner/spawn-entity
Entity spawn command for testing
2023-03-03 14:38:23 -08:00
Brian Fopiano
a6ebdead19 Merge pull request #966 from CocoTheOwner/update-world-nice
nicer command :)
2023-03-03 14:37:31 -08:00
Brian Fopiano
aa7631ecd0 Merge pull request #974 from CocoTheOwner/copypastafix
Fix copy paste of string gone wrong
2023-03-03 14:37:04 -08:00
Sjoerd van de Goor
4e138cad9f Why 2023-03-03 23:23:19 +01:00
Sjoerd van de Goor
7e55b5fcee Import MM 2023-03-03 23:23:15 +01:00
Sjoerd van de Goor
e19e5278b4 shouldve seen that, oops. 2023-03-03 23:01:09 +01:00
Sjoerd van de Goor
dfcd2dc83e lol 2023-03-03 21:59:42 +01:00
Sjoerd van de Goor
8775f842e6 Spawn command 2023-03-03 21:57:13 +01:00
Sjoerd van de Goor
7b07a4ba6c Location context needed to spawn entities 2023-03-03 21:56:33 +01:00
Sjoerd van de Goor
d78e5973e9 nicer command :) 2023-02-23 19:13:14 +01:00
CocoTheOwner
110d296184 Replace bridge with stream used in /ir what biome 2023-02-17 11:51:27 +01:00
CocoTheOwner
23cd5c117b Replace continent renderer with bridgeStream 2023-02-17 11:25:26 +01:00
CocoTheOwner
131c4692bc Remove DEFER from InferredType
Unused
2023-02-17 11:25:10 +01:00
Brian Neumann-Fopiano
f6571367db v+ oops 2023-02-15 18:41:17 -05:00
Brian Fopiano
f5c64c7480 Merge pull request #960 from CocoTheOwner/render-continent
Continent (i.e. heightmap + ocean/land division) render
2023-02-15 14:47:14 -08:00
Brian Fopiano
085f63a915 Merge pull request #961 from CocoTheOwner/slopes-rotation
Implements slope rotation
2023-02-15 14:46:48 -08:00
Brian Fopiano
3e022e1931 Merge pull request #954 from CocoTheOwner/slopes
Slope condition
2023-02-15 14:46:28 -08:00
Brian Fopiano
0dba3725ae Merge pull request #953 from CocoTheOwner/mm-set-stuff
MM should set its own stuff
2023-02-15 14:44:42 -08:00
Brian Fopiano
8bb409df4e Merge pull request #952 from CocoTheOwner/fix-image-math
Fix image mapping math
2023-02-15 14:44:09 -08:00
Brian Fopiano
603168a147 Merge pull request #951 from CocoTheOwner/fix-decree-conv
Actually check for origin on command invoke
2023-02-15 14:42:57 -08:00
Sjoerd van de Goor
2a95edd860 further documentation and cleaner code 2023-02-15 14:14:26 +01:00
Sjoerd van de Goor
e94406fb45 Implement rotation, remove precise rotation. 2023-02-15 14:05:34 +01:00
Sjoerd van de Goor
e5a7b5d0c6 Reformulate todo 2023-02-15 13:12:34 +01:00
Sjoerd van de Goor
d6f816fe2f Flipped water / land 2023-02-15 13:00:13 +01:00
Sjoerd van de Goor
c15d4a349f map to 255 range 2023-02-15 12:55:43 +01:00
Sjoerd van de Goor
3ce832583c Continent (i.e. heightmap + ocean/land division) render 2023-02-15 12:49:20 +01:00
Sjoerd van de Goor
5514fd2645 Proper ordering 2023-02-08 01:51:39 +01:00
Sjoerd van de Goor
66d07dcaca Revert "Slope condition"
This reverts commit d4c0e07b1d.
2023-02-08 01:35:18 +01:00
Sjoerd van de Goor
c1cf8e88ee That is pretty necessary 2023-02-08 01:33:31 +01:00
Sjoerd van de Goor
684bd739b9 Slope rotation (unfinished) 2023-02-08 01:30:12 +01:00
Sjoerd van de Goor
d4c0e07b1d Slope condition 2023-02-08 01:29:30 +01:00
Sjoerd van de Goor
a6ea6fcfb2 better 2023-02-07 17:39:44 +01:00
Sjoerd van de Goor
c366ec0c40 MM should set its own stuff 2023-02-07 17:26:06 +01:00
CocoTheOwner
8d715e2e4e x != z 2023-02-06 15:43:27 +01:00
CocoTheOwner
dea3ec80ac Fix image mapping math
Fixes snippet code, prevents an NPE, fixes centered for coordinateScale scaled image noises, fixes tiling on negative numbers (-1 % 2 = -1, a free fuck you from java)
2023-02-06 15:39:28 +01:00
CocoTheOwner
4053f05ba9 Actually check for origin on command invoke 2023-02-06 14:58:17 +01:00
Brian Neumann-Fopiano
ef07ec2c62 Datapack Shenanigans 2023-02-04 14:38:30 -05:00
46 changed files with 726 additions and 288 deletions

1
.gitignore vendored
View File

@@ -1,5 +1,6 @@
build/
libs/
.gradle/

View File

@@ -24,11 +24,11 @@ plugins {
id "de.undercouch.download" version "5.0.1"
}
version '2.3.13-1.19.3' // Needs to be version specific
def nmsVersion = "1.19.3" //[NMS]
version '2.5.1-1.19.4'
def nmsVersion = "1.19.4" //[NMS]
def apiVersion = '1.19'
def specialSourceVersion = '1.11.0' //[NMS]
def spigotJarVersion = '1.19.3-R0.1-SNAPSHOT' //[NMS]
def spigotJarVersion = '1.19.4-R0.1-SNAPSHOT' //[NMS]
def name = getRootProject().getName() // Defined in settings.gradle
def main = 'com.volmit.iris.Iris'
@@ -37,9 +37,9 @@ def main = 'com.volmit.iris.Iris'
registerCustomOutputTask('Cyberpwn', 'C://Users/cyberpwn/Documents/development/server/plugins')
registerCustomOutputTask('Psycho', 'C://Dan/MinecraftDevelopment/Server/plugins')
registerCustomOutputTask('ArcaneArts', 'C://Users/arcane/Documents/development/server/plugins')
registerCustomOutputTask('Coco', 'D://Documents/MC/plugins')
registerCustomOutputTask('Coco', 'D://mcsm/plugins')
registerCustomOutputTask('Strange', 'D://Servers/1.17 Test Server/plugins')
registerCustomOutputTask('Vatuu', 'D://Minecraft/Servers/1.19.3/plugins')
registerCustomOutputTask('Vatuu', 'D://Minecraft/Servers/1.19.4/plugins')
// ========================== UNIX ==============================
registerCustomOutputTaskUnix('CyberpwnLT', '/Users/danielmills/development/server/plugins')
registerCustomOutputTaskUnix('PsychoLT', '/Users/brianfopiano/Desktop/REMOTES/RemoteMinecraft/plugins')
@@ -74,8 +74,15 @@ repositories {
includeGroup("org.spigotmc")
}
}
mavenCentral()
maven { url "https://arcanearts.jfrog.io/artifactory/archives" }
maven { url "https://mvn.lumine.io/repository/maven-public/" }
maven { url "https://jitpack.io"}
maven { url "https://s01.oss.sonatype.org/content/repositories/snapshots" }
maven { url "https://mvn.lumine.io/repository/maven/" }
maven { url "https://repo.triumphteam.dev/snapshots" }
maven { url "https://repo.mineinabyss.com/releases" }
}
/**
@@ -122,11 +129,14 @@ 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.3-R0.1-SNAPSHOT'
implementation 'org.spigotmc:spigot-api:1.19.4-R0.1-SNAPSHOT'
implementation 'org.bukkit:craftbukkit:1.19.4-R0.1-SNAPSHOT:remapped-mojang' //[NMS]
// Third Party Integrations
implementation 'com.github.oraxen:oraxen:1.152.5'
implementation 'com.github.LoneDev6:api-itemsadder:3.2.5'
implementation 'me.clip:placeholderapi:2.11.1'
implementation 'io.th0rgal:oraxen:1.94.0'
implementation 'org.bukkit:craftbukkit:1.19.3-R0.1-SNAPSHOT:remapped-mojang' //[NMS]
implementation 'com.github.LoneDev6:api-itemsadder:3.1.0b'
//implementation files('libs/CustomItems.jar')
// Shaded
implementation 'com.dfsek:Paralithic:0.4.0'
@@ -134,6 +144,7 @@ dependencies {
implementation "net.kyori:adventure-text-minimessage:4.11.0"
implementation 'net.kyori:adventure-platform-bukkit:4.1.0'
implementation 'net.kyori:adventure-api:4.11.0'
implementation 'io.lumine:Mythic-Dist:5.2.1'
// Dynamically Loaded
implementation 'io.timeandspace:smoothie-map:2.0.2'

View File

@@ -28,7 +28,7 @@ import com.volmit.iris.core.link.MultiverseCoreLink;
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_3.NMSBinding19_3;
import com.volmit.iris.core.nms.v19_4.NMSBinding19_4;
import com.volmit.iris.core.pregenerator.LazyPregenerator;
import com.volmit.iris.core.service.StudioSVC;
import com.volmit.iris.core.tools.IrisToolbelt;
@@ -66,6 +66,7 @@ import org.bukkit.*;
import org.bukkit.block.data.BlockData;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
@@ -87,7 +88,7 @@ import java.util.Map;
@SuppressWarnings("CanBeFinal")
public class Iris extends VolmitPlugin implements Listener {
public static final String OVERWORLD_TAG = "2092";
public static final String OVERWORLD_TAG = "2100";
private static final Queue<Runnable> syncJobs = new ShurikenQueue<>();
@@ -301,8 +302,8 @@ public class Iris extends VolmitPlugin implements Listener {
msg(C.IRIS + string);
}
public static void info(String string) {
msg(C.WHITE + string);
public static void info(String format, Object... args) {
msg(C.WHITE + String.format(format, args));
}
@SuppressWarnings("deprecation")
@@ -462,33 +463,38 @@ public class Iris extends VolmitPlugin implements Listener {
FileConfiguration fc = new YamlConfiguration();
try {
fc.load(new File("bukkit.yml"));
searching:
for (String i : fc.getKeys(true)) {
if (i.startsWith("worlds.") && i.endsWith(".generator")) {
String worldName = i.split("\\Q.\\E")[1];
String generator = IrisSettings.get().getGenerator().getDefaultWorldType();
if (fc.getString(i).startsWith("Iris:")) {
generator = fc.getString(i).split("\\Q:\\E")[1];
} else if (fc.getString(i).equals("Iris")) {
generator = IrisSettings.get().getGenerator().getDefaultWorldType();
} else {
continue;
}
ConfigurationSection section = fc.getConfigurationSection("worlds");
if(section == null) {
return;
}
for (World j : Bukkit.getWorlds()) {
if (j.getName().equals(worldName)) {
continue searching;
}
}
Iris.warn("Detected an Iris World in the bukkit yml '" + worldName + "' using Iris that was not loaded by bukkit. Good Guy Iris will load it up for you!");
Iris.info(C.LIGHT_PURPLE + "Preparing Spawn for " + worldName + "' using Iris:" + generator);
World world = new WorldCreator(worldName)
.generator(getDefaultWorldGenerator(worldName, generator))
.environment(IrisData.loadAnyDimension(generator).getEnvironment())
.createWorld();
Iris.info(C.LIGHT_PURPLE + "Loaded " + worldName + "!");
for(String s : section.getKeys(false)){
ConfigurationSection entry = section.getConfigurationSection(s);
if(!entry.contains("generator", true)) {
continue;
}
String generator = entry.getString("generator");
if(generator.startsWith("Iris:")) {
generator = generator.split("\\Q:\\E")[1];
} else if(generator.equalsIgnoreCase("Iris")) {
generator = IrisSettings.get().getGenerator().getDefaultWorldType();
} else {
continue;
}
Iris.info("2 World: %s | Generator: %s", s, generator);
if(Bukkit.getWorlds().stream().anyMatch(w -> w.getName().equals(s))) {
continue;
}
Iris.info(C.LIGHT_PURPLE + "Preparing Spawn for " + s + "' using Iris:" + generator + "...");
new WorldCreator(s)
.generator(getDefaultWorldGenerator(s, generator))
.environment(IrisData.loadAnyDimension(generator).getEnvironment())
.createWorld();
Iris.info(C.LIGHT_PURPLE + "Loaded " + s + "!");
}
} catch (Throwable e) {
e.printStackTrace();
@@ -570,13 +576,13 @@ public class Iris extends VolmitPlugin implements Listener {
private boolean setupChecks() {
boolean passed = true;
Iris.info("Version Information: " + instance.getServer().getVersion() + " | " + instance.getServer().getBukkitVersion());
if (!instance.getServer().getBukkitVersion().contains(NMSBinding19_3.NMS_VERSION)) {
if (!instance.getServer().getBukkitVersion().contains(NMSBinding19_4.NMS_VERSION)) {
passed = false;
Iris.warn("============================================");
Iris.warn("=");
Iris.warn("=");
Iris.warn("=");
Iris.warn("Iris is not compatible with this version of Minecraft.\nPlease use " + NMSBinding19_3.NMS_VERSION + " or use an older version of Iris.");
Iris.warn("Iris is not compatible with this version of Minecraft.\nPlease use " + NMSBinding19_4.NMS_VERSION + " or use an older version of Iris.");
Iris.warn("=");
Iris.warn("=");
Iris.warn("=");

View File

@@ -24,6 +24,7 @@ import com.volmit.iris.core.service.StudioSVC;
import com.volmit.iris.core.tools.IrisToolbelt;
import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.engine.object.IrisDimension;
import com.volmit.iris.engine.object.IrisEntity;
import com.volmit.iris.engine.platform.PlatformChunkGenerator;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.decree.DecreeContext;
@@ -40,7 +41,9 @@ import com.volmit.iris.util.scheduling.J;
import com.volmit.iris.util.scheduling.jobs.QueueJob;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.util.Vector;
import java.io.File;
import java.io.IOException;
@@ -325,7 +328,7 @@ public class CommandIris implements DecreeExecutor {
C.YELLOW + " - Caves not lining up",
C.YELLOW + " - Terrain layers not lining up",
C.RED + "Now that you are aware of the risks, and have made a back-up:",
C.RED + "/iris ^world <world> <pack> confirm=true"
C.RED + "/iris ^world " + world.getName() + " " + pack.getLoadKey() + " confirm=true"
});
return;
}

View File

@@ -464,19 +464,16 @@ public class CommandStudio implements DecreeExecutor {
sender().sendMessage(C.GREEN + "Done! " + report.getPath());
}
@Decree(description = "Summon an Iris Entity", origin = DecreeOrigin.PLAYER)
public void summon(
@Param(description = "The Iris Entity to spawn")
@Decree(description = "Spawn an Iris entity", aliases = "summon", origin = DecreeOrigin.PLAYER)
public void spawn(
@Param(description = "The entity to spawn")
IrisEntity entity,
@Param(description = "The location at which to spawn the entity", defaultValue = "self")
@Param(description = "The location to spawn the entity at", contextual = true)
Vector location
) {
if (!sender().isPlayer()) {
sender().sendMessage(C.RED + "Players only (this is a config error. Ask support to add DecreeOrigin.PLAYER to the command you tried to run)");
return;
if (!IrisToolbelt.isIrisWorld(player().getWorld())) {
sender().sendMessage(C.RED + "You have to be in an Iris world to spawn entities properly. Trying to spawn the best we can do.");
}
sender().sendMessage(C.GREEN + "Spawning entity");
entity.spawn(engine(), new Location(world(), location.getX(), location.getY(), location.getZ()));
}

View File

@@ -19,6 +19,8 @@
package com.volmit.iris.core.gui.components;
import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.engine.object.IrisBiome;
import com.volmit.iris.engine.object.IrisBiomeGeneratorLink;
import com.volmit.iris.util.interpolation.IrisInterpolation;
import java.awt.*;
@@ -49,6 +51,23 @@ public class IrisRenderer {
colorFunction = (x, z) -> renderer.getComplex().getCaveBiomeStream().get(x, z).getColor(renderer, currentType).getRGB();
case HEIGHT ->
colorFunction = (x, z) -> Color.getHSBColor(renderer.getComplex().getHeightStream().get(x, z).floatValue(), 100, 100).getRGB();
case CONTINENT ->
colorFunction = (x, z) -> {
IrisBiome b = renderer.getBiome((int) Math.round(x), renderer.getMaxHeight() - 1, (int) Math.round(z));
IrisBiomeGeneratorLink g = b.getGenerators().get(0);
Color c;
if (g.getMax() <= 0) {
// Max is below water level, so it is most likely an ocean biome
c = Color.BLUE;
} else if (g.getMin() < 0) {
// Min is below water level, but max is not, so it is most likely a shore biome
c = Color.YELLOW;
} else {
// Both min and max are above water level, so it is most likely a land biome
c = Color.GREEN;
}
return c.getRGB();
};
}
double x, z;

View File

@@ -19,5 +19,5 @@
package com.volmit.iris.core.gui.components;
public enum RenderType {
BIOME, BIOME_LAND, BIOME_SEA, REGION, CAVE_LAND, HEIGHT, OBJECT_LOAD, DECORATOR_LOAD, LAYER_LOAD
BIOME, BIOME_LAND, BIOME_SEA, REGION, CAVE_LAND, HEIGHT, OBJECT_LOAD, DECORATOR_LOAD, CONTINENT, LAYER_LOAD
}

View File

@@ -0,0 +1,102 @@
//package com.volmit.iris.core.link;
//
//import com.jojodmo.customitems.api.CustomItemsAPI;
//import com.jojodmo.customitems.item.custom.CustomItem;
//import com.jojodmo.customitems.item.custom.block.CustomMushroomBlock;
//import com.jojodmo.customitems.version.SafeMaterial;
//import com.volmit.iris.util.collection.KList;
//import com.volmit.iris.util.reflect.WrappedField;
//import com.volmit.iris.util.reflect.WrappedReturningMethod;
//import org.bukkit.block.BlockFace;
//import org.bukkit.block.data.BlockData;
//import org.bukkit.block.data.MultipleFacing;
//import org.bukkit.inventory.ItemStack;
//
//import java.util.Map;
//import java.util.MissingResourceException;
//
//public class CustomItemsDataProvider extends ExternalDataProvider {
//
// private static final String FIELD_FACES = "faces";
// private static final String METHOD_GET_MATERIAL = "getMaterial";
//
// private WrappedField<CustomMushroomBlock, Map<Integer, boolean[]>> mushroomFaces;
// private WrappedReturningMethod<CustomMushroomBlock, SafeMaterial> mushroomMaterial;
//
// public CustomItemsDataProvider() {
// super("CustomItems");
// }
//
// @Override
// public void init() {
// this.mushroomFaces = new WrappedField<>(CustomMushroomBlock.class, FIELD_FACES);
// this.mushroomMaterial = new WrappedReturningMethod<>(CustomMushroomBlock.class, METHOD_GET_MATERIAL);
// }
//
// @Override
// public BlockData getBlockData(Identifier blockId) throws MissingResourceException {
// CustomItem item = CustomItem.get(blockId.key());
// if(item == null) {
// throw new MissingResourceException("Failed to find BlockData!", blockId.namespace(), blockId.key());
// } else if(item.getBlockTexture().isSpawner()) {
// throw new MissingResourceException("Iris does not yet support SpawnerBlocks from CustomItems.", blockId.namespace(), blockId.key());
// } else if(item.getBlockTexture() != null && item.getBlockTexture().isValid()) {
// throw new MissingResourceException("Tried to fetch BlockData for a CustomItem that is not placeable!", blockId.namespace(), blockId.key());
// }
// return getMushroomData(item);
// }
//
// @Override
// public ItemStack getItemStack(Identifier itemId) throws MissingResourceException {
// ItemStack stack = CustomItemsAPI.getCustomItem(itemId.key());
// if(stack == null) {
// throw new MissingResourceException("Failed to find ItemData!", itemId.namespace(), itemId.key());
// }
// return stack;
// }
//
// @Override
// public Identifier[] getBlockTypes() {
// KList<Identifier> names = new KList<>();
// for (String name : CustomItemsAPI.listBlockCustomItemIDs()) {
// try {
// Identifier key = new Identifier("cui", name);
// if (getItemStack(key) != null)
// names.add(key);
// } catch (MissingResourceException ignored) { }
// }
//
// return names.toArray(new Identifier[0]);
// }
//
// @Override
// public Identifier[] getItemTypes() {
// KList<Identifier> names = new KList<>();
// for (String name : CustomItemsAPI.listCustomItemIDs()) {
// try {
// Identifier key = new Identifier("cui", name);
// if (getItemStack(key) != null)
// names.add(key);
// } catch (MissingResourceException ignored) { }
// }
//
// return names.toArray(new Identifier[0]);
// }
//
// @Override
// public boolean isValidProvider(Identifier key, boolean isItem) {
// return key.namespace().equalsIgnoreCase("cui");
// }
//
// private BlockData getMushroomData(CustomItem item) {
// MultipleFacing data = (MultipleFacing)mushroomMaterial.invoke(item.getBlockTexture().getMushroomId()).parseMaterial().createBlockData();
// boolean[] values = mushroomFaces.get().get(item.getBlockTexture().getMushroomId());
// data.setFace(BlockFace.DOWN, values[0]);
// data.setFace(BlockFace.EAST, values[1]);
// data.setFace(BlockFace.NORTH, values[2]);
// data.setFace(BlockFace.SOUTH, values[3]);
// data.setFace(BlockFace.UP, values[4]);
// data.setFace(BlockFace.WEST, values[5]);
// return data;
// }
//}

View File

@@ -26,11 +26,13 @@ public abstract class ExternalDataProvider {
public abstract void init();
public abstract BlockData getBlockData(NamespacedKey blockId) throws MissingResourceException;
public abstract BlockData getBlockData(Identifier blockId) throws MissingResourceException;
public abstract ItemStack getItemStack(NamespacedKey itemId) throws MissingResourceException;
public abstract ItemStack getItemStack(Identifier itemId) throws MissingResourceException;
public abstract NamespacedKey[] getBlockTypes();
public abstract Identifier[] getBlockTypes();
public abstract boolean isValidProvider(NamespacedKey namespace);
public abstract Identifier[] getItemTypes();
public abstract boolean isValidProvider(Identifier id, boolean isItem);
}

View File

@@ -0,0 +1,33 @@
package com.volmit.iris.core.link;
import org.bukkit.NamespacedKey;
public record Identifier(String namespace, String key) {
private static final String DEFAULT_NAMESPACE = "minecraft";
public static Identifier fromString(String id) {
String[] strings = id.split(":", 1);
if(strings.length == 1) {
return new Identifier(DEFAULT_NAMESPACE, strings[0]);
} else {
return new Identifier(strings[0], strings[1]);
}
}
@Override
public String toString() {
return namespace + ":" + key;
}
@Override
public boolean equals(Object obj) {
if(obj instanceof Identifier i) {
return i.namespace().equals(this.namespace) && i.key().equals(this.key);
} else if(obj instanceof NamespacedKey i) {
return i.getNamespace().equals(this.namespace) && i.getKey().equals(this.key);
} else {
return false;
}
}
}

View File

@@ -3,8 +3,6 @@ package com.volmit.iris.core.link;
import com.volmit.iris.util.collection.KList;
import dev.lone.itemsadder.api.CustomBlock;
import dev.lone.itemsadder.api.CustomStack;
import dev.lone.itemsadder.api.ItemsAdder;
import org.bukkit.NamespacedKey;
import org.bukkit.block.data.BlockData;
import org.bukkit.inventory.ItemStack;
@@ -12,41 +10,59 @@ import java.util.MissingResourceException;
public class ItemAdderDataProvider extends ExternalDataProvider {
private KList<String> itemNamespaces, blockNamespaces;
public ItemAdderDataProvider() {
super("ItemsAdder");
}
@Override
public void init() {
this.itemNamespaces = new KList<>();
this.blockNamespaces = new KList<>();
for(Identifier i : getItemTypes()) {
itemNamespaces.addIfMissing(i.namespace());
}
for(Identifier i : getBlockTypes()) {
blockNamespaces.addIfMissing(i.namespace());
}
}
@Override
public BlockData getBlockData(NamespacedKey blockId) throws MissingResourceException {
public BlockData getBlockData(Identifier blockId) throws MissingResourceException {
return CustomBlock.getBaseBlockData(blockId.toString());
}
@Override
public ItemStack getItemStack(NamespacedKey itemId) throws MissingResourceException {
public ItemStack getItemStack(Identifier itemId) throws MissingResourceException {
CustomStack stack = CustomStack.getInstance(itemId.toString());
if (stack == null)
throw new MissingResourceException("Failed to find ItemData!", itemId.getNamespace(), itemId.getKey());
if (stack == null) {
throw new MissingResourceException("Failed to find ItemData!", itemId.namespace(), itemId.key());
}
return stack.getItemStack();
}
@Override
public NamespacedKey[] getBlockTypes() {
KList<NamespacedKey> keys = new KList<>();
for (String s : ItemsAdder.getNamespacedBlocksNamesInConfig())
keys.add(NamespacedKey.fromString(s));
return keys.toArray(new NamespacedKey[0]);
public Identifier[] getBlockTypes() {
KList<Identifier> keys = new KList<>();
for (String s : CustomBlock.getNamespacedIdsInRegistry()) {
keys.add(Identifier.fromString(s));
}
return keys.toArray(new Identifier[0]);
}
@Override
public boolean isValidProvider(NamespacedKey blockId) {
for (NamespacedKey k : getBlockTypes())
if (k.equals(blockId)) {
return true;
}
return false;
public Identifier[] getItemTypes() {
KList<Identifier> keys = new KList<>();
for (String s : CustomStack.getNamespacedIdsInRegistry()) {
keys.add(Identifier.fromString(s));
}
return keys.toArray(new Identifier[0]);
}
@Override
public boolean isValidProvider(Identifier id, boolean isItem) {
return isItem ? this.itemNamespaces.contains(id.namespace()) : this.blockNamespaces.contains(id.namespace());
}
}

View File

@@ -18,23 +18,17 @@
package com.volmit.iris.core.link;
import io.lumine.mythic.bukkit.MythicBukkit;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.plugin.Plugin;
import javax.annotation.Nullable;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collection;
import java.util.function.BiFunction;
public class MythicMobsLink {
private Collection<String> mobs;
private BiFunction<String, Location, Entity> spawnMobFunction;
public MythicMobsLink() {
}
@@ -56,59 +50,10 @@ public class MythicMobsLink {
*/
public @Nullable
Entity spawnMob(String mob, Location location) {
if (!isEnabled()) return null;
if (spawnMobFunction != null) {
return spawnMobFunction.apply(mob, location);
}
try {
Class<?> mythicMobClass = Class.forName("io.lumine.mythic.bukkit.MythicBukkit");
Method getInst = mythicMobClass.getDeclaredMethod("inst");
Object inst = getInst.invoke(null);
Method getAPIHelper = mythicMobClass.getDeclaredMethod("getAPIHelper");
Object apiHelper = getAPIHelper.invoke(inst);
Method spawnMobMethod = apiHelper.getClass().getDeclaredMethod("spawnMythicMob", String.class, Location.class);
spawnMobFunction = (str, loc) -> {
try {
return (Entity) spawnMobMethod.invoke(apiHelper, str, loc);
} catch (InvocationTargetException | IllegalAccessException e) {
e.printStackTrace();
}
return null;
};
return spawnMobFunction.apply(mob, location);
} catch (Exception e) {
e.printStackTrace();
}
return null;
return isEnabled() ? MythicBukkit.inst().getMobManager().spawnMob(mob, location).getEntity().getBukkitEntity() : null;
}
public Collection<String> getMythicMobTypes() {
if (mobs != null) {
return mobs;
}
if (isEnabled()) {
try {
Class<?> mythicMobClass = Class.forName("io.lumine.xikage.mythicmobs.MythicMobs");
Method getInst = mythicMobClass.getDeclaredMethod("inst");
Object inst = getInst.invoke(null);
Method getMobManager = mythicMobClass.getDeclaredMethod("getMobManager");
Object mobManager = getMobManager.invoke(inst);
Method getMobNames = mobManager.getClass().getDeclaredMethod("getMobNames");
mobs = (Collection<String>) getMobNames.invoke(mobManager);
return mobs;
} catch (ClassNotFoundException | NoSuchMethodException | InvocationTargetException |
IllegalAccessException e) {
e.printStackTrace();
}
}
return new ArrayList<>();
return isEnabled() ? MythicBukkit.inst().getMobManager().getMobNames() : null;
}
}

View File

@@ -20,17 +20,17 @@ package com.volmit.iris.core.link;
import com.volmit.iris.Iris;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.reflect.WrappedField;
import io.th0rgal.oraxen.api.OraxenItems;
import io.th0rgal.oraxen.items.ItemBuilder;
import io.th0rgal.oraxen.items.OraxenItems;
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 io.th0rgal.oraxen.mechanics.provided.gameplay.stringblock.StringBlockMechanicFactory;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.MultipleFacing;
import org.bukkit.inventory.ItemStack;
@@ -44,7 +44,7 @@ public class OraxenDataProvider extends ExternalDataProvider {
private static final String FIELD_FACTORIES_MAP = "FACTORIES_BY_MECHANIC_ID";
private Map<String, MechanicFactory> factories;
private WrappedField<MechanicsManager, Map<String, MechanicFactory>> factories;
public OraxenDataProvider() {
super("Oraxen");
@@ -52,48 +52,59 @@ public class OraxenDataProvider extends ExternalDataProvider {
@Override
public void init() {
try {
Field f = MechanicsManager.class.getDeclaredField(FIELD_FACTORIES_MAP);
f.setAccessible(true);
factories = (Map<String, MechanicFactory>) f.get(null);
} catch (NoSuchFieldException | IllegalAccessException e) {
Iris.error("Failed to set up Oraxen Link:");
Iris.error("\t" + e.getClass().getSimpleName());
this.factories = new WrappedField<>(MechanicsManager.class, FIELD_FACTORIES_MAP);
if(this.factories.hasFailed()) {
Iris.error("Failed to set up Oraxen Link: Unable to fetch MechanicFactoriesMap!");
}
}
@Override
public BlockData getBlockData(NamespacedKey blockId) throws MissingResourceException {
MechanicFactory f = getFactory(blockId);
if (f instanceof NoteBlockMechanicFactory)
return ((NoteBlockMechanicFactory) f).createNoteBlockData(blockId.getKey());
else if (f instanceof BlockMechanicFactory) {
public BlockData getBlockData(Identifier blockId) throws MissingResourceException {
MechanicFactory factory = getFactory(blockId);
if (factory instanceof NoteBlockMechanicFactory f)
return f.createNoteBlockData(blockId.key());
else if (factory instanceof BlockMechanicFactory f) {
MultipleFacing newBlockData = (MultipleFacing) Bukkit.createBlockData(Material.MUSHROOM_STEM);
Utils.setBlockFacing(newBlockData, ((BlockMechanic) f.getMechanic(blockId.getKey())).getCustomVariation());
BlockMechanic.setBlockFacing(newBlockData, ((BlockMechanic) f.getMechanic(blockId.key())).getCustomVariation());
return newBlockData;
} else if (factory instanceof StringBlockMechanicFactory f) {
return f.createTripwireData(blockId.key());
} else
throw new MissingResourceException("Failed to find BlockData!", blockId.getNamespace(), blockId.getKey());
throw new MissingResourceException("Failed to find BlockData!", blockId.namespace(), blockId.key());
}
@Override
public ItemStack getItemStack(NamespacedKey itemId) throws MissingResourceException {
Optional<ItemBuilder> opt = OraxenItems.getOptionalItemById(itemId.getKey());
return opt.orElseThrow(() -> new MissingResourceException("Failed to find ItemData!", itemId.getNamespace(), itemId.getKey())).build();
public ItemStack getItemStack(Identifier itemId) throws MissingResourceException {
Optional<ItemBuilder> opt = OraxenItems.getOptionalItemById(itemId.key());
return opt.orElseThrow(() -> new MissingResourceException("Failed to find ItemData!", itemId.namespace(), itemId.key())).build();
}
@Override
public NamespacedKey[] getBlockTypes() {
KList<NamespacedKey> names = new KList<>();
public Identifier[] getBlockTypes() {
KList<Identifier> names = new KList<>();
for (String name : OraxenItems.getItemNames()) {
try {
NamespacedKey key = new NamespacedKey("oraxen", name);
Identifier key = new Identifier("oraxen", name);
if (getBlockData(key) != null)
names.add(key);
} catch (MissingResourceException ignored) {
}
} catch (MissingResourceException ignored) { }
}
return names.toArray(new NamespacedKey[0]);
return names.toArray(new Identifier[0]);
}
@Override
public Identifier[] getItemTypes() {
KList<Identifier> names = new KList<>();
for (String name : OraxenItems.getItemNames()) {
try {
Identifier key = new Identifier("oraxen", name);
if (getItemStack(key) != null)
names.add(key);
} catch (MissingResourceException ignored) { }
}
return names.toArray(new Identifier[0]);
}
@Override
@@ -102,14 +113,14 @@ public class OraxenDataProvider extends ExternalDataProvider {
}
@Override
public boolean isValidProvider(NamespacedKey key) {
return key.getNamespace().equalsIgnoreCase("oraxen");
public boolean isValidProvider(Identifier key, boolean isItem) {
return key.namespace().equalsIgnoreCase("oraxen");
}
private MechanicFactory getFactory(NamespacedKey key) throws MissingResourceException {
return factories.values().stream()
.filter(i -> i.getItems().contains(key.getKey()))
private MechanicFactory getFactory(Identifier key) throws MissingResourceException {
return factories.get().values().stream()
.filter(i -> i.getItems().contains(key.key()))
.findFirst()
.orElseThrow(() -> new MissingResourceException("Failed to find BlockData!", key.getNamespace(), key.getKey()));
.orElseThrow(() -> new MissingResourceException("Failed to find BlockData!", key.namespace(), key.key()));
}
}

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.v19_3.NMSBinding19_3;
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;
@@ -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_19_R2", NMSBinding19_3.class);
.qput("v1_19_R3", NMSBinding19_4.class);
//@done
private static final INMSBinding binding = bind();

View File

@@ -1,4 +1,4 @@
package com.volmit.iris.core.nms.v19_3;
package com.volmit.iris.core.nms.v19_4;
import com.mojang.serialization.Codec;
import com.volmit.iris.Iris;
@@ -18,16 +18,18 @@ import net.minecraft.world.level.biome.BiomeSource;
import net.minecraft.world.level.biome.Climate;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.craftbukkit.v1_19_R2.CraftServer;
import org.bukkit.craftbukkit.v1_19_R2.CraftWorld;
import org.bukkit.craftbukkit.v1_19_R2.block.CraftBlock;
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 java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;
public class CustomBiomeSource extends BiomeSource {
private final long seed;
private final Engine engine;
private final Registry<Biome> biomeCustomRegistry;
@@ -37,19 +39,23 @@ public class CustomBiomeSource extends BiomeSource {
private final KMap<String, Holder<Biome>> customBiomes;
public CustomBiomeSource(long seed, Engine engine, World world) {
super(getAllBiomes(
((RegistryAccess) getFor(RegistryAccess.Frozen.class, ((CraftServer) Bukkit.getServer()).getHandle().getServer()))
.registry(Registries.BIOME).orElse(null),
((CraftWorld) world).getHandle().registryAccess().registry(Registries.BIOME).orElse(null),
engine));
this.engine = engine;
this.seed = seed;
this.biomeCustomRegistry = registry().registry(Registries.BIOME).orElse(null);
this.biomeRegistry = ((CraftWorld) world).getHandle().registryAccess().registry(Registries.BIOME).orElse(null);
this.biomeRegistry = ((RegistryAccess) getFor(RegistryAccess.Frozen.class, ((CraftServer) Bukkit.getServer()).getHandle().getServer())).registry(Registries.BIOME).orElse(null);
this.rng = new RNG(engine.getSeedManager().getBiome());
this.customBiomes = fillCustomBiomes(biomeCustomRegistry, engine);
}
@Override
protected Stream<Holder<Biome>> collectPossibleBiomes() {
return getAllBiomes(
((RegistryAccess) getFor(RegistryAccess.Frozen.class, ((CraftServer) Bukkit.getServer()).getHandle().getServer()))
.registry(Registries.BIOME).orElse(null),
((CraftWorld) engine.getWorld().realWorld()).getHandle().registryAccess().registry(Registries.BIOME).orElse(null),
engine).stream();
}
private static List<Holder<Biome>> getAllBiomes(Registry<Biome> customRegistry, Registry<Biome> registry, Engine engine) {
List<Holder<Biome>> b = new ArrayList<>();

View File

@@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.volmit.iris.core.nms.v19_3;
package com.volmit.iris.core.nms.v19_4;
import com.volmit.iris.Iris;
@@ -46,10 +46,11 @@ 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_R2.CraftChunk;
import org.bukkit.craftbukkit.v1_19_R2.CraftServer;
import org.bukkit.craftbukkit.v1_19_R2.CraftWorld;
import org.bukkit.craftbukkit.v1_19_R2.block.data.CraftBlockData;
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;
@@ -64,9 +65,9 @@ import java.util.Iterator;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
public class NMSBinding19_3 implements INMSBinding {
public class NMSBinding19_4 implements INMSBinding {
public static final String NMS_VERSION = "1.19.3";
public static final String NMS_VERSION = "1.19.4";
private final KMap<Biome, Object> baseBiomeCache = new KMap<>();
private final BlockData AIR = Material.AIR.createBlockData();
private final AtomicCache<MCAIdMap<net.minecraft.world.level.biome.Biome>> biomeMapCache = new AtomicCache<>();
@@ -197,7 +198,6 @@ public class NMSBinding19_3 implements INMSBinding {
}
private Registry<net.minecraft.world.level.biome.Biome> getCustomBiomeRegistry() {
return registry().registry(Registries.BIOME).orElse(null);
}
@@ -256,7 +256,7 @@ public class NMSBinding19_3 implements INMSBinding {
@Override
public Object getBiomeBase(World world, Biome biome) {
return org.bukkit.craftbukkit.v1_19_R2.block.CraftBlock.biomeToBiomeBase(((CraftWorld) world).getHandle()
return CraftBlock.biomeToBiomeBase(((CraftWorld) world).getHandle()
.registryAccess().registry(Registries.BIOME).orElse(null), biome);
}
@@ -268,13 +268,13 @@ public class NMSBinding19_3 implements INMSBinding {
return v;
}
//noinspection unchecked
v = org.bukkit.craftbukkit.v1_19_R2.block.CraftBlock.biomeToBiomeBase((Registry<net.minecraft.world.level.biome.Biome>) registry, biome);
v = 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_19_R2.block.CraftBlock.biomeToBiomeBase((Registry<net.minecraft.world.level.biome.Biome>) registry, Biome.PLAINS);
return CraftBlock.biomeToBiomeBase((Registry<net.minecraft.world.level.biome.Biome>) registry, Biome.PLAINS);
}
baseBiomeCache.put(biome, v);
return v;
@@ -394,7 +394,6 @@ public class NMSBinding19_3 implements INMSBinding {
return f;
}
try {
f = storage.getClass().getDeclaredField("biome");
f.setAccessible(true);
return f;

View File

@@ -101,7 +101,8 @@ public class IrisPregenerator {
eta, M.ms() - startTime.get(), currentGeneratorMethod.get());
if (cl.flip()) {
Iris.info("Pregen: " + Form.f(generated.get()) + " of " + Form.f(totalChunks.get()) + " (" + Form.pc((double) generated.get() / (double) totalChunks.get(), 0) + ") " + Form.f((int) chunksPerSecond.getAverage()) + "/s ETA: " + Form.duration((double) eta, 2));
double percentage = ((double) generated.get() / (double) totalChunks.get()) * 100;
Iris.info("Pregen: " + Form.f(generated.get()) + " of " + Form.f(totalChunks.get()) + " (%.0f%%) " + Form.f((int) chunksPerSecond.getAverage()) + "/s ETA: " + Form.duration((double) eta, 2), percentage);
}
return 1000;

View File

@@ -29,7 +29,7 @@ import net.minecraft.core.BlockPos;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.SoundCategory;
import org.bukkit.craftbukkit.v1_19_R2.entity.CraftDolphin;
import org.bukkit.craftbukkit.v1_19_R3.entity.CraftDolphin;
import org.bukkit.entity.Dolphin;
import org.bukkit.entity.EntityType;
import org.bukkit.event.EventHandler;

View File

@@ -19,9 +19,7 @@
package com.volmit.iris.core.service;
import com.volmit.iris.Iris;
import com.volmit.iris.core.link.ExternalDataProvider;
import com.volmit.iris.core.link.ItemAdderDataProvider;
import com.volmit.iris.core.link.OraxenDataProvider;
import com.volmit.iris.core.link.*;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.plugin.IrisService;
import lombok.Data;
@@ -39,7 +37,10 @@ public class ExternalDataSVC implements IrisService {
@Override
public void onEnable() {
addProvider(new OraxenDataProvider(), new ItemAdderDataProvider());
addProvider(
// new CustomItemsDataProvider(), //need this to be gradelized before i can add it to the master repo
new OraxenDataProvider(),
new ItemAdderDataProvider());
}
@Override
@@ -55,8 +56,8 @@ public class ExternalDataSVC implements IrisService {
}
}
public Optional<BlockData> getBlockData(NamespacedKey key) {
Optional<ExternalDataProvider> provider = providers.stream().filter(p -> p.isPresent() && p.isValidProvider(key)).findFirst();
public Optional<BlockData> getBlockData(Identifier key) {
Optional<ExternalDataProvider> provider = providers.stream().filter(p -> p.isPresent() && p.isValidProvider(key, false)).findFirst();
if (provider.isEmpty())
return Optional.empty();
try {
@@ -67,10 +68,12 @@ public class ExternalDataSVC implements IrisService {
}
}
public Optional<ItemStack> getItemStack(NamespacedKey key) {
Optional<ExternalDataProvider> provider = providers.stream().filter(p -> p.isPresent() && p.isValidProvider(key)).findFirst();
if (provider.isEmpty())
public Optional<ItemStack> getItemStack(Identifier key) {
Optional<ExternalDataProvider> provider = providers.stream().filter(p -> p.isPresent() && p.isValidProvider(key, true)).findFirst();
if (provider.isEmpty()) {
Iris.warn("No matching Provider found for modded material \"%s\"!", key);
return Optional.empty();
}
try {
return Optional.of(provider.get().getItemStack(key));
} catch (MissingResourceException e) {
@@ -79,9 +82,15 @@ public class ExternalDataSVC implements IrisService {
}
}
public NamespacedKey[] getAllIdentifiers() {
KList<NamespacedKey> names = new KList<>();
public Identifier[] getAllBlockIdentifiers() {
KList<Identifier> names = new KList<>();
providers.stream().filter(ExternalDataProvider::isPresent).forEach(p -> names.add(p.getBlockTypes()));
return names.toArray(new NamespacedKey[0]);
return names.toArray(new Identifier[0]);
}
public Identifier[] getAllItemIdentifiers() {
KList<Identifier> names = new KList<>();
providers.stream().filter(ExternalDataProvider::isPresent).forEach(p -> names.add(p.getItemTypes()));
return names.toArray(new Identifier[0]);
}
}

View File

@@ -220,7 +220,6 @@ public class IrisComplex implements DataProvider {
return seaBiomeStream;
case SHORE:
return shoreBiomeStream;
case DEFER:
default:
break;
}

View File

@@ -32,8 +32,5 @@ public enum InferredType {
SEA,
@Desc("Represents any cave biome type")
CAVE,
@Desc("Defers the type to whatever another biome type that already exists is.")
DEFER
CAVE
}

View File

@@ -484,11 +484,6 @@ public class IrisBiome extends IrisRegistrant implements IRare {
});
}
public IrisBiome infer(InferredType t, InferredType type) {
setInferredType(t.equals(InferredType.DEFER) ? type : t);
return this;
}
public KList<BlockData> generateSeaLayers(double wx, double wz, RNG random, int maxDepth, IrisData rdata) {
KList<BlockData> data = new KList<>();

View File

@@ -120,6 +120,7 @@ public class IrisBiomeCustom {
j.put("temperature", getTemperature());
j.put("downfall", getHumidity());
j.put("creature_spawn_probability", getSpawnRarity());
j.put("has_precipitation", getDownfallType() != IrisBiomeCustomPrecipType.none);
j.put("precipitation", getDownfallType().toString().toLowerCase());
j.put("category", getCategory().toString().toLowerCase());
j.put("effects", effects);

View File

@@ -54,20 +54,70 @@ public class IrisDimension extends IrisRegistrant {
public static final BlockData WATER = Material.WATER.createBlockData();
private static final String DP_OVERWORLD_DEFAULT = """
{
"ultrawarm": false,
"natural": true,
"coordinate_scale": 1.0,
"has_skylight": true,
"has_ceiling": false,
"ambient_light": 0,
"piglin_safe": false,
"bed_works": true,
"respawn_anchor_works": true,
"has_raids": true,
"monster_spawn_block_light_limit": 7,
"monster_spawn_light_level": 7,
"infiniburn": "#minecraft:infiniburn_overworld",
"effects": "minecraft:overworld"
"ambient_light": 0.0,
"bed_works": true,
"coordinate_scale": 1.0,
"effects": "minecraft:overworld",
"has_ceiling": false,
"has_raids": true,
"has_skylight": true,
"infiniburn": "#minecraft:infiniburn_overworld",
"monster_spawn_block_light_limit": 0,
"monster_spawn_light_level": {
"type": "minecraft:uniform",
"value": {
"max_inclusive": 7,
"min_inclusive": 0
}
},
"natural": true,
"piglin_safe": false,
"respawn_anchor_works": false,
"ultrawarm": false
}""";
private static final String DP_NETHER_DEFAULT = """
{
"ambient_light": 0.1,
"bed_works": false,
"coordinate_scale": 8.0,
"effects": "minecraft:the_nether",
"fixed_time": 18000,
"has_ceiling": true,
"has_raids": false,
"has_skylight": false,
"infiniburn": "#minecraft:infiniburn_nether",
"monster_spawn_block_light_limit": 15,
"monster_spawn_light_level": 7,
"natural": false,
"piglin_safe": true,
"respawn_anchor_works": true,
"ultrawarm": true
}""";
private static final String DP_END_DEFAULT = """
{
"ambient_light": 0.0,
"bed_works": false,
"coordinate_scale": 1.0,
"effects": "minecraft:the_end",
"fixed_time": 6000,
"has_ceiling": false,
"has_raids": true,
"has_skylight": false,
"infiniburn": "#minecraft:infiniburn_end",
"monster_spawn_block_light_limit": 0,
"monster_spawn_light_level": {
"type": "minecraft:uniform",
"value": {
"max_inclusive": 7,
"min_inclusive": 0
}
},
"natural": false,
"piglin_safe": false,
"respawn_anchor_works": false,
"ultrawarm": false
}""";
private final transient AtomicCache<Position2> parallaxSize = new AtomicCache<>();
private final transient AtomicCache<CNG> rockLayerGenerator = new AtomicCache<>();
@@ -86,6 +136,10 @@ public class IrisDimension extends IrisRegistrant {
@MaxNumber(2032)
@Desc("Maximum height at which players can be teleported to through gameplay.")
private int logicalHeight = 256;
@Desc("Maximum height at which players can be teleported to through gameplay.")
private int logicalHeightEnd = 256;
@Desc("Maximum height at which players can be teleported to through gameplay.")
private int logicalHeightNether = 256;
@RegistryListResource(IrisJigsawStructure.class)
@Desc("If defined, Iris will place the given jigsaw structure where minecraft should place the overworld stronghold.")
private String stronghold;
@@ -107,12 +161,8 @@ public class IrisDimension extends IrisRegistrant {
private int strongholdJumpDistance = 1280;
@Desc("Define the maximum strongholds to place")
private int maxStrongholds = 14;
@Desc("Improves the biome grid variation by shuffling the cell grid more depending on the seed. This makes biomes across multiple seeds look far different than before.")
private boolean aggressiveBiomeReshuffle = false;
@Desc("Tree growth override settings")
private IrisTreeSettings treeSettings = new IrisTreeSettings();
@Desc("Upon joining this world, Iris will send a resource pack request to the client. If they have previously selected yes, it will auto-switch depending on which dimension they go to.")
private String resourcePack = "";
@Desc("Spawn Entities in this dimension over time. Iris will continually replenish these mobs just like vanilla does.")
@ArrayType(min = 1, type = String.class)
@RegistryListResource(IrisSpawner.class)
@@ -174,6 +224,10 @@ public class IrisDimension extends IrisRegistrant {
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.")
private IrisRange dimensionHeight = new IrisRange(-64, 320);
@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.")
private IrisRange dimensionHeightEnd = new IrisRange(-64, 320);
@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.")
private IrisRange dimensionHeightNether = new IrisRange(-64, 320);
@RegistryListResource(IrisBiome.class)
@Desc("Keep this either undefined or empty. Setting any biome name into this will force iris to only generate the specified biome. Great for testing.")
private String focus = "";
@@ -279,7 +333,6 @@ public class IrisDimension extends IrisRegistrant {
KList<Position2> pos = new KList<>();
int jump = strongholdJumpDistance;
RNG rng = new RNG((seed * 223) + 12945);
for (int i = 0; i < maxStrongholds + 1; i++) {
int m = i + 1;
pos.add(new Position2(
@@ -416,7 +469,7 @@ public class IrisDimension extends IrisRegistrant {
}
if (!dimensionHeight.equals(new IrisRange(-64, 320)) && this.name.equalsIgnoreCase("overworld")) {
Iris.verbose(" Installing Data Pack Dimension Type: \"minecraft:overworld\"");
Iris.verbose(" Installing Data Pack Dimension Types: \"minecraft:overworld\", \"minecraft:the_nether\", \"minecraft:the_end\"");
changed = writeDimensionType(changed, datapacks);
}
@@ -457,24 +510,63 @@ public class IrisDimension extends IrisRegistrant {
}
public boolean writeDimensionType(boolean changed, File datapacks) {
File dimType = new File(datapacks, "iris/data/minecraft/dimension_type/overworld.json");
if (!dimType.exists())
File dimTypeOverworld = new File(datapacks, "iris/data/minecraft/dimension_type/overworld.json");
if (!dimTypeOverworld.exists())
changed = true;
dimType.getParentFile().mkdirs();
dimTypeOverworld.getParentFile().mkdirs();
try {
IO.writeAll(dimType, generateDatapackJson());
IO.writeAll(dimTypeOverworld, generateDatapackJsonOverworld());
} catch (IOException e) {
Iris.reportError(e);
e.printStackTrace();
}
File dimTypeNether = new File(datapacks, "iris/data/minecraft/dimension_type/the_nether.json");
if (!dimTypeNether.exists())
changed = true;
dimTypeNether.getParentFile().mkdirs();
try {
IO.writeAll(dimTypeNether, generateDatapackJsonNether());
} catch (IOException e) {
Iris.reportError(e);
e.printStackTrace();
}
File dimTypeEnd = new File(datapacks, "iris/data/minecraft/dimension_type/the_end.json");
if (!dimTypeEnd.exists())
changed = true;
dimTypeEnd.getParentFile().mkdirs();
try {
IO.writeAll(dimTypeEnd, generateDatapackJsonEnd());
} catch (IOException e) {
Iris.reportError(e);
e.printStackTrace();
}
return changed;
}
private String generateDatapackJson() {
private String generateDatapackJsonOverworld() {
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 String generateDatapackJsonNether() {
JSONObject obj = new JSONObject(DP_NETHER_DEFAULT);
obj.put("min_y", dimensionHeightNether.getMin());
obj.put("height", dimensionHeightNether.getMax() - dimensionHeightNether.getMin());
obj.put("logical_height", logicalHeightNether);
return obj.toString(4);
}
private String generateDatapackJsonEnd() {
JSONObject obj = new JSONObject(DP_END_DEFAULT);
obj.put("min_y", dimensionHeightEnd.getMin());
obj.put("height", dimensionHeightEnd.getMax() - dimensionHeightEnd.getMin());
obj.put("logical_height", logicalHeightEnd);
return obj.toString(4);
}
}

View File

@@ -154,6 +154,9 @@ public class IrisEntity extends IrisRegistrant {
@Desc("Create a mob from another plugin, such as Mythic Mobs. Should be in the format of a namespace of PluginName:MobName")
private String specialType = "";
@Desc("Set to true if you want to apply all of the settings here to the mob, even though an external plugin has already done so. Scripts are always applied.")
private boolean applySettingsToCustomMobAnyways = false;
@Desc("Set the entity type to UNKNOWN, then define a script here which ends with the entity variable (the result). You can use Iris.getLocation() to find the target location. You can spawn any entity this way.")
@RegistryListResource(IrisScript.class)
private String spawnerScript = "";
@@ -211,6 +214,10 @@ public class IrisEntity extends IrisRegistrant {
}
}
if (isSpecialType() && !applySettingsToCustomMobAnyways) {
return ee;
}
if (ee == null) {
return null;
}
@@ -413,7 +420,7 @@ public class IrisEntity extends IrisRegistrant {
return null;
}
if (type.equals(EntityType.UNKNOWN)) {
if (type.equals(EntityType.UNKNOWN) && !isSpecialType()) {
return null;
}

View File

@@ -32,7 +32,7 @@ import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@Snippet("carving")
@Snippet("image-map")
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@@ -68,6 +68,7 @@ public class IrisImageMap {
IrisImage i = imageCache.aquire(() -> data.getImageLoader().load(image));
if (i == null) {
Iris.error("NULL IMAGE FOR " + image);
return 0;
}
return IrisInterpolation.getNoise(interpolationMethod, x, z, coordinateScale, (xx, zz) -> rawNoise(i, xx, zz));
@@ -76,11 +77,27 @@ public class IrisImageMap {
private double rawNoise(IrisImage i, double x, double z) {
x /= coordinateScale;
z /= coordinateScale;
x = isCentered() ? x + ((i.getWidth() / 2D) * coordinateScale) : x;
z = isCentered() ? z + ((i.getHeight() / 2D) * coordinateScale) : z;
x = isTiled() ? x % i.getWidth() : x;
z = isTiled() ? z % i.getHeight() : z;
// X and Z are now scaled to the image
// Add half the image width & height if centered
if (isCentered()) {
x += i.getWidth() / 2D;
z += i.getHeight() / 2D;
}
// If tiled modulo over width and height
if (isTiled()) {
x = x % i.getWidth();
x = x < 0 ? x + i.getWidth() : x; // Fix java's negative modulo shit
z = z % i.getHeight();
z = z < 0 ? z + i.getHeight() : z; // Fix java's negative modulo shit
}
// Retrieve value from image
double v = i.getValue(getChannel(), (int) x, (int) z);
// Return value, or 1 - value if inverted (value is in double set [0, 1] so this will return [0, 1])
return isInverted() ? 1D - v : v;
}
}

View File

@@ -20,6 +20,7 @@ package com.volmit.iris.engine.object;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import com.volmit.iris.Iris;
import com.volmit.iris.core.link.Identifier;
import com.volmit.iris.core.service.ExternalDataSVC;
import com.volmit.iris.engine.data.cache.AtomicCache;
import com.volmit.iris.engine.object.annotations.*;
@@ -39,8 +40,7 @@ import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.TagParser;
import org.bukkit.DyeColor;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.craftbukkit.v1_19_R2.inventory.CraftItemStack;
import org.bukkit.craftbukkit.v1_19_R3.inventory.CraftItemStack;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.Damageable;
@@ -149,10 +149,10 @@ public class IrisLoot {
// TODO Better Third Party Item Acquisition
private ItemStack getItemStack(RNG rng) {
if (!type.startsWith("minecraft:") && type.contains(":")) {
Optional<ItemStack> opt = Iris.service(ExternalDataSVC.class).getItemStack(NamespacedKey.fromString(type));
Optional<ItemStack> opt = Iris.service(ExternalDataSVC.class).getItemStack(Identifier.fromString(type));
if (opt.isEmpty()) {
Iris.warn("Unknown Material: " + type);
return null;
return new ItemStack(Material.AIR);
}
ItemStack is = opt.get();
is.setAmount(Math.max(1, rng.i(getMinAmount(), getMaxAmount())));
@@ -198,8 +198,10 @@ public class IrisLoot {
colorable.setColor(getDyeColor());
}
m.setLocalizedName(C.translateAlternateColorCodes('&', displayName));
m.setDisplayName(C.translateAlternateColorCodes('&', displayName));
if(displayName != null) {
m.setLocalizedName(C.translateAlternateColorCodes('&', displayName));
m.setDisplayName(C.translateAlternateColorCodes('&', displayName));
}
KList<String> lore = new KList<>();

View File

@@ -30,16 +30,14 @@ import com.volmit.iris.util.data.B;
import com.volmit.iris.util.format.Form;
import com.volmit.iris.util.interpolation.IrisInterpolation;
import com.volmit.iris.util.json.JSONObject;
import com.volmit.iris.util.math.AxisAlignedBB;
import com.volmit.iris.util.math.BlockPosition;
import com.volmit.iris.util.math.Position2;
import com.volmit.iris.util.math.RNG;
import com.volmit.iris.util.math.*;
import com.volmit.iris.util.matter.MatterMarker;
import com.volmit.iris.util.parallel.BurstExecutor;
import com.volmit.iris.util.parallel.MultiBurst;
import com.volmit.iris.util.plugin.VolmitSender;
import com.volmit.iris.util.scheduling.IrisLock;
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
import com.volmit.iris.util.stream.ProceduralStream;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
@@ -496,6 +494,38 @@ public class IrisObject extends IrisRegistrant {
public int place(int x, int yv, int z, IObjectPlacer oplacer, IrisObjectPlacement config, RNG rng, BiConsumer<BlockPosition, BlockData> listener, CarveResult c, IrisData rdata) {
IObjectPlacer placer = (config.getHeightmap() != null) ? new HeightmapObjectPlacer(oplacer.getEngine() == null ? IrisContext.get().getEngine() : oplacer.getEngine(), rng, x, yv, z, config, oplacer) : oplacer;
if (rdata != null) {
// Slope condition
if (!config.getSlopeCondition().isDefault() &&
!config.getSlopeCondition().isValid(rdata.getEngine().getComplex().getSlopeStream().get(x, z))) {
return -1;
}
// Rotation calculation
int slopeRotationY = 0;
ProceduralStream<Double> heightStream = rdata.getEngine().getComplex().getHeightStream();
if (config.isRotateTowardsSlope()) {
// Whichever side of the rectangle that bounds the object is lowest is the 'direction' of the slope (simply said).
double hNorth = heightStream.get(x, z + ((float) d) / 2);
double hEast = heightStream.get(x + ((float) w) / 2, z);
double hSouth = heightStream.get(x, z - ((float) d) / 2);
double hWest = heightStream.get(x - ((float) w) / 2, z);
double min = Math.min(Math.min(hNorth, hEast), Math.min(hSouth, hWest));
if (min == hNorth) {
slopeRotationY = 0;
} else if (min == hEast) {
slopeRotationY = 90;
} else if (min == hSouth) {
slopeRotationY = 180;
} else if (min == hWest) {
slopeRotationY = 270;
}
}
double newRotation = config.getRotation().getYAxis().getMin() + slopeRotationY;
config.getRotation().setYAxis(new IrisAxisRotationClamp(true, false, newRotation, newRotation, 360));
config.getRotation().setEnabled(true);
}
if (config.isSmartBore()) {
ensureSmartBored(placer.isDebugSmartBore());
}

View File

@@ -62,6 +62,11 @@ public class IrisObjectPlacement {
private double snow = 0;
@Desc("Whether or not this object can be targeted by a dolphin.")
private boolean isDolphinTarget = false;
@Desc("The slope at which this object can be placed. Range from 0 to 10 by default. Calculated from a 3-block radius from the center of the object placement.")
private IrisSlopeClip slopeCondition = new IrisSlopeClip();
@Desc("Set to true to add the rotation of the direction of the slope of the terrain (wherever the slope is going down) to the y-axis rotation of the object." +
"Rounded to 90 degrees. Adds the *min* rotation of the y axis as well (to still allow you to rotate objects nicely). Discards *max* and *interval* on *yaxis*")
private boolean rotateTowardsSlope = false;
@MinNumber(0)
@MaxNumber(1)
@Desc("The chance for this to place in a chunk. If you need multiple per chunk, set this to 1 and use density.")

View File

@@ -76,17 +76,17 @@ public class IrisSpawner extends IrisRegistrant {
public boolean isValid(IrisBiome biome) {
return switch (group) {
case NORMAL -> switch (biome.getInferredType()) {
case SHORE, SEA, CAVE, DEFER -> false;
case SHORE, SEA, CAVE -> false;
case LAND -> true;
};
case CAVE -> true;
case UNDERWATER -> switch (biome.getInferredType()) {
case SHORE, LAND, CAVE, DEFER -> false;
case SHORE, LAND, CAVE -> false;
case SEA -> true;
};
case BEACH -> switch (biome.getInferredType()) {
case SHORE -> true;
case LAND, CAVE, SEA, DEFER -> false;
case LAND, CAVE, SEA -> false;
};
};
}

View File

@@ -20,7 +20,7 @@ package com.volmit.iris.engine.platform;
import com.volmit.iris.Iris;
import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.core.nms.v19_3.CustomBiomeSource;
import com.volmit.iris.core.nms.v19_4.CustomBiomeSource;
import com.volmit.iris.core.service.StudioSVC;
import com.volmit.iris.engine.IrisEngine;
import com.volmit.iris.engine.data.chunk.TerrainChunk;
@@ -46,7 +46,7 @@ import net.minecraft.server.level.ServerLevel;
import org.bukkit.*;
import org.bukkit.block.Biome;
import org.bukkit.block.data.BlockData;
import org.bukkit.craftbukkit.v1_19_R2.CraftWorld;
import org.bukkit.craftbukkit.v1_19_R3.CraftWorld;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@@ -92,6 +92,8 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
@Setter
private StudioGenerator studioGenerator;
private boolean initialized = false;
public BukkitChunkGenerator(IrisWorld world, boolean studio, File dataLocation, String dimensionKey) {
setup = new AtomicBoolean(false);
studioGenerator = null;
@@ -124,21 +126,23 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
@EventHandler
public void onWorldInit(WorldInitEvent event) {
try {
if (world.name().equals(event.getWorld().getName()) && world.getRawWorldSeed() == event.getWorld().getSeed()) {
ServerLevel serverLevel = ((CraftWorld) event.getWorld()).getHandle();
Engine engine = getEngine(event.getWorld());
Class<?> clazz = serverLevel.getChunkSource().chunkMap.generator.getClass();
Field biomeSource = getField(clazz, "b");
biomeSource.setAccessible(true);
Field unsafeField = Unsafe.class.getDeclaredField("theUnsafe");
unsafeField.setAccessible(true);
Unsafe unsafe = (Unsafe) unsafeField.get(null);
CustomBiomeSource customBiomeSource = new CustomBiomeSource(event.getWorld().getSeed(), engine, event.getWorld());
unsafe.putObject(biomeSource.get(serverLevel.getChunkSource().chunkMap.generator), unsafe.objectFieldOffset(biomeSource), customBiomeSource);
biomeSource.set(serverLevel.getChunkSource().chunkMap.generator, customBiomeSource);
Iris.info("Injected Iris Biome Source into " + event.getWorld().getName());
} else {
Iris.info("World " + event.getWorld().getName() + " is not an Iris world in this context");
if(!initialized) {
world.setRawWorldSeed(event.getWorld().getSeed());
if (world.name().equals(event.getWorld().getName())) {
ServerLevel serverLevel = ((CraftWorld) event.getWorld()).getHandle();
Engine engine = getEngine(event.getWorld());
Class<?> clazz = serverLevel.getChunkSource().chunkMap.generator.getClass();
Field biomeSource = getField(clazz, "b");
biomeSource.setAccessible(true);
Field unsafeField = Unsafe.class.getDeclaredField("theUnsafe");
unsafeField.setAccessible(true);
Unsafe unsafe = (Unsafe) unsafeField.get(null);
CustomBiomeSource customBiomeSource = new CustomBiomeSource(event.getWorld().getSeed(), engine, event.getWorld());
unsafe.putObject(biomeSource.get(serverLevel.getChunkSource().chunkMap.generator), unsafe.objectFieldOffset(biomeSource), customBiomeSource);
biomeSource.set(serverLevel.getChunkSource().chunkMap.generator, customBiomeSource);
Iris.info("Injected Iris Biome Source into " + event.getWorld().getName());
initialized = true;
}
}
} catch (Throwable e) {
e.printStackTrace();

View File

@@ -9,7 +9,7 @@ import org.jetbrains.annotations.NotNull;
import java.util.List;
public class DummyBiomeProvider extends BiomeProvider {
private final List<Biome> ALL = new KList<>(Biome.values()).qdel(Biome.CUSTOM);
private final List<Biome> ALL = new KList<>(Biome.values()).qdel(Biome.CHERRY_GROVE).qdel(Biome.CUSTOM);
@NotNull
@Override

View File

@@ -20,6 +20,7 @@ package com.volmit.iris.util.data;
import com.volmit.iris.Iris;
import com.volmit.iris.core.IrisSettings;
import com.volmit.iris.core.link.Identifier;
import com.volmit.iris.core.service.ExternalDataSVC;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.collection.KMap;
@@ -27,7 +28,6 @@ import com.volmit.iris.util.scheduling.ChronoLatch;
import it.unimi.dsi.fastutil.ints.*;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Waterlogged;
import org.bukkit.block.data.type.Leaves;
@@ -471,7 +471,7 @@ public class B {
BlockData bx = null;
if (!ix.startsWith("minecraft:") && ix.contains(":")) {
NamespacedKey key = NamespacedKey.fromString(ix);
Identifier key = Identifier.fromString(ix);
Optional<BlockData> bd = Iris.service(ExternalDataSVC.class).getBlockData(key);
if (bd.isPresent())
bx = bd.get();
@@ -647,7 +647,7 @@ public class B {
}
}
for (NamespacedKey id : Iris.service(ExternalDataSVC.class).getAllIdentifiers())
for (Identifier id : Iris.service(ExternalDataSVC.class).getAllBlockIdentifiers())
bt.add(id.toString());
bt.addAll(custom.k());
@@ -662,6 +662,9 @@ public class B {
bt.add(v);
}
for (Identifier id : Iris.service(ExternalDataSVC.class).getAllItemIdentifiers())
bt.add(id.toString());
return bt.toArray(new String[0]);
}

View File

@@ -0,0 +1,39 @@
/*
* 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.util.decree.context;
import com.volmit.iris.core.tools.IrisToolbelt;
import com.volmit.iris.engine.object.IrisBiome;
import com.volmit.iris.util.decree.DecreeContextHandler;
import com.volmit.iris.util.plugin.VolmitSender;
import org.bukkit.util.Vector;
public class VectorContextHandler implements DecreeContextHandler<Vector> {
public Class<Vector> getType() {
return Vector.class;
}
public Vector handle(VolmitSender sender) {
if (sender.isPlayer()) {
return sender.player().getLocation().toVector();
}
return null;
}
}

View File

@@ -70,7 +70,7 @@ public class DimensionHandler implements DecreeParameterHandler<IrisDimension> {
try {
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).toList().get(0);
} catch (Throwable e) {
throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\"");
throw new DecreeParsingException("Unable to filter which Dimension \"" + in + "\"");
}
}

View File

@@ -83,7 +83,7 @@ public class EntityHandler implements DecreeParameterHandler<IrisEntity> {
try {
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0);
} catch (Throwable e) {
throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\"");
throw new DecreeParsingException("Unable to filter which Entity \"" + in + "\"");
}
}

View File

@@ -64,7 +64,7 @@ public class GeneratorHandler implements DecreeParameterHandler<IrisGenerator> {
try {
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0);
} catch (Throwable e) {
throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\"");
throw new DecreeParsingException("Unable to filter which Generator \"" + in + "\"");
}
}

View File

@@ -48,7 +48,7 @@ public class PlayerHandler implements DecreeParameterHandler<Player> {
try {
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0);
} catch (Throwable e) {
throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\"");
throw new DecreeParsingException("Unable to filter which Player \"" + in + "\"");
}
}

View File

@@ -67,7 +67,7 @@ public class RegionHandler implements DecreeParameterHandler<IrisRegion> {
try {
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0);
} catch (Throwable e) {
throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\"");
throw new DecreeParsingException("Unable to filter which Region \"" + in + "\"");
}
}

View File

@@ -64,7 +64,7 @@ public class ScriptHandler implements DecreeParameterHandler<IrisScript> {
try {
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0);
} catch (Throwable e) {
throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\"");
throw new DecreeParsingException("Unable to filter which Script \"" + in + "\"");
}
}

View File

@@ -53,7 +53,7 @@ public class WorldHandler implements DecreeParameterHandler<World> {
try {
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0);
} catch (Throwable e) {
throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\"");
throw new DecreeParsingException("Unable to filter which World \"" + in + "\"");
}
}

View File

@@ -58,7 +58,7 @@ public class ObjectHandler implements DecreeParameterHandler<String> {
try {
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0);
} catch (Throwable e) {
throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\"");
throw new DecreeParsingException("Unable to filter which Object \"" + in + "\"");
}
}

View File

@@ -23,10 +23,7 @@ import com.volmit.iris.core.IrisSettings;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.collection.KMap;
import com.volmit.iris.util.collection.KSet;
import com.volmit.iris.util.decree.DecreeContext;
import com.volmit.iris.util.decree.DecreeContextHandler;
import com.volmit.iris.util.decree.DecreeNode;
import com.volmit.iris.util.decree.DecreeParameter;
import com.volmit.iris.util.decree.*;
import com.volmit.iris.util.decree.annotations.Decree;
import com.volmit.iris.util.decree.exceptions.DecreeParsingException;
import com.volmit.iris.util.format.C;
@@ -381,6 +378,12 @@ public class VirtualDecreeCommand {
return false;
}
DecreeOrigin origin = type.getDeclaredAnnotation(Decree.class).origin();
if (!origin.validFor(sender)) {
sender.sendMessage(C.RED + "This command has to be sent from another origin: " + C.GOLD + origin);
return false;
}
Iris.debug("@ " + getPath() + " with " + args.toString(", "));
if (isNode()) {
Iris.debug("Invoke " + getPath() + "(" + args.toString(",") + ") at ");

View File

@@ -0,0 +1,42 @@
package com.volmit.iris.util.reflect;
import com.volmit.iris.Iris;
import java.lang.reflect.Field;
public class WrappedField<C, T> {
private final Field field;
public WrappedField(Class<C> origin, String methodName) {
Field f = null;
try {
f = origin.getDeclaredField(methodName);
f.setAccessible(true);
} catch(NoSuchFieldException e) {
Iris.error("Failed to created WrappedField %s#%s: %s%s", origin.getSimpleName(), methodName, e.getClass().getSimpleName(), e.getMessage().equals("") ? "" : " | " + e.getMessage());
}
this.field = f;
}
public T get() {
return get(null);
}
public T get(C instance) {
if(field == null) {
return null;
}
try {
return (T)field.get(instance);
} catch(IllegalAccessException e) {
Iris.error("Failed to get WrappedField %s#%s: %s%s", field.getDeclaringClass().getSimpleName(), field.getName(), e.getClass().getSimpleName(), e.getMessage().equals("") ? "" : " | " + e.getMessage());
return null;
}
}
public boolean hasFailed() {
return field == null;
}
}

View File

@@ -0,0 +1,39 @@
package com.volmit.iris.util.reflect;
import com.volmit.iris.Iris;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
public final class WrappedReturningMethod<C, R> {
private final Method method;
public WrappedReturningMethod(Class<C> origin, String methodName, Class<?>... paramTypes) {
Method m = null;
try {
m = origin.getDeclaredMethod(methodName, paramTypes);
m.setAccessible(true);
} catch(NoSuchMethodException e) {
Iris.error("Failed to created WrappedMethod %s#%s: %s%s", origin.getSimpleName(), methodName, e.getClass().getSimpleName(), e.getMessage().equals("") ? "" : " | " + e.getMessage());
}
this.method = m;
}
public R invoke(Object... args) {
return invoke(null, args);
}
public R invoke(C instance, Object... args) {
if(method == null) {
return null;
}
try {
return (R)method.invoke(instance, args);
} catch(InvocationTargetException | IllegalAccessException e) {
Iris.error("Failed to invoke WrappedMethod %s#%s: %s%s", method.getDeclaringClass().getSimpleName(), method.getName(), e.getClass().getSimpleName(), e.getMessage().equals("") ? "" : " | " + e.getMessage());
return null;
}
}
}

View File

@@ -21,4 +21,6 @@ commands:
iris:
aliases: [ ir, irs ]
api-version: ${apiversion}
softdepend:
- ItemsAdder
hotload-dependencies: false