pass pack to ConfigType#registrySupplier

This commit is contained in:
dfsek 2021-07-20 15:09:51 -07:00
parent c1dfcafa1d
commit d807abb165
6 changed files with 11 additions and 11 deletions

View File

@ -39,8 +39,8 @@ public class BiomeConfigType implements ConfigType<BiomeTemplate, TerraBiome> {
} }
@Override @Override
public Supplier<OpenRegistry<TerraBiome>> registrySupplier() { public Supplier<OpenRegistry<TerraBiome>> registrySupplier(ConfigPack pack) {
return () -> pack.getRegistryFactory().create(registry -> (TypeLoader<TerraBiome>) (t, c, loader) -> { return () -> this.pack.getRegistryFactory().create(registry -> (TypeLoader<TerraBiome>) (t, c, loader) -> {
if(c.equals("SELF")) return null; if(c.equals("SELF")) return null;
TerraBiome obj = registry.get((String) c); TerraBiome obj = registry.get((String) c);
if(obj == null) if(obj == null)

View File

@ -36,7 +36,7 @@ public class FloraConfigType implements ConfigType<FloraTemplate, Flora> {
} }
@Override @Override
public Supplier<OpenRegistry<Flora>> registrySupplier() { public Supplier<OpenRegistry<Flora>> registrySupplier(ConfigPack pack) {
return pack.getRegistryFactory()::create; return this.pack.getRegistryFactory()::create;
} }
} }

View File

@ -35,7 +35,7 @@ public class OreConfigType implements ConfigType<OreTemplate, Ore> {
} }
@Override @Override
public Supplier<OpenRegistry<Ore>> registrySupplier() { public Supplier<OpenRegistry<Ore>> registrySupplier(ConfigPack pack) {
return pack.getRegistryFactory()::create; return this.pack.getRegistryFactory()::create;
} }
} }

View File

@ -41,8 +41,8 @@ public class PaletteConfigType implements ConfigType<PaletteTemplate, Palette> {
} }
@Override @Override
public Supplier<OpenRegistry<Palette>> registrySupplier() { public Supplier<OpenRegistry<Palette>> registrySupplier(ConfigPack pack) {
return () -> pack.getRegistryFactory().create(registry -> (TypeLoader<Palette>) (t, c, loader) -> { return () -> this.pack.getRegistryFactory().create(registry -> (TypeLoader<Palette>) (t, c, loader) -> {
if(((String) c).startsWith("BLOCK:")) if(((String) c).startsWith("BLOCK:"))
return new PaletteImpl.Singleton(main.getWorldHandle().createBlockData(((String) c).substring(6))); // Return single palette for BLOCK: shortcut. return new PaletteImpl.Singleton(main.getWorldHandle().createBlockData(((String) c).substring(6))); // Return single palette for BLOCK: shortcut.
Palette obj = registry.get((String) c); Palette obj = registry.get((String) c);

View File

@ -35,7 +35,7 @@ public class TreeConfigType implements ConfigType<TreeTemplate, Tree> {
} }
@Override @Override
public Supplier<OpenRegistry<Tree>> registrySupplier() { public Supplier<OpenRegistry<Tree>> registrySupplier(ConfigPack pack) {
return pack.getRegistryFactory()::create; return this.pack.getRegistryFactory()::create;
} }
} }

View File

@ -13,5 +13,5 @@ public interface ConfigType<T extends AbstractableTemplate, R> {
TypeKey<R> getTypeClass(); TypeKey<R> getTypeClass();
Supplier<OpenRegistry<R>> registrySupplier(); Supplier<OpenRegistry<R>> registrySupplier(ConfigPack pack);
} }