Skip to content

Commit

Permalink
Updated to 1.16.5
Browse files Browse the repository at this point in the history
  • Loading branch information
CraftedMods committed Apr 12, 2021
1 parent 89ecd59 commit 120bdae
Show file tree
Hide file tree
Showing 12 changed files with 772 additions and 857 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog of JEI LOTR

## 2.0.0-BETA
* Updated to 1.16.5 and LOTR Renewed-3.0

## 1.3.1-BETA
* Updated to LOTR Renewed-2.2
* Fixed that the transfer/click handlers didn't work anymore
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
The plugin adds JEI support for all devices and recipes added by the LOTR Mod.
## Dependencies
JEI LOTR has the following dependencies:
- [The Lord of the Rings Mod Renewed v2.2](https://www.curseforge.com/minecraft/mc-mods/the-lord-of-the-rings-mod-renewed/files)
- [JEI 1.15.2-6.0.3.15](https://www.curseforge.com/minecraft/mc-mods/jei/files/all)
- [The Lord of the Rings Mod Renewed v3.0](https://www.curseforge.com/minecraft/mc-mods/the-lord-of-the-rings-mod-renewed/files)
- [JEI 1.16.5-7.6.4.86](https://www.curseforge.com/minecraft/mc-mods/jei/files/all)

The plugin was created with the MinecraftForge version "1.15.2-31.2.31".
The plugin was created with the MinecraftForge version "1.16.5-36.1.0".
## Announcements and Documentation
Announcements regarding the plugin can be found at the official Discord server (https://discord.gg/37GanUf) and here: http://lotrminecraftmod.wikia.com/wiki/Thread:174874
## Download
Expand Down
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ buildscript {
}
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '4.1+', changing: true
classpath "net.minecrell.licenser:net.minecrell.licenser.gradle.plugin:0.+"
}
}
Expand All @@ -22,7 +22,7 @@ apply plugin: 'eclipse'
apply plugin: 'maven-publish'
apply plugin: "net.minecrell.licenser"

version = '1.3.1-BETA'
version = '2.0.0-BETA'
group = 'craftedMods.jeiLotr' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'jeilotr'

Expand All @@ -34,7 +34,7 @@ minecraft {
// stable_# Stables are built at the discretion of the MCP team.
// Use non-default mappings at your own risk. they may not always work.
// Simply re-run your setup task after changing the mappings to update your workspace.
mappings channel: 'snapshot', version: '20200225-1.15.1'
mappings channel: 'official', version: '1.16.5'
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.

// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
Expand Down Expand Up @@ -107,7 +107,7 @@ dependencies {
// Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
// that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
minecraft 'net.minecraftforge:forge:1.15.2-31.2.31'
minecraft 'net.minecraftforge:forge:1.16.5-36.1.0'

compileOnly fg.deobf("mezz.jei:jei-${jei_mc_version}:${jei_version}")

Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
# This is required to provide enough memory for the Minecraft decompilation process.
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
jei_mc_version=1.15.2
jei_version=6.0.3.15
lotr_version=2.2
jei_mc_version=1.16.5
jei_version=7.6.4.86
lotr_version=3.0
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.1-all.zip
228 changes: 105 additions & 123 deletions src/main/java/craftedMods/jeiLotr/AlloyForge.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2020 CraftedMods (see http://github.com/CraftedMods)
* Copyright (C) 2020-2021 CraftedMods (see http://github.com/CraftedMods)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
Expand All @@ -17,10 +17,13 @@

package craftedMods.jeiLotr;

import com.mojang.blaze3d.matrix.MatrixStack;

import lotr.common.recipe.AbstractAlloyForgeRecipe;
import mezz.jei.api.constants.VanillaTypes;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.gui.drawable.*;
import mezz.jei.api.gui.drawable.IDrawable;
import mezz.jei.api.gui.drawable.IDrawableAnimated;
import mezz.jei.api.gui.ingredient.IGuiItemStackGroup;
import mezz.jei.api.helpers.IGuiHelper;
import mezz.jei.api.ingredients.IIngredients;
Expand All @@ -30,128 +33,107 @@
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.resources.I18n;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.*;
import net.minecraft.item.crafting.AbstractCookingRecipe;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.util.ResourceLocation;

public class AlloyForge extends FurnaceVariantCategory<IRecipe<?>>
{

private final ResourceLocation uid;
private final ItemStack forgeIcon;
private final IDrawable icon;
private final IDrawable background;
private final IDrawable arrow;

public static final ResourceLocation ALLOY_FORGE_GUI_LOCATION = new ResourceLocation (
"lotr:textures/gui/alloy_forge.png");

public AlloyForge (ResourceLocation uid, ItemStack forgeIcon, IGuiHelper guiHelper)
{
super (guiHelper);
this.uid = uid;
this.forgeIcon = forgeIcon;
icon = guiHelper.createDrawableIngredient (forgeIcon);
background = guiHelper.createDrawable (ALLOY_FORGE_GUI_LOCATION, 45, 20, 85, 130);
arrow = guiHelper
.drawableBuilder (ALLOY_FORGE_GUI_LOCATION, 176, 14, 16, 30)
.buildAnimated (200, IDrawableAnimated.StartDirection.TOP, false);
}

@Override
public ResourceLocation getUid ()
{
return uid;
}

@Override
public String getTitle ()
{
return I18n.format (forgeIcon.getTranslationKey ());
}

@Override
public IDrawable getIcon ()
{
return icon;
}

@Override
public IDrawable getBackground ()
{
return background;
}

@Override
@SuppressWarnings("unchecked")
public Class<? extends IRecipe<?>> getRecipeClass ()
{
return (Class<? extends IRecipe<?>>) (Class<?>) IRecipe.class;
}

@Override
public void setIngredients (IRecipe<?> recipe, IIngredients ingreds)
{
ingreds.setInputIngredients (recipe.getIngredients ());
ingreds.setOutput (VanillaTypes.ITEM, recipe.getRecipeOutput ());
}

@Override
public void setRecipe (IRecipeLayout layout, IRecipe<?> recipe, IIngredients ingreds)
{
IGuiItemStackGroup guiItemStacks = layout.getItemStacks ();

for (int i = 0; i < 4; i++)
{
guiItemStacks.init (i, true, 7 + 18 * i, 18);
guiItemStacks.set (i, ingreds.getInputs (VanillaTypes.ITEM).get (0));
}

// Alloy items are not required
if (ingreds.getInputs (VanillaTypes.ITEM).size () > 1)
{
for (int i = 0; i < 4; i++)
{
guiItemStacks.init (i + 4, true, 7 + 18 * i, 0);
guiItemStacks.set (i + 4, ingreds.getInputs (VanillaTypes.ITEM).get (1));
}
}

for (int i = 0; i < 4; i++)
{
guiItemStacks.init (i + 8, false, 7 + 18 * i, 64);
guiItemStacks.set (i + 8, ingreds.getOutputs (VanillaTypes.ITEM).get (0));
}
}

@Override
public void draw (IRecipe<?> recipe, double mouseX, double mouseY)
{
animatedFlame.draw (35, 92);
arrow.draw (35, 38);

float experience = 0f;

if (recipe instanceof AbstractCookingRecipe)
{
experience = ((AbstractCookingRecipe) recipe).getExperience ();
}
else if (recipe instanceof AbstractAlloyForgeRecipe)
{
experience = ((AbstractAlloyForgeRecipe) recipe).getExperience ();
}

if (experience > 0.0f)
{
String experienceString = Translator.translateToLocalFormatted (
"gui.jei.category.smelting.experience",
new Object[]
{Float.valueOf (experience)});
Minecraft minecraft = Minecraft.getInstance ();
FontRenderer fontRenderer = minecraft.fontRenderer;
int stringWidth = fontRenderer.getStringWidth (experienceString);
fontRenderer.drawString (experienceString, background.getWidth () - stringWidth, 43.0f,
-8355712);
}
}
public class AlloyForge extends FurnaceVariantCategory<IRecipe<?>> {

private final ResourceLocation uid;
private final ItemStack forgeIcon;
private final IDrawable icon;
private final IDrawable background;
private final IDrawable arrow;

public static final ResourceLocation ALLOY_FORGE_GUI_LOCATION = new ResourceLocation(
"lotr:textures/gui/alloy_forge.png");

public AlloyForge(ResourceLocation uid, ItemStack forgeIcon, IGuiHelper guiHelper) {
super(guiHelper);
this.uid = uid;
this.forgeIcon = forgeIcon;
this.icon = guiHelper.createDrawableIngredient(forgeIcon);
this.background = guiHelper.createDrawable(ALLOY_FORGE_GUI_LOCATION, 45, 20, 85, 130);
this.arrow = guiHelper.drawableBuilder(ALLOY_FORGE_GUI_LOCATION, 176, 14, 16, 30).buildAnimated(200,
IDrawableAnimated.StartDirection.TOP, false);
}

@Override
public ResourceLocation getUid() {
return uid;
}

@Override
public String getTitle() {
return I18n.get(forgeIcon.getDescriptionId());
}

@Override
public IDrawable getIcon() {
return icon;
}

@Override
public IDrawable getBackground() {
return background;
}

@Override
@SuppressWarnings("unchecked")
public Class<? extends IRecipe<?>> getRecipeClass() {
return (Class<? extends IRecipe<?>>) (Class<?>) IRecipe.class;
}

@Override
public void setIngredients(IRecipe<?> recipe, IIngredients ingreds) {
ingreds.setInputIngredients(recipe.getIngredients());
ingreds.setOutput(VanillaTypes.ITEM, recipe.getResultItem());
}

@Override
public void setRecipe(IRecipeLayout layout, IRecipe<?> recipe, IIngredients ingreds) {
IGuiItemStackGroup guiItemStacks = layout.getItemStacks();

for (int i = 0; i < 4; i++) {
guiItemStacks.init(i, true, 7 + 18 * i, 18);
guiItemStacks.set(i, ingreds.getInputs(VanillaTypes.ITEM).get(0));
}

// Alloy items are not required
if (ingreds.getInputs(VanillaTypes.ITEM).size() > 1) {
for (int i = 0; i < 4; i++) {
guiItemStacks.init(i + 4, true, 7 + 18 * i, 0);
guiItemStacks.set(i + 4, ingreds.getInputs(VanillaTypes.ITEM).get(1));
}
}

for (int i = 0; i < 4; i++) {
guiItemStacks.init(i + 8, false, 7 + 18 * i, 64);
guiItemStacks.set(i + 8, ingreds.getOutputs(VanillaTypes.ITEM).get(0));
}
}

@Override
public void draw(IRecipe<?> recipe, MatrixStack matrixStack, double mouseX, double mouseY) {
animatedFlame.draw(matrixStack, 35, 92);
arrow.draw(matrixStack, 35, 38);

float experience = 0f;

if (recipe instanceof AbstractCookingRecipe) {
experience = ((AbstractCookingRecipe) recipe).getExperience();
} else if (recipe instanceof AbstractAlloyForgeRecipe) {
experience = ((AbstractAlloyForgeRecipe) recipe).getExperience();
}

if (experience > 0.0f) {
String experienceString = Translator.translateToLocalFormatted("gui.jei.category.smelting.experience",
new Object[] { Float.valueOf(experience) });
Minecraft minecraft = Minecraft.getInstance();
FontRenderer fontRenderer = minecraft.font;
int stringWidth = fontRenderer.width(experienceString);
fontRenderer.draw(matrixStack, experienceString, background.getWidth() - stringWidth, 43.0f, -8355712);
}
}

}
Loading

0 comments on commit 120bdae

Please sign in to comment.