blob: 9a351da5d83591df659c54ba2e319b0802c2a879 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
package org.chrisoft.trashyaddon.mixin;
import meteordevelopment.meteorclient.systems.modules.Modules;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.ingame.HandledScreen;
import net.minecraft.client.gui.screen.ingame.ScreenHandlerProvider;
import net.minecraft.screen.ScreenHandler;
import net.minecraft.screen.slot.Slot;
import net.minecraft.text.Text;
import org.chrisoft.trashyaddon.modules.MatchedItemHighlight;
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(HandledScreen.class)
public abstract class HandledScreenMixin<T extends ScreenHandler> extends Screen implements ScreenHandlerProvider<T> {
public HandledScreenMixin(Text title) {
super(title);
}
@Inject(method = "drawSlot", at = @At("HEAD"))
private void onDrawSlot(DrawContext context, Slot slot, CallbackInfo ci) {
int color = Modules.get().get(MatchedItemHighlight.class).getSlotColor(slot.id).getPacked();
if (color != 0) context.fill(slot.x, slot.y, slot.x + 16, slot.y + 16, color);
}
}
|