Skip to content

Commit

Permalink
fix: fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Zepalesque committed Jun 16, 2024
1 parent 10d6a78 commit f6140fa
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 24 deletions.
17 changes: 3 additions & 14 deletions src/main/java/net/zepalesque/redux/Redux.java
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
package net.zepalesque.redux;

import com.mojang.logging.LogUtils;
import net.minecraft.SharedConstants;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.packs.PackType;
import net.minecraft.server.packs.PathPackResources;
import net.minecraft.server.packs.metadata.pack.PackMetadataSection;
import net.minecraft.server.packs.repository.Pack;
import net.minecraft.server.packs.repository.PackCompatibility;
import net.minecraft.server.packs.repository.PackSource;
import net.minecraft.world.flag.FeatureFlagSet;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.bus.api.EventPriority;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.fml.ModList;
import net.neoforged.fml.common.Mod;
import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent;
import net.neoforged.neoforge.event.AddPackFindersEvent;
Expand All @@ -32,8 +23,8 @@
import net.zepalesque.redux.entity.ReduxEntities;
import net.zepalesque.redux.item.ReduxItems;
import net.zepalesque.redux.loot.modifer.ReduxLootModifiers;
import net.zepalesque.redux.pack.ReduxPackConfig;
import net.zepalesque.redux.pack.PackUtils;
import net.zepalesque.redux.pack.ReduxPackConfig;
import net.zepalesque.redux.recipe.ReduxRecipes;
import net.zepalesque.redux.tile.ReduxTiles;
import net.zepalesque.redux.world.biome.tint.ReduxBiomeTints;
Expand All @@ -43,10 +34,8 @@
import net.zepalesque.zenith.api.blockset.AbstractWoodSet;
import org.slf4j.Logger;

import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

@Mod(Redux.MODID)
public class Redux {
Expand Down Expand Up @@ -110,9 +99,9 @@ public void packSetup(AddPackFindersEvent event) {
if (event.getPackType() == PackType.CLIENT_RESOURCES) {
String pathString = "resource/overrides_pack";
String id = "overrides_pack";
PackUtils.setupPack(event, pathString, id, PackType.CLIENT_RESOURCES, true, ReduxPackConfig::generate);
PackUtils.setupPack(event, pathString, id, true, ReduxPackConfig::generate);
} else if (event.getPackType() == PackType.SERVER_DATA) {
if (ReduxConfig.COMMON.bronze_dungeon_upgrade.get()) { PackUtils.setupPack(event, "dungeon_upgrades/bronze", "bronze_upgrade", PackType.SERVER_DATA, true); }
if (ReduxConfig.COMMON.bronze_dungeon_upgrade.get()) { PackUtils.setupPack(event, "dungeon_upgrades/bronze", "bronze_upgrade", true); }
}
}

Expand Down
19 changes: 9 additions & 10 deletions src/main/java/net/zepalesque/redux/pack/PackUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@

public class PackUtils {

public static void setupPack(AddPackFindersEvent event, String path, String id, PackType side, boolean required, Function<Path, Pack.ResourcesSupplier> packBuilder) {
if (event.getPackType() == side) {
String folder = (side == PackType.SERVER_DATA ? "data/" : "resource/");
Path resourcePath = ModList.get().getModFileById(Redux.MODID).getFile().findResource("packs/" + folder + path);
PackMetadataSection metadata = new PackMetadataSection(Component.translatable("pack.aether_redux." + id + ".description"),
SharedConstants.getCurrentVersion().getPackVersion(side));
event.addRepositorySource((source) ->
public static void setupPack(AddPackFindersEvent event, String path, String id, boolean required, Function<Path, Pack.ResourcesSupplier> packBuilder) {
String folder = (event.getPackType() == PackType.SERVER_DATA ? "data/" : "resource/");
Path resourcePath = ModList.get().getModFileById(Redux.MODID).getFile().findResource("packs/" + folder + path);
PackMetadataSection metadata = new PackMetadataSection(Component.translatable("pack.aether_redux." + id + ".description"),
SharedConstants.getCurrentVersion().getPackVersion(event.getPackType()));
event.addRepositorySource((source) ->
source.accept(Pack.create(
"builtin/redux/" + folder + path,
Component.translatable("pack.aether_redux." + id + ".title"),
Expand All @@ -36,10 +35,10 @@ public static void setupPack(AddPackFindersEvent event, String path, String id,
false,
PackSource.BUILT_IN)
));
}

}

public static void setupPack(AddPackFindersEvent event, String path, String id, PackType side, boolean required) {
setupPack(event, path, id, side, required, resourcePath -> new PathPackResources.PathResourcesSupplier(resourcePath, true));
public static void setupPack(AddPackFindersEvent event, String path, String id, boolean required) {
setupPack(event, path, id, required, resourcePath -> new PathPackResources.PathResourcesSupplier(resourcePath, true));
}
}

0 comments on commit f6140fa

Please sign in to comment.