diff options
7 files changed, 57 insertions, 46 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java index ac1121ee..25d1002a 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java @@ -169,13 +169,6 @@ public class NotEnoughUpdates { private File neuDir; private boolean hasSkyblockScoreboard; - public NotEnoughUpdates() { - // Budget Construction Event - ((AccessorMinecraft) FMLClientHandler.instance().getClient()) - .onGetDefaultResourcePacks() - .add(new NEURepoResourcePack(null, "neurepo")); - } - public File getConfigFile() { return this.configFile; } @@ -188,6 +181,13 @@ public class NotEnoughUpdates { return this.neuDir; } + public NotEnoughUpdates() { + // Budget Construction Event + ((AccessorMinecraft) FMLClientHandler.instance().getClient()) + .onGetDefaultResourcePacks() + .add(new NEURepoResourcePack(null, "neurepo")); + } + /** * Instantiates NEUIo, NEUManager and NEUOverlay instances. Registers keybinds and adds a shutdown hook to clear tmp folder. */ diff --git a/src/main/java/io/github/moulberry/notenoughupdates/events/GuiContainerBackgroundDrawnEvent.java b/src/main/java/io/github/moulberry/notenoughupdates/events/GuiContainerBackgroundDrawnEvent.java deleted file mode 100644 index bdb6d1a1..00000000 --- a/src/main/java/io/github/moulberry/notenoughupdates/events/GuiContainerBackgroundDrawnEvent.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2022 NotEnoughUpdates contributors - * - * This file is part of NotEnoughUpdates. - * - * NotEnoughUpdates is free software: you can redistribute it - * and/or modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation, either - * version 3 of the License, or (at your option) any later version. - * - * NotEnoughUpdates is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>. - */ - -package io.github.moulberry.notenoughupdates.events; - -import lombok.Value; -import net.minecraft.client.gui.inventory.GuiContainer; - -@Value -public class GuiContainerBackgroundDrawnEvent extends NEUEvent { - public GuiContainer container; - public float partialTicks; -} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AbiphoneFavourites.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AbiphoneFavourites.java index 750e674d..3366fd1e 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AbiphoneFavourites.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/AbiphoneFavourites.java @@ -24,7 +24,6 @@ import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe; import io.github.moulberry.notenoughupdates.core.config.KeybindHelper; import io.github.moulberry.notenoughupdates.core.util.StringUtils; import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils; -import io.github.moulberry.notenoughupdates.events.GuiContainerBackgroundDrawnEvent; import io.github.moulberry.notenoughupdates.events.ReplaceItemEvent; import io.github.moulberry.notenoughupdates.events.SlotClickEvent; import io.github.moulberry.notenoughupdates.options.NEUConfig; @@ -203,11 +202,10 @@ public class AbiphoneFavourites { return isAbiphoneShowOnlyFavourites() && !getFavouriteContacts().contains(name); } - @SubscribeEvent - public void onDrawBackground(GuiContainerBackgroundDrawnEvent event) { + public void onDrawBackground(GuiScreen screen) { if (isWrongInventory()) return; - GuiContainer container = event.getContainer(); + GuiContainer container = (GuiContainer) screen; for (Slot slot : container.inventorySlots.inventorySlots) { if (slot == null) continue; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java index 8aca73d1..a5bb99b8 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java @@ -21,7 +21,6 @@ package io.github.moulberry.notenoughupdates.mixins; import io.github.moulberry.notenoughupdates.NEUOverlay; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; -import io.github.moulberry.notenoughupdates.events.GuiContainerBackgroundDrawnEvent; import io.github.moulberry.notenoughupdates.events.SlotClickEvent; import io.github.moulberry.notenoughupdates.listener.RenderListener; import io.github.moulberry.notenoughupdates.miscfeatures.AbiphoneFavourites; @@ -331,6 +330,6 @@ public abstract class MixinGuiContainer extends GuiScreen { @Inject(method = "drawScreen", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/GlStateManager;color(FFFF)V", ordinal = 1)) private void drawBackground(int mouseX, int mouseY, float partialTicks, CallbackInfo ci) { - new GuiContainerBackgroundDrawnEvent(((GuiContainer) (Object) this), partialTicks).post(); + AbiphoneFavourites.getInstance().onDrawBackground(this); } } 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 b6e0e45a..7c2cfcbf 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRenderItem.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRenderItem.java @@ -25,7 +25,6 @@ import io.github.moulberry.notenoughupdates.core.ChromaColour; 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.miscfeatures.inventory.MuseumItemHighlighter; import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; @@ -149,6 +148,51 @@ public abstract class MixinRenderItem { @Shadow abstract void renderModel(IBakedModel model, int color); + /*@Redirect(method="renderEffect", + at=@At( + value = "INVOKE", + target = "Lnet/minecraft/client/renderer/entity/RenderItem;renderModel(Lnet/minecraft/client/resources/model/IBakedModel;I)V" + ) + ) + public void renderEffect_renderModel(RenderItem renderItem, IBakedModel model, int colour) { + if(customEnchGlint != null) { + renderModel(model, ChromaColour.specialToChromaRGB(customEnchGlint)); + } else { + renderModel(model, colour); + } + } + + @Redirect(method="renderEffect", + at=@At( + value = "INVOKE", + target = "Lnet/minecraft/client/renderer/texture/TextureManager;bindTexture(Lnet/minecraft/util/ResourceLocation;)V" + ) + ) + public void renderEffect_bindTexture(TextureManager textureManager, ResourceLocation location) { + if(customEnchGlint != null) { + textureManager.bindTexture(GlintManager.getCustomGlintTexture()); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); + } else { + textureManager.bindTexture(location); + } + } + + @Redirect(method="renderEffect", + at=@At( + value = "INVOKE", + target = "Lnet/minecraft/client/renderer/GlStateManager;blendFunc(II)V" + ) + ) + public void renderEffect_blendFunc(int src, int dst) { + if(dst != 1) { + GlStateManager.blendFunc(src, dst); + } else if(customEnchGlint != null) { + GlintManager.setCustomBlendFunc(customEnchGlint); + } else { + GlStateManager.blendFunc(GL11.GL_SRC_COLOR, 1); + } + }*/ @Inject(method = "renderItemIntoGUI", at = @At("HEAD")) public void renderItemHead(ItemStack stack, int x, int y, CallbackInfo ci) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java index 4020a82a..c10e247f 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java @@ -247,8 +247,8 @@ public class NEUConfig extends Config { @Expose @Category( - name = "Todo Overlays", - desc = "Todo Overlays" + name = "Todo Overlay", + desc = "Todo Overlay" ) public MiscOverlays miscOverlays = new MiscOverlays(); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/MiscOverlays.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/MiscOverlays.java index 53361a26..5634a4b7 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/MiscOverlays.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/MiscOverlays.java @@ -439,5 +439,4 @@ public class MiscOverlays { @ConfigEditorBoolean @ConfigAccordionId(id = 0) public boolean todoIcons = true; - } |