diff options
author | HacktheTime <l4bg0jb7@duck.com> | 2023-07-15 19:42:41 +0200 |
---|---|---|
committer | hackthetime <l4bg0jb7@duck.com> | 2023-09-05 08:22:07 +0200 |
commit | 94ef1e319dda7e1be4857297a0a9edbf8953346c (patch) | |
tree | ed6c5d295cd562edb9052c8f77ee8b57f82de732 /src/main/java | |
parent | 7f44f53220ee6d471a51baf5c7b6a4bbc37b5d89 (diff) | |
download | BBsentials-94ef1e319dda7e1be4857297a0a9edbf8953346c.tar.gz BBsentials-94ef1e319dda7e1be4857297a0a9edbf8953346c.tar.bz2 BBsentials-94ef1e319dda7e1be4857297a0a9edbf8953346c.zip |
General
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/de/hype/bbsentials/client/RenderOverlay.java | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/src/main/java/de/hype/bbsentials/client/RenderOverlay.java b/src/main/java/de/hype/bbsentials/client/RenderOverlay.java index 2efb7fe..6d6a070 100644 --- a/src/main/java/de/hype/bbsentials/client/RenderOverlay.java +++ b/src/main/java/de/hype/bbsentials/client/RenderOverlay.java @@ -4,26 +4,30 @@ 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.datafixer.fix.ItemNbtFix; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NbtCompound; 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; + if (BBsentials.bbserver.highlightItem()) { + MinecraftClient client = MinecraftClient.getInstance(); + if (client.currentScreen != null) { + 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 = 0; i < items.size(); i++) { + if (items.get(i).getName().getString().contains(BBsentials.bbserver.getItemName())) { + ItemStack found = items.get(i); + found.setCustomName(Text.literal("§r§6Splash Hub")); + } + } } - }//starting at 9 because first 10 are empty panes + } } - }} + } }
\ No newline at end of file |