mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-08-29 21:30:43 +00:00
rename main parameters/fields to platform
This commit is contained in:
+7
-7
@@ -17,17 +17,17 @@ import com.dfsek.terra.api.inject.annotations.Inject;
|
||||
@Version("1.0.0")
|
||||
public class PaletteAddon extends TerraAddon {
|
||||
@Inject
|
||||
private Platform main;
|
||||
private Platform platform;
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
main.getEventManager()
|
||||
.getHandler(FunctionalEventHandler.class)
|
||||
.register(this, ConfigPackPreLoadEvent.class)
|
||||
.then(event -> {
|
||||
event.getPack().registerConfigType(new PaletteConfigType(main), "PALETTE", 2);
|
||||
platform.getEventManager()
|
||||
.getHandler(FunctionalEventHandler.class)
|
||||
.register(this, ConfigPackPreLoadEvent.class)
|
||||
.then(event -> {
|
||||
event.getPack().registerConfigType(new PaletteConfigType(platform), "PALETTE", 2);
|
||||
event.getPack().applyLoader(PaletteLayerHolder.class, new PaletteLayerLoader());
|
||||
})
|
||||
.failThrough();
|
||||
.failThrough();
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -19,10 +19,10 @@ public class PaletteConfigType implements ConfigType<PaletteTemplate, Palette> {
|
||||
public static final TypeKey<Palette> PALETTE_TYPE_TOKEN = new TypeKey<>() {
|
||||
};
|
||||
private final PaletteFactory factory = new PaletteFactory();
|
||||
private final Platform main;
|
||||
private final Platform platform;
|
||||
|
||||
public PaletteConfigType(Platform main) {
|
||||
this.main = main;
|
||||
public PaletteConfigType(Platform platform) {
|
||||
this.platform = platform;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -30,7 +30,7 @@ public class PaletteConfigType implements ConfigType<PaletteTemplate, Palette> {
|
||||
return () -> pack.getRegistryFactory().create(registry -> (TypeLoader<Palette>) (t, c, loader) -> {
|
||||
if(((String) c).startsWith("BLOCK:"))
|
||||
return new PaletteImpl.Singleton(
|
||||
main.getWorldHandle().createBlockData(((String) c).substring(6))); // Return single palette for BLOCK: shortcut.
|
||||
platform.getWorldHandle().createBlockData(((String) c).substring(6))); // Return single palette for BLOCK: shortcut.
|
||||
Palette obj = registry.get((String) c);
|
||||
if(obj == null)
|
||||
throw new LoadException("No such " + t.getType().getTypeName() + " matching \"" + c + "\" was found in this registry.");
|
||||
@@ -39,7 +39,7 @@ public class PaletteConfigType implements ConfigType<PaletteTemplate, Palette> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PaletteTemplate getTemplate(ConfigPack pack, Platform main) {
|
||||
public PaletteTemplate getTemplate(ConfigPack pack, Platform platform) {
|
||||
return new PaletteTemplate();
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ import com.dfsek.terra.api.world.generator.Palette;
|
||||
|
||||
public class PaletteFactory implements ConfigFactory<PaletteTemplate, Palette> {
|
||||
@Override
|
||||
public Palette build(PaletteTemplate config, Platform main) {
|
||||
public Palette build(PaletteTemplate config, Platform platform) {
|
||||
NoisePalette palette = new NoisePalette(config.getNoise());
|
||||
for(PaletteLayerHolder layer : config.getPalette()) {
|
||||
palette.add(layer.getLayer(), layer.getSize(), layer.getSampler());
|
||||
|
||||
Reference in New Issue
Block a user