mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-03 08:26:11 +00:00
replace Oraxen with Nexo support
This commit is contained in:
parent
d5251350a1
commit
b6bacee095
@ -121,7 +121,7 @@ allprojects {
|
|||||||
maven { url "https://repo.triumphteam.dev/snapshots" }
|
maven { url "https://repo.triumphteam.dev/snapshots" }
|
||||||
maven { url "https://repo.mineinabyss.com/releases" }
|
maven { url "https://repo.mineinabyss.com/releases" }
|
||||||
maven { url 'https://hub.jeff-media.com/nexus/repository/jeff-media-public/' }
|
maven { url 'https://hub.jeff-media.com/nexus/repository/jeff-media-public/' }
|
||||||
maven { url "https://repo.oraxen.com/releases" }
|
maven { url "https://repo.nexomc.com/snapshots/" }
|
||||||
maven { url "https://libraries.minecraft.net" }
|
maven { url "https://libraries.minecraft.net" }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ dependencies {
|
|||||||
|
|
||||||
// Third Party Integrations
|
// Third Party Integrations
|
||||||
compileOnly 'com.ticxo.playeranimator:PlayerAnimator:R1.2.7'
|
compileOnly 'com.ticxo.playeranimator:PlayerAnimator:R1.2.7'
|
||||||
compileOnly 'io.th0rgal:oraxen:1.173.0'
|
compileOnly 'com.nexomc:nexo:0.1.0-dev.0'
|
||||||
compileOnly 'com.github.LoneDev6:api-itemsadder:3.4.1-r4'
|
compileOnly 'com.github.LoneDev6:api-itemsadder:3.4.1-r4'
|
||||||
compileOnly 'com.github.PlaceholderAPI:placeholderapi:2.11.3'
|
compileOnly 'com.github.PlaceholderAPI:placeholderapi:2.11.3'
|
||||||
compileOnly 'com.github.Ssomar-Developement:SCore:4.23.10.8'
|
compileOnly 'com.github.Ssomar-Developement:SCore:4.23.10.8'
|
||||||
@ -71,6 +71,9 @@ dependencies {
|
|||||||
//implementation files('libs/CustomItems.jar')
|
//implementation files('libs/CustomItems.jar')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
java {
|
||||||
|
disableAutoTargetJvm()
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gradle is weird sometimes, we need to delete the plugin yml from the build folder to actually filter properly.
|
* Gradle is weird sometimes, we need to delete the plugin yml from the build folder to actually filter properly.
|
||||||
|
@ -0,0 +1,187 @@
|
|||||||
|
package com.volmit.iris.core.link;
|
||||||
|
|
||||||
|
import com.volmit.iris.Iris;
|
||||||
|
import com.volmit.iris.core.nms.INMS;
|
||||||
|
import com.volmit.iris.core.nms.container.BiomeColor;
|
||||||
|
import com.volmit.iris.core.service.ExternalDataSVC;
|
||||||
|
import com.volmit.iris.engine.data.cache.Cache;
|
||||||
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
|
import com.volmit.iris.util.collection.KMap;
|
||||||
|
import com.volmit.iris.util.data.B;
|
||||||
|
import com.volmit.iris.util.data.IrisBlockData;
|
||||||
|
import com.volmit.iris.util.math.RNG;
|
||||||
|
import com.volmit.iris.util.reflect.WrappedReturningMethod;
|
||||||
|
import org.bukkit.Color;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.block.data.BlockData;
|
||||||
|
import org.bukkit.entity.ItemDisplay;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.meta.PotionMeta;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.MissingResourceException;
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
|
public class NexoDataProvider extends ExternalDataProvider {
|
||||||
|
private final AtomicBoolean failed = new AtomicBoolean(false);
|
||||||
|
private WrappedReturningMethod<?, String[]> itemNames;
|
||||||
|
private WrappedReturningMethod<?, Boolean> exists;
|
||||||
|
|
||||||
|
private WrappedReturningMethod<?, Boolean> isCustomBlock;
|
||||||
|
private WrappedReturningMethod<?, Boolean> isFurniture;
|
||||||
|
|
||||||
|
private WrappedReturningMethod<?, BlockData> getBlockData;
|
||||||
|
private WrappedReturningMethod<?, ItemDisplay> placeFurniture;
|
||||||
|
|
||||||
|
private WrappedReturningMethod<?, Object> itemFromId;
|
||||||
|
private WrappedReturningMethod<?, ItemStack> buildItem;
|
||||||
|
|
||||||
|
public NexoDataProvider() {
|
||||||
|
super("Nexo");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init() {
|
||||||
|
try {
|
||||||
|
Class<?> nexoItems = Class.forName("com.nexomc.nexo.api.NexoItems");
|
||||||
|
Class<?> nexoBlocks = Class.forName("com.nexomc.nexo.api.NexoBlocks");
|
||||||
|
Class<?> nexoFurniture = Class.forName("com.nexomc.nexo.api.NexoFurniture");
|
||||||
|
Class<?> itemBuilder = Class.forName("com.nexomc.nexo.items.ItemBuilder");
|
||||||
|
|
||||||
|
itemNames = new WrappedReturningMethod<>(nexoItems, "itemNames");
|
||||||
|
exists = new WrappedReturningMethod<>(nexoItems, "exists", String.class);
|
||||||
|
|
||||||
|
isCustomBlock = new WrappedReturningMethod<>(nexoBlocks, "isCustomBlock", String.class);
|
||||||
|
isFurniture = new WrappedReturningMethod<>(nexoFurniture, "isFurniture", String.class);
|
||||||
|
|
||||||
|
getBlockData = new WrappedReturningMethod<>(nexoBlocks, "blockData", String.class);
|
||||||
|
placeFurniture = new WrappedReturningMethod<>(nexoFurniture, "place", String.class, Location.class, float.class, BlockFace.class);
|
||||||
|
|
||||||
|
itemFromId = new WrappedReturningMethod<>(nexoItems, "itemFromId", String.class);
|
||||||
|
buildItem = new WrappedReturningMethod<>(itemBuilder, "buildItem");
|
||||||
|
} catch (Throwable e) {
|
||||||
|
failed.set(true);
|
||||||
|
Iris.error("Failed to initialize NexoDataProvider");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockData getBlockData(Identifier blockId, KMap<String, String> state) throws MissingResourceException {
|
||||||
|
if (!exists.invoke(blockId.key())) {
|
||||||
|
throw new MissingResourceException("Failed to find BlockData!", blockId.namespace(), blockId.key());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isCustomBlock.invoke(blockId.key())) {
|
||||||
|
return getBlockData.invoke(blockId.key());
|
||||||
|
} else if (isFurniture.invoke(blockId.key())) {
|
||||||
|
return new IrisBlockData(B.getAir(), ExternalDataSVC.buildState(blockId, state));
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new MissingResourceException("Failed to find BlockData!", blockId.namespace(), blockId.key());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getItemStack(Identifier itemId, KMap<String, Object> customNbt) throws MissingResourceException {
|
||||||
|
Object o = itemFromId.invoke(itemId.key());
|
||||||
|
if (o == null) {
|
||||||
|
throw new MissingResourceException("Failed to find ItemData!", itemId.namespace(), itemId.key());
|
||||||
|
}
|
||||||
|
ItemStack itemStack = buildItem.invoke(o, new Object[0]);
|
||||||
|
if (itemStack == null) {
|
||||||
|
throw new MissingResourceException("Failed to find ItemData!", itemId.namespace(), itemId.key());
|
||||||
|
}
|
||||||
|
return itemStack;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void processUpdate(Engine engine, Block block, Identifier blockId) {
|
||||||
|
var pair = ExternalDataSVC.parseState(blockId);
|
||||||
|
var state = pair.getB();
|
||||||
|
blockId = pair.getA();
|
||||||
|
|
||||||
|
if (!isFurniture.invoke(blockId.key()))
|
||||||
|
return;
|
||||||
|
|
||||||
|
float yaw = 0;
|
||||||
|
BlockFace face = BlockFace.NORTH;
|
||||||
|
|
||||||
|
long seed = engine.getSeedManager().getSeed() + Cache.key(block.getX(), block.getZ()) + block.getY();
|
||||||
|
RNG rng = new RNG(seed);
|
||||||
|
if ("true".equals(state.get("randomYaw"))) {
|
||||||
|
yaw = rng.f(0, 360);
|
||||||
|
} else if (state.containsKey("yaw")) {
|
||||||
|
yaw = Float.parseFloat(state.get("yaw"));
|
||||||
|
}
|
||||||
|
if ("true".equals(state.get("randomFace"))) {
|
||||||
|
BlockFace[] faces = BlockFace.values();
|
||||||
|
face = faces[rng.i(0, faces.length - 1)];
|
||||||
|
} else if (state.containsKey("face")) {
|
||||||
|
face = BlockFace.valueOf(state.get("face").toUpperCase());
|
||||||
|
}
|
||||||
|
if (face == BlockFace.SELF) {
|
||||||
|
face = BlockFace.NORTH;
|
||||||
|
}
|
||||||
|
ItemDisplay display = placeFurniture.invoke(blockId.key(), block.getLocation(), yaw, face);
|
||||||
|
if (display == null) return;
|
||||||
|
ItemStack itemStack = display.getItemStack();
|
||||||
|
if (itemStack == null) return;
|
||||||
|
|
||||||
|
BiomeColor type = null;
|
||||||
|
try {
|
||||||
|
type = BiomeColor.valueOf(state.get("matchBiome").toUpperCase());
|
||||||
|
} catch (NullPointerException | IllegalArgumentException ignored) {}
|
||||||
|
|
||||||
|
if (type != null) {
|
||||||
|
var biomeColor = INMS.get().getBiomeColor(block.getLocation(), type);
|
||||||
|
if (biomeColor == null) return;
|
||||||
|
var potionColor = Color.fromARGB(biomeColor.getAlpha(), biomeColor.getRed(), biomeColor.getGreen(), biomeColor.getBlue());
|
||||||
|
if (itemStack.getItemMeta() instanceof PotionMeta meta) {
|
||||||
|
meta.setColor(potionColor);
|
||||||
|
itemStack.setItemMeta(meta);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
display.setItemStack(itemStack);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Identifier[] getBlockTypes() {
|
||||||
|
return Arrays.stream(itemNames.invoke())
|
||||||
|
.filter(i -> isCustomBlock.invoke(i) || isFurniture.invoke(i))
|
||||||
|
.map(i -> new Identifier("nexo", i))
|
||||||
|
.filter(i -> {
|
||||||
|
try {
|
||||||
|
return getBlockData(i) != null;
|
||||||
|
} catch (MissingResourceException e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.toArray(Identifier[]::new);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Identifier[] getItemTypes() {
|
||||||
|
return Arrays.stream(itemNames.invoke())
|
||||||
|
.map(i -> new Identifier("nexo", i))
|
||||||
|
.filter(i -> {
|
||||||
|
try {
|
||||||
|
return getItemStack(i) != null;
|
||||||
|
} catch (MissingResourceException e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.toArray(Identifier[]::new);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isValidProvider(Identifier id, boolean isItem) {
|
||||||
|
return "nexo".equalsIgnoreCase(id.namespace());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isReady() {
|
||||||
|
return super.isReady() && !failed.get();
|
||||||
|
}
|
||||||
|
}
|
@ -1,213 +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.Iris;
|
|
||||||
import com.volmit.iris.core.nms.INMS;
|
|
||||||
import com.volmit.iris.core.nms.container.BiomeColor;
|
|
||||||
import com.volmit.iris.core.service.ExternalDataSVC;
|
|
||||||
import com.volmit.iris.engine.data.cache.Cache;
|
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
|
||||||
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.data.IrisBlockData;
|
|
||||||
import com.volmit.iris.util.math.RNG;
|
|
||||||
import com.volmit.iris.util.reflect.WrappedField;
|
|
||||||
import io.th0rgal.oraxen.api.OraxenItems;
|
|
||||||
import io.th0rgal.oraxen.items.ItemBuilder;
|
|
||||||
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.furniture.FurnitureFactory;
|
|
||||||
import io.th0rgal.oraxen.mechanics.provided.gameplay.furniture.FurnitureMechanic;
|
|
||||||
import io.th0rgal.oraxen.mechanics.provided.gameplay.noteblock.NoteBlockMechanicFactory;
|
|
||||||
import io.th0rgal.oraxen.mechanics.provided.gameplay.stringblock.StringBlockMechanicFactory;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Color;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.block.BlockFace;
|
|
||||||
import org.bukkit.block.data.BlockData;
|
|
||||||
import org.bukkit.block.data.MultipleFacing;
|
|
||||||
import org.bukkit.entity.Entity;
|
|
||||||
import org.bukkit.entity.ItemDisplay;
|
|
||||||
import org.bukkit.entity.ItemFrame;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
import org.bukkit.inventory.meta.PotionMeta;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.MissingResourceException;
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
public class OraxenDataProvider extends ExternalDataProvider {
|
|
||||||
|
|
||||||
private static final String FIELD_FACTORIES_MAP = "FACTORIES_BY_MECHANIC_ID";
|
|
||||||
|
|
||||||
private WrappedField<MechanicsManager, Map<String, MechanicFactory>> factories;
|
|
||||||
|
|
||||||
public OraxenDataProvider() {
|
|
||||||
super("Oraxen");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void init() {
|
|
||||||
Iris.info("Setting up Oraxen Link...");
|
|
||||||
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(Identifier blockId, KMap<String, String> state) 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);
|
|
||||||
BlockMechanic.setBlockFacing(newBlockData, ((BlockMechanic) f.getMechanic(blockId.key())).getCustomVariation());
|
|
||||||
return newBlockData;
|
|
||||||
} else if (factory instanceof StringBlockMechanicFactory f) {
|
|
||||||
return f.createTripwireData(blockId.key());
|
|
||||||
} else if (factory instanceof FurnitureFactory) {
|
|
||||||
return new IrisBlockData(B.getAir(), ExternalDataSVC.buildState(blockId, state));
|
|
||||||
} else
|
|
||||||
throw new MissingResourceException("Failed to find BlockData!", blockId.namespace(), blockId.key());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getItemStack(Identifier itemId, KMap<String, Object> customNbt) 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 void processUpdate(Engine engine, Block block, Identifier blockId) {
|
|
||||||
var pair = ExternalDataSVC.parseState(blockId);
|
|
||||||
var state = pair.getB();
|
|
||||||
blockId = pair.getA();
|
|
||||||
Mechanic mechanic = getFactory(blockId).getMechanic(blockId.key());
|
|
||||||
if (mechanic instanceof FurnitureMechanic f) {
|
|
||||||
float yaw = 0;
|
|
||||||
BlockFace face = BlockFace.NORTH;
|
|
||||||
|
|
||||||
long seed = engine.getSeedManager().getSeed() + Cache.key(block.getX(), block.getZ()) + block.getY();
|
|
||||||
RNG rng = new RNG(seed);
|
|
||||||
if ("true".equals(state.get("randomYaw"))) {
|
|
||||||
yaw = rng.f(0, 360);
|
|
||||||
} else if (state.containsKey("yaw")) {
|
|
||||||
yaw = Float.parseFloat(state.get("yaw"));
|
|
||||||
}
|
|
||||||
if ("true".equals(state.get("randomFace"))) {
|
|
||||||
BlockFace[] faces = BlockFace.values();
|
|
||||||
face = faces[rng.i(0, faces.length - 1)];
|
|
||||||
} else if (state.containsKey("face")) {
|
|
||||||
face = BlockFace.valueOf(state.get("face").toUpperCase());
|
|
||||||
}
|
|
||||||
if (face == BlockFace.SELF) {
|
|
||||||
face = BlockFace.NORTH;
|
|
||||||
}
|
|
||||||
ItemStack itemStack = OraxenItems.getItemById(f.getItemID()).build();
|
|
||||||
Entity entity = f.place(block.getLocation(), itemStack, yaw, face, false);
|
|
||||||
|
|
||||||
Consumer<ItemStack> setter = null;
|
|
||||||
if (entity instanceof ItemFrame frame) {
|
|
||||||
itemStack = frame.getItem();
|
|
||||||
setter = frame::setItem;
|
|
||||||
} else if (entity instanceof ItemDisplay display) {
|
|
||||||
itemStack = display.getItemStack();
|
|
||||||
setter = display::setItemStack;
|
|
||||||
}
|
|
||||||
if (setter == null || itemStack == null) return;
|
|
||||||
|
|
||||||
BiomeColor type = null;
|
|
||||||
try {
|
|
||||||
type = BiomeColor.valueOf(state.get("matchBiome").toUpperCase());
|
|
||||||
} catch (NullPointerException | IllegalArgumentException ignored) {}
|
|
||||||
|
|
||||||
if (type != null) {
|
|
||||||
var biomeColor = INMS.get().getBiomeColor(block.getLocation(), type);
|
|
||||||
if (biomeColor == null) return;
|
|
||||||
var potionColor = Color.fromARGB(biomeColor.getAlpha(), biomeColor.getRed(), biomeColor.getGreen(), biomeColor.getBlue());
|
|
||||||
if (itemStack.getItemMeta() instanceof PotionMeta meta) {
|
|
||||||
meta.setColor(potionColor);
|
|
||||||
itemStack.setItemMeta(meta);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
setter.accept(itemStack);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Identifier[] getBlockTypes() {
|
|
||||||
KList<Identifier> names = new KList<>();
|
|
||||||
for (String name : OraxenItems.getItemNames()) {
|
|
||||||
try {
|
|
||||||
Identifier key = new Identifier("oraxen", name);
|
|
||||||
if (getBlockData(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 : 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
|
|
||||||
public boolean isReady() {
|
|
||||||
if (super.isReady()) {
|
|
||||||
if (factories == null) {
|
|
||||||
this.factories = new WrappedField<>(MechanicsManager.class, FIELD_FACTORIES_MAP);
|
|
||||||
}
|
|
||||||
return super.isReady() && !factories.hasFailed();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isValidProvider(Identifier key, boolean isItem) {
|
|
||||||
return key.namespace().equalsIgnoreCase("oraxen");
|
|
||||||
}
|
|
||||||
|
|
||||||
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.namespace(), key.key()));
|
|
||||||
}
|
|
||||||
}
|
|
@ -46,9 +46,9 @@ public class ExternalDataSVC implements IrisService {
|
|||||||
Iris.info("Loading ExternalDataProvider...");
|
Iris.info("Loading ExternalDataProvider...");
|
||||||
Bukkit.getPluginManager().registerEvents(this, Iris.instance);
|
Bukkit.getPluginManager().registerEvents(this, Iris.instance);
|
||||||
|
|
||||||
providers.add(new OraxenDataProvider());
|
providers.add(new NexoDataProvider());
|
||||||
if (Bukkit.getPluginManager().getPlugin("Oraxen") != null) {
|
if (Bukkit.getPluginManager().getPlugin("Nexo") != null) {
|
||||||
Iris.info("Oraxen found, loading OraxenDataProvider...");
|
Iris.info("Nexo found, loading NexoDataProvider...");
|
||||||
}
|
}
|
||||||
providers.add(new MythicCrucibleDataProvider());
|
providers.add(new MythicCrucibleDataProvider());
|
||||||
if (Bukkit.getPluginManager().getPlugin("MythicCrucible") != null) {
|
if (Bukkit.getPluginManager().getPlugin("MythicCrucible") != null) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user