Kicked out a bunch of purely intermediate crafting items.

This commit is contained in:
Florian Nücke
2021-04-05 01:07:24 +02:00
parent 215a983f8c
commit 6ff3d844f2
69 changed files with 1011 additions and 775 deletions

View File

@@ -51,12 +51,8 @@ public final class Constants {
public static final String INVENTORY_OPERATIONS_MODULE_ITEM_NAME = "inventory_operations_module";
public static final String BLOCK_OPERATIONS_MODULE_ITEM_NAME = "block_operations_module";
public static final String CONTROL_UNIT_ITEM_NAME = "control_unit";
public static final String ARITHMETIC_LOGIC_UNIT_ITEM_NAME = "arithmetic_logic_unit";
public static final String MICROCHIP_ITEM_NAME = "microchip";
public static final String DISK_PLATTER_ITEM_NAME = "disk_platter";
public static final String TRANSISTOR_ITEM_NAME = "transistor";
public static final String PCB_ITEM_NAME = "pcb";
public static final String CIRCUIT_BOARD_ITEM_NAME = "circuit_board";
///////////////////////////////////////////////////////////////////

View File

@@ -10,7 +10,7 @@ import li.cil.oc2.common.bus.device.data.Firmwares;
import li.cil.oc2.common.bus.device.provider.Providers;
import li.cil.oc2.common.container.Containers;
import li.cil.oc2.common.entity.Entities;
import li.cil.oc2.common.customrecipes.CustomRecipes;
import li.cil.oc2.common.item.crafting.RecipeSerializers;
import li.cil.oc2.common.item.Items;
import li.cil.oc2.common.serialization.serializers.Serializers;
import li.cil.oc2.common.tags.BlockTags;
@@ -21,7 +21,6 @@ import li.cil.sedna.Sedna;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
@Mod(API.MOD_ID)
@@ -40,13 +39,13 @@ public final class Main {
TileEntities.initialize();
Entities.initialize();
Containers.initialize();
RecipeSerializers.initialize();
SoundEvents.initialize();
Providers.initialize();
DeviceTypes.initialize();
BlockDeviceDataRegistration.initialize();
Firmwares.initialize();
CustomRecipes.initialize();
FMLJavaModLoadingContext.get().getModEventBus().register(CommonSetup.class);
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> FMLJavaModLoadingContext.get().getModEventBus().register(ClientSetup.class));

View File

@@ -1,20 +0,0 @@
package li.cil.oc2.common.customrecipes;
import li.cil.oc2.api.API;
import net.minecraft.item.crafting.IRecipeSerializer;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
public final class CustomRecipes {
private static final DeferredRegister<IRecipeSerializer<?>> INITIALIZER = DeferredRegister.create(ForgeRegistries.RECIPE_SERIALIZERS, API.MOD_ID);
public static final RegistryObject<HDDRecipe.Serializer> HDD_RECIPE = INITIALIZER.register("hard_drive", HDDRecipe.Serializer::new);
public static final RegistryObject<MemoryRecipe.Serializer> MEMORY_RECIPE = INITIALIZER.register("memory", MemoryRecipe.Serializer::new);
public static final RegistryObject<LinuxFlashRecipe.Serializer> FLASH_MEMORY_LINUX_RECIPE = INITIALIZER.register("flash_memory_linux", LinuxFlashRecipe.Serializer::new);
public static void initialize() {
INITIALIZER.register(FMLJavaModLoadingContext.get().getModEventBus());
}
}

View File

@@ -1,109 +0,0 @@
package li.cil.oc2.common.customrecipes;
import com.google.gson.JsonObject;
import li.cil.oc2.common.Constants;
import li.cil.oc2.common.item.HardDriveItem;
import li.cil.oc2.common.item.Items;
import net.minecraft.inventory.CraftingInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.*;
import net.minecraft.network.PacketBuffer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.ForgeRegistryEntry;
import org.jetbrains.annotations.NotNull;
public class HDDRecipe implements ICraftingRecipe {
private static final RegistryObject<Item> regObject = RegistryObject.of(new ResourceLocation("oc2:hard_drive"), ForgeRegistries.ITEMS);
private final ResourceLocation id;
public HDDRecipe(ResourceLocation idIn) {
id = idIn;
}
@Override
public @NotNull ResourceLocation getId() {
return id;
}
@Override
public @NotNull ItemStack getRecipeOutput() {
return new ItemStack(regObject.get());
}
@Override
public boolean matches(@NotNull CraftingInventory inv, @NotNull World worldIn) {
return craftingTemplateForTiers(inv) && creatingTiers(inv) != -1;
}
@Override
public @NotNull ItemStack getCraftingResult(@NotNull CraftingInventory inv) {
boolean checkTemplate = craftingTemplateForTiers(inv);
if (!checkTemplate) return ItemStack.EMPTY;
int tier = creatingTiers(inv);
return (tier != -1) ? HardDriveItem.withCapacity(((int) Math.pow(2, tier)) * Constants.MEGABYTE) : ItemStack.EMPTY;
}
@Override
public boolean canFit(int width, int height) {
return width * height >= 9;
}
@Override
public @NotNull IRecipeSerializer<?> getSerializer() {
return CustomRecipes.HDD_RECIPE.get();
}
public static class Serializer extends ForgeRegistryEntry<IRecipeSerializer<?>> implements IRecipeSerializer<HDDRecipe> {
@Override
public @NotNull HDDRecipe read(@NotNull ResourceLocation recipeId, @NotNull JsonObject json) {
return new HDDRecipe(recipeId);
}
@Override
public HDDRecipe read(@NotNull ResourceLocation recipeId, @NotNull PacketBuffer buffer) {
return new HDDRecipe(recipeId);
}
@Override
public void write(@NotNull PacketBuffer buffer, @NotNull HDDRecipe recipe) {
}
}
private int creatingTiers(CraftingInventory inv) {
Item iron = net.minecraft.item.Items.IRON_INGOT;
Item gold = net.minecraft.item.Items.GOLD_INGOT;
Item diamond = net.minecraft.item.Items.DIAMOND;
Item first = inv.getStackInSlot(2).getItem();
Item second = inv.getStackInSlot(8).getItem();
boolean ironTemplate = first.equals(iron) && second.equals(iron);
boolean goldTemplate = first.equals(gold) && second.equals(gold);
boolean diamondTemplate = first.equals(diamond) && second.equals(diamond);
if (ironTemplate) return 1;
else if (goldTemplate) return 2;
else if (diamondTemplate) return 3;
else return -1;
}
private boolean craftingTemplateForTiers(CraftingInventory inv) {
Item slot5 = inv.getStackInSlot(5).getItem();
return inv.getStackInSlot(0).getItem().equals(Items.MICROCHIP_ITEM.get())
&& inv.getStackInSlot(1).getItem().equals(Items.DISK_PLATTER_ITEM.get())
&& inv.getStackInSlot(3).getItem().equals(Items.PCB_ITEM.get())
&& inv.getStackInSlot(4).getItem().equals(Items.DISK_PLATTER_ITEM.get())
&& (slot5.equals(net.minecraft.item.Items.PISTON) || slot5.equals(net.minecraft.item.Items.STICKY_PISTON))
&& inv.getStackInSlot(6).getItem().equals(Items.MICROCHIP_ITEM.get())
&& inv.getStackInSlot(7).getItem().equals(Items.DISK_PLATTER_ITEM.get());
}
}

View File

@@ -1,94 +0,0 @@
package li.cil.oc2.common.customrecipes;
import com.google.gson.JsonObject;
import li.cil.oc2.api.bus.device.data.Firmware;
import li.cil.oc2.common.Constants;
import li.cil.oc2.common.bus.device.data.Firmwares;
import li.cil.oc2.common.item.FlashMemoryItem;
import li.cil.oc2.common.item.Items;
import li.cil.oc2.common.item.MemoryItem;
import net.minecraft.inventory.CraftingInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.ICraftingRecipe;
import net.minecraft.item.crafting.IRecipeSerializer;
import net.minecraft.network.PacketBuffer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.ForgeRegistryEntry;
import org.jetbrains.annotations.NotNull;
import java.util.Arrays;
public class LinuxFlashRecipe implements ICraftingRecipe {
private static final RegistryObject<Item> regObject = RegistryObject.of(new ResourceLocation("oc2:flash_memory"), ForgeRegistries.ITEMS);
private final ResourceLocation id;
public LinuxFlashRecipe(ResourceLocation idIn) {
id = idIn;
}
@Override
public @NotNull ResourceLocation getId() {
return id;
}
@Override
public @NotNull ItemStack getRecipeOutput() {
return new ItemStack(regObject.get());
}
@Override
public boolean matches(@NotNull CraftingInventory inv, @NotNull World worldIn) {
return isValid(inv);
}
@Override
public @NotNull ItemStack getCraftingResult(@NotNull CraftingInventory inv) {
return (isValid(inv)) ? FlashMemoryItem.withFirmware(Firmwares.BUILDROOT.get()) : ItemStack.EMPTY;
}
@Override
public boolean canFit(int width, int height) {
return width * height >= 4;
}
@Override
public @NotNull IRecipeSerializer<?> getSerializer() {
return CustomRecipes.FLASH_MEMORY_LINUX_RECIPE.get();
}
public static class Serializer extends ForgeRegistryEntry<IRecipeSerializer<?>> implements IRecipeSerializer<LinuxFlashRecipe> {
@Override
public @NotNull LinuxFlashRecipe read(@NotNull ResourceLocation recipeId, @NotNull JsonObject json) {
return new LinuxFlashRecipe(recipeId);
}
@Override
public LinuxFlashRecipe read(@NotNull ResourceLocation recipeId, @NotNull PacketBuffer buffer) {
return new LinuxFlashRecipe(recipeId);
}
@Override
public void write(@NotNull PacketBuffer buffer, @NotNull LinuxFlashRecipe recipe) {
}
}
private boolean isValid(CraftingInventory inv) {
ItemStack[] array = new ItemStack[8];
for (int i = 0; i < 8; i++) {
array[i] = inv.getStackInSlot(i);
}
boolean memoryCard = Arrays.stream(array).filter(x -> x.getItem().equals(Items.FLASH_MEMORY_ITEM.get())).count() == 1;
boolean wrenchItem = Arrays.stream(array).filter(x -> x.getItem().equals(Items.WRENCH_ITEM.get())).count() == 1;
boolean emptySlots = Arrays.stream(array).filter(ItemStack::isEmpty).count() == 6;
return memoryCard && wrenchItem && emptySlots;
}
}

View File

@@ -1,101 +0,0 @@
package li.cil.oc2.common.customrecipes;
import com.google.gson.JsonObject;
import li.cil.oc2.common.Constants;
import li.cil.oc2.common.item.Items;
import li.cil.oc2.common.item.MemoryItem;
import net.minecraft.inventory.CraftingInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.ICraftingRecipe;
import net.minecraft.item.crafting.IRecipeSerializer;
import net.minecraft.network.PacketBuffer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.ForgeRegistryEntry;
import org.jetbrains.annotations.NotNull;
public class MemoryRecipe implements ICraftingRecipe {
private static final RegistryObject<Item> regObject = RegistryObject.of(new ResourceLocation("oc2:memory"), ForgeRegistries.ITEMS);
private final ResourceLocation id;
public MemoryRecipe(ResourceLocation idIn) {
id = idIn;
}
@Override
public @NotNull ResourceLocation getId() {
return id;
}
@Override
public @NotNull ItemStack getRecipeOutput() {
return new ItemStack(regObject.get());
}
@Override
public boolean matches(@NotNull CraftingInventory inv, @NotNull World worldIn) {
int level = getLevelOfMemory(inv);
return level == 2 || level == 4 || level == 8;
}
@Override
public @NotNull ItemStack getCraftingResult(@NotNull CraftingInventory inv) {
int level = getLevelOfMemory(inv);
return (level == 2 || level == 4 || level == 8) ? MemoryItem.withCapacity(level * Constants.MEGABYTE) : ItemStack.EMPTY;
}
@Override
public boolean canFit(int width, int height) {
return width * height >= 4;
}
@Override
public @NotNull IRecipeSerializer<?> getSerializer() {
return CustomRecipes.MEMORY_RECIPE.get();
}
public static class Serializer extends ForgeRegistryEntry<IRecipeSerializer<?>> implements IRecipeSerializer<MemoryRecipe> {
@Override
public @NotNull MemoryRecipe read(@NotNull ResourceLocation recipeId, @NotNull JsonObject json) {
return new MemoryRecipe(recipeId);
}
@Override
public MemoryRecipe read(@NotNull ResourceLocation recipeId, @NotNull PacketBuffer buffer) {
return new MemoryRecipe(recipeId);
}
@Override
public void write(@NotNull PacketBuffer buffer, @NotNull MemoryRecipe recipe) {
}
}
private int getLevelOfMemory(CraftingInventory inv) {
if (!inv.getStackInSlot(0).getItem().equals(Items.PCB_ITEM.get())) return 0;
ItemStack[] array = new ItemStack[8];
for (int i = 0; i < 8; i++) {
array[i] = inv.getStackInSlot(i);
}
int value = 0;
for (int i = 1; i < 9; i++) {
if (array[0].getItem().equals(Items.MICROCHIP_ITEM.get())) {
value++;
}
}
int valueEmpty = 0;
for (int i = 1; i < 9; i++) {
if (array[0].isEmpty()) {
valueEmpty++;
}
}
return valueEmpty + value == 8 ? value : 0;
}
}

View File

@@ -45,12 +45,8 @@ public final class Items {
public static final RegistryObject<Item> INVENTORY_OPERATIONS_MODULE = register(Constants.INVENTORY_OPERATIONS_MODULE_ITEM_NAME);
public static final RegistryObject<Item> BLOCK_OPERATIONS_MODULE = register(Constants.BLOCK_OPERATIONS_MODULE_ITEM_NAME, BlockOperationsModule::new);
public static final RegistryObject<Item> CONTROL_UNIT_ITEM = register(Constants.CONTROL_UNIT_ITEM_NAME, Item::new);
public static final RegistryObject<Item> ARITHMETIC_LOGIC_UNIT_ITEM = register(Constants.ARITHMETIC_LOGIC_UNIT_ITEM_NAME, Item::new);
public static final RegistryObject<Item> MICROCHIP_ITEM = register(Constants.MICROCHIP_ITEM_NAME, Item::new);
public static final RegistryObject<Item> DISK_PLATTER_ITEM = register(Constants.DISK_PLATTER_ITEM_NAME, Item::new);
public static final RegistryObject<Item> TRANSISTOR_ITEM = register(Constants.TRANSISTOR_ITEM_NAME, Item::new);
public static final RegistryObject<Item> PCB_ITEM = register(Constants.PCB_ITEM_NAME, Item::new);
public static final RegistryObject<Item> TRANSISTOR = register(Constants.TRANSISTOR_ITEM_NAME, ModItem::new);
public static final RegistryObject<Item> CIRCUIT_BOARD = register(Constants.CIRCUIT_BOARD_ITEM_NAME, ModItem::new);
///////////////////////////////////////////////////////////////////

View File

@@ -0,0 +1,19 @@
package li.cil.oc2.common.item.crafting;
import li.cil.oc2.api.API;
import net.minecraft.item.crafting.IRecipeSerializer;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
public final class RecipeSerializers {
private static final DeferredRegister<IRecipeSerializer<?>> RECIPE_SERIALIZERS = DeferredRegister.create(ForgeRegistries.RECIPE_SERIALIZERS, API.MOD_ID);
public static final RegistryObject<ShapedNbtRecipe.Serializer> SHAPED = RECIPE_SERIALIZERS.register("shaped", ShapedNbtRecipe.Serializer::new);
public static final RegistryObject<ShapelessNbtRecipe.Serializer> SHAPELESS = RECIPE_SERIALIZERS.register("shapeless", ShapelessNbtRecipe.Serializer::new);
public static void initialize() {
RECIPE_SERIALIZERS.register(FMLJavaModLoadingContext.get().getModEventBus());
}
}

View File

@@ -0,0 +1,57 @@
package li.cil.oc2.common.item.crafting;
import com.google.gson.JsonObject;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipeSerializer;
import net.minecraft.item.crafting.ShapedRecipe;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.JsonToNBT;
import net.minecraft.network.PacketBuffer;
import net.minecraft.util.JSONUtils;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.registries.ForgeRegistryEntry;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.jetbrains.annotations.Nullable;
public final class ShapedNbtRecipe extends ShapedRecipe {
private static final Logger LOGGER = LogManager.getLogger();
public ShapedNbtRecipe(final ShapedRecipe recipe) {
this(recipe, recipe.getRecipeOutput());
}
public ShapedNbtRecipe(final ShapedRecipe recipe, final ItemStack output) {
super(recipe.getId(), recipe.getGroup(), recipe.getWidth(), recipe.getHeight(), recipe.getIngredients(), output);
}
public static class Serializer extends ForgeRegistryEntry<IRecipeSerializer<?>> implements IRecipeSerializer<ShapedNbtRecipe> {
@Override
public ShapedNbtRecipe read(final ResourceLocation location, final JsonObject json) {
final ShapedRecipe recipe = CRAFTING_SHAPED.read(location, json);
final ItemStack stack = recipe.getRecipeOutput();
if (json.has("nbt")) {
try {
final CompoundNBT recipeTag = JsonToNBT.getTagFromJson(
JSONUtils.getJsonObject(json, "nbt").toString());
stack.getOrCreateTag().merge(recipeTag);
} catch (final CommandSyntaxException e) {
LOGGER.error(e);
}
}
return new ShapedNbtRecipe(recipe, stack);
}
@Nullable
@Override
public ShapedNbtRecipe read(final ResourceLocation location, final PacketBuffer buffer) {
return new ShapedNbtRecipe(CRAFTING_SHAPED.read(location, buffer));
}
@Override
public void write(final PacketBuffer buffer, final ShapedNbtRecipe recipe) {
CRAFTING_SHAPED.write(buffer, recipe);
}
}
}

View File

@@ -0,0 +1,57 @@
package li.cil.oc2.common.item.crafting;
import com.google.gson.JsonObject;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipeSerializer;
import net.minecraft.item.crafting.ShapelessRecipe;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.JsonToNBT;
import net.minecraft.network.PacketBuffer;
import net.minecraft.util.JSONUtils;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.registries.ForgeRegistryEntry;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.jetbrains.annotations.Nullable;
public final class ShapelessNbtRecipe extends ShapelessRecipe {
private static final Logger LOGGER = LogManager.getLogger();
public ShapelessNbtRecipe(final ShapelessRecipe recipe) {
this(recipe, recipe.getRecipeOutput());
}
public ShapelessNbtRecipe(final ShapelessRecipe recipe, final ItemStack output) {
super(recipe.getId(), recipe.getGroup(), output, recipe.getIngredients());
}
public static class Serializer extends ForgeRegistryEntry<IRecipeSerializer<?>> implements IRecipeSerializer<ShapelessNbtRecipe> {
@Override
public ShapelessNbtRecipe read(final ResourceLocation location, final JsonObject json) {
final ShapelessRecipe recipe = CRAFTING_SHAPELESS.read(location, json);
final ItemStack stack = recipe.getRecipeOutput();
if (json.has("nbt")) {
try {
final CompoundNBT recipeTag = JsonToNBT.getTagFromJson(
JSONUtils.getJsonObject(json, "nbt").toString());
stack.getOrCreateTag().merge(recipeTag);
} catch (final CommandSyntaxException e) {
LOGGER.error(e);
}
}
return new ShapelessNbtRecipe(recipe, stack);
}
@Nullable
@Override
public ShapelessNbtRecipe read(final ResourceLocation location, final PacketBuffer buffer) {
return new ShapelessNbtRecipe(CRAFTING_SHAPELESS.read(location, buffer));
}
@Override
public void write(final PacketBuffer buffer, final ShapelessNbtRecipe recipe) {
CRAFTING_SHAPELESS.write(buffer, recipe);
}
}
}

View File

@@ -0,0 +1,7 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package li.cil.oc2.common.item.crafting;
import mcp.MethodsReturnNonnullByDefault;
import javax.annotation.ParametersAreNonnullByDefault;

View File

@@ -1,194 +0,0 @@
package li.cil.oc2.data;
import li.cil.oc2.common.item.Items;
import net.minecraft.advancements.criterion.InventoryChangeTrigger;
import net.minecraft.data.*;
import net.minecraft.item.Item;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.util.IItemProvider;
import net.minecraftforge.common.Tags;
import net.minecraftforge.fml.RegistryObject;
import java.util.function.Consumer;
public final class CraftingRecipes extends RecipeProvider {
public CraftingRecipes(final DataGenerator generatorIn) {
super(generatorIn);
}
@Override
protected void registerRecipes(final Consumer<IFinishedRecipe> consumer) {
ShapedRecipeBuilder
.shapedRecipe(Items.WRENCH_ITEM.get())
.patternLine("I I")
.patternLine(" C ")
.patternLine(" I ")
.key('I', net.minecraft.item.Items.IRON_INGOT)
.key('C', Items.MICROCHIP_ITEM.get())
.addCriterion("has_microchip", inventoryChange(Items.MICROCHIP_ITEM.get()))
.build(consumer);
ShapedRecipeBuilder
.shapedRecipe(Items.TRANSISTOR_ITEM.get(), 4)
.patternLine("III")
.patternLine("GPG")
.patternLine(" R ")
.key('I', net.minecraft.item.Items.IRON_INGOT)
.key('G', net.minecraft.item.Items.GOLD_NUGGET)
.key('R', net.minecraft.item.Items.REDSTONE)
.key('P', net.minecraft.item.Items.PAPER)
.addCriterion("has_iron", inventoryChange(net.minecraft.item.Items.GOLD_NUGGET))
.build(consumer);
createInterfaceCard(Items.REDSTONE_INTERFACE_CARD_ITEM, net.minecraft.item.Items.REDSTONE_TORCH, consumer);
createInterfaceCardBlock(Items.REDSTONE_INTERFACE_ITEM, Items.REDSTONE_INTERFACE_CARD_ITEM, consumer);
ShapelessRecipeBuilder
.shapelessRecipe(Items.PCB_ITEM.get())
.addIngredient(net.minecraft.item.Items.GOLD_NUGGET)
.addIngredient(Ingredient.fromItems(net.minecraft.item.Items.SLIME_BALL, net.minecraft.item.Items.HONEY_BOTTLE))
.addIngredient(Ingredient.fromItems(net.minecraft.item.Items.KELP, net.minecraft.item.Items.GREEN_DYE))
.addCriterion("has_iron", inventoryChange(net.minecraft.item.Items.GOLD_NUGGET))
.build(consumer);
createInterfaceCard(Items.NETWORK_INTERFACE_CARD_ITEM, Items.NETWORK_CABLE_ITEM.get(), consumer);
createInterfaceCardBlock(Items.NETWORK_HUB_ITEM, Items.NETWORK_INTERFACE_CARD_ITEM, consumer);
ShapedRecipeBuilder
.shapedRecipe(Items.NETWORK_CONNECTOR_ITEM.get(), 2)
.patternLine("NWN")
.patternLine("NWN")
.key('N', net.minecraft.item.Items.GOLD_NUGGET)
.key('W', Items.NETWORK_CABLE_ITEM.get())
.addCriterion("has_iron", inventoryChange(Items.NETWORK_CABLE_ITEM.get()))
.build(consumer);
ShapedRecipeBuilder
.shapedRecipe(Items.NETWORK_CABLE_ITEM.get(), 6)
.patternLine("SSS")
.patternLine("GGG")
.key('G', net.minecraft.item.Items.GOLD_NUGGET)
.key('S', net.minecraft.item.Items.STRING)
.addCriterion("has_iron", inventoryChange(net.minecraft.item.Items.GOLD_NUGGET))
.build(consumer);
ShapedRecipeBuilder
.shapedRecipe(Items.MICROCHIP_ITEM.get())
.patternLine("III")
.patternLine("RTR")
.patternLine("III")
.key('I', net.minecraft.item.Items.GOLD_NUGGET)
.key('T', Items.TRANSISTOR_ITEM.get())
.key('R', net.minecraft.item.Items.REDSTONE)
.addCriterion("has_iron", inventoryChange(net.minecraft.item.Items.IRON_INGOT))
.build(consumer);
// MEMORY
// HARD_DRIVE
// FLASH_MEMORY_LINUX
// FLASH_MEMORY
ShapedRecipeBuilder
.shapedRecipe(Items.DISK_PLATTER_ITEM.get(), 6)
.patternLine(" N ")
.patternLine("N N")
.patternLine(" N ")
.key('N', net.minecraft.item.Items.IRON_NUGGET)
.addCriterion("has_iron", inventoryChange(net.minecraft.item.Items.IRON_NUGGET))
.build(consumer);
ShapedRecipeBuilder
.shapedRecipe(Items.CONTROL_UNIT_ITEM.get())
.patternLine("IRI")
.patternLine("TCT")
.patternLine("ITI")
.key('I', net.minecraft.item.Items.GOLD_NUGGET)
.key('T', Items.TRANSISTOR_ITEM.get())
.key('C', net.minecraft.item.Items.CLOCK)
.key('R', net.minecraft.item.Items.REDSTONE)
.addCriterion("has_transistor", inventoryChange(Items.TRANSISTOR_ITEM.get()))
.build(consumer);
ShapedRecipeBuilder
.shapedRecipe(Items.COMPUTER_ITEM.get())
.patternLine("IMI")
.patternLine("BCB")
.patternLine("IPI")
.key('I', net.minecraft.item.Items.GOLD_NUGGET)
.key('C', Tags.Items.CHESTS_WOODEN)
.key('M', Items.MICROCHIP_ITEM.get())
.key('P', Items.PCB_ITEM.get())
.key('B', net.minecraft.item.Items.IRON_BARS)
.addCriterion("has_microchip", inventoryChange(Items.MICROCHIP_ITEM.get()))
.addCriterion("has_pcb", inventoryChange(Items.PCB_ITEM.get()))
.build(consumer);
ShapedRecipeBuilder
.shapedRecipe(Items.BUS_INTERFACE_ITEM.get())
.patternLine("N ")
.patternLine("NC ")
.patternLine("N ")
.key('N', net.minecraft.item.Items.GOLD_NUGGET)
.key('C', Items.BUS_CABLE_ITEM.get())
.addCriterion("has_bus_cable", inventoryChange(Items.BUS_CABLE_ITEM.get()))
.build(consumer);
ShapedRecipeBuilder
.shapedRecipe(Items.BUS_CABLE_ITEM.get(), 3)
.patternLine("NNN")
.patternLine("WWW")
.patternLine("NNN")
.key('N', net.minecraft.item.Items.GOLD_NUGGET)
.key('W', Items.NETWORK_CABLE_ITEM.get())
.addCriterion("has_network_cable", inventoryChange(Items.NETWORK_CABLE_ITEM.get()))
.build(consumer);
ShapedRecipeBuilder
.shapedRecipe(Items.ARITHMETIC_LOGIC_UNIT_ITEM.get())
.patternLine("IRI")
.patternLine("TNT")
.patternLine("ITI")
.key('I', net.minecraft.item.Items.IRON_NUGGET)
.key('T', Items.TRANSISTOR_ITEM.get())
.key('N', Items.MICROCHIP_ITEM.get())
.key('R', net.minecraft.item.Items.REDSTONE)
.addCriterion("has_microchip", inventoryChange(Items.MICROCHIP_ITEM.get()))
.addCriterion("has_transistor", inventoryChange(Items.TRANSISTOR_ITEM.get()))
.build(consumer);
}
private void createInterfaceCard(final RegistryObject<Item> result, final Item type, final Consumer<IFinishedRecipe> consumer) {
ShapedRecipeBuilder
.shapedRecipe(result.get())
.patternLine("POG")
.patternLine("PC ")
.patternLine("PI ")
.key('I', net.minecraft.item.Items.GOLD_NUGGET)
.key('P', net.minecraft.item.Items.IRON_NUGGET)
.key('C', Items.PCB_ITEM.get())
.key('O', Items.MICROCHIP_ITEM.get())
.key('G', type)
.addCriterion("has_pcb", inventoryChange(Items.PCB_ITEM.get()))
.addCriterion("has_microchip", inventoryChange(Items.MICROCHIP_ITEM.get()))
.build(consumer);
}
private void createInterfaceCardBlock(final RegistryObject<Item> result, final RegistryObject<Item> type, final Consumer<IFinishedRecipe> consumer) {
ShapedRecipeBuilder
.shapedRecipe(result.get())
.patternLine("GGG")
.patternLine("GCG")
.patternLine("GGG")
.key('G', net.minecraft.item.Items.GOLD_NUGGET)
.key('C', type.get())
.addCriterion("has_custom_card", inventoryChange(type.get()))
.build(consumer);
}
private static InventoryChangeTrigger.Instance inventoryChange(IItemProvider item) {
return InventoryChangeTrigger.Instance.forItems(item);
}
}

View File

@@ -21,7 +21,7 @@ public final class DataGenerators {
final BlockTagsProvider blockTagProvider = new ModBlockTagsProvider(generator, existingFileHelper);
generator.addProvider(blockTagProvider);
generator.addProvider(new ModItemTagsProvider(generator, blockTagProvider, existingFileHelper));
generator.addProvider(new CraftingRecipes(generator));
generator.addProvider(new ModRecipesProvider(generator));
}
}
}

View File

@@ -33,6 +33,7 @@ public class ModBlockStateProvider extends BlockStateProvider {
.transform(ModelBuilder.Perspective.FIXED)
.rotation(270, 0, 0)
.translation(0, 0, -5)
.scale(1, 1, 1)
.end()
.end();
horizontalBlock(Blocks.NETWORK_HUB, Items.NETWORK_HUB);
@@ -47,6 +48,7 @@ public class ModBlockStateProvider extends BlockStateProvider {
final ModelFile baseModel = models().getExistingFile(new ResourceLocation(API.MOD_ID, "block/cable_base"));
final ModelFile linkModel = models().getExistingFile(new ResourceLocation(API.MOD_ID, "block/cable_link"));
final ModelFile plugModel = models().getExistingFile(new ResourceLocation(API.MOD_ID, "block/cable_plug"));
final ModelFile straightModel = models().getExistingFile(new ResourceLocation(API.MOD_ID, "block/cable_straight"));
final MultiPartBlockStateBuilder builder = getMultipartBuilder(Blocks.BUS_CABLE.get());
@@ -88,7 +90,7 @@ public class ModBlockStateProvider extends BlockStateProvider {
});
itemModels().getBuilder(Items.BUS_CABLE.getId().getPath())
.parent(baseModel)
.parent(straightModel)
.transforms()
.transform(ModelBuilder.Perspective.GUI)
.rotation(30, 225, 0)

View File

@@ -43,6 +43,9 @@ public final class ModItemModelProvider extends ItemModelProvider {
simple(Items.INVENTORY_OPERATIONS_MODULE, "item/inventory_operations_module");
simple(Items.BLOCK_OPERATIONS_MODULE, "item/block_operations_module");
simple(Items.TRANSISTOR, "item/transistor");
simple(Items.CIRCUIT_BOARD, "item/circuit_board");
withExistingParent(Constants.ROBOT_ENTITY_NAME, "template_shulker_box");
}

View File

@@ -0,0 +1,198 @@
package li.cil.oc2.data;
import li.cil.oc2.common.item.Items;
import net.minecraft.advancements.criterion.InventoryChangeTrigger;
import net.minecraft.data.*;
import net.minecraft.tags.ItemTags;
import net.minecraft.util.IItemProvider;
import net.minecraftforge.common.Tags;
import java.util.function.Consumer;
public final class ModRecipesProvider extends RecipeProvider {
public ModRecipesProvider(final DataGenerator generatorIn) {
super(generatorIn);
}
@Override
protected void registerRecipes(final Consumer<IFinishedRecipe> consumer) {
ShapedRecipeBuilder
.shapedRecipe(Items.COMPUTER.get())
.patternLine("ICI")
.patternLine("XTX")
.patternLine("IBI")
.key('I', Tags.Items.INGOTS_IRON)
.key('C', Tags.Items.CHESTS_WOODEN)
.key('X', Items.BUS_INTERFACE.get())
.key('T', Items.TRANSISTOR.get())
.key('B', Items.CIRCUIT_BOARD.get())
.addCriterion("has_transistor", inventoryChange(Items.TRANSISTOR.get()))
.addCriterion("has_circuit_board", inventoryChange(Items.CIRCUIT_BOARD.get()))
.build(consumer);
ShapedRecipeBuilder
.shapedRecipe(Items.BUS_CABLE.get(), 16)
.patternLine("III")
.patternLine("GTG")
.patternLine("III")
.key('I', Tags.Items.INGOTS_IRON)
.key('G', Tags.Items.INGOTS_GOLD)
.key('T', Items.TRANSISTOR.get())
.addCriterion("has_gold", inventoryChange(net.minecraft.item.Items.GOLD_INGOT))
.build(consumer);
ShapelessRecipeBuilder
.shapelessRecipe(Items.BUS_INTERFACE.get())
.addIngredient(Items.TRANSISTOR.get())
.addIngredient(Items.BUS_CABLE.get())
.addCriterion("has_bus_cable", inventoryChange(Items.BUS_CABLE.get()))
.build(consumer);
ShapedRecipeBuilder
.shapedRecipe(Items.NETWORK_CONNECTOR.get(), 4)
.patternLine("IGI")
.patternLine("ITI")
.key('I', Tags.Items.INGOTS_IRON)
.key('G', Tags.Items.GLASS)
.key('T', Items.TRANSISTOR.get())
.addCriterion("has_transistor", inventoryChange(Items.TRANSISTOR.get()))
.build(consumer);
ShapedRecipeBuilder
.shapedRecipe(Items.NETWORK_HUB.get())
.patternLine("ICI")
.patternLine("XRX")
.patternLine("ICI")
.key('I', Tags.Items.INGOTS_IRON)
.key('C', Items.NETWORK_CONNECTOR.get())
.key('R', net.minecraft.item.Items.REPEATER)
.key('X', Items.BUS_INTERFACE.get())
.addCriterion("has_network_connector", inventoryChange(Items.NETWORK_CONNECTOR.get()))
.build(consumer);
ShapedRecipeBuilder
.shapedRecipe(Items.REDSTONE_INTERFACE.get())
.patternLine("IRI")
.patternLine("XTX")
.patternLine("IRI")
.key('I', Tags.Items.INGOTS_IRON)
.key('R', Tags.Items.DUSTS_REDSTONE)
.key('T', Items.TRANSISTOR.get())
.key('X', Items.BUS_INTERFACE.get())
.addCriterion("has_computer", inventoryChange(Items.COMPUTER.get()))
.build(consumer);
ShapedRecipeBuilder
.shapedRecipe(Items.DISK_DRIVE.get())
.patternLine("IBI")
.patternLine("XSX")
.patternLine("IDI")
.key('I', Tags.Items.INGOTS_IRON)
.key('B', ItemTags.BUTTONS)
.key('S', net.minecraft.item.Items.STICK)
.key('X', Items.BUS_INTERFACE.get())
.key('D', net.minecraft.item.Items.DISPENSER)
.addCriterion("has_computer", inventoryChange(Items.COMPUTER.get()))
.build(consumer);
ShapedRecipeBuilder
.shapedRecipe(Items.CHARGER.get())
.patternLine("IPI")
.patternLine("XTX")
.patternLine("IRI")
.key('I', Tags.Items.INGOTS_IRON)
.key('P', net.minecraft.item.Items.LIGHT_WEIGHTED_PRESSURE_PLATE)
.key('T', Items.TRANSISTOR.get())
.key('X', Items.BUS_INTERFACE.get())
.key('R', Tags.Items.STORAGE_BLOCKS_REDSTONE)
.addCriterion("has_transistor", inventoryChange(Items.TRANSISTOR.get()))
.build(consumer);
ShapedRecipeBuilder
.shapedRecipe(Items.WRENCH.get())
.patternLine("I I")
.patternLine(" T ")
.patternLine(" I ")
.key('I', Tags.Items.INGOTS_IRON)
.key('T', Items.TRANSISTOR.get())
.addCriterion("has_transistor", inventoryChange(Items.TRANSISTOR.get()))
.build(consumer);
ShapedRecipeBuilder
.shapedRecipe(Items.NETWORK_CABLE.get(), 8)
.patternLine("SSS")
.patternLine("GTG")
.patternLine("SSS")
.key('S', Tags.Items.STRING)
.key('G', Tags.Items.GLASS)
.key('T', Items.TRANSISTOR.get())
.addCriterion("has_transistor", inventoryChange(Items.TRANSISTOR.get()))
.build(consumer);
// todo Robot
// todo Memory
// todo HardDrive
// todo HardDrive - Linux
// todo FlashMemory
// todo FlashMemory - Linux
ShapedRecipeBuilder
.shapedRecipe(Items.REDSTONE_INTERFACE_CARD.get())
.patternLine("IRT")
.patternLine(" B ")
.key('I', Tags.Items.INGOTS_IRON)
.key('B', Items.CIRCUIT_BOARD.get())
.key('T', Items.TRANSISTOR.get())
.key('R', Tags.Items.DUSTS_REDSTONE)
.addCriterion("has_board", inventoryChange(Items.CIRCUIT_BOARD.get()))
.addCriterion("has_transistor", inventoryChange(Items.TRANSISTOR.get()))
.build(consumer);
ShapedRecipeBuilder
.shapedRecipe(Items.NETWORK_INTERFACE_CARD.get())
.patternLine("IRT")
.patternLine(" B ")
.key('I', Tags.Items.INGOTS_IRON)
.key('B', Items.CIRCUIT_BOARD.get())
.key('T', Items.TRANSISTOR.get())
.key('R', net.minecraft.item.Items.REPEATER)
.addCriterion("has_board", inventoryChange(Items.CIRCUIT_BOARD.get()))
.addCriterion("has_transistor", inventoryChange(Items.TRANSISTOR.get()))
.build(consumer);
// todo Floppy
// todo InventoryOperationsModule
// todo BlockOperationsModule
ShapedRecipeBuilder
.shapedRecipe(Items.TRANSISTOR.get(), 8)
.patternLine(" G ")
.patternLine("RPR")
.patternLine("III")
.key('I', Tags.Items.INGOTS_IRON)
.key('G', Tags.Items.INGOTS_GOLD)
.key('R', Tags.Items.DUSTS_REDSTONE)
.key('P', net.minecraft.item.Items.PAPER)
.addCriterion("has_gold", inventoryChange(net.minecraft.item.Items.GOLD_INGOT))
.build(consumer);
ShapelessRecipeBuilder
.shapelessRecipe(Items.CIRCUIT_BOARD.get(), 4)
.addIngredient(Tags.Items.INGOTS_GOLD)
.addIngredient(net.minecraft.item.Items.CLAY_BALL)
.addIngredient(Items.TRANSISTOR.get())
.addCriterion("has_transistor", inventoryChange(Items.TRANSISTOR.get()))
.build(consumer);
}
private static InventoryChangeTrigger.Instance inventoryChange(final IItemProvider item) {
return InventoryChangeTrigger.Instance.forItems(item);
}
}

View File

@@ -33,12 +33,8 @@
"item.oc2.block_operations_module": "Block Operations Module",
"item.oc2.block_operations_module.desc": "Enables robots to break and place blocks.",
"item.oc2.control_unit": "Control Unit (CU)",
"item.oc2.arithmetic_logic_unit": "Arithmetic Logic Unit (ALU)",
"item.oc2.microchip": "Microchip",
"item.oc2.disk_platter": "Disk Platter",
"item.oc2.transistor": "Transistor",
"item.oc2.pcb": "Printed Circuit Board (PCB)",
"item.oc2.circuit_board": "Circuit Board",
"entity.oc2.robot": "Robot",

View File

@@ -1,6 +0,0 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "oc2:items/arithmetic_logic_unit"
}
}

View File

@@ -1,6 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "oc2:items/pcb"
"layer0": "oc2:item/circuit_board"
}
}

View File

@@ -1,6 +0,0 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "oc2:items/control_unit"
}
}

View File

@@ -1,6 +0,0 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "oc2:items/disk_platter"
}
}

View File

@@ -1,6 +0,0 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "oc2:items/microchip"
}
}

View File

@@ -8,7 +8,9 @@
0
],
"translation": [
0, 2, 0
0,
2,
0
],
"scale": [
0.75,

View File

@@ -1,6 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "oc2:items/transistor"
"layer0": "oc2:item/transistor"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 289 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 303 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 208 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 300 B

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 322 B

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 281 B

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 265 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 351 B

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 331 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 394 B

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 221 B

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"oc2:bus_cable"
]
},
"criteria": {
"has_gold": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "minecraft:gold_ingot"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "oc2:bus_cable"
}
}
},
"requirements": [
[
"has_gold",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"oc2:bus_interface"
]
},
"criteria": {
"has_bus_cable": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "oc2:bus_cable"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "oc2:bus_interface"
}
}
},
"requirements": [
[
"has_bus_cable",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"oc2:charger"
]
},
"criteria": {
"has_transistor": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "oc2:transistor"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "oc2:charger"
}
}
},
"requirements": [
[
"has_transistor",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"oc2:circuit_board"
]
},
"criteria": {
"has_transistor": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "oc2:transistor"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "oc2:circuit_board"
}
}
},
"requirements": [
[
"has_transistor",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,43 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"oc2:computer"
]
},
"criteria": {
"has_transistor": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "oc2:transistor"
}
]
}
},
"has_circuit_board": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "oc2:circuit_board"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "oc2:computer"
}
}
},
"requirements": [
[
"has_transistor",
"has_circuit_board",
"has_the_recipe"
]
]
}

View File

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

View File

@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"oc2:network_cable"
]
},
"criteria": {
"has_transistor": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "oc2:transistor"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "oc2:network_cable"
}
}
},
"requirements": [
[
"has_transistor",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"oc2:network_connector"
]
},
"criteria": {
"has_transistor": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "oc2:transistor"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "oc2:network_connector"
}
}
},
"requirements": [
[
"has_transistor",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"oc2:network_hub"
]
},
"criteria": {
"has_network_connector": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "oc2:network_connector"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "oc2:network_hub"
}
}
},
"requirements": [
[
"has_network_connector",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,43 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"oc2:network_interface_card"
]
},
"criteria": {
"has_board": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "oc2:circuit_board"
}
]
}
},
"has_transistor": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "oc2:transistor"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "oc2:network_interface_card"
}
}
},
"requirements": [
[
"has_board",
"has_transistor",
"has_the_recipe"
]
]
}

View File

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

View File

@@ -0,0 +1,43 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"oc2:redstone_interface_card"
]
},
"criteria": {
"has_board": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "oc2:circuit_board"
}
]
}
},
"has_transistor": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "oc2:transistor"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "oc2:redstone_interface_card"
}
}
},
"requirements": [
[
"has_board",
"has_transistor",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"oc2:transistor"
]
},
"criteria": {
"has_gold": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "minecraft:gold_ingot"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "oc2:transistor"
}
}
},
"requirements": [
[
"has_gold",
"has_the_recipe"
]
]
}

View File

@@ -0,0 +1,32 @@
{
"parent": "minecraft:recipes/root",
"rewards": {
"recipes": [
"oc2:wrench"
]
},
"criteria": {
"has_transistor": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"item": "oc2:transistor"
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "oc2:wrench"
}
}
},
"requirements": [
[
"has_transistor",
"has_the_recipe"
]
]
}

View File

@@ -1,25 +0,0 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"IRI",
"TMT",
"ITI"
],
"key": {
"I": {
"item": "minecraft:iron_nugget"
},
"T": {
"item": "oc2:transistor"
},
"M": {
"item": "oc2:microchip"
},
"R": {
"item": "minecraft:redstone"
}
},
"result": {
"item": "oc2:arithmetic_logic_unit"
}
}

View File

@@ -1,20 +1,23 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"NNN",
"WWW",
"NNN"
"III",
"GTG",
"III"
],
"key": {
"N": {
"item": "minecraft:gold_nugget"
"I": {
"tag": "forge:ingots/iron"
},
"W": {
"item": "oc2:network_cable"
"G": {
"tag": "forge:ingots/gold"
},
"T": {
"item": "oc2:transistor"
}
},
"result": {
"item": "oc2:bus_cable",
"count": 3
"count": 16
}
}

View File

@@ -1,18 +1,13 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"N ",
"NC ",
"N "
],
"key": {
"N": {
"item": "minecraft:gold_nugget"
"type": "minecraft:crafting_shapeless",
"ingredients": [
{
"item": "oc2:transistor"
},
"C": {
{
"item": "oc2:bus_cable"
}
},
],
"result": {
"item": "oc2:bus_interface"
}

View File

@@ -0,0 +1,28 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"IPI",
"XTX",
"IRI"
],
"key": {
"I": {
"tag": "forge:ingots/iron"
},
"P": {
"item": "minecraft:light_weighted_pressure_plate"
},
"T": {
"item": "oc2:transistor"
},
"X": {
"item": "oc2:bus_interface"
},
"R": {
"tag": "forge:storage_blocks/redstone"
}
},
"result": {
"item": "oc2:charger"
}
}

View File

@@ -0,0 +1,18 @@
{
"type": "minecraft:crafting_shapeless",
"ingredients": [
{
"tag": "forge:ingots/gold"
},
{
"item": "minecraft:clay_ball"
},
{
"item": "oc2:transistor"
}
],
"result": {
"item": "oc2:circuit_board",
"count": 4
}
}

View File

@@ -1,29 +1,28 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"IMI",
"BCB",
"IPI"
"ICI",
"XTX",
"IBI"
],
"key": {
"I": {
"item": "minecraft:gold_ingot"
"tag": "forge:ingots/iron"
},
"C": {
"item": "minecraft:chest"
"tag": "forge:chests"
},
"M": {
"item": "oc2:microchip"
"X": {
"item": "oc2:bus_interface"
},
"P": {
"item": "oc2:pcb"
"T": {
"item": "oc2:transistor"
},
"B": {
"item": "minecraft:iron_bars"
"item": "oc2:circuit_board"
}
},
"result": {
"item": "oc2:computer",
"count": 1
"item": "oc2:computer"
}
}

View File

@@ -1,25 +0,0 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"IRI",
"TCT",
"ITI"
],
"key": {
"I": {
"item": "minecraft:gold_nugget"
},
"T": {
"item": "oc2:transistor"
},
"C": {
"item": "minecraft:clock"
},
"R": {
"item": "minecraft:redstone"
}
},
"result": {
"item": "oc2:control_unit"
}
}

View File

@@ -0,0 +1,28 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"IBI",
"XSX",
"IDI"
],
"key": {
"I": {
"tag": "forge:ingots/iron"
},
"B": {
"tag": "minecraft:buttons"
},
"S": {
"item": "minecraft:stick"
},
"X": {
"item": "oc2:bus_interface"
},
"D": {
"item": "minecraft:dispenser"
}
},
"result": {
"item": "oc2:disk_drive"
}
}

View File

@@ -1,16 +0,0 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
" N ",
"N N",
" N "
],
"key": {
"N": {
"item": "minecraft:iron_nugget"
}
},
"result": {
"item": "oc2:disk_platter"
}
}

View File

@@ -1,22 +0,0 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"III",
"RTR",
"III"
],
"key": {
"I": {
"item": "minecraft:gold_nugget"
},
"T": {
"item": "oc2:transistor"
},
"R": {
"item": "minecraft:redstone"
}
},
"result": {
"item": "oc2:microchip"
}
}

View File

@@ -2,19 +2,22 @@
"type": "minecraft:crafting_shaped",
"pattern": [
"SSS",
"GGG",
" "
"GTG",
"SSS"
],
"key": {
"S": {
"item": "minecraft:string"
"tag": "forge:string"
},
"G": {
"item": "minecraft:gold_nugget"
"tag": "forge:glass"
},
"T": {
"item": "oc2:transistor"
}
},
"result": {
"item": "oc2:network_cable",
"count": 6
"count": 8
}
}

View File

@@ -1,20 +1,22 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
" ",
"NWN",
"NWN"
"IGI",
"ITI"
],
"key": {
"N": {
"item": "minecraft:gold_nugget"
"I": {
"tag": "forge:ingots/iron"
},
"W": {
"item": "oc2:network_cable"
"G": {
"tag": "forge:glass"
},
"T": {
"item": "oc2:transistor"
}
},
"result": {
"item": "oc2:network_connector",
"count": 2
"count": 4
}
}

View File

@@ -1,16 +1,22 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"GGG",
"GCG",
"GGG"
"ICI",
"XRX",
"ICI"
],
"key": {
"G": {
"item": "minecraft:gold_nugget"
"I": {
"tag": "forge:ingots/iron"
},
"C": {
"item": "oc2:network_interface_card"
"item": "oc2:network_connector"
},
"R": {
"item": "minecraft:repeater"
},
"X": {
"item": "oc2:bus_interface"
}
},
"result": {

View File

@@ -1,25 +1,21 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"POG",
"PC ",
"PI "
"IRT",
" B "
],
"key": {
"I": {
"item": "minecraft:gold_nugget"
"tag": "forge:ingots/iron"
},
"P": {
"item": "minecraft:iron_nugget"
"B": {
"item": "oc2:circuit_board"
},
"C": {
"item": "oc2:pcb"
"T": {
"item": "oc2:transistor"
},
"O": {
"item": "oc2:microchip"
},
"G": {
"item": "oc2:network_cable"
"R": {
"item": "minecraft:repeater"
}
},
"result": {

View File

@@ -1,27 +0,0 @@
{
"type": "minecraft:crafting_shapeless",
"ingredients": [
{
"item": "minecraft:gold_nugget"
},
[
{
"item": "minecraft:slime_ball"
},
{
"item": "minecraft:honey_bottle"
}
],
[
{
"item": "minecraft:kelp"
},
{
"item": "minecraft:green_dye"
}
]
],
"result": {
"item": "oc2:pcb"
}
}

View File

@@ -1,16 +1,22 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"GGG",
"GCG",
"GGG"
"IRI",
"XTX",
"IRI"
],
"key": {
"G": {
"item": "minecraft:gold_nugget"
"I": {
"tag": "forge:ingots/iron"
},
"C": {
"item": "oc2:redstone_interface_card"
"R": {
"tag": "forge:dusts/redstone"
},
"T": {
"item": "oc2:transistor"
},
"X": {
"item": "oc2:bus_interface"
}
},
"result": {

View File

@@ -1,25 +1,21 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"POG",
"PC ",
"PI "
"IRT",
" B "
],
"key": {
"I": {
"item": "minecraft:gold_nugget"
"tag": "forge:ingots/iron"
},
"P": {
"item": "minecraft:iron_nugget"
"B": {
"item": "oc2:circuit_board"
},
"C": {
"item": "oc2:pcb"
"T": {
"item": "oc2:transistor"
},
"O": {
"item": "oc2:microchip"
},
"G": {
"item": "minecraft:redstone_torch"
"R": {
"tag": "forge:dusts/redstone"
}
},
"result": {

View File

@@ -1,19 +1,19 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"III",
"GPG",
" R "
" G ",
"RPR",
"III"
],
"key": {
"I": {
"item": "minecraft:iron_ingot"
"tag": "forge:ingots/iron"
},
"G": {
"item": "minecraft:gold_nugget"
"tag": "forge:ingots/gold"
},
"R": {
"item": "minecraft:redstone"
"tag": "forge:dusts/redstone"
},
"P": {
"item": "minecraft:paper"
@@ -21,6 +21,6 @@
},
"result": {
"item": "oc2:transistor",
"count": 4
"count": 8
}
}

View File

@@ -2,15 +2,15 @@
"type": "minecraft:crafting_shaped",
"pattern": [
"I I",
" C ",
" T ",
" I "
],
"key": {
"I": {
"item": "minecraft:iron_ingot"
"tag": "forge:ingots/iron"
},
"C": {
"item": "oc2:microchip"
"T": {
"item": "oc2:transistor"
}
},
"result": {