Skip to content

Commit

Permalink
Update to MC 1.16
Browse files Browse the repository at this point in the history
  • Loading branch information
rubensworks committed Dec 22, 2020
1 parent 717fe76 commit 637cefd
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 34 deletions.
8 changes: 4 additions & 4 deletions build.properties
Original file line number Diff line number Diff line change
@@ -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

Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package org.cyclops.iconexporter.client.gui;

import com.mojang.blaze3d.matrix.MatrixStack;

import java.io.IOException;

/**
* @author rubensworks
*/
public interface IExportTask {

public void run() throws IOException;
public void run(MatrixStack matrixStack) throws IOException;

}
Original file line number Diff line number Diff line change
Expand Up @@ -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()},
Expand All @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 -----
Expand Down Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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();
}
}
Expand All @@ -80,14 +83,14 @@ public Queue<IExportTask> createExportTasks() {
Queue<IExportTask> exportTasks = Queues.newArrayDeque();

// Add fluids
for (Map.Entry<ResourceLocation, Fluid> fluidEntry : ForgeRegistries.FLUIDS.getEntries()) {
for (Map.Entry<RegistryKey<Fluid>, 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);
});
}
Expand All @@ -100,10 +103,10 @@ public Queue<IExportTask> 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) {
Expand Down
16 changes: 9 additions & 7 deletions src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
@@ -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"
2 changes: 1 addition & 1 deletion src/main/resources/pack.mcmeta
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"pack": {
"description": "iconexporter resources",
"pack_format": 4
"pack_format": 6
}
}

0 comments on commit 637cefd

Please sign in to comment.