Chonker of an update
This commit is contained in:
Brian Fopiano 2022-05-19 15:44:56 -07:00 committed by GitHub
commit b7a892ecfe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
34 changed files with 524 additions and 287 deletions

View File

@ -24,7 +24,7 @@ plugins {
id "de.undercouch.download" version "5.0.1"
}
version '2.0.7-1.18.2' // Needs to be version specific
version '2.1.0-1.18.2' // Needs to be version specific
def nmsVersion = "1.18.2"
def apiVersion = '1.18'
def spigotJarVersion = '1.18.2-R0.1-SNAPSHOT'
@ -76,6 +76,7 @@ repositories {
maven { url "https://dl.cloudsmith.io/public/arcane/archive/maven/" }
mavenCentral()
mavenLocal()
maven { url "https://jitpack.io"}
}
/**
@ -126,6 +127,7 @@ dependencies {
implementation 'me.clip:placeholderapi:2.11.1'
implementation 'io.th0rgal:oraxen:1.94.0'
implementation 'org.bukkit:craftbukkit:1.18.2-R0.1-SNAPSHOT:remapped-mojang'
implementation 'com.github.LoneDev6:api-itemsadder:3.1.0b'
// Shaded
implementation 'com.dfsek:Paralithic:0.4.0'

View File

@ -18,27 +18,24 @@
package com.volmit.iris;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import com.google.gson.JsonParser;
import com.google.gson.stream.JsonReader;
import com.volmit.iris.core.IrisSettings;
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.link.*;
import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.core.nms.INMS;
import com.volmit.iris.core.service.StudioSVC;
import com.volmit.iris.core.tools.IrisToolbelt;
import com.volmit.iris.engine.EnginePanic;
import com.volmit.iris.engine.object.IrisBiome;
import com.volmit.iris.engine.object.IrisCompat;
import com.volmit.iris.engine.object.IrisDimension;
import com.volmit.iris.engine.object.IrisObject;
import com.volmit.iris.engine.object.IrisWorld;
import com.volmit.iris.engine.platform.BukkitChunkGenerator;
import com.volmit.iris.engine.platform.DummyChunkGenerator;
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.exceptions.IrisException;
import com.volmit.iris.util.format.C;
import com.volmit.iris.util.format.Form;
@ -46,8 +43,6 @@ import com.volmit.iris.util.function.NastyRunnable;
import com.volmit.iris.util.io.*;
import com.volmit.iris.util.math.M;
import com.volmit.iris.util.math.RNG;
import com.volmit.iris.util.matter.IrisMatter;
import com.volmit.iris.util.matter.Matter;
import com.volmit.iris.util.parallel.MultiBurst;
import com.volmit.iris.util.plugin.IrisService;
import com.volmit.iris.util.plugin.Metrics;
@ -63,16 +58,12 @@ import net.kyori.adventure.text.serializer.ComponentSerializer;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.WorldCreator;
import org.bukkit.block.data.BlockData;
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.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
@ -84,15 +75,12 @@ import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.*;
import java.lang.annotation.Annotation;
import java.net.URL;
import java.util.Date;
import java.util.Map;
import java.util.Objects;
@SuppressWarnings("CanBeFinal")
public class Iris extends VolmitPlugin implements Listener {
@ -100,7 +88,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;
@ -405,7 +392,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);
@ -690,17 +676,51 @@ public class Iris extends VolmitPlugin implements Listener {
String padd2 = Form.repeat(" ", 4);
String[] info = {"", "", "", "", "", padd2 + C.IRIS + " Iris", padd2 + C.GRAY + " by " + "<rainbow>Volmit Software", padd2 + C.GRAY + " v" + C.IRIS + getDescription().getVersion(),
};
String[] splash = {padd + C.GRAY + " @@@@@@@@@@@@@@" + C.DARK_GRAY + "@@@", padd + C.GRAY + " @@&&&&&&&&&" + C.DARK_GRAY + "&&&&&&" + C.IRIS + " .(((()))). ", padd + C.GRAY + "@@@&&&&&&&&" + C.DARK_GRAY + "&&&&&" + C.IRIS + " .((((((())))))). ", padd + C.GRAY + "@@@&&&&&" + C.DARK_GRAY + "&&&&&&&" + C.IRIS + " ((((((((())))))))) " + C.GRAY + " @", padd + C.GRAY + "@@@&&&&" + C.DARK_GRAY + "@@@@@&" + C.IRIS + " ((((((((-))))))))) " + C.GRAY + " @@", padd + C.GRAY + "@@@&&" + C.IRIS + " ((((((({ })))))))) " + C.GRAY + " &&@@@", padd + C.GRAY + "@@" + C.IRIS + " ((((((((-))))))))) " + C.DARK_GRAY + "&@@@@@" + C.GRAY + "&&&&@@@", padd + C.GRAY + "@" + C.IRIS + " ((((((((())))))))) " + C.DARK_GRAY + "&&&&&" + C.GRAY + "&&&&&&&@@@", padd + C.GRAY + "" + C.IRIS + " '((((((()))))))' " + C.DARK_GRAY + "&&&&&" + C.GRAY + "&&&&&&&&@@@", padd + C.GRAY + "" + C.IRIS + " '(((())))' " + C.DARK_GRAY + "&&&&&&&&" + C.GRAY + "&&&&&&&@@", padd + C.GRAY + " " + C.DARK_GRAY + "@@@" + C.GRAY + "@@@@@@@@@@@@@@"
String[] splash = {
padd + C.GRAY + " @@@@@@@@@@@@@@" + C.DARK_GRAY + "@@@",
padd + C.GRAY + " @@&&&&&&&&&" + C.DARK_GRAY + "&&&&&&" + C.IRIS + " .(((()))). ",
padd + C.GRAY + "@@@&&&&&&&&" + C.DARK_GRAY + "&&&&&" + C.IRIS + " .((((((())))))). ",
padd + C.GRAY + "@@@&&&&&" + C.DARK_GRAY + "&&&&&&&" + C.IRIS + " ((((((((())))))))) " + C.GRAY + " @",
padd + C.GRAY + "@@@&&&&" + C.DARK_GRAY + "@@@@@&" + C.IRIS + " ((((((((-))))))))) " + C.GRAY + " @@",
padd + C.GRAY + "@@@&&" + C.IRIS + " ((((((({ })))))))) " + C.GRAY + " &&@@@",
padd + C.GRAY + "@@" + C.IRIS + " ((((((((-))))))))) " + C.DARK_GRAY + "&@@@@@" + C.GRAY + "&&&&@@@",
padd + C.GRAY + "@" + C.IRIS + " ((((((((())))))))) " + C.DARK_GRAY + "&&&&&" + C.GRAY + "&&&&&&&@@@",
padd + C.GRAY + "" + C.IRIS + " '((((((()))))))' " + C.DARK_GRAY + "&&&&&" + C.GRAY + "&&&&&&&&@@@",
padd + C.GRAY + "" + C.IRIS + " '(((())))' " + C.DARK_GRAY + "&&&&&&&&" + C.GRAY + "&&&&&&&@@",
padd + C.GRAY + " " + C.DARK_GRAY + "@@@" + C.GRAY + "@@@@@@@@@@@@@@"
};
//@done
Iris.info("Server type & version: " + Bukkit.getVersion());
Iris.info("Bukkit version: " + Bukkit.getBukkitVersion());
Iris.info("Java version: " + getJavaVersion());
Iris.info("Custom Biomes: " + INMS.get().countCustomBiomes());
printPacks();
for(int i = 0; i < info.length; i++) {
splash[i] += info[i];
}
Iris.info("\n\n " + new KList<>(splash).toString("\n") + "\n");
}
private void printPacks() {
File packFolder = Iris.service(StudioSVC.class).getWorkspaceFolder();
File[] packs = packFolder.listFiles(File::isDirectory);
if(packs == null || packs.length == 0)
return;
Iris.info("Custom Dimensions: " + packs.length);
for(File f : packs)
printPack(f);
}
private void printPack(File pack) {
String dimName = pack.getName();
String version = "???";
try(FileReader r = new FileReader(new File(pack, "dimensions/" + dimName + ".json"))) {
JsonObject json = JsonParser.parseReader(r).getAsJsonObject();
if(json.has("version"))
version = json.get("version").getAsString();
} catch(IOException | JsonParseException ignored) { }
Iris.info(" " + dimName + " v" + version);
}
}

View File

@ -76,7 +76,7 @@ public class CommandIris implements DecreeExecutor {
return;
}
sender().sendMessage(C.RED + "You should not be using this command to create new worlds. Instead, use /mvc " + name + " NORMAL -g Iris:" + type.getName());
sender().sendMessage(C.RED + "You should not be using this command to create new worlds. Instead, use the tutorial: https://docs.volmit.com/iris/getting-started");
try {
IrisToolbelt.createWorld()

View File

@ -36,12 +36,11 @@ public class BlockSignal {
public BlockSignal(Block block, int ticks) {
active.incrementAndGet();
Location tg = block.getLocation().clone().add(0.5, 0, 0.5).clone();
FallingBlock e = block.getWorld().spawnFallingBlock(tg.clone(), block.getBlockData());
Location tg = block.getLocation().clone().add(0.5, 0, 0.5);
FallingBlock e = block.getWorld().spawnFallingBlock(tg, block.getBlockData());
e.setGravity(false);
e.setInvulnerable(true);
e.setGlowing(true);
e.teleport(tg.clone());
e.setDropItem(false);
e.setHurtEntities(false);
e.setSilent(true);

View File

@ -49,7 +49,7 @@ public class DustRevealer {
this.hits = hits;
J.s(() -> {
new BlockSignal(world.getBlockAt(block.getX(), block.getY(), block.getZ()), 7);
new BlockSignal(world.getBlockAt(block.getX(), block.getY(), block.getZ()), 10);
if(M.r(0.25)) {
world.playSound(block.toBlock(world).getLocation(), Sound.BLOCK_AMETHYST_BLOCK_CHIME, 1f, RNG.r.f(0.2f, 2f));
}
@ -98,8 +98,7 @@ public class DustRevealer {
Engine access = IrisToolbelt.access(world).getEngine();
if(access != null) {
String a = access.getObjectPlacementKey(block.getX(), block.getY(), block.getZ());
String a = access.getObjectPlacementKey(block.getX(), block.getY() - block.getWorld().getMinHeight(), block.getZ());
if(a != null) {
world.playSound(block.getLocation(), Sound.ITEM_LODESTONE_COMPASS_LOCK, 1f, 0.1f);
@ -112,7 +111,8 @@ public class DustRevealer {
}
private boolean is(BlockPosition a) {
if(isValidTry(a) && engine.getObjectPlacementKey(a.getX(), a.getY(), a.getZ()) != null && engine.getObjectPlacementKey(a.getX(), a.getY(), a.getZ()).equals(key)) {
int betterY = a.getY() - world.getMinHeight();
if(isValidTry(a) && engine.getObjectPlacementKey(a.getX(), betterY, a.getZ()) != null && engine.getObjectPlacementKey(a.getX(), betterY, a.getZ()).equals(key)) {
hits.add(a);
new DustRevealer(engine, world, a, key, hits);
return true;

View File

@ -19,6 +19,7 @@
package com.volmit.iris.core.edit;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.volmit.iris.Iris;
import com.volmit.iris.core.service.WandSVC;
import com.volmit.iris.engine.object.IrisDirection;
@ -26,6 +27,7 @@ import com.volmit.iris.engine.object.IrisJigsawPiece;
import com.volmit.iris.engine.object.IrisJigsawPieceConnector;
import com.volmit.iris.engine.object.IrisObject;
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.data.Cuboid;
import com.volmit.iris.util.io.IO;
@ -47,6 +49,7 @@ import org.bukkit.util.Vector;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.ExecutionException;
public class JigsawEditor implements Listener {
@ -154,10 +157,50 @@ public class JigsawEditor implements Listener {
}
}
private void removeKey(JSONObject o, String... path)
{
if(path.length == 1)
{
o.remove(path[0]);
return;
}
List<String> s = new java.util.ArrayList<>(List.of(path));
s.remove(0);
removeKey(o.getJSONObject(path[0]), s.toArray(new String[0]));
}
private List<JSONObject> getObjectsInArray(JSONObject a, String key)
{
KList<JSONObject> o = new KList<>();
for(int i = 0; i < a.getJSONArray(key).length(); i++)
{
o.add(a.getJSONArray(key).getJSONObject(i));
}
return o;
}
public void close() {
exit();
try {
IO.writeAll(targetSaveLocation, new JSONObject(new Gson().toJson(piece)).toString(4));
JSONObject j = new JSONObject(new Gson().toJson(piece));
// Remove sub-key
removeKey(j, "placementOptions", "translateCenter"); // should work
J.attempt(() -> j.getJSONObject("placementOptions").remove("translateCenter")); // otherwise
// remove root key
removeKey(j, "placementOptions"); // should work
j.remove("placementOptions"); // otherwise
// Remove key in all objects in array
for(JSONObject i : getObjectsInArray(j, "connectors"))
{
removeKey(i, "rotateConnector");
}
IO.writeAll(targetSaveLocation, j.toString(4));
} catch(IOException e) {
Iris.reportError(e);
e.printStackTrace();

View File

@ -0,0 +1,36 @@
package com.volmit.iris.core.link;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.bukkit.Bukkit;
import org.bukkit.NamespacedKey;
import org.bukkit.block.data.BlockData;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin;
import java.util.MissingResourceException;
@RequiredArgsConstructor
public abstract class ExternalDataProvider {
@Getter
private final String pluginId;
public Plugin getPlugin() {
return Bukkit.getPluginManager().getPlugin(pluginId);
}
public boolean isPresent() {
return getPlugin() != null;
}
public abstract void init();
public abstract BlockData getBlockData(NamespacedKey blockId) throws MissingResourceException;
public abstract ItemStack getItemStack(NamespacedKey itemId) throws MissingResourceException;
public abstract NamespacedKey[] getBlockTypes();
public abstract boolean isValidProvider(NamespacedKey namespace);
}

View File

@ -0,0 +1,51 @@
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;
import java.util.MissingResourceException;
public class ItemAdderDataProvider extends ExternalDataProvider {
public ItemAdderDataProvider() {
super("ItemsAdder");
}
@Override
public void init() { }
@Override
public BlockData getBlockData(NamespacedKey blockId) throws MissingResourceException {
return CustomBlock.getBaseBlockData(blockId.toString());
}
@Override
public ItemStack getItemStack(NamespacedKey itemId) throws MissingResourceException {
CustomStack stack = CustomStack.getInstance(itemId.toString());
if(stack == null)
throw new MissingResourceException("Failed to find ItemData!", itemId.getNamespace(), itemId.getKey());
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]);
}
@Override
public boolean isValidProvider(NamespacedKey blockId) {
for(NamespacedKey k : getBlockTypes())
if(k.equals(blockId)) {
return true;
}
return false;
}
}

View File

@ -0,0 +1,112 @@
/*
* 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.Iris;
import com.volmit.iris.util.collection.KList;
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 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;
import java.lang.reflect.Field;
import java.util.Map;
import java.util.MissingResourceException;
import java.util.Optional;
public class OraxenDataProvider extends ExternalDataProvider {
private static final String FIELD_FACTORIES_MAP = "FACTORIES_BY_MECHANIC_ID";
private Map<String, MechanicFactory> factories;
public OraxenDataProvider() { super("Oraxen"); }
@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());
}
}
@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) {
MultipleFacing newBlockData = (MultipleFacing) Bukkit.createBlockData(Material.MUSHROOM_STEM);
Utils.setBlockFacing(newBlockData, ((BlockMechanic)f.getMechanic(blockId.getKey())).getCustomVariation());
return newBlockData;
} else
throw new MissingResourceException("Failed to find BlockData!", blockId.getNamespace(), blockId.getKey());
}
@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();
}
@Override
public NamespacedKey[] getBlockTypes() {
KList<NamespacedKey> names = new KList<>();
for(String name : OraxenItems.getItemNames()) {
try {
NamespacedKey key = new NamespacedKey("oraxen", name);
if(getBlockData(key) != null)
names.add(key);
} catch(MissingResourceException ignored) { }
}
return names.toArray(new NamespacedKey[0]);
}
@Override
public boolean isPresent() {
return super.isPresent() && factories != null;
}
@Override
public boolean isValidProvider(NamespacedKey key) {
return key.getNamespace().equalsIgnoreCase("oraxen");
}
private MechanicFactory getFactory(NamespacedKey key) throws MissingResourceException {
return factories.values().stream()
.filter(i -> i.getItems().contains(key.getKey()))
.findFirst()
.orElseThrow(() -> new MissingResourceException("Failed to find BlockData!", key.getNamespace(), key.getKey()));
}
}

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

@ -75,6 +75,7 @@ public class IrisData implements ExclusionStrategy, TypeAdapterFactory {
private ResourceLoader<IrisScript> scriptLoader;
private ResourceLoader<IrisCave> caveLoader;
private ResourceLoader<IrisRavine> ravineLoader;
private ResourceLoader<IrisMatterObject> matterObjectLoader;
private KMap<String, KList<String>> possibleSnippets;
private Gson gson;
private Gson snippetLoader;
@ -337,6 +338,7 @@ public class IrisData implements ExclusionStrategy, TypeAdapterFactory {
this.objectLoader = registerLoader(IrisObject.class);
this.imageLoader = registerLoader(IrisImage.class);
this.scriptLoader = registerLoader(IrisScript.class);
this.matterObjectLoader = registerLoader(IrisMatterObject.class);
gson = builder.create();
}

View File

@ -0,0 +1,86 @@
/*
* 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.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.util.collection.KList;
import com.volmit.iris.util.plugin.IrisService;
import lombok.Data;
import org.bukkit.NamespacedKey;
import org.bukkit.block.data.BlockData;
import org.bukkit.inventory.ItemStack;
import java.util.MissingResourceException;
import java.util.Optional;
@Data
public class ExternalDataSVC implements IrisService {
private KList<ExternalDataProvider> providers = new KList<>();
@Override
public void onEnable() {
addProvider(new OraxenDataProvider(), new ItemAdderDataProvider());
}
@Override
public void onDisable() { }
public void addProvider(ExternalDataProvider... provider) {
for(ExternalDataProvider p : provider) {
if(p.getPlugin() != null) {
providers.add(p);
p.init();
}
}
}
public Optional<BlockData> getBlockData(NamespacedKey key) {
Optional<ExternalDataProvider> provider = providers.stream().filter(p -> p.isPresent() && p.isValidProvider(key)).findFirst();
if(provider.isEmpty())
return Optional.empty();
try {
return Optional.of(provider.get().getBlockData(key));
} catch(MissingResourceException e) {
Iris.error(e.getMessage() + " - [" + e.getClassName() + ":" + e.getKey() + "]");
return Optional.empty();
}
}
public Optional<ItemStack> getItemStack(NamespacedKey key) {
Optional<ExternalDataProvider> provider = providers.stream().filter(p -> p.isPresent() && p.isValidProvider(key)).findFirst();
if(provider.isEmpty())
return Optional.empty();
try {
return Optional.of(provider.get().getItemStack(key));
} catch(MissingResourceException e) {
Iris.error(e.getMessage() + " - [" + e.getClassName() + ":" + e.getKey() + "]");
return Optional.empty();
}
}
public NamespacedKey[] getAllIdentifiers() {
KList<NamespacedKey> names = new KList<>();
providers.stream().filter(ExternalDataProvider::isPresent).forEach(p -> names.add(p.getBlockTypes()));
return names.toArray(new NamespacedKey[0]);
}
}

View File

@ -1,41 +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.service;
import com.volmit.iris.util.plugin.IrisService;
import com.volmit.iris.util.plugin.PluginRegistryGroup;
import lombok.Data;
import org.bukkit.block.data.BlockData;
import java.util.function.Supplier;
@Data
public class RegistrySVC implements IrisService {
private PluginRegistryGroup<Supplier<BlockData>> customBlockRegistry;
@Override
public void onEnable() {
customBlockRegistry = new PluginRegistryGroup<>();
}
@Override
public void onDisable() {
}
}

View File

@ -315,7 +315,6 @@ public class StudioSVC implements IrisService {
return activeProject != null && activeProject.isOpen();
}
public void open(VolmitSender sender, String dimm) {
open(sender, 1337, dimm);
}

View File

@ -42,6 +42,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
@ -388,6 +389,8 @@ public class WandSVC implements IrisService {
@EventHandler
public void on(PlayerInteractEvent e) {
if(e.getHand() != EquipmentSlot.HAND)
return;
try {
if(isHoldingWand(e.getPlayer())) {
if(e.getAction().equals(Action.LEFT_CLICK_BLOCK)) {
@ -408,7 +411,6 @@ public class WandSVC implements IrisService {
e.setCancelled(true);
e.getPlayer().playSound(Objects.requireNonNull(e.getClickedBlock()).getLocation(), Sound.ENTITY_ENDER_EYE_DEATH, 2f, 1.97f);
DustRevealer.spawn(e.getClickedBlock(), new VolmitSender(e.getPlayer(), Iris.instance.getTag()));
}
}
} catch(Throwable xx) {

View File

@ -116,8 +116,24 @@ public class IrisToolbelt {
public static PlatformChunkGenerator access(World world) {
if(isIrisWorld(world)) {
return ((PlatformChunkGenerator) world.getGenerator());
}
} /*else {
Iris.warn("""
"---------- No World? ---------------
""");
}*/
return null;
}

View File

@ -21,6 +21,7 @@ package com.volmit.iris.engine;
import com.google.common.util.concurrent.AtomicDouble;
import com.google.gson.Gson;
import com.volmit.iris.Iris;
import com.volmit.iris.core.ServerConfigurator;
import com.volmit.iris.core.events.IrisEngineHotloadEvent;
import com.volmit.iris.core.gui.PregeneratorJob;
import com.volmit.iris.core.project.IrisProject;
@ -233,6 +234,7 @@ public class IrisEngine implements Engine {
getTarget().setDimension(getData().getDimensionLoader().load(getDimension().getLoadKey()));
prehotload();
setupEngine();
J.a(() -> { synchronized(ServerConfigurator.class) { ServerConfigurator.installDataPacks(false); } });
}
@Override

View File

@ -472,6 +472,8 @@ public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdat
int b = 4;
for(IrisLootTable i : tables) {
if(i == null)
continue;
b++;
items.addAll(i.getLoot(debug, items.isEmpty(), rng, slot, x, y, z, b + b, mgf + b));
}
@ -746,7 +748,6 @@ public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdat
default PlacedObject getObjectPlacement(int x, int y, int z) {
String objectAt = getMantle().getMantle().get(x, y, z, String.class);
if(objectAt == null || objectAt.isEmpty()) {
return null;
}

View File

@ -47,14 +47,14 @@ public class IrisBiomeGeneratorLink {
private String generator = "default";
@DependsOn({"min", "max"})
@Required
@MinNumber(-256) // TODO: WARNING HEIGHT
@MaxNumber(256) // TODO: WARNING HEIGHT
@MinNumber(-2032) // TODO: WARNING HEIGHT
@MaxNumber(2032) // TODO: WARNING HEIGHT
@Desc("The min block value (value + fluidHeight)")
private int min = 0;
@DependsOn({"min", "max"})
@Required
@MinNumber(-256) // TODO: WARNING HEIGHT
@MaxNumber(256) // TODO: WARNING HEIGHT
@MinNumber(-2032) // TODO: WARNING HEIGHT
@MaxNumber(2032) // TODO: WARNING HEIGHT
@Desc("The max block value (value + fluidHeight)")
private int max = 0;

View File

@ -50,13 +50,13 @@ public class IrisBiomePaletteLayer {
private IrisGeneratorStyle style = NoiseStyle.STATIC.style();
@DependsOn({"minHeight", "maxHeight"})
@MinNumber(0)
@MaxNumber(256) // TODO: WARNING HEIGHT
@MaxNumber(2032) // TODO: WARNING HEIGHT
@Desc("The min thickness of this layer")
private int minHeight = 1;
@DependsOn({"minHeight", "maxHeight"})
@MinNumber(1)
@MaxNumber(256) // TODO: WARNING HEIGHT
@MaxNumber(2032) // TODO: WARNING HEIGHT
@Desc("The max thickness of this layer")
private int maxHeight = 1;

View File

@ -65,12 +65,12 @@ public class IrisDecorator {
private IrisDecorationPart partOf = IrisDecorationPart.NONE;
@DependsOn({"stackMin", "stackMax"})
@MinNumber(1)
@MaxNumber(256) // TODO: WARNING HEIGHT
@MaxNumber(2032) // TODO: WARNING HEIGHT
@Desc("The minimum repeat stack height (setting to 3 would stack 3 of <block> on top of each other")
private int stackMin = 1;
@DependsOn({"stackMin", "stackMax"})
@MinNumber(1)
@MaxNumber(256) // TODO: WARNING HEIGHT
@MaxNumber(2032) // TODO: WARNING HEIGHT
@Desc("The maximum repeat stack height")
private int stackMax = 1;
@DependsOn({"stackMin", "stackMax"})

View File

@ -46,12 +46,12 @@ public class IrisDepositGenerator {
private final transient AtomicCache<KList<BlockData>> blockData = new AtomicCache<>();
@Required
@MinNumber(0)
@MaxNumber(256) // TODO: WARNING HEIGHT
@MaxNumber(2032) // TODO: WARNING HEIGHT
@Desc("The minimum height this deposit can generate at")
private int minHeight = 7;
@Required
@MinNumber(0)
@MaxNumber(256) // TODO: WARNING HEIGHT
@MaxNumber(2032) // TODO: WARNING HEIGHT
@Desc("The maximum height this deposit can generate at")
private int maxHeight = 55;
@Required

View File

@ -74,6 +74,7 @@ public class IrisDimension extends IrisRegistrant {
@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;
@ -405,19 +406,10 @@ 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(!dimensionHeight.equals(new IrisRange(-64, 320)) && this.name.equalsIgnoreCase("overworld")) {
Iris.verbose(" Installing Data Pack Dimension Type: \"minecraft:overworld\"");
changed = writeDimensionType(changed, datapacks);
}
if(write) {
File mcm = new File(datapacks, "iris/pack.mcmeta");
@ -455,6 +447,20 @@ 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())
changed = true;
dimType.getParentFile().mkdirs();
try {
IO.writeAll(dimType, generateDatapackJson());
} catch(IOException e) {
Iris.reportError(e);
e.printStackTrace();
}
return changed;
}
private String generateDatapackJson() {
JSONObject obj = new JSONObject(DP_OVERWORLD_DEFAULT);
obj.put("min_y", dimensionHeight.getMin());
@ -465,19 +471,17 @@ public class IrisDimension extends IrisRegistrant {
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",
"infiniburn": "#minecraft:infiniburn_overworld",
"effects": "minecraft:overworld"
}""";
}

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.service.ExternalDataSVC;
import com.volmit.iris.engine.data.cache.AtomicCache;
import com.volmit.iris.engine.object.annotations.ArrayType;
import com.volmit.iris.engine.object.annotations.Desc;
@ -44,6 +45,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_18_R2.inventory.CraftItemStack;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
@ -53,6 +55,7 @@ import org.bukkit.inventory.meta.LeatherArmorMeta;
import org.bukkit.material.Colorable;
import java.awt.Color;
import java.util.Optional;
@Snippet("loot")
@Accessors(chain = true)
@ -117,11 +120,24 @@ public class IrisLoot {
public ItemStack get(boolean debug, RNG rng) {
try {
ItemStack is = new ItemStack(getType(), Math.max(1, rng.i(getMinAmount(), getMaxAmount())));
ItemStack is;
if(!type.startsWith("minecraft:") && type.contains(":")) {
Optional<ItemStack> opt = Iris.service(ExternalDataSVC.class).getItemStack(NamespacedKey.fromString(type));
if(opt.isEmpty()) {
//TODO Better third party provider
Iris.warn("Unknown Material: " + type);
return null;
}
is = opt.get();
is.setAmount(Math.max(1, rng.i(getMinAmount(), getMaxAmount())));
} else {
is = new ItemStack(getType(), Math.max(1, rng.i(getMinAmount(), getMaxAmount())));
}
ItemMeta m = is.getItemMeta();
if(getType().getMaxDurability() > 0 && m instanceof Damageable d) {
int max = getType().getMaxDurability();
if(is.getType().getMaxDurability() > 0 && m instanceof Damageable d) {
int max = is.getType().getMaxDurability();
d.setDamage((int) Math.round(Math.max(0, Math.min(max, (1D - rng.d(getMinDurability(), getMaxDurability())) * max))));
}
@ -184,7 +200,6 @@ public class IrisLoot {
return applyCustomNbt(is);
} catch(Throwable e) {
Iris.reportError(e);
}
return new ItemStack(Material.AIR);
@ -196,17 +211,25 @@ public class IrisLoot {
}
if(giveSomething || chance.aquire(() -> NoiseStyle.STATIC.create(rng)).fit(1, rarity * table.getRarity(), x, y, z) == 1) {
if(getType() == null) {
Iris.warn("Cant find item type " + type);
try {
ItemStack is;
if(!type.startsWith("minecraft:") && type.contains(":")) {
Optional<ItemStack> opt = Iris.service(ExternalDataSVC.class).getItemStack(NamespacedKey.fromString(type));
if(opt.isEmpty()) {
Iris.warn("Unknown Material: " + type);
return null;
}
is = opt.get();
is.setAmount(Math.max(1, rng.i(getMinAmount(), getMaxAmount())));
return is;
} else {
is = new ItemStack(getType(), Math.max(1, rng.i(getMinAmount(), getMaxAmount())));
}
try {
ItemStack is = new ItemStack(getType(), Math.max(1, rng.i(getMinAmount(), getMaxAmount())));
ItemMeta m = is.getItemMeta();
if(getType().getMaxDurability() > 0 && m instanceof Damageable d) {
int max = getType().getMaxDurability();
if(is.getType().getMaxDurability() > 0 && m instanceof Damageable d) {
int max = is.getType().getMaxDurability();
d.setDamage((int) Math.round(Math.max(0, Math.min(max, (1D - rng.d(getMinDurability(), getMaxDurability())) * max))));
}
@ -260,7 +283,8 @@ public class IrisLoot {
is.setItemMeta(m);
return applyCustomNbt(is);
} catch(Throwable e) {
Iris.reportError(e);
//Iris.reportError(e);
e.printStackTrace();
}
}

View File

@ -585,7 +585,7 @@ public class IrisObject extends IrisRegistrant {
}
}
} else if(config.getMode().equals(ObjectPlaceMode.FAST_MIN_HEIGHT)) {
y = 257;
y = rdata.getEngine().getHeight() + 1;
BlockVector offset = new BlockVector(config.getTranslate().getX(), config.getTranslate().getY(), config.getTranslate().getZ());
BlockVector rotatedDimensions = config.getRotation().rotate(new BlockVector(getW(), getH(), getD()), spinx, spiny, spinz).clone();
@ -820,14 +820,27 @@ public class IrisObject extends IrisRegistrant {
i = config.getRotation().rotate(i.clone(), spinx, spiny, spinz).clone();
i = config.getTranslate().translate(i.clone(), config.getRotation(), spinx, spiny, spinz).clone();
if(i.getBlockY() != lowest) {
if(i.getBlockY() != lowest)
continue;
for(IrisObjectReplace j : config.getEdit()) {
if(rng.chance(j.getChance())) {
for(BlockData k : j.getFind(rdata)) {
if(j.isExact() ? k.matches(d) : k.getMaterial().equals(d.getMaterial())) {
BlockData newData = j.getReplace(rng, i.getX() + x, i.getY() + y, i.getZ() + z, rdata).clone();
if(newData.getMaterial() == d.getMaterial()) {
d = d.merge(newData);
} else {
d = newData;
}
}
}
}
}
if(d == null || B.isAir(d)) {
if(d == null || B.isAir(d))
continue;
}
xx = x + (int) Math.round(i.getX());
zz = z + (int) Math.round(i.getZ());
@ -837,7 +850,11 @@ public class IrisObject extends IrisRegistrant {
zz += config.warp(rng, i.getZ() + z, i.getY() + y, i.getX() + x, getLoader());
}
int yg = placer.getHighest(xx, zz, getLoader(), config.isUnderwater());
int yg = placer.getHighest(xx, zz, getLoader(), true);
if(config.isWaterloggable() && yg <= placer.getFluidHeight() && d instanceof Waterlogged) {
((Waterlogged) d).setWaterlogged(true);
}
if(yv >= 0 && config.isBottom()) {
y += Math.floorDiv(h, 2);
@ -1118,7 +1135,5 @@ public class IrisObject extends IrisRegistrant {
}
@Override
public void scanForErrors(JSONObject p, VolmitSender sender) {
}
public void scanForErrors(JSONObject p, VolmitSender sender) { }
}

View File

@ -37,12 +37,12 @@ public class IrisObjectLimit {
@MinNumber(0)
@MaxNumber(1024)
@Desc("The minimum height for placement (bottom of object)")
private int minimumHeight = 0;
private int minimumHeight = -2048; //TODO: WARNING HEIGHT
@MinNumber(0)
@MaxNumber(1024)
@Desc("The maximum height for placement (top of object)")
private int maximumHeight = 255;
private int maximumHeight = 2048; //TODO: WARNING HEIGHT
public boolean canPlace(int h, int l) {
return h <= maximumHeight && l >= minimumHeight;

View File

@ -42,8 +42,8 @@ public class IrisObjectTranslate {
private int x = 0;
@Required
@MinNumber(-256) // TODO: WARNING HEIGHT
@MaxNumber(256) // TODO: WARNING HEIGHT
@MinNumber(-128) // TODO: WARNING HEIGHT
@MaxNumber(128) // TODO: WARNING HEIGHT
@Desc("The x shift in blocks")
private int y = 0;

View File

@ -42,14 +42,14 @@ public class IrisShapedGeneratorStyle {
private IrisGeneratorStyle generator = new IrisGeneratorStyle(NoiseStyle.IRIS);
@Required
@MinNumber(-256) // TODO: WARNING HEIGHT
@MaxNumber(256) // TODO: WARNING HEIGHT
@MinNumber(-2032) // TODO: WARNING HEIGHT
@MaxNumber(2032) // TODO: WARNING HEIGHT
@Desc("The min block value")
private int min = 0;
@Required
@MinNumber(-256) // TODO: WARNING HEIGHT
@MaxNumber(256) // TODO: WARNING HEIGHT
@MinNumber(-2032) // TODO: WARNING HEIGHT
@MaxNumber(2032) // TODO: WARNING HEIGHT
@Desc("The max block value")
private int max = 0;

View File

@ -7,11 +7,13 @@ import com.volmit.iris.util.matter.IrisMatter;
import com.volmit.iris.util.matter.Matter;
import com.volmit.iris.util.plugin.VolmitSender;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.File;
import java.io.IOException;
@Data
@EqualsAndHashCode(callSuper = false)
public class IrisMatterObject extends IrisRegistrant {
private final Matter matter;

View File

@ -1,10 +1,11 @@
package com.volmit.iris.engine.object.matter;
import com.volmit.iris.engine.IrisEngine;
import com.volmit.iris.engine.object.annotations.Desc;
import com.volmit.iris.util.function.Function3;
import java.util.function.Function;
@Desc("WHERE THINGS PLACE")
public enum IrisMatterPlacementLocation {
SURFACE((e, x, z) -> e.getHeight(x, z, true)),
SURFACE_ON_FLUID((e, x, z) -> e.getHeight(x, z, false)),

View File

@ -164,7 +164,6 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
if(yy + (finalI << 4) >= engine.getHeight() || yy + (finalI << 4) < 0) {
continue;
}
c.getBlock(xx, yy + (finalI << 4) + world.getMinHeight(), zz)
.setBlockData(tc.getBlockData(xx, yy + (finalI << 4) + world.getMinHeight(), zz), false);
}

View File

@ -20,7 +20,7 @@ package com.volmit.iris.util.data;
import com.volmit.iris.Iris;
import com.volmit.iris.core.IrisSettings;
import com.volmit.iris.core.service.RegistrySVC;
import com.volmit.iris.core.service.ExternalDataSVC;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.collection.KMap;
import com.volmit.iris.util.scheduling.ChronoLatch;
@ -31,16 +31,16 @@ import it.unimi.dsi.fastutil.ints.IntSet;
import it.unimi.dsi.fastutil.ints.IntSets;
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;
import org.bukkit.block.data.type.PointedDripstone;
import org.checkerframework.checker.units.qual.K;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Supplier;
import java.util.Optional;
import java.util.stream.Collectors;
import static org.bukkit.Material.*;
@ -470,25 +470,11 @@ public class B {
try {
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(":")) {
String[] v = ix.toLowerCase().split("\\Q:\\E");
Supplier<BlockData> b = Iris.service(RegistrySVC.class).getCustomBlockRegistry().resolve(v[0], v[1]);
if(b != null) {
bx = b.get();
}
}
} catch(Throwable e) {
e.printStackTrace();// TODO: REMOVE
}
}
if(!ix.startsWith("minecraft:") && ix.contains(":")) {
NamespacedKey key = NamespacedKey.fromString(ix);
Optional<BlockData> bd = Iris.service(ExternalDataSVC.class).getBlockData(key);
if(bd.isPresent())
bx = bd.get();
}
if(bx == null) {
@ -661,22 +647,10 @@ public class B {
}
}
try {
for(String i : Iris.linkOraxen.getItemTypes()) {
bt.add("oraxen:" + i);
}
} catch(Throwable e) {
e.printStackTrace();
}
for(NamespacedKey id : Iris.service(ExternalDataSVC.class).getAllIdentifiers())
bt.add(id.toString());
bt.addAll(custom.k());
try {
bt.addAll(Iris.service(RegistrySVC.class).getCustomBlockRegistry().compile());
} catch(Throwable e) {
e.printStackTrace();
}
return bt.toArray(new String[0]);
}

View File

@ -330,7 +330,7 @@ public class Mantle {
}
/**
* Gets the data tat the current block position This method will attempt to find a
* Gets the data at the current block position This method will attempt to find a
* Tectonic Plate either by loading it or creating a new one. This method uses
* the hyper lock packaged with each Mantle. The hyperlock allows locking of multiple
* threads at a single region while still allowing other threads to continue

View File

@ -22,3 +22,4 @@ commands:
aliases: [ ir, irs ]
api-version: ${apiversion}
hotload-dependencies: false
softdepend: [ "Oraxen", "ItemsAdder", "IrisFeller"]