Fix naming and add gamerules

This commit is contained in:
Bruno Rybársky 2024-07-06 16:55:54 +02:00
parent 773cb102e3
commit 6cd7c83bb5
31 changed files with 158 additions and 156 deletions

@ -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

@ -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<ItemStack, Integer> inputs = new HashMap<>();
HashMap<ItemStack, Integer> outputs = new HashMap<>();
MyCraftingRecipe(RecipeEntry<CraftingRecipe> recipeEntry) {
recipeEntry.value().getIngredients();
}
}

@ -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<InventoryInterfaceBlockEntity> INVENTORY_INTERFACE_BLOCK_ENTITY;
public static final GameRules.Key<GameRules.BooleanRule> ServerStorage_Crafting_Enable =
GameRuleRegistry.register("serverstoragecraftingmodule", GameRules.Category.MISC, GameRuleFactory.createBooleanRule(true));
public static final GameRules.Key<GameRules.BooleanRule> ServerStorage_Terminal_Enable =
GameRuleRegistry.register("serverstorageterminalmodule", GameRules.Category.MISC, GameRuleFactory.createBooleanRule(true));
public static final GameRules.Key<GameRules.BooleanRule> ServerStorage_Interface_Enable =
GameRuleRegistry.register("serverstorageinterfacemodule", GameRules.Category.MISC, GameRuleFactory.createBooleanRule(true));
public static Item DRIVE_CASING;
public static Item CPU;

@ -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<ItemStack> inventory;

@ -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> connectionType = getPropertyForDirection(direction);
@ -122,7 +123,10 @@ public class InventoryInterfaceBlockEntity extends BlockEntity {
return count;
}
public static <T extends BlockEntity> void tick(World world, BlockPos blockPos, BlockState state, T t) {
public static <T extends BlockEntity> 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) {

@ -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 {

@ -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;

@ -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 {

@ -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 {

@ -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()) {

@ -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);

@ -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;

@ -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) {

@ -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;

@ -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;

@ -1,4 +1,4 @@
package systems.brn.server_storage.lib;
package systems.brn.serverstorage.lib;
import net.minecraft.util.StringIdentifiable;

@ -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<ItemStack> outputStacks;
public final RecipeEntry<CraftingRecipe> recipeEntry;
public final ArrayList<MyCraftingRecipe> myCraftingRecipeEntries;
public final ArrayList<RecipeEntry<CraftingRecipe>> myCraftingRecipeEntries;
public CraftingEntry(ItemStack itemStack, RecipeEntry<CraftingRecipe> recipeEntry, HashMap<ItemStack, Integer> inputs, Integer maxCount) {
ArrayList<ItemStack> tempOutputStacks = new ArrayList<>();

@ -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;

@ -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) {

@ -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);

@ -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<HardDriveContainerBlockEntity> 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;

@ -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;

@ -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;

@ -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) {

@ -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<DisplayElement> 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());
}

@ -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 {

@ -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);
}

@ -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) {

@ -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"
}

Before

Width:  |  Height:  |  Size: 414 B

After

Width:  |  Height:  |  Size: 414 B

@ -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": {