diff --git a/src/main/java/li/cil/oc2/common/block/ComputerBlock.java b/src/main/java/li/cil/oc2/common/block/ComputerBlock.java index 3bf66009..8034feea 100644 --- a/src/main/java/li/cil/oc2/common/block/ComputerBlock.java +++ b/src/main/java/li/cil/oc2/common/block/ComputerBlock.java @@ -47,6 +47,7 @@ import java.util.List; import static li.cil.oc2.common.Constants.BLOCK_ENTITY_TAG_NAME_IN_ITEM; import static li.cil.oc2.common.Constants.ITEMS_TAG_NAME; import static li.cil.oc2.common.util.NBTUtils.makeInventoryTag; +import static li.cil.oc2.common.util.TranslationUtils.text; public final class ComputerBlock extends HorizontalBlock { // We bake the "screen" indent on the front into the collision shape to prevent stuff being @@ -76,8 +77,7 @@ public final class ComputerBlock extends HorizontalBlock { @Override public void fillItemCategory(final ItemGroup group, final NonNullList items) { - super.fillItemCategory(group, items); - + items.add(getComputerWithFlash()); items.add(getPreconfiguredComputer()); } @@ -218,11 +218,23 @@ public final class ComputerBlock extends HorizontalBlock { /////////////////////////////////////////////////////////////////// + private ItemStack getComputerWithFlash() { + final ItemStack computer = new ItemStack(this); + + final CompoundNBT itemsTag = NBTUtils.getOrCreateChildTag(computer.getOrCreateTag(), BLOCK_ENTITY_TAG_NAME_IN_ITEM, ITEMS_TAG_NAME); + itemsTag.put(DeviceTypes.FLASH_MEMORY.getRegistryName().toString(), makeInventoryTag( + new ItemStack(Items.FLASH_MEMORY_CUSTOM.get()) + )); + + return computer; + } + private ItemStack getPreconfiguredComputer() { - final ItemStack computer = new ItemStack(Items.COMPUTER.get()); + final ItemStack computer = getComputerWithFlash(); final CompoundNBT itemsTag = NBTUtils.getOrCreateChildTag(computer.getOrCreateTag(), BLOCK_ENTITY_TAG_NAME_IN_ITEM, ITEMS_TAG_NAME); itemsTag.put(DeviceTypes.MEMORY.getRegistryName().toString(), makeInventoryTag( + new ItemStack(Items.MEMORY_LARGE.get()), new ItemStack(Items.MEMORY_LARGE.get()), new ItemStack(Items.MEMORY_LARGE.get()), new ItemStack(Items.MEMORY_LARGE.get()) @@ -230,13 +242,12 @@ public final class ComputerBlock extends HorizontalBlock { itemsTag.put(DeviceTypes.HARD_DRIVE.getRegistryName().toString(), makeInventoryTag( new ItemStack(Items.HARD_DRIVE_CUSTOM.get()) )); - itemsTag.put(DeviceTypes.FLASH_MEMORY.getRegistryName().toString(), makeInventoryTag( - new ItemStack(Items.FLASH_MEMORY_CUSTOM.get()) - )); itemsTag.put(DeviceTypes.CARD.getRegistryName().toString(), makeInventoryTag( new ItemStack(Items.NETWORK_INTERFACE_CARD.get()) )); + computer.setHoverName(text("block.{mod}.computer.preconfigured")); + return computer; } } diff --git a/src/main/resources/assets/oc2/lang/en_us.json b/src/main/resources/assets/oc2/lang/en_us.json index 082476c1..c233b3a2 100644 --- a/src/main/resources/assets/oc2/lang/en_us.json +++ b/src/main/resources/assets/oc2/lang/en_us.json @@ -3,6 +3,7 @@ "block.oc2.computer": "Computer", "block.oc2.computer.desc": "Use a Scrench or compatible wrench to add and remove components.", + "block.oc2.computer.preconfigured": "Preconfigured Computer", "block.oc2.bus_cable": "Bus Cable", "block.oc2.bus_cable.desc": "Used in combination with Bus Interfaces to connect external devices to computers.", "block.oc2.network_connector": "Network Connector", diff --git a/src/main/resources/data/oc2/recipes/computer.json b/src/main/resources/data/oc2/recipes/computer.json index ae5b1153..261e853d 100644 --- a/src/main/resources/data/oc2/recipes/computer.json +++ b/src/main/resources/data/oc2/recipes/computer.json @@ -23,6 +23,21 @@ } }, "result": { - "item": "oc2:computer" + "item": "oc2:computer", + "nbt": { + "BlockEntityTag": { + "items": { + "oc2:flash_memory": { + "Items": [ + { + "Slot": 0, + "Count": 1, + "id": "oc2:flash_memory_custom" + } + ] + } + } + } + } } } \ No newline at end of file