Skip to content

Commit

Permalink
Release 1.2.0-BETA
Browse files Browse the repository at this point in the history
  • Loading branch information
CraftedMods committed Jul 4, 2020
1 parent c373d79 commit be8984f
Show file tree
Hide file tree
Showing 8 changed files with 263 additions and 48 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

## 1.2.0-BETA
* Updated to LOTR Renewed-1.3 (added support for alloy forges)

## 1.1.0-BETA
* New faction crafting tables will now be discovered automatically
* Fixed that some recipes were not shown for faction crafting tables
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 v1.1](https://www.mediafire.com/file/8aaa04j3u56gezx/)
- [JEI 1.15.2-6.0.0.4](https://www.curseforge.com/minecraft/mc-mods/jei/files/all)
- [The Lord of the Rings Mod Renewed v1.3](https://www.mediafire.com/file/8aaa04j3u56gezx/)
- [JEI 1.15.2-6.0.0.12](https://www.curseforge.com/minecraft/mc-mods/jei/files/all)

The plugin was created with the MinecraftForge version "1.15.2-31.1.27".
The plugin was created with the MinecraftForge version "1.15.2-31.2.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
12 changes: 6 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ apply plugin: 'eclipse'
apply plugin: 'maven-publish'
apply plugin: "net.minecrell.licenser"

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

Expand All @@ -46,7 +46,7 @@ minecraft {
workingDirectory project.file('run')

// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
// property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'

// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'
Expand All @@ -62,7 +62,7 @@ minecraft {
workingDirectory project.file('run')

// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
// property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'

// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'
Expand All @@ -78,12 +78,12 @@ minecraft {
workingDirectory project.file('run')

// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
// property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'

// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'

args '--mod', 'examplemod', '--all', '--output', file('src/generated/resources/')
args '--mod', 'jeilotr', '--all', '--output', file('src/generated/resources/')

mods {
examplemod {
Expand All @@ -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.1.27'
minecraft 'net.minecraftforge:forge:1.15.2-31.2.0'

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

Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
jei_mc_version=1.15.2
jei_version=6.0.0.4
lotr_version=1.1
jei_version=6.0.2.12
lotr_version=1.3
156 changes: 156 additions & 0 deletions src/main/java/craftedMods/jeiLotr/AlloyForge.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
/*
* Copyright (C) 2020-2020 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/

package craftedMods.jeiLotr;

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.ingredient.IGuiItemStackGroup;
import mezz.jei.api.helpers.IGuiHelper;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.plugins.vanilla.cooking.FurnaceVariantCategory;
import mezz.jei.util.Translator;
import net.minecraft.client.Minecraft;
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.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;
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.format (forgeIcon.getTranslationKey ());
}

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

@Override
public IDrawable getBackground ()
{
return this.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));
}
}

public void draw (IRecipe<?> recipe, double mouseX, double mouseY)
{
this.animatedFlame.draw (35, 92);
this.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 (
(String) "gui.jei.category.smelting.experience",
(Object[]) new Object[]
{Float.valueOf (experience)});
Minecraft minecraft = Minecraft.getInstance ();
FontRenderer fontRenderer = minecraft.fontRenderer;
int stringWidth = fontRenderer.getStringWidth (experienceString);
fontRenderer.drawString (experienceString, (float) (this.background.getWidth () - stringWidth), 43.0f,
-8355712);
}
}

}
Loading

0 comments on commit be8984f

Please sign in to comment.