Port most recipes to use generators

Closes #354
This commit is contained in:
SquidDev 2020-02-08 23:26:05 +00:00
parent 00b41d29c1
commit 419f29321a
68 changed files with 1149 additions and 627 deletions

View File

@ -0,0 +1,43 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:cable"
]
},
"criteria": {
"has_computer": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"tag": "computercraft:computer"
}
]
}
},
"has_modem": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"tag": "computercraft:computer"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:cable"
}
}
},
"requirements": [
[
"has_computer",
"has_modem",
"has_the_recipe"
]
]
}

View File

@ -0,0 +1,35 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:computer_advanced"
]
},
"criteria": {
"has_components": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "minecraft:redstone"
},
{
"item": "minecraft:gold_ingot"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:computer_advanced"
}
}
},
"requirements": [
[
"has_components",
"has_the_recipe"
]
]
}

View File

@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:computer_command"
]
},
"criteria": {
"has_components": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "minecraft:command_block"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:computer_command"
}
}
},
"requirements": [
[
"has_components",
"has_the_recipe"
]
]
}

View File

@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:computer_normal"
]
},
"criteria": {
"has_redstone": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"tag": "forge:dusts/redstone"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:computer_normal"
}
}
},
"requirements": [
[
"has_redstone",
"has_the_recipe"
]
]
}

View File

@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:disk_drive"
]
},
"criteria": {
"has_computer": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"tag": "computercraft:computer"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:disk_drive"
}
}
},
"requirements": [
[
"has_computer",
"has_the_recipe"
]
]
}

View File

@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:monitor_advanced"
]
},
"criteria": {
"has_computer": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"tag": "computercraft:computer"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:monitor_advanced"
}
}
},
"requirements": [
[
"has_computer",
"has_the_recipe"
]
]
}

View File

@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:monitor_normal"
]
},
"criteria": {
"has_computer": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"tag": "computercraft:computer"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:monitor_normal"
}
}
},
"requirements": [
[
"has_computer",
"has_the_recipe"
]
]
}

View File

@ -0,0 +1,43 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:pocket_computer_advanced"
]
},
"criteria": {
"has_computer": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"tag": "computercraft:computer"
}
]
}
},
"has_apple": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "minecraft:golden_apple"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:pocket_computer_advanced"
}
}
},
"requirements": [
[
"has_computer",
"has_apple",
"has_the_recipe"
]
]
}

View File

@ -0,0 +1,43 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:pocket_computer_normal"
]
},
"criteria": {
"has_computer": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"tag": "computercraft:computer"
}
]
}
},
"has_apple": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "minecraft:golden_apple"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:pocket_computer_normal"
}
}
},
"requirements": [
[
"has_computer",
"has_apple",
"has_the_recipe"
]
]
}

View File

@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:printer"
]
},
"criteria": {
"has_computer": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"tag": "computercraft:computer"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:printer"
}
}
},
"requirements": [
[
"has_computer",
"has_the_recipe"
]
]
}

View File

@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:speaker"
]
},
"criteria": {
"has_computer": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"tag": "computercraft:computer"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:speaker"
}
}
},
"requirements": [
[
"has_computer",
"has_the_recipe"
]
]
}

View File

@ -0,0 +1,43 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:wired_modem"
]
},
"criteria": {
"has_computer": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"tag": "computercraft:computer"
}
]
}
},
"has_cable": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:cable"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:wired_modem"
}
}
},
"requirements": [
[
"has_computer",
"has_cable",
"has_the_recipe"
]
]
}

View File

@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:wired_modem_full_from"
]
},
"criteria": {
"has_modem": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"tag": "computercraft:wired_modem"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:wired_modem_full_from"
}
}
},
"requirements": [
[
"has_modem",
"has_the_recipe"
]
]
}

View File

@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:wired_modem_full_to"
]
},
"criteria": {
"has_modem": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"tag": "computercraft:wired_modem"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:wired_modem_full_to"
}
}
},
"requirements": [
[
"has_modem",
"has_the_recipe"
]
]
}

View File

@ -0,0 +1,43 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:wireless_modem_advanced"
]
},
"criteria": {
"has_computer": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"tag": "computercraft:computer"
}
]
}
},
"has_wireless": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "computercraft:wireless_modem_normal"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:wireless_modem_advanced"
}
}
},
"requirements": [
[
"has_computer",
"has_wireless",
"has_the_recipe"
]
]
}

View File

@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"computercraft:wireless_modem_normal"
]
},
"criteria": {
"has_computer": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"tag": "computercraft:computer"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "computercraft:wireless_modem_normal"
}
}
},
"requirements": [
[
"has_computer",
"has_the_recipe"
]
]
}

View File

@ -0,0 +1,20 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
" # ",
"#R#",
" # "
],
"key": {
"#": {
"tag": "forge:stone"
},
"R": {
"tag": "forge:dusts/redstone"
}
},
"result": {
"item": "computercraft:cable",
"count": 6
}
}

View File

@ -0,0 +1,22 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"###",
"#R#",
"#G#"
],
"key": {
"#": {
"tag": "forge:ingots/gold"
},
"R": {
"tag": "forge:dusts/redstone"
},
"G": {
"tag": "forge:glass_panes"
}
},
"result": {
"item": "computercraft:computer_advanced"
}
}

View File

@ -0,0 +1,22 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"###",
"#R#",
"#G#"
],
"key": {
"#": {
"tag": "forge:ingots/gold"
},
"R": {
"item": "minecraft:command_block"
},
"G": {
"tag": "forge:glass_panes"
}
},
"result": {
"item": "computercraft:computer_command"
}
}

View File

@ -0,0 +1,22 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"###",
"#R#",
"#G#"
],
"key": {
"#": {
"tag": "forge:stone"
},
"R": {
"tag": "forge:dusts/redstone"
},
"G": {
"tag": "forge:glass_panes"
}
},
"result": {
"item": "computercraft:computer_normal"
}
}

View File

@ -0,0 +1,19 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"###",
"#R#",
"#R#"
],
"key": {
"#": {
"tag": "forge:stone"
},
"R": {
"tag": "forge:dusts/redstone"
}
},
"result": {
"item": "computercraft:disk_drive"
}
}

View File

@ -0,0 +1,20 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"###",
"#G#",
"###"
],
"key": {
"#": {
"tag": "forge:ingots/gold"
},
"G": {
"tag": "forge:glass_panes"
}
},
"result": {
"item": "computercraft:monitor_advanced",
"count": 4
}
}

View File

@ -0,0 +1,19 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"###",
"#G#",
"###"
],
"key": {
"#": {
"tag": "forge:stone"
},
"G": {
"tag": "forge:glass_panes"
}
},
"result": {
"item": "computercraft:monitor_normal"
}
}

View File

@ -0,0 +1,22 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"###",
"#A#",
"#G#"
],
"key": {
"#": {
"tag": "forge:ingots/gold"
},
"A": {
"item": "minecraft:golden_apple"
},
"G": {
"tag": "forge:glass_panes"
}
},
"result": {
"item": "computercraft:pocket_computer_advanced"
}
}

View File

@ -0,0 +1,22 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"###",
"#A#",
"#G#"
],
"key": {
"#": {
"tag": "forge:stone"
},
"A": {
"item": "minecraft:golden_apple"
},
"G": {
"tag": "forge:glass_panes"
}
},
"result": {
"item": "computercraft:pocket_computer_normal"
}
}

View File

@ -0,0 +1,22 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"###",
"#R#",
"#D#"
],
"key": {
"#": {
"tag": "forge:stone"
},
"R": {
"tag": "forge:dusts/redstone"
},
"D": {
"tag": "forge:dyes"
}
},
"result": {
"item": "computercraft:printer"
}
}

View File

@ -0,0 +1,22 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"###",
"#N#",
"#R#"
],
"key": {
"#": {
"tag": "forge:stone"
},
"N": {
"item": "minecraft:note_block"
},
"R": {
"tag": "forge:dusts/redstone"
}
},
"result": {
"item": "computercraft:speaker"
}
}

View File

@ -0,0 +1,19 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"###",
"#R#",
"###"
],
"key": {
"#": {
"tag": "forge:stone"
},
"R": {
"tag": "forge:dusts/redstone"
}
},
"result": {
"item": "computercraft:wired_modem"
}
}

View File

@ -0,0 +1,11 @@
{
"type": "minecraft:crafting_shapeless",
"ingredients": [
{
"item": "computercraft:wired_modem"
}
],
"result": {
"item": "computercraft:wired_modem_full"
}
}

View File

@ -0,0 +1,11 @@
{
"type": "minecraft:crafting_shapeless",
"ingredients": [
{
"item": "computercraft:wired_modem_full"
}
],
"result": {
"item": "computercraft:wired_modem"
}
}

View File

@ -0,0 +1,19 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"###",
"#E#",
"###"
],
"key": {
"#": {
"tag": "forge:ingots/gold"
},
"E": {
"item": "minecraft:ender_eye"
}
},
"result": {
"item": "computercraft:wireless_modem_advanced"
}
}

View File

@ -0,0 +1,19 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"###",
"#E#",
"###"
],
"key": {
"#": {
"tag": "forge:stone"
},
"E": {
"tag": "forge:ender_pearls"
}
},
"result": {
"item": "computercraft:wireless_modem_normal"
}
}

View File

@ -0,0 +1,8 @@
{
"replace": false,
"values": [
"computercraft:computer_normal",
"computercraft:computer_advanced",
"computercraft:computer_command"
]
}

View File

@ -0,0 +1,7 @@
{
"replace": false,
"values": [
"computercraft:monitor_normal",
"computercraft:monitor_advanced"
]
}

View File

@ -0,0 +1,7 @@
{
"replace": false,
"values": [
"computercraft:turtle_normal",
"computercraft:turtle_advanced"
]
}

View File

@ -0,0 +1,7 @@
{
"replace": false,
"values": [
"computercraft:wired_modem",
"computercraft:wired_modem_full"
]
}

View File

@ -23,5 +23,6 @@ public static void gather( GatherDataEvent event )
DataGenerator generator = event.getGenerator();
generator.addProvider( new Recipes( generator ) );
generator.addProvider( new LootTables( generator ) );
generator.addProvider( new Tags( generator ) );
}
}

View File

@ -7,6 +7,7 @@
package dan200.computercraft.data;
import dan200.computercraft.ComputerCraft;
import dan200.computercraft.data.Tags.CCTags;
import dan200.computercraft.shared.TurtleUpgrades;
import dan200.computercraft.shared.computer.core.ComputerFamily;
import dan200.computercraft.shared.pocket.items.PocketComputerItemFactory;
@ -15,11 +16,12 @@
import dan200.computercraft.shared.util.ImpostorRecipe;
import dan200.computercraft.shared.util.ImpostorShapelessRecipe;
import net.minecraft.advancements.criterion.InventoryChangeTrigger;
import net.minecraft.advancements.criterion.ItemPredicate;
import net.minecraft.block.Blocks;
import net.minecraft.data.*;
import net.minecraft.item.DyeColor;
import net.minecraft.item.DyeItem;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.item.*;
import net.minecraft.tags.Tag;
import net.minecraft.util.IItemProvider;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.Tags;
@ -37,6 +39,7 @@ public Recipes( DataGenerator generator )
@Override
protected void registerRecipes( @Nonnull Consumer<IFinishedRecipe> add )
{
basicRecipes( add );
diskColours( add );
pocketUpgrades( add );
turtleUpgrades( add );
@ -57,7 +60,7 @@ private void diskColours( @Nonnull Consumer<IFinishedRecipe> add )
.addIngredient( Items.PAPER )
.addIngredient( DyeItem.getItem( ofColour( colour ) ) )
.setGroup( "computercraft:disk" )
.addCriterion( "has_drive", InventoryChangeTrigger.Instance.forItems( ComputerCraft.Blocks.diskDrive ) )
.addCriterion( "has_drive", inventoryChange( ComputerCraft.Blocks.diskDrive ) )
.build( RecipeWrapper.wrap(
ImpostorShapelessRecipe.SERIALIZER, add,
x -> x.putInt( "color", colour.getHex() )
@ -88,7 +91,7 @@ private void turtleUpgrades( @Nonnull Consumer<IFinishedRecipe> add )
.key( '#', base.getItem() )
.key( 'T', upgrade.getCraftingItem().getItem() )
.addCriterion( "has_items",
InventoryChangeTrigger.Instance.forItems( base.getItem(), upgrade.getCraftingItem().getItem() ) )
inventoryChange( base.getItem(), upgrade.getCraftingItem().getItem() ) )
.build(
RecipeWrapper.wrap( ImpostorRecipe.SERIALIZER, add, result.getTag() ),
new ResourceLocation( ComputerCraft.MOD_ID, String.format( "turtle_%s/%s/%s",
@ -123,7 +126,7 @@ private void pocketUpgrades( @Nonnull Consumer<IFinishedRecipe> add )
.key( '#', base.getItem() )
.key( 'P', upgrade.getCraftingItem().getItem() )
.addCriterion( "has_items",
InventoryChangeTrigger.Instance.forItems( base.getItem(), upgrade.getCraftingItem().getItem() ) )
inventoryChange( base.getItem(), upgrade.getCraftingItem().getItem() ) )
.build(
RecipeWrapper.wrap( ImpostorRecipe.SERIALIZER, add, result.getTag() ),
new ResourceLocation( ComputerCraft.MOD_ID, String.format( "pocket_%s/%s/%s",
@ -134,8 +137,184 @@ private void pocketUpgrades( @Nonnull Consumer<IFinishedRecipe> add )
}
}
private void basicRecipes( @Nonnull Consumer<IFinishedRecipe> add )
{
ShapedRecipeBuilder
.shapedRecipe( ComputerCraft.Items.cable, 6 )
.patternLine( " # " )
.patternLine( "#R#" )
.patternLine( " # " )
.key( '#', Tags.Items.STONE )
.key( 'R', Tags.Items.DUSTS_REDSTONE )
.addCriterion( "has_computer", inventoryChange( CCTags.COMPUTER ) )
.addCriterion( "has_modem", inventoryChange( CCTags.COMPUTER ) )
.build( add );
ShapedRecipeBuilder
.shapedRecipe( ComputerCraft.Blocks.computerNormal )
.patternLine( "###" )
.patternLine( "#R#" )
.patternLine( "#G#" )
.key( '#', Tags.Items.STONE )
.key( 'R', Tags.Items.DUSTS_REDSTONE )
.key( 'G', Tags.Items.GLASS_PANES )
.addCriterion( "has_redstone", inventoryChange( Tags.Items.DUSTS_REDSTONE ) )
.build( add );
ShapedRecipeBuilder
.shapedRecipe( ComputerCraft.Blocks.computerAdvanced )
.patternLine( "###" )
.patternLine( "#R#" )
.patternLine( "#G#" )
.key( '#', Tags.Items.INGOTS_GOLD )
.key( 'R', Tags.Items.DUSTS_REDSTONE )
.key( 'G', Tags.Items.GLASS_PANES )
.addCriterion( "has_components", inventoryChange( Items.REDSTONE, Items.GOLD_INGOT ) )
.build( add );
ShapedRecipeBuilder
.shapedRecipe( ComputerCraft.Blocks.computerCommand )
.patternLine( "###" )
.patternLine( "#R#" )
.patternLine( "#G#" )
.key( '#', Tags.Items.INGOTS_GOLD )
.key( 'R', Blocks.COMMAND_BLOCK )
.key( 'G', Tags.Items.GLASS_PANES )
.addCriterion( "has_components", inventoryChange( Blocks.COMMAND_BLOCK ) )
.build( add );
ShapedRecipeBuilder
.shapedRecipe( ComputerCraft.Blocks.diskDrive )
.patternLine( "###" )
.patternLine( "#R#" )
.patternLine( "#R#" )
.key( '#', Tags.Items.STONE )
.key( 'R', Tags.Items.DUSTS_REDSTONE )
.addCriterion( "has_computer", inventoryChange( CCTags.COMPUTER ) )
.build( add );
ShapedRecipeBuilder
.shapedRecipe( ComputerCraft.Blocks.monitorNormal )
.patternLine( "###" )
.patternLine( "#G#" )
.patternLine( "###" )
.key( '#', Tags.Items.STONE )
.key( 'G', Tags.Items.GLASS_PANES )
.addCriterion( "has_computer", inventoryChange( CCTags.COMPUTER ) )
.build( add );
ShapedRecipeBuilder
.shapedRecipe( ComputerCraft.Blocks.monitorAdvanced, 4 )
.patternLine( "###" )
.patternLine( "#G#" )
.patternLine( "###" )
.key( '#', Tags.Items.INGOTS_GOLD )
.key( 'G', Tags.Items.GLASS_PANES )
.addCriterion( "has_computer", inventoryChange( CCTags.COMPUTER ) )
.build( add );
ShapedRecipeBuilder
.shapedRecipe( ComputerCraft.Items.pocketComputerNormal )
.patternLine( "###" )
.patternLine( "#A#" )
.patternLine( "#G#" )
.key( '#', Tags.Items.STONE )
.key( 'A', Items.GOLDEN_APPLE )
.key( 'G', Tags.Items.GLASS_PANES )
.addCriterion( "has_computer", inventoryChange( CCTags.COMPUTER ) )
.addCriterion( "has_apple", inventoryChange( Items.GOLDEN_APPLE ) )
.build( add );
ShapedRecipeBuilder
.shapedRecipe( ComputerCraft.Items.pocketComputerAdvanced )
.patternLine( "###" )
.patternLine( "#A#" )
.patternLine( "#G#" )
.key( '#', Tags.Items.INGOTS_GOLD )
.key( 'A', Items.GOLDEN_APPLE )
.key( 'G', Tags.Items.GLASS_PANES )
.addCriterion( "has_computer", inventoryChange( CCTags.COMPUTER ) )
.addCriterion( "has_apple", inventoryChange( Items.GOLDEN_APPLE ) )
.build( add );
ShapedRecipeBuilder
.shapedRecipe( ComputerCraft.Blocks.printer )
.patternLine( "###" )
.patternLine( "#R#" )
.patternLine( "#D#" )
.key( '#', Tags.Items.STONE )
.key( 'R', Tags.Items.DUSTS_REDSTONE )
.key( 'D', Tags.Items.DYES )
.addCriterion( "has_computer", inventoryChange( CCTags.COMPUTER ) )
.build( add );
ShapedRecipeBuilder
.shapedRecipe( ComputerCraft.Blocks.speaker )
.patternLine( "###" )
.patternLine( "#N#" )
.patternLine( "#R#" )
.key( '#', Tags.Items.STONE )
.key( 'N', Blocks.NOTE_BLOCK )
.key( 'R', Tags.Items.DUSTS_REDSTONE )
.addCriterion( "has_computer", inventoryChange( CCTags.COMPUTER ) )
.build( add );
ShapedRecipeBuilder
.shapedRecipe( ComputerCraft.Items.wiredModem )
.patternLine( "###" )
.patternLine( "#R#" )
.patternLine( "###" )
.key( '#', Tags.Items.STONE )
.key( 'R', Tags.Items.DUSTS_REDSTONE )
.addCriterion( "has_computer", inventoryChange( CCTags.COMPUTER ) )
.addCriterion( "has_cable", inventoryChange( ComputerCraft.Items.cable ) )
.build( add );
ShapelessRecipeBuilder
.shapelessRecipe( ComputerCraft.Blocks.wiredModemFull )
.addIngredient( ComputerCraft.Items.wiredModem )
.addCriterion( "has_modem", inventoryChange( CCTags.WIRED_MODEM ) )
.build( add, new ResourceLocation( ComputerCraft.MOD_ID, "wired_modem_full_from" ) );
ShapelessRecipeBuilder
.shapelessRecipe( ComputerCraft.Items.wiredModem )
.addIngredient( ComputerCraft.Blocks.wiredModemFull )
.addCriterion( "has_modem", inventoryChange( CCTags.WIRED_MODEM ) )
.build( add, new ResourceLocation( ComputerCraft.MOD_ID, "wired_modem_full_to" ) );
ShapedRecipeBuilder
.shapedRecipe( ComputerCraft.Blocks.wirelessModemNormal )
.patternLine( "###" )
.patternLine( "#E#" )
.patternLine( "###" )
.key( '#', Tags.Items.STONE )
.key( 'E', Tags.Items.ENDER_PEARLS )
.addCriterion( "has_computer", inventoryChange( CCTags.COMPUTER ) )
.build( add );
ShapedRecipeBuilder
.shapedRecipe( ComputerCraft.Blocks.wirelessModemAdvanced )
.patternLine( "###" )
.patternLine( "#E#" )
.patternLine( "###" )
.key( '#', Tags.Items.INGOTS_GOLD )
.key( 'E', Items.ENDER_EYE )
.addCriterion( "has_computer", inventoryChange( CCTags.COMPUTER ) )
.addCriterion( "has_wireless", inventoryChange( ComputerCraft.Blocks.wirelessModemNormal ) )
.build( add );
}
private static DyeColor ofColour( Colour colour )
{
return DyeColor.byId( 15 - colour.ordinal() );
}
private static InventoryChangeTrigger.Instance inventoryChange( Tag<Item> stack )
{
return InventoryChangeTrigger.Instance.forItems( ItemPredicate.Builder.create().tag( stack ).build() );
}
private static InventoryChangeTrigger.Instance inventoryChange( IItemProvider... stack )
{
return InventoryChangeTrigger.Instance.forItems( stack );
}
}

View File

@ -0,0 +1,52 @@
/*
* This file is part of ComputerCraft - http://www.computercraft.info
* Copyright Daniel Ratcliffe, 2011-2020. Do not distribute without permission.
* Send enquiries to dratcliffe@gmail.com
*/
package dan200.computercraft.data;
import dan200.computercraft.ComputerCraft;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.ItemTagsProvider;
import net.minecraft.item.Item;
import net.minecraft.tags.ItemTags;
import net.minecraft.tags.Tag;
import net.minecraft.util.ResourceLocation;
import static dan200.computercraft.data.Tags.CCTags.*;
public class Tags extends ItemTagsProvider
{
public static class CCTags
{
public static final Tag<Item> COMPUTER = item( "computer" );
public static final Tag<Item> TURTLE = item( "turtle" );
public static final Tag<Item> WIRED_MODEM = item( "wired_modem" );
public static final Tag<Item> MONITOR = item( "monitor" );
}
public Tags( DataGenerator generator )
{
super( generator );
}
@Override
protected void registerTags()
{
getBuilder( COMPUTER )
.add( ComputerCraft.Items.computerNormal )
.add( ComputerCraft.Items.computerAdvanced )
.add( ComputerCraft.Items.computerCommand );
getBuilder( TURTLE ).add( ComputerCraft.Items.turtleNormal, ComputerCraft.Items.turtleAdvanced );
getBuilder( WIRED_MODEM ).add( ComputerCraft.Items.wiredModem, ComputerCraft.Blocks.wiredModemFull.asItem() );
getBuilder( MONITOR )
.add( ComputerCraft.Blocks.monitorNormal.asItem() )
.add( ComputerCraft.Blocks.monitorAdvanced.asItem() );
}
private static Tag<Item> item( String name )
{
return new ItemTags.Wrapper( new ResourceLocation( ComputerCraft.MOD_ID, name ) );
}
}

View File

@ -1,38 +0,0 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [ "computercraft:cable" ]
},
"criteria": {
"has_normal": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [ { "item": "computercraft:computer_normal" } ]
}
},
"has_advanced": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [ { "item": "computercraft:computer_advanced" } ]
}
},
"has_modem": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [ { "item": "computercraft:cable" } ]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": { "recipe": "computercraft:cable" }
}
},
"requirements": [
[
"has_normal",
"has_advanced",
"has_modem",
"has_the_recipe"
]
]
}

View File

@ -1,24 +0,0 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [ "computercraft:command_computer" ]
},
"criteria": {
"has_redstone": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [ { "item": "minecraft:command_block" } ]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": { "recipe": "computercraft:command_computer" }
}
},
"requirements": [
[
"has_redstone",
"has_the_recipe"
]
]
}

View File

@ -1,24 +0,0 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [ "computercraft:advanced_computer" ]
},
"criteria": {
"has_redstone": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [ { "tag": "forge:dusts/redstone" } ]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": { "recipe": "computercraft:advanced_computer" }
}
},
"requirements": [
[
"has_redstone",
"has_the_recipe"
]
]
}

View File

@ -1,24 +0,0 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [ "computercraft:normal_computer" ]
},
"criteria": {
"has_redstone": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [ { "tag": "forge:dusts/redstone" } ]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": { "recipe": "computercraft:normal_computer" }
}
},
"requirements": [
[
"has_redstone",
"has_the_recipe"
]
]
}

View File

@ -1,31 +0,0 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [ "computercraft:disk_drive" ]
},
"criteria": {
"has_normal": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [ { "item": "computercraft:computer_normal" } ]
}
},
"has_advanced": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [ { "item": "computercraft:computer_advanced" } ]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": { "recipe": "computercraft:disk_drive" }
}
},
"requirements": [
[
"has_normal",
"has_advanced",
"has_the_recipe"
]
]
}

View File

@ -1,31 +0,0 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [ "computercraft:monitor_advanced" ]
},
"criteria": {
"has_normal": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [ { "item": "computercraft:computer_normal" } ]
}
},
"has_advanced": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [ { "item": "computercraft:computer_advanced" } ]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": { "recipe": "computercraft:monitor_advanced" }
}
},
"requirements": [
[
"has_normal",
"has_advanced",
"has_the_recipe"
]
]
}

View File

@ -1,31 +0,0 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [ "computercraft:normal_monitor" ]
},
"criteria": {
"has_normal": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [ { "item": "computercraft:computer_normal" } ]
}
},
"has_advanced": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [ { "item": "computercraft:computer_advanced" } ]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": { "recipe": "computercraft:normal_monitor" }
}
},
"requirements": [
[
"has_normal",
"has_advanced",
"has_the_recipe"
]
]
}

View File

@ -1,38 +0,0 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [ "computercraft:pocket_computer_advanced" ]
},
"criteria": {
"has_normal": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [ { "item": "computercraft:computer_normal" } ]
}
},
"has_advanced": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [ { "item": "computercraft:computer_advanced" } ]
}
},
"has_apple": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [ { "item": "minecraft:golden_apple" } ]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": { "recipe": "computercraft:pocket_computer_advanced" }
}
},
"requirements": [
[
"has_normal",
"has_advanced",
"has_apple",
"has_the_recipe"
]
]
}

View File

@ -1,38 +0,0 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [ "computercraft:normal_pocket_computer_normal" ]
},
"criteria": {
"has_normal": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [ { "item": "computercraft:computer_normal" } ]
}
},
"has_advanced": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [ { "item": "computercraft:computer_advanced" } ]
}
},
"has_apple": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [ { "item": "minecraft:golden_apple" } ]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": { "recipe": "computercraft:pocket_computer_normal" }
}
},
"requirements": [
[
"has_normal",
"has_advanced",
"has_apple",
"has_the_recipe"
]
]
}

View File

@ -1,31 +0,0 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [ "computercraft:printer" ]
},
"criteria": {
"has_normal": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [ { "item": "computercraft:computer_normal" } ]
}
},
"has_advanced": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [ { "item": "computercraft:computer_advanced" } ]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": { "recipe": "computercraft:printer" }
}
},
"requirements": [
[
"has_normal",
"has_advanced",
"has_the_recipe"
]
]
}

View File

@ -1,38 +0,0 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [ "computercraft:speaker" ]
},
"criteria": {
"has_normal": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [ { "item": "computercraft:computer_normal" } ]
}
},
"has_advanced": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [ { "item": "computercraft:computer_advanced" } ]
}
},
"has_noteblock": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [ { "item": "minecraft:note_block" } ]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": { "recipe": "computercraft:speaker" }
}
},
"requirements": [
[
"has_normal",
"has_advanced",
"has_noteblock",
"has_the_recipe"
]
]
}

View File

@ -1,38 +0,0 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [ "computercraft:wireless_modem_advanced" ]
},
"criteria": {
"has_normal": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [ { "item": "computercraft:computer_normal" } ]
}
},
"has_advanced": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [ { "item": "computercraft:computer_advanced" } ]
}
},
"has_wireless": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [ { "item": "computercraft:wireless_modem_normal" } ]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": { "recipe": "computercraft:wireless_modem_advanced" }
}
},
"requirements": [
[
"has_normal",
"has_advanced",
"has_wireless",
"has_the_recipe"
]
]
}

View File

@ -1,31 +0,0 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [ "computercraft:wireless_modem_normal" ]
},
"criteria": {
"has_normal": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [ { "item": "computercraft:computer_normal" } ]
}
},
"has_advanced": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [ { "item": "computercraft:computer_advanced" } ]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": { "recipe": "computercraft:wireless_modem_normal" }
}
},
"requirements": [
[
"has_normal",
"has_advanced",
"has_the_recipe"
]
]
}

View File

@ -1,13 +0,0 @@
{
"type": "crafting_shaped",
"pattern": [
" # ",
"#R#",
" # "
],
"key": {
"#": { "tag": "forge:stone" },
"R": { "tag": "forge:dusts/redstone" }
},
"result": { "item": "computercraft:cable", "count": 6 }
}

View File

@ -1,14 +0,0 @@
{
"type": "crafting_shaped",
"pattern": [
"###",
"#R#",
"#G#"
],
"key": {
"#": { "tag": "forge:ingots/gold" },
"R": { "tag": "forge:dusts/redstone" },
"G": { "item": "minecraft:glass_pane" }
},
"result": { "item": "computercraft:computer_advanced" }
}

View File

@ -1,14 +0,0 @@
{
"type": "crafting_shaped",
"pattern": [
"###",
"#R#",
"#G#"
],
"key": {
"#": { "tag": "forge:stone" },
"R": { "item": "minecraft:command_block" },
"G": { "item": "minecraft:glass_pane" }
},
"result": { "item": "computercraft:computer_command" }
}

View File

@ -1,14 +0,0 @@
{
"type": "crafting_shaped",
"pattern": [
"###",
"#R#",
"#G#"
],
"key": {
"#": { "tag": "forge:stone" },
"R": { "tag": "forge:dusts/redstone" },
"G": { "item": "minecraft:glass_pane" }
},
"result": { "item": "computercraft:computer_normal" }
}

View File

@ -1,13 +0,0 @@
{
"type": "crafting_shaped",
"pattern": [
"###",
"#R#",
"#R#"
],
"key": {
"#": { "tag": "forge:stone" },
"R": { "tag": "forge:dusts/redstone" }
},
"result": { "item": "computercraft:disk_drive" }
}

View File

@ -1,13 +0,0 @@
{
"type": "crafting_shaped",
"pattern": [
"###",
"#G#",
"###"
],
"key": {
"#": { "tag": "forge:ingots/gold" },
"G": { "item": "minecraft:glass_pane" }
},
"result": { "item": "computercraft:monitor_advanced", "count": 4 }
}

View File

@ -1,13 +0,0 @@
{
"type": "crafting_shaped",
"pattern": [
"###",
"#G#",
"###"
],
"key": {
"#": { "tag": "forge:stone" },
"G": { "item": "minecraft:glass_pane" }
},
"result": { "item": "computercraft:monitor_normal" }
}

View File

@ -1,14 +0,0 @@
{
"type": "crafting_shaped",
"pattern": [
"###",
"#A#",
"#G#"
],
"key": {
"#": { "tag": "forge:ingots/gold" },
"G": { "item": "minecraft:glass_pane" },
"A": { "item": "minecraft:golden_apple" }
},
"result": { "item": "computercraft:pocket_computer_advanced" }
}

View File

@ -1,14 +0,0 @@
{
"type": "crafting_shaped",
"pattern": [
"###",
"#A#",
"#G#"
],
"key": {
"#": { "tag": "forge:stone" },
"G": { "item": "minecraft:glass_pane" },
"A": { "item": "minecraft:golden_apple" }
},
"result": { "item": "computercraft:pocket_computer_normal" }
}

View File

@ -1,14 +0,0 @@
{
"type": "crafting_shaped",
"pattern": [
"###",
"#R#",
"#D#"
],
"key": {
"#": { "tag": "forge:stone" },
"R": { "item": "minecraft:glass_pane" },
"D": { "tag": "forge:dyes" }
},
"result": { "item": "computercraft:printer" }
}

View File

@ -1,14 +0,0 @@
{
"type": "crafting_shaped",
"pattern": [
"###",
"#N#",
"#R#"
],
"key": {
"#": { "tag": "forge:stone" },
"R": { "tag": "forge:dusts/redstone" },
"N": { "item": "minecraft:note_block" }
},
"result": { "item": "computercraft:speaker" }
}

View File

@ -1,13 +0,0 @@
{
"type": "crafting_shaped",
"pattern": [
"###",
"#R#",
"###"
],
"key": {
"#": { "tag": "forge:stone" },
"R": { "tag": "forge:dusts/redstone" }
},
"result": { "item": "computercraft:wired_modem" }
}

View File

@ -1,7 +0,0 @@
{
"type": "crafting_shapeless",
"ingredients": [
{ "item": "computercraft:wired_modem_full" }
],
"result": { "item": "computercraft:wired_modem" }
}

View File

@ -1,7 +0,0 @@
{
"type": "crafting_shapeless",
"ingredients": [
{ "item": "computercraft:wired_modem" }
],
"result": { "item": "computercraft:wired_modem_full" }
}

View File

@ -1,13 +0,0 @@
{
"type": "crafting_shaped",
"pattern": [
"###",
"#E#",
"###"
],
"key": {
"#": { "tag": "forge:ingots/gold" },
"E": { "item": "minecraft:ender_eye" }
},
"result": { "item": "computercraft:wireless_modem_advanced" }
}

View File

@ -1,13 +0,0 @@
{
"type": "crafting_shaped",
"pattern": [
"###",
"#E#",
"###"
],
"key": {
"#": { "tag": "forge:stone" },
"E": { "item": "minecraft:ender_pearl" }
},
"result": { "item": "computercraft:wireless_modem_normal" }
}