Files
CatServer/patches/net/minecraft/item/crafting/RecipesBanners.java.patch
2019-02-24 22:29:41 +08:00

111 lines
4.7 KiB
Diff

--- ../src-base/minecraft/net/minecraft/item/crafting/RecipesBanners.java
+++ ../src-work/minecraft/net/minecraft/item/crafting/RecipesBanners.java
@@ -12,13 +12,17 @@
import net.minecraft.tileentity.TileEntityBanner;
import net.minecraft.util.NonNullList;
import net.minecraft.world.World;
-import net.minecraftforge.fml.relauncher.Side;
-import net.minecraftforge.fml.relauncher.SideOnly;
public class RecipesBanners
{
- public static class RecipeAddPattern implements IRecipe
+ public static class RecipeAddPattern extends ShapelessRecipes implements IRecipe
{
+ // CraftBukkit start - Delegate to new parent class with bogus info
+ public RecipeAddPattern() {
+ super("", new ItemStack(Items.BANNER, 0, 0), NonNullList.from(Ingredient.EMPTY, Ingredient.fromItem(Items.BANNER)));
+ }
+ // CraftBukkit end
+
public boolean matches(InventoryCrafting inv, World worldIn)
{
boolean flag = false;
@@ -79,9 +83,10 @@
{
ItemStack itemstack2 = inv.getStackInSlot(j);
- if (itemstack2.getItem() == Items.DYE)
+ int color = net.minecraftforge.oredict.DyeUtils.rawDyeDamageFromStack(itemstack2);
+ if (color != -1)
{
- k = itemstack2.getMetadata();
+ k = color;
break;
}
}
@@ -120,11 +125,7 @@
for (int i = 0; i < nonnulllist.size(); ++i)
{
ItemStack itemstack = inv.getStackInSlot(i);
-
- if (itemstack.getItem().hasContainerItem())
- {
- nonnulllist.set(i, new ItemStack(itemstack.getItem().getContainerItem()));
- }
+ nonnulllist.set(i, net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack));
}
return nonnulllist;
@@ -150,7 +151,7 @@
if (!itemstack.isEmpty() && itemstack.getItem() != Items.BANNER)
{
- if (itemstack.getItem() == Items.DYE)
+ if (net.minecraftforge.oredict.DyeUtils.isDye(itemstack))
{
if (flag2)
{
@@ -190,7 +191,7 @@
if (!itemstack1.isEmpty() && itemstack1.getItem() != Items.BANNER)
{
- if (itemstack1.getItem() != Items.DYE)
+ if (!net.minecraftforge.oredict.DyeUtils.isDye(itemstack1))
{
flag = false;
break;
@@ -237,15 +238,20 @@
return true;
}
- @SideOnly(Side.CLIENT)
public boolean canFit(int width, int height)
{
return width >= 3 && height >= 3;
}
}
- public static class RecipeDuplicatePattern implements IRecipe
+ public static class RecipeDuplicatePattern extends ShapelessRecipes implements IRecipe
{
+ // CraftBukkit start - Delegate to new parent class with bogus info
+ public RecipeDuplicatePattern() {
+ super("", new ItemStack(Items.BANNER, 0, 0), NonNullList.from(Ingredient.EMPTY, Ingredient.fromItem(Items.DYE)));
+ }
+ // CraftBukkit end
+
public boolean matches(InventoryCrafting inv, World worldIn)
{
ItemStack itemstack = ItemStack.EMPTY;
@@ -344,9 +350,9 @@
if (!itemstack.isEmpty())
{
- if (itemstack.getItem().hasContainerItem())
+ if (itemstack.getItem().hasContainerItem(itemstack))
{
- nonnulllist.set(i, new ItemStack(itemstack.getItem().getContainerItem()));
+ nonnulllist.set(i, net.minecraftforge.common.ForgeHooks.getContainerItem(itemstack));
}
else if (itemstack.hasTagCompound() && TileEntityBanner.getPatterns(itemstack) > 0)
{
@@ -365,7 +371,6 @@
return true;
}
- @SideOnly(Side.CLIENT)
public boolean canFit(int width, int height)
{
return width * height >= 2;