diff --git a/build.gradle b/build.gradle index 46b7c9ac..a8d864aa 100644 --- a/build.gradle +++ b/build.gradle @@ -214,7 +214,8 @@ dependencies { modImplementation("dev.latvian.mods:rhino-forge:${rhino_version}") modImplementation("dev.toma.configuration:configuration-forge-${minecraft_version}:${configuration_version}") modImplementation("dev.architectury:architectury-forge:${architectury_version}") - jarJar(modImplementation("appeng:appliedenergistics2-forge:${ae2_version}")) + modImplementation("appeng:appliedenergistics2-forge:${ae2_version}") + jarJar("appeng:appliedenergistics2-forge:${ae2_version}") modImplementation("org.appliedenergistics:guideme:${guideme_version}") modClientLocalRuntime("maven.modrinth:oculus:${oculus_version}") diff --git a/gradle.properties b/gradle.properties index fe010bca..4de265e6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -37,4 +37,4 @@ org.gradle.jvmargs=-Xmx1G ftblibrary_version = 2001.2.4 ftbteams_version = 2001.3.0 jade_version = 11.6.3 - ae2_version=15.4.10-cosmolite.32 + ae2_version=15.4.10-cosmolite.26 diff --git a/src/generated/resources/assets/monilabs/blockstates/ev_auto_charger_4x.json b/src/generated/resources/assets/monilabs/blockstates/ev_auto_charger_4x.json new file mode 100644 index 00000000..d2ae14f6 --- /dev/null +++ b/src/generated/resources/assets/monilabs/blockstates/ev_auto_charger_4x.json @@ -0,0 +1,28 @@ +{ + "variants": { + "facing=down": { + "model": "monilabs:block/machine/ev_auto_charger_4x", + "x": 90 + }, + "facing=east": { + "model": "monilabs:block/machine/ev_auto_charger_4x", + "y": 90 + }, + "facing=north": { + "model": "monilabs:block/machine/ev_auto_charger_4x" + }, + "facing=south": { + "model": "monilabs:block/machine/ev_auto_charger_4x", + "y": 180 + }, + "facing=up": { + "gtceu:z": 180, + "model": "monilabs:block/machine/ev_auto_charger_4x", + "x": 270 + }, + "facing=west": { + "model": "monilabs:block/machine/ev_auto_charger_4x", + "y": 270 + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/monilabs/blockstates/hv_auto_charger_4x.json b/src/generated/resources/assets/monilabs/blockstates/hv_auto_charger_4x.json new file mode 100644 index 00000000..0c9560fd --- /dev/null +++ b/src/generated/resources/assets/monilabs/blockstates/hv_auto_charger_4x.json @@ -0,0 +1,28 @@ +{ + "variants": { + "facing=down": { + "model": "monilabs:block/machine/hv_auto_charger_4x", + "x": 90 + }, + "facing=east": { + "model": "monilabs:block/machine/hv_auto_charger_4x", + "y": 90 + }, + "facing=north": { + "model": "monilabs:block/machine/hv_auto_charger_4x" + }, + "facing=south": { + "model": "monilabs:block/machine/hv_auto_charger_4x", + "y": 180 + }, + "facing=up": { + "gtceu:z": 180, + "model": "monilabs:block/machine/hv_auto_charger_4x", + "x": 270 + }, + "facing=west": { + "model": "monilabs:block/machine/hv_auto_charger_4x", + "y": 270 + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/monilabs/blockstates/iv_auto_charger_4x.json b/src/generated/resources/assets/monilabs/blockstates/iv_auto_charger_4x.json new file mode 100644 index 00000000..605b855c --- /dev/null +++ b/src/generated/resources/assets/monilabs/blockstates/iv_auto_charger_4x.json @@ -0,0 +1,28 @@ +{ + "variants": { + "facing=down": { + "model": "monilabs:block/machine/iv_auto_charger_4x", + "x": 90 + }, + "facing=east": { + "model": "monilabs:block/machine/iv_auto_charger_4x", + "y": 90 + }, + "facing=north": { + "model": "monilabs:block/machine/iv_auto_charger_4x" + }, + "facing=south": { + "model": "monilabs:block/machine/iv_auto_charger_4x", + "y": 180 + }, + "facing=up": { + "gtceu:z": 180, + "model": "monilabs:block/machine/iv_auto_charger_4x", + "x": 270 + }, + "facing=west": { + "model": "monilabs:block/machine/iv_auto_charger_4x", + "y": 270 + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/monilabs/blockstates/luv_auto_charger_4x.json b/src/generated/resources/assets/monilabs/blockstates/luv_auto_charger_4x.json new file mode 100644 index 00000000..2b48386e --- /dev/null +++ b/src/generated/resources/assets/monilabs/blockstates/luv_auto_charger_4x.json @@ -0,0 +1,28 @@ +{ + "variants": { + "facing=down": { + "model": "monilabs:block/machine/luv_auto_charger_4x", + "x": 90 + }, + "facing=east": { + "model": "monilabs:block/machine/luv_auto_charger_4x", + "y": 90 + }, + "facing=north": { + "model": "monilabs:block/machine/luv_auto_charger_4x" + }, + "facing=south": { + "model": "monilabs:block/machine/luv_auto_charger_4x", + "y": 180 + }, + "facing=up": { + "gtceu:z": 180, + "model": "monilabs:block/machine/luv_auto_charger_4x", + "x": 270 + }, + "facing=west": { + "model": "monilabs:block/machine/luv_auto_charger_4x", + "y": 270 + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/monilabs/blockstates/lv_auto_charger_4x.json b/src/generated/resources/assets/monilabs/blockstates/lv_auto_charger_4x.json new file mode 100644 index 00000000..d3d78ea5 --- /dev/null +++ b/src/generated/resources/assets/monilabs/blockstates/lv_auto_charger_4x.json @@ -0,0 +1,28 @@ +{ + "variants": { + "facing=down": { + "model": "monilabs:block/machine/lv_auto_charger_4x", + "x": 90 + }, + "facing=east": { + "model": "monilabs:block/machine/lv_auto_charger_4x", + "y": 90 + }, + "facing=north": { + "model": "monilabs:block/machine/lv_auto_charger_4x" + }, + "facing=south": { + "model": "monilabs:block/machine/lv_auto_charger_4x", + "y": 180 + }, + "facing=up": { + "gtceu:z": 180, + "model": "monilabs:block/machine/lv_auto_charger_4x", + "x": 270 + }, + "facing=west": { + "model": "monilabs:block/machine/lv_auto_charger_4x", + "y": 270 + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/monilabs/blockstates/mv_auto_charger_4x.json b/src/generated/resources/assets/monilabs/blockstates/mv_auto_charger_4x.json new file mode 100644 index 00000000..cba2b28d --- /dev/null +++ b/src/generated/resources/assets/monilabs/blockstates/mv_auto_charger_4x.json @@ -0,0 +1,28 @@ +{ + "variants": { + "facing=down": { + "model": "monilabs:block/machine/mv_auto_charger_4x", + "x": 90 + }, + "facing=east": { + "model": "monilabs:block/machine/mv_auto_charger_4x", + "y": 90 + }, + "facing=north": { + "model": "monilabs:block/machine/mv_auto_charger_4x" + }, + "facing=south": { + "model": "monilabs:block/machine/mv_auto_charger_4x", + "y": 180 + }, + "facing=up": { + "gtceu:z": 180, + "model": "monilabs:block/machine/mv_auto_charger_4x", + "x": 270 + }, + "facing=west": { + "model": "monilabs:block/machine/mv_auto_charger_4x", + "y": 270 + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/monilabs/blockstates/uhv_auto_charger_4x.json b/src/generated/resources/assets/monilabs/blockstates/uhv_auto_charger_4x.json new file mode 100644 index 00000000..40233999 --- /dev/null +++ b/src/generated/resources/assets/monilabs/blockstates/uhv_auto_charger_4x.json @@ -0,0 +1,28 @@ +{ + "variants": { + "facing=down": { + "model": "monilabs:block/machine/uhv_auto_charger_4x", + "x": 90 + }, + "facing=east": { + "model": "monilabs:block/machine/uhv_auto_charger_4x", + "y": 90 + }, + "facing=north": { + "model": "monilabs:block/machine/uhv_auto_charger_4x" + }, + "facing=south": { + "model": "monilabs:block/machine/uhv_auto_charger_4x", + "y": 180 + }, + "facing=up": { + "gtceu:z": 180, + "model": "monilabs:block/machine/uhv_auto_charger_4x", + "x": 270 + }, + "facing=west": { + "model": "monilabs:block/machine/uhv_auto_charger_4x", + "y": 270 + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/monilabs/blockstates/uv_auto_charger_4x.json b/src/generated/resources/assets/monilabs/blockstates/uv_auto_charger_4x.json new file mode 100644 index 00000000..e6dd2121 --- /dev/null +++ b/src/generated/resources/assets/monilabs/blockstates/uv_auto_charger_4x.json @@ -0,0 +1,28 @@ +{ + "variants": { + "facing=down": { + "model": "monilabs:block/machine/uv_auto_charger_4x", + "x": 90 + }, + "facing=east": { + "model": "monilabs:block/machine/uv_auto_charger_4x", + "y": 90 + }, + "facing=north": { + "model": "monilabs:block/machine/uv_auto_charger_4x" + }, + "facing=south": { + "model": "monilabs:block/machine/uv_auto_charger_4x", + "y": 180 + }, + "facing=up": { + "gtceu:z": 180, + "model": "monilabs:block/machine/uv_auto_charger_4x", + "x": 270 + }, + "facing=west": { + "model": "monilabs:block/machine/uv_auto_charger_4x", + "y": 270 + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/monilabs/blockstates/zpm_auto_charger_4x.json b/src/generated/resources/assets/monilabs/blockstates/zpm_auto_charger_4x.json new file mode 100644 index 00000000..314feca0 --- /dev/null +++ b/src/generated/resources/assets/monilabs/blockstates/zpm_auto_charger_4x.json @@ -0,0 +1,28 @@ +{ + "variants": { + "facing=down": { + "model": "monilabs:block/machine/zpm_auto_charger_4x", + "x": 90 + }, + "facing=east": { + "model": "monilabs:block/machine/zpm_auto_charger_4x", + "y": 90 + }, + "facing=north": { + "model": "monilabs:block/machine/zpm_auto_charger_4x" + }, + "facing=south": { + "model": "monilabs:block/machine/zpm_auto_charger_4x", + "y": 180 + }, + "facing=up": { + "gtceu:z": 180, + "model": "monilabs:block/machine/zpm_auto_charger_4x", + "x": 270 + }, + "facing=west": { + "model": "monilabs:block/machine/zpm_auto_charger_4x", + "y": 270 + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/monilabs/lang/en_ud.json b/src/generated/resources/assets/monilabs/lang/en_ud.json index fbfa1ec9..710c4f21 100644 --- a/src/generated/resources/assets/monilabs/lang/en_ud.json +++ b/src/generated/resources/assets/monilabs/lang/en_ud.json @@ -11,8 +11,13 @@ "block.monilabs.dimensional_stabilization_netherite_casing": "buısɐƆ ǝʇıɹǝɥʇǝN uoıʇɐzıןıqɐʇS ןɐuoısuǝɯıᗡ", "block.monilabs.elite_microverse_projector": "ɹoʇɔǝظoɹԀ ǝsɹǝʌoɹɔıW ǝʇıןƎ", "block.monilabs.eltz_casing": "buısɐƆ zʇןƎ", + "block.monilabs.ev_auto_charger_4x": "ɹǝbɹɐɥƆ oqɹn⟘ oʇnⱯ xㄣ ɹ§ǝbɐʇןoΛ ǝɯǝɹʇxƎϛ§", + "block.monilabs.hv_auto_charger_4x": "ɹǝbɹɐɥƆ oqɹn⟘ oʇnⱯ xㄣ ɹ§ǝbɐʇןoΛ ɥbıH9§", "block.monilabs.hyperbolic_microverse_projector": "ɹoʇɔǝظoɹԀ ǝsɹǝʌoɹɔıW ɔıןoqɹǝdʎH", + "block.monilabs.iv_auto_charger_4x": "ɹǝbɹɐɥƆ oqɹn⟘ oʇnⱯ xㄣ ɹ§ǝbɐʇןoΛ ǝuɐsuI6§", "block.monilabs.knowledge_transmission_array": "ʎɐɹɹⱯ uoıssıɯsuɐɹ⟘ ǝbpǝןʍouʞ", + "block.monilabs.luv_auto_charger_4x": "ɹǝbɹɐɥƆ oqɹn⟘ oʇnⱯ xㄣ ɹ§ǝbɐʇןoΛ snoɹɔıpnꞀp§", + "block.monilabs.lv_auto_charger_4x": "ɹǝbɹɐɥƆ oqɹn⟘ oʇnⱯ xㄣ ɹ§ǝbɐʇןoΛ ʍoꞀㄥ§", "block.monilabs.max_1024a_laser_source_hatch": "ɥɔʇɐH ǝɔɹnoS ɹǝsɐꞀ ɹ§Ɐǝ§ㄣᄅ0'Ɩ ɹ§XⱯWן§ɔ§", "block.monilabs.max_1024a_laser_target_hatch": "ɥɔʇɐH ʇǝbɹɐ⟘ ɹǝsɐꞀ ɹ§Ɐǝ§ㄣᄅ0'Ɩ ɹ§XⱯWן§ɔ§", "block.monilabs.max_256a_laser_source_hatch": "ɥɔʇɐH ǝɔɹnoS ɹǝsɐꞀ ɹ§Ɐǝ§9ϛᄅ ɹ§XⱯWן§ɔ§", @@ -22,6 +27,7 @@ "block.monilabs.microverse_casing": "buısɐƆ ǝsɹǝʌoɹɔıW", "block.monilabs.microverse_stability_sensor_hatch": "ɥɔʇɐH ɹosuǝS ʎʇıןıqɐʇS ǝsɹǝʌoɹɔıW", "block.monilabs.microverse_type_sensor_hatch": "ɥɔʇɐH ɹosuǝS ǝdʎ⟘ ǝsɹǝʌoɹɔıW", + "block.monilabs.mv_auto_charger_4x": "ɹǝbɹɐɥƆ oqɹn⟘ oʇnⱯ xㄣ ɹ§ǝbɐʇןoΛ ɯnıpǝWq§", "block.monilabs.prism_glass": "ssɐן⅁ ɯsıɹԀ", "block.monilabs.prismatic_crucible": "ǝןqıɔnɹƆ ɔıʇɐɯsıɹԀ", "block.monilabs.prismatic_focus": "snɔoℲ ɔıʇɐɯsıɹԀ", diff --git a/src/generated/resources/assets/monilabs/lang/en_us.json b/src/generated/resources/assets/monilabs/lang/en_us.json index 1658560d..e04a3249 100644 --- a/src/generated/resources/assets/monilabs/lang/en_us.json +++ b/src/generated/resources/assets/monilabs/lang/en_us.json @@ -11,8 +11,13 @@ "block.monilabs.dimensional_stabilization_netherite_casing": "Dimensional Stabilization Netherite Casing", "block.monilabs.elite_microverse_projector": "Elite Microverse Projector", "block.monilabs.eltz_casing": "Eltz Casing", + "block.monilabs.ev_auto_charger_4x": "§5Extreme Voltage§r 4x Auto Turbo Charger", + "block.monilabs.hv_auto_charger_4x": "§6High Voltage§r 4x Auto Turbo Charger", "block.monilabs.hyperbolic_microverse_projector": "Hyperbolic Microverse Projector", + "block.monilabs.iv_auto_charger_4x": "§9Insane Voltage§r 4x Auto Turbo Charger", "block.monilabs.knowledge_transmission_array": "Knowledge Transmission Array", + "block.monilabs.luv_auto_charger_4x": "§dLudicrous Voltage§r 4x Auto Turbo Charger", + "block.monilabs.lv_auto_charger_4x": "§7Low Voltage§r 4x Auto Turbo Charger", "block.monilabs.max_1024a_laser_source_hatch": "§c§lMAX§r 1,024§eA§r Laser Source Hatch", "block.monilabs.max_1024a_laser_target_hatch": "§c§lMAX§r 1,024§eA§r Laser Target Hatch", "block.monilabs.max_256a_laser_source_hatch": "§c§lMAX§r 256§eA§r Laser Source Hatch", @@ -22,6 +27,7 @@ "block.monilabs.microverse_casing": "Microverse Casing", "block.monilabs.microverse_stability_sensor_hatch": "Microverse Stability Sensor Hatch", "block.monilabs.microverse_type_sensor_hatch": "Microverse Type Sensor Hatch", + "block.monilabs.mv_auto_charger_4x": "§bMedium Voltage§r 4x Auto Turbo Charger", "block.monilabs.prism_glass": "Prism Glass", "block.monilabs.prismatic_crucible": "Prismatic Crucible", "block.monilabs.prismatic_focus": "Prismatic Focus", diff --git a/src/generated/resources/assets/monilabs/models/block/machine/ev_auto_charger_4x.json b/src/generated/resources/assets/monilabs/models/block/machine/ev_auto_charger_4x.json new file mode 100644 index 00000000..b0826cfe --- /dev/null +++ b/src/generated/resources/assets/monilabs/models/block/machine/ev_auto_charger_4x.json @@ -0,0 +1,42 @@ +{ + "parent": "minecraft:block/block", + "loader": "gtceu:machine", + "machine": "monilabs:ev_auto_charger_4x", + "variants": { + "charger_state=finished": { + "model": { + "parent": "gtceu:block/machine/template/sided/sided", + "textures": { + "bottom": "gtceu:block/casings/voltage/ev/bottom", + "overlay_front": "gtceu:block/machines/charger/overlay_charger_finished", + "overlay_front_emissive": "gtceu:block/machines/charger/overlay_charger_finished_emissive", + "side": "gtceu:block/casings/voltage/ev/side", + "top": "gtceu:block/casings/voltage/ev/top" + } + } + }, + "charger_state=idle": { + "model": { + "parent": "gtceu:block/machine/template/sided/sided", + "textures": { + "bottom": "gtceu:block/casings/voltage/ev/bottom", + "overlay_front": "gtceu:block/machines/charger/overlay_charger_idle", + "side": "gtceu:block/casings/voltage/ev/side", + "top": "gtceu:block/casings/voltage/ev/top" + } + } + }, + "charger_state=running": { + "model": { + "parent": "gtceu:block/machine/template/sided/sided", + "textures": { + "bottom": "gtceu:block/casings/voltage/ev/bottom", + "overlay_front": "gtceu:block/machines/charger/overlay_charger_running", + "overlay_front_emissive": "gtceu:block/machines/charger/overlay_charger_running_emissive", + "side": "gtceu:block/casings/voltage/ev/side", + "top": "gtceu:block/casings/voltage/ev/top" + } + } + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/monilabs/models/block/machine/hv_auto_charger_4x.json b/src/generated/resources/assets/monilabs/models/block/machine/hv_auto_charger_4x.json new file mode 100644 index 00000000..722f52c9 --- /dev/null +++ b/src/generated/resources/assets/monilabs/models/block/machine/hv_auto_charger_4x.json @@ -0,0 +1,42 @@ +{ + "parent": "minecraft:block/block", + "loader": "gtceu:machine", + "machine": "monilabs:hv_auto_charger_4x", + "variants": { + "charger_state=finished": { + "model": { + "parent": "gtceu:block/machine/template/sided/sided", + "textures": { + "bottom": "gtceu:block/casings/voltage/hv/bottom", + "overlay_front": "gtceu:block/machines/charger/overlay_charger_finished", + "overlay_front_emissive": "gtceu:block/machines/charger/overlay_charger_finished_emissive", + "side": "gtceu:block/casings/voltage/hv/side", + "top": "gtceu:block/casings/voltage/hv/top" + } + } + }, + "charger_state=idle": { + "model": { + "parent": "gtceu:block/machine/template/sided/sided", + "textures": { + "bottom": "gtceu:block/casings/voltage/hv/bottom", + "overlay_front": "gtceu:block/machines/charger/overlay_charger_idle", + "side": "gtceu:block/casings/voltage/hv/side", + "top": "gtceu:block/casings/voltage/hv/top" + } + } + }, + "charger_state=running": { + "model": { + "parent": "gtceu:block/machine/template/sided/sided", + "textures": { + "bottom": "gtceu:block/casings/voltage/hv/bottom", + "overlay_front": "gtceu:block/machines/charger/overlay_charger_running", + "overlay_front_emissive": "gtceu:block/machines/charger/overlay_charger_running_emissive", + "side": "gtceu:block/casings/voltage/hv/side", + "top": "gtceu:block/casings/voltage/hv/top" + } + } + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/monilabs/models/block/machine/iv_auto_charger_4x.json b/src/generated/resources/assets/monilabs/models/block/machine/iv_auto_charger_4x.json new file mode 100644 index 00000000..341c6902 --- /dev/null +++ b/src/generated/resources/assets/monilabs/models/block/machine/iv_auto_charger_4x.json @@ -0,0 +1,42 @@ +{ + "parent": "minecraft:block/block", + "loader": "gtceu:machine", + "machine": "monilabs:iv_auto_charger_4x", + "variants": { + "charger_state=finished": { + "model": { + "parent": "gtceu:block/machine/template/sided/sided", + "textures": { + "bottom": "gtceu:block/casings/voltage/iv/bottom", + "overlay_front": "gtceu:block/machines/charger/overlay_charger_finished", + "overlay_front_emissive": "gtceu:block/machines/charger/overlay_charger_finished_emissive", + "side": "gtceu:block/casings/voltage/iv/side", + "top": "gtceu:block/casings/voltage/iv/top" + } + } + }, + "charger_state=idle": { + "model": { + "parent": "gtceu:block/machine/template/sided/sided", + "textures": { + "bottom": "gtceu:block/casings/voltage/iv/bottom", + "overlay_front": "gtceu:block/machines/charger/overlay_charger_idle", + "side": "gtceu:block/casings/voltage/iv/side", + "top": "gtceu:block/casings/voltage/iv/top" + } + } + }, + "charger_state=running": { + "model": { + "parent": "gtceu:block/machine/template/sided/sided", + "textures": { + "bottom": "gtceu:block/casings/voltage/iv/bottom", + "overlay_front": "gtceu:block/machines/charger/overlay_charger_running", + "overlay_front_emissive": "gtceu:block/machines/charger/overlay_charger_running_emissive", + "side": "gtceu:block/casings/voltage/iv/side", + "top": "gtceu:block/casings/voltage/iv/top" + } + } + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/monilabs/models/block/machine/luv_auto_charger_4x.json b/src/generated/resources/assets/monilabs/models/block/machine/luv_auto_charger_4x.json new file mode 100644 index 00000000..45bd529d --- /dev/null +++ b/src/generated/resources/assets/monilabs/models/block/machine/luv_auto_charger_4x.json @@ -0,0 +1,42 @@ +{ + "parent": "minecraft:block/block", + "loader": "gtceu:machine", + "machine": "monilabs:luv_auto_charger_4x", + "variants": { + "charger_state=finished": { + "model": { + "parent": "gtceu:block/machine/template/sided/sided", + "textures": { + "bottom": "gtceu:block/casings/voltage/luv/bottom", + "overlay_front": "gtceu:block/machines/charger/overlay_charger_finished", + "overlay_front_emissive": "gtceu:block/machines/charger/overlay_charger_finished_emissive", + "side": "gtceu:block/casings/voltage/luv/side", + "top": "gtceu:block/casings/voltage/luv/top" + } + } + }, + "charger_state=idle": { + "model": { + "parent": "gtceu:block/machine/template/sided/sided", + "textures": { + "bottom": "gtceu:block/casings/voltage/luv/bottom", + "overlay_front": "gtceu:block/machines/charger/overlay_charger_idle", + "side": "gtceu:block/casings/voltage/luv/side", + "top": "gtceu:block/casings/voltage/luv/top" + } + } + }, + "charger_state=running": { + "model": { + "parent": "gtceu:block/machine/template/sided/sided", + "textures": { + "bottom": "gtceu:block/casings/voltage/luv/bottom", + "overlay_front": "gtceu:block/machines/charger/overlay_charger_running", + "overlay_front_emissive": "gtceu:block/machines/charger/overlay_charger_running_emissive", + "side": "gtceu:block/casings/voltage/luv/side", + "top": "gtceu:block/casings/voltage/luv/top" + } + } + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/monilabs/models/block/machine/lv_auto_charger_4x.json b/src/generated/resources/assets/monilabs/models/block/machine/lv_auto_charger_4x.json new file mode 100644 index 00000000..132555fa --- /dev/null +++ b/src/generated/resources/assets/monilabs/models/block/machine/lv_auto_charger_4x.json @@ -0,0 +1,42 @@ +{ + "parent": "minecraft:block/block", + "loader": "gtceu:machine", + "machine": "monilabs:lv_auto_charger_4x", + "variants": { + "charger_state=finished": { + "model": { + "parent": "gtceu:block/machine/template/sided/sided", + "textures": { + "bottom": "gtceu:block/casings/voltage/lv/bottom", + "overlay_front": "gtceu:block/machines/charger/overlay_charger_finished", + "overlay_front_emissive": "gtceu:block/machines/charger/overlay_charger_finished_emissive", + "side": "gtceu:block/casings/voltage/lv/side", + "top": "gtceu:block/casings/voltage/lv/top" + } + } + }, + "charger_state=idle": { + "model": { + "parent": "gtceu:block/machine/template/sided/sided", + "textures": { + "bottom": "gtceu:block/casings/voltage/lv/bottom", + "overlay_front": "gtceu:block/machines/charger/overlay_charger_idle", + "side": "gtceu:block/casings/voltage/lv/side", + "top": "gtceu:block/casings/voltage/lv/top" + } + } + }, + "charger_state=running": { + "model": { + "parent": "gtceu:block/machine/template/sided/sided", + "textures": { + "bottom": "gtceu:block/casings/voltage/lv/bottom", + "overlay_front": "gtceu:block/machines/charger/overlay_charger_running", + "overlay_front_emissive": "gtceu:block/machines/charger/overlay_charger_running_emissive", + "side": "gtceu:block/casings/voltage/lv/side", + "top": "gtceu:block/casings/voltage/lv/top" + } + } + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/monilabs/models/block/machine/mv_auto_charger_4x.json b/src/generated/resources/assets/monilabs/models/block/machine/mv_auto_charger_4x.json new file mode 100644 index 00000000..c8078af9 --- /dev/null +++ b/src/generated/resources/assets/monilabs/models/block/machine/mv_auto_charger_4x.json @@ -0,0 +1,42 @@ +{ + "parent": "minecraft:block/block", + "loader": "gtceu:machine", + "machine": "monilabs:mv_auto_charger_4x", + "variants": { + "charger_state=finished": { + "model": { + "parent": "gtceu:block/machine/template/sided/sided", + "textures": { + "bottom": "gtceu:block/casings/voltage/mv/bottom", + "overlay_front": "gtceu:block/machines/charger/overlay_charger_finished", + "overlay_front_emissive": "gtceu:block/machines/charger/overlay_charger_finished_emissive", + "side": "gtceu:block/casings/voltage/mv/side", + "top": "gtceu:block/casings/voltage/mv/top" + } + } + }, + "charger_state=idle": { + "model": { + "parent": "gtceu:block/machine/template/sided/sided", + "textures": { + "bottom": "gtceu:block/casings/voltage/mv/bottom", + "overlay_front": "gtceu:block/machines/charger/overlay_charger_idle", + "side": "gtceu:block/casings/voltage/mv/side", + "top": "gtceu:block/casings/voltage/mv/top" + } + } + }, + "charger_state=running": { + "model": { + "parent": "gtceu:block/machine/template/sided/sided", + "textures": { + "bottom": "gtceu:block/casings/voltage/mv/bottom", + "overlay_front": "gtceu:block/machines/charger/overlay_charger_running", + "overlay_front_emissive": "gtceu:block/machines/charger/overlay_charger_running_emissive", + "side": "gtceu:block/casings/voltage/mv/side", + "top": "gtceu:block/casings/voltage/mv/top" + } + } + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/monilabs/models/block/machine/uhv_auto_charger_4x.json b/src/generated/resources/assets/monilabs/models/block/machine/uhv_auto_charger_4x.json new file mode 100644 index 00000000..cd871f85 --- /dev/null +++ b/src/generated/resources/assets/monilabs/models/block/machine/uhv_auto_charger_4x.json @@ -0,0 +1,42 @@ +{ + "parent": "minecraft:block/block", + "loader": "gtceu:machine", + "machine": "monilabs:uhv_auto_charger_4x", + "variants": { + "charger_state=finished": { + "model": { + "parent": "gtceu:block/machine/template/sided/sided", + "textures": { + "bottom": "gtceu:block/casings/voltage/uhv/bottom", + "overlay_front": "gtceu:block/machines/charger/overlay_charger_finished", + "overlay_front_emissive": "gtceu:block/machines/charger/overlay_charger_finished_emissive", + "side": "gtceu:block/casings/voltage/uhv/side", + "top": "gtceu:block/casings/voltage/uhv/top" + } + } + }, + "charger_state=idle": { + "model": { + "parent": "gtceu:block/machine/template/sided/sided", + "textures": { + "bottom": "gtceu:block/casings/voltage/uhv/bottom", + "overlay_front": "gtceu:block/machines/charger/overlay_charger_idle", + "side": "gtceu:block/casings/voltage/uhv/side", + "top": "gtceu:block/casings/voltage/uhv/top" + } + } + }, + "charger_state=running": { + "model": { + "parent": "gtceu:block/machine/template/sided/sided", + "textures": { + "bottom": "gtceu:block/casings/voltage/uhv/bottom", + "overlay_front": "gtceu:block/machines/charger/overlay_charger_running", + "overlay_front_emissive": "gtceu:block/machines/charger/overlay_charger_running_emissive", + "side": "gtceu:block/casings/voltage/uhv/side", + "top": "gtceu:block/casings/voltage/uhv/top" + } + } + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/monilabs/models/block/machine/uv_auto_charger_4x.json b/src/generated/resources/assets/monilabs/models/block/machine/uv_auto_charger_4x.json new file mode 100644 index 00000000..aa4ba2cc --- /dev/null +++ b/src/generated/resources/assets/monilabs/models/block/machine/uv_auto_charger_4x.json @@ -0,0 +1,42 @@ +{ + "parent": "minecraft:block/block", + "loader": "gtceu:machine", + "machine": "monilabs:uv_auto_charger_4x", + "variants": { + "charger_state=finished": { + "model": { + "parent": "gtceu:block/machine/template/sided/sided", + "textures": { + "bottom": "gtceu:block/casings/voltage/uv/bottom", + "overlay_front": "gtceu:block/machines/charger/overlay_charger_finished", + "overlay_front_emissive": "gtceu:block/machines/charger/overlay_charger_finished_emissive", + "side": "gtceu:block/casings/voltage/uv/side", + "top": "gtceu:block/casings/voltage/uv/top" + } + } + }, + "charger_state=idle": { + "model": { + "parent": "gtceu:block/machine/template/sided/sided", + "textures": { + "bottom": "gtceu:block/casings/voltage/uv/bottom", + "overlay_front": "gtceu:block/machines/charger/overlay_charger_idle", + "side": "gtceu:block/casings/voltage/uv/side", + "top": "gtceu:block/casings/voltage/uv/top" + } + } + }, + "charger_state=running": { + "model": { + "parent": "gtceu:block/machine/template/sided/sided", + "textures": { + "bottom": "gtceu:block/casings/voltage/uv/bottom", + "overlay_front": "gtceu:block/machines/charger/overlay_charger_running", + "overlay_front_emissive": "gtceu:block/machines/charger/overlay_charger_running_emissive", + "side": "gtceu:block/casings/voltage/uv/side", + "top": "gtceu:block/casings/voltage/uv/top" + } + } + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/monilabs/models/block/machine/zpm_auto_charger_4x.json b/src/generated/resources/assets/monilabs/models/block/machine/zpm_auto_charger_4x.json new file mode 100644 index 00000000..8b2db144 --- /dev/null +++ b/src/generated/resources/assets/monilabs/models/block/machine/zpm_auto_charger_4x.json @@ -0,0 +1,42 @@ +{ + "parent": "minecraft:block/block", + "loader": "gtceu:machine", + "machine": "monilabs:zpm_auto_charger_4x", + "variants": { + "charger_state=finished": { + "model": { + "parent": "gtceu:block/machine/template/sided/sided", + "textures": { + "bottom": "gtceu:block/casings/voltage/zpm/bottom", + "overlay_front": "gtceu:block/machines/charger/overlay_charger_finished", + "overlay_front_emissive": "gtceu:block/machines/charger/overlay_charger_finished_emissive", + "side": "gtceu:block/casings/voltage/zpm/side", + "top": "gtceu:block/casings/voltage/zpm/top" + } + } + }, + "charger_state=idle": { + "model": { + "parent": "gtceu:block/machine/template/sided/sided", + "textures": { + "bottom": "gtceu:block/casings/voltage/zpm/bottom", + "overlay_front": "gtceu:block/machines/charger/overlay_charger_idle", + "side": "gtceu:block/casings/voltage/zpm/side", + "top": "gtceu:block/casings/voltage/zpm/top" + } + } + }, + "charger_state=running": { + "model": { + "parent": "gtceu:block/machine/template/sided/sided", + "textures": { + "bottom": "gtceu:block/casings/voltage/zpm/bottom", + "overlay_front": "gtceu:block/machines/charger/overlay_charger_running", + "overlay_front_emissive": "gtceu:block/machines/charger/overlay_charger_running_emissive", + "side": "gtceu:block/casings/voltage/zpm/side", + "top": "gtceu:block/casings/voltage/zpm/top" + } + } + } + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/monilabs/models/item/ev_auto_charger_4x.json b/src/generated/resources/assets/monilabs/models/item/ev_auto_charger_4x.json new file mode 100644 index 00000000..8015233d --- /dev/null +++ b/src/generated/resources/assets/monilabs/models/item/ev_auto_charger_4x.json @@ -0,0 +1,3 @@ +{ + "parent": "monilabs:block/machine/ev_auto_charger_4x" +} \ No newline at end of file diff --git a/src/generated/resources/assets/monilabs/models/item/hv_auto_charger_4x.json b/src/generated/resources/assets/monilabs/models/item/hv_auto_charger_4x.json new file mode 100644 index 00000000..67a6bd2f --- /dev/null +++ b/src/generated/resources/assets/monilabs/models/item/hv_auto_charger_4x.json @@ -0,0 +1,3 @@ +{ + "parent": "monilabs:block/machine/hv_auto_charger_4x" +} \ No newline at end of file diff --git a/src/generated/resources/assets/monilabs/models/item/iv_auto_charger_4x.json b/src/generated/resources/assets/monilabs/models/item/iv_auto_charger_4x.json new file mode 100644 index 00000000..2f5c597a --- /dev/null +++ b/src/generated/resources/assets/monilabs/models/item/iv_auto_charger_4x.json @@ -0,0 +1,3 @@ +{ + "parent": "monilabs:block/machine/iv_auto_charger_4x" +} \ No newline at end of file diff --git a/src/generated/resources/assets/monilabs/models/item/luv_auto_charger_4x.json b/src/generated/resources/assets/monilabs/models/item/luv_auto_charger_4x.json new file mode 100644 index 00000000..35041c80 --- /dev/null +++ b/src/generated/resources/assets/monilabs/models/item/luv_auto_charger_4x.json @@ -0,0 +1,3 @@ +{ + "parent": "monilabs:block/machine/luv_auto_charger_4x" +} \ No newline at end of file diff --git a/src/generated/resources/assets/monilabs/models/item/lv_auto_charger_4x.json b/src/generated/resources/assets/monilabs/models/item/lv_auto_charger_4x.json new file mode 100644 index 00000000..2ccb27bd --- /dev/null +++ b/src/generated/resources/assets/monilabs/models/item/lv_auto_charger_4x.json @@ -0,0 +1,3 @@ +{ + "parent": "monilabs:block/machine/lv_auto_charger_4x" +} \ No newline at end of file diff --git a/src/generated/resources/assets/monilabs/models/item/mv_auto_charger_4x.json b/src/generated/resources/assets/monilabs/models/item/mv_auto_charger_4x.json new file mode 100644 index 00000000..d6e58cc0 --- /dev/null +++ b/src/generated/resources/assets/monilabs/models/item/mv_auto_charger_4x.json @@ -0,0 +1,3 @@ +{ + "parent": "monilabs:block/machine/mv_auto_charger_4x" +} \ No newline at end of file diff --git a/src/generated/resources/assets/monilabs/models/item/uhv_auto_charger_4x.json b/src/generated/resources/assets/monilabs/models/item/uhv_auto_charger_4x.json new file mode 100644 index 00000000..6479eef3 --- /dev/null +++ b/src/generated/resources/assets/monilabs/models/item/uhv_auto_charger_4x.json @@ -0,0 +1,3 @@ +{ + "parent": "monilabs:block/machine/uhv_auto_charger_4x" +} \ No newline at end of file diff --git a/src/generated/resources/assets/monilabs/models/item/uv_auto_charger_4x.json b/src/generated/resources/assets/monilabs/models/item/uv_auto_charger_4x.json new file mode 100644 index 00000000..7518e709 --- /dev/null +++ b/src/generated/resources/assets/monilabs/models/item/uv_auto_charger_4x.json @@ -0,0 +1,3 @@ +{ + "parent": "monilabs:block/machine/uv_auto_charger_4x" +} \ No newline at end of file diff --git a/src/generated/resources/assets/monilabs/models/item/zpm_auto_charger_4x.json b/src/generated/resources/assets/monilabs/models/item/zpm_auto_charger_4x.json new file mode 100644 index 00000000..6303fbe2 --- /dev/null +++ b/src/generated/resources/assets/monilabs/models/item/zpm_auto_charger_4x.json @@ -0,0 +1,3 @@ +{ + "parent": "monilabs:block/machine/zpm_auto_charger_4x" +} \ No newline at end of file diff --git a/src/main/java/net/neganote/monilabs/common/machine/AutoChargerMachine.java b/src/main/java/net/neganote/monilabs/common/machine/AutoChargerMachine.java new file mode 100644 index 00000000..3d729d5f --- /dev/null +++ b/src/main/java/net/neganote/monilabs/common/machine/AutoChargerMachine.java @@ -0,0 +1,407 @@ +package net.neganote.monilabs.common.machine; + +import com.gregtechceu.gtceu.api.GTValues; +import com.gregtechceu.gtceu.api.capability.*; +import com.gregtechceu.gtceu.api.capability.compat.FeCompat; +import com.gregtechceu.gtceu.api.capability.recipe.IO; +import com.gregtechceu.gtceu.api.gui.GuiTextures; +import com.gregtechceu.gtceu.api.gui.fancy.ConfiguratorPanel; +import com.gregtechceu.gtceu.api.gui.fancy.IFancyConfiguratorButton; +import com.gregtechceu.gtceu.api.gui.widget.SlotWidget; +import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; +import com.gregtechceu.gtceu.api.machine.TickableSubscription; +import com.gregtechceu.gtceu.api.machine.TieredEnergyMachine; +import com.gregtechceu.gtceu.api.machine.feature.IAutoOutputItem; +import com.gregtechceu.gtceu.api.machine.feature.IFancyUIMachine; +import com.gregtechceu.gtceu.api.machine.feature.IMachineLife; +import com.gregtechceu.gtceu.api.machine.property.GTMachineModelProperties; +import com.gregtechceu.gtceu.api.machine.trait.NotifiableEnergyContainer; +import com.gregtechceu.gtceu.api.machine.trait.NotifiableItemStackHandler; +import com.gregtechceu.gtceu.common.machine.electric.ChargerMachine; +import com.gregtechceu.gtceu.config.ConfigHolder; +import com.gregtechceu.gtceu.utils.GTTransferUtils; +import com.gregtechceu.gtceu.utils.GTUtil; + +import com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup; +import com.lowdragmc.lowdraglib.gui.widget.Widget; +import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; +import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; +import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; +import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; +import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; +import com.lowdragmc.lowdraglib.utils.Position; + +import net.minecraft.MethodsReturnNonnullByDefault; +import net.minecraft.core.Direction; +import net.minecraft.world.item.ItemStack; +import net.minecraftforge.energy.IEnergyStorage; +import net.minecraftforge.items.ItemHandlerHelper; + +import org.jetbrains.annotations.Nullable; + +import java.util.ArrayList; +import java.util.List; + +import javax.annotation.ParametersAreNonnullByDefault; + +@ParametersAreNonnullByDefault +@MethodsReturnNonnullByDefault +public class AutoChargerMachine extends TieredEnergyMachine + implements IFancyUIMachine, IMachineLife, IAutoOutputItem { + + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(AutoChargerMachine.class, + TieredEnergyMachine.MANAGED_FIELD_HOLDER); + + public static final long AMPS_PER_ITEM = 4L; + private final int inventorySize; + + @Persisted + private boolean isWorkingEnabled = true; + + @Persisted + protected final NotifiableItemStackHandler chargerInventory; + + @DescSynced + @RequireRerender + private ChargerMachine.State state = ChargerMachine.State.IDLE; + + @Persisted + @DescSynced + @RequireRerender + protected Direction outputFacingItems; + + @Persisted + @DescSynced + @RequireRerender + protected boolean autoOutputItems; + + @Persisted + protected boolean allowInputFromOutputSideItems; + + @Nullable + protected TickableSubscription autoOutputSubs; + + public AutoChargerMachine(IMachineBlockEntity holder, int tier, int inventorySize) { + super(holder, tier, inventorySize); + + this.chargerInventory = new NotifiableItemStackHandler(this, inventorySize, IO.BOTH); + this.chargerInventory.setFilter(stack -> GTCapabilityHelper.getElectricItem(stack) != null || + (ConfigHolder.INSTANCE.compat.energy.nativeEUToFE && + GTCapabilityHelper.getForgeEnergyItem(stack) != null)); + this.inventorySize = inventorySize; + + this.outputFacingItems = getFrontFacing().getOpposite(); + } + + @Override + public ManagedFieldHolder getFieldHolder() { + return MANAGED_FIELD_HOLDER; + } + + @Override + protected NotifiableEnergyContainer createEnergyContainer(Object... args) { + return new EnergyBatteryTrait((int) args[0]); + } + + private void changeState(ChargerMachine.State newState) { + if (this.state != newState) { + this.state = newState; + setRenderState(getRenderState().setValue(GTMachineModelProperties.CHARGER_STATE, newState)); + } + } + + @Override + public void onLoad() { + super.onLoad(); + if (!isRemote()) { + updateAutoOutputSubscription(); + this.chargerInventory.addChangedListener(this::updateAutoOutputSubscription); + } + } + + protected void updateAutoOutputSubscription() { + if (isAutoOutputItems() && !chargerInventory.isEmpty()) { + autoOutputSubs = subscribeServerTick(autoOutputSubs, this::autoOutput); + } else if (autoOutputSubs != null) { + autoOutputSubs.unsubscribe(); + autoOutputSubs = null; + } + } + + protected void autoOutput() { + if (getOffsetTimer() % 5 == 0 && isAutoOutputItems()) { + boolean exported = false; + for (int i = 0; i < chargerInventory.getSlots(); i++) { + ItemStack stack = chargerInventory.getStackInSlot(i); + if (stack.isEmpty()) continue; + + if (isFullyCharged(stack)) { + final int slotIndex = i; + var handlerCap = GTTransferUtils.getItemHandler(getLevel(), getPos().relative(outputFacingItems), + outputFacingItems.getOpposite()); + + handlerCap.ifPresent(handler -> { + ItemStack remainder = ItemHandlerHelper.insertItemStacked(handler, stack, false); + chargerInventory.setStackInSlot(slotIndex, remainder); + }); + + if (chargerInventory.getStackInSlot(slotIndex).getCount() != stack.getCount()) { + exported = true; + } + } + } + if (exported) markDirty(); + } + } + + @Override + public void attachConfigurators(ConfiguratorPanel panel) { + IFancyUIMachine.super.attachConfigurators(panel); + + panel.attachConfigurators(new IFancyConfiguratorButton.Toggle( + new GuiTextureGroup( + GuiTextures.TOGGLE_BUTTON_BACK.getSubTexture(0, 0, 1, 0.5f), + GuiTextures.IO_CONFIG_ITEM_MODES_BUTTON.getSubTexture(0, 1f / 3f, 1, 1f / 3f)), + new GuiTextureGroup( + GuiTextures.TOGGLE_BUTTON_BACK.getSubTexture(0, 0.5f, 1, 0.5f), + GuiTextures.IO_CONFIG_ITEM_MODES_BUTTON.getSubTexture(0, 2f / 3f, 1, 1f / 3f)), + this::isAutoOutputItems, + (cd, next) -> setAutoOutputItems(next))); + } + + private boolean isFullyCharged(ItemStack stack) { + var elec = GTCapabilityHelper.getElectricItem(stack); + if (elec != null) return elec.getCharge() >= elec.getMaxCharge(); + + var fe = GTCapabilityHelper.getForgeEnergyItem(stack); + if (fe != null) return fe.getEnergyStored() >= fe.getMaxEnergyStored(); + + return false; + } + + @Override + public boolean isAutoOutputItems() { + return this.autoOutputItems; + } + + @Override + public void setAutoOutputItems(boolean allow) { + this.autoOutputItems = allow; + updateAutoOutputSubscription(); + } + + @Override + public boolean isAllowInputFromOutputSideItems() { + return this.allowInputFromOutputSideItems; + } + + @Override + public void setAllowInputFromOutputSideItems(boolean b) { + this.allowInputFromOutputSideItems = b; + } + + @Override + public Direction getOutputFacingItems() { + return outputFacingItems; + } + + @Override + public void setOutputFacingItems(@Nullable Direction direction) { + this.outputFacingItems = direction == null ? getFrontFacing().getOpposite() : direction; + updateAutoOutputSubscription(); + } + + @Override + public Widget createUIWidget() { + int rowSize = (int) Math.sqrt(inventorySize); + int colSize = rowSize; + if (inventorySize == 8) { + rowSize = 4; + colSize = 2; + } + var template = new WidgetGroup(0, 0, 18 * rowSize + 8, 18 * colSize + 8); + template.setBackground(GuiTextures.BACKGROUND_INVERSE); + int index = 0; + for (int y = 0; y < colSize; y++) { + for (int x = 0; x < rowSize; x++) { + template.addWidget(new SlotWidget(chargerInventory, index++, 4 + x * 18, 4 + y * 18, true, true) + .setBackgroundTexture(new GuiTextureGroup(GuiTextures.SLOT, GuiTextures.CHARGER_OVERLAY))); + } + } + + var editableUI = createEnergyBar(); + var energyBar = editableUI.createDefault(); + + var group = new WidgetGroup(0, 0, + Math.max(energyBar.getSize().width + template.getSize().width + 4 + 8, 172), + Math.max(template.getSize().height + 8, energyBar.getSize().height + 8)); + var size = group.getSize(); + energyBar.setSelfPosition(new Position(3, (size.height - energyBar.getSize().height) / 2)); + template.setSelfPosition(new Position( + (size.width - energyBar.getSize().width - 4 - template.getSize().width) / 2 + 2 + + energyBar.getSize().width + 2, + (size.height - template.getSize().height) / 2)); + group.addWidget(energyBar); + group.addWidget(template); + editableUI.setupUI(group, this); + return group; + } + + protected class EnergyBatteryTrait extends NotifiableEnergyContainer { + + protected EnergyBatteryTrait(int invSize) { + super( + AutoChargerMachine.this, + GTValues.V[tier] * invSize * 32L, + GTValues.V[tier], + invSize * AMPS_PER_ITEM, + 0L, + 0L); + setSideInputCondition(side -> isWorkingEnabled); + setSideOutputCondition(side -> false); + } + + private List getNonFullElectricItem() { + List electricItems = new ArrayList<>(); + for (int i = 0; i < chargerInventory.getSlots(); i++) { + var electricItemStack = chargerInventory.getStackInSlot(i); + var electricItem = GTCapabilityHelper.getElectricItem(electricItemStack); + if (electricItem != null) { + if (electricItem.getCharge() < electricItem.getMaxCharge()) { + electricItems.add(electricItem); + } + } else if (ConfigHolder.INSTANCE.compat.energy.nativeEUToFE) { + var energyStorage = GTCapabilityHelper.getForgeEnergyItem(electricItemStack); + if (energyStorage != null) { + if (energyStorage.getEnergyStored() < energyStorage.getMaxEnergyStored()) { + electricItems.add(energyStorage); + } + } + } + } + return electricItems; + } + + private void changeState(ChargerMachine.State newState) { + if (state != newState) { + state = newState; + setRenderState(getRenderState().setValue(GTMachineModelProperties.CHARGER_STATE, newState)); + } + } + + @Override + public long acceptEnergyFromNetwork(@Nullable Direction side, long voltage, long amperage) { + var latestTimeStamp = getMachine().getOffsetTimer(); + if (lastTimeStamp < latestTimeStamp) { + amps = 0; + lastTimeStamp = latestTimeStamp; + } + if (amperage <= 0 || voltage <= 0) { + changeState(ChargerMachine.State.IDLE); + return 0; + } + + var electricItems = getNonFullElectricItem(); + var maxAmps = electricItems.size() * AMPS_PER_ITEM - amps; + var usedAmps = Math.min(maxAmps, amperage); + if (maxAmps <= 0) { + return 0; + } + + if (side == null || inputsEnergy(side)) { + if (voltage > getInputVoltage()) { + doExplosion(GTUtil.getExplosionPower(voltage)); + return usedAmps; + } + + long internalAmps = Math.min(maxAmps, Math.max(0, getInternalStorage() / voltage)); + + usedAmps = Math.min(usedAmps, maxAmps - internalAmps); + amps += usedAmps; + + long energy = (usedAmps + internalAmps) * voltage; + long distributed = energy / electricItems.size(); + + boolean changed = false; + for (var electricItem : electricItems) { + long charged = 0; + if (electricItem instanceof IElectricItem item) { + charged = item.charge(Math.min(distributed, GTValues.V[item.getTier()] * AMPS_PER_ITEM), + getTier(), true, false); + } else if (electricItem instanceof IEnergyStorage energyStorage) { + charged = FeCompat.insertEu(energyStorage, + Math.min(distributed, GTValues.V[getTier()] * AMPS_PER_ITEM), false); + } + if (charged > 0) { + changed = true; + } + energy -= charged; + energyInputPerSec += charged; + } + + if (changed) { + AutoChargerMachine.this.markDirty(); + changeState(ChargerMachine.State.RUNNING); + } + + setEnergyStored(getInternalStorage() - internalAmps * voltage + energy); + return usedAmps; + } + return 0; + } + + @Override + public long getEnergyCapacity() { + long energyCapacity = 0L; + for (int i = 0; i < chargerInventory.getSlots(); i++) { + var electricItemStack = chargerInventory.getStackInSlot(i); + var electricItem = GTCapabilityHelper.getElectricItem(electricItemStack); + if (electricItem != null) { + energyCapacity += electricItem.getMaxCharge(); + } else if (ConfigHolder.INSTANCE.compat.energy.nativeEUToFE) { + var energyStorage = GTCapabilityHelper.getForgeEnergyItem(electricItemStack); + if (energyStorage != null) { + energyCapacity += FeCompat.toEu(energyStorage.getMaxEnergyStored(), + FeCompat.ratio(false)); + } + } + } + + if (energyCapacity == 0) { + changeState(ChargerMachine.State.IDLE); + } + + return energyCapacity; + } + + @Override + public long getEnergyStored() { + long energyStored = 0L; + for (int i = 0; i < chargerInventory.getSlots(); i++) { + var electricItemStack = chargerInventory.getStackInSlot(i); + var electricItem = GTCapabilityHelper.getElectricItem(electricItemStack); + if (electricItem != null) { + energyStored += electricItem.getCharge(); + } else if (ConfigHolder.INSTANCE.compat.energy.nativeEUToFE) { + var energyStorage = GTCapabilityHelper.getForgeEnergyItem(electricItemStack); + if (energyStorage != null) { + energyStored += FeCompat.toEu(energyStorage.getEnergyStored(), + FeCompat.ratio(false)); + } + } + } + + var capacity = getEnergyCapacity(); + + if (capacity != 0 && capacity == energyStored) { + changeState(ChargerMachine.State.FINISHED); + } + + return energyStored; + } + + private long getInternalStorage() { + return energyStored; + } + } +} diff --git a/src/main/java/net/neganote/monilabs/common/machine/MoniMachines.java b/src/main/java/net/neganote/monilabs/common/machine/MoniMachines.java index 076ff14d..3b3ea9b1 100644 --- a/src/main/java/net/neganote/monilabs/common/machine/MoniMachines.java +++ b/src/main/java/net/neganote/monilabs/common/machine/MoniMachines.java @@ -23,11 +23,13 @@ import com.gregtechceu.gtceu.common.data.GTMaterials; import com.gregtechceu.gtceu.common.data.GTRecipeModifiers; import com.gregtechceu.gtceu.common.data.models.GTMachineModels; +import com.gregtechceu.gtceu.common.machine.electric.ChargerMachine; import com.gregtechceu.gtceu.common.machine.multiblock.part.EnergyHatchPartMachine; import com.gregtechceu.gtceu.common.machine.multiblock.part.LaserHatchPartMachine; import com.gregtechceu.gtceu.common.machine.multiblock.part.ParallelHatchPartMachine; import com.gregtechceu.gtceu.utils.FormattingUtil; +import net.minecraft.ChatFormatting; import net.minecraft.network.chat.Component; import net.minecraft.world.item.ItemStack; import net.minecraftforge.registries.ForgeRegistries; @@ -52,12 +54,10 @@ import java.util.function.BiFunction; import static com.gregtechceu.gtceu.api.GTValues.*; -import static com.gregtechceu.gtceu.api.GTValues.ZPM; import static com.gregtechceu.gtceu.api.capability.recipe.IO.IN; import static com.gregtechceu.gtceu.api.capability.recipe.IO.OUT; import static com.gregtechceu.gtceu.api.machine.property.GTMachineModelProperties.IS_FORMED; import static com.gregtechceu.gtceu.common.data.machines.GTMachineUtils.registerTieredMachines; -import static com.gregtechceu.gtceu.common.data.models.GTMachineModels.createWorkableTieredHullMachineModel; import static net.neganote.monilabs.MoniLabs.REGISTRATE; @SuppressWarnings("unused") @@ -81,6 +81,32 @@ public class MoniMachines { }; } + public static MachineDefinition[] registerCharger(int itemSlotSize) { + return registerCharger(REGISTRATE, itemSlotSize); + } + + public static MachineDefinition[] registerCharger(GTRegistrate registrate, int itemSlotSize) { + return registerTieredMachines(registrate, "auto_charger_" + itemSlotSize + "x", + (holder, tier) -> new AutoChargerMachine(holder, tier, itemSlotSize), + (tier, builder) -> builder + .rotationState(RotationState.ALL) + .modelProperty(GTMachineModelProperties.CHARGER_STATE, ChargerMachine.State.IDLE) + .model(GTMachineModels.createChargerModel()) + .langValue("%s %sx Auto Turbo Charger".formatted( + VCF[tier] + VOLTAGE_NAMES[tier] + ChatFormatting.RESET, + itemSlotSize)) + .tooltips(Component.translatable("gtceu.universal.tooltip.item_storage_capacity", itemSlotSize), + Component.translatable("gtceu.universal.tooltip.voltage_in_out", + FormattingUtil.formatNumbers(GTValues.V[tier]), + GTValues.VNF[tier]), + Component.translatable("gtceu.universal.tooltip.amperage_in_till", + itemSlotSize * ChargerMachine.AMPS_PER_ITEM)) + .register(), + GTValues.tiersBetween(LV, UHV)); + } + + public static final MachineDefinition[] CHARGER_4 = registerCharger(4); + public static final BiConsumer> PRISMATIC_TOOLTIPS = (stack, list) -> { list.add( Component.translatable("monilabs.tooltip.prismatic.0", @@ -172,43 +198,6 @@ public class MoniMachines { Component.translatable("tooltip.monilabs.hyperbolic_microverse_projector.description.2")); }; - public static final MachineDefinition[] PARALLEL_HATCH = registerTieredParallelMachines("parallel_hatch", - ParallelHatchPartMachine::new, - (tier, builder) -> builder - .langValue(switch (tier) { - case 9 -> "Giga"; - case 10 -> "Omega"; - default -> "Simple"; // Should never be hit. - } + " Parallel Control Hatch") - .rotationState(RotationState.ALL) - .abilities(PartAbility.PARALLEL_HATCH) - .modelProperty(IS_FORMED, false) - .modelProperty(GTMachineModelProperties.RECIPE_LOGIC_STATUS, RecipeLogic.Status.IDLE) - .model(createWorkableTieredHullMachineModel( - MoniLabs.id("block/machines/parallel_hatch_mk" + (tier - 4))) - .andThen((ctx, prov, model) -> { - model.addReplaceableTextures("bottom", "top", "side"); - })) - .tooltips(Component.translatable("gtceu.machine.parallel_hatch_mk" + tier + ".tooltip"), - Component.translatable("gtceu.part_sharing.disabled")) - .register(), - UHV, UEV); - - public static MachineDefinition[] registerTieredParallelMachines(String name, - BiFunction factory, - BiFunction, MachineDefinition> builder, - int... tiers) { - MachineDefinition[] definitions = new MachineDefinition[GTValues.TIER_COUNT]; - for (int tier : tiers) { - var register = REGISTRATE - .machine(GTValues.VN[tier].toLowerCase(Locale.ROOT) + "_" + name, - holder -> factory.apply(holder, tier)) - .tier(tier); - definitions[tier] = builder.apply(tier, register); - } - return definitions; - } - public static MachineDefinition CHROMA_SENSOR_HATCH = REGISTRATE .machine("chroma_sensor_hatch", ChromaSensorHatchPartMachine::new) .langValue("Chroma Sensor Hatch")