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;
}
public abstract void init();
public abstract BlockData getBlockData(NamespacedKey blockId) throws MissingResourceException;
public abstract NamespacedKey[] getBlockTypes();

View File

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

View File

@ -43,17 +43,17 @@ public class OraxenDataProvider extends BlockDataProvider {
private Map<String, MechanicFactory> factories;
public OraxenDataProvider() {
super("Oraxen");
if(getPlugin() != null) {
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());
}
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());
}
}

View File

@ -45,7 +45,11 @@ public class CustomBlockDataSVC implements IrisService {
public void onDisable() { }
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) {

View File

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

View File

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