1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-10-29 21:02:59 +00:00

Move most recipe registration to JSON

We need this for 1.13+, so might as well get it over with.
This commit is contained in:
SquidDev
2018-12-27 12:16:11 +00:00
parent 26ba61097b
commit 618c534d81
13 changed files with 51 additions and 74 deletions

View File

@@ -1,14 +1,15 @@
package dan200.computercraft.shared.common;
import com.google.gson.JsonObject;
import dan200.computercraft.shared.util.Colour;
import dan200.computercraft.shared.util.ColourTracker;
import dan200.computercraft.shared.util.ColourUtils;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.util.NonNullList;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.crafting.IRecipeFactory;
import net.minecraftforge.common.crafting.JsonContext;
import net.minecraftforge.registries.IForgeRegistryEntry;
import javax.annotation.Nonnull;
@@ -98,16 +99,12 @@ public class ColourableRecipe extends IForgeRegistryEntry.Impl<IRecipe> implemen
return ItemStack.EMPTY;
}
@Nonnull
@Override
public NonNullList<ItemStack> getRemainingItems( @Nonnull InventoryCrafting inventoryCrafting )
public static class Factory implements IRecipeFactory
{
NonNullList<ItemStack> results = NonNullList.withSize( inventoryCrafting.getSizeInventory(), ItemStack.EMPTY );
for( int i = 0; i < results.size(); i++ )
@Override
public IRecipe parse( JsonContext jsonContext, JsonObject jsonObject )
{
ItemStack stack = inventoryCrafting.getStackInSlot( i );
results.set( i, ForgeHooks.getContainerItem( stack ) );
return new ColourableRecipe();
}
return results;
}
}