AHilyard / ItemBorders

A mod for Minecraft that shows colored borders around items to indicate their rarity.
Other
12 stars 1 forks source link

Nether Chested compatibility #26

Open LTCatt opened 7 months ago

LTCatt commented 7 months ago

That's it.

import com.anthonyhilyard.itemborders.ItemBorders;
import fuzs.puzzlesaccessapi.api.client.container.v1.ExtendableContainerScreen;
import fuzs.puzzlesapi.api.client.limitlesscontainers.v1.LimitlessContainerScreen;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.inventory.Slot;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import org.jetbrains.annotations.NotNull;
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(LimitlessContainerScreen.class)
@OnlyIn(Dist.CLIENT)
public class Border<T extends AbstractContainerMenu> extends ExtendableContainerScreen<T> {
    public Border(T menu, Inventory inventory, Component title) { super(menu, inventory, title); }
    protected void renderBg(@NotNull GuiGraphics guiGraphics, float v, int i, int i1) {}

    @Inject(method = "m_280092_", at = @At(value = "INVOKE", target = "Lfuzs/puzzlesapi/impl/limitlesscontainers/client/AdvancedItemRenderer;renderItemDecorations(Lnet/minecraft/client/gui/GuiGraphics;Lnet/minecraft/client/gui/Font;Lnet/minecraft/world/item/ItemStack;IILjava/lang/String;)V", shift = At.Shift.AFTER, remap = false), remap = false)
    private void renderSlot(GuiGraphics guiGraphics, Slot slot, CallbackInfo ci) {
        ItemBorders.renderBorder(guiGraphics.pose(), slot);
    }

}
denerka commented 4 months ago

Yes please! Personally looking for Fabric 1.20.1.