mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-01-19 05:32:55 +00:00
Add ore dictionary support to all recipes
This commit is contained in:
parent
3b3dd8071b
commit
3ac76bc05b
@ -10,19 +10,23 @@ import dan200.computercraft.shared.media.items.ItemDiskLegacy;
|
||||
import dan200.computercraft.shared.util.Colour;
|
||||
import dan200.computercraft.shared.util.ColourTracker;
|
||||
import dan200.computercraft.shared.util.ColourUtils;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.oredict.OreIngredient;
|
||||
import net.minecraftforge.registries.IForgeRegistryEntry;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class DiskRecipe extends IForgeRegistryEntry.Impl<IRecipe> implements IRecipe
|
||||
{
|
||||
private final Ingredient paper = new OreIngredient( "paper" );
|
||||
private final Ingredient redstone = new OreIngredient( "dustRedstone" );
|
||||
|
||||
@Override
|
||||
public boolean matches( @Nonnull InventoryCrafting inv, @Nonnull World world )
|
||||
{
|
||||
@ -35,12 +39,12 @@ public class DiskRecipe extends IForgeRegistryEntry.Impl<IRecipe> implements IRe
|
||||
|
||||
if( !stack.isEmpty() )
|
||||
{
|
||||
if( stack.getItem() == Items.PAPER )
|
||||
if( paper.apply( stack ) )
|
||||
{
|
||||
if( paperFound ) return false;
|
||||
paperFound = true;
|
||||
}
|
||||
else if( stack.getItem() == Items.REDSTONE )
|
||||
else if( redstone.apply( stack ) )
|
||||
{
|
||||
if( redstoneFound ) return false;
|
||||
redstoneFound = true;
|
||||
@ -67,7 +71,7 @@ public class DiskRecipe extends IForgeRegistryEntry.Impl<IRecipe> implements IRe
|
||||
|
||||
if( stack.isEmpty() ) continue;
|
||||
|
||||
if( stack.getItem() != Items.PAPER && stack.getItem() != Items.REDSTONE )
|
||||
if( !paper.apply( stack ) && !redstone.apply( stack ) )
|
||||
{
|
||||
int index = ColourUtils.getStackColour( stack );
|
||||
if( index < 0 ) continue;
|
||||
|
@ -7,23 +7,24 @@
|
||||
package dan200.computercraft.shared.media.recipes;
|
||||
|
||||
import dan200.computercraft.shared.media.items.ItemPrintout;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.item.crafting.Ingredient;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.oredict.OreIngredient;
|
||||
import net.minecraftforge.registries.IForgeRegistryEntry;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class PrintoutRecipe extends IForgeRegistryEntry.Impl<IRecipe> implements IRecipe
|
||||
{
|
||||
public PrintoutRecipe( )
|
||||
{
|
||||
}
|
||||
private final Ingredient paper = new OreIngredient( "paper" );
|
||||
private final Ingredient leather = new OreIngredient( "leather" );
|
||||
private final Ingredient string = new OreIngredient( "string" );
|
||||
|
||||
@Override
|
||||
public boolean canFit( int x, int y )
|
||||
@ -68,8 +69,7 @@ public class PrintoutRecipe extends IForgeRegistryEntry.Impl<IRecipe> implements
|
||||
ItemStack stack = inventory.getStackInRowAndColumn(x, y);
|
||||
if( !stack.isEmpty() )
|
||||
{
|
||||
Item item = stack.getItem();
|
||||
if( item instanceof ItemPrintout && ItemPrintout.getType( stack ) != ItemPrintout.Type.Book )
|
||||
if( stack.getItem() instanceof ItemPrintout && ItemPrintout.getType( stack ) != ItemPrintout.Type.Book )
|
||||
{
|
||||
if( printouts == null )
|
||||
{
|
||||
@ -80,7 +80,7 @@ public class PrintoutRecipe extends IForgeRegistryEntry.Impl<IRecipe> implements
|
||||
numPrintouts++;
|
||||
printoutFound = true;
|
||||
}
|
||||
else if( item == Items.PAPER )
|
||||
else if( paper.apply( stack ) )
|
||||
{
|
||||
if( printouts == null )
|
||||
{
|
||||
@ -90,11 +90,11 @@ public class PrintoutRecipe extends IForgeRegistryEntry.Impl<IRecipe> implements
|
||||
numPages++;
|
||||
numPrintouts++;
|
||||
}
|
||||
else if( item == Items.STRING && !stringFound )
|
||||
else if( string.apply( stack ) && !stringFound )
|
||||
{
|
||||
stringFound = true;
|
||||
}
|
||||
else if( item == Items.LEATHER && !leatherFound )
|
||||
else if( leather.apply( stack ) && !leatherFound )
|
||||
{
|
||||
leatherFound = true;
|
||||
}
|
||||
|
@ -6,9 +6,9 @@
|
||||
"#G#"
|
||||
],
|
||||
"key": {
|
||||
"#": { "item": "minecraft:gold_ingot" },
|
||||
"R": { "item": "minecraft:redstone" },
|
||||
"G": { "item": "minecraft:glass_pane" }
|
||||
"#": { "type": "forge:ore_dict", "ore": "ingotGold" },
|
||||
"R": { "type": "forge:ore_dict", "ore": "dustRedstone" },
|
||||
"G": { "type": "forge:ore_dict", "ore": "paneGlass" }
|
||||
},
|
||||
"result": { "item": "computercraft:computer", "data": 16384 }
|
||||
}
|
||||
|
@ -6,8 +6,8 @@
|
||||
"###"
|
||||
],
|
||||
"key": {
|
||||
"#": { "item": "minecraft:gold_ingot" },
|
||||
"G": { "item": "minecraft:glass_pane" }
|
||||
"#": { "type": "forge:ore_dict", "ore": "ingotGold" },
|
||||
"G": { "type": "forge:ore_dict", "ore": "paneGlass" }
|
||||
},
|
||||
"result": { "item": "computercraft:peripheral", "data": 4, "count": 4 }
|
||||
}
|
||||
|
@ -6,8 +6,8 @@
|
||||
"#G#"
|
||||
],
|
||||
"key": {
|
||||
"#": { "item": "minecraft:gold_ingot" },
|
||||
"G": { "item": "minecraft:glass_pane" },
|
||||
"#": { "type": "forge:ore_dict", "ore": "ingotGold" },
|
||||
"G": { "type": "forge:ore_dict", "ore": "paneGlass" },
|
||||
"A": { "item": "minecraft:golden_apple", "data": 0 }
|
||||
},
|
||||
"result": { "item": "computercraft:pocket_computer", "data": 1 }
|
||||
|
@ -6,9 +6,9 @@
|
||||
"#I#"
|
||||
],
|
||||
"key": {
|
||||
"#": { "item": "minecraft:gold_ingot" },
|
||||
"#": { "type": "forge:ore_dict", "ore": "ingotGold" },
|
||||
"C": { "item": "computercraft:computer", "data": 16384 },
|
||||
"I": { "item": "minecraft:chest" }
|
||||
"I": { "type": "forge:ore_dict", "ore": "chestWood" }
|
||||
},
|
||||
"family": "Advanced"
|
||||
}
|
||||
|
@ -6,8 +6,8 @@
|
||||
" # "
|
||||
],
|
||||
"key": {
|
||||
"#": { "item": "minecraft:stone", "data": 0 },
|
||||
"R": { "item": "minecraft:redstone" }
|
||||
"#": { "type": "forge:ore_dict", "ore": "stone" },
|
||||
"R": { "type": "forge:ore_dict", "ore": "dustRedstone" }
|
||||
},
|
||||
"result": { "item": "computercraft:cable", "data": 0, "count": 6 }
|
||||
}
|
||||
|
@ -6,9 +6,9 @@
|
||||
"#G#"
|
||||
],
|
||||
"key": {
|
||||
"#": { "item": "minecraft:stone", "data": 0 },
|
||||
"#": { "type": "forge:ore_dict", "ore": "stone" },
|
||||
"C": { "item": "minecraft:command_block" },
|
||||
"G": { "item": "minecraft:glass_pane" }
|
||||
"G": { "type": "forge:ore_dict", "ore": "paneGlass" }
|
||||
},
|
||||
"result": { "item": "computercraft:command_computer", "data": 0 }
|
||||
}
|
||||
|
@ -6,8 +6,8 @@
|
||||
"#R#"
|
||||
],
|
||||
"key": {
|
||||
"#": { "item": "minecraft:stone", "data": 0 },
|
||||
"R": { "item": "minecraft:redstone" }
|
||||
"#": { "type": "forge:ore_dict", "ore": "stone" },
|
||||
"R": { "type": "forge:ore_dict", "ore": "dustRedstone" }
|
||||
},
|
||||
"result": { "item": "computercraft:peripheral", "data": 0 }
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
{
|
||||
"type": "computercraft:impostor_shapeless",
|
||||
"ingredients": [
|
||||
{ "item": "minecraft:redstone" },
|
||||
{ "item": "minecraft:paper" }
|
||||
{ "type": "forge:ore_dict", "ore": "dustRedstone" },
|
||||
{ "type": "forge:ore_dict", "ore": "paper" }
|
||||
],
|
||||
"result": { "item": "computercraft:disk", "data": 0 }
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
"###"
|
||||
],
|
||||
"key": {
|
||||
"#": { "item": "minecraft:gold_ingot" },
|
||||
"#": { "type": "forge:ore_dict", "ore": "ingotGold" },
|
||||
"E": { "item": "minecraft:ender_eye" }
|
||||
},
|
||||
"result": { "item": "computercraft:advanced_modem", "data": 0 }
|
||||
|
@ -6,9 +6,9 @@
|
||||
"#G#"
|
||||
],
|
||||
"key": {
|
||||
"#": { "item": "minecraft:stone", "data": 0 },
|
||||
"R": { "item": "minecraft:redstone" },
|
||||
"G": { "item": "minecraft:glass_pane" }
|
||||
"#": { "type": "forge:ore_dict", "ore": "stone" },
|
||||
"R": { "type": "forge:ore_dict", "ore": "dustRedstone" },
|
||||
"G": { "type": "forge:ore_dict", "ore": "paneGlass" }
|
||||
},
|
||||
"result": { "item": "computercraft:computer", "data": 0 }
|
||||
}
|
||||
|
@ -6,8 +6,8 @@
|
||||
"###"
|
||||
],
|
||||
"key": {
|
||||
"#": { "item": "minecraft:stone", "data": 0 },
|
||||
"G": { "item": "minecraft:glass_pane" }
|
||||
"#": { "type": "forge:ore_dict", "ore": "stone" },
|
||||
"G": { "type": "forge:ore_dict", "ore": "paneGlass" }
|
||||
},
|
||||
"result": { "item": "computercraft:peripheral", "data": 2 }
|
||||
}
|
||||
|
@ -6,8 +6,8 @@
|
||||
"#G#"
|
||||
],
|
||||
"key": {
|
||||
"#": { "item": "minecraft:stone", "data": 0 },
|
||||
"G": { "item": "minecraft:glass_pane" },
|
||||
"#": { "type": "forge:ore_dict", "ore": "stone" },
|
||||
"G": { "type": "forge:ore_dict", "ore": "paneGlass" },
|
||||
"A": { "item": "minecraft:golden_apple", "data": 0 }
|
||||
},
|
||||
"result": { "item": "computercraft:pocket_computer", "data": 0 }
|
||||
|
@ -6,9 +6,9 @@
|
||||
"#I#"
|
||||
],
|
||||
"key": {
|
||||
"#": { "item": "minecraft:iron_ingot" },
|
||||
"#": { "type": "forge:ore_dict", "ore": "ingotIron" },
|
||||
"C": { "item": "computercraft:computer", "data": 0 },
|
||||
"I": { "item": "minecraft:chest" }
|
||||
"I": { "type": "forge:ore_dict", "ore": "chestWood" }
|
||||
},
|
||||
"family": "Normal"
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
{
|
||||
"type": "computercraft:impostor_shapeless",
|
||||
"ingredients": [
|
||||
{ "item": "minecraft:leather" },
|
||||
{ "type": "forge:ore_dict", "ore": "leather" },
|
||||
{ "item": "computercraft:printout", "data": 0 },
|
||||
{ "item": "minecraft:string" }
|
||||
{ "type": "forge:ore_dict", "ore": "string" }
|
||||
],
|
||||
"result": { "item": "computercraft:printout", "data": 2 }
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
"ingredients": [
|
||||
{ "item": "computercraft:printout", "data": 0 },
|
||||
{ "item": "computercraft:printout", "data": 0 },
|
||||
{ "item": "minecraft:string" }
|
||||
{ "type": "forge:ore_dict", "ore": "string" }
|
||||
],
|
||||
"result": { "item": "computercraft:printout", "data": 1 }
|
||||
}
|
||||
|
@ -6,9 +6,9 @@
|
||||
"#D#"
|
||||
],
|
||||
"key": {
|
||||
"#": { "item": "minecraft:stone", "data": 0 },
|
||||
"R": { "item": "minecraft:redstone" },
|
||||
"D": { "item": "minecraft:dye", "data": 0 }
|
||||
"#": { "type": "forge:ore_dict", "ore": "stone" },
|
||||
"R": { "type": "forge:ore_dict", "ore": "paneGlass" },
|
||||
"D": { "type": "forge:ore_dict", "ore": "dye" }
|
||||
},
|
||||
"result": { "item": "computercraft:peripheral", "data": 3 }
|
||||
}
|
||||
|
@ -6,8 +6,8 @@
|
||||
"#R#"
|
||||
],
|
||||
"key": {
|
||||
"#": { "item": "minecraft:stone", "data": 0 },
|
||||
"R": { "item": "minecraft:redstone" },
|
||||
"#": { "type": "forge:ore_dict", "ore": "stone" },
|
||||
"R": { "type": "forge:ore_dict", "ore": "dustRedstone" },
|
||||
"N": { "item": "minecraft:noteblock" }
|
||||
},
|
||||
"result": { "item": "computercraft:peripheral", "data": 5 }
|
||||
|
@ -6,8 +6,8 @@
|
||||
"###"
|
||||
],
|
||||
"key": {
|
||||
"#": { "item": "minecraft:stone", "data": 0 },
|
||||
"R": { "item": "minecraft:redstone" }
|
||||
"#": { "type": "forge:ore_dict", "ore": "stone" },
|
||||
"R": { "type": "forge:ore_dict", "ore": "dustRedstone" }
|
||||
},
|
||||
"result": { "item": "computercraft:cable", "data": 1 }
|
||||
}
|
||||
|
@ -6,8 +6,8 @@
|
||||
"###"
|
||||
],
|
||||
"key": {
|
||||
"#": { "item": "minecraft:stone", "data": 0 },
|
||||
"E": { "item": "minecraft:ender_pearl" }
|
||||
"#": { "type": "forge:ore_dict", "ore": "stone" },
|
||||
"E": { "type": "forge:ore_dict", "ore": "enderpearl" }
|
||||
},
|
||||
"result": { "item": "computercraft:peripheral", "data": 1 }
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user