dont use pack instance where unneeded

This commit is contained in:
dfsek
2021-07-20 15:12:06 -07:00
parent d807abb165
commit 0ff6a9cce1
10 changed files with 11 additions and 29 deletions
@@ -25,7 +25,7 @@ public class FloraAddon extends TerraAddon implements EventListener {
}
public void onPackLoad(ConfigPackPreLoadEvent event) throws DuplicateEntryException {
event.getPack().registerConfigType(new FloraConfigType(event.getPack()), "FLORA", 2);
event.getPack().registerConfigType(new FloraConfigType(), "FLORA", 2);
event.getPack().applyLoader(BlockLayer.class, BlockLayerTemplate::new);
}
}
@@ -12,14 +12,9 @@ import java.util.function.Supplier;
public class FloraConfigType implements ConfigType<FloraTemplate, Flora> {
private final FloraFactory factory = new FloraFactory();
private final ConfigPack pack;
public static final TypeKey<Flora> FLORA_TYPE_TOKEN = new TypeKey<>(){};
public FloraConfigType(ConfigPack pack) {
this.pack = pack;
}
@Override
public FloraTemplate getTemplate(ConfigPack pack, TerraPlugin main) {
return new FloraTemplate();
@@ -37,6 +32,6 @@ public class FloraConfigType implements ConfigType<FloraTemplate, Flora> {
@Override
public Supplier<OpenRegistry<Flora>> registrySupplier(ConfigPack pack) {
return this.pack.getRegistryFactory()::create;
return pack.getRegistryFactory()::create;
}
}