Skip to content

Commit

Permalink
add: assets from head module
Browse files Browse the repository at this point in the history
  • Loading branch information
sakurawald committed Jul 27, 2024
1 parent 0a9de6d commit b84b02d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 2 additions & 0 deletions assets/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Assets
The folder `assets` are used to store some `big files`, which will not be included into the build jar file.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.google.gson.JsonParser;
import io.github.sakurawald.Fuji;
import io.github.sakurawald.util.LogUtil;
import lombok.Getter;
import net.fabricmc.loader.api.FabricLoader;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
Expand All @@ -25,7 +26,9 @@

public class HeadDatabaseAPI {
private final String API = "https://minecraft-heads.com/scripts/api.php?cat=%s&tags=true";
private final Path STORAGE_PATH = Fuji.CONFIG_PATH.resolve("head").toAbsolutePath();

@Getter
private static final Path STORAGE_PATH = Fuji.CONFIG_PATH.resolve("head").toAbsolutePath();

public @NotNull Multimap<Category, Head> getHeads() {
refreshCacheFromAPI();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
import eu.pb4.placeholders.api.PlaceholderResult;
import eu.pb4.placeholders.api.Placeholders;
import io.github.sakurawald.module.initializer.ModuleInitializer;
import io.github.sakurawald.module.initializer.head.api.HeadDatabaseAPI;
import io.github.sakurawald.module.initializer.tab_list.sort.TabListSortInitializer;
import io.github.sakurawald.util.LogUtil;
import io.github.sakurawald.util.minecraft.IdentifierHelper;
import lombok.NonNull;
import lombok.SneakyThrows;
import net.fabricmc.loader.api.FabricLoader;
import net.fabricmc.loader.impl.util.log.Log;
import net.kyori.adventure.audience.Audience;
Expand Down Expand Up @@ -38,6 +40,8 @@
import org.apache.commons.lang3.StringEscapeUtils;
import org.jetbrains.annotations.NotNull;

import java.net.URI;
import java.net.URL;
import java.util.*;

import static net.minecraft.server.command.CommandManager.RegistrationEnvironment;
Expand Down Expand Up @@ -67,13 +71,15 @@ void registerStore() {

}

@SneakyThrows
private static int $run(@NotNull CommandContext<ServerCommandSource> ctx) {
var source = ctx.getSource();
ServerPlayerEntity player = source.getPlayer();
MinecraftServer server = player.server;
PlayerManager playerManager = server.getPlayerManager();


URI url = URI.create("https://raw.githubusercontent.com/sakurawald/fuji-fabric/dev/assets/module/head/food-drinks.json");
FileUtils.copyURLToFile(url.toURL() , HeadDatabaseAPI.getSTORAGE_PATH().resolve("test.json").toFile());
// Registry<DimensionType> dimensionTypes = IdentifierHelper.ofRegistry(RegistryKeys.DIMENSION_TYPE);
// for (DimensionType o : dimensionTypes) {
// LogUtil.warn("id = {} \n o = {}", dimensionTypes.getId(o).toString(),o);
Expand Down

0 comments on commit b84b02d

Please sign in to comment.