aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/de/hype/bbsentials/client/RenderOverlay.java29
-rw-r--r--src/main/java/de/hype/bbsentials/communication/highlighter.java92
-rw-r--r--src/main/java/de/hype/bbsentials/mixins/renderItemMixin.java26
-rw-r--r--src/main/resources/modid.mixins.json1
4 files changed, 29 insertions, 119 deletions
diff --git a/src/main/java/de/hype/bbsentials/client/RenderOverlay.java b/src/main/java/de/hype/bbsentials/client/RenderOverlay.java
new file mode 100644
index 0000000..2efb7fe
--- /dev/null
+++ b/src/main/java/de/hype/bbsentials/client/RenderOverlay.java
@@ -0,0 +1,29 @@
+package de.hype.bbsentials.client;
+
+import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback;
+import net.minecraft.client.MinecraftClient;
+import net.minecraft.client.gui.DrawContext;
+import net.minecraft.client.gui.screen.ingame.GenericContainerScreen;
+import net.minecraft.item.ItemStack;
+import net.minecraft.text.Text;
+import net.minecraft.util.collection.DefaultedList;
+
+public class RenderOverlay implements HudRenderCallback {
+ @Override
+ public void onHudRender(DrawContext drawContext, float tickDelta) {
+ MinecraftClient client = MinecraftClient.getInstance();
+ // Check if the item is present in the GUI
+ if (BBsentials.bbserver.highlightItem()){
+ if (client.currentScreen instanceof GenericContainerScreen && client.currentScreen.getTitle().getString().equals("SkyBlock Hub Selector")) {
+ GenericContainerScreen containerScreen = (GenericContainerScreen) client.currentScreen;
+ DefaultedList<ItemStack> items = containerScreen.getScreenHandler().getStacks();
+ for (int i = 9; i < items.size()-9; i++) {
+ if (items.get(i).getName().getString().contains(BBsentials.bbserver.getItemName())) {
+ ItemStack found = items.get(i);
+ found.setCustomName(Text.literal("§r§6Splash Hub"));
+ break;
+ }
+ }//starting at 9 because first 10 are empty panes
+ }
+ }}
+} \ No newline at end of file
diff --git a/src/main/java/de/hype/bbsentials/communication/highlighter.java b/src/main/java/de/hype/bbsentials/communication/highlighter.java
deleted file mode 100644
index 4809a5c..0000000
--- a/src/main/java/de/hype/bbsentials/communication/highlighter.java
+++ /dev/null
@@ -1,92 +0,0 @@
-//https://github.com/AHilyard/ItemBorders/blob/main/src/main/java/com/anthonyhilyard/itemborders/ItemBorders.java
-package de.hype;
-
-import net.minecraft.ChatFormatting;
-import net.minecraft.client.renderer.MultiBufferSource;
-import net.minecraft.client.renderer.MultiBufferSource.BufferSource;
-import net.minecraft.network.chat.TextColor;
-import net.minecraft.world.inventory.Slot;
-import net.minecraft.world.item.ItemStack;
-
-import com.mojang.blaze3d.systems.RenderSystem;
-import com.mojang.blaze3d.vertex.PoseStack;
-import com.mojang.blaze3d.vertex.Tesselator;
-import com.mojang.math.Matrix4f;
-
-public class ItemBorders
-{
- public static void renderBorder(PoseStack poseStack, Slot slot)
- {
- // Container GUIs.
- render(poseStack, slot.getItem(), slot.x, slot.y);
- }
-
- public static void renderBorder(PoseStack poseStack, ItemStack item, int x, int y)
- {
- // If borders are enabled for the hotbar...
- if (ItemBordersConfig.INSTANCE.hotBar.get())
- {
- render(new PoseStack(), item, x, y);
- }
- }
-
- private static void render(PoseStack poseStack, ItemStack item, int x, int y)
- {
- if (item.isEmpty())
- {
- return;
- }
-
- TextColor color = ItemBordersConfig.INSTANCE.getBorderColorForItem(item);
-
- // If the color is null, default to white.
- if (color == null)
- {
- color = TextColor.fromLegacyFormat(ChatFormatting.WHITE);
- }
-
- if (color.getValue() == ChatFormatting.WHITE.getColor() && !ItemBordersConfig.INSTANCE.showForCommon.get())
- {
- return;
- }
-
- RenderSystem.disableDepthTest();
-
- poseStack.pushPose();
- poseStack.translate(0, 0, ItemBordersConfig.INSTANCE.overItems.get() ? 290 : 100);
- Matrix4f matrix = poseStack.last().pose();
-
- int startColor = color.getValue() | 0xEE000000;
- int endColor = color.getValue() & 0x00FFFFFF;
-
- int topColor = ItemBordersConfig.INSTANCE.fullBorder.get() ? startColor : endColor;
- int bottomColor = startColor;
-
- int xOffset = ItemBordersConfig.INSTANCE.squareCorners.get() ? 0 : 1;
-
- BufferSource bufferSource = MultiBufferSource.immediate(Tesselator.getInstance().getBuilder());
- GuiUtils.drawGradientRect(matrix, -1, x, y + 1, x + 1, y + 15, topColor, bottomColor);
- GuiUtils.drawGradientRect(matrix, -1, x + 15, y + 1, x + 16, y + 15, topColor, bottomColor);
-
- GuiUtils.drawGradientRect(matrix, -1, x + xOffset, y, x + 16 - xOffset, y + 1, topColor, topColor);
- GuiUtils.drawGradientRect(matrix, -1, x + xOffset, y + 15, x + 16 - xOffset, y + 16, bottomColor, bottomColor);
-
- if (ItemBordersConfig.INSTANCE.extraGlow.get())
- {
- int topAlpha = ((topColor >> 24) & 0xFF) / 3;
- int bottomAlpha = ((bottomColor >> 24) & 0xFF) / 3;
-
- int topGlowColor = (topAlpha << 24) | (topColor & 0x00FFFFFF);
- int bottomGlowColor = (bottomAlpha << 24) | (bottomColor & 0x00FFFFFF);
-
- GuiUtils.drawGradientRect(matrix, -1, x + 1, y + 1, x + 2, y + 15, topGlowColor, bottomGlowColor);
- GuiUtils.drawGradientRect(matrix, -1, x + 14, y + 1, x + 15, y + 15, topGlowColor, bottomGlowColor);
-
- GuiUtils.drawGradientRect(matrix, -1, x + 1, y + 1, x + 15, y + 2, topGlowColor, topGlowColor);
- GuiUtils.drawGradientRect(matrix, -1, x + 1, y + 14, x + 15, y + 15, bottomGlowColor, bottomGlowColor);
- }
-
- bufferSource.endBatch();
- poseStack.popPose();
- }
-} \ No newline at end of file
diff --git a/src/main/java/de/hype/bbsentials/mixins/renderItemMixin.java b/src/main/java/de/hype/bbsentials/mixins/renderItemMixin.java
deleted file mode 100644
index c4ab2cd..0000000
--- a/src/main/java/de/hype/bbsentials/mixins/renderItemMixin.java
+++ /dev/null
@@ -1,26 +0,0 @@
-import com.anthonyhilyard.itemborders.ItemBorders;
-import com.mojang.blaze3d.vertex.PoseStack;
-
-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.At.Shift;
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-
-import net.minecraft.client.gui.screens.Screen;
-import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
-import net.minecraft.world.inventory.Slot;
-import net.minecraft.network.chat.Component;
-
-@Mixin(AbstractContainerScreen.class)
-public class AbstractContainerScreenMixin extends Screen
-{
- protected AbstractContainerScreenMixin(Component titleIn) { super(titleIn); }
-
- @Inject(method = "renderSlot", at = @At(value = "INVOKE",
- target = "Lnet/minecraft/client/renderer/entity/ItemRenderer;renderAndDecorateItem(Lnet/minecraft/world/entity/LivingEntity;Lnet/minecraft/world/item/ItemStack;III)V", shift = Shift.AFTER))
- public void renderSlot(PoseStack poseStack, Slot slot, CallbackInfo info)
- {
- ItemBorders.renderBorder(poseStack, slot);
- }
-} \ No newline at end of file
diff --git a/src/main/resources/modid.mixins.json b/src/main/resources/modid.mixins.json
index 62ccbf4..50a63d3 100644
--- a/src/main/resources/modid.mixins.json
+++ b/src/main/resources/modid.mixins.json
@@ -9,7 +9,6 @@
],
"client": [
"SimpleOptionMixin",
- "renderItemMixin",
"ClientCommandSourceMixin"],
"injectors": {
"defaultRequire": 1