-
Notifications
You must be signed in to change notification settings - Fork 7
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
aaa11e0
commit 0f2ab11
Showing
15 changed files
with
123 additions
and
24 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
45 changes: 45 additions & 0 deletions
45
src/main/java/me/srrapero720/embeddiumplus/mixins/impl/jei_rei_emi/EmiOverlayMixin.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,45 @@ | ||
package me.srrapero720.embeddiumplus.mixins.impl.jei_rei_emi; | ||
|
||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation; | ||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; | ||
import dev.emi.emi.runtime.EmiDrawContext; | ||
import dev.emi.emi.screen.EmiScreenManager; | ||
import dev.emi.emi.screen.widget.EmiSearchWidget; | ||
import me.srrapero720.embeddiumplus.EmbyConfig; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Pseudo; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.Unique; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.Redirect; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
import java.util.Iterator; | ||
import java.util.List; | ||
|
||
@Mixin(value = EmiScreenManager.class, remap = false) | ||
@Pseudo | ||
public class EmiOverlayMixin { | ||
@Shadow public static EmiSearchWidget search; | ||
@Unique private static int checkedPos = 0; | ||
|
||
@WrapOperation(method = "render", at = @At(value = "INVOKE", target = "Ldev/emi/emi/screen/EmiScreenManager$SidebarPanel;render(Ldev/emi/emi/runtime/EmiDrawContext;IIF)V")) | ||
private static void inject$renderStackOverlay(EmiScreenManager.SidebarPanel instance, EmiDrawContext totalPages, int i, int context, float mouseX, Operation<Void> original) { | ||
if (!EmbyConfig.hideJREMICache) { | ||
original.call(instance, totalPages, i, context, mouseX); | ||
} else { | ||
if (checkedPos == 1 && search.getValue().isEmpty()) { | ||
checkedPos++; | ||
return; | ||
} | ||
original.call(instance, totalPages, i, context, mouseX); | ||
checkedPos++; | ||
} | ||
} | ||
|
||
@Inject(method = "render", at = @At("RETURN")) | ||
private static void inject$renderCleanup(EmiDrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) { | ||
checkedPos = 0; | ||
} | ||
} |
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
41 changes: 41 additions & 0 deletions
41
src/main/java/me/srrapero720/embeddiumplus/mixins/impl/jei_rei_emi/ReiOverlayMixin.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,41 @@ | ||
package me.srrapero720.embeddiumplus.mixins.impl.jei_rei_emi; | ||
|
||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation; | ||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; | ||
import me.shedaniel.rei.api.client.gui.widgets.Widget; | ||
import me.shedaniel.rei.impl.client.REIRuntimeImpl; | ||
import me.shedaniel.rei.impl.client.gui.ScreenOverlayImpl; | ||
import me.shedaniel.rei.impl.client.gui.dragging.CurrentDraggingStack; | ||
import me.shedaniel.rei.impl.client.gui.widget.entrylist.EntryListWidget; | ||
import me.shedaniel.rei.impl.client.gui.widget.search.OverlaySearchField; | ||
import me.srrapero720.embeddiumplus.EmbyConfig; | ||
import net.minecraft.client.gui.GuiGraphics; | ||
import org.spongepowered.asm.mixin.*; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Mixin(value = ScreenOverlayImpl.class, priority = 500, remap = false) | ||
@Pseudo | ||
public class ReiOverlayMixin { | ||
@Unique private EntryListWidget embPlus$entryListWidget; | ||
|
||
@WrapOperation(method = "init", at = @At(value = "INVOKE", target = "Ljava/util/List;add(Ljava/lang/Object;)Z")) | ||
public boolean redirect$addOnList(List<Widget> instance, Object e, Operation<Boolean> original) { | ||
if (e instanceof EntryListWidget listWidget) { | ||
embPlus$entryListWidget = listWidget; | ||
return false; | ||
} else { | ||
return original.call(instance, e); | ||
} | ||
} | ||
|
||
@Inject(method = "renderWidgets", at = @At("TAIL")) | ||
public void inject$bottom(GuiGraphics graphics, int mouseX, int mouseY, float delta, CallbackInfo ci) { | ||
if (EmbyConfig.hideJREMICache && REIRuntimeImpl.getSearchField().getText().isEmpty()) return; | ||
embPlus$entryListWidget.render(graphics, mouseX, mouseY, delta); | ||
} | ||
} |
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