Fix some stuff, crafting is broken

This commit is contained in:
Bruno Rybársky 2024-11-01 23:24:42 +01:00
parent f1dd6b9c3c
commit 4be669f41f
No known key found for this signature in database
GPG Key ID: 6C9206A821C70598
65 changed files with 310 additions and 573 deletions

@ -1,5 +1,5 @@
plugins { plugins {
id 'fabric-loom' version '1.6-SNAPSHOT' id 'fabric-loom' version '1.8-SNAPSHOT'
id 'maven-publish' id 'maven-publish'
} }

@ -3,19 +3,19 @@ org.gradle.jvmargs=-Xmx1G
# Fabric Properties # Fabric Properties
# check these on https://modmuss50.me/fabric.html # check these on https://modmuss50.me/fabric.html
minecraft_version=1.21.1 minecraft_version=1.21.3
yarn_mappings=1.21.1+build.3 yarn_mappings=1.21.3+build.2
loader_version=0.16.0 loader_version=0.16.8
# Fabric API # Fabric API
fabric_version=0.102.1+1.21.1 fabric_version=0.107.0+1.21.3
# Mod Properties # Mod Properties
mod_version=3.2.9 mod_version=3.3.0
maven_group=systems.brn maven_group=systems.brn
archives_base_name=Serverstorage archives_base_name=Serverstorage
# Dependencies # Dependencies
polymer_version=0.9.9+1.21 polymer_version=0.10.1+1.21.3
server_translations_api_version=2.3.1+1.21-pre2 server_translations_api_version=2.4.0+1.21.2-rc1
servergui_version=1.6.0+1.21 servergui_version=1.7.2+1.21.2

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists 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 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME

@ -56,7 +56,7 @@ public class ServerStorage implements ModInitializer {
public static BlockEntityType<InventoryInterfaceBlockEntity> INVENTORY_INTERFACE_BLOCK_ENTITY; public static BlockEntityType<InventoryInterfaceBlockEntity> INVENTORY_INTERFACE_BLOCK_ENTITY;
public static final GameRules.Key<GameRules.BooleanRule> ServerStorage_Crafting_Enable = public static final GameRules.Key<GameRules.BooleanRule> 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<GameRules.BooleanRule> ServerStorage_Terminal_Enable = public static final GameRules.Key<GameRules.BooleanRule> ServerStorage_Terminal_Enable =
GameRuleRegistry.register("serverstorage_terminal_module", GameRules.Category.MISC, GameRuleFactory.createBooleanRule(true)); GameRuleRegistry.register("serverstorage_terminal_module", GameRules.Category.MISC, GameRuleFactory.createBooleanRule(true));

@ -6,6 +6,7 @@ import net.minecraft.inventory.Inventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtCompound;
import net.minecraft.registry.RegistryWrapper; import net.minecraft.registry.RegistryWrapper;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.state.property.EnumProperty; import net.minecraft.state.property.EnumProperty;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
@ -107,7 +108,7 @@ public class InventoryInterfaceBlockEntity extends BlockEntity {
} }
public int processIncoming(ItemStack stack, int count) { 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); BlockPos targetedPos = pos.offset(direction);
BlockEntity targetedBlockEntity = world.getBlockEntity(targetedPos); BlockEntity targetedBlockEntity = world.getBlockEntity(targetedPos);
EnumProperty<ConnectionType> connectionType = getPropertyForDirection(direction); EnumProperty<ConnectionType> connectionType = getPropertyForDirection(direction);
@ -124,7 +125,7 @@ public class InventoryInterfaceBlockEntity extends BlockEntity {
} }
public static <T extends BlockEntity> void tick(World world, BlockPos blockPos, BlockState ignoredState, T ignoredt) { public static <T extends BlockEntity> 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; return;
} }
InventoryInterfaceBlockEntity blockEntity = (InventoryInterfaceBlockEntity) world.getBlockEntity(blockPos); InventoryInterfaceBlockEntity blockEntity = (InventoryInterfaceBlockEntity) world.getBlockEntity(blockPos);

@ -7,7 +7,10 @@ import eu.pb4.polymer.blocks.api.PolymerTexturedBlock;
import net.minecraft.block.*; import net.minecraft.block.*;
import net.minecraft.registry.Registries; import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry; import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import xyz.nucleoid.packettweaker.PacketContext;
import static systems.brn.serverstorage.ServerStorage.*; import static systems.brn.serverstorage.ServerStorage.*;
@ -27,14 +30,14 @@ public class BusConnectorBlock extends ConnectedBlock implements PolymerTextured
} }
@Override @Override
public BlockState getPolymerBlockState(BlockState state) { public BlockState getPolymerBlockState(BlockState state, PacketContext packetContext) {
return this.polymerBlockState; return this.polymerBlockState;
} }
public static void register() { public static void register() {
var modId = id(BUS_CONNECTOR_MODEL_ID); var modId = id(BUS_CONNECTOR_MODEL_ID);
BUS_CONNECTOR_BLOCK = Registry.register(Registries.BLOCK, modId, 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(); BUS_CONNECTOR_BLOCK.setDefaultState();
} }
} }

@ -16,6 +16,7 @@ import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.block.WireOrientation;
import systems.brn.serverstorage.lib.ConnectionType; import systems.brn.serverstorage.lib.ConnectionType;
import java.util.HashMap; import java.util.HashMap;
@ -92,9 +93,9 @@ public class ConnectedBlock extends SimplePolymerBlock {
} }
@Override @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); 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) { private BlockState updateState(BlockState state, World world, BlockPos pos) {

@ -3,15 +3,17 @@ package systems.brn.serverstorage.blocks;
import eu.pb4.polymer.blocks.api.PolymerTexturedBlock; import eu.pb4.polymer.blocks.api.PolymerTexturedBlock;
import eu.pb4.polymer.core.api.block.PolymerBlockUtils; import eu.pb4.polymer.core.api.block.PolymerBlockUtils;
import net.fabricmc.fabric.api.event.player.UseBlockCallback; 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.*;
import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemPlacementContext; import net.minecraft.item.ItemPlacementContext;
import net.minecraft.registry.Registries; import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry; import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.state.StateManager; 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.ActionResult;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
@ -23,6 +25,7 @@ import net.minecraft.world.World;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import systems.brn.serverstorage.blockentities.HardDriveContainerBlockEntity; import systems.brn.serverstorage.blockentities.HardDriveContainerBlockEntity;
import systems.brn.serverstorage.lib.StorageNetwork; import systems.brn.serverstorage.lib.StorageNetwork;
import xyz.nucleoid.packettweaker.PacketContext;
import java.util.HashMap; import java.util.HashMap;
@ -31,7 +34,7 @@ import static systems.brn.serverstorage.ServerStorage.*;
public class HardDriveContainerBlock extends ConnectedBlock implements PolymerTexturedBlock, BlockEntityProvider { public class HardDriveContainerBlock extends ConnectedBlock implements PolymerTexturedBlock, BlockEntityProvider {
final Identifier identifier; final Identifier identifier;
public static final DirectionProperty FACING = FacingBlock.FACING; public static final EnumProperty<Direction> FACING = FacingBlock.FACING;
private final HashMap<Direction, BlockState> rotations; private final HashMap<Direction, BlockState> rotations;
public HardDriveContainerBlock(AbstractBlock.Settings settings, Identifier identifier) { public HardDriveContainerBlock(AbstractBlock.Settings settings, Identifier identifier) {
@ -53,7 +56,7 @@ public class HardDriveContainerBlock extends ConnectedBlock implements PolymerTe
} }
@Override @Override
public BlockState getPolymerBlockState(BlockState state) { public BlockState getPolymerBlockState(BlockState state, PacketContext context) {
Direction direction = state.get(FACING); Direction direction = state.get(FACING);
return rotations.get(direction); return rotations.get(direction);
} }
@ -61,7 +64,7 @@ public class HardDriveContainerBlock extends ConnectedBlock implements PolymerTe
public static void register() { public static void register() {
var modId = id(HARD_DRIVE_CONTAINER_BLOCK_MODEL_ID); var modId = id(HARD_DRIVE_CONTAINER_BLOCK_MODEL_ID);
HARD_DRIVE_CONTAINER_BLOCK = Registry.register(Registries.BLOCK, modId, 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); UseBlockCallback.EVENT.register(HardDriveContainerBlock::onUse);
HARD_DRIVE_CONTAINER_BLOCK.setDefaultState(); HARD_DRIVE_CONTAINER_BLOCK.setDefaultState();
@ -69,7 +72,7 @@ public class HardDriveContainerBlock extends ConnectedBlock implements PolymerTe
HARD_DRIVE_CONTAINER_BLOCK_ENTITY = Registry.register( HARD_DRIVE_CONTAINER_BLOCK_ENTITY = Registry.register(
Registries.BLOCK_ENTITY_TYPE, Registries.BLOCK_ENTITY_TYPE,
modId, 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); PolymerBlockUtils.registerBlockEntity(HARD_DRIVE_CONTAINER_BLOCK_ENTITY);
} }

@ -4,6 +4,7 @@ import eu.pb4.polymer.blocks.api.PolymerTexturedBlock;
import eu.pb4.polymer.core.api.block.PolymerBlockUtils; import eu.pb4.polymer.core.api.block.PolymerBlockUtils;
import eu.pb4.sgui.api.elements.GuiElementBuilder; import eu.pb4.sgui.api.elements.GuiElementBuilder;
import net.fabricmc.fabric.api.event.player.UseBlockCallback; 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.*;
import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BlockEntityTicker; import net.minecraft.block.entity.BlockEntityTicker;
@ -13,10 +14,12 @@ import net.minecraft.item.ItemPlacementContext;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.registry.Registries; import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry; 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.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld; import net.minecraft.server.world.ServerWorld;
import net.minecraft.state.StateManager; 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.text.Text;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
import net.minecraft.util.Formatting; 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.lib.PagedGui;
import systems.brn.serverstorage.screens.SearchScreen; import systems.brn.serverstorage.screens.SearchScreen;
import systems.brn.serverstorage.screens.SettingsScreen; import systems.brn.serverstorage.screens.SettingsScreen;
import xyz.nucleoid.packettweaker.PacketContext;
import java.util.HashMap; import java.util.HashMap;
@ -39,7 +43,7 @@ import static systems.brn.serverstorage.lib.PagedGui.*;
public class InventoryInterfaceBlock extends ConnectedBlock implements PolymerTexturedBlock, BlockEntityProvider { public class InventoryInterfaceBlock extends ConnectedBlock implements PolymerTexturedBlock, BlockEntityProvider {
final Identifier identifier; final Identifier identifier;
public static final DirectionProperty FACING = FacingBlock.FACING; public static final EnumProperty<Direction> FACING = FacingBlock.FACING;
private final HashMap<Direction, BlockState> rotations; private final HashMap<Direction, BlockState> rotations;
public InventoryInterfaceBlock(Settings settings, Identifier identifier) { public InventoryInterfaceBlock(Settings settings, Identifier identifier) {
@ -61,7 +65,7 @@ public class InventoryInterfaceBlock extends ConnectedBlock implements PolymerTe
} }
@Override @Override
public BlockState getPolymerBlockState(BlockState state) { public BlockState getPolymerBlockState(BlockState state, PacketContext packetContext) {
Direction direction = state.get(FACING); Direction direction = state.get(FACING);
return rotations.get(direction); return rotations.get(direction);
} }
@ -69,14 +73,15 @@ public class InventoryInterfaceBlock extends ConnectedBlock implements PolymerTe
public static void register() { public static void register() {
var modId = id(INVENTORY_INTERFACE_BLOCK_MODEL_ID); var modId = id(INVENTORY_INTERFACE_BLOCK_MODEL_ID);
INVENTORY_INTERFACE_BLOCK = Registry.register(Registries.BLOCK, modId, 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); UseBlockCallback.EVENT.register(InventoryInterfaceBlock::onUse);
INVENTORY_INTERFACE_BLOCK.setDefaultState(); INVENTORY_INTERFACE_BLOCK.setDefaultState();
INVENTORY_INTERFACE_BLOCK_ENTITY = Registry.register( INVENTORY_INTERFACE_BLOCK_ENTITY = Registry.register(
Registries.BLOCK_ENTITY_TYPE, Registries.BLOCK_ENTITY_TYPE,
modId, 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); PolymerBlockUtils.registerBlockEntity(INVENTORY_INTERFACE_BLOCK_ENTITY);
} }
@ -150,7 +155,7 @@ public class InventoryInterfaceBlock extends ConnectedBlock implements PolymerTe
Block block = state.getBlock(); Block block = state.getBlock();
if (block instanceof InventoryInterfaceBlock) { 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); playerEntity.sendMessage(Text.translatable("message.serverstorage.block_disabled"), true);
return ActionResult.PASS; return ActionResult.PASS;
} }

@ -3,18 +3,20 @@ package systems.brn.serverstorage.blocks;
import eu.pb4.polymer.blocks.api.PolymerTexturedBlock; import eu.pb4.polymer.blocks.api.PolymerTexturedBlock;
import eu.pb4.polymer.core.api.block.PolymerBlockUtils; import eu.pb4.polymer.core.api.block.PolymerBlockUtils;
import net.fabricmc.fabric.api.event.player.UseBlockCallback; 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.*;
import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemPlacementContext; import net.minecraft.item.ItemPlacementContext;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.registry.Registries; import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry; 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.network.ServerPlayerEntity;
import net.minecraft.state.StateManager; 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.ActionResult;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.Identifier; 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.SessionStorageClass;
import systems.brn.serverstorage.lib.WirelessTerminalComponents; import systems.brn.serverstorage.lib.WirelessTerminalComponents;
import systems.brn.serverstorage.screens.RadioBlockPlayerMangementScreen; import systems.brn.serverstorage.screens.RadioBlockPlayerMangementScreen;
import xyz.nucleoid.packettweaker.PacketContext;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
@ -40,7 +43,7 @@ import static systems.brn.serverstorage.lib.Util.removePosition;
public class RadioInterfaceBlock extends ConnectedBlock implements PolymerTexturedBlock, BlockEntityProvider { public class RadioInterfaceBlock extends ConnectedBlock implements PolymerTexturedBlock, BlockEntityProvider {
final Identifier identifier; final Identifier identifier;
public static final DirectionProperty FACING = FacingBlock.FACING; public static final EnumProperty<Direction> FACING = FacingBlock.FACING;
private final HashMap<Direction, BlockState> rotations; private final HashMap<Direction, BlockState> rotations;
public RadioInterfaceBlock(Settings settings, Identifier identifier) { public RadioInterfaceBlock(Settings settings, Identifier identifier) {
@ -63,7 +66,7 @@ public class RadioInterfaceBlock extends ConnectedBlock implements PolymerTextur
} }
@Override @Override
public BlockState getPolymerBlockState(BlockState state) { public BlockState getPolymerBlockState(BlockState state, PacketContext packetContext) {
Direction direction = state.get(FACING); Direction direction = state.get(FACING);
return rotations.get(direction); return rotations.get(direction);
} }
@ -71,7 +74,7 @@ public class RadioInterfaceBlock extends ConnectedBlock implements PolymerTextur
public static void register() { public static void register() {
var modId = id(RADIO_INTERFACE_BLOCK_MODEL_ID); var modId = id(RADIO_INTERFACE_BLOCK_MODEL_ID);
RADIO_INTERFACE_BLOCK = Registry.register(Registries.BLOCK, modId, 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); UseBlockCallback.EVENT.register(RadioInterfaceBlock::onUse);
RADIO_INTERFACE_BLOCK.setDefaultState(); RADIO_INTERFACE_BLOCK.setDefaultState();
@ -79,8 +82,9 @@ public class RadioInterfaceBlock extends ConnectedBlock implements PolymerTextur
RADIO_INTERFACE_BLOCK_ENTITY = Registry.register( RADIO_INTERFACE_BLOCK_ENTITY = Registry.register(
Registries.BLOCK_ENTITY_TYPE, Registries.BLOCK_ENTITY_TYPE,
modId, 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); PolymerBlockUtils.registerBlockEntity(RADIO_INTERFACE_BLOCK_ENTITY);
} }

@ -3,9 +3,9 @@ package systems.brn.serverstorage.blocks;
import eu.pb4.polymer.blocks.api.PolymerTexturedBlock; import eu.pb4.polymer.blocks.api.PolymerTexturedBlock;
import eu.pb4.polymer.core.api.block.PolymerBlockUtils; import eu.pb4.polymer.core.api.block.PolymerBlockUtils;
import net.fabricmc.fabric.api.event.player.UseBlockCallback; 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.*;
import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.component.DataComponentTypes; import net.minecraft.component.DataComponentTypes;
import net.minecraft.component.type.WrittenBookContentComponent; import net.minecraft.component.type.WrittenBookContentComponent;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
@ -14,9 +14,12 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.registry.Registries; import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry; 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.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.state.StateManager; 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.RawFilteredPair;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
@ -29,6 +32,7 @@ import net.minecraft.world.World;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import systems.brn.serverstorage.blockentities.StorageInterfaceBlockEntity; import systems.brn.serverstorage.blockentities.StorageInterfaceBlockEntity;
import systems.brn.serverstorage.screens.StorageScreen; import systems.brn.serverstorage.screens.StorageScreen;
import xyz.nucleoid.packettweaker.PacketContext;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -38,7 +42,7 @@ import static systems.brn.serverstorage.lib.Util.generateBookContent;
public class StorageInterfaceBlock extends ConnectedBlock implements PolymerTexturedBlock, BlockEntityProvider { public class StorageInterfaceBlock extends ConnectedBlock implements PolymerTexturedBlock, BlockEntityProvider {
final Identifier identifier; final Identifier identifier;
public static final DirectionProperty FACING = FacingBlock.FACING; public static final EnumProperty<Direction> FACING = FacingBlock.FACING;
private final HashMap<Direction, BlockState> rotations; private final HashMap<Direction, BlockState> rotations;
public StorageInterfaceBlock(Settings settings, Identifier identifier) { public StorageInterfaceBlock(Settings settings, Identifier identifier) {
@ -60,7 +64,7 @@ public class StorageInterfaceBlock extends ConnectedBlock implements PolymerText
} }
@Override @Override
public BlockState getPolymerBlockState(BlockState state) { public BlockState getPolymerBlockState(BlockState state, PacketContext packetContext) {
Direction direction = state.get(FACING); Direction direction = state.get(FACING);
return rotations.get(direction); return rotations.get(direction);
} }
@ -68,14 +72,15 @@ public class StorageInterfaceBlock extends ConnectedBlock implements PolymerText
public static void register() { public static void register() {
var modId = id(STORAGE_MODEL_ID); var modId = id(STORAGE_MODEL_ID);
STORAGE_INTERFACE_BLOCK = Registry.register(Registries.BLOCK, modId, 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); UseBlockCallback.EVENT.register(StorageInterfaceBlock::onUse);
STORAGE_INTERFACE_BLOCK.setDefaultState(); STORAGE_INTERFACE_BLOCK.setDefaultState();
STORAGE_INTERFACE_BLOCK_ENTITY = Registry.register( STORAGE_INTERFACE_BLOCK_ENTITY = Registry.register(
Registries.BLOCK_ENTITY_TYPE, Registries.BLOCK_ENTITY_TYPE,
modId, 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); PolymerBlockUtils.registerBlockEntity(STORAGE_INTERFACE_BLOCK_ENTITY);
} }
@ -85,7 +90,7 @@ public class StorageInterfaceBlock extends ConnectedBlock implements PolymerText
Block block = state.getBlock(); Block block = state.getBlock();
if (block instanceof StorageInterfaceBlock) { 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); player.sendMessage(Text.translatable("message.serverstorage.block_disabled"), true);
return ActionResult.PASS; return ActionResult.PASS;
} }

@ -5,6 +5,8 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemGroups; import net.minecraft.item.ItemGroups;
import net.minecraft.registry.Registries; import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry; import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import systems.brn.serverstorage.lib.DriveComponents; import systems.brn.serverstorage.lib.DriveComponents;
@ -25,7 +27,7 @@ public class HardDriveItem extends SimpleItem {
Identifier identifier = id(tier + "_drive"); Identifier identifier = id(tier + "_drive");
Item item = Registry.register(Registries.ITEM, identifier, new SimpleItem(new Settings() Item item = Registry.register(Registries.ITEM, identifier, new SimpleItem(new Settings()
.maxCount(1) .maxCount(1)
.component(DriveComponents.ITEMSTACK_MAP, new HashMap<>()) .component(DriveComponents.ITEMSTACK_MAP, new HashMap<>()).registryKey(RegistryKey.of(RegistryKeys.ITEM, identifier))
, identifier)); , identifier));
ItemGroupEvents.modifyEntriesEvent(ItemGroups.FUNCTIONAL).register(content -> content.add(item)); ItemGroupEvents.modifyEntriesEvent(ItemGroups.FUNCTIONAL).register(content -> content.add(item));
items.add(item); items.add(item);

@ -2,7 +2,6 @@ package systems.brn.serverstorage.items;
import eu.pb4.polymer.core.api.item.PolymerBlockItem; import eu.pb4.polymer.core.api.item.PolymerBlockItem;
import eu.pb4.polymer.core.api.item.PolymerItem; import eu.pb4.polymer.core.api.item.PolymerItem;
import eu.pb4.polymer.resourcepack.api.PolymerModelData;
import eu.pb4.polymer.resourcepack.api.PolymerResourcePackUtils; import eu.pb4.polymer.resourcepack.api.PolymerResourcePackUtils;
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents; import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@ -12,33 +11,34 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.registry.Registries; import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry; 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 net.minecraft.util.Identifier;
import org.jetbrains.annotations.Nullable; import xyz.nucleoid.packettweaker.PacketContext;
import static systems.brn.serverstorage.ServerStorage.id; import static systems.brn.serverstorage.ServerStorage.id;
public class SimpleBlockItem extends PolymerBlockItem implements PolymerItem { public class SimpleBlockItem extends PolymerBlockItem implements PolymerItem {
private final PolymerModelData polymerModel; private final Identifier polymerModel;
public SimpleBlockItem(Item.Settings settings, Block block, Identifier identifier) { public SimpleBlockItem(Item.Settings settings, Block block, Identifier identifier) {
super(block, settings, Items.BARRIER); 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 @Override
public Item getPolymerItem(ItemStack itemStack, @Nullable ServerPlayerEntity player) { public Identifier getPolymerItemModel(ItemStack stack, PacketContext context) {
return this.polymerModel.item(); return this.polymerModel;
} }
@Override @Override
public int getPolymerCustomModelData(ItemStack itemStack, @Nullable ServerPlayerEntity player) { public Item getPolymerItem(ItemStack itemStack, PacketContext player) {
return this.polymerModel.value(); return Items.BARRIER;
} }
public static void register(Block block) { public static void register(Block block) {
Identifier identifier = id(block.getRegistryEntry().registryKey().getValue().getPath()); 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)); ItemGroupEvents.modifyEntriesEvent(ItemGroups.FUNCTIONAL).register(content -> content.add(item));
} }
} }

@ -2,16 +2,18 @@ package systems.brn.serverstorage.items;
import eu.pb4.polymer.core.api.item.PolymerItem; import eu.pb4.polymer.core.api.item.PolymerItem;
import eu.pb4.polymer.core.api.item.SimplePolymerItem; import eu.pb4.polymer.core.api.item.SimplePolymerItem;
import eu.pb4.polymer.resourcepack.api.PolymerModelData;
import eu.pb4.polymer.resourcepack.api.PolymerResourcePackUtils; import eu.pb4.polymer.resourcepack.api.PolymerResourcePackUtils;
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents; 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.Registries;
import net.minecraft.registry.Registry; import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey; import net.minecraft.registry.RegistryKey;
import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.registry.RegistryKeys;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import org.jetbrains.annotations.Nullable; import xyz.nucleoid.packettweaker.PacketContext;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -19,21 +21,21 @@ import java.util.List;
import static systems.brn.serverstorage.ServerStorage.id; import static systems.brn.serverstorage.ServerStorage.id;
public class SimpleItem extends SimplePolymerItem implements PolymerItem { public class SimpleItem extends SimplePolymerItem implements PolymerItem {
private final PolymerModelData polymerModel; private final Identifier polymerModel;
public SimpleItem(Settings settings, Identifier identifier) { public SimpleItem(Settings settings, Identifier identifier) {
super(settings, Items.STICK); 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 @Override
public Item getPolymerItem(ItemStack itemStack, @Nullable ServerPlayerEntity player) { public Identifier getPolymerItemModel(ItemStack stack, PacketContext context) {
return this.polymerModel.item(); return this.polymerModel;
} }
@Override @Override
public int getPolymerCustomModelData(ItemStack itemStack, @Nullable ServerPlayerEntity player) { public Item getPolymerItem(ItemStack itemStack, PacketContext player) {
return this.polymerModel.value(); return Items.STICK;
} }
public static Item register(String name, RegistryKey<ItemGroup> group){ public static Item register(String name, RegistryKey<ItemGroup> group){
@ -42,7 +44,7 @@ public class SimpleItem extends SimplePolymerItem implements PolymerItem {
public static Item register(String name, int maxCount, RegistryKey<ItemGroup> group) { public static Item register(String name, int maxCount, RegistryKey<ItemGroup> group) {
Identifier identifier = id(name); 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)); ItemGroupEvents.modifyEntriesEvent(group).register(content -> content.add(item));
return item; return item;
} }

@ -10,6 +10,8 @@ import net.minecraft.item.ItemGroups;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.registry.Registries; import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry; import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld; import net.minecraft.server.world.ServerWorld;
@ -45,6 +47,7 @@ public class WirelessTerminalItem extends SimpleItem {
.component(WirelessTerminalComponents.SORT_ALPHABETICALLY, false) .component(WirelessTerminalComponents.SORT_ALPHABETICALLY, false)
.component(WirelessTerminalComponents.QUERY_STRING, "") .component(WirelessTerminalComponents.QUERY_STRING, "")
.component(WirelessTerminalComponents.PAGE, 0) .component(WirelessTerminalComponents.PAGE, 0)
.registryKey(RegistryKey.of(RegistryKeys.ITEM, identifier))
, identifier)); , identifier));
ItemGroupEvents.modifyEntriesEvent(ItemGroups.FUNCTIONAL).register(content -> content.add(item)); ItemGroupEvents.modifyEntriesEvent(ItemGroups.FUNCTIONAL).register(content -> content.add(item));
return item; return item;

@ -7,6 +7,8 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemGroups; import net.minecraft.item.ItemGroups;
import net.minecraft.registry.Registries; import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry; import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import systems.brn.serverstorage.items.SimpleItem; import systems.brn.serverstorage.items.SimpleItem;
@ -34,7 +36,7 @@ public class Antenna extends SimpleItem {
for (String tier : tiers) { for (String tier : tiers) {
Identifier identifier = id(tier + "_antenna"); Identifier identifier = id(tier + "_antenna");
Item item = Registry.register(Registries.ITEM, identifier, new Antenna(new Settings() Item item = Registry.register(Registries.ITEM, identifier, new Antenna(new Settings()
.maxCount(1) .maxCount(1).registryKey(RegistryKey.of(RegistryKeys.ITEM, identifier))
, identifier, range)); , identifier, range));
ItemGroupEvents.modifyEntriesEvent(ItemGroups.FUNCTIONAL).register(content -> content.add(item)); ItemGroupEvents.modifyEntriesEvent(ItemGroups.FUNCTIONAL).register(content -> content.add(item));
items.add(item); items.add(item);

@ -1,6 +1,5 @@
package systems.brn.serverstorage.lib; package systems.brn.serverstorage.lib;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.recipe.CraftingRecipe; import net.minecraft.recipe.CraftingRecipe;
import net.minecraft.recipe.RecipeEntry; import net.minecraft.recipe.RecipeEntry;
@ -33,11 +32,12 @@ public class CraftingEntry {
for (Map.Entry<ItemStack, Integer> entry : inputs.entrySet()) { for (Map.Entry<ItemStack, Integer> entry : inputs.entrySet()) {
ItemStack stackIn = entry.getKey(); ItemStack stackIn = entry.getKey();
Integer count = entry.getValue(); Integer count = entry.getValue();
if (count > 0 && stackIn.isEmpty() && stackIn.getItem().hasRecipeRemainder()) { if (count > 0 && stackIn.isEmpty() && stackIn.getItem().getRecipeRemainder() != null) {
Item remainderItem = stackIn.getItem().getRecipeRemainder(); ItemStack remainderStack = stackIn.getItem().getRecipeRemainder();
if (remainderItem != null) { if (!remainderStack.isEmpty()) {
ItemStack remainderStack = new ItemStack(stackIn.getItem().getRecipeRemainder(), count); ItemStack remainderStackNew = remainderStack.copy();
tempOutputStacks.add(remainderStack); remainderStackNew.setCount(count);
tempOutputStacks.add(remainderStackNew);
} }
} }
} }

@ -5,27 +5,27 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld; import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.TypedActionResult;
import net.minecraft.world.World; import net.minecraft.world.World;
import systems.brn.serverstorage.items.WirelessTerminalItem; import systems.brn.serverstorage.items.WirelessTerminalItem;
import static systems.brn.serverstorage.ServerStorage.WIRELESS_TERMINAL; import static systems.brn.serverstorage.ServerStorage.WIRELESS_TERMINAL;
public class EventHandler { public class EventHandler {
public static TypedActionResult<ItemStack> onItemUse(PlayerEntity playerEntity, World worldTemp, Hand hand) { public static ActionResult onItemUse(PlayerEntity playerEntity, World worldTemp, Hand hand) {
ItemStack itemStack = playerEntity.getStackInHand(hand); ItemStack itemStack = playerEntity.getStackInHand(hand);
Item item = itemStack.getItem(); Item item = itemStack.getItem();
if (!worldTemp.isClient) { if (!worldTemp.isClient) {
if (playerEntity instanceof ServerPlayerEntity player) { if (playerEntity instanceof ServerPlayerEntity player) {
if (worldTemp instanceof ServerWorld world) { if (worldTemp instanceof ServerWorld world) {
if (item == WIRELESS_TERMINAL) { 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;
} }
} }

@ -187,7 +187,7 @@ public abstract class PagedGui extends SimpleGui {
if (gui.canNextPage()) { if (gui.canNextPage()) {
return DisplayElement.of( return DisplayElement.of(
new GuiElementBuilder(Items.PLAYER_HEAD) 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() .hideDefaultTooltip().noDefaults()
.setSkullOwner(GUI_NEXT_PAGE) .setSkullOwner(GUI_NEXT_PAGE)
.setCallback((x, y, z) -> { .setCallback((x, y, z) -> {
@ -198,7 +198,7 @@ public abstract class PagedGui extends SimpleGui {
} else { } else {
return DisplayElement.of( return DisplayElement.of(
new GuiElementBuilder(Items.PLAYER_HEAD) 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() .hideDefaultTooltip().noDefaults()
.setSkullOwner(GUI_NEXT_PAGE_BLOCKED) .setSkullOwner(GUI_NEXT_PAGE_BLOCKED)
); );
@ -209,7 +209,7 @@ public abstract class PagedGui extends SimpleGui {
if (gui.canPreviousPage()) { if (gui.canPreviousPage()) {
return DisplayElement.of( return DisplayElement.of(
new GuiElementBuilder(Items.PLAYER_HEAD) 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() .hideDefaultTooltip().noDefaults()
.setSkullOwner(GUI_PREVIOUS_PAGE) .setSkullOwner(GUI_PREVIOUS_PAGE)
.setCallback((x, y, z) -> { .setCallback((x, y, z) -> {
@ -220,7 +220,7 @@ public abstract class PagedGui extends SimpleGui {
} else { } else {
return DisplayElement.of( return DisplayElement.of(
new GuiElementBuilder(Items.PLAYER_HEAD) 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() .hideDefaultTooltip().noDefaults()
.setSkullOwner(GUI_PREVIOUS_PAGE_BLOCKED) .setSkullOwner(GUI_PREVIOUS_PAGE_BLOCKED)
); );

@ -5,7 +5,12 @@ import net.minecraft.component.DataComponentTypes;
import net.minecraft.component.type.LoreComponent; import net.minecraft.component.type.LoreComponent;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; 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.server.MinecraftServer;
import net.minecraft.text.RawFilteredPair; import net.minecraft.text.RawFilteredPair;
import net.minecraft.text.Style; import net.minecraft.text.Style;
@ -130,40 +135,42 @@ public class Util {
} }
public static ArrayList<CraftingEntry> getCraftableRecipes(Map<ItemStack, Integer> itemStackMap, MinecraftServer server) { public static ArrayList<CraftingEntry> getCraftableRecipes(Map<ItemStack, Integer> itemStackMap, MinecraftServer server) {
RecipeManager recipeManager = server.getRecipeManager(); ServerRecipeManager recipeManager = server.getRecipeManager();
List<RecipeEntry<CraftingRecipe>> allRecipes = recipeManager.listAllOfType(RecipeType.CRAFTING); List<RecipeEntry<?>> allRecipes = (List<RecipeEntry<?>>) recipeManager.values();
ArrayList<CraftingEntry> craftingEntries = new ArrayList<>(); ArrayList<CraftingEntry> craftingEntries = new ArrayList<>();
for (RecipeEntry<CraftingRecipe> recipe : allRecipes) { for (RecipeEntry<?> recipex : allRecipes) {
if (! (recipex.value() instanceof CraftingRecipe)) {
continue;
}
RecipeEntry<CraftingRecipe> recipe = (RecipeEntry<CraftingRecipe>) recipex;
int maxAmount = Integer.MAX_VALUE; int maxAmount = Integer.MAX_VALUE;
boolean canMake = true; boolean canMake = true;
HashMap<ItemStack, Integer> finalInputs = new HashMap<>(); HashMap<ItemStack, Integer> finalInputs = new HashMap<>();
Map<Item, Integer> ingredientCounts = new HashMap<>(); Map<Item, Integer> ingredientCounts = new HashMap<>();
// Count the occurrences of each ingredient in the recipe // Count the occurrences of each ingredient in the recipe
for (Ingredient ingredient : recipe.value().getIngredients()) { for (Ingredient ingredient : recipe.value().getIngredientPlacement().getIngredients()) {
for (ItemStack stack : ingredient.getMatchingStacks()) { for (RegistryEntry<Item> item : ingredient.getMatchingItems()) {
if (stack.isEmpty()) continue; ingredientCounts.put(item.value(), ingredientCounts.getOrDefault(item.value(), 0) + 1);
ingredientCounts.put(stack.getItem(), ingredientCounts.getOrDefault(stack.getItem(), 0) + 1);
} }
} }
boolean usesAnyIngredient = false; boolean usesAnyIngredient = false;
for (Ingredient ingredient : recipe.value().getIngredients()) { for (Ingredient ingredient : recipe.value().getIngredientPlacement().getIngredients()) {
int totalAvailable = 0; int totalAvailable = 0;
HashMap<ItemStack, Integer> inputsTemp = new HashMap<>(); HashMap<ItemStack, Integer> inputsTemp = new HashMap<>();
for (ItemStack stack : ingredient.getMatchingStacks()) { for (RegistryEntry<Item> item : ingredient.getMatchingItems()) {
if (stack.isEmpty()) continue;
for (Map.Entry<ItemStack, Integer> entry : itemStackMap.entrySet()) { for (Map.Entry<ItemStack, Integer> entry : itemStackMap.entrySet()) {
ItemStack inventoryStack = entry.getKey(); ItemStack inventoryStack = entry.getKey();
int inventoryCount = entry.getValue(); int inventoryCount = entry.getValue();
if (ItemStack.areItemsEqual(stack, inventoryStack)) { if (item.value() == inventoryStack.getItem()) {
totalAvailable += inventoryCount; totalAvailable += inventoryCount;
inputsTemp.put(stack, inventoryCount); inputsTemp.put(item.value().getDefaultStack(), inventoryCount);
usesAnyIngredient = true; usesAnyIngredient = true;
} }
} }
@ -173,10 +180,12 @@ public class Util {
canMake = false; canMake = false;
break; break;
} }
int occurrences = ingredientCounts.getOrDefault(ingredient.getMatchingItems().getFirst(),0);
int requiredCount = ingredient.getMatchingStacks()[0].getCount(); if (occurrences == 0) {
int occurrences = ingredientCounts.get(ingredient.getMatchingStacks()[0].getItem()); canMake = false;
maxAmount = Math.min(maxAmount, totalAvailable / (requiredCount * occurrences)); break;
}
maxAmount = Math.min(maxAmount, totalAvailable / occurrences);
for (Map.Entry<ItemStack, Integer> entry : inputsTemp.entrySet()) { for (Map.Entry<ItemStack, Integer> entry : inputsTemp.entrySet()) {
ItemStack stackIn = entry.getKey(); ItemStack stackIn = entry.getKey();
@ -186,7 +195,9 @@ public class Util {
} }
if (canMake && maxAmount > 0 && usesAnyIngredient) { if (canMake && maxAmount > 0 && usesAnyIngredient) {
ItemStack outputItem = recipe.value().getResult(server.getRegistryManager()).copy(); List<ItemStack> 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); CraftingEntry finalEntry = new CraftingEntry(outputItem, recipe, finalInputs, maxAmount);
craftingEntries.add(finalEntry); craftingEntries.add(finalEntry);
} }

@ -4,11 +4,14 @@ import eu.pb4.sgui.api.elements.GuiElementBuilder;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.Inventory; import net.minecraft.inventory.Inventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.recipe.CraftingRecipe; import net.minecraft.recipe.CraftingRecipe;
import net.minecraft.recipe.Ingredient; import net.minecraft.recipe.Ingredient;
import net.minecraft.recipe.RecipeEntry; 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.text.Text;
import net.minecraft.util.Formatting; import net.minecraft.util.Formatting;
import systems.brn.serverstorage.blockentities.StorageInterfaceBlockEntity; import systems.brn.serverstorage.blockentities.StorageInterfaceBlockEntity;
@ -108,7 +111,7 @@ public class CraftingScreen extends PagedGui implements Searchable {
private boolean canCraft(RecipeEntry<CraftingRecipe> recipeEntry) { private boolean canCraft(RecipeEntry<CraftingRecipe> recipeEntry) {
reindexDrives(); reindexDrives();
for (Ingredient ingredient : recipeEntry.value().getIngredients()) { for (Ingredient ingredient : recipeEntry.value().getIngredientPlacement().getIngredients()) {
if (findMatchingStack(ingredient) == null) { if (findMatchingStack(ingredient) == null) {
return false; return false;
} }
@ -121,7 +124,7 @@ public class CraftingScreen extends PagedGui implements Searchable {
ArrayList<ItemStack> stacksToRemove = new ArrayList<>(); ArrayList<ItemStack> stacksToRemove = new ArrayList<>();
// Check and remove ingredients for one crafting operation // 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); ItemStack stackToRemove = findMatchingStack(ingredient);
if (stackToRemove == null) { if (stackToRemove == null) {
return false; // Unable to find required ingredient 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 // 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) { if (toPlayerInventory) {
PlayerInventory playerInventory = player.getInventory(); PlayerInventory playerInventory = player.getInventory();
@ -164,9 +167,10 @@ public class CraftingScreen extends PagedGui implements Searchable {
ItemStack playerStack = playerInventory.getStack(i); ItemStack playerStack = playerInventory.getStack(i);
if (ingredient.test(playerStack)) { if (ingredient.test(playerStack)) {
ItemStack stackToRemove = playerStack.copy(); ItemStack stackToRemove = playerStack.copy();
for (ItemStack matchingStack : ingredient.getMatchingStacks()) { for (RegistryEntry<Item> matchingItemx : ingredient.getMatchingItems()) {
if (matchingStack.getItem() == stackToRemove.getItem()) { Item matchingItem = matchingItemx.value();
stackToRemove.setCount(matchingStack.getCount()); // Set count to ingredient requirement if (matchingItem == stackToRemove.getItem()) {
stackToRemove.setCount(1); // Set count to ingredient requirement
break; break;
} }
} }
@ -175,10 +179,11 @@ public class CraftingScreen extends PagedGui implements Searchable {
} }
// Check storage network // Check storage network
for (ItemStack stack : ingredient.getMatchingStacks()) { for (RegistryEntry<Item> itemx : ingredient.getMatchingItems()) {
if (this.storageScreen.getNetwork().canRemove(stack)) { Item item = itemx.value();
ItemStack stackToRemove = stack.copy(); if (this.storageScreen.getNetwork().canRemove(item.getDefaultStack())) {
stackToRemove.setCount(ingredient.getMatchingStacks()[0].getCount()); // Set count to ingredient requirement ItemStack stackToRemove = item.getDefaultStack();
stackToRemove.setCount(1); // Set count to ingredient requirement
return stackToRemove; return stackToRemove;
} }
} }

@ -379,7 +379,7 @@ public class StorageScreen extends PagedGui implements Searchable {
@Override @Override
protected DisplayElement crafting() { 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( return DisplayElement.of(
new GuiElementBuilder(Items.PLAYER_HEAD) new GuiElementBuilder(Items.PLAYER_HEAD)
.setName(Text.translatable("container.crafting").formatted(Formatting.WHITE)) .setName(Text.translatable("container.crafting").formatted(Formatting.WHITE))

@ -7,21 +7,11 @@
"BBP" "BBP"
], ],
"key": { "key": {
"C": { "C": "serverstorage:material_cpu",
"item": "serverstorage:material_cpu" "G": "minecraft:gold_nugget",
}, "P": "serverstorage:material_pcb",
"G": { "R": "minecraft:redstone_block",
"item": "minecraft:gold_nugget" "B": "serverstorage:module_bus"
},
"P": {
"item": "serverstorage:material_pcb"
},
"R": {
"item": "minecraft:redstone_block"
},
"B": {
"item": "serverstorage:module_bus"
}
}, },
"result": { "result": {
"id": "serverstorage:bus_connector", "id": "serverstorage:bus_connector",

@ -7,15 +7,9 @@
"GSG" "GSG"
], ],
"key": { "key": {
"G": { "G": "minecraft:gold_nugget",
"item": "minecraft:gold_nugget" "P": "minecraft:amethyst_shard",
}, "S": "serverstorage:material_cpu_substrate"
"P": {
"item": "minecraft:amethyst_shard"
},
"S": {
"item": "serverstorage:material_cpu_substrate"
}
}, },
"result": { "result": {
"id": "serverstorage:material_cpu", "id": "serverstorage:material_cpu",

@ -7,12 +7,8 @@
"AAA" "AAA"
], ],
"key": { "key": {
"D": { "D": "minecraft:light_gray_dye",
"item": "minecraft:light_gray_dye" "A": "minecraft:amethyst_shard"
},
"A": {
"item": "minecraft:amethyst_shard"
}
}, },
"result": { "result": {
"id": "serverstorage:material_cpu_substrate", "id": "serverstorage:material_cpu_substrate",

@ -7,9 +7,7 @@
"# " "# "
], ],
"key": { "key": {
"#": { "#": "minecraft:diamond"
"item": "minecraft:diamond"
}
}, },
"result": { "result": {
"id": "serverstorage:diamond_antenna", "id": "serverstorage:diamond_antenna",

@ -7,18 +7,10 @@
"HXH" "HXH"
], ],
"key": { "key": {
"H": { "H": "serverstorage:diamond_head",
"item": "serverstorage:diamond_head" "P": "serverstorage:diamond_platter",
}, "C": "serverstorage:material_drive_casing",
"P": { "X": "serverstorage:material_drive_controller"
"item": "serverstorage:diamond_platter"
},
"C": {
"item": "serverstorage:material_drive_casing"
},
"X": {
"item": "serverstorage:material_drive_controller"
}
}, },
"result": { "result": {
"id": "serverstorage:diamond_drive", "id": "serverstorage:diamond_drive",

@ -7,9 +7,7 @@
" ##" " ##"
], ],
"key": { "key": {
"#": { "#": "minecraft:diamond"
"item": "minecraft:diamond"
}
}, },
"result": { "result": {
"id": "serverstorage:diamond_head", "id": "serverstorage:diamond_head",

@ -7,9 +7,7 @@
"###" "###"
], ],
"key": { "key": {
"#": { "#": "minecraft:diamond"
"item": "minecraft:diamond"
}
}, },
"result": { "result": {
"id": "serverstorage:diamond_platter", "id": "serverstorage:diamond_platter",

@ -7,15 +7,9 @@
"IRI" "IRI"
], ],
"key": { "key": {
"I": { "I": "minecraft:iron_ingot",
"item": "minecraft:iron_ingot" "R": "minecraft:redstone",
}, "P": "minecraft:paper"
"R": {
"item": "minecraft:redstone"
},
"P": {
"item": "minecraft:paper"
}
}, },
"result": { "result": {
"id": "serverstorage:material_drive_casing", "id": "serverstorage:material_drive_casing",

@ -7,21 +7,11 @@
"DDP" "DDP"
], ],
"key": { "key": {
"C": { "C": "serverstorage:material_cpu",
"item": "serverstorage:material_cpu" "P": "serverstorage:material_pcb",
}, "R": "minecraft:redstone_block",
"P": { "D": "serverstorage:module_drive",
"item": "serverstorage:material_pcb" "B": "serverstorage:module_bus"
},
"R": {
"item": "minecraft:redstone_block"
},
"D": {
"item": "serverstorage:module_drive"
},
"B": {
"item": "serverstorage:module_bus"
}
}, },
"result": { "result": {
"id": "serverstorage:drive_container", "id": "serverstorage:drive_container",

@ -7,18 +7,10 @@
"III" "III"
], ],
"key": { "key": {
"I": { "I": "minecraft:gold_ingot",
"item": "minecraft:gold_ingot" "X": "serverstorage:material_drive_casing",
}, "C": "serverstorage:material_cpu",
"X": { "S": "serverstorage:material_pcb_substrate"
"item": "serverstorage:material_drive_casing"
},
"C": {
"item": "serverstorage:material_cpu"
},
"S": {
"item": "serverstorage:material_pcb_substrate"
}
}, },
"result": { "result": {
"id": "serverstorage:material_drive_controller", "id": "serverstorage:material_drive_controller",

@ -7,9 +7,7 @@
"# " "# "
], ],
"key": { "key": {
"#": { "#": "minecraft:gold_ingot"
"item": "minecraft:gold_ingot"
}
}, },
"result": { "result": {
"id": "serverstorage:golden_antenna", "id": "serverstorage:golden_antenna",

@ -7,18 +7,10 @@
"HXH" "HXH"
], ],
"key": { "key": {
"H": { "H": "serverstorage:golden_head",
"item": "serverstorage:golden_head" "P": "serverstorage:golden_platter",
}, "C": "serverstorage:material_drive_casing",
"P": { "X": "serverstorage:material_drive_controller"
"item": "serverstorage:golden_platter"
},
"C": {
"item": "serverstorage:material_drive_casing"
},
"X": {
"item": "serverstorage:material_drive_controller"
}
}, },
"result": { "result": {
"id": "serverstorage:golden_drive", "id": "serverstorage:golden_drive",

@ -7,9 +7,7 @@
" ##" " ##"
], ],
"key": { "key": {
"#": { "#": "minecraft:gold_ingot"
"item": "minecraft:gold_ingot"
}
}, },
"result": { "result": {
"id": "serverstorage:golden_head", "id": "serverstorage:golden_head",

@ -7,9 +7,7 @@
"###" "###"
], ],
"key": { "key": {
"#": { "#": "minecraft:gold_ingot"
"item": "minecraft:gold_ingot"
}
}, },
"result": { "result": {
"id": "serverstorage:golden_platter", "id": "serverstorage:golden_platter",

@ -7,30 +7,14 @@
"SPF" "SPF"
], ],
"key": { "key": {
"P": { "P": "serverstorage:material_pcb",
"item": "serverstorage:material_pcb" "U": "serverstorage:material_cpu",
}, "C": "serverstorage:module_container",
"U": { "B": "serverstorage:module_bus",
"item": "serverstorage:material_cpu" "H": "minecraft:hopper",
}, "S": "minecraft:chest",
"C": { "G": "serverstorage:module_configuration",
"item": "serverstorage:module_container" "F": "serverstorage:module_filtering"
},
"B": {
"item": "serverstorage:module_bus"
},
"H": {
"item": "minecraft:hopper"
},
"S": {
"item": "minecraft:chest"
},
"G": {
"item": "serverstorage:module_configuration"
},
"F": {
"item": "serverstorage:module_filtering"
}
}, },
"result": { "result": {
"id": "serverstorage:inventory_interface", "id": "serverstorage:inventory_interface",

@ -7,9 +7,7 @@
"# " "# "
], ],
"key": { "key": {
"#": { "#": "minecraft:iron_ingot"
"item": "minecraft:iron_ingot"
}
}, },
"result": { "result": {
"id": "serverstorage:iron_antenna", "id": "serverstorage:iron_antenna",

@ -7,18 +7,10 @@
"HXH" "HXH"
], ],
"key": { "key": {
"H": { "H": "serverstorage:iron_head",
"item": "serverstorage:iron_head" "P": "serverstorage:iron_platter",
}, "C": "serverstorage:material_drive_casing",
"P": { "X": "serverstorage:material_drive_controller"
"item": "serverstorage:iron_platter"
},
"C": {
"item": "serverstorage:material_drive_casing"
},
"X": {
"item": "serverstorage:material_drive_controller"
}
}, },
"result": { "result": {
"id": "serverstorage:iron_drive", "id": "serverstorage:iron_drive",

@ -7,9 +7,7 @@
" ##" " ##"
], ],
"key": { "key": {
"#": { "#": "minecraft:iron_ingot"
"item": "minecraft:iron_ingot"
}
}, },
"result": { "result": {
"id": "serverstorage:iron_head", "id": "serverstorage:iron_head",

@ -7,9 +7,7 @@
"###" "###"
], ],
"key": { "key": {
"#": { "#": "minecraft:iron_ingot"
"item": "minecraft:iron_ingot"
}
}, },
"result": { "result": {
"id": "serverstorage:iron_platter", "id": "serverstorage:iron_platter",

@ -7,21 +7,11 @@
"GGG" "GGG"
], ],
"key": { "key": {
"G": { "G": "minecraft:gold_nugget",
"item": "minecraft:gold_nugget" "R": "minecraft:iron_ingot",
}, "I": "minecraft:gold_ingot",
"R": { "C": "serverstorage:material_cpu",
"item": "minecraft:iron_ingot" "S": "serverstorage:material_pcb_substrate"
},
"I": {
"item": "minecraft:gold_ingot"
},
"C": {
"item": "serverstorage:material_cpu"
},
"S": {
"item": "serverstorage:material_pcb_substrate"
}
}, },
"result": { "result": {
"id": "serverstorage:module_antenna", "id": "serverstorage:module_antenna",

@ -7,18 +7,10 @@
"GGG" "GGG"
], ],
"key": { "key": {
"G": { "G": "minecraft:gold_nugget",
"item": "minecraft:gold_nugget" "R": "minecraft:iron_ingot",
}, "C": "serverstorage:material_cpu",
"R": { "S": "serverstorage:material_pcb_substrate"
"item": "minecraft:iron_ingot"
},
"C": {
"item": "serverstorage:material_cpu"
},
"S": {
"item": "serverstorage:material_pcb_substrate"
}
}, },
"result": { "result": {
"id": "serverstorage:module_antenna_connector", "id": "serverstorage:module_antenna_connector",

@ -7,21 +7,11 @@
"GGG" "GGG"
], ],
"key": { "key": {
"G": { "G": "minecraft:gold_nugget",
"item": "minecraft:gold_nugget" "C": "serverstorage:material_cpu",
}, "S": "serverstorage:material_pcb_substrate",
"C": { "I": "minecraft:iron_ingot",
"item": "serverstorage:material_cpu" "A": "minecraft:gold_ingot"
},
"S": {
"item": "serverstorage:material_pcb_substrate"
},
"I": {
"item": "minecraft:iron_ingot"
},
"A": {
"item": "minecraft:gold_ingot"
}
}, },
"result": { "result": {
"id": "serverstorage:module_bus", "id": "serverstorage:module_bus",

@ -7,18 +7,10 @@
"GGG" "GGG"
], ],
"key": { "key": {
"G": { "G": "minecraft:gold_nugget",
"item": "minecraft:gold_nugget" "C": "serverstorage:material_cpu",
}, "S": "serverstorage:material_pcb_substrate",
"C": { "I": "minecraft:iron_ingot"
"item": "serverstorage:material_cpu"
},
"S": {
"item": "serverstorage:material_pcb_substrate"
},
"I": {
"item": "minecraft:iron_ingot"
}
}, },
"result": { "result": {
"id": "serverstorage:module_configuration", "id": "serverstorage:module_configuration",

@ -7,18 +7,10 @@
"GGG" "GGG"
], ],
"key": { "key": {
"G": { "G": "minecraft:gold_nugget",
"item": "minecraft:gold_nugget" "C": "serverstorage:material_cpu",
}, "S": "serverstorage:material_pcb_substrate",
"C": { "H": "minecraft:chest"
"item": "serverstorage:material_cpu"
},
"S": {
"item": "serverstorage:material_pcb_substrate"
},
"H": {
"item": "minecraft:chest"
}
}, },
"result": { "result": {
"id": "serverstorage:module_container", "id": "serverstorage:module_container",

@ -7,18 +7,10 @@
"GGG" "GGG"
], ],
"key": { "key": {
"G": { "G": "minecraft:gold_nugget",
"item": "minecraft:gold_nugget" "C": "serverstorage:material_cpu",
}, "S": "serverstorage:material_pcb_substrate",
"C": { "D": "minecraft:gray_stained_glass"
"item": "serverstorage:material_cpu"
},
"S": {
"item": "serverstorage:material_pcb_substrate"
},
"D": {
"item": "minecraft:gray_stained_glass"
}
}, },
"result": { "result": {
"id": "serverstorage:module_display", "id": "serverstorage:module_display",

@ -7,18 +7,10 @@
"GGG" "GGG"
], ],
"key": { "key": {
"G": { "G": "minecraft:gold_nugget",
"item": "minecraft:gold_nugget" "I": "minecraft:gold_ingot",
}, "C": "serverstorage:material_cpu",
"I": { "S": "serverstorage:material_pcb_substrate"
"item": "minecraft:gold_ingot"
},
"C": {
"item": "serverstorage:material_cpu"
},
"S": {
"item": "serverstorage:material_pcb_substrate"
}
}, },
"result": { "result": {
"id": "serverstorage:module_drive", "id": "serverstorage:module_drive",

@ -7,21 +7,11 @@
"GGG" "GGG"
], ],
"key": { "key": {
"G": { "G": "minecraft:gold_nugget",
"item": "minecraft:gold_nugget" "C": "serverstorage:material_cpu",
}, "S": "serverstorage:material_pcb_substrate",
"C": { "L": "minecraft:glass",
"item": "serverstorage:material_cpu" "I": "minecraft:iron_ingot"
},
"S": {
"item": "serverstorage:material_pcb_substrate"
},
"L": {
"item": "minecraft:glass"
},
"I": {
"item": "minecraft:iron_ingot"
}
}, },
"result": { "result": {
"id": "serverstorage:module_filtering", "id": "serverstorage:module_filtering",

@ -7,21 +7,11 @@
"GGG" "GGG"
], ],
"key": { "key": {
"G": { "G": "minecraft:gold_nugget",
"item": "minecraft:gold_nugget" "C": "serverstorage:material_cpu",
}, "S": "serverstorage:material_pcb_substrate",
"C": { "H": "minecraft:chest",
"item": "serverstorage:material_cpu" "I": "minecraft:iron_ingot"
},
"S": {
"item": "serverstorage:material_pcb_substrate"
},
"H": {
"item": "minecraft:chest"
},
"I": {
"item": "minecraft:iron_ingot"
}
}, },
"result": { "result": {
"id": "serverstorage:module_inventory", "id": "serverstorage:module_inventory",

@ -7,18 +7,10 @@
"GGG" "GGG"
], ],
"key": { "key": {
"G": { "G": "minecraft:gold_nugget",
"item": "minecraft:gold_nugget" "I": "minecraft:gold_ingot",
}, "C": "serverstorage:material_cpu",
"I": { "S": "serverstorage:material_pcb_substrate"
"item": "minecraft:gold_ingot"
},
"C": {
"item": "serverstorage:material_cpu"
},
"S": {
"item": "serverstorage:material_pcb_substrate"
}
}, },
"result": { "result": {
"id": "serverstorage:module_modem", "id": "serverstorage:module_modem",

@ -7,18 +7,10 @@
"GGG" "GGG"
], ],
"key": { "key": {
"G": { "G": "minecraft:gold_nugget",
"item": "minecraft:gold_nugget" "C": "serverstorage:material_cpu",
}, "S": "serverstorage:material_pcb_substrate",
"C": { "I": "minecraft:iron_ingot"
"item": "serverstorage:material_cpu"
},
"S": {
"item": "serverstorage:material_pcb_substrate"
},
"I": {
"item": "minecraft:iron_ingot"
}
}, },
"result": { "result": {
"id": "serverstorage:module_pagination", "id": "serverstorage:module_pagination",

@ -7,15 +7,9 @@
"GGG" "GGG"
], ],
"key": { "key": {
"G": { "G": "minecraft:gold_nugget",
"item": "minecraft:gold_nugget" "C": "serverstorage:material_cpu",
}, "S": "serverstorage:material_pcb_substrate"
"C": {
"item": "serverstorage:material_cpu"
},
"S": {
"item": "serverstorage:material_pcb_substrate"
}
}, },
"result": { "result": {
"id": "serverstorage:module_pcb", "id": "serverstorage:module_pcb",

@ -7,18 +7,10 @@
"GGG" "GGG"
], ],
"key": { "key": {
"G": { "G": "minecraft:gold_nugget",
"item": "minecraft:gold_nugget" "I": "minecraft:gold_ingot",
}, "C": "serverstorage:material_cpu",
"I": { "S": "serverstorage:material_pcb_substrate"
"item": "minecraft:gold_ingot"
},
"C": {
"item": "serverstorage:material_cpu"
},
"S": {
"item": "serverstorage:material_pcb_substrate"
}
}, },
"result": { "result": {
"id": "serverstorage:module_radio", "id": "serverstorage:module_radio",

@ -7,18 +7,10 @@
"GGG" "GGG"
], ],
"key": { "key": {
"G": { "G": "minecraft:gold_nugget",
"item": "minecraft:gold_nugget" "C": "serverstorage:material_cpu",
}, "S": "serverstorage:material_pcb_substrate",
"C": { "H": "minecraft:hopper"
"item": "serverstorage:material_cpu"
},
"S": {
"item": "serverstorage:material_pcb_substrate"
},
"H": {
"item": "minecraft:hopper"
}
}, },
"result": { "result": {
"id": "serverstorage:module_transport", "id": "serverstorage:module_transport",

@ -1,16 +1,10 @@
{ {
"type": "minecraft:smithing_transform", "type": "minecraft:smithing_transform",
"addition": { "addition": "minecraft:netherite_ingot",
"item": "minecraft:netherite_ingot" "base": "serverstorage:diamond_antenna",
},
"base": {
"item": "serverstorage:diamond_antenna"
},
"result": { "result": {
"count": 1, "count": 1,
"id": "serverstorage:netherite_antenna" "id": "serverstorage:netherite_antenna"
}, },
"template": { "template": "serverstorage:module_netherite_upgrade"
"item": "serverstorage:module_netherite_upgrade"
}
} }

@ -7,18 +7,10 @@
"HXH" "HXH"
], ],
"key": { "key": {
"H": { "H": "serverstorage:netherite_head",
"item": "serverstorage:netherite_head" "P": "serverstorage:netherite_platter",
}, "C": "serverstorage:material_drive_casing",
"P": { "X": "serverstorage:material_drive_controller"
"item": "serverstorage:netherite_platter"
},
"C": {
"item": "serverstorage:material_drive_casing"
},
"X": {
"item": "serverstorage:material_drive_controller"
}
}, },
"result": { "result": {
"id": "serverstorage:netherite_drive", "id": "serverstorage:netherite_drive",

@ -1,16 +1,10 @@
{ {
"type": "minecraft:smithing_transform", "type": "minecraft:smithing_transform",
"addition": { "addition": "minecraft:netherite_ingot",
"item": "minecraft:netherite_ingot" "base": "serverstorage:diamond_head",
},
"base": {
"item": "serverstorage:diamond_head"
},
"result": { "result": {
"count": 1, "count": 1,
"id": "serverstorage:netherite_head" "id": "serverstorage:netherite_head"
}, },
"template": { "template": "serverstorage:module_netherite_upgrade"
"item": "serverstorage:module_netherite_upgrade"
}
} }

@ -1,16 +1,10 @@
{ {
"type": "minecraft:smithing_transform", "type": "minecraft:smithing_transform",
"addition": { "addition": "minecraft:netherite_ingot",
"item": "minecraft:netherite_ingot" "base": "serverstorage:diamond_platter",
},
"base": {
"item": "serverstorage:diamond_platter"
},
"result": { "result": {
"count": 1, "count": 1,
"id": "serverstorage:netherite_platter" "id": "serverstorage:netherite_platter"
}, },
"template": { "template": "serverstorage:module_netherite_upgrade"
"item": "serverstorage:module_netherite_upgrade"
}
} }

@ -7,15 +7,9 @@
"SLS" "SLS"
], ],
"key": { "key": {
"C": { "C": "serverstorage:material_cpu",
"item": "serverstorage:material_cpu" "S": "serverstorage:material_pcb_substrate",
}, "L": "minecraft:glass"
"S": {
"item": "serverstorage:material_pcb_substrate"
},
"L": {
"item": "minecraft:glass"
}
}, },
"result": { "result": {
"id": "serverstorage:module_netherite_upgrade", "id": "serverstorage:module_netherite_upgrade",

@ -7,12 +7,8 @@
"GGG" "GGG"
], ],
"key": { "key": {
"G": { "G": "minecraft:lime_dye",
"item": "minecraft:lime_dye" "P": "serverstorage:material_pcb_substrate"
},
"P": {
"item": "serverstorage:material_pcb_substrate"
}
}, },
"result": { "result": {
"id": "serverstorage:material_pcb", "id": "serverstorage:material_pcb",

@ -7,12 +7,8 @@
"AAA" "AAA"
], ],
"key": { "key": {
"G": { "G": "minecraft:green_dye",
"item": "minecraft:green_dye" "A": "minecraft:amethyst_shard"
},
"A": {
"item": "minecraft:amethyst_shard"
}
}, },
"result": { "result": {
"id": "serverstorage:material_pcb_substrate", "id": "serverstorage:material_pcb_substrate",

@ -7,30 +7,14 @@
"MPF" "MPF"
], ],
"key": { "key": {
"P": { "P": "serverstorage:material_pcb",
"item": "serverstorage:material_pcb" "U": "serverstorage:material_cpu",
}, "C": "serverstorage:module_radio",
"U": { "B": "serverstorage:module_bus",
"item": "serverstorage:material_cpu" "H": "serverstorage:module_antenna_connector",
}, "M": "serverstorage:module_modem",
"C": { "G": "serverstorage:module_configuration",
"item": "serverstorage:module_radio" "F": "serverstorage:module_pagination"
},
"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"
}
}, },
"result": { "result": {
"id": "serverstorage:radio_interface", "id": "serverstorage:radio_interface",

@ -7,33 +7,15 @@
"ILX" "ILX"
], ],
"key": { "key": {
"L": { "L": "minecraft:diamond_block",
"item": "minecraft:diamond_block" "D": "serverstorage:module_display",
}, "F": "serverstorage:module_filtering",
"D": { "C": "serverstorage:module_configuration",
"item": "serverstorage:module_display" "P": "serverstorage:module_pagination",
}, "B": "serverstorage:module_bus",
"F": { "I": "serverstorage:module_inventory",
"item": "serverstorage:module_filtering" "X": "serverstorage:material_cpu",
}, "O": "serverstorage:material_pcb"
"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"
}
}, },
"result": { "result": {
"id": "serverstorage:storage", "id": "serverstorage:storage",

@ -7,30 +7,14 @@
"UMP" "UMP"
], ],
"key": { "key": {
"P": { "P": "serverstorage:material_pcb",
"item": "serverstorage:material_pcb" "U": "serverstorage:material_cpu",
}, "A": "serverstorage:module_antenna",
"U": { "C": "serverstorage:module_radio",
"item": "serverstorage:material_cpu" "H": "serverstorage:module_antenna_connector",
}, "M": "serverstorage:module_modem",
"A": { "G": "serverstorage:module_configuration",
"item": "serverstorage:module_antenna" "F": "serverstorage:module_pagination"
},
"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"
}
}, },
"result": { "result": {
"id": "serverstorage:wireless_terminal", "id": "serverstorage:wireless_terminal",