fix loading

This commit is contained in:
Zoë Gidiere 2023-12-12 17:15:54 -07:00
parent 9d200565d7
commit 7ca24faad3
2 changed files with 5 additions and 10 deletions

View File

@ -53,12 +53,9 @@ public abstract class MinecraftAddon implements BaseAddon {
public void initialize() { public void initialize() {
modPlatform.getEventManager() modPlatform.getEventManager()
.getHandler(FunctionalEventHandler.class) .getHandler(FunctionalEventHandler.class)
.register(this, ConfigurationLoadEvent.class) .register(this, ConfigPackPostLoadEvent.class)
.then(event -> { .then(event -> event.getPack().getContext().put(event.loadTemplate(new VanillaWorldProperties())))
if(event.is(ConfigPack.class)) { .priority(100)
event.getLoadedObject(ConfigPack.class).getContext().put(event.load(new VanillaWorldProperties()));
}
})
.global(); .global();
modPlatform.getEventManager() modPlatform.getEventManager()
.getHandler(FunctionalEventHandler.class) .getHandler(FunctionalEventHandler.class)

View File

@ -28,7 +28,7 @@ public class DimensionUtil {
public static DimensionType createDimension(ConfigPack pack, ModPlatform platform) { public static DimensionType createDimension(ConfigPack pack, ModPlatform platform) {
VanillaWorldProperties vanillaWorldProperties; VanillaWorldProperties vanillaWorldProperties;
MonsterSettingsConfig monsterSettingsConfig; MonsterSettingsConfig monsterSettingsConfig;
if (pack.getContext().has(VanillaBiomeProperties.class)) { if (pack.getContext().has(VanillaWorldProperties.class)) {
vanillaWorldProperties = pack.getContext().get(VanillaWorldProperties.class); vanillaWorldProperties = pack.getContext().get(VanillaWorldProperties.class);
} else { } else {
vanillaWorldProperties = new VanillaWorldProperties(); vanillaWorldProperties = new VanillaWorldProperties();
@ -46,7 +46,7 @@ public class DimensionUtil {
assert defaultDimension != null; assert defaultDimension != null;
MonsterSettings monsterSettings = getMonsterSettings(defaultDimension, monsterSettingsConfig); MonsterSettings monsterSettings = getMonsterSettings(defaultDimension, monsterSettingsConfig);
DimensionType dimension = new DimensionType( return new DimensionType(
vanillaWorldProperties.getFixedTime() == null ? defaultDimension.fixedTime() : OptionalLong.of( vanillaWorldProperties.getFixedTime() == null ? defaultDimension.fixedTime() : OptionalLong.of(
vanillaWorldProperties.getFixedTime()), vanillaWorldProperties.getFixedTime()),
vanillaWorldProperties.getHasSkyLight() == null ? defaultDimension.hasSkyLight() : vanillaWorldProperties.getHasSkyLight(), vanillaWorldProperties.getHasSkyLight() == null ? defaultDimension.hasSkyLight() : vanillaWorldProperties.getHasSkyLight(),
@ -64,8 +64,6 @@ public class DimensionUtil {
vanillaWorldProperties.getAmbientLight() == null ? defaultDimension.ambientLight() : vanillaWorldProperties.getAmbientLight(), vanillaWorldProperties.getAmbientLight() == null ? defaultDimension.ambientLight() : vanillaWorldProperties.getAmbientLight(),
monsterSettings monsterSettings
); );
return dimension;
} }
@NotNull @NotNull