[Changes] Sort Tags by name before writing
This commit is contained in:
parent
f5e26e5e9c
commit
cd65bcf4e8
1 changed files with 6 additions and 1 deletions
|
@ -8,6 +8,7 @@ import net.minecraft.resources.ResourceLocation;
|
||||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
|
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
|
||||||
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider;
|
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider;
|
||||||
|
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
@ -49,8 +50,12 @@ public class TagDataProvider<T> extends FabricTagProvider<T> {
|
||||||
protected void addTags(HolderLookup.Provider arg) {
|
protected void addTags(HolderLookup.Provider arg) {
|
||||||
tagRegistry.forEachTag((tag, locs, tags) -> {
|
tagRegistry.forEachTag((tag, locs, tags) -> {
|
||||||
if (locs.isEmpty() && tags.isEmpty()) return;
|
if (locs.isEmpty() && tags.isEmpty()) return;
|
||||||
|
|
||||||
final FabricTagProvider<T>.FabricTagBuilder builder = getOrCreateTagBuilder(tag);
|
final FabricTagProvider<T>.FabricTagBuilder builder = getOrCreateTagBuilder(tag);
|
||||||
|
|
||||||
|
locs.sort(Comparator.comparing(ResourceLocation::toString));
|
||||||
|
tags.sort(Comparator.comparing(a -> a.location().toString()));
|
||||||
|
|
||||||
locs.forEach(builder::add);
|
locs.forEach(builder::add);
|
||||||
tags.forEach(builder::addTag);
|
tags.forEach(builder::addTag);
|
||||||
}, (tag, loc) -> shouldAdd(tag.location()) || this.shouldAdd(loc));
|
}, (tag, loc) -> shouldAdd(tag.location()) || this.shouldAdd(loc));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue