From 637cefdcaec717e428aa5cf3ac1089a34ac6f60f Mon Sep 17 00:00:00 2001 From: Ruben Taelman Date: Tue, 22 Dec 2020 20:39:10 +0100 Subject: [PATCH] Update to MC 1.16 --- build.properties | 8 +++--- .../iconexporter/client/gui/IExportTask.java | 4 ++- .../client/gui/ItemLightingUtil.java | 12 ++++----- .../client/gui/ItemRenderUtil.java | 6 ++--- .../client/gui/ScreenIconExporter.java | 27 ++++++++++--------- src/main/resources/META-INF/mods.toml | 16 ++++++----- src/main/resources/pack.mcmeta | 2 +- 7 files changed, 41 insertions(+), 34 deletions(-) diff --git a/build.properties b/build.properties index f530395..905298e 100644 --- a/build.properties +++ b/build.properties @@ -1,9 +1,9 @@ mod_version=1.2.1 -minecraft_version=1.15.2 -forge_version=31.1.37 +minecraft_version=1.16.4 +forge_version=35.1.13 mcp_mappings_channel=snapshot -mcp_mappings_version=20200225-1.15.1 -cyclopscore_version=1.6.1-1063 +mcp_mappings_version=20201028-1.16.3 +cyclopscore_version=1.9.0-1148 release_type=release fingerprint=bd0353b3e8a2810d60dd584e256e364bc3bedd44 diff --git a/src/main/java/org/cyclops/iconexporter/client/gui/IExportTask.java b/src/main/java/org/cyclops/iconexporter/client/gui/IExportTask.java index f0172cb..86e27e8 100644 --- a/src/main/java/org/cyclops/iconexporter/client/gui/IExportTask.java +++ b/src/main/java/org/cyclops/iconexporter/client/gui/IExportTask.java @@ -1,5 +1,7 @@ package org.cyclops.iconexporter.client.gui; +import com.mojang.blaze3d.matrix.MatrixStack; + import java.io.IOException; /** @@ -7,6 +9,6 @@ */ public interface IExportTask { - public void run() throws IOException; + public void run(MatrixStack matrixStack) throws IOException; } diff --git a/src/main/java/org/cyclops/iconexporter/client/gui/ItemLightingUtil.java b/src/main/java/org/cyclops/iconexporter/client/gui/ItemLightingUtil.java index 8f09e4e..befea92 100644 --- a/src/main/java/org/cyclops/iconexporter/client/gui/ItemLightingUtil.java +++ b/src/main/java/org/cyclops/iconexporter/client/gui/ItemLightingUtil.java @@ -2,12 +2,12 @@ import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.systems.RenderSystem; -import net.minecraft.client.renderer.Matrix4f; import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.renderer.Vector3f; -import net.minecraft.client.renderer.Vector4f; import net.minecraft.util.Util; -import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.vector.Matrix4f; +import net.minecraft.util.math.vector.Vector3d; +import net.minecraft.util.math.vector.Vector3f; +import net.minecraft.util.math.vector.Vector4f; /** * The same as {@link RenderHelper#enableStandardItemLighting()}, @@ -21,8 +21,8 @@ */ public class ItemLightingUtil { - private static final Vec3d LIGHT0_POS = (new Vec3d(0.20000000298023224D, 1.0D, -0.699999988079071D)).normalize(); - private static final Vec3d LIGHT1_POS = (new Vec3d(-0.20000000298023224D, 1.0D, 0.699999988079071D)).normalize(); + private static final Vector3d LIGHT0_POS = (new Vector3d(0.20000000298023224D, 1.0D, -0.699999988079071D)).normalize(); + private static final Vector3d LIGHT1_POS = (new Vector3d(-0.20000000298023224D, 1.0D, 0.699999988079071D)).normalize(); private static final Vector3f DIFFUSE_LIGHT_0 = Util.make(new Vector3f(0.2F, 1.0F, -0.7F), Vector3f::normalize); private static final Vector3f DIFFUSE_LIGHT_1 = Util.make(new Vector3f(-0.2F, 1.0F, 0.7F), Vector3f::normalize); diff --git a/src/main/java/org/cyclops/iconexporter/client/gui/ItemRenderUtil.java b/src/main/java/org/cyclops/iconexporter/client/gui/ItemRenderUtil.java index cf004dc..7c9c5e0 100644 --- a/src/main/java/org/cyclops/iconexporter/client/gui/ItemRenderUtil.java +++ b/src/main/java/org/cyclops/iconexporter/client/gui/ItemRenderUtil.java @@ -61,10 +61,10 @@ public static void renderItem(ItemStack itemStack, int scale) { RenderHelper.disableStandardItemLighting(); } - public static void renderFluid(AbstractGui gui, Fluid fluid, int scale) { + public static void renderFluid(AbstractGui gui, MatrixStack matrixStack, Fluid fluid, int scale) { GlStateManager.scalef(scale / 16, scale / 16, scale / 16); ItemLightingUtil.enableGUIStandardItemLighting(scale); - GuiHelpers.renderFluidSlot(gui, new FluidStack(fluid, FluidHelpers.BUCKET_VOLUME), 0, 0); + GuiHelpers.renderFluidSlot(gui, matrixStack, new FluidStack(fluid, FluidHelpers.BUCKET_VOLUME), 0, 0); } // ----- Everything below is modified from RenderItem ----- @@ -118,7 +118,7 @@ protected static void renderItemModelIntoGUI(ItemStack stack, int x, int y, IBak RenderSystem.scalef(16.0F, 16.0F, 16.0F); MatrixStack matrixstack = new MatrixStack(); IRenderTypeBuffer.Impl irendertypebuffer$impl = Minecraft.getInstance().getRenderTypeBuffers().getBufferSource(); - boolean flag = !bakedmodel.func_230044_c_(); + boolean flag = !bakedmodel.isSideLit(); if (flag) { ItemLightingUtil.setupGuiFlatDiffuseLighting(scale); } diff --git a/src/main/java/org/cyclops/iconexporter/client/gui/ScreenIconExporter.java b/src/main/java/org/cyclops/iconexporter/client/gui/ScreenIconExporter.java index 2d13a12..58edba8 100644 --- a/src/main/java/org/cyclops/iconexporter/client/gui/ScreenIconExporter.java +++ b/src/main/java/org/cyclops/iconexporter/client/gui/ScreenIconExporter.java @@ -1,6 +1,7 @@ package org.cyclops.iconexporter.client.gui; import com.google.common.collect.Queues; +import com.mojang.blaze3d.matrix.MatrixStack; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screen.Screen; import net.minecraft.fluid.Fluid; @@ -9,7 +10,9 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.INBT; import net.minecraft.util.NonNullList; +import net.minecraft.util.RegistryKey; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.Util; import net.minecraft.util.text.TranslationTextComponent; import net.minecraftforge.registries.ForgeRegistries; import org.apache.commons.codec.digest.DigestUtils; @@ -44,18 +47,18 @@ public ScreenIconExporter(int scale) { } @Override - public void render(int mouseX, int mouseY, float partialTicks) { - super.render(mouseX, mouseY, partialTicks); + public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { + super.render(matrixStack, mouseX, mouseY, partialTicks); if (exportTasks.isEmpty()) { Minecraft.getInstance().displayGuiScreen(null); - Minecraft.getInstance().player.sendMessage(new TranslationTextComponent("gui.itemexporter.finished")); + Minecraft.getInstance().player.sendMessage(new TranslationTextComponent("gui.itemexporter.finished"), Util.DUMMY_UUID); } else { IExportTask task = exportTasks.poll(); try { - task.run(); + task.run(matrixStack); } catch (IOException e) { - Minecraft.getInstance().player.sendMessage(new TranslationTextComponent("gui.itemexporter.error")); + Minecraft.getInstance().player.sendMessage(new TranslationTextComponent("gui.itemexporter.error"), Util.DUMMY_UUID); e.printStackTrace(); } } @@ -80,14 +83,14 @@ public Queue createExportTasks() { Queue exportTasks = Queues.newArrayDeque(); // Add fluids - for (Map.Entry fluidEntry : ForgeRegistries.FLUIDS.getEntries()) { + for (Map.Entry, Fluid> fluidEntry : ForgeRegistries.FLUIDS.getEntries()) { tasks.set(tasks.get() + 1); - String subKey = "fluid:" + fluidEntry.getKey(); - exportTasks.add(() -> { + String subKey = "fluid:" + fluidEntry.getKey().getLocation(); + exportTasks.add((matrixStack) -> { taskProcessed.set(taskProcessed.get() + 1); signalStatus(tasks, taskProcessed); - fill(0, 0, this.scale, this.scale, BACKGROUND_COLOR); - ItemRenderUtil.renderFluid(this, fluidEntry.getValue(), this.scale); + fill(matrixStack, 0, 0, this.scale, this.scale, BACKGROUND_COLOR); + ItemRenderUtil.renderFluid(this, matrixStack, fluidEntry.getValue(), this.scale); ImageExportUtil.exportImageFromScreenshot(baseDir, subKey, this.width, this.height, this.scale, BACKGROUND_COLOR_SHIFTED); }); } @@ -100,10 +103,10 @@ public Queue createExportTasks() { for (ItemStack subItem : subItems) { tasks.set(tasks.get() + 1); String subKey = key + (subItem.hasTag() ? "__" + serializeNbtTag(subItem.getTag()) : ""); - exportTasks.add(() -> { + exportTasks.add((matrixStack) -> { taskProcessed.set(taskProcessed.get() + 1); signalStatus(tasks, taskProcessed); - fill(0, 0, this.scale, this.scale, BACKGROUND_COLOR); + fill(matrixStack, 0, 0, this.scale, this.scale, BACKGROUND_COLOR); ItemRenderUtil.renderItem(subItem, this.scale); ImageExportUtil.exportImageFromScreenshot(baseDir, subKey, this.width, this.height, this.scale, BACKGROUND_COLOR_SHIFTED); if (subItem.hasTag() && GeneralConfig.fileNameHashTag) { diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 6307e13..9428788 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -1,31 +1,33 @@ modLoader="javafml" -loaderVersion="[28.1,)" +loaderVersion="[34,)" issueTrackerURL="https://github.com/CyclopsMC/IconExporter/issues" +displayURL="https://www.curseforge.com/minecraft/mc-mods/iconexporter" +license="MIT" +logoFile="logo.png" +authors="rubensworks (aka kroeser)" + [[mods]] modId="iconexporter" version="${file.jarVersion}" displayName="IconExporter" -displayURL="https://www.curseforge.com/minecraft/mc-mods/iconexporter" -logoFile="logo.png" -authors="rubensworks (aka kroeser)" description=''' Exports item and block icons to files. ''' [[dependencies.iconexporter]] modId="cyclopscore" mandatory=true - versionRange="[1.6.1,)" + versionRange="[1.9.0,)" ordering="NONE" side="BOTH" [[dependencies.iconexporter]] modId="forge" mandatory=true - versionRange="[31.1,)" + versionRange="[34,)" ordering="NONE" side="BOTH" [[dependencies.iconexporter]] modId="minecraft" mandatory=true - versionRange="[1.15.2]" + versionRange="[1.16.2,]" ordering="NONE" side="BOTH" diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta index 624278b..6938d4d 100644 --- a/src/main/resources/pack.mcmeta +++ b/src/main/resources/pack.mcmeta @@ -1,6 +1,6 @@ { "pack": { "description": "iconexporter resources", - "pack_format": 4 + "pack_format": 6 } }