diff options
| author | shedaniel <daniel@shedaniel.me> | 2022-01-15 00:49:22 +0800 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2022-01-15 00:49:22 +0800 |
| commit | 08571477c095235110f3d9097a06baaf42e1b1c9 (patch) | |
| tree | 3cf6c0c524379d5cb6c07e534654a87bce49b277 /fabric/src/main/java | |
| parent | b07b0f77ec1327a8f927e4f4559387a0560b02ba (diff) | |
| download | RoughlyEnoughItems-08571477c095235110f3d9097a06baaf42e1b1c9.tar.gz RoughlyEnoughItems-08571477c095235110f3d9097a06baaf42e1b1c9.tar.bz2 RoughlyEnoughItems-08571477c095235110f3d9097a06baaf42e1b1c9.zip | |
Close #683
Diffstat (limited to 'fabric/src/main/java')
| -rw-r--r-- | fabric/src/main/java/me/shedaniel/rei/mixin/fabric/MixinEffectRenderingInventoryScreen.java | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/fabric/src/main/java/me/shedaniel/rei/mixin/fabric/MixinEffectRenderingInventoryScreen.java b/fabric/src/main/java/me/shedaniel/rei/mixin/fabric/MixinEffectRenderingInventoryScreen.java new file mode 100644 index 000000000..37565afe3 --- /dev/null +++ b/fabric/src/main/java/me/shedaniel/rei/mixin/fabric/MixinEffectRenderingInventoryScreen.java @@ -0,0 +1,41 @@ +package me.shedaniel.rei.mixin.fabric; + +import me.shedaniel.rei.api.client.config.ConfigObject; +import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; +import net.minecraft.client.gui.screens.inventory.EffectRenderingInventoryScreen; +import net.minecraft.network.chat.Component; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.inventory.AbstractContainerMenu; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.ModifyVariable; + +@Mixin(EffectRenderingInventoryScreen.class) +public abstract class MixinEffectRenderingInventoryScreen extends AbstractContainerScreen<AbstractContainerMenu> { + public MixinEffectRenderingInventoryScreen(AbstractContainerMenu menu, Inventory inventory, Component component) { + super(menu, inventory, component); + } + + @Unique + private boolean leftSideEffects() { + return ConfigObject.getInstance().isLeftSideMobEffects(); + } + + @ModifyVariable(method = "renderEffects", + at = @At(value = "INVOKE", target = "Lnet/minecraft/client/player/LocalPlayer;getActiveEffects()Ljava/util/Collection;", ordinal = 0), + ordinal = 2) // 3rd int + public int modifyK(int k) { + if (!leftSideEffects()) return k; + boolean bl = this.leftPos >= 120; + return bl ? this.leftPos - 120 - 4 : this.leftPos - 32 - 4; + } + + @ModifyVariable(method = "renderEffects", + at = @At(value = "INVOKE", target = "Lcom/google/common/collect/Ordering;sortedCopy(Ljava/lang/Iterable;)Ljava/util/List;", ordinal = 0), + ordinal = 0) // 1st bool + public boolean modifyBl(boolean bl) { + if (!leftSideEffects()) return bl; + return this.leftPos >= 120; + } +} |
