-
-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #487 from viciscat/dungeons_party_gui
Add a custom GUI for the Party Finder in dungeons
- Loading branch information
Showing
19 changed files
with
1,796 additions
and
3 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
47 changes: 47 additions & 0 deletions
47
src/main/java/de/hysky/skyblocker/mixin/HandledScreenProviderMixin.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,47 @@ | ||
package de.hysky.skyblocker.mixin; | ||
|
||
|
||
import de.hysky.skyblocker.config.SkyblockerConfigManager; | ||
import de.hysky.skyblocker.skyblock.dungeon.partyfinder.PartyFinderScreen; | ||
import net.minecraft.client.MinecraftClient; | ||
import net.minecraft.client.gui.screen.ingame.HandledScreens; | ||
import net.minecraft.client.network.ClientPlayerEntity; | ||
import net.minecraft.screen.GenericContainerScreenHandler; | ||
import net.minecraft.screen.ScreenHandler; | ||
import net.minecraft.screen.ScreenHandlerType; | ||
import net.minecraft.text.Text; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(HandledScreens.Provider.class) | ||
public interface HandledScreenProviderMixin<T extends ScreenHandler> { | ||
@Inject(method = "open", at = @At("HEAD"), cancellable = true) | ||
default void skyblocker$open(Text name, ScreenHandlerType<T> type, MinecraftClient client, int id, CallbackInfo ci) { | ||
if (!SkyblockerConfigManager.get().general.betterPartyFinder) return; | ||
ClientPlayerEntity player = client.player; | ||
if (player == null) return; | ||
T screenHandler = type.create(id, player.getInventory()); | ||
if (screenHandler instanceof GenericContainerScreenHandler containerScreenHandler && PartyFinderScreen.possibleInventoryNames.contains(name.getString().toLowerCase())) { | ||
if (client.currentScreen != null) { | ||
String lowerCase = client.currentScreen.getTitle().getString().toLowerCase(); | ||
if (lowerCase.contains("group builder")) return; | ||
if (lowerCase.contains("select tier")) { | ||
PartyFinderScreen.isInKuudraPartyFinder = true; | ||
} else if (lowerCase.contains("catacombs")) { | ||
PartyFinderScreen.isInKuudraPartyFinder = false; | ||
} | ||
} | ||
if (PartyFinderScreen.isInKuudraPartyFinder) return; | ||
client.player.currentScreenHandler = containerScreenHandler; | ||
if (client.currentScreen instanceof PartyFinderScreen screen) { | ||
screen.updateHandler(containerScreenHandler, name); | ||
} else { | ||
client.setScreen(new PartyFinderScreen(containerScreenHandler, player.getInventory(), name)); | ||
} | ||
|
||
ci.cancel(); | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/de/hysky/skyblocker/mixin/accessor/SkullBlockEntityAccessor.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,17 @@ | ||
package de.hysky.skyblocker.mixin.accessor; | ||
|
||
import com.mojang.authlib.GameProfile; | ||
import net.minecraft.block.entity.SkullBlockEntity; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.gen.Invoker; | ||
|
||
import java.util.Optional; | ||
import java.util.concurrent.CompletableFuture; | ||
|
||
@Mixin(SkullBlockEntity.class) | ||
public interface SkullBlockEntityAccessor { | ||
@Invoker | ||
static CompletableFuture<Optional<GameProfile>> invokeFetchProfile(String name) { | ||
throw new UnsupportedOperationException(); | ||
} | ||
} |
Oops, something went wrong.