diff options
| author | Hendrik Horstmann <65970327+heinrich26@users.noreply.github.com> | 2023-09-29 04:01:02 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-29 12:01:02 +1000 |
| commit | 981acc84d7426c8b643492b24a8731208976d6e2 (patch) | |
| tree | da791efe0b799597a76857ed2d1264d5eeaab9eb /src/main/java | |
| parent | e34d22adea31de68cf9bf081fa51dd652219e254 (diff) | |
| download | NotEnoughUpdates-981acc84d7426c8b643492b24a8731208976d6e2.tar.gz NotEnoughUpdates-981acc84d7426c8b643492b24a8731208976d6e2.tar.bz2 NotEnoughUpdates-981acc84d7426c8b643492b24a8731208976d6e2.zip | |
Hover Effect for Equipment- & Pet-Display, Vanilla Cooldowns, New DevCommands, Improved CustomSkulls (#837)
Diffstat (limited to 'src/main/java')
12 files changed, 295 insertions, 192 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/listener/ItemTooltipListener.java b/src/main/java/io/github/moulberry/notenoughupdates/listener/ItemTooltipListener.java index 01a173d3..af3b9539 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/listener/ItemTooltipListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/listener/ItemTooltipListener.java @@ -673,6 +673,7 @@ public class ItemTooltipListener { boolean m = Keyboard.isKeyDown(Keyboard.KEY_M); boolean n = Keyboard.isKeyDown(Keyboard.KEY_N); boolean f = Keyboard.isKeyDown(Keyboard.KEY_F); + boolean b = Keyboard.isKeyDown(Keyboard.KEY_B); if (!copied && f && NotEnoughUpdates.INSTANCE.config.hidden.dev) { MiscUtils.copyToClipboard(NotEnoughUpdates.INSTANCE.manager.getSkullValueForItem(event.itemStack)); @@ -688,6 +689,12 @@ public class ItemTooltipListener { if (event.itemStack.getTagCompound() != null) { NBTTagCompound tag = event.itemStack.getTagCompound(); + event.toolTip.add(EnumChatFormatting.AQUA + "NBT: " + EnumChatFormatting.GRAY + "[...]" + + EnumChatFormatting.GOLD + " [B]"); + if (!copied && b) { + MiscUtils.copyToClipboard(tag.toString()); + } + if (tag.hasKey("SkullOwner", 10)) { GameProfile gameprofile = NBTUtil.readGameProfileFromNBT(tag.getCompoundTag("SkullOwner")); @@ -715,7 +722,7 @@ public class ItemTooltipListener { } } - copied = k || m || n || f; + copied = k || m || n || f || b; } } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomSkulls.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomSkulls.java index 95ec0f7a..d57012d2 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomSkulls.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomSkulls.java @@ -59,10 +59,12 @@ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; +import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.NoSuchElementException; import java.util.Set; public class CustomSkulls implements IResourceManagerReloadListener { @@ -72,9 +74,11 @@ public class CustomSkulls implements IResourceManagerReloadListener { return INSTANCE; } - private final ResourceLocation atlas = new ResourceLocation("notenoughupdates:custom_skull_textures_atlas"); + private final ResourceLocation atlas = new ResourceLocation("notenoughupdates", "custom_skull_textures_atlas"); private final ResourceLocation configuration = new ResourceLocation( - "notenoughupdates:custom_skull_textures/customskull.json"); + "notenoughupdates", "custom_skull_textures/customskull.json"); + private final ResourceLocation configuration2 = new ResourceLocation( + "notenoughupdates", "custom_skull_textures/customskull2.json"); protected final TextureMap textureMap = new TextureMap("custom_skull_textures"); public static ItemCameraTransforms.TransformType mostRecentTransformType = ItemCameraTransforms.TransformType.NONE; @@ -85,6 +89,7 @@ public class CustomSkulls implements IResourceManagerReloadListener { private final ModelSkeletonHead humanoidHead = new ModelHumanoidHead(); private final HashMap<String, CustomSkull> customSkulls = new HashMap<>(); + private final HashMap<String, CustomSkull> customSkulls2 = new HashMap<>(); private final Gson gson = new GsonBuilder().create(); @@ -95,13 +100,12 @@ public class CustomSkulls implements IResourceManagerReloadListener { private ResourceLocation texture; } - @Override - public void onResourceManagerReload(IResourceManager resourceManager) { - customSkulls.clear(); + private void processConfig(ResourceLocation config, Map<String, CustomSkull> map, Map<String, CustomSkull> cache) { + map.clear(); try ( BufferedReader reader = new BufferedReader(new InputStreamReader( - Minecraft.getMinecraft().getResourceManager().getResource(configuration).getInputStream(), + Minecraft.getMinecraft().getResourceManager().getResource(config).getInputStream(), StandardCharsets.UTF_8 )) ) { @@ -112,47 +116,73 @@ public class CustomSkulls implements IResourceManagerReloadListener { for (Map.Entry<String, JsonElement> entry : json.entrySet()) { if (entry.getValue().isJsonObject()) { JsonObject obj = entry.getValue().getAsJsonObject(); + CustomSkull skull; if (obj.has("model")) { - String location = obj.get("model").getAsString(); - ResourceLocation loc = new ResourceLocation("notenoughupdates:custom_skull_textures/" + location + ".json"); + ResourceLocation loc = new ResourceLocation( + "notenoughupdates", + "custom_skull_textures/" + obj.get("model").getAsString() + ".json" + ); - CustomSkull skull = new CustomSkull(); - skull.model = ModelBlock.deserialize(new InputStreamReader(Minecraft - .getMinecraft() - .getResourceManager() - .getResource(loc) - .getInputStream())); - customSkulls.put(entry.getKey(), skull); + if ((skull = cache.get(loc.toString())) == null) { + skull = new CustomSkull(); + skull.model = ModelBlock.deserialize(new InputStreamReader(Minecraft + .getMinecraft() + .getResourceManager() + .getResource(loc) + .getInputStream())); + + cache.put(loc.toString(), skull); + } + + map.put(entry.getKey(), skull); } else if (obj.has("texture")) { String location = obj.get("texture").getAsString(); - ResourceLocation loc = new ResourceLocation("notenoughupdates:custom_skull_textures/" + location + ".png"); + ResourceLocation loc = new ResourceLocation( + "notenoughupdates", + "custom_skull_textures/" + location + ".png" + ); - CustomSkull skull = new CustomSkull(); - skull.texture = loc; + if ((skull = cache.get(loc.toString())) == null) { + skull = new CustomSkull(); + skull.texture = loc; + Minecraft.getMinecraft().getTextureManager().deleteTexture(skull.texture); - Minecraft.getMinecraft().getTextureManager().deleteTexture(skull.texture); + cache.put(loc.toString(), skull); + } - customSkulls.put(entry.getKey(), skull); + map.put(entry.getKey(), skull); } } } + } catch (Exception ignored) {} + } - loadSprites(); + @Override + public void onResourceManagerReload(IResourceManager resourceManager) { + Map<String, CustomSkull> skullCache = new HashMap<>(); + processConfig(configuration, customSkulls, skullCache); + processConfig(configuration2, customSkulls2, skullCache); + + if (customSkulls.isEmpty() && customSkulls2.isEmpty()) return; - for (CustomSkull skull : customSkulls.values()) { - if (skull.model != null) { - skull.modelBaked = bakeModel(skull.model, ModelRotation.X0_Y0, false); + try { + loadSprites(skullCache.values()); + + skullCache.values().forEach( + (CustomSkull skull) -> { + if (skull.model != null) { + skull.modelBaked = bakeModel(skull.model, ModelRotation.X0_Y0, false); + } } - } + ); Minecraft.getMinecraft().getTextureManager().loadTexture(atlas, textureMap); - } catch (Exception ignored) { - } + } catch (Exception ignored) {} } - private void loadSprites() { - final Set<ResourceLocation> set = this.getAllTextureLocations(); + private void loadSprites(Collection<CustomSkull> models) { + final Set<ResourceLocation> set = this.getAllTextureLocations(models); set.remove(TextureMap.LOCATION_MISSING_TEXTURE); IIconCreator iiconcreator = iconRegistry -> { for (ResourceLocation resourcelocation : set) { @@ -164,10 +194,10 @@ public class CustomSkulls implements IResourceManagerReloadListener { this.sprites.put(new ResourceLocation("missingno"), this.textureMap.getMissingSprite()); } - protected Set<ResourceLocation> getAllTextureLocations() { + protected Set<ResourceLocation> getAllTextureLocations(Collection<CustomSkull> models) { Set<ResourceLocation> set = new HashSet<>(); - for (CustomSkull skull : customSkulls.values()) { + for (CustomSkull skull : models) { if (skull.model != null) { set.addAll(getTextureLocations(skull.model)); } @@ -288,13 +318,8 @@ public class CustomSkulls implements IResourceManagerReloadListener { } private void renderQuads(WorldRenderer renderer, List<BakedQuad> quads, int color) { - int i = 0; - - for (int j = quads.size(); i < j; ++i) { - BakedQuad bakedquad = quads.get(i); - int k = color; - - net.minecraftforge.client.model.pipeline.LightUtil.renderQuadColor(renderer, bakedquad, k); + for (BakedQuad quad : quads) { + net.minecraftforge.client.model.pipeline.LightUtil.renderQuadColor(renderer, quad, color); } } @@ -305,7 +330,7 @@ public class CustomSkulls implements IResourceManagerReloadListener { if (NotEnoughUpdates.INSTANCE.config.misc.disableSkullRetexturing) { return false; } - if (placedDirection != EnumFacing.UP || skullType != 3) { + if (skullType != 3) { return false; } if (skullOwner == null || skullOwner.getId() == null) { @@ -314,7 +339,12 @@ public class CustomSkulls implements IResourceManagerReloadListener { CustomSkull skull = customSkulls.get(skullOwner.getId().toString()); if (skull == null) { - return false; + try { + skull = customSkulls2.get(skullOwner.getProperties().get("textures").iterator().next().getValue()); + if (skull == null) return false; + } catch (NoSuchElementException e) { + return false; + } } if (skull.modelBaked != null && skull.model != null) { @@ -323,16 +353,42 @@ public class CustomSkulls implements IResourceManagerReloadListener { GlStateManager.disableCull(); GlStateManager.enableLighting(); - GlStateManager.translate(xOffset + 0.5F, yOffset, zOffset + 0.5F); + final float rot; + switch (placedDirection) { + case NORTH: { + GlStateManager.translate(xOffset + 0.5f, yOffset + 0.25f, zOffset + 0.74f); + rot = 0f; + break; + } + case SOUTH: { + GlStateManager.translate(xOffset + 0.5f, yOffset + 0.25f, zOffset + 0.26f); + rot = 180.0f; + break; + } + case WEST: { + GlStateManager.translate(xOffset + 0.74f, yOffset + 0.25f, zOffset + 0.5f); + rot = 270.0f; + break; + } + case EAST: { + GlStateManager.translate(xOffset + 0.26f, yOffset + 0.25f, zOffset + 0.5f); + rot = 90.0f; + break; + } + default: { + GlStateManager.translate(xOffset + 0.5f, yOffset, zOffset + 0.5f); + rot = rotationDeg; + } + } GlStateManager.enableRescaleNormal(); GlStateManager.enableAlpha(); - GlStateManager.rotate(rotationDeg, 0, 1, 0); + GlStateManager.rotate(rot, 0, 1, 0); GlStateManager.translate(0, 0.25f, 0); - if (xOffset == -0.5 && yOffset == 0 && zOffset == -0.5 && rotationDeg == 180) { + if (placedDirection == EnumFacing.UP && xOffset == -0.5 && yOffset == 0 && zOffset == -0.5 && rotationDeg == 180) { skull.model.getAllTransforms().applyTransform(ItemCameraTransforms.TransformType.HEAD); } else { skull.model.getAllTransforms().applyTransform(mostRecentTransformType); @@ -375,11 +431,10 @@ public class CustomSkulls implements IResourceManagerReloadListener { GlStateManager.translate(xOffset + 0.5F, yOffset, zOffset + 0.5F); - float f = 0.0625F; GlStateManager.enableRescaleNormal(); GlStateManager.scale(-1.0F, -1.0F, 1.0F); GlStateManager.enableAlpha(); - humanoidHead.render(null, 0.0F, 0.0F, 0.0F, rotationDeg, 0.0F, f); + humanoidHead.render(null, 0.0F, 0.0F, 0.0F, rotationDeg, 0.0F, 0.0625F); GlStateManager.popMatrix(); } else { return false; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java index 7ac09085..6c0e2499 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java @@ -929,7 +929,7 @@ public class PetInfoOverlay extends TextOverlay { float deltaXp = skillXp - skillXpLast; - float gain = getXpGain(currentPet, deltaXp, entry.getKey().toUpperCase()); + float gain = getXpGain(currentPet, deltaXp, entry.getKey()); totalGain += gain; skillInfoMapLast.put(entry.getKey(), skillXp); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRenderItem.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRenderItem.java index 633a82a2..9705742b 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRenderItem.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRenderItem.java @@ -22,10 +22,12 @@ package io.github.moulberry.notenoughupdates.mixins; import io.github.moulberry.notenoughupdates.NEUOverlay; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.core.ChromaColour; +import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils; import io.github.moulberry.notenoughupdates.listener.RenderListener; import io.github.moulberry.notenoughupdates.miscfeatures.ItemCooldowns; import io.github.moulberry.notenoughupdates.miscfeatures.ItemCustomizeManager; import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer; +import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; @@ -39,6 +41,8 @@ import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.resources.model.IBakedModel; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.MathHelper; +import net.minecraftforge.fml.client.config.GuiUtils; import org.lwjgl.opengl.GL11; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -47,6 +51,7 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + @Mixin({RenderItem.class}) public abstract class MixinRenderItem { private static void func_181565_a( @@ -54,13 +59,13 @@ public abstract class MixinRenderItem { int r, int g, int b, int a ) { w.begin(7, DefaultVertexFormats.POSITION_COLOR); - w.pos((x + 0), (y + 0), 0.0D) + w.pos(x, y, 0.0D) .color(r, g, b, a).endVertex(); - w.pos((x + 0), (y + height), 0.0D) + w.pos(x, y + height, 0.0D) .color(r, g, b, a).endVertex(); - w.pos((x + width), (y + height), 0.0D) + w.pos(x + width, y + height, 0.0D) .color(r, g, b, a).endVertex(); - w.pos((x + width), (y + 0), 0.0D) + w.pos(x + width, y, 0.0D) .color(r, g, b, a).endVertex(); Tessellator.getInstance().draw(); } @@ -154,7 +159,7 @@ public abstract class MixinRenderItem { if (NotEnoughUpdates.INSTANCE.overlay.searchMode && RenderListener.drawingGuiScreen && NotEnoughUpdates.INSTANCE.isOnSkyblock() && !(Minecraft.getMinecraft().currentScreen instanceof GuiProfileViewer)) { boolean matches = false; - GuiTextField textField = NotEnoughUpdates.INSTANCE.overlay.getTextField(); + GuiTextField textField = NEUOverlay.getTextField(); if (textField.getText().trim().isEmpty()) { matches = true; @@ -180,7 +185,7 @@ public abstract class MixinRenderItem { if (NotEnoughUpdates.INSTANCE.overlay.searchMode && RenderListener.drawingGuiScreen && NotEnoughUpdates.INSTANCE.isOnSkyblock() && !(Minecraft.getMinecraft().currentScreen instanceof GuiProfileViewer)) { boolean matches = false; - GuiTextField textField = NotEnoughUpdates.INSTANCE.overlay.getTextField(); + GuiTextField textField = NEUOverlay.getTextField(); if (textField.getText().trim().isEmpty()) { matches = true; @@ -211,7 +216,7 @@ public abstract class MixinRenderItem { if (NotEnoughUpdates.INSTANCE.overlay.searchMode && RenderListener.drawingGuiScreen && NotEnoughUpdates.INSTANCE.isOnSkyblock() && !(Minecraft.getMinecraft().currentScreen instanceof GuiProfileViewer)) { boolean matches = false; - GuiTextField textField = NotEnoughUpdates.INSTANCE.overlay.getTextField(); + GuiTextField textField = NEUOverlay.getTextField(); if (textField.getText().trim().isEmpty()) { matches = true; @@ -236,22 +241,12 @@ public abstract class MixinRenderItem { float damageOverride = ItemCooldowns.getDurabilityOverride(stack); if (damageOverride >= 0) { - float barX = 13.0f - damageOverride * 13.0f; - int col = (int) Math.round(255.0D - damageOverride * 255.0D); GlStateManager.disableLighting(); GlStateManager.disableDepth(); - GlStateManager.disableTexture2D(); - GlStateManager.disableAlpha(); - GlStateManager.disableBlend(); + GlStateManager.enableAlpha(); - Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer worldrenderer = tessellator.getWorldRenderer(); - func_181565_a(worldrenderer, xPosition + 2, yPosition + 13, 13, 2, 0, 0, 0, 255); - func_181565_a(worldrenderer, xPosition + 2, yPosition + 13, 12, 1, (255 - col) / 4, 64, 0, 255); - func_181565_a(worldrenderer, xPosition + 2, yPosition + 13, barX, 1, 255 - col, col, 0, 255); + Utils.drawRect(xPosition, yPosition + 16.0f * (1.0f - damageOverride), xPosition + 16, yPosition + 16, Integer.MAX_VALUE); - GlStateManager.enableAlpha(); - GlStateManager.enableTexture2D(); GlStateManager.enableLighting(); GlStateManager.enableDepth(); } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java index e1b2662a..5b903f00 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java @@ -119,14 +119,14 @@ public class Mining { ) @ConfigEditorSlider( minValue = 50, - maxValue = 400, + maxValue = 350, minStep = 10 ) @ConfigAccordionId(id = 1) - public int drillFuelBarWidth = 200; + public int drillFuelBarWidth = 180; @Expose - public Position drillFuelBarPosition = new Position(0, -100, true, false); + public Position drillFuelBarPosition = new Position(0, -91, true, false); @ConfigOption( name = "Dwarven Overlay", diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/EquipmentOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/EquipmentOverlay.java index 140c533f..d0bf7e8c 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/EquipmentOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/EquipmentOverlay.java @@ -58,6 +58,8 @@ import java.util.List; import java.util.Map; import java.util.Objects; +import static io.github.moulberry.notenoughupdates.util.Utils.drawHoverOverlay; + @NEUAutoSubscribe public class EquipmentOverlay { public static EquipmentOverlay INSTANCE = new EquipmentOverlay(); @@ -205,7 +207,10 @@ public class EquipmentOverlay { int mouseX = Mouse.getX() * width / Minecraft.getMinecraft().displayWidth; int mouseY = height - Mouse.getY() * height / Minecraft.getMinecraft().displayHeight - 1; - GL11.glColor4f(1F, 1F, 1F, 1F); + // Draw Backgrounds before anything, so hover overlay isn't occluded by the background + renderHudBackground(inventory); + + // Draw foregrounds if (shouldRenderArmorHud) { renderEquipmentGui(inventory, mouseX, mouseY, width, height); } @@ -215,17 +220,35 @@ public class EquipmentOverlay { } } + // Draws Backgrounds + public void renderHudBackground(GuiScreen inventory) { + GL11.glColor4f(1F, 1F, 1F, 1F); + AccessorGuiContainer container = ((AccessorGuiContainer) inventory); + final int overlayLeft = container.getGuiLeft() - ARMOR_OVERLAY_OVERHAND_WIDTH; + final int overlayTop = container.getGuiTop(); + if (shouldRenderArmorHud) { + ResourceLocation equipmentTexture = getCustomEquipmentTexture(shouldRenderPets); + Minecraft.getMinecraft().getTextureManager().bindTexture(equipmentTexture); + + Utils.drawTexturedRect(overlayLeft, overlayTop, ARMOR_OVERLAY_WIDTH, ARMOR_OVERLAY_HEIGHT, GL11.GL_NEAREST); + } + + if (shouldRenderPets) { + ResourceLocation customPetTexture = getCustomPetTexture(shouldRenderArmorHud); + Minecraft.getMinecraft().getTextureManager().bindTexture(customPetTexture); + GlStateManager.color(1, 1, 1, 1); + + Utils.drawTexturedRect(overlayLeft, overlayTop + PET_OVERLAY_OFFSET_Y, PET_OVERLAY_WIDTH, PET_OVERLAY_HEIGHT, GL11.GL_NEAREST); + } + GlStateManager.bindTexture(0); + } + public void renderEquipmentGui(GuiInventory guiScreen, int mouseX, int mouseY, int width, int height) { - AccessorGuiContainer container = ((AccessorGuiContainer) guiScreen); + AccessorGuiContainer container = (AccessorGuiContainer) guiScreen; int overlayLeft = container.getGuiLeft() - ARMOR_OVERLAY_OVERHAND_WIDTH; int overlayTop = container.getGuiTop(); - ResourceLocation equipmentTexture = getCustomEquipmentTexture(shouldRenderPets); - Minecraft.getMinecraft().getTextureManager().bindTexture(equipmentTexture); - - Utils.drawTexturedRect(overlayLeft, overlayTop, ARMOR_OVERLAY_WIDTH, ARMOR_OVERLAY_HEIGHT, GL11.GL_NEAREST); - List<String> tooltipToDisplay = new ArrayList<>(); drawSlot(slot1, overlayLeft + 8, overlayTop + EQUIPMENT_SLOT_OFFSET_Y, mouseX, mouseY, tooltipToDisplay); drawSlot(slot2, overlayLeft + 8, overlayTop + EQUIPMENT_SLOT_OFFSET_Y + 18, mouseX, mouseY, tooltipToDisplay); @@ -250,7 +273,7 @@ public class EquipmentOverlay { } } - if (tooltipToDisplay.size() > 0 && + if (!tooltipToDisplay.isEmpty() && Utils.isWithinRect( mouseX, mouseY, overlayLeft, overlayTop, @@ -303,8 +326,12 @@ public class EquipmentOverlay { private void drawSlot(ItemStack stack, int x, int y, int mouseX, int mouseY, List<String> tooltip) { if (stack == null) return; + Utils.drawItemStack(stack, x, y, true); if (Utils.isWithinRect(mouseX, mouseY, x, y, 16, 16)) { + // draw the slot overlay + drawHoverOverlay(x, y); + List<String> tt = stack.getTooltip(Minecraft.getMinecraft().thePlayer, false); if (shouldShowEquipmentTooltip(tt)) tooltip.addAll(tt); @@ -322,16 +349,11 @@ public class EquipmentOverlay { ); ItemStack petInfo = petStack; - ResourceLocation customPetTexture = getCustomPetTexture(isRenderingArmorHud()); - Minecraft.getMinecraft().getTextureManager().bindTexture(customPetTexture); - GlStateManager.color(1, 1, 1, 1); - AccessorGuiContainer container = ((AccessorGuiContainer) inventory); int overlayLeft = container.getGuiLeft() - ARMOR_OVERLAY_OVERHAND_WIDTH; int overlayTop = container.getGuiTop() + PET_OVERLAY_OFFSET_Y; - Utils.drawTexturedRect(overlayLeft, overlayTop, PET_OVERLAY_WIDTH, PET_OVERLAY_HEIGHT, GL11.GL_NEAREST); GlStateManager.bindTexture(0); Utils.drawItemStack(petInfo, overlayLeft + 8, overlayTop + 8, true); @@ -343,6 +365,10 @@ public class EquipmentOverlay { && Mouse.getEventButtonState()) { NotEnoughUpdates.INSTANCE.trySendCommand("/pets"); } + + // draw the slot overlay + drawHoverOverlay(overlayLeft + 8, overlayTop + 8); + tooltipToDisplay = petInfo.getTooltip(Minecraft.getMinecraft().thePlayer, false); Utils.drawHoveringText( tooltipToDisplay, diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/FarmingSkillOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/FarmingSkillOverlay.java index c12ad069..bdffd40d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/FarmingSkillOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/FarmingSkillOverlay.java @@ -362,7 +362,7 @@ public class FarmingSkillOverlay extends TextOverlay { } else if (cultivating < 100000000) { cultivatingTier = 9; cultivatingTierAmount = "100,000,000"; - } else if (cultivating > 100000000) { + } else { cultivatingTier = 10; cultivatingTierAmount = "Maxed"; } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/FishingSkillOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/FishingSkillOverlay.java index 3a4ea544..4139b1e6 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/FishingSkillOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/FishingSkillOverlay.java @@ -385,7 +385,7 @@ public class FishingSkillOverlay if(yaw > 180) yaw -= 360; lineMap.put(6, EnumChatFormatting.AQUA+"Yaw: "+EnumChatFormatting.YELLOW+ - String.format("%.2f", yaw)+EnumChatFormatting.BOLD+"\u1D52");*/ + String.format("%.2f", yaw)+EnumChatFormatting.BOLD+"\u00b0");*/ int key = NotEnoughUpdates.INSTANCE.config.skillOverlays.fishKey; ISound sound = new PositionedSound(new ResourceLocation("random.orb")) {{ diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/FuelBar.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/FuelBar.java index 9212eb6f..489be7b1 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/FuelBar.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/FuelBar.java @@ -32,6 +32,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.event.RenderGameOverlayEvent; +import net.minecraftforge.fml.client.config.GuiUtils; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import org.lwjgl.opengl.GL11; @@ -106,23 +107,21 @@ public class FuelBar { ScaledResolution scaledResolution = Utils.pushGuiScale(NotEnoughUpdates.INSTANCE.config.locationedit.guiScale); Position position = NotEnoughUpdates.INSTANCE.config.mining.drillFuelBarPosition; - int x = position.getAbsX(scaledResolution, NotEnoughUpdates.INSTANCE.config.mining.drillFuelBarWidth); - int y = position.getAbsY(scaledResolution, 12); - x -= NotEnoughUpdates.INSTANCE.config.mining.drillFuelBarWidth / 2; - renderBar(x, y + 4, NotEnoughUpdates.INSTANCE.config.mining.drillFuelBarWidth, fuelAmount); + int x = position.getAbsX(scaledResolution, NotEnoughUpdates.INSTANCE.config.mining.drillFuelBarWidth + 2); + int y = position.getAbsY(scaledResolution, 5); + x -= NotEnoughUpdates.INSTANCE.config.mining.drillFuelBarWidth / 2 - 1; + renderBar(x, y + 6, NotEnoughUpdates.INSTANCE.config.mining.drillFuelBarWidth + 2, fuelAmount); String str = fuelString.replace("\u00A77", EnumChatFormatting.DARK_GREEN.toString()) + EnumChatFormatting.GOLD + String.format(" (%d%%)", (int) (fuelAmount * 100)); GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate( - GL11.GL_SRC_ALPHA, + GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA ); - GlStateManager.tryBlendFuncSeparate( - GL11.GL_SRC_ALPHA, + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA @@ -133,79 +132,40 @@ public class FuelBar { for (int yO = -2; yO <= 2; yO++) { if (Math.abs(xO) != Math.abs(yO)) { Minecraft.getMinecraft().fontRendererObj.drawString(clean, - x + 2 + xO / 2f, y + yO / 2f, - new Color(0, 0, 0, 200 / Math.max(Math.abs(xO), Math.abs(yO))).getRGB(), false + x + 2 + xO / 2f, + y + yO / 2f, + new Color(0, 0, 0, 200 / Math.max(Math.abs(xO), Math.abs(yO))).getRGB(), + false ); } } } - Minecraft.getMinecraft().fontRendererObj.drawString(str, - x + 2, y, 0xffffff, false - ); + Minecraft.getMinecraft().fontRendererObj.drawString(str, x + 2, y, 0xffffff, false); Utils.pushGuiScale(0); GlStateManager.popMatrix(); } } - private void renderBarCap(float x, float y, boolean left, float rCapSize, float completion) { - float size = left ? 10 : rCapSize; - int startTexX = left |
