Fixed Oraxen, and custom dimension height.

This commit is contained in:
Vatuu 2022-05-14 19:03:18 +02:00
parent 5658d6709c
commit c3de8b33de
No known key found for this signature in database
GPG Key ID: C6F07B79B2ED9150
6 changed files with 23 additions and 15 deletions

View File

@ -23,6 +23,8 @@ public abstract class BlockDataProvider {
return getPlugin() != null; return getPlugin() != null;
} }
public abstract void init();
public abstract BlockData getBlockData(NamespacedKey blockId) throws MissingResourceException; public abstract BlockData getBlockData(NamespacedKey blockId) throws MissingResourceException;
public abstract NamespacedKey[] getBlockTypes(); public abstract NamespacedKey[] getBlockTypes();

View File

@ -14,6 +14,9 @@ public class ItemAdderLink extends BlockDataProvider {
super("ItemsAdder"); super("ItemsAdder");
} }
@Override
public void init() { }
@Override @Override
public BlockData getBlockData(NamespacedKey blockId) throws MissingResourceException { public BlockData getBlockData(NamespacedKey blockId) throws MissingResourceException {
return CustomBlock.getBaseBlockData(blockId.toString()); return CustomBlock.getBaseBlockData(blockId.toString());

View File

@ -43,17 +43,17 @@ public class OraxenDataProvider extends BlockDataProvider {
private Map<String, MechanicFactory> factories; private Map<String, MechanicFactory> factories;
public OraxenDataProvider() { public OraxenDataProvider() { super("Oraxen"); }
super("Oraxen");
if(getPlugin() != null) { @Override
try { public void init() {
Field f = MechanicsManager.class.getDeclaredField(FIELD_FACTORIES_MAP); try {
f.setAccessible(true); Field f = MechanicsManager.class.getDeclaredField(FIELD_FACTORIES_MAP);
factories = (Map<String, MechanicFactory>) f.get(null); f.setAccessible(true);
} catch(NoSuchFieldException | IllegalAccessException e) { factories = (Map<String, MechanicFactory>) f.get(null);
Iris.error("Failed to set up Oraxen Link:"); } catch(NoSuchFieldException | IllegalAccessException e) {
Iris.error("\t" + e.getClass().getSimpleName()); Iris.error("Failed to set up Oraxen Link:");
} Iris.error("\t" + e.getClass().getSimpleName());
} }
} }

View File

@ -45,7 +45,11 @@ public class CustomBlockDataSVC implements IrisService {
public void onDisable() { } public void onDisable() { }
public void addProvider(BlockDataProvider... provider) { public void addProvider(BlockDataProvider... provider) {
providers.add(provider); for(BlockDataProvider p : provider) {
if(p.getPlugin() != null)
providers.add(p);
p.init();
}
} }
public Optional<BlockData> getBlockData(NamespacedKey key) { public Optional<BlockData> getBlockData(NamespacedKey key) {

View File

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

View File

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