generated from Fallen-Breath/fabric-mod-template
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ensure
mlShulkerBoxPreviewSupportEnderChest
work with mc1.20.6+ min…
…ihud as well minihud introduced the same check as what tweakeroo introduced in mc1.20.6 resolved #80
- Loading branch information
1 parent
a323830
commit e0b95ac
Showing
3 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
...ks/mod_tweaks/mlShulkerBoxPreviewSupportEnderChest/compat/minihud/RenderHandlerMixin.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,34 @@ | ||
/* | ||
* This file is part of the TweakerMore project, licensed under the | ||
* GNU Lesser General Public License v3.0 | ||
* | ||
* Copyright (C) 2024 Fallen_Breath and contributors | ||
* | ||
* TweakerMore is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* TweakerMore is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with TweakerMore. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package me.fallenbreath.tweakermore.mixins.tweaks.mod_tweaks.mlShulkerBoxPreviewSupportEnderChest.compat.minihud; | ||
|
||
import me.fallenbreath.conditionalmixin.api.annotation.Condition; | ||
import me.fallenbreath.conditionalmixin.api.annotation.Restriction; | ||
import me.fallenbreath.tweakermore.util.ModIds; | ||
import me.fallenbreath.tweakermore.util.mixin.DummyClass; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
|
||
@Restriction(require = @Condition(ModIds.tweakeroo)) | ||
@Mixin(DummyClass.class) | ||
public abstract class RenderHandlerMixin | ||
{ | ||
// impl in mc 1.20.6+ | ||
} |
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
63 changes: 63 additions & 0 deletions
63
...ks/mod_tweaks/mlShulkerBoxPreviewSupportEnderChest/compat/minihud/RenderHandlerMixin.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,63 @@ | ||
/* | ||
* This file is part of the TweakerMore project, licensed under the | ||
* GNU Lesser General Public License v3.0 | ||
* | ||
* Copyright (C) 2024 Fallen_Breath and contributors | ||
* | ||
* TweakerMore is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* TweakerMore is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with TweakerMore. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package me.fallenbreath.tweakermore.mixins.tweaks.mod_tweaks.mlShulkerBoxPreviewSupportEnderChest.compat.minihud; | ||
|
||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue; | ||
import com.llamalad7.mixinextras.sugar.Local; | ||
import fi.dy.masa.minihud.event.RenderHandler; | ||
import me.fallenbreath.conditionalmixin.api.annotation.Condition; | ||
import me.fallenbreath.conditionalmixin.api.annotation.Restriction; | ||
import me.fallenbreath.tweakermore.impl.mod_tweaks.mlShulkerBoxPreviewSupportEnderChest.EnderChestItemFetcher; | ||
import me.fallenbreath.tweakermore.util.ModIds; | ||
import net.minecraft.item.ItemStack; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
|
||
@Restriction(require = @Condition(ModIds.minihud)) | ||
@Mixin(RenderHandler.class) | ||
public abstract class RenderHandlerMixin | ||
{ | ||
// at least sakura-ryoko's fork adds these extra checks | ||
|
||
@ModifyExpressionValue( | ||
method = "onRenderTooltipLast", | ||
at = @At( | ||
value = "INVOKE", | ||
target = "Lnet/minecraft/component/ComponentMap;contains(Lnet/minecraft/component/DataComponentType;)Z" | ||
) | ||
) | ||
private boolean mlShulkerBoxPreviewSupportEnderChest_minihudSkipCheck1(boolean contains, @Local(argsOnly = true) ItemStack stack) | ||
{ | ||
return contains || EnderChestItemFetcher.enableFor(stack); | ||
} | ||
|
||
@ModifyExpressionValue( | ||
method = "onRenderTooltipLast", | ||
at = @At( | ||
value = "INVOKE", | ||
target = "Lfi/dy/masa/malilib/util/InventoryUtils;shulkerBoxHasItems(Lnet/minecraft/item/ItemStack;)Z" | ||
) | ||
) | ||
private boolean mlShulkerBoxPreviewSupportEnderChest_minihudSkipCheck2(boolean contains, @Local(argsOnly = true) ItemStack stack) | ||
{ | ||
return contains || EnderChestItemFetcher.enableFor(stack); | ||
} | ||
} |