From 6cd7c83bb53856f162c92a2f0c0f068359a9d19b Mon Sep 17 00:00:00 2001 From: bruno Date: Sat, 6 Jul 2024 16:55:54 +0200 Subject: [PATCH] Fix naming and add gamerules --- gradle.properties | 6 +-- .../server_storage/lib/MyCraftingRecipe.java | 15 ------ .../ServerStorage.java | 31 ++++++++----- .../HardDriveContainerBlockEntity.java | 12 ++--- .../InventoryInterfaceBlockEntity.java | 22 +++++---- .../StorageInterfaceBlockEntity.java | 10 ++-- .../blocks/BusConnectorBlock.java | 4 +- .../blocks/ConnectedBlock.java | 4 +- .../blocks/HardDriveContainerBlock.java | 8 ++-- .../blocks/InventoryInterfaceBlock.java | 18 +++++--- .../blocks/StorageInterfaceBlock.java | 14 ++++-- .../items/HardDrive.java | 8 ++-- .../items/HardDriveItem.java | 6 +-- .../items/SimpleBlockItem.java | 4 +- .../items/SimpleItem.java | 4 +- .../lib/ConnectionType.java | 2 +- .../lib/CraftingEntry.java | 6 +-- .../lib/DriveComponents.java | 2 +- .../lib/HardDriveSlot.java | 4 +- .../lib/PagedGui.java | 9 +--- .../lib/StorageNetwork.java | 29 ++++++------ .../lib/StorageOperations.java | 2 +- .../lib/Util.java | 3 +- .../DriveContainerScreenHandler.java | 8 ++-- .../screens/CraftingScreen.java | 14 +++--- .../screens/SearchScreen.java | 4 +- .../screens/SettingsScreen.java | 10 ++-- .../screens/StorageScreen.java | 43 ++++++++++-------- .../assets/serverstorage/lang/en_us.json | 4 +- .../{ => serverstorage/textures}/icon.png | Bin src/main/resources/fabric.mod.json | 8 ++-- 31 files changed, 158 insertions(+), 156 deletions(-) delete mode 100644 src/main/java/systems/brn/server_storage/lib/MyCraftingRecipe.java rename src/main/java/systems/brn/{server_storage => serverstorage}/ServerStorage.java (72%) rename src/main/java/systems/brn/{server_storage => serverstorage}/blockentities/HardDriveContainerBlockEntity.java (90%) rename src/main/java/systems/brn/{server_storage => serverstorage}/blockentities/InventoryInterfaceBlockEntity.java (89%) rename src/main/java/systems/brn/{server_storage => serverstorage}/blockentities/StorageInterfaceBlockEntity.java (87%) rename src/main/java/systems/brn/{server_storage => serverstorage}/blocks/BusConnectorBlock.java (93%) rename src/main/java/systems/brn/{server_storage => serverstorage}/blocks/ConnectedBlock.java (97%) rename src/main/java/systems/brn/{server_storage => serverstorage}/blocks/HardDriveContainerBlock.java (95%) rename src/main/java/systems/brn/{server_storage => serverstorage}/blocks/InventoryInterfaceBlock.java (93%) rename src/main/java/systems/brn/{server_storage => serverstorage}/blocks/StorageInterfaceBlock.java (90%) rename src/main/java/systems/brn/{server_storage => serverstorage}/items/HardDrive.java (97%) rename src/main/java/systems/brn/{server_storage => serverstorage}/items/HardDriveItem.java (87%) rename src/main/java/systems/brn/{server_storage => serverstorage}/items/SimpleBlockItem.java (94%) rename src/main/java/systems/brn/{server_storage => serverstorage}/items/SimpleItem.java (96%) rename src/main/java/systems/brn/{server_storage => serverstorage}/lib/ConnectionType.java (91%) rename src/main/java/systems/brn/{server_storage => serverstorage}/lib/CraftingEntry.java (90%) rename src/main/java/systems/brn/{server_storage => serverstorage}/lib/DriveComponents.java (98%) rename src/main/java/systems/brn/{server_storage => serverstorage}/lib/HardDriveSlot.java (83%) rename src/main/java/systems/brn/{server_storage => serverstorage}/lib/PagedGui.java (94%) rename src/main/java/systems/brn/{server_storage => serverstorage}/lib/StorageNetwork.java (90%) rename src/main/java/systems/brn/{server_storage => serverstorage}/lib/StorageOperations.java (99%) rename src/main/java/systems/brn/{server_storage => serverstorage}/lib/Util.java (98%) rename src/main/java/systems/brn/{server_storage => serverstorage}/screenhandlers/DriveContainerScreenHandler.java (91%) rename src/main/java/systems/brn/{server_storage => serverstorage}/screens/CraftingScreen.java (95%) rename src/main/java/systems/brn/{server_storage => serverstorage}/screens/SearchScreen.java (88%) rename src/main/java/systems/brn/{server_storage => serverstorage}/screens/SettingsScreen.java (90%) rename src/main/java/systems/brn/{server_storage => serverstorage}/screens/StorageScreen.java (87%) rename src/main/resources/assets/{ => serverstorage/textures}/icon.png (100%) diff --git a/gradle.properties b/gradle.properties index a6e4e0d..9f85190 100644 --- a/gradle.properties +++ b/gradle.properties @@ -11,11 +11,11 @@ loader_version=0.15.11 fabric_version=0.100.4+1.21 # Mod Properties -mod_version=3.0.7 +mod_version=3.0.8 maven_group=systems.brn -archives_base_name=Server_storage +archives_base_name=Serverstorage # Dependencies -polymer_version=0.9.2+1.21 +polymer_version=0.9.4+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 diff --git a/src/main/java/systems/brn/server_storage/lib/MyCraftingRecipe.java b/src/main/java/systems/brn/server_storage/lib/MyCraftingRecipe.java deleted file mode 100644 index 03e843b..0000000 --- a/src/main/java/systems/brn/server_storage/lib/MyCraftingRecipe.java +++ /dev/null @@ -1,15 +0,0 @@ -package systems.brn.server_storage.lib; - -import net.minecraft.item.ItemStack; -import net.minecraft.recipe.CraftingRecipe; -import net.minecraft.recipe.RecipeEntry; - -import java.util.HashMap; - -public class MyCraftingRecipe { - HashMap inputs = new HashMap<>(); - HashMap outputs = new HashMap<>(); - MyCraftingRecipe(RecipeEntry recipeEntry) { - recipeEntry.value().getIngredients(); - } -} diff --git a/src/main/java/systems/brn/server_storage/ServerStorage.java b/src/main/java/systems/brn/serverstorage/ServerStorage.java similarity index 72% rename from src/main/java/systems/brn/server_storage/ServerStorage.java rename to src/main/java/systems/brn/serverstorage/ServerStorage.java index 7707255..d8367d2 100644 --- a/src/main/java/systems/brn/server_storage/ServerStorage.java +++ b/src/main/java/systems/brn/serverstorage/ServerStorage.java @@ -1,4 +1,4 @@ -package systems.brn.server_storage; +package systems.brn.serverstorage; import eu.pb4.polymer.resourcepack.api.PolymerResourcePackUtils; import net.fabricmc.api.ModInitializer; @@ -9,16 +9,16 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemGroups; import net.minecraft.util.Identifier; import net.minecraft.world.GameRules; -import systems.brn.server_storage.blockentities.HardDriveContainerBlockEntity; -import systems.brn.server_storage.blockentities.InventoryInterfaceBlockEntity; -import systems.brn.server_storage.blockentities.StorageInterfaceBlockEntity; -import systems.brn.server_storage.blocks.BusConnectorBlock; -import systems.brn.server_storage.blocks.HardDriveContainerBlock; -import systems.brn.server_storage.blocks.InventoryInterfaceBlock; -import systems.brn.server_storage.blocks.StorageInterfaceBlock; -import systems.brn.server_storage.items.HardDriveItem; -import systems.brn.server_storage.items.SimpleBlockItem; -import systems.brn.server_storage.items.SimpleItem; +import systems.brn.serverstorage.blockentities.HardDriveContainerBlockEntity; +import systems.brn.serverstorage.blockentities.InventoryInterfaceBlockEntity; +import systems.brn.serverstorage.blockentities.StorageInterfaceBlockEntity; +import systems.brn.serverstorage.blocks.BusConnectorBlock; +import systems.brn.serverstorage.blocks.HardDriveContainerBlock; +import systems.brn.serverstorage.blocks.InventoryInterfaceBlock; +import systems.brn.serverstorage.blocks.StorageInterfaceBlock; +import systems.brn.serverstorage.items.HardDriveItem; +import systems.brn.serverstorage.items.SimpleBlockItem; +import systems.brn.serverstorage.items.SimpleItem; import java.util.Arrays; import java.util.List; @@ -44,6 +44,15 @@ public class ServerStorage implements ModInitializer { public static InventoryInterfaceBlock INVENTORY_INTERFACE_BLOCK; public static BlockEntityType INVENTORY_INTERFACE_BLOCK_ENTITY; + public static final GameRules.Key ServerStorage_Crafting_Enable = + GameRuleRegistry.register("serverstoragecraftingmodule", GameRules.Category.MISC, GameRuleFactory.createBooleanRule(true)); + + public static final GameRules.Key ServerStorage_Terminal_Enable = + GameRuleRegistry.register("serverstorageterminalmodule", GameRules.Category.MISC, GameRuleFactory.createBooleanRule(true)); + + public static final GameRules.Key ServerStorage_Interface_Enable = + GameRuleRegistry.register("serverstorageinterfacemodule", GameRules.Category.MISC, GameRuleFactory.createBooleanRule(true)); + public static Item DRIVE_CASING; public static Item CPU; diff --git a/src/main/java/systems/brn/server_storage/blockentities/HardDriveContainerBlockEntity.java b/src/main/java/systems/brn/serverstorage/blockentities/HardDriveContainerBlockEntity.java similarity index 90% rename from src/main/java/systems/brn/server_storage/blockentities/HardDriveContainerBlockEntity.java rename to src/main/java/systems/brn/serverstorage/blockentities/HardDriveContainerBlockEntity.java index 5a081d5..18fe979 100644 --- a/src/main/java/systems/brn/server_storage/blockentities/HardDriveContainerBlockEntity.java +++ b/src/main/java/systems/brn/serverstorage/blockentities/HardDriveContainerBlockEntity.java @@ -1,4 +1,4 @@ -package systems.brn.server_storage.blockentities; +package systems.brn.serverstorage.blockentities; import net.minecraft.block.BlockState; import net.minecraft.block.entity.LootableContainerBlockEntity; @@ -11,14 +11,14 @@ import net.minecraft.screen.ScreenHandler; import net.minecraft.text.Text; import net.minecraft.util.collection.DefaultedList; import net.minecraft.util.math.BlockPos; -import systems.brn.server_storage.items.HardDrive; -import systems.brn.server_storage.lib.StorageNetwork; -import systems.brn.server_storage.screenhandlers.DriveContainerScreenHandler; +import systems.brn.serverstorage.items.HardDrive; +import systems.brn.serverstorage.lib.StorageNetwork; +import systems.brn.serverstorage.screenhandlers.DriveContainerScreenHandler; import java.util.ArrayList; -import static systems.brn.server_storage.ServerStorage.DRIVES; -import static systems.brn.server_storage.ServerStorage.HARD_DRIVE_CONTAINER_BLOCK_ENTITY; +import static systems.brn.serverstorage.ServerStorage.DRIVES; +import static systems.brn.serverstorage.ServerStorage.HARD_DRIVE_CONTAINER_BLOCK_ENTITY; public class HardDriveContainerBlockEntity extends LootableContainerBlockEntity { public DefaultedList inventory; diff --git a/src/main/java/systems/brn/server_storage/blockentities/InventoryInterfaceBlockEntity.java b/src/main/java/systems/brn/serverstorage/blockentities/InventoryInterfaceBlockEntity.java similarity index 89% rename from src/main/java/systems/brn/server_storage/blockentities/InventoryInterfaceBlockEntity.java rename to src/main/java/systems/brn/serverstorage/blockentities/InventoryInterfaceBlockEntity.java index 502e231..f0f92e3 100644 --- a/src/main/java/systems/brn/server_storage/blockentities/InventoryInterfaceBlockEntity.java +++ b/src/main/java/systems/brn/serverstorage/blockentities/InventoryInterfaceBlockEntity.java @@ -1,4 +1,4 @@ -package systems.brn.server_storage.blockentities; +package systems.brn.serverstorage.blockentities; import net.minecraft.block.BlockState; import net.minecraft.block.entity.BlockEntity; @@ -10,17 +10,18 @@ import net.minecraft.state.property.EnumProperty; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.world.World; -import systems.brn.server_storage.lib.ConnectionType; -import systems.brn.server_storage.lib.StorageNetwork; -import systems.brn.server_storage.screens.SettingsScreen; +import systems.brn.serverstorage.lib.ConnectionType; +import systems.brn.serverstorage.lib.StorageNetwork; +import systems.brn.serverstorage.screens.SettingsScreen; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; -import static systems.brn.server_storage.ServerStorage.INVENTORY_INTERFACE_BLOCK_ENTITY; -import static systems.brn.server_storage.blocks.ConnectedBlock.getPropertyForDirection; -import static systems.brn.server_storage.lib.StorageOperations.*; +import static systems.brn.serverstorage.ServerStorage.INVENTORY_INTERFACE_BLOCK_ENTITY; +import static systems.brn.serverstorage.ServerStorage.ServerStorage_Interface_Enable; +import static systems.brn.serverstorage.blocks.ConnectedBlock.getPropertyForDirection; +import static systems.brn.serverstorage.lib.StorageOperations.*; public class InventoryInterfaceBlockEntity extends BlockEntity { @@ -106,7 +107,7 @@ public class InventoryInterfaceBlockEntity extends BlockEntity { } public int processIncoming(ItemStack stack, int count) { - if (world != null && isOutput && filterItem(stack.getItem(), query)) { + if (world != null && 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); @@ -122,7 +123,10 @@ public class InventoryInterfaceBlockEntity extends BlockEntity { return count; } - public static void tick(World world, BlockPos blockPos, BlockState state, T t) { + public static void tick(World world, BlockPos blockPos, BlockState ignoredState, T ignoredt) { + if (!world.getGameRules().getBoolean(ServerStorage_Interface_Enable)){ + return; + } InventoryInterfaceBlockEntity blockEntity = (InventoryInterfaceBlockEntity) world.getBlockEntity(blockPos); if (blockEntity != null) { if (blockEntity.tickCounter == 0) { diff --git a/src/main/java/systems/brn/server_storage/blockentities/StorageInterfaceBlockEntity.java b/src/main/java/systems/brn/serverstorage/blockentities/StorageInterfaceBlockEntity.java similarity index 87% rename from src/main/java/systems/brn/server_storage/blockentities/StorageInterfaceBlockEntity.java rename to src/main/java/systems/brn/serverstorage/blockentities/StorageInterfaceBlockEntity.java index 276b2d4..587d90f 100644 --- a/src/main/java/systems/brn/server_storage/blockentities/StorageInterfaceBlockEntity.java +++ b/src/main/java/systems/brn/serverstorage/blockentities/StorageInterfaceBlockEntity.java @@ -1,17 +1,17 @@ -package systems.brn.server_storage.blockentities; +package systems.brn.serverstorage.blockentities; import net.minecraft.block.BlockState; import net.minecraft.block.entity.BlockEntity; import net.minecraft.nbt.NbtCompound; import net.minecraft.registry.RegistryWrapper; import net.minecraft.util.math.BlockPos; -import systems.brn.server_storage.lib.StorageNetwork; -import systems.brn.server_storage.screens.CraftingScreen; -import systems.brn.server_storage.screens.StorageScreen; +import systems.brn.serverstorage.lib.StorageNetwork; +import systems.brn.serverstorage.screens.CraftingScreen; +import systems.brn.serverstorage.screens.StorageScreen; import java.util.ArrayList; -import static systems.brn.server_storage.ServerStorage.STORAGE_INTERFACE_BLOCK_ENTITY; +import static systems.brn.serverstorage.ServerStorage.STORAGE_INTERFACE_BLOCK_ENTITY; public class StorageInterfaceBlockEntity extends BlockEntity { diff --git a/src/main/java/systems/brn/server_storage/blocks/BusConnectorBlock.java b/src/main/java/systems/brn/serverstorage/blocks/BusConnectorBlock.java similarity index 93% rename from src/main/java/systems/brn/server_storage/blocks/BusConnectorBlock.java rename to src/main/java/systems/brn/serverstorage/blocks/BusConnectorBlock.java index cebf844..ff72510 100644 --- a/src/main/java/systems/brn/server_storage/blocks/BusConnectorBlock.java +++ b/src/main/java/systems/brn/serverstorage/blocks/BusConnectorBlock.java @@ -1,4 +1,4 @@ -package systems.brn.server_storage.blocks; +package systems.brn.serverstorage.blocks; import eu.pb4.polymer.blocks.api.BlockModelType; import eu.pb4.polymer.blocks.api.PolymerBlockModel; @@ -9,7 +9,7 @@ import net.minecraft.registry.Registries; import net.minecraft.registry.Registry; import net.minecraft.util.Identifier; -import static systems.brn.server_storage.ServerStorage.*; +import static systems.brn.serverstorage.ServerStorage.*; public class BusConnectorBlock extends ConnectedBlock implements PolymerTexturedBlock { final Identifier identifier; diff --git a/src/main/java/systems/brn/server_storage/blocks/ConnectedBlock.java b/src/main/java/systems/brn/serverstorage/blocks/ConnectedBlock.java similarity index 97% rename from src/main/java/systems/brn/server_storage/blocks/ConnectedBlock.java rename to src/main/java/systems/brn/serverstorage/blocks/ConnectedBlock.java index e202730..ced3d9e 100644 --- a/src/main/java/systems/brn/server_storage/blocks/ConnectedBlock.java +++ b/src/main/java/systems/brn/serverstorage/blocks/ConnectedBlock.java @@ -1,4 +1,4 @@ -package systems.brn.server_storage.blocks; +package systems.brn.serverstorage.blocks; import eu.pb4.polymer.core.api.block.SimplePolymerBlock; import net.minecraft.block.Block; @@ -12,7 +12,7 @@ import net.minecraft.state.property.EnumProperty; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.world.World; -import systems.brn.server_storage.lib.ConnectionType; +import systems.brn.serverstorage.lib.ConnectionType; public class ConnectedBlock extends SimplePolymerBlock { diff --git a/src/main/java/systems/brn/server_storage/blocks/HardDriveContainerBlock.java b/src/main/java/systems/brn/serverstorage/blocks/HardDriveContainerBlock.java similarity index 95% rename from src/main/java/systems/brn/server_storage/blocks/HardDriveContainerBlock.java rename to src/main/java/systems/brn/serverstorage/blocks/HardDriveContainerBlock.java index 37a6bc7..d76c7bf 100644 --- a/src/main/java/systems/brn/server_storage/blocks/HardDriveContainerBlock.java +++ b/src/main/java/systems/brn/serverstorage/blocks/HardDriveContainerBlock.java @@ -1,4 +1,4 @@ -package systems.brn.server_storage.blocks; +package systems.brn.serverstorage.blocks; import eu.pb4.polymer.blocks.api.BlockModelType; import eu.pb4.polymer.blocks.api.PolymerBlockModel; @@ -24,10 +24,10 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; -import systems.brn.server_storage.blockentities.HardDriveContainerBlockEntity; -import systems.brn.server_storage.lib.StorageNetwork; +import systems.brn.serverstorage.blockentities.HardDriveContainerBlockEntity; +import systems.brn.serverstorage.lib.StorageNetwork; -import static systems.brn.server_storage.ServerStorage.*; +import static systems.brn.serverstorage.ServerStorage.*; public class HardDriveContainerBlock extends ConnectedBlock implements PolymerTexturedBlock, BlockEntityProvider { diff --git a/src/main/java/systems/brn/server_storage/blocks/InventoryInterfaceBlock.java b/src/main/java/systems/brn/serverstorage/blocks/InventoryInterfaceBlock.java similarity index 93% rename from src/main/java/systems/brn/server_storage/blocks/InventoryInterfaceBlock.java rename to src/main/java/systems/brn/serverstorage/blocks/InventoryInterfaceBlock.java index 2dd169b..6f1672c 100644 --- a/src/main/java/systems/brn/server_storage/blocks/InventoryInterfaceBlock.java +++ b/src/main/java/systems/brn/serverstorage/blocks/InventoryInterfaceBlock.java @@ -1,4 +1,4 @@ -package systems.brn.server_storage.blocks; +package systems.brn.serverstorage.blocks; import eu.pb4.polymer.blocks.api.BlockModelType; import eu.pb4.polymer.blocks.api.PolymerBlockModel; @@ -30,13 +30,13 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; -import systems.brn.server_storage.blockentities.InventoryInterfaceBlockEntity; -import systems.brn.server_storage.lib.PagedGui; -import systems.brn.server_storage.screens.SearchScreen; -import systems.brn.server_storage.screens.SettingsScreen; +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 static systems.brn.server_storage.ServerStorage.*; -import static systems.brn.server_storage.lib.PagedGui.*; +import static systems.brn.serverstorage.ServerStorage.*; +import static systems.brn.serverstorage.lib.PagedGui.*; public class InventoryInterfaceBlock extends ConnectedBlock implements PolymerTexturedBlock, BlockEntityProvider { final Identifier identifier; @@ -150,6 +150,10 @@ public class InventoryInterfaceBlock extends ConnectedBlock implements PolymerTe Block block = state.getBlock(); if (block instanceof InventoryInterfaceBlock) { + if (!world.getGameRules().getBoolean(ServerStorage_Interface_Enable)){ + playerEntity.sendMessage(Text.translatable("message.serverstorage.block_disabled"), true); + return ActionResult.PASS; + } BlockEntity tempBlockEntity = world.getBlockEntity(pos); if (tempBlockEntity instanceof InventoryInterfaceBlockEntity blockEntity) { if (!world.isClient && !playerEntity.isSpectator()) { diff --git a/src/main/java/systems/brn/server_storage/blocks/StorageInterfaceBlock.java b/src/main/java/systems/brn/serverstorage/blocks/StorageInterfaceBlock.java similarity index 90% rename from src/main/java/systems/brn/server_storage/blocks/StorageInterfaceBlock.java rename to src/main/java/systems/brn/serverstorage/blocks/StorageInterfaceBlock.java index ae01821..d537b7e 100644 --- a/src/main/java/systems/brn/server_storage/blocks/StorageInterfaceBlock.java +++ b/src/main/java/systems/brn/serverstorage/blocks/StorageInterfaceBlock.java @@ -1,4 +1,4 @@ -package systems.brn.server_storage.blocks; +package systems.brn.serverstorage.blocks; import eu.pb4.polymer.blocks.api.BlockModelType; import eu.pb4.polymer.blocks.api.PolymerBlockModel; @@ -30,13 +30,13 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; -import systems.brn.server_storage.blockentities.StorageInterfaceBlockEntity; -import systems.brn.server_storage.screens.StorageScreen; +import systems.brn.serverstorage.blockentities.StorageInterfaceBlockEntity; +import systems.brn.serverstorage.screens.StorageScreen; import java.util.List; -import static systems.brn.server_storage.ServerStorage.*; -import static systems.brn.server_storage.lib.Util.generateBookContent; +import static systems.brn.serverstorage.ServerStorage.*; +import static systems.brn.serverstorage.lib.Util.generateBookContent; public class StorageInterfaceBlock extends ConnectedBlock implements PolymerTexturedBlock, BlockEntityProvider { final Identifier identifier; @@ -86,6 +86,10 @@ public class StorageInterfaceBlock extends ConnectedBlock implements PolymerText Block block = state.getBlock(); if (block instanceof StorageInterfaceBlock) { + if (!world.getGameRules().getBoolean(ServerStorage_Terminal_Enable)){ + player.sendMessage(Text.translatable("message.serverstorage.block_disabled"), true); + return ActionResult.PASS; + } if (!world.isClient && !player.isSpectator()) { if (!player.isSneaking()) { StorageScreen storageScreen = new StorageScreen((ServerPlayerEntity) player, pos, null); diff --git a/src/main/java/systems/brn/server_storage/items/HardDrive.java b/src/main/java/systems/brn/serverstorage/items/HardDrive.java similarity index 97% rename from src/main/java/systems/brn/server_storage/items/HardDrive.java rename to src/main/java/systems/brn/serverstorage/items/HardDrive.java index 92cf9c4..f766f24 100644 --- a/src/main/java/systems/brn/server_storage/items/HardDrive.java +++ b/src/main/java/systems/brn/serverstorage/items/HardDrive.java @@ -1,4 +1,4 @@ -package systems.brn.server_storage.items; +package systems.brn.serverstorage.items; import net.minecraft.component.DataComponentTypes; import net.minecraft.component.type.LoreComponent; @@ -7,12 +7,12 @@ import net.minecraft.item.Items; import net.minecraft.text.Style; import net.minecraft.text.Text; import net.minecraft.util.Formatting; -import systems.brn.server_storage.blockentities.HardDriveContainerBlockEntity; +import systems.brn.serverstorage.blockentities.HardDriveContainerBlockEntity; import java.util.*; -import static systems.brn.server_storage.lib.DriveComponents.*; -import static systems.brn.server_storage.lib.StorageOperations.canCombine; +import static systems.brn.serverstorage.lib.DriveComponents.*; +import static systems.brn.serverstorage.lib.StorageOperations.canCombine; public class HardDrive { private ItemStack driveStack; diff --git a/src/main/java/systems/brn/server_storage/items/HardDriveItem.java b/src/main/java/systems/brn/serverstorage/items/HardDriveItem.java similarity index 87% rename from src/main/java/systems/brn/server_storage/items/HardDriveItem.java rename to src/main/java/systems/brn/serverstorage/items/HardDriveItem.java index 329d055..76bbae7 100644 --- a/src/main/java/systems/brn/server_storage/items/HardDriveItem.java +++ b/src/main/java/systems/brn/serverstorage/items/HardDriveItem.java @@ -1,4 +1,4 @@ -package systems.brn.server_storage.items; +package systems.brn.serverstorage.items; import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents; import net.minecraft.item.Item; @@ -6,13 +6,13 @@ import net.minecraft.item.ItemGroups; import net.minecraft.registry.Registries; import net.minecraft.registry.Registry; import net.minecraft.util.Identifier; -import systems.brn.server_storage.lib.DriveComponents; +import systems.brn.serverstorage.lib.DriveComponents; import java.util.ArrayList; import java.util.HashMap; import java.util.List; -import static systems.brn.server_storage.ServerStorage.id; +import static systems.brn.serverstorage.ServerStorage.id; public class HardDriveItem extends SimpleItem { public HardDriveItem(Settings settings, Identifier identifier) { diff --git a/src/main/java/systems/brn/server_storage/items/SimpleBlockItem.java b/src/main/java/systems/brn/serverstorage/items/SimpleBlockItem.java similarity index 94% rename from src/main/java/systems/brn/server_storage/items/SimpleBlockItem.java rename to src/main/java/systems/brn/serverstorage/items/SimpleBlockItem.java index 197e497..b0e5b35 100644 --- a/src/main/java/systems/brn/server_storage/items/SimpleBlockItem.java +++ b/src/main/java/systems/brn/serverstorage/items/SimpleBlockItem.java @@ -1,4 +1,4 @@ -package systems.brn.server_storage.items; +package systems.brn.serverstorage.items; import eu.pb4.polymer.core.api.item.PolymerBlockItem; import eu.pb4.polymer.core.api.item.PolymerItem; @@ -16,7 +16,7 @@ import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.util.Identifier; import org.jetbrains.annotations.Nullable; -import static systems.brn.server_storage.ServerStorage.id; +import static systems.brn.serverstorage.ServerStorage.id; public class SimpleBlockItem extends PolymerBlockItem implements PolymerItem { private final PolymerModelData polymerModel; diff --git a/src/main/java/systems/brn/server_storage/items/SimpleItem.java b/src/main/java/systems/brn/serverstorage/items/SimpleItem.java similarity index 96% rename from src/main/java/systems/brn/server_storage/items/SimpleItem.java rename to src/main/java/systems/brn/serverstorage/items/SimpleItem.java index cd9c2f9..b69fa8c 100644 --- a/src/main/java/systems/brn/server_storage/items/SimpleItem.java +++ b/src/main/java/systems/brn/serverstorage/items/SimpleItem.java @@ -1,4 +1,4 @@ -package systems.brn.server_storage.items; +package systems.brn.serverstorage.items; import eu.pb4.polymer.core.api.item.PolymerItem; import eu.pb4.polymer.core.api.item.SimplePolymerItem; @@ -16,7 +16,7 @@ import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.List; -import static systems.brn.server_storage.ServerStorage.id; +import static systems.brn.serverstorage.ServerStorage.id; public class SimpleItem extends SimplePolymerItem implements PolymerItem { private final PolymerModelData polymerModel; diff --git a/src/main/java/systems/brn/server_storage/lib/ConnectionType.java b/src/main/java/systems/brn/serverstorage/lib/ConnectionType.java similarity index 91% rename from src/main/java/systems/brn/server_storage/lib/ConnectionType.java rename to src/main/java/systems/brn/serverstorage/lib/ConnectionType.java index e127736..2dc3101 100644 --- a/src/main/java/systems/brn/server_storage/lib/ConnectionType.java +++ b/src/main/java/systems/brn/serverstorage/lib/ConnectionType.java @@ -1,4 +1,4 @@ -package systems.brn.server_storage.lib; +package systems.brn.serverstorage.lib; import net.minecraft.util.StringIdentifiable; diff --git a/src/main/java/systems/brn/server_storage/lib/CraftingEntry.java b/src/main/java/systems/brn/serverstorage/lib/CraftingEntry.java similarity index 90% rename from src/main/java/systems/brn/server_storage/lib/CraftingEntry.java rename to src/main/java/systems/brn/serverstorage/lib/CraftingEntry.java index 11baf2f..bb8e6eb 100644 --- a/src/main/java/systems/brn/server_storage/lib/CraftingEntry.java +++ b/src/main/java/systems/brn/serverstorage/lib/CraftingEntry.java @@ -1,4 +1,4 @@ -package systems.brn.server_storage.lib; +package systems.brn.serverstorage.lib; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -9,12 +9,12 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Map; -import static systems.brn.server_storage.lib.Util.addCountToLore; +import static systems.brn.serverstorage.lib.Util.addCountToLore; public class CraftingEntry { public final ArrayList outputStacks; public final RecipeEntry recipeEntry; - public final ArrayList myCraftingRecipeEntries; + public final ArrayList> myCraftingRecipeEntries; public CraftingEntry(ItemStack itemStack, RecipeEntry recipeEntry, HashMap inputs, Integer maxCount) { ArrayList tempOutputStacks = new ArrayList<>(); diff --git a/src/main/java/systems/brn/server_storage/lib/DriveComponents.java b/src/main/java/systems/brn/serverstorage/lib/DriveComponents.java similarity index 98% rename from src/main/java/systems/brn/server_storage/lib/DriveComponents.java rename to src/main/java/systems/brn/serverstorage/lib/DriveComponents.java index c1060ae..ca262cc 100644 --- a/src/main/java/systems/brn/server_storage/lib/DriveComponents.java +++ b/src/main/java/systems/brn/serverstorage/lib/DriveComponents.java @@ -1,4 +1,4 @@ -package systems.brn.server_storage.lib; +package systems.brn.serverstorage.lib; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; diff --git a/src/main/java/systems/brn/server_storage/lib/HardDriveSlot.java b/src/main/java/systems/brn/serverstorage/lib/HardDriveSlot.java similarity index 83% rename from src/main/java/systems/brn/server_storage/lib/HardDriveSlot.java rename to src/main/java/systems/brn/serverstorage/lib/HardDriveSlot.java index c38ba4f..6270c2d 100644 --- a/src/main/java/systems/brn/server_storage/lib/HardDriveSlot.java +++ b/src/main/java/systems/brn/serverstorage/lib/HardDriveSlot.java @@ -1,11 +1,11 @@ -package systems.brn.server_storage.lib; +package systems.brn.serverstorage.lib; import net.minecraft.inventory.Inventory; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.screen.slot.Slot; -import static systems.brn.server_storage.ServerStorage.DRIVES; +import static systems.brn.serverstorage.ServerStorage.DRIVES; public class HardDriveSlot extends Slot { public HardDriveSlot(Inventory inventory, int index, int x, int y) { diff --git a/src/main/java/systems/brn/server_storage/lib/PagedGui.java b/src/main/java/systems/brn/serverstorage/lib/PagedGui.java similarity index 94% rename from src/main/java/systems/brn/server_storage/lib/PagedGui.java rename to src/main/java/systems/brn/serverstorage/lib/PagedGui.java index 4bb764d..50d13a5 100644 --- a/src/main/java/systems/brn/server_storage/lib/PagedGui.java +++ b/src/main/java/systems/brn/serverstorage/lib/PagedGui.java @@ -1,4 +1,4 @@ -package systems.brn.server_storage.lib; +package systems.brn.serverstorage.lib; import eu.pb4.sgui.api.elements.GuiElement; import eu.pb4.sgui.api.elements.GuiElementBuilder; @@ -31,11 +31,8 @@ public abstract class PagedGui extends SimpleGui { public static final String GUI_A = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNGU0MTc0ODEyMTYyNmYyMmFlMTZhNGM2NjRjNzMwMWE5ZjhlYTU5MWJmNGQyOTg4ODk1NzY4MmE5ZmRhZiJ9fX0="; public static final String GUI_1 = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvY2E1MTZmYmFlMTYwNThmMjUxYWVmOWE2OGQzMDc4NTQ5ZjQ4ZjZkNWI2ODNmMTljZjVhMTc0NTIxN2Q3MmNjIn19fQ=="; public static final String GUI_STORE_ALL = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMWFkNmM4MWY4OTlhNzg1ZWNmMjZiZTFkYzQ4ZWFlMmJjZmU3NzdhODYyMzkwZjU3ODVlOTViZDgzYmQxNGQifX19"; - public static final String GUI_CONTAINERS = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvN2EzYzhjNmQzYWFhOTYzNjNkNGJlZjI1NzhmMTAyNDc4MWVhMTRlOWQ4NWE5ZGNmYzA5MzU4NDdhNmZiNWM4ZCJ9fX0="; public static final String GUI_SETTINGS = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZTRkNDliYWU5NWM3OTBjM2IxZmY1YjJmMDEwNTJhNzE0ZDYxODU0ODFkNWIxYzg1OTMwYjNmOTlkMjMyMTY3NCJ9fX0="; public static final String GUI_CRAFTING = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYWQyYzBjZWRmYzMyZTNiZWVlOTU1Y2FiZDY2ZmQ0ZDc2NWVlZGEzYWRjYzg0YmM0NTFjOWZkYmVjZjNjYjdjMiJ9fX0="; - public static final String GUI_AUTOSUCK_OFF = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOGViODFlZjg5MDIzNzk2NTBiYTc5ZjQ1NzIzZDZiOWM4ODgzODhhMDBmYzRlMTkyZjM0NTRmZTE5Mzg4MmVlMSJ9fX0="; - public static final String GUI_AUTOSUCK_ON = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMThjNDQzYWRhNmUzOWZjYTgzN2EwMzgzYjBhNWUzZTU1NDc3M2I5NjYwYzQ4NzNmNTkxMDMyZGJlOWFkY2RmOCJ9fX0="; public static final String GUI_SIDE_NORTH = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZGEyMjFlNGY5NmJlZTYyNjE3NTIzOTZhMzI2NWZmYTRkZWRmOGZmNDgzOWFiZDE0ZjQ5ZWRlZTFlNTMwOTIifX19"; public static final String GUI_SIDE_SOUTH = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZDcxMDEzODQxNjUyODg4OTgxNTU0OGI0NjIzZDI4ZDg2YmJiYWU1NjE5ZDY5Y2Q5ZGJjNWFkNmI0Mzc0NCJ9fX0="; @@ -114,10 +111,6 @@ public abstract class PagedGui extends SimpleGui { } } - protected int getPage() { - return this.page; - } - protected abstract int getPageAmount(); protected abstract DisplayElement getElement(int id); diff --git a/src/main/java/systems/brn/server_storage/lib/StorageNetwork.java b/src/main/java/systems/brn/serverstorage/lib/StorageNetwork.java similarity index 90% rename from src/main/java/systems/brn/server_storage/lib/StorageNetwork.java rename to src/main/java/systems/brn/serverstorage/lib/StorageNetwork.java index 4e47cbb..7093564 100644 --- a/src/main/java/systems/brn/server_storage/lib/StorageNetwork.java +++ b/src/main/java/systems/brn/serverstorage/lib/StorageNetwork.java @@ -1,4 +1,4 @@ -package systems.brn.server_storage.lib; +package systems.brn.serverstorage.lib; import net.minecraft.block.Block; import net.minecraft.block.BlockState; @@ -7,21 +7,20 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.world.World; -import systems.brn.server_storage.blockentities.HardDriveContainerBlockEntity; -import systems.brn.server_storage.blockentities.InventoryInterfaceBlockEntity; -import systems.brn.server_storage.blockentities.StorageInterfaceBlockEntity; -import systems.brn.server_storage.blocks.BusConnectorBlock; -import systems.brn.server_storage.blocks.HardDriveContainerBlock; -import systems.brn.server_storage.blocks.InventoryInterfaceBlock; -import systems.brn.server_storage.blocks.StorageInterfaceBlock; -import systems.brn.server_storage.items.HardDrive; +import systems.brn.serverstorage.blockentities.HardDriveContainerBlockEntity; +import systems.brn.serverstorage.blockentities.InventoryInterfaceBlockEntity; +import systems.brn.serverstorage.blockentities.StorageInterfaceBlockEntity; +import systems.brn.serverstorage.blocks.BusConnectorBlock; +import systems.brn.serverstorage.blocks.HardDriveContainerBlock; +import systems.brn.serverstorage.blocks.InventoryInterfaceBlock; +import systems.brn.serverstorage.blocks.StorageInterfaceBlock; +import systems.brn.serverstorage.items.HardDrive; -import java.security.KeyStore; import java.util.*; -import static systems.brn.server_storage.ServerStorage.DRIVES; -import static systems.brn.server_storage.blocks.BusConnectorBlock.*; -import static systems.brn.server_storage.lib.StorageOperations.*; +import static systems.brn.serverstorage.ServerStorage.DRIVES; +import static systems.brn.serverstorage.blocks.BusConnectorBlock.*; +import static systems.brn.serverstorage.lib.StorageOperations.*; public class StorageNetwork { public List driveContainers; @@ -33,8 +32,8 @@ public class StorageNetwork { public final World world; public final BlockPos startPos; - public boolean sortAlphabetically = false; - public String searchString = ""; + public boolean sortAlphabetically; + public String searchString; public int driveContainerCount; public int drivesCount; diff --git a/src/main/java/systems/brn/server_storage/lib/StorageOperations.java b/src/main/java/systems/brn/serverstorage/lib/StorageOperations.java similarity index 99% rename from src/main/java/systems/brn/server_storage/lib/StorageOperations.java rename to src/main/java/systems/brn/serverstorage/lib/StorageOperations.java index 5ec351c..78b0047 100644 --- a/src/main/java/systems/brn/server_storage/lib/StorageOperations.java +++ b/src/main/java/systems/brn/serverstorage/lib/StorageOperations.java @@ -1,4 +1,4 @@ -package systems.brn.server_storage.lib; +package systems.brn.serverstorage.lib; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.inventory.Inventory; diff --git a/src/main/java/systems/brn/server_storage/lib/Util.java b/src/main/java/systems/brn/serverstorage/lib/Util.java similarity index 98% rename from src/main/java/systems/brn/server_storage/lib/Util.java rename to src/main/java/systems/brn/serverstorage/lib/Util.java index d363bb9..e22b227 100644 --- a/src/main/java/systems/brn/server_storage/lib/Util.java +++ b/src/main/java/systems/brn/serverstorage/lib/Util.java @@ -1,10 +1,9 @@ -package systems.brn.server_storage.lib; +package systems.brn.serverstorage.lib; import net.minecraft.component.DataComponentTypes; import net.minecraft.component.type.LoreComponent; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; import net.minecraft.recipe.*; import net.minecraft.server.MinecraftServer; import net.minecraft.text.RawFilteredPair; diff --git a/src/main/java/systems/brn/server_storage/screenhandlers/DriveContainerScreenHandler.java b/src/main/java/systems/brn/serverstorage/screenhandlers/DriveContainerScreenHandler.java similarity index 91% rename from src/main/java/systems/brn/server_storage/screenhandlers/DriveContainerScreenHandler.java rename to src/main/java/systems/brn/serverstorage/screenhandlers/DriveContainerScreenHandler.java index 800ff45..2203f81 100644 --- a/src/main/java/systems/brn/server_storage/screenhandlers/DriveContainerScreenHandler.java +++ b/src/main/java/systems/brn/serverstorage/screenhandlers/DriveContainerScreenHandler.java @@ -1,4 +1,4 @@ -package systems.brn.server_storage.screenhandlers; +package systems.brn.serverstorage.screenhandlers; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerInventory; @@ -7,8 +7,8 @@ import net.minecraft.item.ItemStack; import net.minecraft.screen.ScreenHandler; import net.minecraft.screen.ScreenHandlerType; import net.minecraft.screen.slot.Slot; -import systems.brn.server_storage.blockentities.HardDriveContainerBlockEntity; -import systems.brn.server_storage.lib.StorageNetwork; +import systems.brn.serverstorage.blockentities.HardDriveContainerBlockEntity; +import systems.brn.serverstorage.lib.HardDriveSlot; public class DriveContainerScreenHandler extends ScreenHandler { private final Inventory inventory; @@ -25,7 +25,7 @@ public class DriveContainerScreenHandler extends ScreenHandler { int j; for (j = 0; j < 5; ++j) { - this.addSlot(new Slot(inventory, j, 44 + j * 18, 20)); + this.addSlot(new HardDriveSlot(inventory, j, 44 + j * 18, 20)); } for (j = 0; j < 3; ++j) { diff --git a/src/main/java/systems/brn/server_storage/screens/CraftingScreen.java b/src/main/java/systems/brn/serverstorage/screens/CraftingScreen.java similarity index 95% rename from src/main/java/systems/brn/server_storage/screens/CraftingScreen.java rename to src/main/java/systems/brn/serverstorage/screens/CraftingScreen.java index f78b0c8..1a54b5c 100644 --- a/src/main/java/systems/brn/server_storage/screens/CraftingScreen.java +++ b/src/main/java/systems/brn/serverstorage/screens/CraftingScreen.java @@ -1,4 +1,4 @@ -package systems.brn.server_storage.screens; +package systems.brn.serverstorage.screens; import eu.pb4.sgui.api.elements.GuiElementBuilder; import net.minecraft.entity.player.PlayerEntity; @@ -9,17 +9,17 @@ import net.minecraft.recipe.CraftingRecipe; import net.minecraft.recipe.Ingredient; import net.minecraft.recipe.RecipeEntry; import net.minecraft.text.Text; -import systems.brn.server_storage.blockentities.StorageInterfaceBlockEntity; -import systems.brn.server_storage.lib.CraftingEntry; -import systems.brn.server_storage.lib.PagedGui; +import systems.brn.serverstorage.blockentities.StorageInterfaceBlockEntity; +import systems.brn.serverstorage.lib.CraftingEntry; +import systems.brn.serverstorage.lib.PagedGui; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import java.util.Objects; -import static systems.brn.server_storage.lib.StorageOperations.*; -import static systems.brn.server_storage.lib.Util.getCraftableRecipes; +import static systems.brn.serverstorage.lib.StorageOperations.*; +import static systems.brn.serverstorage.lib.Util.getCraftableRecipes; public class CraftingScreen extends PagedGui { private final StorageScreen storageScreen; @@ -51,7 +51,7 @@ public class CraftingScreen extends PagedGui { ArrayList recipes = new ArrayList<>(); for (CraftingEntry craftingEntry : craftingEntries) { - ItemStack stackWithCount = craftingEntry.outputStacks.get(0).copy(); + ItemStack stackWithCount = craftingEntry.outputStacks.getFirst().copy(); if (stackWithCount.getCount() > stackWithCount.getMaxCount()) { stackWithCount.setCount(stackWithCount.getMaxCount()); } diff --git a/src/main/java/systems/brn/server_storage/screens/SearchScreen.java b/src/main/java/systems/brn/serverstorage/screens/SearchScreen.java similarity index 88% rename from src/main/java/systems/brn/server_storage/screens/SearchScreen.java rename to src/main/java/systems/brn/serverstorage/screens/SearchScreen.java index 557a563..ed967b0 100644 --- a/src/main/java/systems/brn/server_storage/screens/SearchScreen.java +++ b/src/main/java/systems/brn/serverstorage/screens/SearchScreen.java @@ -1,8 +1,8 @@ -package systems.brn.server_storage.screens; +package systems.brn.serverstorage.screens; import eu.pb4.sgui.api.gui.AnvilInputGui; import eu.pb4.sgui.api.gui.SimpleGui; -import systems.brn.server_storage.blockentities.InventoryInterfaceBlockEntity; +import systems.brn.serverstorage.blockentities.InventoryInterfaceBlockEntity; public class SearchScreen extends AnvilInputGui { diff --git a/src/main/java/systems/brn/server_storage/screens/SettingsScreen.java b/src/main/java/systems/brn/serverstorage/screens/SettingsScreen.java similarity index 90% rename from src/main/java/systems/brn/server_storage/screens/SettingsScreen.java rename to src/main/java/systems/brn/serverstorage/screens/SettingsScreen.java index 103232e..01e0f76 100644 --- a/src/main/java/systems/brn/server_storage/screens/SettingsScreen.java +++ b/src/main/java/systems/brn/serverstorage/screens/SettingsScreen.java @@ -1,4 +1,4 @@ -package systems.brn.server_storage.screens; +package systems.brn.serverstorage.screens; import eu.pb4.sgui.api.elements.GuiElementBuilder; import eu.pb4.sgui.api.gui.SimpleGui; @@ -8,8 +8,8 @@ import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.text.Text; import net.minecraft.util.Formatting; import org.jetbrains.annotations.Nullable; -import systems.brn.server_storage.blockentities.InventoryInterfaceBlockEntity; -import systems.brn.server_storage.lib.PagedGui; +import systems.brn.serverstorage.blockentities.InventoryInterfaceBlockEntity; +import systems.brn.serverstorage.lib.PagedGui; import java.util.ArrayList; @@ -37,10 +37,6 @@ public class SettingsScreen extends PagedGui { this(parentScreen, parentScreen.getPlayer(), parentScreen.blockEntity); } - public SettingsScreen(SimpleGui parentScreen, BlockEntity blockEntity) { - this(parentScreen, parentScreen.getPlayer(), blockEntity); - } - public SettingsScreen(ServerPlayerEntity player, BlockEntity blockEntity) { this(null, player, blockEntity); } diff --git a/src/main/java/systems/brn/server_storage/screens/StorageScreen.java b/src/main/java/systems/brn/serverstorage/screens/StorageScreen.java similarity index 87% rename from src/main/java/systems/brn/server_storage/screens/StorageScreen.java rename to src/main/java/systems/brn/serverstorage/screens/StorageScreen.java index b11e458..c5d801a 100644 --- a/src/main/java/systems/brn/server_storage/screens/StorageScreen.java +++ b/src/main/java/systems/brn/serverstorage/screens/StorageScreen.java @@ -1,4 +1,4 @@ -package systems.brn.server_storage.screens; +package systems.brn.serverstorage.screens; import eu.pb4.sgui.api.ClickType; import eu.pb4.sgui.api.elements.GuiElementBuilder; @@ -11,13 +11,15 @@ import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.text.Text; import net.minecraft.util.Formatting; import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; -import systems.brn.server_storage.blockentities.StorageInterfaceBlockEntity; -import systems.brn.server_storage.lib.PagedGui; +import systems.brn.serverstorage.blockentities.StorageInterfaceBlockEntity; +import systems.brn.serverstorage.lib.PagedGui; -import static systems.brn.server_storage.lib.StorageOperations.*; -import static systems.brn.server_storage.lib.Util.addCountToLore; -import static systems.brn.server_storage.lib.Util.removeCountFromLore; +import static systems.brn.serverstorage.ServerStorage.ServerStorage_Crafting_Enable; +import static systems.brn.serverstorage.lib.StorageOperations.*; +import static systems.brn.serverstorage.lib.Util.addCountToLore; +import static systems.brn.serverstorage.lib.Util.removeCountFromLore; public class StorageScreen extends PagedGui { private final ServerPlayerEntity player; @@ -200,18 +202,23 @@ public class StorageScreen extends PagedGui { @Override protected DisplayElement crafting() { - return DisplayElement.of( - new GuiElementBuilder(Items.PLAYER_HEAD) - .setName(Text.translatable("container.crafting").formatted(Formatting.WHITE)) - .hideDefaultTooltip().noDefaults() - .setSkullOwner(GUI_CRAFTING) - .setCallback((x, y, z) -> { - playClickSound(player); - CraftingScreen craftingScreen = new CraftingScreen(this); - playClickSound(getPlayer()); - craftingScreen.open(); - }) - ); + World world = blockEntity.getWorld(); + if (world != null && world.getGameRules().getBoolean(ServerStorage_Crafting_Enable)) { + return DisplayElement.of( + new GuiElementBuilder(Items.PLAYER_HEAD) + .setName(Text.translatable("container.crafting").formatted(Formatting.WHITE)) + .hideDefaultTooltip().noDefaults() + .setSkullOwner(GUI_CRAFTING) + .setCallback((x, y, z) -> { + playClickSound(player); + CraftingScreen craftingScreen = new CraftingScreen(this); + playClickSound(getPlayer()); + craftingScreen.open(); + }) + ); + } else { + return DisplayElement.filler(); + } } public void doSearch(String query) { diff --git a/src/main/resources/assets/serverstorage/lang/en_us.json b/src/main/resources/assets/serverstorage/lang/en_us.json index ce3c943..b072505 100644 --- a/src/main/resources/assets/serverstorage/lang/en_us.json +++ b/src/main/resources/assets/serverstorage/lang/en_us.json @@ -55,5 +55,7 @@ "gui.serverstorage.direction_west": "West", "gui.serverstorage.direction_east": "East", "gui.serverstorage.direction_up": "Up", - "gui.serverstorage.direction_down": "Down" + "gui.serverstorage.direction_down": "Down", + + "message.serverstorage.block_disabled": "This block was disabled in a gamerule, contact admins" } \ No newline at end of file diff --git a/src/main/resources/assets/icon.png b/src/main/resources/assets/serverstorage/textures/icon.png similarity index 100% rename from src/main/resources/assets/icon.png rename to src/main/resources/assets/serverstorage/textures/icon.png diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 1176a5f..82da586 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -1,19 +1,19 @@ { "schemaVersion": 1, - "id": "server_storage", + "id": "serverstorage", "version": "${version}", "name": "Server storage", "description": "", "authors": [], "contact": { - "repo": "https://git.brn.systems/BRNSystems/Server storageatencryptor" + "repo": "https://git.brn.systems/BRNSystems/Server storage" }, "license": "MIT", - "icon": "assets/icon.png", + "icon": "assets/serverstorage/textures/icon.png", "environment": "*", "entrypoints": { "main": [ - "systems.brn.server_storage.ServerStorage" + "systems.brn.serverstorage.ServerStorage" ] }, "depends": {