diff --git a/src/main/generated/.cache/02abb917ba8e00c835a25a61e1edfdc4b9711b3f b/src/main/generated/.cache/02abb917ba8e00c835a25a61e1edfdc4b9711b3f index c192333f..231b6a39 100644 --- a/src/main/generated/.cache/02abb917ba8e00c835a25a61e1edfdc4b9711b3f +++ b/src/main/generated/.cache/02abb917ba8e00c835a25a61e1edfdc4b9711b3f @@ -1,13 +1,13 @@ -// 1.20.1 2024-04-25T17:00:21.8694617 ExtendedAE/Block Loot Tables -24c71b6a63dc2d0f59ff270a57f1726c1f552acc data\extendedae\loot_tables\blocks\wireless_connect.json -737d1509ebc65cc4a079ec4b4b17ca0cf541aebc data\extendedae\loot_tables\blocks\ex_io_port.json +// 1.20.1 2024-06-07T14:20:29.230799 ExtendedAE/Block Loot Tables +b88aff654e2b52c77d3a954b0a40624ba2b7d94c data\extendedae\loot_tables\blocks\ex_pattern_provider.json 06cd161fbcac8e01ff365488afdb95c66ddbcf26 data\extendedae\loot_tables\blocks\ex_drive.json -99b8511078b13df6bfb1dee44568eff5fda1838c data\extendedae\loot_tables\blocks\crystal_fixer.json -95b7f1ca8dbec880d1db6f29cc0a64eeb9de9480 data\extendedae\loot_tables\blocks\caner.json -a8be6e15007892fb1d04f553bfc9a8808c8618d1 data\extendedae\loot_tables\blocks\ingredient_buffer.json 19d659c4dcf2e05ad65727c6e22a95e22e1887b6 data\extendedae\loot_tables\blocks\ex_molecular_assembler.json ddc5ded4cf2eb2f4ce138a6645ea33c4fc0d461e data\extendedae\loot_tables\blocks\fishbig.json 0b50701ba31a8ea8ff15daee590d6e79e6b046df data\extendedae\loot_tables\blocks\ex_interface.json -b88aff654e2b52c77d3a954b0a40624ba2b7d94c data\extendedae\loot_tables\blocks\ex_pattern_provider.json -8f0fa3bfe64e61ee7cab0a7ae899257059883a87 data\extendedae\loot_tables\blocks\ex_charger.json +24c71b6a63dc2d0f59ff270a57f1726c1f552acc data\extendedae\loot_tables\blocks\wireless_connect.json +95b7f1ca8dbec880d1db6f29cc0a64eeb9de9480 data\extendedae\loot_tables\blocks\caner.json fd265728b9c9f3e5a720fa211cad991ed8e0566f data\extendedae\loot_tables\blocks\ex_inscriber.json +8f0fa3bfe64e61ee7cab0a7ae899257059883a87 data\extendedae\loot_tables\blocks\ex_charger.json +737d1509ebc65cc4a079ec4b4b17ca0cf541aebc data\extendedae\loot_tables\blocks\ex_io_port.json +a8be6e15007892fb1d04f553bfc9a8808c8618d1 data\extendedae\loot_tables\blocks\ingredient_buffer.json +99b8511078b13df6bfb1dee44568eff5fda1838c data\extendedae\loot_tables\blocks\crystal_fixer.json diff --git a/src/main/generated/.cache/a31a09512bce484ecd4ae47514d0b3749b5fbcbe b/src/main/generated/.cache/a31a09512bce484ecd4ae47514d0b3749b5fbcbe index 438a248f..11c917d6 100644 --- a/src/main/generated/.cache/a31a09512bce484ecd4ae47514d0b3749b5fbcbe +++ b/src/main/generated/.cache/a31a09512bce484ecd4ae47514d0b3749b5fbcbe @@ -1,2 +1,2 @@ -// 1.20.1 2024-04-25T17:00:21.8694617 ExtendedAE/Tags for minecraft:block +// 1.20.1 2024-06-07T14:20:29.230799 ExtendedAE/Tags for minecraft:block 7a39ade8c8cfcfb185b7d544c7a0f9c89f41a4ef data\minecraft\tags\blocks\mineable\pickaxe.json diff --git a/src/main/generated/.cache/ce928cef96985321fbd66b5fe5c2bd39a98075c0 b/src/main/generated/.cache/ce928cef96985321fbd66b5fe5c2bd39a98075c0 index c10b669a..79c8da88 100644 --- a/src/main/generated/.cache/ce928cef96985321fbd66b5fe5c2bd39a98075c0 +++ b/src/main/generated/.cache/ce928cef96985321fbd66b5fe5c2bd39a98075c0 @@ -1,3 +1,3 @@ -// 1.20.1 2024-04-25T17:00:21.8684646 ExtendedAE/Tags for minecraft:item +// 1.20.1 2024-06-07T14:20:29.2288029 ExtendedAE/Tags for minecraft:item 7166e4ff733ed79bf23e0d65e92ee77a5d2539a3 data\extendedae\tags\items\extended_pattern_provider.json 184f4dec1675439eb2fdc2dce8431ebe60fbaa7b data\extendedae\tags\items\extended_interface.json diff --git a/src/main/generated/.cache/eb4bb7bf118d6546ada756995518a81713c963f3 b/src/main/generated/.cache/eb4bb7bf118d6546ada756995518a81713c963f3 index 2373ffa0..b6d9b186 100644 --- a/src/main/generated/.cache/eb4bb7bf118d6546ada756995518a81713c963f3 +++ b/src/main/generated/.cache/eb4bb7bf118d6546ada756995518a81713c963f3 @@ -1,77 +1,79 @@ -// 1.20.1 2024-04-25T17:00:21.8704592 ExtendedAE/Recipes -1bac434a93253d0a1b6f0db81f4d2be6a3446301 data\extendedae\advancements\recipes\misc\caner.json -de2cc74ae7419cbdad7713c6785bd1c0e06c2d2e data\extendedae\advancements\recipes\misc\epp_upgrade.json -7cd2e0b2e117c393a56e73f31b8205198753c242 data\extendedae\advancements\recipes\misc\ebus_out.json -157f7daeb5d768290f6e72ca422eb88613e238e7 data\extendedae\advancements\recipes\misc\epp.json -226415d068b01103e857383464da3bf45fa847b0 data\extendedae\advancements\recipes\misc\fishbig.json +// 1.20.1 2024-06-07T14:20:29.2318012 ExtendedAE/Recipes +f508e97befb44ee5bd19d9235e87cd6d6a325f0b data\extendedae\advancements\recipes\misc\ei.json +485a45f69fb55ed861471fe4b2684cdbe6f1df11 data\extendedae\advancements\recipes\misc\ei_alt.json +27427c4dfc2bf1986ef4806648f1c94773b5af2f data\extendedae\advancements\recipes\misc\crystal_fixer.json +7565fe99a7bd65f936fc47b0e1ad431e64446eec data\extendedae\recipes\epp_upgrade.json adbc75d2108ca6483d3598845e869f0fae8f533c data\extendedae\advancements\recipes\misc\water_cell.json -1faa2f305d08984545b99fa10be22969f681b39c data\extendedae\advancements\recipes\misc\wireless_tool.json -f40a8b738597c587ec19a3fa27f859572dde6a41 data\extendedae\recipes\epp_alt.json -d0c8ff587d0140cf44898a21ffa6c8bad08e75c5 data\extendedae\recipes\ei.json -fd61a12d57e4bd4ad77c60425e3668de5975f824 data\extendedae\recipes\ebus_out.json -1d1abecf99c5b107562e937b391ca261d98ca6d0 data\extendedae\advancements\recipes\misc\mod_export_bus.json -68e4e8c941124a874a60a3f61de9571e9831e2c9 data\extendedae\recipes\epa.json -7c5d4fbfcba5cd27afaac59243a0edd855d73a9e data\extendedae\recipes\mod_storage_bus.json -396aa6147e7aa1363a4e8ce276b5165c52b816ac data\extendedae\recipes\caner.json -02b576b74866a4fa219ba5074e5cd56ed73b9131 data\extendedae\advancements\recipes\misc\pattern_modifier.json -a8281b8747957085d28bbc23887fcccffea39229 data\extendedae\advancements\recipes\misc\ex_molecular_assembler.json -a8b3761d9c91d9bcd0bc98492e8b9a5c9f3fd63d data\extendedae\advancements\recipes\misc\tag_export_bus.json -9ee547a12347275beea13b2fb68bb5f2a12a2d5a data\extendedae\recipes\ei_alt.json -7b5c6414a1411317d91e40161c9e27a6168730a7 data\extendedae\advancements\recipes\misc\ex_inscriber.json d921e829524c6776aaf77c6bae8e16d6e3c9e82b data\extendedae\recipes\tag_storage_bus.json -b7f44dfb90b9b92810d272b1d4780674ebfe913d data\extendedae\advancements\recipes\misc\ei_part.json -525f231123ae54b6c26de87934836cae6bbd2cd0 data\extendedae\recipes\wireless_connector.json -f622ed251428985327ee2cfe999e24951cdec874 data\extendedae\advancements\recipes\misc\cobblestone_cell.json -b990c9992dc20e815e500ee898db8ef45a9790b2 data\extendedae\advancements\recipes\misc\ex_drive.json -5355e5286d274a56e8e2f1296bbcb5a36f05d61f data\extendedae\recipes\cobblestone_cell.json -ad1c11ac61d618ef4e46696db592011589948b17 data\extendedae\recipes\tape.json -fceafd07f5a95ceb78b50fce0b9bdee39d240aa0 data\extendedae\recipes\precise_storage_bus.json -639f072db9f8117fa778e22c68a52e64c29c6416 data\extendedae\recipes\epp.json -9d1f3f206dc9d0953fdb65452fd67d32355872b1 data\extendedae\recipes\ebus_in.json -1fad3d73625526a41cc6a1f65d8ff8b1bd4ddcdf data\extendedae\recipes\epa_upgrade.json +157f7daeb5d768290f6e72ca422eb88613e238e7 data\extendedae\advancements\recipes\misc\epp.json +28acf08a9caa818ea6a7d08d73910390c9469997 data\extendedae\recipes\crystal_fixer.json +dd5a7c58737de067596333d1c060748ad226943e data\extendedae\recipes\tag_export_bus.json +a8281b8747957085d28bbc23887fcccffea39229 data\extendedae\advancements\recipes\misc\ex_molecular_assembler.json +7cd2e0b2e117c393a56e73f31b8205198753c242 data\extendedae\advancements\recipes\misc\ebus_out.json +08a03e39c4f2219c6c4e94318274ae5ad7172b71 data\extendedae\recipes\ingredient_buffer.json +d0c8ff587d0140cf44898a21ffa6c8bad08e75c5 data\extendedae\recipes\ei.json d90d5dca824ca5d5a9ec3ea77745b27eb6fbafa0 data\extendedae\advancements\recipes\misc\epa_upgrade.json -b94de294e9524b678b6a0dd2a7385d818f84b235 data\extendedae\advancements\recipes\misc\mod_storage_bus.json -df675d2c3005b9c9d2c0fc7fcfa82bf7e7dd8b35 data\extendedae\advancements\recipes\misc\ei_upgrade.json 9eebc3490a873ada398514259277b0d815ca0874 data\extendedae\advancements\recipes\misc\pre_bus.json -99147d5f0d4b875a37657bafdb7ff1a34cd8c3e1 data\extendedae\recipes\threshold_level_emitter.json -c6573c73383253b83e65f9627b992eb7c3184abb data\extendedae\recipes\pre_bus.json -27eb8f1f80f4e0227df222f5599eea8f737c3138 data\extendedae\recipes\wireless_tool.json -ff60b826b068699ba9e304440800eab9dc7df3bd data\extendedae\recipes\ex_molecular_assembler.json -485a45f69fb55ed861471fe4b2684cdbe6f1df11 data\extendedae\advancements\recipes\misc\ei_alt.json -8829e286eb90097c5d0790604fdab89abf3013e8 data\extendedae\advancements\recipes\misc\threshold_level_emitter.json -28acf08a9caa818ea6a7d08d73910390c9469997 data\extendedae\recipes\crystal_fixer.json -8d0fcb24fa759c224ca31d405817371981b786eb data\extendedae\advancements\recipes\misc\ex_io_port.json -85f4568082647e23482a8a8b029e75840ef92d37 data\extendedae\advancements\recipes\misc\epp_part.json -415358cbfd6b40428a258d49152c2eef6c184079 data\extendedae\advancements\recipes\misc\wireless_connector.json -8c350184b34ab81220ecbb6bbf5e8bba11bf679b data\extendedae\advancements\recipes\misc\epa.json -0158cf64142a1c0dee822e1057a05bef183049f7 data\extendedae\recipes\ex_charger.json -f508e97befb44ee5bd19d9235e87cd6d6a325f0b data\extendedae\advancements\recipes\misc\ei.json -7565fe99a7bd65f936fc47b0e1ad431e64446eec data\extendedae\recipes\epp_upgrade.json -35af04c719a73464cf568997a71ede2ff2309859 data\extendedae\recipes\ebus_upgrade.json -a6ee65b50356fb7d4f743c2bcd4ecfa5165a614c data\extendedae\advancements\recipes\misc\ex_charger.json +3c90b4f6157b28b70b8503929766d5fbc2f1d992 data\extendedae\advancements\recipes\misc\tape.json +b990c9992dc20e815e500ee898db8ef45a9790b2 data\extendedae\advancements\recipes\misc\ex_drive.json 5ba5a5649332f4413a227b1f6606266918f8bb91 data\extendedae\advancements\recipes\misc\ex_drive_upgrade.json -73004f6420ede6da88f207e4af96dca5196123a4 data\extendedae\advancements\recipes\misc\active_formation_plane.json +68e4e8c941124a874a60a3f61de9571e9831e2c9 data\extendedae\recipes\epa.json +b94de294e9524b678b6a0dd2a7385d818f84b235 data\extendedae\advancements\recipes\misc\mod_storage_bus.json +8d0fcb24fa759c224ca31d405817371981b786eb data\extendedae\advancements\recipes\misc\ex_io_port.json +91f1efffd2c45dace6651dc0e9425115cb05d1a4 data\extendedae\recipes\water_cell.json 75230690ccff541ac1cd562095599f8d8fee2652 data\extendedae\advancements\recipes\misc\ebus_in.json +ad1c11ac61d618ef4e46696db592011589948b17 data\extendedae\recipes\tape.json +0158cf64142a1c0dee822e1057a05bef183049f7 data\extendedae\recipes\ex_charger.json +c6573c73383253b83e65f9627b992eb7c3184abb data\extendedae\recipes\pre_bus.json +cee72d050c49f1d990c4afb067b472de8a8da268 data\extendedae\recipes\epp_part.json 87a4fd931ae96ab953572fc774d9fa379af6f6b7 data\extendedae\recipes\active_formation_plane.json -dd5a7c58737de067596333d1c060748ad226943e data\extendedae\recipes\tag_export_bus.json -396361180084444fd00c9b3bf440de7a2c52f0ff data\extendedae\advancements\recipes\misc\epp_alt.json +99147d5f0d4b875a37657bafdb7ff1a34cd8c3e1 data\extendedae\recipes\threshold_level_emitter.json +8829e286eb90097c5d0790604fdab89abf3013e8 data\extendedae\advancements\recipes\misc\threshold_level_emitter.json +de6eaf583206ca9c2e0790292b8bd8649ed5da2a data\extendedae\recipes\ex_drive_upgrade.json +1c678eb50c5988a6670e407c8a78f85c0996e375 data\extendedae\advancements\recipes\misc\threshold_export_bus.json +396aa6147e7aa1363a4e8ce276b5165c52b816ac data\extendedae\recipes\caner.json +7c5d4fbfcba5cd27afaac59243a0edd855d73a9e data\extendedae\recipes\mod_storage_bus.json a0bcd6db7590feaa0f8568977b322ef55459b79e data\extendedae\recipes\ex_inscriber.json 936fb9f1a7f392b8a7328b1a7b71d03b189a3265 data\extendedae\recipes\ei_upgrade.json -0aa2c550181252012d3ce740beb21321330fba52 data\extendedae\recipes\ex_drive.json -27427c4dfc2bf1986ef4806648f1c94773b5af2f data\extendedae\advancements\recipes\misc\crystal_fixer.json -95c601b7549668d291eb0f334592454ef3d0c9fb data\extendedae\recipes\ei_part.json -ccf58443de52da18898204135c744dcaf2f7be1d data\extendedae\recipes\ex_io_port.json -cee72d050c49f1d990c4afb067b472de8a8da268 data\extendedae\recipes\epp_part.json -c1d41ce0812c35f926a9b88270a38dffb3e9c430 data\extendedae\recipes\wireless_ex_pat.json +8c350184b34ab81220ecbb6bbf5e8bba11bf679b data\extendedae\advancements\recipes\misc\epa.json +02b576b74866a4fa219ba5074e5cd56ed73b9131 data\extendedae\advancements\recipes\misc\pattern_modifier.json 9e2bdedee3d97d2b3a4316ccf0828f4fb7dd46dc data\extendedae\advancements\recipes\misc\precise_storage_bus.json -0e1a5843a0c5273cfe0fc0577efbdb620d579e0a data\extendedae\recipes\pattern_modifier.json -beaf4f6680f4592edec80630df4cd99954781f46 data\extendedae\advancements\recipes\misc\wireless_ex_pat.json -260aba7256141fbfa9d4c2cf0760b35e7e500da8 data\extendedae\advancements\recipes\misc\ingredient_buffer.json -91f1efffd2c45dace6651dc0e9425115cb05d1a4 data\extendedae\recipes\water_cell.json -3c90b4f6157b28b70b8503929766d5fbc2f1d992 data\extendedae\advancements\recipes\misc\tape.json +1faa2f305d08984545b99fa10be22969f681b39c data\extendedae\advancements\recipes\misc\wireless_tool.json +ff60b826b068699ba9e304440800eab9dc7df3bd data\extendedae\recipes\ex_molecular_assembler.json +85f4568082647e23482a8a8b029e75840ef92d37 data\extendedae\advancements\recipes\misc\epp_part.json +3f76c4c56c84fd2ffef500e70663ac756c2ca40d data\extendedae\recipes\threshold_export_bus.json +1d1abecf99c5b107562e937b391ca261d98ca6d0 data\extendedae\advancements\recipes\misc\mod_export_bus.json +c1d41ce0812c35f926a9b88270a38dffb3e9c430 data\extendedae\recipes\wireless_ex_pat.json +35af04c719a73464cf568997a71ede2ff2309859 data\extendedae\recipes\ebus_upgrade.json +9d1f3f206dc9d0953fdb65452fd67d32355872b1 data\extendedae\recipes\ebus_in.json f645b7fa89e1d27fb9b869b345fc14d06e7d95b0 data\extendedae\advancements\recipes\misc\ebus_upgrade.json +415358cbfd6b40428a258d49152c2eef6c184079 data\extendedae\advancements\recipes\misc\wireless_connector.json +27eb8f1f80f4e0227df222f5599eea8f737c3138 data\extendedae\recipes\wireless_tool.json +fd61a12d57e4bd4ad77c60425e3668de5975f824 data\extendedae\recipes\ebus_out.json +b7f44dfb90b9b92810d272b1d4780674ebfe913d data\extendedae\advancements\recipes\misc\ei_part.json +0aa2c550181252012d3ce740beb21321330fba52 data\extendedae\recipes\ex_drive.json +7b5c6414a1411317d91e40161c9e27a6168730a7 data\extendedae\advancements\recipes\misc\ex_inscriber.json +1fad3d73625526a41cc6a1f65d8ff8b1bd4ddcdf data\extendedae\recipes\epa_upgrade.json +a8b3761d9c91d9bcd0bc98492e8b9a5c9f3fd63d data\extendedae\advancements\recipes\misc\tag_export_bus.json 3c5e9bc0f27e8ac63672d69b64616dcfd10f319e data\extendedae\recipes\mod_export_bus.json -6934a077604a55ff1c73d9a9b51001c30c8dbfb2 data\extendedae\recipes\fishbig.json -08a03e39c4f2219c6c4e94318274ae5ad7172b71 data\extendedae\recipes\ingredient_buffer.json +5355e5286d274a56e8e2f1296bbcb5a36f05d61f data\extendedae\recipes\cobblestone_cell.json +0e1a5843a0c5273cfe0fc0577efbdb620d579e0a data\extendedae\recipes\pattern_modifier.json +525f231123ae54b6c26de87934836cae6bbd2cd0 data\extendedae\recipes\wireless_connector.json +396361180084444fd00c9b3bf440de7a2c52f0ff data\extendedae\advancements\recipes\misc\epp_alt.json +ccf58443de52da18898204135c744dcaf2f7be1d data\extendedae\recipes\ex_io_port.json +73004f6420ede6da88f207e4af96dca5196123a4 data\extendedae\advancements\recipes\misc\active_formation_plane.json +fceafd07f5a95ceb78b50fce0b9bdee39d240aa0 data\extendedae\recipes\precise_storage_bus.json +a6ee65b50356fb7d4f743c2bcd4ecfa5165a614c data\extendedae\advancements\recipes\misc\ex_charger.json +639f072db9f8117fa778e22c68a52e64c29c6416 data\extendedae\recipes\epp.json +1bac434a93253d0a1b6f0db81f4d2be6a3446301 data\extendedae\advancements\recipes\misc\caner.json +226415d068b01103e857383464da3bf45fa847b0 data\extendedae\advancements\recipes\misc\fishbig.json +de2cc74ae7419cbdad7713c6785bd1c0e06c2d2e data\extendedae\advancements\recipes\misc\epp_upgrade.json +95c601b7549668d291eb0f334592454ef3d0c9fb data\extendedae\recipes\ei_part.json +f40a8b738597c587ec19a3fa27f859572dde6a41 data\extendedae\recipes\epp_alt.json cc629dd912783b3611af0e87536d631ce6ea3581 data\extendedae\advancements\recipes\misc\tag_storage_bus.json -de6eaf583206ca9c2e0790292b8bd8649ed5da2a data\extendedae\recipes\ex_drive_upgrade.json +260aba7256141fbfa9d4c2cf0760b35e7e500da8 data\extendedae\advancements\recipes\misc\ingredient_buffer.json +6934a077604a55ff1c73d9a9b51001c30c8dbfb2 data\extendedae\recipes\fishbig.json +9ee547a12347275beea13b2fb68bb5f2a12a2d5a data\extendedae\recipes\ei_alt.json +f622ed251428985327ee2cfe999e24951cdec874 data\extendedae\advancements\recipes\misc\cobblestone_cell.json +df675d2c3005b9c9d2c0fc7fcfa82bf7e7dd8b35 data\extendedae\advancements\recipes\misc\ei_upgrade.json +beaf4f6680f4592edec80630df4cd99954781f46 data\extendedae\advancements\recipes\misc\wireless_ex_pat.json diff --git a/src/main/generated/data/extendedae/advancements/recipes/misc/threshold_export_bus.json b/src/main/generated/data/extendedae/advancements/recipes/misc/threshold_export_bus.json new file mode 100644 index 00000000..dcdee6a5 --- /dev/null +++ b/src/main/generated/data/extendedae/advancements/recipes/misc/threshold_export_bus.json @@ -0,0 +1,35 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_item": { + "conditions": { + "items": [ + { + "items": [ + "ae2:level_emitter" + ] + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "extendedae:threshold_export_bus" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_item", + "has_the_recipe" + ] + ], + "rewards": { + "recipes": [ + "extendedae:threshold_export_bus" + ] + }, + "sends_telemetry_event": false +} \ No newline at end of file diff --git a/src/main/generated/data/extendedae/recipes/threshold_export_bus.json b/src/main/generated/data/extendedae/recipes/threshold_export_bus.json new file mode 100644 index 00000000..9ed00c22 --- /dev/null +++ b/src/main/generated/data/extendedae/recipes/threshold_export_bus.json @@ -0,0 +1,22 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "misc", + "key": { + "C": { + "item": "ae2:logic_processor" + }, + "E": { + "item": "ae2:export_bus" + }, + "L": { + "item": "ae2:level_emitter" + } + }, + "pattern": [ + "LCE" + ], + "result": { + "item": "extendedae:threshold_export_bus" + }, + "show_notification": true +} \ No newline at end of file diff --git a/src/main/java/com/github/glodblock/extendedae/api/ThresholdMode.java b/src/main/java/com/github/glodblock/extendedae/api/ThresholdMode.java new file mode 100644 index 00000000..32b317bc --- /dev/null +++ b/src/main/java/com/github/glodblock/extendedae/api/ThresholdMode.java @@ -0,0 +1,7 @@ +package com.github.glodblock.extendedae.api; + +public enum ThresholdMode { + + GREATER, LOWER + +} \ No newline at end of file diff --git a/src/main/java/com/github/glodblock/extendedae/client/ClientRegistryHandler.java b/src/main/java/com/github/glodblock/extendedae/client/ClientRegistryHandler.java index 5bbbc7ba..9c6a4872 100644 --- a/src/main/java/com/github/glodblock/extendedae/client/ClientRegistryHandler.java +++ b/src/main/java/com/github/glodblock/extendedae/client/ClientRegistryHandler.java @@ -21,6 +21,7 @@ import com.github.glodblock.extendedae.client.gui.GuiPatternModifier; import com.github.glodblock.extendedae.client.gui.GuiPreciseExportBus; import com.github.glodblock.extendedae.client.gui.GuiPreciseStorageBus; +import com.github.glodblock.extendedae.client.gui.GuiThresholdExportBus; import com.github.glodblock.extendedae.client.gui.GuiRenamer; import com.github.glodblock.extendedae.client.gui.GuiTagExportBus; import com.github.glodblock.extendedae.client.gui.GuiTagStorageBus; @@ -65,6 +66,7 @@ import com.github.glodblock.extendedae.container.ContainerPatternModifier; import com.github.glodblock.extendedae.container.ContainerPreciseExportBus; import com.github.glodblock.extendedae.container.ContainerPreciseStorageBus; +import com.github.glodblock.extendedae.container.ContainerThresholdExportBus; import com.github.glodblock.extendedae.container.ContainerRenamer; import com.github.glodblock.extendedae.container.ContainerTagExportBus; import com.github.glodblock.extendedae.container.ContainerTagStorageBus; @@ -122,6 +124,7 @@ private void registerGui() { InitScreens.register(ContainerExIOPort.TYPE, GuiExIOPort::new, "/screens/ex_io_port.json"); InitScreens.register(ContainerPreciseExportBus.TYPE, GuiPreciseExportBus::new, "/screens/precise_export_bus.json"); InitScreens.register(ContainerPreciseStorageBus.TYPE, GuiPreciseStorageBus::new, "/screens/precise_storage_bus.json"); + InitScreens.register(ContainerThresholdExportBus.TYPE, GuiThresholdExportBus::new, "/screens/threshold_export_bus.json"); MenuScreens.register(ContainerProcessingPattern.TYPE, GuiProcessingPattern::new); MenuScreens.register(ContainerCraftingPattern.TYPE, GuiCraftingPattern::new); MenuScreens.register(ContainerStonecuttingPattern.TYPE, GuiStonecuttingPattern::new); diff --git a/src/main/java/com/github/glodblock/extendedae/client/button/EPPIcon.java b/src/main/java/com/github/glodblock/extendedae/client/button/EPPIcon.java index 8be557e0..9bdddc64 100644 --- a/src/main/java/com/github/glodblock/extendedae/client/button/EPPIcon.java +++ b/src/main/java/com/github/glodblock/extendedae/client/button/EPPIcon.java @@ -16,5 +16,7 @@ public class EPPIcon { public static final Blitter STACK_64 = Blitter.texture(TEXTURE, 64, 64).src(16, 16, 16, 16); public static final Blitter FILLED = Blitter.texture(TEXTURE, 64, 64).src(32, 16, 16, 16); public static final Blitter BUCKET = Blitter.texture(TEXTURE, 64, 64).src(48, 16, 16, 16); + public static final Blitter OVER_STACK = Blitter.texture(TEXTURE, 64, 64).src(0, 32, 16, 16); + public static final Blitter BELOW_STACK = Blitter.texture(TEXTURE, 64, 64).src(16, 32, 16, 16); } diff --git a/src/main/java/com/github/glodblock/extendedae/client/gui/GuiCaner.java b/src/main/java/com/github/glodblock/extendedae/client/gui/GuiCaner.java index 56bdc89c..f21085bc 100644 --- a/src/main/java/com/github/glodblock/extendedae/client/gui/GuiCaner.java +++ b/src/main/java/com/github/glodblock/extendedae/client/gui/GuiCaner.java @@ -20,15 +20,22 @@ public class GuiCaner extends AEBaseScreen implements IActionHolder { private final Map> actions = new Object2ObjectOpenHashMap<>(); + private final CycleEPPButton modeBtn; public GuiCaner(ContainerCaner menu, Inventory playerInventory, Component title, ScreenStyle style) { super(menu, playerInventory, title, style); - var modeBtn = new CycleEPPButton(); - modeBtn.addActionPair(EPPIcon.FILLED, Component.translatable("gui.extendedae.caner.fill"), b -> EAENetworkServer.INSTANCE.sendToServer(new CGenericPacket("set", CanerMode.EMPTY.ordinal()))); - modeBtn.addActionPair(EPPIcon.BUCKET, Component.translatable("gui.extendedae.caner.empty"), b -> EAENetworkServer.INSTANCE.sendToServer(new CGenericPacket("set", CanerMode.FILL.ordinal()))); - this.actions.put("init", o -> modeBtn.setState((Integer) o[0])); + this.modeBtn = new CycleEPPButton(); + this.modeBtn.addActionPair(EPPIcon.FILLED, Component.translatable("gui.extendedae.caner.fill"), b -> EAENetworkServer.INSTANCE.sendToServer(new CGenericPacket("set", CanerMode.EMPTY.ordinal()))); + this.modeBtn.addActionPair(EPPIcon.BUCKET, Component.translatable("gui.extendedae.caner.empty"), b -> EAENetworkServer.INSTANCE.sendToServer(new CGenericPacket("set", CanerMode.FILL.ordinal()))); + this.actions.put("init", o -> this.modeBtn.setState((Integer) o[0])); EAENetworkServer.INSTANCE.sendToServer(new CGenericPacket("update")); - addToLeftToolbar(modeBtn); + addToLeftToolbar(this.modeBtn); + } + + @Override + protected void updateBeforeRender() { + super.updateBeforeRender(); + this.modeBtn.setState(menu.getMode().ordinal()); } @NotNull diff --git a/src/main/java/com/github/glodblock/extendedae/client/gui/GuiThresholdExportBus.java b/src/main/java/com/github/glodblock/extendedae/client/gui/GuiThresholdExportBus.java new file mode 100644 index 00000000..b0bf0c60 --- /dev/null +++ b/src/main/java/com/github/glodblock/extendedae/client/gui/GuiThresholdExportBus.java @@ -0,0 +1,138 @@ +package com.github.glodblock.extendedae.client.gui; + +import appeng.api.config.RedstoneMode; +import appeng.api.config.SchedulingMode; +import appeng.api.config.Settings; +import appeng.api.stacks.GenericStack; +import appeng.client.gui.implementations.UpgradeableScreen; +import appeng.client.gui.style.PaletteColor; +import appeng.client.gui.style.ScreenStyle; +import appeng.client.gui.widgets.ServerSettingToggleButton; +import appeng.client.gui.widgets.SettingToggleButton; +import appeng.core.definitions.AEItems; +import appeng.core.localization.ButtonToolTips; +import appeng.core.localization.Tooltips; +import appeng.core.sync.network.NetworkHandler; +import appeng.core.sync.packets.InventoryActionPacket; +import appeng.helpers.InventoryAction; +import com.github.glodblock.extendedae.api.ThresholdMode; +import com.github.glodblock.extendedae.client.button.CycleEPPButton; +import com.github.glodblock.extendedae.client.button.EPPIcon; +import com.github.glodblock.extendedae.client.gui.subgui.SetAmount; +import com.github.glodblock.extendedae.common.EAEItemAndBlock; +import com.github.glodblock.extendedae.container.ContainerThresholdExportBus; +import com.github.glodblock.extendedae.network.EAENetworkServer; +import com.github.glodblock.extendedae.network.packet.CGenericPacket; +import com.github.glodblock.extendedae.network.packet.sync.IActionHolder; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.network.chat.Component; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; +import org.jetbrains.annotations.NotNull; + +import java.util.ArrayList; +import java.util.Map; +import java.util.function.Consumer; + +public class GuiThresholdExportBus extends UpgradeableScreen implements IActionHolder { + + private final SettingToggleButton redstoneMode; + private final SettingToggleButton schedulingMode; + private final CycleEPPButton thresholdMode; + private final Map> actions = new Object2ObjectOpenHashMap<>(); + + public GuiThresholdExportBus(ContainerThresholdExportBus menu, Inventory playerInventory, Component title, ScreenStyle style) { + super(menu, playerInventory, title, style); + + this.redstoneMode = new ServerSettingToggleButton<>(Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE); + addToLeftToolbar(this.redstoneMode); + + if (menu.getHost().getConfigManager().hasSetting(Settings.SCHEDULING_MODE)) { + this.schedulingMode = new ServerSettingToggleButton<>(Settings.SCHEDULING_MODE, SchedulingMode.DEFAULT); + addToLeftToolbar(this.schedulingMode); + } else { + this.schedulingMode = null; + } + + this.thresholdMode = new CycleEPPButton(); + this.thresholdMode.addActionPair(EPPIcon.OVER_STACK, Component.translatable("gui.extendedae.threshold_export_bus.greater"), b -> EAENetworkServer.INSTANCE.sendToServer(new CGenericPacket("set", ThresholdMode.LOWER.ordinal()))); + this.thresholdMode.addActionPair(EPPIcon.BELOW_STACK, Component.translatable("gui.extendedae.threshold_export_bus.lower"), b -> EAENetworkServer.INSTANCE.sendToServer(new CGenericPacket("set", ThresholdMode.GREATER.ordinal()))); + this.actions.put("init", o -> this.thresholdMode.setState((Integer) o[0])); + EAENetworkServer.INSTANCE.sendToServer(new CGenericPacket("update")); + addToLeftToolbar(this.thresholdMode); + } + + @Override + protected void updateBeforeRender() { + super.updateBeforeRender(); + this.redstoneMode.set(menu.getRedStoneMode()); + this.redstoneMode.setVisibility(menu.hasUpgrade(AEItems.REDSTONE_CARD)); + if (this.schedulingMode != null) { + this.schedulingMode.set(menu.getSchedulingMode()); + } + this.thresholdMode.setState(menu.getMode().ordinal()); + } + + @Override + public boolean mouseClicked(double xCoord, double yCoord, int btn) { + assert this.minecraft != null; + if (this.minecraft.options.keyPickItem.matchesMouse(btn)) { + var slot = this.findSlot(xCoord, yCoord); + if (isValidSlot(slot)) { + var currentStack = GenericStack.fromItemStack(slot.getItem()); + if (currentStack != null) { + var screen = new SetAmount<>( + this, + new ItemStack(EAEItemAndBlock.THRESHOLD_EXPORT_BUS), + currentStack, + newStack -> NetworkHandler.instance().sendToServer(new InventoryActionPacket( + InventoryAction.SET_FILTER, slot.index, + GenericStack.wrapInItemStack(newStack))), + false); + switchToScreen(screen); + return true; + } + } + } + return super.mouseClicked(xCoord, yCoord, btn); + } + + @Override + protected void renderTooltip(@NotNull GuiGraphics guiGraphics, int x, int y) { + if (this.menu.getCarried().isEmpty() && this.isValidSlot(this.hoveredSlot)) { + var itemTooltip = new ArrayList<>(getTooltipFromContainerItem(this.hoveredSlot.getItem())); + var unwrapped = GenericStack.fromItemStack(this.hoveredSlot.getItem()); + if (unwrapped != null) { + itemTooltip.add(Tooltips.getAmountTooltip(ButtonToolTips.Amount, unwrapped)); + } + itemTooltip.add(Tooltips.getSetAmountTooltip()); + drawTooltip(guiGraphics, x, y, itemTooltip); + } else { + super.renderTooltip(guiGraphics, x, y); + } + } + + @Override + public void drawFG(GuiGraphics guiGraphics, int offsetX, int offsetY, int mouseX, int mouseY) { + super.drawFG(guiGraphics, offsetX, offsetY, mouseX, mouseY); + var poseStack = guiGraphics.pose(); + poseStack.pushPose(); + poseStack.translate(10, 17, 0); + poseStack.scale(0.6f, 0.6f, 1); + var color = style.getColor(PaletteColor.DEFAULT_TEXT_COLOR); + guiGraphics.drawString(font, Component.translatable("gui.extendedae.precise_export_bus.set_amount"), 0, 0, color.toARGB(), false); + poseStack.popPose(); + } + + private boolean isValidSlot(Slot slot) { + return slot != null && slot.isActive() && slot.hasItem() && this.menu.isConfigSlot(slot); + } + + @NotNull + @Override + public Map> getActionMap() { + return this.actions; + } +} \ No newline at end of file diff --git a/src/main/java/com/github/glodblock/extendedae/common/EAEItemAndBlock.java b/src/main/java/com/github/glodblock/extendedae/common/EAEItemAndBlock.java index e96f049e..0aee1100 100644 --- a/src/main/java/com/github/glodblock/extendedae/common/EAEItemAndBlock.java +++ b/src/main/java/com/github/glodblock/extendedae/common/EAEItemAndBlock.java @@ -38,6 +38,7 @@ import com.github.glodblock.extendedae.common.parts.PartPreciseStorageBus; import com.github.glodblock.extendedae.common.parts.PartTagExportBus; import com.github.glodblock.extendedae.common.parts.PartTagStorageBus; +import com.github.glodblock.extendedae.common.parts.PartThresholdExportBus; import com.github.glodblock.extendedae.common.parts.PartThresholdLevelEmitter; import com.github.glodblock.extendedae.common.tileentities.TileCaner; import com.github.glodblock.extendedae.common.tileentities.TileCrystalFixer; @@ -89,6 +90,7 @@ public class EAEItemAndBlock { public static WirelessTerminalItem WIRELESS_EX_PAT; public static PartItem PRECISE_EXPORT_BUS; public static PartItem PRECISE_STORAGE_BUS; + public static PartItem THRESHOLD_EXPORT_BUS; public static BlockFishbig FISHBIG; public static void init(RegistryHandler regHandler) { @@ -138,6 +140,7 @@ public static void init(RegistryHandler regHandler) { } PRECISE_EXPORT_BUS = new PartItem<>(new Item.Properties(), PartPreciseExportBus.class, PartPreciseExportBus::new); PRECISE_STORAGE_BUS = new PartItem<>(new Item.Properties(), PartPreciseStorageBus.class, PartPreciseStorageBus::new); + THRESHOLD_EXPORT_BUS = new PartItem<>(new Item.Properties(), PartThresholdExportBus.class, PartThresholdExportBus::new); FISHBIG = new BlockFishbig(); regHandler.block("ex_pattern_provider", EX_PATTERN_PROVIDER, TileExPatternProvider.class, TileExPatternProvider::new); regHandler.block("ex_interface", EX_INTERFACE, TileExInterface.class, TileExInterface::new); @@ -175,6 +178,7 @@ public static void init(RegistryHandler regHandler) { regHandler.item("wireless_ex_pat", WIRELESS_EX_PAT); regHandler.item("precise_export_bus", PRECISE_EXPORT_BUS); regHandler.item("precise_storage_bus", PRECISE_STORAGE_BUS); + regHandler.item("threshold_export_bus", THRESHOLD_EXPORT_BUS); } } diff --git a/src/main/java/com/github/glodblock/extendedae/common/RegistryHandler.java b/src/main/java/com/github/glodblock/extendedae/common/RegistryHandler.java index a4b9b4b6..9618194e 100644 --- a/src/main/java/com/github/glodblock/extendedae/common/RegistryHandler.java +++ b/src/main/java/com/github/glodblock/extendedae/common/RegistryHandler.java @@ -37,6 +37,7 @@ import com.github.glodblock.extendedae.common.parts.PartPreciseStorageBus; import com.github.glodblock.extendedae.common.parts.PartTagExportBus; import com.github.glodblock.extendedae.common.parts.PartTagStorageBus; +import com.github.glodblock.extendedae.common.parts.PartThresholdExportBus; import com.github.glodblock.extendedae.common.parts.PartThresholdLevelEmitter; import com.github.glodblock.extendedae.common.tileentities.TileCaner; import com.github.glodblock.extendedae.common.tileentities.TileExCharger; @@ -65,6 +66,7 @@ import com.github.glodblock.extendedae.container.ContainerRenamer; import com.github.glodblock.extendedae.container.ContainerTagExportBus; import com.github.glodblock.extendedae.container.ContainerTagStorageBus; +import com.github.glodblock.extendedae.container.ContainerThresholdExportBus; import com.github.glodblock.extendedae.container.ContainerThresholdLevelEmitter; import com.github.glodblock.extendedae.container.ContainerWirelessConnector; import com.github.glodblock.extendedae.container.ContainerWirelessExPAT; @@ -186,6 +188,7 @@ private void onRegisterContainer() { registerMenuType("ex_ioport", ContainerExIOPort.TYPE); registerMenuType("precise_export_bus", ContainerPreciseExportBus.TYPE); registerMenuType("precise_storage_bus", ContainerPreciseStorageBus.TYPE); + registerMenuType("threshold_export_bus", ContainerThresholdExportBus.TYPE); if (EAE.checkMod("ae2wtlib")) { WTCommonLoad.container(); } @@ -264,6 +267,9 @@ private void registerUpgrade() { Upgrades.add(AEItems.CRAFTING_CARD, EAEItemAndBlock.PRECISE_EXPORT_BUS, 1); Upgrades.add(AEItems.CAPACITY_CARD, EAEItemAndBlock.PRECISE_STORAGE_BUS, 5); Upgrades.add(AEItems.VOID_CARD, EAEItemAndBlock.PRECISE_STORAGE_BUS, 1); + Upgrades.add(AEItems.CAPACITY_CARD, EAEItemAndBlock.THRESHOLD_EXPORT_BUS, 5); + Upgrades.add(AEItems.REDSTONE_CARD, EAEItemAndBlock.THRESHOLD_EXPORT_BUS, 1); + Upgrades.add(AEItems.SPEED_CARD, EAEItemAndBlock.THRESHOLD_EXPORT_BUS, 4); } @SuppressWarnings("all") @@ -328,6 +334,7 @@ private void onRegisterModels() { PartModels.registerModels(PartActiveFormationPlane.MODELS); PartModels.registerModels(PartPreciseExportBus.MODELS); PartModels.registerModels(PartPreciseStorageBus.MODEL_BASE); + PartModels.registerModels(PartThresholdExportBus.MODELS); } private void onRegisterRandomAPI() { diff --git a/src/main/java/com/github/glodblock/extendedae/common/parts/PartThresholdExportBus.java b/src/main/java/com/github/glodblock/extendedae/common/parts/PartThresholdExportBus.java new file mode 100644 index 00000000..7c9af300 --- /dev/null +++ b/src/main/java/com/github/glodblock/extendedae/common/parts/PartThresholdExportBus.java @@ -0,0 +1,150 @@ +package com.github.glodblock.extendedae.common.parts; + +import appeng.api.config.Settings; +import appeng.api.networking.IGrid; +import appeng.api.networking.storage.IStorageService; +import appeng.api.parts.IPartItem; +import appeng.api.parts.IPartModel; +import appeng.api.stacks.GenericStack; +import appeng.core.AppEngBase; +import appeng.parts.PartModel; +import appeng.parts.automation.ExportBusPart; +import appeng.parts.automation.StackWorldBehaviors; +import appeng.util.ConfigInventory; +import appeng.util.SettingsFrom; +import com.github.glodblock.extendedae.EAE; +import com.github.glodblock.extendedae.api.ThresholdMode; +import com.github.glodblock.extendedae.container.ContainerThresholdExportBus; +import com.github.glodblock.extendedae.util.Ae2Reflect; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.MenuType; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.Arrays; +import java.util.List; + +public class PartThresholdExportBus extends ExportBusPart { + + public static List MODELS = Arrays.asList( + new ResourceLocation(EAE.MODID, "part/threshold_export_bus_base"), + new ResourceLocation(AppEngBase.MOD_ID, "part/export_bus_on"), + new ResourceLocation(AppEngBase.MOD_ID, "part/export_bus_off"), + new ResourceLocation(AppEngBase.MOD_ID, "part/export_bus_has_channel") + ); + + public static final PartModel MODELS_OFF = new PartModel(MODELS.get(0), MODELS.get(2)); + public static final PartModel MODELS_ON = new PartModel(MODELS.get(0), MODELS.get(1)); + public static final PartModel MODELS_HAS_CHANNEL = new PartModel(MODELS.get(0), MODELS.get(3)); + private ConfigInventory config; + private ThresholdMode mode = ThresholdMode.GREATER; + + public PartThresholdExportBus(IPartItem partItem) { + super(partItem); + } + + public void setMode(ThresholdMode mode) { + this.mode = mode; + } + + public ThresholdMode getMode() { + return this.mode; + } + + @Override + public void readFromNBT(CompoundTag extra) { + super.readFromNBT(extra); + this.config.readFromChildTag(extra, "config2"); + this.mode = ThresholdMode.values()[extra.getByte("cmod")]; + } + + @Override + public void writeToNBT(CompoundTag extra) { + super.writeToNBT(extra); + this.config.writeToChildTag(extra, "config2"); + extra.putByte("cmod", (byte) this.mode.ordinal()); + } + + @Override + public ConfigInventory getConfig() { + if (this.config == null) { + this.config = ConfigInventory.configStacks(StackWorldBehaviors.hasExportStrategyFilter(), 63, () -> Ae2Reflect.updatePartState(this), true); + } + return this.config; + } + + @Override + public void importSettings(SettingsFrom mode, CompoundTag input, @Nullable Player player) { + super.importSettings(mode, input, player); + this.mode = ThresholdMode.values()[input.getByte("cmod")]; + } + + @Override + public void exportSettings(SettingsFrom mode, CompoundTag output) { + super.exportSettings(mode, output); + output.putByte("cmod", (byte) this.mode.ordinal()); + } + + @SuppressWarnings("UnstableApiUsage") + @Override + protected boolean doBusWork(IGrid grid) { + var storageService = grid.getStorageService(); + var schedulingMode = this.getConfigManager().getSetting(Settings.SCHEDULING_MODE); + + var context = Ae2Reflect.getExportContext(this, storageService, grid.getEnergyService()); + + int x; + for (x = 0; x < this.availableSlots() && context.hasOperationsLeft(); x++) { + final int slotToExport = this.getStartingSlot(schedulingMode, x); + var stack = getConfig().getStack(slotToExport); + if (stack == null || !checkAmount(stack, storageService)) { + continue; + } + var what = stack.what(); + var transferFactor = what.getAmountPerOperation(); + long amount = (long) context.getOperationsRemaining() * transferFactor; + amount = getExportStrategy().transfer(context, what, amount); + if (amount > 0) { + context.reduceOperationsRemaining(Math.max(1, amount / transferFactor)); + } + } + + // Round-robin should only advance if something was actually exported + if (context.hasDoneWork()) { + this.updateSchedulingMode(schedulingMode, x); + } + + return context.hasDoneWork(); + } + + private boolean checkAmount(@NotNull GenericStack stack, @NotNull IStorageService service) { + long thr = stack.amount(); + long stored = service.getCachedInventory().get(stack.what()); + if (this.mode == ThresholdMode.GREATER) { + return stored >= thr; + } else if (this.mode == ThresholdMode.LOWER) { + return stored <= thr; + } else { + return false; + } + } + + @Override + public IPartModel getStaticModels() { + if (this.isActive() && this.isPowered()) { + return MODELS_HAS_CHANNEL; + } else if (this.isPowered()) { + return MODELS_ON; + } else { + return MODELS_OFF; + } + } + + @Override + protected MenuType getMenuType() { + return ContainerThresholdExportBus.TYPE; + } + +} \ No newline at end of file diff --git a/src/main/java/com/github/glodblock/extendedae/container/ContainerCaner.java b/src/main/java/com/github/glodblock/extendedae/container/ContainerCaner.java index 166cbffc..f8b70471 100644 --- a/src/main/java/com/github/glodblock/extendedae/container/ContainerCaner.java +++ b/src/main/java/com/github/glodblock/extendedae/container/ContainerCaner.java @@ -58,6 +58,10 @@ public void setMode(int mode) { this.broadcastChanges(); } + public CanerMode getMode() { + return this.mode; + } + @NotNull @Override public Map> getActionMap() { diff --git a/src/main/java/com/github/glodblock/extendedae/container/ContainerThresholdExportBus.java b/src/main/java/com/github/glodblock/extendedae/container/ContainerThresholdExportBus.java new file mode 100644 index 00000000..ae02abcc --- /dev/null +++ b/src/main/java/com/github/glodblock/extendedae/container/ContainerThresholdExportBus.java @@ -0,0 +1,81 @@ +package com.github.glodblock.extendedae.container; + +import appeng.core.definitions.AEItems; +import appeng.menu.SlotSemantics; +import appeng.menu.guisync.GuiSync; +import appeng.menu.implementations.MenuTypeBuilder; +import appeng.menu.implementations.UpgradeableMenu; +import com.github.glodblock.extendedae.api.ThresholdMode; +import com.github.glodblock.extendedae.common.parts.PartThresholdExportBus; +import com.github.glodblock.extendedae.network.EAENetworkServer; +import com.github.glodblock.extendedae.network.packet.SGenericPacket; +import com.github.glodblock.extendedae.network.packet.sync.IActionHolder; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.inventory.MenuType; +import net.minecraft.world.inventory.Slot; +import org.jetbrains.annotations.NotNull; + +import java.util.Map; +import java.util.function.Consumer; + +public class ContainerThresholdExportBus extends UpgradeableMenu implements IActionHolder { + + public static final MenuType TYPE = MenuTypeBuilder + .create(ContainerThresholdExportBus::new, PartThresholdExportBus.class) + .build("threshold_export_bus"); + + private final Map> actions = new Object2ObjectOpenHashMap<>(); + @GuiSync(7) + private ThresholdMode mode = ThresholdMode.GREATER; + + public ContainerThresholdExportBus(int id, Inventory ip, PartThresholdExportBus host) { + super(TYPE, id, ip, host); + this.actions.put("set", o -> this.setMode((Integer) o[0])); + this.actions.put("update", o -> { + if (this.getPlayer() instanceof ServerPlayer sp) { + EAENetworkServer.INSTANCE.sendTo(new SGenericPacket("init", this.mode.ordinal()), sp); + } + }); + } + + @Override + protected void setupConfig() { + addExpandableConfigSlots(getHost().getConfig(), 2, 9, 5); + } + + @Override + public boolean isSlotEnabled(int idx) { + final int upgrades = getUpgrades().getInstalledUpgrades(AEItems.CAPACITY_CARD); + return upgrades > idx; + } + + public boolean isConfigSlot(Slot slot) { + return this.getSlots(SlotSemantics.CONFIG).contains(slot); + } + + @Override + public void broadcastChanges() { + super.broadcastChanges(); + if (this.mode != this.getHost().getMode()) { + this.mode = this.getHost().getMode(); + } + } + + public void setMode(int mode) { + this.getHost().setMode(ThresholdMode.values()[mode]); + this.broadcastChanges(); + } + + public ThresholdMode getMode() { + return this.mode; + } + + @NotNull + @Override + public Map> getActionMap() { + return this.actions; + } + +} \ No newline at end of file diff --git a/src/main/java/com/github/glodblock/extendedae/datagen/EAERecipeProvider.java b/src/main/java/com/github/glodblock/extendedae/datagen/EAERecipeProvider.java index 5838b226..90189b16 100644 --- a/src/main/java/com/github/glodblock/extendedae/datagen/EAERecipeProvider.java +++ b/src/main/java/com/github/glodblock/extendedae/datagen/EAERecipeProvider.java @@ -31,7 +31,7 @@ public EAERecipeProvider(FabricDataOutput p) { @Override public void buildRecipes(Consumer c) { - // Extended Parttern Provider + // Extended Pattern Provider ShapedRecipeBuilder .shaped(RecipeCategory.MISC, EAEItemAndBlock.EX_PATTERN_PROVIDER) .pattern("PC") @@ -414,6 +414,16 @@ public void buildRecipes(Consumer c) { .unlockedBy(C, has(AEParts.STORAGE_BUS)) .save(c, EAE.id("precise_storage_bus")); + // Threshold Export Bus + ShapedRecipeBuilder + .shaped(RecipeCategory.MISC, EAEItemAndBlock.THRESHOLD_EXPORT_BUS) + .pattern("LCE") + .define('L', AEParts.LEVEL_EMITTER) + .define('C', AEItems.LOGIC_PROCESSOR) + .define('E', AEParts.EXPORT_BUS) + .unlockedBy(C, has(AEParts.LEVEL_EMITTER)) + .save(c, EAE.id("threshold_export_bus")); + // Fishbig ShapedRecipeBuilder .shaped(RecipeCategory.MISC, EAEItemAndBlock.FISHBIG) diff --git a/src/main/java/com/github/glodblock/extendedae/mixins/MixinPatternAccessTerminalPacket.java b/src/main/java/com/github/glodblock/extendedae/mixins/MixinPatternAccessTerminalPacket.java index becffd55..1a89cdcf 100644 --- a/src/main/java/com/github/glodblock/extendedae/mixins/MixinPatternAccessTerminalPacket.java +++ b/src/main/java/com/github/glodblock/extendedae/mixins/MixinPatternAccessTerminalPacket.java @@ -36,7 +36,7 @@ public abstract class MixinPatternAccessTerminalPacket { cancellable = true ) private void handleExGui(Player player, CallbackInfo ci) { - if (Minecraft.getInstance().screen instanceof GuiExPatternTerminal patternAccessTerminal) { + if (Minecraft.getInstance().screen instanceof GuiExPatternTerminal patternAccessTerminal) { if (fullUpdate) { patternAccessTerminal.postFullUpdate(this.inventoryId, sortBy, group, inventorySize, slots); } else { diff --git a/src/main/resources/assets/ae2/screens/threshold_export_bus.json b/src/main/resources/assets/ae2/screens/threshold_export_bus.json new file mode 100644 index 00000000..35ece426 --- /dev/null +++ b/src/main/resources/assets/ae2/screens/threshold_export_bus.json @@ -0,0 +1,15 @@ +{ + "$schema": "schema.json", + "includes": ["io_bus.json"], + "text": { + "dialog_title": { + "text": { + "translate": "gui.extendedae.threshold_export_bus" + }, + "position": { + "left": 8, + "top": 6 + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/extendedae/ae2guide/epp_intro/threshold_export_bus.md b/src/main/resources/assets/extendedae/ae2guide/epp_intro/threshold_export_bus.md new file mode 100644 index 00000000..62d445e2 --- /dev/null +++ b/src/main/resources/assets/extendedae/ae2guide/epp_intro/threshold_export_bus.md @@ -0,0 +1,28 @@ +--- +navigation: + parent: epp_intro/epp_intro-index.md + title: ME Threshold Export Bus + icon: extendedae:threshold_export_bus +categories: +- extended devices +item_ids: +- extendedae:threshold_export_bus +--- + +# ME Threshold Export Bus + + + + + +ME Threshold Export Bus works when the quantity of an item that stored in ME network is above/below the threshold. + +## Example + +![GUI](../pic/thr_bus_gui1.png) + +The threshold of copper is set to 128, so it exports copper when the stored copper in network is over 128. + +![GUI](../pic/thr_bus_gui2.png) + +The threshold is same as above, but the mode is set to BELOW. it exports copper when the stored copper is below 128. \ No newline at end of file diff --git a/src/main/resources/assets/extendedae/ae2guide/pic/thr_bus_gui1.png b/src/main/resources/assets/extendedae/ae2guide/pic/thr_bus_gui1.png new file mode 100644 index 00000000..b4d457d9 Binary files /dev/null and b/src/main/resources/assets/extendedae/ae2guide/pic/thr_bus_gui1.png differ diff --git a/src/main/resources/assets/extendedae/ae2guide/pic/thr_bus_gui2.png b/src/main/resources/assets/extendedae/ae2guide/pic/thr_bus_gui2.png new file mode 100644 index 00000000..9664d0f3 Binary files /dev/null and b/src/main/resources/assets/extendedae/ae2guide/pic/thr_bus_gui2.png differ diff --git a/src/main/resources/assets/extendedae/ae2guide/structure/cable_threshold_export_bus.snbt b/src/main/resources/assets/extendedae/ae2guide/structure/cable_threshold_export_bus.snbt new file mode 100644 index 00000000..016401d9 --- /dev/null +++ b/src/main/resources/assets/extendedae/ae2guide/structure/cable_threshold_export_bus.snbt @@ -0,0 +1,11 @@ +{ + DataVersion: 3337, + size: [1, 1, 1], + data: [ + {pos: [0, 0, 0], state: "ae2:cable_bus{light_level:0,waterlogged:false}", nbt: {cable: {gn: {g: 27333L, k: -1L, p: 0}, id: "ae2:fluix_glass_cable", visual: {channelsDown: 1, connections: ["down"], missingChannel: 0b, powered: 1b}}, hasRedstone: 1, id: "ae2:cable_bus", up: {craft_only: "NO", fuzzy_mode: "IGNORE_ALL", gn: {g: 27333L, k: -1L, p: 0}, id: "extendedae:threshold_export_bus", nextSlot: 0, redstone_controlled: "IGNORE", scheduling_mode: "DEFAULT", visual: {missingChannel: 0b, powered: 1b}}, visual: {}}} + ], + entities: [], + palette: [ + "ae2:cable_bus{light_level:0,waterlogged:false}" + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/extendedae/lang/en_us.json b/src/main/resources/assets/extendedae/lang/en_us.json index 90af6497..735ef5e7 100644 --- a/src/main/resources/assets/extendedae/lang/en_us.json +++ b/src/main/resources/assets/extendedae/lang/en_us.json @@ -37,6 +37,7 @@ "item.extendedae.wireless_ex_pat": "Wireless Extended Pattern Access Terminal", "item.extendedae.precise_export_bus": "ME Precise Export Bus", "item.extendedae.precise_storage_bus": "ME Precise Storage Bus", + "item.extendedae.threshold_export_bus": "ME Threshold Export Bus", "infinity.tooltip": "It is an infinity source.", "packaged_device.error.tooltip": "Invalid", "packaged_device.tooltip": "Device: %s", @@ -106,6 +107,9 @@ "gui.extendedae.precise_export_bus": "ME Precise Export Bus", "gui.extendedae.precise_export_bus.set_amount": "Use mouse middle click to set amount", "gui.extendedae.precise_storage_bus": "ME Precise Storage Bus", + "gui.extendedae.threshold_export_bus": "ME Threshold Export Bus", + "gui.extendedae.threshold_export_bus.greater": "Work when above threshold", + "gui.extendedae.threshold_export_bus.lower": "Work when below threshold", "gui.pattern_view.craft.substitute": "Substitute: %s", "gui.pattern_view.craft.fluid_substitute": "Fluid Substitute: %s", "gui.wireless_connect.status.unconnected": "Unconnected", diff --git a/src/main/resources/assets/extendedae/lang/zh_cn.json b/src/main/resources/assets/extendedae/lang/zh_cn.json index 51d6eb40..2f7fcf6e 100644 --- a/src/main/resources/assets/extendedae/lang/zh_cn.json +++ b/src/main/resources/assets/extendedae/lang/zh_cn.json @@ -9,6 +9,9 @@ "block.extendedae.ex_inscriber": "扩展压印器", "block.extendedae.ex_charger": "扩展充能器", "block.extendedae.fishbig": "鱼玩偶", + "block.extendedae.caner": "ME装罐机", + "block.extendedae.crystal_fixer": "水晶修复器", + "block.extendedae.ex_io_port": "ME扩展IO端口", "item.extendedae.ex_pattern_provider_part": "ME扩展样板供应器", "item.extendedae.ex_interface_part": "ME扩展接口", "item.extendedae.pattern_provider_upgrade": "样板供应器升级", @@ -31,6 +34,10 @@ "item.extendedae.mod_storage_bus": "ME模组存储总线", "item.extendedae.mod_export_bus": "ME模组输出总线", "item.extendedae.active_formation_plane": "ME快捷成型面板", + "item.extendedae.wireless_ex_pat": "无线扩展样板管理终端", + "item.extendedae.precise_export_bus": "ME精确输出总线", + "item.extendedae.precise_storage_bus": "ME精确存储总线", + "item.extendedae.threshold_export_bus": "ME阈值输出总线", "infinity.tooltip": "我的力量,无穷无尽", "packaged_device.error.tooltip": "无效", "packaged_device.tooltip": "设备: %s", @@ -91,6 +98,18 @@ "gui.extendedae.mod_storage_bus.tooltip": "请输入模组名称或ID", "gui.extendedae.mod_export_bus": "ME模组输出总线", "gui.extendedae.active_formation_plane": "ME快捷成型面板", + "gui.extendedae.tag_storage_bus.whitelist": "白名单过滤器", + "gui.extendedae.tag_storage_bus.blacklist": "黑名单过滤器", + "gui.extendedae.caner": "ME装罐机", + "gui.extendedae.caner.fill": "填充模式", + "gui.extendedae.caner.empty": "排空模式", + "gui.extendedae.ex_io_port": "ME扩展IO端口", + "gui.extendedae.precise_export_bus": "ME精确输出总线", + "gui.extendedae.precise_export_bus.set_amount": "使用鼠标中键点击设置数量", + "gui.extendedae.precise_storage_bus": "ME精确存储总线", + "gui.extendedae.threshold_export_bus": "ME阈值输出总线", + "gui.extendedae.threshold_export_bus.greater": "高于阈值时工作", + "gui.extendedae.threshold_export_bus.lower": "低于阈值时工作", "gui.pattern_view.craft.substitute": "合成替换: %s", "gui.pattern_view.craft.fluid_substitute": "流体替换: %s", "gui.wireless_connect.status.unconnected": "尚未连接", @@ -120,5 +139,6 @@ "jade.wireless_connector.color": "颜色: %s", "config.jade.plugin_extendedae.jade_wireless": "ME无线连接器 颜色", "key.epp.viewpattern": "查看样板配置", - "key.epp.category": "AE2扩展" + "key.epp.category": "AE2扩展", + "jade.crystal_chamber.progress": "进度:%s" } \ No newline at end of file diff --git a/src/main/resources/assets/extendedae/models/item/threshold_export_bus.json b/src/main/resources/assets/extendedae/models/item/threshold_export_bus.json new file mode 100644 index 00000000..810ac3fe --- /dev/null +++ b/src/main/resources/assets/extendedae/models/item/threshold_export_bus.json @@ -0,0 +1,6 @@ +{ + "parent": "ae2:item/export_bus", + "textures": { + "front": "extendedae:part/threshold_export_bus" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/extendedae/models/part/threshold_export_bus_base.json b/src/main/resources/assets/extendedae/models/part/threshold_export_bus_base.json new file mode 100644 index 00000000..163a4a85 --- /dev/null +++ b/src/main/resources/assets/extendedae/models/part/threshold_export_bus_base.json @@ -0,0 +1,6 @@ +{ + "parent": "ae2:part/export_bus_base", + "textures": { + "front": "extendedae:part/threshold_export_bus" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/extendedae/textures/guis/nicons.png b/src/main/resources/assets/extendedae/textures/guis/nicons.png index 177fe505..40b71cab 100644 Binary files a/src/main/resources/assets/extendedae/textures/guis/nicons.png and b/src/main/resources/assets/extendedae/textures/guis/nicons.png differ diff --git a/src/main/resources/assets/extendedae/textures/part/threshold_export_bus.png b/src/main/resources/assets/extendedae/textures/part/threshold_export_bus.png new file mode 100644 index 00000000..01da935a Binary files /dev/null and b/src/main/resources/assets/extendedae/textures/part/threshold_export_bus.png differ