From 4be669f41f8ec6efc8dbb0670cbdb8b1e7d8e954 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Ryb=C3=A1rsky?= Date: Fri, 1 Nov 2024 23:24:42 +0100 Subject: [PATCH] Fix some stuff, crafting is broken --- build.gradle | 2 +- gradle.properties | 16 +++---- gradle/wrapper/gradle-wrapper.properties | 2 +- .../brn/serverstorage/ServerStorage.java | 2 +- .../InventoryInterfaceBlockEntity.java | 5 +- .../blocks/BusConnectorBlock.java | 7 ++- .../serverstorage/blocks/ConnectedBlock.java | 5 +- .../blocks/HardDriveContainerBlock.java | 15 +++--- .../blocks/InventoryInterfaceBlock.java | 17 ++++--- .../blocks/RadioInterfaceBlock.java | 16 ++++--- .../blocks/StorageInterfaceBlock.java | 19 +++++--- .../serverstorage/items/HardDriveItem.java | 4 +- .../serverstorage/items/SimpleBlockItem.java | 20 ++++---- .../brn/serverstorage/items/SimpleItem.java | 24 +++++----- .../items/WirelessTerminalItem.java | 3 ++ .../brn/serverstorage/lib/Antenna.java | 4 +- .../brn/serverstorage/lib/CraftingEntry.java | 12 ++--- .../brn/serverstorage/lib/EventHandler.java | 8 ++-- .../brn/serverstorage/lib/PagedGui.java | 8 ++-- .../systems/brn/serverstorage/lib/Util.java | 47 ++++++++++++------- .../serverstorage/screens/CraftingScreen.java | 25 ++++++---- .../serverstorage/screens/StorageScreen.java | 2 +- .../serverstorage/recipe/bus_connector.json | 20 ++------ .../data/serverstorage/recipe/cpu.json | 12 ++--- .../serverstorage/recipe/cpu_substrate.json | 8 +--- .../serverstorage/recipe/diamond_antenna.json | 4 +- .../serverstorage/recipe/diamond_drive.json | 16 ++----- .../serverstorage/recipe/diamond_head.json | 4 +- .../serverstorage/recipe/diamond_platter.json | 4 +- .../serverstorage/recipe/drive_casing.json | 12 ++--- .../serverstorage/recipe/drive_container.json | 20 ++------ .../recipe/drive_controller.json | 16 ++----- .../serverstorage/recipe/golden_antenna.json | 4 +- .../serverstorage/recipe/golden_drive.json | 16 ++----- .../serverstorage/recipe/golden_head.json | 4 +- .../serverstorage/recipe/golden_platter.json | 4 +- .../recipe/inventory_interface.json | 32 ++++--------- .../serverstorage/recipe/iron_antenna.json | 4 +- .../data/serverstorage/recipe/iron_drive.json | 16 ++----- .../data/serverstorage/recipe/iron_head.json | 4 +- .../serverstorage/recipe/iron_platter.json | 4 +- .../serverstorage/recipe/module_antenna.json | 20 ++------ .../recipe/module_antenna_connector.json | 16 ++----- .../data/serverstorage/recipe/module_bus.json | 20 ++------ .../recipe/module_configuration.json | 16 ++----- .../recipe/module_container.json | 16 ++----- .../serverstorage/recipe/module_display.json | 16 ++----- .../serverstorage/recipe/module_drive.json | 16 ++----- .../recipe/module_filtering.json | 20 ++------ .../recipe/module_inventory.json | 20 ++------ .../serverstorage/recipe/module_modem.json | 16 ++----- .../recipe/module_pagination.json | 16 ++----- .../data/serverstorage/recipe/module_pcb.json | 12 ++--- .../serverstorage/recipe/module_radio.json | 16 ++----- .../recipe/module_transport.json | 16 ++----- .../recipe/netherite_antenna.json | 12 ++--- .../serverstorage/recipe/netherite_drive.json | 16 ++----- .../serverstorage/recipe/netherite_head.json | 12 ++--- .../recipe/netherite_platter.json | 12 ++--- .../recipe/netherite_upgrade.json | 12 ++--- .../data/serverstorage/recipe/pcb.json | 8 +--- .../serverstorage/recipe/pcb_substrate.json | 8 +--- .../serverstorage/recipe/radio_interface.json | 32 ++++--------- .../data/serverstorage/recipe/storage.json | 36 ++++---------- .../recipe/wireless_terminal.json | 32 ++++--------- 65 files changed, 310 insertions(+), 573 deletions(-) diff --git a/build.gradle b/build.gradle index 9e5b8a0..ea8408d 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '1.6-SNAPSHOT' + id 'fabric-loom' version '1.8-SNAPSHOT' id 'maven-publish' } diff --git a/gradle.properties b/gradle.properties index c003df0..e3da2ab 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,19 +3,19 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these on https://modmuss50.me/fabric.html -minecraft_version=1.21.1 -yarn_mappings=1.21.1+build.3 -loader_version=0.16.0 +minecraft_version=1.21.3 +yarn_mappings=1.21.3+build.2 +loader_version=0.16.8 # Fabric API -fabric_version=0.102.1+1.21.1 +fabric_version=0.107.0+1.21.3 # Mod Properties -mod_version=3.2.9 +mod_version=3.3.0 maven_group=systems.brn archives_base_name=Serverstorage # Dependencies -polymer_version=0.9.9+1.21 -server_translations_api_version=2.3.1+1.21-pre2 -servergui_version=1.6.0+1.21 \ No newline at end of file +polymer_version=0.10.1+1.21.3 +server_translations_api_version=2.4.0+1.21.2-rc1 +servergui_version=1.7.2+1.21.2 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b82aa23..9355b41 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/src/main/java/systems/brn/serverstorage/ServerStorage.java b/src/main/java/systems/brn/serverstorage/ServerStorage.java index 833068c..1bd9bec 100644 --- a/src/main/java/systems/brn/serverstorage/ServerStorage.java +++ b/src/main/java/systems/brn/serverstorage/ServerStorage.java @@ -56,7 +56,7 @@ public class ServerStorage implements ModInitializer { public static BlockEntityType INVENTORY_INTERFACE_BLOCK_ENTITY; public static final GameRules.Key ServerStorage_Crafting_Enable = - GameRuleRegistry.register("serverstorage_crafting_module", GameRules.Category.MISC, GameRuleFactory.createBooleanRule(true)); + GameRuleRegistry.register("serverstorage_crafting_module", GameRules.Category.MISC, GameRuleFactory.createBooleanRule(false)); public static final GameRules.Key ServerStorage_Terminal_Enable = GameRuleRegistry.register("serverstorage_terminal_module", GameRules.Category.MISC, GameRuleFactory.createBooleanRule(true)); diff --git a/src/main/java/systems/brn/serverstorage/blockentities/InventoryInterfaceBlockEntity.java b/src/main/java/systems/brn/serverstorage/blockentities/InventoryInterfaceBlockEntity.java index 248306f..25986a5 100644 --- a/src/main/java/systems/brn/serverstorage/blockentities/InventoryInterfaceBlockEntity.java +++ b/src/main/java/systems/brn/serverstorage/blockentities/InventoryInterfaceBlockEntity.java @@ -6,6 +6,7 @@ import net.minecraft.inventory.Inventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NbtCompound; import net.minecraft.registry.RegistryWrapper; +import net.minecraft.server.world.ServerWorld; import net.minecraft.state.property.EnumProperty; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; @@ -107,7 +108,7 @@ public class InventoryInterfaceBlockEntity extends BlockEntity { } public int processIncoming(ItemStack stack, int count) { - if (world != null && world.getGameRules().getBoolean(ServerStorage_Interface_Enable) && isOutput && filterItem(stack.getItem(), query)) { + if (world != null && ((ServerWorld) world).getGameRules().getBoolean(ServerStorage_Interface_Enable) && isOutput && filterItem(stack.getItem(), query)) { BlockPos targetedPos = pos.offset(direction); BlockEntity targetedBlockEntity = world.getBlockEntity(targetedPos); EnumProperty connectionType = getPropertyForDirection(direction); @@ -124,7 +125,7 @@ public class InventoryInterfaceBlockEntity extends BlockEntity { } public static void tick(World world, BlockPos blockPos, BlockState ignoredState, T ignoredt) { - if (!world.getGameRules().getBoolean(ServerStorage_Interface_Enable)) { + if (!((ServerWorld) world).getGameRules().getBoolean(ServerStorage_Interface_Enable)) { return; } InventoryInterfaceBlockEntity blockEntity = (InventoryInterfaceBlockEntity) world.getBlockEntity(blockPos); diff --git a/src/main/java/systems/brn/serverstorage/blocks/BusConnectorBlock.java b/src/main/java/systems/brn/serverstorage/blocks/BusConnectorBlock.java index ff72510..276b590 100644 --- a/src/main/java/systems/brn/serverstorage/blocks/BusConnectorBlock.java +++ b/src/main/java/systems/brn/serverstorage/blocks/BusConnectorBlock.java @@ -7,7 +7,10 @@ import eu.pb4.polymer.blocks.api.PolymerTexturedBlock; import net.minecraft.block.*; import net.minecraft.registry.Registries; import net.minecraft.registry.Registry; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; import net.minecraft.util.Identifier; +import xyz.nucleoid.packettweaker.PacketContext; import static systems.brn.serverstorage.ServerStorage.*; @@ -27,14 +30,14 @@ public class BusConnectorBlock extends ConnectedBlock implements PolymerTextured } @Override - public BlockState getPolymerBlockState(BlockState state) { + public BlockState getPolymerBlockState(BlockState state, PacketContext packetContext) { return this.polymerBlockState; } public static void register() { var modId = id(BUS_CONNECTOR_MODEL_ID); BUS_CONNECTOR_BLOCK = Registry.register(Registries.BLOCK, modId, - new BusConnectorBlock(AbstractBlock.Settings.copy(Blocks.WHITE_WOOL), modId)); + new BusConnectorBlock(AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).registryKey(RegistryKey.of(RegistryKeys.BLOCK, modId)), modId)); BUS_CONNECTOR_BLOCK.setDefaultState(); } } diff --git a/src/main/java/systems/brn/serverstorage/blocks/ConnectedBlock.java b/src/main/java/systems/brn/serverstorage/blocks/ConnectedBlock.java index be3d562..d9ff6c6 100644 --- a/src/main/java/systems/brn/serverstorage/blocks/ConnectedBlock.java +++ b/src/main/java/systems/brn/serverstorage/blocks/ConnectedBlock.java @@ -16,6 +16,7 @@ import net.minecraft.util.Identifier; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.world.World; +import net.minecraft.world.block.WireOrientation; import systems.brn.serverstorage.lib.ConnectionType; import java.util.HashMap; @@ -92,9 +93,9 @@ public class ConnectedBlock extends SimplePolymerBlock { } @Override - public void neighborUpdate(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean notify) { + public void neighborUpdate(BlockState state, World world, BlockPos pos, Block block, WireOrientation wireOrientation, boolean notify) { updateBlockState(world, pos, state); - super.neighborUpdate(state, world, pos, block, fromPos, notify); + super.neighborUpdate(state, world, pos, block, wireOrientation, notify); } private BlockState updateState(BlockState state, World world, BlockPos pos) { diff --git a/src/main/java/systems/brn/serverstorage/blocks/HardDriveContainerBlock.java b/src/main/java/systems/brn/serverstorage/blocks/HardDriveContainerBlock.java index a74e8a2..420e41d 100644 --- a/src/main/java/systems/brn/serverstorage/blocks/HardDriveContainerBlock.java +++ b/src/main/java/systems/brn/serverstorage/blocks/HardDriveContainerBlock.java @@ -3,15 +3,17 @@ package systems.brn.serverstorage.blocks; import eu.pb4.polymer.blocks.api.PolymerTexturedBlock; import eu.pb4.polymer.core.api.block.PolymerBlockUtils; import net.fabricmc.fabric.api.event.player.UseBlockCallback; +import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder; import net.minecraft.block.*; import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityType; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemPlacementContext; import net.minecraft.registry.Registries; import net.minecraft.registry.Registry; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; import net.minecraft.state.StateManager; -import net.minecraft.state.property.DirectionProperty; +import net.minecraft.state.property.EnumProperty; import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; import net.minecraft.util.Identifier; @@ -23,6 +25,7 @@ import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; import systems.brn.serverstorage.blockentities.HardDriveContainerBlockEntity; import systems.brn.serverstorage.lib.StorageNetwork; +import xyz.nucleoid.packettweaker.PacketContext; import java.util.HashMap; @@ -31,7 +34,7 @@ import static systems.brn.serverstorage.ServerStorage.*; public class HardDriveContainerBlock extends ConnectedBlock implements PolymerTexturedBlock, BlockEntityProvider { final Identifier identifier; - public static final DirectionProperty FACING = FacingBlock.FACING; + public static final EnumProperty FACING = FacingBlock.FACING; private final HashMap rotations; public HardDriveContainerBlock(AbstractBlock.Settings settings, Identifier identifier) { @@ -53,7 +56,7 @@ public class HardDriveContainerBlock extends ConnectedBlock implements PolymerTe } @Override - public BlockState getPolymerBlockState(BlockState state) { + public BlockState getPolymerBlockState(BlockState state, PacketContext context) { Direction direction = state.get(FACING); return rotations.get(direction); } @@ -61,7 +64,7 @@ public class HardDriveContainerBlock extends ConnectedBlock implements PolymerTe public static void register() { var modId = id(HARD_DRIVE_CONTAINER_BLOCK_MODEL_ID); HARD_DRIVE_CONTAINER_BLOCK = Registry.register(Registries.BLOCK, modId, - new HardDriveContainerBlock(Settings.copy(Blocks.WHITE_WOOL), modId)); + new HardDriveContainerBlock(Settings.copy(Blocks.WHITE_WOOL).registryKey(RegistryKey.of(RegistryKeys.BLOCK, modId)), modId)); UseBlockCallback.EVENT.register(HardDriveContainerBlock::onUse); HARD_DRIVE_CONTAINER_BLOCK.setDefaultState(); @@ -69,7 +72,7 @@ public class HardDriveContainerBlock extends ConnectedBlock implements PolymerTe HARD_DRIVE_CONTAINER_BLOCK_ENTITY = Registry.register( Registries.BLOCK_ENTITY_TYPE, modId, - BlockEntityType.Builder.create(HardDriveContainerBlockEntity::new, HARD_DRIVE_CONTAINER_BLOCK).build(null) + FabricBlockEntityTypeBuilder.create(HardDriveContainerBlockEntity::new, HARD_DRIVE_CONTAINER_BLOCK).build(null) ); PolymerBlockUtils.registerBlockEntity(HARD_DRIVE_CONTAINER_BLOCK_ENTITY); } diff --git a/src/main/java/systems/brn/serverstorage/blocks/InventoryInterfaceBlock.java b/src/main/java/systems/brn/serverstorage/blocks/InventoryInterfaceBlock.java index 62eac80..c6da528 100644 --- a/src/main/java/systems/brn/serverstorage/blocks/InventoryInterfaceBlock.java +++ b/src/main/java/systems/brn/serverstorage/blocks/InventoryInterfaceBlock.java @@ -4,6 +4,7 @@ import eu.pb4.polymer.blocks.api.PolymerTexturedBlock; import eu.pb4.polymer.core.api.block.PolymerBlockUtils; import eu.pb4.sgui.api.elements.GuiElementBuilder; import net.fabricmc.fabric.api.event.player.UseBlockCallback; +import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder; import net.minecraft.block.*; import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntityTicker; @@ -13,10 +14,12 @@ import net.minecraft.item.ItemPlacementContext; import net.minecraft.item.Items; import net.minecraft.registry.Registries; import net.minecraft.registry.Registry; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.world.ServerWorld; import net.minecraft.state.StateManager; -import net.minecraft.state.property.DirectionProperty; +import net.minecraft.state.property.EnumProperty; import net.minecraft.text.Text; import net.minecraft.util.ActionResult; import net.minecraft.util.Formatting; @@ -31,6 +34,7 @@ import systems.brn.serverstorage.blockentities.InventoryInterfaceBlockEntity; import systems.brn.serverstorage.lib.PagedGui; import systems.brn.serverstorage.screens.SearchScreen; import systems.brn.serverstorage.screens.SettingsScreen; +import xyz.nucleoid.packettweaker.PacketContext; import java.util.HashMap; @@ -39,7 +43,7 @@ import static systems.brn.serverstorage.lib.PagedGui.*; public class InventoryInterfaceBlock extends ConnectedBlock implements PolymerTexturedBlock, BlockEntityProvider { final Identifier identifier; - public static final DirectionProperty FACING = FacingBlock.FACING; + public static final EnumProperty FACING = FacingBlock.FACING; private final HashMap rotations; public InventoryInterfaceBlock(Settings settings, Identifier identifier) { @@ -61,7 +65,7 @@ public class InventoryInterfaceBlock extends ConnectedBlock implements PolymerTe } @Override - public BlockState getPolymerBlockState(BlockState state) { + public BlockState getPolymerBlockState(BlockState state, PacketContext packetContext) { Direction direction = state.get(FACING); return rotations.get(direction); } @@ -69,14 +73,15 @@ public class InventoryInterfaceBlock extends ConnectedBlock implements PolymerTe public static void register() { var modId = id(INVENTORY_INTERFACE_BLOCK_MODEL_ID); INVENTORY_INTERFACE_BLOCK = Registry.register(Registries.BLOCK, modId, - new InventoryInterfaceBlock(Settings.copy(Blocks.WHITE_WOOL), modId)); + new InventoryInterfaceBlock(Settings.copy(Blocks.WHITE_WOOL).registryKey(RegistryKey.of(RegistryKeys.BLOCK, modId)), modId)); UseBlockCallback.EVENT.register(InventoryInterfaceBlock::onUse); INVENTORY_INTERFACE_BLOCK.setDefaultState(); INVENTORY_INTERFACE_BLOCK_ENTITY = Registry.register( Registries.BLOCK_ENTITY_TYPE, modId, - BlockEntityType.Builder.create(InventoryInterfaceBlockEntity::new, INVENTORY_INTERFACE_BLOCK).build(null) + FabricBlockEntityTypeBuilder.create(InventoryInterfaceBlockEntity::new, INVENTORY_INTERFACE_BLOCK).build(null) ); + INVENTORY_INTERFACE_BLOCK_ENTITY.addSupportedBlock(INVENTORY_INTERFACE_BLOCK); PolymerBlockUtils.registerBlockEntity(INVENTORY_INTERFACE_BLOCK_ENTITY); } @@ -150,7 +155,7 @@ public class InventoryInterfaceBlock extends ConnectedBlock implements PolymerTe Block block = state.getBlock(); if (block instanceof InventoryInterfaceBlock) { - if (!world.getGameRules().getBoolean(ServerStorage_Interface_Enable)) { + if (!((ServerWorld) world).getGameRules().getBoolean(ServerStorage_Interface_Enable)) { playerEntity.sendMessage(Text.translatable("message.serverstorage.block_disabled"), true); return ActionResult.PASS; } diff --git a/src/main/java/systems/brn/serverstorage/blocks/RadioInterfaceBlock.java b/src/main/java/systems/brn/serverstorage/blocks/RadioInterfaceBlock.java index 5ee39da..205c09f 100644 --- a/src/main/java/systems/brn/serverstorage/blocks/RadioInterfaceBlock.java +++ b/src/main/java/systems/brn/serverstorage/blocks/RadioInterfaceBlock.java @@ -3,18 +3,20 @@ package systems.brn.serverstorage.blocks; import eu.pb4.polymer.blocks.api.PolymerTexturedBlock; import eu.pb4.polymer.core.api.block.PolymerBlockUtils; import net.fabricmc.fabric.api.event.player.UseBlockCallback; +import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder; import net.minecraft.block.*; import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityType; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemPlacementContext; import net.minecraft.item.ItemStack; import net.minecraft.registry.Registries; import net.minecraft.registry.Registry; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.state.StateManager; -import net.minecraft.state.property.DirectionProperty; +import net.minecraft.state.property.EnumProperty; import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; import net.minecraft.util.Identifier; @@ -29,6 +31,7 @@ import systems.brn.serverstorage.items.WirelessTerminalItem; import systems.brn.serverstorage.lib.SessionStorageClass; import systems.brn.serverstorage.lib.WirelessTerminalComponents; import systems.brn.serverstorage.screens.RadioBlockPlayerMangementScreen; +import xyz.nucleoid.packettweaker.PacketContext; import java.util.ArrayList; import java.util.HashMap; @@ -40,7 +43,7 @@ import static systems.brn.serverstorage.lib.Util.removePosition; public class RadioInterfaceBlock extends ConnectedBlock implements PolymerTexturedBlock, BlockEntityProvider { final Identifier identifier; - public static final DirectionProperty FACING = FacingBlock.FACING; + public static final EnumProperty FACING = FacingBlock.FACING; private final HashMap rotations; public RadioInterfaceBlock(Settings settings, Identifier identifier) { @@ -63,7 +66,7 @@ public class RadioInterfaceBlock extends ConnectedBlock implements PolymerTextur } @Override - public BlockState getPolymerBlockState(BlockState state) { + public BlockState getPolymerBlockState(BlockState state, PacketContext packetContext) { Direction direction = state.get(FACING); return rotations.get(direction); } @@ -71,7 +74,7 @@ public class RadioInterfaceBlock extends ConnectedBlock implements PolymerTextur public static void register() { var modId = id(RADIO_INTERFACE_BLOCK_MODEL_ID); RADIO_INTERFACE_BLOCK = Registry.register(Registries.BLOCK, modId, - new RadioInterfaceBlock(Settings.copy(Blocks.WHITE_WOOL), modId)); + new RadioInterfaceBlock(Settings.copy(Blocks.WHITE_WOOL).registryKey(RegistryKey.of(RegistryKeys.BLOCK, modId)), modId)); UseBlockCallback.EVENT.register(RadioInterfaceBlock::onUse); RADIO_INTERFACE_BLOCK.setDefaultState(); @@ -79,8 +82,9 @@ public class RadioInterfaceBlock extends ConnectedBlock implements PolymerTextur RADIO_INTERFACE_BLOCK_ENTITY = Registry.register( Registries.BLOCK_ENTITY_TYPE, modId, - BlockEntityType.Builder.create(RadioInterfaceBlockEntity::new, RADIO_INTERFACE_BLOCK).build(null) + FabricBlockEntityTypeBuilder.create(RadioInterfaceBlockEntity::new, RADIO_INTERFACE_BLOCK).build(null) ); + RADIO_INTERFACE_BLOCK_ENTITY.addSupportedBlock(RADIO_INTERFACE_BLOCK); PolymerBlockUtils.registerBlockEntity(RADIO_INTERFACE_BLOCK_ENTITY); } diff --git a/src/main/java/systems/brn/serverstorage/blocks/StorageInterfaceBlock.java b/src/main/java/systems/brn/serverstorage/blocks/StorageInterfaceBlock.java index c0353af..4886901 100644 --- a/src/main/java/systems/brn/serverstorage/blocks/StorageInterfaceBlock.java +++ b/src/main/java/systems/brn/serverstorage/blocks/StorageInterfaceBlock.java @@ -3,9 +3,9 @@ package systems.brn.serverstorage.blocks; import eu.pb4.polymer.blocks.api.PolymerTexturedBlock; import eu.pb4.polymer.core.api.block.PolymerBlockUtils; import net.fabricmc.fabric.api.event.player.UseBlockCallback; +import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder; import net.minecraft.block.*; import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityType; import net.minecraft.component.DataComponentTypes; import net.minecraft.component.type.WrittenBookContentComponent; import net.minecraft.entity.player.PlayerEntity; @@ -14,9 +14,12 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.registry.Registries; import net.minecraft.registry.Registry; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; import net.minecraft.server.network.ServerPlayerEntity; +import net.minecraft.server.world.ServerWorld; import net.minecraft.state.StateManager; -import net.minecraft.state.property.DirectionProperty; +import net.minecraft.state.property.EnumProperty; import net.minecraft.text.RawFilteredPair; import net.minecraft.text.Text; import net.minecraft.util.ActionResult; @@ -29,6 +32,7 @@ import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; import systems.brn.serverstorage.blockentities.StorageInterfaceBlockEntity; import systems.brn.serverstorage.screens.StorageScreen; +import xyz.nucleoid.packettweaker.PacketContext; import java.util.HashMap; import java.util.List; @@ -38,7 +42,7 @@ import static systems.brn.serverstorage.lib.Util.generateBookContent; public class StorageInterfaceBlock extends ConnectedBlock implements PolymerTexturedBlock, BlockEntityProvider { final Identifier identifier; - public static final DirectionProperty FACING = FacingBlock.FACING; + public static final EnumProperty FACING = FacingBlock.FACING; private final HashMap rotations; public StorageInterfaceBlock(Settings settings, Identifier identifier) { @@ -60,7 +64,7 @@ public class StorageInterfaceBlock extends ConnectedBlock implements PolymerText } @Override - public BlockState getPolymerBlockState(BlockState state) { + public BlockState getPolymerBlockState(BlockState state, PacketContext packetContext) { Direction direction = state.get(FACING); return rotations.get(direction); } @@ -68,14 +72,15 @@ public class StorageInterfaceBlock extends ConnectedBlock implements PolymerText public static void register() { var modId = id(STORAGE_MODEL_ID); STORAGE_INTERFACE_BLOCK = Registry.register(Registries.BLOCK, modId, - new StorageInterfaceBlock(AbstractBlock.Settings.copy(Blocks.WHITE_WOOL), modId)); + new StorageInterfaceBlock(AbstractBlock.Settings.copy(Blocks.WHITE_WOOL).registryKey(RegistryKey.of(RegistryKeys.BLOCK, modId)), modId)); UseBlockCallback.EVENT.register(StorageInterfaceBlock::onUse); STORAGE_INTERFACE_BLOCK.setDefaultState(); STORAGE_INTERFACE_BLOCK_ENTITY = Registry.register( Registries.BLOCK_ENTITY_TYPE, modId, - BlockEntityType.Builder.create(StorageInterfaceBlockEntity::new, STORAGE_INTERFACE_BLOCK).build(null) + FabricBlockEntityTypeBuilder.create(StorageInterfaceBlockEntity::new, STORAGE_INTERFACE_BLOCK).build(null) ); + STORAGE_INTERFACE_BLOCK_ENTITY.addSupportedBlock(STORAGE_INTERFACE_BLOCK); PolymerBlockUtils.registerBlockEntity(STORAGE_INTERFACE_BLOCK_ENTITY); } @@ -85,7 +90,7 @@ public class StorageInterfaceBlock extends ConnectedBlock implements PolymerText Block block = state.getBlock(); if (block instanceof StorageInterfaceBlock) { - if (!world.getGameRules().getBoolean(ServerStorage_Terminal_Enable)){ + if (!((ServerWorld) world).getGameRules().getBoolean(ServerStorage_Terminal_Enable)){ player.sendMessage(Text.translatable("message.serverstorage.block_disabled"), true); return ActionResult.PASS; } diff --git a/src/main/java/systems/brn/serverstorage/items/HardDriveItem.java b/src/main/java/systems/brn/serverstorage/items/HardDriveItem.java index 76bbae7..eae2c06 100644 --- a/src/main/java/systems/brn/serverstorage/items/HardDriveItem.java +++ b/src/main/java/systems/brn/serverstorage/items/HardDriveItem.java @@ -5,6 +5,8 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemGroups; import net.minecraft.registry.Registries; import net.minecraft.registry.Registry; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; import net.minecraft.util.Identifier; import systems.brn.serverstorage.lib.DriveComponents; @@ -25,7 +27,7 @@ public class HardDriveItem extends SimpleItem { Identifier identifier = id(tier + "_drive"); Item item = Registry.register(Registries.ITEM, identifier, new SimpleItem(new Settings() .maxCount(1) - .component(DriveComponents.ITEMSTACK_MAP, new HashMap<>()) + .component(DriveComponents.ITEMSTACK_MAP, new HashMap<>()).registryKey(RegistryKey.of(RegistryKeys.ITEM, identifier)) , identifier)); ItemGroupEvents.modifyEntriesEvent(ItemGroups.FUNCTIONAL).register(content -> content.add(item)); items.add(item); diff --git a/src/main/java/systems/brn/serverstorage/items/SimpleBlockItem.java b/src/main/java/systems/brn/serverstorage/items/SimpleBlockItem.java index b0e5b35..f963864 100644 --- a/src/main/java/systems/brn/serverstorage/items/SimpleBlockItem.java +++ b/src/main/java/systems/brn/serverstorage/items/SimpleBlockItem.java @@ -2,7 +2,6 @@ package systems.brn.serverstorage.items; import eu.pb4.polymer.core.api.item.PolymerBlockItem; import eu.pb4.polymer.core.api.item.PolymerItem; -import eu.pb4.polymer.resourcepack.api.PolymerModelData; import eu.pb4.polymer.resourcepack.api.PolymerResourcePackUtils; import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents; import net.minecraft.block.Block; @@ -12,33 +11,34 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.registry.Registries; import net.minecraft.registry.Registry; -import net.minecraft.server.network.ServerPlayerEntity; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; import net.minecraft.util.Identifier; -import org.jetbrains.annotations.Nullable; +import xyz.nucleoid.packettweaker.PacketContext; import static systems.brn.serverstorage.ServerStorage.id; public class SimpleBlockItem extends PolymerBlockItem implements PolymerItem { - private final PolymerModelData polymerModel; + private final Identifier polymerModel; public SimpleBlockItem(Item.Settings settings, Block block, Identifier identifier) { super(block, settings, Items.BARRIER); - this.polymerModel = PolymerResourcePackUtils.requestModel(Items.BARRIER, identifier.withPath("item/" + identifier.getPath())); + this.polymerModel = PolymerResourcePackUtils.getBridgedModelId(identifier.withPath("item/" + identifier.getPath())); } @Override - public Item getPolymerItem(ItemStack itemStack, @Nullable ServerPlayerEntity player) { - return this.polymerModel.item(); + public Identifier getPolymerItemModel(ItemStack stack, PacketContext context) { + return this.polymerModel; } @Override - public int getPolymerCustomModelData(ItemStack itemStack, @Nullable ServerPlayerEntity player) { - return this.polymerModel.value(); + public Item getPolymerItem(ItemStack itemStack, PacketContext player) { + return Items.BARRIER; } public static void register(Block block) { Identifier identifier = id(block.getRegistryEntry().registryKey().getValue().getPath()); - Item item = Registry.register(Registries.ITEM, identifier, new SimpleBlockItem(new Item.Settings(), block, identifier)); + Item item = Registry.register(Registries.ITEM, identifier, new SimpleBlockItem(new Item.Settings().registryKey(RegistryKey.of(RegistryKeys.ITEM, identifier)), block, identifier)); ItemGroupEvents.modifyEntriesEvent(ItemGroups.FUNCTIONAL).register(content -> content.add(item)); } } diff --git a/src/main/java/systems/brn/serverstorage/items/SimpleItem.java b/src/main/java/systems/brn/serverstorage/items/SimpleItem.java index b5a60cb..4aede6e 100644 --- a/src/main/java/systems/brn/serverstorage/items/SimpleItem.java +++ b/src/main/java/systems/brn/serverstorage/items/SimpleItem.java @@ -2,16 +2,18 @@ package systems.brn.serverstorage.items; import eu.pb4.polymer.core.api.item.PolymerItem; import eu.pb4.polymer.core.api.item.SimplePolymerItem; -import eu.pb4.polymer.resourcepack.api.PolymerModelData; import eu.pb4.polymer.resourcepack.api.PolymerResourcePackUtils; import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents; -import net.minecraft.item.*; +import net.minecraft.item.Item; +import net.minecraft.item.ItemGroup; +import net.minecraft.item.ItemStack; +import net.minecraft.item.Items; import net.minecraft.registry.Registries; import net.minecraft.registry.Registry; import net.minecraft.registry.RegistryKey; -import net.minecraft.server.network.ServerPlayerEntity; +import net.minecraft.registry.RegistryKeys; import net.minecraft.util.Identifier; -import org.jetbrains.annotations.Nullable; +import xyz.nucleoid.packettweaker.PacketContext; import java.util.ArrayList; import java.util.List; @@ -19,21 +21,21 @@ import java.util.List; import static systems.brn.serverstorage.ServerStorage.id; public class SimpleItem extends SimplePolymerItem implements PolymerItem { - private final PolymerModelData polymerModel; + private final Identifier polymerModel; public SimpleItem(Settings settings, Identifier identifier) { super(settings, Items.STICK); - this.polymerModel = PolymerResourcePackUtils.requestModel(Items.STICK, identifier.withPath("item/" + identifier.getPath())); + this.polymerModel = PolymerResourcePackUtils.getBridgedModelId(identifier.withPath("item/" + identifier.getPath())); } @Override - public Item getPolymerItem(ItemStack itemStack, @Nullable ServerPlayerEntity player) { - return this.polymerModel.item(); + public Identifier getPolymerItemModel(ItemStack stack, PacketContext context) { + return this.polymerModel; } @Override - public int getPolymerCustomModelData(ItemStack itemStack, @Nullable ServerPlayerEntity player) { - return this.polymerModel.value(); + public Item getPolymerItem(ItemStack itemStack, PacketContext player) { + return Items.STICK; } public static Item register(String name, RegistryKey group){ @@ -42,7 +44,7 @@ public class SimpleItem extends SimplePolymerItem implements PolymerItem { public static Item register(String name, int maxCount, RegistryKey group) { Identifier identifier = id(name); - Item item = Registry.register(Registries.ITEM, identifier, new SimpleItem(new Settings().maxCount(maxCount), identifier)); + Item item = Registry.register(Registries.ITEM, identifier, new SimpleItem(new Settings().maxCount(maxCount).registryKey(RegistryKey.of(RegistryKeys.ITEM, identifier)), identifier)); ItemGroupEvents.modifyEntriesEvent(group).register(content -> content.add(item)); return item; } diff --git a/src/main/java/systems/brn/serverstorage/items/WirelessTerminalItem.java b/src/main/java/systems/brn/serverstorage/items/WirelessTerminalItem.java index 3498ffc..35697ba 100644 --- a/src/main/java/systems/brn/serverstorage/items/WirelessTerminalItem.java +++ b/src/main/java/systems/brn/serverstorage/items/WirelessTerminalItem.java @@ -10,6 +10,8 @@ import net.minecraft.item.ItemGroups; import net.minecraft.item.ItemStack; import net.minecraft.registry.Registries; import net.minecraft.registry.Registry; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; import net.minecraft.server.MinecraftServer; import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.world.ServerWorld; @@ -45,6 +47,7 @@ public class WirelessTerminalItem extends SimpleItem { .component(WirelessTerminalComponents.SORT_ALPHABETICALLY, false) .component(WirelessTerminalComponents.QUERY_STRING, "") .component(WirelessTerminalComponents.PAGE, 0) + .registryKey(RegistryKey.of(RegistryKeys.ITEM, identifier)) , identifier)); ItemGroupEvents.modifyEntriesEvent(ItemGroups.FUNCTIONAL).register(content -> content.add(item)); return item; diff --git a/src/main/java/systems/brn/serverstorage/lib/Antenna.java b/src/main/java/systems/brn/serverstorage/lib/Antenna.java index dc3b410..f839146 100644 --- a/src/main/java/systems/brn/serverstorage/lib/Antenna.java +++ b/src/main/java/systems/brn/serverstorage/lib/Antenna.java @@ -7,6 +7,8 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemGroups; import net.minecraft.registry.Registries; import net.minecraft.registry.Registry; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; import net.minecraft.text.Text; import net.minecraft.util.Identifier; import systems.brn.serverstorage.items.SimpleItem; @@ -34,7 +36,7 @@ public class Antenna extends SimpleItem { for (String tier : tiers) { Identifier identifier = id(tier + "_antenna"); Item item = Registry.register(Registries.ITEM, identifier, new Antenna(new Settings() - .maxCount(1) + .maxCount(1).registryKey(RegistryKey.of(RegistryKeys.ITEM, identifier)) , identifier, range)); ItemGroupEvents.modifyEntriesEvent(ItemGroups.FUNCTIONAL).register(content -> content.add(item)); items.add(item); diff --git a/src/main/java/systems/brn/serverstorage/lib/CraftingEntry.java b/src/main/java/systems/brn/serverstorage/lib/CraftingEntry.java index b243040..a506852 100644 --- a/src/main/java/systems/brn/serverstorage/lib/CraftingEntry.java +++ b/src/main/java/systems/brn/serverstorage/lib/CraftingEntry.java @@ -1,6 +1,5 @@ package systems.brn.serverstorage.lib; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.recipe.CraftingRecipe; import net.minecraft.recipe.RecipeEntry; @@ -33,11 +32,12 @@ public class CraftingEntry { for (Map.Entry entry : inputs.entrySet()) { ItemStack stackIn = entry.getKey(); Integer count = entry.getValue(); - if (count > 0 && stackIn.isEmpty() && stackIn.getItem().hasRecipeRemainder()) { - Item remainderItem = stackIn.getItem().getRecipeRemainder(); - if (remainderItem != null) { - ItemStack remainderStack = new ItemStack(stackIn.getItem().getRecipeRemainder(), count); - tempOutputStacks.add(remainderStack); + if (count > 0 && stackIn.isEmpty() && stackIn.getItem().getRecipeRemainder() != null) { + ItemStack remainderStack = stackIn.getItem().getRecipeRemainder(); + if (!remainderStack.isEmpty()) { + ItemStack remainderStackNew = remainderStack.copy(); + remainderStackNew.setCount(count); + tempOutputStacks.add(remainderStackNew); } } } diff --git a/src/main/java/systems/brn/serverstorage/lib/EventHandler.java b/src/main/java/systems/brn/serverstorage/lib/EventHandler.java index 430a45a..5a7519d 100644 --- a/src/main/java/systems/brn/serverstorage/lib/EventHandler.java +++ b/src/main/java/systems/brn/serverstorage/lib/EventHandler.java @@ -5,27 +5,27 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.world.ServerWorld; +import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; -import net.minecraft.util.TypedActionResult; import net.minecraft.world.World; import systems.brn.serverstorage.items.WirelessTerminalItem; import static systems.brn.serverstorage.ServerStorage.WIRELESS_TERMINAL; public class EventHandler { - public static TypedActionResult onItemUse(PlayerEntity playerEntity, World worldTemp, Hand hand) { + public static ActionResult onItemUse(PlayerEntity playerEntity, World worldTemp, Hand hand) { ItemStack itemStack = playerEntity.getStackInHand(hand); Item item = itemStack.getItem(); if (!worldTemp.isClient) { if (playerEntity instanceof ServerPlayerEntity player) { if (worldTemp instanceof ServerWorld world) { if (item == WIRELESS_TERMINAL) { - return WirelessTerminalItem.useItem(world, player, itemStack) ? TypedActionResult.success(itemStack) : TypedActionResult.pass(itemStack); + return WirelessTerminalItem.useItem(world, player, itemStack) ? ActionResult.SUCCESS : ActionResult.PASS; } } } } - return TypedActionResult.pass(itemStack); + return ActionResult.PASS; } } diff --git a/src/main/java/systems/brn/serverstorage/lib/PagedGui.java b/src/main/java/systems/brn/serverstorage/lib/PagedGui.java index 50d13a5..16213b1 100644 --- a/src/main/java/systems/brn/serverstorage/lib/PagedGui.java +++ b/src/main/java/systems/brn/serverstorage/lib/PagedGui.java @@ -187,7 +187,7 @@ public abstract class PagedGui extends SimpleGui { if (gui.canNextPage()) { return DisplayElement.of( new GuiElementBuilder(Items.PLAYER_HEAD) - .setName(Text.translatable("createWorld.customize.custom.next").formatted(Formatting.WHITE)) + .setName(Text.translatable("spectatorMenu.next_page").formatted(Formatting.WHITE)) .hideDefaultTooltip().noDefaults() .setSkullOwner(GUI_NEXT_PAGE) .setCallback((x, y, z) -> { @@ -198,7 +198,7 @@ public abstract class PagedGui extends SimpleGui { } else { return DisplayElement.of( new GuiElementBuilder(Items.PLAYER_HEAD) - .setName(Text.translatable("createWorld.customize.custom.next").formatted(Formatting.DARK_GRAY)) + .setName(Text.translatable("spectatorMenu.next_page").formatted(Formatting.DARK_GRAY)) .hideDefaultTooltip().noDefaults() .setSkullOwner(GUI_NEXT_PAGE_BLOCKED) ); @@ -209,7 +209,7 @@ public abstract class PagedGui extends SimpleGui { if (gui.canPreviousPage()) { return DisplayElement.of( new GuiElementBuilder(Items.PLAYER_HEAD) - .setName(Text.translatable("createWorld.customize.custom.prev").formatted(Formatting.WHITE)) + .setName(Text.translatable("spectatorMenu.previous_page").formatted(Formatting.WHITE)) .hideDefaultTooltip().noDefaults() .setSkullOwner(GUI_PREVIOUS_PAGE) .setCallback((x, y, z) -> { @@ -220,7 +220,7 @@ public abstract class PagedGui extends SimpleGui { } else { return DisplayElement.of( new GuiElementBuilder(Items.PLAYER_HEAD) - .setName(Text.translatable("createWorld.customize.custom.prev").formatted(Formatting.DARK_GRAY)) + .setName(Text.translatable("spectatorMenu.previous_page").formatted(Formatting.DARK_GRAY)) .hideDefaultTooltip().noDefaults() .setSkullOwner(GUI_PREVIOUS_PAGE_BLOCKED) ); diff --git a/src/main/java/systems/brn/serverstorage/lib/Util.java b/src/main/java/systems/brn/serverstorage/lib/Util.java index 973555d..1928924 100644 --- a/src/main/java/systems/brn/serverstorage/lib/Util.java +++ b/src/main/java/systems/brn/serverstorage/lib/Util.java @@ -5,7 +5,12 @@ import net.minecraft.component.DataComponentTypes; import net.minecraft.component.type.LoreComponent; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.recipe.*; +import net.minecraft.recipe.CraftingRecipe; +import net.minecraft.recipe.Ingredient; +import net.minecraft.recipe.RecipeEntry; +import net.minecraft.recipe.ServerRecipeManager; +import net.minecraft.recipe.input.CraftingRecipeInput; +import net.minecraft.registry.entry.RegistryEntry; import net.minecraft.server.MinecraftServer; import net.minecraft.text.RawFilteredPair; import net.minecraft.text.Style; @@ -130,40 +135,42 @@ public class Util { } public static ArrayList getCraftableRecipes(Map itemStackMap, MinecraftServer server) { - RecipeManager recipeManager = server.getRecipeManager(); - List> allRecipes = recipeManager.listAllOfType(RecipeType.CRAFTING); + ServerRecipeManager recipeManager = server.getRecipeManager(); + List> allRecipes = (List>) recipeManager.values(); ArrayList craftingEntries = new ArrayList<>(); - for (RecipeEntry recipe : allRecipes) { + for (RecipeEntry recipex : allRecipes) { + if (! (recipex.value() instanceof CraftingRecipe)) { + continue; + } + RecipeEntry recipe = (RecipeEntry) recipex; int maxAmount = Integer.MAX_VALUE; boolean canMake = true; HashMap finalInputs = new HashMap<>(); Map ingredientCounts = new HashMap<>(); // Count the occurrences of each ingredient in the recipe - for (Ingredient ingredient : recipe.value().getIngredients()) { - for (ItemStack stack : ingredient.getMatchingStacks()) { - if (stack.isEmpty()) continue; - ingredientCounts.put(stack.getItem(), ingredientCounts.getOrDefault(stack.getItem(), 0) + 1); + for (Ingredient ingredient : recipe.value().getIngredientPlacement().getIngredients()) { + for (RegistryEntry item : ingredient.getMatchingItems()) { + ingredientCounts.put(item.value(), ingredientCounts.getOrDefault(item.value(), 0) + 1); } } boolean usesAnyIngredient = false; - for (Ingredient ingredient : recipe.value().getIngredients()) { + for (Ingredient ingredient : recipe.value().getIngredientPlacement().getIngredients()) { int totalAvailable = 0; HashMap inputsTemp = new HashMap<>(); - for (ItemStack stack : ingredient.getMatchingStacks()) { - if (stack.isEmpty()) continue; + for (RegistryEntry item : ingredient.getMatchingItems()) { for (Map.Entry entry : itemStackMap.entrySet()) { ItemStack inventoryStack = entry.getKey(); int inventoryCount = entry.getValue(); - if (ItemStack.areItemsEqual(stack, inventoryStack)) { + if (item.value() == inventoryStack.getItem()) { totalAvailable += inventoryCount; - inputsTemp.put(stack, inventoryCount); + inputsTemp.put(item.value().getDefaultStack(), inventoryCount); usesAnyIngredient = true; } } @@ -173,10 +180,12 @@ public class Util { canMake = false; break; } - - int requiredCount = ingredient.getMatchingStacks()[0].getCount(); - int occurrences = ingredientCounts.get(ingredient.getMatchingStacks()[0].getItem()); - maxAmount = Math.min(maxAmount, totalAvailable / (requiredCount * occurrences)); + int occurrences = ingredientCounts.getOrDefault(ingredient.getMatchingItems().getFirst(),0); + if (occurrences == 0) { + canMake = false; + break; + } + maxAmount = Math.min(maxAmount, totalAvailable / occurrences); for (Map.Entry entry : inputsTemp.entrySet()) { ItemStack stackIn = entry.getKey(); @@ -186,7 +195,9 @@ public class Util { } if (canMake && maxAmount > 0 && usesAnyIngredient) { - ItemStack outputItem = recipe.value().getResult(server.getRegistryManager()).copy(); + List stacks = finalInputs.keySet().stream().toList(); + CraftingRecipeInput input = CraftingRecipeInput.create(stacks.size(), 1, stacks); + ItemStack outputItem = recipe.value().craft(input, server.getRegistryManager()).copy(); CraftingEntry finalEntry = new CraftingEntry(outputItem, recipe, finalInputs, maxAmount); craftingEntries.add(finalEntry); } diff --git a/src/main/java/systems/brn/serverstorage/screens/CraftingScreen.java b/src/main/java/systems/brn/serverstorage/screens/CraftingScreen.java index 91bb94b..2f9bb82 100644 --- a/src/main/java/systems/brn/serverstorage/screens/CraftingScreen.java +++ b/src/main/java/systems/brn/serverstorage/screens/CraftingScreen.java @@ -4,11 +4,14 @@ import eu.pb4.sgui.api.elements.GuiElementBuilder; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.inventory.Inventory; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.recipe.CraftingRecipe; import net.minecraft.recipe.Ingredient; import net.minecraft.recipe.RecipeEntry; +import net.minecraft.recipe.input.CraftingRecipeInput; +import net.minecraft.registry.entry.RegistryEntry; import net.minecraft.text.Text; import net.minecraft.util.Formatting; import systems.brn.serverstorage.blockentities.StorageInterfaceBlockEntity; @@ -108,7 +111,7 @@ public class CraftingScreen extends PagedGui implements Searchable { private boolean canCraft(RecipeEntry recipeEntry) { reindexDrives(); - for (Ingredient ingredient : recipeEntry.value().getIngredients()) { + for (Ingredient ingredient : recipeEntry.value().getIngredientPlacement().getIngredients()) { if (findMatchingStack(ingredient) == null) { return false; } @@ -121,7 +124,7 @@ public class CraftingScreen extends PagedGui implements Searchable { ArrayList stacksToRemove = new ArrayList<>(); // Check and remove ingredients for one crafting operation - for (Ingredient ingredient : recipeEntry.value().getIngredients()) { + for (Ingredient ingredient : recipeEntry.value().getIngredientPlacement().getIngredients()) { ItemStack stackToRemove = findMatchingStack(ingredient); if (stackToRemove == null) { return false; // Unable to find required ingredient @@ -135,7 +138,7 @@ public class CraftingScreen extends PagedGui implements Searchable { } // Add crafted item to the appropriate inventory - ItemStack outputStack = recipeEntry.value().getResult(storageScreen.getPlayer().getRegistryManager()).copy(); + ItemStack outputStack = recipeEntry.value().craft(CraftingRecipeInput.create(stacksToRemove.size(), 1, stacksToRemove), storageScreen.getPlayer().getRegistryManager()).copy(); if (toPlayerInventory) { PlayerInventory playerInventory = player.getInventory(); @@ -164,9 +167,10 @@ public class CraftingScreen extends PagedGui implements Searchable { ItemStack playerStack = playerInventory.getStack(i); if (ingredient.test(playerStack)) { ItemStack stackToRemove = playerStack.copy(); - for (ItemStack matchingStack : ingredient.getMatchingStacks()) { - if (matchingStack.getItem() == stackToRemove.getItem()) { - stackToRemove.setCount(matchingStack.getCount()); // Set count to ingredient requirement + for (RegistryEntry matchingItemx : ingredient.getMatchingItems()) { + Item matchingItem = matchingItemx.value(); + if (matchingItem == stackToRemove.getItem()) { + stackToRemove.setCount(1); // Set count to ingredient requirement break; } } @@ -175,10 +179,11 @@ public class CraftingScreen extends PagedGui implements Searchable { } // Check storage network - for (ItemStack stack : ingredient.getMatchingStacks()) { - if (this.storageScreen.getNetwork().canRemove(stack)) { - ItemStack stackToRemove = stack.copy(); - stackToRemove.setCount(ingredient.getMatchingStacks()[0].getCount()); // Set count to ingredient requirement + for (RegistryEntry itemx : ingredient.getMatchingItems()) { + Item item = itemx.value(); + if (this.storageScreen.getNetwork().canRemove(item.getDefaultStack())) { + ItemStack stackToRemove = item.getDefaultStack(); + stackToRemove.setCount(1); // Set count to ingredient requirement return stackToRemove; } } diff --git a/src/main/java/systems/brn/serverstorage/screens/StorageScreen.java b/src/main/java/systems/brn/serverstorage/screens/StorageScreen.java index ea8ecb1..586f101 100644 --- a/src/main/java/systems/brn/serverstorage/screens/StorageScreen.java +++ b/src/main/java/systems/brn/serverstorage/screens/StorageScreen.java @@ -379,7 +379,7 @@ public class StorageScreen extends PagedGui implements Searchable { @Override protected DisplayElement crafting() { - if (world != null && world.getGameRules().getBoolean(ServerStorage_Crafting_Enable)) { + if (world != null && ((ServerWorld) world).getGameRules().getBoolean(ServerStorage_Crafting_Enable)) { return DisplayElement.of( new GuiElementBuilder(Items.PLAYER_HEAD) .setName(Text.translatable("container.crafting").formatted(Formatting.WHITE)) diff --git a/src/main/resources/data/serverstorage/recipe/bus_connector.json b/src/main/resources/data/serverstorage/recipe/bus_connector.json index a309a11..aad3f1d 100644 --- a/src/main/resources/data/serverstorage/recipe/bus_connector.json +++ b/src/main/resources/data/serverstorage/recipe/bus_connector.json @@ -7,21 +7,11 @@ "BBP" ], "key": { - "C": { - "item": "serverstorage:material_cpu" - }, - "G": { - "item": "minecraft:gold_nugget" - }, - "P": { - "item": "serverstorage:material_pcb" - }, - "R": { - "item": "minecraft:redstone_block" - }, - "B": { - "item": "serverstorage:module_bus" - } + "C": "serverstorage:material_cpu", + "G": "minecraft:gold_nugget", + "P": "serverstorage:material_pcb", + "R": "minecraft:redstone_block", + "B": "serverstorage:module_bus" }, "result": { "id": "serverstorage:bus_connector", diff --git a/src/main/resources/data/serverstorage/recipe/cpu.json b/src/main/resources/data/serverstorage/recipe/cpu.json index 451890d..36345b1 100644 --- a/src/main/resources/data/serverstorage/recipe/cpu.json +++ b/src/main/resources/data/serverstorage/recipe/cpu.json @@ -7,15 +7,9 @@ "GSG" ], "key": { - "G": { - "item": "minecraft:gold_nugget" - }, - "P": { - "item": "minecraft:amethyst_shard" - }, - "S": { - "item": "serverstorage:material_cpu_substrate" - } + "G": "minecraft:gold_nugget", + "P": "minecraft:amethyst_shard", + "S": "serverstorage:material_cpu_substrate" }, "result": { "id": "serverstorage:material_cpu", diff --git a/src/main/resources/data/serverstorage/recipe/cpu_substrate.json b/src/main/resources/data/serverstorage/recipe/cpu_substrate.json index e75bf65..94de069 100644 --- a/src/main/resources/data/serverstorage/recipe/cpu_substrate.json +++ b/src/main/resources/data/serverstorage/recipe/cpu_substrate.json @@ -7,12 +7,8 @@ "AAA" ], "key": { - "D": { - "item": "minecraft:light_gray_dye" - }, - "A": { - "item": "minecraft:amethyst_shard" - } + "D": "minecraft:light_gray_dye", + "A": "minecraft:amethyst_shard" }, "result": { "id": "serverstorage:material_cpu_substrate", diff --git a/src/main/resources/data/serverstorage/recipe/diamond_antenna.json b/src/main/resources/data/serverstorage/recipe/diamond_antenna.json index e87582e..1452d68 100644 --- a/src/main/resources/data/serverstorage/recipe/diamond_antenna.json +++ b/src/main/resources/data/serverstorage/recipe/diamond_antenna.json @@ -7,9 +7,7 @@ "# " ], "key": { - "#": { - "item": "minecraft:diamond" - } + "#": "minecraft:diamond" }, "result": { "id": "serverstorage:diamond_antenna", diff --git a/src/main/resources/data/serverstorage/recipe/diamond_drive.json b/src/main/resources/data/serverstorage/recipe/diamond_drive.json index 4f0cef3..4418047 100644 --- a/src/main/resources/data/serverstorage/recipe/diamond_drive.json +++ b/src/main/resources/data/serverstorage/recipe/diamond_drive.json @@ -7,18 +7,10 @@ "HXH" ], "key": { - "H": { - "item": "serverstorage:diamond_head" - }, - "P": { - "item": "serverstorage:diamond_platter" - }, - "C": { - "item": "serverstorage:material_drive_casing" - }, - "X": { - "item": "serverstorage:material_drive_controller" - } + "H": "serverstorage:diamond_head", + "P": "serverstorage:diamond_platter", + "C": "serverstorage:material_drive_casing", + "X": "serverstorage:material_drive_controller" }, "result": { "id": "serverstorage:diamond_drive", diff --git a/src/main/resources/data/serverstorage/recipe/diamond_head.json b/src/main/resources/data/serverstorage/recipe/diamond_head.json index 65d83e9..d042456 100644 --- a/src/main/resources/data/serverstorage/recipe/diamond_head.json +++ b/src/main/resources/data/serverstorage/recipe/diamond_head.json @@ -7,9 +7,7 @@ " ##" ], "key": { - "#": { - "item": "minecraft:diamond" - } + "#": "minecraft:diamond" }, "result": { "id": "serverstorage:diamond_head", diff --git a/src/main/resources/data/serverstorage/recipe/diamond_platter.json b/src/main/resources/data/serverstorage/recipe/diamond_platter.json index 55db48b..5add9eb 100644 --- a/src/main/resources/data/serverstorage/recipe/diamond_platter.json +++ b/src/main/resources/data/serverstorage/recipe/diamond_platter.json @@ -7,9 +7,7 @@ "###" ], "key": { - "#": { - "item": "minecraft:diamond" - } + "#": "minecraft:diamond" }, "result": { "id": "serverstorage:diamond_platter", diff --git a/src/main/resources/data/serverstorage/recipe/drive_casing.json b/src/main/resources/data/serverstorage/recipe/drive_casing.json index 7b5cdc1..266fe58 100644 --- a/src/main/resources/data/serverstorage/recipe/drive_casing.json +++ b/src/main/resources/data/serverstorage/recipe/drive_casing.json @@ -7,15 +7,9 @@ "IRI" ], "key": { - "I": { - "item": "minecraft:iron_ingot" - }, - "R": { - "item": "minecraft:redstone" - }, - "P": { - "item": "minecraft:paper" - } + "I": "minecraft:iron_ingot", + "R": "minecraft:redstone", + "P": "minecraft:paper" }, "result": { "id": "serverstorage:material_drive_casing", diff --git a/src/main/resources/data/serverstorage/recipe/drive_container.json b/src/main/resources/data/serverstorage/recipe/drive_container.json index ef58952..e23c138 100644 --- a/src/main/resources/data/serverstorage/recipe/drive_container.json +++ b/src/main/resources/data/serverstorage/recipe/drive_container.json @@ -7,21 +7,11 @@ "DDP" ], "key": { - "C": { - "item": "serverstorage:material_cpu" - }, - "P": { - "item": "serverstorage:material_pcb" - }, - "R": { - "item": "minecraft:redstone_block" - }, - "D": { - "item": "serverstorage:module_drive" - }, - "B": { - "item": "serverstorage:module_bus" - } + "C": "serverstorage:material_cpu", + "P": "serverstorage:material_pcb", + "R": "minecraft:redstone_block", + "D": "serverstorage:module_drive", + "B": "serverstorage:module_bus" }, "result": { "id": "serverstorage:drive_container", diff --git a/src/main/resources/data/serverstorage/recipe/drive_controller.json b/src/main/resources/data/serverstorage/recipe/drive_controller.json index 76a8d4f..5e79769 100644 --- a/src/main/resources/data/serverstorage/recipe/drive_controller.json +++ b/src/main/resources/data/serverstorage/recipe/drive_controller.json @@ -7,18 +7,10 @@ "III" ], "key": { - "I": { - "item": "minecraft:gold_ingot" - }, - "X": { - "item": "serverstorage:material_drive_casing" - }, - "C": { - "item": "serverstorage:material_cpu" - }, - "S": { - "item": "serverstorage:material_pcb_substrate" - } + "I": "minecraft:gold_ingot", + "X": "serverstorage:material_drive_casing", + "C": "serverstorage:material_cpu", + "S": "serverstorage:material_pcb_substrate" }, "result": { "id": "serverstorage:material_drive_controller", diff --git a/src/main/resources/data/serverstorage/recipe/golden_antenna.json b/src/main/resources/data/serverstorage/recipe/golden_antenna.json index c4746b4..6a61e0e 100644 --- a/src/main/resources/data/serverstorage/recipe/golden_antenna.json +++ b/src/main/resources/data/serverstorage/recipe/golden_antenna.json @@ -7,9 +7,7 @@ "# " ], "key": { - "#": { - "item": "minecraft:gold_ingot" - } + "#": "minecraft:gold_ingot" }, "result": { "id": "serverstorage:golden_antenna", diff --git a/src/main/resources/data/serverstorage/recipe/golden_drive.json b/src/main/resources/data/serverstorage/recipe/golden_drive.json index 6031bd0..3d081cb 100644 --- a/src/main/resources/data/serverstorage/recipe/golden_drive.json +++ b/src/main/resources/data/serverstorage/recipe/golden_drive.json @@ -7,18 +7,10 @@ "HXH" ], "key": { - "H": { - "item": "serverstorage:golden_head" - }, - "P": { - "item": "serverstorage:golden_platter" - }, - "C": { - "item": "serverstorage:material_drive_casing" - }, - "X": { - "item": "serverstorage:material_drive_controller" - } + "H": "serverstorage:golden_head", + "P": "serverstorage:golden_platter", + "C": "serverstorage:material_drive_casing", + "X": "serverstorage:material_drive_controller" }, "result": { "id": "serverstorage:golden_drive", diff --git a/src/main/resources/data/serverstorage/recipe/golden_head.json b/src/main/resources/data/serverstorage/recipe/golden_head.json index 951cf2f..3fb1137 100644 --- a/src/main/resources/data/serverstorage/recipe/golden_head.json +++ b/src/main/resources/data/serverstorage/recipe/golden_head.json @@ -7,9 +7,7 @@ " ##" ], "key": { - "#": { - "item": "minecraft:gold_ingot" - } + "#": "minecraft:gold_ingot" }, "result": { "id": "serverstorage:golden_head", diff --git a/src/main/resources/data/serverstorage/recipe/golden_platter.json b/src/main/resources/data/serverstorage/recipe/golden_platter.json index f4f18de..e8d8560 100644 --- a/src/main/resources/data/serverstorage/recipe/golden_platter.json +++ b/src/main/resources/data/serverstorage/recipe/golden_platter.json @@ -7,9 +7,7 @@ "###" ], "key": { - "#": { - "item": "minecraft:gold_ingot" - } + "#": "minecraft:gold_ingot" }, "result": { "id": "serverstorage:golden_platter", diff --git a/src/main/resources/data/serverstorage/recipe/inventory_interface.json b/src/main/resources/data/serverstorage/recipe/inventory_interface.json index 545c8dc..5cfd0c2 100644 --- a/src/main/resources/data/serverstorage/recipe/inventory_interface.json +++ b/src/main/resources/data/serverstorage/recipe/inventory_interface.json @@ -7,30 +7,14 @@ "SPF" ], "key": { - "P": { - "item": "serverstorage:material_pcb" - }, - "U": { - "item": "serverstorage:material_cpu" - }, - "C": { - "item": "serverstorage:module_container" - }, - "B": { - "item": "serverstorage:module_bus" - }, - "H": { - "item": "minecraft:hopper" - }, - "S": { - "item": "minecraft:chest" - }, - "G": { - "item": "serverstorage:module_configuration" - }, - "F": { - "item": "serverstorage:module_filtering" - } + "P": "serverstorage:material_pcb", + "U": "serverstorage:material_cpu", + "C": "serverstorage:module_container", + "B": "serverstorage:module_bus", + "H": "minecraft:hopper", + "S": "minecraft:chest", + "G": "serverstorage:module_configuration", + "F": "serverstorage:module_filtering" }, "result": { "id": "serverstorage:inventory_interface", diff --git a/src/main/resources/data/serverstorage/recipe/iron_antenna.json b/src/main/resources/data/serverstorage/recipe/iron_antenna.json index b8b5951..150ba86 100644 --- a/src/main/resources/data/serverstorage/recipe/iron_antenna.json +++ b/src/main/resources/data/serverstorage/recipe/iron_antenna.json @@ -7,9 +7,7 @@ "# " ], "key": { - "#": { - "item": "minecraft:iron_ingot" - } + "#": "minecraft:iron_ingot" }, "result": { "id": "serverstorage:iron_antenna", diff --git a/src/main/resources/data/serverstorage/recipe/iron_drive.json b/src/main/resources/data/serverstorage/recipe/iron_drive.json index d80f19a..3d07fd8 100644 --- a/src/main/resources/data/serverstorage/recipe/iron_drive.json +++ b/src/main/resources/data/serverstorage/recipe/iron_drive.json @@ -7,18 +7,10 @@ "HXH" ], "key": { - "H": { - "item": "serverstorage:iron_head" - }, - "P": { - "item": "serverstorage:iron_platter" - }, - "C": { - "item": "serverstorage:material_drive_casing" - }, - "X": { - "item": "serverstorage:material_drive_controller" - } + "H": "serverstorage:iron_head", + "P": "serverstorage:iron_platter", + "C": "serverstorage:material_drive_casing", + "X": "serverstorage:material_drive_controller" }, "result": { "id": "serverstorage:iron_drive", diff --git a/src/main/resources/data/serverstorage/recipe/iron_head.json b/src/main/resources/data/serverstorage/recipe/iron_head.json index 26775b1..df7888a 100644 --- a/src/main/resources/data/serverstorage/recipe/iron_head.json +++ b/src/main/resources/data/serverstorage/recipe/iron_head.json @@ -7,9 +7,7 @@ " ##" ], "key": { - "#": { - "item": "minecraft:iron_ingot" - } + "#": "minecraft:iron_ingot" }, "result": { "id": "serverstorage:iron_head", diff --git a/src/main/resources/data/serverstorage/recipe/iron_platter.json b/src/main/resources/data/serverstorage/recipe/iron_platter.json index e1b5481..b41e59c 100644 --- a/src/main/resources/data/serverstorage/recipe/iron_platter.json +++ b/src/main/resources/data/serverstorage/recipe/iron_platter.json @@ -7,9 +7,7 @@ "###" ], "key": { - "#": { - "item": "minecraft:iron_ingot" - } + "#": "minecraft:iron_ingot" }, "result": { "id": "serverstorage:iron_platter", diff --git a/src/main/resources/data/serverstorage/recipe/module_antenna.json b/src/main/resources/data/serverstorage/recipe/module_antenna.json index 2366a0d..402e41d 100644 --- a/src/main/resources/data/serverstorage/recipe/module_antenna.json +++ b/src/main/resources/data/serverstorage/recipe/module_antenna.json @@ -7,21 +7,11 @@ "GGG" ], "key": { - "G": { - "item": "minecraft:gold_nugget" - }, - "R": { - "item": "minecraft:iron_ingot" - }, - "I": { - "item": "minecraft:gold_ingot" - }, - "C": { - "item": "serverstorage:material_cpu" - }, - "S": { - "item": "serverstorage:material_pcb_substrate" - } + "G": "minecraft:gold_nugget", + "R": "minecraft:iron_ingot", + "I": "minecraft:gold_ingot", + "C": "serverstorage:material_cpu", + "S": "serverstorage:material_pcb_substrate" }, "result": { "id": "serverstorage:module_antenna", diff --git a/src/main/resources/data/serverstorage/recipe/module_antenna_connector.json b/src/main/resources/data/serverstorage/recipe/module_antenna_connector.json index 7215754..d460d0b 100644 --- a/src/main/resources/data/serverstorage/recipe/module_antenna_connector.json +++ b/src/main/resources/data/serverstorage/recipe/module_antenna_connector.json @@ -7,18 +7,10 @@ "GGG" ], "key": { - "G": { - "item": "minecraft:gold_nugget" - }, - "R": { - "item": "minecraft:iron_ingot" - }, - "C": { - "item": "serverstorage:material_cpu" - }, - "S": { - "item": "serverstorage:material_pcb_substrate" - } + "G": "minecraft:gold_nugget", + "R": "minecraft:iron_ingot", + "C": "serverstorage:material_cpu", + "S": "serverstorage:material_pcb_substrate" }, "result": { "id": "serverstorage:module_antenna_connector", diff --git a/src/main/resources/data/serverstorage/recipe/module_bus.json b/src/main/resources/data/serverstorage/recipe/module_bus.json index bd066a7..803eb39 100644 --- a/src/main/resources/data/serverstorage/recipe/module_bus.json +++ b/src/main/resources/data/serverstorage/recipe/module_bus.json @@ -7,21 +7,11 @@ "GGG" ], "key": { - "G": { - "item": "minecraft:gold_nugget" - }, - "C": { - "item": "serverstorage:material_cpu" - }, - "S": { - "item": "serverstorage:material_pcb_substrate" - }, - "I": { - "item": "minecraft:iron_ingot" - }, - "A": { - "item": "minecraft:gold_ingot" - } + "G": "minecraft:gold_nugget", + "C": "serverstorage:material_cpu", + "S": "serverstorage:material_pcb_substrate", + "I": "minecraft:iron_ingot", + "A": "minecraft:gold_ingot" }, "result": { "id": "serverstorage:module_bus", diff --git a/src/main/resources/data/serverstorage/recipe/module_configuration.json b/src/main/resources/data/serverstorage/recipe/module_configuration.json index 97db703..ebee659 100644 --- a/src/main/resources/data/serverstorage/recipe/module_configuration.json +++ b/src/main/resources/data/serverstorage/recipe/module_configuration.json @@ -7,18 +7,10 @@ "GGG" ], "key": { - "G": { - "item": "minecraft:gold_nugget" - }, - "C": { - "item": "serverstorage:material_cpu" - }, - "S": { - "item": "serverstorage:material_pcb_substrate" - }, - "I": { - "item": "minecraft:iron_ingot" - } + "G": "minecraft:gold_nugget", + "C": "serverstorage:material_cpu", + "S": "serverstorage:material_pcb_substrate", + "I": "minecraft:iron_ingot" }, "result": { "id": "serverstorage:module_configuration", diff --git a/src/main/resources/data/serverstorage/recipe/module_container.json b/src/main/resources/data/serverstorage/recipe/module_container.json index a1078aa..d379b80 100644 --- a/src/main/resources/data/serverstorage/recipe/module_container.json +++ b/src/main/resources/data/serverstorage/recipe/module_container.json @@ -7,18 +7,10 @@ "GGG" ], "key": { - "G": { - "item": "minecraft:gold_nugget" - }, - "C": { - "item": "serverstorage:material_cpu" - }, - "S": { - "item": "serverstorage:material_pcb_substrate" - }, - "H": { - "item": "minecraft:chest" - } + "G": "minecraft:gold_nugget", + "C": "serverstorage:material_cpu", + "S": "serverstorage:material_pcb_substrate", + "H": "minecraft:chest" }, "result": { "id": "serverstorage:module_container", diff --git a/src/main/resources/data/serverstorage/recipe/module_display.json b/src/main/resources/data/serverstorage/recipe/module_display.json index f54ceb9..2d1f77e 100644 --- a/src/main/resources/data/serverstorage/recipe/module_display.json +++ b/src/main/resources/data/serverstorage/recipe/module_display.json @@ -7,18 +7,10 @@ "GGG" ], "key": { - "G": { - "item": "minecraft:gold_nugget" - }, - "C": { - "item": "serverstorage:material_cpu" - }, - "S": { - "item": "serverstorage:material_pcb_substrate" - }, - "D": { - "item": "minecraft:gray_stained_glass" - } + "G": "minecraft:gold_nugget", + "C": "serverstorage:material_cpu", + "S": "serverstorage:material_pcb_substrate", + "D": "minecraft:gray_stained_glass" }, "result": { "id": "serverstorage:module_display", diff --git a/src/main/resources/data/serverstorage/recipe/module_drive.json b/src/main/resources/data/serverstorage/recipe/module_drive.json index 4b28ba3..c585883 100644 --- a/src/main/resources/data/serverstorage/recipe/module_drive.json +++ b/src/main/resources/data/serverstorage/recipe/module_drive.json @@ -7,18 +7,10 @@ "GGG" ], "key": { - "G": { - "item": "minecraft:gold_nugget" - }, - "I": { - "item": "minecraft:gold_ingot" - }, - "C": { - "item": "serverstorage:material_cpu" - }, - "S": { - "item": "serverstorage:material_pcb_substrate" - } + "G": "minecraft:gold_nugget", + "I": "minecraft:gold_ingot", + "C": "serverstorage:material_cpu", + "S": "serverstorage:material_pcb_substrate" }, "result": { "id": "serverstorage:module_drive", diff --git a/src/main/resources/data/serverstorage/recipe/module_filtering.json b/src/main/resources/data/serverstorage/recipe/module_filtering.json index 9d3b702..2c7598b 100644 --- a/src/main/resources/data/serverstorage/recipe/module_filtering.json +++ b/src/main/resources/data/serverstorage/recipe/module_filtering.json @@ -7,21 +7,11 @@ "GGG" ], "key": { - "G": { - "item": "minecraft:gold_nugget" - }, - "C": { - "item": "serverstorage:material_cpu" - }, - "S": { - "item": "serverstorage:material_pcb_substrate" - }, - "L": { - "item": "minecraft:glass" - }, - "I": { - "item": "minecraft:iron_ingot" - } + "G": "minecraft:gold_nugget", + "C": "serverstorage:material_cpu", + "S": "serverstorage:material_pcb_substrate", + "L": "minecraft:glass", + "I": "minecraft:iron_ingot" }, "result": { "id": "serverstorage:module_filtering", diff --git a/src/main/resources/data/serverstorage/recipe/module_inventory.json b/src/main/resources/data/serverstorage/recipe/module_inventory.json index 909b004..a2b5863 100644 --- a/src/main/resources/data/serverstorage/recipe/module_inventory.json +++ b/src/main/resources/data/serverstorage/recipe/module_inventory.json @@ -7,21 +7,11 @@ "GGG" ], "key": { - "G": { - "item": "minecraft:gold_nugget" - }, - "C": { - "item": "serverstorage:material_cpu" - }, - "S": { - "item": "serverstorage:material_pcb_substrate" - }, - "H": { - "item": "minecraft:chest" - }, - "I": { - "item": "minecraft:iron_ingot" - } + "G": "minecraft:gold_nugget", + "C": "serverstorage:material_cpu", + "S": "serverstorage:material_pcb_substrate", + "H": "minecraft:chest", + "I": "minecraft:iron_ingot" }, "result": { "id": "serverstorage:module_inventory", diff --git a/src/main/resources/data/serverstorage/recipe/module_modem.json b/src/main/resources/data/serverstorage/recipe/module_modem.json index 429c856..60ff7dd 100644 --- a/src/main/resources/data/serverstorage/recipe/module_modem.json +++ b/src/main/resources/data/serverstorage/recipe/module_modem.json @@ -7,18 +7,10 @@ "GGG" ], "key": { - "G": { - "item": "minecraft:gold_nugget" - }, - "I": { - "item": "minecraft:gold_ingot" - }, - "C": { - "item": "serverstorage:material_cpu" - }, - "S": { - "item": "serverstorage:material_pcb_substrate" - } + "G": "minecraft:gold_nugget", + "I": "minecraft:gold_ingot", + "C": "serverstorage:material_cpu", + "S": "serverstorage:material_pcb_substrate" }, "result": { "id": "serverstorage:module_modem", diff --git a/src/main/resources/data/serverstorage/recipe/module_pagination.json b/src/main/resources/data/serverstorage/recipe/module_pagination.json index 13521d6..f204364 100644 --- a/src/main/resources/data/serverstorage/recipe/module_pagination.json +++ b/src/main/resources/data/serverstorage/recipe/module_pagination.json @@ -7,18 +7,10 @@ "GGG" ], "key": { - "G": { - "item": "minecraft:gold_nugget" - }, - "C": { - "item": "serverstorage:material_cpu" - }, - "S": { - "item": "serverstorage:material_pcb_substrate" - }, - "I": { - "item": "minecraft:iron_ingot" - } + "G": "minecraft:gold_nugget", + "C": "serverstorage:material_cpu", + "S": "serverstorage:material_pcb_substrate", + "I": "minecraft:iron_ingot" }, "result": { "id": "serverstorage:module_pagination", diff --git a/src/main/resources/data/serverstorage/recipe/module_pcb.json b/src/main/resources/data/serverstorage/recipe/module_pcb.json index 2ebb5cd..3c7f5f1 100644 --- a/src/main/resources/data/serverstorage/recipe/module_pcb.json +++ b/src/main/resources/data/serverstorage/recipe/module_pcb.json @@ -7,15 +7,9 @@ "GGG" ], "key": { - "G": { - "item": "minecraft:gold_nugget" - }, - "C": { - "item": "serverstorage:material_cpu" - }, - "S": { - "item": "serverstorage:material_pcb_substrate" - } + "G": "minecraft:gold_nugget", + "C": "serverstorage:material_cpu", + "S": "serverstorage:material_pcb_substrate" }, "result": { "id": "serverstorage:module_pcb", diff --git a/src/main/resources/data/serverstorage/recipe/module_radio.json b/src/main/resources/data/serverstorage/recipe/module_radio.json index d510a1b..c421565 100644 --- a/src/main/resources/data/serverstorage/recipe/module_radio.json +++ b/src/main/resources/data/serverstorage/recipe/module_radio.json @@ -7,18 +7,10 @@ "GGG" ], "key": { - "G": { - "item": "minecraft:gold_nugget" - }, - "I": { - "item": "minecraft:gold_ingot" - }, - "C": { - "item": "serverstorage:material_cpu" - }, - "S": { - "item": "serverstorage:material_pcb_substrate" - } + "G": "minecraft:gold_nugget", + "I": "minecraft:gold_ingot", + "C": "serverstorage:material_cpu", + "S": "serverstorage:material_pcb_substrate" }, "result": { "id": "serverstorage:module_radio", diff --git a/src/main/resources/data/serverstorage/recipe/module_transport.json b/src/main/resources/data/serverstorage/recipe/module_transport.json index d5322a4..45711c1 100644 --- a/src/main/resources/data/serverstorage/recipe/module_transport.json +++ b/src/main/resources/data/serverstorage/recipe/module_transport.json @@ -7,18 +7,10 @@ "GGG" ], "key": { - "G": { - "item": "minecraft:gold_nugget" - }, - "C": { - "item": "serverstorage:material_cpu" - }, - "S": { - "item": "serverstorage:material_pcb_substrate" - }, - "H": { - "item": "minecraft:hopper" - } + "G": "minecraft:gold_nugget", + "C": "serverstorage:material_cpu", + "S": "serverstorage:material_pcb_substrate", + "H": "minecraft:hopper" }, "result": { "id": "serverstorage:module_transport", diff --git a/src/main/resources/data/serverstorage/recipe/netherite_antenna.json b/src/main/resources/data/serverstorage/recipe/netherite_antenna.json index 2d0687a..83222cd 100644 --- a/src/main/resources/data/serverstorage/recipe/netherite_antenna.json +++ b/src/main/resources/data/serverstorage/recipe/netherite_antenna.json @@ -1,16 +1,10 @@ { "type": "minecraft:smithing_transform", - "addition": { - "item": "minecraft:netherite_ingot" - }, - "base": { - "item": "serverstorage:diamond_antenna" - }, + "addition": "minecraft:netherite_ingot", + "base": "serverstorage:diamond_antenna", "result": { "count": 1, "id": "serverstorage:netherite_antenna" }, - "template": { - "item": "serverstorage:module_netherite_upgrade" - } + "template": "serverstorage:module_netherite_upgrade" } \ No newline at end of file diff --git a/src/main/resources/data/serverstorage/recipe/netherite_drive.json b/src/main/resources/data/serverstorage/recipe/netherite_drive.json index 601333d..41c3464 100644 --- a/src/main/resources/data/serverstorage/recipe/netherite_drive.json +++ b/src/main/resources/data/serverstorage/recipe/netherite_drive.json @@ -7,18 +7,10 @@ "HXH" ], "key": { - "H": { - "item": "serverstorage:netherite_head" - }, - "P": { - "item": "serverstorage:netherite_platter" - }, - "C": { - "item": "serverstorage:material_drive_casing" - }, - "X": { - "item": "serverstorage:material_drive_controller" - } + "H": "serverstorage:netherite_head", + "P": "serverstorage:netherite_platter", + "C": "serverstorage:material_drive_casing", + "X": "serverstorage:material_drive_controller" }, "result": { "id": "serverstorage:netherite_drive", diff --git a/src/main/resources/data/serverstorage/recipe/netherite_head.json b/src/main/resources/data/serverstorage/recipe/netherite_head.json index 9017702..a17adbd 100644 --- a/src/main/resources/data/serverstorage/recipe/netherite_head.json +++ b/src/main/resources/data/serverstorage/recipe/netherite_head.json @@ -1,16 +1,10 @@ { "type": "minecraft:smithing_transform", - "addition": { - "item": "minecraft:netherite_ingot" - }, - "base": { - "item": "serverstorage:diamond_head" - }, + "addition": "minecraft:netherite_ingot", + "base": "serverstorage:diamond_head", "result": { "count": 1, "id": "serverstorage:netherite_head" }, - "template": { - "item": "serverstorage:module_netherite_upgrade" - } + "template": "serverstorage:module_netherite_upgrade" } \ No newline at end of file diff --git a/src/main/resources/data/serverstorage/recipe/netherite_platter.json b/src/main/resources/data/serverstorage/recipe/netherite_platter.json index 56fb1c2..b252b7c 100644 --- a/src/main/resources/data/serverstorage/recipe/netherite_platter.json +++ b/src/main/resources/data/serverstorage/recipe/netherite_platter.json @@ -1,16 +1,10 @@ { "type": "minecraft:smithing_transform", - "addition": { - "item": "minecraft:netherite_ingot" - }, - "base": { - "item": "serverstorage:diamond_platter" - }, + "addition": "minecraft:netherite_ingot", + "base": "serverstorage:diamond_platter", "result": { "count": 1, "id": "serverstorage:netherite_platter" }, - "template": { - "item": "serverstorage:module_netherite_upgrade" - } + "template": "serverstorage:module_netherite_upgrade" } \ No newline at end of file diff --git a/src/main/resources/data/serverstorage/recipe/netherite_upgrade.json b/src/main/resources/data/serverstorage/recipe/netherite_upgrade.json index 4e1c8b6..99ff589 100644 --- a/src/main/resources/data/serverstorage/recipe/netherite_upgrade.json +++ b/src/main/resources/data/serverstorage/recipe/netherite_upgrade.json @@ -7,15 +7,9 @@ "SLS" ], "key": { - "C": { - "item": "serverstorage:material_cpu" - }, - "S": { - "item": "serverstorage:material_pcb_substrate" - }, - "L": { - "item": "minecraft:glass" - } + "C": "serverstorage:material_cpu", + "S": "serverstorage:material_pcb_substrate", + "L": "minecraft:glass" }, "result": { "id": "serverstorage:module_netherite_upgrade", diff --git a/src/main/resources/data/serverstorage/recipe/pcb.json b/src/main/resources/data/serverstorage/recipe/pcb.json index ec57ff0..15c780a 100644 --- a/src/main/resources/data/serverstorage/recipe/pcb.json +++ b/src/main/resources/data/serverstorage/recipe/pcb.json @@ -7,12 +7,8 @@ "GGG" ], "key": { - "G": { - "item": "minecraft:lime_dye" - }, - "P": { - "item": "serverstorage:material_pcb_substrate" - } + "G": "minecraft:lime_dye", + "P": "serverstorage:material_pcb_substrate" }, "result": { "id": "serverstorage:material_pcb", diff --git a/src/main/resources/data/serverstorage/recipe/pcb_substrate.json b/src/main/resources/data/serverstorage/recipe/pcb_substrate.json index ebeef7b..12a60ff 100644 --- a/src/main/resources/data/serverstorage/recipe/pcb_substrate.json +++ b/src/main/resources/data/serverstorage/recipe/pcb_substrate.json @@ -7,12 +7,8 @@ "AAA" ], "key": { - "G": { - "item": "minecraft:green_dye" - }, - "A": { - "item": "minecraft:amethyst_shard" - } + "G": "minecraft:green_dye", + "A": "minecraft:amethyst_shard" }, "result": { "id": "serverstorage:material_pcb_substrate", diff --git a/src/main/resources/data/serverstorage/recipe/radio_interface.json b/src/main/resources/data/serverstorage/recipe/radio_interface.json index a647549..2a6af46 100644 --- a/src/main/resources/data/serverstorage/recipe/radio_interface.json +++ b/src/main/resources/data/serverstorage/recipe/radio_interface.json @@ -7,30 +7,14 @@ "MPF" ], "key": { - "P": { - "item": "serverstorage:material_pcb" - }, - "U": { - "item": "serverstorage:material_cpu" - }, - "C": { - "item": "serverstorage:module_radio" - }, - "B": { - "item": "serverstorage:module_bus" - }, - "H": { - "item": "serverstorage:module_antenna_connector" - }, - "M": { - "item": "serverstorage:module_modem" - }, - "G": { - "item": "serverstorage:module_configuration" - }, - "F": { - "item": "serverstorage:module_pagination" - } + "P": "serverstorage:material_pcb", + "U": "serverstorage:material_cpu", + "C": "serverstorage:module_radio", + "B": "serverstorage:module_bus", + "H": "serverstorage:module_antenna_connector", + "M": "serverstorage:module_modem", + "G": "serverstorage:module_configuration", + "F": "serverstorage:module_pagination" }, "result": { "id": "serverstorage:radio_interface", diff --git a/src/main/resources/data/serverstorage/recipe/storage.json b/src/main/resources/data/serverstorage/recipe/storage.json index 6ef3691..74d3c9e 100644 --- a/src/main/resources/data/serverstorage/recipe/storage.json +++ b/src/main/resources/data/serverstorage/recipe/storage.json @@ -7,33 +7,15 @@ "ILX" ], "key": { - "L": { - "item": "minecraft:diamond_block" - }, - "D": { - "item": "serverstorage:module_display" - }, - "F": { - "item": "serverstorage:module_filtering" - }, - "C": { - "item": "serverstorage:module_configuration" - }, - "P": { - "item": "serverstorage:module_pagination" - }, - "B": { - "item": "serverstorage:module_bus" - }, - "I": { - "item": "serverstorage:module_inventory" - }, - "X": { - "item": "serverstorage:material_cpu" - }, - "O": { - "item": "serverstorage:material_pcb" - } + "L": "minecraft:diamond_block", + "D": "serverstorage:module_display", + "F": "serverstorage:module_filtering", + "C": "serverstorage:module_configuration", + "P": "serverstorage:module_pagination", + "B": "serverstorage:module_bus", + "I": "serverstorage:module_inventory", + "X": "serverstorage:material_cpu", + "O": "serverstorage:material_pcb" }, "result": { "id": "serverstorage:storage", diff --git a/src/main/resources/data/serverstorage/recipe/wireless_terminal.json b/src/main/resources/data/serverstorage/recipe/wireless_terminal.json index 28f2d89..ed3e0be 100644 --- a/src/main/resources/data/serverstorage/recipe/wireless_terminal.json +++ b/src/main/resources/data/serverstorage/recipe/wireless_terminal.json @@ -7,30 +7,14 @@ "UMP" ], "key": { - "P": { - "item": "serverstorage:material_pcb" - }, - "U": { - "item": "serverstorage:material_cpu" - }, - "A": { - "item": "serverstorage:module_antenna" - }, - "C": { - "item": "serverstorage:module_radio" - }, - "H": { - "item": "serverstorage:module_antenna_connector" - }, - "M": { - "item": "serverstorage:module_modem" - }, - "G": { - "item": "serverstorage:module_configuration" - }, - "F": { - "item": "serverstorage:module_pagination" - } + "P": "serverstorage:material_pcb", + "U": "serverstorage:material_cpu", + "A": "serverstorage:module_antenna", + "C": "serverstorage:module_radio", + "H": "serverstorage:module_antenna_connector", + "M": "serverstorage:module_modem", + "G": "serverstorage:module_configuration", + "F": "serverstorage:module_pagination" }, "result": { "id": "serverstorage:wireless_terminal",