-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
44915c8
commit df9c4c0
Showing
12 changed files
with
45 additions
and
28 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
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
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
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
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
34 changes: 20 additions & 14 deletions
34
...op/hendrixshen/tweakmyclient/mixin/patch/disableResourcePackCompatCheck/MixinOptions.java
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,30 +1,36 @@ | ||
package top.hendrixshen.tweakmyclient.mixin.patch.disableResourcePackCompatCheck; | ||
|
||
import net.minecraft.client.Options; | ||
import net.minecraft.server.packs.repository.Pack; | ||
import net.minecraft.server.packs.repository.PackRepository; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.ModifyArg; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture; | ||
import top.hendrixshen.tweakmyclient.TweakMyClient; | ||
|
||
import java.util.List; | ||
// Disable remove incompatible resource pack. | ||
import java.util.Iterator; | ||
import java.util.Set; | ||
|
||
@Mixin(Options.class) | ||
public class MixinOptions { | ||
@Shadow public List<String> incompatibleResourcePacks; | ||
|
||
@ModifyArg( | ||
@Inject( | ||
method = "loadSelectedResourcePacks", | ||
at = @At( | ||
value = "INVOKE", | ||
target = "Ljava/util/List;contains(Ljava/lang/Object;)Z", | ||
ordinal = 0, | ||
target = "Ljava/util/Iterator;remove()V", | ||
ordinal = 1, | ||
remap = false | ||
) | ||
), | ||
locals = LocalCapture.CAPTURE_FAILHARD | ||
) | ||
private Object on(Object o) { | ||
this.incompatibleResourcePacks.add((String) o); | ||
TweakMyClient.getLogger().warn("Prevented the removal of incompatible resource pack {} from options", o); | ||
return o; | ||
private void onRemovePack(PackRepository packRepository, CallbackInfo ci, @NotNull Set<String> set, Iterator<String> iterator, String string, @NotNull Pack pack) { | ||
// We forcefully prevent the removal of incompatible resource packages here | ||
// without doing any configuration checks, because at this point Malilib | ||
// has not yet loaded the configuration file. | ||
set.add(pack.getId()); | ||
TweakMyClient.getLogger().warn("Prevented the removal of incompatible resource pack {} from options", iterator); | ||
} | ||
} |
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