mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-02 07:55:28 +00:00
structure configtype impl
This commit is contained in:
parent
e1dadaca6a
commit
94ee2c27eb
@ -28,7 +28,7 @@ public class StructureAddon implements AddonInitializer {
|
||||
platform.getEventManager()
|
||||
.getHandler(FunctionalEventHandler.class)
|
||||
.register(addon, ConfigPackPreLoadEvent.class)
|
||||
.then(event -> event.getPack().applyLoader(ConfiguredStructure.class, (t, o, l) -> null))
|
||||
.then(event -> event.getPack().registerConfigType(new StructureConfigType(), "STRUCTURE", 2))
|
||||
.failThrough();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (c) 2020-2021 Polyhedral Development
|
||||
*
|
||||
* The Terra Core Addons are licensed under the terms of the MIT License. For more details,
|
||||
* reference the LICENSE file in this module's root directory.
|
||||
*/
|
||||
|
||||
package com.dfsek.terra.addons.structure;
|
||||
|
||||
import com.dfsek.terra.api.Platform;
|
||||
import com.dfsek.terra.api.config.ConfigFactory;
|
||||
import com.dfsek.terra.api.config.ConfigPack;
|
||||
import com.dfsek.terra.api.config.ConfigType;
|
||||
import com.dfsek.terra.api.registry.OpenRegistry;
|
||||
import com.dfsek.terra.api.structure.configured.ConfiguredStructure;
|
||||
import com.dfsek.terra.api.util.reflection.TypeKey;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
|
||||
public class StructureConfigType implements ConfigType<StructureTemplate, ConfiguredStructure> {
|
||||
private final ConfigFactory<StructureTemplate, ConfiguredStructure> factory = new StructureFactory();
|
||||
public static final TypeKey<ConfiguredStructure> CONFIGURED_STRUCTURE_TYPE_KEY = new TypeKey<>(){};
|
||||
|
||||
@Override
|
||||
public StructureTemplate getTemplate(ConfigPack pack, Platform platform) {
|
||||
return new StructureTemplate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigFactory<StructureTemplate, ConfiguredStructure> getFactory() {
|
||||
return factory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypeKey<ConfiguredStructure> getTypeKey() {
|
||||
return CONFIGURED_STRUCTURE_TYPE_KEY;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user