forked from jacksonhardaway/server-pack-unlocker
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
6 changed files
with
39 additions
and
26 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
21 changes: 12 additions & 9 deletions
21
src/main/java/me/jaackson/spu/mixin/ClientBuiltinResourcePackProviderMixin.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,23 +1,26 @@ | ||
package me.jaackson.spu.mixin; | ||
|
||
import net.minecraft.client.resource.ClientBuiltinResourcePackProvider; | ||
import net.minecraft.resource.ResourcePack; | ||
import net.minecraft.resource.ResourcePackCompatibility; | ||
import net.minecraft.resource.ResourcePackProfile; | ||
import net.minecraft.resource.ResourcePackSource; | ||
import net.minecraft.text.Text; | ||
import org.jetbrains.annotations.Nullable; | ||
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.Redirect; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
import java.util.function.Supplier; | ||
import java.io.File; | ||
import java.util.concurrent.CompletableFuture; | ||
|
||
@Mixin(ClientBuiltinResourcePackProvider.class) | ||
public class ClientBuiltinResourcePackProviderMixin { | ||
|
||
@Redirect(at = @At("NEW"), method = "loadServerPack") | ||
private ResourcePackProfile unlockServerPack(String name, boolean alwaysEnabled, Supplier<ResourcePack> packFactory, Text displayName, Text description, ResourcePackCompatibility compatibility, ResourcePackProfile.InsertionPosition direction, boolean pinned, ResourcePackSource source) { | ||
return new ResourcePackProfile(name, alwaysEnabled, packFactory, displayName, description, compatibility, direction, false, source); | ||
|
||
@Shadow private @Nullable ResourcePackProfile serverContainer; | ||
|
||
@Inject(at = @At("TAIL"), method = "loadServerPack") | ||
private void unlockServerPack(File packZip, ResourcePackSource packSource, CallbackInfoReturnable<CompletableFuture<Void>> cir) { | ||
this.serverContainer = new ResourcePackProfile(serverContainer.getName(), serverContainer.isAlwaysEnabled(), ((ResourcePackProfileAccessor)serverContainer).accessPackFactory(), serverContainer.getDisplayName(), serverContainer.getDescription(), serverContainer.getCompatibility(), serverContainer.getInitialPosition(), false, serverContainer.getSource()); | ||
} | ||
|
||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/me/jaackson/spu/mixin/ResourcePackProfileAccessor.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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package me.jaackson.spu.mixin; | ||
|
||
import net.minecraft.resource.ResourcePack; | ||
import net.minecraft.resource.ResourcePackProfile; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.gen.Accessor; | ||
|
||
import java.util.function.Supplier; | ||
|
||
@Mixin(ResourcePackProfile.class) | ||
public interface ResourcePackProfileAccessor { | ||
|
||
@Accessor("packFactory") | ||
Supplier<ResourcePack> accessPackFactory(); | ||
|
||
} |
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