aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjani270 <69345714+jani270@users.noreply.github.com>2023-12-14 18:03:58 +0100
committerGitHub <noreply@github.com>2023-12-14 18:03:58 +0100
commit406021a5a79f220d40fbce73c95440b3ade5eb83 (patch)
tree9543a87de07e24812553ae60a9a8b0c139b0c5a3
parentc98a1fbc727cfd33294346bc9fc27767e4a2545b (diff)
downloadNotEnoughUpdates-406021a5a79f220d40fbce73c95440b3ade5eb83.tar.gz
NotEnoughUpdates-406021a5a79f220d40fbce73c95440b3ade5eb83.tar.bz2
NotEnoughUpdates-406021a5a79f220d40fbce73c95440b3ade5eb83.zip
Added option for old cooldowns (#968)
Co-authored-by: nopo <nopotheemail@gmail.com>
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRenderItem.java23
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/separatesections/ItemOverlays.java12
2 files changed, 27 insertions, 8 deletions
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 9705742b..f8e1b432 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRenderItem.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRenderItem.java
@@ -22,7 +22,6 @@ 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;
@@ -41,8 +40,6 @@ 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;
@@ -243,10 +240,24 @@ public abstract class MixinRenderItem {
if (damageOverride >= 0) {
GlStateManager.disableLighting();
GlStateManager.disableDepth();
- GlStateManager.enableAlpha();
-
- Utils.drawRect(xPosition, yPosition + 16.0f * (1.0f - damageOverride), xPosition + 16, yPosition + 16, Integer.MAX_VALUE);
+ if (NotEnoughUpdates.INSTANCE.config.itemOverlays.oldCooldowns) {
+ float barX = 13.0f - damageOverride * 13.0f;
+ int col = (int) Math.round(255.0D - damageOverride * 255.0D);
+ GlStateManager.disableTexture2D();
+ GlStateManager.disableAlpha();
+ GlStateManager.disableBlend();
+ 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);
+ GlStateManager.enableAlpha();
+ GlStateManager.enableTexture2D();
+ } else {
+ GlStateManager.enableAlpha();
+ Utils.drawRect(xPosition, yPosition + 16.0f * (1.0f - damageOverride), xPosition + 16, yPosition + 16, Integer.MAX_VALUE);
+ }
GlStateManager.enableLighting();
GlStateManager.enableDepth();
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/separatesections/ItemOverlays.java b/src/main/java/io/github/moulberry/notenoughupdates/options/separatesections/ItemOverlays.java
index 4606a78f..a5cd6cb7 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/separatesections/ItemOverlays.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/separatesections/ItemOverlays.java
@@ -20,16 +20,16 @@
package io.github.moulberry.notenoughupdates.options.separatesections;
import com.google.gson.annotations.Expose;
-import io.github.moulberry.moulconfig.annotations.ConfigEditorInfoText;
-import io.github.moulberry.notenoughupdates.core.config.Position;
import io.github.moulberry.moulconfig.annotations.ConfigAccordionId;
import io.github.moulberry.moulconfig.annotations.ConfigEditorAccordion;
import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean;
import io.github.moulberry.moulconfig.annotations.ConfigEditorColour;
import io.github.moulberry.moulconfig.annotations.ConfigEditorDraggableList;
import io.github.moulberry.moulconfig.annotations.ConfigEditorDropdown;
+import io.github.moulberry.moulconfig.annotations.ConfigEditorInfoText;
import io.github.moulberry.moulconfig.annotations.ConfigEditorSlider;
import io.github.moulberry.moulconfig.annotations.ConfigOption;
+import io.github.moulberry.notenoughupdates.core.config.Position;
import java.util.ArrayList;
import java.util.Arrays;
@@ -464,6 +464,14 @@ public class ItemOverlays {
@Expose
@ConfigOption(
+ name = "Use Durability for Cooldowns",
+ desc = "Show the cooldown durations as the durability."
+ )
+ @ConfigEditorBoolean
+ public boolean oldCooldowns = false;
+
+ @Expose
+ @ConfigOption(
name = "Pickaxe Ability Cooldown",
desc = "Show the cooldown duration of the pickaxe ability as the durability."
)