Skip to content

Commit

Permalink
add registry access to ZGatherHints
Browse files Browse the repository at this point in the history
  • Loading branch information
mezz committed Sep 7, 2024
1 parent a5122c6 commit fe6d906
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.violetmoon.zeta.event.load;

import net.minecraft.core.RegistryAccess;
import net.minecraft.network.chat.Component;
import net.minecraft.world.level.ItemLike;
import org.violetmoon.zeta.config.ConfigFlagManager;
Expand All @@ -17,4 +18,5 @@ public interface ZGatherHints extends IZetaLoadEvent {

void gatherHintsFromModule(ZetaModule module, ConfigFlagManager cfm);

RegistryAccess getRegistryAccess();
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@
import java.util.List;
import java.util.Map;

class InfoRecipeBuilder implements ZGatherHints {
class JeiGatherHints implements ZGatherHints {

private final IRecipeRegistration registration;
private final String modId;
private final RegistryAccess registryAccess;
private final List<Item> blacklist;
private final MutableComponent externalPreamble;

public InfoRecipeBuilder(IRecipeRegistration registration, String modId, RegistryAccess registryAccess, List<Item> blacklist) {
public JeiGatherHints(IRecipeRegistration registration, String modId, RegistryAccess registryAccess, List<Item> blacklist) {
this.registration = registration;
this.modId = modId;
this.registryAccess = registryAccess;
Expand Down Expand Up @@ -169,4 +169,9 @@ else if (target instanceof Iterable<?> iter)
}
}
}

@Override
public RegistryAccess getRegistryAccess() {
return registryAccess;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public void registerRecipes(@NotNull IRecipeRegistration registration) {

List<Item> blacklist = RegistryUtil.massRegistryGet(ZetaGeneralConfig.suppressedInfo, BuiltInRegistries.ITEM);
for (Zeta z : ZetaList.INSTANCE.getZetas()) {
z.loadBus.fire(new InfoRecipeBuilder(registration, z.modid, registryAccess, blacklist), ZGatherHints.class);
z.loadBus.fire(new JeiGatherHints(registration, z.modid, registryAccess, blacklist), ZGatherHints.class);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import net.minecraft.network.chat.Component;
import net.minecraft.world.level.ItemLike;
import net.minecraftforge.eventbus.api.Event;
import org.violetmoon.zeta.Zeta;
import org.violetmoon.zeta.config.ConfigFlagManager;
import org.violetmoon.zeta.event.load.ZGatherHints;
import org.violetmoon.zeta.module.ZetaModule;
Expand Down Expand Up @@ -35,4 +34,9 @@ public void hintItem(ItemLike itemLike, String key, Object... extra) {
public void gatherHintsFromModule(ZetaModule module, ConfigFlagManager cfm) {
wrapped.gatherHintsFromModule(module, cfm);
}

@Override
public RegistryAccess getRegistryAccess() {
return wrapped.getRegistryAccess();
}
}

0 comments on commit fe6d906

Please sign in to comment.