From 38aab205c382d6b6c2490ed6d2a20880db518d32 Mon Sep 17 00:00:00 2001 From: Raoul Date: Thu, 4 Apr 2024 18:50:18 +0200 Subject: [PATCH 01/26] chore: update translation Chinese Simplified from crowdin --- .../assets/refinedstorage2/lang/zh_cn.json | 296 ++++++++++-------- 1 file changed, 169 insertions(+), 127 deletions(-) diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/zh_cn.json b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/zh_cn.json index 8bb3939ce..1933d6e11 100644 --- a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/zh_cn.json +++ b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/zh_cn.json @@ -1,9 +1,9 @@ { - "itemGroup.refinedstorage2.general": "精致存储 2", + "mod.refinedstorage2": "Refined Storage 2", "block.refinedstorage2.cable": "线缆", - "block.refinedstorage2.quartz_enriched_iron_block": "含石英铁", + "block.refinedstorage2.quartz_enriched_iron_block": "富石英铁块", "block.refinedstorage2.disk_drive": "磁盘驱动器", - "block.refinedstorage2.machine_casing": "机壳", + "block.refinedstorage2.machine_casing": "机器外壳", "block.refinedstorage2.grid": "终端", "block.refinedstorage2.crafting_grid": "合成终端", "block.refinedstorage2.controller": "控制器", @@ -30,15 +30,17 @@ "block.refinedstorage2.storage_monitor": "存储监控器", "block.refinedstorage2.network_receiver": "网络接收器", "block.refinedstorage2.network_transmitter": "网络变送器", - "block.refinedstorage2.portable_grid": "Portable Grid", - "block.refinedstorage2.creative_portable_grid": "Creative Portable Grid", - "gui.refinedstorage2.controller.redstone_mode_help": "当此设备处于非活动状态时,存储网络将无法将此设备用作能源来源。", + "block.refinedstorage2.portable_grid": "便携式终端", + "block.refinedstorage2.creative_portable_grid": "创造模式便携式终端", + "block.refinedstorage2.security_manager": "Security Manager", + "block.refinedstorage2.security_manager.help": "When this device is active, will protect the network by default and block all operations. Start adding Security Cards to permit or deny specific operations for a player.", + "gui.refinedstorage2.controller.redstone_mode_help": "当此设备处于非激活状态时,存储网络将无法将此设备用作能源来源。", "gui.refinedstorage2.disk_drive.disks": "磁盘", - "gui.refinedstorage2.storage.redstone_mode_help": "当此设备处于非活动状态时,存储在其中的存储空间将无法从存储网络内访问。", - "gui.refinedstorage2.storage.filter_help": "这些资源可能会或可能不会被允许存储,具体取决于设备是否处于允许列表或阻止列表模式。", + "gui.refinedstorage2.storage.redstone_mode_help": "当此设备处于非激活状态时,其中的存储空间将无法从存储网络内访问。", + "gui.refinedstorage2.storage.filter_help": "这些资源可能会或可能不会被允许存储,具体取决于设备是否处于白名单或黑名单模式。", "gui.refinedstorage2.storage.filter_mode.empty_warning": "在没有配置任何过滤器的情况下,此存储将不接受任何资源。", - "gui.refinedstorage2.storage.filter_mode.allow.help": "只允许经过过滤器配置的资源进入此存储。", - "gui.refinedstorage2.storage.filter_mode.block.help": "禁止经过过滤器配置的资源进入此存储。", + "gui.refinedstorage2.storage.filter_mode.allow.help": "只允许过滤器配置中的资源进入此存储。", + "gui.refinedstorage2.storage.filter_mode.block.help": "禁止过滤器配置中的资源进入此存储。", "gui.refinedstorage2.grid.sorting.direction": "排序方式", "gui.refinedstorage2.grid.sorting.direction.ascending": "升序", "gui.refinedstorage2.grid.sorting.direction.descending": "降序", @@ -47,12 +49,6 @@ "gui.refinedstorage2.grid.sorting.type.name": "名字", "gui.refinedstorage2.grid.sorting.type.id": "ID", "gui.refinedstorage2.grid.sorting.type.last_modified": "最后修改时间", - "gui.refinedstorage2.grid.size": "大小", - "gui.refinedstorage2.grid.size.stretch": "自适应", - "gui.refinedstorage2.grid.size.small": "小", - "gui.refinedstorage2.grid.size.medium": "中", - "gui.refinedstorage2.grid.size.large": "大", - "gui.refinedstorage2.grid.size.extra_large": "特大", "gui.refinedstorage2.grid.auto_selected": "自动选取", "gui.refinedstorage2.grid.auto_selected.help": "在打开终端时是否自动选择搜索框。", "gui.refinedstorage2.grid.synchronizer": "同步模式", @@ -65,42 +61,48 @@ "gui.refinedstorage2.grid.synchronizer.rei": "REI", "gui.refinedstorage2.grid.synchronizer.rei.help": "将搜索框文本同步到 REI 过滤器。", "gui.refinedstorage2.grid.synchronizer.rei.two_way": "REI 双向", - "gui.refinedstorage2.grid.synchronizer.rei.two_way.help": "将搜索框文本同步到 JEI 过滤器,并将 JEI 过滤器同步到搜索框文本。", + "gui.refinedstorage2.grid.synchronizer.rei.two_way.help": "Sync the search box text to the REI filter, and the REI filter to the search box text.", "gui.refinedstorage2.grid.resource_type": "存储通道", "gui.refinedstorage2.grid.resource_type.all": "全部", "gui.refinedstorage2.grid.resource_type.help": "从特定的存储通道中过滤资源。", "gui.refinedstorage2.crafting_grid.move.network": "将物品移动到网络。", "gui.refinedstorage2.crafting_grid.move.inventory": "将物品移动到物品栏。", + "gui.refinedstorage2.screen_size": "Screen size", + "gui.refinedstorage2.screen_size.stretch": "Stretch", + "gui.refinedstorage2.screen_size.small": "Small", + "gui.refinedstorage2.screen_size.medium": "Medium", + "gui.refinedstorage2.screen_size.large": "Large", + "gui.refinedstorage2.screen_size.extra_large": "Extra large", "gui.refinedstorage2.detector.mode": "模式", "gui.refinedstorage2.detector.mode.under": "物品数量小于输入数量时输出信号。", "gui.refinedstorage2.detector.mode.equal": "物品数量等于输入数量时输出信号。", "gui.refinedstorage2.detector.mode.above": "物品数量大于于输入数量时输出信号。", "gui.refinedstorage2.detector.filter_help": "应该在存储网络中检测的资源。", "gui.refinedstorage2.destructor.pickup_items": "拾取物品而不是破坏。", - "gui.refinedstorage2.destructor.filter_help": "这些方块可能会或可能不会被破坏,具体取决于设备是否处于允许列表或阻止列表模式。", - "gui.refinedstorage2.destructor.filter_mode.allow.help": "只允许经过过滤器配置的方块进入存储网络。", - "gui.refinedstorage2.destructor.filter_mode.block.help": "禁止经过过滤器配置的方块进入存储网络。", - "gui.refinedstorage2.constructor.drop_items": "放置方块而不是掉落物品。", + "gui.refinedstorage2.destructor.filter_help": "这些方块被破坏与否,具体取决于设备是否处于白名单或黑名单模式。", + "gui.refinedstorage2.destructor.filter_mode.allow.help": "只允许过滤器配置中的方块进入存储网络。", + "gui.refinedstorage2.destructor.filter_mode.block.help": "禁止过滤器配置中的方块进入存储网络。", + "gui.refinedstorage2.constructor.drop_items": "丢出物品而不是放置方块", "gui.refinedstorage2.constructor.filter_help": "应该从存储网络中放置的资源。", "gui.refinedstorage2.interface.filter_help": "应该从存储网络导出的资源。", "gui.refinedstorage2.exporter.filter_help": "应该从存储网络导出的资源。", "gui.refinedstorage2.importer.filter_help": "可能从目标物品栏导入的资源。", - "gui.refinedstorage2.importer.filter_mode.allow.help": "只允许经过过滤器配置的资源进入存储网络。", - "gui.refinedstorage2.importer.filter_mode.block.help": "禁止经过过滤器配置的资源进入存储网络。", + "gui.refinedstorage2.importer.filter_mode.allow.help": "只允许过滤器配置中的资源进入存储网络。", + "gui.refinedstorage2.importer.filter_mode.block.help": "禁止过滤器配置中的资源进入存储网络。", "gui.refinedstorage2.wireless_transmitter.distance": "%d 方块", "gui.refinedstorage2.storage_monitor.filter_help": "要显示的资源。", "gui.refinedstorage2.redstone_mode": "红石模式", "gui.refinedstorage2.redstone_mode.ignore": "忽略红石信号", - "gui.refinedstorage2.redstone_mode.ignore.help": "此设备将始终处于活动状态,不受红石信号影响。", + "gui.refinedstorage2.redstone_mode.ignore.help": "此设备将始终处于激活状态,不受红石信号影响。", "gui.refinedstorage2.redstone_mode.high": "有红石信号时工作", - "gui.refinedstorage2.redstone_mode.high.help": "此设备仅在有红石信号时才会处于活动状态。", + "gui.refinedstorage2.redstone_mode.high.help": "此设备仅在有红石信号时才会处于激活状态。", "gui.refinedstorage2.redstone_mode.low": "无红石信号时工作", - "gui.refinedstorage2.redstone_mode.low.help": "此设备仅在没有红石信号时才会处于活动状态。", + "gui.refinedstorage2.redstone_mode.low.help": "此设备仅在没有红石信号时才会处于激活状态。", "gui.refinedstorage2.scheduling_mode": "调度模式", "gui.refinedstorage2.scheduling_mode.default": "默认", "gui.refinedstorage2.scheduling_mode.default.help": "使用第一个可用的过滤器。", - "gui.refinedstorage2.scheduling_mode.round_robin": "循环", - "gui.refinedstorage2.scheduling_mode.round_robin.help": "依次使用每个过滤器。", + "gui.refinedstorage2.scheduling_mode.round_robin": "轮询", + "gui.refinedstorage2.scheduling_mode.round_robin.help": "轮询使用每个过滤器。", "gui.refinedstorage2.scheduling_mode.random": "随机", "gui.refinedstorage2.scheduling_mode.random.help": "使用随机过滤器。", "gui.refinedstorage2.priority": "优先级", @@ -129,9 +131,9 @@ "gui.refinedstorage2.access_mode.insert.help": "存储网络只能插入此存储。包含的资源仍然可在终端中看到。", "gui.refinedstorage2.access_mode.extract": "仅提取", "gui.refinedstorage2.access_mode.extract.help": "存储网络只能从此存储中提取。", - "gui.refinedstorage2.void_excess": "Void excess resources", - "gui.refinedstorage2.void_excess.help": "When void excess mode is turned on and the storage is full, it will keep accepting resources but void them.", - "gui.refinedstorage2.void_excess.allowlist_warning": "Void excess will only work when the storage is in allowlist mode.", + "gui.refinedstorage2.void_excess": "销毁过量资源", + "gui.refinedstorage2.void_excess.help": "当销毁过量模式被打开且存储已满时,将继续接受资源并将其直接销毁。", + "gui.refinedstorage2.void_excess.allowlist_warning": "销毁过量仅在白名单模式下才会生效", "gui.refinedstorage2.upgrade_slot": "空升级槽", "gui.refinedstorage2.filter_slot.empty_filter": "空过滤器", "gui.refinedstorage2.filter_slot.left_click_for": "左键点击", @@ -142,26 +144,31 @@ "gui.refinedstorage2.network_transmitter.status.missing_network_card": "缺少网络卡", "gui.refinedstorage2.network_transmitter.status.transmitting": "传输中:%d个方块", "gui.refinedstorage2.network_transmitter.status.receiver_unreachable": "无法访问", - "item.refinedstorage2.controller.help": "为存储网络提供能量。一个存储网络中允许多个。", + "gui.refinedstorage2.security_card.permission.reset": "Reset", + "gui.refinedstorage2.security_card.permission.modified": "Modified", + "gui.refinedstorage2.security_manager.redstone_mode_help": "When this device is inactive, the network will not be protected.", + "gui.refinedstorage2.security_manager.fallback_security_card_slot_hint": "Slot for a Fallback Security Card.", + "gui.refinedstorage2.security_manager.no_fallback_security_card_consequence": "Add a Fallback Security Card to this slot to set permissions for every player without a Security Card. By default, all actions are denied.", + "item.refinedstorage2.controller.help": "为存储网络提供能量。一个存储网络中允许包含多个。", "item.refinedstorage2.creative_controller.help": "为存储网络提供无限能源。", "item.refinedstorage2.disk_drive.help": "接受存储磁盘,为存储网络提供存储空间。", "item.refinedstorage2.grid.help": "允许与存储网络交互。", - "item.refinedstorage2.crafting_grid.help": "允许与存储网络交互,并具有制作能力。", + "item.refinedstorage2.crafting_grid.help": "允许与存储网络交互,并具有合成能力。", "item.refinedstorage2.importer.help": "从外部源导入资源到存储网络。", "item.refinedstorage2.exporter.help": "从存储网络将资源导出到外部目标。", - "item.refinedstorage2.interface.help": "充当导入器和导出器的组合。", + "item.refinedstorage2.interface.help": "充当输入总线和输出总线的结合。", "item.refinedstorage2.external_storage.help": "为存储网络提供来自外部源的存储。", "item.refinedstorage2.detector.help": "如果存储网络包含等于、大于或小于给定数量的资源,则发出红石信号。", "item.refinedstorage2.constructor.help": "从存储网络中放置方块到世界中。", "item.refinedstorage2.destructor.help": "从世界中销毁方块并将其放入存储网络。", - "item.refinedstorage2.quartz_enriched_iron": "浸石英铁", + "item.refinedstorage2.quartz_enriched_iron": "富石英铁", "item.refinedstorage2.processor_binding": "处理器绑定", "item.refinedstorage2.silicon": "硅", "item.refinedstorage2.raw_basic_processor": "原始基础处理器", - "item.refinedstorage2.raw_improved_processor": "原始改进处理器", + "item.refinedstorage2.raw_improved_processor": "原始进阶处理器", "item.refinedstorage2.raw_advanced_processor": "原始高级处理器", "item.refinedstorage2.basic_processor": "基础处理器", - "item.refinedstorage2.improved_processor": "改进处理器", + "item.refinedstorage2.improved_processor": "进阶处理器", "item.refinedstorage2.advanced_processor": "高级处理器", "item.refinedstorage2.1k_storage_part": "1K 存储元件", "item.refinedstorage2.4k_storage_part": "4K 存储元件", @@ -181,12 +188,12 @@ "item.refinedstorage2.1024b_fluid_storage_disk": "1024B 流体存储磁盘", "item.refinedstorage2.4096b_fluid_storage_disk": "4096B 流体存储磁盘", "item.refinedstorage2.creative_fluid_storage_disk": "创造流体存储磁盘", - "item.refinedstorage2.storage_housing": "存储模块", - "item.refinedstorage2.construction_core": "建造核心", - "item.refinedstorage2.destruction_core": "摧毁核心", + "item.refinedstorage2.storage_housing": "磁盘外壳", + "item.refinedstorage2.construction_core": "成型核心", + "item.refinedstorage2.destruction_core": "破坏核心", "item.refinedstorage2.wrench": "扳手", - "item.refinedstorage2.wrench.helper": "用于旋转方块,或按住SHIFT并使用以拆解精炼存储方块。", - "item.refinedstorage2.upgrade": "升级", + "item.refinedstorage2.wrench.helper": "用于旋转方块,或按住SHIFT并使用以拆解精致存储方块。", + "item.refinedstorage2.upgrade": "空白升级", "item.refinedstorage2.speed_upgrade": "速度升级", "item.refinedstorage2.stack_upgrade": "堆叠升级", "item.refinedstorage2.silk_touch_upgrade": "精准采集升级", @@ -194,14 +201,14 @@ "item.refinedstorage2.fortune_upgrade.2": "时运 II 升级", "item.refinedstorage2.fortune_upgrade.3": "时运 III 升级", "item.refinedstorage2.regulator_upgrade": "调节器升级", - "item.refinedstorage2.regulator_upgrade.help": "在导出器中,仅在目标中的数量少于升级中配置的数量时导出。在导入器中,仅在目标中的数量大于升级中配置的数量时导入。使用物品进行配置。", + "item.refinedstorage2.regulator_upgrade.help": "在输出总线中,仅在目标中的数量少于升级中配置的数量时导出。在输入总线中,仅在目标中的数量大于升级中配置的数量时导入。使用物品进行配置。", "item.refinedstorage2.range_upgrade": "范围升级", "item.refinedstorage2.creative_range_upgrade": "创造范围升级", "item.refinedstorage2.wireless_grid": "无线终端", "item.refinedstorage2.creative_wireless_grid": "创造无线终端", - "item.refinedstorage2.wireless_transmitter.help": "为诸如无线终端之类的物品提供无线网络访问。一个区域内允许多个以扩大覆盖范围。", + "item.refinedstorage2.wireless_transmitter.help": "为诸如无线终端之类的物品提供无线网络访问。一个区域内允许放置多个以扩大覆盖范围。", "item.refinedstorage2.network_item.unbound": "未绑定。", - "item.refinedstorage2.network_item.unbound.help": "用于任何存储网络设备进行绑定。", + "item.refinedstorage2.network_item.unbound.help": "对任一存储网络设备使用以进行绑定。", "item.refinedstorage2.network_item.bound_to": "绑定到 %d, %d, %d。", "item.refinedstorage2.network_item.cannot_open_with_shortcut_due_to_duplicate": "你的库存中存在多个 %s,无法使用快捷方式打开。", "item.refinedstorage2.network_item.cannot_open_because_not_found": "你的库存中没有任何 %s。", @@ -212,13 +219,21 @@ "item.refinedstorage2.configuration_card.cleared_configuration": "已清除配置。", "item.refinedstorage2.configuration_card.cannot_apply_configuration": "无法将配置卡应用于不同类型的设备。它配置为 %s。", "item.refinedstorage2.configuration_card.applied_configuration": "已应用配置。", - "item.refinedstorage2.configuration_card.empty_help": "在蹲下的同时用于存储网络设备,以将其配置和升级复制到卡上。", + "item.refinedstorage2.configuration_card.empty_help": "在潜行状态下对存储网络设备使用,以将其配置和升级复制到卡上。", "item.refinedstorage2.configuration_card.configured_help": "在蹲下的同时用于目标存储网络设备,以传输配置和升级。蹲下时使用以清除。", "item.refinedstorage2.network_card": "网络卡", - "item.refinedstorage2.network_card.unbound_help": "在 Network Receiver 上蹲下使用。", + "item.refinedstorage2.network_card.unbound_help": "潜行状态下对网络接收器使用", "item.refinedstorage2.network_card.unbound": "未绑定。", - "item.refinedstorage2.network_card.bound_help": "插入到 Network Transmitter 中。在蹲下的同时使用以清除绑定。", + "item.refinedstorage2.network_card.bound_help": "插入到网络变送器中。在潜行状态下使用以清除绑定。", "item.refinedstorage2.network_card.bound": "绑定到 %d, %d, %d 在 %s 中。", + "item.refinedstorage2.security_card": "Security Card", + "item.refinedstorage2.security_card.cleared_configuration": "Cleared configuration.", + "item.refinedstorage2.security_card.unbound": "Unbound.", + "item.refinedstorage2.security_card.unbound.help": "Right click to configure and bind to the current player.", + "item.refinedstorage2.security_card.bound": "Bound to %s.", + "item.refinedstorage2.security_card.bound.help": "Right click to configure. Use while crouching to clear configuration and binding.", + "item.refinedstorage2.fallback_security_card": "Fallback Security Card", + "item.refinedstorage2.fallback_security_card.help": "Acts as a fallback if no matching Security Card for a player is found. Right click to configure. Use while crouching to clear configuration.", "misc.refinedstorage2.stored": "存储:%s", "misc.refinedstorage2.stored_with_capacity": "存储:%s / %s (%d%%)", "misc.refinedstorage2.total": "总数:%d", @@ -238,39 +253,58 @@ "misc.refinedstorage2.resource_type.item": "物品", "misc.refinedstorage2.resource_type.fluid": "流体", "misc.refinedstorage2.press_shift_for_help": "按下 SHIFT 获取帮助", + "misc.refinedstorage2.no_permission": "No permission", + "misc.refinedstorage2.no_permission.open": "You are not allowed to open the %s.", + "misc.refinedstorage2.no_permission.insert": "You are not allowed to insert.", + "misc.refinedstorage2.no_permission.extract": "You are not allowed to extract.", + "misc.refinedstorage2.no_permission.build.place": "You are not allowed to place a %s here.", + "misc.refinedstorage2.no_permission.build.break": "You are not allowed to break the %s.", + "misc.refinedstorage2.no_permission.build.rotate": "You are not allowed to rotate the %s.", + "misc.refinedstorage2.no_permission.build.dismantle": "You are not allowed to dismantle the %s.", "key.refinedstorage2.focus_search_bar": "聚焦搜索栏", - "key.refinedstorage2.clear_crafting_grid_matrix_to_network": "清除制作终端矩阵到网络", - "key.refinedstorage2.clear_crafting_grid_matrix_to_inventory": "清除制作终端矩阵到库存", + "key.refinedstorage2.clear_crafting_grid_matrix_to_network": "清除合成终端矩阵到网络", + "key.refinedstorage2.clear_crafting_grid_matrix_to_inventory": "清除合成终端矩阵到库存", "key.refinedstorage2.open_wireless_grid": "打开无线终端", "refinedstorage2.subtitle.wrench": "使用扳手", - "category.refinedstorage2.key_bindings": "精致存储 2", "curios.identifier.refinedstorage2": "精致存储 2", "trinkets.slot.refinedstorage2.wireless": "精致存储 2", + "permission.refinedstorage2.insert": "Insert", + "permission.refinedstorage2.insert.description": "Whether the player can insert resources in a network.", + "permission.refinedstorage2.extract": "Extract", + "permission.refinedstorage2.extract.description": "Whether the player can extract resources from a network.", + "permission.refinedstorage2.autocrafting": "Autocrafting", + "permission.refinedstorage2.autocrafting.description": "Whether the player can start, cancel or view an autocrafting task.", + "permission.refinedstorage2.open": "Open", + "permission.refinedstorage2.open.description": "Whether the player can open network device GUIs.", + "permission.refinedstorage2.build": "Build", + "permission.refinedstorage2.build.description": "Whether the player can add or remove network devices.", + "permission.refinedstorage2.security": "Security", + "permission.refinedstorage2.security.description": "Whether the player can manage the security options for a network.", "text.autoconfig.refinedstorage2.title": "精致存储 2", + "text.autoconfig.refinedstorage2.option.smoothScrolling": "Smooth scrolling", + "text.autoconfig.refinedstorage2.option.screenSize": "Screen size", + "text.autoconfig.refinedstorage2.option.maxRowsStretch": "Maximum amount of rows when screen size is stretched", "text.autoconfig.refinedstorage2.option.grid": "终端", "text.autoconfig.refinedstorage2.option.grid.largeFont": "大字体", - "text.autoconfig.refinedstorage2.option.grid.maxRowsStretch": "拉伸时的最大行数", "text.autoconfig.refinedstorage2.option.grid.preventSortingWhileShiftIsDown": "按住 SHIFT 时阻止排序", "text.autoconfig.refinedstorage2.option.grid.detailedTooltip": "详细提示", "text.autoconfig.refinedstorage2.option.grid.rememberSearchQuery": "记住搜索查询", - "text.autoconfig.refinedstorage2.option.grid.energyUsage": "能源", - "text.autoconfig.refinedstorage2.option.grid.smoothScrolling": "平滑滚动", + "text.autoconfig.refinedstorage2.option.grid.energyUsage": "耗能", "text.autoconfig.refinedstorage2.option.grid.autoSelected": "自动选择搜索框", "text.autoconfig.refinedstorage2.option.grid.synchronizer": "同步器", "text.autoconfig.refinedstorage2.option.grid.resourceTypeId": "存储通道类型", "text.autoconfig.refinedstorage2.option.grid.sortingDirection": "排序方向", "text.autoconfig.refinedstorage2.option.grid.sortingType": "排序类型", - "text.autoconfig.refinedstorage2.option.grid.size": "大小", - "text.autoconfig.refinedstorage2.option.craftingGrid": "制作终端", - "text.autoconfig.refinedstorage2.option.craftingGrid.energyUsage": "能源", - "text.autoconfig.refinedstorage2.option.craftingGrid.craftingMatrixCloseBehavior": "制作矩阵关闭行为", + "text.autoconfig.refinedstorage2.option.craftingGrid": "合成终端", + "text.autoconfig.refinedstorage2.option.craftingGrid.energyUsage": "耗能", + "text.autoconfig.refinedstorage2.option.craftingGrid.craftingMatrixCloseBehavior": "合成矩阵关闭行为", "text.autoconfig.refinedstorage2.option.controller": "控制器", - "text.autoconfig.refinedstorage2.option.controller.energyCapacity": "能源容量", + "text.autoconfig.refinedstorage2.option.controller.energyCapacity": "能量容量", "text.autoconfig.refinedstorage2.option.cable": "电缆", - "text.autoconfig.refinedstorage2.option.cable.energyUsage": "能源", + "text.autoconfig.refinedstorage2.option.cable.energyUsage": "耗能", "text.autoconfig.refinedstorage2.option.diskDrive": "磁盘驱动器", - "text.autoconfig.refinedstorage2.option.diskDrive.energyUsage": "能源", - "text.autoconfig.refinedstorage2.option.diskDrive.energyUsagePerDisk": "每个磁盘的能源", + "text.autoconfig.refinedstorage2.option.diskDrive.energyUsage": "耗能", + "text.autoconfig.refinedstorage2.option.diskDrive.energyUsagePerDisk": "每个磁盘的耗能", "text.autoconfig.refinedstorage2.option.storageBlock": "存储方块", "text.autoconfig.refinedstorage2.option.storageBlock.oneKEnergyUsage": "1K 能源", "text.autoconfig.refinedstorage2.option.storageBlock.fourKEnergyUsage": "4K 能源", @@ -283,85 +317,93 @@ "text.autoconfig.refinedstorage2.option.fluidStorageBlock.thousandTwentyFourBEnergyUsage": "1024B 能源", "text.autoconfig.refinedstorage2.option.fluidStorageBlock.fourThousandNinetySixBEnergyUsage": "4096B 能源", "text.autoconfig.refinedstorage2.option.fluidStorageBlock.creativeEnergyUsage": "创造能源", - "text.autoconfig.refinedstorage2.option.importer": "导入器", - "text.autoconfig.refinedstorage2.option.importer.energyUsage": "能源", - "text.autoconfig.refinedstorage2.option.exporter": "导出器", - "text.autoconfig.refinedstorage2.option.exporter.energyUsage": "能源", + "text.autoconfig.refinedstorage2.option.importer": "输入总线", + "text.autoconfig.refinedstorage2.option.importer.energyUsage": "耗能", + "text.autoconfig.refinedstorage2.option.exporter": "输出总线", + "text.autoconfig.refinedstorage2.option.exporter.energyUsage": "耗能", "text.autoconfig.refinedstorage2.option.detector": "检测器", - "text.autoconfig.refinedstorage2.option.detector.energyUsage": "能源", - "text.autoconfig.refinedstorage2.option.constructor": "构造器", - "text.autoconfig.refinedstorage2.option.constructor.energyUsage": "能源", - "text.autoconfig.refinedstorage2.option.destructor": "破坏器", - "text.autoconfig.refinedstorage2.option.destructor.energyUsage": "能源", + "text.autoconfig.refinedstorage2.option.detector.energyUsage": "耗能", + "text.autoconfig.refinedstorage2.option.constructor": "成型面板", + "text.autoconfig.refinedstorage2.option.constructor.energyUsage": "耗能", + "text.autoconfig.refinedstorage2.option.destructor": "破坏面板", + "text.autoconfig.refinedstorage2.option.destructor.energyUsage": "耗能", "text.autoconfig.refinedstorage2.option.upgrade": "升级", - "text.autoconfig.refinedstorage2.option.upgrade.speedUpgradeEnergyUsage": "速度升级能源", - "text.autoconfig.refinedstorage2.option.upgrade.stackUpgradeEnergyUsage": "堆叠升级能源", - "text.autoconfig.refinedstorage2.option.upgrade.fortune1UpgradeEnergyUsage": "时运 I 升级能源", - "text.autoconfig.refinedstorage2.option.upgrade.fortune2UpgradeEnergyUsage": "时运 II 升级能源", - "text.autoconfig.refinedstorage2.option.upgrade.fortune3UpgradeEnergyUsage": "时运 III 升级能源", - "text.autoconfig.refinedstorage2.option.upgrade.silkTouchUpgradeEnergyUsage": "精准采集升级能源", - "text.autoconfig.refinedstorage2.option.upgrade.regulatorUpgradeEnergyUsage": "调节器升级能源", - "text.autoconfig.refinedstorage2.option.upgrade.rangeUpgradeEnergyUsage": "范围升级能源", - "text.autoconfig.refinedstorage2.option.upgrade.creativeRangeUpgradeEnergyUsage": "创造范围升级能源", + "text.autoconfig.refinedstorage2.option.upgrade.speedUpgradeEnergyUsage": "速度升级耗能", + "text.autoconfig.refinedstorage2.option.upgrade.stackUpgradeEnergyUsage": "堆叠升级耗能", + "text.autoconfig.refinedstorage2.option.upgrade.fortune1UpgradeEnergyUsage": "时运 I 升级耗能", + "text.autoconfig.refinedstorage2.option.upgrade.fortune2UpgradeEnergyUsage": "时运 II 升级耗能", + "text.autoconfig.refinedstorage2.option.upgrade.fortune3UpgradeEnergyUsage": "时运 III 升级耗能", + "text.autoconfig.refinedstorage2.option.upgrade.silkTouchUpgradeEnergyUsage": "精准采集升级耗能", + "text.autoconfig.refinedstorage2.option.upgrade.regulatorUpgradeEnergyUsage": "调节器升级耗能", + "text.autoconfig.refinedstorage2.option.upgrade.rangeUpgradeEnergyUsage": "范围升级耗能", + "text.autoconfig.refinedstorage2.option.upgrade.creativeRangeUpgradeEnergyUsage": "创造范围升级耗能", "text.autoconfig.refinedstorage2.option.upgrade.rangeUpgradeRange": "范围升级范围", - "text.autoconfig.refinedstorage2.option.iface": "接口", - "text.autoconfig.refinedstorage2.option.iface.energyUsage": "能源", + "text.autoconfig.refinedstorage2.option.iface": "物品传输接口", + "text.autoconfig.refinedstorage2.option.iface.energyUsage": "耗能", "text.autoconfig.refinedstorage2.option.externalStorage": "外部存储", - "text.autoconfig.refinedstorage2.option.externalStorage.energyUsage": "能源", + "text.autoconfig.refinedstorage2.option.externalStorage.energyUsage": "耗能", "text.autoconfig.refinedstorage2.option.wirelessGrid": "无线网格", - "text.autoconfig.refinedstorage2.option.wirelessGrid.energyCapacity": "能源容量", - "text.autoconfig.refinedstorage2.option.wirelessGrid.openEnergyUsage": "打开能源", - "text.autoconfig.refinedstorage2.option.wirelessGrid.insertEnergyUsage": "插入能源", - "text.autoconfig.refinedstorage2.option.wirelessGrid.extractEnergyUsage": "提取能源", - "text.autoconfig.refinedstorage2.option.wirelessTransmitter": "无线发射器", - "text.autoconfig.refinedstorage2.option.wirelessTransmitter.energyUsage": "能源", + "text.autoconfig.refinedstorage2.option.wirelessGrid.energyCapacity": "能量容量", + "text.autoconfig.refinedstorage2.option.wirelessGrid.openEnergyUsage": "打开耗能", + "text.autoconfig.refinedstorage2.option.wirelessGrid.insertEnergyUsage": "插入耗能", + "text.autoconfig.refinedstorage2.option.wirelessGrid.extractEnergyUsage": "取出耗能", + "text.autoconfig.refinedstorage2.option.wirelessTransmitter": "无线访问点", + "text.autoconfig.refinedstorage2.option.wirelessTransmitter.energyUsage": "耗能", "text.autoconfig.refinedstorage2.option.wirelessTransmitter.baseRange": "基础范围", - "text.autoconfig.refinedstorage2.option.storageMonitor": "存储监视器", - "text.autoconfig.refinedstorage2.option.storageMonitor.energyUsage": "能源", + "text.autoconfig.refinedstorage2.option.storageMonitor": "存储监控器", + "text.autoconfig.refinedstorage2.option.storageMonitor.energyUsage": "耗能", "text.autoconfig.refinedstorage2.option.networkReceiver": "网络接收器", - "text.autoconfig.refinedstorage2.option.networkReceiver.energyUsage": "能源", - "text.autoconfig.refinedstorage2.option.networkTransmitter": "Network Transmitter", - "text.autoconfig.refinedstorage2.option.networkTransmitter.energyUsage": "Energy usage", - "text.autoconfig.refinedstorage2.option.portableGrid": "Portable Grid", - "text.autoconfig.refinedstorage2.option.portableGrid.energyCapacity": "Energy capacity", - "text.autoconfig.refinedstorage2.option.portableGrid.openEnergyUsage": "Open energy usage", - "text.autoconfig.refinedstorage2.option.portableGrid.insertEnergyUsage": "Insert energy usage", - "text.autoconfig.refinedstorage2.option.portableGrid.extractEnergyUsage": "Extract energy usage", - "advancements.refinedstorage2.root.description": "在网络中使用一个或多个控制器为您的网络提供能源", - "advancements.refinedstorage2.connecting": "连接中", - "advancements.refinedstorage2.connecting.description": "使用电缆将设备连接在一起,或将设备放置在一起", + "text.autoconfig.refinedstorage2.option.networkReceiver.energyUsage": "耗能", + "text.autoconfig.refinedstorage2.option.networkTransmitter": "网络发送器", + "text.autoconfig.refinedstorage2.option.networkTransmitter.energyUsage": "耗能", + "text.autoconfig.refinedstorage2.option.portableGrid": "便携式终端", + "text.autoconfig.refinedstorage2.option.portableGrid.energyCapacity": "能量容量", + "text.autoconfig.refinedstorage2.option.portableGrid.openEnergyUsage": "打开耗能", + "text.autoconfig.refinedstorage2.option.portableGrid.insertEnergyUsage": "插入耗能", + "text.autoconfig.refinedstorage2.option.portableGrid.extractEnergyUsage": "取出耗能", + "text.autoconfig.refinedstorage2.option.securityCard": "Security Card", + "text.autoconfig.refinedstorage2.option.securityCard.energyUsage": "Energy usage", + "text.autoconfig.refinedstorage2.option.fallbackSecurityCard": "Fallback Security Card", + "text.autoconfig.refinedstorage2.option.fallbackSecurityCard.energyUsage": "Energy usage", + "text.autoconfig.refinedstorage2.option.securityManager": "Security Manager", + "text.autoconfig.refinedstorage2.option.securityManager.energyUsage": "Energy usage", + "advancements.refinedstorage2.root.description": "Use one or multiple Controllers in a storage network to provide your network with energy", + "advancements.refinedstorage2.connecting": "连接", + "advancements.refinedstorage2.connecting.description": "使用电缆将设备连接在一起,或放置时使设备贴在一起", "advancements.refinedstorage2.drives": "驱动器", - "advancements.refinedstorage2.drives.description": "制作一个磁盘驱动器,以便能够存储您的存储磁盘", + "advancements.refinedstorage2.drives.description": "合成一个磁盘驱动器,以便能够收纳您的存储磁盘", "advancements.refinedstorage2.storing_items": "存储物品", - "advancements.refinedstorage2.storing_items.description": "制作一个存储磁盘并将其放入磁盘驱动器中", + "advancements.refinedstorage2.storing_items.description": "合成一个存储磁盘并将其放入磁盘驱动器中", "advancements.refinedstorage2.viewing_your_storage": "查看您的存储", - "advancements.refinedstorage2.viewing_your_storage.description": "制作一个网格以与您的存储互动", - "advancements.refinedstorage2.upgrading_your_grid": "升级您的网格", - "advancements.refinedstorage2.upgrading_your_grid.description": "将您的网格升级为制作网格以获得制作能力", + "advancements.refinedstorage2.viewing_your_storage.description": "合成一个终端以与您的存储互动", + "advancements.refinedstorage2.upgrading_your_grid": "升级您的终端", + "advancements.refinedstorage2.upgrading_your_grid.description": "将您的终端升级为合成终端以获得制作能力", "advancements.refinedstorage2.storing_fluids": "存储流体", - "advancements.refinedstorage2.storing_fluids.description": "制作流体存储磁盘并将其放入磁盘驱动器中", - "advancements.refinedstorage2.importing": "导入中", - "advancements.refinedstorage2.importing.description": "使用导入器将资源带入存储网络", - "advancements.refinedstorage2.exporting": "导出中", - "advancements.refinedstorage2.exporting.description": "使用导出器将资源从存储网络中取出", - "advancements.refinedstorage2.upgrading": "升级中", - "advancements.refinedstorage2.upgrading.description": "制作升级以改进各种设备", - "advancements.refinedstorage2.interface_to_the_world": "与世界的接口", - "advancements.refinedstorage2.interface_to_the_world.description": "使用接口同时导出和导入物品", + "advancements.refinedstorage2.storing_fluids.description": "合成流体存储磁盘并将其放入磁盘驱动器中", + "advancements.refinedstorage2.importing": "输入", + "advancements.refinedstorage2.importing.description": "使用输入总线将资源带入存储网络", + "advancements.refinedstorage2.exporting": "输出", + "advancements.refinedstorage2.exporting.description": "使用输出总线将资源从存储网络中取出", + "advancements.refinedstorage2.upgrading": "升级", + "advancements.refinedstorage2.upgrading.description": "合成一个升级以改善各种设备", + "advancements.refinedstorage2.interface_to_the_world": "通往世界的接口", + "advancements.refinedstorage2.interface_to_the_world.description": "使用物品传输接口同时导出和导入物品", "advancements.refinedstorage2.storing_externally": "外部存储", - "advancements.refinedstorage2.storing_externally.description": "使用外部存储从外部方块(如箱子)提供网络存储", - "advancements.refinedstorage2.detecting": "检测中", - "advancements.refinedstorage2.detecting.description": "使用红石检查存储网络中存储的资源", - "advancements.refinedstorage2.construction": "建设中", + "advancements.refinedstorage2.storing_externally.description": "使用外部存储总线从外部方块(如箱子)提供网络存储", + "advancements.refinedstorage2.detecting": "检测", + "advancements.refinedstorage2.detecting.description": "Use redstone to check resources stored in the storage network", + "advancements.refinedstorage2.construction": "成型", "advancements.refinedstorage2.construction.description": "使用构造器将方块从存储网络中放入世界", - "advancements.refinedstorage2.destruction": "破坏中", + "advancements.refinedstorage2.destruction": "破坏", "advancements.refinedstorage2.destruction.description": "使用破坏器将世界中的方块放入存储网络", - "advancements.refinedstorage2.wireless": "无线中", - "advancements.refinedstorage2.wireless.description": "使用无线网格无线访问您的资源。", + "advancements.refinedstorage2.wireless": "无线", + "advancements.refinedstorage2.wireless.description": "Access your resources wirelessly with a Wireless Grid", "advancements.refinedstorage2.better_than_a_barrel": "比桶更好", - "advancements.refinedstorage2.better_than_a_barrel.description": "制作存储监视器以查看、插入或提取存储网络中的资源", + "advancements.refinedstorage2.better_than_a_barrel.description": "合成存储监视器以查看、插入或提取存储网络中的资源", "advancements.refinedstorage2.no_cables_required": "无需电缆", - "advancements.refinedstorage2.no_cables_required.description": "通过使用网络发射器、网络接收器和网络卡,添加额外组件到您的网络而无需使用电缆", - "advancements.refinedstorage2.portable_storage": "Portable storage", - "advancements.refinedstorage2.portable_storage.description": "Craft a Portable Grid to access the content of disks without requiring a storage network" + "advancements.refinedstorage2.no_cables_required.description": "Add extra components to your storage network without using cables by using a Network Transmitter, Network Receiver and Network Card", + "advancements.refinedstorage2.portable_storage": "便携式存储", + "advancements.refinedstorage2.portable_storage.description": "合成一个便携式终端,在不需要连接到存储网络的情况下也可以访问磁盘内容。", + "advancements.refinedstorage2.security": "Security", + "advancements.refinedstorage2.security.description": "Secure your storage network with a Security Manager and a Security Card" } From e9b9081c1ff9d20db47fbd299be40981d2cbc2ec Mon Sep 17 00:00:00 2001 From: Raoul Date: Thu, 4 Apr 2024 18:50:19 +0200 Subject: [PATCH 02/26] chore: update translation French from crowdin --- .../assets/refinedstorage2/lang/fr_fr.json | 274 ++++++++++-------- 1 file changed, 158 insertions(+), 116 deletions(-) diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/fr_fr.json b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/fr_fr.json index 9d221632a..88b7f8735 100644 --- a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/fr_fr.json +++ b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/fr_fr.json @@ -1,5 +1,5 @@ { - "itemGroup.refinedstorage2.general": "Refined Storage 2", + "mod.refinedstorage2": "Refined Storage 2", "block.refinedstorage2.cable": "Câble", "block.refinedstorage2.quartz_enriched_iron_block": "Bloc de Fer Enrichi en Quartz", "block.refinedstorage2.disk_drive": "Lecteur de Disque", @@ -32,92 +32,94 @@ "block.refinedstorage2.network_transmitter": "Transmetteur Réseau", "block.refinedstorage2.portable_grid": "Grille portable", "block.refinedstorage2.creative_portable_grid": "Grille portable créative", + "block.refinedstorage2.security_manager": "Poste de sécurité", + "block.refinedstorage2.security_manager.help": "Lorsque cet appareil est actif, il protège le réseau par défaut et bloque toutes les opérations. Commencez à ajouter des Cartes de Sécurité pour permettre ou refuser des opérations spécifiques pour un joueur.", "gui.refinedstorage2.controller.redstone_mode_help": "Lorsque cet appareil est inactif, le réseau de stockage ne pourra pas utiliser cet appareil comme source d'énergie.", "gui.refinedstorage2.disk_drive.disks": "Disques", "gui.refinedstorage2.storage.redstone_mode_help": "Lorsque cet appareil est inactif, le stockage contenu ne sera plus accessible depuis le réseau de stockage.", - "gui.refinedstorage2.storage.filter_help": "The resources that may or may not be allowed in this storage, depending if the device is in allowlist or blocklist mode.", - "gui.refinedstorage2.storage.filter_mode.empty_warning": "Without any configured filters, no resources will be accepted in this storage.", - "gui.refinedstorage2.storage.filter_mode.allow.help": "Only allow resources into this storage that are configured in the filters.", - "gui.refinedstorage2.storage.filter_mode.block.help": "Disallow resources into this storage that are configured in the filters.", - "gui.refinedstorage2.grid.sorting.direction": "Sorting direction", + "gui.refinedstorage2.storage.filter_help": "Les ressources qui sont autorisées ou non dans ce stockage, en fonction du mode de filtrage de l'appareil.", + "gui.refinedstorage2.storage.filter_mode.empty_warning": "Sans filtre configuré, aucune ressource ne sera accepté dans ce stockage.", + "gui.refinedstorage2.storage.filter_mode.allow.help": "Autorise dans ce stockage uniquement les ressources configurées dans les filtres.", + "gui.refinedstorage2.storage.filter_mode.block.help": "Interdis dans ce stockage les ressources configurées dans les filtres.", + "gui.refinedstorage2.grid.sorting.direction": "Direction du tri", "gui.refinedstorage2.grid.sorting.direction.ascending": "Ascendant", "gui.refinedstorage2.grid.sorting.direction.descending": "Descendant", "gui.refinedstorage2.grid.sorting.type": "Type de tri", "gui.refinedstorage2.grid.sorting.type.quantity": "Quantité", "gui.refinedstorage2.grid.sorting.type.name": "Nom", - "gui.refinedstorage2.grid.sorting.type.id": "ID", - "gui.refinedstorage2.grid.sorting.type.last_modified": "Last modified", - "gui.refinedstorage2.grid.size": "Taille", - "gui.refinedstorage2.grid.size.stretch": "Étirée", - "gui.refinedstorage2.grid.size.small": "Petite", - "gui.refinedstorage2.grid.size.medium": "Moyenne", - "gui.refinedstorage2.grid.size.large": "Grande", - "gui.refinedstorage2.grid.size.extra_large": "Très grande", - "gui.refinedstorage2.grid.auto_selected": "Auto-selected", - "gui.refinedstorage2.grid.auto_selected.help": "Whether to auto-select the search box when opening the Grid.", - "gui.refinedstorage2.grid.synchronizer": "Synchronization mode", - "gui.refinedstorage2.grid.synchronizer.off": "Off", - "gui.refinedstorage2.grid.synchronizer.off.help": "Don't sync the search box text.", + "gui.refinedstorage2.grid.sorting.type.id": "Identifiant", + "gui.refinedstorage2.grid.sorting.type.last_modified": "Dernière modification", + "gui.refinedstorage2.grid.auto_selected": "Sélection automatique", + "gui.refinedstorage2.grid.auto_selected.help": "Si la barre de recherche doit être sélectionnée automatique à l'ouverture de la grille.", + "gui.refinedstorage2.grid.synchronizer": "Mode de synchronisation", + "gui.refinedstorage2.grid.synchronizer.off": "Éteint", + "gui.refinedstorage2.grid.synchronizer.off.help": "Ne pas synchroniser la recherche.", "gui.refinedstorage2.grid.synchronizer.jei": "JEI", - "gui.refinedstorage2.grid.synchronizer.jei.help": "Sync the search box text to the JEI filter.", - "gui.refinedstorage2.grid.synchronizer.jei.two_way": "JEI two-way", - "gui.refinedstorage2.grid.synchronizer.jei.two_way.help": "Sync the search box text to the JEI filter, and the JEI filter to the search box text.", + "gui.refinedstorage2.grid.synchronizer.jei.help": "Synchroniser la recherche avec le filtre de JEI.", + "gui.refinedstorage2.grid.synchronizer.jei.two_way": "JEI bidirectionnel", + "gui.refinedstorage2.grid.synchronizer.jei.two_way.help": "Synchroniser la recherche avec le filtre de JEI et le filtre de JEI avec la recherche.", "gui.refinedstorage2.grid.synchronizer.rei": "REI", - "gui.refinedstorage2.grid.synchronizer.rei.help": "Sync the search box text to the REI filter.", - "gui.refinedstorage2.grid.synchronizer.rei.two_way": "REI two-way", - "gui.refinedstorage2.grid.synchronizer.rei.two_way.help": "Sync the search box text to the JEI filter, and the JEI filter to the search box text.", + "gui.refinedstorage2.grid.synchronizer.rei.help": "Synchroniser la recherche avec le filtre de REI.", + "gui.refinedstorage2.grid.synchronizer.rei.two_way": "REI bidirectionnel", + "gui.refinedstorage2.grid.synchronizer.rei.two_way.help": "Sync the search box text to the REI filter, and the REI filter to the search box text.", "gui.refinedstorage2.grid.resource_type": "Type de ressource", "gui.refinedstorage2.grid.resource_type.all": "Toutes", "gui.refinedstorage2.grid.resource_type.help": "Filter specific resource types.", - "gui.refinedstorage2.crafting_grid.move.network": "Move items to network", - "gui.refinedstorage2.crafting_grid.move.inventory": "Move items to inventory", + "gui.refinedstorage2.crafting_grid.move.network": "Déplacer les objets dans le réseau", + "gui.refinedstorage2.crafting_grid.move.inventory": "Déplacer les objets dans l'inventaire", + "gui.refinedstorage2.screen_size": "Taille de l'écran", + "gui.refinedstorage2.screen_size.stretch": "Etiré", + "gui.refinedstorage2.screen_size.small": "Petit", + "gui.refinedstorage2.screen_size.medium": "Moyen", + "gui.refinedstorage2.screen_size.large": "Grand", + "gui.refinedstorage2.screen_size.extra_large": "Très grand", "gui.refinedstorage2.detector.mode": "Mode", - "gui.refinedstorage2.detector.mode.under": "Emit redstone signal when under the amount", - "gui.refinedstorage2.detector.mode.equal": "Emit redstone signal when on the amount", - "gui.refinedstorage2.detector.mode.above": "Emit redstone signal when above the amount", - "gui.refinedstorage2.detector.filter_help": "The resource that should be detected in the storage network.", - "gui.refinedstorage2.destructor.pickup_items": "Pickup items instead of breaking", + "gui.refinedstorage2.detector.mode.under": "Émet un signal de redstone si la valeur est inférieure au seuil.", + "gui.refinedstorage2.detector.mode.equal": "Émet un signal de redstone si la valeur est égale au seuil.", + "gui.refinedstorage2.detector.mode.above": "Émet un signal de redstone si la valeur est supérieure au seuil.", + "gui.refinedstorage2.detector.filter_help": "La ressource qui doit être détectée dans le réseau de stockage.", + "gui.refinedstorage2.destructor.pickup_items": "Ramasser des objets au lieu de casser des blocs.", "gui.refinedstorage2.destructor.filter_help": "The blocks that may or may not be destroyed, depending if the device is in allowlist or blocklist mode.", - "gui.refinedstorage2.destructor.filter_mode.allow.help": "Only allow blocks into the storage network that are configured in the filters.", - "gui.refinedstorage2.destructor.filter_mode.block.help": "Disallow blocks into the storage network that are configured in the filters.", - "gui.refinedstorage2.constructor.drop_items": "Drop items instead of placing blocks", + "gui.refinedstorage2.destructor.filter_mode.allow.help": "Autorise dans le réseau de stockage uniquement les blocs configurés dans les filtres.", + "gui.refinedstorage2.destructor.filter_mode.block.help": "Interdit dans le réseau de stockage les blocs configurés dans les filtres.", + "gui.refinedstorage2.constructor.drop_items": "Laisser tomber des objets au lieu de placer des blocs.", "gui.refinedstorage2.constructor.filter_help": "The resources that should be placed from the storage network.", "gui.refinedstorage2.interface.filter_help": "The resources that should be exported from the storage network.", "gui.refinedstorage2.exporter.filter_help": "The resources that should be exported from the storage network.", "gui.refinedstorage2.importer.filter_help": "The resources that may be imported from the target inventory.", - "gui.refinedstorage2.importer.filter_mode.allow.help": "Only allow resources into the storage network that are configured in the filters.", - "gui.refinedstorage2.importer.filter_mode.block.help": "Disallow resources into the storage network that are configured in the filters.", - "gui.refinedstorage2.wireless_transmitter.distance": "%d block(s)", - "gui.refinedstorage2.storage_monitor.filter_help": "The resource to display.", - "gui.refinedstorage2.redstone_mode": "Redstone mode", - "gui.refinedstorage2.redstone_mode.ignore": "Ignore", - "gui.refinedstorage2.redstone_mode.ignore.help": "This device will always be active, regardless of redstone signal.", - "gui.refinedstorage2.redstone_mode.high": "High", - "gui.refinedstorage2.redstone_mode.high.help": "This device will only be active with a redstone signal.", - "gui.refinedstorage2.redstone_mode.low": "Low", - "gui.refinedstorage2.redstone_mode.low.help": "This device will only be active without a redstone signal.", - "gui.refinedstorage2.scheduling_mode": "Scheduling mode", - "gui.refinedstorage2.scheduling_mode.default": "Default", - "gui.refinedstorage2.scheduling_mode.default.help": "Use the first available filter.", - "gui.refinedstorage2.scheduling_mode.round_robin": "Round robin", - "gui.refinedstorage2.scheduling_mode.round_robin.help": "Use each filter in turn.", + "gui.refinedstorage2.importer.filter_mode.allow.help": "Autorise dans le réseau de stockage uniquement les ressources configurées dans les filtres.", + "gui.refinedstorage2.importer.filter_mode.block.help": "Interdit dans le réseau de stockage les ressources configurées dans les filtres.", + "gui.refinedstorage2.wireless_transmitter.distance": "%d bloc(s)", + "gui.refinedstorage2.storage_monitor.filter_help": "La ressource à afficher.", + "gui.refinedstorage2.redstone_mode": "Mode redstone", + "gui.refinedstorage2.redstone_mode.ignore": "Ignoré", + "gui.refinedstorage2.redstone_mode.ignore.help": "Cet appareil sera toujours actif quel que soit le signal de redstone.", + "gui.refinedstorage2.redstone_mode.high": "Allumé", + "gui.refinedstorage2.redstone_mode.high.help": "Cet appareil sera actif seulement s'il reçoit un signal de redstone.", + "gui.refinedstorage2.redstone_mode.low": "Éteint", + "gui.refinedstorage2.redstone_mode.low.help": "Cet appareil sera actif seulement s'il ne reçoit pas de signal de redstone.", + "gui.refinedstorage2.scheduling_mode": "Mode de distribution", + "gui.refinedstorage2.scheduling_mode.default": "Par défaut", + "gui.refinedstorage2.scheduling_mode.default.help": "Utilise le premier filtre disponible.", + "gui.refinedstorage2.scheduling_mode.round_robin": "À tour de rôle", + "gui.refinedstorage2.scheduling_mode.round_robin.help": "Utiliser chaque filtre à tour de rôle.", "gui.refinedstorage2.scheduling_mode.random": "Aléatoire", "gui.refinedstorage2.scheduling_mode.random.help": "Utiliser un filtre aléatoire.", "gui.refinedstorage2.priority": "Priorité", "gui.refinedstorage2.priority.storage_help": "L'ordre dans lequel le réseau de stockage va insérer ou extraire les ressources, le plus élevé en premier.", "gui.refinedstorage2.amount": "Quantité", - "gui.refinedstorage2.amount.reset": "Reset", + "gui.refinedstorage2.amount.reset": "Réinitialiser", "gui.refinedstorage2.amount.set": "Set", - "gui.refinedstorage2.filter_mode": "Filter mode", + "gui.refinedstorage2.filter_mode": "Mode de filtrage", "gui.refinedstorage2.filter_mode.allow": "Liste blanche", "gui.refinedstorage2.filter_mode.block": "Liste noire", "gui.refinedstorage2.fuzzy_mode": "Fuzzy mode", - "gui.refinedstorage2.fuzzy_mode.on": "On", + "gui.refinedstorage2.fuzzy_mode.on": "Activé", "gui.refinedstorage2.fuzzy_mode.on.storage_help": "Match the filters for the allowlist or blocklist exactly.", "gui.refinedstorage2.fuzzy_mode.on.generic_help": "Match the filter exactly.", "gui.refinedstorage2.fuzzy_mode.on.extracting_storage_network_help": "Match the filters when extracting from the storage network exactly.", "gui.refinedstorage2.fuzzy_mode.on.extracting_source_help": "Match the filters when extracting from the source exactly.", - "gui.refinedstorage2.fuzzy_mode.off": "Off", + "gui.refinedstorage2.fuzzy_mode.off": "Désactivé", "gui.refinedstorage2.fuzzy_mode.off.storage_help": "Match the filters for the allowlist or blocklist without comparing NBT tags.", "gui.refinedstorage2.fuzzy_mode.off.generic_help": "Match the filter without comparing NBT tags.", "gui.refinedstorage2.fuzzy_mode.off.extracting_storage_network_help": "Match the filters when extracting from the storage network without comparing NBT tags.", @@ -139,11 +141,16 @@ "gui.refinedstorage2.filter_slot.click_to_clear": "Click to clear", "gui.refinedstorage2.regulator_upgrade.filter_help": "The resource that should be regulated in the target.", "gui.refinedstorage2.network_transmitter.status.inactive": "Inactive", - "gui.refinedstorage2.network_transmitter.status.missing_network_card": "Missing Network Card", - "gui.refinedstorage2.network_transmitter.status.transmitting": "%d block(s)", + "gui.refinedstorage2.network_transmitter.status.missing_network_card": "Carte réseau manquante", + "gui.refinedstorage2.network_transmitter.status.transmitting": "%d bloc(s)", "gui.refinedstorage2.network_transmitter.status.receiver_unreachable": "Unreachable", - "item.refinedstorage2.controller.help": "Provides the storage network with energy. Multiple are allowed in a single storage network.", - "item.refinedstorage2.creative_controller.help": "Provides the storage network with an infinite source of energy.", + "gui.refinedstorage2.security_card.permission.reset": "Reset", + "gui.refinedstorage2.security_card.permission.modified": "Modified", + "gui.refinedstorage2.security_manager.redstone_mode_help": "Lorsque cet appareil est inactif, le réseau ne sera pas protégé.", + "gui.refinedstorage2.security_manager.fallback_security_card_slot_hint": "Emplacement pour une carte de sécurité de repli.", + "gui.refinedstorage2.security_manager.no_fallback_security_card_consequence": "Ajoutez une Carte de sécurité de repli à cet emplacement pour définir les permissions de tous les joueurs sans Carte de sécurité. Par défaut, toutes les actions sont interdites.", + "item.refinedstorage2.controller.help": "Alimente le réseau de stockage en énergie. Plusieurs sont autorisés dans un seul réseau de stockage. ", + "item.refinedstorage2.creative_controller.help": "Alimente le réseau de stockage avec une source d'énergie infinie. ", "item.refinedstorage2.disk_drive.help": "Accepts storage disks to provide the storage network with storage space.", "item.refinedstorage2.grid.help": "Allows for interacting with the storage network.", "item.refinedstorage2.crafting_grid.help": "Allows for interacting with the storage network, with crafting abilities.", @@ -151,52 +158,52 @@ "item.refinedstorage2.exporter.help": "Exports resources from the storage network to an external destination.", "item.refinedstorage2.interface.help": "Acts as the combination of an Importer and Exporter.", "item.refinedstorage2.external_storage.help": "Provides the storage network with storage from an external source.", - "item.refinedstorage2.detector.help": "Emits a redstone signal if the storage network contains a resource equal, above or under a given amount.", + "item.refinedstorage2.detector.help": "Émet un signal de redstone si le réseau de stockage contient une ressource en quantité égale, supérieure ou inférieure à un seuil donné.", "item.refinedstorage2.constructor.help": "Places blocks from the storage network in the world.", "item.refinedstorage2.destructor.help": "Destroys blocks from the world and puts them in the storage network.", - "item.refinedstorage2.quartz_enriched_iron": "Quartz Enriched Iron", - "item.refinedstorage2.processor_binding": "Processor Binding", - "item.refinedstorage2.silicon": "Silicon", - "item.refinedstorage2.raw_basic_processor": "Raw Basic Processor", - "item.refinedstorage2.raw_improved_processor": "Raw Improved Processor", - "item.refinedstorage2.raw_advanced_processor": "Raw Advanced Processor", - "item.refinedstorage2.basic_processor": "Basic Processor", - "item.refinedstorage2.improved_processor": "Improved Processor", - "item.refinedstorage2.advanced_processor": "Advanced Processor", - "item.refinedstorage2.1k_storage_part": "1K Storage Part", - "item.refinedstorage2.4k_storage_part": "4K Storage Part", - "item.refinedstorage2.16k_storage_part": "16K Storage Part", - "item.refinedstorage2.64k_storage_part": "64K Storage Part", - "item.refinedstorage2.1k_storage_disk": "1K Storage Disk", - "item.refinedstorage2.4k_storage_disk": "4K Storage Disk", - "item.refinedstorage2.16k_storage_disk": "16K Storage Disk", - "item.refinedstorage2.64k_storage_disk": "64K Storage Disk", - "item.refinedstorage2.creative_storage_disk": "Creative Storage Disk", - "item.refinedstorage2.64b_fluid_storage_part": "64B Fluid Storage Part", - "item.refinedstorage2.256b_fluid_storage_part": "256B Fluid Storage Part", - "item.refinedstorage2.1024b_fluid_storage_part": "1024B Fluid Storage Part", - "item.refinedstorage2.4096b_fluid_storage_part": "4096B Fluid Storage Part", - "item.refinedstorage2.64b_fluid_storage_disk": "64B Fluid Storage Disk", - "item.refinedstorage2.256b_fluid_storage_disk": "256B Fluid Storage Disk", - "item.refinedstorage2.1024b_fluid_storage_disk": "1024B Fluid Storage Disk", - "item.refinedstorage2.4096b_fluid_storage_disk": "4096B Fluid Storage Disk", - "item.refinedstorage2.creative_fluid_storage_disk": "Creative Fluid Storage Disk", - "item.refinedstorage2.storage_housing": "Storage Housing", - "item.refinedstorage2.construction_core": "Construction Core", - "item.refinedstorage2.destruction_core": "Destruction Core", - "item.refinedstorage2.wrench": "Wrench", - "item.refinedstorage2.wrench.helper": "Use to rotate blocks or press SHIFT and use to dismantle Refined Storage blocks.", - "item.refinedstorage2.upgrade": "Upgrade", - "item.refinedstorage2.speed_upgrade": "Speed Upgrade", - "item.refinedstorage2.stack_upgrade": "Stack Upgrade", - "item.refinedstorage2.silk_touch_upgrade": "Silk Touch Upgrade", - "item.refinedstorage2.fortune_upgrade.1": "Fortune I Upgrade", - "item.refinedstorage2.fortune_upgrade.2": "Fortune II Upgrade", - "item.refinedstorage2.fortune_upgrade.3": "Fortune III Upgrade", - "item.refinedstorage2.regulator_upgrade": "Regulator Upgrade", - "item.refinedstorage2.regulator_upgrade.help": "In an Exporter, will only export if the amount in the target is less than configured in the upgrade. In an Importer, will only import if the amount in the target is more than configured in the upgrade. Use item to configure.", - "item.refinedstorage2.range_upgrade": "Range Upgrade", - "item.refinedstorage2.creative_range_upgrade": "Creative Range Upgrade", + "item.refinedstorage2.quartz_enriched_iron": "Fer enrichi en quartz", + "item.refinedstorage2.processor_binding": "Liant pour processeur", + "item.refinedstorage2.silicon": "Silicone", + "item.refinedstorage2.raw_basic_processor": "Processeur basique brut", + "item.refinedstorage2.raw_improved_processor": "Processeur amélioré brut", + "item.refinedstorage2.raw_advanced_processor": "Processeur avancé brut", + "item.refinedstorage2.basic_processor": "Processeur basique", + "item.refinedstorage2.improved_processor": "Processeur amélioré", + "item.refinedstorage2.advanced_processor": "Processeur avancé", + "item.refinedstorage2.1k_storage_part": "Pièce de stockage 1k", + "item.refinedstorage2.4k_storage_part": "Pièce de stockage 4k", + "item.refinedstorage2.16k_storage_part": "Pièce de stockage 16k", + "item.refinedstorage2.64k_storage_part": "Pièce de stockage 64k", + "item.refinedstorage2.1k_storage_disk": "Disque de stockage 1k", + "item.refinedstorage2.4k_storage_disk": "Disque de stockage 4k", + "item.refinedstorage2.16k_storage_disk": "Disque de stockage 16k", + "item.refinedstorage2.64k_storage_disk": "Disque de stockage 64k", + "item.refinedstorage2.creative_storage_disk": "Disque de stockage créatif", + "item.refinedstorage2.64b_fluid_storage_part": "Pièce de stockage de fluides 64B", + "item.refinedstorage2.256b_fluid_storage_part": "Pièce de stockage de fluides 256B", + "item.refinedstorage2.1024b_fluid_storage_part": "Pièce de stockage de fluides 1024B", + "item.refinedstorage2.4096b_fluid_storage_part": "Pièce de stockage de fluides 4096B", + "item.refinedstorage2.64b_fluid_storage_disk": "Disque de stockage de fluides 64B", + "item.refinedstorage2.256b_fluid_storage_disk": "Disque de stockage de fluides 256B", + "item.refinedstorage2.1024b_fluid_storage_disk": "Disque de stockage de fluides 1024B", + "item.refinedstorage2.4096b_fluid_storage_disk": "Disque de stockage de fluides 4096B", + "item.refinedstorage2.creative_fluid_storage_disk": "Disque de stockage de fluides créatif", + "item.refinedstorage2.storage_housing": "Boitier de stockage", + "item.refinedstorage2.construction_core": "Cœur de construction", + "item.refinedstorage2.destruction_core": "Cœur de destruction", + "item.refinedstorage2.wrench": "Clé", + "item.refinedstorage2.wrench.helper": "Utilisez pour faire tourner un bloc, ou appuyez sur Maj et utilisez pour démanteler les blocs de Refined Storage.", + "item.refinedstorage2.upgrade": "Amélioration", + "item.refinedstorage2.speed_upgrade": "Amélioration de vitesse", + "item.refinedstorage2.stack_upgrade": "Amélioration de stack", + "item.refinedstorage2.silk_touch_upgrade": "Amélioration de toucher de soie", + "item.refinedstorage2.fortune_upgrade.1": "Amélioration de fortune I", + "item.refinedstorage2.fortune_upgrade.2": "Amélioration de fortune II", + "item.refinedstorage2.fortune_upgrade.3": "Amélioration de fortune III", + "item.refinedstorage2.regulator_upgrade": "Amélioration de régulation", + "item.refinedstorage2.regulator_upgrade.help": "Dans un Exportateur, n'exportera que si le montant dans la cible est inférieur à la valeur configurée dans l'amélioration. Dans un Importateur, n'importera que si le montant dans la cible est supérieur à la valeur configurée dans l'amélioration. Utilisez l'objet pour configurer.", + "item.refinedstorage2.range_upgrade": "Amélioration de portée", + "item.refinedstorage2.creative_range_upgrade": "Amélioration de portée créative", "item.refinedstorage2.wireless_grid": "Wireless Grid", "item.refinedstorage2.creative_wireless_grid": "Creative Wireless Grid", "item.refinedstorage2.wireless_transmitter.help": "Provides wireless network access for items like the Wireless Grid. Multiple are allowed in an area for wider coverage.", @@ -219,6 +226,14 @@ "item.refinedstorage2.network_card.unbound": "Unbound.", "item.refinedstorage2.network_card.bound_help": "Insert into a Network Transmitter. Use while crouching to clear binding.", "item.refinedstorage2.network_card.bound": "Bound to %d, %d, %d in %s.", + "item.refinedstorage2.security_card": "Security Card", + "item.refinedstorage2.security_card.cleared_configuration": "Cleared configuration.", + "item.refinedstorage2.security_card.unbound": "Unbound.", + "item.refinedstorage2.security_card.unbound.help": "Right click to configure and bind to the current player.", + "item.refinedstorage2.security_card.bound": "Bound to %s.", + "item.refinedstorage2.security_card.bound.help": "Right click to configure. Use while crouching to clear configuration and binding.", + "item.refinedstorage2.fallback_security_card": "Fallback Security Card", + "item.refinedstorage2.fallback_security_card.help": "Acts as a fallback if no matching Security Card for a player is found. Right click to configure. Use while crouching to clear configuration.", "misc.refinedstorage2.stored": "Stored: %s", "misc.refinedstorage2.stored_with_capacity": "Stored: %s / %s (%d%%)", "misc.refinedstorage2.total": "%d total", @@ -238,29 +253,48 @@ "misc.refinedstorage2.resource_type.item": "Item", "misc.refinedstorage2.resource_type.fluid": "Fluid", "misc.refinedstorage2.press_shift_for_help": "Press SHIFT for help", + "misc.refinedstorage2.no_permission": "No permission", + "misc.refinedstorage2.no_permission.open": "You are not allowed to open the %s.", + "misc.refinedstorage2.no_permission.insert": "You are not allowed to insert.", + "misc.refinedstorage2.no_permission.extract": "You are not allowed to extract.", + "misc.refinedstorage2.no_permission.build.place": "You are not allowed to place a %s here.", + "misc.refinedstorage2.no_permission.build.break": "You are not allowed to break the %s.", + "misc.refinedstorage2.no_permission.build.rotate": "You are not allowed to rotate the %s.", + "misc.refinedstorage2.no_permission.build.dismantle": "You are not allowed to dismantle the %s.", "key.refinedstorage2.focus_search_bar": "Focus search bar", "key.refinedstorage2.clear_crafting_grid_matrix_to_network": "Clear Crafting Grid matrix to network", "key.refinedstorage2.clear_crafting_grid_matrix_to_inventory": "Clear Crafting Grid matrix to inventory", "key.refinedstorage2.open_wireless_grid": "Open Wireless Grid", "refinedstorage2.subtitle.wrench": "Wrench used", - "category.refinedstorage2.key_bindings": "Refined Storage 2", "curios.identifier.refinedstorage2": "Refined Storage 2", "trinkets.slot.refinedstorage2.wireless": "Refined Storage 2", + "permission.refinedstorage2.insert": "Insert", + "permission.refinedstorage2.insert.description": "Whether the player can insert resources in a network.", + "permission.refinedstorage2.extract": "Extract", + "permission.refinedstorage2.extract.description": "Whether the player can extract resources from a network.", + "permission.refinedstorage2.autocrafting": "Autocrafting", + "permission.refinedstorage2.autocrafting.description": "Whether the player can start, cancel or view an autocrafting task.", + "permission.refinedstorage2.open": "Open", + "permission.refinedstorage2.open.description": "Whether the player can open network device GUIs.", + "permission.refinedstorage2.build": "Build", + "permission.refinedstorage2.build.description": "Whether the player can add or remove network devices.", + "permission.refinedstorage2.security": "Security", + "permission.refinedstorage2.security.description": "Whether the player can manage the security options for a network.", "text.autoconfig.refinedstorage2.title": "Refined Storage 2", + "text.autoconfig.refinedstorage2.option.smoothScrolling": "Smooth scrolling", + "text.autoconfig.refinedstorage2.option.screenSize": "Screen size", + "text.autoconfig.refinedstorage2.option.maxRowsStretch": "Maximum amount of rows when screen size is stretched", "text.autoconfig.refinedstorage2.option.grid": "Grille", "text.autoconfig.refinedstorage2.option.grid.largeFont": "Large font", - "text.autoconfig.refinedstorage2.option.grid.maxRowsStretch": "Maximum amount of rows when stretched", - "text.autoconfig.refinedstorage2.option.grid.preventSortingWhileShiftIsDown": "Prevent sorting while SHIFT is down", + "text.autoconfig.refinedstorage2.option.grid.preventSortingWhileShiftIsDown": "Empêcher le tri lorsque la touche Maj est enfoncée", "text.autoconfig.refinedstorage2.option.grid.detailedTooltip": "Detailed tooltip", "text.autoconfig.refinedstorage2.option.grid.rememberSearchQuery": "Remember search query", "text.autoconfig.refinedstorage2.option.grid.energyUsage": "Energy usage", - "text.autoconfig.refinedstorage2.option.grid.smoothScrolling": "Smooth scrolling", "text.autoconfig.refinedstorage2.option.grid.autoSelected": "Auto selected search box", - "text.autoconfig.refinedstorage2.option.grid.synchronizer": "Synchronizer", + "text.autoconfig.refinedstorage2.option.grid.synchronizer": "Synchronisation", "text.autoconfig.refinedstorage2.option.grid.resourceTypeId": "Resource type", - "text.autoconfig.refinedstorage2.option.grid.sortingDirection": "Sorting direction", - "text.autoconfig.refinedstorage2.option.grid.sortingType": "Sorting type", - "text.autoconfig.refinedstorage2.option.grid.size": "Size", + "text.autoconfig.refinedstorage2.option.grid.sortingDirection": "Direction du tri", + "text.autoconfig.refinedstorage2.option.grid.sortingType": "Type de tri", "text.autoconfig.refinedstorage2.option.craftingGrid": "Crafting Grid", "text.autoconfig.refinedstorage2.option.craftingGrid.energyUsage": "Energy usage", "text.autoconfig.refinedstorage2.option.craftingGrid.craftingMatrixCloseBehavior": "Crafting matrix close behavior", @@ -327,7 +361,13 @@ "text.autoconfig.refinedstorage2.option.portableGrid.openEnergyUsage": "Open energy usage", "text.autoconfig.refinedstorage2.option.portableGrid.insertEnergyUsage": "Insert energy usage", "text.autoconfig.refinedstorage2.option.portableGrid.extractEnergyUsage": "Extract energy usage", - "advancements.refinedstorage2.root.description": "Use one or multiple Controllers in a network to provide your network with energy", + "text.autoconfig.refinedstorage2.option.securityCard": "Security Card", + "text.autoconfig.refinedstorage2.option.securityCard.energyUsage": "Energy usage", + "text.autoconfig.refinedstorage2.option.fallbackSecurityCard": "Fallback Security Card", + "text.autoconfig.refinedstorage2.option.fallbackSecurityCard.energyUsage": "Energy usage", + "text.autoconfig.refinedstorage2.option.securityManager": "Security Manager", + "text.autoconfig.refinedstorage2.option.securityManager.energyUsage": "Energy usage", + "advancements.refinedstorage2.root.description": "Use one or multiple Controllers in a storage network to provide your network with energy", "advancements.refinedstorage2.connecting": "Connecting", "advancements.refinedstorage2.connecting.description": "Use Cable to connect devices with each other, or place devices against each other", "advancements.refinedstorage2.drives": "Drives", @@ -351,17 +391,19 @@ "advancements.refinedstorage2.storing_externally": "Storing externally", "advancements.refinedstorage2.storing_externally.description": "Use an External Storage to provide the network with storage from an external block like a chest", "advancements.refinedstorage2.detecting": "Detecting", - "advancements.refinedstorage2.detecting.description": "Use redstone to check resources stored in the network", + "advancements.refinedstorage2.detecting.description": "Use redstone to check resources stored in the storage network", "advancements.refinedstorage2.construction": "Construction", "advancements.refinedstorage2.construction.description": "Get blocks from the storage network into the world with a Constructor", "advancements.refinedstorage2.destruction": "Destruction", "advancements.refinedstorage2.destruction.description": "Get blocks from in the world into the storage network with a Destructor", "advancements.refinedstorage2.wireless": "Wireless", - "advancements.refinedstorage2.wireless.description": "Access your resources wirelessly with a Wireless Grid.", + "advancements.refinedstorage2.wireless.description": "Access your resources wirelessly with a Wireless Grid", "advancements.refinedstorage2.better_than_a_barrel": "Better than a barrel", "advancements.refinedstorage2.better_than_a_barrel.description": "Craft a Storage Monitor to view, insert or extract resources in a storage network", "advancements.refinedstorage2.no_cables_required": "No cables required", - "advancements.refinedstorage2.no_cables_required.description": "Add extra components to your network without using cables by using a Network Transmitter, Network Receiver and Network Card", + "advancements.refinedstorage2.no_cables_required.description": "Add extra components to your storage network without using cables by using a Network Transmitter, Network Receiver and Network Card", "advancements.refinedstorage2.portable_storage": "Portable storage", - "advancements.refinedstorage2.portable_storage.description": "Craft a Portable Grid to access the content of disks without requiring a storage network" + "advancements.refinedstorage2.portable_storage.description": "Craft a Portable Grid to access the content of disks without requiring a storage network", + "advancements.refinedstorage2.security": "Security", + "advancements.refinedstorage2.security.description": "Secure your storage network with a Security Manager and a Security Card" } From 9bb88863e2ede1e5bfe10143a01a5ef854e156c8 Mon Sep 17 00:00:00 2001 From: Raoul Date: Thu, 4 Apr 2024 18:50:20 +0200 Subject: [PATCH 03/26] chore: update translation Spanish from crowdin --- .../assets/refinedstorage2/lang/es_es.json | 186 +++++++++++------- 1 file changed, 114 insertions(+), 72 deletions(-) diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/es_es.json b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/es_es.json index 0e58472c8..841f3e462 100644 --- a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/es_es.json +++ b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/es_es.json @@ -1,76 +1,78 @@ { - "itemGroup.refinedstorage2.general": "Refined Storage 2", + "mod.refinedstorage2": "Refined Storage 2", "block.refinedstorage2.cable": "Cable", - "block.refinedstorage2.quartz_enriched_iron_block": "Block of Quartz Enriched Iron", - "block.refinedstorage2.disk_drive": "Disk Drive", - "block.refinedstorage2.machine_casing": "Machine Casing", - "block.refinedstorage2.grid": "Grid", - "block.refinedstorage2.crafting_grid": "Crafting Grid", - "block.refinedstorage2.controller": "Controller", - "block.refinedstorage2.controller.rei_fully_charged": "Fully charged Controller", - "block.refinedstorage2.creative_controller": "Creative Controller", - "block.refinedstorage2.1k_storage_block": "1K Storage Block", - "block.refinedstorage2.4k_storage_block": "4K Storage Block", - "block.refinedstorage2.16k_storage_block": "16K Storage Block", - "block.refinedstorage2.64k_storage_block": "64K Storage Block", - "block.refinedstorage2.creative_storage_block": "Creative Storage Block", - "block.refinedstorage2.64b_fluid_storage_block": "64B Fluid Storage Block", - "block.refinedstorage2.256b_fluid_storage_block": "256B Fluid Storage Block", - "block.refinedstorage2.1024b_fluid_storage_block": "1024B Fluid Storage Block", - "block.refinedstorage2.4096b_fluid_storage_block": "4096B Fluid Storage Block", - "block.refinedstorage2.creative_fluid_storage_block": "Creative Fluid Storage Block", - "block.refinedstorage2.importer": "Importer", - "block.refinedstorage2.exporter": "Exporter", - "block.refinedstorage2.interface": "Interface", - "block.refinedstorage2.external_storage": "External Storage", + "block.refinedstorage2.quartz_enriched_iron_block": "Bloque de Hierro Enriquecido", + "block.refinedstorage2.disk_drive": "Unidad de Disco", + "block.refinedstorage2.machine_casing": "Carcasa de la Máquina", + "block.refinedstorage2.grid": "Rejilla", + "block.refinedstorage2.crafting_grid": "Rejilla de Fabricación", + "block.refinedstorage2.controller": "Controlador", + "block.refinedstorage2.controller.rei_fully_charged": "Controlador completamente cargado", + "block.refinedstorage2.creative_controller": "Controlador Creativo", + "block.refinedstorage2.1k_storage_block": "Bloque de almacenamiento de 1K", + "block.refinedstorage2.4k_storage_block": "Bloque de almacenamiento de 4K", + "block.refinedstorage2.16k_storage_block": "Bloque de almacenamiento de 16K", + "block.refinedstorage2.64k_storage_block": "Bloque de almacenamiento de 64K", + "block.refinedstorage2.creative_storage_block": "Bloque de almacenamiento creativo", + "block.refinedstorage2.64b_fluid_storage_block": "Bloque de almacenamiento de fluidos de 64B", + "block.refinedstorage2.256b_fluid_storage_block": "Bloque de almacenamiento de fluidos de 64B", + "block.refinedstorage2.1024b_fluid_storage_block": "Bloque de almacenamiento de fluidos de 1024B", + "block.refinedstorage2.4096b_fluid_storage_block": "Bloque de almacenamiento de fluidos de 4096B", + "block.refinedstorage2.creative_fluid_storage_block": "Bloque de almacenamiento de fluidos creativo", + "block.refinedstorage2.importer": "Importador", + "block.refinedstorage2.exporter": "Exportador", + "block.refinedstorage2.interface": "Interfaz", + "block.refinedstorage2.external_storage": "Almacenamiento Externo", "block.refinedstorage2.detector": "Detector", "block.refinedstorage2.constructor": "Constructor", "block.refinedstorage2.destructor": "Destructor", - "block.refinedstorage2.wireless_transmitter": "Wireless Transmitter", - "block.refinedstorage2.storage_monitor": "Storage Monitor", - "block.refinedstorage2.network_receiver": "Network Receiver", - "block.refinedstorage2.network_transmitter": "Network Transmitter", - "block.refinedstorage2.portable_grid": "Portable Grid", - "block.refinedstorage2.creative_portable_grid": "Creative Portable Grid", - "gui.refinedstorage2.controller.redstone_mode_help": "When this device is inactive, the storage network will not be able to use this device as an energy source.", - "gui.refinedstorage2.disk_drive.disks": "Disks", - "gui.refinedstorage2.storage.redstone_mode_help": "When this device is inactive, the contained storage will no longer be accessible from within the storage network.", - "gui.refinedstorage2.storage.filter_help": "The resources that may or may not be allowed in this storage, depending if the device is in allowlist or blocklist mode.", - "gui.refinedstorage2.storage.filter_mode.empty_warning": "Without any configured filters, no resources will be accepted in this storage.", - "gui.refinedstorage2.storage.filter_mode.allow.help": "Only allow resources into this storage that are configured in the filters.", - "gui.refinedstorage2.storage.filter_mode.block.help": "Disallow resources into this storage that are configured in the filters.", - "gui.refinedstorage2.grid.sorting.direction": "Sorting direction", - "gui.refinedstorage2.grid.sorting.direction.ascending": "Ascending", - "gui.refinedstorage2.grid.sorting.direction.descending": "Descending", - "gui.refinedstorage2.grid.sorting.type": "Sorting type", - "gui.refinedstorage2.grid.sorting.type.quantity": "Quantity", - "gui.refinedstorage2.grid.sorting.type.name": "Name", + "block.refinedstorage2.wireless_transmitter": "Transmisor Inalámbrico", + "block.refinedstorage2.storage_monitor": "Monitor de Almacenamiento", + "block.refinedstorage2.network_receiver": "Receptor de Red", + "block.refinedstorage2.network_transmitter": "Transmisor de Red", + "block.refinedstorage2.portable_grid": "Rejilla Portátil", + "block.refinedstorage2.creative_portable_grid": "Rejilla Portátil Creativa", + "block.refinedstorage2.security_manager": "Security Manager", + "block.refinedstorage2.security_manager.help": "When this device is active, will protect the network by default and block all operations. Start adding Security Cards to permit or deny specific operations for a player.", + "gui.refinedstorage2.controller.redstone_mode_help": "Cuando este dispositivo está inactivo, la red de almacenamiento no podrá utilizar este dispositivo como fuente de energía.", + "gui.refinedstorage2.disk_drive.disks": "Discos", + "gui.refinedstorage2.storage.redstone_mode_help": "Cuando este dispositivo está inactivo, ya no se podrá acceder al almacenamiento contenido desde la red de almacenamiento.", + "gui.refinedstorage2.storage.filter_help": "Los recursos que pueden o no ser permitidos en este almacenamiento, dependiendo de si el dispositivo está en la lista de permitidos o en el modo de lista de bloqueos.", + "gui.refinedstorage2.storage.filter_mode.empty_warning": "Sin filtros configurados, no se aceptarán recursos en este almacenamiento.", + "gui.refinedstorage2.storage.filter_mode.allow.help": "Sólo permitir recursos en este almacenamiento que estén configurados en los filtros.", + "gui.refinedstorage2.storage.filter_mode.block.help": "No permitir recursos en este almacenamiento que están configurados en los filtros.", + "gui.refinedstorage2.grid.sorting.direction": "Dirección de ordenación", + "gui.refinedstorage2.grid.sorting.direction.ascending": "Ascendente", + "gui.refinedstorage2.grid.sorting.direction.descending": "Descendente", + "gui.refinedstorage2.grid.sorting.type": "Tipo de ordenación", + "gui.refinedstorage2.grid.sorting.type.quantity": "Cantidad", + "gui.refinedstorage2.grid.sorting.type.name": "Nombre", "gui.refinedstorage2.grid.sorting.type.id": "ID", - "gui.refinedstorage2.grid.sorting.type.last_modified": "Last modified", - "gui.refinedstorage2.grid.size": "Size", - "gui.refinedstorage2.grid.size.stretch": "Stretch", - "gui.refinedstorage2.grid.size.small": "Small", - "gui.refinedstorage2.grid.size.medium": "Medium", - "gui.refinedstorage2.grid.size.large": "Large", - "gui.refinedstorage2.grid.size.extra_large": "Extra large", - "gui.refinedstorage2.grid.auto_selected": "Auto-selected", - "gui.refinedstorage2.grid.auto_selected.help": "Whether to auto-select the search box when opening the Grid.", - "gui.refinedstorage2.grid.synchronizer": "Synchronization mode", - "gui.refinedstorage2.grid.synchronizer.off": "Off", - "gui.refinedstorage2.grid.synchronizer.off.help": "Don't sync the search box text.", + "gui.refinedstorage2.grid.sorting.type.last_modified": "Última modificación", + "gui.refinedstorage2.grid.auto_selected": "Auto-seleccionado", + "gui.refinedstorage2.grid.auto_selected.help": "Si seleccionar automáticamente el cuadro de búsqueda al abrir el cuadrículo.", + "gui.refinedstorage2.grid.synchronizer": "Modo de sincronización", + "gui.refinedstorage2.grid.synchronizer.off": "Apagado", + "gui.refinedstorage2.grid.synchronizer.off.help": "No sincronizar el texto del cuadro de búsqueda.", "gui.refinedstorage2.grid.synchronizer.jei": "JEI", - "gui.refinedstorage2.grid.synchronizer.jei.help": "Sync the search box text to the JEI filter.", - "gui.refinedstorage2.grid.synchronizer.jei.two_way": "JEI two-way", - "gui.refinedstorage2.grid.synchronizer.jei.two_way.help": "Sync the search box text to the JEI filter, and the JEI filter to the search box text.", + "gui.refinedstorage2.grid.synchronizer.jei.help": "Sincroniza el texto del cuadro de búsqueda al filtro JEI.", + "gui.refinedstorage2.grid.synchronizer.jei.two_way": "JEI en dos direcciones", + "gui.refinedstorage2.grid.synchronizer.jei.two_way.help": "Sincronice el texto del cuadro de búsqueda al filtro JEI, y el filtro JEI al texto del cuadro de búsqueda.", "gui.refinedstorage2.grid.synchronizer.rei": "REI", - "gui.refinedstorage2.grid.synchronizer.rei.help": "Sync the search box text to the REI filter.", - "gui.refinedstorage2.grid.synchronizer.rei.two_way": "REI two-way", - "gui.refinedstorage2.grid.synchronizer.rei.two_way.help": "Sync the search box text to the JEI filter, and the JEI filter to the search box text.", - "gui.refinedstorage2.grid.resource_type": "Resource type", - "gui.refinedstorage2.grid.resource_type.all": "All", - "gui.refinedstorage2.grid.resource_type.help": "Filter specific resource types.", + "gui.refinedstorage2.grid.synchronizer.rei.help": "Sincroniza el texto del cuadro de búsqueda al filtro REI.", + "gui.refinedstorage2.grid.synchronizer.rei.two_way": "REI en dos direcciones", + "gui.refinedstorage2.grid.synchronizer.rei.two_way.help": "Sync the search box text to the REI filter, and the REI filter to the search box text.", + "gui.refinedstorage2.grid.resource_type": "Tipo de Recurso", + "gui.refinedstorage2.grid.resource_type.all": "Todo", + "gui.refinedstorage2.grid.resource_type.help": "Filtrar tipos de recurso específicos.", "gui.refinedstorage2.crafting_grid.move.network": "Move items to network", "gui.refinedstorage2.crafting_grid.move.inventory": "Move items to inventory", + "gui.refinedstorage2.screen_size": "Screen size", + "gui.refinedstorage2.screen_size.stretch": "Stretch", + "gui.refinedstorage2.screen_size.small": "Small", + "gui.refinedstorage2.screen_size.medium": "Medium", + "gui.refinedstorage2.screen_size.large": "Large", + "gui.refinedstorage2.screen_size.extra_large": "Extra large", "gui.refinedstorage2.detector.mode": "Mode", "gui.refinedstorage2.detector.mode.under": "Emit redstone signal when under the amount", "gui.refinedstorage2.detector.mode.equal": "Emit redstone signal when on the amount", @@ -142,6 +144,11 @@ "gui.refinedstorage2.network_transmitter.status.missing_network_card": "Missing Network Card", "gui.refinedstorage2.network_transmitter.status.transmitting": "%d block(s)", "gui.refinedstorage2.network_transmitter.status.receiver_unreachable": "Unreachable", + "gui.refinedstorage2.security_card.permission.reset": "Reset", + "gui.refinedstorage2.security_card.permission.modified": "Modified", + "gui.refinedstorage2.security_manager.redstone_mode_help": "When this device is inactive, the network will not be protected.", + "gui.refinedstorage2.security_manager.fallback_security_card_slot_hint": "Slot for a Fallback Security Card.", + "gui.refinedstorage2.security_manager.no_fallback_security_card_consequence": "Add a Fallback Security Card to this slot to set permissions for every player without a Security Card. By default, all actions are denied.", "item.refinedstorage2.controller.help": "Provides the storage network with energy. Multiple are allowed in a single storage network.", "item.refinedstorage2.creative_controller.help": "Provides the storage network with an infinite source of energy.", "item.refinedstorage2.disk_drive.help": "Accepts storage disks to provide the storage network with storage space.", @@ -219,6 +226,14 @@ "item.refinedstorage2.network_card.unbound": "Unbound.", "item.refinedstorage2.network_card.bound_help": "Insert into a Network Transmitter. Use while crouching to clear binding.", "item.refinedstorage2.network_card.bound": "Bound to %d, %d, %d in %s.", + "item.refinedstorage2.security_card": "Security Card", + "item.refinedstorage2.security_card.cleared_configuration": "Cleared configuration.", + "item.refinedstorage2.security_card.unbound": "Unbound.", + "item.refinedstorage2.security_card.unbound.help": "Right click to configure and bind to the current player.", + "item.refinedstorage2.security_card.bound": "Bound to %s.", + "item.refinedstorage2.security_card.bound.help": "Right click to configure. Use while crouching to clear configuration and binding.", + "item.refinedstorage2.fallback_security_card": "Fallback Security Card", + "item.refinedstorage2.fallback_security_card.help": "Acts as a fallback if no matching Security Card for a player is found. Right click to configure. Use while crouching to clear configuration.", "misc.refinedstorage2.stored": "Stored: %s", "misc.refinedstorage2.stored_with_capacity": "Stored: %s / %s (%d%%)", "misc.refinedstorage2.total": "%d total", @@ -238,29 +253,48 @@ "misc.refinedstorage2.resource_type.item": "Item", "misc.refinedstorage2.resource_type.fluid": "Fluid", "misc.refinedstorage2.press_shift_for_help": "Press SHIFT for help", + "misc.refinedstorage2.no_permission": "No permission", + "misc.refinedstorage2.no_permission.open": "You are not allowed to open the %s.", + "misc.refinedstorage2.no_permission.insert": "You are not allowed to insert.", + "misc.refinedstorage2.no_permission.extract": "You are not allowed to extract.", + "misc.refinedstorage2.no_permission.build.place": "You are not allowed to place a %s here.", + "misc.refinedstorage2.no_permission.build.break": "You are not allowed to break the %s.", + "misc.refinedstorage2.no_permission.build.rotate": "You are not allowed to rotate the %s.", + "misc.refinedstorage2.no_permission.build.dismantle": "You are not allowed to dismantle the %s.", "key.refinedstorage2.focus_search_bar": "Focus search bar", "key.refinedstorage2.clear_crafting_grid_matrix_to_network": "Clear Crafting Grid matrix to network", "key.refinedstorage2.clear_crafting_grid_matrix_to_inventory": "Clear Crafting Grid matrix to inventory", "key.refinedstorage2.open_wireless_grid": "Open Wireless Grid", "refinedstorage2.subtitle.wrench": "Wrench used", - "category.refinedstorage2.key_bindings": "Refined Storage 2", "curios.identifier.refinedstorage2": "Refined Storage 2", "trinkets.slot.refinedstorage2.wireless": "Refined Storage 2", + "permission.refinedstorage2.insert": "Insert", + "permission.refinedstorage2.insert.description": "Whether the player can insert resources in a network.", + "permission.refinedstorage2.extract": "Extract", + "permission.refinedstorage2.extract.description": "Whether the player can extract resources from a network.", + "permission.refinedstorage2.autocrafting": "Autocrafting", + "permission.refinedstorage2.autocrafting.description": "Whether the player can start, cancel or view an autocrafting task.", + "permission.refinedstorage2.open": "Open", + "permission.refinedstorage2.open.description": "Whether the player can open network device GUIs.", + "permission.refinedstorage2.build": "Build", + "permission.refinedstorage2.build.description": "Whether the player can add or remove network devices.", + "permission.refinedstorage2.security": "Security", + "permission.refinedstorage2.security.description": "Whether the player can manage the security options for a network.", "text.autoconfig.refinedstorage2.title": "Refined Storage 2", + "text.autoconfig.refinedstorage2.option.smoothScrolling": "Smooth scrolling", + "text.autoconfig.refinedstorage2.option.screenSize": "Screen size", + "text.autoconfig.refinedstorage2.option.maxRowsStretch": "Maximum amount of rows when screen size is stretched", "text.autoconfig.refinedstorage2.option.grid": "Grid", "text.autoconfig.refinedstorage2.option.grid.largeFont": "Large font", - "text.autoconfig.refinedstorage2.option.grid.maxRowsStretch": "Maximum amount of rows when stretched", "text.autoconfig.refinedstorage2.option.grid.preventSortingWhileShiftIsDown": "Prevent sorting while SHIFT is down", "text.autoconfig.refinedstorage2.option.grid.detailedTooltip": "Detailed tooltip", "text.autoconfig.refinedstorage2.option.grid.rememberSearchQuery": "Remember search query", "text.autoconfig.refinedstorage2.option.grid.energyUsage": "Energy usage", - "text.autoconfig.refinedstorage2.option.grid.smoothScrolling": "Smooth scrolling", "text.autoconfig.refinedstorage2.option.grid.autoSelected": "Auto selected search box", "text.autoconfig.refinedstorage2.option.grid.synchronizer": "Synchronizer", "text.autoconfig.refinedstorage2.option.grid.resourceTypeId": "Resource type", "text.autoconfig.refinedstorage2.option.grid.sortingDirection": "Sorting direction", "text.autoconfig.refinedstorage2.option.grid.sortingType": "Sorting type", - "text.autoconfig.refinedstorage2.option.grid.size": "Size", "text.autoconfig.refinedstorage2.option.craftingGrid": "Crafting Grid", "text.autoconfig.refinedstorage2.option.craftingGrid.energyUsage": "Energy usage", "text.autoconfig.refinedstorage2.option.craftingGrid.craftingMatrixCloseBehavior": "Crafting matrix close behavior", @@ -327,7 +361,13 @@ "text.autoconfig.refinedstorage2.option.portableGrid.openEnergyUsage": "Open energy usage", "text.autoconfig.refinedstorage2.option.portableGrid.insertEnergyUsage": "Insert energy usage", "text.autoconfig.refinedstorage2.option.portableGrid.extractEnergyUsage": "Extract energy usage", - "advancements.refinedstorage2.root.description": "Use one or multiple Controllers in a network to provide your network with energy", + "text.autoconfig.refinedstorage2.option.securityCard": "Security Card", + "text.autoconfig.refinedstorage2.option.securityCard.energyUsage": "Energy usage", + "text.autoconfig.refinedstorage2.option.fallbackSecurityCard": "Fallback Security Card", + "text.autoconfig.refinedstorage2.option.fallbackSecurityCard.energyUsage": "Energy usage", + "text.autoconfig.refinedstorage2.option.securityManager": "Security Manager", + "text.autoconfig.refinedstorage2.option.securityManager.energyUsage": "Energy usage", + "advancements.refinedstorage2.root.description": "Use one or multiple Controllers in a storage network to provide your network with energy", "advancements.refinedstorage2.connecting": "Connecting", "advancements.refinedstorage2.connecting.description": "Use Cable to connect devices with each other, or place devices against each other", "advancements.refinedstorage2.drives": "Drives", @@ -351,17 +391,19 @@ "advancements.refinedstorage2.storing_externally": "Storing externally", "advancements.refinedstorage2.storing_externally.description": "Use an External Storage to provide the network with storage from an external block like a chest", "advancements.refinedstorage2.detecting": "Detecting", - "advancements.refinedstorage2.detecting.description": "Use redstone to check resources stored in the network", + "advancements.refinedstorage2.detecting.description": "Use redstone to check resources stored in the storage network", "advancements.refinedstorage2.construction": "Construction", "advancements.refinedstorage2.construction.description": "Get blocks from the storage network into the world with a Constructor", "advancements.refinedstorage2.destruction": "Destruction", "advancements.refinedstorage2.destruction.description": "Get blocks from in the world into the storage network with a Destructor", "advancements.refinedstorage2.wireless": "Wireless", - "advancements.refinedstorage2.wireless.description": "Access your resources wirelessly with a Wireless Grid.", + "advancements.refinedstorage2.wireless.description": "Access your resources wirelessly with a Wireless Grid", "advancements.refinedstorage2.better_than_a_barrel": "Better than a barrel", "advancements.refinedstorage2.better_than_a_barrel.description": "Craft a Storage Monitor to view, insert or extract resources in a storage network", "advancements.refinedstorage2.no_cables_required": "No cables required", - "advancements.refinedstorage2.no_cables_required.description": "Add extra components to your network without using cables by using a Network Transmitter, Network Receiver and Network Card", + "advancements.refinedstorage2.no_cables_required.description": "Add extra components to your storage network without using cables by using a Network Transmitter, Network Receiver and Network Card", "advancements.refinedstorage2.portable_storage": "Portable storage", - "advancements.refinedstorage2.portable_storage.description": "Craft a Portable Grid to access the content of disks without requiring a storage network" + "advancements.refinedstorage2.portable_storage.description": "Craft a Portable Grid to access the content of disks without requiring a storage network", + "advancements.refinedstorage2.security": "Security", + "advancements.refinedstorage2.security.description": "Secure your storage network with a Security Manager and a Security Card" } From bf7d99a8a8331a75bbeb2863e1f6d9a10769b54a Mon Sep 17 00:00:00 2001 From: Raoul Date: Thu, 4 Apr 2024 18:50:21 +0200 Subject: [PATCH 04/26] chore: update translation Polish from crowdin --- .../assets/refinedstorage2/lang/pl_pl.json | 92 ++++++++++++++----- 1 file changed, 67 insertions(+), 25 deletions(-) diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/pl_pl.json b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/pl_pl.json index de98e8bce..f0385525f 100644 --- a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/pl_pl.json +++ b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/pl_pl.json @@ -1,5 +1,5 @@ { - "itemGroup.refinedstorage2.general": "Refined Storage 2", + "mod.refinedstorage2": "Refined Storage 2", "block.refinedstorage2.cable": "Kabel", "block.refinedstorage2.quartz_enriched_iron_block": "Blok kwarcowego żelaza", "block.refinedstorage2.disk_drive": "Napęd dysku", @@ -32,6 +32,8 @@ "block.refinedstorage2.network_transmitter": "Nadajnik sieci", "block.refinedstorage2.portable_grid": "Przenośny terminal", "block.refinedstorage2.creative_portable_grid": "Kreatywny przenośny terminal", + "block.refinedstorage2.security_manager": "Security Manager", + "block.refinedstorage2.security_manager.help": "When this device is active, will protect the network by default and block all operations. Start adding Security Cards to permit or deny specific operations for a player.", "gui.refinedstorage2.controller.redstone_mode_help": "Gdy to urządzenie jest nieaktywne, sieć magazynowa nie będzie w stanie używać tego urządzenia jako źródła energii.", "gui.refinedstorage2.disk_drive.disks": "Dyski", "gui.refinedstorage2.storage.redstone_mode_help": "When this device is inactive, the contained storage will no longer be accessible from within the storage network.", @@ -47,12 +49,6 @@ "gui.refinedstorage2.grid.sorting.type.name": "Nazwa", "gui.refinedstorage2.grid.sorting.type.id": "Identyfikator", "gui.refinedstorage2.grid.sorting.type.last_modified": "Ostatnia modyfikacja", - "gui.refinedstorage2.grid.size": "Rozmiar", - "gui.refinedstorage2.grid.size.stretch": "Rozciągnięcie", - "gui.refinedstorage2.grid.size.small": "Mały", - "gui.refinedstorage2.grid.size.medium": "Średni", - "gui.refinedstorage2.grid.size.large": "Duży", - "gui.refinedstorage2.grid.size.extra_large": "Bardzo duży", "gui.refinedstorage2.grid.auto_selected": "Automatycznie zaznaczone", "gui.refinedstorage2.grid.auto_selected.help": "Whether to auto-select the search box when opening the Grid.", "gui.refinedstorage2.grid.synchronizer": "Tryb synchronizacji", @@ -65,12 +61,18 @@ "gui.refinedstorage2.grid.synchronizer.rei": "REI", "gui.refinedstorage2.grid.synchronizer.rei.help": "Synchronizuj pole wyszukiwania z filtrem REI.", "gui.refinedstorage2.grid.synchronizer.rei.two_way": "Dwukierunkowe REI", - "gui.refinedstorage2.grid.synchronizer.rei.two_way.help": "Synchronizuj pole wyszukiwania z filtrem REI i filtr REI do pola wyszukiwania.", + "gui.refinedstorage2.grid.synchronizer.rei.two_way.help": "Sync the search box text to the REI filter, and the REI filter to the search box text.", "gui.refinedstorage2.grid.resource_type": "Typ zasobu", "gui.refinedstorage2.grid.resource_type.all": "Wszystko", "gui.refinedstorage2.grid.resource_type.help": "Filtruj określone typy zasobów.", "gui.refinedstorage2.crafting_grid.move.network": "Przenieś przedmioty do sieci", "gui.refinedstorage2.crafting_grid.move.inventory": "Przenieś przedmioty do ekwipunku", + "gui.refinedstorage2.screen_size": "Screen size", + "gui.refinedstorage2.screen_size.stretch": "Stretch", + "gui.refinedstorage2.screen_size.small": "Small", + "gui.refinedstorage2.screen_size.medium": "Medium", + "gui.refinedstorage2.screen_size.large": "Large", + "gui.refinedstorage2.screen_size.extra_large": "Extra large", "gui.refinedstorage2.detector.mode": "Tryb", "gui.refinedstorage2.detector.mode.under": "Emituj sygnał redstone, kiedy poniżej danej ilości", "gui.refinedstorage2.detector.mode.equal": "Emituj sygnał redstone, kiedy dana ilość", @@ -101,18 +103,18 @@ "gui.refinedstorage2.scheduling_mode.default.help": "Use the first available filter.", "gui.refinedstorage2.scheduling_mode.round_robin": "Round robin", "gui.refinedstorage2.scheduling_mode.round_robin.help": "Use each filter in turn.", - "gui.refinedstorage2.scheduling_mode.random": "Random", - "gui.refinedstorage2.scheduling_mode.random.help": "Use a random filter.", - "gui.refinedstorage2.priority": "Priority", + "gui.refinedstorage2.scheduling_mode.random": "Losowy", + "gui.refinedstorage2.scheduling_mode.random.help": "Użyj filtru losowego.", + "gui.refinedstorage2.priority": "Priorytet", "gui.refinedstorage2.priority.storage_help": "The order in which the storage network will insert or extract resources, highest-first.", - "gui.refinedstorage2.amount": "Amount", + "gui.refinedstorage2.amount": "Ilość", "gui.refinedstorage2.amount.reset": "Reset", - "gui.refinedstorage2.amount.set": "Set", - "gui.refinedstorage2.filter_mode": "Filter mode", + "gui.refinedstorage2.amount.set": "Ustaw", + "gui.refinedstorage2.filter_mode": "Tryb filtrowania", "gui.refinedstorage2.filter_mode.allow": "Allowlist", "gui.refinedstorage2.filter_mode.block": "Blocklist", - "gui.refinedstorage2.fuzzy_mode": "Fuzzy mode", - "gui.refinedstorage2.fuzzy_mode.on": "On", + "gui.refinedstorage2.fuzzy_mode": "Tryb nieprecyzyjny", + "gui.refinedstorage2.fuzzy_mode.on": "Włączono", "gui.refinedstorage2.fuzzy_mode.on.storage_help": "Match the filters for the allowlist or blocklist exactly.", "gui.refinedstorage2.fuzzy_mode.on.generic_help": "Match the filter exactly.", "gui.refinedstorage2.fuzzy_mode.on.extracting_storage_network_help": "Match the filters when extracting from the storage network exactly.", @@ -142,6 +144,11 @@ "gui.refinedstorage2.network_transmitter.status.missing_network_card": "Brak karty sieci", "gui.refinedstorage2.network_transmitter.status.transmitting": "%d blok(ów)", "gui.refinedstorage2.network_transmitter.status.receiver_unreachable": "Nieosiągalny", + "gui.refinedstorage2.security_card.permission.reset": "Reset", + "gui.refinedstorage2.security_card.permission.modified": "Modified", + "gui.refinedstorage2.security_manager.redstone_mode_help": "When this device is inactive, the network will not be protected.", + "gui.refinedstorage2.security_manager.fallback_security_card_slot_hint": "Slot for a Fallback Security Card.", + "gui.refinedstorage2.security_manager.no_fallback_security_card_consequence": "Add a Fallback Security Card to this slot to set permissions for every player without a Security Card. By default, all actions are denied.", "item.refinedstorage2.controller.help": "Zapewnia sieć magazynowania w energie. Sieć może mieć ich kilka.", "item.refinedstorage2.creative_controller.help": "Zapewnia sieć magazynowania w nieskończoną energię.", "item.refinedstorage2.disk_drive.help": "Akceptuje dyski do zapewnienia przestrzeni dyskowej dla sieci magazynowania.", @@ -219,6 +226,14 @@ "item.refinedstorage2.network_card.unbound": "Unbound.", "item.refinedstorage2.network_card.bound_help": "Insert into a Network Transmitter. Use while crouching to clear binding.", "item.refinedstorage2.network_card.bound": "Bound to %d, %d, %d in %s.", + "item.refinedstorage2.security_card": "Security Card", + "item.refinedstorage2.security_card.cleared_configuration": "Cleared configuration.", + "item.refinedstorage2.security_card.unbound": "Unbound.", + "item.refinedstorage2.security_card.unbound.help": "Right click to configure and bind to the current player.", + "item.refinedstorage2.security_card.bound": "Bound to %s.", + "item.refinedstorage2.security_card.bound.help": "Right click to configure. Use while crouching to clear configuration and binding.", + "item.refinedstorage2.fallback_security_card": "Fallback Security Card", + "item.refinedstorage2.fallback_security_card.help": "Acts as a fallback if no matching Security Card for a player is found. Right click to configure. Use while crouching to clear configuration.", "misc.refinedstorage2.stored": "Stored: %s", "misc.refinedstorage2.stored_with_capacity": "Stored: %s / %s (%d%%)", "misc.refinedstorage2.total": "%d total", @@ -238,29 +253,48 @@ "misc.refinedstorage2.resource_type.item": "Item", "misc.refinedstorage2.resource_type.fluid": "Fluid", "misc.refinedstorage2.press_shift_for_help": "Press SHIFT for help", + "misc.refinedstorage2.no_permission": "No permission", + "misc.refinedstorage2.no_permission.open": "You are not allowed to open the %s.", + "misc.refinedstorage2.no_permission.insert": "You are not allowed to insert.", + "misc.refinedstorage2.no_permission.extract": "You are not allowed to extract.", + "misc.refinedstorage2.no_permission.build.place": "You are not allowed to place a %s here.", + "misc.refinedstorage2.no_permission.build.break": "You are not allowed to break the %s.", + "misc.refinedstorage2.no_permission.build.rotate": "You are not allowed to rotate the %s.", + "misc.refinedstorage2.no_permission.build.dismantle": "You are not allowed to dismantle the %s.", "key.refinedstorage2.focus_search_bar": "Focus search bar", "key.refinedstorage2.clear_crafting_grid_matrix_to_network": "Clear Crafting Grid matrix to network", "key.refinedstorage2.clear_crafting_grid_matrix_to_inventory": "Clear Crafting Grid matrix to inventory", "key.refinedstorage2.open_wireless_grid": "Open Wireless Grid", "refinedstorage2.subtitle.wrench": "Wrench used", - "category.refinedstorage2.key_bindings": "Refined Storage 2", "curios.identifier.refinedstorage2": "Refined Storage 2", "trinkets.slot.refinedstorage2.wireless": "Refined Storage 2", + "permission.refinedstorage2.insert": "Insert", + "permission.refinedstorage2.insert.description": "Whether the player can insert resources in a network.", + "permission.refinedstorage2.extract": "Extract", + "permission.refinedstorage2.extract.description": "Whether the player can extract resources from a network.", + "permission.refinedstorage2.autocrafting": "Autocrafting", + "permission.refinedstorage2.autocrafting.description": "Whether the player can start, cancel or view an autocrafting task.", + "permission.refinedstorage2.open": "Open", + "permission.refinedstorage2.open.description": "Whether the player can open network device GUIs.", + "permission.refinedstorage2.build": "Build", + "permission.refinedstorage2.build.description": "Whether the player can add or remove network devices.", + "permission.refinedstorage2.security": "Security", + "permission.refinedstorage2.security.description": "Whether the player can manage the security options for a network.", "text.autoconfig.refinedstorage2.title": "Refined Storage 2", + "text.autoconfig.refinedstorage2.option.smoothScrolling": "Smooth scrolling", + "text.autoconfig.refinedstorage2.option.screenSize": "Screen size", + "text.autoconfig.refinedstorage2.option.maxRowsStretch": "Maximum amount of rows when screen size is stretched", "text.autoconfig.refinedstorage2.option.grid": "Grid", "text.autoconfig.refinedstorage2.option.grid.largeFont": "Large font", - "text.autoconfig.refinedstorage2.option.grid.maxRowsStretch": "Maximum amount of rows when stretched", "text.autoconfig.refinedstorage2.option.grid.preventSortingWhileShiftIsDown": "Prevent sorting while SHIFT is down", "text.autoconfig.refinedstorage2.option.grid.detailedTooltip": "Detailed tooltip", "text.autoconfig.refinedstorage2.option.grid.rememberSearchQuery": "Remember search query", "text.autoconfig.refinedstorage2.option.grid.energyUsage": "Energy usage", - "text.autoconfig.refinedstorage2.option.grid.smoothScrolling": "Smooth scrolling", "text.autoconfig.refinedstorage2.option.grid.autoSelected": "Auto selected search box", "text.autoconfig.refinedstorage2.option.grid.synchronizer": "Synchronizer", "text.autoconfig.refinedstorage2.option.grid.resourceTypeId": "Resource type", "text.autoconfig.refinedstorage2.option.grid.sortingDirection": "Sorting direction", "text.autoconfig.refinedstorage2.option.grid.sortingType": "Sorting type", - "text.autoconfig.refinedstorage2.option.grid.size": "Size", "text.autoconfig.refinedstorage2.option.craftingGrid": "Crafting Grid", "text.autoconfig.refinedstorage2.option.craftingGrid.energyUsage": "Energy usage", "text.autoconfig.refinedstorage2.option.craftingGrid.craftingMatrixCloseBehavior": "Crafting matrix close behavior", @@ -327,7 +361,13 @@ "text.autoconfig.refinedstorage2.option.portableGrid.openEnergyUsage": "Open energy usage", "text.autoconfig.refinedstorage2.option.portableGrid.insertEnergyUsage": "Insert energy usage", "text.autoconfig.refinedstorage2.option.portableGrid.extractEnergyUsage": "Extract energy usage", - "advancements.refinedstorage2.root.description": "Use one or multiple Controllers in a network to provide your network with energy", + "text.autoconfig.refinedstorage2.option.securityCard": "Security Card", + "text.autoconfig.refinedstorage2.option.securityCard.energyUsage": "Energy usage", + "text.autoconfig.refinedstorage2.option.fallbackSecurityCard": "Fallback Security Card", + "text.autoconfig.refinedstorage2.option.fallbackSecurityCard.energyUsage": "Energy usage", + "text.autoconfig.refinedstorage2.option.securityManager": "Security Manager", + "text.autoconfig.refinedstorage2.option.securityManager.energyUsage": "Energy usage", + "advancements.refinedstorage2.root.description": "Use one or multiple Controllers in a storage network to provide your network with energy", "advancements.refinedstorage2.connecting": "Connecting", "advancements.refinedstorage2.connecting.description": "Use Cable to connect devices with each other, or place devices against each other", "advancements.refinedstorage2.drives": "Drives", @@ -351,17 +391,19 @@ "advancements.refinedstorage2.storing_externally": "Przechowywanie zewnętrzne", "advancements.refinedstorage2.storing_externally.description": "Użyj zewnętrznego magazynu, aby zapewnić sieć w pamięć z zewnętrznego bloku jak skrzynia", "advancements.refinedstorage2.detecting": "Detecting", - "advancements.refinedstorage2.detecting.description": "Use redstone to check resources stored in the network", + "advancements.refinedstorage2.detecting.description": "Use redstone to check resources stored in the storage network", "advancements.refinedstorage2.construction": "Construction", "advancements.refinedstorage2.construction.description": "Get blocks from the storage network into the world with a Constructor", "advancements.refinedstorage2.destruction": "Destruction", "advancements.refinedstorage2.destruction.description": "Get blocks from in the world into the storage network with a Destructor", "advancements.refinedstorage2.wireless": "Wireless", - "advancements.refinedstorage2.wireless.description": "Access your resources wirelessly with a Wireless Grid.", + "advancements.refinedstorage2.wireless.description": "Access your resources wirelessly with a Wireless Grid", "advancements.refinedstorage2.better_than_a_barrel": "Better than a barrel", "advancements.refinedstorage2.better_than_a_barrel.description": "Craft a Storage Monitor to view, insert or extract resources in a storage network", "advancements.refinedstorage2.no_cables_required": "No cables required", - "advancements.refinedstorage2.no_cables_required.description": "Add extra components to your network without using cables by using a Network Transmitter, Network Receiver and Network Card", + "advancements.refinedstorage2.no_cables_required.description": "Add extra components to your storage network without using cables by using a Network Transmitter, Network Receiver and Network Card", "advancements.refinedstorage2.portable_storage": "Portable storage", - "advancements.refinedstorage2.portable_storage.description": "Craft a Portable Grid to access the content of disks without requiring a storage network" + "advancements.refinedstorage2.portable_storage.description": "Craft a Portable Grid to access the content of disks without requiring a storage network", + "advancements.refinedstorage2.security": "Security", + "advancements.refinedstorage2.security.description": "Secure your storage network with a Security Manager and a Security Card" } From 68372bae4892fd09afd994118c7c596ce0b0b3b5 Mon Sep 17 00:00:00 2001 From: Raoul Date: Thu, 4 Apr 2024 18:50:22 +0200 Subject: [PATCH 05/26] chore: update translation Russian from crowdin --- .../assets/refinedstorage2/lang/ru_ru.json | 152 +++++++++++------- 1 file changed, 97 insertions(+), 55 deletions(-) diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/ru_ru.json b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/ru_ru.json index 0e58472c8..646c11f96 100644 --- a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/ru_ru.json +++ b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/ru_ru.json @@ -1,58 +1,54 @@ { - "itemGroup.refinedstorage2.general": "Refined Storage 2", - "block.refinedstorage2.cable": "Cable", - "block.refinedstorage2.quartz_enriched_iron_block": "Block of Quartz Enriched Iron", - "block.refinedstorage2.disk_drive": "Disk Drive", - "block.refinedstorage2.machine_casing": "Machine Casing", - "block.refinedstorage2.grid": "Grid", - "block.refinedstorage2.crafting_grid": "Crafting Grid", - "block.refinedstorage2.controller": "Controller", - "block.refinedstorage2.controller.rei_fully_charged": "Fully charged Controller", - "block.refinedstorage2.creative_controller": "Creative Controller", - "block.refinedstorage2.1k_storage_block": "1K Storage Block", - "block.refinedstorage2.4k_storage_block": "4K Storage Block", - "block.refinedstorage2.16k_storage_block": "16K Storage Block", - "block.refinedstorage2.64k_storage_block": "64K Storage Block", - "block.refinedstorage2.creative_storage_block": "Creative Storage Block", - "block.refinedstorage2.64b_fluid_storage_block": "64B Fluid Storage Block", - "block.refinedstorage2.256b_fluid_storage_block": "256B Fluid Storage Block", - "block.refinedstorage2.1024b_fluid_storage_block": "1024B Fluid Storage Block", - "block.refinedstorage2.4096b_fluid_storage_block": "4096B Fluid Storage Block", - "block.refinedstorage2.creative_fluid_storage_block": "Creative Fluid Storage Block", - "block.refinedstorage2.importer": "Importer", - "block.refinedstorage2.exporter": "Exporter", + "mod.refinedstorage2": "Refined Storage 2", + "block.refinedstorage2.cable": "Кабель", + "block.refinedstorage2.quartz_enriched_iron_block": "Блок обогащённого кварцем железа", + "block.refinedstorage2.disk_drive": "Дисковый привод", + "block.refinedstorage2.machine_casing": "Корпус механизма", + "block.refinedstorage2.grid": "Терминал", + "block.refinedstorage2.crafting_grid": "Терминал создания", + "block.refinedstorage2.controller": "Контроллер", + "block.refinedstorage2.controller.rei_fully_charged": "Полностью заряженный контроллер", + "block.refinedstorage2.creative_controller": "Творческий контроллер", + "block.refinedstorage2.1k_storage_block": "Блок хранения 1k", + "block.refinedstorage2.4k_storage_block": "Блок хранения 4k", + "block.refinedstorage2.16k_storage_block": "Блок хранения 16k", + "block.refinedstorage2.64k_storage_block": "Блок хранения 64k", + "block.refinedstorage2.creative_storage_block": "Творческий блок хранения", + "block.refinedstorage2.64b_fluid_storage_block": "Блок хранения жидкости 64b", + "block.refinedstorage2.256b_fluid_storage_block": "Блок хранения жидкости 256b", + "block.refinedstorage2.1024b_fluid_storage_block": "Блок хранения жидкости 1024b", + "block.refinedstorage2.4096b_fluid_storage_block": "Блок хранения жидкости 4096b", + "block.refinedstorage2.creative_fluid_storage_block": "Творческий блок хранения жидкости", + "block.refinedstorage2.importer": "Шина импорта", + "block.refinedstorage2.exporter": "Шина экспорта", "block.refinedstorage2.interface": "Interface", - "block.refinedstorage2.external_storage": "External Storage", - "block.refinedstorage2.detector": "Detector", - "block.refinedstorage2.constructor": "Constructor", - "block.refinedstorage2.destructor": "Destructor", - "block.refinedstorage2.wireless_transmitter": "Wireless Transmitter", - "block.refinedstorage2.storage_monitor": "Storage Monitor", - "block.refinedstorage2.network_receiver": "Network Receiver", - "block.refinedstorage2.network_transmitter": "Network Transmitter", - "block.refinedstorage2.portable_grid": "Portable Grid", - "block.refinedstorage2.creative_portable_grid": "Creative Portable Grid", + "block.refinedstorage2.external_storage": "Шина внешнего хранения", + "block.refinedstorage2.detector": "Детектор", + "block.refinedstorage2.constructor": "Шина формирования", + "block.refinedstorage2.destructor": "Шина разрушения", + "block.refinedstorage2.wireless_transmitter": "Беспроводной передатчик", + "block.refinedstorage2.storage_monitor": "Монитор хранения", + "block.refinedstorage2.network_receiver": "Сетевой приёмник", + "block.refinedstorage2.network_transmitter": "Сетевой передатчик", + "block.refinedstorage2.portable_grid": "Переносной терминал", + "block.refinedstorage2.creative_portable_grid": "Творческий переносной терминал", + "block.refinedstorage2.security_manager": "Security Manager", + "block.refinedstorage2.security_manager.help": "When this device is active, will protect the network by default and block all operations. Start adding Security Cards to permit or deny specific operations for a player.", "gui.refinedstorage2.controller.redstone_mode_help": "When this device is inactive, the storage network will not be able to use this device as an energy source.", - "gui.refinedstorage2.disk_drive.disks": "Disks", + "gui.refinedstorage2.disk_drive.disks": "Диски", "gui.refinedstorage2.storage.redstone_mode_help": "When this device is inactive, the contained storage will no longer be accessible from within the storage network.", "gui.refinedstorage2.storage.filter_help": "The resources that may or may not be allowed in this storage, depending if the device is in allowlist or blocklist mode.", "gui.refinedstorage2.storage.filter_mode.empty_warning": "Without any configured filters, no resources will be accepted in this storage.", "gui.refinedstorage2.storage.filter_mode.allow.help": "Only allow resources into this storage that are configured in the filters.", "gui.refinedstorage2.storage.filter_mode.block.help": "Disallow resources into this storage that are configured in the filters.", - "gui.refinedstorage2.grid.sorting.direction": "Sorting direction", - "gui.refinedstorage2.grid.sorting.direction.ascending": "Ascending", - "gui.refinedstorage2.grid.sorting.direction.descending": "Descending", - "gui.refinedstorage2.grid.sorting.type": "Sorting type", - "gui.refinedstorage2.grid.sorting.type.quantity": "Quantity", - "gui.refinedstorage2.grid.sorting.type.name": "Name", + "gui.refinedstorage2.grid.sorting.direction": "Порядок сортировки", + "gui.refinedstorage2.grid.sorting.direction.ascending": "По возрастанию", + "gui.refinedstorage2.grid.sorting.direction.descending": "По убыванию", + "gui.refinedstorage2.grid.sorting.type": "Тип сортировки", + "gui.refinedstorage2.grid.sorting.type.quantity": "Кол-во", + "gui.refinedstorage2.grid.sorting.type.name": "Название", "gui.refinedstorage2.grid.sorting.type.id": "ID", "gui.refinedstorage2.grid.sorting.type.last_modified": "Last modified", - "gui.refinedstorage2.grid.size": "Size", - "gui.refinedstorage2.grid.size.stretch": "Stretch", - "gui.refinedstorage2.grid.size.small": "Small", - "gui.refinedstorage2.grid.size.medium": "Medium", - "gui.refinedstorage2.grid.size.large": "Large", - "gui.refinedstorage2.grid.size.extra_large": "Extra large", "gui.refinedstorage2.grid.auto_selected": "Auto-selected", "gui.refinedstorage2.grid.auto_selected.help": "Whether to auto-select the search box when opening the Grid.", "gui.refinedstorage2.grid.synchronizer": "Synchronization mode", @@ -65,12 +61,18 @@ "gui.refinedstorage2.grid.synchronizer.rei": "REI", "gui.refinedstorage2.grid.synchronizer.rei.help": "Sync the search box text to the REI filter.", "gui.refinedstorage2.grid.synchronizer.rei.two_way": "REI two-way", - "gui.refinedstorage2.grid.synchronizer.rei.two_way.help": "Sync the search box text to the JEI filter, and the JEI filter to the search box text.", + "gui.refinedstorage2.grid.synchronizer.rei.two_way.help": "Sync the search box text to the REI filter, and the REI filter to the search box text.", "gui.refinedstorage2.grid.resource_type": "Resource type", "gui.refinedstorage2.grid.resource_type.all": "All", "gui.refinedstorage2.grid.resource_type.help": "Filter specific resource types.", "gui.refinedstorage2.crafting_grid.move.network": "Move items to network", "gui.refinedstorage2.crafting_grid.move.inventory": "Move items to inventory", + "gui.refinedstorage2.screen_size": "Screen size", + "gui.refinedstorage2.screen_size.stretch": "Stretch", + "gui.refinedstorage2.screen_size.small": "Small", + "gui.refinedstorage2.screen_size.medium": "Medium", + "gui.refinedstorage2.screen_size.large": "Large", + "gui.refinedstorage2.screen_size.extra_large": "Extra large", "gui.refinedstorage2.detector.mode": "Mode", "gui.refinedstorage2.detector.mode.under": "Emit redstone signal when under the amount", "gui.refinedstorage2.detector.mode.equal": "Emit redstone signal when on the amount", @@ -142,6 +144,11 @@ "gui.refinedstorage2.network_transmitter.status.missing_network_card": "Missing Network Card", "gui.refinedstorage2.network_transmitter.status.transmitting": "%d block(s)", "gui.refinedstorage2.network_transmitter.status.receiver_unreachable": "Unreachable", + "gui.refinedstorage2.security_card.permission.reset": "Reset", + "gui.refinedstorage2.security_card.permission.modified": "Modified", + "gui.refinedstorage2.security_manager.redstone_mode_help": "When this device is inactive, the network will not be protected.", + "gui.refinedstorage2.security_manager.fallback_security_card_slot_hint": "Slot for a Fallback Security Card.", + "gui.refinedstorage2.security_manager.no_fallback_security_card_consequence": "Add a Fallback Security Card to this slot to set permissions for every player without a Security Card. By default, all actions are denied.", "item.refinedstorage2.controller.help": "Provides the storage network with energy. Multiple are allowed in a single storage network.", "item.refinedstorage2.creative_controller.help": "Provides the storage network with an infinite source of energy.", "item.refinedstorage2.disk_drive.help": "Accepts storage disks to provide the storage network with storage space.", @@ -219,6 +226,14 @@ "item.refinedstorage2.network_card.unbound": "Unbound.", "item.refinedstorage2.network_card.bound_help": "Insert into a Network Transmitter. Use while crouching to clear binding.", "item.refinedstorage2.network_card.bound": "Bound to %d, %d, %d in %s.", + "item.refinedstorage2.security_card": "Security Card", + "item.refinedstorage2.security_card.cleared_configuration": "Cleared configuration.", + "item.refinedstorage2.security_card.unbound": "Unbound.", + "item.refinedstorage2.security_card.unbound.help": "Right click to configure and bind to the current player.", + "item.refinedstorage2.security_card.bound": "Bound to %s.", + "item.refinedstorage2.security_card.bound.help": "Right click to configure. Use while crouching to clear configuration and binding.", + "item.refinedstorage2.fallback_security_card": "Fallback Security Card", + "item.refinedstorage2.fallback_security_card.help": "Acts as a fallback if no matching Security Card for a player is found. Right click to configure. Use while crouching to clear configuration.", "misc.refinedstorage2.stored": "Stored: %s", "misc.refinedstorage2.stored_with_capacity": "Stored: %s / %s (%d%%)", "misc.refinedstorage2.total": "%d total", @@ -238,29 +253,48 @@ "misc.refinedstorage2.resource_type.item": "Item", "misc.refinedstorage2.resource_type.fluid": "Fluid", "misc.refinedstorage2.press_shift_for_help": "Press SHIFT for help", + "misc.refinedstorage2.no_permission": "No permission", + "misc.refinedstorage2.no_permission.open": "You are not allowed to open the %s.", + "misc.refinedstorage2.no_permission.insert": "You are not allowed to insert.", + "misc.refinedstorage2.no_permission.extract": "You are not allowed to extract.", + "misc.refinedstorage2.no_permission.build.place": "You are not allowed to place a %s here.", + "misc.refinedstorage2.no_permission.build.break": "You are not allowed to break the %s.", + "misc.refinedstorage2.no_permission.build.rotate": "You are not allowed to rotate the %s.", + "misc.refinedstorage2.no_permission.build.dismantle": "You are not allowed to dismantle the %s.", "key.refinedstorage2.focus_search_bar": "Focus search bar", "key.refinedstorage2.clear_crafting_grid_matrix_to_network": "Clear Crafting Grid matrix to network", "key.refinedstorage2.clear_crafting_grid_matrix_to_inventory": "Clear Crafting Grid matrix to inventory", "key.refinedstorage2.open_wireless_grid": "Open Wireless Grid", "refinedstorage2.subtitle.wrench": "Wrench used", - "category.refinedstorage2.key_bindings": "Refined Storage 2", "curios.identifier.refinedstorage2": "Refined Storage 2", "trinkets.slot.refinedstorage2.wireless": "Refined Storage 2", + "permission.refinedstorage2.insert": "Insert", + "permission.refinedstorage2.insert.description": "Whether the player can insert resources in a network.", + "permission.refinedstorage2.extract": "Extract", + "permission.refinedstorage2.extract.description": "Whether the player can extract resources from a network.", + "permission.refinedstorage2.autocrafting": "Autocrafting", + "permission.refinedstorage2.autocrafting.description": "Whether the player can start, cancel or view an autocrafting task.", + "permission.refinedstorage2.open": "Open", + "permission.refinedstorage2.open.description": "Whether the player can open network device GUIs.", + "permission.refinedstorage2.build": "Build", + "permission.refinedstorage2.build.description": "Whether the player can add or remove network devices.", + "permission.refinedstorage2.security": "Security", + "permission.refinedstorage2.security.description": "Whether the player can manage the security options for a network.", "text.autoconfig.refinedstorage2.title": "Refined Storage 2", + "text.autoconfig.refinedstorage2.option.smoothScrolling": "Smooth scrolling", + "text.autoconfig.refinedstorage2.option.screenSize": "Screen size", + "text.autoconfig.refinedstorage2.option.maxRowsStretch": "Maximum amount of rows when screen size is stretched", "text.autoconfig.refinedstorage2.option.grid": "Grid", "text.autoconfig.refinedstorage2.option.grid.largeFont": "Large font", - "text.autoconfig.refinedstorage2.option.grid.maxRowsStretch": "Maximum amount of rows when stretched", "text.autoconfig.refinedstorage2.option.grid.preventSortingWhileShiftIsDown": "Prevent sorting while SHIFT is down", "text.autoconfig.refinedstorage2.option.grid.detailedTooltip": "Detailed tooltip", "text.autoconfig.refinedstorage2.option.grid.rememberSearchQuery": "Remember search query", "text.autoconfig.refinedstorage2.option.grid.energyUsage": "Energy usage", - "text.autoconfig.refinedstorage2.option.grid.smoothScrolling": "Smooth scrolling", "text.autoconfig.refinedstorage2.option.grid.autoSelected": "Auto selected search box", "text.autoconfig.refinedstorage2.option.grid.synchronizer": "Synchronizer", "text.autoconfig.refinedstorage2.option.grid.resourceTypeId": "Resource type", "text.autoconfig.refinedstorage2.option.grid.sortingDirection": "Sorting direction", "text.autoconfig.refinedstorage2.option.grid.sortingType": "Sorting type", - "text.autoconfig.refinedstorage2.option.grid.size": "Size", "text.autoconfig.refinedstorage2.option.craftingGrid": "Crafting Grid", "text.autoconfig.refinedstorage2.option.craftingGrid.energyUsage": "Energy usage", "text.autoconfig.refinedstorage2.option.craftingGrid.craftingMatrixCloseBehavior": "Crafting matrix close behavior", @@ -327,7 +361,13 @@ "text.autoconfig.refinedstorage2.option.portableGrid.openEnergyUsage": "Open energy usage", "text.autoconfig.refinedstorage2.option.portableGrid.insertEnergyUsage": "Insert energy usage", "text.autoconfig.refinedstorage2.option.portableGrid.extractEnergyUsage": "Extract energy usage", - "advancements.refinedstorage2.root.description": "Use one or multiple Controllers in a network to provide your network with energy", + "text.autoconfig.refinedstorage2.option.securityCard": "Security Card", + "text.autoconfig.refinedstorage2.option.securityCard.energyUsage": "Energy usage", + "text.autoconfig.refinedstorage2.option.fallbackSecurityCard": "Fallback Security Card", + "text.autoconfig.refinedstorage2.option.fallbackSecurityCard.energyUsage": "Energy usage", + "text.autoconfig.refinedstorage2.option.securityManager": "Security Manager", + "text.autoconfig.refinedstorage2.option.securityManager.energyUsage": "Energy usage", + "advancements.refinedstorage2.root.description": "Use one or multiple Controllers in a storage network to provide your network with energy", "advancements.refinedstorage2.connecting": "Connecting", "advancements.refinedstorage2.connecting.description": "Use Cable to connect devices with each other, or place devices against each other", "advancements.refinedstorage2.drives": "Drives", @@ -351,17 +391,19 @@ "advancements.refinedstorage2.storing_externally": "Storing externally", "advancements.refinedstorage2.storing_externally.description": "Use an External Storage to provide the network with storage from an external block like a chest", "advancements.refinedstorage2.detecting": "Detecting", - "advancements.refinedstorage2.detecting.description": "Use redstone to check resources stored in the network", + "advancements.refinedstorage2.detecting.description": "Use redstone to check resources stored in the storage network", "advancements.refinedstorage2.construction": "Construction", "advancements.refinedstorage2.construction.description": "Get blocks from the storage network into the world with a Constructor", "advancements.refinedstorage2.destruction": "Destruction", "advancements.refinedstorage2.destruction.description": "Get blocks from in the world into the storage network with a Destructor", "advancements.refinedstorage2.wireless": "Wireless", - "advancements.refinedstorage2.wireless.description": "Access your resources wirelessly with a Wireless Grid.", + "advancements.refinedstorage2.wireless.description": "Access your resources wirelessly with a Wireless Grid", "advancements.refinedstorage2.better_than_a_barrel": "Better than a barrel", "advancements.refinedstorage2.better_than_a_barrel.description": "Craft a Storage Monitor to view, insert or extract resources in a storage network", "advancements.refinedstorage2.no_cables_required": "No cables required", - "advancements.refinedstorage2.no_cables_required.description": "Add extra components to your network without using cables by using a Network Transmitter, Network Receiver and Network Card", + "advancements.refinedstorage2.no_cables_required.description": "Add extra components to your storage network without using cables by using a Network Transmitter, Network Receiver and Network Card", "advancements.refinedstorage2.portable_storage": "Portable storage", - "advancements.refinedstorage2.portable_storage.description": "Craft a Portable Grid to access the content of disks without requiring a storage network" + "advancements.refinedstorage2.portable_storage.description": "Craft a Portable Grid to access the content of disks without requiring a storage network", + "advancements.refinedstorage2.security": "Security", + "advancements.refinedstorage2.security.description": "Secure your storage network with a Security Manager and a Security Card" } From 241b7ab841bcadb2499286615e46c70f4fe20db5 Mon Sep 17 00:00:00 2001 From: Raoul Date: Thu, 4 Apr 2024 18:50:23 +0200 Subject: [PATCH 06/26] chore: update translation Portuguese, Brazilian from crowdin --- .../assets/refinedstorage2/lang/pt_br.json | 76 ++++++++++++++----- 1 file changed, 59 insertions(+), 17 deletions(-) diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/pt_br.json b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/pt_br.json index f62422275..310eb110a 100644 --- a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/pt_br.json +++ b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/pt_br.json @@ -1,5 +1,5 @@ { - "itemGroup.refinedstorage2.general": "Refined Storage 2", + "mod.refinedstorage2": "Refined Storage 2", "block.refinedstorage2.cable": "Cabo", "block.refinedstorage2.quartz_enriched_iron_block": "Bloco de ferro com quartzo infundido", "block.refinedstorage2.disk_drive": "Disco rígido", @@ -32,6 +32,8 @@ "block.refinedstorage2.network_transmitter": "Transmissor de Rede", "block.refinedstorage2.portable_grid": "Grade Portátil", "block.refinedstorage2.creative_portable_grid": "Grade Portátil Criativa", + "block.refinedstorage2.security_manager": "Security Manager", + "block.refinedstorage2.security_manager.help": "When this device is active, will protect the network by default and block all operations. Start adding Security Cards to permit or deny specific operations for a player.", "gui.refinedstorage2.controller.redstone_mode_help": "Quando este dispositivo estiver inativo, a rede de armazenamento não poderá usar este dispositivo como fonte de energia.", "gui.refinedstorage2.disk_drive.disks": "Discos", "gui.refinedstorage2.storage.redstone_mode_help": "Quando este dispositivo estiver inativo, o armazenamento contido não estará mais acessível a partir da rede de armazenamento.", @@ -47,12 +49,6 @@ "gui.refinedstorage2.grid.sorting.type.name": "Name", "gui.refinedstorage2.grid.sorting.type.id": "ID", "gui.refinedstorage2.grid.sorting.type.last_modified": "Last modified", - "gui.refinedstorage2.grid.size": "Size", - "gui.refinedstorage2.grid.size.stretch": "Stretch", - "gui.refinedstorage2.grid.size.small": "Small", - "gui.refinedstorage2.grid.size.medium": "Medium", - "gui.refinedstorage2.grid.size.large": "Large", - "gui.refinedstorage2.grid.size.extra_large": "Extra large", "gui.refinedstorage2.grid.auto_selected": "Auto-selected", "gui.refinedstorage2.grid.auto_selected.help": "Whether to auto-select the search box when opening the Grid.", "gui.refinedstorage2.grid.synchronizer": "Synchronization mode", @@ -65,12 +61,18 @@ "gui.refinedstorage2.grid.synchronizer.rei": "REI", "gui.refinedstorage2.grid.synchronizer.rei.help": "Sync the search box text to the REI filter.", "gui.refinedstorage2.grid.synchronizer.rei.two_way": "REI two-way", - "gui.refinedstorage2.grid.synchronizer.rei.two_way.help": "Sync the search box text to the JEI filter, and the JEI filter to the search box text.", + "gui.refinedstorage2.grid.synchronizer.rei.two_way.help": "Sync the search box text to the REI filter, and the REI filter to the search box text.", "gui.refinedstorage2.grid.resource_type": "Resource type", "gui.refinedstorage2.grid.resource_type.all": "All", "gui.refinedstorage2.grid.resource_type.help": "Filter specific resource types.", "gui.refinedstorage2.crafting_grid.move.network": "Move items to network", "gui.refinedstorage2.crafting_grid.move.inventory": "Move items to inventory", + "gui.refinedstorage2.screen_size": "Screen size", + "gui.refinedstorage2.screen_size.stretch": "Stretch", + "gui.refinedstorage2.screen_size.small": "Small", + "gui.refinedstorage2.screen_size.medium": "Medium", + "gui.refinedstorage2.screen_size.large": "Large", + "gui.refinedstorage2.screen_size.extra_large": "Extra large", "gui.refinedstorage2.detector.mode": "Mode", "gui.refinedstorage2.detector.mode.under": "Emit redstone signal when under the amount", "gui.refinedstorage2.detector.mode.equal": "Emit redstone signal when on the amount", @@ -142,6 +144,11 @@ "gui.refinedstorage2.network_transmitter.status.missing_network_card": "Missing Network Card", "gui.refinedstorage2.network_transmitter.status.transmitting": "%d block(s)", "gui.refinedstorage2.network_transmitter.status.receiver_unreachable": "Unreachable", + "gui.refinedstorage2.security_card.permission.reset": "Reset", + "gui.refinedstorage2.security_card.permission.modified": "Modified", + "gui.refinedstorage2.security_manager.redstone_mode_help": "When this device is inactive, the network will not be protected.", + "gui.refinedstorage2.security_manager.fallback_security_card_slot_hint": "Slot for a Fallback Security Card.", + "gui.refinedstorage2.security_manager.no_fallback_security_card_consequence": "Add a Fallback Security Card to this slot to set permissions for every player without a Security Card. By default, all actions are denied.", "item.refinedstorage2.controller.help": "Provides the storage network with energy. Multiple are allowed in a single storage network.", "item.refinedstorage2.creative_controller.help": "Provides the storage network with an infinite source of energy.", "item.refinedstorage2.disk_drive.help": "Accepts storage disks to provide the storage network with storage space.", @@ -219,6 +226,14 @@ "item.refinedstorage2.network_card.unbound": "Unbound.", "item.refinedstorage2.network_card.bound_help": "Insert into a Network Transmitter. Use while crouching to clear binding.", "item.refinedstorage2.network_card.bound": "Bound to %d, %d, %d in %s.", + "item.refinedstorage2.security_card": "Security Card", + "item.refinedstorage2.security_card.cleared_configuration": "Cleared configuration.", + "item.refinedstorage2.security_card.unbound": "Unbound.", + "item.refinedstorage2.security_card.unbound.help": "Right click to configure and bind to the current player.", + "item.refinedstorage2.security_card.bound": "Bound to %s.", + "item.refinedstorage2.security_card.bound.help": "Right click to configure. Use while crouching to clear configuration and binding.", + "item.refinedstorage2.fallback_security_card": "Fallback Security Card", + "item.refinedstorage2.fallback_security_card.help": "Acts as a fallback if no matching Security Card for a player is found. Right click to configure. Use while crouching to clear configuration.", "misc.refinedstorage2.stored": "Stored: %s", "misc.refinedstorage2.stored_with_capacity": "Stored: %s / %s (%d%%)", "misc.refinedstorage2.total": "%d total", @@ -238,29 +253,48 @@ "misc.refinedstorage2.resource_type.item": "Item", "misc.refinedstorage2.resource_type.fluid": "Fluid", "misc.refinedstorage2.press_shift_for_help": "Press SHIFT for help", + "misc.refinedstorage2.no_permission": "No permission", + "misc.refinedstorage2.no_permission.open": "You are not allowed to open the %s.", + "misc.refinedstorage2.no_permission.insert": "You are not allowed to insert.", + "misc.refinedstorage2.no_permission.extract": "You are not allowed to extract.", + "misc.refinedstorage2.no_permission.build.place": "You are not allowed to place a %s here.", + "misc.refinedstorage2.no_permission.build.break": "You are not allowed to break the %s.", + "misc.refinedstorage2.no_permission.build.rotate": "You are not allowed to rotate the %s.", + "misc.refinedstorage2.no_permission.build.dismantle": "You are not allowed to dismantle the %s.", "key.refinedstorage2.focus_search_bar": "Focus search bar", "key.refinedstorage2.clear_crafting_grid_matrix_to_network": "Clear Crafting Grid matrix to network", "key.refinedstorage2.clear_crafting_grid_matrix_to_inventory": "Clear Crafting Grid matrix to inventory", "key.refinedstorage2.open_wireless_grid": "Open Wireless Grid", "refinedstorage2.subtitle.wrench": "Wrench used", - "category.refinedstorage2.key_bindings": "Refined Storage 2", "curios.identifier.refinedstorage2": "Refined Storage 2", "trinkets.slot.refinedstorage2.wireless": "Refined Storage 2", + "permission.refinedstorage2.insert": "Insert", + "permission.refinedstorage2.insert.description": "Whether the player can insert resources in a network.", + "permission.refinedstorage2.extract": "Extract", + "permission.refinedstorage2.extract.description": "Whether the player can extract resources from a network.", + "permission.refinedstorage2.autocrafting": "Autocrafting", + "permission.refinedstorage2.autocrafting.description": "Whether the player can start, cancel or view an autocrafting task.", + "permission.refinedstorage2.open": "Open", + "permission.refinedstorage2.open.description": "Whether the player can open network device GUIs.", + "permission.refinedstorage2.build": "Build", + "permission.refinedstorage2.build.description": "Whether the player can add or remove network devices.", + "permission.refinedstorage2.security": "Security", + "permission.refinedstorage2.security.description": "Whether the player can manage the security options for a network.", "text.autoconfig.refinedstorage2.title": "Refined Storage 2", + "text.autoconfig.refinedstorage2.option.smoothScrolling": "Smooth scrolling", + "text.autoconfig.refinedstorage2.option.screenSize": "Screen size", + "text.autoconfig.refinedstorage2.option.maxRowsStretch": "Maximum amount of rows when screen size is stretched", "text.autoconfig.refinedstorage2.option.grid": "Grid", "text.autoconfig.refinedstorage2.option.grid.largeFont": "Large font", - "text.autoconfig.refinedstorage2.option.grid.maxRowsStretch": "Maximum amount of rows when stretched", "text.autoconfig.refinedstorage2.option.grid.preventSortingWhileShiftIsDown": "Prevent sorting while SHIFT is down", "text.autoconfig.refinedstorage2.option.grid.detailedTooltip": "Detailed tooltip", "text.autoconfig.refinedstorage2.option.grid.rememberSearchQuery": "Remember search query", "text.autoconfig.refinedstorage2.option.grid.energyUsage": "Energy usage", - "text.autoconfig.refinedstorage2.option.grid.smoothScrolling": "Smooth scrolling", "text.autoconfig.refinedstorage2.option.grid.autoSelected": "Auto selected search box", "text.autoconfig.refinedstorage2.option.grid.synchronizer": "Synchronizer", "text.autoconfig.refinedstorage2.option.grid.resourceTypeId": "Resource type", "text.autoconfig.refinedstorage2.option.grid.sortingDirection": "Sorting direction", "text.autoconfig.refinedstorage2.option.grid.sortingType": "Sorting type", - "text.autoconfig.refinedstorage2.option.grid.size": "Size", "text.autoconfig.refinedstorage2.option.craftingGrid": "Crafting Grid", "text.autoconfig.refinedstorage2.option.craftingGrid.energyUsage": "Energy usage", "text.autoconfig.refinedstorage2.option.craftingGrid.craftingMatrixCloseBehavior": "Crafting matrix close behavior", @@ -327,7 +361,13 @@ "text.autoconfig.refinedstorage2.option.portableGrid.openEnergyUsage": "Open energy usage", "text.autoconfig.refinedstorage2.option.portableGrid.insertEnergyUsage": "Insert energy usage", "text.autoconfig.refinedstorage2.option.portableGrid.extractEnergyUsage": "Extract energy usage", - "advancements.refinedstorage2.root.description": "Use one or multiple Controllers in a network to provide your network with energy", + "text.autoconfig.refinedstorage2.option.securityCard": "Security Card", + "text.autoconfig.refinedstorage2.option.securityCard.energyUsage": "Energy usage", + "text.autoconfig.refinedstorage2.option.fallbackSecurityCard": "Fallback Security Card", + "text.autoconfig.refinedstorage2.option.fallbackSecurityCard.energyUsage": "Energy usage", + "text.autoconfig.refinedstorage2.option.securityManager": "Security Manager", + "text.autoconfig.refinedstorage2.option.securityManager.energyUsage": "Energy usage", + "advancements.refinedstorage2.root.description": "Use one or multiple Controllers in a storage network to provide your network with energy", "advancements.refinedstorage2.connecting": "Connecting", "advancements.refinedstorage2.connecting.description": "Use Cable to connect devices with each other, or place devices against each other", "advancements.refinedstorage2.drives": "Drives", @@ -351,17 +391,19 @@ "advancements.refinedstorage2.storing_externally": "Storing externally", "advancements.refinedstorage2.storing_externally.description": "Use an External Storage to provide the network with storage from an external block like a chest", "advancements.refinedstorage2.detecting": "Detecting", - "advancements.refinedstorage2.detecting.description": "Use redstone to check resources stored in the network", + "advancements.refinedstorage2.detecting.description": "Use redstone to check resources stored in the storage network", "advancements.refinedstorage2.construction": "Construction", "advancements.refinedstorage2.construction.description": "Get blocks from the storage network into the world with a Constructor", "advancements.refinedstorage2.destruction": "Destruction", "advancements.refinedstorage2.destruction.description": "Get blocks from in the world into the storage network with a Destructor", "advancements.refinedstorage2.wireless": "Wireless", - "advancements.refinedstorage2.wireless.description": "Access your resources wirelessly with a Wireless Grid.", + "advancements.refinedstorage2.wireless.description": "Access your resources wirelessly with a Wireless Grid", "advancements.refinedstorage2.better_than_a_barrel": "Better than a barrel", "advancements.refinedstorage2.better_than_a_barrel.description": "Craft a Storage Monitor to view, insert or extract resources in a storage network", "advancements.refinedstorage2.no_cables_required": "No cables required", - "advancements.refinedstorage2.no_cables_required.description": "Add extra components to your network without using cables by using a Network Transmitter, Network Receiver and Network Card", + "advancements.refinedstorage2.no_cables_required.description": "Add extra components to your storage network without using cables by using a Network Transmitter, Network Receiver and Network Card", "advancements.refinedstorage2.portable_storage": "Portable storage", - "advancements.refinedstorage2.portable_storage.description": "Craft a Portable Grid to access the content of disks without requiring a storage network" + "advancements.refinedstorage2.portable_storage.description": "Craft a Portable Grid to access the content of disks without requiring a storage network", + "advancements.refinedstorage2.security": "Security", + "advancements.refinedstorage2.security.description": "Secure your storage network with a Security Manager and a Security Card" } From 41941412e63c85d8bafa62a8e2c7fc7a8e47c94e Mon Sep 17 00:00:00 2001 From: Raoul Date: Thu, 4 Apr 2024 18:50:24 +0200 Subject: [PATCH 07/26] chore: update translation Indonesian from crowdin --- .../assets/refinedstorage2/lang/id_id.json | 76 ++++++++++++++----- 1 file changed, 59 insertions(+), 17 deletions(-) diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/id_id.json b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/id_id.json index 7259a10a3..4a58a7d61 100644 --- a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/id_id.json +++ b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/id_id.json @@ -1,5 +1,5 @@ { - "itemGroup.refinedstorage2.general": "Refined Storage 2", + "mod.refinedstorage2": "Refined Storage 2", "block.refinedstorage2.cable": "Kabel", "block.refinedstorage2.quartz_enriched_iron_block": "Balok Besi yang Diperkaya Kuarsa", "block.refinedstorage2.disk_drive": "Lemari Cakram", @@ -32,6 +32,8 @@ "block.refinedstorage2.network_transmitter": "Pemancar Jaringan", "block.refinedstorage2.portable_grid": "Kisi Portabel", "block.refinedstorage2.creative_portable_grid": "Kisi Portabel Kreatif", + "block.refinedstorage2.security_manager": "Security Manager", + "block.refinedstorage2.security_manager.help": "When this device is active, will protect the network by default and block all operations. Start adding Security Cards to permit or deny specific operations for a player.", "gui.refinedstorage2.controller.redstone_mode_help": "Ketika peranagkat ini nonaktif, jaringan penyimpanan tidak dapat menggunakan perangkat ini sebagai sumber energi.", "gui.refinedstorage2.disk_drive.disks": "Cakram", "gui.refinedstorage2.storage.redstone_mode_help": "Ketika perangkat ini nonaktif, penyimpanan tidak akan dapat diakses dari dalam jaringan penyimpanan.", @@ -47,12 +49,6 @@ "gui.refinedstorage2.grid.sorting.type.name": "Nama", "gui.refinedstorage2.grid.sorting.type.id": "ID", "gui.refinedstorage2.grid.sorting.type.last_modified": "Terakhir dirubah", - "gui.refinedstorage2.grid.size": "Ukuran", - "gui.refinedstorage2.grid.size.stretch": "Regang", - "gui.refinedstorage2.grid.size.small": "Kecil", - "gui.refinedstorage2.grid.size.medium": "Sedang", - "gui.refinedstorage2.grid.size.large": "Besar", - "gui.refinedstorage2.grid.size.extra_large": "Ekstra Besar", "gui.refinedstorage2.grid.auto_selected": "Pilih otomatis", "gui.refinedstorage2.grid.auto_selected.help": "Memilih kotak pencarian secara otomatis saat membuka Kisi.", "gui.refinedstorage2.grid.synchronizer": "Mode sinkronisasi", @@ -65,12 +61,18 @@ "gui.refinedstorage2.grid.synchronizer.rei": "REI", "gui.refinedstorage2.grid.synchronizer.rei.help": "Sinkronkan teks kotak pencarian ke filter REI.", "gui.refinedstorage2.grid.synchronizer.rei.two_way": "REI dua arah", - "gui.refinedstorage2.grid.synchronizer.rei.two_way.help": "Sinkronkan teks kotak pencarian ke filter JEI, dan filter JEI ke teks kotak pencarian.", + "gui.refinedstorage2.grid.synchronizer.rei.two_way.help": "Sync the search box text to the REI filter, and the REI filter to the search box text.", "gui.refinedstorage2.grid.resource_type": "Jenis sumber daya", "gui.refinedstorage2.grid.resource_type.all": "Semua", "gui.refinedstorage2.grid.resource_type.help": "Filter jenis sumber daya tertentu.", "gui.refinedstorage2.crafting_grid.move.network": "Pindahkan barang ke jaringan", "gui.refinedstorage2.crafting_grid.move.inventory": "Pindahkan barang ke inventaris", + "gui.refinedstorage2.screen_size": "Screen size", + "gui.refinedstorage2.screen_size.stretch": "Stretch", + "gui.refinedstorage2.screen_size.small": "Small", + "gui.refinedstorage2.screen_size.medium": "Medium", + "gui.refinedstorage2.screen_size.large": "Large", + "gui.refinedstorage2.screen_size.extra_large": "Extra large", "gui.refinedstorage2.detector.mode": "Mode", "gui.refinedstorage2.detector.mode.under": "Pancarkan sinyal redstone saat berada di bawah jumlah yang ditentukan", "gui.refinedstorage2.detector.mode.equal": "Pancarkan sinyal redstone saat berada pada jumlah yang ditentukan", @@ -142,6 +144,11 @@ "gui.refinedstorage2.network_transmitter.status.missing_network_card": "Kartu Jaringan Tidak Ditemukan", "gui.refinedstorage2.network_transmitter.status.transmitting": "%d blok", "gui.refinedstorage2.network_transmitter.status.receiver_unreachable": "Tidak dapat diraih", + "gui.refinedstorage2.security_card.permission.reset": "Reset", + "gui.refinedstorage2.security_card.permission.modified": "Modified", + "gui.refinedstorage2.security_manager.redstone_mode_help": "When this device is inactive, the network will not be protected.", + "gui.refinedstorage2.security_manager.fallback_security_card_slot_hint": "Slot for a Fallback Security Card.", + "gui.refinedstorage2.security_manager.no_fallback_security_card_consequence": "Add a Fallback Security Card to this slot to set permissions for every player without a Security Card. By default, all actions are denied.", "item.refinedstorage2.controller.help": "Menyediakan energi ke jaringan penyimpanan. dapat digunakan beberapa kali dalam satu jaringan penyimpanan.", "item.refinedstorage2.creative_controller.help": "Menyediakan energi tidak terbatas ke jaringan penyimpanan.", "item.refinedstorage2.disk_drive.help": "Menerima cakram penyimpanan untuk menyediakan ruang penyimpanan kedalam jaringan penyimpanan.", @@ -219,6 +226,14 @@ "item.refinedstorage2.network_card.unbound": "Tidak terikat.", "item.refinedstorage2.network_card.bound_help": "Masukkan ke Pemancar Jaringan. Gunakan sambil berjongkok untuk membersihkan ikatan.", "item.refinedstorage2.network_card.bound": "Terikat pada %d, %d, %d dalam %s.", + "item.refinedstorage2.security_card": "Security Card", + "item.refinedstorage2.security_card.cleared_configuration": "Cleared configuration.", + "item.refinedstorage2.security_card.unbound": "Unbound.", + "item.refinedstorage2.security_card.unbound.help": "Right click to configure and bind to the current player.", + "item.refinedstorage2.security_card.bound": "Bound to %s.", + "item.refinedstorage2.security_card.bound.help": "Right click to configure. Use while crouching to clear configuration and binding.", + "item.refinedstorage2.fallback_security_card": "Fallback Security Card", + "item.refinedstorage2.fallback_security_card.help": "Acts as a fallback if no matching Security Card for a player is found. Right click to configure. Use while crouching to clear configuration.", "misc.refinedstorage2.stored": "Tersimpan: %s", "misc.refinedstorage2.stored_with_capacity": "Tersimpan: %s / %s (%d%%)", "misc.refinedstorage2.total": "Total %d", @@ -238,29 +253,48 @@ "misc.refinedstorage2.resource_type.item": "Barang", "misc.refinedstorage2.resource_type.fluid": "Cairan", "misc.refinedstorage2.press_shift_for_help": "Tekan SHIFT untuk bantuan", + "misc.refinedstorage2.no_permission": "No permission", + "misc.refinedstorage2.no_permission.open": "You are not allowed to open the %s.", + "misc.refinedstorage2.no_permission.insert": "You are not allowed to insert.", + "misc.refinedstorage2.no_permission.extract": "You are not allowed to extract.", + "misc.refinedstorage2.no_permission.build.place": "You are not allowed to place a %s here.", + "misc.refinedstorage2.no_permission.build.break": "You are not allowed to break the %s.", + "misc.refinedstorage2.no_permission.build.rotate": "You are not allowed to rotate the %s.", + "misc.refinedstorage2.no_permission.build.dismantle": "You are not allowed to dismantle the %s.", "key.refinedstorage2.focus_search_bar": "Fokus pada kotak pencarian", "key.refinedstorage2.clear_crafting_grid_matrix_to_network": "Singkirkan matriks Kisi Kerajinan ke jaringan", "key.refinedstorage2.clear_crafting_grid_matrix_to_inventory": "Singkirkan matriks Kisi Kerajinan ke inventaris", "key.refinedstorage2.open_wireless_grid": "Buka Kisi Nirkabel", "refinedstorage2.subtitle.wrench": "Kunci inggris digunakan", - "category.refinedstorage2.key_bindings": "Refined Storage 2", "curios.identifier.refinedstorage2": "Refined Storage 2", "trinkets.slot.refinedstorage2.wireless": "Refined Storage 2", + "permission.refinedstorage2.insert": "Insert", + "permission.refinedstorage2.insert.description": "Whether the player can insert resources in a network.", + "permission.refinedstorage2.extract": "Extract", + "permission.refinedstorage2.extract.description": "Whether the player can extract resources from a network.", + "permission.refinedstorage2.autocrafting": "Autocrafting", + "permission.refinedstorage2.autocrafting.description": "Whether the player can start, cancel or view an autocrafting task.", + "permission.refinedstorage2.open": "Open", + "permission.refinedstorage2.open.description": "Whether the player can open network device GUIs.", + "permission.refinedstorage2.build": "Build", + "permission.refinedstorage2.build.description": "Whether the player can add or remove network devices.", + "permission.refinedstorage2.security": "Security", + "permission.refinedstorage2.security.description": "Whether the player can manage the security options for a network.", "text.autoconfig.refinedstorage2.title": "Refined Storage 2", + "text.autoconfig.refinedstorage2.option.smoothScrolling": "Smooth scrolling", + "text.autoconfig.refinedstorage2.option.screenSize": "Screen size", + "text.autoconfig.refinedstorage2.option.maxRowsStretch": "Maximum amount of rows when screen size is stretched", "text.autoconfig.refinedstorage2.option.grid": "Kisi", "text.autoconfig.refinedstorage2.option.grid.largeFont": "Font besar", - "text.autoconfig.refinedstorage2.option.grid.maxRowsStretch": "Baris maksimum saat diregangkan", "text.autoconfig.refinedstorage2.option.grid.preventSortingWhileShiftIsDown": "Mencegah pengurutan ketika SHIFT ditekan", "text.autoconfig.refinedstorage2.option.grid.detailedTooltip": "Detail teks keterangan", "text.autoconfig.refinedstorage2.option.grid.rememberSearchQuery": "Ingat permintaan pencarian", "text.autoconfig.refinedstorage2.option.grid.energyUsage": "Pemakaian daya", - "text.autoconfig.refinedstorage2.option.grid.smoothScrolling": "Pengguliran mulus", "text.autoconfig.refinedstorage2.option.grid.autoSelected": "Memilih otomatis kotak pencarian", "text.autoconfig.refinedstorage2.option.grid.synchronizer": "Sinkronisasi", "text.autoconfig.refinedstorage2.option.grid.resourceTypeId": "Jenis sumber daya", "text.autoconfig.refinedstorage2.option.grid.sortingDirection": "Arah Pengurutan", "text.autoconfig.refinedstorage2.option.grid.sortingType": "Jenis pengurutan", - "text.autoconfig.refinedstorage2.option.grid.size": "Ukuran", "text.autoconfig.refinedstorage2.option.craftingGrid": "Kisi Kerajinan", "text.autoconfig.refinedstorage2.option.craftingGrid.energyUsage": "Pemakaian daya", "text.autoconfig.refinedstorage2.option.craftingGrid.craftingMatrixCloseBehavior": "Perilaku menutup Matriks kerajinan", @@ -327,7 +361,13 @@ "text.autoconfig.refinedstorage2.option.portableGrid.openEnergyUsage": "Buka pemakaian daya", "text.autoconfig.refinedstorage2.option.portableGrid.insertEnergyUsage": "Masukkan pemakaian daya", "text.autoconfig.refinedstorage2.option.portableGrid.extractEnergyUsage": "Ekstrak pemakaian daya", - "advancements.refinedstorage2.root.description": "Gunakan satu atau beberapa Pengendali dalam jaringan untuk menyediakan energi kedalam jaringan anda", + "text.autoconfig.refinedstorage2.option.securityCard": "Security Card", + "text.autoconfig.refinedstorage2.option.securityCard.energyUsage": "Energy usage", + "text.autoconfig.refinedstorage2.option.fallbackSecurityCard": "Fallback Security Card", + "text.autoconfig.refinedstorage2.option.fallbackSecurityCard.energyUsage": "Energy usage", + "text.autoconfig.refinedstorage2.option.securityManager": "Security Manager", + "text.autoconfig.refinedstorage2.option.securityManager.energyUsage": "Energy usage", + "advancements.refinedstorage2.root.description": "Use one or multiple Controllers in a storage network to provide your network with energy", "advancements.refinedstorage2.connecting": "Menyambungkan", "advancements.refinedstorage2.connecting.description": "Gunakan Kabel untuk menghubungkan perangkat satu sama lain, atau letakkan perangkat melawan satu sama lain", "advancements.refinedstorage2.drives": "Cakram", @@ -351,17 +391,19 @@ "advancements.refinedstorage2.storing_externally": "Menyimpan secara eksternal", "advancements.refinedstorage2.storing_externally.description": "Gunakan Penyimpanan Eksternal untuk menyediakan jaringan dengan penyimpanan dari balok eksternal seperti peti", "advancements.refinedstorage2.detecting": "Mendeteksi", - "advancements.refinedstorage2.detecting.description": "Gunakan redstone untuk memeriksa sumber daya yang tersimpan di jaringan", + "advancements.refinedstorage2.detecting.description": "Use redstone to check resources stored in the storage network", "advancements.refinedstorage2.construction": "Pembangunan", "advancements.refinedstorage2.construction.description": "Tempatkan balok dari jaringan penyimpanan ke dunia menggunakan Pembangun", "advancements.refinedstorage2.destruction": "Penghancuran", "advancements.refinedstorage2.destruction.description": "Peroleh balok dari dunia kedalam jaringan penyimpanan menggunakan Penghancur", "advancements.refinedstorage2.wireless": "Nirkabel", - "advancements.refinedstorage2.wireless.description": "Akses sumber daya anda secara nirkabel menggunakan Kisi Nirkabel.", + "advancements.refinedstorage2.wireless.description": "Access your resources wirelessly with a Wireless Grid", "advancements.refinedstorage2.better_than_a_barrel": "Lebih baik dari tong", "advancements.refinedstorage2.better_than_a_barrel.description": "Rakit Monitor Penyimpanan untuk melihat, memasukkan atau mengekstrak sumber daya dalam jaringan penyimpanan", "advancements.refinedstorage2.no_cables_required": "Tidak memerlukan kabel", - "advancements.refinedstorage2.no_cables_required.description": "Tambahkan komponen tambahan ke jaringan anda tanpa menggunakan kabel dengan menggunakan Pemancar Jaringan, Penerima Jaringan dan Kartu Jaringan", + "advancements.refinedstorage2.no_cables_required.description": "Add extra components to your storage network without using cables by using a Network Transmitter, Network Receiver and Network Card", "advancements.refinedstorage2.portable_storage": "Penyimpanan portabel", - "advancements.refinedstorage2.portable_storage.description": "Rakit Kisi Portabel untuk mengakses isi dari cakram tanpa memerlukan jaringan penyimpanan" + "advancements.refinedstorage2.portable_storage.description": "Rakit Kisi Portabel untuk mengakses isi dari cakram tanpa memerlukan jaringan penyimpanan", + "advancements.refinedstorage2.security": "Security", + "advancements.refinedstorage2.security.description": "Secure your storage network with a Security Manager and a Security Card" } From 3e587c238e15f475774fc6be51881b62a72ed25b Mon Sep 17 00:00:00 2001 From: Raoul Date: Thu, 4 Apr 2024 18:50:24 +0200 Subject: [PATCH 08/26] chore: update translation German from crowdin --- .../assets/refinedstorage2/lang/de_de.json | 76 ++++++++++++++----- 1 file changed, 59 insertions(+), 17 deletions(-) diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/de_de.json b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/de_de.json index 325293e3d..e9aecf7ab 100644 --- a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/de_de.json +++ b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/de_de.json @@ -1,5 +1,5 @@ { - "itemGroup.refinedstorage2.general": "Refined Storage 2", + "mod.refinedstorage2": "Refined Storage 2", "block.refinedstorage2.cable": "Kabel", "block.refinedstorage2.quartz_enriched_iron_block": "Quarz angereichertes Eisenblock", "block.refinedstorage2.disk_drive": "Laufwerk", @@ -32,6 +32,8 @@ "block.refinedstorage2.network_transmitter": "Netzwerksender", "block.refinedstorage2.portable_grid": "Mobile Konsole", "block.refinedstorage2.creative_portable_grid": "Mobile Kreative Konsole", + "block.refinedstorage2.security_manager": "Sicherheits-Manager", + "block.refinedstorage2.security_manager.help": "Während aktivem Betrieb ist das Netzwerk geschützt und es werden alle Zugriffe blockiert. Füge Sicherheits-Karten hinzu, um spezifische Zugriffe für Spieler zuzulassen.", "gui.refinedstorage2.controller.redstone_mode_help": "Falls dieses Gerät inaktiv ist, kann das Speichernetzwerk dieses Gerät nicht als Energiequelle nutzen.", "gui.refinedstorage2.disk_drive.disks": "Speicherplatten", "gui.refinedstorage2.storage.redstone_mode_help": "Falls dieses Gerät inaktiv ist, ist der enthaltene Speicher nicht mehr über das Speichernetzwerk zugänglich.", @@ -47,12 +49,6 @@ "gui.refinedstorage2.grid.sorting.type.name": "Name", "gui.refinedstorage2.grid.sorting.type.id": "ID", "gui.refinedstorage2.grid.sorting.type.last_modified": "Zuletzt geändert", - "gui.refinedstorage2.grid.size": "Größe", - "gui.refinedstorage2.grid.size.stretch": "Strecken", - "gui.refinedstorage2.grid.size.small": "Klein", - "gui.refinedstorage2.grid.size.medium": "Mittel", - "gui.refinedstorage2.grid.size.large": "Groß", - "gui.refinedstorage2.grid.size.extra_large": "Extra groß", "gui.refinedstorage2.grid.auto_selected": "Automatisch ausgewählt", "gui.refinedstorage2.grid.auto_selected.help": "Gibt an, ob das Suchfeld beim Öffnen der Konsole automatisch ausgewählt werden soll.", "gui.refinedstorage2.grid.synchronizer": "Synchronisierungsmodus", @@ -65,12 +61,18 @@ "gui.refinedstorage2.grid.synchronizer.rei": "REI", "gui.refinedstorage2.grid.synchronizer.rei.help": "Synchronisieren Sie das Suchfeld Text mit dem REI Filter.", "gui.refinedstorage2.grid.synchronizer.rei.two_way": "REI beidseitig", - "gui.refinedstorage2.grid.synchronizer.rei.two_way.help": "Synchronisieren Sie das Suchfeld Text mit dem JEI Filter und den JEI Filter mit dem Suchfeld Text.", + "gui.refinedstorage2.grid.synchronizer.rei.two_way.help": "Synchronisieren Sie das Suchfeld Text mit dem REI Filter und den REI Filter mit dem Suchfeld Text.", "gui.refinedstorage2.grid.resource_type": "Ressourcentyp", "gui.refinedstorage2.grid.resource_type.all": "Alle", "gui.refinedstorage2.grid.resource_type.help": "Spezifische Ressourcentypen filtern.", "gui.refinedstorage2.crafting_grid.move.network": "Items ins Netzwerk verschieben", "gui.refinedstorage2.crafting_grid.move.inventory": "Items ins Inventar verschieben", + "gui.refinedstorage2.screen_size": "Bildschirmgröße", + "gui.refinedstorage2.screen_size.stretch": "Strecken", + "gui.refinedstorage2.screen_size.small": "Klein", + "gui.refinedstorage2.screen_size.medium": "Normal", + "gui.refinedstorage2.screen_size.large": "Groß", + "gui.refinedstorage2.screen_size.extra_large": "Sehr groß", "gui.refinedstorage2.detector.mode": "Modus", "gui.refinedstorage2.detector.mode.under": "Redstone-Signal ausgeben, falls unter der Menge", "gui.refinedstorage2.detector.mode.equal": "Redstone-Signal ausgeben, falls auf der Menge", @@ -142,6 +144,11 @@ "gui.refinedstorage2.network_transmitter.status.missing_network_card": "Fehlende Netzwerkkarte", "gui.refinedstorage2.network_transmitter.status.transmitting": "%d Block(s)", "gui.refinedstorage2.network_transmitter.status.receiver_unreachable": "Unerreichbar", + "gui.refinedstorage2.security_card.permission.reset": "Zurücksetzen", + "gui.refinedstorage2.security_card.permission.modified": "Modifiziert", + "gui.refinedstorage2.security_manager.redstone_mode_help": "Wenn dieses Gerät inaktiv ist, wird das Netzwerk nicht geschützt.", + "gui.refinedstorage2.security_manager.fallback_security_card_slot_hint": "Slot für eine Standard-Sicherheitskarte.", + "gui.refinedstorage2.security_manager.no_fallback_security_card_consequence": "Fügen Sie diesem Slot eine Standard-Sicherheitskarte hinzu, um Berechtigungen für jeden Spieler ohne Sicherheitskarte festzulegen. Standardmäßig werden alle Aktionen verweigert.", "item.refinedstorage2.controller.help": "Stellt das Speichernetzwerk mit Energie zur Verfügung. Mehrere sind in einem einzigen Speichernetzwerk erlaubt.", "item.refinedstorage2.creative_controller.help": "Stellt dem Speichernetzwerk eine unendliche Energiequelle zur Verfügung.", "item.refinedstorage2.disk_drive.help": "Akzeptiert Speicherplatten, um dem Speichernetz Speicherplatz zur Verfügung zu stellen.", @@ -219,6 +226,14 @@ "item.refinedstorage2.network_card.unbound": "Ungebunden.", "item.refinedstorage2.network_card.bound_help": "Einfügen in einen Netzwerksender. Benutzen beim Schleichen um die Verbindung zu löschen.", "item.refinedstorage2.network_card.bound": "Verbunden zu %d, %d, %d in %s.", + "item.refinedstorage2.security_card": "Sicherheitskarte", + "item.refinedstorage2.security_card.cleared_configuration": "Konfiguration gelöscht.", + "item.refinedstorage2.security_card.unbound": "Nicht zugewiesen.", + "item.refinedstorage2.security_card.unbound.help": "Rechtsklick zum Konfigurieren und Zuweisen an den aktuellen Spieler.", + "item.refinedstorage2.security_card.bound": "Zugewiesen an %s.", + "item.refinedstorage2.security_card.bound.help": "Rechtsklick zum Konfigurieren. Benutze während Schleichen, um die Konfiguration und Zuweisung zu löschen.", + "item.refinedstorage2.fallback_security_card": "Standard-Sicherheitskarte", + "item.refinedstorage2.fallback_security_card.help": "Funktioniert als Standard, wenn keine passende Sicherheitskarte für einen Spieler gefunden wurde. Rechtsklick zum Konfigurieren. Benutze während Schleichen, um die Konfiguration zu löschen.", "misc.refinedstorage2.stored": "Gespeichert: %s", "misc.refinedstorage2.stored_with_capacity": "Gespeichert: %s / %s (%d%%)", "misc.refinedstorage2.total": "%d Gesamt", @@ -238,29 +253,48 @@ "misc.refinedstorage2.resource_type.item": "Item", "misc.refinedstorage2.resource_type.fluid": "Flüssigkeit", "misc.refinedstorage2.press_shift_for_help": "Drücke SHIFT für Hilfe", + "misc.refinedstorage2.no_permission": "Kein Zugriff", + "misc.refinedstorage2.no_permission.open": "Sie sind nicht berechtigt, die %s zu öffnen.", + "misc.refinedstorage2.no_permission.insert": "Sie haben keine Berechtigung zum Einfügen.", + "misc.refinedstorage2.no_permission.extract": "Sie haben keine Berechtigung zum Extrahieren.", + "misc.refinedstorage2.no_permission.build.place": "Sie sind nicht berechtigt, hier %s zu platzieren.", + "misc.refinedstorage2.no_permission.build.break": "Du hast keine Berechtigung die %s zu brechen.", + "misc.refinedstorage2.no_permission.build.rotate": "Sie haben keine Berechtigung die %s zu drehen.", + "misc.refinedstorage2.no_permission.build.dismantle": "Sie haben keine Berechtigung die %s abzubauen.", "key.refinedstorage2.focus_search_bar": "Suchleiste Selektieren", "key.refinedstorage2.clear_crafting_grid_matrix_to_network": "Werkbank in der Konsole zum Netzwerk leeren", "key.refinedstorage2.clear_crafting_grid_matrix_to_inventory": "Werkbank in der Konsole zum Inventar leeren", "key.refinedstorage2.open_wireless_grid": "Drahtlose Konsole öffnen", "refinedstorage2.subtitle.wrench": "Schraubenschlüssel benutzt", - "category.refinedstorage2.key_bindings": "Refined Storage 2", "curios.identifier.refinedstorage2": "Refined Storage 2", "trinkets.slot.refinedstorage2.wireless": "Refined Storage 2", + "permission.refinedstorage2.insert": "Einfügen", + "permission.refinedstorage2.insert.description": "Gibt an, ob der Spieler Ressourcen in ein Netzwerk einfügen kann.", + "permission.refinedstorage2.extract": "Extrahieren", + "permission.refinedstorage2.extract.description": "Gibt an, ob der Spieler Ressourcen aus einem Netzwerk extrahieren kann.", + "permission.refinedstorage2.autocrafting": "Automatisches Herstellen", + "permission.refinedstorage2.autocrafting.description": "Ob der Spieler einen Herstellungsauftrag starten, abbrechen oder sehen kann.", + "permission.refinedstorage2.open": "Öffnen", + "permission.refinedstorage2.open.description": "Gibt an, ob der Player GUIs des Netzwerkgeräts öffnen kann.", + "permission.refinedstorage2.build": "Bauen", + "permission.refinedstorage2.build.description": "Gibt an, ob der Player Netzwerkgeräte hinzufügen oder entfernen kann.", + "permission.refinedstorage2.security": "Sicherheit", + "permission.refinedstorage2.security.description": "Whether the player can manage the security options for a network.", "text.autoconfig.refinedstorage2.title": "Refined Storage 2", + "text.autoconfig.refinedstorage2.option.smoothScrolling": "Smooth scrolling", + "text.autoconfig.refinedstorage2.option.screenSize": "Screen size", + "text.autoconfig.refinedstorage2.option.maxRowsStretch": "Maximum amount of rows when screen size is stretched", "text.autoconfig.refinedstorage2.option.grid": "Konsole", "text.autoconfig.refinedstorage2.option.grid.largeFont": "Große Schriftart", - "text.autoconfig.refinedstorage2.option.grid.maxRowsStretch": "Maximale Anzahl von Zeilen wenn gestreckt", "text.autoconfig.refinedstorage2.option.grid.preventSortingWhileShiftIsDown": "Sortierung verhindern während SHIFT gedrückt ist", "text.autoconfig.refinedstorage2.option.grid.detailedTooltip": "Detaillierte Kurzinfo", "text.autoconfig.refinedstorage2.option.grid.rememberSearchQuery": "Suchabfrage merken", "text.autoconfig.refinedstorage2.option.grid.energyUsage": "Energieverbrauch", - "text.autoconfig.refinedstorage2.option.grid.smoothScrolling": "Sanftes Scrollen", "text.autoconfig.refinedstorage2.option.grid.autoSelected": "Autoselektieres Suchfeld", "text.autoconfig.refinedstorage2.option.grid.synchronizer": "Synchronisator", "text.autoconfig.refinedstorage2.option.grid.resourceTypeId": "Ressourcentyp", "text.autoconfig.refinedstorage2.option.grid.sortingDirection": "Sortierrichtung", "text.autoconfig.refinedstorage2.option.grid.sortingType": "Sortierart", - "text.autoconfig.refinedstorage2.option.grid.size": "Größe", "text.autoconfig.refinedstorage2.option.craftingGrid": "Herstellungskonsole", "text.autoconfig.refinedstorage2.option.craftingGrid.energyUsage": "Energieverbrauch", "text.autoconfig.refinedstorage2.option.craftingGrid.craftingMatrixCloseBehavior": "Werkbank Schließverhalten", @@ -327,7 +361,13 @@ "text.autoconfig.refinedstorage2.option.portableGrid.openEnergyUsage": "Energieverbrauch beim Öffnen", "text.autoconfig.refinedstorage2.option.portableGrid.insertEnergyUsage": "Energieverbrauch beim Importieren", "text.autoconfig.refinedstorage2.option.portableGrid.extractEnergyUsage": "Energieverbrauch beim Exportieren", - "advancements.refinedstorage2.root.description": "Verwenden Sie einen oder mehrere Konsolen in einem Netzwerk, um Ihr Netzwerk mit Energie zu versorgen", + "text.autoconfig.refinedstorage2.option.securityCard": "Security Card", + "text.autoconfig.refinedstorage2.option.securityCard.energyUsage": "Energy usage", + "text.autoconfig.refinedstorage2.option.fallbackSecurityCard": "Fallback Security Card", + "text.autoconfig.refinedstorage2.option.fallbackSecurityCard.energyUsage": "Energy usage", + "text.autoconfig.refinedstorage2.option.securityManager": "Security Manager", + "text.autoconfig.refinedstorage2.option.securityManager.energyUsage": "Energy usage", + "advancements.refinedstorage2.root.description": "Use one or multiple Controllers in a storage network to provide your network with energy", "advancements.refinedstorage2.connecting": "Verbinden", "advancements.refinedstorage2.connecting.description": "Benutze Kabel um Geräte miteinander zu verbinden, oder platziere Geräte nebeneinander", "advancements.refinedstorage2.drives": "Festplatten", @@ -351,17 +391,19 @@ "advancements.refinedstorage2.storing_externally": "Extern speichern", "advancements.refinedstorage2.storing_externally.description": "Verwenden Sie einen externen Speicher um dem Netzwerk Speicher von einem externen Block wie einer Truhe zur Verfügung zu stellen", "advancements.refinedstorage2.detecting": "Erkennung", - "advancements.refinedstorage2.detecting.description": "Verwende Redstone um Ressourcen im Netzwerk zu überprüfen", + "advancements.refinedstorage2.detecting.description": "Use redstone to check resources stored in the storage network", "advancements.refinedstorage2.construction": "Konstruktion", "advancements.refinedstorage2.construction.description": "Erhalte Blöcke aus dem Speichernetzwerk in die Welt mit einem Konstruktor", "advancements.refinedstorage2.destruction": "Zerstörung", "advancements.refinedstorage2.destruction.description": "Erhalte Blöcke aus der Welt in das Speichernetzwerk mit einem Destruktor", "advancements.refinedstorage2.wireless": "Drahtlos", - "advancements.refinedstorage2.wireless.description": "Greifen Sie drahtlos auf Ihre Ressourcen mit einer drahtlosen Konsole zu.", + "advancements.refinedstorage2.wireless.description": "Access your resources wirelessly with a Wireless Grid", "advancements.refinedstorage2.better_than_a_barrel": "Besser als ein Fass", "advancements.refinedstorage2.better_than_a_barrel.description": "Stelle einen Speichermonitor her, um Ressourcen in einem Speichernetzwerk anzuzeigen, zu importieren oder zu exportieren", "advancements.refinedstorage2.no_cables_required": "Keine Kabel erforderlich", - "advancements.refinedstorage2.no_cables_required.description": "Fügen Sie Ihrem Netzwerk zusätzliche Komponenten hinzu, ohne Kabel zu verwenden, indem Sie einen Netzwerkübermittler, Netzwerkempfänger und Netzwerkkarte verwenden", + "advancements.refinedstorage2.no_cables_required.description": "Add extra components to your storage network without using cables by using a Network Transmitter, Network Receiver and Network Card", "advancements.refinedstorage2.portable_storage": "Tragbarer Speicher", - "advancements.refinedstorage2.portable_storage.description": "Erstelle eine mobile Konsole um auf den Inhalt von Speicherplatten zuzugreifen, ohne ein Speichernetzwerk zu benötigen" + "advancements.refinedstorage2.portable_storage.description": "Erstelle eine mobile Konsole um auf den Inhalt von Speicherplatten zuzugreifen, ohne ein Speichernetzwerk zu benötigen", + "advancements.refinedstorage2.security": "Security", + "advancements.refinedstorage2.security.description": "Secure your storage network with a Security Manager and a Security Card" } From dbde1399fde517c6084ac256f9212e12295226e4 Mon Sep 17 00:00:00 2001 From: Raoul Date: Thu, 4 Apr 2024 18:50:25 +0200 Subject: [PATCH 09/26] chore: update translation Hungarian from crowdin --- .../assets/refinedstorage2/lang/hu_hu.json | 76 ++++++++++++++----- 1 file changed, 59 insertions(+), 17 deletions(-) diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/hu_hu.json b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/hu_hu.json index 0e58472c8..36f89262b 100644 --- a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/hu_hu.json +++ b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/hu_hu.json @@ -1,5 +1,5 @@ { - "itemGroup.refinedstorage2.general": "Refined Storage 2", + "mod.refinedstorage2": "Refined Storage 2", "block.refinedstorage2.cable": "Cable", "block.refinedstorage2.quartz_enriched_iron_block": "Block of Quartz Enriched Iron", "block.refinedstorage2.disk_drive": "Disk Drive", @@ -32,6 +32,8 @@ "block.refinedstorage2.network_transmitter": "Network Transmitter", "block.refinedstorage2.portable_grid": "Portable Grid", "block.refinedstorage2.creative_portable_grid": "Creative Portable Grid", + "block.refinedstorage2.security_manager": "Security Manager", + "block.refinedstorage2.security_manager.help": "When this device is active, will protect the network by default and block all operations. Start adding Security Cards to permit or deny specific operations for a player.", "gui.refinedstorage2.controller.redstone_mode_help": "When this device is inactive, the storage network will not be able to use this device as an energy source.", "gui.refinedstorage2.disk_drive.disks": "Disks", "gui.refinedstorage2.storage.redstone_mode_help": "When this device is inactive, the contained storage will no longer be accessible from within the storage network.", @@ -47,12 +49,6 @@ "gui.refinedstorage2.grid.sorting.type.name": "Name", "gui.refinedstorage2.grid.sorting.type.id": "ID", "gui.refinedstorage2.grid.sorting.type.last_modified": "Last modified", - "gui.refinedstorage2.grid.size": "Size", - "gui.refinedstorage2.grid.size.stretch": "Stretch", - "gui.refinedstorage2.grid.size.small": "Small", - "gui.refinedstorage2.grid.size.medium": "Medium", - "gui.refinedstorage2.grid.size.large": "Large", - "gui.refinedstorage2.grid.size.extra_large": "Extra large", "gui.refinedstorage2.grid.auto_selected": "Auto-selected", "gui.refinedstorage2.grid.auto_selected.help": "Whether to auto-select the search box when opening the Grid.", "gui.refinedstorage2.grid.synchronizer": "Synchronization mode", @@ -65,12 +61,18 @@ "gui.refinedstorage2.grid.synchronizer.rei": "REI", "gui.refinedstorage2.grid.synchronizer.rei.help": "Sync the search box text to the REI filter.", "gui.refinedstorage2.grid.synchronizer.rei.two_way": "REI two-way", - "gui.refinedstorage2.grid.synchronizer.rei.two_way.help": "Sync the search box text to the JEI filter, and the JEI filter to the search box text.", + "gui.refinedstorage2.grid.synchronizer.rei.two_way.help": "Sync the search box text to the REI filter, and the REI filter to the search box text.", "gui.refinedstorage2.grid.resource_type": "Resource type", "gui.refinedstorage2.grid.resource_type.all": "All", "gui.refinedstorage2.grid.resource_type.help": "Filter specific resource types.", "gui.refinedstorage2.crafting_grid.move.network": "Move items to network", "gui.refinedstorage2.crafting_grid.move.inventory": "Move items to inventory", + "gui.refinedstorage2.screen_size": "Screen size", + "gui.refinedstorage2.screen_size.stretch": "Stretch", + "gui.refinedstorage2.screen_size.small": "Small", + "gui.refinedstorage2.screen_size.medium": "Medium", + "gui.refinedstorage2.screen_size.large": "Large", + "gui.refinedstorage2.screen_size.extra_large": "Extra large", "gui.refinedstorage2.detector.mode": "Mode", "gui.refinedstorage2.detector.mode.under": "Emit redstone signal when under the amount", "gui.refinedstorage2.detector.mode.equal": "Emit redstone signal when on the amount", @@ -142,6 +144,11 @@ "gui.refinedstorage2.network_transmitter.status.missing_network_card": "Missing Network Card", "gui.refinedstorage2.network_transmitter.status.transmitting": "%d block(s)", "gui.refinedstorage2.network_transmitter.status.receiver_unreachable": "Unreachable", + "gui.refinedstorage2.security_card.permission.reset": "Reset", + "gui.refinedstorage2.security_card.permission.modified": "Modified", + "gui.refinedstorage2.security_manager.redstone_mode_help": "When this device is inactive, the network will not be protected.", + "gui.refinedstorage2.security_manager.fallback_security_card_slot_hint": "Slot for a Fallback Security Card.", + "gui.refinedstorage2.security_manager.no_fallback_security_card_consequence": "Add a Fallback Security Card to this slot to set permissions for every player without a Security Card. By default, all actions are denied.", "item.refinedstorage2.controller.help": "Provides the storage network with energy. Multiple are allowed in a single storage network.", "item.refinedstorage2.creative_controller.help": "Provides the storage network with an infinite source of energy.", "item.refinedstorage2.disk_drive.help": "Accepts storage disks to provide the storage network with storage space.", @@ -219,6 +226,14 @@ "item.refinedstorage2.network_card.unbound": "Unbound.", "item.refinedstorage2.network_card.bound_help": "Insert into a Network Transmitter. Use while crouching to clear binding.", "item.refinedstorage2.network_card.bound": "Bound to %d, %d, %d in %s.", + "item.refinedstorage2.security_card": "Security Card", + "item.refinedstorage2.security_card.cleared_configuration": "Cleared configuration.", + "item.refinedstorage2.security_card.unbound": "Unbound.", + "item.refinedstorage2.security_card.unbound.help": "Right click to configure and bind to the current player.", + "item.refinedstorage2.security_card.bound": "Bound to %s.", + "item.refinedstorage2.security_card.bound.help": "Right click to configure. Use while crouching to clear configuration and binding.", + "item.refinedstorage2.fallback_security_card": "Fallback Security Card", + "item.refinedstorage2.fallback_security_card.help": "Acts as a fallback if no matching Security Card for a player is found. Right click to configure. Use while crouching to clear configuration.", "misc.refinedstorage2.stored": "Stored: %s", "misc.refinedstorage2.stored_with_capacity": "Stored: %s / %s (%d%%)", "misc.refinedstorage2.total": "%d total", @@ -238,29 +253,48 @@ "misc.refinedstorage2.resource_type.item": "Item", "misc.refinedstorage2.resource_type.fluid": "Fluid", "misc.refinedstorage2.press_shift_for_help": "Press SHIFT for help", + "misc.refinedstorage2.no_permission": "No permission", + "misc.refinedstorage2.no_permission.open": "You are not allowed to open the %s.", + "misc.refinedstorage2.no_permission.insert": "You are not allowed to insert.", + "misc.refinedstorage2.no_permission.extract": "You are not allowed to extract.", + "misc.refinedstorage2.no_permission.build.place": "You are not allowed to place a %s here.", + "misc.refinedstorage2.no_permission.build.break": "You are not allowed to break the %s.", + "misc.refinedstorage2.no_permission.build.rotate": "You are not allowed to rotate the %s.", + "misc.refinedstorage2.no_permission.build.dismantle": "You are not allowed to dismantle the %s.", "key.refinedstorage2.focus_search_bar": "Focus search bar", "key.refinedstorage2.clear_crafting_grid_matrix_to_network": "Clear Crafting Grid matrix to network", "key.refinedstorage2.clear_crafting_grid_matrix_to_inventory": "Clear Crafting Grid matrix to inventory", "key.refinedstorage2.open_wireless_grid": "Open Wireless Grid", "refinedstorage2.subtitle.wrench": "Wrench used", - "category.refinedstorage2.key_bindings": "Refined Storage 2", "curios.identifier.refinedstorage2": "Refined Storage 2", "trinkets.slot.refinedstorage2.wireless": "Refined Storage 2", + "permission.refinedstorage2.insert": "Insert", + "permission.refinedstorage2.insert.description": "Whether the player can insert resources in a network.", + "permission.refinedstorage2.extract": "Extract", + "permission.refinedstorage2.extract.description": "Whether the player can extract resources from a network.", + "permission.refinedstorage2.autocrafting": "Autocrafting", + "permission.refinedstorage2.autocrafting.description": "Whether the player can start, cancel or view an autocrafting task.", + "permission.refinedstorage2.open": "Open", + "permission.refinedstorage2.open.description": "Whether the player can open network device GUIs.", + "permission.refinedstorage2.build": "Build", + "permission.refinedstorage2.build.description": "Whether the player can add or remove network devices.", + "permission.refinedstorage2.security": "Security", + "permission.refinedstorage2.security.description": "Whether the player can manage the security options for a network.", "text.autoconfig.refinedstorage2.title": "Refined Storage 2", + "text.autoconfig.refinedstorage2.option.smoothScrolling": "Smooth scrolling", + "text.autoconfig.refinedstorage2.option.screenSize": "Screen size", + "text.autoconfig.refinedstorage2.option.maxRowsStretch": "Maximum amount of rows when screen size is stretched", "text.autoconfig.refinedstorage2.option.grid": "Grid", "text.autoconfig.refinedstorage2.option.grid.largeFont": "Large font", - "text.autoconfig.refinedstorage2.option.grid.maxRowsStretch": "Maximum amount of rows when stretched", "text.autoconfig.refinedstorage2.option.grid.preventSortingWhileShiftIsDown": "Prevent sorting while SHIFT is down", "text.autoconfig.refinedstorage2.option.grid.detailedTooltip": "Detailed tooltip", "text.autoconfig.refinedstorage2.option.grid.rememberSearchQuery": "Remember search query", "text.autoconfig.refinedstorage2.option.grid.energyUsage": "Energy usage", - "text.autoconfig.refinedstorage2.option.grid.smoothScrolling": "Smooth scrolling", "text.autoconfig.refinedstorage2.option.grid.autoSelected": "Auto selected search box", "text.autoconfig.refinedstorage2.option.grid.synchronizer": "Synchronizer", "text.autoconfig.refinedstorage2.option.grid.resourceTypeId": "Resource type", "text.autoconfig.refinedstorage2.option.grid.sortingDirection": "Sorting direction", "text.autoconfig.refinedstorage2.option.grid.sortingType": "Sorting type", - "text.autoconfig.refinedstorage2.option.grid.size": "Size", "text.autoconfig.refinedstorage2.option.craftingGrid": "Crafting Grid", "text.autoconfig.refinedstorage2.option.craftingGrid.energyUsage": "Energy usage", "text.autoconfig.refinedstorage2.option.craftingGrid.craftingMatrixCloseBehavior": "Crafting matrix close behavior", @@ -327,7 +361,13 @@ "text.autoconfig.refinedstorage2.option.portableGrid.openEnergyUsage": "Open energy usage", "text.autoconfig.refinedstorage2.option.portableGrid.insertEnergyUsage": "Insert energy usage", "text.autoconfig.refinedstorage2.option.portableGrid.extractEnergyUsage": "Extract energy usage", - "advancements.refinedstorage2.root.description": "Use one or multiple Controllers in a network to provide your network with energy", + "text.autoconfig.refinedstorage2.option.securityCard": "Security Card", + "text.autoconfig.refinedstorage2.option.securityCard.energyUsage": "Energy usage", + "text.autoconfig.refinedstorage2.option.fallbackSecurityCard": "Fallback Security Card", + "text.autoconfig.refinedstorage2.option.fallbackSecurityCard.energyUsage": "Energy usage", + "text.autoconfig.refinedstorage2.option.securityManager": "Security Manager", + "text.autoconfig.refinedstorage2.option.securityManager.energyUsage": "Energy usage", + "advancements.refinedstorage2.root.description": "Use one or multiple Controllers in a storage network to provide your network with energy", "advancements.refinedstorage2.connecting": "Connecting", "advancements.refinedstorage2.connecting.description": "Use Cable to connect devices with each other, or place devices against each other", "advancements.refinedstorage2.drives": "Drives", @@ -351,17 +391,19 @@ "advancements.refinedstorage2.storing_externally": "Storing externally", "advancements.refinedstorage2.storing_externally.description": "Use an External Storage to provide the network with storage from an external block like a chest", "advancements.refinedstorage2.detecting": "Detecting", - "advancements.refinedstorage2.detecting.description": "Use redstone to check resources stored in the network", + "advancements.refinedstorage2.detecting.description": "Use redstone to check resources stored in the storage network", "advancements.refinedstorage2.construction": "Construction", "advancements.refinedstorage2.construction.description": "Get blocks from the storage network into the world with a Constructor", "advancements.refinedstorage2.destruction": "Destruction", "advancements.refinedstorage2.destruction.description": "Get blocks from in the world into the storage network with a Destructor", "advancements.refinedstorage2.wireless": "Wireless", - "advancements.refinedstorage2.wireless.description": "Access your resources wirelessly with a Wireless Grid.", + "advancements.refinedstorage2.wireless.description": "Access your resources wirelessly with a Wireless Grid", "advancements.refinedstorage2.better_than_a_barrel": "Better than a barrel", "advancements.refinedstorage2.better_than_a_barrel.description": "Craft a Storage Monitor to view, insert or extract resources in a storage network", "advancements.refinedstorage2.no_cables_required": "No cables required", - "advancements.refinedstorage2.no_cables_required.description": "Add extra components to your network without using cables by using a Network Transmitter, Network Receiver and Network Card", + "advancements.refinedstorage2.no_cables_required.description": "Add extra components to your storage network without using cables by using a Network Transmitter, Network Receiver and Network Card", "advancements.refinedstorage2.portable_storage": "Portable storage", - "advancements.refinedstorage2.portable_storage.description": "Craft a Portable Grid to access the content of disks without requiring a storage network" + "advancements.refinedstorage2.portable_storage.description": "Craft a Portable Grid to access the content of disks without requiring a storage network", + "advancements.refinedstorage2.security": "Security", + "advancements.refinedstorage2.security.description": "Secure your storage network with a Security Manager and a Security Card" } From 263894feddca358f0c8186e7e67752f819eef873 Mon Sep 17 00:00:00 2001 From: Raoul Date: Thu, 4 Apr 2024 18:50:26 +0200 Subject: [PATCH 10/26] chore: update translation Italian from crowdin --- .../assets/refinedstorage2/lang/it_it.json | 76 ++++++++++++++----- 1 file changed, 59 insertions(+), 17 deletions(-) diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/it_it.json b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/it_it.json index 0e58472c8..36f89262b 100644 --- a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/it_it.json +++ b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/it_it.json @@ -1,5 +1,5 @@ { - "itemGroup.refinedstorage2.general": "Refined Storage 2", + "mod.refinedstorage2": "Refined Storage 2", "block.refinedstorage2.cable": "Cable", "block.refinedstorage2.quartz_enriched_iron_block": "Block of Quartz Enriched Iron", "block.refinedstorage2.disk_drive": "Disk Drive", @@ -32,6 +32,8 @@ "block.refinedstorage2.network_transmitter": "Network Transmitter", "block.refinedstorage2.portable_grid": "Portable Grid", "block.refinedstorage2.creative_portable_grid": "Creative Portable Grid", + "block.refinedstorage2.security_manager": "Security Manager", + "block.refinedstorage2.security_manager.help": "When this device is active, will protect the network by default and block all operations. Start adding Security Cards to permit or deny specific operations for a player.", "gui.refinedstorage2.controller.redstone_mode_help": "When this device is inactive, the storage network will not be able to use this device as an energy source.", "gui.refinedstorage2.disk_drive.disks": "Disks", "gui.refinedstorage2.storage.redstone_mode_help": "When this device is inactive, the contained storage will no longer be accessible from within the storage network.", @@ -47,12 +49,6 @@ "gui.refinedstorage2.grid.sorting.type.name": "Name", "gui.refinedstorage2.grid.sorting.type.id": "ID", "gui.refinedstorage2.grid.sorting.type.last_modified": "Last modified", - "gui.refinedstorage2.grid.size": "Size", - "gui.refinedstorage2.grid.size.stretch": "Stretch", - "gui.refinedstorage2.grid.size.small": "Small", - "gui.refinedstorage2.grid.size.medium": "Medium", - "gui.refinedstorage2.grid.size.large": "Large", - "gui.refinedstorage2.grid.size.extra_large": "Extra large", "gui.refinedstorage2.grid.auto_selected": "Auto-selected", "gui.refinedstorage2.grid.auto_selected.help": "Whether to auto-select the search box when opening the Grid.", "gui.refinedstorage2.grid.synchronizer": "Synchronization mode", @@ -65,12 +61,18 @@ "gui.refinedstorage2.grid.synchronizer.rei": "REI", "gui.refinedstorage2.grid.synchronizer.rei.help": "Sync the search box text to the REI filter.", "gui.refinedstorage2.grid.synchronizer.rei.two_way": "REI two-way", - "gui.refinedstorage2.grid.synchronizer.rei.two_way.help": "Sync the search box text to the JEI filter, and the JEI filter to the search box text.", + "gui.refinedstorage2.grid.synchronizer.rei.two_way.help": "Sync the search box text to the REI filter, and the REI filter to the search box text.", "gui.refinedstorage2.grid.resource_type": "Resource type", "gui.refinedstorage2.grid.resource_type.all": "All", "gui.refinedstorage2.grid.resource_type.help": "Filter specific resource types.", "gui.refinedstorage2.crafting_grid.move.network": "Move items to network", "gui.refinedstorage2.crafting_grid.move.inventory": "Move items to inventory", + "gui.refinedstorage2.screen_size": "Screen size", + "gui.refinedstorage2.screen_size.stretch": "Stretch", + "gui.refinedstorage2.screen_size.small": "Small", + "gui.refinedstorage2.screen_size.medium": "Medium", + "gui.refinedstorage2.screen_size.large": "Large", + "gui.refinedstorage2.screen_size.extra_large": "Extra large", "gui.refinedstorage2.detector.mode": "Mode", "gui.refinedstorage2.detector.mode.under": "Emit redstone signal when under the amount", "gui.refinedstorage2.detector.mode.equal": "Emit redstone signal when on the amount", @@ -142,6 +144,11 @@ "gui.refinedstorage2.network_transmitter.status.missing_network_card": "Missing Network Card", "gui.refinedstorage2.network_transmitter.status.transmitting": "%d block(s)", "gui.refinedstorage2.network_transmitter.status.receiver_unreachable": "Unreachable", + "gui.refinedstorage2.security_card.permission.reset": "Reset", + "gui.refinedstorage2.security_card.permission.modified": "Modified", + "gui.refinedstorage2.security_manager.redstone_mode_help": "When this device is inactive, the network will not be protected.", + "gui.refinedstorage2.security_manager.fallback_security_card_slot_hint": "Slot for a Fallback Security Card.", + "gui.refinedstorage2.security_manager.no_fallback_security_card_consequence": "Add a Fallback Security Card to this slot to set permissions for every player without a Security Card. By default, all actions are denied.", "item.refinedstorage2.controller.help": "Provides the storage network with energy. Multiple are allowed in a single storage network.", "item.refinedstorage2.creative_controller.help": "Provides the storage network with an infinite source of energy.", "item.refinedstorage2.disk_drive.help": "Accepts storage disks to provide the storage network with storage space.", @@ -219,6 +226,14 @@ "item.refinedstorage2.network_card.unbound": "Unbound.", "item.refinedstorage2.network_card.bound_help": "Insert into a Network Transmitter. Use while crouching to clear binding.", "item.refinedstorage2.network_card.bound": "Bound to %d, %d, %d in %s.", + "item.refinedstorage2.security_card": "Security Card", + "item.refinedstorage2.security_card.cleared_configuration": "Cleared configuration.", + "item.refinedstorage2.security_card.unbound": "Unbound.", + "item.refinedstorage2.security_card.unbound.help": "Right click to configure and bind to the current player.", + "item.refinedstorage2.security_card.bound": "Bound to %s.", + "item.refinedstorage2.security_card.bound.help": "Right click to configure. Use while crouching to clear configuration and binding.", + "item.refinedstorage2.fallback_security_card": "Fallback Security Card", + "item.refinedstorage2.fallback_security_card.help": "Acts as a fallback if no matching Security Card for a player is found. Right click to configure. Use while crouching to clear configuration.", "misc.refinedstorage2.stored": "Stored: %s", "misc.refinedstorage2.stored_with_capacity": "Stored: %s / %s (%d%%)", "misc.refinedstorage2.total": "%d total", @@ -238,29 +253,48 @@ "misc.refinedstorage2.resource_type.item": "Item", "misc.refinedstorage2.resource_type.fluid": "Fluid", "misc.refinedstorage2.press_shift_for_help": "Press SHIFT for help", + "misc.refinedstorage2.no_permission": "No permission", + "misc.refinedstorage2.no_permission.open": "You are not allowed to open the %s.", + "misc.refinedstorage2.no_permission.insert": "You are not allowed to insert.", + "misc.refinedstorage2.no_permission.extract": "You are not allowed to extract.", + "misc.refinedstorage2.no_permission.build.place": "You are not allowed to place a %s here.", + "misc.refinedstorage2.no_permission.build.break": "You are not allowed to break the %s.", + "misc.refinedstorage2.no_permission.build.rotate": "You are not allowed to rotate the %s.", + "misc.refinedstorage2.no_permission.build.dismantle": "You are not allowed to dismantle the %s.", "key.refinedstorage2.focus_search_bar": "Focus search bar", "key.refinedstorage2.clear_crafting_grid_matrix_to_network": "Clear Crafting Grid matrix to network", "key.refinedstorage2.clear_crafting_grid_matrix_to_inventory": "Clear Crafting Grid matrix to inventory", "key.refinedstorage2.open_wireless_grid": "Open Wireless Grid", "refinedstorage2.subtitle.wrench": "Wrench used", - "category.refinedstorage2.key_bindings": "Refined Storage 2", "curios.identifier.refinedstorage2": "Refined Storage 2", "trinkets.slot.refinedstorage2.wireless": "Refined Storage 2", + "permission.refinedstorage2.insert": "Insert", + "permission.refinedstorage2.insert.description": "Whether the player can insert resources in a network.", + "permission.refinedstorage2.extract": "Extract", + "permission.refinedstorage2.extract.description": "Whether the player can extract resources from a network.", + "permission.refinedstorage2.autocrafting": "Autocrafting", + "permission.refinedstorage2.autocrafting.description": "Whether the player can start, cancel or view an autocrafting task.", + "permission.refinedstorage2.open": "Open", + "permission.refinedstorage2.open.description": "Whether the player can open network device GUIs.", + "permission.refinedstorage2.build": "Build", + "permission.refinedstorage2.build.description": "Whether the player can add or remove network devices.", + "permission.refinedstorage2.security": "Security", + "permission.refinedstorage2.security.description": "Whether the player can manage the security options for a network.", "text.autoconfig.refinedstorage2.title": "Refined Storage 2", + "text.autoconfig.refinedstorage2.option.smoothScrolling": "Smooth scrolling", + "text.autoconfig.refinedstorage2.option.screenSize": "Screen size", + "text.autoconfig.refinedstorage2.option.maxRowsStretch": "Maximum amount of rows when screen size is stretched", "text.autoconfig.refinedstorage2.option.grid": "Grid", "text.autoconfig.refinedstorage2.option.grid.largeFont": "Large font", - "text.autoconfig.refinedstorage2.option.grid.maxRowsStretch": "Maximum amount of rows when stretched", "text.autoconfig.refinedstorage2.option.grid.preventSortingWhileShiftIsDown": "Prevent sorting while SHIFT is down", "text.autoconfig.refinedstorage2.option.grid.detailedTooltip": "Detailed tooltip", "text.autoconfig.refinedstorage2.option.grid.rememberSearchQuery": "Remember search query", "text.autoconfig.refinedstorage2.option.grid.energyUsage": "Energy usage", - "text.autoconfig.refinedstorage2.option.grid.smoothScrolling": "Smooth scrolling", "text.autoconfig.refinedstorage2.option.grid.autoSelected": "Auto selected search box", "text.autoconfig.refinedstorage2.option.grid.synchronizer": "Synchronizer", "text.autoconfig.refinedstorage2.option.grid.resourceTypeId": "Resource type", "text.autoconfig.refinedstorage2.option.grid.sortingDirection": "Sorting direction", "text.autoconfig.refinedstorage2.option.grid.sortingType": "Sorting type", - "text.autoconfig.refinedstorage2.option.grid.size": "Size", "text.autoconfig.refinedstorage2.option.craftingGrid": "Crafting Grid", "text.autoconfig.refinedstorage2.option.craftingGrid.energyUsage": "Energy usage", "text.autoconfig.refinedstorage2.option.craftingGrid.craftingMatrixCloseBehavior": "Crafting matrix close behavior", @@ -327,7 +361,13 @@ "text.autoconfig.refinedstorage2.option.portableGrid.openEnergyUsage": "Open energy usage", "text.autoconfig.refinedstorage2.option.portableGrid.insertEnergyUsage": "Insert energy usage", "text.autoconfig.refinedstorage2.option.portableGrid.extractEnergyUsage": "Extract energy usage", - "advancements.refinedstorage2.root.description": "Use one or multiple Controllers in a network to provide your network with energy", + "text.autoconfig.refinedstorage2.option.securityCard": "Security Card", + "text.autoconfig.refinedstorage2.option.securityCard.energyUsage": "Energy usage", + "text.autoconfig.refinedstorage2.option.fallbackSecurityCard": "Fallback Security Card", + "text.autoconfig.refinedstorage2.option.fallbackSecurityCard.energyUsage": "Energy usage", + "text.autoconfig.refinedstorage2.option.securityManager": "Security Manager", + "text.autoconfig.refinedstorage2.option.securityManager.energyUsage": "Energy usage", + "advancements.refinedstorage2.root.description": "Use one or multiple Controllers in a storage network to provide your network with energy", "advancements.refinedstorage2.connecting": "Connecting", "advancements.refinedstorage2.connecting.description": "Use Cable to connect devices with each other, or place devices against each other", "advancements.refinedstorage2.drives": "Drives", @@ -351,17 +391,19 @@ "advancements.refinedstorage2.storing_externally": "Storing externally", "advancements.refinedstorage2.storing_externally.description": "Use an External Storage to provide the network with storage from an external block like a chest", "advancements.refinedstorage2.detecting": "Detecting", - "advancements.refinedstorage2.detecting.description": "Use redstone to check resources stored in the network", + "advancements.refinedstorage2.detecting.description": "Use redstone to check resources stored in the storage network", "advancements.refinedstorage2.construction": "Construction", "advancements.refinedstorage2.construction.description": "Get blocks from the storage network into the world with a Constructor", "advancements.refinedstorage2.destruction": "Destruction", "advancements.refinedstorage2.destruction.description": "Get blocks from in the world into the storage network with a Destructor", "advancements.refinedstorage2.wireless": "Wireless", - "advancements.refinedstorage2.wireless.description": "Access your resources wirelessly with a Wireless Grid.", + "advancements.refinedstorage2.wireless.description": "Access your resources wirelessly with a Wireless Grid", "advancements.refinedstorage2.better_than_a_barrel": "Better than a barrel", "advancements.refinedstorage2.better_than_a_barrel.description": "Craft a Storage Monitor to view, insert or extract resources in a storage network", "advancements.refinedstorage2.no_cables_required": "No cables required", - "advancements.refinedstorage2.no_cables_required.description": "Add extra components to your network without using cables by using a Network Transmitter, Network Receiver and Network Card", + "advancements.refinedstorage2.no_cables_required.description": "Add extra components to your storage network without using cables by using a Network Transmitter, Network Receiver and Network Card", "advancements.refinedstorage2.portable_storage": "Portable storage", - "advancements.refinedstorage2.portable_storage.description": "Craft a Portable Grid to access the content of disks without requiring a storage network" + "advancements.refinedstorage2.portable_storage.description": "Craft a Portable Grid to access the content of disks without requiring a storage network", + "advancements.refinedstorage2.security": "Security", + "advancements.refinedstorage2.security.description": "Secure your storage network with a Security Manager and a Security Card" } From cd0f25ab6118d170676a283c4daece55c18bff5a Mon Sep 17 00:00:00 2001 From: Raoul Date: Thu, 4 Apr 2024 18:50:27 +0200 Subject: [PATCH 11/26] chore: update translation Japanese from crowdin --- .../assets/refinedstorage2/lang/ja_jp.json | 76 ++++++++++++++----- 1 file changed, 59 insertions(+), 17 deletions(-) diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/ja_jp.json b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/ja_jp.json index 0e58472c8..36f89262b 100644 --- a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/ja_jp.json +++ b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/ja_jp.json @@ -1,5 +1,5 @@ { - "itemGroup.refinedstorage2.general": "Refined Storage 2", + "mod.refinedstorage2": "Refined Storage 2", "block.refinedstorage2.cable": "Cable", "block.refinedstorage2.quartz_enriched_iron_block": "Block of Quartz Enriched Iron", "block.refinedstorage2.disk_drive": "Disk Drive", @@ -32,6 +32,8 @@ "block.refinedstorage2.network_transmitter": "Network Transmitter", "block.refinedstorage2.portable_grid": "Portable Grid", "block.refinedstorage2.creative_portable_grid": "Creative Portable Grid", + "block.refinedstorage2.security_manager": "Security Manager", + "block.refinedstorage2.security_manager.help": "When this device is active, will protect the network by default and block all operations. Start adding Security Cards to permit or deny specific operations for a player.", "gui.refinedstorage2.controller.redstone_mode_help": "When this device is inactive, the storage network will not be able to use this device as an energy source.", "gui.refinedstorage2.disk_drive.disks": "Disks", "gui.refinedstorage2.storage.redstone_mode_help": "When this device is inactive, the contained storage will no longer be accessible from within the storage network.", @@ -47,12 +49,6 @@ "gui.refinedstorage2.grid.sorting.type.name": "Name", "gui.refinedstorage2.grid.sorting.type.id": "ID", "gui.refinedstorage2.grid.sorting.type.last_modified": "Last modified", - "gui.refinedstorage2.grid.size": "Size", - "gui.refinedstorage2.grid.size.stretch": "Stretch", - "gui.refinedstorage2.grid.size.small": "Small", - "gui.refinedstorage2.grid.size.medium": "Medium", - "gui.refinedstorage2.grid.size.large": "Large", - "gui.refinedstorage2.grid.size.extra_large": "Extra large", "gui.refinedstorage2.grid.auto_selected": "Auto-selected", "gui.refinedstorage2.grid.auto_selected.help": "Whether to auto-select the search box when opening the Grid.", "gui.refinedstorage2.grid.synchronizer": "Synchronization mode", @@ -65,12 +61,18 @@ "gui.refinedstorage2.grid.synchronizer.rei": "REI", "gui.refinedstorage2.grid.synchronizer.rei.help": "Sync the search box text to the REI filter.", "gui.refinedstorage2.grid.synchronizer.rei.two_way": "REI two-way", - "gui.refinedstorage2.grid.synchronizer.rei.two_way.help": "Sync the search box text to the JEI filter, and the JEI filter to the search box text.", + "gui.refinedstorage2.grid.synchronizer.rei.two_way.help": "Sync the search box text to the REI filter, and the REI filter to the search box text.", "gui.refinedstorage2.grid.resource_type": "Resource type", "gui.refinedstorage2.grid.resource_type.all": "All", "gui.refinedstorage2.grid.resource_type.help": "Filter specific resource types.", "gui.refinedstorage2.crafting_grid.move.network": "Move items to network", "gui.refinedstorage2.crafting_grid.move.inventory": "Move items to inventory", + "gui.refinedstorage2.screen_size": "Screen size", + "gui.refinedstorage2.screen_size.stretch": "Stretch", + "gui.refinedstorage2.screen_size.small": "Small", + "gui.refinedstorage2.screen_size.medium": "Medium", + "gui.refinedstorage2.screen_size.large": "Large", + "gui.refinedstorage2.screen_size.extra_large": "Extra large", "gui.refinedstorage2.detector.mode": "Mode", "gui.refinedstorage2.detector.mode.under": "Emit redstone signal when under the amount", "gui.refinedstorage2.detector.mode.equal": "Emit redstone signal when on the amount", @@ -142,6 +144,11 @@ "gui.refinedstorage2.network_transmitter.status.missing_network_card": "Missing Network Card", "gui.refinedstorage2.network_transmitter.status.transmitting": "%d block(s)", "gui.refinedstorage2.network_transmitter.status.receiver_unreachable": "Unreachable", + "gui.refinedstorage2.security_card.permission.reset": "Reset", + "gui.refinedstorage2.security_card.permission.modified": "Modified", + "gui.refinedstorage2.security_manager.redstone_mode_help": "When this device is inactive, the network will not be protected.", + "gui.refinedstorage2.security_manager.fallback_security_card_slot_hint": "Slot for a Fallback Security Card.", + "gui.refinedstorage2.security_manager.no_fallback_security_card_consequence": "Add a Fallback Security Card to this slot to set permissions for every player without a Security Card. By default, all actions are denied.", "item.refinedstorage2.controller.help": "Provides the storage network with energy. Multiple are allowed in a single storage network.", "item.refinedstorage2.creative_controller.help": "Provides the storage network with an infinite source of energy.", "item.refinedstorage2.disk_drive.help": "Accepts storage disks to provide the storage network with storage space.", @@ -219,6 +226,14 @@ "item.refinedstorage2.network_card.unbound": "Unbound.", "item.refinedstorage2.network_card.bound_help": "Insert into a Network Transmitter. Use while crouching to clear binding.", "item.refinedstorage2.network_card.bound": "Bound to %d, %d, %d in %s.", + "item.refinedstorage2.security_card": "Security Card", + "item.refinedstorage2.security_card.cleared_configuration": "Cleared configuration.", + "item.refinedstorage2.security_card.unbound": "Unbound.", + "item.refinedstorage2.security_card.unbound.help": "Right click to configure and bind to the current player.", + "item.refinedstorage2.security_card.bound": "Bound to %s.", + "item.refinedstorage2.security_card.bound.help": "Right click to configure. Use while crouching to clear configuration and binding.", + "item.refinedstorage2.fallback_security_card": "Fallback Security Card", + "item.refinedstorage2.fallback_security_card.help": "Acts as a fallback if no matching Security Card for a player is found. Right click to configure. Use while crouching to clear configuration.", "misc.refinedstorage2.stored": "Stored: %s", "misc.refinedstorage2.stored_with_capacity": "Stored: %s / %s (%d%%)", "misc.refinedstorage2.total": "%d total", @@ -238,29 +253,48 @@ "misc.refinedstorage2.resource_type.item": "Item", "misc.refinedstorage2.resource_type.fluid": "Fluid", "misc.refinedstorage2.press_shift_for_help": "Press SHIFT for help", + "misc.refinedstorage2.no_permission": "No permission", + "misc.refinedstorage2.no_permission.open": "You are not allowed to open the %s.", + "misc.refinedstorage2.no_permission.insert": "You are not allowed to insert.", + "misc.refinedstorage2.no_permission.extract": "You are not allowed to extract.", + "misc.refinedstorage2.no_permission.build.place": "You are not allowed to place a %s here.", + "misc.refinedstorage2.no_permission.build.break": "You are not allowed to break the %s.", + "misc.refinedstorage2.no_permission.build.rotate": "You are not allowed to rotate the %s.", + "misc.refinedstorage2.no_permission.build.dismantle": "You are not allowed to dismantle the %s.", "key.refinedstorage2.focus_search_bar": "Focus search bar", "key.refinedstorage2.clear_crafting_grid_matrix_to_network": "Clear Crafting Grid matrix to network", "key.refinedstorage2.clear_crafting_grid_matrix_to_inventory": "Clear Crafting Grid matrix to inventory", "key.refinedstorage2.open_wireless_grid": "Open Wireless Grid", "refinedstorage2.subtitle.wrench": "Wrench used", - "category.refinedstorage2.key_bindings": "Refined Storage 2", "curios.identifier.refinedstorage2": "Refined Storage 2", "trinkets.slot.refinedstorage2.wireless": "Refined Storage 2", + "permission.refinedstorage2.insert": "Insert", + "permission.refinedstorage2.insert.description": "Whether the player can insert resources in a network.", + "permission.refinedstorage2.extract": "Extract", + "permission.refinedstorage2.extract.description": "Whether the player can extract resources from a network.", + "permission.refinedstorage2.autocrafting": "Autocrafting", + "permission.refinedstorage2.autocrafting.description": "Whether the player can start, cancel or view an autocrafting task.", + "permission.refinedstorage2.open": "Open", + "permission.refinedstorage2.open.description": "Whether the player can open network device GUIs.", + "permission.refinedstorage2.build": "Build", + "permission.refinedstorage2.build.description": "Whether the player can add or remove network devices.", + "permission.refinedstorage2.security": "Security", + "permission.refinedstorage2.security.description": "Whether the player can manage the security options for a network.", "text.autoconfig.refinedstorage2.title": "Refined Storage 2", + "text.autoconfig.refinedstorage2.option.smoothScrolling": "Smooth scrolling", + "text.autoconfig.refinedstorage2.option.screenSize": "Screen size", + "text.autoconfig.refinedstorage2.option.maxRowsStretch": "Maximum amount of rows when screen size is stretched", "text.autoconfig.refinedstorage2.option.grid": "Grid", "text.autoconfig.refinedstorage2.option.grid.largeFont": "Large font", - "text.autoconfig.refinedstorage2.option.grid.maxRowsStretch": "Maximum amount of rows when stretched", "text.autoconfig.refinedstorage2.option.grid.preventSortingWhileShiftIsDown": "Prevent sorting while SHIFT is down", "text.autoconfig.refinedstorage2.option.grid.detailedTooltip": "Detailed tooltip", "text.autoconfig.refinedstorage2.option.grid.rememberSearchQuery": "Remember search query", "text.autoconfig.refinedstorage2.option.grid.energyUsage": "Energy usage", - "text.autoconfig.refinedstorage2.option.grid.smoothScrolling": "Smooth scrolling", "text.autoconfig.refinedstorage2.option.grid.autoSelected": "Auto selected search box", "text.autoconfig.refinedstorage2.option.grid.synchronizer": "Synchronizer", "text.autoconfig.refinedstorage2.option.grid.resourceTypeId": "Resource type", "text.autoconfig.refinedstorage2.option.grid.sortingDirection": "Sorting direction", "text.autoconfig.refinedstorage2.option.grid.sortingType": "Sorting type", - "text.autoconfig.refinedstorage2.option.grid.size": "Size", "text.autoconfig.refinedstorage2.option.craftingGrid": "Crafting Grid", "text.autoconfig.refinedstorage2.option.craftingGrid.energyUsage": "Energy usage", "text.autoconfig.refinedstorage2.option.craftingGrid.craftingMatrixCloseBehavior": "Crafting matrix close behavior", @@ -327,7 +361,13 @@ "text.autoconfig.refinedstorage2.option.portableGrid.openEnergyUsage": "Open energy usage", "text.autoconfig.refinedstorage2.option.portableGrid.insertEnergyUsage": "Insert energy usage", "text.autoconfig.refinedstorage2.option.portableGrid.extractEnergyUsage": "Extract energy usage", - "advancements.refinedstorage2.root.description": "Use one or multiple Controllers in a network to provide your network with energy", + "text.autoconfig.refinedstorage2.option.securityCard": "Security Card", + "text.autoconfig.refinedstorage2.option.securityCard.energyUsage": "Energy usage", + "text.autoconfig.refinedstorage2.option.fallbackSecurityCard": "Fallback Security Card", + "text.autoconfig.refinedstorage2.option.fallbackSecurityCard.energyUsage": "Energy usage", + "text.autoconfig.refinedstorage2.option.securityManager": "Security Manager", + "text.autoconfig.refinedstorage2.option.securityManager.energyUsage": "Energy usage", + "advancements.refinedstorage2.root.description": "Use one or multiple Controllers in a storage network to provide your network with energy", "advancements.refinedstorage2.connecting": "Connecting", "advancements.refinedstorage2.connecting.description": "Use Cable to connect devices with each other, or place devices against each other", "advancements.refinedstorage2.drives": "Drives", @@ -351,17 +391,19 @@ "advancements.refinedstorage2.storing_externally": "Storing externally", "advancements.refinedstorage2.storing_externally.description": "Use an External Storage to provide the network with storage from an external block like a chest", "advancements.refinedstorage2.detecting": "Detecting", - "advancements.refinedstorage2.detecting.description": "Use redstone to check resources stored in the network", + "advancements.refinedstorage2.detecting.description": "Use redstone to check resources stored in the storage network", "advancements.refinedstorage2.construction": "Construction", "advancements.refinedstorage2.construction.description": "Get blocks from the storage network into the world with a Constructor", "advancements.refinedstorage2.destruction": "Destruction", "advancements.refinedstorage2.destruction.description": "Get blocks from in the world into the storage network with a Destructor", "advancements.refinedstorage2.wireless": "Wireless", - "advancements.refinedstorage2.wireless.description": "Access your resources wirelessly with a Wireless Grid.", + "advancements.refinedstorage2.wireless.description": "Access your resources wirelessly with a Wireless Grid", "advancements.refinedstorage2.better_than_a_barrel": "Better than a barrel", "advancements.refinedstorage2.better_than_a_barrel.description": "Craft a Storage Monitor to view, insert or extract resources in a storage network", "advancements.refinedstorage2.no_cables_required": "No cables required", - "advancements.refinedstorage2.no_cables_required.description": "Add extra components to your network without using cables by using a Network Transmitter, Network Receiver and Network Card", + "advancements.refinedstorage2.no_cables_required.description": "Add extra components to your storage network without using cables by using a Network Transmitter, Network Receiver and Network Card", "advancements.refinedstorage2.portable_storage": "Portable storage", - "advancements.refinedstorage2.portable_storage.description": "Craft a Portable Grid to access the content of disks without requiring a storage network" + "advancements.refinedstorage2.portable_storage.description": "Craft a Portable Grid to access the content of disks without requiring a storage network", + "advancements.refinedstorage2.security": "Security", + "advancements.refinedstorage2.security.description": "Secure your storage network with a Security Manager and a Security Card" } From a77dc7692c932cb17f73d8960aafc925cd9f5bbc Mon Sep 17 00:00:00 2001 From: Raoul Date: Thu, 4 Apr 2024 18:50:28 +0200 Subject: [PATCH 12/26] chore: update translation Korean from crowdin --- .../assets/refinedstorage2/lang/ko_kr.json | 76 ++++++++++++++----- 1 file changed, 59 insertions(+), 17 deletions(-) diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/ko_kr.json b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/ko_kr.json index 0e58472c8..36f89262b 100644 --- a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/ko_kr.json +++ b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/ko_kr.json @@ -1,5 +1,5 @@ { - "itemGroup.refinedstorage2.general": "Refined Storage 2", + "mod.refinedstorage2": "Refined Storage 2", "block.refinedstorage2.cable": "Cable", "block.refinedstorage2.quartz_enriched_iron_block": "Block of Quartz Enriched Iron", "block.refinedstorage2.disk_drive": "Disk Drive", @@ -32,6 +32,8 @@ "block.refinedstorage2.network_transmitter": "Network Transmitter", "block.refinedstorage2.portable_grid": "Portable Grid", "block.refinedstorage2.creative_portable_grid": "Creative Portable Grid", + "block.refinedstorage2.security_manager": "Security Manager", + "block.refinedstorage2.security_manager.help": "When this device is active, will protect the network by default and block all operations. Start adding Security Cards to permit or deny specific operations for a player.", "gui.refinedstorage2.controller.redstone_mode_help": "When this device is inactive, the storage network will not be able to use this device as an energy source.", "gui.refinedstorage2.disk_drive.disks": "Disks", "gui.refinedstorage2.storage.redstone_mode_help": "When this device is inactive, the contained storage will no longer be accessible from within the storage network.", @@ -47,12 +49,6 @@ "gui.refinedstorage2.grid.sorting.type.name": "Name", "gui.refinedstorage2.grid.sorting.type.id": "ID", "gui.refinedstorage2.grid.sorting.type.last_modified": "Last modified", - "gui.refinedstorage2.grid.size": "Size", - "gui.refinedstorage2.grid.size.stretch": "Stretch", - "gui.refinedstorage2.grid.size.small": "Small", - "gui.refinedstorage2.grid.size.medium": "Medium", - "gui.refinedstorage2.grid.size.large": "Large", - "gui.refinedstorage2.grid.size.extra_large": "Extra large", "gui.refinedstorage2.grid.auto_selected": "Auto-selected", "gui.refinedstorage2.grid.auto_selected.help": "Whether to auto-select the search box when opening the Grid.", "gui.refinedstorage2.grid.synchronizer": "Synchronization mode", @@ -65,12 +61,18 @@ "gui.refinedstorage2.grid.synchronizer.rei": "REI", "gui.refinedstorage2.grid.synchronizer.rei.help": "Sync the search box text to the REI filter.", "gui.refinedstorage2.grid.synchronizer.rei.two_way": "REI two-way", - "gui.refinedstorage2.grid.synchronizer.rei.two_way.help": "Sync the search box text to the JEI filter, and the JEI filter to the search box text.", + "gui.refinedstorage2.grid.synchronizer.rei.two_way.help": "Sync the search box text to the REI filter, and the REI filter to the search box text.", "gui.refinedstorage2.grid.resource_type": "Resource type", "gui.refinedstorage2.grid.resource_type.all": "All", "gui.refinedstorage2.grid.resource_type.help": "Filter specific resource types.", "gui.refinedstorage2.crafting_grid.move.network": "Move items to network", "gui.refinedstorage2.crafting_grid.move.inventory": "Move items to inventory", + "gui.refinedstorage2.screen_size": "Screen size", + "gui.refinedstorage2.screen_size.stretch": "Stretch", + "gui.refinedstorage2.screen_size.small": "Small", + "gui.refinedstorage2.screen_size.medium": "Medium", + "gui.refinedstorage2.screen_size.large": "Large", + "gui.refinedstorage2.screen_size.extra_large": "Extra large", "gui.refinedstorage2.detector.mode": "Mode", "gui.refinedstorage2.detector.mode.under": "Emit redstone signal when under the amount", "gui.refinedstorage2.detector.mode.equal": "Emit redstone signal when on the amount", @@ -142,6 +144,11 @@ "gui.refinedstorage2.network_transmitter.status.missing_network_card": "Missing Network Card", "gui.refinedstorage2.network_transmitter.status.transmitting": "%d block(s)", "gui.refinedstorage2.network_transmitter.status.receiver_unreachable": "Unreachable", + "gui.refinedstorage2.security_card.permission.reset": "Reset", + "gui.refinedstorage2.security_card.permission.modified": "Modified", + "gui.refinedstorage2.security_manager.redstone_mode_help": "When this device is inactive, the network will not be protected.", + "gui.refinedstorage2.security_manager.fallback_security_card_slot_hint": "Slot for a Fallback Security Card.", + "gui.refinedstorage2.security_manager.no_fallback_security_card_consequence": "Add a Fallback Security Card to this slot to set permissions for every player without a Security Card. By default, all actions are denied.", "item.refinedstorage2.controller.help": "Provides the storage network with energy. Multiple are allowed in a single storage network.", "item.refinedstorage2.creative_controller.help": "Provides the storage network with an infinite source of energy.", "item.refinedstorage2.disk_drive.help": "Accepts storage disks to provide the storage network with storage space.", @@ -219,6 +226,14 @@ "item.refinedstorage2.network_card.unbound": "Unbound.", "item.refinedstorage2.network_card.bound_help": "Insert into a Network Transmitter. Use while crouching to clear binding.", "item.refinedstorage2.network_card.bound": "Bound to %d, %d, %d in %s.", + "item.refinedstorage2.security_card": "Security Card", + "item.refinedstorage2.security_card.cleared_configuration": "Cleared configuration.", + "item.refinedstorage2.security_card.unbound": "Unbound.", + "item.refinedstorage2.security_card.unbound.help": "Right click to configure and bind to the current player.", + "item.refinedstorage2.security_card.bound": "Bound to %s.", + "item.refinedstorage2.security_card.bound.help": "Right click to configure. Use while crouching to clear configuration and binding.", + "item.refinedstorage2.fallback_security_card": "Fallback Security Card", + "item.refinedstorage2.fallback_security_card.help": "Acts as a fallback if no matching Security Card for a player is found. Right click to configure. Use while crouching to clear configuration.", "misc.refinedstorage2.stored": "Stored: %s", "misc.refinedstorage2.stored_with_capacity": "Stored: %s / %s (%d%%)", "misc.refinedstorage2.total": "%d total", @@ -238,29 +253,48 @@ "misc.refinedstorage2.resource_type.item": "Item", "misc.refinedstorage2.resource_type.fluid": "Fluid", "misc.refinedstorage2.press_shift_for_help": "Press SHIFT for help", + "misc.refinedstorage2.no_permission": "No permission", + "misc.refinedstorage2.no_permission.open": "You are not allowed to open the %s.", + "misc.refinedstorage2.no_permission.insert": "You are not allowed to insert.", + "misc.refinedstorage2.no_permission.extract": "You are not allowed to extract.", + "misc.refinedstorage2.no_permission.build.place": "You are not allowed to place a %s here.", + "misc.refinedstorage2.no_permission.build.break": "You are not allowed to break the %s.", + "misc.refinedstorage2.no_permission.build.rotate": "You are not allowed to rotate the %s.", + "misc.refinedstorage2.no_permission.build.dismantle": "You are not allowed to dismantle the %s.", "key.refinedstorage2.focus_search_bar": "Focus search bar", "key.refinedstorage2.clear_crafting_grid_matrix_to_network": "Clear Crafting Grid matrix to network", "key.refinedstorage2.clear_crafting_grid_matrix_to_inventory": "Clear Crafting Grid matrix to inventory", "key.refinedstorage2.open_wireless_grid": "Open Wireless Grid", "refinedstorage2.subtitle.wrench": "Wrench used", - "category.refinedstorage2.key_bindings": "Refined Storage 2", "curios.identifier.refinedstorage2": "Refined Storage 2", "trinkets.slot.refinedstorage2.wireless": "Refined Storage 2", + "permission.refinedstorage2.insert": "Insert", + "permission.refinedstorage2.insert.description": "Whether the player can insert resources in a network.", + "permission.refinedstorage2.extract": "Extract", + "permission.refinedstorage2.extract.description": "Whether the player can extract resources from a network.", + "permission.refinedstorage2.autocrafting": "Autocrafting", + "permission.refinedstorage2.autocrafting.description": "Whether the player can start, cancel or view an autocrafting task.", + "permission.refinedstorage2.open": "Open", + "permission.refinedstorage2.open.description": "Whether the player can open network device GUIs.", + "permission.refinedstorage2.build": "Build", + "permission.refinedstorage2.build.description": "Whether the player can add or remove network devices.", + "permission.refinedstorage2.security": "Security", + "permission.refinedstorage2.security.description": "Whether the player can manage the security options for a network.", "text.autoconfig.refinedstorage2.title": "Refined Storage 2", + "text.autoconfig.refinedstorage2.option.smoothScrolling": "Smooth scrolling", + "text.autoconfig.refinedstorage2.option.screenSize": "Screen size", + "text.autoconfig.refinedstorage2.option.maxRowsStretch": "Maximum amount of rows when screen size is stretched", "text.autoconfig.refinedstorage2.option.grid": "Grid", "text.autoconfig.refinedstorage2.option.grid.largeFont": "Large font", - "text.autoconfig.refinedstorage2.option.grid.maxRowsStretch": "Maximum amount of rows when stretched", "text.autoconfig.refinedstorage2.option.grid.preventSortingWhileShiftIsDown": "Prevent sorting while SHIFT is down", "text.autoconfig.refinedstorage2.option.grid.detailedTooltip": "Detailed tooltip", "text.autoconfig.refinedstorage2.option.grid.rememberSearchQuery": "Remember search query", "text.autoconfig.refinedstorage2.option.grid.energyUsage": "Energy usage", - "text.autoconfig.refinedstorage2.option.grid.smoothScrolling": "Smooth scrolling", "text.autoconfig.refinedstorage2.option.grid.autoSelected": "Auto selected search box", "text.autoconfig.refinedstorage2.option.grid.synchronizer": "Synchronizer", "text.autoconfig.refinedstorage2.option.grid.resourceTypeId": "Resource type", "text.autoconfig.refinedstorage2.option.grid.sortingDirection": "Sorting direction", "text.autoconfig.refinedstorage2.option.grid.sortingType": "Sorting type", - "text.autoconfig.refinedstorage2.option.grid.size": "Size", "text.autoconfig.refinedstorage2.option.craftingGrid": "Crafting Grid", "text.autoconfig.refinedstorage2.option.craftingGrid.energyUsage": "Energy usage", "text.autoconfig.refinedstorage2.option.craftingGrid.craftingMatrixCloseBehavior": "Crafting matrix close behavior", @@ -327,7 +361,13 @@ "text.autoconfig.refinedstorage2.option.portableGrid.openEnergyUsage": "Open energy usage", "text.autoconfig.refinedstorage2.option.portableGrid.insertEnergyUsage": "Insert energy usage", "text.autoconfig.refinedstorage2.option.portableGrid.extractEnergyUsage": "Extract energy usage", - "advancements.refinedstorage2.root.description": "Use one or multiple Controllers in a network to provide your network with energy", + "text.autoconfig.refinedstorage2.option.securityCard": "Security Card", + "text.autoconfig.refinedstorage2.option.securityCard.energyUsage": "Energy usage", + "text.autoconfig.refinedstorage2.option.fallbackSecurityCard": "Fallback Security Card", + "text.autoconfig.refinedstorage2.option.fallbackSecurityCard.energyUsage": "Energy usage", + "text.autoconfig.refinedstorage2.option.securityManager": "Security Manager", + "text.autoconfig.refinedstorage2.option.securityManager.energyUsage": "Energy usage", + "advancements.refinedstorage2.root.description": "Use one or multiple Controllers in a storage network to provide your network with energy", "advancements.refinedstorage2.connecting": "Connecting", "advancements.refinedstorage2.connecting.description": "Use Cable to connect devices with each other, or place devices against each other", "advancements.refinedstorage2.drives": "Drives", @@ -351,17 +391,19 @@ "advancements.refinedstorage2.storing_externally": "Storing externally", "advancements.refinedstorage2.storing_externally.description": "Use an External Storage to provide the network with storage from an external block like a chest", "advancements.refinedstorage2.detecting": "Detecting", - "advancements.refinedstorage2.detecting.description": "Use redstone to check resources stored in the network", + "advancements.refinedstorage2.detecting.description": "Use redstone to check resources stored in the storage network", "advancements.refinedstorage2.construction": "Construction", "advancements.refinedstorage2.construction.description": "Get blocks from the storage network into the world with a Constructor", "advancements.refinedstorage2.destruction": "Destruction", "advancements.refinedstorage2.destruction.description": "Get blocks from in the world into the storage network with a Destructor", "advancements.refinedstorage2.wireless": "Wireless", - "advancements.refinedstorage2.wireless.description": "Access your resources wirelessly with a Wireless Grid.", + "advancements.refinedstorage2.wireless.description": "Access your resources wirelessly with a Wireless Grid", "advancements.refinedstorage2.better_than_a_barrel": "Better than a barrel", "advancements.refinedstorage2.better_than_a_barrel.description": "Craft a Storage Monitor to view, insert or extract resources in a storage network", "advancements.refinedstorage2.no_cables_required": "No cables required", - "advancements.refinedstorage2.no_cables_required.description": "Add extra components to your network without using cables by using a Network Transmitter, Network Receiver and Network Card", + "advancements.refinedstorage2.no_cables_required.description": "Add extra components to your storage network without using cables by using a Network Transmitter, Network Receiver and Network Card", "advancements.refinedstorage2.portable_storage": "Portable storage", - "advancements.refinedstorage2.portable_storage.description": "Craft a Portable Grid to access the content of disks without requiring a storage network" + "advancements.refinedstorage2.portable_storage.description": "Craft a Portable Grid to access the content of disks without requiring a storage network", + "advancements.refinedstorage2.security": "Security", + "advancements.refinedstorage2.security.description": "Secure your storage network with a Security Manager and a Security Card" } From 086d11198b02da449c95a100e0969e26c40bf941 Mon Sep 17 00:00:00 2001 From: Raoul Date: Thu, 4 Apr 2024 18:50:29 +0200 Subject: [PATCH 13/26] chore: update translation Chinese Traditional from crowdin --- .../assets/refinedstorage2/lang/zh_tw.json | 76 ++++++++++++++----- 1 file changed, 59 insertions(+), 17 deletions(-) diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/zh_tw.json b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/zh_tw.json index 0e58472c8..36f89262b 100644 --- a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/zh_tw.json +++ b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/zh_tw.json @@ -1,5 +1,5 @@ { - "itemGroup.refinedstorage2.general": "Refined Storage 2", + "mod.refinedstorage2": "Refined Storage 2", "block.refinedstorage2.cable": "Cable", "block.refinedstorage2.quartz_enriched_iron_block": "Block of Quartz Enriched Iron", "block.refinedstorage2.disk_drive": "Disk Drive", @@ -32,6 +32,8 @@ "block.refinedstorage2.network_transmitter": "Network Transmitter", "block.refinedstorage2.portable_grid": "Portable Grid", "block.refinedstorage2.creative_portable_grid": "Creative Portable Grid", + "block.refinedstorage2.security_manager": "Security Manager", + "block.refinedstorage2.security_manager.help": "When this device is active, will protect the network by default and block all operations. Start adding Security Cards to permit or deny specific operations for a player.", "gui.refinedstorage2.controller.redstone_mode_help": "When this device is inactive, the storage network will not be able to use this device as an energy source.", "gui.refinedstorage2.disk_drive.disks": "Disks", "gui.refinedstorage2.storage.redstone_mode_help": "When this device is inactive, the contained storage will no longer be accessible from within the storage network.", @@ -47,12 +49,6 @@ "gui.refinedstorage2.grid.sorting.type.name": "Name", "gui.refinedstorage2.grid.sorting.type.id": "ID", "gui.refinedstorage2.grid.sorting.type.last_modified": "Last modified", - "gui.refinedstorage2.grid.size": "Size", - "gui.refinedstorage2.grid.size.stretch": "Stretch", - "gui.refinedstorage2.grid.size.small": "Small", - "gui.refinedstorage2.grid.size.medium": "Medium", - "gui.refinedstorage2.grid.size.large": "Large", - "gui.refinedstorage2.grid.size.extra_large": "Extra large", "gui.refinedstorage2.grid.auto_selected": "Auto-selected", "gui.refinedstorage2.grid.auto_selected.help": "Whether to auto-select the search box when opening the Grid.", "gui.refinedstorage2.grid.synchronizer": "Synchronization mode", @@ -65,12 +61,18 @@ "gui.refinedstorage2.grid.synchronizer.rei": "REI", "gui.refinedstorage2.grid.synchronizer.rei.help": "Sync the search box text to the REI filter.", "gui.refinedstorage2.grid.synchronizer.rei.two_way": "REI two-way", - "gui.refinedstorage2.grid.synchronizer.rei.two_way.help": "Sync the search box text to the JEI filter, and the JEI filter to the search box text.", + "gui.refinedstorage2.grid.synchronizer.rei.two_way.help": "Sync the search box text to the REI filter, and the REI filter to the search box text.", "gui.refinedstorage2.grid.resource_type": "Resource type", "gui.refinedstorage2.grid.resource_type.all": "All", "gui.refinedstorage2.grid.resource_type.help": "Filter specific resource types.", "gui.refinedstorage2.crafting_grid.move.network": "Move items to network", "gui.refinedstorage2.crafting_grid.move.inventory": "Move items to inventory", + "gui.refinedstorage2.screen_size": "Screen size", + "gui.refinedstorage2.screen_size.stretch": "Stretch", + "gui.refinedstorage2.screen_size.small": "Small", + "gui.refinedstorage2.screen_size.medium": "Medium", + "gui.refinedstorage2.screen_size.large": "Large", + "gui.refinedstorage2.screen_size.extra_large": "Extra large", "gui.refinedstorage2.detector.mode": "Mode", "gui.refinedstorage2.detector.mode.under": "Emit redstone signal when under the amount", "gui.refinedstorage2.detector.mode.equal": "Emit redstone signal when on the amount", @@ -142,6 +144,11 @@ "gui.refinedstorage2.network_transmitter.status.missing_network_card": "Missing Network Card", "gui.refinedstorage2.network_transmitter.status.transmitting": "%d block(s)", "gui.refinedstorage2.network_transmitter.status.receiver_unreachable": "Unreachable", + "gui.refinedstorage2.security_card.permission.reset": "Reset", + "gui.refinedstorage2.security_card.permission.modified": "Modified", + "gui.refinedstorage2.security_manager.redstone_mode_help": "When this device is inactive, the network will not be protected.", + "gui.refinedstorage2.security_manager.fallback_security_card_slot_hint": "Slot for a Fallback Security Card.", + "gui.refinedstorage2.security_manager.no_fallback_security_card_consequence": "Add a Fallback Security Card to this slot to set permissions for every player without a Security Card. By default, all actions are denied.", "item.refinedstorage2.controller.help": "Provides the storage network with energy. Multiple are allowed in a single storage network.", "item.refinedstorage2.creative_controller.help": "Provides the storage network with an infinite source of energy.", "item.refinedstorage2.disk_drive.help": "Accepts storage disks to provide the storage network with storage space.", @@ -219,6 +226,14 @@ "item.refinedstorage2.network_card.unbound": "Unbound.", "item.refinedstorage2.network_card.bound_help": "Insert into a Network Transmitter. Use while crouching to clear binding.", "item.refinedstorage2.network_card.bound": "Bound to %d, %d, %d in %s.", + "item.refinedstorage2.security_card": "Security Card", + "item.refinedstorage2.security_card.cleared_configuration": "Cleared configuration.", + "item.refinedstorage2.security_card.unbound": "Unbound.", + "item.refinedstorage2.security_card.unbound.help": "Right click to configure and bind to the current player.", + "item.refinedstorage2.security_card.bound": "Bound to %s.", + "item.refinedstorage2.security_card.bound.help": "Right click to configure. Use while crouching to clear configuration and binding.", + "item.refinedstorage2.fallback_security_card": "Fallback Security Card", + "item.refinedstorage2.fallback_security_card.help": "Acts as a fallback if no matching Security Card for a player is found. Right click to configure. Use while crouching to clear configuration.", "misc.refinedstorage2.stored": "Stored: %s", "misc.refinedstorage2.stored_with_capacity": "Stored: %s / %s (%d%%)", "misc.refinedstorage2.total": "%d total", @@ -238,29 +253,48 @@ "misc.refinedstorage2.resource_type.item": "Item", "misc.refinedstorage2.resource_type.fluid": "Fluid", "misc.refinedstorage2.press_shift_for_help": "Press SHIFT for help", + "misc.refinedstorage2.no_permission": "No permission", + "misc.refinedstorage2.no_permission.open": "You are not allowed to open the %s.", + "misc.refinedstorage2.no_permission.insert": "You are not allowed to insert.", + "misc.refinedstorage2.no_permission.extract": "You are not allowed to extract.", + "misc.refinedstorage2.no_permission.build.place": "You are not allowed to place a %s here.", + "misc.refinedstorage2.no_permission.build.break": "You are not allowed to break the %s.", + "misc.refinedstorage2.no_permission.build.rotate": "You are not allowed to rotate the %s.", + "misc.refinedstorage2.no_permission.build.dismantle": "You are not allowed to dismantle the %s.", "key.refinedstorage2.focus_search_bar": "Focus search bar", "key.refinedstorage2.clear_crafting_grid_matrix_to_network": "Clear Crafting Grid matrix to network", "key.refinedstorage2.clear_crafting_grid_matrix_to_inventory": "Clear Crafting Grid matrix to inventory", "key.refinedstorage2.open_wireless_grid": "Open Wireless Grid", "refinedstorage2.subtitle.wrench": "Wrench used", - "category.refinedstorage2.key_bindings": "Refined Storage 2", "curios.identifier.refinedstorage2": "Refined Storage 2", "trinkets.slot.refinedstorage2.wireless": "Refined Storage 2", + "permission.refinedstorage2.insert": "Insert", + "permission.refinedstorage2.insert.description": "Whether the player can insert resources in a network.", + "permission.refinedstorage2.extract": "Extract", + "permission.refinedstorage2.extract.description": "Whether the player can extract resources from a network.", + "permission.refinedstorage2.autocrafting": "Autocrafting", + "permission.refinedstorage2.autocrafting.description": "Whether the player can start, cancel or view an autocrafting task.", + "permission.refinedstorage2.open": "Open", + "permission.refinedstorage2.open.description": "Whether the player can open network device GUIs.", + "permission.refinedstorage2.build": "Build", + "permission.refinedstorage2.build.description": "Whether the player can add or remove network devices.", + "permission.refinedstorage2.security": "Security", + "permission.refinedstorage2.security.description": "Whether the player can manage the security options for a network.", "text.autoconfig.refinedstorage2.title": "Refined Storage 2", + "text.autoconfig.refinedstorage2.option.smoothScrolling": "Smooth scrolling", + "text.autoconfig.refinedstorage2.option.screenSize": "Screen size", + "text.autoconfig.refinedstorage2.option.maxRowsStretch": "Maximum amount of rows when screen size is stretched", "text.autoconfig.refinedstorage2.option.grid": "Grid", "text.autoconfig.refinedstorage2.option.grid.largeFont": "Large font", - "text.autoconfig.refinedstorage2.option.grid.maxRowsStretch": "Maximum amount of rows when stretched", "text.autoconfig.refinedstorage2.option.grid.preventSortingWhileShiftIsDown": "Prevent sorting while SHIFT is down", "text.autoconfig.refinedstorage2.option.grid.detailedTooltip": "Detailed tooltip", "text.autoconfig.refinedstorage2.option.grid.rememberSearchQuery": "Remember search query", "text.autoconfig.refinedstorage2.option.grid.energyUsage": "Energy usage", - "text.autoconfig.refinedstorage2.option.grid.smoothScrolling": "Smooth scrolling", "text.autoconfig.refinedstorage2.option.grid.autoSelected": "Auto selected search box", "text.autoconfig.refinedstorage2.option.grid.synchronizer": "Synchronizer", "text.autoconfig.refinedstorage2.option.grid.resourceTypeId": "Resource type", "text.autoconfig.refinedstorage2.option.grid.sortingDirection": "Sorting direction", "text.autoconfig.refinedstorage2.option.grid.sortingType": "Sorting type", - "text.autoconfig.refinedstorage2.option.grid.size": "Size", "text.autoconfig.refinedstorage2.option.craftingGrid": "Crafting Grid", "text.autoconfig.refinedstorage2.option.craftingGrid.energyUsage": "Energy usage", "text.autoconfig.refinedstorage2.option.craftingGrid.craftingMatrixCloseBehavior": "Crafting matrix close behavior", @@ -327,7 +361,13 @@ "text.autoconfig.refinedstorage2.option.portableGrid.openEnergyUsage": "Open energy usage", "text.autoconfig.refinedstorage2.option.portableGrid.insertEnergyUsage": "Insert energy usage", "text.autoconfig.refinedstorage2.option.portableGrid.extractEnergyUsage": "Extract energy usage", - "advancements.refinedstorage2.root.description": "Use one or multiple Controllers in a network to provide your network with energy", + "text.autoconfig.refinedstorage2.option.securityCard": "Security Card", + "text.autoconfig.refinedstorage2.option.securityCard.energyUsage": "Energy usage", + "text.autoconfig.refinedstorage2.option.fallbackSecurityCard": "Fallback Security Card", + "text.autoconfig.refinedstorage2.option.fallbackSecurityCard.energyUsage": "Energy usage", + "text.autoconfig.refinedstorage2.option.securityManager": "Security Manager", + "text.autoconfig.refinedstorage2.option.securityManager.energyUsage": "Energy usage", + "advancements.refinedstorage2.root.description": "Use one or multiple Controllers in a storage network to provide your network with energy", "advancements.refinedstorage2.connecting": "Connecting", "advancements.refinedstorage2.connecting.description": "Use Cable to connect devices with each other, or place devices against each other", "advancements.refinedstorage2.drives": "Drives", @@ -351,17 +391,19 @@ "advancements.refinedstorage2.storing_externally": "Storing externally", "advancements.refinedstorage2.storing_externally.description": "Use an External Storage to provide the network with storage from an external block like a chest", "advancements.refinedstorage2.detecting": "Detecting", - "advancements.refinedstorage2.detecting.description": "Use redstone to check resources stored in the network", + "advancements.refinedstorage2.detecting.description": "Use redstone to check resources stored in the storage network", "advancements.refinedstorage2.construction": "Construction", "advancements.refinedstorage2.construction.description": "Get blocks from the storage network into the world with a Constructor", "advancements.refinedstorage2.destruction": "Destruction", "advancements.refinedstorage2.destruction.description": "Get blocks from in the world into the storage network with a Destructor", "advancements.refinedstorage2.wireless": "Wireless", - "advancements.refinedstorage2.wireless.description": "Access your resources wirelessly with a Wireless Grid.", + "advancements.refinedstorage2.wireless.description": "Access your resources wirelessly with a Wireless Grid", "advancements.refinedstorage2.better_than_a_barrel": "Better than a barrel", "advancements.refinedstorage2.better_than_a_barrel.description": "Craft a Storage Monitor to view, insert or extract resources in a storage network", "advancements.refinedstorage2.no_cables_required": "No cables required", - "advancements.refinedstorage2.no_cables_required.description": "Add extra components to your network without using cables by using a Network Transmitter, Network Receiver and Network Card", + "advancements.refinedstorage2.no_cables_required.description": "Add extra components to your storage network without using cables by using a Network Transmitter, Network Receiver and Network Card", "advancements.refinedstorage2.portable_storage": "Portable storage", - "advancements.refinedstorage2.portable_storage.description": "Craft a Portable Grid to access the content of disks without requiring a storage network" + "advancements.refinedstorage2.portable_storage.description": "Craft a Portable Grid to access the content of disks without requiring a storage network", + "advancements.refinedstorage2.security": "Security", + "advancements.refinedstorage2.security.description": "Secure your storage network with a Security Manager and a Security Card" } From 44225225489426b51ba820d717ff4a2b6116c4ee Mon Sep 17 00:00:00 2001 From: raoulvdberge Date: Fri, 5 Apr 2024 15:56:31 +0200 Subject: [PATCH 14/26] refactor: allow multiple containers within a single container block entity --- .../node/container/NetworkNodeContainer.java | 4 +- .../platform/api/PlatformApi.java | 22 ++++- .../platform/api/PlatformApiProxy.java | 43 +++++++-- .../platform/api/security/SecurityHelper.java | 14 +++ ...stractNetworkNodeContainerBlockEntity.java | 84 ++++++++--------- ...odeContainer.java => ConnectionLogic.java} | 30 ++---- .../network/InWorldNetworkNodeContainer.java | 21 +++++ .../NetworkNodeContainerBlockEntity.java | 19 ++++ .../NetworkBoundItemTargetBlockEntity.java | 13 +++ .../common/AbstractModInitializer.java | 4 +- .../platform/common/PlatformApiImpl.java | 58 ++++++++---- .../ConstructorBlockEntity.java | 10 +- .../DestructorBlockEntity.java | 10 +- .../common/content/BlockEntities.java | 8 +- .../controller/ControllerBlockEntity.java | 12 +-- .../common/detector/DetectorBlockEntity.java | 16 ++-- .../common/exporter/ExporterBlockEntity.java | 8 +- .../common/grid/AbstractGridBlockEntity.java | 30 +++--- .../common/grid/CraftingGridBlockEntity.java | 6 +- .../common/iface/InterfaceBlockEntity.java | 10 +- ...InterfaceProxyExternalStorageProvider.java | 3 +- .../common/importer/ImporterBlockEntity.java | 16 ++-- .../common/networking/CableBlock.java | 6 +- .../NetworkReceiverBlockEntity.java | 20 ++-- .../NetworkTransmitterBlockEntity.java | 22 ++--- .../security/SecurityManagerBlockEntity.java | 10 +- .../AbstractDiskDriveBlockEntity.java | 31 +++---- .../ExternalStorageBlockEntity.java | 12 +-- .../AbstractStorageBlockBlockEntity.java | 16 ++-- .../StorageMonitorBlockEntity.java | 12 +-- .../common/support/AbstractBaseBlock.java | 44 ++------- .../common/support/CableBlockSupport.java | 8 +- .../NetworkNodeMenuProvider.java | 8 +- ...neModeNetworkNodeContainerBlockEntity.java | 2 +- ... BaseNetworkNodeContainerBlockEntity.java} | 37 +++++--- .../network/ConnectionProviderImpl.java | 81 ++++++++-------- .../InWorldNetworkNodeContainerImpl.java | 92 +++++++++++++++++++ .../network/NetworkNodeBlockEntityTicker.java | 2 +- .../bounditem/NetworkBoundItemHelperImpl.java | 4 +- .../NetworkBoundItemSessionImpl.java | 14 ++- .../WirelessTransmitterBlockEntity.java | 31 ++----- ...relessTransmitterNetworkNodeContainer.java | 44 +++++++++ ...NetworkNodeBreakSecurityEventListener.java | 6 +- .../platform/forge/ModInitializer.java | 6 +- 44 files changed, 584 insertions(+), 365 deletions(-) rename refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/support/network/{PlatformNetworkNodeContainer.java => ConnectionLogic.java} (57%) create mode 100644 refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/support/network/InWorldNetworkNodeContainer.java create mode 100644 refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/support/network/NetworkNodeContainerBlockEntity.java create mode 100644 refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/support/network/bounditem/NetworkBoundItemTargetBlockEntity.java rename refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/{NetworkNodeContainerBlockEntityImpl.java => BaseNetworkNodeContainerBlockEntity.java} (83%) create mode 100644 refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/InWorldNetworkNodeContainerImpl.java create mode 100644 refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/wirelesstransmitter/WirelessTransmitterNetworkNodeContainer.java diff --git a/refinedstorage2-network-api/src/main/java/com/refinedmods/refinedstorage2/api/network/node/container/NetworkNodeContainer.java b/refinedstorage2-network-api/src/main/java/com/refinedmods/refinedstorage2/api/network/node/container/NetworkNodeContainer.java index 1bbc43a2b..de14588a4 100644 --- a/refinedstorage2-network-api/src/main/java/com/refinedmods/refinedstorage2/api/network/node/container/NetworkNodeContainer.java +++ b/refinedstorage2-network-api/src/main/java/com/refinedmods/refinedstorage2/api/network/node/container/NetworkNodeContainer.java @@ -1,6 +1,5 @@ package com.refinedmods.refinedstorage2.api.network.node.container; -import com.refinedmods.refinedstorage2.api.network.node.GraphNetworkComponent; import com.refinedmods.refinedstorage2.api.network.node.NetworkNode; import javax.annotation.Nullable; @@ -18,7 +17,8 @@ public interface NetworkNodeContainer { * The key must be kept stable, and must stay the same for the lifetime of the container. * If it changes after adding it into the graph, the container would not be removed from the key index when the * container is removed! - * The container can be queried by {@link GraphNetworkComponent#getContainer(Object)}. + * The container can be queried by + * {@link com.refinedmods.refinedstorage2.api.network.node.GraphNetworkComponent#getContainer(Object)}. * * @return the key, or null if indexing is not required */ diff --git a/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/PlatformApi.java b/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/PlatformApi.java index a0414004d..61c859046 100644 --- a/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/PlatformApi.java +++ b/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/PlatformApi.java @@ -4,6 +4,7 @@ import com.refinedmods.refinedstorage2.api.network.Network; import com.refinedmods.refinedstorage2.api.network.NetworkComponent; import com.refinedmods.refinedstorage2.api.network.energy.EnergyStorage; +import com.refinedmods.refinedstorage2.api.network.node.NetworkNode; import com.refinedmods.refinedstorage2.api.network.security.SecurityPolicy; import com.refinedmods.refinedstorage2.api.resource.ResourceKey; import com.refinedmods.refinedstorage2.platform.api.constructordestructor.ConstructorStrategyFactory; @@ -30,7 +31,8 @@ import com.refinedmods.refinedstorage2.platform.api.storagemonitor.StorageMonitorExtractionStrategy; import com.refinedmods.refinedstorage2.platform.api.storagemonitor.StorageMonitorInsertionStrategy; import com.refinedmods.refinedstorage2.platform.api.support.energy.EnergyItemHelper; -import com.refinedmods.refinedstorage2.platform.api.support.network.PlatformNetworkNodeContainer; +import com.refinedmods.refinedstorage2.platform.api.support.network.ConnectionLogic; +import com.refinedmods.refinedstorage2.platform.api.support.network.InWorldNetworkNodeContainer; import com.refinedmods.refinedstorage2.platform.api.support.network.bounditem.NetworkBoundItemHelper; import com.refinedmods.refinedstorage2.platform.api.support.network.bounditem.SlotReference; import com.refinedmods.refinedstorage2.platform.api.support.network.bounditem.SlotReferenceFactory; @@ -46,6 +48,8 @@ import java.util.Collection; import java.util.Optional; import java.util.Set; +import java.util.function.Supplier; +import javax.annotation.Nullable; import net.minecraft.core.BlockPos; import net.minecraft.network.FriendlyByteBuf; @@ -57,6 +61,7 @@ import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import org.apiguardian.api.API; @@ -107,11 +112,20 @@ public interface PlatformApi { BuiltinUpgradeDestinations getBuiltinUpgradeDestinations(); - void requestNetworkNodeInitialization(PlatformNetworkNodeContainer container, Level level, Runnable callback); + InWorldNetworkNodeContainer createInWorldNetworkNodeContainer(BlockEntity blockEntity, + NetworkNode node, + String name, + int priority, + ConnectionLogic connectionLogic, + @Nullable Supplier keyProvider); - void requestNetworkNodeRemoval(PlatformNetworkNodeContainer container, Level level); + void onNetworkNodeContainerInitialized(InWorldNetworkNodeContainer container, + @Nullable Level level, + @Nullable Runnable callback); - void requestNetworkNodeUpdate(PlatformNetworkNodeContainer container, Level level); + void onNetworkNodeContainerRemoved(InWorldNetworkNodeContainer container, @Nullable Level level); + + void onNetworkNodeContainerUpdated(InWorldNetworkNodeContainer container, @Nullable Level level); GridInsertionStrategy createGridInsertionStrategy(AbstractContainerMenu containerMenu, ServerPlayer player, diff --git a/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/PlatformApiProxy.java b/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/PlatformApiProxy.java index d67c643f9..ae84a0e00 100644 --- a/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/PlatformApiProxy.java +++ b/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/PlatformApiProxy.java @@ -4,6 +4,7 @@ import com.refinedmods.refinedstorage2.api.network.Network; import com.refinedmods.refinedstorage2.api.network.NetworkComponent; import com.refinedmods.refinedstorage2.api.network.energy.EnergyStorage; +import com.refinedmods.refinedstorage2.api.network.node.NetworkNode; import com.refinedmods.refinedstorage2.api.network.security.SecurityPolicy; import com.refinedmods.refinedstorage2.api.resource.ResourceKey; import com.refinedmods.refinedstorage2.platform.api.constructordestructor.ConstructorStrategyFactory; @@ -30,7 +31,8 @@ import com.refinedmods.refinedstorage2.platform.api.storagemonitor.StorageMonitorExtractionStrategy; import com.refinedmods.refinedstorage2.platform.api.storagemonitor.StorageMonitorInsertionStrategy; import com.refinedmods.refinedstorage2.platform.api.support.energy.EnergyItemHelper; -import com.refinedmods.refinedstorage2.platform.api.support.network.PlatformNetworkNodeContainer; +import com.refinedmods.refinedstorage2.platform.api.support.network.ConnectionLogic; +import com.refinedmods.refinedstorage2.platform.api.support.network.InWorldNetworkNodeContainer; import com.refinedmods.refinedstorage2.platform.api.support.network.bounditem.NetworkBoundItemHelper; import com.refinedmods.refinedstorage2.platform.api.support.network.bounditem.SlotReference; import com.refinedmods.refinedstorage2.platform.api.support.network.bounditem.SlotReferenceFactory; @@ -46,6 +48,7 @@ import java.util.Collection; import java.util.Optional; import java.util.Set; +import java.util.function.Supplier; import javax.annotation.Nullable; import net.minecraft.core.BlockPos; @@ -58,6 +61,7 @@ import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; @@ -178,20 +182,41 @@ public BuiltinUpgradeDestinations getBuiltinUpgradeDestinations() { } @Override - public void requestNetworkNodeInitialization(final PlatformNetworkNodeContainer container, - final Level level, - final Runnable callback) { - ensureLoaded().requestNetworkNodeInitialization(container, level, callback); + public InWorldNetworkNodeContainer createInWorldNetworkNodeContainer( + final BlockEntity blockEntity, + final NetworkNode node, + final String name, + final int priority, + final ConnectionLogic connectionLogic, + @Nullable final Supplier keyProvider + ) { + return ensureLoaded().createInWorldNetworkNodeContainer( + blockEntity, + node, + name, + priority, + connectionLogic, + keyProvider + ); } @Override - public void requestNetworkNodeRemoval(final PlatformNetworkNodeContainer container, final Level level) { - ensureLoaded().requestNetworkNodeRemoval(container, level); + public void onNetworkNodeContainerInitialized(final InWorldNetworkNodeContainer container, + @Nullable final Level level, + @Nullable final Runnable callback) { + ensureLoaded().onNetworkNodeContainerInitialized(container, level, callback); } @Override - public void requestNetworkNodeUpdate(final PlatformNetworkNodeContainer container, final Level level) { - ensureLoaded().requestNetworkNodeUpdate(container, level); + public void onNetworkNodeContainerRemoved(final InWorldNetworkNodeContainer container, + @Nullable final Level level) { + ensureLoaded().onNetworkNodeContainerRemoved(container, level); + } + + @Override + public void onNetworkNodeContainerUpdated(final InWorldNetworkNodeContainer container, + @Nullable final Level level) { + ensureLoaded().onNetworkNodeContainerUpdated(container, level); } @Override diff --git a/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/security/SecurityHelper.java b/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/security/SecurityHelper.java index 0c4ef5038..3e985e320 100644 --- a/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/security/SecurityHelper.java +++ b/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/security/SecurityHelper.java @@ -3,6 +3,9 @@ import com.refinedmods.refinedstorage2.api.network.Network; import com.refinedmods.refinedstorage2.api.network.node.NetworkNode; import com.refinedmods.refinedstorage2.api.network.security.Permission; +import com.refinedmods.refinedstorage2.platform.api.support.network.InWorldNetworkNodeContainer; + +import java.util.Set; import net.minecraft.server.level.ServerPlayer; @@ -10,6 +13,17 @@ public final class SecurityHelper { private SecurityHelper() { } + public static boolean isAllowed(final ServerPlayer player, + final Permission permission, + final Set containers) { + for (final InWorldNetworkNodeContainer container : containers) { + if (!isAllowed(player, permission, container.getNode())) { + return false; + } + } + return true; + } + public static boolean isAllowed(final ServerPlayer player, final Permission permission, final NetworkNode node) { final Network network = node.getNetwork(); if (network == null) { diff --git a/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/support/network/AbstractNetworkNodeContainerBlockEntity.java b/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/support/network/AbstractNetworkNodeContainerBlockEntity.java index 1c6bacffd..c24e9a476 100644 --- a/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/support/network/AbstractNetworkNodeContainerBlockEntity.java +++ b/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/support/network/AbstractNetworkNodeContainerBlockEntity.java @@ -3,58 +3,49 @@ import com.refinedmods.refinedstorage2.api.network.node.NetworkNode; import com.refinedmods.refinedstorage2.platform.api.PlatformApi; +import java.util.HashSet; +import java.util.Set; +import javax.annotation.Nullable; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; -import net.minecraft.core.GlobalPos; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import org.apiguardian.api.API; -import static java.util.Objects.requireNonNull; - @API(status = API.Status.STABLE, since = "2.0.0-milestone.1.2") public abstract class AbstractNetworkNodeContainerBlockEntity extends BlockEntity - implements PlatformNetworkNodeContainer { - private final T node; + implements NetworkNodeContainerBlockEntity, ConnectionLogic { + protected static final String MAIN_CONTAINER_NAME = "main"; + + protected final T mainNode; + protected final InWorldNetworkNodeContainer mainContainer; + + @Nullable + protected Runnable initializationCallback; + + private final Set containers = new HashSet<>(); protected AbstractNetworkNodeContainerBlockEntity(final BlockEntityType type, final BlockPos pos, final BlockState state, - final T node) { + final T mainNode) { super(type, pos, state); - this.node = node; - } - - @Override - public void clearRemoved() { - super.clearRemoved(); - if (level == null || level.isClientSide) { - return; - } - PlatformApi.INSTANCE.requestNetworkNodeInitialization(this, level, this::onNetworkInNodeInitialized); - } - - @Override - public boolean isContainerRemoved() { - return isRemoved(); + this.mainContainer = createMainContainer(mainNode); + this.containers.add(mainContainer); + this.mainNode = mainNode; } - protected void onNetworkInNodeInitialized() { - } - - @Override - public void setRemoved() { - super.setRemoved(); - if (level == null || level.isClientSide) { - return; - } - PlatformApi.INSTANCE.requestNetworkNodeRemoval(this, level); - } - - @Override - public T getNode() { - return node; + protected InWorldNetworkNodeContainer createMainContainer(final T node) { + return PlatformApi.INSTANCE.createInWorldNetworkNodeContainer( + this, + node, + MAIN_CONTAINER_NAME, + 0, + this, + null + ); } @Override @@ -70,20 +61,23 @@ public boolean canAcceptIncomingConnection(final Direction incomingDirection, fi } @Override - public BlockState getContainerBlockState() { - return getBlockState(); + public void clearRemoved() { + super.clearRemoved(); + containers.forEach(container -> PlatformApi.INSTANCE.onNetworkNodeContainerInitialized( + container, + level, + initializationCallback + )); } @Override - public GlobalPos getContainerPosition() { - return GlobalPos.of(requireNonNull(level).dimension(), worldPosition); + public void setRemoved() { + super.setRemoved(); + containers.forEach(container -> PlatformApi.INSTANCE.onNetworkNodeContainerRemoved(container, level)); } @Override - public String toString() { - return "NetworkNodeContainerBlockEntity{" - + "node=" + node - + ", worldPosition=" + worldPosition - + "}"; + public Set getContainers() { + return containers; } } diff --git a/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/support/network/PlatformNetworkNodeContainer.java b/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/support/network/ConnectionLogic.java similarity index 57% rename from refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/support/network/PlatformNetworkNodeContainer.java rename to refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/support/network/ConnectionLogic.java index e1151c134..e364a0136 100644 --- a/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/support/network/PlatformNetworkNodeContainer.java +++ b/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/support/network/ConnectionLogic.java @@ -1,24 +1,18 @@ package com.refinedmods.refinedstorage2.platform.api.support.network; -import com.refinedmods.refinedstorage2.api.network.node.container.NetworkNodeContainer; -import com.refinedmods.refinedstorage2.platform.api.PlatformApi; -import com.refinedmods.refinedstorage2.platform.api.security.SecurityHelper; - import net.minecraft.core.Direction; -import net.minecraft.core.GlobalPos; -import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockState; import org.apiguardian.api.API; -@API(status = API.Status.STABLE, since = "2.0.0-milestone.2.1") -public interface PlatformNetworkNodeContainer extends NetworkNodeContainer { +@API(status = API.Status.STABLE, since = "2.0.0-milestone.3.6") +public interface ConnectionLogic { /** - * Called when a node is about to be added into the network graph. * Add outgoing connections here. + * Called when a node is about to be added into the network graph. * If the outgoing connections ever change, call {@link - * com.refinedmods.refinedstorage2.platform.api.PlatformApi#requestNetworkNodeUpdate( - *PlatformNetworkNodeContainer, Level)}. + * com.refinedmods.refinedstorage2.platform.api.PlatformApi#onNetworkNodeContainerUpdated( + *InWorldNetworkNodeContainer, Level)}. * * @param sink the sink that accepts outgoing connections */ @@ -28,22 +22,12 @@ public interface PlatformNetworkNodeContainer extends NetworkNodeContainer { * Returns whether the (not yet discovered) node can accept an incoming connection. * Changes to this return value won't cause a rebuild of the network state. * If the return value ever changes, call {@link - * com.refinedmods.refinedstorage2.platform.api.PlatformApi#requestNetworkNodeUpdate( - *PlatformNetworkNodeContainer, Level)}. + * com.refinedmods.refinedstorage2.platform.api.PlatformApi#onNetworkNodeContainerUpdated( + *InWorldNetworkNodeContainer, Level)}. * * @param incomingDirection the incoming direction * @param connectingState the state wanting to connect * @return whether the node can accept an incoming connection */ boolean canAcceptIncomingConnection(Direction incomingDirection, BlockState connectingState); - - BlockState getContainerBlockState(); - - GlobalPos getContainerPosition(); - - boolean isContainerRemoved(); - - default boolean canBreakOrRotate(final ServerPlayer player) { - return SecurityHelper.isAllowed(player, PlatformApi.INSTANCE.getBuiltinPermissions().build(), getNode()); - } } diff --git a/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/support/network/InWorldNetworkNodeContainer.java b/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/support/network/InWorldNetworkNodeContainer.java new file mode 100644 index 000000000..a72eb59b8 --- /dev/null +++ b/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/support/network/InWorldNetworkNodeContainer.java @@ -0,0 +1,21 @@ +package com.refinedmods.refinedstorage2.platform.api.support.network; + +import com.refinedmods.refinedstorage2.api.network.node.container.NetworkNodeContainer; + +import net.minecraft.core.BlockPos; +import net.minecraft.core.GlobalPos; +import net.minecraft.world.level.block.state.BlockState; +import org.apiguardian.api.API; + +@API(status = API.Status.STABLE, since = "2.0.0-milestone.2.1") +public interface InWorldNetworkNodeContainer extends NetworkNodeContainer, ConnectionLogic { + BlockState getBlockState(); + + boolean isRemoved(); + + GlobalPos getPosition(); + + BlockPos getLocalPosition(); + + String getName(); +} diff --git a/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/support/network/NetworkNodeContainerBlockEntity.java b/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/support/network/NetworkNodeContainerBlockEntity.java new file mode 100644 index 000000000..9dd1856bd --- /dev/null +++ b/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/support/network/NetworkNodeContainerBlockEntity.java @@ -0,0 +1,19 @@ +package com.refinedmods.refinedstorage2.platform.api.support.network; + +import com.refinedmods.refinedstorage2.platform.api.PlatformApi; +import com.refinedmods.refinedstorage2.platform.api.security.SecurityHelper; + +import java.util.Set; + +import net.minecraft.server.level.ServerPlayer; +import org.apiguardian.api.API; + +@API(status = API.Status.STABLE, since = "2.0.0-milestone.3.6") +@FunctionalInterface +public interface NetworkNodeContainerBlockEntity { + Set getContainers(); + + default boolean canBuild(final ServerPlayer player) { + return SecurityHelper.isAllowed(player, PlatformApi.INSTANCE.getBuiltinPermissions().build(), getContainers()); + } +} diff --git a/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/support/network/bounditem/NetworkBoundItemTargetBlockEntity.java b/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/support/network/bounditem/NetworkBoundItemTargetBlockEntity.java new file mode 100644 index 000000000..265881940 --- /dev/null +++ b/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/support/network/bounditem/NetworkBoundItemTargetBlockEntity.java @@ -0,0 +1,13 @@ +package com.refinedmods.refinedstorage2.platform.api.support.network.bounditem; + +import com.refinedmods.refinedstorage2.api.network.Network; + +import javax.annotation.Nullable; + +import org.apiguardian.api.API; + +@API(status = API.Status.STABLE, since = "2.0.0-milestone.3.6") +public interface NetworkBoundItemTargetBlockEntity { + @Nullable + Network getNetworkForBoundItem(); +} diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/AbstractModInitializer.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/AbstractModInitializer.java index a346ee107..7d8409d4c 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/AbstractModInitializer.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/AbstractModInitializer.java @@ -98,7 +98,7 @@ import com.refinedmods.refinedstorage2.platform.common.support.SimpleBlock; import com.refinedmods.refinedstorage2.platform.common.support.SimpleItem; import com.refinedmods.refinedstorage2.platform.common.support.energy.EnergyLootItemFunction; -import com.refinedmods.refinedstorage2.platform.common.support.network.NetworkNodeContainerBlockEntityImpl; +import com.refinedmods.refinedstorage2.platform.common.support.network.BaseNetworkNodeContainerBlockEntity; import com.refinedmods.refinedstorage2.platform.common.support.network.bounditem.InventorySlotReferenceFactory; import com.refinedmods.refinedstorage2.platform.common.support.network.component.PlatformStorageNetworkComponent; import com.refinedmods.refinedstorage2.platform.common.support.resource.FluidResourceFactory; @@ -521,7 +521,7 @@ protected final void registerBlockEntities( ) { BlockEntities.INSTANCE.setCable(callback.register( CABLE, - () -> typeFactory.create((pos, state) -> new NetworkNodeContainerBlockEntityImpl<>( + () -> typeFactory.create((pos, state) -> new BaseNetworkNodeContainerBlockEntity<>( BlockEntities.INSTANCE.getCable(), pos, state, diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/PlatformApiImpl.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/PlatformApiImpl.java index 803d80feb..1af68b0b1 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/PlatformApiImpl.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/PlatformApiImpl.java @@ -7,6 +7,7 @@ import com.refinedmods.refinedstorage2.api.network.energy.EnergyStorage; import com.refinedmods.refinedstorage2.api.network.impl.NetworkBuilderImpl; import com.refinedmods.refinedstorage2.api.network.impl.NetworkFactory; +import com.refinedmods.refinedstorage2.api.network.node.NetworkNode; import com.refinedmods.refinedstorage2.api.network.security.SecurityPolicy; import com.refinedmods.refinedstorage2.api.resource.ResourceKey; import com.refinedmods.refinedstorage2.platform.api.PlatformApi; @@ -27,7 +28,6 @@ import com.refinedmods.refinedstorage2.platform.api.recipemod.IngredientConverter; import com.refinedmods.refinedstorage2.platform.api.security.BuiltinPermissions; import com.refinedmods.refinedstorage2.platform.api.security.PlatformPermission; -import com.refinedmods.refinedstorage2.platform.api.security.PlatformSecurityNetworkComponent; import com.refinedmods.refinedstorage2.platform.api.storage.StorageContainerItemHelper; import com.refinedmods.refinedstorage2.platform.api.storage.StorageRepository; import com.refinedmods.refinedstorage2.platform.api.storage.StorageType; @@ -35,7 +35,9 @@ import com.refinedmods.refinedstorage2.platform.api.storagemonitor.StorageMonitorExtractionStrategy; import com.refinedmods.refinedstorage2.platform.api.storagemonitor.StorageMonitorInsertionStrategy; import com.refinedmods.refinedstorage2.platform.api.support.energy.EnergyItemHelper; -import com.refinedmods.refinedstorage2.platform.api.support.network.PlatformNetworkNodeContainer; +import com.refinedmods.refinedstorage2.platform.api.support.network.ConnectionLogic; +import com.refinedmods.refinedstorage2.platform.api.support.network.InWorldNetworkNodeContainer; +import com.refinedmods.refinedstorage2.platform.api.support.network.NetworkNodeContainerBlockEntity; import com.refinedmods.refinedstorage2.platform.api.support.network.bounditem.NetworkBoundItemHelper; import com.refinedmods.refinedstorage2.platform.api.support.network.bounditem.SlotReference; import com.refinedmods.refinedstorage2.platform.api.support.network.bounditem.SlotReferenceFactory; @@ -66,6 +68,7 @@ import com.refinedmods.refinedstorage2.platform.common.support.energy.ItemBlockEnergyStorage; import com.refinedmods.refinedstorage2.platform.common.support.energy.ItemEnergyStorage; import com.refinedmods.refinedstorage2.platform.common.support.network.ConnectionProviderImpl; +import com.refinedmods.refinedstorage2.platform.common.support.network.InWorldNetworkNodeContainerImpl; import com.refinedmods.refinedstorage2.platform.common.support.network.bounditem.CompositeSlotReferenceProvider; import com.refinedmods.refinedstorage2.platform.common.support.network.bounditem.InventorySlotReference; import com.refinedmods.refinedstorage2.platform.common.support.network.bounditem.NetworkBoundItemHelperImpl; @@ -90,7 +93,9 @@ import java.util.PriorityQueue; import java.util.Queue; import java.util.Set; +import java.util.function.Supplier; import java.util.stream.Collectors; +import javax.annotation.Nullable; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -288,9 +293,24 @@ public BuiltinUpgradeDestinations getBuiltinUpgradeDestinations() { } @Override - public void requestNetworkNodeInitialization(final PlatformNetworkNodeContainer container, - final Level level, - final Runnable callback) { + public InWorldNetworkNodeContainer createInWorldNetworkNodeContainer( + final BlockEntity blockEntity, + final NetworkNode node, + final String name, + final int priority, + final ConnectionLogic connectionLogic, + @Nullable final Supplier keyProvider + ) { + return new InWorldNetworkNodeContainerImpl(blockEntity, node, name, priority, connectionLogic, keyProvider); + } + + @Override + public void onNetworkNodeContainerInitialized(final InWorldNetworkNodeContainer container, + @Nullable final Level level, + @Nullable final Runnable callback) { + if (level == null || level.isClientSide()) { + return; + } final ConnectionProviderImpl connectionProvider = new ConnectionProviderImpl(level); ServerEventQueue.queue(() -> { // The container could've been removed by the time it has been placed, and by the time the event queue has @@ -298,16 +318,22 @@ public void requestNetworkNodeInitialization(final PlatformNetworkNodeContainer // This is a workaround for the "Carry On" mod. The mod places the block (which creates a block entity and // requests this network node initialization) and then overrides the placed block entity with their own // block entity. This triggers a new initialization, but then this one can no longer run! - if (container.isContainerRemoved()) { + if (container.isRemoved()) { return; } networkBuilder.initialize(container, connectionProvider); - callback.run(); + if (callback != null) { + callback.run(); + } }); } @Override - public void requestNetworkNodeRemoval(final PlatformNetworkNodeContainer container, final Level level) { + public void onNetworkNodeContainerRemoved(final InWorldNetworkNodeContainer container, + @Nullable final Level level) { + if (level == null || level.isClientSide()) { + return; + } // "Carry On" mod places the block (which creates a block entity and requests network node initialization) // and then overrides the placed block entity with their own information. // However, when the placed block entity is replaced, the server event queue hasn't run yet and there is @@ -321,7 +347,11 @@ public void requestNetworkNodeRemoval(final PlatformNetworkNodeContainer contain } @Override - public void requestNetworkNodeUpdate(final PlatformNetworkNodeContainer container, final Level level) { + public void onNetworkNodeContainerUpdated(final InWorldNetworkNodeContainer container, + @Nullable final Level level) { + if (level == null || level.isClientSide() || container.getNode().getNetwork() == null) { + return; + } final ConnectionProviderImpl connectionProvider = new ConnectionProviderImpl(level); networkBuilder.update(container, connectionProvider); } @@ -557,16 +587,10 @@ public boolean canPlaceNetworkNode(final ServerPlayer player, for (final Direction direction : Direction.values()) { final BlockPos adjacentPos = pos.relative(direction); final BlockEntity adjacentBlockEntity = level.getBlockEntity(adjacentPos); - if (!(adjacentBlockEntity instanceof PlatformNetworkNodeContainer platformNetworkNodeContainer) - || !platformNetworkNodeContainer.canAcceptIncomingConnection(direction.getOpposite(), state) - || platformNetworkNodeContainer.getNode().getNetwork() == null) { + if (!(adjacentBlockEntity instanceof NetworkNodeContainerBlockEntity adjacentContainerBlockEntity)) { continue; } - final PlatformSecurityNetworkComponent security = platformNetworkNodeContainer - .getNode() - .getNetwork() - .getComponent(PlatformSecurityNetworkComponent.class); - if (!security.isAllowed(BuiltinPermission.BUILD, player)) { + if (!adjacentContainerBlockEntity.canBuild(player)) { PlatformApi.INSTANCE.sendNoPermissionMessage( player, createTranslation("misc", "no_permission.build.place", state.getBlock().getName()) diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/ConstructorBlockEntity.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/ConstructorBlockEntity.java index 05e3eae2d..4c870f75e 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/ConstructorBlockEntity.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/ConstructorBlockEntity.java @@ -53,7 +53,7 @@ public ConstructorBlockEntity(final BlockPos pos, final BlockState state) { new SimpleNetworkNode(Platform.INSTANCE.getConfig().getConstructor().getEnergyUsage()), UpgradeDestinations.CONSTRUCTOR ); - this.actor = new NetworkNodeActor(getNode()); + this.actor = new NetworkNodeActor(mainNode); } @Override @@ -87,14 +87,14 @@ private ConstructorStrategy createStrategy(final ServerLevel serverLevel, final @Override public void postDoWork() { if (taskExecutor == null - || getNode().getNetwork() == null - || !getNode().isActive() + || mainNode.getNetwork() == null + || !mainNode.isActive() || !(level instanceof ServerLevel serverLevel)) { return; } final Player fakePlayer = getFakePlayer(serverLevel); taskExecutor.execute(tasks, new TaskContext( - getNode().getNetwork(), + mainNode.getNetwork(), fakePlayer )); } @@ -139,7 +139,7 @@ public AbstractContainerMenu createMenu(final int syncId, final Inventory invent @Override protected void setEnergyUsage(final long upgradeEnergyUsage) { final long baseEnergyUsage = Platform.INSTANCE.getConfig().getConstructor().getEnergyUsage(); - getNode().setEnergyUsage(baseEnergyUsage + upgradeEnergyUsage); + mainNode.setEnergyUsage(baseEnergyUsage + upgradeEnergyUsage); } @Override diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/DestructorBlockEntity.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/DestructorBlockEntity.java index 5f90c77bd..f75759a49 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/DestructorBlockEntity.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/constructordestructor/DestructorBlockEntity.java @@ -53,7 +53,7 @@ public DestructorBlockEntity(final BlockPos pos, final BlockState state) { new SimpleNetworkNode(Platform.INSTANCE.getConfig().getDestructor().getEnergyUsage()), UpgradeDestinations.DESTRUCTOR ); - this.actor = new NetworkNodeActor(getNode()); + this.actor = new NetworkNodeActor(mainNode); this.filterWithFuzzyMode = FilterWithFuzzyMode.createAndListenForUniqueFilters( ResourceContainerImpl.createForFilter(), this::setChanged, @@ -105,7 +105,7 @@ public void readConfiguration(final CompoundTag tag) { @Override protected void setEnergyUsage(final long upgradeEnergyUsage) { final long baseEnergyUsage = Platform.INSTANCE.getConfig().getDestructor().getEnergyUsage(); - getNode().setEnergyUsage(baseEnergyUsage + upgradeEnergyUsage); + mainNode.setEnergyUsage(baseEnergyUsage + upgradeEnergyUsage); } @Override @@ -144,13 +144,13 @@ protected void initialize(final ServerLevel level, final Direction direction) { @Override public void postDoWork() { if (strategy == null - || getNode().getNetwork() == null - || !getNode().isActive() + || mainNode.getNetwork() == null + || !mainNode.isActive() || !(level instanceof ServerLevel serverLevel)) { return; } final Player fakePlayer = getFakePlayer(serverLevel); - strategy.apply(filter, actor, getNode()::getNetwork, fakePlayer); + strategy.apply(filter, actor, mainNode::getNetwork, fakePlayer); } @Override diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/BlockEntities.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/BlockEntities.java index 3868df5bb..3d8ccc2a5 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/BlockEntities.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/BlockEntities.java @@ -21,7 +21,7 @@ import com.refinedmods.refinedstorage2.platform.common.storage.storageblock.FluidStorageBlockBlockEntity; import com.refinedmods.refinedstorage2.platform.common.storage.storageblock.ItemStorageBlockBlockEntity; import com.refinedmods.refinedstorage2.platform.common.storagemonitor.StorageMonitorBlockEntity; -import com.refinedmods.refinedstorage2.platform.common.support.network.NetworkNodeContainerBlockEntityImpl; +import com.refinedmods.refinedstorage2.platform.common.support.network.BaseNetworkNodeContainerBlockEntity; import com.refinedmods.refinedstorage2.platform.common.wirelesstransmitter.WirelessTransmitterBlockEntity; import java.util.EnumMap; @@ -37,7 +37,7 @@ public final class BlockEntities { public static final BlockEntities INSTANCE = new BlockEntities(); @Nullable - private Supplier>> cable; + private Supplier>> cable; @Nullable private Supplier> diskDrive; @Nullable @@ -84,12 +84,12 @@ public final class BlockEntities { private BlockEntities() { } - public BlockEntityType> getCable() { + public BlockEntityType> getCable() { return requireNonNull(cable).get(); } public void setCable( - final Supplier>> supplier + final Supplier>> supplier ) { this.cable = supplier; } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/controller/ControllerBlockEntity.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/controller/ControllerBlockEntity.java index e7d99bc8c..151bcea6c 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/controller/ControllerBlockEntity.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/controller/ControllerBlockEntity.java @@ -42,7 +42,7 @@ public ControllerBlockEntity(final ControllerType type, final BlockPos pos, fina super(getBlockEntityType(type), pos, state, new ControllerNetworkNode()); this.type = type; this.energyStorage = createEnergyStorage(type, this); - this.getNode().setEnergyStorage(energyStorage); + this.mainNode.setEnergyStorage(energyStorage); } private static EnergyStorage createEnergyStorage(final ControllerType type, final BlockEntity blockEntity) { @@ -63,7 +63,7 @@ private static BlockEntityType getBlockEntityType(final C public void updateEnergyTypeInLevel(final BlockState state) { final ControllerEnergyType currentEnergyType = state.getValue(AbstractControllerBlock.ENERGY_TYPE); - final ControllerEnergyType newEnergyType = ControllerEnergyType.ofState(getNode().getState()); + final ControllerEnergyType newEnergyType = ControllerEnergyType.ofState(mainNode.getState()); if (newEnergyType != currentEnergyType && level != null && energyStateChangeRateLimiter.tryAcquire()) { LOGGER.debug( "Energy type state change for controller at {}: {} -> {}", @@ -78,12 +78,12 @@ public void updateEnergyTypeInLevel(final BlockState state) { @Override public void saveAdditional(final CompoundTag tag) { super.saveAdditional(tag); - ItemBlockEnergyStorage.writeToTag(tag, getNode().getActualStored()); + ItemBlockEnergyStorage.writeToTag(tag, mainNode.getActualStored()); saveRenderingInfo(tag); } private void saveRenderingInfo(final CompoundTag tag) { - tag.putLong(TAG_CAPACITY, getNode().getActualCapacity()); + tag.putLong(TAG_CAPACITY, mainNode.getActualCapacity()); } @Override @@ -109,11 +109,11 @@ public void writeScreenOpeningData(final ServerPlayer player, final FriendlyByte } long getActualStored() { - return getNode().getActualStored(); + return mainNode.getActualStored(); } long getActualCapacity() { - return getNode().getActualCapacity(); + return mainNode.getActualCapacity(); } @Override diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/detector/DetectorBlockEntity.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/detector/DetectorBlockEntity.java index 87bf4875c..23ffabe08 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/detector/DetectorBlockEntity.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/detector/DetectorBlockEntity.java @@ -57,7 +57,7 @@ public DetectorBlockEntity(final BlockPos pos, final BlockState state) { propagateAmount(); setChanged(); }, - filters -> getNode().setConfiguredResource(filters.isEmpty() ? null : filters.get(0)) + filters -> mainNode.setConfiguredResource(filters.isEmpty() ? null : filters.get(0)) ); initialize(); } @@ -67,7 +67,7 @@ public void writeConfiguration(final CompoundTag tag) { super.writeConfiguration(tag); filter.save(tag); tag.putDouble(TAG_AMOUNT, amount); - tag.putInt(TAG_MODE, DetectorModeSettings.getDetectorMode(getNode().getMode())); + tag.putInt(TAG_MODE, DetectorModeSettings.getDetectorMode(mainNode.getMode())); } @Override @@ -78,7 +78,7 @@ public void readConfiguration(final CompoundTag tag) { this.amount = tag.getDouble(TAG_AMOUNT); } if (tag.contains(TAG_MODE)) { - getNode().setMode(DetectorModeSettings.getDetectorMode(tag.getInt(TAG_MODE))); + mainNode.setMode(DetectorModeSettings.getDetectorMode(tag.getInt(TAG_MODE))); } initialize(); propagateAmount(); @@ -96,7 +96,7 @@ private void propagateAmount() { ? (long) amount : configuredResource.getResourceType().normalizeAmount(amount); LOGGER.debug("Updating detector amount of {} normalized as {}", amount, normalizedAmount); - getNode().setAmount(normalizedAmount); + mainNode.setAmount(normalizedAmount); } boolean isFuzzyMode() { @@ -109,12 +109,12 @@ void setFuzzyMode(final boolean fuzzyMode) { } void setMode(final DetectorMode mode) { - getNode().setMode(mode); + mainNode.setMode(mode); setChanged(); } DetectorMode getMode() { - return getNode().getMode(); + return mainNode.getMode(); } private void initialize() { @@ -122,7 +122,7 @@ private void initialize() { final DetectorAmountStrategy strategy = isFuzzyMode() ? new FuzzyDetectorAmountStrategy(defaultStrategy) : defaultStrategy; - getNode().setAmountStrategy(strategy); + mainNode.setAmountStrategy(strategy); } @Override @@ -144,7 +144,7 @@ public AbstractContainerMenu createMenu(final int syncId, final Inventory invent @Override public void updateActiveness(final BlockState state, @Nullable final BooleanProperty activenessProperty) { super.updateActiveness(state, activenessProperty); - final boolean powered = getNode().isActive() && getNode().isActivated(); + final boolean powered = mainNode.isActive() && mainNode.isActivated(); final boolean needToUpdatePowered = state.getValue(DetectorBlock.POWERED) != powered; if (level != null && needToUpdatePowered && poweredChangeRateLimiter.tryAcquire()) { level.setBlockAndUpdate(getBlockPos(), state.setValue(DetectorBlock.POWERED, powered)); diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/exporter/ExporterBlockEntity.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/exporter/ExporterBlockEntity.java index 36bf2469d..5ea3d2f31 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/exporter/ExporterBlockEntity.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/exporter/ExporterBlockEntity.java @@ -50,7 +50,7 @@ public ExporterBlockEntity(final BlockPos pos, final BlockState state) { protected void initialize(final ServerLevel level, final Direction direction) { final ExporterTransferStrategy strategy = createStrategy(level, direction); LOGGER.debug("Initialized exporter at {} with strategy {}", worldPosition, strategy); - getNode().setTransferStrategy(strategy); + mainNode.setTransferStrategy(strategy); } private ExporterTransferStrategy createStrategy(final ServerLevel serverLevel, final Direction direction) { @@ -75,7 +75,7 @@ private ExporterTransferStrategy createStrategy(final ServerLevel serverLevel, f @Override protected void setEnergyUsage(final long upgradeEnergyUsage) { final long baseEnergyUsage = Platform.INSTANCE.getConfig().getExporter().getEnergyUsage(); - getNode().setEnergyUsage(baseEnergyUsage + upgradeEnergyUsage); + mainNode.setEnergyUsage(baseEnergyUsage + upgradeEnergyUsage); } @Override @@ -91,12 +91,12 @@ public AbstractContainerMenu createMenu(final int syncId, final Inventory invent @Override protected void setTaskExecutor(final TaskExecutor taskExecutor) { - getNode().setTaskExecutor(taskExecutor); + mainNode.setTaskExecutor(taskExecutor); } @Override protected void setFilters(final List filters) { - getNode().setFilters(filters); + mainNode.setFilters(filters); } @Override diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/AbstractGridBlockEntity.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/AbstractGridBlockEntity.java index ba9054fae..525b4dc12 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/AbstractGridBlockEntity.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/AbstractGridBlockEntity.java @@ -14,6 +14,7 @@ import com.refinedmods.refinedstorage2.platform.api.grid.Grid; import com.refinedmods.refinedstorage2.platform.api.security.PlatformSecurityNetworkComponent; import com.refinedmods.refinedstorage2.platform.api.storage.PlayerActor; +import com.refinedmods.refinedstorage2.platform.api.support.network.InWorldNetworkNodeContainer; import com.refinedmods.refinedstorage2.platform.api.support.resource.ResourceType; import com.refinedmods.refinedstorage2.platform.common.support.AbstractDirectionalBlock; import com.refinedmods.refinedstorage2.platform.common.support.containermenu.NetworkNodeMenuProvider; @@ -39,6 +40,18 @@ protected AbstractGridBlockEntity(final BlockEntityType getResources(final Class actorType) { - return requireNonNull(getNode().getNetwork()) + return requireNonNull(mainNode.getNetwork()) .getComponent(StorageNetworkComponent.class) .getResources(actorType); } @Override public GridOperations createOperations(final ResourceType resourceType, final ServerPlayer player) { - final Network network = requireNonNull(getNode().getNetwork()); + final Network network = requireNonNull(mainNode.getNetwork()); final StorageChannel storageChannel = network.getComponent(StorageNetworkComponent.class); final PlatformSecurityNetworkComponent security = network.getComponent(PlatformSecurityNetworkComponent.class); final GridOperations operations = resourceType.createGridOperations(storageChannel, new PlayerActor(player)); @@ -62,27 +75,22 @@ public GridOperations createOperations(final ResourceType resourceType, final Se @Override public boolean isGridActive() { - return getNode().isActive(); + return mainNode.isActive(); } @Override public Storage getItemStorage() { - return requireNonNull(getNode().getNetwork()).getComponent(StorageNetworkComponent.class); + return requireNonNull(mainNode.getNetwork()).getComponent(StorageNetworkComponent.class); } @Override public void addWatcher(final GridWatcher watcher, final Class actorType) { - getNode().addWatcher(watcher, actorType); + mainNode.addWatcher(watcher, actorType); } @Override public void removeWatcher(final GridWatcher watcher) { - getNode().removeWatcher(watcher); - } - - @Override - public final int getPriority() { - return NetworkNodeContainerPriorities.GRID; + mainNode.removeWatcher(watcher); } @Override diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/CraftingGridBlockEntity.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/CraftingGridBlockEntity.java index e331a52e4..8b092ef68 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/CraftingGridBlockEntity.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/CraftingGridBlockEntity.java @@ -2,7 +2,6 @@ import com.refinedmods.refinedstorage2.api.core.Action; import com.refinedmods.refinedstorage2.api.network.Network; -import com.refinedmods.refinedstorage2.api.network.impl.node.grid.GridNetworkNode; import com.refinedmods.refinedstorage2.api.network.storage.StorageNetworkComponent; import com.refinedmods.refinedstorage2.api.storage.channel.StorageChannel; import com.refinedmods.refinedstorage2.platform.api.storage.PlayerActor; @@ -129,11 +128,10 @@ public void setLevel(final Level level) { } Optional getNetwork() { - final GridNetworkNode node = getNode(); - if (!node.isActive()) { + if (!mainNode.isActive()) { return Optional.empty(); } - return Optional.ofNullable(node.getNetwork()); + return Optional.ofNullable(mainNode.getNetwork()); } Optional getStorageChannel() { diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/iface/InterfaceBlockEntity.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/iface/InterfaceBlockEntity.java index c09b5ad03..71a15ddaa 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/iface/InterfaceBlockEntity.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/iface/InterfaceBlockEntity.java @@ -49,13 +49,13 @@ public InterfaceBlockEntity(final BlockPos pos, final BlockState state) { state, new InterfaceNetworkNode(Platform.INSTANCE.getConfig().getInterface().getEnergyUsage()) ); - getNode().setTransferQuotaProvider(InterfaceBlockEntity::getTransferQuota); + this.mainNode.setTransferQuotaProvider(InterfaceBlockEntity::getTransferQuota); this.filter = FilterWithFuzzyMode.create(createFilterContainer(), this::setChanged); this.exportedResources = createExportedResourcesContainer(filter); this.exportedResources.setListener(this::setChanged); - getNode().setExportState(exportedResources); + this.mainNode.setExportState(exportedResources); this.exportedResourcesAsContainer = exportedResources.toItemContainer(); - this.externalStorageProvider = new InterfaceExternalStorageProviderImpl(getNode()); + this.externalStorageProvider = new InterfaceExternalStorageProviderImpl(mainNode); } static ResourceContainer createFilterContainer() { @@ -156,4 +156,8 @@ public NonNullList getDrops() { InterfaceExternalStorageProvider getExternalStorageProvider() { return externalStorageProvider; } + + InterfaceNetworkNode getInterface() { + return mainNode; + } } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/iface/InterfaceProxyExternalStorageProvider.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/iface/InterfaceProxyExternalStorageProvider.java index 329681e7c..4eeaf204f 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/iface/InterfaceProxyExternalStorageProvider.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/iface/InterfaceProxyExternalStorageProvider.java @@ -6,7 +6,6 @@ import com.refinedmods.refinedstorage2.api.resource.ResourceAmount; import com.refinedmods.refinedstorage2.api.resource.ResourceKey; import com.refinedmods.refinedstorage2.api.storage.Actor; -import com.refinedmods.refinedstorage2.platform.api.support.network.AbstractNetworkNodeContainerBlockEntity; import java.util.Collections; import java.util.Iterator; @@ -54,6 +53,6 @@ public Iterator iterator() { @Override @Nullable public InterfaceNetworkNode getInterface() { - return tryGetInterface().map(AbstractNetworkNodeContainerBlockEntity::getNode).orElse(null); + return tryGetInterface().map(InterfaceBlockEntity::getInterface).orElse(null); } } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/importer/ImporterBlockEntity.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/importer/ImporterBlockEntity.java index 20aedfa69..1945dfab1 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/importer/ImporterBlockEntity.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/importer/ImporterBlockEntity.java @@ -57,16 +57,16 @@ public ImporterBlockEntity(final BlockPos pos, final BlockState state) { this.filter = FilterWithFuzzyMode.createAndListenForUniqueFilters( ResourceContainerImpl.createForFilter(), this::setChanged, - filters -> getNode().setFilters(filters) + mainNode::setFilters ); - getNode().setNormalizer(filter.createNormalizer()); + this.mainNode.setNormalizer(filter.createNormalizer()); } @Override protected void initialize(final ServerLevel level, final Direction direction) { final List strategies = createStrategies(level, direction); LOGGER.debug("Initialized importer at {} with strategies {}", worldPosition, strategies); - getNode().setTransferStrategies(strategies); + mainNode.setTransferStrategies(strategies); } private List createStrategies(final ServerLevel serverLevel, final Direction direction) { @@ -83,7 +83,7 @@ private List createStrategies(final ServerLevel server @Override public void writeConfiguration(final CompoundTag tag) { super.writeConfiguration(tag); - tag.putInt(TAG_FILTER_MODE, FilterModeSettings.getFilterMode(getNode().getFilterMode())); + tag.putInt(TAG_FILTER_MODE, FilterModeSettings.getFilterMode(mainNode.getFilterMode())); filter.save(tag); } @@ -91,7 +91,7 @@ public void writeConfiguration(final CompoundTag tag) { public void readConfiguration(final CompoundTag tag) { super.readConfiguration(tag); if (tag.contains(TAG_FILTER_MODE)) { - getNode().setFilterMode(FilterModeSettings.getFilterMode(tag.getInt(TAG_FILTER_MODE))); + mainNode.setFilterMode(FilterModeSettings.getFilterMode(tag.getInt(TAG_FILTER_MODE))); } filter.load(tag); } @@ -105,18 +105,18 @@ void setFuzzyMode(final boolean fuzzyMode) { } FilterMode getFilterMode() { - return getNode().getFilterMode(); + return mainNode.getFilterMode(); } void setFilterMode(final FilterMode mode) { - getNode().setFilterMode(mode); + mainNode.setFilterMode(mode); setChanged(); } @Override protected void setEnergyUsage(final long upgradeEnergyUsage) { final long baseEnergyUsage = Platform.INSTANCE.getConfig().getImporter().getEnergyUsage(); - getNode().setEnergyUsage(baseEnergyUsage + upgradeEnergyUsage); + mainNode.setEnergyUsage(baseEnergyUsage + upgradeEnergyUsage); } @Override diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/CableBlock.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/CableBlock.java index 06ecfa786..7cad3973c 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/CableBlock.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/CableBlock.java @@ -13,8 +13,8 @@ import com.refinedmods.refinedstorage2.platform.common.support.CableShapeCacheKey; import com.refinedmods.refinedstorage2.platform.common.support.ColorableBlock; import com.refinedmods.refinedstorage2.platform.common.support.NetworkNodeBlockItem; +import com.refinedmods.refinedstorage2.platform.common.support.network.BaseNetworkNodeContainerBlockEntity; import com.refinedmods.refinedstorage2.platform.common.support.network.NetworkNodeBlockEntityTicker; -import com.refinedmods.refinedstorage2.platform.common.support.network.NetworkNodeContainerBlockEntityImpl; import javax.annotation.Nullable; @@ -43,7 +43,7 @@ public class CableBlock extends AbstractColoredBlock implements ColorableBlock, SimpleWaterloggedBlock, EntityBlock { - private static final AbstractBlockEntityTicker> TICKER = + private static final AbstractBlockEntityTicker> TICKER = new NetworkNodeBlockEntityTicker<>(BlockEntities.INSTANCE::getCable); public CableBlock(final DyeColor color, final MutableComponent name) { @@ -111,7 +111,7 @@ public VoxelShape getShape(final BlockState state, @Override public BlockEntity newBlockEntity(final BlockPos pos, final BlockState state) { - return new NetworkNodeContainerBlockEntityImpl<>( + return new BaseNetworkNodeContainerBlockEntity<>( BlockEntities.INSTANCE.getCable(), pos, state, diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/NetworkReceiverBlockEntity.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/NetworkReceiverBlockEntity.java index 920d77dc4..60beefc08 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/NetworkReceiverBlockEntity.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/NetworkReceiverBlockEntity.java @@ -1,16 +1,16 @@ package com.refinedmods.refinedstorage2.platform.common.networking; import com.refinedmods.refinedstorage2.api.network.impl.node.SimpleNetworkNode; +import com.refinedmods.refinedstorage2.platform.api.PlatformApi; +import com.refinedmods.refinedstorage2.platform.api.support.network.InWorldNetworkNodeContainer; import com.refinedmods.refinedstorage2.platform.common.Platform; import com.refinedmods.refinedstorage2.platform.common.content.BlockEntities; -import com.refinedmods.refinedstorage2.platform.common.support.network.NetworkNodeContainerBlockEntityImpl; - -import javax.annotation.Nullable; +import com.refinedmods.refinedstorage2.platform.common.support.network.BaseNetworkNodeContainerBlockEntity; import net.minecraft.core.BlockPos; import net.minecraft.world.level.block.state.BlockState; -public class NetworkReceiverBlockEntity extends NetworkNodeContainerBlockEntityImpl { +public class NetworkReceiverBlockEntity extends BaseNetworkNodeContainerBlockEntity { public NetworkReceiverBlockEntity(final BlockPos pos, final BlockState state) { super( BlockEntities.INSTANCE.getNetworkReceiver(), @@ -20,9 +20,15 @@ public NetworkReceiverBlockEntity(final BlockPos pos, final BlockState state) { ); } - @Nullable @Override - public Object createKey() { - return new NetworkReceiverKey(getContainerPosition()); + protected InWorldNetworkNodeContainer createMainContainer(final SimpleNetworkNode node) { + return PlatformApi.INSTANCE.createInWorldNetworkNodeContainer( + this, + node, + MAIN_CONTAINER_NAME, + 0, + this, + () -> new NetworkReceiverKey(mainContainer.getPosition()) + ); } } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/NetworkTransmitterBlockEntity.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/NetworkTransmitterBlockEntity.java index 37ad5e2cf..4433c8323 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/NetworkTransmitterBlockEntity.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/NetworkTransmitterBlockEntity.java @@ -64,11 +64,11 @@ public NetworkTransmitterBlockEntity(final BlockPos pos, final BlockState state) Platform.INSTANCE.getConfig().getNetworkTransmitter().getEnergyUsage() )); networkCardInventory.addListener(container -> { - setChanged(); updateReceiverLocation(); if (level != null) { LOGGER.debug("Network card was changed at {}, sending network update", worldPosition); - PlatformApi.INSTANCE.requestNetworkNodeUpdate(this, level); + setChanged(); + PlatformApi.INSTANCE.onNetworkNodeContainerUpdated(mainContainer, level); } }); } @@ -76,10 +76,7 @@ public NetworkTransmitterBlockEntity(final BlockPos pos, final BlockState state) @Override protected void activenessChanged(final boolean newActive) { super.activenessChanged(newActive); - if (level == null) { - return; - } - PlatformApi.INSTANCE.requestNetworkNodeUpdate(this, level); + PlatformApi.INSTANCE.onNetworkNodeContainerUpdated(mainContainer, level); } public void updateStateInLevel(final BlockState state) { @@ -98,7 +95,7 @@ private NetworkTransmitterState getState() { if (receiverKey == null) { return NetworkTransmitterState.ERROR; } - final Network network = getNode().getNetwork(); + final Network network = mainNode.getNetwork(); if (network == null) { return NetworkTransmitterState.ERROR; } @@ -107,7 +104,7 @@ private NetworkTransmitterState getState() { } NetworkTransmitterStatus getStatus() { - final Network network = getNode().getNetwork(); + final Network network = mainNode.getNetwork(); if (!isActive() || network == null || level == null) { return INACTIVE; } @@ -129,25 +126,22 @@ NetworkTransmitterStatus getStatus() { @Override public void doWork() { super.doWork(); - if (!isActive() || getNode().getNetwork() == null || receiverKey == null) { + if (!isActive() || mainNode.getNetwork() == null || receiverKey == null) { return; } - final boolean receiverFound = isReceiverFoundInNetwork(getNode().getNetwork(), receiverKey); + final boolean receiverFound = isReceiverFoundInNetwork(mainNode.getNetwork(), receiverKey); if (!receiverFound && networkRebuildRetryRateLimiter.tryAcquire()) { tryReconnectingWithReceiver(); } } private void tryReconnectingWithReceiver() { - if (level == null) { - return; - } LOGGER.debug( "Receiver {} was not found in network for transmitter at {}, retrying and sending network update", receiverKey, worldPosition ); - PlatformApi.INSTANCE.requestNetworkNodeUpdate(this, level); + PlatformApi.INSTANCE.onNetworkNodeContainerUpdated(mainContainer, level); } private static boolean isReceiverFoundInNetwork(final Network network, final NetworkReceiverKey key) { diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/security/SecurityManagerBlockEntity.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/security/SecurityManagerBlockEntity.java index 929c2a1bc..cceb99850 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/security/SecurityManagerBlockEntity.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/security/SecurityManagerBlockEntity.java @@ -60,7 +60,7 @@ public SecurityManagerBlockEntity(final BlockPos pos, final BlockState state) { ); securityCards.addListener(c -> invalidate()); fallbackSecurityCard.addListener(c -> invalidate()); - getNode().setDelegate(securityDecisionProvider); + mainNode.setDelegate(securityDecisionProvider); } private void invalidate() { @@ -80,7 +80,7 @@ private void invalidate() { actor -> securityDecisionProvider.setPolicy(actor, policy))); } energyUsage += updateDefaultPolicyAndGetEnergyUsage(); - getNode().setEnergyUsage(energyUsage); + mainNode.setEnergyUsage(energyUsage); } private long updateDefaultPolicyAndGetEnergyUsage() { @@ -161,13 +161,13 @@ public AbstractContainerMenu createMenu(final int syncId, final Inventory invent @Override public boolean canOpen(final ServerPlayer player) { final boolean isAllowedViaSecuritySystem = NetworkNodeMenuProvider.super.canOpen(player) - && SecurityHelper.isAllowed(player, BuiltinPermission.SECURITY, getNode()); + && SecurityHelper.isAllowed(player, BuiltinPermission.SECURITY, getContainers()); return isAllowedViaSecuritySystem || isPlacedBy(player.getGameProfile().getId()); } @Override - public boolean canBreakOrRotate(final ServerPlayer player) { - return super.canBreakOrRotate(player) || isPlacedBy(player.getGameProfile().getId()); + public boolean canBuild(final ServerPlayer player) { + return super.canBuild(player) || isPlacedBy(player.getGameProfile().getId()); } @Override diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/AbstractDiskDriveBlockEntity.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/AbstractDiskDriveBlockEntity.java index 872113d49..ca814bdb5 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/AbstractDiskDriveBlockEntity.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/diskdrive/AbstractDiskDriveBlockEntity.java @@ -60,21 +60,24 @@ protected AbstractDiskDriveBlockEntity(final BlockPos pos, final BlockState stat Platform.INSTANCE.getConfig().getDiskDrive().getEnergyUsagePerDisk(), AMOUNT_OF_DISKS )); - this.diskInventory = new DiskInventory((inventory, slot) -> onDiskChanged(slot), getNode().getSize()); + this.diskInventory = new DiskInventory((inventory, slot) -> onDiskChanged(slot), mainNode.getSize()); this.filter = FilterWithFuzzyMode.createAndListenForUniqueFilters( ResourceContainerImpl.createForFilter(), this::setChanged, - filters -> getNode().setFilters(filters) + mainNode::setFilters ); this.configContainer = new StorageConfigurationContainerImpl( - getNode(), + mainNode, filter, this::setChanged, this::getRedstoneMode, this::setRedstoneMode ); - getNode().setListener(diskStateListener); - getNode().setNormalizer(filter.createNormalizer()); + this.mainNode.setListener(diskStateListener); + this.mainNode.setNormalizer(filter.createNormalizer()); + // It's important to sync here as the initial update packet might have failed as the network + // could possibly be not initialized yet. + this.initializationCallback = diskStateListener::immediateUpdate; } @Nullable @@ -123,7 +126,7 @@ public void setChanged() { private void initialize(final Level level) { diskInventory.setStorageRepository(PlatformApi.INSTANCE.getStorageRepository(level)); - getNode().setProvider(diskInventory); + mainNode.setProvider(diskInventory); } @Override @@ -169,23 +172,15 @@ private void onDiskChanged(final int slot) { // Level will not yet be present final boolean isJustPlacedIntoLevelOrLoading = level == null || level.isClientSide(); // Level will be present, but network not yet - final boolean isPlacedThroughDismantlingMode = getNode().getNetwork() == null; + final boolean isPlacedThroughDismantlingMode = mainNode.getNetwork() == null; if (isJustPlacedIntoLevelOrLoading || isPlacedThroughDismantlingMode) { return; } - getNode().onStorageChanged(slot); + mainNode.onStorageChanged(slot); diskStateListener.immediateUpdate(); setChanged(); } - @Override - protected void onNetworkInNodeInitialized() { - super.onNetworkInNodeInitialized(); - // It's important to sync here as the initial update packet might have failed as the network - // could possibly be not initialized yet. - diskStateListener.immediateUpdate(); - } - private void fromClientTag(final CompoundTag tag) { if (!tag.contains(TAG_DISKS)) { return; @@ -207,10 +202,10 @@ public Packet getUpdatePacket() { public CompoundTag getUpdateTag() { final CompoundTag tag = new CompoundTag(); // This null check is important. #getUpdateTag() can be called before the node's network is initialized! - if (getNode().getNetwork() == null) { + if (mainNode.getNetwork() == null) { return tag; } - tag.put(TAG_DISKS, diskInventory.toSyncTag(getNode()::getState)); + tag.put(TAG_DISKS, diskInventory.toSyncTag(mainNode::getState)); return tag; } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/externalstorage/ExternalStorageBlockEntity.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/externalstorage/ExternalStorageBlockEntity.java index d037b1834..f29fcb6fd 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/externalstorage/ExternalStorageBlockEntity.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/externalstorage/ExternalStorageBlockEntity.java @@ -50,12 +50,12 @@ public ExternalStorageBlockEntity(final BlockPos pos, final BlockState state) { this.filter = FilterWithFuzzyMode.createAndListenForUniqueFilters( ResourceContainerImpl.createForFilter(), this::setChanged, - filters -> getNode().setFilters(filters) + mainNode::setFilters ); - getNode().setNormalizer(filter.createNormalizer()); - getNode().setTrackingRepository(trackedStorageRepository); + mainNode.setNormalizer(filter.createNormalizer()); + mainNode.setTrackingRepository(trackedStorageRepository); this.configContainer = new StorageConfigurationContainerImpl( - getNode(), + mainNode, filter, this::setChanged, this::getRedstoneMode, @@ -89,7 +89,7 @@ void loadStorage(final ServerLevel serverLevel) { if (direction == null) { return; } - getNode().initialize(() -> { + mainNode.initialize(() -> { final Direction incomingDirection = direction.getOpposite(); final BlockPos sourcePosition = worldPosition.relative(direction); return PlatformApi.INSTANCE @@ -104,7 +104,7 @@ void loadStorage(final ServerLevel serverLevel) { public void doWork() { super.doWork(); if (workRate.canDoWork()) { - final boolean hasChanges = getNode().detectChanges(); + final boolean hasChanges = mainNode.detectChanges(); if (hasChanges) { LOGGER.debug("External storage @ {} has changed!", worldPosition); workRate.faster(); diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/storageblock/AbstractStorageBlockBlockEntity.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/storageblock/AbstractStorageBlockBlockEntity.java index 4063cd07a..c0d533097 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/storageblock/AbstractStorageBlockBlockEntity.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/storageblock/AbstractStorageBlockBlockEntity.java @@ -49,16 +49,16 @@ protected AbstractStorageBlockBlockEntity(final BlockEntityType type, this.filter = FilterWithFuzzyMode.createAndListenForUniqueFilters( ResourceContainerImpl.createForFilter(resourceFactory), this::setChanged, - filters -> getNode().setFilters(filters) + mainNode::setFilters ); this.configContainer = new StorageConfigurationContainerImpl( - getNode(), + mainNode, filter, this::setChanged, this::getRedstoneMode, this::setRedstoneMode ); - getNode().setNormalizer(filter.createNormalizer()); + mainNode.setNormalizer(filter.createNormalizer()); } protected abstract Storage createStorage(Runnable listener); @@ -80,11 +80,11 @@ public void setLevel(final Level level) { storageId = UUID.randomUUID(); final Storage storage = createStorage(storageRepository::markAsChanged); storageRepository.set(storageId, storage); - getNode().setStorage(storage); + mainNode.setStorage(storage); } else { // The existing block entity got loaded in the level (#load(CompoundTag) -> #setLevel(Level)). storageRepository.get(storageId).ifPresentOrElse( - storage -> getNode().setStorage(storage), + mainNode::setStorage, () -> LOGGER.warn("Storage {} could not be resolved", storageId) ); } @@ -136,7 +136,7 @@ private void cleanupUnneededInitialStorageAndReinitialize(final UUID actualStora () -> LOGGER.warn("Unneeded storage {} could not be removed", storageId) ); storageRepository.get(actualStorageId).ifPresentOrElse( - storage -> getNode().setStorage(storage), + mainNode::setStorage, () -> LOGGER.warn("Actual storage ID {} could not be resolved!", actualStorageId) ); } @@ -173,8 +173,8 @@ protected final ResourceContainer getFilterContainer() { @Override public void writeScreenOpeningData(final ServerPlayer player, final FriendlyByteBuf buf) { - buf.writeLong(getNode().getStored()); - buf.writeLong(getNode().getCapacity()); + buf.writeLong(mainNode.getStored()); + buf.writeLong(mainNode.getCapacity()); filter.getFilterContainer().writeToUpdatePacket(buf); } } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storagemonitor/StorageMonitorBlockEntity.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storagemonitor/StorageMonitorBlockEntity.java index 316f0cd16..1043d23cb 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storagemonitor/StorageMonitorBlockEntity.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storagemonitor/StorageMonitorBlockEntity.java @@ -79,7 +79,7 @@ public void doWork() { private void trySendDisplayUpdate(final Level level) { final long amount = getAmount(); - final boolean active = getNode().isActive(); + final boolean active = mainNode.isActive(); if ((amount != currentAmount || active != currentlyActive) && displayUpdateRateLimiter.tryAcquire()) { sendDisplayUpdate(level, amount, active); } @@ -90,7 +90,7 @@ private long getAmount() { if (configuredResource == null) { return 0; } - final Network network = getNode().getNetwork(); + final Network network = mainNode.getNetwork(); if (network == null) { return 0; } @@ -109,7 +109,7 @@ public void extract(final Player player) { if (level == null) { return; } - final Network network = getNode().getNetwork(); + final Network network = mainNode.getNetwork(); if (network == null) { return; } @@ -154,7 +154,7 @@ public void insert(final Player player, final InteractionHand hand) { } private boolean doInsert(final Player player, final InteractionHand hand) { - final Network network = getNode().getNetwork(); + final Network network = mainNode.getNetwork(); if (network == null) { return false; } @@ -195,7 +195,7 @@ private boolean doInsertAll(final Player player) { } private boolean doInsertAll(final Player player, final ItemResource lastInsertedItem) { - final Network network = getNode().getNetwork(); + final Network network = mainNode.getNetwork(); if (network == null) { return false; } @@ -313,7 +313,7 @@ private void sendDisplayUpdate() { if (level == null) { return; } - sendDisplayUpdate(level, getAmount(), getNode().isActive()); + sendDisplayUpdate(level, getAmount(), mainNode.isActive()); } private void sendDisplayUpdate(final Level level, final long amount, final boolean active) { diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/AbstractBaseBlock.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/AbstractBaseBlock.java index 59909a309..220180bcf 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/AbstractBaseBlock.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/AbstractBaseBlock.java @@ -1,8 +1,7 @@ package com.refinedmods.refinedstorage2.platform.common.support; -import com.refinedmods.refinedstorage2.api.network.Network; import com.refinedmods.refinedstorage2.platform.api.PlatformApi; -import com.refinedmods.refinedstorage2.platform.api.support.network.PlatformNetworkNodeContainer; +import com.refinedmods.refinedstorage2.platform.api.support.network.NetworkNodeContainerBlockEntity; import com.refinedmods.refinedstorage2.platform.common.Platform; import com.refinedmods.refinedstorage2.platform.common.content.BlockColorMap; import com.refinedmods.refinedstorage2.platform.common.content.Sounds; @@ -12,7 +11,6 @@ import javax.annotation.Nullable; import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; import net.minecraft.server.level.ServerPlayer; import net.minecraft.sounds.SoundSource; import net.minecraft.world.Containers; @@ -185,41 +183,19 @@ private boolean rotate(final BlockState state, final BlockPos pos, final ServerPlayer player) { final BlockEntity blockEntity = level.getBlockEntity(pos); - if (blockEntity instanceof PlatformNetworkNodeContainer platformNetworkNodeContainer) { - final Network network = platformNetworkNodeContainer.getNode().getNetwork(); - if (!platformNetworkNodeContainer.canBreakOrRotate(player) - || mightMakeConnectionWithAnotherSecuredNetwork(level, pos, player, network)) { - PlatformApi.INSTANCE.sendNoPermissionMessage( - player, - createTranslation("misc", "no_permission.build.rotate", getName()) - ); - return false; - } + if (blockEntity instanceof NetworkNodeContainerBlockEntity networkNodeContainerBlockEntity + && !networkNodeContainerBlockEntity.canBuild(player)) { + PlatformApi.INSTANCE.sendNoPermissionMessage( + player, + createTranslation("misc", "no_permission.build.rotate", getName()) + ); + return false; } final BlockState rotated = getRotatedBlockState(state, level, pos); level.setBlockAndUpdate(pos, rotated); return !state.equals(rotated); } - private boolean mightMakeConnectionWithAnotherSecuredNetwork(final Level level, - final BlockPos pos, - final ServerPlayer player, - @Nullable final Network rotatedNetwork) { - for (final Direction direction : Direction.values()) { - final BlockPos neighborPos = pos.relative(direction); - final BlockEntity neighborBlockEntity = level.getBlockEntity(neighborPos); - if (neighborBlockEntity instanceof PlatformNetworkNodeContainer neighborNetworkNodeContainer - && neighborNetworkNodeContainer.getNode().getNetwork() != rotatedNetwork) { - PlatformApi.INSTANCE.sendNoPermissionMessage( - player, - createTranslation("misc", "no_permission.build.rotate", getName()) - ); - return true; - } - } - return false; - } - @SuppressWarnings("deprecation") protected BlockState getRotatedBlockState(final BlockState state, final Level level, final BlockPos pos) { return state.rotate(Rotation.CLOCKWISE_90); @@ -234,8 +210,8 @@ private boolean dismantle(final BlockState state, final BlockHitResult hitResult, final ServerPlayer player) { final BlockEntity blockEntity = level.getBlockEntity(hitResult.getBlockPos()); - if (blockEntity instanceof PlatformNetworkNodeContainer platformNetworkNodeContainer - && !platformNetworkNodeContainer.canBreakOrRotate(player)) { + if (blockEntity instanceof NetworkNodeContainerBlockEntity networkNodeContainerBlockEntity + && !networkNodeContainerBlockEntity.canBuild(player)) { PlatformApi.INSTANCE.sendNoPermissionMessage( player, createTranslation("misc", "no_permission.build.dismantle", getName()) diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/CableBlockSupport.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/CableBlockSupport.java index d43160251..0142bc472 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/CableBlockSupport.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/CableBlockSupport.java @@ -1,6 +1,6 @@ package com.refinedmods.refinedstorage2.platform.common.support; -import com.refinedmods.refinedstorage2.platform.api.support.network.PlatformNetworkNodeContainer; +import com.refinedmods.refinedstorage2.platform.api.support.network.NetworkNodeContainerBlockEntity; import java.util.HashMap; import java.util.Map; @@ -114,9 +114,11 @@ private static boolean hasVisualConnection( return false; } final BlockPos offsetPos = pos.relative(direction); - if (!(level.getBlockEntity(offsetPos) instanceof PlatformNetworkNodeContainer neighboringContainer)) { + if (!(level.getBlockEntity(offsetPos) instanceof NetworkNodeContainerBlockEntity neighbor)) { return false; } - return neighboringContainer.canAcceptIncomingConnection(direction.getOpposite(), blockState); + return neighbor.getContainers() + .stream() + .anyMatch(container -> container.canAcceptIncomingConnection(direction.getOpposite(), blockState)); } } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/containermenu/NetworkNodeMenuProvider.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/containermenu/NetworkNodeMenuProvider.java index c24cd3bb6..f8b3338d3 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/containermenu/NetworkNodeMenuProvider.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/containermenu/NetworkNodeMenuProvider.java @@ -1,15 +1,17 @@ package com.refinedmods.refinedstorage2.platform.common.support.containermenu; -import com.refinedmods.refinedstorage2.api.network.node.NetworkNode; import com.refinedmods.refinedstorage2.platform.api.security.SecurityHelper; +import com.refinedmods.refinedstorage2.platform.api.support.network.InWorldNetworkNodeContainer; import com.refinedmods.refinedstorage2.platform.common.security.BuiltinPermission; +import java.util.Set; + import net.minecraft.server.level.ServerPlayer; public interface NetworkNodeMenuProvider extends ExtendedMenuProvider { - NetworkNode getNode(); + Set getContainers(); default boolean canOpen(final ServerPlayer player) { - return SecurityHelper.isAllowed(player, BuiltinPermission.OPEN, getNode()); + return SecurityHelper.isAllowed(player, BuiltinPermission.OPEN, getContainers()); } } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/AbstractRedstoneModeNetworkNodeContainerBlockEntity.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/AbstractRedstoneModeNetworkNodeContainerBlockEntity.java index d2d53be3e..f4393f4fa 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/AbstractRedstoneModeNetworkNodeContainerBlockEntity.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/AbstractRedstoneModeNetworkNodeContainerBlockEntity.java @@ -19,7 +19,7 @@ import net.minecraft.world.level.block.state.BlockState; public abstract class AbstractRedstoneModeNetworkNodeContainerBlockEntity - extends NetworkNodeContainerBlockEntityImpl implements PlayerAwareBlockEntity, ConfigurationCardTarget { + extends BaseNetworkNodeContainerBlockEntity implements PlayerAwareBlockEntity, ConfigurationCardTarget { private static final String TAG_REDSTONE_MODE = "rm"; private static final String TAG_PLACED_BY_PLAYER_ID = "pbpid"; diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/NetworkNodeContainerBlockEntityImpl.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/BaseNetworkNodeContainerBlockEntity.java similarity index 83% rename from refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/NetworkNodeContainerBlockEntityImpl.java rename to refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/BaseNetworkNodeContainerBlockEntity.java index 47e629a7c..25b5f6978 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/NetworkNodeContainerBlockEntityImpl.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/BaseNetworkNodeContainerBlockEntity.java @@ -1,10 +1,13 @@ package com.refinedmods.refinedstorage2.platform.common.support.network; +import com.refinedmods.refinedstorage2.api.network.Network; import com.refinedmods.refinedstorage2.api.network.energy.EnergyNetworkComponent; import com.refinedmods.refinedstorage2.api.network.impl.storage.AbstractNetworkNode; import com.refinedmods.refinedstorage2.platform.api.PlatformApi; import com.refinedmods.refinedstorage2.platform.api.support.network.AbstractNetworkNodeContainerBlockEntity; +import com.refinedmods.refinedstorage2.platform.api.support.network.ConnectionLogic; import com.refinedmods.refinedstorage2.platform.api.support.network.ConnectionSink; +import com.refinedmods.refinedstorage2.platform.api.support.network.bounditem.NetworkBoundItemTargetBlockEntity; import com.refinedmods.refinedstorage2.platform.common.support.AbstractDirectionalBlock; import com.refinedmods.refinedstorage2.platform.common.support.ColorableBlock; @@ -19,13 +22,14 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class NetworkNodeContainerBlockEntityImpl - extends AbstractNetworkNodeContainerBlockEntity { - private static final Logger LOGGER = LoggerFactory.getLogger(NetworkNodeContainerBlockEntityImpl.class); +public class BaseNetworkNodeContainerBlockEntity + extends AbstractNetworkNodeContainerBlockEntity + implements ConnectionLogic, NetworkBoundItemTargetBlockEntity { + private static final Logger LOGGER = LoggerFactory.getLogger(BaseNetworkNodeContainerBlockEntity.class); private final RateLimiter activenessChangeRateLimiter = RateLimiter.create(1); - public NetworkNodeContainerBlockEntityImpl(final BlockEntityType type, + public BaseNetworkNodeContainerBlockEntity(final BlockEntityType type, final BlockPos pos, final BlockState state, final T networkNode) { @@ -33,16 +37,16 @@ public NetworkNodeContainerBlockEntityImpl(final BlockEntityType type, } protected boolean isActive() { - final long energyUsage = getNode().getEnergyUsage(); + final long energyUsage = mainNode.getEnergyUsage(); final boolean hasLevel = level != null && level.isLoaded(worldPosition); return hasLevel - && getNode().getNetwork() != null - && getNode().getNetwork().getComponent(EnergyNetworkComponent.class).getStored() >= energyUsage; + && mainNode.getNetwork() != null + && mainNode.getNetwork().getComponent(EnergyNetworkComponent.class).getStored() >= energyUsage; } public void updateActiveness(final BlockState state, @Nullable final BooleanProperty activenessProperty) { final boolean newActive = isActive(); - final boolean nodeActivenessNeedsUpdate = newActive != getNode().isActive(); + final boolean nodeActivenessNeedsUpdate = newActive != mainNode.isActive(); final boolean blockStateActivenessNeedsUpdate = activenessProperty != null && state.getValue(activenessProperty) != newActive; final boolean activenessNeedsUpdate = nodeActivenessNeedsUpdate || blockStateActivenessNeedsUpdate; @@ -57,8 +61,8 @@ public void updateActiveness(final BlockState state, @Nullable final BooleanProp } protected void activenessChanged(final boolean newActive) { - LOGGER.debug("Activeness change for node at {}: {} -> {}", getBlockPos(), getNode().isActive(), newActive); - getNode().setActive(newActive); + LOGGER.debug("Activeness change for node at {}: {} -> {}", getBlockPos(), mainNode.isActive(), newActive); + mainNode.setActive(newActive); } private void updateActivenessBlockState(final BlockState state, @@ -76,7 +80,7 @@ private void updateActivenessBlockState(final BlockState state, } public void doWork() { - getNode().doWork(); + mainNode.doWork(); } @Override @@ -151,9 +155,12 @@ public void setBlockState(final BlockState newBlockState) { if (!doesBlockStateChangeWarrantNetworkNodeUpdate(oldBlockState, newBlockState)) { return; } - if (level == null || level.isClientSide || getNode().getNetwork() == null) { - return; - } - PlatformApi.INSTANCE.requestNetworkNodeUpdate(this, level); + PlatformApi.INSTANCE.onNetworkNodeContainerUpdated(mainContainer, level); + } + + @Nullable + @Override + public Network getNetworkForBoundItem() { + return mainNode.getNetwork(); } } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/ConnectionProviderImpl.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/ConnectionProviderImpl.java index 4c0abfa92..0e8f528e9 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/ConnectionProviderImpl.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/ConnectionProviderImpl.java @@ -3,13 +3,16 @@ import com.refinedmods.refinedstorage2.api.network.ConnectionProvider; import com.refinedmods.refinedstorage2.api.network.Connections; import com.refinedmods.refinedstorage2.api.network.node.container.NetworkNodeContainer; -import com.refinedmods.refinedstorage2.platform.api.support.network.PlatformNetworkNodeContainer; +import com.refinedmods.refinedstorage2.platform.api.support.network.InWorldNetworkNodeContainer; +import com.refinedmods.refinedstorage2.platform.api.support.network.NetworkNodeContainerBlockEntity; import java.util.ArrayDeque; import java.util.ArrayList; +import java.util.Collections; import java.util.Comparator; import java.util.HashSet; import java.util.List; +import java.util.Objects; import java.util.Queue; import java.util.Set; import java.util.stream.Collectors; @@ -36,18 +39,18 @@ public ConnectionProviderImpl(final Level originLevel) { @Override public Connections findConnections(final NetworkNodeContainer pivot, final Set existingConnections) { - final Set existingPlatformConnections = existingConnections.stream() - .filter(PlatformNetworkNodeContainer.class::isInstance) - .map(PlatformNetworkNodeContainer.class::cast) + final Set existingInWorldConnections = existingConnections.stream() + .filter(InWorldNetworkNodeContainer.class::isInstance) + .map(InWorldNetworkNodeContainer.class::cast) .collect(Collectors.toSet()); LOGGER.debug( "Finding connections for pivot {} with {} existing connections", pivot, existingConnections.size() ); - final ScanState scanState = new ScanState(existingPlatformConnections); + final ScanState scanState = new ScanState(existingInWorldConnections); addStartContainer(pivot, scanState); - PlatformNetworkNodeContainer currentContainer; + InWorldNetworkNodeContainer currentContainer; int requests = 0; while ((currentContainer = scanState.toCheck.poll()) != null) { visit(scanState, new ScanEntry(currentContainer)); @@ -65,7 +68,7 @@ public Connections findConnections(final NetworkNodeContainer pivot, } private void addStartContainer(final NetworkNodeContainer pivot, final ScanState scanState) { - if (!(pivot instanceof PlatformNetworkNodeContainer platformPivot)) { + if (!(pivot instanceof InWorldNetworkNodeContainer platformPivot)) { return; } scanState.toCheck.add(platformPivot); @@ -80,48 +83,44 @@ private void visit(final ScanState state, final ScanEntry entry) { state.newEntries.add(entry); } state.removedEntries.remove(entry); - final List connections = findConnectionsAt(entry.getContainer()); + final List connections = findConnectionsAt(entry.getContainer()); state.toCheck.addAll(connections); } - private List findConnectionsAt(final PlatformNetworkNodeContainer from) { - final ConnectionSinkImpl sink = new ConnectionSinkImpl(from.getContainerPosition()); + private List findConnectionsAt(final InWorldNetworkNodeContainer from) { + final GlobalPos pos = from.getPosition(); + final ConnectionSinkImpl sink = new ConnectionSinkImpl(pos); from.addOutgoingConnections(sink); - final List connections = new ArrayList<>(); + final List connections = new ArrayList<>(); for (final ConnectionSinkImpl.Connection connection : sink.getConnections()) { - final PlatformNetworkNodeContainer connectionContainer = getConnection(from, connection); - if (connectionContainer != null) { - connections.add(connectionContainer); - } + connections.addAll(getConnections(from, connection)); } return connections; } - @Nullable - private PlatformNetworkNodeContainer getConnection(final PlatformNetworkNodeContainer from, - final ConnectionSinkImpl.Connection connection) { + private Set getConnections(final InWorldNetworkNodeContainer from, + final ConnectionSinkImpl.Connection connection) { final BlockEntity connectionBlockEntity = getBlockEntitySafely(connection.pos()); - if (!(connectionBlockEntity instanceof PlatformNetworkNodeContainer connectionContainer)) { - return null; + if (!(connectionBlockEntity instanceof NetworkNodeContainerBlockEntity networkNodeContainerBlockEntity)) { + return Collections.emptySet(); } if (connection.incomingDirection() == null) { - return connectionContainer; - } - final boolean acceptsIncomingDirection = connectionContainer.canAcceptIncomingConnection( - connection.incomingDirection(), - from.getContainerBlockState() - ); - if (!acceptsIncomingDirection) { - return null; + return networkNodeContainerBlockEntity.getContainers(); } - return connectionContainer; + return networkNodeContainerBlockEntity.getContainers() + .stream() + .filter(container -> container.canAcceptIncomingConnection( + connection.incomingDirection(), + from.getBlockState() + )) + .collect(Collectors.toSet()); } @Override public List sortDeterministically(final Set containers) { return containers .stream() - .sorted(Comparator.comparing(container -> ((BlockEntity) container).getBlockPos())) + .sorted(Comparator.comparing(container -> ((InWorldNetworkNodeContainer) container).getLocalPosition())) .toList(); } @@ -161,9 +160,9 @@ private static class ScanState { private final Set foundEntries = new HashSet<>(); private final Set newEntries = new HashSet<>(); private final Set removedEntries; - private final Queue toCheck = new ArrayDeque<>(); + private final Queue toCheck = new ArrayDeque<>(); - ScanState(final Set existingConnections) { + ScanState(final Set existingConnections) { this.currentEntries = toScanEntries(existingConnections); this.removedEntries = new HashSet<>(currentEntries); } @@ -180,21 +179,23 @@ private Set toContainers(final Set entries) { return entries.stream().map(ScanEntry::getContainer).collect(Collectors.toSet()); } - private static Set toScanEntries(final Set existingConnections) { + private static Set toScanEntries(final Set existingConnections) { return existingConnections.stream().map(ScanEntry::new).collect(Collectors.toSet()); } } private static class ScanEntry { - private final PlatformNetworkNodeContainer container; + private final InWorldNetworkNodeContainer container; private final GlobalPos pos; + private final String name; - ScanEntry(final PlatformNetworkNodeContainer container) { + ScanEntry(final InWorldNetworkNodeContainer container) { this.container = container; - this.pos = container.getContainerPosition(); + this.pos = container.getPosition(); + this.name = container.getName(); } - public PlatformNetworkNodeContainer getContainer() { + private InWorldNetworkNodeContainer getContainer() { return container; } @@ -206,13 +207,13 @@ public boolean equals(final Object o) { if (o == null || getClass() != o.getClass()) { return false; } - final ScanEntry that = (ScanEntry) o; - return pos.equals(that.pos); + final ScanEntry scanEntry = (ScanEntry) o; + return Objects.equals(pos, scanEntry.pos) && Objects.equals(name, scanEntry.name); } @Override public int hashCode() { - return pos.hashCode(); + return Objects.hash(pos, name); } } } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/InWorldNetworkNodeContainerImpl.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/InWorldNetworkNodeContainerImpl.java new file mode 100644 index 000000000..7bb7d8d5e --- /dev/null +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/InWorldNetworkNodeContainerImpl.java @@ -0,0 +1,92 @@ +package com.refinedmods.refinedstorage2.platform.common.support.network; + +import com.refinedmods.refinedstorage2.api.network.node.NetworkNode; +import com.refinedmods.refinedstorage2.platform.api.support.network.ConnectionLogic; +import com.refinedmods.refinedstorage2.platform.api.support.network.ConnectionSink; +import com.refinedmods.refinedstorage2.platform.api.support.network.InWorldNetworkNodeContainer; + +import java.util.function.Supplier; +import javax.annotation.Nullable; + +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.GlobalPos; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; + +import static java.util.Objects.requireNonNull; + +public class InWorldNetworkNodeContainerImpl implements InWorldNetworkNodeContainer { + private final BlockEntity blockEntity; + private final NetworkNode node; + private final String name; + private final int priority; + private final ConnectionLogic connectionLogic; + @Nullable + private final Supplier keyProvider; + + public InWorldNetworkNodeContainerImpl(final BlockEntity blockEntity, + final NetworkNode node, + final String name, + final int priority, + final ConnectionLogic connectionLogic, + @Nullable final Supplier keyProvider) { + this.blockEntity = blockEntity; + this.node = node; + this.name = name; + this.priority = priority; + this.connectionLogic = connectionLogic; + this.keyProvider = keyProvider; + } + + @Override + public NetworkNode getNode() { + return node; + } + + @Override + public void addOutgoingConnections(final ConnectionSink sink) { + connectionLogic.addOutgoingConnections(sink); + } + + @Override + public boolean canAcceptIncomingConnection(final Direction incomingDirection, final BlockState connectingState) { + return connectionLogic.canAcceptIncomingConnection(incomingDirection, connectingState); + } + + @Override + public BlockState getBlockState() { + return blockEntity.getBlockState(); + } + + @Override + public boolean isRemoved() { + return blockEntity.isRemoved(); + } + + @Override + public GlobalPos getPosition() { + return GlobalPos.of(requireNonNull(blockEntity.getLevel()).dimension(), blockEntity.getBlockPos()); + } + + @Override + public BlockPos getLocalPosition() { + return blockEntity.getBlockPos(); + } + + @Override + public String getName() { + return name; + } + + @Override + public int getPriority() { + return priority; + } + + @Nullable + @Override + public Object createKey() { + return keyProvider != null ? keyProvider.get() : null; + } +} diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/NetworkNodeBlockEntityTicker.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/NetworkNodeBlockEntityTicker.java index 37cfc37af..9522e3acf 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/NetworkNodeBlockEntityTicker.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/NetworkNodeBlockEntityTicker.java @@ -14,7 +14,7 @@ public class NetworkNodeBlockEntityTicker< N extends AbstractNetworkNode, - T extends NetworkNodeContainerBlockEntityImpl + T extends BaseNetworkNodeContainerBlockEntity > extends AbstractBlockEntityTicker { @Nullable private final BooleanProperty activenessProperty; diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/bounditem/NetworkBoundItemHelperImpl.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/bounditem/NetworkBoundItemHelperImpl.java index 50ee4e1b3..2e67583a4 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/bounditem/NetworkBoundItemHelperImpl.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/bounditem/NetworkBoundItemHelperImpl.java @@ -1,9 +1,9 @@ package com.refinedmods.refinedstorage2.platform.common.support.network.bounditem; import com.refinedmods.refinedstorage2.platform.api.support.HelpTooltipComponent; -import com.refinedmods.refinedstorage2.platform.api.support.network.PlatformNetworkNodeContainer; import com.refinedmods.refinedstorage2.platform.api.support.network.bounditem.NetworkBoundItemHelper; import com.refinedmods.refinedstorage2.platform.api.support.network.bounditem.NetworkBoundItemSession; +import com.refinedmods.refinedstorage2.platform.api.support.network.bounditem.NetworkBoundItemTargetBlockEntity; import com.refinedmods.refinedstorage2.platform.api.support.network.bounditem.SlotReference; import java.util.List; @@ -67,7 +67,7 @@ public InteractionResult bind(final UseOnContext ctx) { } final ItemStack stack = ctx.getPlayer().getItemInHand(ctx.getHand()); final BlockEntity blockEntity = ctx.getLevel().getBlockEntity(ctx.getClickedPos()); - if (!(blockEntity instanceof PlatformNetworkNodeContainer)) { + if (!(blockEntity instanceof NetworkBoundItemTargetBlockEntity)) { return InteractionResult.PASS; } final CompoundTag tag = stack.getOrCreateTag(); diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/bounditem/NetworkBoundItemSessionImpl.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/bounditem/NetworkBoundItemSessionImpl.java index 5011671a2..dccc47afd 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/bounditem/NetworkBoundItemSessionImpl.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/bounditem/NetworkBoundItemSessionImpl.java @@ -3,9 +3,8 @@ import com.refinedmods.refinedstorage2.api.core.Action; import com.refinedmods.refinedstorage2.api.network.Network; import com.refinedmods.refinedstorage2.api.network.node.GraphNetworkComponent; -import com.refinedmods.refinedstorage2.api.network.node.NetworkNode; -import com.refinedmods.refinedstorage2.platform.api.support.network.PlatformNetworkNodeContainer; import com.refinedmods.refinedstorage2.platform.api.support.network.bounditem.NetworkBoundItemSession; +import com.refinedmods.refinedstorage2.platform.api.support.network.bounditem.NetworkBoundItemTargetBlockEntity; import com.refinedmods.refinedstorage2.platform.api.support.network.bounditem.SlotReference; import com.refinedmods.refinedstorage2.platform.api.wirelesstransmitter.WirelessTransmitter; import com.refinedmods.refinedstorage2.platform.common.Platform; @@ -19,14 +18,14 @@ import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; -public class NetworkBoundItemSessionImpl implements NetworkBoundItemSession { +class NetworkBoundItemSessionImpl implements NetworkBoundItemSession { private final Player player; private final Vec3 playerPosition; private final SlotReference slotReference; @Nullable private final NetworkReference networkReference; - public NetworkBoundItemSessionImpl( + NetworkBoundItemSessionImpl( final Player player, final SlotReference slotReference, @Nullable final NetworkReference networkReference @@ -50,10 +49,9 @@ public Optional resolveNetwork() { .map(server -> server.getLevel(networkReference.dimensionKey())) .filter(level -> level.isLoaded(networkReference.pos())) .map(level -> level.getBlockEntity(networkReference.pos())) - .filter(PlatformNetworkNodeContainer.class::isInstance) - .map(PlatformNetworkNodeContainer.class::cast) - .map(PlatformNetworkNodeContainer::getNode) - .map(NetworkNode::getNetwork) + .filter(NetworkBoundItemTargetBlockEntity.class::isInstance) + .map(NetworkBoundItemTargetBlockEntity.class::cast) + .map(NetworkBoundItemTargetBlockEntity::getNetworkForBoundItem) .filter(this::isInRange); } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/wirelesstransmitter/WirelessTransmitterBlockEntity.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/wirelesstransmitter/WirelessTransmitterBlockEntity.java index 387c76246..30fbfeeb0 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/wirelesstransmitter/WirelessTransmitterBlockEntity.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/wirelesstransmitter/WirelessTransmitterBlockEntity.java @@ -3,7 +3,7 @@ import com.refinedmods.refinedstorage2.api.network.impl.node.SimpleNetworkNode; import com.refinedmods.refinedstorage2.platform.api.PlatformApi; import com.refinedmods.refinedstorage2.platform.api.support.network.ConnectionSink; -import com.refinedmods.refinedstorage2.platform.api.wirelesstransmitter.WirelessTransmitter; +import com.refinedmods.refinedstorage2.platform.api.support.network.InWorldNetworkNodeContainer; import com.refinedmods.refinedstorage2.platform.common.Platform; import com.refinedmods.refinedstorage2.platform.common.content.BlockEntities; import com.refinedmods.refinedstorage2.platform.common.content.ContentNames; @@ -21,18 +21,15 @@ import net.minecraft.nbt.Tag; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; -import net.minecraft.resources.ResourceKey; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.AbstractContainerMenu; -import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.phys.Vec3; public class WirelessTransmitterBlockEntity extends AbstractRedstoneModeNetworkNodeContainerBlockEntity - implements NetworkNodeMenuProvider, WirelessTransmitter { + implements NetworkNodeMenuProvider { private static final String TAG_UPGRADES = "u"; private final UpgradeContainer upgradeContainer = new UpgradeContainer( @@ -47,6 +44,11 @@ public WirelessTransmitterBlockEntity(final BlockPos pos, final BlockState state )); } + @Override + protected InWorldNetworkNodeContainer createMainContainer(final SimpleNetworkNode node) { + return new WirelessTransmitterNetworkNodeContainer(this, node, MAIN_CONTAINER_NAME, this); + } + @Override public void saveAdditional(final CompoundTag tag) { super.saveAdditional(tag); @@ -107,24 +109,7 @@ private void upgradeContainerChanged() { private void configureAccordingToUpgrades() { final long baseUsage = Platform.INSTANCE.getConfig().getWirelessTransmitter().getEnergyUsage(); - getNode().setEnergyUsage(baseUsage + upgradeContainer.getEnergyUsage()); - } - - @Override - public boolean isInRange(final ResourceKey dimension, final Vec3 position) { - final Level level = getLevel(); - if (level == null || level.dimension() != dimension) { - return false; - } - if (!getNode().isActive()) { - return false; - } - final double distance = Math.sqrt( - Math.pow(getBlockPos().getX() - position.x(), 2) - + Math.pow(getBlockPos().getY() - position.y(), 2) - + Math.pow(getBlockPos().getZ() - position.z(), 2) - ); - return distance <= getRange(); + mainNode.setEnergyUsage(baseUsage + upgradeContainer.getEnergyUsage()); } @Override diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/wirelesstransmitter/WirelessTransmitterNetworkNodeContainer.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/wirelesstransmitter/WirelessTransmitterNetworkNodeContainer.java new file mode 100644 index 000000000..35948cc97 --- /dev/null +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/wirelesstransmitter/WirelessTransmitterNetworkNodeContainer.java @@ -0,0 +1,44 @@ +package com.refinedmods.refinedstorage2.platform.common.wirelesstransmitter; + +import com.refinedmods.refinedstorage2.api.network.impl.storage.AbstractNetworkNode; +import com.refinedmods.refinedstorage2.platform.api.support.network.ConnectionLogic; +import com.refinedmods.refinedstorage2.platform.api.wirelesstransmitter.WirelessTransmitter; +import com.refinedmods.refinedstorage2.platform.common.support.network.InWorldNetworkNodeContainerImpl; + +import net.minecraft.core.BlockPos; +import net.minecraft.resources.ResourceKey; +import net.minecraft.world.level.Level; +import net.minecraft.world.phys.Vec3; + +class WirelessTransmitterNetworkNodeContainer extends InWorldNetworkNodeContainerImpl + implements WirelessTransmitter { + private final WirelessTransmitterBlockEntity blockEntity; + private final AbstractNetworkNode node; + + WirelessTransmitterNetworkNodeContainer(final WirelessTransmitterBlockEntity blockEntity, + final AbstractNetworkNode node, + final String name, + final ConnectionLogic connectionLogic) { + super(blockEntity, node, name, 0, connectionLogic, null); + this.blockEntity = blockEntity; + this.node = node; + } + + @Override + public boolean isInRange(final ResourceKey dimension, final Vec3 position) { + final Level level = blockEntity.getLevel(); + if (level == null || level.dimension() != dimension) { + return false; + } + if (!node.isActive()) { + return false; + } + final BlockPos pos = blockEntity.getBlockPos(); + final double distance = Math.sqrt( + Math.pow(pos.getX() - position.x(), 2) + + Math.pow(pos.getY() - position.y(), 2) + + Math.pow(pos.getZ() - position.z(), 2) + ); + return distance <= blockEntity.getRange(); + } +} diff --git a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/security/NetworkNodeBreakSecurityEventListener.java b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/security/NetworkNodeBreakSecurityEventListener.java index 92ae8d63c..b39693f10 100644 --- a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/security/NetworkNodeBreakSecurityEventListener.java +++ b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/security/NetworkNodeBreakSecurityEventListener.java @@ -1,7 +1,7 @@ package com.refinedmods.refinedstorage2.platform.fabric.security; import com.refinedmods.refinedstorage2.platform.api.PlatformApi; -import com.refinedmods.refinedstorage2.platform.api.support.network.PlatformNetworkNodeContainer; +import com.refinedmods.refinedstorage2.platform.api.support.network.NetworkNodeContainerBlockEntity; import javax.annotation.Nullable; @@ -22,9 +22,9 @@ public boolean beforeBlockBreak(final Level world, final BlockPos pos, final BlockState state, @Nullable final BlockEntity blockEntity) { - if (blockEntity instanceof PlatformNetworkNodeContainer platformNetworkNodeContainer + if (blockEntity instanceof NetworkNodeContainerBlockEntity networkNodeContainerBlockEntity && player instanceof ServerPlayer serverPlayer - && !platformNetworkNodeContainer.canBreakOrRotate(serverPlayer)) { + && !networkNodeContainerBlockEntity.canBuild(serverPlayer)) { PlatformApi.INSTANCE.sendNoPermissionMessage( serverPlayer, createTranslation("misc", "no_permission.build.break", state.getBlock().getName()) diff --git a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/ModInitializer.java b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/ModInitializer.java index eb988a812..b5cb440f7 100644 --- a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/ModInitializer.java +++ b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/ModInitializer.java @@ -1,7 +1,7 @@ package com.refinedmods.refinedstorage2.platform.forge; import com.refinedmods.refinedstorage2.platform.api.PlatformApi; -import com.refinedmods.refinedstorage2.platform.api.support.network.PlatformNetworkNodeContainer; +import com.refinedmods.refinedstorage2.platform.api.support.network.NetworkNodeContainerBlockEntity; import com.refinedmods.refinedstorage2.platform.common.AbstractModInitializer; import com.refinedmods.refinedstorage2.platform.common.PlatformProxy; import com.refinedmods.refinedstorage2.platform.common.content.BlockEntities; @@ -438,9 +438,9 @@ public void registerWrenchingEvent(final PlayerInteractEvent.RightClickBlock e) @SubscribeEvent public void registerSecurityBlockBreakEvent(final BlockEvent.BreakEvent e) { final BlockEntity blockEntity = e.getLevel().getBlockEntity(e.getPos()); - if (blockEntity instanceof PlatformNetworkNodeContainer platformNetworkNodeContainer + if (blockEntity instanceof NetworkNodeContainerBlockEntity networkNodeContainerBlockEntity && e.getPlayer() instanceof ServerPlayer serverPlayer - && !platformNetworkNodeContainer.canBreakOrRotate(serverPlayer)) { + && !networkNodeContainerBlockEntity.canBuild(serverPlayer)) { PlatformApi.INSTANCE.sendNoPermissionMessage( serverPlayer, createTranslation("misc", "no_permission.build.break", e.getState().getBlock().getName()) From 36606ec097454e3eb2483aa01949c9081b9f67cf Mon Sep 17 00:00:00 2001 From: raoulvdberge Date: Thu, 4 Apr 2024 21:20:51 +0200 Subject: [PATCH 15/26] fix: double slot highlighting in the grid --- CHANGELOG.md | 4 +++ .../grid/screen/AbstractGridScreen.java | 27 ++++--------------- 2 files changed, 9 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b3603d3cb..b8faf2748 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Fixed + +- Double slot highlighting in the Grid. + ## [2.0.0-milestone.3.5] - 2024-04-04 ### Added diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/screen/AbstractGridScreen.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/screen/AbstractGridScreen.java index 65910f8ac..cdd03593e 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/screen/AbstractGridScreen.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/screen/AbstractGridScreen.java @@ -27,10 +27,10 @@ import java.util.List; import javax.annotation.Nullable; -import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.ChatFormatting; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent; +import net.minecraft.client.renderer.RenderType; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.world.entity.player.Inventory; @@ -46,12 +46,8 @@ public abstract class AbstractGridScreen ex private static final Logger LOGGER = LoggerFactory.getLogger(AbstractGridScreen.class); private static final int MODIFIED_JUST_NOW_MAX_SECONDS = 10; - private static final int COLUMNS = 9; - private static final int DISABLED_SLOT_COLOR = 0xFF5B5B5B; - private static final int SELECTION_SLOT_COLOR = -2130706433; - private static final List SEARCH_FIELD_HISTORY = new ArrayList<>(); protected final int bottomHeight; @@ -235,7 +231,7 @@ private void renderSlot(final GuiGraphics graphics, renderResourceWithAmount(graphics, slotX, slotY, resource); } if (inBounds && isOverStorageArea(mouseX, mouseY)) { - renderSelection(graphics, slotX, slotY); + renderSlotHighlight(graphics, slotX, slotY, 0); if (resource != null) { currentGridSlotIndex = idx; } @@ -269,22 +265,9 @@ private void renderAmount(final GuiGraphics graphics, } private void renderDisabledSlot(final GuiGraphics graphics, final int slotX, final int slotY) { - RenderSystem.disableDepthTest(); - RenderSystem.colorMask(true, true, true, false); - graphics.fillGradient(slotX, slotY, slotX + 16, slotY + 16, DISABLED_SLOT_COLOR, DISABLED_SLOT_COLOR); - RenderSystem.colorMask(true, true, true, true); - RenderSystem.enableDepthTest(); - } - - private void renderSelection(final GuiGraphics graphics, final int slotX, final int slotY) { - graphics.pose().pushPose(); - graphics.pose().translate(0, 0, 200); - RenderSystem.disableDepthTest(); - RenderSystem.colorMask(true, true, true, false); - graphics.fillGradient(slotX, slotY, slotX + 16, slotY + 16, SELECTION_SLOT_COLOR, SELECTION_SLOT_COLOR); - RenderSystem.colorMask(true, true, true, true); - RenderSystem.enableDepthTest(); - graphics.pose().popPose(); + graphics.fillGradient( + RenderType.guiOverlay(), slotX, slotY, slotX + 16, slotY + 16, DISABLED_SLOT_COLOR, DISABLED_SLOT_COLOR, 0 + ); } @Override From d3882704a0d0cda41c3bb2c296557caced2216ad Mon Sep 17 00:00:00 2001 From: raoulvdberge Date: Thu, 4 Apr 2024 21:27:40 +0200 Subject: [PATCH 16/26] fix: detector, receiver, transmitter and security manager always connect regardless of color --- CHANGELOG.md | 4 ++++ .../platform/common/detector/DetectorBlock.java | 5 +++++ .../platform/common/networking/NetworkReceiverBlock.java | 5 +++++ .../platform/common/networking/NetworkTransmitterBlock.java | 5 +++++ .../platform/common/security/SecurityManagerBlock.java | 5 +++++ 5 files changed, 24 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b8faf2748..36ed5a118 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Changed + +- The Detector, Network Receiver, Network Transmitter and Security Manager will now always connect regardless of color. + ### Fixed - Double slot highlighting in the Grid. diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/detector/DetectorBlock.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/detector/DetectorBlock.java index 892333d3e..3f08564e9 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/detector/DetectorBlock.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/detector/DetectorBlock.java @@ -140,4 +140,9 @@ public int getSignal(final BlockState state, public BaseBlockItem createBlockItem() { return new NetworkNodeBlockItem(this, HELP); } + + @Override + public boolean canAlwaysConnect() { + return true; + } } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/NetworkReceiverBlock.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/NetworkReceiverBlock.java index 2cd782ed3..3629e9cd1 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/NetworkReceiverBlock.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/NetworkReceiverBlock.java @@ -69,4 +69,9 @@ public BlockEntityTicker getTicker(final Level level, public BaseBlockItem createBlockItem() { return new NetworkNodeBlockItem(this); } + + @Override + public boolean canAlwaysConnect() { + return true; + } } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/NetworkTransmitterBlock.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/NetworkTransmitterBlock.java index 62abfcb18..7c43ccb02 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/NetworkTransmitterBlock.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/NetworkTransmitterBlock.java @@ -70,4 +70,9 @@ public BlockEntityTicker getTicker(final Level level, public BaseBlockItem createBlockItem() { return new NetworkNodeBlockItem(this); } + + @Override + public boolean canAlwaysConnect() { + return true; + } } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/security/SecurityManagerBlock.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/security/SecurityManagerBlock.java index e47df4f6e..a49fb40f3 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/security/SecurityManagerBlock.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/security/SecurityManagerBlock.java @@ -98,4 +98,9 @@ public BlockEntityTicker getTicker(final Level level, final BlockEntityType type) { return TICKER.get(level, type); } + + @Override + public boolean canAlwaysConnect() { + return true; + } } From ac6626966a0f62e54c70fec328ecce9ca66e8e48 Mon Sep 17 00:00:00 2001 From: raoulvdberge Date: Fri, 5 Apr 2024 20:32:18 +0200 Subject: [PATCH 17/26] fix: relax logging, new storages will not have an id yet --- .../storage/StorageContainerItemHelperImpl.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/StorageContainerItemHelperImpl.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/StorageContainerItemHelperImpl.java index 2be618047..84c88cc6b 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/StorageContainerItemHelperImpl.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/StorageContainerItemHelperImpl.java @@ -128,13 +128,10 @@ public void appendToTooltip(final ItemStack stack, @Override public void transferToBlockEntity(final ItemStack stack, final ItemTransferableStorageBlockEntity blockEntity) { - getId(stack).ifPresentOrElse( - id -> { - blockEntity.modifyStorageIdAfterAlreadyInitialized(id); - LOGGER.debug("Transferred storage {} to block entity {}", id, blockEntity); - }, - () -> LOGGER.warn("Could not transfer storage from stack to block entity {}, it has no id!", blockEntity) - ); + getId(stack).ifPresent(id -> { + blockEntity.modifyStorageIdAfterAlreadyInitialized(id); + LOGGER.debug("Transferred storage {} to block entity {}", id, blockEntity); + }); } @Override From a752533c57cf5015114de878b1f5929b94384534 Mon Sep 17 00:00:00 2001 From: raoulvdberge Date: Fri, 5 Apr 2024 20:39:35 +0200 Subject: [PATCH 18/26] fix: introduce safe saved data for data corruption protection --- CHANGELOG.md | 1 + .../common/storage/StorageRepositoryImpl.java | 4 +- .../common/support/AbstractSafeSavedData.java | 43 +++++++++++++++++++ 3 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/AbstractSafeSavedData.java diff --git a/CHANGELOG.md b/CHANGELOG.md index 36ed5a118..c207434b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ### Fixed - Double slot highlighting in the Grid. +- Improved data corruption protection for storages. ## [2.0.0-milestone.3.5] - 2024-04-04 diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/StorageRepositoryImpl.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/StorageRepositoryImpl.java index 6d25b7163..adaad7a86 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/StorageRepositoryImpl.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/StorageRepositoryImpl.java @@ -7,6 +7,7 @@ import com.refinedmods.refinedstorage2.platform.api.storage.StorageRepository; import com.refinedmods.refinedstorage2.platform.api.storage.StorageType; import com.refinedmods.refinedstorage2.platform.api.support.registry.PlatformRegistry; +import com.refinedmods.refinedstorage2.platform.common.support.AbstractSafeSavedData; import java.util.HashMap; import java.util.Map; @@ -17,11 +18,10 @@ import net.minecraft.nbt.ListTag; import net.minecraft.nbt.Tag; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.level.saveddata.SavedData; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class StorageRepositoryImpl extends SavedData implements StorageRepository { +public class StorageRepositoryImpl extends AbstractSafeSavedData implements StorageRepository { public static final String NAME = "refinedstorage2_storages"; private static final Logger LOGGER = LoggerFactory.getLogger(StorageRepositoryImpl.class); diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/AbstractSafeSavedData.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/AbstractSafeSavedData.java new file mode 100644 index 000000000..3a8ada4d6 --- /dev/null +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/AbstractSafeSavedData.java @@ -0,0 +1,43 @@ +package com.refinedmods.refinedstorage2.platform.common.support; + +import java.io.File; +import java.io.IOException; +import java.nio.file.AtomicMoveNotSupportedException; +import java.nio.file.Files; +import java.nio.file.StandardCopyOption; + +import com.mojang.logging.LogUtils; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.NbtIo; +import net.minecraft.nbt.NbtUtils; +import net.minecraft.world.level.saveddata.SavedData; +import org.slf4j.Logger; + +public abstract class AbstractSafeSavedData extends SavedData { + private static final Logger LOGGER = LogUtils.getLogger(); + + @Override + public void save(final File file) { + if (!isDirty()) { + return; + } + final var targetPath = file.toPath().toAbsolutePath(); + final var tempFile = targetPath.getParent().resolve(file.getName() + ".temp"); + final CompoundTag compoundTag = new CompoundTag(); + compoundTag.put("data", this.save(new CompoundTag())); + NbtUtils.addCurrentDataVersion(compoundTag); + try { + // Write to temp file first. + NbtIo.writeCompressed(compoundTag, tempFile); + // Try atomic move + try { + Files.move(tempFile, targetPath, StandardCopyOption.ATOMIC_MOVE); + } catch (final AtomicMoveNotSupportedException ignored) { + Files.move(tempFile, targetPath, StandardCopyOption.REPLACE_EXISTING); + } + } catch (final IOException e) { + LOGGER.error("Could not save data {}", this, e); + } + setDirty(false); + } +} From 5140d30590804d8ea14f81af8d864364defa4806 Mon Sep 17 00:00:00 2001 From: raoulvdberge Date: Fri, 5 Apr 2024 21:41:47 +0200 Subject: [PATCH 19/26] refactor: improve contract needed for energy network component The energy component doesn't need full EnergyStorages since it doesn't need following operations: * Extracting energy with simulation * Receiving energy This will be relevant when implementing the relay since they will add an energy storage to the outer network when energy sharing is enabled. --- .../energy/EnergyNetworkComponent.java | 7 +- .../api/network/energy/EnergyProvider.java | 12 + .../impl/energy/CompositeEnergyStorage.java | 67 ---- .../energy/EnergyNetworkComponentImpl.java | 43 +- .../controller/ControllerNetworkNode.java | 15 +- .../energy/CompositeEnergyStorageTest.java | 366 ------------------ .../EnergyNetworkComponentImplTest.java | 167 ++++++-- .../controller/ControllerNetworkNodeTest.java | 53 +-- 8 files changed, 196 insertions(+), 534 deletions(-) create mode 100644 refinedstorage2-network-api/src/main/java/com/refinedmods/refinedstorage2/api/network/energy/EnergyProvider.java delete mode 100644 refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/energy/CompositeEnergyStorage.java delete mode 100644 refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/energy/CompositeEnergyStorageTest.java diff --git a/refinedstorage2-network-api/src/main/java/com/refinedmods/refinedstorage2/api/network/energy/EnergyNetworkComponent.java b/refinedstorage2-network-api/src/main/java/com/refinedmods/refinedstorage2/api/network/energy/EnergyNetworkComponent.java index 59f01fd78..e9348891e 100644 --- a/refinedstorage2-network-api/src/main/java/com/refinedmods/refinedstorage2/api/network/energy/EnergyNetworkComponent.java +++ b/refinedstorage2-network-api/src/main/java/com/refinedmods/refinedstorage2/api/network/energy/EnergyNetworkComponent.java @@ -5,10 +5,5 @@ import org.apiguardian.api.API; @API(status = API.Status.STABLE, since = "2.0.0-milestone.1.1") -public interface EnergyNetworkComponent extends NetworkComponent { - long getStored(); - - long getCapacity(); - - long extract(long amount); +public interface EnergyNetworkComponent extends NetworkComponent, EnergyProvider { } diff --git a/refinedstorage2-network-api/src/main/java/com/refinedmods/refinedstorage2/api/network/energy/EnergyProvider.java b/refinedstorage2-network-api/src/main/java/com/refinedmods/refinedstorage2/api/network/energy/EnergyProvider.java new file mode 100644 index 000000000..12a671534 --- /dev/null +++ b/refinedstorage2-network-api/src/main/java/com/refinedmods/refinedstorage2/api/network/energy/EnergyProvider.java @@ -0,0 +1,12 @@ +package com.refinedmods.refinedstorage2.api.network.energy; + +import org.apiguardian.api.API; + +@API(status = API.Status.STABLE, since = "2.0.0-milestone.3.6") +public interface EnergyProvider { + long getStored(); + + long getCapacity(); + + long extract(long amount); +} diff --git a/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/energy/CompositeEnergyStorage.java b/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/energy/CompositeEnergyStorage.java deleted file mode 100644 index 034931e86..000000000 --- a/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/energy/CompositeEnergyStorage.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.refinedmods.refinedstorage2.api.network.impl.energy; - -import com.refinedmods.refinedstorage2.api.core.Action; -import com.refinedmods.refinedstorage2.api.network.energy.EnergyStorage; - -import java.util.ArrayList; -import java.util.List; - -public class CompositeEnergyStorage implements EnergyStorage { - private final List sources = new ArrayList<>(); - - public void addSource(final EnergyStorage source) { - sources.add(source); - } - - public void removeSource(final EnergyStorage source) { - sources.remove(source); - } - - @Override - public long getStored() { - long stored = 0; - for (final EnergyStorage source : sources) { - if (stored + source.getStored() < 0) { - return Long.MAX_VALUE; - } - stored += source.getStored(); - } - return stored; - } - - @Override - public long getCapacity() { - long capacity = 0; - for (final EnergyStorage source : sources) { - if (capacity + source.getCapacity() < 0) { - return Long.MAX_VALUE; - } - capacity += source.getCapacity(); - } - return capacity; - } - - @Override - public long receive(final long amount, final Action action) { - long inserted = 0; - for (final EnergyStorage source : sources) { - inserted += source.receive(amount - inserted, action); - if (inserted == amount) { - break; - } - } - return inserted; - } - - @Override - public long extract(final long amount, final Action action) { - long extracted = 0; - for (final EnergyStorage source : sources) { - extracted += source.extract(amount - extracted, action); - if (extracted == amount) { - break; - } - } - return extracted; - } -} diff --git a/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/energy/EnergyNetworkComponentImpl.java b/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/energy/EnergyNetworkComponentImpl.java index e9bfe0a3b..8a6aed6db 100644 --- a/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/energy/EnergyNetworkComponentImpl.java +++ b/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/energy/EnergyNetworkComponentImpl.java @@ -1,39 +1,62 @@ package com.refinedmods.refinedstorage2.api.network.impl.energy; -import com.refinedmods.refinedstorage2.api.core.Action; import com.refinedmods.refinedstorage2.api.network.energy.EnergyNetworkComponent; -import com.refinedmods.refinedstorage2.api.network.energy.EnergyStorage; +import com.refinedmods.refinedstorage2.api.network.energy.EnergyProvider; import com.refinedmods.refinedstorage2.api.network.node.container.NetworkNodeContainer; +import java.util.LinkedHashSet; +import java.util.Set; + public class EnergyNetworkComponentImpl implements EnergyNetworkComponent { - private final CompositeEnergyStorage energyStorage = new CompositeEnergyStorage(); + private final Set providers = new LinkedHashSet<>(); @Override public void onContainerAdded(final NetworkNodeContainer container) { - if (container.getNode() instanceof EnergyStorage source) { - energyStorage.addSource(source); + if (container.getNode() instanceof EnergyProvider provider) { + providers.add(provider); } } @Override public void onContainerRemoved(final NetworkNodeContainer container) { - if (container.getNode() instanceof EnergyStorage source) { - energyStorage.removeSource(source); + if (container.getNode() instanceof EnergyProvider provider) { + providers.remove(provider); } } @Override public long getStored() { - return energyStorage.getStored(); + long stored = 0; + for (final EnergyProvider provider : providers) { + if (stored + provider.getStored() < 0) { + return Long.MAX_VALUE; + } + stored += provider.getStored(); + } + return stored; } @Override public long getCapacity() { - return energyStorage.getCapacity(); + long capacity = 0; + for (final EnergyProvider provider : providers) { + if (capacity + provider.getCapacity() < 0) { + return Long.MAX_VALUE; + } + capacity += provider.getCapacity(); + } + return capacity; } @Override public long extract(final long amount) { - return energyStorage.extract(amount, Action.EXECUTE); + long extracted = 0; + for (final EnergyProvider provider : providers) { + extracted += provider.extract(amount - extracted); + if (extracted == amount) { + break; + } + } + return extracted; } } diff --git a/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/controller/ControllerNetworkNode.java b/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/controller/ControllerNetworkNode.java index d3fd21a53..005649dac 100644 --- a/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/controller/ControllerNetworkNode.java +++ b/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/controller/ControllerNetworkNode.java @@ -1,12 +1,13 @@ package com.refinedmods.refinedstorage2.api.network.impl.node.controller; import com.refinedmods.refinedstorage2.api.core.Action; +import com.refinedmods.refinedstorage2.api.network.energy.EnergyProvider; import com.refinedmods.refinedstorage2.api.network.energy.EnergyStorage; import com.refinedmods.refinedstorage2.api.network.impl.storage.AbstractNetworkNode; import javax.annotation.Nullable; -public class ControllerNetworkNode extends AbstractNetworkNode implements EnergyStorage { +public class ControllerNetworkNode extends AbstractNetworkNode implements EnergyProvider { @Nullable private EnergyStorage energyStorage; @@ -60,19 +61,11 @@ public long getActualCapacity() { } @Override - public long receive(final long amount, final Action action) { + public long extract(final long amount) { if (energyStorage == null) { return 0L; } - return energyStorage.receive(amount, action); - } - - @Override - public long extract(final long amount, final Action action) { - if (energyStorage == null) { - return 0L; - } - return energyStorage.extract(amount, action); + return energyStorage.extract(amount, Action.EXECUTE); } @Override diff --git a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/energy/CompositeEnergyStorageTest.java b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/energy/CompositeEnergyStorageTest.java deleted file mode 100644 index e8eeb4ad3..000000000 --- a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/energy/CompositeEnergyStorageTest.java +++ /dev/null @@ -1,366 +0,0 @@ -package com.refinedmods.refinedstorage2.api.network.impl.energy; - -import com.refinedmods.refinedstorage2.api.core.Action; -import com.refinedmods.refinedstorage2.api.network.energy.EnergyStorage; - -import org.junit.jupiter.api.Test; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.EnumSource; - -import static org.assertj.core.api.Assertions.assertThat; - -class CompositeEnergyStorageTest { - @ParameterizedTest - @EnumSource(Action.class) - void shouldNotReceiveEnergyWhenNoSourcesArePresent(final Action action) { - // Arrange - final CompositeEnergyStorage sut = new CompositeEnergyStorage(); - - // Act - final long inserted = sut.receive(3, action); - - // Assert - assertThat(inserted).isZero(); - assertThat(sut.getStored()).isZero(); - assertThat(sut.getCapacity()).isZero(); - } - - @ParameterizedTest - @EnumSource(Action.class) - void shouldReceiveSingleSourcePartially(final Action action) { - // Arrange - final EnergyStorage a = new EnergyStorageImpl(10); - final EnergyStorage b = new EnergyStorageImpl(5); - - final CompositeEnergyStorage sut = new CompositeEnergyStorage(); - sut.addSource(a); - sut.addSource(b); - - // Act - final long inserted = sut.receive(3, action); - - // Assert - assertThat(inserted).isEqualTo(3); - - if (action == Action.EXECUTE) { - assertThat(a.getStored()).isEqualTo(3); - assertThat(sut.getStored()).isEqualTo(3); - } else { - assertThat(a.getStored()).isZero(); - assertThat(sut.getStored()).isZero(); - } - - assertThat(b.getStored()).isZero(); - assertThat(sut.getCapacity()).isEqualTo(15); - } - - @ParameterizedTest - @EnumSource(Action.class) - void shouldReceiveSingleSourceCompletely(final Action action) { - // Arrange - final EnergyStorage a = new EnergyStorageImpl(10); - final EnergyStorage b = new EnergyStorageImpl(5); - - final CompositeEnergyStorage sut = new CompositeEnergyStorage(); - sut.addSource(a); - sut.addSource(b); - - // Act - final long inserted = sut.receive(10, action); - - // Assert - if (action == Action.EXECUTE) { - assertThat(a.getStored()).isEqualTo(10); - assertThat(sut.getStored()).isEqualTo(10); - } else { - assertThat(a.getStored()).isZero(); - assertThat(sut.getStored()).isZero(); - } - - assertThat(inserted).isEqualTo(10); - assertThat(b.getStored()).isZero(); - assertThat(sut.getCapacity()).isEqualTo(15); - } - - @ParameterizedTest - @EnumSource(Action.class) - void shouldReceiveIntoMultipleSourcesPartially(final Action action) { - // Arrange - final EnergyStorage a = new EnergyStorageImpl(10); - final EnergyStorage b = new EnergyStorageImpl(5); - - final CompositeEnergyStorage sut = new CompositeEnergyStorage(); - sut.addSource(a); - sut.addSource(b); - - // Act - final long inserted = sut.receive(13, action); - - // Assert - assertThat(inserted).isEqualTo(13); - - if (action == Action.EXECUTE) { - assertThat(a.getStored()).isEqualTo(10); - assertThat(b.getStored()).isEqualTo(3); - assertThat(sut.getStored()).isEqualTo(13); - } else { - assertThat(a.getStored()).isZero(); - assertThat(b.getStored()).isZero(); - assertThat(sut.getStored()).isZero(); - } - - assertThat(sut.getCapacity()).isEqualTo(15); - } - - @ParameterizedTest - @EnumSource(Action.class) - void shouldReceiveIntoMultipleSourcesCompletely(final Action action) { - // Arrange - final EnergyStorage a = new EnergyStorageImpl(10); - final EnergyStorage b = new EnergyStorageImpl(5); - - final CompositeEnergyStorage sut = new CompositeEnergyStorage(); - sut.addSource(a); - sut.addSource(b); - - // Act - final long inserted = sut.receive(15, action); - - // Assert - assertThat(inserted).isEqualTo(15); - - if (action == Action.EXECUTE) { - assertThat(a.getStored()).isEqualTo(10); - assertThat(b.getStored()).isEqualTo(5); - assertThat(sut.getStored()).isEqualTo(15); - } else { - assertThat(a.getStored()).isZero(); - assertThat(b.getStored()).isZero(); - assertThat(sut.getStored()).isZero(); - } - - assertThat(sut.getCapacity()).isEqualTo(15); - } - - @ParameterizedTest - @EnumSource(Action.class) - void shouldReceiveIntoMultipleSourcesCompletelyWithRemainder(final Action action) { - // Arrange - final EnergyStorage a = new EnergyStorageImpl(10); - final EnergyStorage b = new EnergyStorageImpl(5); - - final CompositeEnergyStorage sut = new CompositeEnergyStorage(); - sut.addSource(a); - sut.addSource(b); - - // Act - final long inserted = sut.receive(16, action); - - // Assert - assertThat(inserted).isEqualTo(15); - - if (action == Action.EXECUTE) { - assertThat(a.getStored()).isEqualTo(10); - assertThat(b.getStored()).isEqualTo(5); - assertThat(sut.getStored()).isEqualTo(15); - } else { - assertThat(a.getStored()).isZero(); - assertThat(b.getStored()).isZero(); - assertThat(sut.getStored()).isZero(); - } - - assertThat(sut.getCapacity()).isEqualTo(15); - } - - @ParameterizedTest - @EnumSource(Action.class) - void shouldNotExtractAnythingWhenNoSourcesAreAvailable(final Action action) { - // Arrange - final CompositeEnergyStorage sut = new CompositeEnergyStorage(); - - // Act - final long extracted = sut.extract(3, action); - - // Assert - assertThat(extracted).isZero(); - assertThat(sut.getStored()).isZero(); - assertThat(sut.getCapacity()).isZero(); - } - - @ParameterizedTest - @EnumSource(Action.class) - void shouldExtractFromSingleSourcePartly(final Action action) { - // Arrange - final EnergyStorage a = new EnergyStorageImpl(10); - final EnergyStorage b = new EnergyStorageImpl(5); - - a.receive(10, Action.EXECUTE); - b.receive(3, Action.EXECUTE); - - final CompositeEnergyStorage sut = new CompositeEnergyStorage(); - sut.addSource(a); - sut.addSource(b); - - // Act - final long extracted = sut.extract(3, action); - - // Assert - assertThat(extracted).isEqualTo(3); - - if (action == Action.EXECUTE) { - assertThat(a.getStored()).isEqualTo(7); - assertThat(b.getStored()).isEqualTo(3); - } else { - assertThat(a.getStored()).isEqualTo(10); - assertThat(b.getStored()).isEqualTo(3); - } - - assertThat(sut.getCapacity()).isEqualTo(15); - } - - @ParameterizedTest - @EnumSource(Action.class) - void shouldExtractFromSingleSourceCompletely(final Action action) { - // Arrange - final EnergyStorage a = new EnergyStorageImpl(10); - final EnergyStorage b = new EnergyStorageImpl(5); - - a.receive(10, Action.EXECUTE); - b.receive(3, Action.EXECUTE); - - final CompositeEnergyStorage sut = new CompositeEnergyStorage(); - sut.addSource(a); - sut.addSource(b); - - // Act - final long extracted = sut.extract(10, action); - - // Assert - assertThat(extracted).isEqualTo(10); - - if (action == Action.EXECUTE) { - assertThat(a.getStored()).isZero(); - assertThat(b.getStored()).isEqualTo(3); - } else { - assertThat(a.getStored()).isEqualTo(10); - assertThat(b.getStored()).isEqualTo(3); - } - - assertThat(sut.getCapacity()).isEqualTo(15); - } - - @ParameterizedTest - @EnumSource(Action.class) - void shouldExtractFromMultipleSourcesPartly(final Action action) { - // Arrange - final EnergyStorage a = new EnergyStorageImpl(10); - final EnergyStorage b = new EnergyStorageImpl(5); - - a.receive(10, Action.EXECUTE); - b.receive(3, Action.EXECUTE); - - final CompositeEnergyStorage sut = new CompositeEnergyStorage(); - sut.addSource(a); - sut.addSource(b); - - // Act - final long extracted = sut.extract(11, action); - - // Assert - assertThat(extracted).isEqualTo(11); - - if (action == Action.EXECUTE) { - assertThat(a.getStored()).isZero(); - assertThat(b.getStored()).isEqualTo(2); - } else { - assertThat(a.getStored()).isEqualTo(10); - assertThat(b.getStored()).isEqualTo(3); - } - - assertThat(sut.getCapacity()).isEqualTo(15); - } - - @ParameterizedTest - @EnumSource(Action.class) - void shouldExtractFromMultipleSourcesCompletely(final Action action) { - // Arrange - final EnergyStorage a = new EnergyStorageImpl(10); - final EnergyStorage b = new EnergyStorageImpl(5); - - a.receive(10, Action.EXECUTE); - b.receive(3, Action.EXECUTE); - - final CompositeEnergyStorage sut = new CompositeEnergyStorage(); - sut.addSource(a); - sut.addSource(b); - - // Act - final long extracted = sut.extract(13, action); - - // Assert - assertThat(extracted).isEqualTo(13); - - if (action == Action.EXECUTE) { - assertThat(a.getStored()).isZero(); - assertThat(b.getStored()).isZero(); - } else { - assertThat(a.getStored()).isEqualTo(10); - assertThat(b.getStored()).isEqualTo(3); - } - - assertThat(sut.getCapacity()).isEqualTo(15); - } - - @ParameterizedTest - @EnumSource(Action.class) - void shouldExtractFromMultipleSourcesCompletelyMoreThanIsAvailable(final Action action) { - // Arrange - final EnergyStorage a = new EnergyStorageImpl(10); - final EnergyStorage b = new EnergyStorageImpl(5); - - a.receive(10, Action.EXECUTE); - b.receive(3, Action.EXECUTE); - - final CompositeEnergyStorage sut = new CompositeEnergyStorage(); - sut.addSource(a); - sut.addSource(b); - - // Act - final long extracted = sut.extract(14, action); - - // Assert - assertThat(extracted).isEqualTo(13); - - if (action == Action.EXECUTE) { - assertThat(a.getStored()).isZero(); - assertThat(b.getStored()).isZero(); - } else { - assertThat(a.getStored()).isEqualTo(10); - assertThat(b.getStored()).isEqualTo(3); - } - - assertThat(sut.getCapacity()).isEqualTo(15); - } - - @Test - void shouldNotExceedLongMax() { - // Arrange - final EnergyStorage a = new EnergyStorageImpl(Long.MAX_VALUE); - final EnergyStorage b = new EnergyStorageImpl(Long.MAX_VALUE); - - a.receive(Long.MAX_VALUE, Action.EXECUTE); - b.receive(Long.MAX_VALUE, Action.EXECUTE); - - final CompositeEnergyStorage sut = new CompositeEnergyStorage(); - sut.addSource(a); - sut.addSource(b); - - // Act - final long stored = sut.getStored(); - final long capacity = sut.getCapacity(); - - // Assert - assertThat(stored).isEqualTo(Long.MAX_VALUE); - assertThat(capacity).isEqualTo(Long.MAX_VALUE); - } -} diff --git a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/energy/EnergyNetworkComponentImplTest.java b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/energy/EnergyNetworkComponentImplTest.java index e7ca16904..90778ffe3 100644 --- a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/energy/EnergyNetworkComponentImplTest.java +++ b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/energy/EnergyNetworkComponentImplTest.java @@ -2,6 +2,7 @@ import com.refinedmods.refinedstorage2.api.core.Action; import com.refinedmods.refinedstorage2.api.network.energy.EnergyNetworkComponent; +import com.refinedmods.refinedstorage2.api.network.energy.EnergyStorage; import com.refinedmods.refinedstorage2.api.network.impl.node.controller.ControllerNetworkNode; import com.refinedmods.refinedstorage2.api.network.node.container.NetworkNodeContainer; @@ -21,64 +22,160 @@ void testInitialState() { } @Test - void shouldUpdateEnergyStorageAfterAddingNode() { + void shouldNotExtractAnythingWhenNoProvidersAreAvailable() { // Arrange final EnergyNetworkComponent sut = new EnergyNetworkComponentImpl(); - final ControllerNetworkNode controller = new ControllerNetworkNode(); - controller.setActive(true); - controller.setEnergyStorage(new EnergyStorageImpl(1000)); - controller.receive(100, Action.EXECUTE); - final NetworkNodeContainer container = () -> controller; + // Act + final long extracted = sut.extract(3); + + // Assert + assertThat(extracted).isZero(); + assertThat(sut.getStored()).isZero(); + assertThat(sut.getCapacity()).isZero(); + } + + @Test + void shouldExtractFromSingleProviderPartly() { + // Arrange + final EnergyStorage a = new EnergyStorageImpl(10); + final EnergyStorage b = new EnergyStorageImpl(5); + + a.receive(10, Action.EXECUTE); + b.receive(3, Action.EXECUTE); + + final EnergyNetworkComponent sut = new EnergyNetworkComponentImpl(); + sut.onContainerAdded(container(a)); + sut.onContainerAdded(container(b)); // Act - final long extractedBefore = sut.extract(1); - final long capacityBefore = sut.getCapacity(); - final long storedBefore = sut.getStored(); + final long extracted = sut.extract(3); - sut.onContainerAdded(container); + // Assert + assertThat(extracted).isEqualTo(3); + assertThat(a.getStored()).isEqualTo(7); + assertThat(b.getStored()).isEqualTo(3); + assertThat(sut.getCapacity()).isEqualTo(15); + } + + @Test + void shouldExtractFromSingleProviderCompletely() { + // Arrange + final EnergyStorage a = new EnergyStorageImpl(10); + final EnergyStorage b = new EnergyStorageImpl(5); + + a.receive(10, Action.EXECUTE); + b.receive(3, Action.EXECUTE); + + final EnergyNetworkComponent sut = new EnergyNetworkComponentImpl(); + sut.onContainerAdded(container(a)); + sut.onContainerAdded(container(b)); - final long extractedAfter = sut.extract(1); - final long capacityAfter = sut.getCapacity(); - final long storedAfter = sut.getStored(); + // Act + final long extracted = sut.extract(10); // Assert - assertThat(extractedBefore).isZero(); - assertThat(capacityBefore).isZero(); - assertThat(storedBefore).isZero(); + assertThat(extracted).isEqualTo(10); + assertThat(a.getStored()).isZero(); + assertThat(b.getStored()).isEqualTo(3); + assertThat(sut.getCapacity()).isEqualTo(15); + } + + @Test + void shouldExtractFromMultipleProvidersPartly() { + // Arrange + final EnergyStorage a = new EnergyStorageImpl(10); + final EnergyStorage b = new EnergyStorageImpl(5); + + a.receive(10, Action.EXECUTE); + b.receive(3, Action.EXECUTE); + + final EnergyNetworkComponent sut = new EnergyNetworkComponentImpl(); + sut.onContainerAdded(container(a)); + sut.onContainerAdded(container(b)); + + // Act + final long extracted = sut.extract(11); - assertThat(capacityAfter).isEqualTo(1000); - assertThat(storedAfter).isEqualTo(99); - assertThat(extractedAfter).isEqualTo(1); + // Assert + assertThat(extracted).isEqualTo(11); + assertThat(a.getStored()).isZero(); + assertThat(b.getStored()).isEqualTo(2); + assertThat(sut.getCapacity()).isEqualTo(15); } @Test - void shouldUpdateEnergyStorageAfterRemovingNode() { + void shouldExtractFromMultipleProvidersCompletely() { // Arrange + final EnergyStorage a = new EnergyStorageImpl(10); + final EnergyStorage b = new EnergyStorageImpl(5); + + a.receive(10, Action.EXECUTE); + b.receive(3, Action.EXECUTE); + final EnergyNetworkComponent sut = new EnergyNetworkComponentImpl(); + sut.onContainerAdded(container(a)); + sut.onContainerAdded(container(b)); - final ControllerNetworkNode controller = new ControllerNetworkNode(); - controller.setEnergyStorage(new EnergyStorageImpl(1000)); - controller.receive(100, Action.EXECUTE); - controller.setActive(true); - final NetworkNodeContainer container = () -> controller; + // Act + final long extracted = sut.extract(13); - sut.onContainerAdded(container); + // Assert + assertThat(extracted).isEqualTo(13); + assertThat(a.getStored()).isZero(); + assertThat(b.getStored()).isZero(); + assertThat(sut.getCapacity()).isEqualTo(15); + } - final long capacityBefore = sut.getCapacity(); - final long storedBefore = sut.getStored(); + @Test + void shouldExtractFromMultipleProvidersCompletelyMoreThanIsAvailable() { + // Arrange + final EnergyStorage a = new EnergyStorageImpl(10); + final EnergyStorage b = new EnergyStorageImpl(5); + + a.receive(10, Action.EXECUTE); + b.receive(3, Action.EXECUTE); + + final EnergyNetworkComponent sut = new EnergyNetworkComponentImpl(); + sut.onContainerAdded(container(a)); + sut.onContainerAdded(container(b)); // Act - sut.onContainerRemoved(container); + final long extracted = sut.extract(14); + + // Assert + assertThat(extracted).isEqualTo(13); + assertThat(a.getStored()).isZero(); + assertThat(b.getStored()).isZero(); + assertThat(sut.getCapacity()).isEqualTo(15); + } + + @Test + void shouldNotExceedLongMaxWithCapacityOrStored() { + // Arrange + final EnergyStorage a = new EnergyStorageImpl(Long.MAX_VALUE); + final EnergyStorage b = new EnergyStorageImpl(Long.MAX_VALUE); - final long capacityAfter = sut.getCapacity(); - final long storedAfter = sut.getStored(); + a.receive(Long.MAX_VALUE, Action.EXECUTE); + b.receive(Long.MAX_VALUE, Action.EXECUTE); + + final EnergyNetworkComponent sut = new EnergyNetworkComponentImpl(); + sut.onContainerAdded(container(a)); + sut.onContainerAdded(container(b)); + + // Act + final long stored = sut.getStored(); + final long capacity = sut.getCapacity(); // Assert - assertThat(capacityBefore).isEqualTo(1000); - assertThat(storedBefore).isEqualTo(100); + assertThat(stored).isEqualTo(Long.MAX_VALUE); + assertThat(capacity).isEqualTo(Long.MAX_VALUE); + } - assertThat(capacityAfter).isZero(); - assertThat(storedAfter).isZero(); + private NetworkNodeContainer container(final EnergyStorage energyStorage) { + final ControllerNetworkNode controller = new ControllerNetworkNode(); + controller.setEnergyStorage(energyStorage); + controller.setActive(true); + return () -> controller; } } diff --git a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/controller/ControllerNetworkNodeTest.java b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/controller/ControllerNetworkNodeTest.java index 426aa19ab..f813245b3 100644 --- a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/controller/ControllerNetworkNodeTest.java +++ b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/controller/ControllerNetworkNodeTest.java @@ -34,8 +34,9 @@ void testInitialState() { @Test void testStoredAndCapacityWhenInactive() { // Arrange - sut.setEnergyStorage(new EnergyStorageImpl(100)); - sut.receive(10, Action.EXECUTE); + final EnergyStorageImpl energyStorage = new EnergyStorageImpl(100); + energyStorage.receive(10, Action.EXECUTE); + sut.setEnergyStorage(energyStorage); sut.setActive(false); @@ -69,8 +70,9 @@ private static Stream getStoredAndExpectedState() { @MethodSource("getStoredAndExpectedState") void testCalculatingStates(final long stored, final ControllerEnergyState expectedState) { // Arrange - sut.setEnergyStorage(new EnergyStorageImpl(100)); - sut.receive(stored, Action.EXECUTE); + final EnergyStorageImpl energyStorage = new EnergyStorageImpl(100); + energyStorage.receive(stored, Action.EXECUTE); + sut.setEnergyStorage(energyStorage); // Act final ControllerEnergyState state = sut.getState(); @@ -82,8 +84,9 @@ void testCalculatingStates(final long stored, final ControllerEnergyState expect @Test void testEnergyStateShouldBeOffWhenInactive() { // Arrange - sut.setEnergyStorage(new EnergyStorageImpl(100)); - sut.receive(50, Action.EXECUTE); + final EnergyStorageImpl energyStorage = new EnergyStorageImpl(100); + energyStorage.receive(50, Action.EXECUTE); + sut.setEnergyStorage(energyStorage); sut.setActive(false); // Act @@ -93,30 +96,15 @@ void testEnergyStateShouldBeOffWhenInactive() { assertThat(state).isEqualTo(ControllerEnergyState.OFF); } - @Test - void shouldReceiveEnergy() { - // Arrange - sut.setEnergyStorage(new EnergyStorageImpl(100)); - - // Act - final long inserted = sut.receive(10, Action.EXECUTE); - - // Assert - assertThat(inserted).isEqualTo(10); - assertThat(sut.getCapacity()).isEqualTo(100); - assertThat(sut.getActualCapacity()).isEqualTo(100); - assertThat(sut.getStored()).isEqualTo(10); - assertThat(sut.getActualStored()).isEqualTo(10); - } - @Test void shouldExtractEnergy() { // Arrange - sut.setEnergyStorage(new EnergyStorageImpl(100)); + final EnergyStorageImpl energyStorage = new EnergyStorageImpl(100); + energyStorage.receive(10, Action.EXECUTE); + sut.setEnergyStorage(energyStorage); // Act - sut.receive(10, Action.EXECUTE); - final long extracted = sut.extract(20, Action.EXECUTE); + final long extracted = sut.extract(20); // Assert assertThat(extracted).isEqualTo(10); @@ -126,23 +114,10 @@ void shouldExtractEnergy() { assertThat(sut.getActualStored()).isZero(); } - @Test - void shouldNotReceiveEnergyWithoutEnergyStorage() { - // Act - final long inserted = sut.receive(10, Action.EXECUTE); - - // Assert - assertThat(inserted).isZero(); - assertThat(sut.getCapacity()).isZero(); - assertThat(sut.getActualCapacity()).isZero(); - assertThat(sut.getStored()).isZero(); - assertThat(sut.getActualStored()).isZero(); - } - @Test void shouldNotExtractEnergyWithoutEnergyStorage() { // Act - final long extracted = sut.extract(20, Action.EXECUTE); + final long extracted = sut.extract(20); // Assert assertThat(extracted).isZero(); From c052e23df613638277974b00e2d23450f7b7173b Mon Sep 17 00:00:00 2001 From: Raoul Date: Fri, 5 Apr 2024 18:45:19 +0200 Subject: [PATCH 20/26] chore: update translation German from crowdin --- .../assets/refinedstorage2/lang/de_de.json | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/de_de.json b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/de_de.json index e9aecf7ab..fb02cd86c 100644 --- a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/de_de.json +++ b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/de_de.json @@ -279,11 +279,11 @@ "permission.refinedstorage2.build": "Bauen", "permission.refinedstorage2.build.description": "Gibt an, ob der Player Netzwerkgeräte hinzufügen oder entfernen kann.", "permission.refinedstorage2.security": "Sicherheit", - "permission.refinedstorage2.security.description": "Whether the player can manage the security options for a network.", + "permission.refinedstorage2.security.description": "Ob der Spieler die Sicherheitsoptionen für ein Netzwerk verwalten kann.", "text.autoconfig.refinedstorage2.title": "Refined Storage 2", - "text.autoconfig.refinedstorage2.option.smoothScrolling": "Smooth scrolling", - "text.autoconfig.refinedstorage2.option.screenSize": "Screen size", - "text.autoconfig.refinedstorage2.option.maxRowsStretch": "Maximum amount of rows when screen size is stretched", + "text.autoconfig.refinedstorage2.option.smoothScrolling": "Flüssiges Scrollen", + "text.autoconfig.refinedstorage2.option.screenSize": "Bildschirmgröße", + "text.autoconfig.refinedstorage2.option.maxRowsStretch": "Maximale Anzahl von Zeilen, wenn Bildschirmgröße gestreckt ist", "text.autoconfig.refinedstorage2.option.grid": "Konsole", "text.autoconfig.refinedstorage2.option.grid.largeFont": "Große Schriftart", "text.autoconfig.refinedstorage2.option.grid.preventSortingWhileShiftIsDown": "Sortierung verhindern während SHIFT gedrückt ist", @@ -361,13 +361,13 @@ "text.autoconfig.refinedstorage2.option.portableGrid.openEnergyUsage": "Energieverbrauch beim Öffnen", "text.autoconfig.refinedstorage2.option.portableGrid.insertEnergyUsage": "Energieverbrauch beim Importieren", "text.autoconfig.refinedstorage2.option.portableGrid.extractEnergyUsage": "Energieverbrauch beim Exportieren", - "text.autoconfig.refinedstorage2.option.securityCard": "Security Card", - "text.autoconfig.refinedstorage2.option.securityCard.energyUsage": "Energy usage", - "text.autoconfig.refinedstorage2.option.fallbackSecurityCard": "Fallback Security Card", - "text.autoconfig.refinedstorage2.option.fallbackSecurityCard.energyUsage": "Energy usage", - "text.autoconfig.refinedstorage2.option.securityManager": "Security Manager", - "text.autoconfig.refinedstorage2.option.securityManager.energyUsage": "Energy usage", - "advancements.refinedstorage2.root.description": "Use one or multiple Controllers in a storage network to provide your network with energy", + "text.autoconfig.refinedstorage2.option.securityCard": "Sicherheitskarte", + "text.autoconfig.refinedstorage2.option.securityCard.energyUsage": "Energieverbrauch", + "text.autoconfig.refinedstorage2.option.fallbackSecurityCard": "Standard-Sicherheitskarte", + "text.autoconfig.refinedstorage2.option.fallbackSecurityCard.energyUsage": "Energieverbrauch", + "text.autoconfig.refinedstorage2.option.securityManager": "Sicherheits-Manager", + "text.autoconfig.refinedstorage2.option.securityManager.energyUsage": "Energieverbrauch", + "advancements.refinedstorage2.root.description": "Nutzen Sie einen oder mehrere Kontrollblöcke in einem Speichernetzwerk, um das Netzwerk mit Energie zu versorgen", "advancements.refinedstorage2.connecting": "Verbinden", "advancements.refinedstorage2.connecting.description": "Benutze Kabel um Geräte miteinander zu verbinden, oder platziere Geräte nebeneinander", "advancements.refinedstorage2.drives": "Festplatten", @@ -391,19 +391,19 @@ "advancements.refinedstorage2.storing_externally": "Extern speichern", "advancements.refinedstorage2.storing_externally.description": "Verwenden Sie einen externen Speicher um dem Netzwerk Speicher von einem externen Block wie einer Truhe zur Verfügung zu stellen", "advancements.refinedstorage2.detecting": "Erkennung", - "advancements.refinedstorage2.detecting.description": "Use redstone to check resources stored in the storage network", + "advancements.refinedstorage2.detecting.description": "Nutzen Sie Redstone um die, in einem Netzwerk gespeicherten, Ressourcen zu überprüfen", "advancements.refinedstorage2.construction": "Konstruktion", "advancements.refinedstorage2.construction.description": "Erhalte Blöcke aus dem Speichernetzwerk in die Welt mit einem Konstruktor", "advancements.refinedstorage2.destruction": "Zerstörung", "advancements.refinedstorage2.destruction.description": "Erhalte Blöcke aus der Welt in das Speichernetzwerk mit einem Destruktor", "advancements.refinedstorage2.wireless": "Drahtlos", - "advancements.refinedstorage2.wireless.description": "Access your resources wirelessly with a Wireless Grid", + "advancements.refinedstorage2.wireless.description": "Greifen Sie drahtlos auf Ihre Ressourcen mit einer drahtlosen Konsole zu", "advancements.refinedstorage2.better_than_a_barrel": "Besser als ein Fass", "advancements.refinedstorage2.better_than_a_barrel.description": "Stelle einen Speichermonitor her, um Ressourcen in einem Speichernetzwerk anzuzeigen, zu importieren oder zu exportieren", "advancements.refinedstorage2.no_cables_required": "Keine Kabel erforderlich", - "advancements.refinedstorage2.no_cables_required.description": "Add extra components to your storage network without using cables by using a Network Transmitter, Network Receiver and Network Card", + "advancements.refinedstorage2.no_cables_required.description": "Fügen Sie Ihrem Speichernetzwerk zusätzliche Komponenten hinzu, ohne Kabel zu verwenden, indem Sie einen Netzwerkübermittler, Netzwerkempfänger und Netzwerkkarte verwenden", "advancements.refinedstorage2.portable_storage": "Tragbarer Speicher", "advancements.refinedstorage2.portable_storage.description": "Erstelle eine mobile Konsole um auf den Inhalt von Speicherplatten zuzugreifen, ohne ein Speichernetzwerk zu benötigen", - "advancements.refinedstorage2.security": "Security", - "advancements.refinedstorage2.security.description": "Secure your storage network with a Security Manager and a Security Card" + "advancements.refinedstorage2.security": "Sicherheit", + "advancements.refinedstorage2.security.description": "Sichern Sie Ihr Speichernetzwerk mit einem Security-Manager und einer Sicherheitskarte" } From 09b1212a04c18cf20550c81bb6fa4fa55aaf6071 Mon Sep 17 00:00:00 2001 From: Raoul Date: Mon, 8 Apr 2024 13:12:17 +0200 Subject: [PATCH 21/26] chore: update translation French from crowdin --- .../assets/refinedstorage2/lang/fr_fr.json | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/fr_fr.json b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/fr_fr.json index 88b7f8735..8adec89ae 100644 --- a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/fr_fr.json +++ b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/fr_fr.json @@ -140,11 +140,11 @@ "gui.refinedstorage2.filter_slot.right_click_for": "Right click for", "gui.refinedstorage2.filter_slot.click_to_clear": "Click to clear", "gui.refinedstorage2.regulator_upgrade.filter_help": "The resource that should be regulated in the target.", - "gui.refinedstorage2.network_transmitter.status.inactive": "Inactive", + "gui.refinedstorage2.network_transmitter.status.inactive": "Inactif", "gui.refinedstorage2.network_transmitter.status.missing_network_card": "Carte réseau manquante", "gui.refinedstorage2.network_transmitter.status.transmitting": "%d bloc(s)", - "gui.refinedstorage2.network_transmitter.status.receiver_unreachable": "Unreachable", - "gui.refinedstorage2.security_card.permission.reset": "Reset", + "gui.refinedstorage2.network_transmitter.status.receiver_unreachable": "Inaccessible", + "gui.refinedstorage2.security_card.permission.reset": "Réinitialiser", "gui.refinedstorage2.security_card.permission.modified": "Modified", "gui.refinedstorage2.security_manager.redstone_mode_help": "Lorsque cet appareil est inactif, le réseau ne sera pas protégé.", "gui.refinedstorage2.security_manager.fallback_security_card_slot_hint": "Emplacement pour une carte de sécurité de repli.", @@ -152,15 +152,15 @@ "item.refinedstorage2.controller.help": "Alimente le réseau de stockage en énergie. Plusieurs sont autorisés dans un seul réseau de stockage. ", "item.refinedstorage2.creative_controller.help": "Alimente le réseau de stockage avec une source d'énergie infinie. ", "item.refinedstorage2.disk_drive.help": "Accepts storage disks to provide the storage network with storage space.", - "item.refinedstorage2.grid.help": "Allows for interacting with the storage network.", - "item.refinedstorage2.crafting_grid.help": "Allows for interacting with the storage network, with crafting abilities.", - "item.refinedstorage2.importer.help": "Imports resources from an external source to the storage network.", - "item.refinedstorage2.exporter.help": "Exports resources from the storage network to an external destination.", - "item.refinedstorage2.interface.help": "Acts as the combination of an Importer and Exporter.", + "item.refinedstorage2.grid.help": "Permet d'interagir avec le réseau de stockage.", + "item.refinedstorage2.crafting_grid.help": "Permet d'interagir avec le réseau de stockage, avec les capacités d'artisanat.", + "item.refinedstorage2.importer.help": "Importe des ressources depuis une source externe vers le réseau de stockage.", + "item.refinedstorage2.exporter.help": "Exporte les ressources du réseau de stockage vers une destination externe.", + "item.refinedstorage2.interface.help": "Agit comme la combinaison d'un importateur et d'un exportateur.", "item.refinedstorage2.external_storage.help": "Provides the storage network with storage from an external source.", "item.refinedstorage2.detector.help": "Émet un signal de redstone si le réseau de stockage contient une ressource en quantité égale, supérieure ou inférieure à un seuil donné.", - "item.refinedstorage2.constructor.help": "Places blocks from the storage network in the world.", - "item.refinedstorage2.destructor.help": "Destroys blocks from the world and puts them in the storage network.", + "item.refinedstorage2.constructor.help": "Place des blocs du réseau de stockage dans le monde.", + "item.refinedstorage2.destructor.help": "Détruit les blocs du monde et les met dans le réseau de stockage.", "item.refinedstorage2.quartz_enriched_iron": "Fer enrichi en quartz", "item.refinedstorage2.processor_binding": "Liant pour processeur", "item.refinedstorage2.silicon": "Silicone", @@ -204,14 +204,14 @@ "item.refinedstorage2.regulator_upgrade.help": "Dans un Exportateur, n'exportera que si le montant dans la cible est inférieur à la valeur configurée dans l'amélioration. Dans un Importateur, n'importera que si le montant dans la cible est supérieur à la valeur configurée dans l'amélioration. Utilisez l'objet pour configurer.", "item.refinedstorage2.range_upgrade": "Amélioration de portée", "item.refinedstorage2.creative_range_upgrade": "Amélioration de portée créative", - "item.refinedstorage2.wireless_grid": "Wireless Grid", - "item.refinedstorage2.creative_wireless_grid": "Creative Wireless Grid", - "item.refinedstorage2.wireless_transmitter.help": "Provides wireless network access for items like the Wireless Grid. Multiple are allowed in an area for wider coverage.", - "item.refinedstorage2.network_item.unbound": "Unbound.", - "item.refinedstorage2.network_item.unbound.help": "Use on any storage network device to bind.", + "item.refinedstorage2.wireless_grid": "Grille sans fil", + "item.refinedstorage2.creative_wireless_grid": "Grille sans fil créative", + "item.refinedstorage2.wireless_transmitter.help": "Fournit un accès au réseau sans fil pour des objets comme la grille sans fil. Plusieurs sont autorisés pour une couverture plus large.", + "item.refinedstorage2.network_item.unbound": "Non liée.", + "item.refinedstorage2.network_item.unbound.help": "Utiliser sur n'importe quel périphérique du réseau de stockage pour relier.", "item.refinedstorage2.network_item.bound_to": "Lié à %d, %d, %d.", - "item.refinedstorage2.network_item.cannot_open_with_shortcut_due_to_duplicate": "There is more than one %s in your inventory.", - "item.refinedstorage2.network_item.cannot_open_because_not_found": "There isn't any %s in your inventory.", + "item.refinedstorage2.network_item.cannot_open_with_shortcut_due_to_duplicate": "Il y a plusieurs %s dans votre inventaire.", + "item.refinedstorage2.network_item.cannot_open_because_not_found": "Il n'y a pas de %s dans votre inventaire.", "item.refinedstorage2.configuration_card": "Carte de configuration", "item.refinedstorage2.configuration_card.empty": "Empty.", "item.refinedstorage2.configuration_card.configured": "Contient une configuration pour %s.", @@ -264,7 +264,7 @@ "key.refinedstorage2.focus_search_bar": "Focus search bar", "key.refinedstorage2.clear_crafting_grid_matrix_to_network": "Clear Crafting Grid matrix to network", "key.refinedstorage2.clear_crafting_grid_matrix_to_inventory": "Clear Crafting Grid matrix to inventory", - "key.refinedstorage2.open_wireless_grid": "Open Wireless Grid", + "key.refinedstorage2.open_wireless_grid": "Ouvrir la grille sans fil", "refinedstorage2.subtitle.wrench": "Wrench used", "curios.identifier.refinedstorage2": "Refined Storage 2", "trinkets.slot.refinedstorage2.wireless": "Refined Storage 2", @@ -343,13 +343,13 @@ "text.autoconfig.refinedstorage2.option.externalStorage": "Stockage Externe", "text.autoconfig.refinedstorage2.option.externalStorage.energyUsage": "Energy usage", "text.autoconfig.refinedstorage2.option.wirelessGrid": "Grille sans fil", - "text.autoconfig.refinedstorage2.option.wirelessGrid.energyCapacity": "Energy capacity", + "text.autoconfig.refinedstorage2.option.wirelessGrid.energyCapacity": "Capacité énergétique", "text.autoconfig.refinedstorage2.option.wirelessGrid.openEnergyUsage": "Open energy usage", "text.autoconfig.refinedstorage2.option.wirelessGrid.insertEnergyUsage": "Insert energy usage", "text.autoconfig.refinedstorage2.option.wirelessGrid.extractEnergyUsage": "Extract energy usage", - "text.autoconfig.refinedstorage2.option.wirelessTransmitter": "Wireless Transmitter", + "text.autoconfig.refinedstorage2.option.wirelessTransmitter": "Émetteur sans fil", "text.autoconfig.refinedstorage2.option.wirelessTransmitter.energyUsage": "Energy usage", - "text.autoconfig.refinedstorage2.option.wirelessTransmitter.baseRange": "Base range", + "text.autoconfig.refinedstorage2.option.wirelessTransmitter.baseRange": "Portée de base", "text.autoconfig.refinedstorage2.option.storageMonitor": "Moniteur de Stockage", "text.autoconfig.refinedstorage2.option.storageMonitor.energyUsage": "Energy usage", "text.autoconfig.refinedstorage2.option.networkReceiver": "Récepteur Réseau", @@ -396,8 +396,8 @@ "advancements.refinedstorage2.construction.description": "Get blocks from the storage network into the world with a Constructor", "advancements.refinedstorage2.destruction": "Destruction", "advancements.refinedstorage2.destruction.description": "Get blocks from in the world into the storage network with a Destructor", - "advancements.refinedstorage2.wireless": "Wireless", - "advancements.refinedstorage2.wireless.description": "Access your resources wirelessly with a Wireless Grid", + "advancements.refinedstorage2.wireless": "Sans fil", + "advancements.refinedstorage2.wireless.description": "Accédez à vos ressources à distance avec une grille sans fil.", "advancements.refinedstorage2.better_than_a_barrel": "Better than a barrel", "advancements.refinedstorage2.better_than_a_barrel.description": "Craft a Storage Monitor to view, insert or extract resources in a storage network", "advancements.refinedstorage2.no_cables_required": "No cables required", From da0c99d49ff77a764cbe24863068926064e087c4 Mon Sep 17 00:00:00 2001 From: Raoul Date: Tue, 9 Apr 2024 14:23:38 +0200 Subject: [PATCH 22/26] chore: update translation French from crowdin --- .../assets/refinedstorage2/lang/fr_fr.json | 166 +++++++++--------- 1 file changed, 83 insertions(+), 83 deletions(-) diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/fr_fr.json b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/fr_fr.json index 8adec89ae..62901bcd9 100644 --- a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/fr_fr.json +++ b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/fr_fr.json @@ -33,11 +33,11 @@ "block.refinedstorage2.portable_grid": "Grille portable", "block.refinedstorage2.creative_portable_grid": "Grille portable créative", "block.refinedstorage2.security_manager": "Poste de sécurité", - "block.refinedstorage2.security_manager.help": "Lorsque cet appareil est actif, il protège le réseau par défaut et bloque toutes les opérations. Commencez à ajouter des Cartes de Sécurité pour permettre ou refuser des opérations spécifiques pour un joueur.", - "gui.refinedstorage2.controller.redstone_mode_help": "Lorsque cet appareil est inactif, le réseau de stockage ne pourra pas utiliser cet appareil comme source d'énergie.", + "block.refinedstorage2.security_manager.help": "Lorsque ce périphérique est actif, il protège le réseau par défaut et bloque toutes les opérations. Commencez à ajouter des Cartes de Sécurité pour permettre ou refuser des opérations spécifiques pour un joueur.", + "gui.refinedstorage2.controller.redstone_mode_help": "Lorsque ce périphérique est inactif, le réseau de stockage ne peut pas utiliser ce périphérique comme source d'énergie.", "gui.refinedstorage2.disk_drive.disks": "Disques", - "gui.refinedstorage2.storage.redstone_mode_help": "Lorsque cet appareil est inactif, le stockage contenu ne sera plus accessible depuis le réseau de stockage.", - "gui.refinedstorage2.storage.filter_help": "Les ressources qui sont autorisées ou non dans ce stockage, en fonction du mode de filtrage de l'appareil.", + "gui.refinedstorage2.storage.redstone_mode_help": "Lorsque ce périphérique est inactif, le stockage contenu ne sera plus accessible depuis le réseau de stockage.", + "gui.refinedstorage2.storage.filter_help": "Les ressources qui sont autorisées ou refusées dans ce stockage, en fonction du mode de filtrage du périphérique.", "gui.refinedstorage2.storage.filter_mode.empty_warning": "Sans filtre configuré, aucune ressource ne sera accepté dans ce stockage.", "gui.refinedstorage2.storage.filter_mode.allow.help": "Autorise dans ce stockage uniquement les ressources configurées dans les filtres.", "gui.refinedstorage2.storage.filter_mode.block.help": "Interdis dans ce stockage les ressources configurées dans les filtres.", @@ -61,10 +61,10 @@ "gui.refinedstorage2.grid.synchronizer.rei": "REI", "gui.refinedstorage2.grid.synchronizer.rei.help": "Synchroniser la recherche avec le filtre de REI.", "gui.refinedstorage2.grid.synchronizer.rei.two_way": "REI bidirectionnel", - "gui.refinedstorage2.grid.synchronizer.rei.two_way.help": "Sync the search box text to the REI filter, and the REI filter to the search box text.", + "gui.refinedstorage2.grid.synchronizer.rei.two_way.help": "Synchroniser la recherche avec le filtre de REI et le filtre de REI avec la recherche.", "gui.refinedstorage2.grid.resource_type": "Type de ressource", "gui.refinedstorage2.grid.resource_type.all": "Toutes", - "gui.refinedstorage2.grid.resource_type.help": "Filter specific resource types.", + "gui.refinedstorage2.grid.resource_type.help": "Filtrer un type de ressources spécifique.", "gui.refinedstorage2.crafting_grid.move.network": "Déplacer les objets dans le réseau", "gui.refinedstorage2.crafting_grid.move.inventory": "Déplacer les objets dans l'inventaire", "gui.refinedstorage2.screen_size": "Taille de l'écran", @@ -79,25 +79,25 @@ "gui.refinedstorage2.detector.mode.above": "Émet un signal de redstone si la valeur est supérieure au seuil.", "gui.refinedstorage2.detector.filter_help": "La ressource qui doit être détectée dans le réseau de stockage.", "gui.refinedstorage2.destructor.pickup_items": "Ramasser des objets au lieu de casser des blocs.", - "gui.refinedstorage2.destructor.filter_help": "The blocks that may or may not be destroyed, depending if the device is in allowlist or blocklist mode.", + "gui.refinedstorage2.destructor.filter_help": "Les blocs qui seront détruits ou ignorés en fonction du mode de filtrage du périphérique.", "gui.refinedstorage2.destructor.filter_mode.allow.help": "Autorise dans le réseau de stockage uniquement les blocs configurés dans les filtres.", "gui.refinedstorage2.destructor.filter_mode.block.help": "Interdit dans le réseau de stockage les blocs configurés dans les filtres.", "gui.refinedstorage2.constructor.drop_items": "Laisser tomber des objets au lieu de placer des blocs.", - "gui.refinedstorage2.constructor.filter_help": "The resources that should be placed from the storage network.", - "gui.refinedstorage2.interface.filter_help": "The resources that should be exported from the storage network.", - "gui.refinedstorage2.exporter.filter_help": "The resources that should be exported from the storage network.", - "gui.refinedstorage2.importer.filter_help": "The resources that may be imported from the target inventory.", + "gui.refinedstorage2.constructor.filter_help": "Les ressources qui doivent être placées depuis le réseau de stockage.", + "gui.refinedstorage2.interface.filter_help": "Les ressources qui doivent être exportées depuis le réseau de stockage.", + "gui.refinedstorage2.exporter.filter_help": "Les ressources qui doivent être exportées depuis le réseau de stockage.", + "gui.refinedstorage2.importer.filter_help": "Les ressources qui doivent être importées depuis l'inventaire ciblé.", "gui.refinedstorage2.importer.filter_mode.allow.help": "Autorise dans le réseau de stockage uniquement les ressources configurées dans les filtres.", "gui.refinedstorage2.importer.filter_mode.block.help": "Interdit dans le réseau de stockage les ressources configurées dans les filtres.", "gui.refinedstorage2.wireless_transmitter.distance": "%d bloc(s)", "gui.refinedstorage2.storage_monitor.filter_help": "La ressource à afficher.", "gui.refinedstorage2.redstone_mode": "Mode redstone", "gui.refinedstorage2.redstone_mode.ignore": "Ignoré", - "gui.refinedstorage2.redstone_mode.ignore.help": "Cet appareil sera toujours actif quel que soit le signal de redstone.", + "gui.refinedstorage2.redstone_mode.ignore.help": "Ce périphérique sera toujours actif quel que soit le signal de redstone.", "gui.refinedstorage2.redstone_mode.high": "Allumé", - "gui.refinedstorage2.redstone_mode.high.help": "Cet appareil sera actif seulement s'il reçoit un signal de redstone.", + "gui.refinedstorage2.redstone_mode.high.help": "Ce périphérique sera actif seulement s'il reçoit un signal de redstone.", "gui.refinedstorage2.redstone_mode.low": "Éteint", - "gui.refinedstorage2.redstone_mode.low.help": "Cet appareil sera actif seulement s'il ne reçoit pas de signal de redstone.", + "gui.refinedstorage2.redstone_mode.low.help": "Ce périphérique sera actif seulement s'il ne reçoit pas de signal de redstone.", "gui.refinedstorage2.scheduling_mode": "Mode de distribution", "gui.refinedstorage2.scheduling_mode.default": "Par défaut", "gui.refinedstorage2.scheduling_mode.default.help": "Utilise le premier filtre disponible.", @@ -109,11 +109,11 @@ "gui.refinedstorage2.priority.storage_help": "L'ordre dans lequel le réseau de stockage va insérer ou extraire les ressources, le plus élevé en premier.", "gui.refinedstorage2.amount": "Quantité", "gui.refinedstorage2.amount.reset": "Réinitialiser", - "gui.refinedstorage2.amount.set": "Set", + "gui.refinedstorage2.amount.set": "Définir", "gui.refinedstorage2.filter_mode": "Mode de filtrage", "gui.refinedstorage2.filter_mode.allow": "Liste blanche", "gui.refinedstorage2.filter_mode.block": "Liste noire", - "gui.refinedstorage2.fuzzy_mode": "Fuzzy mode", + "gui.refinedstorage2.fuzzy_mode": "Mode flou", "gui.refinedstorage2.fuzzy_mode.on": "Activé", "gui.refinedstorage2.fuzzy_mode.on.storage_help": "Match the filters for the allowlist or blocklist exactly.", "gui.refinedstorage2.fuzzy_mode.on.generic_help": "Match the filter exactly.", @@ -126,38 +126,38 @@ "gui.refinedstorage2.fuzzy_mode.off.extracting_source_help": "Match the filters when extracting from the source without comparing NBT tags.", "gui.refinedstorage2.access_mode": "Mode d'accès", "gui.refinedstorage2.access_mode.insert_extract": "Insertion et extraction", - "gui.refinedstorage2.access_mode.insert_extract.help": "The storage network will be able to insert or extract from this storage.", - "gui.refinedstorage2.access_mode.insert": "Insert only", - "gui.refinedstorage2.access_mode.insert.help": "The storage network will only be able to insert into this storage. Contained resources will still be visible in a Grid.", - "gui.refinedstorage2.access_mode.extract": "Extract only", - "gui.refinedstorage2.access_mode.extract.help": "The storage network will only be able to extract from this storage.", - "gui.refinedstorage2.void_excess": "Void excess resources", - "gui.refinedstorage2.void_excess.help": "When void excess mode is turned on and the storage is full, it will keep accepting resources but void them.", - "gui.refinedstorage2.void_excess.allowlist_warning": "Void excess will only work when the storage is in allowlist mode.", - "gui.refinedstorage2.upgrade_slot": "Empty upgrade slot", - "gui.refinedstorage2.filter_slot.empty_filter": "Empty filter", + "gui.refinedstorage2.access_mode.insert_extract.help": "Le réseau de stockage pourra insérer et extraire depuis ce stockage.", + "gui.refinedstorage2.access_mode.insert": "Insertion uniquement", + "gui.refinedstorage2.access_mode.insert.help": "Le réseau de stockage ne pourra qu'insérer dans stockage. Les ressources seront tout de même visible dans une grille.", + "gui.refinedstorage2.access_mode.extract": "Extraction uniquement", + "gui.refinedstorage2.access_mode.extract.help": "Le réseau de stockage ne pourra qu'extraire depuis ce stockage.", + "gui.refinedstorage2.void_excess": "Anéantir les ressources en excès", + "gui.refinedstorage2.void_excess.help": "Quand le mode anéantir les ressources en excès est allumé et que le stockage est plein, il continuera d'accepter les ressources mais les détruira.", + "gui.refinedstorage2.void_excess.allowlist_warning": "Le mode anéantir les ressources en excès ne fonction que lorsque le stockage est en mode liste blanche.", + "gui.refinedstorage2.upgrade_slot": "Emplacement d'amélioration vide", + "gui.refinedstorage2.filter_slot.empty_filter": "Filtre vide", "gui.refinedstorage2.filter_slot.left_click_for": "Left click for", "gui.refinedstorage2.filter_slot.right_click_for": "Right click for", "gui.refinedstorage2.filter_slot.click_to_clear": "Click to clear", - "gui.refinedstorage2.regulator_upgrade.filter_help": "The resource that should be regulated in the target.", + "gui.refinedstorage2.regulator_upgrade.filter_help": "La ressource qui doit être régulée dans la cible.", "gui.refinedstorage2.network_transmitter.status.inactive": "Inactif", "gui.refinedstorage2.network_transmitter.status.missing_network_card": "Carte réseau manquante", "gui.refinedstorage2.network_transmitter.status.transmitting": "%d bloc(s)", "gui.refinedstorage2.network_transmitter.status.receiver_unreachable": "Inaccessible", "gui.refinedstorage2.security_card.permission.reset": "Réinitialiser", - "gui.refinedstorage2.security_card.permission.modified": "Modified", - "gui.refinedstorage2.security_manager.redstone_mode_help": "Lorsque cet appareil est inactif, le réseau ne sera pas protégé.", + "gui.refinedstorage2.security_card.permission.modified": "Modifiée", + "gui.refinedstorage2.security_manager.redstone_mode_help": "Lorsque ce périphérique est inactif, le réseau ne sera pas protégé.", "gui.refinedstorage2.security_manager.fallback_security_card_slot_hint": "Emplacement pour une carte de sécurité de repli.", "gui.refinedstorage2.security_manager.no_fallback_security_card_consequence": "Ajoutez une Carte de sécurité de repli à cet emplacement pour définir les permissions de tous les joueurs sans Carte de sécurité. Par défaut, toutes les actions sont interdites.", "item.refinedstorage2.controller.help": "Alimente le réseau de stockage en énergie. Plusieurs sont autorisés dans un seul réseau de stockage. ", "item.refinedstorage2.creative_controller.help": "Alimente le réseau de stockage avec une source d'énergie infinie. ", - "item.refinedstorage2.disk_drive.help": "Accepts storage disks to provide the storage network with storage space.", + "item.refinedstorage2.disk_drive.help": "Accepte des disques de stockage pour fournir de l'espace de stockage au réseau.", "item.refinedstorage2.grid.help": "Permet d'interagir avec le réseau de stockage.", "item.refinedstorage2.crafting_grid.help": "Permet d'interagir avec le réseau de stockage, avec les capacités d'artisanat.", "item.refinedstorage2.importer.help": "Importe des ressources depuis une source externe vers le réseau de stockage.", "item.refinedstorage2.exporter.help": "Exporte les ressources du réseau de stockage vers une destination externe.", "item.refinedstorage2.interface.help": "Agit comme la combinaison d'un importateur et d'un exportateur.", - "item.refinedstorage2.external_storage.help": "Provides the storage network with storage from an external source.", + "item.refinedstorage2.external_storage.help": "Fournit au réseau de stockage accès à un inventaire externe.", "item.refinedstorage2.detector.help": "Émet un signal de redstone si le réseau de stockage contient une ressource en quantité égale, supérieure ou inférieure à un seuil donné.", "item.refinedstorage2.constructor.help": "Place des blocs du réseau de stockage dans le monde.", "item.refinedstorage2.destructor.help": "Détruit les blocs du monde et les met dans le réseau de stockage.", @@ -192,7 +192,7 @@ "item.refinedstorage2.construction_core": "Cœur de construction", "item.refinedstorage2.destruction_core": "Cœur de destruction", "item.refinedstorage2.wrench": "Clé", - "item.refinedstorage2.wrench.helper": "Utilisez pour faire tourner un bloc, ou appuyez sur Maj et utilisez pour démanteler les blocs de Refined Storage.", + "item.refinedstorage2.wrench.helper": "Utilisez pour faire tourner un bloc, ou appuyez sur Maj et utilisez pour démonter les blocs de Refined Storage.", "item.refinedstorage2.upgrade": "Amélioration", "item.refinedstorage2.speed_upgrade": "Amélioration de vitesse", "item.refinedstorage2.stack_upgrade": "Amélioration de stack", @@ -213,16 +213,16 @@ "item.refinedstorage2.network_item.cannot_open_with_shortcut_due_to_duplicate": "Il y a plusieurs %s dans votre inventaire.", "item.refinedstorage2.network_item.cannot_open_because_not_found": "Il n'y a pas de %s dans votre inventaire.", "item.refinedstorage2.configuration_card": "Carte de configuration", - "item.refinedstorage2.configuration_card.empty": "Empty.", + "item.refinedstorage2.configuration_card.empty": "Vide.", "item.refinedstorage2.configuration_card.configured": "Contient une configuration pour %s.", "item.refinedstorage2.configuration_card.copied_configuration": "Configuration copiée pour %s.", "item.refinedstorage2.configuration_card.cleared_configuration": "Configuration effacée.", - "item.refinedstorage2.configuration_card.cannot_apply_configuration": "Impossible d'appliquer la carte de configuration à un autre type d'appareil. Elle est configurée pour %s.", - "item.refinedstorage2.configuration_card.applied_configuration": "Applied configuration.", - "item.refinedstorage2.configuration_card.empty_help": "Use on a storage network device while crouching to copy its configuration and upgrades to the card.", - "item.refinedstorage2.configuration_card.configured_help": "Use on the destination storage network device while crouching to transfer the configuration and upgrades. Use while crouching to clear.", - "item.refinedstorage2.network_card": "Network Card", - "item.refinedstorage2.network_card.unbound_help": "Use while crouching on a Network Receiver.", + "item.refinedstorage2.configuration_card.cannot_apply_configuration": "Impossible d'appliquer la carte de configuration à un autre type de périphérique. Elle est configurée pour %s.", + "item.refinedstorage2.configuration_card.applied_configuration": "Configuration appliquée.", + "item.refinedstorage2.configuration_card.empty_help": "Utiliser sur un périphérique réseau en étant accroupi pour sauvegarder sa configuration et ses améliorations dans la carte.", + "item.refinedstorage2.configuration_card.configured_help": "Utiliser sur le périphérique de destination en étant accroupi pour transférer la configuration et les améliorations. Utiliser en étant accroupi pour effacer.", + "item.refinedstorage2.network_card": "Carte réseau", + "item.refinedstorage2.network_card.unbound_help": "Utilisez en étant accroupi sur un Récepteur réseau.", "item.refinedstorage2.network_card.unbound": "Unbound.", "item.refinedstorage2.network_card.bound_help": "Insert into a Network Transmitter. Use while crouching to clear binding.", "item.refinedstorage2.network_card.bound": "Bound to %d, %d, %d in %s.", @@ -234,52 +234,52 @@ "item.refinedstorage2.security_card.bound.help": "Right click to configure. Use while crouching to clear configuration and binding.", "item.refinedstorage2.fallback_security_card": "Fallback Security Card", "item.refinedstorage2.fallback_security_card.help": "Acts as a fallback if no matching Security Card for a player is found. Right click to configure. Use while crouching to clear configuration.", - "misc.refinedstorage2.stored": "Stored: %s", - "misc.refinedstorage2.stored_with_capacity": "Stored: %s / %s (%d%%)", + "misc.refinedstorage2.stored": "Stocké : %s", + "misc.refinedstorage2.stored_with_capacity": "Stocké : %s / %s (%d%%)", "misc.refinedstorage2.total": "%d total", - "misc.refinedstorage2.last_modified.just_now": "Last modified just now by %s", - "misc.refinedstorage2.last_modified.second": "Last modified %d second ago by %s", - "misc.refinedstorage2.last_modified.seconds": "Last modified %d seconds ago by %s", - "misc.refinedstorage2.last_modified.minute": "Last modified %d minute ago by %s", - "misc.refinedstorage2.last_modified.minutes": "Last modified %d minutes ago by %s", - "misc.refinedstorage2.last_modified.hour": "Last modified %d hour ago by %s", - "misc.refinedstorage2.last_modified.hours": "Last modified %d hours ago by %s", - "misc.refinedstorage2.last_modified.day": "Last modified %d day ago by %s", - "misc.refinedstorage2.last_modified.days": "Last modified %d days ago by %s", - "misc.refinedstorage2.last_modified.week": "Last modified %d week ago by %s", - "misc.refinedstorage2.last_modified.weeks": "Last modified %d weeks ago by %s", - "misc.refinedstorage2.last_modified.year": "Last modified %d year ago by %s", - "misc.refinedstorage2.last_modified.years": "Last modified %d years ago by %s", - "misc.refinedstorage2.resource_type.item": "Item", - "misc.refinedstorage2.resource_type.fluid": "Fluid", - "misc.refinedstorage2.press_shift_for_help": "Press SHIFT for help", - "misc.refinedstorage2.no_permission": "No permission", - "misc.refinedstorage2.no_permission.open": "You are not allowed to open the %s.", - "misc.refinedstorage2.no_permission.insert": "You are not allowed to insert.", - "misc.refinedstorage2.no_permission.extract": "You are not allowed to extract.", - "misc.refinedstorage2.no_permission.build.place": "You are not allowed to place a %s here.", - "misc.refinedstorage2.no_permission.build.break": "You are not allowed to break the %s.", - "misc.refinedstorage2.no_permission.build.rotate": "You are not allowed to rotate the %s.", - "misc.refinedstorage2.no_permission.build.dismantle": "You are not allowed to dismantle the %s.", + "misc.refinedstorage2.last_modified.just_now": "Dernière modification à l'instant par %s", + "misc.refinedstorage2.last_modified.second": "Dernière modification il y %d seconde par %s", + "misc.refinedstorage2.last_modified.seconds": "Dernière modification il y %d secondes par %s", + "misc.refinedstorage2.last_modified.minute": "Dernière modification il y %d minute par %s", + "misc.refinedstorage2.last_modified.minutes": "Dernière modification il y %d minutes par %s", + "misc.refinedstorage2.last_modified.hour": "Dernière modification il y %d heure par %s", + "misc.refinedstorage2.last_modified.hours": "Dernière modification il y %d heures par %s", + "misc.refinedstorage2.last_modified.day": "Dernière modification il y %d jour par %s", + "misc.refinedstorage2.last_modified.days": "Dernière modification il y %d jours par %s", + "misc.refinedstorage2.last_modified.week": "Dernière modification il y %d semaine par %s", + "misc.refinedstorage2.last_modified.weeks": "Dernière modification il y %d semaines par %s", + "misc.refinedstorage2.last_modified.year": "Dernière modification il y %d an par %s", + "misc.refinedstorage2.last_modified.years": "Dernière modification il y %d ans par %s", + "misc.refinedstorage2.resource_type.item": "Objet", + "misc.refinedstorage2.resource_type.fluid": "Fluide", + "misc.refinedstorage2.press_shift_for_help": "Appuyez sur Maj pour obtenir de l'aide", + "misc.refinedstorage2.no_permission": "Permission manquante", + "misc.refinedstorage2.no_permission.open": "Vous n'êtes pas autorisé à ouvrir %s.", + "misc.refinedstorage2.no_permission.insert": "Vous n'êtes pas autorisé à insérer.", + "misc.refinedstorage2.no_permission.extract": "Vous n'êtes pas autorisé à extraire.", + "misc.refinedstorage2.no_permission.build.place": "Vous n'êtes pas autorisé à placer %s ici.", + "misc.refinedstorage2.no_permission.build.break": "Vous n'êtes pas autorisé à casser %s.", + "misc.refinedstorage2.no_permission.build.rotate": "Vous n'êtes pas autorisé à faire pivoter %s.", + "misc.refinedstorage2.no_permission.build.dismantle": "Vous n'êtes pas autorisé à démonter %s.", "key.refinedstorage2.focus_search_bar": "Focus search bar", - "key.refinedstorage2.clear_crafting_grid_matrix_to_network": "Clear Crafting Grid matrix to network", - "key.refinedstorage2.clear_crafting_grid_matrix_to_inventory": "Clear Crafting Grid matrix to inventory", + "key.refinedstorage2.clear_crafting_grid_matrix_to_network": "Vider la matrice d'artisanat dans le réseau", + "key.refinedstorage2.clear_crafting_grid_matrix_to_inventory": "Vider la matrice d'artisanat dans l'inventaire", "key.refinedstorage2.open_wireless_grid": "Ouvrir la grille sans fil", - "refinedstorage2.subtitle.wrench": "Wrench used", + "refinedstorage2.subtitle.wrench": "Clé utilisée", "curios.identifier.refinedstorage2": "Refined Storage 2", "trinkets.slot.refinedstorage2.wireless": "Refined Storage 2", - "permission.refinedstorage2.insert": "Insert", - "permission.refinedstorage2.insert.description": "Whether the player can insert resources in a network.", - "permission.refinedstorage2.extract": "Extract", - "permission.refinedstorage2.extract.description": "Whether the player can extract resources from a network.", - "permission.refinedstorage2.autocrafting": "Autocrafting", - "permission.refinedstorage2.autocrafting.description": "Whether the player can start, cancel or view an autocrafting task.", - "permission.refinedstorage2.open": "Open", - "permission.refinedstorage2.open.description": "Whether the player can open network device GUIs.", - "permission.refinedstorage2.build": "Build", - "permission.refinedstorage2.build.description": "Whether the player can add or remove network devices.", - "permission.refinedstorage2.security": "Security", - "permission.refinedstorage2.security.description": "Whether the player can manage the security options for a network.", + "permission.refinedstorage2.insert": "Insérer", + "permission.refinedstorage2.insert.description": "Si le joueur peut insérer des ressources dans le réseau.", + "permission.refinedstorage2.extract": "Extraire", + "permission.refinedstorage2.extract.description": "Si le joueur peut extraire des ressources du réseau.", + "permission.refinedstorage2.autocrafting": "Fabrication automatique", + "permission.refinedstorage2.autocrafting.description": "Si le joueur peut démarrer, annuler ou afficher les tâches de fabrication automatique.", + "permission.refinedstorage2.open": "Ouvrir", + "permission.refinedstorage2.open.description": "Si le joueur peut ouvrir l'interface graphique des périphériques du réseau.", + "permission.refinedstorage2.build": "Construire", + "permission.refinedstorage2.build.description": "Si le joueur peut ajouter ou enlever des périphériques au réseau.", + "permission.refinedstorage2.security": "Sécurité", + "permission.refinedstorage2.security.description": "Si le joueur peut gérer les options de sécurité du réseau.", "text.autoconfig.refinedstorage2.title": "Refined Storage 2", "text.autoconfig.refinedstorage2.option.smoothScrolling": "Smooth scrolling", "text.autoconfig.refinedstorage2.option.screenSize": "Screen size", @@ -369,7 +369,7 @@ "text.autoconfig.refinedstorage2.option.securityManager.energyUsage": "Energy usage", "advancements.refinedstorage2.root.description": "Use one or multiple Controllers in a storage network to provide your network with energy", "advancements.refinedstorage2.connecting": "Connecting", - "advancements.refinedstorage2.connecting.description": "Use Cable to connect devices with each other, or place devices against each other", + "advancements.refinedstorage2.connecting.description": "Utiliser un câble pour connecter pour connecter des périphériques ensembles, ou placer les périphériques l'un contre l'autre", "advancements.refinedstorage2.drives": "Drives", "advancements.refinedstorage2.drives.description": "Craft a Disk Drive to be able to store your storage disks", "advancements.refinedstorage2.storing_items": "Storing items", @@ -385,7 +385,7 @@ "advancements.refinedstorage2.exporting": "Exporting", "advancements.refinedstorage2.exporting.description": "Get resources out of the storage network with an Exporter", "advancements.refinedstorage2.upgrading": "Upgrading", - "advancements.refinedstorage2.upgrading.description": "Craft an Upgrade to improve various devices", + "advancements.refinedstorage2.upgrading.description": "Construire une amélioration pour améliorer divers périphériques", "advancements.refinedstorage2.interface_to_the_world": "Interface to the world", "advancements.refinedstorage2.interface_to_the_world.description": "Export and import items at the same time with an Interface", "advancements.refinedstorage2.storing_externally": "Storing externally", @@ -397,7 +397,7 @@ "advancements.refinedstorage2.destruction": "Destruction", "advancements.refinedstorage2.destruction.description": "Get blocks from in the world into the storage network with a Destructor", "advancements.refinedstorage2.wireless": "Sans fil", - "advancements.refinedstorage2.wireless.description": "Accédez à vos ressources à distance avec une grille sans fil.", + "advancements.refinedstorage2.wireless.description": "Accédez à vos ressources à distance avec une grille sans fil", "advancements.refinedstorage2.better_than_a_barrel": "Better than a barrel", "advancements.refinedstorage2.better_than_a_barrel.description": "Craft a Storage Monitor to view, insert or extract resources in a storage network", "advancements.refinedstorage2.no_cables_required": "No cables required", From 55f4f60dee4b4e9fbd6235b7968d2e555f5c98be Mon Sep 17 00:00:00 2001 From: Raoul Date: Sat, 20 Apr 2024 20:47:38 +0200 Subject: [PATCH 23/26] chore: update translation Spanish from crowdin --- .../assets/refinedstorage2/lang/es_es.json | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/es_es.json b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/es_es.json index 841f3e462..29a6bc96d 100644 --- a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/es_es.json +++ b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/es_es.json @@ -1,5 +1,5 @@ { - "mod.refinedstorage2": "Refined Storage 2", + "mod.refinedstorage2": "Almacenamiento refinado 2", "block.refinedstorage2.cable": "Cable", "block.refinedstorage2.quartz_enriched_iron_block": "Bloque de Hierro Enriquecido", "block.refinedstorage2.disk_drive": "Unidad de Disco", @@ -32,8 +32,8 @@ "block.refinedstorage2.network_transmitter": "Transmisor de Red", "block.refinedstorage2.portable_grid": "Rejilla Portátil", "block.refinedstorage2.creative_portable_grid": "Rejilla Portátil Creativa", - "block.refinedstorage2.security_manager": "Security Manager", - "block.refinedstorage2.security_manager.help": "When this device is active, will protect the network by default and block all operations. Start adding Security Cards to permit or deny specific operations for a player.", + "block.refinedstorage2.security_manager": "Gestor de seguridad", + "block.refinedstorage2.security_manager.help": "Cuando este dispositivo está activo, protegerá la red por defecto y bloqueará todas las operaciones. Empieza a añadir tarjetas de seguridad para permitir o denegar operaciones específicas para un jugador.", "gui.refinedstorage2.controller.redstone_mode_help": "Cuando este dispositivo está inactivo, la red de almacenamiento no podrá utilizar este dispositivo como fuente de energía.", "gui.refinedstorage2.disk_drive.disks": "Discos", "gui.refinedstorage2.storage.redstone_mode_help": "Cuando este dispositivo está inactivo, ya no se podrá acceder al almacenamiento contenido desde la red de almacenamiento.", @@ -61,26 +61,26 @@ "gui.refinedstorage2.grid.synchronizer.rei": "REI", "gui.refinedstorage2.grid.synchronizer.rei.help": "Sincroniza el texto del cuadro de búsqueda al filtro REI.", "gui.refinedstorage2.grid.synchronizer.rei.two_way": "REI en dos direcciones", - "gui.refinedstorage2.grid.synchronizer.rei.two_way.help": "Sync the search box text to the REI filter, and the REI filter to the search box text.", + "gui.refinedstorage2.grid.synchronizer.rei.two_way.help": "Sincronice el texto del cuadro de búsqueda al filtro REI, y el filtro REI al texto del cuadro de búsqueda.", "gui.refinedstorage2.grid.resource_type": "Tipo de Recurso", "gui.refinedstorage2.grid.resource_type.all": "Todo", "gui.refinedstorage2.grid.resource_type.help": "Filtrar tipos de recurso específicos.", - "gui.refinedstorage2.crafting_grid.move.network": "Move items to network", - "gui.refinedstorage2.crafting_grid.move.inventory": "Move items to inventory", - "gui.refinedstorage2.screen_size": "Screen size", - "gui.refinedstorage2.screen_size.stretch": "Stretch", - "gui.refinedstorage2.screen_size.small": "Small", - "gui.refinedstorage2.screen_size.medium": "Medium", - "gui.refinedstorage2.screen_size.large": "Large", - "gui.refinedstorage2.screen_size.extra_large": "Extra large", - "gui.refinedstorage2.detector.mode": "Mode", - "gui.refinedstorage2.detector.mode.under": "Emit redstone signal when under the amount", - "gui.refinedstorage2.detector.mode.equal": "Emit redstone signal when on the amount", - "gui.refinedstorage2.detector.mode.above": "Emit redstone signal when above the amount", - "gui.refinedstorage2.detector.filter_help": "The resource that should be detected in the storage network.", - "gui.refinedstorage2.destructor.pickup_items": "Pickup items instead of breaking", - "gui.refinedstorage2.destructor.filter_help": "The blocks that may or may not be destroyed, depending if the device is in allowlist or blocklist mode.", - "gui.refinedstorage2.destructor.filter_mode.allow.help": "Only allow blocks into the storage network that are configured in the filters.", + "gui.refinedstorage2.crafting_grid.move.network": "Mover objetos a la red", + "gui.refinedstorage2.crafting_grid.move.inventory": "Mover objetos al inventario", + "gui.refinedstorage2.screen_size": "Tamaño de pantalla", + "gui.refinedstorage2.screen_size.stretch": "Estirar", + "gui.refinedstorage2.screen_size.small": "Pequeño", + "gui.refinedstorage2.screen_size.medium": "Mediano", + "gui.refinedstorage2.screen_size.large": "Grande", + "gui.refinedstorage2.screen_size.extra_large": "Muy grande", + "gui.refinedstorage2.detector.mode": "Modo", + "gui.refinedstorage2.detector.mode.under": "Emitir señal de redstone cuando esté por debajo de la cantidad", + "gui.refinedstorage2.detector.mode.equal": "Emitir señal de redstone cuando esté en la cantidad", + "gui.refinedstorage2.detector.mode.above": "Emitir señal de redstone cuando esté por encima de la cantidad", + "gui.refinedstorage2.detector.filter_help": "El recurso que debería ser detectado en la red de almacenamiento.", + "gui.refinedstorage2.destructor.pickup_items": "Recoger objetos en lugar de romperlos", + "gui.refinedstorage2.destructor.filter_help": "Los bloques que pueden o no ser destruidos, dependiendo de si el dispositivo está en la lista de permitidos o en el modo de lista de bloqueos.", + "gui.refinedstorage2.destructor.filter_mode.allow.help": "Solo permitir bloques en esta red de almacenamiento que estén configurados en los filtros.", "gui.refinedstorage2.destructor.filter_mode.block.help": "Disallow blocks into the storage network that are configured in the filters.", "gui.refinedstorage2.constructor.drop_items": "Drop items instead of placing blocks", "gui.refinedstorage2.constructor.filter_help": "The resources that should be placed from the storage network.", From 0e0fe83a73476e1374a837b18f6ddd87c36a1073 Mon Sep 17 00:00:00 2001 From: Raoul Date: Mon, 22 Apr 2024 08:40:11 +0200 Subject: [PATCH 24/26] chore: update translation Chinese Simplified from crowdin --- .../src/main/resources/assets/refinedstorage2/lang/zh_cn.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/zh_cn.json b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/zh_cn.json index 1933d6e11..59cda48de 100644 --- a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/zh_cn.json +++ b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/zh_cn.json @@ -404,6 +404,6 @@ "advancements.refinedstorage2.no_cables_required.description": "Add extra components to your storage network without using cables by using a Network Transmitter, Network Receiver and Network Card", "advancements.refinedstorage2.portable_storage": "便携式存储", "advancements.refinedstorage2.portable_storage.description": "合成一个便携式终端,在不需要连接到存储网络的情况下也可以访问磁盘内容。", - "advancements.refinedstorage2.security": "Security", - "advancements.refinedstorage2.security.description": "Secure your storage network with a Security Manager and a Security Card" + "advancements.refinedstorage2.security": "权限", + "advancements.refinedstorage2.security.description": "用权限管理器和权限卡来保护你的存储网络" } From b7c3d94967dbe163b442c77545e1b98d0481c4b7 Mon Sep 17 00:00:00 2001 From: raoulvdberge Date: Fri, 5 Apr 2024 21:22:19 +0200 Subject: [PATCH 25/26] feat: relay and subnetworking --- CHANGELOG.md | 7 + .../core/component/ComponentMapFactory.java | 6 +- .../api/network/energy/EnergyProvider.java | 4 + .../security/SecurityDecisionProvider.java | 6 +- .../security/SecurityNetworkComponent.java | 3 +- .../api/network/security/SecurityPolicy.java | 4 + .../storage/StorageNetworkComponent.java | 3 + .../test/InjectNetworkSecurityComponent.java | 12 + ...ava => InjectNetworkStorageComponent.java} | 2 +- .../network/test/NetworkTest.java | 6 + .../network/test/NetworkTestExtension.java | 54 +- .../network/test/NetworkTestFixtures.java | 8 + .../network/test/SetupNetwork.java | 4 +- .../network/test/SetupNetworks.java | 2 +- .../test/{util => fake}/FakeActor.java | 2 +- .../network/test/fake/FakePermissions.java | 7 + .../FakeResources.java} | 4 +- .../network/test/fake/FakeSecurityActors.java | 7 + .../test/{util => fake}/package-info.java | 2 +- .../AbstractNetworkNodeFactory.java | 2 +- .../ControllerNetworkNodeFactory.java | 2 +- .../DetectorNetworkNodeFactory.java | 2 +- .../ExporterNetworkNodeFactory.java | 2 +- .../ExternalStorageNetworkNodeFactory.java | 2 +- .../nodefactory/GridNetworkNodeFactory.java | 2 +- .../ImporterNetworkNodeFactory.java | 2 +- .../InterfaceNetworkNodeFactory.java | 2 +- .../MultiStorageNetworkNodeFactory.java | 2 +- .../RelayInputNetworkNodeFactory.java | 14 + .../RelayOutputNetworkNodeFactory.java | 14 + .../nodefactory/SimpleNetworkNodeFactory.java | 2 +- .../StorageNetworkNodeFactory.java | 2 +- .../test/NetworkTestExtensionTest.java | 45 +- .../api/network/impl/NetworkBuilderImpl.java | 4 +- .../energy/EnergyNetworkComponentImpl.java | 10 + .../AbstractNetworkNode.java | 2 +- .../network/impl/node/SimpleNetworkNode.java | 2 - .../controller/ControllerNetworkNode.java | 2 +- .../node/detector/DetectorNetworkNode.java | 2 +- .../node/exporter/ExporterNetworkNode.java | 2 +- .../impl/node/grid/GridNetworkNode.java | 2 +- .../impl/node/iface/InterfaceNetworkNode.java | 2 +- .../node/importer/ImporterNetworkNode.java | 2 +- .../impl/node/relay/RelayComponentType.java | 7 + .../node/relay/RelayInputNetworkNode.java | 116 ++++ .../node/relay/RelayOutputNetworkNode.java | 123 ++++ .../impl/node/relay/RelayOutputStorage.java | 181 +++++ .../network/impl/node/relay/package-info.java | 7 + ...urityDecisionProviderProxyNetworkNode.java | 15 +- .../SecurityNetworkComponentImpl.java | 12 +- .../storage/AbstractStorageNetworkNode.java | 1 + .../storage/StorageNetworkComponentImpl.java | 5 + .../impl/PriorityNetworkBuilderImplTest.java | 2 +- .../api/network/impl/SpyingNetworkNode.java | 2 +- .../detector/DetectorNetworkNodeTest.java | 14 +- .../AbstractExporterNetworkNodeTest.java | 108 +-- ...FirstAvailableExporterNetworkNodeTest.java | 48 +- .../RandomExporterNetworkNodeTest.java | 30 +- .../RoundRobinExporterNetworkNodeTest.java | 66 +- .../ExternalStorageNetworkNodeTest.java | 73 +- .../impl/node/grid/GridNetworkNodeTest.java | 36 +- .../ClearSlotInterfaceNetworkNodeTest.java | 36 +- ...rtToEmptySlotInterfaceNetworkNodeTest.java | 52 +- .../node/iface/InterfaceExportStateImpl.java | 6 +- .../node/iface/InterfaceNetworkNodeTest.java | 38 +- ...KeepExportingInterfaceNetworkNodeTest.java | 112 ++-- ...erfaceExternalStorageProviderImplTest.java | 58 +- ...erfaceExternalStorageProviderImplTest.java | 16 +- ...erfaceExternalStorageProviderImplTest.java | 8 +- .../importer/ImporterNetworkNodeTest.java | 110 +-- .../MultiStorageNetworkNodeTest.java | 66 +- .../PriorityMultiStorageNetworkNodeTest.java | 8 +- .../relay/RelayEnergyNetworkNodeTest.java | 106 +++ .../impl/node/relay/RelayNetworkNodeTest.java | 405 +++++++++++ .../relay/RelaySecurityNetworkNodeTest.java | 165 +++++ .../relay/RelayStorageNetworkNodeTest.java | 634 ++++++++++++++++++ .../node/storage/StorageNetworkNodeTest.java | 57 +- .../SecurityNetworkComponentImplTest.java | 171 ++--- .../StorageNetworkComponentImplTest.java | 4 +- .../PlatformSecurityNetworkComponent.java | 5 +- ...stractNetworkNodeContainerBlockEntity.java | 10 +- .../blockstates/black_relay.json | 52 ++ .../blockstates/blue_relay.json | 52 ++ .../blockstates/brown_relay.json | 52 ++ .../blockstates/cyan_relay.json | 52 ++ .../blockstates/gray_relay.json | 52 ++ .../blockstates/green_relay.json | 52 ++ .../blockstates/light_gray_relay.json | 52 ++ .../blockstates/lime_relay.json | 52 ++ .../blockstates/magenta_relay.json | 52 ++ .../blockstates/orange_relay.json | 52 ++ .../blockstates/pink_relay.json | 52 ++ .../blockstates/purple_relay.json | 52 ++ .../blockstates/red_relay.json | 52 ++ .../refinedstorage2/blockstates/relay.json | 52 ++ .../blockstates/white_relay.json | 52 ++ .../blockstates/yellow_relay.json | 52 ++ .../models/block/relay/black.json | 18 + .../models/block/relay/blue.json | 18 + .../models/block/relay/brown.json | 18 + .../models/block/relay/cyan.json | 18 + .../models/block/relay/gray.json | 18 + .../models/block/relay/green.json | 18 + .../models/block/relay/inactive.json | 18 + .../models/block/relay/light_blue.json | 18 + .../models/block/relay/light_gray.json | 18 + .../models/block/relay/lime.json | 18 + .../models/block/relay/magenta.json | 18 + .../models/block/relay/orange.json | 18 + .../models/block/relay/pink.json | 18 + .../models/block/relay/purple.json | 18 + .../models/block/relay/red.json | 18 + .../models/block/relay/white.json | 18 + .../models/block/relay/yellow.json | 18 + .../models/item/black_relay.json | 3 + .../models/item/blue_relay.json | 3 + .../models/item/brown_relay.json | 3 + .../models/item/cyan_relay.json | 3 + .../models/item/gray_relay.json | 3 + .../models/item/green_relay.json | 3 + .../models/item/light_gray_relay.json | 3 + .../models/item/lime_relay.json | 3 + .../models/item/magenta_relay.json | 3 + .../models/item/orange_relay.json | 3 + .../models/item/pink_relay.json | 3 + .../models/item/purple_relay.json | 3 + .../models/item/red_relay.json | 3 + .../refinedstorage2/models/item/relay.json | 3 + .../models/item/white_relay.json | 3 + .../models/item/yellow_relay.json | 3 + .../recipes/misc/coloring/black_relay.json | 32 + .../recipes/misc/coloring/blue_relay.json | 32 + .../recipes/misc/coloring/brown_relay.json | 32 + .../recipes/misc/coloring/cyan_relay.json | 32 + .../recipes/misc/coloring/gray_relay.json | 32 + .../recipes/misc/coloring/green_relay.json | 32 + .../misc/coloring/light_blue_relay.json | 32 + .../misc/coloring/light_gray_relay.json | 32 + .../recipes/misc/coloring/lime_relay.json | 32 + .../recipes/misc/coloring/magenta_relay.json | 32 + .../recipes/misc/coloring/orange_relay.json | 32 + .../recipes/misc/coloring/pink_relay.json | 32 + .../recipes/misc/coloring/purple_relay.json | 32 + .../recipes/misc/coloring/red_relay.json | 32 + .../recipes/misc/coloring/white_relay.json | 32 + .../recipes/misc/coloring/yellow_relay.json | 32 + .../loot_tables/blocks/black_relay.json | 21 + .../loot_tables/blocks/blue_relay.json | 21 + .../loot_tables/blocks/brown_relay.json | 21 + .../loot_tables/blocks/cyan_relay.json | 21 + .../loot_tables/blocks/gray_relay.json | 21 + .../loot_tables/blocks/green_relay.json | 21 + .../loot_tables/blocks/light_gray_relay.json | 21 + .../loot_tables/blocks/lime_relay.json | 21 + .../loot_tables/blocks/magenta_relay.json | 21 + .../loot_tables/blocks/orange_relay.json | 21 + .../loot_tables/blocks/pink_relay.json | 21 + .../loot_tables/blocks/purple_relay.json | 21 + .../loot_tables/blocks/red_relay.json | 21 + .../loot_tables/blocks/relay.json | 21 + .../loot_tables/blocks/white_relay.json | 21 + .../loot_tables/blocks/yellow_relay.json | 21 + .../recipes/coloring/black_relay.json | 15 + .../recipes/coloring/blue_relay.json | 15 + .../recipes/coloring/brown_relay.json | 15 + .../recipes/coloring/cyan_relay.json | 15 + .../recipes/coloring/gray_relay.json | 15 + .../recipes/coloring/green_relay.json | 15 + .../recipes/coloring/light_blue_relay.json | 15 + .../recipes/coloring/light_gray_relay.json | 15 + .../recipes/coloring/lime_relay.json | 15 + .../recipes/coloring/magenta_relay.json | 15 + .../recipes/coloring/orange_relay.json | 15 + .../recipes/coloring/pink_relay.json | 15 + .../recipes/coloring/purple_relay.json | 15 + .../recipes/coloring/red_relay.json | 15 + .../recipes/coloring/white_relay.json | 15 + .../recipes/coloring/yellow_relay.json | 15 + .../refinedstorage2/tags/items/relays.json | 20 + .../common/AbstractClientModInitializer.java | 2 + .../common/AbstractModInitializer.java | 19 + .../platform/common/Config.java | 8 + .../common/content/BlockEntities.java | 11 + .../platform/common/content/Blocks.java | 11 + .../platform/common/content/ContentIds.java | 1 + .../platform/common/content/ContentNames.java | 1 + .../common/content/CreativeModeTabItems.java | 1 + .../common/content/DefaultEnergyUsage.java | 2 + .../platform/common/content/Items.java | 9 + .../platform/common/content/Menus.java | 11 + .../platform/common/content/Tags.java | 1 + .../common/detector/DetectorBlock.java | 4 +- .../common/grid/AbstractGridSynchronizer.java | 2 +- .../NetworkTransmitterBlockEntity.java | 19 +- .../NetworkTransmitterContainerMenu.java | 3 +- .../common/networking/RelayBlock.java | 99 +++ .../common/networking/RelayBlockEntity.java | 246 +++++++ .../common/networking/RelayContainerMenu.java | 154 +++++ .../RelayInputNetworkNodeContainer.java | 36 + .../RelayOutputNetworkNodeContainer.java | 36 + .../RelayPassEnergySideButtonWidget.java | 36 + .../RelayPassSecuritySideButtonWidget.java | 36 + .../RelayPassStorageSideButtonWidget.java | 36 + .../RelayPassThroughSideButtonWidget.java | 36 + .../common/networking/RelayPropertyTypes.java | 24 + .../common/networking/RelayScreen.java | 147 ++++ .../common/storage/AccessModeSettings.java | 6 +- .../AbstractDirectionalCableBlock.java | 4 +- .../common/support/AbstractFilterScreen.java | 6 +- .../AbstractSimpleFilterContainerMenu.java | 22 +- .../support/containermenu/ClientProperty.java | 5 + ...ypeImpl.java => DefaultDirectionType.java} | 18 +- ...actingNetworkNodeContainerBlockEntity.java | 2 +- ...neModeNetworkNodeContainerBlockEntity.java | 8 +- ...dulingNetworkNodeContainerBlockEntity.java | 2 +- ...deableNetworkNodeContainerBlockEntity.java | 2 +- .../BaseNetworkNodeContainerBlockEntity.java | 9 +- .../network/NetworkNodeBlockEntityTicker.java | 2 +- .../widget/AbstractSideButtonWidget.java | 10 +- .../WirelessTransmitterBlock.java | 4 +- ...relessTransmitterNetworkNodeContainer.java | 2 +- .../assets/refinedstorage2/lang/en_us.json | 20 +- .../textures/block/relay/cutouts/in/black.png | Bin 0 -> 2930 bytes .../textures/block/relay/cutouts/in/blue.png | Bin 0 -> 2928 bytes .../textures/block/relay/cutouts/in/brown.png | Bin 0 -> 2941 bytes .../textures/block/relay/cutouts/in/cyan.png | Bin 0 -> 2953 bytes .../textures/block/relay/cutouts/in/gray.png | Bin 0 -> 2935 bytes .../textures/block/relay/cutouts/in/green.png | Bin 0 -> 2945 bytes .../block/relay/cutouts/in/inactive.png | Bin 0 -> 280 bytes .../block/relay/cutouts/in/light_blue.png | Bin 0 -> 334 bytes .../block/relay/cutouts/in/light_gray.png | Bin 0 -> 2922 bytes .../textures/block/relay/cutouts/in/lime.png | Bin 0 -> 2941 bytes .../block/relay/cutouts/in/magenta.png | Bin 0 -> 2932 bytes .../block/relay/cutouts/in/orange.png | Bin 0 -> 2920 bytes .../textures/block/relay/cutouts/in/pink.png | Bin 0 -> 2906 bytes .../block/relay/cutouts/in/purple.png | Bin 0 -> 2946 bytes .../textures/block/relay/cutouts/in/red.png | Bin 0 -> 2924 bytes .../textures/block/relay/cutouts/in/white.png | Bin 0 -> 2908 bytes .../block/relay/cutouts/in/yellow.png | Bin 0 -> 2924 bytes .../block/relay/cutouts/out/black.png | Bin 0 -> 2958 bytes .../textures/block/relay/cutouts/out/blue.png | Bin 0 -> 2957 bytes .../block/relay/cutouts/out/brown.png | Bin 0 -> 2975 bytes .../textures/block/relay/cutouts/out/cyan.png | Bin 0 -> 2985 bytes .../textures/block/relay/cutouts/out/gray.png | Bin 0 -> 2968 bytes .../block/relay/cutouts/out/green.png | Bin 0 -> 2978 bytes .../block/relay/cutouts/out/inactive.png | Bin 0 -> 268 bytes .../block/relay/cutouts/out/light_blue.png | Bin 0 -> 338 bytes .../block/relay/cutouts/out/light_gray.png | Bin 0 -> 2956 bytes .../textures/block/relay/cutouts/out/lime.png | Bin 0 -> 2974 bytes .../block/relay/cutouts/out/magenta.png | Bin 0 -> 2968 bytes .../block/relay/cutouts/out/orange.png | Bin 0 -> 2955 bytes .../textures/block/relay/cutouts/out/pink.png | Bin 0 -> 2930 bytes .../block/relay/cutouts/out/purple.png | Bin 0 -> 2988 bytes .../textures/block/relay/cutouts/out/red.png | Bin 0 -> 2961 bytes .../block/relay/cutouts/out/white.png | Bin 0 -> 2929 bytes .../block/relay/cutouts/out/yellow.png | Bin 0 -> 2955 bytes .../textures/block/relay/in.png | Bin 0 -> 654 bytes .../textures/block/relay/out.png | Bin 0 -> 673 bytes .../assets/refinedstorage2/textures/icons.png | Bin 4278 -> 5035 bytes .../advancements/conditional_connecting.json | 26 + .../data/refinedstorage2/recipes/relay.json | 20 + .../fabric/ClientModInitializerImpl.java | 19 + .../platform/fabric/ConfigImpl.java | 26 +- .../rei/RefinedStorageREIClientPlugin.java | 6 + .../platform/forge/ConfigImpl.java | 32 + .../forge/datagen/BlockModelProviderImpl.java | 102 ++- .../forge/datagen/BlockStateProviderImpl.java | 51 +- .../forge/datagen/ItemModelProviderImpl.java | 9 + .../forge/datagen/loot/BlockDropProvider.java | 2 + .../recipe/RecoloringRecipeProvider.java | 3 + .../datagen/tag/ItemTagsProviderImpl.java | 5 + .../rei/RefinedStorageREIClientPlugin.java | 6 + .../api/storage/channel/StorageChannel.java | 2 +- .../storage/channel/StorageChannelImpl.java | 3 +- .../composite/CompositeAwareChild.java | 4 + .../composite/CompositeStorageImpl.java | 10 + .../storage/composite/PriorityStorage.java} | 12 +- .../channel/StorageChannelImplTest.java | 8 +- .../composite/CompositeStorageImplTest.java | 16 +- .../ExtractCompositeStorageImplTest.java | 4 +- .../InsertCompositeStorageImplTest.java | 4 +- 281 files changed, 6224 insertions(+), 734 deletions(-) create mode 100644 refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/InjectNetworkSecurityComponent.java rename refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/{InjectNetworkStorageChannel.java => InjectNetworkStorageComponent.java} (86%) rename refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/{util => fake}/FakeActor.java (82%) create mode 100644 refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/fake/FakePermissions.java rename refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/{TestResource.java => fake/FakeResources.java} (58%) create mode 100644 refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/fake/FakeSecurityActors.java rename refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/{util => fake}/package-info.java (78%) create mode 100644 refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/RelayInputNetworkNodeFactory.java create mode 100644 refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/RelayOutputNetworkNodeFactory.java rename refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/{storage => node}/AbstractNetworkNode.java (94%) create mode 100644 refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/relay/RelayComponentType.java create mode 100644 refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/relay/RelayInputNetworkNode.java create mode 100644 refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/relay/RelayOutputNetworkNode.java create mode 100644 refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/relay/RelayOutputStorage.java create mode 100644 refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/relay/package-info.java create mode 100644 refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/relay/RelayEnergyNetworkNodeTest.java create mode 100644 refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/relay/RelayNetworkNodeTest.java create mode 100644 refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/relay/RelaySecurityNetworkNodeTest.java create mode 100644 refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/relay/RelayStorageNetworkNodeTest.java create mode 100644 refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/black_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/blue_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/brown_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/cyan_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/gray_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/green_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/light_gray_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/lime_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/magenta_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/orange_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/pink_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/purple_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/red_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/white_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/yellow_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/black.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/blue.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/brown.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/cyan.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/gray.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/green.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/inactive.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/light_blue.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/light_gray.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/lime.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/magenta.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/orange.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/pink.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/purple.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/red.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/white.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/yellow.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/black_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/blue_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/brown_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/cyan_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/gray_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/green_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/light_gray_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/lime_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/magenta_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/orange_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/pink_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/purple_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/red_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/white_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/yellow_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/black_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/blue_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/brown_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/cyan_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/gray_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/green_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/light_blue_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/light_gray_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/lime_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/magenta_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/orange_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/pink_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/purple_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/red_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/white_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/yellow_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/black_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/blue_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/brown_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/cyan_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/gray_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/green_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/light_gray_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/lime_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/magenta_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/orange_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/pink_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/purple_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/red_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/white_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/yellow_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/black_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/blue_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/brown_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/cyan_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/gray_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/green_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/light_blue_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/light_gray_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/lime_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/magenta_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/orange_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/pink_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/purple_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/red_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/white_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/yellow_relay.json create mode 100644 refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/tags/items/relays.json create mode 100644 refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/RelayBlock.java create mode 100644 refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/RelayBlockEntity.java create mode 100644 refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/RelayContainerMenu.java create mode 100644 refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/RelayInputNetworkNodeContainer.java create mode 100644 refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/RelayOutputNetworkNodeContainer.java create mode 100644 refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/RelayPassEnergySideButtonWidget.java create mode 100644 refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/RelayPassSecuritySideButtonWidget.java create mode 100644 refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/RelayPassStorageSideButtonWidget.java create mode 100644 refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/RelayPassThroughSideButtonWidget.java create mode 100644 refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/RelayPropertyTypes.java create mode 100644 refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/RelayScreen.java rename refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/direction/{DirectionTypeImpl.java => DefaultDirectionType.java} (61%) create mode 100644 refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/in/black.png create mode 100644 refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/in/blue.png create mode 100644 refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/in/brown.png create mode 100644 refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/in/cyan.png create mode 100644 refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/in/gray.png create mode 100644 refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/in/green.png create mode 100644 refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/in/inactive.png create mode 100644 refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/in/light_blue.png create mode 100644 refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/in/light_gray.png create mode 100644 refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/in/lime.png create mode 100644 refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/in/magenta.png create mode 100644 refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/in/orange.png create mode 100644 refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/in/pink.png create mode 100644 refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/in/purple.png create mode 100644 refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/in/red.png create mode 100644 refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/in/white.png create mode 100644 refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/in/yellow.png create mode 100644 refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/out/black.png create mode 100644 refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/out/blue.png create mode 100644 refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/out/brown.png create mode 100644 refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/out/cyan.png create mode 100644 refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/out/gray.png create mode 100644 refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/out/green.png create mode 100644 refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/out/inactive.png create mode 100644 refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/out/light_blue.png create mode 100644 refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/out/light_gray.png create mode 100644 refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/out/lime.png create mode 100644 refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/out/magenta.png create mode 100644 refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/out/orange.png create mode 100644 refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/out/pink.png create mode 100644 refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/out/purple.png create mode 100644 refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/out/red.png create mode 100644 refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/out/white.png create mode 100644 refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/out/yellow.png create mode 100644 refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/in.png create mode 100644 refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/out.png create mode 100644 refinedstorage2-platform-common/src/main/resources/data/refinedstorage2/advancements/conditional_connecting.json create mode 100644 refinedstorage2-platform-common/src/main/resources/data/refinedstorage2/recipes/relay.json rename refinedstorage2-storage-api/src/{test/java/com/refinedmods/refinedstorage2/api/storage/composite/PrioritizedStorage.java => main/java/com/refinedmods/refinedstorage2/api/storage/composite/PriorityStorage.java} (53%) diff --git a/CHANGELOG.md b/CHANGELOG.md index c207434b9..c62a7f8ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,9 +7,16 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Added + +- Relay + ### Changed - The Detector, Network Receiver, Network Transmitter and Security Manager will now always connect regardless of color. +- The Relay now has a "pass-through" mode. By default, pass-through is on, which means that when the Relay is active, the network signal from the input network will be passed through as-is to the output side. +- When the "pass-through" mode on the Relay is off, the network signal from the input network will no longer be passed through as-is to the output side, but you can choose to pass the energy buffer, security settings or (specific) storage resources of the input network to the output network. +- When using the Relay when "pass-through" mode is off, and when passing all storage resources or specific storage resources, you can choose the filter mode, whether fuzzy mode is enabled, the access mode and the priority of the storage exposed to the output network. ### Fixed diff --git a/refinedstorage2-core-api/src/main/java/com/refinedmods/refinedstorage2/api/core/component/ComponentMapFactory.java b/refinedstorage2-core-api/src/main/java/com/refinedmods/refinedstorage2/api/core/component/ComponentMapFactory.java index e69e7880d..370f57cf1 100644 --- a/refinedstorage2-core-api/src/main/java/com/refinedmods/refinedstorage2/api/core/component/ComponentMapFactory.java +++ b/refinedstorage2-core-api/src/main/java/com/refinedmods/refinedstorage2/api/core/component/ComponentMapFactory.java @@ -26,9 +26,13 @@ public ComponentMapFactory copy() { return new ComponentMapFactory<>(new LinkedHashMap<>(factories)); } + @SuppressWarnings("unchecked") public ComponentMap buildComponentMap(final X context) { final Map, C> components = new LinkedHashMap<>(); - factories.forEach((componentType, factory) -> components.put(componentType, factory.apply(context))); + factories.forEach((componentType, factory) -> { + final C component = factory.apply(context); + components.put(componentType, component); + }); return new ComponentMap<>(components); } } diff --git a/refinedstorage2-network-api/src/main/java/com/refinedmods/refinedstorage2/api/network/energy/EnergyProvider.java b/refinedstorage2-network-api/src/main/java/com/refinedmods/refinedstorage2/api/network/energy/EnergyProvider.java index 12a671534..8af73c121 100644 --- a/refinedstorage2-network-api/src/main/java/com/refinedmods/refinedstorage2/api/network/energy/EnergyProvider.java +++ b/refinedstorage2-network-api/src/main/java/com/refinedmods/refinedstorage2/api/network/energy/EnergyProvider.java @@ -9,4 +9,8 @@ public interface EnergyProvider { long getCapacity(); long extract(long amount); + + default boolean contains(EnergyProvider energyProvider) { + return false; + } } diff --git a/refinedstorage2-network-api/src/main/java/com/refinedmods/refinedstorage2/api/network/security/SecurityDecisionProvider.java b/refinedstorage2-network-api/src/main/java/com/refinedmods/refinedstorage2/api/network/security/SecurityDecisionProvider.java index 65648e5fc..eb4f3ff1f 100644 --- a/refinedstorage2-network-api/src/main/java/com/refinedmods/refinedstorage2/api/network/security/SecurityDecisionProvider.java +++ b/refinedstorage2-network-api/src/main/java/com/refinedmods/refinedstorage2/api/network/security/SecurityDecisionProvider.java @@ -11,7 +11,11 @@ default SecurityDecision isAllowed(Permission permission) { return SecurityDecision.PASS; } - default boolean isActive() { + default boolean isProviderActive() { return true; } + + default boolean contains(SecurityNetworkComponent component) { + return false; + } } diff --git a/refinedstorage2-network-api/src/main/java/com/refinedmods/refinedstorage2/api/network/security/SecurityNetworkComponent.java b/refinedstorage2-network-api/src/main/java/com/refinedmods/refinedstorage2/api/network/security/SecurityNetworkComponent.java index fcda6ad8c..e87cfa4b2 100644 --- a/refinedstorage2-network-api/src/main/java/com/refinedmods/refinedstorage2/api/network/security/SecurityNetworkComponent.java +++ b/refinedstorage2-network-api/src/main/java/com/refinedmods/refinedstorage2/api/network/security/SecurityNetworkComponent.java @@ -5,7 +5,8 @@ import org.apiguardian.api.API; @API(status = API.Status.STABLE, since = "2.0.0-milestone.3.5") -@FunctionalInterface public interface SecurityNetworkComponent extends NetworkComponent { boolean isAllowed(Permission permission, SecurityActor actor); + + boolean contains(SecurityNetworkComponent component); } diff --git a/refinedstorage2-network-api/src/main/java/com/refinedmods/refinedstorage2/api/network/security/SecurityPolicy.java b/refinedstorage2-network-api/src/main/java/com/refinedmods/refinedstorage2/api/network/security/SecurityPolicy.java index fce560a79..0f997651f 100644 --- a/refinedstorage2-network-api/src/main/java/com/refinedmods/refinedstorage2/api/network/security/SecurityPolicy.java +++ b/refinedstorage2-network-api/src/main/java/com/refinedmods/refinedstorage2/api/network/security/SecurityPolicy.java @@ -9,6 +9,10 @@ public record SecurityPolicy(Set allowedPermissions) { public static final SecurityPolicy EMPTY = new SecurityPolicy(Collections.emptySet()); + public static SecurityPolicy of(final Permission... permissions) { + return new SecurityPolicy(Set.of(permissions)); + } + public boolean isAllowed(final Permission permission) { return allowedPermissions.contains(permission); } diff --git a/refinedstorage2-network-api/src/main/java/com/refinedmods/refinedstorage2/api/network/storage/StorageNetworkComponent.java b/refinedstorage2-network-api/src/main/java/com/refinedmods/refinedstorage2/api/network/storage/StorageNetworkComponent.java index 7b6a9ad0d..29a27ead8 100644 --- a/refinedstorage2-network-api/src/main/java/com/refinedmods/refinedstorage2/api/network/storage/StorageNetworkComponent.java +++ b/refinedstorage2-network-api/src/main/java/com/refinedmods/refinedstorage2/api/network/storage/StorageNetworkComponent.java @@ -2,6 +2,7 @@ import com.refinedmods.refinedstorage2.api.network.NetworkComponent; import com.refinedmods.refinedstorage2.api.storage.Actor; +import com.refinedmods.refinedstorage2.api.storage.Storage; import com.refinedmods.refinedstorage2.api.storage.TrackedResourceAmount; import com.refinedmods.refinedstorage2.api.storage.channel.StorageChannel; @@ -12,4 +13,6 @@ @API(status = API.Status.STABLE, since = "2.0.0-milestone.1.1") public interface StorageNetworkComponent extends NetworkComponent, StorageChannel { List getResources(Class actorType); + + boolean contains(Storage storage); } diff --git a/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/InjectNetworkSecurityComponent.java b/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/InjectNetworkSecurityComponent.java new file mode 100644 index 000000000..d0b87298c --- /dev/null +++ b/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/InjectNetworkSecurityComponent.java @@ -0,0 +1,12 @@ +package com.refinedmods.refinedstorage2.network.test; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.PARAMETER) +public @interface InjectNetworkSecurityComponent { + String networkId() default "default"; +} diff --git a/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/InjectNetworkStorageChannel.java b/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/InjectNetworkStorageComponent.java similarity index 86% rename from refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/InjectNetworkStorageChannel.java rename to refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/InjectNetworkStorageComponent.java index 58b66a386..a78bd1f77 100644 --- a/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/InjectNetworkStorageChannel.java +++ b/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/InjectNetworkStorageComponent.java @@ -7,6 +7,6 @@ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.PARAMETER) -public @interface InjectNetworkStorageChannel { +public @interface InjectNetworkStorageComponent { String networkId() default "default"; } diff --git a/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/NetworkTest.java b/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/NetworkTest.java index bfa7b10aa..15b6880bb 100644 --- a/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/NetworkTest.java +++ b/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/NetworkTest.java @@ -9,6 +9,8 @@ import com.refinedmods.refinedstorage2.api.network.impl.node.iface.InterfaceNetworkNode; import com.refinedmods.refinedstorage2.api.network.impl.node.importer.ImporterNetworkNode; import com.refinedmods.refinedstorage2.api.network.impl.node.multistorage.MultiStorageNetworkNode; +import com.refinedmods.refinedstorage2.api.network.impl.node.relay.RelayInputNetworkNode; +import com.refinedmods.refinedstorage2.api.network.impl.node.relay.RelayOutputNetworkNode; import com.refinedmods.refinedstorage2.api.network.impl.node.storage.StorageNetworkNode; import com.refinedmods.refinedstorage2.network.test.nodefactory.ControllerNetworkNodeFactory; import com.refinedmods.refinedstorage2.network.test.nodefactory.DetectorNetworkNodeFactory; @@ -18,6 +20,8 @@ import com.refinedmods.refinedstorage2.network.test.nodefactory.ImporterNetworkNodeFactory; import com.refinedmods.refinedstorage2.network.test.nodefactory.InterfaceNetworkNodeFactory; import com.refinedmods.refinedstorage2.network.test.nodefactory.MultiStorageNetworkNodeFactory; +import com.refinedmods.refinedstorage2.network.test.nodefactory.RelayInputNetworkNodeFactory; +import com.refinedmods.refinedstorage2.network.test.nodefactory.RelayOutputNetworkNodeFactory; import com.refinedmods.refinedstorage2.network.test.nodefactory.SimpleNetworkNodeFactory; import com.refinedmods.refinedstorage2.network.test.nodefactory.StorageNetworkNodeFactory; @@ -41,5 +45,7 @@ @RegisterNetworkNode(value = InterfaceNetworkNodeFactory.class, clazz = InterfaceNetworkNode.class) @RegisterNetworkNode(value = ExternalStorageNetworkNodeFactory.class, clazz = ExternalStorageNetworkNode.class) @RegisterNetworkNode(value = DetectorNetworkNodeFactory.class, clazz = DetectorNetworkNode.class) +@RegisterNetworkNode(value = RelayInputNetworkNodeFactory.class, clazz = RelayInputNetworkNode.class) +@RegisterNetworkNode(value = RelayOutputNetworkNodeFactory.class, clazz = RelayOutputNetworkNode.class) public @interface NetworkTest { } diff --git a/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/NetworkTestExtension.java b/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/NetworkTestExtension.java index 96c5afaa1..dbcb0be5a 100644 --- a/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/NetworkTestExtension.java +++ b/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/NetworkTestExtension.java @@ -8,13 +8,14 @@ import com.refinedmods.refinedstorage2.api.network.impl.energy.EnergyStorageImpl; import com.refinedmods.refinedstorage2.api.network.impl.node.controller.ControllerNetworkNode; import com.refinedmods.refinedstorage2.api.network.node.NetworkNode; +import com.refinedmods.refinedstorage2.api.network.security.SecurityNetworkComponent; import com.refinedmods.refinedstorage2.api.network.storage.StorageNetworkComponent; -import com.refinedmods.refinedstorage2.api.storage.channel.StorageChannel; import com.refinedmods.refinedstorage2.network.test.nodefactory.NetworkNodeFactory; import java.lang.annotation.Annotation; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -33,9 +34,10 @@ public class NetworkTestExtension implements BeforeEachCallback, ParameterResolv @Override public void beforeEach(final ExtensionContext extensionContext) { - extensionContext - .getTestInstances() - .ifPresent(testInstances -> testInstances.getAllInstances().forEach(this::processTestInstance)); + extensionContext.getTestInstances().ifPresent( + testInstances -> testInstances.getAllInstances().forEach(this::processTestInstance) + ); + extensionContext.getTestMethod().ifPresent(this::processTestMethod); } private void processTestInstance(final Object testInstance) { @@ -45,6 +47,10 @@ private void processTestInstance(final Object testInstance) { addNetworkNodes(testInstance); } + private void processTestMethod(final Method method) { + setupNetworks(method); + } + private void registerNetworkNodes(final Object testInstance) { for (final RegisterNetworkNode annotation : getAnnotations(testInstance, RegisterNetworkNode.class)) { try { @@ -61,10 +67,22 @@ private void registerNetworkNodes(final Object testInstance) { private void setupNetworks(final Object testInstance) { for (final SetupNetwork annotation : getAnnotations(testInstance, SetupNetwork.class)) { - final Network network = new NetworkImpl(NetworkTestFixtures.NETWORK_COMPONENT_MAP_FACTORY); + setupNetwork(annotation); + } + } + + private void setupNetworks(final Method method) { + for (final SetupNetwork annotation : method.getAnnotationsByType(SetupNetwork.class)) { + setupNetwork(annotation); + } + } + + private void setupNetwork(final SetupNetwork annotation) { + final Network network = new NetworkImpl(NetworkTestFixtures.NETWORK_COMPONENT_MAP_FACTORY); + if (annotation.setupEnergy()) { setupNetworkEnergy(annotation.energyCapacity(), annotation.energyStored(), network); - networkMap.put(annotation.id(), network); } + networkMap.put(annotation.id(), network); } private List getAnnotations(final Object testInstance, final Class annotationType) { @@ -173,8 +191,9 @@ private void setField(final Object instance, final Field field, final Object val @Override public boolean supportsParameter(final ParameterContext parameterContext, final ExtensionContext extensionContext) throws ParameterResolutionException { - return parameterContext.isAnnotated(InjectNetworkStorageChannel.class) + return parameterContext.isAnnotated(InjectNetworkStorageComponent.class) || parameterContext.isAnnotated(InjectNetworkEnergyComponent.class) + || parameterContext.isAnnotated(InjectNetworkSecurityComponent.class) || parameterContext.isAnnotated(InjectNetwork.class); } @@ -182,26 +201,29 @@ public boolean supportsParameter(final ParameterContext parameterContext, public Object resolveParameter(final ParameterContext parameterContext, final ExtensionContext extensionContext) throws ParameterResolutionException { return parameterContext - .findAnnotation(InjectNetworkStorageChannel.class) - .map(annotation -> (Object) getNetworkStorageChannel(annotation.networkId())) + .findAnnotation(InjectNetworkStorageComponent.class) + .map(annotation -> (Object) getNetworkStorage(annotation.networkId())) .or(() -> parameterContext .findAnnotation(InjectNetworkEnergyComponent.class) .map(annotation -> (Object) getNetworkEnergy(annotation.networkId()))) + .or(() -> parameterContext + .findAnnotation(InjectNetworkSecurityComponent.class) + .map(annotation -> (Object) getNetworkSecurity(annotation.networkId()))) .or(() -> parameterContext .findAnnotation(InjectNetwork.class) .map(annotation -> networkMap.get(annotation.value()))) .orElseThrow(); } - private StorageChannel getNetworkStorageChannel(final String networkId) { - return networkMap - .get(networkId) - .getComponent(StorageNetworkComponent.class); + private StorageNetworkComponent getNetworkStorage(final String networkId) { + return networkMap.get(networkId).getComponent(StorageNetworkComponent.class); } private EnergyNetworkComponent getNetworkEnergy(final String networkId) { - return networkMap - .get(networkId) - .getComponent(EnergyNetworkComponent.class); + return networkMap.get(networkId).getComponent(EnergyNetworkComponent.class); + } + + private SecurityNetworkComponent getNetworkSecurity(final String networkId) { + return networkMap.get(networkId).getComponent(SecurityNetworkComponent.class); } } diff --git a/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/NetworkTestFixtures.java b/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/NetworkTestFixtures.java index 71914cc5f..4cbfc678c 100644 --- a/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/NetworkTestFixtures.java +++ b/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/NetworkTestFixtures.java @@ -6,10 +6,14 @@ import com.refinedmods.refinedstorage2.api.network.energy.EnergyNetworkComponent; import com.refinedmods.refinedstorage2.api.network.impl.energy.EnergyNetworkComponentImpl; import com.refinedmods.refinedstorage2.api.network.impl.node.GraphNetworkComponentImpl; +import com.refinedmods.refinedstorage2.api.network.impl.security.SecurityNetworkComponentImpl; import com.refinedmods.refinedstorage2.api.network.impl.storage.StorageNetworkComponentImpl; import com.refinedmods.refinedstorage2.api.network.node.GraphNetworkComponent; +import com.refinedmods.refinedstorage2.api.network.security.SecurityNetworkComponent; +import com.refinedmods.refinedstorage2.api.network.security.SecurityPolicy; import com.refinedmods.refinedstorage2.api.network.storage.StorageNetworkComponent; import com.refinedmods.refinedstorage2.api.resource.list.ResourceListImpl; +import com.refinedmods.refinedstorage2.network.test.fake.FakePermissions; public final class NetworkTestFixtures { public static final ComponentMapFactory NETWORK_COMPONENT_MAP_FACTORY = @@ -28,6 +32,10 @@ public final class NetworkTestFixtures { StorageNetworkComponent.class, network -> new StorageNetworkComponentImpl(new ResourceListImpl()) ); + NETWORK_COMPONENT_MAP_FACTORY.addFactory( + SecurityNetworkComponent.class, + network -> new SecurityNetworkComponentImpl(SecurityPolicy.of(FakePermissions.ALLOW_BY_DEFAULT)) + ); } private NetworkTestFixtures() { diff --git a/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/SetupNetwork.java b/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/SetupNetwork.java index 33d86306c..566fc4889 100644 --- a/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/SetupNetwork.java +++ b/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/SetupNetwork.java @@ -7,12 +7,14 @@ import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) +@Target({ElementType.TYPE, ElementType.METHOD}) @Repeatable(SetupNetworks.class) public @interface SetupNetwork { long energyStored() default Long.MAX_VALUE; long energyCapacity() default Long.MAX_VALUE; + boolean setupEnergy() default true; + String id() default "default"; } diff --git a/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/SetupNetworks.java b/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/SetupNetworks.java index d1eb45dbd..409d5b997 100644 --- a/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/SetupNetworks.java +++ b/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/SetupNetworks.java @@ -6,7 +6,7 @@ import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) +@Target({ElementType.TYPE, ElementType.METHOD}) public @interface SetupNetworks { SetupNetwork[] value(); } diff --git a/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/util/FakeActor.java b/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/fake/FakeActor.java similarity index 82% rename from refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/util/FakeActor.java rename to refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/fake/FakeActor.java index 27f1d6963..c746b2e03 100644 --- a/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/util/FakeActor.java +++ b/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/fake/FakeActor.java @@ -1,4 +1,4 @@ -package com.refinedmods.refinedstorage2.network.test.util; +package com.refinedmods.refinedstorage2.network.test.fake; import com.refinedmods.refinedstorage2.api.storage.Actor; diff --git a/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/fake/FakePermissions.java b/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/fake/FakePermissions.java new file mode 100644 index 000000000..8e8e42914 --- /dev/null +++ b/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/fake/FakePermissions.java @@ -0,0 +1,7 @@ +package com.refinedmods.refinedstorage2.network.test.fake; + +import com.refinedmods.refinedstorage2.api.network.security.Permission; + +public enum FakePermissions implements Permission { + ALLOW_BY_DEFAULT, OTHER, OTHER2 +} diff --git a/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/TestResource.java b/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/fake/FakeResources.java similarity index 58% rename from refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/TestResource.java rename to refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/fake/FakeResources.java index d5fa8fd57..3a3f9faca 100644 --- a/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/TestResource.java +++ b/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/fake/FakeResources.java @@ -1,8 +1,8 @@ -package com.refinedmods.refinedstorage2.network.test; +package com.refinedmods.refinedstorage2.network.test.fake; import com.refinedmods.refinedstorage2.api.resource.ResourceKey; -public enum TestResource implements ResourceKey { +public enum FakeResources implements ResourceKey { A, A_ALTERNATIVE, A_ALTERNATIVE2, diff --git a/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/fake/FakeSecurityActors.java b/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/fake/FakeSecurityActors.java new file mode 100644 index 000000000..c0852bf24 --- /dev/null +++ b/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/fake/FakeSecurityActors.java @@ -0,0 +1,7 @@ +package com.refinedmods.refinedstorage2.network.test.fake; + +import com.refinedmods.refinedstorage2.api.network.security.SecurityActor; + +public enum FakeSecurityActors implements SecurityActor { + A, B, C +} diff --git a/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/util/package-info.java b/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/fake/package-info.java similarity index 78% rename from refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/util/package-info.java rename to refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/fake/package-info.java index a2f32aa2c..c0900bc54 100644 --- a/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/util/package-info.java +++ b/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/fake/package-info.java @@ -1,6 +1,6 @@ @ParametersAreNonnullByDefault @FieldsAndMethodsAreNonnullByDefault -package com.refinedmods.refinedstorage2.network.test.util; +package com.refinedmods.refinedstorage2.network.test.fake; import com.refinedmods.refinedstorage2.api.core.FieldsAndMethodsAreNonnullByDefault; diff --git a/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/AbstractNetworkNodeFactory.java b/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/AbstractNetworkNodeFactory.java index e6093f416..995a66a29 100644 --- a/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/AbstractNetworkNodeFactory.java +++ b/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/AbstractNetworkNodeFactory.java @@ -1,6 +1,6 @@ package com.refinedmods.refinedstorage2.network.test.nodefactory; -import com.refinedmods.refinedstorage2.api.network.impl.storage.AbstractNetworkNode; +import com.refinedmods.refinedstorage2.api.network.impl.node.AbstractNetworkNode; import com.refinedmods.refinedstorage2.api.network.node.NetworkNode; import com.refinedmods.refinedstorage2.network.test.AddNetworkNode; diff --git a/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/ControllerNetworkNodeFactory.java b/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/ControllerNetworkNodeFactory.java index 7db29d3ee..4b2e9d739 100644 --- a/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/ControllerNetworkNodeFactory.java +++ b/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/ControllerNetworkNodeFactory.java @@ -1,7 +1,7 @@ package com.refinedmods.refinedstorage2.network.test.nodefactory; +import com.refinedmods.refinedstorage2.api.network.impl.node.AbstractNetworkNode; import com.refinedmods.refinedstorage2.api.network.impl.node.controller.ControllerNetworkNode; -import com.refinedmods.refinedstorage2.api.network.impl.storage.AbstractNetworkNode; import com.refinedmods.refinedstorage2.network.test.AddNetworkNode; import java.util.Map; diff --git a/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/DetectorNetworkNodeFactory.java b/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/DetectorNetworkNodeFactory.java index c6f1830fb..84bb4f968 100644 --- a/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/DetectorNetworkNodeFactory.java +++ b/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/DetectorNetworkNodeFactory.java @@ -1,7 +1,7 @@ package com.refinedmods.refinedstorage2.network.test.nodefactory; +import com.refinedmods.refinedstorage2.api.network.impl.node.AbstractNetworkNode; import com.refinedmods.refinedstorage2.api.network.impl.node.detector.DetectorNetworkNode; -import com.refinedmods.refinedstorage2.api.network.impl.storage.AbstractNetworkNode; import com.refinedmods.refinedstorage2.network.test.AddNetworkNode; import java.util.Map; diff --git a/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/ExporterNetworkNodeFactory.java b/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/ExporterNetworkNodeFactory.java index 1c1addc8c..785efded3 100644 --- a/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/ExporterNetworkNodeFactory.java +++ b/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/ExporterNetworkNodeFactory.java @@ -1,7 +1,7 @@ package com.refinedmods.refinedstorage2.network.test.nodefactory; +import com.refinedmods.refinedstorage2.api.network.impl.node.AbstractNetworkNode; import com.refinedmods.refinedstorage2.api.network.impl.node.exporter.ExporterNetworkNode; -import com.refinedmods.refinedstorage2.api.network.impl.storage.AbstractNetworkNode; import com.refinedmods.refinedstorage2.network.test.AddNetworkNode; import java.util.Map; diff --git a/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/ExternalStorageNetworkNodeFactory.java b/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/ExternalStorageNetworkNodeFactory.java index 3827224d0..dab53f6ce 100644 --- a/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/ExternalStorageNetworkNodeFactory.java +++ b/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/ExternalStorageNetworkNodeFactory.java @@ -1,7 +1,7 @@ package com.refinedmods.refinedstorage2.network.test.nodefactory; +import com.refinedmods.refinedstorage2.api.network.impl.node.AbstractNetworkNode; import com.refinedmods.refinedstorage2.api.network.impl.node.externalstorage.ExternalStorageNetworkNode; -import com.refinedmods.refinedstorage2.api.network.impl.storage.AbstractNetworkNode; import com.refinedmods.refinedstorage2.api.storage.tracked.InMemoryTrackedStorageRepository; import com.refinedmods.refinedstorage2.network.test.AddNetworkNode; diff --git a/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/GridNetworkNodeFactory.java b/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/GridNetworkNodeFactory.java index 48ae36153..b44076bb4 100644 --- a/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/GridNetworkNodeFactory.java +++ b/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/GridNetworkNodeFactory.java @@ -1,7 +1,7 @@ package com.refinedmods.refinedstorage2.network.test.nodefactory; +import com.refinedmods.refinedstorage2.api.network.impl.node.AbstractNetworkNode; import com.refinedmods.refinedstorage2.api.network.impl.node.grid.GridNetworkNode; -import com.refinedmods.refinedstorage2.api.network.impl.storage.AbstractNetworkNode; import com.refinedmods.refinedstorage2.network.test.AddNetworkNode; import java.util.Map; diff --git a/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/ImporterNetworkNodeFactory.java b/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/ImporterNetworkNodeFactory.java index 8cd7444af..95cd430c4 100644 --- a/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/ImporterNetworkNodeFactory.java +++ b/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/ImporterNetworkNodeFactory.java @@ -1,7 +1,7 @@ package com.refinedmods.refinedstorage2.network.test.nodefactory; +import com.refinedmods.refinedstorage2.api.network.impl.node.AbstractNetworkNode; import com.refinedmods.refinedstorage2.api.network.impl.node.importer.ImporterNetworkNode; -import com.refinedmods.refinedstorage2.api.network.impl.storage.AbstractNetworkNode; import com.refinedmods.refinedstorage2.network.test.AddNetworkNode; import java.util.Map; diff --git a/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/InterfaceNetworkNodeFactory.java b/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/InterfaceNetworkNodeFactory.java index dca9012be..96a33ac88 100644 --- a/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/InterfaceNetworkNodeFactory.java +++ b/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/InterfaceNetworkNodeFactory.java @@ -1,7 +1,7 @@ package com.refinedmods.refinedstorage2.network.test.nodefactory; +import com.refinedmods.refinedstorage2.api.network.impl.node.AbstractNetworkNode; import com.refinedmods.refinedstorage2.api.network.impl.node.iface.InterfaceNetworkNode; -import com.refinedmods.refinedstorage2.api.network.impl.storage.AbstractNetworkNode; import com.refinedmods.refinedstorage2.network.test.AddNetworkNode; import java.util.Map; diff --git a/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/MultiStorageNetworkNodeFactory.java b/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/MultiStorageNetworkNodeFactory.java index 7543f8b51..0e56caffe 100644 --- a/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/MultiStorageNetworkNodeFactory.java +++ b/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/MultiStorageNetworkNodeFactory.java @@ -1,7 +1,7 @@ package com.refinedmods.refinedstorage2.network.test.nodefactory; +import com.refinedmods.refinedstorage2.api.network.impl.node.AbstractNetworkNode; import com.refinedmods.refinedstorage2.api.network.impl.node.multistorage.MultiStorageNetworkNode; -import com.refinedmods.refinedstorage2.api.network.impl.storage.AbstractNetworkNode; import com.refinedmods.refinedstorage2.network.test.AddNetworkNode; import java.util.Map; diff --git a/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/RelayInputNetworkNodeFactory.java b/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/RelayInputNetworkNodeFactory.java new file mode 100644 index 000000000..a5a404150 --- /dev/null +++ b/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/RelayInputNetworkNodeFactory.java @@ -0,0 +1,14 @@ +package com.refinedmods.refinedstorage2.network.test.nodefactory; + +import com.refinedmods.refinedstorage2.api.network.impl.node.AbstractNetworkNode; +import com.refinedmods.refinedstorage2.api.network.impl.node.relay.RelayInputNetworkNode; +import com.refinedmods.refinedstorage2.network.test.AddNetworkNode; + +import java.util.Map; + +public class RelayInputNetworkNodeFactory extends AbstractNetworkNodeFactory { + @Override + protected AbstractNetworkNode innerCreate(final AddNetworkNode ctx, final Map properties) { + return new RelayInputNetworkNode(getEnergyUsage(properties)); + } +} diff --git a/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/RelayOutputNetworkNodeFactory.java b/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/RelayOutputNetworkNodeFactory.java new file mode 100644 index 000000000..5fe51e9f1 --- /dev/null +++ b/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/RelayOutputNetworkNodeFactory.java @@ -0,0 +1,14 @@ +package com.refinedmods.refinedstorage2.network.test.nodefactory; + +import com.refinedmods.refinedstorage2.api.network.impl.node.AbstractNetworkNode; +import com.refinedmods.refinedstorage2.api.network.impl.node.relay.RelayOutputNetworkNode; +import com.refinedmods.refinedstorage2.network.test.AddNetworkNode; + +import java.util.Map; + +public class RelayOutputNetworkNodeFactory extends AbstractNetworkNodeFactory { + @Override + protected AbstractNetworkNode innerCreate(final AddNetworkNode ctx, final Map properties) { + return new RelayOutputNetworkNode(getEnergyUsage(properties)); + } +} diff --git a/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/SimpleNetworkNodeFactory.java b/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/SimpleNetworkNodeFactory.java index ad1c8380f..894ca653f 100644 --- a/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/SimpleNetworkNodeFactory.java +++ b/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/SimpleNetworkNodeFactory.java @@ -1,7 +1,7 @@ package com.refinedmods.refinedstorage2.network.test.nodefactory; +import com.refinedmods.refinedstorage2.api.network.impl.node.AbstractNetworkNode; import com.refinedmods.refinedstorage2.api.network.impl.node.SimpleNetworkNode; -import com.refinedmods.refinedstorage2.api.network.impl.storage.AbstractNetworkNode; import com.refinedmods.refinedstorage2.network.test.AddNetworkNode; import java.util.Map; diff --git a/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/StorageNetworkNodeFactory.java b/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/StorageNetworkNodeFactory.java index 2c7cb7aca..9600b77f0 100644 --- a/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/StorageNetworkNodeFactory.java +++ b/refinedstorage2-network-test/src/main/java/com/refinedmods/refinedstorage2/network/test/nodefactory/StorageNetworkNodeFactory.java @@ -1,7 +1,7 @@ package com.refinedmods.refinedstorage2.network.test.nodefactory; +import com.refinedmods.refinedstorage2.api.network.impl.node.AbstractNetworkNode; import com.refinedmods.refinedstorage2.api.network.impl.node.storage.StorageNetworkNode; -import com.refinedmods.refinedstorage2.api.network.impl.storage.AbstractNetworkNode; import com.refinedmods.refinedstorage2.network.test.AddNetworkNode; import java.util.Map; diff --git a/refinedstorage2-network-test/src/test/java/com/refinedmods/refinedstorage2/network/test/NetworkTestExtensionTest.java b/refinedstorage2-network-test/src/test/java/com/refinedmods/refinedstorage2/network/test/NetworkTestExtensionTest.java index fa703a9b1..f842ed7c8 100644 --- a/refinedstorage2-network-test/src/test/java/com/refinedmods/refinedstorage2/network/test/NetworkTestExtensionTest.java +++ b/refinedstorage2-network-test/src/test/java/com/refinedmods/refinedstorage2/network/test/NetworkTestExtensionTest.java @@ -7,8 +7,8 @@ import com.refinedmods.refinedstorage2.api.network.impl.node.storage.StorageNetworkNode; import com.refinedmods.refinedstorage2.api.network.node.GraphNetworkComponent; import com.refinedmods.refinedstorage2.api.network.node.container.NetworkNodeContainer; +import com.refinedmods.refinedstorage2.api.network.security.SecurityNetworkComponent; import com.refinedmods.refinedstorage2.api.network.storage.StorageNetworkComponent; -import com.refinedmods.refinedstorage2.api.storage.channel.StorageChannel; import com.refinedmods.refinedstorage2.network.test.nodefactory.AbstractNetworkNodeFactory; import com.refinedmods.refinedstorage2.network.test.nodefactory.MultiStorageNetworkNodeFactory; import com.refinedmods.refinedstorage2.network.test.nodefactory.SimpleNetworkNodeFactory; @@ -62,6 +62,29 @@ void shouldSetNetwork() { assertThat(storageInB.getNetwork()).isEqualTo(b); } + @Test + @SetupNetwork(id = "method_test") + void shouldSetNetworkThroughMethod( + @InjectNetwork("method_test") final Network network + ) { + // Assert + assertThat(network) + .isNotNull() + .isNotEqualTo(a) + .isNotEqualTo(b); + } + + @Test + @SetupNetwork(id = "without_energy", setupEnergy = false) + void shouldNotSetupEnergy( + @InjectNetworkEnergyComponent(networkId = "without_energy") final EnergyNetworkComponent energy + ) { + // Assert + assertThat(energy.getStored()).isZero(); + assertThat(energy.getCapacity()).isZero(); + assertThat(energy.extract(1)).isZero(); + } + @Test void shouldSetActivenessOfNetworkNode() { // Assert @@ -106,13 +129,13 @@ void shouldAddNetworkNodeToGraph() { } @Test - void shouldInjectStorageChannel( - @InjectNetworkStorageChannel(networkId = "a") final StorageChannel storageChannelA, - @InjectNetworkStorageChannel(networkId = "b") final StorageChannel storageChannelB + void shouldInjectNetworkStorageComponent( + @InjectNetworkStorageComponent(networkId = "a") final StorageNetworkComponent networkStorageA, + @InjectNetworkStorageComponent(networkId = "b") final StorageNetworkComponent networkStorageB ) { // Assert - assertThat(storageChannelA).isSameAs(a.getComponent(StorageNetworkComponent.class)); - assertThat(storageChannelB).isSameAs(b.getComponent(StorageNetworkComponent.class)); + assertThat(networkStorageA).isSameAs(a.getComponent(StorageNetworkComponent.class)); + assertThat(networkStorageB).isSameAs(b.getComponent(StorageNetworkComponent.class)); } @Test @@ -125,6 +148,16 @@ void shouldInjectNetworkEnergyComponent( assertThat(networkEnergyB).isSameAs(b.getComponent(EnergyNetworkComponent.class)); } + @Test + void shouldInjectNetworkSecurityComponent( + @InjectNetworkSecurityComponent(networkId = "a") final SecurityNetworkComponent networkSecurityA, + @InjectNetworkSecurityComponent(networkId = "b") final SecurityNetworkComponent networkSecurityB + ) { + // Assert + assertThat(networkSecurityA).isSameAs(a.getComponent(SecurityNetworkComponent.class)); + assertThat(networkSecurityB).isSameAs(b.getComponent(SecurityNetworkComponent.class)); + } + @Test void shouldInjectNetworkThroughParameter( @InjectNetwork("a") final Network injectedA, diff --git a/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/NetworkBuilderImpl.java b/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/NetworkBuilderImpl.java index 52404150c..2ab334726 100644 --- a/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/NetworkBuilderImpl.java +++ b/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/NetworkBuilderImpl.java @@ -163,7 +163,9 @@ private void splitNetworks(final ConnectionProvider connectionProvider, connectionProvider.sortDeterministically(removedEntries).stream().sorted(HIGHEST_PRIORITY_FIRST).forEach(e -> { if (e.getNode().getNetwork() == null) { - throw new IllegalStateException("Network of resulting removed node cannot be empty"); + throw new IllegalStateException( + "Network of resulting removed node (" + e.getNode() + ") cannot be empty" + ); } e.getNode().getNetwork().removeContainer(e); e.getNode().setNetwork(null); diff --git a/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/energy/EnergyNetworkComponentImpl.java b/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/energy/EnergyNetworkComponentImpl.java index 8a6aed6db..2c158a91a 100644 --- a/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/energy/EnergyNetworkComponentImpl.java +++ b/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/energy/EnergyNetworkComponentImpl.java @@ -59,4 +59,14 @@ public long extract(final long amount) { } return extracted; } + + @Override + public boolean contains(final EnergyProvider energyProvider) { + for (final EnergyProvider provider : providers) { + if (provider.contains(energyProvider)) { + return true; + } + } + return false; + } } diff --git a/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/storage/AbstractNetworkNode.java b/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/AbstractNetworkNode.java similarity index 94% rename from refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/storage/AbstractNetworkNode.java rename to refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/AbstractNetworkNode.java index 62668a51e..ab56f816f 100644 --- a/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/storage/AbstractNetworkNode.java +++ b/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/AbstractNetworkNode.java @@ -1,4 +1,4 @@ -package com.refinedmods.refinedstorage2.api.network.impl.storage; +package com.refinedmods.refinedstorage2.api.network.impl.node; import com.refinedmods.refinedstorage2.api.network.Network; import com.refinedmods.refinedstorage2.api.network.energy.EnergyNetworkComponent; diff --git a/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/SimpleNetworkNode.java b/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/SimpleNetworkNode.java index 7a2e3af67..c96642d8f 100644 --- a/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/SimpleNetworkNode.java +++ b/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/SimpleNetworkNode.java @@ -1,7 +1,5 @@ package com.refinedmods.refinedstorage2.api.network.impl.node; -import com.refinedmods.refinedstorage2.api.network.impl.storage.AbstractNetworkNode; - public class SimpleNetworkNode extends AbstractNetworkNode { private long energyUsage; diff --git a/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/controller/ControllerNetworkNode.java b/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/controller/ControllerNetworkNode.java index 005649dac..c5ff7f7aa 100644 --- a/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/controller/ControllerNetworkNode.java +++ b/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/controller/ControllerNetworkNode.java @@ -3,7 +3,7 @@ import com.refinedmods.refinedstorage2.api.core.Action; import com.refinedmods.refinedstorage2.api.network.energy.EnergyProvider; import com.refinedmods.refinedstorage2.api.network.energy.EnergyStorage; -import com.refinedmods.refinedstorage2.api.network.impl.storage.AbstractNetworkNode; +import com.refinedmods.refinedstorage2.api.network.impl.node.AbstractNetworkNode; import javax.annotation.Nullable; diff --git a/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/detector/DetectorNetworkNode.java b/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/detector/DetectorNetworkNode.java index fb6d9c53c..80a6d0ece 100644 --- a/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/detector/DetectorNetworkNode.java +++ b/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/detector/DetectorNetworkNode.java @@ -1,6 +1,6 @@ package com.refinedmods.refinedstorage2.api.network.impl.node.detector; -import com.refinedmods.refinedstorage2.api.network.impl.storage.AbstractNetworkNode; +import com.refinedmods.refinedstorage2.api.network.impl.node.AbstractNetworkNode; import com.refinedmods.refinedstorage2.api.resource.ResourceKey; import javax.annotation.Nullable; diff --git a/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/exporter/ExporterNetworkNode.java b/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/exporter/ExporterNetworkNode.java index 9ae1f3962..456528588 100644 --- a/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/exporter/ExporterNetworkNode.java +++ b/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/exporter/ExporterNetworkNode.java @@ -1,7 +1,7 @@ package com.refinedmods.refinedstorage2.api.network.impl.node.exporter; import com.refinedmods.refinedstorage2.api.network.Network; -import com.refinedmods.refinedstorage2.api.network.impl.storage.AbstractNetworkNode; +import com.refinedmods.refinedstorage2.api.network.impl.node.AbstractNetworkNode; import com.refinedmods.refinedstorage2.api.network.node.NetworkNodeActor; import com.refinedmods.refinedstorage2.api.network.node.exporter.ExporterTransferStrategy; import com.refinedmods.refinedstorage2.api.network.node.task.Task; diff --git a/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/grid/GridNetworkNode.java b/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/grid/GridNetworkNode.java index 1df665710..14bd41a2e 100644 --- a/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/grid/GridNetworkNode.java +++ b/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/grid/GridNetworkNode.java @@ -4,7 +4,7 @@ import com.refinedmods.refinedstorage2.api.grid.watcher.GridWatcherManager; import com.refinedmods.refinedstorage2.api.grid.watcher.GridWatcherManagerImpl; import com.refinedmods.refinedstorage2.api.network.Network; -import com.refinedmods.refinedstorage2.api.network.impl.storage.AbstractNetworkNode; +import com.refinedmods.refinedstorage2.api.network.impl.node.AbstractNetworkNode; import com.refinedmods.refinedstorage2.api.network.storage.StorageNetworkComponent; import com.refinedmods.refinedstorage2.api.storage.Actor; diff --git a/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/iface/InterfaceNetworkNode.java b/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/iface/InterfaceNetworkNode.java index 95a969da1..2e48a7f8d 100644 --- a/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/iface/InterfaceNetworkNode.java +++ b/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/iface/InterfaceNetworkNode.java @@ -1,9 +1,9 @@ package com.refinedmods.refinedstorage2.api.network.impl.node.iface; import com.refinedmods.refinedstorage2.api.core.Action; +import com.refinedmods.refinedstorage2.api.network.impl.node.AbstractNetworkNode; import com.refinedmods.refinedstorage2.api.network.impl.node.externalstorage.ExposedExternalStorage; import com.refinedmods.refinedstorage2.api.network.impl.node.iface.externalstorage.InterfaceExternalStorageProvider; -import com.refinedmods.refinedstorage2.api.network.impl.storage.AbstractNetworkNode; import com.refinedmods.refinedstorage2.api.network.node.NetworkNodeActor; import com.refinedmods.refinedstorage2.api.network.storage.StorageNetworkComponent; import com.refinedmods.refinedstorage2.api.resource.ResourceKey; diff --git a/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/importer/ImporterNetworkNode.java b/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/importer/ImporterNetworkNode.java index dacbe7b16..75174753e 100644 --- a/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/importer/ImporterNetworkNode.java +++ b/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/importer/ImporterNetworkNode.java @@ -1,6 +1,6 @@ package com.refinedmods.refinedstorage2.api.network.impl.node.importer; -import com.refinedmods.refinedstorage2.api.network.impl.storage.AbstractNetworkNode; +import com.refinedmods.refinedstorage2.api.network.impl.node.AbstractNetworkNode; import com.refinedmods.refinedstorage2.api.network.node.NetworkNodeActor; import com.refinedmods.refinedstorage2.api.network.node.importer.ImporterTransferStrategy; import com.refinedmods.refinedstorage2.api.resource.ResourceKey; diff --git a/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/relay/RelayComponentType.java b/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/relay/RelayComponentType.java new file mode 100644 index 000000000..c9ba9ddcf --- /dev/null +++ b/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/relay/RelayComponentType.java @@ -0,0 +1,7 @@ +package com.refinedmods.refinedstorage2.api.network.impl.node.relay; + +public enum RelayComponentType { + ENERGY, + SECURITY, + STORAGE +} diff --git a/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/relay/RelayInputNetworkNode.java b/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/relay/RelayInputNetworkNode.java new file mode 100644 index 000000000..955f7c097 --- /dev/null +++ b/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/relay/RelayInputNetworkNode.java @@ -0,0 +1,116 @@ +package com.refinedmods.refinedstorage2.api.network.impl.node.relay; + +import com.refinedmods.refinedstorage2.api.network.Network; +import com.refinedmods.refinedstorage2.api.network.energy.EnergyNetworkComponent; +import com.refinedmods.refinedstorage2.api.network.impl.node.AbstractNetworkNode; +import com.refinedmods.refinedstorage2.api.network.security.SecurityNetworkComponent; +import com.refinedmods.refinedstorage2.api.network.storage.StorageNetworkComponent; +import com.refinedmods.refinedstorage2.api.resource.ResourceKey; +import com.refinedmods.refinedstorage2.api.resource.filter.FilterMode; +import com.refinedmods.refinedstorage2.api.storage.AccessMode; + +import java.util.HashSet; +import java.util.Set; +import java.util.function.UnaryOperator; +import javax.annotation.Nullable; + +public class RelayInputNetworkNode extends AbstractNetworkNode { + private final long energyUsage; + private final Set componentTypes = new HashSet<>(); + + @Nullable + private RelayOutputNetworkNode outputNode; + + public RelayInputNetworkNode(final long energyUsage) { + this.energyUsage = energyUsage; + } + + @Override + public void setNetwork(@Nullable final Network network) { + super.setNetwork(network); + updateComponents(); + } + + @Override + protected void onActiveChanged(final boolean newActive) { + super.onActiveChanged(newActive); + updateComponents(); + } + + public void setOutputNode(@Nullable final RelayOutputNetworkNode outputNode) { + this.outputNode = outputNode; + } + + public void setComponentTypes(final Set componentTypes) { + this.componentTypes.clear(); + this.componentTypes.addAll(componentTypes); + updateComponents(); + } + + public void updateComponentType(final RelayComponentType componentType, final boolean enabled) { + if (enabled) { + componentTypes.add(componentType); + } else { + componentTypes.remove(componentType); + } + updateComponents(); + } + + private void updateComponents() { + if (outputNode == null) { + return; + } + final boolean valid = network != null && isActive(); + final boolean hasEnergy = componentTypes.contains(RelayComponentType.ENERGY); + outputNode.setEnergyDelegate(valid && hasEnergy + ? network.getComponent(EnergyNetworkComponent.class) + : null); + final boolean hasSecurity = componentTypes.contains(RelayComponentType.SECURITY); + outputNode.setSecurityDelegate(valid && hasSecurity + ? network.getComponent(SecurityNetworkComponent.class) + : null); + final boolean hasStorage = componentTypes.contains(RelayComponentType.STORAGE); + outputNode.setStorageDelegate(valid && hasStorage + ? network.getComponent(StorageNetworkComponent.class) + : null); + } + + public void setAccessMode(final AccessMode accessMode) { + if (outputNode != null) { + outputNode.setAccessMode(accessMode); + } + } + + public void setPriority(final int priority) { + if (outputNode != null) { + outputNode.setPriority(priority); + } + } + + public void setFilters(final Set filters) { + if (outputNode != null) { + outputNode.setFilters(filters); + } + } + + public void setFilterMode(final FilterMode filterMode) { + if (outputNode != null) { + outputNode.setFilterMode(filterMode); + } + } + + public void setFilterNormalizer(final UnaryOperator normalizer) { + if (outputNode != null) { + outputNode.setFilterNormalizer(normalizer); + } + } + + public boolean hasComponentType(final RelayComponentType componentType) { + return componentTypes.contains(componentType); + } + + @Override + public long getEnergyUsage() { + return energyUsage; + } +} diff --git a/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/relay/RelayOutputNetworkNode.java b/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/relay/RelayOutputNetworkNode.java new file mode 100644 index 000000000..2abe51359 --- /dev/null +++ b/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/relay/RelayOutputNetworkNode.java @@ -0,0 +1,123 @@ +package com.refinedmods.refinedstorage2.api.network.impl.node.relay; + +import com.refinedmods.refinedstorage2.api.network.energy.EnergyNetworkComponent; +import com.refinedmods.refinedstorage2.api.network.energy.EnergyProvider; +import com.refinedmods.refinedstorage2.api.network.impl.node.AbstractNetworkNode; +import com.refinedmods.refinedstorage2.api.network.security.Permission; +import com.refinedmods.refinedstorage2.api.network.security.SecurityActor; +import com.refinedmods.refinedstorage2.api.network.security.SecurityDecision; +import com.refinedmods.refinedstorage2.api.network.security.SecurityDecisionProvider; +import com.refinedmods.refinedstorage2.api.network.security.SecurityNetworkComponent; +import com.refinedmods.refinedstorage2.api.network.storage.StorageNetworkComponent; +import com.refinedmods.refinedstorage2.api.network.storage.StorageProvider; +import com.refinedmods.refinedstorage2.api.resource.ResourceKey; +import com.refinedmods.refinedstorage2.api.resource.filter.FilterMode; +import com.refinedmods.refinedstorage2.api.storage.AccessMode; +import com.refinedmods.refinedstorage2.api.storage.Storage; + +import java.util.Set; +import java.util.function.UnaryOperator; +import javax.annotation.Nullable; + +public class RelayOutputNetworkNode extends AbstractNetworkNode + implements EnergyProvider, SecurityDecisionProvider, StorageProvider { + private final long energyUsage; + private final RelayOutputStorage storage = new RelayOutputStorage(); + + @Nullable + private EnergyNetworkComponent energyDelegate; + @Nullable + private SecurityNetworkComponent securityDelegate; + + public RelayOutputNetworkNode(final long energyUsage) { + this.energyUsage = energyUsage; + } + + void setEnergyDelegate(@Nullable final EnergyNetworkComponent energyDelegate) { + this.energyDelegate = energyDelegate; + } + + void setSecurityDelegate(@Nullable final SecurityNetworkComponent securityDelegate) { + this.securityDelegate = securityDelegate; + } + + void setStorageDelegate(@Nullable final StorageNetworkComponent storageDelegate) { + this.storage.setDelegate(storageDelegate); + } + + void setAccessMode(final AccessMode accessMode) { + this.storage.setAccessMode(accessMode); + } + + void setPriority(final int priority) { + this.storage.setPriority(priority); + if (network != null) { + network.getComponent(StorageNetworkComponent.class).sortSources(); + } + } + + void setFilters(final Set filters) { + this.storage.setFilters(filters); + } + + void setFilterMode(final FilterMode filterMode) { + this.storage.setFilterMode(filterMode); + } + + void setFilterNormalizer(final UnaryOperator normalizer) { + this.storage.setFilterNormalizer(normalizer); + } + + @Override + public long getEnergyUsage() { + if (energyDelegate != null || securityDelegate != null || storage.hasDelegate()) { + return energyUsage; + } + return 0; + } + + @Override + public long getStored() { + return energyDelegate == null || energyDelegate.contains(energyDelegate) ? 0 : energyDelegate.getStored(); + } + + @Override + public long getCapacity() { + return energyDelegate == null || energyDelegate.contains(energyDelegate) ? 0 : energyDelegate.getCapacity(); + } + + @Override + public long extract(final long amount) { + return energyDelegate == null || energyDelegate.contains(energyDelegate) ? 0 : energyDelegate.extract(amount); + } + + @Override + public boolean contains(final EnergyProvider energyProvider) { + return energyProvider == energyDelegate + || (energyDelegate != null && energyDelegate.contains(energyProvider)); + } + + @Override + public boolean contains(final SecurityNetworkComponent securityComponent) { + return securityComponent == securityDelegate + || (securityDelegate != null && securityDelegate.contains(securityComponent)); + } + + @Override + public SecurityDecision isAllowed(final Permission permission, final SecurityActor actor) { + if (securityDelegate == null || securityDelegate.contains(securityDelegate)) { + return SecurityDecision.PASS; + } + return securityDelegate.isAllowed(permission, actor) ? SecurityDecision.ALLOW : SecurityDecision.DENY; + } + + @Override + public boolean isProviderActive() { + return isActive() && securityDelegate != null; + } + + @Override + public Storage getStorage() { + return storage; + } +} diff --git a/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/relay/RelayOutputStorage.java b/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/relay/RelayOutputStorage.java new file mode 100644 index 000000000..c0693fb68 --- /dev/null +++ b/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/relay/RelayOutputStorage.java @@ -0,0 +1,181 @@ +package com.refinedmods.refinedstorage2.api.network.impl.node.relay; + +import com.refinedmods.refinedstorage2.api.core.Action; +import com.refinedmods.refinedstorage2.api.network.storage.StorageNetworkComponent; +import com.refinedmods.refinedstorage2.api.resource.ResourceAmount; +import com.refinedmods.refinedstorage2.api.resource.ResourceKey; +import com.refinedmods.refinedstorage2.api.resource.filter.Filter; +import com.refinedmods.refinedstorage2.api.resource.filter.FilterMode; +import com.refinedmods.refinedstorage2.api.resource.list.ResourceList; +import com.refinedmods.refinedstorage2.api.resource.list.listenable.ResourceListListener; +import com.refinedmods.refinedstorage2.api.storage.AccessMode; +import com.refinedmods.refinedstorage2.api.storage.Actor; +import com.refinedmods.refinedstorage2.api.storage.Storage; +import com.refinedmods.refinedstorage2.api.storage.composite.CompositeAwareChild; +import com.refinedmods.refinedstorage2.api.storage.composite.ParentComposite; +import com.refinedmods.refinedstorage2.api.storage.composite.Priority; + +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; +import java.util.function.UnaryOperator; +import javax.annotation.Nullable; + +class RelayOutputStorage implements CompositeAwareChild, ResourceListListener, Priority { + private final Set parentComposites = new HashSet<>(); + private final Filter filter = new Filter(); + + @Nullable + private StorageNetworkComponent delegate; + private AccessMode accessMode = AccessMode.INSERT_EXTRACT; + private int priority; + + boolean hasDelegate() { + return delegate != null; + } + + void setAccessMode(final AccessMode accessMode) { + this.accessMode = accessMode; + } + + void setPriority(final int priority) { + this.priority = priority; + } + + void setFilters(final Set filters) { + reset(() -> filter.setFilters(filters)); + } + + void setFilterMode(final FilterMode filterMode) { + reset(() -> filter.setMode(filterMode)); + } + + void setFilterNormalizer(final UnaryOperator normalizer) { + reset(() -> filter.setNormalizer(normalizer)); + } + + private void reset(final Runnable action) { + final StorageNetworkComponent oldDelegate = delegate; + setDelegate(null); + action.run(); + setDelegate(oldDelegate); + } + + void setDelegate(@Nullable final StorageNetworkComponent delegate) { + if (this.delegate != null) { + parentComposites.forEach(parent -> getAll().forEach(resourceAmount -> parent.removeFromCache( + resourceAmount.getResource(), + resourceAmount.getAmount() + ))); + this.delegate.removeListener(this); + } + this.delegate = delegate; + if (delegate != null) { + parentComposites.forEach(parent -> getAll().forEach(resourceAmount -> parent.addToCache( + resourceAmount.getResource(), + resourceAmount.getAmount() + ))); + delegate.addListener(this); + } + } + + @Override + public void onAddedIntoComposite(final ParentComposite parentComposite) { + parentComposites.add(parentComposite); + } + + @Override + public void onRemovedFromComposite(final ParentComposite parentComposite) { + parentComposites.remove(parentComposite); + } + + @Override + public boolean contains(final Storage storage) { + return storage == delegate || (delegate != null && delegate.contains(storage)); + } + + @Override + public Amount compositeInsert(final ResourceKey resource, + final long amount, + final Action action, + final Actor actor) { + if (delegate == null + || accessMode == AccessMode.EXTRACT + || delegate.contains(delegate) + || !filter.isAllowed(resource)) { + return Amount.ZERO; + } + final long inserted = delegate.insert(resource, amount, action, actor); + return new Amount(inserted, 0); + } + + @Override + public Amount compositeExtract(final ResourceKey resource, + final long amount, + final Action action, + final Actor actor) { + if (delegate == null + || accessMode == AccessMode.INSERT + || delegate.contains(delegate) + || !filter.isAllowed(resource)) { + return Amount.ZERO; + } + final long extracted = delegate.extract(resource, amount, action, actor); + return new Amount(extracted, 0); + } + + @Override + public long extract(final ResourceKey resource, final long amount, final Action action, final Actor actor) { + throw new UnsupportedOperationException(); + } + + @Override + public long insert(final ResourceKey resource, final long amount, final Action action, final Actor actor) { + throw new UnsupportedOperationException(); + } + + @Override + public Collection getAll() { + if (delegate == null || delegate.contains(delegate)) { + return Collections.emptyList(); + } + return delegate.getAll() + .stream() + .filter(resourceAmount -> filter.isAllowed(resourceAmount.getResource())) + .toList(); + } + + @Override + public long getStored() { + if (delegate == null || delegate.contains(delegate)) { + return 0; + } + return delegate.getAll() + .stream() + .filter(resourceAmount -> filter.isAllowed(resourceAmount.getResource())) + .mapToLong(ResourceAmount::getAmount) + .sum(); + } + + @Override + public void onChanged(final ResourceList.OperationResult change) { + if (delegate != null && delegate.contains(delegate)) { + return; + } + final ResourceKey resource = change.resourceAmount().getResource(); + if (!filter.isAllowed(resource)) { + return; + } + if (change.change() > 0) { + parentComposites.forEach(parent -> parent.addToCache(resource, change.change())); + } else { + parentComposites.forEach(parent -> parent.removeFromCache(resource, -change.change())); + } + } + + @Override + public int getPriority() { + return priority; + } +} diff --git a/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/relay/package-info.java b/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/relay/package-info.java new file mode 100644 index 000000000..9b2bc6065 --- /dev/null +++ b/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/relay/package-info.java @@ -0,0 +1,7 @@ +@ParametersAreNonnullByDefault +@FieldsAndMethodsAreNonnullByDefault +package com.refinedmods.refinedstorage2.api.network.impl.node.relay; + +import com.refinedmods.refinedstorage2.api.core.FieldsAndMethodsAreNonnullByDefault; + +import javax.annotation.ParametersAreNonnullByDefault; diff --git a/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/security/SecurityDecisionProviderProxyNetworkNode.java b/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/security/SecurityDecisionProviderProxyNetworkNode.java index 1ab5c878d..db3c3b443 100644 --- a/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/security/SecurityDecisionProviderProxyNetworkNode.java +++ b/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/node/security/SecurityDecisionProviderProxyNetworkNode.java @@ -1,6 +1,6 @@ package com.refinedmods.refinedstorage2.api.network.impl.node.security; -import com.refinedmods.refinedstorage2.api.network.impl.storage.AbstractNetworkNode; +import com.refinedmods.refinedstorage2.api.network.impl.node.AbstractNetworkNode; import com.refinedmods.refinedstorage2.api.network.security.Permission; import com.refinedmods.refinedstorage2.api.network.security.SecurityActor; import com.refinedmods.refinedstorage2.api.network.security.SecurityDecision; @@ -50,4 +50,17 @@ public SecurityDecision isAllowed(final Permission permission) { } return delegate.isAllowed(permission); } + + @Override + public boolean isProviderActive() { + return isActive(); + } + + public static SecurityDecisionProviderProxyNetworkNode activeSecurityDecisionProvider( + final SecurityDecisionProvider provider + ) { + final SecurityDecisionProviderProxyNetworkNode node = new SecurityDecisionProviderProxyNetworkNode(0, provider); + node.setActive(true); + return node; + } } diff --git a/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/security/SecurityNetworkComponentImpl.java b/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/security/SecurityNetworkComponentImpl.java index 1b3eceeb0..a2d7f9918 100644 --- a/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/security/SecurityNetworkComponentImpl.java +++ b/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/security/SecurityNetworkComponentImpl.java @@ -38,7 +38,7 @@ public void onContainerRemoved(final NetworkNodeContainer container) { @Override public boolean isAllowed(final Permission permission, final SecurityActor actor) { final Set activeProviders = providers.stream() - .filter(SecurityDecisionProvider::isActive) + .filter(SecurityDecisionProvider::isProviderActive) .collect(Collectors.toSet()); if (activeProviders.isEmpty()) { return defaultPolicy.isAllowed(permission); @@ -57,6 +57,16 @@ public boolean isAllowed(final Permission permission, final SecurityActor actor) return tryFallback(permission, activeProviders); } + @Override + public boolean contains(final SecurityNetworkComponent component) { + for (final SecurityDecisionProvider provider : providers) { + if (provider.contains(component)) { + return true; + } + } + return false; + } + private boolean tryFallback(final Permission permission, final Set activeProviders) { final Set decisions = activeProviders.stream().map(provider -> CoreValidations.validateNotNull(provider.isAllowed(permission), "Decision cannot be null") diff --git a/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/storage/AbstractStorageNetworkNode.java b/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/storage/AbstractStorageNetworkNode.java index 695e0a26f..c2cad2cd6 100644 --- a/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/storage/AbstractStorageNetworkNode.java +++ b/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/storage/AbstractStorageNetworkNode.java @@ -1,5 +1,6 @@ package com.refinedmods.refinedstorage2.api.network.impl.storage; +import com.refinedmods.refinedstorage2.api.network.impl.node.AbstractNetworkNode; import com.refinedmods.refinedstorage2.api.network.storage.StorageNetworkComponent; import com.refinedmods.refinedstorage2.api.resource.ResourceKey; import com.refinedmods.refinedstorage2.api.resource.filter.Filter; diff --git a/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/storage/StorageNetworkComponentImpl.java b/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/storage/StorageNetworkComponentImpl.java index 6e25cc557..3fbe66dc0 100644 --- a/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/storage/StorageNetworkComponentImpl.java +++ b/refinedstorage2-network/src/main/java/com/refinedmods/refinedstorage2/api/network/impl/storage/StorageNetworkComponentImpl.java @@ -46,4 +46,9 @@ public List getResources(final Class act findTrackedResourceByActorType(resourceAmount.getResource(), actorType).orElse(null) )).toList(); } + + @Override + public boolean contains(final Storage storage) { + return this.storage.contains(storage); + } } diff --git a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/PriorityNetworkBuilderImplTest.java b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/PriorityNetworkBuilderImplTest.java index b6fb80561..b5b5bea44 100644 --- a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/PriorityNetworkBuilderImplTest.java +++ b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/PriorityNetworkBuilderImplTest.java @@ -11,7 +11,7 @@ import com.refinedmods.refinedstorage2.api.resource.ResourceKey; import com.refinedmods.refinedstorage2.api.storage.EmptyActor; import com.refinedmods.refinedstorage2.api.storage.InMemoryStorageImpl; -import com.refinedmods.refinedstorage2.network.test.util.FakeActor; +import com.refinedmods.refinedstorage2.network.test.fake.FakeActor; import java.util.function.Supplier; diff --git a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/SpyingNetworkNode.java b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/SpyingNetworkNode.java index 8d43fe645..8d9ab159a 100644 --- a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/SpyingNetworkNode.java +++ b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/SpyingNetworkNode.java @@ -1,6 +1,6 @@ package com.refinedmods.refinedstorage2.api.network.impl; -import com.refinedmods.refinedstorage2.api.network.impl.storage.AbstractNetworkNode; +import com.refinedmods.refinedstorage2.api.network.impl.node.AbstractNetworkNode; public final class SpyingNetworkNode extends AbstractNetworkNode { private final long energyUsage; diff --git a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/detector/DetectorNetworkNodeTest.java b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/detector/DetectorNetworkNodeTest.java index 936654442..d22d2903b 100644 --- a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/detector/DetectorNetworkNodeTest.java +++ b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/detector/DetectorNetworkNodeTest.java @@ -1,11 +1,11 @@ package com.refinedmods.refinedstorage2.api.network.impl.node.detector; import com.refinedmods.refinedstorage2.api.core.Action; +import com.refinedmods.refinedstorage2.api.network.storage.StorageNetworkComponent; import com.refinedmods.refinedstorage2.api.storage.EmptyActor; import com.refinedmods.refinedstorage2.api.storage.InMemoryStorageImpl; -import com.refinedmods.refinedstorage2.api.storage.channel.StorageChannel; import com.refinedmods.refinedstorage2.network.test.AddNetworkNode; -import com.refinedmods.refinedstorage2.network.test.InjectNetworkStorageChannel; +import com.refinedmods.refinedstorage2.network.test.InjectNetworkStorageComponent; import com.refinedmods.refinedstorage2.network.test.NetworkTest; import com.refinedmods.refinedstorage2.network.test.SetupNetwork; import com.refinedmods.refinedstorage2.network.test.nodefactory.AbstractNetworkNodeFactory; @@ -19,7 +19,7 @@ import org.junit.jupiter.params.provider.EnumSource; import org.junit.jupiter.params.provider.MethodSource; -import static com.refinedmods.refinedstorage2.network.test.TestResource.A; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.A; import static org.assertj.core.api.Assertions.assertThat; @NetworkTest @@ -33,8 +33,8 @@ class DetectorNetworkNodeTest { DetectorNetworkNode sut; @BeforeEach - void setUp(@InjectNetworkStorageChannel final StorageChannel storageChannel) { - storageChannel.addSource(new InMemoryStorageImpl()); + void setUp(@InjectNetworkStorageComponent final StorageNetworkComponent storage) { + storage.addSource(new InMemoryStorageImpl()); sut.setAmountStrategy(new DetectorAmountStrategyImpl()); } @@ -118,14 +118,14 @@ void testModes(final DetectorMode mode, final long comparisonAmount, final long amountInNetwork, final boolean expectedActivated, - @InjectNetworkStorageChannel final StorageChannel storageChannel) { + @InjectNetworkStorageComponent final StorageNetworkComponent storage) { // Arrange sut.setConfiguredResource(A); sut.setMode(mode); sut.setAmount(comparisonAmount); if (amountInNetwork > 0) { - storageChannel.insert(A, amountInNetwork, Action.EXECUTE, EmptyActor.INSTANCE); + storage.insert(A, amountInNetwork, Action.EXECUTE, EmptyActor.INSTANCE); } // Act diff --git a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/exporter/AbstractExporterNetworkNodeTest.java b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/exporter/AbstractExporterNetworkNodeTest.java index e36a0c7f9..da0d68d44 100644 --- a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/exporter/AbstractExporterNetworkNodeTest.java +++ b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/exporter/AbstractExporterNetworkNodeTest.java @@ -4,6 +4,7 @@ import com.refinedmods.refinedstorage2.api.network.energy.EnergyNetworkComponent; import com.refinedmods.refinedstorage2.api.network.node.exporter.ExporterTransferStrategy; import com.refinedmods.refinedstorage2.api.network.node.task.TaskExecutor; +import com.refinedmods.refinedstorage2.api.network.storage.StorageNetworkComponent; import com.refinedmods.refinedstorage2.api.resource.ResourceAmount; import com.refinedmods.refinedstorage2.api.resource.ResourceKey; import com.refinedmods.refinedstorage2.api.storage.Actor; @@ -11,11 +12,10 @@ import com.refinedmods.refinedstorage2.api.storage.InMemoryStorageImpl; import com.refinedmods.refinedstorage2.api.storage.InsertableStorage; import com.refinedmods.refinedstorage2.api.storage.Storage; -import com.refinedmods.refinedstorage2.api.storage.channel.StorageChannel; import com.refinedmods.refinedstorage2.api.storage.limited.LimitedStorageImpl; import com.refinedmods.refinedstorage2.network.test.AddNetworkNode; import com.refinedmods.refinedstorage2.network.test.InjectNetworkEnergyComponent; -import com.refinedmods.refinedstorage2.network.test.InjectNetworkStorageChannel; +import com.refinedmods.refinedstorage2.network.test.InjectNetworkStorageComponent; import com.refinedmods.refinedstorage2.network.test.NetworkTest; import com.refinedmods.refinedstorage2.network.test.SetupNetwork; @@ -24,9 +24,9 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static com.refinedmods.refinedstorage2.network.test.TestResource.A; -import static com.refinedmods.refinedstorage2.network.test.TestResource.B; -import static com.refinedmods.refinedstorage2.network.test.TestResource.C; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.A; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.B; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.C; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; @@ -55,12 +55,12 @@ void testInitialState() { @Test void shouldUseFirstSuccessfulStrategy( - @InjectNetworkStorageChannel final StorageChannel storageChannel + @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storageChannel.addSource(new InMemoryStorageImpl()); - storageChannel.insert(A, 100, Action.EXECUTE, EmptyActor.INSTANCE); - storageChannel.insert(B, 100, Action.EXECUTE, EmptyActor.INSTANCE); + storage.addSource(new InMemoryStorageImpl()); + storage.insert(A, 100, Action.EXECUTE, EmptyActor.INSTANCE); + storage.insert(B, 100, Action.EXECUTE, EmptyActor.INSTANCE); final Storage failingDestination = new LimitedStorageImpl(0); final Storage destination = new LimitedStorageImpl(100); @@ -76,7 +76,7 @@ void shouldUseFirstSuccessfulStrategy( sut.doWork(); // Assert - assertThat(storageChannel.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( + assertThat(storage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( new ResourceAmount(A, 90), new ResourceAmount(B, 100) ); @@ -87,12 +87,12 @@ void shouldUseFirstSuccessfulStrategy( @Test void shouldUseFirstSuccessfulResourceInTheStrategy( - @InjectNetworkStorageChannel final StorageChannel storageChannel + @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storageChannel.addSource(new InMemoryStorageImpl()); - storageChannel.insert(A, 100, Action.EXECUTE, EmptyActor.INSTANCE); - storageChannel.insert(B, 100, Action.EXECUTE, EmptyActor.INSTANCE); + storage.addSource(new InMemoryStorageImpl()); + storage.insert(A, 100, Action.EXECUTE, EmptyActor.INSTANCE); + storage.insert(B, 100, Action.EXECUTE, EmptyActor.INSTANCE); final Storage destination = new LimitedStorageImpl(100) { @Override @@ -113,7 +113,7 @@ public long insert(final ResourceKey resource, final long amount, final Action a sut.doWork(); // Assert - assertThat(storageChannel.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( + assertThat(storage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( new ResourceAmount(A, 90), new ResourceAmount(B, 100) ); @@ -142,12 +142,12 @@ void shouldNotTransferWithoutNetwork() { @Test void shouldNotTransferWithoutTaskExecutor( - @InjectNetworkStorageChannel final StorageChannel storageChannel + @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storageChannel.addSource(new InMemoryStorageImpl()); - storageChannel.insert(A, 100, Action.EXECUTE, EmptyActor.INSTANCE); - storageChannel.insert(B, 100, Action.EXECUTE, EmptyActor.INSTANCE); + storage.addSource(new InMemoryStorageImpl()); + storage.insert(A, 100, Action.EXECUTE, EmptyActor.INSTANCE); + storage.insert(B, 100, Action.EXECUTE, EmptyActor.INSTANCE); final Storage destination = new InMemoryStorageImpl(); @@ -159,7 +159,7 @@ void shouldNotTransferWithoutTaskExecutor( sut.doWork(); // Assert - assertThat(storageChannel.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( + assertThat(storage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( new ResourceAmount(A, 100), new ResourceAmount(B, 100) ); @@ -167,11 +167,11 @@ void shouldNotTransferWithoutTaskExecutor( } @Test - void shouldNotTransferWithoutStrategy(@InjectNetworkStorageChannel final StorageChannel storageChannel) { + void shouldNotTransferWithoutStrategy(@InjectNetworkStorageComponent final StorageNetworkComponent storage) { // Arrange - storageChannel.addSource(new InMemoryStorageImpl()); - storageChannel.insert(A, 100, Action.EXECUTE, EmptyActor.INSTANCE); - storageChannel.insert(B, 100, Action.EXECUTE, EmptyActor.INSTANCE); + storage.addSource(new InMemoryStorageImpl()); + storage.insert(A, 100, Action.EXECUTE, EmptyActor.INSTANCE); + storage.insert(B, 100, Action.EXECUTE, EmptyActor.INSTANCE); final Storage destination = new InMemoryStorageImpl(); @@ -181,7 +181,7 @@ void shouldNotTransferWithoutStrategy(@InjectNetworkStorageChannel final Storage sut.doWork(); // Assert - assertThat(storageChannel.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( + assertThat(storage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( new ResourceAmount(A, 100), new ResourceAmount(B, 100) ); @@ -189,11 +189,11 @@ void shouldNotTransferWithoutStrategy(@InjectNetworkStorageChannel final Storage } @Test - void shouldNotTransferIfInactive(@InjectNetworkStorageChannel final StorageChannel storageChannel) { + void shouldNotTransferIfInactive(@InjectNetworkStorageComponent final StorageNetworkComponent storage) { // Arrange - storageChannel.addSource(new InMemoryStorageImpl()); - storageChannel.insert(A, 100, Action.EXECUTE, EmptyActor.INSTANCE); - storageChannel.insert(B, 100, Action.EXECUTE, EmptyActor.INSTANCE); + storage.addSource(new InMemoryStorageImpl()); + storage.insert(A, 100, Action.EXECUTE, EmptyActor.INSTANCE); + storage.insert(B, 100, Action.EXECUTE, EmptyActor.INSTANCE); final Storage destination = new InMemoryStorageImpl(); final ExporterTransferStrategy strategy = createTransferStrategy(destination, 1); @@ -206,7 +206,7 @@ void shouldNotTransferIfInactive(@InjectNetworkStorageChannel final StorageChann sut.doWork(); // Assert - assertThat(storageChannel.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( + assertThat(storage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( new ResourceAmount(A, 100), new ResourceAmount(B, 100) ); @@ -214,11 +214,11 @@ void shouldNotTransferIfInactive(@InjectNetworkStorageChannel final StorageChann } @Test - void shouldNotTransferWithoutFilters(@InjectNetworkStorageChannel final StorageChannel storageChannel) { + void shouldNotTransferWithoutFilters(@InjectNetworkStorageComponent final StorageNetworkComponent storage) { // Arrange - storageChannel.addSource(new InMemoryStorageImpl()); - storageChannel.insert(A, 100, Action.EXECUTE, EmptyActor.INSTANCE); - storageChannel.insert(B, 100, Action.EXECUTE, EmptyActor.INSTANCE); + storage.addSource(new InMemoryStorageImpl()); + storage.insert(A, 100, Action.EXECUTE, EmptyActor.INSTANCE); + storage.insert(B, 100, Action.EXECUTE, EmptyActor.INSTANCE); final Storage destination = new InMemoryStorageImpl(); final ExporterTransferStrategy strategy = createTransferStrategy(destination, 1); @@ -230,7 +230,7 @@ void shouldNotTransferWithoutFilters(@InjectNetworkStorageChannel final StorageC sut.doWork(); // Assert - assertThat(storageChannel.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( + assertThat(storage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( new ResourceAmount(A, 100), new ResourceAmount(B, 100) ); @@ -239,7 +239,7 @@ void shouldNotTransferWithoutFilters(@InjectNetworkStorageChannel final StorageC @Test void shouldNotTransferIfNoResourcesAreAvailable( - @InjectNetworkStorageChannel final StorageChannel storageChannel + @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange final Storage destination = new InMemoryStorageImpl(); @@ -254,19 +254,19 @@ void shouldNotTransferIfNoResourcesAreAvailable( sut.doWork(); // Assert - assertThat(storageChannel.getAll()).isEmpty(); + assertThat(storage.getAll()).isEmpty(); assertThat(destination.getAll()).isEmpty(); } @Test void shouldTransferWithLimitedSpaceInDestination( - @InjectNetworkStorageChannel final StorageChannel storageChannel + @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storageChannel.addSource(new InMemoryStorageImpl()); - storageChannel.insert(A, 100, Action.EXECUTE, EmptyActor.INSTANCE); - storageChannel.insert(B, 100, Action.EXECUTE, EmptyActor.INSTANCE); - storageChannel.insert(C, 100, Action.EXECUTE, EmptyActor.INSTANCE); + storage.addSource(new InMemoryStorageImpl()); + storage.insert(A, 100, Action.EXECUTE, EmptyActor.INSTANCE); + storage.insert(B, 100, Action.EXECUTE, EmptyActor.INSTANCE); + storage.insert(C, 100, Action.EXECUTE, EmptyActor.INSTANCE); final Storage destination = new LimitedStorageImpl(5); destination.insert(C, 1, Action.EXECUTE, EmptyActor.INSTANCE); @@ -280,7 +280,7 @@ void shouldTransferWithLimitedSpaceInDestination( // Act & assert sut.doWork(); - assertThat(storageChannel.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( + assertThat(storage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( new ResourceAmount(A, 96), new ResourceAmount(B, 100), new ResourceAmount(C, 100) @@ -292,7 +292,7 @@ void shouldTransferWithLimitedSpaceInDestination( sut.doWork(); - assertThat(storageChannel.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( + assertThat(storage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( new ResourceAmount(A, 96), new ResourceAmount(B, 100), new ResourceAmount(C, 100) @@ -305,12 +305,12 @@ void shouldTransferWithLimitedSpaceInDestination( @Test void shouldNotTransferIfThereIsNoSpaceInTheDestination( - @InjectNetworkStorageChannel final StorageChannel storageChannel + @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storageChannel.addSource(new InMemoryStorageImpl()); - storageChannel.insert(A, 100, Action.EXECUTE, EmptyActor.INSTANCE); - storageChannel.insert(B, 100, Action.EXECUTE, EmptyActor.INSTANCE); + storage.addSource(new InMemoryStorageImpl()); + storage.insert(A, 100, Action.EXECUTE, EmptyActor.INSTANCE); + storage.insert(B, 100, Action.EXECUTE, EmptyActor.INSTANCE); final Storage destination = new LimitedStorageImpl(1); destination.insert(C, 1, Action.EXECUTE, EmptyActor.INSTANCE); @@ -324,7 +324,7 @@ void shouldNotTransferIfThereIsNoSpaceInTheDestination( sut.doWork(); // Assert - assertThat(storageChannel.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( + assertThat(storage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( new ResourceAmount(A, 100), new ResourceAmount(B, 100) ); @@ -335,12 +335,12 @@ void shouldNotTransferIfThereIsNoSpaceInTheDestination( @Test void shouldTransferSingleResourceEvenIfTransferQuotaHasNotBeenMet( - @InjectNetworkStorageChannel final StorageChannel storageChannel + @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storageChannel.addSource(new InMemoryStorageImpl()); - storageChannel.insert(A, 6, Action.EXECUTE, EmptyActor.INSTANCE); - storageChannel.insert(B, 7, Action.EXECUTE, EmptyActor.INSTANCE); + storage.addSource(new InMemoryStorageImpl()); + storage.insert(A, 6, Action.EXECUTE, EmptyActor.INSTANCE); + storage.insert(B, 7, Action.EXECUTE, EmptyActor.INSTANCE); final Storage destination = new InMemoryStorageImpl(); final ExporterTransferStrategy strategy = createTransferStrategy(destination, 10); @@ -352,7 +352,7 @@ void shouldTransferSingleResourceEvenIfTransferQuotaHasNotBeenMet( sut.doWork(); // Assert - assertThat(storageChannel.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( + assertThat(storage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( new ResourceAmount(B, 7) ); assertThat(destination.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( diff --git a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/exporter/FirstAvailableExporterNetworkNodeTest.java b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/exporter/FirstAvailableExporterNetworkNodeTest.java index 4f94d158f..b993f78d3 100644 --- a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/exporter/FirstAvailableExporterNetworkNodeTest.java +++ b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/exporter/FirstAvailableExporterNetworkNodeTest.java @@ -5,24 +5,24 @@ import com.refinedmods.refinedstorage2.api.network.node.NetworkNodeActor; import com.refinedmods.refinedstorage2.api.network.node.exporter.ExporterTransferStrategy; import com.refinedmods.refinedstorage2.api.network.node.task.TaskExecutor; +import com.refinedmods.refinedstorage2.api.network.storage.StorageNetworkComponent; import com.refinedmods.refinedstorage2.api.resource.ResourceAmount; import com.refinedmods.refinedstorage2.api.resource.ResourceKey; import com.refinedmods.refinedstorage2.api.storage.Actor; import com.refinedmods.refinedstorage2.api.storage.EmptyActor; import com.refinedmods.refinedstorage2.api.storage.InMemoryStorageImpl; import com.refinedmods.refinedstorage2.api.storage.Storage; -import com.refinedmods.refinedstorage2.api.storage.channel.StorageChannel; import com.refinedmods.refinedstorage2.api.storage.tracked.TrackedResource; import com.refinedmods.refinedstorage2.api.storage.tracked.TrackedStorageImpl; -import com.refinedmods.refinedstorage2.network.test.InjectNetworkStorageChannel; +import com.refinedmods.refinedstorage2.network.test.InjectNetworkStorageComponent; import java.util.List; import org.junit.jupiter.api.Test; -import static com.refinedmods.refinedstorage2.network.test.TestResource.A; -import static com.refinedmods.refinedstorage2.network.test.TestResource.B; -import static com.refinedmods.refinedstorage2.network.test.TestResource.C; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.A; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.B; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.C; import static org.assertj.core.api.Assertions.assertThat; class FirstAvailableExporterNetworkNodeTest extends AbstractExporterNetworkNodeTest { @@ -32,11 +32,11 @@ protected TaskExecutor createTaskExecutor() { } @Test - void shouldTransfer(@InjectNetworkStorageChannel final StorageChannel storageChannel) { + void shouldTransfer(@InjectNetworkStorageComponent final StorageNetworkComponent storage) { // Arrange - storageChannel.addSource(new TrackedStorageImpl(new InMemoryStorageImpl(), () -> 1L)); - storageChannel.insert(A, 100, Action.EXECUTE, EmptyActor.INSTANCE); - storageChannel.insert(B, 100, Action.EXECUTE, EmptyActor.INSTANCE); + storage.addSource(new TrackedStorageImpl(new InMemoryStorageImpl(), () -> 1L)); + storage.insert(A, 100, Action.EXECUTE, EmptyActor.INSTANCE); + storage.insert(B, 100, Action.EXECUTE, EmptyActor.INSTANCE); final Storage destination = new InMemoryStorageImpl(); final ExporterTransferStrategy strategy = createTransferStrategy(destination, 1); @@ -48,27 +48,27 @@ void shouldTransfer(@InjectNetworkStorageChannel final StorageChannel storageCha sut.doWork(); // Assert - assertThat(storageChannel.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( + assertThat(storage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( new ResourceAmount(A, 99), new ResourceAmount(B, 100) ); assertThat(destination.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( new ResourceAmount(A, 1) ); - assertThat(storageChannel.findTrackedResourceByActorType(A, NetworkNodeActor.class)) + assertThat(storage.findTrackedResourceByActorType(A, NetworkNodeActor.class)) .get() .usingRecursiveComparison() .isEqualTo(new TrackedResource(ExporterNetworkNode.class.getName(), 1)); - assertThat(storageChannel.findTrackedResourceByActorType(B, NetworkNodeActor.class)).isEmpty(); + assertThat(storage.findTrackedResourceByActorType(B, NetworkNodeActor.class)).isEmpty(); } @Test void shouldUseNextResourceIfFirstOneIsNotAvailableInSameCycle( - @InjectNetworkStorageChannel final StorageChannel storageChannel + @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storageChannel.addSource(new InMemoryStorageImpl()); - storageChannel.insert(B, 7, Action.EXECUTE, EmptyActor.INSTANCE); + storage.addSource(new InMemoryStorageImpl()); + storage.insert(B, 7, Action.EXECUTE, EmptyActor.INSTANCE); final Storage destination = new InMemoryStorageImpl(); final ExporterTransferStrategy strategy = createTransferStrategy(destination, 10); @@ -80,7 +80,7 @@ void shouldUseNextResourceIfFirstOneIsNotAvailableInSameCycle( sut.doWork(); // Assert - assertThat(storageChannel.getAll()).isEmpty(); + assertThat(storage.getAll()).isEmpty(); assertThat(destination.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( new ResourceAmount(B, 7) ); @@ -88,13 +88,13 @@ void shouldUseNextResourceIfFirstOneIsNotAvailableInSameCycle( @Test void shouldUseNextResourceIfFirstOneIsNotAcceptedInSameCycle( - @InjectNetworkStorageChannel final StorageChannel storageChannel + @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storageChannel.addSource(new InMemoryStorageImpl()); - storageChannel.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); - storageChannel.insert(B, 10, Action.EXECUTE, EmptyActor.INSTANCE); - storageChannel.insert(C, 10, Action.EXECUTE, EmptyActor.INSTANCE); + storage.addSource(new InMemoryStorageImpl()); + storage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); + storage.insert(B, 10, Action.EXECUTE, EmptyActor.INSTANCE); + storage.insert(C, 10, Action.EXECUTE, EmptyActor.INSTANCE); final Storage destination = new InMemoryStorageImpl() { @Override @@ -113,7 +113,7 @@ public long insert(final ResourceKey resource, final long amount, final Action a // Act & assert sut.doWork(); - assertThat(storageChannel.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( + assertThat(storage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( new ResourceAmount(A, 10), new ResourceAmount(C, 10) ); @@ -123,7 +123,7 @@ public long insert(final ResourceKey resource, final long amount, final Action a sut.doWork(); - assertThat(storageChannel.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( + assertThat(storage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( new ResourceAmount(A, 10) ); assertThat(destination.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( @@ -133,7 +133,7 @@ public long insert(final ResourceKey resource, final long amount, final Action a sut.doWork(); - assertThat(storageChannel.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( + assertThat(storage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( new ResourceAmount(A, 10) ); assertThat(destination.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( diff --git a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/exporter/RandomExporterNetworkNodeTest.java b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/exporter/RandomExporterNetworkNodeTest.java index fe2e90ddc..8c78adcb9 100644 --- a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/exporter/RandomExporterNetworkNodeTest.java +++ b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/exporter/RandomExporterNetworkNodeTest.java @@ -4,19 +4,19 @@ import com.refinedmods.refinedstorage2.api.network.impl.node.task.RandomTaskExecutor; import com.refinedmods.refinedstorage2.api.network.node.exporter.ExporterTransferStrategy; import com.refinedmods.refinedstorage2.api.network.node.task.TaskExecutor; +import com.refinedmods.refinedstorage2.api.network.storage.StorageNetworkComponent; import com.refinedmods.refinedstorage2.api.resource.ResourceAmount; import com.refinedmods.refinedstorage2.api.storage.EmptyActor; import com.refinedmods.refinedstorage2.api.storage.InMemoryStorageImpl; import com.refinedmods.refinedstorage2.api.storage.Storage; -import com.refinedmods.refinedstorage2.api.storage.channel.StorageChannel; -import com.refinedmods.refinedstorage2.network.test.InjectNetworkStorageChannel; +import com.refinedmods.refinedstorage2.network.test.InjectNetworkStorageComponent; import java.util.List; import org.junit.jupiter.api.Test; -import static com.refinedmods.refinedstorage2.network.test.TestResource.A; -import static com.refinedmods.refinedstorage2.network.test.TestResource.B; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.A; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.B; import static org.assertj.core.api.Assertions.assertThat; class RandomExporterNetworkNodeTest extends AbstractExporterNetworkNodeTest { @@ -30,11 +30,11 @@ protected TaskExecutor createTaskExecutor() { } @Test - void shouldTransfer(@InjectNetworkStorageChannel final StorageChannel storageChannel) { + void shouldTransfer(@InjectNetworkStorageComponent final StorageNetworkComponent storage) { // Arrange - storageChannel.addSource(new InMemoryStorageImpl()); - storageChannel.insert(A, 100, Action.EXECUTE, EmptyActor.INSTANCE); - storageChannel.insert(B, 100, Action.EXECUTE, EmptyActor.INSTANCE); + storage.addSource(new InMemoryStorageImpl()); + storage.insert(A, 100, Action.EXECUTE, EmptyActor.INSTANCE); + storage.insert(B, 100, Action.EXECUTE, EmptyActor.INSTANCE); final Storage destination = new InMemoryStorageImpl(); final ExporterTransferStrategy strategy = createTransferStrategy(destination, 5); @@ -45,7 +45,7 @@ void shouldTransfer(@InjectNetworkStorageChannel final StorageChannel storageCha // Act & assert sut.doWork(); - assertThat(storageChannel.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( + assertThat(storage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( new ResourceAmount(A, 95), new ResourceAmount(B, 100) ); @@ -55,7 +55,7 @@ void shouldTransfer(@InjectNetworkStorageChannel final StorageChannel storageCha sut.doWork(); - assertThat(storageChannel.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( + assertThat(storage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( new ResourceAmount(A, 90), new ResourceAmount(B, 100) ); @@ -66,11 +66,11 @@ void shouldTransfer(@InjectNetworkStorageChannel final StorageChannel storageCha @Test void shouldUseNextResourceIfFirstOneIsNotAvailableInSameCycle( - @InjectNetworkStorageChannel final StorageChannel storageChannel + @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storageChannel.addSource(new InMemoryStorageImpl()); - storageChannel.insert(B, 7, Action.EXECUTE, EmptyActor.INSTANCE); + storage.addSource(new InMemoryStorageImpl()); + storage.insert(B, 7, Action.EXECUTE, EmptyActor.INSTANCE); final Storage destination = new InMemoryStorageImpl(); final ExporterTransferStrategy strategy = createTransferStrategy(destination, 10); @@ -81,14 +81,14 @@ void shouldUseNextResourceIfFirstOneIsNotAvailableInSameCycle( // Act & assert sut.doWork(); - assertThat(storageChannel.getAll()).isEmpty(); + assertThat(storage.getAll()).isEmpty(); assertThat(destination.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( new ResourceAmount(B, 7) ); sut.doWork(); - assertThat(storageChannel.getAll()).isEmpty(); + assertThat(storage.getAll()).isEmpty(); assertThat(destination.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( new ResourceAmount(B, 7) ); diff --git a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/exporter/RoundRobinExporterNetworkNodeTest.java b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/exporter/RoundRobinExporterNetworkNodeTest.java index 278f6c6b3..d09f2cc24 100644 --- a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/exporter/RoundRobinExporterNetworkNodeTest.java +++ b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/exporter/RoundRobinExporterNetworkNodeTest.java @@ -4,22 +4,22 @@ import com.refinedmods.refinedstorage2.api.network.impl.node.task.RoundRobinTaskExecutor; import com.refinedmods.refinedstorage2.api.network.node.exporter.ExporterTransferStrategy; import com.refinedmods.refinedstorage2.api.network.node.task.TaskExecutor; +import com.refinedmods.refinedstorage2.api.network.storage.StorageNetworkComponent; import com.refinedmods.refinedstorage2.api.resource.ResourceAmount; import com.refinedmods.refinedstorage2.api.storage.EmptyActor; import com.refinedmods.refinedstorage2.api.storage.InMemoryStorageImpl; import com.refinedmods.refinedstorage2.api.storage.Storage; -import com.refinedmods.refinedstorage2.api.storage.channel.StorageChannel; -import com.refinedmods.refinedstorage2.network.test.InjectNetworkStorageChannel; +import com.refinedmods.refinedstorage2.network.test.InjectNetworkStorageComponent; import java.util.List; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static com.refinedmods.refinedstorage2.network.test.TestResource.A; -import static com.refinedmods.refinedstorage2.network.test.TestResource.B; -import static com.refinedmods.refinedstorage2.network.test.TestResource.C; -import static com.refinedmods.refinedstorage2.network.test.TestResource.D; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.A; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.B; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.C; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.D; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; @@ -41,11 +41,11 @@ protected TaskExecutor createTaskExecutor() { } @Test - void shouldTransfer(@InjectNetworkStorageChannel final StorageChannel storageChannel) { + void shouldTransfer(@InjectNetworkStorageComponent final StorageNetworkComponent storage) { // Arrange - storageChannel.addSource(new InMemoryStorageImpl()); - storageChannel.insert(A, 100, Action.EXECUTE, EmptyActor.INSTANCE); - storageChannel.insert(B, 100, Action.EXECUTE, EmptyActor.INSTANCE); + storage.addSource(new InMemoryStorageImpl()); + storage.insert(A, 100, Action.EXECUTE, EmptyActor.INSTANCE); + storage.insert(B, 100, Action.EXECUTE, EmptyActor.INSTANCE); final Storage destination = new InMemoryStorageImpl(); final ExporterTransferStrategy strategy = createTransferStrategy(destination, 5); @@ -56,7 +56,7 @@ void shouldTransfer(@InjectNetworkStorageChannel final StorageChannel storageCha // Act & assert sut.doWork(); - assertThat(storageChannel.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( + assertThat(storage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( new ResourceAmount(A, 95), new ResourceAmount(B, 100) ); @@ -68,7 +68,7 @@ void shouldTransfer(@InjectNetworkStorageChannel final StorageChannel storageCha sut.doWork(); - assertThat(storageChannel.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( + assertThat(storage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( new ResourceAmount(A, 95), new ResourceAmount(B, 95) ); @@ -81,7 +81,7 @@ void shouldTransfer(@InjectNetworkStorageChannel final StorageChannel storageCha sut.doWork(); - assertThat(storageChannel.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( + assertThat(storage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( new ResourceAmount(A, 90), new ResourceAmount(B, 95) ); @@ -109,12 +109,12 @@ void shouldNotTransferIfThereAreNoResourcesInSource() { @Test void shouldUseNextResourceIfFirstOneIsNotAvailableInSameCycle( - @InjectNetworkStorageChannel final StorageChannel storageChannel + @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storageChannel.addSource(new InMemoryStorageImpl()); - storageChannel.insert(C, 8, Action.EXECUTE, EmptyActor.INSTANCE); - storageChannel.insert(D, 9, Action.EXECUTE, EmptyActor.INSTANCE); + storage.addSource(new InMemoryStorageImpl()); + storage.insert(C, 8, Action.EXECUTE, EmptyActor.INSTANCE); + storage.insert(D, 9, Action.EXECUTE, EmptyActor.INSTANCE); final Storage destination = new InMemoryStorageImpl(); final ExporterTransferStrategy strategy = createTransferStrategy(destination, 10); @@ -125,7 +125,7 @@ void shouldUseNextResourceIfFirstOneIsNotAvailableInSameCycle( // Act & assert sut.doWork(); - assertThat(storageChannel.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( + assertThat(storage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( new ResourceAmount(D, 9) ); assertThat(destination.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( @@ -134,7 +134,7 @@ void shouldUseNextResourceIfFirstOneIsNotAvailableInSameCycle( sut.doWork(); - assertThat(storageChannel.getAll()).isEmpty(); + assertThat(storage.getAll()).isEmpty(); assertThat(destination.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( new ResourceAmount(C, 8), new ResourceAmount(D, 9) @@ -142,18 +142,18 @@ void shouldUseNextResourceIfFirstOneIsNotAvailableInSameCycle( sut.doWork(); - assertThat(storageChannel.getAll()).isEmpty(); + assertThat(storage.getAll()).isEmpty(); assertThat(destination.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( new ResourceAmount(C, 8), new ResourceAmount(D, 9) ); - storageChannel.insert(A, 1, Action.EXECUTE, EmptyActor.INSTANCE); - storageChannel.insert(B, 2, Action.EXECUTE, EmptyActor.INSTANCE); + storage.insert(A, 1, Action.EXECUTE, EmptyActor.INSTANCE); + storage.insert(B, 2, Action.EXECUTE, EmptyActor.INSTANCE); sut.doWork(); - assertThat(storageChannel.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( + assertThat(storage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( new ResourceAmount(B, 2) ); assertThat(destination.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( @@ -164,7 +164,7 @@ void shouldUseNextResourceIfFirstOneIsNotAvailableInSameCycle( sut.doWork(); - assertThat(storageChannel.getAll()).isEmpty(); + assertThat(storage.getAll()).isEmpty(); assertThat(destination.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( new ResourceAmount(A, 1), new ResourceAmount(B, 2), @@ -174,7 +174,7 @@ void shouldUseNextResourceIfFirstOneIsNotAvailableInSameCycle( sut.doWork(); - assertThat(storageChannel.getAll()).isEmpty(); + assertThat(storage.getAll()).isEmpty(); assertThat(destination.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( new ResourceAmount(A, 1), new ResourceAmount(B, 2), @@ -185,13 +185,13 @@ void shouldUseNextResourceIfFirstOneIsNotAvailableInSameCycle( @Test void shouldResetRoundRobinStateAfterChangingFilters( - @InjectNetworkStorageChannel final StorageChannel storageChannel + @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storageChannel.addSource(new InMemoryStorageImpl()); - storageChannel.insert(A, 100, Action.EXECUTE, EmptyActor.INSTANCE); - storageChannel.insert(B, 100, Action.EXECUTE, EmptyActor.INSTANCE); - storageChannel.insert(C, 100, Action.EXECUTE, EmptyActor.INSTANCE); + storage.addSource(new InMemoryStorageImpl()); + storage.insert(A, 100, Action.EXECUTE, EmptyActor.INSTANCE); + storage.insert(B, 100, Action.EXECUTE, EmptyActor.INSTANCE); + storage.insert(C, 100, Action.EXECUTE, EmptyActor.INSTANCE); final Storage destination = new InMemoryStorageImpl(); final ExporterTransferStrategy strategy = createTransferStrategy(destination, 5); @@ -202,7 +202,7 @@ void shouldResetRoundRobinStateAfterChangingFilters( // Act & assert sut.doWork(); - assertThat(storageChannel.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( + assertThat(storage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( new ResourceAmount(A, 95), new ResourceAmount(B, 100), new ResourceAmount(C, 100) @@ -213,7 +213,7 @@ void shouldResetRoundRobinStateAfterChangingFilters( sut.doWork(); - assertThat(storageChannel.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( + assertThat(storage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( new ResourceAmount(A, 95), new ResourceAmount(B, 95), new ResourceAmount(C, 100) @@ -227,7 +227,7 @@ void shouldResetRoundRobinStateAfterChangingFilters( sut.setFilters(List.of(A, C)); sut.doWork(); - assertThat(storageChannel.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( + assertThat(storage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( new ResourceAmount(A, 90), new ResourceAmount(B, 95), new ResourceAmount(C, 100) diff --git a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/externalstorage/ExternalStorageNetworkNodeTest.java b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/externalstorage/ExternalStorageNetworkNodeTest.java index bc6bff232..218848016 100644 --- a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/externalstorage/ExternalStorageNetworkNodeTest.java +++ b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/externalstorage/ExternalStorageNetworkNodeTest.java @@ -2,23 +2,23 @@ import com.refinedmods.refinedstorage2.api.core.Action; import com.refinedmods.refinedstorage2.api.network.Network; +import com.refinedmods.refinedstorage2.api.network.storage.StorageNetworkComponent; import com.refinedmods.refinedstorage2.api.resource.ResourceAmount; import com.refinedmods.refinedstorage2.api.resource.filter.FilterMode; import com.refinedmods.refinedstorage2.api.storage.AccessMode; import com.refinedmods.refinedstorage2.api.storage.EmptyActor; import com.refinedmods.refinedstorage2.api.storage.InMemoryStorageImpl; import com.refinedmods.refinedstorage2.api.storage.Storage; -import com.refinedmods.refinedstorage2.api.storage.channel.StorageChannel; import com.refinedmods.refinedstorage2.api.storage.external.ExternalStorageProvider; import com.refinedmods.refinedstorage2.api.storage.limited.LimitedStorageImpl; import com.refinedmods.refinedstorage2.api.storage.tracked.TrackedResource; import com.refinedmods.refinedstorage2.api.storage.tracked.TrackedStorageImpl; import com.refinedmods.refinedstorage2.network.test.AddNetworkNode; import com.refinedmods.refinedstorage2.network.test.InjectNetwork; -import com.refinedmods.refinedstorage2.network.test.InjectNetworkStorageChannel; +import com.refinedmods.refinedstorage2.network.test.InjectNetworkStorageComponent; import com.refinedmods.refinedstorage2.network.test.NetworkTest; import com.refinedmods.refinedstorage2.network.test.SetupNetwork; -import com.refinedmods.refinedstorage2.network.test.util.FakeActor; +import com.refinedmods.refinedstorage2.network.test.fake.FakeActor; import java.util.Optional; import java.util.Set; @@ -30,9 +30,9 @@ import org.junit.jupiter.params.provider.EnumSource; import org.junit.jupiter.params.provider.ValueSource; -import static com.refinedmods.refinedstorage2.network.test.TestResource.A; -import static com.refinedmods.refinedstorage2.network.test.TestResource.B; -import static com.refinedmods.refinedstorage2.network.test.TestResource.C; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.A; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.B; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.C; import static com.refinedmods.refinedstorage2.network.test.nodefactory.AbstractNetworkNodeFactory.PROPERTY_ENERGY_USAGE; import static org.assertj.core.api.Assertions.assertThat; @@ -48,7 +48,7 @@ class ExternalStorageNetworkNodeTest { ExternalStorageNetworkNode sut; @Test - void testInitialState(@InjectNetworkStorageChannel final StorageChannel networkStorage) { + void testInitialState(@InjectNetworkStorageComponent final StorageNetworkComponent networkStorage) { // Act final long inserted = networkStorage.insert(A, 10, Action.EXECUTE, FakeActor.INSTANCE); final long extracted = networkStorage.extract(A, 10, Action.EXECUTE, FakeActor.INSTANCE); @@ -66,7 +66,7 @@ void testInitialState(@InjectNetworkStorageChannel final StorageChannel networkS } @Test - void shouldInitialize(@InjectNetworkStorageChannel final StorageChannel networkStorage) { + void shouldInitialize(@InjectNetworkStorageComponent final StorageNetworkComponent networkStorage) { // Arrange final Storage storage = new InMemoryStorageImpl(); final ExternalStorageProvider provider = new StorageExternalStorageProvider(storage); @@ -81,7 +81,7 @@ void shouldInitialize(@InjectNetworkStorageChannel final StorageChannel networkS @Test void shouldBeAbleToInitializeMultipleTimes( - @InjectNetworkStorageChannel final StorageChannel networkStorage + @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage ) { // Arrange final Storage storage1 = new InMemoryStorageImpl(); @@ -111,7 +111,7 @@ void shouldBeAbleToInitializeMultipleTimes( } @Test - void shouldInsert(@InjectNetworkStorageChannel final StorageChannel networkStorage) { + void shouldInsert(@InjectNetworkStorageComponent final StorageNetworkComponent networkStorage) { // Arrange final Storage storage = new InMemoryStorageImpl(); final ExternalStorageProvider provider = new StorageExternalStorageProvider(storage); @@ -132,7 +132,7 @@ void shouldInsert(@InjectNetworkStorageChannel final StorageChannel networkStora } @Test - void shouldExtract(@InjectNetworkStorageChannel final StorageChannel networkStorage) { + void shouldExtract(@InjectNetworkStorageComponent final StorageNetworkComponent networkStorage) { // Arrange final Storage storage = new InMemoryStorageImpl(); storage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); @@ -154,7 +154,8 @@ void shouldExtract(@InjectNetworkStorageChannel final StorageChannel networkStor } @Test - void shouldRespectAllowlistWhenInserting(@InjectNetworkStorageChannel final StorageChannel networkStorage) { + void shouldRespectAllowlistWhenInserting( + @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage) { // Arrange sut.setFilterMode(FilterMode.ALLOW); sut.setFilters(Set.of(A, B)); @@ -176,7 +177,7 @@ void shouldRespectAllowlistWhenInserting(@InjectNetworkStorageChannel final Stor @Test void shouldRespectEmptyAllowlistWhenInserting( - @InjectNetworkStorageChannel final StorageChannel networkStorage + @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage ) { // Arrange sut.setFilterMode(FilterMode.ALLOW); @@ -198,7 +199,8 @@ void shouldRespectEmptyAllowlistWhenInserting( } @Test - void shouldRespectBlocklistWhenInserting(@InjectNetworkStorageChannel final StorageChannel networkStorage) { + void shouldRespectBlocklistWhenInserting( + @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage) { // Arrange sut.setFilterMode(FilterMode.BLOCK); sut.setFilters(Set.of(A, B)); @@ -220,7 +222,7 @@ void shouldRespectBlocklistWhenInserting(@InjectNetworkStorageChannel final Stor @Test void shouldRespectEmptyBlocklistWhenInserting( - @InjectNetworkStorageChannel final StorageChannel networkStorage) { + @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage) { // Arrange sut.setFilterMode(FilterMode.BLOCK); sut.setFilters(Set.of()); @@ -243,7 +245,8 @@ void shouldRespectEmptyBlocklistWhenInserting( @ParameterizedTest @EnumSource(AccessMode.class) void shouldRespectAccessModeWhenInserting(final AccessMode accessMode, - @InjectNetworkStorageChannel final StorageChannel networkStorage + @InjectNetworkStorageComponent + final StorageNetworkComponent networkStorage ) { // Arrange sut.setAccessMode(accessMode); @@ -265,7 +268,8 @@ void shouldRespectAccessModeWhenInserting(final AccessMode accessMode, @ParameterizedTest @EnumSource(AccessMode.class) void shouldRespectAccessModeWhenExtracting(final AccessMode accessMode, - @InjectNetworkStorageChannel final StorageChannel networkStorage + @InjectNetworkStorageComponent + final StorageNetworkComponent networkStorage ) { // Arrange sut.setAccessMode(accessMode); @@ -287,7 +291,7 @@ void shouldRespectAccessModeWhenExtracting(final AccessMode accessMode, } @Test - void shouldNotInsertWhenInactive(@InjectNetworkStorageChannel final StorageChannel networkStorage) { + void shouldNotInsertWhenInactive(@InjectNetworkStorageComponent final StorageNetworkComponent networkStorage) { // Arrange final Storage storage = new InMemoryStorageImpl(); final ExternalStorageProvider provider = new StorageExternalStorageProvider(storage); @@ -303,7 +307,7 @@ void shouldNotInsertWhenInactive(@InjectNetworkStorageChannel final StorageChann } @Test - void shouldNotExtractWhenInactive(@InjectNetworkStorageChannel final StorageChannel networkStorage) { + void shouldNotExtractWhenInactive(@InjectNetworkStorageComponent final StorageNetworkComponent networkStorage) { // Arrange final Storage storage = new InMemoryStorageImpl(); storage.insert(A, 5, Action.EXECUTE, EmptyActor.INSTANCE); @@ -321,7 +325,7 @@ void shouldNotExtractWhenInactive(@InjectNetworkStorageChannel final StorageChan @Test void shouldHideStorageContentsWhenInactive( - @InjectNetworkStorageChannel final StorageChannel networkStorage + @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage ) { // Arrange final Storage storage = new LimitedStorageImpl(100); @@ -340,7 +344,8 @@ void shouldHideStorageContentsWhenInactive( } @Test - void shouldShowStorageContentsWhenActive(@InjectNetworkStorageChannel final StorageChannel networkStorage) { + void shouldShowStorageContentsWhenActive( + @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage) { // Arrange final Storage storage = new LimitedStorageImpl(100); final ExternalStorageProvider provider = new StorageExternalStorageProvider(storage); @@ -363,7 +368,7 @@ void shouldShowStorageContentsWhenActive(@InjectNetworkStorageChannel final Stor @Test void shouldNoLongerShowOnNetworkWhenRemoved( - @InjectNetworkStorageChannel final StorageChannel networkStorage, + @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage, @InjectNetwork final Network network ) { // Arrange @@ -384,8 +389,8 @@ void shouldNoLongerShowOnNetworkWhenRemoved( @Test void shouldNotifyNewNetworkAboutChangesWhenChangingNetworks( - @InjectNetworkStorageChannel final StorageChannel networkStorage, - @InjectNetworkStorageChannel(networkId = "other") final StorageChannel otherNetworkStorage, + @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage, + @InjectNetworkStorageComponent(networkId = "other") final StorageNetworkComponent otherNetworkStorage, @InjectNetwork final Network network, @InjectNetwork("other") final Network otherNetwork ) { @@ -415,8 +420,8 @@ void shouldNotifyNewNetworkAboutChangesWhenChangingNetworks( @Test void shouldNoLongerNotifyOldNetworkAboutChangesWhenChangingNetworks( - @InjectNetworkStorageChannel final StorageChannel networkStorage, - @InjectNetworkStorageChannel(networkId = "other") final StorageChannel otherNetworkStorage, + @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage, + @InjectNetworkStorageComponent(networkId = "other") final StorageNetworkComponent otherNetworkStorage, @InjectNetwork final Network network, @InjectNetwork("other") final Network otherNetwork ) { @@ -450,7 +455,7 @@ void shouldNoLongerNotifyOldNetworkAboutChangesWhenChangingNetworks( @Test void shouldNoLongerShowOnNetworkWhenRemovedWithoutInitializedStorage( - @InjectNetworkStorageChannel final StorageChannel networkStorage, + @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage, @InjectNetwork final Network network ) { // Act @@ -465,7 +470,7 @@ void shouldNoLongerShowOnNetworkWhenRemovedWithoutInitializedStorage( @EnumSource(Action.class) void shouldTrackChangesWhenExtracting( final Action action, - @InjectNetworkStorageChannel final StorageChannel networkStorage + @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage ) { // Arrange final Storage storage = new LimitedStorageImpl(100); @@ -502,7 +507,7 @@ void shouldTrackChangesWhenExtracting( @EnumSource(Action.class) void shouldNotTrackChangesWhenExtractionFailed( final Action action, - @InjectNetworkStorageChannel final StorageChannel networkStorage + @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage ) { // Arrange final Storage storage = new LimitedStorageImpl(100); @@ -525,7 +530,7 @@ void shouldNotTrackChangesWhenExtractionFailed( @EnumSource(Action.class) void shouldTrackChangesWhenInserting( final Action action, - @InjectNetworkStorageChannel final StorageChannel networkStorage + @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage ) { // Arrange final Storage storage = new LimitedStorageImpl(100); @@ -561,7 +566,7 @@ void shouldTrackChangesWhenInserting( @EnumSource(Action.class) void shouldNotTrackChangesWhenInsertionFailed( final Action action, - @InjectNetworkStorageChannel final StorageChannel networkStorage + @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage ) { // Arrange final Storage storage = new LimitedStorageImpl(0); @@ -581,7 +586,7 @@ void shouldNotTrackChangesWhenInsertionFailed( } private AtomicBoolean trackWhetherResourceHasChangedAndTrackedResourceIsAvailable( - final StorageChannel networkStorage + final StorageNetworkComponent networkStorage ) { final AtomicBoolean found = new AtomicBoolean(); networkStorage.addListener(change -> { @@ -602,7 +607,7 @@ void shouldNotDetectChangesWithoutConnectedStorage() { } @Test - void shouldDetectChanges(@InjectNetworkStorageChannel final StorageChannel networkStorage) { + void shouldDetectChanges(@InjectNetworkStorageComponent final StorageNetworkComponent networkStorage) { // Arrange final Storage storage = new LimitedStorageImpl(100); final ExternalStorageProvider provider = new StorageExternalStorageProvider(storage); @@ -631,7 +636,7 @@ class PriorityTest { @ParameterizedTest @ValueSource(booleans = {true, false}) void shouldRespectPriority(final boolean oneHasPriority, - @InjectNetworkStorageChannel final StorageChannel networkStorage) { + @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage) { // Arrange final Storage storage1 = new TrackedStorageImpl(new LimitedStorageImpl(100), () -> 0L); final ExternalStorageProvider provider1 = new StorageExternalStorageProvider(storage1); diff --git a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/grid/GridNetworkNodeTest.java b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/grid/GridNetworkNodeTest.java index c90aa1436..5d28eab96 100644 --- a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/grid/GridNetworkNodeTest.java +++ b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/grid/GridNetworkNodeTest.java @@ -3,30 +3,30 @@ import com.refinedmods.refinedstorage2.api.core.Action; import com.refinedmods.refinedstorage2.api.grid.watcher.GridWatcher; import com.refinedmods.refinedstorage2.api.network.Network; +import com.refinedmods.refinedstorage2.api.network.storage.StorageNetworkComponent; import com.refinedmods.refinedstorage2.api.resource.ResourceKey; import com.refinedmods.refinedstorage2.api.storage.Actor; import com.refinedmods.refinedstorage2.api.storage.EmptyActor; import com.refinedmods.refinedstorage2.api.storage.InMemoryStorageImpl; -import com.refinedmods.refinedstorage2.api.storage.channel.StorageChannel; import com.refinedmods.refinedstorage2.api.storage.limited.LimitedStorageImpl; import com.refinedmods.refinedstorage2.api.storage.tracked.TrackedResource; import com.refinedmods.refinedstorage2.api.storage.tracked.TrackedStorageImpl; import com.refinedmods.refinedstorage2.network.test.AddNetworkNode; import com.refinedmods.refinedstorage2.network.test.InjectNetwork; -import com.refinedmods.refinedstorage2.network.test.InjectNetworkStorageChannel; +import com.refinedmods.refinedstorage2.network.test.InjectNetworkStorageComponent; import com.refinedmods.refinedstorage2.network.test.NetworkTest; import com.refinedmods.refinedstorage2.network.test.SetupNetwork; +import com.refinedmods.refinedstorage2.network.test.fake.FakeActor; import com.refinedmods.refinedstorage2.network.test.nodefactory.AbstractNetworkNodeFactory; -import com.refinedmods.refinedstorage2.network.test.util.FakeActor; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; -import static com.refinedmods.refinedstorage2.network.test.TestResource.A; -import static com.refinedmods.refinedstorage2.network.test.TestResource.B; -import static com.refinedmods.refinedstorage2.network.test.TestResource.C; -import static com.refinedmods.refinedstorage2.network.test.TestResource.D; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.A; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.B; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.C; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.D; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.ArgumentMatchers.anyLong; @@ -48,14 +48,14 @@ class GridNetworkNodeTest { @BeforeEach void setUp( - @InjectNetworkStorageChannel final StorageChannel storage, - @InjectNetworkStorageChannel(networkId = "other") final StorageChannel otherStorageChannel + @InjectNetworkStorageComponent final StorageNetworkComponent storage, + @InjectNetworkStorageComponent(networkId = "other") final StorageNetworkComponent otherStorage ) { storage.addSource(new TrackedStorageImpl(new LimitedStorageImpl(1000), () -> 2L)); storage.insert(A, 100, Action.EXECUTE, EmptyActor.INSTANCE); storage.insert(B, 200, Action.EXECUTE, EmptyActor.INSTANCE); - otherStorageChannel.addSource(new TrackedStorageImpl(new InMemoryStorageImpl(), () -> 3L)); + otherStorage.addSource(new TrackedStorageImpl(new InMemoryStorageImpl(), () -> 3L)); } @Test @@ -85,7 +85,7 @@ void shouldNotifyWatchersOfActivenessChanges() { @Test void shouldNotifyWatchersOfStorageChanges( - @InjectNetworkStorageChannel final StorageChannel networkStorage + @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage ) { // Arrange final GridWatcher watcher = mock(GridWatcher.class); @@ -141,8 +141,8 @@ void shouldNotBeAbleToAddDuplicateWatcher() { void shouldDetachWatchersFromOldNetworkAndReattachToNewNetwork( @InjectNetwork("other") final Network otherNetwork, @InjectNetwork final Network network, - @InjectNetworkStorageChannel final StorageChannel storageChannel, - @InjectNetworkStorageChannel(networkId = "other") final StorageChannel otherStorageChannel + @InjectNetworkStorageComponent final StorageNetworkComponent storage, + @InjectNetworkStorageComponent(networkId = "other") final StorageNetworkComponent otherStorage ) { // Arrange final GridWatcher watcher = mock(GridWatcher.class); @@ -150,19 +150,19 @@ void shouldDetachWatchersFromOldNetworkAndReattachToNewNetwork( // Act // This one shouldn't be ignored! - otherStorageChannel.insert(C, 10, Action.EXECUTE, FakeActor.INSTANCE); + otherStorage.insert(C, 10, Action.EXECUTE, FakeActor.INSTANCE); sut.setNetwork(otherNetwork); network.removeContainer(() -> sut); otherNetwork.addContainer(() -> sut); // these one shouldn't be ignored either - otherStorageChannel.insert(A, 10, Action.EXECUTE, FakeActor.INSTANCE); - otherStorageChannel.insert(D, 10, Action.EXECUTE, EmptyActor.INSTANCE); + otherStorage.insert(A, 10, Action.EXECUTE, FakeActor.INSTANCE); + otherStorage.insert(D, 10, Action.EXECUTE, EmptyActor.INSTANCE); // these should be ignored - storageChannel.insert(B, 10, Action.EXECUTE, FakeActor.INSTANCE); - storageChannel.insert(D, 10, Action.EXECUTE, EmptyActor.INSTANCE); + storage.insert(B, 10, Action.EXECUTE, FakeActor.INSTANCE); + storage.insert(D, 10, Action.EXECUTE, EmptyActor.INSTANCE); // Assert verify(watcher, times(1)).invalidate(); diff --git a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/iface/ClearSlotInterfaceNetworkNodeTest.java b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/iface/ClearSlotInterfaceNetworkNodeTest.java index 673d43a55..27a2b136a 100644 --- a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/iface/ClearSlotInterfaceNetworkNodeTest.java +++ b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/iface/ClearSlotInterfaceNetworkNodeTest.java @@ -1,19 +1,19 @@ package com.refinedmods.refinedstorage2.api.network.impl.node.iface; +import com.refinedmods.refinedstorage2.api.network.storage.StorageNetworkComponent; import com.refinedmods.refinedstorage2.api.resource.ResourceAmount; import com.refinedmods.refinedstorage2.api.storage.InMemoryStorageImpl; -import com.refinedmods.refinedstorage2.api.storage.channel.StorageChannel; import com.refinedmods.refinedstorage2.api.storage.limited.LimitedStorageImpl; import com.refinedmods.refinedstorage2.network.test.AddNetworkNode; -import com.refinedmods.refinedstorage2.network.test.InjectNetworkStorageChannel; +import com.refinedmods.refinedstorage2.network.test.InjectNetworkStorageComponent; import com.refinedmods.refinedstorage2.network.test.NetworkTest; import com.refinedmods.refinedstorage2.network.test.SetupNetwork; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static com.refinedmods.refinedstorage2.network.test.TestResource.A; -import static com.refinedmods.refinedstorage2.network.test.TestResource.B; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.A; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.B; import static org.assertj.core.api.Assertions.assertThat; @NetworkTest @@ -34,10 +34,10 @@ void setUp() { @Test void shouldClearSlotWhenNoLongerRequestingAnything( - @InjectNetworkStorageChannel final StorageChannel storageChannel + @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storageChannel.addSource(new InMemoryStorageImpl()); + storage.addSource(new InMemoryStorageImpl()); exportState.setCurrentlyExported(1, A, 7); exportState.setCurrentlyExported(2, B, 2); @@ -48,7 +48,7 @@ void shouldClearSlotWhenNoLongerRequestingAnything( assertThat(exportState.getExportedResource(1)).isEqualTo(A); assertThat(exportState.getExportedAmount(1)).isEqualTo(5); assertThat(exportState.getExportedResource(2)).isNull(); - assertThat(storageChannel.getAll()) + assertThat(storage.getAll()) .usingRecursiveFieldByFieldElementComparator() .containsExactlyInAnyOrder( new ResourceAmount(A, 2), @@ -60,7 +60,7 @@ void shouldClearSlotWhenNoLongerRequestingAnything( assertThat(exportState.getExportedResource(1)).isEqualTo(A); assertThat(exportState.getExportedAmount(1)).isEqualTo(3); assertThat(exportState.getExportedResource(2)).isNull(); - assertThat(storageChannel.getAll()) + assertThat(storage.getAll()) .usingRecursiveFieldByFieldElementComparator() .containsExactlyInAnyOrder( new ResourceAmount(A, 4), @@ -72,7 +72,7 @@ void shouldClearSlotWhenNoLongerRequestingAnything( assertThat(exportState.getExportedResource(1)).isEqualTo(A); assertThat(exportState.getExportedAmount(1)).isEqualTo(1); assertThat(exportState.getExportedResource(2)).isNull(); - assertThat(storageChannel.getAll()) + assertThat(storage.getAll()) .usingRecursiveFieldByFieldElementComparator() .containsExactlyInAnyOrder( new ResourceAmount(A, 6), @@ -83,7 +83,7 @@ void shouldClearSlotWhenNoLongerRequestingAnything( assertThat(exportState.getExportedResource(0)).isNull(); assertThat(exportState.getExportedResource(1)).isNull(); assertThat(exportState.getExportedResource(2)).isNull(); - assertThat(storageChannel.getAll()) + assertThat(storage.getAll()) .usingRecursiveFieldByFieldElementComparator() .containsExactlyInAnyOrder( new ResourceAmount(A, 7), @@ -96,7 +96,7 @@ void shouldClearSlotWhenNoLongerRequestingAnything( assertThat(exportState.getExportedResource(0)).isNull(); assertThat(exportState.getExportedResource(1)).isNull(); assertThat(exportState.getExportedResource(2)).isNull(); - assertThat(storageChannel.getAll()) + assertThat(storage.getAll()) .usingRecursiveFieldByFieldElementComparator() .containsExactlyInAnyOrder( new ResourceAmount(A, 7), @@ -106,10 +106,10 @@ void shouldClearSlotWhenNoLongerRequestingAnything( @Test void shouldClearSlotPartiallyWhenNoLongerRequestingAnythingButNetworkDoesNotHaveEnoughSpace( - @InjectNetworkStorageChannel final StorageChannel storageChannel + @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storageChannel.addSource(new LimitedStorageImpl(3)); + storage.addSource(new LimitedStorageImpl(3)); exportState.setCurrentlyExported(1, A, 7); @@ -119,7 +119,7 @@ void shouldClearSlotPartiallyWhenNoLongerRequestingAnythingButNetworkDoesNotHave assertThat(exportState.getExportedResource(1)).isEqualTo(A); assertThat(exportState.getExportedAmount(1)).isEqualTo(5); assertThat(exportState.getExportedResource(2)).isNull(); - assertThat(storageChannel.getAll()) + assertThat(storage.getAll()) .usingRecursiveFieldByFieldElementComparator() .containsExactly(new ResourceAmount(A, 2)); @@ -128,7 +128,7 @@ void shouldClearSlotPartiallyWhenNoLongerRequestingAnythingButNetworkDoesNotHave assertThat(exportState.getExportedResource(1)).isEqualTo(A); assertThat(exportState.getExportedAmount(1)).isEqualTo(4); assertThat(exportState.getExportedResource(2)).isNull(); - assertThat(storageChannel.getAll()) + assertThat(storage.getAll()) .usingRecursiveFieldByFieldElementComparator() .containsExactly(new ResourceAmount(A, 3)); @@ -139,14 +139,14 @@ void shouldClearSlotPartiallyWhenNoLongerRequestingAnythingButNetworkDoesNotHave assertThat(exportState.getExportedResource(1)).isEqualTo(A); assertThat(exportState.getExportedAmount(1)).isEqualTo(4); assertThat(exportState.getExportedResource(2)).isNull(); - assertThat(storageChannel.getAll()) + assertThat(storage.getAll()) .usingRecursiveFieldByFieldElementComparator() .containsExactly(new ResourceAmount(A, 3)); } @Test void shouldNotClearSlotWhenNoLongerRequestingAnythingAndNetworkDoesNotHaveEnoughSpace( - @InjectNetworkStorageChannel final StorageChannel storageChannel + @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange exportState.setCurrentlyExported(1, A, 7); @@ -160,6 +160,6 @@ void shouldNotClearSlotWhenNoLongerRequestingAnythingAndNetworkDoesNotHaveEnough assertThat(exportState.getExportedAmount(1)).isEqualTo(7); assertThat(exportState.getExportedResource(2)).isNull(); - assertThat(storageChannel.getAll()).isEmpty(); + assertThat(storage.getAll()).isEmpty(); } } diff --git a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/iface/ExportToEmptySlotInterfaceNetworkNodeTest.java b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/iface/ExportToEmptySlotInterfaceNetworkNodeTest.java index 7a41bd42b..a54ed32c7 100644 --- a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/iface/ExportToEmptySlotInterfaceNetworkNodeTest.java +++ b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/iface/ExportToEmptySlotInterfaceNetworkNodeTest.java @@ -1,22 +1,22 @@ package com.refinedmods.refinedstorage2.api.network.impl.node.iface; import com.refinedmods.refinedstorage2.api.core.Action; +import com.refinedmods.refinedstorage2.api.network.storage.StorageNetworkComponent; import com.refinedmods.refinedstorage2.api.resource.ResourceAmount; import com.refinedmods.refinedstorage2.api.storage.EmptyActor; import com.refinedmods.refinedstorage2.api.storage.InMemoryStorageImpl; -import com.refinedmods.refinedstorage2.api.storage.channel.StorageChannel; import com.refinedmods.refinedstorage2.network.test.AddNetworkNode; -import com.refinedmods.refinedstorage2.network.test.InjectNetworkStorageChannel; +import com.refinedmods.refinedstorage2.network.test.InjectNetworkStorageComponent; import com.refinedmods.refinedstorage2.network.test.NetworkTest; import com.refinedmods.refinedstorage2.network.test.SetupNetwork; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static com.refinedmods.refinedstorage2.network.test.TestResource.A; -import static com.refinedmods.refinedstorage2.network.test.TestResource.A_ALTERNATIVE; -import static com.refinedmods.refinedstorage2.network.test.TestResource.A_ALTERNATIVE2; -import static com.refinedmods.refinedstorage2.network.test.TestResource.B; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.A; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.A_ALTERNATIVE; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.A_ALTERNATIVE2; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.B; import static org.assertj.core.api.Assertions.assertThat; @NetworkTest @@ -37,7 +37,7 @@ void setUp() { @Test void shouldNotExportToEmptySlotWhenRequestedIsNotAvailable( - @InjectNetworkStorageChannel final StorageChannel storageChannel + @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange exportState.setRequestedResource(1, A, 1); @@ -50,16 +50,16 @@ void shouldNotExportToEmptySlotWhenRequestedIsNotAvailable( assertThat(exportState.getExportedResource(0)).isNull(); assertThat(exportState.getExportedResource(1)).isNull(); assertThat(exportState.getExportedResource(2)).isNull(); - assertThat(storageChannel.getAll()).isEmpty(); + assertThat(storage.getAll()).isEmpty(); } @Test void shouldExportToEmptySlotWhenRequestedIsNotEntirelyAvailable( - @InjectNetworkStorageChannel final StorageChannel storageChannel + @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storageChannel.addSource(new InMemoryStorageImpl()); - storageChannel.insert(A, 2, Action.EXECUTE, EmptyActor.INSTANCE); + storage.addSource(new InMemoryStorageImpl()); + storage.insert(A, 2, Action.EXECUTE, EmptyActor.INSTANCE); exportState.setRequestedResource(1, A, 10); @@ -74,16 +74,16 @@ void shouldExportToEmptySlotWhenRequestedIsNotEntirelyAvailable( assertThat(exportState.getExportedAmount(1)).isEqualTo(2); assertThat(exportState.getExportedResource(2)).isNull(); - assertThat(storageChannel.getAll()).isEmpty(); + assertThat(storage.getAll()).isEmpty(); } @Test void shouldExportToEmptySlotWhenRequestedIsLessThanTransferQuota( - @InjectNetworkStorageChannel final StorageChannel storageChannel + @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storageChannel.addSource(new InMemoryStorageImpl()); - storageChannel.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); + storage.addSource(new InMemoryStorageImpl()); + storage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); exportState.setRequestedResource(1, A, 1); @@ -96,19 +96,19 @@ void shouldExportToEmptySlotWhenRequestedIsLessThanTransferQuota( assertThat(exportState.getExportedAmount(1)).isEqualTo(1); assertThat(exportState.getExportedResource(2)).isNull(); - assertThat(storageChannel.getAll()) + assertThat(storage.getAll()) .usingRecursiveFieldByFieldElementComparator() .containsExactly(new ResourceAmount(A, 9)); } @Test void shouldExportToEmptySlot( - @InjectNetworkStorageChannel final StorageChannel storageChannel + @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storageChannel.addSource(new InMemoryStorageImpl()); - storageChannel.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); - storageChannel.insert(B, 10, Action.EXECUTE, EmptyActor.INSTANCE); + storage.addSource(new InMemoryStorageImpl()); + storage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); + storage.insert(B, 10, Action.EXECUTE, EmptyActor.INSTANCE); exportState.setRequestedResource(1, A, 7); exportState.setRequestedResource(2, B, 2); @@ -123,7 +123,7 @@ void shouldExportToEmptySlot( assertThat(exportState.getExportedResource(2)).isEqualTo(B); assertThat(exportState.getExportedAmount(2)).isEqualTo(2); - assertThat(storageChannel.getAll()) + assertThat(storage.getAll()) .usingRecursiveFieldByFieldElementComparator() .containsExactlyInAnyOrder( new ResourceAmount(A, 8), @@ -133,12 +133,12 @@ void shouldExportToEmptySlot( @Test void shouldExportResourceFuzzilyToEmptySlot( - @InjectNetworkStorageChannel final StorageChannel storageChannel + @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storageChannel.addSource(new InMemoryStorageImpl()); - storageChannel.insert(A_ALTERNATIVE, 10, Action.EXECUTE, EmptyActor.INSTANCE); - storageChannel.insert(A_ALTERNATIVE2, 10, Action.EXECUTE, EmptyActor.INSTANCE); + storage.addSource(new InMemoryStorageImpl()); + storage.insert(A_ALTERNATIVE, 10, Action.EXECUTE, EmptyActor.INSTANCE); + storage.insert(A_ALTERNATIVE2, 10, Action.EXECUTE, EmptyActor.INSTANCE); exportState.setRequestedResource(1, A, 10); @@ -151,7 +151,7 @@ void shouldExportResourceFuzzilyToEmptySlot( assertThat(exportState.getExportedAmount(1)).isEqualTo(2); assertThat(exportState.getExportedResource(2)).isNull(); - assertThat(storageChannel.getAll()) + assertThat(storage.getAll()) .usingRecursiveFieldByFieldElementComparator() .containsExactlyInAnyOrder( new ResourceAmount(A_ALTERNATIVE, 8), diff --git a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/iface/InterfaceExportStateImpl.java b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/iface/InterfaceExportStateImpl.java index df0b48887..ed4e50d7c 100644 --- a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/iface/InterfaceExportStateImpl.java +++ b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/iface/InterfaceExportStateImpl.java @@ -13,9 +13,9 @@ import java.util.Map; import javax.annotation.Nullable; -import static com.refinedmods.refinedstorage2.network.test.TestResource.A; -import static com.refinedmods.refinedstorage2.network.test.TestResource.A_ALTERNATIVE; -import static com.refinedmods.refinedstorage2.network.test.TestResource.A_ALTERNATIVE2; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.A; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.A_ALTERNATIVE; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.A_ALTERNATIVE2; public class InterfaceExportStateImpl implements InterfaceExportState { private final Map requested = new HashMap<>(); diff --git a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/iface/InterfaceNetworkNodeTest.java b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/iface/InterfaceNetworkNodeTest.java index 7365d7687..3ce965776 100644 --- a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/iface/InterfaceNetworkNodeTest.java +++ b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/iface/InterfaceNetworkNodeTest.java @@ -2,20 +2,20 @@ import com.refinedmods.refinedstorage2.api.core.Action; import com.refinedmods.refinedstorage2.api.network.energy.EnergyNetworkComponent; +import com.refinedmods.refinedstorage2.api.network.storage.StorageNetworkComponent; import com.refinedmods.refinedstorage2.api.resource.ResourceAmount; import com.refinedmods.refinedstorage2.api.storage.EmptyActor; import com.refinedmods.refinedstorage2.api.storage.InMemoryStorageImpl; -import com.refinedmods.refinedstorage2.api.storage.channel.StorageChannel; import com.refinedmods.refinedstorage2.network.test.AddNetworkNode; import com.refinedmods.refinedstorage2.network.test.InjectNetworkEnergyComponent; -import com.refinedmods.refinedstorage2.network.test.InjectNetworkStorageChannel; +import com.refinedmods.refinedstorage2.network.test.InjectNetworkStorageComponent; import com.refinedmods.refinedstorage2.network.test.NetworkTest; import com.refinedmods.refinedstorage2.network.test.SetupNetwork; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static com.refinedmods.refinedstorage2.network.test.TestResource.A; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.A; import static org.assertj.core.api.Assertions.assertThat; @NetworkTest @@ -46,12 +46,12 @@ void shouldExtractEnergy( @Test void shouldExportAllWithDefaultTransferQuota( - @InjectNetworkStorageChannel final StorageChannel storageChannel, + @InjectNetworkStorageComponent final StorageNetworkComponent storage, @InjectNetworkEnergyComponent final EnergyNetworkComponent energy ) { // Arrange - storageChannel.addSource(new InMemoryStorageImpl()); - storageChannel.insert(A, Long.MAX_VALUE, Action.EXECUTE, EmptyActor.INSTANCE); + storage.addSource(new InMemoryStorageImpl()); + storage.insert(A, Long.MAX_VALUE, Action.EXECUTE, EmptyActor.INSTANCE); exportState.setRequestedResource(1, A, Long.MAX_VALUE); @@ -62,18 +62,18 @@ void shouldExportAllWithDefaultTransferQuota( assertThat(exportState.getExportedResource(0)).isNull(); assertThat(exportState.getExportedResource(1)).isEqualTo(A); assertThat(exportState.getExportedAmount(1)).isEqualTo(Long.MAX_VALUE); - assertThat(storageChannel.getAll()).isEmpty(); + assertThat(storage.getAll()).isEmpty(); assertThat(energy.getStored()).isEqualTo(1000 - 5); } @Test void shouldNotExportAnythingWithoutBeingActive( - @InjectNetworkStorageChannel final StorageChannel storageChannel, + @InjectNetworkStorageComponent final StorageNetworkComponent storage, @InjectNetworkEnergyComponent final EnergyNetworkComponent energy ) { // Arrange - storageChannel.addSource(new InMemoryStorageImpl()); - storageChannel.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); + storage.addSource(new InMemoryStorageImpl()); + storage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); exportState.setRequestedResource(1, A, 1); @@ -86,7 +86,7 @@ void shouldNotExportAnythingWithoutBeingActive( // Assert assertThat(exportState.getExportedResource(0)).isNull(); assertThat(exportState.getExportedResource(1)).isNull(); - assertThat(storageChannel.getAll()) + assertThat(storage.getAll()) .usingRecursiveFieldByFieldElementComparator() .containsExactly(new ResourceAmount(A, 10)); assertThat(energy.getStored()).isEqualTo(1000); @@ -94,12 +94,12 @@ void shouldNotExportAnythingWithoutBeingActive( @Test void shouldNotExportAnythingWithoutNetwork( - @InjectNetworkStorageChannel final StorageChannel storageChannel, + @InjectNetworkStorageComponent final StorageNetworkComponent storage, @InjectNetworkEnergyComponent final EnergyNetworkComponent energy ) { // Arrange - storageChannel.addSource(new InMemoryStorageImpl()); - storageChannel.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); + storage.addSource(new InMemoryStorageImpl()); + storage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); exportState.setRequestedResource(1, A, 1); @@ -112,7 +112,7 @@ void shouldNotExportAnythingWithoutNetwork( // Assert assertThat(exportState.getExportedResource(0)).isNull(); assertThat(exportState.getExportedResource(1)).isNull(); - assertThat(storageChannel.getAll()) + assertThat(storage.getAll()) .usingRecursiveFieldByFieldElementComparator() .containsExactly(new ResourceAmount(A, 10)); assertThat(energy.getStored()).isEqualTo(1000); @@ -120,12 +120,12 @@ void shouldNotExportAnythingWithoutNetwork( @Test void shouldNotExportAnythingWithoutExportState( - @InjectNetworkStorageChannel final StorageChannel storageChannel, + @InjectNetworkStorageComponent final StorageNetworkComponent storage, @InjectNetworkEnergyComponent final EnergyNetworkComponent energy ) { // Arrange - storageChannel.addSource(new InMemoryStorageImpl()); - storageChannel.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); + storage.addSource(new InMemoryStorageImpl()); + storage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); sut.setExportState(null); sut.setTransferQuotaProvider(resource -> 2); @@ -136,7 +136,7 @@ void shouldNotExportAnythingWithoutExportState( // Assert assertThat(exportState.getExportedResource(0)).isNull(); assertThat(exportState.getExportedResource(1)).isNull(); - assertThat(storageChannel.getAll()) + assertThat(storage.getAll()) .usingRecursiveFieldByFieldElementComparator() .containsExactly(new ResourceAmount(A, 10)); assertThat(energy.getStored()).isEqualTo(1000 - 5); diff --git a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/iface/KeepExportingInterfaceNetworkNodeTest.java b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/iface/KeepExportingInterfaceNetworkNodeTest.java index 78d1d5ace..14886930f 100644 --- a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/iface/KeepExportingInterfaceNetworkNodeTest.java +++ b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/iface/KeepExportingInterfaceNetworkNodeTest.java @@ -1,23 +1,23 @@ package com.refinedmods.refinedstorage2.api.network.impl.node.iface; import com.refinedmods.refinedstorage2.api.core.Action; +import com.refinedmods.refinedstorage2.api.network.storage.StorageNetworkComponent; import com.refinedmods.refinedstorage2.api.resource.ResourceAmount; import com.refinedmods.refinedstorage2.api.storage.EmptyActor; import com.refinedmods.refinedstorage2.api.storage.InMemoryStorageImpl; -import com.refinedmods.refinedstorage2.api.storage.channel.StorageChannel; import com.refinedmods.refinedstorage2.api.storage.limited.LimitedStorageImpl; import com.refinedmods.refinedstorage2.network.test.AddNetworkNode; -import com.refinedmods.refinedstorage2.network.test.InjectNetworkStorageChannel; +import com.refinedmods.refinedstorage2.network.test.InjectNetworkStorageComponent; import com.refinedmods.refinedstorage2.network.test.NetworkTest; import com.refinedmods.refinedstorage2.network.test.SetupNetwork; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static com.refinedmods.refinedstorage2.network.test.TestResource.A; -import static com.refinedmods.refinedstorage2.network.test.TestResource.A_ALTERNATIVE; -import static com.refinedmods.refinedstorage2.network.test.TestResource.A_ALTERNATIVE2; -import static com.refinedmods.refinedstorage2.network.test.TestResource.B; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.A; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.A_ALTERNATIVE; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.A_ALTERNATIVE2; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.B; import static org.assertj.core.api.Assertions.assertThat; @NetworkTest @@ -38,11 +38,11 @@ void setUp() { @Test void shouldKeepExportingResourceUntilWantedAmountIsReached( - @InjectNetworkStorageChannel final StorageChannel storageChannel + @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storageChannel.addSource(new InMemoryStorageImpl()); - storageChannel.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); + storage.addSource(new InMemoryStorageImpl()); + storage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); exportState.setRequestedResource(1, A, 7); @@ -51,7 +51,7 @@ void shouldKeepExportingResourceUntilWantedAmountIsReached( assertThat(exportState.getExportedResource(0)).isNull(); assertThat(exportState.getExportedResource(1)).isEqualTo(A); assertThat(exportState.getExportedAmount(1)).isEqualTo(2); - assertThat(storageChannel.getAll()) + assertThat(storage.getAll()) .usingRecursiveFieldByFieldElementComparator() .containsExactly(new ResourceAmount(A, 8)); @@ -59,7 +59,7 @@ void shouldKeepExportingResourceUntilWantedAmountIsReached( assertThat(exportState.getExportedResource(0)).isNull(); assertThat(exportState.getExportedResource(1)).isEqualTo(A); assertThat(exportState.getExportedAmount(1)).isEqualTo(4); - assertThat(storageChannel.getAll()) + assertThat(storage.getAll()) .usingRecursiveFieldByFieldElementComparator() .containsExactly(new ResourceAmount(A, 6)); @@ -67,7 +67,7 @@ void shouldKeepExportingResourceUntilWantedAmountIsReached( assertThat(exportState.getExportedResource(0)).isNull(); assertThat(exportState.getExportedResource(1)).isEqualTo(A); assertThat(exportState.getExportedAmount(1)).isEqualTo(6); - assertThat(storageChannel.getAll()) + assertThat(storage.getAll()) .usingRecursiveFieldByFieldElementComparator() .containsExactly(new ResourceAmount(A, 4)); @@ -75,7 +75,7 @@ void shouldKeepExportingResourceUntilWantedAmountIsReached( assertThat(exportState.getExportedResource(0)).isNull(); assertThat(exportState.getExportedResource(1)).isEqualTo(A); assertThat(exportState.getExportedAmount(1)).isEqualTo(7); - assertThat(storageChannel.getAll()) + assertThat(storage.getAll()) .usingRecursiveFieldByFieldElementComparator() .containsExactly(new ResourceAmount(A, 3)); @@ -85,18 +85,18 @@ void shouldKeepExportingResourceUntilWantedAmountIsReached( assertThat(exportState.getExportedResource(0)).isNull(); assertThat(exportState.getExportedResource(1)).isEqualTo(A); assertThat(exportState.getExportedAmount(1)).isEqualTo(7); - assertThat(storageChannel.getAll()) + assertThat(storage.getAll()) .usingRecursiveFieldByFieldElementComparator() .containsExactly(new ResourceAmount(A, 3)); } @Test void shouldKeepExportingResourceUntilWantedAmountIsReachedAndNetworkHasEnoughResources( - @InjectNetworkStorageChannel final StorageChannel storageChannel + @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storageChannel.addSource(new InMemoryStorageImpl()); - storageChannel.insert(A, 7, Action.EXECUTE, EmptyActor.INSTANCE); + storage.addSource(new InMemoryStorageImpl()); + storage.insert(A, 7, Action.EXECUTE, EmptyActor.INSTANCE); exportState.setRequestedResource(1, A, 10); @@ -105,7 +105,7 @@ void shouldKeepExportingResourceUntilWantedAmountIsReachedAndNetworkHasEnoughRes assertThat(exportState.getExportedResource(0)).isNull(); assertThat(exportState.getExportedResource(1)).isEqualTo(A); assertThat(exportState.getExportedAmount(1)).isEqualTo(2); - assertThat(storageChannel.getAll()) + assertThat(storage.getAll()) .usingRecursiveFieldByFieldElementComparator() .containsExactly(new ResourceAmount(A, 5)); @@ -113,7 +113,7 @@ void shouldKeepExportingResourceUntilWantedAmountIsReachedAndNetworkHasEnoughRes assertThat(exportState.getExportedResource(0)).isNull(); assertThat(exportState.getExportedResource(1)).isEqualTo(A); assertThat(exportState.getExportedAmount(1)).isEqualTo(4); - assertThat(storageChannel.getAll()) + assertThat(storage.getAll()) .usingRecursiveFieldByFieldElementComparator() .containsExactly(new ResourceAmount(A, 3)); @@ -121,7 +121,7 @@ void shouldKeepExportingResourceUntilWantedAmountIsReachedAndNetworkHasEnoughRes assertThat(exportState.getExportedResource(0)).isNull(); assertThat(exportState.getExportedResource(1)).isEqualTo(A); assertThat(exportState.getExportedAmount(1)).isEqualTo(6); - assertThat(storageChannel.getAll()) + assertThat(storage.getAll()) .usingRecursiveFieldByFieldElementComparator() .containsExactly(new ResourceAmount(A, 1)); @@ -129,7 +129,7 @@ void shouldKeepExportingResourceUntilWantedAmountIsReachedAndNetworkHasEnoughRes assertThat(exportState.getExportedResource(0)).isNull(); assertThat(exportState.getExportedResource(1)).isEqualTo(A); assertThat(exportState.getExportedAmount(1)).isEqualTo(7); - assertThat(storageChannel.getAll()).isEmpty(); + assertThat(storage.getAll()).isEmpty(); sut.doWork(); sut.doWork(); @@ -137,17 +137,17 @@ void shouldKeepExportingResourceUntilWantedAmountIsReachedAndNetworkHasEnoughRes assertThat(exportState.getExportedResource(0)).isNull(); assertThat(exportState.getExportedResource(1)).isEqualTo(A); assertThat(exportState.getExportedAmount(1)).isEqualTo(7); - assertThat(storageChannel.getAll()).isEmpty(); + assertThat(storage.getAll()).isEmpty(); } @Test void shouldKeepExportingResourceFuzzilyUntilWantedAmountIsReached( - @InjectNetworkStorageChannel final StorageChannel storageChannel + @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storageChannel.addSource(new InMemoryStorageImpl()); - storageChannel.insert(A_ALTERNATIVE, 10, Action.EXECUTE, EmptyActor.INSTANCE); - storageChannel.insert(A_ALTERNATIVE2, 10, Action.EXECUTE, EmptyActor.INSTANCE); + storage.addSource(new InMemoryStorageImpl()); + storage.insert(A_ALTERNATIVE, 10, Action.EXECUTE, EmptyActor.INSTANCE); + storage.insert(A_ALTERNATIVE2, 10, Action.EXECUTE, EmptyActor.INSTANCE); exportState.setRequestedResource(1, A, 10); @@ -156,7 +156,7 @@ void shouldKeepExportingResourceFuzzilyUntilWantedAmountIsReached( assertThat(exportState.getExportedResource(0)).isNull(); assertThat(exportState.getExportedResource(1)).isEqualTo(A_ALTERNATIVE); assertThat(exportState.getExportedAmount(1)).isEqualTo(2); - assertThat(storageChannel.getAll()) + assertThat(storage.getAll()) .usingRecursiveFieldByFieldElementComparator() .containsExactlyInAnyOrder( new ResourceAmount(A_ALTERNATIVE, 8), @@ -167,7 +167,7 @@ void shouldKeepExportingResourceFuzzilyUntilWantedAmountIsReached( assertThat(exportState.getExportedResource(0)).isNull(); assertThat(exportState.getExportedResource(1)).isEqualTo(A_ALTERNATIVE); assertThat(exportState.getExportedAmount(1)).isEqualTo(4); - assertThat(storageChannel.getAll()) + assertThat(storage.getAll()) .usingRecursiveFieldByFieldElementComparator() .containsExactlyInAnyOrder( new ResourceAmount(A_ALTERNATIVE, 6), @@ -177,11 +177,11 @@ void shouldKeepExportingResourceFuzzilyUntilWantedAmountIsReached( @Test void shouldKeepExportingResourceFuzzilyUntilWantedAmountIsReachedEvenIfTheResourceIsNoLongerAvailableInTheNetwork( - @InjectNetworkStorageChannel final StorageChannel storageChannel + @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storageChannel.addSource(new InMemoryStorageImpl()); - storageChannel.insert(A_ALTERNATIVE, 1, Action.EXECUTE, EmptyActor.INSTANCE); + storage.addSource(new InMemoryStorageImpl()); + storage.insert(A_ALTERNATIVE, 1, Action.EXECUTE, EmptyActor.INSTANCE); exportState.setRequestedResource(1, A, 1); @@ -190,21 +190,21 @@ void shouldKeepExportingResourceFuzzilyUntilWantedAmountIsReachedEvenIfTheResour assertThat(exportState.getExportedResource(0)).isNull(); assertThat(exportState.getExportedResource(1)).isEqualTo(A_ALTERNATIVE); assertThat(exportState.getExportedAmount(1)).isEqualTo(1); - assertThat(storageChannel.getAll()).isEmpty(); + assertThat(storage.getAll()).isEmpty(); sut.doWork(); assertThat(exportState.getExportedResource(0)).isNull(); assertThat(exportState.getExportedResource(1)).isEqualTo(A_ALTERNATIVE); assertThat(exportState.getExportedAmount(1)).isEqualTo(1); - assertThat(storageChannel.getAll()).isEmpty(); + assertThat(storage.getAll()).isEmpty(); } @Test void shouldReturnResourceToNetworkUntilWantedAmountIsReached( - @InjectNetworkStorageChannel final StorageChannel storageChannel + @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storageChannel.addSource(new InMemoryStorageImpl()); + storage.addSource(new InMemoryStorageImpl()); exportState.setRequestedResource(1, A, 7); exportState.setCurrentlyExported(1, A, 10); @@ -214,7 +214,7 @@ void shouldReturnResourceToNetworkUntilWantedAmountIsReached( assertThat(exportState.getExportedResource(0)).isNull(); assertThat(exportState.getExportedResource(1)).isEqualTo(A); assertThat(exportState.getExportedAmount(1)).isEqualTo(8); - assertThat(storageChannel.getAll()) + assertThat(storage.getAll()) .usingRecursiveFieldByFieldElementComparator() .containsExactly(new ResourceAmount(A, 2)); @@ -222,7 +222,7 @@ void shouldReturnResourceToNetworkUntilWantedAmountIsReached( assertThat(exportState.getExportedResource(0)).isNull(); assertThat(exportState.getExportedResource(1)).isEqualTo(A); assertThat(exportState.getExportedAmount(1)).isEqualTo(7); - assertThat(storageChannel.getAll()) + assertThat(storage.getAll()) .usingRecursiveFieldByFieldElementComparator() .containsExactly(new ResourceAmount(A, 3)); @@ -232,17 +232,17 @@ void shouldReturnResourceToNetworkUntilWantedAmountIsReached( assertThat(exportState.getExportedResource(0)).isNull(); assertThat(exportState.getExportedResource(1)).isEqualTo(A); assertThat(exportState.getExportedAmount(1)).isEqualTo(7); - assertThat(storageChannel.getAll()) + assertThat(storage.getAll()) .usingRecursiveFieldByFieldElementComparator() .containsExactly(new ResourceAmount(A, 3)); } @Test void shouldReturnResourceToNetworkUntilWantedAmountIsReachedAndNetworkIsFull( - @InjectNetworkStorageChannel final StorageChannel storageChannel + @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storageChannel.addSource(new LimitedStorageImpl(3)); + storage.addSource(new LimitedStorageImpl(3)); exportState.setRequestedResource(1, A, 5); exportState.setCurrentlyExported(1, A, 10); @@ -252,7 +252,7 @@ void shouldReturnResourceToNetworkUntilWantedAmountIsReachedAndNetworkIsFull( assertThat(exportState.getExportedResource(0)).isNull(); assertThat(exportState.getExportedResource(1)).isEqualTo(A); assertThat(exportState.getExportedAmount(1)).isEqualTo(8); - assertThat(storageChannel.getAll()) + assertThat(storage.getAll()) .usingRecursiveFieldByFieldElementComparator() .containsExactly(new ResourceAmount(A, 2)); @@ -260,7 +260,7 @@ void shouldReturnResourceToNetworkUntilWantedAmountIsReachedAndNetworkIsFull( assertThat(exportState.getExportedResource(0)).isNull(); assertThat(exportState.getExportedResource(1)).isEqualTo(A); assertThat(exportState.getExportedAmount(1)).isEqualTo(7); - assertThat(storageChannel.getAll()) + assertThat(storage.getAll()) .usingRecursiveFieldByFieldElementComparator() .containsExactly(new ResourceAmount(A, 3)); @@ -270,18 +270,18 @@ void shouldReturnResourceToNetworkUntilWantedAmountIsReachedAndNetworkIsFull( assertThat(exportState.getExportedResource(0)).isNull(); assertThat(exportState.getExportedResource(1)).isEqualTo(A); assertThat(exportState.getExportedAmount(1)).isEqualTo(7); - assertThat(storageChannel.getAll()) + assertThat(storage.getAll()) .usingRecursiveFieldByFieldElementComparator() .containsExactly(new ResourceAmount(A, 3)); } @Test void shouldReturnResourceToNetworkAndExportOtherResourceIfSpecified( - @InjectNetworkStorageChannel final StorageChannel storageChannel + @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storageChannel.addSource(new InMemoryStorageImpl()); - storageChannel.insert(B, 10, Action.EXECUTE, EmptyActor.INSTANCE); + storage.addSource(new InMemoryStorageImpl()); + storage.insert(B, 10, Action.EXECUTE, EmptyActor.INSTANCE); exportState.setRequestedResource(1, B, 3); exportState.setCurrentlyExported(1, A, 3); @@ -291,7 +291,7 @@ void shouldReturnResourceToNetworkAndExportOtherResourceIfSpecified( assertThat(exportState.getExportedResource(0)).isNull(); assertThat(exportState.getExportedResource(1)).isEqualTo(A); assertThat(exportState.getExportedAmount(1)).isEqualTo(1); - assertThat(storageChannel.getAll()) + assertThat(storage.getAll()) .usingRecursiveFieldByFieldElementComparator() .containsExactlyInAnyOrder( new ResourceAmount(A, 2), @@ -301,7 +301,7 @@ void shouldReturnResourceToNetworkAndExportOtherResourceIfSpecified( sut.doWork(); assertThat(exportState.getExportedResource(0)).isNull(); assertThat(exportState.getExportedResource(1)).isNull(); - assertThat(storageChannel.getAll()) + assertThat(storage.getAll()) .usingRecursiveFieldByFieldElementComparator() .containsExactlyInAnyOrder( new ResourceAmount(A, 3), @@ -312,7 +312,7 @@ void shouldReturnResourceToNetworkAndExportOtherResourceIfSpecified( assertThat(exportState.getExportedResource(0)).isNull(); assertThat(exportState.getExportedResource(1)).isEqualTo(B); assertThat(exportState.getExportedAmount(1)).isEqualTo(2); - assertThat(storageChannel.getAll()) + assertThat(storage.getAll()) .usingRecursiveFieldByFieldElementComparator() .containsExactlyInAnyOrder( new ResourceAmount(A, 3), @@ -323,7 +323,7 @@ void shouldReturnResourceToNetworkAndExportOtherResourceIfSpecified( assertThat(exportState.getExportedResource(0)).isNull(); assertThat(exportState.getExportedResource(1)).isEqualTo(B); assertThat(exportState.getExportedAmount(1)).isEqualTo(3); - assertThat(storageChannel.getAll()) + assertThat(storage.getAll()) .usingRecursiveFieldByFieldElementComparator() .containsExactlyInAnyOrder( new ResourceAmount(A, 3), @@ -336,7 +336,7 @@ void shouldReturnResourceToNetworkAndExportOtherResourceIfSpecified( assertThat(exportState.getExportedResource(0)).isNull(); assertThat(exportState.getExportedResource(1)).isEqualTo(B); assertThat(exportState.getExportedAmount(1)).isEqualTo(3); - assertThat(storageChannel.getAll()) + assertThat(storage.getAll()) .usingRecursiveFieldByFieldElementComparator() .containsExactlyInAnyOrder( new ResourceAmount(A, 3), @@ -346,11 +346,11 @@ void shouldReturnResourceToNetworkAndExportOtherResourceIfSpecified( @Test void shouldReturnResourceToNetworkAndExportOtherResourceIfSpecifiedUntilNetworkIsFull( - @InjectNetworkStorageChannel final StorageChannel storageChannel + @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storageChannel.addSource(new LimitedStorageImpl(11)); - storageChannel.insert(B, 10, Action.EXECUTE, EmptyActor.INSTANCE); + storage.addSource(new LimitedStorageImpl(11)); + storage.insert(B, 10, Action.EXECUTE, EmptyActor.INSTANCE); exportState.setRequestedResource(1, B, 3); exportState.setCurrentlyExported(1, A, 3); @@ -360,7 +360,7 @@ void shouldReturnResourceToNetworkAndExportOtherResourceIfSpecifiedUntilNetworkI assertThat(exportState.getExportedResource(0)).isNull(); assertThat(exportState.getExportedResource(1)).isEqualTo(A); assertThat(exportState.getExportedAmount(1)).isEqualTo(2); - assertThat(storageChannel.getAll()) + assertThat(storage.getAll()) .usingRecursiveFieldByFieldElementComparator() .containsExactlyInAnyOrder( new ResourceAmount(A, 1), @@ -373,7 +373,7 @@ void shouldReturnResourceToNetworkAndExportOtherResourceIfSpecifiedUntilNetworkI assertThat(exportState.getExportedResource(0)).isNull(); assertThat(exportState.getExportedResource(1)).isEqualTo(A); assertThat(exportState.getExportedAmount(1)).isEqualTo(2); - assertThat(storageChannel.getAll()) + assertThat(storage.getAll()) .usingRecursiveFieldByFieldElementComparator() .containsExactlyInAnyOrder( new ResourceAmount(A, 1), diff --git a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/iface/externalstorage/InterfaceExternalStorageProviderImplTest.java b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/iface/externalstorage/InterfaceExternalStorageProviderImplTest.java index 3c4425d8e..efe2a893b 100644 --- a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/iface/externalstorage/InterfaceExternalStorageProviderImplTest.java +++ b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/iface/externalstorage/InterfaceExternalStorageProviderImplTest.java @@ -5,11 +5,11 @@ import com.refinedmods.refinedstorage2.api.network.impl.node.externalstorage.ExternalStorageProviderFactoryImpl; import com.refinedmods.refinedstorage2.api.network.impl.node.iface.InterfaceExportStateImpl; import com.refinedmods.refinedstorage2.api.network.impl.node.iface.InterfaceNetworkNode; +import com.refinedmods.refinedstorage2.api.network.storage.StorageNetworkComponent; import com.refinedmods.refinedstorage2.api.resource.ResourceAmount; import com.refinedmods.refinedstorage2.api.storage.EmptyActor; -import com.refinedmods.refinedstorage2.api.storage.channel.StorageChannel; import com.refinedmods.refinedstorage2.network.test.AddNetworkNode; -import com.refinedmods.refinedstorage2.network.test.InjectNetworkStorageChannel; +import com.refinedmods.refinedstorage2.network.test.InjectNetworkStorageComponent; import com.refinedmods.refinedstorage2.network.test.NetworkTest; import com.refinedmods.refinedstorage2.network.test.SetupNetwork; @@ -18,8 +18,8 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.EnumSource; -import static com.refinedmods.refinedstorage2.network.test.TestResource.A; -import static com.refinedmods.refinedstorage2.network.test.TestResource.B; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.A; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.B; import static org.assertj.core.api.Assertions.assertThat; @NetworkTest @@ -42,7 +42,7 @@ void setUp() { @Test void shouldExposeExportedResources( - @InjectNetworkStorageChannel final StorageChannel networkStorage + @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange exportState.setCurrentlyExported(0, A, 100); @@ -56,14 +56,14 @@ void shouldExposeExportedResources( externalStorage.detectChanges(); // Assert - assertThat(networkStorage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( + assertThat(storage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( new ResourceAmount(A, 101) ); } @Test void shouldNotExposeExportedResourceWithoutExportState( - @InjectNetworkStorageChannel final StorageChannel networkStorage + @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange externalStorage.initialize(new ExternalStorageProviderFactoryImpl(new InterfaceExternalStorageProviderImpl( @@ -74,14 +74,14 @@ void shouldNotExposeExportedResourceWithoutExportState( externalStorage.detectChanges(); // Assert - assertThat(networkStorage.getAll()).isEmpty(); + assertThat(storage.getAll()).isEmpty(); } @ParameterizedTest @EnumSource(Action.class) void shouldInsertIntoInterface( final Action action, - @InjectNetworkStorageChannel final StorageChannel networkStorage + @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange externalStorage.initialize(new ExternalStorageProviderFactoryImpl(new InterfaceExternalStorageProviderImpl( @@ -89,18 +89,18 @@ void shouldInsertIntoInterface( ))); // Act - final long inserted = networkStorage.insert(A, 10, action, EmptyActor.INSTANCE); + final long inserted = storage.insert(A, 10, action, EmptyActor.INSTANCE); // Assert assertThat(inserted).isEqualTo(10); if (action == Action.EXECUTE) { - assertThat(networkStorage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( + assertThat(storage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( new ResourceAmount(A, 10) ); assertThat(exportState.getExportedResource(0)).isEqualTo(A); assertThat(exportState.getExportedAmount(0)).isEqualTo(10); } else { - assertThat(networkStorage.getAll()).isEmpty(); + assertThat(storage.getAll()).isEmpty(); assertThat(exportState.getExportedResource(0)).isNull(); assertThat(exportState.getExportedAmount(0)).isZero(); } @@ -110,7 +110,7 @@ void shouldInsertIntoInterface( @EnumSource(Action.class) void shouldNotInsertResourceWithoutExportState( final Action action, - @InjectNetworkStorageChannel final StorageChannel networkStorage + @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange externalStorage.initialize(new ExternalStorageProviderFactoryImpl(new InterfaceExternalStorageProviderImpl( @@ -119,18 +119,18 @@ void shouldNotInsertResourceWithoutExportState( externalStorage.detectChanges(); // Act - final long inserted = networkStorage.insert(A, 101, action, EmptyActor.INSTANCE); + final long inserted = storage.insert(A, 101, action, EmptyActor.INSTANCE); // Assert assertThat(inserted).isZero(); - assertThat(networkStorage.getAll()).isEmpty(); + assertThat(storage.getAll()).isEmpty(); } @ParameterizedTest @EnumSource(Action.class) void shouldExtractEntireResourceFromInterface( final Action action, - @InjectNetworkStorageChannel final StorageChannel networkStorage + @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange exportState.setCurrentlyExported(0, A, 50); @@ -141,18 +141,18 @@ void shouldExtractEntireResourceFromInterface( externalStorage.detectChanges(); // Act - final long extracted = networkStorage.extract(A, 101, action, EmptyActor.INSTANCE); + final long extracted = storage.extract(A, 101, action, EmptyActor.INSTANCE); // Assert assertThat(extracted).isEqualTo(100); if (action == Action.EXECUTE) { - assertThat(networkStorage.getAll()).isEmpty(); + assertThat(storage.getAll()).isEmpty(); assertThat(exportState.getExportedResource(0)).isNull(); assertThat(exportState.getExportedAmount(0)).isZero(); assertThat(exportState.getExportedResource(1)).isNull(); assertThat(exportState.getExportedAmount(1)).isZero(); } else { - assertThat(networkStorage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( + assertThat(storage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( new ResourceAmount(A, 100) ); assertThat(exportState.getExportedResource(0)).isEqualTo(A); @@ -166,7 +166,7 @@ void shouldExtractEntireResourceFromInterface( @EnumSource(Action.class) void shouldExtractPartialResourceFromInterface( final Action action, - @InjectNetworkStorageChannel final StorageChannel networkStorage + @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange exportState.setCurrentlyExported(0, A, 50); @@ -177,12 +177,12 @@ void shouldExtractPartialResourceFromInterface( externalStorage.detectChanges(); // Act - final long extracted = networkStorage.extract(A, 51, action, EmptyActor.INSTANCE); + final long extracted = storage.extract(A, 51, action, EmptyActor.INSTANCE); // Assert assertThat(extracted).isEqualTo(51); if (action == Action.EXECUTE) { - assertThat(networkStorage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( + assertThat(storage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( new ResourceAmount(A, 49) ); assertThat(exportState.getExportedResource(0)).isNull(); @@ -190,7 +190,7 @@ void shouldExtractPartialResourceFromInterface( assertThat(exportState.getExportedResource(1)).isEqualTo(A); assertThat(exportState.getExportedAmount(1)).isEqualTo(49); } else { - assertThat(networkStorage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( + assertThat(storage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( new ResourceAmount(A, 100) ); assertThat(exportState.getExportedResource(0)).isEqualTo(A); @@ -204,7 +204,7 @@ void shouldExtractPartialResourceFromInterface( @EnumSource(Action.class) void shouldNotExtractNonExistentResourceFromInterface( final Action action, - @InjectNetworkStorageChannel final StorageChannel networkStorage + @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange exportState.setCurrentlyExported(0, A, 50); @@ -214,11 +214,11 @@ void shouldNotExtractNonExistentResourceFromInterface( externalStorage.detectChanges(); // Act - final long extracted = networkStorage.extract(B, 1, action, EmptyActor.INSTANCE); + final long extracted = storage.extract(B, 1, action, EmptyActor.INSTANCE); // Assert assertThat(extracted).isZero(); - assertThat(networkStorage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( + assertThat(storage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( new ResourceAmount(A, 50) ); assertThat(exportState.getExportedResource(0)).isEqualTo(A); @@ -229,7 +229,7 @@ void shouldNotExtractNonExistentResourceFromInterface( @EnumSource(Action.class) void shouldNotExtractResourceWithoutExportState( final Action action, - @InjectNetworkStorageChannel final StorageChannel networkStorage + @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange externalStorage.initialize(new ExternalStorageProviderFactoryImpl(new InterfaceExternalStorageProviderImpl( @@ -238,10 +238,10 @@ void shouldNotExtractResourceWithoutExportState( externalStorage.detectChanges(); // Act - final long extracted = networkStorage.extract(A, 101, action, EmptyActor.INSTANCE); + final long extracted = storage.extract(A, 101, action, EmptyActor.INSTANCE); // Assert assertThat(extracted).isZero(); - assertThat(networkStorage.getAll()).isEmpty(); + assertThat(storage.getAll()).isEmpty(); } } diff --git a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/iface/externalstorage/IoLoopInterfaceExternalStorageProviderImplTest.java b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/iface/externalstorage/IoLoopInterfaceExternalStorageProviderImplTest.java index ace9aaf46..10fca42e2 100644 --- a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/iface/externalstorage/IoLoopInterfaceExternalStorageProviderImplTest.java +++ b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/iface/externalstorage/IoLoopInterfaceExternalStorageProviderImplTest.java @@ -7,21 +7,21 @@ import com.refinedmods.refinedstorage2.api.network.impl.node.externalstorage.StorageExternalStorageProvider; import com.refinedmods.refinedstorage2.api.network.impl.node.iface.InterfaceExportStateImpl; import com.refinedmods.refinedstorage2.api.network.impl.node.iface.InterfaceNetworkNode; +import com.refinedmods.refinedstorage2.api.network.storage.StorageNetworkComponent; import com.refinedmods.refinedstorage2.api.resource.ResourceAmount; import com.refinedmods.refinedstorage2.api.storage.EmptyActor; import com.refinedmods.refinedstorage2.api.storage.InMemoryStorageImpl; import com.refinedmods.refinedstorage2.api.storage.Storage; -import com.refinedmods.refinedstorage2.api.storage.channel.StorageChannel; import com.refinedmods.refinedstorage2.network.test.AddNetworkNode; import com.refinedmods.refinedstorage2.network.test.InjectNetwork; -import com.refinedmods.refinedstorage2.network.test.InjectNetworkStorageChannel; +import com.refinedmods.refinedstorage2.network.test.InjectNetworkStorageComponent; import com.refinedmods.refinedstorage2.network.test.NetworkTest; import com.refinedmods.refinedstorage2.network.test.SetupNetwork; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static com.refinedmods.refinedstorage2.network.test.TestResource.A; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.A; import static org.assertj.core.api.Assertions.assertThat; @NetworkTest @@ -54,7 +54,7 @@ class IoLoopInterfaceExternalStorageProviderImplTest { ExternalStorageNetworkNode externalStorageWithNonInterfaceConnection; @BeforeEach - void setUp(@InjectNetworkStorageChannel final StorageChannel networkStorage) { + void setUp(@InjectNetworkStorageComponent final StorageNetworkComponent networkStorage) { interfaceWithExternalStorageState = new InterfaceExportStateImpl(2); interfaceWithExternalStorageState.setRequestedResource(1, A, 10); interfaceWithExternalStorage.setExportState(interfaceWithExternalStorageState); @@ -92,7 +92,7 @@ void setUp(@InjectNetworkStorageChannel final StorageChannel networkStorage) { // and would double count them because the External Storage update is later. @Test void shouldNotAllowInsertionByAnotherInterfaceIfThatInterfaceIsActingAsExternalStorage( - @InjectNetworkStorageChannel final StorageChannel networkStorage, + @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage, @InjectNetwork final Network network ) { // Arrange @@ -121,7 +121,7 @@ void shouldNotAllowInsertionByAnotherInterfaceIfThatInterfaceIsActingAsExternalS @Test void shouldAllowInsertionByAnotherInterfaceIfThatInterfaceIsNotActingAsExternalStorage( - @InjectNetworkStorageChannel final StorageChannel networkStorage, + @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage, @InjectNetwork final Network network ) { // Arrange @@ -155,7 +155,7 @@ void shouldAllowInsertionByAnotherInterfaceIfThatInterfaceIsNotActingAsExternalS // isn't allowed as it would create an extraction loop causing the Interfaces to constantly steal from each other. @Test void shouldNotAllowExtractionRequestedByAnotherInterfaceIfThatInterfaceIsActingAsExternalStorage( - @InjectNetworkStorageChannel final StorageChannel networkStorage + @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage ) { // Act & assert interfaceWithExternalStorage.doWork(); @@ -193,7 +193,7 @@ void shouldNotAllowExtractionRequestedByAnotherInterfaceIfThatInterfaceIsActingA @Test void shouldAllowExtractionRequestedByAnotherInterfaceIfThatInterfaceIsNotActingAsExternalStorage( - @InjectNetworkStorageChannel final StorageChannel networkStorage + @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage ) { // Act & assert interfaceWithExternalStorage.doWork(); diff --git a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/iface/externalstorage/SelfIoInterfaceExternalStorageProviderImplTest.java b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/iface/externalstorage/SelfIoInterfaceExternalStorageProviderImplTest.java index 1c73869e7..12e5d5f7e 100644 --- a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/iface/externalstorage/SelfIoInterfaceExternalStorageProviderImplTest.java +++ b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/iface/externalstorage/SelfIoInterfaceExternalStorageProviderImplTest.java @@ -4,17 +4,17 @@ import com.refinedmods.refinedstorage2.api.network.impl.node.externalstorage.ExternalStorageProviderFactoryImpl; import com.refinedmods.refinedstorage2.api.network.impl.node.iface.InterfaceExportStateImpl; import com.refinedmods.refinedstorage2.api.network.impl.node.iface.InterfaceNetworkNode; +import com.refinedmods.refinedstorage2.api.network.storage.StorageNetworkComponent; import com.refinedmods.refinedstorage2.api.resource.ResourceAmount; -import com.refinedmods.refinedstorage2.api.storage.channel.StorageChannel; import com.refinedmods.refinedstorage2.network.test.AddNetworkNode; -import com.refinedmods.refinedstorage2.network.test.InjectNetworkStorageChannel; +import com.refinedmods.refinedstorage2.network.test.InjectNetworkStorageComponent; import com.refinedmods.refinedstorage2.network.test.NetworkTest; import com.refinedmods.refinedstorage2.network.test.SetupNetwork; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static com.refinedmods.refinedstorage2.network.test.TestResource.B; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.B; import static org.assertj.core.api.Assertions.assertThat; @NetworkTest @@ -38,7 +38,7 @@ void setUp() { // IoLoopInterfaceExternalStorageProviderImplTest. @Test void shouldNotAllowSelfInsertionOrSelfExtraction( - @InjectNetworkStorageChannel final StorageChannel networkStorage + @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage ) { // Arrange // this would try to do a self-insert as it's an unwanted resource. diff --git a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/importer/ImporterNetworkNodeTest.java b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/importer/ImporterNetworkNodeTest.java index 03e491b57..d01189c90 100644 --- a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/importer/ImporterNetworkNodeTest.java +++ b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/importer/ImporterNetworkNodeTest.java @@ -3,17 +3,17 @@ import com.refinedmods.refinedstorage2.api.core.Action; import com.refinedmods.refinedstorage2.api.network.energy.EnergyNetworkComponent; import com.refinedmods.refinedstorage2.api.network.node.importer.ImporterTransferStrategy; +import com.refinedmods.refinedstorage2.api.network.storage.StorageNetworkComponent; import com.refinedmods.refinedstorage2.api.resource.ResourceAmount; import com.refinedmods.refinedstorage2.api.resource.ResourceKey; import com.refinedmods.refinedstorage2.api.resource.filter.FilterMode; import com.refinedmods.refinedstorage2.api.storage.Actor; import com.refinedmods.refinedstorage2.api.storage.EmptyActor; import com.refinedmods.refinedstorage2.api.storage.InMemoryStorageImpl; -import com.refinedmods.refinedstorage2.api.storage.channel.StorageChannel; import com.refinedmods.refinedstorage2.api.storage.limited.LimitedStorageImpl; import com.refinedmods.refinedstorage2.network.test.AddNetworkNode; import com.refinedmods.refinedstorage2.network.test.InjectNetworkEnergyComponent; -import com.refinedmods.refinedstorage2.network.test.InjectNetworkStorageChannel; +import com.refinedmods.refinedstorage2.network.test.InjectNetworkStorageComponent; import com.refinedmods.refinedstorage2.network.test.NetworkTest; import com.refinedmods.refinedstorage2.network.test.SetupNetwork; @@ -23,11 +23,11 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static com.refinedmods.refinedstorage2.network.test.TestResource.A; -import static com.refinedmods.refinedstorage2.network.test.TestResource.A_ALTERNATIVE; -import static com.refinedmods.refinedstorage2.network.test.TestResource.A_ALTERNATIVE2; -import static com.refinedmods.refinedstorage2.network.test.TestResource.B; -import static com.refinedmods.refinedstorage2.network.test.TestResource.C; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.A; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.A_ALTERNATIVE; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.A_ALTERNATIVE2; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.B; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.C; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; @@ -65,14 +65,14 @@ void shouldExtractEnergy( @Test void shouldNotWorkWithoutAnyTransferStrategy( - @InjectNetworkStorageChannel final StorageChannel storageChannel, + @InjectNetworkStorageComponent final StorageNetworkComponent storage, @InjectNetworkEnergyComponent final EnergyNetworkComponent energy ) { // Act sut.doWork(); // Assert - assertThat(storageChannel.getAll()).isEmpty(); + assertThat(storage.getAll()).isEmpty(); assertThat(energy.getStored()).isEqualTo(1000 - 5); } @@ -85,11 +85,11 @@ void shouldNotWorkWithoutNetwork() { @Test void shouldNotWorkOrExtractEnergyWithoutBeingActive( - @InjectNetworkStorageChannel final StorageChannel storageChannel, + @InjectNetworkStorageComponent final StorageNetworkComponent storage, @InjectNetworkEnergyComponent final EnergyNetworkComponent energy ) { // Arrange - storageChannel.addSource(new InMemoryStorageImpl()); + storage.addSource(new InMemoryStorageImpl()); final FakeImporterSource source = new FakeImporterSource(A, B) .add(A, 100) @@ -102,7 +102,7 @@ void shouldNotWorkOrExtractEnergyWithoutBeingActive( sut.doWork(); // Assert - assertThat(storageChannel.getAll()).isEmpty(); + assertThat(storage.getAll()).isEmpty(); assertThat(source.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( new ResourceAmount(A, 100), new ResourceAmount(B, 100) @@ -111,9 +111,9 @@ void shouldNotWorkOrExtractEnergyWithoutBeingActive( } @Test - void testTransfer(@InjectNetworkStorageChannel final StorageChannel storageChannel) { + void testTransfer(@InjectNetworkStorageComponent final StorageNetworkComponent storage) { // Arrange - storageChannel.addSource(new InMemoryStorageImpl()); + storage.addSource(new InMemoryStorageImpl()); final FakeImporterSource source = new FakeImporterSource(A, B, A) .add(A, 100) @@ -125,7 +125,7 @@ void testTransfer(@InjectNetworkStorageChannel final StorageChannel storageChann sut.doWork(); // Assert - assertThat(storageChannel.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( + assertThat(storage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( new ResourceAmount(A, 1) ); assertThat(source.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( @@ -136,10 +136,10 @@ void testTransfer(@InjectNetworkStorageChannel final StorageChannel storageChann @Test void shouldUseFirstSuccessfulTransferStrategy( - @InjectNetworkStorageChannel final StorageChannel storageChannel + @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storageChannel.addSource(new InMemoryStorageImpl()); + storage.addSource(new InMemoryStorageImpl()); final FakeImporterSource emptySource = new FakeImporterSource(); final FakeImporterSource outdatedSource = new FakeImporterSource(C) @@ -161,7 +161,7 @@ void shouldUseFirstSuccessfulTransferStrategy( sut.doWork(); // Assert - assertThat(storageChannel.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( + assertThat(storage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( new ResourceAmount(A, 1) ); assertThat(source.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( @@ -172,11 +172,11 @@ void shouldUseFirstSuccessfulTransferStrategy( @Test void shouldNotTransferIfThereIsNoSpaceInTheNetwork( - @InjectNetworkStorageChannel final StorageChannel storageChannel + @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storageChannel.addSource(new LimitedStorageImpl(100)); - storageChannel.insert(C, 100, Action.EXECUTE, EmptyActor.INSTANCE); + storage.addSource(new LimitedStorageImpl(100)); + storage.insert(C, 100, Action.EXECUTE, EmptyActor.INSTANCE); final FakeImporterSource source = new FakeImporterSource(A, B) .add(A, 100) @@ -188,7 +188,7 @@ void shouldNotTransferIfThereIsNoSpaceInTheNetwork( sut.doWork(); // Assert - assertThat(storageChannel.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( + assertThat(storage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( new ResourceAmount(C, 100) ); assertThat(source.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( @@ -199,10 +199,10 @@ void shouldNotTransferIfThereIsNoSpaceInTheNetwork( @Test void testTransferDifferentResourceOverMultipleSlots( - @InjectNetworkStorageChannel final StorageChannel storageChannel + @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storageChannel.addSource(new InMemoryStorageImpl()); + storage.addSource(new InMemoryStorageImpl()); final FakeImporterSource source = new FakeImporterSource(A, B, A, B) .add(A, 11) @@ -214,7 +214,7 @@ void testTransferDifferentResourceOverMultipleSlots( sut.doWork(); // Assert - assertThat(storageChannel.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( + assertThat(storage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( new ResourceAmount(A, 10) ); assertThat(source.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( @@ -225,10 +225,10 @@ void testTransferDifferentResourceOverMultipleSlots( @Test void testTransferSameResourceOverMultipleSlots( - @InjectNetworkStorageChannel final StorageChannel storageChannel + @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storageChannel.addSource(new InMemoryStorageImpl()); + storage.addSource(new InMemoryStorageImpl()); final FakeImporterSource source = new FakeImporterSource(A, A, A, B) .add(A, 20) @@ -241,7 +241,7 @@ void testTransferSameResourceOverMultipleSlots( sut.doWork(); // Assert - assertThat(storageChannel.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( + assertThat(storage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( new ResourceAmount(A, 10) ); assertThat(source.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( @@ -252,10 +252,10 @@ void testTransferSameResourceOverMultipleSlots( @Test void testTransferWhereResourceIsNotAccepted( - @InjectNetworkStorageChannel final StorageChannel storageChannel + @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storageChannel.addSource(new InMemoryStorageImpl() { + storage.addSource(new InMemoryStorageImpl() { @Override public long insert(final ResourceKey resource, final long amount, final Action action, final Actor actor) { if (A.equals(resource)) { @@ -275,7 +275,7 @@ public long insert(final ResourceKey resource, final long amount, final Action a sut.doWork(); // Assert - assertThat(storageChannel.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( + assertThat(storage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( new ResourceAmount(B, 10) ); assertThat(source.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( @@ -286,10 +286,10 @@ public long insert(final ResourceKey resource, final long amount, final Action a @Test void testTransferWithoutAnyResourcesInSource( - @InjectNetworkStorageChannel final StorageChannel storageChannel + @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange - storageChannel.addSource(new InMemoryStorageImpl()); + storage.addSource(new InMemoryStorageImpl()); final FakeImporterSource source = new FakeImporterSource(); final ImporterTransferStrategy strategy = new ImporterTransferStrategyImpl(source, 10); @@ -299,17 +299,17 @@ void testTransferWithoutAnyResourcesInSource( sut.doWork(); // Assert - assertThat(storageChannel.getAll()).usingRecursiveFieldByFieldElementComparator().isEmpty(); + assertThat(storage.getAll()).usingRecursiveFieldByFieldElementComparator().isEmpty(); assertThat(source.getAll()).isEmpty(); } @Test - void shouldRespectAllowlist(@InjectNetworkStorageChannel final StorageChannel storageChannel) { + void shouldRespectAllowlist(@InjectNetworkStorageComponent final StorageNetworkComponent storage) { // Arrange sut.setFilterMode(FilterMode.ALLOW); sut.setFilters(Set.of(A)); - storageChannel.addSource(new InMemoryStorageImpl()); + storage.addSource(new InMemoryStorageImpl()); final FakeImporterSource source = new FakeImporterSource(B, A) .add(B, 10) @@ -322,7 +322,7 @@ void shouldRespectAllowlist(@InjectNetworkStorageChannel final StorageChannel st sut.doWork(); // Assert - assertThat(storageChannel.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( + assertThat(storage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( new ResourceAmount(A, 1) ); assertThat(source.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( @@ -333,7 +333,7 @@ void shouldRespectAllowlist(@InjectNetworkStorageChannel final StorageChannel st @Test void shouldRespectAllowlistWithNormalizer( - @InjectNetworkStorageChannel final StorageChannel storageChannel + @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange sut.setFilterMode(FilterMode.ALLOW); @@ -345,7 +345,7 @@ void shouldRespectAllowlistWithNormalizer( return resource; }); - storageChannel.addSource(new InMemoryStorageImpl()); + storage.addSource(new InMemoryStorageImpl()); final FakeImporterSource source = new FakeImporterSource(B, A_ALTERNATIVE, A_ALTERNATIVE2) .add(B, 10) @@ -360,7 +360,7 @@ void shouldRespectAllowlistWithNormalizer( sut.doWork(); // Assert - assertThat(storageChannel.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( + assertThat(storage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( new ResourceAmount(A_ALTERNATIVE, 1), new ResourceAmount(A_ALTERNATIVE2, 1) ); @@ -371,13 +371,13 @@ void shouldRespectAllowlistWithNormalizer( @Test void shouldRespectAllowlistWithoutAlternative( - @InjectNetworkStorageChannel final StorageChannel storageChannel + @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange sut.setFilterMode(FilterMode.ALLOW); sut.setFilters(Set.of(A)); - storageChannel.addSource(new InMemoryStorageImpl()); + storage.addSource(new InMemoryStorageImpl()); final FakeImporterSource source = new FakeImporterSource(B) .add(B, 10); @@ -389,19 +389,19 @@ void shouldRespectAllowlistWithoutAlternative( sut.doWork(); // Assert - assertThat(storageChannel.getAll()).isEmpty(); + assertThat(storage.getAll()).isEmpty(); assertThat(source.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( new ResourceAmount(B, 10) ); } @Test - void shouldRespectEmptyAllowlist(@InjectNetworkStorageChannel final StorageChannel storageChannel) { + void shouldRespectEmptyAllowlist(@InjectNetworkStorageComponent final StorageNetworkComponent storage) { // Arrange sut.setFilterMode(FilterMode.ALLOW); sut.setFilters(Set.of()); - storageChannel.addSource(new InMemoryStorageImpl()); + storage.addSource(new InMemoryStorageImpl()); final FakeImporterSource source = new FakeImporterSource(B, A) .add(B, 10) @@ -414,7 +414,7 @@ void shouldRespectEmptyAllowlist(@InjectNetworkStorageChannel final StorageChann sut.doWork(); // Assert - assertThat(storageChannel.getAll()).isEmpty(); + assertThat(storage.getAll()).isEmpty(); assertThat(source.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( new ResourceAmount(B, 10), new ResourceAmount(A, 10) @@ -422,12 +422,12 @@ void shouldRespectEmptyAllowlist(@InjectNetworkStorageChannel final StorageChann } @Test - void shouldRespectBlocklist(@InjectNetworkStorageChannel final StorageChannel storageChannel) { + void shouldRespectBlocklist(@InjectNetworkStorageComponent final StorageNetworkComponent storage) { // Arrange sut.setFilterMode(FilterMode.BLOCK); sut.setFilters(Set.of(A)); - storageChannel.addSource(new InMemoryStorageImpl()); + storage.addSource(new InMemoryStorageImpl()); final FakeImporterSource source = new FakeImporterSource(A, B) .add(A, 10) @@ -440,7 +440,7 @@ void shouldRespectBlocklist(@InjectNetworkStorageChannel final StorageChannel st sut.doWork(); // Assert - assertThat(storageChannel.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( + assertThat(storage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( new ResourceAmount(B, 1) ); assertThat(source.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( @@ -451,13 +451,13 @@ void shouldRespectBlocklist(@InjectNetworkStorageChannel final StorageChannel st @Test void shouldRespectBlocklistWithoutAlternative( - @InjectNetworkStorageChannel final StorageChannel storageChannel + @InjectNetworkStorageComponent final StorageNetworkComponent storage ) { // Arrange sut.setFilterMode(FilterMode.BLOCK); sut.setFilters(Set.of(A)); - storageChannel.addSource(new InMemoryStorageImpl()); + storage.addSource(new InMemoryStorageImpl()); final FakeImporterSource source = new FakeImporterSource(A) .add(A, 10); @@ -469,19 +469,19 @@ void shouldRespectBlocklistWithoutAlternative( sut.doWork(); // Assert - assertThat(storageChannel.getAll()).isEmpty(); + assertThat(storage.getAll()).isEmpty(); assertThat(source.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( new ResourceAmount(A, 10) ); } @Test - void shouldRespectEmptyBlocklist(@InjectNetworkStorageChannel final StorageChannel storageChannel) { + void shouldRespectEmptyBlocklist(@InjectNetworkStorageComponent final StorageNetworkComponent storage) { // Arrange sut.setFilterMode(FilterMode.BLOCK); sut.setFilters(Set.of()); - storageChannel.addSource(new InMemoryStorageImpl()); + storage.addSource(new InMemoryStorageImpl()); final FakeImporterSource source = new FakeImporterSource(A, B) .add(A, 10) @@ -494,7 +494,7 @@ void shouldRespectEmptyBlocklist(@InjectNetworkStorageChannel final StorageChann sut.doWork(); // Assert - assertThat(storageChannel.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( + assertThat(storage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( new ResourceAmount(A, 1) ); assertThat(source.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( diff --git a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/multistorage/MultiStorageNetworkNodeTest.java b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/multistorage/MultiStorageNetworkNodeTest.java index 058500dea..3c696ab91 100644 --- a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/multistorage/MultiStorageNetworkNodeTest.java +++ b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/multistorage/MultiStorageNetworkNodeTest.java @@ -2,6 +2,7 @@ import com.refinedmods.refinedstorage2.api.core.Action; import com.refinedmods.refinedstorage2.api.network.Network; +import com.refinedmods.refinedstorage2.api.network.storage.StorageNetworkComponent; import com.refinedmods.refinedstorage2.api.resource.ResourceAmount; import com.refinedmods.refinedstorage2.api.resource.filter.FilterMode; import com.refinedmods.refinedstorage2.api.storage.AccessMode; @@ -10,15 +11,14 @@ import com.refinedmods.refinedstorage2.api.storage.StateTrackedStorage; import com.refinedmods.refinedstorage2.api.storage.Storage; import com.refinedmods.refinedstorage2.api.storage.StorageState; -import com.refinedmods.refinedstorage2.api.storage.channel.StorageChannel; import com.refinedmods.refinedstorage2.api.storage.limited.LimitedStorageImpl; import com.refinedmods.refinedstorage2.api.storage.tracked.TrackedStorageImpl; import com.refinedmods.refinedstorage2.network.test.AddNetworkNode; import com.refinedmods.refinedstorage2.network.test.InjectNetwork; -import com.refinedmods.refinedstorage2.network.test.InjectNetworkStorageChannel; +import com.refinedmods.refinedstorage2.network.test.InjectNetworkStorageComponent; import com.refinedmods.refinedstorage2.network.test.NetworkTest; import com.refinedmods.refinedstorage2.network.test.SetupNetwork; -import com.refinedmods.refinedstorage2.network.test.util.FakeActor; +import com.refinedmods.refinedstorage2.network.test.fake.FakeActor; import java.util.Collection; import java.util.HashSet; @@ -30,12 +30,12 @@ import org.junit.jupiter.params.provider.EnumSource; import org.junit.jupiter.params.provider.ValueSource; -import static com.refinedmods.refinedstorage2.network.test.TestResource.A; -import static com.refinedmods.refinedstorage2.network.test.TestResource.A_ALTERNATIVE; -import static com.refinedmods.refinedstorage2.network.test.TestResource.A_ALTERNATIVE2; -import static com.refinedmods.refinedstorage2.network.test.TestResource.B; -import static com.refinedmods.refinedstorage2.network.test.TestResource.B_ALTERNATIVE; -import static com.refinedmods.refinedstorage2.network.test.TestResource.C; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.A; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.A_ALTERNATIVE; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.A_ALTERNATIVE2; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.B; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.B_ALTERNATIVE; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.C; import static com.refinedmods.refinedstorage2.network.test.nodefactory.AbstractNetworkNodeFactory.PROPERTY_ENERGY_USAGE; import static com.refinedmods.refinedstorage2.network.test.nodefactory.MultiStorageNetworkNodeFactory.PROPERTY_ENERGY_USAGE_PER_STORAGE; import static org.assertj.core.api.Assertions.assertThat; @@ -64,7 +64,7 @@ void setUp() { @Test void shouldInitializeButNotShowResourcesYet( - @InjectNetworkStorageChannel final StorageChannel networkStorage + @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage ) { // Arrange final Storage storage = new LimitedStorageImpl(10); @@ -82,7 +82,7 @@ void shouldInitializeButNotShowResourcesYet( @Test void shouldInitializeAndShowResourcesAfterEnabling( - @InjectNetworkStorageChannel final StorageChannel networkStorage + @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage ) { // Arrange final Storage storage = new LimitedStorageImpl(100); @@ -103,7 +103,7 @@ void shouldInitializeAndShowResourcesAfterEnabling( @Test void shouldInitializeMultipleTimes( - @InjectNetworkStorageChannel final StorageChannel networkStorage + @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage ) { // Arrange final Storage storage1 = new LimitedStorageImpl(10); @@ -127,7 +127,7 @@ void shouldInitializeMultipleTimes( } @Test - void testInitialState(@InjectNetworkStorageChannel final StorageChannel networkStorage) { + void testInitialState(@InjectNetworkStorageComponent final StorageNetworkComponent networkStorage) { // Assert assertThat(sut.getEnergyUsage()).isEqualTo(BASE_USAGE); assertThat(sut.getFilterMode()).isEqualTo(FilterMode.BLOCK); @@ -176,7 +176,7 @@ void testState(final boolean active) { } @Test - void shouldDetectNewStorage(@InjectNetworkStorageChannel final StorageChannel networkStorage) { + void shouldDetectNewStorage(@InjectNetworkStorageComponent final StorageNetworkComponent networkStorage) { // Arrange initializeAndActivate(); @@ -195,7 +195,7 @@ void shouldDetectNewStorage(@InjectNetworkStorageChannel final StorageChannel ne } @Test - void shouldDetectChangedStorage(@InjectNetworkStorageChannel final StorageChannel networkStorage) { + void shouldDetectChangedStorage(@InjectNetworkStorageComponent final StorageNetworkComponent networkStorage) { // Arrange final Storage originalStorage = new LimitedStorageImpl(10); originalStorage.insert(A, 5, Action.EXECUTE, EmptyActor.INSTANCE); @@ -223,7 +223,7 @@ void shouldDetectChangedStorage(@InjectNetworkStorageChannel final StorageChanne } @Test - void shouldDetectRemovedStorage(@InjectNetworkStorageChannel final StorageChannel networkStorage) { + void shouldDetectRemovedStorage(@InjectNetworkStorageComponent final StorageNetworkComponent networkStorage) { // Arrange final Storage storage = new LimitedStorageImpl(10); storage.insert(A, 5, Action.EXECUTE, EmptyActor.INSTANCE); @@ -259,7 +259,7 @@ void shouldNotDetectStorageChangeInInvalidIndex() { @Test void shouldNotUpdateNetworkStorageWhenChangingStorageWhenInactive( - @InjectNetworkStorageChannel final StorageChannel networkStorage + @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage ) { // Arrange final Storage storage = new LimitedStorageImpl(100); @@ -282,7 +282,7 @@ void shouldNotUpdateNetworkStorageWhenChangingStorageWhenInactive( @Test void shouldHaveResourcesFromStoragePresentInNetwork( - @InjectNetworkStorageChannel final StorageChannel networkStorage + @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage ) { // Arrange final Storage storage = new LimitedStorageImpl(100); @@ -305,7 +305,7 @@ void shouldHaveResourcesFromStoragePresentInNetwork( } @Test - void shouldInsert(@InjectNetworkStorageChannel final StorageChannel networkStorage) { + void shouldInsert(@InjectNetworkStorageComponent final StorageNetworkComponent networkStorage) { // Arrange final Storage storage1 = new LimitedStorageImpl(100); provider.set(1, storage1); @@ -347,7 +347,7 @@ void shouldInsert(@InjectNetworkStorageChannel final StorageChannel networkStora } @Test - void shouldExtract(@InjectNetworkStorageChannel final StorageChannel networkStorage) { + void shouldExtract(@InjectNetworkStorageComponent final StorageNetworkComponent networkStorage) { // Arrange final Storage storage1 = new LimitedStorageImpl(100); storage1.insert(A, 50, Action.EXECUTE, EmptyActor.INSTANCE); @@ -392,7 +392,7 @@ void shouldExtract(@InjectNetworkStorageChannel final StorageChannel networkStor @Test void shouldRespectAllowlistWhenInserting( - @InjectNetworkStorageChannel final StorageChannel networkStorage + @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage ) { // Arrange sut.setFilterMode(FilterMode.ALLOW); @@ -415,7 +415,7 @@ void shouldRespectAllowlistWhenInserting( @Test void shouldRespectAllowlistWithNormalizerWhenInserting( - @InjectNetworkStorageChannel final StorageChannel networkStorage + @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage ) { // Arrange sut.setFilterMode(FilterMode.ALLOW); @@ -451,7 +451,7 @@ void shouldRespectAllowlistWithNormalizerWhenInserting( @Test void shouldRespectEmptyAllowlistWhenInserting( - @InjectNetworkStorageChannel final StorageChannel networkStorage + @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage ) { // Arrange sut.setFilterMode(FilterMode.ALLOW); @@ -474,7 +474,7 @@ void shouldRespectEmptyAllowlistWhenInserting( @Test void shouldRespectBlocklistWhenInserting( - @InjectNetworkStorageChannel final StorageChannel networkStorage + @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage ) { // Arrange sut.setFilterMode(FilterMode.BLOCK); @@ -497,7 +497,7 @@ void shouldRespectBlocklistWhenInserting( @Test void shouldRespectEmptyBlocklistWhenInserting( - @InjectNetworkStorageChannel final StorageChannel networkStorage + @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage ) { // Arrange sut.setFilterMode(FilterMode.BLOCK); @@ -522,7 +522,7 @@ void shouldRespectEmptyBlocklistWhenInserting( @EnumSource(AccessMode.class) void shouldRespectAccessModeWhenInserting( final AccessMode accessMode, - @InjectNetworkStorageChannel final StorageChannel networkStorage + @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage ) { // Arrange sut.setAccessMode(accessMode); @@ -545,7 +545,7 @@ void shouldRespectAccessModeWhenInserting( @EnumSource(AccessMode.class) void shouldRespectAccessModeWhenExtracting( final AccessMode accessMode, - @InjectNetworkStorageChannel final StorageChannel networkStorage + @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage ) { // Arrange sut.setAccessMode(accessMode); @@ -568,7 +568,7 @@ void shouldRespectAccessModeWhenExtracting( @Test void shouldNotAllowInsertsWhenInactive( - @InjectNetworkStorageChannel final StorageChannel networkStorage + @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage ) { // Arrange final Storage storage = new LimitedStorageImpl(100); @@ -586,7 +586,7 @@ void shouldNotAllowInsertsWhenInactive( @Test void shouldNotAllowExtractsWhenInactive( - @InjectNetworkStorageChannel final StorageChannel networkStorage + @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage ) { // Arrange final Storage storage = new LimitedStorageImpl(100); @@ -605,7 +605,7 @@ void shouldNotAllowExtractsWhenInactive( @Test void shouldHideFromNetworkWhenInactive( - @InjectNetworkStorageChannel final StorageChannel networkStorage + @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage ) { // Arrange final Storage storage = new LimitedStorageImpl(100); @@ -626,7 +626,7 @@ void shouldHideFromNetworkWhenInactive( @Test void shouldNoLongerShowOnNetworkWhenRemoved( - @InjectNetworkStorageChannel final StorageChannel networkStorage, + @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage, @InjectNetwork final Network network ) { // Arrange @@ -658,7 +658,7 @@ void shouldNoLongerShowOnNetworkWhenRemoved( } @Test - void shouldTrackChanges(@InjectNetworkStorageChannel final StorageChannel networkStorage) { + void shouldTrackChanges(@InjectNetworkStorageComponent final StorageNetworkComponent networkStorage) { // Arrange final Storage storage = new TrackedStorageImpl(new LimitedStorageImpl(100), () -> 0L); provider.set(1, storage); @@ -674,7 +674,7 @@ void shouldTrackChanges(@InjectNetworkStorageChannel final StorageChannel networ @Test void shouldNotifyListenerWhenStateChanges( - @InjectNetworkStorageChannel final StorageChannel networkStorage + @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage ) { // Arrange final StateTrackedStorage.Listener listener = mock(StateTrackedStorage.Listener.class); diff --git a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/multistorage/PriorityMultiStorageNetworkNodeTest.java b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/multistorage/PriorityMultiStorageNetworkNodeTest.java index 506be8cb3..baf6d15f1 100644 --- a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/multistorage/PriorityMultiStorageNetworkNodeTest.java +++ b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/multistorage/PriorityMultiStorageNetworkNodeTest.java @@ -1,12 +1,12 @@ package com.refinedmods.refinedstorage2.api.network.impl.node.multistorage; import com.refinedmods.refinedstorage2.api.core.Action; +import com.refinedmods.refinedstorage2.api.network.storage.StorageNetworkComponent; import com.refinedmods.refinedstorage2.api.storage.EmptyActor; import com.refinedmods.refinedstorage2.api.storage.Storage; -import com.refinedmods.refinedstorage2.api.storage.channel.StorageChannel; import com.refinedmods.refinedstorage2.api.storage.limited.LimitedStorageImpl; import com.refinedmods.refinedstorage2.network.test.AddNetworkNode; -import com.refinedmods.refinedstorage2.network.test.InjectNetworkStorageChannel; +import com.refinedmods.refinedstorage2.network.test.InjectNetworkStorageComponent; import com.refinedmods.refinedstorage2.network.test.NetworkTest; import com.refinedmods.refinedstorage2.network.test.SetupNetwork; @@ -14,7 +14,7 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; -import static com.refinedmods.refinedstorage2.network.test.TestResource.A; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.A; import static org.assertj.core.api.Assertions.assertThat; @NetworkTest @@ -37,7 +37,7 @@ void setUp() { @ValueSource(booleans = {true, false}) void shouldRespectPriority( final boolean multiStorageAHasPriority, - @InjectNetworkStorageChannel final StorageChannel networkStorage + @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage ) { // Arrange final Storage storage1 = new LimitedStorageImpl(100); diff --git a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/relay/RelayEnergyNetworkNodeTest.java b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/relay/RelayEnergyNetworkNodeTest.java new file mode 100644 index 000000000..60e88ae80 --- /dev/null +++ b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/relay/RelayEnergyNetworkNodeTest.java @@ -0,0 +1,106 @@ +package com.refinedmods.refinedstorage2.api.network.impl.node.relay; + +import com.refinedmods.refinedstorage2.api.core.Action; +import com.refinedmods.refinedstorage2.api.network.Network; +import com.refinedmods.refinedstorage2.api.network.energy.EnergyNetworkComponent; +import com.refinedmods.refinedstorage2.api.network.security.SecurityNetworkComponent; +import com.refinedmods.refinedstorage2.api.network.storage.StorageNetworkComponent; +import com.refinedmods.refinedstorage2.api.storage.EmptyActor; +import com.refinedmods.refinedstorage2.network.test.AddNetworkNode; +import com.refinedmods.refinedstorage2.network.test.InjectNetwork; +import com.refinedmods.refinedstorage2.network.test.InjectNetworkEnergyComponent; +import com.refinedmods.refinedstorage2.network.test.InjectNetworkSecurityComponent; +import com.refinedmods.refinedstorage2.network.test.InjectNetworkStorageComponent; +import com.refinedmods.refinedstorage2.network.test.NetworkTest; +import com.refinedmods.refinedstorage2.network.test.SetupNetwork; +import com.refinedmods.refinedstorage2.network.test.fake.FakePermissions; +import com.refinedmods.refinedstorage2.network.test.fake.FakeSecurityActors; + +import java.util.Set; + +import org.junit.jupiter.api.Test; + +import static com.refinedmods.refinedstorage2.api.network.impl.node.relay.RelayNetworkNodeTest.addSecurityPolicy; +import static com.refinedmods.refinedstorage2.api.network.impl.node.relay.RelayNetworkNodeTest.addStorageSource; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.A; +import static com.refinedmods.refinedstorage2.network.test.nodefactory.AbstractNetworkNodeFactory.PROPERTY_ACTIVE; +import static org.assertj.core.api.Assertions.assertThat; + +@NetworkTest +@SetupNetwork(id = "input") +@SetupNetwork(id = "output", setupEnergy = false) +class RelayEnergyNetworkNodeTest { + @AddNetworkNode(properties = { + @AddNetworkNode.Property(key = PROPERTY_ACTIVE, boolValue = false) + }, networkId = "input") + private RelayInputNetworkNode input; + + @AddNetworkNode(networkId = "output") + private RelayOutputNetworkNode output; + + @Test + void shouldPassEnergyComponent( + @InjectNetworkEnergyComponent(networkId = "input") final EnergyNetworkComponent inputEnergy, + @InjectNetworkSecurityComponent(networkId = "input") final SecurityNetworkComponent inputSecurity, + @InjectNetworkStorageComponent(networkId = "input") final StorageNetworkComponent inputStorage, + @InjectNetworkEnergyComponent(networkId = "output") final EnergyNetworkComponent outputEnergy, + @InjectNetworkSecurityComponent(networkId = "output") final SecurityNetworkComponent outputSecurity, + @InjectNetworkStorageComponent(networkId = "output") final StorageNetworkComponent outputStorage + ) { + // Arrange + input.setActive(true); + input.setOutputNode(output); + + addSecurityPolicy(inputSecurity, FakePermissions.OTHER); + addStorageSource(inputStorage); + + final long originalStored = inputEnergy.getStored(); + + // Act + input.setComponentTypes(Set.of(RelayComponentType.ENERGY)); + final long extracted = output.extract(10); + + // Assert + assertThat(extracted).isEqualTo(10); + assertThat(outputEnergy.getCapacity()).isEqualTo(inputEnergy.getCapacity()); + assertThat(outputEnergy.getStored()).isEqualTo(originalStored - 10); + assertThat(outputSecurity.isAllowed(FakePermissions.ALLOW_BY_DEFAULT, FakeSecurityActors.A)).isTrue(); + assertThat(outputSecurity.isAllowed(FakePermissions.OTHER, FakeSecurityActors.A)).isFalse(); + assertThat(outputStorage.getAll()).isEmpty(); + assertThat(outputStorage.insert(A, 1, Action.EXECUTE, EmptyActor.INSTANCE)).isZero(); + assertThat(input.hasComponentType(RelayComponentType.ENERGY)).isTrue(); + assertThat(input.hasComponentType(RelayComponentType.SECURITY)).isFalse(); + assertThat(input.hasComponentType(RelayComponentType.STORAGE)).isFalse(); + } + + @Test + @SetupNetwork(id = "cycle_input", energyStored = 1, energyCapacity = 2) + @SetupNetwork(id = "cycle_input_alt", energyStored = 3, energyCapacity = 4) + void shouldDetectEnergyCycles( + @InjectNetwork("cycle_input") final Network inputNetwork, + @InjectNetworkEnergyComponent(networkId = "cycle_input") final EnergyNetworkComponent inputEnergy, + @InjectNetwork("cycle_input_alt") final Network inputAlternativeNetwork, + @InjectNetworkEnergyComponent(networkId = "cycle_input_alt") final EnergyNetworkComponent inputAlternativeEnergy + ) { + // Arrange + final RelayOutputNetworkNode cycleOutput = new RelayOutputNetworkNode(0); + cycleOutput.setEnergyDelegate(inputAlternativeEnergy); + cycleOutput.setNetwork(inputNetwork); + inputNetwork.addContainer(() -> cycleOutput); + + final RelayOutputNetworkNode cycleOutputAlternative = new RelayOutputNetworkNode(0); + cycleOutputAlternative.setEnergyDelegate(inputEnergy); + cycleOutputAlternative.setNetwork(inputAlternativeNetwork); + inputAlternativeNetwork.addContainer(() -> cycleOutputAlternative); + + // Assert + assertThat(inputEnergy.getStored()).isEqualTo(1); + assertThat(inputAlternativeEnergy.getStored()).isEqualTo(3); + + assertThat(inputEnergy.getCapacity()).isEqualTo(2); + assertThat(inputAlternativeEnergy.getCapacity()).isEqualTo(4); + + assertThat(inputEnergy.extract(10)).isEqualTo(1); + assertThat(inputAlternativeEnergy.extract(10)).isEqualTo(3); + } +} diff --git a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/relay/RelayNetworkNodeTest.java b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/relay/RelayNetworkNodeTest.java new file mode 100644 index 000000000..777be1c1e --- /dev/null +++ b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/relay/RelayNetworkNodeTest.java @@ -0,0 +1,405 @@ +package com.refinedmods.refinedstorage2.api.network.impl.node.relay; + +import com.refinedmods.refinedstorage2.api.core.Action; +import com.refinedmods.refinedstorage2.api.network.Network; +import com.refinedmods.refinedstorage2.api.network.energy.EnergyNetworkComponent; +import com.refinedmods.refinedstorage2.api.network.impl.security.SecurityDecisionProviderImpl; +import com.refinedmods.refinedstorage2.api.network.security.SecurityNetworkComponent; +import com.refinedmods.refinedstorage2.api.network.security.SecurityPolicy; +import com.refinedmods.refinedstorage2.api.network.storage.StorageNetworkComponent; +import com.refinedmods.refinedstorage2.api.resource.ResourceAmount; +import com.refinedmods.refinedstorage2.api.storage.AccessMode; +import com.refinedmods.refinedstorage2.api.storage.EmptyActor; +import com.refinedmods.refinedstorage2.api.storage.InMemoryStorageImpl; +import com.refinedmods.refinedstorage2.network.test.AddNetworkNode; +import com.refinedmods.refinedstorage2.network.test.InjectNetwork; +import com.refinedmods.refinedstorage2.network.test.InjectNetworkEnergyComponent; +import com.refinedmods.refinedstorage2.network.test.InjectNetworkSecurityComponent; +import com.refinedmods.refinedstorage2.network.test.InjectNetworkStorageComponent; +import com.refinedmods.refinedstorage2.network.test.NetworkTest; +import com.refinedmods.refinedstorage2.network.test.SetupNetwork; +import com.refinedmods.refinedstorage2.network.test.fake.FakePermissions; +import com.refinedmods.refinedstorage2.network.test.fake.FakeSecurityActors; + +import java.util.Set; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.EnumSource; + +import static com.refinedmods.refinedstorage2.api.network.impl.node.security.SecurityDecisionProviderProxyNetworkNode.activeSecurityDecisionProvider; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.A; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.B; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.C; +import static com.refinedmods.refinedstorage2.network.test.nodefactory.AbstractNetworkNodeFactory.PROPERTY_ACTIVE; +import static com.refinedmods.refinedstorage2.network.test.nodefactory.AbstractNetworkNodeFactory.PROPERTY_ENERGY_USAGE; +import static org.assertj.core.api.Assertions.assertThat; + +@NetworkTest +@SetupNetwork(id = "input") +@SetupNetwork(id = "output", setupEnergy = false) +class RelayNetworkNodeTest { + private static final long INPUT_ENERGY_USAGE = 5; + private static final long OUTPUT_ENERGY_USAGE = 5; + + @AddNetworkNode(properties = { + @AddNetworkNode.Property(key = PROPERTY_ENERGY_USAGE, longValue = INPUT_ENERGY_USAGE), + @AddNetworkNode.Property(key = PROPERTY_ACTIVE, boolValue = false) + }, networkId = "input") + private RelayInputNetworkNode input; + + @AddNetworkNode(properties = { + @AddNetworkNode.Property(key = PROPERTY_ENERGY_USAGE, longValue = OUTPUT_ENERGY_USAGE) + }, networkId = "output") + private RelayOutputNetworkNode output; + + @Test + void testInitialState() { + assertThat(input.getEnergyUsage()).isEqualTo(INPUT_ENERGY_USAGE); + assertThat(output.getEnergyUsage()).isZero(); + } + + @Test + void shouldNotPassComponentsIfOutputNodeIsNotSet( + @InjectNetworkSecurityComponent(networkId = "input") final SecurityNetworkComponent inputSecurity, + @InjectNetworkStorageComponent(networkId = "input") final StorageNetworkComponent inputStorage, + @InjectNetworkEnergyComponent(networkId = "output") final EnergyNetworkComponent outputEnergy, + @InjectNetworkSecurityComponent(networkId = "output") final SecurityNetworkComponent outputSecurity, + @InjectNetworkStorageComponent(networkId = "output") final StorageNetworkComponent outputStorage + ) { + // Arrange + input.setActive(true); + + addSecurityPolicy(inputSecurity, FakePermissions.OTHER); + addStorageSource(inputStorage); + + input.setAccessMode(AccessMode.INSERT_EXTRACT); + input.setPriority(5); + input.setFilters(Set.of(A, B, C)); + + // Act + input.setComponentTypes(Set.of( + RelayComponentType.ENERGY, + RelayComponentType.SECURITY, + RelayComponentType.STORAGE + )); + + // Assert + assertThat(outputEnergy.getCapacity()).isZero(); + assertThat(outputEnergy.getStored()).isZero(); + assertThat(outputEnergy.extract(1)).isZero(); + assertThat(outputSecurity.isAllowed(FakePermissions.ALLOW_BY_DEFAULT, FakeSecurityActors.A)).isTrue(); + assertThat(outputSecurity.isAllowed(FakePermissions.OTHER, FakeSecurityActors.A)).isFalse(); + assertThat(outputStorage.getAll()).isEmpty(); + assertThat(outputStorage.insert(A, 1, Action.EXECUTE, EmptyActor.INSTANCE)).isZero(); + assertThat(outputStorage.extract(A, 1, Action.EXECUTE, EmptyActor.INSTANCE)).isZero(); + assertThat(output.getEnergyUsage()).isZero(); + } + + @Test + void shouldNotPassComponentsIfInactive( + @InjectNetworkSecurityComponent(networkId = "input") final SecurityNetworkComponent inputSecurity, + @InjectNetworkStorageComponent(networkId = "input") final StorageNetworkComponent inputStorage, + @InjectNetworkEnergyComponent(networkId = "output") final EnergyNetworkComponent outputEnergy, + @InjectNetworkSecurityComponent(networkId = "output") final SecurityNetworkComponent outputSecurity, + @InjectNetworkStorageComponent(networkId = "output") final StorageNetworkComponent outputStorage + ) { + // Arrange + input.setOutputNode(output); + + addSecurityPolicy(inputSecurity, FakePermissions.OTHER); + addStorageSource(inputStorage); + + // Act + input.setComponentTypes(Set.of( + RelayComponentType.ENERGY, + RelayComponentType.SECURITY, + RelayComponentType.STORAGE + )); + + // Assert + assertThat(outputEnergy.getCapacity()).isZero(); + assertThat(outputEnergy.getStored()).isZero(); + assertThat(outputEnergy.extract(1)).isZero(); + assertThat(outputSecurity.isAllowed(FakePermissions.ALLOW_BY_DEFAULT, FakeSecurityActors.A)).isTrue(); + assertThat(outputSecurity.isAllowed(FakePermissions.OTHER, FakeSecurityActors.A)).isFalse(); + assertThat(outputStorage.getAll()).isEmpty(); + assertThat(outputStorage.insert(A, 1, Action.EXECUTE, EmptyActor.INSTANCE)).isZero(); + assertThat(outputStorage.extract(A, 1, Action.EXECUTE, EmptyActor.INSTANCE)).isZero(); + assertThat(output.getEnergyUsage()).isZero(); + } + + @Test + void shouldNotPassComponentsIfNoNetworkIsSet( + @InjectNetworkSecurityComponent(networkId = "input") final SecurityNetworkComponent inputSecurity, + @InjectNetworkStorageComponent(networkId = "input") final StorageNetworkComponent inputStorage, + @InjectNetworkEnergyComponent(networkId = "output") final EnergyNetworkComponent outputEnergy, + @InjectNetworkSecurityComponent(networkId = "output") final SecurityNetworkComponent outputSecurity, + @InjectNetworkStorageComponent(networkId = "output") final StorageNetworkComponent outputStorage + ) { + // Arrange + input.setActive(true); + input.setNetwork(null); + input.setOutputNode(output); + + addSecurityPolicy(inputSecurity, FakePermissions.OTHER); + addStorageSource(inputStorage); + + // Act + input.setComponentTypes(Set.of( + RelayComponentType.ENERGY, + RelayComponentType.SECURITY, + RelayComponentType.STORAGE + )); + + // Assert + assertThat(outputEnergy.getCapacity()).isZero(); + assertThat(outputEnergy.getStored()).isZero(); + assertThat(outputEnergy.extract(1)).isZero(); + assertThat(outputSecurity.isAllowed(FakePermissions.ALLOW_BY_DEFAULT, FakeSecurityActors.A)).isTrue(); + assertThat(outputSecurity.isAllowed(FakePermissions.OTHER, FakeSecurityActors.A)).isFalse(); + assertThat(outputStorage.getAll()).isEmpty(); + assertThat(outputStorage.insert(A, 1, Action.EXECUTE, EmptyActor.INSTANCE)).isZero(); + assertThat(outputStorage.extract(A, 1, Action.EXECUTE, EmptyActor.INSTANCE)).isZero(); + assertThat(output.getEnergyUsage()).isZero(); + } + + @Test + void shouldResetComponentsIfBecomingInactive( + @InjectNetworkSecurityComponent(networkId = "input") final SecurityNetworkComponent inputSecurity, + @InjectNetworkStorageComponent(networkId = "input") final StorageNetworkComponent inputStorage, + @InjectNetworkEnergyComponent(networkId = "output") final EnergyNetworkComponent outputEnergy, + @InjectNetworkSecurityComponent(networkId = "output") final SecurityNetworkComponent outputSecurity, + @InjectNetworkStorageComponent(networkId = "output") final StorageNetworkComponent outputStorage + ) { + // Arrange + input.setActive(true); + input.setOutputNode(output); + input.setComponentTypes(Set.of( + RelayComponentType.ENERGY, + RelayComponentType.SECURITY, + RelayComponentType.STORAGE + )); + + addSecurityPolicy(inputSecurity, FakePermissions.OTHER); + addStorageSource(inputStorage); + + // Act + input.setActive(false); + + // Assert + assertThat(outputEnergy.getCapacity()).isZero(); + assertThat(outputEnergy.getStored()).isZero(); + assertThat(outputEnergy.extract(1)).isZero(); + assertThat(outputSecurity.isAllowed(FakePermissions.ALLOW_BY_DEFAULT, FakeSecurityActors.A)).isTrue(); + assertThat(outputSecurity.isAllowed(FakePermissions.OTHER, FakeSecurityActors.A)).isFalse(); + assertThat(outputStorage.getAll()).isEmpty(); + assertThat(outputStorage.insert(A, 1, Action.EXECUTE, EmptyActor.INSTANCE)).isZero(); + assertThat(outputStorage.extract(A, 1, Action.EXECUTE, EmptyActor.INSTANCE)).isZero(); + assertThat(output.getEnergyUsage()).isZero(); + } + + @Test + void shouldResetComponentsIfNetworkIsRemoved( + @InjectNetworkSecurityComponent(networkId = "input") final SecurityNetworkComponent inputSecurity, + @InjectNetworkStorageComponent(networkId = "input") final StorageNetworkComponent inputStorage, + @InjectNetworkEnergyComponent(networkId = "output") final EnergyNetworkComponent outputEnergy, + @InjectNetworkSecurityComponent(networkId = "output") final SecurityNetworkComponent outputSecurity, + @InjectNetworkStorageComponent(networkId = "output") final StorageNetworkComponent outputStorage + ) { + // Arrange + input.setActive(true); + input.setOutputNode(output); + input.setComponentTypes(Set.of( + RelayComponentType.ENERGY, + RelayComponentType.SECURITY, + RelayComponentType.STORAGE + )); + + addSecurityPolicy(inputSecurity, FakePermissions.OTHER); + addStorageSource(inputStorage); + + // Act + input.setNetwork(null); + + // Assert + assertThat(outputEnergy.getCapacity()).isZero(); + assertThat(outputEnergy.getStored()).isZero(); + assertThat(outputEnergy.extract(1)).isZero(); + assertThat(outputSecurity.isAllowed(FakePermissions.ALLOW_BY_DEFAULT, FakeSecurityActors.A)).isTrue(); + assertThat(outputSecurity.isAllowed(FakePermissions.OTHER, FakeSecurityActors.A)).isFalse(); + assertThat(outputStorage.getAll()).isEmpty(); + assertThat(outputStorage.insert(A, 1, Action.EXECUTE, EmptyActor.INSTANCE)).isZero(); + assertThat(outputStorage.extract(A, 1, Action.EXECUTE, EmptyActor.INSTANCE)).isZero(); + assertThat(output.getEnergyUsage()).isZero(); + } + + @Test + @SetupNetwork(id = "input_alt", energyStored = 123, energyCapacity = 456) + void shouldResetComponentsIfNetworkIsChanged( + @InjectNetwork("input") final Network inputNetwork, + @InjectNetworkSecurityComponent(networkId = "input") final SecurityNetworkComponent inputSecurity, + @InjectNetworkStorageComponent(networkId = "input") final StorageNetworkComponent inputStorage, + @InjectNetwork("input_alt") final Network inputAlternativeNetwork, + @InjectNetworkEnergyComponent(networkId = "input_alt") final EnergyNetworkComponent inputAlternativeEnergy, + @InjectNetworkSecurityComponent(networkId = "input_alt") + final SecurityNetworkComponent inputAlternativeSecurity, + @InjectNetworkStorageComponent(networkId = "input_alt") final StorageNetworkComponent inputAlternativeStorage, + @InjectNetworkEnergyComponent(networkId = "output") final EnergyNetworkComponent outputEnergy, + @InjectNetworkSecurityComponent(networkId = "output") final SecurityNetworkComponent outputSecurity, + @InjectNetworkStorageComponent(networkId = "output") final StorageNetworkComponent outputStorage + ) { + // Arrange + input.setActive(true); + input.setOutputNode(output); + input.setComponentTypes(Set.of( + RelayComponentType.ENERGY, + RelayComponentType.SECURITY, + RelayComponentType.STORAGE + )); + + inputStorage.addSource(new InMemoryStorageImpl()); + inputStorage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); + inputStorage.insert(B, 5, Action.EXECUTE, EmptyActor.INSTANCE); + inputStorage.extract(B, 3, Action.EXECUTE, EmptyActor.INSTANCE); + + inputAlternativeStorage.addSource(new InMemoryStorageImpl()); + inputAlternativeStorage.insert(A, 33, Action.EXECUTE, EmptyActor.INSTANCE); + + addSecurityPolicy(inputSecurity, FakePermissions.OTHER); + addSecurityPolicy(inputAlternativeSecurity, FakePermissions.OTHER2); + + // Act + inputNetwork.removeContainer(() -> input); + input.setNetwork(inputAlternativeNetwork); + inputAlternativeNetwork.addContainer(() -> input); + + final long originalStored = inputAlternativeEnergy.getStored(); + final long extractedEnergy = output.extract(1); + + final long insertedStorage = outputStorage.insert(C, 1, Action.EXECUTE, EmptyActor.INSTANCE); + final long extractedStorage = outputStorage.extract(A, 1, Action.EXECUTE, EmptyActor.INSTANCE); + + // Assert + assertThat(extractedEnergy).isEqualTo(1); + assertThat(insertedStorage).isEqualTo(1); + assertThat(extractedStorage).isEqualTo(1); + + assertThat(outputEnergy.getCapacity()).isEqualTo(inputAlternativeEnergy.getCapacity()); + assertThat(outputEnergy.getStored()).isEqualTo(originalStored - 1); + assertThat(outputSecurity.isAllowed(FakePermissions.ALLOW_BY_DEFAULT, FakeSecurityActors.A)).isFalse(); + assertThat(outputSecurity.isAllowed(FakePermissions.OTHER, FakeSecurityActors.A)).isFalse(); + assertThat(outputSecurity.isAllowed(FakePermissions.OTHER2, FakeSecurityActors.A)).isTrue(); + assertThat(outputStorage.getStored()).isEqualTo(33); + assertThat(outputStorage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( + new ResourceAmount(A, 32), + new ResourceAmount(C, 1) + ); + assertThat(inputAlternativeStorage.getAll()).usingRecursiveFieldByFieldElementComparator() + .containsExactlyInAnyOrder(new ResourceAmount(A, 32), new ResourceAmount(C, 1)); + assertThat(inputStorage.getAll()).usingRecursiveFieldByFieldElementComparator() + .containsExactlyInAnyOrder(new ResourceAmount(A, 10), new ResourceAmount(B, 2)); + assertThat(output.getEnergyUsage()).isEqualTo(OUTPUT_ENERGY_USAGE); + } + + @Test + void shouldResetComponentsWhenComponentTypeIsEnabled( + @InjectNetworkEnergyComponent(networkId = "input") final EnergyNetworkComponent inputEnergy, + @InjectNetworkSecurityComponent(networkId = "input") final SecurityNetworkComponent inputSecurity, + @InjectNetworkStorageComponent(networkId = "input") final StorageNetworkComponent inputStorage, + @InjectNetworkEnergyComponent(networkId = "output") final EnergyNetworkComponent outputEnergy, + @InjectNetworkSecurityComponent(networkId = "output") final SecurityNetworkComponent outputSecurity, + @InjectNetworkStorageComponent(networkId = "output") final StorageNetworkComponent outputStorage + ) { + // Arrange + input.setActive(true); + input.setOutputNode(output); + input.setComponentTypes(Set.of( + RelayComponentType.SECURITY, + RelayComponentType.STORAGE + )); + + addSecurityPolicy(inputSecurity, FakePermissions.OTHER); + addStorageSource(inputStorage); + + // Act + final long originalStored = inputEnergy.getStored(); + input.updateComponentType(RelayComponentType.ENERGY, true); + final long extracted = output.extract(10); + + // Assert + assertThat(outputEnergy.getCapacity()).isEqualTo(inputEnergy.getCapacity()); + assertThat(outputEnergy.getStored()).isEqualTo(originalStored - 10); + assertThat(extracted).isEqualTo(10); + assertThat(outputSecurity.isAllowed(FakePermissions.ALLOW_BY_DEFAULT, FakeSecurityActors.A)).isFalse(); + assertThat(outputSecurity.isAllowed(FakePermissions.OTHER, FakeSecurityActors.A)).isTrue(); + assertThat(outputStorage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( + new ResourceAmount(A, 10) + ); + assertThat(outputStorage.insert(A, 1, Action.EXECUTE, EmptyActor.INSTANCE)).isEqualTo(1); + assertThat(outputStorage.extract(A, 1, Action.EXECUTE, EmptyActor.INSTANCE)).isEqualTo(1); + assertThat(output.getEnergyUsage()).isEqualTo(OUTPUT_ENERGY_USAGE); + } + + @Test + void shouldResetComponentsWhenComponentTypeIsDisabled( + @InjectNetworkSecurityComponent(networkId = "input") final SecurityNetworkComponent inputSecurity, + @InjectNetworkStorageComponent(networkId = "input") final StorageNetworkComponent inputStorage, + @InjectNetworkEnergyComponent(networkId = "output") final EnergyNetworkComponent outputEnergy, + @InjectNetworkSecurityComponent(networkId = "output") final SecurityNetworkComponent outputSecurity, + @InjectNetworkStorageComponent(networkId = "output") final StorageNetworkComponent outputStorage + ) { + // Arrange + input.setActive(true); + input.setOutputNode(output); + input.setComponentTypes(Set.of( + RelayComponentType.SECURITY, + RelayComponentType.STORAGE + )); + + addSecurityPolicy(inputSecurity, FakePermissions.OTHER); + addStorageSource(inputStorage); + + // Act + input.updateComponentType(RelayComponentType.ENERGY, false); + final long extracted = output.extract(10); + + // Assert + assertThat(outputEnergy.getCapacity()).isZero(); + assertThat(outputEnergy.getStored()).isZero(); + assertThat(extracted).isZero(); + assertThat(outputSecurity.isAllowed(FakePermissions.ALLOW_BY_DEFAULT, FakeSecurityActors.A)).isFalse(); + assertThat(outputSecurity.isAllowed(FakePermissions.OTHER, FakeSecurityActors.A)).isTrue(); + assertThat(outputStorage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( + new ResourceAmount(A, 10) + ); + assertThat(outputStorage.insert(A, 1, Action.EXECUTE, EmptyActor.INSTANCE)).isEqualTo(1); + assertThat(outputStorage.extract(A, 1, Action.EXECUTE, EmptyActor.INSTANCE)).isEqualTo(1); + assertThat(output.getEnergyUsage()).isEqualTo(OUTPUT_ENERGY_USAGE); + } + + @ParameterizedTest + @EnumSource(RelayComponentType.class) + void shouldUseEnergyWhenAtLeastOneComponentIsActive(final RelayComponentType type) { + // Arrange + input.setActive(true); + input.setOutputNode(output); + + // Act + input.setComponentTypes(Set.of(type)); + + // Assert + assertThat(output.getEnergyUsage()).isEqualTo(OUTPUT_ENERGY_USAGE); + } + + static void addSecurityPolicy(final SecurityNetworkComponent security, final FakePermissions permission) { + security.onContainerAdded(() -> activeSecurityDecisionProvider(new SecurityDecisionProviderImpl() + .setPolicy(FakeSecurityActors.A, SecurityPolicy.of(permission)) + )); + } + + static void addStorageSource(final StorageNetworkComponent storage) { + storage.addSource(new InMemoryStorageImpl()); + storage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); + } +} diff --git a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/relay/RelaySecurityNetworkNodeTest.java b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/relay/RelaySecurityNetworkNodeTest.java new file mode 100644 index 000000000..e2b61c35c --- /dev/null +++ b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/relay/RelaySecurityNetworkNodeTest.java @@ -0,0 +1,165 @@ +package com.refinedmods.refinedstorage2.api.network.impl.node.relay; + +import com.refinedmods.refinedstorage2.api.core.Action; +import com.refinedmods.refinedstorage2.api.network.Network; +import com.refinedmods.refinedstorage2.api.network.energy.EnergyNetworkComponent; +import com.refinedmods.refinedstorage2.api.network.impl.security.SecurityDecisionProviderImpl; +import com.refinedmods.refinedstorage2.api.network.security.SecurityNetworkComponent; +import com.refinedmods.refinedstorage2.api.network.security.SecurityPolicy; +import com.refinedmods.refinedstorage2.api.network.storage.StorageNetworkComponent; +import com.refinedmods.refinedstorage2.api.storage.EmptyActor; +import com.refinedmods.refinedstorage2.network.test.AddNetworkNode; +import com.refinedmods.refinedstorage2.network.test.InjectNetwork; +import com.refinedmods.refinedstorage2.network.test.InjectNetworkEnergyComponent; +import com.refinedmods.refinedstorage2.network.test.InjectNetworkSecurityComponent; +import com.refinedmods.refinedstorage2.network.test.InjectNetworkStorageComponent; +import com.refinedmods.refinedstorage2.network.test.NetworkTest; +import com.refinedmods.refinedstorage2.network.test.SetupNetwork; +import com.refinedmods.refinedstorage2.network.test.fake.FakePermissions; +import com.refinedmods.refinedstorage2.network.test.fake.FakeSecurityActors; + +import java.util.Set; + +import org.junit.jupiter.api.Test; + +import static com.refinedmods.refinedstorage2.api.network.impl.node.relay.RelayNetworkNodeTest.addStorageSource; +import static com.refinedmods.refinedstorage2.api.network.impl.node.security.SecurityDecisionProviderProxyNetworkNode.activeSecurityDecisionProvider; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.A; +import static com.refinedmods.refinedstorage2.network.test.nodefactory.AbstractNetworkNodeFactory.PROPERTY_ACTIVE; +import static org.assertj.core.api.Assertions.assertThat; + +@NetworkTest +@SetupNetwork(id = "input") +@SetupNetwork(id = "output", setupEnergy = false) +class RelaySecurityNetworkNodeTest { + @AddNetworkNode(properties = { + @AddNetworkNode.Property(key = PROPERTY_ACTIVE, boolValue = false) + }, networkId = "input") + private RelayInputNetworkNode input; + + @AddNetworkNode(networkId = "output") + private RelayOutputNetworkNode output; + + @Test + void shouldPassSecurityComponent( + @InjectNetworkSecurityComponent(networkId = "input") final SecurityNetworkComponent inputSecurity, + @InjectNetworkStorageComponent(networkId = "input") final StorageNetworkComponent inputStorage, + @InjectNetworkEnergyComponent(networkId = "output") final EnergyNetworkComponent outputEnergy, + @InjectNetworkSecurityComponent(networkId = "output") final SecurityNetworkComponent outputSecurity, + @InjectNetworkStorageComponent(networkId = "output") final StorageNetworkComponent outputStorage + ) { + // Arrange + input.setActive(true); + input.setOutputNode(output); + + inputSecurity.onContainerAdded(() -> activeSecurityDecisionProvider( + new SecurityDecisionProviderImpl() + .setPolicy(FakeSecurityActors.A, SecurityPolicy.of(FakePermissions.ALLOW_BY_DEFAULT)) + .setPolicy(FakeSecurityActors.B, SecurityPolicy.of(FakePermissions.OTHER)) + )); + + addStorageSource(inputStorage); + + // Act + input.setComponentTypes(Set.of(RelayComponentType.SECURITY)); + + // Assert + assertThat(outputEnergy.getCapacity()).isZero(); + assertThat(outputEnergy.getStored()).isZero(); + assertThat(outputEnergy.extract(1)).isZero(); + assertThat(outputSecurity.isAllowed(FakePermissions.ALLOW_BY_DEFAULT, FakeSecurityActors.A)).isTrue(); + assertThat(outputSecurity.isAllowed(FakePermissions.ALLOW_BY_DEFAULT, FakeSecurityActors.B)).isFalse(); + assertThat(outputSecurity.isAllowed(FakePermissions.OTHER, FakeSecurityActors.A)).isFalse(); + assertThat(outputSecurity.isAllowed(FakePermissions.OTHER, FakeSecurityActors.B)).isTrue(); + assertThat(outputStorage.getAll()).isEmpty(); + assertThat(outputStorage.insert(A, 1, Action.EXECUTE, EmptyActor.INSTANCE)).isZero(); + assertThat(outputStorage.extract(A, 1, Action.EXECUTE, EmptyActor.INSTANCE)).isZero(); + assertThat(input.hasComponentType(RelayComponentType.ENERGY)).isFalse(); + assertThat(input.hasComponentType(RelayComponentType.SECURITY)).isTrue(); + assertThat(input.hasComponentType(RelayComponentType.STORAGE)).isFalse(); + } + + @Test + void shouldNotActAsSecurityDecisionProviderIfOutputIsDisabled( + @InjectNetworkSecurityComponent(networkId = "input") final SecurityNetworkComponent inputSecurity, + @InjectNetworkSecurityComponent(networkId = "output") final SecurityNetworkComponent outputSecurity + ) { + // Arrange + input.setActive(true); + input.setOutputNode(output); + + inputSecurity.onContainerAdded(() -> activeSecurityDecisionProvider(new SecurityDecisionProviderImpl() + .setPolicy(FakeSecurityActors.A, SecurityPolicy.of(FakePermissions.OTHER)) + )); + + input.setComponentTypes(Set.of(RelayComponentType.SECURITY)); + + // Act + output.setActive(false); + + // Assert + assertThat(outputSecurity.isAllowed(FakePermissions.ALLOW_BY_DEFAULT, FakeSecurityActors.A)).isTrue(); + assertThat(outputSecurity.isAllowed(FakePermissions.OTHER, FakeSecurityActors.A)).isFalse(); + } + + @Test + void shouldNotActAsSecurityDecisionProviderIfSecurityIsNotPassed( + @InjectNetworkSecurityComponent(networkId = "input") final SecurityNetworkComponent inputSecurity, + @InjectNetworkSecurityComponent(networkId = "output") final SecurityNetworkComponent outputSecurity + ) { + // Arrange + input.setActive(true); + input.setOutputNode(output); + + inputSecurity.onContainerAdded(() -> activeSecurityDecisionProvider(new SecurityDecisionProviderImpl() + .setPolicy(FakeSecurityActors.A, SecurityPolicy.of(FakePermissions.OTHER)) + )); + + // Act + input.setComponentTypes(Set.of()); + + // Assert + assertThat(outputSecurity.isAllowed(FakePermissions.ALLOW_BY_DEFAULT, FakeSecurityActors.A)).isTrue(); + assertThat(outputSecurity.isAllowed(FakePermissions.OTHER, FakeSecurityActors.A)).isFalse(); + } + + @Test + @SetupNetwork(id = "cycle_input") + @SetupNetwork(id = "cycle_input_alt") + void shouldDetectSecurityCycles( + @InjectNetwork("cycle_input") final Network inputNetwork, + @InjectNetworkSecurityComponent(networkId = "cycle_input") final SecurityNetworkComponent inputSecurity, + @InjectNetwork("cycle_input_alt") final Network inputAlternativeNetwork, + @InjectNetworkSecurityComponent(networkId = "cycle_input_alt") + final SecurityNetworkComponent inputAlternativeSecurity + ) { + // Arrange + inputSecurity.onContainerAdded(() -> activeSecurityDecisionProvider( + new SecurityDecisionProviderImpl() + .setPolicy(FakeSecurityActors.A, SecurityPolicy.of(FakePermissions.OTHER)) + )); + + inputAlternativeSecurity.onContainerAdded(() -> activeSecurityDecisionProvider( + new SecurityDecisionProviderImpl() + .setPolicy(FakeSecurityActors.A, SecurityPolicy.of(FakePermissions.OTHER2)) + )); + + // Act + final RelayOutputNetworkNode cycleOutput = new RelayOutputNetworkNode(0); + cycleOutput.setSecurityDelegate(inputAlternativeSecurity); + cycleOutput.setNetwork(inputNetwork); + inputNetwork.addContainer(() -> cycleOutput); + + final RelayOutputNetworkNode cycleOutputAlternative = new RelayOutputNetworkNode(0); + cycleOutputAlternative.setSecurityDelegate(inputSecurity); + cycleOutputAlternative.setNetwork(inputAlternativeNetwork); + inputAlternativeNetwork.addContainer(() -> cycleOutputAlternative); + + // Assert + assertThat(inputSecurity.isAllowed(FakePermissions.OTHER, FakeSecurityActors.A)).isTrue(); + assertThat(inputSecurity.isAllowed(FakePermissions.OTHER2, FakeSecurityActors.A)).isFalse(); + + assertThat(inputAlternativeSecurity.isAllowed(FakePermissions.OTHER, FakeSecurityActors.A)).isFalse(); + assertThat(inputAlternativeSecurity.isAllowed(FakePermissions.OTHER2, FakeSecurityActors.A)).isTrue(); + } +} diff --git a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/relay/RelayStorageNetworkNodeTest.java b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/relay/RelayStorageNetworkNodeTest.java new file mode 100644 index 000000000..5688f54e9 --- /dev/null +++ b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/relay/RelayStorageNetworkNodeTest.java @@ -0,0 +1,634 @@ +package com.refinedmods.refinedstorage2.api.network.impl.node.relay; + +import com.refinedmods.refinedstorage2.api.core.Action; +import com.refinedmods.refinedstorage2.api.network.Network; +import com.refinedmods.refinedstorage2.api.network.energy.EnergyNetworkComponent; +import com.refinedmods.refinedstorage2.api.network.security.SecurityNetworkComponent; +import com.refinedmods.refinedstorage2.api.network.storage.StorageNetworkComponent; +import com.refinedmods.refinedstorage2.api.resource.ResourceAmount; +import com.refinedmods.refinedstorage2.api.resource.filter.FilterMode; +import com.refinedmods.refinedstorage2.api.storage.AccessMode; +import com.refinedmods.refinedstorage2.api.storage.EmptyActor; +import com.refinedmods.refinedstorage2.api.storage.InMemoryStorageImpl; +import com.refinedmods.refinedstorage2.api.storage.Storage; +import com.refinedmods.refinedstorage2.api.storage.composite.PriorityStorage; +import com.refinedmods.refinedstorage2.api.storage.limited.LimitedStorageImpl; +import com.refinedmods.refinedstorage2.network.test.AddNetworkNode; +import com.refinedmods.refinedstorage2.network.test.InjectNetwork; +import com.refinedmods.refinedstorage2.network.test.InjectNetworkEnergyComponent; +import com.refinedmods.refinedstorage2.network.test.InjectNetworkSecurityComponent; +import com.refinedmods.refinedstorage2.network.test.InjectNetworkStorageComponent; +import com.refinedmods.refinedstorage2.network.test.NetworkTest; +import com.refinedmods.refinedstorage2.network.test.SetupNetwork; +import com.refinedmods.refinedstorage2.network.test.fake.FakePermissions; +import com.refinedmods.refinedstorage2.network.test.fake.FakeSecurityActors; + +import java.util.Set; + +import org.junit.jupiter.api.Test; + +import static com.refinedmods.refinedstorage2.api.network.impl.node.relay.RelayNetworkNodeTest.addSecurityPolicy; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.A; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.A_ALTERNATIVE; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.B; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.C; +import static com.refinedmods.refinedstorage2.network.test.nodefactory.AbstractNetworkNodeFactory.PROPERTY_ACTIVE; +import static org.assertj.core.api.Assertions.assertThat; + +@NetworkTest +@SetupNetwork(id = "input") +@SetupNetwork(id = "output", setupEnergy = false) +class RelayStorageNetworkNodeTest { + @AddNetworkNode(properties = { + @AddNetworkNode.Property(key = PROPERTY_ACTIVE, boolValue = false) + }, networkId = "input") + private RelayInputNetworkNode input; + + @AddNetworkNode(networkId = "output") + private RelayOutputNetworkNode output; + + @Test + void shouldPassStorageComponent( + @InjectNetworkSecurityComponent(networkId = "input") final SecurityNetworkComponent inputSecurity, + @InjectNetworkStorageComponent(networkId = "input") final StorageNetworkComponent inputStorage, + @InjectNetworkEnergyComponent(networkId = "output") final EnergyNetworkComponent outputEnergy, + @InjectNetworkSecurityComponent(networkId = "output") final SecurityNetworkComponent outputSecurity, + @InjectNetworkStorageComponent(networkId = "output") final StorageNetworkComponent outputStorage + ) { + // Arrange + input.setActive(true); + input.setOutputNode(output); + + addSecurityPolicy(inputSecurity, FakePermissions.OTHER); + + inputStorage.addSource(new InMemoryStorageImpl()); + inputStorage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); + + // Act + input.setComponentTypes(Set.of(RelayComponentType.STORAGE)); + + inputStorage.insert(B, 5, Action.EXECUTE, EmptyActor.INSTANCE); + inputStorage.extract(B, 3, Action.EXECUTE, EmptyActor.INSTANCE); + + // Assert + assertThat(outputEnergy.getCapacity()).isZero(); + assertThat(outputEnergy.getStored()).isZero(); + assertThat(outputSecurity.isAllowed(FakePermissions.ALLOW_BY_DEFAULT, FakeSecurityActors.A)).isTrue(); + assertThat(outputSecurity.isAllowed(FakePermissions.OTHER, FakeSecurityActors.A)).isFalse(); + + assertThat(inputStorage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( + new ResourceAmount(A, 10), + new ResourceAmount(B, 2) + ); + assertThat(outputStorage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( + new ResourceAmount(A, 10), + new ResourceAmount(B, 2) + ); + assertThat(outputStorage.getStored()).isEqualTo(12); + assertThat(input.hasComponentType(RelayComponentType.ENERGY)).isFalse(); + assertThat(input.hasComponentType(RelayComponentType.SECURITY)).isFalse(); + assertThat(input.hasComponentType(RelayComponentType.STORAGE)).isTrue(); + } + + @Test + void shouldRemoveStorageWhenNetworkIsRemoved( + @InjectNetworkStorageComponent(networkId = "input") final StorageNetworkComponent inputStorage, + @InjectNetworkStorageComponent(networkId = "output") final StorageNetworkComponent outputStorage + ) { + // Arrange + input.setActive(true); + input.setOutputNode(output); + + inputStorage.addSource(new InMemoryStorageImpl()); + inputStorage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); + input.setComponentTypes(Set.of(RelayComponentType.STORAGE)); + inputStorage.insert(B, 5, Action.EXECUTE, EmptyActor.INSTANCE); + inputStorage.extract(B, 3, Action.EXECUTE, EmptyActor.INSTANCE); + + // Act + input.setNetwork(null); + + inputStorage.insert(C, 1, Action.EXECUTE, EmptyActor.INSTANCE); + + // Assert + assertThat(inputStorage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( + new ResourceAmount(A, 10), + new ResourceAmount(B, 2), + new ResourceAmount(C, 1) + ); + assertThat(outputStorage.getAll()).isEmpty(); + assertThat(outputStorage.getStored()).isZero(); + assertThat(outputStorage.insert(A, 1, Action.EXECUTE, EmptyActor.INSTANCE)).isZero(); + assertThat(outputStorage.extract(A, 1, Action.EXECUTE, EmptyActor.INSTANCE)).isZero(); + } + + @Test + @SetupNetwork(id = "output_alt") + void shouldNotNotifyOldOutputNetworkWhenOutputNetworkHasChanged( + @InjectNetworkStorageComponent(networkId = "input") final StorageNetworkComponent inputStorage, + @InjectNetwork("output") final Network outputNetwork, + @InjectNetworkStorageComponent(networkId = "output_alt") final StorageNetworkComponent outputAlternativeStorage, + @InjectNetwork("output_alt") final Network outputAlternativeNetwork, + @InjectNetworkStorageComponent(networkId = "output") final StorageNetworkComponent outputStorage + ) { + // Arrange + input.setActive(true); + input.setOutputNode(output); + + inputStorage.addSource(new InMemoryStorageImpl()); + inputStorage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); + input.setComponentTypes(Set.of(RelayComponentType.STORAGE)); + + // Act + outputNetwork.removeContainer(() -> output); + outputAlternativeNetwork.addContainer(() -> output); + output.setNetwork(outputAlternativeNetwork); + + inputStorage.insert(A, 1, Action.EXECUTE, EmptyActor.INSTANCE); + + // Assert + assertThat(outputAlternativeStorage.getAll()).usingRecursiveFieldByFieldElementComparator() + .containsExactlyInAnyOrder(new ResourceAmount(A, 11)); + assertThat(outputAlternativeStorage.getStored()).isEqualTo(11); + assertThat(outputStorage.getAll()).isEmpty(); + assertThat(outputStorage.getStored()).isZero(); + } + + @Test + void shouldInsertResourcesIntoInputStorageFromOutputStorage( + @InjectNetworkStorageComponent(networkId = "input") final StorageNetworkComponent inputStorage, + @InjectNetworkStorageComponent(networkId = "output") final StorageNetworkComponent outputStorage + ) { + // Arrange + input.setActive(true); + input.setOutputNode(output); + input.setComponentTypes(Set.of(RelayComponentType.STORAGE)); + + inputStorage.addSource(new InMemoryStorageImpl()); + inputStorage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); + + // Act + final long inserted = outputStorage.insert(B, 2, Action.EXECUTE, EmptyActor.INSTANCE); + + // Assert + assertThat(inserted).isEqualTo(2); + assertThat(inputStorage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( + new ResourceAmount(A, 10), + new ResourceAmount(B, 2) + ); + assertThat(inputStorage.getStored()).isEqualTo(12); + assertThat(outputStorage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( + new ResourceAmount(A, 10), + new ResourceAmount(B, 2) + ); + assertThat(outputStorage.getStored()).isEqualTo(12); + } + + @Test + void shouldExtractResourcesFromInputStorageIntoOutputStorage( + @InjectNetworkStorageComponent(networkId = "input") final StorageNetworkComponent inputStorage, + @InjectNetworkStorageComponent(networkId = "output") final StorageNetworkComponent outputStorage + ) { + // Arrange + input.setActive(true); + input.setOutputNode(output); + input.setComponentTypes(Set.of(RelayComponentType.STORAGE)); + + inputStorage.addSource(new InMemoryStorageImpl()); + inputStorage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); + + // Act + final long extracted = outputStorage.extract(A, 2, Action.EXECUTE, EmptyActor.INSTANCE); + + // Assert + assertThat(extracted).isEqualTo(2); + assertThat(inputStorage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( + new ResourceAmount(A, 8) + ); + assertThat(inputStorage.getStored()).isEqualTo(8); + assertThat(outputStorage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( + new ResourceAmount(A, 8) + ); + assertThat(outputStorage.getStored()).isEqualTo(8); + } + + @Test + void shouldNotInsertInExtractOnlyMode( + @InjectNetworkStorageComponent(networkId = "input") final StorageNetworkComponent inputStorage, + @InjectNetworkStorageComponent(networkId = "output") final StorageNetworkComponent outputStorage + ) { + // Arrange + input.setActive(true); + input.setOutputNode(output); + input.setAccessMode(AccessMode.EXTRACT); + input.setComponentTypes(Set.of(RelayComponentType.STORAGE)); + + inputStorage.addSource(new InMemoryStorageImpl()); + inputStorage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); + + // Act + final long inserted = outputStorage.insert(B, 2, Action.EXECUTE, EmptyActor.INSTANCE); + final long extracted = outputStorage.extract(A, 2, Action.EXECUTE, EmptyActor.INSTANCE); + + // Assert + assertThat(inserted).isZero(); + assertThat(extracted).isEqualTo(2); + assertThat(inputStorage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( + new ResourceAmount(A, 8) + ); + assertThat(inputStorage.getStored()).isEqualTo(8); + assertThat(outputStorage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( + new ResourceAmount(A, 8) + ); + assertThat(outputStorage.getStored()).isEqualTo(8); + } + + @Test + void shouldNotExtractInInsertOnlyMode( + @InjectNetworkStorageComponent(networkId = "input") final StorageNetworkComponent inputStorage, + @InjectNetworkStorageComponent(networkId = "output") final StorageNetworkComponent outputStorage + ) { + // Arrange + input.setActive(true); + input.setOutputNode(output); + input.setAccessMode(AccessMode.INSERT); + input.setComponentTypes(Set.of(RelayComponentType.STORAGE)); + + inputStorage.addSource(new InMemoryStorageImpl()); + inputStorage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); + + // Act + final long inserted = outputStorage.insert(B, 2, Action.EXECUTE, EmptyActor.INSTANCE); + final long extracted = outputStorage.extract(A, 2, Action.EXECUTE, EmptyActor.INSTANCE); + + // Assert + assertThat(inserted).isEqualTo(2); + assertThat(extracted).isZero(); + assertThat(inputStorage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( + new ResourceAmount(A, 10), + new ResourceAmount(B, 2) + ); + assertThat(inputStorage.getStored()).isEqualTo(12); + assertThat(outputStorage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( + new ResourceAmount(A, 10), + new ResourceAmount(B, 2) + ); + assertThat(outputStorage.getStored()).isEqualTo(12); + } + + @Test + void shouldRespectPriorityOfOutput( + @InjectNetworkStorageComponent(networkId = "input") final StorageNetworkComponent inputStorage, + @InjectNetworkStorageComponent(networkId = "output") final StorageNetworkComponent outputStorage + ) { + // Arrange + input.setActive(true); + input.setOutputNode(output); + input.setPriority(3); + input.setComponentTypes(Set.of(RelayComponentType.STORAGE)); + inputStorage.addSource(new InMemoryStorageImpl()); + inputStorage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); + + final Storage fallbackStorage1 = PriorityStorage.of(new InMemoryStorageImpl(), 2); + fallbackStorage1.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); + outputStorage.addSource(fallbackStorage1); + + final Storage fallbackStorage2 = PriorityStorage.of(new InMemoryStorageImpl(), 1); + fallbackStorage2.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); + outputStorage.addSource(fallbackStorage2); + + // Act + final long inserted = outputStorage.insert(A, 2, Action.EXECUTE, EmptyActor.INSTANCE); + final long extracted = outputStorage.extract(A, 3, Action.EXECUTE, EmptyActor.INSTANCE); + + // Assert + assertThat(inserted).isEqualTo(2); + assertThat(extracted).isEqualTo(3); + + assertThat(inputStorage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( + new ResourceAmount(A, 9) + ); + assertThat(fallbackStorage1.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( + new ResourceAmount(A, 10) + ); + assertThat(fallbackStorage2.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( + new ResourceAmount(A, 10) + ); + } + + @Test + void shouldModifyPriorityOfOutput( + @InjectNetworkStorageComponent(networkId = "input") final StorageNetworkComponent inputStorage, + @InjectNetworkStorageComponent(networkId = "output") final StorageNetworkComponent outputStorage + ) { + // Arrange + input.setActive(true); + input.setOutputNode(output); + input.setPriority(3); + input.setComponentTypes(Set.of(RelayComponentType.STORAGE)); + inputStorage.addSource(new LimitedStorageImpl(10)); + + final Storage fallbackStorage1 = PriorityStorage.of(new LimitedStorageImpl(5), 1); + outputStorage.addSource(fallbackStorage1); + + final Storage fallbackStorage2 = PriorityStorage.of(new LimitedStorageImpl(5), 3); + outputStorage.addSource(fallbackStorage2); + + // Act + input.setPriority(2); + + // Assert + final long inserted = outputStorage.insert(A, 7, Action.EXECUTE, EmptyActor.INSTANCE); + final long extracted = outputStorage.extract(A, 3, Action.EXECUTE, EmptyActor.INSTANCE); + + assertThat(inserted).isEqualTo(7); + assertThat(extracted).isEqualTo(3); + + assertThat(inputStorage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( + new ResourceAmount(A, 2) + ); + assertThat(fallbackStorage1.getAll()).usingRecursiveFieldByFieldElementComparator().isEmpty(); + assertThat(fallbackStorage2.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( + new ResourceAmount(A, 2) + ); + } + + @Test + void shouldRespectBlocklistFilter( + @InjectNetworkStorageComponent(networkId = "input") final StorageNetworkComponent inputStorage, + @InjectNetworkStorageComponent(networkId = "output") final StorageNetworkComponent outputStorage + ) { + // Arrange + input.setActive(true); + input.setOutputNode(output); + input.setFilters(Set.of(A, B)); + + inputStorage.addSource(new InMemoryStorageImpl()); + inputStorage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); + inputStorage.insert(B, 9, Action.EXECUTE, EmptyActor.INSTANCE); + inputStorage.insert(C, 8, Action.EXECUTE, EmptyActor.INSTANCE); + + // Act + input.setComponentTypes(Set.of(RelayComponentType.STORAGE)); + + // This update shouldn't arrive. + inputStorage.insert(A, 1, Action.EXECUTE, EmptyActor.INSTANCE); + // This one should. + inputStorage.insert(C, 3, Action.EXECUTE, EmptyActor.INSTANCE); + + final long insertedAllowed = outputStorage.insert(C, 2, Action.EXECUTE, EmptyActor.INSTANCE); + final long insertedNotAllowed = outputStorage.insert(A, 1, Action.EXECUTE, EmptyActor.INSTANCE); + + final long extractedAllowed = outputStorage.extract(C, 1, Action.EXECUTE, EmptyActor.INSTANCE); + final long extractedNotAllowed = outputStorage.extract(A, 1, Action.EXECUTE, EmptyActor.INSTANCE); + + // Assert + assertThat(insertedAllowed).isEqualTo(2); + assertThat(insertedNotAllowed).isZero(); + + assertThat(extractedAllowed).isEqualTo(1); + assertThat(extractedNotAllowed).isZero(); + + assertThat(inputStorage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( + new ResourceAmount(A, 11), + new ResourceAmount(B, 9), + new ResourceAmount(C, 12) + ); + assertThat(inputStorage.getStored()).isEqualTo(11 + 9 + 12); + + assertThat(outputStorage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( + new ResourceAmount(C, 12) + ); + assertThat(outputStorage.getStored()).isEqualTo(12); + } + + @Test + void shouldRespectAllowlistFilter( + @InjectNetworkStorageComponent(networkId = "input") final StorageNetworkComponent inputStorage, + @InjectNetworkStorageComponent(networkId = "output") final StorageNetworkComponent outputStorage + ) { + // Arrange + input.setActive(true); + input.setOutputNode(output); + input.setFilters(Set.of(A, B)); + input.setFilterMode(FilterMode.ALLOW); + + inputStorage.addSource(new InMemoryStorageImpl()); + inputStorage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); + inputStorage.insert(B, 9, Action.EXECUTE, EmptyActor.INSTANCE); + inputStorage.insert(C, 8, Action.EXECUTE, EmptyActor.INSTANCE); + + // Act + input.setComponentTypes(Set.of(RelayComponentType.STORAGE)); + + // This update should arrive. + inputStorage.insert(A, 1, Action.EXECUTE, EmptyActor.INSTANCE); + // This one shouldn't. + inputStorage.insert(C, 3, Action.EXECUTE, EmptyActor.INSTANCE); + + final long insertedAllowed = outputStorage.insert(A, 2, Action.EXECUTE, EmptyActor.INSTANCE); + final long insertedNotAllowed = outputStorage.insert(C, 1, Action.EXECUTE, EmptyActor.INSTANCE); + + final long extractedAllowed = outputStorage.extract(A, 1, Action.EXECUTE, EmptyActor.INSTANCE); + final long extractedNotAllowed = outputStorage.extract(C, 1, Action.EXECUTE, EmptyActor.INSTANCE); + + // Assert + assertThat(insertedAllowed).isEqualTo(2); + assertThat(insertedNotAllowed).isZero(); + + assertThat(extractedAllowed).isEqualTo(1); + assertThat(extractedNotAllowed).isZero(); + + assertThat(inputStorage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( + new ResourceAmount(A, 12), + new ResourceAmount(B, 9), + new ResourceAmount(C, 11) + ); + assertThat(inputStorage.getStored()).isEqualTo(12 + 9 + 11); + + assertThat(outputStorage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( + new ResourceAmount(A, 12), + new ResourceAmount(B, 9) + ); + assertThat(outputStorage.getStored()).isEqualTo(12 + 9); + } + + @Test + void shouldRespectFilterNormalizer( + @InjectNetworkStorageComponent(networkId = "input") final StorageNetworkComponent inputStorage, + @InjectNetworkStorageComponent(networkId = "output") final StorageNetworkComponent outputStorage + ) { + // Arrange + input.setActive(true); + input.setOutputNode(output); + input.setFilters(Set.of(A, B)); + input.setFilterMode(FilterMode.ALLOW); + input.setFilterNormalizer(resource -> { + if (resource == A_ALTERNATIVE) { + return A; + } + return resource; + }); + + inputStorage.addSource(new InMemoryStorageImpl()); + inputStorage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); + inputStorage.insert(A_ALTERNATIVE, 3, Action.EXECUTE, EmptyActor.INSTANCE); + inputStorage.insert(B, 9, Action.EXECUTE, EmptyActor.INSTANCE); + inputStorage.insert(C, 8, Action.EXECUTE, EmptyActor.INSTANCE); + + // Act + input.setComponentTypes(Set.of(RelayComponentType.STORAGE)); + + // These updates should arrive. + inputStorage.insert(A, 1, Action.EXECUTE, EmptyActor.INSTANCE); + inputStorage.insert(A_ALTERNATIVE, 2, Action.EXECUTE, EmptyActor.INSTANCE); + // This one shouldn't. + inputStorage.insert(C, 3, Action.EXECUTE, EmptyActor.INSTANCE); + + final long insertedAllowed1 = outputStorage.insert(A, 2, Action.EXECUTE, EmptyActor.INSTANCE); + final long insertedAllowed2 = outputStorage.insert(A_ALTERNATIVE, 3, Action.EXECUTE, EmptyActor.INSTANCE); + final long insertedNotAllowed = outputStorage.insert(C, 1, Action.EXECUTE, EmptyActor.INSTANCE); + + final long extractedAllowed = outputStorage.extract(A, 1, Action.EXECUTE, EmptyActor.INSTANCE); + final long extractedAllowed2 = outputStorage.extract(A_ALTERNATIVE, 2, Action.EXECUTE, EmptyActor.INSTANCE); + final long extractedNotAllowed = outputStorage.extract(C, 1, Action.EXECUTE, EmptyActor.INSTANCE); + + // Assert + assertThat(insertedAllowed1).isEqualTo(2); + assertThat(insertedAllowed2).isEqualTo(3); + assertThat(insertedNotAllowed).isZero(); + + assertThat(extractedAllowed).isEqualTo(1); + assertThat(extractedAllowed2).isEqualTo(2); + assertThat(extractedNotAllowed).isZero(); + + assertThat(inputStorage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( + new ResourceAmount(A, 12), + new ResourceAmount(A_ALTERNATIVE, 6), + new ResourceAmount(B, 9), + new ResourceAmount(C, 11) + ); + assertThat(inputStorage.getStored()).isEqualTo(12 + 6 + 9 + 11); + + assertThat(outputStorage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( + new ResourceAmount(A, 12), + new ResourceAmount(A_ALTERNATIVE, 6), + new ResourceAmount(B, 9) + ); + assertThat(outputStorage.getStored()).isEqualTo(12 + 6 + 9); + } + + @Test + void shouldUpdateOutputStorageWhenFiltersAreChanged( + @InjectNetworkStorageComponent(networkId = "input") final StorageNetworkComponent inputStorage, + @InjectNetworkStorageComponent(networkId = "output") final StorageNetworkComponent outputStorage + ) { + // Arrange + input.setActive(true); + input.setOutputNode(output); + input.setFilters(Set.of(A)); + input.setFilterMode(FilterMode.BLOCK); + + inputStorage.addSource(new InMemoryStorageImpl()); + inputStorage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); + inputStorage.insert(B, 9, Action.EXECUTE, EmptyActor.INSTANCE); + inputStorage.insert(C, 8, Action.EXECUTE, EmptyActor.INSTANCE); + + // Act + input.setComponentTypes(Set.of(RelayComponentType.STORAGE)); + input.setFilters(Set.of(B)); + + // Assert + assertThat(inputStorage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( + new ResourceAmount(A, 10), + new ResourceAmount(B, 9), + new ResourceAmount(C, 8) + ); + assertThat(inputStorage.getStored()).isEqualTo(10 + 9 + 8); + + assertThat(outputStorage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( + new ResourceAmount(A, 10), + new ResourceAmount(C, 8) + ); + assertThat(outputStorage.getStored()).isEqualTo(10 + 8); + } + + @Test + void shouldUpdateOutputStorageWhenFilterModeIsChanged( + @InjectNetworkStorageComponent(networkId = "input") final StorageNetworkComponent inputStorage, + @InjectNetworkStorageComponent(networkId = "output") final StorageNetworkComponent outputStorage + ) { + // Arrange + input.setActive(true); + input.setOutputNode(output); + input.setFilters(Set.of(A)); + input.setFilterMode(FilterMode.BLOCK); + + inputStorage.addSource(new InMemoryStorageImpl()); + inputStorage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); + inputStorage.insert(B, 9, Action.EXECUTE, EmptyActor.INSTANCE); + inputStorage.insert(C, 8, Action.EXECUTE, EmptyActor.INSTANCE); + + // Act + input.setComponentTypes(Set.of(RelayComponentType.STORAGE)); + input.setFilterMode(FilterMode.ALLOW); + + // Assert + assertThat(inputStorage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( + new ResourceAmount(A, 10), + new ResourceAmount(B, 9), + new ResourceAmount(C, 8) + ); + assertThat(inputStorage.getStored()).isEqualTo(10 + 9 + 8); + + assertThat(outputStorage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactlyInAnyOrder( + new ResourceAmount(A, 10) + ); + assertThat(outputStorage.getStored()).isEqualTo(10); + } + + @Test + @SetupNetwork(id = "cycle_input", energyStored = 1, energyCapacity = 2) + @SetupNetwork(id = "cycle_input_alt", energyStored = 3, energyCapacity = 4) + void shouldDetectStorageCycles( + @InjectNetwork("cycle_input") final Network inputNetwork, + @InjectNetworkStorageComponent(networkId = "cycle_input") final StorageNetworkComponent inputStorage, + @InjectNetwork("cycle_input_alt") final Network inputAlternativeNetwork, + @InjectNetworkStorageComponent(networkId = "cycle_input_alt") + final StorageNetworkComponent inputAlternativeStorage + ) { + // Act + final RelayOutputNetworkNode cycleOutput = new RelayOutputNetworkNode(0); + cycleOutput.setStorageDelegate(inputAlternativeStorage); + cycleOutput.setNetwork(inputNetwork); + inputNetwork.addContainer(() -> cycleOutput); + + final RelayOutputNetworkNode cycleOutputAlternative = new RelayOutputNetworkNode(0); + cycleOutputAlternative.setStorageDelegate(inputStorage); + cycleOutputAlternative.setNetwork(inputAlternativeNetwork); + inputAlternativeNetwork.addContainer(() -> cycleOutputAlternative); + + inputStorage.addSource(new InMemoryStorageImpl()); + + // Assert + final long inserted1 = inputStorage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); + final long inserted2 = inputAlternativeStorage.insert(A, 2, Action.EXECUTE, EmptyActor.INSTANCE); + + final long extracted1 = inputStorage.extract(A, 1, Action.EXECUTE, EmptyActor.INSTANCE); + final long extracted2 = inputAlternativeStorage.extract(A, 1, Action.EXECUTE, EmptyActor.INSTANCE); + + assertThat(inserted1).isEqualTo(10); + assertThat(inserted2).isZero(); + + assertThat(extracted1).isEqualTo(1); + assertThat(extracted2).isZero(); + + assertThat(inputStorage.getAll()).usingRecursiveFieldByFieldElementComparator().containsExactly( + new ResourceAmount(A, 9) + ); + assertThat(inputAlternativeStorage.getAll()).isEmpty(); + + assertThat(inputStorage.getStored()).isEqualTo(9); + assertThat(inputAlternativeStorage.getStored()).isZero(); + } +} diff --git a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/storage/StorageNetworkNodeTest.java b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/storage/StorageNetworkNodeTest.java index fce1733f2..bb04a9e36 100644 --- a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/storage/StorageNetworkNodeTest.java +++ b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/node/storage/StorageNetworkNodeTest.java @@ -1,20 +1,20 @@ package com.refinedmods.refinedstorage2.api.network.impl.node.storage; import com.refinedmods.refinedstorage2.api.core.Action; +import com.refinedmods.refinedstorage2.api.network.storage.StorageNetworkComponent; import com.refinedmods.refinedstorage2.api.resource.ResourceAmount; import com.refinedmods.refinedstorage2.api.resource.filter.FilterMode; import com.refinedmods.refinedstorage2.api.storage.AccessMode; import com.refinedmods.refinedstorage2.api.storage.EmptyActor; import com.refinedmods.refinedstorage2.api.storage.Storage; -import com.refinedmods.refinedstorage2.api.storage.channel.StorageChannel; import com.refinedmods.refinedstorage2.api.storage.limited.LimitedStorage; import com.refinedmods.refinedstorage2.api.storage.limited.LimitedStorageImpl; import com.refinedmods.refinedstorage2.api.storage.tracked.TrackedStorageImpl; import com.refinedmods.refinedstorage2.network.test.AddNetworkNode; -import com.refinedmods.refinedstorage2.network.test.InjectNetworkStorageChannel; +import com.refinedmods.refinedstorage2.network.test.InjectNetworkStorageComponent; import com.refinedmods.refinedstorage2.network.test.NetworkTest; import com.refinedmods.refinedstorage2.network.test.SetupNetwork; -import com.refinedmods.refinedstorage2.network.test.util.FakeActor; +import com.refinedmods.refinedstorage2.network.test.fake.FakeActor; import java.util.Collection; import java.util.Set; @@ -25,9 +25,9 @@ import org.junit.jupiter.params.provider.EnumSource; import org.junit.jupiter.params.provider.ValueSource; -import static com.refinedmods.refinedstorage2.network.test.TestResource.A; -import static com.refinedmods.refinedstorage2.network.test.TestResource.B; -import static com.refinedmods.refinedstorage2.network.test.TestResource.C; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.A; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.B; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.C; import static com.refinedmods.refinedstorage2.network.test.nodefactory.AbstractNetworkNodeFactory.PROPERTY_ENERGY_USAGE; import static org.assertj.core.api.Assertions.assertThat; @@ -42,7 +42,7 @@ class StorageNetworkNodeTest { StorageNetworkNode sut; @Test - void testInitialState(@InjectNetworkStorageChannel final StorageChannel networkStorage) { + void testInitialState(@InjectNetworkStorageComponent final StorageNetworkComponent networkStorage) { // Act final long inserted = networkStorage.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); final long extracted = networkStorage.extract(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); @@ -61,7 +61,7 @@ void testInitialState(@InjectNetworkStorageChannel final StorageChannel networkS } @Test - void shouldInitialize(@InjectNetworkStorageChannel final StorageChannel networkStorage) { + void shouldInitialize(@InjectNetworkStorageComponent final StorageNetworkComponent networkStorage) { // Arrange final LimitedStorage limitedStorage = new LimitedStorageImpl(100); limitedStorage.insert(A, 50, Action.EXECUTE, EmptyActor.INSTANCE); @@ -78,7 +78,7 @@ void shouldInitialize(@InjectNetworkStorageChannel final StorageChannel networkS } @Test - void shouldInsert(@InjectNetworkStorageChannel final StorageChannel networkStorage) { + void shouldInsert(@InjectNetworkStorageComponent final StorageNetworkComponent networkStorage) { // Arrange final Storage storage = new LimitedStorageImpl(100); activateStorage(storage); @@ -97,7 +97,7 @@ void shouldInsert(@InjectNetworkStorageChannel final StorageChannel networkStora } @Test - void shouldExtract(@InjectNetworkStorageChannel final StorageChannel networkStorage) { + void shouldExtract(@InjectNetworkStorageComponent final StorageNetworkComponent networkStorage) { // Arrange final Storage storage = new LimitedStorageImpl(200); storage.insert(A, 100, Action.EXECUTE, EmptyActor.INSTANCE); @@ -120,7 +120,8 @@ void shouldExtract(@InjectNetworkStorageChannel final StorageChannel networkStor } @Test - void shouldRespectAllowlistWhenInserting(@InjectNetworkStorageChannel final StorageChannel networkStorage) { + void shouldRespectAllowlistWhenInserting( + @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage) { // Arrange sut.setFilterMode(FilterMode.ALLOW); sut.setFilters(Set.of(A, B)); @@ -141,7 +142,7 @@ void shouldRespectAllowlistWhenInserting(@InjectNetworkStorageChannel final Stor @Test void shouldRespectEmptyAllowlistWhenInserting( - @InjectNetworkStorageChannel final StorageChannel networkStorage) { + @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage) { // Arrange sut.setFilterMode(FilterMode.ALLOW); sut.setFilters(Set.of()); @@ -161,7 +162,8 @@ void shouldRespectEmptyAllowlistWhenInserting( } @Test - void shouldRespectBlocklistWhenInserting(@InjectNetworkStorageChannel final StorageChannel networkStorage) { + void shouldRespectBlocklistWhenInserting( + @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage) { // Arrange sut.setFilterMode(FilterMode.BLOCK); sut.setFilters(Set.of(A, B)); @@ -182,7 +184,7 @@ void shouldRespectBlocklistWhenInserting(@InjectNetworkStorageChannel final Stor @Test void shouldRespectEmptyBlocklistWhenInserting( - @InjectNetworkStorageChannel final StorageChannel networkStorage) { + @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage) { // Arrange sut.setFilterMode(FilterMode.BLOCK); sut.setFilters(Set.of()); @@ -204,7 +206,8 @@ void shouldRespectEmptyBlocklistWhenInserting( @ParameterizedTest @EnumSource(AccessMode.class) void shouldRespectAccessModeWhenInserting(final AccessMode accessMode, - @InjectNetworkStorageChannel final StorageChannel networkStorage + @InjectNetworkStorageComponent + final StorageNetworkComponent networkStorage ) { // Arrange sut.setAccessMode(accessMode); @@ -225,7 +228,8 @@ void shouldRespectAccessModeWhenInserting(final AccessMode accessMode, @ParameterizedTest @EnumSource(AccessMode.class) void shouldRespectAccessModeWhenExtracting(final AccessMode accessMode, - @InjectNetworkStorageChannel final StorageChannel networkStorage + @InjectNetworkStorageComponent + final StorageNetworkComponent networkStorage ) { // Arrange sut.setAccessMode(accessMode); @@ -245,7 +249,7 @@ void shouldRespectAccessModeWhenExtracting(final AccessMode accessMode, } @Test - void shouldNotInsertWhenInactive(@InjectNetworkStorageChannel final StorageChannel networkStorage) { + void shouldNotInsertWhenInactive(@InjectNetworkStorageComponent final StorageNetworkComponent networkStorage) { // Arrange final Storage storage = new LimitedStorageImpl(100); activateStorage(storage); @@ -259,7 +263,7 @@ void shouldNotInsertWhenInactive(@InjectNetworkStorageChannel final StorageChann } @Test - void shouldNotExtractWhenInactive(@InjectNetworkStorageChannel final StorageChannel networkStorage) { + void shouldNotExtractWhenInactive(@InjectNetworkStorageComponent final StorageNetworkComponent networkStorage) { // Arrange final Storage storage = new LimitedStorageImpl(100); activateStorage(storage); @@ -275,7 +279,7 @@ void shouldNotExtractWhenInactive(@InjectNetworkStorageChannel final StorageChan @Test void shouldHideStorageContentsWhenInactive( - @InjectNetworkStorageChannel final StorageChannel networkStorage + @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage ) { // Arrange final Storage storage = new LimitedStorageImpl(100); @@ -291,7 +295,8 @@ void shouldHideStorageContentsWhenInactive( } @Test - void shouldShowStorageContentsWhenActive(@InjectNetworkStorageChannel final StorageChannel networkStorage) { + void shouldShowStorageContentsWhenActive( + @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage) { // Arrange final Storage storage = new LimitedStorageImpl(100); storage.insert(A, 50, Action.EXECUTE, EmptyActor.INSTANCE); @@ -308,7 +313,7 @@ void shouldShowStorageContentsWhenActive(@InjectNetworkStorageChannel final Stor } @Test - void shouldNotInsertWhenFull(@InjectNetworkStorageChannel final StorageChannel networkStorage) { + void shouldNotInsertWhenFull(@InjectNetworkStorageComponent final StorageNetworkComponent networkStorage) { // Arrange final Storage storage = new LimitedStorageImpl(100); storage.insert(A, 95, Action.EXECUTE, EmptyActor.INSTANCE); @@ -334,7 +339,7 @@ void shouldNotInsertWhenFull(@InjectNetworkStorageChannel final StorageChannel n @Test void shouldNotInsertWhenFullWhenStorageVoidsExcessButIsNotInAllowlistMode( - @InjectNetworkStorageChannel final StorageChannel networkStorage + @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage ) { // Arrange final LimitedStorageImpl storage = new LimitedStorageImpl(100); @@ -355,7 +360,7 @@ void shouldNotInsertWhenFullWhenStorageVoidsExcessButIsNotInAllowlistMode( @Test void shouldNotInsertWhenStorageVoidsExcessAndInAllowlistModeWithoutConfiguredFilter( - @InjectNetworkStorageChannel final StorageChannel networkStorage + @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage ) { // Arrange final LimitedStorageImpl storage = new LimitedStorageImpl(100); @@ -374,7 +379,7 @@ void shouldNotInsertWhenStorageVoidsExcessAndInAllowlistModeWithoutConfiguredFil @Test void shouldInsertWhenFullWhenStorageVoidsExcessAndIsInAllowlistMode( - @InjectNetworkStorageChannel final StorageChannel networkStorage + @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage ) { // Arrange final LimitedStorageImpl storage = new LimitedStorageImpl(100); @@ -400,7 +405,7 @@ void shouldInsertWhenFullWhenStorageVoidsExcessAndIsInAllowlistMode( } @Test - void shouldTrackChanges(@InjectNetworkStorageChannel final StorageChannel networkStorage) { + void shouldTrackChanges(@InjectNetworkStorageComponent final StorageNetworkComponent networkStorage) { // Arrange activateStorage(new TrackedStorageImpl(new LimitedStorageImpl(100), () -> 0L)); @@ -426,7 +431,7 @@ class PriorityTest { @ValueSource(booleans = {true, false}) void shouldRespectPriority( final boolean oneHasPriority, - @InjectNetworkStorageChannel final StorageChannel networkStorage + @InjectNetworkStorageComponent final StorageNetworkComponent networkStorage ) { // Arrange final LimitedStorageImpl storage1 = new LimitedStorageImpl(100); diff --git a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/security/SecurityNetworkComponentImplTest.java b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/security/SecurityNetworkComponentImplTest.java index 596534a0c..50494ba03 100644 --- a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/security/SecurityNetworkComponentImplTest.java +++ b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/security/SecurityNetworkComponentImplTest.java @@ -1,17 +1,15 @@ package com.refinedmods.refinedstorage2.api.network.impl.security; import com.refinedmods.refinedstorage2.api.network.impl.node.security.SecurityDecisionProviderProxyNetworkNode; -import com.refinedmods.refinedstorage2.api.network.security.Permission; -import com.refinedmods.refinedstorage2.api.network.security.SecurityActor; -import com.refinedmods.refinedstorage2.api.network.security.SecurityDecisionProvider; import com.refinedmods.refinedstorage2.api.network.security.SecurityNetworkComponent; import com.refinedmods.refinedstorage2.api.network.security.SecurityPolicy; - -import java.util.Set; +import com.refinedmods.refinedstorage2.network.test.fake.FakePermissions; +import com.refinedmods.refinedstorage2.network.test.fake.FakeSecurityActors; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import static com.refinedmods.refinedstorage2.api.network.impl.node.security.SecurityDecisionProviderProxyNetworkNode.activeSecurityDecisionProvider; import static org.assertj.core.api.Assertions.assertThat; class SecurityNetworkComponentImplTest { @@ -21,21 +19,21 @@ class SecurityNetworkComponentImplTest { @BeforeEach void setUp() { - sut = new SecurityNetworkComponentImpl(policy(TestPermissions.ALLOW_BY_DEFAULT)); + sut = new SecurityNetworkComponentImpl(SecurityPolicy.of(FakePermissions.ALLOW_BY_DEFAULT)); securityDecisionProvider = new SecurityDecisionProviderImpl(); - node = createNode(securityDecisionProvider); + node = activeSecurityDecisionProvider(securityDecisionProvider); } @Test void shouldUseDefaultPolicyIfNoSecurityDecisionProvidersArePresent() { // Act & assert - assertThat(sut.isAllowed(TestPermissions.ALLOW_BY_DEFAULT, TestActors.A)).isTrue(); - assertThat(sut.isAllowed(TestPermissions.OTHER, TestActors.A)).isFalse(); - assertThat(sut.isAllowed(TestPermissions.OTHER2, TestActors.A)).isFalse(); + assertThat(sut.isAllowed(FakePermissions.ALLOW_BY_DEFAULT, FakeSecurityActors.A)).isTrue(); + assertThat(sut.isAllowed(FakePermissions.OTHER, FakeSecurityActors.A)).isFalse(); + assertThat(sut.isAllowed(FakePermissions.OTHER2, FakeSecurityActors.A)).isFalse(); - assertThat(sut.isAllowed(TestPermissions.ALLOW_BY_DEFAULT, TestActors.B)).isTrue(); - assertThat(sut.isAllowed(TestPermissions.OTHER, TestActors.B)).isFalse(); - assertThat(sut.isAllowed(TestPermissions.OTHER2, TestActors.B)).isFalse(); + assertThat(sut.isAllowed(FakePermissions.ALLOW_BY_DEFAULT, FakeSecurityActors.B)).isTrue(); + assertThat(sut.isAllowed(FakePermissions.OTHER, FakeSecurityActors.B)).isFalse(); + assertThat(sut.isAllowed(FakePermissions.OTHER2, FakeSecurityActors.B)).isFalse(); } @Test @@ -44,161 +42,138 @@ void shouldDenyAllIfAtLeastOneSecurityDecisionProviderIsPresent() { sut.onContainerAdded(() -> node); // Act & assert - assertThat(sut.isAllowed(TestPermissions.ALLOW_BY_DEFAULT, TestActors.A)).isFalse(); - assertThat(sut.isAllowed(TestPermissions.OTHER, TestActors.A)).isFalse(); - assertThat(sut.isAllowed(TestPermissions.OTHER2, TestActors.A)).isFalse(); + assertThat(sut.isAllowed(FakePermissions.ALLOW_BY_DEFAULT, FakeSecurityActors.A)).isFalse(); + assertThat(sut.isAllowed(FakePermissions.OTHER, FakeSecurityActors.A)).isFalse(); + assertThat(sut.isAllowed(FakePermissions.OTHER2, FakeSecurityActors.A)).isFalse(); - assertThat(sut.isAllowed(TestPermissions.ALLOW_BY_DEFAULT, TestActors.B)).isFalse(); - assertThat(sut.isAllowed(TestPermissions.OTHER, TestActors.B)).isFalse(); - assertThat(sut.isAllowed(TestPermissions.OTHER2, TestActors.B)).isFalse(); + assertThat(sut.isAllowed(FakePermissions.ALLOW_BY_DEFAULT, FakeSecurityActors.B)).isFalse(); + assertThat(sut.isAllowed(FakePermissions.OTHER, FakeSecurityActors.B)).isFalse(); + assertThat(sut.isAllowed(FakePermissions.OTHER2, FakeSecurityActors.B)).isFalse(); } @Test void shouldUseDefaultPolicyIfAllSecurityDecisionProvidersAreInactive() { // Arrange - sut.onContainerAdded(() -> createNode(new SecurityDecisionProviderImpl() - .setDefaultPolicy(policy(TestPermissions.OTHER)), false)); + sut.onContainerAdded(() -> new SecurityDecisionProviderProxyNetworkNode(0, new SecurityDecisionProviderImpl() + .setDefaultPolicy(SecurityPolicy.of(FakePermissions.OTHER)))); // Act & assert - assertThat(sut.isAllowed(TestPermissions.ALLOW_BY_DEFAULT, TestActors.A)).isTrue(); - assertThat(sut.isAllowed(TestPermissions.OTHER, TestActors.A)).isFalse(); - assertThat(sut.isAllowed(TestPermissions.OTHER2, TestActors.A)).isFalse(); + assertThat(sut.isAllowed(FakePermissions.ALLOW_BY_DEFAULT, FakeSecurityActors.A)).isTrue(); + assertThat(sut.isAllowed(FakePermissions.OTHER, FakeSecurityActors.A)).isFalse(); + assertThat(sut.isAllowed(FakePermissions.OTHER2, FakeSecurityActors.A)).isFalse(); - assertThat(sut.isAllowed(TestPermissions.ALLOW_BY_DEFAULT, TestActors.B)).isTrue(); - assertThat(sut.isAllowed(TestPermissions.OTHER, TestActors.B)).isFalse(); - assertThat(sut.isAllowed(TestPermissions.OTHER2, TestActors.B)).isFalse(); + assertThat(sut.isAllowed(FakePermissions.ALLOW_BY_DEFAULT, FakeSecurityActors.B)).isTrue(); + assertThat(sut.isAllowed(FakePermissions.OTHER, FakeSecurityActors.B)).isFalse(); + assertThat(sut.isAllowed(FakePermissions.OTHER2, FakeSecurityActors.B)).isFalse(); } @Test void shouldAllowOrDeny() { // Arrange - securityDecisionProvider.setPolicy(TestActors.A, policy(TestPermissions.OTHER)); + securityDecisionProvider.setPolicy(FakeSecurityActors.A, SecurityPolicy.of(FakePermissions.OTHER)); sut.onContainerAdded(() -> node); // Act & assert - assertThat(sut.isAllowed(TestPermissions.ALLOW_BY_DEFAULT, TestActors.A)).isFalse(); - assertThat(sut.isAllowed(TestPermissions.OTHER, TestActors.A)).isTrue(); - assertThat(sut.isAllowed(TestPermissions.OTHER2, TestActors.A)).isFalse(); + assertThat(sut.isAllowed(FakePermissions.ALLOW_BY_DEFAULT, FakeSecurityActors.A)).isFalse(); + assertThat(sut.isAllowed(FakePermissions.OTHER, FakeSecurityActors.A)).isTrue(); + assertThat(sut.isAllowed(FakePermissions.OTHER2, FakeSecurityActors.A)).isFalse(); - assertThat(sut.isAllowed(TestPermissions.ALLOW_BY_DEFAULT, TestActors.B)).isFalse(); - assertThat(sut.isAllowed(TestPermissions.OTHER, TestActors.B)).isFalse(); - assertThat(sut.isAllowed(TestPermissions.OTHER2, TestActors.B)).isFalse(); + assertThat(sut.isAllowed(FakePermissions.ALLOW_BY_DEFAULT, FakeSecurityActors.B)).isFalse(); + assertThat(sut.isAllowed(FakePermissions.OTHER, FakeSecurityActors.B)).isFalse(); + assertThat(sut.isAllowed(FakePermissions.OTHER2, FakeSecurityActors.B)).isFalse(); } @Test void shouldOnlyAllowIfAllSecurityDecisionProvidersAllow() { // Arrange - sut.onContainerAdded(() -> createNode(new SecurityDecisionProviderImpl() - .setPolicy(TestActors.A, policy(TestPermissions.OTHER)) + sut.onContainerAdded(() -> activeSecurityDecisionProvider(new SecurityDecisionProviderImpl() + .setPolicy(FakeSecurityActors.A, SecurityPolicy.of(FakePermissions.OTHER)) )); - sut.onContainerAdded(() -> createNode(new SecurityDecisionProviderImpl() - .setPolicy(TestActors.A, policy(TestPermissions.OTHER2)) + sut.onContainerAdded(() -> activeSecurityDecisionProvider(new SecurityDecisionProviderImpl() + .setPolicy(FakeSecurityActors.A, SecurityPolicy.of(FakePermissions.OTHER2)) )); - sut.onContainerAdded(() -> createNode(new SecurityDecisionProviderImpl() - .setPolicy(TestActors.B, policy(TestPermissions.OTHER)) + sut.onContainerAdded(() -> activeSecurityDecisionProvider(new SecurityDecisionProviderImpl() + .setPolicy(FakeSecurityActors.B, SecurityPolicy.of(FakePermissions.OTHER)) )); - sut.onContainerAdded(() -> createNode(new SecurityDecisionProviderImpl() - .setPolicy(TestActors.A, policy(TestPermissions.ALLOW_BY_DEFAULT)) - .setDefaultPolicy(policy(TestPermissions.OTHER, TestPermissions.OTHER2)), false)); + sut.onContainerAdded(() -> new SecurityDecisionProviderProxyNetworkNode(0, new SecurityDecisionProviderImpl() + .setPolicy(FakeSecurityActors.A, SecurityPolicy.of(FakePermissions.ALLOW_BY_DEFAULT)) + .setDefaultPolicy(SecurityPolicy.of(FakePermissions.OTHER, FakePermissions.OTHER2)))); // Act & assert - assertThat(sut.isAllowed(TestPermissions.OTHER, TestActors.A)).isFalse(); - assertThat(sut.isAllowed(TestPermissions.OTHER2, TestActors.A)).isFalse(); + assertThat(sut.isAllowed(FakePermissions.OTHER, FakeSecurityActors.A)).isFalse(); + assertThat(sut.isAllowed(FakePermissions.OTHER2, FakeSecurityActors.A)).isFalse(); - assertThat(sut.isAllowed(TestPermissions.OTHER, TestActors.B)).isTrue(); - assertThat(sut.isAllowed(TestPermissions.OTHER2, TestActors.B)).isFalse(); + assertThat(sut.isAllowed(FakePermissions.OTHER, FakeSecurityActors.B)).isTrue(); + assertThat(sut.isAllowed(FakePermissions.OTHER2, FakeSecurityActors.B)).isFalse(); - assertThat(sut.isAllowed(TestPermissions.OTHER, TestActors.C)).isFalse(); - assertThat(sut.isAllowed(TestPermissions.OTHER2, TestActors.C)).isFalse(); + assertThat(sut.isAllowed(FakePermissions.OTHER, FakeSecurityActors.C)).isFalse(); + assertThat(sut.isAllowed(FakePermissions.OTHER2, FakeSecurityActors.C)).isFalse(); } @Test void shouldUseDefaultPolicyOfSecurityDecisionProviderIfAllProvidersPassDecision() { // Arrange - sut.onContainerAdded(() -> createNode(new SecurityDecisionProviderImpl() - .setPolicy(TestActors.A, policy(TestPermissions.OTHER)) - .setDefaultPolicy(policy(TestPermissions.ALLOW_BY_DEFAULT)) + sut.onContainerAdded(() -> activeSecurityDecisionProvider(new SecurityDecisionProviderImpl() + .setPolicy(FakeSecurityActors.A, SecurityPolicy.of(FakePermissions.OTHER)) + .setDefaultPolicy(SecurityPolicy.of(FakePermissions.ALLOW_BY_DEFAULT)) )); - sut.onContainerAdded(() -> createNode(new SecurityDecisionProviderImpl() - .setPolicy(TestActors.A, policy(TestPermissions.OTHER)) - .setDefaultPolicy(policy(TestPermissions.ALLOW_BY_DEFAULT, TestPermissions.OTHER2)) + sut.onContainerAdded(() -> activeSecurityDecisionProvider(new SecurityDecisionProviderImpl() + .setPolicy(FakeSecurityActors.A, SecurityPolicy.of(FakePermissions.OTHER)) + .setDefaultPolicy(SecurityPolicy.of(FakePermissions.ALLOW_BY_DEFAULT, FakePermissions.OTHER2)) )); - sut.onContainerAdded(() -> createNode(new SecurityDecisionProviderImpl() - .setPolicy(TestActors.C, policy(TestPermissions.OTHER)) + sut.onContainerAdded(() -> activeSecurityDecisionProvider(new SecurityDecisionProviderImpl() + .setPolicy(FakeSecurityActors.C, SecurityPolicy.of(FakePermissions.OTHER)) )); // Act & assert - assertThat(sut.isAllowed(TestPermissions.ALLOW_BY_DEFAULT, TestActors.A)).isFalse(); - assertThat(sut.isAllowed(TestPermissions.OTHER, TestActors.A)).isTrue(); - assertThat(sut.isAllowed(TestPermissions.OTHER2, TestActors.A)).isFalse(); + assertThat(sut.isAllowed(FakePermissions.ALLOW_BY_DEFAULT, FakeSecurityActors.A)).isFalse(); + assertThat(sut.isAllowed(FakePermissions.OTHER, FakeSecurityActors.A)).isTrue(); + assertThat(sut.isAllowed(FakePermissions.OTHER2, FakeSecurityActors.A)).isFalse(); - assertThat(sut.isAllowed(TestPermissions.ALLOW_BY_DEFAULT, TestActors.B)).isTrue(); - assertThat(sut.isAllowed(TestPermissions.OTHER, TestActors.B)).isFalse(); - assertThat(sut.isAllowed(TestPermissions.OTHER2, TestActors.B)).isFalse(); + assertThat(sut.isAllowed(FakePermissions.ALLOW_BY_DEFAULT, FakeSecurityActors.B)).isTrue(); + assertThat(sut.isAllowed(FakePermissions.OTHER, FakeSecurityActors.B)).isFalse(); + assertThat(sut.isAllowed(FakePermissions.OTHER2, FakeSecurityActors.B)).isFalse(); - assertThat(sut.isAllowed(TestPermissions.ALLOW_BY_DEFAULT, TestActors.C)).isFalse(); - assertThat(sut.isAllowed(TestPermissions.OTHER, TestActors.C)).isTrue(); - assertThat(sut.isAllowed(TestPermissions.OTHER2, TestActors.C)).isFalse(); + assertThat(sut.isAllowed(FakePermissions.ALLOW_BY_DEFAULT, FakeSecurityActors.C)).isFalse(); + assertThat(sut.isAllowed(FakePermissions.OTHER, FakeSecurityActors.C)).isTrue(); + assertThat(sut.isAllowed(FakePermissions.OTHER2, FakeSecurityActors.C)).isFalse(); } @Test void shouldRemoveContainer() { // Arrange - sut.onContainerAdded(() -> createNode(new SecurityDecisionProviderImpl() - .setDefaultPolicy(policy(TestPermissions.ALLOW_BY_DEFAULT)) + sut.onContainerAdded(() -> activeSecurityDecisionProvider(new SecurityDecisionProviderImpl() + .setDefaultPolicy(SecurityPolicy.of(FakePermissions.ALLOW_BY_DEFAULT)) )); - final var removedNode = createNode(new SecurityDecisionProviderImpl() - .setDefaultPolicy(policy(TestPermissions.OTHER))); + final var removedNode = activeSecurityDecisionProvider(new SecurityDecisionProviderImpl() + .setDefaultPolicy(SecurityPolicy.of(FakePermissions.OTHER))); sut.onContainerAdded(() -> removedNode); // Act sut.onContainerRemoved(() -> removedNode); // Assert - assertThat(sut.isAllowed(TestPermissions.ALLOW_BY_DEFAULT, TestActors.A)).isTrue(); + assertThat(sut.isAllowed(FakePermissions.ALLOW_BY_DEFAULT, FakeSecurityActors.A)).isTrue(); } @Test void shouldClearPolicies() { // Arrange sut.onContainerAdded(() -> node); - securityDecisionProvider.setPolicy(TestActors.A, policy(TestPermissions.OTHER)); - securityDecisionProvider.setDefaultPolicy(policy(TestPermissions.OTHER2)); + securityDecisionProvider.setPolicy(FakeSecurityActors.A, SecurityPolicy.of(FakePermissions.OTHER)); + securityDecisionProvider.setDefaultPolicy(SecurityPolicy.of(FakePermissions.OTHER2)); // Act securityDecisionProvider.clearPolicies(); // Assert - assertThat(sut.isAllowed(TestPermissions.OTHER, TestActors.A)).isFalse(); - assertThat(sut.isAllowed(TestPermissions.OTHER2, TestActors.A)).isTrue(); - } - - private static SecurityDecisionProviderProxyNetworkNode createNode(final SecurityDecisionProvider provider) { - return createNode(provider, true); - } - - private static SecurityDecisionProviderProxyNetworkNode createNode(final SecurityDecisionProvider provider, - final boolean active) { - final var node = new SecurityDecisionProviderProxyNetworkNode(0, provider); - node.setActive(active); - return node; - } - - enum TestPermissions implements Permission { - ALLOW_BY_DEFAULT, OTHER, OTHER2 - } - - enum TestActors implements SecurityActor { - A, B, C - } - - private SecurityPolicy policy(final Permission... permissions) { - return new SecurityPolicy(Set.of(permissions)); + assertThat(sut.isAllowed(FakePermissions.OTHER, FakeSecurityActors.A)).isFalse(); + assertThat(sut.isAllowed(FakePermissions.OTHER2, FakeSecurityActors.A)).isTrue(); } } diff --git a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/storage/StorageNetworkComponentImplTest.java b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/storage/StorageNetworkComponentImplTest.java index 0e8246008..eb99af6f1 100644 --- a/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/storage/StorageNetworkComponentImplTest.java +++ b/refinedstorage2-network/src/test/java/com/refinedmods/refinedstorage2/api/network/impl/storage/StorageNetworkComponentImplTest.java @@ -21,8 +21,8 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static com.refinedmods.refinedstorage2.network.test.TestResource.A; -import static com.refinedmods.refinedstorage2.network.test.TestResource.B; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.A; +import static com.refinedmods.refinedstorage2.network.test.fake.FakeResources.B; import static org.assertj.core.api.Assertions.assertThat; class StorageNetworkComponentImplTest { diff --git a/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/security/PlatformSecurityNetworkComponent.java b/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/security/PlatformSecurityNetworkComponent.java index 3850fd466..6b70ea03d 100644 --- a/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/security/PlatformSecurityNetworkComponent.java +++ b/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/security/PlatformSecurityNetworkComponent.java @@ -1,13 +1,12 @@ package com.refinedmods.refinedstorage2.platform.api.security; -import com.refinedmods.refinedstorage2.api.network.NetworkComponent; import com.refinedmods.refinedstorage2.api.network.security.Permission; +import com.refinedmods.refinedstorage2.api.network.security.SecurityNetworkComponent; import net.minecraft.server.level.ServerPlayer; import org.apiguardian.api.API; @API(status = API.Status.STABLE, since = "2.0.0-milestone.3.5") -@FunctionalInterface -public interface PlatformSecurityNetworkComponent extends NetworkComponent { +public interface PlatformSecurityNetworkComponent extends SecurityNetworkComponent { boolean isAllowed(Permission permission, ServerPlayer player); } diff --git a/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/support/network/AbstractNetworkNodeContainerBlockEntity.java b/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/support/network/AbstractNetworkNodeContainerBlockEntity.java index c24e9a476..583a35c81 100644 --- a/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/support/network/AbstractNetworkNodeContainerBlockEntity.java +++ b/refinedstorage2-platform-api/src/main/java/com/refinedmods/refinedstorage2/platform/api/support/network/AbstractNetworkNodeContainerBlockEntity.java @@ -33,7 +33,7 @@ protected AbstractNetworkNodeContainerBlockEntity(final BlockEntityType type, final T mainNode) { super(type, pos, state); this.mainContainer = createMainContainer(mainNode); - this.containers.add(mainContainer); + addContainer(mainContainer); this.mainNode = mainNode; } @@ -48,6 +48,14 @@ protected InWorldNetworkNodeContainer createMainContainer(final T node) { ); } + protected final void addContainer(final InWorldNetworkNodeContainer container) { + containers.add(container); + } + + protected final void updateContainers() { + containers.forEach(container -> PlatformApi.INSTANCE.onNetworkNodeContainerUpdated(container, level)); + } + @Override public void addOutgoingConnections(final ConnectionSink sink) { for (final Direction direction : Direction.values()) { diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/black_relay.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/black_relay.json new file mode 100644 index 000000000..cb770d118 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/black_relay.json @@ -0,0 +1,52 @@ +{ + "variants": { + "active=false,direction=down": { + "model": "refinedstorage2:block/relay/inactive", + "x": 90 + }, + "active=false,direction=east": { + "model": "refinedstorage2:block/relay/inactive", + "y": 90 + }, + "active=false,direction=north": { + "model": "refinedstorage2:block/relay/inactive" + }, + "active=false,direction=south": { + "model": "refinedstorage2:block/relay/inactive", + "y": 180 + }, + "active=false,direction=up": { + "model": "refinedstorage2:block/relay/inactive", + "x": -90, + "y": 180 + }, + "active=false,direction=west": { + "model": "refinedstorage2:block/relay/inactive", + "y": 270 + }, + "active=true,direction=down": { + "model": "refinedstorage2:block/relay/black", + "x": 90 + }, + "active=true,direction=east": { + "model": "refinedstorage2:block/relay/black", + "y": 90 + }, + "active=true,direction=north": { + "model": "refinedstorage2:block/relay/black" + }, + "active=true,direction=south": { + "model": "refinedstorage2:block/relay/black", + "y": 180 + }, + "active=true,direction=up": { + "model": "refinedstorage2:block/relay/black", + "x": -90, + "y": 180 + }, + "active=true,direction=west": { + "model": "refinedstorage2:block/relay/black", + "y": 270 + } + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/blue_relay.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/blue_relay.json new file mode 100644 index 000000000..795311c42 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/blue_relay.json @@ -0,0 +1,52 @@ +{ + "variants": { + "active=false,direction=down": { + "model": "refinedstorage2:block/relay/inactive", + "x": 90 + }, + "active=false,direction=east": { + "model": "refinedstorage2:block/relay/inactive", + "y": 90 + }, + "active=false,direction=north": { + "model": "refinedstorage2:block/relay/inactive" + }, + "active=false,direction=south": { + "model": "refinedstorage2:block/relay/inactive", + "y": 180 + }, + "active=false,direction=up": { + "model": "refinedstorage2:block/relay/inactive", + "x": -90, + "y": 180 + }, + "active=false,direction=west": { + "model": "refinedstorage2:block/relay/inactive", + "y": 270 + }, + "active=true,direction=down": { + "model": "refinedstorage2:block/relay/blue", + "x": 90 + }, + "active=true,direction=east": { + "model": "refinedstorage2:block/relay/blue", + "y": 90 + }, + "active=true,direction=north": { + "model": "refinedstorage2:block/relay/blue" + }, + "active=true,direction=south": { + "model": "refinedstorage2:block/relay/blue", + "y": 180 + }, + "active=true,direction=up": { + "model": "refinedstorage2:block/relay/blue", + "x": -90, + "y": 180 + }, + "active=true,direction=west": { + "model": "refinedstorage2:block/relay/blue", + "y": 270 + } + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/brown_relay.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/brown_relay.json new file mode 100644 index 000000000..749c6e38e --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/brown_relay.json @@ -0,0 +1,52 @@ +{ + "variants": { + "active=false,direction=down": { + "model": "refinedstorage2:block/relay/inactive", + "x": 90 + }, + "active=false,direction=east": { + "model": "refinedstorage2:block/relay/inactive", + "y": 90 + }, + "active=false,direction=north": { + "model": "refinedstorage2:block/relay/inactive" + }, + "active=false,direction=south": { + "model": "refinedstorage2:block/relay/inactive", + "y": 180 + }, + "active=false,direction=up": { + "model": "refinedstorage2:block/relay/inactive", + "x": -90, + "y": 180 + }, + "active=false,direction=west": { + "model": "refinedstorage2:block/relay/inactive", + "y": 270 + }, + "active=true,direction=down": { + "model": "refinedstorage2:block/relay/brown", + "x": 90 + }, + "active=true,direction=east": { + "model": "refinedstorage2:block/relay/brown", + "y": 90 + }, + "active=true,direction=north": { + "model": "refinedstorage2:block/relay/brown" + }, + "active=true,direction=south": { + "model": "refinedstorage2:block/relay/brown", + "y": 180 + }, + "active=true,direction=up": { + "model": "refinedstorage2:block/relay/brown", + "x": -90, + "y": 180 + }, + "active=true,direction=west": { + "model": "refinedstorage2:block/relay/brown", + "y": 270 + } + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/cyan_relay.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/cyan_relay.json new file mode 100644 index 000000000..a16b269c8 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/cyan_relay.json @@ -0,0 +1,52 @@ +{ + "variants": { + "active=false,direction=down": { + "model": "refinedstorage2:block/relay/inactive", + "x": 90 + }, + "active=false,direction=east": { + "model": "refinedstorage2:block/relay/inactive", + "y": 90 + }, + "active=false,direction=north": { + "model": "refinedstorage2:block/relay/inactive" + }, + "active=false,direction=south": { + "model": "refinedstorage2:block/relay/inactive", + "y": 180 + }, + "active=false,direction=up": { + "model": "refinedstorage2:block/relay/inactive", + "x": -90, + "y": 180 + }, + "active=false,direction=west": { + "model": "refinedstorage2:block/relay/inactive", + "y": 270 + }, + "active=true,direction=down": { + "model": "refinedstorage2:block/relay/cyan", + "x": 90 + }, + "active=true,direction=east": { + "model": "refinedstorage2:block/relay/cyan", + "y": 90 + }, + "active=true,direction=north": { + "model": "refinedstorage2:block/relay/cyan" + }, + "active=true,direction=south": { + "model": "refinedstorage2:block/relay/cyan", + "y": 180 + }, + "active=true,direction=up": { + "model": "refinedstorage2:block/relay/cyan", + "x": -90, + "y": 180 + }, + "active=true,direction=west": { + "model": "refinedstorage2:block/relay/cyan", + "y": 270 + } + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/gray_relay.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/gray_relay.json new file mode 100644 index 000000000..be0738666 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/gray_relay.json @@ -0,0 +1,52 @@ +{ + "variants": { + "active=false,direction=down": { + "model": "refinedstorage2:block/relay/inactive", + "x": 90 + }, + "active=false,direction=east": { + "model": "refinedstorage2:block/relay/inactive", + "y": 90 + }, + "active=false,direction=north": { + "model": "refinedstorage2:block/relay/inactive" + }, + "active=false,direction=south": { + "model": "refinedstorage2:block/relay/inactive", + "y": 180 + }, + "active=false,direction=up": { + "model": "refinedstorage2:block/relay/inactive", + "x": -90, + "y": 180 + }, + "active=false,direction=west": { + "model": "refinedstorage2:block/relay/inactive", + "y": 270 + }, + "active=true,direction=down": { + "model": "refinedstorage2:block/relay/gray", + "x": 90 + }, + "active=true,direction=east": { + "model": "refinedstorage2:block/relay/gray", + "y": 90 + }, + "active=true,direction=north": { + "model": "refinedstorage2:block/relay/gray" + }, + "active=true,direction=south": { + "model": "refinedstorage2:block/relay/gray", + "y": 180 + }, + "active=true,direction=up": { + "model": "refinedstorage2:block/relay/gray", + "x": -90, + "y": 180 + }, + "active=true,direction=west": { + "model": "refinedstorage2:block/relay/gray", + "y": 270 + } + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/green_relay.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/green_relay.json new file mode 100644 index 000000000..89112dcdb --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/green_relay.json @@ -0,0 +1,52 @@ +{ + "variants": { + "active=false,direction=down": { + "model": "refinedstorage2:block/relay/inactive", + "x": 90 + }, + "active=false,direction=east": { + "model": "refinedstorage2:block/relay/inactive", + "y": 90 + }, + "active=false,direction=north": { + "model": "refinedstorage2:block/relay/inactive" + }, + "active=false,direction=south": { + "model": "refinedstorage2:block/relay/inactive", + "y": 180 + }, + "active=false,direction=up": { + "model": "refinedstorage2:block/relay/inactive", + "x": -90, + "y": 180 + }, + "active=false,direction=west": { + "model": "refinedstorage2:block/relay/inactive", + "y": 270 + }, + "active=true,direction=down": { + "model": "refinedstorage2:block/relay/green", + "x": 90 + }, + "active=true,direction=east": { + "model": "refinedstorage2:block/relay/green", + "y": 90 + }, + "active=true,direction=north": { + "model": "refinedstorage2:block/relay/green" + }, + "active=true,direction=south": { + "model": "refinedstorage2:block/relay/green", + "y": 180 + }, + "active=true,direction=up": { + "model": "refinedstorage2:block/relay/green", + "x": -90, + "y": 180 + }, + "active=true,direction=west": { + "model": "refinedstorage2:block/relay/green", + "y": 270 + } + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/light_gray_relay.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/light_gray_relay.json new file mode 100644 index 000000000..2f3e1c1f9 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/light_gray_relay.json @@ -0,0 +1,52 @@ +{ + "variants": { + "active=false,direction=down": { + "model": "refinedstorage2:block/relay/inactive", + "x": 90 + }, + "active=false,direction=east": { + "model": "refinedstorage2:block/relay/inactive", + "y": 90 + }, + "active=false,direction=north": { + "model": "refinedstorage2:block/relay/inactive" + }, + "active=false,direction=south": { + "model": "refinedstorage2:block/relay/inactive", + "y": 180 + }, + "active=false,direction=up": { + "model": "refinedstorage2:block/relay/inactive", + "x": -90, + "y": 180 + }, + "active=false,direction=west": { + "model": "refinedstorage2:block/relay/inactive", + "y": 270 + }, + "active=true,direction=down": { + "model": "refinedstorage2:block/relay/light_gray", + "x": 90 + }, + "active=true,direction=east": { + "model": "refinedstorage2:block/relay/light_gray", + "y": 90 + }, + "active=true,direction=north": { + "model": "refinedstorage2:block/relay/light_gray" + }, + "active=true,direction=south": { + "model": "refinedstorage2:block/relay/light_gray", + "y": 180 + }, + "active=true,direction=up": { + "model": "refinedstorage2:block/relay/light_gray", + "x": -90, + "y": 180 + }, + "active=true,direction=west": { + "model": "refinedstorage2:block/relay/light_gray", + "y": 270 + } + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/lime_relay.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/lime_relay.json new file mode 100644 index 000000000..468f24466 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/lime_relay.json @@ -0,0 +1,52 @@ +{ + "variants": { + "active=false,direction=down": { + "model": "refinedstorage2:block/relay/inactive", + "x": 90 + }, + "active=false,direction=east": { + "model": "refinedstorage2:block/relay/inactive", + "y": 90 + }, + "active=false,direction=north": { + "model": "refinedstorage2:block/relay/inactive" + }, + "active=false,direction=south": { + "model": "refinedstorage2:block/relay/inactive", + "y": 180 + }, + "active=false,direction=up": { + "model": "refinedstorage2:block/relay/inactive", + "x": -90, + "y": 180 + }, + "active=false,direction=west": { + "model": "refinedstorage2:block/relay/inactive", + "y": 270 + }, + "active=true,direction=down": { + "model": "refinedstorage2:block/relay/lime", + "x": 90 + }, + "active=true,direction=east": { + "model": "refinedstorage2:block/relay/lime", + "y": 90 + }, + "active=true,direction=north": { + "model": "refinedstorage2:block/relay/lime" + }, + "active=true,direction=south": { + "model": "refinedstorage2:block/relay/lime", + "y": 180 + }, + "active=true,direction=up": { + "model": "refinedstorage2:block/relay/lime", + "x": -90, + "y": 180 + }, + "active=true,direction=west": { + "model": "refinedstorage2:block/relay/lime", + "y": 270 + } + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/magenta_relay.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/magenta_relay.json new file mode 100644 index 000000000..abe6cac51 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/magenta_relay.json @@ -0,0 +1,52 @@ +{ + "variants": { + "active=false,direction=down": { + "model": "refinedstorage2:block/relay/inactive", + "x": 90 + }, + "active=false,direction=east": { + "model": "refinedstorage2:block/relay/inactive", + "y": 90 + }, + "active=false,direction=north": { + "model": "refinedstorage2:block/relay/inactive" + }, + "active=false,direction=south": { + "model": "refinedstorage2:block/relay/inactive", + "y": 180 + }, + "active=false,direction=up": { + "model": "refinedstorage2:block/relay/inactive", + "x": -90, + "y": 180 + }, + "active=false,direction=west": { + "model": "refinedstorage2:block/relay/inactive", + "y": 270 + }, + "active=true,direction=down": { + "model": "refinedstorage2:block/relay/magenta", + "x": 90 + }, + "active=true,direction=east": { + "model": "refinedstorage2:block/relay/magenta", + "y": 90 + }, + "active=true,direction=north": { + "model": "refinedstorage2:block/relay/magenta" + }, + "active=true,direction=south": { + "model": "refinedstorage2:block/relay/magenta", + "y": 180 + }, + "active=true,direction=up": { + "model": "refinedstorage2:block/relay/magenta", + "x": -90, + "y": 180 + }, + "active=true,direction=west": { + "model": "refinedstorage2:block/relay/magenta", + "y": 270 + } + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/orange_relay.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/orange_relay.json new file mode 100644 index 000000000..b88a78a2e --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/orange_relay.json @@ -0,0 +1,52 @@ +{ + "variants": { + "active=false,direction=down": { + "model": "refinedstorage2:block/relay/inactive", + "x": 90 + }, + "active=false,direction=east": { + "model": "refinedstorage2:block/relay/inactive", + "y": 90 + }, + "active=false,direction=north": { + "model": "refinedstorage2:block/relay/inactive" + }, + "active=false,direction=south": { + "model": "refinedstorage2:block/relay/inactive", + "y": 180 + }, + "active=false,direction=up": { + "model": "refinedstorage2:block/relay/inactive", + "x": -90, + "y": 180 + }, + "active=false,direction=west": { + "model": "refinedstorage2:block/relay/inactive", + "y": 270 + }, + "active=true,direction=down": { + "model": "refinedstorage2:block/relay/orange", + "x": 90 + }, + "active=true,direction=east": { + "model": "refinedstorage2:block/relay/orange", + "y": 90 + }, + "active=true,direction=north": { + "model": "refinedstorage2:block/relay/orange" + }, + "active=true,direction=south": { + "model": "refinedstorage2:block/relay/orange", + "y": 180 + }, + "active=true,direction=up": { + "model": "refinedstorage2:block/relay/orange", + "x": -90, + "y": 180 + }, + "active=true,direction=west": { + "model": "refinedstorage2:block/relay/orange", + "y": 270 + } + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/pink_relay.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/pink_relay.json new file mode 100644 index 000000000..fad05f6fd --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/pink_relay.json @@ -0,0 +1,52 @@ +{ + "variants": { + "active=false,direction=down": { + "model": "refinedstorage2:block/relay/inactive", + "x": 90 + }, + "active=false,direction=east": { + "model": "refinedstorage2:block/relay/inactive", + "y": 90 + }, + "active=false,direction=north": { + "model": "refinedstorage2:block/relay/inactive" + }, + "active=false,direction=south": { + "model": "refinedstorage2:block/relay/inactive", + "y": 180 + }, + "active=false,direction=up": { + "model": "refinedstorage2:block/relay/inactive", + "x": -90, + "y": 180 + }, + "active=false,direction=west": { + "model": "refinedstorage2:block/relay/inactive", + "y": 270 + }, + "active=true,direction=down": { + "model": "refinedstorage2:block/relay/pink", + "x": 90 + }, + "active=true,direction=east": { + "model": "refinedstorage2:block/relay/pink", + "y": 90 + }, + "active=true,direction=north": { + "model": "refinedstorage2:block/relay/pink" + }, + "active=true,direction=south": { + "model": "refinedstorage2:block/relay/pink", + "y": 180 + }, + "active=true,direction=up": { + "model": "refinedstorage2:block/relay/pink", + "x": -90, + "y": 180 + }, + "active=true,direction=west": { + "model": "refinedstorage2:block/relay/pink", + "y": 270 + } + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/purple_relay.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/purple_relay.json new file mode 100644 index 000000000..64092cee3 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/purple_relay.json @@ -0,0 +1,52 @@ +{ + "variants": { + "active=false,direction=down": { + "model": "refinedstorage2:block/relay/inactive", + "x": 90 + }, + "active=false,direction=east": { + "model": "refinedstorage2:block/relay/inactive", + "y": 90 + }, + "active=false,direction=north": { + "model": "refinedstorage2:block/relay/inactive" + }, + "active=false,direction=south": { + "model": "refinedstorage2:block/relay/inactive", + "y": 180 + }, + "active=false,direction=up": { + "model": "refinedstorage2:block/relay/inactive", + "x": -90, + "y": 180 + }, + "active=false,direction=west": { + "model": "refinedstorage2:block/relay/inactive", + "y": 270 + }, + "active=true,direction=down": { + "model": "refinedstorage2:block/relay/purple", + "x": 90 + }, + "active=true,direction=east": { + "model": "refinedstorage2:block/relay/purple", + "y": 90 + }, + "active=true,direction=north": { + "model": "refinedstorage2:block/relay/purple" + }, + "active=true,direction=south": { + "model": "refinedstorage2:block/relay/purple", + "y": 180 + }, + "active=true,direction=up": { + "model": "refinedstorage2:block/relay/purple", + "x": -90, + "y": 180 + }, + "active=true,direction=west": { + "model": "refinedstorage2:block/relay/purple", + "y": 270 + } + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/red_relay.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/red_relay.json new file mode 100644 index 000000000..d8d0481ff --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/red_relay.json @@ -0,0 +1,52 @@ +{ + "variants": { + "active=false,direction=down": { + "model": "refinedstorage2:block/relay/inactive", + "x": 90 + }, + "active=false,direction=east": { + "model": "refinedstorage2:block/relay/inactive", + "y": 90 + }, + "active=false,direction=north": { + "model": "refinedstorage2:block/relay/inactive" + }, + "active=false,direction=south": { + "model": "refinedstorage2:block/relay/inactive", + "y": 180 + }, + "active=false,direction=up": { + "model": "refinedstorage2:block/relay/inactive", + "x": -90, + "y": 180 + }, + "active=false,direction=west": { + "model": "refinedstorage2:block/relay/inactive", + "y": 270 + }, + "active=true,direction=down": { + "model": "refinedstorage2:block/relay/red", + "x": 90 + }, + "active=true,direction=east": { + "model": "refinedstorage2:block/relay/red", + "y": 90 + }, + "active=true,direction=north": { + "model": "refinedstorage2:block/relay/red" + }, + "active=true,direction=south": { + "model": "refinedstorage2:block/relay/red", + "y": 180 + }, + "active=true,direction=up": { + "model": "refinedstorage2:block/relay/red", + "x": -90, + "y": 180 + }, + "active=true,direction=west": { + "model": "refinedstorage2:block/relay/red", + "y": 270 + } + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/relay.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/relay.json new file mode 100644 index 000000000..81c13e2df --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/relay.json @@ -0,0 +1,52 @@ +{ + "variants": { + "active=false,direction=down": { + "model": "refinedstorage2:block/relay/inactive", + "x": 90 + }, + "active=false,direction=east": { + "model": "refinedstorage2:block/relay/inactive", + "y": 90 + }, + "active=false,direction=north": { + "model": "refinedstorage2:block/relay/inactive" + }, + "active=false,direction=south": { + "model": "refinedstorage2:block/relay/inactive", + "y": 180 + }, + "active=false,direction=up": { + "model": "refinedstorage2:block/relay/inactive", + "x": -90, + "y": 180 + }, + "active=false,direction=west": { + "model": "refinedstorage2:block/relay/inactive", + "y": 270 + }, + "active=true,direction=down": { + "model": "refinedstorage2:block/relay/light_blue", + "x": 90 + }, + "active=true,direction=east": { + "model": "refinedstorage2:block/relay/light_blue", + "y": 90 + }, + "active=true,direction=north": { + "model": "refinedstorage2:block/relay/light_blue" + }, + "active=true,direction=south": { + "model": "refinedstorage2:block/relay/light_blue", + "y": 180 + }, + "active=true,direction=up": { + "model": "refinedstorage2:block/relay/light_blue", + "x": -90, + "y": 180 + }, + "active=true,direction=west": { + "model": "refinedstorage2:block/relay/light_blue", + "y": 270 + } + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/white_relay.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/white_relay.json new file mode 100644 index 000000000..fc3ee23ce --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/white_relay.json @@ -0,0 +1,52 @@ +{ + "variants": { + "active=false,direction=down": { + "model": "refinedstorage2:block/relay/inactive", + "x": 90 + }, + "active=false,direction=east": { + "model": "refinedstorage2:block/relay/inactive", + "y": 90 + }, + "active=false,direction=north": { + "model": "refinedstorage2:block/relay/inactive" + }, + "active=false,direction=south": { + "model": "refinedstorage2:block/relay/inactive", + "y": 180 + }, + "active=false,direction=up": { + "model": "refinedstorage2:block/relay/inactive", + "x": -90, + "y": 180 + }, + "active=false,direction=west": { + "model": "refinedstorage2:block/relay/inactive", + "y": 270 + }, + "active=true,direction=down": { + "model": "refinedstorage2:block/relay/white", + "x": 90 + }, + "active=true,direction=east": { + "model": "refinedstorage2:block/relay/white", + "y": 90 + }, + "active=true,direction=north": { + "model": "refinedstorage2:block/relay/white" + }, + "active=true,direction=south": { + "model": "refinedstorage2:block/relay/white", + "y": 180 + }, + "active=true,direction=up": { + "model": "refinedstorage2:block/relay/white", + "x": -90, + "y": 180 + }, + "active=true,direction=west": { + "model": "refinedstorage2:block/relay/white", + "y": 270 + } + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/yellow_relay.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/yellow_relay.json new file mode 100644 index 000000000..335a4983f --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/blockstates/yellow_relay.json @@ -0,0 +1,52 @@ +{ + "variants": { + "active=false,direction=down": { + "model": "refinedstorage2:block/relay/inactive", + "x": 90 + }, + "active=false,direction=east": { + "model": "refinedstorage2:block/relay/inactive", + "y": 90 + }, + "active=false,direction=north": { + "model": "refinedstorage2:block/relay/inactive" + }, + "active=false,direction=south": { + "model": "refinedstorage2:block/relay/inactive", + "y": 180 + }, + "active=false,direction=up": { + "model": "refinedstorage2:block/relay/inactive", + "x": -90, + "y": 180 + }, + "active=false,direction=west": { + "model": "refinedstorage2:block/relay/inactive", + "y": 270 + }, + "active=true,direction=down": { + "model": "refinedstorage2:block/relay/yellow", + "x": 90 + }, + "active=true,direction=east": { + "model": "refinedstorage2:block/relay/yellow", + "y": 90 + }, + "active=true,direction=north": { + "model": "refinedstorage2:block/relay/yellow" + }, + "active=true,direction=south": { + "model": "refinedstorage2:block/relay/yellow", + "y": 180 + }, + "active=true,direction=up": { + "model": "refinedstorage2:block/relay/yellow", + "x": -90, + "y": 180 + }, + "active=true,direction=west": { + "model": "refinedstorage2:block/relay/yellow", + "y": 270 + } + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/black.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/black.json new file mode 100644 index 000000000..914e403fd --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/black.json @@ -0,0 +1,18 @@ +{ + "parent": "refinedstorage2:block/emissive_cutout", + "textures": { + "cutout_down": "refinedstorage2:block/relay/cutouts/in/black", + "cutout_east": "refinedstorage2:block/relay/cutouts/in/black", + "cutout_north": "refinedstorage2:block/relay/cutouts/out/black", + "cutout_south": "refinedstorage2:block/relay/cutouts/in/black", + "cutout_up": "refinedstorage2:block/relay/cutouts/in/black", + "cutout_west": "refinedstorage2:block/relay/cutouts/in/black", + "down": "refinedstorage2:block/relay/in", + "east": "refinedstorage2:block/relay/in", + "north": "refinedstorage2:block/relay/out", + "particle": "refinedstorage2:block/relay/in", + "south": "refinedstorage2:block/relay/in", + "up": "refinedstorage2:block/relay/in", + "west": "refinedstorage2:block/relay/in" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/blue.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/blue.json new file mode 100644 index 000000000..93491c2d2 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/blue.json @@ -0,0 +1,18 @@ +{ + "parent": "refinedstorage2:block/emissive_cutout", + "textures": { + "cutout_down": "refinedstorage2:block/relay/cutouts/in/blue", + "cutout_east": "refinedstorage2:block/relay/cutouts/in/blue", + "cutout_north": "refinedstorage2:block/relay/cutouts/out/blue", + "cutout_south": "refinedstorage2:block/relay/cutouts/in/blue", + "cutout_up": "refinedstorage2:block/relay/cutouts/in/blue", + "cutout_west": "refinedstorage2:block/relay/cutouts/in/blue", + "down": "refinedstorage2:block/relay/in", + "east": "refinedstorage2:block/relay/in", + "north": "refinedstorage2:block/relay/out", + "particle": "refinedstorage2:block/relay/in", + "south": "refinedstorage2:block/relay/in", + "up": "refinedstorage2:block/relay/in", + "west": "refinedstorage2:block/relay/in" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/brown.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/brown.json new file mode 100644 index 000000000..b4e379ea6 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/brown.json @@ -0,0 +1,18 @@ +{ + "parent": "refinedstorage2:block/emissive_cutout", + "textures": { + "cutout_down": "refinedstorage2:block/relay/cutouts/in/brown", + "cutout_east": "refinedstorage2:block/relay/cutouts/in/brown", + "cutout_north": "refinedstorage2:block/relay/cutouts/out/brown", + "cutout_south": "refinedstorage2:block/relay/cutouts/in/brown", + "cutout_up": "refinedstorage2:block/relay/cutouts/in/brown", + "cutout_west": "refinedstorage2:block/relay/cutouts/in/brown", + "down": "refinedstorage2:block/relay/in", + "east": "refinedstorage2:block/relay/in", + "north": "refinedstorage2:block/relay/out", + "particle": "refinedstorage2:block/relay/in", + "south": "refinedstorage2:block/relay/in", + "up": "refinedstorage2:block/relay/in", + "west": "refinedstorage2:block/relay/in" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/cyan.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/cyan.json new file mode 100644 index 000000000..8487e8b95 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/cyan.json @@ -0,0 +1,18 @@ +{ + "parent": "refinedstorage2:block/emissive_cutout", + "textures": { + "cutout_down": "refinedstorage2:block/relay/cutouts/in/cyan", + "cutout_east": "refinedstorage2:block/relay/cutouts/in/cyan", + "cutout_north": "refinedstorage2:block/relay/cutouts/out/cyan", + "cutout_south": "refinedstorage2:block/relay/cutouts/in/cyan", + "cutout_up": "refinedstorage2:block/relay/cutouts/in/cyan", + "cutout_west": "refinedstorage2:block/relay/cutouts/in/cyan", + "down": "refinedstorage2:block/relay/in", + "east": "refinedstorage2:block/relay/in", + "north": "refinedstorage2:block/relay/out", + "particle": "refinedstorage2:block/relay/in", + "south": "refinedstorage2:block/relay/in", + "up": "refinedstorage2:block/relay/in", + "west": "refinedstorage2:block/relay/in" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/gray.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/gray.json new file mode 100644 index 000000000..0cc0a2ace --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/gray.json @@ -0,0 +1,18 @@ +{ + "parent": "refinedstorage2:block/emissive_cutout", + "textures": { + "cutout_down": "refinedstorage2:block/relay/cutouts/in/gray", + "cutout_east": "refinedstorage2:block/relay/cutouts/in/gray", + "cutout_north": "refinedstorage2:block/relay/cutouts/out/gray", + "cutout_south": "refinedstorage2:block/relay/cutouts/in/gray", + "cutout_up": "refinedstorage2:block/relay/cutouts/in/gray", + "cutout_west": "refinedstorage2:block/relay/cutouts/in/gray", + "down": "refinedstorage2:block/relay/in", + "east": "refinedstorage2:block/relay/in", + "north": "refinedstorage2:block/relay/out", + "particle": "refinedstorage2:block/relay/in", + "south": "refinedstorage2:block/relay/in", + "up": "refinedstorage2:block/relay/in", + "west": "refinedstorage2:block/relay/in" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/green.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/green.json new file mode 100644 index 000000000..f22c4d555 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/green.json @@ -0,0 +1,18 @@ +{ + "parent": "refinedstorage2:block/emissive_cutout", + "textures": { + "cutout_down": "refinedstorage2:block/relay/cutouts/in/green", + "cutout_east": "refinedstorage2:block/relay/cutouts/in/green", + "cutout_north": "refinedstorage2:block/relay/cutouts/out/green", + "cutout_south": "refinedstorage2:block/relay/cutouts/in/green", + "cutout_up": "refinedstorage2:block/relay/cutouts/in/green", + "cutout_west": "refinedstorage2:block/relay/cutouts/in/green", + "down": "refinedstorage2:block/relay/in", + "east": "refinedstorage2:block/relay/in", + "north": "refinedstorage2:block/relay/out", + "particle": "refinedstorage2:block/relay/in", + "south": "refinedstorage2:block/relay/in", + "up": "refinedstorage2:block/relay/in", + "west": "refinedstorage2:block/relay/in" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/inactive.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/inactive.json new file mode 100644 index 000000000..c33e16f41 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/inactive.json @@ -0,0 +1,18 @@ +{ + "parent": "refinedstorage2:block/cutout", + "textures": { + "cutout_down": "refinedstorage2:block/relay/cutouts/in/inactive", + "cutout_east": "refinedstorage2:block/relay/cutouts/in/inactive", + "cutout_north": "refinedstorage2:block/relay/cutouts/out/inactive", + "cutout_south": "refinedstorage2:block/relay/cutouts/in/inactive", + "cutout_up": "refinedstorage2:block/relay/cutouts/in/inactive", + "cutout_west": "refinedstorage2:block/relay/cutouts/in/inactive", + "down": "refinedstorage2:block/relay/in", + "east": "refinedstorage2:block/relay/in", + "north": "refinedstorage2:block/relay/out", + "particle": "refinedstorage2:block/relay/in", + "south": "refinedstorage2:block/relay/in", + "up": "refinedstorage2:block/relay/in", + "west": "refinedstorage2:block/relay/in" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/light_blue.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/light_blue.json new file mode 100644 index 000000000..b7509e1e4 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/light_blue.json @@ -0,0 +1,18 @@ +{ + "parent": "refinedstorage2:block/emissive_cutout", + "textures": { + "cutout_down": "refinedstorage2:block/relay/cutouts/in/light_blue", + "cutout_east": "refinedstorage2:block/relay/cutouts/in/light_blue", + "cutout_north": "refinedstorage2:block/relay/cutouts/out/light_blue", + "cutout_south": "refinedstorage2:block/relay/cutouts/in/light_blue", + "cutout_up": "refinedstorage2:block/relay/cutouts/in/light_blue", + "cutout_west": "refinedstorage2:block/relay/cutouts/in/light_blue", + "down": "refinedstorage2:block/relay/in", + "east": "refinedstorage2:block/relay/in", + "north": "refinedstorage2:block/relay/out", + "particle": "refinedstorage2:block/relay/in", + "south": "refinedstorage2:block/relay/in", + "up": "refinedstorage2:block/relay/in", + "west": "refinedstorage2:block/relay/in" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/light_gray.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/light_gray.json new file mode 100644 index 000000000..cd4f2c280 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/light_gray.json @@ -0,0 +1,18 @@ +{ + "parent": "refinedstorage2:block/emissive_cutout", + "textures": { + "cutout_down": "refinedstorage2:block/relay/cutouts/in/light_gray", + "cutout_east": "refinedstorage2:block/relay/cutouts/in/light_gray", + "cutout_north": "refinedstorage2:block/relay/cutouts/out/light_gray", + "cutout_south": "refinedstorage2:block/relay/cutouts/in/light_gray", + "cutout_up": "refinedstorage2:block/relay/cutouts/in/light_gray", + "cutout_west": "refinedstorage2:block/relay/cutouts/in/light_gray", + "down": "refinedstorage2:block/relay/in", + "east": "refinedstorage2:block/relay/in", + "north": "refinedstorage2:block/relay/out", + "particle": "refinedstorage2:block/relay/in", + "south": "refinedstorage2:block/relay/in", + "up": "refinedstorage2:block/relay/in", + "west": "refinedstorage2:block/relay/in" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/lime.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/lime.json new file mode 100644 index 000000000..a4a606c67 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/lime.json @@ -0,0 +1,18 @@ +{ + "parent": "refinedstorage2:block/emissive_cutout", + "textures": { + "cutout_down": "refinedstorage2:block/relay/cutouts/in/lime", + "cutout_east": "refinedstorage2:block/relay/cutouts/in/lime", + "cutout_north": "refinedstorage2:block/relay/cutouts/out/lime", + "cutout_south": "refinedstorage2:block/relay/cutouts/in/lime", + "cutout_up": "refinedstorage2:block/relay/cutouts/in/lime", + "cutout_west": "refinedstorage2:block/relay/cutouts/in/lime", + "down": "refinedstorage2:block/relay/in", + "east": "refinedstorage2:block/relay/in", + "north": "refinedstorage2:block/relay/out", + "particle": "refinedstorage2:block/relay/in", + "south": "refinedstorage2:block/relay/in", + "up": "refinedstorage2:block/relay/in", + "west": "refinedstorage2:block/relay/in" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/magenta.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/magenta.json new file mode 100644 index 000000000..5d8aec8b0 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/magenta.json @@ -0,0 +1,18 @@ +{ + "parent": "refinedstorage2:block/emissive_cutout", + "textures": { + "cutout_down": "refinedstorage2:block/relay/cutouts/in/magenta", + "cutout_east": "refinedstorage2:block/relay/cutouts/in/magenta", + "cutout_north": "refinedstorage2:block/relay/cutouts/out/magenta", + "cutout_south": "refinedstorage2:block/relay/cutouts/in/magenta", + "cutout_up": "refinedstorage2:block/relay/cutouts/in/magenta", + "cutout_west": "refinedstorage2:block/relay/cutouts/in/magenta", + "down": "refinedstorage2:block/relay/in", + "east": "refinedstorage2:block/relay/in", + "north": "refinedstorage2:block/relay/out", + "particle": "refinedstorage2:block/relay/in", + "south": "refinedstorage2:block/relay/in", + "up": "refinedstorage2:block/relay/in", + "west": "refinedstorage2:block/relay/in" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/orange.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/orange.json new file mode 100644 index 000000000..8b237cab8 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/orange.json @@ -0,0 +1,18 @@ +{ + "parent": "refinedstorage2:block/emissive_cutout", + "textures": { + "cutout_down": "refinedstorage2:block/relay/cutouts/in/orange", + "cutout_east": "refinedstorage2:block/relay/cutouts/in/orange", + "cutout_north": "refinedstorage2:block/relay/cutouts/out/orange", + "cutout_south": "refinedstorage2:block/relay/cutouts/in/orange", + "cutout_up": "refinedstorage2:block/relay/cutouts/in/orange", + "cutout_west": "refinedstorage2:block/relay/cutouts/in/orange", + "down": "refinedstorage2:block/relay/in", + "east": "refinedstorage2:block/relay/in", + "north": "refinedstorage2:block/relay/out", + "particle": "refinedstorage2:block/relay/in", + "south": "refinedstorage2:block/relay/in", + "up": "refinedstorage2:block/relay/in", + "west": "refinedstorage2:block/relay/in" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/pink.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/pink.json new file mode 100644 index 000000000..89fbb71be --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/pink.json @@ -0,0 +1,18 @@ +{ + "parent": "refinedstorage2:block/emissive_cutout", + "textures": { + "cutout_down": "refinedstorage2:block/relay/cutouts/in/pink", + "cutout_east": "refinedstorage2:block/relay/cutouts/in/pink", + "cutout_north": "refinedstorage2:block/relay/cutouts/out/pink", + "cutout_south": "refinedstorage2:block/relay/cutouts/in/pink", + "cutout_up": "refinedstorage2:block/relay/cutouts/in/pink", + "cutout_west": "refinedstorage2:block/relay/cutouts/in/pink", + "down": "refinedstorage2:block/relay/in", + "east": "refinedstorage2:block/relay/in", + "north": "refinedstorage2:block/relay/out", + "particle": "refinedstorage2:block/relay/in", + "south": "refinedstorage2:block/relay/in", + "up": "refinedstorage2:block/relay/in", + "west": "refinedstorage2:block/relay/in" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/purple.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/purple.json new file mode 100644 index 000000000..a2c080940 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/purple.json @@ -0,0 +1,18 @@ +{ + "parent": "refinedstorage2:block/emissive_cutout", + "textures": { + "cutout_down": "refinedstorage2:block/relay/cutouts/in/purple", + "cutout_east": "refinedstorage2:block/relay/cutouts/in/purple", + "cutout_north": "refinedstorage2:block/relay/cutouts/out/purple", + "cutout_south": "refinedstorage2:block/relay/cutouts/in/purple", + "cutout_up": "refinedstorage2:block/relay/cutouts/in/purple", + "cutout_west": "refinedstorage2:block/relay/cutouts/in/purple", + "down": "refinedstorage2:block/relay/in", + "east": "refinedstorage2:block/relay/in", + "north": "refinedstorage2:block/relay/out", + "particle": "refinedstorage2:block/relay/in", + "south": "refinedstorage2:block/relay/in", + "up": "refinedstorage2:block/relay/in", + "west": "refinedstorage2:block/relay/in" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/red.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/red.json new file mode 100644 index 000000000..fb2aa93d2 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/red.json @@ -0,0 +1,18 @@ +{ + "parent": "refinedstorage2:block/emissive_cutout", + "textures": { + "cutout_down": "refinedstorage2:block/relay/cutouts/in/red", + "cutout_east": "refinedstorage2:block/relay/cutouts/in/red", + "cutout_north": "refinedstorage2:block/relay/cutouts/out/red", + "cutout_south": "refinedstorage2:block/relay/cutouts/in/red", + "cutout_up": "refinedstorage2:block/relay/cutouts/in/red", + "cutout_west": "refinedstorage2:block/relay/cutouts/in/red", + "down": "refinedstorage2:block/relay/in", + "east": "refinedstorage2:block/relay/in", + "north": "refinedstorage2:block/relay/out", + "particle": "refinedstorage2:block/relay/in", + "south": "refinedstorage2:block/relay/in", + "up": "refinedstorage2:block/relay/in", + "west": "refinedstorage2:block/relay/in" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/white.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/white.json new file mode 100644 index 000000000..1adac00bc --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/white.json @@ -0,0 +1,18 @@ +{ + "parent": "refinedstorage2:block/emissive_cutout", + "textures": { + "cutout_down": "refinedstorage2:block/relay/cutouts/in/white", + "cutout_east": "refinedstorage2:block/relay/cutouts/in/white", + "cutout_north": "refinedstorage2:block/relay/cutouts/out/white", + "cutout_south": "refinedstorage2:block/relay/cutouts/in/white", + "cutout_up": "refinedstorage2:block/relay/cutouts/in/white", + "cutout_west": "refinedstorage2:block/relay/cutouts/in/white", + "down": "refinedstorage2:block/relay/in", + "east": "refinedstorage2:block/relay/in", + "north": "refinedstorage2:block/relay/out", + "particle": "refinedstorage2:block/relay/in", + "south": "refinedstorage2:block/relay/in", + "up": "refinedstorage2:block/relay/in", + "west": "refinedstorage2:block/relay/in" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/yellow.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/yellow.json new file mode 100644 index 000000000..2096a76e2 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/block/relay/yellow.json @@ -0,0 +1,18 @@ +{ + "parent": "refinedstorage2:block/emissive_cutout", + "textures": { + "cutout_down": "refinedstorage2:block/relay/cutouts/in/yellow", + "cutout_east": "refinedstorage2:block/relay/cutouts/in/yellow", + "cutout_north": "refinedstorage2:block/relay/cutouts/out/yellow", + "cutout_south": "refinedstorage2:block/relay/cutouts/in/yellow", + "cutout_up": "refinedstorage2:block/relay/cutouts/in/yellow", + "cutout_west": "refinedstorage2:block/relay/cutouts/in/yellow", + "down": "refinedstorage2:block/relay/in", + "east": "refinedstorage2:block/relay/in", + "north": "refinedstorage2:block/relay/out", + "particle": "refinedstorage2:block/relay/in", + "south": "refinedstorage2:block/relay/in", + "up": "refinedstorage2:block/relay/in", + "west": "refinedstorage2:block/relay/in" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/black_relay.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/black_relay.json new file mode 100644 index 000000000..b662ba05e --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/black_relay.json @@ -0,0 +1,3 @@ +{ + "parent": "refinedstorage2:block/relay/black" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/blue_relay.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/blue_relay.json new file mode 100644 index 000000000..11ac25440 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/blue_relay.json @@ -0,0 +1,3 @@ +{ + "parent": "refinedstorage2:block/relay/blue" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/brown_relay.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/brown_relay.json new file mode 100644 index 000000000..c2520d02c --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/brown_relay.json @@ -0,0 +1,3 @@ +{ + "parent": "refinedstorage2:block/relay/brown" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/cyan_relay.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/cyan_relay.json new file mode 100644 index 000000000..fc8c86be2 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/cyan_relay.json @@ -0,0 +1,3 @@ +{ + "parent": "refinedstorage2:block/relay/cyan" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/gray_relay.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/gray_relay.json new file mode 100644 index 000000000..9d2c654e0 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/gray_relay.json @@ -0,0 +1,3 @@ +{ + "parent": "refinedstorage2:block/relay/gray" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/green_relay.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/green_relay.json new file mode 100644 index 000000000..a50ef1165 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/green_relay.json @@ -0,0 +1,3 @@ +{ + "parent": "refinedstorage2:block/relay/green" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/light_gray_relay.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/light_gray_relay.json new file mode 100644 index 000000000..51a372bad --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/light_gray_relay.json @@ -0,0 +1,3 @@ +{ + "parent": "refinedstorage2:block/relay/light_gray" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/lime_relay.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/lime_relay.json new file mode 100644 index 000000000..0f12fad98 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/lime_relay.json @@ -0,0 +1,3 @@ +{ + "parent": "refinedstorage2:block/relay/lime" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/magenta_relay.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/magenta_relay.json new file mode 100644 index 000000000..13c4bd8af --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/magenta_relay.json @@ -0,0 +1,3 @@ +{ + "parent": "refinedstorage2:block/relay/magenta" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/orange_relay.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/orange_relay.json new file mode 100644 index 000000000..deaa01aca --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/orange_relay.json @@ -0,0 +1,3 @@ +{ + "parent": "refinedstorage2:block/relay/orange" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/pink_relay.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/pink_relay.json new file mode 100644 index 000000000..7b56295eb --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/pink_relay.json @@ -0,0 +1,3 @@ +{ + "parent": "refinedstorage2:block/relay/pink" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/purple_relay.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/purple_relay.json new file mode 100644 index 000000000..a51cd5fd7 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/purple_relay.json @@ -0,0 +1,3 @@ +{ + "parent": "refinedstorage2:block/relay/purple" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/red_relay.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/red_relay.json new file mode 100644 index 000000000..7c94769ee --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/red_relay.json @@ -0,0 +1,3 @@ +{ + "parent": "refinedstorage2:block/relay/red" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/relay.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/relay.json new file mode 100644 index 000000000..a6634495e --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/relay.json @@ -0,0 +1,3 @@ +{ + "parent": "refinedstorage2:block/relay/light_blue" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/white_relay.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/white_relay.json new file mode 100644 index 000000000..b2badbd1e --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/white_relay.json @@ -0,0 +1,3 @@ +{ + "parent": "refinedstorage2:block/relay/white" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/yellow_relay.json b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/yellow_relay.json new file mode 100644 index 000000000..8486447ab --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/assets/refinedstorage2/models/item/yellow_relay.json @@ -0,0 +1,3 @@ +{ + "parent": "refinedstorage2:block/relay/yellow" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/black_relay.json b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/black_relay.json new file mode 100644 index 000000000..3377dcb4c --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/black_relay.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_relays": { + "conditions": { + "items": [ + { + "tag": "refinedstorage2:relays" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "refinedstorage2:coloring/black_relay" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_relays" + ] + ], + "rewards": { + "recipes": [ + "refinedstorage2:coloring/black_relay" + ] + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/blue_relay.json b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/blue_relay.json new file mode 100644 index 000000000..15e6f885c --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/blue_relay.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_relays": { + "conditions": { + "items": [ + { + "tag": "refinedstorage2:relays" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "refinedstorage2:coloring/blue_relay" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_relays" + ] + ], + "rewards": { + "recipes": [ + "refinedstorage2:coloring/blue_relay" + ] + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/brown_relay.json b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/brown_relay.json new file mode 100644 index 000000000..cffbbfee1 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/brown_relay.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_relays": { + "conditions": { + "items": [ + { + "tag": "refinedstorage2:relays" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "refinedstorage2:coloring/brown_relay" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_relays" + ] + ], + "rewards": { + "recipes": [ + "refinedstorage2:coloring/brown_relay" + ] + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/cyan_relay.json b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/cyan_relay.json new file mode 100644 index 000000000..776a551b8 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/cyan_relay.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_relays": { + "conditions": { + "items": [ + { + "tag": "refinedstorage2:relays" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "refinedstorage2:coloring/cyan_relay" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_relays" + ] + ], + "rewards": { + "recipes": [ + "refinedstorage2:coloring/cyan_relay" + ] + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/gray_relay.json b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/gray_relay.json new file mode 100644 index 000000000..eafcb62d5 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/gray_relay.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_relays": { + "conditions": { + "items": [ + { + "tag": "refinedstorage2:relays" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "refinedstorage2:coloring/gray_relay" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_relays" + ] + ], + "rewards": { + "recipes": [ + "refinedstorage2:coloring/gray_relay" + ] + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/green_relay.json b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/green_relay.json new file mode 100644 index 000000000..82699eef5 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/green_relay.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_relays": { + "conditions": { + "items": [ + { + "tag": "refinedstorage2:relays" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "refinedstorage2:coloring/green_relay" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_relays" + ] + ], + "rewards": { + "recipes": [ + "refinedstorage2:coloring/green_relay" + ] + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/light_blue_relay.json b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/light_blue_relay.json new file mode 100644 index 000000000..a59f37c02 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/light_blue_relay.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_relays": { + "conditions": { + "items": [ + { + "tag": "refinedstorage2:relays" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "refinedstorage2:coloring/light_blue_relay" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_relays" + ] + ], + "rewards": { + "recipes": [ + "refinedstorage2:coloring/light_blue_relay" + ] + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/light_gray_relay.json b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/light_gray_relay.json new file mode 100644 index 000000000..83690021d --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/light_gray_relay.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_relays": { + "conditions": { + "items": [ + { + "tag": "refinedstorage2:relays" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "refinedstorage2:coloring/light_gray_relay" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_relays" + ] + ], + "rewards": { + "recipes": [ + "refinedstorage2:coloring/light_gray_relay" + ] + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/lime_relay.json b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/lime_relay.json new file mode 100644 index 000000000..fb2918db3 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/lime_relay.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_relays": { + "conditions": { + "items": [ + { + "tag": "refinedstorage2:relays" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "refinedstorage2:coloring/lime_relay" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_relays" + ] + ], + "rewards": { + "recipes": [ + "refinedstorage2:coloring/lime_relay" + ] + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/magenta_relay.json b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/magenta_relay.json new file mode 100644 index 000000000..80665cba1 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/magenta_relay.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_relays": { + "conditions": { + "items": [ + { + "tag": "refinedstorage2:relays" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "refinedstorage2:coloring/magenta_relay" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_relays" + ] + ], + "rewards": { + "recipes": [ + "refinedstorage2:coloring/magenta_relay" + ] + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/orange_relay.json b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/orange_relay.json new file mode 100644 index 000000000..2e38b0954 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/orange_relay.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_relays": { + "conditions": { + "items": [ + { + "tag": "refinedstorage2:relays" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "refinedstorage2:coloring/orange_relay" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_relays" + ] + ], + "rewards": { + "recipes": [ + "refinedstorage2:coloring/orange_relay" + ] + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/pink_relay.json b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/pink_relay.json new file mode 100644 index 000000000..bce19fbb8 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/pink_relay.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_relays": { + "conditions": { + "items": [ + { + "tag": "refinedstorage2:relays" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "refinedstorage2:coloring/pink_relay" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_relays" + ] + ], + "rewards": { + "recipes": [ + "refinedstorage2:coloring/pink_relay" + ] + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/purple_relay.json b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/purple_relay.json new file mode 100644 index 000000000..8defcc832 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/purple_relay.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_relays": { + "conditions": { + "items": [ + { + "tag": "refinedstorage2:relays" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "refinedstorage2:coloring/purple_relay" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_relays" + ] + ], + "rewards": { + "recipes": [ + "refinedstorage2:coloring/purple_relay" + ] + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/red_relay.json b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/red_relay.json new file mode 100644 index 000000000..850719359 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/red_relay.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_relays": { + "conditions": { + "items": [ + { + "tag": "refinedstorage2:relays" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "refinedstorage2:coloring/red_relay" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_relays" + ] + ], + "rewards": { + "recipes": [ + "refinedstorage2:coloring/red_relay" + ] + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/white_relay.json b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/white_relay.json new file mode 100644 index 000000000..7260c1feb --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/white_relay.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_relays": { + "conditions": { + "items": [ + { + "tag": "refinedstorage2:relays" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "refinedstorage2:coloring/white_relay" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_relays" + ] + ], + "rewards": { + "recipes": [ + "refinedstorage2:coloring/white_relay" + ] + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/yellow_relay.json b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/yellow_relay.json new file mode 100644 index 000000000..bd7759ea9 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/advancements/recipes/misc/coloring/yellow_relay.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_relays": { + "conditions": { + "items": [ + { + "tag": "refinedstorage2:relays" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "refinedstorage2:coloring/yellow_relay" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_relays" + ] + ], + "rewards": { + "recipes": [ + "refinedstorage2:coloring/yellow_relay" + ] + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/black_relay.json b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/black_relay.json new file mode 100644 index 000000000..4936678f4 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/black_relay.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "refinedstorage2:black_relay" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "refinedstorage2:blocks/black_relay" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/blue_relay.json b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/blue_relay.json new file mode 100644 index 000000000..565c2fba3 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/blue_relay.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "refinedstorage2:blue_relay" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "refinedstorage2:blocks/blue_relay" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/brown_relay.json b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/brown_relay.json new file mode 100644 index 000000000..08d3ff147 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/brown_relay.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "refinedstorage2:brown_relay" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "refinedstorage2:blocks/brown_relay" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/cyan_relay.json b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/cyan_relay.json new file mode 100644 index 000000000..37304c1b4 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/cyan_relay.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "refinedstorage2:cyan_relay" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "refinedstorage2:blocks/cyan_relay" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/gray_relay.json b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/gray_relay.json new file mode 100644 index 000000000..b14675039 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/gray_relay.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "refinedstorage2:gray_relay" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "refinedstorage2:blocks/gray_relay" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/green_relay.json b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/green_relay.json new file mode 100644 index 000000000..a25a064b2 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/green_relay.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "refinedstorage2:green_relay" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "refinedstorage2:blocks/green_relay" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/light_gray_relay.json b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/light_gray_relay.json new file mode 100644 index 000000000..10f10db8e --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/light_gray_relay.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "refinedstorage2:light_gray_relay" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "refinedstorage2:blocks/light_gray_relay" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/lime_relay.json b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/lime_relay.json new file mode 100644 index 000000000..7b4771a9f --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/lime_relay.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "refinedstorage2:lime_relay" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "refinedstorage2:blocks/lime_relay" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/magenta_relay.json b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/magenta_relay.json new file mode 100644 index 000000000..def0bf407 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/magenta_relay.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "refinedstorage2:magenta_relay" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "refinedstorage2:blocks/magenta_relay" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/orange_relay.json b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/orange_relay.json new file mode 100644 index 000000000..646af5e56 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/orange_relay.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "refinedstorage2:orange_relay" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "refinedstorage2:blocks/orange_relay" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/pink_relay.json b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/pink_relay.json new file mode 100644 index 000000000..6255d9b7d --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/pink_relay.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "refinedstorage2:pink_relay" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "refinedstorage2:blocks/pink_relay" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/purple_relay.json b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/purple_relay.json new file mode 100644 index 000000000..f92f4e4a8 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/purple_relay.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "refinedstorage2:purple_relay" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "refinedstorage2:blocks/purple_relay" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/red_relay.json b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/red_relay.json new file mode 100644 index 000000000..d050f5995 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/red_relay.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "refinedstorage2:red_relay" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "refinedstorage2:blocks/red_relay" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/relay.json b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/relay.json new file mode 100644 index 000000000..d79ebcf77 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/relay.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "refinedstorage2:relay" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "refinedstorage2:blocks/relay" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/white_relay.json b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/white_relay.json new file mode 100644 index 000000000..7e6246c65 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/white_relay.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "refinedstorage2:white_relay" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "refinedstorage2:blocks/white_relay" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/yellow_relay.json b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/yellow_relay.json new file mode 100644 index 000000000..3e2872c11 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/loot_tables/blocks/yellow_relay.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "refinedstorage2:yellow_relay" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "refinedstorage2:blocks/yellow_relay" +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/black_relay.json b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/black_relay.json new file mode 100644 index 000000000..37ad99430 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/black_relay.json @@ -0,0 +1,15 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "tag": "refinedstorage2:relays" + }, + { + "item": "minecraft:black_dye" + } + ], + "result": { + "item": "refinedstorage2:black_relay" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/blue_relay.json b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/blue_relay.json new file mode 100644 index 000000000..2c4374cd8 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/blue_relay.json @@ -0,0 +1,15 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "tag": "refinedstorage2:relays" + }, + { + "item": "minecraft:blue_dye" + } + ], + "result": { + "item": "refinedstorage2:blue_relay" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/brown_relay.json b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/brown_relay.json new file mode 100644 index 000000000..49c08e3ae --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/brown_relay.json @@ -0,0 +1,15 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "tag": "refinedstorage2:relays" + }, + { + "item": "minecraft:brown_dye" + } + ], + "result": { + "item": "refinedstorage2:brown_relay" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/cyan_relay.json b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/cyan_relay.json new file mode 100644 index 000000000..5e680e821 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/cyan_relay.json @@ -0,0 +1,15 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "tag": "refinedstorage2:relays" + }, + { + "item": "minecraft:cyan_dye" + } + ], + "result": { + "item": "refinedstorage2:cyan_relay" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/gray_relay.json b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/gray_relay.json new file mode 100644 index 000000000..c6676fcbf --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/gray_relay.json @@ -0,0 +1,15 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "tag": "refinedstorage2:relays" + }, + { + "item": "minecraft:gray_dye" + } + ], + "result": { + "item": "refinedstorage2:gray_relay" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/green_relay.json b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/green_relay.json new file mode 100644 index 000000000..da3689085 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/green_relay.json @@ -0,0 +1,15 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "tag": "refinedstorage2:relays" + }, + { + "item": "minecraft:green_dye" + } + ], + "result": { + "item": "refinedstorage2:green_relay" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/light_blue_relay.json b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/light_blue_relay.json new file mode 100644 index 000000000..37fb39142 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/light_blue_relay.json @@ -0,0 +1,15 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "tag": "refinedstorage2:relays" + }, + { + "item": "minecraft:light_blue_dye" + } + ], + "result": { + "item": "refinedstorage2:relay" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/light_gray_relay.json b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/light_gray_relay.json new file mode 100644 index 000000000..108d49c9f --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/light_gray_relay.json @@ -0,0 +1,15 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "tag": "refinedstorage2:relays" + }, + { + "item": "minecraft:light_gray_dye" + } + ], + "result": { + "item": "refinedstorage2:light_gray_relay" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/lime_relay.json b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/lime_relay.json new file mode 100644 index 000000000..f327a70cd --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/lime_relay.json @@ -0,0 +1,15 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "tag": "refinedstorage2:relays" + }, + { + "item": "minecraft:lime_dye" + } + ], + "result": { + "item": "refinedstorage2:lime_relay" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/magenta_relay.json b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/magenta_relay.json new file mode 100644 index 000000000..b20acee6f --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/magenta_relay.json @@ -0,0 +1,15 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "tag": "refinedstorage2:relays" + }, + { + "item": "minecraft:magenta_dye" + } + ], + "result": { + "item": "refinedstorage2:magenta_relay" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/orange_relay.json b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/orange_relay.json new file mode 100644 index 000000000..383053a5b --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/orange_relay.json @@ -0,0 +1,15 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "tag": "refinedstorage2:relays" + }, + { + "item": "minecraft:orange_dye" + } + ], + "result": { + "item": "refinedstorage2:orange_relay" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/pink_relay.json b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/pink_relay.json new file mode 100644 index 000000000..46eacad2d --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/pink_relay.json @@ -0,0 +1,15 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "tag": "refinedstorage2:relays" + }, + { + "item": "minecraft:pink_dye" + } + ], + "result": { + "item": "refinedstorage2:pink_relay" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/purple_relay.json b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/purple_relay.json new file mode 100644 index 000000000..b069db8ad --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/purple_relay.json @@ -0,0 +1,15 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "tag": "refinedstorage2:relays" + }, + { + "item": "minecraft:purple_dye" + } + ], + "result": { + "item": "refinedstorage2:purple_relay" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/red_relay.json b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/red_relay.json new file mode 100644 index 000000000..8f04b7e21 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/red_relay.json @@ -0,0 +1,15 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "tag": "refinedstorage2:relays" + }, + { + "item": "minecraft:red_dye" + } + ], + "result": { + "item": "refinedstorage2:red_relay" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/white_relay.json b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/white_relay.json new file mode 100644 index 000000000..d58f4f5ed --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/white_relay.json @@ -0,0 +1,15 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "tag": "refinedstorage2:relays" + }, + { + "item": "minecraft:white_dye" + } + ], + "result": { + "item": "refinedstorage2:white_relay" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/yellow_relay.json b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/yellow_relay.json new file mode 100644 index 000000000..d2c04d4b0 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/recipes/coloring/yellow_relay.json @@ -0,0 +1,15 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "tag": "refinedstorage2:relays" + }, + { + "item": "minecraft:yellow_dye" + } + ], + "result": { + "item": "refinedstorage2:yellow_relay" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/tags/items/relays.json b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/tags/items/relays.json new file mode 100644 index 000000000..d65c7afe7 --- /dev/null +++ b/refinedstorage2-platform-common/src/generated/resources/data/refinedstorage2/tags/items/relays.json @@ -0,0 +1,20 @@ +{ + "values": [ + "refinedstorage2:white_relay", + "refinedstorage2:orange_relay", + "refinedstorage2:magenta_relay", + "refinedstorage2:relay", + "refinedstorage2:yellow_relay", + "refinedstorage2:lime_relay", + "refinedstorage2:pink_relay", + "refinedstorage2:gray_relay", + "refinedstorage2:light_gray_relay", + "refinedstorage2:cyan_relay", + "refinedstorage2:purple_relay", + "refinedstorage2:blue_relay", + "refinedstorage2:brown_relay", + "refinedstorage2:green_relay", + "refinedstorage2:red_relay", + "refinedstorage2:black_relay" + ] +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/AbstractClientModInitializer.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/AbstractClientModInitializer.java index 8530d48e2..e73ce9111 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/AbstractClientModInitializer.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/AbstractClientModInitializer.java @@ -18,6 +18,7 @@ import com.refinedmods.refinedstorage2.platform.common.iface.InterfaceScreen; import com.refinedmods.refinedstorage2.platform.common.importer.ImporterScreen; import com.refinedmods.refinedstorage2.platform.common.networking.NetworkTransmitterScreen; +import com.refinedmods.refinedstorage2.platform.common.networking.RelayScreen; import com.refinedmods.refinedstorage2.platform.common.security.FallbackSecurityCardScreen; import com.refinedmods.refinedstorage2.platform.common.security.SecurityCardScreen; import com.refinedmods.refinedstorage2.platform.common.security.SecurityManagerScreen; @@ -81,6 +82,7 @@ protected static void registerScreens(final ScreenRegistration registration) { registration.register(Menus.INSTANCE.getSecurityCard(), SecurityCardScreen::new); registration.register(Menus.INSTANCE.getFallbackSecurityCard(), FallbackSecurityCardScreen::new); registration.register(Menus.INSTANCE.getSecurityManager(), SecurityManagerScreen::new); + registration.register(Menus.INSTANCE.getRelay(), RelayScreen::new); } protected static void registerAlternativeGridHints() { diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/AbstractModInitializer.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/AbstractModInitializer.java index 7d8409d4c..82f97c96d 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/AbstractModInitializer.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/AbstractModInitializer.java @@ -4,7 +4,9 @@ import com.refinedmods.refinedstorage2.api.network.impl.energy.EnergyNetworkComponentImpl; import com.refinedmods.refinedstorage2.api.network.impl.node.GraphNetworkComponentImpl; import com.refinedmods.refinedstorage2.api.network.impl.node.SimpleNetworkNode; +import com.refinedmods.refinedstorage2.api.network.impl.security.SecurityNetworkComponentImpl; import com.refinedmods.refinedstorage2.api.network.node.GraphNetworkComponent; +import com.refinedmods.refinedstorage2.api.network.security.SecurityNetworkComponent; import com.refinedmods.refinedstorage2.api.network.storage.StorageNetworkComponent; import com.refinedmods.refinedstorage2.platform.api.PlatformApi; import com.refinedmods.refinedstorage2.platform.api.PlatformApiProxy; @@ -55,6 +57,8 @@ import com.refinedmods.refinedstorage2.platform.common.networking.NetworkReceiverBlockEntity; import com.refinedmods.refinedstorage2.platform.common.networking.NetworkTransmitterBlockEntity; import com.refinedmods.refinedstorage2.platform.common.networking.NetworkTransmitterContainerMenu; +import com.refinedmods.refinedstorage2.platform.common.networking.RelayBlockEntity; +import com.refinedmods.refinedstorage2.platform.common.networking.RelayContainerMenu; import com.refinedmods.refinedstorage2.platform.common.security.BuiltinPermission; import com.refinedmods.refinedstorage2.platform.common.security.FallbackSecurityCardContainerMenu; import com.refinedmods.refinedstorage2.platform.common.security.PlatformSecurityNetworkComponentImpl; @@ -158,6 +162,7 @@ import static com.refinedmods.refinedstorage2.platform.common.content.ContentIds.QUARTZ_ENRICHED_IRON; import static com.refinedmods.refinedstorage2.platform.common.content.ContentIds.QUARTZ_ENRICHED_IRON_BLOCK; import static com.refinedmods.refinedstorage2.platform.common.content.ContentIds.REGULATOR_UPGRADE; +import static com.refinedmods.refinedstorage2.platform.common.content.ContentIds.RELAY; import static com.refinedmods.refinedstorage2.platform.common.content.ContentIds.SECURITY_CARD; import static com.refinedmods.refinedstorage2.platform.common.content.ContentIds.SECURITY_MANAGER; import static com.refinedmods.refinedstorage2.platform.common.content.ContentIds.SILICON; @@ -264,6 +269,10 @@ private void registerNetworkComponents() { PlatformSecurityNetworkComponent.class, network -> new PlatformSecurityNetworkComponentImpl(PlatformApi.INSTANCE.createDefaultSecurityPolicy()) ); + PlatformApi.INSTANCE.getNetworkComponentMapFactory().addFactory( + SecurityNetworkComponent.class, + network -> new SecurityNetworkComponentImpl(PlatformApi.INSTANCE.createDefaultSecurityPolicy()) + ); } private void registerWirelessTransmitterRangeModifiers() { @@ -328,6 +337,7 @@ protected final void registerBlocks( creativePortableGridBlockEntityFactory ))); Blocks.INSTANCE.getSecurityManager().registerBlocks(callback); + Blocks.INSTANCE.getRelay().registerBlocks(callback); } protected final void registerItems(final RegistryCallback callback) { @@ -347,6 +357,7 @@ protected final void registerItems(final RegistryCallback callback) { Blocks.INSTANCE.getNetworkReceiver().registerItems(callback, Items.INSTANCE::addNetworkReceiver); Blocks.INSTANCE.getNetworkTransmitter().registerItems(callback, Items.INSTANCE::addNetworkTransmitter); Blocks.INSTANCE.getSecurityManager().registerItems(callback, Items.INSTANCE::addSecurityManager); + Blocks.INSTANCE.getRelay().registerItems(callback, Items.INSTANCE::addRelay); registerStorageItems(callback); registerUpgrades(callback); } @@ -642,6 +653,10 @@ protected final void registerBlockEntities( Blocks.INSTANCE.getSecurityManager().toArray() ) )); + BlockEntities.INSTANCE.setRelay(callback.register( + RELAY, + () -> typeFactory.create(RelayBlockEntity::new, Blocks.INSTANCE.getRelay().toArray()) + )); } protected final void registerMenus(final RegistryCallback> callback, @@ -737,6 +752,10 @@ protected final void registerMenus(final RegistryCallback> callback, Menus.INSTANCE.setSecurityManager(callback.register(SECURITY_MANAGER, () -> menuTypeFactory.create( (syncId, playerInventory, buf) -> new SecurityManagerContainerMenu(syncId, playerInventory) ))); + Menus.INSTANCE.setRelay(callback.register( + RELAY, + () -> menuTypeFactory.create(RelayContainerMenu::new) + )); } protected final void registerLootFunctions(final RegistryCallback callback) { diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/Config.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/Config.java index 0e9068ecf..1bdb808b2 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/Config.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/Config.java @@ -66,6 +66,8 @@ public interface Config { SimpleEnergyUsageEntry getSecurityManager(); + RelayEntry getRelay(); + interface SimpleEnergyUsageEntry { long getEnergyUsage(); } @@ -185,4 +187,10 @@ interface PortableGridEntry { long getExtractEnergyUsage(); } + + interface RelayEntry { + long getInputNetworkEnergyUsage(); + + long getOutputNetworkEnergyUsage(); + } } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/BlockEntities.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/BlockEntities.java index 3d8ccc2a5..cd94473b5 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/BlockEntities.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/BlockEntities.java @@ -12,6 +12,7 @@ import com.refinedmods.refinedstorage2.platform.common.importer.ImporterBlockEntity; import com.refinedmods.refinedstorage2.platform.common.networking.NetworkReceiverBlockEntity; import com.refinedmods.refinedstorage2.platform.common.networking.NetworkTransmitterBlockEntity; +import com.refinedmods.refinedstorage2.platform.common.networking.RelayBlockEntity; import com.refinedmods.refinedstorage2.platform.common.security.SecurityManagerBlockEntity; import com.refinedmods.refinedstorage2.platform.common.storage.FluidStorageType; import com.refinedmods.refinedstorage2.platform.common.storage.ItemStorageType; @@ -80,6 +81,8 @@ public final class BlockEntities { private Supplier> creativePortableGrid; @Nullable private Supplier> securityManager; + @Nullable + private Supplier> relay; private BlockEntities() { } @@ -263,4 +266,12 @@ public BlockEntityType getSecurityManager() { public void setSecurityManager(final Supplier> supplier) { this.securityManager = supplier; } + + public BlockEntityType getRelay() { + return requireNonNull(relay).get(); + } + + public void setRelay(final Supplier> supplier) { + this.relay = supplier; + } } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/Blocks.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/Blocks.java index f393da0a5..c4814773d 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/Blocks.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/Blocks.java @@ -17,6 +17,7 @@ import com.refinedmods.refinedstorage2.platform.common.networking.CableBlock; import com.refinedmods.refinedstorage2.platform.common.networking.NetworkReceiverBlock; import com.refinedmods.refinedstorage2.platform.common.networking.NetworkTransmitterBlock; +import com.refinedmods.refinedstorage2.platform.common.networking.RelayBlock; import com.refinedmods.refinedstorage2.platform.common.security.SecurityManagerBlock; import com.refinedmods.refinedstorage2.platform.common.storage.FluidStorageType; import com.refinedmods.refinedstorage2.platform.common.storage.ItemStorageType; @@ -144,6 +145,12 @@ public final class Blocks { ContentNames.SECURITY_MANAGER, COLOR ); + private final BlockColorMap relay = new BlockColorMap<>( + RelayBlock::new, + ContentIds.RELAY, + ContentNames.RELAY, + COLOR + ); @Nullable private Supplier quartzEnrichedIronBlock; @@ -301,4 +308,8 @@ public void setCreativePortableGrid(final Supplier supplier) public BlockColorMap getSecurityManager() { return securityManager; } + + public BlockColorMap getRelay() { + return relay; + } } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/ContentIds.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/ContentIds.java index c1898295d..5d61fa250 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/ContentIds.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/ContentIds.java @@ -57,6 +57,7 @@ public final class ContentIds { public static final ResourceLocation SECURITY_CARD = createIdentifier("security_card"); public static final ResourceLocation FALLBACK_SECURITY_CARD = createIdentifier("fallback_security_card"); public static final ResourceLocation SECURITY_MANAGER = createIdentifier("security_manager"); + public static final ResourceLocation RELAY = createIdentifier("relay"); private ContentIds() { } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/ContentNames.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/ContentNames.java index 9a6ea25f5..6ce442caf 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/ContentNames.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/ContentNames.java @@ -32,6 +32,7 @@ public final class ContentNames { public static final MutableComponent SECURITY_CARD = createTranslation("item", "security_card"); public static final MutableComponent FALLBACK_SECURITY_CARD = createTranslation("item", "fallback_security_card"); public static final MutableComponent SECURITY_MANAGER = name("security_manager"); + public static final MutableComponent RELAY = name("relay"); private ContentNames() { } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/CreativeModeTabItems.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/CreativeModeTabItems.java index fd43e703b..f79f0546b 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/CreativeModeTabItems.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/CreativeModeTabItems.java @@ -54,6 +54,7 @@ private static void appendBlocks(final Consumer consumer) { Items.INSTANCE.getNetworkTransmitters().stream().map(Supplier::get).forEach(itemConsumer); Items.INSTANCE.getNetworkReceivers().stream().map(Supplier::get).forEach(itemConsumer); Items.INSTANCE.getSecurityManagers().stream().map(Supplier::get).forEach(itemConsumer); + Items.INSTANCE.getRelays().stream().map(Supplier::get).forEach(itemConsumer); } private static void appendBlockColors(final Consumer consumer, final BlockColorMap map) { diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/DefaultEnergyUsage.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/DefaultEnergyUsage.java index d01592d55..cad36d18a 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/DefaultEnergyUsage.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/DefaultEnergyUsage.java @@ -17,6 +17,8 @@ public final class DefaultEnergyUsage { public static final long NETWORK_RECEIVER = 8; public static final long NETWORK_TRANSMITTER = 32; public static final long SECURITY_MANAGER = 16; + public static final long RELAY_INPUT_NETWORK = 8; + public static final long RELAY_OUTPUT_NETWORK = 8; public static final long CONTROLLER_CAPACITY = 1000; diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/Items.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/Items.java index 4d8dea711..07036ed8d 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/Items.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/Items.java @@ -48,6 +48,7 @@ public final class Items { private final List> allNetworkReceivers = new ArrayList<>(); private final List> allNetworkTransmitters = new ArrayList<>(); private final List> allSecurityManagers = new ArrayList<>(); + private final List> allRelays = new ArrayList<>(); @Nullable private Supplier quartzEnrichedIron; @Nullable @@ -407,6 +408,14 @@ public List> getSecurityManagers() { return Collections.unmodifiableList(allSecurityManagers); } + public void addRelay(final Supplier supplier) { + allRelays.add(supplier); + } + + public List> getRelays() { + return Collections.unmodifiableList(allRelays); + } + public Item getNetworkCard() { return requireNonNull(networkCard).get(); } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/Menus.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/Menus.java index 197b59973..21c477e97 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/Menus.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/Menus.java @@ -11,6 +11,7 @@ import com.refinedmods.refinedstorage2.platform.common.iface.InterfaceContainerMenu; import com.refinedmods.refinedstorage2.platform.common.importer.ImporterContainerMenu; import com.refinedmods.refinedstorage2.platform.common.networking.NetworkTransmitterContainerMenu; +import com.refinedmods.refinedstorage2.platform.common.networking.RelayContainerMenu; import com.refinedmods.refinedstorage2.platform.common.security.FallbackSecurityCardContainerMenu; import com.refinedmods.refinedstorage2.platform.common.security.SecurityCardContainerMenu; import com.refinedmods.refinedstorage2.platform.common.security.SecurityManagerContainerMenu; @@ -80,6 +81,8 @@ public final class Menus { private Supplier> fallbackSecurityCard; @Nullable private Supplier> securityManager; + @Nullable + private Supplier> relay; private Menus() { } @@ -269,4 +272,12 @@ public MenuType getSecurityManager() { public void setSecurityManager(final Supplier> securityManager) { this.securityManager = securityManager; } + + public MenuType getRelay() { + return requireNonNull(relay).get(); + } + + public void setRelay(final Supplier> relay) { + this.relay = relay; + } } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/Tags.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/Tags.java index c46aeeb72..068fdd0de 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/Tags.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/content/Tags.java @@ -24,6 +24,7 @@ public final class Tags { public static final TagKey NETWORK_RECEIVERS = createTag("network_receivers"); public static final TagKey NETWORK_TRANSMITTERS = createTag("network_transmitters"); public static final TagKey SECURITY_MANAGERS = createTag("security_managers"); + public static final TagKey RELAYS = createTag("relays"); private Tags() { } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/detector/DetectorBlock.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/detector/DetectorBlock.java index 3f08564e9..24de98829 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/detector/DetectorBlock.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/detector/DetectorBlock.java @@ -10,8 +10,8 @@ import com.refinedmods.refinedstorage2.platform.common.support.BlockItemProvider; import com.refinedmods.refinedstorage2.platform.common.support.ColorableBlock; import com.refinedmods.refinedstorage2.platform.common.support.NetworkNodeBlockItem; +import com.refinedmods.refinedstorage2.platform.common.support.direction.DefaultDirectionType; import com.refinedmods.refinedstorage2.platform.common.support.direction.DirectionType; -import com.refinedmods.refinedstorage2.platform.common.support.direction.DirectionTypeImpl; import com.refinedmods.refinedstorage2.platform.common.support.network.NetworkNodeBlockEntityTicker; import net.minecraft.core.BlockPos; @@ -65,7 +65,7 @@ public DetectorBlock(final DyeColor color, final MutableComponent name) { @Override protected DirectionType getDirectionType() { - return DirectionTypeImpl.INSTANCE; + return DefaultDirectionType.FACE_CLICKED; } @Override diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/AbstractGridSynchronizer.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/AbstractGridSynchronizer.java index 9aa55136a..bcdc117d4 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/AbstractGridSynchronizer.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/grid/AbstractGridSynchronizer.java @@ -13,6 +13,6 @@ public ResourceLocation getTextureIdentifier() { @Override public int getYTexture() { - return 97; + return 96; } } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/NetworkTransmitterBlockEntity.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/NetworkTransmitterBlockEntity.java index 4433c8323..004f4c99d 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/NetworkTransmitterBlockEntity.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/NetworkTransmitterBlockEntity.java @@ -3,7 +3,6 @@ import com.refinedmods.refinedstorage2.api.network.Network; import com.refinedmods.refinedstorage2.api.network.impl.node.SimpleNetworkNode; import com.refinedmods.refinedstorage2.api.network.node.GraphNetworkComponent; -import com.refinedmods.refinedstorage2.platform.api.PlatformApi; import com.refinedmods.refinedstorage2.platform.api.support.network.ConnectionSink; import com.refinedmods.refinedstorage2.platform.common.Platform; import com.refinedmods.refinedstorage2.platform.common.content.BlockEntities; @@ -68,7 +67,7 @@ public NetworkTransmitterBlockEntity(final BlockPos pos, final BlockState state) if (level != null) { LOGGER.debug("Network card was changed at {}, sending network update", worldPosition); setChanged(); - PlatformApi.INSTANCE.onNetworkNodeContainerUpdated(mainContainer, level); + updateContainers(); } }); } @@ -76,20 +75,20 @@ public NetworkTransmitterBlockEntity(final BlockPos pos, final BlockState state) @Override protected void activenessChanged(final boolean newActive) { super.activenessChanged(newActive); - PlatformApi.INSTANCE.onNetworkNodeContainerUpdated(mainContainer, level); + updateContainers(); } public void updateStateInLevel(final BlockState state) { final NetworkTransmitterState currentState = state.getValue(NetworkTransmitterBlock.STATE); - final NetworkTransmitterState newState = getState(); + final NetworkTransmitterState newState = calculateState(); if (currentState != newState && level != null && stateChangeRateLimiter.tryAcquire()) { LOGGER.debug("Updating network transmitter at {} from {} to {}", worldPosition, currentState, newState); level.setBlockAndUpdate(worldPosition, state.setValue(NetworkTransmitterBlock.STATE, newState)); } } - private NetworkTransmitterState getState() { - if (!isActive()) { + private NetworkTransmitterState calculateState() { + if (!mainNode.isActive()) { return NetworkTransmitterState.INACTIVE; } if (receiverKey == null) { @@ -105,7 +104,7 @@ private NetworkTransmitterState getState() { NetworkTransmitterStatus getStatus() { final Network network = mainNode.getNetwork(); - if (!isActive() || network == null || level == null) { + if (!mainNode.isActive() || network == null || level == null) { return INACTIVE; } if (receiverKey == null) { @@ -126,7 +125,7 @@ NetworkTransmitterStatus getStatus() { @Override public void doWork() { super.doWork(); - if (!isActive() || mainNode.getNetwork() == null || receiverKey == null) { + if (!mainNode.isActive() || mainNode.getNetwork() == null || receiverKey == null) { return; } final boolean receiverFound = isReceiverFoundInNetwork(mainNode.getNetwork(), receiverKey); @@ -141,7 +140,7 @@ private void tryReconnectingWithReceiver() { receiverKey, worldPosition ); - PlatformApi.INSTANCE.onNetworkNodeContainerUpdated(mainContainer, level); + updateContainers(); } private static boolean isReceiverFoundInNetwork(final Network network, final NetworkReceiverKey key) { @@ -197,7 +196,7 @@ public NonNullList getDrops() { @Override public void addOutgoingConnections(final ConnectionSink sink) { super.addOutgoingConnections(sink); - if (receiverKey != null && isActive()) { + if (receiverKey != null && mainNode.isActive()) { sink.tryConnect(receiverKey.pos()); } } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/NetworkTransmitterContainerMenu.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/NetworkTransmitterContainerMenu.java index 812c6083b..83acf1856 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/NetworkTransmitterContainerMenu.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/NetworkTransmitterContainerMenu.java @@ -15,7 +15,6 @@ import net.minecraft.network.FriendlyByteBuf; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.Container; -import net.minecraft.world.SimpleContainer; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; @@ -49,7 +48,7 @@ public NetworkTransmitterContainerMenu(final int syncId, this.blockEntity = null; this.player = playerInventory.player; this.status = new NetworkTransmitterStatus(buf.readBoolean(), buf.readComponent()); - addSlots(playerInventory, new SimpleContainer(1)); + addSlots(playerInventory, new NetworkCardInventory()); } @Override diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/RelayBlock.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/RelayBlock.java new file mode 100644 index 000000000..b54b36db8 --- /dev/null +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/RelayBlock.java @@ -0,0 +1,99 @@ +package com.refinedmods.refinedstorage2.platform.common.networking; + +import com.refinedmods.refinedstorage2.platform.common.content.BlockColorMap; +import com.refinedmods.refinedstorage2.platform.common.content.BlockConstants; +import com.refinedmods.refinedstorage2.platform.common.content.BlockEntities; +import com.refinedmods.refinedstorage2.platform.common.content.Blocks; +import com.refinedmods.refinedstorage2.platform.common.support.AbstractBlockEntityTicker; +import com.refinedmods.refinedstorage2.platform.common.support.AbstractDirectionalBlock; +import com.refinedmods.refinedstorage2.platform.common.support.BaseBlockItem; +import com.refinedmods.refinedstorage2.platform.common.support.BlockItemProvider; +import com.refinedmods.refinedstorage2.platform.common.support.ColorableBlock; +import com.refinedmods.refinedstorage2.platform.common.support.direction.DefaultDirectionType; +import com.refinedmods.refinedstorage2.platform.common.support.direction.DirectionType; +import com.refinedmods.refinedstorage2.platform.common.support.network.NetworkNodeBlockEntityTicker; + +import javax.annotation.Nullable; + +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.world.item.DyeColor; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.EntityBlock; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BooleanProperty; + +public class RelayBlock extends AbstractDirectionalBlock + implements EntityBlock, ColorableBlock, BlockItemProvider { + public static final BooleanProperty ACTIVE = BooleanProperty.create("active"); + + private static final AbstractBlockEntityTicker TICKER = new NetworkNodeBlockEntityTicker<>( + BlockEntities.INSTANCE::getRelay, + ACTIVE + ); + + private final MutableComponent name; + private final DyeColor color; + + public RelayBlock(final DyeColor color, final MutableComponent name) { + super(BlockConstants.PROPERTIES); + this.name = name; + this.color = color; + } + + @Override + protected BlockState getDefaultState() { + return super.getDefaultState().setValue(ACTIVE, false); + } + + @Override + protected void createBlockStateDefinition(final StateDefinition.Builder builder) { + super.createBlockStateDefinition(builder); + builder.add(ACTIVE); + } + + @Nullable + @Override + public BlockEntity newBlockEntity(final BlockPos blockPos, final BlockState blockState) { + return new RelayBlockEntity(blockPos, blockState); + } + + @Nullable + @Override + public BlockEntityTicker getTicker(final Level level, + final BlockState blockState, + final BlockEntityType type) { + return TICKER.get(level, type); + } + + @Override + protected DirectionType getDirectionType() { + return DefaultDirectionType.FACE_PLAYER; + } + + @Override + public BaseBlockItem createBlockItem() { + return new BaseBlockItem(this); + } + + @Override + public BlockColorMap getBlockColorMap() { + return Blocks.INSTANCE.getRelay(); + } + + @Override + public MutableComponent getName() { + return name; + } + + @Override + public DyeColor getColor() { + return color; + } +} diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/RelayBlockEntity.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/RelayBlockEntity.java new file mode 100644 index 000000000..b2b093bf6 --- /dev/null +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/RelayBlockEntity.java @@ -0,0 +1,246 @@ +package com.refinedmods.refinedstorage2.platform.common.networking; + +import com.refinedmods.refinedstorage2.api.network.impl.node.relay.RelayComponentType; +import com.refinedmods.refinedstorage2.api.network.impl.node.relay.RelayInputNetworkNode; +import com.refinedmods.refinedstorage2.api.network.impl.node.relay.RelayOutputNetworkNode; +import com.refinedmods.refinedstorage2.api.resource.ResourceKey; +import com.refinedmods.refinedstorage2.api.resource.filter.FilterMode; +import com.refinedmods.refinedstorage2.api.storage.AccessMode; +import com.refinedmods.refinedstorage2.platform.api.support.network.InWorldNetworkNodeContainer; +import com.refinedmods.refinedstorage2.platform.common.Platform; +import com.refinedmods.refinedstorage2.platform.common.content.BlockEntities; +import com.refinedmods.refinedstorage2.platform.common.content.ContentNames; +import com.refinedmods.refinedstorage2.platform.common.storage.AccessModeSettings; +import com.refinedmods.refinedstorage2.platform.common.support.FilterModeSettings; +import com.refinedmods.refinedstorage2.platform.common.support.FilterWithFuzzyMode; +import com.refinedmods.refinedstorage2.platform.common.support.RedstoneMode; +import com.refinedmods.refinedstorage2.platform.common.support.containermenu.NetworkNodeMenuProvider; +import com.refinedmods.refinedstorage2.platform.common.support.network.AbstractRedstoneModeNetworkNodeContainerBlockEntity; +import com.refinedmods.refinedstorage2.platform.common.support.resource.ResourceContainerImpl; + +import java.util.HashSet; +import java.util.Set; +import javax.annotation.Nullable; + +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.chat.Component; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.level.block.state.BlockState; + +import static java.util.Objects.requireNonNull; + +public class RelayBlockEntity extends AbstractRedstoneModeNetworkNodeContainerBlockEntity + implements NetworkNodeMenuProvider { + private static final String TAG_PASS_THROUGH = "passthrough"; + private static final String TAG_PASS_ENERGY = "passenergy"; + private static final String TAG_PASS_SECURITY = "passsecurity"; + private static final String TAG_PASS_STORAGE = "passstorage"; + private static final String TAG_FILTER_MODE = "fim"; + private static final String TAG_ACCESS_MODE = "am"; + private static final String TAG_PRIORITY = "pri"; + + private final FilterWithFuzzyMode filter; + private final RelayOutputNetworkNode outputNode; + + private boolean passThrough = true; + private FilterMode filterMode = FilterMode.BLOCK; + private AccessMode accessMode = AccessMode.INSERT_EXTRACT; + private int priority = 0; + + public RelayBlockEntity(final BlockPos pos, final BlockState state) { + super(BlockEntities.INSTANCE.getRelay(), pos, state, new RelayInputNetworkNode( + Platform.INSTANCE.getConfig().getRelay().getInputNetworkEnergyUsage() + )); + this.outputNode = new RelayOutputNetworkNode( + Platform.INSTANCE.getConfig().getRelay().getOutputNetworkEnergyUsage() + ); + this.mainNode.setOutputNode(outputNode); + this.filter = FilterWithFuzzyMode.createAndListenForUniqueFilters( + ResourceContainerImpl.createForFilter(), + this::setChanged, + this::filterContainerChanged + ); + this.mainNode.setFilterNormalizer(filter.createNormalizer()); + this.addContainer(new RelayOutputNetworkNodeContainer(this, outputNode)); + setRedstoneMode(RedstoneMode.LOW); + } + + boolean isFuzzyMode() { + return filter.isFuzzyMode(); + } + + void setFuzzyMode(final boolean fuzzyMode) { + final boolean wasActive = mainNode.isActive(); + // Updating fuzzy mode will call the filter's listener as the normalizer will yield different outputs. + // However, when updating a filter the storage resets and "self-removes". If the normalizer yields different + // outputs too early, the self-remove operation will partially fail as the expected resources will be different. + // Therefore, we need to deactivate the node, update the fuzzy mode, and then reinitialize the node (ugly hack). + mainNode.setActive(false); + filter.setFuzzyMode(fuzzyMode); + mainNode.setActive(wasActive); + } + + private void filterContainerChanged(final Set filters) { + mainNode.setFilters(filters); + setChanged(); + } + + int getPriority() { + return priority; + } + + void setPriority(final int priority) { + this.priority = priority; + this.mainNode.setPriority(priority); + setChanged(); + } + + AccessMode getAccessMode() { + return accessMode; + } + + void setAccessMode(final AccessMode accessMode) { + this.accessMode = accessMode; + mainNode.setAccessMode(accessMode); + setChanged(); + } + + FilterMode getFilterMode() { + return filterMode; + } + + void setFilterMode(final FilterMode filterMode) { + this.filterMode = filterMode; + mainNode.setFilterMode(filterMode); + setChanged(); + } + + boolean isPassEnergy() { + return mainNode.hasComponentType(RelayComponentType.ENERGY); + } + + void setPassEnergy(final boolean passEnergy) { + mainNode.updateComponentType(RelayComponentType.ENERGY, passEnergy); + setChanged(); + } + + boolean isPassStorage() { + return mainNode.hasComponentType(RelayComponentType.STORAGE); + } + + void setPassStorage(final boolean passStorage) { + mainNode.updateComponentType(RelayComponentType.STORAGE, passStorage); + setChanged(); + } + + boolean isPassSecurity() { + return mainNode.hasComponentType(RelayComponentType.SECURITY); + } + + void setPassSecurity(final boolean passSecurity) { + mainNode.updateComponentType(RelayComponentType.SECURITY, passSecurity); + setChanged(); + } + + boolean isPassThrough() { + return passThrough; + } + + void setPassThrough(final boolean passThrough) { + this.passThrough = passThrough; + this.mainNode.setComponentTypes(Set.of()); + setChanged(); + updateContainers(); + } + + boolean isActiveInternal() { + return mainNode.isActive(); + } + + Direction getDirectionInternal() { + return requireNonNull(getDirection()); + } + + @Override + protected void activenessChanged(final boolean newActive) { + super.activenessChanged(newActive); + outputNode.setActive(newActive); + updateContainers(); + } + + @Override + protected InWorldNetworkNodeContainer createMainContainer(final RelayInputNetworkNode node) { + return new RelayInputNetworkNodeContainer(this, node); + } + + @Override + public void writeScreenOpeningData(final ServerPlayer player, final FriendlyByteBuf buf) { + filter.getFilterContainer().writeToUpdatePacket(buf); + } + + @Override + public Component getDisplayName() { + return ContentNames.RELAY; + } + + @Nullable + @Override + public AbstractContainerMenu createMenu(final int syncId, final Inventory inventory, final Player player) { + return new RelayContainerMenu(syncId, player, this, filter.getFilterContainer()); + } + + @Override + public void writeConfiguration(final CompoundTag tag) { + super.writeConfiguration(tag); + filter.save(tag); + tag.putInt(TAG_FILTER_MODE, FilterModeSettings.getFilterMode(filterMode)); + tag.putBoolean(TAG_PASS_THROUGH, passThrough); + tag.putBoolean(TAG_PASS_ENERGY, mainNode.hasComponentType(RelayComponentType.ENERGY)); + tag.putBoolean(TAG_PASS_STORAGE, mainNode.hasComponentType(RelayComponentType.STORAGE)); + tag.putBoolean(TAG_PASS_SECURITY, mainNode.hasComponentType(RelayComponentType.SECURITY)); + tag.putInt(TAG_ACCESS_MODE, AccessModeSettings.getAccessMode(accessMode)); + tag.putInt(TAG_PRIORITY, priority); + } + + @Override + public void readConfiguration(final CompoundTag tag) { + super.readConfiguration(tag); + filter.load(tag); + if (tag.contains(TAG_FILTER_MODE)) { + filterMode = FilterModeSettings.getFilterMode(tag.getInt(TAG_FILTER_MODE)); + } + mainNode.setFilterMode(filterMode); + if (tag.contains(TAG_PASS_THROUGH)) { + passThrough = tag.getBoolean(TAG_PASS_THROUGH); + } + mainNode.setComponentTypes(getComponentTypes(tag)); + if (tag.contains(TAG_ACCESS_MODE)) { + accessMode = AccessModeSettings.getAccessMode(tag.getInt(TAG_ACCESS_MODE)); + } + mainNode.setAccessMode(accessMode); + if (tag.contains(TAG_PRIORITY)) { + priority = tag.getInt(TAG_PRIORITY); + } + mainNode.setPriority(priority); + } + + private Set getComponentTypes(final CompoundTag tag) { + final Set types = new HashSet<>(); + if (tag.getBoolean(TAG_PASS_ENERGY)) { + types.add(RelayComponentType.ENERGY); + } + if (tag.getBoolean(TAG_PASS_SECURITY)) { + types.add(RelayComponentType.SECURITY); + } + if (tag.getBoolean(TAG_PASS_STORAGE)) { + types.add(RelayComponentType.STORAGE); + } + return types; + } +} diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/RelayContainerMenu.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/RelayContainerMenu.java new file mode 100644 index 000000000..86a6494e7 --- /dev/null +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/RelayContainerMenu.java @@ -0,0 +1,154 @@ +package com.refinedmods.refinedstorage2.platform.common.networking; + +import com.refinedmods.refinedstorage2.api.resource.filter.FilterMode; +import com.refinedmods.refinedstorage2.api.storage.AccessMode; +import com.refinedmods.refinedstorage2.platform.api.support.resource.ResourceContainer; +import com.refinedmods.refinedstorage2.platform.common.content.Menus; +import com.refinedmods.refinedstorage2.platform.common.storage.StoragePropertyTypes; +import com.refinedmods.refinedstorage2.platform.common.support.RedstoneMode; +import com.refinedmods.refinedstorage2.platform.common.support.containermenu.AbstractSimpleFilterContainerMenu; +import com.refinedmods.refinedstorage2.platform.common.support.containermenu.ClientProperty; +import com.refinedmods.refinedstorage2.platform.common.support.containermenu.PropertyTypes; +import com.refinedmods.refinedstorage2.platform.common.support.containermenu.ServerProperty; + +import javax.annotation.Nullable; + +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; + +import static com.refinedmods.refinedstorage2.platform.common.util.IdentifierUtil.createTranslation; + +public class RelayContainerMenu extends AbstractSimpleFilterContainerMenu { + private static final MutableComponent FILTER_HELP = createTranslation("gui", "relay.filter_help"); + + @Nullable + private PassThroughListener passThroughListener; + + public RelayContainerMenu(final int syncId, final Inventory playerInventory, final FriendlyByteBuf buf) { + super( + Menus.INSTANCE.getRelay(), + syncId, + playerInventory.player, + buf, + null, + FILTER_HELP + ); + } + + RelayContainerMenu(final int syncId, + final Player player, + final RelayBlockEntity relay, + final ResourceContainer resourceContainer) { + super( + Menus.INSTANCE.getRelay(), + syncId, + player, + resourceContainer, + null, + relay, + FILTER_HELP + ); + } + + @Override + protected void registerClientProperties() { + registerProperty(new ClientProperty<>(PropertyTypes.REDSTONE_MODE, RedstoneMode.IGNORE)); + registerProperty(new ClientProperty<>(RelayPropertyTypes.PASS_THROUGH, true) { + @Override + protected void onChangedOnClient(final Boolean newValue) { + super.onChangedOnClient(newValue); + if (passThroughListener != null) { + passThroughListener.passThroughChanged( + Boolean.TRUE.equals(newValue), + Boolean.TRUE.equals(getProperty(RelayPropertyTypes.PASS_STORAGE).getValue()) + ); + } + } + }); + registerProperty(new ClientProperty<>(RelayPropertyTypes.PASS_ENERGY, false)); + registerProperty(new ClientProperty<>(RelayPropertyTypes.PASS_STORAGE, false) { + @Override + protected void onChangedOnClient(final Boolean newValue) { + super.onChangedOnClient(newValue); + if (passThroughListener != null) { + passThroughListener.passThroughChanged( + Boolean.TRUE.equals(getProperty(RelayPropertyTypes.PASS_THROUGH).getValue()), + Boolean.TRUE.equals(newValue) + ); + } + } + }); + registerProperty(new ClientProperty<>(RelayPropertyTypes.PASS_SECURITY, false)); + registerProperty(new ClientProperty<>(PropertyTypes.FILTER_MODE, FilterMode.BLOCK)); + registerProperty(new ClientProperty<>(StoragePropertyTypes.ACCESS_MODE, AccessMode.INSERT_EXTRACT)); + registerProperty(new ClientProperty<>(StoragePropertyTypes.PRIORITY, 0)); + registerProperty(new ClientProperty<>(PropertyTypes.FUZZY_MODE, false)); + } + + @Override + protected void registerServerProperties(final RelayBlockEntity blockEntity) { + registerProperty(new ServerProperty<>( + PropertyTypes.REDSTONE_MODE, + blockEntity::getRedstoneMode, + blockEntity::setRedstoneMode + )); + registerProperty(new ServerProperty<>( + RelayPropertyTypes.PASS_THROUGH, + blockEntity::isPassThrough, + blockEntity::setPassThrough + )); + registerProperty(new ServerProperty<>( + RelayPropertyTypes.PASS_ENERGY, + blockEntity::isPassEnergy, + blockEntity::setPassEnergy + )); + registerProperty(new ServerProperty<>( + RelayPropertyTypes.PASS_STORAGE, + blockEntity::isPassStorage, + blockEntity::setPassStorage + )); + registerProperty(new ServerProperty<>( + RelayPropertyTypes.PASS_SECURITY, + blockEntity::isPassSecurity, + blockEntity::setPassSecurity + )); + registerProperty(new ServerProperty<>( + PropertyTypes.FILTER_MODE, + blockEntity::getFilterMode, + blockEntity::setFilterMode + )); + registerProperty(new ServerProperty<>( + StoragePropertyTypes.ACCESS_MODE, + blockEntity::getAccessMode, + blockEntity::setAccessMode + )); + registerProperty(new ServerProperty<>( + StoragePropertyTypes.PRIORITY, + blockEntity::getPriority, + blockEntity::setPriority + )); + registerProperty(new ServerProperty<>( + PropertyTypes.FUZZY_MODE, + blockEntity::isFuzzyMode, + blockEntity::setFuzzyMode + )); + } + + boolean isPassThrough() { + return Boolean.TRUE.equals(getProperty(RelayPropertyTypes.PASS_THROUGH).getValue()); + } + + boolean isPassStorage() { + return Boolean.TRUE.equals(getProperty(RelayPropertyTypes.PASS_STORAGE).getValue()); + } + + void setPassThroughListener(final PassThroughListener passThroughListener) { + this.passThroughListener = passThroughListener; + } + + interface PassThroughListener { + void passThroughChanged(boolean passThrough, boolean passStorage); + } +} diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/RelayInputNetworkNodeContainer.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/RelayInputNetworkNodeContainer.java new file mode 100644 index 000000000..f20428859 --- /dev/null +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/RelayInputNetworkNodeContainer.java @@ -0,0 +1,36 @@ +package com.refinedmods.refinedstorage2.platform.common.networking; + +import com.refinedmods.refinedstorage2.api.network.node.NetworkNode; +import com.refinedmods.refinedstorage2.platform.api.support.network.ConnectionSink; +import com.refinedmods.refinedstorage2.platform.common.support.network.InWorldNetworkNodeContainerImpl; + +import net.minecraft.core.Direction; +import net.minecraft.world.level.block.state.BlockState; + +class RelayInputNetworkNodeContainer extends InWorldNetworkNodeContainerImpl { + private final RelayBlockEntity blockEntity; + + RelayInputNetworkNodeContainer(final RelayBlockEntity blockEntity, final NetworkNode node) { + super(blockEntity, node, "input", 0, blockEntity, null); + this.blockEntity = blockEntity; + } + + @Override + public void addOutgoingConnections(final ConnectionSink sink) { + final Direction direction = blockEntity.getDirectionInternal(); + for (final Direction otherDirection : Direction.values()) { + if (otherDirection != direction || (blockEntity.isPassThrough() && blockEntity.isActiveInternal())) { + sink.tryConnectInSameDimension( + blockEntity.getBlockPos().relative(otherDirection), + otherDirection.getOpposite() + ); + } + } + } + + @Override + public boolean canAcceptIncomingConnection(final Direction incomingDirection, final BlockState connectingState) { + return incomingDirection != blockEntity.getDirectionInternal() + || (blockEntity.isPassThrough() && blockEntity.isActiveInternal()); + } +} diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/RelayOutputNetworkNodeContainer.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/RelayOutputNetworkNodeContainer.java new file mode 100644 index 000000000..0d45d4d91 --- /dev/null +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/RelayOutputNetworkNodeContainer.java @@ -0,0 +1,36 @@ +package com.refinedmods.refinedstorage2.platform.common.networking; + +import com.refinedmods.refinedstorage2.api.network.impl.node.relay.RelayOutputNetworkNode; +import com.refinedmods.refinedstorage2.platform.api.support.network.ConnectionSink; +import com.refinedmods.refinedstorage2.platform.common.support.network.InWorldNetworkNodeContainerImpl; + +import net.minecraft.core.Direction; +import net.minecraft.world.level.block.state.BlockState; + +class RelayOutputNetworkNodeContainer extends InWorldNetworkNodeContainerImpl { + private final RelayBlockEntity blockEntity; + + RelayOutputNetworkNodeContainer(final RelayBlockEntity blockEntity, final RelayOutputNetworkNode node) { + super(blockEntity, node, "output", 0, blockEntity, null); + this.blockEntity = blockEntity; + } + + // The output network node container must always have an outgoing and incoming connection. + // If not, network node containers after the output network node container may end up without a network + // because the graph algorithm won't be able to work properly and won't be able to reassign a new network. + // The output network node container *never* provides a connection with the input network node container. + // The input network node container controls whether the output network node container is connected. + @Override + public void addOutgoingConnections(final ConnectionSink sink) { + final Direction direction = blockEntity.getDirectionInternal(); + sink.tryConnectInSameDimension( + blockEntity.getBlockPos().relative(direction), + direction.getOpposite() + ); + } + + @Override + public boolean canAcceptIncomingConnection(final Direction incomingDirection, final BlockState connectingState) { + return incomingDirection == blockEntity.getDirectionInternal(); + } +} diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/RelayPassEnergySideButtonWidget.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/RelayPassEnergySideButtonWidget.java new file mode 100644 index 000000000..731881458 --- /dev/null +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/RelayPassEnergySideButtonWidget.java @@ -0,0 +1,36 @@ +package com.refinedmods.refinedstorage2.platform.common.networking; + +import com.refinedmods.refinedstorage2.platform.common.support.containermenu.ClientProperty; +import com.refinedmods.refinedstorage2.platform.common.support.widget.AbstractYesNoSideButtonWidget; + +import javax.annotation.Nullable; + +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; + +import static com.refinedmods.refinedstorage2.platform.common.util.IdentifierUtil.createTranslation; + +class RelayPassEnergySideButtonWidget extends AbstractYesNoSideButtonWidget { + private static final MutableComponent TITLE = createTranslation("gui", "relay.pass_energy"); + private static final MutableComponent HELP = createTranslation("gui", "relay.pass_energy.help"); + + RelayPassEnergySideButtonWidget(final ClientProperty property) { + super(property, TITLE); + } + + @Override + protected int getXTexture() { + return Boolean.TRUE.equals(property.getValue()) ? 128 : 144; + } + + @Override + protected int getYTexture() { + return 0; + } + + @Nullable + @Override + protected Component getHelpText() { + return HELP; + } +} diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/RelayPassSecuritySideButtonWidget.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/RelayPassSecuritySideButtonWidget.java new file mode 100644 index 000000000..6e9271ac3 --- /dev/null +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/RelayPassSecuritySideButtonWidget.java @@ -0,0 +1,36 @@ +package com.refinedmods.refinedstorage2.platform.common.networking; + +import com.refinedmods.refinedstorage2.platform.common.support.containermenu.ClientProperty; +import com.refinedmods.refinedstorage2.platform.common.support.widget.AbstractYesNoSideButtonWidget; + +import javax.annotation.Nullable; + +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; + +import static com.refinedmods.refinedstorage2.platform.common.util.IdentifierUtil.createTranslation; + +class RelayPassSecuritySideButtonWidget extends AbstractYesNoSideButtonWidget { + private static final MutableComponent TITLE = createTranslation("gui", "relay.pass_security"); + private static final MutableComponent HELP = createTranslation("gui", "relay.pass_security.help"); + + RelayPassSecuritySideButtonWidget(final ClientProperty property) { + super(property, TITLE); + } + + @Override + protected int getXTexture() { + return Boolean.TRUE.equals(property.getValue()) ? 128 : 144; + } + + @Override + protected int getYTexture() { + return 32; + } + + @Nullable + @Override + protected Component getHelpText() { + return HELP; + } +} diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/RelayPassStorageSideButtonWidget.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/RelayPassStorageSideButtonWidget.java new file mode 100644 index 000000000..b6ec659fb --- /dev/null +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/RelayPassStorageSideButtonWidget.java @@ -0,0 +1,36 @@ +package com.refinedmods.refinedstorage2.platform.common.networking; + +import com.refinedmods.refinedstorage2.platform.common.support.containermenu.ClientProperty; +import com.refinedmods.refinedstorage2.platform.common.support.widget.AbstractYesNoSideButtonWidget; + +import javax.annotation.Nullable; + +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; + +import static com.refinedmods.refinedstorage2.platform.common.util.IdentifierUtil.createTranslation; + +class RelayPassStorageSideButtonWidget extends AbstractYesNoSideButtonWidget { + private static final MutableComponent TITLE = createTranslation("gui", "relay.pass_storage"); + private static final MutableComponent HELP = createTranslation("gui", "relay.pass_storage.help"); + + RelayPassStorageSideButtonWidget(final ClientProperty property) { + super(property, TITLE); + } + + @Override + protected int getXTexture() { + return Boolean.TRUE.equals(property.getValue()) ? 128 : 144; + } + + @Override + protected int getYTexture() { + return 16; + } + + @Nullable + @Override + protected Component getHelpText() { + return HELP; + } +} diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/RelayPassThroughSideButtonWidget.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/RelayPassThroughSideButtonWidget.java new file mode 100644 index 000000000..654761ace --- /dev/null +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/RelayPassThroughSideButtonWidget.java @@ -0,0 +1,36 @@ +package com.refinedmods.refinedstorage2.platform.common.networking; + +import com.refinedmods.refinedstorage2.platform.common.support.containermenu.ClientProperty; +import com.refinedmods.refinedstorage2.platform.common.support.widget.AbstractYesNoSideButtonWidget; + +import javax.annotation.Nullable; + +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; + +import static com.refinedmods.refinedstorage2.platform.common.util.IdentifierUtil.createTranslation; + +class RelayPassThroughSideButtonWidget extends AbstractYesNoSideButtonWidget { + private static final MutableComponent TITLE = createTranslation("gui", "relay.pass_through"); + private static final MutableComponent HELP = createTranslation("gui", "relay.pass_through.help"); + + RelayPassThroughSideButtonWidget(final ClientProperty property) { + super(property, TITLE); + } + + @Override + protected int getXTexture() { + return Boolean.TRUE.equals(property.getValue()) ? 96 : 112; + } + + @Override + protected int getYTexture() { + return 0; + } + + @Nullable + @Override + protected Component getHelpText() { + return HELP; + } +} diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/RelayPropertyTypes.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/RelayPropertyTypes.java new file mode 100644 index 000000000..bb63de761 --- /dev/null +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/RelayPropertyTypes.java @@ -0,0 +1,24 @@ +package com.refinedmods.refinedstorage2.platform.common.networking; + +import com.refinedmods.refinedstorage2.platform.common.support.containermenu.PropertyType; +import com.refinedmods.refinedstorage2.platform.common.support.containermenu.PropertyTypes; + +import static com.refinedmods.refinedstorage2.platform.common.util.IdentifierUtil.createIdentifier; + +final class RelayPropertyTypes { + static final PropertyType PASS_THROUGH = PropertyTypes.createBooleanProperty( + createIdentifier("pass_through") + ); + static final PropertyType PASS_ENERGY = PropertyTypes.createBooleanProperty( + createIdentifier("pass_energy") + ); + static final PropertyType PASS_STORAGE = PropertyTypes.createBooleanProperty( + createIdentifier("pass_storage") + ); + static final PropertyType PASS_SECURITY = PropertyTypes.createBooleanProperty( + createIdentifier("pass_security") + ); + + private RelayPropertyTypes() { + } +} diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/RelayScreen.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/RelayScreen.java new file mode 100644 index 000000000..0192726f9 --- /dev/null +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/networking/RelayScreen.java @@ -0,0 +1,147 @@ +package com.refinedmods.refinedstorage2.platform.common.networking; + +import com.refinedmods.refinedstorage2.platform.common.storage.AccessModeSideButtonWidget; +import com.refinedmods.refinedstorage2.platform.common.storage.FilterModeSideButtonWidget; +import com.refinedmods.refinedstorage2.platform.common.storage.PrioritySideButtonWidget; +import com.refinedmods.refinedstorage2.platform.common.storage.StoragePropertyTypes; +import com.refinedmods.refinedstorage2.platform.common.support.AbstractFilterScreen; +import com.refinedmods.refinedstorage2.platform.common.support.containermenu.PropertyTypes; +import com.refinedmods.refinedstorage2.platform.common.support.widget.AbstractSideButtonWidget; +import com.refinedmods.refinedstorage2.platform.common.support.widget.FuzzyModeSideButtonWidget; + +import javax.annotation.Nullable; + +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.world.entity.player.Inventory; + +import static com.refinedmods.refinedstorage2.platform.common.util.IdentifierUtil.createTranslation; + +public class RelayScreen extends AbstractFilterScreen + implements RelayContainerMenu.PassThroughListener { + private static final MutableComponent ALLOW_FILTER_MODE_HELP = createTranslation( + "gui", + "relay.filter_mode.allow.help" + ); + private static final MutableComponent BLOCK_FILTER_MODE_HELP = createTranslation( + "gui", + "relay.filter_mode.block.help" + ); + + private final Inventory playerInventory; + + @Nullable + private AbstractSideButtonWidget passEnergyButton; + @Nullable + private AbstractSideButtonWidget passSecurityButton; + @Nullable + private AbstractSideButtonWidget passStorageButton; + @Nullable + private AbstractSideButtonWidget filterModeButton; + @Nullable + private AbstractSideButtonWidget fuzzyModeButton; + @Nullable + private AbstractSideButtonWidget accessModeButton; + @Nullable + private AbstractSideButtonWidget priorityButton; + + public RelayScreen(final RelayContainerMenu menu, final Inventory playerInventory, final Component text) { + super(menu, playerInventory, text); + this.playerInventory = playerInventory; + menu.setPassThroughListener(this); + } + + @Override + protected boolean hasUpgrades() { + return false; + } + + @Override + protected void init() { + super.init(); + addSideButton(new RelayPassThroughSideButtonWidget(getMenu().getProperty(RelayPropertyTypes.PASS_THROUGH))); + final boolean visible = !getMenu().isPassThrough(); + addPassButtons(visible); + addStorageButtons(visible && getMenu().isPassStorage()); + } + + private void addPassButtons(final boolean visible) { + passEnergyButton = new RelayPassEnergySideButtonWidget(getMenu().getProperty(RelayPropertyTypes.PASS_ENERGY)); + passEnergyButton.visible = visible; + addSideButton(passEnergyButton); + + passSecurityButton = new RelayPassSecuritySideButtonWidget( + getMenu().getProperty(RelayPropertyTypes.PASS_SECURITY) + ); + passSecurityButton.visible = visible; + addSideButton(passSecurityButton); + + passStorageButton = new RelayPassStorageSideButtonWidget( + getMenu().getProperty(RelayPropertyTypes.PASS_STORAGE) + ); + passStorageButton.visible = visible; + addSideButton(passStorageButton); + } + + private void addStorageButtons(final boolean visible) { + filterModeButton = new FilterModeSideButtonWidget( + getMenu().getProperty(PropertyTypes.FILTER_MODE), + ALLOW_FILTER_MODE_HELP, + BLOCK_FILTER_MODE_HELP + ); + filterModeButton.visible = visible; + addSideButton(filterModeButton); + + fuzzyModeButton = new FuzzyModeSideButtonWidget( + getMenu().getProperty(PropertyTypes.FUZZY_MODE), + FuzzyModeSideButtonWidget.Type.STORAGE + ); + fuzzyModeButton.visible = visible; + addSideButton(fuzzyModeButton); + + accessModeButton = new AccessModeSideButtonWidget(getMenu().getProperty(StoragePropertyTypes.ACCESS_MODE)); + accessModeButton.visible = visible; + addSideButton(accessModeButton); + + priorityButton = new PrioritySideButtonWidget( + getMenu().getProperty(StoragePropertyTypes.PRIORITY), + playerInventory, + this + ); + priorityButton.visible = visible; + addSideButton(priorityButton); + } + + @Override + public void passThroughChanged(final boolean passThrough, final boolean passStorage) { + updatePassButtons(passThrough); + updateStorageButtons(passThrough, passStorage); + } + + private void updatePassButtons(final boolean passThrough) { + if (passEnergyButton != null) { + passEnergyButton.visible = !passThrough; + } + if (passSecurityButton != null) { + passSecurityButton.visible = !passThrough; + } + if (passStorageButton != null) { + passStorageButton.visible = !passThrough; + } + } + + private void updateStorageButtons(final boolean passThrough, final boolean passStorage) { + if (filterModeButton != null) { + filterModeButton.visible = !passThrough && passStorage; + } + if (fuzzyModeButton != null) { + fuzzyModeButton.visible = !passThrough && passStorage; + } + if (accessModeButton != null) { + accessModeButton.visible = !passThrough && passStorage; + } + if (priorityButton != null) { + priorityButton.visible = !passThrough && passStorage; + } + } +} diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/AccessModeSettings.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/AccessModeSettings.java index 1672f1fe7..200ffa503 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/AccessModeSettings.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/storage/AccessModeSettings.java @@ -2,7 +2,7 @@ import com.refinedmods.refinedstorage2.api.storage.AccessMode; -class AccessModeSettings { +public class AccessModeSettings { private static final int INSERT_EXTRACT = 0; private static final int INSERT = 1; private static final int EXTRACT = 2; @@ -10,7 +10,7 @@ class AccessModeSettings { private AccessModeSettings() { } - static AccessMode getAccessMode(final int accessMode) { + public static AccessMode getAccessMode(final int accessMode) { return switch (accessMode) { case INSERT_EXTRACT -> AccessMode.INSERT_EXTRACT; case INSERT -> AccessMode.INSERT; @@ -19,7 +19,7 @@ static AccessMode getAccessMode(final int accessMode) { }; } - static int getAccessMode(final AccessMode accessMode) { + public static int getAccessMode(final AccessMode accessMode) { return switch (accessMode) { case INSERT_EXTRACT -> INSERT_EXTRACT; case INSERT -> INSERT; diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/AbstractDirectionalCableBlock.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/AbstractDirectionalCableBlock.java index d75d8310e..f7651d654 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/AbstractDirectionalCableBlock.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/AbstractDirectionalCableBlock.java @@ -1,8 +1,8 @@ package com.refinedmods.refinedstorage2.platform.common.support; import com.refinedmods.refinedstorage2.platform.common.content.BlockConstants; +import com.refinedmods.refinedstorage2.platform.common.support.direction.DefaultDirectionType; import com.refinedmods.refinedstorage2.platform.common.support.direction.DirectionType; -import com.refinedmods.refinedstorage2.platform.common.support.direction.DirectionTypeImpl; import java.util.Map; import java.util.Objects; @@ -38,7 +38,7 @@ protected AbstractDirectionalCableBlock(final Map getDirectionType() { - return DirectionTypeImpl.INSTANCE; + return DefaultDirectionType.FACE_CLICKED; } @Override diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/AbstractFilterScreen.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/AbstractFilterScreen.java index 86ea9e9c6..f188c0f38 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/AbstractFilterScreen.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/AbstractFilterScreen.java @@ -17,10 +17,14 @@ protected AbstractFilterScreen(final T menu, final Component text) { super(menu, playerInventory, text); this.inventoryLabelY = 42; - this.imageWidth = 210; + this.imageWidth = hasUpgrades() ? 210 : 176; this.imageHeight = 137; } + protected boolean hasUpgrades() { + return true; + } + @Override protected void init() { super.init(); diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/containermenu/AbstractSimpleFilterContainerMenu.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/containermenu/AbstractSimpleFilterContainerMenu.java index abda2b6ec..385536763 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/containermenu/AbstractSimpleFilterContainerMenu.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/containermenu/AbstractSimpleFilterContainerMenu.java @@ -7,6 +7,8 @@ import com.refinedmods.refinedstorage2.platform.common.upgrade.UpgradeDestinations; import com.refinedmods.refinedstorage2.platform.common.upgrade.UpgradeSlot; +import javax.annotation.Nullable; + import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Player; @@ -25,7 +27,7 @@ protected AbstractSimpleFilterContainerMenu(final MenuType type, final int syncId, final Player player, final ResourceContainer resourceContainer, - final UpgradeContainer upgradeContainer, + @Nullable final UpgradeContainer upgradeContainer, final T blockEntity, final Component filterHelp) { super(type, syncId, player); @@ -38,7 +40,7 @@ protected AbstractSimpleFilterContainerMenu(final MenuType type, final int syncId, final Player player, final FriendlyByteBuf buf, - final UpgradeDestinations upgradeDestination, + @Nullable final UpgradeDestinations upgradeDestination, final Component filterHelp) { super(type, syncId); this.filterHelp = filterHelp; @@ -46,7 +48,9 @@ protected AbstractSimpleFilterContainerMenu(final MenuType type, addSlots( player, ResourceContainerImpl.createForFilter(), - new UpgradeContainer(upgradeDestination, PlatformApi.INSTANCE.getUpgradeRegistry()) + upgradeDestination == null + ? null + : new UpgradeContainer(upgradeDestination, PlatformApi.INSTANCE.getUpgradeRegistry()) ); initializeResourceSlots(buf); } @@ -57,16 +61,20 @@ protected AbstractSimpleFilterContainerMenu(final MenuType type, private void addSlots(final Player player, final ResourceContainer resourceContainer, - final UpgradeContainer upgradeContainer) { + @Nullable final UpgradeContainer upgradeContainer) { for (int i = 0; i < resourceContainer.size(); ++i) { addSlot(createFilterSlot(resourceContainer, i)); } - for (int i = 0; i < upgradeContainer.getContainerSize(); ++i) { - addSlot(new UpgradeSlot(upgradeContainer, i, 187, 6 + (i * 18))); + if (upgradeContainer != null) { + for (int i = 0; i < upgradeContainer.getContainerSize(); ++i) { + addSlot(new UpgradeSlot(upgradeContainer, i, 187, 6 + (i * 18))); + } } addPlayerInventory(player.getInventory(), 8, 55); - transferManager.addBiTransfer(player.getInventory(), upgradeContainer); + if (upgradeContainer != null) { + transferManager.addBiTransfer(player.getInventory(), upgradeContainer); + } transferManager.addFilterTransfer(player.getInventory()); } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/containermenu/ClientProperty.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/containermenu/ClientProperty.java index a22d53f7f..d78d56b35 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/containermenu/ClientProperty.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/containermenu/ClientProperty.java @@ -43,5 +43,10 @@ public int get() { public void set(final int newValue) { this.value = type.deserializer().apply(newValue); this.rawValue = newValue; + onChangedOnClient(value); + } + + protected void onChangedOnClient(final T newValue) { + // do nothing by default } } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/direction/DirectionTypeImpl.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/direction/DefaultDirectionType.java similarity index 61% rename from refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/direction/DirectionTypeImpl.java rename to refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/direction/DefaultDirectionType.java index 039d6941b..e2e003aed 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/direction/DirectionTypeImpl.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/direction/DefaultDirectionType.java @@ -3,12 +3,16 @@ import net.minecraft.core.Direction; import net.minecraft.world.level.block.state.properties.EnumProperty; -public class DirectionTypeImpl implements DirectionType { - public static final DirectionType INSTANCE = new DirectionTypeImpl(); +public class DefaultDirectionType implements DirectionType { + public static final DirectionType FACE_CLICKED = new DefaultDirectionType(false); + public static final DirectionType FACE_PLAYER = new DefaultDirectionType(true); private static final EnumProperty PROPERTY = EnumProperty.create("direction", Direction.class); - private DirectionTypeImpl() { + private final boolean facePlayer; + + private DefaultDirectionType(final boolean facePlayer) { + this.facePlayer = facePlayer; } @Override @@ -28,6 +32,14 @@ public Direction extractDirection(final Direction direction) { @Override public Direction getDirection(final Direction clickedFace, final Direction playerFacing, final float playerPitch) { + if (facePlayer) { + if (playerPitch > 65) { + return Direction.UP; + } else if (playerPitch < -65) { + return Direction.DOWN; + } + return playerFacing.getOpposite(); + } return clickedFace.getOpposite(); } diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/AbstractLevelInteractingNetworkNodeContainerBlockEntity.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/AbstractLevelInteractingNetworkNodeContainerBlockEntity.java index ebffd0c75..e3c8f2bc5 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/AbstractLevelInteractingNetworkNodeContainerBlockEntity.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/AbstractLevelInteractingNetworkNodeContainerBlockEntity.java @@ -1,6 +1,6 @@ package com.refinedmods.refinedstorage2.platform.common.support.network; -import com.refinedmods.refinedstorage2.api.network.impl.storage.AbstractNetworkNode; +import com.refinedmods.refinedstorage2.api.network.impl.node.AbstractNetworkNode; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/AbstractRedstoneModeNetworkNodeContainerBlockEntity.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/AbstractRedstoneModeNetworkNodeContainerBlockEntity.java index f4393f4fa..e54dbc67a 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/AbstractRedstoneModeNetworkNodeContainerBlockEntity.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/AbstractRedstoneModeNetworkNodeContainerBlockEntity.java @@ -1,6 +1,6 @@ package com.refinedmods.refinedstorage2.platform.common.support.network; -import com.refinedmods.refinedstorage2.api.network.impl.storage.AbstractNetworkNode; +import com.refinedmods.refinedstorage2.api.network.impl.node.AbstractNetworkNode; import com.refinedmods.refinedstorage2.platform.api.configurationcard.ConfigurationCardTarget; import com.refinedmods.refinedstorage2.platform.common.Platform; import com.refinedmods.refinedstorage2.platform.common.support.PlayerAwareBlockEntity; @@ -35,8 +35,10 @@ protected AbstractRedstoneModeNetworkNodeContainerBlockEntity(final BlockEntityT } @Override - protected boolean isActive() { - return super.isActive() && level != null && redstoneMode.isActive(level.hasNeighborSignal(worldPosition)); + protected boolean calculateActive() { + return super.calculateActive() + && level != null + && redstoneMode.isActive(level.hasNeighborSignal(worldPosition)); } @Override diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/AbstractSchedulingNetworkNodeContainerBlockEntity.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/AbstractSchedulingNetworkNodeContainerBlockEntity.java index 6ca816d94..df09b565f 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/AbstractSchedulingNetworkNodeContainerBlockEntity.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/AbstractSchedulingNetworkNodeContainerBlockEntity.java @@ -1,6 +1,6 @@ package com.refinedmods.refinedstorage2.platform.common.support.network; -import com.refinedmods.refinedstorage2.api.network.impl.storage.AbstractNetworkNode; +import com.refinedmods.refinedstorage2.api.network.impl.node.AbstractNetworkNode; import com.refinedmods.refinedstorage2.api.network.node.task.TaskExecutor; import com.refinedmods.refinedstorage2.api.resource.ResourceKey; import com.refinedmods.refinedstorage2.platform.common.support.FilterWithFuzzyMode; diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/AbstractUpgradeableNetworkNodeContainerBlockEntity.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/AbstractUpgradeableNetworkNodeContainerBlockEntity.java index 69dc02d40..6939537ae 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/AbstractUpgradeableNetworkNodeContainerBlockEntity.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/AbstractUpgradeableNetworkNodeContainerBlockEntity.java @@ -1,6 +1,6 @@ package com.refinedmods.refinedstorage2.platform.common.support.network; -import com.refinedmods.refinedstorage2.api.network.impl.storage.AbstractNetworkNode; +import com.refinedmods.refinedstorage2.api.network.impl.node.AbstractNetworkNode; import com.refinedmods.refinedstorage2.platform.api.PlatformApi; import com.refinedmods.refinedstorage2.platform.common.content.Items; import com.refinedmods.refinedstorage2.platform.common.support.BlockEntityWithDrops; diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/BaseNetworkNodeContainerBlockEntity.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/BaseNetworkNodeContainerBlockEntity.java index 25b5f6978..f995dcdb0 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/BaseNetworkNodeContainerBlockEntity.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/BaseNetworkNodeContainerBlockEntity.java @@ -2,8 +2,7 @@ import com.refinedmods.refinedstorage2.api.network.Network; import com.refinedmods.refinedstorage2.api.network.energy.EnergyNetworkComponent; -import com.refinedmods.refinedstorage2.api.network.impl.storage.AbstractNetworkNode; -import com.refinedmods.refinedstorage2.platform.api.PlatformApi; +import com.refinedmods.refinedstorage2.api.network.impl.node.AbstractNetworkNode; import com.refinedmods.refinedstorage2.platform.api.support.network.AbstractNetworkNodeContainerBlockEntity; import com.refinedmods.refinedstorage2.platform.api.support.network.ConnectionLogic; import com.refinedmods.refinedstorage2.platform.api.support.network.ConnectionSink; @@ -36,7 +35,7 @@ public BaseNetworkNodeContainerBlockEntity(final BlockEntityType type, super(type, pos, state, networkNode); } - protected boolean isActive() { + protected boolean calculateActive() { final long energyUsage = mainNode.getEnergyUsage(); final boolean hasLevel = level != null && level.isLoaded(worldPosition); return hasLevel @@ -45,7 +44,7 @@ protected boolean isActive() { } public void updateActiveness(final BlockState state, @Nullable final BooleanProperty activenessProperty) { - final boolean newActive = isActive(); + final boolean newActive = calculateActive(); final boolean nodeActivenessNeedsUpdate = newActive != mainNode.isActive(); final boolean blockStateActivenessNeedsUpdate = activenessProperty != null && state.getValue(activenessProperty) != newActive; @@ -155,7 +154,7 @@ public void setBlockState(final BlockState newBlockState) { if (!doesBlockStateChangeWarrantNetworkNodeUpdate(oldBlockState, newBlockState)) { return; } - PlatformApi.INSTANCE.onNetworkNodeContainerUpdated(mainContainer, level); + updateContainers(); } @Nullable diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/NetworkNodeBlockEntityTicker.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/NetworkNodeBlockEntityTicker.java index 9522e3acf..24eaa11d4 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/NetworkNodeBlockEntityTicker.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/network/NetworkNodeBlockEntityTicker.java @@ -1,6 +1,6 @@ package com.refinedmods.refinedstorage2.platform.common.support.network; -import com.refinedmods.refinedstorage2.api.network.impl.storage.AbstractNetworkNode; +import com.refinedmods.refinedstorage2.api.network.impl.node.AbstractNetworkNode; import com.refinedmods.refinedstorage2.platform.common.support.AbstractBlockEntityTicker; import java.util.function.Supplier; diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/widget/AbstractSideButtonWidget.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/widget/AbstractSideButtonWidget.java index e4208b8fd..4aa279714 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/widget/AbstractSideButtonWidget.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/support/widget/AbstractSideButtonWidget.java @@ -50,7 +50,15 @@ public void setWarning(@Nullable final Component text) { @Override public void renderWidget(final GuiGraphics graphics, final int mouseX, final int mouseY, final float partialTicks) { graphics.blit(getTextureIdentifier(), getX(), getY(), 238, isHovered ? 35 : 16, WIDTH, HEIGHT); - graphics.blit(getTextureIdentifier(), getX() + 1, getY() + 1, getXTexture(), getYTexture(), WIDTH, HEIGHT); + graphics.blit( + getTextureIdentifier(), + getX() + 1, + getY() + 1, + getXTexture(), + getYTexture(), + WIDTH - 2, + HEIGHT - 2 + ); if (isHovered) { RenderSystem.enableBlend(); RenderSystem.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/wirelesstransmitter/WirelessTransmitterBlock.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/wirelesstransmitter/WirelessTransmitterBlock.java index b45d2187c..c3fb469b9 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/wirelesstransmitter/WirelessTransmitterBlock.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/wirelesstransmitter/WirelessTransmitterBlock.java @@ -10,8 +10,8 @@ import com.refinedmods.refinedstorage2.platform.common.support.BlockItemProvider; import com.refinedmods.refinedstorage2.platform.common.support.ColorableBlock; import com.refinedmods.refinedstorage2.platform.common.support.NetworkNodeBlockItem; +import com.refinedmods.refinedstorage2.platform.common.support.direction.DefaultDirectionType; import com.refinedmods.refinedstorage2.platform.common.support.direction.DirectionType; -import com.refinedmods.refinedstorage2.platform.common.support.direction.DirectionTypeImpl; import com.refinedmods.refinedstorage2.platform.common.support.network.NetworkNodeBlockEntityTicker; import javax.annotation.Nullable; @@ -75,7 +75,7 @@ protected void createBlockStateDefinition(final StateDefinition.Builder getDirectionType() { - return DirectionTypeImpl.INSTANCE; + return DefaultDirectionType.FACE_CLICKED; } @Override diff --git a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/wirelesstransmitter/WirelessTransmitterNetworkNodeContainer.java b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/wirelesstransmitter/WirelessTransmitterNetworkNodeContainer.java index 35948cc97..dc65fa1e1 100644 --- a/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/wirelesstransmitter/WirelessTransmitterNetworkNodeContainer.java +++ b/refinedstorage2-platform-common/src/main/java/com/refinedmods/refinedstorage2/platform/common/wirelesstransmitter/WirelessTransmitterNetworkNodeContainer.java @@ -1,6 +1,6 @@ package com.refinedmods.refinedstorage2.platform.common.wirelesstransmitter; -import com.refinedmods.refinedstorage2.api.network.impl.storage.AbstractNetworkNode; +import com.refinedmods.refinedstorage2.api.network.impl.node.AbstractNetworkNode; import com.refinedmods.refinedstorage2.platform.api.support.network.ConnectionLogic; import com.refinedmods.refinedstorage2.platform.api.wirelesstransmitter.WirelessTransmitter; import com.refinedmods.refinedstorage2.platform.common.support.network.InWorldNetworkNodeContainerImpl; diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/en_us.json b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/en_us.json index 36f89262b..6e06c5772 100644 --- a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/en_us.json +++ b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/lang/en_us.json @@ -34,6 +34,8 @@ "block.refinedstorage2.creative_portable_grid": "Creative Portable Grid", "block.refinedstorage2.security_manager": "Security Manager", "block.refinedstorage2.security_manager.help": "When this device is active, will protect the network by default and block all operations. Start adding Security Cards to permit or deny specific operations for a player.", + "block.refinedstorage2.relay": "Relay", + "block.refinedstorage2.relay.help": "Turn entire sections of a storage network on or off and create new branches of your network with a Relay.", "gui.refinedstorage2.controller.redstone_mode_help": "When this device is inactive, the storage network will not be able to use this device as an energy source.", "gui.refinedstorage2.disk_drive.disks": "Disks", "gui.refinedstorage2.storage.redstone_mode_help": "When this device is inactive, the contained storage will no longer be accessible from within the storage network.", @@ -149,6 +151,17 @@ "gui.refinedstorage2.security_manager.redstone_mode_help": "When this device is inactive, the network will not be protected.", "gui.refinedstorage2.security_manager.fallback_security_card_slot_hint": "Slot for a Fallback Security Card.", "gui.refinedstorage2.security_manager.no_fallback_security_card_consequence": "Add a Fallback Security Card to this slot to set permissions for every player without a Security Card. By default, all actions are denied.", + "gui.refinedstorage2.relay.filter_help": "Resources which should be exposed from the input network to the output network if the Relay isn't in pass-through mode.", + "gui.refinedstorage2.relay.pass_through": "Pass-through", + "gui.refinedstorage2.relay.pass_through.help": "Whether this device should pass-through the entire input network signal as-is. Turn this off to selectively expose components to the output network.", + "gui.refinedstorage2.relay.pass_energy": "Pass energy", + "gui.refinedstorage2.relay.pass_energy.help": "Whether this device should pass the energy buffer from the input network to the output network.", + "gui.refinedstorage2.relay.pass_storage": "Pass storage", + "gui.refinedstorage2.relay.pass_storage.help": "Whether this device should pass the storage from the input network to the output network.", + "gui.refinedstorage2.relay.pass_security": "Pass security", + "gui.refinedstorage2.relay.pass_security.help": "Whether this device should pass the security settings from the input network to the output network.", + "gui.refinedstorage2.relay.filter_mode.allow.help": "Only expose resources from the input network to the output network that are configured in the filters.", + "gui.refinedstorage2.relay.filter_mode.block.help": "Don't expose resources from the input network to the output network that are configured in the filters.", "item.refinedstorage2.controller.help": "Provides the storage network with energy. Multiple are allowed in a single storage network.", "item.refinedstorage2.creative_controller.help": "Provides the storage network with an infinite source of energy.", "item.refinedstorage2.disk_drive.help": "Accepts storage disks to provide the storage network with storage space.", @@ -367,6 +380,9 @@ "text.autoconfig.refinedstorage2.option.fallbackSecurityCard.energyUsage": "Energy usage", "text.autoconfig.refinedstorage2.option.securityManager": "Security Manager", "text.autoconfig.refinedstorage2.option.securityManager.energyUsage": "Energy usage", + "text.autoconfig.refinedstorage2.option.relay": "Relay", + "text.autoconfig.refinedstorage2.option.relay.inputNetworkEnergyUsage": "Input network energy usage", + "text.autoconfig.refinedstorage2.option.relay.outputNetworkEnergyUsage": "Output network energy usage (if not in pass through mode)", "advancements.refinedstorage2.root.description": "Use one or multiple Controllers in a storage network to provide your network with energy", "advancements.refinedstorage2.connecting": "Connecting", "advancements.refinedstorage2.connecting.description": "Use Cable to connect devices with each other, or place devices against each other", @@ -405,5 +421,7 @@ "advancements.refinedstorage2.portable_storage": "Portable storage", "advancements.refinedstorage2.portable_storage.description": "Craft a Portable Grid to access the content of disks without requiring a storage network", "advancements.refinedstorage2.security": "Security", - "advancements.refinedstorage2.security.description": "Secure your storage network with a Security Manager and a Security Card" + "advancements.refinedstorage2.security.description": "Secure your storage network with a Security Manager and a Security Card", + "advancements.refinedstorage2.conditional_connecting": "Conditional connecting", + "advancements.refinedstorage2.conditional_connecting.description": "Turn entire sections of a storage network on or off and create new branches of your network with a Relay" } diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/in/black.png b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/in/black.png new file mode 100644 index 0000000000000000000000000000000000000000..af499530ba7a0aff582c674afe4cbeff82baf8a7 GIT binary patch literal 2930 zcmcguU1%Id9KT9wwYH^VEyWL9wzO#5x!u{XyIp#=$z9r{cri_`B*7PFXJ#);?sm4j zo7|-e)>a=>d=f#b4jb+lB^9qx`)?+;?u`&xilGf%xmLaBwotWbVFK+#53I z-`t(aY&qpuCX$Kr;|^x^EF#RM*=9ZD=uGC&;bw^NG)*LzR{fwL|Mtm(Ecv7$kDFz+ z92V)6KX^K#W2c8J`1CZkiG27m=}^<*2I@3HQnOwQVy9VfeRn?@NorRWRSn5GZQ#DmlO$BNIT8?TsFeh~`nR|S1a&h&wcK!jvWo6_{1Ulv+T7Q(QO`)mqL8R%ngZX^_Mm3sWp-sa#IsE1Ip> zQ*@jR%<_mjb6XJ|SLQ;hjMA9RM3@fDa*unufyK!vU7}_k!#O-198R%>#Zzn*64LHv zR3yH)ibK(}3`(2+Dp1jrLPMt*QIxQ#!dR`Vosn*Ak_NMy^vJj$5Y~tv6%+3ape2;h zf-Hmt)I8ADil#X#bWC_aRqZ@UtvwO>JjGG1 z*Q$t$aEl(zTRJ8#&`FMhJTV}!p(`FHv2_FLIhS*|7QJqf2sRq;B$&KSrU42TK>m)>EZ!crm35q_7T5H zYZE1(vlh1lv3h$Zm-mQDCNk6+^kc5MxlXMaqo+DwHD78arGs#L3RtL<61mgtudu-D zqq1$bF-199w@_^x7BeqtposQWIm2sag|b@kF`B(~=rCtM6@q?f>|2%2rEPp;u|TA;)3i&tS+H2togW=UCL}gI{QX>GjD zO0{6U8ss~%!%O=b#hySLTW-z-$hKSnO_83+v;opRO*bve#2ylg7S`B5E%rh~EgE{x zP2DDb7!#lADUko9=SUjxyp8xNvHI3`3;cvRKUC_gf;et!GGhpztq!`xRlh6hXGJ1-UIpS>fzzH{+fwzTo*2QU8l z;kB*zJO?+yeaV$`vm5B#z>kOh-J3F(j8C5~fBW7Suf4FN|Jui2e|CHf+w*0 literal 0 HcmV?d00001 diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/in/blue.png b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/in/blue.png new file mode 100644 index 0000000000000000000000000000000000000000..46829ae7bf4a3a66562df8c128c9e40453b17bb6 GIT binary patch literal 2928 zcmcImU1%It6kbIoOtOp*H2*_k`PJ44r+W>XXBrXktV6hV6D&Yfh)?#y&% zlHCOQph8hlsn91IrCN%D5UhwV#cB&;Me#*YAFMwQf{3MpNYOsjb9ZMa8%>%}?ZEuq z``vTCd+vA6z0Z#fKe4fUYj-Y}+c-2>8in`0?C!b;o)7$f1H)@wICv<|<<|GI`;Ocz z^ILMc?jv4hJQ*+Vvq(_OV<)g_zEKMSoy+ao-3T$6q6ufy3C}O`SI>RObDmS=4{Bwp z9QM;mZ*VT6V{^k5GB-s`hu{4ex2s`+ff`LP*Qizf*lHB{rd8<^t>bxNs>9k%p+Y@b!jIjOR^+Nnuufp>6WBg$l%h82XB$%TBD`CsW12| z@{>stTB2C5*YkBHA4C%(GEGyIWKos{KnU@ypWuez$J^T$N;D>s7bafdbIc;PgXyHm z1Jl+NYGG#9kJB(gz{Ca)MUlozAY|Q3 zLXmjx3JzJ%5-4qWD?nLK1`VzLh~gxODnU?fYiFd*jgwJc<{moe`A$%eA7&Fz2hb8u zXpv_^5~PBlNEKPOBxGsmQ3*bz7PJh~bZ~+@!6x7<$ONRNC`-VBG~Ysili>=QavD)K-z?|F{pC^|tB2AYnB1k+TpP(Tg^%E-}8)zlT@ zw#SzOGR;KA#<%jz2?*H8R>LwRTOkGkYqsGEhOL@Hq2OS_)ltEAiEit<(YCff@*u@= zwbLqN<$y((7QnG%3yNbk#-Tr(*xOj=VQOr6x>(`Ij(1zuYy zTW0H%6oPdV)wW=9;3jn((Y^_Y@TyrMu0%e@GdHJ>3>8U8r-ExLx}Z^25^O~?1ifGq zTT*075vXY;>WYO_OU`oWR;Z`8$t3nCC~QI^f9sPWiYrrFwgpMWM35EL7HnP8AU_Dw z3aVlgVlFqCWedV>o(u{685(s6E5s3ojg&@lk$0n@#^ErmdZd|M;*9U4`%{*XToQ1L zOvbAY$yw-BH zV67U2o!ElXzDluokO>vt&;)GiwtzI2o>(&l3`$otUDt?pL?I%c(ELQ^R@cO$igGdX877=3VI=cSJ~Eo?hlng8OW<8M55YF~NX zI|mlNyEOm8=B|VH|9bVOZR@w6+VkYd^<%?_jr`e@r?2(A-g{zd{rBI#d~WWq8+X2T Y{g~48qx8dF>`Xi~FkD*LbNHFR0feo$I{*Lx literal 0 HcmV?d00001 diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/in/brown.png b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/in/brown.png new file mode 100644 index 0000000000000000000000000000000000000000..bf56d8d1a32fb59bf68695873c3200ff6039f5c3 GIT binary patch literal 2941 zcmcguO^g&p6dn*%K*$0yAs)2TaKN}d-PJw)S2FUmv$z|bWwH#i>w!>RRXy7<)75nM z?#%8*Lc+mBjET{pc+)e9CdLC2A`-lKKra$CD#1iCQ4)=!qct3wW_S+oduXWMTc#_F%*edQ-nK$3s zmdUI?5tPT$vEs83vsxAr=Fx1U7IAbYvuk%FLijjMC688uFfZS}a7mT|l9vygMXeYO z(1~DZCZ-2xM#^~RIChD=`zdKx19Am5nj)!DtA+_|~S+Lz3&#l(lBh5cqeHv6&1Lyt7^Kc>k3CG$#j^ah7u;*I~oc!!Eq3!0ShIe5qWGf&CA@= z))Hz_S8bTIY2t*b4HT&$tBEBwfdqGP(PUh08Yft#Ra&EAns6-WVmV92Vi&%s+FGrP zPSU|C?ooSfi=vbAbVSurny|?j)4?fjaeK$HBps#m)U04Shj%AO6D(!P1Y3fHu6O|z zY2YtmP)HU)X(LzyDkNQK1P5Y@QWlpPt9D|i)bUNyK~|S`9u7jn>dE6`;q3{ufKr;5 zMIb4fqZnFQ*P#ZW37*jSht`4?d1w-pqF%7e@nzsb-GsWc0L)0>PcI8482T)(A--`z z4OOTbg_WkYVi699Ns2;DhYNX`yP6FG0A6hS5CxAKcH%yo2k18UfJkwvV`7RdEk})xwgYj%Qyf)$ zwF<8Y*XUEnGBDu|5t}Lw;d)%)iHAvCBL@uI;~dW09bi=!7a8H4bNynsAy>~`MIyiQ zGH4HuiBPRhwgzoo}GLn{L;dgY-oEs~Sknq=X2!mViZcQX;p9gGDxYWmLA* z)+Z<@>n>5-f+fsP>nNssE1cnFvqD|U`2P9Dr?#1;st#|^370M4GRlfJdST;e(F^GaO1q$$TNO67YDn7!x z>zS6(OpQDDVbOx{A1?;8aEit~ffb<`@q?7cNnZA2R+CT^RRi42E_Es-?enRdkW$K| z`SPPYm>0>AE2Oi}sd{xRq7I|9z8G(IB+Sfcp0e(fTj6nA|V+rg`wf#cIJy zW00T3keBvliah}?wmjQZkZXAgFhzPIlb;`kuN$Uinb=1nJ%u**Pm8^Xp(YJIeN$(M zH)G@^y|%?Wb}IYOdFN#1 zSAAyN?VIbqe&dg=gF8wO!(U!Hu@j)1m&a#|mp(oB#TMi318Xmab8Ggz@M!-J>mFEh zW&e${wzl~r(06R#5!nCSlRvH5vHi^NS3jRE-Y__{# literal 0 HcmV?d00001 diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/in/cyan.png b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/in/cyan.png new file mode 100644 index 0000000000000000000000000000000000000000..fae40f424f798831533d9b38d75727e44bd03f78 GIT binary patch literal 2953 zcmcguYlsz993M$-)zr;`qQZtzO3Ar1XP$S4z4_R?wo6{y)>~eY&~wi@bMNH6bH|_`pIz5Ec&&W=Gh&m)||}+4JG6Hz9j12nV;tg0Scwe$Nr!IC{Sz zEZptq3rQij$wjo9f|wRbs$LBlS`hly)EqgZS(Vkt%!P45t#lE`B6jVt9#d@_8#BMz!HT1gdn-43J*nlLvGSYf(P%Pwz z#eNzQ(MqW@QdLc~ofNPP!&29XnyRUaYAQgJf#s@(3v97Wu$VF zgs!5Djg6(o^c0Os3UC}pQ8h)=WQLIA@gRY9Ifz%ZHDpPQB0o%g8i-sYEYi^=BQZ~# zAymVT+8}PFi6u;_!%zV!m50;-V${Kfqfw<{93zEPNR54DT#rUo$QI78 z!V*!!pwzII%eg~AoWKB)p=?HCuBLn+yB4-J2iTSj45-S6V`#DiG($EuXpyv51P->_ z^RpCyI4+Xj&xgo`q;0kUn)Mw(9A+MbGhR^qVI zt(AL)nMRMKEuBx)u}$POHURUg$R8$lbOY#ik>zm0Za=NiC`U2Nxh{!(wOyv3xe9rG zWhBrVEO4q;Mw^4Srm{-`{MnLkn?XJyekSl)iZw~(d~qB0x3Jd59I#ANH(TSwew|bb zS)XMsZaQLhOSVmx@J_}n)E)F=#<}rUuh~L&x4tUA*eFUDqGkw)vy)({HSABZz_Uwb zQ|(xpuw>nWwM|$|y<`kVWPOQcc*d$wrgJ`qwOhLmYy+skBC_Y`mTVG3m5aJ*%U0S! zMOD`b0gRi|xvsmwa5cSML$~94OE)URphVavq)4|PjHOxFG_0ab939FAX2GN#&z6a) z+O}OZ(+$@AJ(wvQ!hakLqCt&BUBn7u1ldMPqBtXY5v__a3@birRF_f0)!zl#IiRyr<-|DwGa88^Fb_`ffb!Vd_|HlX~qLp1-h%}j3OYtz_x-Kl!P zY&pnwVwbh{8Jax?4zh~2DMN?R8koF1q3Os__cYzKEE9Q)g~H zVuvyQ**OKWpUydw1gvf&c1pZ>Z|xm+!u(_?yFQ;jaOF^D+1_<`?cee2kqz1Ti_Y&p zd*;m9tIL1<{HOYoQ^!u&r+=g2+F0E7+_$QuzG<)KgH-*Bf z&yx4QT{*XMX`eg);K@6lJJLHMEk(zF)^GHbub=Dr?!k}gAHqx5dh;KBgTH>Lv;tqg z_jiJ?aY4N?zU$ebE%2-VoXn(TEWik%;whK?QD1V za+iuw)YcX$RBS=SzZHK-!4kzUtf-`j{t>YiL=mL=ODj|m5s5SRm5WW9Q0>Bg&HK#z z@yz?aGe<{;AL#8_*ON-6dWQycqx`)}+&A6GpLblI!Tfb|IJi4brIxP|_p;P0udYp{ zdiMK;v1Ba&kmIsS8WUEe>3SvP=u~RU)_REDeKe7ZbleZJ@}>9B%92mA@-8C}^I<5U+1*$kEu1{4nuZAPJ4Q$f`+J=AJe~ zsDvH0LENH=6QmG0f;2ZYt)4I=Q?1e(JM&B`K? z0JMMx3##fsZ5i${Sfq@|fln&56gh{pcKcbGMR`Uz=b9{u)podg?kX1bm6f^C z#^9Jp)pE5tm{B3W6eON4`R+yJv*JespHr;LlE@dQVSguYUEBfFFf^kzKH}GDc`WC1 z*5alkX18SbT#4vpqC%ZPKjt|%+3Gbr>HgMN*_Rqc>0q}Rf-AC<61g?(&$qx!qOz&B zR-&A&t7L5x7BerY;fVH)bA}hK3S}YZV?1$n*HK1C5SbKswq^o@>LN>x3@|O*EkaGD zJayZlU+KE$Al*^5cEMeX>n&Q{5)Q^G--HzT+Jh-Vq!P=pfT2?hn248#O+5`j6>F+# zsFs<*^93_+L%7btxGb2UQCDJxIKq4*rBR%fy@*vL9EN4zZB&;s5s=pY)G0_QVbW~- zS&%eBBfl#Lx~+6vkp4$|i)P%?y5W_@a-A1R5eI~38&Lk;A)5cWCX?I6+B7y^XTDyr z)EwkHvBO*YBF&y4+ck?B17O=M0%VBt#D)#9=Bb)tnuhB&GFoV3|FzkR9BR5&KfE>yqy(=j|>bWzOI$wSI_v!uQsJ48=sh{5cc~U*L?77l8 z`R>gx-!OGPziq=sZSS{l-}A%9<+)D}|9a{~ah-NDo`x&FUi<8i*75joyz=uiA53kV cdE%qq7jv5r{pOwCDvriO1H-w~_wRk?AEYa|F#rGn literal 0 HcmV?d00001 diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/in/green.png b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/in/green.png new file mode 100644 index 0000000000000000000000000000000000000000..e267c752d6b2ad854907c452bd7530c159350bb6 GIT binary patch literal 2945 zcmcImTWl0n7+y>@rHDe*sPMorgha)&GjrxXvXIg(wuuW(S!nxU!kIZ|x?^`|hM8%1 zmk5H1MuKPz@e=UGs1GJcFe;ir6g4VO2KB)giN*vCM#BR>86%#vm+4ko+MrA_xATAJ zzkKKa|8ouuZFzWU&x)Q*CbM*KAU{ms%h=t03w^G-d1tbNq-}5DQ@+ zDR~3CBeHGxmZGzJ!Z9(waRax$W>Ezdk|3^DDf_Wi%kd4p7X4~BeH|ZB*#-v zn;}%fRIMMkXrhD(H53X`R%9VHfY?cK;bc^97{`u4%A`X4B&Jv?#Zs0Eg%m!k+Dauw z$4UPb^{5rwtmwE{4~Z~L;$SjzNdFYIxTft`oD7p`Y8Eh^!qdrNDM*626wEezU%C;7}duYFJpZ9n~~MpsSJzTw5`L?P>-*6>e8{Vj z@@U?pti?@7v`)#`ObP2`tU|2;FQz$HZ}pmOWLN8}>~W2vw2;#b!C~1+D5cF|Z;vZ@2k zFdbWzAt9394*hD^WlK^lD7S0qdR%YO>XeW_PUt2i@Yf#SDRUizKiELbDAB|LzdY|9q3l&1`KN z8?QB6FIZ>}(w*3%t$p5RZ#tT-s{omF>yT7do`~i)l3ggPnx;A~V&%!S1^>0#vm9#B z&~a{R57EOI`%F)P^d~(>5}(#>L{Eu(SE`@W6Xwamd~eY>^!wpL&!^(Dr+#>2puKH9YF_=!g^U0lN*d3s>#-iv*E@BZeO^LY8e=MHv% zckIN5541z)y7t|<_}kBZJNwe&H}yY`W&8_Yb?-A@+;L`P`OdAG3xlU#+4R=Lvp?^- u?TZb+p6-2Z-L3BG?1B2q{eM5PNMA8*p8tB)duQ1pd9Z&={`jVyPyPeBs=SE+ literal 0 HcmV?d00001 diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/in/inactive.png b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/in/inactive.png new file mode 100644 index 0000000000000000000000000000000000000000..b1bf0e0902639bdc56b3878bd36655efa432e8d8 GIT binary patch literal 280 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBugD~Uq{1qucLCF%=h?3y^w370~qEv>0#LT=By}Z;C1rt33 zJtM=93Yk-ZiaI=9978Ppw@&orI%2@X@>%5l?f?Im2eR{AmXm$cVkzP)UZgX}+a)gX zl(0`_lcxUH9V-KfH>ib|bRei=Mmf(2_r)r=4Vt9S} WVvfp&IlVwPF?hQAxvX0#LT=By}Z;C1rt33 zJwr2>%=KS^iuQTBIEGmGFP(Ur>yQJF>u+y87mX&7EWr?gLd6${;=eI#MP#qmopx*a z?rgUit{Gy+J1k;~IA(GdGW==P$Q4-1yJ$Mgg5@_=MOn+&1e|GAJNxR_vIl*lT?%V8cU;bKYG!Qz+}&h-*2*a2;Q6-o z8Gm*k#c_&R$0Zqy ZcnxuePYwL+KY%`A@O1TaS?83{1OPU8dddI* literal 0 HcmV?d00001 diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/in/light_gray.png b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/in/light_gray.png new file mode 100644 index 0000000000000000000000000000000000000000..726db1049fb0123a718ca2fa46033ee858db679b GIT binary patch literal 2922 zcmcguONihqyS4M^(+qiz~`a+?wacHnS%HNyCeap@KdGF<`h`(-)2Pe})VZ$BbUQ>Ac)RsbF z{h_crkxf*d@Gz?v5n(?um4(I__bB1@(e=(?_=YKo=-jsWRgl%Xbw(j8q5Wt!q7jI)qMlF*2JHj|ZP?rA%O zdYr3`(oULq!jvY86Xk!98a^1rPFMgB;?{nsmQ`$ z8G}Ny2uhpbGEgDOp|RJWP?WKx%2=(-osq6@k_L;KbpLo55!Og|ioiP)Xc=X+Bnu(| z)d9L%)ih6qo(UgR`G?wuRyZ{Y%1|%Z<@hReJ&m)@S_Eb!4CYpZ66^&msUyB{VI56T zC61-kk~$@z)^h{P~WhDV`Bs;f{yP5hVG-FJHO2E zj3AYm->xshFxQcUv0Xl3`mWWO!D%2YcQ_i`$POsTV4|Tq3q0}l$58-wQSg?~4xicItvB0ZKWm|1y zn(|~_hqY~3%7Uzc652P#GrVF|D9bsYqS@=a4s8Rf(4ru4bqko(P=T+THn1EQ`>L){ z3hi#_*SfBI(C{?9TSGVEdMB-T8bwo-Z$gTEJjKV_7D^S`fG< z!6tS&H?CcWB^$zj91LdBEKPcd6{7_4jg%&7Ne&WLmrxwnLfon@Wi}$6{V6X8L$ba&4B#n68Cj68r|8e#ae!@IGRPL)ful;e`FHf+L%cynNuy!1=qrGy2Nv z>pRY0KJxoJ#Wk0A;~%V7;fLQ}m>Iig{LbH=yY&30C*L#HN%C7)hPGwjob-?VbkqKa z-Y=Xxl&$&X!ZTlvo!#}pPE|jZ`ez1quKV^FoqS{T>HY6s1s6B|c(-%q#qo2xI1LXC M43|H8^uXc20D0c8UH||9 literal 0 HcmV?d00001 diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/in/lime.png b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/in/lime.png new file mode 100644 index 0000000000000000000000000000000000000000..7256027ccc5730836c3dbdcd1c610934a4cc00e9 GIT binary patch literal 2941 zcmcImU1%Id9N$V2TbugPid6)cZO}@c+nxQqU2?WDmzZEL4VMeKAcf4%&gPcf?QV8A zxl0fYQqU9&1%-+Y^hHDzluGeI!4&a9#0Pz|1;HmNXtdCG>&)HWC9z2ptUb89-I?F~ zKYsK3|7Vs)hF|L1`{Z7Zc4fPHsy?=K(X zxV0`ECFVO%Rng|LrQ zyupQtj4lk9@WM1U9pTsud{4uo25KZhe4|$NW2=!9nszPv%!WmQZ$gskoY2c0^5wz^ z-xoxL*E15pk|gtnnSr{h>eBPPEXk56X(E&X)GbN1puwjffqIJ^*DB@*QeX5fCsdLo zv_!F9uV?B?CWxj)Xqu)d$)YR+iU9GvpP&Zt^n%k!6xHKOUu}I=zHo~NTj(R-Y4lGWJWR02~ET{0!;;<4VL0k#8AfYq8fr`X) zw{Xa2Hb6T|n|EAvu8w z2}oI>NF`aeBxq^ys6-#67PLU6>7WFy2b&aMf~KX(mZoh02ae~?Zwqy>j-bs5&vttg7hk z_4xqLGEuSht@?5TOl@>_!?JZX>#76;Lv>xC5^BxFHUx@nIEG{Ek_zp%wUd!YOB_|# zTV+u>)S^qWx`G`WD2_o`KoFRa+A*Q#n2HJ&!=@ar`Rxm;K~xAF%DE!&Y_~0Ho`#B8 zedPq04wjiztFx^^Lzd`AgzPt+pV(%8ZFWa7{%A8c`)+E1CiH zEEScc$b>+no%-#eD;88OS!vhMe+fOM6<3fyMd%?U3U`qV%_fU97eL3B0XC_mvks=^ zZpc`NlIlX_ZkEiZ4dEUqg9Cq#MC*hVq6pE0ltgh(aHF8cqcE&`xLIA|obROPQ>P&L zB;eQD&z7V)B=Xj2V7-@42>k!(Z(GIftQ+25EcbYmM0P=FwE^+p9isJ~Z!tN*_NIC8 zTATF(xI+!nlh~rIeVbp#fy-Hh>x{Po$XuDXy$&x~^dtF-0?L!QD1{rlBSc z>+VhMA$l2OkDXf}ed*jIiBIb`qPN5n`i$O0xzC64y`}8g)pv6HzmfJ0tepN3y#Dd^ zGe0kI-G6?2Df`gT$B)~`C2s8e2Zd{=ySkT4gQpJNs62b}wc#I@<3o?W`s3u~YLk#pl8z1<5heA)BJx!RlGUoIDl h%Vc$I^46&<2d*A8f4Vl&f0bR3hx&)}pT0Qx#y`^UwCDf; literal 0 HcmV?d00001 diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/in/magenta.png b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/in/magenta.png new file mode 100644 index 0000000000000000000000000000000000000000..ff10df67c5695e990442bad098819dda6a6acf01 GIT binary patch literal 2932 zcmcguUu+ab7(XAxT0??CiJBNTOGF6l?acnW+YKkQy<$te(zJ)P@x{5B+3UjH&a%7h zT`?wVP~^c7LwGTeh~WW@@kxQ`1Cbb>j3Go5pM1a&{{(`FPm+K$cYE6dTH4^BOKx{| z<~QH>&2N6+H*;WgCfvG}GftCXd2j-;YCv$Hhah&K|6_|ckqiMqoG`VC0u^R~SW*i}aEc42!&=KZ!78oMI`!j-V_}NrER{+rd|tEl zdWw$X!5JP=vbK5AQF%6?>KKjKbcpHT4EMOE6Ic|F(K%|CFrCBG$-xwhSv18KAR!&T zgNoR57jP&>?ts#!w*XX(q|m?_2q}tLSZ1u&(avZmHc5k7O&3#83ABh} zT9Ad16p&YRP}VdDK*xj|0B?Xcw8W)JP>j04HpiEt?U=^hU`9N5c2Ow7j?2P2;v47H zQI)EJUu}6Sm7HNeijj}$aIqlsP_v##9B5!<0;nt4)m>})9J+-zy^mvM+TDMgZ z72y_LnzwXJDvC~WRLK(qDmJW$he>SRfO@XNIh^x5z-lZkF~T|5Wl8L|!_D(hk;t!t z43o|YA=TP+yECT&{!^iNCgYQfjL!}4@I6kkCQCvuPRsu|FI_wU%QST}=^yo)v^G)n zIBQWm5UYD+^3D-a$wY=aLtex+H=ER&ak?jI)jX+{ln%n}C19aWO5~*5n`eWUMrGS< zV~TRJ?xWf^EMjilKq2j`a)uYp3U#62BQ$gW&|%Ji09sUWZQW8#Y5=98n>oeG+qeRB zjZ&EFEdAclb*^nk(>n?GAfYF;;wj`;DL;f%`N0?Cx|*%!c|EXf{(wj%n!)qK)Lo0% z$guSaSLwa`FmFNlj~9cPKSRSVVFf5e{2--aRFK_})g=@JH4nG4OP%paaz3RADaA~h zD?ba8Mri1DX`tIn8iMpM`deIaOR9$d`zER4g3vAl>fIHh{atJ`xmD~<>)>_ftp!We zAU}y6UfLHa_Jmh;tCBMnWLp&lnj$@sX)8!~HQlryZ-M+Hy+=}?=WWPuiO08}`;p%;PYxIR%K7)M9_s5o2UZN;K3+0*e0J&L;r$nG zuHJG@I`i_^{fB0Hej548EBiSLx6`^nGx^>5!C?v>>H0f XP4d4zdCPo9+>3_?M~a{JzxvkS=bgE; literal 0 HcmV?d00001 diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/in/orange.png b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/in/orange.png new file mode 100644 index 0000000000000000000000000000000000000000..c7e7005be562bf27e991a92c8a37b09b6bfd22f9 GIT binary patch literal 2920 zcmcImU1%It6kc1Xnp#>^L_~C)P_^2-bMO4^&a`VyvS|}^YnrSk0cpK6_f9fqckXm% zlHK%8MYR4P{yfzm6a{^d>Vp)q*cKI$LVf9j3PJ@z`{EDyAV#s?yE{8cY|?~k7k1{( zJ>Na&JLjHr?malPd)J1p8@h72+=jt{@-TmI68|gK@#oFIox}WfWjHV%=W^?>5&z3_ zhhDipm+RW^SI3gE%DuMB>Um6k}h)QN20vAG6Dp+}B>beQHN-9*L0u2SJ0GT$_ZB&rbpUkaA#IuLXJ5yWy zt0Ye*NoXrdqtVDWv^yYt z^$Z;+{WF|V>f4g&xH=nBWthfnI&x|M47b?bAr>dYbUrkzSkB?u;&75BES_Y`1R)bI z3Ps|3%NP`rMNr!Gmw^gN1`X}Lh~k7rRmN(a+!^X{lT?&frQ1jSfUriqML3==pkYy;g1`2e<|6`q;|CwL*);`l1EY`th})*>(?zBjufl(@FXqB`aq z=hyKBRl;DRWvx=N2ZK1lflCL=C7Dyr`#!NXiiwH!0w`Kg2d1fez%q~q91~*0A-YFV zn=M~oX702|DzUy@Uxc|_N46U_#41E8qM)ckUROok0!8Q&Ky*u|6grw#G&^kWi+o<< zxVBKMU`4n_j}}eMB@WO?fh!|A0v2+_!yuNXBdy?YR`YiISdB#$MtICMSrWT#bM>4m z7WGwW4G;sE3%UkIi2>G z*x=QLvaPl;NqMj?khN`C%)F$5Bib{;BfMf&D9e$L@yvy(qk@hgGAZyZ%>)M3A#gOK z0L-H0I#5$7MTL&*=Tp~gq}!_2siBLZo`%((#K8pRhmay)yff4+Vw36wm=t+H)p^Nb z*TtaVP)&6VULb@n<;;=|;SxLJvS5Zr3lb~D5#|RejpCB*MXWC2Fs%7*tGbk#fTZVB zR*+J{r1|!2rvXn&X6k=!Zv zrgiYzOZ9@)<{&?bZQj~fX!ZnIuIUsEfGyJj$Pnd;4GUn+Q#Hdh4cEgWqlGs1Uz@$i zp;j0c+?zU6{4yqn*)5QNWcNrK@VbroEirj!;|RZDzB*X$sTQC8>BUOdCvelwGao$P zb=^nR(Y+_u&JJw+e)EGb<=-N2*3Tw;hQb$y&wl>+H>b|rb4)q-&K*+^9C>)|w%pI# z_U!B5ymqwbtGoBES^LGh-t|vBeRAvTUq5#ImiPX=_V-h7AKB*KSh#v_*W8Dnp8nz8 z%eBJ;$8z7D)K7Fhnd^P|wSBkt)J`8ITc7*3_t*DJZyY`}bJa~xbtlGWdq4i`+?wu3 Xz?L7wFaQ2S+=U1Gcb5z_6w`;F$%%vva#h6}_E5(o5*}2@(yPfUs zCU>c#Rsy26R#2f7#XeN@!HB*UM1(&0BnW-5uj-?qMSLn%bmnevbFoPis$JNx`Tyqs z@tgnuKl8@K_>@X&Y!#f_#5-r)^PN2oXg#Huedkm&VF!z zE;n$@uT+z2`6-96W*&RYrTKO<z6R?Fcq zt^1?LBYNogc!eB4N^DQwzfaoRcDRBjO|aB%HiFn`7v+v#hkuJ3+-GP>rUNW~9c{OLUbTGBW|B7-w zNkT_aTCG;TrR7;Pt3cbf6%{E60geFiLXhA#2;$v64J8_r$PW{r1(MK+T{f2#W$tM= zgl3qj4dRq0PMFfhp#t-&2&n_~NQMjNqDIHKM->uK-i#uQ%hGwMW6MmaEswJPZ z7Iz&n`z420N<=3U73z%oG0(Y$wAUP>$I`EcFLjF2!K51k5!p#SIUV*_S>TOP*;U)B zQ%=?mvbGD0SuJVdhz`wihS#kMWi97pJbz=?Ax}aTniSM*%>;(XO;0oRsv4pc zTD{P(cU^NJuOY2hLpS4kN-L@3V3zVtNRe+o7*{J$M34>$)O6q>-3GR%sen>fL$-;L zYi8@%AIz!^;T8u&STIkczQhV~g!x8Fqqr#7BG!~}7&d&;sV-$c@Y4M$D@Z9}(sKJ* zlQfS;eqRpsTghCI{zrT3X57ZQ;q}FGix)`|2ZU}LQ2yN^y8opvlLy7xbT(dRwO+8% z9OOH(!(010&EA7HFqbiHB!wb_dt>d?@4Zt4y3 z!ML8WzIW=?feV`+l(v62 zc%Do?bKvoxzWsS`?(*s9mfmT9@#D2COBYUleP(FS`%{aXpFJ}2!;6bsH@|$}zG-Xd xTy^)(i#zKlwoHFKQwMeBrQbij?JsuXAqfp$J^$PEpg8@Gjf|H*f8vGL{sGp4ro#XL literal 0 HcmV?d00001 diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/in/purple.png b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/in/purple.png new file mode 100644 index 0000000000000000000000000000000000000000..a5bbe779a3a1f8e34dc690be606193418b5070c0 GIT binary patch literal 2946 zcmcImU2GIZ96xwypnyS|7(!y$EIeTB-p=gj?Z8o?2ej%zZBJ>#hs@5-wj1ttm)&je zN_=P(5GXpz!tms_RnaN~U^!F78+5bxZUDCmR*Zy_`v%jTb-$;W{OMJ7!LC%7GKF?-B@43nET}t{szKGX8Hdw;dxLTi6$6KH&g}EuM$9}5 z74!Pai?BI3%%xf$Zw#6&8~|jDh9LZp{^nKO!n)zj#d3!?N#+-XMjMd--60z9g$9$``QFqI zUNl=TSf~csNsL%)pQqV7&?1Iy>P*LmEkT`^C)O?2>|I6G4MQg`=8ERlg8$m=xrXXA zwB4IpL+mofAJbbPdr9w+)Ms@Yv0LJ`tFP>0H_X%hg)ODr3%|Uazw0xw{OF0^Wp7Vy zu(!URTV#K)?S1iru>Q-bV=I?mT6^-yJMVvou5@(V)3Isu#uI<-UuC;b4E_Ax*FB4_ z?LT@ky726huAVP`c!~V@$AJ3z?t9;QjC}I=S9{KOuO`)vm+oGgx$^wSKS^&6ug`Yx zeeO)WZ{NttrBmXn-isftU)Od1+_K|SYp!2h@__we*MWDht7j{jYkRt%-gEB3r~W)} u{t@%YsZQsz@avA;s~>!``0pEw-`H@>{Pyziryt_CgD(ocilBlo+IsH(Og1)YLj4(-zk9xW z&bi+`=iKx1*y!O+8+L8T<#L-whRfsd-XiXG_rUX!UvFV}t&fJMl3ecI?cyHDy>)(P zF1KMes7|Jnm8V_8>v>GM$MUUu1n69D@BUVV$#IrS9-9urlKk`4YqAv3l6=&vXq9M? z%>=_IVs_-jXqB8eP8=%l-zV*DxuBrVQY^LVwJ>p8CAqEFg>Nye%2FGW9xurUgh6St zGA0f3m`QeCQ;4SNQo+e1+ca(MNlDjqP1P(F=?b!4&2&*g>RvKfi>dF9mk)Jq!Cy(9 zNz=$x)n>DqZyI?XPpimr997d*T~`31B=cd4TS}Ph?rA8qgv3FV20WC6M(pvqv?PP4 zoh8(xOl_ESX#&F37LHVu*Tj-7ws zq(cqxsJpf$(MfeaV(K_c_*_ibPy;OP?m3pE<7|PNRZItXHaVK%DNknjG9+Z;MO37L zzl=d4Sp;RRU>T^8WYEYRj2TXOT;;shi=DBaZ<3Dky7bu5Af&vRJT4aAoxsXCWhGez zlA;wAL#yh#t0C7yPiXL=b)XdpO^Q?84|V`wMUHD(E;1K^ISu^z6`_>4K9B1dHZG{+ zX{JWublX~`;*Nw#ibKLi$|V_G%?AN>4N52?mZkWF*@{O@rZ|p?6d&oVh%8D?%kRxE zb22A_O3d%%7v%(WWV_*-#4|lq&=rRjMP8Yp(l0oQts%|S8M4fx(bM)!96*ZWTEAA| z6$OnxE7}I3o?_4fQ;HNEa*!t;7Ih3083hkGT(CRHYdo%S3Y>#}vD+@F2UoGkuabJA49#N2$h)*NB8-LG08wUg4tq_YGfqLWd%I~**r!K8qtJHDl8hGW?# z$S8r(y?q~+EC~PcVh9f#Eba@e2*(%>QWhsA*^hZ$!ckNUNISdKMo7EoQNvdcNI%Popdxhxympe=z5_{7=c-$_9BMbH1zdNy&-7E z#Ant8!cW#mvJmn%hA#2O=R}4M^TJ5^K(+YlPv_9)>)OVlYqR&g+c literal 0 HcmV?d00001 diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/in/white.png b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/in/white.png new file mode 100644 index 0000000000000000000000000000000000000000..77d9b52b7f964a1923f66ea17512eb0e6318b0ce GIT binary patch literal 2908 zcmcguZHN_B7``cptse-I*%yr?m6da6&V1gPyo&B!-KDNByEj~=urqVc>`vZ0XPlYc zdsm3G{!~;T2}RUmKcpXh5P=aHSWy-v{z&Ub;E(W!Ac#RwKO*Wq_s+e0H+S77tAY7C z?{nUd=e+NG&hvvicdY2Sy(gE;tr+Mp4Z(XAzn3n7=iR^jiQ#o~)W0Xm<(94H_f5Ii z-&mW=^&AK)Bk4%_5yxY-JSNPg`9>`QbS}4POC!SGewqp{9Sy>wc=hBdQ3yy;+-;PV za@0%5g8qXs9X`0T;vL-Y*+ks3S=iKYKtYYBSZLI$Vd6B3VpFdJ-+WjWg(f83Ulg}; zgThF8Q0Qeb70kRMd5WS6mYqkYuA9n6K~+>mRty=b5;7e{caSAymk8Ek;yXj7?U^n3 zD~e-j8ac9Duh;W+Ezjan8QHciE2^xj5+I~xGE8wp3X}D14JDd*aS){e3k9wbyKFoy zir{H0gj&>58zvb|K$zUXk&N;R52*om1Ycxy~z@iQoSSpu0@LAQ? zY8`Zv_Dz6CS!}bSlgea77%lcO<~vSf_SK|)77 zgNiip=P<}6GoZ8)%mL++4m5IlV~SH2R~W0db7!#ao1mh+Ds0#tgoM?T`+4Bm1X{u= zEs8vmB&8r}N<~#21vv(KP=ODn1ua8r5}e|0unqVMvK>`(Gn)ZjGb%6t>VQ5A+J{UA; zb)*ykYe~xyvs~6`fzT{U2Yam$Jf5ADh}m#3%K|Tq z%9h&t7zMJfleH~a!u+(3W4d(|7@oH(le8unEcH4FqFiOl_)41}`s7*A1u&C^>2) z-Lg#Nx<2H_wd*izL->z_@mM%PJ+4q zGGV&?%t;!danO|m-Bvm-2>+tJc{6Td-SB^3B$*!&T5Ul7dxvQKms(72=WEm4c%9jL z0a{=V!cOc!YoDjt6J&d)Ye62{rYj+XmnSxC32VNp8K!A?KIR$CwXqv*_B@B0G<2Pt z+Cy*{VApCUBku-$5jp3Ad_={H`h7;zIfzsAW;iW6DJhXE0y5*&>zundU*rDI| zy*$i>uc<)!A-1!rpqUZK5t6%>3`#)}7^6TRpj&ICGXW#m5rMEnH=(*3% zd}E*6vG{87$@k9h9X@sZ==m>iS)}bd{busOmA7wOb>zFFhfln4`P~a=H$00@AOC#! z(vz=Uy4bt=olnoaxc1_QKWr-r;?i};PJGmN?9!T_7d<^?E`MtCeRuKm??B(q()-(< Gc;+t!L##Xi literal 0 HcmV?d00001 diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/in/yellow.png b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/in/yellow.png new file mode 100644 index 0000000000000000000000000000000000000000..434b96252fb2427082a45278508b695b4de15de4 GIT binary patch literal 2924 zcmcguO^6&t6rOdBB+-aV2*gCN(-DnmO?UNwH<=`xoy1*mHtS^E?24e()zv#~rn@@b zy*sn3peUk(f)Mc_Ip{?pNG`!s4kmaAs0kiCNC>Ei;3Wo3@FEhc=BIbo>}Hqv)6joa zU%mJ0tM9$4w7DyW$*j=z5XuteDK;0#9kZX(do2MxO+3d2MQmY z*jgxTJQmcZvZ>0G4yIuddDJDvRv0sMp|E>zD@OPz$pn|o1W`%6dggOc2)vSbM6bw| zc!bo0(S?K@UKp?8g`?Q^#Jzij-7SY12uX&7R@jJAr&SW$b{+Q3nv)ELNG?|g0ZQGKpNQwd&0;Ka%hFTy>clIolNs5yo&H@?<+#+)6Y*rFk zq@5{*ac(wByEHMvq!x-LSd{sc+CUHIxOg^cw4HlcA`KFfC`%a@=2*s3rIN#!H5-OG zI?WEuv52~JTNa(x=3^pNNlIrEOb*O3k2`yTrCF6MQnQBP44w~;>olWjovuJa-o1p1 zEbv!w$a|JRNh??Z%6oEX?2IG?Wi+W#+URL#q8FQ>z@j4TIub-4ZKjX%iFXH(GRjCv zhC+JQ4kZCgan$Iy z%A@j_MW0xPiai&oo=Je^v8Zh5@`vu(ss>flWgIU09ia`HRH(-|S4DxZw!_S`P!Z3s zk_fwvQ(UTz*-oRW$n26Je|Gz)SLt8uemV*m#fm6!y*O?Ehgs=j0T{Zj>fQE+vp4mdLsuQBIf~lLq1y?)ODnFUXoj#&ND^;Lby2nUiIutZ#?(=`W=%yzquj(u;I*)#vhm7RiEMK O;jshb<^`B>@wH5rTvOK`|y?xDY&u5fkLV$%Ao?5)Q^h4kl{i1*1l*=C!l3%WhCQ=~w+< z{g1Ey|F1gK-?w>r*P5X7ojkQV zmFgPti>0Jg*kWT^Nh6m!Bwee744q1?-%tw?-b)g}AwzzU6@R&OSrmLXEAG?_un_i; zVZV1GBHJhWig;o#wp?+;^TPU?%@kBff`nS79K?1lE7tYe?3)iuqELq)8XjO-)}8^leT7-3Qkg_4|xJfu3%#cf+LmK+GC-!Nna6YnZ%+<~X+q;+ItvMH@iZzD z-*{nb2aVzuAQ-rjDfTaP%L5r%g_jLT%7<}u^i}O&%-Ki z&CgLh%9D!EZ`7AdG1Jjr4I4YifHKQ>NK^CW$P+gONjH}7Ok{$lgT}#zu)pQt#Q+9i3nMMWbGR{>|;Hzyj^~_bo z>nkhD&A}2+)$(X#&{QD1B$+>(^1(UeQ{o+g&nQ+zf#-`|x4)gWF6Mxt>#E)y@Aqq@ zT*~>3wYcGk(J2|6F5#VwSE$|V$1LZ@o4sZ`8EJl%eW6~IHo}b%FwaiHC~XY;Gc54@ zsBFxy4iiS!9kR9oi>a4XQAE0j7{hZ`g*2P$0iIP&NqgES5t$(I9YC-2_I) z!VXjwLS(ZQ`t7c(wyfET+NzAIfQ4p(OvZq~ z#G08QD5D{h%oNOw4dEUKgK02EqK?E0QH0n=N}@O`dJ(M%C=AO!u2+{d7P!s*sa=pl zLWQaJGb?E>iTsWn=(N&yLHHl-&6#oY>xQ=%%ROEsi60OeZ9w{WhiLrg8cc5DYg6BN z?U{PPd~=ZP#5QZ~b2NKbwy@!tIzX1;09ohdiF6Af)l*d6Fm&u8p3z(z{jbfQ=TM!7 zj&oCMh#kiGXZsY$e%j|q60o|B*eTH|JjYI!@Zsv=t4xats z$k7$S5&YeP{Ib)v(qr3>f3$A0dg;QE(|?^k`1z`_RBB}3pIx^;lg`{+pe~FT4j%vE z*TOre9^Wq?8z?<`;KYYZ3SaGe>a`*~FuCU9K8l{Y@!A?z8P zbe24H=%-I!y+8L#>B5R#-*oS|G0{D^`@PEbYulD1&;4=t+c)36dTr~mfm;ukzrTFn z^^dQPoci|XzVp$_Mb7HQxkaP9UOahb^B-@%^yTjleqnF9MxQ*8@Dp=>V_)w43w!qe E1H2W(BLDyZ literal 0 HcmV?d00001 diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/out/blue.png b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/out/blue.png new file mode 100644 index 0000000000000000000000000000000000000000..00d6eb6f0d72f5bd66c1cebbeaae760a55bc9827 GIT binary patch literal 2957 zcmcguTWl3Y7(Nh0tzsY`UZQbb3}Rr;?(BUx9Bw^8YkIILhfov)vpcgrE9dMkyW94( zQ67jS@_^B3Vl48gkU)%>_=1Az15YL;Dj^zTG@2+X2ti^bKIqK3Y)_@7ji{UKZRVT* z|L2?U|7Z4hZ`wGo?ZLK8CNrc^VxmJT>5E3LYL(Pl`O)6O|sQWNYRv%P}#(dKI^_YEc6fk|3^HDf_Wi&G9w67X4<;0?*YT$*vr~mO12l z3*B6M5D`wxiog*?iPOz2)D%S%S8$RjiGrvKPy$f1M8$$S*SL7<05C#Vavx9Ori24L*nx-I1f+PWo0P&EYpepd=B~1%?5<8I>CSKrk%p$Ub{v^lK zNb6ImgsE9SZqP&t6RIc_U{+*PssXW+;==x@Tyu^cfs{#w_(@E$FvU`q3WXFtso6>; zMaRkd0UA+bZj++p;!sG09uf!rkwexGP>)NRfyGG=8K-6j!znx+9F~G4h)cl~B&6LF zs7O3_3Wuy`0+dv}DWI$;g@#spL{Jh$#ULm*wbR{jnMPq2wM29P{T zNRDSh0-^zAu_#HF2rU&Z7wLyshZd+bF-lM?*rfQPBwC6*0U2P=9lALVJC++n6-1ZJ ztDrt2gnnPmPoZFS`f-AMhjiw1JPk7IdDtS70}Tmlz>uH_bX&23?IIHx2G%5-AVX5j z=JtI2N5NJv&P$lF76)FhWs!0GO64arq=#H&4tvwZaG`Uf^ z)hde$Q;RM!G}*y6kg-mHffWc$XtRfkO<94mZd3Ng{k8|?ASwiyvMuu*TW5=!r=cR2 zSvejy8he>Y%l-96T@vXfK=y3(Z=0rnynBo9QHmv=V@k1V{x{R2MFY@ORaP7A-CmWH zd-EP;Ev^Tmwf1bA*u!cV%T24pi>ca%8dYX9+1>amdt5CYE#%av;4obh%r~07Nfvl! zRMyQ7mIx*5CVH*I;=oM?QAF1EQHH0@2VttEE{(4nqC5o!durmO*#C?c?BRR@}3 zI<_b?t?A9F-x#`VLB*2N1o|hTH)wTA$nPU``w{qCm<&=36U!37M3Vv0X`&gnN>ffT zY+{&-rVuLK8`t5+Qt%(o#0mTX61Au*L=mFmes22d?@3o=+pRd!nfh|mJv$ZCx z0&s@vqr0y~i~2NW9z)a7Y+VJ&)NBA%mY7I20g_!wRy9p^T*S1@tOd7P=9z$MG_;(R znoaZo#y-=NAN@(sj>M-K8_|>D+3n{?>8Wz8GrzWI9Qfe1uiEymnZNJMg^_p2eG3-l zlP}L-J9e`0#)3ub=Hs76E@{tR+c;wPetqfULt|raKI(2*I49Hf!zb%TA0GJPfok{F zyTQHR7CNr$M^9f|dS(A(FLnH4YtJlwy}0jt{dV%6+tagU&*+h3=f2TrAL_jP^RkbQ zp9${i+IV*H@#ha7I`v1i^SXBB^s4RBffZdlW*4o2o$DbP>+j`=+CqKWo{OR57 Pz}&fhQ~up`JNNztzaY!8 literal 0 HcmV?d00001 diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/out/brown.png b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/out/brown.png new file mode 100644 index 0000000000000000000000000000000000000000..63204a3af3edf0e1a72070136d08ff2a352fd4e3 GIT binary patch literal 2975 zcmcImU2GIp6kg>g3RaCoKwcaNqN3iNx${30)>^v77P?s4MM@&b-8*;M3A;1Xnc41^ z2NHkyRbKFcgkZ#AFiJFFOhhFj3C0KUNn%VuNfdoR4GAPDyx_h2*R8a)L78O!?)mOH z-#Pc3bMKCxmCv@!S}-e-NVIfyrhDo8eszr(-9hKtD3O>whuwE1_U@aX zNX!~?v;A>@rrW}PA&G21N0Q}2K+%cBlGbv7@J14IIWpjSDgNT;$9c}RQ~Vk=BW8kj zGU#@03Q6Clm07%LBQ|Zm^=WQN*`f*xBt~4hkoO|1oZ>5bE&9!d1)i%w;*BZ3jTz+n zGd*0p9}-SWiU5nE#OY=dYKo$XPjQkciGrvKPy$f1M8$$SSG#y>Ewml0H@&Q8i~gnf z!8i^qK`50<$&#G(!vO)BrYVS$AW48CKs4gTs0_SlVO>L-L^yPV*!4Y*X+$}{7^is3 zwCX}3XsGp~T9|0Sgfa>Qm=u{y6`+k9xS$y3E5>askUS|6FODb{Hn22GnM?yduG&JO zfsW#iVallH+qmc`I}#9~mqdOs#H3@GT3lEs7R9|}G&EC~PT`Ho!Jr@e(V#y;5E|k! zp@>~)0)tF421?5A1W+bvKm)5iBq;X7tncURxzkhU#z`B1E1uzEV7_4feBC%@?bKx+Ky|fb3b5ubo6bDqiimG{h3mv3#*A_WNk-q69QmmDSpK zk6R}B{UOKvZ}T;NNBKblC@P>AS8O2R0`JE33TP!Qx@T&XT$*t2W< zQ==fc*yl#u&xApeH)+OAtsCB0EVp@)1a?5EwgKVa9isZ5u10bh zTbs(pYmL_nrkaCvC$?y7pQPE_(8O9!R{=7$9Dph-Po$av$&Mtenx?vw`Gl8-@egy?}=yTZ#j2L zS^drfPqZE0@W{|yeTdVC=Iz*?dF9bXuO1}v=GT%7K3Lp4``nec{<`G+)cX4Np6SyP z2j@H{&;Pjlg4*)J(k(0YA3l4w|Jtei=It%(k6iIi{kY&>F0N+TXwp8=G8Ul zKmG2$zjvKD`r@_EcCOOD4-(v+@6Wyd!^tBviWipc{_@C-)AJr$+GXrJaB@TG*utY1 z4lVy>+s>qI5NSeCUoaX?R31&_AQbu7Xyk;BsOj;2gu$>V$LFY*GuzP-v5y2T%6|n)hx&c z?PSpH91Tg|Xm`#Y-Dew^-}Df-v20QWMG_;fTr7BzSx)m6y(ax;!y?aBAo0F5-^L7b z1KA#~-46+;C4pcAAaS~pgqosg-~mno5)gqZLP>y{2^16RT~qBuM}oE(;uewY`bVHhHiL`f1TLWoAZ7?lMtT3y$WA(0)rLG1b-$220#ABxjF z^|Ts7F=(juqFS10!o)HPM3@9DqzVw*4O}o37AnTEEs_E$5-*M@7B;XnOWAA#KC9Yd zv4M`_juQ2#7Tc`oC^r%iv6n>tP-v5m61BLx?pPG}lBv`zU^<02CI^Fl>_>zC97$-1 zXQU!_ojD9L$qXndyK_L9qyY`g_K=|14|Bd>sB@>M?i(k;q{OZ3cRlP6N9$SOwFxAH zVv^<=kpz$uWRR026F^gi8vy+PRcMw{6QdYS2OAWhlYps6Ce&ttee60T^Fpz0I(}G0 zbm810$`dj0@)c{@tl8y7G4gEEl}Yo|)uiiU6UvsNTMiTmNZA6^6;-eRRs{tTVh|+- zF~Rlu8Q&gaq+;`{^@V+#>S(NnsS{ZSHc$lBz*vAlv4s@SiJ+x)MMI9P0&LW^Z4X^q z;;1lPEAt9djSfj^vW+c4#&mWHD^M_?#U3g)WChB)MRPc1x7{!JVb;eq=Q7W+)i$Ym z>MCOOmF8h>aDY*@FjO7XB|t9`vS&@ca~}DWc!%fG6iYnE_+nP<_tDlx9ne%&R%_!u zZkZGYGA_+pRCPp~F4;L#!a5nNP_xsGDCb6My{3=suYDCALq z3%syYR_6~75}K?Vu(k?|d?y}8A!*Cg49{B?;#|&0sB~l3DH|bx8W9{r)&!L(K(J(0 zr))B83&;{7P_Ku6z3Z|G6;qPyHFPts*V1YaA}>$qCM5DV9}F@qWZRA!jqBH8)`svO2V?tQiG&;b;}l4L8s|vj(Yg)kDe=;^;9YvcoaoB5Y;};v-9T71ejl6(2Vh`_^9`DxJMra>hCS)V<3R zpmqDE=J3_AqZ5m^uH19+(6@z-iSw<;F6?S)+I8X+O<#9s$DZSVUbuRcd+y0U*1Y}m zr4876W9jc>n^*pJ_VJEaF1NjuxIO&dvJStt+$=u=q08#U#YOO_G&jK+%cB+VzzHqCpaKHp#nQn!j=OJkPl}&2QJTVm9a? z18&!7NVbmlLqmo{D0G9^^*xShgtlLb(>(RG z7D6#-s`a8eO_VU90s}!xiY%lm5Thn8D20Wpaf}2~AVuQE5yeVPEM+O1ZNev2TP!xw zQQSF9J*vkxDLTrH1Vrc~kzWcC=^UmOmp2@X;yyA)%?zefcyn?v;KzP6;7>t9Q#^r+ z*mb5b$Rrb>q~cBiWs)W|usT8lV?WIKexZ>&y$#s_m|a{c_aC0ljcQhZJpEm^lTZ35WGt}`+%6eG*=!y=>$ z=N4g}2!WTcTFYjwZZC?Vhe&rO%~MyCu8S=wV+2J*1|oDcU=tMr({vPou_}K|XnQ(zX^F$a zc&*GUOf@Zz-c z)mNIA>Vy3(RSTuspdpL&5+wGl%Xds89}{o$TuQObb1Yx1s{O6Bbx{X&O;fb`c&}R_ zh5n37S&M3p(D17>s*)WOC9IRN3bnf2i00f#z1M6dL-ntM%TTybSyNjcAe5{-WNi%=`A%GhA!*N3hNrCxVJhb%IDBWJo-MT;HFX z1+tu$TW{zrS$X57rW;lDHP9xsx>4hXe2ApEmK)c!LyCO5LR zscyX1WW8XfIY@V6i?;S@nmv|Gq}zr@TfA-qNn_;+H4{L^krhqXHRM26o=ltnUzZyZK{}Z$ES2lSjze z4GTJ#>|OTpC5}H#+D;Arx^{QVx_1sgQrh`Z@iKRO=dH`LH*LANV&9Ly%{hJX{aNSd zzw7={TG0L4O@5b?dKs;GwJ&U)eSP-18|cma4_7Y?WiFrk;B9yDL!SqWzCUvA#*3Fm z7v{E+D}QciTlv_h3;$Xj>^z$O_KEDZn{5|{zCJ?QH}5}j{miNZul&B^#Pio4SbwzV VnYVsAKElq<-JLy|6B~Bz`5UA`%&hEeZ}viF@^oobfy9 zsM9?e(80;RES?<0CK0zkBy6i#OhJ)GNT?JGZfI3fVpXrjzWJ~u3ROrnmJ&O-L18G< zFLZhV6^ytHuq-P=!i+;h(+s&?P-I1xWL<&^fQBV&7EB2BOJvpplCuWVU3FXRFC~sf zk#9*-xm=Ey)wmbrC1{$aBrB4l0EPhJgd3p>aKpBShBOUv;P{c_xdPXSY;QbDiOkbl z2t~iC)(z`vVhNKf$d_PT<{?#q1UGU1cu=SsCs?8dTBL3iGAwLjS(Y-HCVWA)#bOg3 zM!QPPqk3!$qQmTjPo)7GdgB46yGqPrTf?z18lbbOS;lk*Z%+0{y~qnky+xAH6wgaV zkrgA}`2#UZKIA{)TUY0^^Es|6a!>UO9Y#2VS2*(F`0BeaJOvhEbEC2+akX44+kGOVcb_nFscWlbcu)O0bplf+AuI z=M+(%O1_(~TFYdt9yg4Ti)l|fB{EmzjzcU(Mo6VL1sWn0B(bIglbQ%Xl+%*7tR^u@ zH0Gy0JkCkQ=hy0sc$n#Eu7;(n2qra!vXU}2peDFBf^A^Sx{P%bF^xt;+n&H-C5{Sn zwQ{cr)0m@4L&d}fDoHS}hz5ZPZT`@SscKM7*er*$c00X-7i2uba;}O3Uu}!2XRab% zUnvpR2ZuOS3*)uHgd(#`g8W&R4=*8~6+h}aEX9f_aK2bo`-7}?F$WA?SM~aMzf+-w zp|r!Y7Shndq#fhyfIWbwH@50uv<& zQ0$y(+PaOPX)hGaf(_v&2ZKGgM1wiR@=<`;MoNP)CFTOJC?MZ2IJjC}QpqLt{i#`y zLgWdv?Pt-X5gIsiI55{r(*@yww6`SVme&pc&A6MqND@CF)Y^db&kj-hPuDWp#n+~~ z@mdS@g5`3M?Zg&q?MpO!0!?h#2^}EQumRM0c_Q5eNX;p#ZWubwAB)n~-+QXRC1AI(p1r&r&9=451V8adK8GdOeT)#o-&A-M9Mjz7No^P?^8*IwH^ Y6Yu@x@`X2c@>6uruD0#LT=By}Z;C1rt33 zJtM=93Yk-ZifTMv978PpmrlIM)u6!R`d3W!%K!fdu6BwkPA~dekR^BX!0wc^{S$<| zG_O@}zcwrI{P(^oe&>E}lw8uIkjkQ|EHi(5xfaLt|D_!~E4SW~NY+2kxTgEa%J2jR z+biuqKC!%?I9(8;RQ6EQ&HEFDI69X^PJbVx_|$5eS$gjEy}cXdnt<+L@O1TaS?83{ F1OQ&3VJ!dv literal 0 HcmV?d00001 diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/out/light_blue.png b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/out/light_blue.png new file mode 100644 index 0000000000000000000000000000000000000000..a6b017a448d929aeef6bdaa460b18898cd60d3cc GIT binary patch literal 338 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBugD~Uq{1qucLCF%=h?3y^w370~qEv>0#LT=By}Z;C1rt33 zJwr2>%=KS^iVk_YIEGmGC;#~W-`-VXwE~Cx{J)>-&;5P>|FwSo|M`WFlmj?+Tdip_ z$l3PnRsHs@<_$h?J}LBsP7r}%9<`$Lb<9CGL?0Y_nXXWEV9p!k`2V}t>|+yCU}MkU z_qG1r-}??~R~lA+um8LKZUwiF15a60{p0$Br7Fyi^lI3PJq{*{*D+~ku_~zo9iR!s zJl6TU{@$;?TdE+u+lC`ql;vTE_x}IKV}E_!|N7bb|1+Q0F|=-2eOSxG=HGb+2Ag&N VvzjXwDFc1O;OXk;vd$@?2>>j9g(3g| literal 0 HcmV?d00001 diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/out/light_gray.png b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/out/light_gray.png new file mode 100644 index 0000000000000000000000000000000000000000..fca72ba2ef01f6cb84d45a9d2456ef5790cde5fb GIT binary patch literal 2956 zcmcImTWl0n7+w+~wMZhO1`Nh=@S!MY=RUJDVS(B$bk!}TEMZF^a^{>f-AQ+6rZdy- zwu%OVMDg}uGz1JWk@yA=MvO=d-i^d~eZa&Jq9z)H#tUygi0ACBTWx8BGRfS|`Og3U z=R4p3pYy~(|E49Kw{<2Gi6z;-%piT=$nK6s^m)gn%aFdV5Bi3pL}KwWb}vXAesOss z(K+ho3vnU$fQ9^W5@O#b$!a;E=tN@e`f32t2#GnH47*;M|Mm14o^x@U->&7vT+l;` zZr@}`wodlv(c}m+F~5Etx3+3g17#9Ju39d6kyTCeHM+wUv=}8eFQIt8uOiH?{>f#zs7G+ToH9?Yrq+6nDNe0)rciw$kWAAQL|Kq!KoKCC@M2g6UbL!dAwwb*x**~+aHV5JdLzI zg>uj`>qQNkC}Bbs27;6n*_3KPj9R#0EG*TWVz2ns5s%BtOJV>Ufna6MnZw(HLe(Xm@e-;v2-P5Ru zU1t`DtY;dORNYyitfvJHte%j-*bno*UutS+pcxw{OG%mQ+U|PTuSBca#2W)h2F4`K zGa&&n1r#wa%a$lvnskpyKg2pTN2Q5j4BNpb#ph+wl66bbrh$FzIumn3F|r&#EJM0* zZW#^}A@GK4-f}rB>qRm25XolJJPkGJy4ccf!06j*eBM zIX>f~F(xWDzMfy$N7P1ZH7tlEU6TwENVcv5l2RRD8nz8&TZfvVI?%*+)7s|Hr6~?e z?N(V-m|Ap5N>>oJfr1SJQdpIMDcS6yVN+2h#jq)dQ+|8=k{{-LOgUG0j;*#u&C^gJ z%da#qH5v;{s->}dqalm*5+wF)^bgI^Kh?d>b1B6#&oRANHUC>_>7oJXnx<%t_5rs_ zN`;I|S&Qm{=l;JtELYOW12##MlbjeU9QPK%;OhpG8QAJ=YngR5b ziEL4k36ZEaXA51iB-N6YW)59V=ndPb2)$uKHz9$)`pKja)diy4fuU+9a5U8bP&HLx z=$cJL?8qqyXPV561>qV`2KnAN3EPAfz!1`nl!Q^5cS66+!5}EPsFq#AxQ842Q!634 z*ypCo&#a_j61r^~X!p_zf%_l*&8fKgRl|QP?iw$WzzzuYG9di3Le&2=btX5mwW)2q z)=afvz8a)Eu|-S!9K{|>Cem#~1JKlMAZaW;A=Nfi99hwHT|-Vy(af6vUyD7{P>qJR zb5pa49>&;b>l8?TTIWdO(Yy`mDY4^&Eicd$<~!L;cRuy>$>*}2`#0Rs`{=RT-`>&H z_1);&Q|Fd~>$=}B?B1y!e{I>p^Zt>utDfJRxo&fH!G@zh9@%hn?@b5pJhWoZg_qad zzvIluul@|a?itCA?Rv8O&F&v^e{5g4>8bDgK6&`hg%{Pyy%##ZRNqP;yeo@ueY|7k zN2k{OzURSxT;cA4`@a2j-E#E#>%Z{D!;3yV^xl@^D-OV;&n!%A+qSF!ua{1~GW6U2 z%bh#V-SXL`{?iY=advd&;-%fIA3JgJSl7Yx>%RCZI+~bxxBtyYetLEjJ1=K@`!gr* H-M#N`M6$y7 literal 0 HcmV?d00001 diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/out/lime.png b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/out/lime.png new file mode 100644 index 0000000000000000000000000000000000000000..d2dc60135013ec9e10526454befabbc1c13093f8 GIT binary patch literal 2974 zcmcguduSX*7{5ZReb9O}P=f!s-T0)P+ns&g?$B#(bEygS(vX}qMbymh%-t=y+uiPN zl577FB8YMo>!;X|)O}h(!<-^bes>|4@WlXYQ3mlP1*1!oKGF z&G-1t_kA;u_4VGpeCbU~6N$v~p6+Zvdnft5_&WBy`Ijr0y_N*s+oMEcSsT9>B%a^j zo=7a+;pPY9!Q4H_@hd4ze4D1Km4KlWiFF&Q0d|IIEZDT@dKvNJ#QUP)l8m@b&&j!< zla}1>T_GLV)th&A4LcSQH>?-dRS{EAp)nS!m9iJ1YDTQ-MeLgoOQKMN#KReJBR41v z=K6$AKcs?@l7S=3ijcNa(9kqPUMncFB1^I^K?Ohq$r^%bp>c`KT1X10KfAeMi~VK9 zQXB_JlE%iyQe$e$4~r7CEK8CVNl^epfM}-|<0|l?j;4kzjhxU8V%PTst`Xb*NSqOw zr}YpjK})R{HE3dlNmU$3FeUSlYCz(&aKT7et{EqeM9Z{7y*Of6*upZFa=8|KMzxhn z3mwH>qs*g5Y%`*x{LX+%{WS7NLWg#ZGK(Ee$D+8OPEs?E=?vbQ9F+Xnk4pY5B(%iS zsEFOdEC#t`8kAPuS)g3ff(EEFq&W7&yziHrxzpG5O;BJ;5$@RLdc+@#?&N_tCeSR7 zX-4FU1Y{Gaa$Zr843Q4k$m~O|Lvt)O36Akpu*L9sMMj#5G<_P_CvIWqoKWJRf*)2e zTR69Zi&P4{V$E7EhkCpy#-2lavKf)NnsQx&2vN;+fhquNjs{o(6o6@C9hfR6R4tgQ zNz={wS>GAqNyX>a>x=jf)6rTDLfT8QE-Wcz5 ztF%0rbs1|>-4SD|Wczdp?_|6}QMVhhoZH#xH3M`<2GFS{16$S8 zz%VVxmQ{sP$Z~Tw*Hr{Hq^Qjrx)#?Px}6gCij-|al6dXGXqE{HrUoDsL!hae1~AoF zY_?@!*^;42S(g4im>Cd}u>i}DZ4WQ1;6YCbhYC%zT!_b`qYxZ?-{D0c)c@EWR zm~w7v4za@+|7@KC*-z^nNj+A#Av+}=_@wtNJ7Ip&liip%cc0udv10tLWLI(F!X-Dj z$4(quecMN8B<+ubi{QcI$KQgNk{{mRzO3!h_s$%6<;8FJOsFTiv+}}~iJ>3S$??O( zZ-1U&+wD3}g;Qs@bapIQS?+pd%kKv+>!qLDR$M;6bvr6?A9iL~Mc1&czUP`p4Nl;A@iD*E7yT7{}b1Rt$b&=Rx=E%lteWn+^j)XTu! z&i|eN@}2+x&zTw?dU{RwBi*rBY)xh`Jwo3-?C!dkJ~zzWLiDxT9~=u~vHRAt`<~dD zx7NjC-G`i9KFViz8Q3ewk>!~rUMu?)9gA(X2wW#cyW@ zxqNn*>-Pe}X>lN6039_L!zN9XFtLVw5yk-vsSdPo8|PPoQr)fV` z+vqSFn4lgtV_Os*<|ch2j*!r+1egp=P>UN|j)l<(nWtt2(%ZNKt$gy)U9Q+M#c>zS(WqkpL=$nyv~2TB-oCA_>W)f&|T!G$140mUPn6wmWcW ziK9}dR_2vOHQFSp$=EUl*-8*0X(>?9p~)VqrOOJG6DH+w-fq8F@`9{qQO;$aW2MO;==3t(sYN^r~Oh|xUB4p2|d~6x{ym+tcP>Lm%7B(EwIwfNZC9IRN3N;3ukmlTEv)7E0L(Q*}!_|w@K)4YCX4y$BzB%kH zvcM~&vZ1zGB$TW>WNiZ$dUjMr0oh)l3@=+1;!@6sXyVSU!-N6>)QDi~vL>iR0fH&3 z2|-Kh*aWgf2u!p>zuk427LXyyts1%;*PFEBB616aZbBk|_rchbj3t=Rgap)WTI4Jk zQ<4S6l#rH$60sAs&~9IcMH|9@91Ql{2@-T9mX88NH&POWDc%meGKYM>T}$X#A%eOzvQ7 zQ{Q-vMSH;tbCB-D25s%jG z4%KPsI5)M1=wXa~woifdr+tnjF0I>uo)W+O^yUCPVSbTGZ_g!9&%Cy$`{jp>)R7G4a$sU16jXI5Q!aLfMd zSNCptZ0&Qa*WKTn9-rE@Y4$97*_o=xb@vKN=+x%T}>_QR3yJ z_a+h@d)?efJd)jRV!xC`wr`PSwG>cvBC)Bf8X&xf#GFO)u9xO7PMzX8*G}`h)U1>Z zdPu?Tp9sm$iNPG6*neS=E+G zEp!z3mZ?XL*k(mXx$%IA!zA*@LQHzg)Z)6PV^KUzrc<+k=@j0Y92ET6j|%=ANoa{@ zq#|~mISew%3@E9(b3mD-1r5xekf7KPbG~0}a%ZUN8wWuWau4ltJ=?ED8(83t2_%DJ zlI9ta1SuuRQVv2>0;UQcmgt96hh`}?Z4{$+utD)TD4DWuLS+Wnw_Rs^UZ{;t#}7-0 zE}UCJc_Id0zGf|(H3z&XMjj>unKVybO}egaLQT>%TXF=bAXTt{0)>=rK>;Jnu}O*m zqFK%P86S@^QnC5<`m%jYb+lH)bR1;svf>B?KwD6WVhbq=(+bmprRh)s$f(Coz1b1E zw8T-dT`Tj-rWzfR(qwE~f^6$VNZASy3}CT`Y8$cwWZj~ArtS9lML*2?HqE)rb8NMl zdg>}-^_Av9V{n8~wK!HE)S*N#5wK@NK01$lTKt&j(iB6UV|+1d_IJ|OMIF#oRaP70 zLvEE6M=~zWT2yyLYnP19l(0_5D%9+EBg(n)Mz7gP_BOtXE>|l`6XALYn6Z=Cd}G+1 zWq}u#%DUQ0fzV{#gtc{86cftL8oCwN8)?M_?a*|Qt_ zQ>!4k*ypC(&zwoKN$9q5pxsK#1@2$8H!tHB)(!vnMH1Noq230>zjuiGf2N+vKDIWs zjn|yD7c7v2bSE}xYoDjt+rYq@rK%P_KZWd zG_;+YnnUz3#y(r8K>E`zygKvMg#({* zYfjv=`plL~KVDzkHMp{~x8uHLos*L0{5G+4{yJD|PIXA zxszY7Ub=Yuhf|Zkbsiesa3Foh=TjG7eKY8Kak=;4XGbm^|KS|iwsrlXU(P>q{ejEN z&c61|`KOJ(w+8lYJiO!E(atXxe}CxLgJ=Huec$l@Q&(>Pa+~qpQ&zN_9hV1s2QzPP H*?sUYR2aqb literal 0 HcmV?d00001 diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/out/pink.png b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/out/pink.png new file mode 100644 index 0000000000000000000000000000000000000000..7991ef0d9f8fd47e53bb38013906c25abc8d0818 GIT binary patch literal 2930 zcmcImUu+ab7(Y!QSRpFbM2N=CLX1TAc4qe9?aD!Fuh<%|)bI5BynOtN_`p%TqCyWL|PP? zr_B(8C{r6IEt(i%aveu9%mW@$1L!&#E}Dp|4dbpOlPU>Fm?jJhGc04NT+ZMNsttk+ zouqw}%%fIp3!;Q<&q2q4Fpq>McKM-8Ysn@acxwVF;gl3b zo=6fXND8PRWC3Vt@JYZvKoeSKsp;YrcY;lZuOMJ)21~qoVCwqb)RIuwu{;_Fm@S+i z;4vac;aJ03xoi!DNs2><43vr@b2ab#u0>SSaSZ|_L>wYPsOpjpU_ml94D5ogW3QmJ z=a;B6!IO&5Z`PMf9i}5&4a-HU0X^4cI=q4e995OD=DCt$BV?#bff%OO*0v+|S&8Fn zr&jKj%QSkVpev4ROA7N%D!3|?Olb3m=9-EM6~ks6&e`pyRT`J6%Q$D=^3}GOdgdzT z^;HyMYjBjOYIUMHXdu8Y8S-aKzIzGzoOoyGGm4QY@O-fv_D5LjVh-q9bS3Cp>uR<9W$ds|;sUuYDig`H*y4$n^FimhRPfdyV3 zl})v^al**DMbn&QHaU6~jwh77N?FWNx+dxo7lE<@IK`NFoFxd`6 zSgAm}U?9z2D3}Es!W|CAq2VNnI}$6xF=iVniIbw}#WWCb6jgnvQC;$6=(hH!tRRJy z3UlpeQPNxz`yDyZX(e+(_#f>pnQ_bOhBp_>9bP1v9}t>tK>l}!X#SU)Om63E)7W^e zg?hnqbCB)C7HjQGHG60}x@~9@Hg#Kq8ZS?*nG#k!q-eUXIUeR2&9%}0+U$7_HE8HK zH?@b@VT^xfr$F|Tog+!e>NaMl#Qr}n?`J2>V*{n0O5v^Zvprp3fbPZhYyjvQP2&diV7U+-S=RDPyA7}@mc)!>yYzn$Co$$4XS?s)M1;msdinOXbD>X)zY z-}r<3{I}1(w(r!syFXaB|Dtg2(Fd#@Z%-W9c5TDiLpOGwupjSQ{pNIkeB$6QYt)BM zsRu8wJpAE`t?N$ye0=@8U!6VuYVU!ov!Zw7=$GBj*GJC0e|_Xd8x7_6eSGosrPmD!FZdUIdk0^SrEG|t+-Ij8j9h;GiT21j_l41Gt=%a zA(SeYm|%D?Mgu6CnE0lV2Q*@6qsGJ=^+iL14`M%-sZBQne+xfrq zU%vDI|2fa~u3x*T{f_onEVihpJJm#5KCck@g7>nI}8@=bn4jx__ zi?wfaGW}71`Y{7}g*dc46UR#hpP*y0m8(lWL|bvhm^kaWN%q&{BP`=sNp_Qx7SetP z&N73mhcdKI&>WDo@f96_d3$h)CYO0reG2KlDLJj+xe(bgoph8kr0 z)4fcG7hpz>3mg&zkX5M%>rO#NbswZO8CzEoG;7WqrE zxhV1to-Y=Q@uC#>f-DboUFQXn7e$UBxUlR-u*A9H@`i>K4pHFvk>j}x)d)>*AWE{t z(^?1xzp2&@>ogI<_!9Ja5Ep1jRiK5MIDa6>SB+bU$9Y`9ZWIzMXkrOV>2wo5t=dAN zi4LRALE=$8wrSB}rtD+B4~O1BfNzSI3dAFLPit~0T>E+Kp-DN4VosYX~77#f^~w=h=QSr1`wuzJlEvk2!B%h1&} zh@8?Sv%f%Jp8e5pS!1{HLPw?`i5LT|5&D&`O9qe)QEJrCwYXlV73H9t#bguW*=r95o1%sVlE^aFMNTJW z!9h)wIa`txo0N+xn0UHirfmqtrlxRES4|Emv^=3g(ps`bNl{e=*`(Rmyz%~P zv!^*!rJ?2A)EFX%G5Xm&1(KiUITE|1ZUb^kJo)nIhvbBLrYE%~lXxCYR4S|Iuh_L` zczF2rwP^9)-R%d?4VB|}?;RW3DeU;;;vbMNAj nk;=%0^S6KFn{UVu&5s>FvF_MO?duomdAg@_ed?`8o_gjVq1)ux literal 0 HcmV?d00001 diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/out/red.png b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/out/red.png new file mode 100644 index 0000000000000000000000000000000000000000..d4b83ce383d473d470eacd5dc95d67ece9a5d8b1 GIT binary patch literal 2961 zcmcguYlsz99KT8USd~QW!4fr$D=0O0&Y9<((d%okx*J|ycW<~W6rDM9W_R-5IpfUi z-n&wXl2Cz?L>l(^R-a4)S%r#P2qXGp1z{hOB*CB$y`&-#>YV$S-OXKhvB$u?&i{A* zkKg(K|K~j4vvd2>w)VD6CbP7=tI*5d%lN%;K6^fR{ZGVRi^8sfIFnhtg5P&!PQ7+t zCeyaxFZCz=#T_=Ll`L|pL$b9>$k3V0`i->^;e8|#95Uz!dGW{hJ`@Gt&5L{VA}EHP zWXSJ25RtwEJ4^V$K5V(-#tp*yn#~kcNP>h~r5wa|Eicyf+U%PT%c4++B>VE>W^PdE zFZKwXG$MkL1ri285lkx!4NWt^!-4`7AOl^7iUbWCXf`y3<|Q&~k?YyLg>6k+>@P14 zB}r(@aMH7ST!wKNn+j3Ylxd>RN`BXa0)k{6k$ zjSwnfsy2w5G%>>D8VY5Y1w5oW(8Vb(9FEF$<1Us-nN&!S#0(2lEMuuyOySe2tyEHU zoNOIo9yMc|79E#HLn8N*m<~snY#m`1SG63AlU_1G%^apPcse;8q6v+M=nN#J;we-l zzBhwGE|~%)HGc*um!#0p?u-aZXjG!K+{&GvmT!Urvx=~0j~}?S8n5MnHz$w+N=RPh zi6nuXq=J&7*Z|r(dJJnUct!A9)Nn_ZF5N*t9Z zYvo?K+$)kZRO~vE>Y7B#xf+x#=~_*Jjf&J|oU5Y1SDUM6t|DGv zc@Z`T`+2IChZ}>Y0@x)({%pzzW|2>b9}Rp)u_6jQU+lX5KGwRJ1BR}vdUL$TuaR

v`_nD( zoTzN5tqu`J)-AHO0gI`ZR8d4W4>E>ltqOT2=VLT-YuBNvK>!URd6sHOI?;gSsJbZ` zISV^LRS1D*EA*RPS8b@-irOl;+i|@~D;`3@AYq%3EZ%-FhKCd_r@N8^ks>)cO_g${ z;jnT?gq513VVz~u&Fe62L->z_!88~l(WJx*QH0n=N}@O~dJ(M%C=AO!u2+{l61dI% zDJ@7Lp~6J_nUOS?ME;~4m~16=LHHN#&6;s@>xTdPBFX%K&}akl-#bL(ztCWE8(*9H z#%oX43+9@GY$vu^YoDdryU@ahW3s)%VtEX8UYQ&Q^>`aluU*NEuU)wJ$lLIJIRC`L zb8Eux<)1$lFZt-?rhAW%eS6}q({Dbz`bquZj?Wgr#bW!7!}p&)cEy~x;Nq+03m<%c zJTsm-@yOA8ejdB_tFwF8J72W-{qo|;)enq5zWD32O9lph+xun5>gDI6?eoURR&{*y z-08dNA?wDT@iiCDTwM~JH$Po>i7Xnw)V_cBPu8(@zjs`FlCm&>i{?{kLe`%d;>b{l=JyK)uM*Yc=uB+2DgtYQCKa)%Dz zo6B|JpfsEg7az3|spg?aT%500BZ|)Dx;ED%h{kZrxp*`P3;gAGKj68*EATtDA}B^Z zxE%EDj`8;010}S33|St(`C+cBZc_zSoI?tabgaO4GlSf4 zagggFG3N9<5D)+|XIObjS5+N!ax##C2sBZW1xdGoYD)%}{dj6E_I!KD>CJ4>uL56A z)5sRZTCJ9^DR~l)ijrknB9KK{7AQhUCc_lgg)mv)(%|3(#X*z?B;=Sz=#ufYz*A3~ zAylKb+Azt|L=z^~VI)dO)DCJGxL(udU3%1rf z1dTH~vGvW$@(7|j+WTPpGO`TMf`TO@NzisS zuRN;J$EL0z&lMEUz=G+il3+c*{15LtB_Sz zftRw$VMfx*cyrQ_0sV;*duH;HMdUN$9brIIEb|;=iruikoi;7%fUaqZmdy_abzB*C z0-Cj?=?D$Kv7#XvnJZyEjMb*y7bKKzlUbM9j-Sj%m4IuMqYY6r1jKlWJwBTb=Gow- zrLw8ER>m}0*WqgumJmO!!5DXs(hM(J58^`3Cvf8Wu1kh00ZGS#Zz;N$5!bV{qB0CeF+F}n{>Fn*B-2o20}8tC0YP?ES8#!$ z3aW{ajuc=3W!_+}Z3Q%&w?5Aa2(7cz-%jR7r6h?-lB9{S}VM^Qf}rBiR@C)YyjfFdqeZvX{NE4ZA{~^ zwdd;sOJyHDeQny*7isgJWFg%(Gyz(=D@YnEOsH7`RD4;{bX`L}Jv5r$kpJ4|8G#yU zm~~fbP0$2$sKYrAC_Q=$_moC`mp5xojf4;#xael?0y`QR|T-tc?^iMpueC!hLfBEOmv+<=P z8#})F^4WuTy9eIbb?Cw42Uj2a>gZIj^Z4|4FFd_|@2-2M*ZjTd)EA#wHT&B$J5EmR o|M2kOf#;vOaQWQFU4NYuJMS2{vaI9vGP@M_Zy9h-KC)}iKTfs1W&i*H literal 0 HcmV?d00001 diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/out/yellow.png b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/cutouts/out/yellow.png new file mode 100644 index 0000000000000000000000000000000000000000..b6fcecf4b17229ac8d7617a79e9b1e19396e6395 GIT binary patch literal 2955 zcmcImZD<@t7(Su2n%G*jN-3i27W}}@?aY4OF1?nRYnl|Vrs+v9DA?KAx!iJhyPMrj z?h@*c)>14Qu(m(M5Be)0Es8~2!J@4QrJyLbRFLWqp=y6rDk?=pj5GI@#3oIsc45Ef zedhgm=6&Cp{ry`vFYj2>kw_$#_w{B5*n1_vZ(quu5B@fV+3Sv=cQ8sMI`854ZHd?4 zT%AaC47<5}oXiIzfgql%OUd86e$)s)Y=pd5O$g=oGAhOi$Am`%8<( zI1VgHs#dGXs*?1>AqknLDM4A1Wxx<18uMaY175VYr6EHj61qX``kufwV%r~y(<1Y< z5ke(stM#HLO^h(9h64#DArGkzbVwT)jD+R7afe8>Oe@rjBZft7EMqB~ZNukOTdB0s zQM_rCdDM(;PIQzT3#c?eBYz|$bkiuaxVGh36c5m8Y8Ek_!P}FAq96NF(VvHews;m5 zv0IqOAeYR7(waLDluO#s!0HYuj{Pv_`{h>d^tXHyWR#SJM|ZfM<5#1{c;L+mG=pQB z7I`88m;wsS$+88JrJ=_m`+yB-mZheHV>}aVGJH;kmXfj*Wfs_X+``y`P={CrKdfN3 zaBc+;Q7Q0->ejMZtIvyK>=D|RNsG+Yr0Y5sLWmLtQXtDR0j8o7fQ^&}4Ba+tRdrADY8_M2cZE4yWyQ`(;1O`VQk<5e2^57E{k$ z#k{`KB5Drid8(F28iR%m*(D+VY{~~0kWY)B_FP7>EDAhdth)W}taUL5bWKyV=6Jtb zqvd?YWvoRFM_Bmv8Fk6vYzgmVyh5#BH)1(A*6cOg>2UL_>ptHgP`n^dUZ*op3~f) z+65`ZzA)W><|WOcp*tf7W?E^xApDQ^7S6aub;Ik6^GbmdYL#}8gyu?OC{@0su9 zSB7hyWY^SYbmoJVuPwRU^AQ|AaB$`CCx5;+S(%K3P49iVxh|d2E@u=Gnh5@9g+-#r_Y!dE`prXy+dj!e{3$9PK^7_xWX? z3w!hHwrv?+weRB>g#Py)zUvF~?KjSJ9yzk~r*AJE`7>WSaCW?F+luaAC(fEF_I@x-n#U;4`Y{_CrMEt$BIy>#u^hU5IW+_!0K=G`ZD G?)e8~62-Fs literal 0 HcmV?d00001 diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/in.png b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/in.png new file mode 100644 index 0000000000000000000000000000000000000000..11dd25763a6cdf5bfab67cc72b0842e99d7cd015 GIT binary patch literal 654 zcmV;90&)F`P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D02y>eSaefwW^{L9 za%BK;VQFr3E^cLXAT%y8E;2FkAZe8V00I6D?`1xpOTXWj>2#{= zWHQl*mEd$bNwr#)&(BZUZnv7STCEiH_4OsQ+3YuQBIEH`lhf(6bUGbXZN%eoC4jlz zZcC%lkhixtjbgE=k;~;YiO6I!^8WrV^?F@PGNRF_5^Odbsnu%o`!oKEL?WS&pjZiF zv6x&g7nKb&Aj+Ve#bP1r^;(w8rS7?-ZU`!siW+O+^znF95OM)suUESpB!C%>MtX+= zUZ+GQK*r&4P=Z3Cpdj|N(cy52)9F;A!C+t$e0+RJKA-<@A}q8B6EO%7^69ZffC`J? z<>f_7#V?2rfL6<1Utblp+wD{V02C73bH^Dt%C$YfKun@tfUG&-jM{s>p6vm6OM&eH zg93oM0R0ur4Kq+Gm2{*HjKDOeESXG7Hk-AFhI*NkR4OGTT6+}G2_0o5(FN)nk4G{b z4mDb>f70!CRcfo%(u8ukta}ns%ill=FbFV-xJ^0Cdb8P70@}vjB4UvEW(d_)nCJ$6 oKuB5asgc*LPFP(5Lzt#1KQhxE;Kkc7J^%m!07*qoM6N<$f?jVORR910 literal 0 HcmV?d00001 diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/out.png b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/block/relay/out.png new file mode 100644 index 0000000000000000000000000000000000000000..f0fdad1d7ae215e5d0382822309b4c0e1fbb7416 GIT binary patch literal 673 zcmV;S0$%-zP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D02y>eSaefwW^{L9 za%BK;VQFr3E^cLXAT%y8E;2FkAZe8V00I$7L_t(IPfb%v%Yk7O^@muS$4n6+WQxpl z#tbRRLRl!1l!aI*l7;-g`+eusE9&$-@6$c!o;y(4Y&Nmm?P4?t#HKVF4U+wSzZ8o_x>mW}ZVEuTP$)<{yWQk`KFjm@l+wE37 z9uJeiF$ItTfNdy)h%!)4r_+&szc1Zxm-plG$hsi_G8(H=YK2HN8kN`UCG+|GI}H#J zQ?J+Ma5&HbY6ph`P{M~I0;|Y~F{;&S(P%Ujs#dGAUay%|iDwgkACL(SU>`G91mFS! zaPS)sVHE-uawHOA)5ha59UuS>0nB~3+wn~i`IZ2nNf_7r{boaZy&m6Cd%0ZZx!G*k z4>TK`uRy!qWXQ0fGb1cZ1zF8O?(M7YJ@fC6YxsZ=5n-9}jo zSpnWah7cAhm&600000NkvXX Hu0mjfVL%S7 literal 0 HcmV?d00001 diff --git a/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/icons.png b/refinedstorage2-platform-common/src/main/resources/assets/refinedstorage2/textures/icons.png index 340761a2dea262046fa2e731eca94546562132b2..2a5d67b2e6503b6a5aa285e147f8728595cc36b4 100644 GIT binary patch literal 5035 zcmZ`-c{mha_rEhtgp3fflPq6C8?sIzDqFH<8Ieknr7U3>60%hG$}(Qcp0PEO%uHXh zR1DdZeVZ^C%ZwR}-@JdkfBx?CoO{pn+~v8?=brO9=bq;_R%S*nHjote`wM1?u83(pw0#y|V=VpqB6osZb-V~5^0`;fI!aJAIGIT!a{7KLR< z+-tjCe|YqpL&(JxuQ7>nsRZY|D~wlpJx#&Z_W8PtcKH>$lkm95lX!v)eR9pQ)N1g8 zl8|hX>x+#Ml3a;}dv^t^V6ka?x4yYq)gR9&*~W#2hR#=Qx5VJSY$mz{=`RAcC$HvOy IQ8PL>ukY^u=eLPg}`Y zsbpX}9p^(ObH@qmV>xpX@B`yHB&%Qd@_8SNv1sy!LR*Ur@njmxMVbvChO~Gl-^#nz zNyjLj712Ljjl(8^t~KnoAzI#^leMJ58lYXM-f5jYIM0|RFmRpP2i+>HJ<|TWD%9HU zcId!fiaG66+FrVOiT?rK96xajY2pYgR*N#kXzLDP!}*zh!Psl#jv7$QnOj3Xya>jE z(L^@#Aayc5f<8{mzuS|Smg64Yr81<%`n72?Je#XXV3}?kyl6}vUURfC$yNBLeYu+| zfD*Sn<^l~Ee!`0|x$Wm?$zp08{PeMwmk(O~bKwbd%csA_y^a2nqw?>jvUG-qNV2bP zezwTd3i;dh6wfd2oXibr{_B|{#Qsw2lcde87Z+V*P+Mt{D}B$!^xRRma#sz0&?fMQ zr^K=8HC>B~E+9GKgds{WaR9nA&849W+>(eb(NV~{pR;_3xiH7%Z}Pn3vFoXhm`N%% zkb*K+BqXsdvFFqkllzd!rH-C1E}5vu%m}K!fBtY3t90&b8VVjYIfHtUyDdMJ{soT` zC<)6YVN>TEjkNb!Q_pZW!8IB6oFM+(wZ+BUJ@qltyzKw1>P$?6+PHygB%xrK(j6=zA@MOHS_%fPpO*ae88nHaP;|PTrwL|k>RI`k*~tca&vQgYR$~dg6ON`1;Xf~62Bs$rj{hn-sgW>%w9@g z_+}8b=VWsKCcul<#C-;e*#e~KPOKY2pkg&xc#)$lX)zql(z!uP5SZ;s_(|Wcd@Y9$ z{T6rLZRB=Q&t`LbaYQ@RMqA!@<tm4CfNxWNg4xg%H=H(hj8%zW%U-*3V z3(O{z?|68G--f};@tNgQBGrn|3f1r{D`4iqyg*@TTZ?d!u5mO zVX~ey9)8K{*98SRIAkmAyo$LCNut|c1U*te(w4dLK-9;bXxYMI{&~tIZE~F-!enT zK3;@CZO0?Hfgx@LYZUUOxH)t!{9AI$dmvj@S1*b)j$Q6`oMJPgW@m&sgeaK%)v$z6 zK8JNVDeaVWF0;NKoQUj1RXo!L(4@C3uqAmDkvd+!peD4}1x5ms_4Vs|r zAXWyNSjAs_l98a&7C;{L&A!gb{NV()X4h>pTq-SowggC%*rh_ z^s*>Xcu{=voXE8BE;@2{a2hcl3?+*ULkjK43<0tbS%wE#jpp4y^&lgG~Ld3X2pr+vN3yN)K2C>j4HRwRrhga zKB13?z7eeI458>Ifp~S&CiYpFq%I^TF7-3eOct>58-O9=|p*{)HCjj zU=5`|KyGG`v=rz`I4JK(*kd)R^<3qZE&MEk7++qkfN2iVjlBQ4>&HK7Uy$6()vJn! z#nl6!8+vPsj34ibhvgU@q!Jjm7=RP~@3^wqQZh$jh}ko*p<;FY zY%9{Xne$=YNr`^GfxAlq9)=h*4J(91_#m|ARx_gHT2+^?){m`L zh%U!zMb%T_Mvw?$%aTSc@vd;o=+x?IFln-$sW60C?cefs;6Y>rlP#mqj=QhyJ-YB= z;Ww2m_@IcN>&45LC>b7d>U*d_y$@2@(=r0nrtOEh!S;ZDXm4pU+A|>EQA+GgJM^Bp z@4I-7FG}$otz4}!25D$?^Vk2z7NdgPuo=|M37(sPY{C(L(h1_BZ=k9F-Vyq?y5vS< zj=}3FN+k7?F4qtrnKtXc3Cb&I&pDaDKMGC|PEKL$+XN zgnHB-2NW}|te)-nUkL+)S9#I+M6(oylopgMj2*~aKee7bj1tsoqd^8-RDgFS?QvFI zZ6o~M?Q$@1YScS7t~z4f)3p|kmIra(zL3oErXO?tji$diC{FC<5zb>U1D}66T5qjz zswr0fxR2M(X}c>c(2IW$^$>rGRU-JymEBO&Us8)@wooV><>mUEy+XZ8jJItJ=~z%B zx+frO0!=XFgm^gUiV*LLtKT@f{)8`G=APNShb*RzH?2Xzu($fFlGrB1qtlbb6_Cvd z{k6R!AWI9oH}l;3f}#8!PN?8z2oThIq4E`|J=y$op%QPv12k`#C;t^=&@w$h7)KGq0yCHB` zfW(^_u^h$ekS*^g0igR+p17+IL|AlIZNj0nYTF|`5(L7Gcx|$#6pVT`KI9!bcT%?t zzGeMj7(za5y}_|>H+uM!liHaZ7{sy3Ffd+gcw~h0IX|EAyfY9zM~|8IPy?ERCA={f zjem>QKCsC-^W$mBk)bX}yZ{006rnvj(=h^Vj_PJlwy1yFgx16+8$e=QzF?J%P%LS^5bT4OPnj=u11^OvgbuLklot{&9*MUQ&HX&sC)`z+-FTkALNup zSDQ}F%vUz4;8sG?-uisaeKAvi#VNPLSxw|kxY~joaisjt0g3h9f8l^hk6zt#i(a2d zU8yJRTx*I_4y0}j?(MJr$(c2yr@VY{{)9~m=bWJDJI{y+J&j!yyLTik8)5gNHWYF) zlo-_Fh|%52rs&VZMwYC_XpQzkcb-2A3}aEAn^3W43WXAhLb;ikMD4H$$%&mzCe!Dr zO>}>>);?t!!)QoMbk%#3E`y0ax%=nYwyTL%#=+LwvySPjh(e_o{`>h zLeTv8@BHiEvs6cEw2&yu%I{y3(qBSPs1{uR6cTc3Y+}MaT#}tq1d}8x;KZ%4mHpEp z$b+Ay^KV-xx3bYiy8B6{g<+GwtcWAs{^>F*Bcr3IR|kKrBDb|$j@4xDEF!y-z8M=> z%{!w@Ol9qg()Y}t=@v|mj&@b=li=A8Z!EDw4p{qH9si77rs6-Mz-ggZb7nk4!^7Uu z(MCC&*xS3iyG`Y@YxRV^%4>w>Ks`M@)j;nt<%!`X+o@`yv^KLO8l8S^x7TpH36ssn zR=i_yJf{{QtnIhq!f=>tYBAWUuDhyFJw2;h_9M=;z)dA=wIkZ|{oP5ktrD$SMp_;F z(`ym&2(^Yqc3_pF-SVne@cYVuLz-l%Pj&mr<)LTysXUNPVY790jZy0pM`kJf*-4$Y zkQ%ASH-@gQNx%^s`u=NWIzQ@M8{~U`|3;T&#h6DH+E#XH$k#cknKWd_4ZbHHk=F0W zirEn=$He-$Mw%ZjTCI2d85_%B=baaHbUIBHT-g30)bNRpYm#K!Tus4V3WaOwW7?kL zHCUngs2_bo@(^ehczjtFMMBb?0JAtK*khkwH#cnx2beUtn!H(^@Ef1~TL-MfJ zo0bm%8NM70d8>bKR3DlL1I&{f=f>U8*r+5g&&9-vv|+ z@TQ0+uyq|yAn4!%bfmab94V22jdFfsZE?4=gaA1P=g9fbSOI+^f0~HaJ1>I>w5-uu zicS2PEkABr zt!`|z12`P63a6jjUDPOv=5N5e(zlm~=RY(~*j^d!+L$6)Q|`*&gxGXp)0@LsNF%9F zA3tUdAB(97^GFN{4Si~~Fg^Vr_NH|8Y%b(|$j`+`|1DE2ZZfVGcEc{(({EWo;;T~U zu)hX3rr0%u`cbvY->t*PVn5FB;PxJuFv6Tz-N0s@c?#7qyKM1@*=d*%V85zW*CFR@Sz_%TXSE! z2E;Iz&qDhILHqpHxx$HQ?R={omIli=;+RL^$NvOaOCY%Wth?AOe|j+Gkba96;e#p! z4u_kX%uP)p{A^5q=fe?W?jopjg==BHJls?2;Sg?5;%wjZwTqGez7~-*ck+R7_r++x zu?WKS7_k|6Fa=f!ztVA>vk;}q*1GP5^P|Gti6d&q(1r?cDDULKURE`qorTueanurR zBDgiik`yD?hR_qo!0x3JExjO*E3ZRpEIs=7OZv-)bz(n!_>dRKjc^)*75<%YAsjr` z&0_ySnyfU77L;$t3d&afst4iFN=$AKUzPRYJI!45R4xxvm`aVme*`-PaB#@sqEpIL zFR&V|?y>K;Jy6zab%=wZezM*6HbST6rt}}t)|lxN9~mHtC9`oBBD<_DH?oK56~)Yuy+Tt-ws{McHA0NN zvP3bqFxIk+CC1p7VZP~l|M|`zXSuHDI?uVD<-YF|Z)I^wfbR$&06+k1g0Thw!r4Lq z4}!Be-F|zMv%rHcU~PFg<35jD8~{i^EXL6GZpPxMOPr*=WFvFj&FDZ=<#TbLaIX~a zLob_chhiO76ik|5SxG^aqiZipz1IAEfn2ZD>)hrTzFcHw*PANit)Z}AJ?G3*fhEP1 zQ%n#1{cxd@*3#omnl#eZ@|fw&R;PbsZ%2@SkJSa;yw$$9H}h><5lXJGh4}dR7z^5S zX77+*HX00RYH2-stP?czFfOjJq(nkW3JdBPilj(G4l;i@?9yIHD@s~B&B;?m3kO}fcb}c)i)G~jV4NKV@7dh`Ob%}0U zIvDzTY9WYzQKHWp#uJU5_{P91vF|NpUJw&hin}{d>tB%F_HkO`dH<3neveQa!DPtb z_hSRooDUB)c&;A*Qm@&VDdqmI2!Z4yHL7IqzMJ#NSe*)KIBl@suPCFk*PqWCvy8A6 z#o=Yy=_&|i8>@HmXpk3mtx?-2L=3IsB2E}A~A=(6`RL&raaF;d}^I&!;1 z$?-I3P_U}}I)t=L+57j>Zz7oLlXmPXy?YyN>k9*kqCUo< z4$N-3M}45!r9s*BU3HA14WoXyxRybU8w?H|wqtEE``{D#DMuQI?fo?Y4MhyXQ)IH} zR2VfN)UkK2?=^y`reO`MS~R*hHLt_y#KmG8*Nl#``dX)^l~zSrmCr)Fng>XrNyz?c zKag?xR?p9c*tu{r_c9%taW3$JMV9V0Ph~*lFCV1QUbfeyFFb$#{5E4BNXuvlK7?3h z<>uyEUrZ}I2B=qJ1trUrYbq*Ecywi*fY?4-hg;>Er7B;0R&#&5EN&!2hva$o$jQ`V z)qxdr#mUu!EYA;pa5A1*bM#B46MOG^+VTAcqY#uFAxC8~xxUSvwfkAeKm(KyIYHZY zUJ0Gxz5K>TMPK5*r?d?WE%r?VI`0x3Q${%u3twd;{V*zML@K%8Lqvq-SNT zAK7$AGaGkLhL>EVRs->K3-7KGg==>0GgsUrj*)$HGkDS8ag+$%={!jr4wxL^ufU8~WgpzRv?F z4{?AT^;pWF^NDL?vgG;OUnswu6UC<2=6dIN(NYb#;M4c+1FMw4b!I5cct$uluoE)z zi`gpm@l?q2grV@)Ye=^tQ?xte!lPM#FMRbL`U!v4Lzq90*9 z=5a$AaLR6dPp$Ld99P@$kXBNJFA_d>S9hlPK>1%N2x|1-#F6UBR&%+7hm%_4=|x61 z16-89ZyhE0te?Z_`-%sjf3rY8&I`WY9tKV!Tau41nilX5W_&u_#X^_$KtJc~c5Q}N z)YU2NZY&n~s#@8}N(m5V6HSjm3Pj<=kN)HJrX?wM)AC!y&|Cy2JqD^Sf(*B_6CjX* z_FGaC0JLa0;1~Z>0wO@wHHC=2?h=9XiEvPi80^1EiI;!1#>QVWC^(h$^Jj4eTj-3zy8Y?PtoKAmsko3D#nn|5GxY=$M+&Xo~n4I?!0<*e2XBL?P zCoH{nGe&%mH^nae-rg*w|^l5KwN)>8tyP6`VTRWptD zcPSmMTvmA|(7Vi_Tkbbwe9~zOoMYi611NH7% ztGs%R{y{G!#qa$mICB3RML#NyDrP4ONkq7H>#e*TX^QDi5Em(cTb1t|8y`^i$Lpkb z**@>~%#kC-KWv?pGeB4+I(UP;>0u=6Cxi6$LB4*Nf5`svRVRt%p7sTNl00nhPWO=q zUPD{!pIeDv-FoichUQcAj}YQ(r*0gX$cvO-UTY;*uH%66j5okG9cK54Rm0>LZTuxL zdDEYKhMt;>RPs{SW9!q*fE@9a)@<6-B&~h-XO=gHmpyGXv0LZf*VQeCog!;+kjVT7 zWQ|-zX>kn;r|@)Z*?MVk5cf|w*2EJdp#gLbeVT*v9N1#AHd4V$)qHESoHS?TF}b&# z7rx@<-u}CnJHTj8B1)AcC{C7U9YWq4ykR}kpgxgn8B0Ij2XNc_KSh?mKv`&5?d0<$}ePRHhT z$X{*4xPsa9PVKZT7$Le4ttj%Kl9yb#08?l~HTou%o=jciF%$vq>RMt19aYt%LA=s_ zqU5=V2(Q-MOfhtjhzG1Cs{f|Cr6f@(7^AzKs5#@V$F8Y7lWambQWgC9nQ&t;3@YG5 zk;*2b(d!RW>8HYe-KA18qTCz*dlI;JnvYM~RI2JATd&B>!evRPM7JXnwy641J^4U5 zw>0>^J(i_+QESKq%G1h<-CGJ{*L-!$;w1kQN;T8sKq|LY*5{D%%&VAk54mEjlZ(cI=Qz5^SKKbRdI`f1Uo!A+Ij#M$L*IQ z{iA~fCv2Q5*Q@eFa&|YJs~E=B0pp25_%2^q+~#EBixb4071CFX2^6i~a|B{0$(OE$-M>C>H&IgFFs5p#hSgyN&`fZfBB+)gg8}fk^S$$90wsH%Clf zoI|#`2U&sdCSfyOW^i92!Lt~S1aNGZ=$QwoFx z&79z-y(tR>OfJI$iXga`_K3iIM!b9k;@kmyn-r+!Dh$`A3Z&Hm&9_Ui(IzKAmVbhP zPMh=O-@&Sa{?fxd7y&RVPV%bHqfdlN&c0Afg)2_#0@DDtY^)DMPrV&z20@*wa4H$q zZ?j{!c|6tiwp=1M-qGr_tNnoa#+-TAaxC0$X)x4Bw9lCYN!a=#CS`};UhK-OPv6yFy>@3{zxkTdul-Ac1&SqEsf%WG zkuJxfrN(04Sfq^)dZ4hd@NM~kqN3ud`$cU1%`m$82_64@j#(|oJbQHAqlw+L%e-A} zL`+=b^9?JU+g=Mt`1wFlT;=`k?FkM}PKSh3K9;b|F&I%XF%PWteM`39T%G(uJjXa)XCeB0?Q4@PTe?{FY6A8;kSsalc8e^Ayp%xtB*^ao!ctpL>Rn)HWRONEA@sbV@`u; zH8?9~31!}}iG>c!5zA}?x#fAues=cu2O0BTtsZr62B0#;hD{5VEZtA5Zk=2TFX8Qc zwgVHE65L3aY~bmzrQ1NE%uDWWI;J#4uZ-#7_gN#=J;lNXnjZzoUkS(mIs;EkOe`xc z{nw3=Io8q=W9q#%ycw-xj9ZxIxS_Y_I?F~BcKbF`VBH&G%-g5UVw8sl2Tj6t>lTZX zIyQ2HqC2J~JAz%wxn(r&UrEqP6M#;P{`|oB*26<1t3Q*TYTFaM&rsjz)Ko`oTBa*J zwJ&bt$h*I;+C+Z^=v~|McFktt*R@ULii}4qbiozVt77addc0?#%g`7B>l^^rPkz@k zAtsz=@kYi$K(+#rtl_Ka-x*F5{A|vD5}}QH0ytk8vxdg_gYp>6RGLSYurQN@*j`ay zml?mXpJUf2JWlH;mn2MBTDP0(0Mj!C5ZhjPd*MTrLV z4+tshtrU2&*zeGgm2x_ZgDRIrcnD#K@4!R_Xytd{o@RiSyA}v`MsaM%9tL>%zchi_ zu#lN0!C*6gdoDzB(*IWs@5~~b9T&VNU_0`qh~&Pjmo_D-25CmbNeQoHI3WUilrJM1 z1=dl*;Yks-3B+HWLE} zQw4rCOO%pJP*B!SaSj{ ztx!Am9galc#Ye6wLbvNnR-OPwzJIx8Al3EtxE-#}jPtTGAHHknE-g06juJS4cz@iU z^wq7Hyx;)gSGbURRhV^co_6g1t)plp9QQ*~UqyI|OG}-fxbeaayzVw}?}x7-C(t1% z3&cx{H)C#UDa^Y^x6}94u|1{6?Xb7@GbWA8f#hN#7#YXu*(mAdmdQZLY%cWohcnOz ze$cCUaj>qI#g8!uv)LCuK;H3!J+%cyp9G6zH|4AgY-OO+mtLhoW)AWzS->d;|0nDINMh@Q=)(ecneNRC%0kkPe?vWusNGS()?XP?ethtWzLA8!7*#6;PK}XP zceaHSYTC{bwklnB?&T@&OpVs9w(z3D5iO#iUt#2c6^fAfoXe`@0&nA40_m|tQme%( z4<{nuj6l1421ppITc2#5EQK3R3@NLM6klnBo-UFFj|E!;r>qqDqe$7R&AkvQ&EkqyR$J-fdXJLU~RU$ ct=NdoE&DKG>&1{G?GL45jV&<67hEI%557_HjQ{`u diff --git a/refinedstorage2-platform-common/src/main/resources/data/refinedstorage2/advancements/conditional_connecting.json b/refinedstorage2-platform-common/src/main/resources/data/refinedstorage2/advancements/conditional_connecting.json new file mode 100644 index 000000000..28a80e541 --- /dev/null +++ b/refinedstorage2-platform-common/src/main/resources/data/refinedstorage2/advancements/conditional_connecting.json @@ -0,0 +1,26 @@ +{ + "display": { + "icon": { + "item": "refinedstorage2:relay" + }, + "title": { + "translate": "advancements.refinedstorage2.conditional_connecting" + }, + "description": { + "translate": "advancements.refinedstorage2.conditional_connecting.description" + } + }, + "parent": "refinedstorage2:connecting", + "criteria": { + "relay_in_inventory": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { + "tag": "refinedstorage2:relays" + } + ] + } + } + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-common/src/main/resources/data/refinedstorage2/recipes/relay.json b/refinedstorage2-platform-common/src/main/resources/data/refinedstorage2/recipes/relay.json new file mode 100644 index 000000000..47503ccd9 --- /dev/null +++ b/refinedstorage2-platform-common/src/main/resources/data/refinedstorage2/recipes/relay.json @@ -0,0 +1,20 @@ +{ + "type": "minecraft:crafting_shapeless", + "ingredients": [ + { + "item": "refinedstorage2:machine_casing" + }, + { + "item": "refinedstorage2:cable" + }, + { + "item": "refinedstorage2:advanced_processor" + }, + { + "item": "minecraft:redstone_torch" + } + ], + "result": { + "item": "refinedstorage2:relay" + } +} \ No newline at end of file diff --git a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/ClientModInitializerImpl.java b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/ClientModInitializerImpl.java index 7e8ead76a..44e702874 100644 --- a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/ClientModInitializerImpl.java +++ b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/ClientModInitializerImpl.java @@ -120,6 +120,7 @@ private void setRenderLayers() { setCutout(Blocks.INSTANCE.getPortableGrid()); setCutout(Blocks.INSTANCE.getCreativePortableGrid()); setCutout(Blocks.INSTANCE.getSecurityManager()); + setCutout(Blocks.INSTANCE.getRelay()); } private void setCutout(final BlockColorMap blockMap) { @@ -168,6 +169,9 @@ private void registerEmissiveModels() { Blocks.INSTANCE.getSecurityManager().forEach( (color, id, block) -> registerEmissiveSecurityManagerModels(color, id) ); + Blocks.INSTANCE.getRelay().forEach( + (color, id, block) -> registerEmissiveRelayModels(color, id) + ); } private void registerEmissiveControllerModels(final DyeColor color) { @@ -298,6 +302,21 @@ private void registerEmissiveSecurityManagerModels(final DyeColor color, final R ); } + private void registerEmissiveRelayModels(final DyeColor color, final ResourceLocation id) { + // Block + EmissiveModelRegistry.INSTANCE.register( + createIdentifier("block/relay/" + color.getName()), + createIdentifier("block/relay/cutouts/in/" + color.getName()), + createIdentifier("block/relay/cutouts/out/" + color.getName()) + ); + // Item + EmissiveModelRegistry.INSTANCE.register( + id, + createIdentifier("block/relay/cutouts/in/" + color.getName()), + createIdentifier("block/relay/cutouts/out/" + color.getName()) + ); + } + private void registerPackets() { ClientPlayNetworking.registerGlobalReceiver(PacketIds.STORAGE_INFO_RESPONSE, new StorageInfoResponsePacket()); ClientPlayNetworking.registerGlobalReceiver(PacketIds.GRID_UPDATE, new GridUpdatePacket()); diff --git a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/ConfigImpl.java b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/ConfigImpl.java index ce44228b7..8f788287e 100644 --- a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/ConfigImpl.java +++ b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/ConfigImpl.java @@ -102,12 +102,15 @@ public class ConfigImpl implements ConfigData, com.refinedmods.refinedstorage2.p private SimpleEnergyUsageEntryImpl fallbackSecurityCard = new SimpleEnergyUsageEntryImpl( DefaultEnergyUsage.FALLBACK_SECURITY_CARD ); - + @ConfigEntry.Gui.CollapsibleObject private SimpleEnergyUsageEntryImpl securityManager = new SimpleEnergyUsageEntryImpl( DefaultEnergyUsage.SECURITY_MANAGER ); + @ConfigEntry.Gui.CollapsibleObject + private RelayEntryImpl relay = new RelayEntryImpl(); + public static ConfigImpl get() { return AutoConfig.getConfigHolder(ConfigImpl.class).getConfig(); } @@ -253,6 +256,11 @@ public SimpleEnergyUsageEntry getSecurityManager() { return securityManager; } + @Override + public RelayEntry getRelay() { + return relay; + } + private static class GridEntryImpl implements GridEntry { private boolean largeFont = false; @@ -644,4 +652,20 @@ public long getExtractEnergyUsage() { return extractEnergyUsage; } } + + private static class RelayEntryImpl implements RelayEntry { + private long inputNetworkEnergyUsage = DefaultEnergyUsage.RELAY_INPUT_NETWORK; + + private long outputNetworkEnergyUsage = DefaultEnergyUsage.RELAY_OUTPUT_NETWORK; + + @Override + public long getInputNetworkEnergyUsage() { + return inputNetworkEnergyUsage; + } + + @Override + public long getOutputNetworkEnergyUsage() { + return outputNetworkEnergyUsage; + } + } } diff --git a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/recipemod/rei/RefinedStorageREIClientPlugin.java b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/recipemod/rei/RefinedStorageREIClientPlugin.java index 3369fe363..a61e0be9f 100644 --- a/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/recipemod/rei/RefinedStorageREIClientPlugin.java +++ b/refinedstorage2-platform-fabric/src/main/java/com/refinedmods/refinedstorage2/platform/fabric/recipemod/rei/RefinedStorageREIClientPlugin.java @@ -101,6 +101,12 @@ public void registerCollapsibleEntries(final CollapsibleEntryRegistry registry) ContentIds.SECURITY_MANAGER, Tags.SECURITY_MANAGERS ); + groupItems( + registry, + Blocks.INSTANCE.getRelay(), + ContentIds.RELAY, + Tags.RELAYS + ); } @Override diff --git a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/ConfigImpl.java b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/ConfigImpl.java index 549efa30c..2406e4068 100644 --- a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/ConfigImpl.java +++ b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/ConfigImpl.java @@ -46,6 +46,7 @@ public class ConfigImpl implements Config { private final SimpleEnergyUsageEntry securityCard; private final SimpleEnergyUsageEntry fallbackSecurityCard; private final SimpleEnergyUsageEntry securityManager; + private final RelayEntry relay; public ConfigImpl() { screenSize = builder @@ -109,6 +110,7 @@ public ConfigImpl() { "Security Manager", DefaultEnergyUsage.SECURITY_MANAGER ); + relay = new RelayEntryImpl(); spec = builder.build(); } @@ -256,6 +258,11 @@ public SimpleEnergyUsageEntry getSecurityManager() { return securityManager; } + @Override + public RelayEntry getRelay() { + return relay; + } + private class SimpleEnergyUsageEntryImpl implements SimpleEnergyUsageEntry { private final ModConfigSpec.LongValue energyUsage; @@ -807,4 +814,29 @@ public long getInsertEnergyUsage() { return insertEnergyUsage.get(); } } + + private class RelayEntryImpl implements RelayEntry { + private final ModConfigSpec.LongValue inputNetworkEnergyUsage; + private final ModConfigSpec.LongValue outputNetworkEnergyUsage; + + RelayEntryImpl() { + builder.push("relay"); + inputNetworkEnergyUsage = builder.comment("The energy used by the Relay in the input network") + .defineInRange(ENERGY_CAPACITY, DefaultEnergyUsage.RELAY_INPUT_NETWORK, 8, Long.MAX_VALUE); + outputNetworkEnergyUsage = builder.comment( + "The energy used by the Relay in the output network (if not in pass through mode)" + ).defineInRange(ENERGY_CAPACITY, DefaultEnergyUsage.RELAY_OUTPUT_NETWORK, 8, Long.MAX_VALUE); + builder.pop(); + } + + @Override + public long getInputNetworkEnergyUsage() { + return inputNetworkEnergyUsage.get(); + } + + @Override + public long getOutputNetworkEnergyUsage() { + return outputNetworkEnergyUsage.get(); + } + } } diff --git a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/datagen/BlockModelProviderImpl.java b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/datagen/BlockModelProviderImpl.java index bf5080b64..17bb5bff8 100644 --- a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/datagen/BlockModelProviderImpl.java +++ b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/datagen/BlockModelProviderImpl.java @@ -25,10 +25,20 @@ public class BlockModelProviderImpl extends BlockModelProvider { private static final ResourceLocation ALL_CUTOUT = createIdentifier("block/all_cutout"); private static final ResourceLocation NORTH_CUTOUT = createIdentifier("block/north_cutout"); + private static final ResourceLocation BOTTOM_TEXTURE = createIdentifier("block/bottom"); + + private static final String CUTOUT_NORTH = "cutout_north"; + private static final String CUTOUT_EAST = "cutout_east"; + private static final String CUTOUT_SOUTH = "cutout_south"; + private static final String CUTOUT_WEST = "cutout_west"; + private static final String CUTOUT_UP = "cutout_up"; + private static final String CUTOUT_DOWN = "cutout_down"; private static final String NORTH = "north"; + private static final String EAST = "east"; private static final String SOUTH = "south"; - - private static final ResourceLocation BOTTOM_TEXTURE = createIdentifier("block/bottom"); + private static final String WEST = "west"; + private static final String UP = "up"; + private static final String DOWN = "down"; public BlockModelProviderImpl(final PackOutput output, final ExistingFileHelper existingFileHelper) { super(output, MOD_ID, existingFileHelper); @@ -45,6 +55,7 @@ protected void registerModels() { registerNetworkReceivers(); registerNetworkTransmitters(); registerSecurityManagers(); + registerRelays(); } private void registerCables() { @@ -94,11 +105,11 @@ private void registerGrids(final String name, withExistingParent(BLOCK_PREFIX + "/" + name + "/" + variantName, baseModel) .texture(PARTICLE_TEXTURE, right) .texture(NORTH, front) - .texture("east", right) + .texture(EAST, right) .texture(SOUTH, back) - .texture("west", left) - .texture("up", top) - .texture("down", BOTTOM_TEXTURE) + .texture(WEST, left) + .texture(UP, top) + .texture(DOWN, BOTTOM_TEXTURE) .texture(CUTOUT_TEXTURE, cutout); } @@ -189,17 +200,17 @@ private void registerSecurityManagers() { withExistingParent("block/security_manager/" + color.getName(), EMISSIVE_CUTOUT) .texture(PARTICLE_TEXTURE, back) .texture(NORTH, front) - .texture("east", right) + .texture(EAST, right) .texture(SOUTH, back) - .texture("west", left) - .texture("up", top) - .texture("down", BOTTOM_TEXTURE) - .texture("cutout_north", cutoutFront) - .texture("cutout_east", cutoutRight) - .texture("cutout_south", cutoutBack) - .texture("cutout_west", cutoutLeft) - .texture("cutout_up", cutoutTop) - .texture("cutout_down", BOTTOM_TEXTURE); + .texture(WEST, left) + .texture(UP, top) + .texture(DOWN, BOTTOM_TEXTURE) + .texture(CUTOUT_NORTH, cutoutFront) + .texture(CUTOUT_EAST, cutoutRight) + .texture(CUTOUT_SOUTH, cutoutBack) + .texture(CUTOUT_WEST, cutoutLeft) + .texture(CUTOUT_UP, cutoutTop) + .texture(CUTOUT_DOWN, BOTTOM_TEXTURE); }); final ResourceLocation cutoutBack = createIdentifier("block/security_manager/cutouts/back/inactive"); final ResourceLocation cutoutFront = createIdentifier("block/security_manager/cutouts/front/inactive"); @@ -209,16 +220,55 @@ private void registerSecurityManagers() { withExistingParent("block/security_manager/inactive", CUTOUT) .texture(PARTICLE_TEXTURE, back) .texture(NORTH, front) - .texture("east", right) + .texture(EAST, right) .texture(SOUTH, back) - .texture("west", left) - .texture("up", top) - .texture("down", BOTTOM_TEXTURE) - .texture("cutout_north", cutoutFront) - .texture("cutout_east", cutoutRight) - .texture("cutout_south", cutoutBack) - .texture("cutout_west", cutoutLeft) - .texture("cutout_up", cutoutTop) - .texture("cutout_down", BOTTOM_TEXTURE); + .texture(WEST, left) + .texture(UP, top) + .texture(DOWN, BOTTOM_TEXTURE) + .texture(CUTOUT_NORTH, cutoutFront) + .texture(CUTOUT_EAST, cutoutRight) + .texture(CUTOUT_SOUTH, cutoutBack) + .texture(CUTOUT_WEST, cutoutLeft) + .texture(CUTOUT_UP, cutoutTop) + .texture(CUTOUT_DOWN, BOTTOM_TEXTURE); + } + + private void registerRelays() { + final ResourceLocation in = createIdentifier("block/relay/in"); + final ResourceLocation out = createIdentifier("block/relay/out"); + Blocks.INSTANCE.getNetworkTransmitter().forEach((color, id, receiver) -> { + final ResourceLocation cutoutIn = createIdentifier("block/relay/cutouts/in/" + color.getName()); + final ResourceLocation cutoutOut = createIdentifier("block/relay/cutouts/out/" + color.getName()); + withExistingParent("block/relay/" + color.getName(), EMISSIVE_CUTOUT) + .texture(PARTICLE_TEXTURE, in) + .texture(NORTH, out) + .texture(EAST, in) + .texture(SOUTH, in) + .texture(WEST, in) + .texture(UP, in) + .texture(DOWN, in) + .texture(CUTOUT_NORTH, cutoutOut) + .texture(CUTOUT_EAST, cutoutIn) + .texture(CUTOUT_SOUTH, cutoutIn) + .texture(CUTOUT_WEST, cutoutIn) + .texture(CUTOUT_UP, cutoutIn) + .texture(CUTOUT_DOWN, cutoutIn); + }); + final ResourceLocation cutoutIn = createIdentifier("block/relay/cutouts/in/inactive"); + final ResourceLocation cutoutOut = createIdentifier("block/relay/cutouts/out/inactive"); + withExistingParent("block/relay/inactive", CUTOUT) + .texture(PARTICLE_TEXTURE, in) + .texture(NORTH, out) + .texture(EAST, in) + .texture(SOUTH, in) + .texture(WEST, in) + .texture(UP, in) + .texture(DOWN, in) + .texture(CUTOUT_NORTH, cutoutOut) + .texture(CUTOUT_EAST, cutoutIn) + .texture(CUTOUT_SOUTH, cutoutIn) + .texture(CUTOUT_WEST, cutoutIn) + .texture(CUTOUT_UP, cutoutIn) + .texture(CUTOUT_DOWN, cutoutIn); } } diff --git a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/datagen/BlockStateProviderImpl.java b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/datagen/BlockStateProviderImpl.java index e60050740..668da5c78 100644 --- a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/datagen/BlockStateProviderImpl.java +++ b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/datagen/BlockStateProviderImpl.java @@ -9,11 +9,12 @@ import com.refinedmods.refinedstorage2.platform.common.grid.AbstractGridBlock; import com.refinedmods.refinedstorage2.platform.common.networking.NetworkReceiverBlock; import com.refinedmods.refinedstorage2.platform.common.networking.NetworkTransmitterBlock; +import com.refinedmods.refinedstorage2.platform.common.networking.RelayBlock; import com.refinedmods.refinedstorage2.platform.common.security.SecurityManagerBlock; import com.refinedmods.refinedstorage2.platform.common.support.CableBlockSupport; import com.refinedmods.refinedstorage2.platform.common.support.direction.BiDirection; import com.refinedmods.refinedstorage2.platform.common.support.direction.BiDirectionType; -import com.refinedmods.refinedstorage2.platform.common.support.direction.DirectionTypeImpl; +import com.refinedmods.refinedstorage2.platform.common.support.direction.DefaultDirectionType; import com.refinedmods.refinedstorage2.platform.common.support.direction.HorizontalDirectionType; import com.refinedmods.refinedstorage2.platform.common.wirelesstransmitter.WirelessTransmitterBlock; @@ -71,6 +72,7 @@ protected void registerStatesAndModels() { registerNetworkReceivers(); registerNetworkTransmitters(); registerSecurityManagers(); + registerRelays(); } private void registerCables() { @@ -84,7 +86,8 @@ private void registerExporters() { PROPERTY_BY_DIRECTION.forEach((direction, property) -> { final var part = builder.part(); addDirectionalRotation(direction, part); - part.modelFile(exporterModel).addModel().condition(DirectionTypeImpl.INSTANCE.getProperty(), direction); + part.modelFile(exporterModel).addModel() + .condition(DefaultDirectionType.FACE_CLICKED.getProperty(), direction); }); }); } @@ -96,7 +99,8 @@ private void registerImporters() { PROPERTY_BY_DIRECTION.forEach((direction, property) -> { final var part = builder.part(); addDirectionalRotation(direction, part); - part.modelFile(importerModel).addModel().condition(DirectionTypeImpl.INSTANCE.getProperty(), direction); + part.modelFile(importerModel).addModel() + .condition(DefaultDirectionType.FACE_CLICKED.getProperty(), direction); }); }); } @@ -110,7 +114,7 @@ private void registerExternalStorages() { addDirectionalRotation(direction, part); part.modelFile(model) .addModel() - .condition(DirectionTypeImpl.INSTANCE.getProperty(), direction); + .condition(DefaultDirectionType.FACE_CLICKED.getProperty(), direction); }); }); } @@ -171,7 +175,7 @@ private void configureGridVariants(final DyeColor color, } else { model.modelFile(inactive); } - addRotation(model, blockState.getValue(BiDirectionType.INSTANCE.getProperty())); + addRotationFrontFacingNorth(model, blockState.getValue(BiDirectionType.INSTANCE.getProperty())); return model.build(); }); } @@ -227,7 +231,7 @@ private void registerWirelessTransmitters() { } else { model.modelFile(inactive); } - final Direction direction = blockState.getValue(DirectionTypeImpl.INSTANCE.getProperty()); + final Direction direction = blockState.getValue(DefaultDirectionType.FACE_CLICKED.getProperty()); addRotation(model, direction); return model.build(); }); @@ -244,12 +248,12 @@ private void registerConstructorDestructors(final BlockColorMap blockMap, addDirectionalRotation(direction, part); part.modelFile(activeModel) .addModel() - .condition(DirectionTypeImpl.INSTANCE.getProperty(), direction) + .condition(DefaultDirectionType.FACE_CLICKED.getProperty(), direction) .condition(AbstractConstructorDestructorBlock.ACTIVE, true) .end(); part.modelFile(inactiveModel) .addModel() - .condition(DirectionTypeImpl.INSTANCE.getProperty(), direction) + .condition(DefaultDirectionType.FACE_CLICKED.getProperty(), direction) .condition(AbstractConstructorDestructorBlock.ACTIVE, false) .end(); }); @@ -265,7 +269,7 @@ private ConfiguredModel[] registerDetector(final ModelFile unpowered, } else { model.modelFile(unpowered); } - final Direction direction = blockState.getValue(DirectionTypeImpl.INSTANCE.getProperty()); + final Direction direction = blockState.getValue(DefaultDirectionType.FACE_CLICKED.getProperty()); addRotation(model, direction); return model.build(); } @@ -319,7 +323,32 @@ private void registerSecurityManagers() { final Direction direction = HorizontalDirectionType.INSTANCE.extractDirection(blockState.getValue( HorizontalDirectionType.INSTANCE.getProperty() )); - addRotation(model, BiDirection.forHorizontal(direction)); + addRotationFrontFacingNorth(model, BiDirection.forHorizontal(direction)); + return model.build(); + }); + }); + } + + private void registerRelays() { + final ModelFile inactive = modelFile(createIdentifier("block/relay/inactive")); + Blocks.INSTANCE.getRelay().forEach((color, id, block) -> { + final ModelFile active = modelFile(createIdentifier("block/relay/" + color.getName())); + final var builder = getVariantBuilder(block.get()); + builder.forAllStates(blockState -> { + final ConfiguredModel.Builder model = ConfiguredModel.builder(); + if (Boolean.TRUE.equals(blockState.getValue(RelayBlock.ACTIVE))) { + model.modelFile(active); + } else { + model.modelFile(inactive); + } + final Direction direction = blockState.getValue(DefaultDirectionType.FACE_PLAYER.getProperty()); + final BiDirection biDirection; + if (direction.getAxis().isHorizontal()) { + biDirection = BiDirection.forHorizontal(direction); + } else { + biDirection = direction == Direction.UP ? BiDirection.UP_NORTH : BiDirection.DOWN_NORTH; + } + addRotationFrontFacingNorth(model, biDirection); return model.build(); }); }); @@ -337,7 +366,7 @@ private void addRotation(final ConfiguredModel.Builder model, final Direction model.rotationY(rotationY); } - private void addRotation(final ConfiguredModel.Builder model, final BiDirection direction) { + private void addRotationFrontFacingNorth(final ConfiguredModel.Builder model, final BiDirection direction) { final int x = (int) direction.getVec().x(); final int y = (int) direction.getVec().y(); final int z = (int) direction.getVec().z(); diff --git a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/datagen/ItemModelProviderImpl.java b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/datagen/ItemModelProviderImpl.java index 07fc36159..9e48971b1 100644 --- a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/datagen/ItemModelProviderImpl.java +++ b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/datagen/ItemModelProviderImpl.java @@ -47,6 +47,7 @@ protected void registerModels() { registerNetworkReceivers(); registerNetworkTransmitters(); registerSecurityManagers(); + registerRelays(); } private void registerCables() { @@ -186,6 +187,14 @@ private void registerSecurityManagers() { )); } + private void registerRelays() { + final var blocks = Blocks.INSTANCE.getRelay(); + blocks.forEach((color, id, block) -> withExistingParent( + id.getPath(), + createIdentifier("block/relay/" + color.getName()) + )); + } + private ModelFile modelFile(final ResourceLocation location) { return new ModelFile.ExistingModelFile(location, existingFileHelper); } diff --git a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/datagen/loot/BlockDropProvider.java b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/datagen/loot/BlockDropProvider.java index b0a25b484..f0d9df1ba 100644 --- a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/datagen/loot/BlockDropProvider.java +++ b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/datagen/loot/BlockDropProvider.java @@ -33,6 +33,7 @@ protected void generate() { Blocks.INSTANCE.getNetworkReceiver().forEach((color, id, block) -> dropSelf(block.get())); Blocks.INSTANCE.getNetworkTransmitter().forEach((color, id, block) -> dropSelf(block.get())); Blocks.INSTANCE.getSecurityManager().forEach((color, id, block) -> dropSelf(block.get())); + Blocks.INSTANCE.getRelay().forEach((color, id, block) -> dropSelf(block.get())); } @Override @@ -50,6 +51,7 @@ protected Iterable getKnownBlocks() { blocks.addAll(Blocks.INSTANCE.getNetworkReceiver().values()); blocks.addAll(Blocks.INSTANCE.getNetworkTransmitter().values()); blocks.addAll(Blocks.INSTANCE.getSecurityManager().values()); + blocks.addAll(Blocks.INSTANCE.getRelay().values()); return blocks; } } diff --git a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/datagen/recipe/RecoloringRecipeProvider.java b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/datagen/recipe/RecoloringRecipeProvider.java index 65e8bbb32..55386a36a 100644 --- a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/datagen/recipe/RecoloringRecipeProvider.java +++ b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/datagen/recipe/RecoloringRecipeProvider.java @@ -65,6 +65,9 @@ protected void buildRecipes(final RecipeOutput output) { Blocks.INSTANCE.getSecurityManager().forEach((color, id, block) -> recipe(Tags.SECURITY_MANAGERS, block.get().asItem(), color) .save(output, recipeId(color, "security_manager"))); + Blocks.INSTANCE.getRelay().forEach((color, id, block) -> + recipe(Tags.RELAYS, block.get().asItem(), color) + .save(output, recipeId(color, "relay"))); } private ResourceLocation recipeId(final DyeColor color, final String suffix) { diff --git a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/datagen/tag/ItemTagsProviderImpl.java b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/datagen/tag/ItemTagsProviderImpl.java index 6827cd5cb..5aee00d63 100644 --- a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/datagen/tag/ItemTagsProviderImpl.java +++ b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/datagen/tag/ItemTagsProviderImpl.java @@ -34,6 +34,7 @@ import static com.refinedmods.refinedstorage2.platform.common.content.Tags.IMPORTERS; import static com.refinedmods.refinedstorage2.platform.common.content.Tags.NETWORK_RECEIVERS; import static com.refinedmods.refinedstorage2.platform.common.content.Tags.NETWORK_TRANSMITTERS; +import static com.refinedmods.refinedstorage2.platform.common.content.Tags.RELAYS; import static com.refinedmods.refinedstorage2.platform.common.content.Tags.SECURITY_MANAGERS; import static com.refinedmods.refinedstorage2.platform.common.content.Tags.STORAGE_DISKS; import static com.refinedmods.refinedstorage2.platform.common.content.Tags.WIRELESS_TRANSMITTERS; @@ -115,6 +116,10 @@ protected void addTags(final HolderLookup.Provider provider) { Blocks.INSTANCE.getSecurityManager().values().stream() .map(block -> (Supplier) block::asItem) .toList()); + addAllToTag(RELAYS, + Blocks.INSTANCE.getRelay().values().stream() + .map(block -> (Supplier) block::asItem) + .toList()); } private void addAllToTag(final TagKey t, final Collection> items) { diff --git a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/recipemod/rei/RefinedStorageREIClientPlugin.java b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/recipemod/rei/RefinedStorageREIClientPlugin.java index 37064bfa7..eee99d6e6 100644 --- a/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/recipemod/rei/RefinedStorageREIClientPlugin.java +++ b/refinedstorage2-platform-forge/src/main/java/com/refinedmods/refinedstorage2/platform/forge/recipemod/rei/RefinedStorageREIClientPlugin.java @@ -99,6 +99,12 @@ public void registerCollapsibleEntries(final CollapsibleEntryRegistry registry) ContentIds.SECURITY_MANAGER, Tags.SECURITY_MANAGERS ); + groupItems( + registry, + Blocks.INSTANCE.getRelay(), + ContentIds.RELAY, + Tags.RELAYS + ); } @Override diff --git a/refinedstorage2-storage-api/src/main/java/com/refinedmods/refinedstorage2/api/storage/channel/StorageChannel.java b/refinedstorage2-storage-api/src/main/java/com/refinedmods/refinedstorage2/api/storage/channel/StorageChannel.java index 29299d15c..55cf8eb60 100644 --- a/refinedstorage2-storage-api/src/main/java/com/refinedmods/refinedstorage2/api/storage/channel/StorageChannel.java +++ b/refinedstorage2-storage-api/src/main/java/com/refinedmods/refinedstorage2/api/storage/channel/StorageChannel.java @@ -44,7 +44,7 @@ public interface StorageChannel extends Storage, TrackedStorage { void sortSources(); /** - * Adds a source to the channel. + * Adds a source to the channel and resorts all the sources. * * @param source the source */ diff --git a/refinedstorage2-storage-api/src/main/java/com/refinedmods/refinedstorage2/api/storage/channel/StorageChannelImpl.java b/refinedstorage2-storage-api/src/main/java/com/refinedmods/refinedstorage2/api/storage/channel/StorageChannelImpl.java index 6639d851d..da97fe035 100644 --- a/refinedstorage2-storage-api/src/main/java/com/refinedmods/refinedstorage2/api/storage/channel/StorageChannelImpl.java +++ b/refinedstorage2-storage-api/src/main/java/com/refinedmods/refinedstorage2/api/storage/channel/StorageChannelImpl.java @@ -9,7 +9,6 @@ import com.refinedmods.refinedstorage2.api.resource.list.listenable.ResourceListListener; import com.refinedmods.refinedstorage2.api.storage.Actor; import com.refinedmods.refinedstorage2.api.storage.Storage; -import com.refinedmods.refinedstorage2.api.storage.composite.CompositeStorage; import com.refinedmods.refinedstorage2.api.storage.composite.CompositeStorageImpl; import com.refinedmods.refinedstorage2.api.storage.tracked.TrackedResource; @@ -21,8 +20,8 @@ @API(status = API.Status.STABLE, since = "2.0.0-milestone.1.0") public class StorageChannelImpl implements StorageChannel { + protected final CompositeStorageImpl storage; private final ListenableResourceList list; - private final CompositeStorage storage; public StorageChannelImpl() { this(new ResourceListImpl()); diff --git a/refinedstorage2-storage-api/src/main/java/com/refinedmods/refinedstorage2/api/storage/composite/CompositeAwareChild.java b/refinedstorage2-storage-api/src/main/java/com/refinedmods/refinedstorage2/api/storage/composite/CompositeAwareChild.java index 19f428e00..154d25fb8 100644 --- a/refinedstorage2-storage-api/src/main/java/com/refinedmods/refinedstorage2/api/storage/composite/CompositeAwareChild.java +++ b/refinedstorage2-storage-api/src/main/java/com/refinedmods/refinedstorage2/api/storage/composite/CompositeAwareChild.java @@ -52,6 +52,10 @@ public interface CompositeAwareChild extends Storage { */ Amount compositeExtract(ResourceKey resource, long amount, Action action, Actor actor); + default boolean contains(Storage storage) { + return false; + } + /** * @param amount the amount * @param amountForList the amount to be modified in the parent composite cache list diff --git a/refinedstorage2-storage-api/src/main/java/com/refinedmods/refinedstorage2/api/storage/composite/CompositeStorageImpl.java b/refinedstorage2-storage-api/src/main/java/com/refinedmods/refinedstorage2/api/storage/composite/CompositeStorageImpl.java index 21fe2ea9a..c0dc06497 100644 --- a/refinedstorage2-storage-api/src/main/java/com/refinedmods/refinedstorage2/api/storage/composite/CompositeStorageImpl.java +++ b/refinedstorage2-storage-api/src/main/java/com/refinedmods/refinedstorage2/api/storage/composite/CompositeStorageImpl.java @@ -74,6 +74,16 @@ public void clearSources() { oldSources.forEach(this::removeSource); } + @Override + public boolean contains(final Storage storage) { + for (final Storage source : sources) { + if (source instanceof CompositeAwareChild compositeAwareChild && compositeAwareChild.contains(storage)) { + return true; + } + } + return false; + } + @Override public long extract(final ResourceKey resource, final long amount, final Action action, final Actor actor) { long remaining = amount; diff --git a/refinedstorage2-storage-api/src/test/java/com/refinedmods/refinedstorage2/api/storage/composite/PrioritizedStorage.java b/refinedstorage2-storage-api/src/main/java/com/refinedmods/refinedstorage2/api/storage/composite/PriorityStorage.java similarity index 53% rename from refinedstorage2-storage-api/src/test/java/com/refinedmods/refinedstorage2/api/storage/composite/PrioritizedStorage.java rename to refinedstorage2-storage-api/src/main/java/com/refinedmods/refinedstorage2/api/storage/composite/PriorityStorage.java index fafebcb41..034996742 100644 --- a/refinedstorage2-storage-api/src/test/java/com/refinedmods/refinedstorage2/api/storage/composite/PrioritizedStorage.java +++ b/refinedstorage2-storage-api/src/main/java/com/refinedmods/refinedstorage2/api/storage/composite/PriorityStorage.java @@ -3,14 +3,21 @@ import com.refinedmods.refinedstorage2.api.storage.AbstractProxyStorage; import com.refinedmods.refinedstorage2.api.storage.Storage; -public class PrioritizedStorage extends AbstractProxyStorage implements Priority { +import org.apiguardian.api.API; + +@API(status = API.Status.STABLE, since = "2.0.0-milestone.3.6") +public class PriorityStorage extends AbstractProxyStorage implements Priority { private int priority; - public PrioritizedStorage(final int priority, final Storage delegate) { + private PriorityStorage(final int priority, final Storage delegate) { super(delegate); this.priority = priority; } + public static PriorityStorage of(final Storage delegate, final int priority) { + return new PriorityStorage(priority, delegate); + } + public void setPriority(final int priority) { this.priority = priority; } @@ -20,3 +27,4 @@ public int getPriority() { return priority; } } + diff --git a/refinedstorage2-storage-api/src/test/java/com/refinedmods/refinedstorage2/api/storage/channel/StorageChannelImplTest.java b/refinedstorage2-storage-api/src/test/java/com/refinedmods/refinedstorage2/api/storage/channel/StorageChannelImplTest.java index 834f0c639..cf3f1c9cd 100644 --- a/refinedstorage2-storage-api/src/test/java/com/refinedmods/refinedstorage2/api/storage/channel/StorageChannelImplTest.java +++ b/refinedstorage2-storage-api/src/test/java/com/refinedmods/refinedstorage2/api/storage/channel/StorageChannelImplTest.java @@ -6,7 +6,7 @@ import com.refinedmods.refinedstorage2.api.resource.list.listenable.ResourceListListener; import com.refinedmods.refinedstorage2.api.storage.EmptyActor; import com.refinedmods.refinedstorage2.api.storage.Storage; -import com.refinedmods.refinedstorage2.api.storage.composite.PrioritizedStorage; +import com.refinedmods.refinedstorage2.api.storage.composite.PriorityStorage; import com.refinedmods.refinedstorage2.api.storage.limited.LimitedStorageImpl; import com.refinedmods.refinedstorage2.api.storage.tracked.TrackedResource; import com.refinedmods.refinedstorage2.api.storage.tracked.TrackedStorageImpl; @@ -266,9 +266,9 @@ void shouldNotBeAbleToRetrieveNonExistentResource() { @Test void shouldSortSources() { // Arrange - final PrioritizedStorage storage1 = new PrioritizedStorage(0, new LimitedStorageImpl(10)); - final PrioritizedStorage storage2 = new PrioritizedStorage(0, new LimitedStorageImpl(10)); - final PrioritizedStorage storage3 = new PrioritizedStorage(0, new LimitedStorageImpl(10)); + final PriorityStorage storage1 = PriorityStorage.of(new LimitedStorageImpl(10), 0); + final PriorityStorage storage2 = PriorityStorage.of(new LimitedStorageImpl(10), 0); + final PriorityStorage storage3 = PriorityStorage.of(new LimitedStorageImpl(10), 0); sut.addSource(storage1); sut.addSource(storage2); diff --git a/refinedstorage2-storage-api/src/test/java/com/refinedmods/refinedstorage2/api/storage/composite/CompositeStorageImplTest.java b/refinedstorage2-storage-api/src/test/java/com/refinedmods/refinedstorage2/api/storage/composite/CompositeStorageImplTest.java index 92d37d937..f8ccd870a 100644 --- a/refinedstorage2-storage-api/src/test/java/com/refinedmods/refinedstorage2/api/storage/composite/CompositeStorageImplTest.java +++ b/refinedstorage2-storage-api/src/test/java/com/refinedmods/refinedstorage2/api/storage/composite/CompositeStorageImplTest.java @@ -129,9 +129,9 @@ void shouldClearSources() { @Test void shouldRespectPriorityWhenAddingNewSources() { // Arrange - final Storage storage1 = new PrioritizedStorage(20, new LimitedStorageImpl(10)); - final Storage storage2 = new PrioritizedStorage(10, new LimitedStorageImpl(10)); - final Storage storage3 = new PrioritizedStorage(30, new LimitedStorageImpl(10)); + final Storage storage1 = PriorityStorage.of(new LimitedStorageImpl(10), 20); + final Storage storage2 = PriorityStorage.of(new LimitedStorageImpl(10), 10); + final Storage storage3 = PriorityStorage.of(new LimitedStorageImpl(10), 30); // Act sut.addSource(storage1); @@ -154,9 +154,9 @@ void shouldRespectPriorityWhenAddingNewSources() { @Test void shouldRespectPriorityWhenRemovingSources() { // Arrange - final Storage storage1 = new PrioritizedStorage(20, new LimitedStorageImpl(10)); - final Storage storage2 = new PrioritizedStorage(10, new LimitedStorageImpl(10)); - final Storage storage3 = new PrioritizedStorage(30, new LimitedStorageImpl(10)); + final Storage storage1 = PriorityStorage.of(new LimitedStorageImpl(10), 20); + final Storage storage2 = PriorityStorage.of(new LimitedStorageImpl(10), 10); + final Storage storage3 = PriorityStorage.of(new LimitedStorageImpl(10), 30); sut.addSource(storage1); sut.addSource(storage2); @@ -180,8 +180,8 @@ void shouldRespectPriorityWhenRemovingSources() { @Test void shouldOnlyRespectPriorityWhenSortingSourcesExplicitlyWhenChangingPriorityAfterAddingSource() { // Arrange - final PrioritizedStorage storage1 = new PrioritizedStorage(1, new LimitedStorageImpl(10)); - final Storage storage2 = new PrioritizedStorage(2, new LimitedStorageImpl(10)); + final PriorityStorage storage1 = PriorityStorage.of(new LimitedStorageImpl(10), 1); + final Storage storage2 = PriorityStorage.of(new LimitedStorageImpl(10), 2); sut.addSource(storage1); sut.addSource(storage2); diff --git a/refinedstorage2-storage-api/src/test/java/com/refinedmods/refinedstorage2/api/storage/composite/ExtractCompositeStorageImplTest.java b/refinedstorage2-storage-api/src/test/java/com/refinedmods/refinedstorage2/api/storage/composite/ExtractCompositeStorageImplTest.java index 28e9d0343..17aff9ed1 100644 --- a/refinedstorage2-storage-api/src/test/java/com/refinedmods/refinedstorage2/api/storage/composite/ExtractCompositeStorageImplTest.java +++ b/refinedstorage2-storage-api/src/test/java/com/refinedmods/refinedstorage2/api/storage/composite/ExtractCompositeStorageImplTest.java @@ -281,8 +281,8 @@ void shouldNotExtractWithoutAnySourcesPresent() { @Test void shouldRespectPriorityWhenExtracting() { // Arrange - final PrioritizedStorage lowestPriority = new PrioritizedStorage(5, new LimitedStorageImpl(10)); - final PrioritizedStorage highestPriority = new PrioritizedStorage(10, new LimitedStorageImpl(10)); + final PriorityStorage lowestPriority = PriorityStorage.of(new LimitedStorageImpl(10), 5); + final PriorityStorage highestPriority = PriorityStorage.of(new LimitedStorageImpl(10), 10); lowestPriority.insert(A, 5, Action.EXECUTE, EmptyActor.INSTANCE); highestPriority.insert(A, 10, Action.EXECUTE, EmptyActor.INSTANCE); diff --git a/refinedstorage2-storage-api/src/test/java/com/refinedmods/refinedstorage2/api/storage/composite/InsertCompositeStorageImplTest.java b/refinedstorage2-storage-api/src/test/java/com/refinedmods/refinedstorage2/api/storage/composite/InsertCompositeStorageImplTest.java index 4f882bcb2..361c86d0e 100644 --- a/refinedstorage2-storage-api/src/test/java/com/refinedmods/refinedstorage2/api/storage/composite/InsertCompositeStorageImplTest.java +++ b/refinedstorage2-storage-api/src/test/java/com/refinedmods/refinedstorage2/api/storage/composite/InsertCompositeStorageImplTest.java @@ -185,8 +185,8 @@ void shouldNotInsertWithoutAnySourcesPresent() { @Test void shouldRespectPriorityWhenInserting() { // Arrange - final PrioritizedStorage lowestPriority = new PrioritizedStorage(5, new LimitedStorageImpl(10)); - final PrioritizedStorage highestPriority = new PrioritizedStorage(10, new LimitedStorageImpl(10)); + final PriorityStorage lowestPriority = PriorityStorage.of(new LimitedStorageImpl(10), 5); + final PriorityStorage highestPriority = PriorityStorage.of(new LimitedStorageImpl(10), 10); sut.addSource(lowestPriority); sut.addSource(highestPriority); From b212d5ac9610392621f41fbb65a6b3371509ddee Mon Sep 17 00:00:00 2001 From: raoulvdberge Date: Sat, 18 May 2024 09:38:04 +0000 Subject: [PATCH 26/26] chore: prepare release v2.0.0-milestone.3.6 --- CHANGELOG.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c62a7f8ad..5ce45fae3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +## [2.0.0-milestone.3.6] - 2024-05-18 + ### Added - Relay @@ -570,7 +572,9 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - The Grid can now use smooth scrolling. - The Grid now has syntax highlighting for the search query. -[Unreleased]: https://github.com/refinedmods/refinedstorage2/compare/v2.0.0-milestone.3.5...HEAD +[Unreleased]: https://github.com/refinedmods/refinedstorage2/compare/v2.0.0-milestone.3.6...HEAD + +[2.0.0-milestone.3.6]: https://github.com/refinedmods/refinedstorage2/compare/v2.0.0-milestone.3.5...v2.0.0-milestone.3.6 [2.0.0-milestone.3.5]: https://github.com/refinedmods/refinedstorage2/compare/v2.0.0-milestone.3.4...v2.0.0-milestone.3.5