Don't register too early
Changes to be committed: modified: src/main/java/org/dimdev/dimdoors/DimensionalDoorsInitializer.java modified: src/main/java/org/dimdev/dimdoors/world/feature/ModFeatures.java modified: src/main/java/org/dimdev/dimdoors/world/feature/gateway/v2/SchematicV2Gateway.java
This commit is contained in:
parent
41804a02be
commit
b4b72daf7a
3 changed files with 11 additions and 11 deletions
|
@ -66,6 +66,8 @@ public class DimensionalDoorsInitializer implements ModInitializer {
|
|||
ModSoundEvents.init();
|
||||
ModFeatures.init();
|
||||
|
||||
ModConfig.deserialize();
|
||||
|
||||
Targets.registerDefaultTargets();
|
||||
|
||||
SchematicHandler.INSTANCE.loadSchematics();
|
||||
|
|
|
@ -1,12 +1,6 @@
|
|||
package org.dimdev.dimdoors.world.feature;
|
||||
|
||||
import org.dimdev.dimdoors.ModConfig;
|
||||
import org.dimdev.dimdoors.block.ModBlocks;
|
||||
import org.dimdev.dimdoors.world.feature.gateway.SandstonePillarsGateway;
|
||||
import org.dimdev.dimdoors.world.feature.gateway.SchematicGateway;
|
||||
import org.dimdev.dimdoors.world.feature.gateway.SchematicGatewayFeature;
|
||||
import org.dimdev.dimdoors.world.feature.gateway.SchematicGatewayFeatureConfig;
|
||||
import org.dimdev.dimdoors.world.feature.gateway.TwoPillarsGateway;
|
||||
import org.dimdev.dimdoors.world.feature.gateway.v2.SandstonePillarsV2Gateway;
|
||||
import org.dimdev.dimdoors.world.feature.gateway.v2.SchematicV2Gateway;
|
||||
import org.dimdev.dimdoors.world.feature.gateway.v2.SchematicV2GatewayFeature;
|
||||
|
@ -27,11 +21,11 @@ public final class ModFeatures {
|
|||
public static final ConfiguredFeature<?, ?> SANDSTONE_PILLARS_FEATURE_V2;
|
||||
|
||||
public static void init() {
|
||||
SANDSTONE_PILLARS_GATEWAY_V2.init();
|
||||
Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, new Identifier("dimdoors", "sandstone_pillars_v2"), SANDSTONE_PILLARS_FEATURE_V2);
|
||||
}
|
||||
|
||||
static {
|
||||
ModBlocks.init();
|
||||
SANDSTONE_PILLARS_GATEWAY_V2 = new SandstonePillarsV2Gateway();
|
||||
|
||||
int gatewayChance = FabricLoader.getInstance().isDevelopmentEnvironment() ? 20 : ModConfig.INSTANCE.getWorldConfig().gatewayGenChance;
|
||||
|
|
|
@ -21,15 +21,19 @@ import net.minecraft.world.StructureWorldAccess;
|
|||
public class SchematicV2Gateway extends BaseGateway {
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
private Schematic schematic;
|
||||
private final String id;
|
||||
public static final BiMap<SchematicV2Gateway, String> SCHEMATIC_ID_MAP = HashBiMap.create();
|
||||
public static final BiMap<String, SchematicV2Gateway> ID_SCHEMATIC_MAP = HashBiMap.create();
|
||||
|
||||
public SchematicV2Gateway(String id) {
|
||||
String schematicJarDirectory = "/data/dimdoors/gateways/v2/";
|
||||
SCHEMATIC_ID_MAP.putIfAbsent(this, id);
|
||||
ID_SCHEMATIC_MAP.putIfAbsent(id, this);
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
InputStream schematicStream = DimensionalDoorsInitializer.class.getResourceAsStream(schematicJarDirectory + id + ".schem");
|
||||
public void init() {
|
||||
String schematicJarDirectory = "/data/dimdoors/gateways/v2/";
|
||||
InputStream schematicStream = DimensionalDoorsInitializer.class.getResourceAsStream(schematicJarDirectory + this.id + ".schem");
|
||||
|
||||
DataInputStream schematicDataStream = null;
|
||||
boolean streamOpened = false;
|
||||
|
@ -37,7 +41,7 @@ public class SchematicV2Gateway extends BaseGateway {
|
|||
schematicDataStream = new DataInputStream(schematicStream);
|
||||
streamOpened = true;
|
||||
} else {
|
||||
LOGGER.warn("Schematic '" + id + "' was not found in the jar or config directory, neither with the .schem extension, nor with the .schematic extension.");
|
||||
LOGGER.warn("Schematic '" + this.id + "' was not found in the jar or config directory, neither with the .schem extension, nor with the .schematic extension.");
|
||||
}
|
||||
|
||||
CompoundTag tag;
|
||||
|
@ -48,7 +52,7 @@ public class SchematicV2Gateway extends BaseGateway {
|
|||
this.schematic = Schematic.fromTag(tag);
|
||||
schematicDataStream.close();
|
||||
} catch (IOException ex) {
|
||||
LOGGER.error("Schematic file for " + id + " could not be read as a valid schematic NBT file.", ex);
|
||||
LOGGER.error("Schematic file for " + this.id + " could not be read as a valid schematic NBT file.", ex);
|
||||
} finally {
|
||||
try {
|
||||
schematicDataStream.close();
|
||||
|
|
Loading…
Reference in a new issue