diff options
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 |