Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to 1.20.2 #6

Open
wants to merge 1 commit into
base: fabric/1.20
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ org.gradle.jvmargs = -Xmx1G

# filled in at build
mod_version = 1.3.<patch>
minecraft_version = 1.20.1
loader_version = 0.14.21
fabric_version = 0.86.0+1.20.1
porting_lib_version = 2.1.1090+1.20
minecraft_version = 1.20.2
loader_version = 0.14.22
fabric_version = 0.91.0+1.20.2
porting_lib_version = 2.1.1154+1.20.2
mixin_extras_version = 0.2.0-beta.6

# Mappings
# https://lambdaurora.dev/tools/import_quilt.html
qm_version = 21
qm_version = 3
Original file line number Diff line number Diff line change
@@ -1,34 +1,29 @@
package com.tterrag.registrate.providers;

import java.nio.file.Path;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.function.Consumer;

import com.google.common.collect.Lists;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.tterrag.registrate.AbstractRegistrate;
import lombok.extern.log4j.Log4j2;
import net.fabricmc.api.EnvType;
import org.jetbrains.annotations.Nullable;

import net.minecraft.advancements.Advancement;
import net.minecraft.advancements.AdvancementHolder;
import net.minecraft.core.HolderLookup;
import net.minecraft.core.HolderLookup.Provider;
import net.minecraft.data.CachedOutput;
import net.minecraft.data.DataProvider;
import net.minecraft.data.PackOutput;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.resources.ResourceLocation;
import org.jetbrains.annotations.Nullable;

@Log4j2
public class RegistrateAdvancementProvider implements RegistrateProvider, Consumer<Advancement> {
import java.nio.file.Path;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.function.Consumer;

private static final Gson GSON = (new GsonBuilder()).setPrettyPrinting().create();
@Log4j2
public class RegistrateAdvancementProvider implements RegistrateProvider, Consumer<AdvancementHolder> {

private final AbstractRegistrate<?> owner;
private final PackOutput packOutput;
Expand Down Expand Up @@ -75,23 +70,23 @@ public CompletableFuture<?> run(CachedOutput cache) {
}

@Override
public void accept(@Nullable Advancement t) {
public void accept(@Nullable AdvancementHolder t) {
CachedOutput cache = this.cache;
if (cache == null) {
throw new IllegalStateException("Cannot accept advancements outside of act");
}
Objects.requireNonNull(t, "Cannot accept a null advancement");
Path path = this.packOutput.getOutputFolder();
if (!seenAdvancements.add(t.getId())) {
throw new IllegalStateException("Duplicate advancement " + t.getId());
if (!seenAdvancements.add(t.id())) {
throw new IllegalStateException("Duplicate advancement " + t.id());
} else {
Path path1 = getPath(path, t);
advancementsToSave.add(DataProvider.saveStable(cache, t.deconstruct().serializeToJson(), path1));
advancementsToSave.add(DataProvider.saveStable(cache, t.value().serializeToJson(), path1));
}
}

private static Path getPath(Path pathIn, Advancement advancementIn) {
return pathIn.resolve("data/" + advancementIn.getId().getNamespace() + "/advancements/" + advancementIn.getId().getPath() + ".json");
private static Path getPath(Path pathIn, AdvancementHolder advancementIn) {
return pathIn.resolve("data/" + advancementIn.id().getNamespace() + "/advancements/" + advancementIn.id().getPath() + ".json");
}

public String getName() {
Expand Down
Loading