Fixed ShapedOre recipes not laying out correctly with the guidebook.

This commit is contained in:
LexManos committed 2017-09-14 14:32:03 -07:00
1 parent 883109182d
commit 036191cd52
8 files changed
+134 -3

No files matched your search

@@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/client/gui/recipebook/GuiRecipeBook.java
+++ ../src-work/minecraft/net/minecraft/client/gui/recipebook/GuiRecipeBook.java
@@ -485,7 +485,7 @@
this.field_191915_z.func_194187_a(Ingredient.func_193369_a(itemstack), (p_193951_2_.get(0)).field_75223_e, (p_193951_2_.get(0)).field_75221_f);
int i = this.field_193961_o.func_174922_i();
int j = this.field_193961_o.func_174923_h();
- int k = p_193951_1_ instanceof ShapedRecipes ? ((ShapedRecipes)p_193951_1_).func_192403_f() : i;
+ int k = p_193951_1_ instanceof net.minecraftforge.common.crafting.IShapedRecipe ? ((net.minecraftforge.common.crafting.IShapedRecipe)p_193951_1_).getRecipeWidth() : i;
int l = 1;
Iterator<Ingredient> iterator = p_193951_1_.func_192400_c().iterator();
@@ -0,0 +1,18 @@
--- ../src-base/minecraft/net/minecraft/client/gui/recipebook/GuiRecipeOverlay.java
+++ ../src-work/minecraft/net/minecraft/client/gui/recipebook/GuiRecipeOverlay.java
@@ -230,11 +230,11 @@
int k = 3;
int l = 3;
- if (this.field_193924_p instanceof ShapedRecipes)
+ if (this.field_193924_p instanceof net.minecraftforge.common.crafting.IShapedRecipe)
{
- ShapedRecipes shapedrecipes = (ShapedRecipes)this.field_193924_p;
- k = shapedrecipes.func_192403_f();
- l = shapedrecipes.func_192404_g();
+ net.minecraftforge.common.crafting.IShapedRecipe shapedrecipes = (net.minecraftforge.common.crafting.IShapedRecipe)this.field_193924_p;
+ k = shapedrecipes.getRecipeWidth();
+ l = shapedrecipes.getRecipeHeight();
}
Iterator<Ingredient> iterator = this.field_193924_p.func_192400_c().iterator();
@@ -8,7 +8,7 @@
-import net.minecraftforge.fml.relauncher.SideOnly;
-public class ShapedRecipes implements IRecipe
+public class ShapedRecipes extends net.minecraftforge.registries.IForgeRegistryEntry.Impl<IRecipe> implements IRecipe
+public class ShapedRecipes extends net.minecraftforge.registries.IForgeRegistryEntry.Impl<IRecipe> implements net.minecraftforge.common.crafting.IShapedRecipe
{
public final int field_77576_b;
public final int field_77577_c;
@@ -40,3 +40,20 @@
public boolean func_194133_a(int p_194133_1_, int p_194133_2_)
{
return p_194133_1_ >= this.field_77576_b && p_194133_2_ >= this.field_77577_c;
@@ -379,4 +372,16 @@
return new ItemStack(item, j, i);
}
}
+
+ //================================================ FORGE START ================================================
+ @Override
+ public int getRecipeWidth()
+ {
+ return this.func_192403_f();
+ }
+ @Override
+ public int getRecipeHeight()
+ {
+ return this.func_192404_g();
+ }
}
@@ -0,0 +1,18 @@
--- ../src-base/minecraft/net/minecraft/util/ServerRecipeBookHelper.java
+++ ../src-work/minecraft/net/minecraft/util/ServerRecipeBookHelper.java
@@ -199,11 +199,11 @@
int i = this.field_194336_g.func_174922_i();
int j = this.field_194336_g.func_174923_h();
- if (this.field_194333_d instanceof ShapedRecipes)
+ if (this.field_194333_d instanceof net.minecraftforge.common.crafting.IShapedRecipe)
{
- ShapedRecipes shapedrecipes = (ShapedRecipes)this.field_194333_d;
- i = shapedrecipes.func_192403_f();
- j = shapedrecipes.func_192404_g();
+ net.minecraftforge.common.crafting.IShapedRecipe shapedrecipes = (net.minecraftforge.common.crafting.IShapedRecipe)this.field_194333_d;
+ i = shapedrecipes.getRecipeWidth();
+ j = shapedrecipes.getRecipeHeight();
}
int j1 = 1;
@@ -0,0 +1,32 @@
/*
* Minecraft Forge
* Copyright (c) 2016.
*
* This library 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 version 2.1
* of the License.
*
* This library 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 library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package net.minecraftforge.common.crafting;
import net.minecraft.item.crafting.IRecipe;
/**
* Used to mark a recipe that shape matters so that the recipe
* book and auto crafting picks the correct shape.
* Note: These methods can't be named 'getHeight' or 'getWidth' due to obfusication issues.
*/
public interface IShapedRecipe extends IRecipe
{
public int getRecipeWidth();
public int getRecipeHeight();
}
@@ -32,6 +32,7 @@ import net.minecraft.world.World;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.crafting.CraftingHelper;
import net.minecraftforge.common.crafting.CraftingHelper.ShapedPrimer;
import net.minecraftforge.common.crafting.IShapedRecipe;
import net.minecraftforge.registries.IForgeRegistryEntry;
import net.minecraftforge.common.crafting.JsonContext;
@@ -49,7 +50,7 @@ import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonSyntaxException;
public class ShapedOreRecipe extends IForgeRegistryEntry.Impl<IRecipe> implements IRecipe
public class ShapedOreRecipe extends IForgeRegistryEntry.Impl<IRecipe> implements IShapedRecipe
{
//Added in for future ease of change, but hard coded for now.
public static final int MAX_CRAFT_GRID_WIDTH = 3;
@@ -154,16 +155,30 @@ public class ShapedOreRecipe extends IForgeRegistryEntry.Impl<IRecipe> implement
return this.input;
}
@Deprecated //Use IShapedRecipe.getRecipeWidth
public int getWidth()
{
return width;
}
@Override
public int getRecipeWidth()
{
return this.getWidth();
}
@Deprecated //Use IShapedRecipe.getRecipeHeight
public int getHeight()
{
return height;
}
@Override
public int getRecipeHeight()
{
return this.getHeight();
}
@Override
@Nonnull
public String getGroup()
-1
View File
@@ -1,2 +1 @@
MD: net/minecraft/server/management/ServerConfigurationManager/initializeConnectionToPlayer (Lnet/minecraft/network/NetworkManager;Lnet/minecraft/entity/player/EntityPlayerMP;Lnet/minecraft/network/NetHandlerPlayServer;)V net/minecraft/server/management/ServerConfigurationManager/func_72355_a (Lnet/minecraft/network/NetworkManager;Lnet/minecraft/entity/player/EntityPlayerMP;Lnet/minecraft/network/NetHandlerPlayServer;)V
MD: net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry/getKeys ()Ljava/util/Set; net/minecraftforge/fml/common/registry/FMLControlledNamespacedRegistry/getKeys ()Ljava/util/Set;
@@ -0,0 +1,21 @@
{
"type": "forge:ore_shaped",
"pattern": [
"X",
"X",
"#"
],
"key": {
"#": {
"type": "forge:ore_dict",
"ore": "stickWood"
},
"X": {
"item": "minecraft:beetroot"
}
},
"result": {
"item": "minecraft:dirt",
"data": 0
}
}