-
-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '1.20.x' into LootTableLoadEventFix-1.20.4
- Loading branch information
Showing
28 changed files
with
379 additions
and
396 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 9 additions & 21 deletions
30
patches/net/minecraft/client/gui/screens/packs/PackSelectionModel.java.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,11 @@ | ||
--- a/net/minecraft/client/gui/screens/packs/PackSelectionModel.java | ||
+++ b/net/minecraft/client/gui/screens/packs/PackSelectionModel.java | ||
@@ -106,6 +_,8 @@ | ||
boolean canMoveUp(); | ||
|
||
boolean canMoveDown(); | ||
+ | ||
+ default boolean notHidden() { return true; } | ||
} | ||
|
||
@OnlyIn(Dist.CLIENT) | ||
@@ -205,6 +_,11 @@ | ||
@Override | ||
public void moveDown() { | ||
this.move(1); | ||
+ } | ||
+ | ||
+ @Override | ||
+ public boolean notHidden() { | ||
+ return !pack.isHidden(); | ||
} | ||
} | ||
|
||
@@ -31,7 +_,7 @@ | ||
this.onListChanged = p_99909_; | ||
this.iconGetter = p_99910_; | ||
this.repository = p_99911_; | ||
- this.selected = Lists.newArrayList(p_99911_.getSelectedPacks()); | ||
+ this.selected = Lists.newArrayList(p_99911_.getSelectedPacks().stream().filter(p -> !p.isHidden()).toList()); | ||
Collections.reverse(this.selected); | ||
this.unselected = Lists.newArrayList(p_99911_.getAvailablePacks()); | ||
this.unselected.removeAll(this.selected); |
11 changes: 0 additions & 11 deletions
11
patches/net/minecraft/client/gui/screens/packs/PackSelectionScreen.java.patch
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
patches/net/minecraft/server/commands/DataPackCommand.java.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- a/net/minecraft/server/commands/DataPackCommand.java | ||
+++ b/net/minecraft/server/commands/DataPackCommand.java | ||
@@ -183,7 +_,7 @@ | ||
private static int listEnabledPacks(CommandSourceStack p_136866_) { | ||
PackRepository packrepository = p_136866_.getServer().getPackRepository(); | ||
packrepository.reload(); | ||
- Collection<? extends Pack> collection = packrepository.getSelectedPacks(); | ||
+ Collection<? extends Pack> collection = packrepository.getSelectedPacks().stream().filter(p -> !p.isHidden()).toList(); | ||
if (collection.isEmpty()) { | ||
p_136866_.sendSuccess(() -> Component.translatable("commands.datapack.list.enabled.none"), false); | ||
} else { |
57 changes: 2 additions & 55 deletions
57
patches/net/minecraft/server/packs/metadata/pack/PackMetadataSection.java.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,11 @@ | ||
--- a/net/minecraft/server/packs/metadata/pack/PackMetadataSection.java | ||
+++ b/net/minecraft/server/packs/metadata/pack/PackMetadataSection.java | ||
@@ -9,14 +_,59 @@ | ||
import net.minecraft.server.packs.metadata.MetadataSectionType; | ||
import net.minecraft.util.InclusiveRange; | ||
|
||
-public record PackMetadataSection(Component description, int packFormat, Optional<InclusiveRange<Integer>> supportedFormats) { | ||
+public record PackMetadataSection(Component description, @Deprecated int packFormat, Optional<InclusiveRange<Integer>> supportedFormats, Optional<NeoForgeData> neoForgeData) { | ||
public static final Codec<PackMetadataSection> CODEC = RecordCodecBuilder.create( | ||
p_304321_ -> p_304321_.group( | ||
ComponentSerialization.CODEC.fieldOf("description").forGetter(PackMetadataSection::description), | ||
Codec.INT.fieldOf("pack_format").forGetter(PackMetadataSection::packFormat), | ||
- InclusiveRange.codec(Codec.INT).optionalFieldOf("supported_formats").forGetter(PackMetadataSection::supportedFormats) | ||
+ InclusiveRange.codec(Codec.INT).optionalFieldOf("supported_formats").forGetter(PackMetadataSection::supportedFormats), | ||
+ NeoForgeData.CODEC.optionalFieldOf("neoforge").forGetter(PackMetadataSection::neoForgeData) | ||
) | ||
@@ -19,4 +_,8 @@ | ||
.apply(p_304321_, PackMetadataSection::new) | ||
); | ||
public static final MetadataSectionType<PackMetadataSection> TYPE = MetadataSectionType.fromCodec("pack", CODEC); | ||
+ | ||
+ @Deprecated | ||
+ public PackMetadataSection(Component description, int packFormat, Optional<InclusiveRange<Integer>> supportedFormats) { | ||
+ this(description, packFormat, supportedFormats, Optional.empty()); | ||
+ } | ||
+ | ||
+ public PackMetadataSection(Component description, int packFormat, InclusiveRange<Integer> supportedFormats) { | ||
+ this(description, packFormat, Optional.of(supportedFormats), Optional.empty()); | ||
+ } | ||
+ | ||
+ public PackMetadataSection(Component description, int packFormat, NeoForgeData neoForgeData) { | ||
+ this(description, packFormat, Optional.empty(), Optional.of(neoForgeData)); | ||
+ } | ||
+ | ||
+ public <R> PackMetadataSection(Component p_10371_, int p_10372_, java.util.Map<net.minecraft.server.packs.PackType, Integer> packTypeVersions) { | ||
+ this(p_10371_, p_10372_, new NeoForgeData(packTypeVersions)); | ||
+ } | ||
+ | ||
+ public PackMetadataSection(Component description, int packVersion) { | ||
+ this(description, packVersion, Optional.empty(), Optional.empty()); | ||
+ } | ||
+ | ||
+ public int packFormat(net.minecraft.server.packs.PackType packType) { | ||
+ return neoForgeData().flatMap(d -> d.packFormat(packType)).orElse(packFormat()); | ||
+ } | ||
+ | ||
+ public record NeoForgeData(Optional<java.util.Map<net.minecraft.server.packs.PackType, Integer>> formatPerPackType) { | ||
+ | ||
+ private static final Codec<NeoForgeData> CODEC = RecordCodecBuilder.create(builder -> builder.group( | ||
+ Codec.simpleMap( | ||
+ net.minecraft.util.StringRepresentable.fromEnum(net.minecraft.server.packs.PackType::values), | ||
+ Codec.INT, | ||
+ com.mojang.serialization.Keyable.forStrings(() -> java.util.Arrays.stream(net.minecraft.server.packs.PackType.values()).map(net.minecraft.util.StringRepresentable::getSerializedName)) | ||
+ ).codec().optionalFieldOf("versions").forGetter(NeoForgeData::formatPerPackType) | ||
+ ).apply(builder, NeoForgeData::new)); | ||
+ | ||
+ public NeoForgeData(java.util.Map<net.minecraft.server.packs.PackType, Integer> supportedFormats) { | ||
+ this(Optional.of(supportedFormats)); | ||
+ } | ||
+ | ||
+ public Optional<Integer> packFormat(net.minecraft.server.packs.PackType packType) { | ||
+ return formatPerPackType.map(p -> p.get(packType)); | ||
+ } | ||
+ this(description, packVersion, Optional.empty()); | ||
+ } | ||
} |
81 changes: 65 additions & 16 deletions
81
patches/net/minecraft/server/packs/repository/Pack.java.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,97 @@ | ||
--- a/net/minecraft/server/packs/repository/Pack.java | ||
+++ b/net/minecraft/server/packs/repository/Pack.java | ||
@@ -29,6 +_,7 @@ | ||
@@ -29,6 +_,8 @@ | ||
private final Pack.Position defaultPosition; | ||
private final boolean required; | ||
private final boolean fixedPosition; | ||
+ private final boolean hidden; // Forge: Allow packs to be hidden from the UI entirely | ||
+ private final boolean hidden; // Neo: Allow packs to be hidden from the UI entirely | ||
+ private final List<Pack> children; // Neo: Allows packs to specify packs which will always be placed beneath them; must be hidden | ||
private final PackSource packSource; | ||
|
||
@Nullable | ||
@@ -77,6 +_,7 @@ | ||
this.defaultPosition = p_251298_; | ||
this.fixedPosition = p_249753_; | ||
this.packSource = p_251608_; | ||
@@ -69,6 +_,33 @@ | ||
boolean p_249753_, | ||
PackSource p_251608_ | ||
) { | ||
+ this(p_252218_, p_248829_, p_249377_, p_251718_, p_250162_, p_251298_, p_249753_, p_251608_, List.of()); | ||
+ } | ||
+ | ||
+ private Pack( | ||
+ String p_252218_, | ||
+ boolean p_248829_, | ||
+ Pack.ResourcesSupplier p_249377_, | ||
+ Component p_251718_, | ||
+ Pack.Info p_250162_, | ||
+ Pack.Position p_251298_, | ||
+ boolean p_249753_, | ||
+ PackSource p_251608_, | ||
+ List<Pack> children | ||
+ ) { | ||
+ List<Pack> flattenedChildren = new java.util.ArrayList<>(); | ||
+ List<Pack> remainingChildren = children; | ||
+ // recursively flatten children | ||
+ while (!remainingChildren.isEmpty()) { | ||
+ List<Pack> oldChildren = remainingChildren; | ||
+ remainingChildren = new java.util.ArrayList<>(); | ||
+ for (Pack child : oldChildren) { | ||
+ flattenedChildren.add(child.withChildren(List.of()).hidden()); | ||
+ remainingChildren.addAll(child.getChildren()); | ||
+ } | ||
+ } | ||
+ this.children = List.copyOf(flattenedChildren); | ||
+ this.hidden = p_250162_.isHidden(); | ||
} | ||
|
||
@Nullable | ||
this.id = p_252218_; | ||
this.resources = p_249377_; | ||
this.title = p_251718_; | ||
@@ -96,7 +_,7 @@ | ||
PackCompatibility packcompatibility = PackCompatibility.forVersion(inclusiverange, p_294759_); | ||
OverlayMetadataSection overlaymetadatasection = packresources.getMetadataSection(OverlayMetadataSection.TYPE); | ||
List<String> list = overlaymetadatasection != null ? overlaymetadatasection.overlaysForVersion(p_294759_) : List.of(); | ||
- pack$info = new Pack.Info(packmetadatasection.description(), packcompatibility, featureflagset, list); | ||
+ pack$info = new Pack.Info(packmetadatasection.description(), packmetadatasection.packFormat(PackType.SERVER_DATA), packmetadatasection.packFormat(PackType.CLIENT_RESOURCES), packcompatibility, featureflagset, list, packresources.isHidden()); | ||
+ pack$info = new Pack.Info(packmetadatasection.description(), packcompatibility, featureflagset, list, packresources.isHidden()); | ||
} | ||
|
||
return pack$info; | ||
@@ -172,6 +_,8 @@ | ||
@@ -172,6 +_,33 @@ | ||
return this.packSource; | ||
} | ||
|
||
+ public boolean isHidden() { return hidden; } | ||
+ | ||
+ public List<Pack> getChildren() { return children; } | ||
+ | ||
+ /** | ||
+ * {@return a copy of the pack with the provided children in place of any children this pack currently has} | ||
+ */ | ||
+ public Pack withChildren(List<Pack> children) { | ||
+ return new Pack(this.id, this.required, this.resources, this.title, this.info, this.defaultPosition, this.fixedPosition, this.packSource, children); | ||
+ } | ||
+ | ||
+ /** | ||
+ * {@return a copy of the pack that is hidden} | ||
+ */ | ||
+ public Pack hidden() { | ||
+ return new Pack( | ||
+ this.id, this.required, this.resources, this.title, | ||
+ new Info( | ||
+ this.info.description(), | ||
+ info.compatibility(), | ||
+ info.requestedFeatures(), | ||
+ info.overlays(), | ||
+ true | ||
+ ), | ||
+ this.defaultPosition, this.fixedPosition, this.packSource, this.children); | ||
+ } | ||
+ | ||
@Override | ||
public boolean equals(Object p_10448_) { | ||
if (this == p_10448_) { | ||
@@ -189,7 +_,10 @@ | ||
@@ -189,7 +_,7 @@ | ||
return this.id.hashCode(); | ||
} | ||
|
||
- public static record Info(Component description, PackCompatibility compatibility, FeatureFlagSet requestedFeatures, List<String> overlays) { | ||
+ public static record Info(Component description, int dataFormat, int resourceFormat, PackCompatibility compatibility, FeatureFlagSet requestedFeatures, List<String> overlays, boolean isHidden) { | ||
+ public int getFormat(PackType type) { | ||
+ return type == PackType.SERVER_DATA ? this.dataFormat : this.resourceFormat; | ||
+ } | ||
+ public static record Info(Component description, PackCompatibility compatibility, FeatureFlagSet requestedFeatures, List<String> overlays, boolean isHidden) { | ||
} | ||
|
||
public static enum Position { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 0 additions & 24 deletions
24
patches/net/minecraft/server/packs/resources/FallbackResourceManager.java.patch
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.