diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 6a01661edb..0000000000 --- a/.editorconfig +++ /dev/null @@ -1,5 +0,0 @@ -root = true - -[*.java] -indent_style = space -indent_size = 4 diff --git a/.github/actions/build_setup/action.yml b/.github/actions/build_setup/action.yml new file mode 100644 index 0000000000..754d3379e1 --- /dev/null +++ b/.github/actions/build_setup/action.yml @@ -0,0 +1,40 @@ +name: Build Setup +description: Setup for standard Java builds + +inputs: + update-cache: + description: If cache should be updated + required: false + default: true + +runs: + using: 'composite' + + steps: + - uses: actions/checkout@v4 + with: + submodules: true + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + distribution: adopt + java-version: 17 + + - name: Validate Gradle wrapper + uses: gradle/actions/wrapper-validation@v3 + + - name: Grant execute permission for gradlew + shell: bash + run: chmod +x gradlew + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + with: + cache-write-only: ${{ inputs.update-cache }} + generate-job-summary: false + gradle-home-cache-includes: | + caches + notifications + jdks + wrapper diff --git a/.github/workflows/auto-build.yml b/.github/workflows/auto-build.yml index 59becdc60f..71595de1bf 100644 --- a/.github/workflows/auto-build.yml +++ b/.github/workflows/auto-build.yml @@ -11,24 +11,18 @@ jobs: env: GITHUB_ACTION_NUMBER: ${{ vars.GITHUB_RUN_NUMBER }} GITHUB_RUN_NUMBER: ${{ vars.GITHUB_RUN_NUMBER }} + permissions: + contents: write steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true - - uses: actions/setup-java@v3 - with: - java-version: '17' - distribution: 'adopt' - - - name: Validate Gradle wrapper - uses: gradle/wrapper-validation-action@v1 - - - name: Grant execute permission for gradlew - run: chmod +x gradlew + - name: Setup Build + uses: ./.github/actions/build_setup - name: Build - uses: gradle/gradle-build-action@v2.4.2 + uses: gradle/gradle-build-action@v2 with: arguments: build @@ -36,12 +30,19 @@ jobs: id: var run: | MESSAGE=$(ls build/libs/* | grep sources.jar -v | grep shadow.jar -v | grep slim.jar -v | awk -F 'gtceu-|.jar' '{print $2}') - echo version=$MESSAGE >> $GITHUB_OUTPUT + echo "version=$MESSAGE" >> $GITHUB_OUTPUT - - name: release + - name: Release + id: release uses: Kir-Antipov/mc-publish@v3.3.0 with: github-tag: ${{ steps.var.outputs.version }} github-token: ${{ secrets.GITHUB_TOKEN }} files: | - build/libs/!(*-@(dev|sources|javadoc|dev-shadow)).jar + build/libs/!(*-@(dev|sources|javadoc)).jar + + - name: Print Output + run: | + echo "Release tag: ${{ steps.release.outputs.github-tag }}" + echo "Release URL: ${{ steps.release.outputs.github-url }}" + echo "Released files: ${{ steps.release.outputs.github-files }}" diff --git a/.github/workflows/auto-publish.yml b/.github/workflows/auto-publish.yml index 05c19d8cc0..29f55510d7 100644 --- a/.github/workflows/auto-publish.yml +++ b/.github/workflows/auto-publish.yml @@ -18,7 +18,7 @@ on: type: boolean default: true publishCurseForgeAndModrinth: - description: 'whether publish to the curseforge and modrinth' + description: 'whether to publish to curseforge and modrinth' required: true type: boolean default: true @@ -30,29 +30,26 @@ jobs: MAVEN_PASS: ${{ secrets.MAVEN_PASS }} MAVEN_USER: ${{ secrets.MAVEN_USER }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true - - uses: actions/setup-java@v3 + - uses: actions/setup-java@v4 with: java-version: '17' distribution: 'adopt' - - name: Validate Gradle wrapper - uses: gradle/wrapper-validation-action@v1 - - - name: Grant execute permission for gradlew - run: chmod +x gradlew + - name: Setup Build + uses: ./.github/actions/build_setup - name: Build - uses: gradle/gradle-build-action@v2.4.2 + uses: gradle/gradle-build-action@v2 with: arguments: build - if: ${{ inputs.publishMaven }} name: Publish to Maven - uses: gradle/gradle-build-action@v2.4.2 + uses: gradle/gradle-build-action@v2 with: arguments: publish diff --git a/.github/workflows/build-on-push.yml b/.github/workflows/build-on-push.yml index 1f0f86dd92..3941f2f555 100644 --- a/.github/workflows/build-on-push.yml +++ b/.github/workflows/build-on-push.yml @@ -11,23 +11,15 @@ jobs: GITHUB_ACTION_NUMBER: ${{ vars.GITHUB_RUN_NUMBER }} GITHUB_RUN_NUMBER: ${{ vars.GITHUB_RUN_NUMBER }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true - - uses: actions/setup-java@v3 - with: - java-version: '17' - distribution: 'adopt' - - - name: Validate Gradle wrapper - uses: gradle/wrapper-validation-action@v1 - - - name: Grant execute permission for gradlew - run: chmod +x gradlew + - name: Setup Build + uses: ./.github/actions/build_setup - name: Build - uses: gradle/gradle-build-action@v2.4.2 + uses: gradle/gradle-build-action@v2 with: arguments: build diff --git a/.github/workflows/format-java.yml b/.github/workflows/format-java.yml new file mode 100644 index 0000000000..e8d233df43 --- /dev/null +++ b/.github/workflows/format-java.yml @@ -0,0 +1,29 @@ +# Runs formatting requirements +name: Java Formatting + +on: + push: + branches: + - master + paths: ['src/main/java/**', 'src/test/**'] + pull_request: + paths: ['src/main/java/**', 'src/test/**'] + +concurrency: + group: formatting-${{ github.head_ref || github.ref }} + cancel-in-progress: true + +jobs: + formatting: + name: Formatting + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Setup Build + uses: ./.github/actions/build_setup + + - name: Run Spotless Formatting Check with Gradle + run: ./gradlew spotlessCheck --warning-mode all --build-cache diff --git a/build.gradle b/build.gradle index 77d4a1eef6..2caed50e94 100644 --- a/build.gradle +++ b/build.gradle @@ -6,6 +6,7 @@ plugins { alias libs.plugins.vineFlower // VineFlower, a better decompiler alias libs.plugins.machete // automatic jar compressing on build alias libs.plugins.shadow + alias libs.plugins.spotless } apply plugin: "dev.architectury.loom" @@ -37,6 +38,7 @@ apply from: "$rootDir/dependencies.gradle" apply from: "$rootDir/gradle/scripts/resources.gradle" apply from: "$rootDir/gradle/scripts/jars.gradle" apply from: "$rootDir/gradle/scripts/publishing.gradle" +apply from: "$rootDir/gradle/scripts/spotless.gradle" tasks.withType(JavaCompile) { options.encoding = "UTF-8" diff --git a/dependencies.gradle b/dependencies.gradle index 38ef5d2953..5a74ccf8d5 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -56,6 +56,7 @@ dependencies { // AE2 modImplementation(forge.ae2) { transitive = false } + modCompileOnly("curse.maven:ae2wtlib-459929:5217955") //AlmostUnified modCompileOnly(forge.almostUnified.forge) diff --git a/gradle/scripts/spotless.gradle b/gradle/scripts/spotless.gradle new file mode 100644 index 0000000000..46cd4be631 --- /dev/null +++ b/gradle/scripts/spotless.gradle @@ -0,0 +1,26 @@ +// Spotless auto-formatter +// See https://github.com/diffplug/spotless/tree/main/plugin-gradle +// Can be locally toggled via spotless:off/spotless:on comments +spotless { + encoding 'UTF-8' + + format 'misc', { + target '.gitignore' + + trimTrailingWhitespace() + indentWithSpaces(4) + endWithNewline() + } + java { + target 'src/main/java/**/*.java', 'src/test/java/**/*.java' + + def orderFile = file("$rootDir/spotless/spotless.importorder") + def formatFile = file("$rootDir/spotless/spotless.eclipseformat.xml") + + toggleOffOn() + importOrderFile(orderFile) + removeUnusedImports('cleanthat-javaparser-unnecessaryimport') + endWithNewline() + eclipse('4.31').configFile(formatFile) + } +} diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 84a0b92f9a..48c0a02ca4 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/settings.gradle b/settings.gradle index 010da243b9..59708265d9 100644 --- a/settings.gradle +++ b/settings.gradle @@ -19,7 +19,7 @@ dependencyResolutionManagement { // Mod Dependencies Versions // Common def jeiVersion = "15.2.0.27" - def reiVersion = "12.0.684" + def reiVersion = "12.1.725" def emiVersion = "1.0.30" def ae2Version = "15.0.18" def kjsVersion = "2001.6.4-build.120" @@ -38,6 +38,7 @@ dependencyResolutionManagement { def quiltMappingsVersion = "5" // https://lambdaurora.dev/tools/import_quilt.html def parchmentVersion = "2023.09.03" // https://parchmentmc.org/docs/getting-started def shadowVersion = "7.1.2" + def spotlessVersion = "6.25.0" def architecturyPluginVersion = "3.4-SNAPSHOT" def architecturyLoomVersion = "1.3-SNAPSHOT" def vineFlowerVersion = "1.+" @@ -115,6 +116,9 @@ dependencyResolutionManagement { def shadow = version("shadow", shadowVersion) plugin("shadow", "com.github.johnrengelman.shadow").versionRef(shadow) + def spotless = version("spotless", spotlessVersion) + plugin("spotless", "com.diffplug.spotless").versionRef(spotless) + def architecturyPlugin = version("architectury", architecturyPluginVersion) plugin("architectury", "architectury-plugin").versionRef(architecturyPlugin) diff --git a/spotless/spotless.eclipseformat.xml b/spotless/spotless.eclipseformat.xml new file mode 100644 index 0000000000..8db01de429 --- /dev/null +++ b/spotless/spotless.eclipseformat.xml @@ -0,0 +1,400 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spotless/spotless.importorder b/spotless/spotless.importorder new file mode 100644 index 0000000000..b697a17962 --- /dev/null +++ b/spotless/spotless.importorder @@ -0,0 +1,9 @@ +#Organize Import Order +#Sat May 27 02:13:47 CDT 2023 +0=com.gregtechceu +1=com.lowdragmc +1=net +2= +3=java +4=javax +5=\# \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/compass/nodes/generation/blackstone.json b/src/generated/resources/assets/gtceu/compass/nodes/generation/blackstone.json new file mode 100644 index 0000000000..e7aaf5e64b --- /dev/null +++ b/src/generated/resources/assets/gtceu/compass/nodes/generation/blackstone.json @@ -0,0 +1,127 @@ +{ + "button_texture": { + "type": "item", + "res": "gtceu:blackstone_aluminium_ore" + }, + "items": [ + "gtceu:blackstone_aluminium_ore", + "gtceu:blackstone_beryllium_ore", + "gtceu:blackstone_cobalt_ore", + "gtceu:blackstone_copper_ore", + "gtceu:blackstone_gold_ore", + "gtceu:blackstone_iron_ore", + "gtceu:blackstone_lead_ore", + "gtceu:blackstone_lithium_ore", + "gtceu:blackstone_molybdenum_ore", + "gtceu:blackstone_neodymium_ore", + "gtceu:blackstone_nickel_ore", + "gtceu:blackstone_palladium_ore", + "gtceu:blackstone_platinum_ore", + "gtceu:blackstone_plutonium_ore", + "gtceu:blackstone_silver_ore", + "gtceu:blackstone_sulfur_ore", + "gtceu:blackstone_thorium_ore", + "gtceu:blackstone_tin_ore", + "gtceu:blackstone_naquadah_ore", + "gtceu:blackstone_almandine_ore", + "gtceu:blackstone_asbestos_ore", + "gtceu:blackstone_hematite_ore", + "gtceu:blackstone_blue_topaz_ore", + "gtceu:blackstone_goethite_ore", + "gtceu:blackstone_calcite_ore", + "gtceu:blackstone_cassiterite_ore", + "gtceu:blackstone_cassiterite_sand_ore", + "gtceu:blackstone_chalcopyrite_ore", + "gtceu:blackstone_chromite_ore", + "gtceu:blackstone_cinnabar_ore", + "gtceu:blackstone_coal_ore", + "gtceu:blackstone_cobaltite_ore", + "gtceu:blackstone_cooperite_ore", + "gtceu:blackstone_diamond_ore", + "gtceu:blackstone_emerald_ore", + "gtceu:blackstone_galena_ore", + "gtceu:blackstone_garnierite_ore", + "gtceu:blackstone_green_sapphire_ore", + "gtceu:blackstone_grossular_ore", + "gtceu:blackstone_ilmenite_ore", + "gtceu:blackstone_bauxite_ore", + "gtceu:blackstone_lazurite_ore", + "gtceu:blackstone_magnesite_ore", + "gtceu:blackstone_magnetite_ore", + "gtceu:blackstone_molybdenite_ore", + "gtceu:blackstone_powellite_ore", + "gtceu:blackstone_pyrite_ore", + "gtceu:blackstone_pyrolusite_ore", + "gtceu:blackstone_pyrope_ore", + "gtceu:blackstone_rock_salt_ore", + "gtceu:blackstone_ruby_ore", + "gtceu:blackstone_salt_ore", + "gtceu:blackstone_saltpeter_ore", + "gtceu:blackstone_sapphire_ore", + "gtceu:blackstone_scheelite_ore", + "gtceu:blackstone_sodalite_ore", + "gtceu:blackstone_tantalite_ore", + "gtceu:blackstone_spessartine_ore", + "gtceu:blackstone_sphalerite_ore", + "gtceu:blackstone_stibnite_ore", + "gtceu:blackstone_tetrahedrite_ore", + "gtceu:blackstone_topaz_ore", + "gtceu:blackstone_tungstate_ore", + "gtceu:blackstone_uraninite_ore", + "gtceu:blackstone_wulfenite_ore", + "gtceu:blackstone_yellow_limonite_ore", + "gtceu:blackstone_nether_quartz_ore", + "gtceu:blackstone_certus_quartz_ore", + "gtceu:blackstone_quartzite_ore", + "gtceu:blackstone_graphite_ore", + "gtceu:blackstone_bornite_ore", + "gtceu:blackstone_chalcocite_ore", + "gtceu:blackstone_realgar_ore", + "gtceu:blackstone_bastnasite_ore", + "gtceu:blackstone_pentlandite_ore", + "gtceu:blackstone_spodumene_ore", + "gtceu:blackstone_lepidolite_ore", + "gtceu:blackstone_glauconite_sand_ore", + "gtceu:blackstone_malachite_ore", + "gtceu:blackstone_mica_ore", + "gtceu:blackstone_barite_ore", + "gtceu:blackstone_alunite_ore", + "gtceu:blackstone_talc_ore", + "gtceu:blackstone_soapstone_ore", + "gtceu:blackstone_kyanite_ore", + "gtceu:blackstone_pyrochlore_ore", + "gtceu:blackstone_oilsands_ore", + "gtceu:blackstone_olivine_ore", + "gtceu:blackstone_opal_ore", + "gtceu:blackstone_amethyst_ore", + "gtceu:blackstone_lapis_ore", + "gtceu:blackstone_apatite_ore", + "gtceu:blackstone_tricalcium_phosphate_ore", + "gtceu:blackstone_red_garnet_ore", + "gtceu:blackstone_yellow_garnet_ore", + "gtceu:blackstone_vanadium_magnetite_ore", + "gtceu:blackstone_pollucite_ore", + "gtceu:blackstone_bentonite_ore", + "gtceu:blackstone_fullers_earth_ore", + "gtceu:blackstone_pitchblende_ore", + "gtceu:blackstone_monazite_ore", + "gtceu:blackstone_trona_ore", + "gtceu:blackstone_gypsum_ore", + "gtceu:blackstone_zeolite_ore", + "gtceu:blackstone_redstone_ore", + "gtceu:blackstone_electrotine_ore", + "gtceu:blackstone_diatomite_ore", + "gtceu:blackstone_granitic_mineral_sand_ore", + "gtceu:blackstone_garnet_sand_ore", + "gtceu:blackstone_basaltic_mineral_sand_ore" + ], + "page": "gtceu:generation/blackstone", + "position": [ + -50, + 150 + ], + "pre_nodes": [ + "gtceu:generation/ore" + ], + "section": "gtceu:generation" +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/compass/nodes/generation/endstone.json b/src/generated/resources/assets/gtceu/compass/nodes/generation/endstone.json index ae8d8fec67..f3b450c854 100644 --- a/src/generated/resources/assets/gtceu/compass/nodes/generation/endstone.json +++ b/src/generated/resources/assets/gtceu/compass/nodes/generation/endstone.json @@ -117,8 +117,8 @@ ], "page": "gtceu:generation/endstone", "position": [ - -50, - 100 + -250, + 200 ], "pre_nodes": [ "gtceu:generation/ore" diff --git a/src/generated/resources/assets/gtceu/compass/nodes/misc/mold.json b/src/generated/resources/assets/gtceu/compass/nodes/misc/mold.json index 8bcc191d5c..95deb56cd4 100644 --- a/src/generated/resources/assets/gtceu/compass/nodes/misc/mold.json +++ b/src/generated/resources/assets/gtceu/compass/nodes/misc/mold.json @@ -16,7 +16,8 @@ "gtceu:anvil_casting_mold", "gtceu:name_casting_mold", "gtceu:small_gear_casting_mold", - "gtceu:rotor_casting_mold" + "gtceu:rotor_casting_mold", + "gtceu:pill_casting_mold" ], "page": "gtceu:misc/mold", "position": [ diff --git a/src/generated/resources/assets/gtceu/lang/en_ud.json b/src/generated/resources/assets/gtceu/lang/en_ud.json index 027b85f1b6..95a1367291 100644 --- a/src/generated/resources/assets/gtceu/lang/en_ud.json +++ b/src/generated/resources/assets/gtceu/lang/en_ud.json @@ -239,6 +239,7 @@ "block.gtceu.ev_transformer_4a": "ɹǝɯɹoɟsuɐɹ⟘ )xㄣ( dɯⱯ-ıH ǝbɐʇןoΛ ǝɯǝɹʇxƎ", "block.gtceu.ev_wiremill": "ɹ§III ןןıɯǝɹıM pǝɔuɐʌpⱯϛ§", "block.gtceu.ev_world_accelerator": "ɹ§III ɹoʇɐɹǝןǝɔɔⱯ pןɹoM pǝɔuɐʌpⱯϛ§", + "block.gtceu.evaporation_plant": "ɹǝʍo⟘ uoıʇɐɹodɐʌƎ", "block.gtceu.explosion_hazard_sign_block": "ʞɔoןᗺ ubıS pɹɐzɐH uoısoןdxƎ", "block.gtceu.explosive.breaking_tooltip": "dn ʞɔɐq ʞɔıd oʇ ǝuıɯ ʞɐǝus 'pǝuıɯ uǝɥʍ uoısoןdxǝ sǝɯıɹԀ", "block.gtceu.explosive.lighting_tooltip": "ǝuoʇspǝᴚ ɥʇıʍ ʇıן ǝq ʇouuɐƆ", @@ -952,6 +953,7 @@ "block.gtceu.square_marble_bricks": "sʞɔıɹᗺ ǝןqɹɐW ǝɹɐnbS", "block.gtceu.square_red_granite_bricks": "sʞɔıɹᗺ ǝʇıuɐɹ⅁ pǝᴚ ǝɹɐnbS", "block.gtceu.stable_machine_casing": "buısɐƆ ǝuıɥɔɐW ɯnıuɐʇı⟘ ǝןqɐʇS", + "block.gtceu.stainless_evaporation_casing": "buısɐƆ uoıʇɐɹodɐʌƎ ssǝןuıɐʇS", "block.gtceu.stainless_steel_crate": "ǝʇɐɹƆ ןǝǝʇS ssǝןuıɐʇS", "block.gtceu.stainless_steel_drum": "ɯnɹᗡ ןǝǝʇS ssǝןuıɐʇS", "block.gtceu.stainless_steel_gearbox": "buısɐƆ xoqɹɐǝ⅁ ןǝǝʇS ssǝןuıɐʇS", @@ -1645,6 +1647,7 @@ "compass.node.gtceu.ev/large_miner": "ɹǝuıW ǝbɹɐꞀ", "compass.node.gtceu.generation/andesite": "ǝʇısǝpuⱯ", "compass.node.gtceu.generation/basalt": "ʇןɐsɐᗺ", + "compass.node.gtceu.generation/blackstone": "ǝuoʇsʞɔɐןᗺ", "compass.node.gtceu.generation/deepslate": "ǝʇɐןsdǝǝᗡ", "compass.node.gtceu.generation/diorite": "ǝʇıɹoıᗡ", "compass.node.gtceu.generation/endstone": "ǝuoʇspuƎ", @@ -2008,6 +2011,7 @@ "compass.section.gtceu.uv": "ǝbɐʇןoΛ Λ∩Ɛ§", "compass.section.gtceu.zpm": "ǝbɐʇןoΛ WԀZɔ§", "config.gtceu.option.addLoot": "ʇooꞀppɐ", + "config.gtceu.option.ae2": "ᄅǝɐ", "config.gtceu.option.allUniqueStoneTypes": "sǝdʎ⟘ǝuoʇSǝnbıu∩ןןɐ", "config.gtceu.option.animationTime": "ǝɯı⟘uoıʇɐɯıuɐ", "config.gtceu.option.armorHud": "pnHɹoɯɹɐ", @@ -2036,6 +2040,7 @@ "config.gtceu.option.enableTieredCasings": "sbuısɐƆpǝɹǝı⟘ǝןqɐuǝ", "config.gtceu.option.enableWorldAccelerators": "sɹoʇɐɹǝןǝɔɔⱯpןɹoMǝןqɐuǝ", "config.gtceu.option.energy": "ʎbɹǝuǝ", + "config.gtceu.option.energyConsumption": "uoıʇdɯnsuoƆʎbɹǝuǝ", "config.gtceu.option.energyUsageMultiplier": "ɹǝıןdıʇןnWǝbɐs∩ʎbɹǝuǝ", "config.gtceu.option.euToPlatformRatio": "oıʇɐᴚɯɹoɟʇɐןԀo⟘nǝ", "config.gtceu.option.flintAndSteelRequireSteel": "ןǝǝʇSǝɹınbǝᴚןǝǝʇSpuⱯʇuıןɟ", @@ -2059,6 +2064,7 @@ "config.gtceu.option.hazardsEnabled": "pǝןqɐuƎspɹɐzɐɥ", "config.gtceu.option.hideFacadesInJEI": "IƎſuIsǝpɐɔɐℲǝpıɥ", "config.gtceu.option.hideFilledCellsInJEI": "IƎſuIsןןǝƆpǝןןıℲǝpıɥ", + "config.gtceu.option.hideOreProcessingDiagrams": "sɯɐɹbɐıᗡbuıssǝɔoɹԀǝɹOǝpıɥ", "config.gtceu.option.highTierContent": "ʇuǝʇuoƆɹǝı⟘ɥbıɥ", "config.gtceu.option.hudLocation": "uoıʇɐɔoꞀpnɥ", "config.gtceu.option.hudOffsetX": "XʇǝsɟɟOpnɥ", @@ -2071,6 +2077,9 @@ "config.gtceu.option.machineSounds": "spunoSǝuıɥɔɐɯ", "config.gtceu.option.machines": "sǝuıɥɔɐɯ", "config.gtceu.option.machinesEmissiveTextures": "sǝɹnʇxǝ⟘ǝʌıssıɯƎsǝuıɥɔɐɯ", + "config.gtceu.option.nanoSaber": "ɹǝqɐSouɐu", + "config.gtceu.option.nanoSaberBaseDamage": "ǝbɐɯɐᗡǝsɐᗺɹǝqɐSouɐu", + "config.gtceu.option.nanoSaberDamageBoost": "ʇsooᗺǝbɐɯɐᗡɹǝqɐSouɐu", "config.gtceu.option.nativeEUToPlatformNative": "ǝʌıʇɐNɯɹoɟʇɐןԀo⟘∩Ǝǝʌıʇɐu", "config.gtceu.option.nerfPaperCrafting": "buıʇɟɐɹƆɹǝdɐԀɟɹǝu", "config.gtceu.option.nerfWoodCrafting": "buıʇɟɐɹƆpooMɟɹǝu", @@ -2099,9 +2108,18 @@ "config.gtceu.option.toolCraftingSounds": "spunoSbuıʇɟɐɹƆןooʇ", "config.gtceu.option.toolUseSounds": "spunoSǝs∩ןooʇ", "config.gtceu.option.tools": "sןooʇ", + "config.gtceu.option.universalHazards": "spɹɐzɐHןɐsɹǝʌıun", "config.gtceu.option.useVBO": "OᗺΛǝsn", + "config.gtceu.option.voltageTierAdvImpeller": "ɹǝןןǝdɯIʌpⱯɹǝı⟘ǝbɐʇןoʌ", + "config.gtceu.option.voltageTierAdvNanoSuit": "ʇınSouɐNʌpⱯɹǝı⟘ǝbɐʇןoʌ", + "config.gtceu.option.voltageTierAdvQuarkTech": "ɥɔǝ⟘ʞɹɐnὉʌpⱯɹǝı⟘ǝbɐʇןoʌ", + "config.gtceu.option.voltageTierImpeller": "ɹǝןןǝdɯIɹǝı⟘ǝbɐʇןoʌ", + "config.gtceu.option.voltageTierNanoSuit": "ʇınSouɐNɹǝı⟘ǝbɐʇןoʌ", + "config.gtceu.option.voltageTierNightVision": "uoısıΛʇɥbıNɹǝı⟘ǝbɐʇןoʌ", + "config.gtceu.option.voltageTierQuarkTech": "ɥɔǝ⟘ʞɹɐnὉɹǝı⟘ǝbɐʇןoʌ", "config.gtceu.option.worldAcceleratorBlacklist": "ʇsıןʞɔɐןᗺɹoʇɐɹǝןǝɔɔⱯpןɹoʍ", "config.gtceu.option.worldgen": "uǝbpןɹoʍ", + "config.gtceu.option.zombieSpawnWithSabers": "sɹǝqɐSɥʇıMuʍɐdSǝıqɯoz", "config.jade.plugin_gtceu.controllable_provider": "ǝןqɐןןoɹʇuoƆ ]nƎƆ⟘⅁[", "config.jade.plugin_gtceu.electric_container_provider": "ɹǝuıɐʇuoƆ ɔıɹʇɔǝןƎ ]nƎƆ⟘⅁[", "config.jade.plugin_gtceu.recipe_logic_provider": "ɔıboꞀ ǝdıɔǝᴚ ]nƎƆ⟘⅁[", @@ -2307,6 +2325,7 @@ "death.attack.gtceu.wrench_hv": "%s ʎq pǝuǝsooן ǝɹǝʍ sǝdıd s,%s", "death.attack.gtceu.wrench_iv": "%s ʎq suɐןd ɹıǝɥʇ oʇuı uʍoɹɥʇ ɥɔuǝɹM ʎǝʞuoW ɐ pɐɥ %s", "death.attack.gtceu.wrench_lv": "%s ʎq pǝuǝsooן ǝɹǝʍ sǝdıd s,%s", + "effect.gtceu.weak_poison": "uosıoԀ ʞɐǝM", "enchantment.damage.disjunction": "uoıʇɔunظsıᗡ", "enchantment.disjunction": "uoıʇɔunظsıᗡ", "enchantment.gtceu.disjunction.desc": "˙sqoɯ pǝʇɐןǝɹ-ɹǝpuƎ oʇ ssǝuʍoןS puɐ ssǝuʞɐǝM sǝıןddⱯ", @@ -2406,6 +2425,7 @@ "gtceu.electric_furnace": "ǝɔɐuɹnℲ ɔıɹʇɔǝןƎ", "gtceu.electrolyzer": "ɹǝzʎןoɹʇɔǝןƎ", "gtceu.electromagnetic_separator": "ɹoʇɐɹɐdǝS ɔıʇǝubɐɯoɹʇɔǝןƎ", + "gtceu.evaporation": "uoıʇɐɹodɐʌƎ", "gtceu.extractor": "ɹoʇɔɐɹʇxƎ", "gtceu.extruder": "ɹǝpnɹʇxƎ", "gtceu.fermenter": "ɹǝʇuǝɯɹǝℲ", @@ -2526,11 +2546,16 @@ "gtceu.gui.title_bar.page_switcher": "sǝbɐԀ", "gtceu.gui.toggle_view.disabled": ")spınןℲ( ʍǝıΛ ǝןbbo⟘", "gtceu.gui.toggle_view.enabled": ")sɯǝʇI( ʍǝıΛ ǝןbbo⟘", + "gtceu.hazard.antidote.description": "sןıɐʇǝp ʍoɥs oʇ ʇɟıɥS pןoHㄥ§ ǝʇopıʇuⱯɐ§", + "gtceu.hazard.antidote.description.effect_removed": "sʇɔǝɟɟǝ ,sʇuǝɯןıɐ ʇuǝɹɹnɔ ɟo %s%% sǝʌoɯǝᴚ", + "gtceu.hazard.antidote.description.effect_removed.all": "sʇɔǝɟɟǝ ,sʇuǝɯןıɐ ʇuǝɹɹnɔ ɟo ןןɐ sǝʌoɯǝᴚ", + "gtceu.hazard.antidote.description_shift": ":sǝdʎʇ sǝɹnƆɐ§", "gtceu.hazard.contact_poison": "uosıoԀ ʇɔɐʇuoƆϛ§", "gtceu.hazard.corrosive": "ǝʌısoɹɹoƆ9§", "gtceu.hazard.description": "sןıɐʇǝp ʍoɥs oʇ ʇɟıɥS pןoHㄥ§ S∩OᗡᴚⱯZⱯHɔ§ן§", "gtceu.hazard.description_shift": ":S∩OᗡᴚⱯZⱯHɔ§ן§", "gtceu.hazard.inhalation_poison": "pǝןɐɥuı uǝɥʍ snouosıoԀᄅ§", + "gtceu.hazard.none": "snoɹǝbuɐᗡ ʇoNᄅ§", "gtceu.hazard.radioactive": "ǝʌıʇɔɐoıpɐᴚǝ§", "gtceu.implosion_compressor": "ɹossǝɹdɯoƆ uoısoןdɯI", "gtceu.io.both": "ɥʇoᗺ", @@ -3499,6 +3524,7 @@ "gtceu.recipe.scan_for_research": "ǝuıꞀ ʎןqɯǝssⱯ ɹoɟ uɐɔS", "gtceu.recipe.temperature": "ʞ%s :dɯǝ⟘", "gtceu.recipe.total": "∩Ǝ %s :ןɐʇo⟘", + "gtceu.recipe.total_computation": "∩MƆ %s :uoıʇɐʇndɯoƆ", "gtceu.recipe_logic.condition_fails": "sןıɐℲ uoıʇıpuoƆ", "gtceu.recipe_logic.insufficient_fuel": "ןǝnℲ ʇuǝıɔıɟɟnsuI", "gtceu.recipe_logic.insufficient_in": "sʇnduI ʇuǝıɔıɟɟnsuI", @@ -3857,6 +3883,7 @@ "item.gtceu.exquisite_glass_gem": "ןɐʇsʎɹƆ ssɐן⅁ ǝʇısınbxƎ", "item.gtceu.facade_cover": "ǝpɐɔɐℲ ɹǝʌoƆ %s", "item.gtceu.facade_cover.tooltip": "˙ㄥ§ɹǝʌoƆɟ§ ʇıɟʇnO ǝʌıʇɐɹoɔǝᗡㄥ§", + "item.gtceu.face_mask": "ʞsɐW ǝɔɐℲ", "item.gtceu.fertilizer": "ɹǝzıןıʇɹǝℲ", "item.gtceu.fiber_reinforced_circuit_board": "pɹɐoᗺ ʇınɔɹıƆ pǝɔɹoɟuıǝᴚ-ɹǝqıℲ", "item.gtceu.fiber_reinforced_circuit_board.tooltip": "pɹɐoᗺ ǝɯǝɹʇxƎ uⱯㄥ§", @@ -4192,6 +4219,7 @@ "item.gtceu.osmium_credit.tooltip": "sʇıpǝɹƆ 960ㄣㄥ§", "item.gtceu.palladium_raw_dust": "ɹǝpʍoԀ ɯnıpɐןןɐԀ ʍɐᴚ", "item.gtceu.paper_dust": "pɐɥƆ", + "item.gtceu.paracetamol_pill": "ןןıԀ ןoɯɐʇǝɔɐɹɐԀ", "item.gtceu.petri_dish": "ɥsıᗡ ıɹʇǝԀ", "item.gtceu.petri_dish.tooltip": "sןןǝƆ buıʇɐʌıʇןnɔ ɹoℲㄥ§", "item.gtceu.phenolic_circuit_board": "pɹɐoᗺ ʇınɔɹıƆ ɔıןouǝɥԀ", @@ -4203,6 +4231,7 @@ "item.gtceu.phosphorus_wafer": "ɹǝɟɐM pǝdop-snɹoɥdsoɥԀ", "item.gtceu.phosphorus_wafer.tooltip": "ʇınɔɹıƆ ʍɐᴚㄥ§", "item.gtceu.pickaxe_extruder_mold.tooltip": "sǝxɐʞɔıԀ buıʞɐɯ ɹoɟ ǝdɐɥS ɹǝpnɹʇxƎㄥ§", + "item.gtceu.pill_casting_mold": ")ןןıԀ( pןoW buıʇsɐƆ", "item.gtceu.pink_dye_spray_can": ")ʞuıԀ( uɐƆ ʎɐɹdS", "item.gtceu.pink_glass_lens": ")ʞuıԀ( suǝꞀ ssɐן⅁", "item.gtceu.pipe.huge_extruder_mold.tooltip": "sǝdıԀ ʞɔoןᗺ ןןnɟ buıʞɐɯ ɹoɟ ǝdɐɥS ɹǝpnɹʇxƎㄥ§", @@ -4271,6 +4300,7 @@ "item.gtceu.quarktech_helmet": "ʇǝɯןǝH ǝʇınS ™ɥɔǝ⟘ʞɹɐnὉ", "item.gtceu.quarktech_leggings": "sbuıbbǝꞀ ǝʇınS ™ɥɔǝ⟘ʞɹɐnὉ", "item.gtceu.quartz_sand_dust": "puɐS zʇɹɐnὉ", + "item.gtceu.rad_away_pill": "ןןıԀ ™ʎɐʍⱯpɐᴚ", "item.gtceu.ram_chip": "dıɥƆ WⱯᴚ", "item.gtceu.ram_chip.tooltip": "ʎɹoɯǝW ssǝɔɔⱯ ɯopuɐᴚㄥ§", "item.gtceu.ram_wafer": "ɹǝɟɐM WⱯᴚ", @@ -4304,6 +4334,7 @@ "item.gtceu.rotor_casting_mold.tooltip": "sɹoʇoᴚ buıʞɐɯ ɹoɟ pןoWㄥ§", "item.gtceu.rotor_extruder_mold": ")ɹoʇoᴚ( pןoW ɹǝpnɹʇxƎ", "item.gtceu.rotor_extruder_mold.tooltip": "sɹoʇoᴚ buıʞɐɯ ɹoɟ ǝdɐɥS ɹǝpnɹʇxƎㄥ§", + "item.gtceu.rubber_gloves": "sǝʌoן⅁ ɹǝqqnᴚ", "item.gtceu.salt_dust": "ʇןɐS", "item.gtceu.saw_extruder_mold.tooltip": "sʍɐS buıʞɐɯ ɹoɟ ǝdɐɥS ɹǝpnɹʇxƎㄥ§", "item.gtceu.shovel_extruder_mold.tooltip": "sןǝʌoɥS buıʞɐɯ ɹoɟ ǝdɐɥS ɹǝpnɹʇxƎㄥ§", @@ -4650,7 +4681,10 @@ "ldlib.gui.editor.register.editor.gtceu.template_tab": "sǝʇɐןdɯǝʇ", "mataarmor.hud.supply_mode": "%s :ǝpoW ʎןddnS", "material.gtceu.acetic_acid": "pıɔⱯ ɔıʇǝɔⱯ", + "material.gtceu.acetic_anhydride": "ǝpıɹpʎɥuⱯ ɔıʇǝɔⱯ", "material.gtceu.acetone": "ǝuoʇǝɔⱯ", + "material.gtceu.acidic_bromine_exhaust": "ʇsnɐɥxƎ ǝuıɯoɹᗺ ɔıpıɔⱯ", + "material.gtceu.acidic_bromine_solution": "uoıʇnןoS ǝuıɯoɹᗺ ɔıpıɔⱯ", "material.gtceu.acidic_enriched_naquadah_solution": "uoıʇnןoS ɥɐpɐnbɐN pǝɥɔıɹuƎ ɔıpıɔⱯ", "material.gtceu.acidic_naquadria_solution": "uoıʇnןoS ɐıɹpɐnbɐN ɔıpıɔⱯ", "material.gtceu.acidic_osmium_solution": "uoıʇnןoS ɯnıɯsO ɔıpıɔⱯ", @@ -4665,8 +4699,10 @@ "material.gtceu.alunite": "ǝʇıunןⱯ", "material.gtceu.americium": "ɯnıɔıɹǝɯⱯ", "material.gtceu.amethyst": "ʇsʎɥʇǝɯⱯ", + "material.gtceu.aminophenol": "ןouǝɥdouıɯⱯ", "material.gtceu.ammonia": "ɐıuoɯɯⱯ", "material.gtceu.ammonium_chloride": "ǝpıɹoןɥƆ ɯnıuoɯɯⱯ", + "material.gtceu.ammonium_formate": "ǝʇɐɯɹoℲ ɯnıuoɯɯⱯ", "material.gtceu.andesite": "ǝʇısǝpuⱯ", "material.gtceu.andradite": "ǝʇıpɐɹpuⱯ", "material.gtceu.annealed_copper": "ɹǝddoƆ pǝןɐǝuuⱯ", @@ -4718,6 +4754,7 @@ "material.gtceu.borosilicate_glass": "ssɐן⅁ ǝʇɐɔıןısoɹoᗺ", "material.gtceu.brass": "ssɐɹᗺ", "material.gtceu.brick": "ʞɔıɹᗺ", + "material.gtceu.brominated_chlorine_vapor": "ɹodɐΛ ǝuıɹoןɥƆ pǝʇɐuıɯoɹᗺ", "material.gtceu.bromine": "ǝuıɯoɹᗺ", "material.gtceu.bronze": "ǝzuoɹᗺ", "material.gtceu.brown_dye": "ǝʎᗡ uʍoɹᗺ", @@ -4729,7 +4766,10 @@ "material.gtceu.caesium": "ɯnısǝɐƆ", "material.gtceu.calcite": "ǝʇıɔןɐƆ", "material.gtceu.calcium": "ɯnıɔןɐƆ", + "material.gtceu.calcium_carbonate": "ǝʇɐuoqɹɐƆ ɯnıɔןɐƆ", "material.gtceu.calcium_chloride": "ǝpıɹoןɥƆ ɯnıɔןɐƆ", + "material.gtceu.calcium_ferrocyanide": "ǝpıuɐʎɔoɹɹǝℲ ɯnıɔןɐƆ", + "material.gtceu.calcium_hydroxide": "ǝpıxoɹpʎH ɯnıɔןɐƆ", "material.gtceu.calcium_phosphide": "ǝpıɥdsoɥԀ ɯnıɔןɐƆ", "material.gtceu.californium": "ɯnıuɹoɟıןɐƆ", "material.gtceu.caprolactam": "ɯɐʇɔɐןoɹdɐƆ", @@ -4764,6 +4804,7 @@ "material.gtceu.cocoa": "ɐoɔoƆ", "material.gtceu.coke": "ǝʞoƆ", "material.gtceu.collagen": "uǝbɐןןoƆ", + "material.gtceu.concentrated_bromine_solution": "uoıʇnןoS ǝuıɯoɹᗺ pǝʇɐɹʇuǝɔuoƆ", "material.gtceu.concrete": "ǝʇǝɹɔuoƆ", "material.gtceu.construction_foam": "ɯɐoℲ uoıʇɔnɹʇsuoƆ", "material.gtceu.cooperite": "ǝʇıuopןǝɥS", @@ -4780,6 +4821,7 @@ "material.gtceu.damascus_steel": "ןǝǝʇS snɔsɐɯɐᗡ", "material.gtceu.dark_ash": "ɥsⱯ ʞɹɐᗡ", "material.gtceu.darmstadtium": "ɯnıʇpɐʇsɯɹɐᗡ", + "material.gtceu.debrominated_brine": "ǝuıɹᗺ pǝʇɐuıɯoɹqǝᗡ", "material.gtceu.deepslate": "ǝʇɐןsdǝǝᗡ", "material.gtceu.depleted_uranium_hexafluoride": "ǝpıɹonןɟɐxǝH ɯnıuɐɹ∩ pǝʇǝןdǝᗡ", "material.gtceu.deuterium": "ɯnıɹǝʇnǝᗡ", @@ -4788,7 +4830,12 @@ "material.gtceu.diatomite": "ǝʇıɯoʇɐıᗡ", "material.gtceu.dichlorobenzene": "ǝuǝzuǝqoɹoןɥɔıᗡ", "material.gtceu.dichlorobenzidine": "ǝuıpızuǝqoɹoןɥɔıᗡ", + "material.gtceu.dichloroethane": "ǝuɐɥʇǝoɹoןɥɔıᗡ", "material.gtceu.diesel": "ןǝsǝıᗡ", + "material.gtceu.diethylenetriamine": "ǝuıɯɐıɹʇǝuǝןʎɥʇǝıᗡ", + "material.gtceu.diethylenetriamine_pentaacetonitrile": "ǝןıɹʇıuoʇǝɔɐɐʇuǝԀ ǝuıɯɐıɹʇǝuǝןʎɥʇǝıᗡ", + "material.gtceu.diethylenetriaminepentaacetic_acid": "pıɔⱯ ɔıʇǝɔɐɐʇuǝdǝuıɯɐıɹʇǝuǝןʎɥʇǝıᗡ", + "material.gtceu.dilute_iodine_solution": "uoıʇnןoS ǝuıpoI ǝʇnןıᗡ", "material.gtceu.diluted_hydrochloric_acid": "pıɔⱯ ɔıɹoןɥɔoɹpʎH pǝʇnןıᗡ", "material.gtceu.diluted_sulfuric_acid": "pıɔⱯ ɔıɹnɟןnS pǝʇnןıᗡ", "material.gtceu.dimethylamine": "ǝuıɯɐןʎɥʇǝɯıᗡ", @@ -4839,6 +4886,9 @@ "material.gtceu.flint": "ʇuıןℲ", "material.gtceu.fluorine": "ǝuıɹonןℲ", "material.gtceu.fluoroantimonic_acid": "pıɔⱯ ɔıuoɯıʇuɐoɹonןℲ", + "material.gtceu.formaldehyde": "ǝpʎɥǝpןɐɯɹoℲ", + "material.gtceu.formamide": "ǝpıɯɐɯɹoℲ", + "material.gtceu.formic_acid": "pıɔⱯ ɔıɯɹoℲ", "material.gtceu.francium": "ɯnıɔuɐɹℲ", "material.gtceu.fullers_earth": "ɥʇɹɐƎ s,ɹǝןןnℲ", "material.gtceu.gadolinium": "ɯnıuıןopɐ⅁", @@ -4858,6 +4908,7 @@ "material.gtceu.glue": "ǝnן⅁", "material.gtceu.glycerol": "ןoɹǝɔʎן⅁", "material.gtceu.glyceryl_trinitrate": "ǝʇɐɹʇıuıɹ⟘ ןʎɹǝɔʎן⅁", + "material.gtceu.glycolonitrile": "ǝןıɹʇıuoןoɔʎן⅁", "material.gtceu.goethite": "ǝʇıɥʇǝo⅁", "material.gtceu.gold": "pןo⅁", "material.gtceu.granite": "ǝʇıuɐɹ⅁", @@ -4882,6 +4933,10 @@ "material.gtceu.hematite": "ǝʇıʇɐɯǝH", "material.gtceu.high_octane_gasoline": "ǝuıןosɐ⅁ ǝuɐʇɔO ɥbıH", "material.gtceu.holmium": "ɯnıɯןoH", + "material.gtceu.hot_alkaline_debrominated_brine": "ǝuıɹᗺ pǝʇɐuıɯoɹqǝᗡ ǝuıןɐʞןⱯ ʇoH", + "material.gtceu.hot_brine": "ǝuıɹᗺ ʇoH", + "material.gtceu.hot_chlorinated_brominated_brine": "ǝuıɹᗺ pǝʇɐuıɯoɹᗺ pǝʇɐuıɹoןɥƆ ʇoH", + "material.gtceu.hot_debrominated_brine": "ǝuıɹᗺ pǝʇɐuıɯoɹqǝᗡ ʇoH", "material.gtceu.hsla_steel": "ןǝǝʇS ɐןsH", "material.gtceu.hsse": "Ǝ-SSH", "material.gtceu.hssg": "⅁-SSH", @@ -4896,6 +4951,7 @@ "material.gtceu.hydrochloric_acid": "pıɔⱯ ɔıɹoןɥɔoɹpʎH", "material.gtceu.hydrofluoric_acid": "pıɔⱯ ɔıɹonןɟoɹpʎH", "material.gtceu.hydrogen": "uǝboɹpʎH", + "material.gtceu.hydrogen_cyanide": "ǝpıuɐʎƆ uǝboɹpʎH", "material.gtceu.hydrogen_sulfide": "ǝpıɟןnS uǝboɹpʎH", "material.gtceu.hypochlorous_acid": "pıɔⱯ snoɹoןɥɔodʎH", "material.gtceu.ice": "ǝɔI", @@ -4910,11 +4966,14 @@ "material.gtceu.indium_tin_barium_titanium_cuprate": "ǝʇɐɹdnƆ ɯnıuɐʇı⟘ ɯnıɹɐᗺ uı⟘ ɯnıpuI", "material.gtceu.inert_metal_mixture": "ǝɹnʇxıW ןɐʇǝW ʇɹǝuI", "material.gtceu.invar": "ɹɐʌuI", + "material.gtceu.iodide": "ǝpıpoI", "material.gtceu.iodine": "ǝuıpoI", + "material.gtceu.iodine_solution": "uoıʇnןoS ǝuıpoI", "material.gtceu.iridium": "ɯnıpıɹI", "material.gtceu.iridium_chloride": "ǝpıɹoןɥƆ ɯnıpıɹI", "material.gtceu.iridium_metal_residue": "ǝnpısǝᴚ ןɐʇǝW ɯnıpıɹI", "material.gtceu.iron": "uoɹI", + "material.gtceu.iron_ii_chloride": "ǝpıɹoןɥƆ II uoɹI", "material.gtceu.iron_iii_chloride": "ǝpıɹoןɥƆ III uoɹI", "material.gtceu.isoprene": "ǝuǝɹdosI", "material.gtceu.kanthal": "ןɐɥʇuɐʞ", @@ -5040,6 +5099,7 @@ "material.gtceu.palladium": "ɯnıpɐןןɐԀ", "material.gtceu.palladium_raw": "ʍɐᴚ ɯnıpɐןןɐԀ", "material.gtceu.paper": "ɹǝdɐԀ", + "material.gtceu.paracetamol": "ןoɯɐʇǝɔɐɹɐԀ", "material.gtceu.pcb_coolant": "ʇuɐןooƆ ᗺƆԀ", "material.gtceu.pentlandite": "ǝʇıpuɐןʇuǝԀ", "material.gtceu.perlite": "ǝʇıןɹǝԀ", @@ -5071,8 +5131,14 @@ "material.gtceu.polyvinyl_chloride": "ǝpıɹoןɥƆ ןʎuıʌʎןoԀ", "material.gtceu.potash": "ɥsɐʇoԀ", "material.gtceu.potassium": "ɯnıssɐʇoԀ", + "material.gtceu.potassium_carbonate": "ǝʇɐuoqɹɐƆ ɯnıssɐʇoԀ", + "material.gtceu.potassium_cyanide": "ǝpıuɐʎƆ ɯnıssɐʇoԀ", "material.gtceu.potassium_dichromate": "ǝʇɐɯoɹɥɔıᗡ ɯnıssɐʇoԀ", "material.gtceu.potassium_feldspar": "ɹɐdspןǝℲ ɯnıssɐʇoԀ", + "material.gtceu.potassium_ferrocyanide": "ǝpıuɐʎɔoɹɹǝℲ ɯnıssɐʇoԀ", + "material.gtceu.potassium_hydroxide": "ǝpıxoɹpʎH ɯnıssɐʇoԀ", + "material.gtceu.potassium_iodide": "ǝpıpoI ɯnıssɐʇoԀ", + "material.gtceu.potassium_sulfate": "ǝʇɐɟןnS ɯnıssɐʇoԀ", "material.gtceu.potin": "uıʇoԀ", "material.gtceu.powellite": "ǝʇıןןǝʍoԀ", "material.gtceu.praseodymium": "ɯnıɯʎpoǝsɐɹԀ", @@ -5080,6 +5146,7 @@ "material.gtceu.propane": "ǝuɐdoɹԀ", "material.gtceu.propene": "ǝuǝdoɹԀ", "material.gtceu.protactinium": "ɯnıuıʇɔɐʇoɹԀ", + "material.gtceu.prussian_blue": "ǝnןᗺ uɐıssnɹԀ", "material.gtceu.purple_dye": "ǝʎᗡ ǝןdɹnԀ", "material.gtceu.pyrite": "ǝʇıɹʎԀ", "material.gtceu.pyrochlore": "ǝɹoןɥɔoɹʎԀ", @@ -5088,10 +5155,12 @@ "material.gtceu.quartz_sand": "puɐS zʇɹɐnὉ", "material.gtceu.quartzite": "ǝʇızʇɹɐnὉ", "material.gtceu.quicklime": "ǝɯıןʞɔınὉ", + "material.gtceu.rad_away": "ʎɐʍⱯ pɐᴚ", "material.gtceu.radium": "ɯnıpɐᴚ", "material.gtceu.radon": "uopɐᴚ", "material.gtceu.rare_earth": "ɥʇɹɐƎ ǝɹɐᴚ", "material.gtceu.rarest_metal_mixture": "ǝɹnʇxıW ןɐʇǝW ʇsǝɹɐᴚ", + "material.gtceu.raw_brine": "ǝuıɹᗺ ʍɐᴚ", "material.gtceu.raw_gasoline": "ǝuıןosɐ⅁ ʍɐᴚ", "material.gtceu.raw_growth_medium": "ɯnıpǝW ɥʇʍoɹ⅁ ʍɐᴚ", "material.gtceu.raw_rubber": "ɹǝqqnᴚ ʍɐᴚ", @@ -5155,6 +5224,7 @@ "material.gtceu.sodium_bicarbonate": "ǝʇɐuoqɹɐɔıᗺ ɯnıpoS", "material.gtceu.sodium_bisulfate": "ǝʇɐɟןnsıᗺ ɯnıpoS", "material.gtceu.sodium_hydroxide": "ǝpıxoɹpʎH ɯnıpoS", + "material.gtceu.sodium_nitrite": "ǝʇıɹʇıN ɯnıpoS", "material.gtceu.sodium_persulfate": "ǝʇɐɟןnsɹǝԀ ɯnıpoS", "material.gtceu.sodium_potassium": "ɯnıssɐʇoԀ ɯnıpoS", "material.gtceu.sodium_sulfide": "ǝpıɟןnS ɯnıpoS", @@ -5370,6 +5440,7 @@ "recipe.condition.thunder.tooltip": "%d :ןǝʌǝꞀ ɹǝpunɥ⟘", "tagprefix.andesite": "ǝɹO %s ǝʇısǝpuⱯ", "tagprefix.basalt": "ǝɹO %s ʇןɐsɐᗺ", + "tagprefix.blackstone": "ǝɹO %s ǝuoʇsʞɔɐןᗺ", "tagprefix.block": "%s ɟo ʞɔoןᗺ", "tagprefix.bolt": "ʇןoᗺ %s", "tagprefix.buzz_saw_blade": "ǝpɐןᗺ ʍɐszznᗺ %s", diff --git a/src/generated/resources/assets/gtceu/lang/en_us.json b/src/generated/resources/assets/gtceu/lang/en_us.json index 4913feaaee..3be48efe2d 100644 --- a/src/generated/resources/assets/gtceu/lang/en_us.json +++ b/src/generated/resources/assets/gtceu/lang/en_us.json @@ -239,6 +239,7 @@ "block.gtceu.ev_transformer_4a": "Extreme Voltage Hi-Amp (4x) Transformer", "block.gtceu.ev_wiremill": "§5Advanced Wiremill III§r", "block.gtceu.ev_world_accelerator": "§5Advanced World Accelerator III§r", + "block.gtceu.evaporation_plant": "Evaporation Tower", "block.gtceu.explosion_hazard_sign_block": "Explosion Hazard Sign Block", "block.gtceu.explosive.breaking_tooltip": "Primes explosion when mined, sneak mine to pick back up", "block.gtceu.explosive.lighting_tooltip": "Cannot be lit with Redstone", @@ -952,6 +953,7 @@ "block.gtceu.square_marble_bricks": "Square Marble Bricks", "block.gtceu.square_red_granite_bricks": "Square Red Granite Bricks", "block.gtceu.stable_machine_casing": "Stable Titanium Machine Casing", + "block.gtceu.stainless_evaporation_casing": "Stainless Evaporation Casing", "block.gtceu.stainless_steel_crate": "Stainless Steel Crate", "block.gtceu.stainless_steel_drum": "Stainless Steel Drum", "block.gtceu.stainless_steel_gearbox": "Stainless Steel Gearbox Casing", @@ -1645,6 +1647,7 @@ "compass.node.gtceu.ev/large_miner": "Large Miner", "compass.node.gtceu.generation/andesite": "Andesite", "compass.node.gtceu.generation/basalt": "Basalt", + "compass.node.gtceu.generation/blackstone": "Blackstone", "compass.node.gtceu.generation/deepslate": "Deepslate", "compass.node.gtceu.generation/diorite": "Diorite", "compass.node.gtceu.generation/endstone": "Endstone", @@ -2008,6 +2011,7 @@ "compass.section.gtceu.uv": "§3UV Voltage", "compass.section.gtceu.zpm": "§cZPM Voltage", "config.gtceu.option.addLoot": "addLoot", + "config.gtceu.option.ae2": "ae2", "config.gtceu.option.allUniqueStoneTypes": "allUniqueStoneTypes", "config.gtceu.option.animationTime": "animationTime", "config.gtceu.option.armorHud": "armorHud", @@ -2036,6 +2040,7 @@ "config.gtceu.option.enableTieredCasings": "enableTieredCasings", "config.gtceu.option.enableWorldAccelerators": "enableWorldAccelerators", "config.gtceu.option.energy": "energy", + "config.gtceu.option.energyConsumption": "energyConsumption", "config.gtceu.option.energyUsageMultiplier": "energyUsageMultiplier", "config.gtceu.option.euToPlatformRatio": "euToPlatformRatio", "config.gtceu.option.flintAndSteelRequireSteel": "flintAndSteelRequireSteel", @@ -2059,6 +2064,7 @@ "config.gtceu.option.hazardsEnabled": "hazardsEnabled", "config.gtceu.option.hideFacadesInJEI": "hideFacadesInJEI", "config.gtceu.option.hideFilledCellsInJEI": "hideFilledCellsInJEI", + "config.gtceu.option.hideOreProcessingDiagrams": "hideOreProcessingDiagrams", "config.gtceu.option.highTierContent": "highTierContent", "config.gtceu.option.hudLocation": "hudLocation", "config.gtceu.option.hudOffsetX": "hudOffsetX", @@ -2071,6 +2077,9 @@ "config.gtceu.option.machineSounds": "machineSounds", "config.gtceu.option.machines": "machines", "config.gtceu.option.machinesEmissiveTextures": "machinesEmissiveTextures", + "config.gtceu.option.nanoSaber": "nanoSaber", + "config.gtceu.option.nanoSaberBaseDamage": "nanoSaberBaseDamage", + "config.gtceu.option.nanoSaberDamageBoost": "nanoSaberDamageBoost", "config.gtceu.option.nativeEUToPlatformNative": "nativeEUToPlatformNative", "config.gtceu.option.nerfPaperCrafting": "nerfPaperCrafting", "config.gtceu.option.nerfWoodCrafting": "nerfWoodCrafting", @@ -2099,9 +2108,18 @@ "config.gtceu.option.toolCraftingSounds": "toolCraftingSounds", "config.gtceu.option.toolUseSounds": "toolUseSounds", "config.gtceu.option.tools": "tools", + "config.gtceu.option.universalHazards": "universalHazards", "config.gtceu.option.useVBO": "useVBO", + "config.gtceu.option.voltageTierAdvImpeller": "voltageTierAdvImpeller", + "config.gtceu.option.voltageTierAdvNanoSuit": "voltageTierAdvNanoSuit", + "config.gtceu.option.voltageTierAdvQuarkTech": "voltageTierAdvQuarkTech", + "config.gtceu.option.voltageTierImpeller": "voltageTierImpeller", + "config.gtceu.option.voltageTierNanoSuit": "voltageTierNanoSuit", + "config.gtceu.option.voltageTierNightVision": "voltageTierNightVision", + "config.gtceu.option.voltageTierQuarkTech": "voltageTierQuarkTech", "config.gtceu.option.worldAcceleratorBlacklist": "worldAcceleratorBlacklist", "config.gtceu.option.worldgen": "worldgen", + "config.gtceu.option.zombieSpawnWithSabers": "zombieSpawnWithSabers", "config.jade.plugin_gtceu.controllable_provider": "[GTCEu] Controllable", "config.jade.plugin_gtceu.electric_container_provider": "[GTCEu] Electric Container", "config.jade.plugin_gtceu.recipe_logic_provider": "[GTCEu] Recipe Logic", @@ -2307,6 +2325,7 @@ "death.attack.gtceu.wrench_hv": "%s's pipes were loosened by %s", "death.attack.gtceu.wrench_iv": "%s had a Monkey Wrench thrown into their plans by %s", "death.attack.gtceu.wrench_lv": "%s's pipes were loosened by %s", + "effect.gtceu.weak_poison": "Weak Poison", "enchantment.damage.disjunction": "Disjunction", "enchantment.disjunction": "Disjunction", "enchantment.gtceu.disjunction.desc": "Applies Weakness and Slowness to Ender-related mobs.", @@ -2406,6 +2425,7 @@ "gtceu.electric_furnace": "Electric Furnace", "gtceu.electrolyzer": "Electrolyzer", "gtceu.electromagnetic_separator": "Electromagnetic Separator", + "gtceu.evaporation": "Evaporation", "gtceu.extractor": "Extractor", "gtceu.extruder": "Extruder", "gtceu.fermenter": "Fermenter", @@ -2526,11 +2546,16 @@ "gtceu.gui.title_bar.page_switcher": "Pages", "gtceu.gui.toggle_view.disabled": "Toggle View (Fluids)", "gtceu.gui.toggle_view.enabled": "Toggle View (Items)", + "gtceu.hazard.antidote.description": "§aAntidote §7Hold Shift to show details", + "gtceu.hazard.antidote.description.effect_removed": "Removes %s%% of current ailments' effects", + "gtceu.hazard.antidote.description.effect_removed.all": "Removes all of current ailments' effects", + "gtceu.hazard.antidote.description_shift": "§aCures types:", "gtceu.hazard.contact_poison": "§5Contact Poison", "gtceu.hazard.corrosive": "§6Corrosive", "gtceu.hazard.description": "§l§cHAZARDOUS §7Hold Shift to show details", "gtceu.hazard.description_shift": "§l§cHAZARDOUS:", "gtceu.hazard.inhalation_poison": "§2Poisonous when inhaled", + "gtceu.hazard.none": "§2Not Dangerous", "gtceu.hazard.radioactive": "§eRadioactive", "gtceu.implosion_compressor": "Implosion Compressor", "gtceu.io.both": "Both", @@ -3499,6 +3524,7 @@ "gtceu.recipe.scan_for_research": "Scan for Assembly Line", "gtceu.recipe.temperature": "Temp: %sK", "gtceu.recipe.total": "Total: %s EU", + "gtceu.recipe.total_computation": "Computation: %s CWU", "gtceu.recipe_logic.condition_fails": "Condition Fails", "gtceu.recipe_logic.insufficient_fuel": "Insufficient Fuel", "gtceu.recipe_logic.insufficient_in": "Insufficient Inputs", @@ -3857,6 +3883,7 @@ "item.gtceu.exquisite_glass_gem": "Exquisite Glass Crystal", "item.gtceu.facade_cover": "%s Cover Facade", "item.gtceu.facade_cover.tooltip": "§7Decorative Outfit §fCover§7.", + "item.gtceu.face_mask": "Face Mask", "item.gtceu.fertilizer": "Fertilizer", "item.gtceu.fiber_reinforced_circuit_board": "Fiber-Reinforced Circuit Board", "item.gtceu.fiber_reinforced_circuit_board.tooltip": "§7An Extreme Board", @@ -4192,6 +4219,7 @@ "item.gtceu.osmium_credit.tooltip": "§74096 Credits", "item.gtceu.palladium_raw_dust": "Raw Palladium Powder", "item.gtceu.paper_dust": "Chad", + "item.gtceu.paracetamol_pill": "Paracetamol Pill", "item.gtceu.petri_dish": "Petri Dish", "item.gtceu.petri_dish.tooltip": "§7For cultivating Cells", "item.gtceu.phenolic_circuit_board": "Phenolic Circuit Board", @@ -4203,6 +4231,7 @@ "item.gtceu.phosphorus_wafer": "Phosphorus-doped Wafer", "item.gtceu.phosphorus_wafer.tooltip": "§7Raw Circuit", "item.gtceu.pickaxe_extruder_mold.tooltip": "§7Extruder Shape for making Pickaxes", + "item.gtceu.pill_casting_mold": "Casting Mold (Pill)", "item.gtceu.pink_dye_spray_can": "Spray Can (Pink)", "item.gtceu.pink_glass_lens": "Glass Lens (Pink)", "item.gtceu.pipe.huge_extruder_mold.tooltip": "§7Extruder Shape for making full Block Pipes", @@ -4271,6 +4300,7 @@ "item.gtceu.quarktech_helmet": "QuarkTech™ Suite Helmet", "item.gtceu.quarktech_leggings": "QuarkTech™ Suite Leggings", "item.gtceu.quartz_sand_dust": "Quartz Sand", + "item.gtceu.rad_away_pill": "RadAway™ Pill", "item.gtceu.ram_chip": "RAM Chip", "item.gtceu.ram_chip.tooltip": "§7Random Access Memory", "item.gtceu.ram_wafer": "RAM Wafer", @@ -4304,6 +4334,7 @@ "item.gtceu.rotor_casting_mold.tooltip": "§7Mold for making Rotors", "item.gtceu.rotor_extruder_mold": "Extruder Mold (Rotor)", "item.gtceu.rotor_extruder_mold.tooltip": "§7Extruder Shape for making Rotors", + "item.gtceu.rubber_gloves": "Rubber Gloves", "item.gtceu.salt_dust": "Salt", "item.gtceu.saw_extruder_mold.tooltip": "§7Extruder Shape for making Saws", "item.gtceu.shovel_extruder_mold.tooltip": "§7Extruder Shape for making Shovels", @@ -4650,7 +4681,10 @@ "ldlib.gui.editor.register.editor.gtceu.template_tab": "templates", "mataarmor.hud.supply_mode": "Supply Mode: %s", "material.gtceu.acetic_acid": "Acetic Acid", + "material.gtceu.acetic_anhydride": "Acetic Anhydride", "material.gtceu.acetone": "Acetone", + "material.gtceu.acidic_bromine_exhaust": "Acidic Bromine Exhaust", + "material.gtceu.acidic_bromine_solution": "Acidic Bromine Solution", "material.gtceu.acidic_enriched_naquadah_solution": "Acidic Enriched Naquadah Solution", "material.gtceu.acidic_naquadria_solution": "Acidic Naquadria Solution", "material.gtceu.acidic_osmium_solution": "Acidic Osmium Solution", @@ -4665,8 +4699,10 @@ "material.gtceu.alunite": "Alunite", "material.gtceu.americium": "Americium", "material.gtceu.amethyst": "Amethyst", + "material.gtceu.aminophenol": "Aminophenol", "material.gtceu.ammonia": "Ammonia", "material.gtceu.ammonium_chloride": "Ammonium Chloride", + "material.gtceu.ammonium_formate": "Ammonium Formate", "material.gtceu.andesite": "Andesite", "material.gtceu.andradite": "Andradite", "material.gtceu.annealed_copper": "Annealed Copper", @@ -4718,6 +4754,7 @@ "material.gtceu.borosilicate_glass": "Borosilicate Glass", "material.gtceu.brass": "Brass", "material.gtceu.brick": "Brick", + "material.gtceu.brominated_chlorine_vapor": "Brominated Chlorine Vapor", "material.gtceu.bromine": "Bromine", "material.gtceu.bronze": "Bronze", "material.gtceu.brown_dye": "Brown Dye", @@ -4729,7 +4766,10 @@ "material.gtceu.caesium": "Caesium", "material.gtceu.calcite": "Calcite", "material.gtceu.calcium": "Calcium", + "material.gtceu.calcium_carbonate": "Calcium Carbonate", "material.gtceu.calcium_chloride": "Calcium Chloride", + "material.gtceu.calcium_ferrocyanide": "Calcium Ferrocyanide", + "material.gtceu.calcium_hydroxide": "Calcium Hydroxide", "material.gtceu.calcium_phosphide": "Calcium Phosphide", "material.gtceu.californium": "Californium", "material.gtceu.caprolactam": "Caprolactam", @@ -4764,6 +4804,7 @@ "material.gtceu.cocoa": "Cocoa", "material.gtceu.coke": "Coke", "material.gtceu.collagen": "Collagen", + "material.gtceu.concentrated_bromine_solution": "Concentrated Bromine Solution", "material.gtceu.concrete": "Concrete", "material.gtceu.construction_foam": "Construction Foam", "material.gtceu.cooperite": "Sheldonite", @@ -4780,6 +4821,7 @@ "material.gtceu.damascus_steel": "Damascus Steel", "material.gtceu.dark_ash": "Dark Ash", "material.gtceu.darmstadtium": "Darmstadtium", + "material.gtceu.debrominated_brine": "Debrominated Brine", "material.gtceu.deepslate": "Deepslate", "material.gtceu.depleted_uranium_hexafluoride": "Depleted Uranium Hexafluoride", "material.gtceu.deuterium": "Deuterium", @@ -4788,7 +4830,12 @@ "material.gtceu.diatomite": "Diatomite", "material.gtceu.dichlorobenzene": "Dichlorobenzene", "material.gtceu.dichlorobenzidine": "Dichlorobenzidine", + "material.gtceu.dichloroethane": "Dichloroethane", "material.gtceu.diesel": "Diesel", + "material.gtceu.diethylenetriamine": "Diethylenetriamine", + "material.gtceu.diethylenetriamine_pentaacetonitrile": "Diethylenetriamine Pentaacetonitrile", + "material.gtceu.diethylenetriaminepentaacetic_acid": "Diethylenetriaminepentaacetic Acid", + "material.gtceu.dilute_iodine_solution": "Dilute Iodine Solution", "material.gtceu.diluted_hydrochloric_acid": "Diluted Hydrochloric Acid", "material.gtceu.diluted_sulfuric_acid": "Diluted Sulfuric Acid", "material.gtceu.dimethylamine": "Dimethylamine", @@ -4839,6 +4886,9 @@ "material.gtceu.flint": "Flint", "material.gtceu.fluorine": "Fluorine", "material.gtceu.fluoroantimonic_acid": "Fluoroantimonic Acid", + "material.gtceu.formaldehyde": "Formaldehyde", + "material.gtceu.formamide": "Formamide", + "material.gtceu.formic_acid": "Formic Acid", "material.gtceu.francium": "Francium", "material.gtceu.fullers_earth": "Fuller's Earth", "material.gtceu.gadolinium": "Gadolinium", @@ -4858,6 +4908,7 @@ "material.gtceu.glue": "Glue", "material.gtceu.glycerol": "Glycerol", "material.gtceu.glyceryl_trinitrate": "Glyceryl Trinitrate", + "material.gtceu.glycolonitrile": "Glycolonitrile", "material.gtceu.goethite": "Goethite", "material.gtceu.gold": "Gold", "material.gtceu.granite": "Granite", @@ -4882,6 +4933,10 @@ "material.gtceu.hematite": "Hematite", "material.gtceu.high_octane_gasoline": "High Octane Gasoline", "material.gtceu.holmium": "Holmium", + "material.gtceu.hot_alkaline_debrominated_brine": "Hot Alkaline Debrominated Brine", + "material.gtceu.hot_brine": "Hot Brine", + "material.gtceu.hot_chlorinated_brominated_brine": "Hot Chlorinated Brominated Brine", + "material.gtceu.hot_debrominated_brine": "Hot Debrominated Brine", "material.gtceu.hsla_steel": "Hsla Steel", "material.gtceu.hsse": "HSS-E", "material.gtceu.hssg": "HSS-G", @@ -4896,6 +4951,7 @@ "material.gtceu.hydrochloric_acid": "Hydrochloric Acid", "material.gtceu.hydrofluoric_acid": "Hydrofluoric Acid", "material.gtceu.hydrogen": "Hydrogen", + "material.gtceu.hydrogen_cyanide": "Hydrogen Cyanide", "material.gtceu.hydrogen_sulfide": "Hydrogen Sulfide", "material.gtceu.hypochlorous_acid": "Hypochlorous Acid", "material.gtceu.ice": "Ice", @@ -4910,11 +4966,14 @@ "material.gtceu.indium_tin_barium_titanium_cuprate": "Indium Tin Barium Titanium Cuprate", "material.gtceu.inert_metal_mixture": "Inert Metal Mixture", "material.gtceu.invar": "Invar", + "material.gtceu.iodide": "Iodide", "material.gtceu.iodine": "Iodine", + "material.gtceu.iodine_solution": "Iodine Solution", "material.gtceu.iridium": "Iridium", "material.gtceu.iridium_chloride": "Iridium Chloride", "material.gtceu.iridium_metal_residue": "Iridium Metal Residue", "material.gtceu.iron": "Iron", + "material.gtceu.iron_ii_chloride": "Iron II Chloride", "material.gtceu.iron_iii_chloride": "Iron III Chloride", "material.gtceu.isoprene": "Isoprene", "material.gtceu.kanthal": "Kanthal", @@ -5040,6 +5099,7 @@ "material.gtceu.palladium": "Palladium", "material.gtceu.palladium_raw": "Palladium Raw", "material.gtceu.paper": "Paper", + "material.gtceu.paracetamol": "Paracetamol", "material.gtceu.pcb_coolant": "PCB Coolant", "material.gtceu.pentlandite": "Pentlandite", "material.gtceu.perlite": "Perlite", @@ -5071,8 +5131,14 @@ "material.gtceu.polyvinyl_chloride": "Polyvinyl Chloride", "material.gtceu.potash": "Potash", "material.gtceu.potassium": "Potassium", + "material.gtceu.potassium_carbonate": "Potassium Carbonate", + "material.gtceu.potassium_cyanide": "Potassium Cyanide", "material.gtceu.potassium_dichromate": "Potassium Dichromate", "material.gtceu.potassium_feldspar": "Potassium Feldspar", + "material.gtceu.potassium_ferrocyanide": "Potassium Ferrocyanide", + "material.gtceu.potassium_hydroxide": "Potassium Hydroxide", + "material.gtceu.potassium_iodide": "Potassium Iodide", + "material.gtceu.potassium_sulfate": "Potassium Sulfate", "material.gtceu.potin": "Potin", "material.gtceu.powellite": "Powellite", "material.gtceu.praseodymium": "Praseodymium", @@ -5080,6 +5146,7 @@ "material.gtceu.propane": "Propane", "material.gtceu.propene": "Propene", "material.gtceu.protactinium": "Protactinium", + "material.gtceu.prussian_blue": "Prussian Blue", "material.gtceu.purple_dye": "Purple Dye", "material.gtceu.pyrite": "Pyrite", "material.gtceu.pyrochlore": "Pyrochlore", @@ -5088,10 +5155,12 @@ "material.gtceu.quartz_sand": "Quartz Sand", "material.gtceu.quartzite": "Quartzite", "material.gtceu.quicklime": "Quicklime", + "material.gtceu.rad_away": "Rad Away", "material.gtceu.radium": "Radium", "material.gtceu.radon": "Radon", "material.gtceu.rare_earth": "Rare Earth", "material.gtceu.rarest_metal_mixture": "Rarest Metal Mixture", + "material.gtceu.raw_brine": "Raw Brine", "material.gtceu.raw_gasoline": "Raw Gasoline", "material.gtceu.raw_growth_medium": "Raw Growth Medium", "material.gtceu.raw_rubber": "Raw Rubber", @@ -5155,6 +5224,7 @@ "material.gtceu.sodium_bicarbonate": "Sodium Bicarbonate", "material.gtceu.sodium_bisulfate": "Sodium Bisulfate", "material.gtceu.sodium_hydroxide": "Sodium Hydroxide", + "material.gtceu.sodium_nitrite": "Sodium Nitrite", "material.gtceu.sodium_persulfate": "Sodium Persulfate", "material.gtceu.sodium_potassium": "Sodium Potassium", "material.gtceu.sodium_sulfide": "Sodium Sulfide", @@ -5370,6 +5440,7 @@ "recipe.condition.thunder.tooltip": "Thunder Level: %d", "tagprefix.andesite": "Andesite %s Ore", "tagprefix.basalt": "Basalt %s Ore", + "tagprefix.blackstone": "Blackstone %s Ore", "tagprefix.block": "Block of %s", "tagprefix.bolt": "%s Bolt", "tagprefix.buzz_saw_blade": "%s Buzzsaw Blade", diff --git a/src/generated/resources/assets/gtceu/models/item/face_mask.json b/src/generated/resources/assets/gtceu/models/item/face_mask.json new file mode 100644 index 0000000000..f3ce0ba31c --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/item/face_mask.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "gtceu:item/face_mask" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/item/paracetamol_pill.json b/src/generated/resources/assets/gtceu/models/item/paracetamol_pill.json new file mode 100644 index 0000000000..845b7dea0e --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/item/paracetamol_pill.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "gtceu:item/paracetamol_pill" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/item/pill_casting_mold.json b/src/generated/resources/assets/gtceu/models/item/pill_casting_mold.json new file mode 100644 index 0000000000..540c29d271 --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/item/pill_casting_mold.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "gtceu:item/pill_casting_mold" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/item/rad_away_pill.json b/src/generated/resources/assets/gtceu/models/item/rad_away_pill.json new file mode 100644 index 0000000000..aaec1fa825 --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/item/rad_away_pill.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "gtceu:item/rad_away_pill" + } +} \ No newline at end of file diff --git a/src/generated/resources/assets/gtceu/models/item/rubber_gloves.json b/src/generated/resources/assets/gtceu/models/item/rubber_gloves.json new file mode 100644 index 0000000000..a34980063b --- /dev/null +++ b/src/generated/resources/assets/gtceu/models/item/rubber_gloves.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "gtceu:item/rubber_gloves" + } +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/blocks/mineable/wrench.json b/src/generated/resources/data/forge/tags/blocks/mineable/wrench.json index bfbd1cd616..c397898a5b 100644 --- a/src/generated/resources/data/forge/tags/blocks/mineable/wrench.json +++ b/src/generated/resources/data/forge/tags/blocks/mineable/wrench.json @@ -16,6 +16,7 @@ "gtceu:sturdy_machine_casing", "gtceu:palladium_substation", "gtceu:tempered_glass", + "gtceu:stainless_evaporation_casing", "gtceu:nonconducting_casing", "gtceu:vibration_safe_casing", "gtceu:watertight_casing", diff --git a/src/generated/resources/data/gtceu/loot_tables/blocks/stainless_evaporation_casing.json b/src/generated/resources/data/gtceu/loot_tables/blocks/stainless_evaporation_casing.json new file mode 100644 index 0000000000..e627c10875 --- /dev/null +++ b/src/generated/resources/data/gtceu/loot_tables/blocks/stainless_evaporation_casing.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "gtceu:stainless_evaporation_casing" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "gtceu:blocks/stainless_evaporation_casing" +} \ No newline at end of file diff --git a/src/generated/resources/data/gtceu/tags/items/ppe_armor.json b/src/generated/resources/data/gtceu/tags/items/ppe_armor.json new file mode 100644 index 0000000000..ec5f73fa99 --- /dev/null +++ b/src/generated/resources/data/gtceu/tags/items/ppe_armor.json @@ -0,0 +1,16 @@ +{ + "values": [ + "gtceu:face_mask", + "gtceu:rubber_gloves", + "gtceu:hazmat_chestpiece", + "gtceu:hazmat_leggings", + "gtceu:hazmat_boots", + "gtceu:hazmat_headpiece", + "gtceu:quarktech_chestplate", + "gtceu:quarktech_leggings", + "gtceu:quarktech_boots", + "gtceu:quarktech_helmet", + "gtceu:avanced_nanomuscle_chestplate", + "gtceu:advanced_quarktech_chestplate" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/tags/blocks/mineable/pickaxe.json b/src/generated/resources/data/minecraft/tags/blocks/mineable/pickaxe.json index 04a9b24af7..639bb25724 100644 --- a/src/generated/resources/data/minecraft/tags/blocks/mineable/pickaxe.json +++ b/src/generated/resources/data/minecraft/tags/blocks/mineable/pickaxe.json @@ -16,6 +16,7 @@ "gtceu:sturdy_machine_casing", "gtceu:palladium_substation", "gtceu:tempered_glass", + "gtceu:stainless_evaporation_casing", "gtceu:nonconducting_casing", "gtceu:vibration_safe_casing", "gtceu:watertight_casing", diff --git a/src/main/java/com/gregtechceu/gtceu/GTCEu.java b/src/main/java/com/gregtechceu/gtceu/GTCEu.java index a42f7263d5..265548aeff 100644 --- a/src/main/java/com/gregtechceu/gtceu/GTCEu.java +++ b/src/main/java/com/gregtechceu/gtceu/GTCEu.java @@ -5,16 +5,20 @@ import com.gregtechceu.gtceu.client.ClientProxy; import com.gregtechceu.gtceu.common.CommonProxy; import com.gregtechceu.gtceu.utils.FormattingUtil; + import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.Platform; + import net.minecraft.resources.ResourceLocation; import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.common.Mod; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; @Mod(GTCEu.MOD_ID) public class GTCEu { + public static final String MOD_ID = "gtceu"; public static final String NAME = "GregTechCEu"; public static final Logger LOGGER = LoggerFactory.getLogger(NAME); @@ -38,7 +42,7 @@ public static String appendIdString(String id) { } public static ResourceLocation appendId(String id) { - String[] strings = new String[]{"gtceu", id}; + String[] strings = new String[] { "gtceu", id }; int i = id.indexOf(':'); if (i >= 0) { strings[1] = id.substring(i + 1); @@ -62,7 +66,8 @@ public static boolean isIrisOculusLoaded() { } public static boolean isSodiumRubidiumEmbeddiumLoaded() { - return LDLib.isModLoaded(GTValues.MODID_SODIUM) || LDLib.isModLoaded(GTValues.MODID_RUBIDIUM) ||LDLib.isModLoaded(GTValues.MODID_EMBEDDIUM); + return LDLib.isModLoaded(GTValues.MODID_SODIUM) || LDLib.isModLoaded(GTValues.MODID_RUBIDIUM) || + LDLib.isModLoaded(GTValues.MODID_EMBEDDIUM); } public static boolean isRebornEnergyLoaded() { diff --git a/src/main/java/com/gregtechceu/gtceu/api/GTCEuAPI.java b/src/main/java/com/gregtechceu/gtceu/api/GTCEuAPI.java index 504b0396c2..1214cdbf1e 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/GTCEuAPI.java +++ b/src/main/java/com/gregtechceu/gtceu/api/GTCEuAPI.java @@ -11,12 +11,15 @@ import com.gregtechceu.gtceu.common.block.BatteryBlock; import com.gregtechceu.gtceu.common.block.CoilBlock; import com.gregtechceu.gtceu.config.ConfigHolder; + import com.lowdragmc.lowdraglib.Platform; -import lombok.Getter; + import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.block.Block; import net.minecraftforge.eventbus.api.GenericEvent; import net.minecraftforge.fml.event.IModBusEvent; + +import lombok.Getter; import org.jetbrains.annotations.ApiStatus; import java.util.HashMap; @@ -45,7 +48,8 @@ public class GTCEuAPI { @ApiStatus.Internal public static void initializeHighTier() { if (highTierInitialized) throw new IllegalStateException("High-Tier is already initialized."); - highTier = ConfigHolder.INSTANCE.machines.highTierContent || AddonFinder.getAddons().stream().anyMatch(IGTAddon::requiresHighTier) || Platform.isDevEnv(); + highTier = ConfigHolder.INSTANCE.machines.highTierContent || + AddonFinder.getAddons().stream().anyMatch(IGTAddon::requiresHighTier) || Platform.isDevEnv(); highTierInitialized = true; if (isHighTier()) GTCEu.LOGGER.info("High-Tier is Enabled."); diff --git a/src/main/java/com/gregtechceu/gtceu/api/GTValues.java b/src/main/java/com/gregtechceu/gtceu/api/GTValues.java index e8008a8352..1907362a1e 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/GTValues.java +++ b/src/main/java/com/gregtechceu/gtceu/api/GTValues.java @@ -1,7 +1,7 @@ package com.gregtechceu.gtceu.api; - import com.gregtechceu.gtceu.data.recipe.CraftingComponent; + import net.minecraft.util.RandomSource; import java.time.LocalDate; @@ -14,6 +14,7 @@ * Made for static imports, this Class is just a Helper. */ public class GTValues { + /** * Default fallback value used for Map keys. * Currently only used in {@link CraftingComponent}. @@ -45,7 +46,7 @@ public class GTValues { * The Item WildCard Tag. Even shorter than the "-1" of the past */ -// public static final short W = OreDictionary.WILDCARD_VALUE; + // public static final short W = OreDictionary.WILDCARD_VALUE; /** Current time on the Client. Will always be zero on the server. */ public static long CLIENT_TIME = 0; @@ -53,23 +54,26 @@ public class GTValues { /** * The Voltage Tiers. Use this Array instead of the old named Voltage Variables */ - public static final long[] V = new long[]{8, 32, 128, 512, 2048, 8192, 32768, 131072, 524288, 2097152, 8388608, 33554432, 134217728, 536870912, Integer.MAX_VALUE}; + public static final long[] V = new long[] { 8, 32, 128, 512, 2048, 8192, 32768, 131072, 524288, 2097152, 8388608, + 33554432, 134217728, 536870912, Integer.MAX_VALUE }; /** * The Voltage Tiers divided by 2. */ - public static final int[] VH = {4, 16, 64, 256, 1024, 4096, 16384, 65536, 262144, 1048576, 4194304, 16777216, 67108864, 268435456, 1073741824}; - + public static final int[] VH = { 4, 16, 64, 256, 1024, 4096, 16384, 65536, 262144, 1048576, 4194304, 16777216, + 67108864, 268435456, 1073741824 }; /** * The Voltage Tiers adjusted for cable loss. Use this for recipe EU/t to avoid full-amp recipes */ - public static final int[] VA = new int[]{7, 30, 120, 480, 1920, 7680, 30720, 122880, 491520, 1966080, 7864320, 31457280, 125829120, 503316480, 2013265920}; + public static final int[] VA = new int[] { 7, 30, 120, 480, 1920, 7680, 30720, 122880, 491520, 1966080, 7864320, + 31457280, 125829120, 503316480, 2013265920 }; /** * The Voltage Tiers adjusted for cable loss, divided by 2. */ - public static final int[] VHA = {7, 16, 60, 240, 960, 3840, 15360, 61440, 245760, 983040, 3932160, 15728640, 62914560, 251658240, 1006632960}; + public static final int[] VHA = { 7, 16, 60, 240, 960, 3840, 15360, 61440, 245760, 983040, 3932160, 15728640, + 62914560, 251658240, 1006632960 }; public static final int ULV = 0; public static final int LV = 1; @@ -87,15 +91,16 @@ public class GTValues { public static final int OpV = 13; public static final int MAX = 14; - public static final int[] ALL_TIERS = new int[]{ULV, LV, MV, HV, EV, IV, LuV, ZPM, UV, UHV, UEV, UIV, UXV, OpV, MAX}; + public static final int[] ALL_TIERS = new int[] { ULV, LV, MV, HV, EV, IV, LuV, ZPM, UV, UHV, UEV, UIV, UXV, OpV, + MAX }; public static final int TIER_COUNT = ALL_TIERS.length; public static int[] tiersBetween(int minInclusive, int maxInclusive) { - return Arrays.stream(ALL_TIERS).dropWhile(tier -> tier < minInclusive).takeWhile(tier -> tier <= maxInclusive).toArray(); + return Arrays.stream(ALL_TIERS).dropWhile(tier -> tier < minInclusive).takeWhile(tier -> tier <= maxInclusive) + .toArray(); } - public static final String - MODID_TOP = "theoneprobe", + public static final String MODID_TOP = "theoneprobe", MODID_JEI = "jei", MODID_APPENG = "ae2", MODID_KUBEJS = "kubejs", @@ -107,23 +112,24 @@ public static int[] tiersBetween(int minInclusive, int maxInclusive) { MODID_CREATE = "create", MODID_REBORN_ENERGY = "team_reborn_energy", MODID_ALMOSTUNIFIED = "almostunified", - MODID_CURIOS = "curios"; + MODID_CURIOS = "curios", + MODID_AE2WTLIB = "ae2wtlib"; /** * Spray painting compat modids */ - public static final String - MODID_TINTED = "tinted"; + public static final String MODID_TINTED = "tinted"; /** * The short names for the voltages, used for registration primarily */ - public static final String[] VN = new String[]{"ULV", "LV", "MV", "HV", "EV", "IV", "LuV", "ZPM", "UV", "UHV", "UEV", "UIV", "UXV", "OpV", "MAX"}; + public static final String[] VN = new String[] { "ULV", "LV", "MV", "HV", "EV", "IV", "LuV", "ZPM", "UV", "UHV", + "UEV", "UIV", "UXV", "OpV", "MAX" }; /** * The short names for the voltages, formatted for text */ - public static final String[] VNF = new String[]{ + public static final String[] VNF = new String[] { DARK_GRAY + "ULV", GRAY + "LV", AQUA + "MV", @@ -137,11 +143,10 @@ public static int[] tiersBetween(int minInclusive, int maxInclusive) { GREEN + "UEV", DARK_GREEN + "UIV", YELLOW + "UXV", - BLUE.toString() + BOLD + "OpV", - RED.toString() + BOLD + "MAX"}; + BLUE.toString() + BOLD + "OpV", + RED.toString() + BOLD + "MAX" }; - - public static final String[] VLVH = new String[]{ + public static final String[] VLVH = new String[] { "Primitive", // not doing the gray color for these first two because it looks weird "Basic", AQUA + "Advanced", @@ -155,10 +160,10 @@ public static int[] tiersBetween(int minInclusive, int maxInclusive) { GREEN + "Epic", DARK_GREEN + "Epic", YELLOW + "Epic", - BLUE.toString() + BOLD + "Legendary", - RED.toString() + BOLD + "MAX"}; + BLUE.toString() + BOLD + "Legendary", + RED.toString() + BOLD + "MAX" }; - public static final String[] VLVT = new String[]{ + public static final String[] VLVT = new String[] { "" + RESET, "" + RESET, "" + RESET, @@ -173,9 +178,9 @@ public static int[] tiersBetween(int minInclusive, int maxInclusive) { "III" + RESET, "IV" + RESET, "" + RESET, - "" + RESET}; + "" + RESET }; - public static final String[] LVT = new String[]{ + public static final String[] LVT = new String[] { "", "I", "II", @@ -196,13 +201,16 @@ public static int[] tiersBetween(int minInclusive, int maxInclusive) { /** * Color values for the voltages */ - public static final int[] VC = new int[]{0xC80000, 0xDCDCDC, 0xFF6400, 0xFFFF1E, 0x808080, 0xF0F0F5, 0xE99797, 0x7EC3C4, 0x7EB07E, 0xBF74C0, 0x0B5CFE, 0x914E91, 0x488748, 0x8C0000, 0x2828F5}; + public static final int[] VC = new int[] { 0xC80000, 0xDCDCDC, 0xFF6400, 0xFFFF1E, 0x808080, 0xF0F0F5, 0xE99797, + 0x7EC3C4, 0x7EB07E, 0xBF74C0, 0x0B5CFE, 0x914E91, 0x488748, 0x8C0000, 0x2828F5 }; /** * The long names for the voltages */ - public static final String[] VOLTAGE_NAMES = new String[]{"Ultra Low Voltage", "Low Voltage", "Medium Voltage", "High Voltage", "Extreme Voltage", "Insane Voltage", "Ludicrous Voltage", "ZPM Voltage", "Ultimate Voltage", - "Ultra High Voltage", "Ultra Excessive Voltage", "Ultra Immense Voltage", "Ultra Extreme Voltage", "Overpowered Voltage", "Maximum Voltage"}; + public static final String[] VOLTAGE_NAMES = new String[] { "Ultra Low Voltage", "Low Voltage", "Medium Voltage", + "High Voltage", "Extreme Voltage", "Insane Voltage", "Ludicrous Voltage", "ZPM Voltage", "Ultimate Voltage", + "Ultra High Voltage", "Ultra Excessive Voltage", "Ultra Immense Voltage", "Ultra Extreme Voltage", + "Overpowered Voltage", "Maximum Voltage" }; /** * Used to tell if any high-tier machine (UHV+) was registered. @@ -219,7 +227,5 @@ public static int[] tiersBetween(int minInclusive, int maxInclusive) { return yearMonthDay[1].equals("12") && (yearMonthDay[2].equals("24") || yearMonthDay[2].equals("25")); }; - public static final String CUSTOM_TAG_SOURCE = "GTCEu Custom Tags"; - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/addon/AddonFinder.java b/src/main/java/com/gregtechceu/gtceu/api/addon/AddonFinder.java index ae4d28e21b..89a80f028e 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/addon/AddonFinder.java +++ b/src/main/java/com/gregtechceu/gtceu/api/addon/AddonFinder.java @@ -2,6 +2,7 @@ import net.minecraftforge.fml.ModList; import net.minecraftforge.forgespi.language.ModFileScanData; + import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.jetbrains.annotations.Nullable; @@ -11,6 +12,7 @@ import java.util.*; public class AddonFinder { + private static final Logger LOGGER = LogManager.getLogger(); protected static List cache = null; protected static Map modIdMap = new HashMap<>(); diff --git a/src/main/java/com/gregtechceu/gtceu/api/addon/GTAddon.java b/src/main/java/com/gregtechceu/gtceu/api/addon/GTAddon.java index 991f733918..bec2a5b503 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/addon/GTAddon.java +++ b/src/main/java/com/gregtechceu/gtceu/api/addon/GTAddon.java @@ -1,4 +1,3 @@ package com.gregtechceu.gtceu.api.addon; -public @interface GTAddon { -} +public @interface GTAddon {} diff --git a/src/main/java/com/gregtechceu/gtceu/api/addon/IGTAddon.java b/src/main/java/com/gregtechceu/gtceu/api/addon/IGTAddon.java index a05b4be13e..fa95834d05 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/addon/IGTAddon.java +++ b/src/main/java/com/gregtechceu/gtceu/api/addon/IGTAddon.java @@ -5,6 +5,7 @@ import com.gregtechceu.gtceu.api.data.worldgen.bedrockfluid.BedrockFluidDefinition; import com.gregtechceu.gtceu.api.registry.registrate.GTRegistrate; import com.gregtechceu.gtceu.common.data.GTOres; + import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.resources.ResourceLocation; @@ -15,7 +16,7 @@ public interface IGTAddon { /** * @return this addon's GTRegistrate instance. - * remember to call{@link GTRegistrate#registerRegistrate} in your mod class! + * remember to call{@link GTRegistrate#registerRegistrate} in your mod class! */ GTRegistrate getRegistrate(); @@ -26,6 +27,7 @@ public interface IGTAddon { /** * this addon's Mod id. + * * @return the Mod ID this addon uses for content. */ String addonModId(); @@ -33,117 +35,87 @@ public interface IGTAddon { /** * Call init on your custom TagPrefix class(es) here */ - default void registerTagPrefixes() { - - } + default void registerTagPrefixes() {} /** * Call init on your custom Element class(es) here */ - default void registerElements() { - - } + default void registerElements() {} /** * Call init on your custom Material class(es) here - * @deprecated use {@link com.gregtechceu.gtceu.api.data.chemical.material.event.MaterialRegistryEvent} and {@link com.gregtechceu.gtceu.api.data.chemical.material.event.MaterialEvent} instead. + * + * @deprecated use {@link com.gregtechceu.gtceu.api.data.chemical.material.event.MaterialRegistryEvent} and + * {@link com.gregtechceu.gtceu.api.data.chemical.material.event.MaterialEvent} instead. */ @Deprecated(forRemoval = true, since = "1.0.21") - default void registerMaterials() { - - } + default void registerMaterials() {} /** * Call init on your custom Sound class(es) here */ - default void registerSounds() { - - } + default void registerSounds() {} /** * Call init on your custom Cover class(es) here */ - default void registerCovers() { - - } + default void registerCovers() {} /** * Call init on your custom Recipe Capabilities here */ - default void registerRecipeCapabilities() { - - } + default void registerRecipeCapabilities() {} /** * Call init on your custom Recipe Conditions here */ - default void registerRecipeConditions() { - - } + default void registerRecipeConditions() {} /** * Call init on your custom IWorldGenLayer class(es) here */ - default void registerWorldgenLayers() { - - } + default void registerWorldgenLayers() {} /** * Call init on your custom VeinGenerator class(es) here */ - default void registerVeinGenerators() { - - } + default void registerVeinGenerators() {} /** * Call init on your custom IndicatorGenerator class(es) here */ - default void registerIndicatorGenerators() { - - } + default void registerIndicatorGenerators() {} - default void addRecipes(Consumer provider) { - - } + default void addRecipes(Consumer provider) {} - default void removeRecipes(Consumer consumer) { - - } + default void removeRecipes(Consumer consumer) {} /** * Use {@link GTOres#create(ResourceLocation, Consumer)} to register the veins. */ - default void registerOreVeins() { - - } + default void registerOreVeins() {} /** * Use {@link BedrockFluidDefinition#builder(ResourceLocation)} to register the veins. */ - default void registerFluidVeins() { - - } + default void registerFluidVeins() {} /** - * Use {@link com.gregtechceu.gtceu.api.data.worldgen.bedrockore.BedrockOreDefinition#builder(ResourceLocation)} to register the veins. + * Use {@link com.gregtechceu.gtceu.api.data.worldgen.bedrockore.BedrockOreDefinition#builder(ResourceLocation)} to + * register the veins. */ - default void registerBedrockOreVeins() { - - } + default void registerBedrockOreVeins() {} /** * Register Material -> Casing block mappings here */ - default void collectMaterialCasings(MaterialCasingCollectionEvent event) { + default void collectMaterialCasings(MaterialCasingCollectionEvent event) {} - } - - default void registerRecipeKeys(KJSRecipeKeyEvent event) { - - } + default void registerRecipeKeys(KJSRecipeKeyEvent event) {} /** * Does this addon require high-tier content to be enabled? + * * @return if this addon requires highTier. */ default boolean requiresHighTier() { diff --git a/src/main/java/com/gregtechceu/gtceu/api/addon/events/KJSRecipeKeyEvent.java b/src/main/java/com/gregtechceu/gtceu/api/addon/events/KJSRecipeKeyEvent.java index 8acc25a6b7..8612db525a 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/addon/events/KJSRecipeKeyEvent.java +++ b/src/main/java/com/gregtechceu/gtceu/api/addon/events/KJSRecipeKeyEvent.java @@ -3,6 +3,7 @@ import com.gregtechceu.gtceu.api.capability.recipe.RecipeCapability; import com.gregtechceu.gtceu.integration.kjs.recipe.components.ContentJS; import com.gregtechceu.gtceu.integration.kjs.recipe.components.GTRecipeComponents; + import com.mojang.datafixers.util.Pair; import lombok.Getter; @@ -16,13 +17,16 @@ */ @SuppressWarnings("unused") public class KJSRecipeKeyEvent { + @Getter private final Map, Pair, ContentJS>> registeredKeys = new HashMap<>(); /** * Use this to register new components for KJS to use! + * * @param cap the recipe capability you're adding a KJS binding for. - * @param key the components, like {@link GTRecipeComponents#ITEM_IN} and {@link GTRecipeComponents#ITEM_OUT}, as a {@link Pair} + * @param key the components, like {@link GTRecipeComponents#ITEM_IN} and {@link GTRecipeComponents#ITEM_OUT}, as a + * {@link Pair} */ public void registerKey(RecipeCapability cap, Pair, ContentJS> key) { if (registeredKeys.put(cap, key) != null) { diff --git a/src/main/java/com/gregtechceu/gtceu/api/addon/events/MaterialCasingCollectionEvent.java b/src/main/java/com/gregtechceu/gtceu/api/addon/events/MaterialCasingCollectionEvent.java index 60b04c83f4..d9c2cacd7f 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/addon/events/MaterialCasingCollectionEvent.java +++ b/src/main/java/com/gregtechceu/gtceu/api/addon/events/MaterialCasingCollectionEvent.java @@ -1,11 +1,14 @@ package com.gregtechceu.gtceu.api.addon.events; -import com.google.common.collect.ImmutableMap; import com.gregtechceu.gtceu.api.data.chemical.material.Material; -import com.tterrag.registrate.util.entry.BlockEntry; + import net.minecraft.world.level.block.Block; +import com.google.common.collect.ImmutableMap; +import com.tterrag.registrate.util.entry.BlockEntry; + public class MaterialCasingCollectionEvent { + private final ImmutableMap.Builder> builder; public MaterialCasingCollectionEvent(ImmutableMap.Builder> builder) { diff --git a/src/main/java/com/gregtechceu/gtceu/api/block/ActiveBlock.java b/src/main/java/com/gregtechceu/gtceu/api/block/ActiveBlock.java index 48fc638cad..b5e6f04a8c 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/block/ActiveBlock.java +++ b/src/main/java/com/gregtechceu/gtceu/api/block/ActiveBlock.java @@ -2,6 +2,7 @@ import com.lowdragmc.lowdraglib.client.renderer.IBlockRendererProvider; import com.lowdragmc.lowdraglib.client.renderer.IRenderer; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -12,6 +13,7 @@ import net.minecraft.world.level.block.state.properties.BooleanProperty; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + import org.jetbrains.annotations.Nullable; import javax.annotation.ParametersAreNonnullByDefault; @@ -19,6 +21,7 @@ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class ActiveBlock extends AppearanceBlock implements IBlockRendererProvider { + public static final BooleanProperty ACTIVE = BooleanProperty.create("active"); private final IRenderer renderer; @@ -56,7 +59,8 @@ public IRenderer getRenderer(BlockState state) { } @Override - public BlockState getBlockAppearance(BlockState state, BlockAndTintGetter level, BlockPos pos, Direction side, BlockState sourceState, BlockPos sourcePos) { + public BlockState getBlockAppearance(BlockState state, BlockAndTintGetter level, BlockPos pos, Direction side, + BlockState sourceState, BlockPos sourcePos) { return defaultBlockState(); } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/block/AppearanceBlock.java b/src/main/java/com/gregtechceu/gtceu/api/block/AppearanceBlock.java index 09711e8cd4..82475dd893 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/block/AppearanceBlock.java +++ b/src/main/java/com/gregtechceu/gtceu/api/block/AppearanceBlock.java @@ -5,6 +5,7 @@ import net.minecraft.world.level.BlockAndTintGetter; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; + import org.jetbrains.annotations.Nullable; /** @@ -13,13 +14,16 @@ * @implNote AppearanceBlock */ public class AppearanceBlock extends Block implements IAppearance { + public AppearanceBlock(Properties properties) { super(properties); } @Override - public BlockState getAppearance(BlockState state, BlockAndTintGetter level, BlockPos pos, Direction side, @Nullable BlockState queryState, @Nullable BlockPos queryPos) { - var appearance = AppearanceBlock.class.cast(this).getBlockAppearance(state, level, pos, side, queryState, queryPos); + public BlockState getAppearance(BlockState state, BlockAndTintGetter level, BlockPos pos, Direction side, + @Nullable BlockState queryState, @Nullable BlockPos queryPos) { + var appearance = AppearanceBlock.class.cast(this).getBlockAppearance(state, level, pos, side, queryState, + queryPos); return appearance == null ? state : appearance; } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/block/BlockProperties.java b/src/main/java/com/gregtechceu/gtceu/api/block/BlockProperties.java index 5a69b04a7d..a42ed84c3c 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/block/BlockProperties.java +++ b/src/main/java/com/gregtechceu/gtceu/api/block/BlockProperties.java @@ -8,5 +8,6 @@ * @implNote BlockProperties */ public final class BlockProperties { + public static final BooleanProperty SERVER_TICK = BooleanProperty.create("server_tick"); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/block/IAppearance.java b/src/main/java/com/gregtechceu/gtceu/api/block/IAppearance.java index 1ab9673203..5224d78f02 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/block/IAppearance.java +++ b/src/main/java/com/gregtechceu/gtceu/api/block/IAppearance.java @@ -18,8 +18,8 @@ public interface IAppearance { * get Appearance. same as IForgeBlock.getAppearance() / IFabricBlock.getAppearance() */ @Nullable - default BlockState getBlockAppearance(BlockState state, BlockAndTintGetter level, BlockPos pos, Direction side, BlockState sourceState, BlockPos sourcePos) { + default BlockState getBlockAppearance(BlockState state, BlockAndTintGetter level, BlockPos pos, Direction side, + BlockState sourceState, BlockPos sourcePos) { return state; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/block/ICoilType.java b/src/main/java/com/gregtechceu/gtceu/api/block/ICoilType.java index 7e9ac3e7ac..f4ed44974a 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/block/ICoilType.java +++ b/src/main/java/com/gregtechceu/gtceu/api/block/ICoilType.java @@ -2,9 +2,10 @@ import com.gregtechceu.gtceu.api.GTCEuAPI; import com.gregtechceu.gtceu.api.data.chemical.material.Material; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.ResourceLocation; import net.minecraftforge.common.util.Lazy; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -57,13 +58,13 @@ public interface ICoilType { ResourceLocation getTexture(); Lazy ALL_COILS_TEMPERATURE_SORTED = Lazy.of(() -> GTCEuAPI.HEATING_COILS.keySet().stream() - .sorted(Comparator.comparing(ICoilType::getCoilTemperature)) - .toArray(ICoilType[]::new)); + .sorted(Comparator.comparing(ICoilType::getCoilTemperature)) + .toArray(ICoilType[]::new)); @Nullable static ICoilType getMinRequiredType(int requiredTemperature) { return Arrays.stream(ALL_COILS_TEMPERATURE_SORTED.get()) - .filter(coil -> coil.getCoilTemperature() >= requiredTemperature) - .findFirst().orElse(null); + .filter(coil -> coil.getCoilTemperature() >= requiredTemperature) + .findFirst().orElse(null); } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/block/IFilterType.java b/src/main/java/com/gregtechceu/gtceu/api/block/IFilterType.java index 81e5ed089e..46ca8e04b6 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/block/IFilterType.java +++ b/src/main/java/com/gregtechceu/gtceu/api/block/IFilterType.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.api.block; import com.gregtechceu.gtceu.api.machine.multiblock.CleanroomType; + import net.minecraft.util.StringRepresentable; import org.jetbrains.annotations.NotNull; @@ -12,5 +13,4 @@ public interface IFilterType extends StringRepresentable { */ @NotNull CleanroomType getCleanroomType(); - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/block/IMachineBlock.java b/src/main/java/com/gregtechceu/gtceu/api/block/IMachineBlock.java index 2e441d4f06..a270852411 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/block/IMachineBlock.java +++ b/src/main/java/com/gregtechceu/gtceu/api/block/IMachineBlock.java @@ -4,7 +4,9 @@ import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; import com.gregtechceu.gtceu.api.machine.MachineDefinition; import com.gregtechceu.gtceu.api.machine.MetaMachine; + import com.lowdragmc.lowdraglib.client.renderer.IBlockRendererProvider; + import net.minecraft.core.BlockPos; import net.minecraft.world.level.BlockAndTintGetter; import net.minecraft.world.level.Level; @@ -14,6 +16,7 @@ import net.minecraft.world.level.block.entity.BlockEntityTicker; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; + import org.jetbrains.annotations.Nullable; /** @@ -22,6 +25,7 @@ * @implNote IMachineBlock */ public interface IMachineBlock extends IBlockRendererProvider, EntityBlock { + default Block self() { return (Block) this; } @@ -30,7 +34,8 @@ default Block self() { RotationState getRotationState(); - static int colorTinted(BlockState blockState, @Nullable BlockAndTintGetter level, @Nullable BlockPos pos, int index) { + static int colorTinted(BlockState blockState, @Nullable BlockAndTintGetter level, @Nullable BlockPos pos, + int index) { if (level != null && pos != null) { var machine = MetaMachine.getMachine(level, pos); if (machine != null) { @@ -48,7 +53,8 @@ default BlockEntity newBlockEntity(BlockPos pos, BlockState state) { @Nullable @Override - default BlockEntityTicker getTicker(Level level, BlockState state, BlockEntityType blockEntityType) { + default BlockEntityTicker getTicker(Level level, BlockState state, + BlockEntityType blockEntityType) { if (blockEntityType == getDefinition().getBlockEntityType()) { if (state.getValue(BlockProperties.SERVER_TICK) && !level.isClientSide) { return (pLevel, pPos, pState, pTile) -> { @@ -67,5 +73,4 @@ default BlockEntityTicker getTicker(Level level, Bloc } return null; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/block/MaterialBlock.java b/src/main/java/com/gregtechceu/gtceu/api/block/MaterialBlock.java index cc16d34f16..2892cd8893 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/block/MaterialBlock.java +++ b/src/main/java/com/gregtechceu/gtceu/api/block/MaterialBlock.java @@ -4,7 +4,9 @@ import com.gregtechceu.gtceu.api.data.tag.TagPrefix; import com.gregtechceu.gtceu.client.renderer.block.MaterialBlockRenderer; import com.gregtechceu.gtceu.config.ConfigHolder; + import com.lowdragmc.lowdraglib.Platform; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.client.color.block.BlockColor; import net.minecraft.core.BlockPos; @@ -59,20 +61,22 @@ public static BlockColor tintedColor() { }; } - /** Start falling ore stuff */ @SuppressWarnings("deprecation") @Override public void onPlace(BlockState state, Level level, BlockPos pos, BlockState oldState, boolean isMoving) { - if (TagPrefix.ORES.containsKey(this.tagPrefix) && TagPrefix.ORES.get(tagPrefix).isSand() && ConfigHolder.INSTANCE.worldgen.sandOresFall) { + if (TagPrefix.ORES.containsKey(this.tagPrefix) && TagPrefix.ORES.get(tagPrefix).isSand() && + ConfigHolder.INSTANCE.worldgen.sandOresFall) { level.scheduleTick(pos, this, this.getDelayAfterPlace()); } } @SuppressWarnings("deprecation") @Override - public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, BlockPos currentPos, BlockPos neighborPos) { - if (TagPrefix.ORES.containsKey(this.tagPrefix) && TagPrefix.ORES.get(tagPrefix).isSand() && ConfigHolder.INSTANCE.worldgen.sandOresFall) { + public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor level, + BlockPos currentPos, BlockPos neighborPos) { + if (TagPrefix.ORES.containsKey(this.tagPrefix) && TagPrefix.ORES.get(tagPrefix).isSand() && + ConfigHolder.INSTANCE.worldgen.sandOresFall) { level.scheduleTick(currentPos, this, this.getDelayAfterPlace()); } return super.updateShape(state, direction, neighborState, level, currentPos, neighborPos); @@ -89,11 +93,13 @@ public void tick(BlockState state, ServerLevel level, BlockPos pos, RandomSource @Override public void animateTick(BlockState state, Level level, BlockPos pos, RandomSource random) { - if (!TagPrefix.ORES.containsKey(this.tagPrefix) || !TagPrefix.ORES.get(tagPrefix).isSand() || !ConfigHolder.INSTANCE.worldgen.sandOresFall) return; + if (!TagPrefix.ORES.containsKey(this.tagPrefix) || !TagPrefix.ORES.get(tagPrefix).isSand() || + !ConfigHolder.INSTANCE.worldgen.sandOresFall) + return; if (random.nextInt(16) == 0 && FallingBlock.isFree(level.getBlockState(pos.below()))) { - double d = (double)pos.getX() + random.nextDouble(); - double e = (double)pos.getY() - 0.05; - double f = (double)pos.getZ() + random.nextDouble(); + double d = (double) pos.getX() + random.nextDouble(); + double e = (double) pos.getY() - 0.05; + double f = (double) pos.getZ() + random.nextDouble(); level.addParticle(new BlockParticleOption(ParticleTypes.FALLING_DUST, state), d, e, f, 0.0, 0.0, 0.0); } } @@ -104,8 +110,8 @@ public void animateTick(BlockState state, Level level, BlockPos pos, RandomSourc protected int getDelayAfterPlace() { return 2; } - /** End falling ore stuff */ + /** End falling ore stuff */ @Override public String getDescriptionId() { @@ -116,5 +122,4 @@ public String getDescriptionId() { public MutableComponent getName() { return tagPrefix.getLocalizedName(material); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/block/MaterialPipeBlock.java b/src/main/java/com/gregtechceu/gtceu/api/block/MaterialPipeBlock.java index 7ce4e07150..812fbb14d1 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/block/MaterialPipeBlock.java +++ b/src/main/java/com/gregtechceu/gtceu/api/block/MaterialPipeBlock.java @@ -1,10 +1,11 @@ package com.gregtechceu.gtceu.api.block; import com.gregtechceu.gtceu.api.blockentity.PipeBlockEntity; +import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.api.pipenet.*; import com.gregtechceu.gtceu.client.model.PipeModel; import com.gregtechceu.gtceu.client.renderer.block.PipeBlockRenderer; -import com.gregtechceu.gtceu.api.data.chemical.material.Material; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.client.color.block.BlockColor; import net.minecraft.core.BlockPos; @@ -14,6 +15,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + import org.jetbrains.annotations.Nullable; import javax.annotation.ParametersAreNonnullByDefault; @@ -25,7 +27,10 @@ */ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault -public abstract class MaterialPipeBlock & IPipeType & IMaterialPipeType, NodeDataType, WorldPipeNetType extends LevelPipeNet>> extends PipeBlock { +public abstract class MaterialPipeBlock< + PipeType extends Enum & IPipeType & IMaterialPipeType, NodeDataType, + WorldPipeNetType extends LevelPipeNet>> + extends PipeBlock { public final Material material; public final PipeBlockRenderer renderer; @@ -41,8 +46,9 @@ public MaterialPipeBlock(Properties properties, PipeType pipeType, Material mate @OnlyIn(Dist.CLIENT) public static BlockColor tintedColor() { return (blockState, level, blockPos, index) -> { - if (blockState.getBlock() instanceof MaterialPipeBlock block) { - if (blockPos != null && level != null && level.getBlockEntity(blockPos) instanceof PipeBlockEntity pipe && pipe.isPainted()) { + if (blockState.getBlock() instanceof MaterialPipeBlock block) { + if (blockPos != null && level != null && + level.getBlockEntity(blockPos) instanceof PipeBlockEntity pipe && pipe.isPainted()) { return pipe.getRealColor(); } return block.tinted(blockState, level, blockPos, index); @@ -51,7 +57,8 @@ public static BlockColor tintedColor() { }; } - public int tinted(BlockState blockState, @Nullable BlockAndTintGetter blockAndTintGetter, @Nullable BlockPos blockPos, int index) { + public int tinted(BlockState blockState, @Nullable BlockAndTintGetter blockAndTintGetter, + @Nullable BlockPos blockPos, int index) { return index == 0 || index == 1 ? material.getMaterialRGB() : -1; } @@ -68,7 +75,8 @@ public final NodeDataType createRawData(BlockState pState, @Nullable ItemStack p @Override public NodeDataType createProperties(IPipeNode pipeTile) { PipeType pipeType = pipeTile.getPipeType(); - Material material = ((MaterialPipeBlock) pipeTile.getPipeBlock()).material; + Material material = ((MaterialPipeBlock) pipeTile + .getPipeBlock()).material; if (pipeType == null || material == null) { return getFallbackType(); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/block/MetaMachineBlock.java b/src/main/java/com/gregtechceu/gtceu/api/block/MetaMachineBlock.java index 41f9a56459..f2c64a0d78 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/block/MetaMachineBlock.java +++ b/src/main/java/com/gregtechceu/gtceu/api/block/MetaMachineBlock.java @@ -1,24 +1,20 @@ package com.gregtechceu.gtceu.api.block; import com.gregtechceu.gtceu.api.data.RotationState; -import com.gregtechceu.gtceu.api.item.ComponentItem; import com.gregtechceu.gtceu.api.item.IGTTool; import com.gregtechceu.gtceu.api.item.MetaMachineItem; -import com.gregtechceu.gtceu.api.item.component.IInteractionItem; -import com.gregtechceu.gtceu.api.item.component.IItemComponent; -import com.gregtechceu.gtceu.api.item.tool.GTToolItem; import com.gregtechceu.gtceu.api.item.tool.GTToolType; import com.gregtechceu.gtceu.api.item.tool.ToolHelper; -import com.gregtechceu.gtceu.api.item.tool.behavior.IToolBehavior; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; import com.gregtechceu.gtceu.api.machine.MachineDefinition; import com.gregtechceu.gtceu.api.machine.MetaMachine; import com.gregtechceu.gtceu.api.machine.feature.*; import com.gregtechceu.gtceu.common.data.GTItems; import com.gregtechceu.gtceu.utils.GTUtil; + import com.lowdragmc.lowdraglib.client.renderer.IRenderer; import com.lowdragmc.lowdraglib.utils.LocalizationUtils; -import lombok.Getter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -50,12 +46,15 @@ import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; + +import lombok.Getter; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.List; import java.util.Set; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author KilaBash * @date 2023/2/17 @@ -101,7 +100,8 @@ public IRenderer getRenderer(BlockState state) { @Override public VoxelShape getShape(BlockState pState, BlockGetter pLevel, BlockPos pPos, CollisionContext pContext) { - return getRotationState() == RotationState.NONE ? definition.getShape(Direction.NORTH) : definition.getShape(pState.getValue(getRotationState().property)); + return getRotationState() == RotationState.NONE ? definition.getShape(Direction.NORTH) : + definition.getShape(pState.getValue(getRotationState().property)); } @Override @@ -119,7 +119,8 @@ public boolean isCollisionShapeFullBlock(BlockState state, BlockGetter level, Bl } @Override - public void setPlacedBy(Level pLevel, BlockPos pPos, BlockState pState, @Nullable LivingEntity player, ItemStack pStack) { + public void setPlacedBy(Level pLevel, BlockPos pPos, BlockState pState, @Nullable LivingEntity player, + ItemStack pStack) { if (!pLevel.isClientSide) { var machine = getMachine(pLevel, pPos); if (machine instanceof IDropSaveMachine dropSaveMachine) { @@ -137,7 +138,7 @@ public void setPlacedBy(Level pLevel, BlockPos pPos, BlockState pState, @Nullabl @Override public void onPlace(BlockState state, Level level, BlockPos pos, BlockState oldState, boolean movedByPiston) { super.onPlace(state, level, pos, oldState, movedByPiston); - //needed to trigger block updates so machines connect to open cables properly. + // needed to trigger block updates so machines connect to open cables properly. level.updateNeighbourForOutputSignal(pos, this); } @@ -150,7 +151,8 @@ public BlockState getStateForPlacement(BlockPlaceContext context) { var state = defaultBlockState(); if (player != null && rotationState != RotationState.NONE) { Vec3 pos = player.position(); - if (Math.abs(pos.x - (double) ((float) blockPos.getX() + 0.5F)) < 2.0D && Math.abs(pos.z - (double) ((float) blockPos.getZ() + 0.5F)) < 2.0D) { + if (Math.abs(pos.x - (double) ((float) blockPos.getX() + 0.5F)) < 2.0D && + Math.abs(pos.z - (double) ((float) blockPos.getZ() + 0.5F)) < 2.0D) { double d0 = pos.y + (double) player.getEyeHeight(); if (d0 - (double) blockPos.getY() > 2.0D && rotationState.test(Direction.UP)) { return state.setValue(rotationState.property, Direction.UP); @@ -182,9 +184,11 @@ public ItemStack getCloneItemStack(BlockGetter level, BlockPos pos, BlockState s } @Override - public void appendHoverText(ItemStack stack, @Nullable BlockGetter level, List tooltip, TooltipFlag flag) { + public void appendHoverText(ItemStack stack, @Nullable BlockGetter level, List tooltip, + TooltipFlag flag) { definition.getTooltipBuilder().accept(stack, tooltip); - String mainKey = String.format("%s.machine.%s.tooltip", definition.getId().getNamespace(), definition.getId().getPath()); + String mainKey = String.format("%s.machine.%s.tooltip", definition.getId().getNamespace(), + definition.getId().getPath()); if (LocalizationUtils.exist(mainKey)) { tooltip.add(1, Component.translatable(mainKey)); } @@ -201,7 +205,8 @@ public boolean triggerEvent(BlockState pState, Level pLevel, BlockPos pPos, int @Override public BlockState rotate(BlockState pState, Rotation pRotation) { - return pState.setValue(this.rotationState.property, pRotation.rotate(pState.getValue(this.rotationState.property))); + return pState.setValue(this.rotationState.property, + pRotation.rotate(pState.getValue(this.rotationState.property))); } @Override @@ -235,18 +240,18 @@ public List getDrops(BlockState state, LootParams.Builder builder) { public void onRemove(BlockState pState, Level pLevel, BlockPos pPos, BlockState pNewState, boolean pIsMoving) { if (pState.hasBlockEntity()) { if (!pState.is(pNewState.getBlock())) { // new block - if(getMachine(pLevel, pPos) instanceof IMachineLife machineLife) { + if (getMachine(pLevel, pPos) instanceof IMachineLife machineLife) { machineLife.onMachineRemoved(); } pLevel.updateNeighbourForOutputSignal(pPos, this); pLevel.removeBlockEntity(pPos); - } else if (rotationState != RotationState.NONE){ // old block different facing + } else if (rotationState != RotationState.NONE) { // old block different facing var oldFacing = pState.getValue(rotationState.property); var newFacing = pNewState.getValue(rotationState.property); if (newFacing != oldFacing) { var machine = getMachine(pLevel, pPos); - if(machine != null) { + if (machine != null) { machine.onRotated(oldFacing, newFacing); } } @@ -255,7 +260,8 @@ public void onRemove(BlockState pState, Level pLevel, BlockPos pPos, BlockState } @Override - public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { + public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, + BlockHitResult hit) { var machine = getMachine(world, pos); ItemStack itemStack = player.getItemInHand(hand); boolean shouldOpenUi = true; @@ -291,7 +297,6 @@ public InteractionResult use(BlockState state, Level world, BlockPos pos, Player return shouldOpenUi ? InteractionResult.PASS : InteractionResult.CONSUME; } - public boolean canConnectRedstone(BlockGetter level, BlockPos pos, Direction side) { return getMachine(level, pos).canConnectRedstone(side); } @@ -315,7 +320,8 @@ public int getAnalogOutputSignal(BlockState state, Level level, BlockPos pos) { } @Override - public void neighborChanged(BlockState state, Level level, BlockPos pos, Block block, BlockPos fromPos, boolean isMoving) { + public void neighborChanged(BlockState state, Level level, BlockPos pos, Block block, BlockPos fromPos, + boolean isMoving) { var machine = getMachine(level, pos); if (machine != null) { machine.onNeighborChanged(block, fromPos, isMoving); @@ -323,10 +329,9 @@ public void neighborChanged(BlockState state, Level level, BlockPos pos, Block b super.neighborChanged(state, level, pos, block, fromPos, isMoving); } - - @Override - public BlockState getBlockAppearance(BlockState state, BlockAndTintGetter level, BlockPos pos, Direction side, BlockState sourceState, BlockPos sourcePos) { + public BlockState getBlockAppearance(BlockState state, BlockAndTintGetter level, BlockPos pos, Direction side, + BlockState sourceState, BlockPos sourcePos) { var machine = getMachine(level, pos); if (machine != null) { return machine.getBlockAppearance(state, level, pos, side, sourceState, sourcePos); diff --git a/src/main/java/com/gregtechceu/gtceu/api/block/OreBlock.java b/src/main/java/com/gregtechceu/gtceu/api/block/OreBlock.java index 582fbf36be..d4f8d5de0b 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/block/OreBlock.java +++ b/src/main/java/com/gregtechceu/gtceu/api/block/OreBlock.java @@ -1,12 +1,13 @@ package com.gregtechceu.gtceu.api.block; import com.gregtechceu.gtceu.api.data.chemical.material.Material; -import com.gregtechceu.gtceu.api.data.chemical.material.properties.PropertyKey; import com.gregtechceu.gtceu.api.data.tag.TagPrefix; import com.gregtechceu.gtceu.client.renderer.block.OreBlockRenderer; + import com.lowdragmc.lowdraglib.Platform; public class OreBlock extends MaterialBlock { + public OreBlock(Properties properties, TagPrefix tagPrefix, Material material, boolean registerModel) { super(properties, tagPrefix, material, false); if (registerModel && Platform.isClient()) { diff --git a/src/main/java/com/gregtechceu/gtceu/api/block/PipeBlock.java b/src/main/java/com/gregtechceu/gtceu/api/block/PipeBlock.java index cd8283bbc6..278bef0a7d 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/block/PipeBlock.java +++ b/src/main/java/com/gregtechceu/gtceu/api/block/PipeBlock.java @@ -17,7 +17,9 @@ import com.gregtechceu.gtceu.common.item.CoverPlaceBehavior; import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.utils.GTUtil; + import com.lowdragmc.lowdraglib.client.renderer.IBlockRendererProvider; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -50,13 +52,15 @@ import net.minecraft.world.phys.shapes.EntityCollisionContext; import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.List; import java.util.Set; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author KilaBash * @date 2023/2/28 @@ -65,7 +69,10 @@ @SuppressWarnings("deprecation") @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault -public abstract class PipeBlock & IPipeType, NodeDataType, WorldPipeNetType extends LevelPipeNet>> extends AppearanceBlock implements EntityBlock, IBlockRendererProvider { +public abstract class PipeBlock & IPipeType, NodeDataType, + WorldPipeNetType extends LevelPipeNet>> extends AppearanceBlock + implements EntityBlock, IBlockRendererProvider { + public final PipeType pipeType; public PipeBlock(Properties properties, PipeType pipeType) { @@ -110,7 +117,8 @@ public NodeDataType createProperties(BlockState state, @Nullable ItemStack stack protected abstract PipeModel getPipeModel(); - public void updateActiveNodeStatus(@NotNull Level worldIn, BlockPos pos, IPipeNode pipeTile) { + public void updateActiveNodeStatus(@NotNull Level worldIn, BlockPos pos, + IPipeNode pipeTile) { if (worldIn.isClientSide) return; PipeNet pipeNet = getWorldPipeNet((ServerLevel) worldIn).getNetFromPos(pos); @@ -135,7 +143,7 @@ public void onNeighborChange(BlockState state, LevelReader level, BlockPos pos, if (!ConfigHolder.INSTANCE.machines.gt6StylePipesCables) { boolean open = pipeTile.isConnected(facing); boolean canConnect = pipeTile.getCoverContainer().getCoverAtSide(facing) != null || - canConnect(pipeTile, facing); + canConnect(pipeTile, facing); if (!open && canConnect) pipeTile.setConnection(facing, true, false); if (open && !canConnect) @@ -155,7 +163,8 @@ public void onNeighborChange(BlockState state, LevelReader level, BlockPos pos, @Nullable @SuppressWarnings("unchecked") public IPipeNode getPipeTile(BlockGetter level, BlockPos pos) { - if (level.getBlockEntity(pos) instanceof IPipeNode pipeTile && pipeTile.getPipeType().type().equals(pipeType.type())) { + if (level.getBlockEntity(pos) instanceof IPipeNode pipeTile && + pipeTile.getPipeType().type().equals(pipeType.type())) { return (IPipeNode) pipeTile; } return null; @@ -175,7 +184,7 @@ public boolean canConnect(IPipeNode selfTile, Direction return false; } BlockEntity other = selfTile.getNeighbor(facing); - if (other instanceof IPipeNode node) { + if (other instanceof IPipeNode node) { cover = node.getCoverContainer().getCoverAtSide(facing.getOpposite()); if (cover != null && !cover.canPipePassThrough()) return false; @@ -191,7 +200,8 @@ public abstract boolean canPipeConnectToBlock(IPipeNode @Nullable BlockEntity tile); @Override - public void setPlacedBy(Level level, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack) { + public void setPlacedBy(Level level, BlockPos pos, BlockState state, @Nullable LivingEntity placer, + ItemStack stack) { super.setPlacedBy(level, pos, state, placer, stack); IPipeNode pipeTile = getPipeTile(level, pos); if (pipeTile != null) { @@ -200,7 +210,9 @@ public void setPlacedBy(Level level, BlockPos pos, BlockState state, @Nullable L ItemStack offhand = placer.getOffhandItem(); for (int i = 0; i < DyeColor.values().length; i++) { if (offhand.is(GTItems.SPRAY_CAN_DYES[i].get())) { - ((IInteractionItem)GTItems.SPRAY_CAN_DYES[i].get().getComponents().get(0)).useOn(new UseOnContext(player, InteractionHand.OFF_HAND, new BlockHitResult(Vec3.ZERO, player.getDirection(), pos, false))); + ((IInteractionItem) GTItems.SPRAY_CAN_DYES[i].get().getComponents().get(0)) + .useOn(new UseOnContext(player, InteractionHand.OFF_HAND, + new BlockHitResult(Vec3.ZERO, player.getDirection(), pos, false))); break; } } @@ -214,7 +226,8 @@ public void onPlace(BlockState state, Level level, BlockPos pos, BlockState oldS } @Override - public void neighborChanged(BlockState state, Level level, BlockPos pos, Block block, BlockPos fromPos, boolean isMoving) { + public void neighborChanged(BlockState state, Level level, BlockPos pos, Block block, BlockPos fromPos, + boolean isMoving) { if (level.isClientSide) return; IPipeNode pipeTile = getPipeTile(level, pos); if (pipeTile != null) { @@ -223,7 +236,7 @@ public void neighborChanged(BlockState state, Level level, BlockPos pos, Block b if (!ConfigHolder.INSTANCE.machines.gt6StylePipesCables) { boolean open = pipeTile.isConnected(facing); boolean canConnect = pipeTile.getCoverContainer().getCoverAtSide(facing) != null || - this.canConnect(pipeTile, facing); + this.canConnect(pipeTile, facing); if (!open && canConnect && state.getBlock() != block) pipeTile.setConnection(facing, true, false); if (open && !canConnect) @@ -267,7 +280,8 @@ public void tick(BlockState state, ServerLevel level, BlockPos pos, RandomSource } @Override - public InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { + public InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, + BlockHitResult hit) { ItemStack itemStack = player.getItemInHand(hand); BlockEntity entity = level.getBlockEntity(pos); @@ -305,13 +319,16 @@ public VoxelShape getShape(BlockState pState, BlockGetter pLevel, BlockPos pPos, var held = player.getMainHandItem(); Set types = Set.of(GTToolType.WIRE_CUTTER, GTToolType.WRENCH); BlockEntity tile = pLevel.getBlockEntity(pPos); - if (tile instanceof PipeBlockEntity pipeTile) { + if (tile instanceof PipeBlockEntity pipeTile) { types = Set.of(pipeTile.getPipeTuneTool()); } if (types.stream().anyMatch(type -> type.itemTags.stream().anyMatch(held::is)) || - CoverPlaceBehavior.isCoverBehaviorItem(held, coverable::hasAnyCover, coverDef -> ICoverable.canPlaceCover(coverDef, coverable)) || - (held.getItem() instanceof BlockItem blockItem && blockItem.getBlock() instanceof PipeBlock pipeBlock && pipeBlock.pipeType.type().equals(pipeType.type()))) { + CoverPlaceBehavior.isCoverBehaviorItem(held, coverable::hasAnyCover, + coverDef -> ICoverable.canPlaceCover(coverDef, coverable)) || + (held.getItem() instanceof BlockItem blockItem && + blockItem.getBlock() instanceof PipeBlock pipeBlock && + pipeBlock.pipeType.type().equals(pipeType.type()))) { return Shapes.block(); } } @@ -322,7 +339,8 @@ public VoxelShape getShape(BlockState pState, BlockGetter pLevel, BlockPos pPos, @Nullable @Override - public BlockEntityTicker getTicker(Level level, BlockState state, BlockEntityType blockEntityType) { + public BlockEntityTicker getTicker(Level level, BlockState state, + BlockEntityType blockEntityType) { if (blockEntityType == getBlockEntityType()) { if (!level.isClientSide && state.getValue(BlockProperties.SERVER_TICK)) { return (pLevel, pPos, pState, pTile) -> { @@ -335,12 +353,13 @@ public BlockEntityTicker getTicker(Level level, Block return null; } - @Override - public BlockState getBlockAppearance(BlockState state, BlockAndTintGetter level, BlockPos pos, Direction side, BlockState sourceState, BlockPos sourcePos) { + public BlockState getBlockAppearance(BlockState state, BlockAndTintGetter level, BlockPos pos, Direction side, + BlockState sourceState, BlockPos sourcePos) { var pipe = getPipeTile(level, pos); if (pipe != null) { - var appearance = pipe.getCoverContainer().getBlockAppearance(state, level, pos, side, sourceState, sourcePos); + var appearance = pipe.getCoverContainer().getBlockAppearance(state, level, pos, side, sourceState, + sourcePos); if (appearance != null) return appearance; } return super.getBlockAppearance(state, level, pos, side, sourceState, sourcePos); @@ -350,7 +369,7 @@ public BlockState getBlockAppearance(BlockState state, BlockAndTintGetter level, public List getDrops(BlockState state, LootParams.Builder builder) { var context = builder.withParameter(LootContextParams.BLOCK_STATE, state).create(LootContextParamSets.BLOCK); BlockEntity tileEntity = context.getParamOrNull(LootContextParams.BLOCK_ENTITY); - if (tileEntity instanceof IPipeNode pipeTile) { + if (tileEntity instanceof IPipeNode pipeTile) { for (Direction direction : GTUtil.DIRECTIONS) { pipeTile.getCoverContainer().removeCover(direction, null); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/block/RendererBlock.java b/src/main/java/com/gregtechceu/gtceu/api/block/RendererBlock.java index 0e22cd535a..d2f67ef700 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/block/RendererBlock.java +++ b/src/main/java/com/gregtechceu/gtceu/api/block/RendererBlock.java @@ -2,9 +2,11 @@ import com.lowdragmc.lowdraglib.client.renderer.IBlockRendererProvider; import com.lowdragmc.lowdraglib.client.renderer.IRenderer; + import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + import org.jetbrains.annotations.Nullable; /** @@ -13,6 +15,7 @@ * @implNote BlockStateModelBlock */ public class RendererBlock extends AppearanceBlock implements IBlockRendererProvider { + public final IRenderer renderer; public RendererBlock(Properties properties, IRenderer renderer) { @@ -26,5 +29,4 @@ public RendererBlock(Properties properties, IRenderer renderer) { public IRenderer getRenderer(BlockState state) { return renderer; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/block/RendererGlassBlock.java b/src/main/java/com/gregtechceu/gtceu/api/block/RendererGlassBlock.java index 62077bd9d9..f60a498518 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/block/RendererGlassBlock.java +++ b/src/main/java/com/gregtechceu/gtceu/api/block/RendererGlassBlock.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.api.block; import com.lowdragmc.lowdraglib.client.renderer.IRenderer; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.level.BlockGetter; @@ -15,6 +16,7 @@ * @implNote RendererGlassBlock */ public class RendererGlassBlock extends RendererBlock { + public RendererGlassBlock(Properties properties, IRenderer renderer) { super(properties, renderer); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/block/RendererMaterialBlock.java b/src/main/java/com/gregtechceu/gtceu/api/block/RendererMaterialBlock.java index f9491be979..ddd25dd4e5 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/block/RendererMaterialBlock.java +++ b/src/main/java/com/gregtechceu/gtceu/api/block/RendererMaterialBlock.java @@ -2,17 +2,22 @@ import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.api.data.tag.TagPrefix; + import com.lowdragmc.lowdraglib.client.renderer.IBlockRendererProvider; import com.lowdragmc.lowdraglib.client.renderer.IRenderer; + import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + import org.jetbrains.annotations.Nullable; public class RendererMaterialBlock extends MaterialBlock implements IBlockRendererProvider { + public final IRenderer renderer; - public RendererMaterialBlock(Properties properties, TagPrefix tagPrefix, Material material, @Nullable IRenderer renderer) { + public RendererMaterialBlock(Properties properties, TagPrefix tagPrefix, Material material, + @Nullable IRenderer renderer) { super(properties, tagPrefix, material, false); this.renderer = renderer; } diff --git a/src/main/java/com/gregtechceu/gtceu/api/block/SimpleCoilType.java b/src/main/java/com/gregtechceu/gtceu/api/block/SimpleCoilType.java index 8495f8023c..4d8e733708 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/block/SimpleCoilType.java +++ b/src/main/java/com/gregtechceu/gtceu/api/block/SimpleCoilType.java @@ -2,22 +2,24 @@ import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.utils.SupplierMemoizer; -import lombok.Getter; + import net.minecraft.resources.ResourceLocation; import net.minecraft.util.StringRepresentable; +import lombok.Getter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.function.Supplier; public class SimpleCoilType implements ICoilType, StringRepresentable { + @Getter private final String name; - //electric blast furnace properties + // electric blast furnace properties @Getter private final int coilTemperature; - //multi smelter properties + // multi smelter properties @Getter private final int level; @Getter @@ -29,7 +31,8 @@ public class SimpleCoilType implements ICoilType, StringRepresentable { @Getter private final ResourceLocation texture; - public SimpleCoilType(String name, int coilTemperature, int level, int energyDiscount, int tier, @NotNull Supplier<@Nullable Material> material, ResourceLocation texture) { + public SimpleCoilType(String name, int coilTemperature, int level, int energyDiscount, int tier, + @NotNull Supplier<@Nullable Material> material, ResourceLocation texture) { this.name = name; this.coilTemperature = coilTemperature; this.level = level; diff --git a/src/main/java/com/gregtechceu/gtceu/api/blockentity/IPaintable.java b/src/main/java/com/gregtechceu/gtceu/api/blockentity/IPaintable.java index 6b006b9ee2..4513aed152 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/blockentity/IPaintable.java +++ b/src/main/java/com/gregtechceu/gtceu/api/blockentity/IPaintable.java @@ -10,6 +10,7 @@ public interface IPaintable { /** * Get painting color. * It's not the real color of this block. + * * @return -1 - non painted. */ int getPaintingColor(); diff --git a/src/main/java/com/gregtechceu/gtceu/api/blockentity/ITickSubscription.java b/src/main/java/com/gregtechceu/gtceu/api/blockentity/ITickSubscription.java index 2f3addc221..2b0c15991a 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/blockentity/ITickSubscription.java +++ b/src/main/java/com/gregtechceu/gtceu/api/blockentity/ITickSubscription.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.api.blockentity; import com.gregtechceu.gtceu.api.machine.TickableSubscription; + import net.minecraft.world.level.block.entity.BlockEntity; import org.jetbrains.annotations.Nullable; @@ -13,7 +14,8 @@ public interface ITickSubscription { /** - * For initialization. To get level and property fields after auto sync, you can subscribe it in {@link BlockEntity#clearRemoved()} event. + * For initialization. To get level and property fields after auto sync, you can subscribe it in + * {@link BlockEntity#clearRemoved()} event. */ @Nullable TickableSubscription subscribeServerTick(Runnable runnable); @@ -27,5 +29,4 @@ default TickableSubscription subscribeServerTick(@Nullable TickableSubscription } return last; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/blockentity/MetaMachineBlockEntity.java b/src/main/java/com/gregtechceu/gtceu/api/blockentity/MetaMachineBlockEntity.java index 7a223fc681..49e5ef21ac 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/blockentity/MetaMachineBlockEntity.java +++ b/src/main/java/com/gregtechceu/gtceu/api/blockentity/MetaMachineBlockEntity.java @@ -1,7 +1,5 @@ package com.gregtechceu.gtceu.api.blockentity; -import appeng.api.networking.IInWorldGridNodeHost; -import appeng.capabilities.Capabilities; import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.capability.*; @@ -20,6 +18,7 @@ import com.gregtechceu.gtceu.client.renderer.GTRendererProvider; import com.gregtechceu.gtceu.common.pipelike.fluidpipe.longdistance.LDFluidEndpointMachine; import com.gregtechceu.gtceu.common.pipelike.item.longdistance.LDItemEndpointMachine; + import com.lowdragmc.lowdraglib.client.renderer.IRenderer; import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; import com.lowdragmc.lowdraglib.side.fluid.FluidTransferHelper; @@ -28,7 +27,7 @@ import com.lowdragmc.lowdraglib.side.item.IItemTransfer; import com.lowdragmc.lowdraglib.side.item.forge.ItemTransferHelperImpl; import com.lowdragmc.lowdraglib.syncdata.managed.MultiManagedStorage; -import lombok.Getter; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.entity.player.Player; @@ -42,6 +41,10 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.common.util.LazyOptional; + +import appeng.api.networking.IInWorldGridNodeHost; +import appeng.capabilities.Capabilities; +import lombok.Getter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -56,6 +59,7 @@ * @implNote MetaMachineBlockEntity */ public class MetaMachineBlockEntity extends BlockEntity implements IMachineBlockEntity { + public final MultiManagedStorage managedStorage = new MultiManagedStorage(); @Getter public final MetaMachine metaMachine; @@ -66,12 +70,12 @@ protected MetaMachineBlockEntity(BlockEntityType type, BlockPos pos, BlockSta this.metaMachine = getDefinition().createMetaMachine(this); } - public static MetaMachineBlockEntity createBlockEntity(BlockEntityType type, BlockPos pos, BlockState blockState) { + public static MetaMachineBlockEntity createBlockEntity(BlockEntityType type, BlockPos pos, + BlockState blockState) { return new MetaMachineBlockEntity(type, pos, blockState); } - public static void onBlockEntityRegister(BlockEntityType metaMachineBlockEntityBlockEntityType) { - } + public static void onBlockEntityRegister(BlockEntityType metaMachineBlockEntityBlockEntityType) {} @Override public MultiManagedStorage getRootStorage() { @@ -89,7 +93,6 @@ public boolean triggerEvent(int id, int para) { return false; } - @Override public long getOffset() { return offset; @@ -131,7 +134,8 @@ public void setChanged() { } @Nullable - public static LazyOptional getCapability(MetaMachine machine, @NotNull Capability cap, @Nullable Direction side) { + public static LazyOptional getCapability(MetaMachine machine, @NotNull Capability cap, + @Nullable Direction side) { if (cap == GTCapability.CAPABILITY_COVERABLE) { return GTCapability.CAPABILITY_COVERABLE.orEmpty(cap, LazyOptional.of(machine::getCoverContainer)); } else if (cap == GTCapability.CAPABILITY_TOOLABLE) { @@ -166,23 +170,28 @@ public static LazyOptional getCapability(MetaMachine machine, @NotNull Ca } var list = getCapabilitiesFromTraits(machine.getTraits(), side, IEnergyContainer.class); if (!list.isEmpty()) { - return GTCapability.CAPABILITY_ENERGY_CONTAINER.orEmpty(cap, LazyOptional.of(() -> list.size() == 1 ? list.get(0) : new EnergyContainerList(list))); + return GTCapability.CAPABILITY_ENERGY_CONTAINER.orEmpty(cap, + LazyOptional.of(() -> list.size() == 1 ? list.get(0) : new EnergyContainerList(list))); } } else if (cap == GTCapability.CAPABILITY_ENERGY_INFO_PROVIDER) { if (machine instanceof IEnergyInfoProvider energyInfoProvider) { - return GTCapability.CAPABILITY_ENERGY_INFO_PROVIDER.orEmpty(cap, LazyOptional.of(() -> energyInfoProvider)); + return GTCapability.CAPABILITY_ENERGY_INFO_PROVIDER.orEmpty(cap, + LazyOptional.of(() -> energyInfoProvider)); } var list = getCapabilitiesFromTraits(machine.getTraits(), side, IEnergyInfoProvider.class); if (!list.isEmpty()) { - return GTCapability.CAPABILITY_ENERGY_INFO_PROVIDER.orEmpty(cap, LazyOptional.of(() -> list.size() == 1 ? list.get(0) : new EnergyInfoProviderList(list))); + return GTCapability.CAPABILITY_ENERGY_INFO_PROVIDER.orEmpty(cap, + LazyOptional.of(() -> list.size() == 1 ? list.get(0) : new EnergyInfoProviderList(list))); } } else if (cap == GTCapability.CAPABILITY_CLEANROOM_RECEIVER) { if (machine instanceof ICleanroomReceiver cleanroomReceiver) { - return GTCapability.CAPABILITY_CLEANROOM_RECEIVER.orEmpty(cap, LazyOptional.of(() -> cleanroomReceiver)); + return GTCapability.CAPABILITY_CLEANROOM_RECEIVER.orEmpty(cap, + LazyOptional.of(() -> cleanroomReceiver)); } } else if (cap == GTCapability.CAPABILITY_MAINTENANCE_MACHINE) { if (machine instanceof IMaintenanceMachine maintenanceMachine) { - return GTCapability.CAPABILITY_MAINTENANCE_MACHINE.orEmpty(cap, LazyOptional.of(() -> maintenanceMachine)); + return GTCapability.CAPABILITY_MAINTENANCE_MACHINE.orEmpty(cap, + LazyOptional.of(() -> maintenanceMachine)); } } else if (cap == ForgeCapabilities.ITEM_HANDLER) { if (machine instanceof LDItemEndpointMachine fluidEndpointMachine) { @@ -190,16 +199,17 @@ public static LazyOptional getCapability(MetaMachine machine, @NotNull Ca ILDEndpoint endpoint = fluidEndpointMachine.getLink(); if (endpoint == null) return null; Direction outputFacing = fluidEndpointMachine.getOutputFacing(); - IItemTransfer transfer = ItemTransferHelperImpl.getItemTransfer(machine.getLevel(), endpoint.getPos().relative(outputFacing), outputFacing.getOpposite()); + IItemTransfer transfer = ItemTransferHelperImpl.getItemTransfer(machine.getLevel(), + endpoint.getPos().relative(outputFacing), outputFacing.getOpposite()); if (transfer != null) { - return ForgeCapabilities.ITEM_HANDLER.orEmpty(cap, LazyOptional.of(() -> - ItemTransferHelperImpl.toItemHandler(new LDItemEndpointMachine.ItemHandlerWrapper(transfer)) - )); + return ForgeCapabilities.ITEM_HANDLER.orEmpty(cap, LazyOptional.of(() -> ItemTransferHelperImpl + .toItemHandler(new LDItemEndpointMachine.ItemHandlerWrapper(transfer)))); } } var transfer = machine.getItemTransferCap(side, true); if (transfer != null) { - return ForgeCapabilities.ITEM_HANDLER.orEmpty(cap, LazyOptional.of(() -> ItemTransferHelperImpl.toItemHandler(transfer))); + return ForgeCapabilities.ITEM_HANDLER.orEmpty(cap, + LazyOptional.of(() -> ItemTransferHelperImpl.toItemHandler(transfer))); } } else if (cap == ForgeCapabilities.FLUID_HANDLER) { if (machine instanceof LDFluidEndpointMachine fluidEndpointMachine) { @@ -207,25 +217,28 @@ public static LazyOptional getCapability(MetaMachine machine, @NotNull Ca ILDEndpoint endpoint = fluidEndpointMachine.getLink(); if (endpoint == null) return null; Direction outputFacing = fluidEndpointMachine.getOutputFacing(); - IFluidTransfer transfer = FluidTransferHelper.getFluidTransfer(machine.getLevel(), endpoint.getPos().relative(outputFacing), outputFacing.getOpposite()); + IFluidTransfer transfer = FluidTransferHelper.getFluidTransfer(machine.getLevel(), + endpoint.getPos().relative(outputFacing), outputFacing.getOpposite()); if (transfer != null) { - return ForgeCapabilities.FLUID_HANDLER.orEmpty(cap, LazyOptional.of(() -> - FluidTransferHelperImpl.toFluidHandler(new LDFluidEndpointMachine.FluidHandlerWrapper(transfer)) - )); + return ForgeCapabilities.FLUID_HANDLER.orEmpty(cap, LazyOptional.of(() -> FluidTransferHelperImpl + .toFluidHandler(new LDFluidEndpointMachine.FluidHandlerWrapper(transfer)))); } } var transfer = machine.getFluidTransferCap(side, true); if (transfer != null) { - return ForgeCapabilities.FLUID_HANDLER.orEmpty(cap, LazyOptional.of(() -> FluidTransferHelperImpl.toFluidHandler(transfer))); + return ForgeCapabilities.FLUID_HANDLER.orEmpty(cap, + LazyOptional.of(() -> FluidTransferHelperImpl.toFluidHandler(transfer))); } } else if (cap == ForgeCapabilities.ENERGY) { if (machine instanceof IPlatformEnergyStorage platformEnergyStorage) { - return ForgeCapabilities.ENERGY.orEmpty(cap, LazyOptional.of(() -> GTEnergyHelperImpl.toEnergyStorage(platformEnergyStorage))); + return ForgeCapabilities.ENERGY.orEmpty(cap, + LazyOptional.of(() -> GTEnergyHelperImpl.toEnergyStorage(platformEnergyStorage))); } var list = getCapabilitiesFromTraits(machine.getTraits(), side, IPlatformEnergyStorage.class); if (!list.isEmpty()) { // TODO wrap list in the future - return ForgeCapabilities.ENERGY.orEmpty(cap, LazyOptional.of(() -> GTEnergyHelperImpl.toEnergyStorage(list.get(0)))); + return ForgeCapabilities.ENERGY.orEmpty(cap, + LazyOptional.of(() -> GTEnergyHelperImpl.toEnergyStorage(list.get(0)))); } } else if (cap == GTCapability.CAPABILITY_LASER) { if (machine instanceof ILaserContainer energyContainer) { @@ -233,11 +246,13 @@ public static LazyOptional getCapability(MetaMachine machine, @NotNull Ca } var list = getCapabilitiesFromTraits(machine.getTraits(), side, ILaserContainer.class); if (!list.isEmpty()) { - return GTCapability.CAPABILITY_LASER.orEmpty(cap, LazyOptional.of(() -> list.size() == 1 ? list.get(0) : new LaserContainerList(list))); + return GTCapability.CAPABILITY_LASER.orEmpty(cap, + LazyOptional.of(() -> list.size() == 1 ? list.get(0) : new LaserContainerList(list))); } } else if (cap == GTCapability.CAPABILITY_COMPUTATION_PROVIDER) { if (machine instanceof IOpticalComputationProvider computationProvider) { - return GTCapability.CAPABILITY_COMPUTATION_PROVIDER.orEmpty(cap, LazyOptional.of(() -> computationProvider)); + return GTCapability.CAPABILITY_COMPUTATION_PROVIDER.orEmpty(cap, + LazyOptional.of(() -> computationProvider)); } var list = getCapabilitiesFromTraits(machine.getTraits(), side, IOpticalComputationProvider.class); if (!list.isEmpty()) { @@ -267,7 +282,8 @@ public static LazyOptional getCapability(MetaMachine machine, @NotNull Ca return null; } - public static List getCapabilitiesFromTraits(List traits, Direction accessSide, Class capability) { + public static List getCapabilitiesFromTraits(List traits, Direction accessSide, + Class capability) { if (traits.isEmpty()) return Collections.emptyList(); List list = new ArrayList<>(); for (MachineTrait trait : traits) { @@ -289,7 +305,7 @@ public AABB getRenderBoundingBox() { if (instance != null) { IRenderer renderer = instance.getRenderer(this); if (renderer != null) { - if (renderer.getViewDistance() == 64 /*the default*/) { + if (renderer.getViewDistance() == 64 /* the default */) { return new AABB(worldPosition.offset(-1, 0, -1), worldPosition.offset(2, 2, 2)); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/blockentity/PipeBlockEntity.java b/src/main/java/com/gregtechceu/gtceu/api/blockentity/PipeBlockEntity.java index 1313ec1b53..e0bd3ac205 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/blockentity/PipeBlockEntity.java +++ b/src/main/java/com/gregtechceu/gtceu/api/blockentity/PipeBlockEntity.java @@ -13,20 +13,19 @@ import com.gregtechceu.gtceu.api.item.tool.IToolGridHighLight; import com.gregtechceu.gtceu.api.machine.TickableSubscription; import com.gregtechceu.gtceu.api.pipenet.*; -import com.lowdragmc.lowdraglib.syncdata.IEnhancedManaged; -import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; import com.gregtechceu.gtceu.utils.GTUtil; + import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; +import com.lowdragmc.lowdraglib.syncdata.IEnhancedManaged; import com.lowdragmc.lowdraglib.syncdata.IManagedStorage; 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.blockentity.IAsyncAutoSyncBlockEntity; import com.lowdragmc.lowdraglib.syncdata.blockentity.IAutoPersistBlockEntity; import com.lowdragmc.lowdraglib.syncdata.field.FieldManagedStorage; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import com.mojang.datafixers.util.Pair; -import lombok.Getter; -import lombok.Setter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -43,12 +42,17 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.BlockHitResult; +import com.mojang.datafixers.util.Pair; +import lombok.Getter; +import lombok.Setter; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; + import java.util.ArrayList; import java.util.List; import java.util.Set; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author KilaBash * @date 2023/2/28 @@ -56,7 +60,9 @@ */ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault -public abstract class PipeBlockEntity & IPipeType, NodeDataType> extends BlockEntity implements IPipeNode, IEnhancedManaged, IAsyncAutoSyncBlockEntity, IAutoPersistBlockEntity, IToolGridHighLight, IToolable { +public abstract class PipeBlockEntity & IPipeType, NodeDataType> + extends BlockEntity implements IPipeNode, IEnhancedManaged, + IAsyncAutoSyncBlockEntity, IAutoPersistBlockEntity, IToolGridHighLight, IToolable { public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(PipeBlockEntity.class); @Getter @@ -68,7 +74,8 @@ public abstract class PipeBlockEntity & IPipeTyp @Persisted(key = "cover") protected final PipeCoverContainer coverContainer; - @Getter @Setter + @Getter + @Setter @DescSynced @Persisted @RequireRerender @@ -80,24 +87,29 @@ public abstract class PipeBlockEntity & IPipeTyp private int blockedConnections = Node.ALL_CLOSED; private NodeDataType cachedNodeData; - @Persisted @DescSynced @RequireRerender - @Getter @Setter + @Persisted + @DescSynced + @RequireRerender + @Getter + @Setter private int paintingColor = -1; - @Persisted @DescSynced @RequireRerender + @Persisted + @DescSynced + @RequireRerender private String frameMaterial; private final List serverTicks; private final List waitingToAdd; public PipeBlockEntity(BlockEntityType type, BlockPos pos, BlockState blockState) { super(type, pos, blockState); - this.coverContainer = new PipeCoverContainer(this); + this.coverContainer = new PipeCoverContainer(this); this.serverTicks = new ArrayList<>(); this.waitingToAdd = new ArrayList<>(); } ////////////////////////////////////// - //***** Initialization ******// + // ***** Initialization ******// ////////////////////////////////////// public void scheduleRenderUpdate() { IPipeNode.super.scheduleRenderUpdate(); @@ -172,7 +184,8 @@ public TickableSubscription subscribeServerTick(Runnable runnable) { if (getLevel() instanceof ServerLevel serverLevel) { blockState = blockState.setValue(BlockProperties.SERVER_TICK, true); setBlockState(blockState); - serverLevel.getServer().tell(new TickTask(0, () -> serverLevel.setBlockAndUpdate(getBlockPos(), getBlockState().setValue(BlockProperties.SERVER_TICK, true)))); + serverLevel.getServer().tell(new TickTask(0, () -> serverLevel.setBlockAndUpdate(getBlockPos(), + getBlockState().setValue(BlockProperties.SERVER_TICK, true)))); } } return subscription; @@ -207,7 +220,7 @@ public final void serverTick() { } ////////////////////////////////////// - //******* Pipe Status *******// + // ******* Pipe Status *******// ////////////////////////////////////// @Override @@ -237,7 +250,8 @@ public int getVisualConnections() { @Override public void setConnection(Direction side, boolean connected, boolean fromNeighbor) { - // fix desync between two connections. Can happen if a pipe side is blocked, and a new pipe is placed next to it. + // fix desync between two connections. Can happen if a pipe side is blocked, and a new pipe is placed next to + // it. if (!getLevel().isClientSide) { if (isConnected(side) == connected) { return; @@ -245,8 +259,8 @@ public void setConnection(Direction side, boolean connected, boolean fromNeighbo BlockEntity tile = getNeighbor(side); // block connections if Pipe Types do not match if (connected && - tile instanceof IPipeNode pipeTile && - pipeTile.getPipeType().getClass() != this.getPipeType().getClass()) { + tile instanceof IPipeNode pipeTile && + pipeTile.getPipeType().getClass() != this.getPipeType().getClass()) { return; } connections = withSideConnection(connections, side, connected); @@ -310,7 +324,7 @@ public void setChanged() { } ////////////////////////////////////// - //******* Interaction *******// + // ******* Interaction *******// ////////////////////////////////////// @Override public boolean shouldRenderGrid(Player player, ItemStack held, Set toolTypes) { @@ -342,13 +356,15 @@ public ResourceTexture sideTips(Player player, Set toolTypes, Direct } @Override - public Pair onToolClick(Set toolTypes, ItemStack itemStack, UseOnContext context) { + public Pair onToolClick(Set toolTypes, ItemStack itemStack, + UseOnContext context) { // the side hit from the machine grid var playerIn = context.getPlayer(); if (playerIn == null) return Pair.of(null, InteractionResult.PASS); var hand = context.getHand(); - var hitResult = new BlockHitResult(context.getClickLocation(), context.getClickedFace(), context.getClickedPos(), false); + var hitResult = new BlockHitResult(context.getClickLocation(), context.getClickedFace(), + context.getClickedPos(), false); Direction gridSide = ICoverable.determineGridSideHit(hitResult); CoverBehavior coverBehavior = gridSide == null ? null : coverContainer.getCoverAtSide(gridSide); if (gridSide == null) gridSide = hitResult.getDirection(); @@ -389,7 +405,8 @@ public GTToolType getPipeTuneTool() { @Override public int getDefaultPaintingColor() { - return this.getPipeBlock() instanceof MaterialPipeBlock materialPipeBlock ? materialPipeBlock.material.getMaterialRGB() : IPipeNode.super.getDefaultPaintingColor(); + return this.getPipeBlock() instanceof MaterialPipeBlock materialPipeBlock ? + materialPipeBlock.material.getMaterialRGB() : IPipeNode.super.getDefaultPaintingColor(); } @Nullable @@ -402,11 +419,11 @@ public void doExplosion(float explosionPower) { getLevel().removeBlock(getPipePos(), false); if (!getLevel().isClientSide) { ((ServerLevel) getLevel()).sendParticles(ParticleTypes.LARGE_SMOKE, getPipePos().getX() + 0.5, - getPipePos().getY() + 0.5, getPipePos().getZ() + 0.5, - 10, 0.2, 0.2, 0.2, 0.0); + getPipePos().getY() + 0.5, getPipePos().getZ() + 0.5, + 10, 0.2, 0.2, 0.2, 0.0); } getLevel().explode(null, getPipePos().getX() + 0.5, getPipePos().getY() + 0.5, getPipePos().getZ() + 0.5, - explosionPower, Level.ExplosionInteraction.NONE); + explosionPower, Level.ExplosionInteraction.NONE); } public static boolean isFaceBlocked(int blockedConnections, Direction side) { @@ -416,5 +433,4 @@ public static boolean isFaceBlocked(int blockedConnections, Direction side) { public static boolean isConnected(int connections, Direction side) { return (connections & (1 << side.ordinal())) > 0; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/GTCapabilityHelper.java b/src/main/java/com/gregtechceu/gtceu/api/capability/GTCapabilityHelper.java index f2ecd1164b..d8cb3b798a 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/GTCapabilityHelper.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/GTCapabilityHelper.java @@ -4,14 +4,17 @@ import com.gregtechceu.gtceu.api.capability.forge.GTEnergyHelperImpl; import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMaintenanceMachine; import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import net.minecraft.world.entity.Entity; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.energy.IEnergyStorage; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; /** @@ -20,6 +23,7 @@ * @implNote EnergyContainerHelper */ public class GTCapabilityHelper { + @Nullable public static IElectricItem getElectricItem(ItemStack itemStack) { return itemStack.getCapability(GTCapability.CAPABILITY_ELECTRIC_ITEM).resolve().orElse(null); @@ -94,7 +98,8 @@ public static ILaserContainer getLaser(Level level, BlockPos pos, @Nullable Dire } @Nullable - public static IOpticalComputationProvider getOpticalComputationProvider(Level level, BlockPos pos, @Nullable Direction side) { + public static IOpticalComputationProvider getOpticalComputationProvider(Level level, BlockPos pos, + @Nullable Direction side) { return getBlockEntityCapability(GTCapability.CAPABILITY_COMPUTATION_PROVIDER, level, pos, side); } @@ -104,7 +109,8 @@ public static IDataAccessHatch getDataAccess(Level level, BlockPos pos, @Nullabl } @Nullable - private static T getBlockEntityCapability(Capability capability, Level level, BlockPos pos, @Nullable Direction side) { + private static T getBlockEntityCapability(Capability capability, Level level, BlockPos pos, + @Nullable Direction side) { if (level.getBlockState(pos).hasBlockEntity()) { var blockEntity = level.getBlockEntity(pos); if (blockEntity != null) { @@ -113,4 +119,9 @@ private static T getBlockEntityCapability(Capability capability, Level le } return null; } + + @Nullable + public static IHazardEffectTracker getHazardEffectTracker(@NotNull Entity entity) { + return entity.getCapability(GTCapability.CAPABILITY_HAZARD_EFFECT_TRACKER, null).resolve().orElse(null); + } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/IControllable.java b/src/main/java/com/gregtechceu/gtceu/api/capability/IControllable.java index 9d5f89106b..ec83009b79 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/IControllable.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/IControllable.java @@ -13,5 +13,4 @@ public interface IControllable { * @param isWorkingAllowed true if the workable can work, otherwise false */ void setWorkingEnabled(boolean isWorkingAllowed); - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/ICoverable.java b/src/main/java/com/gregtechceu/gtceu/api/capability/ICoverable.java index cd0d29063b..1b703bb84d 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/ICoverable.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/ICoverable.java @@ -5,9 +5,11 @@ import com.gregtechceu.gtceu.api.cover.CoverBehavior; import com.gregtechceu.gtceu.api.cover.CoverDefinition; import com.gregtechceu.gtceu.utils.GTUtil; + import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.side.fluid.IFluidTransfer; import com.lowdragmc.lowdraglib.side.item.IItemTransfer; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.server.level.ServerPlayer; @@ -22,6 +24,7 @@ import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; + import org.jetbrains.annotations.Nullable; import java.util.ArrayList; @@ -30,7 +33,6 @@ import java.util.Objects; import java.util.stream.Collectors; - public interface ICoverable extends ITickSubscription, IAppearance { Level getLevel(); @@ -59,12 +61,15 @@ public interface ICoverable extends ITickSubscription, IAppearance { // TODO replace getItemTransferCap and getFluidTransferCap with a cross-platform capability implementation IItemTransfer getItemTransferCap(@Nullable Direction side, boolean useCoverCapability); + IFluidTransfer getFluidTransferCap(@Nullable Direction side, boolean useCoverCapability); /** * Its an internal method, you should never call it yourself. *
- * Use {@link ICoverable#removeCover(boolean, Direction, Player)} and {@link ICoverable#placeCoverOnSide(Direction, ItemStack, CoverDefinition, ServerPlayer)} instead + * Use {@link ICoverable#removeCover(boolean, Direction, Player)} and + * {@link ICoverable#placeCoverOnSide(Direction, ItemStack, CoverDefinition, ServerPlayer)} instead + * * @param coverBehavior * @param side */ @@ -73,7 +78,8 @@ public interface ICoverable extends ITickSubscription, IAppearance { @Nullable CoverBehavior getCoverAtSide(Direction side); - default boolean placeCoverOnSide(Direction side, ItemStack itemStack, CoverDefinition coverDefinition, ServerPlayer player) { + default boolean placeCoverOnSide(Direction side, ItemStack itemStack, CoverDefinition coverDefinition, + ServerPlayer player) { CoverBehavior coverBehavior = coverDefinition.createCoverBehavior(this, side); if (!canPlaceCoverOnSide(coverDefinition, side) || !coverBehavior.canAttach()) { return false; @@ -88,7 +94,7 @@ default boolean placeCoverOnSide(Direction side, ItemStack itemStack, CoverDefin markDirty(); scheduleNeighborShapeUpdate(); // TODO achievement -// AdvancementTriggers.FIRST_COVER_PLACE.trigger((PlayerMP) player); + // AdvancementTriggers.FIRST_COVER_PLACE.trigger((PlayerMP) player); return true; } @@ -130,7 +136,8 @@ default boolean removeCover(Direction side, @Nullable Player player) { } default List getCovers() { - return Arrays.stream(GTUtil.DIRECTIONS).map(this::getCoverAtSide).filter(Objects::nonNull).collect(Collectors.toList()); + return Arrays.stream(GTUtil.DIRECTIONS).map(this::getCoverAtSide).filter(Objects::nonNull) + .collect(Collectors.toList()); } default void onLoad() { @@ -145,7 +152,7 @@ default void onUnload() { } } - default void onNeighborChanged(Block block, BlockPos fromPos, boolean isMoving){ + default void onNeighborChanged(Block block, BlockPos fromPos, boolean isMoving) { for (CoverBehavior cover : getCovers()) { cover.onNeighborChanged(block, fromPos, isMoving); } @@ -184,7 +191,7 @@ static boolean doesCoverCollide(Direction side, List collisionBox, d if (side == null) { return false; } - + if (plateThickness > 0.0) { var coverPlateBox = getCoverPlateBox(side, plateThickness); var aabbs = coverPlateBox.toAabbs(); @@ -207,8 +214,8 @@ static Direction rayTraceCoverableSide(ICoverable coverable, Player player) { return traceCoverSide(rayTrace); } - class PrimaryBoxData { + public final boolean usePlacementGrid; public PrimaryBoxData(boolean usePlacementGrid) { @@ -254,7 +261,8 @@ static boolean canPlaceCover(CoverDefinition coverDef, ICoverable coverable) { @Nullable @Override - default BlockState getBlockAppearance(BlockState state, BlockAndTintGetter level, BlockPos pos, Direction side, BlockState sourceState, BlockPos sourcePos) { + default BlockState getBlockAppearance(BlockState state, BlockAndTintGetter level, BlockPos pos, Direction side, + BlockState sourceState, BlockPos sourcePos) { if (hasCover(side)) { return getCoverAtSide(side).getAppearance(sourceState, sourcePos); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/IDataAccessHatch.java b/src/main/java/com/gregtechceu/gtceu/api/capability/IDataAccessHatch.java index 0eae1d2086..094a9471c5 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/IDataAccessHatch.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/IDataAccessHatch.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.api.capability; import com.gregtechceu.gtceu.api.recipe.GTRecipe; + import org.jetbrains.annotations.NotNull; import java.util.ArrayList; @@ -42,4 +43,4 @@ default GTRecipe modifyRecipe(GTRecipe recipe) { * @return true if this Data Access Hatch is creative or not */ boolean isCreative(); -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/IElectricItem.java b/src/main/java/com/gregtechceu/gtceu/api/capability/IElectricItem.java index 80e5f66637..202ddebc75 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/IElectricItem.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/IElectricItem.java @@ -1,6 +1,5 @@ package com.gregtechceu.gtceu.api.capability; - public interface IElectricItem { /** @@ -80,5 +79,4 @@ default boolean canUse(long amount) { * @return The tier of the item. */ int getTier(); - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/IEnergyContainer.java b/src/main/java/com/gregtechceu/gtceu/api/capability/IEnergyContainer.java index 333a5f5097..7440cf1c5f 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/IEnergyContainer.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/IEnergyContainer.java @@ -1,6 +1,5 @@ package com.gregtechceu.gtceu.api.capability; - import net.minecraft.core.Direction; import java.math.BigInteger; @@ -76,7 +75,6 @@ default long getEnergyCanBeInserted() { */ long getEnergyCapacity(); - @Override default EnergyInfo getEnergyInfo() { return new EnergyInfo(BigInteger.valueOf(getEnergyCapacity()), BigInteger.valueOf(getEnergyStored())); @@ -108,7 +106,7 @@ default long getOutputVoltage() { /** * @return output energy packet size - * Overflowing this value will explode machine. + * Overflowing this value will explode machine. */ long getInputVoltage(); @@ -128,13 +126,14 @@ default long getOutputPerSec() { /** * @return true if information like energy capacity should be hidden from TOP. - * Useful for cables + * Useful for cables */ default boolean isOneProbeHidden() { return false; } IEnergyContainer DEFAULT = new IEnergyContainer() { + @Override public long acceptEnergyFromNetwork(Direction Direction, long l, long l1) { return 0; diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/IEnergyInfoProvider.java b/src/main/java/com/gregtechceu/gtceu/api/capability/IEnergyInfoProvider.java index 11e9f9b9c3..acca06f960 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/IEnergyInfoProvider.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/IEnergyInfoProvider.java @@ -3,8 +3,8 @@ import java.math.BigInteger; public interface IEnergyInfoProvider { - record EnergyInfo(BigInteger capacity, BigInteger stored) { - } + + record EnergyInfo(BigInteger capacity, BigInteger stored) {} EnergyInfo getEnergyInfo(); diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/IHPCAComponentHatch.java b/src/main/java/com/gregtechceu/gtceu/api/capability/IHPCAComponentHatch.java index 4988daff35..51ea1429ee 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/IHPCAComponentHatch.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/IHPCAComponentHatch.java @@ -47,4 +47,4 @@ default void setDamaged(boolean damaged) {} * The icon for this component in the HPCA's UI. Should be a 13x13 px sprite. */ ResourceTexture getComponentIcon(); -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/IHPCAComputationProvider.java b/src/main/java/com/gregtechceu/gtceu/api/capability/IHPCAComputationProvider.java index 0eaac14b9e..615dde99b6 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/IHPCAComputationProvider.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/IHPCAComputationProvider.java @@ -11,4 +11,4 @@ public interface IHPCAComputationProvider extends IHPCAComponentHatch { * How much coolant/t this component needs when running at max CWU/t. */ int getCoolingPerTick(); -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/IHPCACoolantProvider.java b/src/main/java/com/gregtechceu/gtceu/api/capability/IHPCACoolantProvider.java index 68dc649230..838851b1c3 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/IHPCACoolantProvider.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/IHPCACoolantProvider.java @@ -22,4 +22,4 @@ public interface IHPCACoolantProvider extends IHPCAComponentHatch { default int getMaxCoolantPerTick() { return 0; } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/IHazardEffectTracker.java b/src/main/java/com/gregtechceu/gtceu/api/capability/IHazardEffectTracker.java new file mode 100644 index 0000000000..b753ce9e5f --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/IHazardEffectTracker.java @@ -0,0 +1,32 @@ +package com.gregtechceu.gtceu.api.capability; + +import com.gregtechceu.gtceu.api.data.chemical.material.Material; + +import it.unimi.dsi.fastutil.objects.Object2IntMap; + +import java.util.Set; + +public interface IHazardEffectTracker { + + /** + * @return a set of hazard effect to how long it's been applied for. + */ + Set getExtraHazards(); + + /** + * @return a map of material to how long its effects been applied for. + */ + Object2IntMap getCurrentHazards(); + + /** + * @return the maximum air supply for the entity this is attached to. -1 for default (300). + */ + // default maxAirSupply for players is 300. + int getMaxAirSupply(); + + void startTick(); + + void tick(Material material); + + void endTick(); +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/ILaserContainer.java b/src/main/java/com/gregtechceu/gtceu/api/capability/ILaserContainer.java index b795b26302..fbfcb5ed16 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/ILaserContainer.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/ILaserContainer.java @@ -3,5 +3,4 @@ /** * It is its own separate interface to make piping work easier */ -public interface ILaserContainer extends IEnergyContainer { -} \ No newline at end of file +public interface ILaserContainer extends IEnergyContainer {} diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/IMiner.java b/src/main/java/com/gregtechceu/gtceu/api/capability/IMiner.java index 2566612b0b..0b08daa6aa 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/IMiner.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/IMiner.java @@ -5,6 +5,7 @@ import com.gregtechceu.gtceu.common.machine.trait.miner.MinerLogic; public interface IMiner extends IRecipeLogicMachine, IMachineLife { + @Override MinerLogic getRecipeLogic(); diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/IObjectHolder.java b/src/main/java/com/gregtechceu/gtceu/api/capability/IObjectHolder.java index e217cbf5ff..04c7637718 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/IObjectHolder.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/IObjectHolder.java @@ -1,17 +1,21 @@ package com.gregtechceu.gtceu.api.capability; import com.gregtechceu.gtceu.api.machine.trait.NotifiableItemStackHandler; + import net.minecraft.core.Direction; import net.minecraft.world.item.ItemStack; + import org.jetbrains.annotations.NotNull; public interface IObjectHolder { /** * Get the item held in the object holder. + * * @param remove Whether to also remove the item from its slot. */ - @NotNull ItemStack getHeldItem(boolean remove); + @NotNull + ItemStack getHeldItem(boolean remove); /** * Set the item held in the object holder. Overwrites the currently held item. @@ -20,6 +24,7 @@ public interface IObjectHolder { /** * Get the data item held in the object holder. + * * @param remove Whether to also remove the item from its slot. */ @NotNull @@ -40,5 +45,6 @@ public interface IObjectHolder { /** * @return the object holder's contents represented as an IItemHandler */ - @NotNull NotifiableItemStackHandler getAsHandler(); + @NotNull + NotifiableItemStackHandler getAsHandler(); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/IOpticalComputationHatch.java b/src/main/java/com/gregtechceu/gtceu/api/capability/IOpticalComputationHatch.java index d734354469..1b1235ce8a 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/IOpticalComputationHatch.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/IOpticalComputationHatch.java @@ -4,4 +4,4 @@ public interface IOpticalComputationHatch extends IOpticalComputationProvider { /** If this hatch transmits or receives CWU/t. */ boolean isTransmitter(); -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/IOpticalComputationProvider.java b/src/main/java/com/gregtechceu/gtceu/api/capability/IOpticalComputationProvider.java index 26fe94cb50..999197c823 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/IOpticalComputationProvider.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/IOpticalComputationProvider.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.api.capability; import org.jetbrains.annotations.NotNull; + import java.util.ArrayList; import java.util.Collection; @@ -66,4 +67,4 @@ default boolean canBridge() { * @param seen The Optical Computation Providers already checked */ boolean canBridge(@NotNull Collection seen); -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/IOpticalComputationReceiver.java b/src/main/java/com/gregtechceu/gtceu/api/capability/IOpticalComputationReceiver.java index f5c22b4cc3..204a6c311a 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/IOpticalComputationReceiver.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/IOpticalComputationReceiver.java @@ -1,6 +1,5 @@ package com.gregtechceu.gtceu.api.capability; - import com.gregtechceu.gtceu.api.machine.trait.NotifiableComputationContainer; /** @@ -9,4 +8,4 @@ public interface IOpticalComputationReceiver { IOpticalComputationProvider getComputationProvider(); -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/IOpticalDataAccessHatch.java b/src/main/java/com/gregtechceu/gtceu/api/capability/IOpticalDataAccessHatch.java index 4138530331..2b40949941 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/IOpticalDataAccessHatch.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/IOpticalDataAccessHatch.java @@ -6,4 +6,4 @@ public interface IOpticalDataAccessHatch extends IDataAccessHatch { * @return if this hatch transmits data through cables */ boolean isTransmitter(); -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/IPlatformEnergyStorage.java b/src/main/java/com/gregtechceu/gtceu/api/capability/IPlatformEnergyStorage.java index 4e37eaf696..5b4181f965 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/IPlatformEnergyStorage.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/IPlatformEnergyStorage.java @@ -5,7 +5,8 @@ public interface IPlatformEnergyStorage { /** * Return false if calling {@link #insert} will absolutely always return 0, or true otherwise or in doubt. * - *

Note: This function is meant to be used by cables or other devices that can transfer energy to know if + *

+ * Note: This function is meant to be used by cables or other devices that can transfer energy to know if * they should interact with this storage at all. */ boolean supportsInsertion(); @@ -14,7 +15,7 @@ public interface IPlatformEnergyStorage { * Try to insert up to some amount of energy into this storage. * * @param maxAmount The maximum amount of energy to insert. May not be negative. - * @param simulate Is this a test? + * @param simulate Is this a test? * @return A nonnegative integer not greater than maxAmount: the amount that was inserted. */ long insert(long maxAmount, boolean simulate); @@ -22,7 +23,8 @@ public interface IPlatformEnergyStorage { /** * Return false if calling {@link #extract} will absolutely always return 0, or true otherwise or in doubt. * - *

Note: This function is meant to be used by cables or other devices that can transfer energy to know if + *

+ * Note: This function is meant to be used by cables or other devices that can transfer energy to know if * they should interact with this storage at all. */ boolean supportsExtraction(); @@ -31,7 +33,7 @@ public interface IPlatformEnergyStorage { * Try to extract up to some amount of energy from this storage. * * @param maxAmount The maximum amount of energy to extract. May not be negative. - * @param simulate Is this a test? + * @param simulate Is this a test? * @return A nonnegative integer not greater than maxAmount: the amount that was extracted. */ long extract(long maxAmount, boolean simulate); diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/IPropertyFluidFilter.java b/src/main/java/com/gregtechceu/gtceu/api/capability/IPropertyFluidFilter.java index 2a2dc94701..244756638f 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/IPropertyFluidFilter.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/IPropertyFluidFilter.java @@ -4,14 +4,16 @@ import com.gregtechceu.gtceu.api.fluids.attribute.FluidAttribute; import com.gregtechceu.gtceu.api.fluids.attribute.IAttributedFluid; import com.gregtechceu.gtceu.utils.GTUtil; + import com.lowdragmc.lowdraglib.side.fluid.FluidHelper; import com.lowdragmc.lowdraglib.side.fluid.FluidStack; + import net.minecraft.network.chat.Component; import net.minecraft.world.level.material.Fluid; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.UnmodifiableView; -import org.jetbrains.annotations.NotNull; import java.util.Collection; import java.util.List; import java.util.function.Predicate; @@ -64,12 +66,14 @@ default boolean test(@NotNull FluidStack stack) { /** * Set the container as able to contain an attribute * - * @param attribute the attribute to change containment status for + * @param attribute the attribute to change containment status for * @param canContain whether the attribute can be contained */ void setCanContain(@NotNull FluidAttribute attribute, boolean canContain); - @NotNull @UnmodifiableView Collection<@NotNull FluidAttribute> getContainedAttributes(); + @NotNull + @UnmodifiableView + Collection<@NotNull FluidAttribute> getContainedAttributes(); /** * Append tooltips about containment info @@ -80,7 +84,8 @@ default boolean test(@NotNull FluidStack stack) { */ default void appendTooltips(@NotNull List tooltip, boolean showToolsInfo, boolean showTemperatureInfo) { if (GTUtil.isShiftDown()) { - if (showTemperatureInfo) tooltip.add(Component.translatable("gtceu.fluid_pipe.max_temperature", getMaxFluidTemperature())); + if (showTemperatureInfo) + tooltip.add(Component.translatable("gtceu.fluid_pipe.max_temperature", getMaxFluidTemperature())); if (isGasProof()) tooltip.add(Component.translatable("gtceu.fluid_pipe.gas_proof")); else tooltip.add(Component.translatable("gtceu.fluid_pipe.not_gas_proof")); if (isPlasmaProof()) tooltip.add(Component.translatable("gtceu.fluid_pipe.plasma_proof")); diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/IThermalFluidHandlerItemStack.java b/src/main/java/com/gregtechceu/gtceu/api/capability/IThermalFluidHandlerItemStack.java index f7825ac9d1..d1d397519f 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/IThermalFluidHandlerItemStack.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/IThermalFluidHandlerItemStack.java @@ -3,12 +3,15 @@ import com.gregtechceu.gtceu.api.fluids.attribute.FluidAttribute; import com.gregtechceu.gtceu.api.fluids.attribute.FluidAttributes; import com.gregtechceu.gtceu.api.fluids.attribute.IAttributedFluid; + import com.lowdragmc.lowdraglib.side.fluid.FluidHelper; import com.lowdragmc.lowdraglib.side.fluid.FluidStack; + import net.minecraft.world.level.material.Fluid; /** * Interface for FluidHandlerItemStacks which handle GT's unique fluid mechanics + * * @see FluidAttribute * @see FluidAttributes * @see IAttributedFluid @@ -31,13 +34,13 @@ default boolean canFillFluidType(FluidStack stack) { if (FluidHelper.isLighterThanAir(stack) && !isGasProof()) return false; // TODO custom fluid -// for (RegistryEntry entry : GTRegistries.REGISTRATE.getAll(Registry.FLUID_REGISTRY)) { -// if (entry.get() == fluid) { -// FluidType fluidType = ((MaterialFluid) fluid).getFluidType(); -// if (fluidType == FluidTypes.ACID && !isAcidProof()) return false; -// if (fluidType == FluidTypes.PLASMA && !isPlasmaProof()) return false; -// } -// } + // for (RegistryEntry entry : GTRegistries.REGISTRATE.getAll(Registry.FLUID_REGISTRY)) { + // if (entry.get() == fluid) { + // FluidType fluidType = ((MaterialFluid) fluid).getFluidType(); + // if (fluidType == FluidTypes.ACID && !isAcidProof()) return false; + // if (fluidType == FluidTypes.PLASMA && !isPlasmaProof()) return false; + // } + // } return true; } diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/IToolable.java b/src/main/java/com/gregtechceu/gtceu/api/capability/IToolable.java index 7d4b1308af..0abb344c13 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/IToolable.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/IToolable.java @@ -1,13 +1,15 @@ package com.gregtechceu.gtceu.api.capability; import com.gregtechceu.gtceu.api.item.tool.GTToolType; -import com.mojang.datafixers.util.Pair; + import net.minecraft.world.InteractionResult; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.context.UseOnContext; -import org.jetbrains.annotations.Nullable; +import com.mojang.datafixers.util.Pair; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + import java.util.Set; /** @@ -20,8 +22,9 @@ public interface IToolable { /** * Called when a player clicks this meta tile entity with a tool * - * @return SUCCESS / CONSUME (will damage tool) / FAIL if something happened, so tools will get damaged and animations will be played + * @return SUCCESS / CONSUME (will damage tool) / FAIL if something happened, so tools will get damaged and + * animations will be played */ - Pair<@Nullable GTToolType, InteractionResult> onToolClick(@NotNull Set toolTypes, ItemStack itemStack, UseOnContext context); - + Pair<@Nullable GTToolType, InteractionResult> onToolClick(@NotNull Set toolTypes, ItemStack itemStack, + UseOnContext context); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/IWorkable.java b/src/main/java/com/gregtechceu/gtceu/api/capability/IWorkable.java index f3f36300cc..72a2f63147 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/IWorkable.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/IWorkable.java @@ -19,5 +19,4 @@ public interface IWorkable extends IControllable { * @return true is machine is active */ boolean isActive(); - -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/PlatformEnergyCompat.java b/src/main/java/com/gregtechceu/gtceu/api/capability/PlatformEnergyCompat.java index 29763dde0e..41bc743975 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/PlatformEnergyCompat.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/PlatformEnergyCompat.java @@ -8,11 +8,13 @@ public class PlatformEnergyCompat { * Conversion ratio used by energy converters */ public static int ratio(boolean nativeToEu) { - return nativeToEu ? ConfigHolder.INSTANCE.compat.energy.platformToEuRatio : ConfigHolder.INSTANCE.compat.energy.euToPlatformRatio; + return nativeToEu ? ConfigHolder.INSTANCE.compat.energy.platformToEuRatio : + ConfigHolder.INSTANCE.compat.energy.euToPlatformRatio; } /** * Converts eu to native energy, using specified ratio + * * @return amount of native energy */ public static int toNative(long eu, int ratio) { @@ -22,6 +24,7 @@ public static int toNative(long eu, int ratio) { /** * Converts eu to native energy, using specified ratio, and returns as a long. * Can be used for overflow protection. + * * @return amount of native energy */ public static long toNativeLong(long eu, int ratio) { @@ -31,6 +34,7 @@ public static long toNativeLong(long eu, int ratio) { /** * Converts eu to native energy, using a specified ratio, and with a specified upper bound. * This can be useful for dealing with int-overflows when converting from a long to an int. + * * @return amount of native energy */ public static long toNativeBounded(long eu, int ratio, int max) { @@ -39,17 +43,19 @@ public static long toNativeBounded(long eu, int ratio, int max) { /** * Converts native energy to eu, using specified ratio + * * @return amount of eu */ - public static long toEu(long nat, int ratio){ + public static long toEu(long nat, int ratio) { return nat / ratio; } /** * Inserts energy to the storage. EU -> FE conversion is performed. + * * @return amount of EU inserted */ - public static long insertEu(IPlatformEnergyStorage storage, long amountEU){ + public static long insertEu(IPlatformEnergyStorage storage, long amountEU) { int euToNativeRatio = ratio(false); long nativeSent = storage.insert(toNativeLong(amountEU, euToNativeRatio), true); return toEu(storage.insert(nativeSent - (nativeSent % euToNativeRatio), false), euToNativeRatio); @@ -57,9 +63,10 @@ public static long insertEu(IPlatformEnergyStorage storage, long amountEU){ /** * Extracts energy from the storage. EU -> FE conversion is performed. + * * @return amount of EU extracted */ - public static long extractEu(IPlatformEnergyStorage storage, long amountEU){ + public static long extractEu(IPlatformEnergyStorage storage, long amountEU) { int euToNativeRatio = ratio(false); long extract = storage.extract(toNativeLong(amountEU, euToNativeRatio), true); return toEu(storage.extract(extract - (extract % euToNativeRatio), false), euToNativeRatio); diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/forge/CombinedCapabilityProvider.java b/src/main/java/com/gregtechceu/gtceu/api/capability/forge/CombinedCapabilityProvider.java index f6db91fdf9..2b7cf2a541 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/forge/CombinedCapabilityProvider.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/forge/CombinedCapabilityProvider.java @@ -4,6 +4,7 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.common.util.LazyOptional; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -31,4 +32,4 @@ public CombinedCapabilityProvider(List providers) { } return LazyOptional.empty(); } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/forge/GTCapability.java b/src/main/java/com/gregtechceu/gtceu/api/capability/forge/GTCapability.java index 26a9e9bd71..3330870b89 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/forge/GTCapability.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/forge/GTCapability.java @@ -3,6 +3,7 @@ import com.gregtechceu.gtceu.api.capability.*; import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMaintenanceMachine; import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; + import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.CapabilityManager; import net.minecraftforge.common.capabilities.CapabilityToken; @@ -14,19 +15,33 @@ * @implNote GTCapabilities */ public class GTCapability { - public static final Capability CAPABILITY_ENERGY_CONTAINER = CapabilityManager.get(new CapabilityToken<>() {}); - public static final Capability CAPABILITY_ENERGY_INFO_PROVIDER = CapabilityManager.get(new CapabilityToken<>() {}); + + public static final Capability CAPABILITY_ENERGY_CONTAINER = CapabilityManager + .get(new CapabilityToken<>() {}); + public static final Capability CAPABILITY_ENERGY_INFO_PROVIDER = CapabilityManager + .get(new CapabilityToken<>() {}); public static final Capability CAPABILITY_COVERABLE = CapabilityManager.get(new CapabilityToken<>() {}); public static final Capability CAPABILITY_TOOLABLE = CapabilityManager.get(new CapabilityToken<>() {}); public static final Capability CAPABILITY_WORKABLE = CapabilityManager.get(new CapabilityToken<>() {}); - public static final Capability CAPABILITY_CONTROLLABLE = CapabilityManager.get(new CapabilityToken<>() {}); - public static final Capability CAPABILITY_RECIPE_LOGIC = CapabilityManager.get(new CapabilityToken<>() {}); - public static final Capability CAPABILITY_ELECTRIC_ITEM = CapabilityManager.get(new CapabilityToken<>() {}); - public static final Capability CAPABILITY_CLEANROOM_RECEIVER = CapabilityManager.get(new CapabilityToken<>() {}); - public static final Capability CAPABILITY_MAINTENANCE_MACHINE = CapabilityManager.get(new CapabilityToken<>() {}); - public static final Capability CAPABILITY_LASER = CapabilityManager.get(new CapabilityToken<>() {}); - public static final Capability CAPABILITY_COMPUTATION_PROVIDER = CapabilityManager.get(new CapabilityToken<>() {}); - public static final Capability CAPABILITY_DATA_ACCESS = CapabilityManager.get(new CapabilityToken<>() {}); + public static final Capability CAPABILITY_CONTROLLABLE = CapabilityManager + .get(new CapabilityToken<>() {}); + public static final Capability CAPABILITY_RECIPE_LOGIC = CapabilityManager + .get(new CapabilityToken<>() {}); + public static final Capability CAPABILITY_ELECTRIC_ITEM = CapabilityManager + .get(new CapabilityToken<>() {}); + public static final Capability CAPABILITY_CLEANROOM_RECEIVER = CapabilityManager + .get(new CapabilityToken<>() {}); + public static final Capability CAPABILITY_MAINTENANCE_MACHINE = CapabilityManager + .get(new CapabilityToken<>() {}); + public static final Capability CAPABILITY_LASER = CapabilityManager + .get(new CapabilityToken<>() {}); + public static final Capability CAPABILITY_COMPUTATION_PROVIDER = CapabilityManager + .get(new CapabilityToken<>() {}); + public static final Capability CAPABILITY_DATA_ACCESS = CapabilityManager + .get(new CapabilityToken<>() {}); + + public static final Capability CAPABILITY_HAZARD_EFFECT_TRACKER = CapabilityManager + .get(new CapabilityToken<>() {}); public static void register(RegisterCapabilitiesEvent event) { event.register(IEnergyContainer.class); @@ -42,6 +57,7 @@ public static void register(RegisterCapabilitiesEvent event) { event.register(ILaserContainer.class); event.register(IOpticalComputationProvider.class); event.register(IDataAccessHatch.class); - } + event.register(IHazardEffectTracker.class); + } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/forge/GTEnergyHelperImpl.java b/src/main/java/com/gregtechceu/gtceu/api/capability/forge/GTEnergyHelperImpl.java index 515a117160..b8a30e94b9 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/forge/GTEnergyHelperImpl.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/forge/GTEnergyHelperImpl.java @@ -1,12 +1,14 @@ package com.gregtechceu.gtceu.api.capability.forge; import com.gregtechceu.gtceu.api.capability.IPlatformEnergyStorage; + import net.minecraftforge.energy.IEnergyStorage; public class GTEnergyHelperImpl { public static IPlatformEnergyStorage toPlatformEnergyStorage(IEnergyStorage handler) { return new IPlatformEnergyStorage() { + @Override public long insert(long maxAmount, boolean simulate) { return handler.receiveEnergy((int) maxAmount, simulate); diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/forge/compat/EUToFEProvider.java b/src/main/java/com/gregtechceu/gtceu/api/capability/forge/compat/EUToFEProvider.java index eeff2f901c..8a9a7bb041 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/forge/compat/EUToFEProvider.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/forge/compat/EUToFEProvider.java @@ -8,6 +8,7 @@ import com.gregtechceu.gtceu.api.capability.forge.GTEnergyHelperImpl; import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.utils.GTUtil; + import net.minecraft.core.Direction; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraftforge.common.capabilities.Capability; @@ -32,11 +33,15 @@ public EUToFEProvider(BlockEntity tileEntity) { @Override public LazyOptional getCapability(@NotNull Capability capability, Direction facing) { - if (!ConfigHolder.INSTANCE.compat.energy.nativeEUToPlatformNative || capability != GTCapability.CAPABILITY_ENERGY_CONTAINER) + if (!ConfigHolder.INSTANCE.compat.energy.nativeEUToPlatformNative || + capability != GTCapability.CAPABILITY_ENERGY_CONTAINER) return LazyOptional.empty(); LazyOptional energyStorage = getUpvalueCapability(ForgeCapabilities.ENERGY, facing); - return energyStorage.isPresent() ? GTCapability.CAPABILITY_ENERGY_CONTAINER.orEmpty(capability, LazyOptional.of(() -> new GTEnergyWrapper(energyStorage.resolve().get()))) : LazyOptional.empty(); + return energyStorage.isPresent() ? + GTCapability.CAPABILITY_ENERGY_CONTAINER.orEmpty(capability, + LazyOptional.of(() -> new GTEnergyWrapper(energyStorage.resolve().get()))) : + LazyOptional.empty(); } public class GTEnergyWrapper implements IEnergyContainer { @@ -49,7 +54,6 @@ public GTEnergyWrapper(IEnergyStorage energyStorage) { @Override public long acceptEnergyFromNetwork(Direction facing, long voltage, long amperage) { - long receive = 0; // Try to use the internal buffer before consuming a new packet @@ -156,9 +160,12 @@ public long getEnergyStored() { } /** - * Most RF/FE cables blindly try to insert energy without checking if there is space, since the receiving IEnergyStorage should handle it. - * This simulates that behavior in most places by allowing our "is there space" checks to pass and letting the cable attempt to insert energy. - * If the wrapped TE actually cannot accept any more energy, the energy transfer will return 0 before any changes to our internal rf buffer. + * Most RF/FE cables blindly try to insert energy without checking if there is space, since the receiving + * IEnergyStorage should handle it. + * This simulates that behavior in most places by allowing our "is there space" checks to pass and letting the + * cable attempt to insert energy. + * If the wrapped TE actually cannot accept any more energy, the energy transfer will return 0 before any + * changes to our internal rf buffer. */ @Override public long getEnergyCanBeInserted() { @@ -175,7 +182,8 @@ public long getInputVoltage() { long maxInput = energyStorage.insert(Integer.MAX_VALUE, true); if (maxInput == 0) return 0; - return GTValues.V[GTUtil.getTierByVoltage(PlatformEnergyCompat.toEu(maxInput, PlatformEnergyCompat.ratio(false)))]; + return GTValues.V[GTUtil + .getTierByVoltage(PlatformEnergyCompat.toEu(maxInput, PlatformEnergyCompat.ratio(false)))]; } @Override @@ -211,4 +219,4 @@ public boolean isOneProbeHidden() { public static int safeCastLongToInt(long v) { return v > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) v; } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/BlockStateRecipeCapability.java b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/BlockStateRecipeCapability.java index bdc35faa2b..5ff165fbdd 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/BlockStateRecipeCapability.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/BlockStateRecipeCapability.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.api.capability.recipe; import com.gregtechceu.gtceu.api.recipe.content.SerializerBlockState; + import net.minecraft.world.level.block.state.BlockState; public class BlockStateRecipeCapability extends RecipeCapability { @@ -15,4 +16,4 @@ protected BlockStateRecipeCapability() { public BlockState copyInner(BlockState content) { return content; } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/CWURecipeCapability.java b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/CWURecipeCapability.java index 7bb9df0f0d..c9bddb0b23 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/CWURecipeCapability.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/CWURecipeCapability.java @@ -1,12 +1,14 @@ package com.gregtechceu.gtceu.api.capability.recipe; +import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.content.Content; import com.gregtechceu.gtceu.api.recipe.content.ContentModifier; import com.gregtechceu.gtceu.api.recipe.content.SerializerInteger; -import com.gregtechceu.gtceu.api.recipe.content.SerializerLong; + import com.lowdragmc.lowdraglib.gui.widget.LabelWidget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.utils.LocalizationUtils; + import org.apache.commons.lang3.mutable.MutableInt; import java.util.List; @@ -35,10 +37,16 @@ public Integer copyWithModifier(Integer content, ContentModifier modifier) { } @Override - public void addXEIInfo(WidgetGroup group, int xOffset, List contents, boolean perTick, boolean isInput, MutableInt yOffset) { - if (perTick && isInput) { + public void addXEIInfo(WidgetGroup group, int xOffset, GTRecipe recipe, List contents, boolean perTick, + boolean isInput, MutableInt yOffset) { + if (perTick) { int cwu = contents.stream().map(Content::getContent).mapToInt(CWURecipeCapability.CAP::of).sum(); - group.addWidget(new LabelWidget(3 - xOffset, yOffset.addAndGet(10), LocalizationUtils.format("gtceu.recipe.computation_per_tick", cwu))); + group.addWidget(new LabelWidget(3 - xOffset, yOffset.addAndGet(10), + LocalizationUtils.format("gtceu.recipe.computation_per_tick", cwu))); + } + if (recipe.data.getBoolean("duration_is_total_cwu")) { + group.addWidget(new LabelWidget(3 - xOffset, yOffset.addAndGet(10), + LocalizationUtils.format("gtceu.recipe.total_computation", recipe.duration))); } } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/EURecipeCapability.java b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/EURecipeCapability.java index 30de885dcb..25822e366c 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/EURecipeCapability.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/EURecipeCapability.java @@ -1,7 +1,6 @@ package com.gregtechceu.gtceu.api.capability.recipe; import com.gregtechceu.gtceu.api.GTValues; -import com.gregtechceu.gtceu.api.capability.IEnergyContainer; import com.gregtechceu.gtceu.api.machine.feature.IOverclockMachine; import com.gregtechceu.gtceu.api.machine.feature.ITieredMachine; import com.gregtechceu.gtceu.api.recipe.GTRecipe; @@ -10,9 +9,7 @@ import com.gregtechceu.gtceu.api.recipe.content.SerializerLong; import java.util.Collection; -import java.util.Collections; import java.util.List; -import java.util.Objects; /** * @author KilaBash diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/FluidRecipeCapability.java b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/FluidRecipeCapability.java index d121ed5293..9bc80c2320 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/FluidRecipeCapability.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/FluidRecipeCapability.java @@ -16,6 +16,7 @@ import com.gregtechceu.gtceu.utils.GTHashMaps; import com.gregtechceu.gtceu.utils.OverlayedFluidHandler; import com.gregtechceu.gtceu.utils.OverlayingFluidStorage; + import com.lowdragmc.lowdraglib.gui.texture.ProgressTexture; import com.lowdragmc.lowdraglib.gui.widget.TankWidget; import com.lowdragmc.lowdraglib.gui.widget.Widget; @@ -24,14 +25,16 @@ import com.lowdragmc.lowdraglib.side.fluid.FluidStack; import com.lowdragmc.lowdraglib.side.fluid.IFluidTransfer; import com.lowdragmc.lowdraglib.utils.TagOrCycleFluidTransfer; -import com.mojang.datafixers.util.Either; -import com.mojang.datafixers.util.Pair; -import it.unimi.dsi.fastutil.objects.Object2LongLinkedOpenHashMap; -import it.unimi.dsi.fastutil.objects.ObjectArrayList; + import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; import net.minecraft.tags.TagKey; import net.minecraft.world.level.material.Fluid; + +import com.mojang.datafixers.util.Either; +import com.mojang.datafixers.util.Pair; +import it.unimi.dsi.fastutil.objects.Object2LongLinkedOpenHashMap; +import it.unimi.dsi.fastutil.objects.ObjectArrayList; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.UnknownNullability; @@ -75,14 +78,16 @@ public List convertToMapIngredient(Object obj) { } else { Collection fluids = value.getFluids(); for (Fluid fluid : fluids) { - ingredients.add(new MapFluidIngredient(FluidStack.create(fluid, ingredient.getAmount(), ingredient.getNbt()))); + ingredients.add(new MapFluidIngredient( + FluidStack.create(fluid, ingredient.getAmount(), ingredient.getNbt()))); } } } } else if (obj instanceof FluidStack stack) { ingredients.add(new MapFluidIngredient(stack)); - //noinspection deprecation - stack.getFluid().builtInRegistryHolder().tags().forEach(tag -> ingredients.add(new MapFluidTagIngredient(tag))); + // noinspection deprecation + stack.getFluid().builtInRegistryHolder().tags() + .forEach(tag -> ingredients.add(new MapFluidTagIngredient(tag))); } return ingredients; @@ -142,12 +147,12 @@ public int limitParallel(GTRecipe recipe, IRecipeCapabilityHolder holder, int mu int maxMultiplier = multiplier; OverlayedFluidHandler overlayedFluidHandler = new OverlayedFluidHandler(new FluidTransferList( - Objects.requireNonNullElseGet(holder.getCapabilitiesProxy().get(IO.OUT, FluidRecipeCapability.CAP), Collections::emptyList) - .stream() - .filter(IFluidTransfer.class::isInstance) - .map(IFluidTransfer.class::cast) - .toList() - )); + Objects.requireNonNullElseGet(holder.getCapabilitiesProxy().get(IO.OUT, FluidRecipeCapability.CAP), + Collections::emptyList) + .stream() + .filter(IFluidTransfer.class::isInstance) + .map(IFluidTransfer.class::cast) + .toList())); while (minMultiplier != maxMultiplier) { overlayedFluidHandler.reset(); @@ -155,11 +160,11 @@ public int limitParallel(GTRecipe recipe, IRecipeCapabilityHolder holder, int mu long amountLeft = 0; for (FluidStack fluidStack : recipe.getOutputContents(FluidRecipeCapability.CAP) - .stream() - .map(FluidRecipeCapability.CAP::of) - .filter(ingredient -> !ingredient.isEmpty()) - .map(ingredient -> ingredient.getStacks()[0]) - .toList()) { + .stream() + .map(FluidRecipeCapability.CAP::of) + .filter(ingredient -> !ingredient.isEmpty()) + .map(ingredient -> ingredient.getStacks()[0]) + .toList()) { if (fluidStack.getAmount() <= 0) continue; // Since multiplier starts at Int.MAX, check here for integer overflow if (multiplier > Integer.MAX_VALUE / fluidStack.getAmount()) { @@ -188,11 +193,15 @@ public int limitParallel(GTRecipe recipe, IRecipeCapabilityHolder holder, int mu @Override public int getMaxParallelRatio(IRecipeCapabilityHolder holder, GTRecipe recipe, int parallelAmount) { // Find all the fluids in the combined Fluid Input inventories and create oversized FluidStacks - Map fluidStacks = Objects.requireNonNullElseGet(holder.getCapabilitiesProxy().get(IO.IN, FluidRecipeCapability.CAP), Collections::>emptyList) - .stream() - .map(container -> container.getContents().stream().filter(FluidStack.class::isInstance).map(FluidStack.class::cast).toList()) - .flatMap(container -> GTHashMaps.fromFluidCollection(container).entrySet().stream()) - .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, Long::sum, Object2LongLinkedOpenHashMap::new)); + Map fluidStacks = Objects + .requireNonNullElseGet(holder.getCapabilitiesProxy().get(IO.IN, FluidRecipeCapability.CAP), + Collections::>emptyList) + .stream() + .map(container -> container.getContents().stream().filter(FluidStack.class::isInstance) + .map(FluidStack.class::cast).toList()) + .flatMap(container -> GTHashMaps.fromFluidCollection(container).entrySet().stream()) + .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, Long::sum, + Object2LongLinkedOpenHashMap::new)); int minMultiplier = Integer.MAX_VALUE; // map the recipe input fluids to account for duplicated fluids, @@ -204,11 +213,11 @@ public int getMaxParallelRatio(IRecipeCapabilityHolder holder, GTRecipe recipe, long fluidAmount = fluidInput.getAmount(); if (content.chance == 0.0f) { notConsumableMap.computeIfPresent(new FluidKey(fluidInput.getStacks()[0]), - (k, v) -> v + fluidAmount); + (k, v) -> v + fluidAmount); notConsumableMap.putIfAbsent(new FluidKey(fluidInput.getStacks()[0]), fluidAmount); } else { fluidCountMap.computeIfPresent(new FluidKey(fluidInput.getStacks()[0]), - (k, v) -> v + fluidAmount); + (k, v) -> v + fluidAmount); fluidCountMap.putIfAbsent(new FluidKey(fluidInput.getStacks()[0]), fluidAmount); } } @@ -278,14 +287,14 @@ public int getMaxParallelRatio(IRecipeCapabilityHolder holder, GTRecipe recipe, @Override public @NotNull List createXEIContainerContents(List contents, GTRecipe recipe, IO io) { return contents.stream().map(content -> content.content) - .map(this::of) - .map(FluidRecipeCapability::mapFluid) - .collect(Collectors.toList()); + .map(this::of) + .map(FluidRecipeCapability::mapFluid) + .collect(Collectors.toList()); } public Object createXEIContainer(List contents) { // cast is safe if you don't pass the wrong thing. - //noinspection unchecked + // noinspection unchecked return new TagOrCycleFluidTransfer((List, Long>>, List>>) contents); } @@ -327,7 +336,8 @@ public void applyWidgetInfo(@NotNull Widget widget, tank.setXEIChance(content.chance); tank.setOnAddedTooltips((w, tooltips) -> { GTRecipeWidget.setConsumedChance(content, tooltips); - if (index >= (io == IO.IN ? recipe.getInputContents(this) : recipe.getOutputContents(this)).size()) { + if (index >= + (io == IO.IN ? recipe.getInputContents(this) : recipe.getOutputContents(this)).size()) { tooltips.add(Component.translatable("gtceu.gui.content.per_tick")); } }); @@ -351,7 +361,7 @@ public static Either, Long>>, List> mapFluid } if (!tags.isEmpty()) { return Either.left(tags); - }else { + } else { return Either.right(fluids); } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/IFilteredHandler.java b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/IFilteredHandler.java index 106adadfca..51dfe4c3cf 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/IFilteredHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/IFilteredHandler.java @@ -4,14 +4,16 @@ import java.util.function.Predicate; public interface IFilteredHandler extends Predicate { + Comparator> PRIORITY_COMPARATOR = Comparator.comparingInt(IFilteredHandler::getPriority); int NO_PRIORITY = Integer.MIN_VALUE; /** * Test an ingredient for filtering & priority. + * * @param ingredient the ingredient * @return {@code true} if the input argument matches the predicate, - * otherwise {@code false} + * otherwise {@code false} */ @Override default boolean test(K ingredient) { diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/IO.java b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/IO.java index 9c22ffb140..40a905e48e 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/IO.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/IO.java @@ -1,14 +1,17 @@ package com.gregtechceu.gtceu.api.capability.recipe; import com.gregtechceu.gtceu.api.gui.widget.EnumSelectorWidget; + import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; + import lombok.Getter; /** * The capability can be input or output or both */ public enum IO implements EnumSelectorWidget.SelectableEnum { + IN("gtceu.io.import", "import"), OUT("gtceu.io.export", "export"), BOTH("gtceu.io.both", "both"), @@ -29,5 +32,4 @@ public boolean support(IO io) { if (io == NONE) return false; return this == BOTH; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/IRecipeCapabilityHolder.java b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/IRecipeCapabilityHolder.java index 90588f5705..28291dc3f8 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/IRecipeCapabilityHolder.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/IRecipeCapabilityHolder.java @@ -1,10 +1,9 @@ package com.gregtechceu.gtceu.api.capability.recipe; import com.google.common.collect.Table; - import org.jetbrains.annotations.NotNull; -import java.util.List; +import java.util.List; public interface IRecipeCapabilityHolder { @@ -22,5 +21,4 @@ default boolean hasProxies() { default int getChanceTier() { return 0; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/IRecipeHandler.java b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/IRecipeHandler.java index 9cb03af2c3..3b4126cda5 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/IRecipeHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/IRecipeHandler.java @@ -1,8 +1,8 @@ package com.gregtechceu.gtceu.api.capability.recipe; import com.gregtechceu.gtceu.api.recipe.GTRecipe; -import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import it.unimi.dsi.fastutil.objects.ObjectArrayList; import org.jetbrains.annotations.Nullable; import java.util.Comparator; @@ -15,6 +15,7 @@ * @implNote IRecipeHandler */ public interface IRecipeHandler extends IFilteredHandler { + /** * Comparator for entries that can be used in insertion logic */ @@ -37,8 +38,8 @@ public interface IRecipeHandler extends IFilteredHandler { * @param slotName specific slot name. * @param simulate simulate. * @return left contents for continue handling by other proxies. - *
- * null - nothing left. handling successful/finish. you should always return null as a handling-done mark. + *
+ * null - nothing left. handling successful/finish. you should always return null as a handling-done mark. */ List handleRecipeInner(IO io, GTRecipe recipe, List left, @Nullable String slotName, boolean simulate); @@ -62,7 +63,7 @@ default int getSize() { double getTotalContentAmount(); /** - * Whether the content of same capability can only be handled distinct. + * Whether the content of same capability can only be handled distinct. */ default boolean isDistinct() { return false; @@ -76,7 +77,7 @@ default boolean isProxy() { @SuppressWarnings("unchecked") default K copyContent(Object content) { - return getCapability().copyInner((K)content); + return getCapability().copyInner((K) content); } default List handleRecipe(IO io, GTRecipe recipe, List left, @Nullable String slotName, boolean simulate) { @@ -87,11 +88,7 @@ default List handleRecipe(IO io, GTRecipe recipe, List left, @Nullable Str return handleRecipeInner(io, recipe, contents, slotName, simulate); } - default void preWorking(IRecipeCapabilityHolder holder, IO io, GTRecipe recipe) { - } - - default void postWorking(IRecipeCapabilityHolder holder, IO io, GTRecipe recipe) { - } - + default void preWorking(IRecipeCapabilityHolder holder, IO io, GTRecipe recipe) {} + default void postWorking(IRecipeCapabilityHolder holder, IO io, GTRecipe recipe) {} } diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/ItemRecipeCapability.java b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/ItemRecipeCapability.java index 30838cf862..6f8faa6572 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/ItemRecipeCapability.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/ItemRecipeCapability.java @@ -21,6 +21,7 @@ import com.gregtechceu.gtceu.core.mixins.TagValueAccessor; import com.gregtechceu.gtceu.integration.GTRecipeWidget; import com.gregtechceu.gtceu.utils.*; + import com.lowdragmc.lowdraglib.gui.widget.SlotWidget; import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.jei.IngredientIO; @@ -28,12 +29,7 @@ import com.lowdragmc.lowdraglib.side.item.IItemTransfer; import com.lowdragmc.lowdraglib.utils.CycleItemStackHandler; import com.lowdragmc.lowdraglib.utils.TagOrCycleItemStackTransfer; -import com.mojang.datafixers.util.Either; -import com.mojang.datafixers.util.Pair; -import it.unimi.dsi.fastutil.objects.Object2IntMap; -import it.unimi.dsi.fastutil.objects.Object2IntOpenCustomHashMap; -import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; -import it.unimi.dsi.fastutil.objects.ObjectArrayList; + import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.network.chat.Component; import net.minecraft.tags.TagKey; @@ -43,6 +39,13 @@ import net.minecraftforge.common.crafting.IntersectionIngredient; import net.minecraftforge.common.crafting.PartialNBTIngredient; import net.minecraftforge.common.crafting.StrictNBTIngredient; + +import com.mojang.datafixers.util.Either; +import com.mojang.datafixers.util.Pair; +import it.unimi.dsi.fastutil.objects.Object2IntMap; +import it.unimi.dsi.fastutil.objects.Object2IntOpenCustomHashMap; +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; +import it.unimi.dsi.fastutil.objects.ObjectArrayList; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.UnknownNullability; @@ -71,7 +74,10 @@ public Ingredient copyInner(Ingredient content) { @Override public Ingredient copyWithModifier(Ingredient content, ContentModifier modifier) { - return content instanceof SizedIngredient sizedIngredient ? SizedIngredient.create(sizedIngredient.getInner(), modifier.apply(sizedIngredient.getAmount()).intValue()) : SizedIngredient.create(content, modifier.apply(1).intValue()); + return content instanceof SizedIngredient sizedIngredient ? + SizedIngredient.create(sizedIngredient.getInner(), + modifier.apply(sizedIngredient.getAmount()).intValue()) : + SizedIngredient.create(content, modifier.apply(1).intValue()); } @Override @@ -92,9 +98,9 @@ public List convertToMapIngredient(Object obj) { } else if (sized.getInner() instanceof IntersectionIngredient intersection) { ingredients.add(new MapIntersectionIngredient(intersection)); } else { - for (Ingredient.Value value : ((IngredientAccessor)sized.getInner()).getValues()) { + for (Ingredient.Value value : ((IngredientAccessor) sized.getInner()).getValues()) { if (value instanceof Ingredient.TagValue tagValue) { - ingredients.add(new MapItemTagIngredient(((TagValueAccessor)tagValue).getTag())); + ingredients.add(new MapItemTagIngredient(((TagValueAccessor) tagValue).getTag())); } else { Collection stacks = value.getItems(); for (ItemStack stack : stacks) { @@ -106,9 +112,9 @@ public List convertToMapIngredient(Object obj) { } else if (ingredient instanceof IntersectionIngredient intersection) { ingredients.add(new MapIntersectionIngredient(intersection)); } else { - for (Ingredient.Value value : ((IngredientAccessor)ingredient).getValues()) { + for (Ingredient.Value value : ((IngredientAccessor) ingredient).getValues()) { if (value instanceof Ingredient.TagValue tagValue) { - ingredients.add(new MapItemTagIngredient(((TagValueAccessor)tagValue).getTag())); + ingredients.add(new MapItemTagIngredient(((TagValueAccessor) tagValue).getTag())); } else { Collection stacks = value.getItems(); for (ItemStack stack : stacks) { @@ -125,12 +131,14 @@ public List convertToMapIngredient(Object obj) { ingredients.add(new MapItemStackNBTIngredient(stack, StrictNBTIngredient.of(stack))); } if (stack.getShareTag() != null) { - ingredients.add(new MapItemStackPartialNBTIngredient(stack, PartialNBTIngredient.of(stack.getItem(), stack.getShareTag()))); + ingredients.add(new MapItemStackPartialNBTIngredient(stack, + PartialNBTIngredient.of(stack.getItem(), stack.getShareTag()))); } TagPrefix prefix = ChemicalHelper.getPrefix(stack.getItem()); if (prefix != null && TagPrefix.ORES.containsKey(prefix)) { Material material = ChemicalHelper.getMaterial(stack.getItem()).material(); - ingredients.add(new MapIntersectionIngredient((IntersectionIngredient) IntersectionIngredient.of(Ingredient.of(prefix.getItemTags(material)[0]), Ingredient.of(prefix.getItemParentTags()[0])))); + ingredients.add(new MapIntersectionIngredient((IntersectionIngredient) IntersectionIngredient.of( + Ingredient.of(prefix.getItemTags(material)[0]), Ingredient.of(prefix.getItemParentTags()[0])))); } } return ingredients; @@ -158,11 +166,12 @@ public List compressIngredients(Collection ingredients) { if (isEqual) continue; if (ingredient instanceof IntCircuitIngredient) { list.add(0, ingredient); - } else if (ingredient instanceof SizedIngredient sized && sized.getInner() instanceof IntCircuitIngredient) { - list.add(0, ingredient); - } else { - list.add(ingredient); - } + } else if (ingredient instanceof SizedIngredient sized && + sized.getInner() instanceof IntCircuitIngredient) { + list.add(0, ingredient); + } else { + list.add(ingredient); + } } else if (item instanceof ItemStack stack) { boolean isEqual = false; for (Object obj : list) { @@ -196,20 +205,20 @@ public int limitParallel(GTRecipe recipe, IRecipeCapabilityHolder holder, int mu int maxMultiplier = multiplier; OverlayedItemHandler itemHandler = new OverlayedItemHandler(new ItemTransferList( - Objects.requireNonNullElseGet(holder.getCapabilitiesProxy().get(IO.OUT, ItemRecipeCapability.CAP), Collections::emptyList) - .stream() - .filter(IItemTransfer.class::isInstance) - .map(IItemTransfer.class::cast) - .toList() - )); - - Object2IntMap recipeOutputs = GTHashMaps.fromItemStackCollection(recipe.getOutputContents(ItemRecipeCapability.CAP) - .stream() - .map(ItemRecipeCapability.CAP::of) - .filter(ingredient -> !ingredient.isEmpty()) - .map(ingredient -> ingredient.getItems()[0]) - .toList() - ); + Objects.requireNonNullElseGet(holder.getCapabilitiesProxy().get(IO.OUT, ItemRecipeCapability.CAP), + Collections::emptyList) + .stream() + .filter(IItemTransfer.class::isInstance) + .map(IItemTransfer.class::cast) + .toList())); + + Object2IntMap recipeOutputs = GTHashMaps + .fromItemStackCollection(recipe.getOutputContents(ItemRecipeCapability.CAP) + .stream() + .map(ItemRecipeCapability.CAP::of) + .filter(ingredient -> !ingredient.isEmpty()) + .map(ingredient -> ingredient.getItems()[0]) + .toList()); while (minMultiplier != maxMultiplier) { itemHandler.reset(); @@ -242,12 +251,16 @@ public int limitParallel(GTRecipe recipe, IRecipeCapabilityHolder holder, int mu @Override public int getMaxParallelRatio(IRecipeCapabilityHolder holder, GTRecipe recipe, int parallelAmount) { // Find all the items in the combined Item Input inventories and create oversized ItemStacks - Object2IntMap ingredientStacks = Objects.requireNonNullElseGet(holder.getCapabilitiesProxy().get(IO.IN, ItemRecipeCapability.CAP), Collections::>emptyList) - .stream() - .filter(handler -> !handler.isProxy()) - .map(container -> container.getContents().stream().filter(ItemStack.class::isInstance).map(ItemStack.class::cast).toList()) - .flatMap(container -> GTHashMaps.fromItemStackCollection(container).object2IntEntrySet().stream()) - .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, Integer::sum, () -> new Object2IntOpenCustomHashMap<>(ItemStackHashStrategy.comparingAllButCount()))); + Object2IntMap ingredientStacks = Objects + .requireNonNullElseGet(holder.getCapabilitiesProxy().get(IO.IN, ItemRecipeCapability.CAP), + Collections::>emptyList) + .stream() + .filter(handler -> !handler.isProxy()) + .map(container -> container.getContents().stream().filter(ItemStack.class::isInstance) + .map(ItemStack.class::cast).toList()) + .flatMap(container -> GTHashMaps.fromItemStackCollection(container).object2IntEntrySet().stream()) + .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, Integer::sum, + () -> new Object2IntOpenCustomHashMap<>(ItemStackHashStrategy.comparingAllButCount()))); int minMultiplier = Integer.MAX_VALUE; // map the recipe ingredients to account for duplicated and notConsumable ingredients. @@ -256,7 +269,8 @@ public int getMaxParallelRatio(IRecipeCapabilityHolder holder, GTRecipe recipe, Object2IntOpenHashMap countableMap = new Object2IntOpenHashMap<>(); for (Content content : recipe.getInputContents(ItemRecipeCapability.CAP)) { Ingredient recipeIngredient = ItemRecipeCapability.CAP.of(content.content); - int ingredientCount = recipeIngredient instanceof SizedIngredient sizedIngredient ? sizedIngredient.getAmount() : 1; + int ingredientCount = recipeIngredient instanceof SizedIngredient sizedIngredient ? + sizedIngredient.getAmount() : 1; if (content.chance == 0.0f) { notConsumableMap.computeIfPresent(recipeIngredient, (k, v) -> v + ingredientCount); notConsumableMap.putIfAbsent(recipeIngredient, ingredientCount); @@ -328,9 +342,9 @@ public int getMaxParallelRatio(IRecipeCapabilityHolder holder, GTRecipe recipe, @Override public @NotNull List createXEIContainerContents(List contents, GTRecipe recipe, IO io) { var outputStacks = contents.stream().map(content -> content.content) - .map(this::of) - .map(ItemRecipeCapability::mapItem) - .collect(Collectors.toList()); + .map(this::of) + .map(ItemRecipeCapability::mapItem) + .collect(Collectors.toList()); List, Integer>>, List>> scannerPossibilities = null; if (io == IO.OUT && recipe.recipeType.isScanner()) { @@ -342,21 +356,24 @@ public int getMaxParallelRatio(IRecipeCapabilityHolder holder, GTRecipe recipe, if (researchData != null) break; } if (researchData != null) { - Collection possibleRecipes = researchData.getFirst().getDataStickEntry(researchData.getSecond()); + Collection possibleRecipes = researchData.getFirst() + .getDataStickEntry(researchData.getSecond()); if (possibleRecipes != null) { for (GTRecipe r : possibleRecipes) { - ItemStack researchItem = ItemRecipeCapability.CAP.of(r.getOutputContents(ItemRecipeCapability.CAP).get(0).content).getItems()[0]; + ItemStack researchItem = ItemRecipeCapability.CAP + .of(r.getOutputContents(ItemRecipeCapability.CAP).get(0).content).getItems()[0]; researchItem = researchItem.copy(); researchItem.setCount(1); boolean didMatch = false; for (Either, Integer>>, List> stacks : scannerPossibilities) { for (ItemStack stack : stacks.map( - tag -> tag - .stream() - .flatMap(key -> BuiltInRegistries.ITEM.getTag(key.getFirst()).stream()) - .flatMap(holders -> holders.stream().map(holder -> new ItemStack(holder.get()))) - .collect(Collectors.toList()), - Function.identity())) { + tag -> tag + .stream() + .flatMap(key -> BuiltInRegistries.ITEM.getTag(key.getFirst()).stream()) + .flatMap(holders -> holders.stream() + .map(holder -> new ItemStack(holder.get()))) + .collect(Collectors.toList()), + Function.identity())) { if (ItemStack.isSameItem(stack, researchItem)) { didMatch = true; break; @@ -380,8 +397,9 @@ public int getMaxParallelRatio(IRecipeCapabilityHolder holder, GTRecipe recipe, public Object createXEIContainer(List contents) { // cast is safe if you don't pass the wrong thing. - //noinspection unchecked - return new TagOrCycleItemStackTransfer((List, Integer>>, List>>) contents); + // noinspection unchecked + return new TagOrCycleItemStackTransfer( + (List, Integer>>, List>>) contents); } @NotNull @@ -420,12 +438,15 @@ public void applyWidgetInfo(@NotNull Widget widget, // If in a recipe viewer and a research slot can be added, add it. if (isXEI && recipeType.isHasResearchSlot() && index == items.getSlots()) { if (ConfigHolder.INSTANCE.machines.enableResearch) { - ResearchCondition condition = recipeHolder.conditions().stream().filter(ResearchCondition.class::isInstance).findAny().map(ResearchCondition.class::cast).orElse(null); + ResearchCondition condition = recipeHolder.conditions().stream() + .filter(ResearchCondition.class::isInstance).findAny() + .map(ResearchCondition.class::cast).orElse(null); if (condition != null) { List dataItems = new ArrayList<>(); for (ResearchData.ResearchEntry entry : condition.data) { ItemStack dataStick = entry.getDataItem().copy(); - ResearchManager.writeResearchToNBT(dataStick.getOrCreateTag(), entry.getResearchId(), recipeType); + ResearchManager.writeResearchToNBT(dataStick.getOrCreateTag(), entry.getResearchId(), + recipeType); dataItems.add(dataStick); } CycleItemStackHandler handler = new CycleItemStackHandler(List.of(dataItems)); @@ -441,7 +462,8 @@ public void applyWidgetInfo(@NotNull Widget widget, slot.setXEIChance(content.chance); slot.setOnAddedTooltips((w, tooltips) -> { GTRecipeWidget.setConsumedChance(content, tooltips); - if (index >= (io == IO.IN ? recipe.getInputContents(this) : recipe.getOutputContents(this)).size()) { + if (index >= + (io == IO.IN ? recipe.getInputContents(this) : recipe.getOutputContents(this)).size()) { tooltips.add(Component.translatable("gtceu.gui.content.per_tick")); } }); @@ -455,16 +477,18 @@ private static Either, Integer>>, List> mapIte if (ingredient instanceof SizedIngredient sizedIngredient) { final int amount = sizedIngredient.getAmount(); if (sizedIngredient.getInner() instanceof IntersectionIngredient intersection) { - List children = ((IntersectionIngredientAccessor)intersection).getChildren(); + List children = ((IntersectionIngredientAccessor) intersection).getChildren(); if (children.isEmpty()) { return Either.right(null); } var childEither = mapItem(children.get(0)); return Either.right(childEither.map(tags -> { List tagItems = tags.stream() - .map(pair -> Pair.of(BuiltInRegistries.ITEM.getTag(pair.getFirst()).stream(), pair.getSecond())) - .flatMap(pair -> pair.getFirst().flatMap(tag -> tag.stream().map(holder -> new ItemStack(holder.value(), pair.getSecond())))) - .collect(Collectors.toList()); + .map(pair -> Pair.of(BuiltInRegistries.ITEM.getTag(pair.getFirst()).stream(), + pair.getSecond())) + .flatMap(pair -> pair.getFirst().flatMap( + tag -> tag.stream().map(holder -> new ItemStack(holder.value(), pair.getSecond())))) + .collect(Collectors.toList()); ListIterator iterator = tagItems.listIterator(); while (iterator.hasNext()) { var item = iterator.next(); @@ -492,21 +516,24 @@ private static Either, Integer>>, List> mapIte } return items; })); - } else if (((IngredientAccessor)sizedIngredient.getInner()).getValues().length > 0 && ((IngredientAccessor)sizedIngredient.getInner()).getValues()[0] instanceof Ingredient.TagValue tagValue) { - return Either.left(List.of(Pair.of(((TagValueAccessor)tagValue).getTag(), amount))); - } + } else if (((IngredientAccessor) sizedIngredient.getInner()).getValues().length > 0 && + ((IngredientAccessor) sizedIngredient.getInner()) + .getValues()[0] instanceof Ingredient.TagValue tagValue) { + return Either.left(List.of(Pair.of(((TagValueAccessor) tagValue).getTag(), amount))); + } } else if (ingredient instanceof IntersectionIngredient intersection) { // Map intersection ingredients to the items inside, as recipe viewers don't support them. - List children = ((IntersectionIngredientAccessor)intersection).getChildren(); + List children = ((IntersectionIngredientAccessor) intersection).getChildren(); if (children.isEmpty()) { return Either.right(null); } var childEither = mapItem(children.get(0)); return Either.right(childEither.map(tags -> { List tagItems = tags.stream() - .map(pair -> Pair.of(BuiltInRegistries.ITEM.getTag(pair.getFirst()).stream(), pair.getSecond())) - .flatMap(pair -> pair.getFirst().flatMap(tag -> tag.stream().map(holder -> new ItemStack(holder.value(), pair.getSecond())))) - .collect(Collectors.toList()); + .map(pair -> Pair.of(BuiltInRegistries.ITEM.getTag(pair.getFirst()).stream(), pair.getSecond())) + .flatMap(pair -> pair.getFirst().flatMap( + tag -> tag.stream().map(holder -> new ItemStack(holder.value(), pair.getSecond())))) + .collect(Collectors.toList()); ListIterator iterator = tagItems.listIterator(); while (iterator.hasNext()) { var item = iterator.next(); @@ -532,9 +559,10 @@ private static Either, Integer>>, List> mapIte } return items; })); - } else if (((IngredientAccessor)ingredient).getValues().length > 0 && ((IngredientAccessor)ingredient).getValues()[0] instanceof Ingredient.TagValue tagValue) { - return Either.left(List.of(Pair.of(((TagValueAccessor)tagValue).getTag(), 1))); - } + } else if (((IngredientAccessor) ingredient).getValues().length > 0 && + ((IngredientAccessor) ingredient).getValues()[0] instanceof Ingredient.TagValue tagValue) { + return Either.left(List.of(Pair.of(((TagValueAccessor) tagValue).getTag(), 1))); + } return Either.right(Arrays.stream(ingredient.getItems()).toList()); } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/RecipeCapability.java b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/RecipeCapability.java index e697a0820e..3d886b1449 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/RecipeCapability.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/RecipeCapability.java @@ -8,11 +8,14 @@ import com.gregtechceu.gtceu.api.recipe.lookup.AbstractMapIngredient; import com.gregtechceu.gtceu.api.recipe.modifier.ParallelLogic; import com.gregtechceu.gtceu.api.recipe.ui.GTRecipeTypeUI; + import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; -import io.netty.buffer.Unpooled; + import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; + +import io.netty.buffer.Unpooled; import org.apache.commons.lang3.mutable.MutableInt; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -23,6 +26,7 @@ * Used to detect whether a machine has a certain capability. */ public abstract class RecipeCapability { + public static final Comparator> COMPARATOR = Comparator.comparingInt(o -> o.sortIndex); public final String name; @@ -31,7 +35,8 @@ public abstract class RecipeCapability { public final int sortIndex; public final IContentSerializer serializer; - protected RecipeCapability(String name, int color, boolean doRenderSlot, int sortIndex, IContentSerializer serializer) { + protected RecipeCapability(String name, int color, boolean doRenderSlot, int sortIndex, + IContentSerializer serializer) { this.name = name; this.color = color; this.doRenderSlot = doRenderSlot; @@ -51,7 +56,7 @@ public T copyInner(T content) { /** * deep copy and modify the size attribute for those Content that have the size attribute. */ - public T copyWithModifier(T content, ContentModifier modifier){ + public T copyWithModifier(T content, ContentModifier modifier) { return copyInner(content); } @@ -90,6 +95,7 @@ public boolean isRecipeSearchFilter() { /** * Convert the passed object to a list of recipe lookup filters. + * * @param ingredient ingredient. e.g. for ITEM, this can be Ingredient or ItemStack * @return a list of recipe lookup filters. */ @@ -124,11 +130,13 @@ public int limitParallel(GTRecipe recipe, IRecipeCapabilityHolder holder, int mu } /** - * Finds the maximum number of GTRecipes that can be performed at the same time based on the contents of input inventories + * Finds the maximum number of GTRecipes that can be performed at the same time based on the contents of input + * inventories * - * @param holder The {@link IRecipeCapabilityHolder} that contains all the inputs and outputs of the machine. - * @param recipe The {@link GTRecipe} for which to find the maximum that can be run simultaneously - * @param parallelAmount The limit on the amount of recipes that can be performed at one time + * @param holder The {@link IRecipeCapabilityHolder} that contains all the inputs and outputs of the + * machine. + * @param recipe The {@link GTRecipe} for which to find the maximum that can be run simultaneously + * @param parallelAmount The limit on the amount of recipes that can be performed at one time * @return The Maximum number of GTRecipes that can be performed at a single time based on the available Items */ // returns Integer.MAX_VALUE by default, to skip processing. @@ -140,9 +148,8 @@ public boolean doAddGuiSlots() { return isRecipeSearchFilter(); } - public void addXEIInfo(WidgetGroup group, int xOffset, List contents, boolean perTick, boolean isInput, MutableInt yOffset) { - - } + public void addXEIInfo(WidgetGroup group, int xOffset, GTRecipe recipe, List contents, boolean perTick, + boolean isInput, MutableInt yOffset) {} @NotNull public List createXEIContainerContents(List contents, GTRecipe recipe, IO io) { @@ -172,11 +179,9 @@ public void applyWidgetInfo(@NotNull Widget widget, @NotNull GTRecipeType recipeType, @Nullable("null when content == null") GTRecipe recipe, @Nullable Content content, - @Nullable Object storage) { - - } + @Nullable Object storage) {} - //TODO + // TODO public double calculateAmount(List left) { return 1; } diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/StressRecipeCapability.java b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/StressRecipeCapability.java index 77d488fa54..5159874353 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/StressRecipeCapability.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/StressRecipeCapability.java @@ -2,7 +2,6 @@ import com.gregtechceu.gtceu.api.recipe.content.ContentModifier; import com.gregtechceu.gtceu.api.recipe.content.SerializerFloat; -import com.gregtechceu.gtceu.api.recipe.lookup.AbstractMapIngredient; import java.util.Collection; import java.util.List; diff --git a/src/main/java/com/gregtechceu/gtceu/api/cover/CoverBehavior.java b/src/main/java/com/gregtechceu/gtceu/api/cover/CoverBehavior.java index 0366132da3..4e8f056cdd 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/cover/CoverBehavior.java +++ b/src/main/java/com/gregtechceu/gtceu/api/cover/CoverBehavior.java @@ -5,16 +5,17 @@ import com.gregtechceu.gtceu.api.gui.factory.CoverUIFactory; import com.gregtechceu.gtceu.api.item.tool.GTToolType; import com.gregtechceu.gtceu.api.item.tool.IToolGridHighLight; -import com.lowdragmc.lowdraglib.syncdata.IEnhancedManaged; import com.gregtechceu.gtceu.client.renderer.cover.ICoverRenderer; + import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; import com.lowdragmc.lowdraglib.side.fluid.IFluidTransfer; import com.lowdragmc.lowdraglib.side.item.IItemTransfer; +import com.lowdragmc.lowdraglib.syncdata.IEnhancedManaged; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.FieldManagedStorage; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import lombok.Getter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -27,12 +28,15 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.BlockHitResult; +import lombok.Getter; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; + import java.util.ArrayList; import java.util.List; import java.util.Set; +import javax.annotation.ParametersAreNonnullByDefault; + /** * Represents cover instance attached on the specific side of meta tile entity * Cover filters out interaction and logic of meta tile entity @@ -48,9 +52,12 @@ public abstract class CoverBehavior implements IEnhancedManaged, IToolGridHighLi public final CoverDefinition coverDefinition; public final ICoverable coverHolder; public final Direction attachedSide; - @Getter @Persisted @DescSynced + @Getter + @Persisted + @DescSynced protected ItemStack attachItem = ItemStack.EMPTY; - @Getter @Persisted + @Getter + @Persisted protected int redstoneSignalOutput = 0; public CoverBehavior(CoverDefinition definition, ICoverable coverHolder, Direction attachedSide) { @@ -60,7 +67,7 @@ public CoverBehavior(CoverDefinition definition, ICoverable coverHolder, Directi } ////////////////////////////////////// - //***** Initialization ******// + // ***** Initialization ******// ////////////////////////////////////// @Override public void scheduleRenderUpdate() { @@ -101,16 +108,12 @@ public void onAttached(ItemStack itemStack, ServerPlayer player) { attachItem.setCount(1); } - public void onLoad() { - - } + public void onLoad() {} - public void onUnload() { - - } + public void onUnload() {} ////////////////////////////////////// - //********** Misc ***********// + // ********** Misc ***********// ////////////////////////////////////// public ItemStack getPickItem() { return attachItem; @@ -127,11 +130,9 @@ public List getAdditionalDrops() { * Called prior to cover removing on the server side * Will also be called during machine dismantling, as machine loses installed covers after that */ - public void onRemoved() { - } + public void onRemoved() {} - public void onNeighborChanged(Block block, BlockPos fromPos, boolean isMoving) { - } + public void onNeighborChanged(Block block, BlockPos fromPos, boolean isMoving) {} public void setRedstoneSignalOutput(int redstoneSignalOutput) { this.redstoneSignalOutput = redstoneSignalOutput; @@ -144,7 +145,7 @@ public boolean canConnectRedstone() { } ////////////////////////////////////// - //******* Interaction *******// + // ******* Interaction *******// ////////////////////////////////////// public InteractionResult onScrewdriverClick(Player playerIn, InteractionHand hand, BlockHitResult hitResult) { if (this instanceof IUICover) { @@ -161,7 +162,7 @@ public InteractionResult onSoftMalletClick(Player playerIn, InteractionHand hand } ////////////////////////////////////// - //******* Rendering ********// + // ******* Rendering ********// ////////////////////////////////////// /** * @return If the pipe this is placed on and a pipe on the other side should be able to connect @@ -180,7 +181,8 @@ public ICoverRenderer getCoverRenderer() { @Override public boolean shouldRenderGrid(Player player, ItemStack held, Set toolTypes) { - return toolTypes.contains(GTToolType.CROWBAR) || (toolTypes.contains(GTToolType.SCREWDRIVER ) && this instanceof IUICover); + return toolTypes.contains(GTToolType.CROWBAR) || + (toolTypes.contains(GTToolType.SCREWDRIVER) && this instanceof IUICover); } @Override @@ -203,7 +205,7 @@ public BlockState getAppearance(BlockState sourceState, BlockPos sourcePos) { } ////////////////////////////////////// - //******* Capabilities *******// + // ******* Capabilities *******// ////////////////////////////////////// // TODO possibly refactor this in the future, using some sort of cross-platform capability-like system diff --git a/src/main/java/com/gregtechceu/gtceu/api/cover/CoverDefinition.java b/src/main/java/com/gregtechceu/gtceu/api/cover/CoverDefinition.java index 1e490870b9..30fb5b9177 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/cover/CoverDefinition.java +++ b/src/main/java/com/gregtechceu/gtceu/api/cover/CoverDefinition.java @@ -1,19 +1,22 @@ package com.gregtechceu.gtceu.api.cover; - import com.gregtechceu.gtceu.api.capability.ICoverable; import com.gregtechceu.gtceu.client.renderer.cover.ICoverRenderer; -import lombok.Getter; + import net.minecraft.core.Direction; import net.minecraft.resources.ResourceLocation; +import lombok.Getter; + public final class CoverDefinition { public interface CoverBehaviourProvider { + CoverBehavior create(CoverDefinition definition, ICoverable coverable, Direction side); } public interface TieredCoverBehaviourProvider { + CoverBehavior create(CoverDefinition definition, ICoverable coverable, Direction side, int tier); } @@ -32,5 +35,4 @@ public CoverDefinition(ResourceLocation id, CoverBehaviourProvider behaviorCreat public CoverBehavior createCoverBehavior(ICoverable metaTileEntity, Direction side) { return behaviorCreator.create(this, metaTileEntity, side); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/cover/IUICover.java b/src/main/java/com/gregtechceu/gtceu/api/cover/IUICover.java index 9a7cf3f321..5c4e316863 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/cover/IUICover.java +++ b/src/main/java/com/gregtechceu/gtceu/api/cover/IUICover.java @@ -2,10 +2,12 @@ import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.api.gui.UITemplate; + import com.lowdragmc.lowdraglib.gui.modular.IUIHolder; import com.lowdragmc.lowdraglib.gui.modular.ModularUI; import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.utils.Position; + import net.minecraft.world.entity.player.Player; /** @@ -35,14 +37,15 @@ default void markAsDirty() { } @Override - default ModularUI createUI(Player entityPlayer){ + default ModularUI createUI(Player entityPlayer) { var widget = createUIWidget(); var size = widget.getSize(); widget.setSelfPosition(new Position((176 - size.width) / 2, 0)); return new ModularUI(176, size.height + 82, this, entityPlayer) .background(GuiTextures.BACKGROUND) .widget(widget) - .widget(UITemplate.bindPlayerInventory(entityPlayer.getInventory(), GuiTextures.SLOT, 7, size.height, true)); + .widget(UITemplate.bindPlayerInventory(entityPlayer.getInventory(), GuiTextures.SLOT, 7, size.height, + true)); } Widget createUIWidget(); diff --git a/src/main/java/com/gregtechceu/gtceu/api/cover/filter/Filter.java b/src/main/java/com/gregtechceu/gtceu/api/cover/filter/Filter.java index c3e1adef1d..a97ab05f7c 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/cover/filter/Filter.java +++ b/src/main/java/com/gregtechceu/gtceu/api/cover/filter/Filter.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.api.cover.filter; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; + import net.minecraft.nbt.CompoundTag; import java.util.function.Consumer; diff --git a/src/main/java/com/gregtechceu/gtceu/api/cover/filter/FilterHandler.java b/src/main/java/com/gregtechceu/gtceu/api/cover/filter/FilterHandler.java index 26de075228..970a1e905f 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/cover/filter/FilterHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/api/cover/filter/FilterHandler.java @@ -1,33 +1,39 @@ package com.gregtechceu.gtceu.api.cover.filter; import com.gregtechceu.gtceu.api.gui.GuiTextures; -import com.lowdragmc.lowdraglib.syncdata.IEnhancedManaged; + import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup; import com.lowdragmc.lowdraglib.gui.widget.SlotWidget; import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.misc.ItemStackTransfer; +import com.lowdragmc.lowdraglib.syncdata.IEnhancedManaged; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.FieldManagedStorage; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import lombok.Getter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.world.item.ItemStack; + +import lombok.Getter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.function.Consumer; +import javax.annotation.ParametersAreNonnullByDefault; + @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public abstract class FilterHandler> implements IEnhancedManaged { private final IEnhancedManaged container; - @Persisted @DescSynced @Getter + @Persisted + @DescSynced + @Getter private @NotNull ItemStack filterItem = ItemStack.EMPTY; private @Nullable F filter; @@ -43,12 +49,13 @@ public FilterHandler(IEnhancedManaged container) { } protected abstract F loadFilter(ItemStack filterItem); + protected abstract F getEmptyFilter(); - protected abstract boolean canInsertFilterItem(ItemStack itemStack); + protected abstract boolean canInsertFilterItem(ItemStack itemStack); ////////////////////////////////// - //***** PUBLIC API ******// + // ***** PUBLIC API ******// ////////////////////////////////// public Widget createFilterSlotUI(int xPos, int yPos) { @@ -102,7 +109,7 @@ public FilterHandler onFilterUpdated(Consumer onFilterUpdated) { } /////////////////////////////////////// - //***** FILTER HANDLING ******// + // ***** FILTER HANDLING ******// /////////////////////////////////////// private ItemStackTransfer getFilterSlot() { @@ -155,9 +162,8 @@ private void updateFilterGroupUI() { } } - ////////////////////////////////////// - //***** LDLib SyncData ******// + // ***** LDLib SyncData ******// ////////////////////////////////////// public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(FilterHandler.class); diff --git a/src/main/java/com/gregtechceu/gtceu/api/cover/filter/FilterHandlers.java b/src/main/java/com/gregtechceu/gtceu/api/cover/filter/FilterHandlers.java index 5a800ac289..26bb521c6f 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/cover/filter/FilterHandlers.java +++ b/src/main/java/com/gregtechceu/gtceu/api/cover/filter/FilterHandlers.java @@ -1,12 +1,15 @@ package com.gregtechceu.gtceu.api.cover.filter; -import com.lowdragmc.lowdraglib.syncdata.IEnhancedManaged; import com.lowdragmc.lowdraglib.side.fluid.FluidStack; +import com.lowdragmc.lowdraglib.syncdata.IEnhancedManaged; + import net.minecraft.world.item.ItemStack; public interface FilterHandlers { + static FilterHandler item(IEnhancedManaged container) { return new FilterHandler<>(container) { + @Override protected ItemFilter loadFilter(ItemStack filterItem) { return ItemFilter.loadFilter(filterItem); @@ -26,6 +29,7 @@ protected boolean canInsertFilterItem(ItemStack itemStack) { static FilterHandler fluid(IEnhancedManaged container) { return new FilterHandler<>(container) { + @Override protected FluidFilter loadFilter(ItemStack filterItem) { return FluidFilter.loadFilter(filterItem); diff --git a/src/main/java/com/gregtechceu/gtceu/api/cover/filter/FluidFilter.java b/src/main/java/com/gregtechceu/gtceu/api/cover/filter/FluidFilter.java index 205982224b..852533a1ad 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/cover/filter/FluidFilter.java +++ b/src/main/java/com/gregtechceu/gtceu/api/cover/filter/FluidFilter.java @@ -2,10 +2,11 @@ import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.side.fluid.FluidStack; + import net.minecraft.nbt.CompoundTag; -import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.ItemLike; + import org.apache.commons.lang3.NotImplementedException; import java.util.HashMap; @@ -46,6 +47,7 @@ default boolean supportsAmounts() { * ONLY TO BE USED FOR FLUID MATCHING! All other functionality will throw an exception. */ FluidFilter EMPTY = new FluidFilter() { + @Override public boolean test(FluidStack fluidStack) { return true; diff --git a/src/main/java/com/gregtechceu/gtceu/api/cover/filter/ItemFilter.java b/src/main/java/com/gregtechceu/gtceu/api/cover/filter/ItemFilter.java index 2c82713ade..8c59307724 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/cover/filter/ItemFilter.java +++ b/src/main/java/com/gregtechceu/gtceu/api/cover/filter/ItemFilter.java @@ -1,10 +1,11 @@ package com.gregtechceu.gtceu.api.cover.filter; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; + import net.minecraft.nbt.CompoundTag; -import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.ItemLike; + import org.apache.commons.lang3.NotImplementedException; import java.util.HashMap; @@ -45,23 +46,29 @@ default boolean supportsAmounts() { * ONLY TO BE USED FOR ITEM MATCHING! All other functionality will throw an exception. */ ItemFilter EMPTY = new ItemFilter() { - @Override public int testItemCount(ItemStack itemStack) { + + @Override + public int testItemCount(ItemStack itemStack) { return Integer.MAX_VALUE; } - @Override public boolean test(ItemStack itemStack) { + @Override + public boolean test(ItemStack itemStack) { return true; } - @Override public WidgetGroup openConfigurator(int x, int y) { + @Override + public WidgetGroup openConfigurator(int x, int y) { throw new NotImplementedException("Not available for empty item filter"); } - @Override public CompoundTag saveFilter() { + @Override + public CompoundTag saveFilter() { throw new NotImplementedException("Not available for empty item filter"); } - @Override public void setOnUpdated(Consumer onUpdated) { + @Override + public void setOnUpdated(Consumer onUpdated) { throw new NotImplementedException("Not available for empty item filter"); } }; diff --git a/src/main/java/com/gregtechceu/gtceu/api/cover/filter/SimpleFluidFilter.java b/src/main/java/com/gregtechceu/gtceu/api/cover/filter/SimpleFluidFilter.java index e8b807ec6a..80cc6ce02a 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/cover/filter/SimpleFluidFilter.java +++ b/src/main/java/com/gregtechceu/gtceu/api/cover/filter/SimpleFluidFilter.java @@ -3,20 +3,24 @@ import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.api.gui.widget.ScrollablePhantomFluidWidget; import com.gregtechceu.gtceu.api.gui.widget.ToggleButtonWidget; + import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.misc.FluidStorage; import com.lowdragmc.lowdraglib.side.fluid.FluidStack; -import lombok.Getter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.nbt.Tag; import net.minecraft.world.item.ItemStack; -import javax.annotation.ParametersAreNonnullByDefault; +import lombok.Getter; + import java.util.Arrays; import java.util.function.Consumer; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author KilaBash * @date 2023/3/13 @@ -25,6 +29,7 @@ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class SimpleFluidFilter implements FluidFilter { + @Getter protected boolean isBlackList; @Getter @@ -80,7 +85,6 @@ public CompoundTag saveFilter() { return tag; } - public void setBlackList(boolean blackList) { isBlackList = blackList; onUpdated.accept(this); @@ -101,7 +105,10 @@ public WidgetGroup openConfigurator(int x, int y) { fluidStorageSlots[index] = new FluidStorage(maxStackSize); fluidStorageSlots[index].setFluid(matches[index]); - var tank = new ScrollablePhantomFluidWidget(fluidStorageSlots[index], 0, i * 18, j * 18, 18, 18, () -> fluidStorageSlots[index].getFluid(), (fluid) -> fluidStorageSlots[index].setFluid(fluid)) { + var tank = new ScrollablePhantomFluidWidget(fluidStorageSlots[index], 0, i * 18, j * 18, 18, 18, + () -> fluidStorageSlots[index].getFluid(), + (fluid) -> fluidStorageSlots[index].setFluid(fluid)) { + @Override public void updateScreen() { super.updateScreen(); diff --git a/src/main/java/com/gregtechceu/gtceu/api/cover/filter/SimpleItemFilter.java b/src/main/java/com/gregtechceu/gtceu/api/cover/filter/SimpleItemFilter.java index 4a2e187edc..16be254469 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/cover/filter/SimpleItemFilter.java +++ b/src/main/java/com/gregtechceu/gtceu/api/cover/filter/SimpleItemFilter.java @@ -2,21 +2,25 @@ import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.api.gui.widget.ToggleButtonWidget; + import com.lowdragmc.lowdraglib.gui.widget.PhantomSlotWidget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.misc.ItemStackTransfer; import com.lowdragmc.lowdraglib.side.item.ItemTransferHelper; -import lombok.Getter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.nbt.Tag; import net.minecraft.world.item.ItemStack; -import javax.annotation.ParametersAreNonnullByDefault; +import lombok.Getter; + import java.util.Arrays; import java.util.function.Consumer; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author KilaBash * @date 2023/3/13 @@ -25,6 +29,7 @@ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class SimpleItemFilter implements ItemFilter { + @Getter protected boolean isBlackList; @Getter @@ -38,7 +43,6 @@ public class SimpleItemFilter implements ItemFilter { @Getter protected int maxStackSize; - protected SimpleItemFilter() { Arrays.fill(matches, ItemStack.EMPTY); maxStackSize = 1; @@ -80,7 +84,6 @@ public CompoundTag saveFilter() { return tag; } - public void setBlackList(boolean blackList) { isBlackList = blackList; onUpdated.accept(this); @@ -100,6 +103,7 @@ public WidgetGroup openConfigurator(int x, int y) { var handler = new ItemStackTransfer(matches[index]); var slot = new PhantomSlotWidget(handler, 0, i * 18, j * 18) { + @Override public void updateScreen() { super.updateScreen(); diff --git a/src/main/java/com/gregtechceu/gtceu/api/cover/filter/TagFilter.java b/src/main/java/com/gregtechceu/gtceu/api/cover/filter/TagFilter.java index 68379f1b70..5fa5e1537f 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/cover/filter/TagFilter.java +++ b/src/main/java/com/gregtechceu/gtceu/api/cover/filter/TagFilter.java @@ -3,13 +3,16 @@ import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.data.lang.LangHandler; import com.gregtechceu.gtceu.utils.OreDictExprFilter; + import com.lowdragmc.lowdraglib.gui.widget.ImageWidget; import com.lowdragmc.lowdraglib.gui.widget.TextFieldWidget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; -import lombok.Getter; + import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.MutableComponent; +import lombok.Getter; + import java.util.ArrayList; import java.util.List; import java.util.function.Consumer; @@ -21,6 +24,7 @@ * @implNote TagFilter */ public abstract class TagFilter> implements Filter { + private static final Pattern DOUBLE_WILDCARD = Pattern.compile("\\*{2,}"); private static final Pattern DOUBLE_AND = Pattern.compile("&{2,}"); private static final Pattern DOUBLE_OR = Pattern.compile("\\|{2,}"); @@ -36,8 +40,7 @@ public abstract class TagFilter> implements Filter matchRules = new ArrayList<>(); - protected TagFilter() { - } + protected TagFilter() {} public CompoundTag saveFilter() { var tag = new CompoundTag(); @@ -55,7 +58,8 @@ public void setOreDict(String oreDict) { public WidgetGroup openConfigurator(int x, int y) { WidgetGroup group = new WidgetGroup(x, y, 18 * 3 + 25, 18 * 3); // 80 55 group.addWidget(new ImageWidget(0, 0, 20, 20, GuiTextures.INFO_ICON) - .setHoverTooltips(LangHandler.getMultiLang("cover.ore_dictionary_filter.info").toArray(new MutableComponent[0]))); + .setHoverTooltips( + LangHandler.getMultiLang("cover.ore_dictionary_filter.info").toArray(new MutableComponent[0]))); group.addWidget(new TextFieldWidget(0, 29, 18 * 3 + 25, 12, () -> oreDictFilterExpression, this::setOreDict) .setMaxStringLength(64) .setValidator(input -> { diff --git a/src/main/java/com/gregtechceu/gtceu/api/cover/filter/TagFluidFilter.java b/src/main/java/com/gregtechceu/gtceu/api/cover/filter/TagFluidFilter.java index 897b25f914..5273335d99 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/cover/filter/TagFluidFilter.java +++ b/src/main/java/com/gregtechceu/gtceu/api/cover/filter/TagFluidFilter.java @@ -1,13 +1,16 @@ package com.gregtechceu.gtceu.api.cover.filter; import com.gregtechceu.gtceu.utils.OreDictExprFilter; + import com.lowdragmc.lowdraglib.side.fluid.FluidStack; -import it.unimi.dsi.fastutil.objects.Object2BooleanMap; -import it.unimi.dsi.fastutil.objects.Object2BooleanOpenHashMap; + import net.minecraft.nbt.CompoundTag; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.material.Fluid; +import it.unimi.dsi.fastutil.objects.Object2BooleanMap; +import it.unimi.dsi.fastutil.objects.Object2BooleanOpenHashMap; + import java.util.function.Consumer; /** @@ -16,10 +19,10 @@ * @implNote TagFluidFilter */ public class TagFluidFilter extends TagFilter implements FluidFilter { + private final Object2BooleanMap cache = new Object2BooleanOpenHashMap<>(); - protected TagFluidFilter() { - } + protected TagFluidFilter() {} public static TagFluidFilter loadFilter(ItemStack itemStack) { return loadFilter(itemStack.getOrCreateTag(), filter -> itemStack.setTag(filter.saveFilter())); diff --git a/src/main/java/com/gregtechceu/gtceu/api/cover/filter/TagItemFilter.java b/src/main/java/com/gregtechceu/gtceu/api/cover/filter/TagItemFilter.java index 3b92d604e0..aa7f34c080 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/cover/filter/TagItemFilter.java +++ b/src/main/java/com/gregtechceu/gtceu/api/cover/filter/TagItemFilter.java @@ -1,12 +1,14 @@ package com.gregtechceu.gtceu.api.cover.filter; import com.gregtechceu.gtceu.utils.OreDictExprFilter; -import it.unimi.dsi.fastutil.objects.Object2BooleanMap; -import it.unimi.dsi.fastutil.objects.Object2BooleanOpenHashMap; + import net.minecraft.nbt.CompoundTag; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; +import it.unimi.dsi.fastutil.objects.Object2BooleanMap; +import it.unimi.dsi.fastutil.objects.Object2BooleanOpenHashMap; + import java.util.function.Consumer; /** @@ -18,8 +20,7 @@ public class TagItemFilter extends TagFilter implements I private final Object2BooleanMap cache = new Object2BooleanOpenHashMap<>(); - protected TagItemFilter() { - } + protected TagItemFilter() {} public static TagItemFilter loadFilter(ItemStack itemStack) { return loadFilter(itemStack.getOrCreateTag(), filter -> itemStack.setTag(filter.saveFilter())); diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/RotationState.java b/src/main/java/com/gregtechceu/gtceu/api/data/RotationState.java index 090456f91b..95a2ee27d3 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/RotationState.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/RotationState.java @@ -7,22 +7,25 @@ import java.util.function.Predicate; public enum RotationState implements Predicate { + ALL(dir -> true, Direction.NORTH, BlockStateProperties.FACING), NONE(dir -> false, Direction.NORTH, DirectionProperty.create("facing", Direction.NORTH)), - Y_AXIS(dir -> dir.getAxis() == Direction.Axis.Y, Direction.UP, DirectionProperty.create("facing", Direction.Plane.VERTICAL)), + Y_AXIS(dir -> dir.getAxis() == Direction.Axis.Y, Direction.UP, + DirectionProperty.create("facing", Direction.Plane.VERTICAL)), NON_Y_AXIS(dir -> dir.getAxis() != Direction.Axis.Y, Direction.NORTH, BlockStateProperties.HORIZONTAL_FACING); final Predicate predicate; public final Direction defaultDirection; public final DirectionProperty property; - RotationState(Predicate predicate, Direction defaultDirection, DirectionProperty property){ + RotationState(Predicate predicate, Direction defaultDirection, DirectionProperty property) { this.predicate = predicate; this.defaultDirection = defaultDirection; this.property = property; } static final ThreadLocal STATE = new ThreadLocal<>(); + public static RotationState get() { return STATE.get(); } @@ -39,4 +42,4 @@ public static void clear() { public boolean test(Direction dir) { return predicate.test(dir); } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/advancement/IAdvancementCriterion.java b/src/main/java/com/gregtechceu/gtceu/api/data/advancement/IAdvancementCriterion.java deleted file mode 100644 index 2f6736fae2..0000000000 --- a/src/main/java/com/gregtechceu/gtceu/api/data/advancement/IAdvancementCriterion.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.gregtechceu.gtceu.api.data.advancement; - -import net.minecraft.advancements.CriterionTriggerInstance; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.server.level.ServerPlayer; - -public interface IAdvancementCriterion extends CriterionTriggerInstance { - - boolean test(ServerPlayer player); - - void setId(ResourceLocation id); -} diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/advancement/IAdvancementManager.java b/src/main/java/com/gregtechceu/gtceu/api/data/advancement/IAdvancementManager.java deleted file mode 100644 index a0ba0193f5..0000000000 --- a/src/main/java/com/gregtechceu/gtceu/api/data/advancement/IAdvancementManager.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.gregtechceu.gtceu.api.data.advancement; - -public interface IAdvancementManager { - IAdvancementTrigger registerTrigger(String id, T criterion); -} diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/advancement/IAdvancementTrigger.java b/src/main/java/com/gregtechceu/gtceu/api/data/advancement/IAdvancementTrigger.java deleted file mode 100644 index 3fc83e445b..0000000000 --- a/src/main/java/com/gregtechceu/gtceu/api/data/advancement/IAdvancementTrigger.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.gregtechceu.gtceu.api.data.advancement; - -import net.minecraft.advancements.CriterionTrigger; -import net.minecraft.server.level.ServerPlayer; - -public interface IAdvancementTrigger extends CriterionTrigger { - void trigger(ServerPlayer player); -} diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/ChemicalHelper.java b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/ChemicalHelper.java index ef1bfa6e1b..b9cca23106 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/ChemicalHelper.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/ChemicalHelper.java @@ -14,13 +14,10 @@ import com.gregtechceu.gtceu.data.recipe.misc.WoodMachineRecipes; import com.gregtechceu.gtceu.data.tags.TagsHandler; import com.gregtechceu.gtceu.utils.SupplierMemoizer; -import com.lowdragmc.lowdraglib.Platform; -import com.tterrag.registrate.util.entry.BlockEntry; -import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap; + import net.minecraft.core.Holder; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.Registries; -import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.TagKey; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; @@ -28,11 +25,14 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.Fluid; -import net.minecraft.world.level.material.Fluids; import net.minecraftforge.registries.RegistryObject; +import com.mojang.datafixers.util.Pair; +import com.tterrag.registrate.util.entry.BlockEntry; +import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; + import java.util.*; import java.util.concurrent.ConcurrentHashMap; import java.util.function.Supplier; @@ -50,7 +50,8 @@ public class ChemicalHelper { /** Used for custom material data for items that do not fall into the normal "prefix, material" pair */ public static final Map ITEM_MATERIAL_INFO = new ConcurrentHashMap<>(); /** Mapping of an item to a "prefix, material" pair */ - public static final Set, UnificationEntry>> ITEM_UNIFICATION_ENTRY = ConcurrentHashMap.newKeySet(); + public static final Set, UnificationEntry>> ITEM_UNIFICATION_ENTRY = ConcurrentHashMap + .newKeySet(); public static final Map ITEM_UNIFICATION_ENTRY_COLLECTED = new ConcurrentHashMap<>(); /** Mapping of a tag to a "prefix, material" pair */ public static final Map, UnificationEntry> TAG_UNIFICATION_ENTRY = new Object2ObjectLinkedOpenHashMap<>(); @@ -71,7 +72,8 @@ public static ItemMaterialInfo getMaterialInfo(ItemLike item) { } @SafeVarargs - public static void registerUnificationItems(UnificationEntry unificationEntry, Supplier... items) { + public static void registerUnificationItems(UnificationEntry unificationEntry, + Supplier... items) { UNIFICATION_ENTRY_ITEM.computeIfAbsent(unificationEntry, entry -> new ArrayList<>()) .addAll(Arrays.asList(items)); for (Supplier item : items) { @@ -85,14 +87,15 @@ public static void registerUnificationItems(UnificationEntry unificationEntry, S } else if (item instanceof RegistryObject registryObject) { if (registryObject.getKey().isFor(Registries.BLOCK)) { UNIFICATION_ENTRY_BLOCK.computeIfAbsent(unificationEntry, entry -> new ArrayList<>()) - .add((RegistryObject) registryObject); + .add((RegistryObject) registryObject); } } else if (item instanceof SupplierMemoizer.MemoizedBlockSupplier supplier) { UNIFICATION_ENTRY_BLOCK.computeIfAbsent(unificationEntry, entry -> new ArrayList<>()) - .add(supplier); + .add(supplier); } } - if (TagPrefix.ORES.containsKey(unificationEntry.tagPrefix) && !ORES_INVERSE.containsValue(unificationEntry.tagPrefix)) { + if (TagPrefix.ORES.containsKey(unificationEntry.tagPrefix) && + !ORES_INVERSE.containsValue(unificationEntry.tagPrefix)) { ORES_INVERSE.put(TagPrefix.ORES.get(unificationEntry.tagPrefix).stoneType(), unificationEntry.tagPrefix); } for (TagKey tag : unificationEntry.tagPrefix.getAllItemTags(unificationEntry.material)) { @@ -101,12 +104,14 @@ public static void registerUnificationItems(UnificationEntry unificationEntry, S } @SafeVarargs - public static void registerUnificationItems(TagPrefix tagPrefix, @Nullable Material material, Supplier... items) { + public static void registerUnificationItems(TagPrefix tagPrefix, @Nullable Material material, + Supplier... items) { registerUnificationItems(new UnificationEntry(tagPrefix, material), items); } public static void registerUnificationItems(TagPrefix tagPrefix, @Nullable Material material, ItemLike... items) { - registerUnificationItems(new UnificationEntry(tagPrefix, material), Arrays.stream(items).map(item -> (Supplier) () -> item).toArray(Supplier[]::new)); + registerUnificationItems(new UnificationEntry(tagPrefix, material), + Arrays.stream(items).map(item -> (Supplier) () -> item).toArray(Supplier[]::new)); for (ItemLike item : items) { ITEM_UNIFICATION_ENTRY_COLLECTED.put(item, new UnificationEntry(tagPrefix, material)); } @@ -144,23 +149,24 @@ public static MaterialStack getMaterial(ItemLike itemLike) { @Nullable public static Material getMaterial(Fluid fluid) { - return FLUID_MATERIAL.computeIfAbsent(fluid, f -> { - for (Material material : GTCEuAPI.materialManager.getRegisteredMaterials()) { + if (FLUID_MATERIAL.isEmpty()) { + Set> allFluidTags = BuiltInRegistries.FLUID.getTagNames().collect(Collectors.toSet()); + for (final Material material : GTCEuAPI.materialManager.getRegisteredMaterials()) { if (material.hasProperty(PropertyKey.FLUID)) { FluidProperty property = material.getProperty(PropertyKey.FLUID); - for (FluidStorageKey key : FluidStorageKey.allKeys()) { - Fluid stored = property.getStorage().get(key); - TagKey tag = TagUtil.createFluidTag(BuiltInRegistries.FLUID.getKey(stored).getPath()); - if (!Platform.isForge() && tag.location().equals(new ResourceLocation("water")) && !stored.isSame(Fluids.WATER)) continue; - if (!Platform.isForge() && tag.location().equals(new ResourceLocation("lava")) && !stored.isSame(Fluids.LAVA)) continue; - if (f == stored || f.is(tag)) { - return material; - } - } + FluidStorageKey.allKeys().stream() + .map(key -> property.getStorage().get(key)) + .filter(Objects::nonNull) + .map(f -> Pair.of(f, TagUtil.createFluidTag(BuiltInRegistries.FLUID.getKey(f).getPath()))) + .filter(pair -> allFluidTags.contains(pair.getSecond())) + .forEach(pair -> { + allFluidTags.remove(pair.getSecond()); + FLUID_MATERIAL.put(pair.getFirst(), material); + }); } } - return null; - }); + } + return FLUID_MATERIAL.get(fluid); } @Nullable @@ -214,9 +220,9 @@ public static ItemStack getIngotOrDust(MaterialStack materialStack) { } public static ItemStack getGem(MaterialStack materialStack) { - if (materialStack.material().hasProperty(PropertyKey.GEM) - && !TagPrefix.gem.isIgnored(materialStack.material()) - && materialStack.amount() == TagPrefix.gem.getMaterialAmount(materialStack.material())) { + if (materialStack.material().hasProperty(PropertyKey.GEM) && + !TagPrefix.gem.isIgnored(materialStack.material()) && + materialStack.amount() == TagPrefix.gem.getMaterialAmount(materialStack.material())) { return get(TagPrefix.gem, materialStack.material(), (int) (materialStack.amount() / M)); } return getDust(materialStack); @@ -228,7 +234,7 @@ public static UnificationEntry getUnificationEntry(ItemLike itemLike) { var itemKey = itemLike.asItem(); var unifyingEntry = ITEM_UNIFICATION_ENTRY_COLLECTED.get(itemKey); - if(unifyingEntry == null) { + if (unifyingEntry == null) { // Resolve all the lazy suppliers once, rather than on each request. This avoids O(n) lookup performance // for unification entries. ITEM_UNIFICATION_ENTRY.removeIf(entry -> { @@ -241,7 +247,8 @@ public static UnificationEntry getUnificationEntry(ItemLike itemLike) { for (TagKey itemTag : item.asItem().builtInRegistryHolder().tags().toList()) { UnificationEntry unificationEntry = getUnificationEntry(itemTag); // check that it's not the empty marker and that it's not a parent tag - if (unificationEntry != null && Arrays.stream(unificationEntry.tagPrefix.getItemParentTags()).noneMatch(itemTag::equals)) { + if (unificationEntry != null && + Arrays.stream(unificationEntry.tagPrefix.getItemParentTags()).noneMatch(itemTag::equals)) { return unificationEntry; } } @@ -253,17 +260,18 @@ public static UnificationEntry getUnificationEntry(ItemLike itemLike) { public static UnificationEntry getUnificationEntry(TagKey tag) { if (TAG_UNIFICATION_ENTRY.isEmpty()) { - // If the map is empty, resolve all possible tags to their values in an attempt to save time on later lookups. + // If the map is empty, resolve all possible tags to their values in an attempt to save time on later + // lookups. Set> allItemTags = BuiltInRegistries.ITEM.getTagNames().collect(Collectors.toSet()); for (TagPrefix prefix : TagPrefix.values()) { for (Material material : GTCEuAPI.materialManager.getRegisteredMaterials()) { Arrays.stream(prefix.getItemTags(material)) - .filter(allItemTags::contains) - .forEach(tagKey -> { - // remove the tag so that the next iteration is faster. - allItemTags.remove(tagKey); - TAG_UNIFICATION_ENTRY.put(tagKey, new UnificationEntry(prefix, material)); - }); + .filter(allItemTags::contains) + .forEach(tagKey -> { + // remove the tag so that the next iteration is faster. + allItemTags.remove(tagKey); + TAG_UNIFICATION_ENTRY.put(tagKey, new UnificationEntry(prefix, material)); + }); } } } @@ -305,7 +313,8 @@ public static ItemStack get(TagPrefix orePrefix, Material material) { public static List getBlocks(UnificationEntry unificationEntry) { return UNIFICATION_ENTRY_BLOCK.computeIfAbsent(unificationEntry, entry -> { var blocks = new ArrayList>(); - for (TagKey tag : Arrays.stream(getTags(unificationEntry.tagPrefix, unificationEntry.material)).map(itemTagKey -> TagKey.create(Registries.BLOCK, itemTagKey.location())).toList()) { + for (TagKey tag : Arrays.stream(getTags(unificationEntry.tagPrefix, unificationEntry.material)) + .map(itemTagKey -> TagKey.create(Registries.BLOCK, itemTagKey.location())).toList()) { for (Holder itemHolder : BuiltInRegistries.BLOCK.getTagOrEmpty(tag)) { blocks.add(itemHolder::value); } @@ -353,7 +362,8 @@ public static List> getAllItemInfos() { } public static Optional getOrePrefix(BlockState state) { - return ORES_INVERSE.entrySet().stream().filter(entry -> entry.getKey().get().equals(state)).map(Map.Entry::getValue).findFirst(); + return ORES_INVERSE.entrySet().stream().filter(entry -> entry.getKey().get().equals(state)) + .map(Map.Entry::getValue).findFirst(); } public static void reinitializeUnification() { diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/Element.java b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/Element.java index 30e2fcbb8b..0a8e1c249d 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/Element.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/Element.java @@ -1,6 +1,5 @@ package com.gregtechceu.gtceu.api.data.chemical; - import lombok.Getter; import lombok.Setter; import lombok.experimental.Accessors; @@ -10,47 +9,56 @@ */ @Accessors(fluent = true, chain = false) public class Element { + /** * Amount of Protons */ - @Getter @Setter + @Getter + @Setter private long protons; /** * Amount of Neutrons */ - @Getter @Setter + @Getter + @Setter private long neutrons; /** * Amount of Half Life this Material has in Seconds. -1 for stable Materials */ - @Getter @Setter + @Getter + @Setter private long halfLifeSeconds; /** * String representing the Elements this element decays to. Separated by an '&' Character */ - @Getter @Setter + @Getter + @Setter private String decayTo; /** * Name of the Element */ - @Getter @Setter + @Getter + @Setter private String name; /** * Symbol of the Element */ - @Getter @Setter + @Getter + @Setter private String symbol; /** * Is this element an isotope? */ - @Getter @Setter + @Getter + @Setter private boolean isIsotope; public long mass() { return protons + neutrons; } - public Element(long protons, long neutrons, long halfLifeSeconds, String decayTo, String name, String symbol, boolean isIsotope) { + public Element(long protons, long neutrons, long halfLifeSeconds, String decayTo, String name, String symbol, + boolean isIsotope) { this.protons = protons; this.neutrons = neutrons; this.halfLifeSeconds = halfLifeSeconds; diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/IMaterialRegistryManager.java b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/IMaterialRegistryManager.java index b69b6929e0..4b0e8e17c4 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/IMaterialRegistryManager.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/IMaterialRegistryManager.java @@ -1,9 +1,11 @@ package com.gregtechceu.gtceu.api.data.chemical.material; import com.gregtechceu.gtceu.api.data.chemical.material.registry.MaterialRegistry; + +import net.minecraft.resources.ResourceLocation; + import com.mojang.serialization.Codec; import com.mojang.serialization.DataResult; -import net.minecraft.resources.ResourceLocation; import org.jetbrains.annotations.NotNull; import java.util.Collection; @@ -91,7 +93,13 @@ default boolean canModifyMaterials() { } default Codec codec() { - return ResourceLocation.CODEC.flatXmap(id -> Optional.ofNullable(this.getRegistry(id.getNamespace()).get(id.getPath())).map(DataResult::success).orElseGet(() -> DataResult.error(() -> "Unknown registry key in material registry: " + id)), obj -> DataResult.success(obj.getResourceLocation())); + return ResourceLocation.CODEC + .flatXmap( + id -> Optional.ofNullable(this.getRegistry(id.getNamespace()).get(id.getPath())) + .map(DataResult::success) + .orElseGet(() -> DataResult + .error(() -> "Unknown registry key in material registry: " + id)), + obj -> DataResult.success(obj.getResourceLocation())); } enum Phase { @@ -104,4 +112,4 @@ enum Phase { /** Material Registration and Modification is unavailable */ FROZEN } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/MarkerMaterial.java b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/MarkerMaterial.java index d346283d16..15a5c2fa04 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/MarkerMaterial.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/MarkerMaterial.java @@ -5,7 +5,8 @@ /** * MarkerMaterial is type of material used for generic things like material re-registration and use in recipes * Marker material cannot be used to generate any meta items - * Marker material can be used only for marking other materials (re-registering) equal to it and then using it in recipes or in getting items + * Marker material can be used only for marking other materials (re-registering) equal to it and then using it in + * recipes or in getting items * Marker material is not presented in material registry and cannot be used for persistence */ public final class MarkerMaterial extends Material { @@ -15,20 +16,18 @@ public final class MarkerMaterial extends Material { public MarkerMaterial(ResourceLocation resourceLocation) { super(resourceLocation); this.resourceLocation = resourceLocation; - //TODO -// OreDictUnifier.registerMarkerMaterial(this); + // TODO + // OreDictUnifier.registerMarkerMaterial(this); } @Override - protected void registerMaterial() { - } + protected void registerMaterial() {} @Override - public void verifyMaterial() { - } + public void verifyMaterial() {} @Override - //since we're not registered, return overriden name + // since we're not registered, return overriden name public String toString() { return resourceLocation.toString(); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/MarkerMaterials.java b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/MarkerMaterials.java index 9cbcfbb5f1..1aa9c63d46 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/MarkerMaterials.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/MarkerMaterials.java @@ -1,9 +1,11 @@ package com.gregtechceu.gtceu.api.data.chemical.material; -import com.google.common.collect.HashBiMap; import com.gregtechceu.gtceu.GTCEu; + import net.minecraft.world.item.DyeColor; +import com.google.common.collect.HashBiMap; + public class MarkerMaterials { @SuppressWarnings("ResultOfMethodCallIgnored") @@ -49,8 +51,9 @@ public static class Color { /** * Arrays containing all possible color values (without Colorless!) */ - public static final MarkerMaterial[] VALUES = new MarkerMaterial[]{ - White, Orange, Magenta, LightBlue, Yellow, Lime, Pink, Gray, LightGray, Cyan, Purple, Blue, Brown, Green, Red, Black + public static final MarkerMaterial[] VALUES = new MarkerMaterial[] { + White, Orange, Magenta, LightBlue, Yellow, Lime, Pink, Gray, LightGray, Cyan, Purple, Blue, Brown, + Green, Red, Black }; /** diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/Material.java b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/Material.java index ba1d5dd698..0430d7c61a 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/Material.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/Material.java @@ -1,7 +1,5 @@ package com.gregtechceu.gtceu.api.data.chemical.material; -import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableList; import com.gregtechceu.gtceu.api.GTCEuAPI; import com.gregtechceu.gtceu.api.data.chemical.Element; import com.gregtechceu.gtceu.api.data.chemical.material.info.MaterialFlag; @@ -19,25 +17,31 @@ import com.gregtechceu.gtceu.common.data.GTMaterials; import com.gregtechceu.gtceu.integration.kjs.helpers.MaterialStackWrapper; import com.gregtechceu.gtceu.utils.FormattingUtil; + import com.lowdragmc.lowdraglib.side.fluid.FluidStack; -import dev.latvian.mods.rhino.util.RemapPrefixForJS; -import it.unimi.dsi.fastutil.ints.IntArrayList; -import it.unimi.dsi.fastutil.ints.IntList; -import lombok.Getter; -import lombok.Setter; -import lombok.experimental.Accessors; + import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.effect.MobEffects; import net.minecraft.tags.TagKey; +import net.minecraft.world.entity.ai.attributes.Attribute; +import net.minecraft.world.entity.ai.attributes.AttributeModifier; import net.minecraft.world.item.Item; import net.minecraft.world.item.enchantment.Enchantment; import net.minecraft.world.level.material.Fluid; -import org.jetbrains.annotations.NotNull; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableList; +import dev.latvian.mods.rhino.util.HideFromJS; +import dev.latvian.mods.rhino.util.RemapPrefixForJS; +import it.unimi.dsi.fastutil.ints.IntArrayList; +import it.unimi.dsi.fastutil.ints.IntList; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; + import java.util.*; import static com.gregtechceu.gtceu.api.data.chemical.material.properties.PropertyKey.HAZARD; @@ -118,7 +122,8 @@ public Material setComponents(MaterialStack... components) { return this; } - private Material(@NotNull MaterialInfo materialInfo, @NotNull MaterialProperties properties, @NotNull MaterialFlags flags) { + private Material(@NotNull MaterialInfo materialInfo, @NotNull MaterialProperties properties, + @NotNull MaterialFlags flags) { this.materialInfo = materialInfo; this.properties = properties; this.flags = flags; @@ -147,7 +152,8 @@ public String getModid() { } public void addFlags(MaterialFlag... flags) { - if (!GTCEuAPI.materialManager.canModifyMaterials()) throw new IllegalStateException("Cannot add flag to material when registry is frozen!"); + if (!GTCEuAPI.materialManager.canModifyMaterials()) + throw new IllegalStateException("Cannot add flag to material when registry is frozen!"); this.flags.addFlags(flags).verify(this); } @@ -182,7 +188,7 @@ protected void calculateDecompositionType() { Material material = materialStack.material(); onlyMetalMaterials &= material.hasProperty(PropertyKey.INGOT); } - //allow centrifuging of alloy materials only + // allow centrifuging of alloy materials only if (onlyMetalMaterials) { flags.addFlags(MaterialFlags.DECOMPOSITION_BY_CENTRIFUGING); } else { @@ -195,6 +201,7 @@ protected void calculateDecompositionType() { * Retrieves a fluid from the material. * Attempts to retrieve with {@link FluidProperty#getPrimaryKey()}, {@link FluidStorageKeys#LIQUID} and * {@link FluidStorageKeys#GAS}. + * * @return the fluid * @see #getFluid(FluidStorageKey) */ @@ -240,7 +247,7 @@ public FluidStack getFluid(long amount) { /** * - * @param key the key for the fluid + * @param key the key for the fluid * @param amount the amount the FluidStack should have * @return a FluidStack with the fluid and amount */ @@ -263,6 +270,7 @@ public TagKey getFluidTag() { *
* Attempts to retrieve with {@link FluidProperty#getPrimaryKey()}, {@link FluidStorageKeys#LIQUID} and * {@link FluidStorageKeys#GAS}. + * * @return the fluid builder */ public FluidBuilder getFluidBuilder() { @@ -285,6 +293,7 @@ public FluidBuilder getFluidBuilder() { /** * NOTE: only available before the fluids are registered. + * * @param key the key for the fluid * @return the fluid corresponding with the key */ @@ -321,14 +330,16 @@ public Item getBucket() { public int getBlockHarvestLevel() { if (!hasProperty(PropertyKey.DUST)) - throw new IllegalArgumentException("Material " + materialInfo.resourceLocation + " does not have a harvest level! Is probably a Fluid"); + throw new IllegalArgumentException("Material " + materialInfo.resourceLocation + + " does not have a harvest level! Is probably a Fluid"); int harvestLevel = getProperty(PropertyKey.DUST).getHarvestLevel(); return harvestLevel > 0 ? harvestLevel - 1 : harvestLevel; } public int getToolHarvestLevel() { if (!hasProperty(PropertyKey.TOOL)) - throw new IllegalArgumentException("Material " + materialInfo.resourceLocation + " does not have a tool harvest level! Is probably not a Tool Material"); + throw new IllegalArgumentException("Material " + materialInfo.resourceLocation + + " does not have a tool harvest level! Is probably not a Tool Material"); return getProperty(PropertyKey.TOOL).getHarvestLevel(); } @@ -361,6 +372,7 @@ public int getMaterialSecondaryARGB() { /** * Gets a specific color layer in ARGB. + * * @param index the index of the layer [0,10). will crash if you pass values > 10. * @return Gets a specific color layer. */ @@ -374,6 +386,7 @@ public int getMaterialRGB() { /** * Gets a specific color layer. + * * @param index the index of the layer [0,10). will crash if you pass values > 10. * @return Gets a specific color layer. */ @@ -431,7 +444,6 @@ public long getNeutrons() { return totalNeutrons / totalAmount; } - public long getMass() { if (materialInfo.element != null) return materialInfo.element.mass(); @@ -539,7 +551,7 @@ public static class Builder extends BuilderBase { * no longer uses a class hierarchy, instead using a {@link MaterialProperties} system. * * @param resourceLocation The Name of this Material. Will be formatted as - * "material." for the Translation Key. + * "material." for the Translation Key. * @since GTCEu 2.0.0 */ public Builder(ResourceLocation resourceLocation) { @@ -617,6 +629,7 @@ public Builder liquid(int temp) { /** * Add a plasma for this material. + * * @see #fluid(FluidStorageKey, FluidState) */ public Builder plasma() { @@ -638,6 +651,7 @@ public Builder plasma(int temp) { /** * Add a gas for this material. + * * @see #fluid(FluidStorageKey, FluidState) */ public Builder gas() { @@ -755,7 +769,8 @@ public Builder ingot() { * * @param harvestLevel The Harvest Level of this block for Mining. 2 will make it require a iron tool.
* If this Material also has a {@link ToolProperty}, this value will - * also be used to determine the tool's Mining level (-1). So 2 will make the tool harvest diamonds.
+ * also be used to determine the tool's Mining level (-1). So 2 will make the tool harvest + * diamonds.
* If this Material already had a Harvest Level defined, it will be overridden. * @throws IllegalArgumentException If an {@link IngotProperty} has already been added to this Material. */ @@ -769,7 +784,8 @@ public Builder ingot(int harvestLevel) { * * @param harvestLevel The Harvest Level of this block for Mining. 2 will make it require a iron tool.
* If this Material also has a {@link ToolProperty}, this value will - * also be used to determine the tool's Mining level (-1). So 2 will make the tool harvest diamonds.
+ * also be used to determine the tool's Mining level (-1). So 2 will make the tool harvest + * diamonds.
* If this Material already had a Harvest Level defined, it will be overridden. * @param burnTime The Burn Time (in ticks) of this Material as a Furnace Fuel.
* If this Material already had a Burn Time defined, it will be overridden. @@ -908,7 +924,7 @@ public Builder color(int color, boolean hasFluidColor) { * Defaults to 0xFFFFFF unless {@link Builder#colorAverage()} was called, where * it will be a weighted average of the components of the Material. * - * @param color The RGB-formatted Color. + * @param color The RGB-formatted Color. */ public Builder secondaryColor(int color) { this.materialInfo.colors.set(1, color); @@ -924,9 +940,9 @@ public Builder colorAverage() { * Set the {@link MaterialIconSet} of this Material.
* Defaults vary depending on if the Material has a:
*
    - *
  • {@link GemProperty}, it will default to {@link MaterialIconSet#GEM_VERTICAL} - *
  • {@link IngotProperty} or {@link DustProperty}, it will default to {@link MaterialIconSet#DULL} - *
  • {@link FluidProperty}, it will default to {@link MaterialIconSet#FLUID} + *
  • {@link GemProperty}, it will default to {@link MaterialIconSet#GEM_VERTICAL} + *
  • {@link IngotProperty} or {@link DustProperty}, it will default to {@link MaterialIconSet#DULL} + *
  • {@link FluidProperty}, it will default to {@link MaterialIconSet#FLUID} *
* Default will be determined by first-found Property in this order, unless specified. * @@ -940,18 +956,17 @@ public Builder iconSet(MaterialIconSet iconSet) { public Builder components(Object... components) { Preconditions.checkArgument( components.length % 2 == 0, - "Material Components list malformed!" - ); + "Material Components list malformed!"); for (int i = 0; i < components.length; i += 2) { if (components[i] == null) { - throw new IllegalArgumentException("Material in Components List is null for Material " - + this.materialInfo.resourceLocation); + throw new IllegalArgumentException( + "Material in Components List is null for Material " + this.materialInfo.resourceLocation); } composition.add(new MaterialStack( - components[i] instanceof CharSequence chars ? GTMaterials.get(chars.toString()) : (Material) components[i], - ((Number) components[i + 1]).longValue() - )); + components[i] instanceof CharSequence chars ? GTMaterials.get(chars.toString()) : + (Material) components[i], + ((Number) components[i + 1]).longValue())); } return this; } @@ -986,8 +1001,10 @@ public Builder flags(MaterialFlag... flags) { * Dependent Flags (for example, {@link MaterialFlags#GENERATE_LONG_ROD} requiring * {@link MaterialFlags#GENERATE_ROD}) will be automatically applied. * - * @param f1 A {@link Collection} of {@link MaterialFlag}. Provided this way for easy Flag presets to be applied. - * @param f2 An Array of {@link MaterialFlag}. If no {@link Collection} is required, use {@link Builder#flags(MaterialFlag...)}. + * @param f1 A {@link Collection} of {@link MaterialFlag}. Provided this way for easy Flag presets to be + * applied. + * @param f2 An Array of {@link MaterialFlag}. If no {@link Collection} is required, use + * {@link Builder#flags(MaterialFlag...)}. */ // rename for kjs conflicts public Builder appendFlags(Collection f1, MaterialFlag... f2) { @@ -1035,40 +1052,123 @@ public Builder blastTemp(int temp, BlastProperty.GasTier gasTier, int eutOverrid return this; } + // Tons of shortcut functions for adding various hazard effects. + + public Builder hazard(HazardProperty.HazardType hazardType, HazardProperty.HazardEffect effect, + HazardProperty.HazardDamage damage, boolean applyToDerivatives) { + properties.setProperty(HAZARD, new HazardProperty(hazardType, effect, damage, applyToDerivatives)); + return this; + } + + public Builder hazard(HazardProperty.HazardType hazardType, HazardProperty.HazardEffect effect, + HazardProperty.HazardDamage damage) { + properties.setProperty(HAZARD, new HazardProperty(hazardType, effect, damage, true)); + return this; + } - public Builder hazard(HazardProperty.HazardType poisonType, HazardProperty.HazardEffect effect, HazardProperty.HazardDamage damage, boolean applyToDerivatives) { - properties.setProperty(HAZARD, new HazardProperty(poisonType, effect, damage, applyToDerivatives)); + public Builder hazard(HazardProperty.HazardType hazardType, HazardProperty.HazardEffect effect, + boolean applyToDerivatives) { + properties.setProperty(HAZARD, new HazardProperty(hazardType, effect, null, applyToDerivatives)); return this; } - public Builder hazard(HazardProperty.HazardType poisonType, HazardProperty.HazardEffect effect, HazardProperty.HazardDamage damage) { - properties.setProperty(HAZARD, new HazardProperty(poisonType, effect, damage, true)); + + public Builder hazard(HazardProperty.HazardType hazardType, HazardProperty.HazardDamage damage, + boolean applyToDerivatives) { + properties.setProperty(HAZARD, new HazardProperty(hazardType, List.of(), damage, applyToDerivatives)); return this; } - public Builder hazard(HazardProperty.HazardType poisonType, HazardProperty.HazardEffect effect, boolean applyToDerivatives) { - properties.setProperty(HAZARD, new HazardProperty(poisonType, effect, null, applyToDerivatives)); + + @HideFromJS + public Builder hazard(HazardProperty.HazardType hazardType, HazardProperty.HazardEffect effect) { + properties.setProperty(HAZARD, new HazardProperty(hazardType, effect, null, true)); return this; } - public Builder hazard(HazardProperty.HazardType poisonType, HazardProperty.HazardDamage damage, boolean applyToDerivatives) { - properties.setProperty(HAZARD, new HazardProperty(poisonType, null, damage, applyToDerivatives)); + + public Builder hazard(HazardProperty.HazardType hazardType, HazardProperty.HazardDamage damage) { + properties.setProperty(HAZARD, new HazardProperty(hazardType, List.of(), damage, true)); return this; } - public Builder hazard(HazardProperty.HazardType poisonType, HazardProperty.HazardEffect effect) { - properties.setProperty(HAZARD, new HazardProperty(poisonType, effect, null, true)); + public Builder hazard(HazardProperty.HazardType hazardType, List effects) { + properties.setProperty(HAZARD, new HazardProperty(hazardType, effects, null, true)); return this; } - public Builder hazard(HazardProperty.HazardType poisonType, HazardProperty.HazardDamage damage) { - properties.setProperty(HAZARD, new HazardProperty(poisonType, null, damage, true)); + + public Builder hazard(HazardProperty.HazardType hazardType, List effects, + boolean applyToDerivatives) { + properties.setProperty(HAZARD, new HazardProperty(hazardType, effects, null, applyToDerivatives)); + return this; + } + + public Builder hazard(HazardProperty.HazardType hazardType, int secondsToMax, Attribute attribute, + AttributeModifier maxModifier) { + properties.setProperty(HAZARD, new HazardProperty(hazardType, + new HazardProperty.HazardEffect(secondsToMax, Map.of(attribute, maxModifier)), null, true)); + return this; + } + + public Builder hazard(HazardProperty.HazardType hazardType, int secondsToMax, Attribute attribute, + AttributeModifier maxModifier, boolean applyToDerivatives) { + properties.setProperty(HAZARD, + new HazardProperty(hazardType, + new HazardProperty.HazardEffect(secondsToMax, Map.of(attribute, maxModifier)), null, + applyToDerivatives)); + return this; + } + + public Builder hazard(HazardProperty.HazardType hazardType, int secondsToMax, Attribute attribute, + AttributeModifier maxModifier, int maxAirModifier) { + properties.setProperty(HAZARD, new HazardProperty(hazardType, + new HazardProperty.HazardEffect(secondsToMax, Map.of(attribute, maxModifier), maxAirModifier), null, + true)); return this; } - public Builder hazard(HazardProperty.HazardType poisonType, boolean applyToDerivatives) { - properties.setProperty(HAZARD, new HazardProperty(poisonType, new HazardProperty.HazardEffect(200, MobEffects.POISON), new HazardProperty.HazardDamage(2,1), applyToDerivatives)); + public Builder hazard(HazardProperty.HazardType hazardType, int secondsToMax, Attribute attribute, + AttributeModifier maxModifier, int maxAirModifier, boolean applyToDerivatives) { + properties.setProperty(HAZARD, new HazardProperty(hazardType, + new HazardProperty.HazardEffect(secondsToMax, Map.of(attribute, maxModifier), maxAirModifier), null, + applyToDerivatives)); return this; } - public Builder hazard(HazardProperty.HazardType poisonType) { - properties.setProperty(HAZARD, new HazardProperty(poisonType, new HazardProperty.HazardEffect(200, MobEffects.POISON), new HazardProperty.HazardDamage(2,1), true)); + public Builder hazard(HazardProperty.HazardType hazardType, boolean applyToDerivatives) { + properties.setProperty(HAZARD, new HazardProperty(hazardType, HazardProperty.poisonEffect(1000, 2000, 3), + null, applyToDerivatives)); + return this; + } + + public Builder hazard(HazardProperty.HazardType hazardType) { + properties.setProperty(HAZARD, + new HazardProperty(hazardType, HazardProperty.poisonEffect(1000, 2000, 3), null, true)); + return this; + } + + public Builder radioactiveHazard(float multiplier) { + int effectAmplifier = (int) (multiplier - 1); + properties.setProperty(HAZARD, new HazardProperty( + HazardProperty.HazardType.RADIOACTIVE, + List.of( + HazardProperty.slownessEffect(-1, (int) (2000 / multiplier), effectAmplifier), + HazardProperty.weaknessEffect(-1, (int) (2000 / multiplier), effectAmplifier), + HazardProperty.miningFautigueEffect(-1, (int) (3000 / multiplier), effectAmplifier), + HazardProperty.maxAirLoweringEffect(1000, (int) (4000 / multiplier), + (int) (100 / multiplier)), + HazardProperty.maxHealthLoweringEffect(4000, (int) (6000 / multiplier), 10), + HazardProperty.witherEffect(10000, (int) (24000 / multiplier), effectAmplifier)), + null, + true)); + return this; + } + + public Builder irritantHazard(boolean applyToDerivatives) { + properties.setProperty(HAZARD, new HazardProperty( + HazardProperty.HazardType.CONTACT_POISON, + List.of( + HazardProperty.slownessEffect(200, 200, 0), + HazardProperty.miningFautigueEffect(200, 300, 0)), + null, + applyToDerivatives)); return this; } @@ -1157,9 +1257,11 @@ public Builder cableProperties(long voltage, int amperage, int loss, boolean isS return this; } - public Builder cableProperties(long voltage, int amperage, int loss, boolean isSuperCon, int criticalTemperature) { + public Builder cableProperties(long voltage, int amperage, int loss, boolean isSuperCon, + int criticalTemperature) { properties.ensureSet(PropertyKey.DUST); - properties.setProperty(PropertyKey.WIRE, new WireProperties((int) voltage, amperage, loss, isSuperCon, criticalTemperature)); + properties.setProperty(PropertyKey.WIRE, + new WireProperties((int) voltage, amperage, loss, isSuperCon, criticalTemperature)); return this; } @@ -1167,8 +1269,10 @@ public Builder fluidPipeProperties(int maxTemp, int throughput, boolean gasProof return fluidPipeProperties(maxTemp, throughput, gasProof, false, false, false); } - public Builder fluidPipeProperties(int maxTemp, int throughput, boolean gasProof, boolean acidProof, boolean cryoProof, boolean plasmaProof) { - properties.setProperty(PropertyKey.FLUID_PIPE, new FluidPipeProperties(maxTemp, throughput, gasProof, acidProof, cryoProof, plasmaProof)); + public Builder fluidPipeProperties(int maxTemp, int throughput, boolean gasProof, boolean acidProof, + boolean cryoProof, boolean plasmaProof) { + properties.setProperty(PropertyKey.FLUID_PIPE, + new FluidPipeProperties(maxTemp, throughput, gasProof, acidProof, cryoProof, plasmaProof)); return this; } @@ -1185,14 +1289,26 @@ public Builder addDefaultEnchant(Enchantment enchant, int level) { return this; } + @HideFromJS public Material buildAndRegister() { - materialInfo.componentList = composition.isEmpty() && this.compositionSupplier != null ? ImmutableList.copyOf(compositionSupplier.stream().map(MaterialStackWrapper::toMatStack).toArray(MaterialStack[]::new)) : ImmutableList.copyOf(composition); - for (MaterialStack materialStack: materialInfo.componentList) - if(materialStack.material().getProperties().hasProperty(HAZARD) && materialStack.material().getProperties().getProperty(HAZARD).isApplyToDerivatives() && !properties.hasProperty(HAZARD)) - properties.setProperty(HAZARD, materialStack.material().getProperties().getProperty(HAZARD)); - - if(properties.hasProperty(HAZARD) && properties.getProperty(HAZARD).getHazardType() == HazardProperty.HazardType.NONE) + materialInfo.componentList = composition.isEmpty() && this.compositionSupplier != null ? + ImmutableList.copyOf(compositionSupplier.stream().map(MaterialStackWrapper::toMatStack) + .toArray(MaterialStack[]::new)) : + ImmutableList.copyOf(composition); + if (!properties.hasProperty(HAZARD)) { + for (MaterialStack materialStack : materialInfo.componentList) { + Material material = materialStack.material(); + if (material.hasProperty(HAZARD) && material.getProperty(HAZARD).isApplyToDerivatives()) { + properties.setProperty(HAZARD, material.getProperty(HAZARD)); + break; + } + } + } + if (properties.hasProperty(HAZARD) && + properties.getProperty(HAZARD).getHazardType() == HazardProperty.HazardType.NONE) { properties.removeProperty(HAZARD); + } + var mat = new Material(materialInfo, properties, flags); materialInfo.verifyInfo(properties, averageRGB); mat.registerMaterial(); @@ -1200,6 +1316,7 @@ public Material buildAndRegister() { } @Override + @HideFromJS public Material register() { return value = buildAndRegister(); } @@ -1210,6 +1327,7 @@ public Material register() { */ @Accessors(chain = true) private static class MaterialInfo { + /** * The modid and unlocalized name of this Material. *

@@ -1223,7 +1341,8 @@ private static class MaterialInfo { *

* Default: 0xFFFFFF if no Components, otherwise it will be the average of Components. */ - @Getter @Setter + @Getter + @Setter private IntList colors = new IntArrayList(List.of(-1, -1)); /** @@ -1231,7 +1350,8 @@ private static class MaterialInfo { *

* Default: 0xFFFFFF if no Components, otherwise it will be the average of Components. */ - @Getter @Setter + @Getter + @Setter private boolean hasFluidColor = true; /** @@ -1240,7 +1360,8 @@ private static class MaterialInfo { * Default: - GEM_VERTICAL if it has GemProperty. * - DULL if has DustProperty or IngotProperty. */ - @Getter @Setter + @Getter + @Setter private MaterialIconSet iconSet; /** @@ -1248,7 +1369,8 @@ private static class MaterialInfo { *

* Default: none. */ - @Getter @Setter + @Getter + @Setter private ImmutableList componentList; /** @@ -1256,7 +1378,8 @@ private static class MaterialInfo { *

* Default: none. */ - @Getter @Setter + @Getter + @Setter private Element element; private MaterialInfo(ResourceLocation resourceLocation) { @@ -1268,11 +1391,13 @@ private void verifyInfo(MaterialProperties p, boolean averageRGB) { if (iconSet == null) { if (p.hasProperty(PropertyKey.GEM)) { iconSet = MaterialIconSet.GEM_VERTICAL; - } else if (p.hasProperty(PropertyKey.DUST) || p.hasProperty(PropertyKey.INGOT) || p.hasProperty(PropertyKey.POLYMER)) { - iconSet = MaterialIconSet.DULL; - } else if (p.hasProperty(PropertyKey.FLUID)) { - iconSet = MaterialIconSet.FLUID; - } else iconSet = MaterialIconSet.DULL; + } else if (p.hasProperty(PropertyKey.DUST) || p.hasProperty(PropertyKey.INGOT) || + p.hasProperty(PropertyKey.POLYMER)) { + iconSet = MaterialIconSet.DULL; + } else + if (p.hasProperty(PropertyKey.FLUID)) { + iconSet = MaterialIconSet.FLUID; + } else iconSet = MaterialIconSet.DULL; } // Verify MaterialRGB diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/event/MaterialEvent.java b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/event/MaterialEvent.java index c52718b0c7..27a162f6b5 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/event/MaterialEvent.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/event/MaterialEvent.java @@ -13,4 +13,4 @@ public class MaterialEvent extends Event implements IModBusEvent { public MaterialEvent() { super(); } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/event/MaterialRegistryEvent.java b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/event/MaterialRegistryEvent.java index be3ca6298b..4749df8e1a 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/event/MaterialRegistryEvent.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/event/MaterialRegistryEvent.java @@ -1,9 +1,8 @@ package com.gregtechceu.gtceu.api.data.chemical.material.event; import com.gregtechceu.gtceu.api.data.chemical.material.IMaterialRegistryManager; -import com.gregtechceu.gtceu.api.data.chemical.material.registry.MaterialRegistry; + import net.minecraftforge.eventbus.api.Event; -import net.minecraftforge.eventbus.api.GenericEvent; import net.minecraftforge.fml.event.IModBusEvent; /** @@ -18,4 +17,4 @@ public class MaterialRegistryEvent extends Event implements IModBusEvent { public MaterialRegistryEvent() { super(); } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/event/PostMaterialEvent.java b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/event/PostMaterialEvent.java index 9c5ea1b8b3..21c57b947b 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/event/PostMaterialEvent.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/event/PostMaterialEvent.java @@ -13,4 +13,4 @@ public class PostMaterialEvent extends Event implements IModBusEvent { public PostMaterialEvent() { super(); } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/info/MaterialFlag.java b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/info/MaterialFlag.java index 33ae423ca4..1953eace5b 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/info/MaterialFlag.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/info/MaterialFlag.java @@ -3,6 +3,7 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.api.data.chemical.material.properties.PropertyKey; + import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import java.util.Arrays; @@ -30,7 +31,8 @@ private MaterialFlag(String name, Set requiredFlags, Set verifyFlag(Material material) { requiredProperties.forEach(key -> { if (!material.hasProperty(key)) { - GTCEu.LOGGER.warn("Material {} does not have required property {} for flag {}!", material.getUnlocalizedName(), key.toString(), this.name); + GTCEu.LOGGER.warn("Material {} does not have required property {} for flag {}!", + material.getUnlocalizedName(), key.toString(), this.name); } }); diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/info/MaterialFlags.java b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/info/MaterialFlags.java index 7f327d656d..aa2784a3ef 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/info/MaterialFlags.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/info/MaterialFlags.java @@ -37,7 +37,7 @@ public String toString() { } ///////////////// - // GENERIC // + // GENERIC // ///////////////// /** @@ -48,12 +48,14 @@ public String toString() { /** * Enables electrolyzer decomposition recipe generation */ - public static final MaterialFlag DECOMPOSITION_BY_ELECTROLYZING = new MaterialFlag.Builder("decomposition_by_electrolyzing").build(); + public static final MaterialFlag DECOMPOSITION_BY_ELECTROLYZING = new MaterialFlag.Builder( + "decomposition_by_electrolyzing").build(); /** * Enables centrifuge decomposition recipe generation */ - public static final MaterialFlag DECOMPOSITION_BY_CENTRIFUGING = new MaterialFlag.Builder("decomposition_by_centrifuging").build(); + public static final MaterialFlag DECOMPOSITION_BY_CENTRIFUGING = new MaterialFlag.Builder( + "decomposition_by_centrifuging").build(); /** * Disables decomposition recipe generation for this material @@ -81,7 +83,7 @@ public String toString() { public static final MaterialFlag PHOSPHORESCENT = new MaterialFlag.Builder("phosphorescent").build(); ////////////////// - // DUST // + // DUST // ////////////////// /** @@ -95,9 +97,9 @@ public String toString() { .build(); public static final MaterialFlag GENERATE_DENSE = new MaterialFlag.Builder("generate_dense") - .requireFlags(GENERATE_PLATE) - .requireProps(PropertyKey.DUST) - .build(); + .requireFlags(GENERATE_PLATE) + .requireProps(PropertyKey.DUST) + .build(); public static final MaterialFlag GENERATE_ROD = new MaterialFlag.Builder("generate_rod") .requireProps(PropertyKey.DUST) @@ -131,11 +133,13 @@ public String toString() { * This will prevent material from creating Shapeless recipes for dust to block and vice versa * Also preventing extruding and alloy smelting recipes via SHAPE_EXTRUDING/MOLD_BLOCK */ - public static final MaterialFlag EXCLUDE_BLOCK_CRAFTING_RECIPES = new MaterialFlag.Builder("exclude_block_crafting_recipes") + public static final MaterialFlag EXCLUDE_BLOCK_CRAFTING_RECIPES = new MaterialFlag.Builder( + "exclude_block_crafting_recipes") .requireProps(PropertyKey.DUST) .build(); - public static final MaterialFlag EXCLUDE_PLATE_COMPRESSOR_RECIPE = new MaterialFlag.Builder("exclude_plate_compressor_recipe") + public static final MaterialFlag EXCLUDE_PLATE_COMPRESSOR_RECIPE = new MaterialFlag.Builder( + "exclude_plate_compressor_recipe") .requireFlags(GENERATE_PLATE) .requireProps(PropertyKey.DUST) .build(); @@ -143,7 +147,8 @@ public String toString() { /** * This will prevent material from creating Shapeless recipes for dust to block and vice versa */ - public static final MaterialFlag EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES = new MaterialFlag.Builder("exclude_block_crafting_by_hand_recipes") + public static final MaterialFlag EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES = new MaterialFlag.Builder( + "exclude_block_crafting_by_hand_recipes") .requireProps(PropertyKey.DUST) .build(); @@ -152,7 +157,8 @@ public String toString() { .build(); /** - * Add to material if it cannot be worked by any other means, than smashing or smelting. This is used for coated Materials. + * Add to material if it cannot be worked by any other means, than smashing or smelting. This is used for coated + * Materials. */ public static final MaterialFlag NO_WORKING = new MaterialFlag.Builder("no_working") .requireProps(PropertyKey.DUST) @@ -176,22 +182,24 @@ public String toString() { * Add to material if it's impossible to smelt it from an ore. */ public static final MaterialFlag NO_ORE_SMELTING = new MaterialFlag.Builder("no_ore_smelting") - .requireProps(PropertyKey.DUST) - .build(); + .requireProps(PropertyKey.DUST) + .build(); /** - * Add this to your Material if you want to have its Ore Calcite heated in a Blast Furnace for more output. Already listed are: + * Add this to your Material if you want to have its Ore Calcite heated in a Blast Furnace for more output. Already + * listed are: * Iron, Pyrite, PigIron, WroughtIron. */ - public static final MaterialFlag BLAST_FURNACE_CALCITE_DOUBLE = new MaterialFlag.Builder("blast_furnace_calcite_double") + public static final MaterialFlag BLAST_FURNACE_CALCITE_DOUBLE = new MaterialFlag.Builder( + "blast_furnace_calcite_double") .requireProps(PropertyKey.DUST) .build(); - public static final MaterialFlag BLAST_FURNACE_CALCITE_TRIPLE = new MaterialFlag.Builder("blast_furnace_calcite_triple") + public static final MaterialFlag BLAST_FURNACE_CALCITE_TRIPLE = new MaterialFlag.Builder( + "blast_furnace_calcite_triple") .requireProps(PropertyKey.DUST) .build(); - // GCyM /** * Use to disable alloy blast recipes from generating @@ -209,7 +217,7 @@ public String toString() { .build(); ///////////////// - // FLUID // + // FLUID // ///////////////// public static final MaterialFlag SOLDER_MATERIAL = new MaterialFlag.Builder("solder_material") @@ -225,7 +233,7 @@ public String toString() { .build(); ///////////////// - // INGOT // + // INGOT // ///////////////// public static final MaterialFlag GENERATE_FOIL = new MaterialFlag.Builder("generate_foil") @@ -275,7 +283,7 @@ public String toString() { .build(); ///////////////// - // GEM // + // GEM // ///////////////// /** @@ -291,7 +299,7 @@ public String toString() { .build(); ///////////////// - // ORE // + // ORE // ///////////////// public static final MaterialFlag HIGH_SIFTER_OUTPUT = new MaterialFlag.Builder("high_sifter_output") diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/info/MaterialIconSet.java b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/info/MaterialIconSet.java index 01e6099a18..edf2447771 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/info/MaterialIconSet.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/info/MaterialIconSet.java @@ -1,11 +1,12 @@ package com.gregtechceu.gtceu.api.data.chemical.material.info; -import com.google.common.base.Preconditions; import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.integration.kjs.GTRegistryInfo; +import com.google.common.base.Preconditions; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; + import java.util.HashMap; import java.util.Locale; import java.util.Map; @@ -72,13 +73,15 @@ public MaterialIconSet(@NotNull String name, @NotNull MaterialIconSet parentIcon /** * Create a new MaterialIconSet which is a root + * * @param name the name of the iconset * @param parentIconset the parent iconset, should be null if this should be a root iconset * @param isRootIconset true if this should be a root iconset, otherwise false */ public MaterialIconSet(@NotNull String name, @Nullable MaterialIconSet parentIconset, boolean isRootIconset) { this.name = name.toLowerCase(Locale.ENGLISH); - Preconditions.checkArgument(!ICON_SETS.containsKey(this.name), "MaterialIconSet " + this.name + " already registered!"); + Preconditions.checkArgument(!ICON_SETS.containsKey(this.name), + "MaterialIconSet " + this.name + " already registered!"); this.id = idCounter++; this.isRootIconset = isRootIconset; this.parentIconset = parentIconset; diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/info/MaterialIconType.java b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/info/MaterialIconType.java index 3d43230e76..e6b674fb0f 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/info/MaterialIconType.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/info/MaterialIconType.java @@ -1,18 +1,21 @@ package com.gregtechceu.gtceu.api.data.chemical.material.info; -import com.google.common.base.CaseFormat; -import com.google.common.base.Preconditions; -import com.google.common.collect.HashBasedTable; -import com.google.common.collect.Table; import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.integration.kjs.GTRegistryInfo; + import com.lowdragmc.lowdraglib.Platform; import com.lowdragmc.lowdraglib.utils.ResourceHelper; + import net.minecraft.client.Minecraft; import net.minecraft.resources.ResourceLocation; +import com.google.common.base.CaseFormat; +import com.google.common.base.Preconditions; +import com.google.common.collect.HashBasedTable; +import com.google.common.collect.Table; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; + import java.util.HashMap; import java.util.Map; @@ -102,15 +105,21 @@ public record MaterialIconType(String name) { public static final MaterialIconType crop = new MaterialIconType("crop"); public static final MaterialIconType essence = new MaterialIconType("essence"); - private static final Table ITEM_MODEL_CACHE = HashBasedTable.create(); - private static final Table ITEM_TEXTURE_CACHE = HashBasedTable.create(); - private static final Table BLOCK_MODEL_CACHE = HashBasedTable.create(); - private static final Table BLOCK_TEXTURE_CACHE = HashBasedTable.create(); - private static final Table BLOCK_TEXTURE_CACHE_SECONDARY = HashBasedTable.create(); + private static final Table ITEM_MODEL_CACHE = HashBasedTable + .create(); + private static final Table ITEM_TEXTURE_CACHE = HashBasedTable + .create(); + private static final Table BLOCK_MODEL_CACHE = HashBasedTable + .create(); + private static final Table BLOCK_TEXTURE_CACHE = HashBasedTable + .create(); + private static final Table BLOCK_TEXTURE_CACHE_SECONDARY = HashBasedTable + .create(); public MaterialIconType(String name) { this.name = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, name); - Preconditions.checkArgument(!ICON_TYPES.containsKey(this.name), "MaterialIconType " + this.name + " already registered!"); + Preconditions.checkArgument(!ICON_TYPES.containsKey(this.name), + "MaterialIconType " + this.name + " already registered!"); ICON_TYPES.put(this.name, this); } @@ -130,31 +139,39 @@ public ResourceLocation getBlockTexturePath(@NotNull MaterialIconSet materialIco } @Nullable // Safe: only null on registration on fabric, and no "required" textures are resolved at that point. - public ResourceLocation getBlockTexturePath(@NotNull MaterialIconSet materialIconSet, String suffix, boolean doReadCache) { + public ResourceLocation getBlockTexturePath(@NotNull MaterialIconSet materialIconSet, String suffix, + boolean doReadCache) { if (doReadCache) { if (suffix == null || suffix.isBlank()) { - if (BLOCK_TEXTURE_CACHE.contains(this, materialIconSet)) return BLOCK_TEXTURE_CACHE.get(this, materialIconSet); + if (BLOCK_TEXTURE_CACHE.contains(this, materialIconSet)) + return BLOCK_TEXTURE_CACHE.get(this, materialIconSet); } else { - if (BLOCK_TEXTURE_CACHE_SECONDARY.contains(this, materialIconSet)) return BLOCK_TEXTURE_CACHE_SECONDARY.get(this, materialIconSet); + if (BLOCK_TEXTURE_CACHE_SECONDARY.contains(this, materialIconSet)) + return BLOCK_TEXTURE_CACHE_SECONDARY.get(this, materialIconSet); } } suffix = suffix == null || suffix.isBlank() ? "" : "_" + suffix; MaterialIconSet iconSet = materialIconSet; - //noinspection ConstantConditions - if (!Platform.isClient() || Minecraft.getInstance() == null || Minecraft.getInstance().getResourceManager() == null) return null; // check minecraft for null for CI environments + // noinspection ConstantConditions + if (!Platform.isClient() || Minecraft.getInstance() == null || + Minecraft.getInstance().getResourceManager() == null) + return null; // check minecraft for null for CI environments if (!iconSet.isRootIconset) { while (!iconSet.isRootIconset) { - ResourceLocation location = GTCEu.id(String.format("textures/block/material_sets/%s/%s%s.png", iconSet.name, this.name, suffix)); + ResourceLocation location = GTCEu + .id(String.format("textures/block/material_sets/%s/%s%s.png", iconSet.name, this.name, suffix)); if (ResourceHelper.isResourceExist(location) || ResourceHelper.isResourceExistRaw(location)) break; iconSet = iconSet.parentIconset; } } - ResourceLocation location = GTCEu.id(String.format("textures/block/material_sets/%s/%s%s.png", iconSet.name, this.name, suffix)); - if (!suffix.isEmpty() && !ResourceHelper.isResourceExist(location) && !ResourceHelper.isResourceExistRaw(location)) { + ResourceLocation location = GTCEu + .id(String.format("textures/block/material_sets/%s/%s%s.png", iconSet.name, this.name, suffix)); + if (!suffix.isEmpty() && !ResourceHelper.isResourceExist(location) && + !ResourceHelper.isResourceExistRaw(location)) { return null; } location = GTCEu.id(String.format("block/material_sets/%s/%s%s", iconSet.name, this.name, suffix)); @@ -176,10 +193,12 @@ public ResourceLocation getBlockModelPath(@NotNull MaterialIconSet materialIconS } MaterialIconSet iconSet = materialIconSet; - //noinspection ConstantConditions - if (!iconSet.isRootIconset && Platform.isClient() && Minecraft.getInstance() != null && Minecraft.getInstance().getResourceManager() != null) { // check minecraft for null for CI environments + // noinspection ConstantConditions + if (!iconSet.isRootIconset && Platform.isClient() && Minecraft.getInstance() != null && + Minecraft.getInstance().getResourceManager() != null) { // check minecraft for null for CI environments while (!iconSet.isRootIconset) { - ResourceLocation location = GTCEu.id(String.format("models/block/material_sets/%s/%s.json", iconSet.name, this.name)); + ResourceLocation location = GTCEu + .id(String.format("models/block/material_sets/%s/%s.json", iconSet.name, this.name)); if (ResourceHelper.isResourceExist(location) || ResourceHelper.isResourceExistRaw(location)) break; iconSet = iconSet.parentIconset; @@ -201,10 +220,12 @@ public ResourceLocation getItemModelPath(@NotNull MaterialIconSet materialIconSe } MaterialIconSet iconSet = materialIconSet; - //noinspection ConstantConditions - if (!iconSet.isRootIconset && Platform.isClient() && Minecraft.getInstance() != null && Minecraft.getInstance().getResourceManager() != null) { // check minecraft for null for CI environments + // noinspection ConstantConditions + if (!iconSet.isRootIconset && Platform.isClient() && Minecraft.getInstance() != null && + Minecraft.getInstance().getResourceManager() != null) { // check minecraft for null for CI environments while (!iconSet.isRootIconset) { - ResourceLocation location = GTCEu.id(String.format("models/item/material_sets/%s/%s.json", iconSet.name, this.name)); + ResourceLocation location = GTCEu + .id(String.format("models/item/material_sets/%s/%s.json", iconSet.name, this.name)); if (ResourceHelper.isResourceExist(location) || ResourceHelper.isResourceExistRaw(location)) break; iconSet = iconSet.parentIconset; @@ -226,10 +247,12 @@ public ResourceLocation getItemTexturePath(@NotNull MaterialIconSet materialIcon } MaterialIconSet iconSet = materialIconSet; - //noinspection ConstantConditions - if (!iconSet.isRootIconset && Platform.isClient() && Minecraft.getInstance() != null && Minecraft.getInstance().getResourceManager() != null) { // check minecraft for null for CI environments + // noinspection ConstantConditions + if (!iconSet.isRootIconset && Platform.isClient() && Minecraft.getInstance() != null && + Minecraft.getInstance().getResourceManager() != null) { // check minecraft for null for CI environments while (!iconSet.isRootIconset) { - ResourceLocation location = GTCEu.id(String.format("textures/item/material_sets/%s/%s.png", iconSet.name, this.name)); + ResourceLocation location = GTCEu + .id(String.format("textures/item/material_sets/%s/%s.png", iconSet.name, this.name)); if (ResourceHelper.isResourceExist(location) || ResourceHelper.isResourceExistRaw(location)) break; iconSet = iconSet.parentIconset; diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/AlloyBlastProperty.java b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/AlloyBlastProperty.java index d64d277cb0..d52d9b7259 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/AlloyBlastProperty.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/AlloyBlastProperty.java @@ -1,12 +1,14 @@ package com.gregtechceu.gtceu.api.data.chemical.material.properties; -import com.google.common.base.Preconditions; import com.gregtechceu.gtceu.data.recipe.misc.alloyblast.AlloyBlastRecipeProducer; -import lombok.Getter; -import lombok.Setter; + import net.minecraft.world.level.material.Fluid; +import com.google.common.base.Preconditions; +import lombok.Getter; +import lombok.Setter; import org.jetbrains.annotations.NotNull; + import java.util.function.Supplier; public class AlloyBlastProperty implements IMaterialProperty { diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/BlastProperty.java b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/BlastProperty.java index cff432cca9..0bfefaa5f0 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/BlastProperty.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/BlastProperty.java @@ -100,16 +100,21 @@ public static GasTier validateGasTier(String gasTierName) { else if ("HIGHEST".equalsIgnoreCase(gasTierName)) return GasTier.HIGHEST; else { String message = "Gas Tier must be either \"LOW\", \"MID\", \"HIGH\", \"HIGHER\", or \"HIGHEST\""; - throw new IllegalArgumentException("Could not find valid gas tier for name: " + gasTierName + ". " + message); + throw new IllegalArgumentException( + "Could not find valid gas tier for name: " + gasTierName + ". " + message); } } public enum GasTier { + // Tiers used by GTCEu - LOW, MID, HIGH, + LOW, + MID, + HIGH, // Tiers reserved for addons - HIGHER, HIGHEST; + HIGHER, + HIGHEST; public static final GasTier[] VALUES = values(); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/FluidPipeProperties.java b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/FluidPipeProperties.java index 48554f37e6..f7c5c6c5b1 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/FluidPipeProperties.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/FluidPipeProperties.java @@ -4,7 +4,9 @@ import com.gregtechceu.gtceu.api.fluids.FluidState; import com.gregtechceu.gtceu.api.fluids.attribute.FluidAttribute; import com.gregtechceu.gtceu.api.fluids.attribute.FluidAttributes; + import com.lowdragmc.lowdraglib.side.fluid.FluidHelper; + import it.unimi.dsi.fastutil.objects.Object2BooleanMap; import it.unimi.dsi.fastutil.objects.Object2BooleanOpenHashMap; import lombok.Getter; @@ -16,28 +18,35 @@ import java.util.Objects; public class FluidPipeProperties implements IMaterialProperty, IPropertyFluidFilter { + /** * The maximum number of channels any fluid pipe can have */ public static final int MAX_PIPE_CHANNELS = 9; - @Getter @Setter + @Getter + @Setter private long throughput; - @Getter @Setter + @Getter + @Setter private int channels; - @Getter @Setter + @Getter + @Setter private int maxFluidTemperature; - @Getter @Setter + @Getter + @Setter private boolean gasProof; - @Getter @Setter + @Getter + @Setter private boolean cryoProof; - @Getter @Setter + @Getter + @Setter private boolean plasmaProof; private final Object2BooleanMap containmentPredicate = new Object2BooleanOpenHashMap<>(); - - public FluidPipeProperties(int maxFluidTemperature, long throughput, boolean gasProof, boolean acidProof, boolean cryoProof, boolean plasmaProof, int channels) { + public FluidPipeProperties(int maxFluidTemperature, long throughput, boolean gasProof, boolean acidProof, + boolean cryoProof, boolean plasmaProof, int channels) { this.maxFluidTemperature = maxFluidTemperature; this.throughput = throughput; this.gasProof = gasProof; @@ -50,7 +59,8 @@ public FluidPipeProperties(int maxFluidTemperature, long throughput, boolean gas /** * Default property constructor. */ - public FluidPipeProperties(int maxFluidTemperature, long throughput, boolean gasProof, boolean acidProof, boolean cryoProof, boolean plasmaProof) { + public FluidPipeProperties(int maxFluidTemperature, long throughput, boolean gasProof, boolean acidProof, + boolean cryoProof, boolean plasmaProof) { this(maxFluidTemperature, throughput, gasProof, acidProof, cryoProof, plasmaProof, 1); } @@ -72,7 +82,7 @@ public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof FluidPipeProperties that)) return false; return maxFluidTemperature == that.maxFluidTemperature && - throughput == that.throughput && gasProof == that.gasProof && channels == that.channels; + throughput == that.throughput && gasProof == that.gasProof && channels == that.channels; } @Override diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/FluidProperty.java b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/FluidProperty.java index a5385ce51c..35d227d435 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/FluidProperty.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/FluidProperty.java @@ -2,10 +2,10 @@ import com.gregtechceu.gtceu.api.fluids.store.FluidStorage; import com.gregtechceu.gtceu.api.fluids.store.FluidStorageKey; + import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; - import org.jetbrains.annotations.Nullable; @NoArgsConstructor @@ -13,12 +13,10 @@ public class FluidProperty implements IMaterialProperty { @Getter private final FluidStorage storage = new FluidStorage(); - @Getter @Setter + @Getter + @Setter private @Nullable FluidStorageKey primaryKey = null; @Override - public void verifyProperty(MaterialProperties properties) { - - } - + public void verifyProperty(MaterialProperties properties) {} } diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/HazardProperty.java b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/HazardProperty.java index 7040bc9612..76b3b92d49 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/HazardProperty.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/HazardProperty.java @@ -1,119 +1,293 @@ package com.gregtechceu.gtceu.api.data.chemical.material.properties; +import com.gregtechceu.gtceu.api.data.chemical.ChemicalHelper; +import com.gregtechceu.gtceu.api.data.chemical.material.Material; +import com.gregtechceu.gtceu.api.data.chemical.material.stack.UnificationEntry; import com.gregtechceu.gtceu.api.data.tag.TagPrefix; - +import com.gregtechceu.gtceu.api.item.TagPrefixItem; import com.gregtechceu.gtceu.api.item.armor.ArmorComponentItem; +import com.gregtechceu.gtceu.api.item.forge.GTBucketItem; +import com.gregtechceu.gtceu.common.data.GTMobEffects; +import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.data.recipe.CustomTags; -import lombok.Getter; -import net.minecraft.world.effect.MobEffect; + +import net.minecraft.util.StringRepresentable; import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.ai.attributes.Attribute; +import net.minecraft.world.entity.ai.attributes.AttributeModifier; +import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.item.ArmorItem; +import net.minecraft.world.item.BucketItem; import net.minecraft.world.item.ItemStack; + +import it.unimi.dsi.fastutil.objects.Object2ObjectMaps; +import lombok.Getter; import org.jetbrains.annotations.Nullable; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; +import java.util.*; +import java.util.function.Supplier; /** * @author h3tR * @date 2024/2/12 * @implNote HazardProperty */ -public class HazardProperty implements IMaterialProperty{ +public class HazardProperty implements IMaterialProperty { + + public static final UUID HAZARD_MAX_HEALTH_UUID = UUID.fromString("607aa6d9-a7e4-4919-9962-f007104c4be8"); + public static final String HAZARD_MAX_HEALTH_KEY = "gtceu.hazard.max_health"; @Getter @Nullable private final HazardProperty.HazardDamage damage; - @Getter - @Nullable - private final HazardProperty.HazardEffect effect; - + private final List effects = new ArrayList<>(); @Getter private final HazardType hazardType; - @Getter private final boolean applyToDerivatives; - - - public HazardProperty(HazardType hazardType, @Nullable HazardProperty.HazardEffect effect, @Nullable HazardProperty.HazardDamage damage, boolean applyToDerivatives) { - this.damage = damage; + public HazardProperty(HazardType hazardType, @Nullable HazardProperty.HazardEffect effect, + @Nullable HazardProperty.HazardDamage damage, boolean applyToDerivatives) { this.hazardType = hazardType; + this.effects.add(effect); + this.damage = damage; this.applyToDerivatives = applyToDerivatives; - this.effect = effect; } - /** - * Default property constructor. - */ - public HazardProperty(){ - this(HazardType.CONTACT_POISON,null,null,false); + public HazardProperty(HazardType hazardType, List effects, + @Nullable HazardProperty.HazardDamage damage, boolean applyToDerivatives) { + this.hazardType = hazardType; + this.effects.addAll(effects); + this.damage = damage; + this.applyToDerivatives = applyToDerivatives; } @Override - public void verifyProperty(MaterialProperties properties) { - } + public void verifyProperty(MaterialProperties properties) {} - public enum HazardType { - INHALATION_POISON(ProtectionType.MASK, TagPrefix.dust,TagPrefix.dustImpure,TagPrefix.dustSmall,TagPrefix.dustPure,TagPrefix.dustTiny,TagPrefix.rawOre,TagPrefix.rawOreBlock,TagPrefix.crushed,TagPrefix.crushedRefined,TagPrefix.crushedPurified), - CONTACT_POISON(ProtectionType.FULL), - RADIOACTIVE(ProtectionType.FULL), - CORROSIVE(ProtectionType.HANDS,TagPrefix.dust,TagPrefix.dustSmall,TagPrefix.dustTiny), - NONE(ProtectionType.FULL); + public record HazardType(String name, ProtectionType protectionType, Set affectedTagPrefixes) + implements StringRepresentable { - private final List affectedTagPrefixes = new ArrayList<>(); + public static final Map ALL_HAZARDS = new HashMap<>(); - @Getter - private final ProtectionType protectionType; - HazardType(ProtectionType protectionType, TagPrefix... tagPrefixes){ - this.protectionType = protectionType; - affectedTagPrefixes.addAll(Arrays.asList(tagPrefixes)); + public static final HazardType INHALATION_POISON = new HazardType("inhalation_poison", ProtectionType.MASK, + TagPrefix.dust, TagPrefix.dustSmall, TagPrefix.dustTiny, TagPrefix.dustPure, TagPrefix.dustImpure); + public static final HazardType CONTACT_POISON = new HazardType("contacy_poison", ProtectionType.FULL); + public static final HazardType RADIOACTIVE = new HazardType("radioactive", ProtectionType.FULL); + public static final HazardType CORROSIVE = new HazardType("corrosive", ProtectionType.HANDS, + TagPrefix.dust, TagPrefix.dustSmall, TagPrefix.dustTiny); + public static final HazardType NONE = new HazardType("none", ProtectionType.NONE); + + public HazardType { + ALL_HAZARDS.put(name, this); } + public HazardType(String name, ProtectionType protectionType, TagPrefix... tagPrefixes) { + this(name, protectionType, new HashSet<>()); + affectedTagPrefixes.addAll(Arrays.asList(tagPrefixes)); + } - public boolean isAffected(TagPrefix prefix){ - if(affectedTagPrefixes.isEmpty()) return true; //empty list means all prefixes are affected + public boolean isAffected(TagPrefix prefix) { + if (affectedTagPrefixes.isEmpty()) return true; // empty list means all prefixes are affected return affectedTagPrefixes.contains(prefix); } + + @Override + public String getSerializedName() { + return this.name; + } } - public enum ProtectionType{ + public enum ProtectionType { + MASK(ArmorItem.Type.HELMET), HANDS(ArmorItem.Type.CHESTPLATE), + FULL(ArmorItem.Type.BOOTS, ArmorItem.Type.HELMET, ArmorItem.Type.CHESTPLATE, ArmorItem.Type.LEGGINGS), + NONE(); - FULL(ArmorItem.Type.BOOTS, ArmorItem.Type.HELMET, ArmorItem.Type.CHESTPLATE, ArmorItem.Type.LEGGINGS); - private final List equipmentTypes; - ProtectionType(ArmorItem.Type... equipmentTypes){ - this.equipmentTypes = List.of(equipmentTypes); + @Getter + private final Set equipmentTypes; + + ProtectionType(ArmorItem.Type... equipmentTypes) { + this.equipmentTypes = Set.of(equipmentTypes); } - public boolean isProtected(LivingEntity livingEntity){ - List correctArmorItems = new ArrayList<>(); - for (ArmorItem.Type equipmentType: equipmentTypes) { + public boolean isProtected(LivingEntity livingEntity) { + if (this == NONE) { + return true; + } + Set correctArmorItems = new HashSet<>(); + for (ArmorItem.Type equipmentType : equipmentTypes) { ItemStack armor = livingEntity.getItemBySlot(equipmentType.getSlot()); - if(!armor.isEmpty() && ((armor.getItem() instanceof ArmorComponentItem armorItem && armorItem.getArmorLogic().isPPE()) || armor.getTags().anyMatch(tag -> tag.equals(CustomTags.PPE_ARMOR)))){ + if (!armor.isEmpty() && ((armor.getItem() instanceof ArmorComponentItem armorItem && + armorItem.getArmorLogic().isPPE()) || + armor.getTags().anyMatch(tag -> tag.equals(CustomTags.PPE_ARMOR)))) { correctArmorItems.add(equipmentType); } } - return new HashSet<>(correctArmorItems).containsAll(equipmentTypes); + return correctArmorItems.containsAll(equipmentTypes); + } + } + + public static HazardProperty.HazardEffect maxHealthLoweringEffect(int secondsToMax, int startTime, int modifier) { + return new HazardProperty.HazardEffect(secondsToMax, startTime, + Map.of(Attributes.MAX_HEALTH, new AttributeModifier(HazardProperty.HAZARD_MAX_HEALTH_UUID, + HazardProperty.HAZARD_MAX_HEALTH_KEY, -modifier, AttributeModifier.Operation.ADDITION))); + } + + public static HazardProperty.HazardEffect maxAirLoweringEffect(int secondsToMax, int startTime, + int newMaxAirSupply) { + return new HazardProperty.HazardEffect(secondsToMax, startTime, newMaxAirSupply); + } + + public static HazardProperty.HazardEffect witherEffect(int duration, int startTime, int amplifier) { + return new HazardProperty.HazardEffect(duration, startTime, + () -> new MobEffectInstance(MobEffects.WITHER, 1, amplifier)); + } + + public static HazardProperty.HazardEffect slownessEffect(int duration, int startTime, int amplifier) { + return new HazardProperty.HazardEffect(duration, startTime, + () -> new MobEffectInstance(MobEffects.MOVEMENT_SLOWDOWN, 1, amplifier)); + } + + public static HazardProperty.HazardEffect miningFautigueEffect(int duration, int startTime, int amplifier) { + return new HazardProperty.HazardEffect(duration, startTime, + () -> new MobEffectInstance(MobEffects.DIG_SLOWDOWN, 1, amplifier)); + } + + public static HazardProperty.HazardEffect poisonEffect(int duration, int startTime, int amplifier) { + return new HazardProperty.HazardEffect(duration, startTime, + () -> new MobEffectInstance(GTMobEffects.WEAK_POISON.get(), 1, amplifier)); + } + + public static HazardProperty.HazardEffect weaknessEffect(int duration, int startTime, int amplifier) { + return new HazardProperty.HazardEffect(duration, startTime, + () -> new MobEffectInstance(MobEffects.WEAKNESS, 1, amplifier)); + } + + public static HazardProperty.HazardEffect blindnessEffect(int duration, int startTime, int amplifier) { + return new HazardProperty.HazardEffect(duration, startTime, + () -> new MobEffectInstance(MobEffects.BLINDNESS, 1, amplifier)); + } + + @Nullable + public static Material getValidHazardMaterial(ItemStack item) { + Material material = null; + TagPrefix prefix = null; + boolean isFluid = false; + if (item.getItem() instanceof TagPrefixItem prefixItem) { + material = prefixItem.material; + prefix = prefixItem.tagPrefix; + } else if (item.getItem() instanceof BucketItem bucket) { + if (ConfigHolder.INSTANCE.gameplay.universalHazards || bucket instanceof GTBucketItem) { + material = ChemicalHelper.getMaterial(bucket.getFluid()); + isFluid = true; + } + } else if (ConfigHolder.INSTANCE.gameplay.universalHazards) { + UnificationEntry entry = ChemicalHelper.getUnificationEntry(item.getItem()); + if (entry != null && entry.material != null) { + material = entry.material; + prefix = entry.tagPrefix; + } + } + if (material == null) { + return null; + } + HazardProperty property = material.getProperty(PropertyKey.HAZARD); + if (property == null) { + return null; } + if (!isFluid && !property.getHazardType().isAffected(prefix)) { + return null; + } + return material; } /** - * @param delay damage is applied every X seconds + * @param damage amount of damage applied every {@code delay} seconds. + * @param delay damage is applied every {@code delay} seconds + */ + public record HazardDamage(int damage, int delay) {} + + /** + * A group of effects applied by a hazard. + * + * @param duration if this is a potion effect, the time (in ticks) the effect has. else it's the ramp-up + * time (in ticks) for the attribute modifiers. + * @param modifierStartTime the time (in seconds) before the modifier is applied at all. + * @param effects the mob effects, if any. + * @param modifiers the attribute modifiers, if any. */ - public record HazardDamage(int damage, int delay){} - public record HazardEffect(int duration, MobEffect... effects){ - public void apply(LivingEntity entity) { - for(MobEffect effect: effects) - entity.addEffect(new MobEffectInstance(effect,duration)); + public record HazardEffect(int duration, int modifierStartTime, List> effects, + Map modifiers, int newMaxAirSupply) { + @SafeVarargs + public HazardEffect(int duration, Supplier... effects) { + this(duration, 0, Arrays.stream(effects).toList(), Object2ObjectMaps.emptyMap(), -1); } - } + @SafeVarargs + public HazardEffect(int duration, int modifierStartTime, Supplier... effects) { + this(duration, modifierStartTime, Arrays.stream(effects).toList(), Object2ObjectMaps.emptyMap(), -1); + } + public HazardEffect(int secondsToMax, Map modifiers) { + this(secondsToMax, 0, List.of(), modifiers, -1); + } + + public HazardEffect(int secondsToMax, int modifierStartTime, Map modifiers) { + this(secondsToMax, modifierStartTime, List.of(), modifiers, -1); + } + + public HazardEffect(int secondsToMax, Map modifiers, int maxAirModifier) { + this(secondsToMax, 0, List.of(), modifiers, maxAirModifier); + } + + public HazardEffect(int secondsToMax, int maxAirModifier) { + this(secondsToMax, 0, List.of(), Object2ObjectMaps.emptyMap(), maxAirModifier); + } + + public HazardEffect(int secondsToMax, int modifierStartTime, int maxAirModifier) { + this(secondsToMax, modifierStartTime, List.of(), Object2ObjectMaps.emptyMap(), maxAirModifier); + } + + public List getEffectInstancesAtTime(int timeFromStart) { + if (this.effects.isEmpty()) { + return List.of(); + } + List effectInstances = new ArrayList<>(); + for (Supplier effectSupplier : effects) { + MobEffectInstance effect = effectSupplier.get(); + // the effects get stronger the longer you hold the item. + int effectDuration = duration == -1 ? -1 : effect.getDuration() * duration * timeFromStart / 500; + int effectAmplifier = effect.getAmplifier() * timeFromStart / 1000; + effectInstances.add(new MobEffectInstance(effect.getEffect(), effectDuration, effectAmplifier)); + } + return effectInstances; + } + + public Map getModifiersAtTime(int timeFromStart) { + if (this.modifiers.isEmpty()) { + return Object2ObjectMaps.emptyMap(); + } + Map modifierMap = new HashMap<>(); + for (var entry : this.modifiers.entrySet()) { + AttributeModifier modifier = entry.getValue(); + double amount = modifier.getAmount() * (double) timeFromStart / Math.max(duration, 1); + modifierMap.put(entry.getKey(), + new AttributeModifier(modifier.getId(), modifier.getName(), amount, modifier.getOperation())); + } + return modifierMap; + } + + public int getNewMaxAirSupplyAtTime(int timeFromStart) { + if (newMaxAirSupply == -1) { + return -1; + } + return newMaxAirSupply / Math.max(Math.round((float) timeFromStart / Math.max(duration, 1)), 1); + } + } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/IngotProperty.java b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/IngotProperty.java index 5132ecc2e2..d7d1be9b70 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/IngotProperty.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/IngotProperty.java @@ -1,9 +1,9 @@ package com.gregtechceu.gtceu.api.data.chemical.material.properties; import com.gregtechceu.gtceu.api.data.chemical.material.Material; + import lombok.Getter; import lombok.Setter; - import org.jetbrains.annotations.Nullable; public class IngotProperty implements IMaterialProperty { @@ -11,13 +11,15 @@ public class IngotProperty implements IMaterialProperty { /** * Specifies a material into which this material parts turn when heated */ - @Getter @Setter + @Getter + @Setter private Material smeltingInto; /** * Specifies a material into which this material parts turn when heated in arc furnace */ - @Getter @Setter + @Getter + @Setter private Material arcSmeltingInto; /** @@ -25,14 +27,16 @@ public class IngotProperty implements IMaterialProperty { *

* Default: this Material. */ - @Getter @Setter + @Getter + @Setter private Material macerateInto; /** * Material which obtained when this material is polarized */ @Nullable - @Getter @Setter + @Getter + @Setter private Material magneticMaterial; @Override diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/MaterialProperties.java b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/MaterialProperties.java index ab05e8c632..759fe54781 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/MaterialProperties.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/MaterialProperties.java @@ -2,6 +2,7 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.data.chemical.material.Material; + import com.lowdragmc.lowdraglib.Platform; import java.util.*; @@ -10,8 +11,7 @@ public class MaterialProperties { private static final Set> baseTypes = new HashSet<>(Arrays.asList( PropertyKey.FLUID, PropertyKey.DUST, - PropertyKey.INGOT, PropertyKey.GEM, PropertyKey.EMPTY - )); + PropertyKey.INGOT, PropertyKey.GEM, PropertyKey.EMPTY)); @SuppressWarnings("unused") public static void addBaseType(PropertyKey baseTypeKey) { @@ -49,7 +49,7 @@ public > void removeProperty(PropertyKey prope if (!hasProperty(property)) throw new IllegalArgumentException("Material Property " + property.toString() + " not present!"); propertyMap.remove(property); - if(propertyMap.isEmpty()) + if (propertyMap.isEmpty()) propertyMap.put(PropertyKey.EMPTY, PropertyKey.EMPTY.constructDefault()); } @@ -78,7 +78,8 @@ public void verify() { GTCEu.LOGGER.debug("Creating empty placeholder Material {}", material); } propertyMap.put(PropertyKey.EMPTY, PropertyKey.EMPTY.constructDefault()); - } else throw new IllegalArgumentException("Material must have at least one of: " + baseTypes + " specified!"); + } else + throw new IllegalArgumentException("Material must have at least one of: " + baseTypes + " specified!"); } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/OreProperty.java b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/OreProperty.java index 5df6ee22e8..1f6c014511 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/OreProperty.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/OreProperty.java @@ -1,13 +1,15 @@ package com.gregtechceu.gtceu.api.data.chemical.material.properties; import com.gregtechceu.gtceu.api.data.chemical.material.Material; + +import net.minecraft.util.Mth; + import com.mojang.datafixers.util.Pair; import lombok.Getter; import lombok.Setter; -import net.minecraft.util.Mth; import org.jetbrains.annotations.NotNull; - import org.jetbrains.annotations.Nullable; + import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -27,7 +29,8 @@ public class OreProperty implements IMaterialProperty { *

* Default: 1 (no multiplier). */ - @Getter @Setter + @Getter + @Setter private int oreMultiplier; /** @@ -35,7 +38,8 @@ public class OreProperty implements IMaterialProperty { *

* Default: 1 (no multiplier). */ - @Getter @Setter + @Getter + @Setter private int byProductMultiplier; /** @@ -43,7 +47,8 @@ public class OreProperty implements IMaterialProperty { *

* Default: false. */ - @Getter @Setter + @Getter + @Setter private boolean emissive; /** @@ -52,7 +57,8 @@ public class OreProperty implements IMaterialProperty { * Material will have a Dust Property. * Default: none. */ - @Getter @Setter + @Getter + @Setter @Nullable private Material directSmeltResult; diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/PolymerProperty.java b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/PolymerProperty.java index 92b5fd1d5e..d1b27f118b 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/PolymerProperty.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/PolymerProperty.java @@ -2,17 +2,15 @@ import com.gregtechceu.gtceu.api.data.chemical.material.info.MaterialFlags; -public class PolymerProperty implements IMaterialProperty{ - +public class PolymerProperty implements IMaterialProperty { @Override public void verifyProperty(MaterialProperties properties) { - properties.ensureSet(PropertyKey.DUST, true); properties.ensureSet(PropertyKey.INGOT, true); properties.ensureSet(PropertyKey.FLUID, true); - properties.getMaterial().addFlags(MaterialFlags.FLAMMABLE, MaterialFlags.NO_SMASHING, MaterialFlags.DISABLE_DECOMPOSITION); - + properties.getMaterial().addFlags(MaterialFlags.FLAMMABLE, MaterialFlags.NO_SMASHING, + MaterialFlags.DISABLE_DECOMPOSITION); } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/PropertyKey.java b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/PropertyKey.java index 5767efb9dd..90fb77da86 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/PropertyKey.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/PropertyKey.java @@ -3,14 +3,17 @@ public class PropertyKey> { public static final PropertyKey BLAST = new PropertyKey<>("blast", BlastProperty.class); - public static final PropertyKey ALLOY_BLAST = new PropertyKey<>("blast_alloy", AlloyBlastProperty.class); + public static final PropertyKey ALLOY_BLAST = new PropertyKey<>("blast_alloy", + AlloyBlastProperty.class); public static final PropertyKey DUST = new PropertyKey<>("dust", DustProperty.class); - public static final PropertyKey FLUID_PIPE = new PropertyKey<>("fluid_pipe", FluidPipeProperties.class); + public static final PropertyKey FLUID_PIPE = new PropertyKey<>("fluid_pipe", + FluidPipeProperties.class); public static final PropertyKey FLUID = new PropertyKey<>("fluid", FluidProperty.class); public static final PropertyKey GEM = new PropertyKey<>("gem", GemProperty.class); public static final PropertyKey INGOT = new PropertyKey<>("ingot", IngotProperty.class); public static final PropertyKey POLYMER = new PropertyKey<>("polymer", PolymerProperty.class); - public static final PropertyKey ITEM_PIPE = new PropertyKey<>("item_pipe", ItemPipeProperties.class); + public static final PropertyKey ITEM_PIPE = new PropertyKey<>("item_pipe", + ItemPipeProperties.class); public static final PropertyKey ORE = new PropertyKey<>("ore", OreProperty.class); public static final PropertyKey TOOL = new PropertyKey<>("tool", ToolProperty.class); public static final PropertyKey ROTOR = new PropertyKey<>("rotor", RotorProperty.class); diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/ToolProperty.java b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/ToolProperty.java index ab6de713f4..3d5c5e5f46 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/ToolProperty.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/ToolProperty.java @@ -1,13 +1,15 @@ package com.gregtechceu.gtceu.api.data.chemical.material.properties; +import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.api.item.tool.GTToolType; import com.gregtechceu.gtceu.api.item.tool.MaterialToolTier; -import com.gregtechceu.gtceu.api.data.chemical.material.Material; + +import net.minecraft.world.item.enchantment.Enchantment; + import it.unimi.dsi.fastutil.objects.Object2IntArrayMap; import it.unimi.dsi.fastutil.objects.Object2IntMap; import lombok.Getter; import lombok.Setter; -import net.minecraft.world.item.enchantment.Enchantment; import org.apache.commons.lang3.ArrayUtils; import java.util.Arrays; @@ -158,7 +160,8 @@ public ToolProperty addTypes(GTToolType... types) { } public ToolProperty removeTypes(GTToolType... types) { - this.types = Arrays.stream(this.types).filter(type -> !ArrayUtils.contains(types, type)).toArray(GTToolType[]::new); + this.types = Arrays.stream(this.types).filter(type -> !ArrayUtils.contains(types, type)) + .toArray(GTToolType[]::new); return this; } @@ -167,7 +170,7 @@ public static class Builder { private final ToolProperty toolProperty; public static Builder of(float harvestSpeed, float attackDamage, int durability, int harvestLevel) { - return new Builder(harvestSpeed, attackDamage, durability, harvestLevel, new GTToolType[]{ + return new Builder(harvestSpeed, attackDamage, durability, harvestLevel, new GTToolType[] { SWORD, PICKAXE, SHOVEL, @@ -177,17 +180,17 @@ public static Builder of(float harvestSpeed, float attackDamage, int durability, SPADE, SAW, HARD_HAMMER, -// SOFT_MALLET, + // SOFT_MALLET, WRENCH, FILE, CROWBAR, SCREWDRIVER, -// MORTAR, + // MORTAR, WIRE_CUTTER, SCYTHE, KNIFE, BUTCHERY_KNIFE, -// PLUNGER, + // PLUNGER, DRILL_LV, DRILL_MV, DRILL_HV, @@ -202,7 +205,8 @@ public static Builder of(float harvestSpeed, float attackDamage, int durability, }); } - public static Builder of(float harvestSpeed, float attackDamage, int durability, int harvestLevel, GTToolType... types) { + public static Builder of(float harvestSpeed, float attackDamage, int durability, int harvestLevel, + GTToolType... types) { return new Builder(harvestSpeed, attackDamage, durability, harvestLevel, types); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/WireProperties.java b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/WireProperties.java index 46ef79a107..cdef8fa281 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/WireProperties.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/properties/WireProperties.java @@ -1,6 +1,5 @@ package com.gregtechceu.gtceu.api.data.chemical.material.properties; - import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.data.chemical.material.Material; @@ -24,7 +23,8 @@ public WireProperties(int voltage, int baseAmperage, int lossPerBlock, boolean i this(voltage, baseAmperage, lossPerBlock, isSuperCon, 0); } - public WireProperties(int voltage, int baseAmperage, int lossPerBlock, boolean isSuperCon, int criticalTemperature) { + public WireProperties(int voltage, int baseAmperage, int lossPerBlock, boolean isSuperCon, + int criticalTemperature) { this.voltage = voltage; this.amperage = baseAmperage; this.lossPerBlock = isSuperCon ? 0 : lossPerBlock; @@ -116,11 +116,12 @@ public void setSuperconductor(boolean isSuperconductor) { } /** - * Retrieves the critical temperature of the superconductor (the temperature at which the superconductive phase transition happens) + * Retrieves the critical temperature of the superconductor (the temperature at which the superconductive phase + * transition happens) * * @return Critical temperature of the material */ - public int getSuperconductorCriticalTemperature(){ + public int getSuperconductorCriticalTemperature() { return superconductorCriticalTemperature; } @@ -129,7 +130,7 @@ public int getSuperconductorCriticalTemperature(){ * * @param criticalTemperature The new critical temperature */ - public void setSuperconductorCriticalTemperature(int criticalTemperature){ + public void setSuperconductorCriticalTemperature(int criticalTemperature) { this.superconductorCriticalTemperature = this.isSuperconductor ? criticalTemperature : 0; } diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/registry/MaterialRegistry.java b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/registry/MaterialRegistry.java index 23b4908e48..25e4d6a59d 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/registry/MaterialRegistry.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/registry/MaterialRegistry.java @@ -7,8 +7,10 @@ import com.gregtechceu.gtceu.api.registry.GTRegistry; import com.gregtechceu.gtceu.api.registry.registrate.GTRegistrate; import com.gregtechceu.gtceu.common.registry.GTRegistration; -import lombok.Getter; + import net.minecraft.resources.ResourceLocation; + +import lombok.Getter; import org.jetbrains.annotations.NotNull; import java.util.Collection; @@ -21,7 +23,8 @@ public abstract class MaterialRegistry extends GTRegistry.String { public MaterialRegistry(java.lang.String modId) { super(new ResourceLocation(modId, "material")); IGTAddon addon = AddonFinder.getAddon(modId); - this.registrate = addon != null ? addon.getRegistrate() : GTCEu.MOD_ID.equals(modId) ? GTRegistration.REGISTRATE : GTRegistrate.create(modId); + this.registrate = addon != null ? addon.getRegistrate() : + GTCEu.MOD_ID.equals(modId) ? GTRegistration.REGISTRATE : GTRegistrate.create(modId); } public abstract void register(Material material); @@ -52,4 +55,4 @@ public MaterialRegistry(java.lang.String modId) { @NotNull public abstract java.lang.String getModid(); -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/stack/ItemMaterialInfo.java b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/stack/ItemMaterialInfo.java index dd244c891c..d388f25739 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/stack/ItemMaterialInfo.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/stack/ItemMaterialInfo.java @@ -50,5 +50,4 @@ public int hashCode() { public String toString() { return materials.size() == 0 ? "" : materials.get(0).material().toCamelCaseString(); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/stack/MaterialStack.java b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/stack/MaterialStack.java index 9d1201f097..75277d572c 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/stack/MaterialStack.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/stack/MaterialStack.java @@ -8,6 +8,7 @@ import java.util.WeakHashMap; public record MaterialStack(Material material, long amount) { + private static final Map PARSE_CACHE = new WeakHashMap<>(); public MaterialStack copy(long amount) { @@ -76,5 +77,4 @@ public String toString() { } return string; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/stack/UnificationEntry.java b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/stack/UnificationEntry.java index 013d8a6d6c..4aadc9675b 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/stack/UnificationEntry.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/chemical/material/stack/UnificationEntry.java @@ -4,6 +4,7 @@ import com.gregtechceu.gtceu.api.data.tag.TagPrefix; import org.jetbrains.annotations.Nullable; + import java.util.Objects; public class UnificationEntry { @@ -35,17 +36,18 @@ public boolean equals(Object o) { @Override public int hashCode() { - int result = tagPrefix.hashCode(); + int result = (tagPrefix != null ? tagPrefix.hashCode() : 0); result = 31 * result + (material != null ? material.hashCode() : 0); return result; } @Override public String toString() { - return tagPrefix.name + (material != null ? material.toCamelCaseString() : ""); + return (tagPrefix != null ? tagPrefix.name : "") + (material != null ? material.toCamelCaseString() : ""); } public static final UnificationEntry EmptyMapMarkerEntry = new UnificationEntry(null) { + @Override public boolean equals(Object o) { return this == o; @@ -61,5 +63,4 @@ public String toString() { return "EMPTY UNIFICATION ENTRY"; } }; - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/damagesource/DamageTypeData.java b/src/main/java/com/gregtechceu/gtceu/api/data/damagesource/DamageTypeData.java index 23e7b649ba..8964461237 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/damagesource/DamageTypeData.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/damagesource/DamageTypeData.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.api.data.damagesource; import com.gregtechceu.gtceu.GTCEu; + import net.minecraft.core.Holder; import net.minecraft.core.Registry; import net.minecraft.core.registries.Registries; @@ -14,6 +15,7 @@ import net.minecraft.world.level.LevelAccessor; import org.jetbrains.annotations.Nullable; + import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -22,11 +24,13 @@ /** * An extension of {@link DamageType} that contains extra data, functionality, and utility. + * * @see DamageType * @see DamageSource * @see DamageSources */ public class DamageTypeData { + private static final List ALL = new ArrayList<>(); public final ResourceKey key; @@ -36,7 +40,6 @@ public class DamageTypeData { private Holder holder; - protected DamageTypeData(ResourceKey key, DamageType type, Collection> tags) { this.key = key; this.id = key.location(); @@ -85,6 +88,7 @@ public static DamageTypeData.Builder builder() { } public static class Builder { + // required private String msgId; private ResourceLocation location; @@ -131,7 +135,8 @@ public DamageTypeData.Builder msgId(String msgId) { } /** - * Set the exhaustion of this type. This is the amount of hunger that will be consumed when an entity is damaged. + * Set the exhaustion of this type. This is the amount of hunger that will be consumed when an entity is + * damaged. */ public DamageTypeData.Builder exhaustion(float exhaustion) { this.exhaustion = exhaustion; @@ -157,9 +162,10 @@ public DamageTypeData.Builder effects(DamageEffects effects) { /** * Set the death message type of this damage type. This determines how a death message lang key is assembled. *

    - *
  • {@link DeathMessageType#DEFAULT}: {@link DamageSource#getLocalizedDeathMessage}
  • - *
  • {@link DeathMessageType#FALL_VARIANTS}: {@link CombatTracker#getFallMessage(CombatEntry, Entity)}
  • - *
  • {@link DeathMessageType#INTENTIONAL_GAME_DESIGN}: "death.attack." + msgId, wrapped in brackets, linking to MCPE-28723
  • + *
  • {@link DeathMessageType#DEFAULT}: {@link DamageSource#getLocalizedDeathMessage}
  • + *
  • {@link DeathMessageType#FALL_VARIANTS}: {@link CombatTracker#getFallMessage(CombatEntry, Entity)}
  • + *
  • {@link DeathMessageType#INTENTIONAL_GAME_DESIGN}: "death.attack." + msgId, wrapped in brackets, linking + * to MCPE-28723
  • *
*/ @SuppressWarnings("JavadocReference") @@ -185,8 +191,7 @@ public DamageTypeData build() { DamageTypeData data = new DamageTypeData( ResourceKey.create(Registries.DAMAGE_TYPE, location), new DamageType(msgId, scaling, exhaustion, effects, deathMessageType), - tags - ); + tags); ALL.add(data); return data; } diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/tag/TagPrefix.java b/src/main/java/com/gregtechceu/gtceu/api/data/tag/TagPrefix.java index 4b4555a3a2..5cbc4843fa 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/tag/TagPrefix.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/tag/TagPrefix.java @@ -1,7 +1,5 @@ package com.gregtechceu.gtceu.api.data.tag; -import com.google.common.base.Preconditions; -import com.google.common.collect.Table; import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.GTCEuAPI; import com.gregtechceu.gtceu.api.GTValues; @@ -23,15 +21,9 @@ import com.gregtechceu.gtceu.integration.kjs.GTRegistryInfo; import com.gregtechceu.gtceu.utils.FormattingUtil; import com.gregtechceu.gtceu.utils.SupplierMemoizer; + import com.lowdragmc.lowdraglib.utils.LocalizationUtils; -import com.mojang.serialization.Codec; -import com.mojang.serialization.DataResult; -import it.unimi.dsi.fastutil.objects.Object2FloatMap; -import it.unimi.dsi.fastutil.objects.Object2FloatOpenHashMap; -import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap; -import lombok.Getter; -import lombok.Setter; -import lombok.experimental.Accessors; + import net.minecraft.client.renderer.RenderType; import net.minecraft.core.registries.Registries; import net.minecraft.data.recipes.FinishedRecipe; @@ -49,9 +41,20 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.NoteBlockInstrument; import net.minecraft.world.level.material.MapColor; -import org.jetbrains.annotations.NotNull; +import com.google.common.base.Preconditions; +import com.google.common.collect.Table; +import com.mojang.serialization.Codec; +import com.mojang.serialization.DataResult; +import it.unimi.dsi.fastutil.objects.Object2FloatMap; +import it.unimi.dsi.fastutil.objects.Object2FloatOpenHashMap; +import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; + import java.util.*; import java.util.function.*; @@ -64,7 +67,10 @@ public class TagPrefix { public final static Map PREFIXES = new HashMap<>(); public static final Map ORES = new Object2ObjectLinkedOpenHashMap<>(); - public static final Codec CODEC = Codec.STRING.flatXmap(str -> Optional.ofNullable(get(str)).map(DataResult::success).orElseGet(() -> DataResult.error(() -> "invalid TagPrefix: " + str)), prefix -> DataResult.success(prefix.name)); + public static final Codec CODEC = Codec.STRING.flatXmap( + str -> Optional.ofNullable(get(str)).map(DataResult::success) + .orElseGet(() -> DataResult.error(() -> "invalid TagPrefix: " + str)), + prefix -> DataResult.success(prefix.name)); public static void init() { AddonFinder.getAddons().forEach(IGTAddon::registerTagPrefixes); @@ -79,59 +85,112 @@ public static TagPrefix get(String name) { public static final TagPrefix ore = oreTagPrefix("stone", BlockTags.MINEABLE_WITH_PICKAXE) .langValue("%s Ore") - .registerOre(Blocks.STONE::defaultBlockState, () -> GTMaterials.Stone, BlockBehaviour.Properties.of().mapColor(MapColor.STONE).requiresCorrectToolForDrops().strength(3.0F, 3.0F), new ResourceLocation("block/stone"), false, false, true); + .registerOre( + Blocks.STONE::defaultBlockState, () -> GTMaterials.Stone, BlockBehaviour.Properties.of() + .mapColor(MapColor.STONE).requiresCorrectToolForDrops().strength(3.0F, 3.0F), + new ResourceLocation("block/stone"), false, false, true); public static final TagPrefix oreGranite = oreTagPrefix("granite", BlockTags.MINEABLE_WITH_PICKAXE) .langValue("Granite %s Ore") - .registerOre(Blocks.GRANITE::defaultBlockState, () -> GTMaterials.Granite, BlockBehaviour.Properties.of().mapColor(MapColor.DIRT).requiresCorrectToolForDrops().strength(3.0F, 3.0F), new ResourceLocation("block/granite")); + .registerOre( + Blocks.GRANITE::defaultBlockState, () -> GTMaterials.Granite, BlockBehaviour.Properties.of() + .mapColor(MapColor.DIRT).requiresCorrectToolForDrops().strength(3.0F, 3.0F), + new ResourceLocation("block/granite")); public static final TagPrefix oreDiorite = oreTagPrefix("diorite", BlockTags.MINEABLE_WITH_PICKAXE) .langValue("Diorite %s Ore") - .registerOre(Blocks.DIORITE::defaultBlockState, () -> GTMaterials.Diorite, BlockBehaviour.Properties.of().mapColor(MapColor.QUARTZ).requiresCorrectToolForDrops().strength(3.0F, 3.0F), new ResourceLocation("block/diorite")); + .registerOre( + Blocks.DIORITE::defaultBlockState, () -> GTMaterials.Diorite, BlockBehaviour.Properties.of() + .mapColor(MapColor.QUARTZ).requiresCorrectToolForDrops().strength(3.0F, 3.0F), + new ResourceLocation("block/diorite")); public static final TagPrefix oreAndesite = oreTagPrefix("andesite", BlockTags.MINEABLE_WITH_PICKAXE) .langValue("Andesite %s Ore") - .registerOre(Blocks.ANDESITE::defaultBlockState, () -> GTMaterials.Andesite, BlockBehaviour.Properties.of().mapColor(MapColor.DIRT).requiresCorrectToolForDrops().strength(3.0F, 3.0F), new ResourceLocation("block/andesite")); + .registerOre( + Blocks.ANDESITE::defaultBlockState, () -> GTMaterials.Andesite, BlockBehaviour.Properties.of() + .mapColor(MapColor.DIRT).requiresCorrectToolForDrops().strength(3.0F, 3.0F), + new ResourceLocation("block/andesite")); public static final TagPrefix oreRedGranite = oreTagPrefix("red_granite", BlockTags.MINEABLE_WITH_PICKAXE) - .langValue("Red Granite %s Ore") - .registerOre(() -> GTBlocks.RED_GRANITE.getDefaultState(), () -> GTMaterials.GraniteRed, BlockBehaviour.Properties.of().mapColor(MapColor.TERRACOTTA_RED).requiresCorrectToolForDrops().strength(3.0F, 3.0F), GTCEu.id("block/red_granite")); + .langValue("Red Granite %s Ore") + .registerOre(() -> GTBlocks.RED_GRANITE.getDefaultState(), () -> GTMaterials.GraniteRed, + BlockBehaviour.Properties.of().mapColor(MapColor.TERRACOTTA_RED).requiresCorrectToolForDrops() + .strength(3.0F, 3.0F), + GTCEu.id("block/red_granite")); public static final TagPrefix oreMarble = oreTagPrefix("marble", BlockTags.MINEABLE_WITH_PICKAXE) - .langValue("Red Granite %s Ore") - .registerOre(() -> GTBlocks.MARBLE.getDefaultState(), () -> GTMaterials.Marble, BlockBehaviour.Properties.of().mapColor(MapColor.QUARTZ).requiresCorrectToolForDrops().strength(3.0F, 3.0F), GTCEu.id("block/marble")); + .langValue("Red Granite %s Ore") + .registerOre( + () -> GTBlocks.MARBLE.getDefaultState(), () -> GTMaterials.Marble, BlockBehaviour.Properties.of() + .mapColor(MapColor.QUARTZ).requiresCorrectToolForDrops().strength(3.0F, 3.0F), + GTCEu.id("block/marble")); public static final TagPrefix oreDeepslate = oreTagPrefix("deepslate", BlockTags.MINEABLE_WITH_PICKAXE) .langValue("Deepslate %s Ore") - .registerOre(Blocks.DEEPSLATE::defaultBlockState, () -> GTMaterials.Deepslate, BlockBehaviour.Properties.of().mapColor(MapColor.DEEPSLATE).requiresCorrectToolForDrops().strength(4.5F, 3.0F), new ResourceLocation("block/deepslate"), false, false, true); + .registerOre( + Blocks.DEEPSLATE::defaultBlockState, () -> GTMaterials.Deepslate, BlockBehaviour.Properties.of() + .mapColor(MapColor.DEEPSLATE).requiresCorrectToolForDrops().strength(4.5F, 3.0F), + new ResourceLocation("block/deepslate"), false, false, true); + // TODO figure out a composition for tuff public static final TagPrefix oreTuff = oreTagPrefix("tuff", BlockTags.MINEABLE_WITH_PICKAXE) .langValue("Tuff %s Ore") - .registerOre(Blocks.TUFF::defaultBlockState, null, BlockBehaviour.Properties.of().mapColor(MapColor.TERRACOTTA_GRAY).requiresCorrectToolForDrops().strength(3.0F, 3.0F), new ResourceLocation("block/tuff")); + .registerOre( + Blocks.TUFF::defaultBlockState, null, BlockBehaviour.Properties.of() + .mapColor(MapColor.TERRACOTTA_GRAY).requiresCorrectToolForDrops().strength(3.0F, 3.0F), + new ResourceLocation("block/tuff")); public static final TagPrefix oreSand = oreTagPrefix("sand", BlockTags.MINEABLE_WITH_SHOVEL) .langValue("Sand %s Ore") - .registerOre(Blocks.SAND::defaultBlockState, () -> GTMaterials.SiliconDioxide, BlockBehaviour.Properties.of().mapColor(MapColor.SAND).instrument(NoteBlockInstrument.SNARE).strength(0.5F).sound(SoundType.SAND), new ResourceLocation("block/sand"), false, true, false); + .registerOre(Blocks.SAND::defaultBlockState, () -> GTMaterials.SiliconDioxide, + BlockBehaviour.Properties.of().mapColor(MapColor.SAND).instrument(NoteBlockInstrument.SNARE) + .strength(0.5F).sound(SoundType.SAND), + new ResourceLocation("block/sand"), false, true, false); public static final TagPrefix oreRedSand = oreTagPrefix("redSand", BlockTags.MINEABLE_WITH_SHOVEL) .langValue("Red Sand %s Ore") - .registerOre(Blocks.RED_SAND::defaultBlockState, () -> GTMaterials.SiliconDioxide, BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_ORANGE).instrument(NoteBlockInstrument.SNARE).strength(0.5F).sound(SoundType.SAND), new ResourceLocation("block/red_sand"), false, true, false); + .registerOre(Blocks.RED_SAND::defaultBlockState, () -> GTMaterials.SiliconDioxide, + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_ORANGE).instrument(NoteBlockInstrument.SNARE) + .strength(0.5F).sound(SoundType.SAND), + new ResourceLocation("block/red_sand"), false, true, false); public static final TagPrefix oreGravel = oreTagPrefix("gravel", BlockTags.MINEABLE_WITH_SHOVEL) .langValue("Gravel %s Ore") - .registerOre(Blocks.GRAVEL::defaultBlockState, () -> GTMaterials.Flint, BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.SNARE).strength(0.6F).sound(SoundType.GRAVEL), new ResourceLocation("block/gravel"), false, true, false); + .registerOre(Blocks.GRAVEL::defaultBlockState, () -> GTMaterials.Flint, + BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.SNARE) + .strength(0.6F).sound(SoundType.GRAVEL), + new ResourceLocation("block/gravel"), false, true, false); public static final TagPrefix oreBasalt = oreTagPrefix("basalt", BlockTags.MINEABLE_WITH_PICKAXE) .langValue("Basalt %s Ore") - .registerOre(Blocks.BASALT::defaultBlockState, () -> GTMaterials.Basalt, BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BLACK).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(2.5F, 4.2F).sound(SoundType.BASALT), new ResourceLocation("block/basalt"), true); + .registerOre(Blocks.BASALT::defaultBlockState, () -> GTMaterials.Basalt, + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BLACK) + .instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(2.5F, 4.2F) + .sound(SoundType.BASALT), + new ResourceLocation("block/basalt"), true); public static final TagPrefix oreNetherrack = oreTagPrefix("netherrack", BlockTags.MINEABLE_WITH_PICKAXE) .langValue("Nether %s Ore") - .registerOre(Blocks.NETHERRACK::defaultBlockState, () -> GTMaterials.Netherrack, BlockBehaviour.Properties.of().mapColor(MapColor.NETHER).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(3.0F, 3.0F).sound(SoundType.NETHER_ORE), new ResourceLocation("block/netherrack"), true, false, true); + .registerOre(Blocks.NETHERRACK::defaultBlockState, () -> GTMaterials.Netherrack, + BlockBehaviour.Properties.of().mapColor(MapColor.NETHER).instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops().strength(3.0F, 3.0F).sound(SoundType.NETHER_ORE), + new ResourceLocation("block/netherrack"), true, false, true); + + // TODO figure out a composition for blackstone + public static final TagPrefix oreBlackstone = oreTagPrefix("blackstone", BlockTags.MINEABLE_WITH_PICKAXE) + .langValue("Blackstone %s Ore") + .registerOre(Blocks.BLACKSTONE::defaultBlockState, null, + BlockBehaviour.Properties.of().mapColor(MapColor.COLOR_BLACK) + .instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops() + .strength(3.0F, 3.0F), + new ResourceLocation("block/blackstone"), true, false, false); public static final TagPrefix oreEndstone = oreTagPrefix("endstone", BlockTags.MINEABLE_WITH_PICKAXE) .langValue("End %s Ore") - .registerOre(Blocks.END_STONE::defaultBlockState, () -> GTMaterials.Endstone, BlockBehaviour.Properties.of().mapColor(MapColor.SAND).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(4.5F, 9.0F), new ResourceLocation("block/end_stone"), true, false, true); + .registerOre(Blocks.END_STONE::defaultBlockState, () -> GTMaterials.Endstone, + BlockBehaviour.Properties.of().mapColor(MapColor.SAND).instrument(NoteBlockInstrument.BASEDRUM) + .requiresCorrectToolForDrops().strength(4.5F, 9.0F), + new ResourceLocation("block/end_stone"), true, false, true); public static final TagPrefix rawOre = new TagPrefix("raw", true) .idPattern("raw_%s") @@ -194,7 +253,8 @@ public static TagPrefix get(String name) { .materialIconType(MaterialIconType.ingotHot) .unificationEnabled(true) .generateItem(true) - .generationCondition(hasBlastProperty.and(mat -> mat.getProperty(PropertyKey.BLAST).getBlastTemperature() > 1750)); + .generationCondition( + hasBlastProperty.and(mat -> mat.getProperty(PropertyKey.BLAST).getBlastTemperature() > 1750)); // A regular Ingot. public static final TagPrefix ingot = new TagPrefix("ingot") @@ -360,7 +420,8 @@ public static TagPrefix get(String name) { .materialIconType(MaterialIconType.plateDouble) .unificationEnabled(true) .generateItem(true) - .generationCondition(hasIngotProperty.and(mat -> mat.hasFlag(MaterialFlags.GENERATE_PLATE) && !mat.hasFlag(MaterialFlags.NO_SMASHING))); + .generationCondition(hasIngotProperty + .and(mat -> mat.hasFlag(MaterialFlags.GENERATE_PLATE) && !mat.hasFlag(MaterialFlags.NO_SMASHING))); // Regular Plate made of one Ingot/Dust. public static final TagPrefix plate = new TagPrefix("plate") @@ -455,7 +516,8 @@ public static TagPrefix get(String name) { .materialIconType(MaterialIconType.springSmall) .unificationEnabled(true) .generateItem(true) - .generationCondition(mat -> mat.hasFlag(MaterialFlags.GENERATE_SPRING_SMALL) && !mat.hasFlag(MaterialFlags.NO_SMASHING)); + .generationCondition( + mat -> mat.hasFlag(MaterialFlags.GENERATE_SPRING_SMALL) && !mat.hasFlag(MaterialFlags.NO_SMASHING)); // consisting out of 2 Sticks. public static final TagPrefix spring = new TagPrefix("spring") @@ -465,7 +527,8 @@ public static TagPrefix get(String name) { .materialIconType(MaterialIconType.spring) .unificationEnabled(true) .generateItem(true) - .generationCondition(mat -> mat.hasFlag(MaterialFlags.GENERATE_SPRING) && !mat.hasFlag(MaterialFlags.NO_SMASHING)); + .generationCondition( + mat -> mat.hasFlag(MaterialFlags.GENERATE_SPRING) && !mat.hasFlag(MaterialFlags.NO_SMASHING)); // consisting out of 1/8 Ingot or 1/4 Wire. public static final TagPrefix wireFine = new TagPrefix("fineWire") @@ -537,7 +600,8 @@ public static TagPrefix get(String name) { .materialIconType(MaterialIconType.toolHeadBuzzSaw) .unificationEnabled(true) .generateItem(true) - .generationCondition(hasNoCraftingToolProperty.and(mat -> mat.hasFlag(MaterialFlags.GENERATE_PLATE)).and(mat -> mat.getProperty(PropertyKey.TOOL).hasType(GTToolType.BUZZSAW))); + .generationCondition(hasNoCraftingToolProperty.and(mat -> mat.hasFlag(MaterialFlags.GENERATE_PLATE)) + .and(mat -> mat.getProperty(PropertyKey.TOOL).hasType(GTToolType.BUZZSAW))); // made of 1 Ingots. public static final TagPrefix toolHeadScrewdriver = new TagPrefix("screwdriverTip") @@ -548,7 +612,8 @@ public static TagPrefix get(String name) { .materialIconType(MaterialIconType.toolHeadScrewdriver) .unificationEnabled(true) .generateItem(true) - .generationCondition(hasNoCraftingToolProperty.and(mat -> mat.hasFlag(MaterialFlags.GENERATE_LONG_ROD)).and(mat -> mat.getProperty(PropertyKey.TOOL).hasType(GTToolType.SCREWDRIVER_LV))); + .generationCondition(hasNoCraftingToolProperty.and(mat -> mat.hasFlag(MaterialFlags.GENERATE_LONG_ROD)) + .and(mat -> mat.getProperty(PropertyKey.TOOL).hasType(GTToolType.SCREWDRIVER_LV))); // made of 4 Ingots. public static final TagPrefix toolHeadDrill = new TagPrefix("drillHead") @@ -559,7 +624,8 @@ public static TagPrefix get(String name) { .materialIconType(MaterialIconType.toolHeadDrill) .unificationEnabled(true) .generateItem(true) - .generationCondition(hasToolProperty.and(mat -> mat.hasFlag(MaterialFlags.GENERATE_PLATE)).and(mat -> mat.getProperty(PropertyKey.TOOL).hasType(GTToolType.DRILL_LV))); + .generationCondition(hasToolProperty.and(mat -> mat.hasFlag(MaterialFlags.GENERATE_PLATE)) + .and(mat -> mat.getProperty(PropertyKey.TOOL).hasType(GTToolType.DRILL_LV))); // made of 2 Ingots. public static final TagPrefix toolHeadChainsaw = new TagPrefix("chainsawHead") @@ -570,7 +636,8 @@ public static TagPrefix get(String name) { .materialIconType(MaterialIconType.toolHeadChainsaw) .unificationEnabled(true) .generateItem(true) - .generationCondition(hasNoCraftingToolProperty.and(mat -> mat.hasFlag(MaterialFlags.GENERATE_PLATE)).and(mat -> mat.getProperty(PropertyKey.TOOL).hasType(GTToolType.CHAINSAW_LV))); + .generationCondition(hasNoCraftingToolProperty.and(mat -> mat.hasFlag(MaterialFlags.GENERATE_PLATE)) + .and(mat -> mat.getProperty(PropertyKey.TOOL).hasType(GTToolType.CHAINSAW_LV))); // made of 4 Ingots. public static final TagPrefix toolHeadWrench = new TagPrefix("wrenchTip") @@ -581,7 +648,8 @@ public static TagPrefix get(String name) { .materialIconType(MaterialIconType.toolHeadWrench) .unificationEnabled(true) .generateItem(true) - .generationCondition(hasNoCraftingToolProperty.and(mat -> mat.hasFlag(MaterialFlags.GENERATE_PLATE)).and(mat -> mat.getProperty(PropertyKey.TOOL).hasType(GTToolType.WRENCH_LV))); + .generationCondition(hasNoCraftingToolProperty.and(mat -> mat.hasFlag(MaterialFlags.GENERATE_PLATE)) + .and(mat -> mat.getProperty(PropertyKey.TOOL).hasType(GTToolType.WRENCH_LV))); // made of 5 Ingots. public static final TagPrefix turbineBlade = new TagPrefix("turbineBlade") @@ -591,7 +659,9 @@ public static TagPrefix get(String name) { .materialIconType(MaterialIconType.turbineBlade) .unificationEnabled(true) .generateItem(true) - .generationCondition(hasRotorProperty.and(m -> m.hasFlags(MaterialFlags.GENERATE_BOLT_SCREW, MaterialFlags.GENERATE_PLATE) && !m.hasProperty(PropertyKey.GEM))); + .generationCondition(hasRotorProperty + .and(m -> m.hasFlags(MaterialFlags.GENERATE_BOLT_SCREW, MaterialFlags.GENERATE_PLATE) && + !m.hasProperty(PropertyKey.GEM))); // Storage Block consisting out of 9 Ingots/Gems/Dusts. public static final TagPrefix block = new TagPrefix("block") @@ -602,23 +672,24 @@ public static TagPrefix get(String name) { .materialIconType(MaterialIconType.block) .miningToolTag(BlockTags.MINEABLE_WITH_PICKAXE) .generateBlock(true) - .generationCondition(material -> material.hasProperty(PropertyKey.INGOT) || material.hasProperty(PropertyKey.GEM) || material.hasFlag(MaterialFlags.FORCE_GENERATE_BLOCK)) + .generationCondition(material -> material.hasProperty(PropertyKey.INGOT) || + material.hasProperty(PropertyKey.GEM) || material.hasFlag(MaterialFlags.FORCE_GENERATE_BLOCK)) .unificationEnabled(true); public static final TagPrefix log = new TagPrefix("log") - .unformattedTagPath("logs", true); + .unformattedTagPath("logs", true); public static final TagPrefix planks = new TagPrefix("planks") - .unformattedTagPath("planks", true); + .unformattedTagPath("planks", true); public static final TagPrefix slab = new TagPrefix("slab") - .unformattedTagPath("slabs", true); + .unformattedTagPath("slabs", true); public static final TagPrefix stairs = new TagPrefix("stairs") - .unformattedTagPath("stairs", true); + .unformattedTagPath("stairs", true); public static final TagPrefix fence = new TagPrefix("fence") - .unformattedTagPath("fences"); + .unformattedTagPath("fences"); public static final TagPrefix fenceGate = new TagPrefix("fenceGate") - .unformattedTagPath("fence_gates"); + .unformattedTagPath("fence_gates"); public static final TagPrefix door = new TagPrefix("door") - .unformattedTagPath("doors", true); + .unformattedTagPath("doors", true); // Prefix to determine which kind of Rock this is. // Also has a base tag path of only the material, for things like obsidian etc. @@ -639,45 +710,111 @@ public static TagPrefix get(String name) { .unificationEnabled(true) .generateBlock(true) .blockProperties(() -> RenderType::translucent, p -> p.noOcclusion()) - .generationCondition(material -> material.hasProperty(PropertyKey.DUST) && material.hasFlag(MaterialFlags.GENERATE_FRAME)); + .generationCondition(material -> material.hasProperty(PropertyKey.DUST) && + material.hasFlag(MaterialFlags.GENERATE_FRAME)); // Pipes - public static final TagPrefix pipeTinyFluid = new TagPrefix("pipeTinyFluid").itemTable(() -> GTBlocks.FLUID_PIPE_BLOCKS).langValue("Tiny %s Fluid Pipe").miningToolTag(GTToolType.WRENCH.harvestTags.get(0)).materialAmount(GTValues.M / 2).unificationEnabled(true); - public static final TagPrefix pipeSmallFluid = new TagPrefix("pipeSmallFluid").itemTable(() -> GTBlocks.FLUID_PIPE_BLOCKS).langValue("Small %s Fluid Pipe").miningToolTag(GTToolType.WRENCH.harvestTags.get(0)).materialAmount(GTValues.M).unificationEnabled(true); - public static final TagPrefix pipeNormalFluid = new TagPrefix("pipeNormalFluid").itemTable(() -> GTBlocks.FLUID_PIPE_BLOCKS).langValue("Normal %s Fluid Pipe").miningToolTag(GTToolType.WRENCH.harvestTags.get(0)).materialAmount(GTValues.M * 3).unificationEnabled(true); - public static final TagPrefix pipeLargeFluid = new TagPrefix("pipeLargeFluid").itemTable(() -> GTBlocks.FLUID_PIPE_BLOCKS).langValue("Large %s Fluid Pipe").miningToolTag(GTToolType.WRENCH.harvestTags.get(0)).materialAmount(GTValues.M * 6).unificationEnabled(true); - public static final TagPrefix pipeHugeFluid = new TagPrefix("pipeHugeFluid").itemTable(() -> GTBlocks.FLUID_PIPE_BLOCKS).langValue("Huge %s Fluid Pipe").miningToolTag(GTToolType.WRENCH.harvestTags.get(0)).materialAmount(GTValues.M * 12).unificationEnabled(true); + public static final TagPrefix pipeTinyFluid = new TagPrefix("pipeTinyFluid") + .itemTable(() -> GTBlocks.FLUID_PIPE_BLOCKS).langValue("Tiny %s Fluid Pipe") + .miningToolTag(GTToolType.WRENCH.harvestTags.get(0)).materialAmount(GTValues.M / 2) + .unificationEnabled(true); + public static final TagPrefix pipeSmallFluid = new TagPrefix("pipeSmallFluid") + .itemTable(() -> GTBlocks.FLUID_PIPE_BLOCKS).langValue("Small %s Fluid Pipe") + .miningToolTag(GTToolType.WRENCH.harvestTags.get(0)).materialAmount(GTValues.M).unificationEnabled(true); + public static final TagPrefix pipeNormalFluid = new TagPrefix("pipeNormalFluid") + .itemTable(() -> GTBlocks.FLUID_PIPE_BLOCKS).langValue("Normal %s Fluid Pipe") + .miningToolTag(GTToolType.WRENCH.harvestTags.get(0)).materialAmount(GTValues.M * 3) + .unificationEnabled(true); + public static final TagPrefix pipeLargeFluid = new TagPrefix("pipeLargeFluid") + .itemTable(() -> GTBlocks.FLUID_PIPE_BLOCKS).langValue("Large %s Fluid Pipe") + .miningToolTag(GTToolType.WRENCH.harvestTags.get(0)).materialAmount(GTValues.M * 6) + .unificationEnabled(true); + public static final TagPrefix pipeHugeFluid = new TagPrefix("pipeHugeFluid") + .itemTable(() -> GTBlocks.FLUID_PIPE_BLOCKS).langValue("Huge %s Fluid Pipe") + .miningToolTag(GTToolType.WRENCH.harvestTags.get(0)).materialAmount(GTValues.M * 12) + .unificationEnabled(true); - public static final TagPrefix pipeQuadrupleFluid = new TagPrefix("pipeQuadrupleFluid").itemTable(() -> GTBlocks.FLUID_PIPE_BLOCKS).langValue("Quadruple %s Fluid Pipe").miningToolTag(GTToolType.WRENCH.harvestTags.get(0)).materialAmount(GTValues.M * 4).unificationEnabled(true); - public static final TagPrefix pipeNonupleFluid = new TagPrefix("pipeNonupleFluid").itemTable(() -> GTBlocks.FLUID_PIPE_BLOCKS).langValue("Nonuple %s Fluid Pipe").miningToolTag(GTToolType.WRENCH.harvestTags.get(0)).materialAmount(GTValues.M * 9).unificationEnabled(true); + public static final TagPrefix pipeQuadrupleFluid = new TagPrefix("pipeQuadrupleFluid") + .itemTable(() -> GTBlocks.FLUID_PIPE_BLOCKS).langValue("Quadruple %s Fluid Pipe") + .miningToolTag(GTToolType.WRENCH.harvestTags.get(0)).materialAmount(GTValues.M * 4) + .unificationEnabled(true); + public static final TagPrefix pipeNonupleFluid = new TagPrefix("pipeNonupleFluid") + .itemTable(() -> GTBlocks.FLUID_PIPE_BLOCKS).langValue("Nonuple %s Fluid Pipe") + .miningToolTag(GTToolType.WRENCH.harvestTags.get(0)).materialAmount(GTValues.M * 9) + .unificationEnabled(true); - public static final TagPrefix pipeSmallItem = new TagPrefix("pipeSmallItem").itemTable(() -> GTBlocks.ITEM_PIPE_BLOCKS).langValue("Small %s Item Pipe").miningToolTag(GTToolType.WRENCH.harvestTags.get(0)).materialAmount(GTValues.M).unificationEnabled(true); - public static final TagPrefix pipeNormalItem = new TagPrefix("pipeNormalItem").itemTable(() -> GTBlocks.ITEM_PIPE_BLOCKS).langValue("Normal %s Item Pipe").miningToolTag(GTToolType.WRENCH.harvestTags.get(0)).materialAmount(GTValues.M * 3).unificationEnabled(true); - public static final TagPrefix pipeLargeItem = new TagPrefix("pipeLargeItem").itemTable(() -> GTBlocks.ITEM_PIPE_BLOCKS).langValue("Large %s Item Pipe").miningToolTag(GTToolType.WRENCH.harvestTags.get(0)).materialAmount(GTValues.M * 6).unificationEnabled(true); - public static final TagPrefix pipeHugeItem = new TagPrefix("pipeHugeItem").itemTable(() -> GTBlocks.ITEM_PIPE_BLOCKS).langValue("Huge %s Item Pipe").miningToolTag(GTToolType.WRENCH.harvestTags.get(0)).materialAmount(GTValues.M * 12).unificationEnabled(true); + public static final TagPrefix pipeSmallItem = new TagPrefix("pipeSmallItem") + .itemTable(() -> GTBlocks.ITEM_PIPE_BLOCKS).langValue("Small %s Item Pipe") + .miningToolTag(GTToolType.WRENCH.harvestTags.get(0)).materialAmount(GTValues.M).unificationEnabled(true); + public static final TagPrefix pipeNormalItem = new TagPrefix("pipeNormalItem") + .itemTable(() -> GTBlocks.ITEM_PIPE_BLOCKS).langValue("Normal %s Item Pipe") + .miningToolTag(GTToolType.WRENCH.harvestTags.get(0)).materialAmount(GTValues.M * 3) + .unificationEnabled(true); + public static final TagPrefix pipeLargeItem = new TagPrefix("pipeLargeItem") + .itemTable(() -> GTBlocks.ITEM_PIPE_BLOCKS).langValue("Large %s Item Pipe") + .miningToolTag(GTToolType.WRENCH.harvestTags.get(0)).materialAmount(GTValues.M * 6) + .unificationEnabled(true); + public static final TagPrefix pipeHugeItem = new TagPrefix("pipeHugeItem") + .itemTable(() -> GTBlocks.ITEM_PIPE_BLOCKS).langValue("Huge %s Item Pipe") + .miningToolTag(GTToolType.WRENCH.harvestTags.get(0)).materialAmount(GTValues.M * 12) + .unificationEnabled(true); - public static final TagPrefix pipeSmallRestrictive = new TagPrefix("pipeSmallRestrictive").itemTable(() -> GTBlocks.ITEM_PIPE_BLOCKS).langValue("Small Restrictive %s Item Pipe").miningToolTag(GTToolType.WRENCH.harvestTags.get(0)).materialAmount(GTValues.M).unificationEnabled(true); - public static final TagPrefix pipeNormalRestrictive = new TagPrefix("pipeNormalRestrictive").itemTable(() -> GTBlocks.ITEM_PIPE_BLOCKS).langValue("Normal Restrictive %s Item Pipe").miningToolTag(GTToolType.WRENCH.harvestTags.get(0)).materialAmount(GTValues.M * 3).unificationEnabled(true); - public static final TagPrefix pipeLargeRestrictive = new TagPrefix("pipeLargeRestrictive").itemTable(() -> GTBlocks.ITEM_PIPE_BLOCKS).langValue("Large Restrictive %s Item Pipe").miningToolTag(GTToolType.WRENCH.harvestTags.get(0)).materialAmount(GTValues.M * 6).unificationEnabled(true); - public static final TagPrefix pipeHugeRestrictive = new TagPrefix("pipeHugeRestrictive").itemTable(() -> GTBlocks.ITEM_PIPE_BLOCKS).langValue("Huge Restrictive %s Item Pipe").miningToolTag(GTToolType.WRENCH.harvestTags.get(0)).materialAmount(GTValues.M * 12).unificationEnabled(true); + public static final TagPrefix pipeSmallRestrictive = new TagPrefix("pipeSmallRestrictive") + .itemTable(() -> GTBlocks.ITEM_PIPE_BLOCKS).langValue("Small Restrictive %s Item Pipe") + .miningToolTag(GTToolType.WRENCH.harvestTags.get(0)).materialAmount(GTValues.M).unificationEnabled(true); + public static final TagPrefix pipeNormalRestrictive = new TagPrefix("pipeNormalRestrictive") + .itemTable(() -> GTBlocks.ITEM_PIPE_BLOCKS).langValue("Normal Restrictive %s Item Pipe") + .miningToolTag(GTToolType.WRENCH.harvestTags.get(0)).materialAmount(GTValues.M * 3) + .unificationEnabled(true); + public static final TagPrefix pipeLargeRestrictive = new TagPrefix("pipeLargeRestrictive") + .itemTable(() -> GTBlocks.ITEM_PIPE_BLOCKS).langValue("Large Restrictive %s Item Pipe") + .miningToolTag(GTToolType.WRENCH.harvestTags.get(0)).materialAmount(GTValues.M * 6) + .unificationEnabled(true); + public static final TagPrefix pipeHugeRestrictive = new TagPrefix("pipeHugeRestrictive") + .itemTable(() -> GTBlocks.ITEM_PIPE_BLOCKS).langValue("Huge Restrictive %s Item Pipe") + .miningToolTag(GTToolType.WRENCH.harvestTags.get(0)).materialAmount(GTValues.M * 12) + .unificationEnabled(true); // Wires and cables - public static final TagPrefix wireGtHex = new TagPrefix("wireGtHex").itemTable(() -> GTBlocks.CABLE_BLOCKS).langValue("16x %s Wire").miningToolTag(GTToolType.WIRE_CUTTER.harvestTags.get(0)).materialAmount(GTValues.M * 8).materialIconType(MaterialIconType.wire).unificationEnabled(true); - public static final TagPrefix wireGtOctal = new TagPrefix("wireGtOctal").itemTable(() -> GTBlocks.CABLE_BLOCKS).langValue("8x %s Wire").miningToolTag(GTToolType.WIRE_CUTTER.harvestTags.get(0)).materialAmount(GTValues.M * 4).materialIconType(MaterialIconType.wire).unificationEnabled(true); - public static final TagPrefix wireGtQuadruple = new TagPrefix("wireGtQuadruple").itemTable(() -> GTBlocks.CABLE_BLOCKS).langValue("4x %s Wire").miningToolTag(GTToolType.WIRE_CUTTER.harvestTags.get(0)).materialAmount(GTValues.M * 2).materialIconType(MaterialIconType.wire).unificationEnabled(true); - public static final TagPrefix wireGtDouble = new TagPrefix("wireGtDouble").itemTable(() -> GTBlocks.CABLE_BLOCKS).langValue("2x %s Wire").miningToolTag(GTToolType.WIRE_CUTTER.harvestTags.get(0)).materialAmount(GTValues.M).materialIconType(MaterialIconType.wire).unificationEnabled(true); - public static final TagPrefix wireGtSingle = new TagPrefix("wireGtSingle").itemTable(() -> GTBlocks.CABLE_BLOCKS).langValue("1x %s Wire").miningToolTag(GTToolType.WIRE_CUTTER.harvestTags.get(0)).materialAmount(GTValues.M / 2).materialIconType(MaterialIconType.wire).unificationEnabled(true); - - public static final TagPrefix cableGtHex = new TagPrefix("cableGtHex").itemTable(() -> GTBlocks.CABLE_BLOCKS).langValue("16x %s Cable").miningToolTag(GTToolType.WIRE_CUTTER.harvestTags.get(0)).materialAmount(GTValues.M * 8).unificationEnabled(true); - public static final TagPrefix cableGtOctal = new TagPrefix("cableGtOctal").itemTable(() -> GTBlocks.CABLE_BLOCKS).langValue("8x %s Cable").miningToolTag(GTToolType.WIRE_CUTTER.harvestTags.get(0)).materialAmount(GTValues.M * 4).unificationEnabled(true); - public static final TagPrefix cableGtQuadruple = new TagPrefix("cableGtQuadruple").itemTable(() -> GTBlocks.CABLE_BLOCKS).langValue("4x %s Cable").miningToolTag(GTToolType.WIRE_CUTTER.harvestTags.get(0)).materialAmount(GTValues.M * 2).unificationEnabled(true); - public static final TagPrefix cableGtDouble = new TagPrefix("cableGtDouble").itemTable(() -> GTBlocks.CABLE_BLOCKS).langValue("2x %s Cable").miningToolTag(GTToolType.WIRE_CUTTER.harvestTags.get(0)).materialAmount(GTValues.M).unificationEnabled(true); - public static final TagPrefix cableGtSingle = new TagPrefix("cableGtSingle").itemTable(() -> GTBlocks.CABLE_BLOCKS).langValue("1x %s Cable").miningToolTag(GTToolType.WIRE_CUTTER.harvestTags.get(0)).materialAmount(GTValues.M / 2).unificationEnabled(true); - + public static final TagPrefix wireGtHex = new TagPrefix("wireGtHex").itemTable(() -> GTBlocks.CABLE_BLOCKS) + .langValue("16x %s Wire").miningToolTag(GTToolType.WIRE_CUTTER.harvestTags.get(0)) + .materialAmount(GTValues.M * 8).materialIconType(MaterialIconType.wire).unificationEnabled(true); + public static final TagPrefix wireGtOctal = new TagPrefix("wireGtOctal").itemTable(() -> GTBlocks.CABLE_BLOCKS) + .langValue("8x %s Wire").miningToolTag(GTToolType.WIRE_CUTTER.harvestTags.get(0)) + .materialAmount(GTValues.M * 4).materialIconType(MaterialIconType.wire).unificationEnabled(true); + public static final TagPrefix wireGtQuadruple = new TagPrefix("wireGtQuadruple") + .itemTable(() -> GTBlocks.CABLE_BLOCKS).langValue("4x %s Wire") + .miningToolTag(GTToolType.WIRE_CUTTER.harvestTags.get(0)).materialAmount(GTValues.M * 2) + .materialIconType(MaterialIconType.wire).unificationEnabled(true); + public static final TagPrefix wireGtDouble = new TagPrefix("wireGtDouble").itemTable(() -> GTBlocks.CABLE_BLOCKS) + .langValue("2x %s Wire").miningToolTag(GTToolType.WIRE_CUTTER.harvestTags.get(0)).materialAmount(GTValues.M) + .materialIconType(MaterialIconType.wire).unificationEnabled(true); + public static final TagPrefix wireGtSingle = new TagPrefix("wireGtSingle").itemTable(() -> GTBlocks.CABLE_BLOCKS) + .langValue("1x %s Wire").miningToolTag(GTToolType.WIRE_CUTTER.harvestTags.get(0)) + .materialAmount(GTValues.M / 2).materialIconType(MaterialIconType.wire).unificationEnabled(true); + + public static final TagPrefix cableGtHex = new TagPrefix("cableGtHex").itemTable(() -> GTBlocks.CABLE_BLOCKS) + .langValue("16x %s Cable").miningToolTag(GTToolType.WIRE_CUTTER.harvestTags.get(0)) + .materialAmount(GTValues.M * 8).unificationEnabled(true); + public static final TagPrefix cableGtOctal = new TagPrefix("cableGtOctal").itemTable(() -> GTBlocks.CABLE_BLOCKS) + .langValue("8x %s Cable").miningToolTag(GTToolType.WIRE_CUTTER.harvestTags.get(0)) + .materialAmount(GTValues.M * 4).unificationEnabled(true); + public static final TagPrefix cableGtQuadruple = new TagPrefix("cableGtQuadruple") + .itemTable(() -> GTBlocks.CABLE_BLOCKS).langValue("4x %s Cable") + .miningToolTag(GTToolType.WIRE_CUTTER.harvestTags.get(0)).materialAmount(GTValues.M * 2) + .unificationEnabled(true); + public static final TagPrefix cableGtDouble = new TagPrefix("cableGtDouble").itemTable(() -> GTBlocks.CABLE_BLOCKS) + .langValue("2x %s Cable").miningToolTag(GTToolType.WIRE_CUTTER.harvestTags.get(0)) + .materialAmount(GTValues.M).unificationEnabled(true); + public static final TagPrefix cableGtSingle = new TagPrefix("cableGtSingle").itemTable(() -> GTBlocks.CABLE_BLOCKS) + .langValue("1x %s Cable").miningToolTag(GTToolType.WIRE_CUTTER.harvestTags.get(0)) + .materialAmount(GTValues.M / 2).unificationEnabled(true); public static class Conditions { + public static final Predicate hasToolProperty = mat -> mat.hasProperty(PropertyKey.TOOL); - public static final Predicate hasNoCraftingToolProperty = hasToolProperty.and(mat -> !mat.getProperty(PropertyKey.TOOL).isIgnoreCraftingTools()); + public static final Predicate hasNoCraftingToolProperty = hasToolProperty + .and(mat -> !mat.getProperty(PropertyKey.TOOL).isIgnoreCraftingTools()); public static final Predicate hasOreProperty = mat -> mat.hasProperty(PropertyKey.ORE); public static final Predicate hasGemProperty = mat -> mat.hasProperty(PropertyKey.GEM); public static final Predicate hasDustProperty = mat -> mat.hasProperty(PropertyKey.DUST); @@ -686,18 +823,24 @@ public static class Conditions { public static final Predicate hasRotorProperty = mat -> mat.hasProperty(PropertyKey.ROTOR); } - public record OreType(Supplier stoneType, Supplier material, Supplier template, ResourceLocation baseModelLocation, boolean isDoubleDrops, boolean isSand, boolean shouldDropAsItem) { } - public record BlockProperties(Supplier> renderType, UnaryOperator properties) {} + public record OreType(Supplier stoneType, Supplier material, + Supplier template, ResourceLocation baseModelLocation, + boolean isDoubleDrops, boolean isSand, boolean shouldDropAsItem) {} + + public record BlockProperties(Supplier> renderType, + UnaryOperator properties) {} @Getter public final String name; - @Getter @Setter + @Getter + @Setter private String idPattern; @Getter public final boolean invertedName; protected final List tags = new ArrayList<>(); - @Setter @Getter + @Setter + @Getter public String langValue; @Getter @@ -710,22 +853,25 @@ public record BlockProperties(Supplier> renderType, UnaryOp private boolean generateItem; @Setter private boolean generateBlock; - @Getter @Setter - private BlockProperties blockProperties = new BlockProperties(() -> RenderType::translucent, UnaryOperator.identity()); + @Getter + @Setter + private BlockProperties blockProperties = new BlockProperties(() -> RenderType::translucent, + UnaryOperator.identity()); @Getter @Setter - private @Nullable - Predicate generationCondition; + private @Nullable Predicate generationCondition; - @Nullable @Getter + @Nullable + @Getter @Setter private MaterialIconType materialIconType; @Setter private Supplier>> itemTable; - @Nullable @Getter + @Nullable + @Getter @Setter private BiConsumer> tooltip; @@ -756,13 +902,13 @@ public TagPrefix(String name, boolean invertedName) { public static TagPrefix oreTagPrefix(String name, TagKey miningToolTag) { return new TagPrefix(name) - .defaultTagPath("ores/%s") - .prefixOnlyTagPath("ores_in_ground/%s") - .unformattedTagPath("ores") - .materialIconType(MaterialIconType.ore) - .miningToolTag(miningToolTag) - .unificationEnabled(true) - .generationCondition(hasOreProperty); + .defaultTagPath("ores/%s") + .prefixOnlyTagPath("ores_in_ground/%s") + .unformattedTagPath("ores") + .materialIconType(MaterialIconType.ore) + .miningToolTag(miningToolTag) + .unificationEnabled(true) + .generationCondition(hasOreProperty); } public void addSecondaryMaterial(MaterialStack secondaryMaterial) { @@ -770,20 +916,29 @@ public void addSecondaryMaterial(MaterialStack secondaryMaterial) { secondaryMaterials.add(secondaryMaterial); } - public TagPrefix registerOre(Supplier stoneType, Supplier material, BlockBehaviour.Properties properties, ResourceLocation baseModelLocation) { + public TagPrefix registerOre(Supplier stoneType, Supplier material, + BlockBehaviour.Properties properties, ResourceLocation baseModelLocation) { return registerOre(stoneType, material, properties, baseModelLocation, false); } - public TagPrefix registerOre(Supplier stoneType, Supplier material, BlockBehaviour.Properties properties, ResourceLocation baseModelLocation, boolean doubleDrops) { + public TagPrefix registerOre(Supplier stoneType, Supplier material, + BlockBehaviour.Properties properties, ResourceLocation baseModelLocation, + boolean doubleDrops) { return registerOre(stoneType, material, properties, baseModelLocation, doubleDrops, false, false); } - public TagPrefix registerOre(Supplier stoneType, Supplier material, BlockBehaviour.Properties properties, ResourceLocation baseModelLocation, boolean doubleDrops, boolean isSand, boolean shouldDropAsItem) { - return registerOre(stoneType, material, () -> properties, baseModelLocation, doubleDrops, isSand, shouldDropAsItem); + public TagPrefix registerOre(Supplier stoneType, Supplier material, + BlockBehaviour.Properties properties, ResourceLocation baseModelLocation, + boolean doubleDrops, boolean isSand, boolean shouldDropAsItem) { + return registerOre(stoneType, material, () -> properties, baseModelLocation, doubleDrops, isSand, + shouldDropAsItem); } - public TagPrefix registerOre(Supplier stoneType, Supplier material, Supplier properties, ResourceLocation baseModelLocation, boolean doubleDrops, boolean isSand, boolean shouldDropAsItem) { - ORES.put(this, new OreType(stoneType, material, properties, baseModelLocation, doubleDrops, isSand, shouldDropAsItem)); + public TagPrefix registerOre(Supplier stoneType, Supplier material, + Supplier properties, ResourceLocation baseModelLocation, + boolean doubleDrops, boolean isSand, boolean shouldDropAsItem) { + ORES.put(this, + new OreType(stoneType, material, properties, baseModelLocation, doubleDrops, isSand, shouldDropAsItem)); if (shouldDropAsItem) { GTOreByProduct.addOreByProductPrefix(this); } @@ -828,7 +983,8 @@ public TagPrefix miningToolTag(TagKey tag) { return this; } - public TagPrefix blockProperties(Supplier> renderType, UnaryOperator properties) { + public TagPrefix blockProperties(Supplier> renderType, + UnaryOperator properties) { return this.blockProperties(new BlockProperties(renderType, properties)); } @@ -854,7 +1010,8 @@ public TagKey[] getItemParentTags() { @SuppressWarnings("unchecked") public TagKey[] getItemTags(@NotNull Material mat) { - return tags.stream().filter(type -> !type.isParentTag()).map(type -> type.getTag(this, mat)).toArray(TagKey[]::new); + return tags.stream().filter(type -> !type.isParentTag()).map(type -> type.getTag(this, mat)) + .toArray(TagKey[]::new); } @SuppressWarnings("unchecked") @@ -864,12 +1021,14 @@ public TagKey[] getAllItemTags(@NotNull Material mat) { @SuppressWarnings("unchecked") public TagKey[] getBlockTags(@NotNull Material mat) { - return tags.stream().filter(type -> !type.isParentTag()).map(type -> type.getTag(this, mat)).map(itemTagKey -> TagKey.create(Registries.BLOCK, itemTagKey.location())).toArray(TagKey[]::new); + return tags.stream().filter(type -> !type.isParentTag()).map(type -> type.getTag(this, mat)) + .map(itemTagKey -> TagKey.create(Registries.BLOCK, itemTagKey.location())).toArray(TagKey[]::new); } @SuppressWarnings("unchecked") public TagKey[] getAllBlockTags(@NotNull Material mat) { - return tags.stream().map(type -> type.getTag(this, mat)).map(itemTagKey -> TagKey.create(Registries.BLOCK, itemTagKey.location())).toArray(TagKey[]::new); + return tags.stream().map(type -> type.getTag(this, mat)) + .map(itemTagKey -> TagKey.create(Registries.BLOCK, itemTagKey.location())).toArray(TagKey[]::new); } public boolean hasItemTable() { @@ -886,7 +1045,9 @@ public boolean doGenerateItem() { } public boolean doGenerateItem(Material material) { - return generateItem && !isIgnored(material) && (generationCondition == null || generationCondition.test(material)) || (hasItemTable() && this.itemTable.get() != null && getItemFromTable(material) != null); + return generateItem && !isIgnored(material) && + (generationCondition == null || generationCondition.test(material)) || + (hasItemTable() && this.itemTable.get() != null && getItemFromTable(material) != null); } public boolean doGenerateBlock() { @@ -894,17 +1055,23 @@ public boolean doGenerateBlock() { } public boolean doGenerateBlock(Material material) { - return generateBlock && !isIgnored(material) && (generationCondition == null || generationCondition.test(material)) || hasItemTable() && this.itemTable.get() != null && getItemFromTable(material) != null; + return generateBlock && !isIgnored(material) && + (generationCondition == null || generationCondition.test(material)) || + hasItemTable() && this.itemTable.get() != null && getItemFromTable(material) != null; } @FunctionalInterface public interface MaterialRecipeHandler> { + void accept(TagPrefix prefix, Material material, T property, Consumer provider); } - public > void executeHandler(Consumer provider, PropertyKey propertyKey, MaterialRecipeHandler handler) { + public > void executeHandler(Consumer provider, + PropertyKey propertyKey, + MaterialRecipeHandler handler) { for (Material material : GTCEuAPI.materialManager.getRegisteredMaterials()) { - if (material.hasProperty(propertyKey) && !material.hasFlag(MaterialFlags.NO_UNIFICATION) && !ChemicalHelper.get(this, material).isEmpty()) { + if (material.hasProperty(propertyKey) && !material.hasFlag(MaterialFlags.NO_UNIFICATION) && + !ChemicalHelper.get(this, material).isEmpty()) { handler.accept(this, material, material.getProperty(propertyKey), provider); } } @@ -920,14 +1087,15 @@ public MutableComponent getLocalizedName(Material material) { public String getUnlocalizedName(Material material) { String formattedPrefix = FormattingUtil.toLowerCaseUnderscore(this.name); - String matSpecificKey = String.format("item.%s.%s", material.getModid(), this.idPattern.formatted(material.getName())); + String matSpecificKey = String.format("item.%s.%s", material.getModid(), + this.idPattern.formatted(material.getName())); if (LocalizationUtils.exist(matSpecificKey)) { return matSpecificKey; } - if(material.hasProperty(PropertyKey.POLYMER)) { + if (material.hasProperty(PropertyKey.POLYMER)) { String localizationKey = String.format("tagprefix.polymer.%s", formattedPrefix); // Not every polymer tag prefix gets a special name - if(LocalizationUtils.exist(localizationKey)) { + if (LocalizationUtils.exist(localizationKey)) { return localizationKey; } } @@ -951,15 +1119,18 @@ public final void setIgnored(Material material, Supplier... public void setIgnored(Material material, ItemLike... items) { // go through setIgnoredBlock to wrap if this is a block prefix if (this.doGenerateBlock()) { - this.setIgnoredBlock(material, Arrays.stream(items).filter(Block.class::isInstance).map(Block.class::cast).toArray(Block[]::new)); + this.setIgnoredBlock(material, + Arrays.stream(items).filter(Block.class::isInstance).map(Block.class::cast).toArray(Block[]::new)); } else { - this.setIgnored(material, Arrays.stream(items).map(item -> (Supplier) () -> item).toArray(Supplier[]::new)); + this.setIgnored(material, + Arrays.stream(items).map(item -> (Supplier) () -> item).toArray(Supplier[]::new)); } } @SuppressWarnings("unchecked") public void setIgnoredBlock(Material material, Block... items) { - this.setIgnored(material, Arrays.stream(items).map(block -> SupplierMemoizer.memoizeBlockSupplier(() -> block)).toArray(Supplier[]::new)); + this.setIgnored(material, Arrays.stream(items).map(block -> SupplierMemoizer.memoizeBlockSupplier(() -> block)) + .toArray(Supplier[]::new)); } @SuppressWarnings("unchecked") diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/tag/TagType.java b/src/main/java/com/gregtechceu/gtceu/api/data/tag/TagType.java index be803728c7..5268565b74 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/tag/TagType.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/tag/TagType.java @@ -2,10 +2,12 @@ import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.utils.FormattingUtil; -import lombok.Getter; + import net.minecraft.tags.TagKey; import net.minecraft.world.item.Item; +import lombok.Getter; + import java.util.function.BiFunction; public class TagType { @@ -36,7 +38,8 @@ public static TagType withDefaultFormatter(String tagPath, boolean isVanilla) { */ public static TagType withPrefixFormatter(String tagPath) { TagType type = new TagType(tagPath); - type.formatter = (prefix, mat) -> TagUtil.createItemTag(type.tagPath.formatted(FormattingUtil.toLowerCaseUnderscore(prefix.name), mat.getName())); + type.formatter = (prefix, mat) -> TagUtil.createItemTag( + type.tagPath.formatted(FormattingUtil.toLowerCaseUnderscore(prefix.name), mat.getName())); return type; } @@ -46,7 +49,8 @@ public static TagType withPrefixFormatter(String tagPath) { */ public static TagType withPrefixOnlyFormatter(String tagPath) { TagType type = new TagType(tagPath); - type.formatter = (prefix, mat) -> TagUtil.createItemTag(type.tagPath.formatted(FormattingUtil.toLowerCaseUnderscore(prefix.name))); + type.formatter = (prefix, mat) -> TagUtil + .createItemTag(type.tagPath.formatted(FormattingUtil.toLowerCaseUnderscore(prefix.name))); type.isParentTag = true; return type; } diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/tag/TagUtil.java b/src/main/java/com/gregtechceu/gtceu/api/data/tag/TagUtil.java index 475f72f17e..63990cce15 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/tag/TagUtil.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/tag/TagUtil.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.api.data.tag; import com.gregtechceu.gtceu.GTCEu; + import net.minecraft.core.Registry; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceKey; @@ -30,7 +31,8 @@ public static TagKey createTag(Registry registry, String path, boolean return optionalTag(registry, new ResourceLocation("forge", path)); // TODO change "forge" to "common" in 1.21 } - public static TagKey createTag(ResourceKey> registryKey, String path, boolean vanilla) { + public static TagKey createTag(ResourceKey> registryKey, String path, + boolean vanilla) { if (vanilla) return optionalTag(registryKey, new ResourceLocation("minecraft", path)); return optionalTag(registryKey, new ResourceLocation("forge", path)); // TODO change "forge" to "common" in 1.21 } @@ -70,5 +72,4 @@ public static TagKey createModItemTag(String path) { public static TagKey createFluidTag(String path) { return createTag(BuiltInRegistries.FLUID, path, false); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/BiomeWeightModifier.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/BiomeWeightModifier.java index 515f688be5..03ad2800ec 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/BiomeWeightModifier.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/BiomeWeightModifier.java @@ -1,22 +1,23 @@ package com.gregtechceu.gtceu.api.data.worldgen; -import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; import net.minecraft.core.Holder; import net.minecraft.core.HolderSet; import net.minecraft.core.RegistryCodecs; import net.minecraft.core.registries.Registries; import net.minecraft.world.level.biome.Biome; +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; + import java.util.function.Function; import java.util.function.Supplier; public class BiomeWeightModifier implements Function, Integer> { + public static final Codec CODEC = RecordCodecBuilder.create(instance -> instance.group( - RegistryCodecs.homogeneousList(Registries.BIOME).fieldOf("biomes").forGetter(mod -> mod.biomes.get()), - Codec.INT.fieldOf("added_weight").forGetter(mod -> mod.addedWeight) - ).apply(instance, (biomes, weight) -> new BiomeWeightModifier(() -> biomes, weight)) - ); + RegistryCodecs.homogeneousList(Registries.BIOME).fieldOf("biomes").forGetter(mod -> mod.biomes.get()), + Codec.INT.fieldOf("added_weight").forGetter(mod -> mod.addedWeight)) + .apply(instance, (biomes, weight) -> new BiomeWeightModifier(() -> biomes, weight))); public Supplier> biomes; public int addedWeight; diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/GTLayerPattern.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/GTLayerPattern.java index 5d62b37f43..8a108a967c 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/GTLayerPattern.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/GTLayerPattern.java @@ -2,10 +2,7 @@ import com.gregtechceu.gtceu.api.GTCEuAPI; import com.gregtechceu.gtceu.api.data.chemical.material.Material; -import com.gregtechceu.gtceu.api.registry.GTRegistries; -import com.mojang.datafixers.util.Either; -import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; + import net.minecraft.util.RandomSource; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; @@ -13,7 +10,11 @@ import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration.TargetBlockState; import net.minecraft.world.level.levelgen.structure.templatesystem.RuleTest; +import com.mojang.datafixers.util.Either; +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; import org.jetbrains.annotations.Nullable; + import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -21,133 +22,138 @@ import java.util.function.Supplier; public class GTLayerPattern { - public static final Codec CODEC = Codec.list(Layer.CODEC) - .xmap(GTLayerPattern::new, pattern -> pattern.layers); - - public final List layers; - - public GTLayerPattern(List layers) { - this.layers = layers; - } - - public Layer rollNext(@Nullable Layer previous, RandomSource random) { - int totalWeight = 0; - for (Layer layer : layers) - if (layer != previous) - totalWeight += layer.weight; - int rolled = random.nextInt(totalWeight); - - for (Layer layer : layers) { - if (layer == previous) - continue; - rolled -= layer.weight; - if (rolled < 0) - return layer; - } - return null; - } - - public static Builder builder(RuleTest... rules) { - return new Builder(rules); - } - - public static class Builder { - private final List layers = new ArrayList<>(); - private final RuleTest[] rules; - - protected Builder(RuleTest... rules) { - this.rules = rules; - } - - public Builder layer(Consumer builder) { - Layer.Builder layerBuilder = new Layer.Builder(rules); - builder.accept(layerBuilder); - layers.add(layerBuilder.build()); - return this; - } - - public GTLayerPattern build() { - return new GTLayerPattern(layers); - } - } - - public static class Layer { - public static final Codec CODEC = RecordCodecBuilder.create(instance -> instance.group( - Codec.list(Codec.either(TargetBlockState.CODEC.listOf(), GTCEuAPI.materialManager.codec())) - .fieldOf("targets") - .forGetter(layer -> layer.targets), - Codec.intRange(0, Integer.MAX_VALUE) - .fieldOf("min_size") - .forGetter(layer -> layer.minSize), - Codec.intRange(0, Integer.MAX_VALUE) - .fieldOf("max_size") - .forGetter(layer -> layer.maxSize), - Codec.intRange(0, Integer.MAX_VALUE) - .fieldOf("weight") - .forGetter(layer -> layer.weight) - ).apply(instance, Layer::new)); - - public final List, Material>> targets; - public final int minSize; - public final int maxSize; - public final int weight; - - public Layer(List, Material>> targets, int minSize, int maxSize, int weight) { - this.targets = targets; - this.minSize = minSize; - this.maxSize = maxSize; - this.weight = weight; - } - - public Either, Material> rollBlock(RandomSource random) { - if (targets.size() == 1) - return targets.get(0); - return targets.get(random.nextInt(targets.size())); - } - - public static class Builder { - private final List, Material>> targets = new ArrayList<>(); - private int minSize = 1; - private int maxSize = 1; - private int weight = 1; - private final RuleTest[] rules; - - protected Builder(RuleTest... rules) { - this.rules = rules; - } - - public GTLayerPattern.Layer.Builder block(Supplier block) { - return state(block.get().defaultBlockState()); - } - - public GTLayerPattern.Layer.Builder state(Supplier state) { - return state(state.get()); - } - - public GTLayerPattern.Layer.Builder state(BlockState state) { - this.targets.add(Either.left(Arrays.stream(this.rules).map(rule -> OreConfiguration.target(rule, state)).toList())); - return this; - } - - public GTLayerPattern.Layer.Builder mat(Material material) { - this.targets.add(Either.right(material)); - return this; - } - - public GTLayerPattern.Layer.Builder weight(int weight) { - this.weight = weight; - return this; - } - - public GTLayerPattern.Layer.Builder size(int min, int max) { - this.minSize = min; - this.maxSize = max; - return this; - } - - public Layer build() { - return new Layer(targets, minSize, maxSize, weight); - } - } - } + + public static final Codec CODEC = Codec.list(Layer.CODEC) + .xmap(GTLayerPattern::new, pattern -> pattern.layers); + + public final List layers; + + public GTLayerPattern(List layers) { + this.layers = layers; + } + + public Layer rollNext(@Nullable Layer previous, RandomSource random) { + int totalWeight = 0; + for (Layer layer : layers) + if (layer != previous) + totalWeight += layer.weight; + int rolled = random.nextInt(totalWeight); + + for (Layer layer : layers) { + if (layer == previous) + continue; + rolled -= layer.weight; + if (rolled < 0) + return layer; + } + return null; + } + + public static Builder builder(RuleTest... rules) { + return new Builder(rules); + } + + public static class Builder { + + private final List layers = new ArrayList<>(); + private final RuleTest[] rules; + + protected Builder(RuleTest... rules) { + this.rules = rules; + } + + public Builder layer(Consumer builder) { + Layer.Builder layerBuilder = new Layer.Builder(rules); + builder.accept(layerBuilder); + layers.add(layerBuilder.build()); + return this; + } + + public GTLayerPattern build() { + return new GTLayerPattern(layers); + } + } + + public static class Layer { + + public static final Codec CODEC = RecordCodecBuilder.create(instance -> instance.group( + Codec.list(Codec.either(TargetBlockState.CODEC.listOf(), GTCEuAPI.materialManager.codec())) + .fieldOf("targets") + .forGetter(layer -> layer.targets), + Codec.intRange(0, Integer.MAX_VALUE) + .fieldOf("min_size") + .forGetter(layer -> layer.minSize), + Codec.intRange(0, Integer.MAX_VALUE) + .fieldOf("max_size") + .forGetter(layer -> layer.maxSize), + Codec.intRange(0, Integer.MAX_VALUE) + .fieldOf("weight") + .forGetter(layer -> layer.weight)) + .apply(instance, Layer::new)); + + public final List, Material>> targets; + public final int minSize; + public final int maxSize; + public final int weight; + + public Layer(List, Material>> targets, int minSize, int maxSize, int weight) { + this.targets = targets; + this.minSize = minSize; + this.maxSize = maxSize; + this.weight = weight; + } + + public Either, Material> rollBlock(RandomSource random) { + if (targets.size() == 1) + return targets.get(0); + return targets.get(random.nextInt(targets.size())); + } + + public static class Builder { + + private final List, Material>> targets = new ArrayList<>(); + private int minSize = 1; + private int maxSize = 1; + private int weight = 1; + private final RuleTest[] rules; + + protected Builder(RuleTest... rules) { + this.rules = rules; + } + + public GTLayerPattern.Layer.Builder block(Supplier block) { + return state(block.get().defaultBlockState()); + } + + public GTLayerPattern.Layer.Builder state(Supplier state) { + return state(state.get()); + } + + public GTLayerPattern.Layer.Builder state(BlockState state) { + this.targets.add(Either + .left(Arrays.stream(this.rules).map(rule -> OreConfiguration.target(rule, state)).toList())); + return this; + } + + public GTLayerPattern.Layer.Builder mat(Material material) { + this.targets.add(Either.right(material)); + return this; + } + + public GTLayerPattern.Layer.Builder weight(int weight) { + this.weight = weight; + return this; + } + + public GTLayerPattern.Layer.Builder size(int min, int max) { + this.minSize = min; + this.maxSize = max; + return this; + } + + public Layer build() { + return new Layer(targets, minSize, maxSize, weight); + } + } + } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/GTOreDefinition.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/GTOreDefinition.java index c230378be5..0999da193d 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/GTOreDefinition.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/GTOreDefinition.java @@ -6,15 +6,7 @@ import com.gregtechceu.gtceu.api.data.worldgen.generator.veins.*; import com.gregtechceu.gtceu.api.data.worldgen.ores.OreVeinUtil; import com.gregtechceu.gtceu.api.registry.GTRegistries; -import com.mojang.datafixers.util.Pair; -import com.mojang.serialization.Codec; -import com.mojang.serialization.DataResult; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.latvian.mods.rhino.util.HideFromJS; -import lombok.Getter; -import lombok.Setter; -import lombok.experimental.Accessors; -import lombok.experimental.Tolerate; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.HolderSet; import net.minecraft.core.RegistryCodecs; @@ -28,9 +20,18 @@ import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.levelgen.VerticalAnchor; import net.minecraft.world.level.levelgen.placement.HeightRangePlacement; + +import com.mojang.datafixers.util.Pair; +import com.mojang.serialization.Codec; +import com.mojang.serialization.DataResult; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import dev.latvian.mods.rhino.util.HideFromJS; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; +import lombok.experimental.Tolerate; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.*; import java.util.function.Consumer; import java.util.function.Function; @@ -38,6 +39,8 @@ import java.util.stream.Collectors; import java.util.stream.Stream; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author Screret * @date 2023/6/14 @@ -48,10 +51,11 @@ @ParametersAreNonnullByDefault @Accessors(chain = true, fluent = true) public class GTOreDefinition { + public static final Codec CODEC = ResourceLocation.CODEC .flatXmap(rl -> Optional.ofNullable(GTRegistries.ORE_VEINS.get(rl)) - .map(DataResult::success) - .orElseGet(() -> DataResult.error(() -> "No GTOreDefinition with id " + rl + " registered")), + .map(DataResult::success) + .orElseGet(() -> DataResult.error(() -> "No GTOreDefinition with id " + rl + " registered")), obj -> Optional.ofNullable(GTRegistries.ORE_VEINS.getKey(obj)) .map(DataResult::success) .orElseGet(() -> DataResult.error(() -> "GTOreDefinition " + obj + " not registered"))); @@ -61,16 +65,24 @@ public class GTOreDefinition { Codec.floatRange(0.0F, 1.0F).fieldOf("density").forGetter(ft -> ft.density), Codec.INT.fieldOf("weight").forGetter(ft -> ft.weight), IWorldGenLayer.CODEC.fieldOf("layer").forGetter(ft -> ft.layer), - ResourceKey.codec(Registries.DIMENSION).listOf().fieldOf("dimension_filter").forGetter(ft -> new ArrayList<>(ft.dimensionFilter)), + ResourceKey.codec(Registries.DIMENSION).listOf().fieldOf("dimension_filter") + .forGetter(ft -> new ArrayList<>(ft.dimensionFilter)), HeightRangePlacement.CODEC.fieldOf("height_range").forGetter(ft -> ft.range), - Codec.floatRange(0.0F, 1.0F).fieldOf("discard_chance_on_air_exposure").forGetter(ft -> ft.discardChanceOnAirExposure), - RegistryCodecs.homogeneousList(Registries.BIOME).optionalFieldOf("biomes", null).forGetter(ext -> ext.biomes == null ? null : ext.biomes.get()), - BiomeWeightModifier.CODEC.optionalFieldOf("weight_modifier", null).forGetter(ext -> ext.biomeWeightModifier), + Codec.floatRange(0.0F, 1.0F).fieldOf("discard_chance_on_air_exposure") + .forGetter(ft -> ft.discardChanceOnAirExposure), + RegistryCodecs.homogeneousList(Registries.BIOME).optionalFieldOf("biomes", null) + .forGetter(ext -> ext.biomes == null ? null : ext.biomes.get()), + BiomeWeightModifier.CODEC.optionalFieldOf("weight_modifier", null) + .forGetter(ext -> ext.biomeWeightModifier), VeinGenerator.DIRECT_CODEC.fieldOf("generator").forGetter(ft -> ft.veinGenerator), - Codec.list(IndicatorGenerator.DIRECT_CODEC).fieldOf("indicators").forGetter(ft -> ft.indicatorGenerators) - ).apply(instance, (clusterSize, density, weight, layer, dimensionFilter, range, discardChanceOnAirExposure, biomes, biomeWeightModifier, veinGenerator, indicatorGenerators) -> - new GTOreDefinition(clusterSize, density, weight, layer, new HashSet<>(dimensionFilter), range, discardChanceOnAirExposure, biomes == null ? null : () -> biomes, biomeWeightModifier, veinGenerator, indicatorGenerators)) - ); + Codec.list(IndicatorGenerator.DIRECT_CODEC).fieldOf("indicators") + .forGetter(ft -> ft.indicatorGenerators)) + .apply(instance, + (clusterSize, density, weight, layer, dimensionFilter, range, discardChanceOnAirExposure, + biomes, biomeWeightModifier, veinGenerator, indicatorGenerators) -> new GTOreDefinition( + clusterSize, density, weight, layer, new HashSet<>(dimensionFilter), range, + discardChanceOnAirExposure, biomes == null ? null : () -> biomes, + biomeWeightModifier, veinGenerator, indicatorGenerators))); private final InferredProperties inferredProperties = new InferredProperties(); @@ -82,32 +94,41 @@ public class GTOreDefinition { private int weight; @Getter private IWorldGenLayer layer; - @Getter @Setter + @Getter + @Setter private Set> dimensionFilter; - @Getter @Setter + @Getter + @Setter private HeightRangePlacement range; - @Getter @Setter + @Getter + @Setter private float discardChanceOnAirExposure; @Getter private Supplier> biomes; - @Getter @Setter + @Getter + @Setter private BiomeWeightModifier biomeWeightModifier; - @Getter @Setter + @Getter + @Setter private VeinGenerator veinGenerator; - @Getter @Setter + @Getter + @Setter private List indicatorGenerators; public GTOreDefinition(GTOreDefinition other) { this( other.clusterSize, other.density, other.weight, other.layer, Set.copyOf(other.dimensionFilter), other.range, other.discardChanceOnAirExposure, - other.biomes, other.biomeWeightModifier, other.veinGenerator, List.copyOf(other.indicatorGenerators) - ); + other.biomes, other.biomeWeightModifier, other.veinGenerator, List.copyOf(other.indicatorGenerators)); } - public GTOreDefinition(IntProvider clusterSize, float density, int weight, IWorldGenLayer layer, Set> dimensionFilter, HeightRangePlacement range, float discardChanceOnAirExposure, @Nullable Supplier> biomes, @Nullable BiomeWeightModifier biomeWeightModifier, @Nullable VeinGenerator veinGenerator, @Nullable List indicatorGenerators) { + public GTOreDefinition(IntProvider clusterSize, float density, int weight, IWorldGenLayer layer, + Set> dimensionFilter, HeightRangePlacement range, + float discardChanceOnAirExposure, @Nullable Supplier> biomes, + @Nullable BiomeWeightModifier biomeWeightModifier, @Nullable VeinGenerator veinGenerator, + @Nullable List indicatorGenerators) { this.clusterSize = clusterSize; this.density = density; this.weight = weight; @@ -273,7 +294,8 @@ public GTOreDefinition cuboidVeinGenerator(Consumer config) @Nullable public VeinGenerator veinGenerator(ResourceLocation id) { if (veinGenerator == null) { - veinGenerator = WorldGeneratorUtils.VEIN_GENERATOR_FUNCTIONS.containsKey(id) ? WorldGeneratorUtils.VEIN_GENERATOR_FUNCTIONS.get(id).apply(this) : null; + veinGenerator = WorldGeneratorUtils.VEIN_GENERATOR_FUNCTIONS.containsKey(id) ? + WorldGeneratorUtils.VEIN_GENERATOR_FUNCTIONS.get(id).apply(this) : null; } return veinGenerator; } @@ -283,7 +305,8 @@ public GTOreDefinition surfaceIndicatorGenerator(Consumer T getOrCreateIndicatorGenerator(Class indicatorClass, Function constructor) { + private T getOrCreateIndicatorGenerator(Class indicatorClass, + Function constructor) { var existingGenerator = indicatorGenerators.stream() .filter(indicatorClass::isInstance) .map(indicatorClass::cast) @@ -298,6 +321,7 @@ private T getOrCreateIndicatorGenerator(Class } private static class InferredProperties { + public Pair heightRange = null; } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/IWorldGenLayer.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/IWorldGenLayer.java index 0d16437567..645e0155e0 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/IWorldGenLayer.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/IWorldGenLayer.java @@ -1,12 +1,13 @@ package com.gregtechceu.gtceu.api.data.worldgen; -import com.mojang.serialization.Codec; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.ExtraCodecs; import net.minecraft.util.StringRepresentable; import net.minecraft.world.level.levelgen.structure.templatesystem.AlwaysTrueTest; import net.minecraft.world.level.levelgen.structure.templatesystem.RuleTest; +import com.mojang.serialization.Codec; + import java.util.Set; /** @@ -15,20 +16,24 @@ * @implNote IWorldGenLayer */ public interface IWorldGenLayer extends StringRepresentable { - Codec CODEC = ExtraCodecs.stringResolverCodec(StringRepresentable::getSerializedName, WorldGeneratorUtils.WORLD_GEN_LAYERS::get); + + Codec CODEC = ExtraCodecs.stringResolverCodec(StringRepresentable::getSerializedName, + WorldGeneratorUtils.WORLD_GEN_LAYERS::get); boolean isApplicableForLevel(ResourceLocation level); + Set getLevels(); - RuleTest getTarget(); + RuleTest getTarget(); @FunctionalInterface interface RuleTestSupplier { + RuleTest get(); } - IWorldGenLayer NOWHERE = new IWorldGenLayer() { + @Override public boolean isApplicableForLevel(ResourceLocation level) { return false; diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/RTTTree.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/RTTTree.java index 207dc432d2..2017bc664c 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/RTTTree.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/RTTTree.java @@ -1,8 +1,8 @@ package com.gregtechceu.gtceu.api.data.worldgen; -import lombok.Getter; import net.minecraft.core.BlockPos; -import net.minecraft.core.Vec3i; + +import lombok.Getter; import java.util.ArrayList; import java.util.List; @@ -40,5 +40,4 @@ public BlockPos nearestNode(BlockPos random) { public void addNode(BlockPos node) { this.nodes.add(node); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/SimpleWorldGenLayer.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/SimpleWorldGenLayer.java index ce8aa8b3bf..7ee15fe8bc 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/SimpleWorldGenLayer.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/SimpleWorldGenLayer.java @@ -1,14 +1,15 @@ package com.gregtechceu.gtceu.api.data.worldgen; -import com.mojang.serialization.JsonOps; -import lombok.Getter; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.levelgen.structure.templatesystem.RuleTest; +import com.mojang.serialization.JsonOps; +import lombok.Getter; + import java.util.Set; -import java.util.function.Supplier; public class SimpleWorldGenLayer implements IWorldGenLayer { + private final String name; private final IWorldGenLayer.RuleTestSupplier target; @Getter @@ -28,7 +29,8 @@ public String getSerializedName() { @Override public String toString() { - return getSerializedName() + "[" + RuleTest.CODEC.encodeStart(JsonOps.INSTANCE, target.get()).result().orElse(null) + "]"; + return getSerializedName() + "[" + + RuleTest.CODEC.encodeStart(JsonOps.INSTANCE, target.get()).result().orElse(null) + "]"; } @Override diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/WorldGenLayers.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/WorldGenLayers.java index 01f9ab25ae..4aefcf064e 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/WorldGenLayers.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/WorldGenLayers.java @@ -4,14 +4,16 @@ import com.gregtechceu.gtceu.api.addon.AddonFinder; import com.gregtechceu.gtceu.api.addon.IGTAddon; import com.gregtechceu.gtceu.integration.kjs.GTRegistryInfo; -import lombok.Getter; -import lombok.Setter; + import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.BlockTags; import net.minecraft.util.StringRepresentable; import net.minecraft.world.level.Level; import net.minecraft.world.level.levelgen.structure.templatesystem.RuleTest; import net.minecraft.world.level.levelgen.structure.templatesystem.TagMatchTest; + +import lombok.Getter; +import lombok.Setter; import org.jetbrains.annotations.NotNull; import java.util.Set; @@ -22,31 +24,30 @@ * @implNote WorldGenLayers */ public enum WorldGenLayers implements IWorldGenLayer, StringRepresentable { + STONE( "stone", new TagMatchTest(BlockTags.STONE_ORE_REPLACEABLES), - Set.of(Level.OVERWORLD.location()) - ), + Set.of(Level.OVERWORLD.location())), DEEPSLATE( "deepslate", new TagMatchTest(BlockTags.DEEPSLATE_ORE_REPLACEABLES), - Set.of(Level.OVERWORLD.location()) - ), + Set.of(Level.OVERWORLD.location())), NETHERRACK( "netherrack", new TagMatchTest(BlockTags.NETHER_CARVER_REPLACEABLES), - Set.of(Level.NETHER.location()) - ), + Set.of(Level.NETHER.location())), ENDSTONE( "endstone", WorldGeneratorUtils.END_ORE_REPLACEABLES, - Set.of(Level.END.location()) - ); + Set.of(Level.END.location())); private final String name; @SuppressWarnings("NonFinalFieldInEnum") - @Getter @Setter + @Getter + @Setter private Set levels; @SuppressWarnings("NonFinalFieldInEnum") - @Getter @Setter + @Getter + @Setter private RuleTest target; WorldGenLayers(String name, RuleTest target, Set levels) { @@ -63,8 +64,6 @@ public static void registerAll() { } } - - public static IWorldGenLayer getByName(String name) { return WorldGeneratorUtils.WORLD_GEN_LAYERS.get(name); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/WorldGeneratorUtils.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/WorldGeneratorUtils.java index 0d8d10c04f..dd544ce715 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/WorldGeneratorUtils.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/WorldGeneratorUtils.java @@ -1,14 +1,10 @@ package com.gregtechceu.gtceu.api.data.worldgen; -import com.google.common.collect.HashBiMap; import com.gregtechceu.gtceu.api.data.worldgen.generator.IndicatorGenerator; import com.gregtechceu.gtceu.api.data.worldgen.generator.VeinGenerator; import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.data.recipe.CustomTags; -import com.mojang.serialization.Codec; -import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; -import it.unimi.dsi.fastutil.objects.ObjectArrayList; + import net.minecraft.core.BlockPos; import net.minecraft.core.Holder; import net.minecraft.resources.ResourceKey; @@ -23,6 +19,12 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.RuleTest; import net.minecraft.world.level.levelgen.structure.templatesystem.TagMatchTest; +import com.google.common.collect.HashBiMap; +import com.mojang.serialization.Codec; +import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import it.unimi.dsi.fastutil.objects.ObjectArrayList; + import java.util.*; import java.util.Map.Entry; import java.util.function.Consumer; @@ -31,25 +33,32 @@ import java.util.stream.Collectors; public class WorldGeneratorUtils { + public static final RuleTest END_ORE_REPLACEABLES = new TagMatchTest(CustomTags.ENDSTONE_ORE_REPLACEABLES); private static final Map oreVeinCache = new WeakHashMap<>(); public static final SortedMap WORLD_GEN_LAYERS = new Object2ObjectLinkedOpenHashMap<>(); - public static final HashBiMap> VEIN_GENERATORS = HashBiMap.create(); - public static final HashBiMap> VEIN_GENERATOR_FUNCTIONS = HashBiMap.create(); + public static final HashBiMap> VEIN_GENERATORS = HashBiMap + .create(); + public static final HashBiMap> VEIN_GENERATOR_FUNCTIONS = HashBiMap + .create(); - public static final HashBiMap> INDICATOR_GENERATORS = HashBiMap.create(); - public static final HashBiMap> INDICATOR_GENERATOR_FUNCTIONS = HashBiMap.create(); + public static final HashBiMap> INDICATOR_GENERATORS = HashBiMap + .create(); + public static final HashBiMap> INDICATOR_GENERATOR_FUNCTIONS = HashBiMap + .create(); private static class WorldOreVeinCache { + private final List worldVeins; private final List> veins = new LinkedList<>(); public WorldOreVeinCache(ServerLevel level) { this.worldVeins = GTRegistries.ORE_VEINS.values().stream() - .filter(entry -> entry.dimensionFilter().stream().anyMatch(dim -> WorldGeneratorUtils.isSameDimension(dim, level.dimension()))) + .filter(entry -> entry.dimensionFilter().stream() + .anyMatch(dim -> WorldGeneratorUtils.isSameDimension(dim, level.dimension()))) .collect(Collectors.toList()); } @@ -58,7 +67,10 @@ private List> getEntry(Holder biome) { return veins; List> result = worldVeins.stream() .filter(entry -> entry.biomes() == null || entry.biomes().get().contains(biome)) - .map(vein -> new AbstractMap.SimpleEntry<>(vein.weight() + (vein.biomeWeightModifier() == null ? 0 : vein.biomeWeightModifier().apply(biome)), vein)) + .map(vein -> new AbstractMap.SimpleEntry<>( + vein.weight() + + (vein.biomeWeightModifier() == null ? 0 : vein.biomeWeightModifier().apply(biome)), + vein)) .filter(entry -> entry.getKey() > 0) .collect(Collectors.toList()); veins.addAll(result); @@ -66,7 +78,8 @@ private List> getEntry(Holder biome) { } } - public static List> getCachedBiomeVeins(ServerLevel level, Holder biome, RandomSource random) { + public static List> getCachedBiomeVeins(ServerLevel level, Holder biome, + RandomSource random) { if (oreVeinCache.containsKey(level)) return oreVeinCache.get(level).getEntry(biome); WorldOreVeinCache worldOreVeinCache = new WorldOreVeinCache(level); @@ -89,8 +102,7 @@ public static Map> groupByChunks(Map return input.entrySet().stream().collect(Collectors.groupingBy( entry -> new ChunkPos(entry.getKey()), Object2ObjectOpenHashMap::new, - Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (a, b) -> a, Object2ObjectOpenHashMap::new) - )); + Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (a, b) -> a, Object2ObjectOpenHashMap::new))); } public static Map> groupByChunks(Collection positions) { diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/bedrockfluid/BedrockFluidDefinition.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/bedrockfluid/BedrockFluidDefinition.java index 70ebcaeb07..b365117b83 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/bedrockfluid/BedrockFluidDefinition.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/bedrockfluid/BedrockFluidDefinition.java @@ -4,18 +4,9 @@ import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.common.data.GTBedrockFluids; import com.gregtechceu.gtceu.utils.RegistryUtil; -import com.mojang.datafixers.util.Pair; -import com.mojang.serialization.Codec; -import com.mojang.serialization.MapCodec; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.latvian.mods.rhino.util.HideFromJS; -import lombok.Getter; -import lombok.Setter; -import lombok.experimental.Accessors; + import net.minecraft.core.Holder; import net.minecraft.core.HolderSet; -import net.minecraft.core.Registry; -import net.minecraft.core.RegistryCodecs; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceKey; @@ -23,15 +14,24 @@ import net.minecraft.tags.TagKey; import net.minecraft.world.level.Level; import net.minecraft.world.level.biome.Biome; -import net.minecraft.world.level.dimension.DimensionType; import net.minecraft.world.level.material.Fluid; +import com.mojang.datafixers.util.Pair; +import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import dev.latvian.mods.rhino.util.HideFromJS; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + import java.util.*; import java.util.function.Supplier; -import java.util.stream.Collectors; public class BedrockFluidDefinition { - public static final MapCodec> YIELD = Codec.mapPair(Codec.INT.fieldOf("min"), Codec.INT.fieldOf("max")); + + public static final MapCodec> YIELD = Codec.mapPair(Codec.INT.fieldOf("min"), + Codec.INT.fieldOf("max")); public static final Codec FULL_CODEC = RecordCodecBuilder.create( instance -> instance.group( @@ -41,35 +41,55 @@ public class BedrockFluidDefinition { Codec.INT.fieldOf("depletion_chance").forGetter(ft -> ft.depletionChance), Codec.INT.fieldOf("depleted_yield").forGetter(ft -> ft.depletedYield), BuiltInRegistries.FLUID.byNameCodec().fieldOf("fluid").forGetter(ft -> ft.storedFluid.get()), - BiomeWeightModifier.CODEC.listOf().optionalFieldOf("weight_modifier", null).forGetter(ft -> ft.originalModifiers), - ResourceKey.codec(Registries.DIMENSION).listOf().fieldOf("dimension_filter").forGetter(ft -> new ArrayList<>(ft.dimensionFilter)) - ).apply(instance, (weight, yield, depletionAmount, depletionChance, depletedYield, storedFluid, biomeWeightModifier, dimensionFilter) -> new BedrockFluidDefinition(weight, yield.getFirst(), yield.getSecond(), depletionAmount, depletionChance, depletedYield, () -> storedFluid, biomeWeightModifier, new HashSet<>(dimensionFilter))) - ); + BiomeWeightModifier.CODEC.listOf().optionalFieldOf("weight_modifier", null) + .forGetter(ft -> ft.originalModifiers), + ResourceKey.codec(Registries.DIMENSION).listOf().fieldOf("dimension_filter") + .forGetter(ft -> new ArrayList<>(ft.dimensionFilter))) + .apply(instance, + (weight, yield, depletionAmount, depletionChance, depletedYield, storedFluid, + biomeWeightModifier, dimensionFilter) -> new BedrockFluidDefinition(weight, + yield.getFirst(), yield.getSecond(), depletionAmount, depletionChance, + depletedYield, () -> storedFluid, biomeWeightModifier, + new HashSet<>(dimensionFilter)))); - @Getter @Setter + @Getter + @Setter private int weight; // weight value for determining which vein will appear - @Getter @Setter + @Getter + @Setter private int minimumYield, maximumYield;// the [minimum, maximum) yields - @Getter @Setter + @Getter + @Setter private int depletionAmount; // amount of fluid the vein gets drained by - @Getter @Setter + @Getter + @Setter private int depletionChance; // the chance [0, 100] that the vein will deplete by 1 - @Getter @Setter + @Getter + @Setter private int depletedYield; // yield after the vein is depleted - @Getter @Setter + @Getter + @Setter private Supplier storedFluid; // the fluid which the vein contains @Getter private BiomeWeightModifier biomeWeightModifier; // weighting of biomes private List originalModifiers; // weighting of biomes - @Getter @Setter + @Getter + @Setter public Set> dimensionFilter; // filtering of dimensions - public BedrockFluidDefinition(ResourceLocation name, int weight, int minimumYield, int maximumYield, int depletionAmount, int depletionChance, int depletedYield, Supplier storedFluid, List originalModifiers, Set> dimensionFilter) { - this(weight, minimumYield, maximumYield, depletionAmount, depletionChance, depletedYield, storedFluid, originalModifiers, dimensionFilter); + public BedrockFluidDefinition(ResourceLocation name, int weight, int minimumYield, int maximumYield, + int depletionAmount, int depletionChance, int depletedYield, + Supplier storedFluid, List originalModifiers, + Set> dimensionFilter) { + this(weight, minimumYield, maximumYield, depletionAmount, depletionChance, depletedYield, storedFluid, + originalModifiers, dimensionFilter); GTRegistries.BEDROCK_FLUID_DEFINITIONS.register(name, this); } - public BedrockFluidDefinition(int weight, int minimumYield, int maximumYield, int depletionAmount, int depletionChance, int depletedYield, Supplier storedFluid, List originalModifiers, Set> dimensionFilter) { + public BedrockFluidDefinition(int weight, int minimumYield, int maximumYield, int depletionAmount, + int depletionChance, int depletedYield, Supplier storedFluid, + List originalModifiers, + Set> dimensionFilter) { this.weight = weight; this.minimumYield = minimumYield; this.maximumYield = maximumYield; @@ -78,7 +98,10 @@ public BedrockFluidDefinition(int weight, int minimumYield, int maximumYield, in this.depletedYield = depletedYield; this.storedFluid = storedFluid; this.originalModifiers = originalModifiers; - this.biomeWeightModifier = new BiomeWeightModifier(() -> HolderSet.direct(originalModifiers.stream().flatMap(mod -> mod.biomes.get().stream()).toList()), originalModifiers.stream().mapToInt(mod -> mod.addedWeight).sum()) { + this.biomeWeightModifier = new BiomeWeightModifier( + () -> HolderSet.direct(originalModifiers.stream().flatMap(mod -> mod.biomes.get().stream()).toList()), + originalModifiers.stream().mapToInt(mod -> mod.addedWeight).sum()) { + @Override public Integer apply(Holder biome) { int mod = 0; @@ -95,7 +118,10 @@ public Integer apply(Holder biome) { public void setOriginalModifiers(List modifiers) { this.originalModifiers = modifiers; - this.biomeWeightModifier = new BiomeWeightModifier(() -> HolderSet.direct(originalModifiers.stream().flatMap(mod -> mod.biomes.get().stream()).toList()), originalModifiers.stream().mapToInt(mod -> mod.addedWeight).sum()) { + this.biomeWeightModifier = new BiomeWeightModifier( + () -> HolderSet.direct(originalModifiers.stream().flatMap(mod -> mod.biomes.get().stream()).toList()), + originalModifiers.stream().mapToInt(mod -> mod.addedWeight).sum()) { + @Override public Integer apply(Holder biome) { int mod = 0; @@ -115,6 +141,7 @@ public static Builder builder(ResourceLocation name) { @Accessors(chain = true, fluent = true) public static class Builder { + private final ResourceLocation name; @Setter private int weight; // weight value for determining which vein will appear @@ -180,10 +207,10 @@ public Builder dimensions(String... dimensions) { } public BedrockFluidDefinition register() { - var definition = new BedrockFluidDefinition(weight, minimumYield, maximumYield, depletionAmount, depletionChance, depletedYield, fluid, biomes, dimensions); + var definition = new BedrockFluidDefinition(weight, minimumYield, maximumYield, depletionAmount, + depletionChance, depletedYield, fluid, biomes, dimensions); GTBedrockFluids.toReRegister.put(name, definition); return definition; } } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/bedrockfluid/BedrockFluidVeinSavedData.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/bedrockfluid/BedrockFluidVeinSavedData.java index b050271128..bd70abb4c6 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/bedrockfluid/BedrockFluidVeinSavedData.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/bedrockfluid/BedrockFluidVeinSavedData.java @@ -3,6 +3,7 @@ import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.data.worldgen.WorldGeneratorUtils; import com.gregtechceu.gtceu.api.registry.GTRegistries; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Holder; @@ -17,10 +18,12 @@ import net.minecraft.world.level.saveddata.SavedData; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; + import java.util.HashMap; import java.util.Objects; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author KilaBash * @date 2023/7/11 @@ -29,6 +32,7 @@ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class BedrockFluidVeinSavedData extends SavedData { + public static final int VEIN_CHUNK_SIZE = 8; // veins are 8x8 chunk squares public static final int MAXIMUM_VEIN_OPERATIONS = 100_000; public final HashMap veinFluids = new HashMap<>(); @@ -39,7 +43,8 @@ public class BedrockFluidVeinSavedData extends SavedData { private final ServerLevel serverLevel; public static BedrockFluidVeinSavedData getOrCreate(ServerLevel serverLevel) { - return serverLevel.getDataStorage().computeIfAbsent(tag -> new BedrockFluidVeinSavedData(serverLevel, tag), () -> new BedrockFluidVeinSavedData(serverLevel), "gtceu_bedrock_fluid"); + return serverLevel.getDataStorage().computeIfAbsent(tag -> new BedrockFluidVeinSavedData(serverLevel, tag), + () -> new BedrockFluidVeinSavedData(serverLevel), "gtceu_bedrock_fluid"); } public BedrockFluidVeinSavedData(ServerLevel serverLevel) { @@ -81,14 +86,19 @@ public FluidVeinWorldEntry getFluidVeinWorldEntry(int chunkX, int chunkZ) { ChunkPos pos = new ChunkPos(chunkX, chunkZ); if (!veinFluids.containsKey(pos)) { BedrockFluidDefinition definition = null; - int query = RandomSource.create(Objects.hash(serverLevel.getSeed(), chunkX / VEIN_CHUNK_SIZE, chunkZ / VEIN_CHUNK_SIZE)).nextInt(); + int query = RandomSource + .create(Objects.hash(serverLevel.getSeed(), chunkX / VEIN_CHUNK_SIZE, chunkZ / VEIN_CHUNK_SIZE)) + .nextInt(); var biome = serverLevel.getBiome(new BlockPos(chunkX << 4, 64, chunkZ << 4)); int totalWeight = getTotalWeight(biome); if (totalWeight > 0) { int weight = Math.abs(query % totalWeight); for (var fluidDefinition : GTRegistries.BEDROCK_FLUID_DEFINITIONS) { - int veinWeight = fluidDefinition.getWeight() + fluidDefinition.getBiomeWeightModifier().apply(biome); - if (veinWeight > 0 && (fluidDefinition.getDimensionFilter() == null || fluidDefinition.getDimensionFilter().stream().anyMatch(dim -> WorldGeneratorUtils.isSameDimension(dim, serverLevel.dimension())))) { + int veinWeight = fluidDefinition.getWeight() + + fluidDefinition.getBiomeWeightModifier().apply(biome); + if (veinWeight > 0 && (fluidDefinition.getDimensionFilter() == null || + fluidDefinition.getDimensionFilter().stream().anyMatch( + dim -> WorldGeneratorUtils.isSameDimension(dim, serverLevel.dimension())))) { weight -= veinWeight; if (weight < 0) { definition = fluidDefinition; @@ -105,7 +115,8 @@ public FluidVeinWorldEntry getFluidVeinWorldEntry(int chunkX, int chunkZ) { if (definition.getMaximumYield() - definition.getMinimumYield() <= 0) { maximumYield = definition.getMinimumYield(); } else { - maximumYield = random.nextInt(definition.getMaximumYield() - definition.getMinimumYield()) + definition.getMinimumYield(); + maximumYield = random.nextInt(definition.getMaximumYield() - definition.getMinimumYield()) + + definition.getMinimumYield(); } maximumYield = Math.min(maximumYield, definition.getMaximumYield()); } @@ -118,14 +129,15 @@ public FluidVeinWorldEntry getFluidVeinWorldEntry(int chunkX, int chunkZ) { /** * Gets the total weight of all veins for the given dimension ID and biome type * - * @param biome The biome type to check + * @param biome The biome type to check * @return The total weight associated with the dimension/biome pair */ public int getTotalWeight(Holder biome) { return biomeWeights.computeIfAbsent(biome, b -> { int totalWeight = 0; for (var definition : GTRegistries.BEDROCK_FLUID_DEFINITIONS) { - if (definition.getDimensionFilter() == null || definition.getDimensionFilter().stream().anyMatch(dim -> WorldGeneratorUtils.isSameDimension(dim, serverLevel.dimension()))) { + if (definition.getDimensionFilter() == null || definition.getDimensionFilter().stream() + .anyMatch(dim -> WorldGeneratorUtils.isSameDimension(dim, serverLevel.dimension()))) { totalWeight += definition.getBiomeWeightModifier().apply(biome); totalWeight += definition.getWeight(); } @@ -213,5 +225,4 @@ public void depleteVein(int chunkX, int chunkZ, int amount, boolean ignoreVeinSt setDirty(); } } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/bedrockfluid/FluidVeinWorldEntry.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/bedrockfluid/FluidVeinWorldEntry.java index 950050af5a..411090358c 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/bedrockfluid/FluidVeinWorldEntry.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/bedrockfluid/FluidVeinWorldEntry.java @@ -2,10 +2,11 @@ import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.config.ConfigHolder; -import lombok.Getter; + import net.minecraft.nbt.CompoundTag; import net.minecraft.resources.ResourceLocation; +import lombok.Getter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -15,6 +16,7 @@ * @implNote FluidVeinWorldEntry */ public class FluidVeinWorldEntry { + @Nullable @Getter private BedrockFluidDefinition vein; @@ -29,9 +31,7 @@ public FluidVeinWorldEntry(@Nullable BedrockFluidDefinition vein, int fluidYield this.operationsRemaining = operationsRemaining; } - private FluidVeinWorldEntry() { - - } + private FluidVeinWorldEntry() {} public BedrockFluidDefinition getDefinition() { return this.vein; @@ -43,7 +43,8 @@ public void setOperationsRemaining(int amount) { } public void decreaseOperations(int amount) { - operationsRemaining = ConfigHolder.INSTANCE.worldgen.oreVeins.infiniteBedrockOresFluids ? operationsRemaining : Math.max(0, operationsRemaining - amount); + operationsRemaining = ConfigHolder.INSTANCE.worldgen.oreVeins.infiniteBedrockOresFluids ? operationsRemaining : + Math.max(0, operationsRemaining - amount); } public CompoundTag writeToNBT() { @@ -63,7 +64,10 @@ public static FluidVeinWorldEntry readFromNBT(@NotNull CompoundTag tag) { info.operationsRemaining = tag.getInt("operationsRemaining"); if (tag.contains("vein")) { - info.vein = GTRegistries.BEDROCK_FLUID_DEFINITIONS.get(new ResourceLocation(tag.getString("vein"))); + ResourceLocation id = new ResourceLocation(tag.getString("vein")); + if (GTRegistries.BEDROCK_FLUID_DEFINITIONS.containKey(id)) { + info.vein = GTRegistries.BEDROCK_FLUID_DEFINITIONS.get(id); + } } return info; } diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/bedrockore/BedrockOreDefinition.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/bedrockore/BedrockOreDefinition.java index a1bf13e214..0ffc8d08bf 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/bedrockore/BedrockOreDefinition.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/bedrockore/BedrockOreDefinition.java @@ -6,14 +6,7 @@ import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.common.data.GTOres; import com.gregtechceu.gtceu.utils.RegistryUtil; -import com.mojang.datafixers.util.Pair; -import com.mojang.serialization.Codec; -import com.mojang.serialization.MapCodec; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import dev.latvian.mods.rhino.util.HideFromJS; -import lombok.Getter; -import lombok.Setter; -import lombok.experimental.Accessors; + import net.minecraft.core.Holder; import net.minecraft.core.HolderSet; import net.minecraft.core.registries.Registries; @@ -26,11 +19,22 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.biome.Biome; +import com.mojang.datafixers.util.Pair; +import com.mojang.serialization.Codec; +import com.mojang.serialization.MapCodec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import dev.latvian.mods.rhino.util.HideFromJS; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; + import java.util.*; @Accessors(fluent = true, chain = true) public class BedrockOreDefinition { - public static final MapCodec> MATERIAL = Codec.mapPair(GTCEuAPI.materialManager.codec().fieldOf("material"), Codec.INT.fieldOf("chance")); + + public static final MapCodec> MATERIAL = Codec + .mapPair(GTCEuAPI.materialManager.codec().fieldOf("material"), Codec.INT.fieldOf("chance")); public static final Codec FULL_CODEC = RecordCodecBuilder.create( instance -> instance.group( @@ -41,37 +45,55 @@ public class BedrockOreDefinition { ExtraCodecs.intRange(0, 100).fieldOf("depletion_chance").forGetter(ft -> ft.depletionChance), Codec.INT.fieldOf("depleted_yield").forGetter(ft -> ft.depletedYield), MATERIAL.codec().listOf().fieldOf("materials").forGetter(ft -> ft.materials), - BiomeWeightModifier.CODEC.listOf().optionalFieldOf("weight_modifier", List.of()).forGetter(ft -> ft.originalModifiers), - ResourceKey.codec(Registries.DIMENSION).listOf().fieldOf("dimension_filter").forGetter(ft -> new ArrayList<>(ft.dimensionFilter)) - ).apply(instance, (weight, size, yield, depletionAmount, depletionChance, depletedYield, materials, biomeWeightModifier, dimensionFilter) -> new BedrockOreDefinition(weight, size, yield, depletionAmount, depletionChance, depletedYield, materials, biomeWeightModifier, new HashSet<>(dimensionFilter))) - ); + BiomeWeightModifier.CODEC.listOf().optionalFieldOf("weight_modifier", List.of()) + .forGetter(ft -> ft.originalModifiers), + ResourceKey.codec(Registries.DIMENSION).listOf().fieldOf("dimension_filter") + .forGetter(ft -> new ArrayList<>(ft.dimensionFilter))) + .apply(instance, + (weight, size, yield, depletionAmount, depletionChance, depletedYield, materials, + biomeWeightModifier, dimensionFilter) -> new BedrockOreDefinition(weight, size, yield, + depletionAmount, depletionChance, depletedYield, materials, biomeWeightModifier, + new HashSet<>(dimensionFilter)))); - @Getter @Setter + @Getter + @Setter private int weight; // weight value for determining which vein will appear - @Getter @Setter + @Getter + @Setter private int size; // size in chunks - @Getter @Setter + @Getter + @Setter private IntProvider yield;// the [minimum, maximum] yields - @Getter @Setter + @Getter + @Setter private int depletionAmount; // amount of ore the vein gets drained by - @Getter @Setter + @Getter + @Setter private int depletionChance; // the chance [0, 100] that the vein will deplete by 1 - @Getter @Setter + @Getter + @Setter private int depletedYield; // yield after the vein is depleted - @Getter @Setter + @Getter + @Setter private List> materials; // the ores which the vein contains @Getter private BiomeWeightModifier biomeWeightModifier; // weighting of biomes private List originalModifiers; // weighting of biomes - @Getter @Setter + @Getter + @Setter public Set> dimensionFilter; // filtering of dimensions - public BedrockOreDefinition(ResourceLocation name, int size, int weight, IntProvider yield, int depletionAmount, int depletionChance, int depletedYield, List> materials, List originalModifiers, Set> dimensionFilter) { - this(weight, size, yield, depletionAmount, depletionChance, depletedYield, materials, originalModifiers, dimensionFilter); + public BedrockOreDefinition(ResourceLocation name, int size, int weight, IntProvider yield, int depletionAmount, + int depletionChance, int depletedYield, List> materials, + List originalModifiers, Set> dimensionFilter) { + this(weight, size, yield, depletionAmount, depletionChance, depletedYield, materials, originalModifiers, + dimensionFilter); GTRegistries.BEDROCK_ORE_DEFINITIONS.register(name, this); } - public BedrockOreDefinition(int weight, int size, IntProvider yield, int depletionAmount, int depletionChance, int depletedYield, List> materials, List originalModifiers, Set> dimensionFilter) { + public BedrockOreDefinition(int weight, int size, IntProvider yield, int depletionAmount, int depletionChance, + int depletedYield, List> materials, + List originalModifiers, Set> dimensionFilter) { this.weight = weight; this.size = size; this.yield = yield; @@ -80,7 +102,10 @@ public BedrockOreDefinition(int weight, int size, IntProvider yield, int depleti this.depletedYield = depletedYield; this.materials = materials; this.originalModifiers = originalModifiers; - this.biomeWeightModifier = new BiomeWeightModifier(() -> HolderSet.direct(originalModifiers.stream().flatMap(mod -> mod.biomes.get().stream()).toList()), originalModifiers.stream().mapToInt(mod -> mod.addedWeight).sum()) { + this.biomeWeightModifier = new BiomeWeightModifier( + () -> HolderSet.direct(originalModifiers.stream().flatMap(mod -> mod.biomes.get().stream()).toList()), + originalModifiers.stream().mapToInt(mod -> mod.addedWeight).sum()) { + @Override public Integer apply(Holder biome) { int mod = 0; @@ -97,7 +122,10 @@ public Integer apply(Holder biome) { public void setOriginalModifiers(List modifiers) { this.originalModifiers = modifiers; - this.biomeWeightModifier = new BiomeWeightModifier(() -> HolderSet.direct(originalModifiers.stream().flatMap(mod -> mod.biomes.get().stream()).toList()), originalModifiers.stream().mapToInt(mod -> mod.addedWeight).sum()) { + this.biomeWeightModifier = new BiomeWeightModifier( + () -> HolderSet.direct(originalModifiers.stream().flatMap(mod -> mod.biomes.get().stream()).toList()), + originalModifiers.stream().mapToInt(mod -> mod.addedWeight).sum()) { + @Override public Integer apply(Holder biome) { int mod = 0; @@ -117,6 +145,7 @@ public static Builder builder(ResourceLocation name) { @Accessors(chain = true, fluent = true) public static class Builder { + private final ResourceLocation name; @Setter private int weight; // weight value for determining which vein will appear @@ -189,10 +218,10 @@ public Builder dimensions(String... dimensions) { } public BedrockOreDefinition register() { - var definition = new BedrockOreDefinition(weight, size, yield, depletionAmount, depletionChance, depletedYield, materials, biomes, dimensions); + var definition = new BedrockOreDefinition(weight, size, yield, depletionAmount, depletionChance, + depletedYield, materials, biomes, dimensions); GTOres.toReRegisterBedrock.put(name, definition); return definition; } } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/bedrockore/BedrockOreVeinSavedData.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/bedrockore/BedrockOreVeinSavedData.java index 8e564bf454..ff66636585 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/bedrockore/BedrockOreVeinSavedData.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/bedrockore/BedrockOreVeinSavedData.java @@ -5,10 +5,10 @@ import com.gregtechceu.gtceu.api.data.worldgen.WorldGeneratorUtils; import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.config.ConfigHolder; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Holder; -import net.minecraft.core.SectionPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.nbt.Tag; @@ -19,13 +19,15 @@ import net.minecraft.world.level.saveddata.SavedData; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; + import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.stream.Collectors; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author KilaBash * @date 2023/7/11 @@ -34,6 +36,7 @@ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class BedrockOreVeinSavedData extends SavedData { + public static final int VEIN_CHUNK_SIZE = 3; // veins are 3x3 chunk squares public static final int MAXIMUM_VEIN_OPERATIONS = 100_000; public final HashMap veinOres = new HashMap<>(); @@ -44,7 +47,8 @@ public class BedrockOreVeinSavedData extends SavedData { private final ServerLevel serverLevel; public static BedrockOreVeinSavedData getOrCreate(ServerLevel serverLevel) { - return serverLevel.getDataStorage().computeIfAbsent(tag -> new BedrockOreVeinSavedData(serverLevel, tag), () -> new BedrockOreVeinSavedData(serverLevel), "gtceu_bedrock_ore"); + return serverLevel.getDataStorage().computeIfAbsent(tag -> new BedrockOreVeinSavedData(serverLevel, tag), + () -> new BedrockOreVeinSavedData(serverLevel), "gtceu_bedrock_ore"); } public BedrockOreVeinSavedData(ServerLevel serverLevel) { @@ -93,14 +97,19 @@ public OreVeinWorldEntry getOreVeinWorldEntry(int chunkX, int chunkZ) { } BedrockOreDefinition definition = null; - int query = RandomSource.create(Objects.hash(serverLevel.getSeed(), chunkX / VEIN_CHUNK_SIZE, chunkZ / VEIN_CHUNK_SIZE)).nextInt(); + int query = RandomSource + .create(Objects.hash(serverLevel.getSeed(), chunkX / VEIN_CHUNK_SIZE, chunkZ / VEIN_CHUNK_SIZE)) + .nextInt(); var biome = serverLevel.getBiome(new BlockPos(chunkX << 4, 64, chunkZ << 4)); int totalWeight = getTotalWeight(biome); if (totalWeight > 0) { int weight = Math.abs(query % totalWeight); for (var oreDefinition : GTRegistries.BEDROCK_ORE_DEFINITIONS) { - int veinWeight = oreDefinition.weight() + (oreDefinition.biomeWeightModifier() != null ? oreDefinition.biomeWeightModifier().apply(biome) : 0); - if (veinWeight > 0 && (oreDefinition.dimensionFilter == null || oreDefinition.dimensionFilter().stream().anyMatch(dim -> WorldGeneratorUtils.isSameDimension(dim, serverLevel.dimension())))) { + int veinWeight = oreDefinition.weight() + (oreDefinition.biomeWeightModifier() != null ? + oreDefinition.biomeWeightModifier().apply(biome) : 0); + if (veinWeight > 0 && + (oreDefinition.dimensionFilter == null || oreDefinition.dimensionFilter().stream().anyMatch( + dim -> WorldGeneratorUtils.isSameDimension(dim, serverLevel.dimension())))) { weight -= veinWeight; if (weight < 0) { definition = oreDefinition; @@ -131,13 +140,16 @@ public void createVein(ChunkPos pos, @Nullable BedrockOreDefinition definition) distanceFromOriginal = distanceFromOriginal == 0 ? 1 : distanceFromOriginal; distanceFromOriginal = (float) Math.pow(distanceFromOriginal, 2); - var random = RandomSource.create(31L * 31 * pos2.x + pos2.z * 31L + Long.hashCode(serverLevel.getSeed())); + var random = RandomSource + .create(31L * 31 * pos2.x + pos2.z * 31L + Long.hashCode(serverLevel.getSeed())); int maximumYield; - if ((definition.yield().getMaxValue() - definition.yield().getMinValue()) / distanceFromOriginal <= 0) { + if ((definition.yield().getMaxValue() - definition.yield().getMinValue()) / distanceFromOriginal <= + 0) { maximumYield = definition.yield().getMinValue(); } else { - maximumYield = (int) ((definition.yield().sample(random) + definition.yield().getMinValue()) / distanceFromOriginal); + maximumYield = (int) ((definition.yield().sample(random) + definition.yield().getMinValue()) / + distanceFromOriginal); maximumYield = Math.max(maximumYield, definition.yield().getMinValue()); } maximumYield = Math.min(maximumYield, definition.yield().getMaxValue()); @@ -151,15 +163,17 @@ public void createVein(ChunkPos pos, @Nullable BedrockOreDefinition definition) /** * Gets the total weight of all veins for the given dimension ID and biome type * - * @param biome The biome type to check + * @param biome The biome type to check * @return The total weight associated with the dimension/biome pair */ public int getTotalWeight(Holder biome) { return biomeWeights.computeIfAbsent(biome, b -> { int totalWeight = 0; for (var definition : GTRegistries.BEDROCK_ORE_DEFINITIONS) { - if (definition.dimensionFilter == null || definition.dimensionFilter().stream().anyMatch(dim -> WorldGeneratorUtils.isSameDimension(dim, serverLevel.dimension()))) { - totalWeight += definition.biomeWeightModifier() != null ? definition.biomeWeightModifier().apply(biome) : 0; + if (definition.dimensionFilter == null || definition.dimensionFilter().stream() + .anyMatch(dim -> WorldGeneratorUtils.isSameDimension(dim, serverLevel.dimension()))) { + totalWeight += definition.biomeWeightModifier() != null ? + definition.biomeWeightModifier().apply(biome) : 0; totalWeight += definition.weight(); } } @@ -213,7 +227,8 @@ public int getOperationsRemaining(int chunkX, int chunkZ) { public List> getOreInChunk(int chunkX, int chunkZ) { OreVeinWorldEntry info = getOreVeinWorldEntry(chunkX, chunkZ); if (info.getDefinition() == null) return null; - return info.getDefinition().materials().stream().map(pair -> Map.entry(pair.getSecond(), pair.getFirst())).collect(Collectors.toList()); + return info.getDefinition().materials().stream().map(pair -> Map.entry(pair.getSecond(), pair.getFirst())) + .collect(Collectors.toList()); } /** @@ -246,5 +261,4 @@ public void depleteVein(int chunkX, int chunkZ, int amount, boolean ignoreVeinSt setDirty(); } } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/bedrockore/OreVeinWorldEntry.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/bedrockore/OreVeinWorldEntry.java index c1b3a74371..98dddd09ff 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/bedrockore/OreVeinWorldEntry.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/bedrockore/OreVeinWorldEntry.java @@ -2,10 +2,11 @@ import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.config.ConfigHolder; -import lombok.Getter; + import net.minecraft.nbt.CompoundTag; import net.minecraft.resources.ResourceLocation; +import lombok.Getter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -15,6 +16,7 @@ * @implNote OreVeinWorldEntry */ public class OreVeinWorldEntry { + @Nullable @Getter private BedrockOreDefinition definition; @@ -29,9 +31,7 @@ public OreVeinWorldEntry(@Nullable BedrockOreDefinition vein, int oreYield, int this.operationsRemaining = operationsRemaining; } - private OreVeinWorldEntry() { - - } + private OreVeinWorldEntry() {} @SuppressWarnings("unused") public void setOperationsRemaining(int amount) { @@ -39,7 +39,8 @@ public void setOperationsRemaining(int amount) { } public void decreaseOperations(int amount) { - operationsRemaining = ConfigHolder.INSTANCE.worldgen.oreVeins.infiniteBedrockOresFluids ? operationsRemaining : Math.max(0, operationsRemaining - amount); + operationsRemaining = ConfigHolder.INSTANCE.worldgen.oreVeins.infiniteBedrockOresFluids ? operationsRemaining : + Math.max(0, operationsRemaining - amount); } public CompoundTag writeToNBT() { @@ -59,7 +60,10 @@ public static OreVeinWorldEntry readFromNBT(@NotNull CompoundTag tag) { info.operationsRemaining = tag.getInt("operationsRemaining"); if (tag.contains("vein")) { - info.definition = GTRegistries.BEDROCK_ORE_DEFINITIONS.get(new ResourceLocation(tag.getString("vein"))); + ResourceLocation id = new ResourceLocation(tag.getString("vein")); + if (GTRegistries.BEDROCK_ORE_DEFINITIONS.containKey(id)) { + info.definition = GTRegistries.BEDROCK_ORE_DEFINITIONS.get(id); + } } return info; } diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/IndicatorGenerator.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/IndicatorGenerator.java index ef91cccba4..02a862c18b 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/IndicatorGenerator.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/IndicatorGenerator.java @@ -4,38 +4,41 @@ import com.gregtechceu.gtceu.api.data.worldgen.WorldGeneratorUtils; import com.gregtechceu.gtceu.api.data.worldgen.ores.GeneratedVeinMetadata; import com.gregtechceu.gtceu.api.data.worldgen.ores.OreIndicatorPlacer; -import com.mojang.serialization.Codec; -import com.mojang.serialization.DataResult; -import dev.latvian.mods.rhino.util.HideFromJS; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.RandomSource; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.WorldGenLevel; -import javax.annotation.ParametersAreNonnullByDefault; +import com.mojang.serialization.Codec; +import com.mojang.serialization.DataResult; +import dev.latvian.mods.rhino.util.HideFromJS; + import java.util.Map; import java.util.Optional; import java.util.function.Function; +import javax.annotation.ParametersAreNonnullByDefault; @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault public abstract class IndicatorGenerator { + public static final Codec> REGISTRY_CODEC = ResourceLocation.CODEC .flatXmap(rl -> Optional.ofNullable(WorldGeneratorUtils.INDICATOR_GENERATORS.get(rl)) - .map(DataResult::success) - .orElseGet(() -> DataResult.error(() -> "No IndicatorGenerator with id " + rl + " registered")), + .map(DataResult::success) + .orElseGet(() -> DataResult.error(() -> "No IndicatorGenerator with id " + rl + " registered")), obj -> Optional.ofNullable(WorldGeneratorUtils.INDICATOR_GENERATORS.inverse().get(obj)) .map(DataResult::success) .orElseGet(() -> DataResult.error(() -> "IndicatorGenerator " + obj + " not registered"))); - public static final Codec DIRECT_CODEC = REGISTRY_CODEC.dispatchStable(IndicatorGenerator::codec, Function.identity()); + public static final Codec DIRECT_CODEC = REGISTRY_CODEC + .dispatchStable(IndicatorGenerator::codec, Function.identity()); protected GTOreDefinition entry; - public IndicatorGenerator() { - } + public IndicatorGenerator() {} public IndicatorGenerator(GTOreDefinition entry) { this.entry = entry; @@ -44,11 +47,13 @@ public IndicatorGenerator(GTOreDefinition entry) { /** * Generate a map of all ore placers (by block position), containing each indicator block for the ore vein. * - *

Note that, if in any way possible, this is NOT supposed to directly place any of the indicator blocks, as + *

+ * Note that, if in any way possible, this is NOT supposed to directly place any of the indicator blocks, as * their respective ore placers are invoked at a later time, when the chunk containing them is actually generated. */ @HideFromJS - public abstract Map generate(WorldGenLevel level, RandomSource random, GeneratedVeinMetadata metadata); + public abstract Map generate(WorldGenLevel level, RandomSource random, + GeneratedVeinMetadata metadata); @HideFromJS public GTOreDefinition parent() { diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/IndicatorGenerators.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/IndicatorGenerators.java index d22f1c4fa4..e0e7744ebe 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/IndicatorGenerators.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/IndicatorGenerators.java @@ -7,17 +7,23 @@ import com.gregtechceu.gtceu.api.data.worldgen.WorldGeneratorUtils; import com.gregtechceu.gtceu.api.data.worldgen.generator.indicators.NoopIndicatorGenerator; import com.gregtechceu.gtceu.api.data.worldgen.generator.indicators.SurfaceIndicatorGenerator; -import com.mojang.serialization.Codec; + import net.minecraft.resources.ResourceLocation; +import com.mojang.serialization.Codec; + import java.util.function.Function; public class IndicatorGenerators { - public static final Codec NO_OP = register(GTCEu.id("no_op"), NoopIndicatorGenerator.CODEC, entry -> NoopIndicatorGenerator.INSTANCE); - public static final Codec SURFACE = register(GTCEu.id("surface"), SurfaceIndicatorGenerator.CODEC, SurfaceIndicatorGenerator::new); + public static final Codec NO_OP = register(GTCEu.id("no_op"), NoopIndicatorGenerator.CODEC, + entry -> NoopIndicatorGenerator.INSTANCE); + + public static final Codec SURFACE = register(GTCEu.id("surface"), + SurfaceIndicatorGenerator.CODEC, SurfaceIndicatorGenerator::new); - public static Codec register(ResourceLocation id, Codec codec, Function function) { + public static Codec register(ResourceLocation id, Codec codec, + Function function) { WorldGeneratorUtils.INDICATOR_GENERATORS.put(id, codec); WorldGeneratorUtils.INDICATOR_GENERATOR_FUNCTIONS.put(id, function); return codec; diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/VeinGenerator.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/VeinGenerator.java index 27fa96017b..4a4ad298af 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/VeinGenerator.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/VeinGenerator.java @@ -6,34 +6,37 @@ import com.gregtechceu.gtceu.api.data.worldgen.GTOreDefinition; import com.gregtechceu.gtceu.api.data.worldgen.WorldGeneratorUtils; import com.gregtechceu.gtceu.api.data.worldgen.ores.OreBlockPlacer; -import com.mojang.datafixers.util.Either; -import com.mojang.serialization.Codec; -import com.mojang.serialization.DataResult; -import dev.latvian.mods.rhino.util.HideFromJS; + import net.minecraft.core.BlockPos; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.RandomSource; import net.minecraft.world.level.WorldGenLevel; import net.minecraft.world.level.block.state.BlockState; +import com.mojang.datafixers.util.Either; +import com.mojang.serialization.Codec; +import com.mojang.serialization.DataResult; +import dev.latvian.mods.rhino.util.HideFromJS; + import java.util.*; import java.util.function.Function; import java.util.stream.Collectors; public abstract class VeinGenerator { + public static final Codec> REGISTRY_CODEC = ResourceLocation.CODEC .flatXmap(rl -> Optional.ofNullable(WorldGeneratorUtils.VEIN_GENERATORS.get(rl)) - .map(DataResult::success) - .orElseGet(() -> DataResult.error(() -> "No VeinGenerator with id " + rl + " registered")), + .map(DataResult::success) + .orElseGet(() -> DataResult.error(() -> "No VeinGenerator with id " + rl + " registered")), obj -> Optional.ofNullable(WorldGeneratorUtils.VEIN_GENERATORS.inverse().get(obj)) .map(DataResult::success) .orElseGet(() -> DataResult.error(() -> "VeinGenerator " + obj + " not registered"))); - public static final Codec DIRECT_CODEC = REGISTRY_CODEC.dispatchStable(VeinGenerator::codec, Function.identity()); + public static final Codec DIRECT_CODEC = REGISTRY_CODEC.dispatchStable(VeinGenerator::codec, + Function.identity()); protected GTOreDefinition entry; - public VeinGenerator() { - } + public VeinGenerator() {} public VeinGenerator(GTOreDefinition entry) { this.entry = entry; @@ -45,14 +48,17 @@ public VeinGenerator(GTOreDefinition entry) { public abstract List, Integer>> getAllEntries(); public List getAllBlocks() { - return getAllEntries().stream().map(entry -> entry.getKey().map(Function.identity(), material -> ChemicalHelper.getBlock(TagPrefix.ore, material).defaultBlockState())).toList(); + return getAllEntries().stream().map(entry -> entry.getKey().map(Function.identity(), + material -> ChemicalHelper.getBlock(TagPrefix.ore, material).defaultBlockState())).toList(); } public List getAllMaterials() { return getAllEntries().stream() .sorted(Comparator.comparingInt(Map.Entry::getValue)) .map(Map.Entry::getKey) - .map(either -> either.map(state -> ChemicalHelper.getMaterial(state.getBlock()) != null ? ChemicalHelper.getMaterial(state.getBlock()).material() : null, Function.identity())).filter(Objects::nonNull) + .map(either -> either.map(state -> ChemicalHelper.getMaterial(state.getBlock()) != null ? + ChemicalHelper.getMaterial(state.getBlock()).material() : null, Function.identity())) + .filter(Objects::nonNull) .toList(); } @@ -62,19 +68,26 @@ public List getAllChances() { public List> getValidMaterialsChances() { return getAllEntries().stream() - .filter(entry -> entry.getKey().map(state -> ChemicalHelper.getMaterial(state.getBlock()) != null ? ChemicalHelper.getMaterial(state.getBlock()).material() : null, Function.identity()) != null) - .map(entry -> Map.entry(entry.getValue(), entry.getKey().map(state -> ChemicalHelper.getMaterial(state.getBlock()) != null ? ChemicalHelper.getMaterial(state.getBlock()).material() : null, Function.identity()))) + .filter(entry -> entry.getKey() + .map(state -> ChemicalHelper.getMaterial(state.getBlock()) != null ? + ChemicalHelper.getMaterial(state.getBlock()).material() : null, Function.identity()) != + null) + .map(entry -> Map.entry(entry.getValue(), entry.getKey() + .map(state -> ChemicalHelper.getMaterial(state.getBlock()) != null ? + ChemicalHelper.getMaterial(state.getBlock()).material() : null, Function.identity()))) .collect(Collectors.toList()); } /** * Generate a map of all ore placers (by block position), for each block in this ore vein. * - *

Note that, if in any way possible, this is NOT supposed to directly place any of the vein's blocks, as their + *

+ * Note that, if in any way possible, this is NOT supposed to directly place any of the vein's blocks, as their * respective ore placers are invoked at a later time, when the chunk containing them is actually generated. */ @HideFromJS - public abstract Map generate(WorldGenLevel level, RandomSource random, GTOreDefinition entry, BlockPos origin); + public abstract Map generate(WorldGenLevel level, RandomSource random, + GTOreDefinition entry, BlockPos origin); @HideFromJS public abstract VeinGenerator build(); diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/VeinGenerators.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/VeinGenerators.java index fab68cad8e..7f5a5f3143 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/VeinGenerators.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/VeinGenerators.java @@ -6,24 +6,37 @@ import com.gregtechceu.gtceu.api.data.worldgen.GTOreDefinition; import com.gregtechceu.gtceu.api.data.worldgen.WorldGeneratorUtils; import com.gregtechceu.gtceu.api.data.worldgen.generator.veins.*; -import com.mojang.serialization.Codec; + import net.minecraft.resources.ResourceLocation; +import com.mojang.serialization.Codec; + import java.util.function.Function; @SuppressWarnings("unused") public class VeinGenerators { - public static final Codec NO_OP = register(GTCEu.id("no_op"), NoopVeinGenerator.CODEC, entry -> NoopVeinGenerator.INSTANCE); - public static final Codec STANDARD = register(GTCEu.id("standard"), StandardVeinGenerator.CODEC, StandardVeinGenerator::new); - public static final Codec LAYER = register(GTCEu.id("layer"), LayeredVeinGenerator.CODEC, LayeredVeinGenerator::new); - public static final Codec GEODE = register(GTCEu.id("geode"), GeodeVeinGenerator.CODEC, GeodeVeinGenerator::new); - public static final Codec DIKE = register(GTCEu.id("dike"), DikeVeinGenerator.CODEC, DikeVeinGenerator::new); - public static final Codec VEINED = register(GTCEu.id("veined"), VeinedVeinGenerator.CODEC, VeinedVeinGenerator::new); - public static final Codec CLASSIC = register(GTCEu.id("classic"), ClassicVeinGenerator.CODEC, ClassicVeinGenerator::new); - public static final Codec CUBOID = register(GTCEu.id("cuboid"), CuboidVeinGenerator.CODEC, CuboidVeinGenerator::new); + public static final Codec NO_OP = register(GTCEu.id("no_op"), NoopVeinGenerator.CODEC, + entry -> NoopVeinGenerator.INSTANCE); + + public static final Codec STANDARD = register(GTCEu.id("standard"), + StandardVeinGenerator.CODEC, StandardVeinGenerator::new); + public static final Codec LAYER = register(GTCEu.id("layer"), LayeredVeinGenerator.CODEC, + LayeredVeinGenerator::new); + public static final Codec GEODE = register(GTCEu.id("geode"), GeodeVeinGenerator.CODEC, + GeodeVeinGenerator::new); + public static final Codec DIKE = register(GTCEu.id("dike"), DikeVeinGenerator.CODEC, + DikeVeinGenerator::new); + public static final Codec VEINED = register(GTCEu.id("veined"), VeinedVeinGenerator.CODEC, + VeinedVeinGenerator::new); + public static final Codec CLASSIC = register(GTCEu.id("classic"), ClassicVeinGenerator.CODEC, + ClassicVeinGenerator::new); + public static final Codec CUBOID = register(GTCEu.id("cuboid"), CuboidVeinGenerator.CODEC, + CuboidVeinGenerator::new); - public static Codec register(ResourceLocation id, Codec codec, Function function) { + public static < + T extends VeinGenerator> Codec register(ResourceLocation id, Codec codec, + Function function) { WorldGeneratorUtils.VEIN_GENERATORS.put(id, codec); WorldGeneratorUtils.VEIN_GENERATOR_FUNCTIONS.put(id, function); return codec; diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/indicators/NoopIndicatorGenerator.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/indicators/NoopIndicatorGenerator.java index 793a19de44..6dd5165f4a 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/indicators/NoopIndicatorGenerator.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/indicators/NoopIndicatorGenerator.java @@ -3,25 +3,29 @@ import com.gregtechceu.gtceu.api.data.worldgen.generator.IndicatorGenerator; import com.gregtechceu.gtceu.api.data.worldgen.ores.GeneratedVeinMetadata; import com.gregtechceu.gtceu.api.data.worldgen.ores.OreIndicatorPlacer; -import com.mojang.serialization.Codec; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.util.RandomSource; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.WorldGenLevel; -import javax.annotation.ParametersAreNonnullByDefault; +import com.mojang.serialization.Codec; + import java.util.Collections; import java.util.Map; +import javax.annotation.ParametersAreNonnullByDefault; @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault public class NoopIndicatorGenerator extends IndicatorGenerator { + public static final NoopIndicatorGenerator INSTANCE = new NoopIndicatorGenerator(); public static final Codec CODEC = Codec.unit(() -> INSTANCE); @Override - public Map generate(WorldGenLevel level, RandomSource random, GeneratedVeinMetadata metadata) { + public Map generate(WorldGenLevel level, RandomSource random, + GeneratedVeinMetadata metadata) { // Nothing to do here return Collections.emptyMap(); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/indicators/SurfaceIndicatorGenerator.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/indicators/SurfaceIndicatorGenerator.java index fbecad892e..0cd3555ceb 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/indicators/SurfaceIndicatorGenerator.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/indicators/SurfaceIndicatorGenerator.java @@ -7,12 +7,8 @@ import com.gregtechceu.gtceu.api.data.worldgen.generator.IndicatorGenerator; import com.gregtechceu.gtceu.api.data.worldgen.ores.GeneratedVeinMetadata; import com.gregtechceu.gtceu.api.data.worldgen.ores.OreIndicatorPlacer; -import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.common.data.GTBlocks; -import com.mojang.datafixers.util.Either; -import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import lombok.AllArgsConstructor; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -30,10 +26,14 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.BulkSectionAccess; import net.minecraft.world.level.levelgen.Heightmap; -import org.apache.commons.lang3.function.TriFunction; +import com.mojang.datafixers.util.Either; +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import lombok.AllArgsConstructor; +import org.apache.commons.lang3.function.TriFunction; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; + import java.util.List; import java.util.Map; import java.util.Objects; @@ -41,16 +41,19 @@ import java.util.stream.Collectors; import java.util.stream.Stream; +import javax.annotation.ParametersAreNonnullByDefault; @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault public class SurfaceIndicatorGenerator extends IndicatorGenerator { + public static final Codec CODEC = RecordCodecBuilder.create(instance -> instance.group( - Codec.either(BlockState.CODEC, GTCEuAPI.materialManager.codec()).fieldOf("block").forGetter(ext -> ext.block), + Codec.either(BlockState.CODEC, GTCEuAPI.materialManager.codec()).fieldOf("block") + .forGetter(ext -> ext.block), IntProvider.codec(1, 32).fieldOf("radius").forGetter(ext -> ext.radius), FloatProvider.codec(0.0f, 2.0f).fieldOf("density").forGetter(ext -> ext.density), - IndicatorPlacement.CODEC.fieldOf("placement").forGetter(ext -> ext.placement) - ).apply(instance, SurfaceIndicatorGenerator::new)); + IndicatorPlacement.CODEC.fieldOf("placement").forGetter(ext -> ext.placement)) + .apply(instance, SurfaceIndicatorGenerator::new)); private Either block = Either.left(Blocks.AIR.defaultBlockState()); private IntProvider radius = ConstantInt.of(5); @@ -61,7 +64,8 @@ public SurfaceIndicatorGenerator(GTOreDefinition entry) { super(entry); } - public SurfaceIndicatorGenerator(Either block, IntProvider radius, FloatProvider density, IndicatorPlacement placement) { + public SurfaceIndicatorGenerator(Either block, IntProvider radius, FloatProvider density, + IndicatorPlacement placement) { this.block = block; this.radius = radius; this.density = density; @@ -115,7 +119,8 @@ private static void validateSurfaceRockMaterial(Material material) { } @Override - public Map generate(WorldGenLevel level, RandomSource random, GeneratedVeinMetadata metadata) { + public Map generate(WorldGenLevel level, RandomSource random, + GeneratedVeinMetadata metadata) { BlockState blockState = placement.stateTransformer.apply(block); int radius = this.radius.sample(random); @@ -125,8 +130,7 @@ public Map generate(WorldGenLevel level, RandomSou Stream positionStream = BlockPos.betweenClosedStream( center.getX() - radius, center.getY(), center.getZ() - radius, - center.getX() + radius, center.getY(), center.getZ() + radius - ).map(BlockPos::immutable); + center.getX() + radius, center.getY(), center.getZ() + radius).map(BlockPos::immutable); var positions = positionStream .filter(pos -> pos.equals(center) || random.nextFloat() <= density) @@ -134,10 +138,12 @@ public Map generate(WorldGenLevel level, RandomSou .toList(); return WorldGeneratorUtils.groupByChunks(positions).entrySet().stream() - .collect(Collectors.toMap(Map.Entry::getKey, entry -> createPlacer(level, entry.getValue(), blockState))); + .collect(Collectors.toMap(Map.Entry::getKey, + entry -> createPlacer(level, entry.getValue(), blockState))); } - private OreIndicatorPlacer createPlacer(WorldGenLevel level, List positionsWithoutY, BlockState blockState) { + private OreIndicatorPlacer createPlacer(WorldGenLevel level, List positionsWithoutY, + BlockState blockState) { return (access) -> { var positions = positionsWithoutY.stream() .map(pos -> placement.resolver.apply(level, access, pos)) @@ -173,16 +179,14 @@ public Codec codec() { return CODEC; } - @AllArgsConstructor public enum IndicatorPlacement implements StringRepresentable { + SURFACE( (level, access, pos) -> pos.atY(Math.max( - level.getHeight(Heightmap.Types.OCEAN_FLOOR_WG, pos.getX(), pos.getZ()), - pos.getY() - )), - block -> getBlockState(block, Direction.DOWN) - ), + level.getHeight(Heightmap.Types.OCEAN_FLOOR_WG, pos.getX(), pos.getZ()), + pos.getY())), + block -> getBlockState(block, Direction.DOWN)), ABOVE( (level, access, initialPos) -> WorldGeneratorUtils.findBlockPos( @@ -190,10 +194,8 @@ public enum IndicatorPlacement implements StringRepresentable { pos -> access.getBlockState(pos).isAir() && access.getBlockState(pos.below()).isFaceSturdy(level, pos.below(), Direction.UP), pos -> pos.move(Direction.UP, 1), - level.getMaxBuildHeight() - initialPos.getY() - ).orElse(initialPos), - block -> getBlockState(block, Direction.DOWN) - ), + level.getMaxBuildHeight() - initialPos.getY()).orElse(initialPos), + block -> getBlockState(block, Direction.DOWN)), BELOW( (level, access, initialPos) -> WorldGeneratorUtils.findBlockPos( @@ -201,10 +203,8 @@ public enum IndicatorPlacement implements StringRepresentable { pos -> access.getBlockState(pos).isAir() && access.getBlockState(pos.above()).isFaceSturdy(level, pos.above(), Direction.DOWN), pos -> pos.move(Direction.DOWN, 1), - initialPos.getY() - level.getMinBuildHeight() - ).orElse(initialPos), - block -> getBlockState(block, Direction.UP) - ); + initialPos.getY() - level.getMinBuildHeight()).orElse(initialPos), + block -> getBlockState(block, Direction.UP)); public static final Codec CODEC = StringRepresentable.fromEnum(IndicatorPlacement::values); @@ -214,8 +214,7 @@ public enum IndicatorPlacement implements StringRepresentable { private static BlockState getBlockState(Either block, Direction direction) { return block.map( state -> state, - material -> GTBlocks.SURFACE_ROCK_BLOCKS.get(material).get().getStateForDirection(direction) - ); + material -> GTBlocks.SURFACE_ROCK_BLOCKS.get(material).get().getStateForDirection(direction)); } @Override diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/veins/ClassicVeinGenerator.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/veins/ClassicVeinGenerator.java index 0850638d88..854e5de357 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/veins/ClassicVeinGenerator.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/veins/ClassicVeinGenerator.java @@ -1,6 +1,5 @@ package com.gregtechceu.gtceu.api.data.worldgen.generator.veins; -import com.google.common.base.Preconditions; import com.gregtechceu.gtceu.api.GTCEuAPI; import com.gregtechceu.gtceu.api.data.chemical.ChemicalHelper; import com.gregtechceu.gtceu.api.data.chemical.material.Material; @@ -8,13 +7,7 @@ import com.gregtechceu.gtceu.api.data.worldgen.generator.VeinGenerator; import com.gregtechceu.gtceu.api.data.worldgen.ores.OreBlockPlacer; import com.gregtechceu.gtceu.api.data.worldgen.ores.OreVeinUtil; -import com.mojang.datafixers.util.Either; -import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; -import lombok.AllArgsConstructor; -import lombok.Setter; -import lombok.experimental.Accessors; + import net.minecraft.core.BlockPos; import net.minecraft.core.SectionPos; import net.minecraft.util.ExtraCodecs; @@ -28,6 +21,15 @@ import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration; import net.minecraft.world.level.levelgen.structure.templatesystem.RuleTest; +import com.google.common.base.Preconditions; +import com.mojang.datafixers.util.Either; +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import lombok.AllArgsConstructor; +import lombok.Setter; +import lombok.experimental.Accessors; + import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -39,13 +41,14 @@ @Accessors(fluent = true, chain = true) public class ClassicVeinGenerator extends VeinGenerator { + public static final Codec CODEC = RecordCodecBuilder.create(instance -> instance.group( - Layer.CODEC.fieldOf("primary").forGetter(val -> val.primary), - Layer.CODEC.fieldOf("secondary").forGetter(val -> val.secondary), - Layer.CODEC.fieldOf("between").forGetter(val -> val.between), - Layer.CODEC.fieldOf("sporadic").forGetter(val -> val.sporadic), - ExtraCodecs.POSITIVE_INT.optionalFieldOf("y_radius", 3).forGetter(val -> val.yRadius) - ).apply(instance, ClassicVeinGenerator::new)); + Layer.CODEC.fieldOf("primary").forGetter(val -> val.primary), + Layer.CODEC.fieldOf("secondary").forGetter(val -> val.secondary), + Layer.CODEC.fieldOf("between").forGetter(val -> val.between), + Layer.CODEC.fieldOf("sporadic").forGetter(val -> val.sporadic), + ExtraCodecs.POSITIVE_INT.optionalFieldOf("y_radius", 3).forGetter(val -> val.yRadius)) + .apply(instance, ClassicVeinGenerator::new)); private Layer primary; private Layer secondary; @@ -78,26 +81,27 @@ public List, Integer>> getAllEntries() { List, Integer>> result = new ArrayList<>(); int totalWeight = primary.layers + secondary.layers + between.layers; primary.target - .map(blockStates -> blockStates.stream().map(state -> Either.left(state.state)), - material -> Stream.of(Either.right(material))) - .forEach(entry -> result.add(Map.entry(entry, primary.layers / totalWeight))); + .map(blockStates -> blockStates.stream().map(state -> Either.left(state.state)), + material -> Stream.of(Either.right(material))) + .forEach(entry -> result.add(Map.entry(entry, primary.layers / totalWeight))); secondary.target - .map(blockStates -> blockStates.stream().map(state -> Either.left(state.state)), - material -> Stream.of(Either.right(material))) - .forEach(entry -> result.add(Map.entry(entry, secondary.layers / totalWeight))); + .map(blockStates -> blockStates.stream().map(state -> Either.left(state.state)), + material -> Stream.of(Either.right(material))) + .forEach(entry -> result.add(Map.entry(entry, secondary.layers / totalWeight))); between.target - .map(blockStates -> blockStates.stream().map(state -> Either.left(state.state)), - material -> Stream.of(Either.right(material))) - .forEach(entry -> result.add(Map.entry(entry, between.layers / totalWeight))); + .map(blockStates -> blockStates.stream().map(state -> Either.left(state.state)), + material -> Stream.of(Either.right(material))) + .forEach(entry -> result.add(Map.entry(entry, between.layers / totalWeight))); sporadic.target - .map(blockStates -> blockStates.stream().map(state -> Either.left(state.state)), - material -> Stream.of(Either.right(material))) - .forEach(entry -> result.add(Map.entry(entry, 1))); + .map(blockStates -> blockStates.stream().map(state -> Either.left(state.state)), + material -> Stream.of(Either.right(material))) + .forEach(entry -> result.add(Map.entry(entry, 1))); return result; } @Override - public Map generate(WorldGenLevel level, RandomSource random, GTOreDefinition entry, BlockPos origin) { + public Map generate(WorldGenLevel level, RandomSource random, GTOreDefinition entry, + BlockPos origin) { Map generatedBlocks = new Object2ObjectOpenHashMap<>(); int radius = entry.clusterSize().sample(random); @@ -129,9 +133,8 @@ public Map generate(WorldGenLevel level, RandomSource final var randomSeed = random.nextLong(); // Fully deterministic regardless of chunk order BlockPos currentPos = new BlockPos(xOffset + xPos, yOffset + yPos, zOffset + zPos); - generatedBlocks.put(currentPos, (access, section) -> - placeBlock(access, section, randomSeed, entry, currentPos, minPos) - ); + generatedBlocks.put(currentPos, + (access, section) -> placeBlock(access, section, randomSeed, entry, currentPos, minPos)); } } } @@ -139,8 +142,8 @@ public Map generate(WorldGenLevel level, RandomSource } private void placeBlock(BulkSectionAccess access, LevelChunkSection section, long randomSeed, - GTOreDefinition entry, - BlockPos blockPos, BlockPos lowestPos) { + GTOreDefinition entry, + BlockPos blockPos, BlockPos lowestPos) { RandomSource random = new XoroshiroRandomSource(randomSeed); int x = SectionPos.sectionRelative(blockPos.getX()); int y = SectionPos.sectionRelative(blockPos.getY()); @@ -184,7 +187,7 @@ public VeinGenerator build() { // Ensure "between" is not more than the total primary and secondary layers Preconditions.checkArgument(primary.layers + secondary.layers >= between.layers, - "Error: cannot be more \"between\" layers than primary and secondary layers combined!"); + "Error: cannot be more \"between\" layers than primary and secondary layers combined!"); this.sporadicDivisor = primary.layers + secondary.layers - 1; this.startPrimary = secondary.layers; @@ -194,7 +197,8 @@ public VeinGenerator build() { @Override public VeinGenerator copy() { - return new ClassicVeinGenerator(this.primary.copy(), this.secondary.copy(), this.between.copy(), this.sporadic.copy(), this.yRadius); + return new ClassicVeinGenerator(this.primary.copy(), this.secondary.copy(), this.between.copy(), + this.sporadic.copy(), this.yRadius); } @Override @@ -232,15 +236,19 @@ public ClassicVeinGenerator sporadic(Consumer builder) { @AllArgsConstructor public static class Layer { + public static final Codec CODEC = RecordCodecBuilder.create(instance -> instance.group( - Codec.either(OreConfiguration.TargetBlockState.CODEC.listOf(), GTCEuAPI.materialManager.codec()).fieldOf("targets").forGetter(layer -> layer.target), - ExtraCodecs.intRange(-1, Integer.MAX_VALUE).optionalFieldOf("layers", -1).forGetter(layer -> layer.layers) - ).apply(instance, Layer::new)); + Codec.either(OreConfiguration.TargetBlockState.CODEC.listOf(), GTCEuAPI.materialManager.codec()) + .fieldOf("targets").forGetter(layer -> layer.target), + ExtraCodecs.intRange(-1, Integer.MAX_VALUE).optionalFieldOf("layers", -1) + .forGetter(layer -> layer.layers)) + .apply(instance, Layer::new)); public final Either, Material> target; public int layers; - public void place(BlockState blockState, BulkSectionAccess access, LevelChunkSection section, long randomSeed, GTOreDefinition entry, BlockPos pos) { + public void place(BlockState blockState, BulkSectionAccess access, LevelChunkSection section, long randomSeed, + GTOreDefinition entry, BlockPos pos) { RandomSource random = new XoroshiroRandomSource(randomSeed); int x = SectionPos.sectionRelative(pos.getX()); int y = SectionPos.sectionRelative(pos.getY()); @@ -273,6 +281,7 @@ public Layer copy() { } public static class Builder { + private Either, Material> target; private int size = 1; private final RuleTest[] rules; @@ -290,7 +299,8 @@ public Layer.Builder state(Supplier state) { } public Layer.Builder state(BlockState state) { - this.target = Either.left(Arrays.stream(this.rules).map(rule -> OreConfiguration.target(rule, state)).toList()); + this.target = Either + .left(Arrays.stream(this.rules).map(rule -> OreConfiguration.target(rule, state)).toList()); return this; } diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/veins/CuboidVeinGenerator.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/veins/CuboidVeinGenerator.java index 797041bfd6..c2de4762cf 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/veins/CuboidVeinGenerator.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/veins/CuboidVeinGenerator.java @@ -7,11 +7,7 @@ import com.gregtechceu.gtceu.api.data.worldgen.generator.VeinGenerator; import com.gregtechceu.gtceu.api.data.worldgen.ores.OreBlockPlacer; import com.gregtechceu.gtceu.api.data.worldgen.ores.OreVeinUtil; -import com.mojang.datafixers.util.Either; -import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; -import lombok.AllArgsConstructor; + import net.minecraft.core.BlockPos; import net.minecraft.core.SectionPos; import net.minecraft.util.Mth; @@ -23,6 +19,12 @@ import net.minecraft.world.level.chunk.LevelChunkSection; import net.minecraft.world.level.levelgen.XoroshiroRandomSource; import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration; + +import com.mojang.datafixers.util.Either; +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import lombok.AllArgsConstructor; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; @@ -32,16 +34,17 @@ @AllArgsConstructor public class CuboidVeinGenerator extends VeinGenerator { - public static final Codec, Material>> LAYER_CODEC = Codec.either(OreConfiguration.TargetBlockState.CODEC.listOf(), GTCEuAPI.materialManager.codec()); + + public static final Codec, Material>> LAYER_CODEC = Codec + .either(OreConfiguration.TargetBlockState.CODEC.listOf(), GTCEuAPI.materialManager.codec()); public static final Codec CODEC = RecordCodecBuilder.create(instance -> instance.group( - LAYER_CODEC.fieldOf("top").forGetter(val -> val.top), - LAYER_CODEC.fieldOf("middle").forGetter(val -> val.middle), - LAYER_CODEC.fieldOf("bottom").forGetter(val -> val.bottom), - LAYER_CODEC.fieldOf("spread").forGetter(val -> val.spread), - Codec.INT.fieldOf("min_y").forGetter(val -> val.minY), - Codec.INT.fieldOf("max_y").forGetter(val -> val.maxY) - ).apply(instance, CuboidVeinGenerator::new)); + LAYER_CODEC.fieldOf("top").forGetter(val -> val.top), + LAYER_CODEC.fieldOf("middle").forGetter(val -> val.middle), + LAYER_CODEC.fieldOf("bottom").forGetter(val -> val.bottom), + LAYER_CODEC.fieldOf("spread").forGetter(val -> val.spread), + Codec.INT.fieldOf("min_y").forGetter(val -> val.minY), + Codec.INT.fieldOf("max_y").forGetter(val -> val.maxY)).apply(instance, CuboidVeinGenerator::new)); private Either, Material> top; private Either, Material> middle; @@ -60,21 +63,22 @@ public List, Integer>> getAllEntries() { // Entries' values are counted based on how many layers the entry is in. top.map(blockStates -> blockStates.stream().map(state -> Either.left(state.state)), material -> Stream.of(Either.right(material))) - .forEach(entry -> result.add(Map.entry(entry, 2))); + .forEach(entry -> result.add(Map.entry(entry, 2))); middle.map(blockStates -> blockStates.stream().map(state -> Either.left(state.state)), material -> Stream.of(Either.right(material))) - .forEach(entry -> result.add(Map.entry(entry, 3))); + .forEach(entry -> result.add(Map.entry(entry, 3))); bottom.map(blockStates -> blockStates.stream().map(state -> Either.left(state.state)), material -> Stream.of(Either.right(material))) - .forEach(entry -> result.add(Map.entry(entry, 4))); + .forEach(entry -> result.add(Map.entry(entry, 4))); spread.map(blockStates -> blockStates.stream().map(state -> Either.left(state.state)), material -> Stream.of(Either.right(material))) - .forEach(entry -> result.add(Map.entry(entry, 7))); + .forEach(entry -> result.add(Map.entry(entry, 7))); return result; } @Override - public Map generate(WorldGenLevel level, RandomSource random, GTOreDefinition entry, BlockPos origin) { + public Map generate(WorldGenLevel level, RandomSource random, GTOreDefinition entry, + BlockPos origin) { Map generatedBlocks = new Object2ObjectOpenHashMap<>(); int size = entry.clusterSize().sample(random); @@ -108,7 +112,8 @@ public Map generate(WorldGenLevel level, RandomSource int localDensity = (int) Math.max(1, entry.density() * volume); int weightX = Math.max(1, Math.max(Mth.abs(westBound - x), Mth.abs(eastBound - x)) / localDensity); - int weightZ = Math.max(1, Math.max(Mth.abs(southBound - z), Mth.abs(northBound - z)) / localDensity); + int weightZ = Math.max(1, + Math.max(Mth.abs(southBound - z), Mth.abs(northBound - z)) / localDensity); BlockPos pos = new BlockPos(x, layer, z); if (layerOffset <= 1) { @@ -155,7 +160,7 @@ public Map generate(WorldGenLevel level, RandomSource } } - return generatedBlocks; + return generatedBlocks; } /** @@ -192,8 +197,8 @@ private boolean placeTop(Map generatedBlocks, GTOreDef * @return if the ore was placed */ private boolean placeMiddle(Map generatedBlocks, GTOreDefinition entry, - long randomSeed, BlockPos pos, - RandomSource random, int weightX, int weightZ) { + long randomSeed, BlockPos pos, + RandomSource random, int weightX, int weightZ) { var middle = this.middle; if (random.nextInt(2) == 0 && shouldPlaceOre(random, weightX, weightZ)) { generatedBlocks.put(pos, (access, section) -> placeOre(access, section, pos, randomSeed, middle, entry)); @@ -234,7 +239,8 @@ private boolean placeSpread(Map generatedBlocks, GTOre return false; } - public void placeOre(BulkSectionAccess access, LevelChunkSection section, BlockPos pos, long randomSeed, Either, Material> ore, GTOreDefinition entry) { + public void placeOre(BulkSectionAccess access, LevelChunkSection section, BlockPos pos, long randomSeed, + Either, Material> ore, GTOreDefinition entry) { RandomSource random = new XoroshiroRandomSource(randomSeed); int x = SectionPos.sectionRelative(pos.getX()); int y = SectionPos.sectionRelative(pos.getY()); diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/veins/DikeVeinGenerator.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/veins/DikeVeinGenerator.java index 075ed447c6..e7a3000e5e 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/veins/DikeVeinGenerator.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/veins/DikeVeinGenerator.java @@ -8,13 +8,7 @@ import com.gregtechceu.gtceu.api.data.worldgen.ores.OreBlockPlacer; import com.gregtechceu.gtceu.api.data.worldgen.ores.OreVeinUtil; import com.gregtechceu.gtceu.utils.GTUtil; -import com.mojang.datafixers.util.Either; -import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; -import lombok.AllArgsConstructor; -import lombok.Setter; -import lombok.experimental.Accessors; + import net.minecraft.core.BlockPos; import net.minecraft.core.SectionPos; import net.minecraft.util.Mth; @@ -33,6 +27,14 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.AlwaysTrueTest; import net.minecraft.world.level.levelgen.synth.NormalNoise; +import com.mojang.datafixers.util.Either; +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import lombok.AllArgsConstructor; +import lombok.Setter; +import lombok.experimental.Accessors; + import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -42,11 +44,11 @@ @Accessors(fluent = true, chain = true) @AllArgsConstructor public class DikeVeinGenerator extends VeinGenerator { + public static final Codec CODEC = RecordCodecBuilder.create(instance -> instance.group( Codec.list(DikeBlockDefinition.CODEC).fieldOf("blocks").forGetter(it -> it.blocks), Codec.INT.fieldOf("min_y").forGetter(it -> it.minYLevel), - Codec.INT.fieldOf("max_y").forGetter(it -> it.maxYLevel) - ).apply(instance, DikeVeinGenerator::new)); + Codec.INT.fieldOf("max_y").forGetter(it -> it.maxYLevel)).apply(instance, DikeVeinGenerator::new)); public List blocks; @Setter @@ -61,15 +63,18 @@ public DikeVeinGenerator(GTOreDefinition entry) { @Override public List, Integer>> getAllEntries() { return this.blocks.stream() - .flatMap(definition -> - definition.block.map(state -> - state.stream().map(target -> Map.entry(Either.left(target.state), definition.weight)), - material -> Stream.of(Map.entry(Either.right(material), definition.weight)))) + .flatMap(definition -> definition.block.map( + state -> state.stream() + .map(target -> Map.entry(Either.left(target.state), + definition.weight)), + material -> Stream + .of(Map.entry(Either.right(material), definition.weight)))) .collect(Collectors.toList()); } @Override - public Map generate(WorldGenLevel level, RandomSource random, GTOreDefinition entry, BlockPos origin) { + public Map generate(WorldGenLevel level, RandomSource random, GTOreDefinition entry, + BlockPos origin) { Map generatedBlocks = new Object2ObjectOpenHashMap<>(); WorldgenRandom worldgenRandom = new WorldgenRandom(new LegacyRandomSource(level.getSeed())); @@ -89,7 +94,6 @@ public Map generate(WorldGenLevel level, RandomSource BlockPos basePos = new BlockPos(xPos, yBottom, zPos); - for (int dY = yBottom; dY <= yTop; dY++) { for (int dX = -radius; dX <= radius; dX++) { for (int dZ = -radius; dZ <= radius; dZ++) { @@ -101,7 +105,8 @@ public Map generate(WorldGenLevel level, RandomSource if (normalNoise.getValue(dX, dY, dZ) >= 0.5 && random.nextFloat() <= density) { final var randomSeed = random.nextLong(); // Fully deterministic regardless of chunk order - generatedBlocks.put(pos, (access, section) -> placeBlock(access, section, randomSeed, pos, entry)); + generatedBlocks.put(pos, + (access, section) -> placeBlock(access, section, randomSeed, pos, entry)); } } } @@ -111,10 +116,11 @@ public Map generate(WorldGenLevel level, RandomSource } private void placeBlock( - BulkSectionAccess level, LevelChunkSection section, long randomSeed, BlockPos pos, GTOreDefinition entry - ) { + BulkSectionAccess level, LevelChunkSection section, long randomSeed, BlockPos pos, + GTOreDefinition entry) { var rand = new XoroshiroRandomSource(randomSeed); - List> entries = blocks.stream().map(b -> Map.entry(b.weight, b)).toList(); + List> entries = blocks.stream() + .map(b -> Map.entry(b.weight, b)).toList(); DikeBlockDefinition blockDefinition = blocks.get(GTUtil.getRandomItem(rand, entries, entries.size())); BlockState current = level.getBlockState(pos); @@ -125,7 +131,8 @@ private void placeBlock( if (pos.getY() >= blockDefinition.minY() && pos.getY() <= blockDefinition.maxY()) { blockDefinition.block.ifLeft(blockStates -> { for (TargetBlockState targetState : blockStates) { - if (!OreVeinUtil.canPlaceOre(current, level::getBlockState, rand, entry, targetState, pos.mutable())) + if (!OreVeinUtil.canPlaceOre(current, level::getBlockState, rand, entry, targetState, + pos.mutable())) continue; if (targetState.state.isAir()) continue; @@ -178,12 +185,14 @@ public DikeVeinGenerator withBlock(DikeBlockDefinition block) { public record DikeBlockDefinition(Either, Material> block, int weight, int minY, int maxY) { + public static final Codec CODEC = RecordCodecBuilder.create(instance -> instance.group( - Codec.either(TargetBlockState.CODEC.listOf(), GTCEuAPI.materialManager.codec()).fieldOf("block").forGetter(x -> x.block), + Codec.either(TargetBlockState.CODEC.listOf(), GTCEuAPI.materialManager.codec()).fieldOf("block") + .forGetter(x -> x.block), Codec.INT.fieldOf("weight").forGetter(x -> x.weight), Codec.INT.fieldOf("min_y").orElse(320).forGetter(x -> x.minY), - Codec.INT.fieldOf("max_y").orElse(-64).forGetter(x -> x.maxY) - ).apply(instance, DikeBlockDefinition::new)); + Codec.INT.fieldOf("max_y").orElse(-64).forGetter(x -> x.maxY)) + .apply(instance, DikeBlockDefinition::new)); public DikeBlockDefinition(Material block, int weight, int minY, int maxY) { this(Either.right(block), weight, minY, maxY); diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/veins/GeodeVeinGenerator.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/veins/GeodeVeinGenerator.java index 6bb6a34382..601e756ada 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/veins/GeodeVeinGenerator.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/veins/GeodeVeinGenerator.java @@ -1,6 +1,5 @@ package com.gregtechceu.gtceu.api.data.worldgen.generator.veins; -import com.google.common.collect.Lists; import com.gregtechceu.gtceu.api.GTCEuAPI; import com.gregtechceu.gtceu.api.data.chemical.ChemicalHelper; import com.gregtechceu.gtceu.api.data.chemical.material.Material; @@ -8,13 +7,7 @@ import com.gregtechceu.gtceu.api.data.worldgen.GTOreDefinition; import com.gregtechceu.gtceu.api.data.worldgen.generator.VeinGenerator; import com.gregtechceu.gtceu.api.data.worldgen.ores.OreBlockPlacer; -import com.mojang.datafixers.util.Either; -import com.mojang.datafixers.util.Pair; -import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import lombok.AllArgsConstructor; -import lombok.Setter; -import lombok.experimental.Accessors; + import net.minecraft.Util; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -44,6 +37,15 @@ import net.minecraft.world.level.levelgen.feature.stateproviders.BlockStateProvider; import net.minecraft.world.level.levelgen.synth.NormalNoise; import net.minecraft.world.level.material.FluidState; + +import com.google.common.collect.Lists; +import com.mojang.datafixers.util.Either; +import com.mojang.datafixers.util.Pair; +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import lombok.AllArgsConstructor; +import lombok.Setter; +import lombok.experimental.Accessors; import org.jetbrains.annotations.Nullable; import java.util.ArrayList; @@ -56,24 +58,31 @@ @Accessors(chain = true, fluent = true) @AllArgsConstructor public class GeodeVeinGenerator extends VeinGenerator { + private static final Direction[] DIRECTIONS = Direction.values(); public static final Codec CHANCE_RANGE = Codec.doubleRange(0.0, 1.0); public static final Codec CODEC = RecordCodecBuilder.create((instance) -> instance.group( - GeodeBlockSettings.CODEC.fieldOf("blocks").forGetter((config) -> config.geodeBlockSettings), - GeodeLayerSettings.CODEC.fieldOf("layers").forGetter((config) -> config.geodeLayerSettings), - GeodeCrackSettings.CODEC.fieldOf("crack").forGetter((config) -> config.geodeCrackSettings), - CHANCE_RANGE.fieldOf("use_potential_placements_chance").orElse(0.35).forGetter((config) -> config.usePotentialPlacementsChance), - CHANCE_RANGE.fieldOf("use_alternate_layer0_chance").orElse(0.0).forGetter((config) -> config.useAlternateLayer0Chance), - Codec.BOOL.fieldOf("placements_require_layer0_alternate").orElse(true).forGetter((config) -> config.placementsRequireLayer0Alternate), - IntProvider.codec(1, 20).fieldOf("outer_wall_distance").orElse(UniformInt.of(4, 5)).forGetter((config) -> config.outerWallDistance), - IntProvider.codec(1, 20).fieldOf("distribution_points").orElse(UniformInt.of(3, 4)).forGetter((config) -> config.distributionPoints), - IntProvider.codec(0, 10).fieldOf("point_offset").orElse(UniformInt.of(1, 2)).forGetter((config) -> config.pointOffset), - Codec.INT.fieldOf("min_gen_offset").orElse(-16).forGetter((config) -> config.minGenOffset), - Codec.INT.fieldOf("max_gen_offset").orElse(16).forGetter((config) -> config.maxGenOffset), - CHANCE_RANGE.fieldOf("noise_multiplier").orElse(0.05).forGetter((config) -> config.noiseMultiplier), - Codec.INT.fieldOf("invalid_blocks_threshold").forGetter((config) -> config.invalidBlocksThreshold)) + GeodeBlockSettings.CODEC.fieldOf("blocks").forGetter((config) -> config.geodeBlockSettings), + GeodeLayerSettings.CODEC.fieldOf("layers").forGetter((config) -> config.geodeLayerSettings), + GeodeCrackSettings.CODEC.fieldOf("crack").forGetter((config) -> config.geodeCrackSettings), + CHANCE_RANGE.fieldOf("use_potential_placements_chance").orElse(0.35) + .forGetter((config) -> config.usePotentialPlacementsChance), + CHANCE_RANGE.fieldOf("use_alternate_layer0_chance").orElse(0.0) + .forGetter((config) -> config.useAlternateLayer0Chance), + Codec.BOOL.fieldOf("placements_require_layer0_alternate").orElse(true) + .forGetter((config) -> config.placementsRequireLayer0Alternate), + IntProvider.codec(1, 20).fieldOf("outer_wall_distance").orElse(UniformInt.of(4, 5)) + .forGetter((config) -> config.outerWallDistance), + IntProvider.codec(1, 20).fieldOf("distribution_points").orElse(UniformInt.of(3, 4)) + .forGetter((config) -> config.distributionPoints), + IntProvider.codec(0, 10).fieldOf("point_offset").orElse(UniformInt.of(1, 2)) + .forGetter((config) -> config.pointOffset), + Codec.INT.fieldOf("min_gen_offset").orElse(-16).forGetter((config) -> config.minGenOffset), + Codec.INT.fieldOf("max_gen_offset").orElse(16).forGetter((config) -> config.maxGenOffset), + CHANCE_RANGE.fieldOf("noise_multiplier").orElse(0.05).forGetter((config) -> config.noiseMultiplier), + Codec.INT.fieldOf("invalid_blocks_threshold").forGetter((config) -> config.invalidBlocksThreshold)) .apply(instance, GeodeVeinGenerator::new)); @Setter @@ -111,17 +120,23 @@ public GeodeVeinGenerator(GTOreDefinition entry) { public List, Integer>> getAllEntries() { RandomSource source = new LegacyRandomSource(0); return List.of( - Map.entry(geodeBlockSettings.fillingProvider.mapBoth(provider -> provider.getState(source, BlockPos.ZERO), Function.identity()), 1), - Map.entry(geodeBlockSettings.innerLayerProvider.mapBoth(provider -> provider.getState(source, BlockPos.ZERO), Function.identity()), 1), - Map.entry(geodeBlockSettings.alternateInnerLayerProvider.mapBoth(provider -> provider.getState(source, BlockPos.ZERO), Function.identity()), 1), - Map.entry(geodeBlockSettings.middleLayerProvider.mapBoth(provider -> provider.getState(source, BlockPos.ZERO), Function.identity()), 1), - Map.entry(geodeBlockSettings.outerLayerProvider.mapBoth(provider -> provider.getState(source, BlockPos.ZERO), Function.identity()), 1) - ); + Map.entry(geodeBlockSettings.fillingProvider + .mapBoth(provider -> provider.getState(source, BlockPos.ZERO), Function.identity()), 1), + Map.entry(geodeBlockSettings.innerLayerProvider + .mapBoth(provider -> provider.getState(source, BlockPos.ZERO), Function.identity()), 1), + Map.entry(geodeBlockSettings.alternateInnerLayerProvider + .mapBoth(provider -> provider.getState(source, BlockPos.ZERO), Function.identity()), 1), + Map.entry(geodeBlockSettings.middleLayerProvider + .mapBoth(provider -> provider.getState(source, BlockPos.ZERO), Function.identity()), 1), + Map.entry(geodeBlockSettings.outerLayerProvider + .mapBoth(provider -> provider.getState(source, BlockPos.ZERO), Function.identity()), 1)); } @Override - public Map generate(WorldGenLevel level, RandomSource random, GTOreDefinition entry, BlockPos origin) { - // TODO refactor geode sizes for the new ore generation system. For now, geode veins are still generated in place. + public Map generate(WorldGenLevel level, RandomSource random, GTOreDefinition entry, + BlockPos origin) { + // TODO refactor geode sizes for the new ore generation system. For now, geode veins are still generated in + // place. BulkSectionAccess access = new BulkSectionAccess(level); @@ -135,19 +150,22 @@ public Map generate(WorldGenLevel level, RandomSource WorldgenRandom worldgenRandom = new WorldgenRandom(new LegacyRandomSource(level.getSeed())); NormalNoise normalNoise = NormalNoise.create(worldgenRandom, -4, 1.0); LinkedList list2 = Lists.newLinkedList(); - double wallDistance = (double)distributionSample / (double)this.outerWallDistance.getMaxValue(); + double wallDistance = (double) distributionSample / (double) this.outerWallDistance.getMaxValue(); double fillingSize = 1.0 / Math.sqrt(geodeLayerSettings.filling); double innerSize = 1.0 / Math.sqrt(geodeLayerSettings.innerLayer + wallDistance); double middleSize = 1.0 / Math.sqrt(geodeLayerSettings.middleLayer + wallDistance); double outerSize = 1.0 / Math.sqrt(geodeLayerSettings.outerLayer + wallDistance); - double crackSize = 1.0 / Math.sqrt(geodeCrackSettings.baseCrackSize + random.nextDouble() / 2.0 + (distributionSample > 3 ? wallDistance : 0.0)); - boolean doCrack = (double)random.nextFloat() < geodeCrackSettings.generateCrackChance; + double crackSize = 1.0 / Math.sqrt(geodeCrackSettings.baseCrackSize + random.nextDouble() / 2.0 + + (distributionSample > 3 ? wallDistance : 0.0)); + boolean doCrack = (double) random.nextFloat() < geodeCrackSettings.generateCrackChance; int invalidBlocksCount = 0; for (offset2 = 0; offset2 < distributionSample; ++offset2) { offset = this.outerWallDistance.sample(random); - BlockPos origin2 = origin.offset(offset, this.outerWallDistance.sample(random), this.outerWallDistance.sample(random)); + BlockPos origin2 = origin.offset(offset, this.outerWallDistance.sample(random), + this.outerWallDistance.sample(random)); blockState = access.getBlockState(origin2); - if ((blockState.isAir() || blockState.is(BlockTags.GEODE_INVALID_BLOCKS)) && ++invalidBlocksCount > this.invalidBlocksThreshold) { + if ((blockState.isAir() || blockState.is(BlockTags.GEODE_INVALID_BLOCKS)) && + ++invalidBlocksCount > this.invalidBlocksThreshold) { return Map.of(); } points.add(Pair.of(origin2, this.pointOffset.sample(random))); @@ -175,7 +193,8 @@ public Map generate(WorldGenLevel level, RandomSource } ArrayList positions = Lists.newArrayList(); Predicate placementPredicate = GeodeFeature.isReplaceable(this.geodeBlockSettings.cannotReplace); - for (BlockPos pos : BlockPos.betweenClosed(origin.offset(minOffset, minOffset, minOffset), origin.offset(maxOffset, maxOffset, maxOffset))) { + for (BlockPos pos : BlockPos.betweenClosed(origin.offset(minOffset, minOffset, minOffset), + origin.offset(maxOffset, maxOffset, maxOffset))) { double noiseValue = normalNoise.getValue(pos.getX(), pos.getY(), pos.getZ()) * this.noiseMultiplier; double s = 0.0; double t = 0.0; @@ -183,7 +202,7 @@ public Map generate(WorldGenLevel level, RandomSource s += Mth.fastInvSqrt(pos.distSqr(pair.getFirst()) + (double) pair.getSecond()) + noiseValue; } for (BlockPos origin4 : list2) { - t += Mth.fastInvSqrt(pos.distSqr(origin4) + (double)geodeCrackSettings.crackPointOffset) + noiseValue; + t += Mth.fastInvSqrt(pos.distSqr(origin4) + (double) geodeCrackSettings.crackPointOffset) + noiseValue; } if (s < outerSize) continue; if (!level.ensureCanWrite(pos)) @@ -202,29 +221,43 @@ public Map generate(WorldGenLevel level, RandomSource continue; } if (s >= fillingSize) { - this.safeSetBlock(access, section, pos, getStateFromEither(geodeBlockSettings.fillingProvider, geodeBlockSettings, random, pos), placementPredicate); + this.safeSetBlock(access, section, pos, + getStateFromEither(geodeBlockSettings.fillingProvider, geodeBlockSettings, random, pos), + placementPredicate); continue; } if (s >= innerSize) { - boolean useAltLayer = (double)random.nextFloat() < this.useAlternateLayer0Chance; + boolean useAltLayer = (double) random.nextFloat() < this.useAlternateLayer0Chance; if (useAltLayer) { - this.safeSetBlock(access, section, pos, getStateFromEither(geodeBlockSettings.alternateInnerLayerProvider, geodeBlockSettings, random, pos), placementPredicate); + this.safeSetBlock(access, section, pos, + getStateFromEither(geodeBlockSettings.alternateInnerLayerProvider, geodeBlockSettings, + random, pos), + placementPredicate); } else { - this.safeSetBlock(access, section, pos, getStateFromEither(geodeBlockSettings.innerLayerProvider, geodeBlockSettings, random, pos), placementPredicate); + this.safeSetBlock(access, section, pos, + getStateFromEither(geodeBlockSettings.innerLayerProvider, geodeBlockSettings, random, pos), + placementPredicate); } - if (this.placementsRequireLayer0Alternate && !useAltLayer || !((double)random.nextFloat() < this.usePotentialPlacementsChance)) continue; + if (this.placementsRequireLayer0Alternate && !useAltLayer || + !((double) random.nextFloat() < this.usePotentialPlacementsChance)) + continue; positions.add(pos.immutable()); continue; } if (s >= middleSize) { - this.safeSetBlock(access, section, pos, getStateFromEither(geodeBlockSettings.middleLayerProvider, geodeBlockSettings, random, pos), placementPredicate); + this.safeSetBlock(access, section, pos, + getStateFromEither(geodeBlockSettings.middleLayerProvider, geodeBlockSettings, random, pos), + placementPredicate); continue; } if (!(s >= outerSize)) continue; - this.safeSetBlock(access, section, pos, getStateFromEither(geodeBlockSettings.outerLayerProvider, geodeBlockSettings, random, pos), placementPredicate); + this.safeSetBlock(access, section, pos, + getStateFromEither(geodeBlockSettings.outerLayerProvider, geodeBlockSettings, random, pos), + placementPredicate); } List innerPlacements = geodeBlockSettings.innerPlacements; - block5: for (BlockPos origin2 : positions) { + block5: + for (BlockPos origin2 : positions) { blockState = Util.getRandom(innerPlacements, random); for (Direction direction2 : DIRECTIONS) { if (blockState.hasProperty(BlockStateProperties.FACING)) { @@ -233,7 +266,8 @@ public Map generate(WorldGenLevel level, RandomSource BlockPos origin6 = origin2.relative(direction2); BlockState blockState2 = access.getBlockState(origin6); if (blockState.hasProperty(BlockStateProperties.WATERLOGGED)) { - blockState = blockState.setValue(BlockStateProperties.WATERLOGGED, blockState2.getFluidState().isSource()); + blockState = blockState.setValue(BlockStateProperties.WATERLOGGED, + blockState2.getFluidState().isSource()); } if (!BuddingAmethystBlock.canClusterGrowAtState(blockState2)) continue; if (!level.ensureCanWrite(origin6)) @@ -250,8 +284,8 @@ public Map generate(WorldGenLevel level, RandomSource return Map.of(); } - - protected void safeSetBlock(BulkSectionAccess level, LevelChunkSection section, BlockPos pos, BlockState state, Predicate oldState) { + protected void safeSetBlock(BulkSectionAccess level, LevelChunkSection section, BlockPos pos, BlockState state, + Predicate oldState) { if (oldState.test(level.getBlockState(pos))) { int x = SectionPos.sectionRelative(pos.getX()); int y = SectionPos.sectionRelative(pos.getY()); @@ -260,8 +294,10 @@ protected void safeSetBlock(BulkSectionAccess level, LevelChunkSection section, } } - protected BlockState getStateFromEither(Either either, GeodeBlockSettings settings, RandomSource random, BlockPos pos) { - return either.map(provider -> provider.getState(random, pos), material -> ChemicalHelper.getBlock(settings.providerMaterialPrefix, material).defaultBlockState()); + protected BlockState getStateFromEither(Either either, GeodeBlockSettings settings, + RandomSource random, BlockPos pos) { + return either.map(provider -> provider.getState(random, pos), + material -> ChemicalHelper.getBlock(settings.providerMaterialPrefix, material).defaultBlockState()); } @Override @@ -271,7 +307,10 @@ public VeinGenerator build() { @Override public VeinGenerator copy() { - return new GeodeVeinGenerator(this.geodeBlockSettings, this.geodeLayerSettings, this.geodeCrackSettings, this.usePotentialPlacementsChance, this.useAlternateLayer0Chance, this.placementsRequireLayer0Alternate, this.outerWallDistance, this.distributionPoints, this.pointOffset, this.minGenOffset, this.maxGenOffset, this.noiseMultiplier, this.invalidBlocksThreshold); + return new GeodeVeinGenerator(this.geodeBlockSettings, this.geodeLayerSettings, this.geodeCrackSettings, + this.usePotentialPlacementsChance, this.useAlternateLayer0Chance, this.placementsRequireLayer0Alternate, + this.outerWallDistance, this.distributionPoints, this.pointOffset, this.minGenOffset, this.maxGenOffset, + this.noiseMultiplier, this.invalidBlocksThreshold); } @Override @@ -284,17 +323,29 @@ public record GeodeBlockSettings(Either fillingPro Either alternateInnerLayerProvider, Either middleLayerProvider, Either outerLayerProvider, - List innerPlacements, TagKey cannotReplace, TagKey invalidBlocks, @Nullable TagPrefix providerMaterialPrefix) { + List innerPlacements, TagKey cannotReplace, + TagKey invalidBlocks, @Nullable TagPrefix providerMaterialPrefix) { + public static final Codec CODEC = RecordCodecBuilder.create(instance -> instance.group( - Codec.either(BlockStateProvider.CODEC, GTCEuAPI.materialManager.codec()).fieldOf("filling_provider").forGetter(config -> config.fillingProvider), - Codec.either(BlockStateProvider.CODEC, GTCEuAPI.materialManager.codec()).fieldOf("inner_layer_provider").forGetter(config -> config.innerLayerProvider), - Codec.either(BlockStateProvider.CODEC, GTCEuAPI.materialManager.codec()).fieldOf("alternate_inner_layer_provider").forGetter(config -> config.alternateInnerLayerProvider), - Codec.either(BlockStateProvider.CODEC, GTCEuAPI.materialManager.codec()).fieldOf("middle_layer_provider").forGetter(config -> config.middleLayerProvider), - Codec.either(BlockStateProvider.CODEC, GTCEuAPI.materialManager.codec()).fieldOf("outer_layer_provider").forGetter(config -> config.outerLayerProvider), - ExtraCodecs.nonEmptyList(BlockState.CODEC.listOf()).fieldOf("inner_placements").forGetter(config -> config.innerPlacements), - TagKey.hashedCodec(Registries.BLOCK).fieldOf("cannot_replace").forGetter(config -> config.cannotReplace), - TagKey.hashedCodec(Registries.BLOCK).fieldOf("invalid_blocks").forGetter(config -> config.invalidBlocks), - TagPrefix.CODEC.optionalFieldOf("provider_material_prefix", TagPrefix.block).forGetter(config -> config.providerMaterialPrefix) - ).apply(instance, GeodeBlockSettings::new)); + Codec.either(BlockStateProvider.CODEC, GTCEuAPI.materialManager.codec()).fieldOf("filling_provider") + .forGetter(config -> config.fillingProvider), + Codec.either(BlockStateProvider.CODEC, GTCEuAPI.materialManager.codec()).fieldOf("inner_layer_provider") + .forGetter(config -> config.innerLayerProvider), + Codec.either(BlockStateProvider.CODEC, GTCEuAPI.materialManager.codec()) + .fieldOf("alternate_inner_layer_provider") + .forGetter(config -> config.alternateInnerLayerProvider), + Codec.either(BlockStateProvider.CODEC, GTCEuAPI.materialManager.codec()) + .fieldOf("middle_layer_provider").forGetter(config -> config.middleLayerProvider), + Codec.either(BlockStateProvider.CODEC, GTCEuAPI.materialManager.codec()).fieldOf("outer_layer_provider") + .forGetter(config -> config.outerLayerProvider), + ExtraCodecs.nonEmptyList(BlockState.CODEC.listOf()).fieldOf("inner_placements") + .forGetter(config -> config.innerPlacements), + TagKey.hashedCodec(Registries.BLOCK).fieldOf("cannot_replace") + .forGetter(config -> config.cannotReplace), + TagKey.hashedCodec(Registries.BLOCK).fieldOf("invalid_blocks") + .forGetter(config -> config.invalidBlocks), + TagPrefix.CODEC.optionalFieldOf("provider_material_prefix", TagPrefix.block) + .forGetter(config -> config.providerMaterialPrefix)) + .apply(instance, GeodeBlockSettings::new)); } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/veins/LayeredVeinGenerator.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/veins/LayeredVeinGenerator.java index 9d92cafda7..56cad35242 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/veins/LayeredVeinGenerator.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/veins/LayeredVeinGenerator.java @@ -7,11 +7,7 @@ import com.gregtechceu.gtceu.api.data.worldgen.generator.VeinGenerator; import com.gregtechceu.gtceu.api.data.worldgen.ores.OreBlockPlacer; import com.gregtechceu.gtceu.api.data.worldgen.ores.OreVeinUtil; -import com.mojang.datafixers.util.Either; -import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import com.tterrag.registrate.util.nullness.NonNullSupplier; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.core.BlockPos; import net.minecraft.core.SectionPos; import net.minecraft.util.Mth; @@ -24,6 +20,12 @@ import net.minecraft.world.level.levelgen.XoroshiroRandomSource; import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration; +import com.mojang.datafixers.util.Either; +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import com.tterrag.registrate.util.nullness.NonNullSupplier; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -33,10 +35,12 @@ import java.util.stream.Stream; public class LayeredVeinGenerator extends VeinGenerator { + public static final Codec CODEC = RecordCodecBuilder.create(instance -> instance.group( - GTLayerPattern.CODEC.listOf().fieldOf("layer_patterns").forGetter(ft -> ft.layerPatterns != null ? ft.layerPatterns : ft.bakingLayerPatterns.stream().map(Supplier::get).collect(Collectors.toList())) - ).apply(instance, LayeredVeinGenerator::new) - ); + GTLayerPattern.CODEC.listOf().fieldOf("layer_patterns") + .forGetter(ft -> ft.layerPatterns != null ? ft.layerPatterns : + ft.bakingLayerPatterns.stream().map(Supplier::get).collect(Collectors.toList()))) + .apply(instance, LayeredVeinGenerator::new)); private final List> bakingLayerPatterns = new ArrayList<>(); @@ -50,20 +54,26 @@ public LayeredVeinGenerator(GTOreDefinition entry) { public List, Integer>> getAllEntries() { return layerPatterns.stream() .flatMap(pattern -> pattern.layers.stream()) - .map(layer -> Map.entry(layer.targets.stream().flatMap(entry -> - entry.map(blockStates -> blockStates.stream().map(state -> Either.left(state.state)), - material -> Stream.of(Either.right(material)))).toList(), + .map(layer -> Map.entry( + layer.targets.stream() + .flatMap(entry -> entry.map( + blockStates -> blockStates.stream() + .map(state -> Either.left(state.state)), + material -> Stream.of(Either.right(material)))) + .toList(), layer.weight)) .flatMap(entry -> { var iterator = entry.getKey().iterator(); - return Stream.generate(() -> Map.entry(iterator.next(), entry.getValue())).limit(entry.getKey().size()); + return Stream.generate(() -> Map.entry(iterator.next(), entry.getValue())) + .limit(entry.getKey().size()); }) .distinct() .collect(Collectors.toList()); } @Override - public Map generate(WorldGenLevel level, RandomSource random, GTOreDefinition entry, BlockPos origin) { + public Map generate(WorldGenLevel level, RandomSource random, GTOreDefinition entry, + BlockPos origin) { Map generatedBlocks = new Object2ObjectOpenHashMap<>(); var patternPool = this.layerPatterns; @@ -87,7 +97,6 @@ public Map generate(WorldGenLevel level, RandomSource if (origin.getY() >= level.getMaxBuildHeight()) return Map.of(); - List resolvedLayers = new ArrayList<>(); List layerDiameterOffsets = new ArrayList<>(); @@ -112,7 +121,8 @@ public Map generate(WorldGenLevel level, RandomSource int layerIndex = layerCoordinate == 0 ? zOffset : layerCoordinate == 1 ? xOffset : yOffset; if (slantyCoordinate != layerCoordinate) - layerIndex += Mth.floor(slantyCoordinate == 0 ? zOffset : slantyCoordinate == 1 ? xOffset : yOffset) * slope; + layerIndex += Mth.floor( + slantyCoordinate == 0 ? zOffset : slantyCoordinate == 1 ? xOffset : yOffset) * slope; while (layerIndex >= resolvedLayers.size()) { GTLayerPattern.Layer next = layerPattern.rollNext( @@ -125,7 +135,8 @@ public Map generate(WorldGenLevel level, RandomSource } } - if ((sizeFractionX * sizeFractionX) + (sizeFractionY * sizeFractionY) + (sizeFractionZ * sizeFractionZ) > 1 * layerDiameterOffsets.get(layerIndex)) + if ((sizeFractionX * sizeFractionX) + (sizeFractionY * sizeFractionY) + + (sizeFractionZ * sizeFractionZ) > 1 * layerDiameterOffsets.get(layerIndex)) continue; GTLayerPattern.Layer layer = resolvedLayers.get(layerIndex); @@ -138,9 +149,8 @@ public Map generate(WorldGenLevel level, RandomSource final var randomSeed = random.nextLong(); // Fully deterministic regardless of chunk order BlockPos currentPos = new BlockPos(currentX, currentY, currentZ); - generatedBlocks.put(currentPos, (access, section) -> - placeBlock(access, section, randomSeed, entry, density, state, currentPos) - ); + generatedBlocks.put(currentPos, (access, section) -> placeBlock(access, section, randomSeed, entry, + density, state, currentPos)); } } } @@ -162,7 +172,8 @@ private static void placeBlock(BulkSectionAccess access, LevelChunkSection secti if (random.nextFloat() <= density) { state.ifLeft(blockStates -> { for (OreConfiguration.TargetBlockState targetState : blockStates) { - if (!OreVeinUtil.canPlaceOre(blockState, access::getBlockState, random, entry, targetState, posCursor)) + if (!OreVeinUtil.canPlaceOre(blockState, access::getBlockState, random, entry, targetState, + posCursor)) continue; if (targetState.state.isAir()) continue; @@ -218,4 +229,3 @@ public Codec codec() { return CODEC; } } - diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/veins/NoopVeinGenerator.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/veins/NoopVeinGenerator.java index d0a0fca6f7..56a0abd5aa 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/veins/NoopVeinGenerator.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/veins/NoopVeinGenerator.java @@ -4,17 +4,20 @@ import com.gregtechceu.gtceu.api.data.worldgen.GTOreDefinition; import com.gregtechceu.gtceu.api.data.worldgen.generator.VeinGenerator; import com.gregtechceu.gtceu.api.data.worldgen.ores.OreBlockPlacer; -import com.mojang.datafixers.util.Either; -import com.mojang.serialization.Codec; + import net.minecraft.core.BlockPos; import net.minecraft.util.RandomSource; import net.minecraft.world.level.WorldGenLevel; import net.minecraft.world.level.block.state.BlockState; +import com.mojang.datafixers.util.Either; +import com.mojang.serialization.Codec; + import java.util.List; import java.util.Map; public class NoopVeinGenerator extends VeinGenerator { + public static final NoopVeinGenerator INSTANCE = new NoopVeinGenerator(); public static final Codec CODEC = Codec.unit(() -> INSTANCE); @@ -24,7 +27,8 @@ public List, Integer>> getAllEntries() { } @Override - public Map generate(WorldGenLevel level, RandomSource random, GTOreDefinition entry, BlockPos origin) { + public Map generate(WorldGenLevel level, RandomSource random, GTOreDefinition entry, + BlockPos origin) { return Map.of(); } @@ -43,4 +47,3 @@ public Codec codec() { return CODEC; } } - diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/veins/StandardVeinGenerator.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/veins/StandardVeinGenerator.java index 3611c53fd2..d16ae48c71 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/veins/StandardVeinGenerator.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/veins/StandardVeinGenerator.java @@ -7,11 +7,7 @@ import com.gregtechceu.gtceu.api.data.worldgen.generator.VeinGenerator; import com.gregtechceu.gtceu.api.data.worldgen.ores.OreBlockPlacer; import com.gregtechceu.gtceu.api.data.worldgen.ores.OreVeinUtil; -import com.mojang.datafixers.util.Either; -import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import com.tterrag.registrate.util.nullness.NonNullSupplier; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.core.BlockPos; import net.minecraft.core.SectionPos; import net.minecraft.core.registries.BuiltInRegistries; @@ -26,6 +22,12 @@ import net.minecraft.world.level.levelgen.XoroshiroRandomSource; import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration; import net.minecraft.world.level.levelgen.structure.templatesystem.TagMatchTest; + +import com.mojang.datafixers.util.Either; +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import com.tterrag.registrate.util.nullness.NonNullSupplier; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import org.apache.commons.lang3.mutable.MutableInt; import java.util.ArrayList; @@ -36,17 +38,22 @@ import java.util.stream.Collectors; public class StandardVeinGenerator extends VeinGenerator { - public static final Codec CODEC_SEPARATE = RecordCodecBuilder.create(instance -> instance.group( - BuiltInRegistries.BLOCK.byNameCodec().fieldOf("block").forGetter(ext -> ext.block.get()), - BuiltInRegistries.BLOCK.byNameCodec().fieldOf("deep_block").forGetter(ext -> ext.deepBlock.get()), - BuiltInRegistries.BLOCK.byNameCodec().fieldOf("nether_block").forGetter(ext -> ext.netherBlock.get()) - ).apply(instance, StandardVeinGenerator::new)); + + public static final Codec CODEC_SEPARATE = RecordCodecBuilder + .create(instance -> instance.group( + BuiltInRegistries.BLOCK.byNameCodec().fieldOf("block").forGetter(ext -> ext.block.get()), + BuiltInRegistries.BLOCK.byNameCodec().fieldOf("deep_block").forGetter(ext -> ext.deepBlock.get()), + BuiltInRegistries.BLOCK.byNameCodec().fieldOf("nether_block") + .forGetter(ext -> ext.netherBlock.get())) + .apply(instance, StandardVeinGenerator::new)); public static final Codec CODEC_LIST = RecordCodecBuilder.create(instance -> instance.group( - Codec.either(OreConfiguration.TargetBlockState.CODEC.listOf(), GTCEuAPI.materialManager.codec()).fieldOf("targets").forGetter(ext -> ext.blocks) - ).apply(instance, StandardVeinGenerator::new)); + Codec.either(OreConfiguration.TargetBlockState.CODEC.listOf(), GTCEuAPI.materialManager.codec()) + .fieldOf("targets").forGetter(ext -> ext.blocks)) + .apply(instance, StandardVeinGenerator::new)); - public static final Codec CODEC = Codec.either(CODEC_SEPARATE, CODEC_LIST).xmap(either -> either.map(Function.identity(), Function.identity()), Either::left); + public static final Codec CODEC = Codec.either(CODEC_SEPARATE, CODEC_LIST) + .xmap(either -> either.map(Function.identity(), Function.identity()), Either::left); public NonNullSupplier block; public NonNullSupplier deepBlock; @@ -90,14 +97,12 @@ public List, Integer>> getAllEntries() { return this.blocks.map(blockStates -> blockStates.stream() .map(state -> Either.left(state.state)) .map(entry -> Map.entry(entry, 1)) - .collect(Collectors.toList()), material -> List.of(Map.entry(Either.right(material), 1)) - ); + .collect(Collectors.toList()), material -> List.of(Map.entry(Either.right(material), 1))); } else { return List.of( Map.entry(Either.left(block.get().defaultBlockState()), 1), Map.entry(Either.left(deepBlock.get().defaultBlockState()), 1), - Map.entry(Either.left(netherBlock.get().defaultBlockState()), 1) - ); + Map.entry(Either.left(netherBlock.get().defaultBlockState()), 1)); } } @@ -106,15 +111,18 @@ public VeinGenerator build() { // if (this.blocks.left().isPresent() && !this.blocks.left().get().isEmpty()) return this; List targetStates = new ArrayList<>(); if (this.block != null) { - targetStates.add(OreConfiguration.target(new TagMatchTest(BlockTags.STONE_ORE_REPLACEABLES), this.block.get().defaultBlockState())); + targetStates.add(OreConfiguration.target(new TagMatchTest(BlockTags.STONE_ORE_REPLACEABLES), + this.block.get().defaultBlockState())); } if (this.deepBlock != null) { - targetStates.add(OreConfiguration.target(new TagMatchTest(BlockTags.DEEPSLATE_ORE_REPLACEABLES), this.deepBlock.get().defaultBlockState())); + targetStates.add(OreConfiguration.target(new TagMatchTest(BlockTags.DEEPSLATE_ORE_REPLACEABLES), + this.deepBlock.get().defaultBlockState())); } if (this.netherBlock != null) { - targetStates.add(OreConfiguration.target(new TagMatchTest(BlockTags.NETHER_CARVER_REPLACEABLES), this.netherBlock.get().defaultBlockState())); + targetStates.add(OreConfiguration.target(new TagMatchTest(BlockTags.NETHER_CARVER_REPLACEABLES), + this.netherBlock.get().defaultBlockState())); } this.blocks = Either.left(targetStates); @@ -132,7 +140,8 @@ public Codec codec() { } @Override - public Map generate(WorldGenLevel level, RandomSource random, GTOreDefinition entry, BlockPos origin) { + public Map generate(WorldGenLevel level, RandomSource random, GTOreDefinition entry, + BlockPos origin) { Map generatedBlocks = new Object2ObjectOpenHashMap<>(); int size = entry.clusterSize().sample(random); @@ -153,7 +162,8 @@ public Map generate(WorldGenLevel level, RandomSource for (int heightmapX = x; heightmapX <= x + width; ++heightmapX) { for (int heightmapZ = z; heightmapZ <= z + width; ++heightmapZ) { - this.doPlaceNormal(generatedBlocks, random, entry, origin, this.blocks, minX, maxX, minZ, maxZ, minY, maxY, x, y, z, width, height); + this.doPlaceNormal(generatedBlocks, random, entry, origin, this.blocks, minX, maxX, minZ, maxZ, minY, + maxY, x, y, z, width, height); // Stop after first successful placement attempt if (!generatedBlocks.isEmpty()) @@ -164,10 +174,11 @@ public Map generate(WorldGenLevel level, RandomSource return generatedBlocks; } - protected void doPlaceNormal(Map generatedBlocks, RandomSource random, GTOreDefinition entry, BlockPos origin, - Either, Material> targets, - double pMinX, double pMaxX, double pMinZ, double pMaxZ, double pMinY, double pMaxY, - int pX, int pY, int pZ, int pWidth, int pHeight) { + protected void doPlaceNormal(Map generatedBlocks, RandomSource random, + GTOreDefinition entry, BlockPos origin, + Either, Material> targets, + double pMinX, double pMaxX, double pMinZ, double pMaxZ, double pMinY, double pMaxY, + int pX, int pY, int pZ, int pWidth, int pHeight) { MutableInt placedAmount = new MutableInt(1); BitSet placedBlocks = new BitSet(pWidth * pHeight * pWidth); BlockPos.MutableBlockPos posCursor = new BlockPos.MutableBlockPos(); @@ -182,7 +193,8 @@ protected void doPlaceNormal(Map generatedBlocks, Rand double z = Mth.lerp(centerOffsetFraction, pMinZ, pMaxZ); double randomOffsetModifier = random.nextDouble() * (double) size / 16.0D; - double randomShapeOffset = ((double) (Mth.sin((float) Math.PI * centerOffsetFraction) + 1.0F) * randomOffsetModifier + 1.0D) / 2.0D; + double randomShapeOffset = ((double) (Mth.sin((float) Math.PI * centerOffsetFraction) + 1.0F) * + randomOffsetModifier + 1.0D) / 2.0D; int shapeIdxOffset = centerOffset * 4; shape[shapeIdxOffset] = x; @@ -222,14 +234,15 @@ protected void doPlaceNormal(Map generatedBlocks, Rand generateShape( generatedBlocks, random, entry, origin, targets, pX, pY, pZ, pWidth, pHeight, - shape, shapeIdxOffset, placedBlocks, posCursor, density, placedAmount - ); + shape, shapeIdxOffset, placedBlocks, posCursor, density, placedAmount); } } - private static void generateShape(Map generatedBlocks, RandomSource random, GTOreDefinition entry, BlockPos origin, + private static void generateShape(Map generatedBlocks, RandomSource random, + GTOreDefinition entry, BlockPos origin, Either, Material> targets, - int pX, int pY, int pZ, int pWidth, int pHeight, double[] shape, int shapeIdxOffset, + int pX, int pY, int pZ, int pWidth, int pHeight, double[] shape, + int shapeIdxOffset, BitSet placedBlocks, BlockPos.MutableBlockPos posCursor, float density, MutableInt placedAmount) { double randomShapeOffset = shape[shapeIdxOffset + 3]; @@ -273,9 +286,8 @@ private static void generateShape(Map generatedBlocks, BlockPos pos = posCursor.immutable(); final var randomSeed = random.nextLong(); // Fully deterministic regardless of chunk order - generatedBlocks.put(pos, (access, section) -> - placeBlock(access, randomSeed, entry, targets, pos, density, placedAmount) - ); + generatedBlocks.put(pos, (access, section) -> placeBlock(access, randomSeed, entry, targets, pos, + density, placedAmount)); } } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/veins/VeinedVeinGenerator.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/veins/VeinedVeinGenerator.java index f91eae1a3f..755fa3f68e 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/veins/VeinedVeinGenerator.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/generator/veins/VeinedVeinGenerator.java @@ -10,13 +10,7 @@ import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.common.data.GTFeatures; import com.gregtechceu.gtceu.utils.GTUtil; -import com.mojang.datafixers.util.Either; -import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; -import lombok.AllArgsConstructor; -import lombok.Setter; -import lombok.experimental.Accessors; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Registry; @@ -38,24 +32,36 @@ import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration; import net.minecraft.world.level.levelgen.structure.templatesystem.AlwaysTrueTest; -import javax.annotation.ParametersAreNonnullByDefault; +import com.mojang.datafixers.util.Either; +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import lombok.AllArgsConstructor; +import lombok.Setter; +import lombok.experimental.Accessors; + import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.stream.Collectors; import java.util.stream.Stream; +import javax.annotation.ParametersAreNonnullByDefault; + @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault @AllArgsConstructor @Accessors(fluent = true, chain = true) public class VeinedVeinGenerator extends VeinGenerator { - public static final Codec, Material>> BLOCK_ENTRY_CODEC = Codec.either(OreConfiguration.TargetBlockState.CODEC.listOf(), GTCEuAPI.materialManager.codec()); + + public static final Codec, Material>> BLOCK_ENTRY_CODEC = Codec + .either(OreConfiguration.TargetBlockState.CODEC.listOf(), GTCEuAPI.materialManager.codec()); public static final Codec CODEC = RecordCodecBuilder.create((instance) -> instance.group( VeinBlockDefinition.CODEC.listOf().fieldOf("ore_blocks").forGetter(it -> it.oreBlocks), VeinBlockDefinition.CODEC.listOf().fieldOf("rare_blocks").forGetter(it -> it.rareBlocks), - BlockState.CODEC.fieldOf("filler_block").orElse(Blocks.AIR.defaultBlockState()).forGetter(it -> it.fillerBlock), + BlockState.CODEC.fieldOf("filler_block").orElse(Blocks.AIR.defaultBlockState()) + .forGetter(it -> it.fillerBlock), Codec.INT.fieldOf("min_y").forGetter(it -> it.minYLevel), Codec.INT.fieldOf("max_y").forGetter(it -> it.maxYLevel), Codec.FLOAT.fieldOf("veininess_threshold").orElse(0.4f).forGetter(it -> it.veininessThreshold), @@ -64,7 +70,7 @@ public class VeinedVeinGenerator extends VeinGenerator { Codec.FLOAT.fieldOf("min_richness").orElse(0.1f).forGetter(it -> it.minRichness), Codec.FLOAT.fieldOf("max_richness").orElse(0.3f).forGetter(it -> it.maxRichness), Codec.FLOAT.fieldOf("max_richness_threshold").orElse(0.6f).forGetter(it -> it.maxRichnessThreshold), - Codec.FLOAT.fieldOf("rare_block_chance").orElse(0.02f).forGetter(it -> it.rareBlockChance)//, + Codec.FLOAT.fieldOf("rare_block_chance").orElse(0.02f).forGetter(it -> it.rareBlockChance)// , ).apply(instance, VeinedVeinGenerator::new)); public List oreBlocks = new ArrayList<>(); @@ -96,30 +102,30 @@ public VeinedVeinGenerator(GTOreDefinition entry) { @Override public List, Integer>> getAllEntries() { - var s1 = this.oreBlocks.stream().flatMap(definition -> - definition.block.map( - state -> state.stream().map(target -> Map.entry(Either.left(target.state), definition.weight)), - material -> Stream.of(Map.entry(Either.right(material), definition.weight)) - ) - ); - var s2 = this.rareBlocks.stream().flatMap(definition -> - definition.block.map( - state -> state.stream().map(target -> Map.entry(Either.left(target.state), definition.weight)), - material -> Stream.of(Map.entry(Either.right(material), definition.weight)) - ) - ); + var s1 = this.oreBlocks.stream().flatMap(definition -> definition.block.map( + state -> state.stream() + .map(target -> Map.entry(Either.left(target.state), definition.weight)), + material -> Stream.of(Map.entry(Either.right(material), definition.weight)))); + var s2 = this.rareBlocks.stream().flatMap(definition -> definition.block.map( + state -> state.stream() + .map(target -> Map.entry(Either.left(target.state), definition.weight)), + material -> Stream.of(Map.entry(Either.right(material), definition.weight)))); return Stream.concat(s1, s2).collect(Collectors.toList()); } @Override - public Map generate(WorldGenLevel level, RandomSource random, GTOreDefinition entry, BlockPos origin) { + public Map generate(WorldGenLevel level, RandomSource random, GTOreDefinition entry, + BlockPos origin) { Map generatedBlocks = new Object2ObjectOpenHashMap<>(); - Registry densityFunctions = GTRegistries.builtinRegistry().registry(Registries.DENSITY_FUNCTION).get(); + Registry densityFunctions = GTRegistries.builtinRegistry() + .registry(Registries.DENSITY_FUNCTION).get(); - List> commonEntries = oreBlocks.stream().map(b -> Map.entry(b.weight, b)).toList(); - List> rareEntries = rareBlocks.stream().map(b -> Map.entry(b.weight, b)).toList(); // never accessed if rareBlocks is null + List> commonEntries = oreBlocks.stream() + .map(b -> Map.entry(b.weight, b)).toList(); + List> rareEntries = rareBlocks.stream() + .map(b -> Map.entry(b.weight, b)).toList(); // never accessed if rareBlocks is null RandomState randomState = level.getLevel().getChunkSource().randomState(); Blender blender; @@ -152,6 +158,7 @@ public Map generate(WorldGenLevel level, RandomSource final int z = chunkedPos.getZ(); DensityFunction.FunctionContext functionContext = new DensityFunction.FunctionContext() { + @Override public int blockX() { return x + randOffsetX; @@ -192,20 +199,23 @@ public Blender getBlender() { if (veinRidged.compute(functionContext) >= 0.0) { continue; } - double chance = Mth.clampedMap(absToggleNoise, veininessThreshold, maxRichnessThreshold, minRichness, maxRichness); + double chance = Mth.clampedMap(absToggleNoise, veininessThreshold, maxRichnessThreshold, minRichness, + maxRichness); BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos(x, y, z); final var randomSeed = random.nextLong(); // Fully deterministic regardless of chunk order - generatedBlocks.put(pos, (access, section) -> - placeBlock(access, section, randomSeed, entry, chance, rareEntries, pos, commonEntries) - ); + generatedBlocks.put(pos, (access, section) -> placeBlock(access, section, randomSeed, entry, chance, + rareEntries, pos, commonEntries)); } return generatedBlocks; } - private void placeBlock(BulkSectionAccess access, LevelChunkSection section, long randomSeed, GTOreDefinition entry, double chance, List> rareEntries, BlockPos.MutableBlockPos pos, List> commonEntries) { + private void placeBlock(BulkSectionAccess access, LevelChunkSection section, long randomSeed, GTOreDefinition entry, + double chance, List> rareEntries, + BlockPos.MutableBlockPos pos, + List> commonEntries) { RandomSource random = new XoroshiroRandomSource(randomSeed); int sectionX = SectionPos.sectionRelative(pos.getX()); int sectionY = SectionPos.sectionRelative(pos.getY()); @@ -215,9 +225,11 @@ private void placeBlock(BulkSectionAccess access, LevelChunkSection section, lon if (random.nextFloat() <= entry.density()) { if (random.nextFloat() < chance) { if (rareBlocks != null && !rareBlocks.isEmpty() && random.nextFloat() < rareBlockChance) { - placeOre(rareBlocks.get(GTUtil.getRandomItem(random, rareEntries, rareEntries.size())).block, current, access, section, random, pos, entry); + placeOre(rareBlocks.get(GTUtil.getRandomItem(random, rareEntries, rareEntries.size())).block, + current, access, section, random, pos, entry); } else { - placeOre(oreBlocks.get(GTUtil.getRandomItem(random, commonEntries, commonEntries.size())).block, current, access, section, random, pos, entry); + placeOre(oreBlocks.get(GTUtil.getRandomItem(random, commonEntries, commonEntries.size())).block, + current, access, section, random, pos, entry); } } else { if (fillerBlock == null || fillerBlock.isAir()) @@ -229,7 +241,9 @@ private void placeBlock(BulkSectionAccess access, LevelChunkSection section, lon } } - protected static void placeOre(Either, Material> block, BlockState current, BulkSectionAccess level, LevelChunkSection section, RandomSource random, BlockPos.MutableBlockPos pos, GTOreDefinition entry) { + protected static void placeOre(Either, Material> block, BlockState current, + BulkSectionAccess level, LevelChunkSection section, RandomSource random, + BlockPos.MutableBlockPos pos, GTOreDefinition entry) { int x = SectionPos.sectionRelative(pos.getX()); int y = SectionPos.sectionRelative(pos.getY()); int z = SectionPos.sectionRelative(pos.getZ()); @@ -263,7 +277,10 @@ public VeinGenerator build() { @Override public VeinGenerator copy() { - return new VeinedVeinGenerator(new ArrayList<>(this.oreBlocks), new ArrayList<>(this.rareBlocks), this.fillerBlock, this.minYLevel, this.maxYLevel, this.veininessThreshold, this.edgeRoundoffBegin, this.maxEdgeRoundoff, this.minRichness, this.maxRichness, this.maxRichnessThreshold, this.rareBlockChance); + return new VeinedVeinGenerator(new ArrayList<>(this.oreBlocks), new ArrayList<>(this.rareBlocks), + this.fillerBlock, this.minYLevel, this.maxYLevel, this.veininessThreshold, this.edgeRoundoffBegin, + this.maxEdgeRoundoff, this.minRichness, this.maxRichness, this.maxRichnessThreshold, + this.rareBlockChance); } @Override @@ -300,10 +317,10 @@ public VeinedVeinGenerator rareBlock(VeinBlockDefinition material) { } public record VeinBlockDefinition(Either, Material> block, int weight) { + public static final Codec CODEC = RecordCodecBuilder.create(instance -> instance.group( BLOCK_ENTRY_CODEC.fieldOf("block").forGetter(x -> x.block), - Codec.INT.fieldOf("weight").forGetter(x -> x.weight) - ).apply(instance, VeinBlockDefinition::new)); + Codec.INT.fieldOf("weight").forGetter(x -> x.weight)).apply(instance, VeinBlockDefinition::new)); public VeinBlockDefinition(Material block, int weight) { this(Either.right(block), weight); @@ -316,6 +333,7 @@ public VeinBlockDefinition(List block, int we private static DensityFunction mapToNoise(DensityFunction function, RandomState randomState) { return function.mapAll(new DensityFunction.Visitor() { + @Override public DensityFunction apply(DensityFunction densityFunction) { return densityFunction; diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/modifier/BiomePlacement.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/modifier/BiomePlacement.java index 2f0d85ad68..db84648121 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/modifier/BiomePlacement.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/modifier/BiomePlacement.java @@ -3,22 +3,26 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.data.worldgen.BiomeWeightModifier; import com.gregtechceu.gtceu.api.registry.GTRegistries; -import com.mojang.serialization.Codec; + import net.minecraft.core.BlockPos; -import net.minecraft.core.Registry; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.util.RandomSource; import net.minecraft.world.level.levelgen.placement.PlacementContext; import net.minecraft.world.level.levelgen.placement.PlacementModifier; import net.minecraft.world.level.levelgen.placement.PlacementModifierType; +import com.mojang.serialization.Codec; + import java.util.List; import java.util.stream.Stream; public class BiomePlacement extends PlacementModifier { - public static final PlacementModifierType BIOME_PLACEMENT = GTRegistries.register(BuiltInRegistries.PLACEMENT_MODIFIER_TYPE, GTCEu.id("biome_placement"), () -> BiomePlacement.CODEC); - public static final Codec CODEC = BiomeWeightModifier.CODEC.listOf().fieldOf("modifiers").xmap(BiomePlacement::new, placement -> placement.modifiers).codec(); + public static final PlacementModifierType BIOME_PLACEMENT = GTRegistries.register( + BuiltInRegistries.PLACEMENT_MODIFIER_TYPE, GTCEu.id("biome_placement"), () -> BiomePlacement.CODEC); + + public static final Codec CODEC = BiomeWeightModifier.CODEC.listOf().fieldOf("modifiers") + .xmap(BiomePlacement::new, placement -> placement.modifiers).codec(); public final List modifiers; diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/modifier/DimensionFilter.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/modifier/DimensionFilter.java index 08505f9251..1d2d326937 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/modifier/DimensionFilter.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/modifier/DimensionFilter.java @@ -2,8 +2,7 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.registry.GTRegistries; -import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; + import net.minecraft.core.BlockPos; import net.minecraft.core.HolderSet; import net.minecraft.core.RegistryCodecs; @@ -15,12 +14,18 @@ import net.minecraft.world.level.levelgen.placement.PlacementFilter; import net.minecraft.world.level.levelgen.placement.PlacementModifierType; +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; + public class DimensionFilter extends PlacementFilter { - public static final PlacementModifierType DIMENSION_FILTER = GTRegistries.register(BuiltInRegistries.PLACEMENT_MODIFIER_TYPE, GTCEu.id("dimension"), () -> DimensionFilter.CODEC); + + public static final PlacementModifierType DIMENSION_FILTER = GTRegistries + .register(BuiltInRegistries.PLACEMENT_MODIFIER_TYPE, GTCEu.id("dimension"), () -> DimensionFilter.CODEC); public static final Codec CODEC = RecordCodecBuilder.create(instance -> instance.group( - RegistryCodecs.homogeneousList(Registries.DIMENSION_TYPE).fieldOf("dimension_id").forGetter(filter -> filter.dimensionId) - ).apply(instance, DimensionFilter::new)); + RegistryCodecs.homogeneousList(Registries.DIMENSION_TYPE).fieldOf("dimension_id") + .forGetter(filter -> filter.dimensionId)) + .apply(instance, DimensionFilter::new)); public HolderSet dimensionId; diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/modifier/FrequencyModifier.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/modifier/FrequencyModifier.java index cbda2da653..b8240ac8a2 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/modifier/FrequencyModifier.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/modifier/FrequencyModifier.java @@ -2,10 +2,9 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.registry.GTRegistries; -import com.mojang.serialization.Codec; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; -import net.minecraft.core.Registry; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.util.ExtraCodecs; import net.minecraft.util.Mth; @@ -14,9 +13,12 @@ import net.minecraft.world.level.levelgen.placement.PlacementModifier; import net.minecraft.world.level.levelgen.placement.PlacementModifierType; -import javax.annotation.ParametersAreNonnullByDefault; +import com.mojang.serialization.Codec; + import java.util.stream.Stream; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author KilaBash * @date 2023/3/20 @@ -25,9 +27,12 @@ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class FrequencyModifier extends PlacementModifier { - public static final PlacementModifierType FREQUENCY_MODIFIER = GTRegistries.register(BuiltInRegistries.PLACEMENT_MODIFIER_TYPE, GTCEu.id("frequency"), () -> FrequencyModifier.CODEC); - public static final Codec CODEC = ExtraCodecs.POSITIVE_FLOAT.fieldOf("chance").xmap(FrequencyModifier::new, (modifier) -> modifier.frequency).codec(); + public static final PlacementModifierType FREQUENCY_MODIFIER = GTRegistries + .register(BuiltInRegistries.PLACEMENT_MODIFIER_TYPE, GTCEu.id("frequency"), () -> FrequencyModifier.CODEC); + + public static final Codec CODEC = ExtraCodecs.POSITIVE_FLOAT.fieldOf("chance") + .xmap(FrequencyModifier::new, (modifier) -> modifier.frequency).codec(); private final float frequency; @@ -53,5 +58,4 @@ public int getCount(float frequency, RandomSource random) { public PlacementModifierType type() { return FREQUENCY_MODIFIER; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/ores/GeneratedIndicators.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/ores/GeneratedIndicators.java index 12e9bce79e..9d7ca4f5d7 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/ores/GeneratedIndicators.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/ores/GeneratedIndicators.java @@ -1,14 +1,15 @@ package com.gregtechceu.gtceu.api.data.worldgen.ores; -import lombok.Getter; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.world.level.ChunkPos; -import javax.annotation.ParametersAreNonnullByDefault; +import lombok.Getter; + import java.util.List; import java.util.Map; import java.util.stream.Collectors; +import javax.annotation.ParametersAreNonnullByDefault; /** * Holds a vein's {@link OreBlockPlacer}s for each of its blocks, grouped by chunk. @@ -16,6 +17,7 @@ @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault public class GeneratedIndicators { + @Getter private final ChunkPos origin; @@ -41,6 +43,7 @@ public List consumeIndicators(ChunkPos chunk) { @Override public String toString() { - return "GeneratedIndicators[origin=" + origin + ", chunks={" + generatedIndicators.keySet().stream().map(ChunkPos::toString).collect(Collectors.joining(", ")) + "}]"; + return "GeneratedIndicators[origin=" + origin + ", chunks={" + + generatedIndicators.keySet().stream().map(ChunkPos::toString).collect(Collectors.joining(", ")) + "}]"; } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/ores/GeneratedVein.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/ores/GeneratedVein.java index 2d30b3f762..6643a9cc97 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/ores/GeneratedVein.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/ores/GeneratedVein.java @@ -2,15 +2,17 @@ import com.gregtechceu.gtceu.api.data.worldgen.IWorldGenLayer; import com.gregtechceu.gtceu.api.data.worldgen.WorldGeneratorUtils; -import lombok.Getter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.world.level.ChunkPos; -import javax.annotation.ParametersAreNonnullByDefault; +import lombok.Getter; + import java.util.Map; import java.util.stream.Collectors; +import javax.annotation.ParametersAreNonnullByDefault; /** * Holds a vein's {@link OreBlockPlacer}s for each of its blocks, grouped by chunk. @@ -18,6 +20,7 @@ @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault public class GeneratedVein { + @Getter private final ChunkPos origin; @@ -27,9 +30,9 @@ public class GeneratedVein { private final Map> generatedOres; /** - * @param origin The vein's origin chunk (NOT its actual center, which may be outside the origin chunk) - * @param oresByPosition The ore placers for each ore block position.
- * Doesn't need to be ordered, grouping by chunks is done internally. + * @param origin The vein's origin chunk (NOT its actual center, which may be outside the origin chunk) + * @param oresByPosition The ore placers for each ore block position.
+ * Doesn't need to be ordered, grouping by chunks is done internally. */ public GeneratedVein(ChunkPos origin, IWorldGenLayer layer, Map oresByPosition) { this.origin = origin; @@ -47,6 +50,7 @@ public Map consumeOres(ChunkPos chunk) { @Override public String toString() { - return "GeneratedVein[origin=" + origin + ", chunks={" + generatedOres.keySet().stream().map(ChunkPos::toString).collect(Collectors.joining(", ")) + "}]"; + return "GeneratedVein[origin=" + origin + ", chunks={" + + generatedOres.keySet().stream().map(ChunkPos::toString).collect(Collectors.joining(", ")) + "}]"; } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/ores/GeneratedVeinMetadata.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/ores/GeneratedVeinMetadata.java index 182444d13c..059cd39442 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/ores/GeneratedVeinMetadata.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/ores/GeneratedVeinMetadata.java @@ -1,16 +1,15 @@ package com.gregtechceu.gtceu.api.data.worldgen.ores; import com.gregtechceu.gtceu.api.data.worldgen.GTOreDefinition; + import net.minecraft.core.BlockPos; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.ChunkPos; -import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.NotNull; public record GeneratedVeinMetadata( - @NotNull ResourceLocation id, - @NotNull ChunkPos originChunk, - @NotNull BlockPos center, - @NotNull GTOreDefinition definition -) { -} + @NotNull ResourceLocation id, + @NotNull ChunkPos originChunk, + @NotNull BlockPos center, + @NotNull GTOreDefinition definition) {} diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/ores/OreBlockPlacer.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/ores/OreBlockPlacer.java index 5c55eae3a5..519914d157 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/ores/OreBlockPlacer.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/ores/OreBlockPlacer.java @@ -6,17 +6,18 @@ import javax.annotation.ParametersAreNonnullByDefault; - /** * Responsible for actually placing a vein's block. * - *

This is invoked for every block a vein needs to place, when the relevant chunk is being generated.
+ *

+ * This is invoked for every block a vein needs to place, when the relevant chunk is being generated.
* The positions are computed in advance. */ @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault @FunctionalInterface public interface OreBlockPlacer { + /** * Place a single block at the (precomputed) location this placer is mapped to. */ diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/ores/OreGenCache.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/ores/OreGenCache.java index 4291277878..bb15cfbbe1 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/ores/OreGenCache.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/ores/OreGenCache.java @@ -1,31 +1,35 @@ package com.gregtechceu.gtceu.api.data.worldgen.ores; -import com.google.common.cache.Cache; -import com.google.common.cache.CacheBuilder; import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.config.ConfigHolder; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.WorldGenLevel; import net.minecraft.world.level.chunk.ChunkAccess; import net.minecraft.world.level.chunk.ChunkGenerator; + +import com.google.common.cache.Cache; +import com.google.common.cache.CacheBuilder; import org.apache.commons.lang3.mutable.MutableInt; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.List; import java.util.Objects; import java.util.concurrent.ExecutionException; import java.util.stream.Stream; +import javax.annotation.ParametersAreNonnullByDefault; /** * Used for caching ore veins between generated chunks. * - *

Uses the {@link OreGenerator} to generate new veins in case no vein is cached for a queried chunk. + *

+ * Uses the {@link OreGenerator} to generate new veins in case no vein is cached for a queried chunk. */ @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault public class OreGenCache { + private final OreGenerator oreGenerator = new OreGenerator(); private final int oreGenerationCacheSize = ConfigHolder.INSTANCE != null ? @@ -36,7 +40,6 @@ public class OreGenCache { private final int veinMetadataCacheSize = Math.max(oreGenerationCacheSize, oreIndicatorCacheSize); - private final Cache> veinMetadataByOrigin = CacheBuilder.newBuilder() .maximumSize(veinMetadataCacheSize) .softValues() @@ -52,8 +55,8 @@ public class OreGenCache { .softValues() .build(); - - private List getOrCreateVeinMetadata(WorldGenLevel level, ChunkGenerator generator, ChunkPos chunkPos) { + private List getOrCreateVeinMetadata(WorldGenLevel level, ChunkGenerator generator, + ChunkPos chunkPos) { try { return veinMetadataByOrigin .get(chunkPos, () -> oreGenerator.generateMetadata(level, generator, chunkPos)); @@ -66,13 +69,16 @@ private List getOrCreateVeinMetadata(WorldGenLevel level, /** * Get (or create) all veins to be generated, surrounding the supplied chunk. * - *

The search radius depends on the largest registered vein size, as well as the relevant config options. + *

+ * The search radius depends on the largest registered vein size, as well as the relevant config options. */ public List consumeChunkVeins(WorldGenLevel level, ChunkGenerator generator, ChunkAccess chunk) { return getSurroundingChunks(chunk.getPos(), OreVeinUtil.getMaxVeinSearchDistance()).flatMap(chunkPos -> { try { return generatedVeinsByOrigin - .get(chunkPos, () -> oreGenerator.generateOres(level, getOrCreateVeinMetadata(level, generator, chunkPos), chunkPos)) + .get(chunkPos, + () -> oreGenerator.generateOres(level, + getOrCreateVeinMetadata(level, generator, chunkPos), chunkPos)) .stream(); } catch (ExecutionException e) { GTCEu.LOGGER.error("Cannot create vein in chunk " + chunkPos, e); @@ -84,13 +90,17 @@ public List consumeChunkVeins(WorldGenLevel level, ChunkGenerator /** * Get (or create) all indicators to be generated, surrounding the supplied chunk. * - *

The search radius depends on the largest registered indicator size, as well as the relevant config options. + *

+ * The search radius depends on the largest registered indicator size, as well as the relevant config options. */ - public List consumeChunkIndicators(WorldGenLevel level, ChunkGenerator generator, ChunkAccess chunk) { + public List consumeChunkIndicators(WorldGenLevel level, ChunkGenerator generator, + ChunkAccess chunk) { return getSurroundingChunks(chunk.getPos(), OreVeinUtil.getMaxIndicatorSearchDistance()).flatMap(chunkPos -> { try { return indicatorsByOrigin - .get(chunkPos, () -> oreGenerator.generateIndicators(level, getOrCreateVeinMetadata(level, generator, chunkPos), chunkPos)) + .get(chunkPos, + () -> oreGenerator.generateIndicators(level, + getOrCreateVeinMetadata(level, generator, chunkPos), chunkPos)) .stream(); } catch (ExecutionException e) { GTCEu.LOGGER.error("Cannot create vein in chunk " + chunkPos, e); diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/ores/OreGenerator.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/ores/OreGenerator.java index 05984f17a7..1c7e9cd7fa 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/ores/OreGenerator.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/ores/OreGenerator.java @@ -4,10 +4,10 @@ import com.gregtechceu.gtceu.api.data.worldgen.GTOreDefinition; import com.gregtechceu.gtceu.api.data.worldgen.IWorldGenLayer; import com.gregtechceu.gtceu.api.data.worldgen.WorldGeneratorUtils; -import com.gregtechceu.gtceu.api.data.worldgen.bedrockore.BedrockOreVeinSavedData; import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.utils.GTUtil; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Holder; @@ -18,10 +18,10 @@ import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.levelgen.XoroshiroRandomSource; import net.minecraft.world.level.levelgen.placement.PlacementContext; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.List; import java.util.Map; import java.util.Objects; @@ -29,6 +29,7 @@ import java.util.stream.Collectors; import java.util.stream.Stream; +import javax.annotation.ParametersAreNonnullByDefault; /** * Responsible for (pre)generating ore veins.
@@ -37,22 +38,27 @@ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class OreGenerator { + private record VeinConfiguration(GeneratedVeinMetadata data, RandomSource random) { + public RandomSource newRandom() { return new XoroshiroRandomSource(random.nextLong()); } } - public List generateMetadata(WorldGenLevel level, ChunkGenerator chunkGenerator, ChunkPos chunkPos) { + public List generateMetadata(WorldGenLevel level, ChunkGenerator chunkGenerator, + ChunkPos chunkPos) { return createConfigs(level, chunkGenerator, chunkPos).stream() .map(OreGenerator::logVeinGeneration) .map(entry -> entry.data) .toList(); } - public List generateIndicators(WorldGenLevel level, List metadata, ChunkPos chunkPos) { + public List generateIndicators(WorldGenLevel level, List metadata, + ChunkPos chunkPos) { return metadata.stream() - .map(data -> new VeinConfiguration(data, new XoroshiroRandomSource(level.getSeed() ^ chunkPos.toLong()))) + .map(data -> new VeinConfiguration(data, + new XoroshiroRandomSource(level.getSeed() ^ chunkPos.toLong()))) .map(config -> generateIndicators(config, level, chunkPos)) .toList(); } @@ -64,8 +70,7 @@ private GeneratedIndicators generateIndicators(VeinConfiguration config, WorldGe .flatMap(gen -> gen.generate(level, config.newRandom(), config.data).entrySet().stream()) .collect(Collectors.toMap( Map.Entry::getKey, entry -> List.of(entry.getValue()), - (a, b) -> Stream.of(a, b).flatMap(List::stream).toList() - )); + (a, b) -> Stream.of(a, b).flatMap(List::stream).toList())); return new GeneratedIndicators(chunkPos, generatedIndicators); } @@ -74,18 +79,19 @@ private GeneratedIndicators generateIndicators(VeinConfiguration config, WorldGe * Generates the vein for the specified chunk metadata.
* If the chunk is not located on one of the ore vein grid's intersections, no vein will be generated. * - *

Note that depending on the configured random offset, the actual center of the generated vein may be located + *

+ * Note that depending on the configured random offset, the actual center of the generated vein may be located * outside the specified origin chunk. * * @return The generated vein for the specified chunk metadata.
- * {@code Optional.empty()} if no vein exists at this chunk. + * {@code Optional.empty()} if no vein exists at this chunk. */ - public List generateOres(WorldGenLevel level, List metadata, ChunkPos chunkPos) { + public List generateOres(WorldGenLevel level, List metadata, + ChunkPos chunkPos) { return metadata.stream() .map(data -> new VeinConfiguration( data, - new XoroshiroRandomSource(level.getSeed() ^ chunkPos.toLong()) - )) + new XoroshiroRandomSource(level.getSeed() ^ chunkPos.toLong()))) .flatMap(config -> generateOres(config, level, chunkPos).stream()) .toList(); } @@ -102,21 +108,21 @@ private Optional generateOres(VeinConfiguration config, WorldGenL return Optional.of(new GeneratedVein(chunkPos, definition.layer(), generatedVeins)); } + private List createConfigs(WorldGenLevel level, ChunkGenerator generator, ChunkPos chunkPos) { var random = new XoroshiroRandomSource(level.getSeed() ^ chunkPos.toLong()); - return OreVeinUtil.getVeinCenter(chunkPos, random).stream().flatMap(veinCenter -> - getEntries(level, veinCenter, random).map(entry -> { + return OreVeinUtil.getVeinCenter(chunkPos, random).stream() + .flatMap(veinCenter -> getEntries(level, veinCenter, random).map(entry -> { var id = GTRegistries.ORE_VEINS.getKey(entry); if (entry == null) return null; - BlockPos origin = computeVeinOrigin(level, generator, random, veinCenter, entry).orElseThrow(() -> - new IllegalStateException("Cannot determine y coordinate for the vein at " + veinCenter) - ); + BlockPos origin = computeVeinOrigin(level, generator, random, veinCenter, entry) + .orElseThrow(() -> new IllegalStateException( + "Cannot determine y coordinate for the vein at " + veinCenter)); return new VeinConfiguration(new GeneratedVeinMetadata(id, chunkPos, origin, entry), random); - }) - ).toList(); + })).toList(); } private Stream getEntries(WorldGenLevel level, BlockPos veinCenter, XoroshiroRandomSource random) { @@ -127,7 +133,8 @@ private Stream getEntries(WorldGenLevel level, BlockPos veinCen } @Nullable - private GTOreDefinition getEntry(WorldGenLevel level, Holder biome, RandomSource random, IWorldGenLayer layer) { + private GTOreDefinition getEntry(WorldGenLevel level, Holder biome, RandomSource random, + IWorldGenLayer layer) { var veins = WorldGeneratorUtils.getCachedBiomeVeins(level.getLevel(), biome, random).stream() .filter(vein -> vein.getValue().layer().equals(layer)) .toList(); @@ -137,8 +144,8 @@ private GTOreDefinition getEntry(WorldGenLevel level, Holder biome, Rando @NotNull private static Optional computeVeinOrigin(WorldGenLevel level, ChunkGenerator generator, - RandomSource random, BlockPos veinCenter, GTOreDefinition entry - ) { + RandomSource random, BlockPos veinCenter, + GTOreDefinition entry) { int layerSeed = WorldGeneratorUtils.getWorldGenLayerKey(entry.layer()) .map(String::hashCode) .orElse(0); @@ -146,13 +153,11 @@ private static Optional computeVeinOrigin(WorldGenLevel level, ChunkGe return entry.range().getPositions( new PlacementContext(level, generator, Optional.empty()), - layeredRandom, veinCenter - ).findFirst(); + layeredRandom, veinCenter).findFirst(); } - ///////////////////////////////////// - //********* LOGGING *********// + // ********* LOGGING *********// ///////////////////////////////////// private static VeinConfiguration logVeinGeneration(VeinConfiguration config) { diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/ores/OreIndicatorPlacer.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/ores/OreIndicatorPlacer.java index b44e232ca2..7f663430aa 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/ores/OreIndicatorPlacer.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/ores/OreIndicatorPlacer.java @@ -5,10 +5,10 @@ import javax.annotation.ParametersAreNonnullByDefault; - @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault @FunctionalInterface public interface OreIndicatorPlacer { + void placeIndicators(BulkSectionAccess access); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/ores/OrePlacer.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/ores/OrePlacer.java index e1462c18ba..9a769b1cac 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/ores/OrePlacer.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/ores/OrePlacer.java @@ -12,25 +12,29 @@ import net.minecraft.world.level.levelgen.XoroshiroRandomSource; import net.minecraft.world.level.levelgen.structure.templatesystem.RuleTest; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.Map; import java.util.stream.Collectors; +import javax.annotation.ParametersAreNonnullByDefault; /** * Responsible for placing ores of surrounding veins for the current chunk. * - *

Surrounding veins are resolved from the {@link OreGenCache} and placed using each block position's {@link OreBlockPlacer}. + *

+ * Surrounding veins are resolved from the {@link OreGenCache} and placed using each block position's + * {@link OreBlockPlacer}. */ @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault public class OrePlacer { + private final OreGenCache oreGenCache = new OreGenCache(); /** * Place the contents of all surrounding ore veins in the current chunk. * - *

Consumes the current chunk for all of the relevant veins, allowing the cache to unload the vein, + *

+ * Consumes the current chunk for all of the relevant veins, allowing the cache to unload the vein, * once all of its chunks have been generated. */ public void placeOres(WorldGenLevel level, ChunkGenerator chunkGenerator, ChunkAccess chunk) { @@ -44,7 +48,8 @@ public void placeOres(WorldGenLevel level, ChunkGenerator chunkGenerator, ChunkA } } - private void placeVein(ChunkAccess chunk, RandomSource random, BulkSectionAccess access, GeneratedVein generatedVein) { + private void placeVein(ChunkAccess chunk, RandomSource random, BulkSectionAccess access, + GeneratedVein generatedVein) { RuleTest layerTarget = generatedVein.getLayer().getTarget(); resolvePlacerLists(chunk, generatedVein).forEach(((sectionPos, placers) -> { @@ -57,8 +62,7 @@ private void placeVein(ChunkAccess chunk, RandomSource random, BulkSectionAccess var blockState = section.getBlockState( SectionPos.sectionRelative(pos.getX()), SectionPos.sectionRelative(pos.getY()), - SectionPos.sectionRelative(pos.getZ()) - ); + SectionPos.sectionRelative(pos.getZ())); if (layerTarget.test(blockState, random)) placer.placeBlock(access, section); @@ -70,8 +74,7 @@ private Map> resolvePlacerLists(ChunkA return vein.consumeOres(chunk.getPos()).entrySet().stream() .collect(Collectors.groupingBy( entry -> SectionPos.of(entry.getKey()), - Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue) - )); + Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue))); } private void placeIndicators(ChunkAccess chunk, BulkSectionAccess access, GeneratedIndicators generatedVein) { diff --git a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/ores/OreVeinUtil.java b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/ores/OreVeinUtil.java index 1990263f57..db2e3d492b 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/ores/OreVeinUtil.java +++ b/src/main/java/com/gregtechceu/gtceu/api/data/worldgen/ores/OreVeinUtil.java @@ -1,15 +1,11 @@ package com.gregtechceu.gtceu.api.data.worldgen.ores; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonPrimitive; import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.data.worldgen.GTOreDefinition; import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.common.data.GTOres; import com.gregtechceu.gtceu.config.ConfigHolder; -import com.mojang.datafixers.util.Pair; -import com.mojang.serialization.JsonOps; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.HolderSet; @@ -22,24 +18,29 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.levelgen.feature.Feature; import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration; + +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonPrimitive; +import com.mojang.serialization.JsonOps; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.List; import java.util.Optional; import java.util.function.Function; import java.util.function.Supplier; +import javax.annotation.ParametersAreNonnullByDefault; @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault public class OreVeinUtil { - private OreVeinUtil() { - } + private OreVeinUtil() {} public static boolean canPlaceOre(BlockState pState, Function pAdjacentStateAccessor, - RandomSource pRandom, GTOreDefinition entry, OreConfiguration.TargetBlockState pTargetState, + RandomSource pRandom, GTOreDefinition entry, + OreConfiguration.TargetBlockState pTargetState, BlockPos pMatablePos) { if (!pTargetState.target.test(pState, pRandom)) return false; @@ -67,7 +68,8 @@ protected static boolean shouldSkipAirCheck(RandomSource pRandom, float pChance) /** * Resolves a vein's center for the supplied chunk position. * - *

Note that depending on the config value for the random vein offset, its actual + *

+ * Note that depending on the config value for the random vein offset, its actual * center may be outside the supplied chunk. * * @return The origin of the vein to be generated.
@@ -88,8 +90,7 @@ public static Optional getVeinCenter(ChunkPos chunkPos, RandomSource r return Optional.of(chunkCenter.offset( random.nextInt(-randomOffset, +randomOffset), 0, - random.nextInt(-randomOffset, +randomOffset) - )); + random.nextInt(-randomOffset, +randomOffset))); } /** @@ -128,7 +129,8 @@ private static JsonElement resolveBiomeCodecInput(List biomes) { return new JsonPrimitive(biomes.get(0)); if (biomes.stream().anyMatch(filter -> filter.startsWith("#"))) - throw new IllegalStateException("Cannot resolve biomes: You may use either a single tag or multiple individual biomes."); + throw new IllegalStateException( + "Cannot resolve biomes: You may use either a single tag or multiple individual biomes."); var jsonArray = new JsonArray(); biomes.forEach(jsonArray::add); diff --git a/src/main/java/com/gregtechceu/gtceu/api/fluids/FluidBuilder.java b/src/main/java/com/gregtechceu/gtceu/api/fluids/FluidBuilder.java index 01c5a7451b..ed94e9d61e 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/fluids/FluidBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/api/fluids/FluidBuilder.java @@ -1,10 +1,8 @@ package com.gregtechceu.gtceu.api.fluids; -import com.google.common.base.Preconditions; import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.api.data.chemical.material.info.MaterialFlags; import com.gregtechceu.gtceu.api.data.chemical.material.properties.BlastProperty; -import com.gregtechceu.gtceu.api.data.chemical.material.properties.FluidProperty; import com.gregtechceu.gtceu.api.data.chemical.material.properties.PropertyKey; import com.gregtechceu.gtceu.api.fluids.attribute.FluidAttribute; import com.gregtechceu.gtceu.api.fluids.store.FluidStorageKey; @@ -12,18 +10,21 @@ import com.gregtechceu.gtceu.api.registry.registrate.GTRegistrate; import com.gregtechceu.gtceu.api.registry.registrate.IGTFluidBuilder; import com.gregtechceu.gtceu.utils.GTUtil; + import com.lowdragmc.lowdraglib.Platform; + +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.material.Fluid; + +import com.google.common.base.Preconditions; import lombok.Getter; import lombok.Setter; import lombok.experimental.Accessors; import lombok.experimental.Tolerate; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.level.material.Fluid; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -59,9 +60,11 @@ public class FluidBuilder { @Setter private int burnTime = -1; - @Getter @Setter(onMethod_ = @ApiStatus.Internal) + @Getter + @Setter(onMethod_ = @ApiStatus.Internal) private ResourceLocation still = null; - @Getter @Setter(onMethod_ = @ApiStatus.Internal) + @Getter + @Setter(onMethod_ = @ApiStatus.Internal) private ResourceLocation flowing = null; private boolean hasCustomStill = false; private boolean hasCustomFlowing = false; @@ -117,6 +120,7 @@ public FluidBuilder() {} /** * Converts a density value in g/cm^3 to an MC fluid density by comparison to air's density. + * * @param density the density to convert * @return the MC integer density */ @@ -160,6 +164,7 @@ private static int convertToMCDensity(double density) { /** * Converts viscosity in Poise to MC viscosity + * * @param viscosity the viscosity to convert * @return the converted value */ @@ -180,13 +185,14 @@ private static int convertViscosity(double viscosity) { * @param attributes the attributes to add * @return this */ - public @NotNull FluidBuilder attributes(@NotNull FluidAttribute @NotNull ... attributes) { + public @NotNull FluidBuilder attributes(@NotNull FluidAttribute @NotNull... attributes) { Collections.addAll(this.attributes, attributes); return this; } /** * Mark this fluid as having a custom still texture + * * @return this */ public @NotNull FluidBuilder customStill() { @@ -204,7 +210,7 @@ private static int convertViscosity(double viscosity) { } /** - * @param hasCustomStill if the fluid has a custom still texture + * @param hasCustomStill if the fluid has a custom still texture * @param hasCustomFlowing if the fluid has a custom flowing texture * @return this */ @@ -235,7 +241,8 @@ private static int convertViscosity(double viscosity) { return this; } - public @NotNull Supplier build(@NotNull String modid, Material material, FluidStorageKey key, GTRegistrate registrate) { + public @NotNull Supplier build(@NotNull String modid, Material material, FluidStorageKey key, + GTRegistrate registrate) { determineName(material, key); determineTextures(material, key, modid); @@ -256,7 +263,9 @@ private static int convertViscosity(double viscosity) { determineDensity(); determineLuminosity(material); determineViscosity(material); - IGTFluidBuilder builder = registrate.createFluid(name, this.translation != null ? this.translation : key.getTranslationKeyFor(material), material, this.still, this.flowing) + IGTFluidBuilder builder = registrate + .createFluid(name, this.translation != null ? this.translation : key.getTranslationKeyFor(material), + material, this.still, this.flowing) .temperature(this.temperature) .density(this.density) .luminance(this.luminosity) @@ -319,7 +328,8 @@ private void determineTemperature(@Nullable Material material) { } case GAS -> ROOM_TEMPERATURE; case PLASMA -> { - if (material.hasFluid() && material.getFluidBuilder() != null && material.getFluidBuilder() != material.getFluidBuilder(FluidStorageKeys.PLASMA)) { + if (material.hasFluid() && material.getFluidBuilder() != null && + material.getFluidBuilder() != material.getFluidBuilder(FluidStorageKeys.PLASMA)) { yield BASE_PLASMA_TEMPERATURE + material.getFluidBuilder().temperature; } yield BASE_PLASMA_TEMPERATURE; diff --git a/src/main/java/com/gregtechceu/gtceu/api/fluids/FluidConstants.java b/src/main/java/com/gregtechceu/gtceu/api/fluids/FluidConstants.java index 7e212812f4..ece429185d 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/fluids/FluidConstants.java +++ b/src/main/java/com/gregtechceu/gtceu/api/fluids/FluidConstants.java @@ -47,4 +47,4 @@ public final class FluidConstants { public static final int CRYOGENIC_FLUID_THRESHOLD = 120; private FluidConstants() {} -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/fluids/FluidState.java b/src/main/java/com/gregtechceu/gtceu/api/fluids/FluidState.java index 8b5034b3b9..cde8d46441 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/fluids/FluidState.java +++ b/src/main/java/com/gregtechceu/gtceu/api/fluids/FluidState.java @@ -4,6 +4,7 @@ import org.jetbrains.annotations.NotNull; public enum FluidState { + LIQUID("gtceu.fluid.state_liquid"), GAS("gtceu.fluid.state_gas"), PLASMA("gtceu.fluid.state_plasma"), diff --git a/src/main/java/com/gregtechceu/gtceu/api/fluids/GTFluid.java b/src/main/java/com/gregtechceu/gtceu/api/fluids/GTFluid.java index b489f14dd5..05fbacab74 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/fluids/GTFluid.java +++ b/src/main/java/com/gregtechceu/gtceu/api/fluids/GTFluid.java @@ -1,10 +1,8 @@ package com.gregtechceu.gtceu.api.fluids; - import com.gregtechceu.gtceu.api.fluids.attribute.FluidAttribute; import com.gregtechceu.gtceu.api.fluids.attribute.IAttributedFluid; -import it.unimi.dsi.fastutil.objects.ObjectLinkedOpenHashSet; -import lombok.Getter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -22,12 +20,16 @@ import net.minecraft.world.level.material.FlowingFluid; import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.Fluids; + +import it.unimi.dsi.fastutil.objects.ObjectLinkedOpenHashSet; +import lombok.Getter; import org.jetbrains.annotations.NotNull; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.Collection; import java.util.function.Supplier; +import javax.annotation.ParametersAreNonnullByDefault; + @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault public abstract class GTFluid extends FlowingFluid implements IAttributedFluid { @@ -43,7 +45,9 @@ public abstract class GTFluid extends FlowingFluid implements IAttributedFluid { @Getter private final int burnTime; - public GTFluid(@NotNull FluidState state, Supplier stillFluid, Supplier flowingFluid, Supplier block, Supplier bucket, int burnTime) { + public GTFluid(@NotNull FluidState state, Supplier stillFluid, + Supplier flowingFluid, Supplier block, + Supplier bucket, int burnTime) { super(); this.state = state; this.stillFluid = stillFluid; @@ -59,7 +63,8 @@ public void addAttribute(@NotNull FluidAttribute attribute) { } @Override - protected boolean canBeReplacedWith(net.minecraft.world.level.material.FluidState state, BlockGetter level, BlockPos pos, Fluid fluid, Direction direction) { + protected boolean canBeReplacedWith(net.minecraft.world.level.material.FluidState state, BlockGetter level, + BlockPos pos, Fluid fluid, Direction direction) { return direction == Direction.DOWN && !isSame(fluid); } @@ -123,4 +128,3 @@ public boolean isSame(Fluid fluid) { return still || flowing; } } - diff --git a/src/main/java/com/gregtechceu/gtceu/api/fluids/PropertyFluidFilter.java b/src/main/java/com/gregtechceu/gtceu/api/fluids/PropertyFluidFilter.java index 284fd0c8f9..5373cba8c1 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/fluids/PropertyFluidFilter.java +++ b/src/main/java/com/gregtechceu/gtceu/api/fluids/PropertyFluidFilter.java @@ -3,6 +3,7 @@ import com.gregtechceu.gtceu.api.capability.IPropertyFluidFilter; import com.gregtechceu.gtceu.api.fluids.attribute.FluidAttribute; import com.gregtechceu.gtceu.api.fluids.attribute.FluidAttributes; + import it.unimi.dsi.fastutil.objects.Object2BooleanMap; import it.unimi.dsi.fastutil.objects.Object2BooleanOpenHashMap; import lombok.Getter; diff --git a/src/main/java/com/gregtechceu/gtceu/api/fluids/attribute/FluidAttribute.java b/src/main/java/com/gregtechceu/gtceu/api/fluids/attribute/FluidAttribute.java index 334a197628..3cc9ad1f8f 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/fluids/attribute/FluidAttribute.java +++ b/src/main/java/com/gregtechceu/gtceu/api/fluids/attribute/FluidAttribute.java @@ -2,6 +2,7 @@ import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; + import org.jetbrains.annotations.NotNull; import java.util.List; @@ -14,7 +15,8 @@ public final class FluidAttribute { private final Consumer> containerTooltip; private final int hashCode; - public FluidAttribute(@NotNull ResourceLocation resourceLocation, @NotNull Consumer> fluidTooltip, + public FluidAttribute(@NotNull ResourceLocation resourceLocation, + @NotNull Consumer> fluidTooltip, @NotNull Consumer> containerTooltip) { this.resourceLocation = resourceLocation; this.fluidTooltip = fluidTooltip; diff --git a/src/main/java/com/gregtechceu/gtceu/api/fluids/attribute/FluidAttributes.java b/src/main/java/com/gregtechceu/gtceu/api/fluids/attribute/FluidAttributes.java index 8c66fdcfbf..7fa618fabc 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/fluids/attribute/FluidAttributes.java +++ b/src/main/java/com/gregtechceu/gtceu/api/fluids/attribute/FluidAttributes.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.api.fluids.attribute; import com.gregtechceu.gtceu.GTCEu; + import net.minecraft.network.chat.Component; public final class FluidAttributes { @@ -10,8 +11,7 @@ public final class FluidAttributes { */ public static final FluidAttribute ACID = new FluidAttribute(GTCEu.id("acid"), list -> list.add(Component.translatable("gtceu.fluid.type_acid.tooltip")), - list -> list.add(Component.translatable("gtceu.fluid_pipe.acid_proof")) - ); + list -> list.add(Component.translatable("gtceu.fluid_pipe.acid_proof"))); private FluidAttributes() {} } diff --git a/src/main/java/com/gregtechceu/gtceu/api/fluids/attribute/IAttributedFluid.java b/src/main/java/com/gregtechceu/gtceu/api/fluids/attribute/IAttributedFluid.java index 79609d27f4..1b40ebdc6f 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/fluids/attribute/IAttributedFluid.java +++ b/src/main/java/com/gregtechceu/gtceu/api/fluids/attribute/IAttributedFluid.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.api.fluids.attribute; import com.gregtechceu.gtceu.api.fluids.FluidState; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Unmodifiable; @@ -12,12 +13,14 @@ public interface IAttributedFluid { * @return the attributes on the fluid */ @NotNull - @Unmodifiable Collection getAttributes(); + @Unmodifiable + Collection getAttributes(); /** * @param attribute the attribute to add */ void addAttribute(@NotNull FluidAttribute attribute); - @NotNull FluidState getState(); + @NotNull + FluidState getState(); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/fluids/forge/GTFluidImpl.java b/src/main/java/com/gregtechceu/gtceu/api/fluids/forge/GTFluidImpl.java index 99a4385468..2f3a240472 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/fluids/forge/GTFluidImpl.java +++ b/src/main/java/com/gregtechceu/gtceu/api/fluids/forge/GTFluidImpl.java @@ -2,6 +2,7 @@ import com.gregtechceu.gtceu.api.fluids.FluidState; import com.gregtechceu.gtceu.api.fluids.GTFluid; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.LiquidBlock; @@ -9,17 +10,22 @@ import net.minecraft.world.level.material.Fluid; import net.minecraftforge.common.extensions.IForgeFluid; import net.minecraftforge.fluids.FluidType; + import org.jetbrains.annotations.NotNull; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.function.Supplier; +import javax.annotation.ParametersAreNonnullByDefault; + @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault public abstract class GTFluidImpl extends GTFluid implements IForgeFluid { + private final Supplier fluidType; - public GTFluidImpl(@NotNull FluidState state, Supplier stillFluid, Supplier flowingFluid, Supplier block, Supplier bucket, int burnTime, Supplier fluidType) { + public GTFluidImpl(@NotNull FluidState state, Supplier stillFluid, + Supplier flowingFluid, Supplier block, + Supplier bucket, int burnTime, Supplier fluidType) { super(state, stillFluid, flowingFluid, block, bucket, burnTime); this.fluidType = fluidType; } @@ -31,7 +37,9 @@ public FluidType getFluidType() { public static class Source extends GTFluidImpl { - public Source(@NotNull FluidState state, Supplier stillFluid, Supplier flowingFluid, Supplier block, Supplier bucket, int burnTime, Supplier fluidType) { + public Source(@NotNull FluidState state, Supplier stillFluid, + Supplier flowingFluid, Supplier block, + Supplier bucket, int burnTime, Supplier fluidType) { super(state, stillFluid, flowingFluid, block, bucket, burnTime, fluidType); } @@ -48,9 +56,11 @@ public boolean isSource(net.minecraft.world.level.material.FluidState state) { public static class Flowing extends GTFluidImpl { - public Flowing(@NotNull FluidState state, Supplier stillFluid, Supplier flowingFluid, Supplier block, Supplier bucket, int burnTime, Supplier fluidType) { + public Flowing(@NotNull FluidState state, Supplier stillFluid, + Supplier flowingFluid, Supplier block, + Supplier bucket, int burnTime, Supplier fluidType) { super(state, stillFluid, flowingFluid, block, bucket, burnTime, fluidType); - //registerDefaultState(getStateDefinition().any().setValue(LEVEL, 7)); + // registerDefaultState(getStateDefinition().any().setValue(LEVEL, 7)); } protected void createFluidStateDefinition(StateDefinition.@NotNull Builder builder) { diff --git a/src/main/java/com/gregtechceu/gtceu/api/fluids/store/FluidStorage.java b/src/main/java/com/gregtechceu/gtceu/api/fluids/store/FluidStorage.java index aaadc8e8d0..2ace5b782e 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/fluids/store/FluidStorage.java +++ b/src/main/java/com/gregtechceu/gtceu/api/fluids/store/FluidStorage.java @@ -4,12 +4,13 @@ import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.api.fluids.FluidBuilder; import com.gregtechceu.gtceu.api.registry.registrate.GTRegistrate; + +import net.minecraft.world.level.material.Fluid; + import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.Setter; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.level.material.Fluid; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -22,10 +23,12 @@ public final class FluidStorage { @AllArgsConstructor public static class FluidEntry { + @Getter private Supplier fluid; @Nullable - @Getter @Setter + @Getter + @Setter private FluidBuilder builder; } @@ -39,7 +42,7 @@ public FluidStorage() {} /** * Enqueue a fluid for registration * - * @param key the key corresponding with the fluid + * @param key the key corresponding with the fluid * @param builder the FluidBuilder to build */ public void enqueueRegistration(@NotNull FluidStorageKey key, @NotNull FluidBuilder builder) { @@ -84,15 +87,17 @@ public void registerFluids(@NotNull Material material, GTRegistrate registrate) } toRegister.entrySet().stream() - .sorted(Comparator.comparingInt(e -> -e.getKey().getRegistrationPriority())) - .forEach(entry -> { - if (map.containsKey(entry.getKey())) { - GTCEu.LOGGER.warn("{} already has an associated fluid for material {}", entry.getKey(), material); - return; - } - Supplier fluid = entry.getValue().build(material.getModid(), material, entry.getKey(), registrate); - store(entry.getKey(), fluid, entry.getValue()); - }); + .sorted(Comparator.comparingInt(e -> -e.getKey().getRegistrationPriority())) + .forEach(entry -> { + if (map.containsKey(entry.getKey())) { + GTCEu.LOGGER.warn("{} already has an associated fluid for material {}", entry.getKey(), + material); + return; + } + Supplier fluid = entry.getValue().build(material.getModid(), material, + entry.getKey(), registrate); + store(entry.getKey(), fluid, entry.getValue()); + }); toRegister = null; registered = true; } @@ -116,7 +121,8 @@ public void registerFluids(@NotNull Material material, GTRegistrate registrate) * @param fluid the fluid to associate with the key * @return if the associations were successfully updated */ - public boolean storeNoOverwrites(@NotNull FluidStorageKey key, @NotNull Supplier fluid, @Nullable FluidBuilder builder) { + public boolean storeNoOverwrites(@NotNull FluidStorageKey key, @NotNull Supplier fluid, + @Nullable FluidBuilder builder) { if (map.containsKey(key)) { return false; } @@ -125,11 +131,12 @@ public boolean storeNoOverwrites(@NotNull FluidStorageKey key, @NotNull Supplier } /** - * @param key the key to associate with the fluid + * @param key the key to associate with the fluid * @param fluid the fluid to associate with the key * @throws IllegalArgumentException if a key is already associated with another fluid */ - public void store(@NotNull FluidStorageKey key, @NotNull Supplier fluid, @Nullable FluidBuilder builder) { + public void store(@NotNull FluidStorageKey key, @NotNull Supplier fluid, + @Nullable FluidBuilder builder) { if (map.containsKey(key)) { throw new IllegalArgumentException(key + " already has an associated fluid"); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/fluids/store/FluidStorageKey.java b/src/main/java/com/gregtechceu/gtceu/api/fluids/store/FluidStorageKey.java index 80869cd210..74910d7230 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/fluids/store/FluidStorageKey.java +++ b/src/main/java/com/gregtechceu/gtceu/api/fluids/store/FluidStorageKey.java @@ -3,9 +3,11 @@ import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.api.data.chemical.material.info.MaterialIconType; import com.gregtechceu.gtceu.api.fluids.FluidState; + +import net.minecraft.resources.ResourceLocation; + import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import lombok.Getter; -import net.minecraft.resources.ResourceLocation; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -89,4 +91,4 @@ public int hashCode() { public @NotNull String toString() { return "FluidStorageKey{" + resourceLocation + '}'; } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/fluids/store/FluidStorageKeys.java b/src/main/java/com/gregtechceu/gtceu/api/fluids/store/FluidStorageKeys.java index 84eb39c201..3ce232afd7 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/fluids/store/FluidStorageKeys.java +++ b/src/main/java/com/gregtechceu/gtceu/api/fluids/store/FluidStorageKeys.java @@ -40,4 +40,4 @@ public final class FluidStorageKeys { FluidState.LIQUID, -1); private FluidStorageKeys() {} -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/GuiTextures.java b/src/main/java/com/gregtechceu/gtceu/api/gui/GuiTextures.java index 2bb53d0451..474f5be087 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/GuiTextures.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/GuiTextures.java @@ -2,6 +2,7 @@ import com.lowdragmc.lowdraglib.gui.texture.ResourceBorderTexture; import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; + import lombok.val; /** @@ -11,295 +12,525 @@ */ @SuppressWarnings("unused") public class GuiTextures { - //GREGTECH - public static final ResourceTexture GREGTECH_LOGO = new ResourceTexture("gtceu:textures/gui/icon/gregtech_logo.png"); - public static final ResourceTexture GREGTECH_LOGO_XMAS = new ResourceTexture("gtceu:textures/gui/icon/gregtech_logo_xmas.png"); - //HUD - public static final ResourceTexture TOOL_FRONT_FACING_ROTATION = new ResourceTexture("gtceu:textures/gui/overlay/tool_front_facing_rotation.png"); - public static final ResourceTexture TOOL_IO_FACING_ROTATION = new ResourceTexture("gtceu:textures/gui/overlay/tool_io_facing_rotation.png"); + // GREGTECH + public static final ResourceTexture GREGTECH_LOGO = new ResourceTexture( + "gtceu:textures/gui/icon/gregtech_logo.png"); + public static final ResourceTexture GREGTECH_LOGO_XMAS = new ResourceTexture( + "gtceu:textures/gui/icon/gregtech_logo_xmas.png"); + + // HUD + public static final ResourceTexture TOOL_FRONT_FACING_ROTATION = new ResourceTexture( + "gtceu:textures/gui/overlay/tool_front_facing_rotation.png"); + public static final ResourceTexture TOOL_IO_FACING_ROTATION = new ResourceTexture( + "gtceu:textures/gui/overlay/tool_io_facing_rotation.png"); public static final ResourceTexture TOOL_PAUSE = new ResourceTexture("gtceu:textures/gui/overlay/tool_pause.png"); public static final ResourceTexture TOOL_START = new ResourceTexture("gtceu:textures/gui/overlay/tool_start.png"); - public static final ResourceTexture TOOL_COVER_SETTINGS = new ResourceTexture("gtceu:textures/gui/overlay/tool_cover_settings.png"); + public static final ResourceTexture TOOL_COVER_SETTINGS = new ResourceTexture( + "gtceu:textures/gui/overlay/tool_cover_settings.png"); public static final ResourceTexture TOOL_MUTE = new ResourceTexture("gtceu:textures/gui/overlay/tool_mute.png"); public static final ResourceTexture TOOL_SOUND = new ResourceTexture("gtceu:textures/gui/overlay/tool_sound.png"); - public static final ResourceTexture TOOL_ALLOW_INPUT = new ResourceTexture("gtceu:textures/gui/overlay/tool_allow_input.png"); - public static final ResourceTexture TOOL_ATTACH_COVER = new ResourceTexture("gtceu:textures/gui/overlay/tool_attach_cover.png"); - public static final ResourceTexture TOOL_REMOVE_COVER = new ResourceTexture("gtceu:textures/gui/overlay/tool_remove_cover.png"); - public static final ResourceTexture TOOL_PIPE_BLOCK = new ResourceTexture("gtceu:textures/gui/overlay/tool_pipe_block.png"); - public static final ResourceTexture TOOL_PIPE_CONNECT = new ResourceTexture("gtceu:textures/gui/overlay/tool_pipe_connect.png"); - public static final ResourceTexture TOOL_WIRE_BLOCK = new ResourceTexture("gtceu:textures/gui/overlay/tool_wire_block.png"); - public static final ResourceTexture TOOL_WIRE_CONNECT = new ResourceTexture("gtceu:textures/gui/overlay/tool_wire_connect.png"); - public static final ResourceTexture TOOL_AUTO_OUTPUT = new ResourceTexture("gtceu:textures/gui/overlay/tool_auto_output.png"); - public static final ResourceTexture TOOL_DISABLE_AUTO_OUTPUT = new ResourceTexture("gtceu:textures/gui/overlay/tool_disable_auto_output.png"); - public static final ResourceTexture TOOL_SWITCH_CONVERTER_NATIVE = new ResourceTexture("gtceu:textures/gui/overlay/tool_wire_block.png"); // switch to tool_switch_converter_native once that gets made - public static final ResourceTexture TOOL_SWITCH_CONVERTER_EU = new ResourceTexture("gtceu:textures/gui/overlay/tool_wire_connect.png"); // switch to tool_switch_converter_eu once that gets made + public static final ResourceTexture TOOL_ALLOW_INPUT = new ResourceTexture( + "gtceu:textures/gui/overlay/tool_allow_input.png"); + public static final ResourceTexture TOOL_ATTACH_COVER = new ResourceTexture( + "gtceu:textures/gui/overlay/tool_attach_cover.png"); + public static final ResourceTexture TOOL_REMOVE_COVER = new ResourceTexture( + "gtceu:textures/gui/overlay/tool_remove_cover.png"); + public static final ResourceTexture TOOL_PIPE_BLOCK = new ResourceTexture( + "gtceu:textures/gui/overlay/tool_pipe_block.png"); + public static final ResourceTexture TOOL_PIPE_CONNECT = new ResourceTexture( + "gtceu:textures/gui/overlay/tool_pipe_connect.png"); + public static final ResourceTexture TOOL_WIRE_BLOCK = new ResourceTexture( + "gtceu:textures/gui/overlay/tool_wire_block.png"); + public static final ResourceTexture TOOL_WIRE_CONNECT = new ResourceTexture( + "gtceu:textures/gui/overlay/tool_wire_connect.png"); + public static final ResourceTexture TOOL_AUTO_OUTPUT = new ResourceTexture( + "gtceu:textures/gui/overlay/tool_auto_output.png"); + public static final ResourceTexture TOOL_DISABLE_AUTO_OUTPUT = new ResourceTexture( + "gtceu:textures/gui/overlay/tool_disable_auto_output.png"); + public static final ResourceTexture TOOL_SWITCH_CONVERTER_NATIVE = new ResourceTexture( + "gtceu:textures/gui/overlay/tool_wire_block.png"); // switch to tool_switch_converter_native once that gets + // made + public static final ResourceTexture TOOL_SWITCH_CONVERTER_EU = new ResourceTexture( + "gtceu:textures/gui/overlay/tool_wire_connect.png"); // switch to tool_switch_converter_eu once that gets + // made - - //BASE TEXTURES - public static final ResourceBorderTexture BACKGROUND = new ResourceBorderTexture("gtceu:textures/gui/base/background.png", 16, 16, 4, 4); - public static final ResourceBorderTexture BACKGROUND_INVERSE = new ResourceBorderTexture("gtceu:textures/gui/base/background_inverse.png", 16, 16, 4, 4); - public static final SteamTexture BACKGROUND_STEAM = SteamTexture.fullImage("gtceu:textures/gui/base/background_%s.png"); - public static final ResourceTexture CLIPBOARD_BACKGROUND = new ResourceTexture("gtceu:textures/gui/base/clipboard_background.png"); - public static final ResourceTexture CLIPBOARD_PAPER_BACKGROUND = new ResourceTexture("gtceu:textures/gui/base/clipboard_paper_background.png"); - public static final ResourceBorderTexture TITLE_BAR_BACKGROUND = new ResourceBorderTexture("gtceu:textures/gui/base/title_bar_background.png", 16, 16, 4, 4); + // BASE TEXTURES + public static final ResourceBorderTexture BACKGROUND = new ResourceBorderTexture( + "gtceu:textures/gui/base/background.png", 16, 16, 4, 4); + public static final ResourceBorderTexture BACKGROUND_INVERSE = new ResourceBorderTexture( + "gtceu:textures/gui/base/background_inverse.png", 16, 16, 4, 4); + public static final SteamTexture BACKGROUND_STEAM = SteamTexture + .fullImage("gtceu:textures/gui/base/background_%s.png"); + public static final ResourceTexture CLIPBOARD_BACKGROUND = new ResourceTexture( + "gtceu:textures/gui/base/clipboard_background.png"); + public static final ResourceTexture CLIPBOARD_PAPER_BACKGROUND = new ResourceTexture( + "gtceu:textures/gui/base/clipboard_paper_background.png"); + public static final ResourceBorderTexture TITLE_BAR_BACKGROUND = new ResourceBorderTexture( + "gtceu:textures/gui/base/title_bar_background.png", 16, 16, 4, 4); public static final ResourceTexture DISPLAY = new ResourceTexture("gtceu:textures/gui/base/display.png"); public static final SteamTexture DISPLAY_STEAM = SteamTexture.fullImage("gtceu:textures/gui/base/display_%s.png"); - public static final ResourceTexture BLANK = new ResourceBorderTexture("gtceu:textures/gui/base/blank.png", 1, 1, 0, 0); - public static final ResourceTexture BLANK_TRANSPARENT = new ResourceBorderTexture("gtceu:textures/gui/base/blank_transparent.png", 1, 1, 0, 0); - public static final ResourceBorderTexture FLUID_SLOT = new ResourceBorderTexture("gtceu:textures/gui/base/fluid_slot.png", 18, 18, 1, 1); - public static final ResourceTexture FLUID_TANK_BACKGROUND = new ResourceTexture("gtceu:textures/gui/base/fluid_tank_background.png"); - public static final ResourceTexture FLUID_TANK_OVERLAY = new ResourceTexture("gtceu:textures/gui/base/fluid_tank_overlay.png"); - public static final ResourceBorderTexture SLOT = new ResourceBorderTexture("gtceu:textures/gui/base/slot.png", 18, 18, 1, 1); - public static final ResourceTexture SLOT_DARKENED = new ResourceTexture("gtceu:textures/gui/base/darkened_slot.png"); + public static final ResourceTexture BLANK = new ResourceBorderTexture("gtceu:textures/gui/base/blank.png", 1, 1, 0, + 0); + public static final ResourceTexture BLANK_TRANSPARENT = new ResourceBorderTexture( + "gtceu:textures/gui/base/blank_transparent.png", 1, 1, 0, 0); + public static final ResourceBorderTexture FLUID_SLOT = new ResourceBorderTexture( + "gtceu:textures/gui/base/fluid_slot.png", 18, 18, 1, 1); + public static final ResourceTexture FLUID_TANK_BACKGROUND = new ResourceTexture( + "gtceu:textures/gui/base/fluid_tank_background.png"); + public static final ResourceTexture FLUID_TANK_OVERLAY = new ResourceTexture( + "gtceu:textures/gui/base/fluid_tank_overlay.png"); + public static final ResourceBorderTexture SLOT = new ResourceBorderTexture("gtceu:textures/gui/base/slot.png", 18, + 18, 1, 1); + public static final ResourceTexture SLOT_DARKENED = new ResourceTexture( + "gtceu:textures/gui/base/darkened_slot.png"); public static final SteamTexture SLOT_STEAM = SteamTexture.fullImage("gtceu:textures/gui/base/slot_%s.png"); - public static final ResourceTexture TOGGLE_BUTTON_BACK = new ResourceTexture("gtceu:textures/gui/widget/toggle_button_background.png"); + public static final ResourceTexture TOGGLE_BUTTON_BACK = new ResourceTexture( + "gtceu:textures/gui/widget/toggle_button_background.png"); public static final ResourceTexture CLOSE_ICON = new ResourceTexture("gtceu:textures/gui/icon/close.png"); - //FLUID & ITEM OUTPUT BUTTONS - public static final ResourceTexture BLOCKS_INPUT = new ResourceTexture("gtceu:textures/gui/widget/button_blocks_input.png"); - public static final ResourceBorderTexture BUTTON = new ResourceBorderTexture("gtceu:textures/gui/widget/button.png", 32, 32, 2, 2); - public static final ResourceTexture BUTTON_ALLOW_IMPORT_EXPORT = new ResourceTexture("gtceu:textures/gui/widget/button_allow_import_export.png"); - public static final ResourceTexture BUTTON_BLACKLIST = new ResourceTexture("gtceu:textures/gui/widget/button_blacklist.png"); - public static final ResourceTexture BUTTON_CHUNK_MODE = new ResourceTexture("gtceu:textures/gui/widget/button_chunk_mode.png"); - public static final ResourceTexture BUTTON_CLEAR_GRID = new ResourceTexture("gtceu:textures/gui/widget/button_clear_grid.png"); - public static final ResourceTexture BUTTON_FILTER_DAMAGE = new ResourceTexture("gtceu:textures/gui/widget/button_filter_damage.png"); - public static final ResourceTexture BUTTON_DISTINCT_BUSES = new ResourceTexture("gtceu:textures/gui/widget/button_distinct_buses.png"); - public static final ResourceTexture BUTTON_POWER = new ResourceTexture("gtceu:textures/gui/widget/button_power.png"); - public static final ResourceTexture BUTTON_FILTER_NBT = new ResourceTexture("gtceu:textures/gui/widget/button_filter_nbt.png"); - public static final ResourceTexture BUTTON_FLUID_OUTPUT = new ResourceTexture("gtceu:textures/gui/widget/button_fluid_output_overlay.png"); - public static final ResourceTexture BUTTON_ITEM_OUTPUT = new ResourceTexture("gtceu:textures/gui/widget/button_item_output_overlay.png"); + // FLUID & ITEM OUTPUT BUTTONS + public static final ResourceTexture BLOCKS_INPUT = new ResourceTexture( + "gtceu:textures/gui/widget/button_blocks_input.png"); + public static final ResourceBorderTexture BUTTON = new ResourceBorderTexture("gtceu:textures/gui/widget/button.png", + 32, 32, 2, 2); + public static final ResourceTexture BUTTON_ALLOW_IMPORT_EXPORT = new ResourceTexture( + "gtceu:textures/gui/widget/button_allow_import_export.png"); + public static final ResourceTexture BUTTON_BLACKLIST = new ResourceTexture( + "gtceu:textures/gui/widget/button_blacklist.png"); + public static final ResourceTexture BUTTON_CHUNK_MODE = new ResourceTexture( + "gtceu:textures/gui/widget/button_chunk_mode.png"); + public static final ResourceTexture BUTTON_CLEAR_GRID = new ResourceTexture( + "gtceu:textures/gui/widget/button_clear_grid.png"); + public static final ResourceTexture BUTTON_FILTER_DAMAGE = new ResourceTexture( + "gtceu:textures/gui/widget/button_filter_damage.png"); + public static final ResourceTexture BUTTON_DISTINCT_BUSES = new ResourceTexture( + "gtceu:textures/gui/widget/button_distinct_buses.png"); + public static final ResourceTexture BUTTON_POWER = new ResourceTexture( + "gtceu:textures/gui/widget/button_power.png"); + public static final ResourceTexture BUTTON_FILTER_NBT = new ResourceTexture( + "gtceu:textures/gui/widget/button_filter_nbt.png"); + public static final ResourceTexture BUTTON_FLUID_OUTPUT = new ResourceTexture( + "gtceu:textures/gui/widget/button_fluid_output_overlay.png"); + public static final ResourceTexture BUTTON_ITEM_OUTPUT = new ResourceTexture( + "gtceu:textures/gui/widget/button_item_output_overlay.png"); public static final ResourceTexture BUTTON_LOCK = new ResourceTexture("gtceu:textures/gui/widget/button_lock.png"); public static final ResourceTexture BUTTON_VOID = new ResourceTexture("gtceu:textures/gui/widget/button_void.png"); - public static final ResourceTexture BUTTON_VOID_PARTIAL = new ResourceTexture("gtceu:textures/gui/widget/button_void_partial.png"); - public static final ResourceTexture BUTTON_VOID_MULTIBLOCK = new ResourceTexture("gtceu:textures/gui/widget/button_void_multiblock.png"); + public static final ResourceTexture BUTTON_VOID_PARTIAL = new ResourceTexture( + "gtceu:textures/gui/widget/button_void_partial.png"); + public static final ResourceTexture BUTTON_VOID_MULTIBLOCK = new ResourceTexture( + "gtceu:textures/gui/widget/button_void_multiblock.png"); public static final ResourceTexture BUTTON_LEFT = new ResourceTexture("gtceu:textures/gui/widget/left.png"); - public static final ResourceTexture BUTTON_PUBLIC_PRIVATE = new ResourceTexture("gtceu:textures/gui/widget/button_public_private.png"); + public static final ResourceTexture BUTTON_PUBLIC_PRIVATE = new ResourceTexture( + "gtceu:textures/gui/widget/button_public_private.png"); public static final ResourceTexture BUTTON_RIGHT = new ResourceTexture("gtceu:textures/gui/widget/right.png"); - public static final ResourceTexture BUTTON_SILK_TOUCH_MODE = new ResourceTexture("gtceu:textures/gui/widget/button_silk_touch_mode.png"); - public static final ResourceTexture BUTTON_SWITCH_VIEW = new ResourceTexture("gtceu:textures/gui/widget/button_switch_view.png"); - public static final ResourceTexture BUTTON_WORKING_ENABLE = new ResourceTexture("gtceu:textures/gui/widget/button_working_enable.png"); - public static final ResourceTexture BUTTON_INT_CIRCUIT_PLUS = new ResourceTexture("gtceu:textures/gui/widget/button_circuit_plus.png"); - public static final ResourceTexture BUTTON_INT_CIRCUIT_MINUS = new ResourceTexture("gtceu:textures/gui/widget/button_circuit_minus.png"); - public static final ResourceTexture CLIPBOARD_BUTTON = new ResourceTexture("gtceu:textures/gui/widget/clipboard_button.png"); - public static final ResourceBorderTexture CLIPBOARD_TEXT_BOX = new ResourceBorderTexture("gtceu:textures/gui/widget/clipboard_text_box.png", 9, 18, 1, 1); - public static final ResourceTexture DISTRIBUTION_MODE = new ResourceTexture("gtceu:textures/gui/widget/button_distribution_mode.png"); + public static final ResourceTexture BUTTON_SILK_TOUCH_MODE = new ResourceTexture( + "gtceu:textures/gui/widget/button_silk_touch_mode.png"); + public static final ResourceTexture BUTTON_SWITCH_VIEW = new ResourceTexture( + "gtceu:textures/gui/widget/button_switch_view.png"); + public static final ResourceTexture BUTTON_WORKING_ENABLE = new ResourceTexture( + "gtceu:textures/gui/widget/button_working_enable.png"); + public static final ResourceTexture BUTTON_INT_CIRCUIT_PLUS = new ResourceTexture( + "gtceu:textures/gui/widget/button_circuit_plus.png"); + public static final ResourceTexture BUTTON_INT_CIRCUIT_MINUS = new ResourceTexture( + "gtceu:textures/gui/widget/button_circuit_minus.png"); + public static final ResourceTexture CLIPBOARD_BUTTON = new ResourceTexture( + "gtceu:textures/gui/widget/clipboard_button.png"); + public static final ResourceBorderTexture CLIPBOARD_TEXT_BOX = new ResourceBorderTexture( + "gtceu:textures/gui/widget/clipboard_text_box.png", 9, 18, 1, 1); + public static final ResourceTexture DISTRIBUTION_MODE = new ResourceTexture( + "gtceu:textures/gui/widget/button_distribution_mode.png"); public static final ResourceTexture LOCK = new ResourceTexture("gtceu:textures/gui/widget/lock.png"); public static final ResourceTexture LOCK_WHITE = new ResourceTexture("gtceu:textures/gui/widget/lock_white.png"); public static final ResourceTexture SWITCH = new ResourceTexture("gtceu:textures/gui/widget/switch.png"); - public static final ResourceTexture SWITCH_HORIZONTAL = new ResourceTexture("gtceu:textures/gui/widget/switch_horizontal.png"); - public static final ResourceTexture VANILLA_BUTTON = new ResourceBorderTexture("ldlib:textures/gui/button_common.png", 198, 18, 1, 1); + public static final ResourceTexture SWITCH_HORIZONTAL = new ResourceTexture( + "gtceu:textures/gui/widget/switch_horizontal.png"); + public static final ResourceTexture VANILLA_BUTTON = new ResourceBorderTexture( + "ldlib:textures/gui/button_common.png", 198, 18, 1, 1); - public static final ResourceTexture ENERGY_DETECTOR_COVER_MODE_BUTTON = new ResourceTexture("gtceu:textures/gui/widget/button_detector_cover_energy_mode.png"); - public static final ResourceTexture INVERT_REDSTONE_BUTTON = new ResourceTexture("gtceu:textures/gui/widget/button_detector_cover_inverted.png"); + public static final ResourceTexture ENERGY_DETECTOR_COVER_MODE_BUTTON = new ResourceTexture( + "gtceu:textures/gui/widget/button_detector_cover_energy_mode.png"); + public static final ResourceTexture INVERT_REDSTONE_BUTTON = new ResourceTexture( + "gtceu:textures/gui/widget/button_detector_cover_inverted.png"); - public static final ResourceTexture IO_CONFIG_FLUID_MODES_BUTTON = new ResourceTexture("gtceu:textures/gui/icon/io_config/output_config_fluid_modes.png"); - public static final ResourceTexture IO_CONFIG_ITEM_MODES_BUTTON = new ResourceTexture("gtceu:textures/gui/icon/io_config/output_config_item_modes.png"); - public static final ResourceTexture IO_CONFIG_COVER_SLOT_OVERLAY = new ResourceTexture("gtceu:textures/gui/icon/io_config/cover_slot_overlay.png"); - public static final ResourceTexture IO_CONFIG_COVER_SETTINGS = new ResourceTexture("gtceu:textures/gui/icon/io_config/cover_settings.png"); + public static final ResourceTexture IO_CONFIG_FLUID_MODES_BUTTON = new ResourceTexture( + "gtceu:textures/gui/icon/io_config/output_config_fluid_modes.png"); + public static final ResourceTexture IO_CONFIG_ITEM_MODES_BUTTON = new ResourceTexture( + "gtceu:textures/gui/icon/io_config/output_config_item_modes.png"); + public static final ResourceTexture IO_CONFIG_COVER_SLOT_OVERLAY = new ResourceTexture( + "gtceu:textures/gui/icon/io_config/cover_slot_overlay.png"); + public static final ResourceTexture IO_CONFIG_COVER_SETTINGS = new ResourceTexture( + "gtceu:textures/gui/icon/io_config/cover_settings.png"); - //INDICATORS & ICONS - public static final ResourceTexture INDICATOR_NO_ENERGY = new ResourceTexture("gtceu:textures/gui/base/indicator_no_energy.png"); - public static final SteamTexture INDICATOR_NO_STEAM = SteamTexture.fullImage("gtceu:textures/gui/base/indicator_no_steam_%s.png"); + // INDICATORS & ICONS + public static final ResourceTexture INDICATOR_NO_ENERGY = new ResourceTexture( + "gtceu:textures/gui/base/indicator_no_energy.png"); + public static final SteamTexture INDICATOR_NO_STEAM = SteamTexture + .fullImage("gtceu:textures/gui/base/indicator_no_steam_%s.png"); public static final ResourceTexture TANK_ICON = new ResourceTexture("gtceu:textures/gui/base/tank_icon.png"); - //WIDGET UI RELATED - public static final ResourceTexture SLIDER_BACKGROUND = new ResourceTexture("gtceu:textures/gui/widget/slider_background.png"); - public static final ResourceTexture SLIDER_BACKGROUND_VERTICAL = new ResourceTexture("gtceu:textures/gui/widget/slider_background_vertical.png"); + // WIDGET UI RELATED + public static final ResourceTexture SLIDER_BACKGROUND = new ResourceTexture( + "gtceu:textures/gui/widget/slider_background.png"); + public static final ResourceTexture SLIDER_BACKGROUND_VERTICAL = new ResourceTexture( + "gtceu:textures/gui/widget/slider_background_vertical.png"); public static final ResourceTexture SLIDER_ICON = new ResourceTexture("gtceu:textures/gui/widget/slider.png"); - public static final ResourceTexture MAINTENANCE_BUTTON = new ResourceTexture("gtceu:textures/gui/widget/button_maintenance.png"); - public static final ResourceTexture MAINTENANCE_ICON = new ResourceTexture("gtceu:textures/block/overlay/machine/overlay_maintenance.png"); - public static final ResourceTexture BUTTON_MINER_MODES = new ResourceTexture("gtceu:textures/gui/widget/button_miner_modes.png"); + public static final ResourceTexture MAINTENANCE_BUTTON = new ResourceTexture( + "gtceu:textures/gui/widget/button_maintenance.png"); + public static final ResourceTexture MAINTENANCE_ICON = new ResourceTexture( + "gtceu:textures/block/overlay/machine/overlay_maintenance.png"); + public static final ResourceTexture BUTTON_MINER_MODES = new ResourceTexture( + "gtceu:textures/gui/widget/button_miner_modes.png"); - //ORE PROCESSING + // ORE PROCESSING public static final ResourceTexture OREBY_BASE = new ResourceTexture("gtceu:textures/gui/arrows/oreby-base.png"); public static final ResourceTexture OREBY_CHEM = new ResourceTexture("gtceu:textures/gui/arrows/oreby-chem.png"); public static final ResourceTexture OREBY_SEP = new ResourceTexture("gtceu:textures/gui/arrows/oreby-sep.png"); public static final ResourceTexture OREBY_SIFT = new ResourceTexture("gtceu:textures/gui/arrows/oreby-sift.png"); public static final ResourceTexture OREBY_SMELT = new ResourceTexture("gtceu:textures/gui/arrows/oreby-smelt.png"); + // PRIMITIVE + public static final ResourceBorderTexture PRIMITIVE_BACKGROUND = new ResourceBorderTexture( + "gtceu:textures/gui/primitive/primitive_background.png", 176, 166, 3, 3); + public static final ResourceBorderTexture PRIMITIVE_SLOT = new ResourceBorderTexture( + "gtceu:textures/gui/primitive/primitive_slot.png", 18, 18, 1, 1); + public static final ResourceTexture PRIMITIVE_FURNACE_OVERLAY = new ResourceTexture( + "gtceu:textures/gui/primitive/overlay_primitive_furnace.png"); + public static final ResourceTexture PRIMITIVE_DUST_OVERLAY = new ResourceTexture( + "gtceu:textures/gui/primitive/overlay_primitive_dust.png"); + public static final ResourceTexture PRIMITIVE_INGOT_OVERLAY = new ResourceTexture( + "gtceu:textures/gui/primitive/overlay_primitive_ingot.png"); + public static final ResourceTexture PRIMITIVE_LARGE_FLUID_TANK = new ResourceTexture( + "gtceu:textures/gui/primitive/primitive_large_fluid_tank.png"); + public static final ResourceTexture PRIMITIVE_LARGE_FLUID_TANK_OVERLAY = new ResourceTexture( + "gtceu:textures/gui/primitive/primitive_large_fluid_tank_overlay.png"); + public static final ResourceTexture PRIMITIVE_BLAST_FURNACE_PROGRESS_BAR = new ResourceTexture( + "gtceu:textures/gui/primitive/progress_bar_primitive_blast_furnace.png"); - //PRIMITIVE - public static final ResourceBorderTexture PRIMITIVE_BACKGROUND = new ResourceBorderTexture("gtceu:textures/gui/primitive/primitive_background.png", 176, 166, 3, 3); - public static final ResourceBorderTexture PRIMITIVE_SLOT = new ResourceBorderTexture("gtceu:textures/gui/primitive/primitive_slot.png", 18, 18, 1, 1); - public static final ResourceTexture PRIMITIVE_FURNACE_OVERLAY = new ResourceTexture("gtceu:textures/gui/primitive/overlay_primitive_furnace.png"); - public static final ResourceTexture PRIMITIVE_DUST_OVERLAY = new ResourceTexture("gtceu:textures/gui/primitive/overlay_primitive_dust.png"); - public static final ResourceTexture PRIMITIVE_INGOT_OVERLAY = new ResourceTexture("gtceu:textures/gui/primitive/overlay_primitive_ingot.png"); - public static final ResourceTexture PRIMITIVE_LARGE_FLUID_TANK = new ResourceTexture("gtceu:textures/gui/primitive/primitive_large_fluid_tank.png"); - public static final ResourceTexture PRIMITIVE_LARGE_FLUID_TANK_OVERLAY = new ResourceTexture("gtceu:textures/gui/primitive/primitive_large_fluid_tank_overlay.png"); - public static final ResourceTexture PRIMITIVE_BLAST_FURNACE_PROGRESS_BAR = new ResourceTexture("gtceu:textures/gui/primitive/progress_bar_primitive_blast_furnace.png"); - - //SLOT OVERLAYS - public static final ResourceTexture ATOMIC_OVERLAY_1 = new ResourceTexture("gtceu:textures/gui/overlay/atomic_overlay_1.png"); - public static final ResourceTexture ATOMIC_OVERLAY_2 = new ResourceTexture("gtceu:textures/gui/overlay/atomic_overlay_2.png"); - public static final ResourceTexture ARROW_INPUT_OVERLAY = new ResourceTexture("gtceu:textures/gui/overlay/arrow_input_overlay.png"); - public static final ResourceTexture ARROW_OUTPUT_OVERLAY = new ResourceTexture("gtceu:textures/gui/overlay/arrow_output_overlay.png"); - public static final ResourceTexture BATTERY_OVERLAY = new ResourceTexture("gtceu:textures/gui/overlay/battery_overlay.png"); - public static final ResourceTexture BEAKER_OVERLAY_1 = new ResourceTexture("gtceu:textures/gui/overlay/beaker_overlay_1.png"); - public static final ResourceTexture BEAKER_OVERLAY_2 = new ResourceTexture("gtceu:textures/gui/overlay/beaker_overlay_2.png"); - public static final ResourceTexture BEAKER_OVERLAY_3 = new ResourceTexture("gtceu:textures/gui/overlay/beaker_overlay_3.png"); - public static final ResourceTexture BEAKER_OVERLAY_4 = new ResourceTexture("gtceu:textures/gui/overlay/beaker_overlay_4.png"); - public static final ResourceTexture BENDER_OVERLAY = new ResourceTexture("gtceu:textures/gui/overlay/bender_overlay.png"); + // SLOT OVERLAYS + public static final ResourceTexture ATOMIC_OVERLAY_1 = new ResourceTexture( + "gtceu:textures/gui/overlay/atomic_overlay_1.png"); + public static final ResourceTexture ATOMIC_OVERLAY_2 = new ResourceTexture( + "gtceu:textures/gui/overlay/atomic_overlay_2.png"); + public static final ResourceTexture ARROW_INPUT_OVERLAY = new ResourceTexture( + "gtceu:textures/gui/overlay/arrow_input_overlay.png"); + public static final ResourceTexture ARROW_OUTPUT_OVERLAY = new ResourceTexture( + "gtceu:textures/gui/overlay/arrow_output_overlay.png"); + public static final ResourceTexture BATTERY_OVERLAY = new ResourceTexture( + "gtceu:textures/gui/overlay/battery_overlay.png"); + public static final ResourceTexture BEAKER_OVERLAY_1 = new ResourceTexture( + "gtceu:textures/gui/overlay/beaker_overlay_1.png"); + public static final ResourceTexture BEAKER_OVERLAY_2 = new ResourceTexture( + "gtceu:textures/gui/overlay/beaker_overlay_2.png"); + public static final ResourceTexture BEAKER_OVERLAY_3 = new ResourceTexture( + "gtceu:textures/gui/overlay/beaker_overlay_3.png"); + public static final ResourceTexture BEAKER_OVERLAY_4 = new ResourceTexture( + "gtceu:textures/gui/overlay/beaker_overlay_4.png"); + public static final ResourceTexture BENDER_OVERLAY = new ResourceTexture( + "gtceu:textures/gui/overlay/bender_overlay.png"); public static final ResourceTexture BOX_OVERLAY = new ResourceTexture("gtceu:textures/gui/overlay/box_overlay.png"); - public static final ResourceTexture BOXED_OVERLAY = new ResourceTexture("gtceu:textures/gui/overlay/boxed_overlay.png"); - public static final ResourceTexture BREWER_OVERLAY = new ResourceTexture("gtceu:textures/gui/overlay/brewer_overlay.png"); - public static final ResourceTexture CANNER_OVERLAY = new ResourceTexture("gtceu:textures/gui/overlay/canner_overlay.png"); - public static final ResourceTexture CHARGER_OVERLAY = new ResourceTexture("gtceu:textures/gui/overlay/charger_slot_overlay.png"); - public static final ResourceTexture CANISTER_OVERLAY = new ResourceTexture("gtceu:textures/gui/overlay/canister_overlay.png"); - public static final SteamTexture CANISTER_OVERLAY_STEAM = SteamTexture.fullImage("gtceu:textures/gui/overlay/canister_overlay_%s.png"); - public static final ResourceTexture CENTRIFUGE_OVERLAY = new ResourceTexture("gtceu:textures/gui/overlay/centrifuge_overlay.png"); - public static final ResourceTexture CIRCUIT_OVERLAY = new ResourceTexture("gtceu:textures/gui/overlay/circuit_overlay.png"); - public static final SteamTexture COAL_OVERLAY_STEAM = SteamTexture.fullImage("gtceu:textures/gui/overlay/coal_overlay_%s.png"); - public static final ResourceTexture COMPRESSOR_OVERLAY = new ResourceTexture("gtceu:textures/gui/overlay/compressor_overlay.png"); - public static final SteamTexture COMPRESSOR_OVERLAY_STEAM = SteamTexture.fullImage("gtceu:textures/gui/overlay/compressor_overlay_%s.png"); - public static final ResourceTexture CRACKING_OVERLAY_1 = new ResourceTexture("gtceu:textures/gui/overlay/cracking_overlay_1.png"); - public static final ResourceTexture CRACKING_OVERLAY_2 = new ResourceTexture("gtceu:textures/gui/overlay/cracking_overlay_2.png"); - public static final ResourceTexture CRUSHED_ORE_OVERLAY = new ResourceTexture("gtceu:textures/gui/overlay/crushed_ore_overlay.png"); - public static final SteamTexture CRUSHED_ORE_OVERLAY_STEAM = SteamTexture.fullImage("gtceu:textures/gui/overlay/crushed_ore_overlay_%s.png"); - public static final ResourceTexture CRYSTAL_OVERLAY = new ResourceTexture("gtceu:textures/gui/overlay/crystal_overlay.png"); - public static final ResourceTexture CUTTER_OVERLAY = new ResourceTexture("gtceu:textures/gui/overlay/cutter_overlay.png"); - public static final ResourceTexture DARK_CANISTER_OVERLAY = new ResourceTexture("gtceu:textures/gui/overlay/dark_canister_overlay.png"); - public static final ResourceTexture DUST_OVERLAY = new ResourceTexture("gtceu:textures/gui/overlay/dust_overlay.png"); - public static final SteamTexture DUST_OVERLAY_STEAM = SteamTexture.fullImage("gtceu:textures/gui/overlay/dust_overlay_%s.png"); - public static final ResourceTexture EXTRACTOR_OVERLAY = new ResourceTexture("gtceu:textures/gui/overlay/extractor_overlay.png"); - public static final SteamTexture EXTRACTOR_OVERLAY_STEAM = SteamTexture.fullImage("gtceu:textures/gui/overlay/extractor_overlay_%s.png"); - public static final ResourceTexture FILTER_SLOT_OVERLAY = new ResourceTexture("gtceu:textures/gui/overlay/filter_slot_overlay.png"); - public static final ResourceTexture FURNACE_OVERLAY_1 = new ResourceTexture("gtceu:textures/gui/overlay/furnace_overlay_1.png"); - public static final ResourceTexture FURNACE_OVERLAY_2 = new ResourceTexture("gtceu:textures/gui/overlay/furnace_overlay_2.png"); - public static final SteamTexture FURNACE_OVERLAY_STEAM = SteamTexture.fullImage("gtceu:textures/gui/overlay/furnace_overlay_%s.png"); - public static final ResourceTexture HAMMER_OVERLAY = new ResourceTexture("gtceu:textures/gui/overlay/hammer_overlay.png"); - public static final SteamTexture HAMMER_OVERLAY_STEAM = SteamTexture.fullImage("gtceu:textures/gui/overlay/hammer_overlay_%s.png"); - public static final ResourceTexture HEATING_OVERLAY_1 = new ResourceTexture("gtceu:textures/gui/overlay/heating_overlay_1.png"); - public static final ResourceTexture HEATING_OVERLAY_2 = new ResourceTexture("gtceu:textures/gui/overlay/heating_overlay_2.png"); - public static final ResourceTexture IMPLOSION_OVERLAY_1 = new ResourceTexture("gtceu:textures/gui/overlay/implosion_overlay_1.png"); - public static final ResourceTexture IMPLOSION_OVERLAY_2 = new ResourceTexture("gtceu:textures/gui/overlay/implosion_overlay_2.png"); - public static final ResourceTexture IN_SLOT_OVERLAY = new ResourceTexture("gtceu:textures/gui/overlay/in_slot_overlay.png"); - public static final SteamTexture IN_SLOT_OVERLAY_STEAM = SteamTexture.fullImage("gtceu:textures/gui/overlay/in_slot_overlay_%s.png"); - public static final ResourceTexture INGOT_OVERLAY = new ResourceTexture("gtceu:textures/gui/overlay/ingot_overlay.png"); - public static final ResourceTexture INT_CIRCUIT_OVERLAY = new ResourceTexture("gtceu:textures/gui/overlay/int_circuit_overlay.png"); - public static final ResourceTexture LENS_OVERLAY = new ResourceTexture("gtceu:textures/gui/overlay/lens_overlay.png"); - public static final ResourceTexture LIGHTNING_OVERLAY_1 = new ResourceTexture("gtceu:textures/gui/overlay/lightning_overlay_1.png"); - public static final ResourceTexture LIGHTNING_OVERLAY_2 = new ResourceTexture("gtceu:textures/gui/overlay/lightning_overlay_2.png"); - public static final ResourceTexture MOLD_OVERLAY = new ResourceTexture("gtceu:textures/gui/overlay/mold_overlay.png"); - public static final ResourceTexture MOLECULAR_OVERLAY_1 = new ResourceTexture("gtceu:textures/gui/overlay/molecular_overlay_1.png"); - public static final ResourceTexture MOLECULAR_OVERLAY_2 = new ResourceTexture("gtceu:textures/gui/overlay/molecular_overlay_2.png"); - public static final ResourceTexture MOLECULAR_OVERLAY_3 = new ResourceTexture("gtceu:textures/gui/overlay/molecular_overlay_3.png"); - public static final ResourceTexture MOLECULAR_OVERLAY_4 = new ResourceTexture("gtceu:textures/gui/overlay/molecular_overlay_4.png"); - public static final ResourceTexture OUT_SLOT_OVERLAY = new ResourceTexture("gtceu:textures/gui/overlay/out_slot_overlay.png"); - public static final SteamTexture OUT_SLOT_OVERLAY_STEAM = SteamTexture.fullImage("gtceu:textures/gui/overlay/out_slot_overlay_%s.png"); - public static final ResourceTexture PAPER_OVERLAY = new ResourceTexture("gtceu:textures/gui/overlay/paper_overlay.png"); - public static final ResourceTexture PRINTED_PAPER_OVERLAY = new ResourceTexture("gtceu:textures/gui/overlay/printed_paper_overlay.png"); - public static final ResourceTexture PIPE_OVERLAY_2 = new ResourceTexture("gtceu:textures/gui/overlay/pipe_overlay_2.png"); - public static final ResourceTexture PIPE_OVERLAY_1 = new ResourceTexture("gtceu:textures/gui/overlay/pipe_overlay_1.png"); - public static final ResourceTexture PRESS_OVERLAY_1 = new ResourceTexture("gtceu:textures/gui/overlay/press_overlay_1.png"); - public static final ResourceTexture PRESS_OVERLAY_2 = new ResourceTexture("gtceu:textures/gui/overlay/press_overlay_2.png"); - public static final ResourceTexture PRESS_OVERLAY_3 = new ResourceTexture("gtceu:textures/gui/overlay/press_overlay_3.png"); - public static final ResourceTexture PRESS_OVERLAY_4 = new ResourceTexture("gtceu:textures/gui/overlay/press_overlay_4.png"); - public static final ResourceTexture SAWBLADE_OVERLAY = new ResourceTexture("gtceu:textures/gui/overlay/sawblade_overlay.png"); - public static final ResourceTexture SOLIDIFIER_OVERLAY = new ResourceTexture("gtceu:textures/gui/overlay/solidifier_overlay.png"); - public static final ResourceTexture STRING_SLOT_OVERLAY = new ResourceTexture("gtceu:textures/gui/overlay/string_slot_overlay.png"); - public static final ResourceTexture TOOL_SLOT_OVERLAY = new ResourceTexture("gtceu:textures/gui/overlay/tool_slot_overlay.png"); - public static final ResourceTexture TURBINE_OVERLAY = new ResourceTexture("gtceu:textures/gui/overlay/turbine_overlay.png"); - public static final ResourceTexture VIAL_OVERLAY_1 = new ResourceTexture("gtceu:textures/gui/overlay/vial_overlay_1.png"); - public static final ResourceTexture VIAL_OVERLAY_2 = new ResourceTexture("gtceu:textures/gui/overlay/vial_overlay_2.png"); - public static final ResourceTexture WIREMILL_OVERLAY = new ResourceTexture("gtceu:textures/gui/overlay/wiremill_overlay.png"); - public static final ResourceTexture POSITIVE_MATTER_OVERLAY = new ResourceTexture("gtceu:textures/gui/overlay/positive_matter_overlay.png"); - public static final ResourceTexture NEUTRAL_MATTER_OVERLAY = new ResourceTexture("gtceu:textures/gui/overlay/neutral_matter_overlay.png"); - public static final ResourceTexture DATA_ORB_OVERLAY = new ResourceTexture("gtceu:textures/gui/overlay/data_orb_overlay.png"); - public static final ResourceTexture SCANNER_OVERLAY = new ResourceTexture("gtceu:textures/gui/overlay/scanner_overlay.png"); - public static final ResourceTexture DUCT_TAPE_OVERLAY = new ResourceTexture("gtceu:textures/gui/overlay/duct_tape_overlay.png"); - public static final ResourceTexture RESEARCH_STATION_OVERLAY = new ResourceTexture("gtceu:textures/gui/overlay/research_station_overlay.png"); + public static final ResourceTexture BOXED_OVERLAY = new ResourceTexture( + "gtceu:textures/gui/overlay/boxed_overlay.png"); + public static final ResourceTexture BREWER_OVERLAY = new ResourceTexture( + "gtceu:textures/gui/overlay/brewer_overlay.png"); + public static final ResourceTexture CANNER_OVERLAY = new ResourceTexture( + "gtceu:textures/gui/overlay/canner_overlay.png"); + public static final ResourceTexture CHARGER_OVERLAY = new ResourceTexture( + "gtceu:textures/gui/overlay/charger_slot_overlay.png"); + public static final ResourceTexture CANISTER_OVERLAY = new ResourceTexture( + "gtceu:textures/gui/overlay/canister_overlay.png"); + public static final SteamTexture CANISTER_OVERLAY_STEAM = SteamTexture + .fullImage("gtceu:textures/gui/overlay/canister_overlay_%s.png"); + public static final ResourceTexture CENTRIFUGE_OVERLAY = new ResourceTexture( + "gtceu:textures/gui/overlay/centrifuge_overlay.png"); + public static final ResourceTexture CIRCUIT_OVERLAY = new ResourceTexture( + "gtceu:textures/gui/overlay/circuit_overlay.png"); + public static final SteamTexture COAL_OVERLAY_STEAM = SteamTexture + .fullImage("gtceu:textures/gui/overlay/coal_overlay_%s.png"); + public static final ResourceTexture COMPRESSOR_OVERLAY = new ResourceTexture( + "gtceu:textures/gui/overlay/compressor_overlay.png"); + public static final SteamTexture COMPRESSOR_OVERLAY_STEAM = SteamTexture + .fullImage("gtceu:textures/gui/overlay/compressor_overlay_%s.png"); + public static final ResourceTexture CRACKING_OVERLAY_1 = new ResourceTexture( + "gtceu:textures/gui/overlay/cracking_overlay_1.png"); + public static final ResourceTexture CRACKING_OVERLAY_2 = new ResourceTexture( + "gtceu:textures/gui/overlay/cracking_overlay_2.png"); + public static final ResourceTexture CRUSHED_ORE_OVERLAY = new ResourceTexture( + "gtceu:textures/gui/overlay/crushed_ore_overlay.png"); + public static final SteamTexture CRUSHED_ORE_OVERLAY_STEAM = SteamTexture + .fullImage("gtceu:textures/gui/overlay/crushed_ore_overlay_%s.png"); + public static final ResourceTexture CRYSTAL_OVERLAY = new ResourceTexture( + "gtceu:textures/gui/overlay/crystal_overlay.png"); + public static final ResourceTexture CUTTER_OVERLAY = new ResourceTexture( + "gtceu:textures/gui/overlay/cutter_overlay.png"); + public static final ResourceTexture DARK_CANISTER_OVERLAY = new ResourceTexture( + "gtceu:textures/gui/overlay/dark_canister_overlay.png"); + public static final ResourceTexture DUST_OVERLAY = new ResourceTexture( + "gtceu:textures/gui/overlay/dust_overlay.png"); + public static final SteamTexture DUST_OVERLAY_STEAM = SteamTexture + .fullImage("gtceu:textures/gui/overlay/dust_overlay_%s.png"); + public static final ResourceTexture EXTRACTOR_OVERLAY = new ResourceTexture( + "gtceu:textures/gui/overlay/extractor_overlay.png"); + public static final SteamTexture EXTRACTOR_OVERLAY_STEAM = SteamTexture + .fullImage("gtceu:textures/gui/overlay/extractor_overlay_%s.png"); + public static final ResourceTexture FILTER_SLOT_OVERLAY = new ResourceTexture( + "gtceu:textures/gui/overlay/filter_slot_overlay.png"); + public static final ResourceTexture FURNACE_OVERLAY_1 = new ResourceTexture( + "gtceu:textures/gui/overlay/furnace_overlay_1.png"); + public static final ResourceTexture FURNACE_OVERLAY_2 = new ResourceTexture( + "gtceu:textures/gui/overlay/furnace_overlay_2.png"); + public static final SteamTexture FURNACE_OVERLAY_STEAM = SteamTexture + .fullImage("gtceu:textures/gui/overlay/furnace_overlay_%s.png"); + public static final ResourceTexture HAMMER_OVERLAY = new ResourceTexture( + "gtceu:textures/gui/overlay/hammer_overlay.png"); + public static final SteamTexture HAMMER_OVERLAY_STEAM = SteamTexture + .fullImage("gtceu:textures/gui/overlay/hammer_overlay_%s.png"); + public static final ResourceTexture HEATING_OVERLAY_1 = new ResourceTexture( + "gtceu:textures/gui/overlay/heating_overlay_1.png"); + public static final ResourceTexture HEATING_OVERLAY_2 = new ResourceTexture( + "gtceu:textures/gui/overlay/heating_overlay_2.png"); + public static final ResourceTexture IMPLOSION_OVERLAY_1 = new ResourceTexture( + "gtceu:textures/gui/overlay/implosion_overlay_1.png"); + public static final ResourceTexture IMPLOSION_OVERLAY_2 = new ResourceTexture( + "gtceu:textures/gui/overlay/implosion_overlay_2.png"); + public static final ResourceTexture IN_SLOT_OVERLAY = new ResourceTexture( + "gtceu:textures/gui/overlay/in_slot_overlay.png"); + public static final SteamTexture IN_SLOT_OVERLAY_STEAM = SteamTexture + .fullImage("gtceu:textures/gui/overlay/in_slot_overlay_%s.png"); + public static final ResourceTexture INGOT_OVERLAY = new ResourceTexture( + "gtceu:textures/gui/overlay/ingot_overlay.png"); + public static final ResourceTexture INT_CIRCUIT_OVERLAY = new ResourceTexture( + "gtceu:textures/gui/overlay/int_circuit_overlay.png"); + public static final ResourceTexture LENS_OVERLAY = new ResourceTexture( + "gtceu:textures/gui/overlay/lens_overlay.png"); + public static final ResourceTexture LIGHTNING_OVERLAY_1 = new ResourceTexture( + "gtceu:textures/gui/overlay/lightning_overlay_1.png"); + public static final ResourceTexture LIGHTNING_OVERLAY_2 = new ResourceTexture( + "gtceu:textures/gui/overlay/lightning_overlay_2.png"); + public static final ResourceTexture MOLD_OVERLAY = new ResourceTexture( + "gtceu:textures/gui/overlay/mold_overlay.png"); + public static final ResourceTexture MOLECULAR_OVERLAY_1 = new ResourceTexture( + "gtceu:textures/gui/overlay/molecular_overlay_1.png"); + public static final ResourceTexture MOLECULAR_OVERLAY_2 = new ResourceTexture( + "gtceu:textures/gui/overlay/molecular_overlay_2.png"); + public static final ResourceTexture MOLECULAR_OVERLAY_3 = new ResourceTexture( + "gtceu:textures/gui/overlay/molecular_overlay_3.png"); + public static final ResourceTexture MOLECULAR_OVERLAY_4 = new ResourceTexture( + "gtceu:textures/gui/overlay/molecular_overlay_4.png"); + public static final ResourceTexture OUT_SLOT_OVERLAY = new ResourceTexture( + "gtceu:textures/gui/overlay/out_slot_overlay.png"); + public static final SteamTexture OUT_SLOT_OVERLAY_STEAM = SteamTexture + .fullImage("gtceu:textures/gui/overlay/out_slot_overlay_%s.png"); + public static final ResourceTexture PAPER_OVERLAY = new ResourceTexture( + "gtceu:textures/gui/overlay/paper_overlay.png"); + public static final ResourceTexture PRINTED_PAPER_OVERLAY = new ResourceTexture( + "gtceu:textures/gui/overlay/printed_paper_overlay.png"); + public static final ResourceTexture PIPE_OVERLAY_2 = new ResourceTexture( + "gtceu:textures/gui/overlay/pipe_overlay_2.png"); + public static final ResourceTexture PIPE_OVERLAY_1 = new ResourceTexture( + "gtceu:textures/gui/overlay/pipe_overlay_1.png"); + public static final ResourceTexture PRESS_OVERLAY_1 = new ResourceTexture( + "gtceu:textures/gui/overlay/press_overlay_1.png"); + public static final ResourceTexture PRESS_OVERLAY_2 = new ResourceTexture( + "gtceu:textures/gui/overlay/press_overlay_2.png"); + public static final ResourceTexture PRESS_OVERLAY_3 = new ResourceTexture( + "gtceu:textures/gui/overlay/press_overlay_3.png"); + public static final ResourceTexture PRESS_OVERLAY_4 = new ResourceTexture( + "gtceu:textures/gui/overlay/press_overlay_4.png"); + public static final ResourceTexture SAWBLADE_OVERLAY = new ResourceTexture( + "gtceu:textures/gui/overlay/sawblade_overlay.png"); + public static final ResourceTexture SOLIDIFIER_OVERLAY = new ResourceTexture( + "gtceu:textures/gui/overlay/solidifier_overlay.png"); + public static final ResourceTexture STRING_SLOT_OVERLAY = new ResourceTexture( + "gtceu:textures/gui/overlay/string_slot_overlay.png"); + public static final ResourceTexture TOOL_SLOT_OVERLAY = new ResourceTexture( + "gtceu:textures/gui/overlay/tool_slot_overlay.png"); + public static final ResourceTexture TURBINE_OVERLAY = new ResourceTexture( + "gtceu:textures/gui/overlay/turbine_overlay.png"); + public static final ResourceTexture VIAL_OVERLAY_1 = new ResourceTexture( + "gtceu:textures/gui/overlay/vial_overlay_1.png"); + public static final ResourceTexture VIAL_OVERLAY_2 = new ResourceTexture( + "gtceu:textures/gui/overlay/vial_overlay_2.png"); + public static final ResourceTexture WIREMILL_OVERLAY = new ResourceTexture( + "gtceu:textures/gui/overlay/wiremill_overlay.png"); + public static final ResourceTexture POSITIVE_MATTER_OVERLAY = new ResourceTexture( + "gtceu:textures/gui/overlay/positive_matter_overlay.png"); + public static final ResourceTexture NEUTRAL_MATTER_OVERLAY = new ResourceTexture( + "gtceu:textures/gui/overlay/neutral_matter_overlay.png"); + public static final ResourceTexture DATA_ORB_OVERLAY = new ResourceTexture( + "gtceu:textures/gui/overlay/data_orb_overlay.png"); + public static final ResourceTexture SCANNER_OVERLAY = new ResourceTexture( + "gtceu:textures/gui/overlay/scanner_overlay.png"); + public static final ResourceTexture DUCT_TAPE_OVERLAY = new ResourceTexture( + "gtceu:textures/gui/overlay/duct_tape_overlay.png"); + public static final ResourceTexture RESEARCH_STATION_OVERLAY = new ResourceTexture( + "gtceu:textures/gui/overlay/research_station_overlay.png"); - //PROGRESS BARS - public static final ResourceTexture PROGRESS_BAR_ARC_FURNACE = new ResourceTexture("gtceu:textures/gui/progress_bar/progress_bar_arc_furnace.png"); - public static final ResourceTexture PROGRESS_BAR_ARROW = new ResourceTexture("gtceu:textures/gui/progress_bar/progress_bar_arrow.png"); - public static final SteamTexture PROGRESS_BAR_ARROW_STEAM = SteamTexture.fullImage("gtceu:textures/gui/progress_bar/progress_bar_arrow_%s.png"); - public static final ResourceTexture PROGRESS_BAR_ARROW_MULTIPLE = new ResourceTexture("gtceu:textures/gui/progress_bar/progress_bar_arrow_multiple.png"); - public static final ResourceTexture PROGRESS_BAR_ASSEMBLY_LINE = new ResourceTexture("gtceu:textures/gui/progress_bar/progress_bar_assembly_line.png"); - public static final ResourceTexture PROGRESS_BAR_ASSEMBLY_LINE_ARROW = new ResourceTexture("gtceu:textures/gui/progress_bar/progress_bar_assembly_line_arrow.png"); - public static final ResourceTexture PROGRESS_BAR_BATH = new ResourceTexture("gtceu:textures/gui/progress_bar/progress_bar_bath.png"); - public static final ResourceTexture PROGRESS_BAR_BENDING = new ResourceTexture("gtceu:textures/gui/progress_bar/progress_bar_bending.png"); - public static final SteamTexture PROGRESS_BAR_BOILER_EMPTY = SteamTexture.fullImage("gtceu:textures/gui/progress_bar/progress_bar_boiler_empty_%s.png"); - public static final SteamTexture PROGRESS_BAR_BOILER_FUEL = SteamTexture.fullImage("gtceu:textures/gui/progress_bar/progress_bar_boiler_fuel_%s.png"); - public static final ResourceTexture PROGRESS_BAR_BOILER_HEAT = new ResourceTexture("gtceu:textures/gui/progress_bar/progress_bar_boiler_heat.png"); - public static final ResourceTexture PROGRESS_BAR_CANNER = new ResourceTexture("gtceu:textures/gui/progress_bar/progress_bar_canner.png"); - public static final ResourceTexture PROGRESS_BAR_CIRCUIT = new ResourceTexture("gtceu:textures/gui/progress_bar/progress_bar_circuit.png"); - public static final ResourceTexture PROGRESS_BAR_CIRCUIT_ASSEMBLER = new ResourceTexture("gtceu:textures/gui/progress_bar/progress_bar_circuit_assembler.png"); - public static final ResourceTexture PROGRESS_BAR_COKE_OVEN = new ResourceTexture("gtceu:textures/gui/progress_bar/progress_bar_coke_oven.png"); - public static final ResourceTexture PROGRESS_BAR_COMPRESS = new ResourceTexture("gtceu:textures/gui/progress_bar/progress_bar_compress.png"); - public static final SteamTexture PROGRESS_BAR_COMPRESS_STEAM = SteamTexture.fullImage("gtceu:textures/gui/progress_bar/progress_bar_compress_%s.png"); - public static final ResourceTexture PROGRESS_BAR_CRACKING = new ResourceTexture("gtceu:textures/gui/progress_bar/progress_bar_cracking.png"); - public static final ResourceTexture PROGRESS_BAR_CRACKING_INPUT = new ResourceTexture("gtceu:textures/gui/progress_bar/progress_bar_cracking_2.png"); - public static final ResourceTexture PROGRESS_BAR_CRYSTALLIZATION = new ResourceTexture("gtceu:textures/gui/progress_bar/progress_bar_crystallization.png"); - public static final ResourceTexture PROGRESS_BAR_DISTILLATION_TOWER = new ResourceTexture("gtceu:textures/gui/progress_bar/progress_bar_distillation_tower.png"); - public static final ResourceTexture PROGRESS_BAR_EXTRACT = new ResourceTexture("gtceu:textures/gui/progress_bar/progress_bar_extract.png"); - public static final SteamTexture PROGRESS_BAR_EXTRACT_STEAM = SteamTexture.fullImage("gtceu:textures/gui/progress_bar/progress_bar_extract_%s.png"); - public static final ResourceTexture PROGRESS_BAR_EXTRUDER = new ResourceTexture("gtceu:textures/gui/progress_bar/progress_bar_extruder.png"); - public static final ResourceTexture PROGRESS_BAR_FUSION = new ResourceTexture("gtceu:textures/gui/progress_bar/progress_bar_fusion.png"); - public static final ResourceTexture PROGRESS_BAR_GAS_COLLECTOR = new ResourceTexture("gtceu:textures/gui/progress_bar/progress_bar_gas_collector.png"); - public static final ResourceTexture PROGRESS_BAR_HAMMER = new ResourceTexture("gtceu:textures/gui/progress_bar/progress_bar_hammer.png"); - public static final SteamTexture PROGRESS_BAR_HAMMER_STEAM = SteamTexture.fullImage("gtceu:textures/gui/progress_bar/progress_bar_hammer_%s.png"); - public static final ResourceTexture PROGRESS_BAR_HAMMER_BASE = new ResourceTexture("gtceu:textures/gui/progress_bar/progress_bar_hammer_base.png"); - public static final SteamTexture PROGRESS_BAR_HAMMER_BASE_STEAM = SteamTexture.fullImage("gtceu:textures/gui/progress_bar/progress_bar_hammer_base_%s.png"); - public static final ResourceTexture PROGRESS_BAR_LATHE = new ResourceTexture("gtceu:textures/gui/progress_bar/progress_bar_lathe.png"); - public static final ResourceTexture PROGRESS_BAR_LATHE_BASE = new ResourceTexture("gtceu:textures/gui/progress_bar/progress_bar_lathe_base.png"); - public static final ResourceTexture PROGRESS_BAR_MACERATE = new ResourceTexture("gtceu:textures/gui/progress_bar/progress_bar_macerate.png"); - public static final SteamTexture PROGRESS_BAR_MACERATE_STEAM = SteamTexture.fullImage("gtceu:textures/gui/progress_bar/progress_bar_macerate_%s.png"); - public static final ResourceTexture PROGRESS_BAR_MAGNET = new ResourceTexture("gtceu:textures/gui/progress_bar/progress_bar_magnet.png"); - public static final ResourceTexture PROGRESS_BAR_MASS_FAB = new ResourceTexture("gtceu:textures/gui/progress_bar/progress_bar_mass_fab.png"); - public static final ResourceTexture PROGRESS_BAR_MIXER = new ResourceTexture("gtceu:textures/gui/progress_bar/progress_bar_mixer.png"); - public static final ResourceTexture PROGRESS_BAR_PACKER = new ResourceTexture("gtceu:textures/gui/progress_bar/progress_bar_packer.png"); - public static final ResourceTexture PROGRESS_BAR_RECYCLER = new ResourceTexture("gtceu:textures/gui/progress_bar/progress_bar_recycler.png"); - public static final ResourceTexture PROGRESS_BAR_REPLICATOR = new ResourceTexture("gtceu:textures/gui/progress_bar/progress_bar_replicator.png"); - public static final ResourceTexture PROGRESS_BAR_SIFT = new ResourceTexture("gtceu:textures/gui/progress_bar/progress_bar_sift.png"); - public static final ResourceTexture PROGRESS_BAR_SLICE = new ResourceTexture("gtceu:textures/gui/progress_bar/progress_bar_slice.png"); - public static final SteamTexture PROGRESS_BAR_SOLAR_STEAM = SteamTexture.fullImage("gtceu:textures/gui/progress_bar/progress_bar_solar_%s.png"); - public static final ResourceTexture PROGRESS_BAR_UNLOCK = new ResourceTexture("gtceu:textures/gui/progress_bar/progress_bar_unlock.png"); - public static final ResourceTexture PROGRESS_BAR_UNPACKER = new ResourceTexture("gtceu:textures/gui/progress_bar/progress_bar_unpacker.png"); - public static final ResourceTexture PROGRESS_BAR_WIREMILL = new ResourceTexture("gtceu:textures/gui/progress_bar/progress_bar_wiremill.png"); - public static final ResourceTexture PROGRESS_BAR_RESEARCH_STATION_1 = new ResourceTexture("gtceu:textures/gui/progress_bar/progress_bar_research_station_1.png"); - public static final ResourceTexture PROGRESS_BAR_RESEARCH_STATION_2 = new ResourceTexture("gtceu:textures/gui/progress_bar/progress_bar_research_station_2.png"); - public static final ResourceTexture PROGRESS_BAR_RESEARCH_STATION_BASE = new ResourceTexture("gtceu:textures/gui/progress_bar/progress_bar_research_station_base.png"); + // PROGRESS BARS + public static final ResourceTexture PROGRESS_BAR_ARC_FURNACE = new ResourceTexture( + "gtceu:textures/gui/progress_bar/progress_bar_arc_furnace.png"); + public static final ResourceTexture PROGRESS_BAR_ARROW = new ResourceTexture( + "gtceu:textures/gui/progress_bar/progress_bar_arrow.png"); + public static final SteamTexture PROGRESS_BAR_ARROW_STEAM = SteamTexture + .fullImage("gtceu:textures/gui/progress_bar/progress_bar_arrow_%s.png"); + public static final ResourceTexture PROGRESS_BAR_ARROW_MULTIPLE = new ResourceTexture( + "gtceu:textures/gui/progress_bar/progress_bar_arrow_multiple.png"); + public static final ResourceTexture PROGRESS_BAR_ASSEMBLY_LINE = new ResourceTexture( + "gtceu:textures/gui/progress_bar/progress_bar_assembly_line.png"); + public static final ResourceTexture PROGRESS_BAR_ASSEMBLY_LINE_ARROW = new ResourceTexture( + "gtceu:textures/gui/progress_bar/progress_bar_assembly_line_arrow.png"); + public static final ResourceTexture PROGRESS_BAR_BATH = new ResourceTexture( + "gtceu:textures/gui/progress_bar/progress_bar_bath.png"); + public static final ResourceTexture PROGRESS_BAR_BENDING = new ResourceTexture( + "gtceu:textures/gui/progress_bar/progress_bar_bending.png"); + public static final SteamTexture PROGRESS_BAR_BOILER_EMPTY = SteamTexture + .fullImage("gtceu:textures/gui/progress_bar/progress_bar_boiler_empty_%s.png"); + public static final SteamTexture PROGRESS_BAR_BOILER_FUEL = SteamTexture + .fullImage("gtceu:textures/gui/progress_bar/progress_bar_boiler_fuel_%s.png"); + public static final ResourceTexture PROGRESS_BAR_BOILER_HEAT = new ResourceTexture( + "gtceu:textures/gui/progress_bar/progress_bar_boiler_heat.png"); + public static final ResourceTexture PROGRESS_BAR_CANNER = new ResourceTexture( + "gtceu:textures/gui/progress_bar/progress_bar_canner.png"); + public static final ResourceTexture PROGRESS_BAR_CIRCUIT = new ResourceTexture( + "gtceu:textures/gui/progress_bar/progress_bar_circuit.png"); + public static final ResourceTexture PROGRESS_BAR_CIRCUIT_ASSEMBLER = new ResourceTexture( + "gtceu:textures/gui/progress_bar/progress_bar_circuit_assembler.png"); + public static final ResourceTexture PROGRESS_BAR_COKE_OVEN = new ResourceTexture( + "gtceu:textures/gui/progress_bar/progress_bar_coke_oven.png"); + public static final ResourceTexture PROGRESS_BAR_COMPRESS = new ResourceTexture( + "gtceu:textures/gui/progress_bar/progress_bar_compress.png"); + public static final SteamTexture PROGRESS_BAR_COMPRESS_STEAM = SteamTexture + .fullImage("gtceu:textures/gui/progress_bar/progress_bar_compress_%s.png"); + public static final ResourceTexture PROGRESS_BAR_CRACKING = new ResourceTexture( + "gtceu:textures/gui/progress_bar/progress_bar_cracking.png"); + public static final ResourceTexture PROGRESS_BAR_CRACKING_INPUT = new ResourceTexture( + "gtceu:textures/gui/progress_bar/progress_bar_cracking_2.png"); + public static final ResourceTexture PROGRESS_BAR_CRYSTALLIZATION = new ResourceTexture( + "gtceu:textures/gui/progress_bar/progress_bar_crystallization.png"); + public static final ResourceTexture PROGRESS_BAR_DISTILLATION_TOWER = new ResourceTexture( + "gtceu:textures/gui/progress_bar/progress_bar_distillation_tower.png"); + public static final ResourceTexture PROGRESS_BAR_EXTRACT = new ResourceTexture( + "gtceu:textures/gui/progress_bar/progress_bar_extract.png"); + public static final SteamTexture PROGRESS_BAR_EXTRACT_STEAM = SteamTexture + .fullImage("gtceu:textures/gui/progress_bar/progress_bar_extract_%s.png"); + public static final ResourceTexture PROGRESS_BAR_EXTRUDER = new ResourceTexture( + "gtceu:textures/gui/progress_bar/progress_bar_extruder.png"); + public static final ResourceTexture PROGRESS_BAR_FUSION = new ResourceTexture( + "gtceu:textures/gui/progress_bar/progress_bar_fusion.png"); + public static final ResourceTexture PROGRESS_BAR_GAS_COLLECTOR = new ResourceTexture( + "gtceu:textures/gui/progress_bar/progress_bar_gas_collector.png"); + public static final ResourceTexture PROGRESS_BAR_HAMMER = new ResourceTexture( + "gtceu:textures/gui/progress_bar/progress_bar_hammer.png"); + public static final SteamTexture PROGRESS_BAR_HAMMER_STEAM = SteamTexture + .fullImage("gtceu:textures/gui/progress_bar/progress_bar_hammer_%s.png"); + public static final ResourceTexture PROGRESS_BAR_HAMMER_BASE = new ResourceTexture( + "gtceu:textures/gui/progress_bar/progress_bar_hammer_base.png"); + public static final SteamTexture PROGRESS_BAR_HAMMER_BASE_STEAM = SteamTexture + .fullImage("gtceu:textures/gui/progress_bar/progress_bar_hammer_base_%s.png"); + public static final ResourceTexture PROGRESS_BAR_LATHE = new ResourceTexture( + "gtceu:textures/gui/progress_bar/progress_bar_lathe.png"); + public static final ResourceTexture PROGRESS_BAR_LATHE_BASE = new ResourceTexture( + "gtceu:textures/gui/progress_bar/progress_bar_lathe_base.png"); + public static final ResourceTexture PROGRESS_BAR_MACERATE = new ResourceTexture( + "gtceu:textures/gui/progress_bar/progress_bar_macerate.png"); + public static final SteamTexture PROGRESS_BAR_MACERATE_STEAM = SteamTexture + .fullImage("gtceu:textures/gui/progress_bar/progress_bar_macerate_%s.png"); + public static final ResourceTexture PROGRESS_BAR_MAGNET = new ResourceTexture( + "gtceu:textures/gui/progress_bar/progress_bar_magnet.png"); + public static final ResourceTexture PROGRESS_BAR_MASS_FAB = new ResourceTexture( + "gtceu:textures/gui/progress_bar/progress_bar_mass_fab.png"); + public static final ResourceTexture PROGRESS_BAR_MIXER = new ResourceTexture( + "gtceu:textures/gui/progress_bar/progress_bar_mixer.png"); + public static final ResourceTexture PROGRESS_BAR_PACKER = new ResourceTexture( + "gtceu:textures/gui/progress_bar/progress_bar_packer.png"); + public static final ResourceTexture PROGRESS_BAR_RECYCLER = new ResourceTexture( + "gtceu:textures/gui/progress_bar/progress_bar_recycler.png"); + public static final ResourceTexture PROGRESS_BAR_REPLICATOR = new ResourceTexture( + "gtceu:textures/gui/progress_bar/progress_bar_replicator.png"); + public static final ResourceTexture PROGRESS_BAR_SIFT = new ResourceTexture( + "gtceu:textures/gui/progress_bar/progress_bar_sift.png"); + public static final ResourceTexture PROGRESS_BAR_SLICE = new ResourceTexture( + "gtceu:textures/gui/progress_bar/progress_bar_slice.png"); + public static final SteamTexture PROGRESS_BAR_SOLAR_STEAM = SteamTexture + .fullImage("gtceu:textures/gui/progress_bar/progress_bar_solar_%s.png"); + public static final ResourceTexture PROGRESS_BAR_UNLOCK = new ResourceTexture( + "gtceu:textures/gui/progress_bar/progress_bar_unlock.png"); + public static final ResourceTexture PROGRESS_BAR_UNPACKER = new ResourceTexture( + "gtceu:textures/gui/progress_bar/progress_bar_unpacker.png"); + public static final ResourceTexture PROGRESS_BAR_WIREMILL = new ResourceTexture( + "gtceu:textures/gui/progress_bar/progress_bar_wiremill.png"); + public static final ResourceTexture PROGRESS_BAR_RESEARCH_STATION_1 = new ResourceTexture( + "gtceu:textures/gui/progress_bar/progress_bar_research_station_1.png"); + public static final ResourceTexture PROGRESS_BAR_RESEARCH_STATION_2 = new ResourceTexture( + "gtceu:textures/gui/progress_bar/progress_bar_research_station_2.png"); + public static final ResourceTexture PROGRESS_BAR_RESEARCH_STATION_BASE = new ResourceTexture( + "gtceu:textures/gui/progress_bar/progress_bar_research_station_base.png"); - //JEI + // JEI public static final ResourceTexture INFO_ICON = new ResourceTexture("gtceu:textures/gui/widget/information.png"); - public static final ResourceTexture MULTIBLOCK_CATEGORY = new ResourceTexture("gtceu:textures/gui/icon/coke_oven.png"); + public static final ResourceTexture MULTIBLOCK_CATEGORY = new ResourceTexture( + "gtceu:textures/gui/icon/coke_oven.png"); // Covers - public static final ResourceTexture COVER_MACHINE_CONTROLLER = new ResourceTexture("gtceu:textures/items/metaitems/cover.controller.png"); + public static final ResourceTexture COVER_MACHINE_CONTROLLER = new ResourceTexture( + "gtceu:textures/items/metaitems/cover.controller.png"); - //Terminal - public static final ResourceTexture ICON_REMOVE = new ResourceTexture("gtceu:textures/gui/terminal/icon/remove_hover.png"); + // Terminal + public static final ResourceTexture ICON_REMOVE = new ResourceTexture( + "gtceu:textures/gui/terminal/icon/remove_hover.png"); public static final ResourceTexture ICON_UP = new ResourceTexture("gtceu:textures/gui/terminal/icon/up_hover.png"); - public static final ResourceTexture ICON_DOWN = new ResourceTexture("gtceu:textures/gui/terminal/icon/down_hover.png"); - public static final ResourceTexture ICON_RIGHT = new ResourceTexture("gtceu:textures/gui/terminal/icon/right_hover.png"); - public static final ResourceTexture ICON_LEFT = new ResourceTexture("gtceu:textures/gui/terminal/icon/left_hover.png"); - public static final ResourceTexture ICON_ADD = new ResourceTexture("gtceu:textures/gui/terminal/icon/add_hover.png"); + public static final ResourceTexture ICON_DOWN = new ResourceTexture( + "gtceu:textures/gui/terminal/icon/down_hover.png"); + public static final ResourceTexture ICON_RIGHT = new ResourceTexture( + "gtceu:textures/gui/terminal/icon/right_hover.png"); + public static final ResourceTexture ICON_LEFT = new ResourceTexture( + "gtceu:textures/gui/terminal/icon/left_hover.png"); + public static final ResourceTexture ICON_ADD = new ResourceTexture( + "gtceu:textures/gui/terminal/icon/add_hover.png"); - public static final ResourceTexture ICON_NEW_PAGE = new ResourceTexture("gtceu:textures/gui/terminal/icon/system/memory_card_hover.png"); - public static final ResourceTexture ICON_LOAD = new ResourceTexture("gtceu:textures/gui/terminal/icon/folder_hover.png"); - public static final ResourceTexture ICON_SAVE = new ResourceTexture("gtceu:textures/gui/terminal/icon/system/save_hover.png"); - public static final ResourceTexture ICON_LOCATION = new ResourceTexture("gtceu:textures/gui/terminal/icon/guide_hover.png"); - public static final ResourceTexture ICON_VISIBLE = new ResourceTexture("gtceu:textures/gui/terminal/icon/appearance_hover.png"); - public static final ResourceTexture ICON_CALCULATOR = new ResourceTexture("gtceu:textures/gui/terminal/icon/calculator_hover.png"); - public static final ResourceTexture UI_FRAME_SIDE_UP = new ResourceTexture("gtceu:textures/gui/terminal/frame_side_up.png"); - public static final ResourceTexture UI_FRAME_SIDE_DOWN = new ResourceTexture("gtceu:textures/gui/terminal/frame_side_down.png"); + public static final ResourceTexture ICON_NEW_PAGE = new ResourceTexture( + "gtceu:textures/gui/terminal/icon/system/memory_card_hover.png"); + public static final ResourceTexture ICON_LOAD = new ResourceTexture( + "gtceu:textures/gui/terminal/icon/folder_hover.png"); + public static final ResourceTexture ICON_SAVE = new ResourceTexture( + "gtceu:textures/gui/terminal/icon/system/save_hover.png"); + public static final ResourceTexture ICON_LOCATION = new ResourceTexture( + "gtceu:textures/gui/terminal/icon/guide_hover.png"); + public static final ResourceTexture ICON_VISIBLE = new ResourceTexture( + "gtceu:textures/gui/terminal/icon/appearance_hover.png"); + public static final ResourceTexture ICON_CALCULATOR = new ResourceTexture( + "gtceu:textures/gui/terminal/icon/calculator_hover.png"); + public static final ResourceTexture UI_FRAME_SIDE_UP = new ResourceTexture( + "gtceu:textures/gui/terminal/frame_side_up.png"); + public static final ResourceTexture UI_FRAME_SIDE_DOWN = new ResourceTexture( + "gtceu:textures/gui/terminal/frame_side_down.png"); // Texture Areas - public static final ResourceTexture BUTTON_FLUID = new ResourceTexture("gtceu:textures/block/cover/cover_interface_fluid_button.png"); - public static final ResourceTexture BUTTON_ITEM = new ResourceTexture("gtceu:textures/block/cover/cover_interface_item_button.png"); - public static final ResourceTexture BUTTON_ENERGY = new ResourceTexture("gtceu:textures/block/cover/cover_interface_energy_button.png"); - public static final ResourceTexture BUTTON_MACHINE = new ResourceTexture("gtceu:textures/block/cover/cover_interface_machine_button.png"); - public static final ResourceTexture BUTTON_INTERFACE = new ResourceTexture("gtceu:textures/block/cover/cover_interface_computer_button.png"); - public static final ResourceTexture COVER_INTERFACE_MACHINE_ON_PROXY = new ResourceTexture("gtceu:textures/block/cover/cover_interface_machine_on_proxy.png"); - public static final ResourceTexture COVER_INTERFACE_MACHINE_OFF_PROXY = new ResourceTexture("gtceu:textures/blocks/cover/cover_interface_machine_off_proxy.png"); + public static final ResourceTexture BUTTON_FLUID = new ResourceTexture( + "gtceu:textures/block/cover/cover_interface_fluid_button.png"); + public static final ResourceTexture BUTTON_ITEM = new ResourceTexture( + "gtceu:textures/block/cover/cover_interface_item_button.png"); + public static final ResourceTexture BUTTON_ENERGY = new ResourceTexture( + "gtceu:textures/block/cover/cover_interface_energy_button.png"); + public static final ResourceTexture BUTTON_MACHINE = new ResourceTexture( + "gtceu:textures/block/cover/cover_interface_machine_button.png"); + public static final ResourceTexture BUTTON_INTERFACE = new ResourceTexture( + "gtceu:textures/block/cover/cover_interface_computer_button.png"); + public static final ResourceTexture COVER_INTERFACE_MACHINE_ON_PROXY = new ResourceTexture( + "gtceu:textures/block/cover/cover_interface_machine_on_proxy.png"); + public static final ResourceTexture COVER_INTERFACE_MACHINE_OFF_PROXY = new ResourceTexture( + "gtceu:textures/blocks/cover/cover_interface_machine_off_proxy.png"); public static final ResourceTexture SCENE = new ResourceTexture("gtceu:textures/gui/widget/scene.png"); - public static final ResourceBorderTexture DISPLAY_FRAME = new ResourceBorderTexture("gtceu:textures/gui/base/display_frame.png", 16, 16, 4, 4); - public static final ResourceTexture INSUFFICIENT_INPUT = new ResourceTexture("gtceu:textures/gui/base/indicator_no_energy.png"); - public static final ResourceBorderTexture ENERGY_BAR_BACKGROUND = new ResourceBorderTexture("gtceu:textures/gui/progress_bar/progress_bar_boiler_empty_steel.png", 10, 54, 1, 1); - public static final ResourceBorderTexture ENERGY_BAR_BASE = new ResourceBorderTexture("gtceu:textures/gui/progress_bar/progress_bar_boiler_heat.png", 10, 54, 1, 1); + public static final ResourceBorderTexture DISPLAY_FRAME = new ResourceBorderTexture( + "gtceu:textures/gui/base/display_frame.png", 16, 16, 4, 4); + public static final ResourceTexture INSUFFICIENT_INPUT = new ResourceTexture( + "gtceu:textures/gui/base/indicator_no_energy.png"); + public static final ResourceBorderTexture ENERGY_BAR_BACKGROUND = new ResourceBorderTexture( + "gtceu:textures/gui/progress_bar/progress_bar_boiler_empty_steel.png", 10, 54, 1, 1); + public static final ResourceBorderTexture ENERGY_BAR_BASE = new ResourceBorderTexture( + "gtceu:textures/gui/progress_bar/progress_bar_boiler_heat.png", 10, 54, 1, 1); public static final ResourceTexture LIGHT_ON = new ResourceTexture("gtceu:textures/gui/widget/light_on.png"); public static final ResourceTexture LIGHT_OFF = new ResourceTexture("gtceu:textures/gui/widget/light_off.png"); public static final ResourceTexture UP = new ResourceTexture("gtceu:textures/gui/base/up.png"); @@ -307,24 +538,37 @@ public class GuiTextures { static { val offset = 1f / TIER.length; for (int i = 0; i < TIER.length; i++) { - TIER[i] = new ResourceTexture("gtceu:textures/gui/overlay/tier.png").getSubTexture(0, i * offset, 1, offset); + TIER[i] = new ResourceTexture("gtceu:textures/gui/overlay/tier.png").getSubTexture(0, i * offset, 1, + offset); } } // ME hatch/bus - public static final ResourceTexture NUMBER_BACKGROUND = new ResourceTexture("gtceu:textures/gui/widget/number_background.png"); - public static final ResourceTexture CONFIG_ARROW = new ResourceTexture("gtceu:textures/gui/widget/config_arrow.png"); - public static final ResourceTexture CONFIG_ARROW_DARK = new ResourceTexture("gtceu:textures/gui/widget/config_arrow_dark.png"); + public static final ResourceTexture NUMBER_BACKGROUND = new ResourceTexture( + "gtceu:textures/gui/widget/number_background.png"); + public static final ResourceTexture CONFIG_ARROW = new ResourceTexture( + "gtceu:textures/gui/widget/config_arrow.png"); + public static final ResourceTexture CONFIG_ARROW_DARK = new ResourceTexture( + "gtceu:textures/gui/widget/config_arrow_dark.png"); public static final ResourceTexture SELECT_BOX = new ResourceTexture("gtceu:textures/gui/widget/select_box.png"); // HPCA Component icons - public static final ResourceTexture HPCA_COMPONENT_OUTLINE = new ResourceTexture("gtceu:textures/gui/widget/hpca/component_outline.png"); - public static final ResourceTexture HPCA_ICON_EMPTY_COMPONENT = new ResourceTexture("gtceu:textures/gui/widget/hpca/empty_component.png"); - public static final ResourceTexture HPCA_ICON_ADVANCED_COMPUTATION_COMPONENT = new ResourceTexture("gtceu:textures/gui/widget/hpca/advanced_computation_component.png"); - public static final ResourceTexture HPCA_ICON_BRIDGE_COMPONENT = new ResourceTexture("gtceu:textures/gui/widget/hpca/bridge_component.png"); - public static final ResourceTexture HPCA_ICON_COMPUTATION_COMPONENT = new ResourceTexture("gtceu:textures/gui/widget/hpca/computation_component.png"); - public static final ResourceTexture HPCA_ICON_ACTIVE_COOLER_COMPONENT = new ResourceTexture("gtceu:textures/gui/widget/hpca/active_cooler_component.png"); - public static final ResourceTexture HPCA_ICON_HEAT_SINK_COMPONENT = new ResourceTexture("gtceu:textures/gui/widget/hpca/heat_sink_component.png"); - public static final ResourceTexture HPCA_ICON_DAMAGED_ADVANCED_COMPUTATION_COMPONENT = new ResourceTexture("gtceu:textures/gui/widget/hpca/damaged_advanced_computation_component.png"); - public static final ResourceTexture HPCA_ICON_DAMAGED_COMPUTATION_COMPONENT = new ResourceTexture("gtceu:textures/gui/widget/hpca/damaged_computation_component.png"); + public static final ResourceTexture HPCA_COMPONENT_OUTLINE = new ResourceTexture( + "gtceu:textures/gui/widget/hpca/component_outline.png"); + public static final ResourceTexture HPCA_ICON_EMPTY_COMPONENT = new ResourceTexture( + "gtceu:textures/gui/widget/hpca/empty_component.png"); + public static final ResourceTexture HPCA_ICON_ADVANCED_COMPUTATION_COMPONENT = new ResourceTexture( + "gtceu:textures/gui/widget/hpca/advanced_computation_component.png"); + public static final ResourceTexture HPCA_ICON_BRIDGE_COMPONENT = new ResourceTexture( + "gtceu:textures/gui/widget/hpca/bridge_component.png"); + public static final ResourceTexture HPCA_ICON_COMPUTATION_COMPONENT = new ResourceTexture( + "gtceu:textures/gui/widget/hpca/computation_component.png"); + public static final ResourceTexture HPCA_ICON_ACTIVE_COOLER_COMPONENT = new ResourceTexture( + "gtceu:textures/gui/widget/hpca/active_cooler_component.png"); + public static final ResourceTexture HPCA_ICON_HEAT_SINK_COMPONENT = new ResourceTexture( + "gtceu:textures/gui/widget/hpca/heat_sink_component.png"); + public static final ResourceTexture HPCA_ICON_DAMAGED_ADVANCED_COMPUTATION_COMPONENT = new ResourceTexture( + "gtceu:textures/gui/widget/hpca/damaged_advanced_computation_component.png"); + public static final ResourceTexture HPCA_ICON_DAMAGED_COMPUTATION_COMPONENT = new ResourceTexture( + "gtceu:textures/gui/widget/hpca/damaged_computation_component.png"); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/SteamTexture.java b/src/main/java/com/gregtechceu/gtceu/api/gui/SteamTexture.java index 41f2a09b43..7b3e89070f 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/SteamTexture.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/SteamTexture.java @@ -8,6 +8,7 @@ * @implNote SteamTexture */ public class SteamTexture { + private static final String BRONZE = "bronze"; private static final String STEEL = "steel"; @@ -22,11 +23,10 @@ private SteamTexture(ResourceTexture bronzeTexture, ResourceTexture steelTexture public static SteamTexture fullImage(String path) { return new SteamTexture( new ResourceTexture(String.format(path, BRONZE)), - new ResourceTexture(String.format(path, STEEL)) - ); + new ResourceTexture(String.format(path, STEEL))); } public ResourceTexture get(boolean isHighPressure) { - return isHighPressure ? steelTexture : bronzeTexture; + return isHighPressure ? steelTexture : bronzeTexture; } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/UITemplate.java b/src/main/java/com/gregtechceu/gtceu/api/gui/UITemplate.java index 5a0e28912f..0a9d13c631 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/UITemplate.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/UITemplate.java @@ -3,6 +3,7 @@ import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.widget.SlotWidget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; + import net.minecraft.world.entity.player.Inventory; /** @@ -11,7 +12,9 @@ * @implNote UITemplate */ public class UITemplate { - public static WidgetGroup bindPlayerInventory(Inventory inventoryPlayer, IGuiTexture imageLocation, int x, int y, boolean addHotbar) { + + public static WidgetGroup bindPlayerInventory(Inventory inventoryPlayer, IGuiTexture imageLocation, int x, int y, + boolean addHotbar) { WidgetGroup group = new WidgetGroup(x, y, 162, 54 + (addHotbar ? 22 : 0)); for (int row = 0; row < 3; row++) { for (int col = 0; col < 9; col++) { @@ -29,5 +32,4 @@ public static WidgetGroup bindPlayerInventory(Inventory inventoryPlayer, IGuiTex } return group; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/WidgetUtils.java b/src/main/java/com/gregtechceu/gtceu/api/gui/WidgetUtils.java index acf5c1d923..07259f0db7 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/WidgetUtils.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/WidgetUtils.java @@ -2,6 +2,7 @@ import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; + import org.jetbrains.annotations.Nullable; import java.util.List; @@ -14,6 +15,7 @@ * @implNote WidgetUtils */ public class WidgetUtils { + public static List getWidgetsById(WidgetGroup group, String regex) { return group.getWidgetsById(Pattern.compile(regex)); } @@ -27,7 +29,8 @@ public static void widgetByIdForEach(WidgetGroup group, String regex, Consumer void widgetByIdForEach(WidgetGroup group, String regex, Class clazz, Consumer consumer) { + public static void widgetByIdForEach(WidgetGroup group, String regex, Class clazz, + Consumer consumer) { for (Widget widget : getWidgetsById(group, regex)) { if (clazz.isInstance(widget)) { consumer.accept(clazz.cast(widget)); diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/compass/GTCompassUIConfig.java b/src/main/java/com/gregtechceu/gtceu/api/gui/compass/GTCompassUIConfig.java index 7f86dcd7ac..aaf1d19e13 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/compass/GTCompassUIConfig.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/compass/GTCompassUIConfig.java @@ -1,53 +1,58 @@ package com.gregtechceu.gtceu.api.gui.compass; -import com.google.common.base.Suppliers; import com.gregtechceu.gtceu.GTCEu; + import com.lowdragmc.lowdraglib.gui.compass.ICompassUIConfig; import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.texture.ResourceBorderTexture; import com.lowdragmc.lowdraglib.gui.texture.ShaderTexture; -import com.mojang.blaze3d.systems.RenderSystem; -import lombok.Getter; -import net.minecraft.Util; + import net.minecraft.client.Minecraft; import net.minecraft.world.inventory.InventoryMenu; + +import com.google.common.base.Suppliers; +import com.mojang.blaze3d.systems.RenderSystem; +import lombok.Getter; import org.jetbrains.annotations.NotNull; import org.lwjgl.opengl.GL13; import java.util.function.Supplier; public class GTCompassUIConfig implements ICompassUIConfig { + @Getter private final IGuiTexture listViewBackground = ResourceBorderTexture.BORDERED_BACKGROUND_INVERSE; @Getter private final IGuiTexture listItemBackground = ResourceBorderTexture.BUTTON_COMMON; @Getter - private final IGuiTexture listItemSelectedBackground = ResourceBorderTexture.BUTTON_COMMON.copy().setColor(0xff337f7f); + private final IGuiTexture listItemSelectedBackground = ResourceBorderTexture.BUTTON_COMMON.copy() + .setColor(0xff337f7f); @Getter private final IGuiTexture nodeBackground = ResourceBorderTexture.BUTTON_COMMON; @Getter private final IGuiTexture nodeHoverBackground = ResourceBorderTexture.BUTTON_COMMON.copy().setColor(0xff337f7f); - private final Supplier sectionBackground = Suppliers.memoize(() -> ShaderTexture.createShader(GTCEu.id("compass_background")).setUniformCache(cache -> { - // bind uvs - var atlas = Minecraft.getInstance().getTextureAtlas(InventoryMenu.BLOCK_ATLAS); - var base = atlas.apply(GTCEu.id("block/casings/voltage/lv/side")); - var top = atlas.apply(GTCEu.id("block/machines/distillery/overlay_top_active")); - var front = atlas.apply(GTCEu.id("block/machines/distillery/overlay_front_active")); - var back = atlas.apply(GTCEu.id("block/overlay/machine/overlay_fluid_output")); - var side = atlas.apply(GTCEu.id("block/machines/distillery/overlay_side_active")); - - cache.glUniform4F("baseTexture", base.getU0(), base.getV0(), base.getU1(), base.getV1()); - cache.glUniform4F("topTexture", top.getU0(), top.getV0(), top.getU1(), top.getV1()); - cache.glUniform4F("frontTexture", front.getU0(), front.getV0(), front.getU1(), front.getV1()); - cache.glUniform4F("backTexture", back.getU0(), back.getV0(), back.getU1(), back.getV1()); - cache.glUniform4F("sideTexture", side.getU0(), side.getV0(), side.getU1(), side.getV1()); - - - // bind BLOCK_ATLAS - RenderSystem.activeTexture(GL13.GL_TEXTURE0); - RenderSystem.bindTexture(Minecraft.getInstance().getTextureManager().getTexture(InventoryMenu.BLOCK_ATLAS).getId()); - cache.glUniform1I("BLOCK_ATLAS", 0); - })); + private final Supplier sectionBackground = Suppliers + .memoize(() -> ShaderTexture.createShader(GTCEu.id("compass_background")).setUniformCache(cache -> { + // bind uvs + var atlas = Minecraft.getInstance().getTextureAtlas(InventoryMenu.BLOCK_ATLAS); + var base = atlas.apply(GTCEu.id("block/casings/voltage/lv/side")); + var top = atlas.apply(GTCEu.id("block/machines/distillery/overlay_top_active")); + var front = atlas.apply(GTCEu.id("block/machines/distillery/overlay_front_active")); + var back = atlas.apply(GTCEu.id("block/overlay/machine/overlay_fluid_output")); + var side = atlas.apply(GTCEu.id("block/machines/distillery/overlay_side_active")); + + cache.glUniform4F("baseTexture", base.getU0(), base.getV0(), base.getU1(), base.getV1()); + cache.glUniform4F("topTexture", top.getU0(), top.getV0(), top.getU1(), top.getV1()); + cache.glUniform4F("frontTexture", front.getU0(), front.getV0(), front.getU1(), front.getV1()); + cache.glUniform4F("backTexture", back.getU0(), back.getV0(), back.getU1(), back.getV1()); + cache.glUniform4F("sideTexture", side.getU0(), side.getV0(), side.getU1(), side.getV1()); + + // bind BLOCK_ATLAS + RenderSystem.activeTexture(GL13.GL_TEXTURE0); + RenderSystem.bindTexture( + Minecraft.getInstance().getTextureManager().getTexture(InventoryMenu.BLOCK_ATLAS).getId()); + cache.glUniform1I("BLOCK_ATLAS", 0); + })); @NotNull @Override diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/compass/GTRecipeViewCreator.java b/src/main/java/com/gregtechceu/gtceu/api/gui/compass/GTRecipeViewCreator.java index b73effcb01..e93513d83d 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/compass/GTRecipeViewCreator.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/compass/GTRecipeViewCreator.java @@ -3,8 +3,10 @@ import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.integration.GTRecipeWidget; + import com.lowdragmc.lowdraglib.gui.compass.component.RecipeComponent; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; + import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.item.crafting.Recipe; @@ -15,6 +17,7 @@ * @implNote GTRecipeViewCreator */ public class GTRecipeViewCreator implements RecipeComponent.RecipeViewCreator { + @Override public ItemStack getWorkstation(Recipe recipe) { if (recipe instanceof GTRecipe gtRecipe) { diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/compass/MultiblockAction.java b/src/main/java/com/gregtechceu/gtceu/api/gui/compass/MultiblockAction.java index fd5d2f1c86..eb62f0c984 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/compass/MultiblockAction.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/compass/MultiblockAction.java @@ -5,24 +5,28 @@ import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiController; import com.gregtechceu.gtceu.api.pattern.MultiblockShapeInfo; import com.gregtechceu.gtceu.api.registry.GTRegistries; + import com.lowdragmc.lowdraglib.gui.compass.component.animation.Action; import com.lowdragmc.lowdraglib.gui.compass.component.animation.AnimationFrame; import com.lowdragmc.lowdraglib.gui.compass.component.animation.BlockAnima; import com.lowdragmc.lowdraglib.gui.compass.component.animation.CompassScene; import com.lowdragmc.lowdraglib.utils.BlockInfo; import com.lowdragmc.lowdraglib.utils.XmlUtils; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.Vec3; -import org.w3c.dom.Element; import org.jetbrains.annotations.Nullable; +import org.w3c.dom.Element; + import java.util.HashMap; import java.util.Map; public class MultiblockAction extends Action { + private final BlockAnima animation; @Nullable private final MultiblockMachineDefinition machineDefinition; @@ -36,7 +40,8 @@ public MultiblockAction(Element element) { shapeIndex = XmlUtils.getAsInt(element, "shape-index", 0); facing = XmlUtils.getAsEnum(element, "facing", Direction.class, Direction.NORTH); isFormed = XmlUtils.getAsBoolean(element, "formed", true); - animation = new BlockAnima(blockPos, XmlUtils.getAsVec3(element, "offset", new Vec3(0, 0.7, 0)), XmlUtils.getAsInt(element, "duration", 15)); + animation = new BlockAnima(blockPos, XmlUtils.getAsVec3(element, "offset", new Vec3(0, 0.7, 0)), + XmlUtils.getAsInt(element, "duration", 15)); if (ResourceLocation.isValidResourceLocation(machineName)) { var definition = GTRegistries.MACHINES.get(new ResourceLocation(machineName)); if (definition instanceof MultiblockMachineDefinition multiblockDefinition) { @@ -71,8 +76,8 @@ public void performAction(AnimationFrame frame, CompassScene scene, boolean anim for (int z = 0; z < column.length; z++) { BlockState blockState = column[z].getBlockState(); BlockPos pos = animation.pos().offset(x, y, z); - if (column[z].getBlockEntity(pos) instanceof IMachineBlockEntity holder - && holder.getMetaMachine() instanceof IMultiController) { + if (column[z].getBlockEntity(pos) instanceof IMachineBlockEntity holder && + holder.getMetaMachine() instanceof IMultiController) { offset = pos; } blockMap.put(pos, BlockInfo.fromBlockState(blockState)); @@ -80,7 +85,8 @@ public void performAction(AnimationFrame frame, CompassScene scene, boolean anim } } BlockPos finalOffset = offset; - blockMap.forEach((pos, blockInfo) -> scene.addBlock(pos.subtract(finalOffset).offset(animation.pos()), blockInfo, anima ? animation : null)); + blockMap.forEach((pos, blockInfo) -> scene.addBlock(pos.subtract(finalOffset).offset(animation.pos()), + blockInfo, anima ? animation : null)); } } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/editor/EditableMachineUI.java b/src/main/java/com/gregtechceu/gtceu/api/gui/editor/EditableMachineUI.java index 990377ece5..98d767a451 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/editor/EditableMachineUI.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/editor/EditableMachineUI.java @@ -1,13 +1,14 @@ package com.gregtechceu.gtceu.api.gui.editor; import com.gregtechceu.gtceu.api.machine.MetaMachine; + import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.Platform; import com.lowdragmc.lowdraglib.gui.editor.configurator.IConfigurableWidget; import com.lowdragmc.lowdraglib.gui.editor.data.Resources; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.utils.Position; -import lombok.Getter; + import net.minecraft.client.Minecraft; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.NbtAccounter; @@ -15,7 +16,9 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.resources.ResourceManager; +import lombok.Getter; import org.jetbrains.annotations.Nullable; + import java.io.DataInputStream; import java.io.InputStream; import java.util.function.BiConsumer; @@ -27,6 +30,7 @@ * @implNote EditableMachineUI */ public class EditableMachineUI implements IEditableUI { + @Getter final String groupName; @Getter @@ -36,7 +40,8 @@ public class EditableMachineUI implements IEditableUI @Nullable private CompoundTag customUICache; - public EditableMachineUI(String groupName, ResourceLocation uiPath, Supplier widgetSupplier, BiConsumer binder) { + public EditableMachineUI(String groupName, ResourceLocation uiPath, Supplier widgetSupplier, + BiConsumer binder) { this.groupName = groupName; this.uiPath = uiPath; this.widgetSupplier = widgetSupplier; @@ -52,7 +57,7 @@ public void setupUI(WidgetGroup template, MetaMachine machine) { } ////////////////////////////////////// - //******** GUI *********// + // ******** GUI *********// ////////////////////////////////////// @Nullable @@ -60,7 +65,8 @@ public WidgetGroup createCustomUI() { if (hasCustomUI()) { var nbt = getCustomUI(); var group = new WidgetGroup(); - IConfigurableWidget.deserializeNBT(group, nbt.getCompound("root"), Resources.fromNBT(nbt.getCompound("resources")), false); + IConfigurableWidget.deserializeNBT(group, nbt.getCompound("root"), + Resources.fromNBT(nbt.getCompound("resources")), false); group.setSelfPosition(new Position(0, 0)); return group; } @@ -79,9 +85,10 @@ public CompoundTag getCustomUI() { this.customUICache = new CompoundTag(); } else { try { - var resource = resourceManager.getResourceOrThrow(new ResourceLocation(uiPath.getNamespace(), "ui/machine/%s.mui".formatted(uiPath.getPath()))); - try (InputStream inputStream = resource.open()){ - try (DataInputStream dataInputStream = new DataInputStream(inputStream);){ + var resource = resourceManager.getResourceOrThrow(new ResourceLocation(uiPath.getNamespace(), + "ui/machine/%s.mui".formatted(uiPath.getPath()))); + try (InputStream inputStream = resource.open()) { + try (DataInputStream dataInputStream = new DataInputStream(inputStream);) { this.customUICache = NbtIo.read(dataInputStream, NbtAccounter.UNLIMITED); } } @@ -103,5 +110,4 @@ public boolean hasCustomUI() { public void reloadCustomUI() { this.customUICache = null; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/editor/EditableUI.java b/src/main/java/com/gregtechceu/gtceu/api/gui/editor/EditableUI.java index 7133646742..d3004e686c 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/editor/EditableUI.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/editor/EditableUI.java @@ -1,8 +1,10 @@ package com.gregtechceu.gtceu.api.gui.editor; import com.gregtechceu.gtceu.api.gui.WidgetUtils; + import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; + import lombok.Getter; import java.util.function.BiConsumer; @@ -14,6 +16,7 @@ * @implNote EditableUI */ public class EditableUI implements IEditableUI { + @Getter final String id; final Class clazz; @@ -36,7 +39,6 @@ public W createDefault() { } public void setupUI(WidgetGroup template, T instance) { - WidgetUtils.widgetByIdForEach(template, "^" + id +"$", clazz, w -> binder.accept(w, instance)); + WidgetUtils.widgetByIdForEach(template, "^" + id + "$", clazz, w -> binder.accept(w, instance)); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/editor/GTUIEditor.java b/src/main/java/com/gregtechceu/gtceu/api/gui/editor/GTUIEditor.java index 1416183ff8..d3f33db908 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/editor/GTUIEditor.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/editor/GTUIEditor.java @@ -11,6 +11,7 @@ */ @LDLRegister(name = "editor.gtceu", group = "editor") public class GTUIEditor extends UIEditor { + public GTUIEditor() { super(LDLib.location); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/editor/IEditableUI.java b/src/main/java/com/gregtechceu/gtceu/api/gui/editor/IEditableUI.java index 4dacd42c96..3b264950e1 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/editor/IEditableUI.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/editor/IEditableUI.java @@ -12,11 +12,13 @@ * @implNote IEditableUI */ public interface IEditableUI { + W createDefault(); void setupUI(WidgetGroup template, T instance); - record Normal(Supplier supplier, BiConsumer binder) implements IEditableUI { + record Normal(Supplier supplier, BiConsumer binder) + implements IEditableUI { @Override public A createDefault() { diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/editor/MachineUIProject.java b/src/main/java/com/gregtechceu/gtceu/api/gui/editor/MachineUIProject.java index 7ef2c0e007..0fa19919d5 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/editor/MachineUIProject.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/editor/MachineUIProject.java @@ -2,6 +2,7 @@ import com.gregtechceu.gtceu.api.machine.MachineDefinition; import com.gregtechceu.gtceu.api.registry.GTRegistries; + import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.gui.editor.ColorPattern; import com.lowdragmc.lowdraglib.gui.editor.Icons; @@ -17,12 +18,14 @@ import com.lowdragmc.lowdraglib.gui.widget.TabButton; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.utils.Position; -import lombok.Getter; + import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.NbtIo; import net.minecraft.resources.ResourceLocation; +import lombok.Getter; import org.jetbrains.annotations.Nullable; + import java.io.File; import java.io.IOException; import java.util.*; @@ -35,7 +38,8 @@ @LDLRegister(name = "mui", group = "editor.gtceu") public class MachineUIProject extends UIProject { - @Nullable @Getter + @Nullable + @Getter protected MachineDefinition machineDefinition; private MachineUIProject() { @@ -90,12 +94,15 @@ public void deserializeNBT(CompoundTag tag) { public void onLoad(Editor editor) { editor.getResourcePanel().loadResource(getResources(), false); editor.getTabPages().addTab(new TabButton(50, 16, 60, 14).setTexture( - new GuiTextureGroup(ColorPattern.T_GREEN.rectTexture().setBottomRadius(10).transform(0, 0.4f), new TextTexture("Main")), - new GuiTextureGroup(ColorPattern.T_RED.rectTexture().setBottomRadius(10).transform(0, 0.4f), new TextTexture("Main")) - ), new UIMainPanel(editor, root, machineDefinition == null ? null : machineDefinition.getDescriptionId())); + new GuiTextureGroup(ColorPattern.T_GREEN.rectTexture().setBottomRadius(10).transform(0, 0.4f), + new TextTexture("Main")), + new GuiTextureGroup(ColorPattern.T_RED.rectTexture().setBottomRadius(10).transform(0, 0.4f), + new TextTexture("Main"))), + new UIMainPanel(editor, root, machineDefinition == null ? null : machineDefinition.getDescriptionId())); for (WidgetToolBox.Default tab : WidgetToolBox.Default.TABS) { - editor.getToolPanel().addNewToolBox("ldlib.gui.editor.group." + tab.groupName, tab.icon, tab.createToolBox()); + editor.getToolPanel().addNewToolBox("ldlib.gui.editor.group." + tab.groupName, tab.icon, + tab.createToolBox()); } } @@ -108,7 +115,8 @@ public void attachMenu(Editor editor, String name, TreeBuilder.Menu menu) { menu.remove("ldlib.gui.editor.menu.save"); menu.leaf(Icons.SAVE, "ldlib.gui.editor.menu.save", () -> { var editableUI = machineDefinition.getEditableUI(); - var path = new File(LDLib.location, "assets/%s/ui/machine".formatted(editableUI.getUiPath().getNamespace())); + var path = new File(LDLib.location, + "assets/%s/ui/machine".formatted(editableUI.getUiPath().getNamespace())); path.mkdirs(); saveProject(new File(path, editableUI.getUiPath().getPath() + "." + this.getRegisterUI().name())); editableUI.reloadCustomUI(); @@ -134,7 +142,8 @@ public void attachMenu(Editor editor, String name, TreeBuilder.Menu menu) { deserializeNBT(editableUI.getCustomUI()); } else { var template = editableUI.createDefault(); - template.setSelfPosition(new Position(root.getSelfPosition().x, root.getSelfPosition().y)); + template.setSelfPosition( + new Position(root.getSelfPosition().x, root.getSelfPosition().y)); this.root = template; } setMachine(definition); diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/editor/RecipeTypeUIProject.java b/src/main/java/com/gregtechceu/gtceu/api/gui/editor/RecipeTypeUIProject.java index 9379ffa200..b944d918a0 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/editor/RecipeTypeUIProject.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/editor/RecipeTypeUIProject.java @@ -1,9 +1,8 @@ package com.gregtechceu.gtceu.api.gui.editor; -import com.gregtechceu.gtceu.api.capability.recipe.FluidRecipeCapability; -import com.gregtechceu.gtceu.api.capability.recipe.ItemRecipeCapability; import com.gregtechceu.gtceu.api.recipe.GTRecipeType; import com.gregtechceu.gtceu.api.registry.GTRegistries; + import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.gui.editor.ColorPattern; import com.lowdragmc.lowdraglib.gui.editor.Icons; @@ -18,14 +17,16 @@ import com.lowdragmc.lowdraglib.gui.widget.TabButton; import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; -import lombok.Getter; -import lombok.Setter; + import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.NbtIo; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Items; +import lombok.Getter; +import lombok.Setter; import org.jetbrains.annotations.Nullable; + import java.io.File; import java.io.IOException; import java.util.ArrayList; @@ -41,7 +42,9 @@ @LDLRegister(name = "rtui", group = "editor.gtceu") public class RecipeTypeUIProject extends UIProject { - @Nullable @Getter @Setter + @Nullable + @Getter + @Setter protected GTRecipeType recipeType; private RecipeTypeUIProject() { @@ -93,11 +96,14 @@ public void deserializeNBT(CompoundTag tag) { public void onLoad(Editor editor) { editor.getResourcePanel().loadResource(getResources(), false); editor.getTabPages().addTab(new TabButton(50, 16, 60, 14).setTexture( - new GuiTextureGroup(ColorPattern.T_GREEN.rectTexture().setBottomRadius(10).transform(0, 0.4f), new TextTexture("Main")), - new GuiTextureGroup(ColorPattern.T_RED.rectTexture().setBottomRadius(10).transform(0, 0.4f), new TextTexture("Main")) - ), new UIMainPanel(editor, root, recipeType == null ? null : recipeType.registryName.toLanguageKey())); + new GuiTextureGroup(ColorPattern.T_GREEN.rectTexture().setBottomRadius(10).transform(0, 0.4f), + new TextTexture("Main")), + new GuiTextureGroup(ColorPattern.T_RED.rectTexture().setBottomRadius(10).transform(0, 0.4f), + new TextTexture("Main"))), + new UIMainPanel(editor, root, recipeType == null ? null : recipeType.registryName.toLanguageKey())); for (WidgetToolBox.Default tab : WidgetToolBox.Default.TABS) { - editor.getToolPanel().addNewToolBox("ldlib.gui.editor.group." + tab.groupName, tab.icon, tab.createToolBox()); + editor.getToolPanel().addNewToolBox("ldlib.gui.editor.group." + tab.groupName, tab.icon, + tab.createToolBox()); } } @@ -109,7 +115,8 @@ public void attachMenu(Editor editor, String name, TreeBuilder.Menu menu) { } else { menu.remove("ldlib.gui.editor.menu.save"); menu.leaf(Icons.SAVE, "ldlib.gui.editor.menu.save", () -> { - var path = new File(LDLib.getLDLibDir(), "assets/%s/ui/recipe_type".formatted(recipeType.registryName.getNamespace())); + var path = new File(LDLib.getLDLibDir(), + "assets/%s/ui/recipe_type".formatted(recipeType.registryName.getNamespace())); path.mkdirs(); saveProject(new File(path, recipeType.registryName.getPath() + "." + this.getRegisterUI().name())); recipeType.getRecipeUI().reloadCustomUI(); @@ -132,9 +139,11 @@ public void attachMenu(Editor editor, String name, TreeBuilder.Menu menu) { root.clearAllWidgets(); if (recipeType.getRecipeUI().hasCustomUI()) { var nbt = recipeType.getRecipeUI().getCustomUI(); - IConfigurableWidget.deserializeNBT(root, nbt.getCompound("root"), Resources.fromNBT(nbt.getCompound("resources")), false); + IConfigurableWidget.deserializeNBT(root, nbt.getCompound("root"), + Resources.fromNBT(nbt.getCompound("resources")), false); } else { - var widget = recipeType.getRecipeUI().createEditableUITemplate(false, false).createDefault(); + var widget = recipeType.getRecipeUI().createEditableUITemplate(false, false) + .createDefault(); root.setSize(widget.getSize()); for (Widget children : widget.widgets) { root.addWidget(children); diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/editor/TemplateTab.java b/src/main/java/com/gregtechceu/gtceu/api/gui/editor/TemplateTab.java index da870d4419..e879fd4461 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/editor/TemplateTab.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/editor/TemplateTab.java @@ -15,5 +15,4 @@ public class TemplateTab extends MenuTab { protected TreeBuilder.Menu createMenu() { return TreeBuilder.Menu.start(); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/editor/UIMainPanel.java b/src/main/java/com/gregtechceu/gtceu/api/gui/editor/UIMainPanel.java index 92551d19d1..c408b7af78 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/editor/UIMainPanel.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/editor/UIMainPanel.java @@ -1,11 +1,13 @@ package com.gregtechceu.gtceu.api.gui.editor; import com.gregtechceu.gtceu.api.gui.GuiTextures; + import com.lowdragmc.lowdraglib.gui.editor.ui.Editor; import com.lowdragmc.lowdraglib.gui.editor.ui.MainPanel; import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.texture.TextTexture; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; + import net.minecraft.client.gui.GuiGraphics; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -29,7 +31,8 @@ public UIMainPanel(Editor editor, WidgetGroup root, String description) { @OnlyIn(Dist.CLIENT) public void draw(GuiGraphics graphics, int mouseX, int mouseY, float x, float y, int width, int height) { if (description != null) { - new TextTexture(description).scale(2.0f).draw(graphics, mouseX, mouseY, x, y, width - editor.getConfigPanel().getSize().getWidth(), height); + new TextTexture(description).scale(2.0f).draw(graphics, mouseX, mouseY, x, y, + width - editor.getConfigPanel().getSize().getWidth(), height); } var border = 4; var background = GuiTextures.BACKGROUND; diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/factory/CoverUIFactory.java b/src/main/java/com/gregtechceu/gtceu/api/gui/factory/CoverUIFactory.java index a77e67c3db..ce23b1c7f6 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/factory/CoverUIFactory.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/factory/CoverUIFactory.java @@ -4,8 +4,10 @@ import com.gregtechceu.gtceu.api.capability.GTCapabilityHelper; import com.gregtechceu.gtceu.api.cover.CoverBehavior; import com.gregtechceu.gtceu.api.cover.IUICover; + import com.lowdragmc.lowdraglib.gui.factory.UIFactory; import com.lowdragmc.lowdraglib.gui.modular.ModularUI; + import net.minecraft.client.Minecraft; import net.minecraft.core.Direction; import net.minecraft.network.FriendlyByteBuf; @@ -20,6 +22,7 @@ * @implNote CoverUIFactory */ public class CoverUIFactory extends UIFactory { + public static final CoverUIFactory INSTANCE = new CoverUIFactory(); public CoverUIFactory() { diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/factory/GTUIEditorFactory.java b/src/main/java/com/gregtechceu/gtceu/api/gui/factory/GTUIEditorFactory.java index 5ab3c4293c..9c531f2edb 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/factory/GTUIEditorFactory.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/factory/GTUIEditorFactory.java @@ -1,53 +1,51 @@ package com.gregtechceu.gtceu.api.gui.factory; import com.gregtechceu.gtceu.api.gui.editor.GTUIEditor; + import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.gui.factory.UIFactory; import com.lowdragmc.lowdraglib.gui.modular.IUIHolder; import com.lowdragmc.lowdraglib.gui.modular.ModularUI; + import net.minecraft.network.FriendlyByteBuf; import net.minecraft.world.entity.player.Player; public class GTUIEditorFactory extends UIFactory implements IUIHolder { - public static final GTUIEditorFactory INSTANCE = new GTUIEditorFactory(); - - private GTUIEditorFactory(){ - super(LDLib.location("gt_ui_editor")); - } - - @Override - protected ModularUI createUITemplate(GTUIEditorFactory holder, Player entityPlayer) { - return createUI(entityPlayer); - } + public static final GTUIEditorFactory INSTANCE = new GTUIEditorFactory(); - @Override - protected GTUIEditorFactory readHolderFromSyncData(FriendlyByteBuf syncData) { - return this; - } + private GTUIEditorFactory() { + super(LDLib.location("gt_ui_editor")); + } - @Override - protected void writeHolderToSyncData(FriendlyByteBuf syncData, GTUIEditorFactory holder) { + @Override + protected ModularUI createUITemplate(GTUIEditorFactory holder, Player entityPlayer) { + return createUI(entityPlayer); + } - } + @Override + protected GTUIEditorFactory readHolderFromSyncData(FriendlyByteBuf syncData) { + return this; + } - @Override - public ModularUI createUI(Player entityPlayer) { - return new ModularUI(this, entityPlayer).widget(new GTUIEditor()); - } + @Override + protected void writeHolderToSyncData(FriendlyByteBuf syncData, GTUIEditorFactory holder) {} - @Override - public boolean isInvalid() { - return false; - } + @Override + public ModularUI createUI(Player entityPlayer) { + return new ModularUI(this, entityPlayer).widget(new GTUIEditor()); + } - @Override - public boolean isRemote() { - return LDLib.isRemote(); - } + @Override + public boolean isInvalid() { + return false; + } - @Override - public void markAsDirty() { + @Override + public boolean isRemote() { + return LDLib.isRemote(); + } - } + @Override + public void markAsDirty() {} } diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/factory/MachineUIFactory.java b/src/main/java/com/gregtechceu/gtceu/api/gui/factory/MachineUIFactory.java index f8597862d1..8215be8b0d 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/factory/MachineUIFactory.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/factory/MachineUIFactory.java @@ -4,8 +4,10 @@ import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; import com.gregtechceu.gtceu.api.machine.MetaMachine; import com.gregtechceu.gtceu.api.machine.feature.IUIMachine; + import com.lowdragmc.lowdraglib.gui.factory.UIFactory; import com.lowdragmc.lowdraglib.gui.modular.ModularUI; + import net.minecraft.client.Minecraft; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.world.entity.player.Player; @@ -19,7 +21,8 @@ * @implNote MachineUIFactory */ public class MachineUIFactory extends UIFactory { - public static final MachineUIFactory INSTANCE = new MachineUIFactory(); + + public static final MachineUIFactory INSTANCE = new MachineUIFactory(); public MachineUIFactory() { super(GTCEu.id("machine")); diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/ConfiguratorPanel.java b/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/ConfiguratorPanel.java index 3055bbe07f..9a5bd0448b 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/ConfiguratorPanel.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/ConfiguratorPanel.java @@ -2,6 +2,7 @@ import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.config.ConfigHolder; + import com.lowdragmc.lowdraglib.gui.animation.Animation; import com.lowdragmc.lowdraglib.gui.animation.Transform; import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; @@ -14,18 +15,19 @@ import com.lowdragmc.lowdraglib.utils.Position; import com.lowdragmc.lowdraglib.utils.Size; import com.lowdragmc.lowdraglib.utils.interpolate.Eases; -import com.mojang.blaze3d.systems.RenderSystem; -import lombok.Getter; -import lombok.Setter; + import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.world.item.ItemStack; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import org.jetbrains.annotations.NotNull; +import com.mojang.blaze3d.systems.RenderSystem; +import lombok.Getter; +import lombok.Setter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; + import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -39,7 +41,8 @@ public class ConfiguratorPanel extends WidgetGroup { @Getter protected List tabs = new ArrayList<>(); - @Getter @Nullable + @Getter + @Nullable protected Tab expanded; @Setter protected int border = 4; @@ -157,7 +160,8 @@ protected void drawWidgetsForeground(@NotNull GuiGraphics graphics, int mouseX, @Override @OnlyIn(Dist.CLIENT) public boolean mouseClicked(double mouseX, double mouseY, int button) { - if (expanded != null && expanded.isVisible() && expanded.isActive() && expanded.mouseClicked(mouseX, mouseY, button)) { + if (expanded != null && expanded.isVisible() && expanded.isActive() && + expanded.mouseClicked(mouseX, mouseY, button)) { return true; } return super.mouseClicked(mouseX, mouseY, button); @@ -168,6 +172,7 @@ public FloatingTab createFloatingTab(IFancyConfigurator configurator) { } public class Tab extends WidgetGroup { + protected final IFancyConfigurator configurator; protected final ButtonWidget button; @Nullable @@ -184,25 +189,29 @@ public Tab(IFancyConfigurator configurator) { if (configurator instanceof IFancyConfiguratorButton) { this.view = null; this.addWidget(button); - } else{ + } else { var widget = configurator.createConfigurator(); widget.setSelfPosition(new Position(border, getTabSize())); this.view = new WidgetGroup(0, 0, 0, 0) { + @Override protected void onChildSizeUpdate(Widget child) { super.onChildSizeUpdate(child); if (widget == child) { - this.setSize(new Size(widget.getSize().width + border * 2, widget.getSize().height + getTabSize() + border)); + this.setSize(new Size(widget.getSize().width + border * 2, + widget.getSize().height + getTabSize() + border)); } } }; this.view.setVisible(false); this.view.setActive(false); - this.view.setSize(new Size(widget.getSize().width + border * 2, widget.getSize().height + button.getSize().height + border)); + this.view.setSize(new Size(widget.getSize().width + border * 2, + widget.getSize().height + button.getSize().height + border)); this.view.addWidget(widget); - this.view.addWidget(new ImageWidget(border + 5, border, widget.getSize().width - getTabSize() - 5, getTabSize() - border, + this.view.addWidget(new ImageWidget(border + 5, border, widget.getSize().width - getTabSize() - 5, + getTabSize() - border, new TextTexture(configurator.getTitle().getString()) .setType(TextTexture.TextType.LEFT_HIDE) .setWidth(widget.getSize().width - getTabSize()))); @@ -247,14 +256,15 @@ protected void onChildSizeUpdate(Widget child) { if (expanded == this) { var size = view.getSize(); animation(new Animation() - .duration(getAnimationTime()) - .position(new Position(dragOffsetX + (- size.width + (tabs.size() > 1 ? - 2 : getTabSize())), dragOffsetY)) - .size(size) - .ease(Eases.EaseQuadOut) - .onFinish(() -> { - view.setVisible(true); - view.setActive(true); - })); + .duration(getAnimationTime()) + .position(new Position(dragOffsetX + (-size.width + (tabs.size() > 1 ? -2 : getTabSize())), + dragOffsetY)) + .size(size) + .ease(Eases.EaseQuadOut) + .onFinish(() -> { + view.setVisible(true); + view.setActive(true); + })); } } } @@ -283,24 +293,26 @@ private void expand() { this.dragOffsetX = 0; this.dragOffsetY = 0; if (isRemote()) { - if (getParentPosition().x - size.width + (tabs.size() > 1 ? - 2 : getTabSize()) < 0) { - this.dragOffsetX -= (view.getParentPosition().x - size.width + (tabs.size() > 1 ? - 2 : getTabSize())); + if (getParentPosition().x - size.width + (tabs.size() > 1 ? -2 : getTabSize()) < 0) { + this.dragOffsetX -= (view.getParentPosition().x - size.width + + (tabs.size() > 1 ? -2 : getTabSize())); } if (getParentPosition().y + size.height > gui.getScreenHeight()) { this.dragOffsetY -= view.getParentPosition().y + size.height - gui.getScreenHeight(); } } - Position position = new Position(dragOffsetX - size.width + (tabs.size() > 1 ? -2 : getTabSize()), dragOffsetY); + Position position = new Position(dragOffsetX - size.width + (tabs.size() > 1 ? -2 : getTabSize()), + dragOffsetY); animation(new Animation() - .duration(getAnimationTime()) - .position(position) - .size(size) - .ease(Eases.EaseQuadOut) - .onFinish(() -> { - view.setVisible(true); - view.setActive(true); - })); + .duration(getAnimationTime()) + .position(position) + .size(size) + .ease(Eases.EaseQuadOut) + .onFinish(() -> { + view.setVisible(true); + view.setActive(true); + })); } protected void collapseTo(int x, int y) { @@ -309,10 +321,10 @@ protected void collapseTo(int x, int y) { view.setActive(false); } animation(new Animation() - .duration(getAnimationTime()) - .position(new Position(x, y)) - .size(new Size(getTabSize(), getTabSize())) - .ease(Eases.EaseQuadOut)); + .duration(getAnimationTime()) + .position(new Position(x, y)) + .size(new Size(getTabSize(), getTabSize())) + .ease(Eases.EaseQuadOut)); } @Override @@ -322,7 +334,9 @@ public void drawInBackground(@NotNull GuiGraphics graphics, int mouseX, int mous var position = getPosition(); var size = getSize(); if (inAnimate()) { - graphics.enableScissor(position.x + border - 1, position.y + border - 1, position.x + border - 1 + size.width - (border - 1) * 2, position.y + border - 1 + size.height - (border - 1) * 2); + graphics.enableScissor(position.x + border - 1, position.y + border - 1, + position.x + border - 1 + size.width - (border - 1) * 2, + position.y + border - 1 + size.height - (border - 1) * 2); drawWidgetsBackground(graphics, mouseX, mouseY, partialTicks); graphics.disableScissor(); } else { @@ -335,7 +349,8 @@ public void drawInBackground(@NotNull GuiGraphics graphics, int mouseX, int mous @OnlyIn(Dist.CLIENT) public void drawInForeground(@NotNull GuiGraphics graphics, int mouseX, int mouseY, float partialTicks) { super.drawInForeground(graphics, mouseX, mouseY, partialTicks); - if (isMouseOver(getPosition().x + getSize().width - 20, getPosition().y + 4, 16, 16, mouseX, mouseY) && gui != null && gui.getModularUIGui() != null) { + if (isMouseOver(getPosition().x + getSize().width - 20, getPosition().y + 4, 16, 16, mouseX, mouseY) && + gui != null && gui.getModularUIGui() != null) { gui.getModularUIGui().setHoverTooltip(configurator.getTooltips(), ItemStack.EMPTY, null, null); } } @@ -346,7 +361,8 @@ public boolean mouseClicked(double mouseX, double mouseY, int button) { this.lastDeltaX = 0; this.lastDeltaY = 0; this.isDragging = false; - if (expanded == this && isMouseOver(getPosition().x, getPosition().y, getSize().width - getTabSize(), getTabSize(), mouseX, mouseY)) { + if (expanded == this && isMouseOver(getPosition().x, getPosition().y, getSize().width - getTabSize(), + getTabSize(), mouseX, mouseY)) { isDragging = true; return true; } @@ -393,6 +409,7 @@ public boolean mouseMoved(double mouseX, double mouseY) { } public class FloatingTab extends Tab { + protected Runnable closeCallback = () -> {}; public FloatingTab(IFancyConfigurator configurator) { diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/FancyMachineUIWidget.java b/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/FancyMachineUIWidget.java index cd7772dcf1..fcd8798aad 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/FancyMachineUIWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/FancyMachineUIWidget.java @@ -2,6 +2,7 @@ import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.config.ConfigHolder; + import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.util.ClickData; @@ -9,6 +10,7 @@ import com.lowdragmc.lowdraglib.gui.widget.custom.PlayerInventoryWidget; import com.lowdragmc.lowdraglib.utils.Position; import com.lowdragmc.lowdraglib.utils.Size; + import lombok.Getter; import lombok.Setter; import org.jetbrains.annotations.Nullable; @@ -16,7 +18,6 @@ import java.util.ArrayDeque; import java.util.Deque; import java.util.List; -import java.util.Stack; import java.util.stream.Stream; /** @@ -26,6 +27,7 @@ */ @Getter public class FancyMachineUIWidget extends WidgetGroup { + protected final TitleBarWidget titleBar; protected final VerticalTabsWidget sideTabsWidget; protected final WidgetGroup pageContainer; @@ -41,7 +43,7 @@ public class FancyMachineUIWidget extends WidgetGroup { protected final IFancyUIProvider mainPage; /* - * Current Page: The page visible in the UI + * Current Page: The page visible in the UI * Current Home Page: The currently selected multiblock part's home page. */ protected IFancyUIProvider currentPage; @@ -51,8 +53,7 @@ public class FancyMachineUIWidget extends WidgetGroup { protected Deque previousPages = new ArrayDeque<>(); - protected record NavigationEntry(IFancyUIProvider page, IFancyUIProvider homePage, Runnable onNavigation) { - } + protected record NavigationEntry(IFancyUIProvider page, IFancyUIProvider homePage, Runnable onNavigation) {} public FancyMachineUIWidget(IFancyUIProvider mainPage, int width, int height) { super(0, 0, width, height); @@ -74,7 +75,8 @@ public FancyMachineUIWidget(IFancyUIProvider mainPage, int width, int height) { addWidget(this.configuratorPanel = new ConfiguratorPanel(-(24 + 2), height)); this.pageSwitcher = new PageSwitcher(this::switchPage); - setBackground(GuiTextures.BACKGROUND.copy().setColor(Long.decode(ConfigHolder.INSTANCE.client.defaultUIColor).intValue() | 0xFF000000)); + setBackground(GuiTextures.BACKGROUND.copy() + .setColor(Long.decode(ConfigHolder.INSTANCE.client.defaultUIColor).intValue() | 0xFF000000)); } @Override @@ -91,7 +93,7 @@ public void initWidget() { } //////////////////////////////////////// - //********* NAVIGATION *********// + // ********* NAVIGATION *********// //////////////////////////////////////// protected void navigate(IFancyUIProvider newPage) { @@ -135,9 +137,8 @@ protected void performNavigation(IFancyUIProvider nextPage, IFancyUIProvider nex setupFancyUI(nextPage, nextPage.hasPlayerInventory()); } - /////////////////////////////////////////////// - //*********** PAGE SWITCHER ***********// + // *********** PAGE SWITCHER ***********// /////////////////////////////////////////////// protected void openPageSwitcher(ClickData clickData) { @@ -176,7 +177,7 @@ protected void switchPage(IFancyUIProvider nextHomePage) { } ////////////////////////////////////////////// - //*********** UI RENDERING ***********// + // *********** UI RENDERING ***********// ////////////////////////////////////////////// protected void setupFancyUI(IFancyUIProvider fancyUI) { @@ -188,16 +189,17 @@ protected void setupFancyUI(IFancyUIProvider fancyUI, boolean showInventory) { sideTabsWidget.selectTab(fancyUI); titleBar.updateState( - currentHomePage, - !this.previousPages.isEmpty(), - this.allPages.size() > 1 && this.currentPage != this.pageSwitcher - ); + currentHomePage, + !this.previousPages.isEmpty(), + this.allPages.size() > 1 && this.currentPage != this.pageSwitcher); var page = fancyUI.createMainPage(this); // layout - var size = new Size(Math.max(172, page.getSize().width + border * 2), Math.max(86, page.getSize().height + border * 2)); - setSize(new Size(size.width, size.height + (!showInventory || playerInventory == null ? 0 : playerInventory.getSize().height))); + var size = new Size(Math.max(172, page.getSize().width + border * 2), + Math.max(86, page.getSize().height + border * 2)); + setSize(new Size(size.width, + size.height + (!showInventory || playerInventory == null ? 0 : playerInventory.getSize().height))); if (LDLib.isRemote() && getGui() != null) { getGui().setSize(getSize().width, getSize().height); } @@ -213,7 +215,8 @@ protected void setupFancyUI(IFancyUIProvider fancyUI, boolean showInventory) { (pageContainer.getSize().width - page.getSize().width) / 2, (pageContainer.getSize().height - page.getSize().height) / 2)); fancyUI.attachConfigurators(configuratorPanel); - configuratorPanel.setSelfPosition(new Position(-24 - 2, getGui().getHeight() - configuratorPanel.getSize().height - 4)); + configuratorPanel + .setSelfPosition(new Position(-24 - 2, getGui().getHeight() - configuratorPanel.getSize().height - 4)); fancyUI.attachTooltips(tooltipsPanel); titleBar.setSize(new Size(this.getSize().width, titleBar.getSize().height)); @@ -224,9 +227,8 @@ private void setupInventoryPosition(boolean showInventory, Size parentSize) { return; this.playerInventory.setSelfPosition(new Position( - (parentSize.width - playerInventory.getSize().width) / 2, - parentSize.height - )); + (parentSize.width - playerInventory.getSize().width) / 2, + parentSize.height)); this.playerInventory.setActive(showInventory); this.playerInventory.setVisible(showInventory); diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/IFancyConfigurator.java b/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/IFancyConfigurator.java index 0d2e175110..8519d5f8b0 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/IFancyConfigurator.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/IFancyConfigurator.java @@ -2,6 +2,7 @@ import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.widget.Widget; + import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; @@ -26,19 +27,11 @@ default List getTooltips() { return List.of(getTitle()); } - default void detectAndSendChange(BiConsumer> sender) { - - } + default void detectAndSendChange(BiConsumer> sender) {} - default void readUpdateInfo(int id, FriendlyByteBuf buf) { - - } + default void readUpdateInfo(int id, FriendlyByteBuf buf) {} - default void writeInitialData(FriendlyByteBuf buffer) { + default void writeInitialData(FriendlyByteBuf buffer) {} - } - - default void readInitialData(FriendlyByteBuf buffer) { - - } + default void readInitialData(FriendlyByteBuf buffer) {} } diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/IFancyConfiguratorButton.java b/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/IFancyConfiguratorButton.java index 3099693a63..4cf7299a51 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/IFancyConfiguratorButton.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/IFancyConfiguratorButton.java @@ -3,11 +3,12 @@ import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.util.ClickData; import com.lowdragmc.lowdraglib.gui.widget.Widget; -import lombok.Getter; -import lombok.Setter; -import lombok.experimental.Accessors; + import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; + +import lombok.Setter; +import lombok.experimental.Accessors; import org.apache.commons.lang3.NotImplementedException; import java.util.Collections; @@ -38,6 +39,7 @@ default Widget createConfigurator() { @Accessors(chain = true) class Toggle implements IFancyConfiguratorButton { + IGuiTexture base; IGuiTexture pressed; BiConsumer onClick; @@ -46,7 +48,8 @@ class Toggle implements IFancyConfiguratorButton { @Setter Function> tooltipsSupplier = isPressed -> Collections.emptyList(); - public Toggle(IGuiTexture base, IGuiTexture pressed, BooleanSupplier booleanSupplier, BiConsumer onClick) { + public Toggle(IGuiTexture base, IGuiTexture pressed, BooleanSupplier booleanSupplier, + BiConsumer onClick) { this.base = base; this.pressed = pressed; this.booleanSupplier = booleanSupplier; diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/IFancyTooltip.java b/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/IFancyTooltip.java index f24a5d44b2..3cc1b71be7 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/IFancyTooltip.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/IFancyTooltip.java @@ -1,8 +1,10 @@ package com.gregtechceu.gtceu.api.gui.fancy; import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; + import net.minecraft.network.chat.Component; import net.minecraft.world.inventory.tooltip.TooltipComponent; + import org.jetbrains.annotations.Nullable; import java.util.List; @@ -14,6 +16,7 @@ * @implNote IFancyConfigurator */ public interface IFancyTooltip { + IGuiTexture getFancyTooltipIcon(); List getFancyTooltip(); @@ -26,7 +29,10 @@ default boolean showFancyTooltip() { default TooltipComponent getFancyComponent() { return null; } - record Basic(Supplier icon, Supplier> content, Supplier predicate, Supplier componentSupplier) implements IFancyTooltip { + + record Basic(Supplier icon, Supplier> content, Supplier predicate, + Supplier componentSupplier) + implements IFancyTooltip { @Override public IGuiTexture getFancyTooltipIcon() { diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/IFancyUIProvider.java b/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/IFancyUIProvider.java index dcc2ae4cbf..a2b6ec8918 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/IFancyUIProvider.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/IFancyUIProvider.java @@ -2,10 +2,12 @@ import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.widget.Widget; + import net.minecraft.network.chat.Component; import net.minecraft.world.inventory.tooltip.TooltipComponent; import org.jetbrains.annotations.Nullable; + import java.util.Collections; import java.util.List; @@ -34,23 +36,17 @@ public interface IFancyUIProvider { /** * Attach configurators to the left subtab list. */ - default void attachSideTabs(TabsWidget configuratorPanel) { - - } + default void attachSideTabs(TabsWidget configuratorPanel) {} /** * Attach configurators to the left panel. */ - default void attachConfigurators(ConfiguratorPanel configuratorPanel) { - - } + default void attachConfigurators(ConfiguratorPanel configuratorPanel) {} /** * Attach tooltips to the right panel */ - default void attachTooltips(TooltipsPanel tooltipsPanel) { - - } + default void attachTooltips(TooltipsPanel tooltipsPanel) {} default boolean hasPlayerInventory() { return true; @@ -83,6 +79,5 @@ default PageGroupingData getPageGroupingData() { return null; } - record PageGroupingData(@Nullable String groupKey, int groupPositionWeight) { - } + record PageGroupingData(@Nullable String groupKey, int groupPositionWeight) {} } diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/PageSwitcher.java b/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/PageSwitcher.java index 5cea46f8e1..20c76d3945 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/PageSwitcher.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/PageSwitcher.java @@ -1,21 +1,25 @@ package com.gregtechceu.gtceu.api.gui.fancy; import com.gregtechceu.gtceu.api.gui.GuiTextures; + import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.texture.TextTexture; import com.lowdragmc.lowdraglib.gui.widget.*; + import net.minecraft.ChatFormatting; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.network.chat.Component; + import org.apache.commons.lang3.mutable.MutableInt; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.Comparator; import java.util.List; import java.util.Objects; import java.util.function.Consumer; import java.util.stream.Collectors; +import javax.annotation.ParametersAreNonnullByDefault; + @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault public class PageSwitcher implements IFancyUIProvider { @@ -43,38 +47,39 @@ public Widget createMainPage(FancyMachineUIWidget widget) { scrollableGroup.setYBarStyle(GuiTextures.SLIDER_BACKGROUND_VERTICAL, GuiTextures.BUTTON); container.addWidget(scrollableGroup); - var groupedPages = pages.stream().collect(Collectors.groupingBy(page -> - Objects.requireNonNullElse(page.getPageGroupingData(), new PageGroupingData(null, -1)) - )); + var groupedPages = pages.stream().collect(Collectors.groupingBy( + page -> Objects.requireNonNullElse(page.getPageGroupingData(), new PageGroupingData(null, -1)))); final MutableInt currentY = new MutableInt(0); groupedPages.keySet().stream() - .sorted(Comparator.comparingInt(PageGroupingData::groupPositionWeight)) - .forEachOrdered(group -> { - if (group.groupKey() != null) { - scrollableGroup.addWidget(new LabelWidget(0, currentY.getAndAdd(12), group.groupKey()).setDropShadow(false)); - } - - final var currentPage = new MutableInt(0); - currentY.subtract(30); // To account for adding it back on the first page inside this group - - groupedPages.get(group).forEach(page -> { - var index = currentPage.getAndIncrement(); - var y = currentY.addAndGet(index % 5 == 0 ? 30 : 0); // Jump to the next row every 5 parts - - var pageWidget = new WidgetGroup((index % 5) * 30, y, 25, 25); - pageWidget.addWidget(new ButtonWidget(0, 0, 25, 25, GuiTextures.BACKGROUND, clickData -> onPageSwitched.accept(page))); - pageWidget.addWidget(new ImageWidget(4, 4, 17, 17, page.getTabIcon())); - // For some reason, this doesn't work in any other way: - pageWidget.widgets.get(0).setHoverTooltips(page.getTitle().getString()); - scrollableGroup.addWidget(pageWidget); + .sorted(Comparator.comparingInt(PageGroupingData::groupPositionWeight)) + .forEachOrdered(group -> { + if (group.groupKey() != null) { + scrollableGroup.addWidget( + new LabelWidget(0, currentY.getAndAdd(12), group.groupKey()).setDropShadow(false)); + } + + final var currentPage = new MutableInt(0); + currentY.subtract(30); // To account for adding it back on the first page inside this group + + groupedPages.get(group).forEach(page -> { + var index = currentPage.getAndIncrement(); + var y = currentY.addAndGet(index % 5 == 0 ? 30 : 0); // Jump to the next row every 5 parts + + var pageWidget = new WidgetGroup((index % 5) * 30, y, 25, 25); + pageWidget.addWidget(new ButtonWidget(0, 0, 25, 25, GuiTextures.BACKGROUND, + clickData -> onPageSwitched.accept(page))); + pageWidget.addWidget(new ImageWidget(4, 4, 17, 17, page.getTabIcon())); + // For some reason, this doesn't work in any other way: + pageWidget.widgets.get(0).setHoverTooltips(page.getTitle().getString()); + scrollableGroup.addWidget(pageWidget); + }); + + if (!groupedPages.get(group).isEmpty()) { + currentY.add(30); + } }); - if (!groupedPages.get(group).isEmpty()) { - currentY.add(30); - } - }); - return container; } diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/TabsWidget.java b/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/TabsWidget.java index caa91a2b84..a15f7c18fa 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/TabsWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/TabsWidget.java @@ -1,19 +1,22 @@ package com.gregtechceu.gtceu.api.gui.fancy; import com.gregtechceu.gtceu.api.gui.GuiTextures; + import com.lowdragmc.lowdraglib.gui.editor.Icons; import com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup; import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; import com.lowdragmc.lowdraglib.gui.widget.Widget; -import lombok.Getter; -import lombok.Setter; + import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.util.Mth; import net.minecraft.world.item.ItemStack; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + +import lombok.Getter; +import lombok.Setter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -29,19 +32,26 @@ */ @Getter public class TabsWidget extends Widget { + protected final Consumer onTabClick; protected IFancyUIProvider mainTab; protected List subTabs; @Nullable protected IFancyUIProvider selectedTab; @Setter - protected IGuiTexture leftButtonTexture = new GuiTextureGroup(GuiTextures.BUTTON, Icons.LEFT.copy().scale(0.7f)), leftButtonHoverTexture = new GuiTextureGroup(GuiTextures.BUTTON, Icons.LEFT.copy().setColor(0xffaaaaaa).scale(0.7f)); + protected IGuiTexture leftButtonTexture = new GuiTextureGroup(GuiTextures.BUTTON, Icons.LEFT.copy().scale(0.7f)), + leftButtonHoverTexture = new GuiTextureGroup(GuiTextures.BUTTON, + Icons.LEFT.copy().setColor(0xffaaaaaa).scale(0.7f)); @Setter - protected IGuiTexture rightButtonTexture = new GuiTextureGroup(GuiTextures.BUTTON, Icons.RIGHT.copy().scale(0.7f)), rightButtonHoverTexture = new GuiTextureGroup(GuiTextures.BUTTON, Icons.RIGHT.copy().setColor(0xffaaaaaa).scale(0.7f)); + protected IGuiTexture rightButtonTexture = new GuiTextureGroup(GuiTextures.BUTTON, Icons.RIGHT.copy().scale(0.7f)), + rightButtonHoverTexture = new GuiTextureGroup(GuiTextures.BUTTON, + Icons.RIGHT.copy().setColor(0xffaaaaaa).scale(0.7f)); @Setter - protected IGuiTexture tabTexture = new ResourceTexture("gtceu:textures/gui/tab/tabs_top.png").getSubTexture(1 / 3f, 0, 1 / 3f, 0.5f); + protected IGuiTexture tabTexture = new ResourceTexture("gtceu:textures/gui/tab/tabs_top.png").getSubTexture(1 / 3f, + 0, 1 / 3f, 0.5f); @Setter - protected IGuiTexture tabHoverTexture = new ResourceTexture("gtceu:textures/gui/tab/tabs_top.png").getSubTexture(1 / 3f, 0.5f, 1 / 3f, 0.5f); + protected IGuiTexture tabHoverTexture = new ResourceTexture("gtceu:textures/gui/tab/tabs_top.png") + .getSubTexture(1 / 3f, 0.5f, 1 / 3f, 0.5f); @Setter protected IGuiTexture tabPressedTexture = tabHoverTexture; @Getter @@ -117,7 +127,8 @@ public boolean mouseClicked(double mouseX, double mouseY, int button) { onTabSwitch.accept(selectedTab, hoveredTab); } selectedTab = hoveredTab; - writeClientAction(0, buf -> buf.writeVarInt(selectedTab == mainTab ? -1 : subTabs.indexOf(selectedTab))); + writeClientAction(0, + buf -> buf.writeVarInt(selectedTab == mainTab ? -1 : subTabs.indexOf(selectedTab))); onTabClick.accept(selectedTab); playButtonClickSound(); } @@ -163,7 +174,8 @@ public void drawInBackground(@NotNull GuiGraphics graphics, int mouseX, int mous leftButtonTexture.draw(graphics, mouseX, mouseY, position.x + 8 + 24 + 4, position.y, 16, 24); } if (isHoverRightButton(mouseX, mouseY)) { - rightButtonHoverTexture.draw(graphics, mouseX, mouseY, position.x + size.width - 8 - 16, position.y, 16, 24); + rightButtonHoverTexture.draw(graphics, mouseX, mouseY, position.x + size.width - 8 - 16, position.y, 16, + 24); } else { rightButtonTexture.draw(graphics, mouseX, mouseY, position.x + size.width - 8 - 16, position.y, 16, 24); } @@ -176,7 +188,8 @@ public void drawInBackground(@NotNull GuiGraphics graphics, int mouseX, int mous graphics.disableScissor(); } else { for (int i = subTabs.size() - 1; i >= 0; i--) { - drawTab(subTabs.get(i), graphics, mouseX, mouseY, position.x + size.width - 8 - 24 * (subTabs.size() - i), position.y, 24, 24, hoveredTab); + drawTab(subTabs.get(i), graphics, mouseX, mouseY, + position.x + size.width - 8 - 24 * (subTabs.size() - i), position.y, 24, 24, hoveredTab); } } } @@ -186,7 +199,8 @@ public void drawInBackground(@NotNull GuiGraphics graphics, int mouseX, int mous public void drawInForeground(@NotNull GuiGraphics graphics, int mouseX, int mouseY, float partialTicks) { var hoveredTab = getHoveredTab(mouseX, mouseY); if (hoveredTab != null && gui != null && gui.getModularUIGui() != null) { - gui.getModularUIGui().setHoverTooltip(hoveredTab.getTabTooltips(), ItemStack.EMPTY, null, hoveredTab.getTabTooltipComponent()); + gui.getModularUIGui().setHoverTooltip(hoveredTab.getTabTooltips(), ItemStack.EMPTY, null, + hoveredTab.getTabTooltipComponent()); } super.drawInForeground(graphics, mouseX, mouseY, partialTicks); } @@ -215,24 +229,24 @@ public IFancyUIProvider getHoveredTab(double mouseX, double mouseY) { if (hasButton()) { // need a scrollable bar var sx = position.x + 8 + 24 + 4 + 16; if (isMouseOver(sx, position.y, getSubTabsWidth(), 24, mouseX, mouseY)) { - var i = ((int)mouseX - sx + getOffset()) / 24; + var i = ((int) mouseX - sx + getOffset()) / 24; if (i < subTabs.size()) { return subTabs.get(i); } } } else { - int i = (position.x + size.width - 8 - (int)mouseX) / 24; + int i = (position.x + size.width - 8 - (int) mouseX) / 24; if (i < subTabs.size()) { return subTabs.get(subTabs.size() - 1 - i); } } } return null; - } @OnlyIn(Dist.CLIENT) - public void drawTab(IFancyUIProvider tab, @NotNull GuiGraphics graphics, int mouseX, int mouseY, int x, int y, int width, int height, IFancyUIProvider hoveredTab) { + public void drawTab(IFancyUIProvider tab, @NotNull GuiGraphics graphics, int mouseX, int mouseY, int x, int y, + int width, int height, IFancyUIProvider hoveredTab) { // render background if (tab == selectedTab) { tabPressedTexture.draw(graphics, mouseX, mouseY, x, y, width, height); diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/TitleBarWidget.java b/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/TitleBarWidget.java index 72fc83b41e..b40d56fc46 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/TitleBarWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/TitleBarWidget.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.api.gui.fancy; import com.gregtechceu.gtceu.api.gui.GuiTextures; + import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.texture.TextTexture; import com.lowdragmc.lowdraglib.gui.util.ClickData; @@ -10,15 +11,18 @@ import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.utils.Position; import com.lowdragmc.lowdraglib.utils.Size; + import net.minecraft.ChatFormatting; import net.minecraft.MethodsReturnNonnullByDefault; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.function.Consumer; +import javax.annotation.ParametersAreNonnullByDefault; + @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault public class TitleBarWidget extends WidgetGroup { + private static final int BORDER_WIDTH = 3; private static final int HORIZONTAL_MARGIN = 8; private static final int HEIGHT = 16; @@ -56,21 +60,22 @@ public TitleBarWidget(int parentWidth, Consumer onBackClicked, Consum addWidget(this.buttonGroup = new WidgetGroup(0, BORDER_WIDTH, width, innerHeight)); buttonGroup.setBackground(GuiTextures.TITLE_BAR_BACKGROUND); - buttonGroup.addWidget(this.backButton = new ButtonWidget(0, BORDER_WIDTH, BTN_WIDTH, HEIGHT - BORDER_WIDTH, new TextTexture(" <").setDropShadow(false).setColor(ChatFormatting.BLACK.getColor()), onBackClicked) - .setHoverTooltips("gtceu.gui.title_bar.back")); - buttonGroup.addWidget(this.menuButton = new ButtonWidget(width - BTN_WIDTH, BORDER_WIDTH, BTN_WIDTH, HEIGHT - BORDER_WIDTH, new TextTexture("+").setDropShadow(false).setColor(ChatFormatting.BLACK.getColor()), onMenuClicked) - .setHoverTooltips("gtceu.gui.title_bar.page_switcher")); + buttonGroup.addWidget(this.backButton = new ButtonWidget(0, BORDER_WIDTH, BTN_WIDTH, HEIGHT - BORDER_WIDTH, + new TextTexture(" <").setDropShadow(false).setColor(ChatFormatting.BLACK.getColor()), onBackClicked) + .setHoverTooltips("gtceu.gui.title_bar.back")); + buttonGroup.addWidget(this.menuButton = new ButtonWidget(width - BTN_WIDTH, BORDER_WIDTH, BTN_WIDTH, + HEIGHT - BORDER_WIDTH, + new TextTexture("+").setDropShadow(false).setColor(ChatFormatting.BLACK.getColor()), onMenuClicked) + .setHoverTooltips("gtceu.gui.title_bar.page_switcher")); addWidget(this.mainSection = new WidgetGroup(BTN_WIDTH, 0, width, HEIGHT)); mainSection.setBackground(GuiTextures.TITLE_BAR_BACKGROUND); mainSection.addWidget(this.tabIcon = new ImageWidget( - BORDER_WIDTH + 1, BORDER_WIDTH + 1, - innerHeight - 2, innerHeight - 2, - IGuiTexture.EMPTY - )); + BORDER_WIDTH + 1, BORDER_WIDTH + 1, + innerHeight - 2, innerHeight - 2, + IGuiTexture.EMPTY)); mainSection.addWidget(this.tabTitle = new ImageWidget( - BORDER_WIDTH + innerHeight, BORDER_WIDTH, 0, 0, IGuiTexture.EMPTY - )); + BORDER_WIDTH + innerHeight, BORDER_WIDTH, 0, 0, IGuiTexture.EMPTY)); } public void updateState(IFancyUIProvider currentPage, boolean showBackButton, boolean showMenuButton) { @@ -78,8 +83,8 @@ public void updateState(IFancyUIProvider currentPage, boolean showBackButton, bo this.showMenuButton = showMenuButton; titleText = new TextTexture(ChatFormatting.BLACK.toString() + currentPage.getTitle().copy().getString()) - .setDropShadow(false) - .setType(TextTexture.TextType.ROLL); + .setDropShadow(false) + .setType(TextTexture.TextType.ROLL); titleText.setRollSpeed(ROLL_SPEED); tabIcon.setImage(currentPage.getTabIcon()); diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/TooltipsPanel.java b/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/TooltipsPanel.java index 07537dca98..5e56a1d876 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/TooltipsPanel.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/TooltipsPanel.java @@ -2,12 +2,13 @@ import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.utils.Size; -import com.mojang.blaze3d.vertex.PoseStack; -import lombok.Getter; + import net.minecraft.client.gui.GuiGraphics; import net.minecraft.world.item.ItemStack; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + +import lombok.Getter; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; @@ -20,6 +21,7 @@ * @implNote TooltipsPanel */ public class TooltipsPanel extends Widget { + @Getter protected List tooltips = new ArrayList<>(); @@ -45,7 +47,8 @@ public void drawInBackground(@NotNull GuiGraphics graphics, int mouseX, int mous for (IFancyTooltip tooltip : this.tooltips) { if (tooltip.showFancyTooltip()) { // draw icon - tooltip.getFancyTooltipIcon().draw(graphics, mouseX, mouseY, position.x, position.y + offsetY, size.width, size.width); + tooltip.getFancyTooltipIcon().draw(graphics, mouseX, mouseY, position.x, position.y + offsetY, + size.width, size.width); offsetY += size.getWidth() + 2; } } @@ -62,7 +65,8 @@ public void drawInForeground(@NotNull GuiGraphics graphics, int mouseX, int mous for (IFancyTooltip tooltip : this.tooltips) { if (tooltip.showFancyTooltip()) { if (isMouseOver(position.x, position.y + offsetY, size.width, size.width, mouseX, mouseY)) { - gui.getModularUIGui().setHoverTooltip(tooltip.getFancyTooltip(), ItemStack.EMPTY, null, tooltip.getFancyComponent()); + gui.getModularUIGui().setHoverTooltip(tooltip.getFancyTooltip(), ItemStack.EMPTY, null, + tooltip.getFancyComponent()); return; } offsetY += size.getWidth() + 2; diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/VerticalTabsWidget.java b/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/VerticalTabsWidget.java index 252cd3c462..0fe2fc77f5 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/VerticalTabsWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/VerticalTabsWidget.java @@ -1,9 +1,11 @@ package com.gregtechceu.gtceu.api.gui.fancy; import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; + import net.minecraft.client.gui.GuiGraphics; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -34,7 +36,8 @@ public void drawInBackground(@NotNull GuiGraphics graphics, int mouseX, int mous // main tab drawTab(mainTab, graphics, mouseX, mouseY, position.x, position.y + 8, 24, 24, hoveredTab); for (int i = 0; i < subTabs.size(); ++i) { - drawTab(subTabs.get(i), graphics, mouseX, mouseY, position.x, position.y + 8 + 24 * (i + 1), 24, 24, hoveredTab); + drawTab(subTabs.get(i), graphics, mouseX, mouseY, position.x, position.y + 8 + 24 * (i + 1), 24, 24, + hoveredTab); } } @@ -49,13 +52,11 @@ public IFancyUIProvider getHoveredTab(double mouseX, double mouseY) { return mainTab; } // others - int i = ((int)mouseY - position.y - 24 - 8) / 24; + int i = ((int) mouseY - position.y - 24 - 8) / 24; if (i >= 0 && i < subTabs.size()) { return subTabs.get(i); } } return null; - } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/misc/PacketProspecting.java b/src/main/java/com/gregtechceu/gtceu/api/gui/misc/PacketProspecting.java index 88bd56b62d..6aad5dff96 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/misc/PacketProspecting.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/misc/PacketProspecting.java @@ -5,6 +5,7 @@ import java.lang.reflect.Array; public class PacketProspecting { + public int chunkX; public int chunkZ; public ProspectorMode mode; @@ -42,5 +43,4 @@ public void writePacketData(FriendlyByteBuf buffer) { } } } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/misc/ProspectorMode.java b/src/main/java/com/gregtechceu/gtceu/api/gui/misc/ProspectorMode.java index 39bf1cde3c..64b86ad7d5 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/misc/ProspectorMode.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/misc/ProspectorMode.java @@ -9,17 +9,17 @@ import com.gregtechceu.gtceu.api.data.worldgen.bedrockfluid.BedrockFluidVeinSavedData; import com.gregtechceu.gtceu.api.data.worldgen.bedrockore.BedrockOreVeinSavedData; import com.gregtechceu.gtceu.api.gui.texture.ProspectingTexture; -import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.common.data.GTMaterials; import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.utils.FormattingUtil; + import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.texture.ItemStackTexture; import com.lowdragmc.lowdraglib.gui.texture.ProgressTexture; import com.lowdragmc.lowdraglib.gui.util.DrawerHelper; import com.lowdragmc.lowdraglib.side.fluid.FluidHelper; import com.lowdragmc.lowdraglib.side.fluid.FluidStack; -import com.mojang.blaze3d.vertex.PoseStack; + import net.minecraft.client.gui.GuiGraphics; import net.minecraft.core.BlockPos; import net.minecraft.core.registries.BuiltInRegistries; @@ -34,9 +34,10 @@ import net.minecraft.world.level.material.Fluids; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import org.apache.commons.lang3.ArrayUtils; +import org.apache.commons.lang3.ArrayUtils; import org.jetbrains.annotations.NotNull; + import java.util.*; /** @@ -45,7 +46,9 @@ * @implNote ProspectorMode */ public abstract class ProspectorMode { + public static ProspectorMode ORE = new ProspectorMode<>("metaitem.prospector.mode.ores", 16) { + private final Map BLOCK_CACHE = new HashMap<>(); private final Map ICON_CACHE = new HashMap<>(); @@ -100,7 +103,8 @@ public IGuiTexture getItemIcon(String item) { return new ItemStackTexture(list.toArray(ItemStack[]::new)).scale(0.8f); } } - return new ItemStackTexture(new ItemStack(BuiltInRegistries.BLOCK.get(new ResourceLocation(name)))).scale(0.8f); + return new ItemStackTexture(new ItemStack(BuiltInRegistries.BLOCK.get(new ResourceLocation(name)))) + .scale(0.8f); }); } @@ -145,7 +149,8 @@ public void appendTooltips(List items, List tooltips, Strin } } } - counter.forEach((item, count) -> tooltips.add(Component.translatable(getDescriptionId(item)).append(" --- " + count))); + counter.forEach((item, count) -> tooltips + .add(Component.translatable(getDescriptionId(item)).append(" --- " + count))); } }; @@ -154,14 +159,18 @@ public record FluidInfo(Fluid fluid, int left, int yield) { } public static ProspectorMode FLUID = new ProspectorMode<>("metaitem.prospector.mode.fluid", 1) { + @Override public void scan(FluidInfo[][][] storage, LevelChunk chunk) { if (chunk.getLevel() instanceof ServerLevel serverLevel) { - var fluidVein = BedrockFluidVeinSavedData.getOrCreate(serverLevel).getFluidVeinWorldEntry(chunk.getPos().x, chunk.getPos().z); + var fluidVein = BedrockFluidVeinSavedData.getOrCreate(serverLevel) + .getFluidVeinWorldEntry(chunk.getPos().x, chunk.getPos().z); if (fluidVein.getDefinition() != null) { - var left = 100 * fluidVein.getOperationsRemaining() / BedrockFluidVeinSavedData.MAXIMUM_VEIN_OPERATIONS; + var left = 100 * fluidVein.getOperationsRemaining() / + BedrockFluidVeinSavedData.MAXIMUM_VEIN_OPERATIONS; storage[0][0] = new FluidInfo[] { - new FluidInfo(fluidVein.getDefinition().getStoredFluid().get(), left, fluidVein.getFluidYield()), + new FluidInfo(fluidVein.getDefinition().getStoredFluid().get(), left, + fluidVein.getFluidYield()), }; } } @@ -200,7 +209,8 @@ public void serialize(FluidInfo item, FriendlyByteBuf buf) { @Override public FluidInfo deserialize(FriendlyByteBuf buf) { - return new FluidInfo(BuiltInRegistries.FLUID.get(new ResourceLocation(buf.readUtf())), buf.readVarInt(), buf.readVarInt()); + return new FluidInfo(BuiltInRegistries.FLUID.get(new ResourceLocation(buf.readUtf())), buf.readVarInt(), + buf.readVarInt()); } @Override @@ -212,7 +222,8 @@ public Class getItemClass() { public void appendTooltips(List items, List tooltips, String selected) { for (var array : items) { for (FluidInfo item : array) { - tooltips.add(Component.translatable(getDescriptionId(item)).append(" --- %s (%s%%)".formatted(item.yield, item.left))); + tooltips.add(Component.translatable(getDescriptionId(item)) + .append(" --- %s (%s%%)".formatted(item.yield, item.left))); } } } @@ -227,7 +238,9 @@ public void drawSpecialGrid(GuiGraphics graphics, FluidInfo[] items, int x, int float drawnV = (float) ProgressTexture.FillDirection.DOWN_TO_UP.getDrawnV(progress); float drawnWidth = (float) ProgressTexture.FillDirection.DOWN_TO_UP.getDrawnWidth(progress); float drawnHeight = (float) ProgressTexture.FillDirection.DOWN_TO_UP.getDrawnHeight(progress); - DrawerHelper.drawFluidForGui(graphics, FluidStack.create(item.fluid(), item.left), 100, (int) (x + drawnU * width), (int) (y + drawnV * height), ((int) (width * drawnWidth)), ((int) (height * drawnHeight))); + DrawerHelper.drawFluidForGui(graphics, FluidStack.create(item.fluid(), item.left), 100, + (int) (x + drawnU * width), (int) (y + drawnV * height), ((int) (width * drawnWidth)), + ((int) (height * drawnHeight))); } } }; @@ -236,15 +249,19 @@ public record OreInfo(Material material, int weight, int left, int yield) { } - public static ProspectorMode BEDROCK_ORE = new ProspectorMode<>("metaitem.prospector.mode.bedrock_ore", 1) { + public static ProspectorMode BEDROCK_ORE = new ProspectorMode<>("metaitem.prospector.mode.bedrock_ore", + 1) { + @Override public void scan(OreInfo[][][] storage, LevelChunk chunk) { if (chunk.getLevel() instanceof ServerLevel serverLevel) { - var oreVein = BedrockOreVeinSavedData.getOrCreate(serverLevel).getOreVeinWorldEntry(chunk.getPos().x, chunk.getPos().z); + var oreVein = BedrockOreVeinSavedData.getOrCreate(serverLevel).getOreVeinWorldEntry(chunk.getPos().x, + chunk.getPos().z); if (oreVein.getDefinition() != null) { var left = 100 * oreVein.getOperationsRemaining() / BedrockOreVeinSavedData.MAXIMUM_VEIN_OPERATIONS; for (var entry : oreVein.getDefinition().materials()) { - storage[0][0] = ArrayUtils.add(storage[0][0], new OreInfo(entry.getFirst(), entry.getSecond(), left, oreVein.getOreYield())); + storage[0][0] = ArrayUtils.add(storage[0][0], + new OreInfo(entry.getFirst(), entry.getSecond(), left, oreVein.getOreYield())); } } } @@ -255,15 +272,19 @@ public int getItemColor(OreInfo item) { return item.material.getMaterialRGB(); } - @Override public IGuiTexture getItemIcon(OreInfo item) { Material material = item.material; - ItemStack stack = ChemicalHelper.get(TagPrefix.get(ConfigHolder.INSTANCE.machines.bedrockOreDropTagPrefix), material); - if (stack.isEmpty()) stack = ChemicalHelper.get(TagPrefix.crushed, material); // backup 1: crushed; if raw ore doesn't exist - if (stack.isEmpty()) stack = ChemicalHelper.get(TagPrefix.gem, material); // backup 2: gem; if crushed ore doesn't exist - if (stack.isEmpty()) stack = ChemicalHelper.get(TagPrefix.ore, material); // backup 3: ore; if gem doesn't exist - if (stack.isEmpty()) stack = ChemicalHelper.get(TagPrefix.dust, material); // backup 4: just fallback to dust... + ItemStack stack = ChemicalHelper.get(TagPrefix.get(ConfigHolder.INSTANCE.machines.bedrockOreDropTagPrefix), + material); + if (stack.isEmpty()) stack = ChemicalHelper.get(TagPrefix.crushed, material); // backup 1: crushed; if raw + // ore doesn't exist + if (stack.isEmpty()) stack = ChemicalHelper.get(TagPrefix.gem, material); // backup 2: gem; if crushed ore + // doesn't exist + if (stack.isEmpty()) stack = ChemicalHelper.get(TagPrefix.ore, material); // backup 3: ore; if gem doesn't + // exist + if (stack.isEmpty()) stack = ChemicalHelper.get(TagPrefix.dust, material); // backup 4: just fallback to + // dust... return new ItemStackTexture(stack).scale(0.8f); } @@ -288,7 +309,9 @@ public void serialize(OreInfo item, FriendlyByteBuf buf) { @Override public OreInfo deserialize(FriendlyByteBuf buf) { ResourceLocation materialId = buf.readResourceLocation(); - return new OreInfo(GTCEuAPI.materialManager.getRegistry(materialId.getNamespace()).get(materialId.getPath()), buf.readVarInt(), buf.readVarInt(), buf.readVarInt()); + return new OreInfo( + GTCEuAPI.materialManager.getRegistry(materialId.getNamespace()).get(materialId.getPath()), + buf.readVarInt(), buf.readVarInt(), buf.readVarInt()); } @Override @@ -302,11 +325,13 @@ public void appendTooltips(List items, List tooltips, Stri int totalWeight = Arrays.stream(array).mapToInt(OreInfo::weight).sum(); for (OreInfo item : array) { float chance = (float) item.weight / totalWeight * 100; - tooltips.add(Component.translatable(getDescriptionId(item)).append(" (").append(Component.translatable("gtceu.gui.content.chance_1", FormattingUtil.formatNumber2Places(chance))).append(") --- %s (%s%%)".formatted(item.yield, item.left))); + tooltips.add(Component.translatable(getDescriptionId(item)).append(" (") + .append(Component.translatable("gtceu.gui.content.chance_1", + FormattingUtil.formatNumber2Places(chance))) + .append(") --- %s (%s%%)".formatted(item.yield, item.left))); } } } - }; public final String unlocalizedName; @@ -318,16 +343,23 @@ public void appendTooltips(List items, List tooltips, Stri } public abstract void scan(T[][][] storage, LevelChunk chunk); + public abstract int getItemColor(T item); + public abstract IGuiTexture getItemIcon(T item); + public abstract String getDescriptionId(T item); + public abstract String getUniqueID(T item); + public abstract void serialize(T item, FriendlyByteBuf buf); + public abstract T deserialize(FriendlyByteBuf buf); + public abstract Class getItemClass(); + public abstract void appendTooltips(List items, List tooltips, String selected); @OnlyIn(Dist.CLIENT) - public void drawSpecialGrid(GuiGraphics graphics, T[] items, int x, int y, int width, int height) { - } + public void drawSpecialGrid(GuiGraphics graphics, T[] items, int x, int y, int width, int height) {} } diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/texture/ProspectingTexture.java b/src/main/java/com/gregtechceu/gtceu/api/gui/texture/ProspectingTexture.java index 3e83359790..1573c570e7 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/texture/ProspectingTexture.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/texture/ProspectingTexture.java @@ -3,39 +3,39 @@ import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.api.gui.misc.PacketProspecting; import com.gregtechceu.gtceu.api.gui.misc.ProspectorMode; -import com.gregtechceu.gtceu.core.mixins.GuiGraphicsAccessor; + import com.lowdragmc.lowdraglib.gui.editor.ColorPattern; import com.lowdragmc.lowdraglib.gui.util.DrawerHelper; import com.lowdragmc.lowdraglib.utils.ColorUtils; -import com.mojang.blaze3d.platform.NativeImage; -import com.mojang.blaze3d.platform.TextureUtil; -import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.blaze3d.vertex.BufferBuilder; -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.Tesselator; -import com.mojang.blaze3d.vertex.VertexFormat; -import lombok.Getter; + import net.minecraft.MethodsReturnNonnullByDefault; -import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.renderer.GameRenderer; -import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.texture.AbstractTexture; import net.minecraft.server.packs.resources.ResourceManager; -import net.minecraft.util.FastColor; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import javax.annotation.ParametersAreNonnullByDefault; +import com.mojang.blaze3d.platform.NativeImage; +import com.mojang.blaze3d.platform.TextureUtil; +import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.BufferBuilder; +import com.mojang.blaze3d.vertex.Tesselator; +import com.mojang.blaze3d.vertex.VertexFormat; +import lombok.Getter; + import java.io.IOException; import java.lang.reflect.Array; +import javax.annotation.ParametersAreNonnullByDefault; + import static com.mojang.blaze3d.vertex.DefaultVertexFormat.POSITION_TEX_COLOR; @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault @OnlyIn(Dist.CLIENT) public class ProspectingTexture extends AbstractTexture { + public static final String SELECTED_ALL = "[all]"; @Getter private String selected = SELECTED_ALL; @@ -53,11 +53,13 @@ public class ProspectingTexture extends AbstractTexture { private final ProspectorMode mode; private final int radius; - public ProspectingTexture(int playerChunkX, int playerChunkZ, int posX, int posZ, float direction, ProspectorMode mode, int radius, boolean darkMode) { + public ProspectingTexture(int playerChunkX, int playerChunkZ, int posX, int posZ, float direction, + ProspectorMode mode, int radius, boolean darkMode) { this.darkMode = darkMode; this.radius = radius; this.mode = mode; - this.data = (Object[][][]) Array.newInstance(mode.getItemClass(), (radius * 2 - 1) * mode.cellSize, (radius * 2 - 1) * mode.cellSize, 0); + this.data = (Object[][][]) Array.newInstance(mode.getItemClass(), (radius * 2 - 1) * mode.cellSize, + (radius * 2 - 1) * mode.cellSize, 0); this.imageWidth = (radius * 2 - 1) * 16; this.imageHeight = (radius * 2 - 1) * 16; this.playerChunkX = playerChunkX; @@ -65,8 +67,6 @@ public ProspectingTexture(int playerChunkX, int playerChunkZ, int posX, int posZ this.direction = (direction + 180) % 360; this.playerXGui = posX - (playerChunkX - this.radius + 1) * 16 + (posX > 0 ? 1 : 0); playerYGui = posZ - (playerChunkZ - this.radius + 1) * 16 + (posX > 0 ? 1 : 0); - - } public void updateTexture(PacketProspecting packet) { @@ -97,7 +97,8 @@ public void updateTexture(PacketProspecting packet) { } for (int x = 0; x < mode.cellSize; x++) { - System.arraycopy(packet.data[x], 0, data[x + currentColumn * mode.cellSize], currentRow * mode.cellSize, mode.cellSize); + System.arraycopy(packet.data[x], 0, data[x + currentColumn * mode.cellSize], currentRow * mode.cellSize, + mode.cellSize); } load(); } @@ -110,11 +111,12 @@ private NativeImage getImage() { var items = this.data[i * mode.cellSize / 16][j * mode.cellSize / 16]; // draw bg image.setPixelRGBA(i, j, (darkMode ? ColorPattern.GRAY.color : ColorPattern.WHITE.color)); - //draw items + // draw items for (var item : items) { if (!selected.equals(SELECTED_ALL) && !selected.equals(mode.getUniqueID(item))) continue; var color = mode.getItemColor(item); - image.setPixelRGBA(i, j, combine(255, ColorUtils.blueI(color), ColorUtils.greenI(color), ColorUtils.redI(color))); + image.setPixelRGBA(i, j, + combine(255, ColorUtils.blueI(color), ColorUtils.greenI(color), ColorUtils.redI(color))); break; } // draw grid @@ -156,7 +158,7 @@ public void draw(GuiGraphics graphics, int x, int y) { bufferbuilder.vertex(matrix4f, x, y, 0).uv(0, 0).color(-1).endVertex(); tessellator.end(); - //draw special grid (e.g. fluid) + // draw special grid (e.g. fluid) for (int cx = 0; cx < radius * 2 - 1; cx++) { for (int cz = 0; cz < radius * 2 - 1; cz++) { if (this.data[cx][cz] != null && this.data[cx][cz].length > 0) { @@ -166,15 +168,16 @@ public void draw(GuiGraphics graphics, int x, int y) { } } - GuiTextures.UP.copy().setColor(ColorPattern.RED.color).rotate(direction / 2).draw(graphics, 0, 0, x + playerXGui - 20, y + playerYGui - 20, 40, 40); + GuiTextures.UP.copy().setColor(ColorPattern.RED.color).rotate(direction / 2).draw(graphics, 0, 0, + x + playerXGui - 20, y + playerYGui - 20, 40, 40); - //draw red vertical line + // draw red vertical line if (playerXGui % 16 > 7 || playerXGui % 16 == 0) { DrawerHelper.drawSolidRect(graphics, x + playerXGui - 1, y, 1, imageHeight, ColorPattern.RED.color); } else { DrawerHelper.drawSolidRect(graphics, x + playerXGui, y, 1, imageHeight, ColorPattern.RED.color); } - //draw red horizontal line + // draw red horizontal line if (playerYGui % 16 > 7 || playerYGui % 16 == 0) { DrawerHelper.drawSolidRect(graphics, x, y + playerYGui - 1, imageWidth, 1, ColorPattern.RED.color); } else { @@ -183,9 +186,7 @@ public void draw(GuiGraphics graphics, int x, int y) { } @Override - public void load(ResourceManager resourceManager) throws IOException { - - } + public void load(ResourceManager resourceManager) throws IOException {} public void setDarkMode(boolean darkMode) { if (this.darkMode != darkMode) { diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/util/TimedProgressSupplier.java b/src/main/java/com/gregtechceu/gtceu/api/gui/util/TimedProgressSupplier.java index 49a4dee3f6..e958d11e59 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/util/TimedProgressSupplier.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/util/TimedProgressSupplier.java @@ -4,34 +4,34 @@ public class TimedProgressSupplier implements DoubleSupplier { - private final int msPerCycle; - private final int maxValue; - private final boolean countDown; - private long startTime; + private final int msPerCycle; + private final int maxValue; + private final boolean countDown; + private long startTime; - public TimedProgressSupplier(int ticksPerCycle, int maxValue, boolean countDown) { - this.msPerCycle = ticksPerCycle * 50; - this.maxValue = maxValue; - this.countDown = countDown; - this.startTime = System.currentTimeMillis(); - } + public TimedProgressSupplier(int ticksPerCycle, int maxValue, boolean countDown) { + this.msPerCycle = ticksPerCycle * 50; + this.maxValue = maxValue; + this.countDown = countDown; + this.startTime = System.currentTimeMillis(); + } - public void resetCountdown() { - startTime = System.currentTimeMillis(); - } + public void resetCountdown() { + startTime = System.currentTimeMillis(); + } - @Override - public double getAsDouble() { - return calculateTime(); - } + @Override + public double getAsDouble() { + return calculateTime(); + } - private double calculateTime() { - long currentTime = System.currentTimeMillis(); - long msPassed = (currentTime - startTime) % msPerCycle; - double currentValue = (1.0 * msPassed * maxValue) / msPerCycle; - if (countDown) { - return (maxValue - currentValue) / maxValue; - } - return currentValue / maxValue; + private double calculateTime() { + long currentTime = System.currentTimeMillis(); + long msPassed = (currentTime - startTime) % msPerCycle; + double currentValue = (1.0 * msPassed * maxValue) / msPerCycle; + if (countDown) { + return (maxValue - currentValue) / maxValue; } - } \ No newline at end of file + return currentValue / maxValue; + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/BlockableSlotWidget.java b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/BlockableSlotWidget.java index 0e16c8a938..00c6bb89d1 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/BlockableSlotWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/BlockableSlotWidget.java @@ -1,13 +1,14 @@ package com.gregtechceu.gtceu.api.gui.widget; -import com.lowdragmc.lowdraglib.gui.util.DrawerHelper; import com.lowdragmc.lowdraglib.gui.widget.SlotWidget; import com.lowdragmc.lowdraglib.side.item.IItemTransfer; import com.lowdragmc.lowdraglib.utils.Position; import com.lowdragmc.lowdraglib.utils.Size; -import com.mojang.blaze3d.systems.RenderSystem; + import net.minecraft.client.gui.GuiGraphics; import net.minecraft.world.Container; + +import com.mojang.blaze3d.systems.RenderSystem; import org.jetbrains.annotations.NotNull; import java.util.function.BooleanSupplier; @@ -50,7 +51,8 @@ public void drawInBackground(@NotNull GuiGraphics graphics, int mouseX, int mous Size size = getSize(); RenderSystem.disableDepthTest(); RenderSystem.colorMask(true, true, true, false); - graphics.fill(pos.getX() + 1, pos.getY() + 1, pos.getX() + 1 + size.getWidth() - 2, pos.getY() + 1 + size.getHeight() - 2, OVERLAY_COLOR); + graphics.fill(pos.getX() + 1, pos.getY() + 1, pos.getX() + 1 + size.getWidth() - 2, + pos.getY() + 1 + size.getHeight() - 2, OVERLAY_COLOR); RenderSystem.colorMask(true, true, true, true); RenderSystem.enableDepthTest(); RenderSystem.enableBlend(); @@ -62,4 +64,4 @@ public boolean isMouseOverElement(double mouseX, double mouseY) { // prevent slot removal and hover highlighting when slot is blocked return super.isMouseOverElement(mouseX, mouseY) && !isBlocked.getAsBoolean(); } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/CoverConfigurator.java b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/CoverConfigurator.java index 8b6f75d82d..a7253922ed 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/CoverConfigurator.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/CoverConfigurator.java @@ -6,28 +6,30 @@ import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.api.gui.fancy.IFancyConfigurator; import com.gregtechceu.gtceu.common.data.GTItems; -import com.gregtechceu.gtceu.config.ConfigHolder; -import com.lowdragmc.lowdraglib.gui.animation.Transform; + import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.texture.ItemStackTexture; import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.utils.Position; import com.lowdragmc.lowdraglib.utils.Size; -import lombok.AllArgsConstructor; + import net.minecraft.core.Direction; import net.minecraft.network.chat.Component; +import lombok.AllArgsConstructor; import org.jetbrains.annotations.Nullable; @AllArgsConstructor public class CoverConfigurator implements IFancyConfigurator { + protected final ICoverable coverable; // runtime @Nullable protected final Direction side; @Nullable protected final CoverBehavior coverBehavior; + @Override public Component getTitle() { return Component.translatable("gtceu.gui.cover_setting.title"); @@ -47,7 +49,8 @@ public Widget createConfigurator() { coverConfigurator.setBackground(GuiTextures.BACKGROUND); coverConfigurator.setSelfPosition(new Position(4, -4)); group.addWidget(coverConfigurator); - group.setSize(new Size(Math.max(120, coverConfigurator.getSize().width + 8), Math.max(80, 80 + coverConfigurator.getSize().height))); + group.setSize(new Size(Math.max(120, coverConfigurator.getSize().width + 8), + Math.max(80, 80 + coverConfigurator.getSize().height))); } } return group; diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/DualProgressWidget.java b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/DualProgressWidget.java index 976ce1dccc..668e61c1eb 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/DualProgressWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/DualProgressWidget.java @@ -8,6 +8,7 @@ import com.lowdragmc.lowdraglib.gui.editor.configurator.WrapperConfigurator; import com.lowdragmc.lowdraglib.gui.widget.ProgressWidget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; + import lombok.Getter; import lombok.experimental.Accessors; @@ -16,9 +17,10 @@ @LDLRegister(name = "dual_progress", group = "widget.group") @Accessors(chain = true) public class DualProgressWidget extends WidgetGroup { + private DoubleSupplier progressSupplier; @Configurable - @NumberRange(range = {0.001, 1.0}, wheel = 0.01) + @NumberRange(range = { 0.001, 1.0 }, wheel = 0.01) private double splitPoint; @Configurable(subConfigurable = true) @Getter @@ -32,27 +34,33 @@ public DualProgressWidget() { } public DualProgressWidget(DoubleSupplier progress, double splitPoint) { - this(new ProgressWidget(ProgressWidget.JEIProgress, 0, 0, 16, 16), new ProgressWidget(ProgressWidget.JEIProgress, 16, 0, 16, 16), progress, splitPoint); + this(new ProgressWidget(ProgressWidget.JEIProgress, 0, 0, 16, 16), + new ProgressWidget(ProgressWidget.JEIProgress, 16, 0, 16, 16), progress, splitPoint); } - public DualProgressWidget(ProgressWidget texture1, ProgressWidget texture2, DoubleSupplier progress, double splitPoint) { + public DualProgressWidget(ProgressWidget texture1, ProgressWidget texture2, DoubleSupplier progress, + double splitPoint) { this.progressSupplier = progress; this.splitPoint = splitPoint; - this.texture1 = texture1.setProgressSupplier(() -> progress.getAsDouble() >= splitPoint ? 1.0 : (1.0 / splitPoint) * progress.getAsDouble()); - this.texture2 = texture2.setProgressSupplier(() -> progress.getAsDouble() >= splitPoint ? (1.0 / (1 - splitPoint)) * (progress.getAsDouble() - splitPoint) : 0); + this.texture1 = texture1.setProgressSupplier( + () -> progress.getAsDouble() >= splitPoint ? 1.0 : (1.0 / splitPoint) * progress.getAsDouble()); + this.texture2 = texture2.setProgressSupplier(() -> progress.getAsDouble() >= splitPoint ? + (1.0 / (1 - splitPoint)) * (progress.getAsDouble() - splitPoint) : 0); this.addWidget(this.texture1).addWidget(this.texture2); } public DualProgressWidget setTexture1(ProgressWidget widget) { this.removeWidget(texture1); - this.texture1 = widget.setProgressSupplier(() -> progressSupplier.getAsDouble() >= splitPoint ? 1.0 : (1.0 / splitPoint) * progressSupplier.getAsDouble()); + this.texture1 = widget.setProgressSupplier(() -> progressSupplier.getAsDouble() >= splitPoint ? 1.0 : + (1.0 / splitPoint) * progressSupplier.getAsDouble()); this.addWidget(texture1); return this; } public DualProgressWidget setTexture2(ProgressWidget widget) { this.removeWidget(texture2); - this.texture2 = widget.setProgressSupplier(() -> progressSupplier.getAsDouble() >= splitPoint ? (1.0 / (1 - splitPoint)) * (progressSupplier.getAsDouble() - splitPoint) : 0); + this.texture2 = widget.setProgressSupplier(() -> progressSupplier.getAsDouble() >= splitPoint ? + (1.0 / (1 - splitPoint)) * (progressSupplier.getAsDouble() - splitPoint) : 0); this.addWidget(texture2); return this; } @@ -61,9 +69,11 @@ public DualProgressWidget setProgressSupplier(DoubleSupplier progressSupplier) { this.progressSupplier = progressSupplier; this.widgets.clear(); - this.texture1.setProgressSupplier(() -> progressSupplier.getAsDouble() >= splitPoint ? 1.0 : (1.0 / splitPoint) * progressSupplier.getAsDouble()); + this.texture1.setProgressSupplier(() -> progressSupplier.getAsDouble() >= splitPoint ? 1.0 : + (1.0 / splitPoint) * progressSupplier.getAsDouble()); this.addWidget(texture1); - this.texture2.setProgressSupplier(() -> progressSupplier.getAsDouble() >= splitPoint ? (1.0 / (1 - splitPoint)) * (progressSupplier.getAsDouble() - splitPoint) : 0); + this.texture2.setProgressSupplier(() -> progressSupplier.getAsDouble() >= splitPoint ? + (1.0 / (1 - splitPoint)) * (progressSupplier.getAsDouble() - splitPoint) : 0); this.addWidget(texture2); return this; @@ -73,9 +83,11 @@ public DualProgressWidget setSplitPoint(double splitPoint) { this.splitPoint = splitPoint; this.widgets.clear(); - this.texture1.setProgressSupplier(() -> progressSupplier.getAsDouble() >= splitPoint ? 1.0 : (1.0 / splitPoint) * progressSupplier.getAsDouble()); + this.texture1.setProgressSupplier(() -> progressSupplier.getAsDouble() >= splitPoint ? 1.0 : + (1.0 / splitPoint) * progressSupplier.getAsDouble()); this.addWidget(texture1); - this.texture2.setProgressSupplier(() -> progressSupplier.getAsDouble() >= splitPoint ? (1.0 / (1 - splitPoint)) * (progressSupplier.getAsDouble() - splitPoint) : 0); + this.texture2.setProgressSupplier(() -> progressSupplier.getAsDouble() >= splitPoint ? + (1.0 / (1 - splitPoint)) * (progressSupplier.getAsDouble() - splitPoint) : 0); this.addWidget(texture2); return this; @@ -94,7 +106,8 @@ public void buildConfigurator(ConfiguratorGroup father) { } private boolean setConfiguratorIfProgress(Configurator configurator) { - if (configurator instanceof WrapperConfigurator guiConfigurator && guiConfigurator.inner instanceof ProgressWidget progressWidget) { + if (configurator instanceof WrapperConfigurator guiConfigurator && + guiConfigurator.inner instanceof ProgressWidget progressWidget) { if (configurator.getName().equals("texture1")) { this.setTexture1(progressWidget); return true; diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/EnumSelectorWidget.java b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/EnumSelectorWidget.java index 76072e4a14..6e68b2d5bc 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/EnumSelectorWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/EnumSelectorWidget.java @@ -2,23 +2,26 @@ import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.data.lang.LangHandler; + import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup; import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.widget.CycleButtonWidget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; + import org.jetbrains.annotations.NotNull; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.Arrays; import java.util.List; import java.util.NoSuchElementException; import java.util.function.BiFunction; import java.util.function.Consumer; +import javax.annotation.ParametersAreNonnullByDefault; /** * A widget for selecting a value from an enum or a subset of its values. @@ -26,13 +29,14 @@ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class EnumSelectorWidget & EnumSelectorWidget.SelectableEnum> extends WidgetGroup { + public interface SelectableEnum { + String getTooltip(); IGuiTexture getIcon(); } - private final CycleButtonWidget buttonWidget; private final List values; @@ -40,25 +44,26 @@ public interface SelectableEnum { private int selected = 0; + private BiFunction textureSupplier = (value, texture) -> new GuiTextureGroup( + GuiTextures.VANILLA_BUTTON, texture); - private BiFunction textureSupplier = (value, texture) -> - new GuiTextureGroup(GuiTextures.VANILLA_BUTTON, texture); - - private BiFunction> tooltipSupplier = (value, key) -> - List.copyOf(LangHandler.getSingleOrMultiLang(key)); - + private BiFunction> tooltipSupplier = (value, key) -> List + .copyOf(LangHandler.getSingleOrMultiLang(key)); - public EnumSelectorWidget(int xPosition, int yPosition, int width, int height, T[] values, T initialValue, Consumer onChanged) { + public EnumSelectorWidget(int xPosition, int yPosition, int width, int height, T[] values, T initialValue, + Consumer onChanged) { this(xPosition, yPosition, width, height, Arrays.asList(values), initialValue, onChanged); } - public EnumSelectorWidget(int xPosition, int yPosition, int width, int height, List values, T initialValue, Consumer onChanged) { + public EnumSelectorWidget(int xPosition, int yPosition, int width, int height, List values, T initialValue, + Consumer onChanged) { super(xPosition, yPosition, width, height); this.values = values; this.onChanged = onChanged; - this.buttonWidget = new CycleButtonWidget(0, 0, width, height, values.size(), this::getTexture, this::onSelected); + this.buttonWidget = new CycleButtonWidget(0, 0, width, height, values.size(), this::getTexture, + this::onSelected); this.addWidget(buttonWidget); setSelected(initialValue); diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/ExtendedProgressWidget.java b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/ExtendedProgressWidget.java index 1f423213e9..80bbda0ad4 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/ExtendedProgressWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/ExtendedProgressWidget.java @@ -3,12 +3,14 @@ import com.lowdragmc.lowdraglib.gui.texture.ProgressTexture; import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; import com.lowdragmc.lowdraglib.gui.widget.ProgressWidget; -import lombok.Setter; -import lombok.experimental.Accessors; + import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; import net.minecraft.world.item.ItemStack; + +import lombok.Setter; +import lombok.experimental.Accessors; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; @@ -16,9 +18,9 @@ import java.util.function.Consumer; import java.util.function.DoubleSupplier; - @Accessors(chain = true) public class ExtendedProgressWidget extends ProgressWidget { + private List serverTooltips = new ArrayList<>(); @Setter private Consumer> serverTooltipSupplier; @@ -27,11 +29,13 @@ public ExtendedProgressWidget() { super(JEIProgress, 0, 0, 40, 40, new ProgressTexture()); } - public ExtendedProgressWidget(DoubleSupplier progressSupplier, int x, int y, int width, int height, ResourceTexture fullImage) { + public ExtendedProgressWidget(DoubleSupplier progressSupplier, int x, int y, int width, int height, + ResourceTexture fullImage) { super(progressSupplier, x, y, width, height, fullImage); } - public ExtendedProgressWidget(DoubleSupplier progressSupplier, int x, int y, int width, int height, ProgressTexture progressBar) { + public ExtendedProgressWidget(DoubleSupplier progressSupplier, int x, int y, int width, int height, + ProgressTexture progressBar) { super(progressSupplier, x, y, width, height, progressBar); } @@ -74,7 +78,8 @@ public void readUpdateInfo(int id, FriendlyByteBuf buffer) { @Override public void drawInForeground(@NotNull GuiGraphics graphics, int mouseX, int mouseY, float partialTicks) { - if ((!tooltipTexts.isEmpty() || !serverTooltips.isEmpty()) && isMouseOverElement(mouseX, mouseY) && getHoverElement(mouseX, mouseY) == this && gui != null && gui.getModularUIGui() != null) { + if ((!tooltipTexts.isEmpty() || !serverTooltips.isEmpty()) && isMouseOverElement(mouseX, mouseY) && + getHoverElement(mouseX, mouseY) == this && gui != null && gui.getModularUIGui() != null) { var tips = new ArrayList<>(tooltipTexts); tips.addAll(serverTooltips); gui.getModularUIGui().setHoverTooltip(tips, ItemStack.EMPTY, null, null); diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/GhostCircuitSlotWidget.java b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/GhostCircuitSlotWidget.java index 83688ec1cb..b3afd2b831 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/GhostCircuitSlotWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/GhostCircuitSlotWidget.java @@ -3,16 +3,18 @@ import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.common.item.IntCircuitBehaviour; import com.gregtechceu.gtceu.config.ConfigHolder; + import com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup; import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.texture.ItemStackTexture; import com.lowdragmc.lowdraglib.gui.widget.*; import com.lowdragmc.lowdraglib.side.item.IItemTransfer; -import lombok.Getter; -import lombok.Setter; + import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.world.item.ItemStack; + +import lombok.Getter; import org.jetbrains.annotations.Nullable; /** @@ -25,7 +27,7 @@ public class GhostCircuitSlotWidget extends SlotWidget { private static final int SET_TO_N = 3; private static final int NO_CONFIG = -1; - + @Getter private IItemTransfer circuitInventory; @Nullable @@ -141,26 +143,48 @@ public void handleClientAction(int id, FriendlyByteBuf buffer) { } } - public Widget createConfigurator() { var group = new WidgetGroup(0, 0, 174, 132); group.addWidget(new LabelWidget(9, 8, "Programmed Circuit Configuration")); - group.addWidget(new SlotWidget(this.circuitInventory, 0, (group.getSize().width - 18) / 2, 20, !ConfigHolder.INSTANCE.machines.ghostCircuit, !ConfigHolder.INSTANCE.machines.ghostCircuit) - .setBackground(new GuiTextureGroup(GuiTextures.SLOT, GuiTextures.INT_CIRCUIT_OVERLAY))); + group.addWidget(new SlotWidget(this.circuitInventory, 0, (group.getSize().width - 18) / 2, 20, + !ConfigHolder.INSTANCE.machines.ghostCircuit, !ConfigHolder.INSTANCE.machines.ghostCircuit) + .setBackground(new GuiTextureGroup(GuiTextures.SLOT, GuiTextures.INT_CIRCUIT_OVERLAY))); if (ConfigHolder.INSTANCE.machines.ghostCircuit) { group.addWidget(new ButtonWidget((group.getSize().width - 18) / 2, 20, 18, 18, IGuiTexture.EMPTY, - clickData -> { - if (!clickData.isRemote) { - circuitInventory.setStackInSlot(0, ItemStack.EMPTY); - circuitInventory.onContentsChanged(); - } - })); + clickData -> { + if (!clickData.isRemote) { + circuitInventory.setStackInSlot(0, ItemStack.EMPTY); + circuitInventory.onContentsChanged(); + } + })); } int idx = 0; - for(int x = 0; x <= 2; x++) { - for(int y = 0; y <= 8; y++) { + for (int x = 0; x <= 2; x++) { + for (int y = 0; y <= 8; y++) { int finalIdx = idx; - group.addWidget(new ButtonWidget(5 + (18 * y), 48 + (18 * x), 18, 18, new GuiTextureGroup(GuiTextures.SLOT, new ItemStackTexture(IntCircuitBehaviour.stack(finalIdx)).scale(16f / 18)), + group.addWidget(new ButtonWidget(5 + (18 * y), 48 + (18 * x), 18, 18, + new GuiTextureGroup(GuiTextures.SLOT, + new ItemStackTexture(IntCircuitBehaviour.stack(finalIdx)).scale(16f / 18)), + clickData -> { + if (!clickData.isRemote) { + ItemStack stack = circuitInventory.getStackInSlot(0).copy(); + if (IntCircuitBehaviour.isIntegratedCircuit(stack)) { + IntCircuitBehaviour.setCircuitConfiguration(stack, finalIdx); + circuitInventory.setStackInSlot(0, stack); + } else if (ConfigHolder.INSTANCE.machines.ghostCircuit) { + circuitInventory.setStackInSlot(0, IntCircuitBehaviour.stack(finalIdx)); + } + circuitInventory.onContentsChanged(); + } + })); + idx++; + } + } + for (int x = 0; x <= 5; x++) { + int finalIdx = x + 27; + group.addWidget(new ButtonWidget(5 + (18 * x), 102, 18, 18, + new GuiTextureGroup(GuiTextures.SLOT, + new ItemStackTexture(IntCircuitBehaviour.stack(finalIdx)).scale(16f / 18)), clickData -> { if (!clickData.isRemote) { ItemStack stack = circuitInventory.getStackInSlot(0).copy(); @@ -173,26 +197,8 @@ public Widget createConfigurator() { circuitInventory.onContentsChanged(); } })); - idx++; - } - } - for(int x = 0; x <= 5; x++) { - int finalIdx = x + 27; - group.addWidget(new ButtonWidget(5 + (18 * x), 102, 18, 18, new GuiTextureGroup(GuiTextures.SLOT, new ItemStackTexture(IntCircuitBehaviour.stack(finalIdx)).scale(16f / 18)), - clickData -> { - if (!clickData.isRemote) { - ItemStack stack = circuitInventory.getStackInSlot(0).copy(); - if (IntCircuitBehaviour.isIntegratedCircuit(stack)) { - IntCircuitBehaviour.setCircuitConfiguration(stack, finalIdx); - circuitInventory.setStackInSlot(0, stack); - } else if (ConfigHolder.INSTANCE.machines.ghostCircuit) { - circuitInventory.setStackInSlot(0, IntCircuitBehaviour.stack(finalIdx)); - } - circuitInventory.onContentsChanged(); - } - })); } group.setBackground(GuiTextures.BACKGROUND); return group; } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/IntInputWidget.java b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/IntInputWidget.java index fba325ec55..887c9c9f6a 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/IntInputWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/IntInputWidget.java @@ -3,6 +3,7 @@ import com.lowdragmc.lowdraglib.gui.widget.TextFieldWidget; import com.lowdragmc.lowdraglib.utils.Position; import com.lowdragmc.lowdraglib.utils.Size; + import net.minecraft.util.Mth; import java.util.function.Consumer; @@ -12,8 +13,8 @@ * A widget containing an integer input field, as well as adjacent buttons for increasing or decreasing the value. * *

- * The buttons' change amount can be altered with Ctrl, Shift, or both.
- * The input is limited by a minimum and maximum value. + * The buttons' change amount can be altered with Ctrl, Shift, or both.
+ * The input is limited by a minimum and maximum value. *

*/ public class IntInputWidget extends NumberInputWidget { @@ -30,7 +31,8 @@ public IntInputWidget(Position position, Size size, Supplier valueSuppl super(position, size, valueSupplier, onChanged); } - public IntInputWidget(int x, int y, int width, int height, Supplier valueSupplier, Consumer onChanged) { + public IntInputWidget(int x, int y, int width, int height, Supplier valueSupplier, + Consumer onChanged) { super(x, y, width, height, valueSupplier, onChanged); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/LongInputWidget.java b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/LongInputWidget.java index 0503341430..e7a761a277 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/LongInputWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/LongInputWidget.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.api.gui.widget; import com.gregtechceu.gtceu.utils.GTMath; + import com.lowdragmc.lowdraglib.gui.widget.TextFieldWidget; import com.lowdragmc.lowdraglib.utils.Position; import com.lowdragmc.lowdraglib.utils.Size; @@ -12,11 +13,12 @@ * A widget containing an integer input field, as well as adjacent buttons for increasing or decreasing the value. * *

- * The buttons' change amount can be altered with Ctrl, Shift, or both.
- * The input is limited by a minimum and maximum value. + * The buttons' change amount can be altered with Ctrl, Shift, or both.
+ * The input is limited by a minimum and maximum value. *

*/ public class LongInputWidget extends NumberInputWidget { + public LongInputWidget(Supplier valueSupplier, Consumer onChanged) { super(valueSupplier, onChanged); } @@ -29,7 +31,8 @@ public LongInputWidget(Position position, Size size, Supplier valueSupplie super(position, size, valueSupplier, onChanged); } - public LongInputWidget(int x, int y, int width, int height, Supplier valueSupplier, Consumer onChanged) { + public LongInputWidget(int x, int y, int width, int height, Supplier valueSupplier, + Consumer onChanged) { super(x, y, width, height, valueSupplier, onChanged); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/NumberInputWidget.java b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/NumberInputWidget.java index 5de5ae3216..59400619f4 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/NumberInputWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/NumberInputWidget.java @@ -2,6 +2,7 @@ import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.utils.GTUtil; + import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup; import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; @@ -12,11 +13,13 @@ import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.utils.Position; import com.lowdragmc.lowdraglib.utils.Size; -import lombok.Getter; + import net.minecraft.client.Minecraft; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.util.Mth; +import lombok.Getter; + import java.util.function.Consumer; import java.util.function.Supplier; @@ -29,6 +32,7 @@ *

*/ public abstract class NumberInputWidget extends WidgetGroup { + protected abstract T defaultMin(); protected abstract T defaultMax(); @@ -37,8 +41,7 @@ public abstract class NumberInputWidget extends WidgetGroup { protected abstract T fromText(String value); - protected record ChangeValues(T regular, T shift, T ctrl, T ctrlShift) { - } + protected record ChangeValues(T regular, T shift, T ctrl, T ctrlShift) {} protected abstract ChangeValues getChangeValues(); @@ -52,9 +55,8 @@ protected record ChangeValues(T regular, T shift, T ctrl, T ct protected abstract T getOne(boolean positive); - ///////////////////////////////////////////////// - //*********** IMPLEMENTATION ***********// + // *********** IMPLEMENTATION ***********// ///////////////////////////////////////////////// private final ChangeValues CHANGE_VALUES = getChangeValues(); @@ -72,7 +74,6 @@ protected record ChangeValues(T regular, T shift, T ctrl, T ct private TextFieldWidget textField; - public NumberInputWidget(Supplier valueSupplier, Consumer onChanged) { this(0, 0, 100, 20, valueSupplier, onChanged); } @@ -116,22 +117,17 @@ private void buildUI() { this.addWidget(new ButtonWidget(0, 0, buttonWidth, 20, new GuiTextureGroup(GuiTextures.VANILLA_BUTTON, getButtonTexture("-", buttonWidth)), - this::decrease - ).setHoverTooltips("gui.widget.incrementButton.default_tooltip")); - + this::decrease).setHoverTooltips("gui.widget.incrementButton.default_tooltip")); this.textField = new TextFieldWidget(buttonWidth + 2, 0, textFieldWidth, 20, () -> toText(valueSupplier.get()), - stringValue -> this.setValue(clamp(fromText(stringValue), min, max)) - ); + stringValue -> this.setValue(clamp(fromText(stringValue), min, max))); this.updateTextFieldRange(); this.addWidget(this.textField); - this.addWidget(new ButtonWidget(buttonWidth + textFieldWidth + 4, 0, buttonWidth, 20, new GuiTextureGroup(GuiTextures.VANILLA_BUTTON, getButtonTexture("+", buttonWidth)), - this::increase - ).setHoverTooltips("gui.widget.incrementButton.default_tooltip")); + this::increase).setHoverTooltips("gui.widget.incrementButton.default_tooltip")); } private IGuiTexture getButtonTexture(String prefix, int buttonWidth) { diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/PatternPreviewWidget.java b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/PatternPreviewWidget.java index c4dbcef358..326ca92de9 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/PatternPreviewWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/PatternPreviewWidget.java @@ -1,16 +1,17 @@ package com.gregtechceu.gtceu.api.gui.widget; import com.gregtechceu.gtceu.GTCEu; -import com.gregtechceu.gtceu.api.gui.GuiTextures; -import com.gregtechceu.gtceu.api.machine.MultiblockMachineDefinition; -import com.gregtechceu.gtceu.api.pattern.BlockPattern; import com.gregtechceu.gtceu.api.block.MetaMachineBlock; +import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; +import com.gregtechceu.gtceu.api.machine.MultiblockMachineDefinition; import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiController; +import com.gregtechceu.gtceu.api.pattern.BlockPattern; import com.gregtechceu.gtceu.api.pattern.MultiblockShapeInfo; import com.gregtechceu.gtceu.api.pattern.TraceabilityPredicate; import com.gregtechceu.gtceu.api.pattern.predicates.SimplePredicate; import com.gregtechceu.gtceu.config.ConfigHolder; + import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.gui.editor.ColorPattern; import com.lowdragmc.lowdraglib.gui.texture.*; @@ -20,13 +21,7 @@ import com.lowdragmc.lowdraglib.utils.CycleItemStackHandler; import com.lowdragmc.lowdraglib.utils.ItemStackKey; import com.lowdragmc.lowdraglib.utils.TrackedDummyWorld; -import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.blaze3d.vertex.PoseStack; -import dev.emi.emi.screen.RecipeScreen; -import it.unimi.dsi.fastutil.longs.LongSet; -import it.unimi.dsi.fastutil.longs.LongSets; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; -import me.shedaniel.rei.impl.client.gui.screen.AbstractDisplayViewingScreen; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.core.BlockPos; @@ -39,6 +34,13 @@ import net.minecraft.world.level.material.Fluid; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + +import com.mojang.blaze3d.systems.RenderSystem; +import dev.emi.emi.screen.RecipeScreen; +import it.unimi.dsi.fastutil.longs.LongSet; +import it.unimi.dsi.fastutil.longs.LongSets; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import me.shedaniel.rei.impl.client.gui.screen.AbstractDisplayViewingScreen; import org.jetbrains.annotations.NotNull; import java.util.*; @@ -53,6 +55,7 @@ */ @OnlyIn(Dist.CLIENT) public class PatternPreviewWidget extends WidgetGroup { + private boolean isLoaded; private static TrackedDummyWorld LEVEL; private static BlockPos LAST_POS = new BlockPos(0, 50, 0); @@ -80,10 +83,10 @@ protected PatternPreviewWidget(MultiblockMachineDefinition controllerDefinition) .setRenderFacing(false)); scrollableWidgetGroup = new DraggableScrollableWidgetGroup(3, 132, 154, 22) - .setXScrollBarHeight(4) - .setXBarStyle(GuiTextures.SLIDER_BACKGROUND, GuiTextures.BUTTON) - .setScrollable(true) - .setDraggable(true); + .setXScrollBarHeight(4) + .setXBarStyle(GuiTextures.SLIDER_BACKGROUND, GuiTextures.BUTTON) + .setScrollable(true) + .setDraggable(true); scrollableWidgetGroup.setScrollYOffset(0); addWidget(scrollableWidgetGroup); @@ -142,12 +145,15 @@ private void updateLayer() { } private void setupScene(MBPattern pattern) { - Stream stream = pattern.blockMap.keySet().stream().filter(pos -> layer == -1 || layer + pattern.minY == pos.getY()); + Stream stream = pattern.blockMap.keySet().stream() + .filter(pos -> layer == -1 || layer + pattern.minY == pos.getY()); if (pattern.controllerBase.isFormed()) { - LongSet set = pattern.controllerBase.getMultiblockState().getMatchContext().getOrDefault("renderMask", LongSets.EMPTY_SET); + LongSet set = pattern.controllerBase.getMultiblockState().getMatchContext().getOrDefault("renderMask", + LongSets.EMPTY_SET); Set modelDisabled = set.stream().map(BlockPos::of).collect(Collectors.toSet()); if (!modelDisabled.isEmpty()) { - sceneWidget.setRenderedCore(stream.filter(pos->!modelDisabled.contains(pos)).collect(Collectors.toList()), null); + sceneWidget.setRenderedCore( + stream.filter(pos -> !modelDisabled.contains(pos)).collect(Collectors.toList()), null); } else { sceneWidget.setRenderedCore(stream.toList(), null); } @@ -227,7 +233,8 @@ private void onPosSelected(BlockPos pos, Direction facing) { int maxCol = (160 - (((slotWidgets.length - 1) / 9 + 1) * 18) - 35) % 18; for (int i = 0; i < candidateStacks.size(); i++) { int finalI = i; - candidates[i] = new SlotWidget(itemHandler, i, 3 + (i / maxCol) * 18, 3 + (i % maxCol) * 18, false, false) + candidates[i] = new SlotWidget(itemHandler, i, 3 + (i / maxCol) * 18, 3 + (i % maxCol) * 18, false, + false) .setIngredientIO(IngredientIO.INPUT) .setBackgroundTexture(new ColorRectTexture(0x4fffffff)) .setOnAddedTooltips((slot, list) -> list.addAll(predicateTips.get(finalI))); @@ -249,10 +256,11 @@ public void updateScreen() { if (!isLoaded && LDLib.isEmiLoaded() && Minecraft.getInstance().screen instanceof RecipeScreen) { setPage(0); isLoaded = true; - } else if (!isLoaded && LDLib.isReiLoaded() && Minecraft.getInstance().screen instanceof AbstractDisplayViewingScreen) { - setPage(0); - isLoaded = true; - } + } else if (!isLoaded && LDLib.isReiLoaded() && + Minecraft.getInstance().screen instanceof AbstractDisplayViewingScreen) { + setPage(0); + isLoaded = true; + } } @Override @@ -274,8 +282,8 @@ private MBPattern initializePattern(MultiblockShapeInfo shapeInfo, HashSet !list.isEmpty()).collect(Collectors.toList()), predicateMap, controllerBase); + }).map(PartInfo::getItemStack).filter(list -> !list.isEmpty()).collect(Collectors.toList()), predicateMap, + controllerBase); } private void loadControllerFormed(Collection poses, IMultiController controllerBase) { @@ -313,10 +322,12 @@ private void loadControllerFormed(Collection poses, IMultiController c controllerBase.onStructureFormed(); } if (controllerBase.isFormed()) { - LongSet set = controllerBase.getMultiblockState().getMatchContext().getOrDefault("renderMask", LongSets.EMPTY_SET); + LongSet set = controllerBase.getMultiblockState().getMatchContext().getOrDefault("renderMask", + LongSets.EMPTY_SET); Set modelDisabled = set.stream().map(BlockPos::of).collect(Collectors.toSet()); if (!modelDisabled.isEmpty()) { - sceneWidget.setRenderedCore(poses.stream().filter(pos->!modelDisabled.contains(pos)).collect(Collectors.toList()), null); + sceneWidget.setRenderedCore( + poses.stream().filter(pos -> !modelDisabled.contains(pos)).collect(Collectors.toList()), null); } else { sceneWidget.setRenderedCore(poses, null); } @@ -344,6 +355,7 @@ private Map gatherBlockDrops(Map bl } private static class PartInfo { + final ItemStackKey itemStackKey; boolean isController = false; boolean isTile = false; @@ -372,6 +384,7 @@ public List getItemStack() { } private static class MBPattern { + @NotNull final List> parts; @NotNull @@ -382,7 +395,9 @@ private static class MBPattern { final IMultiController controllerBase; final int maxY, minY; - public MBPattern(@NotNull Map blockMap, @NotNull List> parts, @NotNull Map predicateMap, @NotNull IMultiController controllerBase) { + public MBPattern(@NotNull Map blockMap, @NotNull List> parts, + @NotNull Map predicateMap, + @NotNull IMultiController controllerBase) { this.parts = parts; this.blockMap = blockMap; this.predicateMap = predicateMap; diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/PredicatedButtonWidget.java b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/PredicatedButtonWidget.java index 904c845b41..19fbb69a7e 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/PredicatedButtonWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/PredicatedButtonWidget.java @@ -3,6 +3,7 @@ import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.util.ClickData; import com.lowdragmc.lowdraglib.gui.widget.ButtonWidget; + import net.minecraft.network.FriendlyByteBuf; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -16,19 +17,23 @@ * @implNote DisplayButtonWidget */ public class PredicatedButtonWidget extends ButtonWidget { + private final BooleanSupplier predicate; - public PredicatedButtonWidget(int xPosition, int yPosition, int width, int height, IGuiTexture buttonTexture, Consumer onPressed, BooleanSupplier predicate, boolean defaultVisibility) { + public PredicatedButtonWidget(int xPosition, int yPosition, int width, int height, IGuiTexture buttonTexture, + Consumer onPressed, BooleanSupplier predicate, boolean defaultVisibility) { super(xPosition, yPosition, width, height, buttonTexture, onPressed); this.predicate = predicate; setVisible(defaultVisibility); } - public PredicatedButtonWidget(int xPosition, int yPosition, int width, int height, IGuiTexture buttonTexture, Consumer onPressed, BooleanSupplier predicate) { + public PredicatedButtonWidget(int xPosition, int yPosition, int width, int height, IGuiTexture buttonTexture, + Consumer onPressed, BooleanSupplier predicate) { this(xPosition, yPosition, width, height, buttonTexture, onPressed, predicate, false); } - public PredicatedButtonWidget(int xPosition, int yPosition, int width, int height, Consumer onPressed, BooleanSupplier predicate) { + public PredicatedButtonWidget(int xPosition, int yPosition, int width, int height, Consumer onPressed, + BooleanSupplier predicate) { super(xPosition, yPosition, width, height, onPressed); this.predicate = predicate; } @@ -67,5 +72,4 @@ public void readUpdateInfo(int id, FriendlyByteBuf buffer) { super.readUpdateInfo(id, buffer); } } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/PredicatedImageWidget.java b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/PredicatedImageWidget.java index cf5191d3ce..8f92e3844a 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/PredicatedImageWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/PredicatedImageWidget.java @@ -2,12 +2,14 @@ import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.widget.ImageWidget; -import lombok.Setter; -import lombok.experimental.Accessors; + import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.FriendlyByteBuf; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + +import lombok.Setter; +import lombok.experimental.Accessors; import org.jetbrains.annotations.NotNull; import java.util.function.BooleanSupplier; @@ -19,6 +21,7 @@ */ @Accessors(chain = true) public class PredicatedImageWidget extends ImageWidget { + @Setter private BooleanSupplier predicate; private boolean isVisible = true; diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/ProspectingMapWidget.java b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/ProspectingMapWidget.java index 5ea7c28194..8bc48bed5a 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/ProspectingMapWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/ProspectingMapWidget.java @@ -6,14 +6,14 @@ import com.gregtechceu.gtceu.api.gui.texture.ProspectingTexture; import com.gregtechceu.gtceu.api.item.IComponentItem; import com.gregtechceu.gtceu.common.item.ProspectorScannerBehavior; + import com.lowdragmc.lowdraglib.gui.editor.ColorPattern; import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.texture.TextTexture; import com.lowdragmc.lowdraglib.gui.util.DrawerHelper; import com.lowdragmc.lowdraglib.gui.widget.*; import com.lowdragmc.lowdraglib.utils.LocalizationUtils; -import com.mojang.blaze3d.vertex.PoseStack; -import lombok.Getter; + import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; @@ -21,17 +21,19 @@ import net.minecraft.world.item.ItemStack; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import org.jetbrains.annotations.NotNull; +import lombok.Getter; import org.jetbrains.annotations.NotNull; -import java.util.List; + import java.util.*; +import java.util.List; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.CopyOnWriteArraySet; import java.util.concurrent.LinkedBlockingQueue; import java.util.function.Consumer; public class ProspectingMapWidget extends WidgetGroup implements SearchComponentWidget.IWidgetSearch { + private final int chunkRadius; private final ProspectorMode mode; private final int scanTick; @@ -42,22 +44,26 @@ public class ProspectingMapWidget extends WidgetGroup implements SearchComponent private ProspectingTexture texture; private int playerChunkX; private int playerChunkZ; - //runtime + // runtime private int chunkIndex = 0; private final Queue packetQueue = new LinkedBlockingQueue<>(); private final Set items = new CopyOnWriteArraySet<>(); private final Map selectedMap = new ConcurrentHashMap<>(); - public ProspectingMapWidget(int xPosition, int yPosition, int width, int height, int chunkRadius, @NotNull ProspectorMode mode, int scanTick) { + public ProspectingMapWidget(int xPosition, int yPosition, int width, int height, int chunkRadius, + @NotNull ProspectorMode mode, int scanTick) { super(xPosition, yPosition, width, height); this.chunkRadius = chunkRadius; this.mode = mode; this.scanTick = scanTick; int imageWidth = (chunkRadius * 2 - 1) * 16; int imageHeight = (chunkRadius * 2 - 1) * 16; - addWidget(new ImageWidget(0, (height - imageHeight) / 2 - 4, imageWidth + 8, imageHeight + 8, GuiTextures.BACKGROUND_INVERSE)); - var group = (WidgetGroup) new WidgetGroup(imageWidth + 10, 0, width - (imageWidth + 10), height).setBackground(GuiTextures.BACKGROUND_INVERSE); - group.addWidget(itemList = new DraggableScrollableWidgetGroup(4, 28, group.getSize().width - 8, group.getSize().height - 32) + addWidget(new ImageWidget(0, (height - imageHeight) / 2 - 4, imageWidth + 8, imageHeight + 8, + GuiTextures.BACKGROUND_INVERSE)); + var group = (WidgetGroup) new WidgetGroup(imageWidth + 10, 0, width - (imageWidth + 10), height) + .setBackground(GuiTextures.BACKGROUND_INVERSE); + group.addWidget(itemList = new DraggableScrollableWidgetGroup(4, 28, group.getSize().width - 8, + group.getSize().height - 32) .setYScrollBarWidth(2).setYBarStyle(null, ColorPattern.T_WHITE.rectTexture().setRadius(1))); group.addWidget(new SearchComponentWidget<>(6, 6, group.getSize().width - 12, 18, this)); addWidget(group); @@ -100,7 +106,8 @@ private void addOresToList(Object[][][] data) { for (int z = 0; z < mode.cellSize; z++) { for (var item : data[x][z]) { newItems.add(item); - addNewItem(mode.getUniqueID(item), mode.getDescriptionId(item), mode.getItemIcon(item), mode.getItemColor(item)); + addNewItem(mode.getUniqueID(item), mode.getDescriptionId(item), mode.getItemIcon(item), + mode.getItemColor(item)); } } } @@ -113,7 +120,8 @@ private void addNewItem(String uniqueID, String renderingName, IGuiTexture icon, var selectableWidgetGroup = new SelectableWidgetGroup(0, index * 15, itemList.getSize().width - 4, 15); var size = selectableWidgetGroup.getSize(); selectableWidgetGroup.addWidget(new ImageWidget(0, 0, 15, 15, icon)); - selectableWidgetGroup.addWidget(new ImageWidget(15, 0, size.width - 15, 15, new TextTexture(renderingName).setWidth(size.width - 15).setType(TextTexture.TextType.LEFT_HIDE))); + selectableWidgetGroup.addWidget(new ImageWidget(15, 0, size.width - 15, 15, + new TextTexture(renderingName).setWidth(size.width - 15).setType(TextTexture.TextType.LEFT_HIDE))); selectableWidgetGroup.setOnSelected(s -> { if (isRemote()) { texture.setSelected(uniqueID); @@ -179,7 +187,6 @@ public void updateScreen() { } } - @OnlyIn(Dist.CLIENT) private void addPacketToQueue(PacketProspecting packet) { packetQueue.add(packet); @@ -191,7 +198,7 @@ public void drawInBackground(@NotNull GuiGraphics graphics, int mouseX, int mous super.drawInBackground(graphics, mouseX, mouseY, partialTicks); var position = getPosition(); var size = getSize(); - //draw background + // draw background var x = position.x + 3; var y = position.y + (size.getHeight() - texture.getImageHeight()) / 2 - 1; texture.draw(graphics, x, y); @@ -199,7 +206,7 @@ public void drawInBackground(@NotNull GuiGraphics graphics, int mouseX, int mous int cZ = (mouseY - y) / 16; if (cX >= 0 && cZ >= 0 && cX < chunkRadius * 2 - 1 && cZ < chunkRadius * 2 - 1) { // draw hover layer - DrawerHelper.drawSolidRect(graphics, cX * 16 + x, cZ * 16 + y, 16, 16,0x4B6C6C6C); + DrawerHelper.drawSolidRect(graphics, cX * 16 + x, cZ * 16 + y, 16, 16, 0x4B6C6C6C); } } @@ -257,7 +264,8 @@ public void search(String s, Consumer consumer) { if (!added.contains(id)) { added.add(id); var localized = LocalizationUtils.format(resultDisplay(item)); - if (item.toString().toLowerCase(Locale.ROOT).contains(s.toLowerCase(Locale.ROOT)) || localized.toLowerCase(Locale.ROOT).contains(s.toLowerCase(Locale.ROOT))) { + if (item.toString().toLowerCase(Locale.ROOT).contains(s.toLowerCase(Locale.ROOT)) || + localized.toLowerCase(Locale.ROOT).contains(s.toLowerCase(Locale.ROOT))) { consumer.accept(item); } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/ScrollablePhantomFluidWidget.java b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/ScrollablePhantomFluidWidget.java index b7b2089769..8bb0614dbb 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/ScrollablePhantomFluidWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/ScrollablePhantomFluidWidget.java @@ -1,24 +1,29 @@ package com.gregtechceu.gtceu.api.gui.widget; import com.gregtechceu.gtceu.utils.GTUtil; + import com.lowdragmc.lowdraglib.gui.widget.PhantomFluidWidget; import com.lowdragmc.lowdraglib.side.fluid.FluidHelper; import com.lowdragmc.lowdraglib.side.fluid.FluidStack; import com.lowdragmc.lowdraglib.side.fluid.IFluidTransfer; + import net.minecraft.network.FriendlyByteBuf; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + import org.jetbrains.annotations.Nullable; import java.util.function.Consumer; import java.util.function.Supplier; public class ScrollablePhantomFluidWidget extends PhantomFluidWidget { + private static final int SCROLL_ACTION_ID = 0x0001_0001; private static final long MILLIBUCKETS = FluidHelper.getBucket() / 1000; - - public ScrollablePhantomFluidWidget(@Nullable IFluidTransfer fluidTank, int tank, int x, int y, int width, int height, Supplier phantomFluidGetter, Consumer phantomFluidSetter) { + public ScrollablePhantomFluidWidget(@Nullable IFluidTransfer fluidTank, int tank, int x, int y, int width, + int height, Supplier phantomFluidGetter, + Consumer phantomFluidSetter) { super(fluidTank, tank, x, y, width, height, phantomFluidGetter, phantomFluidSetter); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/ToggleButtonWidget.java b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/ToggleButtonWidget.java index f7e0fcee6e..80e404f9c4 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/ToggleButtonWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/ToggleButtonWidget.java @@ -1,10 +1,12 @@ package com.gregtechceu.gtceu.api.gui.widget; import com.gregtechceu.gtceu.api.gui.GuiTextures; + import com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup; import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; import com.lowdragmc.lowdraglib.gui.widget.SwitchWidget; + import it.unimi.dsi.fastutil.booleans.BooleanConsumer; import lombok.Setter; import lombok.experimental.Accessors; @@ -23,13 +25,15 @@ public class ToggleButtonWidget extends SwitchWidget { @Setter private String tooltipText; - public ToggleButtonWidget(int xPosition, int yPosition, int width, int height, BooleanSupplier isPressedCondition, BooleanConsumer setPressedExecutor) { + public ToggleButtonWidget(int xPosition, int yPosition, int width, int height, BooleanSupplier isPressedCondition, + BooleanConsumer setPressedExecutor) { this(xPosition, yPosition, width, height, GuiTextures.VANILLA_BUTTON, isPressedCondition, setPressedExecutor); } public ToggleButtonWidget(int xPosition, int yPosition, int width, int height, IGuiTexture buttonTexture, BooleanSupplier isPressedCondition, BooleanConsumer setPressedExecutor) { - super(xPosition, yPosition, width, height, (clickData, aBoolean) -> setPressedExecutor.accept(aBoolean.booleanValue())); + super(xPosition, yPosition, width, height, + (clickData, aBoolean) -> setPressedExecutor.accept(aBoolean.booleanValue())); texture = buttonTexture; if (buttonTexture instanceof ResourceTexture resourceTexture) { setTexture(resourceTexture.getSubTexture(0, 0, 1, 0.5), resourceTexture.getSubTexture(0, 0.5, 1, 0.5)); @@ -44,8 +48,7 @@ public ToggleButtonWidget setShouldUseBaseBackground() { if (texture != null) { setTexture( new GuiTextureGroup(GuiTextures.TOGGLE_BUTTON_BACK.getSubTexture(0, 0, 1, 0.5), texture), - new GuiTextureGroup(GuiTextures.TOGGLE_BUTTON_BACK.getSubTexture(0, 0.5, 1, 0.5), texture) - ); + new GuiTextureGroup(GuiTextures.TOGGLE_BUTTON_BACK.getSubTexture(0, 0.5, 1, 0.5), texture)); } return this; } diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/directional/CombinedDirectionalConfigurator.java b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/directional/CombinedDirectionalConfigurator.java index 9f74d2d86e..92d640f947 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/directional/CombinedDirectionalConfigurator.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/directional/CombinedDirectionalConfigurator.java @@ -4,6 +4,7 @@ import com.gregtechceu.gtceu.api.gui.fancy.FancyMachineUIWidget; import com.gregtechceu.gtceu.api.machine.MetaMachine; import com.gregtechceu.gtceu.utils.GTUtil; + import com.lowdragmc.lowdraglib.client.scene.ISceneBlockRenderHook; import com.lowdragmc.lowdraglib.client.scene.WorldSceneRenderer; import com.lowdragmc.lowdraglib.gui.editor.ColorPattern; @@ -15,8 +16,7 @@ import com.lowdragmc.lowdraglib.utils.BlockPosFace; import com.lowdragmc.lowdraglib.utils.Position; import com.lowdragmc.lowdraglib.utils.Size; -import com.mojang.blaze3d.platform.GlStateManager; -import com.mojang.blaze3d.systems.RenderSystem; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.client.renderer.RenderType; import net.minecraft.core.BlockPos; @@ -24,14 +24,19 @@ import net.minecraft.network.FriendlyByteBuf; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + +import com.mojang.blaze3d.platform.GlStateManager; +import com.mojang.blaze3d.systems.RenderSystem; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.List; +import javax.annotation.ParametersAreNonnullByDefault; + @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault public class CombinedDirectionalConfigurator extends WidgetGroup { + protected final static int MOUSE_CLICK_CLIENT_ACTION_ID = 0x0001_0001; protected final static int UPDATE_UI_ID = 0x0001_0002; @@ -46,7 +51,8 @@ public class CombinedDirectionalConfigurator extends WidgetGroup { protected @Nullable BlockPos selectedPos; protected @Nullable Direction selectedSide; - public CombinedDirectionalConfigurator(FancyMachineUIWidget machineUI, IDirectionalConfigHandler[] configHandlers, MetaMachine machine, int width, int height) { + public CombinedDirectionalConfigurator(FancyMachineUIWidget machineUI, IDirectionalConfigHandler[] configHandlers, + MetaMachine machine, int width, int height) { super(0, 0, width, height); this.width = width; this.height = height; @@ -74,22 +80,22 @@ private SceneWidget createSceneWidget() { var pos = this.machine.getPos(); SceneWidget sceneWidget = new SceneWidget(4, 4, width - 8, height - 8, this.machine.getLevel()) - .setRenderedCore(List.of(pos), null) - .setRenderSelect(false) - .setOnSelected(this::onSideSelected); + .setRenderedCore(List.of(pos), null) + .setRenderSelect(false) + .setOnSelected(this::onSideSelected); if (isRemote()) { sceneWidget.getRenderer().addRenderedBlocks( - List.of(pos.above(), pos.below(), pos.north(), pos.south(), pos.east(), pos.west()), - new ISceneBlockRenderHook() { - @Override - @OnlyIn(Dist.CLIENT) - public void apply(boolean isTESR, RenderType layer) { - RenderSystem.enableBlend(); - RenderSystem.blendFunc(GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE); - } - } - ); + List.of(pos.above(), pos.below(), pos.north(), pos.south(), pos.east(), pos.west()), + new ISceneBlockRenderHook() { + + @Override + @OnlyIn(Dist.CLIENT) + public void apply(boolean isTESR, RenderType layer) { + RenderSystem.enableBlend(); + RenderSystem.blendFunc(GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE); + } + }); sceneWidget.getRenderer().setAfterWorldRender(this::renderOverlays); @@ -126,7 +132,8 @@ private void addConfigWidgets(SceneWidget sceneWidget) { yOffsetLeft += widgetSize.height + 3; } case RIGHT -> { - widget.setSelfPosition(new Position( width - widgetSize.width - 6, height - 6 - widgetSize.height - yOffsetRight)); + widget.setSelfPosition( + new Position(width - widgetSize.width - 6, height - 6 - widgetSize.height - yOffsetRight)); yOffsetRight += widgetSize.height + 3; } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/directional/IDirectionalConfigHandler.java b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/directional/IDirectionalConfigHandler.java index 7a4f90f8d0..024b446587 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/directional/IDirectionalConfigHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/directional/IDirectionalConfigHandler.java @@ -1,17 +1,20 @@ package com.gregtechceu.gtceu.api.gui.widget.directional; import com.gregtechceu.gtceu.api.gui.fancy.FancyMachineUIWidget; + import com.lowdragmc.lowdraglib.gui.util.ClickData; import com.lowdragmc.lowdraglib.gui.widget.SceneWidget; import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.utils.BlockPosFace; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; public interface IDirectionalConfigHandler { + /** * Returns the buttons to display inside the side selector */ diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/directional/handlers/AutoOutputFluidConfigHandler.java b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/directional/handlers/AutoOutputFluidConfigHandler.java index 2f7afd0cea..5349ca9c7e 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/directional/handlers/AutoOutputFluidConfigHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/directional/handlers/AutoOutputFluidConfigHandler.java @@ -6,36 +6,37 @@ import com.gregtechceu.gtceu.api.gui.widget.directional.IDirectionalConfigHandler; import com.gregtechceu.gtceu.api.machine.feature.IAutoOutputFluid; import com.gregtechceu.gtceu.api.machine.feature.IAutoOutputItem; + import com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup; import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.util.ClickData; import com.lowdragmc.lowdraglib.gui.widget.*; import com.lowdragmc.lowdraglib.utils.BlockPosFace; import com.lowdragmc.lowdraglib.utils.Position; -import com.mojang.blaze3d.vertex.PoseStack; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; +import com.mojang.blaze3d.vertex.PoseStack; + import javax.annotation.ParametersAreNonnullByDefault; @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault public class AutoOutputFluidConfigHandler implements IDirectionalConfigHandler { + private static final IGuiTexture TEXTURE_OFF = new GuiTextureGroup( - GuiTextures.VANILLA_BUTTON, - GuiTextures.IO_CONFIG_FLUID_MODES_BUTTON.getSubTexture(0, 0, 1, 1/3f) - ); + GuiTextures.VANILLA_BUTTON, + GuiTextures.IO_CONFIG_FLUID_MODES_BUTTON.getSubTexture(0, 0, 1, 1 / 3f)); private static final IGuiTexture TEXTURE_OUTPUT = new GuiTextureGroup( - GuiTextures.VANILLA_BUTTON, - GuiTextures.IO_CONFIG_FLUID_MODES_BUTTON.getSubTexture(0, 1/3f, 1, 1/3f) - ); + GuiTextures.VANILLA_BUTTON, + GuiTextures.IO_CONFIG_FLUID_MODES_BUTTON.getSubTexture(0, 1 / 3f, 1, 1 / 3f)); private static final IGuiTexture TEXTURE_AUTO = new GuiTextureGroup( - GuiTextures.VANILLA_BUTTON, - GuiTextures.IO_CONFIG_FLUID_MODES_BUTTON.getSubTexture(0, 2/3f, 1, 1/3f) - ); + GuiTextures.VANILLA_BUTTON, + GuiTextures.IO_CONFIG_FLUID_MODES_BUTTON.getSubTexture(0, 2 / 3f, 1, 1 / 3f)); private final IAutoOutputFluid machine; private Direction side; @@ -50,6 +51,7 @@ public Widget getSideSelectorWidget(SceneWidget scene, FancyMachineUIWidget mach WidgetGroup group = new WidgetGroup(0, 0, (18 * 2) + 1, 18); group.addWidget(ioModeButton = new ButtonWidget(0, 0, 18, 18, this::onIOModePressed) { + @Override public void updateScreen() { super.updateScreen(); @@ -66,12 +68,11 @@ public void updateScreen() { }); group.addWidget(new ToggleButtonWidget( - 19, 0, 18, 18, GuiTextures.BUTTON_FLUID_OUTPUT, - machine::isAllowInputFromOutputSideFluids, machine::setAllowInputFromOutputSideFluids - ).setShouldUseBaseBackground().setTooltipText("gtceu.gui.fluid_auto_output.allow_input")); + 19, 0, 18, 18, GuiTextures.BUTTON_FLUID_OUTPUT, + machine::isAllowInputFromOutputSideFluids, machine::setAllowInputFromOutputSideFluids) + .setShouldUseBaseBackground().setTooltipText("gtceu.gui.fluid_auto_output.allow_input")); return group; - } private void onIOModePressed(ClickData cd) { @@ -96,7 +97,6 @@ public ScreenSide getScreenSide() { return ScreenSide.LEFT; } - @Override public void handleClick(ClickData cd, Direction direction) { if (!canHandleClick(cd) || !machine.hasAutoOutputFluid()) @@ -127,12 +127,14 @@ public void renderOverlay(SceneWidget sceneWidget, BlockPosFace blockPosFace) { if (machine.getOutputFacingFluids() != blockPosFace.facing) return; - sceneWidget.drawFacingBorder(new PoseStack(), blockPosFace, machine.isAutoOutputFluids() ? 0xff00b4ff : 0x8f00b4ff, 2); + sceneWidget.drawFacingBorder(new PoseStack(), blockPosFace, + machine.isAutoOutputFluids() ? 0xff00b4ff : 0x8f00b4ff, 2); } @Override public void addAdditionalUIElements(WidgetGroup parent) { LabelWidget text = new LabelWidget(4, 4, "gtceu.gui.auto_output.name") { + @Override public boolean isVisible() { return machine.isAutoOutputFluids() && machine.getOutputFacingFluids() != null; @@ -141,7 +143,6 @@ public boolean isVisible() { text.setSelfPosition(new Position(parent.getSize().width - 4 - text.getSize().width, 4)); - text.setTextColor(0xff00b4ff).setDropShadow(false); parent.addWidget(text); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/directional/handlers/AutoOutputItemConfigHandler.java b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/directional/handlers/AutoOutputItemConfigHandler.java index 21685fd8d5..3af3e8492e 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/directional/handlers/AutoOutputItemConfigHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/directional/handlers/AutoOutputItemConfigHandler.java @@ -6,35 +6,36 @@ import com.gregtechceu.gtceu.api.gui.widget.directional.IDirectionalConfigHandler; import com.gregtechceu.gtceu.api.machine.feature.IAutoOutputFluid; import com.gregtechceu.gtceu.api.machine.feature.IAutoOutputItem; + import com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup; import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.util.ClickData; import com.lowdragmc.lowdraglib.gui.widget.*; import com.lowdragmc.lowdraglib.utils.BlockPosFace; -import com.mojang.blaze3d.vertex.PoseStack; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; +import com.mojang.blaze3d.vertex.PoseStack; + import javax.annotation.ParametersAreNonnullByDefault; @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault public class AutoOutputItemConfigHandler implements IDirectionalConfigHandler { + private static final IGuiTexture TEXTURE_OFF = new GuiTextureGroup( - GuiTextures.VANILLA_BUTTON, - GuiTextures.IO_CONFIG_ITEM_MODES_BUTTON.getSubTexture(0, 0, 1, 1/3f) - ); + GuiTextures.VANILLA_BUTTON, + GuiTextures.IO_CONFIG_ITEM_MODES_BUTTON.getSubTexture(0, 0, 1, 1 / 3f)); private static final IGuiTexture TEXTURE_OUTPUT = new GuiTextureGroup( - GuiTextures.VANILLA_BUTTON, - GuiTextures.IO_CONFIG_ITEM_MODES_BUTTON.getSubTexture(0, 1/3f, 1, 1/3f) - ); + GuiTextures.VANILLA_BUTTON, + GuiTextures.IO_CONFIG_ITEM_MODES_BUTTON.getSubTexture(0, 1 / 3f, 1, 1 / 3f)); private static final IGuiTexture TEXTURE_AUTO = new GuiTextureGroup( - GuiTextures.VANILLA_BUTTON, - GuiTextures.IO_CONFIG_ITEM_MODES_BUTTON.getSubTexture(0, 2/3f, 1, 1/3f) - ); + GuiTextures.VANILLA_BUTTON, + GuiTextures.IO_CONFIG_ITEM_MODES_BUTTON.getSubTexture(0, 2 / 3f, 1, 1 / 3f)); private final IAutoOutputItem machine; private Direction side; @@ -48,7 +49,8 @@ public AutoOutputItemConfigHandler(IAutoOutputItem machine) { public Widget getSideSelectorWidget(SceneWidget scene, FancyMachineUIWidget machineUI) { WidgetGroup group = new WidgetGroup(0, 0, (18 * 2) + 1, 18); - group.addWidget(ioModeButton = new ButtonWidget(0, 0, 18, 18, this::onIOModePressed){ + group.addWidget(ioModeButton = new ButtonWidget(0, 0, 18, 18, this::onIOModePressed) { + @Override public void updateScreen() { super.updateScreen(); @@ -66,9 +68,9 @@ public void updateScreen() { }); group.addWidget(new ToggleButtonWidget( - 19, 0, 18, 18, GuiTextures.BUTTON_ITEM_OUTPUT, - machine::isAllowInputFromOutputSideItems, machine::setAllowInputFromOutputSideItems - ).setShouldUseBaseBackground().setTooltipText("gtceu.gui.item_auto_output.allow_input")); + 19, 0, 18, 18, GuiTextures.BUTTON_ITEM_OUTPUT, + machine::isAllowInputFromOutputSideItems, machine::setAllowInputFromOutputSideItems) + .setShouldUseBaseBackground().setTooltipText("gtceu.gui.item_auto_output.allow_input")); return group; } @@ -95,7 +97,6 @@ public ScreenSide getScreenSide() { return ScreenSide.LEFT; } - @Override public void handleClick(ClickData cd, Direction direction) { if (!canHandleClick(cd) || !machine.hasAutoOutputItem()) @@ -126,12 +127,14 @@ public void renderOverlay(SceneWidget sceneWidget, BlockPosFace blockPosFace) { if (machine.getOutputFacingItems() != blockPosFace.facing) return; - sceneWidget.drawFacingBorder(new PoseStack(), blockPosFace, machine.isAutoOutputItems() ? 0xffff6e0f : 0x8fff6e0f, 1); + sceneWidget.drawFacingBorder(new PoseStack(), blockPosFace, + machine.isAutoOutputItems() ? 0xffff6e0f : 0x8fff6e0f, 1); } @Override public void addAdditionalUIElements(WidgetGroup parent) { LabelWidget text = new LabelWidget(4, 4, "gtceu.gui.auto_output.name") { + @Override public boolean isVisible() { return machine.isAutoOutputItems() && machine.getOutputFacingItems() != null; diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/directional/handlers/CoverableConfigHandler.java b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/directional/handlers/CoverableConfigHandler.java index ae637d24ee..03c7e5b24d 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/directional/handlers/CoverableConfigHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/directional/handlers/CoverableConfigHandler.java @@ -12,6 +12,7 @@ import com.gregtechceu.gtceu.api.item.IComponentItem; import com.gregtechceu.gtceu.api.item.component.IItemComponent; import com.gregtechceu.gtceu.common.item.CoverPlaceBehavior; + import com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup; import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.util.ClickData; @@ -22,6 +23,7 @@ import com.lowdragmc.lowdraglib.misc.ItemStackTransfer; import com.lowdragmc.lowdraglib.utils.Position; import com.lowdragmc.lowdraglib.utils.Size; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -34,6 +36,7 @@ @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault public class CoverableConfigHandler implements IDirectionalConfigHandler { + private static final IGuiTexture CONFIG_BTN_TEXTURE = new GuiTextureGroup(GuiTextures.IO_CONFIG_COVER_SETTINGS); private final ICoverable machine; @@ -53,6 +56,7 @@ public CoverableConfigHandler(ICoverable machine) { private ItemStackTransfer createItemStackTransfer() { var transfer = new ItemStackTransfer(1) { + @Override public int getSlotLimit(int slot) { return 1; @@ -62,7 +66,8 @@ public int getSlotLimit(int slot) { transfer.setFilter(itemStack -> { if (itemStack.isEmpty()) return true; if (this.side == null) return false; - return CoverPlaceBehavior.isCoverBehaviorItem(itemStack, () -> false, coverDef -> ICoverable.canPlaceCover(coverDef, this.machine)); + return CoverPlaceBehavior.isCoverBehaviorItem(itemStack, () -> false, + coverDef -> ICoverable.canPlaceCover(coverDef, this.machine)); }); return transfer; @@ -74,10 +79,10 @@ public Widget getSideSelectorWidget(SceneWidget scene, FancyMachineUIWidget mach this.panel = machineUI.getConfiguratorPanel(); group.addWidget(slotWidget = new SlotWidget(transfer, 0, 19, 0) - .setChangeListener(this::coverItemChanged) - .setBackgroundTexture(new GuiTextureGroup(GuiTextures.SLOT, GuiTextures.IO_CONFIG_COVER_SLOT_OVERLAY))); + .setChangeListener(this::coverItemChanged) + .setBackgroundTexture(new GuiTextureGroup(GuiTextures.SLOT, GuiTextures.IO_CONFIG_COVER_SLOT_OVERLAY))); group.addWidget(new PredicatedButtonWidget(0, 0, 18, 18, CONFIG_BTN_TEXTURE, this::toggleConfigTab, - () -> side != null && coverBehavior != null && machine.getCoverAtSide(side) instanceof IUICover)); + () -> side != null && coverBehavior != null && machine.getCoverAtSide(side) instanceof IUICover)); checkCoverBehaviour(); @@ -147,6 +152,7 @@ private void toggleConfigTab(ClickData cd) { private void openConfigTab() { CoverConfigurator configurator = new CoverConfigurator(this.machine, this.side, this.coverBehavior) { + @Override public Component getTitle() { // Uses the widget's own title @@ -170,9 +176,8 @@ public Widget createConfigurator() { group.addWidget(coverConfigurator); group.setSize(new Size( - Math.max(120, coverConfigurator.getSize().width), - Math.max(80, coverConfigurator.getSize().height - 20) - )); + Math.max(120, coverConfigurator.getSize().width), + Math.max(80, coverConfigurator.getSize().height - 20))); return group; } diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/ComponentItem.java b/src/main/java/com/gregtechceu/gtceu/api/item/ComponentItem.java index 2de00338a6..9c378fd445 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/ComponentItem.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/ComponentItem.java @@ -4,11 +4,12 @@ import com.gregtechceu.gtceu.api.capability.IElectricItem; import com.gregtechceu.gtceu.api.item.component.*; import com.gregtechceu.gtceu.api.item.component.forge.IComponentCapability; + import com.lowdragmc.lowdraglib.client.renderer.IItemRendererProvider; import com.lowdragmc.lowdraglib.client.renderer.IRenderer; import com.lowdragmc.lowdraglib.gui.factory.HeldItemUIFactory; import com.lowdragmc.lowdraglib.gui.modular.ModularUI; -import lombok.Getter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.NonNullList; import net.minecraft.network.chat.Component; @@ -27,14 +28,17 @@ import net.minecraft.world.level.Level; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.util.LazyOptional; -import org.jetbrains.annotations.Nullable; +import lombok.Getter; import org.jetbrains.annotations.NotNull; -import javax.annotation.ParametersAreNonnullByDefault; +import org.jetbrains.annotations.Nullable; + import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author KilaBash * @date 2023/2/22 @@ -42,7 +46,8 @@ */ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault -public class ComponentItem extends Item implements HeldItemUIFactory.IHeldItemUIHolder, IItemRendererProvider, IComponentItem { +public class ComponentItem extends Item + implements HeldItemUIFactory.IHeldItemUIHolder, IItemRendererProvider, IComponentItem { protected int burnTime = -1; @@ -83,7 +88,8 @@ public void fillItemCategory(CreativeModeTab category, NonNullList it } @Override - public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltipComponents, TooltipFlag isAdvanced) { + public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltipComponents, + TooltipFlag isAdvanced) { for (IItemComponent component : components) { if (component instanceof IAddInformation addInformation) { addInformation.appendHoverText(stack, level, tooltipComponents, isAdvanced); @@ -154,7 +160,7 @@ public ItemStack finishUsingItem(ItemStack stack, Level level, LivingEntity livi stack = interactionItem.finishUsingItem(stack, level, livingEntity); } } - return super.finishUsingItem(stack, level, livingEntity); + return stack; } @Override @@ -171,7 +177,8 @@ public InteractionResult onItemUseFirst(ItemStack itemStack, UseOnContext contex } @Override - public InteractionResult interactLivingEntity(ItemStack stack, Player player, LivingEntity interactionTarget, InteractionHand usedHand) { + public InteractionResult interactLivingEntity(ItemStack stack, Player player, LivingEntity interactionTarget, + InteractionHand usedHand) { for (IItemComponent component : components) { if (component instanceof IInteractionItem interactionItem) { var result = interactionItem.interactLivingEntity(stack, player, interactionTarget, usedHand); diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/DrumMachineItem.java b/src/main/java/com/gregtechceu/gtceu/api/item/DrumMachineItem.java index f5ae6ca944..0873130e8e 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/DrumMachineItem.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/DrumMachineItem.java @@ -1,14 +1,14 @@ package com.gregtechceu.gtceu.api.item; - import com.gregtechceu.gtceu.api.block.IMachineBlock; -import com.gregtechceu.gtceu.api.item.component.forge.IComponentCapability; import com.gregtechceu.gtceu.common.data.GTMachines; + import net.minecraft.world.item.ItemStack; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.fluids.capability.templates.FluidHandlerItemStack; + import org.jetbrains.annotations.NotNull; /** @@ -17,6 +17,7 @@ * @implNote DrumMachineItem */ public class DrumMachineItem extends MetaMachineItem { + protected DrumMachineItem(IMachineBlock block, Properties properties) { super(block, properties); } @@ -29,11 +30,8 @@ public static DrumMachineItem create(IMachineBlock block, Properties properties) if (cap == ForgeCapabilities.FLUID_HANDLER_ITEM) { return ForgeCapabilities.FLUID_HANDLER_ITEM.orEmpty(cap, LazyOptional.of( () -> new FluidHandlerItemStack( - itemStack, - Math.toIntExact(GTMachines.DRUM_CAPACITY.get(getDefinition())) - ) - ) - ); + itemStack, + Math.toIntExact(GTMachines.DRUM_CAPACITY.get(getDefinition()))))); } return LazyOptional.empty(); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/IComponentItem.java b/src/main/java/com/gregtechceu/gtceu/api/item/IComponentItem.java index 46b637c440..95596c63d7 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/IComponentItem.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/IComponentItem.java @@ -1,12 +1,14 @@ package com.gregtechceu.gtceu.api.item; import com.gregtechceu.gtceu.api.item.component.IItemComponent; + import net.minecraft.core.NonNullList; import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.ItemLike; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.util.LazyOptional; + import org.jetbrains.annotations.NotNull; import java.util.List; @@ -21,7 +23,5 @@ default LazyOptional getCapability(@NotNull final ItemStack itemStack, @N return LazyOptional.empty(); } - default void fillItemCategory(CreativeModeTab category, NonNullList items) { - - } + default void fillItemCategory(CreativeModeTab category, NonNullList items) {} } diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/IGTTool.java b/src/main/java/com/gregtechceu/gtceu/api/item/IGTTool.java index ebdcf306a8..023ff3fc7c 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/IGTTool.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/IGTTool.java @@ -1,7 +1,5 @@ package com.gregtechceu.gtceu.api.item; -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Multimap; import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.capability.GTCapabilityHelper; import com.gregtechceu.gtceu.api.capability.forge.CombinedCapabilityProvider; @@ -28,13 +26,13 @@ import com.gregtechceu.gtceu.data.recipe.VanillaRecipeHelper; import com.gregtechceu.gtceu.utils.FormattingUtil; import com.gregtechceu.gtceu.utils.GTUtil; + import com.lowdragmc.lowdraglib.gui.factory.HeldItemUIFactory; import com.lowdragmc.lowdraglib.gui.modular.ModularUI; import com.lowdragmc.lowdraglib.gui.texture.TextTexture; import com.lowdragmc.lowdraglib.gui.widget.ButtonWidget; import com.lowdragmc.lowdraglib.gui.widget.LabelWidget; -import it.unimi.dsi.fastutil.objects.Object2IntMap; -import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; + import net.minecraft.client.color.item.ItemColor; import net.minecraft.client.resources.language.I18n; import net.minecraft.core.BlockPos; @@ -72,10 +70,14 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.common.util.LazyOptional; -import org.jetbrains.annotations.NotNull; +import com.google.common.collect.HashMultimap; +import com.google.common.collect.Multimap; +import it.unimi.dsi.fastutil.objects.Object2IntMap; +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; + import java.util.*; import java.util.stream.Collectors; @@ -88,7 +90,7 @@ public interface IGTTool extends HeldItemUIFactory.IHeldItemUIHolder, ItemLike { GTToolType getToolType(); Material getMaterial(); - + boolean isElectric(); int getElectricTier(); @@ -130,12 +132,14 @@ default ItemStack get() { ToolProperty toolProperty = this.getMaterial().getProperty(PropertyKey.TOOL); // Durability formula we are working with: - // Final Durability = (material durability * material durability multiplier) + (tool definition durability * definition durability multiplier) - 1 + // Final Durability = (material durability * material durability multiplier) + (tool definition durability * + // definition durability multiplier) - 1 // Subtracts 1 internally since Minecraft treats "0" as a valid durability, but we don't want to display this. int durability = toolProperty.getDurability() * toolProperty.getDurabilityMultiplier(); - // Most Tool Definitions do not set a base durability, which will lead to ignoring the multiplier if present. So apply the multiplier to the material durability if that would happen + // Most Tool Definitions do not set a base durability, which will lead to ignoring the multiplier if present. So + // apply the multiplier to the material durability if that would happen if (toolStats.getBaseDurability(stack) == 0) { durability *= toolStats.getDurabilityMultiplier(stack); } else { @@ -161,7 +165,6 @@ default ItemStack get() { CompoundTag behaviourTag = getBehaviorsTag(stack); getToolStats().getBehaviors().forEach(behavior -> behavior.addBehaviorNBT(stack, behaviourTag)); - if (aoeDefinition != AoESymmetrical.none()) { behaviourTag.putInt(MAX_AOE_COLUMN_KEY, aoeDefinition.column); behaviourTag.putInt(MAX_AOE_ROW_KEY, aoeDefinition.row); @@ -198,7 +201,7 @@ default Material getToolMaterial(ItemStack stack) { if (stack.getItem() instanceof IGTTool tool) { return tool.getMaterial(); } - + return GTMaterials.Iron; } @@ -267,7 +270,8 @@ default float getTotalToolSpeed(ItemStack stack) { if (toolTag.contains(TOOL_SPEED_KEY, Tag.TAG_FLOAT)) { return toolTag.getFloat(TOOL_SPEED_KEY); } - float toolSpeed = getToolStats().getEfficiencyMultiplier(stack) * getMaterialToolSpeed(stack) + getToolStats().getBaseEfficiency(stack); + float toolSpeed = getToolStats().getEfficiencyMultiplier(stack) * getMaterialToolSpeed(stack) + + getToolStats().getBaseEfficiency(stack); toolTag.putFloat(TOOL_SPEED_KEY, toolSpeed); return toolSpeed; } @@ -307,8 +311,10 @@ default int getTotalMaxDurability(ItemStack stack) { int maxDurability = getMaterialDurability(stack); int builderDurability = (int) (toolStats.getBaseDurability(stack) * toolStats.getDurabilityMultiplier(stack)); - // If there is no durability set in the tool builder, multiply the builder AOE multiplier to the material durability - maxDurability = builderDurability == 0 ? (int) (maxDurability * toolStats.getDurabilityMultiplier(stack)) : maxDurability + builderDurability; + // If there is no durability set in the tool builder, multiply the builder AOE multiplier to the material + // durability + maxDurability = builderDurability == 0 ? (int) (maxDurability * toolStats.getDurabilityMultiplier(stack)) : + maxDurability + builderDurability; toolTag.putInt(MAX_DURABILITY_KEY, maxDurability); return maxDurability; @@ -395,9 +401,11 @@ default int getTotalHarvestLevel(ItemStack stack) { return false; } - default boolean definition$mineBlock(ItemStack stack, Level worldIn, BlockState state, BlockPos pos, LivingEntity entityLiving) { + default boolean definition$mineBlock(ItemStack stack, Level worldIn, BlockState state, BlockPos pos, + LivingEntity entityLiving) { if (!worldIn.isClientSide) { - getToolStats().getBehaviors().forEach(behavior -> behavior.onBlockDestroyed(stack, worldIn, state, pos, entityLiving)); + getToolStats().getBehaviors() + .forEach(behavior -> behavior.onBlockDestroyed(stack, worldIn, state, pos, entityLiving)); if ((double) state.getDestroySpeed(worldIn, pos) != 0.0D) { damageItem(stack, entityLiving, getToolStats().getToolDamagePerBlockBreak(stack)); @@ -441,24 +449,31 @@ default int getTotalHarvestLevel(ItemStack stack) { return false; } - default Multimap definition$getDefaultAttributeModifiers(EquipmentSlot equipmentSlot, ItemStack stack) { + default Multimap definition$getDefaultAttributeModifiers(EquipmentSlot equipmentSlot, + ItemStack stack) { Multimap multimap = HashMultimap.create(); if (equipmentSlot == EquipmentSlot.MAINHAND) { - multimap.put(Attributes.ATTACK_DAMAGE, new AttributeModifier(BASE_ATTACK_DAMAGE_UUID, "Weapon modifier", getTotalAttackDamage(stack), AttributeModifier.Operation.ADDITION)); - multimap.put(Attributes.ATTACK_SPEED, new AttributeModifier(BASE_ATTACK_SPEED_UUID, "Weapon modifier", Math.max(-3.9D, getTotalAttackSpeed(stack)), AttributeModifier.Operation.ADDITION)); + multimap.put(Attributes.ATTACK_DAMAGE, new AttributeModifier(BASE_ATTACK_DAMAGE_UUID, "Weapon modifier", + getTotalAttackDamage(stack), AttributeModifier.Operation.ADDITION)); + multimap.put(Attributes.ATTACK_SPEED, new AttributeModifier(BASE_ATTACK_SPEED_UUID, "Weapon modifier", + Math.max(-3.9D, getTotalAttackSpeed(stack)), AttributeModifier.Operation.ADDITION)); } return multimap; } - default int definition$getHarvestLevel(ItemStack stack, GTToolType toolClass, @Nullable Player player, @Nullable BlockState blockState) { + default int definition$getHarvestLevel(ItemStack stack, GTToolType toolClass, @Nullable Player player, + @Nullable BlockState blockState) { return getToolClasses(stack).contains(toolClass) ? getTotalHarvestLevel(stack) : -1; } - default boolean definition$canDisableShield(ItemStack stack, ItemStack shield, LivingEntity entity, LivingEntity attacker) { - return getToolStats().getBehaviors().stream().anyMatch(behavior -> behavior.canDisableShield(stack, shield, entity, attacker)); + default boolean definition$canDisableShield(ItemStack stack, ItemStack shield, LivingEntity entity, + LivingEntity attacker) { + return getToolStats().getBehaviors().stream() + .anyMatch(behavior -> behavior.canDisableShield(stack, shield, entity, attacker)); } - default boolean definition$doesSneakBypassUse(@NotNull ItemStack stack, @NotNull BlockGetter world, @NotNull BlockPos pos, @NotNull Player player) { + default boolean definition$doesSneakBypassUse(@NotNull ItemStack stack, @NotNull BlockGetter world, + @NotNull BlockPos pos, @NotNull Player player) { return getToolStats().doesSneakBypassUse(); } @@ -492,7 +507,8 @@ default int getTotalHarvestLevel(ItemStack stack) { return stack; } - default boolean definition$shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) { + default boolean definition$shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, + boolean slotChanged) { if (getCharge(oldStack) != getCharge(newStack)) { return slotChanged; } @@ -548,7 +564,7 @@ default int getTotalHarvestLevel(ItemStack stack) { default InteractionResult definition$onItemUseFirst(ItemStack stack, UseOnContext context) { for (IToolBehavior behavior : getToolStats().getBehaviors()) { - if (behavior.onItemUseFirst(stack, context) == InteractionResult.SUCCESS) { + if (behavior.onItemUseFirst(stack, context) == InteractionResult.SUCCESS) { return InteractionResult.SUCCESS; } } @@ -558,7 +574,7 @@ default int getTotalHarvestLevel(ItemStack stack) { default InteractionResult definition$onItemUse(UseOnContext context) { for (IToolBehavior behavior : getToolStats().getBehaviors()) { - if (behavior.onItemUse(context) == InteractionResult.SUCCESS) { + if (behavior.onItemUse(context) == InteractionResult.SUCCESS) { return InteractionResult.SUCCESS; } } @@ -577,7 +593,6 @@ default int getTotalHarvestLevel(ItemStack stack) { return InteractionResultHolder.success(heldItem); } - for (IToolBehavior behavior : getToolStats().getBehaviors()) { if (behavior.onItemRightClick(world, player, hand).getResult() == InteractionResult.SUCCESS) { return InteractionResultHolder.success(stack); @@ -588,7 +603,7 @@ default int getTotalHarvestLevel(ItemStack stack) { default boolean definition$shouldOpenUIAfterUse(UseOnContext context) { for (IToolBehavior behavior : getToolStats().getBehaviors()) { - if (!behavior.shouldOpenUIAfterUse(context)) { + if (!behavior.shouldOpenUIAfterUse(context)) { return false; } } @@ -607,7 +622,8 @@ default int getTotalHarvestLevel(ItemStack stack) { // Client-side methods @OnlyIn(Dist.CLIENT) - default void definition$appendHoverText(@NotNull ItemStack stack, @Nullable Level world, @NotNull List tooltip, TooltipFlag flag) { + default void definition$appendHoverText(@NotNull ItemStack stack, @Nullable Level world, + @NotNull List tooltip, TooltipFlag flag) { if (!(stack.getItem() instanceof IGTTool tool)) return; CompoundTag tagCompound = stack.getTag(); @@ -625,29 +641,36 @@ default int getTotalHarvestLevel(ItemStack stack) { // durability info if (!tagCompound.getBoolean(UNBREAKABLE_KEY)) { - // Plus 1 to match vanilla behavior where tools can still be used once at zero durability. We want to not show this + // Plus 1 to match vanilla behavior where tools can still be used once at zero durability. We want to not + // show this int damageRemaining = tool.getTotalMaxDurability(stack) - stack.getDamageValue() + 1; if (toolStats.isSuitableForCrafting(stack)) { - tooltip.add(Component.translatable("item.gtceu.tool.tooltip.crafting_uses", FormattingUtil.formatNumbers(damageRemaining / Math.max(1, toolStats.getToolDamagePerCraft(stack))))); + tooltip.add(Component.translatable("item.gtceu.tool.tooltip.crafting_uses", FormattingUtil + .formatNumbers(damageRemaining / Math.max(1, toolStats.getToolDamagePerCraft(stack))))); } - tooltip.add(Component.translatable("item.gtceu.tool.tooltip.general_uses", FormattingUtil.formatNumbers(damageRemaining))); + tooltip.add(Component.translatable("item.gtceu.tool.tooltip.general_uses", + FormattingUtil.formatNumbers(damageRemaining))); } // attack info if (toolStats.isSuitableForAttacking(stack)) { - tooltip.add(Component.translatable("item.gtceu.tool.tooltip.attack_damage", FormattingUtil.formatNumbers(2 + tool.getTotalAttackDamage(stack)))); - tooltip.add(Component.translatable("item.gtceu.tool.tooltip.attack_speed", FormattingUtil.formatNumbers(4 + tool.getTotalAttackSpeed(stack)))); + tooltip.add(Component.translatable("item.gtceu.tool.tooltip.attack_damage", + FormattingUtil.formatNumbers(2 + tool.getTotalAttackDamage(stack)))); + tooltip.add(Component.translatable("item.gtceu.tool.tooltip.attack_speed", + FormattingUtil.formatNumbers(4 + tool.getTotalAttackSpeed(stack)))); } // mining info if (toolStats.isSuitableForBlockBreak(stack)) { - tooltip.add(Component.translatable("item.gtceu.tool.tooltip.mining_speed", FormattingUtil.formatNumbers(tool.getTotalToolSpeed(stack)))); + tooltip.add(Component.translatable("item.gtceu.tool.tooltip.mining_speed", + FormattingUtil.formatNumbers(tool.getTotalToolSpeed(stack)))); int harvestLevel = tool.getTotalHarvestLevel(stack); String harvestName = "item.gtceu.tool.harvest_level." + harvestLevel; if (I18n.exists(harvestName)) { // if there's a defined name for the harvest level, use it - tooltip.add(Component.translatable("item.gtceu.tool.tooltip.harvest_level_extra", harvestLevel, Component.translatable(harvestName))); + tooltip.add(Component.translatable("item.gtceu.tool.tooltip.harvest_level_extra", harvestLevel, + Component.translatable(harvestName))); } else { tooltip.add(Component.translatable("item.gtceu.tool.tooltip.harvest_level", harvestLevel)); } @@ -691,8 +714,8 @@ default int getTotalHarvestLevel(ItemStack stack) { getToolClassNames(stack).stream() .filter(s -> I18n.exists("gtceu.tool.class." + s)) .map(s -> Component.translatable("gtceu.tool.class." + s)) - .collect(Component::empty, FormattingUtil::combineComponents, FormattingUtil::combineComponents) - )); + .collect(Component::empty, FormattingUtil::combineComponents, + FormattingUtil::combineComponents))); // repair info if (!tagCompound.getBoolean(UNBREAKABLE_KEY)) { @@ -712,7 +735,8 @@ default int getTotalHarvestLevel(ItemStack stack) { } if (!repairItems.isEmpty()) { tooltip.add(Component.translatable("item.gtceu.tool.tooltip.repair_material", repairItems.stream() - .collect(Component::empty, FormattingUtil::combineComponents, FormattingUtil::combineComponents))); + .collect(Component::empty, FormattingUtil::combineComponents, + FormattingUtil::combineComponents))); } } else { tooltip.add(Component.translatable("item.gtceu.tool.tooltip.repair_info")); @@ -722,8 +746,6 @@ default int getTotalHarvestLevel(ItemStack stack) { tooltip.add(Component.translatable("item.gtceu.tool.replace_tool_head")); } } - - default boolean definition$canApplyAtEnchantingTable(@NotNull ItemStack stack, Enchantment enchantment) { if (stack.isEmpty()) return false; @@ -737,11 +759,13 @@ default int getTotalHarvestLevel(ItemStack stack) { case "enchantment.cofhcore.smelting": // cofhcore case "enchantment.as.smelting": // astral sorcery // block autosmelt enchants from AoE and Tree-Felling tools - return getToolStats().getAoEDefinition(stack) == AoESymmetrical.none() && !getBehaviorsTag(stack).contains(TREE_FELLING_KEY); + return getToolStats().getAoEDefinition(stack) == AoESymmetrical.none() && + !getBehaviorsTag(stack).contains(TREE_FELLING_KEY); } // Block Mending and Unbreaking on Electric tools - if (isElectric() && (enchantment instanceof MendingEnchantment || enchantment instanceof DigDurabilityEnchantment)) { + if (isElectric() && + (enchantment instanceof MendingEnchantment || enchantment instanceof DigDurabilityEnchantment)) { return false; } @@ -798,7 +822,8 @@ default boolean canPlaySound(ItemStack stack) { default void playSound(Player player) { if (ConfigHolder.INSTANCE.client.toolUseSounds && getSound() != null) { - player.level().playSound(null, player.position().x, player.position().y, player.position().z, getSound().getMainEvent(), SoundSource.PLAYERS, 1F, 1F); + player.level().playSound(null, player.position().x, player.position().y, player.position().z, + getSound().getMainEvent(), SoundSource.PLAYERS, 1F, 1F); } } @@ -834,12 +859,14 @@ default ModularUI createUI(Player entityPlayer, HeldItemUIFactory.HeldItemHolder AoESymmetrical.decreaseLayer(tag, defaultDefinition); holder.markAsDirty(); })) - .widget(new LabelWidget(23, 65, () -> - Integer.toString(1 + 2 * AoESymmetrical.getColumn(getBehaviorsTag(holder.getHeld()), defaultDefinition)))) - .widget(new LabelWidget(58, 65, () -> - Integer.toString(1 + 2 * AoESymmetrical.getRow(getBehaviorsTag(holder.getHeld()), defaultDefinition)))) - .widget(new LabelWidget(93, 65, () -> - Integer.toString(1 + AoESymmetrical.getLayer(getBehaviorsTag(holder.getHeld()), defaultDefinition)))); + .widget(new LabelWidget(23, 65, + () -> Integer.toString(1 + + 2 * AoESymmetrical.getColumn(getBehaviorsTag(holder.getHeld()), defaultDefinition)))) + .widget(new LabelWidget(58, 65, + () -> Integer.toString( + 1 + 2 * AoESymmetrical.getRow(getBehaviorsTag(holder.getHeld()), defaultDefinition)))) + .widget(new LabelWidget(93, 65, () -> Integer + .toString(1 + AoESymmetrical.getLayer(getBehaviorsTag(holder.getHeld()), defaultDefinition)))); } default Set getToolClasses(ItemStack stack) { @@ -856,8 +883,10 @@ default Set getToolClassNames(ItemStack stack) { if (isElectric()) { ElectricStats item = ElectricStats.createElectricItem(0L, getElectricTier()); providers.add(new ICapabilityProvider() { + @Override - public @NotNull LazyOptional getCapability(@NotNull Capability capability, @org.jetbrains.annotations.Nullable Direction arg) { + public @NotNull LazyOptional getCapability(@NotNull Capability capability, + @org.jetbrains.annotations.Nullable Direction arg) { return item.getCapability(stack, capability); } }); @@ -865,8 +894,11 @@ default Set getToolClassNames(ItemStack stack) { for (IToolBehavior behavior : getToolStats().getBehaviors()) { if (behavior instanceof IComponentCapability componentCapability) { providers.add(new ICapabilityProvider() { + @Override - public @NotNull LazyOptional getCapability(@NotNull Capability capability, @org.jetbrains.annotations.Nullable Direction arg) { + public @NotNull < + T> LazyOptional getCapability(@NotNull Capability capability, + @org.jetbrains.annotations.Nullable Direction arg) { return componentCapability.getCapability(stack, capability); } }); @@ -879,15 +911,16 @@ default Set getToolClassNames(ItemStack stack) { default boolean definition$isCorrectToolForDrops(ItemStack stack, BlockState state) { if (stack.getItem() instanceof IGTTool gtTool) { - boolean isCorrectToolType = gtTool.getToolClasses(stack).stream().anyMatch(type -> type.harvestTags.stream().anyMatch(state::is)); + boolean isCorrectToolType = gtTool.getToolClasses(stack).stream() + .anyMatch(type -> type.harvestTags.stream().anyMatch(state::is)); if (!isCorrectToolType) { return false; } final int totalLevel = gtTool.getTotalHarvestLevel(stack); List tiers = TierSortingRegistry.getSortedTiers().stream() - .filter(tier -> tier.getLevel() == totalLevel) - .toList(); + .filter(tier -> tier.getLevel() == totalLevel) + .toList(); Tier tier = !tiers.isEmpty() ? tiers.get(tiers.size() - 1) : null; if (tier == null) return false; diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/LaserPipeBlockItem.java b/src/main/java/com/gregtechceu/gtceu/api/item/LaserPipeBlockItem.java index 51874127ca..ef8c719a24 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/LaserPipeBlockItem.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/LaserPipeBlockItem.java @@ -2,12 +2,15 @@ import com.gregtechceu.gtceu.api.block.PipeBlock; import com.gregtechceu.gtceu.common.block.LaserPipeBlock; + import com.lowdragmc.lowdraglib.client.renderer.IItemRendererProvider; import com.lowdragmc.lowdraglib.client.renderer.IRenderer; + import net.minecraft.client.color.item.ItemColor; import net.minecraft.world.item.ItemStack; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + import org.jetbrains.annotations.Nullable; public class LaserPipeBlockItem extends PipeBlockItem implements IItemRendererProvider { @@ -25,7 +28,8 @@ public LaserPipeBlock getBlock() { public static ItemColor tintColor() { return (itemStack, index) -> { if (itemStack.getItem() instanceof LaserPipeBlockItem materialBlockItem) { - return LaserPipeBlock.tintedColor().getColor(materialBlockItem.getBlock().defaultBlockState(), null, null, index); + return LaserPipeBlock.tintedColor().getColor(materialBlockItem.getBlock().defaultBlockState(), null, + null, index); } return -1; }; diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/MaterialBlockItem.java b/src/main/java/com/gregtechceu/gtceu/api/item/MaterialBlockItem.java index da0ee258ca..e5455a46e6 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/MaterialBlockItem.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/MaterialBlockItem.java @@ -4,9 +4,11 @@ import com.gregtechceu.gtceu.api.block.MaterialBlock; import com.gregtechceu.gtceu.api.data.chemical.material.properties.DustProperty; import com.gregtechceu.gtceu.api.data.chemical.material.properties.PropertyKey; + import com.lowdragmc.lowdraglib.client.renderer.IBlockRendererProvider; import com.lowdragmc.lowdraglib.client.renderer.IItemRendererProvider; import com.lowdragmc.lowdraglib.client.renderer.IRenderer; + import net.minecraft.client.color.item.ItemColor; import net.minecraft.network.chat.Component; import net.minecraft.world.item.BlockItem; @@ -15,9 +17,9 @@ import net.minecraft.world.item.crafting.RecipeType; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * @author KilaBash @@ -38,14 +40,12 @@ public int getBurnTime(ItemStack itemStack, @Nullable RecipeType recipeType) return getItemBurnTime(); } - public void onRegister() { - - } + public void onRegister() {} @Override @NotNull public MaterialBlock getBlock() { - return (MaterialBlock)super.getBlock(); + return (MaterialBlock) super.getBlock(); } @OnlyIn(Dist.CLIENT) @@ -91,7 +91,8 @@ public Component getName(ItemStack stack) { public int getItemBurnTime() { var material = getBlock().material; DustProperty property = material == null ? null : material.getProperty(PropertyKey.DUST); - if (property != null) return (int) (property.getBurnTime() * getBlock().tagPrefix.getMaterialAmount(material) / GTValues.M); + if (property != null) + return (int) (property.getBurnTime() * getBlock().tagPrefix.getMaterialAmount(material) / GTValues.M); return -1; } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/MaterialPipeBlockItem.java b/src/main/java/com/gregtechceu/gtceu/api/item/MaterialPipeBlockItem.java index e5d7701319..52ca3f5ecb 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/MaterialPipeBlockItem.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/MaterialPipeBlockItem.java @@ -1,18 +1,20 @@ package com.gregtechceu.gtceu.api.item; import com.gregtechceu.gtceu.api.block.MaterialPipeBlock; + import com.lowdragmc.lowdraglib.client.renderer.IItemRendererProvider; import com.lowdragmc.lowdraglib.client.renderer.IRenderer; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.client.color.item.ItemColor; import net.minecraft.network.chat.Component; -import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.ItemStack; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + import javax.annotation.ParametersAreNonnullByDefault; /** @@ -30,14 +32,15 @@ public MaterialPipeBlockItem(MaterialPipeBlock block, Properties properties) { @Override @NotNull public MaterialPipeBlock getBlock() { - return (MaterialPipeBlock)super.getBlock(); + return (MaterialPipeBlock) super.getBlock(); } @OnlyIn(Dist.CLIENT) public static ItemColor tintColor() { return (itemStack, index) -> { if (itemStack.getItem() instanceof MaterialPipeBlockItem materialBlockItem) { - return materialBlockItem.getBlock().tinted(materialBlockItem.getBlock().defaultBlockState(), null, null, index); + return materialBlockItem.getBlock().tinted(materialBlockItem.getBlock().defaultBlockState(), null, null, + index); } return -1; }; diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/MetaMachineItem.java b/src/main/java/com/gregtechceu/gtceu/api/item/MetaMachineItem.java index d8eb574ca8..6e83030b51 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/MetaMachineItem.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/MetaMachineItem.java @@ -4,8 +4,10 @@ import com.gregtechceu.gtceu.api.block.PipeBlock; import com.gregtechceu.gtceu.api.machine.MachineDefinition; import com.gregtechceu.gtceu.api.pipenet.IPipeNode; + import com.lowdragmc.lowdraglib.client.renderer.IItemRendererProvider; import com.lowdragmc.lowdraglib.client.renderer.IRenderer; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -15,6 +17,7 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; + import org.jetbrains.annotations.Nullable; import javax.annotation.ParametersAreNonnullByDefault; @@ -43,7 +46,7 @@ public IRenderer getRenderer(ItemStack stack) { } @Override - @SuppressWarnings({"rawtypes", "unchecked"}) + @SuppressWarnings({ "rawtypes", "unchecked" }) protected boolean placeBlock(BlockPlaceContext context, BlockState state) { Level level = context.getLevel(); BlockPos pos = context.getClickedPos(); @@ -57,7 +60,7 @@ protected boolean placeBlock(BlockPlaceContext context, BlockState state) { if (block instanceof PipeBlock) { IPipeNode pipeTile = ((PipeBlock) block).getPipeTile(level, possiblePipe); if (pipeTile != null && ((PipeBlock) block).canPipeConnectToBlock(pipeTile, side.getOpposite(), - level.getBlockEntity(pos))) { + level.getBlockEntity(pos))) { pipeTile.setConnection(side, true, false); } } @@ -65,4 +68,3 @@ protected boolean placeBlock(BlockPlaceContext context, BlockState state) { return superVal; } } - diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/OpticalPipeBlockItem.java b/src/main/java/com/gregtechceu/gtceu/api/item/OpticalPipeBlockItem.java index c306e3bd3b..009b6a3499 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/OpticalPipeBlockItem.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/OpticalPipeBlockItem.java @@ -1,22 +1,24 @@ package com.gregtechceu.gtceu.api.item; import com.gregtechceu.gtceu.common.block.OpticalPipeBlock; -import com.gregtechceu.gtceu.common.pipelike.optical.OpticalPipeProperties; -import com.gregtechceu.gtceu.common.pipelike.optical.OpticalPipeType; import com.gregtechceu.gtceu.utils.GTUtil; + import com.lowdragmc.lowdraglib.client.renderer.IItemRendererProvider; import com.lowdragmc.lowdraglib.client.renderer.IRenderer; + import net.minecraft.network.chat.Component; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.level.Level; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.List; +import javax.annotation.ParametersAreNonnullByDefault; + @ParametersAreNonnullByDefault public class OpticalPipeBlockItem extends PipeBlockItem implements IItemRendererProvider { @@ -25,7 +27,8 @@ public OpticalPipeBlockItem(OpticalPipeBlock block, Properties properties) { } @Override - public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltip, TooltipFlag isAdvanced) { + public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltip, + TooltipFlag isAdvanced) { super.appendHoverText(stack, level, tooltip, isAdvanced); tooltip.add(Component.translatable("block.gtceu.normal_optical_pipe.tooltip")); @@ -42,4 +45,4 @@ public void appendHoverText(ItemStack stack, @Nullable Level level, List recipeType) return getItemBurnTime(); } - public void onRegister() { - - } + public void onRegister() {} @OnlyIn(Dist.CLIENT) public static ItemColor tintColor() { @@ -70,12 +71,13 @@ public static ItemColor tintColor() { } @Override - public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltipComponents, TooltipFlag isAdvanced) { + public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltipComponents, + TooltipFlag isAdvanced) { super.appendHoverText(stack, level, tooltipComponents, isAdvanced); if (this.tagPrefix.tooltip() != null) { this.tagPrefix.tooltip().accept(material, tooltipComponents); } - GTUtil.appendHazardTooltips(material,tooltipComponents); + GTUtil.appendHazardTooltips(material, tooltipComponents); } @Override @@ -103,12 +105,8 @@ public void inventoryTick(ItemStack stack, Level level, Entity entity, int slotI super.inventoryTick(stack, level, entity, slotId, isSelected); if (entity instanceof LivingEntity livingEntity) { if (livingEntity.tickCount % 20 == 0) { - - - if (tagPrefix != TagPrefix.ingotHot || !material.hasProperty(PropertyKey.BLAST)) { //ignore hazards for hot ingots - GTUtil.applyHazardEffects(material, livingEntity, () -> material.getProperty(HAZARD).getHazardType().isAffected(tagPrefix)); + if (tagPrefix != TagPrefix.ingotHot || !material.hasProperty(PropertyKey.BLAST)) return; - } float heatDamage = ((material.getBlastTemperature() - 1750) / 1000.0F) + 2; ItemStack armor = livingEntity.getItemBySlot(EquipmentSlot.CHEST); @@ -126,7 +124,8 @@ public void inventoryTick(ItemStack stack, Level level, Entity entity, int slotI public int getItemBurnTime() { DustProperty property = material == null ? null : material.getProperty(PropertyKey.DUST); - if (property != null) return (int) (property.getBurnTime() * tagPrefix.getMaterialAmount(material) / GTValues.M); + if (property != null) + return (int) (property.getBurnTime() * tagPrefix.getMaterialAmount(material) / GTValues.M); return -1; } diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/armor/ArmorComponentItem.java b/src/main/java/com/gregtechceu/gtceu/api/item/armor/ArmorComponentItem.java index ca0c755f4e..1910f7d0c5 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/armor/ArmorComponentItem.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/armor/ArmorComponentItem.java @@ -1,11 +1,9 @@ package com.gregtechceu.gtceu.api.item.armor; -import com.google.common.base.Preconditions; -import com.google.common.collect.*; import com.gregtechceu.gtceu.api.item.IComponentItem; import com.gregtechceu.gtceu.api.item.component.*; import com.gregtechceu.gtceu.api.item.component.forge.IComponentCapability; -import lombok.Getter; + import net.minecraft.client.model.HumanoidModel; import net.minecraft.core.NonNullList; import net.minecraft.network.chat.Component; @@ -25,6 +23,10 @@ import net.minecraftforge.client.extensions.common.IClientItemExtensions; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.util.LazyOptional; + +import com.google.common.base.Preconditions; +import com.google.common.collect.*; +import lombok.Getter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -34,6 +36,7 @@ import java.util.function.Consumer; public class ArmorComponentItem extends ArmorItem implements IComponentItem { + @Getter private IArmorLogic armorLogic = new DummyArmorLogic(); @Getter @@ -107,15 +110,19 @@ public int getArmorDisplay(Player player, @NotNull ItemStack armor, EquipmentSlo return armorLogic.getArmorDisplay(player, armor, slot); } - public void damageArmor(LivingEntity entity, @NotNull ItemStack stack, DamageSource source, int damage, EquipmentSlot slot) { + public void damageArmor(LivingEntity entity, @NotNull ItemStack stack, DamageSource source, int damage, + EquipmentSlot slot) { armorLogic.damageArmor(entity, stack, source, damage, slot); } @Override public void initializeClient(Consumer consumer) { consumer.accept(new IClientItemExtensions() { + @Override - public @NotNull HumanoidModel getHumanoidArmorModel(LivingEntity livingEntity, ItemStack itemStack, EquipmentSlot equipmentSlot, HumanoidModel original) { + public @NotNull HumanoidModel getHumanoidArmorModel(LivingEntity livingEntity, ItemStack itemStack, + EquipmentSlot equipmentSlot, + HumanoidModel original) { return armorLogic.getArmorModel(livingEntity, itemStack, equipmentSlot, original); } }); @@ -128,7 +135,7 @@ public String getArmorTexture(ItemStack stack, Entity entity, EquipmentSlot slot } /////////////////////////////////////////// - ///// ALL component item things /////// + ///// ALL component item things /////// /////////////////////////////////////////// public void fillItemCategory(CreativeModeTab category, NonNullList items) { @@ -144,7 +151,8 @@ public void fillItemCategory(CreativeModeTab category, NonNullList it } @Override - public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltipComponents, TooltipFlag isAdvanced) { + public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltipComponents, + TooltipFlag isAdvanced) { for (IItemComponent component : components) { if (component instanceof IAddInformation addInformation) { addInformation.appendHoverText(stack, level, tooltipComponents, isAdvanced); @@ -232,7 +240,8 @@ public InteractionResult onItemUseFirst(ItemStack itemStack, UseOnContext contex } @Override - public InteractionResult interactLivingEntity(ItemStack stack, Player player, LivingEntity interactionTarget, InteractionHand usedHand) { + public InteractionResult interactLivingEntity(ItemStack stack, Player player, LivingEntity interactionTarget, + InteractionHand usedHand) { for (IItemComponent component : components) { if (component instanceof IInteractionItem interactionItem) { var result = interactionItem.interactLivingEntity(stack, player, interactionTarget, usedHand); diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/armor/ArmorLogicSuite.java b/src/main/java/com/gregtechceu/gtceu/api/item/armor/ArmorLogicSuite.java index 59fc2fa17d..bba78688d9 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/armor/ArmorLogicSuite.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/armor/ArmorLogicSuite.java @@ -1,11 +1,10 @@ package com.gregtechceu.gtceu.api.item.armor; -import com.google.common.collect.ImmutableMultimap; -import com.google.common.collect.Multimap; import com.gregtechceu.gtceu.api.capability.GTCapabilityHelper; import com.gregtechceu.gtceu.api.capability.IElectricItem; import com.gregtechceu.gtceu.api.item.component.ElectricStats; import com.gregtechceu.gtceu.api.item.component.IItemHUDProvider; + import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.InteractionHand; @@ -23,6 +22,9 @@ import net.minecraft.world.level.Level; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + +import com.google.common.collect.ImmutableMultimap; +import com.google.common.collect.Multimap; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -64,30 +66,33 @@ public Multimap getAttributeModifiers(EquipmentSlo UUID uuid = IArmorLogic.ARMOR_MODIFIER_UUID_PER_TYPE.get(type); if (item == null) return ImmutableMultimap.of(); if (item.getCharge() >= energyPerUse) { - return ImmutableMultimap.of(Attributes.ARMOR, new AttributeModifier(uuid, "Armor modifier", 20.0F * this.getAbsorption() * this.getDamageAbsorption(), AttributeModifier.Operation.ADDITION)); + return ImmutableMultimap.of(Attributes.ARMOR, new AttributeModifier(uuid, "Armor modifier", + 20.0F * this.getAbsorption() * this.getDamageAbsorption(), AttributeModifier.Operation.ADDITION)); } else { - return ImmutableMultimap.of(Attributes.ARMOR, new AttributeModifier(uuid, "Armor modifier", 4.0F * this.getAbsorption() * this.getDamageAbsorption(), AttributeModifier.Operation.ADDITION)); + return ImmutableMultimap.of(Attributes.ARMOR, new AttributeModifier(uuid, "Armor modifier", + 4.0F * this.getAbsorption() * this.getDamageAbsorption(), AttributeModifier.Operation.ADDITION)); } } @Override public void addToolComponents(ArmorComponentItem mvi) { mvi.attachComponents(new ElectricStats(maxCapacity, tier, true, false) { + @Override - public InteractionResultHolder use(Item item, Level level, Player player, InteractionHand usedHand) { + public InteractionResultHolder use(Item item, Level level, Player player, + InteractionHand usedHand) { return onRightClick(level, player, usedHand); } @Override - public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltipComponents, TooltipFlag isAdvanced) { + public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltipComponents, + TooltipFlag isAdvanced) { addInfo(stack, tooltipComponents); } }); } - public void addInfo(ItemStack itemStack, List lines) { - - } + public void addInfo(ItemStack itemStack, List lines) {} public InteractionResultHolder onRightClick(Level Level, Player player, InteractionHand hand) { return InteractionResultHolder.pass(player.getItemInHand(hand)); @@ -113,7 +118,8 @@ protected static void addCapacityHUD(ItemStack stack, ArmorUtils.ModularHUD hud) if (cont == null) return; if (cont.getCharge() == 0) return; float energyMultiplier = cont.getCharge() * 100.0F / cont.getMaxCharge(); - hud.newString(Component.translatable("metaarmor.hud.energy_lvl", String.format("%.1f", energyMultiplier) + "%")); + hud.newString( + Component.translatable("metaarmor.hud.energy_lvl", String.format("%.1f", energyMultiplier) + "%")); } @OnlyIn(Dist.CLIENT) @@ -128,12 +134,9 @@ public int getEnergyPerUse() { protected float getAbsorption() { return switch (this.getArmorType()) { - case HELMET, BOOTS -> - 0.15F; - case CHESTPLATE -> - 0.4F; - case LEGGINGS -> - 0.3F; + case HELMET, BOOTS -> 0.15F; + case CHESTPLATE -> 0.4F; + case LEGGINGS -> 0.3F; }; } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/armor/ArmorUtils.java b/src/main/java/com/gregtechceu/gtceu/api/item/armor/ArmorUtils.java index 42d4165844..e32c77939d 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/armor/ArmorUtils.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/armor/ArmorUtils.java @@ -6,9 +6,7 @@ import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.core.mixins.ServerGamePacketListenerImplAccessor; import com.gregtechceu.gtceu.utils.ItemStackHashStrategy; -import com.mojang.datafixers.util.Pair; -import it.unimi.dsi.fastutil.objects.Object2IntMap; -import it.unimi.dsi.fastutil.objects.Object2IntOpenCustomHashMap; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.core.NonNullList; @@ -26,12 +24,17 @@ import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.event.ForgeEventFactory; -import javax.annotation.Nonnull; +import com.mojang.datafixers.util.Pair; +import it.unimi.dsi.fastutil.objects.Object2IntMap; +import it.unimi.dsi.fastutil.objects.Object2IntOpenCustomHashMap; + import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import javax.annotation.Nonnull; + public class ArmorUtils { /** @@ -40,7 +43,8 @@ public class ArmorUtils { public static boolean isPossibleToCharge(ItemStack chargeable) { IElectricItem container = GTCapabilityHelper.getElectricItem(chargeable); if (container != null) { - return container.getCharge() < container.getMaxCharge() && (container.getCharge() + container.getTransferLimit()) <= container.getMaxCharge(); + return container.getCharge() < container.getMaxCharge() && + (container.getCharge() + container.getTransferLimit()) <= container.getMaxCharge(); } return false; } @@ -65,35 +69,34 @@ public static List, List>> getChargeableIte } } - if(!openMainSlots.isEmpty()) { + if (!openMainSlots.isEmpty()) { inventorySlotMap.add(Pair.of(player.getInventory().items, openMainSlots)); } - List openArmorSlots = new ArrayList<>(); - for(int i = 0; i < player.getInventory().armor.size(); i++) { + for (int i = 0; i < player.getInventory().armor.size(); i++) { ItemStack current = player.getInventory().armor.get(i); IElectricItem item = GTCapabilityHelper.getElectricItem(current); - if(item == null) { + if (item == null) { continue; } - if(isPossibleToCharge(current) && item.getTier() <= tier) { + if (isPossibleToCharge(current) && item.getTier() <= tier) { openArmorSlots.add(i); } } - if(!openArmorSlots.isEmpty()) { + if (!openArmorSlots.isEmpty()) { inventorySlotMap.add(Pair.of(player.getInventory().armor, openArmorSlots)); } ItemStack offHand = player.getInventory().offhand.get(0); IElectricItem offHandItem = GTCapabilityHelper.getElectricItem(offHand); - if(offHandItem == null) { + if (offHandItem == null) { return inventorySlotMap; } - if(isPossibleToCharge(offHand) && offHandItem.getTier() <= tier) { + if (isPossibleToCharge(offHand) && offHandItem.getTier() <= tier) { inventorySlotMap.add(Pair.of(player.getInventory().offhand, Collections.singletonList(0))); } @@ -106,7 +109,8 @@ public static List, List>> getChargeableIte public static void spawnParticle(Level world, Player player, ParticleOptions type, double speedY) { if (type != null) { Vec3 forward = player.getForward(); - world.addParticle(type, player.getX() - forward.x, player.getY() + 0.5D, player.getZ() - forward.z, 0.0D, speedY, 0.0D); + world.addParticle(type, player.getX() - forward.x, player.getY() + 0.5D, player.getZ() - forward.z, 0.0D, + speedY, 0.0D); } } @@ -132,7 +136,7 @@ public static void playJetpackSound(@Nonnull Player player) { */ public static void resetPlayerFloatingTime(Player player) { if (player instanceof ServerPlayer serverPlayer) { - ((ServerGamePacketListenerImplAccessor)serverPlayer.connection).setAboveGroundTickCount(0); + ((ServerGamePacketListenerImplAccessor) serverPlayer.connection).setAboveGroundTickCount(0); } } @@ -149,7 +153,8 @@ public static InteractionResultHolder eat(Player player, ItemStack fo FoodProperties foodItem = food.getFoodProperties(player); if (foodItem != null && player.getFoodData().needsFood()) { - ItemStack result = ForgeEventFactory.onItemUseFinish(player, food.copy(), player.getUseItemRemainingTicks(), food.finishUsingItem(player.level(), player)); + ItemStack result = ForgeEventFactory.onItemUseFinish(player, food.copy(), player.getUseItemRemainingTicks(), + food.finishUsingItem(player.level(), player)); return InteractionResultHolder.success(result); } else { return InteractionResultHolder.fail(food); @@ -163,7 +168,8 @@ public static InteractionResultHolder eat(Player player, ItemStack fo * @return Formated list */ public static List format(List input) { - Object2IntMap items = new Object2IntOpenCustomHashMap<>(ItemStackHashStrategy.comparingAllButCount()); + Object2IntMap items = new Object2IntOpenCustomHashMap<>( + ItemStackHashStrategy.comparingAllButCount()); List output = new ArrayList<>(); for (ItemStack itemStack : input) { if (items.containsKey(itemStack)) { @@ -181,7 +187,6 @@ public static List format(List input) { return output; } - @Nonnull public static String format(long value) { return new DecimalFormat("###,###.##").format(value); @@ -198,6 +203,7 @@ public static String format(double value) { */ @OnlyIn(Dist.CLIENT) public static class ModularHUD { + private byte stringAmount = 0; private final List stringList; private static final Minecraft mc = Minecraft.getInstance(); @@ -214,7 +220,8 @@ public void newString(Component string) { public void draw(GuiGraphics poseStack) { for (int i = 0; i < stringAmount; i++) { Pair coords = this.getStringCoord(i); - poseStack.drawString(mc.font, stringList.get(i), coords.getFirst(), coords.getSecond(), 0xFFFFFF, false); + poseStack.drawString(mc.font, stringList.get(i), coords.getFirst(), coords.getSecond(), 0xFFFFFF, + false); } } @@ -237,14 +244,16 @@ private Pair getStringCoord(int index) { } case 3 -> { posX = 1 + ConfigHolder.INSTANCE.client.armorHud.hudOffsetX; - posY = windowHeight - fontHeight * (stringAmount - index) - 1 - ConfigHolder.INSTANCE.client.armorHud.hudOffsetY; + posY = windowHeight - fontHeight * (stringAmount - index) - 1 - + ConfigHolder.INSTANCE.client.armorHud.hudOffsetY; } case 4 -> { posX = windowWidth - (1 + ConfigHolder.INSTANCE.client.armorHud.hudOffsetX) - stringWidth; - posY = windowHeight - fontHeight * (stringAmount - index) - 1 - ConfigHolder.INSTANCE.client.armorHud.hudOffsetY; + posY = windowHeight - fontHeight * (stringAmount - index) - 1 - + ConfigHolder.INSTANCE.client.armorHud.hudOffsetY; } - default -> - throw new IllegalArgumentException("Armor Hud config hudLocation is improperly configured. Allowed values: [1,2,3,4]"); + default -> throw new IllegalArgumentException( + "Armor Hud config hudLocation is improperly configured. Allowed values: [1,2,3,4]"); } return Pair.of(posX, posY); } @@ -253,6 +262,5 @@ public void reset() { this.stringAmount = 0; this.stringList.clear(); } - } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/armor/DummyArmorLogic.java b/src/main/java/com/gregtechceu/gtceu/api/item/armor/DummyArmorLogic.java index 567db2b10e..d646064f6b 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/armor/DummyArmorLogic.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/armor/DummyArmorLogic.java @@ -6,9 +6,11 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ArmorItem; import net.minecraft.world.item.ItemStack; + import org.jetbrains.annotations.NotNull; public class DummyArmorLogic implements IArmorLogic { + @Override public ArmorItem.Type getArmorType() { return ArmorItem.Type.HELMET; @@ -28,4 +30,4 @@ public boolean isValidArmor(ItemStack itemStack, Entity entity, EquipmentSlot eq public ResourceLocation getArmorTexture(ItemStack stack, Entity entity, EquipmentSlot slot, String type) { return new ResourceLocation("minecraft", "textures/armor/diamond_layer_0.png"); } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/armor/IArmorLogic.java b/src/main/java/com/gregtechceu/gtceu/api/item/armor/IArmorLogic.java index 518d2e4fd8..f449c5227d 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/armor/IArmorLogic.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/armor/IArmorLogic.java @@ -1,7 +1,5 @@ package com.gregtechceu.gtceu.api.item.armor; -import com.google.common.collect.ImmutableMultimap; -import com.google.common.collect.Multimap; import net.minecraft.Util; import net.minecraft.client.model.HumanoidModel; import net.minecraft.resources.ResourceLocation; @@ -17,6 +15,9 @@ import net.minecraft.world.level.Level; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + +import com.google.common.collect.ImmutableMultimap; +import com.google.common.collect.Multimap; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -34,8 +35,7 @@ public interface IArmorLogic { map.put(ArmorItem.Type.HELMET, UUID.fromString("2AD3F246-FEE1-4E67-B886-69FD380BB150")); }); - default void addToolComponents(ArmorComponentItem item) { - } + default void addToolComponents(ArmorComponentItem item) {} ArmorItem.Type getArmorType(); @@ -54,9 +54,8 @@ default boolean isPPE() { return false; } - default void damageArmor(LivingEntity entity, ItemStack itemStack, DamageSource source, int damage, EquipmentSlot equipmentSlot) { - - } + default void damageArmor(LivingEntity entity, ItemStack itemStack, DamageSource source, int damage, + EquipmentSlot equipmentSlot) {} default Multimap getAttributeModifiers(EquipmentSlot slot, ItemStack stack) { return ImmutableMultimap.of(); @@ -66,12 +65,10 @@ default boolean isValidArmor(ItemStack itemStack, Entity entity, EquipmentSlot e return getArmorType().getSlot() == equipmentSlot; } - default void onArmorTick(Level world, Player player, ItemStack itemStack) { - } + default void onArmorTick(Level world, Player player, ItemStack itemStack) {} @OnlyIn(Dist.CLIENT) - default void renderHelmetOverlay(ItemStack itemStack, Player player, float partialTicks) { - } + default void renderHelmetOverlay(ItemStack itemStack, Player player, float partialTicks) {} default int getArmorLayersAmount(ItemStack itemStack) { return 1; @@ -85,7 +82,8 @@ default int getArmorLayerColor(ItemStack itemStack, int layerIndex) { ResourceLocation getArmorTexture(ItemStack stack, Entity entity, EquipmentSlot slot, String type); @NotNull - default HumanoidModel getArmorModel(LivingEntity entityLiving, ItemStack itemStack, EquipmentSlot armorSlot, HumanoidModel defaultModel) { + default HumanoidModel getArmorModel(LivingEntity entityLiving, ItemStack itemStack, EquipmentSlot armorSlot, + HumanoidModel defaultModel) { return defaultModel; } diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/capability/ElectricItem.java b/src/main/java/com/gregtechceu/gtceu/api/item/capability/ElectricItem.java index a5d8d6268e..53b6657bed 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/capability/ElectricItem.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/capability/ElectricItem.java @@ -1,8 +1,8 @@ package com.gregtechceu.gtceu.api.item.capability; - import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.capability.IElectricItem; + import net.minecraft.nbt.Tag; import net.minecraft.world.item.ItemStack; @@ -16,8 +16,8 @@ public class ElectricItem implements IElectricItem { protected final boolean chargeable; protected final boolean canProvideEnergyExternally; - - public ElectricItem(ItemStack itemStack, long maxCharge, int tier, boolean chargeable, boolean canProvideEnergyExternally) { + public ElectricItem(ItemStack itemStack, long maxCharge, int tier, boolean chargeable, + boolean canProvideEnergyExternally) { this.itemStack = itemStack; this.maxCharge = maxCharge; this.tier = tier; @@ -91,11 +91,13 @@ public long charge(long amount, int chargerTier, boolean ignoreTransferLimit, bo } @Override - public long discharge(long amount, int chargerTier, boolean ignoreTransferLimit, boolean externally, boolean simulate) { + public long discharge(long amount, int chargerTier, boolean ignoreTransferLimit, boolean externally, + boolean simulate) { if (itemStack.getCount() != 1) { return 0L; } - if ((canProvideEnergyExternally || !externally || amount == Long.MAX_VALUE) && (chargerTier >= tier) && amount > 0L) { + if ((canProvideEnergyExternally || !externally || amount == Long.MAX_VALUE) && (chargerTier >= tier) && + amount > 0L) { if (!ignoreTransferLimit) { amount = Math.min(amount, getTransferLimit()); } @@ -113,5 +115,4 @@ public long discharge(long amount, int chargerTier, boolean ignoreTransferLimit, public int getTier() { return tier; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/component/ElectricStats.java b/src/main/java/com/gregtechceu/gtceu/api/item/component/ElectricStats.java index 3e53cfd58f..146333531e 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/component/ElectricStats.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/component/ElectricStats.java @@ -6,7 +6,9 @@ import com.gregtechceu.gtceu.api.capability.forge.GTCapability; import com.gregtechceu.gtceu.api.item.capability.ElectricItem; import com.gregtechceu.gtceu.api.item.component.forge.IComponentCapability; + import com.lowdragmc.lowdraglib.utils.LocalizationUtils; + import net.minecraft.core.NonNullList; import net.minecraft.network.chat.Component; import net.minecraft.world.InteractionHand; @@ -20,6 +22,7 @@ import net.minecraft.world.level.Level; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.util.LazyOptional; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -27,7 +30,8 @@ import java.time.Instant; import java.util.List; -public class ElectricStats implements IInteractionItem, ISubItemHandler, IAddInformation, IItemLifeCycle, IComponentCapability { +public class ElectricStats implements IInteractionItem, ISubItemHandler, IAddInformation, IItemLifeCycle, + IComponentCapability { public static final ElectricStats EMPTY = ElectricStats.create(0, 0, false, false); @@ -51,7 +55,8 @@ public static ElectricStats create(long maxCharge, long tier, boolean chargeable @Override public @NotNull LazyOptional getCapability(ItemStack itemStack, @NotNull Capability capability) { if (capability == GTCapability.CAPABILITY_ELECTRIC_ITEM) { - return GTCapability.CAPABILITY_ELECTRIC_ITEM.orEmpty(capability, LazyOptional.of(() -> new ElectricItem(itemStack, maxCharge, tier, chargeable, dischargeable))); + return GTCapability.CAPABILITY_ELECTRIC_ITEM.orEmpty(capability, + LazyOptional.of(() -> new ElectricItem(itemStack, maxCharge, tier, chargeable, dischargeable))); } return LazyOptional.empty(); } @@ -65,7 +70,6 @@ public static float getStoredPredicate(ItemStack itemStack) { return 0; } - @Override public InteractionResultHolder use(Item item, Level level, Player player, InteractionHand usedHand) { var itemStack = player.getItemInHand(usedHand); @@ -74,7 +78,7 @@ public InteractionResultHolder use(Item item, Level level, Player pla if (!level.isClientSide) { boolean isInDischargeMode = isInDischargeMode(itemStack); String locale = "metaitem.electric.discharge_mode." + (isInDischargeMode ? "disabled" : "enabled"); - player.displayClientMessage(Component.translatable(locale),true); + player.displayClientMessage(Component.translatable(locale), true); setInDischargeMode(itemStack, !isInDischargeMode); } return InteractionResultHolder.success(itemStack); @@ -129,7 +133,8 @@ private static void setInDischargeMode(ItemStack itemStack, boolean isDischargeM } @Override - public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltipComponents, TooltipFlag isAdvanced) { + public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltipComponents, + TooltipFlag isAdvanced) { IElectricItem electricItem = GTCapabilityHelper.getElectricItem(stack); if (electricItem != null && electricItem.canProvideChargeExternally()) { addTotalChargeTooltip(tooltipComponents, electricItem.getMaxCharge(), electricItem.getTier()); diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/component/IAddInformation.java b/src/main/java/com/gregtechceu/gtceu/api/item/component/IAddInformation.java index aba805b457..a51e8d9f6a 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/component/IAddInformation.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/component/IAddInformation.java @@ -4,6 +4,7 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.level.Level; + import org.jetbrains.annotations.Nullable; import java.util.List; @@ -14,5 +15,7 @@ * @implNote IAddInformation */ public interface IAddInformation extends IItemComponent { - void appendHoverText(ItemStack stack, @Nullable Level level, List tooltipComponents, TooltipFlag isAdvanced); + + void appendHoverText(ItemStack stack, @Nullable Level level, List tooltipComponents, + TooltipFlag isAdvanced); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/component/ICustomDescriptionId.java b/src/main/java/com/gregtechceu/gtceu/api/item/component/ICustomDescriptionId.java index 308391431f..469387f221 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/component/ICustomDescriptionId.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/component/ICustomDescriptionId.java @@ -2,6 +2,7 @@ import net.minecraft.network.chat.Component; import net.minecraft.world.item.ItemStack; + import org.jetbrains.annotations.Nullable; /** @@ -10,6 +11,7 @@ * @implNote ICustomDescriptionId */ public interface ICustomDescriptionId extends IItemComponent { + @Nullable default String getItemDescriptionId(ItemStack itemStack) { return null; diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/component/ICustomRenderer.java b/src/main/java/com/gregtechceu/gtceu/api/item/component/ICustomRenderer.java index 7ed258df30..ac2372e7c6 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/component/ICustomRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/component/ICustomRenderer.java @@ -10,6 +10,7 @@ * @implNote ICustomRenderer */ public interface ICustomRenderer extends IItemComponent { + @NotNull IRenderer getRenderer(); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/component/IDataItem.java b/src/main/java/com/gregtechceu/gtceu/api/item/component/IDataItem.java index 3e5ae821cc..b4c15f8a29 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/component/IDataItem.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/component/IDataItem.java @@ -3,4 +3,4 @@ public interface IDataItem { boolean requireDataBank(); -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/component/IDurabilityBar.java b/src/main/java/com/gregtechceu/gtceu/api/item/component/IDurabilityBar.java index 3e0d9f1a9e..e8768c7da1 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/component/IDurabilityBar.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/component/IDurabilityBar.java @@ -2,6 +2,7 @@ import net.minecraft.util.Mth; import net.minecraft.world.item.ItemStack; + import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.Nullable; @@ -59,5 +60,4 @@ default boolean showEmptyBar(ItemStack itemStack) { default boolean showFullBar(ItemStack itemStack) { return true; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/component/IInteractionItem.java b/src/main/java/com/gregtechceu/gtceu/api/item/component/IInteractionItem.java index f482a5b5a7..6c65c5674e 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/component/IInteractionItem.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/component/IInteractionItem.java @@ -16,6 +16,7 @@ * @implNote IInteractionItem */ public interface IInteractionItem extends IItemComponent { + default InteractionResult useOn(UseOnContext context) { return InteractionResult.PASS; } @@ -42,7 +43,8 @@ default InteractionResult onItemUseFirst(ItemStack itemStack, UseOnContext conte return InteractionResult.PASS; } - default InteractionResult interactLivingEntity(ItemStack stack, Player player, LivingEntity interactionTarget, InteractionHand usedHand) { + default InteractionResult interactLivingEntity(ItemStack stack, Player player, LivingEntity interactionTarget, + InteractionHand usedHand) { return InteractionResult.PASS; } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/component/IItemComponent.java b/src/main/java/com/gregtechceu/gtceu/api/item/component/IItemComponent.java index 7cafcd4a17..110ce70d44 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/component/IItemComponent.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/component/IItemComponent.java @@ -1,20 +1,19 @@ package com.gregtechceu.gtceu.api.item.component; import com.gregtechceu.gtceu.api.item.ComponentItem; + import net.minecraft.world.item.Item; -import com.gregtechceu.gtceu.api.item.IComponentItem; /** * @author KilaBash * @date 2023/2/22 * @implNote IItemComponent * - * Describes generic component attachable to {@link ComponentItem} - * Multiple components can be attached to one item + * Describes generic component attachable to {@link ComponentItem} + * Multiple components can be attached to one item * */ public interface IItemComponent { - default void onAttached(Item item) { - } + default void onAttached(Item item) {} } diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/component/IItemHUDProvider.java b/src/main/java/com/gregtechceu/gtceu/api/item/component/IItemHUDProvider.java index b9ed048602..6301a9fe95 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/component/IItemHUDProvider.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/component/IItemHUDProvider.java @@ -26,9 +26,7 @@ default boolean shouldDrawHUD() { * @param stack the ItemStack to retrieve information from */ @OnlyIn(Dist.CLIENT) - default void drawHUD(ItemStack stack, GuiGraphics guiGraphics) { - - } + default void drawHUD(ItemStack stack, GuiGraphics guiGraphics) {} /** * Checks and draws the hud for a provider diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/component/IItemLifeCycle.java b/src/main/java/com/gregtechceu/gtceu/api/item/component/IItemLifeCycle.java index 69da60d108..52d40f9add 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/component/IItemLifeCycle.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/component/IItemLifeCycle.java @@ -10,5 +10,6 @@ * @implNote IItemLifeCycle */ public interface IItemLifeCycle extends IItemComponent { + void inventoryTick(ItemStack stack, Level level, Entity entity, int slotId, boolean isSelected); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/component/IItemUIFactory.java b/src/main/java/com/gregtechceu/gtceu/api/item/component/IItemUIFactory.java index 6829bfd1c5..62353b29da 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/component/IItemUIFactory.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/component/IItemUIFactory.java @@ -2,6 +2,7 @@ import com.lowdragmc.lowdraglib.gui.factory.HeldItemUIFactory; import com.lowdragmc.lowdraglib.gui.modular.ModularUI; + import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResultHolder; @@ -27,5 +28,4 @@ default InteractionResultHolder use(Item item, Level level, Player pl } return InteractionResultHolder.success(heldItem); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/component/IMaterialPartItem.java b/src/main/java/com/gregtechceu/gtceu/api/item/component/IMaterialPartItem.java index 112a6533e0..c0c0e19efd 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/component/IMaterialPartItem.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/component/IMaterialPartItem.java @@ -4,6 +4,7 @@ import com.gregtechceu.gtceu.api.data.chemical.material.properties.PropertyKey; import com.gregtechceu.gtceu.api.item.IComponentItem; import com.gregtechceu.gtceu.common.data.GTMaterials; + import net.minecraft.client.color.item.ItemColor; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.Tag; @@ -16,6 +17,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; + import java.util.List; /** @@ -78,12 +80,15 @@ default Component getItemName(ItemStack stack) { } @Override - default void appendHoverText(ItemStack stack, @org.jetbrains.annotations.Nullable Level level, List tooltipComponents, TooltipFlag isAdvanced) { + default void appendHoverText(ItemStack stack, @org.jetbrains.annotations.Nullable Level level, + List tooltipComponents, TooltipFlag isAdvanced) { var material = getPartMaterial(stack); var maxDurability = getPartMaxDurability(stack); var damage = getPartDamage(stack); - tooltipComponents.add(Component.translatable("metaitem.tool.tooltip.durability", maxDurability - damage, maxDurability)); - tooltipComponents.add(Component.translatable("metaitem.tool.tooltip.primary_material", material.getLocalizedName())); + tooltipComponents + .add(Component.translatable("metaitem.tool.tooltip.durability", maxDurability - damage, maxDurability)); + tooltipComponents + .add(Component.translatable("metaitem.tool.tooltip.primary_material", material.getLocalizedName())); } @OnlyIn(Dist.CLIENT) diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/component/IRecipeRemainder.java b/src/main/java/com/gregtechceu/gtceu/api/item/component/IRecipeRemainder.java index 2155190a8e..e1d09d9c51 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/component/IRecipeRemainder.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/component/IRecipeRemainder.java @@ -9,5 +9,6 @@ */ @FunctionalInterface public interface IRecipeRemainder extends IItemComponent { + ItemStack getRecipeRemained(ItemStack itemStack); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/component/ISubItemHandler.java b/src/main/java/com/gregtechceu/gtceu/api/item/component/ISubItemHandler.java index 5a4189a616..bc2053730b 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/component/ISubItemHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/component/ISubItemHandler.java @@ -11,6 +11,7 @@ * @implNote ISubItemHandler */ public interface ISubItemHandler extends IItemComponent { + default void fillItemCategory(Item item, CreativeModeTab category, NonNullList items) { items.add(new ItemStack(item)); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/component/ThermalFluidStats.java b/src/main/java/com/gregtechceu/gtceu/api/item/component/ThermalFluidStats.java index 0ea51d659c..5c0e7de184 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/component/ThermalFluidStats.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/component/ThermalFluidStats.java @@ -3,15 +3,18 @@ import com.gregtechceu.gtceu.api.item.component.forge.IComponentCapability; import com.gregtechceu.gtceu.api.misc.forge.SimpleThermalFluidHandlerItemStack; import com.gregtechceu.gtceu.api.misc.forge.ThermalFluidHandlerItemStack; + +import com.lowdragmc.lowdraglib.side.fluid.FluidStack; +import com.lowdragmc.lowdraglib.side.fluid.FluidTransferHelper; + +import net.minecraft.network.chat.Component; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.level.Level; -import net.minecraft.network.chat.Component; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.common.util.LazyOptional; -import com.lowdragmc.lowdraglib.side.fluid.FluidTransferHelper; -import com.lowdragmc.lowdraglib.side.fluid.FluidStack; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -23,6 +26,7 @@ * @implNote ThermalFluidStats */ public class ThermalFluidStats implements IItemComponent, IComponentCapability, IAddInformation { + public final int capacity; public final int maxFluidTemperature; public final boolean gasProof; @@ -31,7 +35,8 @@ public class ThermalFluidStats implements IItemComponent, IComponentCapability, public final boolean plasmaProof; public final boolean allowPartialFill; - protected ThermalFluidStats(int capacity, int maxFluidTemperature, boolean gasProof, boolean acidProof, boolean cryoProof, boolean plasmaProof, boolean allowPartialFill) { + protected ThermalFluidStats(int capacity, int maxFluidTemperature, boolean gasProof, boolean acidProof, + boolean cryoProof, boolean plasmaProof, boolean allowPartialFill) { this.capacity = capacity; this.maxFluidTemperature = maxFluidTemperature; this.gasProof = gasProof; @@ -41,8 +46,10 @@ protected ThermalFluidStats(int capacity, int maxFluidTemperature, boolean gasPr this.allowPartialFill = allowPartialFill; } - public static ThermalFluidStats create(int capacity, int maxFluidTemperature, boolean gasProof, boolean acidProof, boolean cryoProof, boolean plasmaProof, boolean allowPartialFill) { - return new ThermalFluidStats(capacity, maxFluidTemperature, gasProof, acidProof, cryoProof, plasmaProof, allowPartialFill); + public static ThermalFluidStats create(int capacity, int maxFluidTemperature, boolean gasProof, boolean acidProof, + boolean cryoProof, boolean plasmaProof, boolean allowPartialFill) { + return new ThermalFluidStats(capacity, maxFluidTemperature, gasProof, acidProof, cryoProof, plasmaProof, + allowPartialFill); } @Override @@ -50,19 +57,23 @@ public static ThermalFluidStats create(int capacity, int maxFluidTemperature, bo if (cap == ForgeCapabilities.FLUID_HANDLER_ITEM) { return ForgeCapabilities.FLUID_HANDLER_ITEM.orEmpty(cap, LazyOptional.of(() -> { if (allowPartialFill) { - return new ThermalFluidHandlerItemStack(itemStack, capacity, maxFluidTemperature, gasProof, acidProof, cryoProof, plasmaProof); + return new ThermalFluidHandlerItemStack(itemStack, capacity, maxFluidTemperature, gasProof, + acidProof, cryoProof, plasmaProof); } - return new SimpleThermalFluidHandlerItemStack(itemStack, capacity, maxFluidTemperature, gasProof, acidProof, cryoProof, plasmaProof); + return new SimpleThermalFluidHandlerItemStack(itemStack, capacity, maxFluidTemperature, gasProof, + acidProof, cryoProof, plasmaProof); })); } return LazyOptional.empty(); } @Override - public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltipComponents, TooltipFlag isAdvanced) { + public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltipComponents, + TooltipFlag isAdvanced) { if (stack.hasTag()) { FluidStack tank = FluidTransferHelper.getFluidContained(stack); - tooltipComponents.add(Component.translatable("gtceu.universal.tooltip.fluid_stored", tank.getDisplayName(), tank.getAmount())); + tooltipComponents.add(Component.translatable("gtceu.universal.tooltip.fluid_stored", tank.getDisplayName(), + tank.getAmount())); } } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/component/forge/IComponentCapability.java b/src/main/java/com/gregtechceu/gtceu/api/item/component/forge/IComponentCapability.java index 6688ac3869..2cbcb927c6 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/component/forge/IComponentCapability.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/component/forge/IComponentCapability.java @@ -3,6 +3,7 @@ import net.minecraft.world.item.ItemStack; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.util.LazyOptional; + import org.jetbrains.annotations.NotNull; /** @@ -11,6 +12,6 @@ * @implNote IComponentCapability */ public interface IComponentCapability { - @NotNull LazyOptional getCapability(ItemStack itemStack, @NotNull Capability cap); + @NotNull LazyOptional getCapability(ItemStack itemStack, @NotNull Capability cap); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/forge/GTBucketItem.java b/src/main/java/com/gregtechceu/gtceu/api/item/forge/GTBucketItem.java index a66cd0ea2d..4e0641aab9 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/forge/GTBucketItem.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/forge/GTBucketItem.java @@ -4,14 +4,14 @@ import com.gregtechceu.gtceu.api.data.chemical.material.properties.PropertyKey; import com.gregtechceu.gtceu.api.fluids.GTFluid; import com.gregtechceu.gtceu.utils.GTUtil; + import com.lowdragmc.lowdraglib.side.fluid.FluidHelper; import com.lowdragmc.lowdraglib.side.fluid.FluidStack; + import net.minecraft.core.BlockPos; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.LivingEntity; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.tags.FluidTags; @@ -28,13 +28,17 @@ import net.minecraft.world.level.material.Fluid; import net.minecraft.world.phys.BlockHitResult; import net.minecraftforge.common.capabilities.ICapabilityProvider; +import net.minecraftforge.fluids.FluidUtil; import net.minecraftforge.fluids.capability.wrappers.FluidBucketWrapper; -import javax.annotation.Nullable; -import java.util.List; import org.jetbrains.annotations.NotNull; + +import java.util.List; +import java.util.Optional; import java.util.function.Supplier; +import javax.annotation.Nullable; + /** * @author KilaBash * @date 2023/3/28 @@ -61,7 +65,8 @@ public static int color(ItemStack itemStack, int index) { } public ICapabilityProvider initCapabilities(@NotNull ItemStack stack, @Nullable CompoundTag nbt) { - return this.getClass() == GTBucketItem.class ? new FluidBucketWrapper(stack) : super.initCapabilities(stack, nbt); + return this.getClass() == GTBucketItem.class ? new FluidBucketWrapper(stack) : + super.initCapabilities(stack, nbt); } @Override @@ -76,9 +81,10 @@ public Component getDescription() { } @Override - public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltipComponents, TooltipFlag isAdvanced) { + public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltipComponents, + TooltipFlag isAdvanced) { super.appendHoverText(stack, level, tooltipComponents, isAdvanced); - GTUtil.appendHazardTooltips(material,tooltipComponents); + GTUtil.appendHazardTooltips(material, tooltipComponents); } @Override @@ -99,43 +105,46 @@ public int getBurnTime(ItemStack itemStack, @Nullable RecipeType recipeType) } @Override - public void inventoryTick(ItemStack stack, Level level, Entity entity, int slotId, boolean isSelected) { - super.inventoryTick(stack, level, entity, slotId, isSelected); - if(entity instanceof LivingEntity livingEntity && livingEntity.tickCount % 20 == 0) - GTUtil.applyHazardEffects(material, livingEntity, () -> true); - - } - - @Override - public boolean emptyContents(@org.jetbrains.annotations.Nullable Player pPlayer, Level pLevel, BlockPos pPos, @org.jetbrains.annotations.Nullable BlockHitResult pResult, @org.jetbrains.annotations.Nullable ItemStack container) { - if (!(this.getFluid() instanceof FlowingFluid)) return false; + public boolean emptyContents(@Nullable Player pPlayer, Level pLevel, BlockPos pPos, + @Nullable BlockHitResult pResult, + @Nullable ItemStack container) { + if (!(this.getFluid() instanceof FlowingFluid)) return false; BlockState blockstate = pLevel.getBlockState(pPos); Block block = blockstate.getBlock(); boolean flag = blockstate.canBeReplaced(this.getFluid()); - boolean flag1 = blockstate.isAir() || flag || block instanceof LiquidBlockContainer && ((LiquidBlockContainer) block).canPlaceLiquid(pLevel, pPos, blockstate, this.getFluid()); - java.util.Optional containedFluidStack = java.util.Optional.ofNullable(container).flatMap(net.minecraftforge.fluids.FluidUtil::getFluidContained); + boolean flag1 = blockstate.isAir() || flag || block instanceof LiquidBlockContainer && + ((LiquidBlockContainer) block).canPlaceLiquid(pLevel, pPos, blockstate, this.getFluid()); + Optional containedFluidStack = Optional + .ofNullable(container).flatMap(FluidUtil::getFluidContained); if (!flag1) { - return pResult != null && this.emptyContents(pPlayer, pLevel, pResult.getBlockPos().relative(pResult.getDirection()), null, container); - } else if (containedFluidStack.isPresent() && this.getFluid().getFluidType().isVaporizedOnPlacement(pLevel, pPos, containedFluidStack.get())) { - this.getFluid().getFluidType().onVaporize(pPlayer, pLevel, pPos, containedFluidStack.get()); - return true; - } else if (pLevel.dimensionType().ultraWarm() && this.getFluid().is(FluidTags.WATER)) { - int i = pPos.getX(); - int j = pPos.getY(); - int k = pPos.getZ(); - pLevel.playSound(pPlayer, pPos, SoundEvents.FIRE_EXTINGUISH, SoundSource.BLOCKS, 0.5F, 2.6F + (pLevel.random.nextFloat() - pLevel.random.nextFloat()) * 0.8F); - - for (int l = 0; l < 8; ++l) { - pLevel.addParticle(ParticleTypes.LARGE_SMOKE, (double) i + Math.random(), (double) j + Math.random(), (double) k + Math.random(), 0.0D, 0.0D, 0.0D); - } - - return true; - } else if (block instanceof LiquidBlockContainer && ((LiquidBlockContainer) block).canPlaceLiquid(pLevel, pPos, blockstate, getFluid())) { - ((LiquidBlockContainer) block).placeLiquid(pLevel, pPos, blockstate, ((FlowingFluid) this.getFluid()).getSource(false)); - this.playEmptySound(pPlayer, pLevel, pPos); - return true; - } + return pResult != null && this.emptyContents(pPlayer, pLevel, + pResult.getBlockPos().relative(pResult.getDirection()), null, container); + } else if (containedFluidStack.isPresent() && + this.getFluid().getFluidType().isVaporizedOnPlacement(pLevel, pPos, containedFluidStack.get())) { + this.getFluid().getFluidType().onVaporize(pPlayer, pLevel, pPos, containedFluidStack.get()); + return true; + } else + if (pLevel.dimensionType().ultraWarm() && this.getFluid().is(FluidTags.WATER)) { + int i = pPos.getX(); + int j = pPos.getY(); + int k = pPos.getZ(); + pLevel.playSound(pPlayer, pPos, SoundEvents.FIRE_EXTINGUISH, SoundSource.BLOCKS, 0.5F, + 2.6F + (pLevel.random.nextFloat() - pLevel.random.nextFloat()) * 0.8F); + + for (int l = 0; l < 8; ++l) { + pLevel.addParticle(ParticleTypes.LARGE_SMOKE, (double) i + Math.random(), + (double) j + Math.random(), (double) k + Math.random(), 0.0D, 0.0D, 0.0D); + } + + return true; + } else if (block instanceof LiquidBlockContainer && + ((LiquidBlockContainer) block).canPlaceLiquid(pLevel, pPos, blockstate, getFluid())) { + ((LiquidBlockContainer) block).placeLiquid(pLevel, pPos, blockstate, + ((FlowingFluid) this.getFluid()).getSource(false)); + this.playEmptySound(pPlayer, pLevel, pPos); + return true; + } return false; } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTAxeItem.java b/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTAxeItem.java index 2f92c54279..f3d1573194 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTAxeItem.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTAxeItem.java @@ -1,12 +1,12 @@ package com.gregtechceu.gtceu.api.item.tool; -import com.google.common.collect.Multimap; import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.api.item.IGTTool; import com.gregtechceu.gtceu.api.sound.SoundEntry; import com.gregtechceu.gtceu.client.renderer.item.ToolItemRenderer; + import com.lowdragmc.lowdraglib.Platform; -import lombok.Getter; + import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; @@ -28,6 +28,9 @@ import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.common.capabilities.ICapabilityProvider; + +import com.google.common.collect.Multimap; +import lombok.Getter; import org.jetbrains.annotations.Nullable; import java.util.List; @@ -44,7 +47,8 @@ public class GTAxeItem extends AxeItem implements IGTTool { @Getter private final IGTToolDefinition toolStats; - protected GTAxeItem(GTToolType toolType, MaterialToolTier tier, Material material, IGTToolDefinition toolStats, Properties properties) { + protected GTAxeItem(GTToolType toolType, MaterialToolTier tier, Material material, IGTToolDefinition toolStats, + Properties properties) { super(tier, 0, 0, properties); this.toolType = toolType; this.material = material; @@ -56,7 +60,8 @@ protected GTAxeItem(GTToolType toolType, MaterialToolTier tier, Material materia definition$init(); } - public static GTAxeItem create(GTToolType toolType, MaterialToolTier tier, Material material, IGTToolDefinition toolStats, Item.Properties properties) { + public static GTAxeItem create(GTToolType toolType, MaterialToolTier tier, Material material, + IGTToolDefinition toolStats, Item.Properties properties) { return new GTAxeItem(toolType, tier, material, toolStats, properties); } @@ -146,7 +151,8 @@ public boolean onBlockStartBreak(ItemStack stack, BlockPos pos, Player player) { } @Override - public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltipComponents, TooltipFlag isAdvanced) { + public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltipComponents, + TooltipFlag isAdvanced) { definition$appendHoverText(stack, level, tooltipComponents, isAdvanced); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTHoeItem.java b/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTHoeItem.java index 78562feee0..68a05d9b9e 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTHoeItem.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTHoeItem.java @@ -1,12 +1,12 @@ package com.gregtechceu.gtceu.api.item.tool; -import com.google.common.collect.Multimap; import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.api.item.IGTTool; import com.gregtechceu.gtceu.api.sound.SoundEntry; import com.gregtechceu.gtceu.client.renderer.item.ToolItemRenderer; + import com.lowdragmc.lowdraglib.Platform; -import lombok.Getter; + import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; @@ -28,10 +28,12 @@ import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.common.capabilities.ICapabilityProvider; + +import com.google.common.collect.Multimap; +import lombok.Getter; import org.jetbrains.annotations.Nullable; import java.util.List; -import java.util.Set; public class GTHoeItem extends HoeItem implements IGTTool { @@ -44,7 +46,8 @@ public class GTHoeItem extends HoeItem implements IGTTool { @Getter private final IGTToolDefinition toolStats; - protected GTHoeItem(GTToolType toolType, MaterialToolTier tier, Material material, IGTToolDefinition toolStats, Properties properties) { + protected GTHoeItem(GTToolType toolType, MaterialToolTier tier, Material material, IGTToolDefinition toolStats, + Properties properties) { super(tier, 0, 0, properties); this.toolType = toolType; this.material = material; @@ -56,7 +59,8 @@ protected GTHoeItem(GTToolType toolType, MaterialToolTier tier, Material materia definition$init(); } - public static GTHoeItem create(GTToolType toolType, MaterialToolTier tier, Material material, IGTToolDefinition toolStats, Item.Properties properties) { + public static GTHoeItem create(GTToolType toolType, MaterialToolTier tier, Material material, + IGTToolDefinition toolStats, Item.Properties properties) { return new GTHoeItem(toolType, tier, material, toolStats, properties); } @@ -141,7 +145,8 @@ public boolean onBlockStartBreak(ItemStack stack, BlockPos pos, Player player) { } @Override - public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltipComponents, TooltipFlag isAdvanced) { + public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltipComponents, + TooltipFlag isAdvanced) { definition$appendHoverText(stack, level, tooltipComponents, isAdvanced); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTShovelItem.java b/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTShovelItem.java index c4cbf2e3a8..4f031a34d3 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTShovelItem.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTShovelItem.java @@ -1,12 +1,12 @@ package com.gregtechceu.gtceu.api.item.tool; -import com.google.common.collect.Multimap; import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.api.item.IGTTool; import com.gregtechceu.gtceu.api.sound.SoundEntry; import com.gregtechceu.gtceu.client.renderer.item.ToolItemRenderer; + import com.lowdragmc.lowdraglib.Platform; -import lombok.Getter; + import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; @@ -28,10 +28,12 @@ import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.common.capabilities.ICapabilityProvider; + +import com.google.common.collect.Multimap; +import lombok.Getter; import org.jetbrains.annotations.Nullable; import java.util.List; -import java.util.Set; public class GTShovelItem extends ShovelItem implements IGTTool { @@ -44,7 +46,8 @@ public class GTShovelItem extends ShovelItem implements IGTTool { @Getter private final IGTToolDefinition toolStats; - protected GTShovelItem(GTToolType toolType, MaterialToolTier tier, Material material, IGTToolDefinition toolStats, Properties properties) { + protected GTShovelItem(GTToolType toolType, MaterialToolTier tier, Material material, IGTToolDefinition toolStats, + Properties properties) { super(tier, 0, 0, properties); this.toolType = toolType; this.material = material; @@ -56,7 +59,8 @@ protected GTShovelItem(GTToolType toolType, MaterialToolTier tier, Material mate definition$init(); } - public static GTShovelItem create(GTToolType toolType, MaterialToolTier tier, Material material, IGTToolDefinition toolStats, Item.Properties properties) { + public static GTShovelItem create(GTToolType toolType, MaterialToolTier tier, Material material, + IGTToolDefinition toolStats, Item.Properties properties) { return new GTShovelItem(toolType, tier, material, toolStats, properties); } @@ -141,7 +145,8 @@ public boolean onBlockStartBreak(ItemStack stack, BlockPos pos, Player player) { } @Override - public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltipComponents, TooltipFlag isAdvanced) { + public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltipComponents, + TooltipFlag isAdvanced) { definition$appendHoverText(stack, level, tooltipComponents, isAdvanced); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTSwordItem.java b/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTSwordItem.java index 9766f95692..f65cd3b950 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTSwordItem.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTSwordItem.java @@ -1,12 +1,12 @@ package com.gregtechceu.gtceu.api.item.tool; -import com.google.common.collect.Multimap; import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.api.item.IGTTool; import com.gregtechceu.gtceu.api.sound.SoundEntry; import com.gregtechceu.gtceu.client.renderer.item.ToolItemRenderer; + import com.lowdragmc.lowdraglib.Platform; -import lombok.Getter; + import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; @@ -28,10 +28,12 @@ import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.common.capabilities.ICapabilityProvider; + +import com.google.common.collect.Multimap; +import lombok.Getter; import org.jetbrains.annotations.Nullable; import java.util.List; -import java.util.Set; public class GTSwordItem extends SwordItem implements IGTTool { @@ -44,7 +46,8 @@ public class GTSwordItem extends SwordItem implements IGTTool { @Getter private final IGTToolDefinition toolStats; - protected GTSwordItem(GTToolType toolType, MaterialToolTier tier, Material material, IGTToolDefinition toolStats, Properties properties) { + protected GTSwordItem(GTToolType toolType, MaterialToolTier tier, Material material, IGTToolDefinition toolStats, + Properties properties) { super(tier, 0, 0, properties); this.toolType = toolType; this.material = material; @@ -56,7 +59,8 @@ protected GTSwordItem(GTToolType toolType, MaterialToolTier tier, Material mater definition$init(); } - public static GTSwordItem create(GTToolType toolType, MaterialToolTier tier, Material material, IGTToolDefinition toolStats, Item.Properties properties) { + public static GTSwordItem create(GTToolType toolType, MaterialToolTier tier, Material material, + IGTToolDefinition toolStats, Item.Properties properties) { return new GTSwordItem(toolType, tier, material, toolStats, properties); } @@ -146,7 +150,8 @@ public boolean onBlockStartBreak(ItemStack stack, BlockPos pos, Player player) { } @Override - public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltipComponents, TooltipFlag isAdvanced) { + public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltipComponents, + TooltipFlag isAdvanced) { definition$appendHoverText(stack, level, tooltipComponents, isAdvanced); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTToolItem.java b/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTToolItem.java index 8fb011c7bf..9ad2a21888 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTToolItem.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTToolItem.java @@ -1,12 +1,12 @@ package com.gregtechceu.gtceu.api.item.tool; -import com.google.common.collect.Multimap; import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.api.item.IGTTool; import com.gregtechceu.gtceu.api.sound.SoundEntry; import com.gregtechceu.gtceu.client.renderer.item.ToolItemRenderer; + import com.lowdragmc.lowdraglib.Platform; -import lombok.Getter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; @@ -28,11 +28,14 @@ import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.common.capabilities.ICapabilityProvider; + +import com.google.common.collect.Multimap; +import lombok.Getter; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.List; -import java.util.Set; + +import javax.annotation.ParametersAreNonnullByDefault; /** * @author KilaBash @@ -52,8 +55,8 @@ public class GTToolItem extends DiggerItem implements IGTTool { @Getter private IGTToolDefinition toolStats; - - protected GTToolItem(GTToolType toolType, MaterialToolTier tier, Material material, IGTToolDefinition definition, Properties properties) { + protected GTToolItem(GTToolType toolType, MaterialToolTier tier, Material material, IGTToolDefinition definition, + Properties properties) { super(0, 0, tier, toolType.harvestTags.isEmpty() ? null : toolType.harvestTags.get(0), properties); this.toolType = toolType; this.material = material; @@ -65,7 +68,8 @@ protected GTToolItem(GTToolType toolType, MaterialToolTier tier, Material materi definition$init(); } - public static GTToolItem create(GTToolType toolType, MaterialToolTier tier, Material material, IGTToolDefinition definition, Properties properties) { + public static GTToolItem create(GTToolType toolType, MaterialToolTier tier, Material material, + IGTToolDefinition definition, Properties properties) { return new GTToolItem(toolType, tier, material, definition, properties); } @@ -145,7 +149,8 @@ public boolean onBlockStartBreak(ItemStack stack, BlockPos pos, Player player) { } @Override - public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltipComponents, TooltipFlag isAdvanced) { + public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltipComponents, + TooltipFlag isAdvanced) { definition$appendHoverText(stack, level, tooltipComponents, isAdvanced); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTToolType.java b/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTToolType.java index c516276068..be5eae6299 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTToolType.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/tool/GTToolType.java @@ -9,10 +9,7 @@ import com.gregtechceu.gtceu.api.sound.SoundEntry; import com.gregtechceu.gtceu.common.data.GTSoundEntries; import com.gregtechceu.gtceu.common.item.tool.behavior.*; -import lombok.Getter; -import lombok.Setter; -import lombok.experimental.Accessors; -import lombok.experimental.Tolerate; + import net.minecraft.resources.ResourceLocation; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; @@ -24,6 +21,11 @@ import net.minecraft.world.item.enchantment.EnchantmentCategory; import net.minecraft.world.item.enchantment.Enchantments; import net.minecraft.world.level.block.Block; + +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; +import lombok.experimental.Tolerate; import org.jetbrains.annotations.Nullable; import java.util.*; @@ -35,6 +37,7 @@ * @implNote GTToolType */ public class GTToolType { + @Getter private static final Map types = new HashMap<>(); @@ -48,13 +51,17 @@ public class GTToolType { public static final GTToolType PICKAXE = GTToolType.builder("pickaxe") .toolTag(TagUtil.createItemTag("pickaxes", true)) .harvestTag(TagUtil.createBlockTag("mineable/pickaxe", true)) - .toolStats(b -> b.blockBreaking().attackDamage(1.0F).attackSpeed(-2.8F)/*.behaviors(TorchPlaceBehavior.INSTANCE)*/) + .toolStats(b -> b.blockBreaking().attackDamage(1.0F).attackSpeed(-2.8F)/* + * .behaviors(TorchPlaceBehavior. + * INSTANCE) + */) .toolClassNames("pickaxe") .build(); public static final GTToolType SHOVEL = GTToolType.builder("shovel") .toolTag(TagUtil.createItemTag("shovels", true)) .harvestTag(TagUtil.createBlockTag("mineable/shovel", true)) - .toolStats(b -> b.blockBreaking().attackDamage(1.5F).attackSpeed(-3.0F).behaviors(GrassPathBehavior.INSTANCE)) + .toolStats( + b -> b.blockBreaking().attackDamage(1.5F).attackSpeed(-3.0F).behaviors(GrassPathBehavior.INSTANCE)) .constructor(GTShovelItem::create) .toolClassNames("shovel") .build(); @@ -63,7 +70,8 @@ public class GTToolType { .harvestTag(TagUtil.createBlockTag("mineable/axe", true)) .toolStats(b -> b.blockBreaking() .attackDamage(5.0F).attackSpeed(-3.2F).baseEfficiency(2.0F) - .behaviors(DisableShieldBehavior.INSTANCE, TreeFellingBehavior.INSTANCE, LogStripBehavior.INSTANCE, ScrapeBehavior.INSTANCE, WaxOffBehavior.INSTANCE)) + .behaviors(DisableShieldBehavior.INSTANCE, TreeFellingBehavior.INSTANCE, LogStripBehavior.INSTANCE, + ScrapeBehavior.INSTANCE, WaxOffBehavior.INSTANCE)) .constructor(GTAxeItem::create) .toolClassNames("axe") .build(); @@ -81,7 +89,7 @@ public class GTToolType { .toolStats(b -> b.blockBreaking().aoe(1, 1, 0) .efficiencyMultiplier(0.4F).attackDamage(1.5F).attackSpeed(-3.2F) .durabilityMultiplier(3.0F) - /*.behaviors(TorchPlaceBehavior.INSTANCE)*/) + /* .behaviors(TorchPlaceBehavior.INSTANCE) */) .toolClasses(GTToolType.PICKAXE) .build(); public static final GTToolType SPADE = GTToolType.builder("spade") @@ -138,7 +146,8 @@ public class GTToolType { .harvestTag(TagUtil.createBlockTag("mineable/wrench", false)) .toolStats(b -> b.blockBreaking().crafting().sneakBypassUse() .attackDamage(1.0F).attackSpeed(-2.8F) - .behaviors(BlockRotatingBehavior.INSTANCE, new EntityDamageBehavior(3.0F, IronGolem.class), ToolModeSwitchBehavior.INSTANCE)) + .behaviors(BlockRotatingBehavior.INSTANCE, new EntityDamageBehavior(3.0F, IronGolem.class), + ToolModeSwitchBehavior.INSTANCE)) .sound(GTSoundEntries.WRENCH_TOOL) .symbol('w') .build(); @@ -190,10 +199,12 @@ public class GTToolType { .build(); public static final GTToolType BUTCHERY_KNIFE = GTToolType.builder("butchery_knife") .toolTag(TagUtil.createItemTag("tools/butchery_knives", false)) - .toolStats(b -> b.attacking().attackDamage(1.5F).attackSpeed(-1.3F).defaultEnchantment(Enchantments.MOB_LOOTING, 3)) + .toolStats(b -> b.attacking().attackDamage(1.5F).attackSpeed(-1.3F) + .defaultEnchantment(Enchantments.MOB_LOOTING, 3)) .constructor(GTSwordItem::create) .build(); - //public static GTToolType GRAFTER = new GTToolType("grafter", 1, 1, GTCEu.id("item/tools/handle_hammer"), GTCEu.id("item/tools/hammer")); + // public static GTToolType GRAFTER = new GTToolType("grafter", 1, 1, GTCEu.id("item/tools/handle_hammer"), + // GTCEu.id("item/tools/hammer")); public static final GTToolType PLUNGER = GTToolType.builder("plunger") .toolTag(TagUtil.createItemTag("tools/plungers", false)) .toolStats(b -> b.cannotAttack().attackSpeed(-2.4F).sneakBypassUse() @@ -206,157 +217,160 @@ public class GTToolType { .toolStats(b -> b) .build(); public static final GTToolType DRILL_LV = GTToolType.builder("lv_drill") - .idFormat("lv_%s_drill") - .toolTag(TagUtil.createItemTag("tools/drills", false)) - .toolTag(TagUtil.createItemTag("pickaxes", true)) - .toolTag(TagUtil.createItemTag("shovels", true)) - .harvestTag(TagUtil.createBlockTag("mineable/pickaxe", true)) - .harvestTag(TagUtil.createBlockTag("mineable/shovel", true)) - .toolStats(b -> b.blockBreaking().aoe(1, 1, 0) - .attackDamage(1.0F).attackSpeed(-3.2F).durabilityMultiplier(3.0F) - .brokenStack(ToolHelper.SUPPLY_POWER_UNIT_LV) - /*.behaviors(TorchPlaceBehavior.INSTANCE)*/) - .sound(GTSoundEntries.DRILL_TOOL, true) - .electric(GTValues.LV) - .toolClassNames("drill") - .build(); + .idFormat("lv_%s_drill") + .toolTag(TagUtil.createItemTag("tools/drills", false)) + .toolTag(TagUtil.createItemTag("pickaxes", true)) + .toolTag(TagUtil.createItemTag("shovels", true)) + .harvestTag(TagUtil.createBlockTag("mineable/pickaxe", true)) + .harvestTag(TagUtil.createBlockTag("mineable/shovel", true)) + .toolStats(b -> b.blockBreaking().aoe(1, 1, 0) + .attackDamage(1.0F).attackSpeed(-3.2F).durabilityMultiplier(3.0F) + .brokenStack(ToolHelper.SUPPLY_POWER_UNIT_LV) + /* .behaviors(TorchPlaceBehavior.INSTANCE) */) + .sound(GTSoundEntries.DRILL_TOOL, true) + .electric(GTValues.LV) + .toolClassNames("drill") + .build(); public static final GTToolType DRILL_MV = GTToolType.builder("mv_drill") - .idFormat("mv_%s_drill") - .toolTag(TagUtil.createItemTag("tools/drills", false)) - .toolTag(TagUtil.createItemTag("pickaxes", true)) - .toolTag(TagUtil.createItemTag("shovels", true)) - .harvestTag(TagUtil.createBlockTag("mineable/pickaxe", true)) - .harvestTag(TagUtil.createBlockTag("mineable/shovel", true)) - .toolStats(b -> b.blockBreaking().aoe(1, 1, 2) - .attackDamage(1.0F).attackSpeed(-3.2F).durabilityMultiplier(4.0F) - .brokenStack(ToolHelper.SUPPLY_POWER_UNIT_MV) - /*.behaviors(TorchPlaceBehavior.INSTANCE)*/) - .sound(GTSoundEntries.DRILL_TOOL, true) - .electric(GTValues.MV) - .toolClassNames("drill") - .build(); + .idFormat("mv_%s_drill") + .toolTag(TagUtil.createItemTag("tools/drills", false)) + .toolTag(TagUtil.createItemTag("pickaxes", true)) + .toolTag(TagUtil.createItemTag("shovels", true)) + .harvestTag(TagUtil.createBlockTag("mineable/pickaxe", true)) + .harvestTag(TagUtil.createBlockTag("mineable/shovel", true)) + .toolStats(b -> b.blockBreaking().aoe(1, 1, 2) + .attackDamage(1.0F).attackSpeed(-3.2F).durabilityMultiplier(4.0F) + .brokenStack(ToolHelper.SUPPLY_POWER_UNIT_MV) + /* .behaviors(TorchPlaceBehavior.INSTANCE) */) + .sound(GTSoundEntries.DRILL_TOOL, true) + .electric(GTValues.MV) + .toolClassNames("drill") + .build(); public static final GTToolType DRILL_HV = GTToolType.builder("hv_drill") - .idFormat("hv_%s_drill") - .toolTag(TagUtil.createItemTag("tools/drills", false)) - .toolTag(TagUtil.createItemTag("pickaxes", true)) - .toolTag(TagUtil.createItemTag("shovels", true)) - .harvestTag(TagUtil.createBlockTag("mineable/pickaxe", true)) - .harvestTag(TagUtil.createBlockTag("mineable/shovel", true)) - .toolStats(b -> b.blockBreaking().aoe(2, 2, 4) - .attackDamage(1.0F).attackSpeed(-3.2F).durabilityMultiplier(5.0F) - .brokenStack(ToolHelper.SUPPLY_POWER_UNIT_HV) - /*.behaviors(TorchPlaceBehavior.INSTANCE)*/) - .sound(GTSoundEntries.DRILL_TOOL, true) - .electric(GTValues.HV) - .toolClassNames("drill") - .build(); + .idFormat("hv_%s_drill") + .toolTag(TagUtil.createItemTag("tools/drills", false)) + .toolTag(TagUtil.createItemTag("pickaxes", true)) + .toolTag(TagUtil.createItemTag("shovels", true)) + .harvestTag(TagUtil.createBlockTag("mineable/pickaxe", true)) + .harvestTag(TagUtil.createBlockTag("mineable/shovel", true)) + .toolStats(b -> b.blockBreaking().aoe(2, 2, 4) + .attackDamage(1.0F).attackSpeed(-3.2F).durabilityMultiplier(5.0F) + .brokenStack(ToolHelper.SUPPLY_POWER_UNIT_HV) + /* .behaviors(TorchPlaceBehavior.INSTANCE) */) + .sound(GTSoundEntries.DRILL_TOOL, true) + .electric(GTValues.HV) + .toolClassNames("drill") + .build(); public static final GTToolType DRILL_EV = GTToolType.builder("ev_drill") - .idFormat("ev_%s_drill") - .toolTag(TagUtil.createItemTag("tools/drills", false)) - .toolTag(TagUtil.createItemTag("pickaxes", true)) - .toolTag(TagUtil.createItemTag("shovels", true)) - .harvestTag(TagUtil.createBlockTag("mineable/pickaxe", true)) - .harvestTag(TagUtil.createBlockTag("mineable/shovel", true)) - .toolStats(b -> b.blockBreaking().aoe(3, 3, 6) - .attackDamage(1.0F).attackSpeed(-3.2F).durabilityMultiplier(6.0F) - .brokenStack(ToolHelper.SUPPLY_POWER_UNIT_EV) - /*.behaviors(TorchPlaceBehavior.INSTANCE)*/) - .sound(GTSoundEntries.DRILL_TOOL, true) - .electric(GTValues.EV) - .toolClassNames("drill") - .build(); + .idFormat("ev_%s_drill") + .toolTag(TagUtil.createItemTag("tools/drills", false)) + .toolTag(TagUtil.createItemTag("pickaxes", true)) + .toolTag(TagUtil.createItemTag("shovels", true)) + .harvestTag(TagUtil.createBlockTag("mineable/pickaxe", true)) + .harvestTag(TagUtil.createBlockTag("mineable/shovel", true)) + .toolStats(b -> b.blockBreaking().aoe(3, 3, 6) + .attackDamage(1.0F).attackSpeed(-3.2F).durabilityMultiplier(6.0F) + .brokenStack(ToolHelper.SUPPLY_POWER_UNIT_EV) + /* .behaviors(TorchPlaceBehavior.INSTANCE) */) + .sound(GTSoundEntries.DRILL_TOOL, true) + .electric(GTValues.EV) + .toolClassNames("drill") + .build(); public static final GTToolType DRILL_IV = GTToolType.builder("iv_drill") - .idFormat("iv_%s_drill") - .toolTag(TagUtil.createItemTag("tools/drills", false)) - .toolTag(TagUtil.createItemTag("pickaxes", true)) - .toolTag(TagUtil.createItemTag("shovels", true)) - .harvestTag(TagUtil.createBlockTag("mineable/pickaxe", true)) - .harvestTag(TagUtil.createBlockTag("mineable/shovel", true)) - .toolStats(b -> b.blockBreaking().aoe(4, 4, 8) - .attackDamage(1.0F).attackSpeed(-3.2F).durabilityMultiplier(7.0F) - .brokenStack(ToolHelper.SUPPLY_POWER_UNIT_IV) - /*.behaviors(TorchPlaceBehavior.INSTANCE)*/) - .sound(GTSoundEntries.DRILL_TOOL, true) - .electric(GTValues.IV) - .toolClassNames("drill") - .build(); + .idFormat("iv_%s_drill") + .toolTag(TagUtil.createItemTag("tools/drills", false)) + .toolTag(TagUtil.createItemTag("pickaxes", true)) + .toolTag(TagUtil.createItemTag("shovels", true)) + .harvestTag(TagUtil.createBlockTag("mineable/pickaxe", true)) + .harvestTag(TagUtil.createBlockTag("mineable/shovel", true)) + .toolStats(b -> b.blockBreaking().aoe(4, 4, 8) + .attackDamage(1.0F).attackSpeed(-3.2F).durabilityMultiplier(7.0F) + .brokenStack(ToolHelper.SUPPLY_POWER_UNIT_IV) + /* .behaviors(TorchPlaceBehavior.INSTANCE) */) + .sound(GTSoundEntries.DRILL_TOOL, true) + .electric(GTValues.IV) + .toolClassNames("drill") + .build(); public static final GTToolType CHAINSAW_LV = GTToolType.builder("lv_chainsaw") - .idFormat("lv_%s_chainsaw") - .toolTag(TagUtil.createItemTag("axes", true)) - .toolTag(TagUtil.createItemTag("tools/chainsaws", false)) - .harvestTag(TagUtil.createBlockTag("mineable/axe", true)) - .toolStats(b -> b.blockBreaking() - .efficiencyMultiplier(2.0F) - .attackDamage(5.0F).attackSpeed(-3.2F) - .brokenStack(ToolHelper.SUPPLY_POWER_UNIT_LV) - .behaviors(HarvestIceBehavior.INSTANCE, DisableShieldBehavior.INSTANCE, TreeFellingBehavior.INSTANCE)) - .sound(GTSoundEntries.CHAINSAW_TOOL, true) - .electric(GTValues.LV) - .toolClasses(GTToolType.AXE) - .build(); + .idFormat("lv_%s_chainsaw") + .toolTag(TagUtil.createItemTag("axes", true)) + .toolTag(TagUtil.createItemTag("tools/chainsaws", false)) + .harvestTag(TagUtil.createBlockTag("mineable/axe", true)) + .toolStats(b -> b.blockBreaking() + .efficiencyMultiplier(2.0F) + .attackDamage(5.0F).attackSpeed(-3.2F) + .brokenStack(ToolHelper.SUPPLY_POWER_UNIT_LV) + .behaviors(HarvestIceBehavior.INSTANCE, DisableShieldBehavior.INSTANCE, + TreeFellingBehavior.INSTANCE)) + .sound(GTSoundEntries.CHAINSAW_TOOL, true) + .electric(GTValues.LV) + .toolClasses(GTToolType.AXE) + .build(); public static final GTToolType WRENCH_LV = GTToolType.builder("lv_wrench") - .idFormat("lv_%s_wrench") - .toolTag(TagUtil.createItemTag("tools/wrenches", false)) - .toolTag(TagUtil.createItemTag("tools/wrench", false)) - .harvestTag(TagUtil.createBlockTag("mineable/wrench", false)) - .toolStats(b -> b.blockBreaking().crafting().sneakBypassUse() - .efficiencyMultiplier(2.0F) - .attackDamage(1.0F).attackSpeed(-2.8F) - .behaviors(BlockRotatingBehavior.INSTANCE, new EntityDamageBehavior(3.0F, IronGolem.class), ToolModeSwitchBehavior.INSTANCE) - .brokenStack(ToolHelper.SUPPLY_POWER_UNIT_LV)) - .sound(GTSoundEntries.WRENCH_TOOL, true) - .electric(GTValues.LV) - .toolClasses(GTToolType.WRENCH) - .build(); + .idFormat("lv_%s_wrench") + .toolTag(TagUtil.createItemTag("tools/wrenches", false)) + .toolTag(TagUtil.createItemTag("tools/wrench", false)) + .harvestTag(TagUtil.createBlockTag("mineable/wrench", false)) + .toolStats(b -> b.blockBreaking().crafting().sneakBypassUse() + .efficiencyMultiplier(2.0F) + .attackDamage(1.0F).attackSpeed(-2.8F) + .behaviors(BlockRotatingBehavior.INSTANCE, new EntityDamageBehavior(3.0F, IronGolem.class), + ToolModeSwitchBehavior.INSTANCE) + .brokenStack(ToolHelper.SUPPLY_POWER_UNIT_LV)) + .sound(GTSoundEntries.WRENCH_TOOL, true) + .electric(GTValues.LV) + .toolClasses(GTToolType.WRENCH) + .build(); public static final GTToolType WRENCH_HV = GTToolType.builder("hv_wrench") - .idFormat("hv_%s_wrench") - .toolTag(TagUtil.createItemTag("tools/wrenches", false)) - .toolTag(TagUtil.createItemTag("tools/wrench", false)) - .harvestTag(TagUtil.createBlockTag("mineable/wrench", false)) - .toolStats(b -> b.blockBreaking().crafting().sneakBypassUse() - .efficiencyMultiplier(3.0F) - .attackDamage(1.0F).attackSpeed(-2.8F) - .behaviors(BlockRotatingBehavior.INSTANCE, new EntityDamageBehavior(3.0F, IronGolem.class), ToolModeSwitchBehavior.INSTANCE) - .brokenStack(ToolHelper.SUPPLY_POWER_UNIT_HV)) - .sound(GTSoundEntries.WRENCH_TOOL, true) - .electric(GTValues.HV) - .toolClasses(GTToolType.WRENCH) - .build(); + .idFormat("hv_%s_wrench") + .toolTag(TagUtil.createItemTag("tools/wrenches", false)) + .toolTag(TagUtil.createItemTag("tools/wrench", false)) + .harvestTag(TagUtil.createBlockTag("mineable/wrench", false)) + .toolStats(b -> b.blockBreaking().crafting().sneakBypassUse() + .efficiencyMultiplier(3.0F) + .attackDamage(1.0F).attackSpeed(-2.8F) + .behaviors(BlockRotatingBehavior.INSTANCE, new EntityDamageBehavior(3.0F, IronGolem.class), + ToolModeSwitchBehavior.INSTANCE) + .brokenStack(ToolHelper.SUPPLY_POWER_UNIT_HV)) + .sound(GTSoundEntries.WRENCH_TOOL, true) + .electric(GTValues.HV) + .toolClasses(GTToolType.WRENCH) + .build(); public static final GTToolType WRENCH_IV = GTToolType.builder("iv_wrench") - .idFormat("iv_%s_wrench") - .toolTag(TagUtil.createItemTag("tools/wrenches", false)) - .toolTag(TagUtil.createItemTag("tools/wrench", false)) - .harvestTag(TagUtil.createBlockTag("mineable/wrench", false)) - .toolStats(b -> b.blockBreaking().crafting().sneakBypassUse() - .efficiencyMultiplier(4.0F) - .attackDamage(1.0F).attackSpeed(-2.8F) - .behaviors(BlockRotatingBehavior.INSTANCE, new EntityDamageBehavior(3.0F, IronGolem.class), ToolModeSwitchBehavior.INSTANCE) - .brokenStack(ToolHelper.SUPPLY_POWER_UNIT_IV)) - .sound(GTSoundEntries.WRENCH_TOOL, true) - .electric(GTValues.IV) - .toolClasses(GTToolType.WRENCH) - .build(); + .idFormat("iv_%s_wrench") + .toolTag(TagUtil.createItemTag("tools/wrenches", false)) + .toolTag(TagUtil.createItemTag("tools/wrench", false)) + .harvestTag(TagUtil.createBlockTag("mineable/wrench", false)) + .toolStats(b -> b.blockBreaking().crafting().sneakBypassUse() + .efficiencyMultiplier(4.0F) + .attackDamage(1.0F).attackSpeed(-2.8F) + .behaviors(BlockRotatingBehavior.INSTANCE, new EntityDamageBehavior(3.0F, IronGolem.class), + ToolModeSwitchBehavior.INSTANCE) + .brokenStack(ToolHelper.SUPPLY_POWER_UNIT_IV)) + .sound(GTSoundEntries.WRENCH_TOOL, true) + .electric(GTValues.IV) + .toolClasses(GTToolType.WRENCH) + .build(); public static final GTToolType BUZZSAW = GTToolType.builder("buzzsaw") - .toolTag(TagUtil.createItemTag("tools/saws", false)) - .toolTag(TagUtil.createItemTag("tools/buzzsaws", false)) - .toolStats(b -> b.crafting().attackDamage(1.5F).attackSpeed(-3.2F) - .brokenStack(ToolHelper.SUPPLY_POWER_UNIT_LV)) - .sound(GTSoundEntries.CHAINSAW_TOOL, true) - .electric(GTValues.IV) - .toolClasses(GTToolType.SAW) - .build(); + .toolTag(TagUtil.createItemTag("tools/saws", false)) + .toolTag(TagUtil.createItemTag("tools/buzzsaws", false)) + .toolStats(b -> b.crafting().attackDamage(1.5F).attackSpeed(-3.2F) + .brokenStack(ToolHelper.SUPPLY_POWER_UNIT_LV)) + .sound(GTSoundEntries.CHAINSAW_TOOL, true) + .electric(GTValues.IV) + .toolClasses(GTToolType.SAW) + .build(); public static final GTToolType SCREWDRIVER_LV = GTToolType.builder("lv_screwdriver") - .idFormat("lv_%s_screwdriver") - .toolTag(TagUtil.createItemTag("tools/screwdrivers", false)) - .toolStats(b -> b.crafting().sneakBypassUse() - .attackDamage(-1.0F).attackSpeed(3.0F) - .behaviors(new EntityDamageBehavior(3.0F, Spider.class)) - .brokenStack(ToolHelper.SUPPLY_POWER_UNIT_LV)) - .sound(GTSoundEntries.CHAINSAW_TOOL) - .electric(GTValues.IV) - .toolClasses(GTToolType.SCREWDRIVER) - .build(); - + .idFormat("lv_%s_screwdriver") + .toolTag(TagUtil.createItemTag("tools/screwdrivers", false)) + .toolStats(b -> b.crafting().sneakBypassUse() + .attackDamage(-1.0F).attackSpeed(3.0F) + .behaviors(new EntityDamageBehavior(3.0F, Spider.class)) + .brokenStack(ToolHelper.SUPPLY_POWER_UNIT_LV)) + .sound(GTSoundEntries.CHAINSAW_TOOL) + .electric(GTValues.IV) + .toolClasses(GTToolType.SCREWDRIVER) + .build(); public final String name; public final String idFormat; @@ -375,7 +389,10 @@ public class GTToolType { public final ToolConstructor constructor; public final int electricTier; - public GTToolType(String name, String idFormat, Character symbol, Set toolClasses, IGTToolDefinition toolDefinition, ToolConstructor constructor, List> harvestTags, List> itemTags, ResourceLocation modelLocation, Set toolClassNames, @Nullable SoundEntry soundEntry, boolean playSoundOnBlockDestroy, int electricTier) { + public GTToolType(String name, String idFormat, Character symbol, Set toolClasses, + IGTToolDefinition toolDefinition, ToolConstructor constructor, List> harvestTags, + List> itemTags, ResourceLocation modelLocation, Set toolClassNames, + @Nullable SoundEntry soundEntry, boolean playSoundOnBlockDestroy, int electricTier) { this.name = name; this.idFormat = idFormat; this.symbol = symbol; @@ -404,7 +421,9 @@ public String getUnlocalizedName() { @FunctionalInterface public interface ToolConstructor { - IGTTool apply(GTToolType type, MaterialToolTier tier, Material material, IGTToolDefinition definition, Item.Properties properties); + + IGTTool apply(GTToolType type, MaterialToolTier tier, Material material, IGTToolDefinition definition, + Item.Properties properties); } public static Builder builder(String name) { @@ -413,6 +432,7 @@ public static Builder builder(String name) { @Accessors(fluent = true, chain = true) public static class Builder { + private final String name; @Setter private String idFormat; @@ -500,8 +520,7 @@ private GTToolType get() { toolClassNames, sound, playSoundOnBlockDestroy, - tier - ); + tier); } public GTToolType build() { diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/tool/IGTToolDefinition.java b/src/main/java/com/gregtechceu/gtceu/api/item/tool/IGTToolDefinition.java index 612b06d9db..1c55f4a01c 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/tool/IGTToolDefinition.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/tool/IGTToolDefinition.java @@ -1,13 +1,14 @@ package com.gregtechceu.gtceu.api.item.tool; - import com.gregtechceu.gtceu.api.item.tool.aoe.AoESymmetrical; import com.gregtechceu.gtceu.api.item.tool.behavior.IToolBehavior; -import it.unimi.dsi.fastutil.objects.Object2IntMap; + import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.enchantment.Enchantment; import net.minecraft.world.level.block.state.BlockState; +import it.unimi.dsi.fastutil.objects.Object2IntMap; + import java.util.List; /** @@ -104,5 +105,4 @@ default boolean isEnchantable(ItemStack stack) { default ItemStack getBrokenStack() { return ItemStack.EMPTY; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/tool/IToolGridHighLight.java b/src/main/java/com/gregtechceu/gtceu/api/item/tool/IToolGridHighLight.java index 39aec6e99a..e315a0857e 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/tool/IToolGridHighLight.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/tool/IToolGridHighLight.java @@ -1,11 +1,13 @@ package com.gregtechceu.gtceu.api.item.tool; import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; + import net.minecraft.core.Direction; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import org.jetbrains.annotations.Nullable; + import java.util.Set; /** @@ -14,6 +16,7 @@ * @implNote IBlockGridHighLight */ public interface IToolGridHighLight { + default boolean shouldRenderGrid(Player player, ItemStack held, Set toolTypes) { return true; } @@ -22,5 +25,4 @@ default boolean shouldRenderGrid(Player player, ItemStack held, Set default ResourceTexture sideTips(Player player, Set toolTypes, Direction side) { return null; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/tool/MaterialToolTier.java b/src/main/java/com/gregtechceu/gtceu/api/item/tool/MaterialToolTier.java index 8812c0cbcf..a25c0b3aa9 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/tool/MaterialToolTier.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/tool/MaterialToolTier.java @@ -4,13 +4,14 @@ import com.gregtechceu.gtceu.api.data.chemical.material.properties.PropertyKey; import com.gregtechceu.gtceu.api.data.chemical.material.properties.ToolProperty; import com.gregtechceu.gtceu.data.recipe.CustomTags; + import net.minecraft.tags.TagKey; import net.minecraft.world.item.Tier; import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.level.block.Block; -import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * @author KilaBash @@ -18,6 +19,7 @@ * @implNote MaterialTier */ public class MaterialToolTier implements Tier { + public final Material material; public final ToolProperty property; @@ -25,7 +27,7 @@ public class MaterialToolTier implements Tier { public MaterialToolTier(Material material) { this.material = material; if (!material.hasProperty(PropertyKey.TOOL)) { - throw new IllegalArgumentException("material %s hasn't got Tool Property".formatted(material)); + throw new IllegalArgumentException("material %s hasn't got Tool Property".formatted(material)); } this.property = material.getProperty(PropertyKey.TOOL); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/tool/ToolDefinitionBuilder.java b/src/main/java/com/gregtechceu/gtceu/api/item/tool/ToolDefinitionBuilder.java index 09b7772f75..0378bb645c 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/tool/ToolDefinitionBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/tool/ToolDefinitionBuilder.java @@ -1,19 +1,21 @@ package com.gregtechceu.gtceu.api.item.tool; -import com.google.common.collect.ImmutableList; import com.gregtechceu.gtceu.api.item.tool.aoe.AoESymmetrical; import com.gregtechceu.gtceu.api.item.tool.behavior.IToolBehavior; + +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.enchantment.Enchantment; +import net.minecraft.world.item.enchantment.EnchantmentCategory; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; + +import com.google.common.collect.ImmutableList; import it.unimi.dsi.fastutil.objects.Object2IntArrayMap; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntMaps; import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import lombok.Setter; import lombok.experimental.Accessors; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.enchantment.Enchantment; -import net.minecraft.world.item.enchantment.EnchantmentCategory; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.state.BlockState; import java.util.ArrayList; import java.util.Collections; @@ -286,4 +288,4 @@ public AoESymmetrical getAoEDefinition(ItemStack stack) { } }; } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/tool/ToolHelper.java b/src/main/java/com/gregtechceu/gtceu/api/item/tool/ToolHelper.java index 8e3a569af1..fe2f488335 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/tool/ToolHelper.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/tool/ToolHelper.java @@ -1,9 +1,5 @@ package com.gregtechceu.gtceu.api.item.tool; -import com.google.common.collect.BiMap; -import com.google.common.collect.HashBiMap; -import com.google.common.collect.Table; -import com.google.common.collect.Tables; import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.capability.GTCapabilityHelper; import com.gregtechceu.gtceu.api.capability.IElectricItem; @@ -26,8 +22,9 @@ import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.utils.DummyMachineBlockEntity; import com.gregtechceu.gtceu.utils.InfiniteEnergyContainer; + import com.lowdragmc.lowdraglib.misc.ItemStackTransfer; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import net.minecraft.advancements.CriteriaTriggers; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -64,6 +61,12 @@ import net.minecraftforge.common.IForgeShearable; import net.minecraftforge.common.TierSortingRegistry; import net.minecraftforge.event.ForgeEventFactory; + +import com.google.common.collect.BiMap; +import com.google.common.collect.HashBiMap; +import com.google.common.collect.Table; +import com.google.common.collect.Tables; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -122,12 +125,9 @@ public class ToolHelper { public static final String DISABLE_SHIELDS_KEY = "DisableShields"; public static final String RELOCATE_MINED_BLOCKS_KEY = "RelocateMinedBlocks"; - // Crafting Symbols private static final BiMap symbols = HashBiMap.create(); - - private ToolHelper() {/**/} /** @@ -149,7 +149,8 @@ public static Set getToolSymbols() { } /** - * Registers the tool against a crafting symbol, this is used in {@link com.gregtechceu.gtceu.data.recipe.VanillaRecipeHelper} + * Registers the tool against a crafting symbol, this is used in + * {@link com.gregtechceu.gtceu.data.recipe.VanillaRecipeHelper} */ public static void registerToolSymbol(Character symbol, GTToolType tool) { symbols.put(symbol, tool); @@ -204,7 +205,8 @@ public static void damageItem(@NotNull ItemStack stack, @Nullable LivingEntity u return; } } else { - throw new IllegalStateException("Electric tool does not have an attached electric item capability."); + throw new IllegalStateException( + "Electric tool does not have an attached electric item capability."); } } int unbreakingLevel = EnchantmentHelper.getItemEnchantmentLevel(Enchantments.UNBREAKING, stack); @@ -243,7 +245,8 @@ public static void playToolSound(GTToolType toolType, ServerPlayer player) { } } - public static ItemStack getAndSetToolData(GTToolType toolType, Material material, int maxDurability, int harvestLevel, + public static ItemStack getAndSetToolData(GTToolType toolType, Material material, int maxDurability, + int harvestLevel, float toolSpeed, float attackDamage) { var entry = GTItems.TOOL_ITEMS.get(material, toolType); if (entry == null) return ItemStack.EMPTY; @@ -293,9 +296,10 @@ else if (!ItemStack.isSameItem(player.getMainHandItem(), stack)) { } return false; } - + @FunctionalInterface public interface AOEFunction { + boolean apply(ItemStack stack, Level level, Player player, BlockPos start, UseOnContext context); } @@ -310,7 +314,8 @@ public static AoESymmetrical getAoEDefinition(ItemStack stack) { public static Set iterateAoE(ItemStack stack, AoESymmetrical aoeDefinition, Level world, Player player, HitResult rayTraceResult, AOEFunction function) { - if (aoeDefinition != AoESymmetrical.none() && rayTraceResult instanceof BlockHitResult blockHit && blockHit.getDirection() != null) { + if (aoeDefinition != AoESymmetrical.none() && rayTraceResult instanceof BlockHitResult blockHit && + blockHit.getDirection() != null) { int column = aoeDefinition.column; int row = aoeDefinition.row; int layer = aoeDefinition.layer; @@ -327,8 +332,10 @@ public static Set iterateAoE(ItemStack stack, AoESymmetrical aoeDefini for (int z = isX ? -column : -row; z <= (isX ? column : row); z++) { if (!(x == 0 && y == 0 && z == 0)) { BlockPos pos = blockHit.getBlockPos().offset(x, isDown ? y : -y, z); - if (player.mayUseItemAt(pos.relative(blockHit.getDirection()), blockHit.getDirection(), stack)) { - if (function.apply(stack, world, player, pos, new UseOnContext(player.level(), player, player.getUsedItemHand(), stack, blockHit))) { + if (player.mayUseItemAt(pos.relative(blockHit.getDirection()), blockHit.getDirection(), + stack)) { + if (function.apply(stack, world, player, pos, new UseOnContext(player.level(), + player, player.getUsedItemHand(), stack, blockHit))) { validPositions.add(pos); } } @@ -348,7 +355,8 @@ public static Set iterateAoE(ItemStack stack, AoESymmetrical aoeDefini BlockPos pos = blockHit.getBlockPos().offset( isX ? (isNegative ? x : -x) : (isNegative ? z : -z), y, isX ? (isNegative ? z : -z) : (isNegative ? x : -x)); - if (function.apply(stack, world, player, pos, new UseOnContext(player.level(), player, player.getUsedItemHand(), stack, blockHit))) { + if (function.apply(stack, world, player, pos, new UseOnContext(player.level(), player, + player.getUsedItemHand(), stack, blockHit))) { validPositions.add(pos); } } @@ -361,11 +369,13 @@ public static Set iterateAoE(ItemStack stack, AoESymmetrical aoeDefini return Collections.emptySet(); } - public static Set getHarvestableBlocks(ItemStack stack, AoESymmetrical aoeDefinition, Level world, Player player, HitResult rayTraceResult) { + public static Set getHarvestableBlocks(ItemStack stack, AoESymmetrical aoeDefinition, Level world, + Player player, HitResult rayTraceResult) { return iterateAoE(stack, aoeDefinition, world, player, rayTraceResult, ToolHelper::isBlockAoEHarvestable); } - private static boolean isBlockAoEHarvestable(ItemStack stack, Level world, Player player, BlockPos pos, UseOnContext context) { + private static boolean isBlockAoEHarvestable(ItemStack stack, Level world, Player player, BlockPos pos, + UseOnContext context) { if (world.getBlockState(pos).isAir()) return false; BlockState state = world.getBlockState(pos); @@ -388,19 +398,29 @@ private static boolean isBlockAoEHarvestable(ItemStack stack, Level world, Playe /** * Applies Forge Hammer recipes to block broken, used for hammers or tools with hard hammer enchant applied. */ - public static void applyHammerDropConversion(ServerLevel world, BlockPos pos, ItemStack tool, BlockState state, List drops, int fortune, float dropChance, RandomSource random) { - if (is(tool, GTToolType.HARD_HAMMER) || /*EnchantmentHelper.getEnchantmentLevel(EnchantmentHardHammer.INSTANCE, tool)*/ -1 > 0) { + public static void applyHammerDropConversion(ServerLevel world, BlockPos pos, ItemStack tool, BlockState state, + List drops, int fortune, float dropChance, + RandomSource random) { + if (is(tool, GTToolType.HARD_HAMMER) || /* + * EnchantmentHelper.getEnchantmentLevel(EnchantmentHardHammer.INSTANCE, + * tool) + */ -1 > 0) { List silktouchDrops = getSilkTouchDrop(world, pos, state); for (ItemStack silktouchDrop : silktouchDrops) { if (silktouchDrop.isEmpty()) continue; // Stack lists can be immutable going into Recipe#matches barring no rewrites // Search for forge hammer recipes from all drops individually (only LV or under) - Table, List>> caps = Tables.newCustomTable(new EnumMap<>(IO.class), IdentityHashMap::new); - DummyMachineBlockEntity be = new DummyMachineBlockEntity(GTValues.LV, GTRecipeTypes.FORGE_HAMMER_RECIPES, GTMachines.defaultTankSizeFunction, caps); - caps.put(IO.IN, EURecipeCapability.CAP, List.of(new InfiniteEnergyContainer(be.getMetaMachine(), GTValues.V[GTValues.LV], GTValues.V[GTValues.LV], 1, GTValues.V[GTValues.LV], 1))); - caps.put(IO.IN, ItemRecipeCapability.CAP, List.of(new NotifiableItemStackHandler(be.getMetaMachine(), 1, IO.IN, IO.IN, (slots) -> new ItemStackTransfer(silktouchDrop)))); - caps.put(IO.OUT, ItemRecipeCapability.CAP, List.of(new NotifiableItemStackHandler(be.getMetaMachine(), 2, IO.OUT))); + Table, List>> caps = Tables + .newCustomTable(new EnumMap<>(IO.class), IdentityHashMap::new); + DummyMachineBlockEntity be = new DummyMachineBlockEntity(GTValues.LV, + GTRecipeTypes.FORGE_HAMMER_RECIPES, GTMachines.defaultTankSizeFunction, caps); + caps.put(IO.IN, EURecipeCapability.CAP, List.of(new InfiniteEnergyContainer(be.getMetaMachine(), + GTValues.V[GTValues.LV], GTValues.V[GTValues.LV], 1, GTValues.V[GTValues.LV], 1))); + caps.put(IO.IN, ItemRecipeCapability.CAP, List.of(new NotifiableItemStackHandler(be.getMetaMachine(), 1, + IO.IN, IO.IN, (slots) -> new ItemStackTransfer(silktouchDrop)))); + caps.put(IO.OUT, ItemRecipeCapability.CAP, + List.of(new NotifiableItemStackHandler(be.getMetaMachine(), 2, IO.OUT))); be.getMetaMachine().reinitializeCapabilities(caps); Iterator hammerRecipes = GTRecipeTypes.FORGE_HAMMER_RECIPES.searchRecipe(be.metaMachine); @@ -411,7 +431,8 @@ public static void applyHammerDropConversion(ServerLevel world, BlockPos pos, It if (prefix == null) { for (Content output : hammerRecipe.getOutputContents(ItemRecipeCapability.CAP)) { if (dropChance >= 1.0F || random.nextFloat() <= dropChance) { - drops.add(SizedIngredient.copy(ItemRecipeCapability.CAP.of(output.content)).getItems()[0]); + drops.add(SizedIngredient.copy(ItemRecipeCapability.CAP.of(output.content)) + .getItems()[0]); } } } else if (TagPrefix.ORES.containsKey(prefix)) { @@ -490,14 +511,17 @@ public static boolean isCorrectTierForDrops(BlockState state, int tier) { } private static Tier getTier(int harvestLevel) { - return TierSortingRegistry.getSortedTiers().stream().dropWhile(tier -> tier.getLevel() < harvestLevel || tier.getLevel() > harvestLevel).findAny().orElse(Tiers.WOOD); + return TierSortingRegistry.getSortedTiers().stream() + .dropWhile(tier -> tier.getLevel() < harvestLevel || tier.getLevel() > harvestLevel).findAny() + .orElse(Tiers.WOOD); } public static boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, Player player) { return itemstack.onBlockStartBreak(pos, player); } - public static boolean removeBlockRoutine(@Nullable BlockState state, Level world, ServerPlayer player, BlockPos pos, boolean playSound) { + public static boolean removeBlockRoutine(@Nullable BlockState state, Level world, ServerPlayer player, BlockPos pos, + boolean playSound) { state = state == null ? world.getBlockState(pos) : state; state.getBlock().playerWillDestroy(world, pos, state, player); @@ -546,7 +570,8 @@ public static void onActionDone(@NotNull Player player, @NotNull Level world, @N IGTTool tool = (IGTTool) stack.getItem(); ToolHelper.damageItem(stack, player); if (tool.getSound() != null) { - world.playSound(null, player.getX(), player.getY(), player.getZ(), tool.getSound().getMainEvent(), SoundSource.PLAYERS, 1.0F, + world.playSound(null, player.getX(), player.getY(), player.getZ(), tool.getSound().getMainEvent(), + SoundSource.PLAYERS, 1.0F, 1.0F); } player.swing(hand); @@ -609,8 +634,7 @@ public static boolean isToolEffective(BlockState state, Set toolClas if (toolClasses.contains(GTToolType.SWORD)) { if (block instanceof WebBlock) return true; } - if (toolClasses.contains(GTToolType.SCYTHE)) { - } + if (toolClasses.contains(GTToolType.SCYTHE)) {} if (toolClasses.contains(GTToolType.FILE)) { if (block instanceof IronBarsBlock) { return true; @@ -634,7 +658,8 @@ public static void damageItemWhenCrafting(@NotNull ItemStack stack, @Nullable Li if (stack.getItem() instanceof IGTTool) { damage = ((IGTTool) stack.getItem()).getToolStats().getToolDamagePerCraft(stack); } else { - if (stack.getTags().anyMatch(s -> s.location().getPath().startsWith("tool") || s.location().getPath().startsWith("crafting_tool"))) { + if (stack.getTags().anyMatch(s -> s.location().getPath().startsWith("tool") || + s.location().getPath().startsWith("crafting_tool"))) { damage = 1; } } @@ -680,7 +705,8 @@ public static int shearBlockRoutine(ServerPlayer player, ItemStack tool, BlockPo BlockState state = world.getBlockState(pos); if (state.getBlock() instanceof IForgeShearable shearable) { if (shearable.isShearable(tool, world, pos)) { - List shearedDrops = shearable.onSheared(player, tool, world, pos, tool.getEnchantmentLevel(Enchantments.BLOCK_FORTUNE)); + List shearedDrops = shearable.onSheared(player, tool, world, pos, + tool.getEnchantmentLevel(Enchantments.BLOCK_FORTUNE)); boolean relocateMinedBlocks = getBehaviorsTag(tool).getBoolean(RELOCATE_MINED_BLOCKS_KEY); Iterator iter = shearedDrops.iterator(); while (iter.hasNext()) { @@ -692,7 +718,8 @@ public static int shearBlockRoutine(ServerPlayer player, ItemStack tool, BlockPo double xo = world.random.nextFloat() * f + 0.15D; double yo = world.random.nextFloat() * f + 0.15D; double zo = world.random.nextFloat() * f + 0.15D; - ItemEntity entityItem = new ItemEntity(world, pos.getX() + xo, pos.getY() + yo, pos.getZ() + zo, stack); + ItemEntity entityItem = new ItemEntity(world, pos.getX() + xo, pos.getY() + yo, + pos.getZ() + zo, stack); entityItem.setDefaultPickUpDelay(); world.addFreshEntity(entityItem); } @@ -707,13 +734,17 @@ public static int shearBlockRoutine(ServerPlayer player, ItemStack tool, BlockPo return -1; } - // Suppliers for broken tool stacks - public static final Supplier SUPPLY_POWER_UNIT_LV = () -> GTItems.POWER_UNIT_LV.get().getDefaultInstance(); - public static final Supplier SUPPLY_POWER_UNIT_MV = () -> GTItems.POWER_UNIT_MV.get().getDefaultInstance(); - public static final Supplier SUPPLY_POWER_UNIT_HV = () -> GTItems.POWER_UNIT_HV.get().getDefaultInstance(); - public static final Supplier SUPPLY_POWER_UNIT_EV = () -> GTItems.POWER_UNIT_EV.get().getDefaultInstance(); - public static final Supplier SUPPLY_POWER_UNIT_IV = () -> GTItems.POWER_UNIT_IV.get().getDefaultInstance(); + public static final Supplier SUPPLY_POWER_UNIT_LV = () -> GTItems.POWER_UNIT_LV.get() + .getDefaultInstance(); + public static final Supplier SUPPLY_POWER_UNIT_MV = () -> GTItems.POWER_UNIT_MV.get() + .getDefaultInstance(); + public static final Supplier SUPPLY_POWER_UNIT_HV = () -> GTItems.POWER_UNIT_HV.get() + .getDefaultInstance(); + public static final Supplier SUPPLY_POWER_UNIT_EV = () -> GTItems.POWER_UNIT_EV.get() + .getDefaultInstance(); + public static final Supplier SUPPLY_POWER_UNIT_IV = () -> GTItems.POWER_UNIT_IV.get() + .getDefaultInstance(); /** * @param state the BlockState of the block @@ -725,7 +756,7 @@ public static List getSilkTouchDrop(ServerLevel world, BlockPos origi tool.enchant(Enchantments.SILK_TOUCH, 1); return state.getDrops(new LootParams.Builder(world).withParameter(LootContextParams.BLOCK_STATE, state) - .withParameter(LootContextParams.ORIGIN, Vec3.atCenterOf(origin)) - .withParameter(LootContextParams.TOOL, tool)); + .withParameter(LootContextParams.ORIGIN, Vec3.atCenterOf(origin)) + .withParameter(LootContextParams.TOOL, tool)); } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/tool/TreeFellingHelper.java b/src/main/java/com/gregtechceu/gtceu/api/item/tool/TreeFellingHelper.java index c3dc88bdb1..7b58ac19d0 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/tool/TreeFellingHelper.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/tool/TreeFellingHelper.java @@ -1,7 +1,7 @@ package com.gregtechceu.gtceu.api.item.tool; import com.gregtechceu.gtceu.utils.TaskHandler; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.LivingEntity; @@ -10,12 +10,15 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import java.util.*; import java.util.stream.Collectors; public class TreeFellingHelper { - public static void fellTree(ItemStack stack, Level level, BlockState origin, BlockPos originPos, LivingEntity miner) { + public static void fellTree(ItemStack stack, Level level, BlockState origin, BlockPos originPos, + LivingEntity miner) { BlockPos.MutableBlockPos mutablePos = new BlockPos.MutableBlockPos(); Queue checking = new ArrayDeque<>(); @@ -56,7 +59,8 @@ public static void fellTree(ItemStack stack, Level level, BlockState origin, Blo } } - public static void breakBlocksPerTick(ServerPlayer player, ItemStack tool, List posList, Block originBlock) { + public static void breakBlocksPerTick(ServerPlayer player, ItemStack tool, List posList, + Block originBlock) { for (int i = 0; i < posList.size(); i++) { int delayTick = i * 2; // 1 block per 2 tick BlockPos pos = posList.get(i); diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/tool/aoe/AoESymmetrical.java b/src/main/java/com/gregtechceu/gtceu/api/item/tool/aoe/AoESymmetrical.java index 69584f8f08..3ed0412da9 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/tool/aoe/AoESymmetrical.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/tool/aoe/AoESymmetrical.java @@ -1,10 +1,11 @@ package com.gregtechceu.gtceu.api.item.tool.aoe; -import com.google.common.base.Preconditions; import com.gregtechceu.gtceu.api.item.tool.ToolHelper; + import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.Tag; +import com.google.common.base.Preconditions; import org.jetbrains.annotations.Nullable; public class AoESymmetrical { @@ -162,4 +163,4 @@ public static void decreaseLayer(CompoundTag tag, AoESymmetrical defaultDefiniti } } } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/item/tool/behavior/IToolBehavior.java b/src/main/java/com/gregtechceu/gtceu/api/item/tool/behavior/IToolBehavior.java index 96c172bd08..d58da1d921 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/item/tool/behavior/IToolBehavior.java +++ b/src/main/java/com/gregtechceu/gtceu/api/item/tool/behavior/IToolBehavior.java @@ -1,8 +1,8 @@ package com.gregtechceu.gtceu.api.item.tool.behavior; import com.gregtechceu.gtceu.api.item.IGTTool; + import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; import net.minecraft.world.InteractionHand; @@ -20,6 +20,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; + import java.util.List; /** @@ -27,17 +28,14 @@ */ public interface IToolBehavior { - default void init(IGTTool toolItem) { - - } + default void init(IGTTool toolItem) {} /** * @param stack The current ItemStack * @param target the entity being hit * @param attacker the entity hitting the other */ - default void hitEntity(@NotNull ItemStack stack, @NotNull LivingEntity target, @NotNull LivingEntity attacker) { - } + default void hitEntity(@NotNull ItemStack stack, @NotNull LivingEntity target, @NotNull LivingEntity attacker) {} /** * Called before a block is broken. @@ -48,8 +46,7 @@ default void hitEntity(@NotNull ItemStack stack, @NotNull LivingEntity target, @ * @param pos Block's position in world * @param player The Player that is wielding the item */ - default void onBlockStartBreak(@NotNull ItemStack stack, @NotNull BlockPos pos, @NotNull Player player) { - } + default void onBlockStartBreak(@NotNull ItemStack stack, @NotNull BlockPos pos, @NotNull Player player) {} /** * Called when a Block is destroyed using this Item. @@ -60,8 +57,8 @@ default void onBlockStartBreak(@NotNull ItemStack stack, @NotNull BlockPos pos, * @param pos The position of the destroyed block * @param entityLiving the entity destroying the block */ - default void onBlockDestroyed(@NotNull ItemStack stack, @NotNull Level world, @NotNull BlockState state, @NotNull BlockPos pos, @NotNull LivingEntity entityLiving) { - } + default void onBlockDestroyed(@NotNull ItemStack stack, @NotNull Level world, @NotNull BlockState state, + @NotNull BlockPos pos, @NotNull LivingEntity entityLiving) {} /** * Called when an entity tries to play the 'swing' animation. @@ -69,14 +66,13 @@ default void onBlockDestroyed(@NotNull ItemStack stack, @NotNull Level world, @N * @param entityLiving The entity swinging the item. * @param stack The Item stack */ - default void onEntitySwing(@NotNull LivingEntity entityLiving, @NotNull ItemStack stack) { - } + default void onEntitySwing(@NotNull LivingEntity entityLiving, @NotNull ItemStack stack) {} /** * - * @param stack the tool - * @param shield the shield to disable - * @param entity the entity holding the shield + * @param stack the tool + * @param shield the shield to disable + * @param entity the entity holding the shield * @param attacker the entity attacking the shield * @return if the tool can disable shields */ @@ -87,7 +83,7 @@ default boolean canDisableShield(ItemStack stack, ItemStack shield, LivingEntity /** * Called when a Block is right-clicked with this Item, but before the block is activated * - * @param stack the stack used + * @param stack the stack used * @param context the context containing all information about the click. */ default InteractionResult onItemUseFirst(ItemStack stack, UseOnContext context) { @@ -112,7 +108,8 @@ default InteractionResult onItemUse(UseOnContext context) { * @param hand the hand holding the item */ @NotNull - default InteractionResultHolder onItemRightClick(@NotNull Level world, @NotNull Player player, @NotNull InteractionHand hand) { + default InteractionResultHolder onItemRightClick(@NotNull Level world, @NotNull Player player, + @NotNull InteractionHand hand) { return InteractionResultHolder.pass(player.getItemInHand(hand)); } @@ -127,14 +124,14 @@ default boolean shouldOpenUIAfterUse(UseOnContext context) { } @OnlyIn(Dist.CLIENT) - default void addInformation(@NotNull ItemStack stack, @Nullable Level world, @NotNull List tooltip, @NotNull TooltipFlag flag) { - } + default void addInformation(@NotNull ItemStack stack, @Nullable Level world, @NotNull List tooltip, + @NotNull TooltipFlag flag) {} /** * Add the necessary NBT information to the tool + * * @param stack the tool * @param tag the nbt tag to add to */ - default void addBehaviorNBT(@NotNull ItemStack stack, @NotNull CompoundTag tag) { - } -} \ No newline at end of file + default void addBehaviorNBT(@NotNull ItemStack stack, @NotNull CompoundTag tag) {} +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/ConditionalSubscriptionHandler.java b/src/main/java/com/gregtechceu/gtceu/api/machine/ConditionalSubscriptionHandler.java index d73db7e03f..d07933d173 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/ConditionalSubscriptionHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/ConditionalSubscriptionHandler.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.api.machine; import com.gregtechceu.gtceu.api.blockentity.ITickSubscription; + import net.minecraft.server.MinecraftServer; import net.minecraft.server.TickTask; import net.minecraft.server.level.ServerLevel; @@ -16,6 +17,7 @@ * consume resources. */ public class ConditionalSubscriptionHandler { + private final ITickSubscription handler; private final Runnable runnable; private final Supplier condition; @@ -28,7 +30,6 @@ public ConditionalSubscriptionHandler(ITickSubscription handler, Runnable runnab this.condition = condition; } - /** * Initializes the subscription and, if the supplied level is server-side, adds it to the event loop. * diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/IMachineBlockEntity.java b/src/main/java/com/gregtechceu/gtceu/api/machine/IMachineBlockEntity.java index 6aa6318982..9da6b13811 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/IMachineBlockEntity.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/IMachineBlockEntity.java @@ -2,22 +2,24 @@ import com.gregtechceu.gtceu.api.block.IMachineBlock; import com.gregtechceu.gtceu.api.item.tool.IToolGridHighLight; + import com.lowdragmc.lowdraglib.syncdata.blockentity.IAsyncAutoSyncBlockEntity; import com.lowdragmc.lowdraglib.syncdata.blockentity.IAutoPersistBlockEntity; import com.lowdragmc.lowdraglib.syncdata.blockentity.IRPCBlockEntity; import com.lowdragmc.lowdraglib.syncdata.managed.MultiManagedStorage; + import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; - /** * A simple compound Interface for all my TileEntities. *

* Also delivers most of the Information about TileEntities. */ -public interface IMachineBlockEntity extends IToolGridHighLight, IAsyncAutoSyncBlockEntity, IRPCBlockEntity, IAutoPersistBlockEntity { +public interface IMachineBlockEntity extends IToolGridHighLight, IAsyncAutoSyncBlockEntity, IRPCBlockEntity, + IAutoPersistBlockEntity { default BlockEntity self() { return (BlockEntity) this; @@ -57,7 +59,8 @@ default MachineDefinition getDefinition() { if (self().getBlockState().getBlock() instanceof IMachineBlock machineBlock) { return machineBlock.getDefinition(); } else { - throw new IllegalStateException("MetaMachineBlockEntity is created for an un available block: " + self().getBlockState().getBlock()); + throw new IllegalStateException("MetaMachineBlockEntity is created for an un available block: " + + self().getBlockState().getBlock()); } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/MachineCoverContainer.java b/src/main/java/com/gregtechceu/gtceu/api/machine/MachineCoverContainer.java index 43d0af418d..78c122c0eb 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/MachineCoverContainer.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/MachineCoverContainer.java @@ -5,24 +5,27 @@ import com.gregtechceu.gtceu.api.cover.CoverBehavior; import com.gregtechceu.gtceu.api.cover.CoverDefinition; import com.gregtechceu.gtceu.api.registry.GTRegistries; -import com.lowdragmc.lowdraglib.syncdata.IEnhancedManaged; -import com.lowdragmc.lowdraglib.syncdata.annotation.UpdateListener; import com.gregtechceu.gtceu.utils.GTUtil; + import com.lowdragmc.lowdraglib.side.fluid.IFluidTransfer; import com.lowdragmc.lowdraglib.side.item.IItemTransfer; +import com.lowdragmc.lowdraglib.syncdata.IEnhancedManaged; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.annotation.ReadOnlyManaged; +import com.lowdragmc.lowdraglib.syncdata.annotation.UpdateListener; import com.lowdragmc.lowdraglib.syncdata.field.FieldManagedStorage; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; import com.lowdragmc.lowdraglib.syncdata.managed.IRef; -import lombok.Getter; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.Level; import net.minecraft.world.phys.shapes.VoxelShape; + +import lombok.Getter; import org.jetbrains.annotations.Nullable; import java.util.ArrayList; @@ -41,7 +44,9 @@ public class MachineCoverContainer implements ICoverable, IEnhancedManaged { @DescSynced @Persisted @UpdateListener(methodName = "onCoverSet") - @ReadOnlyManaged(onDirtyMethod = "onCoverDirty", serializeMethod = "serializeCoverUid", deserializeMethod = "deserializeCoverUid") + @ReadOnlyManaged(onDirtyMethod = "onCoverDirty", + serializeMethod = "serializeCoverUid", + deserializeMethod = "deserializeCoverUid") private CoverBehavior up, down, north, south, west, east; public MachineCoverContainer(MetaMachine machine) { @@ -112,9 +117,9 @@ public boolean isInValid() { public boolean canPlaceCoverOnSide(CoverDefinition definition, Direction side) { ArrayList collisionList = new ArrayList<>(); machine.addCollisionBoundingBox(collisionList); - //noinspection RedundantIfStatement + // noinspection RedundantIfStatement if (ICoverable.doesCoverCollide(side, collisionList, getCoverPlateThickness())) { - //cover collision box overlaps with meta tile entity collision box + // cover collision box overlaps with meta tile entity collision box return false; } @@ -126,7 +131,6 @@ public double getCoverPlateThickness() { return 0; } - @Override public Direction getFrontFacing() { return machine.getFrontFacing(); @@ -191,7 +195,8 @@ private boolean onCoverDirty(CoverBehavior coverBehavior) { for (IRef ref : coverBehavior.getSyncStorage().getNonLazyFields()) { ref.update(); } - return coverBehavior.getSyncStorage().hasDirtySyncFields() || coverBehavior.getSyncStorage().hasDirtyPersistedFields(); + return coverBehavior.getSyncStorage().hasDirtySyncFields() || + coverBehavior.getSyncStorage().hasDirtyPersistedFields(); } return false; } @@ -215,6 +220,4 @@ private CoverBehavior deserializeCoverUid(CompoundTag uid) { GTCEu.LOGGER.error("couldn't find cover definition {}", definitionId); throw new RuntimeException(); } - - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/MachineDefinition.java b/src/main/java/com/gregtechceu/gtceu/api/machine/MachineDefinition.java index 9c6f9fb767..896f2a68e8 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/MachineDefinition.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/MachineDefinition.java @@ -8,12 +8,10 @@ import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.GTRecipeType; import com.gregtechceu.gtceu.api.recipe.modifier.RecipeModifier; + import com.lowdragmc.lowdraglib.client.renderer.IRenderer; import com.lowdragmc.lowdraglib.utils.ShapeUtils; -import it.unimi.dsi.fastutil.objects.Object2IntMap; -import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; -import lombok.Getter; -import lombok.Setter; + import net.minecraft.core.Direction; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; @@ -25,8 +23,13 @@ import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; +import it.unimi.dsi.fastutil.objects.Object2IntMap; +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; +import lombok.Getter; +import lombok.Setter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; + import java.util.EnumMap; import java.util.List; import java.util.Map; @@ -36,9 +39,10 @@ * @author KilaBash * @date 2023/2/18 * @implNote MachineDefinition - * Representing basic information of a machine. + * Representing basic information of a machine. */ public class MachineDefinition implements Supplier { + @Getter private final ResourceLocation id; @Setter @@ -49,41 +53,57 @@ public class MachineDefinition implements Supplier { private Supplier> blockEntityTypeSupplier; @Setter private Function machineSupplier; - @Getter @Setter @Nullable + @Getter + @Setter + @Nullable private GTRecipeType[] recipeTypes; - @Getter @Setter + @Getter + @Setter private int tier; - @Getter @Setter + @Getter + @Setter private int defaultPaintingColor; - @Getter @Setter + @Getter + @Setter private RecipeModifier recipeModifier; - @Getter @Setter + @Getter + @Setter private boolean alwaysTryModifyRecipe; @NotNull - @Getter @Setter + @Getter + @Setter private BiPredicate beforeWorking = (machine, recipe) -> true; @NotNull - @Getter @Setter + @Getter + @Setter private Predicate onWorking = (machine) -> true; @NotNull - @Getter @Setter + @Getter + @Setter private Consumer onWaiting = (machine) -> {}; @NotNull - @Getter @Setter + @Getter + @Setter private Consumer afterWorking = (machine) -> {}; - @Getter @Setter + @Getter + @Setter private IRenderer renderer; @Setter private VoxelShape shape; private final Map cache = new EnumMap<>(Direction.class); - @Getter @Setter + @Getter + @Setter private BiConsumer> tooltipBuilder; - @Getter @Setter + @Getter + @Setter private Supplier appearance; - @Nullable @Getter @Setter + @Nullable + @Getter + @Setter private EditableMachineUI editableUI; - @Getter @Setter + @Getter + @Setter private Object2IntMap> recipeOutputLimits = new Object2IntOpenHashMap<>(); protected MachineDefinition(ResourceLocation id) { @@ -91,7 +111,7 @@ protected MachineDefinition(ResourceLocation id) { } public static MachineDefinition createDefinition(ResourceLocation id) { - return new MachineDefinition(id); + return new MachineDefinition(id); } public Block getBlock() { diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/MetaMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/MetaMachine.java index 6c361ebac0..8b2f376cb1 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/MetaMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/MetaMachine.java @@ -21,26 +21,25 @@ import com.gregtechceu.gtceu.api.machine.trait.MachineTrait; import com.gregtechceu.gtceu.api.misc.IOFluidTransferList; import com.gregtechceu.gtceu.api.misc.IOItemTransferList; -import com.gregtechceu.gtceu.common.item.tool.behavior.ToolModeSwitchBehavior; -import com.lowdragmc.lowdraglib.syncdata.IEnhancedManaged; -import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; import com.gregtechceu.gtceu.common.cover.FluidFilterCover; import com.gregtechceu.gtceu.common.cover.ItemFilterCover; +import com.gregtechceu.gtceu.common.item.tool.behavior.ToolModeSwitchBehavior; + import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; import com.lowdragmc.lowdraglib.side.fluid.FluidStack; import com.lowdragmc.lowdraglib.side.fluid.IFluidTransfer; import com.lowdragmc.lowdraglib.side.item.IItemTransfer; +import com.lowdragmc.lowdraglib.syncdata.IEnhancedManaged; 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.FieldManagedStorage; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; import com.lowdragmc.lowdraglib.utils.DummyWorld; import com.lowdragmc.lowdraglib.utils.LocalizationUtils; -import com.mojang.datafixers.util.Pair; -import lombok.Getter; -import lombok.Setter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -64,16 +63,20 @@ import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import org.jetbrains.annotations.NotNull; +import com.mojang.datafixers.util.Pair; +import lombok.Getter; +import lombok.Setter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; + import java.util.ArrayList; import java.util.List; import java.util.Set; import java.util.function.Predicate; +import javax.annotation.ParametersAreNonnullByDefault; + import static com.gregtechceu.gtceu.api.item.tool.ToolHelper.getBehaviorsTag; import static com.gregtechceu.gtceu.common.item.tool.behavior.ToolModeSwitchBehavior.ModeType.BOTH; import static com.gregtechceu.gtceu.common.item.tool.behavior.ToolModeSwitchBehavior.ModeType.ITEM; @@ -82,13 +85,15 @@ * @author KilaBash * @date 2023/2/17 * @implNote MetaMachine, an abstract layer of gregtech machine. - * Because I have to implement BlockEntities for both fabric and forge platform. - * All fundamental features will be implemented here. - * To add additional features, you can see {@link IMachineFeature} + * Because I have to implement BlockEntities for both fabric and forge platform. + * All fundamental features will be implemented here. + * To add additional features, you can see {@link IMachineFeature} */ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault -public class MetaMachine implements IEnhancedManaged, IToolable, ITickSubscription, IAppearance, IToolGridHighLight, IFancyTooltip, IPaintable, IRedstoneSignalMachine { +public class MetaMachine implements IEnhancedManaged, IToolable, ITickSubscription, IAppearance, IToolGridHighLight, + IFancyTooltip, IPaintable, IRedstoneSignalMachine { + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(MetaMachine.class); @Getter private final FieldManagedStorage syncStorage = new FieldManagedStorage(this); @@ -98,8 +103,11 @@ public class MetaMachine implements IEnhancedManaged, IToolable, ITickSubscripti @DescSynced @Persisted(key = "cover") protected final MachineCoverContainer coverContainer; - @Getter @Setter - @Persisted @DescSynced @RequireRerender + @Getter + @Setter + @Persisted + @DescSynced + @RequireRerender private int paintingColor = -1; @Getter protected final List traits; @@ -119,7 +127,7 @@ public MetaMachine(IMachineBlockEntity holder) { } ////////////////////////////////////// - //***** Initialization ******// + // ***** Initialization ******// ////////////////////////////////////// @Override @@ -197,23 +205,21 @@ public void onLoad() { /** * Use for data not able to be saved with the SyncData system, like optional mod compatiblity in internal machines. - * @param tag the CompoundTag to load data from + * + * @param tag the CompoundTag to load data from * @param forDrop if the save is done for dropping the machine as an item. */ - public void saveCustomPersistedData(CompoundTag tag, boolean forDrop) { + public void saveCustomPersistedData(CompoundTag tag, boolean forDrop) {} - } - - public void loadCustomPersistedData(CompoundTag tag) { - - } + public void loadCustomPersistedData(CompoundTag tag) {} ////////////////////////////////////// - //***** Tickable Manager ****// + // ***** Tickable Manager ****// ////////////////////////////////////// /** - * For initialization. To get level and property fields after auto sync, you can subscribe it in {@link #onLoad()} event. + * For initialization. To get level and property fields after auto sync, you can subscribe it in {@link #onLoad()} + * event. */ @Nullable public TickableSubscription subscribeServerTick(Runnable runnable) { @@ -227,7 +233,8 @@ public TickableSubscription subscribeServerTick(Runnable runnable) { holder.getSelf().setBlockState(blockState); serverLevel.getServer().tell(new TickTask(0, () -> { if (!isInValid()) { - serverLevel.setBlockAndUpdate(getPos(), getBlockState().setValue(BlockProperties.SERVER_TICK, true)); + serverLevel.setBlockAndUpdate(getPos(), + getBlockState().setValue(BlockProperties.SERVER_TICK, true)); } })); } @@ -286,21 +293,24 @@ private void executeTick() { } ////////////////////////////////////// - //******* Interaction *******// + // ******* Interaction *******// ////////////////////////////////////// /** * Called when a player clicks this meta tile entity with a tool * - * @return SUCCESS / CONSUME (will damage tool) / FAIL if something happened, so tools will get damaged and animations will be played + * @return SUCCESS / CONSUME (will damage tool) / FAIL if something happened, so tools will get damaged and + * animations will be played */ @Override - public final Pair onToolClick(Set<@NotNull GTToolType> toolType, ItemStack itemStack, UseOnContext context) { + public final Pair onToolClick(Set<@NotNull GTToolType> toolType, ItemStack itemStack, + UseOnContext context) { // the side hit from the machine grid var playerIn = context.getPlayer(); if (playerIn == null) return Pair.of(null, InteractionResult.PASS); var hand = context.getHand(); - var hitResult = new BlockHitResult(context.getClickLocation(), context.getClickedFace(), context.getClickedPos(), false); + var hitResult = new BlockHitResult(context.getClickLocation(), context.getClickedFace(), + context.getClickedPos(), false); Direction gridSide = ICoverable.determineGridSideHit(hitResult); CoverBehavior coverBehavior = gridSide == null ? null : coverContainer.getCoverAtSide(gridSide); if (gridSide == null) gridSide = hitResult.getDirection(); @@ -330,7 +340,8 @@ public final Pair onToolClick(Set<@NotNull GTTool return Pair.of(null, InteractionResult.PASS); } - protected InteractionResult onHardHammerClick(Player playerIn, InteractionHand hand, Direction gridSide, BlockHitResult hitResult) { + protected InteractionResult onHardHammerClick(Player playerIn, InteractionHand hand, Direction gridSide, + BlockHitResult hitResult) { if (this instanceof IMufflableMachine mufflableMachine) { if (!isRemote()) { mufflableMachine.setMuffled(!mufflableMachine.isMuffled()); @@ -341,11 +352,13 @@ protected InteractionResult onHardHammerClick(Player playerIn, InteractionHand h return InteractionResult.PASS; } - protected InteractionResult onCrowbarClick(Player playerIn, InteractionHand hand, Direction gridSide, BlockHitResult hitResult) { + protected InteractionResult onCrowbarClick(Player playerIn, InteractionHand hand, Direction gridSide, + BlockHitResult hitResult) { return InteractionResult.PASS; } - protected InteractionResult onWrenchClick(Player playerIn, InteractionHand hand, Direction gridSide, BlockHitResult hitResult) { + protected InteractionResult onWrenchClick(Player playerIn, InteractionHand hand, Direction gridSide, + BlockHitResult hitResult) { if (playerIn.isShiftKeyDown()) { if (gridSide == getFrontFacing() || !isFacingValid(gridSide)) { return InteractionResult.FAIL; @@ -354,21 +367,23 @@ protected InteractionResult onWrenchClick(Player playerIn, InteractionHand hand, setFrontFacing(gridSide); } return InteractionResult.CONSUME; - } - else { - if(isRemote()) + } else { + if (isRemote()) return InteractionResult.CONSUME; var itemStack = playerIn.getItemInHand(hand); var tagCompound = getBehaviorsTag(itemStack); - ToolModeSwitchBehavior.ModeType type = ToolModeSwitchBehavior.ModeType.values()[tagCompound.getByte("Mode")]; + ToolModeSwitchBehavior.ModeType type = ToolModeSwitchBehavior.ModeType.values()[tagCompound + .getByte("Mode")]; if (type == ToolModeSwitchBehavior.ModeType.ITEM || type == ToolModeSwitchBehavior.ModeType.BOTH) { - if (this instanceof IAutoOutputItem autoOutputItem && (!hasFrontFacing() || gridSide != getFrontFacing())) { + if (this instanceof IAutoOutputItem autoOutputItem && + (!hasFrontFacing() || gridSide != getFrontFacing())) { autoOutputItem.setOutputFacingItems(gridSide); } } if (type == ToolModeSwitchBehavior.ModeType.FLUID || type == ToolModeSwitchBehavior.ModeType.BOTH) { - if (this instanceof IAutoOutputFluid autoOutputFluid && (!hasFrontFacing() || gridSide != getFrontFacing())) { + if (this instanceof IAutoOutputFluid autoOutputFluid && + (!hasFrontFacing() || gridSide != getFrontFacing())) { autoOutputFluid.setOutputFacingFluids(gridSide); } } @@ -376,7 +391,8 @@ protected InteractionResult onWrenchClick(Player playerIn, InteractionHand hand, } } - protected InteractionResult onSoftMalletClick(Player playerIn, InteractionHand hand, Direction gridSide, BlockHitResult hitResult) { + protected InteractionResult onSoftMalletClick(Player playerIn, InteractionHand hand, Direction gridSide, + BlockHitResult hitResult) { var controllable = GTCapabilityHelper.getControllable(getLevel(), getPos(), gridSide); if (controllable != null) { if (!isRemote()) { @@ -389,24 +405,32 @@ protected InteractionResult onSoftMalletClick(Player playerIn, InteractionHand h return InteractionResult.PASS; } - protected InteractionResult onScrewdriverClick(Player playerIn, InteractionHand hand, Direction gridSide, BlockHitResult hitResult) { + protected InteractionResult onScrewdriverClick(Player playerIn, InteractionHand hand, Direction gridSide, + BlockHitResult hitResult) { var itemStack = playerIn.getItemInHand(hand); var tagCompound = getBehaviorsTag(itemStack); - if(isRemote()) + if (isRemote()) return InteractionResult.CONSUME; if (playerIn.isShiftKeyDown()) { boolean flag = false; if (this instanceof IAutoOutputItem autoOutputItem) { if (autoOutputItem.getOutputFacingItems() == gridSide) { autoOutputItem.setAllowInputFromOutputSideItems(!autoOutputItem.isAllowInputFromOutputSideItems()); - playerIn.displayClientMessage(Component.translatable("gtceu.machine.basic.input_from_output_side." + (autoOutputItem.isAllowInputFromOutputSideItems() ? "allow" : "disallow")).append(Component.translatable("gtceu.creative.chest.item")), true); + playerIn.displayClientMessage(Component + .translatable("gtceu.machine.basic.input_from_output_side." + + (autoOutputItem.isAllowInputFromOutputSideItems() ? "allow" : "disallow")) + .append(Component.translatable("gtceu.creative.chest.item")), true); flag = true; } } if (this instanceof IAutoOutputFluid autoOutputFluid) { if (autoOutputFluid.getOutputFacingFluids() == gridSide) { - autoOutputFluid.setAllowInputFromOutputSideFluids(!autoOutputFluid.isAllowInputFromOutputSideFluids()); - playerIn.displayClientMessage(Component.translatable("gtceu.machine.basic.input_from_output_side." + (autoOutputFluid.isAllowInputFromOutputSideFluids() ? "allow" : "disallow")).append(Component.translatable("gtceu.creative.tank.fluid")), true); + autoOutputFluid + .setAllowInputFromOutputSideFluids(!autoOutputFluid.isAllowInputFromOutputSideFluids()); + playerIn.displayClientMessage(Component + .translatable("gtceu.machine.basic.input_from_output_side." + + (autoOutputFluid.isAllowInputFromOutputSideFluids() ? "allow" : "disallow")) + .append(Component.translatable("gtceu.creative.tank.fluid")), true); flag = true; } } @@ -435,9 +459,8 @@ protected InteractionResult onScrewdriverClick(Player playerIn, InteractionHand return InteractionResult.PASS; } - ////////////////////////////////////// - //********** MISC ***********// + // ********** MISC ***********// ////////////////////////////////////// @Nullable @@ -500,12 +523,10 @@ public ResourceTexture sideTips(Player player, Set toolTypes, Direct return null; } - public MachineDefinition getDefinition() { return holder.getDefinition(); } - /** * Called to obtain list of AxisAlignedBB used for collision testing, highlight rendering * and ray tracing this meta tile entity's block in world @@ -546,13 +567,12 @@ public boolean isFacingValid(Direction facing) { public void setFrontFacing(Direction facing) { var blockState = getBlockState(); if (blockState.getBlock() instanceof MetaMachineBlock metaMachineBlock && isFacingValid(facing)) { - getLevel().setBlockAndUpdate(getPos(), blockState.setValue(metaMachineBlock.rotationState.property, facing)); + getLevel().setBlockAndUpdate(getPos(), + blockState.setValue(metaMachineBlock.rotationState.property, facing)); } } - public void onRotated(Direction oldFacing, Direction newFacing) { - - } + public void onRotated(Direction oldFacing, Direction newFacing) {} public int tintColor(int index) { // index < -100 => emission if shimmer is installed. @@ -566,12 +586,12 @@ public void onNeighborChanged(Block block, BlockPos fromPos, boolean isMoving) { coverContainer.onNeighborChanged(block, fromPos, isMoving); } - public void animateTick(RandomSource random) { - } + public void animateTick(RandomSource random) {} @Override @NotNull - public BlockState getBlockAppearance(BlockState state, BlockAndTintGetter level, BlockPos pos, Direction side, BlockState sourceState, BlockPos sourcePos) { + public BlockState getBlockAppearance(BlockState state, BlockAndTintGetter level, BlockPos pos, Direction side, + BlockState sourceState, BlockPos sourcePos) { var appearance = getCoverContainer().getBlockAppearance(state, level, pos, side, sourceState, sourcePos); if (appearance != null) return appearance; if (this instanceof IMultiPart part && part.isFormed()) { @@ -604,7 +624,7 @@ public boolean canConnectRedstone(Direction side) { } ////////////////////////////////////// - //****** Capability ********// + // ****** Capability ********// ////////////////////////////////////// protected Predicate getItemCapFilter(@Nullable Direction side) { @@ -638,7 +658,8 @@ public IItemTransfer getItemTransferCap(@Nullable Direction side, boolean useCov if (list.isEmpty()) return null; var io = IO.BOTH; - if (side != null && this instanceof IAutoOutputItem autoOutput && autoOutput.getOutputFacingItems() == side && !autoOutput.isAllowInputFromOutputSideItems()) { + if (side != null && this instanceof IAutoOutputItem autoOutput && autoOutput.getOutputFacingItems() == side && + !autoOutput.isAllowInputFromOutputSideItems()) { io = IO.OUT; } @@ -660,7 +681,8 @@ public IFluidTransfer getFluidTransferCap(@Nullable Direction side, boolean useC if (list.isEmpty()) return null; var io = IO.BOTH; - if (side != null && this instanceof IAutoOutputFluid autoOutput && autoOutput.getOutputFacingFluids() == side && !autoOutput.isAllowInputFromOutputSideFluids()) { + if (side != null && this instanceof IAutoOutputFluid autoOutput && autoOutput.getOutputFacingFluids() == side && + !autoOutput.isAllowInputFromOutputSideFluids()) { io = IO.OUT; } @@ -672,7 +694,7 @@ public IFluidTransfer getFluidTransferCap(@Nullable Direction side, boolean useC } ////////////////////////////////////// - //******** GUI *********// + // ******** GUI *********// ////////////////////////////////////// @Override public IGuiTexture getFancyTooltipIcon() { @@ -693,7 +715,8 @@ public boolean showFancyTooltip() { public void onAddFancyInformationTooltip(List tooltips) { getDefinition().getTooltipBuilder().accept(getDefinition().asStack(), tooltips); - String mainKey = String.format("%s.machine.%s.tooltip", getDefinition().getId().getNamespace(), getDefinition().getId().getPath()); + String mainKey = String.format("%s.machine.%s.tooltip", getDefinition().getId().getNamespace(), + getDefinition().getId().getPath()); if (LocalizationUtils.exist(mainKey)) { tooltips.add(0, Component.translatable(mainKey)); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/MultiblockMachineDefinition.java b/src/main/java/com/gregtechceu/gtceu/api/machine/MultiblockMachineDefinition.java index bf3520b7f8..0f836cd1af 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/MultiblockMachineDefinition.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/MultiblockMachineDefinition.java @@ -4,19 +4,19 @@ import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiPart; import com.gregtechceu.gtceu.api.pattern.BlockPattern; import com.gregtechceu.gtceu.api.pattern.MultiblockShapeInfo; -import com.mojang.datafixers.util.Function4; -import lombok.Getter; -import lombok.NonNull; -import lombok.Setter; -import net.minecraft.core.BlockPos; + import net.minecraft.core.Direction; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.state.BlockState; -import org.apache.commons.lang3.function.TriFunction; +import lombok.Getter; +import lombok.NonNull; +import lombok.Setter; +import org.apache.commons.lang3.function.TriFunction; import org.jetbrains.annotations.Nullable; + import java.util.*; import java.util.function.BiConsumer; import java.util.function.Supplier; @@ -27,7 +27,9 @@ * @implNote MultiblockMachineDefinition */ public class MultiblockMachineDefinition extends MachineDefinition { - @Getter @Setter + + @Getter + @Setter private boolean generator; @Setter @Getter @@ -43,9 +45,11 @@ public class MultiblockMachineDefinition extends MachineDefinition { @Setter @Getter private Comparator partSorter; - @Getter @Setter + @Getter + @Setter private TriFunction partAppearance; - @Getter @Setter + @Getter + @Setter private BiConsumer> additionalDisplay; protected MultiblockMachineDefinition(ResourceLocation id) { @@ -64,7 +68,8 @@ public List getMatchingShapes() { return repetitionDFS(structurePattern, new ArrayList<>(), aisleRepetitions, new Stack<>()); } - private List repetitionDFS(BlockPattern pattern, List pages, int[][] aisleRepetitions, Stack repetitionStack) { + private List repetitionDFS(BlockPattern pattern, List pages, + int[][] aisleRepetitions, Stack repetitionStack) { if (repetitionStack.size() == aisleRepetitions.length) { int[] repetition = new int[repetitionStack.size()]; for (int i = 0; i < repetitionStack.size(); i++) { @@ -72,7 +77,8 @@ private List repetitionDFS(BlockPattern pattern, List 0) { - var maxParallel = (int)(Math.min(generator.getOverclockVoltage(), GTValues.V[generator.getOverclockTier()]) / EUt); + var maxParallel = (int) (Math.min(generator.getOverclockVoltage(), + GTValues.V[generator.getOverclockTier()]) / EUt); return GTRecipeModifiers.fastParallel(generator, recipe, maxParallel, false).getFirst(); } } @@ -97,34 +103,38 @@ public boolean canVoidRecipeOutputs(RecipeCapability capability) { } ////////////////////////////////////// - //*********** GUI ***********// + // *********** GUI ***********// ////////////////////////////////////// @SuppressWarnings("UnstableApiUsage") - public static BiFunction EDITABLE_UI_CREATOR = Util.memoize((path, recipeType)-> new EditableMachineUI("generator", path, () -> { - WidgetGroup template = recipeType.getRecipeUI().createEditableUITemplate(false, false).createDefault(); - WidgetGroup group = new WidgetGroup(0, 0, template.getSize().width + 4 + 8, template.getSize().height + 8); - Size size = group.getSize(); - template.setSelfPosition(new Position( - (size.width - 4 - template.getSize().width) / 2 + 4, - (size.height - template.getSize().height) / 2)); - group.addWidget(template); - return group; - }, (template, machine) -> { - if (machine instanceof SimpleGeneratorMachine generatorMachine) { - var storages = Tables.newCustomTable(new EnumMap<>(IO.class), LinkedHashMap, Object>::new); - storages.put(IO.IN, ItemRecipeCapability.CAP, generatorMachine.importItems.storage); - storages.put(IO.OUT, ItemRecipeCapability.CAP, generatorMachine.exportItems.storage); - storages.put(IO.IN, FluidRecipeCapability.CAP, generatorMachine.importFluids); - storages.put(IO.OUT, FluidRecipeCapability.CAP, generatorMachine.exportFluids); - - generatorMachine.getRecipeType().getRecipeUI().createEditableUITemplate(false, false).setupUI(template, - new GTRecipeTypeUI.RecipeHolder(generatorMachine.recipeLogic::getProgressPercent, - storages, - new CompoundTag(), - Collections.emptyList(), - false, false)); - createEnergyBar().setupUI(template, generatorMachine); - } - })); + public static BiFunction EDITABLE_UI_CREATOR = Util + .memoize((path, recipeType) -> new EditableMachineUI("generator", path, () -> { + WidgetGroup template = recipeType.getRecipeUI().createEditableUITemplate(false, false).createDefault(); + WidgetGroup group = new WidgetGroup(0, 0, template.getSize().width + 4 + 8, + template.getSize().height + 8); + Size size = group.getSize(); + template.setSelfPosition(new Position( + (size.width - 4 - template.getSize().width) / 2 + 4, + (size.height - template.getSize().height) / 2)); + group.addWidget(template); + return group; + }, (template, machine) -> { + if (machine instanceof SimpleGeneratorMachine generatorMachine) { + var storages = Tables.newCustomTable(new EnumMap<>(IO.class), + LinkedHashMap, Object>::new); + storages.put(IO.IN, ItemRecipeCapability.CAP, generatorMachine.importItems.storage); + storages.put(IO.OUT, ItemRecipeCapability.CAP, generatorMachine.exportItems.storage); + storages.put(IO.IN, FluidRecipeCapability.CAP, generatorMachine.importFluids); + storages.put(IO.OUT, FluidRecipeCapability.CAP, generatorMachine.exportFluids); + + generatorMachine.getRecipeType().getRecipeUI().createEditableUITemplate(false, false).setupUI( + template, + new GTRecipeTypeUI.RecipeHolder(generatorMachine.recipeLogic::getProgressPercent, + storages, + new CompoundTag(), + Collections.emptyList(), + false, false)); + createEnergyBar().setupUI(template, generatorMachine); + } + })); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/SimpleTieredMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/SimpleTieredMachine.java index d1b1fccf00..aa2375cb9a 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/SimpleTieredMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/SimpleTieredMachine.java @@ -1,6 +1,5 @@ package com.gregtechceu.gtceu.api.machine; -import com.google.common.collect.Tables; import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.capability.GTCapabilityHelper; import com.gregtechceu.gtceu.api.capability.recipe.*; @@ -16,10 +15,10 @@ import com.gregtechceu.gtceu.api.machine.trait.NotifiableItemStackHandler; import com.gregtechceu.gtceu.api.recipe.GTRecipeType; import com.gregtechceu.gtceu.api.recipe.ui.GTRecipeTypeUI; -import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; import com.gregtechceu.gtceu.common.item.IntCircuitBehaviour; import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.data.lang.LangHandler; + import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; import com.lowdragmc.lowdraglib.gui.widget.SlotWidget; @@ -30,12 +29,10 @@ import com.lowdragmc.lowdraglib.syncdata.ISubscription; 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 com.mojang.blaze3d.MethodsReturnNonnullByDefault; -import it.unimi.dsi.fastutil.ints.Int2LongFunction; -import lombok.Getter; -import lombok.Setter; + import net.minecraft.Util; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -44,51 +41,74 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.server.TickTask; import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.Block; -import net.minecraft.world.phys.BlockHitResult; + +import com.google.common.collect.Tables; +import com.mojang.blaze3d.MethodsReturnNonnullByDefault; +import it.unimi.dsi.fastutil.ints.Int2LongFunction; +import lombok.Getter; +import lombok.Setter; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.*; import java.util.function.BiFunction; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author KilaBash * @date 2023/2/19 * @implNote SimpleMachine - * All simple single machines are implemented here. + * All simple single machines are implemented here. */ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class SimpleTieredMachine extends WorkableTieredMachine implements IAutoOutputBoth, IFancyUIMachine { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(SimpleTieredMachine.class, WorkableTieredMachine.MANAGED_FIELD_HOLDER); - @Persisted @DescSynced @RequireRerender + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(SimpleTieredMachine.class, + WorkableTieredMachine.MANAGED_FIELD_HOLDER); + + @Persisted + @DescSynced + @RequireRerender protected Direction outputFacingItems; - @Persisted @DescSynced @RequireRerender + @Persisted + @DescSynced + @RequireRerender protected Direction outputFacingFluids; - @Getter @Persisted @DescSynced @RequireRerender + @Getter + @Persisted + @DescSynced + @RequireRerender protected boolean autoOutputItems; - @Getter @Persisted @DescSynced @RequireRerender + @Getter + @Persisted + @DescSynced + @RequireRerender protected boolean autoOutputFluids; - @Getter @Setter @Persisted + @Getter + @Setter + @Persisted protected boolean allowInputFromOutputSideItems; - @Getter @Setter @Persisted + @Getter + @Setter + @Persisted protected boolean allowInputFromOutputSideFluids; - @Getter @Persisted + @Getter + @Persisted protected final ItemStackTransfer chargerInventory; - @Getter @Persisted + @Getter + @Persisted protected final NotifiableItemStackHandler circuitInventory; @Nullable protected TickableSubscription autoOutputSubs, batterySubs; @Nullable protected ISubscription exportItemSubs, exportFluidSubs, energySubs; - public SimpleTieredMachine(IMachineBlockEntity holder, int tier, Int2LongFunction tankScalingFunction, Object... args) { + public SimpleTieredMachine(IMachineBlockEntity holder, int tier, Int2LongFunction tankScalingFunction, + Object... args) { super(holder, tier, tankScalingFunction, args); this.outputFacingItems = hasFrontFacing() ? getFrontFacing().getOpposite() : Direction.UP; this.outputFacingFluids = outputFacingItems; @@ -97,7 +117,7 @@ public SimpleTieredMachine(IMachineBlockEntity holder, int tier, Int2LongFunctio } ////////////////////////////////////// - //***** Initialization ******// + // ***** Initialization ******// ////////////////////////////////////// @Override public ManagedFieldHolder getFieldHolder() { @@ -111,11 +131,12 @@ protected ItemStackTransfer createChargerItemHandler(Object... args) { } protected NotifiableItemStackHandler createCircuitItemHandler(Object... args) { - return new NotifiableItemStackHandler(this, 1, IO.IN, IO.NONE).setFilter(IntCircuitBehaviour::isIntegratedCircuit); + return new NotifiableItemStackHandler(this, 1, IO.IN, IO.NONE) + .setFilter(IntCircuitBehaviour::isIntegratedCircuit); } ////////////////////////////////////// - //***** Initialization ******// + // ***** Initialization ******// ////////////////////////////////////// @Override public void onLoad() { @@ -152,7 +173,7 @@ public void onUnload() { } ////////////////////////////////////// - //******* Auto Output *******// + // ******* Auto Output *******// ////////////////////////////////////// @Override @@ -222,11 +243,12 @@ public void onNeighborChanged(Block block, BlockPos fromPos, boolean isMoving) { protected void updateAutoOutputSubscription() { var outputFacingItems = getOutputFacingItems(); var outputFacingFluids = getOutputFacingFluids(); - if ((isAutoOutputItems() && !exportItems.isEmpty()) && outputFacingItems != null - && ItemTransferHelper.getItemTransfer(getLevel(), getPos().relative(outputFacingItems), outputFacingItems.getOpposite()) != null - || - (isAutoOutputFluids() && !exportFluids.isEmpty()) && outputFacingFluids != null - && FluidTransferHelper.getFluidTransfer(getLevel(), getPos().relative(outputFacingFluids), outputFacingFluids.getOpposite()) != null) { + if ((isAutoOutputItems() && !exportItems.isEmpty()) && outputFacingItems != null && + ItemTransferHelper.getItemTransfer(getLevel(), getPos().relative(outputFacingItems), + outputFacingItems.getOpposite()) != null || + (isAutoOutputFluids() && !exportFluids.isEmpty()) && outputFacingFluids != null && + FluidTransferHelper.getFluidTransfer(getLevel(), getPos().relative(outputFacingFluids), + outputFacingFluids.getOpposite()) != null) { autoOutputSubs = subscribeServerTick(autoOutputSubs, this::autoOutput); } else if (autoOutputSubs != null) { autoOutputSubs.unsubscribe(); @@ -270,7 +292,7 @@ public boolean isFacingValid(Direction facing) { } ////////////////////////////////////// - //********** MISC ***********// + // ********** MISC ***********// ////////////////////////////////////// @Override public void onDrops(List drops, Player entity) { @@ -282,7 +304,7 @@ public void onDrops(List drops, Player entity) { } ////////////////////////////////////// - //*********** GUI ***********// + // *********** GUI ***********// ////////////////////////////////////// @Override @@ -292,43 +314,46 @@ public void attachConfigurators(ConfiguratorPanel configuratorPanel) { } @SuppressWarnings("UnstableApiUsage") - public static BiFunction EDITABLE_UI_CREATOR = Util.memoize((path, recipeType) -> new EditableMachineUI("simple", path, () -> { - WidgetGroup template = recipeType.getRecipeUI().createEditableUITemplate(false, false).createDefault(); - SlotWidget batterySlot = createBatterySlot().createDefault(); - WidgetGroup group = new WidgetGroup(0, 0, template.getSize().width, Math.max(template.getSize().height, 78)); - template.setSelfPosition(new Position(0, (group.getSize().height - template.getSize().height) / 2)); - batterySlot.setSelfPosition(new Position(group.getSize().width / 2 - 9, group.getSize().height - 18)); - group.addWidget(batterySlot); - group.addWidget(template); - - // TODO fix this. -// if (ConfigHolder.INSTANCE.machines.ghostCircuit) { -// SlotWidget circuitSlot = createCircuitConfigurator().createDefault(); -// circuitSlot.setSelfPosition(new Position(120, 62)); -// group.addWidget(circuitSlot); -// } - - return group; - }, (template, machine) -> { - if (machine instanceof SimpleTieredMachine tieredMachine) { - var storages = Tables.newCustomTable(new EnumMap<>(IO.class), LinkedHashMap, Object>::new); - storages.put(IO.IN, ItemRecipeCapability.CAP, tieredMachine.importItems.storage); - storages.put(IO.OUT, ItemRecipeCapability.CAP, tieredMachine.exportItems.storage); - storages.put(IO.IN, FluidRecipeCapability.CAP, tieredMachine.importFluids); - storages.put(IO.OUT, FluidRecipeCapability.CAP, tieredMachine.exportFluids); - storages.put(IO.IN, CWURecipeCapability.CAP, tieredMachine.importComputation); - storages.put(IO.OUT, CWURecipeCapability.CAP, tieredMachine.exportComputation); - - tieredMachine.getRecipeType().getRecipeUI().createEditableUITemplate(false, false).setupUI(template, - new GTRecipeTypeUI.RecipeHolder(tieredMachine.recipeLogic::getProgressPercent, - storages, - new CompoundTag(), - Collections.emptyList(), - false, false)); - createBatterySlot().setupUI(template, tieredMachine); -// createCircuitConfigurator().setupUI(template, tieredMachine); - } - })); + public static BiFunction EDITABLE_UI_CREATOR = Util + .memoize((path, recipeType) -> new EditableMachineUI("simple", path, () -> { + WidgetGroup template = recipeType.getRecipeUI().createEditableUITemplate(false, false).createDefault(); + SlotWidget batterySlot = createBatterySlot().createDefault(); + WidgetGroup group = new WidgetGroup(0, 0, template.getSize().width, + Math.max(template.getSize().height, 78)); + template.setSelfPosition(new Position(0, (group.getSize().height - template.getSize().height) / 2)); + batterySlot.setSelfPosition(new Position(group.getSize().width / 2 - 9, group.getSize().height - 18)); + group.addWidget(batterySlot); + group.addWidget(template); + + // TODO fix this. + // if (ConfigHolder.INSTANCE.machines.ghostCircuit) { + // SlotWidget circuitSlot = createCircuitConfigurator().createDefault(); + // circuitSlot.setSelfPosition(new Position(120, 62)); + // group.addWidget(circuitSlot); + // } + + return group; + }, (template, machine) -> { + if (machine instanceof SimpleTieredMachine tieredMachine) { + var storages = Tables.newCustomTable(new EnumMap<>(IO.class), + LinkedHashMap, Object>::new); + storages.put(IO.IN, ItemRecipeCapability.CAP, tieredMachine.importItems.storage); + storages.put(IO.OUT, ItemRecipeCapability.CAP, tieredMachine.exportItems.storage); + storages.put(IO.IN, FluidRecipeCapability.CAP, tieredMachine.importFluids); + storages.put(IO.OUT, FluidRecipeCapability.CAP, tieredMachine.exportFluids); + storages.put(IO.IN, CWURecipeCapability.CAP, tieredMachine.importComputation); + storages.put(IO.OUT, CWURecipeCapability.CAP, tieredMachine.exportComputation); + + tieredMachine.getRecipeType().getRecipeUI().createEditableUITemplate(false, false).setupUI(template, + new GTRecipeTypeUI.RecipeHolder(tieredMachine.recipeLogic::getProgressPercent, + storages, + new CompoundTag(), + Collections.emptyList(), + false, false)); + createBatterySlot().setupUI(template, tieredMachine); + // createCircuitConfigurator().setupUI(template, tieredMachine); + } + })); /** * Create an energy bar widget. @@ -342,7 +367,8 @@ protected static EditableUI createBatterySlot() slotWidget.setHandlerSlot(machine.chargerInventory, 0); slotWidget.setCanPutItems(true); slotWidget.setCanTakeItems(true); - slotWidget.setHoverTooltips(LangHandler.getMultiLang("gtceu.gui.charger_slot.tooltip", GTValues.VNF[machine.getTier()], GTValues.VNF[machine.getTier()]).toArray(Component[]::new)); + slotWidget.setHoverTooltips(LangHandler.getMultiLang("gtceu.gui.charger_slot.tooltip", + GTValues.VNF[machine.getTier()], GTValues.VNF[machine.getTier()]).toArray(Component[]::new)); }); } @@ -358,7 +384,8 @@ protected static EditableUI createC slotWidget.setCircuitInventory(machine.circuitInventory); slotWidget.setCanPutItems(false); slotWidget.setCanTakeItems(false); - slotWidget.setHoverTooltips(LangHandler.getMultiLang("gtceu.gui.configurator_slot.tooltip").toArray(Component[]::new)); + slotWidget.setHoverTooltips( + LangHandler.getMultiLang("gtceu.gui.configurator_slot.tooltip").toArray(Component[]::new)); }); } @@ -368,7 +395,7 @@ protected IGuiTexture getCircuitSlotOverlay() { } ////////////////////////////////////// - //******* Rendering ********// + // ******* Rendering ********// ////////////////////////////////////// @Override public ResourceTexture sideTips(Player player, Set toolTypes, Direction side) { diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/TieredEnergyMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/TieredEnergyMachine.java index 9a6aff7961..bca7399d5e 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/TieredEnergyMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/TieredEnergyMachine.java @@ -7,6 +7,7 @@ import com.gregtechceu.gtceu.api.machine.feature.ITieredMachine; import com.gregtechceu.gtceu.api.machine.trait.NotifiableEnergyContainer; import com.gregtechceu.gtceu.config.ConfigHolder; + import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.texture.ProgressTexture; import com.lowdragmc.lowdraglib.gui.widget.ProgressWidget; @@ -14,6 +15,7 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.util.Mth; @@ -27,8 +29,11 @@ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class TieredEnergyMachine extends TieredMachine implements ITieredMachine, IExplosionMachine { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(TieredEnergyMachine.class, MetaMachine.MANAGED_FIELD_HOLDER); - @Persisted @DescSynced + + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(TieredEnergyMachine.class, + MetaMachine.MANAGED_FIELD_HOLDER); + @Persisted + @DescSynced public final NotifiableEnergyContainer energyContainer; protected TickableSubscription explosionSubs; protected ISubscription energyListener; @@ -39,7 +44,7 @@ public TieredEnergyMachine(IMachineBlockEntity holder, int tier, Object... args) } ////////////////////////////////////// - //***** Initialization ******// + // ***** Initialization ******// ////////////////////////////////////// @Override public ManagedFieldHolder getFieldHolder() { @@ -75,11 +80,12 @@ public void onUnload() { } ////////////////////////////////////// - //******** Explosion ********// + // ******** Explosion ********// ////////////////////////////////////// protected void updateExplosionSubscription() { - if (ConfigHolder.INSTANCE.machines.doTerrainExplosion && shouldWeatherOrTerrainExplosion() && energyContainer.getEnergyStored() > 0) { + if (ConfigHolder.INSTANCE.machines.doTerrainExplosion && shouldWeatherOrTerrainExplosion() && + energyContainer.getEnergyStored() > 0) { explosionSubs = subscribeServerTick(explosionSubs, this::checkExplosion); } else if (explosionSubs != null) { explosionSubs.unsubscribe(); @@ -93,7 +99,7 @@ protected void checkExplosion() { } ////////////////////////////////////// - //********** MISC ***********// + // ********** MISC ***********// ////////////////////////////////////// @Override public int getAnalogOutputSignal() { @@ -134,8 +140,8 @@ protected static EditableUI createEnergyBar progressBar.setBackground(GuiTextures.ENERGY_BAR_BACKGROUND); return progressBar; }, (progressBar, machine) -> { - progressBar.setProgressSupplier(() -> machine.energyContainer.getEnergyStored() * 1d / machine.energyContainer.getEnergyCapacity()); + progressBar.setProgressSupplier( + () -> machine.energyContainer.getEnergyStored() * 1d / machine.energyContainer.getEnergyCapacity()); }); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/TieredMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/TieredMachine.java index 065189449a..802f23655a 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/TieredMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/TieredMachine.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.api.machine; import com.gregtechceu.gtceu.api.machine.feature.ITieredMachine; + import lombok.Getter; /** @@ -17,5 +18,4 @@ public TieredMachine(IMachineBlockEntity holder, int tier) { super(holder); this.tier = tier; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/WorkableTieredMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/WorkableTieredMachine.java index b5d82e3a16..a21fff6c10 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/WorkableTieredMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/WorkableTieredMachine.java @@ -1,29 +1,33 @@ package com.gregtechceu.gtceu.api.machine; -import com.google.common.collect.Table; -import com.google.common.collect.Tables; import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.capability.recipe.*; import com.gregtechceu.gtceu.api.machine.feature.*; import com.gregtechceu.gtceu.api.machine.trait.*; import com.gregtechceu.gtceu.api.recipe.GTRecipeType; import com.gregtechceu.gtceu.utils.GTUtil; + import com.lowdragmc.lowdraglib.syncdata.ISubscription; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; + +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; + +import com.google.common.collect.Table; +import com.google.common.collect.Tables; import com.mojang.blaze3d.MethodsReturnNonnullByDefault; import it.unimi.dsi.fastutil.ints.Int2LongFunction; import lombok.Getter; import lombok.Setter; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.ItemStack; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.jetbrains.annotations.NotNull; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.*; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author KilaBash * @date 2023/2/19 @@ -31,19 +35,27 @@ */ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault -public abstract class WorkableTieredMachine extends TieredEnergyMachine implements IRecipeLogicMachine, IMachineModifyDrops, IMufflableMachine, IOverclockMachine { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(WorkableTieredMachine.class, TieredEnergyMachine.MANAGED_FIELD_HOLDER); +public abstract class WorkableTieredMachine extends TieredEnergyMachine implements IRecipeLogicMachine, + IMachineModifyDrops, IMufflableMachine, IOverclockMachine { + + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(WorkableTieredMachine.class, + TieredEnergyMachine.MANAGED_FIELD_HOLDER); @Getter - @Persisted @DescSynced + @Persisted + @DescSynced public final RecipeLogic recipeLogic; @Getter public final GTRecipeType[] recipeTypes; - @Getter @Setter @Persisted + @Getter + @Setter + @Persisted public int activeRecipeType; @Getter public final Int2LongFunction tankScalingFunction; - @Nullable @Getter @Setter + @Nullable + @Getter + @Setter private ICleanroomProvider cleanroom; @Persisted public final NotifiableItemStackHandler importItems; @@ -59,14 +71,19 @@ public abstract class WorkableTieredMachine extends TieredEnergyMachine implemen public final NotifiableComputationContainer exportComputation; @Getter protected final Table, List>> capabilitiesProxy; - @Persisted @Getter + @Persisted + @Getter protected int overclockTier; protected final List traitSubscriptions; - @Persisted @DescSynced @Getter @Setter + @Persisted + @DescSynced + @Getter + @Setter protected boolean isMuffled; protected boolean previouslyMuffled = true; - public WorkableTieredMachine(IMachineBlockEntity holder, int tier, Int2LongFunction tankScalingFunction, Object... args) { + public WorkableTieredMachine(IMachineBlockEntity holder, int tier, Int2LongFunction tankScalingFunction, + Object... args) { super(holder, tier, args); this.overclockTier = getMaxOverclockTier(); this.recipeTypes = getDefinition().getRecipeTypes(); @@ -84,7 +101,7 @@ public WorkableTieredMachine(IMachineBlockEntity holder, int tier, Int2LongFunct } ////////////////////////////////////// - //***** Initialization ******// + // ***** Initialization ******// ////////////////////////////////////// @Override public ManagedFieldHolder getFieldHolder() { @@ -99,6 +116,7 @@ protected NotifiableEnergyContainer createEnergyContainer(Object... args) { tierVoltage * 64L, tierVoltage, getMaxInputOutputAmperage()); } else { return new NotifiableEnergyContainer(this, tierVoltage * 64L, tierVoltage, 2, 0L, 0L) { + @Override public long getInputAmperage() { if (getEnergyCapacity() / 2 > getEnergyStored() && recipeLogic.isActive()) { @@ -119,11 +137,13 @@ protected NotifiableItemStackHandler createExportItemHandler(Object... args) { } protected NotifiableFluidTank createImportFluidHandler(Object... args) { - return new NotifiableFluidTank(this, getRecipeType().getMaxInputs(FluidRecipeCapability.CAP), this.tankScalingFunction.apply(this.getTier()), IO.IN); + return new NotifiableFluidTank(this, getRecipeType().getMaxInputs(FluidRecipeCapability.CAP), + this.tankScalingFunction.apply(this.getTier()), IO.IN); } protected NotifiableFluidTank createExportFluidHandler(Object... args) { - return new NotifiableFluidTank(this, getRecipeType().getMaxOutputs(FluidRecipeCapability.CAP), this.tankScalingFunction.apply(this.getTier()), IO.OUT); + return new NotifiableFluidTank(this, getRecipeType().getMaxOutputs(FluidRecipeCapability.CAP), + this.tankScalingFunction.apply(this.getTier()), IO.OUT); } protected NotifiableComputationContainer createImportComputationContainer(Object... args) { @@ -165,7 +185,7 @@ public void onUnload() { } ////////////////////////////////////// - //********** MISC ***********// + // ********** MISC ***********// ////////////////////////////////////// @Override @@ -180,7 +200,7 @@ public void onDrops(List drops, Player entity) { } ////////////////////////////////////// - //******** OVERCLOCK *********// + // ******** OVERCLOCK *********// ////////////////////////////////////// @Override @@ -203,11 +223,12 @@ public void setOverclockTier(int tier) { @Override public long getOverclockVoltage() { - return Math.min(GTValues.V[getOverclockTier()], Math.max(energyContainer.getInputVoltage(), energyContainer.getOutputVoltage())); + return Math.min(GTValues.V[getOverclockTier()], + Math.max(energyContainer.getInputVoltage(), energyContainer.getOutputVoltage())); } ////////////////////////////////////// - //****** RECIPE LOGIC *******// + // ****** RECIPE LOGIC *******// ////////////////////////////////////// @Override diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/fancyconfigurator/CircuitFancyConfigurator.java b/src/main/java/com/gregtechceu/gtceu/api/machine/fancyconfigurator/CircuitFancyConfigurator.java index 3bd0e1c3ca..c99f153ae6 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/fancyconfigurator/CircuitFancyConfigurator.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/fancyconfigurator/CircuitFancyConfigurator.java @@ -5,11 +5,13 @@ import com.gregtechceu.gtceu.common.item.IntCircuitBehaviour; import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.data.lang.LangHandler; + import com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup; import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.texture.ItemStackTexture; import com.lowdragmc.lowdraglib.gui.widget.*; import com.lowdragmc.lowdraglib.misc.ItemStackTransfer; + import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.world.item.ItemStack; @@ -25,6 +27,7 @@ * @implNote CircuitFancyConfigurator */ public class CircuitFancyConfigurator implements IFancyConfigurator { + final ItemStackTransfer circuitSlot; public CircuitFancyConfigurator(ItemStackTransfer circuitSlot) { @@ -41,14 +44,16 @@ public IGuiTexture getIcon() { if (IntCircuitBehaviour.isIntegratedCircuit(circuitSlot.getStackInSlot(0))) { return new ItemStackTexture(circuitSlot.getStackInSlot(0)); } - return new GuiTextureGroup(new ItemStackTexture(IntCircuitBehaviour.stack(0)), new ItemStackTexture(Items.BARRIER)); + return new GuiTextureGroup(new ItemStackTexture(IntCircuitBehaviour.stack(0)), + new ItemStackTexture(Items.BARRIER)); } @Override public Widget createConfigurator() { var group = new WidgetGroup(0, 0, 174, 132); group.addWidget(new LabelWidget(9, 8, "Programmed Circuit Configuration")); - group.addWidget(new SlotWidget(circuitSlot, 0, (group.getSize().width - 18) / 2, 20, !ConfigHolder.INSTANCE.machines.ghostCircuit, !ConfigHolder.INSTANCE.machines.ghostCircuit) + group.addWidget(new SlotWidget(circuitSlot, 0, (group.getSize().width - 18) / 2, 20, + !ConfigHolder.INSTANCE.machines.ghostCircuit, !ConfigHolder.INSTANCE.machines.ghostCircuit) .setBackground(new GuiTextureGroup(GuiTextures.SLOT, GuiTextures.INT_CIRCUIT_OVERLAY))); if (ConfigHolder.INSTANCE.machines.ghostCircuit) { group.addWidget(new ButtonWidget((group.getSize().width - 18) / 2, 20, 18, 18, IGuiTexture.EMPTY, @@ -60,10 +65,12 @@ public Widget createConfigurator() { })); } int idx = 0; - for(int x = 0; x <= 2; x++) { - for(int y = 0; y <= 8; y++) { + for (int x = 0; x <= 2; x++) { + for (int y = 0; y <= 8; y++) { int finalIdx = idx; - group.addWidget(new ButtonWidget(5 + (18 * y), 48 + (18 * x), 18, 18, new GuiTextureGroup(GuiTextures.SLOT, new ItemStackTexture(IntCircuitBehaviour.stack(finalIdx)).scale(16f / 18)), + group.addWidget(new ButtonWidget(5 + (18 * y), 48 + (18 * x), 18, 18, + new GuiTextureGroup(GuiTextures.SLOT, + new ItemStackTexture(IntCircuitBehaviour.stack(finalIdx)).scale(16f / 18)), clickData -> { if (!clickData.isRemote) { ItemStack stack = circuitSlot.getStackInSlot(0).copy(); @@ -79,9 +86,11 @@ public Widget createConfigurator() { idx++; } } - for(int x = 0; x <= 5; x++) { + for (int x = 0; x <= 5; x++) { int finalIdx = x + 27; - group.addWidget(new ButtonWidget(5 + (18 * x), 102, 18, 18, new GuiTextureGroup(GuiTextures.SLOT, new ItemStackTexture(IntCircuitBehaviour.stack(finalIdx)).scale(16f / 18)), + group.addWidget(new ButtonWidget(5 + (18 * x), 102, 18, 18, + new GuiTextureGroup(GuiTextures.SLOT, + new ItemStackTexture(IntCircuitBehaviour.stack(finalIdx)).scale(16f / 18)), clickData -> { if (!clickData.isRemote) { ItemStack stack = circuitSlot.getStackInSlot(0).copy(); @@ -101,7 +110,9 @@ public Widget createConfigurator() { @Override public List getTooltips() { var list = new ArrayList<>(IFancyConfigurator.super.getTooltips()); - list.addAll(Arrays.stream(LangHandler.getMultiLang("gtceu.gui.configurator_slot.tooltip").toArray(new MutableComponent[0])).toList()); + list.addAll(Arrays.stream( + LangHandler.getMultiLang("gtceu.gui.configurator_slot.tooltip").toArray(new MutableComponent[0])) + .toList()); return list; } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/fancyconfigurator/CombinedDirectionalFancyConfigurator.java b/src/main/java/com/gregtechceu/gtceu/api/machine/fancyconfigurator/CombinedDirectionalFancyConfigurator.java index 4b2bfbb594..5ebcecf74e 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/fancyconfigurator/CombinedDirectionalFancyConfigurator.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/fancyconfigurator/CombinedDirectionalFancyConfigurator.java @@ -12,27 +12,33 @@ import com.gregtechceu.gtceu.api.machine.MetaMachine; import com.gregtechceu.gtceu.api.machine.feature.IAutoOutputFluid; import com.gregtechceu.gtceu.api.machine.feature.IAutoOutputItem; + import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.utils.Size; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.network.chat.Component; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; + import java.util.ArrayList; import java.util.List; import java.util.Objects; import java.util.function.Function; import java.util.function.Supplier; +import javax.annotation.ParametersAreNonnullByDefault; + @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault public class CombinedDirectionalFancyConfigurator implements IFancyUIProvider { + private final List> configs; private final MetaMachine machine; - public CombinedDirectionalFancyConfigurator(List> configs, MetaMachine machine) { + public CombinedDirectionalFancyConfigurator(List> configs, + MetaMachine machine) { this.configs = configs; this.machine = machine; } @@ -41,10 +47,9 @@ public CombinedDirectionalFancyConfigurator(List>> CONFIG_HANDLERS = new ArrayList<>(); static { // Left side: - CONFIG_HANDLERS.add(machine -> machine instanceof IAutoOutputItem autoOutputItem && autoOutputItem.hasAutoOutputItem() ? () -> new AutoOutputItemConfigHandler(autoOutputItem) : null); - CONFIG_HANDLERS.add(machine -> machine instanceof IAutoOutputFluid autoOutputFluid && autoOutputFluid.hasAutoOutputFluid() ? () -> new AutoOutputFluidConfigHandler(autoOutputFluid) : null); + CONFIG_HANDLERS.add( + machine -> machine instanceof IAutoOutputItem autoOutputItem && autoOutputItem.hasAutoOutputItem() ? + () -> new AutoOutputItemConfigHandler(autoOutputItem) : null); + CONFIG_HANDLERS.add( + machine -> machine instanceof IAutoOutputFluid autoOutputFluid && autoOutputFluid.hasAutoOutputFluid() ? + () -> new AutoOutputFluidConfigHandler(autoOutputFluid) : null); // Right side: CONFIG_HANDLERS.add(machine -> () -> new CoverableConfigHandler(machine.getCoverContainer())); @@ -80,9 +89,9 @@ public static void registerConfigHandler(Function handler.apply(container)) - .filter(Objects::nonNull) - .toList(); + .map(handler -> handler.apply(container)) + .filter(Objects::nonNull) + .toList(); return configs.isEmpty() ? null : new CombinedDirectionalFancyConfigurator(configs, machine); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/fancyconfigurator/MachineModeFancyConfigurator.java b/src/main/java/com/gregtechceu/gtceu/api/machine/fancyconfigurator/MachineModeFancyConfigurator.java index 61abcf7d86..0e23cf3695 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/fancyconfigurator/MachineModeFancyConfigurator.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/fancyconfigurator/MachineModeFancyConfigurator.java @@ -5,12 +5,14 @@ import com.gregtechceu.gtceu.api.gui.fancy.IFancyUIProvider; import com.gregtechceu.gtceu.api.machine.feature.IRecipeLogicMachine; import com.gregtechceu.gtceu.common.data.GTItems; + import com.lowdragmc.lowdraglib.gui.editor.ColorPattern; import com.lowdragmc.lowdraglib.gui.texture.*; import com.lowdragmc.lowdraglib.gui.widget.ButtonWidget; import com.lowdragmc.lowdraglib.gui.widget.ImageWidget; import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; + import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; @@ -22,6 +24,7 @@ * @implNote MachineModeFancyConfigurator */ public class MachineModeFancyConfigurator implements IFancyUIProvider { + protected IRecipeLogicMachine machine; public MachineModeFancyConfigurator(IRecipeLogicMachine machine) { @@ -44,10 +47,14 @@ public Widget createMainPage(FancyMachineUIWidget widget) { group.setBackground(GuiTextures.BACKGROUND_INVERSE); for (int i = 0; i < machine.getRecipeTypes().length; i++) { int finalI = i; - group.addWidget(new ButtonWidget(2, 2 + i * 20, 136, 20, IGuiTexture.EMPTY, cd -> machine.setActiveRecipeType(finalI))); + group.addWidget(new ButtonWidget(2, 2 + i * 20, 136, 20, IGuiTexture.EMPTY, + cd -> machine.setActiveRecipeType(finalI))); group.addWidget(new ImageWidget(2, 2 + i * 20, 136, 20, - () -> new GuiTextureGroup(ResourceBorderTexture.BUTTON_COMMON.copy().setColor(machine.getActiveRecipeType() == finalI ? ColorPattern.CYAN.color : -1), - new TextTexture(machine.getRecipeTypes()[finalI].registryName.toLanguageKey()).setWidth(136).setType(TextTexture.TextType.ROLL)))); + () -> new GuiTextureGroup( + ResourceBorderTexture.BUTTON_COMMON.copy() + .setColor(machine.getActiveRecipeType() == finalI ? ColorPattern.CYAN.color : -1), + new TextTexture(machine.getRecipeTypes()[finalI].registryName.toLanguageKey()).setWidth(136) + .setType(TextTexture.TextType.ROLL)))); } return group; @@ -61,6 +68,7 @@ public List getTabTooltips() { } public class MachineModeConfigurator extends WidgetGroup { + public MachineModeConfigurator(int x, int y, int width, int height) { super(x, y, width, height); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/fancyconfigurator/OverclockFancyConfigurator.java b/src/main/java/com/gregtechceu/gtceu/api/machine/fancyconfigurator/OverclockFancyConfigurator.java index 862c60d86b..15b69fe97a 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/fancyconfigurator/OverclockFancyConfigurator.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/fancyconfigurator/OverclockFancyConfigurator.java @@ -5,6 +5,7 @@ import com.gregtechceu.gtceu.api.gui.fancy.IFancyConfigurator; import com.gregtechceu.gtceu.api.gui.widget.PredicatedButtonWidget; import com.gregtechceu.gtceu.api.machine.feature.IOverclockMachine; + import com.lowdragmc.lowdraglib.gui.editor.Icons; import com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup; import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; @@ -13,6 +14,7 @@ import com.lowdragmc.lowdraglib.gui.widget.ImageWidget; import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; + import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; @@ -28,6 +30,7 @@ * @implNote OverclockFancyConfigurator */ public class OverclockFancyConfigurator implements IFancyConfigurator { + protected IOverclockMachine overclockMachine; // runtime protected int currentTier; @@ -43,7 +46,8 @@ public Component getTitle() { @Override public IGuiTexture getIcon() { - return currentTier <= GTValues.UV ? GuiTextures.TIER[currentTier].copy().scale(1.2f) : new TextTexture(GTValues.VNF[this.currentTier]).setDropShadow(false); + return currentTier <= GTValues.UV ? GuiTextures.TIER[currentTier].copy().scale(1.2f) : + new TextTexture(GTValues.VNF[this.currentTier]).setDropShadow(false); } @Override @@ -76,23 +80,28 @@ public void readUpdateInfo(int id, FriendlyByteBuf buf) { @Override public Widget createConfigurator() { return new WidgetGroup(0, 0, 120, 40) { + final Map lightGroups = new HashMap<>(); @Override public void initWidget() { super.initWidget(); setBackground(GuiTextures.BACKGROUND_INVERSE); - addWidget(new PredicatedButtonWidget(5, 5, 10, 20, new GuiTextureGroup(GuiTextures.BUTTON, Icons.LEFT.copy().scale(0.7f)), cd -> { - if (!cd.isRemote) { - overclockMachine.setOverclockTier(currentTier - 1); - } - }, () -> currentTier > overclockMachine.getMinOverclockTier())); - addWidget(new ImageWidget(20, 5, 120 - 5 - 10 - 5 - 20, 20, () -> new GuiTextureGroup(GuiTextures.DISPLAY_FRAME, new TextTexture(GTValues.VNF[currentTier])))); - addWidget(new PredicatedButtonWidget(120 -5 - 10, 5, 10, 20, new GuiTextureGroup(GuiTextures.BUTTON, Icons.RIGHT.copy().scale(0.7f)), cd -> { - if (!cd.isRemote) { - overclockMachine.setOverclockTier(currentTier + 1); - } - }, () -> currentTier < overclockMachine.getMaxOverclockTier())); + addWidget(new PredicatedButtonWidget(5, 5, 10, 20, + new GuiTextureGroup(GuiTextures.BUTTON, Icons.LEFT.copy().scale(0.7f)), cd -> { + if (!cd.isRemote) { + overclockMachine.setOverclockTier(currentTier - 1); + } + }, () -> currentTier > overclockMachine.getMinOverclockTier())); + addWidget(new ImageWidget(20, 5, 120 - 5 - 10 - 5 - 20, 20, + () -> new GuiTextureGroup(GuiTextures.DISPLAY_FRAME, + new TextTexture(GTValues.VNF[currentTier])))); + addWidget(new PredicatedButtonWidget(120 - 5 - 10, 5, 10, 20, + new GuiTextureGroup(GuiTextures.BUTTON, Icons.RIGHT.copy().scale(0.7f)), cd -> { + if (!cd.isRemote) { + overclockMachine.setOverclockTier(currentTier + 1); + } + }, () -> currentTier < overclockMachine.getMaxOverclockTier())); } @Override @@ -121,7 +130,7 @@ private void updateLightButton(int min, int max) { } lightGroups.clear(); int x = 5; - for (int tier = min; tier <= max ; tier++) { + for (int tier = min; tier <= max; tier++) { int finalTier = tier; var lightGroup = new WidgetGroup(x, 27, 8, 8); lightGroup.addWidget(new ButtonWidget(0, 0, 8, 8, null, cd -> { @@ -129,7 +138,8 @@ private void updateLightButton(int min, int max) { overclockMachine.setOverclockTier(finalTier); } })); - lightGroup.addWidget(new ImageWidget(0, 0, 8, 8, () -> currentTier >= finalTier ? GuiTextures.LIGHT_ON : GuiTextures.LIGHT_OFF)); + lightGroup.addWidget(new ImageWidget(0, 0, 8, 8, + () -> currentTier >= finalTier ? GuiTextures.LIGHT_ON : GuiTextures.LIGHT_OFF)); lightGroups.put(tier, lightGroup); addWidget(lightGroup); x += 10; @@ -176,6 +186,9 @@ public void readUpdateInfo(int id, FriendlyByteBuf buffer) { @Override public List getTooltips() { - return List.of(getTitle(), Component.translatable("gtceu.gui.overclock.range", GTValues.VNF[overclockMachine.getMinOverclockTier()], GTValues.VNF[overclockMachine.getMaxOverclockTier()])); + return List.of(getTitle(), + Component.translatable("gtceu.gui.overclock.range", + GTValues.VNF[overclockMachine.getMinOverclockTier()], + GTValues.VNF[overclockMachine.getMaxOverclockTier()])); } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IAutoOutputFluid.java b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IAutoOutputFluid.java index ed91e3d867..9a00ff2c6c 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IAutoOutputFluid.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IAutoOutputFluid.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.api.machine.feature; import net.minecraft.core.Direction; + import org.jetbrains.annotations.Nullable; /** @@ -8,16 +9,14 @@ * @date 2023/3/2 * @implNote IAutoOutputItem */ -public interface IAutoOutputFluid extends IMachineFeature{ +public interface IAutoOutputFluid extends IMachineFeature { boolean isAutoOutputFluids(); void setAutoOutputFluids(boolean allow); - boolean isAllowInputFromOutputSideFluids(); - void setAllowInputFromOutputSideFluids(boolean allow); @Nullable diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IAutoOutputItem.java b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IAutoOutputItem.java index d9d60d8a57..c8c834a8be 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IAutoOutputItem.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IAutoOutputItem.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.api.machine.feature; import net.minecraft.core.Direction; + import org.jetbrains.annotations.Nullable; /** @@ -26,5 +27,4 @@ public interface IAutoOutputItem extends IMachineFeature { default boolean hasAutoOutputItem() { return true; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/ICleanroomProvider.java b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/ICleanroomProvider.java index 8fe172dba9..38379cf73f 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/ICleanroomProvider.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/ICleanroomProvider.java @@ -18,5 +18,4 @@ public interface ICleanroomProvider extends IMachineFeature { * @return whether the cleanroom is currently clean */ boolean isClean(); - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IDataInfoProvider.java b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IDataInfoProvider.java index 46490c6df4..da3d9a5f14 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IDataInfoProvider.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IDataInfoProvider.java @@ -1,12 +1,14 @@ package com.gregtechceu.gtceu.api.machine.feature; import com.gregtechceu.gtceu.common.item.PortableScannerBehavior; + import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Player; +import java.util.List; + import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.List; public interface IDataInfoProvider { diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IDropSaveMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IDropSaveMachine.java index 9625f82ce0..bf4eaabb80 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IDropSaveMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IDropSaveMachine.java @@ -20,6 +20,7 @@ default boolean saveBreak() { default boolean savePickClone() { return true; } + /** * Saves the contents of the block entity to a compound tag. * @@ -35,5 +36,4 @@ default void saveToItem(CompoundTag tag) { default void loadFromItem(CompoundTag tag) { self().holder.loadManagedPersistentData(tag); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IExhaustVentMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IExhaustVentMachine.java index d5ef61e6b4..3724918d84 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IExhaustVentMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IExhaustVentMachine.java @@ -3,6 +3,7 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.common.data.GTDamageTypes; import com.gregtechceu.gtceu.config.ConfigHolder; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.particles.ParticleTypes; @@ -15,6 +16,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.shapes.Shapes; + import org.jetbrains.annotations.NotNull; /** @@ -27,7 +29,8 @@ public interface IExhaustVentMachine extends IMachineFeature { /** * @return the direction the vent faces */ - @NotNull Direction getVentingDirection(); + @NotNull + Direction getVentingDirection(); /** * @return if venting is needed @@ -67,14 +70,15 @@ default boolean isVentingBlocked() { BlockPos ventingBlockPos = self().getPos().relative(ventingSide); BlockState state = level.getBlockState(ventingBlockPos); - return state.canOcclude() || Shapes.blockOccudes(state.getCollisionShape(level, ventingBlockPos), Shapes.block(), ventingSide.getOpposite()); + return state.canOcclude() || Shapes.blockOccudes(state.getCollisionShape(level, ventingBlockPos), + Shapes.block(), ventingSide.getOpposite()); } /** * Attempts to vent, if needed * * @param level the level containing the machine venting - * @param pos the position of the machine + * @param pos the position of the machine */ default void tryDoVenting(@NotNull Level level, @NotNull BlockPos pos) { if (isNeedsVenting() && !isVentingBlocked()) { @@ -97,7 +101,7 @@ default void tryDoVenting(@NotNull Level level, @NotNull BlockPos pos) { * Damages entities upon venting * * @param level the level containing the machine and entities - * @param pos the position of the machine venting + * @param pos the position of the machine venting */ default void doVentingDamage(@NotNull Level level, @NotNull BlockPos pos) { for (LivingEntity entity : level.getEntitiesOfClass(LivingEntity.class, @@ -105,9 +109,9 @@ default void doVentingDamage(@NotNull Level level, @NotNull BlockPos pos) { entity -> !(entity instanceof Player player) || !player.isSpectator() && !player.isCreative())) { entity.hurt(GTDamageTypes.HEAT.source(level), getVentingDamage()); // TODO ADVANCEMENT -// if (entity instanceof ServerPlayer) { -// AdvancementTriggers.STEAM_VENT_DEATH.trigger((ServerPlayer) entity); -// } + // if (entity instanceof ServerPlayer) { + // AdvancementTriggers.STEAM_VENT_DEATH.trigger((ServerPlayer) entity); + // } } } @@ -115,9 +119,9 @@ default void doVentingDamage(@NotNull Level level, @NotNull BlockPos pos) { * Create the particles for venting * * @param level the level containing the machine - * @param posX the x position to send particles to - * @param posY the y position to send particles to - * @param posZ the z position to send particles to + * @param posX the x position to send particles to + * @param posY the y position to send particles to + * @param posZ the z position to send particles to */ default void createVentingParticles(@NotNull Level level, double posX, double posY, double posZ) { Direction ventingDirection = getVentingDirection(); @@ -130,9 +134,9 @@ default void createVentingParticles(@NotNull Level level, double posX, double po ventingDirection.getStepZ() / 2.0, 0.1); } else { for (int i = 0; i < count; ++i) { - double d1 = level.random.nextGaussian() * (double)ventingDirection.getStepX() / 2.0; - double d3 = level.random.nextGaussian() * (double)ventingDirection.getStepY() / 2.0; - double d5 = level.random.nextGaussian() * (double)ventingDirection.getStepZ() / 2.0; + double d1 = level.random.nextGaussian() * (double) ventingDirection.getStepX() / 2.0; + double d3 = level.random.nextGaussian() * (double) ventingDirection.getStepY() / 2.0; + double d5 = level.random.nextGaussian() * (double) ventingDirection.getStepZ() / 2.0; double d6 = level.random.nextGaussian() * 0.1; double d7 = level.random.nextGaussian() * 0.1; double d8 = level.random.nextGaussian() * 0.1; @@ -145,16 +149,15 @@ default void createVentingParticles(@NotNull Level level, double posX, double po } } } - } /** * Play the venting sound * * @param level the level to play the sound in - * @param posX the x position to play the sound at - * @param posY the y position to play the sound at - * @param posZ the z position to play the sound at + * @param posX the x position to play the sound at + * @param posY the y position to play the sound at + * @param posZ the z position to play the sound at */ default void playVentingSound(@NotNull Level level, double posX, double posY, double posZ) { level.playSound(null, posX, posY, posZ, SoundEvents.LAVA_EXTINGUISH, SoundSource.BLOCKS, 1F, 1F); diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IExplosionMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IExplosionMachine.java index 0bd28f04f6..a7054b955e 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IExplosionMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IExplosionMachine.java @@ -3,6 +3,7 @@ import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.utils.GTUtil; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.level.Level; @@ -12,13 +13,14 @@ * @author KilaBash * @date 2023/2/18 * @implNote IExplosionMachine - * A machine which may cause explosion. e.g. whether, water around + * A machine which may cause explosion. e.g. whether, water around */ public interface IExplosionMachine extends IMachineFeature { /** * should be called per tick. - * @param explosionPower explosion level + * + * @param explosionPower explosion level * @param additionalFireChance fire chance */ default void checkWeatherOrTerrainExplosion(float explosionPower, double additionalFireChance) { @@ -36,7 +38,8 @@ default void checkWeatherOrTerrainExplosion(float explosionPower, double additio } } if (GTValues.RNG.nextInt(1000) == 0) { - if (level.isRainingAt(pos) || level.isRainingAt(pos.east()) || level.isRainingAt(pos.west()) || level.isRainingAt(pos.north()) || level.isRainingAt(pos.south())) { + if (level.isRainingAt(pos) || level.isRainingAt(pos.east()) || level.isRainingAt(pos.west()) || + level.isRainingAt(pos.north()) || level.isRainingAt(pos.south())) { if (level.isThundering() && GTValues.RNG.nextInt(3) == 0) { doExplosion(explosionPower); } else if (GTValues.RNG.nextInt(10) == 0) { @@ -55,7 +58,8 @@ default void doExplosion(BlockPos pos, float explosionPower) { var level = machine.getLevel(); level.removeBlock(pos, false); level.explode(null, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, - explosionPower, ConfigHolder.INSTANCE.machines.doesExplosionDamagesTerrain ? Level.ExplosionInteraction.BLOCK : Level.ExplosionInteraction.NONE); + explosionPower, ConfigHolder.INSTANCE.machines.doesExplosionDamagesTerrain ? + Level.ExplosionInteraction.BLOCK : Level.ExplosionInteraction.NONE); } default void setOnFire(double additionalFireChance) { diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IFancyUIMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IFancyUIMachine.java index 0e2504bf50..97ecb6fcd6 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IFancyUIMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IFancyUIMachine.java @@ -3,10 +3,10 @@ import com.gregtechceu.gtceu.api.capability.IControllable; import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.api.gui.fancy.*; -import com.gregtechceu.gtceu.api.gui.widget.directional.CombinedDirectionalConfigurator; import com.gregtechceu.gtceu.api.machine.fancyconfigurator.CombinedDirectionalFancyConfigurator; import com.gregtechceu.gtceu.api.machine.fancyconfigurator.MachineModeFancyConfigurator; import com.gregtechceu.gtceu.api.machine.fancyconfigurator.OverclockFancyConfigurator; + import com.lowdragmc.lowdraglib.gui.modular.ModularUI; import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.texture.ItemStackTexture; @@ -16,12 +16,14 @@ import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.utils.BlockInfo; import com.lowdragmc.lowdraglib.utils.TrackedDummyWorld; + import net.minecraft.client.gui.GuiGraphics; import net.minecraft.core.BlockPos; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Player; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + import org.jetbrains.annotations.NotNull; import java.util.ArrayList; @@ -33,6 +35,7 @@ * @implNote IFancyUIMachine */ public interface IFancyUIMachine extends IUIMachine, IFancyUIProvider { + @Override default ModularUI createUI(Player entityPlayer) { return new ModularUI(176, 166, this, entityPlayer).widget(new FancyMachineUIWidget(this, 176, 166)); @@ -65,13 +68,16 @@ default Widget createUIWidget() { TrackedDummyWorld world = new TrackedDummyWorld(); world.addBlock(BlockPos.ZERO, BlockInfo.fromBlockState(self().getBlockState())); SceneWidget sceneWidget = new SceneWidget(0, 0, 100, 100, world) { + @Override @OnlyIn(Dist.CLIENT) - public void drawInBackground(@NotNull GuiGraphics graphics, int mouseX, int mouseY, float partialTicks) { + public void drawInBackground(@NotNull GuiGraphics graphics, int mouseX, int mouseY, + float partialTicks) { // AUTO ROTATION if (renderer != null) { this.rotationPitch = (partialTicks + getGui().getTickCount()) * 2; - renderer.setCameraLookAt(this.center, 0.1f, Math.toRadians(this.rotationPitch), Math.toRadians(this.rotationYaw)); + renderer.setCameraLookAt(this.center, 0.1f, Math.toRadians(this.rotationPitch), + Math.toRadians(this.rotationYaw)); } super.drawInBackground(graphics, mouseX, mouseY, partialTicks); } @@ -114,8 +120,8 @@ default void attachConfigurators(ConfiguratorPanel configuratorPanel) { GuiTextures.BUTTON_POWER.getSubTexture(0, 0.5, 1, 0.5), controllable::isWorkingEnabled, (clickData, pressed) -> controllable.setWorkingEnabled(pressed)) .setTooltipsSupplier(pressed -> List.of( - Component.translatable(pressed ? "behaviour.soft_hammer.enabled" : "behaviour.soft_hammer.disabled") - ))); + Component.translatable( + pressed ? "behaviour.soft_hammer.enabled" : "behaviour.soft_hammer.disabled")))); } if (this instanceof IOverclockMachine overclockMachine) { configuratorPanel.attachConfigurators(new OverclockFancyConfigurator(overclockMachine)); @@ -125,7 +131,8 @@ default void attachConfigurators(ConfiguratorPanel configuratorPanel) { @Override default void attachTooltips(TooltipsPanel tooltipsPanel) { tooltipsPanel.attachTooltips(self()); - self().getTraits().stream().filter(IFancyTooltip.class::isInstance).map(IFancyTooltip.class::cast).forEach(tooltipsPanel::attachTooltips); + self().getTraits().stream().filter(IFancyTooltip.class::isInstance).map(IFancyTooltip.class::cast) + .forEach(tooltipsPanel::attachTooltips); } @Override diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IInteractedMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IInteractedMachine.java index 42fe1a9e7f..c278cad1f9 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IInteractedMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IInteractedMachine.java @@ -17,20 +17,22 @@ public interface IInteractedMachine extends IMachineFeature { /** - * Basically a hook from block {@link net.minecraft.world.level.block.state.BlockBehaviour#use(BlockState, Level, BlockPos, Player, InteractionHand, BlockHitResult)} + * Basically a hook from block + * {@link net.minecraft.world.level.block.state.BlockBehaviour#use(BlockState, Level, BlockPos, Player, InteractionHand, BlockHitResult)} *
* Right-Click */ - default InteractionResult onUse(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { + default InteractionResult onUse(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, + BlockHitResult hit) { return InteractionResult.PASS; } /** * Left-Click + * * @return cancel (true) / keep (false) further processing */ default boolean onLeftClick(Player player, Level world, InteractionHand hand, BlockPos pos, Direction direction) { return false; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IMachineFeature.java b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IMachineFeature.java index 5d3209ec73..f40f4aab86 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IMachineFeature.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IMachineFeature.java @@ -8,8 +8,8 @@ * @implNote IMachine */ public interface IMachineFeature { + default MetaMachine self() { return (MetaMachine) this; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IMachineLife.java b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IMachineLife.java index 960a32a9e1..b99210226d 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IMachineLife.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IMachineLife.java @@ -1,11 +1,13 @@ package com.gregtechceu.gtceu.api.machine.feature; import com.gregtechceu.gtceu.api.block.MetaMachineBlock; + import net.minecraft.core.BlockPos; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockState; + import org.jetbrains.annotations.Nullable; /** @@ -19,15 +21,11 @@ public interface IMachineLife extends IMachineFeature { * Called when machine removed. {@link MetaMachineBlock#onRemove(BlockState, Level, BlockPos, BlockState, boolean)} * Only if block has changed will it be called. Ignore State changes. */ - default void onMachineRemoved() { - - } + default void onMachineRemoved() {} /** * Called when machine placed by (if exist) an entity with item. * it won't be called when machine added by {@link Level#setBlock(BlockPos, BlockState, int, int)} */ - default void onMachinePlaced(@Nullable LivingEntity player, ItemStack stack) { - - } + default void onMachinePlaced(@Nullable LivingEntity player, ItemStack stack) {} } diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IMachineModifyDrops.java b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IMachineModifyDrops.java index d4c2c6dc42..9abbd8fc4e 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IMachineModifyDrops.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IMachineModifyDrops.java @@ -14,7 +14,8 @@ public interface IMachineModifyDrops extends IMachineFeature { /** * Modify or append drops. - * @param drops existing drops. + * + * @param drops existing drops. * @param entity who destroyed it. */ void onDrops(List drops, Player entity); diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IMufflableMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IMufflableMachine.java index 65cb6d9c6b..cc0e49b2e3 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IMufflableMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IMufflableMachine.java @@ -6,6 +6,8 @@ * @implNote IMufflableMachine */ public interface IMufflableMachine extends IMachineFeature { + boolean isMuffled(); + void setMuffled(boolean isMuffled); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IRecipeLogicMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IRecipeLogicMachine.java index f730a8ad0b..7dd91d3d93 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IRecipeLogicMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IRecipeLogicMachine.java @@ -15,13 +15,15 @@ * @author KilaBash * @date 2023/2/20 * @implNote IRecipeMachine - * A machine can handle recipes. + * A machine can handle recipes. */ -public interface IRecipeLogicMachine extends IRecipeCapabilityHolder, IMachineFeature, IWorkable, ICleanroomReceiver, IVoidable { +public interface IRecipeLogicMachine extends IRecipeCapabilityHolder, IMachineFeature, IWorkable, ICleanroomReceiver, + IVoidable { @Override default int getChanceTier() { - return self() instanceof ITieredMachine tieredMachine ? tieredMachine.getTier() : self().getDefinition().getTier(); + return self() instanceof ITieredMachine tieredMachine ? tieredMachine.getTier() : + self().getDefinition().getTier(); } /** @@ -29,17 +31,18 @@ default int getChanceTier() { */ @NotNull GTRecipeType[] getRecipeTypes(); + @NotNull GTRecipeType getRecipeType(); int getActiveRecipeType(); + void setActiveRecipeType(int type); /** * Called when recipe logic status changed */ - default void notifyStatusChanged(RecipeLogic.Status oldStatus, RecipeLogic.Status newStatus) { - } + default void notifyStatusChanged(RecipeLogic.Status oldStatus, RecipeLogic.Status newStatus) {} /** * Recipe logic @@ -53,6 +56,7 @@ default GTRecipe fullModifyRecipe(GTRecipe recipe) { /** * Override it to modify recipe on the fly e.g. applying overclock, change chance, etc + * * @param recipe recipe from detected from GTRecipeType * @return modified recipe. * null -- this recipe is unavailable @@ -64,7 +68,8 @@ default GTRecipe doModifyRecipe(GTRecipe recipe) { /** * Whether the recipe logic should keep subscribing tick logic when no recipe is available after one cycle. - * if false. you should call {@link RecipeLogic#updateTickSubscription()} manually later to active recipe logic again. + * if false. you should call {@link RecipeLogic#updateTickSubscription()} manually later to active recipe logic + * again. */ default boolean keepSubscribing() { return true; @@ -112,22 +117,23 @@ default boolean dampingWhenWaiting() { return true; } - /** * Always try {@link IRecipeLogicMachine#fullModifyRecipe(GTRecipe)} before setting up recipe. + * * @return true - will map {@link RecipeLogic#lastOriginRecipe} to the latest recipe for next round when finishing. - * false - keep using the {@link RecipeLogic#lastRecipe}, which is already modified. + * false - keep using the {@link RecipeLogic#lastRecipe}, which is already modified. */ default boolean alwaysTryModifyRecipe() { return self().getDefinition().isAlwaysTryModifyRecipe(); } default boolean shouldWorkingPlaySound() { - return ConfigHolder.INSTANCE.machines.machineSounds && (!(self() instanceof IMufflableMachine mufflableMachine) || !mufflableMachine.isMuffled()); + return ConfigHolder.INSTANCE.machines.machineSounds && + (!(self() instanceof IMufflableMachine mufflableMachine) || !mufflableMachine.isMuffled()); } ////////////////////////////////////// - //******* IWorkable ********// + // ******* IWorkable ********// ////////////////////////////////////// @Override default boolean isWorkingEnabled() { @@ -153,5 +159,4 @@ default int getMaxProgress() { default boolean isActive() { return getRecipeLogic().isActive(); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IRedstoneSignalMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IRedstoneSignalMachine.java index db45993e08..0142664af7 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IRedstoneSignalMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IRedstoneSignalMachine.java @@ -29,7 +29,8 @@ default boolean canConnectRedstone(Direction side) { /** * Call to update output signal. - * also see {@link IRedstoneSignalMachine#getOutputSignal(Direction)} and {@link IRedstoneSignalMachine#getOutputDirectSignal(Direction)} + * also see {@link IRedstoneSignalMachine#getOutputSignal(Direction)} and + * {@link IRedstoneSignalMachine#getOutputDirectSignal(Direction)} */ default void updateSignal() { var level = self().getLevel(); @@ -37,5 +38,4 @@ default void updateSignal() { self().notifyBlockUpdate(); } } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/ITieredMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/ITieredMachine.java index a823d97e19..08a6914219 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/ITieredMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/ITieredMachine.java @@ -1,6 +1,5 @@ package com.gregtechceu.gtceu.api.machine.feature; - /** * @author KilaBash * @date 2023/2/18 @@ -16,5 +15,4 @@ public interface ITieredMachine extends IMachineFeature { default int getTier() { return self().getDefinition().getTier(); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IUIMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IUIMachine.java index b809d6a8b8..567a487526 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IUIMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IUIMachine.java @@ -1,8 +1,10 @@ package com.gregtechceu.gtceu.api.machine.feature; import com.gregtechceu.gtceu.api.gui.factory.MachineUIFactory; + import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.gui.modular.IUIHolder; + import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IVoidable.java b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IVoidable.java index 7ffef73599..89e626b2a2 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IVoidable.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IVoidable.java @@ -1,9 +1,11 @@ package com.gregtechceu.gtceu.api.machine.feature; import com.gregtechceu.gtceu.api.capability.recipe.RecipeCapability; + import net.minecraft.util.StringRepresentable; import org.jetbrains.annotations.NotNull; + import java.util.Map; public interface IVoidable extends IMachineFeature { @@ -18,6 +20,7 @@ default Map, Integer> getOutputLimits() { } enum VoidingMode implements StringRepresentable { + VOID_NONE("gtceu.gui.multiblock_no_voiding"), VOID_ITEMS("gtceu.gui.multiblock_item_voiding"), VOID_FLUIDS("gtceu.gui.multiblock_fluid_voiding"), diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/multiblock/IDisplayUIMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/multiblock/IDisplayUIMachine.java index 522ba3afb5..4ea74e60c9 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/multiblock/IDisplayUIMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/multiblock/IDisplayUIMachine.java @@ -3,16 +3,15 @@ import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.api.gui.UITemplate; import com.gregtechceu.gtceu.api.machine.feature.IUIMachine; + import com.lowdragmc.lowdraglib.gui.modular.ModularUI; import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.util.ClickData; import com.lowdragmc.lowdraglib.gui.widget.ComponentPanelWidget; import com.lowdragmc.lowdraglib.gui.widget.DraggableScrollableWidgetGroup; import com.lowdragmc.lowdraglib.gui.widget.LabelWidget; -import net.minecraft.ChatFormatting; + import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.HoverEvent; -import net.minecraft.network.chat.Style; import net.minecraft.world.entity.player.Player; import java.util.List; @@ -23,14 +22,14 @@ * @implNote IDisplayUIMachine */ public interface IDisplayUIMachine extends IUIMachine, IMultiController { + default void addDisplayText(List textList) { for (var part : this.getParts()) { part.addMultiText(textList); } } - default void handleDisplayClick(String componentData, ClickData clickData) { - } + default void handleDisplayClick(String componentData, ClickData clickData) {} default IGuiTexture getScreenTexture() { return GuiTextures.DISPLAY; @@ -49,5 +48,4 @@ default ModularUI createUI(Player entityPlayer) { .widget(screen) .widget(UITemplate.bindPlayerInventory(entityPlayer.getInventory(), GuiTextures.SLOT, 7, 134, true)); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/multiblock/IDistinctPart.java b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/multiblock/IDistinctPart.java index f3f27c69f3..3ff3f7d323 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/multiblock/IDistinctPart.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/multiblock/IDistinctPart.java @@ -3,6 +3,7 @@ import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.api.gui.fancy.ConfiguratorPanel; import com.gregtechceu.gtceu.api.gui.fancy.IFancyConfiguratorButton; + import net.minecraft.ChatFormatting; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Style; @@ -28,8 +29,9 @@ default void attachConfigurators(ConfiguratorPanel configuratorPanel) { GuiTextures.BUTTON_DISTINCT_BUSES.getSubTexture(0, 0, 1, 0.5), this::isDistinct, (clickData, pressed) -> setDistinct(pressed)) .setTooltipsSupplier(pressed -> List.of( - Component.translatable("gtceu.multiblock.universal.distinct").setStyle(Style.EMPTY.withColor(ChatFormatting.YELLOW)) - .append(Component.translatable(pressed ? "gtceu.multiblock.universal.distinct.yes" : "gtceu.multiblock.universal.distinct.no"))))); + Component.translatable("gtceu.multiblock.universal.distinct") + .setStyle(Style.EMPTY.withColor(ChatFormatting.YELLOW)) + .append(Component.translatable(pressed ? "gtceu.multiblock.universal.distinct.yes" : + "gtceu.multiblock.universal.distinct.no"))))); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/multiblock/IMaintenanceMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/multiblock/IMaintenanceMachine.java index 4f401af3fa..27795daedf 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/multiblock/IMaintenanceMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/multiblock/IMaintenanceMachine.java @@ -6,14 +6,17 @@ import com.gregtechceu.gtceu.api.gui.fancy.TooltipsPanel; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.config.ConfigHolder; -import lombok.val; + import net.minecraft.ChatFormatting; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Style; +import lombok.val; + import java.util.ArrayList; public interface IMaintenanceMachine extends IMultiPart { + int MINIMUM_MAINTENANCE_TIME = 3456000; // 48 real-life hours = 3456000 ticks byte ALL_PROBLEMS = 0; byte NO_PROBLEMS = 0b111111; @@ -25,6 +28,7 @@ public interface IMaintenanceMachine extends IMultiPart { /** * Sets this Maintenance Hatch as being duct taped + * * @param isTaped is the state of the hatch being taped or not */ void setTaped(boolean isTaped); @@ -39,7 +43,8 @@ public interface IMaintenanceMachine extends IMultiPart { /** * This value stores whether each of the 5 maintenance problems have been fixed. * A value of 0 means the problem is not fixed, else it is fixed - * Value positions correspond to the following from left to right: 0=Wrench, 1=Screwdriver, 2=Soft Mallet, 3=Hard Hammer, 4=Wire Cutter, 5=Crowbar + * Value positions correspond to the following from left to right: 0=Wrench, 1=Screwdriver, 2=Soft Mallet, 3=Hard + * Hammer, 4=Wire Cutter, 5=Crowbar */ byte getMaintenanceProblems(); @@ -119,7 +124,8 @@ default void setMaintenanceFixed(int index) { } default void causeRandomMaintenanceProblems() { - setMaintenanceProblems((byte) (getMaintenanceProblems() & (byte) ~(1 << ((int) (GTValues.RNG.nextFloat() * 5))))); + setMaintenanceProblems( + (byte) (getMaintenanceProblems() & (byte) ~(1 << ((int) (GTValues.RNG.nextFloat() * 5))))); } @Override @@ -136,7 +142,7 @@ default boolean afterWorking(IWorkableMultiController controller) { @Override default GTRecipe modifyRecipe(GTRecipe recipe) { - if (ConfigHolder.INSTANCE.machines.enableMaintenance) { + if (ConfigHolder.INSTANCE.machines.enableMaintenance) { if (hasMaintenanceProblems()) { return null; } @@ -150,7 +156,7 @@ default GTRecipe modifyRecipe(GTRecipe recipe) { } ////////////////////////////////////// - //******* FANCY GUI ********// + // ******* FANCY GUI ********// ////////////////////////////////////// @Override @@ -163,7 +169,8 @@ default void attachTooltips(TooltipsPanel tooltipsPanel) { if (ConfigHolder.INSTANCE.machines.enableMaintenance) { tooltipsPanel.attachTooltips(new IFancyTooltip.Basic(() -> GuiTextures.MAINTENANCE_ICON, () -> { val tooltips = new ArrayList(); - tooltips.add(Component.translatable("gtceu.multiblock.universal.has_problems_header").setStyle(Style.EMPTY.withColor(ChatFormatting.RED))); + tooltips.add(Component.translatable("gtceu.multiblock.universal.has_problems_header") + .setStyle(Style.EMPTY.withColor(ChatFormatting.RED))); if ((getMaintenanceProblems() & 1) == 0) tooltips.add(Component.translatable("gtceu.multiblock.universal.problem.wrench", "\n")); @@ -187,4 +194,4 @@ default void attachTooltips(TooltipsPanel tooltipsPanel) { }, this::hasMaintenanceProblems, () -> null)); } } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/multiblock/IMufflerMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/multiblock/IMufflerMachine.java index 9d6a89478b..3b1ae22283 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/multiblock/IMufflerMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/multiblock/IMufflerMachine.java @@ -5,14 +5,15 @@ import com.gregtechceu.gtceu.api.gui.fancy.IFancyTooltip; import com.gregtechceu.gtceu.api.gui.fancy.TooltipsPanel; import com.gregtechceu.gtceu.api.recipe.GTRecipe; -import lombok.val; + import net.minecraft.ChatFormatting; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Style; import net.minecraft.world.item.ItemStack; -import java.util.ArrayList; +import lombok.val; + import java.util.List; public interface IMufflerMachine extends IMultiPart { @@ -27,7 +28,7 @@ default boolean isFrontFaceFree() { return self().getLevel().getBlockState(frontPos).isAir(); } - default void emitPollutionParticles() { + default void emitPollutionParticles() { var pos = self().getPos(); var facing = self().getFrontFacing(); float xPos = facing.getStepX() * 0.76F + pos.getX() + 0.25F; @@ -51,7 +52,6 @@ default void emitPollutionParticles() { yPos + GTValues.RNG.nextFloat() * 0.5F, zPos + GTValues.RNG.nextFloat() * 0.5F, xSpd, ySpd, zSpd); - } @Override @@ -72,7 +72,7 @@ default boolean afterWorking(IWorkableMultiController controller) { } ////////////////////////////////////// - //******* FANCY GUI ********// + // ******* FANCY GUI ********// ////////////////////////////////////// @Override @@ -84,7 +84,8 @@ default void attachFancyTooltipsToController(IMultiController controller, Toolti default void attachTooltips(TooltipsPanel tooltipsPanel) { tooltipsPanel.attachTooltips(new IFancyTooltip.Basic( () -> GuiTextures.INDICATOR_NO_STEAM.get(false), - () -> List.of(Component.translatable("gtceu.multiblock.universal.muffler_obstructed").setStyle(Style.EMPTY.withColor(ChatFormatting.RED))), + () -> List.of(Component.translatable("gtceu.multiblock.universal.muffler_obstructed") + .setStyle(Style.EMPTY.withColor(ChatFormatting.RED))), () -> !isFrontFaceFree(), () -> null)); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/multiblock/IMufflerMechanic.java b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/multiblock/IMufflerMechanic.java index fd8ead0f69..9df10d9383 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/multiblock/IMufflerMechanic.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/multiblock/IMufflerMechanic.java @@ -1,5 +1,6 @@ package com.gregtechceu.gtceu.api.machine.feature.multiblock; public interface IMufflerMechanic { + boolean hasMufflerMechanics(); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/multiblock/IMultiController.java b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/multiblock/IMultiController.java index 746d50c3ae..b4df2327b7 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/multiblock/IMultiController.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/multiblock/IMultiController.java @@ -7,6 +7,7 @@ import com.gregtechceu.gtceu.api.pattern.MultiblockState; import com.gregtechceu.gtceu.client.renderer.MultiblockInWorldPreviewRenderer; import com.gregtechceu.gtceu.config.ConfigHolder; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.InteractionHand; @@ -18,6 +19,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; + import java.util.List; import java.util.concurrent.locks.Lock; @@ -37,7 +39,9 @@ default MultiblockControllerMachine self() { * Check MultiBlock Pattern. Just checking pattern without any other logic. * You can override it but it's unsafe for calling. because it will also be called in an async thread. *
- * you should always use {@link IMultiController#checkPatternWithLock()} and {@link IMultiController#checkPatternWithTryLock()} instead. + * you should always use {@link IMultiController#checkPatternWithLock()} and + * {@link IMultiController#checkPatternWithTryLock()} instead. + * * @return whether it can be formed. */ default boolean checkPattern() { @@ -58,6 +62,7 @@ default boolean checkPatternWithLock() { /** * Check pattern with a try lock + * * @return false - checking failed or cant get the lock. */ default boolean checkPatternWithTryLock() { @@ -87,7 +92,6 @@ default BlockPattern getPattern() { */ boolean isFormed(); - /** * Get MultiblockState. It records all structure-related information. */ @@ -97,6 +101,7 @@ default BlockPattern getPattern() { /** * Called in an async thread. It's unsafe, Don't modify anything of world but checking information. * It will be called per 5 tick. + * * @param periodID period Tick */ void asyncCheckPattern(long periodID); @@ -166,10 +171,13 @@ default BlockState getPartAppearance(IMultiPart part, Direction side, BlockState * Show the preview of structure. */ @Override - default InteractionResult onUse(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { + default InteractionResult onUse(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, + BlockHitResult hit) { if (!self().isFormed() && player.isShiftKeyDown() && player.getItemInHand(hand).isEmpty()) { if (world.isClientSide()) { - MultiblockInWorldPreviewRenderer.showPreview(pos, self().getFrontFacing(), self().getDefinition().getMatchingShapes().get(0), ConfigHolder.INSTANCE.client.inWorldPreviewDuration * 20); + MultiblockInWorldPreviewRenderer.showPreview(pos, self().getFrontFacing(), + self().getDefinition().getMatchingShapes().get(0), + ConfigHolder.INSTANCE.client.inWorldPreviewDuration * 20); } return InteractionResult.SUCCESS; } diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/multiblock/IMultiPart.java b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/multiblock/IMultiPart.java index 87a3c95b8b..fd65c979f5 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/multiblock/IMultiPart.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/multiblock/IMultiPart.java @@ -7,10 +7,12 @@ import com.gregtechceu.gtceu.api.machine.trait.IRecipeHandlerTrait; import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; import com.gregtechceu.gtceu.api.recipe.GTRecipe; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.network.chat.Component; import net.minecraft.world.level.block.state.BlockState; + import org.jetbrains.annotations.Nullable; import java.util.List; @@ -115,6 +117,7 @@ default boolean beforeWorking(IWorkableMultiController controller) { /** * Override it to modify recipe on the fly e.g. applying overclock, change chance, etc + * * @param recipe recipe from detected from GTRecipeType * @return modified recipe. * null -- this recipe is unavailable @@ -125,11 +128,10 @@ default GTRecipe modifyRecipe(GTRecipe recipe) { /** * Add text to the multiblock's screen. + * * @param textList the text list to add to. */ - default void addMultiText(List textList) { - - } + default void addMultiText(List textList) {} /** * Attach part's tooltips to the controller. diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/multiblock/IRotorHolderMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/multiblock/IRotorHolderMachine.java index a5863ddb80..f6e402f8c1 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/multiblock/IRotorHolderMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/multiblock/IRotorHolderMachine.java @@ -5,6 +5,7 @@ import com.gregtechceu.gtceu.api.gui.fancy.TooltipsPanel; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.common.item.TurbineRotorBehaviour; + import net.minecraft.ChatFormatting; import net.minecraft.core.Direction; import net.minecraft.network.chat.Component; @@ -19,8 +20,9 @@ * @implNote IRotorHolderMachine */ public interface IRotorHolderMachine extends IMultiPart { - int SPEED_INCREMENT = 1; - int SPEED_DECREMENT = 3; + + int SPEED_INCREMENT = 1; + int SPEED_DECREMENT = 3; /** * @return the base efficiency of the rotor holder in % @@ -181,7 +183,7 @@ default boolean isRotorSpinning() { } ////////////////////////////////////// - //****** RECIPE LOGIC *******// + // ****** RECIPE LOGIC *******// ////////////////////////////////////// @Override default GTRecipe modifyRecipe(GTRecipe recipe) { @@ -192,7 +194,7 @@ default GTRecipe modifyRecipe(GTRecipe recipe) { } ////////////////////////////////////// - //******* FANCY GUI ********// + // ******* FANCY GUI ********// ////////////////////////////////////// @Override @@ -204,9 +206,9 @@ default void attachFancyTooltipsToController(IMultiController controller, Toolti default void attachTooltips(TooltipsPanel tooltipsPanel) { tooltipsPanel.attachTooltips(new IFancyTooltip.Basic( () -> GuiTextures.INDICATOR_NO_STEAM.get(false), - () -> List.of(Component.translatable("gtceu.multiblock.universal.muffler_obstructed").setStyle(Style.EMPTY.withColor(ChatFormatting.RED))), + () -> List.of(Component.translatable("gtceu.multiblock.universal.muffler_obstructed") + .setStyle(Style.EMPTY.withColor(ChatFormatting.RED))), () -> !isFrontFaceFree(), () -> null)); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/multiblock/IWorkableMultiController.java b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/multiblock/IWorkableMultiController.java index 18649b03c3..705d2745a5 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/multiblock/IWorkableMultiController.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/multiblock/IWorkableMultiController.java @@ -7,5 +7,4 @@ * @date 2023/7/2 * @implNote IWorkableMultiController */ -public interface IWorkableMultiController extends IMultiController, IRecipeLogicMachine { -} +public interface IWorkableMultiController extends IMultiController, IRecipeLogicMachine {} diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/CleanroomType.java b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/CleanroomType.java index 80459d06dc..831398f019 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/CleanroomType.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/CleanroomType.java @@ -1,9 +1,9 @@ package com.gregtechceu.gtceu.api.machine.multiblock; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; - import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; + import java.util.HashSet; import java.util.Map; import java.util.Set; @@ -13,15 +13,16 @@ public class CleanroomType { private static final Map CLEANROOM_TYPES = new Object2ObjectOpenHashMap<>(); public static final CleanroomType CLEANROOM = new CleanroomType("cleanroom", "gtceu.recipe.cleanroom.display_name"); - public static final CleanroomType STERILE_CLEANROOM = new CleanroomType("sterile_cleanroom", "gtceu.recipe.cleanroom_sterile.display_name"); - + public static final CleanroomType STERILE_CLEANROOM = new CleanroomType("sterile_cleanroom", + "gtceu.recipe.cleanroom_sterile.display_name"); private final String name; private final String translationKey; public CleanroomType(@NotNull String name, @NotNull String translationKey) { if (CLEANROOM_TYPES.get(name) != null) - throw new IllegalArgumentException(String.format("CleanroomType with name %s is already registered!", name)); + throw new IllegalArgumentException( + String.format("CleanroomType with name %s is already registered!", name)); this.name = name; this.translationKey = translationKey; diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/CoilWorkableElectricMultiblockMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/CoilWorkableElectricMultiblockMachine.java index b8b348c243..f6f4be279b 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/CoilWorkableElectricMultiblockMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/CoilWorkableElectricMultiblockMachine.java @@ -3,9 +3,11 @@ import com.gregtechceu.gtceu.api.block.ICoilType; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; import com.gregtechceu.gtceu.common.block.CoilBlock; -import lombok.Getter; + import net.minecraft.MethodsReturnNonnullByDefault; +import lombok.Getter; + import javax.annotation.ParametersAreNonnullByDefault; /** @@ -25,7 +27,7 @@ public CoilWorkableElectricMultiblockMachine(IMachineBlockEntity holder) { } ////////////////////////////////////// - //*** Multiblock LifeCycle ***// + // *** Multiblock LifeCycle ***// ////////////////////////////////////// @Override public void onStructureFormed() { diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/DummyCleanroom.java b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/DummyCleanroom.java index 0275c54bf4..ae209aedfb 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/DummyCleanroom.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/DummyCleanroom.java @@ -3,6 +3,7 @@ import com.gregtechceu.gtceu.api.machine.feature.ICleanroomProvider; import org.jetbrains.annotations.NotNull; + import java.util.Collection; import java.util.Collections; import java.util.HashSet; @@ -15,6 +16,7 @@ public final class DummyCleanroom implements ICleanroomProvider { /** * Create a Dummy Cleanroom that provides specific types + * * @param types the types to provide */ @NotNull @@ -40,10 +42,8 @@ public boolean isClean() { return true; } - @Override public Set getTypes() { return allowsAllTypes ? CleanroomType.getAllTypes() : new HashSet<>(allowedTypes); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/IBatteryData.java b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/IBatteryData.java index dd622c17c6..750e39abd3 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/IBatteryData.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/IBatteryData.java @@ -8,5 +8,6 @@ public interface IBatteryData { long getCapacity(); - @NotNull String getBatteryName(); -} \ No newline at end of file + @NotNull + String getBatteryName(); +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockControllerMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockControllerMachine.java index 5f6c4a6dca..63b2a884ec 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockControllerMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockControllerMachine.java @@ -1,26 +1,28 @@ package com.gregtechceu.gtceu.api.machine.multiblock; -import com.gregtechceu.gtceu.api.machine.MultiblockMachineDefinition; -import com.gregtechceu.gtceu.api.pattern.MultiblockState; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; import com.gregtechceu.gtceu.api.machine.MetaMachine; +import com.gregtechceu.gtceu.api.machine.MultiblockMachineDefinition; import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiController; import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiPart; +import com.gregtechceu.gtceu.api.pattern.MultiblockState; import com.gregtechceu.gtceu.api.pattern.MultiblockWorldSavedData; -import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; -import com.lowdragmc.lowdraglib.syncdata.annotation.UpdateListener; + 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.annotation.UpdateListener; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import lombok.Getter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.block.state.BlockState; +import lombok.Getter; import org.jetbrains.annotations.NotNull; -import javax.annotation.ParametersAreNonnullByDefault; + import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -28,6 +30,8 @@ import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author KilaBash * @date 2023/3/3 @@ -37,11 +41,13 @@ @MethodsReturnNonnullByDefault public class MultiblockControllerMachine extends MetaMachine implements IMultiController { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(MultiblockControllerMachine.class, MetaMachine.MANAGED_FIELD_HOLDER); + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( + MultiblockControllerMachine.class, MetaMachine.MANAGED_FIELD_HOLDER); private MultiblockState multiblockState; private final List parts = new ArrayList<>(); @Getter - @DescSynced @UpdateListener(methodName = "onPartsUpdated") + @DescSynced + @UpdateListener(methodName = "onPartsUpdated") private BlockPos[] partPositions = new BlockPos[0]; @Getter @Persisted @@ -54,7 +60,7 @@ public MultiblockControllerMachine(IMachineBlockEntity holder) { } ////////////////////////////////////// - //***** Initialization ******// + // ***** Initialization ******// ////////////////////////////////////// @Override public ManagedFieldHolder getFieldHolder() { @@ -102,7 +108,8 @@ protected void onPartsUpdated(BlockPos[] newValue, BlockPos[] oldValue) { } protected void updatePartPositions() { - this.partPositions = this.parts.isEmpty() ? new BlockPos[0] : this.parts.stream().map(part -> part.self().getPos()).toArray(BlockPos[]::new); + this.partPositions = this.parts.isEmpty() ? new BlockPos[0] : + this.parts.stream().map(part -> part.self().getPos()).toArray(BlockPos[]::new); } @Override @@ -120,14 +127,15 @@ public List getParts() { } ////////////////////////////////////// - //*** Multiblock LifeCycle ***// + // *** Multiblock LifeCycle ***// ////////////////////////////////////// @Getter private final Lock patternLock = new ReentrantLock(); @Override public void asyncCheckPattern(long periodID) { - if ((getMultiblockState().hasError() || !isFormed) && (getHolder().getOffset() + periodID) % 4 == 0 && checkPatternWithTryLock()) { // per second + if ((getMultiblockState().hasError() || !isFormed) && (getHolder().getOffset() + periodID) % 4 == 0 && + checkPatternWithTryLock()) { // per second if (getLevel() instanceof ServerLevel serverLevel) { serverLevel.getServer().execute(() -> { patternLock.lock(); @@ -173,7 +181,8 @@ public void onStructureInvalid() { /** * mark multiblockState as unload error first. * if it's actually cuz by block breaking. - * {@link #onStructureInvalid()} will be called from {@link MultiblockState#onBlockStateChanged(BlockPos, BlockState)} + * {@link #onStructureInvalid()} will be called from + * {@link MultiblockState#onBlockStateChanged(BlockPos, BlockState)} */ @Override public void onPartUnload() { diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockDisplayText.java b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockDisplayText.java index e31307fc16..d229164d60 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockDisplayText.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockDisplayText.java @@ -6,6 +6,7 @@ import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.utils.FormattingUtil; import com.gregtechceu.gtceu.utils.GTUtil; + import net.minecraft.ChatFormatting; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.HoverEvent; @@ -50,9 +51,12 @@ private Builder(List textList, boolean isStructureFormed, this.isStructureFormed = isStructureFormed; if (!isStructureFormed && showIncompleteStructureWarning) { - MutableComponent base = Component.translatable("gtceu.multiblock.invalid_structure").withStyle(ChatFormatting.RED); - Component hover = Component.translatable("gtceu.multiblock.invalid_structure.tooltip").withStyle(ChatFormatting.GRAY); - textList.add(base.withStyle(style -> style.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, hover)))); + MutableComponent base = Component.translatable("gtceu.multiblock.invalid_structure") + .withStyle(ChatFormatting.RED); + Component hover = Component.translatable("gtceu.multiblock.invalid_structure.tooltip") + .withStyle(ChatFormatting.GRAY); + textList.add(base + .withStyle(style -> style.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, hover)))); } } @@ -99,12 +103,14 @@ public Builder addEnergyUsageLine(IEnergyContainer energyContainer) { String energyFormatted = FormattingUtil.formatNumbers(maxVoltage); // wrap in text component to keep it from being formatted Component voltageName = Component.literal( - GTValues.VNF[GTUtil.getFloorTierByVoltage(maxVoltage)]); + GTValues.VNF[GTUtil.getFloorTierByVoltage(maxVoltage)]); MutableComponent bodyText = Component.translatable("gtceu.multiblock.max_energy_per_tick", - energyFormatted, voltageName).withStyle(ChatFormatting.GRAY); - Component hoverText = Component.translatable("gtceu.multiblock.max_energy_per_tick_hover").withStyle(ChatFormatting.GRAY); - textList.add(bodyText.withStyle(style -> style.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverText)))); + energyFormatted, voltageName).withStyle(ChatFormatting.GRAY); + Component hoverText = Component.translatable("gtceu.multiblock.max_energy_per_tick_hover") + .withStyle(ChatFormatting.GRAY); + textList.add(bodyText.withStyle( + style -> style.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverText)))); } return this; } @@ -123,10 +129,12 @@ public Builder addEnergyTierLine(int tier) { Component voltageName = Component.literal(GTValues.VNF[tier]); MutableComponent bodyText = Component.translatable( - "gtceu.multiblock.max_recipe_tier", - voltageName).withStyle(ChatFormatting.GRAY); - Component hoverText = Component.translatable("gtceu.multiblock.max_recipe_tier_hover").withStyle(ChatFormatting.GRAY); - textList.add(bodyText.withStyle(style -> style.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverText)))); + "gtceu.multiblock.max_recipe_tier", + voltageName).withStyle(ChatFormatting.GRAY); + Component hoverText = Component.translatable("gtceu.multiblock.max_recipe_tier_hover") + .withStyle(ChatFormatting.GRAY); + textList.add(bodyText + .withStyle(style -> style.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, hoverText)))); return this; } @@ -142,10 +150,10 @@ public Builder addEnergyUsageExactLine(long energyUsage) { String energyFormatted = FormattingUtil.formatNumbers(energyUsage); // wrap in text component to keep it from being formatted Component voltageName = Component.literal( - GTValues.VNF[GTUtil.getTierByVoltage(energyUsage)]); + GTValues.VNF[GTUtil.getTierByVoltage(energyUsage)]); textList.add(Component.translatable("gtceu.multiblock.energy_consumption", - energyFormatted, voltageName).withStyle(ChatFormatting.GRAY)); + energyFormatted, voltageName).withStyle(ChatFormatting.GRAY)); } return this; } @@ -162,10 +170,10 @@ public Builder addEnergyProductionLine(long maxVoltage, long recipeEUt) { String energyFormatted = FormattingUtil.formatNumbers(maxVoltage); // wrap in text component to keep it from being formatted Component voltageName = Component.literal( - GTValues.VNF[GTUtil.getFloorTierByVoltage(maxVoltage)]); + GTValues.VNF[GTUtil.getFloorTierByVoltage(maxVoltage)]); textList.add(Component.translatable("gtceu.multiblock.max_energy_per_tick", - energyFormatted, voltageName).withStyle(ChatFormatting.GRAY)); + energyFormatted, voltageName).withStyle(ChatFormatting.GRAY)); } return this; } @@ -184,10 +192,10 @@ public Builder addEnergyProductionAmpsLine(long maxVoltage, int amperage) { String energyFormatted = FormattingUtil.formatNumbers(maxVoltage); // wrap in text component to keep it from being formatted Component voltageName = Component.literal( - GTValues.VNF[GTUtil.getFloorTierByVoltage(maxVoltage)]); + GTValues.VNF[GTUtil.getFloorTierByVoltage(maxVoltage)]); textList.add(Component.translatable("gtceu.multiblock.max_energy_per_tick_amps", - energyFormatted, amperage, voltageName).withStyle(ChatFormatting.GRAY)); + energyFormatted, amperage, voltageName).withStyle(ChatFormatting.GRAY)); } return this; } @@ -201,9 +209,10 @@ public Builder addComputationUsageLine(int maxCWUt) { if (!isStructureFormed) return this; if (maxCWUt > 0) { - Component computation = Component.literal(FormattingUtil.formatNumbers(maxCWUt)).withStyle(ChatFormatting.AQUA); + Component computation = Component.literal(FormattingUtil.formatNumbers(maxCWUt)) + .withStyle(ChatFormatting.AQUA); textList.add(Component.translatable("gtceu.multiblock.computation.max", - computation).withStyle(ChatFormatting.GRAY)); + computation).withStyle(ChatFormatting.GRAY)); } return this; } @@ -217,10 +226,11 @@ public Builder addComputationUsageExactLine(int currentCWUt) { if (!isStructureFormed) return this; if (isActive && currentCWUt > 0) { - Component computation = Component.literal(FormattingUtil.formatNumbers(currentCWUt) + " CWU/t").withStyle(ChatFormatting.AQUA); + Component computation = Component.literal(FormattingUtil.formatNumbers(currentCWUt) + " CWU/t") + .withStyle(ChatFormatting.AQUA); textList.add(Component.translatable( - "gtceu.multiblock.computation.usage", - computation).withStyle(ChatFormatting.GRAY)); + "gtceu.multiblock.computation.usage", + computation).withStyle(ChatFormatting.GRAY)); } return this; } @@ -311,8 +321,10 @@ public Builder addProgressLine(double progressPercent) { // todo public Builder addMachineModeLine(GTRecipeType recipeType) { if (!isStructureFormed) return this; - textList.add(Component.translatable("gtceu.gui.machinemode", Component.translatable(recipeType.registryName.toLanguageKey())) - .withStyle(ChatFormatting.AQUA)); + textList.add(Component + .translatable("gtceu.gui.machinemode", + Component.translatable(recipeType.registryName.toLanguageKey())) + .withStyle(ChatFormatting.AQUA)); return this; } @@ -325,12 +337,13 @@ public Builder addParallelsLine(int numParallels) { if (!isStructureFormed) return this; if (numParallels > 1) { - Component parallels = Component.literal(FormattingUtil.formatNumbers(numParallels)).withStyle(ChatFormatting.DARK_PURPLE); + Component parallels = Component.literal(FormattingUtil.formatNumbers(numParallels)) + .withStyle(ChatFormatting.DARK_PURPLE); textList.add(Component.translatable( "gtceu.multiblock.parallel", parallels) - .withStyle(ChatFormatting.GRAY)); + .withStyle(ChatFormatting.GRAY)); } return this; } @@ -344,7 +357,8 @@ public Builder addLowPowerLine(boolean isLowPower) { if (!isStructureFormed) return this; if (isLowPower) { - textList.add(Component.translatable("gtceu.multiblock.not_enough_energy").withStyle(ChatFormatting.YELLOW)); + textList.add( + Component.translatable("gtceu.multiblock.not_enough_energy").withStyle(ChatFormatting.YELLOW)); } return this; } @@ -358,7 +372,8 @@ public Builder addLowComputationLine(boolean isLowComputation) { if (!isStructureFormed) return this; if (isLowComputation) { - textList.add(Component.translatable("gtceu.multiblock.computation.not_enough_computation").withStyle(ChatFormatting.YELLOW)); + textList.add(Component.translatable("gtceu.multiblock.computation.not_enough_computation") + .withStyle(ChatFormatting.YELLOW)); } return this; } @@ -372,7 +387,8 @@ public Builder addLowDynamoTierLine(boolean isTooLow) { if (!isStructureFormed) return this; if (isTooLow) { - textList.add(Component.translatable("gtceu.multiblock.not_enough_energy_output").withStyle(ChatFormatting.YELLOW)); + textList.add(Component.translatable("gtceu.multiblock.not_enough_energy_output") + .withStyle(ChatFormatting.YELLOW)); } return this; } @@ -391,39 +407,46 @@ public Builder addMaintenanceProblemLines(byte maintenanceProblems) { // Wrench if ((maintenanceProblems & 1) == 0) { - textList.add(Component.translatable("gtceu.multiblock.universal.problem.wrench").withStyle(ChatFormatting.GRAY)); + textList.add(Component.translatable("gtceu.multiblock.universal.problem.wrench") + .withStyle(ChatFormatting.GRAY)); } // Screwdriver if (((maintenanceProblems >> 1) & 1) == 0) { - textList.add(Component.translatable("gtceu.multiblock.universal.problem.screwdriver").withStyle(ChatFormatting.GRAY)); + textList.add(Component.translatable("gtceu.multiblock.universal.problem.screwdriver") + .withStyle(ChatFormatting.GRAY)); } // Soft Mallet if (((maintenanceProblems >> 2) & 1) == 0) { - textList.add(Component.translatable("gtceu.multiblock.universal.problem.soft_mallet").withStyle(ChatFormatting.GRAY)); + textList.add(Component.translatable("gtceu.multiblock.universal.problem.soft_mallet") + .withStyle(ChatFormatting.GRAY)); } // Hammer if (((maintenanceProblems >> 3) & 1) == 0) { - textList.add(Component.translatable("gtceu.multiblock.universal.problem.hard_hammer").withStyle(ChatFormatting.GRAY)); + textList.add(Component.translatable("gtceu.multiblock.universal.problem.hard_hammer") + .withStyle(ChatFormatting.GRAY)); } // Wire Cutters if (((maintenanceProblems >> 4) & 1) == 0) { - textList.add(Component.translatable("gtceu.multiblock.universal.problem.wire_cutter").withStyle(ChatFormatting.GRAY)); + textList.add(Component.translatable("gtceu.multiblock.universal.problem.wire_cutter") + .withStyle(ChatFormatting.GRAY)); } // Crowbar if (((maintenanceProblems >> 5) & 1) == 0) { - textList.add(Component.translatable("gtceu.multiblock.universal.problem.crowbar").withStyle(ChatFormatting.GRAY)); + textList.add(Component.translatable("gtceu.multiblock.universal.problem.crowbar") + .withStyle(ChatFormatting.GRAY)); } } return this; } private void addMaintenanceProblemHeader() { - textList.add(Component.translatable("gtceu.multiblock.universal.has_problems").withStyle(ChatFormatting.YELLOW)); + textList.add( + Component.translatable("gtceu.multiblock.universal.has_problems").withStyle(ChatFormatting.YELLOW)); } /** @@ -435,8 +458,10 @@ public Builder addMufflerObstructedLine(boolean isObstructed) { if (!isStructureFormed) return this; if (isObstructed) { - textList.add(Component.translatable("gtceu.multiblock.universal.muffler_obstructed").withStyle(ChatFormatting.RED)); - textList.add(Component.translatable("gtceu.multiblock.universal.muffler_obstructed.tooltip").withStyle(ChatFormatting.GRAY)); + textList.add(Component.translatable("gtceu.multiblock.universal.muffler_obstructed") + .withStyle(ChatFormatting.RED)); + textList.add(Component.translatable("gtceu.multiblock.universal.muffler_obstructed.tooltip") + .withStyle(ChatFormatting.GRAY)); } return this; } @@ -450,10 +475,11 @@ public Builder addFuelNeededLine(String fuelName, int previousRecipeDuration) { if (!isStructureFormed || !isActive) return this; Component fuelNeeded = Component.literal(fuelName).withStyle(ChatFormatting.RED); - Component numTicks = Component.literal(FormattingUtil.formatNumbers(previousRecipeDuration)).withStyle(ChatFormatting.AQUA); + Component numTicks = Component.literal(FormattingUtil.formatNumbers(previousRecipeDuration)) + .withStyle(ChatFormatting.AQUA); textList.add(Component.translatable( - "gtceu.multiblock.turbine.fuel_needed", - fuelNeeded, numTicks).withStyle(ChatFormatting.GRAY)); + "gtceu.multiblock.turbine.fuel_needed", + fuelNeeded, numTicks).withStyle(ChatFormatting.GRAY)); return this; } @@ -473,4 +499,4 @@ public Builder addCustom(Consumer> customConsumer) { return this; } } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/PartAbility.java b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/PartAbility.java index 713545e15e..ce2fb49ae8 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/PartAbility.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/PartAbility.java @@ -1,13 +1,11 @@ package com.gregtechceu.gtceu.api.machine.multiblock; -import com.gregtechceu.gtceu.api.capability.IObjectHolder; -import com.gregtechceu.gtceu.api.capability.IOpticalComputationHatch; +import net.minecraft.world.level.block.Block; + import com.google.common.base.Suppliers; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import lombok.Getter; -import net.minecraft.world.level.block.Block; -import net.minecraftforge.items.IItemHandlerModifiable; import org.apache.commons.lang3.ArrayUtils; import java.util.*; @@ -17,10 +15,11 @@ * @author KilaBash * @date 2023/3/4 * @implNote MultiblockAbility - * Fine, It's not really needed。It used to specify which blocks are available. - * Only registered blocks can be used as part of gtceu's multiblock. + * Fine, It's not really needed。It used to specify which blocks are available. + * Only registered blocks can be used as part of gtceu's multiblock. */ public class PartAbility { + public static final PartAbility EXPORT_ITEMS = new PartAbility("export_items"); public static final PartAbility IMPORT_ITEMS = new PartAbility("import_items"); public static final PartAbility EXPORT_FLUIDS = new PartAbility("export_fluids"); @@ -67,9 +66,8 @@ public class PartAbility { */ private final Int2ObjectMap> registry = new Int2ObjectOpenHashMap<>(); - private Supplier> allBlocks = Suppliers.memoize(() -> - registry.values().stream().flatMap(Collection::stream).toList() - ); + private Supplier> allBlocks = Suppliers + .memoize(() -> registry.values().stream().flatMap(Collection::stream).toList()); @Getter private final String name; @@ -106,5 +104,4 @@ public Collection getBlockRange(int from, int to) { .flatMap(entry -> entry.getValue().stream()) .toList(); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/TieredWorkableElectricMultiblockMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/TieredWorkableElectricMultiblockMachine.java index 40925c9f1f..a05f44afed 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/TieredWorkableElectricMultiblockMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/TieredWorkableElectricMultiblockMachine.java @@ -4,11 +4,14 @@ import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; import com.gregtechceu.gtceu.api.machine.feature.IOverclockMachine; import com.gregtechceu.gtceu.api.machine.feature.ITieredMachine; + import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import lombok.Getter; + import net.minecraft.MethodsReturnNonnullByDefault; +import lombok.Getter; + import javax.annotation.ParametersAreNonnullByDefault; /** @@ -18,8 +21,11 @@ */ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault -public class TieredWorkableElectricMultiblockMachine extends WorkableElectricMultiblockMachine implements ITieredMachine, IOverclockMachine { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(TieredWorkableElectricMultiblockMachine.class, WorkableElectricMultiblockMachine.MANAGED_FIELD_HOLDER); +public class TieredWorkableElectricMultiblockMachine extends WorkableElectricMultiblockMachine + implements ITieredMachine, IOverclockMachine { + + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( + TieredWorkableElectricMultiblockMachine.class, WorkableElectricMultiblockMachine.MANAGED_FIELD_HOLDER); private final int tier; @Persisted @@ -32,7 +38,7 @@ public TieredWorkableElectricMultiblockMachine(IMachineBlockEntity holder, int t } ////////////////////////////////////// - //***** Initialization ******// + // ***** Initialization ******// ////////////////////////////////////// @Override public ManagedFieldHolder getFieldHolder() { @@ -40,7 +46,7 @@ public ManagedFieldHolder getFieldHolder() { } ////////////////////////////////////// - //******** OVERCLOCK *********// + // ******** OVERCLOCK *********// ////////////////////////////////////// @Override public int getMinOverclockTier() { @@ -61,7 +67,7 @@ public long getOverclockVoltage() { } ////////////////////////////////////// - //****** RECIPE LOGIC *******// + // ****** RECIPE LOGIC *******// ////////////////////////////////////// @Override public int getTier() { diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/WorkableElectricMultiblockMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/WorkableElectricMultiblockMachine.java index 8d26455f3e..017a050c13 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/WorkableElectricMultiblockMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/WorkableElectricMultiblockMachine.java @@ -18,18 +18,21 @@ import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiPart; import com.gregtechceu.gtceu.api.misc.EnergyContainerList; import com.gregtechceu.gtceu.utils.GTUtil; + import com.lowdragmc.lowdraglib.gui.modular.ModularUI; import com.lowdragmc.lowdraglib.gui.widget.*; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Player; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.ArrayList; import java.util.List; import java.util.Objects; import java.util.Optional; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author KilaBash * @date 2023/3/6 @@ -37,7 +40,9 @@ */ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault -public class WorkableElectricMultiblockMachine extends WorkableMultiblockMachine implements IFancyUIMachine, IDisplayUIMachine, ITieredMachine, IOverclockMachine { +public class WorkableElectricMultiblockMachine extends WorkableMultiblockMachine implements IFancyUIMachine, + IDisplayUIMachine, ITieredMachine, IOverclockMachine { + // runtime protected EnergyContainerList energyContainer; @@ -46,7 +51,7 @@ public WorkableElectricMultiblockMachine(IMachineBlockEntity holder, Object... a } ////////////////////////////////////// - //*** Multiblock Lifecycle ***// + // *** Multiblock Lifecycle ***// ////////////////////////////////////// @Override public void onStructureInvalid() { @@ -67,25 +72,26 @@ public void onPartUnload() { } ////////////////////////////////////// - //********** GUI ***********// + // ********** GUI ***********// ////////////////////////////////////// @Override public void addDisplayText(List textList) { int numParallels = 0; - Optional optional = this.getParts().stream().filter(IParallelHatch.class::isInstance).map(IParallelHatch.class::cast).findAny(); + Optional optional = this.getParts().stream().filter(IParallelHatch.class::isInstance) + .map(IParallelHatch.class::cast).findAny(); if (optional.isPresent()) { IParallelHatch parallelHatch = optional.get(); numParallels = parallelHatch.getCurrentParallel(); } MultiblockDisplayText.builder(textList, isFormed()) - .setWorkingStatus(recipeLogic.isWorkingEnabled(), recipeLogic.isActive()) - .addEnergyUsageLine(energyContainer) - .addEnergyTierLine(GTUtil.getTierByVoltage(getMaxVoltage())) - .addMachineModeLine(getRecipeType()) - .addParallelsLine(numParallels) - .addWorkingStatusLine() - .addProgressLine(recipeLogic.getProgressPercent()); + .setWorkingStatus(recipeLogic.isWorkingEnabled(), recipeLogic.isActive()) + .addEnergyUsageLine(energyContainer) + .addEnergyTierLine(GTUtil.getTierByVoltage(getMaxVoltage())) + .addMachineModeLine(getRecipeType()) + .addParallelsLine(numParallels) + .addWorkingStatusLine() + .addProgressLine(recipeLogic.getProgressPercent()); getDefinition().getAdditionalDisplay().accept(this, textList); IDisplayUIMachine.super.addDisplayText(textList); } @@ -120,9 +126,8 @@ public void attachTooltips(TooltipsPanel tooltipsPanel) { } } - ////////////////////////////////////// - //******** OVERCLOCK *********// + // ******** OVERCLOCK *********// ////////////////////////////////////// @Override public int getOverclockTier() { @@ -140,9 +145,7 @@ public int getMinOverclockTier() { } @Override - public void setOverclockTier(int tier) { - - } + public void setOverclockTier(int tier) {} @Override public long getOverclockVoltage() { @@ -172,7 +175,7 @@ public long getOverclockVoltage() { } ////////////////////////////////////// - //****** RECIPE LOGIC *******// + // ****** RECIPE LOGIC *******// ////////////////////////////////////// /** diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/WorkableMultiblockMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/WorkableMultiblockMachine.java index d96751bb7f..b70b820b85 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/WorkableMultiblockMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/WorkableMultiblockMachine.java @@ -1,7 +1,5 @@ package com.gregtechceu.gtceu.api.machine.multiblock; -import com.google.common.collect.Table; -import com.google.common.collect.Tables; import com.gregtechceu.gtceu.api.block.ActiveBlock; import com.gregtechceu.gtceu.api.capability.recipe.IO; import com.gregtechceu.gtceu.api.capability.recipe.IRecipeHandler; @@ -16,23 +14,29 @@ import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.GTRecipeType; + import com.lowdragmc.lowdraglib.syncdata.ISubscription; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; + +import net.minecraft.MethodsReturnNonnullByDefault; +import net.minecraft.core.BlockPos; + +import com.google.common.collect.Table; +import com.google.common.collect.Tables; import it.unimi.dsi.fastutil.longs.Long2ObjectMaps; import it.unimi.dsi.fastutil.longs.LongSet; import it.unimi.dsi.fastutil.longs.LongSets; import lombok.Getter; import lombok.Setter; -import net.minecraft.MethodsReturnNonnullByDefault; -import net.minecraft.core.BlockPos; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.jetbrains.annotations.NotNull; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.*; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author KilaBash * @date 2023/3/3 @@ -40,24 +44,36 @@ */ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault -public abstract class WorkableMultiblockMachine extends MultiblockControllerMachine implements IWorkableMultiController, IMufflableMachine { +public abstract class WorkableMultiblockMachine extends MultiblockControllerMachine + implements IWorkableMultiController, IMufflableMachine { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(WorkableMultiblockMachine.class, MultiblockControllerMachine.MANAGED_FIELD_HOLDER); - @Nullable @Getter @Setter + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( + WorkableMultiblockMachine.class, MultiblockControllerMachine.MANAGED_FIELD_HOLDER); + @Nullable + @Getter + @Setter private ICleanroomProvider cleanroom; - @Getter @Persisted @DescSynced + @Getter + @Persisted + @DescSynced public final RecipeLogic recipeLogic; @Getter private final GTRecipeType[] recipeTypes; - @Getter @Setter @Persisted + @Getter + @Setter + @Persisted private int activeRecipeType; @Getter protected final Table, List>> capabilitiesProxy; protected final List traitSubscriptions; - @Getter @Setter @Persisted @DescSynced + @Getter + @Setter + @Persisted + @DescSynced protected boolean isMuffled; protected boolean previouslyMuffled = true; - @Nullable @Getter + @Nullable + @Getter protected LongSet activeBlocks; public WorkableMultiblockMachine(IMachineBlockEntity holder, Object... args) { @@ -70,7 +86,7 @@ public WorkableMultiblockMachine(IMachineBlockEntity holder, Object... args) { } ////////////////////////////////////// - //***** Initialization ******// + // ***** Initialization ******// ////////////////////////////////////// @Override @@ -91,7 +107,7 @@ protected RecipeLogic createRecipeLogic(Object... args) { } ////////////////////////////////////// - //*** Multiblock LifeCycle ***// + // *** Multiblock LifeCycle ***// ////////////////////////////////////// @Override public void onStructureFormed() { @@ -104,7 +120,7 @@ public void onStructureFormed() { Map ioMap = getMultiblockState().getMatchContext().getOrCreate("ioMap", Long2ObjectMaps::emptyMap); for (IMultiPart part : getParts()) { IO io = ioMap.getOrDefault(part.self().getPos().asLong(), IO.BOTH); - if(io == IO.NONE) continue; + if (io == IO.NONE) continue; for (var handler : part.getRecipeHandlers()) { // If IO not compatible if (io != IO.BOTH && handler.getHandlerIO() != IO.BOTH && io != handler.getHandlerIO()) continue; @@ -138,7 +154,7 @@ public void onStructureInvalid() { capabilitiesProxy.clear(); traitSubscriptions.forEach(ISubscription::unsubscribe); traitSubscriptions.clear(); - //reset recipe Logic + // reset recipe Logic recipeLogic.resetRecipeLogic(); } @@ -157,7 +173,7 @@ public void onPartUnload() { } ////////////////////////////////////// - //****** RECIPE LOGIC *******// + // ****** RECIPE LOGIC *******// ////////////////////////////////////// @Override diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/part/MultiblockPartMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/part/MultiblockPartMachine.java index 6455e938d3..89e82d16e9 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/part/MultiblockPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/part/MultiblockPartMachine.java @@ -2,23 +2,25 @@ import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; import com.gregtechceu.gtceu.api.machine.MetaMachine; -import com.gregtechceu.gtceu.api.machine.feature.IFancyUIMachine; +import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiController; import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiPart; import com.gregtechceu.gtceu.api.machine.trait.IRecipeHandlerTrait; -import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiController; -import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; + import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; +import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerLevel; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author KilaBash * @date 2023/3/4 @@ -28,7 +30,8 @@ @MethodsReturnNonnullByDefault public class MultiblockPartMachine extends MetaMachine implements IMultiPart { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(MultiblockPartMachine.class, MetaMachine.MANAGED_FIELD_HOLDER); + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(MultiblockPartMachine.class, + MetaMachine.MANAGED_FIELD_HOLDER); @DescSynced @RequireRerender @@ -40,7 +43,7 @@ public MultiblockPartMachine(IMachineBlockEntity holder) { } ////////////////////////////////////// - //***** Initialization ******// + // ***** Initialization ******// ////////////////////////////////////// @Override @@ -71,7 +74,8 @@ public List getControllers() { @Override public List getRecipeHandlers() { - return traits.stream().filter(IRecipeHandlerTrait.class::isInstance).map(IRecipeHandlerTrait.class::cast).toList(); + return traits.stream().filter(IRecipeHandlerTrait.class::isInstance).map(IRecipeHandlerTrait.class::cast) + .toList(); } @Override @@ -79,7 +83,8 @@ public void onUnload() { super.onUnload(); var level = getLevel(); for (BlockPos pos : controllerPositions) { - if (level instanceof ServerLevel && level.isLoaded(pos) && MetaMachine.getMachine(level, pos) instanceof IMultiController controller) { + if (level instanceof ServerLevel && level.isLoaded(pos) && + MetaMachine.getMachine(level, pos) instanceof IMultiController controller) { controller.onPartUnload(); } } @@ -87,7 +92,7 @@ public void onUnload() { } ////////////////////////////////////// - //*** Multiblock LifeCycle ***// + // *** Multiblock LifeCycle ***// ////////////////////////////////////// @Override @@ -99,5 +104,4 @@ public void removedFromController(IMultiController controller) { public void addedToController(IMultiController controller) { controllerPositions.add(controller.self().getPos()); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/part/TieredIOPartMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/part/TieredIOPartMachine.java index d04599a3e1..05f243b1fe 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/part/TieredIOPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/part/TieredIOPartMachine.java @@ -3,13 +3,16 @@ import com.gregtechceu.gtceu.api.capability.IControllable; import com.gregtechceu.gtceu.api.capability.recipe.IO; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; -import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; + 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 net.minecraft.MethodsReturnNonnullByDefault; + import lombok.Getter; import lombok.Setter; -import net.minecraft.MethodsReturnNonnullByDefault; import org.jetbrains.annotations.Nullable; import javax.annotation.ParametersAreNonnullByDefault; @@ -23,14 +26,19 @@ @MethodsReturnNonnullByDefault public class TieredIOPartMachine extends TieredPartMachine implements IControllable { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(TieredIOPartMachine.class, MultiblockPartMachine.MANAGED_FIELD_HOLDER); + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(TieredIOPartMachine.class, + MultiblockPartMachine.MANAGED_FIELD_HOLDER); protected final IO io; /** * AUTO IO working? */ - @Getter @Setter @Persisted @DescSynced @RequireRerender + @Getter + @Setter + @Persisted + @DescSynced + @RequireRerender protected boolean workingEnabled; public TieredIOPartMachine(IMachineBlockEntity holder, int tier, IO io) { @@ -40,7 +48,7 @@ public TieredIOPartMachine(IMachineBlockEntity holder, int tier, IO io) { } ////////////////////////////////////// - //***** Initialization ******// + // ***** Initialization ******// ////////////////////////////////////// @Override diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/part/TieredPartMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/part/TieredPartMachine.java index b22789265a..cedaafbdbf 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/part/TieredPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/part/TieredPartMachine.java @@ -2,9 +2,11 @@ import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; import com.gregtechceu.gtceu.api.machine.feature.ITieredMachine; -import lombok.Getter; + import net.minecraft.MethodsReturnNonnullByDefault; +import lombok.Getter; + import javax.annotation.ParametersAreNonnullByDefault; /** @@ -23,5 +25,4 @@ public TieredPartMachine(IMachineBlockEntity holder, int tier) { super(holder); this.tier = tier; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/steam/SimpleSteamMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/steam/SimpleSteamMachine.java index 245711d29a..2398ac323c 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/steam/SimpleSteamMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/steam/SimpleSteamMachine.java @@ -1,6 +1,5 @@ package com.gregtechceu.gtceu.api.machine.steam; -import com.google.common.collect.Tables; import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.capability.recipe.EURecipeCapability; import com.gregtechceu.gtceu.api.capability.recipe.IO; @@ -19,29 +18,36 @@ import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.RecipeHelper; import com.gregtechceu.gtceu.common.recipe.VentCondition; + import com.lowdragmc.lowdraglib.gui.modular.ModularUI; import com.lowdragmc.lowdraglib.gui.widget.LabelWidget; import com.lowdragmc.lowdraglib.side.fluid.FluidHelper; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; import com.lowdragmc.lowdraglib.utils.Position; -import lombok.Setter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; + +import com.google.common.collect.Tables; +import lombok.Setter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.*; +import javax.annotation.ParametersAreNonnullByDefault; + @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault -public class SimpleSteamMachine extends SteamWorkableMachine implements IExhaustVentMachine, IMachineModifyDrops, IUIMachine { +public class SimpleSteamMachine extends SteamWorkableMachine + implements IExhaustVentMachine, IMachineModifyDrops, IUIMachine { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(SimpleSteamMachine.class, SteamWorkableMachine.MANAGED_FIELD_HOLDER); + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(SimpleSteamMachine.class, + SteamWorkableMachine.MANAGED_FIELD_HOLDER); @Persisted public final NotifiableItemStackHandler importItems; @@ -58,7 +64,7 @@ public SimpleSteamMachine(IMachineBlockEntity holder, boolean isHighPressure, Ob } ////////////////////////////////////// - //***** Initialization *****// + // ***** Initialization *****// ////////////////////////////////////// @Override @@ -94,7 +100,7 @@ public void onDrops(List drops, Player entity) { } ////////////////////////////////////// - //****** Venting Logic ******// + // ****** Venting Logic ******// ////////////////////////////////////// @Override @@ -118,7 +124,7 @@ public void markVentingComplete() { } ////////////////////////////////////// - //****** Recipe Logic ******// + // ****** Recipe Logic ******// ////////////////////////////////////// @Nullable @@ -149,7 +155,7 @@ public void afterWorking() { } ////////////////////////////////////// - //*********** GUI ***********// + // *********** GUI ***********// ////////////////////////////////////// @Override @@ -159,19 +165,23 @@ public ModularUI createUI(Player entityPlayer) { storages.put(IO.OUT, ItemRecipeCapability.CAP, exportItems.storage); var group = getRecipeType().getRecipeUI().createUITemplate(recipeLogic::getProgressPercent, - storages, - new CompoundTag(), - Collections.emptyList(), - true, - isHighPressure); - Position pos = new Position((Math.max(group.getSize().width + 4 + 8, 176) - 4 - group.getSize().width) / 2 + 4, 32); + storages, + new CompoundTag(), + Collections.emptyList(), + true, + isHighPressure); + Position pos = new Position((Math.max(group.getSize().width + 4 + 8, 176) - 4 - group.getSize().width) / 2 + 4, + 32); group.setSelfPosition(pos); return new ModularUI(176, 166, this, entityPlayer) .background(GuiTextures.BACKGROUND_STEAM.get(isHighPressure)) .widget(group) .widget(new LabelWidget(5, 5, getBlockState().getBlock().getDescriptionId())) - .widget(new PredicatedImageWidget(pos.x + group.getSize().width / 2 - 9, pos.y + group.getSize().height / 2 - 9, 18, 18, GuiTextures.INDICATOR_NO_STEAM.get(isHighPressure)) + .widget(new PredicatedImageWidget(pos.x + group.getSize().width / 2 - 9, + pos.y + group.getSize().height / 2 - 9, 18, 18, + GuiTextures.INDICATOR_NO_STEAM.get(isHighPressure)) .setPredicate(recipeLogic::isWaiting)) - .widget(UITemplate.bindPlayerInventory(entityPlayer.getInventory(), GuiTextures.SLOT_STEAM.get(isHighPressure), 7, 84, true)); + .widget(UITemplate.bindPlayerInventory(entityPlayer.getInventory(), + GuiTextures.SLOT_STEAM.get(isHighPressure), 7, 84, true)); } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/steam/SteamBoilerMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/steam/SteamBoilerMachine.java index 18ce48cab7..8b3a431e2b 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/steam/SteamBoilerMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/steam/SteamBoilerMachine.java @@ -16,6 +16,7 @@ import com.gregtechceu.gtceu.common.item.PortableScannerBehavior; import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.utils.FormattingUtil; + import com.lowdragmc.lowdraglib.gui.modular.ModularUI; import com.lowdragmc.lowdraglib.gui.texture.ProgressTexture; import com.lowdragmc.lowdraglib.gui.widget.ImageWidget; @@ -28,7 +29,7 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import lombok.Getter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.client.resources.language.I18n; import net.minecraft.core.BlockPos; @@ -44,17 +45,18 @@ import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.material.Fluids; import net.minecraft.world.phys.BlockHitResult; + +import lombok.Getter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.jetbrains.annotations.NotNull; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author KilaBash * @date 2023/3/14 @@ -62,13 +64,16 @@ */ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault -public abstract class SteamBoilerMachine extends SteamWorkableMachine implements IUIMachine, IExplosionMachine, IDataInfoProvider { +public abstract class SteamBoilerMachine extends SteamWorkableMachine + implements IUIMachine, IExplosionMachine, IDataInfoProvider { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(SteamBoilerMachine.class, SteamWorkableMachine.MANAGED_FIELD_HOLDER); + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(SteamBoilerMachine.class, + SteamWorkableMachine.MANAGED_FIELD_HOLDER); @Persisted public final NotifiableFluidTank waterTank; - @Persisted @DescSynced + @Persisted + @DescSynced private int currentTemperature; @Persisted private int timeBeforeCoolingDown; @@ -86,7 +91,7 @@ public SteamBoilerMachine(IMachineBlockEntity holder, boolean isHighPressure, Ob } ////////////////////////////////////// - //***** Initialization *****// + // ***** Initialization *****// ////////////////////////////////////// @Override public ManagedFieldHolder getFieldHolder() { @@ -127,7 +132,7 @@ public void setOutputFacing(@NotNull Direction outputFacing) { } ////////////////////////////////////// - //******* Auto Output *******// + // ******* Auto Output *******// ////////////////////////////////////// @Override @@ -139,7 +144,8 @@ public void onNeighborChanged(Block block, BlockPos fromPos, boolean isMoving) { protected void updateAutoOutputSubscription() { if (Direction.stream() .filter(direction -> direction != getFrontFacing() && direction != Direction.DOWN) - .anyMatch(direction -> FluidTransferHelper.getFluidTransfer(getLevel(), getPos().relative(direction), direction.getOpposite()) != null)) { + .anyMatch(direction -> FluidTransferHelper.getFluidTransfer(getLevel(), getPos().relative(direction), + direction.getOpposite()) != null)) { autoOutputSubs = subscribeServerTick(autoOutputSubs, this::autoOutput); } else if (autoOutputSubs != null) { autoOutputSubs.unsubscribe(); @@ -159,7 +165,7 @@ protected void autoOutput() { } ////////////////////////////////////// - //****** Recipe Logic ******// + // ****** Recipe Logic ******// ////////////////////////////////////// protected void updateSteamSubscription() { @@ -186,15 +192,17 @@ protected void updateCurrentTemperature() { currentTemperature -= getCoolDownRate(); timeBeforeCoolingDown = getCooldownInterval(); } - } else --timeBeforeCoolingDown; + } else--timeBeforeCoolingDown; if (getOffsetTimer() % 10 == 0) { if (currentTemperature >= 100) { - long fillAmount = (long) (getBaseSteamOutput() * (currentTemperature / (getMaxTemperature() * 1.0)) / 2); + long fillAmount = (long) (getBaseSteamOutput() * (currentTemperature / (getMaxTemperature() * 1.0)) / + 2); boolean hasDrainedWater = !waterTank.drainInternal(FluidHelper.getBucket() / 1000, false).isEmpty(); var filledSteam = 0L; if (hasDrainedWater) { - filledSteam = steamTank.fillInternal(GTMaterials.Steam.getFluid(fillAmount * FluidHelper.getBucket() / 1000), false); + filledSteam = steamTank.fillInternal( + GTMaterials.Steam.getFluid(fillAmount * FluidHelper.getBucket() / 1000), false); } if (this.hasNoWater && hasDrainedWater) { doExplosion(2.0f); @@ -214,7 +222,8 @@ protected void updateCurrentTemperature() { getFrontFacing().getStepZ() / 2.0, 0.1); if (ConfigHolder.INSTANCE.machines.machineSounds) { - getLevel().playSound(null, x, y, z, SoundEvents.LAVA_EXTINGUISH, SoundSource.BLOCKS, 1.0f, 1.0f); + getLevel().playSound(null, x, y, z, SoundEvents.LAVA_EXTINGUISH, SoundSource.BLOCKS, 1.0f, + 1.0f); } // bypass capability check for special case behavior @@ -248,7 +257,7 @@ private double getTemperaturePercent() { public static GTRecipe recipeModifier(MetaMachine machine, @NotNull GTRecipe recipe) { if (machine instanceof SteamBoilerMachine boilerMachine) { recipe = recipe.copy(); - //recipe.duration *= 12; // maybe? + // recipe.duration *= 12; // maybe? recipe.duration = boilerMachine.isHighPressure ? recipe.duration / 2 : recipe.duration; return recipe; } @@ -272,16 +281,17 @@ public void afterWorking() { } ////////////////////////////////////// - //******* Interaction *******// + // ******* Interaction *******// ////////////////////////////////////// @Override - protected InteractionResult onSoftMalletClick(Player playerIn, InteractionHand hand, Direction gridSide, BlockHitResult hitResult) { + protected InteractionResult onSoftMalletClick(Player playerIn, InteractionHand hand, Direction gridSide, + BlockHitResult hitResult) { return InteractionResult.PASS; } ////////////////////////////////////// - //********** GUI ***********// + // ********** GUI ***********// ////////////////////////////////////// @Override @@ -290,9 +300,11 @@ public ModularUI createUI(Player entityPlayer) { .background(GuiTextures.BACKGROUND_STEAM.get(isHighPressure)) .widget(new LabelWidget(6, 6, getBlockState().getBlock().getDescriptionId())) .widget(new ProgressWidget(this::getTemperaturePercent, 96, 26, 10, 54) - .setProgressTexture(GuiTextures.PROGRESS_BAR_BOILER_EMPTY.get(isHighPressure), GuiTextures.PROGRESS_BAR_BOILER_HEAT) + .setProgressTexture(GuiTextures.PROGRESS_BAR_BOILER_EMPTY.get(isHighPressure), + GuiTextures.PROGRESS_BAR_BOILER_HEAT) .setFillDirection(ProgressTexture.FillDirection.DOWN_TO_UP) - .setDynamicHoverTips(pct -> I18n.get("gtceu.multiblock.large_boiler.temperature", (int) (currentTemperature + 274.15), (int) (getMaxTemperature() + 274.15)))) + .setDynamicHoverTips(pct -> I18n.get("gtceu.multiblock.large_boiler.temperature", + (int) (currentTemperature + 274.15), (int) (getMaxTemperature() + 274.15)))) .widget(new TankWidget(waterTank.getStorages()[0], 83, 26, 10, 54, false, true) .setShowAmount(false) .setFillDirection(ProgressTexture.FillDirection.DOWN_TO_UP) @@ -302,11 +314,12 @@ public ModularUI createUI(Player entityPlayer) { .setFillDirection(ProgressTexture.FillDirection.DOWN_TO_UP) .setBackground(GuiTextures.PROGRESS_BAR_BOILER_EMPTY.get(isHighPressure))) .widget(new ImageWidget(43, 44, 18, 18, GuiTextures.CANISTER_OVERLAY_STEAM.get(isHighPressure))) - .widget(UITemplate.bindPlayerInventory(entityPlayer.getInventory(), GuiTextures.SLOT_STEAM.get(isHighPressure), 7, 84, true)); + .widget(UITemplate.bindPlayerInventory(entityPlayer.getInventory(), + GuiTextures.SLOT_STEAM.get(isHighPressure), 7, 84, true)); } ////////////////////////////////////// - //********* Client *********// + // ********* Client *********// ////////////////////////////////////// @Override @@ -341,9 +354,10 @@ protected void randomDisplayTick(RandomSource random, float x, float y, float z) @NotNull @Override public List getDataInfo(PortableScannerBehavior.DisplayMode mode) { - if (mode == PortableScannerBehavior.DisplayMode.SHOW_ALL || mode == PortableScannerBehavior.DisplayMode.SHOW_MACHINE_INFO) { + if (mode == PortableScannerBehavior.DisplayMode.SHOW_ALL || + mode == PortableScannerBehavior.DisplayMode.SHOW_MACHINE_INFO) { return Collections.singletonList(Component.translatable("gtceu.machine.steam_boiler.heat_amount", - FormattingUtil.formatNumbers((int) (getTemperaturePercent() * 100)))); + FormattingUtil.formatNumbers((int) (getTemperaturePercent() * 100)))); } return new ArrayList<>(); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/steam/SteamEnergyRecipeHandler.java b/src/main/java/com/gregtechceu/gtceu/api/machine/steam/SteamEnergyRecipeHandler.java index a0f8570b49..c1270947d2 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/steam/SteamEnergyRecipeHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/steam/SteamEnergyRecipeHandler.java @@ -1,15 +1,16 @@ package com.gregtechceu.gtceu.api.machine.steam; -import com.gregtechceu.gtceu.api.capability.recipe.RecipeCapability; import com.gregtechceu.gtceu.api.capability.recipe.EURecipeCapability; import com.gregtechceu.gtceu.api.capability.recipe.IO; import com.gregtechceu.gtceu.api.capability.recipe.IRecipeHandler; +import com.gregtechceu.gtceu.api.capability.recipe.RecipeCapability; import com.gregtechceu.gtceu.api.machine.trait.NotifiableFluidTank; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.ingredient.FluidIngredient; import com.gregtechceu.gtceu.common.data.GTMaterials; -import com.gregtechceu.gtceu.data.recipe.CustomTags; + import com.lowdragmc.lowdraglib.side.fluid.FluidStack; + import org.jetbrains.annotations.Nullable; import java.util.ArrayList; @@ -24,7 +25,7 @@ public class SteamEnergyRecipeHandler implements IRecipeHandler { private final NotifiableFluidTank steamTank; - private final double conversionRate; //energy units per millibucket + private final double conversionRate; // energy units per millibucket public SteamEnergyRecipeHandler(NotifiableFluidTank steamTank, double conversionRate) { this.steamTank = steamTank; @@ -32,11 +33,13 @@ public SteamEnergyRecipeHandler(NotifiableFluidTank steamTank, double conversion } @Override - public List handleRecipeInner(IO io, GTRecipe recipe, List left, @Nullable String slotName, boolean simulate) { + public List handleRecipeInner(IO io, GTRecipe recipe, List left, @Nullable String slotName, + boolean simulate) { long sum = left.stream().reduce(0L, Long::sum); long realSum = (long) Math.ceil(sum * conversionRate); if (realSum > 0) { - var steam = io == IO.IN ? FluidIngredient.of(GTMaterials.Steam.getFluidTag(), realSum) : FluidIngredient.of(GTMaterials.Steam.getFluid(realSum)); + var steam = io == IO.IN ? FluidIngredient.of(GTMaterials.Steam.getFluidTag(), realSum) : + FluidIngredient.of(GTMaterials.Steam.getFluid(realSum)); var list = new ArrayList(); list.add(steam); var leftSteam = steamTank.handleRecipeInner(io, recipe, list, slotName, simulate); diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/steam/SteamMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/steam/SteamMachine.java index fca1550fd2..28bde9c8fb 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/steam/SteamMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/steam/SteamMachine.java @@ -2,15 +2,17 @@ import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; import com.gregtechceu.gtceu.api.machine.MetaMachine; -import com.gregtechceu.gtceu.api.machine.trait.NotifiableFluidTank; import com.gregtechceu.gtceu.api.machine.feature.ITieredMachine; +import com.gregtechceu.gtceu.api.machine.trait.NotifiableFluidTank; import com.gregtechceu.gtceu.common.data.GTMaterials; -import com.gregtechceu.gtceu.data.recipe.CustomTags; + import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import lombok.Getter; + import net.minecraft.MethodsReturnNonnullByDefault; +import lombok.Getter; + import javax.annotation.ParametersAreNonnullByDefault; /** @@ -21,7 +23,9 @@ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public abstract class SteamMachine extends MetaMachine implements ITieredMachine { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(SteamMachine.class, MetaMachine.MANAGED_FIELD_HOLDER); + + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(SteamMachine.class, + MetaMachine.MANAGED_FIELD_HOLDER); @Getter public final boolean isHighPressure; @@ -36,7 +40,7 @@ public SteamMachine(IMachineBlockEntity holder, boolean isHighPressure, Object.. } ////////////////////////////////////// - //***** Initialization *****// + // ***** Initialization *****// ////////////////////////////////////// @Override public ManagedFieldHolder getFieldHolder() { diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/steam/SteamWorkableMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/steam/SteamWorkableMachine.java index a8aff7fb33..d606030184 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/steam/SteamWorkableMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/steam/SteamWorkableMachine.java @@ -1,7 +1,5 @@ package com.gregtechceu.gtceu.api.machine.steam; -import com.google.common.collect.Table; -import com.google.common.collect.Tables; import com.gregtechceu.gtceu.api.capability.recipe.IO; import com.gregtechceu.gtceu.api.capability.recipe.IRecipeHandler; import com.gregtechceu.gtceu.api.capability.recipe.RecipeCapability; @@ -15,26 +13,32 @@ import com.gregtechceu.gtceu.api.machine.trait.MachineTrait; import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; import com.gregtechceu.gtceu.api.recipe.GTRecipeType; -import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; + import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; import com.lowdragmc.lowdraglib.syncdata.ISubscription; 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 lombok.Getter; -import lombok.Setter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.phys.BlockHitResult; + +import com.google.common.collect.Table; +import com.google.common.collect.Tables; +import lombok.Getter; +import lombok.Setter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.*; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author KilaBash * @date 2023/3/14 @@ -43,18 +47,31 @@ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public abstract class SteamWorkableMachine extends SteamMachine implements IRecipeLogicMachine, IMufflableMachine { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(SteamWorkableMachine.class, SteamMachine.MANAGED_FIELD_HOLDER); - @Nullable @Getter @Setter + + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(SteamWorkableMachine.class, + SteamMachine.MANAGED_FIELD_HOLDER); + @Nullable + @Getter + @Setter private ICleanroomProvider cleanroom; - @Getter @Persisted @DescSynced + @Getter + @Persisted + @DescSynced public final RecipeLogic recipeLogic; @Getter public final GTRecipeType[] recipeTypes; - @Getter @Setter + @Getter + @Setter public int activeRecipeType; - @Persisted @DescSynced @Getter @RequireRerender + @Persisted + @DescSynced + @Getter + @RequireRerender protected Direction outputFacing; - @Persisted @DescSynced @Getter @Setter + @Persisted + @DescSynced + @Getter + @Setter protected boolean isMuffled; protected boolean previouslyMuffled = true; @Getter @@ -72,7 +89,7 @@ public SteamWorkableMachine(IMachineBlockEntity holder, boolean isHighPressure, } ////////////////////////////////////// - //***** Initialization *****// + // ***** Initialization *****// ////////////////////////////////////// @Override public ManagedFieldHolder getFieldHolder() { @@ -116,7 +133,8 @@ public void setOutputFacing(@NotNull Direction outputFacing) { } @Override - protected InteractionResult onWrenchClick(Player playerIn, InteractionHand hand, Direction gridSide, BlockHitResult hitResult) { + protected InteractionResult onWrenchClick(Player playerIn, InteractionHand hand, Direction gridSide, + BlockHitResult hitResult) { if (!playerIn.isShiftKeyDown() && !isRemote()) { if (hasFrontFacing() && gridSide == getFrontFacing()) return InteractionResult.PASS; setOutputFacing(gridSide); @@ -148,7 +166,7 @@ public void clientTick() { } ////////////////////////////////////// - //******* Rendering ********// + // ******* Rendering ********// ////////////////////////////////////// @Override public ResourceTexture sideTips(Player player, Set toolTypes, Direction side) { diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/FluidTankProxyTrait.java b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/FluidTankProxyTrait.java index 6ca0771ac7..ca26fee864 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/FluidTankProxyTrait.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/FluidTankProxyTrait.java @@ -2,14 +2,17 @@ import com.gregtechceu.gtceu.api.capability.recipe.IO; import com.gregtechceu.gtceu.api.machine.MetaMachine; + import com.lowdragmc.lowdraglib.side.fluid.FluidStack; import com.lowdragmc.lowdraglib.side.fluid.FluidTransferHelper; import com.lowdragmc.lowdraglib.side.fluid.IFluidTransfer; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; + +import net.minecraft.core.Direction; + import lombok.Getter; import lombok.Setter; import lombok.experimental.Accessors; -import net.minecraft.core.Direction; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -24,7 +27,9 @@ public class FluidTankProxyTrait extends MachineTrait implements IFluidTransfer, public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(FluidTankProxyTrait.class); @Getter public final IO capabilityIO; - @Setter @Getter @Nullable + @Setter + @Getter + @Nullable public IFluidTransfer proxy; public FluidTankProxyTrait(MetaMachine machine, IO capabilityIO) { @@ -38,7 +43,7 @@ public ManagedFieldHolder getFieldHolder() { } ////////////////////////////////////// - //******* Capability ********// + // ******* Capability ********// ////////////////////////////////////// @Override @@ -177,7 +182,8 @@ public void exportToNearby(Direction... facings) { var level = getMachine().getLevel(); var pos = getMachine().getPos(); for (Direction facing : facings) { - FluidTransferHelper.exportToTarget(this, Integer.MAX_VALUE, f -> true, level, pos.relative(facing), facing.getOpposite()); + FluidTransferHelper.exportToTarget(this, Integer.MAX_VALUE, f -> true, level, pos.relative(facing), + facing.getOpposite()); } } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/ICapabilityTrait.java b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/ICapabilityTrait.java index 55ae8bcb6c..7b9a1fc178 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/ICapabilityTrait.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/ICapabilityTrait.java @@ -8,6 +8,7 @@ * @implNote ICapabilityTrait */ public interface ICapabilityTrait { + IO getCapabilityIO(); default boolean canCapInput() { diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/IRecipeHandlerTrait.java b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/IRecipeHandlerTrait.java index b443415997..8d46d74716 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/IRecipeHandlerTrait.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/IRecipeHandlerTrait.java @@ -2,6 +2,7 @@ import com.gregtechceu.gtceu.api.capability.recipe.IO; import com.gregtechceu.gtceu.api.capability.recipe.IRecipeHandler; + import com.lowdragmc.lowdraglib.syncdata.ISubscription; /** @@ -10,6 +11,7 @@ * @implNote IRecipeHandlerTrait */ public interface IRecipeHandlerTrait extends IRecipeHandler { + IO getHandlerIO(); /** diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/ItemHandlerProxyRecipeTrait.java b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/ItemHandlerProxyRecipeTrait.java index 3d8060a397..2104be3975 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/ItemHandlerProxyRecipeTrait.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/ItemHandlerProxyRecipeTrait.java @@ -6,28 +6,34 @@ import com.gregtechceu.gtceu.api.capability.recipe.RecipeCapability; import com.gregtechceu.gtceu.api.machine.MetaMachine; import com.gregtechceu.gtceu.api.recipe.GTRecipe; + +import net.minecraft.world.item.crafting.Ingredient; + import it.unimi.dsi.fastutil.objects.ObjectArrayList; import lombok.Getter; import lombok.Setter; -import net.minecraft.world.item.crafting.Ingredient; import org.jetbrains.annotations.Nullable; import java.util.Collection; import java.util.List; public class ItemHandlerProxyRecipeTrait extends NotifiableRecipeHandlerTrait implements ICapabilityTrait { + @Getter public final IO handlerIO; @Getter public final IO capabilityIO; - @Getter @Setter + @Getter + @Setter private long timeStamp; private boolean enabled; @Getter private final Collection> handlers; - public ItemHandlerProxyRecipeTrait(MetaMachine machine, Collection> handlers, IO handlerIO, IO capabilityIO) { + public ItemHandlerProxyRecipeTrait(MetaMachine machine, + Collection> handlers, IO handlerIO, + IO capabilityIO) { super(machine); this.timeStamp = Long.MIN_VALUE; this.handlerIO = handlerIO; @@ -36,7 +42,8 @@ public ItemHandlerProxyRecipeTrait(MetaMachine machine, Collection handleRecipeInner(IO io, GTRecipe recipe, List left, @Nullable String slotName, boolean simulate) { + public List handleRecipeInner(IO io, GTRecipe recipe, List left, @Nullable String slotName, + boolean simulate) { if (!enabled) return left; for (IRecipeHandler handler : handlers) { handler.handleRecipeInner(io, recipe, left, slotName, simulate); diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/ItemHandlerProxyTrait.java b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/ItemHandlerProxyTrait.java index 6129ab814f..1ce4839499 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/ItemHandlerProxyTrait.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/ItemHandlerProxyTrait.java @@ -1,15 +1,18 @@ package com.gregtechceu.gtceu.api.machine.trait; -import com.gregtechceu.gtceu.api.machine.MetaMachine; import com.gregtechceu.gtceu.api.capability.recipe.IO; +import com.gregtechceu.gtceu.api.machine.MetaMachine; + import com.lowdragmc.lowdraglib.side.item.IItemTransfer; import com.lowdragmc.lowdraglib.side.item.ItemTransferHelper; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; + +import net.minecraft.core.Direction; +import net.minecraft.world.item.ItemStack; + import lombok.Getter; import lombok.Setter; import lombok.experimental.Accessors; -import net.minecraft.core.Direction; -import net.minecraft.world.item.ItemStack; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -24,7 +27,9 @@ public class ItemHandlerProxyTrait extends MachineTrait implements IItemTransfer public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(ItemHandlerProxyTrait.class); @Getter public final IO capabilityIO; - @Setter @Getter @Nullable + @Setter + @Getter + @Nullable public IItemTransfer proxy; public ItemHandlerProxyTrait(MetaMachine machine, IO capabilityIO) { @@ -38,7 +43,7 @@ public ManagedFieldHolder getFieldHolder() { } ////////////////////////////////////// - //******* Capability ********// + // ******* Capability ********// ////////////////////////////////////// @Override @@ -132,8 +137,8 @@ public void exportToNearby(Direction... facings) { var level = getMachine().getLevel(); var pos = getMachine().getPos(); for (Direction facing : facings) { - ItemTransferHelper.exportToTarget(this, Integer.MAX_VALUE, f -> true, level, pos.relative(facing), facing.getOpposite()); + ItemTransferHelper.exportToTarget(this, Integer.MAX_VALUE, f -> true, level, pos.relative(facing), + facing.getOpposite()); } } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/MachineTrait.java b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/MachineTrait.java index b075d8f5ab..adb952746c 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/MachineTrait.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/MachineTrait.java @@ -1,23 +1,26 @@ package com.gregtechceu.gtceu.api.machine.trait; import com.gregtechceu.gtceu.api.machine.MetaMachine; + import com.lowdragmc.lowdraglib.syncdata.IEnhancedManaged; import com.lowdragmc.lowdraglib.syncdata.field.FieldManagedStorage; -import lombok.Getter; -import lombok.Setter; + import net.minecraft.core.Direction; +import lombok.Getter; +import lombok.Setter; import org.jetbrains.annotations.Nullable; -import java.util.function.Predicate; +import java.util.function.Predicate; /** * @author KilaBash * @date 2023/2/18 * @implNote MachineTrait represents an abstract capability held by machine. Such as item, fluid, energy, etc. - * All trait should be added while MetaMachine is creating. you cannot modify it on the fly。 + * All trait should be added while MetaMachine is creating. you cannot modify it on the fly。 */ public abstract class MachineTrait implements IEnhancedManaged { + @Getter private final FieldManagedStorage syncStorage = new FieldManagedStorage(this); @@ -41,13 +44,9 @@ public void onChanged() { machine.onChanged(); } - public void onMachineLoad() { - - } - - public void onMachineUnLoad() { + public void onMachineLoad() {} - } + public void onMachineUnLoad() {} @Override public void scheduleRenderUpdate() { diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableComputationContainer.java b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableComputationContainer.java index bdf3f0a9f7..adc57c3006 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableComputationContainer.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableComputationContainer.java @@ -16,9 +16,11 @@ import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.common.blockentity.OpticalPipeBlockEntity; import com.gregtechceu.gtceu.utils.GTUtil; -import lombok.Getter; + import net.minecraft.core.Direction; import net.minecraft.world.level.block.entity.BlockEntity; + +import lombok.Getter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -26,7 +28,9 @@ import java.util.Collections; import java.util.List; -public class NotifiableComputationContainer extends NotifiableRecipeHandlerTrait implements IOpticalComputationHatch, IOpticalComputationReceiver { +public class NotifiableComputationContainer extends NotifiableRecipeHandlerTrait + implements IOpticalComputationHatch, IOpticalComputationReceiver { + @Getter protected IO handlerIO; @Getter @@ -72,7 +76,8 @@ public int requestCWUt(int cwut, boolean simulate, @NotNull Collection seen) { } } } - GTCEu.LOGGER.error("NotifiableComputationContainer could not get maximum CWU/t from its machine's controller!"); + GTCEu.LOGGER.error( + "NotifiableComputationContainer could not get maximum CWU/t from its machine's controller!"); return 0; } else { GTCEu.LOGGER.error("NotifiableComputationContainer could not get maximum CWU/t from its machine!"); @@ -157,7 +163,8 @@ public boolean canBridge(@NotNull Collection seen) } } } - GTCEu.LOGGER.error("NotifiableComputationContainer could not test bridge status of its machine's controller!"); + GTCEu.LOGGER.error( + "NotifiableComputationContainer could not test bridge status of its machine's controller!"); return false; } else { GTCEu.LOGGER.error("NotifiableComputationContainer could not test bridge status of its machine!"); @@ -175,7 +182,8 @@ public boolean canBridge(@NotNull Collection seen) } @Override - public List handleRecipeInner(IO io, GTRecipe recipe, List left, @Nullable String slotName, boolean simulate) { + public List handleRecipeInner(IO io, GTRecipe recipe, List left, @Nullable String slotName, + boolean simulate) { IOpticalComputationProvider provider = getOpticalNetProvider(); if (provider == null) return left; @@ -240,8 +248,10 @@ public IOpticalComputationProvider getComputationProvider() { } else if (machine instanceof IOpticalComputationProvider provider) { return provider; } else if (machine instanceof IRecipeCapabilityHolder recipeCapabilityHolder) { - if (recipeCapabilityHolder.getCapabilitiesProxy().contains(IO.IN, CWURecipeCapability.CAP) && !recipeCapabilityHolder.getCapabilitiesProxy().get(IO.IN, CWURecipeCapability.CAP).isEmpty()) { - var provider = (IOpticalComputationProvider) recipeCapabilityHolder.getCapabilitiesProxy().get(IO.IN, CWURecipeCapability.CAP).get(0); + if (recipeCapabilityHolder.getCapabilitiesProxy().contains(IO.IN, CWURecipeCapability.CAP) && + !recipeCapabilityHolder.getCapabilitiesProxy().get(IO.IN, CWURecipeCapability.CAP).isEmpty()) { + var provider = (IOpticalComputationProvider) recipeCapabilityHolder.getCapabilitiesProxy() + .get(IO.IN, CWURecipeCapability.CAP).get(0); if (provider != this) { return provider; } @@ -251,9 +261,10 @@ public IOpticalComputationProvider getComputationProvider() { BlockEntity blockEntity = machine.getLevel().getBlockEntity(machine.getPos().relative(direction)); if (blockEntity == null) continue; - //noinspection DataFlowIssue can be null just fine. - IOpticalComputationProvider provider = blockEntity.getCapability(GTCapability.CAPABILITY_COMPUTATION_PROVIDER, direction.getOpposite()).orElse(null); - //noinspection ConstantValue can be null because above. + // noinspection DataFlowIssue can be null just fine. + IOpticalComputationProvider provider = blockEntity + .getCapability(GTCapability.CAPABILITY_COMPUTATION_PROVIDER, direction.getOpposite()).orElse(null); + // noinspection ConstantValue can be null because above. if (provider != null && provider != this) { return provider; } @@ -266,7 +277,8 @@ private IOpticalComputationProvider getOpticalNetProvider() { for (Direction direction : GTUtil.DIRECTIONS) { BlockEntity blockEntity = machine.getLevel().getBlockEntity(machine.getPos().relative(direction)); if (blockEntity instanceof OpticalPipeBlockEntity) { - return blockEntity.getCapability(GTCapability.CAPABILITY_COMPUTATION_PROVIDER, direction.getOpposite()).orElse(null); + return blockEntity.getCapability(GTCapability.CAPABILITY_COMPUTATION_PROVIDER, direction.getOpposite()) + .orElse(null); } } return null; diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableEnergyContainer.java b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableEnergyContainer.java index 21023eebda..e07ddcdc77 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableEnergyContainer.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableEnergyContainer.java @@ -1,6 +1,5 @@ package com.gregtechceu.gtceu.api.machine.trait; - import com.gregtechceu.gtceu.api.capability.GTCapabilityHelper; import com.gregtechceu.gtceu.api.capability.IElectricItem; import com.gregtechceu.gtceu.api.capability.IEnergyContainer; @@ -12,13 +11,16 @@ import com.gregtechceu.gtceu.api.machine.feature.IExplosionMachine; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.utils.GTUtil; + import com.lowdragmc.lowdraglib.side.item.IItemTransfer; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; + +import net.minecraft.core.Direction; + import lombok.Getter; import lombok.Setter; -import net.minecraft.core.Direction; import org.jetbrains.annotations.Nullable; import java.util.Collections; @@ -27,11 +29,13 @@ public class NotifiableEnergyContainer extends NotifiableRecipeHandlerTrait implements IEnergyContainer { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(NotifiableEnergyContainer.class, NotifiableRecipeHandlerTrait.MANAGED_FIELD_HOLDER); + public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( + NotifiableEnergyContainer.class, NotifiableRecipeHandlerTrait.MANAGED_FIELD_HOLDER); @Getter protected IO handlerIO; @Getter - @Persisted @DescSynced + @Persisted + @DescSynced protected long energyStored; @Getter private long energyCapacity, inputVoltage, inputAmperage, outputVoltage, outputAmperage; @@ -44,13 +48,13 @@ public class NotifiableEnergyContainer extends NotifiableRecipeHandlerTrait 0 && (sideInputCondition == null || sideInputCondition.test(side)); + return !outputsEnergy(side) && getInputVoltage() > 0 && + (sideInputCondition == null || sideInputCondition.test(side)); } @Override @@ -257,7 +267,8 @@ public boolean outputsEnergy(Direction side) { @Override public long changeEnergy(long energyToAdd) { long oldEnergyStored = getEnergyStored(); - long newEnergyStored = (energyCapacity - oldEnergyStored < energyToAdd) ? energyCapacity : (oldEnergyStored + energyToAdd); + long newEnergyStored = (energyCapacity - oldEnergyStored < energyToAdd) ? energyCapacity : + (oldEnergyStored + energyToAdd); if (newEnergyStored < 0) newEnergyStored = 0; setEnergyStored(newEnergyStored); @@ -265,7 +276,8 @@ public long changeEnergy(long energyToAdd) { } @Override - public List handleRecipeInner(IO io, GTRecipe recipe, List left, @Nullable String slotName, boolean simulate) { + public List handleRecipeInner(IO io, GTRecipe recipe, List left, @Nullable String slotName, + boolean simulate) { IEnergyContainer capability = this; long sum = left.stream().reduce(0L, Long::sum); if (io == IO.IN) { diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableFluidTank.java b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableFluidTank.java index 79b7370382..5ea7c8a759 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableFluidTank.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableFluidTank.java @@ -6,6 +6,7 @@ import com.gregtechceu.gtceu.api.machine.MetaMachine; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.ingredient.FluidIngredient; + import com.lowdragmc.lowdraglib.misc.FluidStorage; import com.lowdragmc.lowdraglib.side.fluid.FluidHelper; import com.lowdragmc.lowdraglib.side.fluid.FluidStack; @@ -14,9 +15,11 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; + +import net.minecraft.core.Direction; + import lombok.Getter; import lombok.Setter; -import net.minecraft.core.Direction; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -28,9 +31,11 @@ * @date 2023/2/20 * @implNote NotifiableFluidTank */ -public class NotifiableFluidTank extends NotifiableRecipeHandlerTrait implements ICapabilityTrait, IFluidTransfer { +public class NotifiableFluidTank extends NotifiableRecipeHandlerTrait + implements ICapabilityTrait, IFluidTransfer { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(NotifiableFluidTank.class, NotifiableRecipeHandlerTrait.MANAGED_FIELD_HOLDER); + public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(NotifiableFluidTank.class, + NotifiableRecipeHandlerTrait.MANAGED_FIELD_HOLDER); @Getter public final IO handlerIO; @Getter @@ -39,10 +44,12 @@ public class NotifiableFluidTank extends NotifiableRecipeHandlerTrait handleRecipeInner(IO io, GTRecipe recipe, List left, @Nullable String slotName, boolean simulate) { + public List handleRecipeInner(IO io, GTRecipe recipe, List left, + @Nullable String slotName, boolean simulate) { return handleIngredient(io, recipe, left, simulate, this.handlerIO, storages); } @Nullable - public static List handleIngredient(IO io, GTRecipe recipe, List left, boolean simulate, IO handlerIO, FluidStorage[] storages) { + public static List handleIngredient(IO io, GTRecipe recipe, List left, + boolean simulate, IO handlerIO, FluidStorage[] storages) { if (io != handlerIO) return left; - var capabilities = simulate ? Arrays.stream(storages).map(FluidStorage::copy).toArray(FluidStorage[]::new) : storages; + var capabilities = simulate ? Arrays.stream(storages).map(FluidStorage::copy).toArray(FluidStorage[]::new) : + storages; for (FluidStorage capability : capabilities) { Iterator iterator = left.iterator(); if (io == IO.IN) { @@ -257,7 +267,8 @@ public void exportToNearby(@NotNull Direction... facings) { var level = getMachine().getLevel(); var pos = getMachine().getPos(); for (Direction facing : facings) { - FluidTransferHelper.exportToTarget(this, Integer.MAX_VALUE, f -> true, level, pos.relative(facing), facing.getOpposite()); + FluidTransferHelper.exportToTarget(this, Integer.MAX_VALUE, f -> true, level, pos.relative(facing), + facing.getOpposite()); } } @@ -265,12 +276,13 @@ public void importFromNearby(@NotNull Direction... facings) { var level = getMachine().getLevel(); var pos = getMachine().getPos(); for (Direction facing : facings) { - FluidTransferHelper.importToTarget(this, Integer.MAX_VALUE, f -> true, level, pos.relative(facing), facing.getOpposite()); + FluidTransferHelper.importToTarget(this, Integer.MAX_VALUE, f -> true, level, pos.relative(facing), + facing.getOpposite()); } } ////////////////////////////////////// - //******* Capability ********// + // ******* Capability ********// ////////////////////////////////////// @NotNull @Override @@ -444,7 +456,6 @@ public boolean supportsDrain(int i) { return canCapOutput(); } - @NotNull @Override public Object createSnapshot() { @@ -459,5 +470,4 @@ public void restoreFromSnapshot(Object snapshot) { } } } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableItemStackHandler.java b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableItemStackHandler.java index 092d5050f3..baa9e0a82e 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableItemStackHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableItemStackHandler.java @@ -5,19 +5,22 @@ import com.gregtechceu.gtceu.api.capability.recipe.ItemRecipeCapability; import com.gregtechceu.gtceu.api.capability.recipe.RecipeCapability; import com.gregtechceu.gtceu.api.machine.MetaMachine; -import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.DummyCraftingContainer; +import com.gregtechceu.gtceu.api.recipe.GTRecipe; + import com.lowdragmc.lowdraglib.misc.ItemStackTransfer; import com.lowdragmc.lowdraglib.side.item.IItemTransfer; import com.lowdragmc.lowdraglib.side.item.ItemTransferHelper; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import dev.latvian.mods.kubejs.recipe.ingredientaction.IngredientAction; -import lombok.Getter; + import net.minecraft.core.Direction; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.Ingredient; + +import dev.latvian.mods.kubejs.recipe.ingredientaction.IngredientAction; +import lombok.Getter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -32,18 +35,22 @@ * @date 2023/2/20 * @implNote NotifiableItemStackHandler */ -public class NotifiableItemStackHandler extends NotifiableRecipeHandlerTrait implements ICapabilityTrait, IItemTransfer { +public class NotifiableItemStackHandler extends NotifiableRecipeHandlerTrait + implements ICapabilityTrait, IItemTransfer { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(NotifiableItemStackHandler.class, NotifiableRecipeHandlerTrait.MANAGED_FIELD_HOLDER); + public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( + NotifiableItemStackHandler.class, NotifiableRecipeHandlerTrait.MANAGED_FIELD_HOLDER); @Getter public final IO handlerIO; @Getter public final IO capabilityIO; - @Persisted @DescSynced + @Persisted + @DescSynced public final ItemStackTransfer storage; private Boolean isEmpty; - public NotifiableItemStackHandler(MetaMachine machine, int slots, @NotNull IO handlerIO, @NotNull IO capabilityIO, Function transferFactory) { + public NotifiableItemStackHandler(MetaMachine machine, int slots, @NotNull IO handlerIO, @NotNull IO capabilityIO, + Function transferFactory) { super(machine); this.handlerIO = handlerIO; this.storage = transferFactory.apply(slots); @@ -75,12 +82,14 @@ public ManagedFieldHolder getFieldHolder() { } @Override - public List handleRecipeInner(IO io, GTRecipe recipe, List left, @Nullable String slotName, boolean simulate) { + public List handleRecipeInner(IO io, GTRecipe recipe, List left, @Nullable String slotName, + boolean simulate) { return handleIngredient(io, recipe, left, simulate, this.handlerIO, storage); } @Nullable - public static List handleIngredient(IO io, GTRecipe recipe, List left, boolean simulate, IO handlerIO, ItemStackTransfer storage) { + public static List handleIngredient(IO io, GTRecipe recipe, List left, boolean simulate, + IO handlerIO, ItemStackTransfer storage) { if (io != handlerIO) return left; var capability = simulate ? storage.copy() : storage; Iterator iterator = left.iterator(); @@ -90,7 +99,8 @@ public static List handleIngredient(IO io, GTRecipe recipe, List handleIngredient(IO io, GTRecipe recipe, List to be able to load without KJS. - ItemStack actioned = KJSCallWrapper.applyIngredientAction(capability, i, (List) recipe.ingredientActions); + // noinspection unchecked must be List to be able to load without KJS. + ItemStack actioned = KJSCallWrapper.applyIngredientAction(capability, i, + (List) recipe.ingredientActions); if (!actioned.isEmpty()) { extracted = actioned; didRunIngredientAction = true; @@ -132,8 +143,9 @@ public static List handleIngredient(IO io, GTRecipe recipe, List to be able to load without KJS. - ItemStack actioned = KJSCallWrapper.applyIngredientAction(capability, i, (List) recipe.ingredientActions); + // noinspection unchecked must be List to be able to load without KJS. + ItemStack actioned = KJSCallWrapper.applyIngredientAction(capability, i, + (List) recipe.ingredientActions); if (!actioned.isEmpty()) { leftStack = actioned; didRunIngredientAction = true; @@ -208,7 +220,8 @@ public void exportToNearby(@NotNull Direction... facings) { var level = getMachine().getLevel(); var pos = getMachine().getPos(); for (Direction facing : facings) { - ItemTransferHelper.exportToTarget(this, Integer.MAX_VALUE, f -> true, level, pos.relative(facing), facing.getOpposite()); + ItemTransferHelper.exportToTarget(this, Integer.MAX_VALUE, f -> true, level, pos.relative(facing), + facing.getOpposite()); } } @@ -216,12 +229,13 @@ public void importFromNearby(@NotNull Direction... facings) { var level = getMachine().getLevel(); var pos = getMachine().getPos(); for (Direction facing : facings) { - ItemTransferHelper.importToTarget(this, Integer.MAX_VALUE, f -> true, level, pos.relative(facing), facing.getOpposite()); + ItemTransferHelper.importToTarget(this, Integer.MAX_VALUE, f -> true, level, pos.relative(facing), + facing.getOpposite()); } } ////////////////////////////////////// - //******* Capability ********// + // ******* Capability ********// ////////////////////////////////////// @NotNull @Override @@ -282,7 +296,9 @@ public void restoreFromSnapshot(Object snapshot) { } public static class KJSCallWrapper { - public static ItemStack applyIngredientAction(ItemStackTransfer storage, int index, List ingredientActions) { + + public static ItemStack applyIngredientAction(ItemStackTransfer storage, int index, + List ingredientActions) { var stack = storage.getStackInSlot(index); if (stack.isEmpty()) { @@ -299,5 +315,4 @@ public static ItemStack applyIngredientAction(ItemStackTransfer storage, int ind return ItemStack.EMPTY; } } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableLaserContainer.java b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableLaserContainer.java index 86e95ccd38..b1e65e8fb1 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableLaserContainer.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableLaserContainer.java @@ -4,23 +4,29 @@ import com.gregtechceu.gtceu.api.capability.ILaserContainer; import com.gregtechceu.gtceu.api.machine.MetaMachine; import com.gregtechceu.gtceu.utils.GTUtil; + import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; + import net.minecraft.core.Direction; import net.minecraft.world.level.block.entity.BlockEntity; public class NotifiableLaserContainer extends NotifiableEnergyContainer implements ILaserContainer { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(NotifiableEnergyContainer.class, NotifiableRecipeHandlerTrait.MANAGED_FIELD_HOLDER); + public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( + NotifiableEnergyContainer.class, NotifiableRecipeHandlerTrait.MANAGED_FIELD_HOLDER); - public NotifiableLaserContainer(MetaMachine machine, long maxCapacity, long maxInputVoltage, long maxInputAmperage, long maxOutputVoltage, long maxOutputAmperage) { + public NotifiableLaserContainer(MetaMachine machine, long maxCapacity, long maxInputVoltage, long maxInputAmperage, + long maxOutputVoltage, long maxOutputAmperage) { super(machine, maxCapacity, maxInputVoltage, maxInputAmperage, maxOutputVoltage, maxOutputAmperage); } - public static NotifiableLaserContainer emitterContainer(MetaMachine machine, long maxCapacity, long maxOutputVoltage, long maxOutputAmperage) { + public static NotifiableLaserContainer emitterContainer(MetaMachine machine, long maxCapacity, + long maxOutputVoltage, long maxOutputAmperage) { return new NotifiableLaserContainer(machine, maxCapacity, 0L, 0L, maxOutputVoltage, maxOutputAmperage); } - public static NotifiableLaserContainer receiverContainer(MetaMachine machine, long maxCapacity, long maxInputVoltage, long maxInputAmperage) { + public static NotifiableLaserContainer receiverContainer(MetaMachine machine, long maxCapacity, + long maxInputVoltage, long maxInputAmperage) { return new NotifiableLaserContainer(machine, maxCapacity, maxInputVoltage, maxInputAmperage, 0L, 0L); } @@ -39,10 +45,12 @@ public void serverTick() { if (!outputsEnergy(side)) continue; BlockEntity tileEntity = getMachine().getLevel().getBlockEntity(getMachine().getPos().relative(side)); Direction oppositeSide = side.getOpposite(); - ILaserContainer laserContainer = GTCapabilityHelper.getLaser(getMachine().getLevel(), getMachine().getPos().relative(side), oppositeSide); + ILaserContainer laserContainer = GTCapabilityHelper.getLaser(getMachine().getLevel(), + getMachine().getPos().relative(side), oppositeSide); if (tileEntity != null && laserContainer != null) { if (laserContainer == null || !laserContainer.inputsEnergy(oppositeSide)) continue; - amperesUsed += laserContainer.acceptEnergyFromNetwork(oppositeSide, outputVoltage, outputAmperes - amperesUsed); + amperesUsed += laserContainer.acceptEnergyFromNetwork(oppositeSide, outputVoltage, + outputAmperes - amperesUsed); if (amperesUsed == outputAmperes) break; } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableRecipeHandlerTrait.java b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableRecipeHandlerTrait.java index e96f9d1862..73e7e89f10 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableRecipeHandlerTrait.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableRecipeHandlerTrait.java @@ -1,13 +1,13 @@ package com.gregtechceu.gtceu.api.machine.trait; import com.gregtechceu.gtceu.api.machine.MetaMachine; -import com.gregtechceu.gtceu.common.machine.trait.NotifiableStressTrait; + import com.lowdragmc.lowdraglib.syncdata.ISubscription; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; + import lombok.Getter; -import lombok.Setter; import java.util.ArrayList; import java.util.List; @@ -18,7 +18,9 @@ * @implNote NotifiableTrait */ public abstract class NotifiableRecipeHandlerTrait extends MachineTrait implements IRecipeHandlerTrait { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(NotifiableRecipeHandlerTrait.class); + + public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( + NotifiableRecipeHandlerTrait.class); protected List listeners = new ArrayList<>(); @Persisted diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/RecipeLogic.java b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/RecipeLogic.java index d83fa5034f..3dc29e49c1 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/RecipeLogic.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/RecipeLogic.java @@ -10,6 +10,7 @@ import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.sound.AutoReleasedSound; import com.gregtechceu.gtceu.config.ConfigHolder; + import com.lowdragmc.lowdraglib.Platform; import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.syncdata.IEnhancedManaged; @@ -17,15 +18,17 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.annotation.UpdateListener; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import lombok.Getter; -import lombok.Setter; + import net.minecraft.network.chat.Component; import net.minecraft.world.item.crafting.RecipeManager; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import org.jetbrains.annotations.VisibleForTesting; +import lombok.Getter; +import lombok.Setter; import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.VisibleForTesting; + import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; @@ -34,7 +37,10 @@ public class RecipeLogic extends MachineTrait implements IEnhancedManaged, IWorkable, IFancyTooltip { public enum Status { - IDLE, WORKING, WAITING, SUSPEND + IDLE, + WORKING, + WAITING, + SUSPEND } public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(RecipeLogic.class); @@ -42,33 +48,48 @@ public enum Status { public final IRecipeLogicMachine machine; public List lastFailedMatches; - @Getter @Persisted @DescSynced @UpdateListener(methodName = "onStatusSynced") + @Getter + @Persisted + @DescSynced + @UpdateListener(methodName = "onStatusSynced") private Status status = Status.IDLE; - @Persisted @DescSynced @UpdateListener(methodName = "onActiveSynced") + @Persisted + @DescSynced + @UpdateListener(methodName = "onActiveSynced") private boolean isActive; @Nullable - @Persisted @DescSynced + @Persisted + @DescSynced private Component waitingReason = null; /** * unsafe, it may not be found from {@link RecipeManager}. Do not index it. */ - @Nullable @Getter @Persisted + @Nullable + @Getter + @Persisted protected GTRecipe lastRecipe; /** - * safe, it is the origin recipe before {@link IRecipeLogicMachine#fullModifyRecipe(GTRecipe)}' which can be found from {@link RecipeManager}. + * safe, it is the origin recipe before {@link IRecipeLogicMachine#fullModifyRecipe(GTRecipe)}' which can be found + * from {@link RecipeManager}. */ - @Nullable @Getter @Persisted + @Nullable + @Getter + @Persisted protected GTRecipe lastOriginRecipe; @Persisted - @Getter @Setter + @Getter + @Setter protected int progress; - @Getter @Persisted + @Getter + @Persisted protected int duration; - @Getter @Persisted + @Getter + @Persisted protected int fuelTime; - @Getter @Persisted + @Getter + @Persisted protected int fuelMaxTime; @Getter(onMethod_ = @VisibleForTesting) protected boolean recipeDirty; @@ -174,12 +195,13 @@ public void serverTick() { boolean unsubscribe = false; if (isSuspend()) { unsubscribe = true; - } else if (lastRecipe == null && isIdle() && !machine.keepSubscribing() && !recipeDirty && lastFailedMatches == null) { - // machine isn't working enabled - // or - // there is no available recipes, so it will wait for notification. - unsubscribe = true; - } + } else if (lastRecipe == null && isIdle() && !machine.keepSubscribing() && !recipeDirty && + lastFailedMatches == null) { + // machine isn't working enabled + // or + // there is no available recipes, so it will wait for notification. + unsubscribe = true; + } if (unsubscribe && subscription != null) { subscription.unsubscribe(); @@ -192,8 +214,8 @@ protected boolean checkMatchedRecipeAvailable(GTRecipe match) { var modified = machine.fullModifyRecipe(match); if (modified != null) { if (modified.checkConditions(this).isSuccess() && - modified.matchRecipe(machine).isSuccess() && - modified.matchTickRecipe(machine).isSuccess()) { + modified.matchRecipe(machine).isSuccess() && + modified.matchTickRecipe(machine).isSuccess()) { setupRecipe(modified); } if (lastRecipe != null && getStatus() == Status.WORKING) { @@ -257,9 +279,9 @@ public void findAndHandleRecipe() { lastFailedMatches = null; // try to execute last recipe if possible if (!recipeDirty && lastRecipe != null && - lastRecipe.matchRecipe(this.machine).isSuccess() && - lastRecipe.matchTickRecipe(this.machine).isSuccess() && - lastRecipe.checkConditions(this).isSuccess()) { + lastRecipe.matchRecipe(this.machine).isSuccess() && + lastRecipe.matchTickRecipe(this.machine).isSuccess() && + lastRecipe.checkConditions(this).isSuccess()) { GTRecipe recipe = lastRecipe; lastRecipe = null; lastOriginRecipe = null; @@ -430,9 +452,9 @@ public void onRecipeFinish() { } // try it again if (!recipeDirty && - lastRecipe.matchRecipe(this.machine).isSuccess() && - lastRecipe.matchTickRecipe(this.machine).isSuccess() && - lastRecipe.checkConditions(this).isSuccess()) { + lastRecipe.matchRecipe(this.machine).isSuccess() && + lastRecipe.matchTickRecipe(this.machine).isSuccess() && + lastRecipe.checkConditions(this).isSuccess()) { setupRecipe(lastRecipe); } else { setStatus(Status.IDLE); @@ -476,7 +498,7 @@ public ManagedFieldHolder getFieldHolder() { } ////////////////////////////////////// - //******** MISC *********// + // ******** MISC *********// ////////////////////////////////////// @OnlyIn(Dist.CLIENT) public void updateSound() { @@ -490,12 +512,11 @@ public void updateSound() { workingSound = null; } if (sound != null) { - workingSound = sound.playAutoReleasedSound(() -> - machine.shouldWorkingPlaySound() - && isWorking() - && !getMachine().isInValid() - && getMachine().getLevel().isLoaded(getMachine().getPos()) - && MetaMachine.getMachine(getMachine().getLevel(), getMachine().getPos()) == getMachine(), getMachine().getPos(), true, 0, 1, 1); + workingSound = sound.playAutoReleasedSound( + () -> machine.shouldWorkingPlaySound() && isWorking() && !getMachine().isInValid() && + getMachine().getLevel().isLoaded(getMachine().getPos()) && + MetaMachine.getMachine(getMachine().getLevel(), getMachine().getPos()) == getMachine(), + getMachine().getPos(), true, 0, 1, 1); } } else if (workingSound instanceof AutoReleasedSound soundEntry) { soundEntry.release(); diff --git a/src/main/java/com/gregtechceu/gtceu/api/misc/EnergyContainerList.java b/src/main/java/com/gregtechceu/gtceu/api/misc/EnergyContainerList.java index bc7ffb3ab9..f4b0c6c0aa 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/misc/EnergyContainerList.java +++ b/src/main/java/com/gregtechceu/gtceu/api/misc/EnergyContainerList.java @@ -1,8 +1,10 @@ package com.gregtechceu.gtceu.api.misc; import com.gregtechceu.gtceu.api.capability.IEnergyContainer; -import lombok.Getter; + import net.minecraft.core.Direction; + +import lombok.Getter; import org.jetbrains.annotations.NotNull; import java.util.List; @@ -205,13 +207,13 @@ public long getOutputPerSec() { @Override public String toString() { return "EnergyContainerList{" + - "energyContainerList=" + energyContainerList + - ", energyStored=" + getEnergyStored() + - ", energyCapacity=" + getEnergyCapacity() + - ", inputVoltage=" + inputVoltage + - ", inputAmperage=" + inputAmperage + - ", outputVoltage=" + outputVoltage + - ", outputAmperage=" + outputAmperage + - '}'; + "energyContainerList=" + energyContainerList + + ", energyStored=" + getEnergyStored() + + ", energyCapacity=" + getEnergyCapacity() + + ", inputVoltage=" + inputVoltage + + ", inputAmperage=" + inputAmperage + + ", outputVoltage=" + outputVoltage + + ", outputAmperage=" + outputAmperage + + '}'; } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/misc/EnergyInfoProviderList.java b/src/main/java/com/gregtechceu/gtceu/api/misc/EnergyInfoProviderList.java index 27796b3841..5001abd9e6 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/misc/EnergyInfoProviderList.java +++ b/src/main/java/com/gregtechceu/gtceu/api/misc/EnergyInfoProviderList.java @@ -1,15 +1,18 @@ package com.gregtechceu.gtceu.api.misc; import com.gregtechceu.gtceu.api.capability.IEnergyInfoProvider; + import net.minecraft.MethodsReturnNonnullByDefault; -import javax.annotation.ParametersAreNonnullByDefault; import java.math.BigInteger; import java.util.List; +import javax.annotation.ParametersAreNonnullByDefault; + @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault public class EnergyInfoProviderList implements IEnergyInfoProvider { + private final List list; public EnergyInfoProviderList(List list) { diff --git a/src/main/java/com/gregtechceu/gtceu/api/misc/FluidRecipeHandler.java b/src/main/java/com/gregtechceu/gtceu/api/misc/FluidRecipeHandler.java index ebeb994553..b6d7eb1b2c 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/misc/FluidRecipeHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/api/misc/FluidRecipeHandler.java @@ -7,9 +7,11 @@ import com.gregtechceu.gtceu.api.machine.trait.NotifiableFluidTank; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.ingredient.FluidIngredient; + import com.lowdragmc.lowdraglib.misc.FluidStorage; import com.lowdragmc.lowdraglib.side.fluid.FluidStack; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; + import lombok.Getter; import org.jetbrains.annotations.Nullable; @@ -18,6 +20,7 @@ import java.util.List; public class FluidRecipeHandler implements IRecipeHandler { + @Getter public final IO handlerIO; @Persisted @@ -33,7 +36,8 @@ public FluidRecipeHandler(IO handlerIO, int slots, long capacity) { } @Override - public List handleRecipeInner(IO io, GTRecipe recipe, List left, @Nullable String slotName, boolean simulate) { + public List handleRecipeInner(IO io, GTRecipe recipe, List left, + @Nullable String slotName, boolean simulate) { return NotifiableFluidTank.handleIngredient(io, recipe, left, simulate, this.handlerIO, getStorages()); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/misc/IOFluidTransferList.java b/src/main/java/com/gregtechceu/gtceu/api/misc/IOFluidTransferList.java index 528624beb4..a2bee13634 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/misc/IOFluidTransferList.java +++ b/src/main/java/com/gregtechceu/gtceu/api/misc/IOFluidTransferList.java @@ -1,9 +1,11 @@ package com.gregtechceu.gtceu.api.misc; import com.gregtechceu.gtceu.api.capability.recipe.IO; + import com.lowdragmc.lowdraglib.misc.FluidTransferList; import com.lowdragmc.lowdraglib.side.fluid.FluidStack; import com.lowdragmc.lowdraglib.side.fluid.IFluidTransfer; + import lombok.Getter; import org.jetbrains.annotations.NotNull; @@ -16,6 +18,7 @@ * @implNote IOFluidTransferList */ public class IOFluidTransferList extends FluidTransferList { + @Getter private final IO io; diff --git a/src/main/java/com/gregtechceu/gtceu/api/misc/IOItemTransferList.java b/src/main/java/com/gregtechceu/gtceu/api/misc/IOItemTransferList.java index 6f1c5e438a..53f1c76812 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/misc/IOItemTransferList.java +++ b/src/main/java/com/gregtechceu/gtceu/api/misc/IOItemTransferList.java @@ -1,10 +1,13 @@ package com.gregtechceu.gtceu.api.misc; import com.gregtechceu.gtceu.api.capability.recipe.IO; + import com.lowdragmc.lowdraglib.misc.ItemTransferList; import com.lowdragmc.lowdraglib.side.item.IItemTransfer; -import lombok.Getter; + import net.minecraft.world.item.ItemStack; + +import lombok.Getter; import org.jetbrains.annotations.NotNull; import java.util.List; diff --git a/src/main/java/com/gregtechceu/gtceu/api/misc/IgnoreEnergyRecipeHandler.java b/src/main/java/com/gregtechceu/gtceu/api/misc/IgnoreEnergyRecipeHandler.java index 01b6fb5e86..cabc3721b2 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/misc/IgnoreEnergyRecipeHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/api/misc/IgnoreEnergyRecipeHandler.java @@ -5,13 +5,16 @@ import com.gregtechceu.gtceu.api.capability.recipe.IRecipeHandler; import com.gregtechceu.gtceu.api.capability.recipe.RecipeCapability; import com.gregtechceu.gtceu.api.recipe.GTRecipe; + import org.jetbrains.annotations.Nullable; import java.util.List; public class IgnoreEnergyRecipeHandler implements IRecipeHandler { + @Override - public List handleRecipeInner(IO io, GTRecipe recipe, List left, @Nullable String slotName, boolean simulate) { + public List handleRecipeInner(IO io, GTRecipe recipe, List left, @Nullable String slotName, + boolean simulate) { return null; } diff --git a/src/main/java/com/gregtechceu/gtceu/api/misc/ItemRecipeHandler.java b/src/main/java/com/gregtechceu/gtceu/api/misc/ItemRecipeHandler.java index 3d4753140b..39350074ac 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/misc/ItemRecipeHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/api/misc/ItemRecipeHandler.java @@ -5,10 +5,13 @@ import com.gregtechceu.gtceu.api.capability.recipe.ItemRecipeCapability; import com.gregtechceu.gtceu.api.capability.recipe.RecipeCapability; import com.gregtechceu.gtceu.api.recipe.GTRecipe; + import com.lowdragmc.lowdraglib.misc.ItemStackTransfer; -import lombok.Getter; + import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.Ingredient; + +import lombok.Getter; import org.jetbrains.annotations.Nullable; import java.util.ArrayList; @@ -23,6 +26,7 @@ * @implNote ItemRecipeHandler */ public class ItemRecipeHandler implements IRecipeHandler { + @Getter public final IO handlerIO; public final ItemStackTransfer storage; @@ -33,7 +37,8 @@ public ItemRecipeHandler(IO handlerIO, int slots) { } @Override - public List handleRecipeInner(IO io, GTRecipe recipe, List left, @Nullable String slotName, boolean simulate) { + public List handleRecipeInner(IO io, GTRecipe recipe, List left, @Nullable String slotName, + boolean simulate) { return handleIngredient(io, recipe, left, simulate, this.handlerIO, storage); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/misc/LaserContainerList.java b/src/main/java/com/gregtechceu/gtceu/api/misc/LaserContainerList.java index 9aae74beb7..210a52d848 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/misc/LaserContainerList.java +++ b/src/main/java/com/gregtechceu/gtceu/api/misc/LaserContainerList.java @@ -1,7 +1,7 @@ package com.gregtechceu.gtceu.api.misc; -import com.gregtechceu.gtceu.api.capability.IEnergyContainer; import com.gregtechceu.gtceu.api.capability.ILaserContainer; + import net.minecraft.core.Direction; import java.util.List; diff --git a/src/main/java/com/gregtechceu/gtceu/api/misc/RateCounter.java b/src/main/java/com/gregtechceu/gtceu/api/misc/RateCounter.java index 910377071f..47deb9fd48 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/misc/RateCounter.java +++ b/src/main/java/com/gregtechceu/gtceu/api/misc/RateCounter.java @@ -2,10 +2,10 @@ import net.minecraft.MethodsReturnNonnullByDefault; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.Arrays; import java.util.function.LongSupplier; +import javax.annotation.ParametersAreNonnullByDefault; /** * Limits a rate/throughput across a certain amount of time, without needing an active tick subscription @@ -13,6 +13,7 @@ @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault public class RateCounter { + private final LongSupplier timeSupplier; private final long[] usedAmounts; diff --git a/src/main/java/com/gregtechceu/gtceu/api/misc/forge/SimpleThermalFluidHandlerItemStack.java b/src/main/java/com/gregtechceu/gtceu/api/misc/forge/SimpleThermalFluidHandlerItemStack.java index af32d4e3b9..a1c1c84650 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/misc/forge/SimpleThermalFluidHandlerItemStack.java +++ b/src/main/java/com/gregtechceu/gtceu/api/misc/forge/SimpleThermalFluidHandlerItemStack.java @@ -1,10 +1,10 @@ package com.gregtechceu.gtceu.api.misc.forge; import com.gregtechceu.gtceu.api.capability.IThermalFluidHandlerItemStack; + import net.minecraft.world.item.ItemStack; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.capability.templates.FluidHandlerItemStackSimple; -import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull; @@ -13,14 +13,18 @@ * @date 2023/2/22 * @implNote FluidHandlerHelperImpl */ -public class SimpleThermalFluidHandlerItemStack extends FluidHandlerItemStackSimple implements IThermalFluidHandlerItemStack { +public class SimpleThermalFluidHandlerItemStack extends FluidHandlerItemStackSimple + implements IThermalFluidHandlerItemStack { + public final int maxFluidTemperature; private final boolean gasProof; private final boolean acidProof; private final boolean cryoProof; private final boolean plasmaProof; - public SimpleThermalFluidHandlerItemStack(@NotNull ItemStack container, int capacity, int maxFluidTemperature, boolean gasProof, boolean acidProof, boolean cryoProof, boolean plasmaProof) { + public SimpleThermalFluidHandlerItemStack(@NotNull ItemStack container, int capacity, int maxFluidTemperature, + boolean gasProof, boolean acidProof, boolean cryoProof, + boolean plasmaProof) { super(container, capacity); this.maxFluidTemperature = maxFluidTemperature; this.gasProof = gasProof; diff --git a/src/main/java/com/gregtechceu/gtceu/api/misc/forge/ThermalFluidHandlerItemStack.java b/src/main/java/com/gregtechceu/gtceu/api/misc/forge/ThermalFluidHandlerItemStack.java index 733cd0ffec..75f64abe46 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/misc/forge/ThermalFluidHandlerItemStack.java +++ b/src/main/java/com/gregtechceu/gtceu/api/misc/forge/ThermalFluidHandlerItemStack.java @@ -1,11 +1,12 @@ package com.gregtechceu.gtceu.api.misc.forge; import com.gregtechceu.gtceu.api.capability.IThermalFluidHandlerItemStack; + import com.lowdragmc.lowdraglib.side.fluid.forge.FluidHelperImpl; + import net.minecraft.world.item.ItemStack; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.capability.templates.FluidHandlerItemStack; -import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull; @@ -21,7 +22,8 @@ public class ThermalFluidHandlerItemStack extends FluidHandlerItemStack implemen * @param container The container itemStack, data is stored on it directly as NBT. * @param capacity The maximum capacity of this fluid tank. */ - public ThermalFluidHandlerItemStack(@NotNull ItemStack container, int capacity, int maxFluidTemperature, boolean gasProof, boolean acidProof, boolean cryoProof, boolean plasmaProof) { + public ThermalFluidHandlerItemStack(@NotNull ItemStack container, int capacity, int maxFluidTemperature, + boolean gasProof, boolean acidProof, boolean cryoProof, boolean plasmaProof) { super(container, capacity); this.maxFluidTemperature = maxFluidTemperature; this.gasProof = gasProof; diff --git a/src/main/java/com/gregtechceu/gtceu/api/misc/forge/VoidFluidHandlerItemStack.java b/src/main/java/com/gregtechceu/gtceu/api/misc/forge/VoidFluidHandlerItemStack.java index e4f9285a02..bb67c93e1b 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/misc/forge/VoidFluidHandlerItemStack.java +++ b/src/main/java/com/gregtechceu/gtceu/api/misc/forge/VoidFluidHandlerItemStack.java @@ -3,6 +3,7 @@ import net.minecraft.world.item.ItemStack; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.capability.templates.FluidHandlerItemStack; + import org.jetbrains.annotations.NotNull; /** @@ -65,4 +66,4 @@ public boolean canFillFluidType(FluidStack fluid) { public boolean canDrainFluidType(FluidStack fluid) { return false; } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/pattern/BlockPattern.java b/src/main/java/com/gregtechceu/gtceu/api/pattern/BlockPattern.java index d0e14ec9d5..a393612f79 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/pattern/BlockPattern.java +++ b/src/main/java/com/gregtechceu/gtceu/api/pattern/BlockPattern.java @@ -1,20 +1,20 @@ package com.gregtechceu.gtceu.api.pattern; import com.gregtechceu.gtceu.api.block.ActiveBlock; -import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiPart; -import com.gregtechceu.gtceu.api.pattern.error.PatternError; -import com.gregtechceu.gtceu.api.pattern.error.SinglePredicateError; import com.gregtechceu.gtceu.api.block.MetaMachineBlock; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; import com.gregtechceu.gtceu.api.machine.MetaMachine; import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiController; +import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiPart; +import com.gregtechceu.gtceu.api.pattern.error.PatternError; import com.gregtechceu.gtceu.api.pattern.error.PatternStringError; +import com.gregtechceu.gtceu.api.pattern.error.SinglePredicateError; import com.gregtechceu.gtceu.api.pattern.predicates.SimplePredicate; import com.gregtechceu.gtceu.api.pattern.util.PatternMatchContext; import com.gregtechceu.gtceu.api.pattern.util.RelativeDirection; + import com.lowdragmc.lowdraglib.utils.BlockInfo; -import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; -import it.unimi.dsi.fastutil.longs.LongOpenHashSet; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.InteractionHand; @@ -29,6 +29,9 @@ import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.Property; import net.minecraft.world.phys.BlockHitResult; + +import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; +import it.unimi.dsi.fastutil.longs.LongOpenHashSet; import org.apache.commons.lang3.ArrayUtils; import java.lang.reflect.Array; @@ -38,17 +41,19 @@ public class BlockPattern { - static Direction[] FACINGS = {Direction.SOUTH, Direction.NORTH, Direction.WEST, Direction.EAST, Direction.UP, Direction.DOWN}; - static Direction[] FACINGS_H = {Direction.SOUTH, Direction.NORTH, Direction.WEST, Direction.EAST}; + static Direction[] FACINGS = { Direction.SOUTH, Direction.NORTH, Direction.WEST, Direction.EAST, Direction.UP, + Direction.DOWN }; + static Direction[] FACINGS_H = { Direction.SOUTH, Direction.NORTH, Direction.WEST, Direction.EAST }; public final int[][] aisleRepetitions; public final RelativeDirection[] structureDir; - protected final TraceabilityPredicate[][][] blockMatches; //[z][y][x] - protected final int fingerLength; //z size - protected final int thumbLength; //y size - protected final int palmLength; //x size + protected final TraceabilityPredicate[][][] blockMatches; // [z][y][x] + protected final int fingerLength; // z size + protected final int thumbLength; // y size + protected final int palmLength; // x size protected final int[] centerOffset; // x, y, z, minZ, maxZ - public BlockPattern(TraceabilityPredicate[][][] predicatesIn, RelativeDirection[] structureDir, int[][] aisleRepetitions, int[] centerOffset) { + public BlockPattern(TraceabilityPredicate[][][] predicatesIn, RelativeDirection[] structureDir, + int[][] aisleRepetitions, int[] centerOffset) { this.blockMatches = predicatesIn; this.fingerLength = predicatesIn.length; this.structureDir = structureDir; @@ -78,7 +83,8 @@ public boolean checkPatternAt(MultiblockState worldState, boolean savePredicate) } BlockPos centerPos = controller.self().getPos(); Direction frontFacing = controller.self().getFrontFacing(); - Direction[] facings = controller.hasFrontFacing() ? new Direction[]{frontFacing} : new Direction[]{Direction.SOUTH, Direction.NORTH, Direction.EAST, Direction.WEST}; + Direction[] facings = controller.hasFrontFacing() ? new Direction[] { frontFacing } : + new Direction[] { Direction.SOUTH, Direction.NORTH, Direction.EAST, Direction.WEST }; for (Direction facing : facings) { if (checkPatternAt(worldState, centerPos, facing, savePredicate)) { return true; @@ -87,26 +93,28 @@ public boolean checkPatternAt(MultiblockState worldState, boolean savePredicate) return false; } - public boolean checkPatternAt(MultiblockState worldState, BlockPos centerPos, Direction facing, boolean savePredicate) { + public boolean checkPatternAt(MultiblockState worldState, BlockPos centerPos, Direction facing, + boolean savePredicate) { boolean findFirstAisle = false; int minZ = -centerOffset[4]; worldState.clean(); PatternMatchContext matchContext = worldState.getMatchContext(); Map globalCount = worldState.getGlobalCount(); Map layerCount = worldState.getLayerCount(); - //Checking aisles + // Checking aisles for (int c = 0, z = minZ++, r; c < this.fingerLength; c++) { - //Checking repeatable slices + // Checking repeatable slices loop: for (r = 0; (findFirstAisle ? r < aisleRepetitions[c][1] : z <= -centerOffset[3]); r++) { - //Checking single slice + // Checking single slice layerCount.clear(); for (int b = 0, y = -centerOffset[1]; b < this.thumbLength; b++, y++) { for (int a = 0, x = -centerOffset[0]; a < this.palmLength; a++, x++) { worldState.setError(null); TraceabilityPredicate predicate = this.blockMatches[c][b][a]; - BlockPos pos = setActualRelativeOffset(x, y, z, facing).offset(centerPos.getX(), centerPos.getY(), centerPos.getZ()); + BlockPos pos = setActualRelativeOffset(x, y, z, facing).offset(centerPos.getX(), + centerPos.getY(), centerPos.getZ()); if (!worldState.update(pos, predicate)) { return false; } @@ -117,9 +125,11 @@ public boolean checkPatternAt(MultiblockState worldState, BlockPos centerPos, Di } } boolean canPartShared = true; - if (worldState.getTileEntity() instanceof IMachineBlockEntity machineBlockEntity && machineBlockEntity.getMetaMachine() instanceof IMultiPart part) { // add detected parts + if (worldState.getTileEntity() instanceof IMachineBlockEntity machineBlockEntity && + machineBlockEntity.getMetaMachine() instanceof IMultiPart part) { // add detected parts if (!predicate.isAny()) { - if (part.isFormed() && !part.canShared() && !part.hasController(worldState.controllerPos)) { // check part can be shared + if (part.isFormed() && !part.canShared() && + !part.hasController(worldState.controllerPos)) { // check part can be shared canPartShared = false; worldState.setError(new PatternStringError("multiblocked.pattern.error.share")); } else { @@ -128,28 +138,30 @@ public boolean checkPatternAt(MultiblockState worldState, BlockPos centerPos, Di } } if (worldState.getBlockState().getBlock() instanceof ActiveBlock) { - matchContext.getOrCreate("vaBlocks", LongOpenHashSet::new).add(worldState.getPos().asLong()); + matchContext.getOrCreate("vaBlocks", LongOpenHashSet::new) + .add(worldState.getPos().asLong()); } if (!predicate.test(worldState) || !canPartShared) { // matching failed if (findFirstAisle) { - if (r < aisleRepetitions[c][0]) {//retreat to see if the first aisle can start later + if (r < aisleRepetitions[c][0]) {// retreat to see if the first aisle can start later r = c = 0; z = minZ++; matchContext.reset(); findFirstAisle = false; } } else { - z++;//continue searching for the first aisle + z++;// continue searching for the first aisle } continue loop; } - matchContext.getOrCreate("ioMap", Long2ObjectOpenHashMap::new).put(worldState.getPos().asLong(), worldState.io); + matchContext.getOrCreate("ioMap", Long2ObjectOpenHashMap::new).put(worldState.getPos().asLong(), + worldState.io); } } findFirstAisle = true; z++; - //Check layer-local matcher predicate + // Check layer-local matcher predicate for (Map.Entry entry : layerCount.entrySet()) { if (entry.getValue() < entry.getKey().minLayerCount) { worldState.setError(new SinglePredicateError(entry.getKey(), 3)); @@ -157,7 +169,7 @@ public boolean checkPatternAt(MultiblockState worldState, BlockPos centerPos, Di } } } - //Repetitions out of range + // Repetitions out of range if (r < aisleRepetitions[c][0] || worldState.hasError() || !findFirstAisle) { if (!worldState.hasError()) { worldState.setError(new PatternError()); @@ -166,7 +178,7 @@ public boolean checkPatternAt(MultiblockState worldState, BlockPos centerPos, Di } } - //Check count matches amount + // Check count matches amount for (Map.Entry entry : globalCount.entrySet()) { if (entry.getValue() < entry.getKey().minCount) { worldState.setError(new SinglePredicateError(entry.getKey(), 1)); @@ -196,7 +208,8 @@ public void autoBuild(Player player, MultiblockState worldState) { for (int b = 0, y = -centerOffset[1]; b < this.thumbLength; b++, y++) { for (int a = 0, x = -centerOffset[0]; a < this.palmLength; a++, x++) { TraceabilityPredicate predicate = this.blockMatches[c][b][a]; - BlockPos pos = setActualRelativeOffset(x, y, z, facing).offset(centerPos.getX(), centerPos.getY(), centerPos.getZ()); + BlockPos pos = setActualRelativeOffset(x, y, z, facing).offset(centerPos.getX(), + centerPos.getY(), centerPos.getZ()); worldState.update(pos, predicate); if (!world.isEmptyBlock(pos)) { blocks.put(pos, world.getBlockState(pos)); @@ -210,11 +223,13 @@ public void autoBuild(Player player, MultiblockState worldState) { if (limit.minLayerCount > 0) { if (!cacheLayer.containsKey(limit)) { cacheLayer.put(limit, 1); - } else if (cacheLayer.get(limit) < limit.minLayerCount && (limit.maxLayerCount == -1 || cacheLayer.get(limit) < limit.maxLayerCount)) { - cacheLayer.put(limit, cacheLayer.get(limit) + 1); - } else { - continue; - } + } else + if (cacheLayer.get(limit) < limit.minLayerCount && (limit.maxLayerCount == -1 || + cacheLayer.get(limit) < limit.maxLayerCount)) { + cacheLayer.put(limit, cacheLayer.get(limit) + 1); + } else { + continue; + } } else { continue; } @@ -227,11 +242,12 @@ public void autoBuild(Player player, MultiblockState worldState) { if (limit.minCount > 0) { if (!cacheGlobal.containsKey(limit)) { cacheGlobal.put(limit, 1); - } else if (cacheGlobal.get(limit) < limit.minCount && (limit.maxCount == -1 || cacheGlobal.get(limit) < limit.maxCount)) { - cacheGlobal.put(limit, cacheGlobal.get(limit) + 1); - } else { - continue; - } + } else if (cacheGlobal.get(limit) < limit.minCount && + (limit.maxCount == -1 || cacheGlobal.get(limit) < limit.maxCount)) { + cacheGlobal.put(limit, cacheGlobal.get(limit) + 1); + } else { + continue; + } } else { continue; } @@ -240,11 +256,13 @@ public void autoBuild(Player player, MultiblockState worldState) { break; } } - if (!find) { // no limited + if (!find) { // no limited for (SimplePredicate limit : predicate.limited) { - if (limit.maxLayerCount != -1 && cacheLayer.getOrDefault(limit, Integer.MAX_VALUE) == limit.maxLayerCount) + if (limit.maxLayerCount != -1 && + cacheLayer.getOrDefault(limit, Integer.MAX_VALUE) == limit.maxLayerCount) continue; - if (limit.maxCount != -1 && cacheGlobal.getOrDefault(limit, Integer.MAX_VALUE) == limit.maxCount) + if (limit.maxCount != -1 && + cacheGlobal.getOrDefault(limit, Integer.MAX_VALUE) == limit.maxCount) continue; if (cacheLayer.containsKey(limit)) { cacheLayer.put(limit, cacheLayer.get(limit) + 1); @@ -256,10 +274,12 @@ public void autoBuild(Player player, MultiblockState worldState) { } else { cacheGlobal.put(limit, 1); } - infos = ArrayUtils.addAll(infos, limit.candidates == null ? null : limit.candidates.get()); + infos = ArrayUtils.addAll(infos, + limit.candidates == null ? null : limit.candidates.get()); } for (SimplePredicate common : predicate.common) { - infos = ArrayUtils.addAll(infos, common.candidates == null ? null : common.candidates.get()); + infos = ArrayUtils.addAll(infos, + common.candidates == null ? null : common.candidates.get()); } } @@ -277,7 +297,9 @@ public void autoBuild(Player player, MultiblockState worldState) { ItemStack originalItemStack = null; if (!player.isCreative()) { for (ItemStack itemStack : player.getInventory().items) { - if (candidates.stream().anyMatch(candidate -> ItemStack.isSameItemSameTags(candidate, itemStack)) && !itemStack.isEmpty() && itemStack.getItem() instanceof BlockItem) { + if (candidates.stream().anyMatch( + candidate -> ItemStack.isSameItemSameTags(candidate, itemStack)) && + !itemStack.isEmpty() && itemStack.getItem() instanceof BlockItem) { found = itemStack.copy(); originalItemStack = itemStack; break; @@ -294,11 +316,12 @@ public void autoBuild(Player player, MultiblockState worldState) { } if (found == null) continue; BlockItem itemBlock = (BlockItem) found.getItem(); - BlockPlaceContext context = new BlockPlaceContext(world, player, InteractionHand.MAIN_HAND, found, BlockHitResult.miss(player.getEyePosition(0), Direction.UP, pos)); + BlockPlaceContext context = new BlockPlaceContext(world, player, InteractionHand.MAIN_HAND, + found, BlockHitResult.miss(player.getEyePosition(0), Direction.UP, pos)); InteractionResult interactionResult = itemBlock.place(context); - if(interactionResult != InteractionResult.FAIL) { + if (interactionResult != InteractionResult.FAIL) { placeBlockPos.add(pos); - if(originalItemStack != null) { + if (originalItemStack != null) { originalItemStack.setCount(originalItemStack.getCount() - 1); } } @@ -319,7 +342,8 @@ public void autoBuild(Player player, MultiblockState worldState) { if (block instanceof BlockState && placeBlockPos.contains(pos)) { resetFacing(pos, (BlockState) block, frontFacing, (p, f) -> { Object object = blocks.get(p.relative(f)); - return object == null || (object instanceof BlockState && ((BlockState) object).getBlock() == Blocks.AIR); + return object == null || + (object instanceof BlockState && ((BlockState) object).getBlock() == Blocks.AIR); }, state -> world.setBlock(pos, state, 3)); } else if (block instanceof MetaMachine machine) { resetFacing(pos, machine.getBlockState(), frontFacing, (p, f) -> { @@ -345,7 +369,7 @@ public BlockInfo[][][] getPreview(int[] repetition) { int maxZ = Integer.MIN_VALUE; for (int l = 0, x = 0; l < this.fingerLength; l++) { for (int r = 0; r < repetition[l]; r++) { - //Checking single slice + // Checking single slice Map cacheLayer = new HashMap<>(); for (int y = 0; y < this.thumbLength; y++) { for (int z = 0; z < this.palmLength; z++) { @@ -472,7 +496,8 @@ public BlockInfo[][][] getPreview(int[] repetition) { x++; } } - BlockInfo[][][] result = (BlockInfo[][][]) Array.newInstance(BlockInfo.class, maxX - minX + 1, maxY - minY + 1, maxZ - minZ + 1); + BlockInfo[][][] result = (BlockInfo[][][]) Array.newInstance(BlockInfo.class, maxX - minX + 1, maxY - minY + 1, + maxZ - minZ + 1); int finalMinX = minX; int finalMinY = minY; int finalMinZ = minZ; @@ -481,7 +506,8 @@ public BlockInfo[][][] getPreview(int[] repetition) { BlockInfo blockInfo = blocks.get(p.relative(f)); if (blockInfo == null || blockInfo.getBlockState().getBlock() == Blocks.AIR) { if (blocks.get(pos).getBlockState().getBlock() instanceof MetaMachineBlock machineBlock) { - if (machineBlock.newBlockEntity(BlockPos.ZERO, machineBlock.defaultBlockState()) instanceof IMachineBlockEntity machineBlockEntity) { + if (machineBlock.newBlockEntity(BlockPos.ZERO, + machineBlock.defaultBlockState()) instanceof IMachineBlockEntity machineBlockEntity) { var machine = machineBlockEntity.getMetaMachine(); if (machine instanceof IMultiController) { return false; @@ -499,15 +525,20 @@ public BlockInfo[][][] getPreview(int[] repetition) { return result; } - private void resetFacing(BlockPos pos, BlockState blockState, Direction facing, BiFunction checker, Consumer consumer) { + private void resetFacing(BlockPos pos, BlockState blockState, Direction facing, + BiFunction checker, Consumer consumer) { if (blockState.hasProperty(BlockStateProperties.FACING)) { - tryFacings(blockState, pos, checker, consumer, BlockStateProperties.FACING, facing == null ? FACINGS : ArrayUtils.addAll(new Direction[]{facing}, FACINGS)); + tryFacings(blockState, pos, checker, consumer, BlockStateProperties.FACING, + facing == null ? FACINGS : ArrayUtils.addAll(new Direction[] { facing }, FACINGS)); } else if (blockState.hasProperty(BlockStateProperties.HORIZONTAL_FACING)) { - tryFacings(blockState, pos, checker, consumer, BlockStateProperties.HORIZONTAL_FACING, facing == null || facing.getAxis() == Direction.Axis.Y ? FACINGS_H : ArrayUtils.addAll(new Direction[]{facing}, FACINGS_H)); + tryFacings(blockState, pos, checker, consumer, BlockStateProperties.HORIZONTAL_FACING, + facing == null || facing.getAxis() == Direction.Axis.Y ? FACINGS_H : + ArrayUtils.addAll(new Direction[] { facing }, FACINGS_H)); } } - private void tryFacings(BlockState blockState, BlockPos pos, BiFunction checker, Consumer consumer, Property property, Direction[] facings) { + private void tryFacings(BlockState blockState, BlockPos pos, BiFunction checker, + Consumer consumer, Property property, Direction[] facings) { Direction found = null; for (Direction facing : facings) { if (checker.apply(pos, facing)) { @@ -522,7 +553,7 @@ private void tryFacings(BlockState blockState, BlockPos pos, BiFunction c1[1] = c0[i]; diff --git a/src/main/java/com/gregtechceu/gtceu/api/pattern/FactoryBlockPattern.java b/src/main/java/com/gregtechceu/gtceu/api/pattern/FactoryBlockPattern.java index 17f109323c..8ef60f55b9 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/pattern/FactoryBlockPattern.java +++ b/src/main/java/com/gregtechceu/gtceu/api/pattern/FactoryBlockPattern.java @@ -1,7 +1,8 @@ package com.gregtechceu.gtceu.api.pattern; -import com.google.common.base.Joiner; import com.gregtechceu.gtceu.api.pattern.util.RelativeDirection; + +import com.google.common.base.Joiner; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.StringUtils; @@ -13,6 +14,7 @@ import java.util.Map.Entry; public class FactoryBlockPattern { + private static final Joiner COMMA_JOIN = Joiner.on(","); private final List depth; private final List aisleRepetitions; @@ -52,11 +54,14 @@ public FactoryBlockPattern aisleRepeatable(int minRepeat, int maxRepeat, String. } if (aisle.length != this.aisleHeight) { - throw new IllegalArgumentException("Expected aisle with height of " + this.aisleHeight + ", but was given one with a height of " + aisle.length + ")"); + throw new IllegalArgumentException("Expected aisle with height of " + this.aisleHeight + + ", but was given one with a height of " + aisle.length + ")"); } else { for (String s : aisle) { if (s.length() != this.rowWidth) { - throw new IllegalArgumentException("Not all rows in the given aisle are the correct width (expected " + this.rowWidth + ", found one with " + s.length() + ")"); + throw new IllegalArgumentException( + "Not all rows in the given aisle are the correct width (expected " + this.rowWidth + + ", found one with " + s.length() + ")"); } for (char c0 : s.toCharArray()) { @@ -69,7 +74,7 @@ public FactoryBlockPattern aisleRepeatable(int minRepeat, int maxRepeat, String. this.depth.add(aisle); if (minRepeat > maxRepeat) throw new IllegalArgumentException("Lower bound of repeat counting must smaller than upper bound!"); - aisleRepetitions.add(new int[]{minRepeat, maxRepeat}); + aisleRepetitions.add(new int[] { minRepeat, maxRepeat }); return this; } } else { @@ -90,7 +95,7 @@ public FactoryBlockPattern aisle(String... aisle) { public FactoryBlockPattern setRepeatable(int minRepeat, int maxRepeat) { if (minRepeat > maxRepeat) throw new IllegalArgumentException("Lower bound of repeat counting must smaller than upper bound!"); - aisleRepetitions.set(aisleRepetitions.size() - 1, new int[]{minRepeat, maxRepeat}); + aisleRepetitions.set(aisleRepetitions.size() - 1, new int[] { minRepeat, maxRepeat }); return this; } @@ -105,7 +110,8 @@ public static FactoryBlockPattern start() { return new FactoryBlockPattern(RelativeDirection.LEFT, RelativeDirection.UP, RelativeDirection.FRONT); } - public static FactoryBlockPattern start(RelativeDirection charDir, RelativeDirection stringDir, RelativeDirection aisleDir) { + public static FactoryBlockPattern start(RelativeDirection charDir, RelativeDirection stringDir, + RelativeDirection aisleDir) { return new FactoryBlockPattern(charDir, stringDir, aisleDir); } @@ -114,7 +120,7 @@ public FactoryBlockPattern where(String symbol, TraceabilityPredicate blockMatch } public FactoryBlockPattern where(char symbol, TraceabilityPredicate blockMatcher) { - if (blockMatcher.isAny()|| blockMatcher.isAir()) { + if (blockMatcher.isAny() || blockMatcher.isAir()) { this.symbolMap.put(symbol, blockMatcher); } else { this.symbolMap.put(symbol, new TraceabilityPredicate(blockMatcher).sort()); @@ -126,14 +132,16 @@ public BlockPattern build() { this.checkMissingPredicates(); int[] centerOffset = new int[5]; int[][] aisleRepetitions = this.aisleRepetitions.toArray(new int[this.aisleRepetitions.size()][]); - TraceabilityPredicate[][][] predicate = (TraceabilityPredicate[][][]) Array.newInstance(TraceabilityPredicate.class, this.depth.size(), this.aisleHeight, this.rowWidth); + TraceabilityPredicate[][][] predicate = (TraceabilityPredicate[][][]) Array + .newInstance(TraceabilityPredicate.class, this.depth.size(), this.aisleHeight, this.rowWidth); - for (int i = 0, minZ = 0, maxZ = 0; i < this.depth.size(); minZ += aisleRepetitions[i][0], maxZ += aisleRepetitions[i][1], i++) { + for (int i = 0, minZ = 0, maxZ = 0; i < + this.depth.size(); minZ += aisleRepetitions[i][0], maxZ += aisleRepetitions[i][1], i++) { for (int j = 0; j < this.aisleHeight; j++) { for (int k = 0; k < this.rowWidth; k++) { predicate[i][j][k] = this.symbolMap.get(this.depth.get(i)[j].charAt(k)); if (predicate[i][j][k].isController) { - centerOffset = new int[]{k, j, i, minZ, maxZ}; + centerOffset = new int[] { k, j, i, minZ, maxZ }; } } } @@ -144,7 +152,8 @@ public BlockPattern build() { private TraceabilityPredicate[][][] makePredicateArray() { this.checkMissingPredicates(); - TraceabilityPredicate[][][] predicate = (TraceabilityPredicate[][][]) Array.newInstance(TraceabilityPredicate.class, this.depth.size(), this.aisleHeight, this.rowWidth); + TraceabilityPredicate[][][] predicate = (TraceabilityPredicate[][][]) Array + .newInstance(TraceabilityPredicate.class, this.depth.size(), this.aisleHeight, this.rowWidth); for (int i = 0; i < this.depth.size(); ++i) { for (int j = 0; j < this.aisleHeight; ++j) { diff --git a/src/main/java/com/gregtechceu/gtceu/api/pattern/MultiblockShapeInfo.java b/src/main/java/com/gregtechceu/gtceu/api/pattern/MultiblockShapeInfo.java index fa04ffb3ae..326e1e01b9 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/pattern/MultiblockShapeInfo.java +++ b/src/main/java/com/gregtechceu/gtceu/api/pattern/MultiblockShapeInfo.java @@ -1,10 +1,11 @@ package com.gregtechceu.gtceu.api.pattern; import com.gregtechceu.gtceu.api.block.IMachineBlock; -import com.gregtechceu.gtceu.api.block.MetaMachineBlock; import com.gregtechceu.gtceu.api.data.RotationState; + import com.lowdragmc.lowdraglib.utils.BlockInfo; import com.lowdragmc.lowdraglib.utils.Builder; + import net.minecraft.core.Direction; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; @@ -13,7 +14,7 @@ public class MultiblockShapeInfo { - private final BlockInfo[][][] blocks; //[z][y][x] + private final BlockInfo[][][] blocks; // [z][y][x] public MultiblockShapeInfo(BlockInfo[][][] blocks) { this.blocks = blocks; @@ -54,10 +55,9 @@ public ShapeInfoBuilder where(char symbol, IMachineBlock machine, Direction faci private BlockInfo[][][] bake() { return this.bakeArray(BlockInfo.class, BlockInfo.EMPTY); } + public MultiblockShapeInfo build() { return new MultiblockShapeInfo(bake()); } - } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/pattern/MultiblockState.java b/src/main/java/com/gregtechceu/gtceu/api/pattern/MultiblockState.java index 56e9f48f3b..c6b34b4326 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/pattern/MultiblockState.java +++ b/src/main/java/com/gregtechceu/gtceu/api/pattern/MultiblockState.java @@ -2,17 +2,14 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.block.ActiveBlock; -import com.gregtechceu.gtceu.api.pattern.error.PatternError; import com.gregtechceu.gtceu.api.capability.recipe.IO; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiController; +import com.gregtechceu.gtceu.api.pattern.error.PatternError; import com.gregtechceu.gtceu.api.pattern.error.PatternStringError; import com.gregtechceu.gtceu.api.pattern.predicates.SimplePredicate; import com.gregtechceu.gtceu.api.pattern.util.PatternMatchContext; -import it.unimi.dsi.fastutil.longs.LongOpenHashSet; -import it.unimi.dsi.fastutil.longs.LongSet; -import it.unimi.dsi.fastutil.longs.LongSets; -import lombok.Getter; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.server.level.ServerLevel; @@ -20,13 +17,19 @@ import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; +import it.unimi.dsi.fastutil.longs.LongOpenHashSet; +import it.unimi.dsi.fastutil.longs.LongSet; +import it.unimi.dsi.fastutil.longs.LongSets; +import lombok.Getter; import org.jetbrains.annotations.Nullable; + import java.util.Collection; import java.util.HashMap; import java.util.Map; import java.util.stream.Collectors; public class MultiblockState { + public final static PatternError UNLOAD_ERROR = new PatternStringError("multiblocked.pattern.error.chunk"); public final static PatternError UNINIT_ERROR = new PatternStringError("multiblocked.pattern.error.init"); @@ -80,8 +83,8 @@ protected boolean update(BlockPos posIn, TraceabilityPredicate predicate) { public IMultiController getController() { if (world.isLoaded(controllerPos)) { - if (world.getBlockEntity(controllerPos) instanceof IMachineBlockEntity machineBlockEntity - && machineBlockEntity.getMetaMachine() instanceof IMultiController controller) { + if (world.getBlockEntity(controllerPos) instanceof IMachineBlockEntity machineBlockEntity && + machineBlockEntity.getMetaMachine() instanceof IMultiController controller) { return lastController = controller; } } else { @@ -189,5 +192,4 @@ public void onBlockStateChanged(BlockPos pos, BlockState state) { } } } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/pattern/MultiblockWorldSavedData.java b/src/main/java/com/gregtechceu/gtceu/api/pattern/MultiblockWorldSavedData.java index a11925f20c..f6448dcfda 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/pattern/MultiblockWorldSavedData.java +++ b/src/main/java/com/gregtechceu/gtceu/api/pattern/MultiblockWorldSavedData.java @@ -1,23 +1,28 @@ package com.gregtechceu.gtceu.api.pattern; -import com.google.common.util.concurrent.ThreadFactoryBuilder; import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiController; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.saveddata.SavedData; +import com.google.common.util.concurrent.ThreadFactoryBuilder; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import org.jetbrains.annotations.NotNull; + import java.util.*; import java.util.concurrent.*; public class MultiblockWorldSavedData extends SavedData { + private final ServerLevel serverLevel; + public static MultiblockWorldSavedData getOrCreate(ServerLevel serverLevel) { - return serverLevel.getDataStorage().computeIfAbsent(tag -> new MultiblockWorldSavedData(serverLevel, tag), () -> new MultiblockWorldSavedData(serverLevel), "gtceu_multiblock"); + return serverLevel.getDataStorage().computeIfAbsent(tag -> new MultiblockWorldSavedData(serverLevel, tag), + () -> new MultiblockWorldSavedData(serverLevel), "gtceu_multiblock"); } /** @@ -46,7 +51,7 @@ public MultiblockState[] getControllerInChunk(ChunkPos chunkPos) { public void addMapping(MultiblockState state) { this.mapping.put(state.controllerPos, state); for (BlockPos blockPos : state.getCache()) { - chunkPosMapping.computeIfAbsent(new ChunkPos(blockPos), c->new HashSet<>()).add(state); + chunkPosMapping.computeIfAbsent(new ChunkPos(blockPos), c -> new HashSet<>()).add(state); } setDirty(true); } @@ -72,7 +77,7 @@ public CompoundTag save(@NotNull CompoundTag compound) { .setNameFormat("GTCEu Multiblock Async Thread-%d") .setDaemon(true) .build(); - private static final ThreadLocal IN_SERVICE = ThreadLocal.withInitial(()->false); + private static final ThreadLocal IN_SERVICE = ThreadLocal.withInitial(() -> false); private long periodID = Long.MIN_VALUE; public void createExecutorService() { @@ -83,6 +88,7 @@ public void createExecutorService() { /** * add a async logic runnable + * * @param controller controller */ public void addAsyncLogic(IMultiController controller) { @@ -92,6 +98,7 @@ public void addAsyncLogic(IMultiController controller) { /** * remove async controller + * * @param controller controller */ public void removeAsyncLogic(IMultiController controller) { @@ -131,5 +138,4 @@ public void releaseExecutorService() { public long getPeriodID() { return periodID; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/pattern/Predicates.java b/src/main/java/com/gregtechceu/gtceu/api/pattern/Predicates.java index 5e350e424a..5dbe792ec3 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/pattern/Predicates.java +++ b/src/main/java/com/gregtechceu/gtceu/api/pattern/Predicates.java @@ -20,14 +20,17 @@ import com.gregtechceu.gtceu.common.data.GTBlocks; import com.gregtechceu.gtceu.common.machine.multiblock.electric.PowerSubstationMachine; import com.gregtechceu.gtceu.config.ConfigHolder; + import com.lowdragmc.lowdraglib.utils.BlockInfo; -import com.tterrag.registrate.util.entry.RegistryEntry; + import net.minecraft.network.chat.Component; import net.minecraft.tags.TagKey; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.Fluid; + +import com.tterrag.registrate.util.entry.RegistryEntry; import org.apache.commons.lang3.ArrayUtils; import java.util.*; @@ -58,7 +61,8 @@ public static TraceabilityPredicate blocks(Block... blocks) { } public static TraceabilityPredicate blocks(IMachineBlock... blocks) { - return new TraceabilityPredicate(new PredicateBlocks(Arrays.stream(blocks).map(IMachineBlock::self).toArray(Block[]::new))); + return new TraceabilityPredicate( + new PredicateBlocks(Arrays.stream(blocks).map(IMachineBlock::self).toArray(Block[]::new))); } public static TraceabilityPredicate blockTag(TagKey tag) { @@ -76,6 +80,7 @@ public static TraceabilityPredicate fluidTag(TagKey tag) { public static TraceabilityPredicate custom(Predicate predicate, Supplier candidates) { return new TraceabilityPredicate(predicate, candidates); } + public static TraceabilityPredicate any() { return new TraceabilityPredicate(SimplePredicate.ANY); } @@ -85,7 +90,8 @@ public static TraceabilityPredicate air() { } public static TraceabilityPredicate abilities(PartAbility... abilities) { - return blocks(Arrays.stream(abilities).map(PartAbility::getAllBlocks).flatMap(Collection::stream).toArray(Block[]::new)); + return blocks(Arrays.stream(abilities).map(PartAbility::getAllBlocks).flatMap(Collection::stream) + .toArray(Block[]::new)); } public static TraceabilityPredicate ability(PartAbility ability, int... tiers) { @@ -108,7 +114,8 @@ public static TraceabilityPredicate autoAbilities(GTRecipeType[] recipeType, if (checkEnergyIn) { for (var type : recipeType) { if (type.getMaxInputs(EURecipeCapability.CAP) > 0) { - predicate = predicate.or(abilities(PartAbility.INPUT_ENERGY).setMinGlobalLimited(1).setMaxGlobalLimited(2).setPreviewCount(1)); + predicate = predicate.or(abilities(PartAbility.INPUT_ENERGY).setMinGlobalLimited(1) + .setMaxGlobalLimited(2).setPreviewCount(1)); break; } } @@ -116,7 +123,8 @@ public static TraceabilityPredicate autoAbilities(GTRecipeType[] recipeType, if (checkEnergyOut) { for (var type : recipeType) { if (type.getMaxOutputs(EURecipeCapability.CAP) > 0) { - predicate = predicate.or(abilities(PartAbility.OUTPUT_ENERGY).setMinGlobalLimited(1).setMaxGlobalLimited(2).setPreviewCount(1)); + predicate = predicate.or(abilities(PartAbility.OUTPUT_ENERGY).setMinGlobalLimited(1) + .setMaxGlobalLimited(2).setPreviewCount(1)); break; } } @@ -156,10 +164,13 @@ public static TraceabilityPredicate autoAbilities(GTRecipeType[] recipeType, return predicate; } - public static TraceabilityPredicate autoAbilities(boolean checkMaintenance, boolean checkMuffler, boolean checkParallel) { + public static TraceabilityPredicate autoAbilities(boolean checkMaintenance, boolean checkMuffler, + boolean checkParallel) { TraceabilityPredicate predicate = new TraceabilityPredicate(); if (checkMaintenance) { - predicate = predicate.or(abilities(PartAbility.MAINTENANCE).setMinGlobalLimited(ConfigHolder.INSTANCE.machines.enableMaintenance ? 1 : 0).setMaxGlobalLimited(1)); + predicate = predicate.or(abilities(PartAbility.MAINTENANCE) + .setMinGlobalLimited(ConfigHolder.INSTANCE.machines.enableMaintenance ? 1 : 0) + .setMaxGlobalLimited(1)); } if (checkMuffler) { predicate = predicate.or(abilities(PartAbility.MUFFLER).setMinGlobalLimited(1).setMaxGlobalLimited(1)); @@ -237,21 +248,23 @@ public static TraceabilityPredicate powerSubstationBatteries() { .map(entry -> new BlockInfo(entry.getValue().get().defaultBlockState(), null)) .toArray(BlockInfo[]::new)) .addTooltips(Component.translatable("gtceu.multiblock.pattern.error.batteries")); - } /** * Use this predicate for Frames in your Multiblock. Allows for Framed Pipes as well as normal Frame blocks. */ public static TraceabilityPredicate frames(Material... frameMaterials) { - return blocks(Arrays.stream(frameMaterials).map(m -> GTBlocks.MATERIAL_BLOCKS.get(TagPrefix.frameGt, m)).filter(Objects::nonNull).filter(RegistryEntry::isPresent).map(RegistryEntry::get).toArray(Block[]::new)) + return blocks(Arrays.stream(frameMaterials).map(m -> GTBlocks.MATERIAL_BLOCKS.get(TagPrefix.frameGt, m)) + .filter(Objects::nonNull).filter(RegistryEntry::isPresent).map(RegistryEntry::get) + .toArray(Block[]::new)) .or(new TraceabilityPredicate(blockWorldState -> { BlockEntity tileEntity = blockWorldState.getTileEntity(); - if (!(tileEntity instanceof IPipeNode pipeNode)) { + if (!(tileEntity instanceof IPipeNode pipeNode)) { return false; } return ArrayUtils.contains(frameMaterials, pipeNode.getFrameMaterial()); - }, () -> Arrays.stream(frameMaterials).map(m -> GTBlocks.MATERIAL_BLOCKS.get(TagPrefix.frameGt, m)).filter(Objects::nonNull).filter(RegistryEntry::isPresent).map(RegistryEntry::get).map(BlockInfo::fromBlock).toArray(BlockInfo[]::new))); + }, () -> Arrays.stream(frameMaterials).map(m -> GTBlocks.MATERIAL_BLOCKS.get(TagPrefix.frameGt, m)) + .filter(Objects::nonNull).filter(RegistryEntry::isPresent).map(RegistryEntry::get) + .map(BlockInfo::fromBlock).toArray(BlockInfo[]::new))); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/pattern/TraceabilityPredicate.java b/src/main/java/com/gregtechceu/gtceu/api/pattern/TraceabilityPredicate.java index 8e305aef93..e0d7d1f391 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/pattern/TraceabilityPredicate.java +++ b/src/main/java/com/gregtechceu/gtceu/api/pattern/TraceabilityPredicate.java @@ -2,7 +2,9 @@ import com.gregtechceu.gtceu.api.capability.recipe.IO; import com.gregtechceu.gtceu.api.pattern.predicates.SimplePredicate; + import com.lowdragmc.lowdraglib.utils.BlockInfo; + import net.minecraft.network.chat.Component; import java.util.ArrayList; @@ -141,6 +143,7 @@ public TraceabilityPredicate setMaxLayerLimited(int max, int previewCount) { /** * Sets the Minimum and Maximum limit to the passed value + * * @param limit The Maximum and Minimum limit */ public TraceabilityPredicate setExactLimit(int limit) { @@ -194,7 +197,7 @@ public boolean test(MultiblockState blockWorldState) { flag = true; } } - flag = flag || common.stream().anyMatch(predicate->predicate.test(blockWorldState)); + flag = flag || common.stream().anyMatch(predicate -> predicate.test(blockWorldState)); if (flag) { blockWorldState.setError(null); } @@ -230,5 +233,4 @@ public boolean isSingle() { public boolean hasAir() { return this.common.contains(SimplePredicate.AIR); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/pattern/error/PatternError.java b/src/main/java/com/gregtechceu/gtceu/api/pattern/error/PatternError.java index f83ac04b78..9f777d1177 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/pattern/error/PatternError.java +++ b/src/main/java/com/gregtechceu/gtceu/api/pattern/error/PatternError.java @@ -3,6 +3,7 @@ import com.gregtechceu.gtceu.api.pattern.MultiblockState; import com.gregtechceu.gtceu.api.pattern.TraceabilityPredicate; import com.gregtechceu.gtceu.api.pattern.predicates.SimplePredicate; + import net.minecraft.core.BlockPos; import net.minecraft.network.chat.Component; import net.minecraft.world.item.ItemStack; diff --git a/src/main/java/com/gregtechceu/gtceu/api/pattern/error/PatternStringError.java b/src/main/java/com/gregtechceu/gtceu/api/pattern/error/PatternStringError.java index 042d5e31bf..1f11a61905 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/pattern/error/PatternStringError.java +++ b/src/main/java/com/gregtechceu/gtceu/api/pattern/error/PatternStringError.java @@ -2,7 +2,8 @@ import net.minecraft.network.chat.Component; -public class PatternStringError extends PatternError{ +public class PatternStringError extends PatternError { + public final String translateKey; public PatternStringError(String translateKey) { diff --git a/src/main/java/com/gregtechceu/gtceu/api/pattern/error/SinglePredicateError.java b/src/main/java/com/gregtechceu/gtceu/api/pattern/error/SinglePredicateError.java index 6557ac4675..fea8334f34 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/pattern/error/SinglePredicateError.java +++ b/src/main/java/com/gregtechceu/gtceu/api/pattern/error/SinglePredicateError.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.api.pattern.error; import com.gregtechceu.gtceu.api.pattern.predicates.SimplePredicate; + import net.minecraft.network.chat.Component; import net.minecraft.world.item.ItemStack; @@ -8,6 +9,7 @@ import java.util.List; public class SinglePredicateError extends PatternError { + public final SimplePredicate predicate; public final int type; diff --git a/src/main/java/com/gregtechceu/gtceu/api/pattern/predicates/PredicateBlockTag.java b/src/main/java/com/gregtechceu/gtceu/api/pattern/predicates/PredicateBlockTag.java index f42a6701a0..7c2e954ba2 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/pattern/predicates/PredicateBlockTag.java +++ b/src/main/java/com/gregtechceu/gtceu/api/pattern/predicates/PredicateBlockTag.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.api.pattern.predicates; import com.lowdragmc.lowdraglib.utils.BlockInfo; + import net.minecraft.core.Holder; import net.minecraft.core.HolderSet; import net.minecraft.core.registries.BuiltInRegistries; @@ -9,6 +10,7 @@ import net.minecraft.world.level.block.Blocks; public class PredicateBlockTag extends SimplePredicate { + public TagKey tag = null; public PredicateBlockTag() { @@ -25,16 +27,16 @@ public PredicateBlockTag(TagKey tag) { public SimplePredicate buildPredicate() { if (tag == null) { predicate = state -> false; - candidates = () -> new BlockInfo[] {BlockInfo.fromBlock(Blocks.BARRIER)}; + candidates = () -> new BlockInfo[] { BlockInfo.fromBlock(Blocks.BARRIER) }; return this; } predicate = state -> state.getBlockState().is(tag); candidates = () -> BuiltInRegistries.BLOCK.getTag(tag) - .stream() - .flatMap(HolderSet.Named::stream) - .map(Holder::value) - .map(BlockInfo::fromBlock) - .toArray(BlockInfo[]::new); + .stream() + .flatMap(HolderSet.Named::stream) + .map(Holder::value) + .map(BlockInfo::fromBlock) + .toArray(BlockInfo[]::new); return this; } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/pattern/predicates/PredicateBlocks.java b/src/main/java/com/gregtechceu/gtceu/api/pattern/predicates/PredicateBlocks.java index f73c01d0c9..09fd777829 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/pattern/predicates/PredicateBlocks.java +++ b/src/main/java/com/gregtechceu/gtceu/api/pattern/predicates/PredicateBlocks.java @@ -1,20 +1,23 @@ package com.gregtechceu.gtceu.api.pattern.predicates; import com.lowdragmc.lowdraglib.utils.BlockInfo; + import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; + import org.apache.commons.lang3.ArrayUtils; import java.util.Arrays; import java.util.Objects; public class PredicateBlocks extends SimplePredicate { + public Block[] blocks = new Block[0]; - + public PredicateBlocks() { super("blocks"); } - + public PredicateBlocks(Block... blocks) { this(); this.blocks = blocks; @@ -24,10 +27,9 @@ public PredicateBlocks(Block... blocks) { @Override public SimplePredicate buildPredicate() { blocks = Arrays.stream(blocks).filter(Objects::nonNull).toArray(Block[]::new); - if (blocks.length == 0) blocks = new Block[]{Blocks.BARRIER}; + if (blocks.length == 0) blocks = new Block[] { Blocks.BARRIER }; predicate = state -> ArrayUtils.contains(blocks, state.getBlockState().getBlock()); candidates = () -> Arrays.stream(blocks).map(BlockInfo::fromBlock).toArray(BlockInfo[]::new); return this; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/pattern/predicates/PredicateFluidTag.java b/src/main/java/com/gregtechceu/gtceu/api/pattern/predicates/PredicateFluidTag.java index 8f1aeb27e7..b25e333d8e 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/pattern/predicates/PredicateFluidTag.java +++ b/src/main/java/com/gregtechceu/gtceu/api/pattern/predicates/PredicateFluidTag.java @@ -1,15 +1,16 @@ package com.gregtechceu.gtceu.api.pattern.predicates; import com.lowdragmc.lowdraglib.utils.BlockInfo; + import net.minecraft.core.Holder; import net.minecraft.core.HolderSet; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.tags.TagKey; -import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.material.Fluid; public class PredicateFluidTag extends SimplePredicate { + public TagKey tag = null; public PredicateFluidTag() { @@ -26,16 +27,16 @@ public PredicateFluidTag(TagKey tag) { public SimplePredicate buildPredicate() { if (tag == null) { predicate = state -> false; - candidates = () -> new BlockInfo[] {BlockInfo.fromBlock(Blocks.BARRIER)}; + candidates = () -> new BlockInfo[] { BlockInfo.fromBlock(Blocks.BARRIER) }; return this; } predicate = state -> state.getBlockState().getFluidState().is(tag); candidates = () -> BuiltInRegistries.FLUID.getTag(tag) - .stream() - .flatMap(HolderSet.Named::stream) - .map(Holder::value) - .map(fluid -> BlockInfo.fromBlockState(fluid.defaultFluidState().createLegacyBlock())) - .toArray(BlockInfo[]::new); + .stream() + .flatMap(HolderSet.Named::stream) + .map(Holder::value) + .map(fluid -> BlockInfo.fromBlockState(fluid.defaultFluidState().createLegacyBlock())) + .toArray(BlockInfo[]::new); return this; } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/pattern/predicates/PredicateFluids.java b/src/main/java/com/gregtechceu/gtceu/api/pattern/predicates/PredicateFluids.java index 332b357d8f..8d5265478d 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/pattern/predicates/PredicateFluids.java +++ b/src/main/java/com/gregtechceu/gtceu/api/pattern/predicates/PredicateFluids.java @@ -1,8 +1,10 @@ package com.gregtechceu.gtceu.api.pattern.predicates; import com.lowdragmc.lowdraglib.utils.BlockInfo; + import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.Fluids; + import org.apache.commons.lang3.ArrayUtils; import java.util.Arrays; @@ -11,6 +13,7 @@ public class PredicateFluids extends SimplePredicate { public Fluid[] fluids = new Fluid[0]; + public PredicateFluids() { super("fluids"); } @@ -24,10 +27,11 @@ public PredicateFluids(Fluid... fluids) { @Override public SimplePredicate buildPredicate() { fluids = Arrays.stream(fluids).filter(Objects::nonNull).toArray(Fluid[]::new); - if (fluids.length == 0) fluids = new Fluid[]{Fluids.WATER}; + if (fluids.length == 0) fluids = new Fluid[] { Fluids.WATER }; predicate = state -> ArrayUtils.contains(fluids, state.getBlockState().getFluidState().getType()); - candidates = () -> Arrays.stream(fluids).map(fluid -> BlockInfo.fromBlockState(fluid.defaultFluidState().createLegacyBlock())).toArray(BlockInfo[]::new); + candidates = () -> Arrays.stream(fluids) + .map(fluid -> BlockInfo.fromBlockState(fluid.defaultFluidState().createLegacyBlock())) + .toArray(BlockInfo[]::new); return this; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/pattern/predicates/PredicateStates.java b/src/main/java/com/gregtechceu/gtceu/api/pattern/predicates/PredicateStates.java index d4add6cbfa..349b90721a 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/pattern/predicates/PredicateStates.java +++ b/src/main/java/com/gregtechceu/gtceu/api/pattern/predicates/PredicateStates.java @@ -1,20 +1,23 @@ package com.gregtechceu.gtceu.api.pattern.predicates; import com.lowdragmc.lowdraglib.utils.BlockInfo; + import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; + import org.apache.commons.lang3.ArrayUtils; import java.util.Arrays; import java.util.Objects; public class PredicateStates extends SimplePredicate { + public BlockState[] states = new BlockState[0]; public PredicateStates() { super("states"); } - + public PredicateStates(BlockState... states) { this(); this.states = states; @@ -24,7 +27,7 @@ public PredicateStates(BlockState... states) { @Override public SimplePredicate buildPredicate() { states = Arrays.stream(states).filter(Objects::nonNull).toArray(BlockState[]::new); - if (states.length == 0) states = new BlockState[]{Blocks.BARRIER.defaultBlockState()}; + if (states.length == 0) states = new BlockState[] { Blocks.BARRIER.defaultBlockState() }; predicate = state -> ArrayUtils.contains(states, state.getBlockState()); candidates = () -> Arrays.stream(states).map(BlockInfo::fromBlockState).toArray(BlockInfo[]::new); return this; diff --git a/src/main/java/com/gregtechceu/gtceu/api/pattern/predicates/SimplePredicate.java b/src/main/java/com/gregtechceu/gtceu/api/pattern/predicates/SimplePredicate.java index fb1c3e9285..21160288f0 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/pattern/predicates/SimplePredicate.java +++ b/src/main/java/com/gregtechceu/gtceu/api/pattern/predicates/SimplePredicate.java @@ -1,15 +1,15 @@ package com.gregtechceu.gtceu.api.pattern.predicates; +import com.gregtechceu.gtceu.api.capability.recipe.IO; import com.gregtechceu.gtceu.api.pattern.MultiblockState; import com.gregtechceu.gtceu.api.pattern.TraceabilityPredicate; -import com.gregtechceu.gtceu.api.pattern.error.SinglePredicateError; -import com.gregtechceu.gtceu.api.capability.recipe.IO; import com.gregtechceu.gtceu.api.pattern.error.PatternStringError; +import com.gregtechceu.gtceu.api.pattern.error.SinglePredicateError; import com.gregtechceu.gtceu.data.lang.LangHandler; + import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.utils.BlockInfo; -import it.unimi.dsi.fastutil.longs.Long2ObjectArrayMap; -import it.unimi.dsi.fastutil.longs.LongOpenHashSet; + import net.minecraft.client.Minecraft; import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; @@ -20,7 +20,10 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; +import it.unimi.dsi.fastutil.longs.Long2ObjectArrayMap; +import it.unimi.dsi.fastutil.longs.LongOpenHashSet; import org.jetbrains.annotations.Nullable; + import java.util.*; import java.util.function.Predicate; import java.util.function.Supplier; @@ -28,8 +31,10 @@ import java.util.stream.Collectors; public class SimplePredicate { + public static SimplePredicate ANY = new SimplePredicate("any", x -> true, null); - public static SimplePredicate AIR = new SimplePredicate("air", blockWorldState -> blockWorldState.getWorld().isEmptyBlock(blockWorldState.getPos()), null); + public static SimplePredicate AIR = new SimplePredicate("air", + blockWorldState -> blockWorldState.getWorld().isEmptyBlock(blockWorldState.getPos()), null); @Nullable public Supplier candidates; public Predicate predicate; @@ -49,7 +54,7 @@ public class SimplePredicate { public SimplePredicate() { this("unknown"); } - + public SimplePredicate(String type) { this.type = type; } @@ -60,7 +65,8 @@ public SimplePredicate(Predicate predicate, @Nullable Supplier< this.candidates = candidates; } - public SimplePredicate(String type, Predicate predicate, @Nullable Supplier candidates) { + public SimplePredicate(String type, Predicate predicate, + @Nullable Supplier candidates) { this(type); this.predicate = predicate; this.candidates = candidates; @@ -114,7 +120,8 @@ public boolean testLimited(MultiblockState blockWorldState) { private boolean checkInnerConditions(MultiblockState blockWorldState) { if (disableRenderFormed) { - blockWorldState.getMatchContext().getOrCreate("renderMask", LongOpenHashSet::new).add(blockWorldState.getPos().asLong()); + blockWorldState.getMatchContext().getOrCreate("renderMask", LongOpenHashSet::new) + .add(blockWorldState.getPos().asLong()); } if (io != IO.BOTH) { if (blockWorldState.io == IO.BOTH) { @@ -135,8 +142,9 @@ private boolean checkInnerConditions(MultiblockState blockWorldState) { return false; } if (slotName != null) { - Map> slots = blockWorldState.getMatchContext().getOrCreate("slots", Long2ObjectArrayMap::new); - slots.computeIfAbsent(blockWorldState.getPos().asLong(), s->new HashSet<>()).add(slotName); + Map> slots = blockWorldState.getMatchContext().getOrCreate("slots", + Long2ObjectArrayMap::new); + slots.computeIfAbsent(blockWorldState.getPos().asLong(), s -> new HashSet<>()).add(slotName); return true; } return true; @@ -166,10 +174,13 @@ public boolean testLayer(MultiblockState blockWorldState) { public List getCandidates() { if (LDLib.isClient()) { - return candidates == null ? Collections.emptyList() : Arrays.stream(this.candidates.get()).filter(info -> info.getBlockState().getBlock() != Blocks.AIR) - .map(blockInfo -> blockInfo.getItemStackForm(Minecraft.getInstance().level, BlockPos.ZERO)).collect(Collectors.toList()); + return candidates == null ? Collections.emptyList() : + Arrays.stream(this.candidates.get()).filter(info -> info.getBlockState().getBlock() != Blocks.AIR) + .map(blockInfo -> blockInfo.getItemStackForm(Minecraft.getInstance().level, BlockPos.ZERO)) + .collect(Collectors.toList()); } - return candidates == null ? Collections.emptyList() : Arrays.stream(this.candidates.get()).filter(info -> info.getBlockState().getBlock() != Blocks.AIR).map(BlockInfo::getItemStackForm).collect(Collectors.toList()); + return candidates == null ? Collections.emptyList() : + Arrays.stream(this.candidates.get()).filter(info -> info.getBlockState().getBlock() != Blocks.AIR) + .map(BlockInfo::getItemStackForm).collect(Collectors.toList()); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/pattern/util/PatternMatchContext.java b/src/main/java/com/gregtechceu/gtceu/api/pattern/util/PatternMatchContext.java index abcc9cf88b..b0a01a87f2 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/pattern/util/PatternMatchContext.java +++ b/src/main/java/com/gregtechceu/gtceu/api/pattern/util/PatternMatchContext.java @@ -57,7 +57,7 @@ public T getOrPut(String key, T initialValue) { return result; } - public boolean containsKey (String key) { + public boolean containsKey(String key) { return data.containsKey(key); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/pattern/util/RelativeDirection.java b/src/main/java/com/gregtechceu/gtceu/api/pattern/util/RelativeDirection.java index 32a7a6d353..e9e08e77e0 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/pattern/util/RelativeDirection.java +++ b/src/main/java/com/gregtechceu/gtceu/api/pattern/util/RelativeDirection.java @@ -10,6 +10,7 @@ * Relative direction when facing horizontally */ public enum RelativeDirection { + UP(f -> Direction.UP, Direction.Axis.Y), DOWN(f -> Direction.DOWN, Direction.Axis.Y), LEFT(Direction::getCounterClockWise, Direction.Axis.X), @@ -125,7 +126,7 @@ public Function getSorter(Direction frontFacing, Direction up * @return Returns the new upwards facing. */ public static Direction simulateAxisRotation(Direction newFrontFacing, Direction oldFrontFacing, - Direction upwardsFacing) { + Direction upwardsFacing) { if (newFrontFacing == oldFrontFacing) return upwardsFacing; Direction.Axis newAxis = newFrontFacing.getAxis(); @@ -143,7 +144,7 @@ public static Direction simulateAxisRotation(Direction newFrontFacing, Direction default -> oldFrontFacing.getClockWise(); // WEST }; return newFrontFacing == Direction.DOWN && upwardsFacing.getAxis() == Direction.Axis.Z ? - newUpwardsFacing.getOpposite() : newUpwardsFacing; + newUpwardsFacing.getOpposite() : newUpwardsFacing; } else if (newAxis != Direction.Axis.Y) { // going from vertical to horizontal axis Direction newUpwardsFacing; @@ -157,7 +158,7 @@ public static Direction simulateAxisRotation(Direction newFrontFacing, Direction newUpwardsFacing = Direction.EAST; } return oldFrontFacing == Direction.DOWN && newUpwardsFacing.getAxis() == Direction.Axis.Z ? - newUpwardsFacing.getOpposite() : newUpwardsFacing; + newUpwardsFacing.getOpposite() : newUpwardsFacing; } else { // was on vertical axis and still is. Must have flipped from up to down or vice versa return upwardsFacing.getOpposite(); @@ -192,5 +193,4 @@ public static BlockPos offsetPos(BlockPos pos, Direction frontFacing, Direction return pos.offset(oX, oY, oZ); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/pipenet/IAttachData.java b/src/main/java/com/gregtechceu/gtceu/api/pipenet/IAttachData.java index 6445c0d49a..59ca6377ae 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/pipenet/IAttachData.java +++ b/src/main/java/com/gregtechceu/gtceu/api/pipenet/IAttachData.java @@ -16,8 +16,8 @@ public interface IAttachData { /** * set it attach to a side. + * * @return whether the status is changed. */ boolean setAttached(Direction side, boolean attach); - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/pipenet/IMaterialPipeType.java b/src/main/java/com/gregtechceu/gtceu/api/pipenet/IMaterialPipeType.java index af8127560d..c1a4ab1747 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/pipenet/IMaterialPipeType.java +++ b/src/main/java/com/gregtechceu/gtceu/api/pipenet/IMaterialPipeType.java @@ -1,6 +1,5 @@ package com.gregtechceu.gtceu.api.pipenet; - import com.gregtechceu.gtceu.api.data.tag.TagPrefix; public interface IMaterialPipeType extends IPipeType { diff --git a/src/main/java/com/gregtechceu/gtceu/api/pipenet/IPipeNode.java b/src/main/java/com/gregtechceu/gtceu/api/pipenet/IPipeNode.java index abef97104d..741185dd2b 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/pipenet/IPipeNode.java +++ b/src/main/java/com/gregtechceu/gtceu/api/pipenet/IPipeNode.java @@ -6,8 +6,9 @@ import com.gregtechceu.gtceu.api.blockentity.PipeBlockEntity; import com.gregtechceu.gtceu.api.capability.ICoverable; import com.gregtechceu.gtceu.api.data.chemical.material.Material; -import com.gregtechceu.gtceu.config.ConfigHolder; + import com.lowdragmc.lowdraglib.LDLib; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.server.level.ServerLevel; @@ -17,7 +18,8 @@ import org.jetbrains.annotations.Nullable; -public interface IPipeNode & IPipeType, NodeDataType> extends ITickSubscription, IPaintable { +public interface IPipeNode & IPipeType, NodeDataType> + extends ITickSubscription, IPaintable { long getOffsetTimer(); @@ -28,6 +30,7 @@ public interface IPipeNode & IPipeType { diff --git a/src/main/java/com/gregtechceu/gtceu/api/pipenet/IRoutePath.java b/src/main/java/com/gregtechceu/gtceu/api/pipenet/IRoutePath.java index 39f273b08c..030c5c456c 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/pipenet/IRoutePath.java +++ b/src/main/java/com/gregtechceu/gtceu/api/pipenet/IRoutePath.java @@ -5,6 +5,7 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraftforge.common.capabilities.Capability; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -29,6 +30,7 @@ default BlockEntity getTargetBlockEntity(Level level) { @Nullable default I getTargetCapability(Capability capability, Level level) { BlockEntity blockEntity = getTargetBlockEntity(level); - return blockEntity == null ? null : blockEntity.getCapability(capability, getTargetFacing().getOpposite()).resolve().orElse(null); + return blockEntity == null ? null : + blockEntity.getCapability(capability, getTargetFacing().getOpposite()).resolve().orElse(null); } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/pipenet/ITickablePipeNet.java b/src/main/java/com/gregtechceu/gtceu/api/pipenet/ITickablePipeNet.java index 5e56948348..c84dedb39e 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/pipenet/ITickablePipeNet.java +++ b/src/main/java/com/gregtechceu/gtceu/api/pipenet/ITickablePipeNet.java @@ -6,5 +6,6 @@ * @implNote ITickablePipeNet */ public interface ITickablePipeNet { + void update(); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/pipenet/LevelPipeNet.java b/src/main/java/com/gregtechceu/gtceu/api/pipenet/LevelPipeNet.java index 38a3b3e10e..32e78bf31a 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/pipenet/LevelPipeNet.java +++ b/src/main/java/com/gregtechceu/gtceu/api/pipenet/LevelPipeNet.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.api.pipenet; import com.gregtechceu.gtceu.utils.GTUtil; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; diff --git a/src/main/java/com/gregtechceu/gtceu/api/pipenet/Node.java b/src/main/java/com/gregtechceu/gtceu/api/pipenet/Node.java index ac568fe4aa..23e251d85c 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/pipenet/Node.java +++ b/src/main/java/com/gregtechceu/gtceu/api/pipenet/Node.java @@ -1,6 +1,5 @@ package com.gregtechceu.gtceu.api.pipenet; - import net.minecraft.core.Direction; /** diff --git a/src/main/java/com/gregtechceu/gtceu/api/pipenet/PipeCoverContainer.java b/src/main/java/com/gregtechceu/gtceu/api/pipenet/PipeCoverContainer.java index 73b83cdb98..05574408da 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/pipenet/PipeCoverContainer.java +++ b/src/main/java/com/gregtechceu/gtceu/api/pipenet/PipeCoverContainer.java @@ -6,28 +6,30 @@ import com.gregtechceu.gtceu.api.cover.CoverDefinition; import com.gregtechceu.gtceu.api.machine.TickableSubscription; import com.gregtechceu.gtceu.api.registry.GTRegistries; -import com.lowdragmc.lowdraglib.syncdata.IEnhancedManaged; -import com.lowdragmc.lowdraglib.syncdata.annotation.UpdateListener; import com.gregtechceu.gtceu.api.transfer.fluid.NoOpFluidTransfer; import com.gregtechceu.gtceu.api.transfer.item.NoOpItemTransfer; import com.gregtechceu.gtceu.common.blockentity.FluidPipeBlockEntity; import com.gregtechceu.gtceu.common.blockentity.ItemPipeBlockEntity; import com.gregtechceu.gtceu.utils.GTUtil; + import com.lowdragmc.lowdraglib.side.fluid.IFluidTransfer; import com.lowdragmc.lowdraglib.side.item.IItemTransfer; +import com.lowdragmc.lowdraglib.syncdata.IEnhancedManaged; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.annotation.ReadOnlyManaged; +import com.lowdragmc.lowdraglib.syncdata.annotation.UpdateListener; import com.lowdragmc.lowdraglib.syncdata.field.FieldManagedStorage; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import lombok.Getter; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.Level; -import org.jetbrains.annotations.Nullable; +import lombok.Getter; +import org.jetbrains.annotations.Nullable; /** * @author KilaBash @@ -45,7 +47,9 @@ public class PipeCoverContainer implements ICoverable, IEnhancedManaged { @DescSynced @Persisted @UpdateListener(methodName = "onCoverSet") - @ReadOnlyManaged(onDirtyMethod = "onCoverDirty", serializeMethod = "serializeCoverUid", deserializeMethod = "deserializeCoverUid") + @ReadOnlyManaged(onDirtyMethod = "onCoverDirty", + serializeMethod = "serializeCoverUid", + deserializeMethod = "deserializeCoverUid") private CoverBehavior up, down, north, south, west, east; public PipeCoverContainer(IPipeNode pipeTile) { @@ -196,7 +200,8 @@ public void setCoverAtSide(@Nullable CoverBehavior coverBehavior, Direction side @SuppressWarnings("unused") private boolean onCoverDirty(CoverBehavior coverBehavior) { - return coverBehavior != null && (coverBehavior.getSyncStorage().hasDirtySyncFields() || coverBehavior.getSyncStorage().hasDirtyPersistedFields()); + return coverBehavior != null && (coverBehavior.getSyncStorage().hasDirtySyncFields() || + coverBehavior.getSyncStorage().hasDirtyPersistedFields()); } @SuppressWarnings("unused") @@ -218,5 +223,4 @@ private CoverBehavior deserializeCoverUid(CompoundTag uid) { GTCEu.LOGGER.error("couldn't find cover definition {}", definitionId); throw new RuntimeException(); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/pipenet/PipeNet.java b/src/main/java/com/gregtechceu/gtceu/api/pipenet/PipeNet.java index 0803dfd48d..1f6bee43ba 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/pipenet/PipeNet.java +++ b/src/main/java/com/gregtechceu/gtceu/api/pipenet/PipeNet.java @@ -1,11 +1,9 @@ package com.gregtechceu.gtceu.api.pipenet; import com.gregtechceu.gtceu.utils.GTUtil; + import com.lowdragmc.lowdraglib.syncdata.ITagSerializable; -import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; -import it.unimi.dsi.fastutil.objects.Object2IntMap; -import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; @@ -14,6 +12,11 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.ChunkPos; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; +import it.unimi.dsi.fastutil.objects.Object2IntMap; +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; + import java.util.*; import java.util.Map.Entry; @@ -21,13 +24,14 @@ public abstract class PipeNet implements ITagSerializable> worldData; private final Map> nodeByBlockPos = new HashMap<>(); - private final Map> unmodifiableNodeByBlockPos = Collections.unmodifiableMap(nodeByBlockPos); + private final Map> unmodifiableNodeByBlockPos = Collections + .unmodifiableMap(nodeByBlockPos); private final Map ownedChunks = new HashMap<>(); private long lastUpdate; boolean isValid = false; public PipeNet(LevelPipeNet> Level) { - //noinspection unchecked + // noinspection unchecked this.worldData = (LevelPipeNet>) Level; } @@ -61,17 +65,14 @@ protected void onNodeConnectionsUpdate() { /** * Is only called when Data changed of nodes. */ - protected void onNodeDataUpdate() { - } + protected void onNodeDataUpdate() {} /** * Is called when any connection of any pipe in the net changes */ - public void onPipeConnectionsUpdate() { - } + public void onPipeConnectionsUpdate() {} - public void onNeighbourUpdate(BlockPos fromPos) { - } + public void onNeighbourUpdate(BlockPos fromPos) {} public Map> getAllNodes() { return unmodifiableNodeByBlockPos; @@ -152,21 +153,22 @@ public void updateBlockedConnections(BlockPos nodePos, Direction facing, boolean if (pipeNetAtOffset == null) { return; } - //if we are on that side of node too - //and it is blocked now + // if we are on that side of node too + // and it is blocked now if (pipeNetAtOffset == this) { - //if side was unblocked, well, there is really nothing changed in this e-net - //if it is blocked now, but was able to connect with neighbour node before, try split networks + // if side was unblocked, well, there is really nothing changed in this e-net + // if it is blocked now, but was able to connect with neighbour node before, try split networks if (isBlocked) { - //need to unblock node before doing canNodesConnectCheck + // need to unblock node before doing canNodesConnectCheck setBlocked(selfNode, facing, false); if (canNodesConnect(selfNode, facing, getNodeAt(offsetPos), this)) { - //now block again to call findAllConnectedBlocks + // now block again to call findAllConnectedBlocks setBlocked(selfNode, facing, true); HashMap> thisENet = findAllConnectedBlocks(nodePos); if (!getAllNodes().equals(thisENet)) { - //node visibility has changed, split network into 2 - //node that code below is similar to removeNodeInternal, but only for 2 networks, and without node removal + // node visibility has changed, split network into 2 + // node that code below is similar to removeNodeInternal, but only for 2 networks, and without + // node removal PipeNet newPipeNet = worldData.createNetInstance(); thisENet.keySet().forEach(this::removeNodeWithoutRebuilding); newPipeNet.transferNodeData(thisENet, this); @@ -174,16 +176,16 @@ public void updateBlockedConnections(BlockPos nodePos, Direction facing, boolean } } } - //there is another network on that side - //if this is an unblock, and we can connect with their node, merge them + // there is another network on that side + // if this is an unblock, and we can connect with their node, merge them } else if (!isBlocked) { Node neighbourNode = pipeNetAtOffset.getNodeAt(offsetPos); - //check connection availability from both networks + // check connection availability from both networks if (canNodesConnect(selfNode, facing, neighbourNode, pipeNetAtOffset) && pipeNetAtOffset.canNodesConnect(neighbourNode, facing.getOpposite(), selfNode, this)) { - //so, side is unblocked now, and nodes can connect, merge two networks - //our network consumes other one + // so, side is unblocked now, and nodes can connect, merge two networks + // our network consumes other one uniteNetworks(pipeNetAtOffset); } } @@ -213,32 +215,32 @@ public void updateMark(BlockPos nodePos, int newMark) { PipeNet otherPipeNet = worldData.getNetFromPos(offsetPos); Node secondNode = otherPipeNet == null ? null : otherPipeNet.getNodeAt(offsetPos); if (secondNode == null) - continue; //there is noting here + continue; // there is noting here if (!areNodeBlockedConnectionsCompatible(selfNode, facing, secondNode) || !areNodesCustomContactable(selfNode.data, secondNode.data, otherPipeNet)) - continue; //if connections aren't compatible, skip them + continue; // if connections aren't compatible, skip them if (areMarksCompatible(oldMark, secondNode.mark) == areMarksCompatible(newMark, secondNode.mark)) - continue; //if compatibility didn't change, skip it + continue; // if compatibility didn't change, skip it if (areMarksCompatible(newMark, secondNode.mark)) { - //if marks are compatible now, and offset network is different network, merge them - //if it is same network, just update mask and paths + // if marks are compatible now, and offset network is different network, merge them + // if it is same network, just update mask and paths if (otherPipeNet != this) { uniteNetworks(otherPipeNet); } - //marks are incompatible now, and this net is connected with it + // marks are incompatible now, and this net is connected with it } else if (otherPipeNet == this) { - //search connected nodes from newly marked node - //populate self connected blocks lazily only once + // search connected nodes from newly marked node + // populate self connected blocks lazily only once if (selfConnectedBlocks == null) { selfConnectedBlocks = findAllConnectedBlocks(nodePos); } if (getAllNodes().equals(selfConnectedBlocks)) { - continue; //if this node is still connected to this network, just continue + continue; // if this node is still connected to this network, just continue } - //otherwise, it is not connected + // otherwise, it is not connected HashMap> offsetConnectedBlocks = findAllConnectedBlocks(offsetPos); - //if in the result of remarking offset node has separated from main network, - //and it is also separated from current cable too, form new network for it + // if in the result of remarking offset node has separated from main network, + // and it is also separated from current cable too, form new network for it if (!offsetConnectedBlocks.equals(selfConnectedBlocks)) { offsetConnectedBlocks.keySet().forEach(this::removeNodeWithoutRebuilding); PipeNet offsetPipeNet = worldData.createNetInstance(); @@ -276,7 +278,8 @@ protected final void uniteNetworks(PipeNet unitedPipeNet) { transferNodeData(allNodes, unitedPipeNet); } - private boolean areNodeBlockedConnectionsCompatible(Node first, Direction firstFacing, Node second) { + private boolean areNodeBlockedConnectionsCompatible(Node first, Direction firstFacing, + Node second) { return !first.isBlocked(firstFacing) && !second.isBlocked(firstFacing.getOpposite()); } @@ -289,13 +292,14 @@ private boolean areMarksCompatible(int mark1, int mark2) { * Note that this logic should equal with block connection logic * for proper work of network */ - protected final boolean canNodesConnect(Node first, Direction firstFacing, Node second, PipeNet secondPipeNet) { + protected final boolean canNodesConnect(Node first, Direction firstFacing, Node second, + PipeNet secondPipeNet) { return areNodeBlockedConnectionsCompatible(first, firstFacing, second) && areMarksCompatible(first.mark, second.mark) && areNodesCustomContactable(first.data, second.data, secondPipeNet); } - //we need to search only this network + // we need to search only this network protected HashMap> findAllConnectedBlocks(BlockPos startPos) { HashMap> observedSet = new HashMap<>(); observedSet.put(startPos, getNodeAt(startPos)); @@ -307,8 +311,10 @@ protected HashMap> findAllConnectedBlocks(BlockPos for (Direction facing : GTUtil.DIRECTIONS) { currentPos.move(facing); Node secondNode = getNodeAt(currentPos); - //if there is node, and it can connect with previous node, add it to list, and set previous node as current - if (secondNode != null && canNodesConnect(firstNode, facing, secondNode, this) && !observedSet.containsKey(currentPos)) { + // if there is node, and it can connect with previous node, add it to list, and set previous node as + // current + if (secondNode != null && canNodesConnect(firstNode, facing, secondNode, this) && + !observedSet.containsKey(currentPos)) { observedSet.put(currentPos.immutable(), getNodeAt(currentPos)); firstNode = secondNode; moveStack.push(facing.getOpposite()); @@ -323,7 +329,7 @@ protected HashMap> findAllConnectedBlocks(BlockPos return observedSet; } - //called when node is removed to rebuild network + // called when node is removed to rebuild network protected void rebuildNetworkOnNodeRemoval(BlockPos nodePos, Node selfNode) { int amountOfConnectedSides = 0; for (Direction facing : GTUtil.DIRECTIONS) { @@ -331,26 +337,26 @@ protected void rebuildNetworkOnNodeRemoval(BlockPos nodePos, Node if (containsNode(offsetPos)) amountOfConnectedSides++; } - //if we are connected only on one side or not connected at all, we don't need to find connected blocks - //because they are only on on side or doesn't exist at all - //this saves a lot of performance in big networks, which are quite big to depth-first them fastly + // if we are connected only on one side or not connected at all, we don't need to find connected blocks + // because they are only on on side or doesn't exist at all + // this saves a lot of performance in big networks, which are quite big to depth-first them fastly if (amountOfConnectedSides >= 2) { for (Direction facing : GTUtil.DIRECTIONS) { BlockPos offsetPos = nodePos.relative(facing); Node secondNode = getNodeAt(offsetPos); if (secondNode == null || !canNodesConnect(selfNode, facing, secondNode, this)) { - //if there isn't any neighbour node, or it wasn't connected with us, just skip it + // if there isn't any neighbour node, or it wasn't connected with us, just skip it continue; } HashMap> thisENet = findAllConnectedBlocks(offsetPos); if (getAllNodes().equals(thisENet)) { - //if cable on some direction contains all nodes of this network - //the network didn't change so keep it as is + // if cable on some direction contains all nodes of this network + // the network didn't change so keep it as is break; } else { - //and use them to create new network with caching active nodes set + // and use them to create new network with caching active nodes set PipeNet energyNet = worldData.createNetInstance(); - //remove blocks that aren't connected with this network + // remove blocks that aren't connected with this network thisENet.keySet().forEach(this::removeNodeWithoutRebuilding); energyNet.transferNodeData(thisENet, this); worldData.addPipeNet(energyNet); @@ -358,14 +364,15 @@ protected void rebuildNetworkOnNodeRemoval(BlockPos nodePos, Node } } if (getAllNodes().isEmpty()) { - //if this energy net is empty now, remove it + // if this energy net is empty now, remove it worldData.removePipeNet(this); } onNodeConnectionsUpdate(); worldData.setDirty(); } - protected boolean areNodesCustomContactable(NodeDataType first, NodeDataType second, PipeNet secondNodePipeNet) { + protected boolean areNodesCustomContactable(NodeDataType first, NodeDataType second, + PipeNet secondNodePipeNet) { return true; } @@ -380,7 +387,8 @@ protected boolean canAttachNode(NodeDataType nodeData) { * from parent network and add it to it's own tank, keeping network contents when old network is split * Note that it should be called when parent net doesn't have transferredNodes in allNodes already */ - protected void transferNodeData(Map> transferredNodes, PipeNet parentNet) { + protected void transferNodeData(Map> transferredNodes, + PipeNet parentNet) { transferredNodes.forEach(this::addNodeSilently); onNodeConnectionsUpdate(); worldData.setDirty(); @@ -484,5 +492,4 @@ protected CompoundTag serializeAllNodeList(Map> all compound.put("WireProperties", wirePropertiesList); return compound; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/pipenet/PipeNetWalker.java b/src/main/java/com/gregtechceu/gtceu/api/pipenet/PipeNetWalker.java index eae32465be..64d904b00e 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/pipenet/PipeNetWalker.java +++ b/src/main/java/com/gregtechceu/gtceu/api/pipenet/PipeNetWalker.java @@ -2,27 +2,35 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.utils.GTUtil; + import com.lowdragmc.lowdraglib.LDLib; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; -import lombok.Getter; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.block.entity.BlockEntity; -import org.jetbrains.annotations.Nullable; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; +import lombok.Getter; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + import java.util.*; /** * This is a helper class to get information about a pipe net - *

The walker is written that it will always find the shortest path to any destination - *

On the way it can collect information about the pipes and it's neighbours - *

After creating a walker simply call {@link #traversePipeNet()} to start walking, then you can just collect the data - *

Do not walk a walker more than once + *

+ * The walker is written that it will always find the shortest path to any destination + *

+ * On the way it can collect information about the pipes and it's neighbours + *

+ * After creating a walker simply call {@link #traversePipeNet()} to start walking, then you can just collect the data + *

+ * Do not walk a walker more than once */ @SuppressWarnings("unused") public abstract class PipeNetWalker, NodeDataType, Net extends PipeNet> { + protected PipeNetWalker root; protected final Net pipeNet; private Set walked; @@ -57,7 +65,8 @@ protected PipeNetWalker(Net pipeNet, BlockPos sourcePipe, int walkedBlocks) { * @return new sub walker */ @NotNull - protected abstract PipeNetWalker createSubWalker(Net pipeNet, Direction facingToNextPos, BlockPos nextPos, int walkedBlocks); + protected abstract PipeNetWalker createSubWalker(Net pipeNet, Direction facingToNextPos, + BlockPos nextPos, int walkedBlocks); /** * Checks the neighbour of the current pos @@ -67,9 +76,8 @@ protected PipeNetWalker(Net pipeNet, BlockPos sourcePipe, int walkedBlocks) { * @param pipeNode pipeNode * @param neighbourTile the neighboring BlockEntity. Might not be a pipe. */ - protected void checkNeighbour(T pipeNode, BlockPos pipePos, Direction faceToNeighbour, @Nullable BlockEntity neighbourTile) { - - } + protected void checkNeighbour(T pipeNode, BlockPos pipePos, Direction faceToNeighbour, + @Nullable BlockEntity neighbourTile) {} /** * If the pipe is valid to perform a walk on @@ -108,8 +116,7 @@ protected Direction[] getSurroundingPipeSides() { * * @param subWalker the finished sub walker */ - protected void onRemoveSubWalker(PipeNetWalker subWalker) { - } + protected void onRemoveSubWalker(PipeNetWalker subWalker) {} public void traversePipeNet() { traversePipeNet(32768); @@ -157,8 +164,8 @@ private boolean walk() { for (int i = 0; i < nextPipeFacings.size(); i++) { Direction side = nextPipeFacings.get(i); PipeNetWalker walker = Objects.requireNonNull( - createSubWalker(pipeNet, side, currentPos.relative(side), walkedBlocks + 1), - "Walker can't be null"); + createSubWalker(pipeNet, side, currentPos.relative(side), walkedBlocks + 1), + "Walker can't be null"); walker.root = root; walker.currentPipe = nextPipes.get(i); walker.from = side.getOpposite(); @@ -182,7 +189,7 @@ private boolean checkPos() { nextPipes.clear(); if (currentPipe == null) { BlockEntity thisPipe = getLevel().getBlockEntity(currentPos); - if (!(thisPipe instanceof IPipeNode)) { + if (!(thisPipe instanceof IPipeNode)) { GTCEu.LOGGER.error("PipeWalker expected a pipe, but found {} at {}", thisPipe, currentPos); return false; } @@ -205,7 +212,7 @@ private boolean checkPos() { if (tile != null && getBasePipeClass().isAssignableFrom(tile.getClass())) { T otherPipe = (T) tile; if (!otherPipe.isConnected(accessSide.getOpposite()) || - otherPipe.isBlocked(accessSide.getOpposite()) || isWalked(otherPipe)) + otherPipe.isBlocked(accessSide.getOpposite()) || isWalked(otherPipe)) continue; if (isValidPipe(pipeTile, otherPipe, currentPos, accessSide)) { nextPipeFacings.add(accessSide); @@ -240,5 +247,4 @@ public ServerLevel getLevel() { public BlockPos getCurrentPos() { return currentPos.immutable(); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/pipenet/TickableLevelPipeNet.java b/src/main/java/com/gregtechceu/gtceu/api/pipenet/TickableLevelPipeNet.java index d366daec48..d06fb258b8 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/pipenet/TickableLevelPipeNet.java +++ b/src/main/java/com/gregtechceu/gtceu/api/pipenet/TickableLevelPipeNet.java @@ -4,12 +4,14 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.chunk.ChunkAccess; + import org.apache.commons.lang3.tuple.Pair; import java.util.*; import java.util.stream.Collectors; -public abstract class TickableLevelPipeNet & ITickablePipeNet> extends LevelPipeNet { +public abstract class TickableLevelPipeNet & ITickablePipeNet> + extends LevelPipeNet { private final Map> loadedChunksByPipeNet = new HashMap<>(); private final Set tickingPipeNets = new HashSet<>(); @@ -35,7 +37,7 @@ public void update() { if (getWorld().getGameTime() % getUpdateRate() == 0L) { tickingPipeNets.forEach(ITickablePipeNet::update); } - if(removeLater.size() > 0) { + if (removeLater.size() > 0) { removeLater.forEach(tickingPipeNets::remove); removeLater.clear(); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/pipenet/longdistance/ILDEndpoint.java b/src/main/java/com/gregtechceu/gtceu/api/pipenet/longdistance/ILDEndpoint.java index 61f9cef421..d7ec436898 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/pipenet/longdistance/ILDEndpoint.java +++ b/src/main/java/com/gregtechceu/gtceu/api/pipenet/longdistance/ILDEndpoint.java @@ -2,16 +2,17 @@ import com.gregtechceu.gtceu.api.capability.recipe.IO; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.block.entity.BlockEntity; -import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -public interface ILDEndpoint extends ILDNetworkPart{ +public interface ILDEndpoint extends ILDNetworkPart { /** * @return the current type of this endpoint (input, output or none) @@ -85,4 +86,4 @@ static ILDEndpoint tryGet(LevelAccessor world, BlockPos pos) { } return null; } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/pipenet/longdistance/ILDNetworkPart.java b/src/main/java/com/gregtechceu/gtceu/api/pipenet/longdistance/ILDNetworkPart.java index 72722243ca..b200e38834 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/pipenet/longdistance/ILDNetworkPart.java +++ b/src/main/java/com/gregtechceu/gtceu/api/pipenet/longdistance/ILDNetworkPart.java @@ -3,6 +3,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.block.state.BlockState; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -26,4 +27,4 @@ static ILDNetworkPart tryGet(LevelAccessor world, BlockPos pos) { static ILDNetworkPart tryGet(LevelAccessor world, BlockPos pos, BlockState blockState) { return blockState.getBlock() instanceof ILDNetworkPart part ? part : ILDEndpoint.tryGet(world, pos); } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/pipenet/longdistance/LongDistanceNetwork.java b/src/main/java/com/gregtechceu/gtceu/api/pipenet/longdistance/LongDistanceNetwork.java index e96e607d34..8a05c60f33 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/pipenet/longdistance/LongDistanceNetwork.java +++ b/src/main/java/com/gregtechceu/gtceu/api/pipenet/longdistance/LongDistanceNetwork.java @@ -1,13 +1,7 @@ package com.gregtechceu.gtceu.api.pipenet.longdistance; import com.gregtechceu.gtceu.utils.GTUtil; -import it.unimi.dsi.fastutil.longs.Long2ObjectMap; -import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; -import it.unimi.dsi.fastutil.objects.Object2ObjectMap; -import it.unimi.dsi.fastutil.objects.Object2ObjectMaps; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; -import lombok.Getter; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; @@ -18,9 +12,17 @@ import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.saveddata.SavedData; -import org.jetbrains.annotations.NotNull; +import it.unimi.dsi.fastutil.longs.Long2ObjectMap; +import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; +import it.unimi.dsi.fastutil.objects.Object2ObjectMap; +import it.unimi.dsi.fastutil.objects.Object2ObjectMaps; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; +import lombok.Getter; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; + import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.Collection; @@ -151,7 +153,8 @@ public void onPlaceEndpoint(ILDEndpoint endpoint) { */ protected void mergePipeNet(LongDistanceNetwork network) { if (getPipeType() != network.getPipeType()) { - throw new IllegalStateException("Can't merge unequal pipe types, " + getPipeType().getName() + " and " + network.getPipeType().getName() + " !"); + throw new IllegalStateException("Can't merge unequal pipe types, " + getPipeType().getName() + " and " + + network.getPipeType().getName() + " !"); } for (BlockPos pos : network.longDistancePipeBlocks) { this.world.putNetwork(pos, this); @@ -252,9 +255,9 @@ private int find(ILDEndpoint endpoint) { continue; } if (endpoint != other && - (other.isOutput() || other.isInput()) && - other.isInput() != endpoint.isInput() && - this.pipeType.satisfiesMinLength(endpoint, other)) { + (other.isOutput() || other.isInput()) && + other.isInput() != endpoint.isInput() && + this.pipeType.satisfiesMinLength(endpoint, other)) { // found valid endpoint with minimum distance return i; } @@ -263,9 +266,9 @@ private int find(ILDEndpoint endpoint) { } public boolean isIOIndexInvalid() { - return (this.activeInputIndex >= 0 && this.activeInputIndex >= this.endpoints.size()) - || (this.activeOutputIndex >= 0 && this.activeOutputIndex >= this.endpoints.size()) - || this.activeInputIndex < 0 != this.activeOutputIndex < 0; + return (this.activeInputIndex >= 0 && this.activeInputIndex >= this.endpoints.size()) || + (this.activeOutputIndex >= 0 && this.activeOutputIndex >= this.endpoints.size()) || + this.activeInputIndex < 0 != this.activeOutputIndex < 0; } public ILDEndpoint getActiveInputIndex() { @@ -327,7 +330,8 @@ public static WorldData create(ServerLevel level) { public static WorldData get(LevelAccessor level) { if (level instanceof ServerLevel serverLevel) { - return serverLevel.getDataStorage().computeIfAbsent((tag) -> WorldData.load(tag, serverLevel), () -> WorldData.create(serverLevel), "gtceu_long_dist_pipe"); + return serverLevel.getDataStorage().computeIfAbsent((tag) -> WorldData.load(tag, serverLevel), + () -> WorldData.create(serverLevel), "gtceu_long_dist_pipe"); } return null; } @@ -448,4 +452,4 @@ public LevelAccessor getWorld() { return this.worldRef.get(); } } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/pipenet/longdistance/LongDistancePipeBlock.java b/src/main/java/com/gregtechceu/gtceu/api/pipenet/longdistance/LongDistancePipeBlock.java index ce13463cb1..951b51c742 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/pipenet/longdistance/LongDistancePipeBlock.java +++ b/src/main/java/com/gregtechceu/gtceu/api/pipenet/longdistance/LongDistancePipeBlock.java @@ -1,7 +1,7 @@ package com.gregtechceu.gtceu.api.pipenet.longdistance; import com.gregtechceu.gtceu.utils.GTUtil; -import lombok.Getter; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.entity.LivingEntity; @@ -11,13 +11,15 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; -import org.jetbrains.annotations.NotNull; + +import lombok.Getter; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.ArrayList; import java.util.List; +import javax.annotation.ParametersAreNonnullByDefault; + @ParametersAreNonnullByDefault public class LongDistancePipeBlock extends Block implements ILDNetworkPart { @@ -28,8 +30,10 @@ public LongDistancePipeBlock(BlockBehaviour.Properties properties, LongDistanceP super(properties); this.pipeType = pipeType; } + @Override - public void setPlacedBy(Level level, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack) { + public void setPlacedBy(Level level, BlockPos pos, BlockState state, @Nullable LivingEntity placer, + ItemStack stack) { super.setPlacedBy(level, pos, state, placer, stack); if (level.isClientSide) return; // first find all neighbouring networks @@ -60,7 +64,8 @@ public List findNetworks(Level level, BlockPos pos) { LongDistanceNetwork network = LongDistanceNetwork.get(level, offsetPos); if (network != null && pipeType == network.getPipeType()) { ILDEndpoint endpoint = ILDEndpoint.tryGet(level, offsetPos); - // only count the network as connected if it's not an endpoint or the endpoints input or output face is connected + // only count the network as connected if it's not an endpoint or the endpoints input or output face is + // connected if (endpoint == null || endpoint.getFrontFacing().getAxis() == facing.getAxis()) { networks.add(network); } @@ -78,4 +83,4 @@ public void destroy(LevelAccessor level, BlockPos pos, BlockState state) { network.onRemovePipe(pos); } } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/pipenet/longdistance/LongDistancePipeType.java b/src/main/java/com/gregtechceu/gtceu/api/pipenet/longdistance/LongDistancePipeType.java index 7786f1e32d..2983ff3bcb 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/pipenet/longdistance/LongDistancePipeType.java +++ b/src/main/java/com/gregtechceu/gtceu/api/pipenet/longdistance/LongDistancePipeType.java @@ -2,12 +2,13 @@ import com.gregtechceu.gtceu.common.pipelike.fluidpipe.longdistance.LDFluidPipeType; import com.gregtechceu.gtceu.common.pipelike.item.longdistance.LDItemPipeType; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.core.BlockPos; import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.state.BlockState; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import org.jetbrains.annotations.NotNull; + import java.util.Objects; /** @@ -73,4 +74,4 @@ public final LongDistanceNetwork createNetwork(Level world) { public final String getName() { return name; } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/pipenet/longdistance/NetworkBuilder.java b/src/main/java/com/gregtechceu/gtceu/api/pipenet/longdistance/NetworkBuilder.java index fff977b446..9b173109e2 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/pipenet/longdistance/NetworkBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/api/pipenet/longdistance/NetworkBuilder.java @@ -1,13 +1,9 @@ package com.gregtechceu.gtceu.api.pipenet.longdistance; import com.gregtechceu.gtceu.utils.GTUtil; -import it.unimi.dsi.fastutil.longs.LongOpenHashSet; -import it.unimi.dsi.fastutil.objects.ObjectArrayList; -import it.unimi.dsi.fastutil.objects.ObjectList; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; -import net.minecraft.server.level.ServerChunkCache; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.LevelAccessor; @@ -17,6 +13,11 @@ import net.minecraft.world.level.chunk.ChunkSource; import net.minecraft.world.level.chunk.ChunkStatus; +import it.unimi.dsi.fastutil.longs.LongOpenHashSet; +import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import it.unimi.dsi.fastutil.objects.ObjectList; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import java.util.*; /** @@ -36,7 +37,8 @@ public class NetworkBuilder extends Thread { private final BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos(); private final LongOpenHashSet loadedChunks = new LongOpenHashSet(); - public NetworkBuilder(LongDistanceNetwork.WorldData worldData, LongDistanceNetwork network, Collection starts) { + public NetworkBuilder(LongDistanceNetwork.WorldData worldData, LongDistanceNetwork network, + Collection starts) { this.worldData = Objects.requireNonNull(worldData); this.originalNetwork = Objects.requireNonNull(network); this.network = network; @@ -54,7 +56,8 @@ public void run() { start = this.starts.remove(0); LongDistanceNetwork ldn = this.worldData.getNetwork(start); if (ldn == this.originalNetwork) { - // this starting point was caught during a previous iteration, so we don't need to create another network here + // this starting point was caught during a previous iteration, so we don't need to create another + // network here continue; } // create a new network, since the current was already calculated @@ -138,4 +141,4 @@ private BlockState getBlockState(BlockPos pos) { } return chunk.getBlockState(pos); } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/DummyCraftingContainer.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/DummyCraftingContainer.java index edd679631e..39049dd30b 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/DummyCraftingContainer.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/DummyCraftingContainer.java @@ -1,10 +1,12 @@ package com.gregtechceu.gtceu.api.recipe; import com.lowdragmc.lowdraglib.side.item.IItemTransfer; + import net.minecraft.core.NonNullList; import net.minecraft.world.entity.player.StackedContents; import net.minecraft.world.inventory.TransientCraftingContainer; import net.minecraft.world.item.ItemStack; + import org.jetbrains.annotations.NotNull; public class DummyCraftingContainer extends TransientCraftingContainer { @@ -76,5 +78,4 @@ private static NonNullList createInventory(IItemTransfer itemHandler) return inv; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/FacadeCoverRecipe.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/FacadeCoverRecipe.java index 11a6c4e033..b72e0011b2 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/FacadeCoverRecipe.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/FacadeCoverRecipe.java @@ -1,12 +1,12 @@ package com.gregtechceu.gtceu.api.recipe; -import com.google.gson.JsonObject; import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.data.chemical.ChemicalHelper; import com.gregtechceu.gtceu.api.data.tag.TagPrefix; import com.gregtechceu.gtceu.common.data.GTItems; import com.gregtechceu.gtceu.common.data.GTMaterials; import com.gregtechceu.gtceu.common.item.FacadeItemBehaviour; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.NonNullList; import net.minecraft.core.RegistryAccess; @@ -21,6 +21,8 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Blocks; +import com.google.gson.JsonObject; + import javax.annotation.ParametersAreNonnullByDefault; /** @@ -34,6 +36,7 @@ public class FacadeCoverRecipe implements CraftingRecipe { public static final FacadeCoverRecipe INSTANCE = new FacadeCoverRecipe(); public static final RecipeSerializer SERIALIZER = new RecipeSerializer<>() { + @Override public FacadeCoverRecipe fromJson(ResourceLocation recipeId, JsonObject serializedRecipe) { return INSTANCE; @@ -45,11 +48,9 @@ public FacadeCoverRecipe fromNetwork(ResourceLocation recipeId, FriendlyByteBuf } @Override - public void toNetwork(FriendlyByteBuf buffer, FacadeCoverRecipe recipe) { - } + public void toNetwork(FriendlyByteBuf buffer, FacadeCoverRecipe recipe) {} }; - public static ResourceLocation ID = GTCEu.id("crafting/facade_cover"); @Override diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipe.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipe.java index c2ea9e487e..9e19072478 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipe.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipe.java @@ -6,7 +6,7 @@ import com.gregtechceu.gtceu.api.recipe.content.Content; import com.gregtechceu.gtceu.api.recipe.content.ContentModifier; import com.gregtechceu.gtceu.data.recipe.builder.GTRecipeBuilder; -import lombok.Getter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.RegistryAccess; import net.minecraft.nbt.CompoundTag; @@ -16,13 +16,16 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraft.world.level.Level; + +import lombok.Getter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.*; import java.util.function.Supplier; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author KilaBash * @date 2023/2/20 @@ -31,6 +34,7 @@ @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault public class GTRecipe implements net.minecraft.world.item.crafting.Recipe { + public final GTRecipeType recipeType; @Getter public final ResourceLocation id; @@ -72,7 +76,8 @@ public GTRecipe(GTRecipeType recipeType, this.isFuel = isFuel; } - public Map, List> copyContents(Map, List> contents, @Nullable ContentModifier modifier) { + public Map, List> copyContents(Map, List> contents, + @Nullable ContentModifier modifier) { Map, List> copyContents = new HashMap<>(); for (var entry : contents.entrySet()) { var contentList = entry.getValue(); @@ -89,7 +94,9 @@ public Map, List> copyContents(Map(conditions), new ArrayList<>(ingredientActions), data, duration, isFuel); + return new GTRecipe(recipeType, id, copyContents(inputs, null), copyContents(outputs, null), + copyContents(tickInputs, null), copyContents(tickOutputs, null), new ArrayList<>(conditions), + new ArrayList<>(ingredientActions), data, duration, isFuel); } public GTRecipe copy(ContentModifier modifier) { @@ -97,7 +104,9 @@ public GTRecipe copy(ContentModifier modifier) { } public GTRecipe copy(ContentModifier modifier, boolean modifyDuration) { - var copied = new GTRecipe(recipeType, id, copyContents(inputs, modifier), copyContents(outputs, modifier), copyContents(tickInputs, modifier), copyContents(tickOutputs, modifier), new ArrayList<>(conditions), new ArrayList<>(ingredientActions), data, duration, isFuel); + var copied = new GTRecipe(recipeType, id, copyContents(inputs, modifier), copyContents(outputs, modifier), + copyContents(tickInputs, modifier), copyContents(tickOutputs, modifier), new ArrayList<>(conditions), + new ArrayList<>(ingredientActions), data, duration, isFuel); if (modifyDuration) { copied.duration = modifier.apply(this.duration).intValue(); } @@ -138,7 +147,6 @@ public ItemStack getResultItem(RegistryAccess registryManager) { // **********************internal logic********************* // /////////////////////////////////////////////////////////////// - public List getInputContents(RecipeCapability capability) { return inputs.getOrDefault(capability, Collections.emptyList()); } @@ -175,7 +183,8 @@ private ActionResult matchRecipe(IRecipeCapabilityHolder holder, boolean tick) { return ActionResult.SUCCESS; } - public ActionResult matchRecipeContents(IO io, IRecipeCapabilityHolder holder, Map, List> contents) { + public ActionResult matchRecipeContents(IO io, IRecipeCapabilityHolder holder, + Map, List> contents) { RecipeRunner runner = new RecipeRunner(this, io, holder, true); for (Map.Entry, List> entry : contents.entrySet()) { var result = runner.handle(entry); @@ -184,9 +193,11 @@ public ActionResult matchRecipeContents(IO io, IRecipeCapabilityHolder holder, M if (result.result().content != null || !result.result().slots.isEmpty()) { if (io == IO.IN) { - return ActionResult.fail(() -> Component.translatable("gtceu.recipe_logic.insufficient_in").append(": ").append(result.capability().getName()), 0f); + return ActionResult.fail(() -> Component.translatable("gtceu.recipe_logic.insufficient_in") + .append(": ").append(result.capability().getName()), 0f); } else if (io == IO.OUT) { - return ActionResult.fail(() -> Component.translatable("gtceu.recipe_logic.insufficient_out").append(": ").append(result.capability().getName()), 0f); + return ActionResult.fail(() -> Component.translatable("gtceu.recipe_logic.insufficient_out") + .append(": ").append(result.capability().getName()), 0f); } else { return ActionResult.FAIL_NO_REASON; } @@ -205,7 +216,8 @@ public boolean handleRecipeIO(IO io, IRecipeCapabilityHolder holder) { return handleRecipe(io, holder, io == IO.IN ? inputs : outputs); } - public boolean handleRecipe(IO io, IRecipeCapabilityHolder holder, Map, List> contents) { + public boolean handleRecipe(IO io, IRecipeCapabilityHolder holder, + Map, List> contents) { RecipeRunner runner = new RecipeRunner(this, io, holder, false); for (Map.Entry, List> entry : contents.entrySet()) { var handled = runner.handle(entry); @@ -220,8 +232,6 @@ public boolean handleRecipe(IO io, IRecipeCapabilityHolder holder, Map new ArrayList<>()).add(condition); } else if (condition.test(this, recipeLogic) == condition.isReverse()) { - return ActionResult.fail(() -> Component.translatable("gtceu.recipe_logic.condition_fails").append(": ").append(condition.getTooltips())); + return ActionResult.fail(() -> Component.translatable("gtceu.recipe_logic.condition_fails").append(": ") + .append(condition.getTooltips())); } } for (List conditions : or.values()) { @@ -315,7 +326,8 @@ public GTRecipe trimRecipeOutputs(Map, Integer> trimLimits) * @param trimLimits The limit(s) on the number of outputs, -1 for disabled. * @return All recipe outputs, limited by some factor(s) */ - public Map, List> doTrim(Map, List> current, Map, Integer> trimLimits) { + public Map, List> doTrim(Map, List> current, + Map, Integer> trimLimits) { Map, List> outputs = new HashMap<>(); Set> trimmed = new HashSet<>(); @@ -346,7 +358,8 @@ else if (nonChanced.size() >= outputLimit) { } // If the regular outputs and chanced outputs are required to satisfy the outputLimit else if (!nonChanced.isEmpty() && (nonChanced.size() + chanced.size()) >= outputLimit) { - outputs.computeIfAbsent(key, $ -> new ArrayList<>()).addAll(nonChanced.stream().map(cont -> cont.copy(key, null)).toList()); + outputs.computeIfAbsent(key, $ -> new ArrayList<>()) + .addAll(nonChanced.stream().map(cont -> cont.copy(key, null)).toList()); // Calculate the number of chanced outputs after adding all the regular outputs int numChanced = outputLimit - nonChanced.size(); @@ -359,12 +372,14 @@ else if (nonChanced.isEmpty()) { } // The number of outputs + chanced outputs is lower than the trim number, so just add everything else { - outputs.computeIfAbsent(key, $ -> new ArrayList<>()).addAll(nonChanced.stream().map(cont -> cont.copy(key, null)).toList()); + outputs.computeIfAbsent(key, $ -> new ArrayList<>()) + .addAll(nonChanced.stream().map(cont -> cont.copy(key, null)).toList()); // Chanced outputs are taken care of in the original copy } if (!chanced.isEmpty()) - outputs.computeIfAbsent(key, $ -> new ArrayList<>()).addAll(chanced.stream().map(cont -> cont.copy(key, null)).toList()); + outputs.computeIfAbsent(key, $ -> new ArrayList<>()) + .addAll(chanced.stream().map(cont -> cont.copy(key, null)).toList()); trimmed.add(key); } @@ -378,17 +393,18 @@ else if (nonChanced.isEmpty()) { /** * - * @param isSuccess is action success - * @param reason if fail, fail reason + * @param isSuccess is action success + * @param reason if fail, fail reason * @param expectingRate if recipe matching fail, the expecting rate of one cap. - *
- * For example, recipe require 300eu and 10 apples, and left 100eu and 5 apples after recipe searching. - *
- * EU Missing Rate : 300 / (300 - 100) = 1.5 - *
- * Item Missing Rate : 10 / (10 - 5) = 2 - *
- * return max expecting rate --- 2 + *
+ * For example, recipe require 300eu and 10 apples, and left 100eu and 5 apples after recipe + * searching. + *
+ * EU Missing Rate : 300 / (300 - 100) = 1.5 + *
+ * Item Missing Rate : 10 / (10 - 5) = 2 + *
+ * return max expecting rate --- 2 */ public static record ActionResult(boolean isSuccess, @Nullable Supplier reason, float expectingRate) { @@ -405,7 +421,8 @@ public static ActionResult fail(@Nullable Supplier component, float e } public boolean checkRecipeValid() { - return checkItemValid(inputs, "input") && checkItemValid(outputs, "output") && checkItemValid(tickInputs, "tickInput") && checkItemValid(tickOutputs, "tickOutput"); + return checkItemValid(inputs, "input") && checkItemValid(outputs, "output") && + checkItemValid(tickInputs, "tickInput") && checkItemValid(tickOutputs, "tickOutput"); } private boolean checkItemValid(Map, List> contents, String name) { diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipeSerializer.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipeSerializer.java index 59762b6398..352dcd76e0 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipeSerializer.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipeSerializer.java @@ -1,14 +1,11 @@ package com.gregtechceu.gtceu.api.recipe; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.capability.recipe.RecipeCapability; import com.gregtechceu.gtceu.api.recipe.content.Content; import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.common.recipe.ResearchCondition; -import dev.latvian.mods.kubejs.recipe.ingredientaction.IngredientAction; + import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.FriendlyByteBuf; @@ -17,6 +14,11 @@ import net.minecraft.util.Tuple; import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraftforge.common.crafting.CraftingHelper; + +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import dev.latvian.mods.kubejs.recipe.ingredientaction.IngredientAction; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; @@ -56,12 +58,17 @@ public Map, List> capabilitiesFromJson(JsonObject j CompoundTag data = new CompoundTag(); if (json.has("data")) data = CraftingHelper.getNBT(json.get("data")); - Map, List> inputs = capabilitiesFromJson(json.has("inputs") ? json.getAsJsonObject("inputs") : new JsonObject()); - Map, List> tickInputs = capabilitiesFromJson(json.has("tickInputs") ? json.getAsJsonObject("tickInputs") : new JsonObject()); - Map, List> outputs = capabilitiesFromJson(json.has("outputs") ? json.getAsJsonObject("outputs") : new JsonObject()); - Map, List> tickOutputs = capabilitiesFromJson(json.has("tickOutputs") ? json.getAsJsonObject("tickOutputs") : new JsonObject()); + Map, List> inputs = capabilitiesFromJson( + json.has("inputs") ? json.getAsJsonObject("inputs") : new JsonObject()); + Map, List> tickInputs = capabilitiesFromJson( + json.has("tickInputs") ? json.getAsJsonObject("tickInputs") : new JsonObject()); + Map, List> outputs = capabilitiesFromJson( + json.has("outputs") ? json.getAsJsonObject("outputs") : new JsonObject()); + Map, List> tickOutputs = capabilitiesFromJson( + json.has("tickOutputs") ? json.getAsJsonObject("tickOutputs") : new JsonObject()); List conditions = new ArrayList<>(); - JsonArray conditionsJson = json.has("recipeConditions") ? json.getAsJsonArray("recipeConditions") : new JsonArray(); + JsonArray conditionsJson = json.has("recipeConditions") ? json.getAsJsonArray("recipeConditions") : + new JsonArray(); for (JsonElement jsonElement : conditionsJson) { if (jsonElement instanceof JsonObject jsonObject) { var conditionKey = GsonHelper.getAsString(jsonObject, "type", ""); @@ -69,7 +76,8 @@ public Map, List> capabilitiesFromJson(JsonObject j if (clazz != null) { RecipeCondition condition = RecipeCondition.create(clazz); if (condition != null) { - conditions.add(condition.deserialize(GsonHelper.getAsJsonObject(jsonObject, "data", new JsonObject()))); + conditions.add(condition + .deserialize(GsonHelper.getAsJsonObject(jsonObject, "data", new JsonObject()))); } } } @@ -79,7 +87,8 @@ public Map, List> capabilitiesFromJson(JsonObject j ingredientActions = KJSCallWrapper.getIngredientActions(json); } boolean isFuel = GsonHelper.getAsBoolean(json, "isFuel", false); - return new GTRecipe((GTRecipeType) BuiltInRegistries.RECIPE_TYPE.get(new ResourceLocation(recipeType)), id, inputs, outputs, tickInputs, tickOutputs, conditions, ingredientActions, data, duration, isFuel); + return new GTRecipe((GTRecipeType) BuiltInRegistries.RECIPE_TYPE.get(new ResourceLocation(recipeType)), id, + inputs, outputs, tickInputs, tickOutputs, conditions, ingredientActions, data, duration, isFuel); } public static Tuple, List> entryReader(FriendlyByteBuf buf) { @@ -116,11 +125,16 @@ public static Map, List> tuplesToMap(List, List> inputs = tuplesToMap(buf.readCollection(c -> new ArrayList<>(), GTRecipeSerializer::entryReader)); - Map, List> tickInputs = tuplesToMap(buf.readCollection(c -> new ArrayList<>(), GTRecipeSerializer::entryReader)); - Map, List> outputs = tuplesToMap(buf.readCollection(c -> new ArrayList<>(), GTRecipeSerializer::entryReader)); - Map, List> tickOutputs = tuplesToMap(buf.readCollection(c -> new ArrayList<>(), GTRecipeSerializer::entryReader)); - List conditions = buf.readCollection(c -> new ArrayList<>(), GTRecipeSerializer::conditionReader); + Map, List> inputs = tuplesToMap( + buf.readCollection(c -> new ArrayList<>(), GTRecipeSerializer::entryReader)); + Map, List> tickInputs = tuplesToMap( + buf.readCollection(c -> new ArrayList<>(), GTRecipeSerializer::entryReader)); + Map, List> outputs = tuplesToMap( + buf.readCollection(c -> new ArrayList<>(), GTRecipeSerializer::entryReader)); + Map, List> tickOutputs = tuplesToMap( + buf.readCollection(c -> new ArrayList<>(), GTRecipeSerializer::entryReader)); + List conditions = buf.readCollection(c -> new ArrayList<>(), + GTRecipeSerializer::conditionReader); List ingredientActions = new ArrayList<>(); if (GTCEu.isKubeJSLoaded()) { ingredientActions = KJSCallWrapper.getIngredientActions(buf); @@ -131,10 +145,13 @@ public GTRecipe fromNetwork(@NotNull ResourceLocation id, @NotNull FriendlyByteB } boolean isFuel = buf.readBoolean(); GTRecipeType type = (GTRecipeType) BuiltInRegistries.RECIPE_TYPE.get(recipeType); - GTRecipe recipe = new GTRecipe(type, id, inputs, outputs, tickInputs, tickOutputs, conditions, ingredientActions, data, duration, isFuel); + GTRecipe recipe = new GTRecipe(type, id, inputs, outputs, tickInputs, tickOutputs, conditions, + ingredientActions, data, duration, isFuel); - // a little special piece of code for loading all the research entries into the recipe type's list on the client. - ResearchCondition researchCondition = conditions.stream().filter(ResearchCondition.class::isInstance).findAny().map(ResearchCondition.class::cast).orElse(null); + // a little special piece of code for loading all the research entries into the recipe type's list on the + // client. + ResearchCondition researchCondition = conditions.stream().filter(ResearchCondition.class::isInstance).findAny() + .map(ResearchCondition.class::cast).orElse(null); if (researchCondition != null) { for (ResearchData.ResearchEntry entry : researchCondition.data) { type.addDataStickEntry(entry.getResearchId(), recipe); @@ -160,16 +177,18 @@ public void toNetwork(FriendlyByteBuf buf, GTRecipe recipe) { } public static class KJSCallWrapper { + public static List getIngredientActions(JsonObject json) { return IngredientAction.parseList(json.get("kubejs:actions")); } + public static List getIngredientActions(FriendlyByteBuf buf) { return IngredientAction.readList(buf); } + public static void writeIngredientActions(List ingredientActions, FriendlyByteBuf buf) { - //noinspection unchecked must be List to be able to load without KJS. + // noinspection unchecked must be List to be able to load without KJS. IngredientAction.writeList(buf, (List) ingredientActions); - } } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipeType.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipeType.java index 60de53a1ce..63998644a7 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipeType.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipeType.java @@ -10,16 +10,12 @@ import com.gregtechceu.gtceu.core.mixins.RecipeManagerInvoker; import com.gregtechceu.gtceu.data.recipe.builder.GTRecipeBuilder; import com.gregtechceu.gtceu.utils.FormattingUtil; + import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.texture.ProgressTexture; import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; -import it.unimi.dsi.fastutil.bytes.Byte2ObjectArrayMap; -import it.unimi.dsi.fastutil.bytes.Byte2ObjectMap; -import it.unimi.dsi.fastutil.objects.*; -import lombok.Getter; -import lombok.Setter; -import lombok.experimental.Accessors; + import net.minecraft.core.RegistryAccess; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.data.recipes.FinishedRecipe; @@ -31,6 +27,13 @@ import net.minecraft.world.item.crafting.RecipeType; import net.minecraft.world.item.crafting.SmeltingRecipe; import net.minecraft.world.level.ItemLike; + +import it.unimi.dsi.fastutil.bytes.Byte2ObjectArrayMap; +import it.unimi.dsi.fastutil.bytes.Byte2ObjectMap; +import it.unimi.dsi.fastutil.objects.*; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -47,6 +50,7 @@ */ @Accessors(chain = true) public class GTRecipeType implements RecipeType { + public static final List CUSTOM_SCANNER_LOGICS = new ArrayList<>(); public final ResourceLocation registryName; @@ -112,8 +116,10 @@ public GTRecipeType(ResourceLocation registryName, String group, RecipeType.. } public GTRecipeType setMaxIOSize(int maxInputs, int maxOutputs, int maxFluidInputs, int maxFluidOutputs) { - return setMaxSize(IO.IN, ItemRecipeCapability.CAP, maxInputs).setMaxSize(IO.IN, FluidRecipeCapability.CAP, maxFluidInputs) - .setMaxSize(IO.OUT, ItemRecipeCapability.CAP, maxOutputs).setMaxSize(IO.OUT, FluidRecipeCapability.CAP, maxFluidOutputs); + return setMaxSize(IO.IN, ItemRecipeCapability.CAP, maxInputs) + .setMaxSize(IO.IN, FluidRecipeCapability.CAP, maxFluidInputs) + .setMaxSize(IO.OUT, ItemRecipeCapability.CAP, maxOutputs) + .setMaxSize(IO.OUT, FluidRecipeCapability.CAP, maxFluidOutputs); } public GTRecipeType setEUIO(IO io) { @@ -184,12 +190,14 @@ public GTRecipe getRecipe(RecipeManager recipeManager, ResourceLocation id) { @Nullable public Iterator searchFuelRecipe(IRecipeCapabilityHolder holder) { if (!holder.hasProxies() || !isFuelRecipeType()) return null; - return getLookup().getRecipeIterator(holder, recipe -> recipe.isFuel && recipe.matchRecipe(holder).isSuccess() && recipe.matchTickRecipe(holder).isSuccess()); + return getLookup().getRecipeIterator(holder, recipe -> recipe.isFuel && + recipe.matchRecipe(holder).isSuccess() && recipe.matchTickRecipe(holder).isSuccess()); } public Iterator searchRecipe(IRecipeCapabilityHolder holder) { if (!holder.hasProxies()) return null; - var iterator = getLookup().getRecipeIterator(holder, recipe -> !recipe.isFuel && recipe.matchRecipe(holder).isSuccess() && recipe.matchTickRecipe(holder).isSuccess()); + var iterator = getLookup().getRecipeIterator(holder, recipe -> !recipe.isFuel && + recipe.matchRecipe(holder).isSuccess() && recipe.matchTickRecipe(holder).isSuccess()); boolean any = false; while (iterator.hasNext()) { GTRecipe recipe = iterator.next(); @@ -211,7 +219,6 @@ public Iterator searchRecipe(IRecipeCapabilityHolder holder) { public int getMaxInputs(RecipeCapability cap) { return maxInputs.getOrDefault(cap, 0); - } public int getMaxOutputs(RecipeCapability cap) { @@ -219,7 +226,7 @@ public int getMaxOutputs(RecipeCapability cap) { } ////////////////////////////////////// - //***** Recipe Builder ******// + // ***** Recipe Builder ******// ////////////////////////////////////// public GTRecipeType prepareBuilder(Consumer onPrepare) { @@ -230,7 +237,8 @@ public GTRecipeType prepareBuilder(Consumer onPrepare) { public GTRecipeBuilder recipeBuilder(ResourceLocation id, Object... append) { if (append.length > 0) { return recipeBuilder.copy(new ResourceLocation(id.getNamespace(), - id.getPath() + Arrays.stream(append).map(Object::toString).map(FormattingUtil::toLowerCaseUnder).reduce("", (a, b) -> a + "_" + b))); + id.getPath() + Arrays.stream(append).map(Object::toString).map(FormattingUtil::toLowerCaseUnder) + .reduce("", (a, b) -> a + "_" + b))); } return recipeBuilder.copy(id); } @@ -240,7 +248,8 @@ public GTRecipeBuilder recipeBuilder(String id, Object... append) { } public GTRecipeBuilder recipeBuilder(UnificationEntry entry, Object... append) { - return recipeBuilder(GTCEu.id(entry.tagPrefix + (entry.material == null ? "" : "_" + entry.material.getName())), append); + return recipeBuilder(GTCEu.id(entry.tagPrefix + (entry.material == null ? "" : "_" + entry.material.getName())), + append); } public GTRecipeBuilder recipeBuilder(Supplier item, Object... append) { @@ -307,7 +316,8 @@ public GTRecipe toGTrecipe(ResourceLocation id, Recipe recipe) { /** * - * @param logic A function which is passed the normal findRecipe() result. Returns null if no valid recipe for the custom logic is found. + * @param logic A function which is passed the normal findRecipe() result. Returns null if no valid recipe for the + * custom logic is found. */ public static void registerCustomScannerLogic(ICustomScannerLogic logic) { CUSTOM_SCANNER_LOGICS.add(logic); @@ -331,5 +341,4 @@ default List getRepresentativeRecipes() { return null; } } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/OverclockingLogic.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/OverclockingLogic.java index b59728204a..b5a2ce865e 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/OverclockingLogic.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/OverclockingLogic.java @@ -2,40 +2,44 @@ import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.utils.GTUtil; -import com.mojang.datafixers.util.Function5; + import it.unimi.dsi.fastutil.longs.LongIntMutablePair; import it.unimi.dsi.fastutil.longs.LongIntPair; import lombok.Getter; - import org.jetbrains.annotations.NotNull; /** * A class for holding all the various Overclocking logics */ public class OverclockingLogic { + @FunctionalInterface public interface Logic { + /** * Calls the desired overclocking logic to be run for the recipe. * Performs the actual overclocking on the provided recipe. * Override this to call custom overclocking mechanics * - * @param recipe current recipe - * @param recipeEUt the EUt of the recipe - * @param maxVoltage the maximum voltage the recipe is allowed to be run at - * @param duration the duration of the recipe - * @param amountOC the maximum amount of overclocks to perform + * @param recipe current recipe + * @param recipeEUt the EUt of the recipe + * @param maxVoltage the maximum voltage the recipe is allowed to be run at + * @param duration the duration of the recipe + * @param amountOC the maximum amount of overclocks to perform * @return an int array of {OverclockedEUt, OverclockedDuration} */ - LongIntPair runOverclockingLogic(@NotNull GTRecipe recipe, long recipeEUt, long maxVoltage, int duration, int amountOC); + LongIntPair runOverclockingLogic(@NotNull GTRecipe recipe, long recipeEUt, long maxVoltage, int duration, + int amountOC); } public static final double STANDARD_OVERCLOCK_VOLTAGE_MULTIPLIER = 4.0; public static final double STANDARD_OVERCLOCK_DURATION_DIVISOR = ConfigHolder.INSTANCE.machines.overclockDivisor; public static final double PERFECT_OVERCLOCK_DURATION_DIVISOR = 4.0; - public static final OverclockingLogic PERFECT_OVERCLOCK = new OverclockingLogic(PERFECT_OVERCLOCK_DURATION_DIVISOR, STANDARD_OVERCLOCK_VOLTAGE_MULTIPLIER); - public static final OverclockingLogic NON_PERFECT_OVERCLOCK = new OverclockingLogic(STANDARD_OVERCLOCK_DURATION_DIVISOR, STANDARD_OVERCLOCK_VOLTAGE_MULTIPLIER); + public static final OverclockingLogic PERFECT_OVERCLOCK = new OverclockingLogic(PERFECT_OVERCLOCK_DURATION_DIVISOR, + STANDARD_OVERCLOCK_VOLTAGE_MULTIPLIER); + public static final OverclockingLogic NON_PERFECT_OVERCLOCK = new OverclockingLogic( + STANDARD_OVERCLOCK_DURATION_DIVISOR, STANDARD_OVERCLOCK_VOLTAGE_MULTIPLIER); @Getter protected Logic logic; @@ -51,8 +55,7 @@ public OverclockingLogic(double durationDivisor, double voltageMultiplier) { duration, amountOC, durationDivisor, - voltageMultiplier - ); + voltageMultiplier); } /** @@ -67,7 +70,9 @@ public OverclockingLogic(double durationDivisor, double voltageMultiplier) { * @return an int array of {OverclockedEUt, OverclockedDuration} */ @NotNull - public static LongIntPair standardOverclockingLogic(long recipeEUt, long maxVoltage, int recipeDuration, int numberOfOCs, double durationDivisor, double voltageMultiplier) { + public static LongIntPair standardOverclockingLogic(long recipeEUt, long maxVoltage, int recipeDuration, + int numberOfOCs, double durationDivisor, + double voltageMultiplier) { double resultDuration = recipeDuration; double resultVoltage = recipeEUt; @@ -93,7 +98,8 @@ public static LongIntPair standardOverclockingLogic(long recipeEUt, long maxVolt } @NotNull - public static LongIntPair heatingCoilOverclockingLogic(long recipeEUt, long maximumVoltage, int recipeDuration, int maxOverclocks, int currentTemp, int recipeRequiredTemp) { + public static LongIntPair heatingCoilOverclockingLogic(long recipeEUt, long maximumVoltage, int recipeDuration, + int maxOverclocks, int currentTemp, int recipeRequiredTemp) { int amountEUDiscount = Math.max(0, (currentTemp - recipeRequiredTemp) / 900); int amountPerfectOC = amountEUDiscount / 2; @@ -103,18 +109,23 @@ public static LongIntPair heatingCoilOverclockingLogic(long recipeEUt, long maxi // perfect overclock for every 1800k over recipe temperature if (amountPerfectOC > 0) { // use the normal overclock logic to do perfect OCs up to as many times as calculated - var overclock = standardOverclockingLogic(recipeEUt, maximumVoltage, recipeDuration, amountPerfectOC, PERFECT_OVERCLOCK_DURATION_DIVISOR, STANDARD_OVERCLOCK_VOLTAGE_MULTIPLIER); + var overclock = standardOverclockingLogic(recipeEUt, maximumVoltage, recipeDuration, amountPerfectOC, + PERFECT_OVERCLOCK_DURATION_DIVISOR, STANDARD_OVERCLOCK_VOLTAGE_MULTIPLIER); // overclock normally as much as possible after perfects are exhausted - return standardOverclockingLogic(overclock.leftLong(), maximumVoltage, overclock.rightInt(), maxOverclocks - amountPerfectOC, STANDARD_OVERCLOCK_DURATION_DIVISOR, STANDARD_OVERCLOCK_VOLTAGE_MULTIPLIER); + return standardOverclockingLogic(overclock.leftLong(), maximumVoltage, overclock.rightInt(), + maxOverclocks - amountPerfectOC, STANDARD_OVERCLOCK_DURATION_DIVISOR, + STANDARD_OVERCLOCK_VOLTAGE_MULTIPLIER); } // no perfects are performed, do normal overclocking - return standardOverclockingLogic(recipeEUt, maximumVoltage, recipeDuration, maxOverclocks, STANDARD_OVERCLOCK_DURATION_DIVISOR, STANDARD_OVERCLOCK_VOLTAGE_MULTIPLIER); + return standardOverclockingLogic(recipeEUt, maximumVoltage, recipeDuration, maxOverclocks, + STANDARD_OVERCLOCK_DURATION_DIVISOR, STANDARD_OVERCLOCK_VOLTAGE_MULTIPLIER); } /** - * Finds the maximum tier that a recipe can overclock to, when provided the maximum voltage a recipe can overclock to. + * Finds the maximum tier that a recipe can overclock to, when provided the maximum voltage a recipe can overclock + * to. * * @param voltage The maximum voltage the recipe is allowed to overclock to. * @return the highest voltage tier the machine should use to overclock with @@ -122,5 +133,4 @@ public static LongIntPair heatingCoilOverclockingLogic(long recipeEUt, long maxi protected int getOverclockForTier(long voltage) { return GTUtil.getTierByVoltage(voltage); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeCondition.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeCondition.java index fb98a6a80d..ca9a5a8285 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeCondition.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeCondition.java @@ -1,14 +1,16 @@ package com.gregtechceu.gtceu.api.recipe; -import com.google.gson.JsonObject; import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; + import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; + import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; import net.minecraft.util.GsonHelper; +import com.google.gson.JsonObject; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -43,7 +45,8 @@ public IGuiTexture getInValidTexture() { } public IGuiTexture getValidTexture() { - return new ResourceTexture("gtceu:textures/gui/condition/" + getType() + ".png").getSubTexture(0, 0.5f, 1, 0.5f); + return new ResourceTexture("gtceu:textures/gui/condition/" + getType() + ".png").getSubTexture(0, 0.5f, 1, + 0.5f); } public boolean isReverse() { @@ -87,5 +90,4 @@ public RecipeCondition fromNetwork(FriendlyByteBuf buf) { isReverse = buf.readBoolean(); return this; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeHelper.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeHelper.java index 1fc4dbfa35..079ab6556a 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeHelper.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeHelper.java @@ -1,12 +1,11 @@ package com.gregtechceu.gtceu.api.recipe; import com.gregtechceu.gtceu.api.GTValues; -import com.gregtechceu.gtceu.utils.GTUtil; import com.gregtechceu.gtceu.api.capability.recipe.EURecipeCapability; import com.gregtechceu.gtceu.api.recipe.content.Content; -import it.unimi.dsi.fastutil.longs.LongIntMutablePair; -import it.unimi.dsi.fastutil.longs.LongIntPair; +import com.gregtechceu.gtceu.utils.GTUtil; +import it.unimi.dsi.fastutil.longs.LongIntPair; import org.jetbrains.annotations.NotNull; /** @@ -85,7 +84,8 @@ public static GTRecipe applyOverclock(OverclockingLogic logic, @NotNull GTRecipe * @param recipe the recipe to overclock * @return an int array of {OverclockedEUt, OverclockedDuration} */ - public static LongIntPair performOverclocking(OverclockingLogic logic, @NotNull GTRecipe recipe, long EUt, long maxOverclockVoltage) { + public static LongIntPair performOverclocking(OverclockingLogic logic, @NotNull GTRecipe recipe, long EUt, + long maxOverclockVoltage) { int recipeTier = GTUtil.getTierByVoltage(EUt); int maximumTier = logic.getOverclockForTier(maxOverclockVoltage); // The maximum number of overclocks is determined by the difference between the tier the recipe is running at, @@ -96,5 +96,4 @@ public static LongIntPair performOverclocking(OverclockingLogic logic, @NotNull // Always overclock even if numberOfOCs is <=0 as without it, some logic for coil bonuses ETC won't apply. return logic.getLogic().runOverclockingLogic(recipe, EUt, maxOverclockVoltage, recipe.duration, numberOfOCs); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeRunner.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeRunner.java index e00e46095f..d3754db5c3 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeRunner.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeRunner.java @@ -1,13 +1,13 @@ package com.gregtechceu.gtceu.api.recipe; -import com.google.common.collect.Table; import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.capability.recipe.IO; import com.gregtechceu.gtceu.api.capability.recipe.IRecipeCapabilityHolder; import com.gregtechceu.gtceu.api.capability.recipe.IRecipeHandler; import com.gregtechceu.gtceu.api.capability.recipe.RecipeCapability; import com.gregtechceu.gtceu.api.recipe.content.Content; -import lombok.experimental.Accessors; + +import com.google.common.collect.Table; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.UnknownNullability; @@ -17,17 +17,18 @@ /** * Used to handle recipes, only valid for a single RecipeCapability's entries */ -@SuppressWarnings({"rawtypes", "unchecked"}) +@SuppressWarnings({ "rawtypes", "unchecked" }) class RecipeRunner { + static class ContentSlots { + public @UnknownNullability List content = new ArrayList<>(); public @NotNull Map slots = new HashMap<>(); } - - record RecipeHandlingResult(RecipeCapability capability, ContentSlots result) { - } -// -------------------------------------------------------------------------------------------------------- + record RecipeHandlingResult(RecipeCapability capability, ContentSlots result) {} + + // -------------------------------------------------------------------------------------------------------- private final GTRecipe recipe; private final IO io; @@ -41,7 +42,6 @@ record RecipeHandlingResult(RecipeCapability capability, ContentSlots result) private ContentSlots content; private ContentSlots search; - public RecipeRunner(GTRecipe recipe, IO io, IRecipeCapabilityHolder holder, boolean simulated) { this.recipe = recipe; this.io = io; @@ -85,7 +85,9 @@ private void fillContent(IRecipeCapabilityHolder holder, Map.Entry= 1 || GTValues.RNG.nextFloat() < (cont.chance + holder.getChanceTier() * cont.tierChanceBoost)) { // chance input + if (cont.chance >= 1 || + GTValues.RNG.nextFloat() < (cont.chance + holder.getChanceTier() * cont.tierChanceBoost)) { // chance + // input if (cont.slotName == null) { this.content.content.add(cont.content); } else { @@ -117,12 +119,11 @@ private ContentSlots handleContents() { return content; } - private void handleContentsInternal(IO capIO) { if (!capabilityProxies.contains(capIO, capability)) return; - //noinspection DataFlowIssue checked above. + // noinspection DataFlowIssue checked above. var handlers = new ArrayList<>(capabilityProxies.get(capIO, capability)); handlers.sort(IRecipeHandler.ENTRY_COMPARATOR); diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/ResearchData.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/ResearchData.java index cff23583b2..1515e446ee 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/ResearchData.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/ResearchData.java @@ -1,13 +1,15 @@ package com.gregtechceu.gtceu.api.recipe; +import com.gregtechceu.gtceu.GTCEu; + +import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.world.item.ItemStack; + import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import com.gregtechceu.gtceu.GTCEu; import com.mojang.serialization.JsonOps; import lombok.AllArgsConstructor; import lombok.Getter; -import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.world.item.ItemStack; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; @@ -81,7 +83,7 @@ public static final class ResearchEntry { /** * @param researchId the id of the research - * @param dataItem the item allowed to contain the research + * @param dataItem the item allowed to contain the research */ public ResearchEntry(@NotNull String researchId, @NotNull ItemStack dataItem) { this.researchId = researchId; @@ -89,13 +91,15 @@ public ResearchEntry(@NotNull String researchId, @NotNull ItemStack dataItem) { } public static ResearchEntry fromJson(JsonObject tag) { - return new ResearchEntry(tag.get("researchId").getAsString(), ItemStack.CODEC.parse(JsonOps.INSTANCE, tag.get("dataItem")).getOrThrow(false, GTCEu.LOGGER::error)); + return new ResearchEntry(tag.get("researchId").getAsString(), ItemStack.CODEC + .parse(JsonOps.INSTANCE, tag.get("dataItem")).getOrThrow(false, GTCEu.LOGGER::error)); } public JsonObject toJson() { JsonObject json = new JsonObject(); json.addProperty("researchId", researchId); - json.add("dataItem", ItemStack.CODEC.encodeStart(JsonOps.INSTANCE, dataItem).getOrThrow(false, GTCEu.LOGGER::error)); + json.add("dataItem", + ItemStack.CODEC.encodeStart(JsonOps.INSTANCE, dataItem).getOrThrow(false, GTCEu.LOGGER::error)); return json; } @@ -110,4 +114,4 @@ public void toNetwork(FriendlyByteBuf buf) { buf.writeItem(this.dataItem); } } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/ResearchRecipeBuilder.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/ResearchRecipeBuilder.java index 9515d7fcea..4062abf336 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/ResearchRecipeBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/ResearchRecipeBuilder.java @@ -5,12 +5,12 @@ import com.gregtechceu.gtceu.api.item.component.IDataItem; import com.gregtechceu.gtceu.api.item.component.IItemComponent; import com.gregtechceu.gtceu.data.recipe.builder.GTRecipeBuilder; -import com.gregtechceu.gtceu.utils.ResearchManager; import com.gregtechceu.gtceu.utils.GTStringUtils; -import dev.latvian.mods.kubejs.recipe.RecipeJS; -import lombok.NoArgsConstructor; +import com.gregtechceu.gtceu.utils.ResearchManager; + import net.minecraft.world.item.ItemStack; +import lombok.NoArgsConstructor; import org.jetbrains.annotations.NotNull; public abstract class ResearchRecipeBuilder> { @@ -150,4 +150,4 @@ public GTRecipeBuilder.ResearchRecipeEntry build() { return new GTRecipeBuilder.ResearchRecipeEntry(researchId, researchStack, dataStack, duration, eut, cwut); } } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/ShapedEnergyTransferRecipe.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/ShapedEnergyTransferRecipe.java index 32baf5b550..56a45edac5 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/ShapedEnergyTransferRecipe.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/ShapedEnergyTransferRecipe.java @@ -1,11 +1,9 @@ package com.gregtechceu.gtceu.api.recipe; -import com.google.gson.JsonObject; import com.gregtechceu.gtceu.api.capability.GTCapabilityHelper; import com.gregtechceu.gtceu.api.capability.IElectricItem; -import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.core.mixins.ShapedRecipeAccessor; -import lombok.Getter; + import net.minecraft.FieldsAreNonnullByDefault; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.NonNullList; @@ -20,6 +18,9 @@ import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraft.world.item.crafting.ShapedRecipe; +import com.google.gson.JsonObject; +import lombok.Getter; + import java.util.Map; /** @@ -30,6 +31,7 @@ @MethodsReturnNonnullByDefault @FieldsAreNonnullByDefault public class ShapedEnergyTransferRecipe extends ShapedRecipe { + public static final RecipeSerializer SERIALIZER = new Serializer(); @Getter @@ -39,8 +41,9 @@ public class ShapedEnergyTransferRecipe extends ShapedRecipe { @Getter private final boolean overrideCharge; - - public ShapedEnergyTransferRecipe(ResourceLocation id, String group, int width, int height, Ingredient chargeIngredient, boolean overrideCharge, boolean transferMaxCharge, NonNullList recipeItems, ItemStack result) { + public ShapedEnergyTransferRecipe(ResourceLocation id, String group, int width, int height, + Ingredient chargeIngredient, boolean overrideCharge, boolean transferMaxCharge, + NonNullList recipeItems, ItemStack result) { super(id, group, CraftingBookCategory.MISC, width, height, recipeItems, result); this.chargeIngredient = chargeIngredient; this.transferMaxCharge = transferMaxCharge; @@ -102,7 +105,8 @@ public ShapedEnergyTransferRecipe fromJson(ResourceLocation recipeId, JsonObject boolean transferMaxCharge = GsonHelper.getAsBoolean(json, "transferMaxCharge"); Ingredient chargeIngredient = Ingredient.fromJson(GsonHelper.getAsJsonObject(json, "chargeIngredient")); ItemStack result = ShapedEnergyTransferRecipe.itemStackFromJson(GsonHelper.getAsJsonObject(json, "result")); - return new ShapedEnergyTransferRecipe(recipeId, group, xSize, ySize, chargeIngredient, overrideCharge, transferMaxCharge, dissolved, result); + return new ShapedEnergyTransferRecipe(recipeId, group, xSize, ySize, chargeIngredient, overrideCharge, + transferMaxCharge, dissolved, result); } @Override @@ -116,7 +120,8 @@ public ShapedEnergyTransferRecipe fromNetwork(ResourceLocation recipeId, Friendl NonNullList ingredients = NonNullList.withSize(xSize * ySize, Ingredient.EMPTY); ingredients.replaceAll($ -> Ingredient.fromNetwork(buffer)); ItemStack result = buffer.readItem(); - return new ShapedEnergyTransferRecipe(recipeId, group, xSize, ySize, chargeIngredient, overrideCharge, transferMaxCharge, ingredients, result); + return new ShapedEnergyTransferRecipe(recipeId, group, xSize, ySize, chargeIngredient, overrideCharge, + transferMaxCharge, ingredients, result); } @Override @@ -130,8 +135,7 @@ public void toNetwork(FriendlyByteBuf buffer, ShapedEnergyTransferRecipe recipe) for (Ingredient ingredient : recipe.getIngredients()) { ingredient.toNetwork(buffer); } - buffer.writeItem(((ShapedRecipeAccessor)this).getResult()); + buffer.writeItem(((ShapedRecipeAccessor) this).getResult()); } } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/StrictShapedRecipe.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/StrictShapedRecipe.java index 3a86428b90..84168104b5 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/StrictShapedRecipe.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/StrictShapedRecipe.java @@ -1,7 +1,7 @@ package com.gregtechceu.gtceu.api.recipe; -import com.google.gson.JsonObject; import com.gregtechceu.gtceu.core.mixins.ShapedRecipeAccessor; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.NonNullList; import net.minecraft.network.FriendlyByteBuf; @@ -14,11 +14,14 @@ import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraft.world.item.crafting.ShapedRecipe; import net.minecraft.world.level.Level; + +import com.google.gson.JsonObject; import org.jetbrains.annotations.NotNull; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.Map; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author KilaBash * @date 2023/7/24 @@ -27,9 +30,11 @@ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class StrictShapedRecipe extends ShapedRecipe { + public static final RecipeSerializer SERIALIZER = new Serializer(); - public StrictShapedRecipe(ResourceLocation id, String group, CraftingBookCategory category, int width, int height, NonNullList recipeItems, ItemStack result) { + public StrictShapedRecipe(ResourceLocation id, String group, CraftingBookCategory category, int width, int height, + NonNullList recipeItems, ItemStack result) { super(id, group, category, width, height, recipeItems, result); } @@ -45,7 +50,6 @@ public boolean matches(CraftingContainer inv, Level level) { return false; } - /** * Checks if the region of a crafting inventory is match for the recipe. */ @@ -71,10 +75,12 @@ private boolean matches(CraftingContainer craftingInventory, int width, int heig } public static class Serializer implements RecipeSerializer { + @Override public StrictShapedRecipe fromJson(ResourceLocation recipeId, JsonObject json) { String string = GsonHelper.getAsString(json, "group", ""); - CraftingBookCategory craftingBookCategory = CraftingBookCategory.CODEC.byName(GsonHelper.getAsString(json, "category", null), CraftingBookCategory.MISC); + CraftingBookCategory craftingBookCategory = CraftingBookCategory.CODEC + .byName(GsonHelper.getAsString(json, "category", null), CraftingBookCategory.MISC); Map map = ShapedRecipeAccessor.callKeyFromJson(GsonHelper.getAsJsonObject(json, "key")); String[] strings = ShapedRecipeAccessor.callPatternFromJson(GsonHelper.getAsJsonArray(json, "pattern")); int i = strings[0].length(); @@ -105,7 +111,7 @@ public void toNetwork(FriendlyByteBuf buffer, StrictShapedRecipe recipe) { for (Ingredient ingredient : recipe.getIngredients()) { ingredient.toNetwork(buffer); } - buffer.writeItem(((ShapedRecipeAccessor)recipe).getResult()); + buffer.writeItem(((ShapedRecipeAccessor) recipe).getResult()); } } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/ToolHeadReplaceRecipe.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/ToolHeadReplaceRecipe.java index a9edb9f29d..05b223547c 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/ToolHeadReplaceRecipe.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/ToolHeadReplaceRecipe.java @@ -1,6 +1,5 @@ package com.gregtechceu.gtceu.api.recipe; -import appeng.recipes.game.FacadeRecipe; import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.capability.GTCapabilityHelper; import com.gregtechceu.gtceu.api.capability.IElectricItem; @@ -9,8 +8,8 @@ import com.gregtechceu.gtceu.api.data.tag.TagPrefix; import com.gregtechceu.gtceu.api.item.IGTTool; import com.gregtechceu.gtceu.api.item.tool.GTToolType; -import com.gregtechceu.gtceu.api.item.tool.ToolHelper; import com.gregtechceu.gtceu.common.data.GTItems; + import net.minecraft.core.NonNullList; import net.minecraft.core.RegistryAccess; import net.minecraft.resources.ResourceLocation; @@ -21,6 +20,7 @@ import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraft.world.item.crafting.SimpleCraftingRecipeSerializer; import net.minecraft.world.level.Level; + import org.jetbrains.annotations.NotNull; import java.util.ArrayList; @@ -29,7 +29,9 @@ import java.util.Map; public class ToolHeadReplaceRecipe extends CustomRecipe { - public static SimpleCraftingRecipeSerializer SERIALIZER = new SimpleCraftingRecipeSerializer<>(ToolHeadReplaceRecipe::new); + + public static SimpleCraftingRecipeSerializer SERIALIZER = new SimpleCraftingRecipeSerializer<>( + ToolHeadReplaceRecipe::new); private static final Map TOOL_HEAD_TO_TOOL_MAP = new HashMap<>(); @@ -110,7 +112,7 @@ public boolean matches(CraftingContainer inv, @NotNull Level level) { if (toolHead == null) return ItemStack.EMPTY; GTToolType[] toolArray = TOOL_HEAD_TO_TOOL_MAP.get(toolHead.tagPrefix); ItemStack newTool = GTItems.TOOL_ITEMS.get(toolHead.material, toolArray[tool.getElectricTier()]) - .get().get(powerUnit.getCharge(), powerUnit.getMaxCharge()); + .get().get(powerUnit.getCharge(), powerUnit.getMaxCharge()); if (newTool == null) return ItemStack.EMPTY; return newTool; diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/Content.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/Content.java index 4d539d7964..b094d685e0 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/Content.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/Content.java @@ -2,21 +2,25 @@ import com.gregtechceu.gtceu.api.capability.recipe.RecipeCapability; import com.gregtechceu.gtceu.api.recipe.ingredient.FluidIngredient; + import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.utils.LocalizationUtils; -import com.mojang.blaze3d.systems.RenderSystem; -import lombok.AllArgsConstructor; -import lombok.Getter; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Font; import net.minecraft.client.gui.GuiGraphics; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + +import com.mojang.blaze3d.systems.RenderSystem; +import lombok.AllArgsConstructor; +import lombok.Getter; import org.jetbrains.annotations.Nullable; @AllArgsConstructor public class Content { + @Getter public Object content; public float chance; @@ -36,6 +40,7 @@ public Content copy(RecipeCapability capability, @Nullable ContentModifier mo public IGuiTexture createOverlay(boolean perTick) { return new IGuiTexture() { + @Override @OnlyIn(Dist.CLIENT) public void draw(GuiGraphics graphics, int mouseX, int mouseY, float x, float y, int width, int height) { @@ -65,7 +70,8 @@ public void drawEmiAmount(GuiGraphics graphics, float x, float y, int width, int s = amount + "mB"; } Font fontRenderer = Minecraft.getInstance().font; - graphics.drawString(fontRenderer, s, (int) ((x + (width / 3f)) * 2 - fontRenderer.width(s) + 21), (int) ((y + (height / 3f) + 6) * 2), 0xFFFFFF, true); + graphics.drawString(fontRenderer, s, (int) ((x + (width / 3f)) * 2 - fontRenderer.width(s) + 21), + (int) ((y + (height / 3f) + 6) * 2), 0xFFFFFF, true); graphics.pose().popPose(); } } @@ -76,10 +82,12 @@ public void drawChance(GuiGraphics graphics, float x, float y, int width, int he graphics.pose().pushPose(); graphics.pose().translate(0, 0, 400); graphics.pose().scale(0.5f, 0.5f, 1); - String s = chance == 0 ? LocalizationUtils.format("gtceu.gui.content.chance_0_short") : String.format("%.2f", chance * 100) + "%"; + String s = chance == 0 ? LocalizationUtils.format("gtceu.gui.content.chance_0_short") : + String.format("%.2f", chance * 100) + "%"; int color = chance == 0 ? 0xff0000 : 0xFFFF00; Font fontRenderer = Minecraft.getInstance().font; - graphics.drawString(fontRenderer, s, (int) ((x + (width / 3f)) * 2 - fontRenderer.width(s) + 23), (int) ((y + (height / 3f) + 6) * 2 - height), color, true); + graphics.drawString(fontRenderer, s, (int) ((x + (width / 3f)) * 2 - fontRenderer.width(s) + 23), + (int) ((y + (height / 3f) + 6) * 2 - height), color, true); graphics.pose().popPose(); } @@ -92,7 +100,8 @@ public void drawTick(GuiGraphics graphics, float x, float y, int width, int heig String s = LocalizationUtils.format("gtceu.gui.content.tips.per_tick_short"); int color = 0xFFFF00; Font fontRenderer = Minecraft.getInstance().font; - graphics.drawString(fontRenderer, s, (int) ((x + (width / 3f)) * 2 - fontRenderer.width(s) + 23), (int) ((y + (height / 3f) + 6) * 2 - height + (chance == 1 ? 0 : 10)), color); + graphics.drawString(fontRenderer, s, (int) ((x + (width / 3f)) * 2 - fontRenderer.width(s) + 23), + (int) ((y + (height / 3f) + 6) * 2 - height + (chance == 1 ? 0 : 10)), color); graphics.pose().popPose(); } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/ContentModifier.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/ContentModifier.java index a1923f0df7..9692c7f3cd 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/ContentModifier.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/ContentModifier.java @@ -34,5 +34,4 @@ public Number apply(Number number) { } return number.doubleValue() * multiplier + addition; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/IContentSerializer.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/IContentSerializer.java index 92722abf7d..73a7fd27d1 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/IContentSerializer.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/IContentSerializer.java @@ -1,10 +1,12 @@ package com.gregtechceu.gtceu.api.recipe.content; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; import com.lowdragmc.lowdraglib.LDLib; + import net.minecraft.network.FriendlyByteBuf; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; + public interface IContentSerializer { default void toNetwork(FriendlyByteBuf buf, T content) { diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerBigInteger.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerBigInteger.java index 198e70f367..2367a59fd5 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerBigInteger.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerBigInteger.java @@ -1,8 +1,9 @@ package com.gregtechceu.gtceu.api.recipe.content; +import net.minecraft.network.FriendlyByteBuf; + import com.google.gson.JsonElement; import com.google.gson.JsonPrimitive; -import net.minecraft.network.FriendlyByteBuf; import java.math.BigInteger; @@ -11,7 +12,7 @@ * @date 2022/06/22 * @implNote SerializerBigInteger */ -public class SerializerBigInteger implements IContentSerializer{ +public class SerializerBigInteger implements IContentSerializer { public static SerializerBigInteger INSTANCE = new SerializerBigInteger(); @@ -53,5 +54,4 @@ public BigInteger of(Object o) { public BigInteger defaultValue() { return BigInteger.ZERO; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerBlockState.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerBlockState.java index e3986f641a..c6dcada1e5 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerBlockState.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerBlockState.java @@ -1,11 +1,7 @@ package com.gregtechceu.gtceu.api.recipe.content; -import com.google.common.collect.ImmutableMap; -import com.google.gson.JsonElement; -import com.google.gson.JsonNull; import com.gregtechceu.gtceu.GTCEu; -import com.mojang.serialization.JsonOps; -import net.minecraft.core.Registry; + import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.world.level.block.Block; @@ -15,6 +11,11 @@ import net.minecraft.world.level.block.state.StateHolder; import net.minecraft.world.level.block.state.properties.Property; +import com.google.common.collect.ImmutableMap; +import com.google.gson.JsonElement; +import com.google.gson.JsonNull; +import com.mojang.serialization.JsonOps; + import java.util.Map; import java.util.Optional; import java.util.function.Function; @@ -34,7 +35,7 @@ public void toNetwork(FriendlyByteBuf buf, BlockState content) { for (Map.Entry, Comparable> entry : values.entrySet()) { buf.writeUtf(entry.getKey().getName()); - buf.writeUtf(((Property)entry.getKey()).getName(entry.getValue())); + buf.writeUtf(((Property) entry.getKey()).getName(entry.getValue())); } } else { buf.writeBoolean(false); @@ -69,7 +70,8 @@ public BlockState fromJson(JsonElement json) { @Override public JsonElement toJson(BlockState content) { - return BlockState.CODEC.encodeStart(JsonOps.INSTANCE, content).get().map(Function.identity(), partial -> JsonNull.INSTANCE); + return BlockState.CODEC.encodeStart(JsonOps.INSTANCE, content).get().map(Function.identity(), + partial -> JsonNull.INSTANCE); } @Override diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerDouble.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerDouble.java index 854c1bab3c..92c1a85b5c 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerDouble.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerDouble.java @@ -1,8 +1,9 @@ package com.gregtechceu.gtceu.api.recipe.content; +import net.minecraft.network.FriendlyByteBuf; + import com.google.gson.JsonElement; import com.google.gson.JsonPrimitive; -import net.minecraft.network.FriendlyByteBuf; import org.apache.commons.lang3.math.NumberUtils; public class SerializerDouble implements IContentSerializer { diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerFloat.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerFloat.java index 5185afd61a..ad1aebc444 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerFloat.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerFloat.java @@ -1,8 +1,9 @@ package com.gregtechceu.gtceu.api.recipe.content; +import net.minecraft.network.FriendlyByteBuf; + import com.google.gson.JsonElement; import com.google.gson.JsonPrimitive; -import net.minecraft.network.FriendlyByteBuf; import org.apache.commons.lang3.math.NumberUtils; public class SerializerFloat implements IContentSerializer { diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerFluidIngredient.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerFluidIngredient.java index 46ff71580a..84791ba351 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerFluidIngredient.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerFluidIngredient.java @@ -1,18 +1,12 @@ package com.gregtechceu.gtceu.api.recipe.content; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.recipe.ingredient.FluidIngredient; -import com.lowdragmc.lowdraglib.side.fluid.FluidHelper; + import com.lowdragmc.lowdraglib.side.fluid.FluidStack; -import com.mojang.brigadier.exceptions.CommandSyntaxException; -import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.nbt.TagParser; + import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.resources.ResourceLocation; -import java.util.Objects; +import com.google.gson.JsonElement; public class SerializerFluidIngredient implements IContentSerializer { @@ -55,4 +49,4 @@ public FluidIngredient of(Object o) { public FluidIngredient defaultValue() { return FluidIngredient.EMPTY; } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerIngredient.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerIngredient.java index 40ecfb1a0b..62a4bdbc74 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerIngredient.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerIngredient.java @@ -1,13 +1,15 @@ package com.gregtechceu.gtceu.api.recipe.content; -import com.google.gson.JsonElement; import com.gregtechceu.gtceu.api.recipe.ingredient.SizedIngredient; + import net.minecraft.network.FriendlyByteBuf; import net.minecraft.tags.TagKey; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.level.ItemLike; +import com.google.gson.JsonElement; + public class SerializerIngredient implements IContentSerializer { public static SerializerIngredient INSTANCE = new SerializerIngredient(); @@ -35,7 +37,7 @@ public JsonElement toJson(Ingredient content) { } @Override - @SuppressWarnings({"unchecked", "rawtypes"}) + @SuppressWarnings({ "unchecked", "rawtypes" }) public Ingredient of(Object o) { if (o instanceof Ingredient ingredient) { return ingredient; @@ -53,5 +55,4 @@ public Ingredient of(Object o) { public Ingredient defaultValue() { return Ingredient.EMPTY; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerInteger.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerInteger.java index d17903f1d2..fcee352cf1 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerInteger.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerInteger.java @@ -1,8 +1,9 @@ package com.gregtechceu.gtceu.api.recipe.content; +import net.minecraft.network.FriendlyByteBuf; + import com.google.gson.JsonElement; import com.google.gson.JsonPrimitive; -import net.minecraft.network.FriendlyByteBuf; import org.apache.commons.lang3.math.NumberUtils; public class SerializerInteger implements IContentSerializer { diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerLong.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerLong.java index 3b24ac67a2..561b7d4ec8 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerLong.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/SerializerLong.java @@ -1,8 +1,9 @@ package com.gregtechceu.gtceu.api.recipe.content; +import net.minecraft.network.FriendlyByteBuf; + import com.google.gson.JsonElement; import com.google.gson.JsonPrimitive; -import net.minecraft.network.FriendlyByteBuf; import org.apache.commons.lang3.math.NumberUtils; /** @@ -52,5 +53,4 @@ public Long of(Object o) { public Long defaultValue() { return 0L; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/FluidIngredient.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/FluidIngredient.java index 70532402ea..072c046484 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/FluidIngredient.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/FluidIngredient.java @@ -1,11 +1,8 @@ package com.gregtechceu.gtceu.api.recipe.ingredient; -import com.google.common.collect.Lists; -import com.google.gson.*; import com.lowdragmc.lowdraglib.side.fluid.FluidHelper; import com.lowdragmc.lowdraglib.side.fluid.FluidStack; -import it.unimi.dsi.fastutil.objects.ObjectArrayList; -import lombok.Getter; + import net.minecraft.core.Holder; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.Registries; @@ -17,6 +14,11 @@ import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.Fluids; import net.minecraftforge.common.crafting.CraftingHelper; + +import com.google.common.collect.Lists; +import com.google.gson.*; +import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import lombok.Getter; import org.jetbrains.annotations.Nullable; import java.util.*; @@ -25,6 +27,7 @@ import java.util.stream.StreamSupport; public class FluidIngredient implements Predicate { + public static final FluidIngredient EMPTY = new FluidIngredient(Stream.empty(), 0, null); public FluidIngredient.Value[] values; @Nullable @@ -41,7 +44,8 @@ public FluidIngredient(Stream empty, long amoun this.nbt = nbt; } - public static FluidIngredient fromValues(Stream stream, long amount, @Nullable CompoundTag nbt) { + public static FluidIngredient fromValues(Stream stream, long amount, + @Nullable CompoundTag nbt) { FluidIngredient ingredient = new FluidIngredient(stream, amount, nbt); return ingredient.isEmpty() ? EMPTY : ingredient; } @@ -70,9 +74,10 @@ public JsonElement toJson() { } public FluidIngredient copy() { - return new FluidIngredient(Arrays.stream(this.values).map(Value::copy), this.amount, this.nbt == null ? null : this.nbt.copy()); + return new FluidIngredient(Arrays.stream(this.values).map(Value::copy), this.amount, + this.nbt == null ? null : this.nbt.copy()); } - + @Override public boolean test(@Nullable FluidStack stack) { if (stack == null) { @@ -163,11 +168,13 @@ public static FluidIngredient of(long amount, Fluid... items) { } public static FluidIngredient of(FluidStack... stacks) { - return FluidIngredient.of(Arrays.stream(stacks).map(FluidStack::getFluid), stacks.length == 0 ? 0 : stacks[0].getAmount(), stacks.length == 0 ? null : stacks[0].getTag()); + return FluidIngredient.of(Arrays.stream(stacks).map(FluidStack::getFluid), + stacks.length == 0 ? 0 : stacks[0].getAmount(), stacks.length == 0 ? null : stacks[0].getTag()); } public static FluidIngredient of(Stream stacks, long amount, CompoundTag nbt) { - return FluidIngredient.fromValues(stacks.filter(stack -> stack != null && !stack.isSame(Fluids.EMPTY)).map(FluidValue::new), amount, nbt); + return FluidIngredient.fromValues( + stacks.filter(stack -> stack != null && !stack.isSame(Fluids.EMPTY)).map(FluidValue::new), amount, nbt); } /** @@ -184,7 +191,9 @@ public static FluidIngredient of(TagKey tag, long amount, CompoundTag nbt } public static FluidIngredient fromNetwork(FriendlyByteBuf buffer) { - return FluidIngredient.fromValues(buffer.readList(FluidStack::readFromBuf).stream().map(stack -> new FluidValue(stack.getFluid())), buffer.readVarLong(), buffer.readNbt()); + return FluidIngredient.fromValues( + buffer.readList(FluidStack::readFromBuf).stream().map(stack -> new FluidValue(stack.getFluid())), + buffer.readVarLong(), buffer.readNbt()); } public static FluidIngredient fromJson(@Nullable JsonElement json) { @@ -202,13 +211,20 @@ public static FluidIngredient fromJson(@Nullable JsonElement json, boolean allow long amount = GsonHelper.getAsLong(jsonObject, "amount", 0); CompoundTag nbt = jsonObject.has("nbt") ? CraftingHelper.getNBT(jsonObject.get("nbt")) : null; if (GsonHelper.isObjectNode(jsonObject, "value")) { - return FluidIngredient.fromValues(Stream.of(FluidIngredient.valueFromJson(GsonHelper.getAsJsonObject(jsonObject, "value"))), amount, nbt); + return FluidIngredient.fromValues( + Stream.of(FluidIngredient.valueFromJson(GsonHelper.getAsJsonObject(jsonObject, "value"))), amount, + nbt); } else if (GsonHelper.isArrayNode(jsonObject, "value")) { JsonArray jsonArray = GsonHelper.getAsJsonArray(jsonObject, "value"); if (jsonArray.size() == 0 && !allowAir) { throw new JsonSyntaxException("Fluid array cannot be empty, at least one item must be defined"); } - return FluidIngredient.fromValues(StreamSupport.stream(jsonArray.spliterator(), false).map(jsonElement -> FluidIngredient.valueFromJson(GsonHelper.convertToJsonObject(jsonElement, "fluid"))), amount, nbt); + return FluidIngredient + .fromValues( + StreamSupport.stream(jsonArray.spliterator(), false) + .map(jsonElement -> FluidIngredient + .valueFromJson(GsonHelper.convertToJsonObject(jsonElement, "fluid"))), + amount, nbt); } throw new JsonSyntaxException("expected value to be either object or array."); } @@ -230,13 +246,16 @@ private static FluidIngredient.Value valueFromJson(JsonObject json) { } public static interface Value { + public Collection getFluids(); public JsonObject serialize(); + public Value copy(); } public static class TagValue implements Value { + @Getter private final TagKey tag; @@ -267,6 +286,7 @@ public Value copy() { } public static class FluidValue implements Value { + private final Fluid fluid; public FluidValue(Fluid item) { diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntCircuitIngredient.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntCircuitIngredient.java index d256c57f1a..f4884f413e 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntCircuitIngredient.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntCircuitIngredient.java @@ -1,23 +1,24 @@ package com.gregtechceu.gtceu.api.recipe.ingredient; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.common.data.GTItems; import com.gregtechceu.gtceu.common.item.IntCircuitBehaviour; import com.gregtechceu.gtceu.core.mixins.StrictNBTIngredientAccessor; + import net.minecraft.network.FriendlyByteBuf; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.Ingredient; import net.minecraftforge.common.crafting.IIngredientSerializer; import net.minecraftforge.common.crafting.StrictNBTIngredient; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public class IntCircuitIngredient extends StrictNBTIngredient { + public static final ResourceLocation TYPE = GTCEu.id("circuit"); public static final int CIRCUIT_MIN = 0; @@ -47,13 +48,14 @@ protected IntCircuitIngredient(int configuration) { @Override public boolean test(@Nullable ItemStack stack) { if (stack == null) return false; - return stack.is(GTItems.INTEGRATED_CIRCUIT.get()) && IntCircuitBehaviour.getCircuitConfiguration(stack) == this.configuration; + return stack.is(GTItems.INTEGRATED_CIRCUIT.get()) && + IntCircuitBehaviour.getCircuitConfiguration(stack) == this.configuration; } @Override public ItemStack[] getItems() { if (stacks == null) { - stacks = new ItemStack[]{((StrictNBTIngredientAccessor) this).getStack()}; + stacks = new ItemStack[] { ((StrictNBTIngredientAccessor) this).getStack() }; } return stacks; } @@ -81,6 +83,7 @@ public static IntCircuitIngredient fromJson(JsonObject json) { } public static final IIngredientSerializer SERIALIZER = new IIngredientSerializer<>() { + @Override public @NotNull IntCircuitIngredient parse(FriendlyByteBuf buffer) { int configuration = buffer.readVarInt(); diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/NBTIngredient.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/NBTIngredient.java index 63e6f47363..9ef4b93e2c 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/NBTIngredient.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/NBTIngredient.java @@ -10,6 +10,7 @@ * @implNote NBTIngredient */ public class NBTIngredient { + public static Ingredient createNBTIngredient(ItemStack itemStack) { return StrictNBTIngredient.of(itemStack); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/SizedIngredient.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/SizedIngredient.java index ba3cfa642d..4d226eb534 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/SizedIngredient.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/SizedIngredient.java @@ -1,10 +1,7 @@ package com.gregtechceu.gtceu.api.recipe.ingredient; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; import com.gregtechceu.gtceu.GTCEu; -import com.gregtechceu.gtceu.core.mixins.IngredientAccessor; -import it.unimi.dsi.fastutil.ints.IntList; + import net.minecraft.network.FriendlyByteBuf; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.TagKey; @@ -12,14 +9,18 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.Ingredient; import net.minecraftforge.common.crafting.IIngredientSerializer; + +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import it.unimi.dsi.fastutil.ints.IntList; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.jetbrains.annotations.NotNull; import java.util.Arrays; import java.util.stream.Stream; public class SizedIngredient extends Ingredient { + public static final ResourceLocation TYPE = GTCEu.id("sized"); protected final int amount; @@ -37,7 +38,8 @@ protected SizedIngredient(@NotNull TagKey tag, int amount) { } protected SizedIngredient(ItemStack itemStack) { - this((itemStack.hasTag() || itemStack.getDamageValue() > 0) ? NBTIngredient.createNBTIngredient(itemStack) : Ingredient.of(itemStack), itemStack.getCount()); + this((itemStack.hasTag() || itemStack.getDamageValue() > 0) ? NBTIngredient.createNBTIngredient(itemStack) : + Ingredient.of(itemStack), itemStack.getCount()); } public static SizedIngredient create(ItemStack inner) { @@ -60,7 +62,8 @@ public static Ingredient copy(Ingredient ingredient) { if (ingredient instanceof SizedIngredient sizedIngredient) { var copied = SizedIngredient.create(sizedIngredient.inner, sizedIngredient.amount); if (sizedIngredient.itemStacks != null) { - copied.itemStacks = Arrays.stream(sizedIngredient.itemStacks).map(ItemStack::copy).toArray(ItemStack[]::new); + copied.itemStacks = Arrays.stream(sizedIngredient.itemStacks).map(ItemStack::copy) + .toArray(ItemStack[]::new); } return copied; } else if (ingredient instanceof IntCircuitIngredient circuit) { @@ -130,6 +133,7 @@ public int hashCode() { } public static final IIngredientSerializer SERIALIZER = new IIngredientSerializer<>() { + @Override public @NotNull SizedIngredient parse(FriendlyByteBuf buffer) { int amount = buffer.readVarInt(); diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/AbstractMapIngredient.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/AbstractMapIngredient.java index 5540bcbf59..daec52460d 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/AbstractMapIngredient.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/AbstractMapIngredient.java @@ -38,4 +38,4 @@ public boolean equals(Object obj) { public boolean isSpecialIngredient() { return false; } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/Branch.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/Branch.java index 3e35da09b9..df135f6079 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/Branch.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/Branch.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.api.recipe.lookup; import com.gregtechceu.gtceu.api.recipe.GTRecipe; + import com.mojang.datafixers.util.Either; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import org.jetbrains.annotations.NotNull; @@ -34,7 +35,7 @@ public Stream getRecipes(boolean filterHidden) { return Stream.empty(); } if (filterHidden) { - //stream = stream.filter(t -> !t.isHidden()); + // stream = stream.filter(t -> !t.isHidden()); } return stream; } @@ -58,4 +59,4 @@ public Map> getSpecialNodes() { } return specialNodes; } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/GTRecipeLookup.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/GTRecipeLookup.java index bd63994f26..22c5488bd3 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/GTRecipeLookup.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/GTRecipeLookup.java @@ -6,15 +6,18 @@ import com.gregtechceu.gtceu.api.recipe.GTRecipeType; import com.gregtechceu.gtceu.api.recipe.content.Content; import com.gregtechceu.gtceu.config.ConfigHolder; + import com.lowdragmc.lowdraglib.Platform; + +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; + import com.mojang.datafixers.util.Either; import it.unimi.dsi.fastutil.objects.ObjectArrayList; import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import lombok.Getter; import lombok.RequiredArgsConstructor; -import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.crafting.Ingredient; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -25,6 +28,7 @@ @RequiredArgsConstructor public class GTRecipeLookup { + private final GTRecipeType recipeType; @Getter @@ -52,7 +56,8 @@ public GTRecipe findRecipe(final IRecipeCapabilityHolder holder) { protected List> prepareRecipeFind(@NotNull IRecipeCapabilityHolder holder) { // First, check if items and fluids are valid. int totalSize = 0; - for (Map.Entry, List>> entries : holder.getCapabilitiesProxy().row(IO.IN).entrySet()) { + for (Map.Entry, List>> entries : holder.getCapabilitiesProxy().row(IO.IN) + .entrySet()) { int size = 0; if (!entries.getKey().isRecipeSearchFilter()) { continue; @@ -103,7 +108,8 @@ public GTRecipe find(@NotNull IRecipeCapabilityHolder holder, @NotNull Predicate * @return the Recipe Iterator */ @NotNull - public RecipeIterator getRecipeIterator(@NotNull IRecipeCapabilityHolder holder, @NotNull Predicate canHandle) { + public RecipeIterator getRecipeIterator(@NotNull IRecipeCapabilityHolder holder, + @NotNull Predicate canHandle) { List> list = prepareRecipeFind(holder); return new RecipeIterator(this.recipeType, list, canHandle); } @@ -155,7 +161,8 @@ else if (ItemStack.isSameItemSameTags(input, unique)) { */ @Nullable private GTRecipe recurseIngredientTreeFindRecipe(@NotNull List> ingredients, - @NotNull Branch branchRoot, @NotNull Predicate canHandle) { + @NotNull Branch branchRoot, + @NotNull Predicate canHandle) { // Try each ingredient as a starting point, adding it to the skip-list. // The skip-list is a packed long, where each 1 bit represents an index to skip for (int i = 0; i < ingredients.size(); i++) { @@ -180,8 +187,8 @@ private GTRecipe recurseIngredientTreeFindRecipe(@NotNull List> ingredients, - @NotNull Branch branchMap, @NotNull Predicate canHandle, - int index, int count, long skip) { + @NotNull Branch branchMap, @NotNull Predicate canHandle, + int index, int count, long skip) { // exhausted all the ingredients, and didn't find anything if (count == ingredients.size()) return null; @@ -195,8 +202,8 @@ public GTRecipe recurseIngredientTreeFindRecipe(@NotNull List canHandle.test(potentialRecipe) ? potentialRecipe : null, - potentialBranch -> diveIngredientTreeFindRecipe(ingredients, potentialBranch, canHandle, index, - count, skip)); + potentialBranch -> diveIngredientTreeFindRecipe(ingredients, potentialBranch, canHandle, index, + count, skip)); if (r != null) { return r; } @@ -218,9 +225,9 @@ public GTRecipe recurseIngredientTreeFindRecipe(@NotNull List> ingredients, - @NotNull Branch map, - @NotNull Predicate canHandle, int currentIndex, int count, - long skip) { + @NotNull Branch map, + @NotNull Predicate canHandle, int currentIndex, int count, + long skip) { // We loop around ingredients.size() if we reach the end. // only end when all ingredients are exhausted, or a recipe is found int i = (currentIndex + 1) % ingredients.size(); @@ -231,7 +238,7 @@ private GTRecipe diveIngredientTreeFindRecipe(@NotNull List> ingredients, - @NotNull Branch branchMap, int index, int count, long skip, - @NotNull Set collidingRecipes) { + @NotNull Branch branchMap, int index, int count, + long skip, + @NotNull Set collidingRecipes) { // exhausted all the ingredients, and didn't find anything if (count == ingredients.size()) return null; @@ -299,8 +307,8 @@ private GTRecipe recurseIngredientTreeFindRecipeCollisions(@NotNull List recipe, - right -> diveIngredientTreeFindRecipeCollisions(ingredients, right, index, count, skip, - collidingRecipes)); + right -> diveIngredientTreeFindRecipeCollisions(ingredients, right, index, count, skip, + collidingRecipes)); if (r != null) { collidingRecipes.add(r); } @@ -322,8 +330,8 @@ private GTRecipe recurseIngredientTreeFindRecipeCollisions(@NotNull List> ingredients, - @NotNull Branch map, int currentIndex, int count, long skip, - @NotNull Set collidingRecipes) { + @NotNull Branch map, int currentIndex, int count, long skip, + @NotNull Set collidingRecipes) { // We loop around ingredients.size() if we reach the end. // only end when all ingredients are exhausted, or a recipe is found int i = (currentIndex + 1) % ingredients.size(); @@ -334,7 +342,7 @@ private GTRecipe diveIngredientTreeFindRecipeCollisions(@NotNull List> fromRecipe(@NotNull GTRecipe r) { } /** - * Converts a GTRecipe's {@link com.gregtechceu.gtceu.api.capability.recipe.RecipeCapability}s into a List of {@link AbstractMapIngredient}s + * Converts a GTRecipe's {@link com.gregtechceu.gtceu.api.capability.recipe.RecipeCapability}s into a List of + * {@link AbstractMapIngredient}s * * @param r the recipe to use * @return a list of all the AbstractMapIngredients comprising the recipe */ @NotNull protected List> fromHolder(@NotNull IRecipeCapabilityHolder r) { - List> list = new ObjectArrayList<>(r.getCapabilitiesProxy().row(IO.IN).values().size()); + List> list = new ObjectArrayList<>( + r.getCapabilitiesProxy().row(IO.IN).values().size()); r.getCapabilitiesProxy().row(IO.IN).forEach((cap, handlers) -> { if (cap.isRecipeSearchFilter() && !handlers.isEmpty()) { for (IRecipeHandler handler : handlers) { @@ -466,7 +477,6 @@ public boolean addRecipe(GTRecipe recipe) { return recurseIngredientTreeAdd(recipe, items, lookup, 0, 0); } - /** * Adds a recipe to the map. (recursive part) * @@ -505,8 +515,8 @@ private boolean recurseIngredientTreeAdd(@NotNull GTRecipe recipe, // the recipe already there was not the one being added, so there is a conflict if (ConfigHolder.INSTANCE.dev.debug || Platform.isDevEnv()) { GTCEu.LOGGER.warn( - "Recipe duplicate or conflict found in GTRecipeType {} and was not added. See next lines for details", - BuiltInRegistries.RECIPE_TYPE.getKey(this.recipeType)); + "Recipe duplicate or conflict found in GTRecipeType {} and was not added. See next lines for details", + BuiltInRegistries.RECIPE_TYPE.getKey(this.recipeType)); GTCEu.LOGGER.warn("Attempted to add GTRecipe: {}", recipe.getId()); @@ -548,9 +558,9 @@ private boolean recurseIngredientTreeAdd(@NotNull GTRecipe recipe, // recursive part: apply the addition for the next ingredient in the list, for the right branch. // the right branch only contains ingredients, or is empty when the left branch is present boolean addedNextBranch = r.right() - .filter(m -> recurseIngredientTreeAdd(recipe, ingredients, m, (index + 1) % ingredients.size(), - count + 1)) - .isPresent(); + .filter(m -> recurseIngredientTreeAdd(recipe, ingredients, m, (index + 1) % ingredients.size(), + count + 1)) + .isPresent(); if (!addedNextBranch) { // failed to add the next branch, so undo any made changes @@ -583,7 +593,8 @@ private boolean recurseIngredientTreeAdd(@NotNull GTRecipe recipe, * @return the correct nodes for the ingredient */ @NotNull - protected static Map> determineRootNodes(@NotNull AbstractMapIngredient ingredient, @NotNull Branch branchMap) { + protected static Map> determineRootNodes(@NotNull AbstractMapIngredient ingredient, + @NotNull Branch branchMap) { return ingredient.isSpecialIngredient() ? branchMap.getSpecialNodes() : branchMap.getNodes(); } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/MapFluidIngredient.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/MapFluidIngredient.java index a01b4362a5..40a0531b6b 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/MapFluidIngredient.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/MapFluidIngredient.java @@ -1,13 +1,14 @@ package com.gregtechceu.gtceu.api.recipe.lookup; import com.gregtechceu.gtceu.api.recipe.ingredient.FluidIngredient; + import com.lowdragmc.lowdraglib.side.fluid.FluidStack; -import it.unimi.dsi.fastutil.objects.ObjectArrayList; + import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.nbt.CompoundTag; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.level.material.Fluid; + +import it.unimi.dsi.fastutil.objects.ObjectArrayList; import org.jetbrains.annotations.NotNull; import java.util.List; @@ -61,4 +62,4 @@ public String toString() { return "MapFluidIngredient{" + "{fluid=" + BuiltInRegistries.FLUID.getKey(fluid) + "} {tag=" + tag + "}"; } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/MapFluidTagIngredient.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/MapFluidTagIngredient.java index 7642accc66..c4cc2be36d 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/MapFluidTagIngredient.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/MapFluidTagIngredient.java @@ -29,4 +29,4 @@ public boolean equals(Object obj) { public String toString() { return "MapFluidTagIngredient{" + "tag=" + tag.location() + "}"; } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/MapIntersectionIngredient.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/MapIntersectionIngredient.java index 96d35b0d71..635fa14b30 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/MapIntersectionIngredient.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/MapIntersectionIngredient.java @@ -5,6 +5,7 @@ import com.gregtechceu.gtceu.core.mixins.ItemValueAccessor; import com.gregtechceu.gtceu.core.mixins.TagValueAccessor; import com.gregtechceu.gtceu.utils.IngredientEquality; + import net.minecraft.world.item.crafting.Ingredient; import net.minecraftforge.common.crafting.IntersectionIngredient; @@ -12,12 +13,13 @@ import java.util.List; public class MapIntersectionIngredient extends AbstractMapIngredient { + protected IntersectionIngredient intersectionIngredient; protected List ingredients; public MapIntersectionIngredient(IntersectionIngredient ingredient) { this.intersectionIngredient = ingredient; - this.ingredients = new ArrayList<>(((IntersectionIngredientAccessor)ingredient).getChildren()); + this.ingredients = new ArrayList<>(((IntersectionIngredientAccessor) ingredient).getChildren()); this.ingredients.sort(IngredientEquality.INGREDIENT_COMPARATOR); } @@ -25,11 +27,11 @@ public MapIntersectionIngredient(IntersectionIngredient ingredient) { protected int hash() { int hash = 31; for (Ingredient ingredient : ingredients) { - for (Ingredient.Value value : ((IngredientAccessor)ingredient).getValues()) { + for (Ingredient.Value value : ((IngredientAccessor) ingredient).getValues()) { if (value instanceof Ingredient.TagValue tagValue) { - hash *= 31 * ((TagValueAccessor)tagValue).getTag().location().hashCode(); + hash *= 31 * ((TagValueAccessor) tagValue).getTag().location().hashCode(); } else { - hash *= 31 * ((ItemValueAccessor)value).getItem().getItem().hashCode(); + hash *= 31 * ((ItemValueAccessor) value).getItem().getItem().hashCode(); } } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/MapItemStackIngredient.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/MapItemStackIngredient.java index b31c1a19fe..53a9456260 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/MapItemStackIngredient.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/MapItemStackIngredient.java @@ -1,15 +1,10 @@ package com.gregtechceu.gtceu.api.recipe.lookup; -import com.gregtechceu.gtceu.api.capability.recipe.ItemRecipeCapability; import com.gregtechceu.gtceu.utils.IngredientEquality; -import it.unimi.dsi.fastutil.objects.ObjectArrayList; + import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.nbt.CompoundTag; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.Ingredient; -import org.jetbrains.annotations.NotNull; - -import java.util.List; public class MapItemStackIngredient extends AbstractMapIngredient { @@ -52,4 +47,4 @@ protected int hash() { public String toString() { return "MapItemStackIngredient{" + "item=" + BuiltInRegistries.ITEM.getKey(stack.getItem()) + "}"; } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/MapItemStackNBTIngredient.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/MapItemStackNBTIngredient.java index 4e87acfcb9..a24fdc77dc 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/MapItemStackNBTIngredient.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/MapItemStackNBTIngredient.java @@ -1,10 +1,12 @@ package com.gregtechceu.gtceu.api.recipe.lookup; import com.gregtechceu.gtceu.core.mixins.StrictNBTIngredientAccessor; -import it.unimi.dsi.fastutil.objects.ObjectArrayList; + import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.world.item.ItemStack; import net.minecraftforge.common.crafting.StrictNBTIngredient; + +import it.unimi.dsi.fastutil.objects.ObjectArrayList; import org.jetbrains.annotations.NotNull; import java.util.List; @@ -43,7 +45,8 @@ public boolean equals(Object obj) { } if (this.nbtIngredient != null) { if (other.nbtIngredient != null) { - return ItemStack.isSameItemSameTags(((StrictNBTIngredientAccessor)nbtIngredient).getStack(), ((StrictNBTIngredientAccessor)other.nbtIngredient).getStack()); + return ItemStack.isSameItemSameTags(((StrictNBTIngredientAccessor) nbtIngredient).getStack(), + ((StrictNBTIngredientAccessor) other.nbtIngredient).getStack()); } } else if (other.nbtIngredient != null) { return other.nbtIngredient.test(this.stack); @@ -61,4 +64,4 @@ public String toString() { public boolean isSpecialIngredient() { return true; } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/MapItemStackPartialNBTIngredient.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/MapItemStackPartialNBTIngredient.java index b25c8e2e5b..7cc1c5eb34 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/MapItemStackPartialNBTIngredient.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/MapItemStackPartialNBTIngredient.java @@ -1,14 +1,16 @@ package com.gregtechceu.gtceu.api.recipe.lookup; -import it.unimi.dsi.fastutil.objects.ObjectArrayList; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.world.item.ItemStack; import net.minecraftforge.common.crafting.PartialNBTIngredient; + +import it.unimi.dsi.fastutil.objects.ObjectArrayList; import org.jetbrains.annotations.NotNull; import java.util.List; public class MapItemStackPartialNBTIngredient extends MapItemStackIngredient { + PartialNBTIngredient nbtIngredient; public MapItemStackPartialNBTIngredient(ItemStack stack, PartialNBTIngredient nbtIngredient) { diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/MapItemTagIngredient.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/MapItemTagIngredient.java index 6cf0073c80..42c197d20f 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/MapItemTagIngredient.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/MapItemTagIngredient.java @@ -32,4 +32,4 @@ public boolean equals(Object obj) { public String toString() { return "MapItemTagIngredient{" + "tag=" + tag.location() + "}"; } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/RecipeIterator.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/RecipeIterator.java index 64633adfa1..0f2a81a096 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/RecipeIterator.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/lookup/RecipeIterator.java @@ -2,6 +2,7 @@ import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.GTRecipeType; + import org.jetbrains.annotations.NotNull; import java.util.Iterator; @@ -38,8 +39,8 @@ public GTRecipe next() { GTRecipe r = null; while (index < ingredients.size()) { r = recipeMap.getLookup().recurseIngredientTreeFindRecipe(ingredients, - recipeMap.getLookup().getLookup(), canHandle, - index, 0, (1L << index)); + recipeMap.getLookup().getLookup(), canHandle, + index, 0, (1L << index)); ++index; if (r != null) break; } @@ -49,4 +50,4 @@ public GTRecipe next() { public void reset() { index = 0; } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/modifier/ParallelLogic.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/modifier/ParallelLogic.java index 014d444d85..4bc20d37cf 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/modifier/ParallelLogic.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/modifier/ParallelLogic.java @@ -1,33 +1,32 @@ package com.gregtechceu.gtceu.api.recipe.modifier; -import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.capability.recipe.*; import com.gregtechceu.gtceu.api.machine.MetaMachine; -import com.gregtechceu.gtceu.api.machine.feature.IOverclockMachine; import com.gregtechceu.gtceu.api.machine.feature.IRecipeLogicMachine; -import com.gregtechceu.gtceu.api.machine.feature.ITieredMachine; import com.gregtechceu.gtceu.api.recipe.GTRecipe; -import com.gregtechceu.gtceu.api.recipe.RecipeHelper; import com.gregtechceu.gtceu.api.recipe.content.ContentModifier; + +import net.minecraft.MethodsReturnNonnullByDefault; + import com.mojang.datafixers.util.Pair; import it.unimi.dsi.fastutil.ints.IntOpenHashSet; import it.unimi.dsi.fastutil.ints.IntSet; import it.unimi.dsi.fastutil.objects.*; import lombok.AllArgsConstructor; -import net.minecraft.MethodsReturnNonnullByDefault; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.function.Predicate; +import javax.annotation.ParametersAreNonnullByDefault; + @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault @AllArgsConstructor public class ParallelLogic { @NotNull - public static Pair applyParallel(MetaMachine machine, @NotNull GTRecipe recipe, int parallelLimit, boolean modifyDuration) { + public static Pair applyParallel(MetaMachine machine, @NotNull GTRecipe recipe, + int parallelLimit, boolean modifyDuration) { if (machine instanceof IRecipeLogicMachine rlm) { return doParallelRecipes(recipe, rlm, parallelLimit, modifyDuration); } @@ -40,7 +39,8 @@ public static Pair applyParallel(MetaMachine machine, @NotNul * @param parallelAmount hard cap on the amount returned * @return returns the amount of possible time a recipe can be made from a given input inventory */ - public static int getMaxRecipeMultiplier(@NotNull GTRecipe recipe, @NotNull IRecipeCapabilityHolder holder, int parallelAmount) { + public static int getMaxRecipeMultiplier(@NotNull GTRecipe recipe, @NotNull IRecipeCapabilityHolder holder, + int parallelAmount) { IntSet multipliers = new IntOpenHashSet(); // non-tick inputs. @@ -130,7 +130,8 @@ public static int limitByOutputMerging(@NotNull GTRecipe recipe, @NotNull IRecip } } else { if (modifiedParallelAmounts.containsKey(cap)) { - modifiedParallelAmounts.put(cap, modifiedParallelAmounts.getInt(cap) + cap.limitParallel(recipe, holder, parallelAmount)); + modifiedParallelAmounts.put(cap, modifiedParallelAmounts.getInt(cap) + + cap.limitParallel(recipe, holder, parallelAmount)); } else { modifiedParallelAmounts.put(cap, cap.limitParallel(recipe, holder, parallelAmount)); } @@ -182,8 +183,8 @@ public static int limitByOutputMerging(@NotNull GTRecipe recipe, @NotNull IRecip // take care of voiding @NotNull public static Pair doParallelRecipes(@NotNull GTRecipe currentRecipe, - @NotNull IRecipeLogicMachine machine, - int parallelAmount, boolean modifyDuration) { + @NotNull IRecipeLogicMachine machine, + int parallelAmount, boolean modifyDuration) { // First check if we are limited by recipe inputs. This can short circuit a lot of consecutive checking int multiplierByInputs = getMaxRecipeMultiplier(currentRecipe, machine, parallelAmount); if (multiplierByInputs == 0) { @@ -192,7 +193,8 @@ public static Pair doParallelRecipes(@NotNull GTRecipe curren // Simulate the merging of the maximum amount of recipes that can be run with these items // and limit by the amount we can successfully merge - int limitByOutput = ParallelLogic.limitByOutputMerging(currentRecipe, machine, multiplierByInputs, machine::canVoidRecipeOutputs); + int limitByOutput = ParallelLogic.limitByOutputMerging(currentRecipe, machine, multiplierByInputs, + machine::canVoidRecipeOutputs); if (limitByOutput > 0) { currentRecipe = currentRecipe.copy(ContentModifier.multiplier(limitByOutput), modifyDuration); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/modifier/RecipeModifier.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/modifier/RecipeModifier.java index a5b90e7ad2..3391c441d2 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/modifier/RecipeModifier.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/modifier/RecipeModifier.java @@ -2,7 +2,9 @@ import com.gregtechceu.gtceu.api.machine.MetaMachine; import com.gregtechceu.gtceu.api.recipe.GTRecipe; + import net.minecraft.MethodsReturnNonnullByDefault; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -12,6 +14,7 @@ @ParametersAreNonnullByDefault @FunctionalInterface public interface RecipeModifier { + @Nullable GTRecipe apply(MetaMachine machine, @NotNull GTRecipe recipe); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/modifier/RecipeModifierList.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/modifier/RecipeModifierList.java index 8b40db1f57..a961299f17 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/modifier/RecipeModifierList.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/modifier/RecipeModifierList.java @@ -2,16 +2,18 @@ import com.gregtechceu.gtceu.api.machine.MetaMachine; import com.gregtechceu.gtceu.api.recipe.GTRecipe; + import net.minecraft.MethodsReturnNonnullByDefault; + import org.jetbrains.annotations.NotNull; import javax.annotation.Nullable; import javax.annotation.ParametersAreNonnullByDefault; -import java.util.List; @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault public class RecipeModifierList implements RecipeModifier { + private final RecipeModifier[] modifiers; public RecipeModifierList(RecipeModifier... modifiers) { diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/ui/GTRecipeTypeUI.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/ui/GTRecipeTypeUI.java index fe1401d5e1..85394e062b 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/ui/GTRecipeTypeUI.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/ui/GTRecipeTypeUI.java @@ -1,6 +1,5 @@ package com.gregtechceu.gtceu.api.recipe.ui; -import com.google.common.collect.Table; import com.gregtechceu.gtceu.api.capability.recipe.FluidRecipeCapability; import com.gregtechceu.gtceu.api.capability.recipe.IO; import com.gregtechceu.gtceu.api.capability.recipe.ItemRecipeCapability; @@ -16,6 +15,7 @@ import com.gregtechceu.gtceu.integration.emi.recipe.GTRecipeTypeEmiCategory; import com.gregtechceu.gtceu.integration.jei.recipe.GTRecipeTypeCategory; import com.gregtechceu.gtceu.integration.rei.recipe.GTRecipeTypeDisplayCategory; + import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.Platform; import com.lowdragmc.lowdraglib.gui.editor.configurator.IConfigurableWidget; @@ -28,19 +28,21 @@ import com.lowdragmc.lowdraglib.jei.JEIPlugin; import com.lowdragmc.lowdraglib.utils.Position; import com.lowdragmc.lowdraglib.utils.Size; -import dev.emi.emi.api.EmiApi; -import it.unimi.dsi.fastutil.bytes.Byte2ObjectArrayMap; -import it.unimi.dsi.fastutil.bytes.Byte2ObjectMap; -import it.unimi.dsi.fastutil.objects.Object2IntLinkedOpenHashMap; -import lombok.Getter; -import lombok.Setter; -import me.shedaniel.rei.api.client.view.ViewSearchBuilder; + import net.minecraft.client.Minecraft; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.NbtAccounter; import net.minecraft.nbt.NbtIo; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.resources.ResourceManager; + +import com.google.common.collect.Table; +import dev.emi.emi.api.EmiApi; +import it.unimi.dsi.fastutil.bytes.Byte2ObjectArrayMap; +import it.unimi.dsi.fastutil.bytes.Byte2ObjectMap; +import lombok.Getter; +import lombok.Setter; +import me.shedaniel.rei.api.client.view.ViewSearchBuilder; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -63,7 +65,9 @@ public class GTRecipeTypeUI { @Getter @Setter - private ProgressTexture progressBarTexture = new ProgressTexture(GuiTextures.PROGRESS_BAR_ARROW.getSubTexture(0, 0, 1, 0.5), GuiTextures.PROGRESS_BAR_ARROW.getSubTexture(0, 0.5, 1, 0.5)); + private ProgressTexture progressBarTexture = new ProgressTexture( + GuiTextures.PROGRESS_BAR_ARROW.getSubTexture(0, 0, 1, 0.5), + GuiTextures.PROGRESS_BAR_ARROW.getSubTexture(0, 0.5, 1, 0.5)); @Setter private SteamTexture steamProgressBarTexture = null; @Setter @@ -103,8 +107,10 @@ public CompoundTag getCustomUI() { this.customUICache = new CompoundTag(); } else { try { - var resource = resourceManager.getResourceOrThrow(new ResourceLocation(recipeType.registryName.getNamespace(), "ui/recipe_type/%s.rtui".formatted(recipeType.registryName.getPath()))); - try (InputStream inputStream = resource.open()){ + var resource = resourceManager + .getResourceOrThrow(new ResourceLocation(recipeType.registryName.getNamespace(), + "ui/recipe_type/%s.rtui".formatted(recipeType.registryName.getPath()))); + try (InputStream inputStream = resource.open()) { try (DataInputStream dataInputStream = new DataInputStream(inputStream)) { this.customUICache = NbtIo.read(dataInputStream, NbtAccounter.UNLIMITED); } @@ -131,10 +137,11 @@ public void reloadCustomUI() { public Size getJEISize() { Size size = this.jeiSize; - if(size == null) { + if (size == null) { var originalSize = createEditableUITemplate(false, false).createDefault().getSize(); this.originalWidth = originalSize.width; - this.jeiSize = size = new Size(Math.max(originalWidth, 150), getPropertyHeightShift() + 5 + originalSize.height); + this.jeiSize = size = new Size(Math.max(originalWidth, 150), + getPropertyHeightShift() + 5 + originalSize.height); } return size; } @@ -148,6 +155,7 @@ public record RecipeHolder(DoubleSupplier progressSupplier, /** * Auto layout UI template for recipes. + * * @param progressSupplier progress. To create a JEI / REI UI, use the para {@link ProgressWidget#JEIProgress}. */ public WidgetGroup createUITemplate(DoubleSupplier progressSupplier, @@ -158,7 +166,8 @@ public WidgetGroup createUITemplate(DoubleSupplier progressSupplier, boolean isHighPressure) { var template = createEditableUITemplate(isSteam, isHighPressure); var group = template.createDefault(); - template.setupUI(group, new RecipeHolder(progressSupplier, storages, data, conditions, isSteam, isHighPressure)); + template.setupUI(group, + new RecipeHolder(progressSupplier, storages, data, conditions, isSteam, isHighPressure)); return group; } @@ -172,13 +181,15 @@ public WidgetGroup createUITemplate(DoubleSupplier progressSupplier, /** * Auto layout UI template for recipes. */ - public IEditableUI createEditableUITemplate(final boolean isSteam, final boolean isHighPressure) { + public IEditableUI createEditableUITemplate(final boolean isSteam, + final boolean isHighPressure) { return new IEditableUI.Normal<>(() -> { var isCustomUI = !isSteam && hasCustomUI(); if (isCustomUI) { CompoundTag nbt = getCustomUI(); WidgetGroup group = new WidgetGroup(); - IConfigurableWidget.deserializeNBT(group, nbt.getCompound("root"), Resources.fromNBT(nbt.getCompound("resources")), false); + IConfigurableWidget.deserializeNBT(group, nbt.getCompound("root"), + Resources.fromNBT(nbt.getCompound("resources")), false); group.setSelfPosition(new Position(0, 0)); return group; } @@ -186,23 +197,26 @@ public IEditableUI createEditableUITemplate(final boo var inputs = addInventorySlotGroup(false, isSteam, isHighPressure); var outputs = addInventorySlotGroup(true, isSteam, isHighPressure); var maxWidth = Math.max(inputs.getSize().width, outputs.getSize().width); - var group = new WidgetGroup(0, 0, 2 * maxWidth + 40, Math.max(inputs.getSize().height, outputs.getSize().height)); + var group = new WidgetGroup(0, 0, 2 * maxWidth + 40, + Math.max(inputs.getSize().height, outputs.getSize().height)); var size = group.getSize(); - inputs.addSelfPosition((maxWidth -inputs.getSize().width) / 2, (size.height - inputs.getSize().height) / 2); - outputs.addSelfPosition(maxWidth + 40 + (maxWidth - outputs.getSize().width) / 2, (size.height - outputs.getSize().height) / 2); + inputs.addSelfPosition((maxWidth - inputs.getSize().width) / 2, + (size.height - inputs.getSize().height) / 2); + outputs.addSelfPosition(maxWidth + 40 + (maxWidth - outputs.getSize().width) / 2, + (size.height - outputs.getSize().height) / 2); group.addWidget(inputs); group.addWidget(outputs); - var progressWidget = new ProgressWidget(ProgressWidget.JEIProgress, maxWidth + 10, size.height / 2 - 10, 20, 20, progressBarTexture); + var progressWidget = new ProgressWidget(ProgressWidget.JEIProgress, maxWidth + 10, size.height / 2 - 10, 20, + 20, progressBarTexture); progressWidget.setId("progress"); group.addWidget(progressWidget); progressWidget.setProgressTexture((isSteam && steamProgressBarTexture != null) ? new ProgressTexture( - steamProgressBarTexture.get(isHighPressure).getSubTexture(0, 0, 1, 0.5), - steamProgressBarTexture.get(isHighPressure).getSubTexture(0, 0.5, 1, 0.5)) - .setFillDirection(steamMoveType) - : progressBarTexture); + steamProgressBarTexture.get(isHighPressure).getSubTexture(0, 0, 1, 0.5), + steamProgressBarTexture.get(isHighPressure).getSubTexture(0, 0.5, 1, 0.5)) + .setFillDirection(steamMoveType) : progressBarTexture); return group; }, (template, recipeHolder) -> { @@ -215,7 +229,8 @@ public IEditableUI createEditableUITemplate(final boo progressWidget.setProgressSupplier(recipeHolder.progressSupplier); progress.add(progressWidget); }); - // Then set the dual-progress widgets, to override their builtin ones' suppliers, in case someone forgot to remove the id from the internal ones. + // Then set the dual-progress widgets, to override their builtin ones' suppliers, in case someone forgot to + // remove the id from the internal ones. WidgetUtils.widgetByIdForEach(template, "^progress$", DualProgressWidget.class, dualProgressWidget -> { dualProgressWidget.setProgressSupplier(recipeHolder.progressSupplier); progress.add(dualProgressWidget); @@ -223,17 +238,22 @@ public IEditableUI createEditableUITemplate(final boo // add recipe button if (!isJEI && (LDLib.isReiLoaded() || LDLib.isJeiLoaded() || LDLib.isEmiLoaded())) { for (Widget widget : progress) { - template.addWidget(new ButtonWidget(widget.getPosition().x, widget.getPosition().y, widget.getSize().width, widget.getSize().height, IGuiTexture.EMPTY, cd -> { - if (cd.isRemote) { - if (LDLib.isReiLoaded()) { - ViewSearchBuilder.builder().addCategory(GTRecipeTypeDisplayCategory.CATEGORIES.apply(recipeType)).open(); - } else if (LDLib.isJeiLoaded()) { - JEIPlugin.jeiRuntime.getRecipesGui().showTypes(List.of(GTRecipeTypeCategory.TYPES.apply(recipeType))); - } else if (LDLib.isEmiLoaded()) { - EmiApi.displayRecipeCategory(GTRecipeTypeEmiCategory.CATEGORIES.apply(recipeType)); - } - } - }).setHoverTooltips("gtceu.recipe_type.show_recipes")); + template.addWidget(new ButtonWidget(widget.getPosition().x, widget.getPosition().y, + widget.getSize().width, widget.getSize().height, IGuiTexture.EMPTY, cd -> { + if (cd.isRemote) { + if (LDLib.isReiLoaded()) { + ViewSearchBuilder.builder() + .addCategory(GTRecipeTypeDisplayCategory.CATEGORIES.apply(recipeType)) + .open(); + } else if (LDLib.isJeiLoaded()) { + JEIPlugin.jeiRuntime.getRecipesGui() + .showTypes(List.of(GTRecipeTypeCategory.TYPES.apply(recipeType))); + } else if (LDLib.isEmiLoaded()) { + EmiApi.displayRecipeCategory( + GTRecipeTypeEmiCategory.CATEGORIES.apply(recipeType)); + } + } + }).setHoverTooltips("gtceu.recipe_type.show_recipes")); } } @@ -246,10 +266,12 @@ public IEditableUI createEditableUITemplate(final boo // bind overlays Class widgetClass = cap.getWidgetClass(); if (widgetClass != null) { - WidgetUtils.widgetByIdForEach(template, "^%s_[0-9]+$".formatted(cap.slotName(io)), widgetClass, widget -> { - var index = WidgetUtils.widgetIdIndex(widget); - cap.applyWidgetInfo(widget, index, isJEI, io, recipeHolder, recipeType, null, null, storage); - }); + WidgetUtils.widgetByIdForEach(template, "^%s_[0-9]+$".formatted(cap.slotName(io)), widgetClass, + widget -> { + var index = WidgetUtils.widgetIdIndex(widget); + cap.applyWidgetInfo(widget, index, isJEI, io, recipeHolder, recipeType, null, null, + storage); + }); } } } @@ -294,7 +316,8 @@ protected WidgetGroup addInventorySlotGroup(boolean isOutputs, boolean isSteam, for (int slotIndex = 0; slotIndex < capCount; slotIndex++) { var slot = cap.createWidget(); slot.setSelfPosition(new Position((index % 3) * 18 + 4, (index / 3) * 18 + 4)); - slot.setBackground(getOverlaysForSlot(isOutputs, cap, slotIndex == capCount - 1, isSteam, isHighPressure)); + slot.setBackground( + getOverlaysForSlot(isOutputs, cap, slotIndex == capCount - 1, isSteam, isHighPressure)); slot.setId(cap.slotName(isOutputs ? IO.OUT : IO.IN, slotIndex)); group.addWidget(slot); index++; @@ -308,12 +331,14 @@ protected WidgetGroup addInventorySlotGroup(boolean isOutputs, boolean isSteam, /** * Add a slot to this ui */ - protected void addSlot(WidgetGroup group, int x, int y, int slotIndex, int count, RecipeCapability capability, boolean isOutputs, boolean isSteam, boolean isHighPressure) { + protected void addSlot(WidgetGroup group, int x, int y, int slotIndex, int count, RecipeCapability capability, + boolean isOutputs, boolean isSteam, boolean isHighPressure) { if (capability != FluidRecipeCapability.CAP) { var slot = new SlotWidget(); slot.initTemplate(); slot.setSelfPosition(new Position(x, y)); - slot.setBackground(getOverlaysForSlot(isOutputs, capability, slotIndex == count - 1, isSteam, isHighPressure)); + slot.setBackground( + getOverlaysForSlot(isOutputs, capability, slotIndex == count - 1, isSteam, isHighPressure)); slot.setId(ItemRecipeCapability.CAP.slotName(isOutputs ? IO.OUT : IO.IN, slotIndex)); group.addWidget(slot); } else { @@ -321,7 +346,8 @@ protected void addSlot(WidgetGroup group, int x, int y, int slotIndex, int count tank.initTemplate(); tank.setFillDirection(ProgressTexture.FillDirection.ALWAYS_FULL); tank.setSelfPosition(new Position(x, y)); - tank.setBackground(getOverlaysForSlot(isOutputs, capability, slotIndex == count - 1, isSteam, isHighPressure)); + tank.setBackground( + getOverlaysForSlot(isOutputs, capability, slotIndex == count - 1, isSteam, isHighPressure)); tank.setId(FluidRecipeCapability.CAP.slotName(isOutputs ? IO.OUT : IO.IN, slotIndex)); group.addWidget(tank); } @@ -331,31 +357,33 @@ protected static int[] determineSlotsGrid(int itemCount) { int itemSlotsToLeft; int itemSlotsToDown; double sqrt = Math.sqrt(itemCount); - //if the number of input has an integer root - //return it. + // if the number of input has an integer root + // return it. if (sqrt % 1 == 0) { itemSlotsToLeft = itemSlotsToDown = (int) sqrt; } else if (itemCount == 3) { itemSlotsToLeft = 3; itemSlotsToDown = 1; } else { - //if we couldn't fit all into a perfect square, - //increase the amount of slots to the left + // if we couldn't fit all into a perfect square, + // increase the amount of slots to the left itemSlotsToLeft = (int) Math.ceil(sqrt); itemSlotsToDown = itemSlotsToLeft - 1; - //if we still can't fit all the slots in a grid, - //increase the amount of slots on the bottom + // if we still can't fit all the slots in a grid, + // increase the amount of slots on the bottom if (itemCount > itemSlotsToLeft * itemSlotsToDown) { itemSlotsToDown = itemSlotsToLeft; } } - return new int[]{itemSlotsToLeft, itemSlotsToDown}; + return new int[] { itemSlotsToLeft, itemSlotsToDown }; } - - protected IGuiTexture getOverlaysForSlot(boolean isOutput, RecipeCapability capability, boolean isLast, boolean isSteam, boolean isHighPressure) { - IGuiTexture base = capability == FluidRecipeCapability.CAP ? GuiTextures.FLUID_SLOT : (isSteam ? GuiTextures.SLOT_STEAM.get(isHighPressure) : GuiTextures.SLOT); - byte overlayKey = (byte) ((isOutput ? 2 : 0) + (capability == FluidRecipeCapability.CAP ? 1 : 0) + (isLast ? 4 : 0)); + protected IGuiTexture getOverlaysForSlot(boolean isOutput, RecipeCapability capability, boolean isLast, + boolean isSteam, boolean isHighPressure) { + IGuiTexture base = capability == FluidRecipeCapability.CAP ? GuiTextures.FLUID_SLOT : + (isSteam ? GuiTextures.SLOT_STEAM.get(isHighPressure) : GuiTextures.SLOT); + byte overlayKey = (byte) ((isOutput ? 2 : 0) + (capability == FluidRecipeCapability.CAP ? 1 : 0) + + (isLast ? 4 : 0)); if (slotOverlays.containsKey(overlayKey)) { return new GuiTextureGroup(base, slotOverlays.get(overlayKey)); } @@ -377,7 +405,8 @@ public void appendJEIUI(GTRecipe recipe, WidgetGroup widgetGroup) { } public GTRecipeTypeUI setSlotOverlay(boolean isOutput, boolean isFluid, IGuiTexture slotOverlay) { - return this.setSlotOverlay(isOutput, isFluid, false, slotOverlay).setSlotOverlay(isOutput, isFluid, true, slotOverlay); + return this.setSlotOverlay(isOutput, isFluid, false, slotOverlay).setSlotOverlay(isOutput, isFluid, true, + slotOverlay); } public GTRecipeTypeUI setSlotOverlay(boolean isOutput, boolean isFluid, boolean isLast, IGuiTexture slotOverlay) { @@ -386,7 +415,8 @@ public GTRecipeTypeUI setSlotOverlay(boolean isOutput, boolean isFluid, boolean } public GTRecipeTypeUI setProgressBar(ResourceTexture progressBar, ProgressTexture.FillDirection moveType) { - this.progressBarTexture = new ProgressTexture(progressBar.getSubTexture(0, 0, 1, 0.5), progressBar.getSubTexture(0, 0.5, 1, 0.5)).setFillDirection(moveType); + this.progressBarTexture = new ProgressTexture(progressBar.getSubTexture(0, 0, 1, 0.5), + progressBar.getSubTexture(0, 0.5, 1, 0.5)).setFillDirection(moveType); return this; } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/registry/GTRegistries.java b/src/main/java/com/gregtechceu/gtceu/api/registry/GTRegistries.java index 83299a40f1..a09182af58 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/registry/GTRegistries.java +++ b/src/main/java/com/gregtechceu/gtceu/api/registry/GTRegistries.java @@ -1,12 +1,9 @@ package com.gregtechceu.gtceu.api.registry; - import com.gregtechceu.gtceu.GTCEu; -import com.gregtechceu.gtceu.api.GTCEuAPI; import com.gregtechceu.gtceu.api.capability.recipe.RecipeCapability; import com.gregtechceu.gtceu.api.cover.CoverDefinition; import com.gregtechceu.gtceu.api.data.chemical.Element; -import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.api.data.worldgen.GTOreDefinition; import com.gregtechceu.gtceu.api.data.worldgen.bedrockfluid.BedrockFluidDefinition; import com.gregtechceu.gtceu.api.data.worldgen.bedrockore.BedrockOreDefinition; @@ -16,15 +13,14 @@ import com.gregtechceu.gtceu.api.registry.registrate.CompassNode; import com.gregtechceu.gtceu.api.registry.registrate.CompassSection; import com.gregtechceu.gtceu.api.sound.SoundEntry; -import com.gregtechceu.gtceu.common.registry.GTRegistration; + import com.lowdragmc.lowdraglib.Platform; -import com.mojang.serialization.Codec; + import net.minecraft.core.Registry; import net.minecraft.core.RegistryAccess; import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraft.world.item.crafting.RecipeType; import net.minecraft.world.level.levelgen.feature.Feature; @@ -36,12 +32,15 @@ import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; +import com.mojang.serialization.Codec; + /** * @author KilaBash * @date 2023/2/13 * @implNote ElementRegistry */ public final class GTRegistries { + // GT Registry public static final GTRegistry.String ELEMENTS = new GTRegistry.String<>(GTCEu.id("element")); @@ -49,18 +48,26 @@ public final class GTRegistries { public static final GTRegistry.RL COVERS = new GTRegistry.RL<>(GTCEu.id("cover")); public static final GTRegistry.RL MACHINES = new GTRegistry.RL<>(GTCEu.id("machine")); - public static final GTRegistry.String> RECIPE_CAPABILITIES = new GTRegistry.String<>(GTCEu.id("recipe_capability")); - public static final GTRegistry.String> RECIPE_CONDITIONS = new GTRegistry.String<>(GTCEu.id("recipe_condition")); + public static final GTRegistry.String> RECIPE_CAPABILITIES = new GTRegistry.String<>( + GTCEu.id("recipe_capability")); + public static final GTRegistry.String> RECIPE_CONDITIONS = new GTRegistry.String<>( + GTCEu.id("recipe_condition")); public static final GTRegistry.RL SOUNDS = new GTRegistry.RL<>(GTCEu.id("sound")); - public static final GTRegistry.RL COMPASS_SECTIONS = new GTRegistry.RL<>(GTCEu.id("compass_section")); + public static final GTRegistry.RL COMPASS_SECTIONS = new GTRegistry.RL<>( + GTCEu.id("compass_section")); public static final GTRegistry.RL COMPASS_NODES = new GTRegistry.RL<>(GTCEu.id("compass_node")); - public static final GTRegistry.RL BEDROCK_FLUID_DEFINITIONS = new GTRegistry.RL<>(GTCEu.id("bedrock_fluid")); - public static final GTRegistry.RL BEDROCK_ORE_DEFINITIONS = new GTRegistry.RL<>(GTCEu.id("bedrock_ore")); + public static final GTRegistry.RL BEDROCK_FLUID_DEFINITIONS = new GTRegistry.RL<>( + GTCEu.id("bedrock_fluid")); + public static final GTRegistry.RL BEDROCK_ORE_DEFINITIONS = new GTRegistry.RL<>( + GTCEu.id("bedrock_ore")); public static final GTRegistry.RL ORE_VEINS = new GTRegistry.RL<>(GTCEu.id("ore_vein")); - public static final DeferredRegister> TRUNK_PLACER_TYPE = DeferredRegister.create(Registries.TRUNK_PLACER_TYPE, GTCEu.MOD_ID); - public static final DeferredRegister> PLACEMENT_MODIFIER = DeferredRegister.create(Registries.PLACEMENT_MODIFIER_TYPE, GTCEu.MOD_ID); - public static final DeferredRegister> GLOBAL_LOOT_MODIFIES = DeferredRegister.create(ForgeRegistries.Keys.GLOBAL_LOOT_MODIFIER_SERIALIZERS, GTCEu.MOD_ID); + public static final DeferredRegister> TRUNK_PLACER_TYPE = DeferredRegister + .create(Registries.TRUNK_PLACER_TYPE, GTCEu.MOD_ID); + public static final DeferredRegister> PLACEMENT_MODIFIER = DeferredRegister + .create(Registries.PLACEMENT_MODIFIER_TYPE, GTCEu.MOD_ID); + public static final DeferredRegister> GLOBAL_LOOT_MODIFIES = DeferredRegister + .create(ForgeRegistries.Keys.GLOBAL_LOOT_MODIFIER_SERIALIZERS, GTCEu.MOD_ID); public static T register(Registry registry, ResourceLocation name, T value) { ResourceKey registryKey = registry.key(); @@ -72,9 +79,9 @@ public static T register(Registry registry, ResourceLocation } else if (registryKey == Registries.FEATURE) { ForgeRegistries.FEATURES.register(name, (Feature) value); } else if (registryKey == Registries.FOLIAGE_PLACER_TYPE) { - ForgeRegistries.FOLIAGE_PLACER_TYPES.register(name, (FoliagePlacerType)value); + ForgeRegistries.FOLIAGE_PLACER_TYPES.register(name, (FoliagePlacerType) value); } else if (registryKey == Registries.TRUNK_PLACER_TYPE) { - TRUNK_PLACER_TYPE.register(name.getPath(), () -> (TrunkPlacerType)value); + TRUNK_PLACER_TYPE.register(name.getPath(), () -> (TrunkPlacerType) value); } else if (registryKey == Registries.PLACEMENT_MODIFIER_TYPE) { PLACEMENT_MODIFIER.register(name.getPath(), () -> (PlacementModifierType) value); } else { diff --git a/src/main/java/com/gregtechceu/gtceu/api/registry/GTRegistry.java b/src/main/java/com/gregtechceu/gtceu/api/registry/GTRegistry.java index 521afbbef1..c2aea4cd01 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/registry/GTRegistry.java +++ b/src/main/java/com/gregtechceu/gtceu/api/registry/GTRegistry.java @@ -1,11 +1,7 @@ package com.gregtechceu.gtceu.api.registry; -import com.google.common.collect.BiMap; -import com.google.common.collect.HashBiMap; import com.gregtechceu.gtceu.GTCEu; -import com.mojang.serialization.Codec; -import com.mojang.serialization.DataResult; -import lombok.Getter; + import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.StringTag; import net.minecraft.nbt.Tag; @@ -13,9 +9,15 @@ import net.minecraft.resources.ResourceLocation; import net.minecraftforge.fml.ModContainer; import net.minecraftforge.fml.ModLoadingContext; -import org.jetbrains.annotations.NotNull; +import com.google.common.collect.BiMap; +import com.google.common.collect.HashBiMap; +import com.mojang.serialization.Codec; +import com.mojang.serialization.DataResult; +import lombok.Getter; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; + import java.util.*; /** @@ -24,6 +26,7 @@ * @implNote GTRegistry */ public abstract class GTRegistry implements Iterable { + public static final Map> REGISTERED = new HashMap<>(); protected final BiMap registry; @@ -78,7 +81,8 @@ public void unfreeze() { @SuppressWarnings("BooleanMethodIsAlwaysInverted") private static boolean checkActiveModContainerIsGregtech() { ModContainer container = ModLoadingContext.get().getActiveContainer(); - return container != null && container.getModId().equals(GTCEu.MOD_ID) || container.getModId().equals("minecraft"); // check for minecraft modid in case of datagen or a mishap + return container != null && container.getModId().equals(GTCEu.MOD_ID) || + container.getModId().equals("minecraft"); // check for minecraft modid in case of datagen or a mishap } public void register(K key, V value) { @@ -86,7 +90,8 @@ public void register(K key, V value) { throw new IllegalStateException("[register] registry %s has been frozen".formatted(registryName)); } if (containKey(key)) { - throw new IllegalStateException("[register] registry %s contains key %s already".formatted(registryName, key)); + throw new IllegalStateException( + "[register] registry %s contains key %s already".formatted(registryName, key)); } registry.put(key, value); } @@ -164,7 +169,7 @@ public boolean remove(K name) { public abstract Codec codec(); - //************************ Built-in Registry ************************// + // ************************ Built-in Registry ************************// public static class String extends GTRegistry { @@ -203,7 +208,14 @@ public V loadFromNBT(Tag tag) { @Override public Codec codec() { - return Codec.STRING.flatXmap(str -> Optional.ofNullable(this.get(str)).map(DataResult::success).orElseGet(() -> DataResult.error(() -> "Unknown registry key in " + this.registryName + ": " + str)), obj -> Optional.ofNullable(this.getKey(obj)).map(DataResult::success).orElseGet(() -> DataResult.error(() -> "Unknown registry element in " + this.registryName + ": " + obj))); + return Codec.STRING + .flatXmap( + str -> Optional.ofNullable(this.get(str)).map(DataResult::success) + .orElseGet(() -> DataResult + .error(() -> "Unknown registry key in " + this.registryName + ": " + str)), + obj -> Optional.ofNullable(this.getKey(obj)).map(DataResult::success) + .orElseGet(() -> DataResult.error( + () -> "Unknown registry element in " + this.registryName + ": " + obj))); } } @@ -244,7 +256,14 @@ public V loadFromNBT(Tag tag) { @Override public Codec codec() { - return ResourceLocation.CODEC.flatXmap(rl -> Optional.ofNullable(this.get(rl)).map(DataResult::success).orElseGet(() -> DataResult.error(() -> "Unknown registry key in " + this.registryName + ": " + rl)), obj -> Optional.ofNullable(this.getKey(obj)).map(DataResult::success).orElseGet(() -> DataResult.error(() -> "Unknown registry element in " + this.registryName + ": " + obj))); + return ResourceLocation.CODEC + .flatXmap( + rl -> Optional.ofNullable(this.get(rl)).map(DataResult::success) + .orElseGet(() -> DataResult + .error(() -> "Unknown registry key in " + this.registryName + ": " + rl)), + obj -> Optional.ofNullable(this.getKey(obj)).map(DataResult::success) + .orElseGet(() -> DataResult.error( + () -> "Unknown registry element in " + this.registryName + ": " + obj))); } } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/CompassNode.java b/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/CompassNode.java index ff88909e02..b6029f1b86 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/CompassNode.java +++ b/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/CompassNode.java @@ -1,17 +1,14 @@ package com.gregtechceu.gtceu.api.registry.registrate; -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.utils.FormattingUtil; + import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.texture.ItemStackTexture; import com.lowdragmc.lowdraglib.json.SimpleIGuiTextureJsonUtils; import com.lowdragmc.lowdraglib.utils.Position; -import lombok.Getter; -import lombok.Setter; -import lombok.experimental.Accessors; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.data.CachedOutput; @@ -23,14 +20,20 @@ import net.minecraft.world.item.Item; import net.minecraftforge.common.data.ExistingFileHelper; +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; + import java.nio.file.Path; import java.util.*; import java.util.concurrent.CompletableFuture; -import java.util.function.Predicate; import java.util.function.Supplier; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author KilaBash * @date 2023/7/31 @@ -40,6 +43,7 @@ @MethodsReturnNonnullByDefault @Accessors(fluent = true, chain = true) public class CompassNode { + @Getter private final ResourceLocation sectionID; @Getter @@ -48,14 +52,17 @@ public class CompassNode { private ResourceLocation page; @Setter private int size = 24; - @Setter @Nullable // null - auto layout + @Setter + @Nullable // null - auto layout private Position position = null; private final Set preNodes = new HashSet<>(); private final List> items = new ArrayList<>(); private final Set> tags = new HashSet<>(); - @Setter @Nullable + @Setter + @Nullable private Supplier icon = null; - @Setter @Getter + @Setter + @Getter private String lang; private CompassNode(ResourceLocation sectionID, String nodeID) { @@ -118,6 +125,7 @@ public CompassNode iconIfNull(Supplier icon) { } public static class CompassNodeProvider implements DataProvider { + private final PackOutput output; private final ExistingFileHelper existingHelper; @@ -172,7 +180,8 @@ public CompletableFuture generate(Path path, CachedOutput cache) { private CompletableFuture genNodeData(Path path, CachedOutput cache, CompassNode node) { if (node.position == null) return CompletableFuture.completedFuture(null); var resourcePath = "compass/nodes/" + node.nodeID.getPath() + ".json"; - if (existingHelper.exists(GTCEu.id(resourcePath), PackType.CLIENT_RESOURCES)) return CompletableFuture.completedFuture(null); + if (existingHelper.exists(GTCEu.id(resourcePath), PackType.CLIENT_RESOURCES)) + return CompletableFuture.completedFuture(null); JsonObject json = new JsonObject(); json.addProperty("section", node.sectionID.toString()); @@ -184,7 +193,7 @@ private CompletableFuture genNodeData(Path path, CachedOutput cache, CompassN node.icon = () -> IGuiTexture.EMPTY; } } - json.add("button_texture",SimpleIGuiTextureJsonUtils.toJson(node.icon.get())); + json.add("button_texture", SimpleIGuiTextureJsonUtils.toJson(node.icon.get())); if (node.size != 24) { json.addProperty("size", node.size); } @@ -216,7 +225,5 @@ private CompletableFuture genNodeData(Path path, CachedOutput cache, CompassN return DataProvider.saveStable(cache, json, path.resolve(resourcePath)); } - } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/CompassSection.java b/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/CompassSection.java index 532ae09789..784bdff35a 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/CompassSection.java +++ b/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/CompassSection.java @@ -1,32 +1,33 @@ package com.gregtechceu.gtceu.api.registry.registrate; -import com.google.gson.JsonObject; import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.utils.FormattingUtil; + import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.json.SimpleIGuiTextureJsonUtils; -import lombok.Getter; -import lombok.Setter; -import lombok.experimental.Accessors; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.data.CachedOutput; -import net.minecraft.data.DataGenerator; import net.minecraft.data.DataProvider; import net.minecraft.data.PackOutput; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.PackType; import net.minecraftforge.common.data.ExistingFileHelper; +import com.google.gson.JsonObject; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; -import java.io.IOException; + import java.nio.file.Path; import java.util.Objects; import java.util.concurrent.CompletableFuture; -import java.util.function.Predicate; import java.util.function.Supplier; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author KilaBash * @date 2023/7/31 @@ -36,15 +37,18 @@ @MethodsReturnNonnullByDefault @Accessors(fluent = true, chain = true) public class CompassSection { + @Getter private final ResourceLocation sectionID; @Setter private Supplier icon = () -> IGuiTexture.EMPTY; - @Setter @Nullable + @Setter + @Nullable private Supplier background = null; @Setter private int priority = 99; - @Setter @Getter + @Setter + @Getter private String lang; private CompassSection(String section) { @@ -66,6 +70,7 @@ public String getUnlocalizedKey() { } public static class CompassSectionProvider implements DataProvider { + private final PackOutput output; private final ExistingFileHelper existingHelper; @@ -91,15 +96,13 @@ public CompletableFuture generate(Path path, CachedOutput cache) { return null; } JsonObject json = new JsonObject(); - json.add("button_texture",SimpleIGuiTextureJsonUtils.toJson(section.icon.get())); + json.add("button_texture", SimpleIGuiTextureJsonUtils.toJson(section.icon.get())); if (section.background != null) { - json.add("background_texture",SimpleIGuiTextureJsonUtils.toJson(section.background.get())); + json.add("background_texture", SimpleIGuiTextureJsonUtils.toJson(section.background.get())); } json.addProperty("priority", section.priority); return DataProvider.saveStable(cache, json, path.resolve(resourcePath)); }).filter(Objects::nonNull).toArray(CompletableFuture[]::new)); } - } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/GTRegistrate.java b/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/GTRegistrate.java index 85ff2ec191..7311642ab7 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/GTRegistrate.java +++ b/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/GTRegistrate.java @@ -14,17 +14,7 @@ import com.gregtechceu.gtceu.api.machine.multiblock.MultiblockControllerMachine; import com.gregtechceu.gtceu.api.registry.registrate.forge.GTFluidBuilder; import com.gregtechceu.gtceu.utils.FormattingUtil; -import com.tterrag.registrate.Registrate; -import com.tterrag.registrate.builders.Builder; -import com.tterrag.registrate.builders.ItemBuilder; -import com.tterrag.registrate.builders.NoConfigBuilder; -import com.tterrag.registrate.providers.ProviderType; -import com.tterrag.registrate.providers.RegistrateLangProvider; -import com.tterrag.registrate.util.entry.ItemEntry; -import com.tterrag.registrate.util.entry.RegistryEntry; -import com.tterrag.registrate.util.nullness.NonNullBiConsumer; -import com.tterrag.registrate.util.nullness.NonNullFunction; -import com.tterrag.registrate.util.nullness.NonNullSupplier; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Registry; @@ -41,11 +31,21 @@ import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.registries.RegistryObject; -import org.apache.commons.lang3.function.TriFunction; +import com.tterrag.registrate.Registrate; +import com.tterrag.registrate.builders.Builder; +import com.tterrag.registrate.builders.ItemBuilder; +import com.tterrag.registrate.builders.NoConfigBuilder; +import com.tterrag.registrate.providers.ProviderType; +import com.tterrag.registrate.util.entry.ItemEntry; +import com.tterrag.registrate.util.entry.RegistryEntry; +import com.tterrag.registrate.util.nullness.NonNullBiConsumer; +import com.tterrag.registrate.util.nullness.NonNullFunction; +import com.tterrag.registrate.util.nullness.NonNullSupplier; +import org.apache.commons.lang3.function.TriFunction; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; + import java.util.Arrays; import java.util.IdentityHashMap; import java.util.Locale; @@ -57,6 +57,8 @@ import java.util.function.Supplier; import java.util.stream.Stream; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author KilaBash * @date 2023/2/14 @@ -72,8 +74,12 @@ protected GTRegistrate(String modId) { super(modId); } - public static IGTFluidBuilder fluid(GTRegistrate parent, Material material, String name, String langKey, ResourceLocation stillTexture, ResourceLocation flowingTexture) { - return parent.entry(name, callback -> new GTFluidBuilder<>(parent, parent, material, name, langKey, callback, stillTexture, flowingTexture, GTFluidBuilder::defaultFluidType).defaultLang().defaultSource().setData(ProviderType.LANG, NonNullBiConsumer.noop())); + public static IGTFluidBuilder fluid(GTRegistrate parent, Material material, String name, String langKey, + ResourceLocation stillTexture, ResourceLocation flowingTexture) { + return parent.entry(name, + callback -> new GTFluidBuilder<>(parent, parent, material, name, langKey, callback, stillTexture, + flowingTexture, GTFluidBuilder::defaultFluidType).defaultLang().defaultSource() + .setData(ProviderType.LANG, NonNullBiConsumer.noop())); } @NotNull @@ -93,17 +99,20 @@ public Registrate registerEventListeners(IEventBus bus) { return this; } - protected

NoConfigBuilder createCreativeModeTab(P parent, String name, Consumer config) { + protected < + P> NoConfigBuilder createCreativeModeTab(P parent, String name, + Consumer config) { return this.generic(parent, name, Registries.CREATIVE_MODE_TAB, () -> { var builder = CreativeModeTab.builder() - .icon(() -> getAll(Registries.ITEM).stream().findFirst().map(ItemEntry::cast).map(ItemEntry::asStack).orElse(new ItemStack(Items.AIR))); + .icon(() -> getAll(Registries.ITEM).stream().findFirst().map(ItemEntry::cast) + .map(ItemEntry::asStack).orElse(new ItemStack(Items.AIR))); config.accept(builder); return builder.build(); }); } - - public IGTFluidBuilder createFluid(String name, String langKey, Material material, ResourceLocation stillTexture, ResourceLocation flowingTexture) { + public IGTFluidBuilder createFluid(String name, String langKey, Material material, ResourceLocation stillTexture, + ResourceLocation flowingTexture) { return fluid(this, material, name, langKey, stillTexture, flowingTexture); } @@ -113,26 +122,38 @@ public MachineBuilder machine BiFunction blockFactory, BiFunction itemFactory, TriFunction, BlockPos, BlockState, IMachineBlockEntity> blockEntityFactory) { - return MachineBuilder.create(this, name, definitionFactory, metaMachine, blockFactory, itemFactory, blockEntityFactory); + return MachineBuilder.create(this, name, definitionFactory, metaMachine, blockFactory, itemFactory, + blockEntityFactory); } - public MachineBuilder machine(String name, Function metaMachine) { - return MachineBuilder.create(this, name, MachineDefinition::createDefinition, metaMachine, MetaMachineBlock::new, MetaMachineItem::new, MetaMachineBlockEntity::createBlockEntity); + public MachineBuilder machine(String name, + Function metaMachine) { + return MachineBuilder.create(this, name, MachineDefinition::createDefinition, metaMachine, + MetaMachineBlock::new, MetaMachineItem::new, MetaMachineBlockEntity::createBlockEntity); } - public Stream> machine(String name, BiFunction metaMachine, int... tiers) { - return Arrays.stream(tiers).mapToObj(tier -> MachineBuilder.create(this, name + "." + GTValues.VN[tier].toLowerCase(Locale.ROOT), MachineDefinition::createDefinition, holder -> metaMachine.apply(holder, tier), MetaMachineBlock::new, MetaMachineItem::new, MetaMachineBlockEntity::createBlockEntity)); + public Stream> machine(String name, + BiFunction metaMachine, + int... tiers) { + return Arrays.stream(tiers) + .mapToObj(tier -> MachineBuilder.create(this, name + "." + GTValues.VN[tier].toLowerCase(Locale.ROOT), + MachineDefinition::createDefinition, holder -> metaMachine.apply(holder, tier), + MetaMachineBlock::new, MetaMachineItem::new, MetaMachineBlockEntity::createBlockEntity)); } - public MultiblockMachineBuilder multiblock(String name, Function metaMachine, + public MultiblockMachineBuilder multiblock(String name, + Function metaMachine, BiFunction blockFactory, BiFunction itemFactory, TriFunction, BlockPos, BlockState, IMachineBlockEntity> blockEntityFactory) { - return MultiblockMachineBuilder.createMulti(this, name, metaMachine, blockFactory, itemFactory, blockEntityFactory); + return MultiblockMachineBuilder.createMulti(this, name, metaMachine, blockFactory, itemFactory, + blockEntityFactory); } - public MultiblockMachineBuilder multiblock(String name, Function metaMachine) { - return MultiblockMachineBuilder.createMulti(this, name, metaMachine, MetaMachineBlock::new, MetaMachineItem::new, MetaMachineBlockEntity::createBlockEntity); + public MultiblockMachineBuilder multiblock(String name, + Function metaMachine) { + return MultiblockMachineBuilder.createMulti(this, name, metaMachine, MetaMachineBlock::new, + MetaMachineItem::new, MetaMachineBlockEntity::createBlockEntity); } public SoundEntryBuilder sound(String name) { @@ -144,7 +165,8 @@ public SoundEntryBuilder sound(ResourceLocation name) { } @Override - public @NotNull ItemBuilder item(String name, NonNullFunction factory) { + public @NotNull ItemBuilder item(String name, + NonNullFunction factory) { return super.item(name, factory).lang(FormattingUtil.toEnglishName(name.replaceAll("\\.", "_"))); } @@ -167,7 +189,10 @@ public void setCreativeTab(RegistryEntry entry, @Nullable RegistryEntry RegistryEntry accept(String name, ResourceKey> type, Builder builder, NonNullSupplier creator, NonNullFunction, ? extends RegistryEntry> entryFactory) { + protected RegistryEntry accept(String name, ResourceKey> type, + Builder builder, NonNullSupplier creator, + NonNullFunction, ? extends RegistryEntry> entryFactory) { RegistryEntry entry = super.accept(name, type, builder, creator, entryFactory); if (this.currentTab != null) { @@ -177,7 +202,8 @@ protected RegistryEntry accept(String name, ResourceKey NoConfigBuilder defaultCreativeTab(P parent, String name, Consumer config) { + public

NoConfigBuilder defaultCreativeTab(P parent, String name, + Consumer config) { return createCreativeModeTab(parent, name, config); } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/IGTFluidBuilder.java b/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/IGTFluidBuilder.java index 341e343a19..0746cd5614 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/IGTFluidBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/IGTFluidBuilder.java @@ -1,11 +1,11 @@ package com.gregtechceu.gtceu.api.registry.registrate; - import com.gregtechceu.gtceu.api.fluids.FluidState; -import com.tterrag.registrate.util.entry.FluidEntry; -import com.tterrag.registrate.util.entry.RegistryEntry; + import net.minecraft.world.level.material.Fluid; +import com.tterrag.registrate.util.entry.RegistryEntry; + import java.util.function.Consumer; import java.util.function.Supplier; @@ -15,16 +15,28 @@ * @implNote GTFluidBuilder */ public interface IGTFluidBuilder { + IGTFluidBuilder temperature(int temperature); + IGTFluidBuilder state(FluidState state); + IGTFluidBuilder density(int density); + IGTFluidBuilder luminance(int luminance); + IGTFluidBuilder viscosity(int viscosity); + IGTFluidBuilder burnTime(int burnTime); + IGTFluidBuilder hasBlock(boolean hasBlock); + IGTFluidBuilder hasBucket(boolean hasBucket); + IGTFluidBuilder color(int color); + IGTFluidBuilder onFluidRegister(Consumer fluidConsumer); + Supplier registerFluid(); + RegistryEntry register(); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/MachineBuilder.java b/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/MachineBuilder.java index 060e5cf574..295497afdf 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/MachineBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/MachineBuilder.java @@ -2,42 +2,32 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.GTValues; +import com.gregtechceu.gtceu.api.block.IMachineBlock; import com.gregtechceu.gtceu.api.blockentity.MetaMachineBlockEntity; import com.gregtechceu.gtceu.api.capability.recipe.RecipeCapability; +import com.gregtechceu.gtceu.api.data.RotationState; import com.gregtechceu.gtceu.api.gui.editor.EditableMachineUI; import com.gregtechceu.gtceu.api.item.MetaMachineItem; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; +import com.gregtechceu.gtceu.api.machine.MachineDefinition; import com.gregtechceu.gtceu.api.machine.MetaMachine; import com.gregtechceu.gtceu.api.machine.feature.IRecipeLogicMachine; import com.gregtechceu.gtceu.api.machine.multiblock.PartAbility; import com.gregtechceu.gtceu.api.recipe.GTRecipe; +import com.gregtechceu.gtceu.api.recipe.GTRecipeType; import com.gregtechceu.gtceu.api.recipe.OverclockingLogic; import com.gregtechceu.gtceu.api.recipe.modifier.RecipeModifier; import com.gregtechceu.gtceu.api.recipe.modifier.RecipeModifierList; -import com.gregtechceu.gtceu.client.renderer.machine.*; -import com.gregtechceu.gtceu.api.block.IMachineBlock; -import com.gregtechceu.gtceu.api.data.RotationState; -import com.gregtechceu.gtceu.api.machine.MachineDefinition; -import com.gregtechceu.gtceu.api.recipe.GTRecipeType; import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.client.renderer.GTRendererProvider; +import com.gregtechceu.gtceu.client.renderer.machine.*; import com.gregtechceu.gtceu.common.data.GTCompassSections; import com.gregtechceu.gtceu.common.data.GTRecipeModifiers; import com.gregtechceu.gtceu.config.ConfigHolder; + import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.client.renderer.IRenderer; -import com.tterrag.registrate.Registrate; -import com.tterrag.registrate.builders.BlockBuilder; -import com.tterrag.registrate.builders.ItemBuilder; -import com.tterrag.registrate.providers.ProviderType; -import com.tterrag.registrate.util.nullness.NonNullBiConsumer; -import com.tterrag.registrate.util.nullness.NonNullConsumer; -import com.tterrag.registrate.util.nullness.NonNullUnaryOperator; -import it.unimi.dsi.fastutil.objects.Object2IntMap; -import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; -import lombok.Getter; -import lombok.Setter; -import lombok.experimental.Accessors; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.client.renderer.RenderType; import net.minecraft.core.BlockPos; @@ -53,15 +43,29 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; + +import com.tterrag.registrate.Registrate; +import com.tterrag.registrate.builders.BlockBuilder; +import com.tterrag.registrate.builders.ItemBuilder; +import com.tterrag.registrate.providers.ProviderType; +import com.tterrag.registrate.util.nullness.NonNullBiConsumer; +import com.tterrag.registrate.util.nullness.NonNullConsumer; +import com.tterrag.registrate.util.nullness.NonNullUnaryOperator; +import it.unimi.dsi.fastutil.objects.Object2IntMap; +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.function.TriFunction; - import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; + import java.util.*; import java.util.function.*; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author KilaBash * @date 2023/2/18 @@ -101,38 +105,46 @@ public class MachineBuilder extends Builde @Setter private NonNullConsumer> onBlockEntityRegister = MetaMachineBlockEntity::onBlockEntityRegister; private GTRecipeType[] recipeTypes; - @Getter @Setter // getter for KJS + @Getter + @Setter // getter for KJS private int tier; @Setter private Object2IntMap> recipeOutputLimits = new Object2IntOpenHashMap<>(); @Setter private int paintingColor = Long.decode(ConfigHolder.INSTANCE.client.defaultPaintingColor).intValue(); @Setter - private BiFunction itemColor = ((itemStack, tintIndex) -> tintIndex == 2 ? GTValues.VC[tier] : tintIndex == 1 ? paintingColor : -1); + private BiFunction itemColor = ((itemStack, tintIndex) -> tintIndex == 2 ? + GTValues.VC[tier] : tintIndex == 1 ? paintingColor : -1); private PartAbility[] abilities = new PartAbility[0]; private final List tooltips = new ArrayList<>(); @Setter private BiConsumer> tooltipBuilder; @Setter - private RecipeModifier recipeModifier = GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK); + private RecipeModifier recipeModifier = GTRecipeModifiers.ELECTRIC_OVERCLOCK + .apply(OverclockingLogic.NON_PERFECT_OVERCLOCK); @Setter private boolean alwaysTryModifyRecipe; @NotNull - @Getter @Setter + @Getter + @Setter private BiPredicate beforeWorking = (machine, recipe) -> true; @NotNull - @Getter @Setter + @Getter + @Setter private Predicate onWorking = (machine) -> true; @NotNull - @Getter @Setter + @Getter + @Setter private Consumer onWaiting = (machine) -> {}; @NotNull - @Getter @Setter + @Getter + @Setter private Consumer afterWorking = (machine) -> {}; @Setter private Supplier appearance; - @Setter @Nullable + @Setter + @Nullable private EditableMachineUI editableUI; @Setter private String langValue = null; @@ -166,19 +178,21 @@ public MachineBuilder recipeType(GTRecipeType type) { } public MachineBuilder recipeTypes(GTRecipeType... types) { - for (GTRecipeType type : types){ + for (GTRecipeType type : types) { this.recipeTypes = ArrayUtils.add(this.recipeTypes, type); } return this; } - public static MachineBuilder create(Registrate registrate, String name, - Function definitionFactory, - Function metaMachine, - BiFunction blockFactory, - BiFunction itemFactory, - TriFunction, BlockPos, BlockState, IMachineBlockEntity> blockEntityFactory) { - return new MachineBuilder<>(registrate, name, definitionFactory, metaMachine, blockFactory, itemFactory, blockEntityFactory); + public static < + DEFINITION extends MachineDefinition> MachineBuilder create(Registrate registrate, String name, + Function definitionFactory, + Function metaMachine, + BiFunction blockFactory, + BiFunction itemFactory, + TriFunction, BlockPos, BlockState, IMachineBlockEntity> blockEntityFactory) { + return new MachineBuilder<>(registrate, name, definitionFactory, metaMachine, blockFactory, itemFactory, + blockEntityFactory); } public MachineBuilder modelRenderer(Supplier model) { @@ -191,30 +205,36 @@ public MachineBuilder defaultModelRenderer() { } public MachineBuilder overlayTieredHullRenderer(String name) { - return renderer(() -> new OverlayTieredMachineRenderer(tier, new ResourceLocation(registrate.getModid(), "block/machine/part/" + name))); + return renderer(() -> new OverlayTieredMachineRenderer(tier, + new ResourceLocation(registrate.getModid(), "block/machine/part/" + name))); } public MachineBuilder overlaySteamHullRenderer(String name) { - return renderer(() -> new OverlaySteamMachineRenderer(new ResourceLocation(registrate.getModid(), "block/machine/part/" + name))); + return renderer(() -> new OverlaySteamMachineRenderer( + new ResourceLocation(registrate.getModid(), "block/machine/part/" + name))); } public MachineBuilder workableTieredHullRenderer(ResourceLocation workableModel) { return renderer(() -> new WorkableTieredHullMachineRenderer(tier, workableModel)); } - public MachineBuilder workableSteamHullRenderer(boolean isHighPressure, ResourceLocation workableModel) { + public MachineBuilder workableSteamHullRenderer(boolean isHighPressure, + ResourceLocation workableModel) { return renderer(() -> new WorkableSteamMachineRenderer(isHighPressure, workableModel)); } - public MachineBuilder workableCasingRenderer(ResourceLocation baseCasing, ResourceLocation workableModel) { + public MachineBuilder workableCasingRenderer(ResourceLocation baseCasing, + ResourceLocation workableModel) { return renderer(() -> new WorkableCasingMachineRenderer(baseCasing, workableModel)); } - public MachineBuilder workableCasingRenderer(ResourceLocation baseCasing, ResourceLocation workableModel, boolean tint) { + public MachineBuilder workableCasingRenderer(ResourceLocation baseCasing, + ResourceLocation workableModel, boolean tint) { return renderer(() -> new WorkableCasingMachineRenderer(baseCasing, workableModel, tint)); } - public MachineBuilder sidedWorkableCasingRenderer(String basePath, ResourceLocation overlayModel, boolean tint) { + public MachineBuilder sidedWorkableCasingRenderer(String basePath, ResourceLocation overlayModel, + boolean tint) { return renderer(() -> new WorkableSidedCasingMachineRenderer(basePath, overlayModel, tint)); } @@ -244,7 +264,8 @@ public MachineBuilder recipeModifiers(RecipeModifier... recipeModifi return this.recipeModifier(new RecipeModifierList(recipeModifiers)); } - public MachineBuilder recipeModifiers(boolean alwaysTryModifyRecipe, RecipeModifier... recipeModifiers) { + public MachineBuilder recipeModifiers(boolean alwaysTryModifyRecipe, + RecipeModifier... recipeModifiers) { return this.recipeModifier(new RecipeModifierList(recipeModifiers), alwaysTryModifyRecipe); } @@ -295,21 +316,21 @@ protected DEFINITION createDefinition() { return definitionFactory.apply(new ResourceLocation(registrate.getModid(), name)); } -// @HideFromJS + // @HideFromJS public DEFINITION register() { var definition = createDefinition(); var blockBuilder = registrate.block(name, properties -> { - RotationState.set(rotationState); - var b = blockFactory.apply(properties, definition); - RotationState.clear(); - return b.self(); - }) + RotationState.set(rotationState); + var b = blockFactory.apply(properties, definition); + RotationState.clear(); + return b.self(); + }) .color(() -> () -> IMachineBlock::colorTinted) .initialProperties(() -> Blocks.DISPENSER) .properties(properties -> properties.noLootTable()) .addLayer(() -> RenderType::cutoutMipped) - //.tag(GTToolType.WRENCH.harvestTag) + // .tag(GTToolType.WRENCH.harvestTag) .blockstate(NonNullBiConsumer.noop()) .properties(blockProp) .onRegister(b -> Arrays.stream(abilities).forEach(a -> a.register(tier, b))); @@ -321,7 +342,8 @@ public DEFINITION register() { } var block = blockBuilder.register(); - var itemBuilder = registrate.item(name, properties -> itemFactory.apply((IMachineBlock) block.get(), properties)) + var itemBuilder = registrate + .item(name, properties -> itemFactory.apply((IMachineBlock) block.get(), properties)) .setData(ProviderType.LANG, NonNullBiConsumer.noop()) // do not gen any lang keys .model(NonNullBiConsumer.noop()) .color(() -> () -> itemColor::apply) @@ -346,7 +368,8 @@ public DEFINITION register() { } var item = itemBuilder.register(); - var blockEntityBuilder = registrate.blockEntity(name, (type, pos, state) -> blockEntityFactory.apply(type, pos, state).self()) + var blockEntityBuilder = registrate + .blockEntity(name, (type, pos, state) -> blockEntityFactory.apply(type, pos, state).self()) .onRegister(onBlockEntityRegister) .validBlock(block); if (hasTESR) { @@ -394,5 +417,4 @@ public DEFINITION register() { GTRegistries.MACHINES.register(definition.getId(), definition); return definition; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/MultiblockMachineBuilder.java b/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/MultiblockMachineBuilder.java index 888e2bb8c1..6c8520cee4 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/MultiblockMachineBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/MultiblockMachineBuilder.java @@ -19,16 +19,9 @@ import com.gregtechceu.gtceu.api.recipe.modifier.RecipeModifier; import com.gregtechceu.gtceu.common.data.GTCompassSections; import com.gregtechceu.gtceu.utils.SupplierMemoizer; + import com.lowdragmc.lowdraglib.client.renderer.IRenderer; -import com.tterrag.registrate.Registrate; -import com.tterrag.registrate.builders.BlockBuilder; -import com.tterrag.registrate.builders.ItemBuilder; -import com.tterrag.registrate.util.nullness.NonNullConsumer; -import com.tterrag.registrate.util.nullness.NonNullUnaryOperator; -import it.unimi.dsi.fastutil.objects.Object2IntMap; -import lombok.Getter; -import lombok.Setter; -import lombok.experimental.Accessors; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -43,13 +36,24 @@ import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.shapes.VoxelShape; + +import com.tterrag.registrate.Registrate; +import com.tterrag.registrate.builders.BlockBuilder; +import com.tterrag.registrate.builders.ItemBuilder; +import com.tterrag.registrate.util.nullness.NonNullConsumer; +import com.tterrag.registrate.util.nullness.NonNullUnaryOperator; +import it.unimi.dsi.fastutil.objects.Object2IntMap; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; import org.apache.commons.lang3.function.TriFunction; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.*; import java.util.function.*; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author KilaBash * @date 2023/2/18 @@ -59,6 +63,7 @@ @MethodsReturnNonnullByDefault @Accessors(chain = true, fluent = true) public class MultiblockMachineBuilder extends MachineBuilder { + @Setter private boolean generator; @Setter @@ -73,19 +78,23 @@ public class MultiblockMachineBuilder extends MachineBuilder> additionalDisplay = (m, l) -> {}; - protected MultiblockMachineBuilder(Registrate registrate, String name, Function metaMachine, + protected MultiblockMachineBuilder(Registrate registrate, String name, + Function metaMachine, BiFunction blockFactory, BiFunction itemFactory, TriFunction, BlockPos, BlockState, IMachineBlockEntity> blockEntityFactory) { - super(registrate, name, MultiblockMachineDefinition::createDefinition, metaMachine::apply, blockFactory, itemFactory, blockEntityFactory); + super(registrate, name, MultiblockMachineDefinition::createDefinition, metaMachine::apply, blockFactory, + itemFactory, blockEntityFactory); this.compassSections(GTCompassSections.MULTIBLOCK); } - public static MultiblockMachineBuilder createMulti(Registrate registrate, String name, Function metaMachine, + public static MultiblockMachineBuilder createMulti(Registrate registrate, String name, + Function metaMachine, BiFunction blockFactory, BiFunction itemFactory, TriFunction, BlockPos, BlockState, IMachineBlockEntity> blockEntityFactory) { - return new MultiblockMachineBuilder(registrate, name, metaMachine, blockFactory, itemFactory, blockEntityFactory); + return new MultiblockMachineBuilder(registrate, name, metaMachine, blockFactory, itemFactory, + blockEntityFactory); } public MultiblockMachineBuilder shapeInfo(Function shape) { @@ -99,7 +108,8 @@ public MultiblockMachineBuilder shapeInfos(Function items) { - this.recoveryItems.add(() -> Arrays.stream(items.get()).map(ItemLike::asItem).map(Item::getDefaultInstance).toArray(ItemStack[]::new)); + this.recoveryItems.add(() -> Arrays.stream(items.get()).map(ItemLike::asItem).map(Item::getDefaultInstance) + .toArray(ItemStack[]::new)); return this; } @@ -202,11 +212,13 @@ public MultiblockMachineBuilder workableCasingRenderer(ResourceLocation baseCasi return (MultiblockMachineBuilder) super.workableCasingRenderer(baseCasing, overlayModel); } - public MultiblockMachineBuilder workableCasingRenderer(ResourceLocation baseCasing, ResourceLocation overlayModel, boolean tint) { + public MultiblockMachineBuilder workableCasingRenderer(ResourceLocation baseCasing, ResourceLocation overlayModel, + boolean tint) { return (MultiblockMachineBuilder) super.workableCasingRenderer(baseCasing, overlayModel, tint); } - public MultiblockMachineBuilder sidedWorkableCasingRenderer(String basePath, ResourceLocation overlayModel, boolean tint) { + public MultiblockMachineBuilder sidedWorkableCasingRenderer(String basePath, ResourceLocation overlayModel, + boolean tint) { return (MultiblockMachineBuilder) super.sidedWorkableCasingRenderer(basePath, overlayModel, tint); } @@ -352,9 +364,11 @@ public MultiblockMachineDefinition register() { throw new IllegalStateException("missing pattern while creating multiblock " + name); } definition.setPatternFactory(SupplierMemoizer.memoize(() -> pattern.apply(definition))); - definition.setShapes(() -> shapeInfos.stream().map(factory -> factory.apply(definition)).flatMap(Collection::stream).toList()); + definition.setShapes(() -> shapeInfos.stream().map(factory -> factory.apply(definition)) + .flatMap(Collection::stream).toList()); if (!recoveryItems.isEmpty()) { - definition.setRecoveryItems(() -> recoveryItems.stream().map(Supplier::get).flatMap(Arrays::stream).toArray(ItemStack[]::new)); + definition.setRecoveryItems( + () -> recoveryItems.stream().map(Supplier::get).flatMap(Arrays::stream).toArray(ItemStack[]::new)); } definition.setPartSorter(partSorter); if (partAppearance == null) { diff --git a/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/SoundEntryBuilder.java b/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/SoundEntryBuilder.java index 511c512a2b..7a7f82f4bb 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/SoundEntryBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/SoundEntryBuilder.java @@ -1,12 +1,12 @@ package com.gregtechceu.gtceu.api.registry.registrate; -import com.google.gson.JsonObject; import com.gregtechceu.gtceu.GTCEu; -import com.gregtechceu.gtceu.api.sound.CustomSoundEntry; -import com.gregtechceu.gtceu.api.sound.SoundEntry; import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.api.sound.ConfiguredSoundEvent; +import com.gregtechceu.gtceu.api.sound.CustomSoundEntry; +import com.gregtechceu.gtceu.api.sound.SoundEntry; import com.gregtechceu.gtceu.api.sound.WrappedSoundEntry; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.data.CachedOutput; import net.minecraft.data.DataProvider; @@ -15,12 +15,15 @@ import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundSource; -import javax.annotation.ParametersAreNonnullByDefault; +import com.google.gson.JsonObject; + import java.nio.file.Path; import java.util.*; import java.util.concurrent.CompletableFuture; import java.util.function.Supplier; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author KilaBash * @date 2023/3/3 @@ -31,6 +34,7 @@ public class SoundEntryBuilder { public static class SoundEntryProvider implements DataProvider { + private final PackOutput output; private final String modId; @@ -55,11 +59,9 @@ public CompletableFuture generate(Path path, CachedOutput cache) { for (SoundEntry sound : GTRegistries.SOUNDS) { if (sound.getId().getNamespace().equals(modId)) sound.write(json); } - } catch (Exception ignored) { - } + } catch (Exception ignored) {} return DataProvider.saveStable(cache, json, path.resolve("sounds.json")); } - } protected ResourceLocation id; @@ -118,11 +120,10 @@ public SoundEntryBuilder playExisting(SoundEvent event) { } public SoundEntry build() { - SoundEntry entry = - wrappedEvents.isEmpty() ? new CustomSoundEntry(id, variants, subtitle, category, attenuationDistance) - : new WrappedSoundEntry(id, subtitle, wrappedEvents, category, attenuationDistance); + SoundEntry entry = wrappedEvents.isEmpty() ? + new CustomSoundEntry(id, variants, subtitle, category, attenuationDistance) : + new WrappedSoundEntry(id, subtitle, wrappedEvents, category, attenuationDistance); GTRegistries.SOUNDS.register(entry.getId(), entry); return entry; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/forge/GTClientFluidTypeExtensions.java b/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/forge/GTClientFluidTypeExtensions.java index 1ee7e96a1a..d5ea0efd44 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/forge/GTClientFluidTypeExtensions.java +++ b/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/forge/GTClientFluidTypeExtensions.java @@ -1,13 +1,16 @@ package com.gregtechceu.gtceu.api.registry.registrate.forge; import com.gregtechceu.gtceu.GTCEu; -import lombok.Getter; -import lombok.Setter; + import net.minecraft.client.Minecraft; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions; +import lombok.Getter; +import lombok.Setter; + public class GTClientFluidTypeExtensions implements IClientFluidTypeExtensions { + public static final ResourceLocation FLUID_SCREEN_OVERLAY = GTCEu.id("textures/misc/fluid_screen_overlay.png"); public GTClientFluidTypeExtensions(ResourceLocation stillTexture, ResourceLocation flowingTexture, int tintColor) { @@ -16,9 +19,11 @@ public GTClientFluidTypeExtensions(ResourceLocation stillTexture, ResourceLocati this.tintColor = tintColor; } - @Getter @Setter + @Getter + @Setter private ResourceLocation flowingTexture, stillTexture; - @Getter @Setter + @Getter + @Setter private int tintColor; @Override diff --git a/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/forge/GTFluidBuilder.java b/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/forge/GTFluidBuilder.java index 4dae519f95..87fd10049b 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/forge/GTFluidBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/forge/GTFluidBuilder.java @@ -1,21 +1,12 @@ package com.gregtechceu.gtceu.api.registry.registrate.forge; -import com.google.common.base.Preconditions; import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.api.fluids.FluidState; import com.gregtechceu.gtceu.api.fluids.GTFluid; import com.gregtechceu.gtceu.api.fluids.forge.GTFluidImpl; import com.gregtechceu.gtceu.api.item.forge.GTBucketItem; import com.gregtechceu.gtceu.api.registry.registrate.IGTFluidBuilder; -import com.tterrag.registrate.AbstractRegistrate; -import com.tterrag.registrate.builders.*; -import com.tterrag.registrate.providers.ProviderType; -import com.tterrag.registrate.providers.RegistrateTagsProvider; -import com.tterrag.registrate.util.OneTimeEventReceiver; -import com.tterrag.registrate.util.entry.RegistryEntry; -import com.tterrag.registrate.util.nullness.*; -import lombok.Setter; -import lombok.experimental.Accessors; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.client.renderer.ItemBlockRenderTypes; import net.minecraft.client.renderer.RenderType; @@ -35,19 +26,30 @@ import net.minecraftforge.common.SoundActions; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidType; -import net.minecraftforge.fluids.ForgeFlowingFluid; import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.registries.ForgeRegistries; +import com.google.common.base.Preconditions; +import com.tterrag.registrate.AbstractRegistrate; +import com.tterrag.registrate.builders.*; +import com.tterrag.registrate.providers.ProviderType; +import com.tterrag.registrate.providers.RegistrateTagsProvider; +import com.tterrag.registrate.util.OneTimeEventReceiver; +import com.tterrag.registrate.util.entry.RegistryEntry; +import com.tterrag.registrate.util.nullness.*; +import lombok.Setter; +import lombok.experimental.Accessors; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; + import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.function.Consumer; import java.util.function.Supplier; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author KilaBash * @date 2023/2/14 @@ -56,7 +58,9 @@ @Accessors(chain = true, fluent = true) @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault -public class GTFluidBuilder

extends AbstractBuilder> implements IGTFluidBuilder { +public class GTFluidBuilder

extends AbstractBuilder> + implements IGTFluidBuilder { + @Setter public int temperature = 300; @Setter @@ -74,7 +78,9 @@ public class GTFluidBuilder

extends AbstractBuilder bucket; private final List> tags = new ArrayList<>(); - public GTFluidBuilder(AbstractRegistrate owner, P parent, Material material, String name, String langKey, BuilderCallback callback, ResourceLocation stillTexture, ResourceLocation flowingTexture, GTFluidBuilder.FluidTypeFactory typeFactory) { + public GTFluidBuilder(AbstractRegistrate owner, P parent, Material material, String name, String langKey, + BuilderCallback callback, ResourceLocation stillTexture, ResourceLocation flowingTexture, + GTFluidBuilder.FluidTypeFactory typeFactory) { super(owner, parent, "flowing_" + name, callback, ForgeRegistries.Keys.FLUIDS); this.sourceName = name; this.bucketName = name + "_bucket"; @@ -111,7 +119,8 @@ public GTFluidBuilder(AbstractRegistrate owner, P parent, Material material, this.langKey = langKey; this.stillTexture = stillTexture; this.flowingTexture = flowingTexture; - this.fluidType = NonNullSupplier.lazy(() -> typeFactory.create(langKey, material, makeTypeProperties(), this.stillTexture, this.flowingTexture, this.color)); + this.fluidType = NonNullSupplier.lazy(() -> typeFactory.create(langKey, material, makeTypeProperties(), + this.stillTexture, this.flowingTexture, this.color)); this.registerType = true; defaultBucket(); } @@ -127,7 +136,8 @@ public GTFluidBuilder

lang(String name) { @SuppressWarnings("deprecation") public GTFluidBuilder

renderType(Supplier layer) { DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> { - Preconditions.checkArgument(RenderType.chunkBufferLayers().contains(layer.get()), "Invalid render type: " + layer); + Preconditions.checkArgument(RenderType.chunkBufferLayers().contains(layer.get()), + "Invalid render type: " + layer); }); if (this.layer == null) { @@ -232,8 +242,10 @@ public ItemBuilder> bucket() { public final GTFluidBuilder

tag(TagKey... tags) { GTFluidBuilder

ret = this.tag(ProviderType.FLUID_TAGS, tags); if (this.tags.isEmpty()) { - ret.getOwner()., Fluid>setDataGenerator(ret.sourceName, getRegistryKey(), ProviderType.FLUID_TAGS, - prov -> this.tags.stream().map(prov::addTag).forEach(p -> p.add(getSource().builtInRegistryHolder().key()))); + ret.getOwner()., Fluid>setDataGenerator(ret.sourceName, getRegistryKey(), + ProviderType.FLUID_TAGS, + prov -> this.tags.stream().map(prov::addTag) + .forEach(p -> p.add(getSource().builtInRegistryHolder().key()))); } this.tags.addAll(Arrays.asList(tags)); return ret; @@ -264,12 +276,15 @@ private FluidType.Properties makeTypeProperties() { setData(ProviderType.LANG, NonNullBiConsumer.noop()); return properties.sound(SoundActions.BUCKET_FILL, SoundEvents.BUCKET_FILL) - .sound(SoundActions.BUCKET_EMPTY, SoundEvents.BUCKET_EMPTY).temperature(temperature).density(density).viscosity(viscosity).lightLevel(luminance); + .sound(SoundActions.BUCKET_EMPTY, SoundEvents.BUCKET_EMPTY).temperature(temperature).density(density) + .viscosity(viscosity).lightLevel(luminance); } @Override protected GTFluidImpl.Flowing createEntry() { - return new GTFluidImpl.Flowing(this.state, () -> this.source.get(), () -> this.get().get(), (() -> this.block != null ? this.block.get() : null), (() -> this.bucket != null ? this.bucket.get() : null), this.burnTime, this.fluidType); + return new GTFluidImpl.Flowing(this.state, () -> this.source.get(), () -> this.get().get(), + (() -> this.block != null ? this.block.get() : null), + (() -> this.bucket != null ? this.bucket.get() : null), this.burnTime, this.fluidType); } @Override @@ -313,7 +328,9 @@ public RegistryEntry register() { } if (defaultSource == Boolean.TRUE) { - source(() -> new GTFluidImpl.Source(this.state, () -> this.source.get(), () -> this.get().get(), (() -> this.block != null ? this.block.get() : null), (() -> this.bucket != null ? this.bucket.get() : null), this.burnTime, this.fluidType)); + source(() -> new GTFluidImpl.Source(this.state, () -> this.source.get(), () -> this.get().get(), + (() -> this.block != null ? this.block.get() : null), + (() -> this.bucket != null ? this.bucket.get() : null), this.burnTime, this.fluidType)); } if (defaultBlock == Boolean.TRUE) { block().register(); @@ -338,8 +355,11 @@ public Supplier registerFluid() { return this.source; } - public static FluidType defaultFluidType(String langKey, Material material, FluidType.Properties properties, ResourceLocation stillTexture, ResourceLocation flowingTexture, int color) { + public static FluidType defaultFluidType(String langKey, Material material, FluidType.Properties properties, + ResourceLocation stillTexture, ResourceLocation flowingTexture, + int color) { return new FluidType(properties) { + @Override public void initializeClient(Consumer consumer) { consumer.accept(new GTClientFluidTypeExtensions(stillTexture, flowingTexture, color)); diff --git a/src/main/java/com/gregtechceu/gtceu/api/sound/AutoReleasedSound.java b/src/main/java/com/gregtechceu/gtceu/api/sound/AutoReleasedSound.java index e8063dad21..e736953be2 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/sound/AutoReleasedSound.java +++ b/src/main/java/com/gregtechceu/gtceu/api/sound/AutoReleasedSound.java @@ -15,10 +15,12 @@ */ @OnlyIn(Dist.CLIENT) public class AutoReleasedSound extends AbstractTickableSoundInstance { + public final BooleanSupplier predicate; public final SoundEntry soundEntry; - protected AutoReleasedSound(SoundEntry soundEntry, BooleanSupplier predicate, BlockPos pos, boolean loop, int delay, float volume, float pitch) { + protected AutoReleasedSound(SoundEntry soundEntry, BooleanSupplier predicate, BlockPos pos, boolean loop, int delay, + float volume, float pitch) { super(soundEntry.getMainEvent(), soundEntry.category, Minecraft.getInstance().level.random); this.soundEntry = soundEntry; this.predicate = predicate; @@ -42,5 +44,4 @@ public void tick() { public void release() { stop(); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/sound/ConfiguredSoundEvent.java b/src/main/java/com/gregtechceu/gtceu/api/sound/ConfiguredSoundEvent.java index 6c20c2b0d8..3fd3f41feb 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/sound/ConfiguredSoundEvent.java +++ b/src/main/java/com/gregtechceu/gtceu/api/sound/ConfiguredSoundEvent.java @@ -9,5 +9,4 @@ * @date 2023/3/3 * @implNote ConfiguredSoundEvent */ -public record ConfiguredSoundEvent(Supplier event, float volume, float pitch) { -} +public record ConfiguredSoundEvent(Supplier event, float volume, float pitch) {} diff --git a/src/main/java/com/gregtechceu/gtceu/api/sound/CustomSoundEntry.java b/src/main/java/com/gregtechceu/gtceu/api/sound/CustomSoundEntry.java index cd0bfc5ae1..4ba6dd6abb 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/sound/CustomSoundEntry.java +++ b/src/main/java/com/gregtechceu/gtceu/api/sound/CustomSoundEntry.java @@ -1,13 +1,14 @@ package com.gregtechceu.gtceu.api.sound; -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; import net.minecraft.resources.ResourceLocation; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundSource; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; + import java.util.List; import java.util.function.Consumer; @@ -17,6 +18,7 @@ * @implNote CustomSoundEntry */ public class CustomSoundEntry extends SoundEntry { + protected List variants; protected SoundEvent event; @@ -77,5 +79,4 @@ public void play(Level world, Player entity, double x, double y, double z, float public void playAt(Level world, double x, double y, double z, float volume, float pitch, boolean fade) { world.playLocalSound(x, y, z, event, category, volume, pitch, fade); } - -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/sound/ExistingSoundEntry.java b/src/main/java/com/gregtechceu/gtceu/api/sound/ExistingSoundEntry.java index 9ae25a6bfb..11f57621b5 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/sound/ExistingSoundEntry.java +++ b/src/main/java/com/gregtechceu/gtceu/api/sound/ExistingSoundEntry.java @@ -1,12 +1,13 @@ package com.gregtechceu.gtceu.api.sound; -import com.google.gson.JsonObject; import net.minecraft.resources.ResourceLocation; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundSource; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; +import com.google.gson.JsonObject; + import java.util.List; import java.util.function.Consumer; @@ -16,6 +17,7 @@ * @implNote CustomSoundEntry */ public class ExistingSoundEntry extends SoundEntry { + protected List variants; protected SoundEvent event; @@ -53,5 +55,4 @@ public void play(Level world, Player entity, double x, double y, double z, float public void playAt(Level world, double x, double y, double z, float volume, float pitch, boolean fade) { world.playLocalSound(x, y, z, event, category, volume, pitch, fade); } - -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/sound/SoundEntry.java b/src/main/java/com/gregtechceu/gtceu/api/sound/SoundEntry.java index ec7620ab5c..0a0bf968a1 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/sound/SoundEntry.java +++ b/src/main/java/com/gregtechceu/gtceu/api/sound/SoundEntry.java @@ -1,6 +1,5 @@ package com.gregtechceu.gtceu.api.sound; -import com.google.gson.JsonObject; import net.minecraft.client.Minecraft; import net.minecraft.core.BlockPos; import net.minecraft.core.Vec3i; @@ -14,6 +13,8 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; +import com.google.gson.JsonObject; + import java.util.function.BooleanSupplier; import java.util.function.Consumer; @@ -102,10 +103,10 @@ public void playAt(Level world, Vec3 pos, float volume, float pitch, boolean fad public abstract void playAt(Level world, double x, double y, double z, float volume, float pitch, boolean fade); @OnlyIn(Dist.CLIENT) - public AutoReleasedSound playAutoReleasedSound(BooleanSupplier predicate, BlockPos pos, boolean loop, int delay, float volume, float pitch) { + public AutoReleasedSound playAutoReleasedSound(BooleanSupplier predicate, BlockPos pos, boolean loop, int delay, + float volume, float pitch) { var sound = new AutoReleasedSound(this, predicate, pos, loop, delay, volume, pitch); Minecraft.getInstance().getSoundManager().play(sound); return sound; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/api/sound/WrappedSoundEntry.java b/src/main/java/com/gregtechceu/gtceu/api/sound/WrappedSoundEntry.java index 37074211a2..aec7f708c9 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/sound/WrappedSoundEntry.java +++ b/src/main/java/com/gregtechceu/gtceu/api/sound/WrappedSoundEntry.java @@ -1,13 +1,14 @@ package com.gregtechceu.gtceu.api.sound; -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; import net.minecraft.resources.ResourceLocation; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundSource; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; + import java.util.ArrayList; import java.util.List; import java.util.function.Consumer; @@ -34,7 +35,8 @@ public void prepare() { for (int i = 0; i < wrappedEvents.size(); i++) { ConfiguredSoundEvent wrapped = wrappedEvents.get(i); ResourceLocation location = getIdOf(i); - compiledEvents.add(new WrappedSoundEntry.CompiledSoundEvent(SoundEvent.createVariableRangeEvent(location), wrapped.volume(), wrapped.pitch())); + compiledEvents.add(new WrappedSoundEntry.CompiledSoundEvent(SoundEvent.createVariableRangeEvent(location), + wrapped.volume(), wrapped.pitch())); } } @@ -92,7 +94,5 @@ public void playAt(Level world, double x, double y, double z, float volume, floa } } - private record CompiledSoundEvent(SoundEvent event, float volume, float pitch) { - } - + private record CompiledSoundEvent(SoundEvent event, float volume, float pitch) {} } diff --git a/src/main/java/com/gregtechceu/gtceu/api/transfer/fluid/FluidTransferDelegate.java b/src/main/java/com/gregtechceu/gtceu/api/transfer/fluid/FluidTransferDelegate.java index a45d0e1dd5..6e23f8461b 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/transfer/fluid/FluidTransferDelegate.java +++ b/src/main/java/com/gregtechceu/gtceu/api/transfer/fluid/FluidTransferDelegate.java @@ -2,17 +2,18 @@ import com.lowdragmc.lowdraglib.side.fluid.FluidStack; import com.lowdragmc.lowdraglib.side.fluid.IFluidTransfer; + import net.minecraft.MethodsReturnNonnullByDefault; + import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.NotNull; import javax.annotation.ParametersAreNonnullByDefault; - @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault public abstract class FluidTransferDelegate implements IFluidTransfer { + public IFluidTransfer delegate; public FluidTransferDelegate(IFluidTransfer delegate) { @@ -23,12 +24,10 @@ protected void setDelegate(IFluidTransfer delegate) { this.delegate = delegate; } - ////////////////////////////////////// - //****** OVERRIDE THESE ******// + // ****** OVERRIDE THESE ******// ////////////////////////////////////// - @Override public int getTanks() { return delegate.getTanks(); diff --git a/src/main/java/com/gregtechceu/gtceu/api/transfer/fluid/InfiniteFluidTransferProxy.java b/src/main/java/com/gregtechceu/gtceu/api/transfer/fluid/InfiniteFluidTransferProxy.java index 7914194967..f8bb48a326 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/transfer/fluid/InfiniteFluidTransferProxy.java +++ b/src/main/java/com/gregtechceu/gtceu/api/transfer/fluid/InfiniteFluidTransferProxy.java @@ -2,7 +2,9 @@ import com.lowdragmc.lowdraglib.side.fluid.FluidStack; import com.lowdragmc.lowdraglib.side.fluid.IFluidTransfer; + import net.minecraft.MethodsReturnNonnullByDefault; + import org.jetbrains.annotations.NotNull; import javax.annotation.ParametersAreNonnullByDefault; @@ -10,6 +12,7 @@ @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault public class InfiniteFluidTransferProxy extends FluidTransferDelegate { + private final boolean infiniteSource; private final boolean infiniteSink; diff --git a/src/main/java/com/gregtechceu/gtceu/api/transfer/fluid/NoOpFluidTransfer.java b/src/main/java/com/gregtechceu/gtceu/api/transfer/fluid/NoOpFluidTransfer.java index 6102f0f06b..877b10966b 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/transfer/fluid/NoOpFluidTransfer.java +++ b/src/main/java/com/gregtechceu/gtceu/api/transfer/fluid/NoOpFluidTransfer.java @@ -2,19 +2,20 @@ import com.lowdragmc.lowdraglib.side.fluid.FluidStack; import com.lowdragmc.lowdraglib.side.fluid.IFluidTransfer; + import net.minecraft.MethodsReturnNonnullByDefault; + import org.jetbrains.annotations.NotNull; import javax.annotation.ParametersAreNonnullByDefault; - @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault public class NoOpFluidTransfer implements IFluidTransfer { + public static final NoOpFluidTransfer INSTANCE = new NoOpFluidTransfer(); - private NoOpFluidTransfer() { - } + private NoOpFluidTransfer() {} @Override public int getTanks() { @@ -28,8 +29,7 @@ public FluidStack getFluidInTank(int tank) { } @Override - public void setFluidInTank(int tank, @NotNull FluidStack fluidStack) { - } + public void setFluidInTank(int tank, @NotNull FluidStack fluidStack) {} @Override public long getTankCapacity(int tank) { @@ -69,7 +69,5 @@ public Object createSnapshot() { } @Override - public void restoreFromSnapshot(Object snapshot) { - - } + public void restoreFromSnapshot(Object snapshot) {} } diff --git a/src/main/java/com/gregtechceu/gtceu/api/transfer/item/InfiniteItemTransferProxy.java b/src/main/java/com/gregtechceu/gtceu/api/transfer/item/InfiniteItemTransferProxy.java index b02a9a492c..7432bef2dc 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/transfer/item/InfiniteItemTransferProxy.java +++ b/src/main/java/com/gregtechceu/gtceu/api/transfer/item/InfiniteItemTransferProxy.java @@ -1,8 +1,10 @@ package com.gregtechceu.gtceu.api.transfer.item; import com.lowdragmc.lowdraglib.side.item.IItemTransfer; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.world.item.ItemStack; + import org.jetbrains.annotations.NotNull; import javax.annotation.ParametersAreNonnullByDefault; @@ -10,6 +12,7 @@ @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault public class InfiniteItemTransferProxy extends ItemTransferDelegate { + private final boolean infiniteSource; private final boolean infiniteSink; diff --git a/src/main/java/com/gregtechceu/gtceu/api/transfer/item/ItemTransferDelegate.java b/src/main/java/com/gregtechceu/gtceu/api/transfer/item/ItemTransferDelegate.java index 8766030172..1f3e3eb6b4 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/transfer/item/ItemTransferDelegate.java +++ b/src/main/java/com/gregtechceu/gtceu/api/transfer/item/ItemTransferDelegate.java @@ -1,18 +1,19 @@ package com.gregtechceu.gtceu.api.transfer.item; import com.lowdragmc.lowdraglib.side.item.IItemTransfer; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.world.item.ItemStack; + import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.NotNull; import javax.annotation.ParametersAreNonnullByDefault; - @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault public abstract class ItemTransferDelegate implements IItemTransfer { + public IItemTransfer delegate; public ItemTransferDelegate(IItemTransfer delegate) { @@ -23,9 +24,8 @@ protected void setDelegate(IItemTransfer delegate) { this.delegate = delegate; } - ////////////////////////////////////// - //****** OVERRIDE THESE ******// + // ****** OVERRIDE THESE ******// ////////////////////////////////////// @Override @@ -74,7 +74,6 @@ public void restoreFromSnapshot(Object snapshot) { delegate.restoreFromSnapshot(snapshot); } - @Override public void onContentsChanged() { delegate.onContentsChanged(); diff --git a/src/main/java/com/gregtechceu/gtceu/api/transfer/item/NoOpItemTransfer.java b/src/main/java/com/gregtechceu/gtceu/api/transfer/item/NoOpItemTransfer.java index 26b4c3f0a2..774e3c2442 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/transfer/item/NoOpItemTransfer.java +++ b/src/main/java/com/gregtechceu/gtceu/api/transfer/item/NoOpItemTransfer.java @@ -1,20 +1,21 @@ package com.gregtechceu.gtceu.api.transfer.item; import com.lowdragmc.lowdraglib.side.item.IItemTransfer; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.world.item.ItemStack; + import org.jetbrains.annotations.NotNull; import javax.annotation.ParametersAreNonnullByDefault; - @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault public class NoOpItemTransfer implements IItemTransfer { + public static final NoOpItemTransfer INSTANCE = new NoOpItemTransfer(); - private NoOpItemTransfer() { - } + private NoOpItemTransfer() {} @Override public int getSlots() { @@ -56,7 +57,5 @@ public Object createSnapshot() { } @Override - public void restoreFromSnapshot(Object snapshot) { - - } + public void restoreFromSnapshot(Object snapshot) {} } diff --git a/src/main/java/com/gregtechceu/gtceu/client/ClientCommands.java b/src/main/java/com/gregtechceu/gtceu/client/ClientCommands.java deleted file mode 100644 index 673d634807..0000000000 --- a/src/main/java/com/gregtechceu/gtceu/client/ClientCommands.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.gregtechceu.gtceu.client; - -import com.mojang.brigadier.builder.LiteralArgumentBuilder; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; - -import java.util.List; - -/** - * @author KilaBash - * @date 2023/2/9 - * @implNote ClientCommands - */ -@OnlyIn(Dist.CLIENT) -public class ClientCommands { - - public static LiteralArgumentBuilder createLiteral(String command) { - return com.lowdragmc.lowdraglib.client.ClientCommands.createLiteral(command); - } - - @SuppressWarnings("unchecked") - public static List> createClientCommands() { - return List.of( - - ); - } -} diff --git a/src/main/java/com/gregtechceu/gtceu/client/ClientProxy.java b/src/main/java/com/gregtechceu/gtceu/client/ClientProxy.java index ed2412fe06..4afa7ebf6c 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/ClientProxy.java +++ b/src/main/java/com/gregtechceu/gtceu/client/ClientProxy.java @@ -9,8 +9,10 @@ import com.gregtechceu.gtceu.common.data.GTBlockEntities; import com.gregtechceu.gtceu.common.data.GTEntityTypes; import com.gregtechceu.gtceu.utils.input.KeyBind; + import com.lowdragmc.lowdraglib.gui.compass.CompassManager; import com.lowdragmc.lowdraglib.gui.compass.component.RecipeComponent; + import net.minecraft.client.renderer.blockentity.HangingSignRenderer; import net.minecraft.client.renderer.blockentity.SignRenderer; import net.minecraft.client.renderer.entity.ThrownItemRenderer; @@ -28,6 +30,7 @@ */ @OnlyIn(Dist.CLIENT) public class ClientProxy extends CommonProxy { + public ClientProxy() { super(); init(); diff --git a/src/main/java/com/gregtechceu/gtceu/client/HudGuiOverlay.java b/src/main/java/com/gregtechceu/gtceu/client/HudGuiOverlay.java index 1e3ddf2c30..489aff1cec 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/HudGuiOverlay.java +++ b/src/main/java/com/gregtechceu/gtceu/client/HudGuiOverlay.java @@ -4,7 +4,7 @@ import com.gregtechceu.gtceu.api.item.armor.ArmorComponentItem; import com.gregtechceu.gtceu.api.item.component.IItemComponent; import com.gregtechceu.gtceu.api.item.component.IItemHUDProvider; -import lombok.NoArgsConstructor; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.world.InteractionHand; @@ -12,12 +12,16 @@ import net.minecraft.world.item.ItemStack; import net.minecraftforge.client.gui.overlay.ForgeGui; import net.minecraftforge.client.gui.overlay.IGuiOverlay; + +import lombok.NoArgsConstructor; import org.jetbrains.annotations.NotNull; @NoArgsConstructor public class HudGuiOverlay implements IGuiOverlay { + @Override - public void render(ForgeGui forgeGui, GuiGraphics guiGraphics, float partialTick, int screenWidth, int screenHeight) { + public void render(ForgeGui forgeGui, GuiGraphics guiGraphics, float partialTick, int screenWidth, + int screenHeight) { Minecraft mc = Minecraft.getInstance(); if (mc.isWindowActive() && mc.level != null && !mc.options.renderDebug && !mc.options.hideGui) { renderHUDMetaArmor(mc.player.getItemBySlot(EquipmentSlot.HEAD), guiGraphics); @@ -46,5 +50,4 @@ private static void renderHUDMetaItem(@NotNull ItemStack stack, GuiGraphics guiG } } } - } diff --git a/src/main/java/com/gregtechceu/gtceu/client/TooltipHelper.java b/src/main/java/com/gregtechceu/gtceu/client/TooltipHelper.java index 2c696eeb29..dd8d2b9447 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/TooltipHelper.java +++ b/src/main/java/com/gregtechceu/gtceu/client/TooltipHelper.java @@ -2,6 +2,7 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.GTValues; + import net.minecraft.ChatFormatting; import java.util.ArrayList; @@ -34,7 +35,6 @@ public class TooltipHelper { /** Switches between GRAY and DARK_GRAY, changing every 25 ticks */ public static final GTFormattingCode BLINKING_GRAY = createNewCode(25, GRAY, DARK_GRAY); - /** * Creates a Formatting Code which can oscillate through a number of different formatting codes at a specified rate. * @@ -47,7 +47,8 @@ public static GTFormattingCode createNewCode(int rate, ChatFormatting... codes) return null; } if (codes == null || codes.length <= 1) { - GTCEu.LOGGER.error("Could not create GT Formatting Code with codes {}, must have length greater than one!", Arrays.toString(codes)); + GTCEu.LOGGER.error("Could not create GT Formatting Code with codes {}, must have length greater than one!", + Arrays.toString(codes)); return null; } GTFormattingCode code = new GTFormattingCode(rate, codes); diff --git a/src/main/java/com/gregtechceu/gtceu/client/TooltipsHandler.java b/src/main/java/com/gregtechceu/gtceu/client/TooltipsHandler.java index fcf83364cb..53994f82be 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/TooltipsHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/client/TooltipsHandler.java @@ -1,9 +1,9 @@ package com.gregtechceu.gtceu.client; import com.gregtechceu.gtceu.GTCEu; -import com.gregtechceu.gtceu.api.capability.GTCapabilityHelper; import com.gregtechceu.gtceu.api.data.chemical.ChemicalHelper; import com.gregtechceu.gtceu.data.lang.LangHandler; + import net.minecraft.ChatFormatting; import net.minecraft.client.resources.language.I18n; import net.minecraft.network.chat.Component; @@ -30,20 +30,23 @@ public class TooltipsHandler { public static void appendTooltips(ItemStack stack, TooltipFlag flag, List tooltips) { // Energy Item /* - var energyItem = GTCapabilityHelper.getElectricItem(stack); - if (energyItem != null) { - tooltips.add(1, Component.translatable("metaitem.generic.electric_item.stored", - energyItem.getCharge(), - energyItem.getMaxCharge(), - Component.literal(String.format("%.2f%%", energyItem.getCharge() * 100f / energyItem.getMaxCharge())).withStyle(ChatFormatting.GREEN))); - } - */ + * var energyItem = GTCapabilityHelper.getElectricItem(stack); + * if (energyItem != null) { + * tooltips.add(1, Component.translatable("metaitem.generic.electric_item.stored", + * energyItem.getCharge(), + * energyItem.getMaxCharge(), + * Component.literal(String.format("%.2f%%", energyItem.getCharge() * 100f / + * energyItem.getMaxCharge())).withStyle(ChatFormatting.GREEN))); + * } + */ // Formula var unificationEntry = ChemicalHelper.getUnificationEntry(stack.getItem()); if (unificationEntry != null && unificationEntry.material != null) { - if (unificationEntry.material.getChemicalFormula() != null && !unificationEntry.material.getChemicalFormula().isEmpty()) - tooltips.add(1, Component.literal(unificationEntry.material.getChemicalFormula()).withStyle(ChatFormatting.YELLOW)); + if (unificationEntry.material.getChemicalFormula() != null && + !unificationEntry.material.getChemicalFormula().isEmpty()) + tooltips.add(1, Component.literal(unificationEntry.material.getChemicalFormula()) + .withStyle(ChatFormatting.YELLOW)); } // Block/Item custom tooltips diff --git a/src/main/java/com/gregtechceu/gtceu/client/forge/ForgeClientEventListener.java b/src/main/java/com/gregtechceu/gtceu/client/forge/ForgeClientEventListener.java index 88d50fa2b9..5a41a64e5f 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/forge/ForgeClientEventListener.java +++ b/src/main/java/com/gregtechceu/gtceu/client/forge/ForgeClientEventListener.java @@ -2,16 +2,11 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.GTValues; -import com.gregtechceu.gtceu.client.ClientCommands; import com.gregtechceu.gtceu.client.TooltipHelper; import com.gregtechceu.gtceu.client.TooltipsHandler; import com.gregtechceu.gtceu.client.renderer.BlockHighLightRenderer; import com.gregtechceu.gtceu.client.renderer.MultiblockInWorldPreviewRenderer; -import com.gregtechceu.gtceu.client.renderer.entity.GTExplosiveRenderer; -import com.gregtechceu.gtceu.common.data.GTEntityTypes; -import com.mojang.brigadier.builder.LiteralArgumentBuilder; -import net.minecraft.client.renderer.entity.ThrownItemRenderer; -import net.minecraft.commands.CommandSourceStack; + import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.client.event.*; @@ -20,8 +15,6 @@ import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; -import java.util.List; - /** * @author KilaBash * @date 2022/8/27 @@ -34,14 +27,17 @@ public class ForgeClientEventListener { @SubscribeEvent public static void onRenderLevelStageEvent(RenderLevelStageEvent event) { if (event.getStage() == RenderLevelStageEvent.Stage.AFTER_BLOCK_ENTITIES) { - // to render the preview after block entities, before the translucent. so it can be seen through the transparent blocks. - MultiblockInWorldPreviewRenderer.renderInWorldPreview(event.getPoseStack(), event.getCamera(), event.getPartialTick()); + // to render the preview after block entities, before the translucent. so it can be seen through the + // transparent blocks. + MultiblockInWorldPreviewRenderer.renderInWorldPreview(event.getPoseStack(), event.getCamera(), + event.getPartialTick()); } } @SubscribeEvent public static void onBlockHighlightEvent(RenderHighlightEvent.Block event) { - BlockHighLightRenderer.renderBlockHighLight(event.getPoseStack(), event.getCamera(), event.getTarget(), event.getMultiBufferSource(), event.getPartialTick()); + BlockHighLightRenderer.renderBlockHighLight(event.getPoseStack(), event.getCamera(), event.getTarget(), + event.getMultiBufferSource(), event.getPartialTick()); } @SubscribeEvent @@ -49,13 +45,6 @@ public static void onTooltipEvent(ItemTooltipEvent event) { TooltipsHandler.appendTooltips(event.getItemStack(), event.getFlags(), event.getToolTip()); } - @SubscribeEvent - public static void onRegisterClientCommands(RegisterClientCommandsEvent event) { - var dispatcher = event.getDispatcher(); - List> commands = ClientCommands.createClientCommands(); - commands.forEach(dispatcher::register); - } - @SubscribeEvent public static void onClientTickEvent(TickEvent.ClientTickEvent event) { if (event.phase == TickEvent.Phase.END) { diff --git a/src/main/java/com/gregtechceu/gtceu/client/instance/SplitShaftInstance.java b/src/main/java/com/gregtechceu/gtceu/client/instance/SplitShaftInstance.java index d6ed211845..68f698c6c9 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/instance/SplitShaftInstance.java +++ b/src/main/java/com/gregtechceu/gtceu/client/instance/SplitShaftInstance.java @@ -2,6 +2,10 @@ import com.gregtechceu.gtceu.common.blockentity.KineticMachineBlockEntity; import com.gregtechceu.gtceu.common.machine.kinetic.IKineticMachine; + +import net.minecraft.core.Direction; +import net.minecraft.world.level.block.Block; + import com.jozufozu.flywheel.api.InstanceData; import com.jozufozu.flywheel.api.Instancer; import com.jozufozu.flywheel.api.Material; @@ -11,8 +15,6 @@ import com.simibubi.create.content.kinetics.base.KineticBlockEntityInstance; import com.simibubi.create.content.kinetics.base.flwdata.RotatingData; import com.simibubi.create.foundation.utility.Iterate; -import net.minecraft.core.Direction; -import net.minecraft.world.level.block.Block; import java.util.ArrayList; @@ -38,7 +40,8 @@ public SplitShaftInstance(MaterialManager modelManager, KineticMachineBlockEntit Instancer half = rotatingMaterial.getModel(AllPartialModels.SHAFT_HALF, blockState, dir); - float splitSpeed = speed * (tile.getMetaMachine() instanceof IKineticMachine kineticMachine ? kineticMachine.getRotationSpeedModifier(dir) : 1); + float splitSpeed = speed * (tile.getMetaMachine() instanceof IKineticMachine kineticMachine ? + kineticMachine.getRotationSpeedModifier(dir) : 1); keys.add(setup(half.createInstance(), splitSpeed)); } @@ -52,7 +55,9 @@ public void update() { Direction[] directions = Iterate.directionsInAxis(boxAxis); for (int i : Iterate.zeroAndOne) { - updateRotation(keys.get(i), blockEntity.getSpeed() * (blockEntity.getMetaMachine() instanceof IKineticMachine kineticMachine ? kineticMachine.getRotationSpeedModifier(directions[i]) : 1)); + updateRotation(keys.get(i), + blockEntity.getSpeed() * (blockEntity.getMetaMachine() instanceof IKineticMachine kineticMachine ? + kineticMachine.getRotationSpeedModifier(directions[i]) : 1)); } } @@ -66,5 +71,4 @@ public void remove() { keys.forEach(InstanceData::delete); keys.clear(); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/client/model/ItemBakedModel.java b/src/main/java/com/gregtechceu/gtceu/client/model/ItemBakedModel.java index 31e08b96e6..545b3920df 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/model/ItemBakedModel.java +++ b/src/main/java/com/gregtechceu/gtceu/client/model/ItemBakedModel.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.client.model; import com.lowdragmc.lowdraglib.client.model.ModelFactory; + import net.minecraft.client.renderer.block.model.ItemOverrides; import net.minecraft.client.renderer.block.model.ItemTransforms; import net.minecraft.client.renderer.texture.MissingTextureAtlasSprite; diff --git a/src/main/java/com/gregtechceu/gtceu/client/model/ModelUtil.java b/src/main/java/com/gregtechceu/gtceu/client/model/ModelUtil.java index 32ff404288..47c11ec0c0 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/model/ModelUtil.java +++ b/src/main/java/com/gregtechceu/gtceu/client/model/ModelUtil.java @@ -20,7 +20,9 @@ */ @OnlyIn(Dist.CLIENT) public class ModelUtil { - public static List getBakedModelQuads(BakedModel model, BlockAndTintGetter level, BlockPos pos, BlockState state, Direction side, RandomSource rand) { + + public static List getBakedModelQuads(BakedModel model, BlockAndTintGetter level, BlockPos pos, + BlockState state, Direction side, RandomSource rand) { return model.getQuads(state, side, rand, model.getModelData(level, pos, state, ModelData.EMPTY), null); } } diff --git a/src/main/java/com/gregtechceu/gtceu/client/model/PipeModel.java b/src/main/java/com/gregtechceu/gtceu/client/model/PipeModel.java index 3f8f847bda..4a122a0563 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/model/PipeModel.java +++ b/src/main/java/com/gregtechceu/gtceu/client/model/PipeModel.java @@ -3,13 +3,11 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.blockentity.PipeBlockEntity; import com.gregtechceu.gtceu.utils.GTUtil; + import com.lowdragmc.lowdraglib.client.bakedpipeline.FaceQuad; import com.lowdragmc.lowdraglib.client.model.ModelFactory; import com.lowdragmc.lowdraglib.client.renderer.IItemRendererProvider; -import com.mojang.blaze3d.vertex.PoseStack; -import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; -import lombok.Setter; + import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.block.model.BakedQuad; @@ -24,6 +22,11 @@ import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + +import com.mojang.blaze3d.vertex.PoseStack; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; +import lombok.Setter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -55,7 +58,8 @@ public class PipeModel { public static final ResourceLocation PIPE_BLOCKED_OVERLAY_DL = GTCEu.id("block/pipe/blocked/pipe_blocked_dl"); public static final ResourceLocation PIPE_BLOCKED_OVERLAY_DR = GTCEu.id("block/pipe/blocked/pipe_blocked_dr"); public static final ResourceLocation PIPE_BLOCKED_OVERLAY_LR = GTCEu.id("block/pipe/blocked/pipe_blocked_lr"); - private static final EnumMap> FACE_BORDER_MAP = new EnumMap<>(Direction.class); + private static final EnumMap> FACE_BORDER_MAP = new EnumMap<>( + Direction.class); private static final Int2ObjectMap RESTRICTOR_MAP = new Int2ObjectOpenHashMap<>(); private static boolean isRestrictorInitialized; @@ -79,19 +83,19 @@ public static void initializeRestrictor(Function sideTexture, Supplier endTexture, @Nullable Supplier<@Nullable ResourceLocation> secondarySideTexture, @Nullable Supplier<@Nullable ResourceLocation> secondaryEndTexture) { + public PipeModel(float thickness, Supplier sideTexture, Supplier endTexture, + @Nullable Supplier<@Nullable ResourceLocation> secondarySideTexture, + @Nullable Supplier<@Nullable ResourceLocation> secondaryEndTexture) { this.sideTexture = sideTexture; this.endTexture = endTexture; this.secondarySideTexture = secondarySideTexture; @@ -176,23 +183,28 @@ public List bakeQuads(@Nullable Direction side, int connections, int if (PipeBlockEntity.isConnected(connections, side)) { // side connected List quads = new ArrayList<>(); - quads.add(FaceQuad.builder(side, endSprite).cube(sideCubes.get(side).inflate(-0.001)).cubeUV().tintIndex(1).bake()); + quads.add(FaceQuad.builder(side, endSprite).cube(sideCubes.get(side).inflate(-0.001)).cubeUV() + .tintIndex(1).bake()); if (secondaryEndSprite != null) { - quads.add(FaceQuad.builder(side, secondaryEndSprite).cube(sideCubes.get(side)).cubeUV().tintIndex(1).bake()); + quads.add(FaceQuad.builder(side, secondaryEndSprite).cube(sideCubes.get(side)).cubeUV().tintIndex(1) + .bake()); } if (endOverlaySprite != null) { - quads.add(FaceQuad.builder(side, endOverlaySprite).cube(sideCubes.get(side)).cubeUV().tintIndex(0).bake()); + quads.add(FaceQuad.builder(side, endOverlaySprite).cube(sideCubes.get(side)).cubeUV().tintIndex(0) + .bake()); } if (sideOverlaySprite != null) { for (Direction face : GTUtil.DIRECTIONS) { if (face.getAxis() != side.getAxis()) { - quads.add(FaceQuad.builder(face, sideOverlaySprite).cube(sideCubes.get(side)).cubeUV().tintIndex(2).bake()); + quads.add(FaceQuad.builder(face, sideOverlaySprite).cube(sideCubes.get(side)).cubeUV() + .tintIndex(2).bake()); } } } int borderMask = computeBorderMask(blockedConnections, connections, side); if (borderMask != 0) { - quads.add(FaceQuad.builder(side, RESTRICTOR_MAP.get(borderMask)).cube(sideCubes.get(side)).cubeUV().bake()); + quads.add(FaceQuad.builder(side, RESTRICTOR_MAP.get(borderMask)).cube(sideCubes.get(side)).cubeUV() + .bake()); } return quads; } @@ -207,23 +219,28 @@ public List bakeQuads(@Nullable Direction side, int connections, int if (!PipeBlockEntity.isConnected(connections, face)) { quads.add(FaceQuad.builder(face, sideSprite).cube(coreCube).cubeUV().tintIndex(0).bake()); if (secondarySideSprite != null) { - quads.add(FaceQuad.builder(face, secondarySideSprite).cube(coreCube).cubeUV().tintIndex(0).bake()); + quads.add(FaceQuad.builder(face, secondarySideSprite).cube(coreCube).cubeUV().tintIndex(0) + .bake()); } } // render each connected side for (Direction facing : GTUtil.DIRECTIONS) { if (facing.getAxis() != face.getAxis()) { if (PipeBlockEntity.isConnected(connections, facing)) { - quads.add(FaceQuad.builder(face, sideSprite).cube(sideCubes.get(facing)).cubeUV().tintIndex(0).bake()); + quads.add(FaceQuad.builder(face, sideSprite).cube(sideCubes.get(facing)).cubeUV() + .tintIndex(0).bake()); if (secondarySideSprite != null) { - quads.add(FaceQuad.builder(face, secondarySideSprite).cube(sideCubes.get(facing)).cubeUV().tintIndex(0).bake()); + quads.add(FaceQuad.builder(face, secondarySideSprite).cube(sideCubes.get(facing)) + .cubeUV().tintIndex(0).bake()); } if (sideOverlaySprite != null) { - quads.add(FaceQuad.builder(face, sideOverlaySprite).cube(sideCubes.get(facing).inflate(0.001)).cubeUV().tintIndex(2).bake()); + quads.add(FaceQuad.builder(face, sideOverlaySprite) + .cube(sideCubes.get(facing).inflate(0.001)).cubeUV().tintIndex(2).bake()); } int borderMask = computeBorderMask(blockedConnections, connections, face); if (borderMask != 0) { - quads.add(FaceQuad.builder(face, RESTRICTOR_MAP.get(borderMask)).cube(sideCubes.get(facing)).cubeUV().bake()); + quads.add(FaceQuad.builder(face, RESTRICTOR_MAP.get(borderMask)) + .cube(sideCubes.get(facing)).cubeUV().bake()); } } } @@ -245,14 +262,14 @@ public TextureAtlasSprite getParticleTexture() { private final Map, List> itemModelCache = new ConcurrentHashMap<>(); @OnlyIn(Dist.CLIENT) - public void renderItem(ItemStack stack, ItemDisplayContext transformType, boolean leftHand, PoseStack matrixStack, MultiBufferSource buffer, int combinedLight, int combinedOverlay, BakedModel model) { + public void renderItem(ItemStack stack, ItemDisplayContext transformType, boolean leftHand, PoseStack matrixStack, + MultiBufferSource buffer, int combinedLight, int combinedOverlay, BakedModel model) { IItemRendererProvider.disabled.set(true); - Minecraft.getInstance().getItemRenderer().render(stack, transformType, leftHand, matrixStack, buffer, combinedLight, combinedOverlay, + Minecraft.getInstance().getItemRenderer().render(stack, transformType, leftHand, matrixStack, buffer, + combinedLight, combinedOverlay, (ItemBakedModel) (state, direction, random) -> itemModelCache.computeIfAbsent( Optional.ofNullable(direction), - direction1 -> bakeQuads(direction1.orElse(null), ITEM_CONNECTIONS, 0) - ) - ); + direction1 -> bakeQuads(direction1.orElse(null), ITEM_CONNECTIONS, 0))); IItemRendererProvider.disabled.set(false); } @@ -268,7 +285,8 @@ public void registerTextureAtlas(Consumer register) { endOverlaySprite = null; } - private static EnumMap borderMap(Direction topSide, Direction bottomSide, Direction leftSide, Direction rightSide) { + private static EnumMap borderMap(Direction topSide, Direction bottomSide, Direction leftSide, + Direction rightSide) { EnumMap sideMap = new EnumMap<>(Border.class); sideMap.put(Border.TOP, topSide); sideMap.put(Border.BOTTOM, bottomSide); @@ -295,7 +313,7 @@ protected static int computeBorderMask(int blockedConnections, int connections, for (Border border : Border.VALUES) { Direction borderSide = getSideAtBorder(side, border); if (PipeBlockEntity.isFaceBlocked(blockedConnections, borderSide) && - PipeBlockEntity.isConnected(connections, borderSide)) { + PipeBlockEntity.isConnected(connections, borderSide)) { // only render when the side is blocked *and* connected borderMask |= border.mask; } @@ -305,6 +323,7 @@ protected static int computeBorderMask(int blockedConnections, int connections, } public enum Border { + TOP, BOTTOM, LEFT, @@ -318,6 +337,4 @@ public enum Border { mask = 1 << this.ordinal(); } } - - } diff --git a/src/main/java/com/gregtechceu/gtceu/client/model/SpriteOverrider.java b/src/main/java/com/gregtechceu/gtceu/client/model/SpriteOverrider.java index 724b16b492..2986d61129 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/model/SpriteOverrider.java +++ b/src/main/java/com/gregtechceu/gtceu/client/model/SpriteOverrider.java @@ -15,11 +15,11 @@ * @implNote SpriteOverrider */ @OnlyIn(Dist.CLIENT) -public record SpriteOverrider(Map override) implements Function { +public record SpriteOverrider(Map override) + implements Function { @Override public TextureAtlasSprite apply(Material material) { return material.sprite(); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/client/model/WorkableOverlayModel.java b/src/main/java/com/gregtechceu/gtceu/client/model/WorkableOverlayModel.java index 7bbcf48615..20d55c5382 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/model/WorkableOverlayModel.java +++ b/src/main/java/com/gregtechceu/gtceu/client/model/WorkableOverlayModel.java @@ -1,15 +1,13 @@ package com.gregtechceu.gtceu.client.model; -import com.google.common.collect.Table; -import com.google.common.collect.Tables; import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.utils.GTUtil; + import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.client.bakedpipeline.FaceQuad; import com.lowdragmc.lowdraglib.client.model.ModelFactory; import com.lowdragmc.lowdraglib.client.renderer.IItemRendererProvider; -import com.lowdragmc.lowdraglib.utils.ResourceHelper; -import com.mojang.blaze3d.vertex.PoseStack; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.MultiBufferSource; @@ -24,13 +22,18 @@ import net.minecraft.world.item.ItemStack; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + +import com.google.common.collect.Table; +import com.google.common.collect.Tables; +import com.mojang.blaze3d.vertex.PoseStack; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.*; import java.util.function.Consumer; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author KilaBash * @date 2023/2/20 @@ -39,8 +42,14 @@ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class WorkableOverlayModel { + public enum OverlayFace { - FRONT, BACK, TOP, BOTTOM, SIDE; + + FRONT, + BACK, + TOP, + BOTTOM, + SIDE; public static final OverlayFace[] VALUES = values(); @@ -77,7 +86,6 @@ public ActivePredicate(@Nullable ResourceLocation normalSprite, @Nullable ResourceLocation normalSpriteEmissive, @Nullable ResourceLocation activeSpriteEmissive, @Nullable ResourceLocation pausedSpriteEmissive) { - this.normalSprite = normalSprite; this.activeSprite = activeSprite; this.pausedSprite = pausedSprite; @@ -93,15 +101,19 @@ public TextureAtlasSprite getSprite(boolean active, boolean workingEnabled) { @Nullable public TextureAtlasSprite getEmissiveSprite(boolean active, boolean workingEnabled) { - return getTextureAtlasSprite(active, workingEnabled, activeSpriteEmissive, pausedSpriteEmissive, normalSpriteEmissive); + return getTextureAtlasSprite(active, workingEnabled, activeSpriteEmissive, pausedSpriteEmissive, + normalSpriteEmissive); } @Nullable - private TextureAtlasSprite getTextureAtlasSprite(boolean active, boolean workingEnabled, @Nullable ResourceLocation activeSprite, @Nullable ResourceLocation pausedSprite, @Nullable ResourceLocation normalSprite) { + private TextureAtlasSprite getTextureAtlasSprite(boolean active, boolean workingEnabled, + @Nullable ResourceLocation activeSprite, + @Nullable ResourceLocation pausedSprite, + @Nullable ResourceLocation normalSprite) { if (active) { if (workingEnabled) { return activeSprite == null ? null : ModelFactory.getBlockSprite(activeSprite); - } else { + } else { return pausedSprite == null ? null : ModelFactory.getBlockSprite(pausedSprite); } } @@ -121,7 +133,8 @@ public WorkableOverlayModel(ResourceLocation location) { public Table[][]> caches; @OnlyIn(Dist.CLIENT) - public List bakeQuads(@Nullable Direction side, Direction frontFacing, boolean isActive, boolean isWorkingEnabled) { + public List bakeQuads(@Nullable Direction side, Direction frontFacing, boolean isActive, + boolean isWorkingEnabled) { synchronized (caches) { if (side == null) return Collections.emptyList(); if (!caches.contains(side, frontFacing)) { @@ -137,7 +150,8 @@ public List bakeQuads(@Nullable Direction side, Direction frontFacing if (predicate != null) { var texture = predicate.getSprite(isActive, isWorkingEnabled); if (texture != null) { - var quad = FaceQuad.bakeFace(FaceQuad.BLOCK, renderSide, texture, rotation, -1, 0, true, true); + var quad = FaceQuad.bakeFace(FaceQuad.BLOCK, renderSide, texture, rotation, -1, 0, true, + true); if (quad.getDirection() == side) { quads.add(quad); } @@ -146,12 +160,14 @@ public List bakeQuads(@Nullable Direction side, Direction frontFacing texture = predicate.getEmissiveSprite(isActive, isWorkingEnabled); if (texture != null) { if (ConfigHolder.INSTANCE.client.machinesEmissiveTextures) { - var quad = FaceQuad.bakeFace(FaceQuad.BLOCK, renderSide, texture, rotation, -101, 15, true, false); + var quad = FaceQuad.bakeFace(FaceQuad.BLOCK, renderSide, texture, rotation, -101, 15, + true, false); if (quad.getDirection() == side) { quads.add(quad); } } else { - var quad = FaceQuad.bakeFace(FaceQuad.BLOCK, renderSide, texture, rotation, -1, 0, true, true); + var quad = FaceQuad.bakeFace(FaceQuad.BLOCK, renderSide, texture, rotation, -1, 0, true, + true); if (quad.getDirection() == side) { quads.add(quad); } @@ -159,7 +175,7 @@ public List bakeQuads(@Nullable Direction side, Direction frontFacing } } } -// return quads; + // return quads; cache[isActive ? 0 : 1][isWorkingEnabled ? 0 : 1] = quads; } return cache[isActive ? 0 : 1][isWorkingEnabled ? 0 : 1]; @@ -177,10 +193,12 @@ public TextureAtlasSprite getParticleTexture() { } @OnlyIn(Dist.CLIENT) - public void renderItem(ItemStack stack, ItemDisplayContext transformType, boolean leftHand, PoseStack matrixStack, MultiBufferSource buffer, int combinedLight, int combinedOverlay, BakedModel model) { + public void renderItem(ItemStack stack, ItemDisplayContext transformType, boolean leftHand, PoseStack matrixStack, + MultiBufferSource buffer, int combinedLight, int combinedOverlay, BakedModel model) { IItemRendererProvider.disabled.set(true); - Minecraft.getInstance().getItemRenderer().render(stack, transformType, leftHand, matrixStack, buffer, combinedLight, combinedOverlay, - (ItemBakedModel) (state, direction, random) -> bakeQuads(direction, Direction.NORTH, false, false)); + Minecraft.getInstance().getItemRenderer().render(stack, transformType, leftHand, matrixStack, buffer, + combinedLight, combinedOverlay, + (ItemBakedModel) (state, direction, random) -> bakeQuads(direction, Direction.NORTH, false, false)); IItemRendererProvider.disabled.set(false); } @@ -188,7 +206,6 @@ public void renderItem(ItemStack stack, ItemDisplayContext transformType, boolea public void registerTextureAtlas(Consumer register) { ResourceManager resManager = Minecraft.getInstance().getResourceManager(); - sprites.clear(); synchronized (caches) { caches.clear(); @@ -196,7 +213,6 @@ public void registerTextureAtlas(Consumer register) { for (OverlayFace overlayFace : OverlayFace.VALUES) { final String overlayPath = "/overlay_" + overlayFace.name().toLowerCase(Locale.ROOT); - var normalSprite = new ResourceLocation(location.getNamespace(), location.getPath() + overlayPath); var normalSprite1 = getTextureLocation(normalSprite); if (!resManager.getResource(normalSprite1).isPresent()) continue; @@ -206,36 +222,40 @@ public void registerTextureAtlas(Consumer register) { final String active = String.format("%s_active", overlayPath); ResourceLocation activeSprite = new ResourceLocation(location.getNamespace(), location.getPath() + active); var activeSprite1 = getTextureLocation(activeSprite); - if (resManager.getResource(activeSprite1).isPresent()) register.accept(activeSprite); else activeSprite = normalSprite; - + if (resManager.getResource(activeSprite1).isPresent()) register.accept(activeSprite); + else activeSprite = normalSprite; final String paused = String.format("%s_paused", overlayPath); ResourceLocation pausedSprite = new ResourceLocation(location.getNamespace(), location.getPath() + paused); var pausedSprite1 = getTextureLocation(pausedSprite); - if (resManager.getResource(pausedSprite1).isPresent()) register.accept(pausedSprite); else pausedSprite = normalSprite; - + if (resManager.getResource(pausedSprite1).isPresent()) register.accept(pausedSprite); + else pausedSprite = normalSprite; // emissive - ResourceLocation normalSpriteEmissive = new ResourceLocation(location.getNamespace(), location.getPath() + overlayPath + "_emissive"); + ResourceLocation normalSpriteEmissive = new ResourceLocation(location.getNamespace(), + location.getPath() + overlayPath + "_emissive"); var normalSpriteEmissive1 = getTextureLocation(normalSpriteEmissive); - if (resManager.getResource(normalSpriteEmissive1).isPresent()) register.accept(normalSpriteEmissive); else normalSpriteEmissive = null; + if (resManager.getResource(normalSpriteEmissive1).isPresent()) register.accept(normalSpriteEmissive); + else normalSpriteEmissive = null; - ResourceLocation activeSpriteEmissive = new ResourceLocation(location.getNamespace(), location.getPath() + active + "_emissive"); + ResourceLocation activeSpriteEmissive = new ResourceLocation(location.getNamespace(), + location.getPath() + active + "_emissive"); var activeSpriteEmissive1 = getTextureLocation(activeSpriteEmissive); - if (resManager.getResource(activeSpriteEmissive1).isPresent()) register.accept(activeSpriteEmissive); else activeSpriteEmissive = null; + if (resManager.getResource(activeSpriteEmissive1).isPresent()) register.accept(activeSpriteEmissive); + else activeSpriteEmissive = null; - ResourceLocation pausedSpriteEmissive = new ResourceLocation(location.getNamespace(), location.getPath() + paused + "_emissive"); + ResourceLocation pausedSpriteEmissive = new ResourceLocation(location.getNamespace(), + location.getPath() + paused + "_emissive"); var pausedSpriteEmissive1 = getTextureLocation(pausedSpriteEmissive); - if (resManager.getResource(pausedSpriteEmissive1).isPresent()) register.accept(pausedSpriteEmissive); else pausedSpriteEmissive = null; - + if (resManager.getResource(pausedSpriteEmissive1).isPresent()) register.accept(pausedSpriteEmissive); + else pausedSpriteEmissive = null; sprites.put(overlayFace, new ActivePredicate(normalSprite, activeSprite, pausedSprite, - normalSpriteEmissive, activeSpriteEmissive, pausedSpriteEmissive)); + normalSpriteEmissive, activeSpriteEmissive, pausedSpriteEmissive)); } } private ResourceLocation getTextureLocation(ResourceLocation location) { return new ResourceLocation(location.getNamespace(), "textures/%s.png".formatted(location.getPath())); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/BlockHighLightRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/BlockHighLightRenderer.java index a8fd813225..db10b25339 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/BlockHighLightRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/BlockHighLightRenderer.java @@ -4,8 +4,6 @@ import com.gregtechceu.gtceu.api.capability.GTCapabilityHelper; import com.gregtechceu.gtceu.api.capability.ICoverable; import com.gregtechceu.gtceu.api.gui.GuiTextures; -import com.gregtechceu.gtceu.api.item.IGTTool; -import com.gregtechceu.gtceu.api.item.tool.GTToolItem; import com.gregtechceu.gtceu.api.item.PipeBlockItem; import com.gregtechceu.gtceu.api.item.tool.GTToolType; import com.gregtechceu.gtceu.api.item.tool.IToolGridHighLight; @@ -15,12 +13,10 @@ import com.gregtechceu.gtceu.common.item.tool.rotation.CustomBlockRotations; import com.gregtechceu.gtceu.common.item.tool.rotation.ICustomRotationBehavior; import com.gregtechceu.gtceu.core.mixins.GuiGraphicsAccessor; + import com.lowdragmc.lowdraglib.client.utils.RenderUtils; import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; -import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.Tesselator; -import com.mojang.blaze3d.vertex.VertexConsumer; + import net.minecraft.client.Camera; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.MultiBufferSource; @@ -35,6 +31,11 @@ import net.minecraft.world.phys.Vec3; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + +import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.Tesselator; +import com.mojang.blaze3d.vertex.VertexConsumer; import org.joml.Matrix4f; import org.joml.Quaternionf; import org.joml.Vector3f; @@ -42,7 +43,6 @@ import java.util.Set; import java.util.function.Function; - /** * @author KilaBash * @date 2023/2/24 @@ -51,7 +51,8 @@ @OnlyIn(Dist.CLIENT) public class BlockHighLightRenderer { - public static void renderBlockHighLight(PoseStack poseStack, Camera camera, BlockHitResult target, MultiBufferSource multiBufferSource, float partialTick) { + public static void renderBlockHighLight(PoseStack poseStack, Camera camera, BlockHitResult target, + MultiBufferSource multiBufferSource, float partialTick) { var mc = Minecraft.getInstance(); var level = mc.level; var player = mc.player; @@ -78,7 +79,8 @@ public static void renderBlockHighLight(PoseStack poseStack, Camera camera, Bloc RenderSystem.disableDepthTest(); RenderSystem.enableBlend(); RenderSystem.defaultBlendFunc(); - poseStack.translate(facing.getStepX() * 0.01, facing.getStepY() * 0.01, facing.getStepZ() * 0.01); + poseStack.translate(facing.getStepX() * 0.01, facing.getStepY() * 0.01, + facing.getStepZ() * 0.01); RenderUtils.moveToFace(poseStack, blockPos.getX(), blockPos.getY(), blockPos.getZ(), facing); if (facing.getAxis() == Direction.Axis.Y) { RenderUtils.rotateToFace(poseStack, facing, Direction.SOUTH); @@ -87,7 +89,10 @@ public static void renderBlockHighLight(PoseStack poseStack, Camera camera, Bloc } poseStack.scale(1f / 16, 1f / 16, 0); poseStack.translate(-8, -8, 0); - texture.copy().draw(GuiGraphicsAccessor.create(Minecraft.getInstance(), poseStack, MultiBufferSource.immediate(Tesselator.getInstance().getBuilder())), 0, 0, 4, 4, 8, 8); + texture.copy() + .draw(GuiGraphicsAccessor.create(Minecraft.getInstance(), poseStack, + MultiBufferSource.immediate(Tesselator.getInstance().getBuilder())), 0, 0, 4, 4, + 8, 8); RenderSystem.disableBlend(); RenderSystem.enableDepthTest(); } @@ -97,7 +102,8 @@ public static void renderBlockHighLight(PoseStack poseStack, Camera camera, Bloc } if (toolType.contains(GTToolType.WRENCH)) { - ICustomRotationBehavior behavior = CustomBlockRotations.getCustomRotation(level.getBlockState(blockPos).getBlock()); + ICustomRotationBehavior behavior = CustomBlockRotations + .getCustomRotation(level.getBlockState(blockPos).getBlock()); if (behavior != null && behavior.showGrid()) { Vec3 pos = camera.getPosition(); poseStack.pushPose(); @@ -113,28 +119,33 @@ public static void renderBlockHighLight(PoseStack poseStack, Camera camera, Bloc // draw cover grid highlight ICoverable coverable = GTCapabilityHelper.getCoverable(level, blockPos, target.getDirection()); - if (coverable != null && CoverPlaceBehavior.isCoverBehaviorItem(held, coverable::hasAnyCover, coverDef -> ICoverable.canPlaceCover(coverDef, coverable))) { + if (coverable != null && CoverPlaceBehavior.isCoverBehaviorItem(held, coverable::hasAnyCover, + coverDef -> ICoverable.canPlaceCover(coverDef, coverable))) { Vec3 pos = camera.getPosition(); poseStack.pushPose(); poseStack.translate(-pos.x, -pos.y, -pos.z); var buffer = multiBufferSource.getBuffer(RenderType.lines()); RenderSystem.lineWidth(3); - drawGridOverlays(poseStack, buffer, target, side -> coverable.hasCover(side) ? null : GuiTextures.TOOL_ATTACH_COVER); + drawGridOverlays(poseStack, buffer, target, + side -> coverable.hasCover(side) ? null : GuiTextures.TOOL_ATTACH_COVER); poseStack.popPose(); } // draw pipe connection grid highlight - var pipeType = held.getItem() instanceof PipeBlockItem pipeBlockItem ? pipeBlockItem.getBlock().pipeType : null; - if (pipeType instanceof IPipeType type && blockEntity instanceof PipeBlockEntity pipeBlockEntity && pipeBlockEntity.getPipeType().type().equals(type.type())) { + var pipeType = held.getItem() instanceof PipeBlockItem pipeBlockItem ? pipeBlockItem.getBlock().pipeType : + null; + if (pipeType instanceof IPipeType type && blockEntity instanceof PipeBlockEntity pipeBlockEntity && + pipeBlockEntity.getPipeType().type().equals(type.type())) { Vec3 pos = camera.getPosition(); poseStack.pushPose(); poseStack.translate(-pos.x, -pos.y, -pos.z); var buffer = multiBufferSource.getBuffer(RenderType.lines()); RenderSystem.lineWidth(3); - drawGridOverlays(poseStack, buffer, target, side -> level.isEmptyBlock(blockPos.relative(side)) ? pipeBlockEntity.getPipeTexture(true) : null); + drawGridOverlays(poseStack, buffer, target, side -> level.isEmptyBlock(blockPos.relative(side)) ? + pipeBlockEntity.getPipeTexture(true) : null); poseStack.popPose(); } @@ -145,7 +156,8 @@ public static void renderBlockHighLight(PoseStack poseStack, Camera camera, Bloc private static float gColour; private static float bColour; - private static void drawGridOverlays(PoseStack poseStack, VertexConsumer buffer, BlockHitResult blockHitResult, Function test) { + private static void drawGridOverlays(PoseStack poseStack, VertexConsumer buffer, BlockHitResult blockHitResult, + Function test) { rColour = gColour = 0.2F + (float) Math.sin((float) (System.currentTimeMillis() % (Mth.PI * 800)) / 800) / 2; bColour = 1f; var blockPos = blockHitResult.getBlockPos(); @@ -310,27 +322,28 @@ private static void drawGridOverlays(PoseStack poseStack, VertexConsumer buffer, poseStack.scale(1f / 16, 1f / 16, 0); poseStack.translate(-8, -8, 0); - var graphics = GuiGraphicsAccessor.create(Minecraft.getInstance(), poseStack, MultiBufferSource.immediate(Tesselator.getInstance().getBuilder())); + var graphics = GuiGraphicsAccessor.create(Minecraft.getInstance(), poseStack, + MultiBufferSource.immediate(Tesselator.getInstance().getBuilder())); if (leftBlocked != null) { - leftBlocked.copy().scale(0.9f).setColor(hoverLeft ? -1 : 0x44ffffff).draw(graphics, 0, 0, 0, 6, 4, 4); + leftBlocked.copy().scale(0.9f).setColor(hoverLeft ? -1 : 0x44ffffff).draw(graphics, 0, 0, 0, 6, 4, 4); } if (topBlocked != null) { - topBlocked.copy().scale(0.9f).setColor(hoverTop ? -1 : 0x44ffffff).draw(graphics, 0, 0, 6, 0, 4, 4); + topBlocked.copy().scale(0.9f).setColor(hoverTop ? -1 : 0x44ffffff).draw(graphics, 0, 0, 6, 0, 4, 4); } if (rightBlocked != null) { - rightBlocked.copy().scale(0.9f).setColor(hoverRight ? -1 : 0x44ffffff).draw(graphics, 0, 0, 12, 6, 4, 4); + rightBlocked.copy().scale(0.9f).setColor(hoverRight ? -1 : 0x44ffffff).draw(graphics, 0, 0, 12, 6, 4, 4); } if (bottomBlocked != null) { - bottomBlocked.copy().scale(0.9f).setColor(hoverBottom ? -1 : 0x44ffffff).draw(graphics, 0, 0, 6, 12, 4, 4); + bottomBlocked.copy().scale(0.9f).setColor(hoverBottom ? -1 : 0x44ffffff).draw(graphics, 0, 0, 6, 12, 4, 4); } if (frontBlocked != null) { - frontBlocked.copy().scale(0.9f).setColor(hoverFront ? -1 : 0x44ffffff).draw(graphics, 0, 0, 6, 6, 4, 4); + frontBlocked.copy().scale(0.9f).setColor(hoverFront ? -1 : 0x44ffffff).draw(graphics, 0, 0, 6, 6, 4, 4); } if (backBlocked != null) { - backBlocked.copy().scale(0.9f).setColor(hoverBack ? -1 : 0x44ffffff).draw(graphics, 0, 0, 0, 0, 4, 4); - backBlocked.copy().scale(0.9f).setColor(hoverBack ? -1 : 0x44ffffff).draw(graphics, 0, 0, 12, 0, 4, 4); - backBlocked.copy().scale(0.9f).setColor(hoverBack ? -1 : 0x44ffffff).draw(graphics, 0, 0, 0, 12, 4, 4); - backBlocked.copy().scale(0.9f).setColor(hoverBack ? -1 : 0x44ffffff).draw(graphics, 0, 0, 12, 12, 4, 4); + backBlocked.copy().scale(0.9f).setColor(hoverBack ? -1 : 0x44ffffff).draw(graphics, 0, 0, 0, 0, 4, 4); + backBlocked.copy().scale(0.9f).setColor(hoverBack ? -1 : 0x44ffffff).draw(graphics, 0, 0, 12, 0, 4, 4); + backBlocked.copy().scale(0.9f).setColor(hoverBack ? -1 : 0x44ffffff).draw(graphics, 0, 0, 0, 12, 4, 4); + backBlocked.copy().scale(0.9f).setColor(hoverBack ? -1 : 0x44ffffff).draw(graphics, 0, 0, 12, 12, 4, 4); } RenderSystem.disableBlend(); RenderSystem.enableDepthTest(); @@ -339,9 +352,10 @@ private static void drawGridOverlays(PoseStack poseStack, VertexConsumer buffer, private static void drawLine(Matrix4f mat, VertexConsumer buffer, Vector3f from, Vector3f to) { var normal = new Vector3f(from).sub(to); - - buffer.vertex(mat, from.x, from.y, from.z).color(rColour, gColour, bColour, 1f).normal(normal.x, normal.y, normal.z).endVertex(); - buffer.vertex(mat, to.x, to.y, to.z).color(rColour, gColour, bColour, 1f).normal(normal.x, normal.y, normal.z).endVertex(); - } + buffer.vertex(mat, from.x, from.y, from.z).color(rColour, gColour, bColour, 1f) + .normal(normal.x, normal.y, normal.z).endVertex(); + buffer.vertex(mat, to.x, to.y, to.z).color(rColour, gColour, bColour, 1f).normal(normal.x, normal.y, normal.z) + .endVertex(); + } } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/BlockStateModelRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/BlockStateModelRenderer.java index de77e33c7b..314af058a8 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/BlockStateModelRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/BlockStateModelRenderer.java @@ -1,13 +1,10 @@ package com.gregtechceu.gtceu.client.renderer; import com.lowdragmc.lowdraglib.client.renderer.IRenderer; -import com.lowdragmc.lowdraglib.client.renderer.impl.IModelRenderer; -import net.minecraft.client.renderer.block.BlockModelShaper; + import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; -import net.minecraft.core.Registry; import net.minecraft.util.RandomSource; import net.minecraft.world.level.BlockAndTintGetter; import net.minecraft.world.level.block.Block; @@ -27,6 +24,7 @@ * @implNote BlockStateModelRenderer */ public class BlockStateModelRenderer implements IRenderer { + private final Map models; public BlockStateModelRenderer(Block block, Function predicate) { @@ -44,11 +42,11 @@ public boolean useAO() { @Override @OnlyIn(Dist.CLIENT) - public List renderModel(BlockAndTintGetter level, BlockPos pos, BlockState state, Direction side, RandomSource rand) { + public List renderModel(BlockAndTintGetter level, BlockPos pos, BlockState state, Direction side, + RandomSource rand) { if (models.containsKey(state)) { return models.get(state).renderModel(level, pos, state, side, rand); } return Collections.emptyList(); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/GTRendererProvider.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/GTRendererProvider.java index b03ea7b261..c70126ff93 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/GTRendererProvider.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/GTRendererProvider.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.client.renderer; import com.lowdragmc.lowdraglib.client.renderer.ATESRRendererProvider; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; import net.minecraft.world.level.block.entity.BlockEntity; @@ -8,6 +9,7 @@ import net.minecraftforge.api.distmarker.OnlyIn; import org.jetbrains.annotations.Nullable; + import javax.annotation.ParametersAreNonnullByDefault; /** @@ -19,11 +21,12 @@ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class GTRendererProvider extends ATESRRendererProvider { + private static GTRendererProvider INSTANCE; private GTRendererProvider(BlockEntityRendererProvider.Context context) { -// ModelBellows.INSTANCE = new ModelBellows(context); -// ModelHungryChest.INSTANCE = new ModelHungryChest(context); + // ModelBellows.INSTANCE = new ModelBellows(context); + // ModelHungryChest.INSTANCE = new ModelHungryChest(context); } public static GTRendererProvider getOrCreate(BlockEntityRendererProvider.Context context) { diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/MultiblockInWorldPreviewRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/MultiblockInWorldPreviewRenderer.java index 5182171d8c..87de0bdbff 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/MultiblockInWorldPreviewRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/MultiblockInWorldPreviewRenderer.java @@ -8,13 +8,12 @@ import com.gregtechceu.gtceu.api.machine.MultiblockMachineDefinition; import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiController; import com.gregtechceu.gtceu.api.pattern.MultiblockShapeInfo; + import com.lowdragmc.lowdraglib.client.scene.WorldSceneRenderer; import com.lowdragmc.lowdraglib.client.scene.forge.WorldSceneRendererImpl; import com.lowdragmc.lowdraglib.utils.BlockInfo; import com.lowdragmc.lowdraglib.utils.TrackedDummyWorld; -import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.blaze3d.vertex.*; -import lombok.Getter; + import net.minecraft.client.Camera; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.*; @@ -33,6 +32,10 @@ import net.minecraft.world.phys.Vec3; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + +import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.*; +import lombok.Getter; import org.jetbrains.annotations.Nullable; import org.lwjgl.opengl.GL11; @@ -43,7 +46,6 @@ import static net.minecraft.world.level.block.RenderShape.INVISIBLE; - @OnlyIn(Dist.CLIENT) public class MultiblockInWorldPreviewRenderer { @@ -53,7 +55,7 @@ private enum CacheState { COMPILED } - @Getter(lazy=true) + @Getter(lazy = true) private final static VertexBuffer[] BUFFERS = initBuffers(); @Nullable private static TrackedDummyWorld LEVEL = null; @@ -63,7 +65,6 @@ private enum CacheState { private static Set BLOCK_ENTITIES; private final static AtomicInteger LEFT_TICK = new AtomicInteger(-1); - /** * It will be cached by lombok#@Getter(lazy=true) */ @@ -99,10 +100,11 @@ public static void removePreview(BlockPos pos) { /** * Show the multiblock preview in the world by the given pos, side, and shape info. - * @param pos the pos of the controller - * @param front the front of the controller + * + * @param pos the pos of the controller + * @param front the front of the controller * @param shapeInfo the shape info of the multiblock - * @param duration the duration of the preview. in ticks. + * @param duration the duration of the preview. in ticks. */ public static void showPreview(BlockPos pos, Direction front, MultiblockShapeInfo shapeInfo, int duration) { Map blockMap = new HashMap<>(); @@ -121,7 +123,8 @@ public static void showPreview(BlockPos pos, Direction front, MultiblockShapeInf for (int z = 0; z < column.length; z++) { var blockState = column[z].getBlockState(); // if its controller record its position offset. - if (blockState.getBlock() instanceof IMachineBlock machineBlock && machineBlock.getDefinition() instanceof MultiblockMachineDefinition) { + if (blockState.getBlock() instanceof IMachineBlock machineBlock && + machineBlock.getDefinition() instanceof MultiblockMachineDefinition) { controllerPatternPos = new BlockPos(x, y, z); } } @@ -181,8 +184,8 @@ public static void showPreview(BlockPos pos, Direction front, MultiblockShapeInf BlockPos realPos = pos.offset(offset); - if (column[z].getBlockEntity(realPos) instanceof IMachineBlockEntity holder - && holder.getMetaMachine() instanceof IMultiController controller) { + if (column[z].getBlockEntity(realPos) instanceof IMachineBlockEntity holder && + holder.getMetaMachine() instanceof IMultiController controller) { holder.getSelf().setLevel(LEVEL); controllerBase = controller; } else { @@ -220,7 +223,7 @@ public static void renderInWorldPreview(PoseStack poseStack, Camera camera, floa if (vertexbuffer.isInvalid() || vertexbuffer.getFormat() == null) continue; var layer = RenderType.chunkBufferLayers().get(i); - // render TESR before translucent + // render TESR before translucent if (layer == RenderType.translucent() && BLOCK_ENTITIES != null) { // render tesr before translucent var buffers = Minecraft.getInstance().renderBuffers().bufferSource(); for (BlockPos pos : BLOCK_ENTITIES) { @@ -228,10 +231,12 @@ public static void renderInWorldPreview(PoseStack poseStack, Camera camera, floa if (tile != null) { poseStack.pushPose(); poseStack.translate(pos.getX(), pos.getY(), pos.getZ()); - BlockEntityRenderer tileentityrenderer = Minecraft.getInstance().getBlockEntityRenderDispatcher().getRenderer(tile); + BlockEntityRenderer tileentityrenderer = Minecraft.getInstance() + .getBlockEntityRenderDispatcher().getRenderer(tile); if (tileentityrenderer != null) { if (tile.hasLevel() && tile.getType().isValid(tile.getBlockState())) { - tileentityrenderer.render(tile, partialTicks, poseStack, buffers, 0xF000F0, OverlayTexture.NO_OVERLAY); + tileentityrenderer.render(tile, partialTicks, poseStack, buffers, 0xF000F0, + OverlayTexture.NO_OVERLAY); } } poseStack.popPose(); @@ -245,7 +250,7 @@ public static void renderInWorldPreview(PoseStack poseStack, Camera camera, floa poseStack.pushPose(); ShaderInstance shaderInstance = RenderSystem.getShader(); - for(int j = 0; j < 12; ++j) { + for (int j = 0; j < 12; ++j) { int k = RenderSystem.getShaderTexture(j); shaderInstance.setSampler("Sampler" + j, k); } @@ -316,7 +321,6 @@ public static void renderInWorldPreview(PoseStack poseStack, Camera camera, floa } } - private static void prepareBuffers(TrackedDummyWorld level, Collection renderedBlocks, int duration) { if (THREAD != null) { THREAD.interrupt(); @@ -334,7 +338,8 @@ private static void prepareBuffers(TrackedDummyWorld level, Collection var layer = RenderType.chunkBufferLayers().get(i); var buffer = new BufferBuilder(layer.bufferSize()); buffer.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.BLOCK); - renderBlocks(level, poseStack, dispatcher, layer, new WorldSceneRenderer.VertexConsumerWrapper(buffer), renderedBlocks); + renderBlocks(level, poseStack, dispatcher, layer, new WorldSceneRenderer.VertexConsumerWrapper(buffer), + renderedBlocks); var builder = buffer.end(); var vertexBuffer = getBUFFERS()[i]; Runnable toUpload = () -> { @@ -374,7 +379,9 @@ private static void prepareBuffers(TrackedDummyWorld level, Collection THREAD.start(); } - private static void renderBlocks(TrackedDummyWorld level, PoseStack poseStack, BlockRenderDispatcher dispatcher, RenderType layer, WorldSceneRenderer.VertexConsumerWrapper wrapperBuffer, Collection renderedBlocks) { + private static void renderBlocks(TrackedDummyWorld level, PoseStack poseStack, BlockRenderDispatcher dispatcher, + RenderType layer, WorldSceneRenderer.VertexConsumerWrapper wrapperBuffer, + Collection renderedBlocks) { for (BlockPos pos : renderedBlocks) { BlockState state = level.getBlockState(pos); @@ -384,7 +391,7 @@ private static void renderBlocks(TrackedDummyWorld level, PoseStack poseStack, B if (block == Blocks.AIR) continue; - //render blocks + // render blocks if (state.getRenderShape() != INVISIBLE && ItemBlockRenderTypes.getRenderLayers(state).contains(layer)) { poseStack.pushPose(); poseStack.translate(pos.getX(), pos.getY(), pos.getZ()); @@ -394,14 +401,16 @@ private static void renderBlocks(TrackedDummyWorld level, PoseStack poseStack, B poseStack.translate(-0.5, -0.5, -0.5); level.setRenderFilter(p -> p.equals(pos)); - WorldSceneRendererImpl.renderBlocksForge(dispatcher, state, pos, level, poseStack, wrapperBuffer, GTValues.RNG, layer); + WorldSceneRendererImpl.renderBlocksForge(dispatcher, state, pos, level, poseStack, wrapperBuffer, + GTValues.RNG, layer); level.setRenderFilter(p -> true); poseStack.popPose(); } // render fluids if (!fluidState.isEmpty() && ItemBlockRenderTypes.getRenderLayer(fluidState) == layer) { - wrapperBuffer.addOffset((pos.getX() - (pos.getX() & 15)), (pos.getY() - (pos.getY() & 15)), (pos.getZ() - (pos.getZ() & 15))); + wrapperBuffer.addOffset((pos.getX() - (pos.getX() & 15)), (pos.getY() - (pos.getY() & 15)), + (pos.getZ() - (pos.getZ() & 15))); dispatcher.renderLiquid(pos, level, wrapperBuffer, state, fluidState); } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/block/CTMModelRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/block/CTMModelRenderer.java index 0ed143d240..ea92ca9cf7 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/block/CTMModelRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/block/CTMModelRenderer.java @@ -1,11 +1,10 @@ package com.gregtechceu.gtceu.client.renderer.block; -import com.google.common.base.Suppliers; import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.utils.SupplierMemoizer; -import com.lowdragmc.lowdraglib.LDLib; + import com.lowdragmc.lowdraglib.client.renderer.impl.IModelRenderer; -import net.minecraft.Util; + import net.minecraft.resources.ResourceLocation; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -18,7 +17,9 @@ * @implNote CTMModelRenderer */ public class CTMModelRenderer extends IModelRenderer { + public static Supplier LOW_PRECISION = SupplierMemoizer.memoize(GTCEu::isSodiumRubidiumEmbeddiumLoaded); + public CTMModelRenderer(ResourceLocation modelLocation) { super(modelLocation); } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/block/MaterialBlockRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/block/MaterialBlockRenderer.java index 52e6c794e3..5ca52d3daa 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/block/MaterialBlockRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/block/MaterialBlockRenderer.java @@ -1,15 +1,12 @@ package com.gregtechceu.gtceu.client.renderer.block; -import com.google.common.collect.ImmutableList; import com.gregtechceu.gtceu.api.block.MaterialBlock; import com.gregtechceu.gtceu.api.data.chemical.material.info.MaterialIconSet; import com.gregtechceu.gtceu.api.data.chemical.material.info.MaterialIconType; import com.gregtechceu.gtceu.data.pack.GTDynamicResourcePack; import com.gregtechceu.gtceu.utils.GradientUtil; -import com.mojang.blaze3d.platform.NativeImage; + import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.metadata.animation.AnimationFrame; -import net.minecraft.client.resources.metadata.animation.AnimationMetadataSection; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.data.models.BlockModelGenerators; import net.minecraft.data.models.model.*; @@ -17,6 +14,8 @@ import net.minecraft.server.packs.resources.Resource; import net.minecraft.world.level.block.Block; +import com.mojang.blaze3d.platform.NativeImage; + import java.io.IOException; import java.io.InputStream; import java.util.HashSet; @@ -28,6 +27,7 @@ * @implNote MaterialBlockRenderer */ public class MaterialBlockRenderer { + public static final String LAYER_2_SUFFIX = "_layer2"; private static final Set MODELS = new HashSet<>(); @@ -39,12 +39,15 @@ public static void reinitModels() { for (MaterialBlockRenderer model : MODELS) { ResourceLocation blockId = BuiltInRegistries.BLOCK.getKey(model.block); ResourceLocation modelId = blockId.withPrefix("block/"); - GTDynamicResourcePack.addBlockModel(modelId, new DelegatedModel(model.type.getBlockModelPath(model.iconSet, true))); + GTDynamicResourcePack.addBlockModel(modelId, + new DelegatedModel(model.type.getBlockModelPath(model.iconSet, true))); GTDynamicResourcePack.addBlockState(blockId, BlockModelGenerators.createSimpleBlock(model.block, modelId)); - // ModelTemplates.CUBE_ALL.create(model.block, - // cubeTwoLayer(model.type.getBlockTexturePath(model.iconSet, true), model.type.getBlockTexturePath(model.iconSet, true).withSuffix(LAYER_2_SUFFIX)), - // GTDynamicResourcePack::addBlockModel))); - GTDynamicResourcePack.addItemModel(BuiltInRegistries.ITEM.getKey(model.block.asItem()), new DelegatedModel(ModelLocationUtils.getModelLocation(model.block))); + // ModelTemplates.CUBE_ALL.create(model.block, + // cubeTwoLayer(model.type.getBlockTexturePath(model.iconSet, true), + // model.type.getBlockTexturePath(model.iconSet, true).withSuffix(LAYER_2_SUFFIX)), + // GTDynamicResourcePack::addBlockModel))); + GTDynamicResourcePack.addItemModel(BuiltInRegistries.ITEM.getKey(model.block.asItem()), + new DelegatedModel(ModelLocationUtils.getModelLocation(model.block))); } } @@ -52,9 +55,12 @@ public static void initTextures() { for (MaterialBlockRenderer model : MODELS) { ResourceLocation blockId = BuiltInRegistries.BLOCK.getKey(model.block); - Resource file1 = Minecraft.getInstance().getResourceManager().getResource(GTDynamicResourcePack.getTextureLocation(null, model.type.getBlockTexturePath(model.iconSet, true)/*.withSuffix("_layer1")*/)).orElse(null); + Resource file1 = Minecraft.getInstance().getResourceManager() + .getResource(GTDynamicResourcePack.getTextureLocation(null, + model.type.getBlockTexturePath(model.iconSet, true)/* .withSuffix("_layer1") */)) + .orElse(null); if (file1 == null) continue; - try(InputStream stream1 = file1.open()) { + try (InputStream stream1 = file1.open()) { if (!(model.block instanceof MaterialBlock materialBlock)) continue; int materialRGBA = GradientUtil.argbToRgba(materialBlock.material.getMaterialARGB()); @@ -67,15 +73,20 @@ public static void initTextures() { } } if (materialBlock.material.getMaterialSecondaryARGB() != -1) { - int materialSecondaryRGBA = GradientUtil.argbToRgba(materialBlock.material.getMaterialSecondaryARGB()); - Resource file2 = Minecraft.getInstance().getResourceManager().getResource(GTDynamicResourcePack.getTextureLocation(null, model.type.getBlockTexturePath(model.iconSet, true).withSuffix(LAYER_2_SUFFIX))).orElse(null); + int materialSecondaryRGBA = GradientUtil + .argbToRgba(materialBlock.material.getMaterialSecondaryARGB()); + Resource file2 = Minecraft.getInstance().getResourceManager() + .getResource(GTDynamicResourcePack.getTextureLocation(null, + model.type.getBlockTexturePath(model.iconSet, true).withSuffix(LAYER_2_SUFFIX))) + .orElse(null); if (file2 != null) { - try(InputStream stream2 = file2.open()) { + try (InputStream stream2 = file2.open()) { NativeImage image2 = NativeImage.read(stream2); for (int x = 0; x < image1.getWidth(); ++x) { for (int y = 0; y < image1.getHeight(); ++y) { int color = image2.getPixelRGBA(x, y); - result.blendPixel(x, y, GradientUtil.multiplyBlendRGBA(color, materialSecondaryRGBA)); + result.blendPixel(x, y, + GradientUtil.multiplyBlendRGBA(color, materialSecondaryRGBA)); } } } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/block/OreBlockRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/block/OreBlockRenderer.java index 8003a53fe9..b10c034e3e 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/block/OreBlockRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/block/OreBlockRenderer.java @@ -1,17 +1,13 @@ package com.gregtechceu.gtceu.client.renderer.block; -import com.google.common.base.Preconditions; -import com.google.gson.JsonObject; import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.block.MaterialBlock; -import com.gregtechceu.gtceu.api.block.OreBlock; import com.gregtechceu.gtceu.api.data.chemical.material.Material; -import com.gregtechceu.gtceu.api.data.chemical.material.info.MaterialIconSet; -import com.gregtechceu.gtceu.api.data.chemical.material.info.MaterialIconType; import com.gregtechceu.gtceu.api.data.chemical.material.properties.OreProperty; import com.gregtechceu.gtceu.api.data.chemical.material.properties.PropertyKey; import com.gregtechceu.gtceu.api.data.tag.TagPrefix; import com.gregtechceu.gtceu.data.pack.GTDynamicResourcePack; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.client.Minecraft; import net.minecraft.core.registries.BuiltInRegistries; @@ -20,10 +16,12 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.util.GsonHelper; +import com.google.common.base.Preconditions; +import com.google.gson.JsonObject; + import java.io.BufferedReader; import java.io.IOException; import java.util.HashSet; -import java.util.Optional; import java.util.Set; /** @@ -33,6 +31,7 @@ */ @MethodsReturnNonnullByDefault public class OreBlockRenderer { + private static final Set MODELS = new HashSet<>(); private final MaterialBlock block; @@ -51,23 +50,27 @@ public static void reinitModels() { ResourceLocation modelId = blockId.withPrefix("block/"); OreBlockRenderer.cloneBlockModel(modelId, model.block.tagPrefix, model.block.material); GTDynamicResourcePack.addBlockState(blockId, BlockModelGenerators.createSimpleBlock(model.block, modelId)); - GTDynamicResourcePack.addItemModel(BuiltInRegistries.ITEM.getKey(model.block.asItem()), new DelegatedModel(ModelLocationUtils.getModelLocation(model.block))); + GTDynamicResourcePack.addItemModel(BuiltInRegistries.ITEM.getKey(model.block.asItem()), + new DelegatedModel(ModelLocationUtils.getModelLocation(model.block))); } } /** * Clones & modifies the base JSON for a single ore block. - * @param modelId the model id (usually {@code gtceu:block/}) - * @param prefix the TagPrefix of the block being added. + * + * @param modelId the model id (usually {@code gtceu:block/}) + * @param prefix the TagPrefix of the block being added. * @param material the material of the block being added. must have an ore property. */ public static void cloneBlockModel(ResourceLocation modelId, TagPrefix prefix, Material material) { OreProperty prop = material.getProperty(PropertyKey.ORE); - Preconditions.checkNotNull(prop, "material %s has no ore property, but needs one for an ore model!".formatted(material.getName())); + Preconditions.checkNotNull(prop, + "material %s has no ore property, but needs one for an ore model!".formatted(material.getName())); // read the base ore model JSON JsonObject original; - try(BufferedReader reader = Minecraft.getInstance().getResourceManager().openAsReader(GTCEu.id("models/block/ore%s.json".formatted(prop.isEmissive() ? "_emissive" : "")))) { + try (BufferedReader reader = Minecraft.getInstance().getResourceManager() + .openAsReader(GTCEu.id("models/block/ore%s.json".formatted(prop.isEmissive() ? "_emissive" : "")))) { original = GsonHelper.parse(reader, true); } catch (IOException e) { throw new RuntimeException(e); @@ -77,10 +80,13 @@ public static void cloneBlockModel(ResourceLocation modelId, TagPrefix prefix, M JsonObject newJson = original.deepCopy(); JsonObject children = newJson.getAsJsonObject("children"); // add the base stone texture. - children.getAsJsonObject("base_stone").addProperty("parent", TagPrefix.ORES.get(prefix).baseModelLocation().toString());//.getAsJsonObject("textures").addProperty("stone", TagPrefix.ORES.get(prefix).baseModelLocation().toString()); + children.getAsJsonObject("base_stone").addProperty("parent", + TagPrefix.ORES.get(prefix).baseModelLocation().toString());// .getAsJsonObject("textures").addProperty("stone", + // TagPrefix.ORES.get(prefix).baseModelLocation().toString()); ResourceLocation layer0 = prefix.materialIconType().getBlockTexturePath(material.getMaterialIconSet(), true); - ResourceLocation layer1 = prefix.materialIconType().getBlockTexturePath(material.getMaterialIconSet(), "layer2", true); + ResourceLocation layer1 = prefix.materialIconType().getBlockTexturePath(material.getMaterialIconSet(), "layer2", + true); JsonObject oresTextures = children.getAsJsonObject("ore_texture").getAsJsonObject("textures"); oresTextures.addProperty("layer0", layer0.toString()); oresTextures.addProperty("layer1", layer1.toString()); @@ -89,5 +95,4 @@ public static void cloneBlockModel(ResourceLocation modelId, TagPrefix prefix, M GTDynamicResourcePack.addBlockModel(modelId, newJson); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/block/PipeBlockRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/block/PipeBlockRenderer.java index 2fd77f622d..0f5c236aa7 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/block/PipeBlockRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/block/PipeBlockRenderer.java @@ -3,11 +3,11 @@ import com.gregtechceu.gtceu.api.pipenet.IPipeNode; import com.gregtechceu.gtceu.client.model.PipeModel; import com.gregtechceu.gtceu.client.renderer.cover.ICoverableRenderer; + import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.client.model.ModelFactory; import com.lowdragmc.lowdraglib.client.renderer.IRenderer; -import com.mojang.blaze3d.vertex.PoseStack; -import lombok.Getter; + import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.texture.TextureAtlas; @@ -23,6 +23,9 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + +import com.mojang.blaze3d.vertex.PoseStack; +import lombok.Getter; import org.jetbrains.annotations.NotNull; import java.util.Collections; @@ -54,7 +57,8 @@ public void renderItem(ItemStack stack, boolean leftHand, PoseStack matrixStack, MultiBufferSource buffer, int combinedLight, int combinedOverlay, BakedModel model) { - pipeModel.renderItem(stack, transformType, leftHand, matrixStack, buffer, combinedLight, combinedOverlay, model); + pipeModel.renderItem(stack, transformType, leftHand, matrixStack, buffer, combinedLight, combinedOverlay, + model); } @Override @@ -70,14 +74,18 @@ public boolean useBlockLight(ItemStack stack) { @Override @OnlyIn(Dist.CLIENT) - public List renderModel(BlockAndTintGetter level, BlockPos pos, BlockState state, Direction side, RandomSource rand) { + public List renderModel(BlockAndTintGetter level, BlockPos pos, BlockState state, Direction side, + RandomSource rand) { if (level == null) { return pipeModel.bakeQuads(side, PipeModel.ITEM_CONNECTIONS, 0); - } else if (level.getBlockEntity(pos) instanceof IPipeNode pipeNode) { - var quads = new LinkedList<>(pipeModel.bakeQuads(side, pipeNode.getVisualConnections(), pipeNode.getBlockedConnections())); + } else if (level.getBlockEntity(pos) instanceof IPipeNode pipeNode) { + var quads = new LinkedList<>( + pipeModel.bakeQuads(side, pipeNode.getVisualConnections(), pipeNode.getBlockedConnections())); var modelState = ModelFactory.getRotation(pipeNode.getCoverContainer().getFrontFacing()); - var modelFacing = side == null ? null : ModelFactory.modelFacing(side, pipeNode.getCoverContainer().getFrontFacing()); - ICoverableRenderer.super.renderCovers(quads, side, rand, pipeNode.getCoverContainer(), modelFacing, pos, level, modelState); + var modelFacing = side == null ? null : + ModelFactory.modelFacing(side, pipeNode.getCoverContainer().getFrontFacing()); + ICoverableRenderer.super.renderCovers(quads, side, rand, pipeNode.getCoverContainer(), modelFacing, pos, + level, modelState); return quads; } return Collections.emptyList(); @@ -97,5 +105,4 @@ public void onPrepareTextureAtlas(ResourceLocation atlasName, Consumer MODELS = new HashSet<>(); public static void create(Block block) { diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/block/TextureOverrideRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/block/TextureOverrideRenderer.java index 314930ef56..9406e29214 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/block/TextureOverrideRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/block/TextureOverrideRenderer.java @@ -1,9 +1,10 @@ package com.gregtechceu.gtceu.client.renderer.block; import com.gregtechceu.gtceu.client.model.SpriteOverrider; + import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.client.model.ModelFactory; -import lombok.Getter; + import net.minecraft.client.renderer.block.model.BlockModel; import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.client.resources.model.BakedModel; @@ -14,8 +15,10 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; +import lombok.Getter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; + import java.util.Collections; import java.util.Map; import java.util.function.Consumer; @@ -42,7 +45,8 @@ public TextureOverrideRenderer(ResourceLocation model, @NotNull Map> overrideSupplier) { + public TextureOverrideRenderer(ResourceLocation model, + @NotNull Supplier> overrideSupplier) { super(model); this.override = Collections.emptyMap(); this.overrideSupplier = overrideSupplier; diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/ConveyorCoverRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/ConveyorCoverRenderer.java index 3ec0ed810d..d5f82ee1e1 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/ConveyorCoverRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/ConveyorCoverRenderer.java @@ -1,13 +1,14 @@ package com.gregtechceu.gtceu.client.renderer.cover; - import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.capability.recipe.IO; import com.gregtechceu.gtceu.api.cover.CoverBehavior; import com.gregtechceu.gtceu.common.cover.ConveyorCover; + import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.client.bakedpipeline.FaceQuad; import com.lowdragmc.lowdraglib.client.model.ModelFactory; + import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.client.resources.model.ModelState; @@ -18,6 +19,7 @@ import net.minecraft.world.level.BlockAndTintGetter; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -34,7 +36,8 @@ public class ConveyorCoverRenderer implements ICoverRenderer { public final static ConveyorCoverRenderer INSTANCE = new ConveyorCoverRenderer(); public final static ResourceLocation CONVEYOR_OVERLAY = GTCEu.id("block/cover/overlay_conveyor"); public final static ResourceLocation CONVEYOR_OVERLAY_OUT = GTCEu.id("block/cover/overlay_conveyor_emissive"); - public final static ResourceLocation CONVEYOR_OVERLAY_IN = GTCEu.id("block/cover/overlay_conveyor_inverted_emissive"); + public final static ResourceLocation CONVEYOR_OVERLAY_IN = GTCEu + .id("block/cover/overlay_conveyor_inverted_emissive"); protected ConveyorCoverRenderer() { if (LDLib.isClient()) { @@ -44,10 +47,16 @@ protected ConveyorCoverRenderer() { @Override @OnlyIn(Dist.CLIENT) - public void renderCover(List quads, @Nullable Direction side, RandomSource rand, @NotNull CoverBehavior coverBehavior, @Nullable Direction modelFacing, BlockPos pos, BlockAndTintGetter level, ModelState modelState) { - if (side == coverBehavior.attachedSide && coverBehavior instanceof ConveyorCover conveyor && modelFacing != null) { + public void renderCover(List quads, @Nullable Direction side, RandomSource rand, + @NotNull CoverBehavior coverBehavior, @Nullable Direction modelFacing, BlockPos pos, + BlockAndTintGetter level, ModelState modelState) { + if (side == coverBehavior.attachedSide && coverBehavior instanceof ConveyorCover conveyor && + modelFacing != null) { quads.add(FaceQuad.bakeFace(modelFacing, ModelFactory.getBlockSprite(CONVEYOR_OVERLAY), modelState)); - quads.add(FaceQuad.bakeFace(modelFacing, ModelFactory.getBlockSprite(conveyor.getIo() == IO.OUT ? CONVEYOR_OVERLAY_OUT : CONVEYOR_OVERLAY_IN), modelState, -101, 15)); + quads.add(FaceQuad.bakeFace(modelFacing, + ModelFactory + .getBlockSprite(conveyor.getIo() == IO.OUT ? CONVEYOR_OVERLAY_OUT : CONVEYOR_OVERLAY_IN), + modelState, -101, 15)); } } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/FacadeCoverRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/FacadeCoverRenderer.java index 30964d82f0..71ac14e596 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/FacadeCoverRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/FacadeCoverRenderer.java @@ -1,15 +1,16 @@ package com.gregtechceu.gtceu.client.renderer.cover; import com.gregtechceu.gtceu.GTCEu; +import com.gregtechceu.gtceu.api.cover.CoverBehavior; import com.gregtechceu.gtceu.client.model.ModelUtil; import com.gregtechceu.gtceu.common.cover.FacadeCover; -import com.gregtechceu.gtceu.api.cover.CoverBehavior; import com.gregtechceu.gtceu.common.item.FacadeItemBehaviour; import com.gregtechceu.gtceu.utils.GTUtil; + import com.lowdragmc.lowdraglib.client.bakedpipeline.FaceQuad; import com.lowdragmc.lowdraglib.client.model.ModelFactory; import com.lowdragmc.lowdraglib.utils.FacadeBlockAndTintGetter; -import com.mojang.blaze3d.vertex.PoseStack; + import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; @@ -29,6 +30,8 @@ import net.minecraft.world.phys.AABB; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + +import com.mojang.blaze3d.vertex.PoseStack; import org.jetbrains.annotations.NotNull; import org.joml.AxisAngle4d; import org.joml.Quaternionf; @@ -40,16 +43,14 @@ * @author KilaBash * @date 2023/2/24 * @implNote FacadeRenderer - * It can only be used for item. - * call it in other renderer to render a facade cover. + * It can only be used for item. + * call it in other renderer to render a facade cover. */ public class FacadeCoverRenderer implements ICoverRenderer { public final static FacadeCoverRenderer INSTANCE = new FacadeCoverRenderer(); - protected FacadeCoverRenderer() { - - } + protected FacadeCoverRenderer() {} @Override @OnlyIn(Dist.CLIENT) @@ -59,7 +60,8 @@ public boolean useBlockLight(ItemStack stack) { @Override @OnlyIn(Dist.CLIENT) - public void renderItem(ItemStack stack, ItemDisplayContext transformType, boolean leftHand, PoseStack matrixStack, MultiBufferSource buffer, int combinedLight, int combinedOverlay, BakedModel model) { + public void renderItem(ItemStack stack, ItemDisplayContext transformType, boolean leftHand, PoseStack matrixStack, + MultiBufferSource buffer, int combinedLight, int combinedOverlay, BakedModel model) { var mc = Minecraft.getInstance(); var renderItem = FacadeItemBehaviour.getFacadeStack(stack); BlockState blockState = null; @@ -72,7 +74,8 @@ public void renderItem(ItemStack stack, ItemDisplayContext transformType, boolea matrixStack.pushPose(); ModelFactory.MODEL_TRANSFORM_BLOCK.getTransform(transformType).apply(leftHand, matrixStack); matrixStack.translate(0, -0.1D, -0.5D); - if (transformType == ItemDisplayContext.FIRST_PERSON_LEFT_HAND || transformType == ItemDisplayContext.FIRST_PERSON_RIGHT_HAND) { + if (transformType == ItemDisplayContext.FIRST_PERSON_LEFT_HAND || + transformType == ItemDisplayContext.FIRST_PERSON_RIGHT_HAND) { matrixStack.translate(0.5, 0.5, 0.5); matrixStack.mulPose(new Quaternionf(new AxisAngle4d().set(90, 0, 1, 0))); @@ -81,19 +84,23 @@ public void renderItem(ItemStack stack, ItemDisplayContext transformType, boolea var pose = matrixStack.last(); var level = new FacadeBlockAndTintGetter(mc.level, BlockPos.ZERO, blockState, null); - var quads = new LinkedList<>(ModelUtil.getBakedModelQuads(model, level, BlockPos.ZERO, blockState, Direction.NORTH, mc.level.random)); + var quads = new LinkedList<>(ModelUtil.getBakedModelQuads(model, level, BlockPos.ZERO, blockState, + Direction.NORTH, mc.level.random)); var cube = new AABB(0.01, 0.01, 0.01, 0.99, 0.99, 1 / 16f); for (Direction side : GTUtil.DIRECTIONS) { if (side != Direction.NORTH) { - quads.add(FaceQuad.builder(side, ModelFactory.getBlockSprite(GTCEu.id("block/cable/wire"))).cube(cube).cubeUV().tintIndex(-1).bake()); - quads.add(FaceQuad.builder(side, ModelFactory.getBlockSprite(GTCEu.id("block/cable/wire"))).cube(cube).cubeUV().tintIndex(-1).bake()); + quads.add(FaceQuad.builder(side, ModelFactory.getBlockSprite(GTCEu.id("block/cable/wire"))) + .cube(cube).cubeUV().tintIndex(-1).bake()); + quads.add(FaceQuad.builder(side, ModelFactory.getBlockSprite(GTCEu.id("block/cable/wire"))) + .cube(cube).cubeUV().tintIndex(-1).bake()); } } for (BakedQuad bakedQuad : quads) { - buffer.getBuffer(RenderType.cutout()).putBulkData(pose, bakedQuad, 1, 1, 1, combinedLight, combinedOverlay); + buffer.getBuffer(RenderType.cutout()).putBulkData(pose, bakedQuad, 1, 1, 1, combinedLight, + combinedOverlay); } matrixStack.popPose(); @@ -101,10 +108,11 @@ public void renderItem(ItemStack stack, ItemDisplayContext transformType, boolea } } - @Override @OnlyIn(Dist.CLIENT) - public void renderCover(List quads, Direction side, RandomSource rand, @NotNull CoverBehavior coverBehavior, Direction modelFacing, BlockPos pos, BlockAndTintGetter level, ModelState modelState) { + public void renderCover(List quads, Direction side, RandomSource rand, + @NotNull CoverBehavior coverBehavior, Direction modelFacing, BlockPos pos, + BlockAndTintGetter level, ModelState modelState) { if (coverBehavior instanceof FacadeCover facadeCover) { var state = facadeCover.getFacadeState(); if (state.getRenderShape() == RenderShape.MODEL) { @@ -121,7 +129,8 @@ public void renderCover(List quads, Direction side, RandomSource rand normal.getX() == 0 ? 1 : normal.getX() > 0 ? 1 : 0, normal.getY() == 0 ? 1 : normal.getY() > 0 ? 1 : 0, normal.getZ() == 0 ? 1 : normal.getZ() > 0 ? 1 : 0); - for (BakedQuad quad : ModelUtil.getBakedModelQuads(model, level, pos, state, coverBehavior.attachedSide, rand)) { + for (BakedQuad quad : ModelUtil.getBakedModelQuads(model, level, pos, state, + coverBehavior.attachedSide, rand)) { quads.add(FaceQuad.builder(coverBehavior.attachedSide.getOpposite(), quad.getSprite()) .cube(cube) .shade(quad.isShade()) @@ -132,5 +141,4 @@ public void renderCover(List quads, Direction side, RandomSource rand } } } - } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/FluidRegulatorCoverRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/FluidRegulatorCoverRenderer.java index 89f99f9524..65e202a222 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/FluidRegulatorCoverRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/FluidRegulatorCoverRenderer.java @@ -4,9 +4,11 @@ import com.gregtechceu.gtceu.api.capability.recipe.IO; import com.gregtechceu.gtceu.api.cover.CoverBehavior; import com.gregtechceu.gtceu.common.cover.PumpCover; + import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.client.bakedpipeline.FaceQuad; import com.lowdragmc.lowdraglib.client.model.ModelFactory; + import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.client.resources.model.ModelState; @@ -17,6 +19,7 @@ import net.minecraft.world.level.BlockAndTintGetter; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + import org.jetbrains.annotations.NotNull; import java.util.List; @@ -41,9 +44,13 @@ protected FluidRegulatorCoverRenderer() { @Override @OnlyIn(Dist.CLIENT) - public void renderCover(List quads, Direction side, RandomSource rand, @NotNull CoverBehavior coverBehavior, Direction modelFacing, BlockPos pos, BlockAndTintGetter level, ModelState modelState) { + public void renderCover(List quads, Direction side, RandomSource rand, + @NotNull CoverBehavior coverBehavior, Direction modelFacing, BlockPos pos, + BlockAndTintGetter level, ModelState modelState) { if (side == coverBehavior.attachedSide && coverBehavior instanceof PumpCover pump && modelFacing != null) { - quads.add(FaceQuad.bakeFace(modelFacing, ModelFactory.getBlockSprite(pump.getIo() == IO.OUT ? PUMP_OVERLAY_OUT : PUMP_OVERLAY_IN), modelState)); + quads.add(FaceQuad.bakeFace(modelFacing, + ModelFactory.getBlockSprite(pump.getIo() == IO.OUT ? PUMP_OVERLAY_OUT : PUMP_OVERLAY_IN), + modelState)); } } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/ICoverRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/ICoverRenderer.java index d6e4dbcd35..bf67108162 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/ICoverRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/ICoverRenderer.java @@ -1,7 +1,9 @@ package com.gregtechceu.gtceu.client.renderer.cover; import com.gregtechceu.gtceu.api.cover.CoverBehavior; + import com.lowdragmc.lowdraglib.client.renderer.IRenderer; + import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.resources.model.ModelState; import net.minecraft.core.BlockPos; @@ -11,6 +13,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -20,20 +23,25 @@ * @author KilaBash * @date 2023/2/24 * @implNote ICoverRenderer - * Do not use it as a block renderer alone. It should be called from {@link ICoverableRenderer} + * Do not use it as a block renderer alone. It should be called from {@link ICoverableRenderer} */ public interface ICoverRenderer extends IRenderer { /** - * Use {@link #renderCover(List, Direction, RandomSource, CoverBehavior, Direction, BlockPos, BlockAndTintGetter, ModelState)} instead + * Use + * {@link #renderCover(List, Direction, RandomSource, CoverBehavior, Direction, BlockPos, BlockAndTintGetter, ModelState)} + * instead */ @Override @Deprecated @OnlyIn(Dist.CLIENT) - default List renderModel(BlockAndTintGetter level, BlockPos pos, BlockState state, Direction side, RandomSource rand) { + default List renderModel(BlockAndTintGetter level, BlockPos pos, BlockState state, Direction side, + RandomSource rand) { return IRenderer.super.renderModel(level, pos, state, side, rand); } @OnlyIn(Dist.CLIENT) - void renderCover(List quads, @Nullable Direction side, RandomSource rand, @NotNull CoverBehavior coverBehavior, @Nullable Direction modelFacing, BlockPos pos, BlockAndTintGetter level, ModelState modelState); + void renderCover(List quads, @Nullable Direction side, RandomSource rand, + @NotNull CoverBehavior coverBehavior, @Nullable Direction modelFacing, BlockPos pos, + BlockAndTintGetter level, ModelState modelState); } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/ICoverableRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/ICoverableRenderer.java index 2a2dddd3cf..f2986b5d81 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/ICoverableRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/ICoverableRenderer.java @@ -4,9 +4,11 @@ import com.gregtechceu.gtceu.api.capability.GTCapabilityHelper; import com.gregtechceu.gtceu.api.capability.ICoverable; import com.gregtechceu.gtceu.utils.GTUtil; + import com.lowdragmc.lowdraglib.client.bakedpipeline.FaceQuad; import com.lowdragmc.lowdraglib.client.model.ModelFactory; import com.lowdragmc.lowdraglib.client.renderer.IRenderer; + import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.resources.model.ModelState; import net.minecraft.core.BlockPos; @@ -20,6 +22,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; + import java.util.LinkedList; import java.util.List; @@ -32,7 +35,8 @@ public interface ICoverableRenderer extends IRenderer { @Override @OnlyIn(Dist.CLIENT) - default List renderModel(BlockAndTintGetter level, BlockPos pos, BlockState state, Direction side, RandomSource rand) { + default List renderModel(BlockAndTintGetter level, BlockPos pos, BlockState state, Direction side, + RandomSource rand) { var blockEntity = level == null ? null : level.getBlockEntity(pos); if (blockEntity != null) { var coverable = GTCapabilityHelper.getCoverable(blockEntity.getLevel(), blockEntity.getBlockPos(), null); @@ -48,7 +52,9 @@ default List renderModel(BlockAndTintGetter level, BlockPos pos, Bloc } @OnlyIn(Dist.CLIENT) - default void renderCovers(List quads, @Nullable Direction side, RandomSource rand, @NotNull ICoverable coverable, @Nullable Direction modelFacing, BlockPos pos, BlockAndTintGetter level, ModelState modelState) { + default void renderCovers(List quads, @Nullable Direction side, RandomSource rand, + @NotNull ICoverable coverable, @Nullable Direction modelFacing, BlockPos pos, + BlockAndTintGetter level, ModelState modelState) { var thickness = coverable.getCoverPlateThickness(); for (Direction face : GTUtil.DIRECTIONS) { var cover = coverable.getCoverAtSide(face); @@ -65,14 +71,19 @@ default void renderCovers(List quads, @Nullable Direction side, Rando normal.getY() == 0 ? 0.999 : normal.getY() > 0 ? 0.999 : min, normal.getZ() == 0 ? 0.999 : normal.getZ() > 0 ? 0.999 : min); if (side == null) { // render back - quads.add(FaceQuad.builder(face.getOpposite(), ModelFactory.getBlockSprite(GTCEu.id("block/material_sets/dull/wire_side"))).cube(cube).cubeUV().tintIndex(-1).bake()); - } else if (side != face.getOpposite()){ // render sides - quads.add(FaceQuad.builder(side, ModelFactory.getBlockSprite(GTCEu.id("block/material_sets/dull/wire_side"))).cube(cube).cubeUV().tintIndex(-1).bake()); + quads.add(FaceQuad + .builder(face.getOpposite(), + ModelFactory.getBlockSprite(GTCEu.id("block/material_sets/dull/wire_side"))) + .cube(cube).cubeUV().tintIndex(-1).bake()); + } else if (side != face.getOpposite()) { // render sides + quads.add(FaceQuad + .builder(side, + ModelFactory.getBlockSprite(GTCEu.id("block/material_sets/dull/wire_side"))) + .cube(cube).cubeUV().tintIndex(-1).bake()); } } cover.getCoverRenderer().renderCover(quads, side, rand, cover, modelFacing, pos, level, modelState); } } } - } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/PumpCoverRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/PumpCoverRenderer.java index af6e0bd4eb..79a3fabed2 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/PumpCoverRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/PumpCoverRenderer.java @@ -1,12 +1,14 @@ package com.gregtechceu.gtceu.client.renderer.cover; import com.gregtechceu.gtceu.GTCEu; +import com.gregtechceu.gtceu.api.capability.recipe.IO; import com.gregtechceu.gtceu.api.cover.CoverBehavior; import com.gregtechceu.gtceu.common.cover.PumpCover; -import com.gregtechceu.gtceu.api.capability.recipe.IO; + import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.client.bakedpipeline.FaceQuad; import com.lowdragmc.lowdraglib.client.model.ModelFactory; + import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.client.resources.model.ModelState; @@ -17,6 +19,7 @@ import net.minecraft.world.level.BlockAndTintGetter; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + import org.jetbrains.annotations.NotNull; import java.util.List; @@ -41,9 +44,13 @@ protected PumpCoverRenderer() { @Override @OnlyIn(Dist.CLIENT) - public void renderCover(List quads, Direction side, RandomSource rand, @NotNull CoverBehavior coverBehavior, Direction modelFacing, BlockPos pos, BlockAndTintGetter level, ModelState modelState) { + public void renderCover(List quads, Direction side, RandomSource rand, + @NotNull CoverBehavior coverBehavior, Direction modelFacing, BlockPos pos, + BlockAndTintGetter level, ModelState modelState) { if (side == coverBehavior.attachedSide && coverBehavior instanceof PumpCover pump && modelFacing != null) { - quads.add(FaceQuad.bakeFace(modelFacing, ModelFactory.getBlockSprite(pump.getIo() == IO.OUT ? PUMP_OVERLAY_OUT : PUMP_OVERLAY_IN), modelState)); + quads.add(FaceQuad.bakeFace(modelFacing, + ModelFactory.getBlockSprite(pump.getIo() == IO.OUT ? PUMP_OVERLAY_OUT : PUMP_OVERLAY_IN), + modelState)); } } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/RobotArmCoverRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/RobotArmCoverRenderer.java index f84482b2ce..73706124ae 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/RobotArmCoverRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/RobotArmCoverRenderer.java @@ -1,13 +1,14 @@ package com.gregtechceu.gtceu.client.renderer.cover; - import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.capability.recipe.IO; import com.gregtechceu.gtceu.api.cover.CoverBehavior; import com.gregtechceu.gtceu.common.cover.RobotArmCover; + import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.client.bakedpipeline.FaceQuad; import com.lowdragmc.lowdraglib.client.model.ModelFactory; + import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.client.resources.model.ModelState; @@ -18,6 +19,7 @@ import net.minecraft.world.level.BlockAndTintGetter; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -39,10 +41,15 @@ protected RobotArmCoverRenderer() { @Override @OnlyIn(Dist.CLIENT) - public void renderCover(List quads, @Nullable Direction side, RandomSource rand, @NotNull CoverBehavior coverBehavior, @Nullable Direction modelFacing, BlockPos pos, BlockAndTintGetter level, ModelState modelState) { - if (side == coverBehavior.attachedSide && coverBehavior instanceof RobotArmCover robotArm && modelFacing != null) { + public void renderCover(List quads, @Nullable Direction side, RandomSource rand, + @NotNull CoverBehavior coverBehavior, @Nullable Direction modelFacing, BlockPos pos, + BlockAndTintGetter level, ModelState modelState) { + if (side == coverBehavior.attachedSide && coverBehavior instanceof RobotArmCover robotArm && + modelFacing != null) { quads.add(FaceQuad.bakeFace(modelFacing, ModelFactory.getBlockSprite(ARM_OVERLAY), modelState)); - quads.add(FaceQuad.bakeFace(modelFacing, ModelFactory.getBlockSprite(robotArm.getIo() == IO.OUT ? ARM_OVERLAY_OUT : AR_OVERLAY_IN), modelState, -101, 15)); + quads.add(FaceQuad.bakeFace(modelFacing, + ModelFactory.getBlockSprite(robotArm.getIo() == IO.OUT ? ARM_OVERLAY_OUT : AR_OVERLAY_IN), + modelState, -101, 15)); } } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/SimpleCoverRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/SimpleCoverRenderer.java index a2d6772d56..28058e71e9 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/SimpleCoverRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/cover/SimpleCoverRenderer.java @@ -1,10 +1,12 @@ package com.gregtechceu.gtceu.client.renderer.cover; import com.gregtechceu.gtceu.api.cover.CoverBehavior; + import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.client.bakedpipeline.FaceQuad; import com.lowdragmc.lowdraglib.client.model.ModelFactory; import com.lowdragmc.lowdraglib.utils.ResourceHelper; + import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.client.resources.model.ModelState; @@ -15,6 +17,7 @@ import net.minecraft.world.level.BlockAndTintGetter; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + import org.jetbrains.annotations.NotNull; import java.util.List; @@ -43,12 +46,15 @@ public void onPrepareTextureAtlas(ResourceLocation atlasName, Consumer quads, Direction side, RandomSource rand, @NotNull CoverBehavior coverBehavior, Direction modelFacing, BlockPos pos, BlockAndTintGetter level, ModelState modelState) { + public void renderCover(List quads, Direction side, RandomSource rand, + @NotNull CoverBehavior coverBehavior, Direction modelFacing, BlockPos pos, + BlockAndTintGetter level, ModelState modelState) { if (side == coverBehavior.attachedSide && modelFacing != null) { quads.add(FaceQuad.bakeFace(modelFacing, ModelFactory.getBlockSprite(texture), modelState)); if (emissiveTexture != null) { @@ -56,5 +62,4 @@ public void renderCover(List quads, Direction side, RandomSource rand } } } - } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/entity/GTExplosiveRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/entity/GTExplosiveRenderer.java index d01f297470..e48cd88a5a 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/entity/GTExplosiveRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/entity/GTExplosiveRenderer.java @@ -1,8 +1,7 @@ package com.gregtechceu.gtceu.client.renderer.entity; import com.gregtechceu.gtceu.common.entity.GTExplosiveEntity; -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.math.Axis; + import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.block.BlockRenderDispatcher; import net.minecraft.client.renderer.entity.EntityRenderer; @@ -13,10 +12,14 @@ import net.minecraft.world.inventory.InventoryMenu; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.math.Axis; import org.jetbrains.annotations.NotNull; @OnlyIn(Dist.CLIENT) public class GTExplosiveRenderer extends EntityRenderer { + private final BlockRenderDispatcher blockRenderer; public GTExplosiveRenderer(EntityRendererProvider.Context context) { @@ -26,12 +29,13 @@ public GTExplosiveRenderer(EntityRendererProvider.Context context) { } @Override - public void render(@NotNull T entity, float entityYaw, float partialTicks, PoseStack poseStack, @NotNull MultiBufferSource buffer, int packedLight) { + public void render(@NotNull T entity, float entityYaw, float partialTicks, PoseStack poseStack, + @NotNull MultiBufferSource buffer, int packedLight) { poseStack.pushPose(); poseStack.translate(0.0F, 0.5F, 0.0F); int fuseTime = entity.getFuse(); - if ((float)fuseTime - partialTicks + 1.0F < 10.0F) { - float size = 1.0F - ((float)fuseTime - partialTicks + 1.0F) / 10.0F; + if ((float) fuseTime - partialTicks + 1.0F < 10.0F) { + float size = 1.0F - ((float) fuseTime - partialTicks + 1.0F) / 10.0F; size = Mth.clamp(size, 0.0F, 1.0F); size *= size; size *= size; @@ -42,7 +46,8 @@ public void render(@NotNull T entity, float entityYaw, float partialTicks, PoseS poseStack.mulPose(Axis.YP.rotationDegrees(-90.0F)); poseStack.translate(-0.5F, -0.5F, 0.5F); poseStack.mulPose(Axis.YP.rotationDegrees(90.0F)); - TntMinecartRenderer.renderWhiteSolidBlock(this.blockRenderer, entity.getExplosiveState(), poseStack, buffer, packedLight, fuseTime / 5 % 2 == 0); + TntMinecartRenderer.renderWhiteSolidBlock(this.blockRenderer, entity.getExplosiveState(), poseStack, buffer, + packedLight, fuseTime / 5 % 2 == 0); poseStack.popPose(); super.render(entity, entityYaw, partialTicks, poseStack, buffer, packedLight); } @@ -52,4 +57,4 @@ public void render(@NotNull T entity, float entityYaw, float partialTicks, PoseS public ResourceLocation getTextureLocation(@NotNull T entity) { return InventoryMenu.BLOCK_ATLAS; } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/item/TagPrefixItemRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/item/TagPrefixItemRenderer.java index 0ea9369c95..94d519edad 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/item/TagPrefixItemRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/item/TagPrefixItemRenderer.java @@ -5,7 +5,7 @@ import com.gregtechceu.gtceu.api.item.TagPrefixItem; import com.gregtechceu.gtceu.data.pack.GTDynamicResourcePack; import com.gregtechceu.gtceu.utils.GradientUtil; -import com.mojang.blaze3d.platform.NativeImage; + import net.minecraft.client.Minecraft; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.data.models.model.DelegatedModel; @@ -13,6 +13,8 @@ import net.minecraft.server.packs.resources.Resource; import net.minecraft.world.item.Item; +import com.mojang.blaze3d.platform.NativeImage; + import java.io.IOException; import java.io.InputStream; import java.util.HashSet; @@ -26,6 +28,7 @@ * @implNote TagPrefixItemRenderer */ public class TagPrefixItemRenderer { + private static final Set MODELS = new HashSet<>(); public static void create(Item item, MaterialIconType type, MaterialIconSet iconSet) { @@ -35,8 +38,10 @@ public static void create(Item item, MaterialIconType type, MaterialIconSet icon public static void reinitModels() { for (TagPrefixItemRenderer model : MODELS) { ResourceLocation itemId = BuiltInRegistries.ITEM.getKey(model.item); - GTDynamicResourcePack.addItemModel(itemId, new DelegatedModel(model.type.getItemModelPath(model.iconSet, true))); - //ModelTemplates.FLAT_ITEM.create(GTDynamicResourcePack.getItemModelLocation(itemId), TextureMapping.layer0(itemId.withPrefix("item/")), GTDynamicResourcePack::addItemModel); + GTDynamicResourcePack.addItemModel(itemId, + new DelegatedModel(model.type.getItemModelPath(model.iconSet, true))); + // ModelTemplates.FLAT_ITEM.create(GTDynamicResourcePack.getItemModelLocation(itemId), + // TextureMapping.layer0(itemId.withPrefix("item/")), GTDynamicResourcePack::addItemModel); } } @@ -44,9 +49,12 @@ public static void initTextures() { for (TagPrefixItemRenderer model : MODELS) { ResourceLocation itemId = BuiltInRegistries.ITEM.getKey(model.item); - Resource file1 = Minecraft.getInstance().getResourceManager().getResource(GTDynamicResourcePack.getTextureLocation(null, model.type.getItemTexturePath(model.iconSet, true)/*.withSuffix("_layer1")*/)).orElse(null); + Resource file1 = Minecraft.getInstance().getResourceManager() + .getResource(GTDynamicResourcePack.getTextureLocation(null, + model.type.getItemTexturePath(model.iconSet, true)/* .withSuffix("_layer1") */)) + .orElse(null); if (file1 == null) continue; - try(InputStream stream1 = file1.open()) { + try (InputStream stream1 = file1.open()) { if (!(model.item instanceof TagPrefixItem prefixItem)) continue; int materialRGBA = GradientUtil.argbToRgba(prefixItem.material.getMaterialARGB()); int materialSecondaryRGBA = GradientUtil.argbToRgba(prefixItem.material.getMaterialSecondaryARGB()); @@ -60,14 +68,18 @@ public static void initTextures() { } } if (prefixItem.material.getMaterialSecondaryARGB() != -1) { - Resource file2 = Minecraft.getInstance().getResourceManager().getResource(GTDynamicResourcePack.getTextureLocation(null, model.type.getItemTexturePath(model.iconSet, true).withSuffix(LAYER_2_SUFFIX))).orElse(null); + Resource file2 = Minecraft.getInstance().getResourceManager() + .getResource(GTDynamicResourcePack.getTextureLocation(null, + model.type.getItemTexturePath(model.iconSet, true).withSuffix(LAYER_2_SUFFIX))) + .orElse(null); if (file2 != null) { - try(InputStream stream2 = file2.open()) { + try (InputStream stream2 = file2.open()) { NativeImage image2 = NativeImage.read(stream2); for (int x = 0; x < image1.getWidth(); ++x) { for (int y = 0; y < image1.getHeight(); ++y) { int color = image2.getPixelRGBA(x, y); - result.blendPixel(x, y, GradientUtil.multiplyBlendRGBA(color, materialSecondaryRGBA)); + result.blendPixel(x, y, + GradientUtil.multiplyBlendRGBA(color, materialSecondaryRGBA)); } } } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/item/ToolItemRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/item/ToolItemRenderer.java index a82875c9d4..4fd47be00f 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/item/ToolItemRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/item/ToolItemRenderer.java @@ -2,6 +2,7 @@ import com.gregtechceu.gtceu.api.item.tool.GTToolType; import com.gregtechceu.gtceu.data.pack.GTDynamicResourcePack; + import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.data.models.model.DelegatedModel; import net.minecraft.world.item.Item; @@ -15,11 +16,13 @@ * @implNote TagPrefixItemRenderer */ public class ToolItemRenderer { + private static final Set MODELS = new HashSet<>(); public static void reinitModels() { for (ToolItemRenderer model : MODELS) { - GTDynamicResourcePack.addItemModel(BuiltInRegistries.ITEM.getKey(model.item), new DelegatedModel(model.toolType.modelLocation)); + GTDynamicResourcePack.addItemModel(BuiltInRegistries.ITEM.getKey(model.item), + new DelegatedModel(model.toolType.modelLocation)); } } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/BatteryBufferRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/BatteryBufferRenderer.java index d3e21deb2d..3694a538d9 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/BatteryBufferRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/BatteryBufferRenderer.java @@ -1,16 +1,19 @@ package com.gregtechceu.gtceu.client.renderer.machine; import com.gregtechceu.gtceu.GTCEu; -import com.gregtechceu.gtceu.api.machine.MetaMachine; import com.gregtechceu.gtceu.api.machine.MachineDefinition; +import com.gregtechceu.gtceu.api.machine.MetaMachine; + import com.lowdragmc.lowdraglib.client.bakedpipeline.FaceQuad; import com.lowdragmc.lowdraglib.client.model.ModelFactory; + import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.resources.model.ModelState; import net.minecraft.core.Direction; import net.minecraft.util.RandomSource; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + import org.jetbrains.annotations.Nullable; import java.util.List; @@ -20,7 +23,8 @@ * @date 2023/3/10 * @implNote TransformerRenderer */ -public class BatteryBufferRenderer extends TieredHullMachineRenderer{ +public class BatteryBufferRenderer extends TieredHullMachineRenderer { + private final int inventorySize; public BatteryBufferRenderer(int tier, int inventorySize) { @@ -30,7 +34,9 @@ public BatteryBufferRenderer(int tier, int inventorySize) { @Override @OnlyIn(Dist.CLIENT) - public void renderMachine(List quads, MachineDefinition definition, @Nullable MetaMachine machine, Direction frontFacing, @Nullable Direction side, RandomSource rand, Direction modelFacing, ModelState modelState) { + public void renderMachine(List quads, MachineDefinition definition, @Nullable MetaMachine machine, + Direction frontFacing, @Nullable Direction side, RandomSource rand, Direction modelFacing, + ModelState modelState) { super.renderMachine(quads, definition, machine, frontFacing, side, rand, modelFacing, modelState); if (side == frontFacing && modelFacing != null) { var texture = inventorySize <= 4 ? TransformerRenderer.ENERGY_OUT : @@ -39,5 +45,4 @@ public void renderMachine(List quads, MachineDefinition definition, @ quads.add(FaceQuad.bakeFace(modelFacing, ModelFactory.getBlockSprite(texture), modelState, 2)); } } - } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/ChargerRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/ChargerRenderer.java index d17f10c3fb..3ef11e566f 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/ChargerRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/ChargerRenderer.java @@ -5,8 +5,10 @@ import com.gregtechceu.gtceu.api.machine.MetaMachine; import com.gregtechceu.gtceu.common.machine.electric.ChargerMachine; import com.gregtechceu.gtceu.config.ConfigHolder; + import com.lowdragmc.lowdraglib.client.bakedpipeline.FaceQuad; import com.lowdragmc.lowdraglib.client.model.ModelFactory; + import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.client.resources.model.ModelState; @@ -15,6 +17,7 @@ import net.minecraft.util.RandomSource; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + import org.jetbrains.annotations.Nullable; import java.util.*; @@ -25,12 +28,15 @@ * @date 2023/7/13 * @implNote ChargerRenderer */ -public class ChargerRenderer extends TieredHullMachineRenderer{ +public class ChargerRenderer extends TieredHullMachineRenderer { + public final static ResourceLocation CHARGER_IDLE = GTCEu.id("block/machines/charger/overlay_charger_idle"); public final static ResourceLocation CHARGER_RUNNING = GTCEu.id("block/machines/charger/overlay_charger_running"); - public final static ResourceLocation CHARGER_RUNNING_EMISSIVE = GTCEu.id("block/machines/charger/overlay_charger_running_emissive"); + public final static ResourceLocation CHARGER_RUNNING_EMISSIVE = GTCEu + .id("block/machines/charger/overlay_charger_running_emissive"); public final static ResourceLocation CHARGER_FINISHED = GTCEu.id("block/machines/charger/overlay_charger_finished"); - public final static ResourceLocation CHARGER_FINISHED_EMISSIVE = GTCEu.id("block/machines/charger/overlay_charger_finished_emissive"); + public final static ResourceLocation CHARGER_FINISHED_EMISSIVE = GTCEu + .id("block/machines/charger/overlay_charger_finished_emissive"); public ChargerRenderer(int tier) { super(tier, GTCEu.id("block/machine/hull_machine")); @@ -38,7 +44,9 @@ public ChargerRenderer(int tier) { @Override @OnlyIn(Dist.CLIENT) - public void renderMachine(List quads, MachineDefinition definition, @Nullable MetaMachine machine, Direction frontFacing, @Nullable Direction side, RandomSource rand, Direction modelFacing, ModelState modelState) { + public void renderMachine(List quads, MachineDefinition definition, @Nullable MetaMachine machine, + Direction frontFacing, @Nullable Direction side, RandomSource rand, Direction modelFacing, + ModelState modelState) { super.renderMachine(quads, definition, machine, frontFacing, side, rand, modelFacing, modelState); var state = ChargerMachine.State.IDLE; if (machine instanceof ChargerMachine charger) { @@ -48,17 +56,24 @@ public void renderMachine(List quads, MachineDefinition definition, @ if (side == frontFacing && modelFacing != null) { var bakedFaces = new ArrayList(); switch (state) { - case IDLE -> bakedFaces.add(FaceQuad.bakeFace(modelFacing, ModelFactory.getBlockSprite(CHARGER_IDLE), modelState, -1, 0, false, true)); + case IDLE -> bakedFaces.add(FaceQuad.bakeFace(modelFacing, ModelFactory.getBlockSprite(CHARGER_IDLE), + modelState, -1, 0, false, true)); case RUNNING -> { - bakedFaces.add(FaceQuad.bakeFace(modelFacing, ModelFactory.getBlockSprite(CHARGER_RUNNING), modelState, -1, 0, true, true)); + bakedFaces.add(FaceQuad.bakeFace(modelFacing, ModelFactory.getBlockSprite(CHARGER_RUNNING), + modelState, -1, 0, true, true)); if (ConfigHolder.INSTANCE.client.machinesEmissiveTextures) { - bakedFaces.add(FaceQuad.bakeFace(modelFacing, ModelFactory.getBlockSprite(CHARGER_RUNNING_EMISSIVE), modelState, -101, 15, true, false)); + bakedFaces.add( + FaceQuad.bakeFace(modelFacing, ModelFactory.getBlockSprite(CHARGER_RUNNING_EMISSIVE), + modelState, -101, 15, true, false)); } } case FINISHED -> { - bakedFaces.add(FaceQuad.bakeFace(modelFacing, ModelFactory.getBlockSprite(CHARGER_FINISHED), modelState, -1, 0, true, true)); + bakedFaces.add(FaceQuad.bakeFace(modelFacing, ModelFactory.getBlockSprite(CHARGER_FINISHED), + modelState, -1, 0, true, true)); if (ConfigHolder.INSTANCE.client.machinesEmissiveTextures) { - bakedFaces.add(FaceQuad.bakeFace(modelFacing, ModelFactory.getBlockSprite(CHARGER_FINISHED_EMISSIVE), modelState, -101, 15, true, false)); + bakedFaces.add( + FaceQuad.bakeFace(modelFacing, ModelFactory.getBlockSprite(CHARGER_FINISHED_EMISSIVE), + modelState, -101, 15, true, false)); } } } @@ -79,5 +94,4 @@ public void onPrepareTextureAtlas(ResourceLocation atlasName, Consumer quads, MachineDefinition definition, @Nullable MetaMachine machine, Direction frontFacing, @Nullable Direction side, RandomSource rand, Direction modelFacing, ModelState modelState) { + public void renderMachine(List quads, MachineDefinition definition, @Nullable MetaMachine machine, + Direction frontFacing, @Nullable Direction side, RandomSource rand, Direction modelFacing, + ModelState modelState) { super.renderMachine(quads, definition, machine, frontFacing, side, rand, modelFacing, modelState); var otherFaceTexture = ENERGY_IN; var frontFaceTexture = CONVERTER_NATIVE_OUT; diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/HPCAPartRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/HPCAPartRenderer.java index e45601d1ff..21baac7154 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/HPCAPartRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/HPCAPartRenderer.java @@ -8,29 +8,34 @@ import com.gregtechceu.gtceu.api.pattern.util.RelativeDirection; import com.gregtechceu.gtceu.common.machine.multiblock.electric.research.HPCAMachine; import com.gregtechceu.gtceu.common.machine.multiblock.part.hpca.HPCAComponentPartMachine; + import com.lowdragmc.lowdraglib.client.bakedpipeline.FaceQuad; import com.lowdragmc.lowdraglib.client.model.ModelFactory; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.texture.MissingTextureAtlasSprite; import net.minecraft.client.resources.model.ModelState; import net.minecraft.core.Direction; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.RandomSource; + import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.List; +import javax.annotation.ParametersAreNonnullByDefault; + @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault public class HPCAPartRenderer extends TieredHullMachineRenderer { private final boolean isAdvanced; - private final ResourceLocation texture, activeTexture, activeEmissiveTexture, damagedTexture, damagedActiveTexture, damagedActiveEmissiveTexture; + private final ResourceLocation texture, activeTexture, activeEmissiveTexture, damagedTexture, damagedActiveTexture, + damagedActiveEmissiveTexture; public HPCAPartRenderer(boolean isAdvanced, ResourceLocation texture, ResourceLocation damagedTexture) { - super(GTValues.ZPM, isAdvanced ? GTCEu.id("block/computer_casing") : GTCEu.id("block/advanced_computer_casing")); + super(GTValues.ZPM, + isAdvanced ? GTCEu.id("block/computer_casing") : GTCEu.id("block/advanced_computer_casing")); this.isAdvanced = isAdvanced; this.texture = texture; this.activeTexture = texture.withSuffix("_active"); @@ -42,12 +47,13 @@ public HPCAPartRenderer(boolean isAdvanced, ResourceLocation texture, ResourceLo public HPCAPartRenderer(boolean isAdvanced, ResourceLocation texture, - @Nullable ResourceLocation activeTexture, + @Nullable ResourceLocation activeTexture, @Nullable ResourceLocation activeEmissiveTexture, @Nullable ResourceLocation damagedTexture, @Nullable ResourceLocation damagedActiveTexture, @Nullable ResourceLocation damagedActiveEmissiveTexture) { - super(GTValues.ZPM, isAdvanced ? GTCEu.id("block/computer_casing") : GTCEu.id("block/advanced_computer_casing")); + super(GTValues.ZPM, + isAdvanced ? GTCEu.id("block/computer_casing") : GTCEu.id("block/advanced_computer_casing")); this.isAdvanced = isAdvanced; this.texture = texture; this.activeTexture = activeTexture; @@ -58,7 +64,9 @@ public HPCAPartRenderer(boolean isAdvanced, } @Override - public void renderMachine(List quads, MachineDefinition definition, @Nullable MetaMachine machine, Direction frontFacing, @Nullable Direction side, RandomSource rand, @Nullable Direction modelFacing, ModelState modelState) { + public void renderMachine(List quads, MachineDefinition definition, @Nullable MetaMachine machine, + Direction frontFacing, @Nullable Direction side, RandomSource rand, + @Nullable Direction modelFacing, ModelState modelState) { super.renderMachine(quads, definition, machine, frontFacing, side, rand, modelFacing, modelState); if (machine instanceof HPCAComponentPartMachine hpcaComponent) { ResourceLocation texture, emissiveTexture = null; @@ -89,15 +97,18 @@ public void renderMachine(List quads, MachineDefinition definition, @ facing = RelativeDirection.RIGHT.getRelativeFacing(hpca.getFrontFacing(), Direction.NORTH, false); } facing = ModelFactory.modelFacing(frontFacing, facing); - quads.add(FaceQuad.bakeFace(FaceQuad.BLOCK, facing, ModelFactory.getBlockSprite(texture), modelState, -1, 0, true, true)); + quads.add(FaceQuad.bakeFace(FaceQuad.BLOCK, facing, ModelFactory.getBlockSprite(texture), modelState, + -1, 0, true, true)); if (emissiveTexture != null) { - quads.add(FaceQuad.bakeFace(FaceQuad.BLOCK, facing, ModelFactory.getBlockSprite(emissiveTexture), modelState, -101, 15, true, false)); + quads.add(FaceQuad.bakeFace(FaceQuad.BLOCK, facing, ModelFactory.getBlockSprite(emissiveTexture), + modelState, -101, 15, true, false)); } } } else { ResourceLocation texture = this.texture; if (texture != null) { - quads.add(FaceQuad.bakeFace(FaceQuad.BLOCK, Direction.NORTH, ModelFactory.getBlockSprite(texture), modelState, -1, 0, true, true)); + quads.add(FaceQuad.bakeFace(FaceQuad.BLOCK, Direction.NORTH, ModelFactory.getBlockSprite(texture), + modelState, -1, 0, true, true)); } } } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/IControllerRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/IControllerRenderer.java index 5ca603127d..b8d2c4b0c6 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/IControllerRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/IControllerRenderer.java @@ -1,7 +1,8 @@ package com.gregtechceu.gtceu.client.renderer.machine; -import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiPart; import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiController; +import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiPart; + import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.resources.model.ModelState; import net.minecraft.core.Direction; @@ -10,6 +11,7 @@ import net.minecraftforge.api.distmarker.OnlyIn; import org.jetbrains.annotations.Nullable; + import java.util.List; /** @@ -18,10 +20,11 @@ * @implNote IControllerRenderer */ public interface IControllerRenderer { + /** * Render a specific model for given part. */ @OnlyIn(Dist.CLIENT) - void renderPartModel(List quads, IMultiController machine, IMultiPart part, Direction frontFacing, @Nullable Direction side, RandomSource rand, Direction modelFacing, ModelState modelState); - + void renderPartModel(List quads, IMultiController machine, IMultiPart part, Direction frontFacing, + @Nullable Direction side, RandomSource rand, Direction modelFacing, ModelState modelState); } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/IKineticMachineRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/IKineticMachineRenderer.java index b1ddefa52e..e8f2ad111f 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/IKineticMachineRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/IKineticMachineRenderer.java @@ -1,12 +1,9 @@ package com.gregtechceu.gtceu.client.renderer.machine; import com.gregtechceu.gtceu.common.blockentity.KineticMachineBlockEntity; -import com.jozufozu.flywheel.backend.Backend; + import com.lowdragmc.lowdraglib.client.renderer.IRenderer; -import com.mojang.blaze3d.vertex.PoseStack; -import com.simibubi.create.content.kinetics.base.KineticBlockEntityRenderer; -import com.simibubi.create.foundation.render.CachedBufferer; -import com.simibubi.create.foundation.render.SuperByteBuffer; + import net.minecraft.client.renderer.ItemBlockRenderTypes; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; @@ -16,13 +13,19 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; +import com.jozufozu.flywheel.backend.Backend; +import com.mojang.blaze3d.vertex.PoseStack; +import com.simibubi.create.content.kinetics.base.KineticBlockEntityRenderer; +import com.simibubi.create.foundation.render.CachedBufferer; +import com.simibubi.create.foundation.render.SuperByteBuffer; + /** * @author KilaBash * @date 2023/3/31 * @implNote KineticMachineRenderer */ public interface IKineticMachineRenderer extends IRenderer { - + default boolean isInvalid(BlockEntity te) { return !te.hasLevel() || te.getBlockState().getBlock() == Blocks.AIR; } @@ -39,7 +42,8 @@ default boolean hasTESR(BlockEntity blockEntity) { @Override @OnlyIn(Dist.CLIENT) - default void render(BlockEntity blockEntity, float partialTicks, PoseStack stack, MultiBufferSource buffer, int combinedLight, int combinedOverlay) { + default void render(BlockEntity blockEntity, float partialTicks, PoseStack stack, MultiBufferSource buffer, + int combinedLight, int combinedOverlay) { if (isInvalid(blockEntity)) return; if (blockEntity instanceof KineticMachineBlockEntity kineticMachineBlockEntity) { renderSafe(kineticMachineBlockEntity, partialTicks, stack, buffer, combinedLight, combinedOverlay); @@ -47,13 +51,15 @@ default void render(BlockEntity blockEntity, float partialTicks, PoseStack stack } @OnlyIn(Dist.CLIENT) - default void renderSafe(KineticMachineBlockEntity te, float partialTicks, PoseStack ms, MultiBufferSource bufferSource, int light, int overlay) { - if (Backend.canUseInstancing(te.getLevel())) return; - BlockState state = getRenderedBlockState(te); - RenderType type = getRenderType(te, state); - if (type != null) { - KineticBlockEntityRenderer.renderRotatingBuffer(te, getRotatedModel(te, state), ms, bufferSource.getBuffer(type), light); - } + default void renderSafe(KineticMachineBlockEntity te, float partialTicks, PoseStack ms, + MultiBufferSource bufferSource, int light, int overlay) { + if (Backend.canUseInstancing(te.getLevel())) return; + BlockState state = getRenderedBlockState(te); + RenderType type = getRenderType(te, state); + if (type != null) { + KineticBlockEntityRenderer.renderRotatingBuffer(te, getRotatedModel(te, state), ms, + bufferSource.getBuffer(type), light); + } } @OnlyIn(Dist.CLIENT) @@ -65,6 +71,4 @@ default RenderType getRenderType(KineticMachineBlockEntity te, BlockState state) default SuperByteBuffer getRotatedModel(KineticMachineBlockEntity te, BlockState state) { return CachedBufferer.block(KineticBlockEntityRenderer.KINETIC_BLOCK, state); } - - } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/IPartRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/IPartRenderer.java index edadfb6718..03ecd1e6eb 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/IPartRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/IPartRenderer.java @@ -3,6 +3,7 @@ import com.gregtechceu.gtceu.api.block.MetaMachineBlock; import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiController; import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiPart; + import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.resources.model.ModelState; import net.minecraft.core.Direction; @@ -11,6 +12,7 @@ import net.minecraftforge.api.distmarker.OnlyIn; import org.jetbrains.annotations.Nullable; + import java.util.List; /** @@ -19,27 +21,32 @@ * @implNote IPartRenderer */ public interface IPartRenderer { + /** * Render part according to its controllers. + * * @return whether its model has been replaced with controller's model */ @OnlyIn(Dist.CLIENT) - default boolean renderReplacedPartMachine(List quads, IMultiPart part, Direction frontFacing, @Nullable Direction side, RandomSource rand, Direction modelFacing, ModelState modelState) { + default boolean renderReplacedPartMachine(List quads, IMultiPart part, Direction frontFacing, + @Nullable Direction side, RandomSource rand, Direction modelFacing, + ModelState modelState) { var controllers = part.getControllers(); for (IMultiController controller : controllers) { var state = controller.self().getBlockState(); if (state.getBlock() instanceof MetaMachineBlock block) { var renderer = block.definition.getRenderer(); if (renderer instanceof IControllerRenderer controllerRenderer) { - controllerRenderer.renderPartModel(quads, controller, part, frontFacing, side, rand, modelFacing, modelState); + controllerRenderer.renderPartModel(quads, controller, part, frontFacing, side, rand, modelFacing, + modelState); return true; } else if (renderer instanceof MachineRenderer machineRenderer) { - machineRenderer.renderBaseModel(quads, block.definition, controller.self(), frontFacing, side, rand); + machineRenderer.renderBaseModel(quads, block.definition, controller.self(), frontFacing, side, + rand); return true; } } } return false; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/ISplitShaftRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/ISplitShaftRenderer.java index 76bd433f4c..97fc3207f8 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/ISplitShaftRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/ISplitShaftRenderer.java @@ -2,6 +2,15 @@ import com.gregtechceu.gtceu.common.blockentity.KineticMachineBlockEntity; import com.gregtechceu.gtceu.common.machine.kinetic.IKineticMachine; + +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.level.block.Block; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + import com.jozufozu.flywheel.backend.Backend; import com.mojang.blaze3d.vertex.PoseStack; import com.simibubi.create.AllPartialModels; @@ -11,13 +20,6 @@ import com.simibubi.create.foundation.render.SuperByteBuffer; import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.Iterate; -import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.RenderType; -import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; -import net.minecraft.world.level.block.Block; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; /** * @author KilaBash @@ -28,10 +30,11 @@ public interface ISplitShaftRenderer extends IKineticMachineRenderer { @Override @OnlyIn(Dist.CLIENT) - default void renderSafe(KineticMachineBlockEntity te, float partialTicks, PoseStack ms, MultiBufferSource bufferSource, int light, int overlay) { + default void renderSafe(KineticMachineBlockEntity te, float partialTicks, PoseStack ms, + MultiBufferSource bufferSource, int light, int overlay) { if (!Backend.canUseInstancing(te.getLevel())) { Block block = te.getBlockState().getBlock(); - Direction.Axis boxAxis = ((IRotate)block).getRotationAxis(te.getBlockState()); + Direction.Axis boxAxis = ((IRotate) block).getRotationAxis(te.getBlockState()); BlockPos pos = te.getBlockPos(); float time = AnimationTickHolder.getRenderTime(te.getLevel()); @@ -47,7 +50,8 @@ default void renderSafe(KineticMachineBlockEntity te, float partialTicks, PoseSt angle *= modifier; angle += offset; angle = angle / 180.0F * 3.1415927F; - SuperByteBuffer superByteBuffer = CachedBufferer.partialFacing(AllPartialModels.SHAFT_HALF, te.getBlockState(), direction); + SuperByteBuffer superByteBuffer = CachedBufferer.partialFacing(AllPartialModels.SHAFT_HALF, + te.getBlockState(), direction); KineticBlockEntityRenderer.kineticRotationTransform(superByteBuffer, te, axis, angle, light); superByteBuffer.renderInto(ms, bufferSource.getBuffer(RenderType.solid())); } @@ -55,5 +59,4 @@ default void renderSafe(KineticMachineBlockEntity te, float partialTicks, PoseSt } } - } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/KineticWorkableTieredHullMachineRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/KineticWorkableTieredHullMachineRenderer.java index 19f08371b4..db42ce65d5 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/KineticWorkableTieredHullMachineRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/KineticWorkableTieredHullMachineRenderer.java @@ -4,6 +4,7 @@ import com.gregtechceu.gtceu.api.machine.MachineDefinition; import com.gregtechceu.gtceu.api.machine.MetaMachine; import com.gregtechceu.gtceu.client.model.WorkableOverlayModel; + import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.client.resources.model.ModelState; @@ -14,6 +15,7 @@ import net.minecraftforge.api.distmarker.OnlyIn; import org.jetbrains.annotations.Nullable; + import java.util.List; import java.util.function.Consumer; @@ -22,17 +24,22 @@ * @date 2023/4/1 * @implNote ElectricGearBoxRenderer */ -public class KineticWorkableTieredHullMachineRenderer extends SplitShaftTieredHullMachineRenderer implements ISplitShaftRenderer { +public class KineticWorkableTieredHullMachineRenderer extends SplitShaftTieredHullMachineRenderer + implements ISplitShaftRenderer { + protected final WorkableOverlayModel overlayModel; - public KineticWorkableTieredHullMachineRenderer(int tier, ResourceLocation modelLocation, ResourceLocation overlayModel) { + public KineticWorkableTieredHullMachineRenderer(int tier, ResourceLocation modelLocation, + ResourceLocation overlayModel) { super(tier, modelLocation); this.overlayModel = new WorkableOverlayModel(overlayModel); } @Override @OnlyIn(Dist.CLIENT) - public void renderMachine(List quads, MachineDefinition definition, @Nullable MetaMachine machine, Direction frontFacing, @Nullable Direction side, RandomSource rand, Direction modelFacing, ModelState modelState) { + public void renderMachine(List quads, MachineDefinition definition, @Nullable MetaMachine machine, + Direction frontFacing, @Nullable Direction side, RandomSource rand, Direction modelFacing, + ModelState modelState) { super.renderMachine(quads, definition, machine, frontFacing, side, rand, modelFacing, modelState); if (machine instanceof IWorkable workable) { quads.addAll(overlayModel.bakeQuads(side, frontFacing, workable.isActive(), workable.isWorkingEnabled())); diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/LargeBoilerRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/LargeBoilerRenderer.java index 60817cec54..b06e219e4c 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/LargeBoilerRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/LargeBoilerRenderer.java @@ -1,12 +1,14 @@ package com.gregtechceu.gtceu.client.renderer.machine; import com.gregtechceu.gtceu.GTCEu; -import com.gregtechceu.gtceu.common.block.BoilerFireboxType; import com.gregtechceu.gtceu.api.machine.feature.IRecipeLogicMachine; import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiController; import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiPart; +import com.gregtechceu.gtceu.common.block.BoilerFireboxType; + import com.lowdragmc.lowdraglib.client.bakedpipeline.FaceQuad; import com.lowdragmc.lowdraglib.client.model.ModelFactory; + import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.resources.model.ModelState; import net.minecraft.core.Direction; @@ -14,6 +16,7 @@ import net.minecraft.util.RandomSource; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + import org.jetbrains.annotations.Nullable; import java.util.List; @@ -24,6 +27,7 @@ * @implNote LargeBoilerRenderer */ public class LargeBoilerRenderer extends WorkableCasingMachineRenderer implements IControllerRenderer { + public static final ResourceLocation BLOOM_OVERLAY = GTCEu.id("block/casings/firebox/machine_casing_firebox_bloom"); public final BoilerFireboxType firebox; @@ -34,7 +38,9 @@ public LargeBoilerRenderer(ResourceLocation texture, BoilerFireboxType firebox, @Override @OnlyIn(Dist.CLIENT) - public void renderPartModel(List quads, IMultiController machine, IMultiPart part, Direction frontFacing, @Nullable Direction side, RandomSource rand, Direction modelFacing, ModelState modelState) { + public void renderPartModel(List quads, IMultiController machine, IMultiPart part, Direction frontFacing, + @Nullable Direction side, RandomSource rand, Direction modelFacing, + ModelState modelState) { // We have to render it ourselves to avoid uv issues if (machine.self().getPos().below().getY() == part.self().getPos().getY()) { // firebox @@ -42,11 +48,14 @@ public void renderPartModel(List quads, IMultiController machine, IMu if (side == Direction.UP) { quads.add(FaceQuad.bakeFace(modelFacing, ModelFactory.getBlockSprite(firebox.top()), modelState)); } else if (side == Direction.DOWN) { - quads.add(FaceQuad.bakeFace(modelFacing, ModelFactory.getBlockSprite(firebox.bottom()), modelState)); + quads.add( + FaceQuad.bakeFace(modelFacing, ModelFactory.getBlockSprite(firebox.bottom()), modelState)); } else { quads.add(FaceQuad.bakeFace(modelFacing, ModelFactory.getBlockSprite(firebox.side()), modelState)); - if (machine instanceof IRecipeLogicMachine recipeLogicMachine && recipeLogicMachine.getRecipeLogic().isWorking()) { - quads.add(FaceQuad.bakeFace(modelFacing, ModelFactory.getBlockSprite(BLOOM_OVERLAY), modelState, -101, 15, true, false)); + if (machine instanceof IRecipeLogicMachine recipeLogicMachine && + recipeLogicMachine.getRecipeLogic().isWorking()) { + quads.add(FaceQuad.bakeFace(modelFacing, ModelFactory.getBlockSprite(BLOOM_OVERLAY), modelState, + -101, 15, true, false)); } } } @@ -56,5 +65,4 @@ public void renderPartModel(List quads, IMultiController machine, IMu } } } - } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/LargeMinerRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/LargeMinerRenderer.java index 151c51d94f..8f789fe4c2 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/LargeMinerRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/LargeMinerRenderer.java @@ -3,8 +3,10 @@ import com.gregtechceu.gtceu.api.machine.MachineDefinition; import com.gregtechceu.gtceu.api.machine.MetaMachine; import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiController; + import com.lowdragmc.lowdraglib.client.bakedpipeline.FaceQuad; import com.lowdragmc.lowdraglib.client.model.ModelFactory; + import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.resources.model.ModelState; import net.minecraft.core.Direction; @@ -13,11 +15,13 @@ import net.minecraft.world.phys.AABB; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + import org.jetbrains.annotations.Nullable; import java.util.List; public class LargeMinerRenderer extends WorkableCasingMachineRenderer { + public static final AABB BEHIND_BLOCK = new AABB(0, -0.005, 1, 1, 1, 2); public LargeMinerRenderer(ResourceLocation baseCasing, ResourceLocation workableModel) { @@ -26,11 +30,14 @@ public LargeMinerRenderer(ResourceLocation baseCasing, ResourceLocation workable @Override @OnlyIn(Dist.CLIENT) - public void renderMachine(List quads, MachineDefinition definition, @Nullable MetaMachine machine, Direction frontFacing, @Nullable Direction side, RandomSource rand, @Nullable Direction modelFacing, ModelState modelState) { + public void renderMachine(List quads, MachineDefinition definition, @Nullable MetaMachine machine, + Direction frontFacing, @Nullable Direction side, RandomSource rand, + @Nullable Direction modelFacing, ModelState modelState) { super.renderMachine(quads, definition, machine, frontFacing, side, rand, modelFacing, modelState); - if (machine instanceof IMultiController controller && controller.isFormed() && side == Direction.DOWN && modelFacing != null) { - quads.add(FaceQuad.bakeFace(BEHIND_BLOCK, modelFacing, ModelFactory.getBlockSprite(MinerRenderer.PIPE_IN_OVERLAY), modelState, -101, 15, true, true)); + if (machine instanceof IMultiController controller && controller.isFormed() && side == Direction.DOWN && + modelFacing != null) { + quads.add(FaceQuad.bakeFace(BEHIND_BLOCK, modelFacing, + ModelFactory.getBlockSprite(MinerRenderer.PIPE_IN_OVERLAY), modelState, -101, 15, true, true)); } } - } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/MachineRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/MachineRenderer.java index 46d9ec2ae3..8d1133f865 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/MachineRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/MachineRenderer.java @@ -11,12 +11,13 @@ import com.gregtechceu.gtceu.client.model.ItemBakedModel; import com.gregtechceu.gtceu.client.renderer.block.TextureOverrideRenderer; import com.gregtechceu.gtceu.client.renderer.cover.ICoverableRenderer; + import com.lowdragmc.lowdraglib.client.bakedpipeline.FaceQuad; import com.lowdragmc.lowdraglib.client.model.ModelFactory; import com.lowdragmc.lowdraglib.client.model.custommodel.ICTMPredicate; import com.lowdragmc.lowdraglib.client.renderer.IItemRendererProvider; import com.lowdragmc.lowdraglib.utils.FacadeBlockAndTintGetter; -import com.mojang.blaze3d.vertex.PoseStack; + import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.block.model.BakedQuad; @@ -35,7 +36,9 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; +import com.mojang.blaze3d.vertex.PoseStack; import org.jetbrains.annotations.Nullable; + import java.util.Collections; import java.util.LinkedList; import java.util.List; @@ -46,7 +49,8 @@ * @date 2023/2/26 * @implNote MachineRenderer */ -public class MachineRenderer extends TextureOverrideRenderer implements ICoverableRenderer, IPartRenderer, ICTMPredicate { +public class MachineRenderer extends TextureOverrideRenderer + implements ICoverableRenderer, IPartRenderer, ICTMPredicate { public static final ResourceLocation PIPE_OVERLAY = GTCEu.id("block/overlay/machine/overlay_pipe"); public static final ResourceLocation FLUID_OUTPUT_OVERLAY = GTCEu.id("block/overlay/machine/overlay_fluid_output"); @@ -70,16 +74,22 @@ public boolean useAO() { @Override @OnlyIn(Dist.CLIENT) - public void renderItem(ItemStack stack, ItemDisplayContext transformType, boolean leftHand, PoseStack matrixStack, MultiBufferSource buffer, int combinedLight, int combinedOverlay, BakedModel model) { + public void renderItem(ItemStack stack, ItemDisplayContext transformType, boolean leftHand, PoseStack matrixStack, + MultiBufferSource buffer, int combinedLight, int combinedOverlay, BakedModel model) { if (stack.getItem() instanceof MetaMachineItem machineItem) { IItemRendererProvider.disabled.set(true); - Minecraft.getInstance().getItemRenderer().render(stack, transformType, leftHand, matrixStack, buffer, combinedLight, combinedOverlay, + Minecraft.getInstance().getItemRenderer().render(stack, transformType, leftHand, matrixStack, buffer, + combinedLight, combinedOverlay, new ItemBakedModel() { + @Override @OnlyIn(Dist.CLIENT) - public List getQuads(@org.jetbrains.annotations.Nullable BlockState state, @org.jetbrains.annotations.Nullable Direction direction, RandomSource random) { + public List getQuads(@org.jetbrains.annotations.Nullable BlockState state, + @org.jetbrains.annotations.Nullable Direction direction, + RandomSource random) { List quads = new LinkedList<>(); - renderMachine(quads, machineItem.getDefinition(), null, Direction.NORTH, direction, random, direction, BlockModelRotation.X0_Y0); + renderMachine(quads, machineItem.getDefinition(), null, Direction.NORTH, direction, random, + direction, BlockModelRotation.X0_Y0); return quads; } }); @@ -89,7 +99,8 @@ public List getQuads(@org.jetbrains.annotations.Nullable BlockState s @Override @OnlyIn(Dist.CLIENT) - public final List renderModel(@Nullable BlockAndTintGetter level, @Nullable BlockPos pos, @Nullable BlockState state, @Nullable Direction side, RandomSource rand) { + public final List renderModel(@Nullable BlockAndTintGetter level, @Nullable BlockPos pos, + @Nullable BlockState state, @Nullable Direction side, RandomSource rand) { if (state != null && state.getBlock() instanceof MetaMachineBlock machineBlock) { var frontFacing = machineBlock.getFrontFacing(state); var machine = (level == null || pos == null) ? null : machineBlock.getMachine(level, pos); @@ -105,13 +116,15 @@ public final List renderModel(@Nullable BlockAndTintGetter level, @Nu if (machine instanceof IAutoOutputItem autoOutputItem) { var itemFace = autoOutputItem.getOutputFacingItems(); if (itemFace != null && side == itemFace) { - quads.add(FaceQuad.bakeFace(modelFacing, ModelFactory.getBlockSprite(PIPE_OVERLAY), modelState)); + quads.add( + FaceQuad.bakeFace(modelFacing, ModelFactory.getBlockSprite(PIPE_OVERLAY), modelState)); } } if (machine instanceof IAutoOutputFluid autoOutputFluid) { var fluidFace = autoOutputFluid.getOutputFacingFluids(); if (fluidFace != null && side == fluidFace) { - quads.add(FaceQuad.bakeFace(modelFacing, ModelFactory.getBlockSprite(PIPE_OVERLAY), modelState)); + quads.add( + FaceQuad.bakeFace(modelFacing, ModelFactory.getBlockSprite(PIPE_OVERLAY), modelState)); } } @@ -119,7 +132,8 @@ public final List renderModel(@Nullable BlockAndTintGetter level, @Nu var itemFace = autoOutputItem.getOutputFacingItems(); if (itemFace != null && side == itemFace) { if (autoOutputItem.isAutoOutputItems()) { - quads.add(FaceQuad.bakeFace(modelFacing, ModelFactory.getBlockSprite(ITEM_OUTPUT_OVERLAY), modelState, -101, 15)); + quads.add(FaceQuad.bakeFace(modelFacing, ModelFactory.getBlockSprite(ITEM_OUTPUT_OVERLAY), + modelState, -101, 15)); } } } @@ -128,13 +142,15 @@ public final List renderModel(@Nullable BlockAndTintGetter level, @Nu var fluidFace = autoOutputFluid.getOutputFacingFluids(); if (fluidFace != null && side == fluidFace) { if (autoOutputFluid.isAutoOutputFluids()) { - quads.add(FaceQuad.bakeFace(modelFacing, ModelFactory.getBlockSprite(FLUID_OUTPUT_OVERLAY), modelState, -101, 15)); + quads.add(FaceQuad.bakeFace(modelFacing, ModelFactory.getBlockSprite(FLUID_OUTPUT_OVERLAY), + modelState, -101, 15)); } } } // render covers - ICoverableRenderer.super.renderCovers(quads, side, rand, machine.getCoverContainer(), modelFacing, pos, level, modelState); + ICoverableRenderer.super.renderCovers(quads, side, rand, machine.getCoverContainer(), modelFacing, pos, + level, modelState); return quads; } } @@ -142,7 +158,8 @@ public final List renderModel(@Nullable BlockAndTintGetter level, @Nu } @OnlyIn(Dist.CLIENT) - public void renderBaseModel(List quads, MachineDefinition definition, @Nullable MetaMachine machine, Direction frontFacing, @Nullable Direction side, RandomSource rand) { + public void renderBaseModel(List quads, MachineDefinition definition, @Nullable MetaMachine machine, + Direction frontFacing, @Nullable Direction side, RandomSource rand) { quads.addAll(getRotatedModel(frontFacing).getQuads(definition.defaultBlockState(), side, rand)); } @@ -159,8 +176,11 @@ public void renderBaseModel(List quads, MachineDefinition definition, * @param modelState uvLocked rotation according to the front facing */ @OnlyIn(Dist.CLIENT) - public void renderMachine(List quads, MachineDefinition definition, @Nullable MetaMachine machine, Direction frontFacing, @Nullable Direction side, RandomSource rand, @Nullable Direction modelFacing, ModelState modelState) { - if (!(machine instanceof IMultiPart part) || !part.replacePartModelWhenFormed() || !renderReplacedPartMachine(quads, part, frontFacing, side, rand, modelFacing, modelState)) { + public void renderMachine(List quads, MachineDefinition definition, @Nullable MetaMachine machine, + Direction frontFacing, @Nullable Direction side, RandomSource rand, + @Nullable Direction modelFacing, ModelState modelState) { + if (!(machine instanceof IMultiPart part) || !part.replacePartModelWhenFormed() || + !renderReplacedPartMachine(quads, part, frontFacing, side, rand, modelFacing, modelState)) { renderBaseModel(quads, definition, machine, frontFacing, side, rand); } } @@ -177,18 +197,20 @@ public void onPrepareTextureAtlas(ResourceLocation atlasName, Consumer quads, MachineDefinition definition, @Nullable MetaMachine machine, Direction frontFacing, @Nullable Direction side, RandomSource rand, @Nullable Direction modelFacing, ModelState modelState) { + public void renderMachine(List quads, MachineDefinition definition, @Nullable MetaMachine machine, + Direction frontFacing, @Nullable Direction side, RandomSource rand, + @Nullable Direction modelFacing, ModelState modelState) { super.renderMachine(quads, definition, machine, frontFacing, side, rand, modelFacing, modelState); - if (side == frontFacing && modelFacing != null && machine instanceof IMaintenanceMachine maintenanceHatch && maintenanceHatch.isTaped()) { - quads.add(FaceQuad.bakeFace(modelFacing, ModelFactory.getBlockSprite(MAINTENANCE_OVERLAY_TAPED), modelState)); + if (side == frontFacing && modelFacing != null && machine instanceof IMaintenanceMachine maintenanceHatch && + maintenanceHatch.isTaped()) { + quads.add( + FaceQuad.bakeFace(modelFacing, ModelFactory.getBlockSprite(MAINTENANCE_OVERLAY_TAPED), modelState)); } } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/MinerRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/MinerRenderer.java index 8d50b4b1ad..d9f0661666 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/MinerRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/MinerRenderer.java @@ -1,13 +1,14 @@ package com.gregtechceu.gtceu.client.renderer.machine; -import com.google.common.collect.ImmutableMap; import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.api.machine.MachineDefinition; import com.gregtechceu.gtceu.api.machine.MetaMachine; import com.gregtechceu.gtceu.common.data.GTMaterials; + import com.lowdragmc.lowdraglib.client.bakedpipeline.FaceQuad; import com.lowdragmc.lowdraglib.client.model.ModelFactory; + import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.client.resources.model.ModelState; @@ -16,12 +17,15 @@ import net.minecraft.util.RandomSource; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + +import com.google.common.collect.ImmutableMap; import org.jetbrains.annotations.Nullable; import java.util.List; import java.util.function.Consumer; public class MinerRenderer extends WorkableTieredHullMachineRenderer { + public static final ResourceLocation PIPE_IN_OVERLAY = GTCEu.id("block/overlay/machine/overlay_pipe_in"); public static final ImmutableMap MATERIALS_TO_CASING_MODELS; @@ -46,9 +50,12 @@ public MinerRenderer(int tier, ResourceLocation modelLocation) { @Override @OnlyIn(Dist.CLIENT) - public void renderMachine(List quads, MachineDefinition definition, @Nullable MetaMachine machine, Direction frontFacing, @Nullable Direction side, RandomSource rand, @Nullable Direction modelFacing, ModelState modelState) { + public void renderMachine(List quads, MachineDefinition definition, @Nullable MetaMachine machine, + Direction frontFacing, @Nullable Direction side, RandomSource rand, + @Nullable Direction modelFacing, ModelState modelState) { super.renderMachine(quads, definition, machine, frontFacing, side, rand, modelFacing, modelState); - if (side == Direction.DOWN) quads.add(FaceQuad.bakeFace(modelFacing, ModelFactory.getBlockSprite(MinerRenderer.PIPE_IN_OVERLAY), modelState)); + if (side == Direction.DOWN) quads.add( + FaceQuad.bakeFace(modelFacing, ModelFactory.getBlockSprite(MinerRenderer.PIPE_IN_OVERLAY), modelState)); } @Override diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/OverlaySteamMachineRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/OverlaySteamMachineRenderer.java index bc3e4ea7b9..75cc97ad8b 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/OverlaySteamMachineRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/OverlaySteamMachineRenderer.java @@ -4,7 +4,9 @@ import com.gregtechceu.gtceu.api.machine.MachineDefinition; import com.gregtechceu.gtceu.api.machine.MetaMachine; import com.gregtechceu.gtceu.config.ConfigHolder; + import com.lowdragmc.lowdraglib.client.renderer.impl.IModelRenderer; + import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.resources.model.ModelState; import net.minecraft.core.Direction; @@ -14,6 +16,7 @@ import net.minecraftforge.api.distmarker.OnlyIn; import org.jetbrains.annotations.Nullable; + import java.util.List; /** @@ -22,18 +25,21 @@ * @implNote PartSteamMachineRenderer */ public class OverlaySteamMachineRenderer extends SteamHullMachineRenderer implements IPartRenderer { + protected IModelRenderer overlayModel; public OverlaySteamMachineRenderer(ResourceLocation overlayModel) { - super(ConfigHolder.INSTANCE.machines.steelSteamMultiblocks ? "steel" : "bronze", GTCEu.id("block/machine/hull_machine")); + super(ConfigHolder.INSTANCE.machines.steelSteamMultiblocks ? "steel" : "bronze", + GTCEu.id("block/machine/hull_machine")); this.overlayModel = new IModelRenderer(overlayModel); } @Override @OnlyIn(Dist.CLIENT) - public void renderMachine(List quads, MachineDefinition definition, @Nullable MetaMachine machine, Direction frontFacing, @Nullable Direction side, RandomSource rand, Direction modelFacing, ModelState modelState) { + public void renderMachine(List quads, MachineDefinition definition, @Nullable MetaMachine machine, + Direction frontFacing, @Nullable Direction side, RandomSource rand, Direction modelFacing, + ModelState modelState) { super.renderMachine(quads, definition, machine, frontFacing, side, rand, modelFacing, modelState); quads.addAll(overlayModel.getRotatedModel(frontFacing).getQuads(definition.defaultBlockState(), side, rand)); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/OverlayTieredActiveMachineRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/OverlayTieredActiveMachineRenderer.java index 1657e2470f..092e829288 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/OverlayTieredActiveMachineRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/OverlayTieredActiveMachineRenderer.java @@ -5,7 +5,9 @@ import com.gregtechceu.gtceu.api.machine.MetaMachine; import com.gregtechceu.gtceu.api.machine.feature.IRecipeLogicMachine; import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiPart; + import com.lowdragmc.lowdraglib.client.renderer.impl.IModelRenderer; + import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.resources.model.ModelState; import net.minecraft.core.Direction; @@ -15,13 +17,16 @@ import net.minecraftforge.api.distmarker.OnlyIn; import org.jetbrains.annotations.Nullable; + import java.util.List; public class OverlayTieredActiveMachineRenderer extends TieredHullMachineRenderer { + protected IModelRenderer activeOverlayModel; protected IModelRenderer overlayModel; - public OverlayTieredActiveMachineRenderer(int tier, ResourceLocation overlayModel, ResourceLocation activeOverlayModel) { + public OverlayTieredActiveMachineRenderer(int tier, ResourceLocation overlayModel, + ResourceLocation activeOverlayModel) { super(tier, GTCEu.id("block/machine/hull_machine")); this.overlayModel = new IModelRenderer(overlayModel); this.activeOverlayModel = new IModelRenderer(activeOverlayModel); @@ -29,16 +34,21 @@ public OverlayTieredActiveMachineRenderer(int tier, ResourceLocation overlayMode @Override @OnlyIn(Dist.CLIENT) - public void renderMachine(List quads, MachineDefinition definition, @Nullable MetaMachine machine, Direction frontFacing, @Nullable Direction side, RandomSource rand, Direction modelFacing, ModelState modelState) { + public void renderMachine(List quads, MachineDefinition definition, @Nullable MetaMachine machine, + Direction frontFacing, @Nullable Direction side, RandomSource rand, Direction modelFacing, + ModelState modelState) { super.renderMachine(quads, definition, machine, frontFacing, side, rand, modelFacing, modelState); if (machine instanceof IRecipeLogicMachine rlm) { if (rlm.isActive()) { - quads.addAll(activeOverlayModel.getRotatedModel(frontFacing).getQuads(definition.defaultBlockState(), side, rand)); + quads.addAll(activeOverlayModel.getRotatedModel(frontFacing).getQuads(definition.defaultBlockState(), + side, rand)); return; } } else if (machine instanceof IMultiPart part) { - if (part.getControllers().stream().anyMatch(controller -> controller instanceof IRecipeLogicMachine rlm && rlm.isActive())) { - quads.addAll(activeOverlayModel.getRotatedModel(frontFacing).getQuads(definition.defaultBlockState(), side, rand)); + if (part.getControllers().stream() + .anyMatch(controller -> controller instanceof IRecipeLogicMachine rlm && rlm.isActive())) { + quads.addAll(activeOverlayModel.getRotatedModel(frontFacing).getQuads(definition.defaultBlockState(), + side, rand)); return; } } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/OverlayTieredMachineRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/OverlayTieredMachineRenderer.java index 201afa7271..c6ea6cd308 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/OverlayTieredMachineRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/OverlayTieredMachineRenderer.java @@ -3,7 +3,9 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.machine.MachineDefinition; import com.gregtechceu.gtceu.api.machine.MetaMachine; + import com.lowdragmc.lowdraglib.client.renderer.impl.IModelRenderer; + import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.resources.model.ModelState; import net.minecraft.core.Direction; @@ -13,6 +15,7 @@ import net.minecraftforge.api.distmarker.OnlyIn; import org.jetbrains.annotations.Nullable; + import java.util.List; /** @@ -21,6 +24,7 @@ * @implNote PartRenderer */ public class OverlayTieredMachineRenderer extends TieredHullMachineRenderer implements IPartRenderer { + protected IModelRenderer overlayModel; public OverlayTieredMachineRenderer(int tier, ResourceLocation overlayModel) { @@ -30,7 +34,9 @@ public OverlayTieredMachineRenderer(int tier, ResourceLocation overlayModel) { @Override @OnlyIn(Dist.CLIENT) - public void renderMachine(List quads, MachineDefinition definition, @Nullable MetaMachine machine, Direction frontFacing, @Nullable Direction side, RandomSource rand, Direction modelFacing, ModelState modelState) { + public void renderMachine(List quads, MachineDefinition definition, @Nullable MetaMachine machine, + Direction frontFacing, @Nullable Direction side, RandomSource rand, Direction modelFacing, + ModelState modelState) { super.renderMachine(quads, definition, machine, frontFacing, side, rand, modelFacing, modelState); quads.addAll(overlayModel.getRotatedModel(frontFacing).getQuads(definition.defaultBlockState(), side, rand)); } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/PumpHatchPartRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/PumpHatchPartRenderer.java index b2d7dbfd99..e5a674f600 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/PumpHatchPartRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/PumpHatchPartRenderer.java @@ -3,8 +3,10 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.block.MetaMachineBlock; import com.gregtechceu.gtceu.client.renderer.block.CTMModelRenderer; + import com.lowdragmc.lowdraglib.client.bakedpipeline.FaceQuad; import com.lowdragmc.lowdraglib.client.model.ModelFactory; + import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.client.resources.model.BlockModelRotation; @@ -21,7 +23,6 @@ import java.util.List; import java.util.function.Consumer; - /** * @author KilaBash * @date 2023/5/25 @@ -38,11 +39,13 @@ public PumpHatchPartRenderer() { @Override @OnlyIn(Dist.CLIENT) - public List renderModel(BlockAndTintGetter level, BlockPos pos, BlockState state, Direction side, RandomSource rand) { + public List renderModel(BlockAndTintGetter level, BlockPos pos, BlockState state, Direction side, + RandomSource rand) { if (state.getBlock() instanceof MetaMachineBlock machineBlock && side == machineBlock.getFrontFacing(state)) { var quads = new ArrayList<>(super.renderModel(level, pos, state, side, rand)); quads.add(FaceQuad.bakeFace(side, ModelFactory.getBlockSprite(PIPE_OUT))); - quads.add(FaceQuad.bakeFace(side, ModelFactory.getBlockSprite(FLUID_HATCH), BlockModelRotation.X0_Y0, -101, 15)); + quads.add(FaceQuad.bakeFace(side, ModelFactory.getBlockSprite(FLUID_HATCH), BlockModelRotation.X0_Y0, -101, + 15)); return quads; } return super.renderModel(level, pos, state, side, rand); diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/QuantumChestRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/QuantumChestRenderer.java index 6e0abeba68..7fb823fe8b 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/QuantumChestRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/QuantumChestRenderer.java @@ -1,16 +1,14 @@ package com.gregtechceu.gtceu.client.renderer.machine; - import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; import com.gregtechceu.gtceu.common.machine.storage.QuantumChestMachine; import com.gregtechceu.gtceu.core.mixins.GuiGraphicsAccessor; + import com.lowdragmc.lowdraglib.client.utils.RenderUtils; import com.lowdragmc.lowdraglib.gui.texture.TextTexture; import com.lowdragmc.lowdraglib.gui.util.TextFormattingUtil; -import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.Tesselator; + import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.texture.OverlayTexture; @@ -23,6 +21,10 @@ import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + +import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.Tesselator; import org.joml.Quaternionf; /** @@ -44,7 +46,8 @@ public boolean hasTESR(BlockEntity blockEntity) { @Override @OnlyIn(Dist.CLIENT) - public void renderItem(ItemStack stack, ItemDisplayContext transformType, boolean leftHand, PoseStack poseStack, MultiBufferSource buffer, int combinedLight, int combinedOverlay, BakedModel model) { + public void renderItem(ItemStack stack, ItemDisplayContext transformType, boolean leftHand, PoseStack poseStack, + MultiBufferSource buffer, int combinedLight, int combinedOverlay, BakedModel model) { model = getItemBakedModel(); if (model != null && stack.hasTag()) { poseStack.pushPose(); @@ -64,43 +67,51 @@ public void renderItem(ItemStack stack, ItemDisplayContext transformType, boolea @Override @OnlyIn(Dist.CLIENT) - public void render(BlockEntity blockEntity, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int combinedLight, int combinedOverlay) { - if (blockEntity instanceof IMachineBlockEntity machineBlockEntity && machineBlockEntity.getMetaMachine() instanceof QuantumChestMachine machine) { + public void render(BlockEntity blockEntity, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, + int combinedLight, int combinedOverlay) { + if (blockEntity instanceof IMachineBlockEntity machineBlockEntity && + machineBlockEntity.getMetaMachine() instanceof QuantumChestMachine machine) { var level = machine.getLevel(); var frontFacing = machine.getFrontFacing(); float tick = level.getGameTime() + partialTicks; - renderChest(poseStack, buffer, frontFacing, machine.getStored(), machine.getStoredAmount(), tick, machine.getLockedItem().getStackInSlot(0)); + renderChest(poseStack, buffer, frontFacing, machine.getStored(), machine.getStoredAmount(), tick, + machine.getLockedItem().getStackInSlot(0)); } } @OnlyIn(Dist.CLIENT) - public void renderChest(PoseStack poseStack, MultiBufferSource buffer, Direction frontFacing, ItemStack stored, int storedAmount, float tick, ItemStack locked) { + public void renderChest(PoseStack poseStack, MultiBufferSource buffer, Direction frontFacing, ItemStack stored, + int storedAmount, float tick, ItemStack locked) { ItemStack itemStack = !stored.isEmpty() ? stored : locked; if (itemStack.isEmpty()) return; var itemRenderer = Minecraft.getInstance().getItemRenderer(); poseStack.pushPose(); - BakedModel bakedmodel = itemRenderer.getModel(itemStack, Minecraft.getInstance().level, null, Item.getId(itemStack.getItem()) + itemStack.getDamageValue()); + BakedModel bakedmodel = itemRenderer.getModel(itemStack, Minecraft.getInstance().level, null, + Item.getId(itemStack.getItem()) + itemStack.getDamageValue()); poseStack.translate(0.5D, 0.5d, 0.5D); poseStack.mulPose(new Quaternionf().rotateAxis(tick * Mth.TWO_PI / 80, 0, 1, 0)); poseStack.scale(0.6f, 0.6f, 0.6f); - itemRenderer.render(itemStack, ItemDisplayContext.FIXED, false, poseStack, buffer, 0xf000f0, OverlayTexture.NO_OVERLAY, bakedmodel); + itemRenderer.render(itemStack, ItemDisplayContext.FIXED, false, poseStack, buffer, 0xf000f0, + OverlayTexture.NO_OVERLAY, bakedmodel); poseStack.popPose(); - poseStack.pushPose(); RenderSystem.disableDepthTest(); - poseStack.translate(frontFacing.getStepX() * -1 / 16f, frontFacing.getStepY() * -1 / 16f, frontFacing.getStepZ() * -1 / 16f); + poseStack.translate(frontFacing.getStepX() * -1 / 16f, frontFacing.getStepY() * -1 / 16f, + frontFacing.getStepZ() * -1 / 16f); RenderUtils.moveToFace(poseStack, 0, 0, 0, frontFacing); if (frontFacing.getAxis() == Direction.Axis.Y) { - RenderUtils.rotateToFace(poseStack, frontFacing, frontFacing == Direction.UP ? Direction.SOUTH : Direction.NORTH); + RenderUtils.rotateToFace(poseStack, frontFacing, + frontFacing == Direction.UP ? Direction.SOUTH : Direction.NORTH); } else { RenderUtils.rotateToFace(poseStack, frontFacing, null); } var amount = stored.isEmpty() ? "*" : TextFormattingUtil.formatLongToCompactString(storedAmount, 4); poseStack.scale(1f / 64, 1f / 64, 0); poseStack.translate(-32, -32, 0); - new TextTexture(amount).draw(GuiGraphicsAccessor.create(Minecraft.getInstance(), poseStack, MultiBufferSource.immediate(Tesselator.getInstance().getBuilder())), 0, 0, 0, 24, 64, 28); + new TextTexture(amount).draw(GuiGraphicsAccessor.create(Minecraft.getInstance(), poseStack, + MultiBufferSource.immediate(Tesselator.getInstance().getBuilder())), 0, 0, 0, 24, 64, 28); RenderSystem.enableDepthTest(); poseStack.popPose(); } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/QuantumTankRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/QuantumTankRenderer.java index 938188b605..a9f05f1274 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/QuantumTankRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/QuantumTankRenderer.java @@ -4,16 +4,14 @@ import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; import com.gregtechceu.gtceu.common.machine.storage.QuantumTankMachine; import com.gregtechceu.gtceu.core.mixins.GuiGraphicsAccessor; + import com.lowdragmc.lowdraglib.client.utils.RenderBufferUtils; import com.lowdragmc.lowdraglib.client.utils.RenderUtils; import com.lowdragmc.lowdraglib.gui.texture.TextTexture; import com.lowdragmc.lowdraglib.gui.util.TextFormattingUtil; import com.lowdragmc.lowdraglib.side.fluid.FluidHelper; import com.lowdragmc.lowdraglib.side.fluid.FluidStack; -import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.Tesselator; -import com.mojang.blaze3d.vertex.VertexConsumer; + import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.Sheets; @@ -27,6 +25,11 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; +import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.Tesselator; +import com.mojang.blaze3d.vertex.VertexConsumer; + /** * @author KilaBash * @date 2023/3/2 @@ -45,7 +48,8 @@ public boolean hasTESR(BlockEntity blockEntity) { } @Override - public void renderItem(ItemStack stack, ItemDisplayContext transformType, boolean leftHand, PoseStack poseStack, MultiBufferSource buffer, int combinedLight, int combinedOverlay, BakedModel model) { + public void renderItem(ItemStack stack, ItemDisplayContext transformType, boolean leftHand, PoseStack poseStack, + MultiBufferSource buffer, int combinedLight, int combinedOverlay, BakedModel model) { model = getItemBakedModel(); if (model != null && stack.hasTag()) { poseStack.pushPose(); @@ -63,39 +67,49 @@ public void renderItem(ItemStack stack, ItemDisplayContext transformType, boolea @Override @OnlyIn(Dist.CLIENT) - public void render(BlockEntity blockEntity, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int combinedLight, int combinedOverlay) { - if (blockEntity instanceof IMachineBlockEntity machineBlockEntity && machineBlockEntity.getMetaMachine() instanceof QuantumTankMachine machine) { - renderTank(poseStack, buffer, machine.getFrontFacing(), machine.getStored(), machine.getCache().getLockedFluid().getFluid()); + public void render(BlockEntity blockEntity, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, + int combinedLight, int combinedOverlay) { + if (blockEntity instanceof IMachineBlockEntity machineBlockEntity && + machineBlockEntity.getMetaMachine() instanceof QuantumTankMachine machine) { + renderTank(poseStack, buffer, machine.getFrontFacing(), machine.getStored(), + machine.getCache().getLockedFluid().getFluid()); } } @OnlyIn(Dist.CLIENT) - public void renderTank(PoseStack poseStack, MultiBufferSource buffer, Direction frontFacing, FluidStack stored, FluidStack locked) { + public void renderTank(PoseStack poseStack, MultiBufferSource buffer, Direction frontFacing, FluidStack stored, + FluidStack locked) { FluidStack fluid = !stored.isEmpty() ? stored : locked; if (fluid.isEmpty()) return; var fluidTexture = FluidHelper.getStillTexture(fluid); if (fluidTexture == null) { - fluidTexture = Minecraft.getInstance().getTextureAtlas(TextureAtlas.LOCATION_BLOCKS).apply(MissingTextureAtlasSprite.getLocation()); + fluidTexture = Minecraft.getInstance().getTextureAtlas(TextureAtlas.LOCATION_BLOCKS) + .apply(MissingTextureAtlasSprite.getLocation()); } poseStack.pushPose(); VertexConsumer builder = buffer.getBuffer(Sheets.translucentCullBlockSheet()); - RenderBufferUtils.renderCubeFace(poseStack, builder, 2.5f / 16, 2.5f / 16, 2.5f / 16, 13.5f / 16, 13.5f / 16, 13.5f / 16, FluidHelper.getColor(fluid) | 0xff000000, 0xf000f0, fluidTexture); + RenderBufferUtils.renderCubeFace(poseStack, builder, 2.5f / 16, 2.5f / 16, 2.5f / 16, 13.5f / 16, 13.5f / 16, + 13.5f / 16, FluidHelper.getColor(fluid) | 0xff000000, 0xf000f0, fluidTexture); poseStack.popPose(); poseStack.pushPose(); RenderSystem.disableDepthTest(); - poseStack.translate(frontFacing.getStepX() * -1 / 16f, frontFacing.getStepY() * -1 / 16f, frontFacing.getStepZ() * -1 / 16f); + poseStack.translate(frontFacing.getStepX() * -1 / 16f, frontFacing.getStepY() * -1 / 16f, + frontFacing.getStepZ() * -1 / 16f); RenderUtils.moveToFace(poseStack, 0, 0, 0, frontFacing); if (frontFacing.getAxis() == Direction.Axis.Y) { - RenderUtils.rotateToFace(poseStack, frontFacing, frontFacing == Direction.UP ? Direction.SOUTH : Direction.NORTH); + RenderUtils.rotateToFace(poseStack, frontFacing, + frontFacing == Direction.UP ? Direction.SOUTH : Direction.NORTH); } else { RenderUtils.rotateToFace(poseStack, frontFacing, null); } - var amount = stored.isEmpty() ? "*" : TextFormattingUtil.formatLongToCompactString(fluid.getAmount() / (FluidHelper.getBucket() / 1000), 4); + var amount = stored.isEmpty() ? "*" : + TextFormattingUtil.formatLongToCompactString(fluid.getAmount() / (FluidHelper.getBucket() / 1000), 4); poseStack.scale(1f / 64, 1f / 64, 0); poseStack.translate(-32, -32, 0); - new TextTexture(amount).draw(GuiGraphicsAccessor.create(Minecraft.getInstance(), poseStack, MultiBufferSource.immediate(Tesselator.getInstance().getBuilder())), 0, 0, 0, 24, 64, 28); + new TextTexture(amount).draw(GuiGraphicsAccessor.create(Minecraft.getInstance(), poseStack, + MultiBufferSource.immediate(Tesselator.getInstance().getBuilder())), 0, 0, 0, 24, 64, 28); RenderSystem.enableDepthTest(); poseStack.popPose(); } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/RotorHolderMachineRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/RotorHolderMachineRenderer.java index e06e33a5bb..d4c33db38a 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/RotorHolderMachineRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/RotorHolderMachineRenderer.java @@ -4,8 +4,10 @@ import com.gregtechceu.gtceu.api.machine.MachineDefinition; import com.gregtechceu.gtceu.api.machine.MetaMachine; import com.gregtechceu.gtceu.api.machine.feature.multiblock.IRotorHolderMachine; + import com.lowdragmc.lowdraglib.client.bakedpipeline.FaceQuad; import com.lowdragmc.lowdraglib.client.model.ModelFactory; + import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.client.resources.model.ModelState; @@ -15,6 +17,7 @@ import net.minecraft.world.phys.AABB; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + import org.jetbrains.annotations.Nullable; import java.util.List; @@ -26,31 +29,39 @@ * @implNote RotorHolderMachineRenderer */ public class RotorHolderMachineRenderer extends TieredHullMachineRenderer { + public static final ResourceLocation ROTOR_HOLDER_OVERLAY = GTCEu.id("block/overlay/machine/overlay_rotor_holder"); public static final ResourceLocation BASE_RING = GTCEu.id("block/multiblock/large_turbine/base_ring"); public static final ResourceLocation BASE_BG = GTCEu.id("block/multiblock/large_turbine/base_bg"); public static final ResourceLocation IDLE = GTCEu.id("block/multiblock/large_turbine/rotor_idle"); public static final ResourceLocation SPINNING = GTCEu.id("block/multiblock/large_turbine/rotor_spinning"); + public RotorHolderMachineRenderer(int tier) { super(tier, GTCEu.id("block/machine/hull_machine")); } @Override @OnlyIn(Dist.CLIENT) - public void renderMachine(List quads, MachineDefinition definition, @Nullable MetaMachine machine, Direction frontFacing, @Nullable Direction side, RandomSource rand, @Nullable Direction modelFacing, ModelState modelState) { + public void renderMachine(List quads, MachineDefinition definition, @Nullable MetaMachine machine, + Direction frontFacing, @Nullable Direction side, RandomSource rand, + @Nullable Direction modelFacing, ModelState modelState) { super.renderMachine(quads, definition, machine, frontFacing, side, rand, modelFacing, modelState); if (side == frontFacing && modelFacing != null) { quads.add(FaceQuad.bakeFace(modelFacing, ModelFactory.getBlockSprite(ROTOR_HOLDER_OVERLAY), modelState)); if (machine instanceof IRotorHolderMachine rotorHolderMachine) { var aabb = new AABB(-1, -1, -0.01, 2, 2, 1.01); if (!rotorHolderMachine.getControllers().isEmpty()) { - quads.add(FaceQuad.bakeFace(aabb, modelFacing, ModelFactory.getBlockSprite(BASE_RING), modelState, -101, 15, true, false)); - quads.add(FaceQuad.bakeFace(aabb, modelFacing, ModelFactory.getBlockSprite(BASE_BG), modelState, -101, 15, true, false)); + quads.add(FaceQuad.bakeFace(aabb, modelFacing, ModelFactory.getBlockSprite(BASE_RING), modelState, + -101, 15, true, false)); + quads.add(FaceQuad.bakeFace(aabb, modelFacing, ModelFactory.getBlockSprite(BASE_BG), modelState, + -101, 15, true, false)); if (rotorHolderMachine.hasRotor()) { if (rotorHolderMachine.isRotorSpinning()) { - quads.add(FaceQuad.bakeFace(aabb, modelFacing, ModelFactory.getBlockSprite(SPINNING), modelState, 2, 0, true, true)); + quads.add(FaceQuad.bakeFace(aabb, modelFacing, ModelFactory.getBlockSprite(SPINNING), + modelState, 2, 0, true, true)); } else { - quads.add(FaceQuad.bakeFace(aabb, modelFacing, ModelFactory.getBlockSprite(IDLE), modelState, 2, 0, true, true)); + quads.add(FaceQuad.bakeFace(aabb, modelFacing, ModelFactory.getBlockSprite(IDLE), + modelState, 2, 0, true, true)); } } } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/SimpleGeneratorMachineRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/SimpleGeneratorMachineRenderer.java index 058f82baab..7484cfc4eb 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/SimpleGeneratorMachineRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/SimpleGeneratorMachineRenderer.java @@ -2,13 +2,16 @@ import com.gregtechceu.gtceu.api.machine.MachineDefinition; import com.gregtechceu.gtceu.api.machine.MetaMachine; + import com.lowdragmc.lowdraglib.client.bakedpipeline.FaceQuad; import com.lowdragmc.lowdraglib.client.model.ModelFactory; + import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.resources.model.ModelState; import net.minecraft.core.Direction; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.RandomSource; + import org.jetbrains.annotations.Nullable; import java.util.List; @@ -25,10 +28,13 @@ public SimpleGeneratorMachineRenderer(int tier, ResourceLocation workableModel) } @Override - public void renderMachine(List quads, MachineDefinition definition, @Nullable MetaMachine machine, Direction frontFacing, @Nullable Direction side, RandomSource rand, Direction modelFacing, ModelState modelState) { + public void renderMachine(List quads, MachineDefinition definition, @Nullable MetaMachine machine, + Direction frontFacing, @Nullable Direction side, RandomSource rand, Direction modelFacing, + ModelState modelState) { super.renderMachine(quads, definition, machine, frontFacing, side, rand, modelFacing, modelState); if (side == frontFacing && modelFacing != null) { - quads.add(FaceQuad.bakeFace(modelFacing, ModelFactory.getBlockSprite(TransformerRenderer.ENERGY_OUT), modelState, 2)); + quads.add(FaceQuad.bakeFace(modelFacing, ModelFactory.getBlockSprite(TransformerRenderer.ENERGY_OUT), + modelState, 2)); } } } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/SplitShaftTieredHullMachineRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/SplitShaftTieredHullMachineRenderer.java index 4dd41b4184..0891e2d56f 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/SplitShaftTieredHullMachineRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/SplitShaftTieredHullMachineRenderer.java @@ -4,7 +4,9 @@ import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiController; import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiPart; import com.gregtechceu.gtceu.client.model.SpriteOverrider; + import com.lowdragmc.lowdraglib.client.model.ModelFactory; + import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.resources.model.ModelState; import net.minecraft.core.Direction; @@ -12,6 +14,7 @@ import net.minecraft.util.RandomSource; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + import org.jetbrains.annotations.Nullable; import java.util.List; @@ -30,7 +33,9 @@ public SplitShaftTieredHullMachineRenderer(int tier, ResourceLocation modelLocat @Override @OnlyIn(Dist.CLIENT) - public boolean renderReplacedPartMachine(List quads, IMultiPart part, Direction frontFacing, @Nullable Direction side, RandomSource rand, Direction modelFacing, ModelState modelState) { + public boolean renderReplacedPartMachine(List quads, IMultiPart part, Direction frontFacing, + @Nullable Direction side, RandomSource rand, Direction modelFacing, + ModelState modelState) { var controllers = part.getControllers(); for (IMultiController controller : controllers) { var state = controller.self().getBlockState(); @@ -38,7 +43,7 @@ public boolean renderReplacedPartMachine(List quads, IMultiPart part, var renderer = block.definition.getRenderer(); if (renderer instanceof WorkableCasingMachineRenderer workableCasingMachineRenderer) { var baseTexture = workableCasingMachineRenderer.baseCasing; - var bakeModel = ModelFactory.getUnBakedModel(modelLocation).bake( + var bakeModel = ModelFactory.getUnBakedModel(modelLocation).bake( ModelFactory.getModeBaker(), new SpriteOverrider(Map.of("bottom", baseTexture, "top", baseTexture, "side", baseTexture)), ModelFactory.getRotation(frontFacing), @@ -48,10 +53,12 @@ public boolean renderReplacedPartMachine(List quads, IMultiPart part, return true; } } else if (renderer instanceof IControllerRenderer controllerRenderer) { - controllerRenderer.renderPartModel(quads, controller, part, frontFacing, side, rand, modelFacing, modelState); + controllerRenderer.renderPartModel(quads, controller, part, frontFacing, side, rand, modelFacing, + modelState); return true; } else if (renderer instanceof MachineRenderer machineRenderer) { - machineRenderer.renderBaseModel(quads, block.definition, controller.self(), frontFacing, side, rand); + machineRenderer.renderBaseModel(quads, block.definition, controller.self(), frontFacing, side, + rand); return true; } } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/SteamHullMachineRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/SteamHullMachineRenderer.java index 8509c5d975..d042c20390 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/SteamHullMachineRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/SteamHullMachineRenderer.java @@ -1,12 +1,14 @@ package com.gregtechceu.gtceu.client.renderer.machine; import com.gregtechceu.gtceu.GTCEu; + import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.inventory.InventoryMenu; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + import org.jetbrains.annotations.NotNull; import java.util.Map; @@ -27,8 +29,7 @@ public SteamHullMachineRenderer(String name, ResourceLocation modelLocation) { setTextureOverride(Map.of( "bottom", GTCEu.id("block/casings/steam/%s/bottom".formatted(name)), "top", GTCEu.id("block/casings/steam/%s/top".formatted(name)), - "side", GTCEu.id("block/casings/steam/%s/side".formatted(name)) - )); + "side", GTCEu.id("block/casings/steam/%s/side".formatted(name)))); } @NotNull diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/SteamMinerRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/SteamMinerRenderer.java index 5af4fc6b0a..d3c5cddbc6 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/SteamMinerRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/SteamMinerRenderer.java @@ -2,8 +2,10 @@ import com.gregtechceu.gtceu.api.machine.MachineDefinition; import com.gregtechceu.gtceu.api.machine.MetaMachine; + import com.lowdragmc.lowdraglib.client.bakedpipeline.FaceQuad; import com.lowdragmc.lowdraglib.client.model.ModelFactory; + import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.resources.model.ModelState; import net.minecraft.core.Direction; @@ -11,20 +13,24 @@ import net.minecraft.util.RandomSource; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + import org.jetbrains.annotations.Nullable; import java.util.List; public class SteamMinerRenderer extends WorkableSteamMachineRenderer { + public SteamMinerRenderer(boolean isHighTier, ResourceLocation modelLocation) { super(isHighTier, modelLocation); } @Override @OnlyIn(Dist.CLIENT) - public void renderMachine(List quads, MachineDefinition definition, @Nullable MetaMachine machine, Direction frontFacing, @Nullable Direction side, RandomSource rand, @Nullable Direction modelFacing, ModelState modelState) { + public void renderMachine(List quads, MachineDefinition definition, @Nullable MetaMachine machine, + Direction frontFacing, @Nullable Direction side, RandomSource rand, + @Nullable Direction modelFacing, ModelState modelState) { super.renderMachine(quads, definition, machine, frontFacing, side, rand, modelFacing, modelState); - if (side == Direction.DOWN) quads.add(FaceQuad.bakeFace(modelFacing, ModelFactory.getBlockSprite(MinerRenderer.PIPE_IN_OVERLAY), modelState)); + if (side == Direction.DOWN) quads.add( + FaceQuad.bakeFace(modelFacing, ModelFactory.getBlockSprite(MinerRenderer.PIPE_IN_OVERLAY), modelState)); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/TieredHullMachineRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/TieredHullMachineRenderer.java index c7a02c07c3..3700fb9890 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/TieredHullMachineRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/TieredHullMachineRenderer.java @@ -2,12 +2,14 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.GTValues; + import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.inventory.InventoryMenu; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + import org.jetbrains.annotations.NotNull; import java.util.Locale; @@ -23,10 +25,11 @@ public class TieredHullMachineRenderer extends MachineRenderer { public TieredHullMachineRenderer(int tier, ResourceLocation modelLocation) { super(modelLocation); setTextureOverride(Map.of( - "bottom", GTCEu.id("block/casings/voltage/%s/bottom".formatted(GTValues.VN[tier].toLowerCase(Locale.ROOT))), + "bottom", + GTCEu.id("block/casings/voltage/%s/bottom".formatted(GTValues.VN[tier].toLowerCase(Locale.ROOT))), "top", GTCEu.id("block/casings/voltage/%s/top".formatted(GTValues.VN[tier].toLowerCase(Locale.ROOT))), - "side", GTCEu.id("block/casings/voltage/%s/side".formatted(GTValues.VN[tier].toLowerCase(Locale.ROOT))) - )); + "side", + GTCEu.id("block/casings/voltage/%s/side".formatted(GTValues.VN[tier].toLowerCase(Locale.ROOT))))); } @NotNull @@ -35,5 +38,4 @@ public TieredHullMachineRenderer(int tier, ResourceLocation modelLocation) { public TextureAtlasSprite getParticleTexture() { return Minecraft.getInstance().getTextureAtlas(InventoryMenu.BLOCK_ATLAS).apply(override.get("side")); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/TransformerRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/TransformerRenderer.java index 3e45a31d5d..eb17225575 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/TransformerRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/TransformerRenderer.java @@ -4,8 +4,10 @@ import com.gregtechceu.gtceu.api.machine.MachineDefinition; import com.gregtechceu.gtceu.api.machine.MetaMachine; import com.gregtechceu.gtceu.common.machine.electric.TransformerMachine; + import com.lowdragmc.lowdraglib.client.bakedpipeline.FaceQuad; import com.lowdragmc.lowdraglib.client.model.ModelFactory; + import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.client.resources.model.ModelState; @@ -14,6 +16,7 @@ import net.minecraft.util.RandomSource; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + import org.jetbrains.annotations.Nullable; import java.util.List; @@ -24,7 +27,8 @@ * @date 2023/3/10 * @implNote TransformerRenderer */ -public class TransformerRenderer extends TieredHullMachineRenderer{ +public class TransformerRenderer extends TieredHullMachineRenderer { + public final static ResourceLocation ENERGY_IN = GTCEu.id("block/overlay/machine/overlay_energy_in"); public final static ResourceLocation ENERGY_OUT = GTCEu.id("block/overlay/machine/overlay_energy_out"); public final static ResourceLocation ENERGY_IN_HI = GTCEu.id("block/overlay/machine/overlay_energy_in_hi"); @@ -43,7 +47,9 @@ public TransformerRenderer(int tier, int baseAmp) { @Override @OnlyIn(Dist.CLIENT) - public void renderMachine(List quads, MachineDefinition definition, @Nullable MetaMachine machine, Direction frontFacing, @Nullable Direction side, RandomSource rand, Direction modelFacing, ModelState modelState) { + public void renderMachine(List quads, MachineDefinition definition, @Nullable MetaMachine machine, + Direction frontFacing, @Nullable Direction side, RandomSource rand, Direction modelFacing, + ModelState modelState) { super.renderMachine(quads, definition, machine, frontFacing, side, rand, modelFacing, modelState); var otherFaceTexture = ENERGY_OUT; var frontFaceTexture = ENERGY_IN_MULTI; @@ -52,7 +58,7 @@ public void renderMachine(List quads, MachineDefinition definition, @ isTransformUp = transformer.isTransformUp(); } - switch(baseAmp) { + switch (baseAmp) { case 1 -> { // 1A <-> 4A otherFaceTexture = isTransformUp ? ENERGY_IN : otherFaceTexture; frontFaceTexture = isTransformUp ? ENERGY_OUT_MULTI : frontFaceTexture; @@ -91,5 +97,4 @@ public void onPrepareTextureAtlas(ResourceLocation atlasName, Consumer quads, MachineDefinition definition, @Nullable MetaMachine machine, Direction frontFacing, @Nullable Direction side, RandomSource rand, Direction modelFacing, ModelState modelState) { + public void renderMachine(List quads, MachineDefinition definition, @Nullable MetaMachine machine, + Direction frontFacing, @Nullable Direction side, RandomSource rand, Direction modelFacing, + ModelState modelState) { super.renderMachine(quads, definition, machine, frontFacing, side, rand, modelFacing, modelState); if (machine instanceof IWorkable workable) { quads.addAll(overlayModel.bakeQuads(side, frontFacing, workable.isActive(), workable.isWorkingEnabled())); diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/WorkableSidedCasingMachineRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/WorkableSidedCasingMachineRenderer.java index 062af7da0b..17a5b693b2 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/WorkableSidedCasingMachineRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/WorkableSidedCasingMachineRenderer.java @@ -5,6 +5,7 @@ import com.gregtechceu.gtceu.api.machine.MachineDefinition; import com.gregtechceu.gtceu.api.machine.MetaMachine; import com.gregtechceu.gtceu.client.model.WorkableOverlayModel; + import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.texture.TextureAtlas; @@ -16,9 +17,10 @@ import net.minecraft.world.inventory.InventoryMenu; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; + import java.util.List; import java.util.Map; import java.util.function.Consumer; @@ -32,15 +34,15 @@ public WorkableSidedCasingMachineRenderer(String basePath, ResourceLocation work setTextureOverride(Map.of( "bottom", GTCEu.id(basePath + "/bottom"), "top", GTCEu.id(basePath + "/top"), - "side", GTCEu.id(basePath + "/side") - )); + "side", GTCEu.id(basePath + "/side"))); this.overlayModel = new WorkableOverlayModel(workableModel); } - @Override @OnlyIn(Dist.CLIENT) - public void renderMachine(List quads, MachineDefinition definition, @Nullable MetaMachine machine, Direction frontFacing, @Nullable Direction side, RandomSource rand, Direction modelFacing, ModelState modelState) { + public void renderMachine(List quads, MachineDefinition definition, @Nullable MetaMachine machine, + Direction frontFacing, @Nullable Direction side, RandomSource rand, Direction modelFacing, + ModelState modelState) { super.renderMachine(quads, definition, machine, frontFacing, side, rand, modelFacing, modelState); if (machine instanceof IWorkable workable) { quads.addAll(overlayModel.bakeQuads(side, frontFacing, workable.isActive(), workable.isWorkingEnabled())); diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/WorkableSteamMachineRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/WorkableSteamMachineRenderer.java index a940578155..1767d80485 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/WorkableSteamMachineRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/WorkableSteamMachineRenderer.java @@ -6,8 +6,10 @@ import com.gregtechceu.gtceu.api.machine.MetaMachine; import com.gregtechceu.gtceu.api.machine.feature.IExhaustVentMachine; import com.gregtechceu.gtceu.client.model.WorkableOverlayModel; + import com.lowdragmc.lowdraglib.client.bakedpipeline.FaceQuad; import com.lowdragmc.lowdraglib.client.model.ModelFactory; + import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.texture.TextureAtlas; import net.minecraft.client.resources.model.ModelState; @@ -18,6 +20,7 @@ import net.minecraftforge.api.distmarker.OnlyIn; import org.jetbrains.annotations.Nullable; + import java.util.List; import java.util.function.Consumer; @@ -27,17 +30,20 @@ * @implNote SteamBoilerRenderer */ public class WorkableSteamMachineRenderer extends SteamHullMachineRenderer { + public static final ResourceLocation VENT_OVERLAY = GTCEu.id("block/overlay/machine/overlay_steam_vent"); protected final WorkableOverlayModel overlayModel; public WorkableSteamMachineRenderer(boolean isHighTier, ResourceLocation overlay) { super(isHighTier, GTCEu.id("block/machine/hull_machine")); - this.overlayModel = new WorkableOverlayModel(overlay); + this.overlayModel = new WorkableOverlayModel(overlay); } @Override @OnlyIn(Dist.CLIENT) - public void renderMachine(List quads, MachineDefinition definition, @Nullable MetaMachine machine, Direction frontFacing, @Nullable Direction side, RandomSource rand, Direction modelFacing, ModelState modelState) { + public void renderMachine(List quads, MachineDefinition definition, @Nullable MetaMachine machine, + Direction frontFacing, @Nullable Direction side, RandomSource rand, Direction modelFacing, + ModelState modelState) { super.renderMachine(quads, definition, machine, frontFacing, side, rand, modelFacing, modelState); if (machine instanceof IWorkable workable) { quads.addAll(overlayModel.bakeQuads(side, frontFacing, workable.isActive(), workable.isWorkingEnabled())); @@ -60,5 +66,4 @@ public void onPrepareTextureAtlas(ResourceLocation atlasName, Consumer quads, MachineDefinition definition, @Nullable MetaMachine machine, Direction frontFacing, @Nullable Direction side, RandomSource rand, Direction modelFacing, ModelState modelState) { + public void renderMachine(List quads, MachineDefinition definition, @Nullable MetaMachine machine, + Direction frontFacing, @Nullable Direction side, RandomSource rand, Direction modelFacing, + ModelState modelState) { super.renderMachine(quads, definition, machine, frontFacing, side, rand, modelFacing, modelState); if (machine instanceof IWorkable workable) { quads.addAll(overlayModel.bakeQuads(side, frontFacing, workable.isActive(), workable.isWorkingEnabled())); @@ -50,5 +55,4 @@ public void onPrepareTextureAtlas(ResourceLocation atlasName, Consumer quads, MachineDefinition definition, @Nullable MetaMachine machine, Direction frontFacing, @Nullable Direction side, RandomSource rand, Direction modelFacing, ModelState modelState) { + public void renderMachine(List quads, MachineDefinition definition, @Nullable MetaMachine machine, + Direction frontFacing, @Nullable Direction side, RandomSource rand, Direction modelFacing, + ModelState modelState) { super.renderMachine(quads, definition, machine, frontFacing, side, rand, modelFacing, modelState); if (machine instanceof WorldAcceleratorMachine worldAcceleratorMachine) { WorkableOverlayModel model = getModeModel(worldAcceleratorMachine.isRandomTickMode()); - quads.addAll(model.bakeQuads(side, frontFacing, worldAcceleratorMachine.isActive(), worldAcceleratorMachine.isWorkingEnabled())); + quads.addAll(model.bakeQuads(side, frontFacing, worldAcceleratorMachine.isActive(), + worldAcceleratorMachine.isWorkingEnabled())); } else { quads.addAll(getModeModel(true).bakeQuads(side, frontFacing, false, false)); } diff --git a/src/main/java/com/gregtechceu/gtceu/client/util/ToolChargeBarRenderer.java b/src/main/java/com/gregtechceu/gtceu/client/util/ToolChargeBarRenderer.java index 5dd1c073c2..67832055cc 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/util/ToolChargeBarRenderer.java +++ b/src/main/java/com/gregtechceu/gtceu/client/util/ToolChargeBarRenderer.java @@ -2,18 +2,19 @@ import com.gregtechceu.gtceu.api.capability.GTCapabilityHelper; import com.gregtechceu.gtceu.api.capability.IElectricItem; -import com.gregtechceu.gtceu.api.item.ComponentItem; import com.gregtechceu.gtceu.api.item.IComponentItem; import com.gregtechceu.gtceu.api.item.IGTTool; import com.gregtechceu.gtceu.api.item.component.IDurabilityBar; import com.gregtechceu.gtceu.api.item.component.IItemComponent; import com.gregtechceu.gtceu.api.item.tool.ToolHelper; -import com.mojang.blaze3d.vertex.VertexConsumer; + import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.renderer.RenderType; import net.minecraft.nbt.CompoundTag; import net.minecraft.util.FastColor; import net.minecraft.world.item.ItemStack; + +import com.mojang.blaze3d.vertex.VertexConsumer; import org.apache.commons.lang3.tuple.Pair; import org.joml.Matrix4f; @@ -33,7 +34,8 @@ public final class ToolChargeBarRenderer { private static final int colorBarLeftDepleted = FastColor.ARGB32.color(255, 122, 0, 0); private static final int colorBarRightDepleted = FastColor.ARGB32.color(255, 255, 27, 27); - public static void render(GuiGraphics graphics, int level, int xPosition, int yPosition, int offset, boolean shadow, int left, int right, boolean doDepletedColor) { + public static void render(GuiGraphics graphics, int level, int xPosition, int yPosition, int offset, boolean shadow, + int left, int right, boolean doDepletedColor) { if (doDepletedColor && level <= BAR_W / 4) { left = colorBarLeftDepleted; right = colorBarRightDepleted; @@ -43,11 +45,11 @@ public static void render(GuiGraphics graphics, int level, int xPosition, int yP int y = yPosition + 13 - offset; graphics.fill(RenderType.guiOverlay(), x, y, x + 13, y + (shadow ? 2 : 1), 400, colorShadow); fillHorizontalGradient(graphics, RenderType.guiOverlay(), x, y, x + level, y + 1, left, right, 400); - //graphics.fill(RenderType.guiOverlay(), x + BAR_W, y, x + BAR_W - level, y - 1, colorBG); + // graphics.fill(RenderType.guiOverlay(), x + BAR_W, y, x + BAR_W - level, y - 1, colorBG); } - - public static void renderBarsTool(GuiGraphics graphics, IGTTool tool, ItemStack stack, int xPosition, int yPosition) { + public static void renderBarsTool(GuiGraphics graphics, IGTTool tool, ItemStack stack, int xPosition, + int yPosition) { boolean renderedDurability = false; CompoundTag tag = stack.getOrCreateTag(); if (!tag.getBoolean(ToolHelper.UNBREAKABLE_KEY)) { @@ -60,7 +62,8 @@ public static void renderBarsTool(GuiGraphics graphics, IGTTool tool, ItemStack } } - public static void renderBarsItem(GuiGraphics graphics, IComponentItem item, ItemStack stack, int xPosition, int yPosition) { + public static void renderBarsItem(GuiGraphics graphics, IComponentItem item, ItemStack stack, int xPosition, + int yPosition) { boolean renderedDurability = false; IDurabilityBar bar = null; for (IItemComponent component : item.getComponents()) { @@ -79,7 +82,8 @@ public static void renderBarsItem(GuiGraphics graphics, IComponentItem item, Ite } } - private static void renderElectricBar(GuiGraphics graphics, long charge, long maxCharge, int xPosition, int yPosition, boolean renderedDurability) { + private static void renderElectricBar(GuiGraphics graphics, long charge, long maxCharge, int xPosition, + int yPosition, boolean renderedDurability) { if (charge > 0 && maxCharge > 0) { int level = Math.round(charge * 13.0F / maxCharge); render(graphics, level, xPosition, yPosition, renderedDurability ? 2 : 0, true, colorBarLeftEnergy, @@ -87,7 +91,8 @@ private static void renderElectricBar(GuiGraphics graphics, long charge, long ma } } - private static boolean renderDurabilityBar(GuiGraphics graphics, ItemStack stack, IDurabilityBar manager, int xPosition, int yPosition) { + private static boolean renderDurabilityBar(GuiGraphics graphics, ItemStack stack, IDurabilityBar manager, + int xPosition, int yPosition) { float level = manager.getDurabilityForDisplay(stack); if (level == 0.0 && !manager.showEmptyBar(stack)) return false; if (level == 1.0 && !manager.showFullBar(stack)) return false; @@ -105,18 +110,20 @@ private static boolean renderDurabilityBar(GuiGraphics graphics, int level, int } /** - * Fills a rectangle with a gradient color from colorFrom to colorTo at the specified z-level using the given render type and coordinates as the boundaries. + * Fills a rectangle with a gradient color from colorFrom to colorTo at the specified z-level using the given render + * type and coordinates as the boundaries. * - * @param y2 the y-coordinate of the second corner of the rectangle. - * @param x2 the x-coordinate of the second corner of the rectangle. - * @param y1 the y-coordinate of the first corner of the rectangle. - * @param x1 the x-coordinate of the first corner of the rectangle. + * @param y2 the y-coordinate of the second corner of the rectangle. + * @param x2 the x-coordinate of the second corner of the rectangle. + * @param y1 the y-coordinate of the first corner of the rectangle. + * @param x1 the x-coordinate of the first corner of the rectangle. * @param renderType the render type to use. - * @param z the z-level of the rectangle. - * @param colorTo the ending color of the gradient. - * @param colorFrom the starting color of the gradient. + * @param z the z-level of the rectangle. + * @param colorTo the ending color of the gradient. + * @param colorFrom the starting color of the gradient. */ - public static void fillHorizontalGradient(GuiGraphics graphics, RenderType renderType, int x1, int y1, int x2, int y2, int colorFrom, int colorTo, int z) { + public static void fillHorizontalGradient(GuiGraphics graphics, RenderType renderType, int x1, int y1, int x2, + int y2, int colorFrom, int colorTo, int z) { VertexConsumer vertexconsumer = graphics.bufferSource().getBuffer(renderType); fillHorizontalGradient(graphics, vertexconsumer, x1, y1, x2, y2, z, colorFrom, colorTo); } @@ -124,32 +131,34 @@ public static void fillHorizontalGradient(GuiGraphics graphics, RenderType rende /** * The core `fillGradient` method. *

- * Fills a rectangle with a gradient color from colorFrom to colorTo at the specified z-level using the given render type and coordinates as the boundaries. + * Fills a rectangle with a gradient color from colorFrom to colorTo at the specified z-level using the given render + * type and coordinates as the boundaries. * - * @param consumer the {@linkplain VertexConsumer} object for drawing the vertices on screen. - * @param x1 the x-coordinate of the first corner of the rectangle. - * @param y1 the y-coordinate of the first corner of the rectangle. - * @param x2 the x-coordinate of the second corner of the rectangle. - * @param y2 the y-coordinate of the second corner of the rectangle. - * @param z the z-level of the rectangle. + * @param consumer the {@linkplain VertexConsumer} object for drawing the vertices on screen. + * @param x1 the x-coordinate of the first corner of the rectangle. + * @param y1 the y-coordinate of the first corner of the rectangle. + * @param x2 the x-coordinate of the second corner of the rectangle. + * @param y2 the y-coordinate of the second corner of the rectangle. + * @param z the z-level of the rectangle. * @param colorFrom the starting color of the gradient. - * @param colorTo the ending color of the gradient. + * @param colorTo the ending color of the gradient. */ - private static void fillHorizontalGradient(GuiGraphics graphics, VertexConsumer consumer, int x1, int y1, int x2, int y2, int z, int colorFrom, int colorTo) { - float a1 = (float)FastColor.ARGB32.alpha(colorFrom) / 255.0F; - float r1 = (float)FastColor.ARGB32.red(colorFrom) / 255.0F; - float g1 = (float)FastColor.ARGB32.green(colorFrom) / 255.0F; - float b1 = (float)FastColor.ARGB32.blue(colorFrom) / 255.0F; - float a2 = (float)FastColor.ARGB32.alpha(colorTo) / 255.0F; - float r2 = (float)FastColor.ARGB32.red(colorTo) / 255.0F; - float g2 = (float)FastColor.ARGB32.green(colorTo) / 255.0F; - float b2 = (float)FastColor.ARGB32.blue(colorTo) / 255.0F; + private static void fillHorizontalGradient(GuiGraphics graphics, VertexConsumer consumer, int x1, int y1, int x2, + int y2, int z, int colorFrom, int colorTo) { + float a1 = (float) FastColor.ARGB32.alpha(colorFrom) / 255.0F; + float r1 = (float) FastColor.ARGB32.red(colorFrom) / 255.0F; + float g1 = (float) FastColor.ARGB32.green(colorFrom) / 255.0F; + float b1 = (float) FastColor.ARGB32.blue(colorFrom) / 255.0F; + float a2 = (float) FastColor.ARGB32.alpha(colorTo) / 255.0F; + float r2 = (float) FastColor.ARGB32.red(colorTo) / 255.0F; + float g2 = (float) FastColor.ARGB32.green(colorTo) / 255.0F; + float b2 = (float) FastColor.ARGB32.blue(colorTo) / 255.0F; Matrix4f matrix4f = graphics.pose().last().pose(); - consumer.vertex(matrix4f, (float)x1, (float)y1, (float)z).color(r1, g1, b1, a1).endVertex(); - consumer.vertex(matrix4f, (float)x1, (float)y2, (float)z).color(r1, g1, b1, a1).endVertex(); - consumer.vertex(matrix4f, (float)x2, (float)y2, (float)z).color(r2, g2, b2, a2).endVertex(); - consumer.vertex(matrix4f, (float)x2, (float)y1, (float)z).color(r2, g2, b2, a2).endVertex(); + consumer.vertex(matrix4f, (float) x1, (float) y1, (float) z).color(r1, g1, b1, a1).endVertex(); + consumer.vertex(matrix4f, (float) x1, (float) y2, (float) z).color(r1, g1, b1, a1).endVertex(); + consumer.vertex(matrix4f, (float) x2, (float) y2, (float) z).color(r2, g2, b2, a2).endVertex(); + consumer.vertex(matrix4f, (float) x2, (float) y1, (float) z).color(r2, g2, b2, a2).endVertex(); } private ToolChargeBarRenderer() {} -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/CommonProxy.java b/src/main/java/com/gregtechceu/gtceu/common/CommonProxy.java index 0683449fee..f0764ee8b9 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/CommonProxy.java +++ b/src/main/java/com/gregtechceu/gtceu/common/CommonProxy.java @@ -1,9 +1,8 @@ package com.gregtechceu.gtceu.common; -import com.google.common.collect.Multimaps; import com.gregtechceu.gtceu.GTCEu; -import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.GTCEuAPI; +import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.addon.AddonFinder; import com.gregtechceu.gtceu.api.addon.IGTAddon; import com.gregtechceu.gtceu.api.capability.forge.GTCapability; @@ -44,16 +43,13 @@ import com.gregtechceu.gtceu.integration.kjs.events.MaterialModificationEventJS; import com.gregtechceu.gtceu.integration.top.forge.TheOneProbePluginImpl; import com.gregtechceu.gtceu.utils.input.KeyBind; + import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.gui.factory.UIFactory; -import com.tterrag.registrate.providers.ProviderType; -import com.tterrag.registrate.providers.RegistrateLangProvider; -import com.tterrag.registrate.providers.RegistrateProvider; -import com.tterrag.registrate.util.nullness.NonNullConsumer; + import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.server.packs.PackType; import net.minecraft.server.packs.repository.Pack; -import net.minecraft.server.packs.repository.RepositorySource; import net.minecraftforge.common.capabilities.RegisterCapabilitiesEvent; import net.minecraftforge.common.crafting.CraftingHelper; import net.minecraftforge.event.AddPackFindersEvent; @@ -68,10 +64,16 @@ import net.minecraftforge.fml.javafmlmod.FMLModContainer; import net.minecraftforge.registries.RegisterEvent; +import com.google.common.collect.Multimaps; +import com.tterrag.registrate.providers.ProviderType; +import com.tterrag.registrate.providers.RegistrateLangProvider; +import com.tterrag.registrate.providers.RegistrateProvider; +import com.tterrag.registrate.util.nullness.NonNullConsumer; + import java.util.List; -import java.util.stream.Collectors; public class CommonProxy { + public CommonProxy() { // used for forge events (ClientProxy + CommonProxy) IEventBus eventBus = FMLJavaModLoadingContext.get().getModEventBus(); @@ -85,6 +87,8 @@ public CommonProxy() { GTRegistries.init(eventBus); GTFeatures.init(eventBus); + GTCommandArguments.init(eventBus); + GTMobEffects.init(eventBus); // init common features GTRegistries.GLOBAL_LOOT_MODIFIES.register("tool", () -> ToolLootModifier.CODEC); } @@ -130,23 +134,26 @@ public static void init() { // Register all material manager registries, for materials with mod ids. GTCEuAPI.materialManager.getRegistries().forEach(registry -> { // Force the material lang generator to be at index 0, so that addons' lang generators can override it. - AbstractRegistrateAccessor accessor = (AbstractRegistrateAccessor)registry.getRegistrate(); + AbstractRegistrateAccessor accessor = (AbstractRegistrateAccessor) registry.getRegistrate(); if (accessor.getDoDatagen().get()) { - //noinspection UnstableApiUsage - List> providers = Multimaps.asMap(accessor.getDatagens()).get(ProviderType.LANG); + // noinspection UnstableApiUsage + List> providers = Multimaps.asMap(accessor.getDatagens()) + .get(ProviderType.LANG); if (providers.isEmpty()) { - providers.add((provider) -> MaterialLangGenerator.generate((RegistrateLangProvider) provider, registry)); + providers.add( + (provider) -> MaterialLangGenerator.generate((RegistrateLangProvider) provider, registry)); } else { - providers.add(0, (provider) -> MaterialLangGenerator.generate((RegistrateLangProvider) provider, registry)); + providers.add(0, + (provider) -> MaterialLangGenerator.generate((RegistrateLangProvider) provider, registry)); } } registry.getRegistrate() - .registerEventListeners(ModList.get().getModContainerById(registry.getModid()) - .filter(FMLModContainer.class::isInstance) - .map(FMLModContainer.class::cast) - .map(FMLModContainer::getEventBus) - .orElse(FMLJavaModLoadingContext.get().getModEventBus())); + .registerEventListeners(ModList.get().getModContainerById(registry.getModid()) + .filter(FMLModContainer.class::isInstance) + .map(FMLModContainer.class::cast) + .map(FMLModContainer::getEventBus) + .orElse(FMLJavaModLoadingContext.get().getModEventBus())); }); WorldGenLayers.registerAll(); @@ -168,8 +175,8 @@ private static void initMaterials() { GTCEu.LOGGER.info("Registering GTCEu Materials"); GTMaterials.init(); MaterialRegistryManager.getInstance() - .getRegistry(GTCEu.MOD_ID) - .setFallbackMaterial(GTMaterials.Aluminium); + .getRegistry(GTCEu.MOD_ID) + .setFallbackMaterial(GTMaterials.Aluminium); // Then, register addon Materials GTCEu.LOGGER.info("Registering addon Materials"); @@ -234,10 +241,9 @@ public void registerPackFinders(AddPackFindersEvent event) { GTDynamicResourcePack.clearClient(); event.addRepositorySource(new GTPackSource("gtceu:dynamic_assets", - event.getPackType(), - Pack.Position.BOTTOM, - GTDynamicResourcePack::new) - ); + event.getPackType(), + Pack.Position.BOTTOM, + GTDynamicResourcePack::new)); } else { // Clear old data GTDynamicDataPack.clearServer(); @@ -251,14 +257,14 @@ public void registerPackFinders(AddPackFindersEvent event) { GTCEu.LOGGER.info("GregTech Data loading took {}ms", System.currentTimeMillis() - startTime); event.addRepositorySource(new GTPackSource("gtceu:dynamic_data", - event.getPackType(), - Pack.Position.BOTTOM, - GTDynamicDataPack::new) - ); + event.getPackType(), + Pack.Position.BOTTOM, + GTDynamicDataPack::new)); } } public static final class KJSEventWrapper { + public static void materialRegistry() { GTRegistryInfo.registerFor(GTCEuAPI.materialManager.getRegistry(GTCEu.MOD_ID).getRegistryName()); } diff --git a/src/main/java/com/gregtechceu/gtceu/common/ServerCommands.java b/src/main/java/com/gregtechceu/gtceu/common/ServerCommands.java deleted file mode 100644 index 30c41aaec7..0000000000 --- a/src/main/java/com/gregtechceu/gtceu/common/ServerCommands.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gregtechceu.gtceu.common; - -import com.gregtechceu.gtceu.api.gui.factory.GTUIEditorFactory; -import com.gregtechceu.gtceu.api.recipe.GTRecipe; -import com.lowdragmc.lowdraglib.gui.factory.UIEditorFactory; -import com.mojang.brigadier.builder.LiteralArgumentBuilder; -import net.minecraft.commands.CommandSourceStack; -import net.minecraft.commands.Commands; -import net.minecraft.network.chat.Component; -import net.minecraft.world.item.crafting.Recipe; - -import java.util.List; - -/** - * @author KilaBash - * @date 2023/2/9 - * @implNote ServerCommands - */ -public class ServerCommands { - public static List> createServerCommands() { - return List.of( - Commands.literal("gtceu") - .then(Commands.literal("ui_editor") - .executes(context -> { - GTUIEditorFactory.INSTANCE.openUI(GTUIEditorFactory.INSTANCE, context.getSource().getPlayerOrException()); - return 1; - }) - ) - .then(Commands.literal("check_recipes_valid") - .requires(cs -> cs.hasPermission(0)) - .executes(context -> { - for (Recipe recipe : context.getSource().getServer().getRecipeManager().getRecipes()) { - if (recipe instanceof GTRecipe gtRecipe && !gtRecipe.checkRecipeValid()) { - context.getSource().sendSuccess(() -> Component.literal("recipe %s is invalid".formatted(gtRecipe.id)), false); - } - } - return 1; - }) - ) - ); - } -} diff --git a/src/main/java/com/gregtechceu/gtceu/common/block/BatteryBlock.java b/src/main/java/com/gregtechceu/gtceu/common/block/BatteryBlock.java index b319aeb9a1..20cca8dde7 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/block/BatteryBlock.java +++ b/src/main/java/com/gregtechceu/gtceu/common/block/BatteryBlock.java @@ -3,15 +3,19 @@ import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.block.AppearanceBlock; import com.gregtechceu.gtceu.api.machine.multiblock.IBatteryData; + import com.lowdragmc.lowdraglib.client.renderer.IBlockRendererProvider; import com.lowdragmc.lowdraglib.client.renderer.IRenderer; -import lombok.Getter; + import net.minecraft.util.StringRepresentable; import net.minecraft.world.level.block.state.BlockState; + +import lombok.Getter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class BatteryBlock extends AppearanceBlock implements IBlockRendererProvider { + private final IRenderer renderer; @Getter @@ -30,6 +34,7 @@ public IRenderer getRenderer(BlockState state) { } public enum BatteryPartType implements StringRepresentable, IBatteryData { + EMPTY_TIER_I, EV_LAPOTRONIC(GTValues.EV, 25_000_000L * 6), // Lapotron Crystal * 6 IV_LAPOTRONIC(GTValues.IV, 250_000_000L * 6), // Lapotronic Orb * 6 diff --git a/src/main/java/com/gregtechceu/gtceu/common/block/BoilerFireboxType.java b/src/main/java/com/gregtechceu/gtceu/common/block/BoilerFireboxType.java index 45d91cab9e..6bfd4a3949 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/block/BoilerFireboxType.java +++ b/src/main/java/com/gregtechceu/gtceu/common/block/BoilerFireboxType.java @@ -1,9 +1,10 @@ package com.gregtechceu.gtceu.common.block; import com.gregtechceu.gtceu.GTCEu; -import lombok.Getter; + import net.minecraft.resources.ResourceLocation; +import lombok.Getter; import org.jetbrains.annotations.NotNull; /** @@ -11,20 +12,25 @@ * @date 2023/3/9 * @implNote BoilerFireBoxCasingBlock */ -public record BoilerFireboxType(@Getter String name, @Getter ResourceLocation bottom, @Getter ResourceLocation top, @Getter ResourceLocation side) { +public record BoilerFireboxType(@Getter String name, @Getter ResourceLocation bottom, @Getter ResourceLocation top, + @Getter ResourceLocation side) { - public static BoilerFireboxType BRONZE_FIREBOX = new BoilerFireboxType("bronze_firebox", GTCEu.id("block/casings/solid/machine_casing_bronze_plated_bricks") - , GTCEu.id("block/casings/solid/machine_casing_bronze_plated_bricks") - , GTCEu.id("block/casings/firebox/machine_casing_firebox_bronze")); - public static BoilerFireboxType STEEL_FIREBOX = new BoilerFireboxType("steel_firebox", GTCEu.id("block/casings/solid/machine_casing_solid_steel") - , GTCEu.id("block/casings/solid/machine_casing_solid_steel") - , GTCEu.id("block/casings/firebox/machine_casing_firebox_steel")); - public static BoilerFireboxType TITANIUM_FIREBOX = new BoilerFireboxType("titanium_firebox", GTCEu.id("block/casings/solid/machine_casing_stable_titanium") - , GTCEu.id("block/casings/solid/machine_casing_stable_titanium") - , GTCEu.id("block/casings/firebox/machine_casing_firebox_titanium")); - public static BoilerFireboxType TUNGSTENSTEEL_FIREBOX = new BoilerFireboxType("tungstensteel_firebox", GTCEu.id("block/casings/solid/machine_casing_robust_tungstensteel") - , GTCEu.id("block/casings/solid/machine_casing_robust_tungstensteel") - , GTCEu.id("block/casings/firebox/machine_casing_firebox_tungstensteel")); + public static BoilerFireboxType BRONZE_FIREBOX = new BoilerFireboxType("bronze_firebox", + GTCEu.id("block/casings/solid/machine_casing_bronze_plated_bricks"), + GTCEu.id("block/casings/solid/machine_casing_bronze_plated_bricks"), + GTCEu.id("block/casings/firebox/machine_casing_firebox_bronze")); + public static BoilerFireboxType STEEL_FIREBOX = new BoilerFireboxType("steel_firebox", + GTCEu.id("block/casings/solid/machine_casing_solid_steel"), + GTCEu.id("block/casings/solid/machine_casing_solid_steel"), + GTCEu.id("block/casings/firebox/machine_casing_firebox_steel")); + public static BoilerFireboxType TITANIUM_FIREBOX = new BoilerFireboxType("titanium_firebox", + GTCEu.id("block/casings/solid/machine_casing_stable_titanium"), + GTCEu.id("block/casings/solid/machine_casing_stable_titanium"), + GTCEu.id("block/casings/firebox/machine_casing_firebox_titanium")); + public static BoilerFireboxType TUNGSTENSTEEL_FIREBOX = new BoilerFireboxType("tungstensteel_firebox", + GTCEu.id("block/casings/solid/machine_casing_robust_tungstensteel"), + GTCEu.id("block/casings/solid/machine_casing_robust_tungstensteel"), + GTCEu.id("block/casings/firebox/machine_casing_firebox_tungstensteel")); @NotNull @Override diff --git a/src/main/java/com/gregtechceu/gtceu/common/block/CableBlock.java b/src/main/java/com/gregtechceu/gtceu/common/block/CableBlock.java index 5df4796296..54e9bda762 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/block/CableBlock.java +++ b/src/main/java/com/gregtechceu/gtceu/common/block/CableBlock.java @@ -12,10 +12,10 @@ import com.gregtechceu.gtceu.common.blockentity.CableBlockEntity; import com.gregtechceu.gtceu.common.data.GTBlockEntities; import com.gregtechceu.gtceu.common.data.GTDamageTypes; -import com.gregtechceu.gtceu.common.pipelike.cable.CableData; import com.gregtechceu.gtceu.common.pipelike.cable.Insulation; import com.gregtechceu.gtceu.common.pipelike.cable.LevelEnergyNet; import com.gregtechceu.gtceu.utils.GTUtil; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -32,13 +32,13 @@ import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.phys.shapes.CollisionContext; -import net.minecraft.world.phys.shapes.VoxelShape; + import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.List; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author KilaBash * @date 2023/3/1 @@ -53,7 +53,8 @@ public CableBlock(Properties properties, Insulation insulation, Material materia } @Override - public int tinted(BlockState blockState, @Nullable BlockAndTintGetter blockAndTintGetter, @Nullable BlockPos blockPos, int index) { + public int tinted(BlockState blockState, @Nullable BlockAndTintGetter blockAndTintGetter, + @Nullable BlockPos blockPos, int index) { if (pipeType.isCable && index == 0) { return 0x404040; } @@ -81,13 +82,16 @@ public BlockEntityType> ge } @Override - public boolean canPipesConnect(IPipeNode selfTile, Direction side, IPipeNode sideTile) { + public boolean canPipesConnect(IPipeNode selfTile, Direction side, + IPipeNode sideTile) { return selfTile instanceof CableBlockEntity && sideTile instanceof CableBlockEntity; } @Override - public boolean canPipeConnectToBlock(IPipeNode selfTile, Direction side, @Nullable BlockEntity tile) { - return tile != null && tile.getCapability(GTCapability.CAPABILITY_ENERGY_CONTAINER, side.getOpposite()).isPresent(); + public boolean canPipeConnectToBlock(IPipeNode selfTile, Direction side, + @Nullable BlockEntity tile) { + return tile != null && + tile.getCapability(GTCapability.CAPABILITY_ENERGY_CONTAINER, side.getOpposite()).isPresent(); } @Override @@ -96,11 +100,13 @@ protected PipeModel createPipeModel() { } @Override - public void appendHoverText(ItemStack stack, @Nullable BlockGetter level, List tooltip, TooltipFlag flag) { + public void appendHoverText(ItemStack stack, @Nullable BlockGetter level, List tooltip, + TooltipFlag flag) { super.appendHoverText(stack, level, tooltip, flag); WireProperties wireProperties = createProperties(defaultBlockState(), stack); int tier = GTUtil.getTierByVoltage(wireProperties.getVoltage()); - if (wireProperties.isSuperconductor()) tooltip.add(Component.translatable("gtceu.cable.superconductor", GTValues.VN[tier])); + if (wireProperties.isSuperconductor()) + tooltip.add(Component.translatable("gtceu.cable.superconductor", GTValues.VN[tier])); tooltip.add(Component.translatable("gtceu.cable.voltage", wireProperties.getVoltage(), GTValues.VNF[tier])); tooltip.add(Component.translatable("gtceu.cable.amperage", wireProperties.getAmperage())); tooltip.add(Component.translatable("gtceu.cable.loss_per_block", wireProperties.getLossPerBlock())); @@ -120,7 +126,7 @@ public void entityInside(BlockState state, Level level, BlockPos pos, Entity ent entityLiving.hurt(GTDamageTypes.ELECTRIC.source(level), damageAmount); if (entityLiving instanceof ServerPlayer) { // TODO advancments - //AdvancementTriggers.ELECTROCUTION_DEATH.trigger((EntityPlayerMP) entityLiving); + // AdvancementTriggers.ELECTROCUTION_DEATH.trigger((EntityPlayerMP) entityLiving); } } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/block/CleanroomFilterType.java b/src/main/java/com/gregtechceu/gtceu/common/block/CleanroomFilterType.java index 75b9109887..c7a5fa82b0 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/block/CleanroomFilterType.java +++ b/src/main/java/com/gregtechceu/gtceu/common/block/CleanroomFilterType.java @@ -2,8 +2,8 @@ import com.gregtechceu.gtceu.api.block.IFilterType; import com.gregtechceu.gtceu.api.machine.multiblock.CleanroomType; -import lombok.Getter; +import lombok.Getter; import org.jetbrains.annotations.NotNull; public enum CleanroomFilterType implements IFilterType { @@ -31,5 +31,4 @@ public String getSerializedName() { public String toString() { return getSerializedName(); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/block/CoilBlock.java b/src/main/java/com/gregtechceu/gtceu/common/block/CoilBlock.java index c49dcd95fd..11630ce9ab 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/block/CoilBlock.java +++ b/src/main/java/com/gregtechceu/gtceu/common/block/CoilBlock.java @@ -7,22 +7,25 @@ import com.gregtechceu.gtceu.client.renderer.block.TextureOverrideRenderer; import com.gregtechceu.gtceu.common.data.GTMaterials; import com.gregtechceu.gtceu.utils.GTUtil; + import com.lowdragmc.lowdraglib.Platform; -import lombok.Getter; + import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.StringRepresentable; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.level.BlockGetter; + +import lombok.Getter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.jetbrains.annotations.NotNull; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.List; import java.util.Map; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author KilaBash * @date 2023/3/4 @@ -30,28 +33,34 @@ */ @ParametersAreNonnullByDefault public class CoilBlock extends ActiveBlock { + public ICoilType coilType; public CoilBlock(Properties properties, ICoilType coilType) { super(properties, Platform.isClient() ? new TextureOverrideRenderer(new ResourceLocation("block/cube_all"), - Map.of("all", coilType.getTexture())) : null, + Map.of("all", coilType.getTexture())) : null, Platform.isClient() ? new TextureOverrideRenderer(GTCEu.id("block/cube_2_layer_all"), Map.of("bot_all", coilType.getTexture(), - "top_all", new ResourceLocation(coilType.getTexture() + "_bloom"))) : null); + "top_all", new ResourceLocation(coilType.getTexture() + "_bloom"))) : + null); this.coilType = coilType; } @Override - public void appendHoverText(ItemStack stack, @Nullable BlockGetter level, List tooltip, TooltipFlag flag) { + public void appendHoverText(ItemStack stack, @Nullable BlockGetter level, List tooltip, + TooltipFlag flag) { super.appendHoverText(stack, level, tooltip, flag); if (GTUtil.isShiftDown()) { int coilTier = coilType.getTier(); tooltip.add(Component.translatable("block.gtceu.wire_coil.tooltip_heat", coilType.getCoilTemperature())); tooltip.add(Component.translatable("block.gtceu.wire_coil.tooltip_smelter")); - tooltip.add(Component.translatable("block.gtceu.wire_coil.tooltip_parallel_smelter", coilType.getLevel() * 32)); - tooltip.add(Component.translatable("block.gtceu.wire_coil.tooltip_energy_smelter", Math.max(1, 16 / coilType.getEnergyDiscount()))); + tooltip.add( + Component.translatable("block.gtceu.wire_coil.tooltip_parallel_smelter", coilType.getLevel() * 32)); + tooltip.add(Component.translatable("block.gtceu.wire_coil.tooltip_energy_smelter", + Math.max(1, 16 / coilType.getEnergyDiscount()))); tooltip.add(Component.translatable("block.gtceu.wire_coil.tooltip_pyro")); - tooltip.add(Component.translatable("block.gtceu.wire_coil.tooltip_speed_pyro", coilTier == 0 ? 75 : 50 * (coilTier + 1))); + tooltip.add(Component.translatable("block.gtceu.wire_coil.tooltip_speed_pyro", + coilTier == 0 ? 75 : 50 * (coilTier + 1))); tooltip.add(Component.translatable("block.gtceu.wire_coil.tooltip_cracking")); tooltip.add(Component.translatable("block.gtceu.wire_coil.tooltip_energy_cracking", 100 - 10 * coilTier)); } else { @@ -60,31 +69,38 @@ public void appendHoverText(ItemStack stack, @Nullable BlockGetter level, List selfTile, Direction side, IPipeNode sideTile) { + public boolean canPipesConnect(IPipeNode selfTile, Direction side, + IPipeNode sideTile) { return selfTile instanceof FluidPipeBlockEntity && sideTile instanceof FluidPipeBlockEntity; } @Override - public boolean canPipeConnectToBlock(IPipeNode selfTile, Direction side, @Nullable BlockEntity tile) { + public boolean canPipeConnectToBlock(IPipeNode selfTile, Direction side, + @Nullable BlockEntity tile) { return tile != null && tile.getCapability(ForgeCapabilities.FLUID_HANDLER, side.getOpposite()).isPresent(); } @@ -91,7 +94,8 @@ protected PipeModel createPipeModel() { } @Override - public void appendHoverText(ItemStack stack, @Nullable BlockGetter level, List tooltip, TooltipFlag flag) { + public void appendHoverText(ItemStack stack, @Nullable BlockGetter level, List tooltip, + TooltipFlag flag) { super.appendHoverText(stack, level, tooltip, flag); FluidPipeProperties properties = createProperties(defaultBlockState(), stack); diff --git a/src/main/java/com/gregtechceu/gtceu/common/block/FusionCasingBlock.java b/src/main/java/com/gregtechceu/gtceu/common/block/FusionCasingBlock.java index 3e6d94cb01..f5e793f074 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/block/FusionCasingBlock.java +++ b/src/main/java/com/gregtechceu/gtceu/common/block/FusionCasingBlock.java @@ -4,21 +4,25 @@ import com.gregtechceu.gtceu.api.block.ActiveBlock; import com.gregtechceu.gtceu.api.block.IFusionCasingType; import com.gregtechceu.gtceu.client.renderer.block.TextureOverrideRenderer; + import com.lowdragmc.lowdraglib.Platform; -import lombok.Getter; + import net.minecraft.resources.ResourceLocation; import net.minecraft.util.StringRepresentable; +import lombok.Getter; + import java.util.Map; public class FusionCasingBlock extends ActiveBlock { public FusionCasingBlock(Properties properties, IFusionCasingType casingType) { super(properties, Platform.isClient() ? new TextureOverrideRenderer(new ResourceLocation("block/cube_all"), - Map.of("all", casingType.getTexture())) : null, + Map.of("all", casingType.getTexture())) : null, Platform.isClient() ? new TextureOverrideRenderer(GTCEu.id("block/cube_2_layer_all"), Map.of("bot_all", casingType.getTexture(), - "top_all", new ResourceLocation(casingType.getTexture() + "_bloom"))) : null); + "top_all", new ResourceLocation(casingType.getTexture() + "_bloom"))) : + null); } public enum CasingType implements IFusionCasingType, StringRepresentable { diff --git a/src/main/java/com/gregtechceu/gtceu/common/block/GTCeilingHangingSignBlock.java b/src/main/java/com/gregtechceu/gtceu/common/block/GTCeilingHangingSignBlock.java index 0f895daa97..cda5421857 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/block/GTCeilingHangingSignBlock.java +++ b/src/main/java/com/gregtechceu/gtceu/common/block/GTCeilingHangingSignBlock.java @@ -2,6 +2,7 @@ import com.gregtechceu.gtceu.common.blockentity.GTHangingSignBlockEntity; import com.gregtechceu.gtceu.common.data.GTBlockEntities; + import net.minecraft.core.BlockPos; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.CeilingHangingSignBlock; @@ -15,6 +16,7 @@ import javax.annotation.Nullable; public class GTCeilingHangingSignBlock extends CeilingHangingSignBlock { + public GTCeilingHangingSignBlock(Properties properties, WoodType type) { super(properties, type); } @@ -26,7 +28,8 @@ public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { @Nullable @Override - public BlockEntityTicker getTicker(Level level, BlockState state, BlockEntityType blockEntityType) { + public BlockEntityTicker getTicker(Level level, BlockState state, + BlockEntityType blockEntityType) { return createTickerHelper(blockEntityType, GTBlockEntities.GT_HANGING_SIGN.get(), SignBlockEntity::tick); } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/block/GTStandingSignBlock.java b/src/main/java/com/gregtechceu/gtceu/common/block/GTStandingSignBlock.java index 64e1ddc8c2..c1c73cf49b 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/block/GTStandingSignBlock.java +++ b/src/main/java/com/gregtechceu/gtceu/common/block/GTStandingSignBlock.java @@ -1,9 +1,9 @@ package com.gregtechceu.gtceu.common.block; import com.gregtechceu.gtceu.common.data.GTBlockEntities; + import net.minecraft.core.BlockPos; import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.SignBlock; import net.minecraft.world.level.block.StandingSignBlock; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityTicker; @@ -15,6 +15,7 @@ import javax.annotation.Nullable; public class GTStandingSignBlock extends StandingSignBlock { + public GTStandingSignBlock(Properties properties, WoodType type) { super(properties, type); } @@ -26,7 +27,8 @@ public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { @Nullable @Override - public BlockEntityTicker getTicker(Level level, BlockState state, BlockEntityType blockEntityType) { + public BlockEntityTicker getTicker(Level level, BlockState state, + BlockEntityType blockEntityType) { return createTickerHelper(blockEntityType, GTBlockEntities.GT_SIGN.get(), SignBlockEntity::tick); } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/block/GTWallHangingSignBlock.java b/src/main/java/com/gregtechceu/gtceu/common/block/GTWallHangingSignBlock.java index 7ca0c2012a..328fbb5128 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/block/GTWallHangingSignBlock.java +++ b/src/main/java/com/gregtechceu/gtceu/common/block/GTWallHangingSignBlock.java @@ -2,6 +2,7 @@ import com.gregtechceu.gtceu.common.blockentity.GTHangingSignBlockEntity; import com.gregtechceu.gtceu.common.data.GTBlockEntities; + import net.minecraft.core.BlockPos; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.WallHangingSignBlock; @@ -15,6 +16,7 @@ import javax.annotation.Nullable; public class GTWallHangingSignBlock extends WallHangingSignBlock { + public GTWallHangingSignBlock(Properties properties, WoodType type) { super(properties, type); } @@ -26,7 +28,8 @@ public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { @Nullable @Override - public BlockEntityTicker getTicker(Level level, BlockState state, BlockEntityType blockEntityType) { + public BlockEntityTicker getTicker(Level level, BlockState state, + BlockEntityType blockEntityType) { return createTickerHelper(blockEntityType, GTBlockEntities.GT_HANGING_SIGN.get(), SignBlockEntity::tick); } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/block/GTWallSignBlock.java b/src/main/java/com/gregtechceu/gtceu/common/block/GTWallSignBlock.java index a31fcdcf11..a400ec7df6 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/block/GTWallSignBlock.java +++ b/src/main/java/com/gregtechceu/gtceu/common/block/GTWallSignBlock.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.common.block; import com.gregtechceu.gtceu.common.data.GTBlockEntities; + import net.minecraft.core.BlockPos; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.WallSignBlock; @@ -14,6 +15,7 @@ import javax.annotation.Nullable; public class GTWallSignBlock extends WallSignBlock { + public GTWallSignBlock(Properties properties, WoodType type) { super(properties, type); } @@ -25,7 +27,8 @@ public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { @Nullable @Override - public BlockEntityTicker getTicker(Level level, BlockState state, BlockEntityType blockEntityType) { + public BlockEntityTicker getTicker(Level level, BlockState state, + BlockEntityType blockEntityType) { return createTickerHelper(blockEntityType, GTBlockEntities.GT_SIGN.get(), SignBlockEntity::tick); } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/block/ItemPipeBlock.java b/src/main/java/com/gregtechceu/gtceu/common/block/ItemPipeBlock.java index 371a4890e1..c7affc0a67 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/block/ItemPipeBlock.java +++ b/src/main/java/com/gregtechceu/gtceu/common/block/ItemPipeBlock.java @@ -11,6 +11,7 @@ import com.gregtechceu.gtceu.common.data.GTBlockEntities; import com.gregtechceu.gtceu.common.pipelike.item.ItemPipeType; import com.gregtechceu.gtceu.common.pipelike.item.LevelItemPipeNet; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.network.chat.Component; @@ -21,14 +22,17 @@ import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraftforge.common.capabilities.ForgeCapabilities; + import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.List; +import javax.annotation.ParametersAreNonnullByDefault; + @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class ItemPipeBlock extends MaterialPipeBlock { + public ItemPipeBlock(Properties properties, ItemPipeType itemPipeType, Material material) { super(properties, itemPipeType, material); } @@ -59,14 +63,17 @@ public BlockEntityType tooltip, TooltipFlag flag) { + public void appendHoverText(ItemStack stack, @Nullable BlockGetter level, List tooltip, + TooltipFlag flag) { super.appendHoverText(stack, level, tooltip, flag); ItemPipeProperties properties = createProperties(defaultBlockState(), stack); if (properties.getTransferRate() % 1 != 0) { - tooltip.add(Component.translatable("gtceu.universal.tooltip.item_transfer_rate", (int) ((properties.getTransferRate() * 64) + 0.5))); + tooltip.add(Component.translatable("gtceu.universal.tooltip.item_transfer_rate", + (int) ((properties.getTransferRate() * 64) + 0.5))); } else { - tooltip.add(Component.translatable("gtceu.universal.tooltip.item_transfer_rate_stacks", (int) properties.getTransferRate())); + tooltip.add(Component.translatable("gtceu.universal.tooltip.item_transfer_rate_stacks", + (int) properties.getTransferRate())); } tooltip.add(Component.translatable("gtceu.item_pipe.priority", properties.getPriority())); @@ -82,6 +89,6 @@ public boolean canPipesConnect(IPipeNode selfT public boolean canPipeConnectToBlock(IPipeNode selfTile, Direction side, @Nullable BlockEntity tile) { return tile != null && - tile.getCapability(ForgeCapabilities.ITEM_HANDLER, side.getOpposite()).isPresent(); + tile.getCapability(ForgeCapabilities.ITEM_HANDLER, side.getOpposite()).isPresent(); } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/block/KineticMachineBlock.java b/src/main/java/com/gregtechceu/gtceu/common/block/KineticMachineBlock.java index b0f2fde320..29d1754022 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/block/KineticMachineBlock.java +++ b/src/main/java/com/gregtechceu/gtceu/common/block/KineticMachineBlock.java @@ -7,8 +7,7 @@ import com.gregtechceu.gtceu.common.blockentity.KineticMachineBlockEntity; import com.gregtechceu.gtceu.common.machine.KineticMachineDefinition; import com.gregtechceu.gtceu.common.machine.kinetic.IKineticMachine; -import com.simibubi.create.content.kinetics.base.IRotate; -import com.simibubi.create.content.kinetics.base.KineticBlockEntity; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.level.Level; @@ -19,6 +18,9 @@ import net.minecraft.world.level.block.entity.BlockEntityTicker; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; + +import com.simibubi.create.content.kinetics.base.IRotate; +import com.simibubi.create.content.kinetics.base.KineticBlockEntity; import org.jetbrains.annotations.Nullable; /** @@ -27,7 +29,7 @@ * @implNote KineticMachineBlock */ public class KineticMachineBlock extends MetaMachineBlock implements IRotate { - + public KineticMachineBlock(Properties properties, KineticMachineDefinition definition) { super(properties, definition); } @@ -42,7 +44,8 @@ public boolean hasShaftTowards(LevelReader world, BlockPos pos, BlockState state public Direction getRotationFacing(BlockState state) { var frontFacing = getFrontFacing(state); - return ((KineticMachineDefinition)definition).isFrontRotation() ? frontFacing : (frontFacing.getAxis() == Direction.Axis.Y ? Direction.NORTH : frontFacing.getClockWise()); + return ((KineticMachineDefinition) definition).isFrontRotation() ? frontFacing : + (frontFacing.getAxis() == Direction.Axis.Y ? Direction.NORTH : frontFacing.getClockWise()); } @Override @@ -74,7 +77,8 @@ public void onPlace(BlockState state, Level level, BlockPos pos, BlockState oldS @Override public BlockState rotate(BlockState pState, Rotation pRotation) { - return pState.setValue(this.rotationState.property, pRotation.rotate(pState.getValue(this.rotationState.property))); + return pState.setValue(this.rotationState.property, + pRotation.rotate(pState.getValue(this.rotationState.property))); } public boolean areStatesKineticallyEquivalent(BlockState oldState, BlockState newState) { @@ -84,7 +88,8 @@ public boolean areStatesKineticallyEquivalent(BlockState oldState, BlockState ne } @Override - public void updateIndirectNeighbourShapes(BlockState stateIn, LevelAccessor worldIn, BlockPos pos, int flags, int count) { + public void updateIndirectNeighbourShapes(BlockState stateIn, LevelAccessor worldIn, BlockPos pos, int flags, + int count) { if (worldIn.isClientSide()) return; @@ -102,18 +107,20 @@ public void updateIndirectNeighbourShapes(BlockState stateIn, LevelAccessor worl } @Override - public @Nullable BlockEntityTicker getTicker(Level level, BlockState state, BlockEntityType blockEntityType) { + public @Nullable BlockEntityTicker getTicker(Level level, BlockState state, + BlockEntityType blockEntityType) { if (blockEntityType == getDefinition().getBlockEntityType()) { if (!level.isClientSide) { return (pLevel, pPos, pState, pTile) -> { - if (pState.getValue(BlockProperties.SERVER_TICK) && pTile instanceof IMachineBlockEntity metaMachine) { + if (pState.getValue(BlockProperties.SERVER_TICK) && + pTile instanceof IMachineBlockEntity metaMachine) { metaMachine.getMetaMachine().serverTick(); } if (pTile instanceof KineticMachineBlockEntity kineticMachineBlockEntity) { kineticMachineBlockEntity.tick(); } }; - } else { + } else { return (pLevel, pPos, pState, pTile) -> { if (pTile instanceof IMachineBlockEntity metaMachine) { metaMachine.getMetaMachine().clientTick(); diff --git a/src/main/java/com/gregtechceu/gtceu/common/block/LaserPipeBlock.java b/src/main/java/com/gregtechceu/gtceu/common/block/LaserPipeBlock.java index 875d5fedab..f1ae3c3adb 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/block/LaserPipeBlock.java +++ b/src/main/java/com/gregtechceu/gtceu/common/block/LaserPipeBlock.java @@ -12,6 +12,7 @@ import com.gregtechceu.gtceu.common.pipelike.laser.LaserPipeProperties; import com.gregtechceu.gtceu.common.pipelike.laser.LaserPipeType; import com.gregtechceu.gtceu.common.pipelike.laser.LevelLaserPipeNet; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.client.color.block.BlockColor; import net.minecraft.core.Direction; @@ -22,6 +23,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + import org.jetbrains.annotations.Nullable; import javax.annotation.ParametersAreNonnullByDefault; @@ -37,14 +39,16 @@ public class LaserPipeBlock extends PipeBlock GTCEu.id("block/pipe/pipe_laser_side"), () -> GTCEu.id("block/pipe/pipe_laser_in"), null, null); + this.model = new PipeModel(LaserPipeType.NORMAL.getThickness(), () -> GTCEu.id("block/pipe/pipe_laser_side"), + () -> GTCEu.id("block/pipe/pipe_laser_in"), null, null); this.renderer = new PipeBlockRenderer(this.model); } @OnlyIn(Dist.CLIENT) public static BlockColor tintedColor() { return (blockState, level, blockPos, index) -> { - if (blockPos != null && level != null && level.getBlockEntity(blockPos) instanceof PipeBlockEntity pipe && pipe.isPainted()) { + if (blockPos != null && level != null && + level.getBlockEntity(blockPos) instanceof PipeBlockEntity pipe && pipe.isPainted()) { return pipe.getRealColor(); } return -1; @@ -95,7 +99,8 @@ public boolean canPipesConnect(IPipeNode sel } @Override - public boolean canPipeConnectToBlock(IPipeNode selfTile, Direction side, @Nullable BlockEntity tile) { + public boolean canPipeConnectToBlock(IPipeNode selfTile, Direction side, + @Nullable BlockEntity tile) { return tile != null && tile.getCapability(GTCapability.CAPABILITY_LASER, side.getOpposite()).isPresent(); } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/block/MinerPipeBlock.java b/src/main/java/com/gregtechceu/gtceu/common/block/MinerPipeBlock.java index 59eef5b54e..18419d6c72 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/block/MinerPipeBlock.java +++ b/src/main/java/com/gregtechceu/gtceu/common/block/MinerPipeBlock.java @@ -14,7 +14,7 @@ */ public class MinerPipeBlock extends Block { - public static VoxelShape SHAPE = Block.box(4,0, 4, 12, 16, 12); + public static VoxelShape SHAPE = Block.box(4, 0, 4, 12, 16, 12); public MinerPipeBlock(Properties properties) { super(properties); diff --git a/src/main/java/com/gregtechceu/gtceu/common/block/OpticalPipeBlock.java b/src/main/java/com/gregtechceu/gtceu/common/block/OpticalPipeBlock.java index a1b27a3095..8c3dbb3dec 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/block/OpticalPipeBlock.java +++ b/src/main/java/com/gregtechceu/gtceu/common/block/OpticalPipeBlock.java @@ -9,10 +9,10 @@ import com.gregtechceu.gtceu.client.renderer.block.PipeBlockRenderer; import com.gregtechceu.gtceu.common.blockentity.OpticalPipeBlockEntity; import com.gregtechceu.gtceu.common.data.GTBlockEntities; +import com.gregtechceu.gtceu.common.pipelike.optical.LevelOpticalPipeNet; import com.gregtechceu.gtceu.common.pipelike.optical.OpticalPipeProperties; import com.gregtechceu.gtceu.common.pipelike.optical.OpticalPipeType; -import com.gregtechceu.gtceu.common.pipelike.optical.LevelOpticalPipeNet; -import lombok.Getter; + import net.minecraft.core.Direction; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.item.ItemStack; @@ -20,6 +20,8 @@ import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; + +import lombok.Getter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -39,7 +41,8 @@ public OpticalPipeBlock(BlockBehaviour.Properties properties, @NotNull OpticalPi super(properties, pipeType); this.pipeType = pipeType; this.properties = OpticalPipeProperties.INSTANCE; - this.pipeModel = new PipeModel(pipeType.getThickness(), () -> GTCEu.id("block/pipe/pipe_optical_side"), () -> GTCEu.id("block/pipe/pipe_optical_in"), null, null); + this.pipeModel = new PipeModel(pipeType.getThickness(), () -> GTCEu.id("block/pipe/pipe_optical_side"), + () -> GTCEu.id("block/pipe/pipe_optical_in"), null, null); this.renderer = new PipeBlockRenderer(this.pipeModel); } @@ -82,9 +85,10 @@ public boolean canPipesConnect(IPipeNode } @Override - public boolean canPipeConnectToBlock(IPipeNode selfTile, Direction side, @Nullable BlockEntity tile) { + public boolean canPipeConnectToBlock(IPipeNode selfTile, Direction side, + @Nullable BlockEntity tile) { if (tile == null) return false; if (tile.getCapability(GTCapability.CAPABILITY_DATA_ACCESS, side.getOpposite()).isPresent()) return true; return tile.getCapability(GTCapability.CAPABILITY_COMPUTATION_PROVIDER, side.getOpposite()).isPresent(); } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/block/StoneBlockType.java b/src/main/java/com/gregtechceu/gtceu/common/block/StoneBlockType.java index 9c9e8206ab..8fb21b2c63 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/block/StoneBlockType.java +++ b/src/main/java/com/gregtechceu/gtceu/common/block/StoneBlockType.java @@ -3,6 +3,7 @@ import javax.annotation.Nonnull; public enum StoneBlockType { + STONE("stone", "%s"), COBBLE("cobble", "%s_cobblestone", 2.0f, 6.0f), COBBLE_MOSSY("cobble_mossy", "mossy_%s_cobblestone", 2.0f, 6.0f), @@ -33,4 +34,4 @@ public enum StoneBlockType { this.hardness = hardness; this.resistance = resistance; } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/block/StoneTypes.java b/src/main/java/com/gregtechceu/gtceu/common/block/StoneTypes.java index bf5ebc0f30..96706d4a42 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/block/StoneTypes.java +++ b/src/main/java/com/gregtechceu/gtceu/common/block/StoneTypes.java @@ -4,28 +4,36 @@ import com.gregtechceu.gtceu.api.data.tag.TagPrefix; import com.gregtechceu.gtceu.common.data.GTBlocks; import com.gregtechceu.gtceu.common.data.GTMaterials; -import lombok.Getter; + import net.minecraft.util.StringRepresentable; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.MapColor; -import javax.annotation.Nonnull; +import lombok.Getter; + import java.util.function.Supplier; +import javax.annotation.Nonnull; + public enum StoneTypes implements StringRepresentable { STONE("stone", MapColor.STONE, true, () -> Blocks.STONE::defaultBlockState, GTMaterials.Stone, false), - DEEPSLATE("deepslate", MapColor.DEEPSLATE, true, () -> Blocks.DEEPSLATE::defaultBlockState, GTMaterials.Deepslate, false), - RED_GRANITE("red_granite", MapColor.COLOR_RED, true, () -> GTBlocks.RED_GRANITE::getDefaultState, GTMaterials.GraniteRed), + DEEPSLATE("deepslate", MapColor.DEEPSLATE, true, () -> Blocks.DEEPSLATE::defaultBlockState, GTMaterials.Deepslate, + false), + RED_GRANITE("red_granite", MapColor.COLOR_RED, true, () -> GTBlocks.RED_GRANITE::getDefaultState, + GTMaterials.GraniteRed), MARBLE("marble", MapColor.QUARTZ, true, () -> GTBlocks.MARBLE::getDefaultState, GTMaterials.Marble), ANDESITE("andesite", MapColor.STONE, true, () -> Blocks.ANDESITE::defaultBlockState, GTMaterials.Andesite, false), - GRANITE("granite", MapColor.DIRT, true, () -> Blocks.GRANITE::defaultBlockState, GTMaterials.Granite, false) , + GRANITE("granite", MapColor.DIRT, true, () -> Blocks.GRANITE::defaultBlockState, GTMaterials.Granite, false), DIORITE("diorite", MapColor.QUARTZ, true, () -> Blocks.DIORITE::defaultBlockState, GTMaterials.Diorite, false), - BASALT("basalt", MapColor.TERRACOTTA_BLACK, true, () -> Blocks.BASALT::defaultBlockState, GTMaterials.Basalt, false), - CONCRETE_LIGHT("light_concrete", MapColor.STONE, false, () -> GTBlocks.LIGHT_CONCRETE::getDefaultState, GTMaterials.Concrete), - CONCRETE_DARK("dark_concrete", MapColor.STONE, false, () -> GTBlocks.DARK_CONCRETE::getDefaultState, GTMaterials.Concrete), - ; + BASALT("basalt", MapColor.TERRACOTTA_BLACK, true, () -> Blocks.BASALT::defaultBlockState, GTMaterials.Basalt, + false), + CONCRETE_LIGHT("light_concrete", MapColor.STONE, false, () -> GTBlocks.LIGHT_CONCRETE::getDefaultState, + GTMaterials.Concrete), + CONCRETE_DARK("dark_concrete", MapColor.STONE, false, () -> GTBlocks.DARK_CONCRETE::getDefaultState, + GTMaterials.Concrete), + ; private final String name; public final MapColor mapColor; @@ -36,14 +44,15 @@ public enum StoneTypes implements StringRepresentable { @Getter public final Material material; - public final boolean generateBlocks; - StoneTypes(@Nonnull String name, @Nonnull MapColor mapColor, boolean natural, Supplier> state, Material material) { + StoneTypes(@Nonnull String name, @Nonnull MapColor mapColor, boolean natural, Supplier> state, + Material material) { this(name, mapColor, natural, state, material, true); } - StoneTypes(@Nonnull String name, @Nonnull MapColor mapColor, boolean natural, Supplier> state, Material material, boolean generateBlocks) { + StoneTypes(@Nonnull String name, @Nonnull MapColor mapColor, boolean natural, Supplier> state, + Material material, boolean generateBlocks) { this.name = name; this.mapColor = mapColor; this.natural = natural; @@ -60,15 +69,12 @@ public String getSerializedName() { public TagPrefix getTagPrefix() { return switch (this) { - //case RED_GRANITE, MARBLE -> - // TagPrefix.ore; - case CONCRETE_LIGHT, CONCRETE_DARK -> - TagPrefix.block; + // case RED_GRANITE, MARBLE -> + // TagPrefix.ore; + case CONCRETE_LIGHT, CONCRETE_DARK -> TagPrefix.block; default -> TagPrefix.block; }; } - public static void init() { - - } -} \ No newline at end of file + public static void init() {} +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/block/SurfaceRockBlock.java b/src/main/java/com/gregtechceu/gtceu/common/block/SurfaceRockBlock.java index 117dbc6bab..eaac0660ba 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/block/SurfaceRockBlock.java +++ b/src/main/java/com/gregtechceu/gtceu/common/block/SurfaceRockBlock.java @@ -2,8 +2,9 @@ import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.client.renderer.block.SurfaceRockRenderer; + import com.lowdragmc.lowdraglib.Platform; -import lombok.Getter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.client.color.block.BlockColor; import net.minecraft.core.BlockPos; @@ -28,6 +29,8 @@ import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + +import lombok.Getter; import org.jetbrains.annotations.Nullable; import javax.annotation.ParametersAreNonnullByDefault; @@ -35,10 +38,11 @@ @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault public class SurfaceRockBlock extends Block { + public static final DirectionProperty FACING = BlockStateProperties.FACING; private static final VoxelShape AABB_NORTH = Block.box(2, 2, 0, 14, 14, 3); - private static final VoxelShape AABB_SOUTH = Block.box(2, 2,13, 14, 14 ,16); + private static final VoxelShape AABB_SOUTH = Block.box(2, 2, 13, 14, 14, 16); private static final VoxelShape AABB_WEST = Block.box(0, 2, 2, 3, 14, 14); private static final VoxelShape AABB_EAST = Block.box(13, 2, 2, 16, 14, 14); private static final VoxelShape AABB_UP = Block.box(2, 13, 2, 14, 16, 14); @@ -60,7 +64,8 @@ public SurfaceRockBlock(Properties properties, Material material) { @Override @SuppressWarnings("deprecation") - public InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { + public InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, + BlockHitResult hit) { if (level.destroyBlock(pos, true, player)) { return InteractionResult.SUCCESS; } @@ -102,7 +107,8 @@ public boolean canSurvive(BlockState state, LevelReader level, BlockPos pos) { } @Override - public void neighborChanged(BlockState state, Level level, BlockPos pos, Block neighborBlock, BlockPos neighborPos, boolean movedByPiston) { + public void neighborChanged(BlockState state, Level level, BlockPos pos, Block neighborBlock, BlockPos neighborPos, + boolean movedByPiston) { super.neighborChanged(state, level, pos, neighborBlock, neighborPos, movedByPiston); if (!canSurvive(state, level, pos)) { diff --git a/src/main/java/com/gregtechceu/gtceu/common/block/explosive/GTExplosiveBlock.java b/src/main/java/com/gregtechceu/gtceu/common/block/explosive/GTExplosiveBlock.java index ddddaf7f1d..4ffec36867 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/block/explosive/GTExplosiveBlock.java +++ b/src/main/java/com/gregtechceu/gtceu/common/block/explosive/GTExplosiveBlock.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.common.block.explosive; import com.gregtechceu.gtceu.common.entity.GTExplosiveEntity; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.network.chat.Component; @@ -24,12 +25,14 @@ import net.minecraft.world.level.storage.loot.LootParams; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.phys.BlockHitResult; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.List; +import javax.annotation.ParametersAreNonnullByDefault; + @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault @SuppressWarnings("deprecation") @@ -44,14 +47,16 @@ public abstract class GTExplosiveBlock extends Block { * @param explodeOnMine whether mining this block should prime it (sneak mine to drop normally) * @param fuseLength explosion countdown after priming. Vanilla TNT is 80. */ - public GTExplosiveBlock(BlockBehaviour.Properties properties, boolean canRedstoneActivate, boolean explodeOnMine, int fuseLength) { + public GTExplosiveBlock(BlockBehaviour.Properties properties, boolean canRedstoneActivate, boolean explodeOnMine, + int fuseLength) { super(properties.isValidSpawn((state, level, pos, ent) -> false).explosionResistance(1.0f)); this.canRedstoneActivate = canRedstoneActivate; this.explodeOnMine = explodeOnMine; this.fuseLength = fuseLength; } - protected abstract GTExplosiveEntity createEntity(@NotNull Level world, @NotNull BlockPos pos, @NotNull LivingEntity exploder); + protected abstract GTExplosiveEntity createEntity(@NotNull Level world, @NotNull BlockPos pos, + @NotNull LivingEntity exploder); @Override public boolean isCollisionShapeFullBlock(BlockState state, BlockGetter level, BlockPos pos) { @@ -83,7 +88,8 @@ public void wasExploded(Level level, BlockPos pos, Explosion explosion) { } @Override - public InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { + public InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, + BlockHitResult hit) { ItemStack stack = player.getItemInHand(hand); if (!stack.isEmpty() && (stack.getItem() == Items.FLINT_AND_STEEL || stack.getItem() == Items.FIRE_CHARGE)) { this.explode(level, pos, player); @@ -103,7 +109,8 @@ public List getDrops(BlockState state, LootParams.Builder params) { if (explodeOnMine) { Entity entity = params.getOptionalParameter(LootContextParams.THIS_ENTITY); if (entity != null && !entity.isCrouching() && entity instanceof LivingEntity living) { - this.explode(params.getLevel(), BlockPos.containing(params.getParameter(LootContextParams.ORIGIN)), living); + this.explode(params.getLevel(), BlockPos.containing(params.getParameter(LootContextParams.ORIGIN)), + living); return List.of(); } } @@ -133,7 +140,8 @@ public void onPlace(BlockState state, Level level, BlockPos pos, BlockState oldS } @Override - public void neighborChanged(BlockState state, Level level, BlockPos pos, Block neighborBlock, BlockPos neighborPos, boolean movedByPiston) { + public void neighborChanged(BlockState state, Level level, BlockPos pos, Block neighborBlock, BlockPos neighborPos, + boolean movedByPiston) { if (canRedstoneActivate) { if (level.hasNeighborSignal(pos)) { this.explode(level, pos, null); @@ -143,7 +151,8 @@ public void neighborChanged(BlockState state, Level level, BlockPos pos, Block n } @Override - public void appendHoverText(ItemStack stack, @Nullable BlockGetter level, List tooltip, TooltipFlag flag) { + public void appendHoverText(ItemStack stack, @Nullable BlockGetter level, List tooltip, + TooltipFlag flag) { super.appendHoverText(stack, level, tooltip, flag); if (explodeOnMine) { tooltip.add(Component.translatable("block.gtceu.explosive.breaking_tooltip")); @@ -152,4 +161,4 @@ public void appendHoverText(ItemStack stack, @Nullable BlockGetter level, List tooltip, TooltipFlag flag) { + public void appendHoverText(ItemStack stack, @Nullable BlockGetter level, List tooltip, + TooltipFlag flag) { tooltip.add(Component.translatable("block.gtceu.itnt.drops_tooltip")); super.appendHoverText(stack, level, tooltip, flag); } @Override - protected GTExplosiveEntity createEntity(@NotNull Level world, @NotNull BlockPos pos, @NotNull LivingEntity exploder) { + protected GTExplosiveEntity createEntity(@NotNull Level world, @NotNull BlockPos pos, + @NotNull LivingEntity exploder) { float x = pos.getX() + 0.5F, y = pos.getY(), z = pos.getZ() + 0.5F; return new IndustrialTNTEntity(world, x, y, z, exploder); } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/block/explosive/PowderbarrelBlock.java b/src/main/java/com/gregtechceu/gtceu/common/block/explosive/PowderbarrelBlock.java index 24fdc4a436..2bd81d8fac 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/block/explosive/PowderbarrelBlock.java +++ b/src/main/java/com/gregtechceu/gtceu/common/block/explosive/PowderbarrelBlock.java @@ -2,6 +2,7 @@ import com.gregtechceu.gtceu.common.entity.GTExplosiveEntity; import com.gregtechceu.gtceu.common.entity.PowderbarrelEntity; + import net.minecraft.core.BlockPos; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.LivingEntity; @@ -9,24 +10,28 @@ import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.List; public class PowderbarrelBlock extends GTExplosiveBlock { + public PowderbarrelBlock(Properties properties) { super(properties, false, true, 100); } @Override - protected GTExplosiveEntity createEntity(@NotNull Level world, @NotNull BlockPos pos, @NotNull LivingEntity exploder) { + protected GTExplosiveEntity createEntity(@NotNull Level world, @NotNull BlockPos pos, + @NotNull LivingEntity exploder) { float x = pos.getX() + 0.5F, y = pos.getY(), z = pos.getZ() + 0.5F; return new PowderbarrelEntity(world, x, y, z, exploder); } @Override - public void appendHoverText(ItemStack stack, @Nullable BlockGetter level, List tooltip, TooltipFlag flag) { + public void appendHoverText(ItemStack stack, @Nullable BlockGetter level, List tooltip, + TooltipFlag flag) { tooltip.add(Component.translatable("block.gtceu.powderbarrel.drops_tooltip")); super.appendHoverText(stack, level, tooltip, flag); } diff --git a/src/main/java/com/gregtechceu/gtceu/common/blockentity/CableBlockEntity.java b/src/main/java/com/gregtechceu/gtceu/common/blockentity/CableBlockEntity.java index e1297fff32..ca8e848311 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/blockentity/CableBlockEntity.java +++ b/src/main/java/com/gregtechceu/gtceu/common/blockentity/CableBlockEntity.java @@ -16,34 +16,36 @@ import com.gregtechceu.gtceu.common.pipelike.cable.*; import com.gregtechceu.gtceu.utils.FormattingUtil; import com.gregtechceu.gtceu.utils.GTUtil; + import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import lombok.Getter; + import net.minecraft.ChatFormatting; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.network.chat.Component; -import net.minecraft.server.TickTask; import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.util.LazyOptional; + +import lombok.Getter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.EnumMap; import java.util.List; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author KilaBash * @date 2023/3/1 @@ -52,7 +54,9 @@ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class CableBlockEntity extends PipeBlockEntity implements IDataInfoProvider { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(CableBlockEntity.class, PipeBlockEntity.MANAGED_FIELD_HOLDER); + + public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(CableBlockEntity.class, + PipeBlockEntity.MANAGED_FIELD_HOLDER); protected WeakReference currentEnergyNet = new WeakReference<>(null); @@ -65,7 +69,8 @@ public class CableBlockEntity extends PipeBlockEntity cableBlockEntityBlockEntityType) { - } + public static void onBlockEntityRegister(BlockEntityType cableBlockEntityBlockEntityType) {} ////////////////////////////////////// - //******* Interaction *******// + // ******* Interaction *******// ////////////////////////////////////// @Override @@ -344,13 +350,14 @@ public ManagedFieldHolder getFieldHolder() { public @NotNull List getDataInfo(PortableScannerBehavior.DisplayMode mode) { List list = new ArrayList<>(); - if (mode == PortableScannerBehavior.DisplayMode.SHOW_ALL || mode == PortableScannerBehavior.DisplayMode.SHOW_ELECTRICAL_INFO) { + if (mode == PortableScannerBehavior.DisplayMode.SHOW_ALL || + mode == PortableScannerBehavior.DisplayMode.SHOW_ELECTRICAL_INFO) { list.add(Component.translatable("behavior.portable_scanner.eu_per_sec", - Component.translatable(FormattingUtil.formatNumbers(getAverageVoltage())) - .withStyle(ChatFormatting.RED))); + Component.translatable(FormattingUtil.formatNumbers(getAverageVoltage())) + .withStyle(ChatFormatting.RED))); list.add(Component.translatable("behavior.portable_scanner.amp_per_sec", - Component.translatable(FormattingUtil.formatNumbers(getAverageAmperage())) - .withStyle(ChatFormatting.RED))); + Component.translatable(FormattingUtil.formatNumbers(getAverageAmperage())) + .withStyle(ChatFormatting.RED))); } return list; diff --git a/src/main/java/com/gregtechceu/gtceu/common/blockentity/FluidPipeBlockEntity.java b/src/main/java/com/gregtechceu/gtceu/common/blockentity/FluidPipeBlockEntity.java index 3a34fd6fa4..731c00a2df 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/blockentity/FluidPipeBlockEntity.java +++ b/src/main/java/com/gregtechceu/gtceu/common/blockentity/FluidPipeBlockEntity.java @@ -20,12 +20,14 @@ import com.gregtechceu.gtceu.utils.EntityDamageUtil; import com.gregtechceu.gtceu.utils.FormattingUtil; import com.gregtechceu.gtceu.utils.GTUtil; + import com.lowdragmc.lowdraglib.misc.FluidStorage; import com.lowdragmc.lowdraglib.side.fluid.FluidStack; import com.lowdragmc.lowdraglib.side.fluid.FluidTransferHelper; import com.lowdragmc.lowdraglib.side.fluid.IFluidTransfer; import com.lowdragmc.lowdraglib.side.fluid.forge.FluidHelperImpl; import com.lowdragmc.lowdraglib.side.fluid.forge.FluidTransferHelperImpl; + import net.minecraft.ChatFormatting; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -52,6 +54,7 @@ import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.fluids.capability.IFluidHandler; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -59,7 +62,9 @@ import java.util.EnumMap; import java.util.List; -public class FluidPipeBlockEntity extends PipeBlockEntity implements IDataInfoProvider { +public class FluidPipeBlockEntity extends PipeBlockEntity + implements IDataInfoProvider { + public static final int FREQUENCY = 5; public byte lastReceivedFrom = 0, oldLastReceivedFrom = 0; @@ -75,8 +80,7 @@ public FluidPipeBlockEntity(BlockEntityType type, BlockPos pos, BlockState bl super(type, pos, blockState); } - public static void onBlockEntityRegister(BlockEntityType fluidPipeBlockEntityBlockEntityType) { - } + public static void onBlockEntityRegister(BlockEntityType fluidPipeBlockEntityBlockEntityType) {} public long getOffsetTimer() { return timer + offset; @@ -105,7 +109,8 @@ public boolean canAttachTo(Direction side) { if (level.getBlockEntity(getBlockPos().relative(side)) instanceof FluidPipeBlockEntity) { return false; } - return FluidTransferHelper.getFluidTransfer(level, getBlockPos().relative(side), side.getOpposite()) != null; + return FluidTransferHelper.getFluidTransfer(level, getBlockPos().relative(side), side.getOpposite()) != + null; } return false; } @@ -118,7 +123,8 @@ public LazyOptional getCapability(Capability capability, @Nullable Dir PipeTankList tankList = getTankList(facing); if (tankList == null) return LazyOptional.empty(); - return ForgeCapabilities.FLUID_HANDLER.orEmpty(capability, LazyOptional.of(() -> FluidTransferHelperImpl.toFluidHandler(tankList))); + return ForgeCapabilities.FLUID_HANDLER.orEmpty(capability, + LazyOptional.of(() -> FluidTransferHelperImpl.toFluidHandler(tankList))); } } else if (capability == GTCapability.CAPABILITY_COVERABLE) { return GTCapability.CAPABILITY_COVERABLE.orEmpty(capability, LazyOptional.of(this::getCoverContainer)); @@ -181,7 +187,8 @@ private void distributeFluid(int channel, FluidStorage tank, FluidStack fluid) { BlockEntity neighbor = getNeighbor(facing); if (neighbor == null) continue; - IFluidHandler handler = neighbor.getCapability(ForgeCapabilities.FLUID_HANDLER, facing.getOpposite()).resolve().orElse(null); + IFluidHandler handler = neighbor.getCapability(ForgeCapabilities.FLUID_HANDLER, facing.getOpposite()) + .resolve().orElse(null); IFluidTransfer fluidHandler = handler == null ? null : FluidTransferHelperImpl.toFluidTransfer(handler); if (fluidHandler == null) continue; @@ -194,7 +201,8 @@ private void distributeFluid(int channel, FluidStorage tank, FluidStack fluid) { // Shutter covers return null capability when active, so check here to prevent NPE if (pipeTank == null || checkForPumpCover(cover)) continue; } else { - ICoverable coverable = neighbor.getCapability(GTCapability.CAPABILITY_COVERABLE, facing.getOpposite()).resolve().orElse(null); + ICoverable coverable = neighbor.getCapability(GTCapability.CAPABILITY_COVERABLE, facing.getOpposite()) + .resolve().orElse(null); if (coverable != null) { cover = coverable.getCoverAtSide(facing.getOpposite()); if (checkForPumpCover(cover)) continue; @@ -224,7 +232,11 @@ private void distributeFluid(int channel, FluidStorage tank, FluidStack fluid) { // Now distribute for (FluidTransaction transaction : tanks) { if (availableCapacity > maxAmount) { - transaction.amount = Mth.floor(transaction.amount * maxAmount / availableCapacity); // Distribute fluids based on percentage available space at destination + transaction.amount = Mth.floor(transaction.amount * maxAmount / availableCapacity); // Distribute fluids + // based on + // percentage + // available space + // at destination } if (transaction.amount == 0) { if (tank.getFluidAmount() <= 0) break; // If there is no more stored fluid, stop transferring to prevent @@ -263,7 +275,8 @@ public void checkAndDestroy(@NotNull FluidStack stack) { net.minecraftforge.fluids.FluidStack forgeStack = FluidHelperImpl.toFluidStack(stack); boolean burning = prop.getMaxFluidTemperature() < fluid.getFluidType().getTemperature(forgeStack); boolean leaking = !prop.isGasProof() && fluid.getFluidType().getDensity(forgeStack) < 0; - boolean shattering = !prop.isCryoProof() && fluid.getFluidType().getTemperature() < FluidConstants.CRYOGENIC_FLUID_THRESHOLD; + boolean shattering = !prop.isCryoProof() && + fluid.getFluidType().getTemperature() < FluidConstants.CRYOGENIC_FLUID_THRESHOLD; boolean corroding = false; boolean melting = false; @@ -301,7 +314,7 @@ public void destroyPipe(FluidStack stack, boolean isBurning, boolean isLeaking, if (isLeaking) { FluidPipeBlockEntity.spawnParticles(level, worldPosition, Direction.UP, ParticleTypes.SMOKE, - 7 + GTValues.RNG.nextInt(2)); + 7 + GTValues.RNG.nextInt(2)); // voids 10% stack.setAmount(Math.max(0, stack.getAmount() * 9 / 10)); @@ -309,10 +322,11 @@ public void destroyPipe(FluidStack stack, boolean isBurning, boolean isLeaking, // apply heat damage in area surrounding the pipe if (getOffsetTimer() % 20 == 0) { List entities = getPipeLevel().getEntitiesOfClass(LivingEntity.class, - new AABB(getPipePos()).inflate(2)); + new AABB(getPipePos()).inflate(2)); for (LivingEntity entityLivingBase : entities) { - EntityDamageUtil.applyTemperatureDamage(entityLivingBase, stack.getFluid().getFluidType().getTemperature(FluidHelperImpl.toFluidStack(stack)), - 2.0F, 10); + EntityDamageUtil.applyTemperatureDamage(entityLivingBase, + stack.getFluid().getFluidType().getTemperature(FluidHelperImpl.toFluidStack(stack)), + 2.0F, 10); } } @@ -324,7 +338,7 @@ public void destroyPipe(FluidStack stack, boolean isBurning, boolean isLeaking, if (isCorroding) { FluidPipeBlockEntity.spawnParticles(getPipeLevel(), getPipePos(), Direction.UP, ParticleTypes.CRIT, - 3 + GTValues.RNG.nextInt(2)); + 3 + GTValues.RNG.nextInt(2)); // voids 25% stack.setAmount(Math.max(0, stack.getAmount() * 3 / 4)); @@ -332,7 +346,7 @@ public void destroyPipe(FluidStack stack, boolean isBurning, boolean isLeaking, // apply chemical damage in area surrounding the pipe if (getOffsetTimer() % 20 == 0) { List entities = getPipeLevel().getEntitiesOfClass(LivingEntity.class, - new AABB(getPipePos()).inflate(1)); + new AABB(getPipePos()).inflate(1)); for (LivingEntity entityLivingBase : entities) { EntityDamageUtil.applyChemicalDamage(entityLivingBase, 2); } @@ -347,7 +361,7 @@ public void destroyPipe(FluidStack stack, boolean isBurning, boolean isLeaking, if (isBurning || isMelting) { FluidPipeBlockEntity.spawnParticles(level, getBlockPos(), Direction.UP, ParticleTypes.FLAME, - (isMelting ? 7 : 3) + GTValues.RNG.nextInt(2)); + (isMelting ? 7 : 3) + GTValues.RNG.nextInt(2)); // voids 75% stack.setAmount(Math.max(0, stack.getAmount() / 4)); @@ -360,10 +374,11 @@ public void destroyPipe(FluidStack stack, boolean isBurning, boolean isLeaking, // apply heat damage in area surrounding the pipe if (isMelting && getOffsetTimer() % 20 == 0) { List entities = getPipeLevel().getEntitiesOfClass(LivingEntity.class, - new AABB(getPipePos()).inflate(2)); + new AABB(getPipePos()).inflate(2)); for (LivingEntity entityLivingBase : entities) { - EntityDamageUtil.applyTemperatureDamage(entityLivingBase, stack.getFluid().getFluidType().getTemperature(FluidHelperImpl.toFluidStack(stack)), - 2.0F, 10); + EntityDamageUtil.applyTemperatureDamage(entityLivingBase, + stack.getFluid().getFluidType().getTemperature(FluidHelperImpl.toFluidStack(stack)), + 2.0F, 10); } } @@ -376,7 +391,7 @@ public void destroyPipe(FluidStack stack, boolean isBurning, boolean isLeaking, if (isShattering) { FluidPipeBlockEntity.spawnParticles(level, getBlockPos(), Direction.UP, ParticleTypes.CLOUD, - 3 + GTValues.RNG.nextInt(2)); + 3 + GTValues.RNG.nextInt(2)); // voids 75% stack.setAmount(Math.max(0, stack.getAmount() / 4)); @@ -384,10 +399,11 @@ public void destroyPipe(FluidStack stack, boolean isBurning, boolean isLeaking, // apply frost damage in area surrounding the pipe if (getOffsetTimer() % 20 == 0) { List entities = getPipeLevel().getEntitiesOfClass(LivingEntity.class, - new AABB(getPipePos()).inflate(2)); + new AABB(getPipePos()).inflate(2)); for (LivingEntity entityLivingBase : entities) { - EntityDamageUtil.applyTemperatureDamage(entityLivingBase, stack.getFluid().getFluidType().getTemperature(FluidHelperImpl.toFluidStack(stack)), - 2.0F, 10); + EntityDamageUtil.applyTemperatureDamage(entityLivingBase, + stack.getFluid().getFluidType().getTemperature(FluidHelperImpl.toFluidStack(stack)), + 2.0F, 10); } } @@ -483,14 +499,14 @@ public static void spawnParticles(Level worldIn, BlockPos pos, Direction directi int particleCount) { if (worldIn instanceof ServerLevel serverLevel) { serverLevel.sendParticles(particleType, - pos.getX() + 0.5, - pos.getY() + 0.5, - pos.getZ() + 0.5, - particleCount, - direction.getStepX() * 0.2 + GTValues.RNG.nextDouble() * 0.1, - direction.getStepY() * 0.2 + GTValues.RNG.nextDouble() * 0.1, - direction.getStepZ() * 0.2 + GTValues.RNG.nextDouble() * 0.1, - 0.1); + pos.getX() + 0.5, + pos.getY() + 0.5, + pos.getZ() + 0.5, + particleCount, + direction.getStepX() * 0.2 + GTValues.RNG.nextDouble() * 0.1, + direction.getStepY() * 0.2 + GTValues.RNG.nextDouble() * 0.1, + direction.getStepZ() * 0.2 + GTValues.RNG.nextDouble() * 0.1, + 0.1); } } @@ -500,7 +516,7 @@ public static void setNeighboursToFire(Level world, BlockPos selfPos) { BlockPos blockPos = selfPos.relative(side); BlockState blockState = world.getBlockState(blockPos); if (world.isEmptyBlock(blockPos) || - blockState.isFlammable(world, blockPos, side.getOpposite())) { + blockState.isFlammable(world, blockPos, side.getOpposite())) { world.setBlockAndUpdate(blockPos, Blocks.FIRE.defaultBlockState()); } } @@ -510,7 +526,8 @@ public static void setNeighboursToFire(Level world, BlockPos selfPos) { public @NotNull List getDataInfo(PortableScannerBehavior.DisplayMode mode) { List list = new ArrayList<>(); - if (mode == PortableScannerBehavior.DisplayMode.SHOW_ALL || mode == PortableScannerBehavior.DisplayMode.SHOW_MACHINE_INFO) { + if (mode == PortableScannerBehavior.DisplayMode.SHOW_ALL || + mode == PortableScannerBehavior.DisplayMode.SHOW_MACHINE_INFO) { FluidStack[] fluids = getContainedFluids(); if (fluids != null) { boolean allTanksEmpty = true; @@ -522,12 +539,12 @@ public static void setNeighboursToFire(Level world, BlockPos selfPos) { allTanksEmpty = false; list.add(Component.translatable("behavior.portable_scanner.tank", i, - Component.translatable(FormattingUtil.formatNumbers(fluids[i].getAmount())) - .withStyle(ChatFormatting.GREEN), - Component.translatable(FormattingUtil.formatNumbers(getCapacityPerTank())) - .withStyle(ChatFormatting.YELLOW), - fluids[i].getDisplayName().copy() - .withStyle(ChatFormatting.GOLD))); + Component.translatable(FormattingUtil.formatNumbers(fluids[i].getAmount())) + .withStyle(ChatFormatting.GREEN), + Component.translatable(FormattingUtil.formatNumbers(getCapacityPerTank())) + .withStyle(ChatFormatting.YELLOW), + fluids[i].getDisplayName().copy() + .withStyle(ChatFormatting.GOLD))); } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/blockentity/GTHangingSignBlockEntity.java b/src/main/java/com/gregtechceu/gtceu/common/blockentity/GTHangingSignBlockEntity.java index 8d0417c8ce..b30c774f31 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/blockentity/GTHangingSignBlockEntity.java +++ b/src/main/java/com/gregtechceu/gtceu/common/blockentity/GTHangingSignBlockEntity.java @@ -6,10 +6,12 @@ import net.minecraft.world.level.block.state.BlockState; public class GTHangingSignBlockEntity extends SignBlockEntity { + private static final int MAX_TEXT_LINE_WIDTH = 60; private static final int TEXT_LINE_HEIGHT = 9; - public GTHangingSignBlockEntity(BlockEntityType type, BlockPos pos, BlockState blockState) { + public GTHangingSignBlockEntity(BlockEntityType type, BlockPos pos, + BlockState blockState) { super(type, pos, blockState); } diff --git a/src/main/java/com/gregtechceu/gtceu/common/blockentity/ItemPipeBlockEntity.java b/src/main/java/com/gregtechceu/gtceu/common/blockentity/ItemPipeBlockEntity.java index 6f201539cf..31da1ba8dc 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/blockentity/ItemPipeBlockEntity.java +++ b/src/main/java/com/gregtechceu/gtceu/common/blockentity/ItemPipeBlockEntity.java @@ -10,13 +10,12 @@ import com.gregtechceu.gtceu.common.pipelike.item.ItemPipeType; import com.gregtechceu.gtceu.utils.FacingPos; import com.gregtechceu.gtceu.utils.GTUtil; + import com.lowdragmc.lowdraglib.misc.ItemStackTransfer; import com.lowdragmc.lowdraglib.side.item.IItemTransfer; import com.lowdragmc.lowdraglib.side.item.ItemTransferHelper; import com.lowdragmc.lowdraglib.side.item.forge.ItemTransferHelperImpl; -import it.unimi.dsi.fastutil.objects.Object2IntMap; -import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; -import lombok.Getter; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.server.level.ServerLevel; @@ -26,6 +25,10 @@ import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.common.util.LazyOptional; + +import it.unimi.dsi.fastutil.objects.Object2IntMap; +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; +import lombok.Getter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -33,8 +36,8 @@ import java.util.EnumMap; public class ItemPipeBlockEntity extends PipeBlockEntity { - protected WeakReference currentItemPipeNet = new WeakReference<>(null); + protected WeakReference currentItemPipeNet = new WeakReference<>(null); @Getter private final EnumMap handlers = new EnumMap<>(Direction.class); @@ -48,7 +51,6 @@ public class ItemPipeBlockEntity extends PipeBlockEntity type, BlockPos pos, BlockState blockState) { super(type, pos, blockState); } @@ -57,13 +59,11 @@ public static ItemPipeBlockEntity create(BlockEntityType type, BlockPos pos, return new ItemPipeBlockEntity(type, pos, blockState); } - public long getLevelTime() { return hasLevel() ? getLevel().getGameTime() : 0L; } - public static void onBlockEntityRegister(BlockEntityType itemPipeBlockEntityBlockEntityType) { - } + public static void onBlockEntityRegister(BlockEntityType itemPipeBlockEntityBlockEntityType) {} @Override public @NotNull LazyOptional getCapability(@NotNull Capability cap, @Nullable Direction side) { @@ -75,7 +75,8 @@ public static void onBlockEntityRegister(BlockEntityType it if (side != null && isConnected(side)) { ensureHandlersInitialized(); checkNetwork(); - return ForgeCapabilities.ITEM_HANDLER.orEmpty(cap, LazyOptional.of(() -> ItemTransferHelperImpl.toItemHandler(getHandler(side, true)))); + return ForgeCapabilities.ITEM_HANDLER.orEmpty(cap, + LazyOptional.of(() -> ItemTransferHelperImpl.toItemHandler(getHandler(side, true)))); } } else if (cap == GTCapability.CAPABILITY_COVERABLE) { return GTCapability.CAPABILITY_COVERABLE.orEmpty(cap, LazyOptional.of(this::getCoverContainer)); @@ -124,10 +125,12 @@ public boolean canAttachTo(Direction side) { @Nullable public ItemPipeNet getItemPipeNet() { - if (level instanceof ServerLevel serverLevel && getBlockState().getBlock() instanceof ItemPipeBlock itemPipeBlock) { + if (level instanceof ServerLevel serverLevel && + getBlockState().getBlock() instanceof ItemPipeBlock itemPipeBlock) { ItemPipeNet currentItemPipeNet = this.currentItemPipeNet.get(); - if (currentItemPipeNet != null && currentItemPipeNet.isValid() && currentItemPipeNet.containsNode(getBlockPos())) - return currentItemPipeNet; //return current net if it is still valid + if (currentItemPipeNet != null && currentItemPipeNet.isValid() && + currentItemPipeNet.containsNode(getBlockPos())) + return currentItemPipeNet; // return current net if it is still valid currentItemPipeNet = itemPipeBlock.getWorldPipeNet(serverLevel).getNetFromPos(getBlockPos()); if (currentItemPipeNet != null) { this.currentItemPipeNet = new WeakReference<>(currentItemPipeNet); @@ -144,13 +147,14 @@ public void resetTransferred() { * every time the transferred variable is accessed this method should be called * if 20 ticks passed since the last access it will reset it * this method is equal to + * * @code { - * if (++time % 20 == 0) { - * this.transferredItems = 0; - * } - * } - *

- * if it was in a ticking TileEntity + * if (++time % 20 == 0) { + * this.transferredItems = 0; + * } + * } + *

+ * if it was in a ticking TileEntity */ private void updateTransferredState() { long currentTime = getLevelTime(); diff --git a/src/main/java/com/gregtechceu/gtceu/common/blockentity/KineticMachineBlockEntity.java b/src/main/java/com/gregtechceu/gtceu/common/blockentity/KineticMachineBlockEntity.java index 3c77e7fa0c..2c0fc996e3 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/blockentity/KineticMachineBlockEntity.java +++ b/src/main/java/com/gregtechceu/gtceu/common/blockentity/KineticMachineBlockEntity.java @@ -7,20 +7,11 @@ import com.gregtechceu.gtceu.api.machine.MetaMachine; import com.gregtechceu.gtceu.common.machine.KineticMachineDefinition; import com.gregtechceu.gtceu.common.registry.GTRegistration; -import com.jozufozu.flywheel.api.MaterialManager; -import com.jozufozu.flywheel.backend.instancing.InstancedRenderRegistry; -import com.jozufozu.flywheel.backend.instancing.blockentity.BlockEntityInstance; + import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; import com.lowdragmc.lowdraglib.syncdata.managed.MultiManagedStorage; -import com.simibubi.create.content.kinetics.KineticNetwork; -import com.simibubi.create.content.kinetics.base.IRotate; -import com.simibubi.create.content.kinetics.base.KineticBlockEntity; -import com.simibubi.create.content.kinetics.base.KineticEffectHandler; -import com.simibubi.create.foundation.utility.Lang; -import com.tterrag.registrate.util.OneTimeEventReceiver; -import com.tterrag.registrate.util.nullness.NonNullSupplier; -import lombok.Getter; + import net.minecraft.ChatFormatting; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -36,6 +27,18 @@ import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; + +import com.jozufozu.flywheel.api.MaterialManager; +import com.jozufozu.flywheel.backend.instancing.InstancedRenderRegistry; +import com.jozufozu.flywheel.backend.instancing.blockentity.BlockEntityInstance; +import com.simibubi.create.content.kinetics.KineticNetwork; +import com.simibubi.create.content.kinetics.base.IRotate; +import com.simibubi.create.content.kinetics.base.KineticBlockEntity; +import com.simibubi.create.content.kinetics.base.KineticEffectHandler; +import com.simibubi.create.foundation.utility.Lang; +import com.tterrag.registrate.util.OneTimeEventReceiver; +import com.tterrag.registrate.util.nullness.NonNullSupplier; +import lombok.Getter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -49,6 +52,7 @@ * @implNote CreateKineticSourceBlockEntity */ public class KineticMachineBlockEntity extends KineticBlockEntity implements IMachineBlockEntity { + public final MultiManagedStorage managedStorage = new MultiManagedStorage(); @Getter public final MetaMachine metaMachine; @@ -71,14 +75,17 @@ public static KineticMachineBlockEntity create(BlockEntityType typeIn, BlockP return result == null ? super.getCapability(cap, side) : result; } - public static void onBlockEntityRegister(BlockEntityType blockEntityType, NonNullSupplier>> instanceFactory, boolean renderNormally) { + public static void onBlockEntityRegister(BlockEntityType blockEntityType, + NonNullSupplier>> instanceFactory, + boolean renderNormally) { if (instanceFactory != null && LDLib.isClient()) { - DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> - OneTimeEventReceiver.addModListener(GTRegistration.REGISTRATE, FMLClientSetupEvent.class, - ($) -> InstancedRenderRegistry.configure(blockEntityType) - .factory(instanceFactory.get()) - .skipRender((be) -> !renderNormally) - .apply())); + DistExecutor.unsafeRunWhenOn(Dist.CLIENT, + () -> () -> OneTimeEventReceiver.addModListener(GTRegistration.REGISTRATE, + FMLClientSetupEvent.class, + ($) -> InstancedRenderRegistry.configure(blockEntityType) + .factory(instanceFactory.get()) + .skipRender((be) -> !renderNormally) + .apply())); } } @@ -103,7 +110,6 @@ public boolean triggerEvent(int id, int para) { return false; } - @Override public long getOffset() { return offset; @@ -137,7 +143,7 @@ public ResourceTexture sideTips(Player player, Set toolTypes, Direct } ////////////////////////////////////// - //********* Create *********// + // ********* Create *********// ////////////////////////////////////// public KineticEffectHandler getEffects() { @@ -200,7 +206,6 @@ public void tick() { this.updateGeneratedRotation(); this.reActivateSource = false; } - } public boolean addToGoggleTooltip(List tooltip, boolean isPlayerSneaking) { @@ -216,7 +221,9 @@ public boolean addToGoggleTooltip(List tooltip, boolean isPlayerSneak speed = Math.abs(speed); float stressTotal = stressBase * speed; - Lang.number(stressTotal).translate("generic.unit.stress").style(ChatFormatting.AQUA).space().add(Lang.translate("gui.goggles.at_current_speed").style(ChatFormatting.DARK_GRAY)).forGoggles(tooltip, 1); + Lang.number(stressTotal).translate("generic.unit.stress").style(ChatFormatting.AQUA).space() + .add(Lang.translate("gui.goggles.at_current_speed").style(ChatFormatting.DARK_GRAY)) + .forGoggles(tooltip, 1); added = true; } @@ -300,5 +307,4 @@ protected void read(CompoundTag compound, boolean clientPacket) { super.read(compound, clientPacket); workingSpeed = compound.contains("workingSpeed") ? compound.getFloat("workingSpeed") : 0; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/blockentity/LaserPipeBlockEntity.java b/src/main/java/com/gregtechceu/gtceu/common/blockentity/LaserPipeBlockEntity.java index 1fff891834..0d35e2cd4b 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/blockentity/LaserPipeBlockEntity.java +++ b/src/main/java/com/gregtechceu/gtceu/common/blockentity/LaserPipeBlockEntity.java @@ -9,10 +9,11 @@ import com.gregtechceu.gtceu.common.pipelike.laser.*; import com.gregtechceu.gtceu.utils.GTUtil; import com.gregtechceu.gtceu.utils.TaskHandler; + import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import lombok.Getter; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.server.level.ServerLevel; @@ -21,6 +22,8 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.util.LazyOptional; + +import lombok.Getter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -28,7 +31,9 @@ import java.util.EnumMap; public class LaserPipeBlockEntity extends PipeBlockEntity { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(LaserPipeBlockEntity.class, PipeBlockEntity.MANAGED_FIELD_HOLDER); + + public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(LaserPipeBlockEntity.class, + PipeBlockEntity.MANAGED_FIELD_HOLDER); @Getter protected final EnumMap handlers = new EnumMap<>(Direction.class); @@ -41,7 +46,8 @@ public class LaserPipeBlockEntity extends PipeBlockEntity type, BlockPos pos, BlockState blockState) { @@ -52,8 +58,7 @@ public static LaserPipeBlockEntity create(BlockEntityType type, BlockPos pos, return new LaserPipeBlockEntity(type, pos, blockState); } - public static void onBlockEntityRegister(BlockEntityType cableBlockEntityBlockEntityType) { - } + public static void onBlockEntityRegister(BlockEntityType cableBlockEntityBlockEntityType) {} @Override public @NotNull LazyOptional getCapability(@NotNull Capability cap, @Nullable Direction side) { @@ -65,7 +70,8 @@ public static void onBlockEntityRegister(BlockEntityType c initHandlers(); } checkNetwork(); - return GTCapability.CAPABILITY_LASER.orEmpty(cap, LazyOptional.of(() -> handlers.getOrDefault(side, defaultHandler))); + return GTCapability.CAPABILITY_LASER.orEmpty(cap, + LazyOptional.of(() -> handlers.getOrDefault(side, defaultHandler))); } else if (cap == GTCapability.CAPABILITY_COVERABLE) { return GTCapability.CAPABILITY_COVERABLE.orEmpty(cap, LazyOptional.of(this::getCoverContainer)); } else if (cap == GTCapability.CAPABILITY_TOOLABLE) { @@ -168,7 +174,7 @@ public void setConnection(Direction side, boolean connected, boolean fromNeighbo // check the same for the targeted pipe BlockEntity tile = getLevel().getBlockEntity(getBlockPos().relative(side)); if (tile instanceof IPipeNode pipeTile && - pipeTile.getPipeType().getClass() == this.getPipeType().getClass()) { + pipeTile.getPipeType().getClass() == this.getPipeType().getClass()) { connections = pipeTile.getConnections(); connections &= ~(1 << side.ordinal()); connections &= ~(1 << side.getOpposite().ordinal()); diff --git a/src/main/java/com/gregtechceu/gtceu/common/blockentity/OpticalPipeBlockEntity.java b/src/main/java/com/gregtechceu/gtceu/common/blockentity/OpticalPipeBlockEntity.java index 244f265f39..cbb77bc2df 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/blockentity/OpticalPipeBlockEntity.java +++ b/src/main/java/com/gregtechceu/gtceu/common/blockentity/OpticalPipeBlockEntity.java @@ -10,11 +10,12 @@ import com.gregtechceu.gtceu.common.pipelike.optical.*; import com.gregtechceu.gtceu.utils.GTUtil; import com.gregtechceu.gtceu.utils.TaskHandler; + 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 lombok.Getter; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.server.level.ServerLevel; @@ -23,6 +24,8 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.util.LazyOptional; + +import lombok.Getter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -31,7 +34,9 @@ import java.util.EnumMap; public class OpticalPipeBlockEntity extends PipeBlockEntity { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(OpticalPipeBlockEntity.class, PipeBlockEntity.MANAGED_FIELD_HOLDER); + + public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(OpticalPipeBlockEntity.class, + PipeBlockEntity.MANAGED_FIELD_HOLDER); private final EnumMap handlers = new EnumMap<>(Direction.class); // the OpticalNetHandler can only be created on the server, so we have an empty placeholder for the client @@ -41,7 +46,9 @@ public class OpticalPipeBlockEntity extends PipeBlockEntity type, BlockPos pos, BlockState blockState) { @@ -66,24 +73,28 @@ private void initHandlers() { public LazyOptional getCapability(Capability capability, @Nullable Direction facing) { if (capability == GTCapability.CAPABILITY_DATA_ACCESS) { if (level.isClientSide) { - return GTCapability.CAPABILITY_DATA_ACCESS.orEmpty(capability, LazyOptional.of(() -> clientDataHandler)); + return GTCapability.CAPABILITY_DATA_ACCESS.orEmpty(capability, + LazyOptional.of(() -> clientDataHandler)); } if (handlers.isEmpty()) initHandlers(); checkNetwork(); - return GTCapability.CAPABILITY_DATA_ACCESS.orEmpty(capability, LazyOptional.of(() -> handlers.getOrDefault(facing, defaultHandler))); + return GTCapability.CAPABILITY_DATA_ACCESS.orEmpty(capability, + LazyOptional.of(() -> handlers.getOrDefault(facing, defaultHandler))); } if (capability == GTCapability.CAPABILITY_COMPUTATION_PROVIDER) { if (level.isClientSide) { - return GTCapability.CAPABILITY_COMPUTATION_PROVIDER.orEmpty(capability, LazyOptional.of(() -> clientComputationHandler)); + return GTCapability.CAPABILITY_COMPUTATION_PROVIDER.orEmpty(capability, + LazyOptional.of(() -> clientComputationHandler)); } if (handlers.isEmpty()) initHandlers(); checkNetwork(); - return GTCapability.CAPABILITY_COMPUTATION_PROVIDER.orEmpty(capability, LazyOptional.of(() -> handlers.getOrDefault(facing, defaultHandler))); + return GTCapability.CAPABILITY_COMPUTATION_PROVIDER.orEmpty(capability, + LazyOptional.of(() -> handlers.getOrDefault(facing, defaultHandler))); } return super.getCapability(capability, facing); } @@ -106,7 +117,8 @@ public OpticalPipeNet getOpticalPipeNet() { OpticalPipeNet currentPipeNet = this.currentPipeNet.get(); if (currentPipeNet != null && currentPipeNet.isValid() && currentPipeNet.containsNode(getPipePos())) return currentPipeNet; // if current net is valid and does contain position, return it - LevelOpticalPipeNet worldNet = (LevelOpticalPipeNet) getPipeBlock().getWorldPipeNet((ServerLevel) getPipeLevel()); + LevelOpticalPipeNet worldNet = (LevelOpticalPipeNet) getPipeBlock() + .getWorldPipeNet((ServerLevel) getPipeLevel()); currentPipeNet = worldNet.getNetFromPos(getPipePos()); if (currentPipeNet != null) { this.currentPipeNet = new WeakReference<>(currentPipeNet); @@ -204,4 +216,4 @@ public boolean canBridge(@NotNull Collection seen) return false; } } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/capability/HazardEffectTracker.java b/src/main/java/com/gregtechceu/gtceu/common/capability/HazardEffectTracker.java new file mode 100644 index 0000000000..248434454e --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/common/capability/HazardEffectTracker.java @@ -0,0 +1,168 @@ +package com.gregtechceu.gtceu.common.capability; + +import com.gregtechceu.gtceu.api.GTCEuAPI; +import com.gregtechceu.gtceu.api.capability.IHazardEffectTracker; +import com.gregtechceu.gtceu.api.data.chemical.material.Material; +import com.gregtechceu.gtceu.api.data.chemical.material.properties.HazardProperty; +import com.gregtechceu.gtceu.api.data.chemical.material.properties.PropertyKey; + +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.ListTag; +import net.minecraft.nbt.StringTag; +import net.minecraft.nbt.Tag; +import net.minecraft.world.effect.MobEffectInstance; +import net.minecraft.world.entity.ai.attributes.AttributeInstance; +import net.minecraft.world.entity.ai.attributes.AttributeModifier; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ArmorItem; +import net.minecraftforge.common.util.INBTSerializable; + +import it.unimi.dsi.fastutil.objects.Object2IntMap; +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; +import lombok.Getter; +import lombok.Setter; +import org.jetbrains.annotations.NotNull; + +import java.util.HashSet; +import java.util.Set; + +public class HazardEffectTracker implements IHazardEffectTracker, INBTSerializable { + + @Getter + @Setter + private int maxAirSupply = -1; + @Getter + private final Set extraHazards = new HashSet<>(); + @Getter + private final Object2IntMap currentHazards = new Object2IntOpenHashMap<>(); + + private final Player player; + + private int totalMaxAirSupply, maxAirSupplySetterAmount; + + public HazardEffectTracker(Player player) { + this.player = player; + } + + @Override + public void startTick() { + for (Material material : this.getExtraHazards()) { + tick(material); + } + } + + @Override + public void tick(@NotNull Material material) { + HazardProperty property = material.getProperty(PropertyKey.HAZARD); + if (property == null) { + return; + } + int time = currentHazards.getOrDefault(material, 0); + + if (property.getHazardType().protectionType().isProtected(player)) { + // entity has proper safety equipment, so damage it per material every 5 seconds. + if (player.level().getGameTime() % 100 == 0) { + for (ArmorItem.Type type : property.getHazardType().protectionType().getEquipmentTypes()) { + player.getItemBySlot(type.getSlot()).hurtAndBreak(1, player, + p -> p.broadcastBreakEvent(type.getSlot())); + } + } + // exit the hazard applying after. + return; + } + + int totalTime = 0; + int effectsCount = 0; + for (HazardProperty.HazardEffect effect : property.getEffects()) { + totalTime += effect.duration() + effect.modifierStartTime(); + effectsCount++; + if (time < effect.modifierStartTime()) { + // if the current applied time is less than the minimum for effects to be applied, return early. + continue; + } + + for (MobEffectInstance mobEffect : effect.getEffectInstancesAtTime(time)) { + player.addEffect(mobEffect); + } + var attributeModifiers = effect.getModifiersAtTime(time); + for (var modifierEntry : attributeModifiers.entrySet()) { + AttributeModifier modifier = modifierEntry.getValue(); + AttributeInstance attributeInstance = player.getAttribute(modifierEntry.getKey()); + if (attributeInstance == null) { + continue; + } + + if (attributeInstance.hasModifier(modifier)) { + attributeInstance.removeModifier(modifier); + } + attributeInstance.addPermanentModifier(modifier); + } + int maxAirSupply = effect.getNewMaxAirSupplyAtTime(time); + if (maxAirSupply >= 0) { + totalMaxAirSupply += maxAirSupply; + maxAirSupplySetterAmount++; + } + } + + currentHazards.put(material, time += 1); + // if the hazardous material has been held for 5x the average of the effects' start times, make it permanent. + // this also makes it tick 1 more time per tick, thus speeding up the effects. + if (time >= 5 * (totalTime / effectsCount)) { + extraHazards.add(material); + } + } + + @Override + public void endTick() { + if (maxAirSupplySetterAmount > 0) { + this.setMaxAirSupply(totalMaxAirSupply / maxAirSupplySetterAmount); + } + totalMaxAirSupply = 0; + maxAirSupplySetterAmount = 0; + } + + @Override + public CompoundTag serializeNBT() { + CompoundTag tag = new CompoundTag(); + + ListTag effectsTag = new ListTag(); + for (var effect : currentHazards.object2IntEntrySet()) { + if (effect.getKey() == null) { + continue; + } + CompoundTag effectTag = new CompoundTag(); + effectTag.putString("material", effect.getKey().getResourceLocation().toString()); + effectTag.putInt("time", effect.getIntValue()); + effectsTag.add(effectTag); + } + tag.put("effects", effectsTag); + + ListTag extrasTag = new ListTag(); + for (Material material : extraHazards) { + extrasTag.add(StringTag.valueOf(material.getResourceLocation().toString())); + } + tag.put("extras", extrasTag); + + return tag; + } + + @Override + public void deserializeNBT(CompoundTag arg) { + ListTag effects = arg.getList("effects", Tag.TAG_COMPOUND); + for (Tag tag : effects) { + if (!(tag instanceof CompoundTag compoundTag)) { + continue; + } + Material material = GTCEuAPI.materialManager.getMaterial(compoundTag.getString("material")); + int time = compoundTag.getInt("time"); + currentHazards.put(material, time); + } + ListTag extras = arg.getList("extras", Tag.TAG_STRING); + for (Tag tag : extras) { + if (!(tag instanceof StringTag stringTag)) { + continue; + } + extraHazards.add(GTCEuAPI.materialManager.getMaterial(stringTag.getAsString())); + } + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/commands/ServerCommands.java b/src/main/java/com/gregtechceu/gtceu/common/commands/ServerCommands.java new file mode 100644 index 0000000000..2c4aaa17bb --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/common/commands/ServerCommands.java @@ -0,0 +1,124 @@ +package com.gregtechceu.gtceu.common.commands; + +import com.gregtechceu.gtceu.api.capability.GTCapabilityHelper; +import com.gregtechceu.gtceu.api.capability.IHazardEffectTracker; +import com.gregtechceu.gtceu.api.data.chemical.material.Material; +import com.gregtechceu.gtceu.api.data.chemical.material.properties.HazardProperty; +import com.gregtechceu.gtceu.api.data.chemical.material.properties.PropertyKey; +import com.gregtechceu.gtceu.api.gui.factory.GTUIEditorFactory; +import com.gregtechceu.gtceu.api.recipe.GTRecipe; +import com.gregtechceu.gtceu.common.commands.arguments.MaterialArgument; + +import net.minecraft.commands.CommandSourceStack; +import net.minecraft.commands.Commands; +import net.minecraft.commands.arguments.EntityArgument; +import net.minecraft.network.chat.Component; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.item.crafting.Recipe; + +import com.mojang.brigadier.builder.LiteralArgumentBuilder; +import com.mojang.brigadier.exceptions.SimpleCommandExceptionType; + +import java.util.Collection; +import java.util.List; + +/** + * @author KilaBash + * @date 2023/2/9 + * @implNote ServerCommands + */ +public class ServerCommands { + + private static final SimpleCommandExceptionType ERROR_CLEAR_EVERYTHING_FAILED = new SimpleCommandExceptionType( + Component.translatable("commands.effect.clear.everything.failed")); + private static final SimpleCommandExceptionType ERROR_INVALID_MATERIAL = new SimpleCommandExceptionType( + Component.translatable("commands.gtceu.hazard.invalid.material")); + private static final SimpleCommandExceptionType ERROR_GIVE_FAILED = new SimpleCommandExceptionType( + Component.translatable("commands.effect.give.failed")); + + public static List> createServerCommands() { + return List.of( + Commands.literal("gtceu") + .then(Commands.literal("ui_editor") + .executes(context -> { + GTUIEditorFactory.INSTANCE.openUI(GTUIEditorFactory.INSTANCE, + context.getSource().getPlayerOrException()); + return 1; + })) + .then(Commands.literal("check_recipes_valid") + .requires(cs -> cs.hasPermission(0)) + .executes(context -> { + for (Recipe recipe : context.getSource().getServer().getRecipeManager() + .getRecipes()) { + if (recipe instanceof GTRecipe gtRecipe && !gtRecipe.checkRecipeValid()) { + context.getSource().sendSuccess( + () -> Component + .literal("recipe %s is invalid".formatted(gtRecipe.id)), + false); + } + } + return 1; + })) + .then(Commands.literal("hazard") + .requires(source -> source.hasPermission(2)) + .then(Commands.literal("clear") + .executes(context -> { + ServerPlayer target = context.getSource().getPlayerOrException(); + IHazardEffectTracker tracker = GTCapabilityHelper + .getHazardEffectTracker(target); + if (tracker == null) { + throw EntityArgument.NO_PLAYERS_FOUND.create(); + } + int count = tracker.getCurrentHazards().keySet().size(); + tracker.getCurrentHazards().clear(); + return count; + }) + .then(Commands.argument("targets", EntityArgument.players()) + .executes(context -> { + Collection targets = EntityArgument + .getPlayers(context, "targets"); + int count = 0; + for (ServerPlayer target : targets) { + IHazardEffectTracker tracker = GTCapabilityHelper + .getHazardEffectTracker(target); + if (tracker == null) { + continue; + } + count += tracker.getCurrentHazards().keySet().size(); + tracker.getCurrentHazards().clear(); + } + if (count == 0) { + throw ERROR_CLEAR_EVERYTHING_FAILED.create(); + } + return count; + }))) + .then(Commands.literal("apply") + .then(Commands.argument("targets", EntityArgument.players()) + .then(Commands.argument("material", MaterialArgument.material()) + .executes(context -> { + Material material = MaterialArgument.getMaterial(context, + "material"); + Collection players = EntityArgument + .getPlayers(context, "targets"); + int success = 0; + HazardProperty property = material + .getProperty(PropertyKey.HAZARD); + if (property == null) { + throw ERROR_INVALID_MATERIAL.create(); + } + for (ServerPlayer player : players) { + IHazardEffectTracker tracker = GTCapabilityHelper + .getHazardEffectTracker(player); + if (tracker == null) { + continue; + } + tracker.getExtraHazards().add(material); + success++; + } + if (success == 0) { + throw ERROR_GIVE_FAILED.create(); + } + return success; + })))))); + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/commands/arguments/MaterialArgument.java b/src/main/java/com/gregtechceu/gtceu/common/commands/arguments/MaterialArgument.java new file mode 100644 index 0000000000..b752292f67 --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/common/commands/arguments/MaterialArgument.java @@ -0,0 +1,45 @@ +package com.gregtechceu.gtceu.common.commands.arguments; + +import com.gregtechceu.gtceu.api.GTCEuAPI; +import com.gregtechceu.gtceu.api.data.chemical.material.Material; + +import com.mojang.brigadier.StringReader; +import com.mojang.brigadier.arguments.ArgumentType; +import com.mojang.brigadier.context.CommandContext; +import com.mojang.brigadier.exceptions.CommandSyntaxException; +import com.mojang.brigadier.suggestion.Suggestions; +import com.mojang.brigadier.suggestion.SuggestionsBuilder; + +import java.util.Arrays; +import java.util.Collection; +import java.util.concurrent.CompletableFuture; + +public class MaterialArgument implements ArgumentType { + + private static final Collection EXAMPLES = Arrays.asList("aluminium", "gtceu:steel"); + + public MaterialArgument() {} + + public static MaterialArgument material() { + return new MaterialArgument(); + } + + @Override + public Material parse(StringReader reader) throws CommandSyntaxException { + return MaterialParser.parseForMaterial(GTCEuAPI.materialManager, reader); + } + + public static Material getMaterial(CommandContext context, String name) { + return context.getArgument(name, Material.class); + } + + @Override + public CompletableFuture listSuggestions(CommandContext context, SuggestionsBuilder builder) { + return MaterialParser.fillSuggestions(GTCEuAPI.materialManager, builder); + } + + @Override + public Collection getExamples() { + return EXAMPLES; + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/commands/arguments/MaterialParser.java b/src/main/java/com/gregtechceu/gtceu/common/commands/arguments/MaterialParser.java new file mode 100644 index 0000000000..cd2b4b55e9 --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/common/commands/arguments/MaterialParser.java @@ -0,0 +1,100 @@ +package com.gregtechceu.gtceu.common.commands.arguments; + +import com.gregtechceu.gtceu.api.data.chemical.material.IMaterialRegistryManager; +import com.gregtechceu.gtceu.api.data.chemical.material.Material; + +import net.minecraft.commands.SharedSuggestionProvider; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; + +import com.mojang.brigadier.StringReader; +import com.mojang.brigadier.exceptions.CommandSyntaxException; +import com.mojang.brigadier.exceptions.DynamicCommandExceptionType; +import com.mojang.brigadier.exceptions.SimpleCommandExceptionType; +import com.mojang.brigadier.suggestion.Suggestions; +import com.mojang.brigadier.suggestion.SuggestionsBuilder; + +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Function; + +public class MaterialParser { + + private static final SimpleCommandExceptionType ERROR_NO_TAGS_ALLOWED = new SimpleCommandExceptionType( + Component.translatable("argument.item.tag.disallowed")); + private static final DynamicCommandExceptionType ERROR_UNKNOWN_ITEM = new DynamicCommandExceptionType( + id -> Component.translatable("argument.item.id.invalid", id)); + private static final DynamicCommandExceptionType ERROR_UNKNOWN_TAG = new DynamicCommandExceptionType( + tag -> Component.translatable("arguments.item.tag.unknown", tag)); + private static final char SYNTAX_START_NBT = '{'; + private static final char SYNTAX_TAG = '#'; + private static final Function> SUGGEST_NOTHING = SuggestionsBuilder::buildFuture; + private final IMaterialRegistryManager materials; + private final StringReader reader; + private Material result; + /** + * Builder to be used when creating a list of suggestions + */ + private Function> suggestions = SUGGEST_NOTHING; + + private MaterialParser(IMaterialRegistryManager materials, StringReader reader) { + this.materials = materials; + this.reader = reader; + } + + public static Material parseForMaterial(IMaterialRegistryManager registry, + StringReader reader) throws CommandSyntaxException { + int i = reader.getCursor(); + + try { + MaterialParser materialParser = new MaterialParser(registry, reader); + materialParser.parse(); + return materialParser.result; + } catch (CommandSyntaxException var5) { + reader.setCursor(i); + throw var5; + } + } + + public static CompletableFuture fillSuggestions(IMaterialRegistryManager lookup, + SuggestionsBuilder builder) { + StringReader stringReader = new StringReader(builder.getInput()); + stringReader.setCursor(builder.getStart()); + MaterialParser materialParser = new MaterialParser(lookup, stringReader); + + try { + materialParser.parse(); + } catch (CommandSyntaxException var6) {} + + return (CompletableFuture) materialParser.suggestions + .apply(builder.createOffset(stringReader.getCursor())); + } + + private void readMaterial() throws CommandSyntaxException { + int i = this.reader.getCursor(); + ResourceLocation resourceLocation = ResourceLocation.read(this.reader); + Material material = this.materials.getRegistry(resourceLocation.getNamespace()).get(resourceLocation.getPath()); + this.result = Optional.ofNullable(material).orElseThrow(() -> { + this.reader.setCursor(i); + return ERROR_UNKNOWN_ITEM.createWithContext(this.reader, resourceLocation); + }); + } + + private void parse() throws CommandSyntaxException { + this.suggestions = this::suggestMaterial; + this.readMaterial(); + } + + private CompletableFuture suggestOpenNbt(SuggestionsBuilder builder) { + if (builder.getRemaining().isEmpty()) { + builder.suggest(String.valueOf('{')); + } + + return builder.buildFuture(); + } + + private CompletableFuture suggestMaterial(SuggestionsBuilder builder) { + return SharedSuggestionProvider.suggestResource( + this.materials.getRegisteredMaterials().stream().map(Material::getResourceLocation), builder); + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/ComputerMonitorCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/ComputerMonitorCover.java index 47712fed12..3fc282952b 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/ComputerMonitorCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/ComputerMonitorCover.java @@ -3,9 +3,11 @@ import com.gregtechceu.gtceu.api.capability.ICoverable; import com.gregtechceu.gtceu.api.cover.CoverBehavior; import com.gregtechceu.gtceu.api.cover.CoverDefinition; + import net.minecraft.core.Direction; public class ComputerMonitorCover extends CoverBehavior { + public ComputerMonitorCover(CoverDefinition definition, ICoverable coverHolder, Direction attachedSide) { super(definition, coverHolder, attachedSide); } diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/ConveyorCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/ConveyorCover.java index 2b308fd854..0e2d6093fa 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/ConveyorCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/ConveyorCover.java @@ -14,12 +14,12 @@ import com.gregtechceu.gtceu.api.gui.widget.EnumSelectorWidget; import com.gregtechceu.gtceu.api.gui.widget.IntInputWidget; import com.gregtechceu.gtceu.api.machine.ConditionalSubscriptionHandler; -import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; import com.gregtechceu.gtceu.api.transfer.item.ItemTransferDelegate; import com.gregtechceu.gtceu.common.blockentity.ItemPipeBlockEntity; import com.gregtechceu.gtceu.common.cover.data.DistributionMode; import com.gregtechceu.gtceu.common.cover.data.ManualIOMode; import com.gregtechceu.gtceu.utils.ItemStackHashStrategy; + import com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup; import com.lowdragmc.lowdraglib.gui.widget.LabelWidget; import com.lowdragmc.lowdraglib.gui.widget.SwitchWidget; @@ -29,26 +29,29 @@ import com.lowdragmc.lowdraglib.side.item.ItemTransferHelper; 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.LocalizationUtils; -import it.unimi.dsi.fastutil.ints.IntArrayList; -import it.unimi.dsi.fastutil.ints.IntList; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenCustomHashMap; -import lombok.AllArgsConstructor; -import lombok.Getter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.Block; + +import it.unimi.dsi.fastutil.ints.IntArrayList; +import it.unimi.dsi.fastutil.ints.IntList; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenCustomHashMap; +import lombok.AllArgsConstructor; +import lombok.Getter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.jetbrains.annotations.NotNull; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.List; import java.util.Map; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author KilaBash * @date 2023/3/12 @@ -57,23 +60,36 @@ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class ConveyorCover extends CoverBehavior implements IUICover, IControllable { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(ConveyorCover.class, CoverBehavior.MANAGED_FIELD_HOLDER); + + public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(ConveyorCover.class, + CoverBehavior.MANAGED_FIELD_HOLDER); public final int tier; public final int maxItemTransferRate; - @Persisted @Getter + @Persisted + @Getter protected int transferRate; - @Persisted @DescSynced @Getter @RequireRerender + @Persisted + @DescSynced + @Getter + @RequireRerender protected IO io; - @Persisted @DescSynced @Getter + @Persisted + @DescSynced + @Getter protected DistributionMode distributionMode; - @Persisted @DescSynced @Getter + @Persisted + @DescSynced + @Getter protected ManualIOMode manualIOMode = ManualIOMode.DISABLED; - @Persisted @Getter + @Persisted + @Getter protected boolean isWorkingEnabled = true; protected int itemsLeftToTransferLastSecond; private Widget ioModeSwitch; - @Persisted @DescSynced @Getter + @Persisted + @DescSynced + @Getter protected final FilterHandler filterHandler; protected final ConditionalSubscriptionHandler subscriptionHandler; @@ -102,11 +118,12 @@ protected boolean isSubscriptionActive() { } protected @Nullable IItemTransfer getAdjacentItemTransfer() { - return ItemTransferHelper.getItemTransfer(coverHolder.getLevel(), coverHolder.getPos().relative(attachedSide), attachedSide.getOpposite()); + return ItemTransferHelper.getItemTransfer(coverHolder.getLevel(), coverHolder.getPos().relative(attachedSide), + attachedSide.getOpposite()); } ////////////////////////////////////// - //***** Initialization ******// + // ***** Initialization ******// ////////////////////////////////////// @Override public ManagedFieldHolder getFieldHolder() { @@ -163,7 +180,7 @@ public List getAdditionalDrops() { } ////////////////////////////////////// - //***** Transfer Logic *****// + // ***** Transfer Logic *****// ////////////////////////////////////// @Override @@ -206,7 +223,8 @@ protected int doTransferItems(IItemTransfer sourceInventory, IItemTransfer targe return moveInventoryItems(sourceInventory, targetInventory, maxTransferAmount); } - protected int moveInventoryItems(IItemTransfer sourceInventory, IItemTransfer targetInventory, int maxTransferAmount) { + protected int moveInventoryItems(IItemTransfer sourceInventory, IItemTransfer targetInventory, + int maxTransferAmount) { ItemFilter filter = filterHandler.getFilter(); int itemsLeftToTransfer = maxTransferAmount; @@ -238,10 +256,11 @@ protected int moveInventoryItems(IItemTransfer sourceInventory, IItemTransfer ta return maxTransferAmount - itemsLeftToTransfer; } - protected static boolean moveInventoryItemsExact(IItemTransfer sourceInventory, IItemTransfer targetInventory, TypeItemInfo itemInfo) { - //first, compute how much can we extract in reality from the machine, - //because totalCount is based on what getStackInSlot returns, which may differ from what - //extractItem() will return + protected static boolean moveInventoryItemsExact(IItemTransfer sourceInventory, IItemTransfer targetInventory, + TypeItemInfo itemInfo) { + // first, compute how much can we extract in reality from the machine, + // because totalCount is based on what getStackInSlot returns, which may differ from what + // extractItem() will return ItemStack resultStack = itemInfo.itemStack.copy(); int totalExtractedCount = 0; int itemsLeftToExtract = itemInfo.totalCount; @@ -258,25 +277,25 @@ protected static boolean moveInventoryItemsExact(IItemTransfer sourceInventory, break; } } - //if amount of items extracted is not equal to the amount of items we - //wanted to extract, abort item extraction + // if amount of items extracted is not equal to the amount of items we + // wanted to extract, abort item extraction if (totalExtractedCount != itemInfo.totalCount) { return false; } - //adjust size of the result stack accordingly + // adjust size of the result stack accordingly resultStack.setCount(totalExtractedCount); - //now, see how much we can insert into destination inventory - //if we can't insert as much as itemInfo requires, and remainder is empty, abort, abort + // now, see how much we can insert into destination inventory + // if we can't insert as much as itemInfo requires, and remainder is empty, abort, abort ItemStack remainder = ItemTransferHelper.insertItem(targetInventory, resultStack, true); if (!remainder.isEmpty()) { return false; } - //otherwise, perform real insertion and then remove items from the source inventory + // otherwise, perform real insertion and then remove items from the source inventory ItemTransferHelper.insertItem(targetInventory, resultStack, false); - //perform real extraction of the items from the source inventory now + // perform real extraction of the items from the source inventory now itemsLeftToExtract = itemInfo.totalCount; for (int i = 0; i < itemInfo.slots.size(); i++) { int slotIndex = itemInfo.slots.getInt(i); @@ -292,7 +311,8 @@ protected static boolean moveInventoryItemsExact(IItemTransfer sourceInventory, return true; } - protected int moveInventoryItems(IItemTransfer sourceInventory, IItemTransfer targetInventory, Map itemInfos, int maxTransferAmount) { + protected int moveInventoryItems(IItemTransfer sourceInventory, IItemTransfer targetInventory, + Map itemInfos, int maxTransferAmount) { ItemFilter filter = filterHandler.getFilter(); int itemsLeftToTransfer = maxTransferAmount; @@ -304,7 +324,8 @@ protected int moveInventoryItems(IItemTransfer sourceInventory, IItemTransfer ta GroupItemInfo itemInfo = itemInfos.get(itemStack); - ItemStack extractedStack = sourceInventory.extractItem(i, Math.min(itemInfo.totalCount, itemsLeftToTransfer), true); + ItemStack extractedStack = sourceInventory.extractItem(i, + Math.min(itemInfo.totalCount, itemsLeftToTransfer), true); ItemStack remainderStack = ItemTransferHelper.insertItem(targetInventory, extractedStack, true); int amountToInsert = extractedStack.getCount() - remainderStack.getCount(); @@ -336,7 +357,8 @@ protected int moveInventoryItems(IItemTransfer sourceInventory, IItemTransfer ta @NotNull protected Map countInventoryItemsByType(@NotNull IItemTransfer inventory) { ItemFilter filter = filterHandler.getFilter(); - Map result = new Object2ObjectOpenCustomHashMap<>(ItemStackHashStrategy.comparingAllButCount()); + Map result = new Object2ObjectOpenCustomHashMap<>( + ItemStackHashStrategy.comparingAllButCount()); for (int srcIndex = 0; srcIndex < inventory.getSlots(); srcIndex++) { ItemStack itemStack = inventory.getStackInSlot(srcIndex); @@ -356,7 +378,8 @@ protected Map countInventoryItemsByType(@NotNull IItemT @NotNull protected Map countInventoryItemsByMatchSlot(@NotNull IItemTransfer inventory) { ItemFilter filter = filterHandler.getFilter(); - Map result = new Object2ObjectOpenCustomHashMap<>(ItemStackHashStrategy.comparingAllButCount()); + Map result = new Object2ObjectOpenCustomHashMap<>( + ItemStackHashStrategy.comparingAllButCount()); for (int srcIndex = 0; srcIndex < inventory.getSlots(); srcIndex++) { ItemStack itemStack = inventory.getStackInSlot(srcIndex); @@ -373,6 +396,7 @@ protected Map countInventoryItemsByMatchSlot(@NotNull @AllArgsConstructor protected static class TypeItemInfo { + public final ItemStack itemStack; public final IntList slots; public int totalCount; @@ -380,13 +404,13 @@ protected static class TypeItemInfo { @AllArgsConstructor protected static class GroupItemInfo { + public final ItemStack itemStack; public int totalCount; } - ////////////////////////////////////// - //*********** GUI ***********// + // *********** GUI ***********// ////////////////////////////////////// @Override public Widget createUIWidget() { @@ -400,14 +424,14 @@ public Widget createUIWidget() { (clickData, value) -> { setIo(value ? IO.IN : IO.OUT); ioModeSwitch.setHoverTooltips( - LocalizationUtils.format("cover.conveyor.mode", LocalizationUtils.format(io.tooltip)) - ); + LocalizationUtils.format("cover.conveyor.mode", LocalizationUtils.format(io.tooltip))); }) .setTexture( new GuiTextureGroup(GuiTextures.VANILLA_BUTTON, IO.OUT.icon), new GuiTextureGroup(GuiTextures.VANILLA_BUTTON, IO.IN.icon)) .setPressed(io == IO.IN) - .setHoverTooltips(LocalizationUtils.format("cover.conveyor.mode", LocalizationUtils.format(io.tooltip))); + .setHoverTooltips( + LocalizationUtils.format("cover.conveyor.mode", LocalizationUtils.format(io.tooltip))); group.addWidget(ioModeSwitch); if (shouldDisplayDistributionMode()) { @@ -429,7 +453,8 @@ public Widget createUIWidget() { private boolean shouldDisplayDistributionMode() { return coverHolder.getLevel().getBlockEntity(coverHolder.getPos()) instanceof ItemPipeBlockEntity || - coverHolder.getLevel().getBlockEntity(coverHolder.getPos().relative(attachedSide)) instanceof ItemPipeBlockEntity; + coverHolder.getLevel() + .getBlockEntity(coverHolder.getPos().relative(attachedSide)) instanceof ItemPipeBlockEntity; } @NotNull @@ -445,9 +470,8 @@ protected void configureFilter() { // Do nothing in the base implementation. This is intended to be overridden by subclasses. } - ///////////////////////////////////// - //*** CAPABILITY OVERRIDE ***// + // *** CAPABILITY OVERRIDE ***// ///////////////////////////////////// private CoverableItemTransferWrapper itemHandlerWrapper; @@ -465,6 +489,7 @@ public IItemTransfer getItemTransferCap(@Nullable IItemTransfer defaultValue) { } private class CoverableItemTransferWrapper extends ItemTransferDelegate { + public CoverableItemTransferWrapper(IItemTransfer delegate) { super(delegate); } diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/CoverSolarPanel.java b/src/main/java/com/gregtechceu/gtceu/common/cover/CoverSolarPanel.java index 07acbadf3e..62c622a8e9 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/CoverSolarPanel.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/CoverSolarPanel.java @@ -1,24 +1,22 @@ package com.gregtechceu.gtceu.common.cover; -import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.capability.GTCapabilityHelper; import com.gregtechceu.gtceu.api.capability.ICoverable; import com.gregtechceu.gtceu.api.capability.IEnergyContainer; import com.gregtechceu.gtceu.api.cover.CoverBehavior; import com.gregtechceu.gtceu.api.cover.CoverDefinition; -import com.gregtechceu.gtceu.api.machine.ConditionalSubscriptionHandler; import com.gregtechceu.gtceu.api.machine.TickableSubscription; -import com.gregtechceu.gtceu.client.renderer.cover.ICoverRenderer; -import com.gregtechceu.gtceu.utils.FacingPos; import com.gregtechceu.gtceu.utils.GTUtil; + import net.minecraft.core.BlockPos; -import net.minecraft.world.level.Level; -import com.lowdragmc.lowdraglib.syncdata.IManagedStorage; import net.minecraft.core.Direction; +import net.minecraft.world.level.Level; + import org.jetbrains.annotations.Nullable; public class CoverSolarPanel extends CoverBehavior { + private final long EUt; protected TickableSubscription subscription; @@ -46,7 +44,6 @@ public boolean canAttach() { return attachedSide == Direction.UP && getEnergyContainer() != null; } - protected void update() { Level level = coverHolder.getLevel(); BlockPos blockPos = coverHolder.getPos(); @@ -56,7 +53,6 @@ protected void update() { energyContainer.acceptEnergyFromNetwork(null, EUt, 1); } } - } @Nullable diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/FacadeCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/FacadeCover.java index daf57df90e..db5a45e0fb 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/FacadeCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/FacadeCover.java @@ -3,14 +3,13 @@ import com.gregtechceu.gtceu.api.capability.ICoverable; import com.gregtechceu.gtceu.api.cover.CoverBehavior; import com.gregtechceu.gtceu.api.cover.CoverDefinition; -import com.gregtechceu.gtceu.api.pipenet.ITickablePipeNet; -import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; import com.gregtechceu.gtceu.common.item.FacadeItemBehaviour; + 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 lombok.Getter; -import lombok.Setter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -19,6 +18,9 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; + +import lombok.Getter; +import lombok.Setter; import org.jetbrains.annotations.Nullable; import javax.annotation.ParametersAreNonnullByDefault; @@ -27,8 +29,13 @@ @MethodsReturnNonnullByDefault public class FacadeCover extends CoverBehavior { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(FacadeCover.class, CoverBehavior.MANAGED_FIELD_HOLDER); - @Setter @Getter @DescSynced @Persisted @RequireRerender + public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(FacadeCover.class, + CoverBehavior.MANAGED_FIELD_HOLDER); + @Setter + @Getter + @DescSynced + @Persisted + @RequireRerender private BlockState facadeState = Blocks.STONE.defaultBlockState(); public FacadeCover(CoverDefinition definition, ICoverable coverHolder, Direction attachedSide) { diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/FluidFilterCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/FluidFilterCover.java index eef29180de..19232c0cf6 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/FluidFilterCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/FluidFilterCover.java @@ -5,16 +5,14 @@ import com.gregtechceu.gtceu.api.cover.CoverDefinition; import com.gregtechceu.gtceu.api.cover.IUICover; import com.gregtechceu.gtceu.api.cover.filter.FluidFilter; -import com.gregtechceu.gtceu.api.gui.GuiTextures; -import com.gregtechceu.gtceu.api.gui.UITemplate; -import com.lowdragmc.lowdraglib.gui.modular.ModularUI; + import com.lowdragmc.lowdraglib.gui.widget.LabelWidget; import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.side.fluid.FluidTransferHelper; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; -import net.minecraft.world.entity.player.Player; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/FluidRegulatorCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/FluidRegulatorCover.java index 44a37e7bc8..15d8e249b0 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/FluidRegulatorCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/FluidRegulatorCover.java @@ -9,31 +9,40 @@ import com.gregtechceu.gtceu.api.gui.widget.NumberInputWidget; import com.gregtechceu.gtceu.common.cover.data.BucketMode; import com.gregtechceu.gtceu.common.cover.data.TransferMode; + import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.side.fluid.FluidStack; import com.lowdragmc.lowdraglib.side.fluid.IFluidTransfer; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import lombok.Getter; + import net.minecraft.core.Direction; + +import lombok.Getter; import org.jetbrains.annotations.NotNull; import java.util.Map; public class FluidRegulatorCover extends PumpCover { + private static final long MAX_STACK_SIZE = 2_048_000_000; // Capacity of quantum tank IX - @Persisted @DescSynced @Getter + @Persisted + @DescSynced + @Getter private TransferMode transferMode = TransferMode.TRANSFER_ANY; - @Persisted @DescSynced @Getter + @Persisted + @DescSynced + @Getter private BucketMode transferBucketMode = BucketMode.MILLI_BUCKET; - @Persisted @DescSynced @Getter + @Persisted + @DescSynced + @Getter protected long globalTransferSizeMillibuckets; protected long fluidTransferBuffered = 0L; - private NumberInputWidget transferSizeInput; private EnumSelectorWidget transferBucketModeInput; @@ -42,12 +51,12 @@ public FluidRegulatorCover(CoverDefinition definition, ICoverable coverHolder, D } ////////////////////////////////////// - //***** Transfer Logic ******// + // ***** Transfer Logic ******// ////////////////////////////////////// - @Override - protected long doTransferFluidsInternal(IFluidTransfer source, IFluidTransfer destination, long platformTransferLimit) { + protected long doTransferFluidsInternal(IFluidTransfer source, IFluidTransfer destination, + long platformTransferLimit) { return switch (transferMode) { case TRANSFER_ANY -> transferAny(source, destination, platformTransferLimit); case TRANSFER_EXACT -> transferExact(source, destination, platformTransferLimit); @@ -142,7 +151,6 @@ private void setTransferBucketMode(BucketMode transferBucketMode) { this.transferBucketMode = transferBucketMode; - if (transferSizeInput == null) return; if (oldMultiplier > newMultiplier) { @@ -178,11 +186,12 @@ private long getFilteredFluidAmount(FluidStack fluidStack) { return globalTransferSizeMillibuckets; FluidFilter filter = filterHandler.getFilter(); - return (filter.supportsAmounts() ? filter.testFluidAmount(fluidStack) : globalTransferSizeMillibuckets) * MILLIBUCKET_SIZE; + return (filter.supportsAmounts() ? filter.testFluidAmount(fluidStack) : globalTransferSizeMillibuckets) * + MILLIBUCKET_SIZE; } /////////////////////////// - //***** GUI ******// + // ***** GUI ******// /////////////////////////// @Override @@ -192,15 +201,17 @@ private long getFilteredFluidAmount(FluidStack fluidStack) { @Override protected void buildAdditionalUI(WidgetGroup group) { - group.addWidget(new EnumSelectorWidget<>(146, 45, 20, 20, TransferMode.values(), transferMode, this::setTransferMode)); + group.addWidget( + new EnumSelectorWidget<>(146, 45, 20, 20, TransferMode.values(), transferMode, this::setTransferMode)); this.transferSizeInput = new LongInputWidget(35, 45, 84, 20, - this::getCurrentBucketModeTransferSize, this::setCurrentBucketModeTransferSize - ).setMin(0L).setMax(Long.MAX_VALUE); + this::getCurrentBucketModeTransferSize, this::setCurrentBucketModeTransferSize).setMin(0L) + .setMax(Long.MAX_VALUE); configureTransferSizeInput(); group.addWidget(this.transferSizeInput); - this.transferBucketModeInput = new EnumSelectorWidget<>(121, 45, 20, 20, BucketMode.values(), transferBucketMode, this::setTransferBucketMode); + this.transferBucketModeInput = new EnumSelectorWidget<>(121, 45, 20, 20, BucketMode.values(), + transferBucketMode, this::setTransferBucketMode); group.addWidget(this.transferBucketModeInput); } @@ -209,7 +220,8 @@ private long getCurrentBucketModeTransferSize() { } private void setCurrentBucketModeTransferSize(long transferSize) { - this.globalTransferSizeMillibuckets = Math.min(Math.max(transferSize * this.transferBucketMode.multiplier, 0), MAX_STACK_SIZE); + this.globalTransferSizeMillibuckets = Math.min(Math.max(transferSize * this.transferBucketMode.multiplier, 0), + MAX_STACK_SIZE); } private void configureTransferSizeInput() { @@ -231,10 +243,11 @@ private boolean shouldShowTransferSize() { } ////////////////////////////////////// - //***** LDLib SyncData ******// + // ***** LDLib SyncData ******// ////////////////////////////////////// - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(FluidRegulatorCover.class, PumpCover.MANAGED_FIELD_HOLDER); + public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(FluidRegulatorCover.class, + PumpCover.MANAGED_FIELD_HOLDER); @Override public ManagedFieldHolder getFieldHolder() { diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/InfiniteWaterCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/InfiniteWaterCover.java index 4242e72571..8e4e33db2b 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/InfiniteWaterCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/InfiniteWaterCover.java @@ -4,9 +4,11 @@ import com.gregtechceu.gtceu.api.cover.CoverBehavior; import com.gregtechceu.gtceu.api.cover.CoverDefinition; import com.gregtechceu.gtceu.api.machine.TickableSubscription; + import com.lowdragmc.lowdraglib.side.fluid.FluidHelper; import com.lowdragmc.lowdraglib.side.fluid.FluidStack; import com.lowdragmc.lowdraglib.side.fluid.FluidTransferHelper; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.world.level.material.Fluids; @@ -49,10 +51,10 @@ public void onRemoved() { public void update() { if (coverHolder.getOffsetTimer() % 20 == 0) { - var fluidHandler = FluidTransferHelper.getFluidTransfer(coverHolder.getLevel(), coverHolder.getPos(), attachedSide); - if(fluidHandler != null) + var fluidHandler = FluidTransferHelper.getFluidTransfer(coverHolder.getLevel(), coverHolder.getPos(), + attachedSide); + if (fluidHandler != null) fluidHandler.fill(FluidStack.create(Fluids.WATER, 16 * FluidHelper.getBucket()), false); } } - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/ItemFilterCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/ItemFilterCover.java index 49a89d76f5..4dfd227b83 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/ItemFilterCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/ItemFilterCover.java @@ -7,6 +7,7 @@ import com.gregtechceu.gtceu.api.cover.filter.ItemFilter; import com.gregtechceu.gtceu.api.gui.widget.EnumSelectorWidget; import com.gregtechceu.gtceu.common.cover.data.ItemFilterMode; + import com.lowdragmc.lowdraglib.gui.widget.LabelWidget; import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; @@ -14,10 +15,12 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import lombok.Getter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; +import lombok.Getter; + import javax.annotation.ParametersAreNonnullByDefault; /** @@ -29,10 +32,13 @@ @MethodsReturnNonnullByDefault public class ItemFilterCover extends CoverBehavior implements IUICover { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(ItemFilterCover.class, CoverBehavior.MANAGED_FIELD_HOLDER); + public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(ItemFilterCover.class, + CoverBehavior.MANAGED_FIELD_HOLDER); protected ItemFilter itemFilter; - @Persisted @DescSynced @Getter + @Persisted + @DescSynced + @Getter protected ItemFilterMode filterMode = ItemFilterMode.FILTER_INSERT; public ItemFilterCover(CoverDefinition definition, ICoverable coverHolder, Direction attachedSide) { diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/MachineControllerCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/MachineControllerCover.java index a0e3ce164f..4d3d20a995 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/MachineControllerCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/MachineControllerCover.java @@ -11,6 +11,7 @@ import com.gregtechceu.gtceu.api.gui.widget.ToggleButtonWidget; import com.gregtechceu.gtceu.common.cover.data.ControllerMode; import com.gregtechceu.gtceu.data.lang.LangHandler; + import com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup; import com.lowdragmc.lowdraglib.gui.texture.TextTexture; import com.lowdragmc.lowdraglib.gui.widget.*; @@ -18,7 +19,7 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import lombok.Getter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -28,19 +29,23 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.state.BlockState; + +import lombok.Getter; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.Arrays; import java.util.List; import java.util.Optional; import java.util.stream.Collectors; +import javax.annotation.ParametersAreNonnullByDefault; + @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class MachineControllerCover extends CoverBehavior implements IUICover { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(MachineControllerCover.class, CoverBehavior.MANAGED_FIELD_HOLDER); + + public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(MachineControllerCover.class, + CoverBehavior.MANAGED_FIELD_HOLDER); private ItemStackTransfer sideCoverSlot; private ButtonWidget modeButton; @@ -49,14 +54,17 @@ public ManagedFieldHolder getFieldHolder() { return MANAGED_FIELD_HOLDER; } - - @Persisted @Getter + @Persisted + @Getter private boolean isInverted = false; - @Persisted @Getter + @Persisted + @Getter private int minRedstoneStrength = 1; - @Persisted @DescSynced @Getter + @Persisted + @DescSynced + @Getter private ControllerMode controllerMode = ControllerMode.MACHINE; public MachineControllerCover(CoverDefinition definition, ICoverable coverHolder, Direction attachedSide) { @@ -117,7 +125,7 @@ private void updateAll() { } /////////////////////////////////////////////////// - //*********** CONTROLLER LOGIC ***********// + // *********** CONTROLLER LOGIC ***********// /////////////////////////////////////////////////// @Nullable @@ -181,9 +189,8 @@ private int getInputSignal() { return level.getSignal(sourcePos, attachedSide); } - ////////////////////////////////////// - //*********** GUI ***********// + // *********** GUI ***********// ////////////////////////////////////// @Override @@ -192,31 +199,29 @@ public Widget createUIWidget() { group.addWidget(new LabelWidget(10, 5, "cover.machine_controller.title")); group.addWidget(new IntInputWidget(10, 20, 131, 20, - this::getMinRedstoneStrength, this::setMinRedstoneStrength - ).setMin(1).setMax(15)); + this::getMinRedstoneStrength, this::setMinRedstoneStrength).setMin(1).setMax(15)); modeButton = new ButtonWidget(10, 45, 131, 20, new GuiTextureGroup(GuiTextures.VANILLA_BUTTON), - cd -> selectNextMode() - ); + cd -> selectNextMode()); group.addWidget(modeButton); // Inverted Mode Toggle: group.addWidget(new ToggleButtonWidget( 146, 20, 20, 20, - GuiTextures.INVERT_REDSTONE_BUTTON, this::isInverted, this::setInverted - ) { + GuiTextures.INVERT_REDSTONE_BUTTON, this::isInverted, this::setInverted) { + @Override public void updateScreen() { super.updateScreen(); setHoverTooltips(List.copyOf(LangHandler.getMultiLang( - "cover.machine_controller.invert." + (isPressed ? "enabled" : "disabled") - ))); + "cover.machine_controller.invert." + (isPressed ? "enabled" : "disabled")))); } }); sideCoverSlot = new ItemStackTransfer(1); group.addWidget(new PhantomSlotWidget(sideCoverSlot, 0, 147, 46) { + @Override public ItemStack slotClickPhantom(Slot slot, int mouseButton, ClickType clickTypeIn, ItemStack stackHeld) { return sideCoverSlot.getStackInSlot(0); @@ -250,8 +255,7 @@ private void updateModeButton() { modeButton.setButtonTexture(new GuiTextureGroup( GuiTextures.VANILLA_BUTTON, - new TextTexture(controllerMode.localeName) - )); + new TextTexture(controllerMode.localeName))); } private void updateCoverSlot() { @@ -269,7 +273,6 @@ private void updateCoverSlot() { () -> { sideCoverSlot.setStackInSlot(0, ItemStack.EMPTY); sideCoverSlot.onContentsChanged(0); - } - ); + }); } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/PumpCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/PumpCover.java index 6ff19749b5..a5e4a21d62 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/PumpCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/PumpCover.java @@ -14,11 +14,11 @@ import com.gregtechceu.gtceu.api.gui.widget.LongInputWidget; import com.gregtechceu.gtceu.api.gui.widget.NumberInputWidget; import com.gregtechceu.gtceu.api.machine.ConditionalSubscriptionHandler; -import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; import com.gregtechceu.gtceu.api.transfer.fluid.FluidTransferDelegate; import com.gregtechceu.gtceu.common.cover.data.BucketMode; import com.gregtechceu.gtceu.common.cover.data.ManualIOMode; import com.gregtechceu.gtceu.utils.FluidStackHashStrategy; + import com.lowdragmc.lowdraglib.gui.widget.LabelWidget; import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; @@ -28,25 +28,28 @@ import com.lowdragmc.lowdraglib.side.fluid.IFluidTransfer; 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.LocalizationUtils; -import it.unimi.dsi.fastutil.objects.Object2LongOpenCustomHashMap; -import lombok.Getter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.network.chat.Component; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.Block; + +import it.unimi.dsi.fastutil.objects.Object2LongOpenCustomHashMap; +import lombok.Getter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.Arrays; -import java.util.EnumMap; import java.util.List; import java.util.Map; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author KilaBash * @date 2023/3/12 @@ -55,27 +58,40 @@ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class PumpCover extends CoverBehavior implements IUICover, IControllable { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(PumpCover.class, CoverBehavior.MANAGED_FIELD_HOLDER); + + public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(PumpCover.class, + CoverBehavior.MANAGED_FIELD_HOLDER); protected static final long MILLIBUCKET_SIZE = FluidHelper.getBucket() / 1000; public final int tier; public final long maxMilliBucketsPerTick; - @Persisted @DescSynced @Getter + @Persisted + @DescSynced + @Getter protected long currentMilliBucketsPerTick; - @Persisted @DescSynced @Getter @RequireRerender + @Persisted + @DescSynced + @Getter + @RequireRerender protected IO io = IO.OUT; - @Persisted @DescSynced @Getter + @Persisted + @DescSynced + @Getter protected BucketMode bucketMode = BucketMode.MILLI_BUCKET; - @Persisted @DescSynced @Getter + @Persisted + @DescSynced + @Getter protected ManualIOMode manualIOMode = ManualIOMode.DISABLED; - @Persisted @Getter + @Persisted + @Getter protected boolean isWorkingEnabled = true; protected long milliBucketsLeftToTransferLastSecond; - @Persisted @DescSynced + @Persisted + @DescSynced protected final FilterHandler filterHandler; protected final ConditionalSubscriptionHandler subscriptionHandler; private NumberInputWidget transferRateWidget; @@ -110,11 +126,12 @@ protected boolean isSubscriptionActive() { } protected @Nullable IFluidTransfer getAdjacentFluidTransfer() { - return FluidTransferHelper.getFluidTransfer(coverHolder.getLevel(), coverHolder.getPos().relative(attachedSide), attachedSide.getOpposite()); + return FluidTransferHelper.getFluidTransfer(coverHolder.getLevel(), coverHolder.getPos().relative(attachedSide), + attachedSide.getOpposite()); } ////////////////////////////////////// - //***** Initialization ******// + // ***** Initialization ******// ////////////////////////////////////// @Override public ManagedFieldHolder getFieldHolder() { @@ -167,10 +184,9 @@ public void setWorkingEnabled(boolean isWorkingAllowed) { } ////////////////////////////////////// - //***** Transfer Logic *****// + // ***** Transfer Logic *****// ////////////////////////////////////// - public void setTransferRate(long milliBucketsPerTick) { this.currentMilliBucketsPerTick = Math.min(Math.max(milliBucketsPerTick, 0), maxMilliBucketsPerTick); } @@ -181,7 +197,6 @@ public void setBucketMode(BucketMode bucketMode) { this.bucketMode = bucketMode; - if (transferRateWidget == null) return; if (oldMultiplier > newMultiplier) { @@ -229,25 +244,26 @@ private long doTransferFluids(long platformTransferLimit) { }; } return 0; - } - protected long doTransferFluidsInternal(IFluidTransfer source, IFluidTransfer destination, long platformTransferLimit) { + protected long doTransferFluidsInternal(IFluidTransfer source, IFluidTransfer destination, + long platformTransferLimit) { return transferAny(source, destination, platformTransferLimit); } protected long transferAny(IFluidTransfer source, IFluidTransfer destination, long platformTransferLimit) { - return FluidTransferHelper.transferFluids(source, destination, platformTransferLimit, filterHandler.getFilter()); + return FluidTransferHelper.transferFluids(source, destination, platformTransferLimit, + filterHandler.getFilter()); } - protected enum TransferDirection { INSERT, EXTRACT } protected Map enumerateDistinctFluids(IFluidTransfer fluidTransfer, TransferDirection direction) { - final Map summedFluids = new Object2LongOpenCustomHashMap<>(FluidStackHashStrategy.comparingAllButAmount()); + final Map summedFluids = new Object2LongOpenCustomHashMap<>( + FluidStackHashStrategy.comparingAllButAmount()); for (int tank = 0; tank < fluidTransfer.getTanks(); tank++) { if (!canTransfer(fluidTransfer, direction, tank)) @@ -273,9 +289,8 @@ private static boolean canTransfer(IFluidTransfer fluidTransfer, TransferDirecti }; } - ////////////////////////////////////// - //*********** GUI ***********// + // *********** GUI ***********// ////////////////////////////////////// @Override @@ -291,8 +306,7 @@ public Widget createUIWidget() { group.addWidget(new EnumSelectorWidget<>( 146, 20, 20, 20, Arrays.stream(BucketMode.values()).filter(m -> m.multiplier <= maxMilliBucketsPerTick).toList(), - bucketMode, this::setBucketMode - ).setTooltipSupplier(this::getBucketModeTooltip)); + bucketMode, this::setBucketMode).setTooltipSupplier(this::getBucketModeTooltip)); group.addWidget(new EnumSelectorWidget<>(10, 45, 20, 20, List.of(IO.IN, IO.OUT), io, this::setIo)); @@ -310,8 +324,7 @@ public Widget createUIWidget() { private List getBucketModeTooltip(BucketMode mode, String langKey) { return List.of( - Component.translatable(langKey).append(Component.translatable("gtceu.gui.content.units.per_tick")) - ); + Component.translatable(langKey).append(Component.translatable("gtceu.gui.content.units.per_tick"))); } private long getCurrentBucketModeTransferRate() { @@ -335,9 +348,8 @@ protected void configureFilter() { // Do nothing in the base implementation. This is intended to be overridden by subclasses. } - ///////////////////////////////////// - //*** CAPABILITY OVERRIDE ***// + // *** CAPABILITY OVERRIDE ***// ///////////////////////////////////// private CoverableFluidTransferWrapper fluidTransferWrapper; diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/RobotArmCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/RobotArmCover.java index a37fd56dcd..f00bbe6e7c 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/RobotArmCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/RobotArmCover.java @@ -9,30 +9,39 @@ import com.gregtechceu.gtceu.api.gui.widget.IntInputWidget; import com.gregtechceu.gtceu.common.cover.data.TransferMode; import com.gregtechceu.gtceu.common.pipelike.item.ItemNetHandler; + import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.side.item.IItemTransfer; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import lombok.Getter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.world.item.ItemStack; + +import lombok.Getter; import org.jetbrains.annotations.NotNull; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.Iterator; import java.util.Map; +import javax.annotation.ParametersAreNonnullByDefault; + @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault public class RobotArmCover extends ConveyorCover { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(RobotArmCover.class, ConveyorCover.MANAGED_FIELD_HOLDER); - @Persisted @DescSynced @Getter + public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(RobotArmCover.class, + ConveyorCover.MANAGED_FIELD_HOLDER); + + @Persisted + @DescSynced + @Getter protected TransferMode transferMode; - @Persisted @Getter + @Persisted + @Getter protected int globalTransferLimit; protected int itemsTransferBuffered; @@ -92,11 +101,11 @@ protected int doTransferExact(IItemTransfer sourceInventory, IItemTransfer targe notEnoughTransferRate = true; } } - //if we didn't transfer anything because of too small transfer rate, buffer it + // if we didn't transfer anything because of too small transfer rate, buffer it if (itemsTransferred == 0 && notEnoughTransferRate) { itemsTransferBuffered += maxTransferAmount; } else { - //otherwise, if transfer succeed, empty transfer buffer value + // otherwise, if transfer succeed, empty transfer buffer value itemsTransferBuffered = 0; } return Math.min(itemsTransferred, maxTransferAmount); @@ -147,9 +156,8 @@ public void clearBuffer() { itemsTransferBuffered = 0; } - ////////////////////////////////////// - //*********** GUI ***********// + // *********** GUI ***********// ////////////////////////////////////// @Override @@ -160,11 +168,11 @@ protected String getUITitle() { @Override protected void buildAdditionalUI(WidgetGroup group) { - group.addWidget(new EnumSelectorWidget<>(146, 45, 20, 20, TransferMode.values(), transferMode, this::setTransferMode)); + group.addWidget( + new EnumSelectorWidget<>(146, 45, 20, 20, TransferMode.values(), transferMode, this::setTransferMode)); this.stackSizeInput = new IntInputWidget(64, 45, 80, 20, - () -> globalTransferLimit, val -> globalTransferLimit = val - ); + () -> globalTransferLimit, val -> globalTransferLimit = val); configureStackSizeInput(); group.addWidget(this.stackSizeInput); diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/ShutterCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/ShutterCover.java index 8c7ac6ef87..ce103e774b 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/ShutterCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/ShutterCover.java @@ -4,10 +4,10 @@ import com.gregtechceu.gtceu.api.capability.ICoverable; import com.gregtechceu.gtceu.api.cover.CoverBehavior; import com.gregtechceu.gtceu.api.cover.CoverDefinition; + import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import lombok.Getter; -import lombok.Setter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.network.chat.Component; @@ -15,6 +15,9 @@ import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; import net.minecraft.world.phys.BlockHitResult; + +import lombok.Getter; +import lombok.Setter; import org.jetbrains.annotations.NotNull; import javax.annotation.ParametersAreNonnullByDefault; @@ -22,10 +25,13 @@ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class ShutterCover extends CoverBehavior implements IControllable { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(ShutterCover.class, CoverBehavior.MANAGED_FIELD_HOLDER); + + public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(ShutterCover.class, + CoverBehavior.MANAGED_FIELD_HOLDER); @Persisted - @Getter @Setter + @Getter + @Setter private boolean workingEnabled = true; public ShutterCover(@NotNull CoverDefinition definition, @NotNull ICoverable coverableView, @@ -57,4 +63,4 @@ public InteractionResult onSoftMalletClick(Player playerIn, InteractionHand hand public ManagedFieldHolder getFieldHolder() { return MANAGED_FIELD_HOLDER; } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/data/BucketMode.java b/src/main/java/com/gregtechceu/gtceu/common/cover/data/BucketMode.java index 257f6422e1..059386b461 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/data/BucketMode.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/data/BucketMode.java @@ -1,11 +1,14 @@ package com.gregtechceu.gtceu.common.cover.data; import com.gregtechceu.gtceu.api.gui.widget.EnumSelectorWidget; + import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; + import lombok.Getter; public enum BucketMode implements EnumSelectorWidget.SelectableEnum { + BUCKET("cover.bucket.mode.bucket", "minecraft:textures/item/water_bucket", 1000), MILLI_BUCKET("cover.bucket.mode.milli_bucket", "gtceu:textures/gui/icon/bucket_mode/water_drop", 1); @@ -14,7 +17,6 @@ public enum BucketMode implements EnumSelectorWidget.SelectableEnum { @Getter public final IGuiTexture icon; - public final long multiplier; BucketMode(String tooltip, String textureName, long multiplier) { diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/data/ControllerMode.java b/src/main/java/com/gregtechceu/gtceu/common/cover/data/ControllerMode.java index d72cf286f6..b27531b660 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/data/ControllerMode.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/data/ControllerMode.java @@ -1,9 +1,11 @@ package com.gregtechceu.gtceu.common.cover.data; -import lombok.Getter; import net.minecraft.core.Direction; +import lombok.Getter; + public enum ControllerMode { + MACHINE("cover.machine_controller.mode.machine", null), COVER_UP("cover.machine_controller.mode.cover_up", Direction.UP), COVER_DOWN("cover.machine_controller.mode.cover_down", Direction.DOWN), @@ -20,4 +22,4 @@ public enum ControllerMode { this.localeName = localeName; this.side = side; } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/data/DistributionMode.java b/src/main/java/com/gregtechceu/gtceu/common/cover/data/DistributionMode.java index dfeab2d0d9..137f7c5d7d 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/data/DistributionMode.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/data/DistributionMode.java @@ -1,10 +1,12 @@ package com.gregtechceu.gtceu.common.cover.data; import com.gregtechceu.gtceu.api.gui.widget.EnumSelectorWidget; + import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; public enum DistributionMode implements EnumSelectorWidget.SelectableEnum { + ROUND_ROBIN_GLOBAL("round_robin_global"), ROUND_ROBIN_PRIO("round_robin_prio"), INSERT_FIRST("insert_first"); diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/data/ItemFilterMode.java b/src/main/java/com/gregtechceu/gtceu/common/cover/data/ItemFilterMode.java index de302e8233..b5815fc735 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/data/ItemFilterMode.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/data/ItemFilterMode.java @@ -1,8 +1,10 @@ package com.gregtechceu.gtceu.common.cover.data; import com.gregtechceu.gtceu.api.gui.widget.EnumSelectorWidget; + import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; + import net.minecraft.MethodsReturnNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/data/ManualIOMode.java b/src/main/java/com/gregtechceu/gtceu/common/cover/data/ManualIOMode.java index 672648c21a..c03b48b0a2 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/data/ManualIOMode.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/data/ManualIOMode.java @@ -1,10 +1,12 @@ package com.gregtechceu.gtceu.common.cover.data; import com.gregtechceu.gtceu.api.gui.widget.EnumSelectorWidget; + import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; public enum ManualIOMode implements EnumSelectorWidget.SelectableEnum { + DISABLED("disabled"), FILTERED("filtered"), UNFILTERED("unfiltered"); @@ -26,4 +28,4 @@ public String getTooltip() { public IGuiTexture getIcon() { return new ResourceTexture("gtceu:textures/gui/icon/manual_io_mode/" + localeName + ".png"); } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/data/TransferMode.java b/src/main/java/com/gregtechceu/gtceu/common/cover/data/TransferMode.java index 3bbfe2edaa..aefcf62a6f 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/data/TransferMode.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/data/TransferMode.java @@ -1,11 +1,14 @@ package com.gregtechceu.gtceu.common.cover.data; import com.gregtechceu.gtceu.api.gui.widget.EnumSelectorWidget; + import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; + import lombok.Getter; public enum TransferMode implements EnumSelectorWidget.SelectableEnum { + TRANSFER_ANY("cover.robotic_arm.transfer_mode.transfer_any", "transfer_any", 1), TRANSFER_EXACT("cover.robotic_arm.transfer_mode.transfer_exact", "transfer_exact", 1024), KEEP_EXACT("cover.robotic_arm.transfer_mode.keep_exact", "keep_exact", 1024); diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/data/VoidingMode.java b/src/main/java/com/gregtechceu/gtceu/common/cover/data/VoidingMode.java index 58f2080e45..bed9890115 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/data/VoidingMode.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/data/VoidingMode.java @@ -1,11 +1,14 @@ package com.gregtechceu.gtceu.common.cover.data; import com.gregtechceu.gtceu.api.gui.widget.EnumSelectorWidget; + import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; + import lombok.Getter; public enum VoidingMode implements EnumSelectorWidget.SelectableEnum { + VOID_ANY("cover.voiding.voiding_mode.void_any", "void_any", 1), VOID_OVERFLOW("cover.voiding.voiding_mode.void_overflow", "void_overflow", 1024); diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/detector/ActivityDetectorCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/detector/ActivityDetectorCover.java index ef1576cc5e..d10aa75c3f 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/detector/ActivityDetectorCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/detector/ActivityDetectorCover.java @@ -3,15 +3,16 @@ import com.gregtechceu.gtceu.api.capability.GTCapabilityHelper; import com.gregtechceu.gtceu.api.capability.ICoverable; import com.gregtechceu.gtceu.api.cover.CoverDefinition; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import javax.annotation.ParametersAreNonnullByDefault; - @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class ActivityDetectorCover extends DetectorCover { + public ActivityDetectorCover(CoverDefinition definition, ICoverable coverHolder, Direction attachedSide) { super(definition, coverHolder, attachedSide); } diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/detector/AdvancedActivityDetectorCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/detector/AdvancedActivityDetectorCover.java index a3f1a99a11..415ba2eeca 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/detector/AdvancedActivityDetectorCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/detector/AdvancedActivityDetectorCover.java @@ -4,15 +4,16 @@ import com.gregtechceu.gtceu.api.capability.ICoverable; import com.gregtechceu.gtceu.api.cover.CoverDefinition; import com.gregtechceu.gtceu.utils.RedstoneUtil; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import javax.annotation.ParametersAreNonnullByDefault; - @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class AdvancedActivityDetectorCover extends ActivityDetectorCover { + public AdvancedActivityDetectorCover(CoverDefinition definition, ICoverable coverHolder, Direction attachedSide) { super(definition, coverHolder, attachedSide); } @@ -26,9 +27,10 @@ protected void update() { if (workable == null || workable.getMaxProgress() == 0) return; - int outputAmount = RedstoneUtil.computeRedstoneValue(workable.getProgress(), workable.getMaxProgress(), isInverted()); + int outputAmount = RedstoneUtil.computeRedstoneValue(workable.getProgress(), workable.getMaxProgress(), + isInverted()); - //nonstandard logic for handling off state + // nonstandard logic for handling off state if (!workable.isWorkingEnabled() || !workable.isActive()) outputAmount = 0; diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/detector/AdvancedEnergyDetectorCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/detector/AdvancedEnergyDetectorCover.java index 2000c74f3b..8f7e8f2939 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/detector/AdvancedEnergyDetectorCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/detector/AdvancedEnergyDetectorCover.java @@ -10,6 +10,7 @@ import com.gregtechceu.gtceu.data.lang.LangHandler; import com.gregtechceu.gtceu.utils.GTMath; import com.gregtechceu.gtceu.utils.RedstoneUtil; + import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.gui.widget.LabelWidget; import com.lowdragmc.lowdraglib.gui.widget.TextBoxWidget; @@ -18,29 +19,39 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; import com.lowdragmc.lowdraglib.utils.LocalizationUtils; -import lombok.Getter; -import lombok.Setter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; -import javax.annotation.ParametersAreNonnullByDefault; +import lombok.Getter; +import lombok.Setter; + import java.util.List; +import javax.annotation.ParametersAreNonnullByDefault; + @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class AdvancedEnergyDetectorCover extends EnergyDetectorCover implements IUICover { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(AdvancedEnergyDetectorCover.class, DetectorCover.MANAGED_FIELD_HOLDER); + + public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( + AdvancedEnergyDetectorCover.class, DetectorCover.MANAGED_FIELD_HOLDER); @Override public ManagedFieldHolder getFieldHolder() { return MANAGED_FIELD_HOLDER; } - @Persisted @Getter @Setter + @Persisted + @Getter + @Setter public long minValue, maxValue; - @Persisted @Getter @Setter + @Persisted + @Getter + @Setter private int outputAmount; - @Persisted @Getter + @Persisted + @Getter private boolean usePercent; private LongInputWidget minValueInput; @@ -75,12 +86,14 @@ protected void update() { if (usePercent) { if (capacity > 0) { float ratio = (float) stored / capacity; - this.outputAmount = RedstoneUtil.computeLatchedRedstoneBetweenValues(ratio * 100, this.maxValue, this.minValue, isInverted(), this.outputAmount); + this.outputAmount = RedstoneUtil.computeLatchedRedstoneBetweenValues(ratio * 100, this.maxValue, + this.minValue, isInverted(), this.outputAmount); } else { this.outputAmount = isInverted() ? 0 : 15; } } else { - this.outputAmount = RedstoneUtil.computeLatchedRedstoneBetweenValues(stored, this.maxValue, this.minValue, isInverted(), this.outputAmount); + this.outputAmount = RedstoneUtil.computeLatchedRedstoneBetweenValues(stored, this.maxValue, this.minValue, + isInverted(), this.outputAmount); } setRedstoneSignalOutput(outputAmount); } @@ -92,9 +105,8 @@ public void setUsePercent(boolean usePercent) { initializeMinMaxInputs(wasPercent); } - ////////////////////////////////////// - //*********** GUI ***********// + // *********** GUI ***********// ////////////////////////////////////// @Override @@ -114,33 +126,30 @@ public Widget createUIWidget() { group.addWidget(minValueInput); group.addWidget(maxValueInput); - // Invert Redstone Output Toggle: group.addWidget(new ToggleButtonWidget( 9, 20, 20, 20, - GuiTextures.INVERT_REDSTONE_BUTTON, this::isInverted, this::setInverted - ) { + GuiTextures.INVERT_REDSTONE_BUTTON, this::isInverted, this::setInverted) { + @Override public void updateScreen() { super.updateScreen(); setHoverTooltips(List.copyOf(LangHandler.getMultiLang( - "cover.advanced_energy_detector.invert." + (isPressed ? "enabled" : "disabled") - ))); + "cover.advanced_energy_detector.invert." + (isPressed ? "enabled" : "disabled")))); } }); // Mode (EU / Percent) Toggle: group.addWidget(new ToggleButtonWidget( 176 - 29, 20, 20, 20, - GuiTextures.ENERGY_DETECTOR_COVER_MODE_BUTTON, this::isUsePercent, this::setUsePercent - ) { + GuiTextures.ENERGY_DETECTOR_COVER_MODE_BUTTON, this::isUsePercent, this::setUsePercent) { + @Override public void updateScreen() { super.updateScreen(); setHoverTooltips(List.copyOf(LangHandler.getMultiLang( - "cover.advanced_energy_detector.use_percent." + (isPressed ? "enabled" : "disabled") - ))); + "cover.advanced_energy_detector.use_percent." + (isPressed ? "enabled" : "disabled")))); } }); diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/detector/AdvancedFluidDetectorCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/detector/AdvancedFluidDetectorCover.java index 724751b96e..7639696228 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/detector/AdvancedFluidDetectorCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/detector/AdvancedFluidDetectorCover.java @@ -12,6 +12,7 @@ import com.gregtechceu.gtceu.data.lang.LangHandler; import com.gregtechceu.gtceu.utils.GTMath; import com.gregtechceu.gtceu.utils.RedstoneUtil; + import com.lowdragmc.lowdraglib.gui.widget.LabelWidget; import com.lowdragmc.lowdraglib.gui.widget.TextBoxWidget; import com.lowdragmc.lowdraglib.gui.widget.Widget; @@ -22,32 +23,39 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; import com.lowdragmc.lowdraglib.utils.LocalizationUtils; -import lombok.Getter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.world.item.ItemStack; -import javax.annotation.ParametersAreNonnullByDefault; +import lombok.Getter; + import java.util.List; +import javax.annotation.ParametersAreNonnullByDefault; + @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class AdvancedFluidDetectorCover extends FluidDetectorCover implements IUICover { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(AdvancedFluidDetectorCover.class, DetectorCover.MANAGED_FIELD_HOLDER); + + public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( + AdvancedFluidDetectorCover.class, DetectorCover.MANAGED_FIELD_HOLDER); @Override public ManagedFieldHolder getFieldHolder() { return MANAGED_FIELD_HOLDER; } - private static final int DEFAULT_MIN = 64; private static final int DEFAULT_MAX = 512; - @Persisted @Getter + @Persisted + @Getter private long minValue, maxValue; - @Persisted @DescSynced @Getter + @Persisted + @DescSynced + @Getter protected final FilterHandler filterHandler; public AdvancedFluidDetectorCover(CoverDefinition definition, ICoverable coverHolder, Direction attachedSide) { @@ -87,7 +95,8 @@ protected void update() { storedFluid += content.getAmount(); } - setRedstoneSignalOutput(RedstoneUtil.computeRedstoneBetweenValues(storedFluid, maxValue, minValue, this.isInverted())); + setRedstoneSignalOutput( + RedstoneUtil.computeRedstoneBetweenValues(storedFluid, maxValue, minValue, this.isInverted())); } public void setMinValue(long minValue) { @@ -98,9 +107,8 @@ public void setMaxValue(long maxValue) { this.maxValue = Math.max(maxValue, 0); } - ////////////////////////////////////// - //*********** GUI ***********// + // *********** GUI ***********// ////////////////////////////////////// @Override @@ -117,18 +125,16 @@ public Widget createUIWidget() { group.addWidget(new LongInputWidget(80, 50, 176 - 80 - 10, 20, this::getMinValue, this::setMinValue)); group.addWidget(new LongInputWidget(80, 75, 176 - 80 - 10, 20, this::getMaxValue, this::setMaxValue)); - // Invert Redstone Output Toggle: group.addWidget(new ToggleButtonWidget( 9, 20, 20, 20, - GuiTextures.INVERT_REDSTONE_BUTTON, this::isInverted, this::setInverted - ) { + GuiTextures.INVERT_REDSTONE_BUTTON, this::isInverted, this::setInverted) { + @Override public void updateScreen() { super.updateScreen(); setHoverTooltips(List.copyOf(LangHandler.getMultiLang( - "cover.advanced_fluid_detector.invert." + (isPressed ? "enabled" : "disabled") - ))); + "cover.advanced_fluid_detector.invert." + (isPressed ? "enabled" : "disabled")))); } }); diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/detector/AdvancedItemDetectorCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/detector/AdvancedItemDetectorCover.java index 48822094d2..b4bc1f6944 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/detector/AdvancedItemDetectorCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/detector/AdvancedItemDetectorCover.java @@ -11,6 +11,7 @@ import com.gregtechceu.gtceu.api.gui.widget.ToggleButtonWidget; import com.gregtechceu.gtceu.data.lang.LangHandler; import com.gregtechceu.gtceu.utils.RedstoneUtil; + import com.lowdragmc.lowdraglib.gui.widget.LabelWidget; import com.lowdragmc.lowdraglib.gui.widget.TextBoxWidget; import com.lowdragmc.lowdraglib.gui.widget.Widget; @@ -20,33 +21,40 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; import com.lowdragmc.lowdraglib.utils.LocalizationUtils; -import lombok.Getter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.util.Mth; import net.minecraft.world.item.ItemStack; -import javax.annotation.ParametersAreNonnullByDefault; +import lombok.Getter; + import java.util.List; +import javax.annotation.ParametersAreNonnullByDefault; + @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class AdvancedItemDetectorCover extends ItemDetectorCover implements IUICover { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(AdvancedItemDetectorCover.class, DetectorCover.MANAGED_FIELD_HOLDER); + + public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( + AdvancedItemDetectorCover.class, DetectorCover.MANAGED_FIELD_HOLDER); @Override public ManagedFieldHolder getFieldHolder() { return MANAGED_FIELD_HOLDER; } - private static final int DEFAULT_MIN = 64; private static final int DEFAULT_MAX = 512; - @Persisted @Getter + @Persisted + @Getter private int minValue, maxValue; - @Persisted @DescSynced @Getter + @Persisted + @DescSynced + @Getter protected final FilterHandler filterHandler; public AdvancedItemDetectorCover(CoverDefinition definition, ICoverable coverHolder, Direction attachedSide) { @@ -84,7 +92,8 @@ protected void update() { storedItems += itemTransfer.getStackInSlot(i).getCount(); } - setRedstoneSignalOutput(RedstoneUtil.computeRedstoneBetweenValues(storedItems, maxValue, minValue, isInverted())); + setRedstoneSignalOutput( + RedstoneUtil.computeRedstoneBetweenValues(storedItems, maxValue, minValue, isInverted())); } public void setMinValue(int minValue) { @@ -95,9 +104,8 @@ public void setMaxValue(int maxValue) { this.maxValue = Math.max(maxValue, 0); } - ////////////////////////////////////// - //*********** GUI ***********// + // *********** GUI ***********// ////////////////////////////////////// @Override @@ -114,22 +122,19 @@ public Widget createUIWidget() { group.addWidget(new IntInputWidget(80, 50, 176 - 80 - 10, 20, this::getMinValue, this::setMinValue)); group.addWidget(new IntInputWidget(80, 75, 176 - 80 - 10, 20, this::getMaxValue, this::setMaxValue)); - // Invert Redstone Output Toggle: group.addWidget(new ToggleButtonWidget( 9, 20, 20, 20, - GuiTextures.INVERT_REDSTONE_BUTTON, this::isInverted, this::setInverted - ) { + GuiTextures.INVERT_REDSTONE_BUTTON, this::isInverted, this::setInverted) { + @Override public void updateScreen() { super.updateScreen(); setHoverTooltips(List.copyOf(LangHandler.getMultiLang( - "cover.advanced_item_detector.invert." + (isPressed ? "enabled" : "disabled") - ))); + "cover.advanced_item_detector.invert." + (isPressed ? "enabled" : "disabled")))); } }); - // Item Filter UI: group.addWidget(filterHandler.createFilterSlotUI(148, 100)); group.addWidget(filterHandler.createFilterConfigUI(10, 100, 156, 60)); diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/detector/DetectorCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/detector/DetectorCover.java index cc6790d774..c30ef9b1fc 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/detector/DetectorCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/detector/DetectorCover.java @@ -5,11 +5,11 @@ import com.gregtechceu.gtceu.api.cover.CoverBehavior; import com.gregtechceu.gtceu.api.cover.CoverDefinition; import com.gregtechceu.gtceu.api.machine.TickableSubscription; + import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import lombok.Getter; -import lombok.Setter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.network.chat.Component; @@ -18,24 +18,33 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.phys.BlockHitResult; +import lombok.Getter; +import lombok.Setter; + import javax.annotation.ParametersAreNonnullByDefault; @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public abstract class DetectorCover extends CoverBehavior implements IControllable { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(DetectorCover.class, CoverBehavior.MANAGED_FIELD_HOLDER); + + public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(DetectorCover.class, + CoverBehavior.MANAGED_FIELD_HOLDER); @Override public ManagedFieldHolder getFieldHolder() { return MANAGED_FIELD_HOLDER; } - - @Persisted @Getter @Setter + @Persisted + @Getter + @Setter protected boolean isWorkingEnabled = true; protected TickableSubscription subscription; - @Persisted @DescSynced @Getter @Setter + @Persisted + @DescSynced + @Getter + @Setter private boolean isInverted; public DetectorCover(CoverDefinition definition, ICoverable coverHolder, Direction attachedSide) { @@ -77,9 +86,8 @@ public InteractionResult onScrewdriverClick(Player playerIn, InteractionHand han if (!this.coverHolder.isRemote()) { toggleInvertedWithNotification(); - String translationKey = isInverted() - ? "cover.detector_base.message_inverted_state" - : "cover.detector_base.message_normal_state"; + String translationKey = isInverted() ? "cover.detector_base.message_inverted_state" : + "cover.detector_base.message_normal_state"; playerIn.sendSystemMessage(Component.translatable(translationKey)); } @@ -91,4 +99,3 @@ public boolean canConnectRedstone() { return true; } } - diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/detector/EnergyDetectorCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/detector/EnergyDetectorCover.java index bb65d1afb3..c5334db9f5 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/detector/EnergyDetectorCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/detector/EnergyDetectorCover.java @@ -5,10 +5,13 @@ import com.gregtechceu.gtceu.api.capability.IEnergyInfoProvider; import com.gregtechceu.gtceu.api.cover.CoverDefinition; import com.gregtechceu.gtceu.utils.RedstoneUtil; + import net.minecraft.core.Direction; + import org.jetbrains.annotations.Nullable; public class EnergyDetectorCover extends DetectorCover { + public EnergyDetectorCover(CoverDefinition definition, ICoverable coverHolder, Direction attachedSide) { super(definition, coverHolder, attachedSide); } diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/detector/FluidDetectorCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/detector/FluidDetectorCover.java index 6723d2838f..de79297413 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/detector/FluidDetectorCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/detector/FluidDetectorCover.java @@ -3,12 +3,15 @@ import com.gregtechceu.gtceu.api.capability.ICoverable; import com.gregtechceu.gtceu.api.cover.CoverDefinition; import com.gregtechceu.gtceu.utils.RedstoneUtil; + import com.lowdragmc.lowdraglib.side.fluid.FluidStack; import com.lowdragmc.lowdraglib.side.fluid.FluidTransferHelper; import com.lowdragmc.lowdraglib.side.fluid.IFluidTransfer; + import net.minecraft.core.Direction; public class FluidDetectorCover extends DetectorCover { + public FluidDetectorCover(CoverDefinition definition, ICoverable coverHolder, Direction attachedSide) { super(definition, coverHolder, attachedSide); } diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/detector/ItemDetectorCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/detector/ItemDetectorCover.java index 7f71edca63..f9bb515262 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/detector/ItemDetectorCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/detector/ItemDetectorCover.java @@ -3,11 +3,14 @@ import com.gregtechceu.gtceu.api.capability.ICoverable; import com.gregtechceu.gtceu.api.cover.CoverDefinition; import com.gregtechceu.gtceu.utils.RedstoneUtil; + import com.lowdragmc.lowdraglib.side.item.IItemTransfer; import com.lowdragmc.lowdraglib.side.item.ItemTransferHelper; + import net.minecraft.core.Direction; public class ItemDetectorCover extends DetectorCover { + public ItemDetectorCover(CoverDefinition definition, ICoverable coverHolder, Direction attachedSide) { super(definition, coverHolder, attachedSide); } diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/detector/MaintenanceDetectorCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/detector/MaintenanceDetectorCover.java index 395dee2f22..ad5ba24c7c 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/detector/MaintenanceDetectorCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/detector/MaintenanceDetectorCover.java @@ -5,9 +5,11 @@ import com.gregtechceu.gtceu.api.cover.CoverDefinition; import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMaintenanceMachine; import com.gregtechceu.gtceu.config.ConfigHolder; + import net.minecraft.core.Direction; public class MaintenanceDetectorCover extends DetectorCover { + public MaintenanceDetectorCover(CoverDefinition definition, ICoverable coverHolder, Direction attachedSide) { super(definition, coverHolder, attachedSide); } @@ -18,7 +20,8 @@ public boolean canAttach() { return false; } - return GTCapabilityHelper.getMaintenanceMachine(coverHolder.getLevel(), coverHolder.getPos(), attachedSide) != null; + return GTCapabilityHelper.getMaintenanceMachine(coverHolder.getLevel(), coverHolder.getPos(), attachedSide) != + null; } @Override @@ -27,7 +30,8 @@ protected void update() { return; } - IMaintenanceMachine maintenance = GTCapabilityHelper.getMaintenanceMachine(coverHolder.getLevel(), coverHolder.getPos(), attachedSide); + IMaintenanceMachine maintenance = GTCapabilityHelper.getMaintenanceMachine(coverHolder.getLevel(), + coverHolder.getPos(), attachedSide); int signal = getRedstoneSignalOutput(); boolean shouldSignal = isInverted() != maintenance.hasMaintenanceProblems(); diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/voiding/AdvancedFluidVoidingCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/voiding/AdvancedFluidVoidingCover.java index 35a0490b1e..e81047e923 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/voiding/AdvancedFluidVoidingCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/voiding/AdvancedFluidVoidingCover.java @@ -9,29 +9,40 @@ import com.gregtechceu.gtceu.api.gui.widget.NumberInputWidget; import com.gregtechceu.gtceu.common.cover.data.BucketMode; import com.gregtechceu.gtceu.common.cover.data.VoidingMode; + import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.side.fluid.FluidStack; import com.lowdragmc.lowdraglib.side.fluid.IFluidTransfer; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import lombok.Getter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; + +import lombok.Getter; import org.jetbrains.annotations.NotNull; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.Map; +import javax.annotation.ParametersAreNonnullByDefault; + @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault public class AdvancedFluidVoidingCover extends FluidVoidingCover { - @Persisted @DescSynced @Getter + + @Persisted + @DescSynced + @Getter private VoidingMode voidingMode = VoidingMode.VOID_ANY; - @Persisted @DescSynced @Getter + @Persisted + @DescSynced + @Getter protected long globalTransferSizeMillibuckets = 1L; - @Persisted @DescSynced @Getter + @Persisted + @DescSynced + @Getter private BucketMode transferBucketMode = BucketMode.MILLI_BUCKET; private NumberInputWidget stackSizeInput; @@ -41,9 +52,8 @@ public AdvancedFluidVoidingCover(CoverDefinition definition, ICoverable coverHol super(definition, coverHolder, attachedSide); } - ////////////////////////////////////////////// - //*********** COVER LOGIC ***********// + // *********** COVER LOGIC ***********// ////////////////////////////////////////////// @Override @@ -99,14 +109,12 @@ private void setTransferBucketMode(BucketMode transferBucketMode) { this.transferBucketMode = transferBucketMode; - if (stackSizeInput == null) return; stackSizeInput.setValue(getCurrentBucketModeTransferSize()); } - ////////////////////////////////////// - //*********** GUI ***********// + // *********** GUI ***********// ////////////////////////////////////// @Override @@ -116,15 +124,17 @@ private void setTransferBucketMode(BucketMode transferBucketMode) { @Override protected void buildAdditionalUI(WidgetGroup group) { - group.addWidget(new EnumSelectorWidget<>(146, 20, 20, 20, VoidingMode.values(), voidingMode, this::setVoidingMode)); + group.addWidget( + new EnumSelectorWidget<>(146, 20, 20, 20, VoidingMode.values(), voidingMode, this::setVoidingMode)); this.stackSizeInput = new LongInputWidget(35, 20, 84, 20, - this::getCurrentBucketModeTransferSize, this::setCurrentBucketModeTransferSize - ).setMin(1L).setMax(Long.MAX_VALUE); + this::getCurrentBucketModeTransferSize, this::setCurrentBucketModeTransferSize).setMin(1L) + .setMax(Long.MAX_VALUE); configureStackSizeInput(); group.addWidget(this.stackSizeInput); - this.stackSizeBucketModeInput = new EnumSelectorWidget<>(121, 20, 20, 20, BucketMode.values(), transferBucketMode, this::setTransferBucketMode); + this.stackSizeBucketModeInput = new EnumSelectorWidget<>(121, 20, 20, 20, BucketMode.values(), + transferBucketMode, this::setTransferBucketMode); group.addWidget(this.stackSizeBucketModeInput); } @@ -162,12 +172,14 @@ private boolean shouldShowStackSize() { return this.filterHandler.getFilter().isBlackList(); } - + ////////////////////////////////////// - //***** LDLib SyncData ******// + // ***** LDLib SyncData ******// ////////////////////////////////////// - - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(AdvancedFluidVoidingCover.class, FluidVoidingCover.MANAGED_FIELD_HOLDER); + + public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( + AdvancedFluidVoidingCover.class, FluidVoidingCover.MANAGED_FIELD_HOLDER); + @Override public ManagedFieldHolder getFieldHolder() { return MANAGED_FIELD_HOLDER; diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/voiding/AdvancedItemVoidingCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/voiding/AdvancedItemVoidingCover.java index 1a7d3ae44a..a7fa86fcb5 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/voiding/AdvancedItemVoidingCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/voiding/AdvancedItemVoidingCover.java @@ -7,27 +7,35 @@ import com.gregtechceu.gtceu.api.gui.widget.EnumSelectorWidget; import com.gregtechceu.gtceu.api.gui.widget.IntInputWidget; import com.gregtechceu.gtceu.common.cover.data.VoidingMode; + import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.side.item.IItemTransfer; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import lombok.Getter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.world.item.ItemStack; + +import lombok.Getter; import org.jetbrains.annotations.NotNull; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.Map; +import javax.annotation.ParametersAreNonnullByDefault; + @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault public class AdvancedItemVoidingCover extends ItemVoidingCover { - @Persisted @DescSynced @Getter + + @Persisted + @DescSynced + @Getter private VoidingMode voidingMode = VoidingMode.VOID_ANY; - @Persisted @Getter + @Persisted + @Getter protected int globalVoidingLimit = 1; private IntInputWidget stackSizeInput; @@ -36,9 +44,8 @@ public AdvancedItemVoidingCover(CoverDefinition definition, ICoverable coverHold super(definition, coverHolder, attachedSide); } - ////////////////////////////////////////////// - //*********** COVER LOGIC ***********// + // *********** COVER LOGIC ***********// ////////////////////////////////////////////// @Override @@ -98,9 +105,8 @@ public void setVoidingMode(VoidingMode voidingMode) { } } - ////////////////////////////////////// - //*********** GUI ***********// + // *********** GUI ***********// ////////////////////////////////////// @Override @@ -110,12 +116,11 @@ public void setVoidingMode(VoidingMode voidingMode) { @Override protected void buildAdditionalUI(WidgetGroup group) { - group.addWidget(new EnumSelectorWidget<>(146, 20, 20, 20, VoidingMode.values(), voidingMode, this::setVoidingMode)); - + group.addWidget( + new EnumSelectorWidget<>(146, 20, 20, 20, VoidingMode.values(), voidingMode, this::setVoidingMode)); this.stackSizeInput = new IntInputWidget(64, 20, 80, 20, - () -> globalVoidingLimit, val -> globalVoidingLimit = val - ); + () -> globalVoidingLimit, val -> globalVoidingLimit = val); configureStackSizeInput(); group.addWidget(this.stackSizeInput); @@ -150,10 +155,11 @@ private boolean shouldShowStackSize() { } ////////////////////////////////////// - //***** LDLib SyncData ******// + // ***** LDLib SyncData ******// ////////////////////////////////////// - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(AdvancedItemVoidingCover.class, ItemVoidingCover.MANAGED_FIELD_HOLDER); + public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(AdvancedItemVoidingCover.class, + ItemVoidingCover.MANAGED_FIELD_HOLDER); @Override public ManagedFieldHolder getFieldHolder() { diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/voiding/FluidVoidingCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/voiding/FluidVoidingCover.java index 166f824e7a..26374ffa1b 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/voiding/FluidVoidingCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/voiding/FluidVoidingCover.java @@ -5,6 +5,7 @@ import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.api.gui.widget.ToggleButtonWidget; import com.gregtechceu.gtceu.common.cover.PumpCover; + import com.lowdragmc.lowdraglib.gui.widget.LabelWidget; import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; @@ -12,18 +13,23 @@ import com.lowdragmc.lowdraglib.side.fluid.IFluidTransfer; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import lombok.Getter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; + +import lombok.Getter; import org.jetbrains.annotations.NotNull; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.Map; +import javax.annotation.ParametersAreNonnullByDefault; + @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault public class FluidVoidingCover extends PumpCover { - @Persisted @Getter + + @Persisted + @Getter protected boolean isEnabled = false; public FluidVoidingCover(CoverDefinition definition, ICoverable coverHolder, Direction attachedSide) { @@ -36,7 +42,7 @@ protected boolean isSubscriptionActive() { } ////////////////////////////////////////////// - //*********** COVER LOGIC ***********// + // *********** COVER LOGIC ***********// ////////////////////////////////////////////// @Override @@ -81,7 +87,7 @@ public void setEnabled(boolean enabled) { } ////////////////////////////////////// - //*********** GUI ***********// + // *********** GUI ***********// ////////////////////////////////////// @Override @@ -92,7 +98,7 @@ public Widget createUIWidget() { group.addWidget(new ToggleButtonWidget(10, 20, 20, 20, GuiTextures.BUTTON_POWER, this::isEnabled, this::setEnabled)); - //group.addWidget(filterHandler.createFilterSlotUI(36, 21)); + // group.addWidget(filterHandler.createFilterSlotUI(36, 21)); group.addWidget(filterHandler.createFilterSlotUI(148, 91)); group.addWidget(filterHandler.createFilterConfigUI(10, 50, 126, 60)); @@ -115,10 +121,11 @@ protected void configureFilter() { } ////////////////////////////////////// - //***** LDLib SyncData ******// + // ***** LDLib SyncData ******// ////////////////////////////////////// - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(FluidVoidingCover.class, PumpCover.MANAGED_FIELD_HOLDER); + public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(FluidVoidingCover.class, + PumpCover.MANAGED_FIELD_HOLDER); @Override public ManagedFieldHolder getFieldHolder() { diff --git a/src/main/java/com/gregtechceu/gtceu/common/cover/voiding/ItemVoidingCover.java b/src/main/java/com/gregtechceu/gtceu/common/cover/voiding/ItemVoidingCover.java index 5554f9ef19..f5b6b6084a 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/cover/voiding/ItemVoidingCover.java +++ b/src/main/java/com/gregtechceu/gtceu/common/cover/voiding/ItemVoidingCover.java @@ -8,16 +8,19 @@ import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.api.gui.widget.ToggleButtonWidget; import com.gregtechceu.gtceu.common.cover.ConveyorCover; + import com.lowdragmc.lowdraglib.gui.widget.LabelWidget; import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.side.item.IItemTransfer; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import lombok.Getter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.world.item.ItemStack; + +import lombok.Getter; import org.jetbrains.annotations.NotNull; import javax.annotation.ParametersAreNonnullByDefault; @@ -25,7 +28,9 @@ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class ItemVoidingCover extends ConveyorCover implements IUICover, IControllable { - @Persisted @Getter + + @Persisted + @Getter protected boolean isEnabled = false; public ItemVoidingCover(CoverDefinition definition, ICoverable coverHolder, Direction attachedSide) { @@ -38,7 +43,7 @@ protected boolean isSubscriptionActive() { } ////////////////////////////////////////////// - //*********** COVER LOGIC ***********// + // *********** COVER LOGIC ***********// ////////////////////////////////////////////// @Override @@ -81,7 +86,7 @@ public void setEnabled(boolean enabled) { } ////////////////////////////////////// - //*********** GUI ***********// + // *********** GUI ***********// ////////////////////////////////////// @Override @@ -92,7 +97,7 @@ public Widget createUIWidget() { group.addWidget(new ToggleButtonWidget(10, 20, 20, 20, GuiTextures.BUTTON_POWER, this::isEnabled, this::setEnabled)); - //group.addWidget(filterHandler.createFilterSlotUI(36, 21)); + // group.addWidget(filterHandler.createFilterSlotUI(36, 21)); group.addWidget(filterHandler.createFilterSlotUI(148, 91)); group.addWidget(filterHandler.createFilterConfigUI(10, 50, 126, 60)); @@ -115,10 +120,12 @@ protected void configureFilter() { } ////////////////////////////////////// - //***** LDLib SyncData ******// + // ***** LDLib SyncData ******// ////////////////////////////////////// - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(ItemVoidingCover.class, ConveyorCover.MANAGED_FIELD_HOLDER); + public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(ItemVoidingCover.class, + ConveyorCover.MANAGED_FIELD_HOLDER); + @Override public ManagedFieldHolder getFieldHolder() { return MANAGED_FIELD_HOLDER; diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GCyMBlocks.java b/src/main/java/com/gregtechceu/gtceu/common/data/GCyMBlocks.java index 2f8b9fbacc..fd5e9035dd 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GCyMBlocks.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GCyMBlocks.java @@ -2,34 +2,52 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.block.ActiveBlock; -import com.tterrag.registrate.util.entry.BlockEntry; + import net.minecraft.world.level.block.Block; +import com.tterrag.registrate.util.entry.BlockEntry; + import static com.gregtechceu.gtceu.common.data.GTBlocks.createActiveCasing; import static com.gregtechceu.gtceu.common.data.GTBlocks.createCasingBlock; public class GCyMBlocks { - public static void init() { - } - - public static final BlockEntry CASING_NONCONDUCTING = createCasingBlock("nonconducting_casing", GTCEu.id("block/casings/gcym/nonconducting_casing")); - public static final BlockEntry CASING_VIBRATION_SAFE = createCasingBlock("vibration_safe_casing", GTCEu.id("block/casings/gcym/vibration_safe_casing")); - public static final BlockEntry CASING_WATERTIGHT = createCasingBlock("watertight_casing", GTCEu.id("block/casings/gcym/watertight_casing")); - public static final BlockEntry CASING_SECURE_MACERATION = createCasingBlock("secure_maceration_casing", GTCEu.id("block/casings/gcym/secure_maceration_casing")); - public static final BlockEntry CASING_HIGH_TEMPERATURE_SMELTING = createCasingBlock("high_temperature_smelting_casing", GTCEu.id("block/casings/gcym/high_temperature_smelting_casing")); - public static final BlockEntry CASING_LASER_SAFE_ENGRAVING = createCasingBlock("laser_safe_engraving_casing", GTCEu.id("block/casings/gcym/laser_safe_engraving_casing")); - public static final BlockEntry CASING_LARGE_SCALE_ASSEMBLING = createCasingBlock("large_scale_assembler_casing", GTCEu.id("block/casings/gcym/large_scale_assembling_casing")); - public static final BlockEntry CASING_SHOCK_PROOF = createCasingBlock("shock_proof_cutting_casing", GTCEu.id("block/casings/gcym/shock_proof_cutting_casing")); - public static final BlockEntry CASING_STRESS_PROOF = createCasingBlock("stress_proof_casing", GTCEu.id("block/casings/gcym/stress_proof_casing")); - public static final BlockEntry CASING_CORROSION_PROOF = createCasingBlock("corrosion_proof_casing", GTCEu.id("block/casings/gcym/corrosion_proof_casing")); - public static final BlockEntry CASING_REACTION_SAFE = createCasingBlock("reaction_safe_mixing_casing", GTCEu.id("block/casings/gcym/reaction_safe_mixing_casing")); - public static final BlockEntry CASING_ATOMIC = createCasingBlock("atomic_casing", GTCEu.id("block/casings/gcym/atomic_casing")); - public static final BlockEntry CASING_INDUSTRIAL_STEAM = createCasingBlock("industrial_steam_casing", GTCEu.id("block/casings/gcym/industrial_steam_casing")); - - public static final BlockEntry SLICING_BLADES = createActiveCasing("slicing_blades", "block/variant/slicing_blades"); - public static final BlockEntry MOLYBDENUM_DISILICIDE_COIL_BLOCK = createActiveCasing("molybdenum_disilicide_coil_block", "block/variant/molybdenum_disilicide_coil_block"); - public static final BlockEntry ELECTROLYTIC_CELL = createActiveCasing("electrolytic_cell", "block/variant/electrolytic_cell"); - public static final BlockEntry CRUSHING_WHEELS = createActiveCasing("crushing_wheels", "block/variant/crushing_wheels"); + public static void init() {} + + public static final BlockEntry CASING_NONCONDUCTING = createCasingBlock("nonconducting_casing", + GTCEu.id("block/casings/gcym/nonconducting_casing")); + public static final BlockEntry CASING_VIBRATION_SAFE = createCasingBlock("vibration_safe_casing", + GTCEu.id("block/casings/gcym/vibration_safe_casing")); + public static final BlockEntry CASING_WATERTIGHT = createCasingBlock("watertight_casing", + GTCEu.id("block/casings/gcym/watertight_casing")); + public static final BlockEntry CASING_SECURE_MACERATION = createCasingBlock("secure_maceration_casing", + GTCEu.id("block/casings/gcym/secure_maceration_casing")); + public static final BlockEntry CASING_HIGH_TEMPERATURE_SMELTING = createCasingBlock( + "high_temperature_smelting_casing", GTCEu.id("block/casings/gcym/high_temperature_smelting_casing")); + public static final BlockEntry CASING_LASER_SAFE_ENGRAVING = createCasingBlock("laser_safe_engraving_casing", + GTCEu.id("block/casings/gcym/laser_safe_engraving_casing")); + public static final BlockEntry CASING_LARGE_SCALE_ASSEMBLING = createCasingBlock( + "large_scale_assembler_casing", GTCEu.id("block/casings/gcym/large_scale_assembling_casing")); + public static final BlockEntry CASING_SHOCK_PROOF = createCasingBlock("shock_proof_cutting_casing", + GTCEu.id("block/casings/gcym/shock_proof_cutting_casing")); + public static final BlockEntry CASING_STRESS_PROOF = createCasingBlock("stress_proof_casing", + GTCEu.id("block/casings/gcym/stress_proof_casing")); + public static final BlockEntry CASING_CORROSION_PROOF = createCasingBlock("corrosion_proof_casing", + GTCEu.id("block/casings/gcym/corrosion_proof_casing")); + public static final BlockEntry CASING_REACTION_SAFE = createCasingBlock("reaction_safe_mixing_casing", + GTCEu.id("block/casings/gcym/reaction_safe_mixing_casing")); + public static final BlockEntry CASING_ATOMIC = createCasingBlock("atomic_casing", + GTCEu.id("block/casings/gcym/atomic_casing")); + public static final BlockEntry CASING_INDUSTRIAL_STEAM = createCasingBlock("industrial_steam_casing", + GTCEu.id("block/casings/gcym/industrial_steam_casing")); + + public static final BlockEntry SLICING_BLADES = createActiveCasing("slicing_blades", + "block/variant/slicing_blades"); + public static final BlockEntry MOLYBDENUM_DISILICIDE_COIL_BLOCK = createActiveCasing( + "molybdenum_disilicide_coil_block", "block/variant/molybdenum_disilicide_coil_block"); + public static final BlockEntry ELECTROLYTIC_CELL = createActiveCasing("electrolytic_cell", + "block/variant/electrolytic_cell"); + public static final BlockEntry CRUSHING_WHEELS = createActiveCasing("crushing_wheels", + "block/variant/crushing_wheels"); public static final BlockEntry HEAT_VENT = createActiveCasing("heat_vent", "block/variant/heat_vent"); } diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GCyMRecipeTypes.java b/src/main/java/com/gregtechceu/gtceu/common/data/GCyMRecipeTypes.java index cc0eb8e4d3..e605772822 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GCyMRecipeTypes.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GCyMRecipeTypes.java @@ -6,9 +6,11 @@ import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.api.recipe.GTRecipeType; import com.gregtechceu.gtceu.utils.FormattingUtil; + import com.lowdragmc.lowdraglib.gui.widget.SlotWidget; import com.lowdragmc.lowdraglib.utils.CycleItemStackHandler; import com.lowdragmc.lowdraglib.utils.LocalizationUtils; + import net.minecraft.client.resources.language.I18n; import net.minecraft.world.item.ItemStack; @@ -26,9 +28,10 @@ public class GCyMRecipeTypes { ////////////////////////////////////// - //******* Multiblock *******// + // ******* Multiblock *******// ////////////////////////////////////// - public final static GTRecipeType ALLOY_BLAST_RECIPES = register("alloy_blast_smelter", MULTIBLOCK).setMaxIOSize(9, 0, 3, 1) + public final static GTRecipeType ALLOY_BLAST_RECIPES = register("alloy_blast_smelter", MULTIBLOCK) + .setMaxIOSize(9, 0, 3, 1) .setEUIO(IO.IN) .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, LEFT_TO_RIGHT) .setSlotOverlay(false, false, false, GuiTextures.FURNACE_OVERLAY_1) @@ -38,28 +41,30 @@ public class GCyMRecipeTypes { .setSlotOverlay(true, true, false, GuiTextures.FURNACE_OVERLAY_2) .setSlotOverlay(true, true, true, GuiTextures.FURNACE_OVERLAY_2) .addDataInfo(data -> { - int temp = data.getInt("ebf_temp"); - return LocalizationUtils.format("gtceu.recipe.temperature", FormattingUtil.formatNumbers(temp)); + int temp = data.getInt("ebf_temp"); + return LocalizationUtils.format("gtceu.recipe.temperature", FormattingUtil.formatNumbers(temp)); }) .addDataInfo(data -> { int temp = data.getInt("ebf_temp"); ICoilType requiredCoil = ICoilType.getMinRequiredType(temp); if (requiredCoil != null && requiredCoil.getMaterial() != null) { - return LocalizationUtils.format("gtceu.recipe.coil.tier", I18n.get(requiredCoil.getMaterial().getUnlocalizedName())); - } + return LocalizationUtils.format("gtceu.recipe.coil.tier", + I18n.get(requiredCoil.getMaterial().getUnlocalizedName())); + } return ""; }) .setMaxTooltips(4) .setUiBuilder((recipe, widgetGroup) -> { int temp = recipe.data.getInt("ebf_temp"); List> items = new ArrayList<>(); - items.add(GTCEuAPI.HEATING_COILS.entrySet().stream().filter(coil -> coil.getKey().getCoilTemperature() >= temp).map(coil -> new ItemStack(coil.getValue().get())).toList()); - widgetGroup.addWidget(new SlotWidget(new CycleItemStackHandler(items), 0, widgetGroup.getSize().width - 25, widgetGroup.getSize().height - 40, false, false)); + items.add(GTCEuAPI.HEATING_COILS.entrySet().stream() + .filter(coil -> coil.getKey().getCoilTemperature() >= temp) + .map(coil -> new ItemStack(coil.getValue().get())).toList()); + widgetGroup.addWidget(new SlotWidget(new CycleItemStackHandler(items), 0, + widgetGroup.getSize().width - 25, widgetGroup.getSize().height - 40, false, false)); }) .setSound(GTSoundEntries.ARC); - public static void init() { - - } + public static void init() {} } diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTBedrockFluids.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTBedrockFluids.java index 0c90f87125..a7e622a6b1 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTBedrockFluids.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTBedrockFluids.java @@ -1,19 +1,15 @@ package com.gregtechceu.gtceu.common.data; import com.gregtechceu.gtceu.GTCEu; -import com.gregtechceu.gtceu.api.data.worldgen.GTOreDefinition; import com.gregtechceu.gtceu.api.data.worldgen.bedrockfluid.BedrockFluidDefinition; import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.data.recipe.CustomTags; -import net.minecraft.core.HolderSet; -import net.minecraft.core.registries.Registries; + import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.BiomeTags; import net.minecraft.world.level.Level; import net.minecraft.world.level.biome.Biomes; -import net.minecraft.world.level.dimension.BuiltinDimensionTypes; -import net.minecraft.world.level.dimension.DimensionType; import java.util.HashMap; import java.util.Map; @@ -25,11 +21,11 @@ * @implNote GTBedrockFluids */ public class GTBedrockFluids { - public static final Map toReRegister = new HashMap<>(); + public static final Map toReRegister = new HashMap<>(); ////////////////////////////////////// - //******** OVERWORLD ********// + // ******** OVERWORLD ********// ////////////////////////////////////// public static BedrockFluidDefinition HEAVY_OIL = BedrockFluidDefinition.builder(GTCEu.id("heavy_oil_deposit")) .fluid(GTMaterials.OilHeavy::getFluid) @@ -98,7 +94,7 @@ public class GTBedrockFluids { .register(); ////////////////////////////////////// - //******** NETHER ********// + // ******** NETHER ********// ////////////////////////////////////// public static BedrockFluidDefinition LAVA = BedrockFluidDefinition.builder(GTCEu.id("lava_deposit")) .fluid(GTMaterials.Lava::getFluid) @@ -110,7 +106,8 @@ public class GTBedrockFluids { .dimensions(nether()) .register(); - public static BedrockFluidDefinition NETHER_NATURAL_GAS = BedrockFluidDefinition.builder(GTCEu.id("nether_natural_gas_deposit")) + public static BedrockFluidDefinition NETHER_NATURAL_GAS = BedrockFluidDefinition + .builder(GTCEu.id("nether_natural_gas_deposit")) .fluid(GTMaterials.NaturalGas::getFluid) .weight(35) .yield(150, 300) @@ -127,6 +124,7 @@ public static void init() { public static Set> nether() { return Set.of(Level.NETHER); } + public static Set> overworld() { return Set.of(Level.OVERWORLD); } diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTBlockEntities.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTBlockEntities.java index 6a25f46890..560d4fcbed 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTBlockEntities.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTBlockEntities.java @@ -1,10 +1,11 @@ package com.gregtechceu.gtceu.common.data; import com.gregtechceu.gtceu.common.blockentity.*; + +import net.minecraft.world.level.block.entity.SignBlockEntity; + import com.tterrag.registrate.util.entry.BlockEntityEntry; import com.tterrag.registrate.util.entry.BlockEntry; -import net.minecraft.world.level.block.entity.HangingSignBlockEntity; -import net.minecraft.world.level.block.entity.SignBlockEntity; import static com.gregtechceu.gtceu.common.registry.GTRegistration.REGISTRATE; @@ -14,6 +15,7 @@ * @implNote GTBlockEntities */ public class GTBlockEntities { + @SuppressWarnings("unchecked") public static final BlockEntityEntry CABLE = REGISTRATE .blockEntity("cable", CableBlockEntity::create) @@ -42,27 +44,25 @@ public class GTBlockEntities { .register(); public static final BlockEntityEntry OPTICAL_PIPE = REGISTRATE - .blockEntity("optical_pipe", OpticalPipeBlockEntity::new) - .validBlocks(GTBlocks.OPTICAL_PIPES) - .register(); + .blockEntity("optical_pipe", OpticalPipeBlockEntity::new) + .validBlocks(GTBlocks.OPTICAL_PIPES) + .register(); public static final BlockEntityEntry GT_SIGN = REGISTRATE - .blockEntity("sign", SignBlockEntity::new) - .validBlocks(GTBlocks.RUBBER_SIGN, - GTBlocks.RUBBER_WALL_SIGN, - GTBlocks.TREATED_WOOD_SIGN, - GTBlocks.TREATED_WOOD_WALL_SIGN) - .register(); + .blockEntity("sign", SignBlockEntity::new) + .validBlocks(GTBlocks.RUBBER_SIGN, + GTBlocks.RUBBER_WALL_SIGN, + GTBlocks.TREATED_WOOD_SIGN, + GTBlocks.TREATED_WOOD_WALL_SIGN) + .register(); public static final BlockEntityEntry GT_HANGING_SIGN = REGISTRATE - .blockEntity("hanging_sign", GTHangingSignBlockEntity::new) - .validBlocks(GTBlocks.RUBBER_HANGING_SIGN, - GTBlocks.RUBBER_WALL_HANGING_SIGN, - GTBlocks.TREATED_WOOD_HANGING_SIGN, - GTBlocks.TREATED_WOOD_WALL_HANGING_SIGN) - .register(); - - public static void init() { + .blockEntity("hanging_sign", GTHangingSignBlockEntity::new) + .validBlocks(GTBlocks.RUBBER_HANGING_SIGN, + GTBlocks.RUBBER_WALL_HANGING_SIGN, + GTBlocks.TREATED_WOOD_HANGING_SIGN, + GTBlocks.TREATED_WOOD_WALL_HANGING_SIGN) + .register(); - } + public static void init() {} } diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTBlocks.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTBlocks.java index 5082abc18a..115f9d5a58 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTBlocks.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTBlocks.java @@ -1,8 +1,5 @@ package com.gregtechceu.gtceu.common.data; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableTable; -import com.google.common.collect.Table; import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.GTCEuAPI; import com.gregtechceu.gtceu.api.GTValues; @@ -11,14 +8,6 @@ import com.gregtechceu.gtceu.api.block.*; import com.gregtechceu.gtceu.api.data.chemical.ChemicalHelper; import com.gregtechceu.gtceu.api.data.chemical.material.Material; -import com.gregtechceu.gtceu.common.block.explosive.IndustrialTNTBlock; -import com.gregtechceu.gtceu.common.block.explosive.PowderbarrelBlock; -import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.world.item.DyeColor; -import net.minecraft.world.item.HangingSignItem; -import net.minecraft.world.item.SignItem; -import net.minecraft.world.level.block.state.properties.BlockSetType; -import net.minecraft.world.level.block.state.properties.WoodType; import com.gregtechceu.gtceu.api.data.chemical.material.properties.PropertyKey; import com.gregtechceu.gtceu.api.data.chemical.material.registry.MaterialRegistry; import com.gregtechceu.gtceu.api.data.chemical.material.stack.UnificationEntry; @@ -34,6 +23,8 @@ import com.gregtechceu.gtceu.client.renderer.block.CTMModelRenderer; import com.gregtechceu.gtceu.client.renderer.block.TextureOverrideRenderer; import com.gregtechceu.gtceu.common.block.*; +import com.gregtechceu.gtceu.common.block.explosive.IndustrialTNTBlock; +import com.gregtechceu.gtceu.common.block.explosive.PowderbarrelBlock; import com.gregtechceu.gtceu.common.pipelike.cable.Insulation; import com.gregtechceu.gtceu.common.pipelike.fluidpipe.FluidPipeType; import com.gregtechceu.gtceu.common.pipelike.fluidpipe.longdistance.LDFluidPipeType; @@ -45,32 +36,33 @@ import com.gregtechceu.gtceu.data.recipe.CustomTags; import com.gregtechceu.gtceu.utils.FormattingUtil; import com.gregtechceu.gtceu.utils.SupplierMemoizer; + import com.lowdragmc.lowdraglib.Platform; import com.lowdragmc.lowdraglib.client.renderer.IRenderer; import com.lowdragmc.lowdraglib.client.renderer.impl.IModelRenderer; import com.lowdragmc.lowdraglib.gui.texture.ItemStackTexture; -import com.tterrag.registrate.builders.BlockBuilder; -import com.tterrag.registrate.providers.ProviderType; -import com.tterrag.registrate.util.entry.BlockEntry; -import com.tterrag.registrate.util.nullness.NonNullBiConsumer; -import com.tterrag.registrate.util.nullness.NonNullConsumer; -import com.tterrag.registrate.util.nullness.NonNullFunction; -import com.tterrag.registrate.util.nullness.NonNullSupplier; + import net.minecraft.advancements.critereon.StatePropertiesPredicate; import net.minecraft.client.color.block.BlockColor; import net.minecraft.client.color.item.ItemColor; import net.minecraft.client.renderer.BiomeColors; import net.minecraft.client.renderer.RenderType; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.BlockTags; import net.minecraft.tags.ItemTags; import net.minecraft.util.RandomSource; +import net.minecraft.world.item.DyeColor; +import net.minecraft.world.item.HangingSignItem; +import net.minecraft.world.item.SignItem; import net.minecraft.world.level.FoliageColor; import net.minecraft.world.level.ItemLike; import net.minecraft.world.level.block.*; import net.minecraft.world.level.block.grower.AbstractTreeGrower; import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.block.state.properties.BlockSetType; +import net.minecraft.world.level.block.state.properties.WoodType; import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; import net.minecraft.world.level.material.MapColor; import net.minecraft.world.level.material.PushReaction; @@ -84,6 +76,17 @@ import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.client.model.generators.ModelFile; import net.minecraftforge.client.model.generators.ModelProvider; + +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableTable; +import com.google.common.collect.Table; +import com.tterrag.registrate.builders.BlockBuilder; +import com.tterrag.registrate.providers.ProviderType; +import com.tterrag.registrate.util.entry.BlockEntry; +import com.tterrag.registrate.util.nullness.NonNullBiConsumer; +import com.tterrag.registrate.util.nullness.NonNullConsumer; +import com.tterrag.registrate.util.nullness.NonNullFunction; +import com.tterrag.registrate.util.nullness.NonNullSupplier; import org.jetbrains.annotations.NotNull; import java.util.HashMap; @@ -93,9 +96,9 @@ import java.util.function.Supplier; import static com.gregtechceu.gtceu.api.GTValues.*; -import static com.gregtechceu.gtceu.common.registry.GTRegistration.REGISTRATE; import static com.gregtechceu.gtceu.common.data.GCyMBlocks.*; import static com.gregtechceu.gtceu.common.data.GTModels.createModelBlockState; +import static com.gregtechceu.gtceu.common.registry.GTRegistration.REGISTRATE; /** * @author KilaBash @@ -106,17 +109,21 @@ public class GTBlocks { ////////////////////////////////////// - //***** Tables Builders *****// + // ***** Tables Builders *****// ////////////////////////////////////// - private static ImmutableTable.Builder> MATERIAL_BLOCKS_BUILDER = ImmutableTable.builder(); - private static ImmutableMap.Builder> SURFACE_ROCK_BLOCKS_BUILDER = ImmutableMap.builder(); - private static ImmutableTable.Builder> CABLE_BLOCKS_BUILDER = ImmutableTable.builder(); - private static ImmutableTable.Builder> FLUID_PIPE_BLOCKS_BUILDER = ImmutableTable.builder(); - private static ImmutableTable.Builder> ITEM_PIPE_BLOCKS_BUILDER = ImmutableTable.builder(); - + private static ImmutableTable.Builder> MATERIAL_BLOCKS_BUILDER = ImmutableTable + .builder(); + private static ImmutableMap.Builder> SURFACE_ROCK_BLOCKS_BUILDER = ImmutableMap + .builder(); + private static ImmutableTable.Builder> CABLE_BLOCKS_BUILDER = ImmutableTable + .builder(); + private static ImmutableTable.Builder> FLUID_PIPE_BLOCKS_BUILDER = ImmutableTable + .builder(); + private static ImmutableTable.Builder> ITEM_PIPE_BLOCKS_BUILDER = ImmutableTable + .builder(); ////////////////////////////////////// - //***** Reference Tables *****// + // ***** Reference Tables *****// ////////////////////////////////////// public static Table> MATERIAL_BLOCKS; public static Map> SURFACE_ROCK_BLOCKS; @@ -126,9 +133,8 @@ public class GTBlocks { public static final BlockEntry[] LASER_PIPES = new BlockEntry[LaserPipeType.values().length]; public static final BlockEntry[] OPTICAL_PIPES = new BlockEntry[OpticalPipeType.values().length]; - ////////////////////////////////////// - //***** Procedural Blocks *****// + // ***** Procedural Blocks *****// ////////////////////////////////////// // Compressed Blocks @@ -142,25 +148,29 @@ private static void generateMaterialBlocks() { for (Material material : registry.getAllMaterials()) { if (tagPrefix.doGenerateBlock(material)) { MATERIAL_BLOCKS_BUILDER.put(tagPrefix, material, registrate - .block(tagPrefix.idPattern().formatted(material.getName()), properties -> new MaterialBlock(properties, tagPrefix, material)) - .initialProperties(() -> Blocks.IRON_BLOCK) - .properties(p -> tagPrefix.blockProperties().properties().apply(p).noLootTable()) - .transform(unificationBlock(tagPrefix, material)) - .addLayer(tagPrefix.blockProperties().renderType()) - .setData(ProviderType.BLOCKSTATE, NonNullBiConsumer.noop()) - .setData(ProviderType.LANG, NonNullBiConsumer.noop()) - .setData(ProviderType.LOOT, NonNullBiConsumer.noop()) - .color(() -> MaterialBlock::tintedColor) - .item(MaterialBlockItem::create) - .onRegister(MaterialBlockItem::onRegister) - .model(NonNullBiConsumer.noop()) - .color(() -> MaterialBlockItem::tintColor) - .onRegister(item -> { - CompassNode.getOrCreate(GTCompassSections.MATERIALS, FormattingUtil.toLowerCaseUnderscore(tagPrefix.name)) - .iconIfNull(() -> new ItemStackTexture(item)).addTag(tagPrefix.getItemParentTags()); - }) - .build() - .register()); + .block(tagPrefix.idPattern().formatted(material.getName()), + properties -> new MaterialBlock(properties, tagPrefix, material)) + .initialProperties(() -> Blocks.IRON_BLOCK) + .properties(p -> tagPrefix.blockProperties().properties().apply(p).noLootTable()) + .transform(unificationBlock(tagPrefix, material)) + .addLayer(tagPrefix.blockProperties().renderType()) + .setData(ProviderType.BLOCKSTATE, NonNullBiConsumer.noop()) + .setData(ProviderType.LANG, NonNullBiConsumer.noop()) + .setData(ProviderType.LOOT, NonNullBiConsumer.noop()) + .color(() -> MaterialBlock::tintedColor) + .item(MaterialBlockItem::create) + .onRegister(MaterialBlockItem::onRegister) + .model(NonNullBiConsumer.noop()) + .color(() -> MaterialBlockItem::tintColor) + .onRegister(item -> { + CompassNode + .getOrCreate(GTCompassSections.MATERIALS, + FormattingUtil.toLowerCaseUnderscore(tagPrefix.name)) + .iconIfNull(() -> new ItemStackTexture(item)) + .addTag(tagPrefix.getItemParentTags()); + }) + .build() + .register()); } } } @@ -182,35 +192,41 @@ private static void generateOreBlocks() { } GTCEu.LOGGER.debug("Generating GTCEu Ore Blocks... Complete!"); } + private static boolean allowOreBlock(Material material) { return material.hasProperty(PropertyKey.ORE); } + private static void registerOreBlock(Material material, GTRegistrate registrate) { for (var ore : TagPrefix.ORES.entrySet()) { if (ore.getKey().isIgnored(material)) continue; var oreTag = ore.getKey(); final TagPrefix.OreType oreType = ore.getValue(); - var entry = registrate.block("%s%s_ore".formatted(oreTag != TagPrefix.ore ? FormattingUtil.toLowerCaseUnder(oreTag.name) + "_" : "", material.getName()), - properties -> new OreBlock(properties, oreTag, material, true)) - .initialProperties(() -> { - if (oreType.stoneType().get().isAir()) { // if the block is not registered (yet), fallback to stone - return Blocks.IRON_ORE; - } - return oreType.stoneType().get().getBlock(); - }) - .properties(properties -> GTBlocks.copy(oreType.template().get(), properties).noLootTable()) - .transform(unificationBlock(oreTag, material)) - .blockstate(NonNullBiConsumer.noop()) - .setData(ProviderType.LANG, NonNullBiConsumer.noop()) - .setData(ProviderType.LOOT, NonNullBiConsumer.noop()) - .color(() -> MaterialBlock::tintedColor) - .item(MaterialBlockItem::create) - .onRegister(MaterialBlockItem::onRegister) - .model(NonNullBiConsumer.noop()) - .color(() -> MaterialBlockItem::tintColor) - .onRegister(compassNodeExist(GTCompassSections.GENERATIONS, oreTag.name, GTCompassNodes.ORE)) - .build() - .register(); + var entry = registrate + .block("%s%s_ore".formatted( + oreTag != TagPrefix.ore ? FormattingUtil.toLowerCaseUnder(oreTag.name) + "_" : "", + material.getName()), + properties -> new OreBlock(properties, oreTag, material, true)) + .initialProperties(() -> { + if (oreType.stoneType().get().isAir()) { // if the block is not registered (yet), fallback to + // stone + return Blocks.IRON_ORE; + } + return oreType.stoneType().get().getBlock(); + }) + .properties(properties -> GTBlocks.copy(oreType.template().get(), properties).noLootTable()) + .transform(unificationBlock(oreTag, material)) + .blockstate(NonNullBiConsumer.noop()) + .setData(ProviderType.LANG, NonNullBiConsumer.noop()) + .setData(ProviderType.LOOT, NonNullBiConsumer.noop()) + .color(() -> MaterialBlock::tintedColor) + .item(MaterialBlockItem::create) + .onRegister(MaterialBlockItem::onRegister) + .model(NonNullBiConsumer.noop()) + .color(() -> MaterialBlockItem::tintColor) + .onRegister(compassNodeExist(GTCompassSections.GENERATIONS, oreTag.name, GTCompassNodes.ORE)) + .build() + .register(); MATERIAL_BLOCKS_BUILDER.put(oreTag, material, entry); } } @@ -229,11 +245,14 @@ private static void generateOreIndicators() { SURFACE_ROCK_BLOCKS = SURFACE_ROCK_BLOCKS_BUILDER.build(); GTCEu.LOGGER.debug("Generating GTCEu Surface Rock Indicator Blocks... Complete!"); } + private static boolean allowOreIndicator(Material material) { return material.hasProperty(PropertyKey.ORE); } + private static void registerOreIndicator(Material material, GTRegistrate registrate) { - var entry = registrate.block("%s_indicator".formatted(material.getName()), p -> new SurfaceRockBlock(p, material)) + var entry = registrate + .block("%s_indicator".formatted(material.getName()), p -> new SurfaceRockBlock(p, material)) .initialProperties(() -> Blocks.GRAVEL) .properties(p -> p.noLootTable().strength(0.25f)) .blockstate(NonNullBiConsumer.noop()) @@ -261,13 +280,16 @@ private static void generateCableBlocks() { CABLE_BLOCKS = CABLE_BLOCKS_BUILDER.build(); GTCEu.LOGGER.debug("Generating GTCEu Cable/Wire Blocks... Complete!"); } + private static boolean allowCableBlock(Material material, Insulation insulation) { - return material.hasProperty(PropertyKey.WIRE) - && !insulation.tagPrefix.isIgnored(material) - && !(insulation.isCable && material.getProperty(PropertyKey.WIRE).isSuperconductor()); + return material.hasProperty(PropertyKey.WIRE) && !insulation.tagPrefix.isIgnored(material) && + !(insulation.isCable && material.getProperty(PropertyKey.WIRE).isSuperconductor()); } + private static void registerCableBlock(Material material, Insulation insulation, GTRegistrate registrate) { - var entry = registrate.block("%s_%s".formatted(material.getName(), insulation.name), p -> new CableBlock(p, insulation, material)) + var entry = registrate + .block("%s_%s".formatted(material.getName(), insulation.name), + p -> new CableBlock(p, insulation, material)) .initialProperties(() -> Blocks.IRON_BLOCK) .properties(p -> p.dynamicShape().noOcclusion().noLootTable().forceSolidOn()) .transform(unificationBlock(insulation.tagPrefix, material)) @@ -301,12 +323,16 @@ private static void generateFluidPipeBlocks() { FLUID_PIPE_BLOCKS = FLUID_PIPE_BLOCKS_BUILDER.build(); GTCEu.LOGGER.debug("Generating GTCEu Fluid Pipe Blocks... Complete!"); } + private static boolean allowFluidPipeBlock(Material material, FluidPipeType fluidPipeType) { - return material.hasProperty(PropertyKey.FLUID_PIPE) - && !fluidPipeType.tagPrefix.isIgnored(material); + return material.hasProperty(PropertyKey.FLUID_PIPE) && !fluidPipeType.tagPrefix.isIgnored(material); } - private static void registerFluidPipeBlock(Material material, FluidPipeType fluidPipeType, GTRegistrate registrate) { - var entry = registrate.block("%s_%s_fluid_pipe".formatted(material.getName(), fluidPipeType.name), p -> new FluidPipeBlock(p, fluidPipeType, material)) + + private static void registerFluidPipeBlock(Material material, FluidPipeType fluidPipeType, + GTRegistrate registrate) { + var entry = registrate + .block("%s_%s_fluid_pipe".formatted(material.getName(), fluidPipeType.name), + p -> new FluidPipeBlock(p, fluidPipeType, material)) .initialProperties(() -> Blocks.IRON_BLOCK) .properties(p -> { if (doMetalPipe(material)) { @@ -344,12 +370,15 @@ private static void generateItemPipeBlocks() { ITEM_PIPE_BLOCKS = ITEM_PIPE_BLOCKS_BUILDER.build(); GTCEu.LOGGER.debug("Generating GTCEu Item Pipe Blocks... Complete!"); } + private static boolean allowItemPipeBlock(Material material, ItemPipeType itemPipeType) { - return material.hasProperty(PropertyKey.ITEM_PIPE) - && !itemPipeType.getTagPrefix().isIgnored(material); + return material.hasProperty(PropertyKey.ITEM_PIPE) && !itemPipeType.getTagPrefix().isIgnored(material); } + private static void registerItemPipeBlock(Material material, ItemPipeType itemPipeType, GTRegistrate registrate) { - var entry = registrate.block("%s_%s_item_pipe".formatted(material.getName(), itemPipeType.name), p -> new ItemPipeBlock(p, itemPipeType, material)) + var entry = registrate + .block("%s_%s_item_pipe".formatted(material.getName(), itemPipeType.name), + p -> new ItemPipeBlock(p, itemPipeType, material)) .initialProperties(() -> Blocks.IRON_BLOCK) .properties(p -> { if (doMetalPipe(material)) { @@ -379,9 +408,11 @@ private static void generateLaserPipeBlocks() { } GTCEu.LOGGER.debug("Generating GTCEu Laser Pipe Blocks... Complete!"); } + private static void registerLaserPipeBlock(int index) { var type = LaserPipeType.values()[index]; - var entry = REGISTRATE.block("%s_laser_pipe".formatted(type.getSerializedName()), (p) -> new LaserPipeBlock(p, type)) + var entry = REGISTRATE + .block("%s_laser_pipe".formatted(type.getSerializedName()), (p) -> new LaserPipeBlock(p, type)) .initialProperties(() -> Blocks.IRON_BLOCK) .properties(p -> p.dynamicShape().noOcclusion().forceSolidOn()) .blockstate(NonNullBiConsumer.noop()) @@ -405,38 +436,42 @@ private static void generateOpticalPipeBlocks() { } GTCEu.LOGGER.debug("Generating GTCEu Optical Pipe Blocks... Complete!"); } + private static void registerOpticalPipeBlock(int index) { var type = OpticalPipeType.values()[index]; - var entry = REGISTRATE.block("%s_optical_pipe".formatted(type.getSerializedName()), (p) -> new OpticalPipeBlock(p, type)) - .initialProperties(() -> Blocks.IRON_BLOCK) - .properties(p -> p.dynamicShape().noOcclusion().forceSolidOn()) - .blockstate(NonNullBiConsumer.noop()) - .defaultLoot() - .tag(GTToolType.WIRE_CUTTER.harvestTags.get(0)) - .addLayer(() -> RenderType::cutoutMipped) - .item(OpticalPipeBlockItem::new) - .model(NonNullBiConsumer.noop()) - .build() - .register(); + var entry = REGISTRATE + .block("%s_optical_pipe".formatted(type.getSerializedName()), (p) -> new OpticalPipeBlock(p, type)) + .initialProperties(() -> Blocks.IRON_BLOCK) + .properties(p -> p.dynamicShape().noOcclusion().forceSolidOn()) + .blockstate(NonNullBiConsumer.noop()) + .defaultLoot() + .tag(GTToolType.WIRE_CUTTER.harvestTags.get(0)) + .addLayer(() -> RenderType::cutoutMipped) + .item(OpticalPipeBlockItem::new) + .model(NonNullBiConsumer.noop()) + .build() + .register(); OPTICAL_PIPES[index] = entry; } - - ////////////////////////////////////// - //***** General Pipes ******// + // ***** General Pipes ******// ////////////////////////////////////// static { REGISTRATE.creativeModeTab(() -> GTCreativeModeTabs.MATERIAL_PIPE); } - public static final BlockEntry LD_ITEM_PIPE = REGISTRATE.block("long_distance_item_pipeline", properties -> new LongDistancePipeBlock(properties, LDItemPipeType.INSTANCE)) + public static final BlockEntry LD_ITEM_PIPE = REGISTRATE + .block("long_distance_item_pipeline", + properties -> new LongDistancePipeBlock(properties, LDItemPipeType.INSTANCE)) .initialProperties(() -> Blocks.IRON_BLOCK) .blockstate(GTModels::longDistanceItemPipeModel) .tag(GTToolType.WRENCH.harvestTags.get(0), BlockTags.MINEABLE_WITH_PICKAXE, BlockTags.NEEDS_STONE_TOOL) .simpleItem() .register(); - public static final BlockEntry LD_FLUID_PIPE = REGISTRATE.block("long_distance_fluid_pipeline", properties -> new LongDistancePipeBlock(properties, LDFluidPipeType.INSTANCE)) + public static final BlockEntry LD_FLUID_PIPE = REGISTRATE + .block("long_distance_fluid_pipeline", + properties -> new LongDistancePipeBlock(properties, LDFluidPipeType.INSTANCE)) .initialProperties(() -> Blocks.IRON_BLOCK) .blockstate(GTModels::longDistanceFluidPipeModel) .tag(GTToolType.WRENCH.harvestTags.get(0), BlockTags.MINEABLE_WITH_PICKAXE, BlockTags.NEEDS_STONE_TOOL) @@ -448,25 +483,41 @@ private static void registerOpticalPipeBlock(int index) { } ////////////////////////////////////// - //****** Casing Blocks *****// + // ****** Casing Blocks *****// ////////////////////////////////////// // Multiblock Machine Casing Blocks - public static final BlockEntry CASING_WOOD_WALL = createSidedCasingBlock("wood_wall", "block/casings/wood_wall"); - public static final BlockEntry CASING_COKE_BRICKS = createCasingBlock("coke_oven_bricks", GTCEu.id("block/casings/solid/machine_coke_bricks")); - public static final BlockEntry CASING_PRIMITIVE_BRICKS = createCasingBlock("firebricks", GTCEu.id("block/casings/solid/machine_primitive_bricks")); - public static final BlockEntry CASING_BRONZE_BRICKS = createCasingBlock("steam_machine_casing", GTCEu.id("block/casings/solid/machine_casing_bronze_plated_bricks")); - public static final BlockEntry CASING_INVAR_HEATPROOF = createCasingBlock("heatproof_machine_casing", GTCEu.id("block/casings/solid/machine_casing_heatproof")); - public static final BlockEntry CASING_ALUMINIUM_FROSTPROOF = createCasingBlock("frostproof_machine_casing", GTCEu.id("block/casings/solid/machine_casing_frost_proof")); - public static final BlockEntry CASING_STEEL_SOLID = createCasingBlock("solid_machine_casing", GTCEu.id("block/casings/solid/machine_casing_solid_steel")); - public static final BlockEntry CASING_STAINLESS_CLEAN = createCasingBlock("clean_machine_casing", GTCEu.id("block/casings/solid/machine_casing_clean_stainless_steel")); - public static final BlockEntry CASING_TITANIUM_STABLE = createCasingBlock("stable_machine_casing", GTCEu.id("block/casings/solid/machine_casing_stable_titanium")); - public static final BlockEntry CASING_TUNGSTENSTEEL_ROBUST = createCasingBlock("robust_machine_casing", GTCEu.id("block/casings/solid/machine_casing_robust_tungstensteel")); - public static final BlockEntry CASING_PTFE_INERT = createCasingBlock("inert_machine_casing", GTCEu.id("block/casings/solid/machine_casing_inert_ptfe")); - public static final BlockEntry CASING_HSSE_STURDY = createCasingBlock("sturdy_machine_casing", GTCEu.id("block/casings/solid/machine_casing_sturdy_hsse")); - public static final BlockEntry CASING_PALLADIUM_SUBSTATION = createCasingBlock("palladium_substation", GTCEu.id("block/casings/solid/machine_casing_palladium_substation")); - public static final BlockEntry CASING_TEMPERED_GLASS = createGlassCasingBlock("tempered_glass", GTCEu.id("block/casings/transparent/tempered_glass"), () -> RenderType::translucent); - + public static final BlockEntry CASING_WOOD_WALL = createSidedCasingBlock("wood_wall", + "block/casings/wood_wall"); + public static final BlockEntry CASING_COKE_BRICKS = createCasingBlock("coke_oven_bricks", + GTCEu.id("block/casings/solid/machine_coke_bricks")); + public static final BlockEntry CASING_PRIMITIVE_BRICKS = createCasingBlock("firebricks", + GTCEu.id("block/casings/solid/machine_primitive_bricks")); + public static final BlockEntry CASING_BRONZE_BRICKS = createCasingBlock("steam_machine_casing", + GTCEu.id("block/casings/solid/machine_casing_bronze_plated_bricks")); + public static final BlockEntry CASING_INVAR_HEATPROOF = createCasingBlock("heatproof_machine_casing", + GTCEu.id("block/casings/solid/machine_casing_heatproof")); + public static final BlockEntry CASING_ALUMINIUM_FROSTPROOF = createCasingBlock("frostproof_machine_casing", + GTCEu.id("block/casings/solid/machine_casing_frost_proof")); + public static final BlockEntry CASING_STEEL_SOLID = createCasingBlock("solid_machine_casing", + GTCEu.id("block/casings/solid/machine_casing_solid_steel")); + public static final BlockEntry CASING_STAINLESS_CLEAN = createCasingBlock("clean_machine_casing", + GTCEu.id("block/casings/solid/machine_casing_clean_stainless_steel")); + public static final BlockEntry CASING_TITANIUM_STABLE = createCasingBlock("stable_machine_casing", + GTCEu.id("block/casings/solid/machine_casing_stable_titanium")); + public static final BlockEntry CASING_TUNGSTENSTEEL_ROBUST = createCasingBlock("robust_machine_casing", + GTCEu.id("block/casings/solid/machine_casing_robust_tungstensteel")); + public static final BlockEntry CASING_PTFE_INERT = createCasingBlock("inert_machine_casing", + GTCEu.id("block/casings/solid/machine_casing_inert_ptfe")); + public static final BlockEntry CASING_HSSE_STURDY = createCasingBlock("sturdy_machine_casing", + GTCEu.id("block/casings/solid/machine_casing_sturdy_hsse")); + public static final BlockEntry CASING_PALLADIUM_SUBSTATION = createCasingBlock("palladium_substation", + GTCEu.id("block/casings/solid/machine_casing_palladium_substation")); + public static final BlockEntry CASING_TEMPERED_GLASS = createGlassCasingBlock("tempered_glass", + GTCEu.id("block/casings/transparent/tempered_glass"), () -> RenderType::translucent); + public static final BlockEntry CASING_STAINLESS_EVAPORATION = createCasingBlock( + "stainless_evaporation_casing", + GTCEu.id("block/casings/solid/machine_casing_stainless_evaporation")); public static final ImmutableMap> MATERIALS_TO_CASINGS; @@ -481,7 +532,7 @@ private static void registerOpticalPipeBlock(int index) { builder.put(GTMaterials.TungstenSteel, CASING_TUNGSTENSTEEL_ROBUST); builder.put(GTMaterials.Polytetrafluoroethylene, CASING_PTFE_INERT); builder.put(GTMaterials.HSSE, CASING_HSSE_STURDY); - //GCyM + // GCyM builder.put(GTMaterials.HSLASteel, CASING_NONCONDUCTING); builder.put(GTMaterials.IncoloyMA956, CASING_VIBRATION_SAFE); builder.put(GTMaterials.WatertightSteel, CASING_WATERTIGHT); @@ -497,48 +548,66 @@ private static void registerOpticalPipeBlock(int index) { MATERIALS_TO_CASINGS = builder.build(); } - - // Assembly Line - public static final BlockEntry CASING_GRATE = createCasingBlock("assembly_line_grating", GTCEu.id("block/casings/pipe/machine_casing_grate")); - public static final BlockEntry CASING_ASSEMBLY_CONTROL = createCasingBlock("assembly_line_casing", GTCEu.id("block/casings/mechanic/machine_casing_assembly_control")); - public static final BlockEntry CASING_LAMINATED_GLASS = createGlassCasingBlock("laminated_glass", GTCEu.id("block/casings/transparent/laminated_glass"), () -> RenderType::cutoutMipped); - public static final BlockEntry CASING_ASSEMBLY_LINE = createActiveCasing("assembly_line_unit", "block/variant/assembly_line"); - + public static final BlockEntry CASING_GRATE = createCasingBlock("assembly_line_grating", + GTCEu.id("block/casings/pipe/machine_casing_grate")); + public static final BlockEntry CASING_ASSEMBLY_CONTROL = createCasingBlock("assembly_line_casing", + GTCEu.id("block/casings/mechanic/machine_casing_assembly_control")); + public static final BlockEntry CASING_LAMINATED_GLASS = createGlassCasingBlock("laminated_glass", + GTCEu.id("block/casings/transparent/laminated_glass"), () -> RenderType::cutoutMipped); + public static final BlockEntry CASING_ASSEMBLY_LINE = createActiveCasing("assembly_line_unit", + "block/variant/assembly_line"); // Gear Boxes - public static final BlockEntry CASING_BRONZE_GEARBOX = createCasingBlock("bronze_gearbox", GTCEu.id("block/casings/gearbox/machine_casing_gearbox_bronze")); - public static final BlockEntry CASING_STEEL_GEARBOX = createCasingBlock("steel_gearbox", GTCEu.id("block/casings/gearbox/machine_casing_gearbox_steel")); - public static final BlockEntry CASING_STAINLESS_STEEL_GEARBOX = createCasingBlock("stainless_steel_gearbox", GTCEu.id("block/casings/gearbox/machine_casing_gearbox_stainless_steel")); - public static final BlockEntry CASING_TITANIUM_GEARBOX = createCasingBlock("titanium_gearbox", GTCEu.id("block/casings/gearbox/machine_casing_gearbox_titanium")); - public static final BlockEntry CASING_TUNGSTENSTEEL_GEARBOX = createCasingBlock("tungstensteel_gearbox", GTCEu.id("block/casings/gearbox/machine_casing_gearbox_tungstensteel")); + public static final BlockEntry CASING_BRONZE_GEARBOX = createCasingBlock("bronze_gearbox", + GTCEu.id("block/casings/gearbox/machine_casing_gearbox_bronze")); + public static final BlockEntry CASING_STEEL_GEARBOX = createCasingBlock("steel_gearbox", + GTCEu.id("block/casings/gearbox/machine_casing_gearbox_steel")); + public static final BlockEntry CASING_STAINLESS_STEEL_GEARBOX = createCasingBlock("stainless_steel_gearbox", + GTCEu.id("block/casings/gearbox/machine_casing_gearbox_stainless_steel")); + public static final BlockEntry CASING_TITANIUM_GEARBOX = createCasingBlock("titanium_gearbox", + GTCEu.id("block/casings/gearbox/machine_casing_gearbox_titanium")); + public static final BlockEntry CASING_TUNGSTENSTEEL_GEARBOX = createCasingBlock("tungstensteel_gearbox", + GTCEu.id("block/casings/gearbox/machine_casing_gearbox_tungstensteel")); // Turbine Casings - public static final BlockEntry CASING_STEEL_TURBINE = createCasingBlock("steel_turbine_casing", GTCEu.id("block/casings/mechanic/machine_casing_turbine_steel")); - public static final BlockEntry CASING_TITANIUM_TURBINE = createCasingBlock("titanium_turbine_casing", GTCEu.id("block/casings/mechanic/machine_casing_turbine_titanium")); - public static final BlockEntry CASING_STAINLESS_TURBINE = createCasingBlock("stainless_steel_turbine_casing", GTCEu.id("block/casings/mechanic/machine_casing_turbine_stainless_steel")); - public static final BlockEntry CASING_TUNGSTENSTEEL_TURBINE = createCasingBlock("tungstensteel_turbine_casing", GTCEu.id("block/casings/mechanic/machine_casing_turbine_tungstensteel")); + public static final BlockEntry CASING_STEEL_TURBINE = createCasingBlock("steel_turbine_casing", + GTCEu.id("block/casings/mechanic/machine_casing_turbine_steel")); + public static final BlockEntry CASING_TITANIUM_TURBINE = createCasingBlock("titanium_turbine_casing", + GTCEu.id("block/casings/mechanic/machine_casing_turbine_titanium")); + public static final BlockEntry CASING_STAINLESS_TURBINE = createCasingBlock("stainless_steel_turbine_casing", + GTCEu.id("block/casings/mechanic/machine_casing_turbine_stainless_steel")); + public static final BlockEntry CASING_TUNGSTENSTEEL_TURBINE = createCasingBlock( + "tungstensteel_turbine_casing", GTCEu.id("block/casings/mechanic/machine_casing_turbine_tungstensteel")); // Pipe casings - public static final BlockEntry CASING_BRONZE_PIPE = createCasingBlock("bronze_pipe_casing", GTCEu.id("block/casings/pipe/machine_casing_pipe_bronze")); - public static final BlockEntry CASING_STEEL_PIPE = createCasingBlock("steel_pipe_casing", GTCEu.id("block/casings/pipe/machine_casing_pipe_steel")); - public static final BlockEntry CASING_TITANIUM_PIPE = createCasingBlock("titanium_pipe_casing", GTCEu.id("block/casings/pipe/machine_casing_pipe_titanium")); - public static final BlockEntry CASING_TUNGSTENSTEEL_PIPE = createCasingBlock("tungstensteel_pipe_casing", GTCEu.id("block/casings/pipe/machine_casing_pipe_tungstensteel")); - public static final BlockEntry CASING_POLYTETRAFLUOROETHYLENE_PIPE = createPipeCasingBlock("ptfe", GTCEu.id("block/casings/pipe/machine_casing_pipe_polytetrafluoroethylene")); + public static final BlockEntry CASING_BRONZE_PIPE = createCasingBlock("bronze_pipe_casing", + GTCEu.id("block/casings/pipe/machine_casing_pipe_bronze")); + public static final BlockEntry CASING_STEEL_PIPE = createCasingBlock("steel_pipe_casing", + GTCEu.id("block/casings/pipe/machine_casing_pipe_steel")); + public static final BlockEntry CASING_TITANIUM_PIPE = createCasingBlock("titanium_pipe_casing", + GTCEu.id("block/casings/pipe/machine_casing_pipe_titanium")); + public static final BlockEntry CASING_TUNGSTENSTEEL_PIPE = createCasingBlock("tungstensteel_pipe_casing", + GTCEu.id("block/casings/pipe/machine_casing_pipe_tungstensteel")); + public static final BlockEntry CASING_POLYTETRAFLUOROETHYLENE_PIPE = createPipeCasingBlock("ptfe", + GTCEu.id("block/casings/pipe/machine_casing_pipe_polytetrafluoroethylene")); public static final BlockEntry MINER_PIPE = REGISTRATE.block("miner_pipe", MinerPipeBlock::new) .initialProperties(() -> Blocks.BEDROCK) .properties(BlockBehaviour.Properties::noOcclusion) .addLayer(() -> RenderType::cutoutMipped) .blockstate((ctx, prov) -> createModelBlockState(ctx, prov, GTCEu.id("block/miner_pipe"))) - .tag(BlockTags.DRAGON_IMMUNE, BlockTags.WITHER_IMMUNE, BlockTags.INFINIBURN_END, BlockTags.FEATURES_CANNOT_REPLACE, BlockTags.GEODE_INVALID_BLOCKS) + .tag(BlockTags.DRAGON_IMMUNE, BlockTags.WITHER_IMMUNE, BlockTags.INFINIBURN_END, + BlockTags.FEATURES_CANNOT_REPLACE, BlockTags.GEODE_INVALID_BLOCKS) .register(); // The Pump Deck - public static final BlockEntry CASING_PUMP_DECK = REGISTRATE.block("pump_deck", p -> (Block) new RendererBlock(p, + public static final BlockEntry CASING_PUMP_DECK = REGISTRATE + .block("pump_deck", p -> (Block) new RendererBlock(p, Platform.isClient() ? new TextureOverrideRenderer(new ResourceLocation("block/cube_bottom_top"), - Map.of("bottom", GTCEu.id("block/casings/pump_deck/bottom"), - "top", GTCEu.id("block/casings/pump_deck/top"), - "side", GTCEu.id("block/casings/pump_deck/side"))) : null)) + Map.of("bottom", GTCEu.id("block/casings/pump_deck/bottom"), + "top", GTCEu.id("block/casings/pump_deck/top"), + "side", GTCEu.id("block/casings/pump_deck/side"))) : + null)) .initialProperties(() -> Blocks.IRON_BLOCK) .properties(p -> p.sound(SoundType.WOOD).mapColor(MapColor.WOOD)) .addLayer(() -> RenderType::cutoutMipped) @@ -549,7 +618,6 @@ private static void registerOpticalPipeBlock(int index) { .build() .register(); - // Machine Casings public static final BlockEntry MACHINE_CASING_ULV = createMachineCasingBlock(ULV); public static final BlockEntry MACHINE_CASING_LV = createMachineCasingBlock(LV); @@ -579,7 +647,8 @@ private static void registerOpticalPipeBlock(int index) { public static final BlockEntry HERMETIC_CASING_UHV = createHermeticCasing(UHV); public static final BlockEntry BRONZE_HULL = createSteamCasing("bronze_machine_casing", "bronze"); - public static final BlockEntry BRONZE_BRICKS_HULL = createSteamCasing("bronze_brick_casing", "bricked_bronze"); + public static final BlockEntry BRONZE_BRICKS_HULL = createSteamCasing("bronze_brick_casing", + "bricked_bronze"); public static final BlockEntry STEEL_HULL = createSteamCasing("steel_machine_casing", "steel"); public static final BlockEntry STEEL_BRICKS_HULL = createSteamCasing("steel_brick_casing", "bricked_steel"); @@ -594,46 +663,67 @@ private static void registerOpticalPipeBlock(int index) { public static final BlockEntry COIL_TRITANIUM = createCoilBlock(CoilBlock.CoilType.TRITANIUM); // PSS batteries - public static final BlockEntry BATTERY_EMPTY_TIER_I = createBatteryBlock(BatteryBlock.BatteryPartType.EMPTY_TIER_I); - public static final BlockEntry BATTERY_LAPOTRONIC_EV = createBatteryBlock(BatteryBlock.BatteryPartType.EV_LAPOTRONIC); - public static final BlockEntry BATTERY_LAPOTRONIC_IV = createBatteryBlock(BatteryBlock.BatteryPartType.IV_LAPOTRONIC); - public static final BlockEntry BATTERY_EMPTY_TIER_II = createBatteryBlock(BatteryBlock.BatteryPartType.EMPTY_TIER_II); - public static final BlockEntry BATTERY_LAPOTRONIC_LuV = createBatteryBlock(BatteryBlock.BatteryPartType.LuV_LAPOTRONIC); - public static final BlockEntry BATTERY_LAPOTRONIC_ZPM = createBatteryBlock(BatteryBlock.BatteryPartType.ZPM_LAPOTRONIC); - public static final BlockEntry BATTERY_EMPTY_TIER_III = createBatteryBlock(BatteryBlock.BatteryPartType.EMPTY_TIER_III); - public static final BlockEntry BATTERY_LAPOTRONIC_UV = createBatteryBlock(BatteryBlock.BatteryPartType.UV_LAPOTRONIC); - public static final BlockEntry BATTERY_ULTIMATE_UHV = createBatteryBlock(BatteryBlock.BatteryPartType.UHV_ULTIMATE); + public static final BlockEntry BATTERY_EMPTY_TIER_I = createBatteryBlock( + BatteryBlock.BatteryPartType.EMPTY_TIER_I); + public static final BlockEntry BATTERY_LAPOTRONIC_EV = createBatteryBlock( + BatteryBlock.BatteryPartType.EV_LAPOTRONIC); + public static final BlockEntry BATTERY_LAPOTRONIC_IV = createBatteryBlock( + BatteryBlock.BatteryPartType.IV_LAPOTRONIC); + public static final BlockEntry BATTERY_EMPTY_TIER_II = createBatteryBlock( + BatteryBlock.BatteryPartType.EMPTY_TIER_II); + public static final BlockEntry BATTERY_LAPOTRONIC_LuV = createBatteryBlock( + BatteryBlock.BatteryPartType.LuV_LAPOTRONIC); + public static final BlockEntry BATTERY_LAPOTRONIC_ZPM = createBatteryBlock( + BatteryBlock.BatteryPartType.ZPM_LAPOTRONIC); + public static final BlockEntry BATTERY_EMPTY_TIER_III = createBatteryBlock( + BatteryBlock.BatteryPartType.EMPTY_TIER_III); + public static final BlockEntry BATTERY_LAPOTRONIC_UV = createBatteryBlock( + BatteryBlock.BatteryPartType.UV_LAPOTRONIC); + public static final BlockEntry BATTERY_ULTIMATE_UHV = createBatteryBlock( + BatteryBlock.BatteryPartType.UHV_ULTIMATE); // Intake casing - public static final BlockEntry CASING_ENGINE_INTAKE = createActiveCasing("engine_intake_casing", "block/variant/engine_intake"); - public static final BlockEntry CASING_EXTREME_ENGINE_INTAKE = createActiveCasing("extreme_engine_intake_casing", "block/variant/extreme_engine_intake"); + public static final BlockEntry CASING_ENGINE_INTAKE = createActiveCasing("engine_intake_casing", + "block/variant/engine_intake"); + public static final BlockEntry CASING_EXTREME_ENGINE_INTAKE = createActiveCasing( + "extreme_engine_intake_casing", "block/variant/extreme_engine_intake"); // Fusion public static final Map> ALL_FUSION_CASINGS = new HashMap<>(); - public static final BlockEntry SUPERCONDUCTING_COIL = createFusionCasing(FusionCasingBlock.CasingType.SUPERCONDUCTING_COIL); - public static final BlockEntry FUSION_COIL = createFusionCasing(FusionCasingBlock.CasingType.FUSION_COIL); - public static final BlockEntry FUSION_CASING = createFusionCasing(FusionCasingBlock.CasingType.FUSION_CASING); - public static final BlockEntry FUSION_CASING_MK2 = createFusionCasing(FusionCasingBlock.CasingType.FUSION_CASING_MK2); - public static final BlockEntry FUSION_CASING_MK3 = createFusionCasing(FusionCasingBlock.CasingType.FUSION_CASING_MK3); - public static final BlockEntry FUSION_GLASS = createGlassCasingBlock("fusion_glass", GTCEu.id("block/casings/transparent/fusion_glass"), () -> RenderType::cutoutMipped); + public static final BlockEntry SUPERCONDUCTING_COIL = createFusionCasing( + FusionCasingBlock.CasingType.SUPERCONDUCTING_COIL); + public static final BlockEntry FUSION_COIL = createFusionCasing( + FusionCasingBlock.CasingType.FUSION_COIL); + public static final BlockEntry FUSION_CASING = createFusionCasing( + FusionCasingBlock.CasingType.FUSION_CASING); + public static final BlockEntry FUSION_CASING_MK2 = createFusionCasing( + FusionCasingBlock.CasingType.FUSION_CASING_MK2); + public static final BlockEntry FUSION_CASING_MK3 = createFusionCasing( + FusionCasingBlock.CasingType.FUSION_CASING_MK3); + public static final BlockEntry FUSION_GLASS = createGlassCasingBlock("fusion_glass", + GTCEu.id("block/casings/transparent/fusion_glass"), () -> RenderType::cutoutMipped); // Cleanroom - public static final BlockEntry PLASTCRETE = createCasingBlock("plascrete", GTCEu.id("block/casings/cleanroom/plascrete")); + public static final BlockEntry PLASTCRETE = createCasingBlock("plascrete", + GTCEu.id("block/casings/cleanroom/plascrete")); public static final BlockEntry FILTER_CASING = createCleanroomFilter(CleanroomFilterType.FILTER_CASING); - public static final BlockEntry FILTER_CASING_STERILE = createCleanroomFilter(CleanroomFilterType.FILTER_CASING_STERILE); - public static final BlockEntry CLEANROOM_GLASS = createGlassCasingBlock("cleanroom_glass", GTCEu.id("block/casings/transparent/cleanroom_glass"), () -> RenderType::cutoutMipped); - + public static final BlockEntry FILTER_CASING_STERILE = createCleanroomFilter( + CleanroomFilterType.FILTER_CASING_STERILE); + public static final BlockEntry CLEANROOM_GLASS = createGlassCasingBlock("cleanroom_glass", + GTCEu.id("block/casings/transparent/cleanroom_glass"), () -> RenderType::cutoutMipped); // Fireboxes public static final Map> ALL_FIREBOXES = new HashMap<>(); public static final BlockEntry FIREBOX_BRONZE = createFireboxCasing(BoilerFireboxType.BRONZE_FIREBOX); public static final BlockEntry FIREBOX_STEEL = createFireboxCasing(BoilerFireboxType.STEEL_FIREBOX); - public static final BlockEntry FIREBOX_TITANIUM = createFireboxCasing(BoilerFireboxType.TITANIUM_FIREBOX); - public static final BlockEntry FIREBOX_TUNGSTENSTEEL = createFireboxCasing(BoilerFireboxType.TUNGSTENSTEEL_FIREBOX); - + public static final BlockEntry FIREBOX_TITANIUM = createFireboxCasing( + BoilerFireboxType.TITANIUM_FIREBOX); + public static final BlockEntry FIREBOX_TUNGSTENSTEEL = createFireboxCasing( + BoilerFireboxType.TUNGSTENSTEEL_FIREBOX); // HPCA, AT - public static final BlockEntry COMPUTER_CASING = REGISTRATE.block("computer_casing", p -> (Block) new RendererBlock(p, + public static final BlockEntry COMPUTER_CASING = REGISTRATE + .block("computer_casing", p -> (Block) new RendererBlock(p, Platform.isClient() ? new IModelRenderer(GTCEu.id("block/computer_casing")) : null)) .initialProperties(() -> Blocks.IRON_BLOCK) .properties(p -> p.isValidSpawn((state, level, pos, ent) -> false)) @@ -643,7 +733,8 @@ private static void registerOpticalPipeBlock(int index) { .model(NonNullBiConsumer.noop()) .build() .register(); - public static final BlockEntry ADVANCED_COMPUTER_CASING = REGISTRATE.block("advanced_computer_casing", p -> (Block) new RendererBlock(p, + public static final BlockEntry ADVANCED_COMPUTER_CASING = REGISTRATE + .block("advanced_computer_casing", p -> (Block) new RendererBlock(p, Platform.isClient() ? new IModelRenderer(GTCEu.id("block/advanced_computer_casing")) : null)) .initialProperties(() -> Blocks.IRON_BLOCK) .properties(p -> p.isValidSpawn((state, level, pos, ent) -> false)) @@ -653,10 +744,12 @@ private static void registerOpticalPipeBlock(int index) { .model(NonNullBiConsumer.noop()) .build() .register(); - public static final BlockEntry COMPUTER_HEAT_VENT = REGISTRATE.block("computer_heat_vent", p -> (Block) new RendererBlock(p, + public static final BlockEntry COMPUTER_HEAT_VENT = REGISTRATE + .block("computer_heat_vent", p -> (Block) new RendererBlock(p, Platform.isClient() ? new TextureOverrideRenderer(new ResourceLocation("block/cube_column"), Map.of("side", GTCEu.id("block/casings/hpca/computer_heat_vent_side"), - "end", GTCEu.id("block/casings/hpca/computer_heat_vent_top_bot"))) : null)) + "end", GTCEu.id("block/casings/hpca/computer_heat_vent_top_bot"))) : + null)) .initialProperties(() -> Blocks.IRON_BLOCK) .properties(p -> p.isValidSpawn((state, level, pos, ent) -> false)) .addLayer(() -> RenderType::cutoutMipped) @@ -666,16 +759,17 @@ private static void registerOpticalPipeBlock(int index) { .model(NonNullBiConsumer.noop()) .build() .register();; - public static final BlockEntry HIGH_POWER_CASING = createCasingBlock("high_power_casing", GTCEu.id("block/casings/hpca/high_power_casing")); - - + public static final BlockEntry HIGH_POWER_CASING = createCasingBlock("high_power_casing", + GTCEu.id("block/casings/hpca/high_power_casing")); private static BlockEntry createPipeCasingBlock(String name, ResourceLocation texture) { return createPipeCasingBlock(name, texture, () -> Blocks.IRON_BLOCK); } - private static BlockEntry createPipeCasingBlock(String name, ResourceLocation texture, NonNullSupplier properties) { - return REGISTRATE.block("%s_pipe_casing".formatted(name.toLowerCase(Locale.ROOT)), p -> (Block) new RendererBlock(p, + private static BlockEntry createPipeCasingBlock(String name, ResourceLocation texture, + NonNullSupplier properties) { + return REGISTRATE + .block("%s_pipe_casing".formatted(name.toLowerCase(Locale.ROOT)), p -> (Block) new RendererBlock(p, Platform.isClient() ? new TextureOverrideRenderer(new ResourceLocation("block/cube_all"), Map.of("all", texture)) : null)) .lang("%s Pipe Casing".formatted(name)) @@ -690,34 +784,43 @@ private static BlockEntry createPipeCasingBlock(String name, ResourceLoca .register(); } - // THIS IS JUST FOR PTFE PIPE CASING public static BlockEntry createCasingBlock(String name, ResourceLocation texture) { - return createCasingBlock(name, RendererBlock::new, texture, () -> Blocks.IRON_BLOCK, () -> RenderType::cutoutMipped); + return createCasingBlock(name, RendererBlock::new, texture, () -> Blocks.IRON_BLOCK, + () -> RenderType::cutoutMipped); } private static BlockEntry createSidedCasingBlock(String name, String texture) { return createCasingBlock( - name, properties -> new RendererBlock(properties, - Platform.isClient() ? new TextureOverrideRenderer(new ResourceLocation("block/cube_bottom_top"), - Map.of("bottom", GTCEu.id(texture + "/bottom"), - "top", GTCEu.id(texture + "/top"), - "side", GTCEu.id(texture + "/side"))) : null), - () -> Blocks.IRON_BLOCK, () -> RenderType::cutoutMipped - ); + name, properties -> new RendererBlock(properties, + Platform.isClient() ? new TextureOverrideRenderer(new ResourceLocation("block/cube_bottom_top"), + Map.of("bottom", GTCEu.id(texture + "/bottom"), + "top", GTCEu.id(texture + "/top"), + "side", GTCEu.id(texture + "/side"))) : + null), + () -> Blocks.IRON_BLOCK, () -> RenderType::cutoutMipped); } - private static BlockEntry createGlassCasingBlock(String name, ResourceLocation texture, Supplier> type) { + private static BlockEntry createGlassCasingBlock(String name, ResourceLocation texture, + Supplier> type) { return createCasingBlock(name, RendererGlassBlock::new, texture, () -> Blocks.GLASS, type); } - public static BlockEntry createCasingBlock(String name, BiFunction blockSupplier, ResourceLocation texture, NonNullSupplier properties, Supplier> type) { + public static BlockEntry createCasingBlock(String name, + BiFunction blockSupplier, + ResourceLocation texture, + NonNullSupplier properties, + Supplier> type) { return createCasingBlock(name, p -> blockSupplier.apply(p, - Platform.isClient() ? new TextureOverrideRenderer(new ResourceLocation("block/cube_all"), - Map.of("all", texture)) : null), properties, type); + Platform.isClient() ? new TextureOverrideRenderer(new ResourceLocation("block/cube_all"), + Map.of("all", texture)) : null), + properties, type); } - public static BlockEntry createCasingBlock(String name, NonNullFunction blockSupplier, NonNullSupplier properties, Supplier> type) { + public static BlockEntry createCasingBlock(String name, + NonNullFunction blockSupplier, + NonNullSupplier properties, + Supplier> type) { return REGISTRATE.block(name, blockSupplier) .initialProperties(properties) .properties(p -> p.isValidSpawn((state, level, pos, ent) -> false)) @@ -732,11 +835,13 @@ public static BlockEntry createCasingBlock(String name, NonNullFunction createMachineCasingBlock(int tier) { String tierName = GTValues.VN[tier].toLowerCase(Locale.ROOT); - BlockEntry entry = REGISTRATE.block("%s_machine_casing".formatted(tierName), p -> (Block) new RendererBlock(p, - Platform.isClient() ? new TextureOverrideRenderer( GTCEu.id("block/cube_bottom_top_tintindex"), - Map.of("bottom", GTCEu.id("block/casings/voltage/%s/bottom".formatted(tierName)), - "top", GTCEu.id("block/casings/voltage/%s/top".formatted(tierName)), - "side", GTCEu.id("block/casings/voltage/%s/side".formatted(tierName)))) : null)) + BlockEntry entry = REGISTRATE + .block("%s_machine_casing".formatted(tierName), p -> (Block) new RendererBlock(p, + Platform.isClient() ? new TextureOverrideRenderer(GTCEu.id("block/cube_bottom_top_tintindex"), + Map.of("bottom", GTCEu.id("block/casings/voltage/%s/bottom".formatted(tierName)), + "top", GTCEu.id("block/casings/voltage/%s/top".formatted(tierName)), + "side", GTCEu.id("block/casings/voltage/%s/side".formatted(tierName)))) : + null)) .lang("%s Machine Casing".formatted(GTValues.VN[tier])) .initialProperties(() -> Blocks.IRON_BLOCK) .properties(p -> p.isValidSpawn((state, level, pos, ent) -> false)) @@ -755,12 +860,15 @@ private static BlockEntry createMachineCasingBlock(int tier) { private static BlockEntry createHermeticCasing(int tier) { String tierName = GTValues.VN[tier].toLowerCase(Locale.ROOT); - BlockEntry entry = REGISTRATE.block("%s_hermetic_casing".formatted(tierName), p -> (Block) new RendererBlock(p, - Platform.isClient() ? new TextureOverrideRenderer( GTCEu.id("block/hermetic_casing"), - Map.of("bot_bottom", GTCEu.id("block/casings/voltage/%s/bottom".formatted(tierName)), - "bot_top", GTCEu.id("block/casings/voltage/%s/top".formatted(tierName)), - "bot_side", GTCEu.id("block/casings/voltage/%s/side".formatted(tierName)), - "top_side", GTCEu.id("block/casings/hermetic_casing/hermetic_casing_overlay"))) : null)) + BlockEntry entry = REGISTRATE + .block("%s_hermetic_casing".formatted(tierName), p -> (Block) new RendererBlock(p, + Platform.isClient() ? new TextureOverrideRenderer(GTCEu.id("block/hermetic_casing"), + Map.of("bot_bottom", GTCEu.id("block/casings/voltage/%s/bottom".formatted(tierName)), + "bot_top", GTCEu.id("block/casings/voltage/%s/top".formatted(tierName)), + "bot_side", GTCEu.id("block/casings/voltage/%s/side".formatted(tierName)), + "top_side", + GTCEu.id("block/casings/hermetic_casing/hermetic_casing_overlay"))) : + null)) .lang("Hermetic Casing %s".formatted(GTValues.LVT[tier])) .initialProperties(() -> Blocks.IRON_BLOCK) .properties(p -> p.isValidSpawn((state, level, pos, ent) -> false)) @@ -779,10 +887,11 @@ private static BlockEntry createHermeticCasing(int tier) { private static BlockEntry createSteamCasing(String name, String material) { return REGISTRATE.block(name, p -> (Block) new RendererBlock(p, - Platform.isClient() ? new TextureOverrideRenderer(new ResourceLocation("block/cube_bottom_top"), - Map.of("bottom", GTCEu.id("block/casings/steam/%s/bottom".formatted(material)), - "top", GTCEu.id("block/casings/steam/%s/top".formatted(material)), - "side", GTCEu.id("block/casings/steam/%s/side".formatted(material)))) : null)) + Platform.isClient() ? new TextureOverrideRenderer(new ResourceLocation("block/cube_bottom_top"), + Map.of("bottom", GTCEu.id("block/casings/steam/%s/bottom".formatted(material)), + "top", GTCEu.id("block/casings/steam/%s/top".formatted(material)), + "side", GTCEu.id("block/casings/steam/%s/side".formatted(material)))) : + null)) .initialProperties(() -> Blocks.IRON_BLOCK) .addLayer(() -> RenderType::cutoutMipped) .blockstate(NonNullBiConsumer.noop()) @@ -794,7 +903,8 @@ private static BlockEntry createSteamCasing(String name, String material) } private static BlockEntry createCoilBlock(ICoilType coilType) { - BlockEntry coilBlock = REGISTRATE.block("%s_coil_block".formatted(coilType.getName()), p -> new CoilBlock(p, coilType)) + BlockEntry coilBlock = REGISTRATE + .block("%s_coil_block".formatted(coilType.getName()), p -> new CoilBlock(p, coilType)) .initialProperties(() -> Blocks.IRON_BLOCK) .properties(p -> p.isValidSpawn((state, level, pos, ent) -> false)) .addLayer(() -> RenderType::cutoutMipped) @@ -811,12 +921,15 @@ private static BlockEntry createCoilBlock(ICoilType coilType) { private static BlockEntry createBatteryBlock(IBatteryData batteryData) { BlockEntry batteryBlock = REGISTRATE.block("%s_battery".formatted(batteryData.getBatteryName()), - p -> new BatteryBlock(p, batteryData, Platform.isClient() ? - new TextureOverrideRenderer(new ResourceLocation("block/cube_bottom_top"), - Map.of("bottom", GTCEu.id("block/casings/battery/" + batteryData.getBatteryName() + "/top"), - "top", GTCEu.id("block/casings/battery/" + batteryData.getBatteryName() + "/top"), - "side", GTCEu.id("block/casings/battery/" + batteryData.getBatteryName() + "/side"))) : - null)) + p -> new BatteryBlock(p, batteryData, Platform.isClient() ? + new TextureOverrideRenderer(new ResourceLocation("block/cube_bottom_top"), + Map.of("bottom", + GTCEu.id("block/casings/battery/" + batteryData.getBatteryName() + "/top"), + "top", + GTCEu.id("block/casings/battery/" + batteryData.getBatteryName() + "/top"), + "side", + GTCEu.id("block/casings/battery/" + batteryData.getBatteryName() + "/side"))) : + null)) .initialProperties(() -> Blocks.IRON_BLOCK) .properties(p -> p.isValidSpawn((state, level, pos, entityType) -> false)) .addLayer(() -> RenderType::cutoutMipped) @@ -832,7 +945,8 @@ private static BlockEntry createBatteryBlock(IBatteryData batteryD } private static BlockEntry createFusionCasing(IFusionCasingType casingType) { - BlockEntry casingBlock = REGISTRATE.block(casingType.getSerializedName(), p -> new FusionCasingBlock(p, casingType)) + BlockEntry casingBlock = REGISTRATE + .block(casingType.getSerializedName(), p -> new FusionCasingBlock(p, casingType)) .initialProperties(() -> Blocks.IRON_BLOCK) .properties(properties -> properties.strength(5.0f, 10.0f).sound(SoundType.METAL)) .addLayer(() -> RenderType::cutoutMipped) @@ -848,10 +962,11 @@ private static BlockEntry createFusionCasing(IFusionCasingTyp private static BlockEntry createCleanroomFilter(IFilterType filterType) { var filterBlock = REGISTRATE.block(filterType.getSerializedName(), p -> (Block) new RendererBlock(p, - Platform.isClient() ? new TextureOverrideRenderer(new ResourceLocation("block/cube_all"), - Map.of("all", GTCEu.id("block/casings/cleanroom/" + filterType))) : null)) + Platform.isClient() ? new TextureOverrideRenderer(new ResourceLocation("block/cube_all"), + Map.of("all", GTCEu.id("block/casings/cleanroom/" + filterType))) : null)) .initialProperties(() -> Blocks.IRON_BLOCK) - .properties(properties -> properties.strength(2.0f, 8.0f).sound(SoundType.METAL).isValidSpawn((blockState, blockGetter, blockPos, entityType) -> false)) + .properties(properties -> properties.strength(2.0f, 8.0f).sound(SoundType.METAL) + .isValidSpawn((blockState, blockGetter, blockPos, entityType) -> false)) .addLayer(() -> RenderType::cutoutMipped) .blockstate(NonNullBiConsumer.noop()) .tag(GTToolType.WRENCH.harvestTags.get(0), CustomTags.TOOL_TIERS[1]) @@ -866,8 +981,8 @@ private static BlockEntry createCleanroomFilter(IFilterType filterType) { protected static BlockEntry createActiveCasing(String name, String baseModelPath) { String finalName = "%s".formatted(name); return REGISTRATE.block(finalName, p -> new ActiveBlock(p, - Platform.isClient() ? new CTMModelRenderer(GTCEu.id(baseModelPath)) : null, - Platform.isClient() ? new CTMModelRenderer(GTCEu.id("%s_active".formatted(baseModelPath))) : null)) + Platform.isClient() ? new CTMModelRenderer(GTCEu.id(baseModelPath)) : null, + Platform.isClient() ? new CTMModelRenderer(GTCEu.id("%s_active".formatted(baseModelPath))) : null)) .initialProperties(() -> Blocks.IRON_BLOCK) .addLayer(() -> RenderType::cutoutMipped) .blockstate(NonNullBiConsumer.noop()) @@ -884,11 +999,13 @@ private static BlockEntry createFireboxCasing(BoilerFireboxType typ Platform.isClient() ? new TextureOverrideRenderer(new ResourceLocation("block/cube_bottom_top"), Map.of("bottom", type.bottom(), "top", type.top(), - "side", type.side())) : null, + "side", type.side())) : + null, Platform.isClient() ? new TextureOverrideRenderer(GTCEu.id("block/fire_box_active"), Map.of("bottom", type.bottom(), "top", type.top(), - "side", type.side())) : null)) + "side", type.side())) : + null)) .initialProperties(() -> Blocks.IRON_BLOCK) .properties(p -> p.isValidSpawn((state, level, pos, ent) -> false)) .addLayer(() -> RenderType::cutoutMipped) @@ -903,52 +1020,58 @@ private static BlockEntry createFireboxCasing(BoilerFireboxType typ } ////////////////////////////////////// - //********** Misc **********// + // ********** Misc **********// ////////////////////////////////////// - public static final BlockEntry POWDERBARREL = REGISTRATE.block("powderbarrel", PowderbarrelBlock::new) - .lang("Powderbarrel") - .properties(p -> p.destroyTime(0.5F).sound(SoundType.WOOD).mapColor(MapColor.STONE).pushReaction(PushReaction.BLOCK)) - .tag(BlockTags.MINEABLE_WITH_AXE) - .simpleItem() - .register(); - - public static final BlockEntry INDUSTRIAL_TNT = REGISTRATE.block("industrial_tnt", IndustrialTNTBlock::new) - .lang("Industrial TNT") - .properties(p -> p.mapColor(MapColor.FIRE).instabreak().sound(SoundType.GRASS).ignitedByLava()) - .tag(BlockTags.MINEABLE_WITH_AXE) - .blockstate((ctx, prov) -> - prov.simpleBlock(ctx.get(), prov.models().cubeBottomTop(ctx.getName(), - prov.blockTexture(ctx.get()).withSuffix("_side"), - new ResourceLocation("minecraft", "block/tnt_bottom"), - new ResourceLocation("minecraft", "block/tnt_top")))) - .simpleItem() - .register(); - - public static final BlockEntry RUBBER_SAPLING = REGISTRATE.block("rubber_sapling", properties -> new SaplingBlock(new AbstractTreeGrower() { - protected ResourceKey> getConfiguredFeature(@NotNull RandomSource random, boolean largeHive) { - return GTConfiguredFeatures.RUBBER; - } - }, properties)) - .initialProperties(() -> Blocks.OAK_SAPLING) - .lang("Rubber Sapling") - .blockstate(GTModels::createCrossBlockState) - .addLayer(() -> RenderType::cutoutMipped) - .tag(BlockTags.SAPLINGS) - .item() - .model(GTModels::rubberTreeSaplingModel) - .tag(ItemTags.SAPLINGS) - .onRegister(compassNode(GTCompassSections.GENERATIONS)) - .build() - .register(); + public static final BlockEntry POWDERBARREL = REGISTRATE + .block("powderbarrel", PowderbarrelBlock::new) + .lang("Powderbarrel") + .properties(p -> p.destroyTime(0.5F).sound(SoundType.WOOD).mapColor(MapColor.STONE) + .pushReaction(PushReaction.BLOCK)) + .tag(BlockTags.MINEABLE_WITH_AXE) + .simpleItem() + .register(); + + public static final BlockEntry INDUSTRIAL_TNT = REGISTRATE + .block("industrial_tnt", IndustrialTNTBlock::new) + .lang("Industrial TNT") + .properties(p -> p.mapColor(MapColor.FIRE).instabreak().sound(SoundType.GRASS).ignitedByLava()) + .tag(BlockTags.MINEABLE_WITH_AXE) + .blockstate((ctx, prov) -> prov.simpleBlock(ctx.get(), prov.models().cubeBottomTop(ctx.getName(), + prov.blockTexture(ctx.get()).withSuffix("_side"), + new ResourceLocation("minecraft", "block/tnt_bottom"), + new ResourceLocation("minecraft", "block/tnt_top")))) + .simpleItem() + .register(); + + public static final BlockEntry RUBBER_SAPLING = REGISTRATE + .block("rubber_sapling", properties -> new SaplingBlock(new AbstractTreeGrower() { + protected ResourceKey> getConfiguredFeature(@NotNull RandomSource random, + boolean largeHive) { + return GTConfiguredFeatures.RUBBER; + } + }, properties)) + .initialProperties(() -> Blocks.OAK_SAPLING) + .lang("Rubber Sapling") + .blockstate(GTModels::createCrossBlockState) + .addLayer(() -> RenderType::cutoutMipped) + .tag(BlockTags.SAPLINGS) + .item() + .model(GTModels::rubberTreeSaplingModel) + .tag(ItemTags.SAPLINGS) + .onRegister(compassNode(GTCompassSections.GENERATIONS)) + .build() + .register(); public static final BlockEntry RUBBER_LOG = REGISTRATE.block("rubber_log", RubberLogBlock::new) .properties(p -> p.strength(2.0F).sound(SoundType.WOOD)) .loot((table, block) -> table.add(block, LootTable.lootTable() - .withPool(table.applyExplosionCondition(block, LootPool.lootPool().setRolls(ConstantValue.exactly(1.0F))) + .withPool(table + .applyExplosionCondition(block, LootPool.lootPool().setRolls(ConstantValue.exactly(1.0F))) .add(LootItem.lootTableItem(block))) - .withPool(table.applyExplosionCondition(block, LootPool.lootPool().setRolls(ConstantValue.exactly(1.0F))) + .withPool(table + .applyExplosionCondition(block, LootPool.lootPool().setRolls(ConstantValue.exactly(1.0F))) .add(LootItem.lootTableItem(GTItems.STICKY_RESIN.get()) .when(LootItemBlockStatePropertyCondition.hasBlockStateProperties(block) .setProperties(StatePropertiesPredicate.Builder.properties() @@ -964,13 +1087,13 @@ private static BlockEntry createFireboxCasing(BoilerFireboxType typ .register(); // Fortune Level - public static final float[] RUBBER_LEAVES_DROPPING_CHANCE = new float[]{0.05F, 0.0625F, 0.083333336F, 0.1F}; + public static final float[] RUBBER_LEAVES_DROPPING_CHANCE = new float[] { 0.05F, 0.0625F, 0.083333336F, 0.1F }; @OnlyIn(Dist.CLIENT) public static BlockColor leavesBlockColor() { return (state, reader, pos, tintIndex) -> { if (reader != null && pos != null) { - //return reader.getBlockTint(pos, (biome, x, z) -> biome.getFoliageColor()); + // return reader.getBlockTint(pos, (biome, x, z) -> biome.getFoliageColor()); return BiomeColors.getAverageFoliageColor(reader, pos); } return FoliageColor.getDefaultColor(); @@ -987,7 +1110,8 @@ public static ItemColor leavesItemColor() { .initialProperties(() -> Blocks.OAK_LEAVES) .lang("Rubber Leaves") .blockstate((ctx, prov) -> createModelBlockState(ctx, prov, GTCEu.id("block/rubber_leaves"))) - .loot((table, block) -> table.add(block, table.createLeavesDrops(block, GTBlocks.RUBBER_SAPLING.get(), RUBBER_LEAVES_DROPPING_CHANCE))) + .loot((table, block) -> table.add(block, + table.createLeavesDrops(block, GTBlocks.RUBBER_SAPLING.get(), RUBBER_LEAVES_DROPPING_CHANCE))) .tag(BlockTags.LEAVES, BlockTags.MINEABLE_WITH_HOE) .color(() -> GTBlocks::leavesBlockColor) .item() @@ -997,182 +1121,199 @@ public static ItemColor leavesItemColor() { .build() .register(); - public static final BlockSetType RUBBER_SET = BlockSetType.register(new BlockSetType(GTCEu.id("rubber").toString())); - public static final WoodType RUBBER_TYPE = WoodType.register(new WoodType(GTCEu.id("rubber").toString(), RUBBER_SET)); - - public static final BlockEntry STRIPPED_RUBBER_LOG = REGISTRATE.block("stripped_rubber_log", RotatedPillarBlock::new) - .initialProperties(() -> Blocks.STRIPPED_SPRUCE_LOG) - .lang("Stripped Rubber Log") - .blockstate((ctx, provider) -> provider.logBlock(ctx.get())) - .simpleItem() - .register(); - public static final BlockEntry RUBBER_WOOD = REGISTRATE.block("rubber_wood", RotatedPillarBlock::new) - .initialProperties(() -> Blocks.SPRUCE_WOOD) - .lang("Rubber Wood") - .blockstate((ctx, provider) -> provider.axisBlock(ctx.get(), provider.blockTexture(GTBlocks.RUBBER_LOG.get()), provider.blockTexture(GTBlocks.RUBBER_LOG.get()))) - .simpleItem() - .register(); - public static final BlockEntry STRIPPED_RUBBER_WOOD = REGISTRATE.block("stripped_rubber_wood", RotatedPillarBlock::new) - .initialProperties(() -> Blocks.STRIPPED_SPRUCE_WOOD) - .lang("Stripped Rubber Wood") - .blockstate((ctx, provider) -> provider.axisBlock(ctx.get(), provider.blockTexture(ctx.get()), provider.blockTexture(ctx.get()))) - .simpleItem() - .register(); + public static final BlockSetType RUBBER_SET = BlockSetType + .register(new BlockSetType(GTCEu.id("rubber").toString())); + public static final WoodType RUBBER_TYPE = WoodType + .register(new WoodType(GTCEu.id("rubber").toString(), RUBBER_SET)); + + public static final BlockEntry STRIPPED_RUBBER_LOG = REGISTRATE + .block("stripped_rubber_log", RotatedPillarBlock::new) + .initialProperties(() -> Blocks.STRIPPED_SPRUCE_LOG) + .lang("Stripped Rubber Log") + .blockstate((ctx, provider) -> provider.logBlock(ctx.get())) + .simpleItem() + .register(); + public static final BlockEntry RUBBER_WOOD = REGISTRATE + .block("rubber_wood", RotatedPillarBlock::new) + .initialProperties(() -> Blocks.SPRUCE_WOOD) + .lang("Rubber Wood") + .blockstate((ctx, provider) -> provider.axisBlock(ctx.get(), + provider.blockTexture(GTBlocks.RUBBER_LOG.get()), provider.blockTexture(GTBlocks.RUBBER_LOG.get()))) + .simpleItem() + .register(); + public static final BlockEntry STRIPPED_RUBBER_WOOD = REGISTRATE + .block("stripped_rubber_wood", RotatedPillarBlock::new) + .initialProperties(() -> Blocks.STRIPPED_SPRUCE_WOOD) + .lang("Stripped Rubber Wood") + .blockstate((ctx, provider) -> provider.axisBlock(ctx.get(), provider.blockTexture(ctx.get()), + provider.blockTexture(ctx.get()))) + .simpleItem() + .register(); public static final BlockEntry RUBBER_PLANK = REGISTRATE - .block("rubber_planks", Block::new) - .initialProperties(() -> Blocks.SPRUCE_PLANKS) - .lang("Rubber Planks") - .tag(BlockTags.PLANKS) - .item() - .tag(ItemTags.PLANKS) - .onRegister(compassNode(GTCompassSections.GENERATIONS)) - .build() - .register(); + .block("rubber_planks", Block::new) + .initialProperties(() -> Blocks.SPRUCE_PLANKS) + .lang("Rubber Planks") + .tag(BlockTags.PLANKS) + .item() + .tag(ItemTags.PLANKS) + .onRegister(compassNode(GTCompassSections.GENERATIONS)) + .build() + .register(); public static final BlockEntry RUBBER_SLAB = REGISTRATE - .block("rubber_slab", SlabBlock::new) - .initialProperties(() -> Blocks.SPRUCE_SLAB) - .lang("Rubber Slab") - .blockstate((ctx, prov) -> prov.slabBlock(ctx.getEntry(), prov.blockTexture(GTBlocks.RUBBER_PLANK.get()), prov.blockTexture(GTBlocks.RUBBER_PLANK.get()))) - .tag(BlockTags.WOODEN_SLABS) - .item() - .tag(ItemTags.WOODEN_SLABS) - .onRegister(compassNode(GTCompassSections.GENERATIONS)) - .build() - .register(); + .block("rubber_slab", SlabBlock::new) + .initialProperties(() -> Blocks.SPRUCE_SLAB) + .lang("Rubber Slab") + .blockstate((ctx, prov) -> prov.slabBlock(ctx.getEntry(), prov.blockTexture(GTBlocks.RUBBER_PLANK.get()), + prov.blockTexture(GTBlocks.RUBBER_PLANK.get()))) + .tag(BlockTags.WOODEN_SLABS) + .item() + .tag(ItemTags.WOODEN_SLABS) + .onRegister(compassNode(GTCompassSections.GENERATIONS)) + .build() + .register(); public static final BlockEntry RUBBER_FENCE = REGISTRATE - .block("rubber_fence", FenceBlock::new) - .initialProperties(() -> Blocks.SPRUCE_FENCE) - .lang("Rubber Fence") - .blockstate((ctx, prov) -> prov.fenceBlock(ctx.getEntry(), prov.blockTexture(RUBBER_PLANK.get()))) - .tag(BlockTags.WOODEN_FENCES) - .item() - .model((ctx, prov) -> prov.fenceInventory(ctx.getName(), GTBlocks.RUBBER_PLANK.getId().withPrefix("block/"))) - .tag(ItemTags.WOODEN_FENCES) - .build() - .register(); + .block("rubber_fence", FenceBlock::new) + .initialProperties(() -> Blocks.SPRUCE_FENCE) + .lang("Rubber Fence") + .blockstate((ctx, prov) -> prov.fenceBlock(ctx.getEntry(), prov.blockTexture(RUBBER_PLANK.get()))) + .tag(BlockTags.WOODEN_FENCES) + .item() + .model((ctx, prov) -> prov.fenceInventory(ctx.getName(), + GTBlocks.RUBBER_PLANK.getId().withPrefix("block/"))) + .tag(ItemTags.WOODEN_FENCES) + .build() + .register(); public static final BlockEntry RUBBER_SIGN = REGISTRATE - .block("rubber_sign", (p) -> new GTStandingSignBlock(p, RUBBER_TYPE)) - .initialProperties(() -> Blocks.SPRUCE_SIGN) - .lang("Rubber Sign") - .blockstate((ctx, prov) -> prov.signBlock(ctx.get(), GTBlocks.RUBBER_WALL_SIGN.get(), prov.blockTexture(GTBlocks.RUBBER_PLANK.get()))) - .tag(BlockTags.STANDING_SIGNS) - .setData(ProviderType.LANG, NonNullBiConsumer.noop()) - .item((b, p) -> new SignItem(p, b, GTBlocks.RUBBER_WALL_SIGN.get())) - .defaultModel() - .tag(ItemTags.SIGNS) - .build() - .register(); + .block("rubber_sign", (p) -> new GTStandingSignBlock(p, RUBBER_TYPE)) + .initialProperties(() -> Blocks.SPRUCE_SIGN) + .lang("Rubber Sign") + .blockstate((ctx, prov) -> prov.signBlock(ctx.get(), GTBlocks.RUBBER_WALL_SIGN.get(), + prov.blockTexture(GTBlocks.RUBBER_PLANK.get()))) + .tag(BlockTags.STANDING_SIGNS) + .setData(ProviderType.LANG, NonNullBiConsumer.noop()) + .item((b, p) -> new SignItem(p, b, GTBlocks.RUBBER_WALL_SIGN.get())) + .defaultModel() + .tag(ItemTags.SIGNS) + .build() + .register(); public static final BlockEntry RUBBER_WALL_SIGN = REGISTRATE - .block("rubber_wall_sign", (p) -> new GTWallSignBlock(p, RUBBER_TYPE)) - .initialProperties(() -> Blocks.SPRUCE_WALL_SIGN) - .lang("Rubber Wall Sign") - .setData(ProviderType.BLOCKSTATE, NonNullBiConsumer.noop()) - .tag(BlockTags.WALL_SIGNS) - .loot((table, block) -> table.dropOther(block, RUBBER_SIGN.asItem())) - .register(); + .block("rubber_wall_sign", (p) -> new GTWallSignBlock(p, RUBBER_TYPE)) + .initialProperties(() -> Blocks.SPRUCE_WALL_SIGN) + .lang("Rubber Wall Sign") + .setData(ProviderType.BLOCKSTATE, NonNullBiConsumer.noop()) + .tag(BlockTags.WALL_SIGNS) + .loot((table, block) -> table.dropOther(block, RUBBER_SIGN.asItem())) + .register(); public static final BlockEntry RUBBER_HANGING_SIGN = REGISTRATE - .block("rubber_hanging_sign", (p) -> new GTCeilingHangingSignBlock(p, RUBBER_TYPE)) - .initialProperties(() -> Blocks.SPRUCE_HANGING_SIGN) - .lang("Rubber Hanging Sign") - .blockstate((ctx, prov) -> { - ModelFile model = prov.models().sign(ctx.getName(), prov.blockTexture(GTBlocks.RUBBER_PLANK.get())); - prov.simpleBlock(ctx.get(), model); - }) - .tag(BlockTags.CEILING_HANGING_SIGNS) - .setData(ProviderType.LANG, NonNullBiConsumer.noop()) - .item((b, p) -> new HangingSignItem(b, GTBlocks.RUBBER_WALL_HANGING_SIGN.get(), p)) - .defaultModel() - .tag(ItemTags.HANGING_SIGNS) - .setData(ProviderType.LANG, NonNullBiConsumer.noop()) - .build() - .register(); + .block("rubber_hanging_sign", (p) -> new GTCeilingHangingSignBlock(p, RUBBER_TYPE)) + .initialProperties(() -> Blocks.SPRUCE_HANGING_SIGN) + .lang("Rubber Hanging Sign") + .blockstate((ctx, prov) -> { + ModelFile model = prov.models().sign(ctx.getName(), prov.blockTexture(GTBlocks.RUBBER_PLANK.get())); + prov.simpleBlock(ctx.get(), model); + }) + .tag(BlockTags.CEILING_HANGING_SIGNS) + .setData(ProviderType.LANG, NonNullBiConsumer.noop()) + .item((b, p) -> new HangingSignItem(b, GTBlocks.RUBBER_WALL_HANGING_SIGN.get(), p)) + .defaultModel() + .tag(ItemTags.HANGING_SIGNS) + .setData(ProviderType.LANG, NonNullBiConsumer.noop()) + .build() + .register(); public static final BlockEntry RUBBER_WALL_HANGING_SIGN = REGISTRATE - .block("rubber_wall_hanging_sign", (p) -> new GTWallHangingSignBlock(p, RUBBER_TYPE)) - .initialProperties(() -> Blocks.SPRUCE_WALL_HANGING_SIGN) - .lang("Rubber Wall Hanging Sign") - .blockstate((ctx, prov) -> { - ModelFile model = prov.models().sign(ctx.getName(), prov.blockTexture(GTBlocks.RUBBER_PLANK.get())); - prov.simpleBlock(ctx.get(), model); - }) - .tag(BlockTags.WALL_HANGING_SIGNS) - .loot((table, block) -> table.dropOther(block, RUBBER_HANGING_SIGN.asItem())) - .register(); + .block("rubber_wall_hanging_sign", (p) -> new GTWallHangingSignBlock(p, RUBBER_TYPE)) + .initialProperties(() -> Blocks.SPRUCE_WALL_HANGING_SIGN) + .lang("Rubber Wall Hanging Sign") + .blockstate((ctx, prov) -> { + ModelFile model = prov.models().sign(ctx.getName(), prov.blockTexture(GTBlocks.RUBBER_PLANK.get())); + prov.simpleBlock(ctx.get(), model); + }) + .tag(BlockTags.WALL_HANGING_SIGNS) + .loot((table, block) -> table.dropOther(block, RUBBER_HANGING_SIGN.asItem())) + .register(); public static final BlockEntry RUBBER_PRESSURE_PLATE = REGISTRATE - .block("rubber_pressure_plate", (p) -> new PressurePlateBlock(PressurePlateBlock.Sensitivity.EVERYTHING, p, RUBBER_SET)) - .initialProperties(() -> Blocks.SPRUCE_PRESSURE_PLATE) - .lang("Rubber Pressure Plate") - .tag(BlockTags.WOODEN_PRESSURE_PLATES) - .blockstate((ctx, prov) -> prov.pressurePlateBlock(ctx.getEntry(), prov.blockTexture(GTBlocks.RUBBER_PLANK.get()))) - .item() - .tag(ItemTags.WOODEN_PRESSURE_PLATES) - .build() - .register(); + .block("rubber_pressure_plate", + (p) -> new PressurePlateBlock(PressurePlateBlock.Sensitivity.EVERYTHING, p, RUBBER_SET)) + .initialProperties(() -> Blocks.SPRUCE_PRESSURE_PLATE) + .lang("Rubber Pressure Plate") + .tag(BlockTags.WOODEN_PRESSURE_PLATES) + .blockstate((ctx, prov) -> prov.pressurePlateBlock(ctx.getEntry(), + prov.blockTexture(GTBlocks.RUBBER_PLANK.get()))) + .item() + .tag(ItemTags.WOODEN_PRESSURE_PLATES) + .build() + .register(); public static final BlockEntry RUBBER_TRAPDOOR = REGISTRATE - .block("rubber_trapdoor", (p) -> new TrapDoorBlock(p, RUBBER_SET)) - .initialProperties(() -> Blocks.SPRUCE_TRAPDOOR) - .lang("Rubber Trapdoor") - .blockstate((ctx, prov) -> prov.trapdoorBlock(ctx.get(), prov.blockTexture(ctx.get()), true)) - .tag(BlockTags.WOODEN_TRAPDOORS) - .item() - .model((ctx, prov) -> prov.trapdoorOrientableBottom(ctx.getName(), ctx.getId().withPrefix("block/"))) - .tag(ItemTags.WOODEN_TRAPDOORS) - .build() - .register(); + .block("rubber_trapdoor", (p) -> new TrapDoorBlock(p, RUBBER_SET)) + .initialProperties(() -> Blocks.SPRUCE_TRAPDOOR) + .lang("Rubber Trapdoor") + .blockstate((ctx, prov) -> prov.trapdoorBlock(ctx.get(), prov.blockTexture(ctx.get()), true)) + .tag(BlockTags.WOODEN_TRAPDOORS) + .item() + .model((ctx, prov) -> prov.trapdoorOrientableBottom(ctx.getName(), ctx.getId().withPrefix("block/"))) + .tag(ItemTags.WOODEN_TRAPDOORS) + .build() + .register(); public static final BlockEntry RUBBER_STAIRS = REGISTRATE - .block("rubber_stairs", (p) -> new StairBlock(RUBBER_PLANK::getDefaultState, p)) - .initialProperties(() -> Blocks.SPRUCE_STAIRS) - .lang("Rubber Stairs") - .tag(BlockTags.STAIRS) - .blockstate((ctx, prov) -> prov.stairsBlock(ctx.getEntry(), prov.blockTexture(GTBlocks.RUBBER_PLANK.get()))) - .item() - .tag(ItemTags.STAIRS) - .build() - .register(); + .block("rubber_stairs", (p) -> new StairBlock(RUBBER_PLANK::getDefaultState, p)) + .initialProperties(() -> Blocks.SPRUCE_STAIRS) + .lang("Rubber Stairs") + .tag(BlockTags.STAIRS) + .blockstate((ctx, prov) -> prov.stairsBlock(ctx.getEntry(), prov.blockTexture(GTBlocks.RUBBER_PLANK.get()))) + .item() + .tag(ItemTags.STAIRS) + .build() + .register(); public static final BlockEntry RUBBER_BUTTON = REGISTRATE - .block("rubber_button", (p) -> new ButtonBlock(p, RUBBER_SET, 30, true)) - .initialProperties(() -> Blocks.SPRUCE_BUTTON) - .lang("Rubber Button") - .tag(BlockTags.WOODEN_BUTTONS) - .blockstate((ctx, prov) -> prov.buttonBlock(ctx.getEntry(), prov.blockTexture(RUBBER_PLANK.get()))) - .item() - .model((ctx, prov) -> prov.buttonInventory(ctx.getName(), GTBlocks.RUBBER_PLANK.getId().withPrefix("block/"))) - .tag(ItemTags.WOODEN_BUTTONS) - .build() - .register(); + .block("rubber_button", (p) -> new ButtonBlock(p, RUBBER_SET, 30, true)) + .initialProperties(() -> Blocks.SPRUCE_BUTTON) + .lang("Rubber Button") + .tag(BlockTags.WOODEN_BUTTONS) + .blockstate((ctx, prov) -> prov.buttonBlock(ctx.getEntry(), prov.blockTexture(RUBBER_PLANK.get()))) + .item() + .model((ctx, prov) -> prov.buttonInventory(ctx.getName(), + GTBlocks.RUBBER_PLANK.getId().withPrefix("block/"))) + .tag(ItemTags.WOODEN_BUTTONS) + .build() + .register(); public static final BlockEntry RUBBER_FENCE_GATE = REGISTRATE - .block("rubber_fence_gate", (p) -> new FenceGateBlock(p, RUBBER_TYPE)) - .initialProperties(() -> Blocks.SPRUCE_FENCE_GATE) - .lang("Rubber Fence Gate") - .tag(BlockTags.FENCE_GATES) - .blockstate((ctx, prov) -> prov.fenceGateBlock(ctx.getEntry(), prov.blockTexture(GTBlocks.RUBBER_PLANK.get()))) - .item() - .tag(ItemTags.FENCE_GATES) - .build() - .register(); + .block("rubber_fence_gate", (p) -> new FenceGateBlock(p, RUBBER_TYPE)) + .initialProperties(() -> Blocks.SPRUCE_FENCE_GATE) + .lang("Rubber Fence Gate") + .tag(BlockTags.FENCE_GATES) + .blockstate( + (ctx, prov) -> prov.fenceGateBlock(ctx.getEntry(), prov.blockTexture(GTBlocks.RUBBER_PLANK.get()))) + .item() + .tag(ItemTags.FENCE_GATES) + .build() + .register(); public static final BlockEntry RUBBER_DOOR = REGISTRATE - .block("rubber_door", (p) -> new DoorBlock(p, RUBBER_SET)) - .initialProperties(() -> Blocks.SPRUCE_DOOR) - .lang("Rubber Door") - .loot((table, block) -> table.add(block, table.createDoorTable(block))) - .addLayer(() -> RenderType::cutout) - .blockstate((ctx, prov) -> prov.doorBlock(ctx.getEntry(), GTCEu.id("block/rubber_door_bottom"), GTCEu.id("block/rubber_door_top"))) - .tag(BlockTags.WOODEN_DOORS) - .item() - .model((ctx, prov) -> prov.generated(ctx)) - .tag(ItemTags.WOODEN_DOORS) - .build() - .register(); - - public static final BlockSetType TREATED_WOOD_SET = BlockSetType.register(new BlockSetType(GTCEu.id("treated_wood").toString())); - public static final WoodType TREATED_WOOD_TYPE = WoodType.register(new WoodType(GTCEu.id("treated_wood").toString(), TREATED_WOOD_SET)); + .block("rubber_door", (p) -> new DoorBlock(p, RUBBER_SET)) + .initialProperties(() -> Blocks.SPRUCE_DOOR) + .lang("Rubber Door") + .loot((table, block) -> table.add(block, table.createDoorTable(block))) + .addLayer(() -> RenderType::cutout) + .blockstate((ctx, prov) -> prov.doorBlock(ctx.getEntry(), GTCEu.id("block/rubber_door_bottom"), + GTCEu.id("block/rubber_door_top"))) + .tag(BlockTags.WOODEN_DOORS) + .item() + .model((ctx, prov) -> prov.generated(ctx)) + .tag(ItemTags.WOODEN_DOORS) + .build() + .register(); + + public static final BlockSetType TREATED_WOOD_SET = BlockSetType + .register(new BlockSetType(GTCEu.id("treated_wood").toString())); + public static final WoodType TREATED_WOOD_TYPE = WoodType + .register(new WoodType(GTCEu.id("treated_wood").toString(), TREATED_WOOD_SET)); public static final BlockEntry TREATED_WOOD_PLANK = REGISTRATE .block("treated_wood_planks", Block::new) @@ -1187,167 +1328,204 @@ public static ItemColor leavesItemColor() { .register(); public static final BlockEntry TREATED_WOOD_SLAB = REGISTRATE - .block("treated_wood_slab", SlabBlock::new) - .initialProperties(() -> Blocks.SPRUCE_SLAB) - .lang("Treated Wood Slab") - .blockstate((ctx, prov) -> prov.slabBlock(ctx.getEntry(), prov.blockTexture(GTBlocks.TREATED_WOOD_PLANK.get()), prov.blockTexture(GTBlocks.TREATED_WOOD_PLANK.get()))) - .tag(BlockTags.WOODEN_SLABS) - .item() - .tag(ItemTags.WOODEN_SLABS) - .onRegister(compassNode(GTCompassSections.GENERATIONS)) - .build() - .register(); + .block("treated_wood_slab", SlabBlock::new) + .initialProperties(() -> Blocks.SPRUCE_SLAB) + .lang("Treated Wood Slab") + .blockstate( + (ctx, prov) -> prov.slabBlock(ctx.getEntry(), prov.blockTexture(GTBlocks.TREATED_WOOD_PLANK.get()), + prov.blockTexture(GTBlocks.TREATED_WOOD_PLANK.get()))) + .tag(BlockTags.WOODEN_SLABS) + .item() + .tag(ItemTags.WOODEN_SLABS) + .onRegister(compassNode(GTCompassSections.GENERATIONS)) + .build() + .register(); public static final BlockEntry TREATED_WOOD_FENCE = REGISTRATE - .block("treated_wood_fence", FenceBlock::new) - .initialProperties(() -> Blocks.SPRUCE_FENCE) - .lang("Treated Wood Fence") - .blockstate((ctx, prov) -> prov.fenceBlock(ctx.getEntry(), prov.blockTexture(TREATED_WOOD_PLANK.get()))) - .tag(BlockTags.WOODEN_FENCES) - .item() - .model((ctx, prov) -> prov.fenceInventory(ctx.getName(), GTBlocks.TREATED_WOOD_PLANK.getId().withPrefix("block/"))) - .tag(ItemTags.WOODEN_FENCES) - .build() - .register(); + .block("treated_wood_fence", FenceBlock::new) + .initialProperties(() -> Blocks.SPRUCE_FENCE) + .lang("Treated Wood Fence") + .blockstate((ctx, prov) -> prov.fenceBlock(ctx.getEntry(), prov.blockTexture(TREATED_WOOD_PLANK.get()))) + .tag(BlockTags.WOODEN_FENCES) + .item() + .model((ctx, prov) -> prov.fenceInventory(ctx.getName(), + GTBlocks.TREATED_WOOD_PLANK.getId().withPrefix("block/"))) + .tag(ItemTags.WOODEN_FENCES) + .build() + .register(); public static final BlockEntry TREATED_WOOD_SIGN = REGISTRATE - .block("treated_wood_sign", (p) -> new GTStandingSignBlock(p, TREATED_WOOD_TYPE)) - .initialProperties(() -> Blocks.SPRUCE_SIGN) - .lang("Treated Wood Sign") - .blockstate((ctx, prov) -> prov.signBlock(ctx.get(), GTBlocks.TREATED_WOOD_WALL_SIGN.get(), prov.blockTexture(GTBlocks.TREATED_WOOD_PLANK.get()))) - .tag(BlockTags.STANDING_SIGNS) - .setData(ProviderType.LANG, NonNullBiConsumer.noop()) - .item((b, p) -> new SignItem(p, b, GTBlocks.TREATED_WOOD_WALL_SIGN.get())) - .defaultModel() - .tag(ItemTags.SIGNS) - .build() - .register(); + .block("treated_wood_sign", (p) -> new GTStandingSignBlock(p, TREATED_WOOD_TYPE)) + .initialProperties(() -> Blocks.SPRUCE_SIGN) + .lang("Treated Wood Sign") + .blockstate((ctx, prov) -> prov.signBlock(ctx.get(), GTBlocks.TREATED_WOOD_WALL_SIGN.get(), + prov.blockTexture(GTBlocks.TREATED_WOOD_PLANK.get()))) + .tag(BlockTags.STANDING_SIGNS) + .setData(ProviderType.LANG, NonNullBiConsumer.noop()) + .item((b, p) -> new SignItem(p, b, GTBlocks.TREATED_WOOD_WALL_SIGN.get())) + .defaultModel() + .tag(ItemTags.SIGNS) + .build() + .register(); public static final BlockEntry TREATED_WOOD_WALL_SIGN = REGISTRATE - .block("treated_wood_wall_sign", (p) -> new GTWallSignBlock(p, TREATED_WOOD_TYPE)) - .initialProperties(() -> Blocks.SPRUCE_WALL_SIGN) - .lang("Treated Wood Wall Sign") - .setData(ProviderType.BLOCKSTATE, NonNullBiConsumer.noop()) - .tag(BlockTags.WALL_SIGNS) - .loot((table, block) -> table.dropOther(block, TREATED_WOOD_SIGN.asItem())) - .register(); + .block("treated_wood_wall_sign", (p) -> new GTWallSignBlock(p, TREATED_WOOD_TYPE)) + .initialProperties(() -> Blocks.SPRUCE_WALL_SIGN) + .lang("Treated Wood Wall Sign") + .setData(ProviderType.BLOCKSTATE, NonNullBiConsumer.noop()) + .tag(BlockTags.WALL_SIGNS) + .loot((table, block) -> table.dropOther(block, TREATED_WOOD_SIGN.asItem())) + .register(); public static final BlockEntry TREATED_WOOD_HANGING_SIGN = REGISTRATE - .block("treated_wood_hanging_sign", (p) -> new GTCeilingHangingSignBlock(p, TREATED_WOOD_TYPE)) - .initialProperties(() -> Blocks.SPRUCE_HANGING_SIGN) - .lang("Treated Wood Hanging Sign") - .blockstate((ctx, prov) -> { - ModelFile model = prov.models().sign(ctx.getName(), prov.blockTexture(GTBlocks.TREATED_WOOD_PLANK.get())); - prov.simpleBlock(ctx.get(), model); - }) - .tag(BlockTags.CEILING_HANGING_SIGNS) - .setData(ProviderType.LANG, NonNullBiConsumer.noop()) - .item((b, p) -> new HangingSignItem(b, GTBlocks.TREATED_WOOD_WALL_HANGING_SIGN.get(), p)) - .defaultModel() - .tag(ItemTags.HANGING_SIGNS) - .setData(ProviderType.LANG, NonNullBiConsumer.noop()) - .build() - .register(); + .block("treated_wood_hanging_sign", (p) -> new GTCeilingHangingSignBlock(p, TREATED_WOOD_TYPE)) + .initialProperties(() -> Blocks.SPRUCE_HANGING_SIGN) + .lang("Treated Wood Hanging Sign") + .blockstate((ctx, prov) -> { + ModelFile model = prov.models().sign(ctx.getName(), + prov.blockTexture(GTBlocks.TREATED_WOOD_PLANK.get())); + prov.simpleBlock(ctx.get(), model); + }) + .tag(BlockTags.CEILING_HANGING_SIGNS) + .setData(ProviderType.LANG, NonNullBiConsumer.noop()) + .item((b, p) -> new HangingSignItem(b, GTBlocks.TREATED_WOOD_WALL_HANGING_SIGN.get(), p)) + .defaultModel() + .tag(ItemTags.HANGING_SIGNS) + .setData(ProviderType.LANG, NonNullBiConsumer.noop()) + .build() + .register(); public static final BlockEntry TREATED_WOOD_WALL_HANGING_SIGN = REGISTRATE - .block("treated_wood_wall_hanging_sign", (p) -> new GTWallHangingSignBlock(p, TREATED_WOOD_TYPE)) - .initialProperties(() -> Blocks.SPRUCE_WALL_HANGING_SIGN) - .lang("Treated Wood Wall Hanging Sign") - .blockstate((ctx, prov) -> { - ModelFile model = prov.models().sign(ctx.getName(), prov.blockTexture(GTBlocks.TREATED_WOOD_PLANK.get())); - prov.simpleBlock(ctx.get(), model); - }) - .tag(BlockTags.WALL_HANGING_SIGNS) - .loot((table, block) -> table.dropOther(block, TREATED_WOOD_HANGING_SIGN.asItem())) - .register(); + .block("treated_wood_wall_hanging_sign", (p) -> new GTWallHangingSignBlock(p, TREATED_WOOD_TYPE)) + .initialProperties(() -> Blocks.SPRUCE_WALL_HANGING_SIGN) + .lang("Treated Wood Wall Hanging Sign") + .blockstate((ctx, prov) -> { + ModelFile model = prov.models().sign(ctx.getName(), + prov.blockTexture(GTBlocks.TREATED_WOOD_PLANK.get())); + prov.simpleBlock(ctx.get(), model); + }) + .tag(BlockTags.WALL_HANGING_SIGNS) + .loot((table, block) -> table.dropOther(block, TREATED_WOOD_HANGING_SIGN.asItem())) + .register(); public static final BlockEntry TREATED_WOOD_PRESSURE_PLATE = REGISTRATE - .block("treated_wood_pressure_plate", (p) -> new PressurePlateBlock(PressurePlateBlock.Sensitivity.EVERYTHING, p, TREATED_WOOD_SET)) - .initialProperties(() -> Blocks.SPRUCE_PRESSURE_PLATE) - .lang("Treated Wood Pressure Plate") - .tag(BlockTags.WOODEN_PRESSURE_PLATES) - .blockstate((ctx, prov) -> prov.pressurePlateBlock(ctx.getEntry(), prov.blockTexture(GTBlocks.TREATED_WOOD_PLANK.get()))) - .item() - .tag(ItemTags.WOODEN_PRESSURE_PLATES) - .build() - .register(); + .block("treated_wood_pressure_plate", + (p) -> new PressurePlateBlock(PressurePlateBlock.Sensitivity.EVERYTHING, p, TREATED_WOOD_SET)) + .initialProperties(() -> Blocks.SPRUCE_PRESSURE_PLATE) + .lang("Treated Wood Pressure Plate") + .tag(BlockTags.WOODEN_PRESSURE_PLATES) + .blockstate((ctx, prov) -> prov.pressurePlateBlock(ctx.getEntry(), + prov.blockTexture(GTBlocks.TREATED_WOOD_PLANK.get()))) + .item() + .tag(ItemTags.WOODEN_PRESSURE_PLATES) + .build() + .register(); public static final BlockEntry TREATED_WOOD_TRAPDOOR = REGISTRATE - .block("treated_wood_trapdoor", (p) -> new TrapDoorBlock(p, RUBBER_SET)) - .initialProperties(() -> Blocks.SPRUCE_TRAPDOOR) - .lang("Treated Wood Trapdoor") - .blockstate((ctx, prov) -> prov.trapdoorBlock(ctx.get(), prov.blockTexture(ctx.get()), true)) - .tag(BlockTags.WOODEN_TRAPDOORS) - .item() - .model((ctx, prov) -> prov.trapdoorOrientableBottom(ctx.getName(), ctx.getId().withPrefix("block/"))) - .tag(ItemTags.WOODEN_TRAPDOORS) - .build() - .register(); + .block("treated_wood_trapdoor", (p) -> new TrapDoorBlock(p, RUBBER_SET)) + .initialProperties(() -> Blocks.SPRUCE_TRAPDOOR) + .lang("Treated Wood Trapdoor") + .blockstate((ctx, prov) -> prov.trapdoorBlock(ctx.get(), prov.blockTexture(ctx.get()), true)) + .tag(BlockTags.WOODEN_TRAPDOORS) + .item() + .model((ctx, prov) -> prov.trapdoorOrientableBottom(ctx.getName(), ctx.getId().withPrefix("block/"))) + .tag(ItemTags.WOODEN_TRAPDOORS) + .build() + .register(); public static final BlockEntry TREATED_WOOD_STAIRS = REGISTRATE - .block("treated_wood_stairs", (p) -> new StairBlock(TREATED_WOOD_PLANK::getDefaultState, p)) - .initialProperties(() -> Blocks.SPRUCE_STAIRS) - .lang("Treated Wood Stairs") - .tag(BlockTags.STAIRS) - .blockstate((ctx, prov) -> prov.stairsBlock(ctx.getEntry(), prov.blockTexture(GTBlocks.TREATED_WOOD_PLANK.get()))) - .item() - .tag(ItemTags.STAIRS) - .build() - .register(); + .block("treated_wood_stairs", (p) -> new StairBlock(TREATED_WOOD_PLANK::getDefaultState, p)) + .initialProperties(() -> Blocks.SPRUCE_STAIRS) + .lang("Treated Wood Stairs") + .tag(BlockTags.STAIRS) + .blockstate((ctx, prov) -> prov.stairsBlock(ctx.getEntry(), + prov.blockTexture(GTBlocks.TREATED_WOOD_PLANK.get()))) + .item() + .tag(ItemTags.STAIRS) + .build() + .register(); public static final BlockEntry TREATED_WOOD_BUTTON = REGISTRATE - .block("treated_wood_button", (p) -> new ButtonBlock(p, TREATED_WOOD_SET, 30, true)) - .initialProperties(() -> Blocks.SPRUCE_BUTTON) - .lang("Treated Wood Button") - .tag(BlockTags.WOODEN_BUTTONS) - .blockstate((ctx, prov) -> prov.buttonBlock(ctx.getEntry(), prov.blockTexture(TREATED_WOOD_PLANK.get()))) - .item() - .model((ctx, prov) -> prov.buttonInventory(ctx.getName(), GTBlocks.TREATED_WOOD_PLANK.getId().withPrefix("block/"))) - .tag(ItemTags.WOODEN_BUTTONS) - .build() - .register(); + .block("treated_wood_button", (p) -> new ButtonBlock(p, TREATED_WOOD_SET, 30, true)) + .initialProperties(() -> Blocks.SPRUCE_BUTTON) + .lang("Treated Wood Button") + .tag(BlockTags.WOODEN_BUTTONS) + .blockstate((ctx, prov) -> prov.buttonBlock(ctx.getEntry(), prov.blockTexture(TREATED_WOOD_PLANK.get()))) + .item() + .model((ctx, prov) -> prov.buttonInventory(ctx.getName(), + GTBlocks.TREATED_WOOD_PLANK.getId().withPrefix("block/"))) + .tag(ItemTags.WOODEN_BUTTONS) + .build() + .register(); public static final BlockEntry TREATED_WOOD_FENCE_GATE = REGISTRATE - .block("treated_wood_fence_gate", (p) -> new FenceGateBlock(p, TREATED_WOOD_TYPE)) - .initialProperties(() -> Blocks.SPRUCE_FENCE_GATE) - .lang("Treated Wood Fence Gate") - .tag(BlockTags.FENCE_GATES) - .blockstate((ctx, prov) -> prov.fenceGateBlock(ctx.getEntry(), prov.blockTexture(GTBlocks.TREATED_WOOD_PLANK.get()))) - .item() - .tag(ItemTags.FENCE_GATES) - .build() - .register(); + .block("treated_wood_fence_gate", (p) -> new FenceGateBlock(p, TREATED_WOOD_TYPE)) + .initialProperties(() -> Blocks.SPRUCE_FENCE_GATE) + .lang("Treated Wood Fence Gate") + .tag(BlockTags.FENCE_GATES) + .blockstate((ctx, prov) -> prov.fenceGateBlock(ctx.getEntry(), + prov.blockTexture(GTBlocks.TREATED_WOOD_PLANK.get()))) + .item() + .tag(ItemTags.FENCE_GATES) + .build() + .register(); public static final BlockEntry TREATED_WOOD_DOOR = REGISTRATE - .block("treated_wood_door", (p) -> new DoorBlock(p, TREATED_WOOD_SET)) - .initialProperties(() -> Blocks.SPRUCE_DOOR) - .lang("Treated Wood Door") - .loot((table, block) -> table.add(block, table.createDoorTable(block))) - .addLayer(() -> RenderType::cutout) - .blockstate((ctx, prov) -> prov.doorBlock(ctx.getEntry(), GTCEu.id("block/treated_wood_door_bottom"), GTCEu.id("block/treated_wood_door_top"))) - .tag(BlockTags.WOODEN_DOORS) - .item() - .model((ctx, prov) -> prov.generated(ctx)) - .tag(ItemTags.WOODEN_DOORS) - .build() - .register(); + .block("treated_wood_door", (p) -> new DoorBlock(p, TREATED_WOOD_SET)) + .initialProperties(() -> Blocks.SPRUCE_DOOR) + .lang("Treated Wood Door") + .loot((table, block) -> table.add(block, table.createDoorTable(block))) + .addLayer(() -> RenderType::cutout) + .blockstate((ctx, prov) -> prov.doorBlock(ctx.getEntry(), GTCEu.id("block/treated_wood_door_bottom"), + GTCEu.id("block/treated_wood_door_top"))) + .tag(BlockTags.WOODEN_DOORS) + .item() + .model((ctx, prov) -> prov.generated(ctx)) + .tag(ItemTags.WOODEN_DOORS) + .build() + .register(); // Decoration Stuff - public static final BlockEntry ACID_HAZARD_SIGN_BLOCK = createCasingBlock("acid_hazard_sign_block", GTCEu.id("block/casings/signs/machine_casing_acidhazard")); - public static final BlockEntry ANTIMATTER_HAZARD_SIGN_BLOCK = createCasingBlock("antimatter_hazard_sign_block", GTCEu.id("block/casings/signs/machine_casing_antimatterhazard")); - public static final BlockEntry BIO_HAZARD_SIGN_BLOCK = createCasingBlock("bio_hazard_sign_block", GTCEu.id("block/casings/signs/machine_casing_biohazard")); - public static final BlockEntry BOSS_HAZARD_SIGN_BLOCK = createCasingBlock("boss_hazard_sign_block", GTCEu.id("block/casings/signs/machine_casing_bosshazard")); - public static final BlockEntry CAUSALITY_HAZARD_SIGN_BLOCK = createCasingBlock("causality_hazard_sign_block", GTCEu.id("block/casings/signs/machine_casing_causalityhazard")); - public static final BlockEntry EXPLOSION_HAZARD_SIGN_BLOCK = createCasingBlock("explosion_hazard_sign_block", GTCEu.id("block/casings/signs/machine_casing_explosionhazard")); - public static final BlockEntry FIRE_HAZARD_SIGN_BLOCK = createCasingBlock("fire_hazard_sign_block", GTCEu.id("block/casings/signs/machine_casing_firehazard")); - public static final BlockEntry FROST_HAZARD_SIGN_BLOCK = createCasingBlock("frost_hazard_sign_block", GTCEu.id("block/casings/signs/machine_casing_frosthazard")); - public static final BlockEntry GENERIC_HAZARD_SIGN_BLOCK = createCasingBlock("generic_hazard_sign_block", GTCEu.id("block/casings/signs/machine_casing_generichazard")); - public static final BlockEntry GREGIFICATION_HAZARD_SIGN_BLOCK = createCasingBlock("gregification_hazard_sign_block", GTCEu.id("block/casings/signs/machine_casing_gregificationhazard")); - public static final BlockEntry HIGH_PRESSURE_HAZARD_SIGN_BLOCK = createCasingBlock("high_pressure_hazard_sign_block", GTCEu.id("block/casings/signs/machine_casing_highpressurehazard")); - public static final BlockEntry HIGH_VOLTAGE_HAZARD_SIGN_BLOCK = createCasingBlock("high_voltage_hazard_sign_block", GTCEu.id("block/casings/signs/machine_casing_highvoltagehazard")); - public static final BlockEntry HIGH_TEMPERATURE_HAZARD_SIGN_BLOCK = createCasingBlock("high_temperature_hazard_sign_block", GTCEu.id("block/casings/signs/machine_casing_hightemperaturehazard")); - public static final BlockEntry LASER_HAZARD_SIGN_BLOCK = createCasingBlock("laser_hazard_sign_block", GTCEu.id("block/casings/signs/machine_casing_laserhazard")); - public static final BlockEntry MAGIC_HAZARD_SIGN_BLOCK = createCasingBlock("magic_hazard_sign_block", GTCEu.id("block/casings/signs/machine_casing_magichazard")); - public static final BlockEntry MAGNETIC_HAZARD_SIGN_BLOCK = createCasingBlock("magnetic_hazard_sign_block", GTCEu.id("block/casings/signs/machine_casing_magneticfieldhazard")); - public static final BlockEntry MOB_INFESTATION_HAZARD_SIGN_BLOCK = createCasingBlock("mob_infestation_hazard_sign_block", GTCEu.id("block/casings/signs/machine_casing_mobhazard")); - public static final BlockEntry MOB_SPAWNER_HAZARD_SIGN_BLOCK = createCasingBlock("mob_spawner_hazard_sign_block", GTCEu.id("block/casings/signs/machine_casing_mobspawnhazard")); - public static final BlockEntry NOISE_HAZARD_SIGN_BLOCK = createCasingBlock("noise_hazard_sign_block", GTCEu.id("block/casings/signs/machine_casing_noisehazard")); - public static final BlockEntry RADIOACTIVE_HAZARD_SIGN_BLOCK = createCasingBlock("radioactive_hazard_sign_block", GTCEu.id("block/casings/signs/machine_casing_radioactivehazard")); - public static final BlockEntry SPATIAL_STORAGE_HAZARD_SIGN_BLOCK = createCasingBlock("spatial_storage_hazard_sign_block", GTCEu.id("block/casings/signs/machine_casing_spatialhazard")); - public static final BlockEntry TURRET_HAZARD_SIGN_BLOCK = createCasingBlock("turret_hazard_sign_block", GTCEu.id("block/casings/signs/machine_casing_turrethazard")); - public static final BlockEntry VOID_HAZARD_SIGN_BLOCK = createCasingBlock("void_hazard_sign_block", GTCEu.id("block/casings/signs/machine_casing_voidhazard")); - public static final BlockEntry YELLOW_STRIPES_BLOCK_A = createCasingBlock("yellow_stripes_block_a", GTCEu.id("block/casings/signs/machine_casing_stripes_a")); - public static final BlockEntry YELLOW_STRIPES_BLOCK_B = createCasingBlock("yellow_stripes_block_b", GTCEu.id("block/casings/signs/machine_casing_stripes_b")); + public static final BlockEntry ACID_HAZARD_SIGN_BLOCK = createCasingBlock("acid_hazard_sign_block", + GTCEu.id("block/casings/signs/machine_casing_acidhazard")); + public static final BlockEntry ANTIMATTER_HAZARD_SIGN_BLOCK = createCasingBlock( + "antimatter_hazard_sign_block", GTCEu.id("block/casings/signs/machine_casing_antimatterhazard")); + public static final BlockEntry BIO_HAZARD_SIGN_BLOCK = createCasingBlock("bio_hazard_sign_block", + GTCEu.id("block/casings/signs/machine_casing_biohazard")); + public static final BlockEntry BOSS_HAZARD_SIGN_BLOCK = createCasingBlock("boss_hazard_sign_block", + GTCEu.id("block/casings/signs/machine_casing_bosshazard")); + public static final BlockEntry CAUSALITY_HAZARD_SIGN_BLOCK = createCasingBlock("causality_hazard_sign_block", + GTCEu.id("block/casings/signs/machine_casing_causalityhazard")); + public static final BlockEntry EXPLOSION_HAZARD_SIGN_BLOCK = createCasingBlock("explosion_hazard_sign_block", + GTCEu.id("block/casings/signs/machine_casing_explosionhazard")); + public static final BlockEntry FIRE_HAZARD_SIGN_BLOCK = createCasingBlock("fire_hazard_sign_block", + GTCEu.id("block/casings/signs/machine_casing_firehazard")); + public static final BlockEntry FROST_HAZARD_SIGN_BLOCK = createCasingBlock("frost_hazard_sign_block", + GTCEu.id("block/casings/signs/machine_casing_frosthazard")); + public static final BlockEntry GENERIC_HAZARD_SIGN_BLOCK = createCasingBlock("generic_hazard_sign_block", + GTCEu.id("block/casings/signs/machine_casing_generichazard")); + public static final BlockEntry GREGIFICATION_HAZARD_SIGN_BLOCK = createCasingBlock( + "gregification_hazard_sign_block", GTCEu.id("block/casings/signs/machine_casing_gregificationhazard")); + public static final BlockEntry HIGH_PRESSURE_HAZARD_SIGN_BLOCK = createCasingBlock( + "high_pressure_hazard_sign_block", GTCEu.id("block/casings/signs/machine_casing_highpressurehazard")); + public static final BlockEntry HIGH_VOLTAGE_HAZARD_SIGN_BLOCK = createCasingBlock( + "high_voltage_hazard_sign_block", GTCEu.id("block/casings/signs/machine_casing_highvoltagehazard")); + public static final BlockEntry HIGH_TEMPERATURE_HAZARD_SIGN_BLOCK = createCasingBlock( + "high_temperature_hazard_sign_block", GTCEu.id("block/casings/signs/machine_casing_hightemperaturehazard")); + public static final BlockEntry LASER_HAZARD_SIGN_BLOCK = createCasingBlock("laser_hazard_sign_block", + GTCEu.id("block/casings/signs/machine_casing_laserhazard")); + public static final BlockEntry MAGIC_HAZARD_SIGN_BLOCK = createCasingBlock("magic_hazard_sign_block", + GTCEu.id("block/casings/signs/machine_casing_magichazard")); + public static final BlockEntry MAGNETIC_HAZARD_SIGN_BLOCK = createCasingBlock("magnetic_hazard_sign_block", + GTCEu.id("block/casings/signs/machine_casing_magneticfieldhazard")); + public static final BlockEntry MOB_INFESTATION_HAZARD_SIGN_BLOCK = createCasingBlock( + "mob_infestation_hazard_sign_block", GTCEu.id("block/casings/signs/machine_casing_mobhazard")); + public static final BlockEntry MOB_SPAWNER_HAZARD_SIGN_BLOCK = createCasingBlock( + "mob_spawner_hazard_sign_block", GTCEu.id("block/casings/signs/machine_casing_mobspawnhazard")); + public static final BlockEntry NOISE_HAZARD_SIGN_BLOCK = createCasingBlock("noise_hazard_sign_block", + GTCEu.id("block/casings/signs/machine_casing_noisehazard")); + public static final BlockEntry RADIOACTIVE_HAZARD_SIGN_BLOCK = createCasingBlock( + "radioactive_hazard_sign_block", GTCEu.id("block/casings/signs/machine_casing_radioactivehazard")); + public static final BlockEntry SPATIAL_STORAGE_HAZARD_SIGN_BLOCK = createCasingBlock( + "spatial_storage_hazard_sign_block", GTCEu.id("block/casings/signs/machine_casing_spatialhazard")); + public static final BlockEntry TURRET_HAZARD_SIGN_BLOCK = createCasingBlock("turret_hazard_sign_block", + GTCEu.id("block/casings/signs/machine_casing_turrethazard")); + public static final BlockEntry VOID_HAZARD_SIGN_BLOCK = createCasingBlock("void_hazard_sign_block", + GTCEu.id("block/casings/signs/machine_casing_voidhazard")); + public static final BlockEntry YELLOW_STRIPES_BLOCK_A = createCasingBlock("yellow_stripes_block_a", + GTCEu.id("block/casings/signs/machine_casing_stripes_a")); + public static final BlockEntry YELLOW_STRIPES_BLOCK_B = createCasingBlock("yellow_stripes_block_b", + GTCEu.id("block/casings/signs/machine_casing_stripes_b")); public static Table> STONE_BLOCKS; @@ -1365,24 +1543,33 @@ public static void generateStoneBlocks() { String blockId = type.blockId.formatted(strata.getSerializedName()); if (BuiltInRegistries.BLOCK.containsKey(new ResourceLocation(blockId))) continue; var entry = REGISTRATE.block(blockId, Block::new) - .initialProperties(() -> Blocks.STONE) - .properties(p -> p.strength(type.hardness, type.resistance).mapColor(strata.mapColor)) - .transform(type == StoneBlockType.STONE ? GTBlocks.unificationBlock(strata.getTagPrefix(), strata.getMaterial()) : builder2 -> builder2) - .tag(BlockTags.MINEABLE_WITH_PICKAXE, CustomTags.NEEDS_WOOD_TOOL) - .loot((tables, block) -> { - if (type == StoneBlockType.STONE) { - tables.add(block, tables.createSingleItemTableWithSilkTouch(block, STONE_BLOCKS.get(StoneBlockType.COBBLE, strata).get())); - } else { - tables.add(block, tables.createSingleItemTable(block)); - } - }) - .item() - .build(); + .initialProperties(() -> Blocks.STONE) + .properties(p -> p.strength(type.hardness, type.resistance).mapColor(strata.mapColor)) + .transform(type == StoneBlockType.STONE ? + GTBlocks.unificationBlock(strata.getTagPrefix(), strata.getMaterial()) : + builder2 -> builder2) + .tag(BlockTags.MINEABLE_WITH_PICKAXE, CustomTags.NEEDS_WOOD_TOOL) + .loot((tables, block) -> { + if (type == StoneBlockType.STONE) { + tables.add(block, tables.createSingleItemTableWithSilkTouch(block, + STONE_BLOCKS.get(StoneBlockType.COBBLE, strata).get())); + } else { + tables.add(block, tables.createSingleItemTable(block)); + } + }) + .item() + .build(); if (type == StoneBlockType.STONE && strata.isNatural()) { - entry.tag(BlockTags.STONE_ORE_REPLACEABLES, BlockTags.BASE_STONE_OVERWORLD, BlockTags.DRIPSTONE_REPLACEABLE, BlockTags.MOSS_REPLACEABLE) - .blockstate(GTModels.randomRotatedModel(GTCEu.id(ModelProvider.BLOCK_FOLDER + "/stones/" + strata.getSerializedName() + "/" + type.id))); + entry.tag(BlockTags.STONE_ORE_REPLACEABLES, BlockTags.BASE_STONE_OVERWORLD, + BlockTags.DRIPSTONE_REPLACEABLE, BlockTags.MOSS_REPLACEABLE) + .blockstate(GTModels.randomRotatedModel(GTCEu.id(ModelProvider.BLOCK_FOLDER + "/stones/" + + strata.getSerializedName() + "/" + type.id))); } else { - entry.blockstate((ctx, prov) -> prov.simpleBlock(ctx.getEntry(), prov.models().singleTexture(ctx.getName(), prov.mcLoc(ModelProvider.BLOCK_FOLDER + "/cube_all"), "all", prov.modLoc(ModelProvider.BLOCK_FOLDER + "/stones/" + strata.getSerializedName() + "/" + type.id)))); + entry.blockstate((ctx, prov) -> prov.simpleBlock(ctx.getEntry(), + prov.models().singleTexture(ctx.getName(), + prov.mcLoc(ModelProvider.BLOCK_FOLDER + "/cube_all"), "all", + prov.modLoc(ModelProvider.BLOCK_FOLDER + "/stones/" + strata.getSerializedName() + + "/" + type.id)))); } builder.put(type, strata, entry.register()); } @@ -1396,26 +1583,26 @@ public static void generateStoneBlocks() { } public static final BlockEntry FOAM = REGISTRATE - .block("foam", Block::new) - .initialProperties(() -> Blocks.SLIME_BLOCK) - .lang("Foam") - .item() - .build() - .register(); + .block("foam", Block::new) + .initialProperties(() -> Blocks.SLIME_BLOCK) + .lang("Foam") + .item() + .build() + .register(); public static final BlockEntry PETRIFIED_FOAM = REGISTRATE - .block("petrified_foam", Block::new) - .initialProperties(() -> Blocks.STONE) - .lang("Petrified Foam") - .item() - .build() - .register(); + .block("petrified_foam", Block::new) + .initialProperties(() -> Blocks.STONE) + .lang("Petrified Foam") + .item() + .build() + .register(); public static final BlockEntry REINFORCED_STONE = REGISTRATE - .block("reinforced_stone", Block::new) - .initialProperties(() -> Blocks.STONE) - .lang("Reinforced Stone") - .item() - .build() - .register(); + .block("reinforced_stone", Block::new) + .initialProperties(() -> Blocks.STONE) + .lang("Reinforced Stone") + .item() + .build() + .register(); // Lamps @SuppressWarnings("unchecked") @@ -1425,13 +1612,15 @@ public static void generateStoneBlocks() { for (int i = 0; i < colors.length; i++) { var dyeColor = colors[i]; LAMPS[i] = REGISTRATE.block("%s_lamp".formatted(dyeColor.getName()), Block::new) - .initialProperties(() -> Blocks.GLOWSTONE) - .simpleItem() - .register(); + .initialProperties(() -> Blocks.GLOWSTONE) + .simpleItem() + .register(); } } - public static > NonNullFunction unificationBlock(@NotNull TagPrefix tagPrefix, @NotNull Material mat) { + public static > NonNullFunction unificationBlock(@NotNull TagPrefix tagPrefix, + @NotNull Material mat) { return builder -> { builder.onRegister(block -> { Supplier blockSupplier = SupplierMemoizer.memoizeBlockSupplier(() -> block); @@ -1447,7 +1636,8 @@ public static NonNullConsumer compassNode(CompassSection return item -> CompassNode.getOrCreate(section, item::asItem).addPreNode(preNodes); } - public static NonNullConsumer compassNodeExist(CompassSection section, String node, CompassNode... preNodes) { + public static NonNullConsumer compassNodeExist(CompassSection section, String node, + CompassNode... preNodes) { return item -> CompassNode.getOrCreate(section, node).addPreNode(preNodes).addItem(item::asItem); } @@ -1482,11 +1672,13 @@ public static void init() { } public static boolean doMetalPipe(Material material) { - return GTValues.FOOLS.get() && material.hasProperty(PropertyKey.INGOT) && !material.hasProperty(PropertyKey.POLYMER) && !material.hasProperty(PropertyKey.WOOD); + return GTValues.FOOLS.get() && material.hasProperty(PropertyKey.INGOT) && + !material.hasProperty(PropertyKey.POLYMER) && !material.hasProperty(PropertyKey.WOOD); } /** * kinda nasty block property copy function because one doesn't exist. + * * @param props the props to copy * @return a shallow copy of the block properties like {@link BlockBehaviour.Properties#copy(BlockBehaviour)} does */ @@ -1494,30 +1686,31 @@ public static BlockBehaviour.Properties copy(BlockBehaviour.Properties props, Bl if (props == null) { return newProps; } - newProps.destroyTime(((BlockPropertiesAccessor)props).getDestroyTime()); - newProps.explosionResistance(((BlockPropertiesAccessor)props).getExplosionResistance()); - if (!((BlockPropertiesAccessor)props).isHasCollision()) newProps.noCollission(); - if (((BlockPropertiesAccessor)props).isIsRandomlyTicking()) newProps.randomTicks(); - newProps.lightLevel(((BlockPropertiesAccessor)props).getLightEmission()); - newProps.mapColor(((BlockPropertiesAccessor)props).getMapColor()); - newProps.sound(((BlockPropertiesAccessor)props).getSoundType()); - newProps.friction(((BlockPropertiesAccessor)props).getFriction()); - newProps.speedFactor(((BlockPropertiesAccessor)props).getSpeedFactor()); - if (((BlockPropertiesAccessor)props).isDynamicShape()) newProps.dynamicShape(); - if (!((BlockPropertiesAccessor)props).isCanOcclude()) newProps.noOcclusion(); - if (((BlockPropertiesAccessor)props).isIsAir()) newProps.air(); - if (((BlockPropertiesAccessor)props).isIgnitedByLava()) newProps.ignitedByLava(); - if (((BlockPropertiesAccessor)props).isLiquid()) newProps.liquid(); - if (((BlockPropertiesAccessor)props).isForceSolidOff()) newProps.forceSolidOff(); - if (((BlockPropertiesAccessor)props).isForceSolidOn()) newProps.forceSolidOn(); - newProps.pushReaction(((BlockPropertiesAccessor)props).getPushReaction()); - if (((BlockPropertiesAccessor)props).isRequiresCorrectToolForDrops()) newProps.requiresCorrectToolForDrops(); - ((BlockPropertiesAccessor)newProps).setOffsetFunction(((BlockPropertiesAccessor)props).getOffsetFunction()); - if (!((BlockPropertiesAccessor)props).isSpawnParticlesOnBreak()) newProps.noParticlesOnBreak(); - ((BlockPropertiesAccessor)newProps).setRequiredFeatures(((BlockPropertiesAccessor)props).getRequiredFeatures()); - newProps.emissiveRendering(((BlockPropertiesAccessor)props).getEmissiveRendering()); - newProps.instrument(((BlockPropertiesAccessor)props).getInstrument()); - if (((BlockPropertiesAccessor)props).isReplaceable()) newProps.replaceable(); + newProps.destroyTime(((BlockPropertiesAccessor) props).getDestroyTime()); + newProps.explosionResistance(((BlockPropertiesAccessor) props).getExplosionResistance()); + if (!((BlockPropertiesAccessor) props).isHasCollision()) newProps.noCollission(); + if (((BlockPropertiesAccessor) props).isIsRandomlyTicking()) newProps.randomTicks(); + newProps.lightLevel(((BlockPropertiesAccessor) props).getLightEmission()); + newProps.mapColor(((BlockPropertiesAccessor) props).getMapColor()); + newProps.sound(((BlockPropertiesAccessor) props).getSoundType()); + newProps.friction(((BlockPropertiesAccessor) props).getFriction()); + newProps.speedFactor(((BlockPropertiesAccessor) props).getSpeedFactor()); + if (((BlockPropertiesAccessor) props).isDynamicShape()) newProps.dynamicShape(); + if (!((BlockPropertiesAccessor) props).isCanOcclude()) newProps.noOcclusion(); + if (((BlockPropertiesAccessor) props).isIsAir()) newProps.air(); + if (((BlockPropertiesAccessor) props).isIgnitedByLava()) newProps.ignitedByLava(); + if (((BlockPropertiesAccessor) props).isLiquid()) newProps.liquid(); + if (((BlockPropertiesAccessor) props).isForceSolidOff()) newProps.forceSolidOff(); + if (((BlockPropertiesAccessor) props).isForceSolidOn()) newProps.forceSolidOn(); + newProps.pushReaction(((BlockPropertiesAccessor) props).getPushReaction()); + if (((BlockPropertiesAccessor) props).isRequiresCorrectToolForDrops()) newProps.requiresCorrectToolForDrops(); + ((BlockPropertiesAccessor) newProps).setOffsetFunction(((BlockPropertiesAccessor) props).getOffsetFunction()); + if (!((BlockPropertiesAccessor) props).isSpawnParticlesOnBreak()) newProps.noParticlesOnBreak(); + ((BlockPropertiesAccessor) newProps) + .setRequiredFeatures(((BlockPropertiesAccessor) props).getRequiredFeatures()); + newProps.emissiveRendering(((BlockPropertiesAccessor) props).getEmissiveRendering()); + newProps.instrument(((BlockPropertiesAccessor) props).getInstrument()); + if (((BlockPropertiesAccessor) props).isReplaceable()) newProps.replaceable(); return newProps; } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTCommandArguments.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTCommandArguments.java new file mode 100644 index 0000000000..f330235d72 --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTCommandArguments.java @@ -0,0 +1,27 @@ +package com.gregtechceu.gtceu.common.data; + +import com.gregtechceu.gtceu.GTCEu; +import com.gregtechceu.gtceu.common.commands.arguments.MaterialArgument; + +import net.minecraft.commands.synchronization.ArgumentTypeInfo; +import net.minecraft.commands.synchronization.ArgumentTypeInfos; +import net.minecraft.commands.synchronization.SingletonArgumentInfo; +import net.minecraft.core.registries.Registries; +import net.minecraftforge.eventbus.api.IEventBus; +import net.minecraftforge.registries.DeferredRegister; +import net.minecraftforge.registries.RegistryObject; + +public class GTCommandArguments { + + private static final DeferredRegister> COMMAND_ARGUMENT_TYPES = DeferredRegister + .create(Registries.COMMAND_ARGUMENT_TYPE, GTCEu.MOD_ID); + + private static final RegistryObject> MATERIAL_ARGUMENT_TYPE = COMMAND_ARGUMENT_TYPES + .register( + "material", () -> ArgumentTypeInfos.registerByClass(MaterialArgument.class, + SingletonArgumentInfo.contextFree(MaterialArgument::material))); + + public static void init(IEventBus modBus) { + COMMAND_ARGUMENT_TYPES.register(modBus); + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTCompassNodes.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTCompassNodes.java index 7156f5e6b9..8b4762703b 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTCompassNodes.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTCompassNodes.java @@ -2,7 +2,9 @@ import com.gregtechceu.gtceu.api.data.tag.TagPrefix; import com.gregtechceu.gtceu.api.registry.registrate.CompassNode; + import com.lowdragmc.lowdraglib.gui.texture.ItemStackTexture; + import net.minecraft.world.item.Items; /** @@ -11,6 +13,7 @@ * @implNote GTCompassNodes */ public class GTCompassNodes { + public final static CompassNode COVER = CompassNode.getOrCreate(GTCompassSections.COVERS, "cover") .icon(() -> new ItemStackTexture(GTItems.ITEM_FILTER.asStack())) .position(50, 100) @@ -29,7 +32,5 @@ public class GTCompassNodes { .size(40) .lang("Steam Age"); - public static void init() { - - } + public static void init() {} } diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTCompassSections.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTCompassSections.java index ddd74f88d8..fa7e674da5 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTCompassSections.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTCompassSections.java @@ -6,6 +6,7 @@ import com.gregtechceu.gtceu.api.item.tool.GTToolType; import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.api.registry.registrate.CompassSection; + import com.lowdragmc.lowdraglib.gui.texture.ItemStackTexture; import java.util.Locale; @@ -111,7 +112,6 @@ public class GTCompassSections { .register(); } } - public static void init() { - } + public static void init() {} } diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTConfiguredFeatures.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTConfiguredFeatures.java index 9590b94f66..463e1f6c28 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTConfiguredFeatures.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTConfiguredFeatures.java @@ -3,6 +3,7 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.common.worldgen.feature.configurations.FluidSproutConfiguration; import com.gregtechceu.gtceu.common.worldgen.feature.configurations.StoneBlobConfiguration; + import net.minecraft.core.registries.Registries; import net.minecraft.data.worldgen.BootstapContext; import net.minecraft.data.worldgen.features.FeatureUtils; @@ -26,25 +27,34 @@ * @implNote GTConfiguredFeatures */ public class GTConfiguredFeatures { - public static final ResourceKey> RUBBER = ResourceKey.create(Registries.CONFIGURED_FEATURE, GTCEu.id("rubber_tree")); - public static final ResourceKey> RED_GRANITE_BLOB = ResourceKey.create(Registries.CONFIGURED_FEATURE, GTCEu.id("red_granite_blob")); - public static final ResourceKey> MARBLE_BLOB = ResourceKey.create(Registries.CONFIGURED_FEATURE, GTCEu.id("marble_blob")); - public static final ResourceKey> RAW_OIL_SPROUT = ResourceKey.create(Registries.CONFIGURED_FEATURE, GTCEu.id("raw_oil_sprout")); + + public static final ResourceKey> RUBBER = ResourceKey.create(Registries.CONFIGURED_FEATURE, + GTCEu.id("rubber_tree")); + public static final ResourceKey> RED_GRANITE_BLOB = ResourceKey + .create(Registries.CONFIGURED_FEATURE, GTCEu.id("red_granite_blob")); + public static final ResourceKey> MARBLE_BLOB = ResourceKey + .create(Registries.CONFIGURED_FEATURE, GTCEu.id("marble_blob")); + public static final ResourceKey> RAW_OIL_SPROUT = ResourceKey + .create(Registries.CONFIGURED_FEATURE, GTCEu.id("raw_oil_sprout")); public static void bootstrap(BootstapContext> ctx) { FeatureUtils.register(ctx, RUBBER, Feature.TREE, new TreeConfiguration.TreeConfigurationBuilder( - BlockStateProvider.simple(GTBlocks.RUBBER_LOG.get().changeNatural(GTBlocks.RUBBER_LOG.getDefaultState(), true)), + BlockStateProvider + .simple(GTBlocks.RUBBER_LOG.get().changeNatural(GTBlocks.RUBBER_LOG.getDefaultState(), true)), new ForkingTrunkPlacer(5, 1, 3), BlockStateProvider.simple(GTBlocks.RUBBER_LEAVES.get()), new MegaJungleFoliagePlacer(ConstantInt.of(1), UniformInt.of(0, 1), 1), new TwoLayersFeatureSize(1, 0, 2)).ignoreVines().build()); FeatureUtils.register(ctx, RED_GRANITE_BLOB, GTFeatures.STONE_BLOB.get(), - new StoneBlobConfiguration(OreConfiguration.target(new TagMatchTest(BlockTags.STONE_ORE_REPLACEABLES), GTBlocks.RED_GRANITE.getDefaultState()), UniformInt.of(20, 30))); + new StoneBlobConfiguration(OreConfiguration.target(new TagMatchTest(BlockTags.STONE_ORE_REPLACEABLES), + GTBlocks.RED_GRANITE.getDefaultState()), UniformInt.of(20, 30))); FeatureUtils.register(ctx, MARBLE_BLOB, GTFeatures.STONE_BLOB.get(), - new StoneBlobConfiguration(OreConfiguration.target(new TagMatchTest(BlockTags.STONE_ORE_REPLACEABLES), GTBlocks.MARBLE.getDefaultState()), UniformInt.of(20, 30))); + new StoneBlobConfiguration(OreConfiguration.target(new TagMatchTest(BlockTags.STONE_ORE_REPLACEABLES), + GTBlocks.MARBLE.getDefaultState()), UniformInt.of(20, 30))); FeatureUtils.register(ctx, RAW_OIL_SPROUT, GTFeatures.FLUID_SPROUT.get(), - new FluidSproutConfiguration(GTMaterials.RawOil.getFluid(), UniformInt.of(9, 13), UniformInt.of(6, 9), 0.4f)); + new FluidSproutConfiguration(GTMaterials.RawOil.getFluid(), UniformInt.of(9, 13), UniformInt.of(6, 9), + 0.4f)); } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTCovers.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTCovers.java index 5276310a38..d743e72068 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTCovers.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTCovers.java @@ -6,7 +6,6 @@ import com.gregtechceu.gtceu.api.addon.AddonFinder; import com.gregtechceu.gtceu.api.addon.IGTAddon; import com.gregtechceu.gtceu.api.cover.CoverDefinition; -import com.gregtechceu.gtceu.api.data.chemical.Element; import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.client.renderer.cover.*; import com.gregtechceu.gtceu.common.cover.*; @@ -15,9 +14,11 @@ import com.gregtechceu.gtceu.common.cover.voiding.AdvancedItemVoidingCover; import com.gregtechceu.gtceu.common.cover.voiding.FluidVoidingCover; import com.gregtechceu.gtceu.common.cover.voiding.ItemVoidingCover; -import it.unimi.dsi.fastutil.ints.Int2ObjectFunction; + import net.minecraftforge.fml.ModLoader; +import it.unimi.dsi.fastutil.ints.Int2ObjectFunction; + import java.util.Arrays; import java.util.Locale; @@ -28,8 +29,10 @@ */ public class GTCovers { - public static final int[] ALL_TIERS = GTValues.tiersBetween(GTValues.LV, GTCEuAPI.isHighTier() ? GTValues.OpV : GTValues.UV); - public static final int[] ALL_TIERS_WITH_ULV = GTValues.tiersBetween(GTValues.ULV, GTCEuAPI.isHighTier() ? GTValues.OpV : GTValues.UV); + public static final int[] ALL_TIERS = GTValues.tiersBetween(GTValues.LV, + GTCEuAPI.isHighTier() ? GTValues.OpV : GTValues.UV); + public static final int[] ALL_TIERS_WITH_ULV = GTValues.tiersBetween(GTValues.ULV, + GTCEuAPI.isHighTier() ? GTValues.OpV : GTValues.UV); static { GTRegistries.COVERS.unfreeze(); @@ -37,145 +40,124 @@ public class GTCovers { public final static CoverDefinition FACADE = register( "facade", FacadeCover::new, - FacadeCoverRenderer.INSTANCE - ); + FacadeCoverRenderer.INSTANCE); public final static CoverDefinition ITEM_FILTER = register( "item_filter", ItemFilterCover::new, - new SimpleCoverRenderer(GTCEu.id("block/cover/overlay_item_filter")) - ); + new SimpleCoverRenderer(GTCEu.id("block/cover/overlay_item_filter"))); public final static CoverDefinition FLUID_FILTER = register( "fluid_filter", FluidFilterCover::new, - new SimpleCoverRenderer(GTCEu.id("block/cover/overlay_fluid_filter")) - ); + new SimpleCoverRenderer(GTCEu.id("block/cover/overlay_fluid_filter"))); public final static CoverDefinition INFINITE_WATER = register( "infinite_water", InfiniteWaterCover::new, - new SimpleCoverRenderer(GTCEu.id("block/cover/overlay_infinite_water")) - ); + new SimpleCoverRenderer(GTCEu.id("block/cover/overlay_infinite_water"))); public final static CoverDefinition SHUTTER = register( - "shutter", ShutterCover::new, - new SimpleCoverRenderer(GTCEu.id("block/cover/overlay_shutter")) - ); + "shutter", ShutterCover::new, + new SimpleCoverRenderer(GTCEu.id("block/cover/overlay_shutter"))); public final static CoverDefinition[] CONVEYORS = registerTiered( "conveyor", ConveyorCover::new, - tier -> ConveyorCoverRenderer.INSTANCE, ALL_TIERS - ); + tier -> ConveyorCoverRenderer.INSTANCE, ALL_TIERS); public final static CoverDefinition[] ROBOT_ARMS = registerTiered( "robot_arm", RobotArmCover::new, - tier -> RobotArmCoverRenderer.INSTANCE, ALL_TIERS - ); + tier -> RobotArmCoverRenderer.INSTANCE, ALL_TIERS); public final static CoverDefinition[] PUMPS = registerTiered( "pump", PumpCover::new, - tier -> PumpCoverRenderer.INSTANCE, ALL_TIERS - ); + tier -> PumpCoverRenderer.INSTANCE, ALL_TIERS); public final static CoverDefinition[] FLUID_REGULATORS = registerTiered( "fluid_regulator", FluidRegulatorCover::new, - tier -> FluidRegulatorCoverRenderer.INSTANCE, ALL_TIERS - ); + tier -> FluidRegulatorCoverRenderer.INSTANCE, ALL_TIERS); public final static CoverDefinition COMPUTER_MONITOR = register( "computer_monitor", ComputerMonitorCover::new, - new SimpleCoverRenderer(GTCEu.id("block/cover/overlay_display")) - ); + new SimpleCoverRenderer(GTCEu.id("block/cover/overlay_display"))); public final static CoverDefinition MACHINE_CONTROLLER = register( "machine_controller", MachineControllerCover::new, - new SimpleCoverRenderer(GTCEu.id("block/cover/overlay_controller")) - ); - + new SimpleCoverRenderer(GTCEu.id("block/cover/overlay_controller"))); // Voiding public final static CoverDefinition ITEM_VOIDING = register( "item_voiding", ItemVoidingCover::new, - new SimpleCoverRenderer(GTCEu.id("block/cover/overlay_item_voiding")) - ); + new SimpleCoverRenderer(GTCEu.id("block/cover/overlay_item_voiding"))); public final static CoverDefinition ITEM_VOIDING_ADVANCED = register( "item_voiding_advanced", AdvancedItemVoidingCover::new, - new SimpleCoverRenderer(GTCEu.id("block/cover/overlay_item_voiding_advanced")) - ); + new SimpleCoverRenderer(GTCEu.id("block/cover/overlay_item_voiding_advanced"))); public final static CoverDefinition FLUID_VOIDING = register( "fluid_voiding", FluidVoidingCover::new, - new SimpleCoverRenderer(GTCEu.id("block/cover/overlay_fluid_voiding")) - ); + new SimpleCoverRenderer(GTCEu.id("block/cover/overlay_fluid_voiding"))); public final static CoverDefinition FLUID_VOIDING_ADVANCED = register( "fluid_voiding_advanced", AdvancedFluidVoidingCover::new, - new SimpleCoverRenderer(GTCEu.id("block/cover/overlay_fluid_voiding_advanced")) - ); - + new SimpleCoverRenderer(GTCEu.id("block/cover/overlay_fluid_voiding_advanced"))); // Detectors public final static CoverDefinition ACTIVITY_DETECTOR = register( "activity_detector", ActivityDetectorCover::new, - new SimpleCoverRenderer(GTCEu.id("block/cover/overlay_activity_detector")) - ); + new SimpleCoverRenderer(GTCEu.id("block/cover/overlay_activity_detector"))); public final static CoverDefinition ACTIVITY_DETECTOR_ADVANCED = register( "activity_detector_advanced", AdvancedActivityDetectorCover::new, - new SimpleCoverRenderer(GTCEu.id("block/cover/overlay_activity_detector_advanced")) - ); + new SimpleCoverRenderer(GTCEu.id("block/cover/overlay_activity_detector_advanced"))); public final static CoverDefinition FLUID_DETECTOR = register( "fluid_detector", FluidDetectorCover::new, - new SimpleCoverRenderer(GTCEu.id("block/cover/overlay_fluid_detector")) - ); + new SimpleCoverRenderer(GTCEu.id("block/cover/overlay_fluid_detector"))); public final static CoverDefinition FLUID_DETECTOR_ADVANCED = register( "fluid_detector_advanced", AdvancedFluidDetectorCover::new, - new SimpleCoverRenderer(GTCEu.id("block/cover/overlay_fluid_detector_advanced")) - ); + new SimpleCoverRenderer(GTCEu.id("block/cover/overlay_fluid_detector_advanced"))); public final static CoverDefinition ITEM_DETECTOR = register( "item_detector", ItemDetectorCover::new, - new SimpleCoverRenderer(GTCEu.id("block/cover/overlay_item_detector")) - ); + new SimpleCoverRenderer(GTCEu.id("block/cover/overlay_item_detector"))); public final static CoverDefinition ITEM_DETECTOR_ADVANCED = register( "item_detector_advanced", AdvancedItemDetectorCover::new, - new SimpleCoverRenderer(GTCEu.id("block/cover/overlay_item_detector_advanced")) - ); + new SimpleCoverRenderer(GTCEu.id("block/cover/overlay_item_detector_advanced"))); public final static CoverDefinition ENERGY_DETECTOR = register( "energy_detector", EnergyDetectorCover::new, - new SimpleCoverRenderer(GTCEu.id("block/cover/overlay_energy_detector")) - ); + new SimpleCoverRenderer(GTCEu.id("block/cover/overlay_energy_detector"))); public final static CoverDefinition ENERGY_DETECTOR_ADVANCED = register( "energy_detector_advanced", AdvancedEnergyDetectorCover::new, - new SimpleCoverRenderer(GTCEu.id("block/cover/overlay_energy_detector_advanced")) - ); + new SimpleCoverRenderer(GTCEu.id("block/cover/overlay_energy_detector_advanced"))); public final static CoverDefinition MAINTENANCE_DETECTOR = register( "maintenance_detector", MaintenanceDetectorCover::new, - new SimpleCoverRenderer(GTCEu.id("block/cover/overlay_maintenance_detector")) - ); + new SimpleCoverRenderer(GTCEu.id("block/cover/overlay_maintenance_detector"))); // Solar Panels public final static CoverDefinition[] SOLAR_PANEL = registerTiered( "solar_panel", CoverSolarPanel::new, - tier -> new SimpleCoverRenderer(GTCEu.id("block/cover/overlay_solar_panel")), ALL_TIERS_WITH_ULV - ); + tier -> new SimpleCoverRenderer(GTCEu.id("block/cover/overlay_solar_panel")), ALL_TIERS_WITH_ULV); /////////////////////////////////////////////// - //*********** UTIL METHODS ***********// + // *********** UTIL METHODS ***********// /////////////////////////////////////////////// public static CoverDefinition register(String id, CoverDefinition.CoverBehaviourProvider behaviorCreator) { return register(id, behaviorCreator, new SimpleCoverRenderer(GTCEu.id("block/cover/" + id))); } - public static CoverDefinition register(String id, CoverDefinition.CoverBehaviourProvider behaviorCreator, ICoverRenderer coverRenderer) { + public static CoverDefinition register(String id, CoverDefinition.CoverBehaviourProvider behaviorCreator, + ICoverRenderer coverRenderer) { var definition = new CoverDefinition(GTCEu.id(id), behaviorCreator, coverRenderer); GTRegistries.COVERS.register(GTCEu.id(id), definition); return definition; } - public static CoverDefinition[] registerTiered(String id, CoverDefinition.TieredCoverBehaviourProvider behaviorCreator, Int2ObjectFunction coverRenderer, int... tiers) { + public static CoverDefinition[] registerTiered(String id, + CoverDefinition.TieredCoverBehaviourProvider behaviorCreator, + Int2ObjectFunction coverRenderer, int... tiers) { return Arrays.stream(tiers).mapToObj(tier -> { var name = id + "." + GTValues.VN[tier].toLowerCase(Locale.ROOT); - return register(name, (def, coverable, side) -> behaviorCreator.create(def, coverable, side, tier), coverRenderer.apply(tier)); + return register(name, (def, coverable, side) -> behaviorCreator.create(def, coverable, side, tier), + coverRenderer.apply(tier)); }).toArray(CoverDefinition[]::new); } - public static CoverDefinition[] registerTiered(String id, CoverDefinition.TieredCoverBehaviourProvider behaviorCreator, int... tiers) { + public static CoverDefinition[] registerTiered(String id, + CoverDefinition.TieredCoverBehaviourProvider behaviorCreator, + int... tiers) { return Arrays.stream(tiers).mapToObj(tier -> { var name = id + "." + GTValues.VN[tier].toLowerCase(Locale.ROOT); return register(name, (def, coverable, side) -> behaviorCreator.create(def, coverable, side, tier)); diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTCreativeModeTabs.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTCreativeModeTabs.java index 759f3037af..db89b5271e 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTCreativeModeTabs.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTCreativeModeTabs.java @@ -3,19 +3,19 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.data.chemical.ChemicalHelper; +import com.gregtechceu.gtceu.api.data.tag.TagPrefix; import com.gregtechceu.gtceu.api.item.IComponentItem; import com.gregtechceu.gtceu.api.item.IGTTool; -import com.gregtechceu.gtceu.api.item.armor.ArmorComponentItem; import com.gregtechceu.gtceu.api.item.tool.GTToolType; import com.gregtechceu.gtceu.api.item.tool.ToolHelper; -import com.gregtechceu.gtceu.api.data.tag.TagPrefix; import com.gregtechceu.gtceu.api.registry.registrate.GTRegistrate; import com.gregtechceu.gtceu.common.pipelike.cable.Insulation; -import com.tterrag.registrate.util.entry.RegistryEntry; + import net.minecraft.core.NonNullList; import net.minecraft.core.registries.Registries; import net.minecraft.world.item.*; +import com.tterrag.registrate.util.entry.RegistryEntry; import org.jetbrains.annotations.NotNull; import static com.gregtechceu.gtceu.common.registry.GTRegistration.REGISTRATE; @@ -27,10 +27,12 @@ */ @SuppressWarnings("Convert2MethodRef") public class GTCreativeModeTabs { + public static RegistryEntry MATERIAL_FLUID = REGISTRATE.defaultCreativeTab("material_fluid", builder -> builder.displayItems(new RegistrateDisplayItemsGenerator("material_fluid", REGISTRATE)) .icon(() -> GTItems.FLUID_CELL.asStack()) - .title(REGISTRATE.addLang("itemGroup", GTCEu.id("material_fluid"), GTCEu.NAME + " Material Fluid Containers")) + .title(REGISTRATE.addLang("itemGroup", GTCEu.id("material_fluid"), + GTCEu.NAME + " Material Fluid Containers")) .build()) .register(); public static RegistryEntry MATERIAL_ITEM = REGISTRATE.defaultCreativeTab("material_item", @@ -76,9 +78,7 @@ public class GTCreativeModeTabs { .build()) .register(); - public static void init() { - - } + public static void init() {} public static class RegistrateDisplayItemsGenerator implements CreativeModeTab.DisplayItemsGenerator { @@ -91,7 +91,8 @@ public RegistrateDisplayItemsGenerator(String name, GTRegistrate registrate) { } @Override - public void accept(@NotNull CreativeModeTab.ItemDisplayParameters itemDisplayParameters, @NotNull CreativeModeTab.Output output) { + public void accept(@NotNull CreativeModeTab.ItemDisplayParameters itemDisplayParameters, + @NotNull CreativeModeTab.Output output) { var tab = registrate.get(name, Registries.CREATIVE_MODE_TAB); for (var entry : registrate.getAll(Registries.BLOCK)) { if (!registrate.isInCreativeTab(entry, tab)) @@ -103,7 +104,7 @@ public void accept(@NotNull CreativeModeTab.ItemDisplayParameters itemDisplayPar NonNullList list = NonNullList.create(); componentItem.fillItemCategory(tab.get(), list); list.forEach(output::accept); - } else if (item instanceof IGTTool tool) { + } else if (item instanceof IGTTool tool) { NonNullList list = NonNullList.create(); tool.definition$fillItemCategory(tab.get(), list); list.forEach(output::accept); @@ -131,5 +132,4 @@ public void accept(@NotNull CreativeModeTab.ItemDisplayParameters itemDisplayPar } } } - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTDamageTypes.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTDamageTypes.java index 0209be7494..19fb26763d 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTDamageTypes.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTDamageTypes.java @@ -2,6 +2,7 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.data.damagesource.DamageTypeData; + import net.minecraft.data.worldgen.BootstapContext; import net.minecraft.tags.DamageTypeTags; import net.minecraft.world.damagesource.DamageType; @@ -12,6 +13,7 @@ * @implNote GTDamageTypes */ public class GTDamageTypes { + public static final DamageTypeData EXPLOSION = new DamageTypeData.Builder() .simpleId("explosion") .tag(DamageTypeTags.IS_EXPLOSION) @@ -37,9 +39,7 @@ public class GTDamageTypes { .tag(DamageTypeTags.BYPASSES_ARMOR) .build(); - public static void init() { - - } + public static void init() {} public static void bootstrap(BootstapContext ctx) { DamageTypeData.allInNamespace(GTCEu.MOD_ID).forEach(data -> data.register(ctx)); diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTElements.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTElements.java index fa826fa85a..7c31949f65 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTElements.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTElements.java @@ -7,6 +7,7 @@ import com.gregtechceu.gtceu.api.data.chemical.Element; import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.integration.kjs.GTRegistryInfo; + import net.minecraftforge.fml.ModLoader; public class GTElements { @@ -150,7 +151,8 @@ public class GTElements { public static final Element Sp = createAndRegister(1, 0, -1, null, "Space", "Sp", false); public static final Element Ma = createAndRegister(1, 0, -1, null, "Magic", "Ma", false); - public static Element createAndRegister(long protons, long neutrons, long halfLifeSeconds, String decayTo, String name, String symbol, boolean isIsotope) { + public static Element createAndRegister(long protons, long neutrons, long halfLifeSeconds, String decayTo, + String name, String symbol, boolean isIsotope) { Element element = new Element(protons, neutrons, halfLifeSeconds, decayTo, name, symbol, isIsotope); GTRegistries.ELEMENTS.register(name, element); return element; diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTEntityTypes.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTEntityTypes.java index 4f02f9bc7f..13a09ffdcf 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTEntityTypes.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTEntityTypes.java @@ -3,31 +3,34 @@ import com.gregtechceu.gtceu.common.entity.DynamiteEntity; import com.gregtechceu.gtceu.common.entity.IndustrialTNTEntity; import com.gregtechceu.gtceu.common.entity.PowderbarrelEntity; -import com.tterrag.registrate.util.entry.EntityEntry; + import net.minecraft.tags.EntityTypeTags; import net.minecraft.world.entity.MobCategory; +import com.tterrag.registrate.util.entry.EntityEntry; + import static com.gregtechceu.gtceu.common.registry.GTRegistration.REGISTRATE; public class GTEntityTypes { - public static final EntityEntry DYNAMITE = REGISTRATE.entity("dynamite", DynamiteEntity::new, MobCategory.MISC) - .lang("Dynamite") - .properties(builder -> builder.sized(0.25F, 0.25F).fireImmune().clientTrackingRange(4).updateInterval(10)) - .tag(EntityTypeTags.IMPACT_PROJECTILES) - .register(); - - public static final EntityEntry POWDERBARREL = REGISTRATE.entity("powderbarrel", PowderbarrelEntity::new, MobCategory.MISC) - .lang("Powderbarrel") - .properties(builder -> builder.sized(0.98F, 0.98F).fireImmune().clientTrackingRange(10).updateInterval(10)) - .register(); - - public static final EntityEntry INDUSTRIAL_TNT = REGISTRATE.entity("industrial_tnt", IndustrialTNTEntity::new, MobCategory.MISC) - .lang("Industrial TNT") - .properties(builder -> builder.sized(0.98F, 0.98F).fireImmune().clientTrackingRange(10).updateInterval(10)) - .register(); - - public static void init() { - - } + public static final EntityEntry DYNAMITE = REGISTRATE + .entity("dynamite", DynamiteEntity::new, MobCategory.MISC) + .lang("Dynamite") + .properties(builder -> builder.sized(0.25F, 0.25F).fireImmune().clientTrackingRange(4).updateInterval(10)) + .tag(EntityTypeTags.IMPACT_PROJECTILES) + .register(); + + public static final EntityEntry POWDERBARREL = REGISTRATE + .entity("powderbarrel", PowderbarrelEntity::new, MobCategory.MISC) + .lang("Powderbarrel") + .properties(builder -> builder.sized(0.98F, 0.98F).fireImmune().clientTrackingRange(10).updateInterval(10)) + .register(); + + public static final EntityEntry INDUSTRIAL_TNT = REGISTRATE + .entity("industrial_tnt", IndustrialTNTEntity::new, MobCategory.MISC) + .lang("Industrial TNT") + .properties(builder -> builder.sized(0.98F, 0.98F).fireImmune().clientTrackingRange(10).updateInterval(10)) + .register(); + + public static void init() {} } diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTFeatures.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTFeatures.java index 911391580a..034cf9efe6 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTFeatures.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTFeatures.java @@ -1,12 +1,12 @@ package com.gregtechceu.gtceu.common.data; - import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.data.worldgen.modifier.BiomePlacement; import com.gregtechceu.gtceu.api.data.worldgen.modifier.DimensionFilter; import com.gregtechceu.gtceu.api.data.worldgen.modifier.FrequencyModifier; import com.gregtechceu.gtceu.common.worldgen.feature.FluidSproutFeature; import com.gregtechceu.gtceu.common.worldgen.feature.StoneBlobFeature; + import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.levelgen.feature.Feature; @@ -20,13 +20,17 @@ * @implNote GTFeatures */ public class GTFeatures { + public static final ResourceLocation NEW_ORE_VEIN_TOGGLE = GTCEu.id("vein_toggle"); public static final ResourceLocation NEW_ORE_VEIN_RIDGED = GTCEu.id("vein_ridged"); - public static final DeferredRegister> FEATURE_REGISTER = DeferredRegister.create(Registries.FEATURE, GTCEu.MOD_ID); + public static final DeferredRegister> FEATURE_REGISTER = DeferredRegister.create(Registries.FEATURE, + GTCEu.MOD_ID); - public static final RegistryObject STONE_BLOB = FEATURE_REGISTER.register("stone_blob", StoneBlobFeature::new); - public static final RegistryObject FLUID_SPROUT = FEATURE_REGISTER.register("fluid_sprout", FluidSproutFeature::new); + public static final RegistryObject STONE_BLOB = FEATURE_REGISTER.register("stone_blob", + StoneBlobFeature::new); + public static final RegistryObject FLUID_SPROUT = FEATURE_REGISTER.register("fluid_sprout", + FluidSproutFeature::new); public static void init() { Object inst = FrequencyModifier.FREQUENCY_MODIFIER; // seemingly useless access to init the class in time diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTFluids.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTFluids.java index 5b51e40bcb..4a8047e9db 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTFluids.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTFluids.java @@ -6,6 +6,7 @@ import com.gregtechceu.gtceu.api.data.chemical.material.registry.MaterialRegistry; import com.gregtechceu.gtceu.api.fluids.store.FluidStorageKeys; import com.gregtechceu.gtceu.api.registry.registrate.GTRegistrate; + import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.Fluids; @@ -41,13 +42,13 @@ public static void handleNonMaterialFluids(@NotNull Material material, @NotNull var property = material.getProperty(PropertyKey.FLUID); property.getStorage().store(FluidStorageKeys.LIQUID, () -> fluid, null); // TODO TOOLTIPS -// List tooltip = new ArrayList<>(); -// if (!material.getChemicalFormula().isEmpty()) { -// tooltip.add(TextFormatting.YELLOW + material.getChemicalFormula()); -// } -// tooltip.add(LocalizationUtils.format("gtceu.fluid.temperature", property.getFluidTemperature())); -// tooltip.add(LocalizationUtils.format(property.getFluidType().getUnlocalizedTooltip())); -// tooltip.addAll(property.getFluidType().getAdditionalTooltips()); -// FluidTooltipUtil.registerTooltip(fluid, tooltip); + // List tooltip = new ArrayList<>(); + // if (!material.getChemicalFormula().isEmpty()) { + // tooltip.add(TextFormatting.YELLOW + material.getChemicalFormula()); + // } + // tooltip.add(LocalizationUtils.format("gtceu.fluid.temperature", property.getFluidTemperature())); + // tooltip.add(LocalizationUtils.format(property.getFluidType().getUnlocalizedTooltip())); + // tooltip.addAll(property.getFluidType().getAdditionalTooltips()); + // FluidTooltipUtil.registerTooltip(fluid, tooltip); } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTItems.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTItems.java index 1335b217e5..545fb2009e 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTItems.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTItems.java @@ -1,8 +1,5 @@ package com.gregtechceu.gtceu.common.data; -import com.google.common.collect.ArrayTable; -import com.google.common.collect.ImmutableTable; -import com.google.common.collect.Table; import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.GTCEuAPI; import com.gregtechceu.gtceu.api.GTValues; @@ -14,6 +11,7 @@ import com.gregtechceu.gtceu.api.data.chemical.material.MarkerMaterial; import com.gregtechceu.gtceu.api.data.chemical.material.MarkerMaterials; import com.gregtechceu.gtceu.api.data.chemical.material.Material; +import com.gregtechceu.gtceu.api.data.chemical.material.properties.HazardProperty; import com.gregtechceu.gtceu.api.data.chemical.material.properties.PropertyKey; import com.gregtechceu.gtceu.api.data.chemical.material.registry.MaterialRegistry; import com.gregtechceu.gtceu.api.data.chemical.material.stack.ItemMaterialInfo; @@ -40,20 +38,12 @@ import com.gregtechceu.gtceu.data.recipe.CustomTags; import com.gregtechceu.gtceu.utils.FormattingUtil; import com.gregtechceu.gtceu.utils.SupplierMemoizer; + import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.gui.texture.ItemStackTexture; import com.lowdragmc.lowdraglib.side.fluid.FluidHelper; import com.lowdragmc.lowdraglib.side.fluid.FluidTransferHelper; -import com.lowdragmc.lowdraglib.utils.LocalizationUtils; -import com.tterrag.registrate.builders.ItemBuilder; -import com.tterrag.registrate.providers.DataGenContext; -import com.tterrag.registrate.providers.ProviderType; -import com.tterrag.registrate.providers.RegistrateLangProvider; -import com.tterrag.registrate.util.entry.ItemEntry; -import com.tterrag.registrate.util.entry.ItemProviderEntry; -import com.tterrag.registrate.util.nullness.NonNullBiConsumer; -import com.tterrag.registrate.util.nullness.NonNullConsumer; -import com.tterrag.registrate.util.nullness.NonNullFunction; + import net.minecraft.client.color.item.ItemColor; import net.minecraft.client.renderer.item.ItemProperties; import net.minecraft.core.cauldron.CauldronInteraction; @@ -68,19 +58,31 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.TierSortingRegistry; + +import com.google.common.collect.ArrayTable; +import com.google.common.collect.ImmutableTable; +import com.google.common.collect.Table; +import com.tterrag.registrate.builders.ItemBuilder; +import com.tterrag.registrate.providers.DataGenContext; +import com.tterrag.registrate.providers.ProviderType; +import com.tterrag.registrate.providers.RegistrateLangProvider; +import com.tterrag.registrate.util.entry.ItemEntry; +import com.tterrag.registrate.util.entry.ItemProviderEntry; +import com.tterrag.registrate.util.nullness.NonNullBiConsumer; +import com.tterrag.registrate.util.nullness.NonNullConsumer; +import com.tterrag.registrate.util.nullness.NonNullFunction; import org.apache.commons.lang3.StringUtils; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import java.util.*; import java.util.function.Function; import java.util.function.Supplier; import java.util.stream.Collectors; -import static com.gregtechceu.gtceu.common.registry.GTRegistration.REGISTRATE; import static com.gregtechceu.gtceu.common.data.GTCreativeModeTabs.*; import static com.gregtechceu.gtceu.common.data.GTModels.createTextureModel; import static com.gregtechceu.gtceu.common.data.GTModels.overrideModel; +import static com.gregtechceu.gtceu.common.registry.GTRegistration.REGISTRATE; import static com.gregtechceu.gtceu.utils.FormattingUtil.toEnglishName; /** @@ -91,7 +93,7 @@ public class GTItems { ////////////////////////////////////// - //***** Material Items ******// + // ***** Material Items ******// ////////////////////////////////////// public static final Map> toUnify = new HashMap<>(); @@ -115,25 +117,29 @@ public static void generateMaterialItems() { for (Material material : registry.getAllMaterials()) { if (tagPrefix.doGenerateItem(material)) { builder.put(tagPrefix, material, registrate - .item(tagPrefix.idPattern().formatted(material.getName()), properties -> new TagPrefixItem(properties, tagPrefix, material)) - .onRegister(TagPrefixItem::onRegister) - .setData(ProviderType.LANG, NonNullBiConsumer.noop()) - .transform(unificationItem(tagPrefix, material)) - .properties(p -> p.stacksTo(tagPrefix.maxStackSize())) - .model(NonNullBiConsumer.noop()) - .color(() -> TagPrefixItem::tintColor) - .onRegister(GTItems::cauldronInteraction) - .onRegister(item -> { - switch (tagPrefix.name) { - case "buzzSawBlade", "screwDriverTip", "drillHead", "chainSawHead", "wrenchTip", "turbineBlade" -> - CompassNode.getOrCreate(GTCompassSections.MATERIALS, "tool_heads").addItem(() -> item); - default -> - CompassNode.getOrCreate(GTCompassSections.MATERIALS, FormattingUtil.toLowerCaseUnderscore(tagPrefix.name)) - .iconIfNull(() -> new ItemStackTexture(item)).addTag(tagPrefix.getItemParentTags()); - - } - }) - .register()); + .item(tagPrefix.idPattern().formatted(material.getName()), + properties -> new TagPrefixItem(properties, tagPrefix, material)) + .onRegister(TagPrefixItem::onRegister) + .setData(ProviderType.LANG, NonNullBiConsumer.noop()) + .transform(unificationItem(tagPrefix, material)) + .properties(p -> p.stacksTo(tagPrefix.maxStackSize())) + .model(NonNullBiConsumer.noop()) + .color(() -> TagPrefixItem::tintColor) + .onRegister(GTItems::cauldronInteraction) + .onRegister(item -> { + switch (tagPrefix.name) { + case "buzzSawBlade", "screwDriverTip", "drillHead", "chainSawHead", "wrenchTip", "turbineBlade" -> CompassNode + .getOrCreate(GTCompassSections.MATERIALS, "tool_heads") + .addItem(() -> item); + default -> CompassNode + .getOrCreate(GTCompassSections.MATERIALS, + FormattingUtil.toLowerCaseUnderscore(tagPrefix.name)) + .iconIfNull(() -> new ItemStackTexture(item)) + .addTag(tagPrefix.getItemParentTags()); + + } + }) + .register()); } } } @@ -143,11 +149,12 @@ public static void generateMaterialItems() { } ////////////////////////////////////// - //***** Material Tools ******// + // ***** Material Tools ******// ////////////////////////////////////// - public final static Table> TOOL_ITEMS = - ArrayTable.create(GTCEuAPI.materialManager.getRegisteredMaterials().stream().filter(mat -> mat.hasProperty(PropertyKey.TOOL)).toList(), - GTToolType.getTypes().values().stream().toList()); + public final static Table> TOOL_ITEMS = ArrayTable.create( + GTCEuAPI.materialManager.getRegisteredMaterials().stream().filter(mat -> mat.hasProperty(PropertyKey.TOOL)) + .toList(), + GTToolType.getTypes().values().stream().toList()); public static void generateTools() { REGISTRATE.creativeModeTab(() -> TOOL); @@ -161,13 +168,24 @@ public static void generateTools() { var tier = material.getToolTier(); if (property.hasType(toolType)) { - TOOL_ITEMS.put(material, toolType, (ItemProviderEntry) (ItemProviderEntry) registrate.item(toolType.idFormat.formatted(tier.material.getName()), p -> toolType.constructor.apply(toolType, tier, material, toolType.toolDefinition, p).asItem()) - .properties(p -> p.craftRemainder(Items.AIR)) - .setData(ProviderType.LANG, NonNullBiConsumer.noop()) - .model(NonNullBiConsumer.noop()) - .color(() -> IGTTool::tintColor) - .onRegister(item -> CompassNode.getOrCreate(GTCompassSections.TOOLS, FormattingUtil.toLowerCaseUnderscore(toolType.name)).iconIfNull(() -> new ItemStackTexture(item)).addTag(toolType.itemTags.get(0))) - .register()); + TOOL_ITEMS + .put(material, toolType, + (ItemProviderEntry) (ItemProviderEntry) registrate + .item(toolType.idFormat.formatted(tier.material.getName()), + p -> toolType.constructor.apply(toolType, tier, material, + toolType.toolDefinition, p).asItem()) + .properties(p -> p.craftRemainder(Items.AIR)) + .setData(ProviderType.LANG, NonNullBiConsumer.noop()) + .model(NonNullBiConsumer.noop()) + .color(() -> IGTTool::tintColor) + .onRegister( + item -> CompassNode + .getOrCreate(GTCompassSections.TOOLS, + FormattingUtil.toLowerCaseUnderscore( + toolType.name)) + .iconIfNull(() -> new ItemStackTexture(item)) + .addTag(toolType.itemTags.get(0))) + .register()); } } } @@ -175,32 +193,51 @@ public static void generateTools() { } } - ////////////////////////////////////// - //******* Misc Items ********// + // ******* Misc Items ********// ////////////////////////////////////// static { REGISTRATE.creativeModeTab(() -> ITEM); } - public static ItemEntry CREDIT_COPPER = REGISTRATE.item("copper_credit", Item::new).lang("Copper Credit").onRegister(compassNodeExist(GTCompassSections.MISC, "credit")).register(); - public static ItemEntry CREDIT_CUPRONICKEL = REGISTRATE.item("cupronickel_credit", Item::new).lang("Cupronickel Credit").defaultModel().onRegister(compassNodeExist(GTCompassSections.MISC, "credit")).register(); - public static ItemEntry CREDIT_SILVER = REGISTRATE.item("silver_credit", Item::new).lang("Silver Credit").properties(p -> p.rarity(Rarity.UNCOMMON)).onRegister(compassNodeExist(GTCompassSections.MISC, "credit")).register(); - public static ItemEntry CREDIT_GOLD = REGISTRATE.item("gold_credit", Item::new).lang("Gold Credit").properties(p -> p.rarity(Rarity.UNCOMMON)).onRegister(compassNodeExist(GTCompassSections.MISC, "credit")).register(); - public static ItemEntry CREDIT_PLATINUM = REGISTRATE.item("platinum_credit", Item::new).lang("Platinum Credit").properties(p -> p.rarity(Rarity.RARE)).onRegister(compassNodeExist(GTCompassSections.MISC, "credit")).register(); - public static ItemEntry CREDIT_OSMIUM = REGISTRATE.item("osmium_credit", Item::new).lang("Osmium Credit").properties(p -> p.rarity(Rarity.RARE)).onRegister(compassNodeExist(GTCompassSections.MISC, "credit")).register(); - public static ItemEntry CREDIT_NAQUADAH = REGISTRATE.item("naquadah_credit", Item::new).lang("Naquadah Credit").properties(p -> p.rarity(Rarity.EPIC)).onRegister(compassNodeExist(GTCompassSections.MISC, "credit")).register(); - public static ItemEntry CREDIT_NEUTRONIUM = REGISTRATE.item("neutronium_credit", Item::new).lang("Neutronium Credit").properties(p -> p.rarity(Rarity.EPIC)).onRegister(compassNodeExist(GTCompassSections.MISC, "credit")).register(); - public static ItemEntry COIN_GOLD_ANCIENT = REGISTRATE.item("ancient_gold_coin", Item::new).lang("Ancient Gold Coin").properties(p -> p.rarity(Rarity.RARE)) + public static ItemEntry CREDIT_COPPER = REGISTRATE.item("copper_credit", Item::new).lang("Copper Credit") + .onRegister(compassNodeExist(GTCompassSections.MISC, "credit")).register(); + public static ItemEntry CREDIT_CUPRONICKEL = REGISTRATE.item("cupronickel_credit", Item::new) + .lang("Cupronickel Credit").defaultModel().onRegister(compassNodeExist(GTCompassSections.MISC, "credit")) + .register(); + public static ItemEntry CREDIT_SILVER = REGISTRATE.item("silver_credit", Item::new).lang("Silver Credit") + .properties(p -> p.rarity(Rarity.UNCOMMON)).onRegister(compassNodeExist(GTCompassSections.MISC, "credit")) + .register(); + public static ItemEntry CREDIT_GOLD = REGISTRATE.item("gold_credit", Item::new).lang("Gold Credit") + .properties(p -> p.rarity(Rarity.UNCOMMON)).onRegister(compassNodeExist(GTCompassSections.MISC, "credit")) + .register(); + public static ItemEntry CREDIT_PLATINUM = REGISTRATE.item("platinum_credit", Item::new) + .lang("Platinum Credit").properties(p -> p.rarity(Rarity.RARE)) + .onRegister(compassNodeExist(GTCompassSections.MISC, "credit")).register(); + public static ItemEntry CREDIT_OSMIUM = REGISTRATE.item("osmium_credit", Item::new).lang("Osmium Credit") + .properties(p -> p.rarity(Rarity.RARE)).onRegister(compassNodeExist(GTCompassSections.MISC, "credit")) + .register(); + public static ItemEntry CREDIT_NAQUADAH = REGISTRATE.item("naquadah_credit", Item::new) + .lang("Naquadah Credit").properties(p -> p.rarity(Rarity.EPIC)) + .onRegister(compassNodeExist(GTCompassSections.MISC, "credit")).register(); + public static ItemEntry CREDIT_NEUTRONIUM = REGISTRATE.item("neutronium_credit", Item::new) + .lang("Neutronium Credit").properties(p -> p.rarity(Rarity.EPIC)) + .onRegister(compassNodeExist(GTCompassSections.MISC, "credit")).register(); + public static ItemEntry COIN_GOLD_ANCIENT = REGISTRATE.item("ancient_gold_coin", Item::new) + .lang("Ancient Gold Coin").properties(p -> p.rarity(Rarity.RARE)) .onRegister(compassNode(GTCompassSections.MISC)) - .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Gold, GTValues.M / 4)))).register(); - public static ItemEntry COIN_DOGE = REGISTRATE.item("doge_coin", Item::new).lang("Doge Coin").properties(p -> p.rarity(Rarity.EPIC)) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Gold, GTValues.M / 4)))) + .register(); + public static ItemEntry COIN_DOGE = REGISTRATE.item("doge_coin", Item::new).lang("Doge Coin") + .properties(p -> p.rarity(Rarity.EPIC)) .onRegister(compassNode(GTCompassSections.MISC)) - .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Brass, GTValues.M / 4)))).register(); + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Brass, GTValues.M / 4)))) + .register(); public static ItemEntry COIN_CHOCOLATE = REGISTRATE.item("chocolate_coin", Item::new) .lang("Chocolate Coin") .properties(p -> p.rarity(Rarity.EPIC).food(GTFoods.CHOCOLATE)) .onRegister(compassNode(GTCompassSections.MISC)) - .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Gold, GTValues.M / 4)))).register(); + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Gold, GTValues.M / 4)))) + .register(); public static ItemEntry COMPRESSED_CLAY = REGISTRATE.item("compressed_clay", Item::new) .lang("Compressed Clay") .onRegister(compassNode(GTCompassSections.MISC)) @@ -212,11 +249,13 @@ public static void generateTools() { public static ItemEntry COMPRESSED_FIRECLAY = REGISTRATE.item("compressed_fireclay", Item::new) .lang("Compressed Fireclay") .onRegister(compassNode(GTCompassSections.MISC)) - .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Fireclay, GTValues.M)))).register(); + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Fireclay, GTValues.M)))) + .register(); public static ItemEntry FIRECLAY_BRICK = REGISTRATE.item("firebrick", Item::new) .lang("Firebrick") .onRegister(compassNode(GTCompassSections.MISC)) - .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Fireclay, GTValues.M)))).register(); + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Fireclay, GTValues.M)))) + .register(); public static ItemEntry COKE_OVEN_BRICK = REGISTRATE.item("coke_oven_brick", Item::new) .lang("Coke Oven Brick") .onRegister(compassNode(GTCompassSections.MISC)) @@ -224,7 +263,8 @@ public static void generateTools() { public static ItemEntry WOODEN_FORM_EMPTY = REGISTRATE.item("empty_wooden_form", Item::new) .lang("Empty Wooden Form") .onRegister(compassNode(GTCompassSections.MISC)).register(); - public static ItemEntry WOODEN_FORM_BRICK = REGISTRATE.item("brick_wooden_form", ComponentItem::create) + public static ItemEntry WOODEN_FORM_BRICK = REGISTRATE + .item("brick_wooden_form", ComponentItem::create) .lang("Brick Wooden Form") .properties(p -> p.stacksTo(1)) .onRegister(compassNode(GTCompassSections.MISC)) @@ -233,9 +273,10 @@ public static void generateTools() { public static ItemEntry SHAPE_EMPTY = REGISTRATE.item("empty_mold", Item::new) .lang("Empty Mold") .onRegister(compassNode(GTCompassSections.MISC)) - .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))).register(); + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))) + .register(); - public static final ItemEntry[] SHAPE_MOLDS = new ItemEntry[13]; + public static final ItemEntry[] SHAPE_MOLDS = new ItemEntry[14]; public static final ItemEntry SHAPE_MOLD_PLATE; public static final ItemEntry SHAPE_MOLD_GEAR; public static final ItemEntry SHAPE_MOLD_CREDIT; @@ -249,34 +290,65 @@ public static void generateTools() { public static final ItemEntry SHAPE_MOLD_NAME; public static final ItemEntry SHAPE_MOLD_GEAR_SMALL; public static final ItemEntry SHAPE_MOLD_ROTOR; + public static final ItemEntry SHAPE_MOLD_PILL; static { SHAPE_MOLDS[0] = SHAPE_MOLD_PLATE = REGISTRATE.item("plate_casting_mold", Item::new) - .lang("Casting Mold (Plate)").onRegister(compassNodeExist(GTCompassSections.MISC, "mold")).onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))).register(); + .lang("Casting Mold (Plate)").onRegister(compassNodeExist(GTCompassSections.MISC, "mold")) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))) + .register(); SHAPE_MOLDS[1] = SHAPE_MOLD_GEAR = REGISTRATE.item("gear_casting_mold", Item::new) - .lang("Casting Mold (Gear)").onRegister(compassNodeExist(GTCompassSections.MISC, "mold")).onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))).register(); + .lang("Casting Mold (Gear)").onRegister(compassNodeExist(GTCompassSections.MISC, "mold")) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))) + .register(); SHAPE_MOLDS[2] = SHAPE_MOLD_CREDIT = REGISTRATE.item("credit_casting_mold", Item::new) - .lang("Casting Mold (Coinage)").onRegister(compassNodeExist(GTCompassSections.MISC, "mold")).onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))).register(); + .lang("Casting Mold (Coinage)").onRegister(compassNodeExist(GTCompassSections.MISC, "mold")) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))) + .register(); SHAPE_MOLDS[3] = SHAPE_MOLD_BOTTLE = REGISTRATE.item("bottle_casting_mold", Item::new) - .lang("Casting Mold (Bottle)").onRegister(compassNodeExist(GTCompassSections.MISC, "mold")).onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))).register(); + .lang("Casting Mold (Bottle)").onRegister(compassNodeExist(GTCompassSections.MISC, "mold")) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))) + .register(); SHAPE_MOLDS[4] = SHAPE_MOLD_INGOT = REGISTRATE.item("ingot_casting_mold", Item::new) - .lang("Casting Mold (Ingot)").onRegister(compassNodeExist(GTCompassSections.MISC, "mold")).onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))).register(); + .lang("Casting Mold (Ingot)").onRegister(compassNodeExist(GTCompassSections.MISC, "mold")) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))) + .register(); SHAPE_MOLDS[5] = SHAPE_MOLD_BALL = REGISTRATE.item("ball_casting_mold", Item::new) - .lang("Casting Mold (Ball)").onRegister(compassNodeExist(GTCompassSections.MISC, "mold")).onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))).register(); + .lang("Casting Mold (Ball)").onRegister(compassNodeExist(GTCompassSections.MISC, "mold")) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))) + .register(); SHAPE_MOLDS[6] = SHAPE_MOLD_BLOCK = REGISTRATE.item("block_casting_mold", Item::new) - .lang("Casting Mold (Block)").onRegister(compassNodeExist(GTCompassSections.MISC, "mold")).onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))).register(); + .lang("Casting Mold (Block)").onRegister(compassNodeExist(GTCompassSections.MISC, "mold")) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))) + .register(); SHAPE_MOLDS[7] = SHAPE_MOLD_NUGGET = REGISTRATE.item("nugget_casting_mold", Item::new) - .lang("Casting Mold (Nugget)").onRegister(compassNodeExist(GTCompassSections.MISC, "mold")).onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))).register(); + .lang("Casting Mold (Nugget)").onRegister(compassNodeExist(GTCompassSections.MISC, "mold")) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))) + .register(); SHAPE_MOLDS[8] = SHAPE_MOLD_CYLINDER = REGISTRATE.item("cylinder_casting_mold", Item::new) - .lang("Casting Mold (Cylinder)").onRegister(compassNodeExist(GTCompassSections.MISC, "mold")).onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))).register(); + .lang("Casting Mold (Cylinder)").onRegister(compassNodeExist(GTCompassSections.MISC, "mold")) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))) + .register(); SHAPE_MOLDS[9] = SHAPE_MOLD_ANVIL = REGISTRATE.item("anvil_casting_mold", Item::new) - .lang("Casting Mold (Anvil)").onRegister(compassNodeExist(GTCompassSections.MISC, "mold")).onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))).register(); + .lang("Casting Mold (Anvil)").onRegister(compassNodeExist(GTCompassSections.MISC, "mold")) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))) + .register(); SHAPE_MOLDS[10] = SHAPE_MOLD_NAME = REGISTRATE.item("name_casting_mold", Item::new) - .lang("Casting Mold (Name)").onRegister(compassNodeExist(GTCompassSections.MISC, "mold")).onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))).register(); + .lang("Casting Mold (Name)").onRegister(compassNodeExist(GTCompassSections.MISC, "mold")) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))) + .register(); SHAPE_MOLDS[11] = SHAPE_MOLD_GEAR_SMALL = REGISTRATE.item("small_gear_casting_mold", Item::new) - .lang("Casting Mold (Small Gear)").onRegister(compassNodeExist(GTCompassSections.MISC, "mold")).onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))).register(); + .lang("Casting Mold (Small Gear)").onRegister(compassNodeExist(GTCompassSections.MISC, "mold")) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))) + .register(); SHAPE_MOLDS[12] = SHAPE_MOLD_ROTOR = REGISTRATE.item("rotor_casting_mold", Item::new) - .lang("Casting Mold (Rotor)").onRegister(compassNodeExist(GTCompassSections.MISC, "mold")).onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))).register(); + .lang("Casting Mold (Rotor)").onRegister(compassNodeExist(GTCompassSections.MISC, "mold")) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))) + .register(); + SHAPE_MOLDS[13] = SHAPE_MOLD_PILL = REGISTRATE.item("pill_casting_mold", Item::new) + .lang("Casting Mold (Pill)").onRegister(compassNodeExist(GTCompassSections.MISC, "mold")) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))) + .register(); } public static final ItemEntry[] SHAPE_EXTRUDERS = new ItemEntry[27]; @@ -302,46 +374,91 @@ public static void generateTools() { static { SHAPE_EXTRUDERS[0] = SHAPE_EXTRUDER_PLATE = REGISTRATE.item("plate_extruder_mold", Item::new) - .lang("Extruder Mold (Plate)").onRegister(compassNodeExist(GTCompassSections.MISC, "extruder_shape")).onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))).register(); + .lang("Extruder Mold (Plate)").onRegister(compassNodeExist(GTCompassSections.MISC, "extruder_shape")) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))) + .register(); SHAPE_EXTRUDERS[1] = SHAPE_EXTRUDER_ROD = REGISTRATE.item("rod_extruder_mold", Item::new) - .lang("Extruder Mold (Rod)").onRegister(compassNodeExist(GTCompassSections.MISC, "extruder_shape")).onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))).register(); + .lang("Extruder Mold (Rod)").onRegister(compassNodeExist(GTCompassSections.MISC, "extruder_shape")) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))) + .register(); SHAPE_EXTRUDERS[2] = SHAPE_EXTRUDER_BOLT = REGISTRATE.item("bolt_extruder_mold", Item::new) - .lang("Extruder Mold (Bolt)").onRegister(compassNodeExist(GTCompassSections.MISC, "extruder_shape")).onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))).register(); + .lang("Extruder Mold (Bolt)").onRegister(compassNodeExist(GTCompassSections.MISC, "extruder_shape")) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))) + .register(); SHAPE_EXTRUDERS[3] = SHAPE_EXTRUDER_RING = REGISTRATE.item("ring_extruder_mold", Item::new) - .lang("Extruder Mold (Ring)").onRegister(compassNodeExist(GTCompassSections.MISC, "extruder_shape")).onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))).register(); + .lang("Extruder Mold (Ring)").onRegister(compassNodeExist(GTCompassSections.MISC, "extruder_shape")) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))) + .register(); SHAPE_EXTRUDERS[4] = SHAPE_EXTRUDER_CELL = REGISTRATE.item("cell_extruder_mold", Item::new) - .lang("Extruder Mold (Cell)").onRegister(compassNodeExist(GTCompassSections.MISC, "extruder_shape")).onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))).register(); + .lang("Extruder Mold (Cell)").onRegister(compassNodeExist(GTCompassSections.MISC, "extruder_shape")) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))) + .register(); SHAPE_EXTRUDERS[5] = SHAPE_EXTRUDER_INGOT = REGISTRATE.item("ingot_extruder_mold", Item::new) - .lang("Extruder Mold (Ingot)").onRegister(compassNodeExist(GTCompassSections.MISC, "extruder_shape")).onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))).register(); + .lang("Extruder Mold (Ingot)").onRegister(compassNodeExist(GTCompassSections.MISC, "extruder_shape")) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))) + .register(); SHAPE_EXTRUDERS[6] = SHAPE_EXTRUDER_WIRE = REGISTRATE.item("wire_extruder_mold", Item::new) - .lang("Extruder Mold (Wire)").onRegister(compassNodeExist(GTCompassSections.MISC, "extruder_shape")).onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))).register(); + .lang("Extruder Mold (Wire)").onRegister(compassNodeExist(GTCompassSections.MISC, "extruder_shape")) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))) + .register(); SHAPE_EXTRUDERS[7] = SHAPE_EXTRUDER_PIPE_TINY = REGISTRATE.item("tiny_pipe_extruder_mold", Item::new) - .lang("Extruder Mold (Tiny Pipe)").onRegister(compassNodeExist(GTCompassSections.MISC, "extruder_shape")).onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))).register(); + .lang("Extruder Mold (Tiny Pipe)") + .onRegister(compassNodeExist(GTCompassSections.MISC, "extruder_shape")) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))) + .register(); SHAPE_EXTRUDERS[8] = SHAPE_EXTRUDER_PIPE_SMALL = REGISTRATE.item("small_pipe_extruder_mold", Item::new) - .lang("Extruder Mold (Small Pipe)").onRegister(compassNodeExist(GTCompassSections.MISC, "extruder_shape")).onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))).register(); + .lang("Extruder Mold (Small Pipe)") + .onRegister(compassNodeExist(GTCompassSections.MISC, "extruder_shape")) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))) + .register(); SHAPE_EXTRUDERS[9] = SHAPE_EXTRUDER_PIPE_NORMAL = REGISTRATE.item("normal_pipe_extruder_mold", Item::new) - .lang("Extruder Mold (Normal Pipe)").onRegister(compassNodeExist(GTCompassSections.MISC, "extruder_shape")).onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))).register(); + .lang("Extruder Mold (Normal Pipe)") + .onRegister(compassNodeExist(GTCompassSections.MISC, "extruder_shape")) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))) + .register(); SHAPE_EXTRUDERS[10] = SHAPE_EXTRUDER_PIPE_LARGE = REGISTRATE.item("large_pipe_extruder_mold", Item::new) - .lang("Extruder Mold (Large Pipe)").onRegister(compassNodeExist(GTCompassSections.MISC, "extruder_shape")).onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))).register(); + .lang("Extruder Mold (Large Pipe)") + .onRegister(compassNodeExist(GTCompassSections.MISC, "extruder_shape")) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))) + .register(); SHAPE_EXTRUDERS[11] = SHAPE_EXTRUDER_PIPE_HUGE = REGISTRATE.item("huge_pipe_extruder_mold", Item::new) - .lang("Extruder Mold (Huge Pipe)").onRegister(compassNodeExist(GTCompassSections.MISC, "extruder_shape")).onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))).register(); + .lang("Extruder Mold (Huge Pipe)") + .onRegister(compassNodeExist(GTCompassSections.MISC, "extruder_shape")) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))) + .register(); SHAPE_EXTRUDERS[12] = SHAPE_EXTRUDER_BLOCK = REGISTRATE.item("block_extruder_mold", Item::new) - .lang("Extruder Mold (Block)").onRegister(compassNodeExist(GTCompassSections.MISC, "extruder_shape")).onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))).register(); + .lang("Extruder Mold (Block)").onRegister(compassNodeExist(GTCompassSections.MISC, "extruder_shape")) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))) + .register(); // Extruder Shapes index 13-20 (inclusive), id 44-51 (inclusive) are unused SHAPE_EXTRUDERS[21] = SHAPE_EXTRUDER_GEAR = REGISTRATE.item("gear_extruder_mold", Item::new) - .lang("Extruder Mold (Gear)").onRegister(compassNodeExist(GTCompassSections.MISC, "extruder_shape")).onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))).register(); + .lang("Extruder Mold (Gear)").onRegister(compassNodeExist(GTCompassSections.MISC, "extruder_shape")) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))) + .register(); SHAPE_EXTRUDERS[22] = SHAPE_EXTRUDER_BOTTLE = REGISTRATE.item("bottle_extruder_mold", Item::new) - .lang("Extruder Mold (Bottle)").onRegister(compassNodeExist(GTCompassSections.MISC, "extruder_shape")).onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))).register(); + .lang("Extruder Mold (Bottle)").onRegister(compassNodeExist(GTCompassSections.MISC, "extruder_shape")) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))) + .register(); SHAPE_EXTRUDERS[23] = SHAPE_EXTRUDER_FOIL = REGISTRATE.item("foil_extruder_mold", Item::new) - .lang("Extruder Mold (Foil)").onRegister(compassNodeExist(GTCompassSections.MISC, "extruder_shape")).onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))).register(); + .lang("Extruder Mold (Foil)").onRegister(compassNodeExist(GTCompassSections.MISC, "extruder_shape")) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))) + .register(); SHAPE_EXTRUDERS[24] = SHAPE_EXTRUDER_GEAR_SMALL = REGISTRATE.item("small_gear_extruder_mold", Item::new) - .lang("Extruder Mold (Small Gear)").onRegister(compassNodeExist(GTCompassSections.MISC, "extruder_shape")).onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))).register(); + .lang("Extruder Mold (Small Gear)") + .onRegister(compassNodeExist(GTCompassSections.MISC, "extruder_shape")) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))) + .register(); SHAPE_EXTRUDERS[25] = SHAPE_EXTRUDER_ROD_LONG = REGISTRATE.item("long_rod_extruder_mold", Item::new) - .lang("Extruder Mold (Long Rod)").onRegister(compassNodeExist(GTCompassSections.MISC, "extruder_shape")).onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))).register(); + .lang("Extruder Mold (Long Rod)").onRegister(compassNodeExist(GTCompassSections.MISC, "extruder_shape")) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))) + .register(); SHAPE_EXTRUDERS[26] = SHAPE_EXTRUDER_ROTOR = REGISTRATE.item("rotor_extruder_mold", Item::new) - .lang("Extruder Mold (Rotor)").onRegister(compassNodeExist(GTCompassSections.MISC, "extruder_shape")).onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))).register(); + .lang("Extruder Mold (Rotor)").onRegister(compassNodeExist(GTCompassSections.MISC, "extruder_shape")) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))) + .register(); } - public static ItemEntry SPRAY_EMPTY = REGISTRATE.item("empty_spray_can", Item::new).onRegister(compassNode(GTCompassSections.ITEMS)).lang("Spray Can (Empty)").register(); + public static ItemEntry SPRAY_EMPTY = REGISTRATE.item("empty_spray_can", Item::new) + .onRegister(compassNode(GTCompassSections.ITEMS)).lang("Spray Can (Empty)").register(); public static ItemEntry SPRAY_SOLVENT = REGISTRATE.item("solvent_spray_can", ComponentItem::create) .lang("Spray Can (Solvent)") .properties(p -> p.stacksTo(1)) @@ -355,12 +472,14 @@ public static void generateTools() { .onRegister(attach(ElectricStats.createElectricItem(100_000L, GTValues.MV), new PortableScannerBehavior(0))) .register(); - public static ItemEntry PORTABLE_DEBUG_SCANNER = REGISTRATE.item("portable_debug_scanner", ComponentItem::create) - .lang("Portable Debug Scanner") - .properties(p -> p.stacksTo(1)) - .onRegister(compassNode(GTCompassSections.TOOLS)) - .onRegister(attach(ElectricStats.createElectricItem(1_000_000L, GTValues.MV), new PortableScannerBehavior(1))) - .register(); + public static ItemEntry PORTABLE_DEBUG_SCANNER = REGISTRATE + .item("portable_debug_scanner", ComponentItem::create) + .lang("Portable Debug Scanner") + .properties(p -> p.stacksTo(1)) + .onRegister(compassNode(GTCompassSections.TOOLS)) + .onRegister( + attach(ElectricStats.createElectricItem(1_000_000L, GTValues.MV), new PortableScannerBehavior(1))) + .register(); @OnlyIn(Dist.CLIENT) public static ItemColor cellColor() { @@ -381,6 +500,7 @@ public static ItemColor cellColor() { public static ICustomDescriptionId cellName() { return new ICustomDescriptionId() { + @Override public Component getItemName(ItemStack stack) { var held = FluidTransferHelper.getFluidContained(stack); @@ -398,56 +518,100 @@ public Component getItemName(ItemStack stack) { .setData(ProviderType.ITEM_MODEL, NonNullBiConsumer.noop()) .color(() -> GTItems::cellColor) .onRegister(compassNodeExist(GTCompassSections.ITEMS, "empty_cell")) - .onRegister(attach(ThermalFluidStats.create((int)FluidHelper.getBucket(), 1800, true, false, false, false, false), new ItemFluidContainer(), cellName())).register(); - public static ItemEntry FLUID_CELL_UNIVERSAL = REGISTRATE.item("universal_fluid_cell", ComponentItem::create) + .onRegister(attach( + ThermalFluidStats.create((int) FluidHelper.getBucket(), 1800, true, false, false, false, false), + new ItemFluidContainer(), cellName())) + .register(); + public static ItemEntry FLUID_CELL_UNIVERSAL = REGISTRATE + .item("universal_fluid_cell", ComponentItem::create) .lang("%s Universal Cell") .color(() -> GTItems::cellColor) .setData(ProviderType.ITEM_MODEL, NonNullBiConsumer.noop()) .onRegister(compassNodeExist(GTCompassSections.ITEMS, "empty_cell")) - .onRegister(attach(cellName(), ThermalFluidStats.create((int)FluidHelper.getBucket(), 1800, true, false, false, false, true), new ItemFluidContainer())).register(); - public static ItemEntry FLUID_CELL_LARGE_STEEL = REGISTRATE.item("steel_fluid_cell", ComponentItem::create) + .onRegister(attach(cellName(), + ThermalFluidStats.create((int) FluidHelper.getBucket(), 1800, true, false, false, false, true), + new ItemFluidContainer())) + .register(); + public static ItemEntry FLUID_CELL_LARGE_STEEL = REGISTRATE + .item("steel_fluid_cell", ComponentItem::create) .lang("%s Steel Cell") .color(() -> GTItems::cellColor) .setData(ProviderType.ITEM_MODEL, NonNullBiConsumer.noop()) .onRegister(compassNodeExist(GTCompassSections.ITEMS, "empty_cell")) - .onRegister(attach(cellName(), ThermalFluidStats.create((int)FluidHelper.getBucket() * 8, GTMaterials.Steel.getProperty(PropertyKey.FLUID_PIPE).getMaxFluidTemperature(), true, false, false, false, true), new ItemFluidContainer())) - .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))).register(); - public static ItemEntry FLUID_CELL_LARGE_ALUMINIUM = REGISTRATE.item("aluminium_fluid_cell", ComponentItem::create) + .onRegister(attach(cellName(), + ThermalFluidStats.create((int) FluidHelper.getBucket() * 8, + GTMaterials.Steel.getProperty(PropertyKey.FLUID_PIPE).getMaxFluidTemperature(), true, false, + false, false, true), + new ItemFluidContainer())) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 4)))) + .register(); + public static ItemEntry FLUID_CELL_LARGE_ALUMINIUM = REGISTRATE + .item("aluminium_fluid_cell", ComponentItem::create) .lang("%s Aluminium Cell") .color(() -> GTItems::cellColor) .setData(ProviderType.ITEM_MODEL, NonNullBiConsumer.noop()) .onRegister(compassNodeExist(GTCompassSections.ITEMS, "empty_cell")) - .onRegister(attach(cellName(), ThermalFluidStats.create((int)FluidHelper.getBucket() * 32, GTMaterials.Aluminium.getProperty(PropertyKey.FLUID_PIPE).getMaxFluidTemperature(), true, false, false, false, true), new ItemFluidContainer())) - .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Aluminium, GTValues.M * 4)))).register(); - public static ItemEntry FLUID_CELL_LARGE_STAINLESS_STEEL = REGISTRATE.item("stainless_steel_fluid_cell", ComponentItem::create) + .onRegister(attach(cellName(), + ThermalFluidStats.create((int) FluidHelper.getBucket() * 32, + GTMaterials.Aluminium.getProperty(PropertyKey.FLUID_PIPE).getMaxFluidTemperature(), true, + false, false, false, true), + new ItemFluidContainer())) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Aluminium, GTValues.M * 4)))) + .register(); + public static ItemEntry FLUID_CELL_LARGE_STAINLESS_STEEL = REGISTRATE + .item("stainless_steel_fluid_cell", ComponentItem::create) .lang("%s Stainless Steel Cell") .color(() -> GTItems::cellColor) .setData(ProviderType.ITEM_MODEL, NonNullBiConsumer.noop()) .onRegister(compassNodeExist(GTCompassSections.ITEMS, "empty_cell")) - .onRegister(attach(cellName(), ThermalFluidStats.create((int)FluidHelper.getBucket() * 64, GTMaterials.StainlessSteel.getProperty(PropertyKey.FLUID_PIPE).getMaxFluidTemperature(), true, false, false, false, true), new ItemFluidContainer())) - .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.StainlessSteel, GTValues.M * 6)))).register(); - public static ItemEntry FLUID_CELL_LARGE_TITANIUM = REGISTRATE.item("titanium_fluid_cell", ComponentItem::create) + .onRegister(attach(cellName(), + ThermalFluidStats.create((int) FluidHelper.getBucket() * 64, + GTMaterials.StainlessSteel.getProperty(PropertyKey.FLUID_PIPE).getMaxFluidTemperature(), + true, false, false, false, true), + new ItemFluidContainer())) + .onRegister( + materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.StainlessSteel, GTValues.M * 6)))) + .register(); + public static ItemEntry FLUID_CELL_LARGE_TITANIUM = REGISTRATE + .item("titanium_fluid_cell", ComponentItem::create) .lang("%s Titanium Cell") .color(() -> GTItems::cellColor) .setData(ProviderType.ITEM_MODEL, NonNullBiConsumer.noop()) .onRegister(compassNodeExist(GTCompassSections.ITEMS, "empty_cell")) - .onRegister(attach(cellName(), ThermalFluidStats.create((int)FluidHelper.getBucket() * 128, GTMaterials.Titanium.getProperty(PropertyKey.FLUID_PIPE).getMaxFluidTemperature(), true, false, false, false, true), new ItemFluidContainer())) - .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Titanium, GTValues.M * 6)))).register(); - public static ItemEntry FLUID_CELL_LARGE_TUNGSTEN_STEEL = REGISTRATE.item("tungstensteel_fluid_cell", ComponentItem::create) + .onRegister(attach(cellName(), + ThermalFluidStats.create((int) FluidHelper.getBucket() * 128, + GTMaterials.Titanium.getProperty(PropertyKey.FLUID_PIPE).getMaxFluidTemperature(), true, + false, false, false, true), + new ItemFluidContainer())) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Titanium, GTValues.M * 6)))) + .register(); + public static ItemEntry FLUID_CELL_LARGE_TUNGSTEN_STEEL = REGISTRATE + .item("tungstensteel_fluid_cell", ComponentItem::create) .lang("%s Tungstensteel Cell") .color(() -> GTItems::cellColor) .setData(ProviderType.ITEM_MODEL, NonNullBiConsumer.noop()) .properties(p -> p.stacksTo(32)) .onRegister(compassNodeExist(GTCompassSections.ITEMS, "empty_cell")) - .onRegister(attach(cellName(), ThermalFluidStats.create((int)FluidHelper.getBucket() * 512, GTMaterials.TungstenSteel.getProperty(PropertyKey.FLUID_PIPE).getMaxFluidTemperature(), true, false, false, false, true), new ItemFluidContainer())) - .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.TungstenSteel, GTValues.M * 8)))).register(); + .onRegister(attach(cellName(), + ThermalFluidStats.create((int) FluidHelper.getBucket() * 512, + GTMaterials.TungstenSteel.getProperty(PropertyKey.FLUID_PIPE).getMaxFluidTemperature(), + true, false, false, false, true), + new ItemFluidContainer())) + .onRegister( + materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.TungstenSteel, GTValues.M * 8)))) + .register(); public static ItemEntry FLUID_CELL_GLASS_VIAL = REGISTRATE.item("glass_vial", ComponentItem::create) .lang("%s Glass Vial") .color(() -> GTItems::cellColor) .setData(ProviderType.ITEM_MODEL, NonNullBiConsumer.noop()) .onRegister(compassNode(GTCompassSections.ITEMS)) - .onRegister(attach(cellName(), ThermalFluidStats.create((int)FluidHelper.getBucket(), 1200, false, true, false, false, true), new ItemFluidContainer())) - .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Glass, GTValues.M / 4)))).register(); + .onRegister( + attach(cellName(), + ThermalFluidStats.create((int) FluidHelper.getBucket(), 1200, false, true, false, false, + true), + new ItemFluidContainer())) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Glass, GTValues.M / 4)))) + .register(); // TODO Lighter public static ItemEntry TOOL_MATCHES; @@ -455,43 +619,82 @@ public Component getItemName(ItemStack stack) { public static ItemEntry TOOL_LIGHTER_INVAR; public static ItemEntry TOOL_LIGHTER_PLATINUM; - public static ItemEntry CARBON_FIBERS = REGISTRATE.item("carbon_fibers", Item::new).onRegister(compassNodeExist(GTCompassSections.MISC, "raw_carbon_fibers")).lang("Raw Carbon Fibers").register(); - public static ItemEntry CARBON_MESH = REGISTRATE.item("carbon_fiber_mesh", Item::new).onRegister(compassNodeExist(GTCompassSections.MISC, "carbon_fiber_mesh")).lang("Carbon Fiber Mesh").register(); - public static ItemEntry CARBON_FIBER_PLATE = REGISTRATE.item("carbon_fiber_plate", Item::new).onRegister(compassNodeExist(GTCompassSections.MISC, "carbon_fiber_plate")).lang("Carbon Fiber Plate").register(); - public static ItemEntry DUCT_TAPE = REGISTRATE.item("duct_tape", Item::new).onRegister(compassNode(GTCompassSections.MISC)).lang("BrainTech Aerospace Advanced Reinforced Duct Tape FAL-84").onRegister(compassNode(GTCompassSections.ITEMS)).register(); + public static ItemEntry CARBON_FIBERS = REGISTRATE.item("carbon_fibers", Item::new) + .onRegister(compassNodeExist(GTCompassSections.MISC, "raw_carbon_fibers")).lang("Raw Carbon Fibers") + .register(); + public static ItemEntry CARBON_MESH = REGISTRATE.item("carbon_fiber_mesh", Item::new) + .onRegister(compassNodeExist(GTCompassSections.MISC, "carbon_fiber_mesh")).lang("Carbon Fiber Mesh") + .register(); + public static ItemEntry CARBON_FIBER_PLATE = REGISTRATE.item("carbon_fiber_plate", Item::new) + .onRegister(compassNodeExist(GTCompassSections.MISC, "carbon_fiber_plate")).lang("Carbon Fiber Plate") + .register(); + public static ItemEntry DUCT_TAPE = REGISTRATE.item("duct_tape", Item::new) + .onRegister(compassNode(GTCompassSections.MISC)) + .lang("BrainTech Aerospace Advanced Reinforced Duct Tape FAL-84") + .onRegister(compassNode(GTCompassSections.ITEMS)).register(); - public static ItemEntry NEUTRON_REFLECTOR = REGISTRATE.item("neutron_reflector", Item::new).onRegister(compassNodeExist(GTCompassSections.ITEMS, "iridium_neutron_reflector")).lang("Iridium Neutron Reflector").register(); + public static ItemEntry NEUTRON_REFLECTOR = REGISTRATE.item("neutron_reflector", Item::new) + .onRegister(compassNodeExist(GTCompassSections.ITEMS, "iridium_neutron_reflector")) + .lang("Iridium Neutron Reflector").register(); - public static ItemEntry BATTERY_HULL_LV = REGISTRATE.item("lv_battery_hull", Item::new).lang("Small Battery Hull").onRegister(compassNodeExist(GTCompassSections.MISC, "battery_hull")).onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.BatteryAlloy, GTValues.M)))).register(); - public static ItemEntry BATTERY_HULL_MV = REGISTRATE.item("mv_battery_hull", Item::new).lang("Medium Battery Hull").onRegister(compassNodeExist(GTCompassSections.MISC, "battery_hull")).onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.BatteryAlloy, GTValues.M * 3)))).register(); - public static ItemEntry BATTERY_HULL_HV = REGISTRATE.item("hv_battery_hull", Item::new).lang("Large Battery Hull").onRegister(compassNodeExist(GTCompassSections.MISC, "battery_hull")).onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.BatteryAlloy, GTValues.M * 9)))).register(); - public static ItemEntry BATTERY_HULL_SMALL_VANADIUM = REGISTRATE.item("ev_battery_hull", Item::new).lang("Small Vanadium Battery Hull").onRegister(compassNodeExist(GTCompassSections.MISC, "battery_hull")).onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.BlueSteel, GTValues.M * 2)))).register(); - public static ItemEntry BATTERY_HULL_MEDIUM_VANADIUM = REGISTRATE.item("iv_battery_hull", Item::new).lang("Medium Vanadium Battery Hull").onRegister(compassNodeExist(GTCompassSections.MISC, "battery_hull")).onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.RoseGold, GTValues.M * 6)))).register(); - public static ItemEntry BATTERY_HULL_LARGE_VANADIUM = REGISTRATE.item("luv_battery_hull", Item::new).lang("Large Vanadium Battery Hull").onRegister(compassNodeExist(GTCompassSections.MISC, "battery_hull")).onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.RedSteel, GTValues.M * 18)))).register(); - public static ItemEntry BATTERY_HULL_MEDIUM_NAQUADRIA = REGISTRATE.item("zpm_battery_hull", Item::new).lang("Medium Naquadria Battery Hull").onRegister(compassNodeExist(GTCompassSections.MISC, "battery_hull")).onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Europium, GTValues.M * 6)))).register(); - public static ItemEntry BATTERY_HULL_LARGE_NAQUADRIA = REGISTRATE.item("uv_battery_hull", Item::new).lang("Large Naquadria Battery Hull").onRegister(compassNodeExist(GTCompassSections.MISC, "battery_hull")).onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Americium, GTValues.M * 18)))).register(); + public static ItemEntry BATTERY_HULL_LV = REGISTRATE.item("lv_battery_hull", Item::new) + .lang("Small Battery Hull").onRegister(compassNodeExist(GTCompassSections.MISC, "battery_hull")) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.BatteryAlloy, GTValues.M)))) + .register(); + public static ItemEntry BATTERY_HULL_MV = REGISTRATE.item("mv_battery_hull", Item::new) + .lang("Medium Battery Hull").onRegister(compassNodeExist(GTCompassSections.MISC, "battery_hull")) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.BatteryAlloy, GTValues.M * 3)))) + .register(); + public static ItemEntry BATTERY_HULL_HV = REGISTRATE.item("hv_battery_hull", Item::new) + .lang("Large Battery Hull").onRegister(compassNodeExist(GTCompassSections.MISC, "battery_hull")) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.BatteryAlloy, GTValues.M * 9)))) + .register(); + public static ItemEntry BATTERY_HULL_SMALL_VANADIUM = REGISTRATE.item("ev_battery_hull", Item::new) + .lang("Small Vanadium Battery Hull").onRegister(compassNodeExist(GTCompassSections.MISC, "battery_hull")) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.BlueSteel, GTValues.M * 2)))) + .register(); + public static ItemEntry BATTERY_HULL_MEDIUM_VANADIUM = REGISTRATE.item("iv_battery_hull", Item::new) + .lang("Medium Vanadium Battery Hull").onRegister(compassNodeExist(GTCompassSections.MISC, "battery_hull")) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.RoseGold, GTValues.M * 6)))) + .register(); + public static ItemEntry BATTERY_HULL_LARGE_VANADIUM = REGISTRATE.item("luv_battery_hull", Item::new) + .lang("Large Vanadium Battery Hull").onRegister(compassNodeExist(GTCompassSections.MISC, "battery_hull")) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.RedSteel, GTValues.M * 18)))) + .register(); + public static ItemEntry BATTERY_HULL_MEDIUM_NAQUADRIA = REGISTRATE.item("zpm_battery_hull", Item::new) + .lang("Medium Naquadria Battery Hull").onRegister(compassNodeExist(GTCompassSections.MISC, "battery_hull")) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Europium, GTValues.M * 6)))) + .register(); + public static ItemEntry BATTERY_HULL_LARGE_NAQUADRIA = REGISTRATE.item("uv_battery_hull", Item::new) + .lang("Large Naquadria Battery Hull").onRegister(compassNodeExist(GTCompassSections.MISC, "battery_hull")) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Americium, GTValues.M * 18)))) + .register(); - public static ItemEntry BATTERY_ULV_TANTALUM = REGISTRATE.item("tantalum_capacitor", ComponentItem::create) + public static ItemEntry BATTERY_ULV_TANTALUM = REGISTRATE + .item("tantalum_capacitor", ComponentItem::create) .lang("Tantalum Capacitor") .onRegister(compassNodeExist(GTCompassSections.BATTERIES, "tantalum_capacitor")) .onRegister(attach(ElectricStats.createRechargeableBattery(1000, GTValues.ULV))) .tag(CustomTags.ULV_BATTERIES).register(); - public static ItemEntry BATTERY_LV_SODIUM = REGISTRATE.item("lv_sodium_battery", ComponentItem::create) + public static ItemEntry BATTERY_LV_SODIUM = REGISTRATE + .item("lv_sodium_battery", ComponentItem::create) .lang("Small Sodium Battery") .model(overrideModel(GTCEu.id("battery"), 8)) .onRegister(compassNodeExist(GTCompassSections.BATTERIES, "small_sodium_battery")) .onRegister(modelPredicate(GTCEu.id("battery"), ElectricStats::getStoredPredicate)) .onRegister(attach(ElectricStats.createRechargeableBattery(80000, GTValues.LV))) .tag(CustomTags.LV_BATTERIES).register(); - public static ItemEntry BATTERY_MV_SODIUM = REGISTRATE.item("mv_sodium_battery", ComponentItem::create) + public static ItemEntry BATTERY_MV_SODIUM = REGISTRATE + .item("mv_sodium_battery", ComponentItem::create) .lang("Medium Sodium Battery") .model(overrideModel(GTCEu.id("battery"), 8)) .onRegister(compassNodeExist(GTCompassSections.BATTERIES, "medium_sodium_battery")) .onRegister(modelPredicate(GTCEu.id("battery"), ElectricStats::getStoredPredicate)) .onRegister(attach(ElectricStats.createRechargeableBattery(360000, GTValues.MV))) .tag(CustomTags.MV_BATTERIES).register(); - public static ItemEntry BATTERY_HV_SODIUM = REGISTRATE.item("hv_sodium_battery", ComponentItem::create) + public static ItemEntry BATTERY_HV_SODIUM = REGISTRATE + .item("hv_sodium_battery", ComponentItem::create) .lang("Large Sodium Battery") .model(overrideModel(GTCEu.id("battery"), 8)) .onRegister(compassNodeExist(GTCompassSections.BATTERIES, "large_sodium_battery")) @@ -499,21 +702,24 @@ public Component getItemName(ItemStack stack) { .onRegister(attach(ElectricStats.createRechargeableBattery(1200000, GTValues.HV))) .tag(CustomTags.HV_BATTERIES).register(); - public static ItemEntry BATTERY_LV_LITHIUM = REGISTRATE.item("lv_lithium_battery", ComponentItem::create) + public static ItemEntry BATTERY_LV_LITHIUM = REGISTRATE + .item("lv_lithium_battery", ComponentItem::create) .lang("Small Lithium Battery") .model(overrideModel(GTCEu.id("battery"), 8)) .onRegister(compassNodeExist(GTCompassSections.BATTERIES, "small_lithium_battery")) .onRegister(modelPredicate(GTCEu.id("battery"), ElectricStats::getStoredPredicate)) .onRegister(attach(ElectricStats.createRechargeableBattery(120000, GTValues.LV))) .tag(CustomTags.LV_BATTERIES).register(); - public static ItemEntry BATTERY_MV_LITHIUM = REGISTRATE.item("mv_lithium_battery", ComponentItem::create) + public static ItemEntry BATTERY_MV_LITHIUM = REGISTRATE + .item("mv_lithium_battery", ComponentItem::create) .lang("Medium Lithium Battery") .model(overrideModel(GTCEu.id("battery"), 8)) .onRegister(compassNodeExist(GTCompassSections.BATTERIES, "medium_lithium_battery")) .onRegister(modelPredicate(GTCEu.id("battery"), ElectricStats::getStoredPredicate)) .onRegister(attach(ElectricStats.createRechargeableBattery(420000, GTValues.MV))) .tag(CustomTags.MV_BATTERIES).register(); - public static ItemEntry BATTERY_HV_LITHIUM = REGISTRATE.item("hv_lithium_battery", ComponentItem::create) + public static ItemEntry BATTERY_HV_LITHIUM = REGISTRATE + .item("hv_lithium_battery", ComponentItem::create) .lang("Large Lithium Battery") .model(overrideModel(GTCEu.id("battery"), 8)) .onRegister(compassNodeExist(GTCompassSections.BATTERIES, "large_lithium_battery")) @@ -521,21 +727,24 @@ public Component getItemName(ItemStack stack) { .onRegister(attach(ElectricStats.createRechargeableBattery(1800000, GTValues.HV))) .tag(CustomTags.HV_BATTERIES).register(); - public static ItemEntry BATTERY_LV_CADMIUM = REGISTRATE.item("lv_cadmium_battery", ComponentItem::create) + public static ItemEntry BATTERY_LV_CADMIUM = REGISTRATE + .item("lv_cadmium_battery", ComponentItem::create) .lang("Small Cadmium Battery") .model(overrideModel(GTCEu.id("battery"), 8)) .onRegister(compassNodeExist(GTCompassSections.BATTERIES, "small_cadmium_battery")) .onRegister(modelPredicate(GTCEu.id("battery"), ElectricStats::getStoredPredicate)) .onRegister(attach(ElectricStats.createRechargeableBattery(100000, GTValues.LV))) .tag(CustomTags.LV_BATTERIES).register(); - public static ItemEntry BATTERY_MV_CADMIUM = REGISTRATE.item("mv_cadmium_battery", ComponentItem::create) + public static ItemEntry BATTERY_MV_CADMIUM = REGISTRATE + .item("mv_cadmium_battery", ComponentItem::create) .lang("Medium Cadmium Battery") .model(overrideModel(GTCEu.id("battery"), 8)) .onRegister(compassNodeExist(GTCompassSections.BATTERIES, "medium_cadmium_battery")) .onRegister(modelPredicate(GTCEu.id("battery"), ElectricStats::getStoredPredicate)) .onRegister(attach(ElectricStats.createRechargeableBattery(400000, GTValues.MV))) .tag(CustomTags.MV_BATTERIES).register(); - public static ItemEntry BATTERY_HV_CADMIUM = REGISTRATE.item("hv_cadmium_battery", ComponentItem::create) + public static ItemEntry BATTERY_HV_CADMIUM = REGISTRATE + .item("hv_cadmium_battery", ComponentItem::create) .lang("Large Cadmium Battery") .model(overrideModel(GTCEu.id("battery"), 8)) .onRegister(compassNodeExist(GTCompassSections.BATTERIES, "large_cadmium_battery")) @@ -557,21 +766,24 @@ public Component getItemName(ItemStack stack) { .onRegister(attach(ElectricStats.createRechargeableBattery(25_000_000L, GTValues.EV))) .tag(CustomTags.EV_BATTERIES).register(); - public static ItemEntry BATTERY_EV_VANADIUM = REGISTRATE.item("ev_vanadium_battery", ComponentItem::create) + public static ItemEntry BATTERY_EV_VANADIUM = REGISTRATE + .item("ev_vanadium_battery", ComponentItem::create) .lang("Small Vanadium Battery") .model(overrideModel(GTCEu.id("battery"), 8)) .onRegister(compassNodeExist(GTCompassSections.BATTERIES, "small_vanadium_battery")) .onRegister(modelPredicate(GTCEu.id("battery"), ElectricStats::getStoredPredicate)) .onRegister(attach(ElectricStats.createRechargeableBattery(10_240_000L, GTValues.EV))) .tag(CustomTags.EV_BATTERIES).register(); - public static ItemEntry BATTERY_IV_VANADIUM = REGISTRATE.item("iv_vanadium_battery", ComponentItem::create) + public static ItemEntry BATTERY_IV_VANADIUM = REGISTRATE + .item("iv_vanadium_battery", ComponentItem::create) .lang("Medium Vanadium Battery") .model(overrideModel(GTCEu.id("battery"), 8)) .onRegister(compassNodeExist(GTCompassSections.BATTERIES, "medium_vanadium_battery")) .onRegister(modelPredicate(GTCEu.id("battery"), ElectricStats::getStoredPredicate)) .onRegister(attach(ElectricStats.createRechargeableBattery(40_960_000L, GTValues.IV))) .tag(CustomTags.IV_BATTERIES).register(); - public static ItemEntry BATTERY_LUV_VANADIUM = REGISTRATE.item("luv_vanadium_battery", ComponentItem::create) + public static ItemEntry BATTERY_LUV_VANADIUM = REGISTRATE + .item("luv_vanadium_battery", ComponentItem::create) .lang("Large Vanadium Battery") .model(overrideModel(GTCEu.id("battery"), 8)) .onRegister(compassNodeExist(GTCompassSections.BATTERIES, "large_vanadium_battery")) @@ -579,14 +791,16 @@ public Component getItemName(ItemStack stack) { .onRegister(attach(ElectricStats.createRechargeableBattery(163_840_000L, GTValues.LuV))) .tag(CustomTags.LuV_BATTERIES).register(); - public static ItemEntry BATTERY_ZPM_NAQUADRIA = REGISTRATE.item("zpm_naquadria_battery", ComponentItem::create) + public static ItemEntry BATTERY_ZPM_NAQUADRIA = REGISTRATE + .item("zpm_naquadria_battery", ComponentItem::create) .lang("Medium Naquadria Battery") .model(overrideModel(GTCEu.id("battery"), 8)) .onRegister(compassNodeExist(GTCompassSections.BATTERIES, "medium_naquadria_battery")) .onRegister(modelPredicate(GTCEu.id("battery"), ElectricStats::getStoredPredicate)) .onRegister(attach(ElectricStats.createRechargeableBattery(655_360_000L, GTValues.ZPM))) .tag(CustomTags.ZPM_BATTERIES).register(); - public static ItemEntry BATTERY_UV_NAQUADRIA = REGISTRATE.item("uv_naquadria_battery", ComponentItem::create) + public static ItemEntry BATTERY_UV_NAQUADRIA = REGISTRATE + .item("uv_naquadria_battery", ComponentItem::create) .lang("Large Naquadria Battery") .model(overrideModel(GTCEu.id("battery"), 8)) .onRegister(compassNodeExist(GTCompassSections.BATTERIES, "large_naquadria_battery")) @@ -594,14 +808,16 @@ public Component getItemName(ItemStack stack) { .onRegister(attach(ElectricStats.createRechargeableBattery(2_621_440_000L, GTValues.UV))) .tag(CustomTags.UV_BATTERIES).register(); - public static ItemEntry ENERGY_LAPOTRONIC_ORB = REGISTRATE.item("lapotronic_energy_orb", ComponentItem::create) + public static ItemEntry ENERGY_LAPOTRONIC_ORB = REGISTRATE + .item("lapotronic_energy_orb", ComponentItem::create) .lang("Lapotronic Energy Orb") .model(overrideModel(GTCEu.id("battery"), 8)) .onRegister(compassNodeExist(GTCompassSections.BATTERIES, "lapotronic_energy_orb")) .onRegister(modelPredicate(GTCEu.id("battery"), ElectricStats::getStoredPredicate)) .onRegister(attach(ElectricStats.createRechargeableBattery(250_000_000L, GTValues.IV))) .tag(CustomTags.IV_BATTERIES).register(); - public static ItemEntry ENERGY_LAPOTRONIC_ORB_CLUSTER = REGISTRATE.item("lapotronic_energy_orb_cluster", ComponentItem::create) + public static ItemEntry ENERGY_LAPOTRONIC_ORB_CLUSTER = REGISTRATE + .item("lapotronic_energy_orb_cluster", ComponentItem::create) .lang("Lapotronic Energy Orb Cluster") .model(overrideModel(GTCEu.id("battery"), 8)) .onRegister(compassNodeExist(GTCompassSections.BATTERIES, "lapotronic_energy_orb_cluster")) @@ -624,7 +840,8 @@ public Component getItemName(ItemStack stack) { .onRegister(attach(ElectricStats.createRechargeableBattery(20_000_000_000L, GTValues.UV))) .tag(CustomTags.UV_BATTERIES).register(); - public static ItemEntry ZERO_POINT_MODULE = REGISTRATE.item("zero_point_module", ComponentItem::create) + public static ItemEntry ZERO_POINT_MODULE = REGISTRATE + .item("zero_point_module", ComponentItem::create) .lang("Zero Point Module") .model(overrideModel(GTCEu.id("battery"), 8)) .onRegister(compassNodeExist(GTCompassSections.BATTERIES, "zero_point_module")) @@ -638,19 +855,50 @@ public Component getItemName(ItemStack stack) { .onRegister(attach(ElectricStats.createRechargeableBattery(Long.MAX_VALUE, GTValues.UHV))) .tag(CustomTags.UHV_BATTERIES).register(); - public static ItemEntry ELECTRIC_MOTOR_LV = REGISTRATE.item("lv_electric_motor", Item::new).lang("LV Electric Motor").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "electric_motor")).register(); - public static ItemEntry ELECTRIC_MOTOR_MV = REGISTRATE.item("mv_electric_motor", Item::new).lang("MV Electric Motor").onRegister(compassNodeExist(GTCompassSections.MISC, "electric_motor")).register(); - public static ItemEntry ELECTRIC_MOTOR_HV = REGISTRATE.item("hv_electric_motor", Item::new).lang("HV Electric Motor").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "electric_motor")).register(); - public static ItemEntry ELECTRIC_MOTOR_EV = REGISTRATE.item("ev_electric_motor", Item::new).lang("EV Electric Motor").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "electric_motor")).register(); - public static ItemEntry ELECTRIC_MOTOR_IV = REGISTRATE.item("iv_electric_motor", Item::new).lang("IV Electric Motor").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "electric_motor")).register(); - public static ItemEntry ELECTRIC_MOTOR_LuV = REGISTRATE.item("luv_electric_motor", Item::new).lang("LuV Electric Motor").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "electric_motor")).register(); - public static ItemEntry ELECTRIC_MOTOR_ZPM = REGISTRATE.item("zpm_electric_motor", Item::new).lang("ZPM Electric Motor").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "electric_motor")).register(); - public static ItemEntry ELECTRIC_MOTOR_UV = REGISTRATE.item("uv_electric_motor", Item::new).lang("UV Electric Motor").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "electric_motor")).register(); - public static ItemEntry ELECTRIC_MOTOR_UHV = GTCEuAPI.isHighTier() ? REGISTRATE.item("uhv_electric_motor", Item::new).lang("UHV Electric Motor").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "electric_motor")).register() : null; - public static ItemEntry ELECTRIC_MOTOR_UEV = GTCEuAPI.isHighTier() ? REGISTRATE.item("uev_electric_motor", Item::new).lang("UEV Electric Motor").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "electric_motor")).register() : null; - public static ItemEntry ELECTRIC_MOTOR_UIV = GTCEuAPI.isHighTier() ? REGISTRATE.item("uiv_electric_motor", Item::new).lang("UIV Electric Motor").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "electric_motor")).register() : null; - public static ItemEntry ELECTRIC_MOTOR_UXV = GTCEuAPI.isHighTier() ? REGISTRATE.item("uxv_electric_motor", Item::new).lang("UXV Electric Motor").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "electric_motor")).register() : null; - public static ItemEntry ELECTRIC_MOTOR_OpV = GTCEuAPI.isHighTier() ? REGISTRATE.item("opv_electric_motor", Item::new).lang("OpV Electric Motor").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "electric_motor")).register() : null; + public static ItemEntry ELECTRIC_MOTOR_LV = REGISTRATE.item("lv_electric_motor", Item::new) + .lang("LV Electric Motor").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "electric_motor")) + .register(); + public static ItemEntry ELECTRIC_MOTOR_MV = REGISTRATE.item("mv_electric_motor", Item::new) + .lang("MV Electric Motor").onRegister(compassNodeExist(GTCompassSections.MISC, "electric_motor")) + .register(); + public static ItemEntry ELECTRIC_MOTOR_HV = REGISTRATE.item("hv_electric_motor", Item::new) + .lang("HV Electric Motor").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "electric_motor")) + .register(); + public static ItemEntry ELECTRIC_MOTOR_EV = REGISTRATE.item("ev_electric_motor", Item::new) + .lang("EV Electric Motor").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "electric_motor")) + .register(); + public static ItemEntry ELECTRIC_MOTOR_IV = REGISTRATE.item("iv_electric_motor", Item::new) + .lang("IV Electric Motor").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "electric_motor")) + .register(); + public static ItemEntry ELECTRIC_MOTOR_LuV = REGISTRATE.item("luv_electric_motor", Item::new) + .lang("LuV Electric Motor").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "electric_motor")) + .register(); + public static ItemEntry ELECTRIC_MOTOR_ZPM = REGISTRATE.item("zpm_electric_motor", Item::new) + .lang("ZPM Electric Motor").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "electric_motor")) + .register(); + public static ItemEntry ELECTRIC_MOTOR_UV = REGISTRATE.item("uv_electric_motor", Item::new) + .lang("UV Electric Motor").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "electric_motor")) + .register(); + public static ItemEntry ELECTRIC_MOTOR_UHV = GTCEuAPI.isHighTier() ? + REGISTRATE.item("uhv_electric_motor", Item::new).lang("UHV Electric Motor") + .onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "electric_motor")).register() : + null; + public static ItemEntry ELECTRIC_MOTOR_UEV = GTCEuAPI.isHighTier() ? + REGISTRATE.item("uev_electric_motor", Item::new).lang("UEV Electric Motor") + .onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "electric_motor")).register() : + null; + public static ItemEntry ELECTRIC_MOTOR_UIV = GTCEuAPI.isHighTier() ? + REGISTRATE.item("uiv_electric_motor", Item::new).lang("UIV Electric Motor") + .onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "electric_motor")).register() : + null; + public static ItemEntry ELECTRIC_MOTOR_UXV = GTCEuAPI.isHighTier() ? + REGISTRATE.item("uxv_electric_motor", Item::new).lang("UXV Electric Motor") + .onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "electric_motor")).register() : + null; + public static ItemEntry ELECTRIC_MOTOR_OpV = GTCEuAPI.isHighTier() ? + REGISTRATE.item("opv_electric_motor", Item::new).lang("OpV Electric Motor") + .onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "electric_motor")).register() : + null; public static ItemEntry ELECTRIC_PUMP_LV = REGISTRATE.item("lv_electric_pump", ComponentItem::create) .lang("LV Electric Pump") @@ -698,7 +946,8 @@ public Component getItemName(ItemStack stack) { }))) .onRegister(compassNodeExist(GTCompassSections.COVERS, "pump", GTCompassNodes.COVER)) .register(); - public static ItemEntry ELECTRIC_PUMP_LuV = REGISTRATE.item("luv_electric_pump", ComponentItem::create) + public static ItemEntry ELECTRIC_PUMP_LuV = REGISTRATE + .item("luv_electric_pump", ComponentItem::create) .lang("LuV Electric Pump") .onRegister(attach(new CoverPlaceBehavior(GTCovers.PUMPS[5]))) .onRegister(attach(new TooltipBehavior(lines -> { @@ -707,7 +956,8 @@ public Component getItemName(ItemStack stack) { }))) .onRegister(compassNodeExist(GTCompassSections.COVERS, "pump", GTCompassNodes.COVER)) .register(); - public static ItemEntry ELECTRIC_PUMP_ZPM = REGISTRATE.item("zpm_electric_pump", ComponentItem::create) + public static ItemEntry ELECTRIC_PUMP_ZPM = REGISTRATE + .item("zpm_electric_pump", ComponentItem::create) .lang("ZPM Electric Pump") .onRegister(attach(new CoverPlaceBehavior(GTCovers.PUMPS[6]))) .onRegister(attach(new TooltipBehavior(lines -> { @@ -721,62 +971,79 @@ public Component getItemName(ItemStack stack) { .onRegister(attach(new CoverPlaceBehavior(GTCovers.PUMPS[7]))) .onRegister(attach(new TooltipBehavior(lines -> { lines.add(Component.translatable("item.gtceu.electric.pump.tooltip")); - lines.add(Component.translatable("gtceu.universal.tooltip.fluid_transfer_rate", 1280 * 64 * 64 * 4 / 20)); + lines.add( + Component.translatable("gtceu.universal.tooltip.fluid_transfer_rate", 1280 * 64 * 64 * 4 / 20)); }))) .onRegister(compassNodeExist(GTCompassSections.COVERS, "pump", GTCompassNodes.COVER)) .register(); - public static ItemEntry ELECTRIC_PUMP_UHV = GTCEuAPI.isHighTier() ? REGISTRATE.item("uhv_electric_pump", ComponentItem::create) - .lang("UHV Electric Pump") - .onRegister(attach(new CoverPlaceBehavior(GTCovers.PUMPS[8]))) - .onRegister(attach(new TooltipBehavior(lines -> { - lines.add(Component.translatable("item.gtceu.electric.pump.tooltip")); - lines.add(Component.translatable("gtceu.universal.tooltip.fluid_transfer_rate", 1280 * 64 * 64 * 4 / 20)); - }))) - .onRegister(compassNodeExist(GTCompassSections.COVERS, "pump", GTCompassNodes.COVER)) - .register() : null; - - public static ItemEntry ELECTRIC_PUMP_UEV = GTCEuAPI.isHighTier() ? REGISTRATE.item("uev_electric_pump", ComponentItem::create) - .lang("UEV Electric Pump") - .onRegister(attach(new CoverPlaceBehavior(GTCovers.PUMPS[9]))) - .onRegister(attach(new TooltipBehavior(lines -> { - lines.add(Component.translatable("item.gtceu.electric.pump.tooltip")); - lines.add(Component.translatable("gtceu.universal.tooltip.fluid_transfer_rate", 1280 * 64 * 64 * 4 / 20)); - }))) - .onRegister(compassNodeExist(GTCompassSections.COVERS, "pump", GTCompassNodes.COVER)) - .register() : null; - - public static ItemEntry ELECTRIC_PUMP_UIV = GTCEuAPI.isHighTier() ? REGISTRATE.item("uiv_electric_pump", ComponentItem::create) - .lang("UIV Electric Pump") - .onRegister(attach(new CoverPlaceBehavior(GTCovers.PUMPS[10]))) - .onRegister(attach(new TooltipBehavior(lines -> { - lines.add(Component.translatable("item.gtceu.electric.pump.tooltip")); - lines.add(Component.translatable("gtceu.universal.tooltip.fluid_transfer_rate", 1280 * 64 * 64 * 4 / 20)); - }))) - .onRegister(compassNodeExist(GTCompassSections.COVERS, "pump", GTCompassNodes.COVER)) - .register() : null; - - public static ItemEntry ELECTRIC_PUMP_UXV = GTCEuAPI.isHighTier() ? REGISTRATE.item("uxv_electric_pump", ComponentItem::create) - .lang("UXV Electric Pump") - .onRegister(attach(new CoverPlaceBehavior(GTCovers.PUMPS[11]))) - .onRegister(attach(new TooltipBehavior(lines -> { - lines.add(Component.translatable("item.gtceu.electric.pump.tooltip")); - lines.add(Component.translatable("gtceu.universal.tooltip.fluid_transfer_rate", 1280 * 64 * 64 * 4 / 20)); - }))) - .onRegister(compassNodeExist(GTCompassSections.COVERS, "pump", GTCompassNodes.COVER)) - .register() : null; - - public static ItemEntry ELECTRIC_PUMP_OpV = GTCEuAPI.isHighTier() ? REGISTRATE.item("opv_electric_pump", ComponentItem::create) - .lang("OpV Electric Pump") - .onRegister(attach(new CoverPlaceBehavior(GTCovers.PUMPS[12]))) - .onRegister(attach(new TooltipBehavior(lines -> { - lines.add(Component.translatable("item.gtceu.electric.pump.tooltip")); - lines.add(Component.translatable("gtceu.universal.tooltip.fluid_transfer_rate", 1280 * 64 * 64 * 4 / 20)); - }))) - .onRegister(compassNodeExist(GTCompassSections.COVERS, "pump", GTCompassNodes.COVER)) - .register() : null; - - public static ItemEntry FLUID_REGULATOR_LV = REGISTRATE.item("lv_fluid_regulator", ComponentItem::create) + public static ItemEntry ELECTRIC_PUMP_UHV = GTCEuAPI.isHighTier() ? + REGISTRATE.item("uhv_electric_pump", ComponentItem::create) + .lang("UHV Electric Pump") + .onRegister(attach(new CoverPlaceBehavior(GTCovers.PUMPS[8]))) + .onRegister(attach(new TooltipBehavior(lines -> { + lines.add(Component.translatable("item.gtceu.electric.pump.tooltip")); + lines.add(Component.translatable("gtceu.universal.tooltip.fluid_transfer_rate", + 1280 * 64 * 64 * 4 / 20)); + }))) + .onRegister(compassNodeExist(GTCompassSections.COVERS, "pump", GTCompassNodes.COVER)) + .register() : + null; + + public static ItemEntry ELECTRIC_PUMP_UEV = GTCEuAPI.isHighTier() ? + REGISTRATE.item("uev_electric_pump", ComponentItem::create) + .lang("UEV Electric Pump") + .onRegister(attach(new CoverPlaceBehavior(GTCovers.PUMPS[9]))) + .onRegister(attach(new TooltipBehavior(lines -> { + lines.add(Component.translatable("item.gtceu.electric.pump.tooltip")); + lines.add(Component.translatable("gtceu.universal.tooltip.fluid_transfer_rate", + 1280 * 64 * 64 * 4 / 20)); + }))) + .onRegister(compassNodeExist(GTCompassSections.COVERS, "pump", GTCompassNodes.COVER)) + .register() : + null; + + public static ItemEntry ELECTRIC_PUMP_UIV = GTCEuAPI.isHighTier() ? + REGISTRATE.item("uiv_electric_pump", ComponentItem::create) + .lang("UIV Electric Pump") + .onRegister(attach(new CoverPlaceBehavior(GTCovers.PUMPS[10]))) + .onRegister(attach(new TooltipBehavior(lines -> { + lines.add(Component.translatable("item.gtceu.electric.pump.tooltip")); + lines.add(Component.translatable("gtceu.universal.tooltip.fluid_transfer_rate", + 1280 * 64 * 64 * 4 / 20)); + }))) + .onRegister(compassNodeExist(GTCompassSections.COVERS, "pump", GTCompassNodes.COVER)) + .register() : + null; + + public static ItemEntry ELECTRIC_PUMP_UXV = GTCEuAPI.isHighTier() ? + REGISTRATE.item("uxv_electric_pump", ComponentItem::create) + .lang("UXV Electric Pump") + .onRegister(attach(new CoverPlaceBehavior(GTCovers.PUMPS[11]))) + .onRegister(attach(new TooltipBehavior(lines -> { + lines.add(Component.translatable("item.gtceu.electric.pump.tooltip")); + lines.add(Component.translatable("gtceu.universal.tooltip.fluid_transfer_rate", + 1280 * 64 * 64 * 4 / 20)); + }))) + .onRegister(compassNodeExist(GTCompassSections.COVERS, "pump", GTCompassNodes.COVER)) + .register() : + null; + + public static ItemEntry ELECTRIC_PUMP_OpV = GTCEuAPI.isHighTier() ? + REGISTRATE.item("opv_electric_pump", ComponentItem::create) + .lang("OpV Electric Pump") + .onRegister(attach(new CoverPlaceBehavior(GTCovers.PUMPS[12]))) + .onRegister(attach(new TooltipBehavior(lines -> { + lines.add(Component.translatable("item.gtceu.electric.pump.tooltip")); + lines.add(Component.translatable("gtceu.universal.tooltip.fluid_transfer_rate", + 1280 * 64 * 64 * 4 / 20)); + }))) + .onRegister(compassNodeExist(GTCompassSections.COVERS, "pump", GTCompassNodes.COVER)) + .register() : + null; + + public static ItemEntry FLUID_REGULATOR_LV = REGISTRATE + .item("lv_fluid_regulator", ComponentItem::create) .lang("LV Fluid Regulator") .onRegister(attach(new CoverPlaceBehavior(GTCovers.FLUID_REGULATORS[0]))) .onRegister(attach(new TooltipBehavior(lines -> { @@ -785,7 +1052,8 @@ public Component getItemName(ItemStack stack) { }))) .onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "fluid_regulator")) .register(); - public static ItemEntry FLUID_REGULATOR_MV = REGISTRATE.item("mv_fluid_regulator", ComponentItem::create) + public static ItemEntry FLUID_REGULATOR_MV = REGISTRATE + .item("mv_fluid_regulator", ComponentItem::create) .lang("MV Fluid Regulator") .onRegister(attach(new CoverPlaceBehavior(GTCovers.FLUID_REGULATORS[1]))) .onRegister(attach(new TooltipBehavior(lines -> { @@ -794,7 +1062,8 @@ public Component getItemName(ItemStack stack) { }))) .onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "fluid_regulator")) .register(); - public static ItemEntry FLUID_REGULATOR_HV = REGISTRATE.item("hv_fluid_regulator", ComponentItem::create) + public static ItemEntry FLUID_REGULATOR_HV = REGISTRATE + .item("hv_fluid_regulator", ComponentItem::create) .lang("HV Fluid Regulator") .onRegister(attach(new CoverPlaceBehavior(GTCovers.FLUID_REGULATORS[2]))) .onRegister(attach(new TooltipBehavior(lines -> { @@ -803,7 +1072,8 @@ public Component getItemName(ItemStack stack) { }))) .onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "fluid_regulator")) .register(); - public static ItemEntry FLUID_REGULATOR_EV = REGISTRATE.item("ev_fluid_regulator", ComponentItem::create) + public static ItemEntry FLUID_REGULATOR_EV = REGISTRATE + .item("ev_fluid_regulator", ComponentItem::create) .lang("EV Fluid Regulator") .onRegister(attach(new CoverPlaceBehavior(GTCovers.FLUID_REGULATORS[3]))) .onRegister(attach(new TooltipBehavior(lines -> { @@ -812,7 +1082,8 @@ public Component getItemName(ItemStack stack) { }))) .onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "fluid_regulator")) .register(); - public static ItemEntry FLUID_REGULATOR_IV = REGISTRATE.item("iv_fluid_regulator", ComponentItem::create) + public static ItemEntry FLUID_REGULATOR_IV = REGISTRATE + .item("iv_fluid_regulator", ComponentItem::create) .lang("IV Fluid Regulator") .onRegister(attach(new CoverPlaceBehavior(GTCovers.FLUID_REGULATORS[4]))) .onRegister(attach(new TooltipBehavior(lines -> { @@ -821,7 +1092,8 @@ public Component getItemName(ItemStack stack) { }))) .onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "fluid_regulator")) .register(); - public static ItemEntry FLUID_REGULATOR_LUV = REGISTRATE.item("luv_fluid_regulator", ComponentItem::create) + public static ItemEntry FLUID_REGULATOR_LUV = REGISTRATE + .item("luv_fluid_regulator", ComponentItem::create) .lang("LuV Fluid Regulator") .onRegister(attach(new CoverPlaceBehavior(GTCovers.FLUID_REGULATORS[5]))) .onRegister(attach(new TooltipBehavior(lines -> { @@ -830,7 +1102,8 @@ public Component getItemName(ItemStack stack) { }))) .onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "fluid_regulator")) .register(); - public static ItemEntry FLUID_REGULATOR_ZPM = REGISTRATE.item("zpm_fluid_regulator", ComponentItem::create) + public static ItemEntry FLUID_REGULATOR_ZPM = REGISTRATE + .item("zpm_fluid_regulator", ComponentItem::create) .lang("ZPM Fluid Regulator") .onRegister(attach(new CoverPlaceBehavior(GTCovers.FLUID_REGULATORS[6]))) .onRegister(attach(new TooltipBehavior(lines -> { @@ -839,63 +1112,81 @@ public Component getItemName(ItemStack stack) { }))) .onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "fluid_regulator")) .register(); - public static ItemEntry FLUID_REGULATOR_UV = REGISTRATE.item("uv_fluid_regulator", ComponentItem::create) + public static ItemEntry FLUID_REGULATOR_UV = REGISTRATE + .item("uv_fluid_regulator", ComponentItem::create) .lang("UV Fluid Regulator") .onRegister(attach(new CoverPlaceBehavior(GTCovers.FLUID_REGULATORS[7]))) .onRegister(attach(new TooltipBehavior(lines -> { lines.add(Component.translatable("item.gtceu.fluid.regulator.tooltip")); - lines.add(Component.translatable("gtceu.universal.tooltip.fluid_transfer_rate", 1280 * 64 * 64 * 4 / 20)); + lines.add( + Component.translatable("gtceu.universal.tooltip.fluid_transfer_rate", 1280 * 64 * 64 * 4 / 20)); }))) .onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "fluid_regulator")) .register(); - public static ItemEntry FLUID_REGULATOR_UHV = GTCEuAPI.isHighTier() ? REGISTRATE.item("uhv_fluid_regulator", ComponentItem::create) - .lang("UHV Fluid Regulator") - .onRegister(attach(new CoverPlaceBehavior(GTCovers.FLUID_REGULATORS[8]))) - .onRegister(attach(new TooltipBehavior(lines -> { - lines.add(Component.translatable("item.gtceu.fluid.regulator.tooltip")); - lines.add(Component.translatable("gtceu.universal.tooltip.fluid_transfer_rate", 1280 * 64 * 64 * 4 / 20)); - }))) - .register() : null; - public static ItemEntry FLUID_REGULATOR_UEV = GTCEuAPI.isHighTier() ? REGISTRATE.item("uev_fluid_regulator", ComponentItem::create) - .lang("UEV Fluid Regulator") - .onRegister(attach(new CoverPlaceBehavior(GTCovers.FLUID_REGULATORS[9]))) - .onRegister(attach(new TooltipBehavior(lines -> { - lines.add(Component.translatable("item.gtceu.fluid.regulator.tooltip")); - lines.add(Component.translatable("gtceu.universal.tooltip.fluid_transfer_rate", 1280 * 64 * 64 * 4 / 20)); - }))) - .register() : null; - public static ItemEntry FLUID_REGULATOR_UIV = GTCEuAPI.isHighTier() ? REGISTRATE.item("uiv_fluid_regulator", ComponentItem::create) - .lang("UIV Fluid Regulator") - .onRegister(attach(new CoverPlaceBehavior(GTCovers.FLUID_REGULATORS[10]))) - .onRegister(attach(new TooltipBehavior(lines -> { - lines.add(Component.translatable("item.gtceu.fluid.regulator.tooltip")); - lines.add(Component.translatable("gtceu.universal.tooltip.fluid_transfer_rate", 1280 * 64 * 64 * 4 / 20)); - }))) - .register() : null; - public static ItemEntry FLUID_REGULATOR_UXV = GTCEuAPI.isHighTier() ? REGISTRATE.item("uxv_fluid_regulator", ComponentItem::create) - .lang("UXV Fluid Regulator") - .onRegister(attach(new CoverPlaceBehavior(GTCovers.FLUID_REGULATORS[11]))) - .onRegister(attach(new TooltipBehavior(lines -> { - lines.add(Component.translatable("item.gtceu.fluid.regulator.tooltip")); - lines.add(Component.translatable("gtceu.universal.tooltip.fluid_transfer_rate", 1280 * 64 * 64 * 4 / 20)); - }))) - .register() : null; - public static ItemEntry FLUID_REGULATOR_OpV = GTCEuAPI.isHighTier() ? REGISTRATE.item("opv_fluid_regulator", ComponentItem::create) - .lang("OpV Fluid Regulator") - .onRegister(attach(new CoverPlaceBehavior(GTCovers.FLUID_REGULATORS[12]))) - .onRegister(attach(new TooltipBehavior(lines -> { - lines.add(Component.translatable("item.gtceu.fluid.regulator.tooltip")); - lines.add(Component.translatable("gtceu.universal.tooltip.fluid_transfer_rate", 1280 * 64 * 64 * 4 / 20)); - }))) - .register() : null; + public static ItemEntry FLUID_REGULATOR_UHV = GTCEuAPI.isHighTier() ? + REGISTRATE.item("uhv_fluid_regulator", ComponentItem::create) + .lang("UHV Fluid Regulator") + .onRegister(attach(new CoverPlaceBehavior(GTCovers.FLUID_REGULATORS[8]))) + .onRegister(attach(new TooltipBehavior(lines -> { + lines.add(Component.translatable("item.gtceu.fluid.regulator.tooltip")); + lines.add(Component.translatable("gtceu.universal.tooltip.fluid_transfer_rate", + 1280 * 64 * 64 * 4 / 20)); + }))) + .register() : + null; + public static ItemEntry FLUID_REGULATOR_UEV = GTCEuAPI.isHighTier() ? + REGISTRATE.item("uev_fluid_regulator", ComponentItem::create) + .lang("UEV Fluid Regulator") + .onRegister(attach(new CoverPlaceBehavior(GTCovers.FLUID_REGULATORS[9]))) + .onRegister(attach(new TooltipBehavior(lines -> { + lines.add(Component.translatable("item.gtceu.fluid.regulator.tooltip")); + lines.add(Component.translatable("gtceu.universal.tooltip.fluid_transfer_rate", + 1280 * 64 * 64 * 4 / 20)); + }))) + .register() : + null; + public static ItemEntry FLUID_REGULATOR_UIV = GTCEuAPI.isHighTier() ? + REGISTRATE.item("uiv_fluid_regulator", ComponentItem::create) + .lang("UIV Fluid Regulator") + .onRegister(attach(new CoverPlaceBehavior(GTCovers.FLUID_REGULATORS[10]))) + .onRegister(attach(new TooltipBehavior(lines -> { + lines.add(Component.translatable("item.gtceu.fluid.regulator.tooltip")); + lines.add(Component.translatable("gtceu.universal.tooltip.fluid_transfer_rate", + 1280 * 64 * 64 * 4 / 20)); + }))) + .register() : + null; + public static ItemEntry FLUID_REGULATOR_UXV = GTCEuAPI.isHighTier() ? + REGISTRATE.item("uxv_fluid_regulator", ComponentItem::create) + .lang("UXV Fluid Regulator") + .onRegister(attach(new CoverPlaceBehavior(GTCovers.FLUID_REGULATORS[11]))) + .onRegister(attach(new TooltipBehavior(lines -> { + lines.add(Component.translatable("item.gtceu.fluid.regulator.tooltip")); + lines.add(Component.translatable("gtceu.universal.tooltip.fluid_transfer_rate", + 1280 * 64 * 64 * 4 / 20)); + }))) + .register() : + null; + public static ItemEntry FLUID_REGULATOR_OpV = GTCEuAPI.isHighTier() ? + REGISTRATE.item("opv_fluid_regulator", ComponentItem::create) + .lang("OpV Fluid Regulator") + .onRegister(attach(new CoverPlaceBehavior(GTCovers.FLUID_REGULATORS[12]))) + .onRegister(attach(new TooltipBehavior(lines -> { + lines.add(Component.translatable("item.gtceu.fluid.regulator.tooltip")); + lines.add(Component.translatable("gtceu.universal.tooltip.fluid_transfer_rate", + 1280 * 64 * 64 * 4 / 20)); + }))) + .register() : + null; public static ItemEntry DYNAMITE = REGISTRATE.item("dynamite", ComponentItem::create) - .lang("Dynamite") - .onRegister(attach(new DynamiteBehaviour())) - .tab(TOOL.getKey()) - .register(); + .lang("Dynamite") + .onRegister(attach(new DynamiteBehaviour())) + .tab(TOOL.getKey()) + .register(); - public static ItemEntry CONVEYOR_MODULE_LV = REGISTRATE.item("lv_conveyor_module", ComponentItem::create) + public static ItemEntry CONVEYOR_MODULE_LV = REGISTRATE + .item("lv_conveyor_module", ComponentItem::create) .lang("LV Conveyor Module") .onRegister(attach(new CoverPlaceBehavior(GTCovers.CONVEYORS[0]))) .onRegister(attach(new TooltipBehavior(lines -> { @@ -904,7 +1195,8 @@ public Component getItemName(ItemStack stack) { }))) .onRegister(compassNodeExist(GTCompassSections.COVERS, "conveyor", GTCompassNodes.COVER)) .register(); - public static ItemEntry CONVEYOR_MODULE_MV = REGISTRATE.item("mv_conveyor_module", ComponentItem::create) + public static ItemEntry CONVEYOR_MODULE_MV = REGISTRATE + .item("mv_conveyor_module", ComponentItem::create) .lang("MV Conveyor Module") .onRegister(attach(new CoverPlaceBehavior(GTCovers.CONVEYORS[1]))) .onRegister(attach(new TooltipBehavior(lines -> { @@ -913,7 +1205,8 @@ public Component getItemName(ItemStack stack) { }))) .onRegister(compassNodeExist(GTCompassSections.COVERS, "conveyor", GTCompassNodes.COVER)) .register(); - public static ItemEntry CONVEYOR_MODULE_HV = REGISTRATE.item("hv_conveyor_module", ComponentItem::create) + public static ItemEntry CONVEYOR_MODULE_HV = REGISTRATE + .item("hv_conveyor_module", ComponentItem::create) .lang("HV Conveyor Module") .onRegister(attach(new CoverPlaceBehavior(GTCovers.CONVEYORS[2]))) .onRegister(attach(new TooltipBehavior(lines -> { @@ -922,7 +1215,8 @@ public Component getItemName(ItemStack stack) { }))) .onRegister(compassNodeExist(GTCompassSections.COVERS, "conveyor", GTCompassNodes.COVER)) .register(); - public static ItemEntry CONVEYOR_MODULE_EV = REGISTRATE.item("ev_conveyor_module", ComponentItem::create) + public static ItemEntry CONVEYOR_MODULE_EV = REGISTRATE + .item("ev_conveyor_module", ComponentItem::create) .lang("EV Conveyor Module") .onRegister(attach(new CoverPlaceBehavior(GTCovers.CONVEYORS[3]))) .onRegister(attach(new TooltipBehavior(lines -> { @@ -931,7 +1225,8 @@ public Component getItemName(ItemStack stack) { }))) .onRegister(compassNodeExist(GTCompassSections.COVERS, "conveyor", GTCompassNodes.COVER)) .register(); - public static ItemEntry CONVEYOR_MODULE_IV = REGISTRATE.item("iv_conveyor_module", ComponentItem::create) + public static ItemEntry CONVEYOR_MODULE_IV = REGISTRATE + .item("iv_conveyor_module", ComponentItem::create) .lang("IV Conveyor Module") .onRegister(attach(new CoverPlaceBehavior(GTCovers.CONVEYORS[4]))) .onRegister(attach(new TooltipBehavior(lines -> { @@ -940,7 +1235,8 @@ public Component getItemName(ItemStack stack) { }))) .onRegister(compassNodeExist(GTCompassSections.COVERS, "conveyor", GTCompassNodes.COVER)) .register(); - public static ItemEntry CONVEYOR_MODULE_LuV = REGISTRATE.item("luv_conveyor_module", ComponentItem::create) + public static ItemEntry CONVEYOR_MODULE_LuV = REGISTRATE + .item("luv_conveyor_module", ComponentItem::create) .lang("LuV Conveyor Module") .onRegister(attach(new CoverPlaceBehavior(GTCovers.CONVEYORS[5]))) .onRegister(attach(new TooltipBehavior(lines -> { @@ -949,7 +1245,8 @@ public Component getItemName(ItemStack stack) { }))) .onRegister(compassNodeExist(GTCompassSections.COVERS, "conveyor", GTCompassNodes.COVER)) .register(); - public static ItemEntry CONVEYOR_MODULE_ZPM = REGISTRATE.item("zpm_conveyor_module", ComponentItem::create) + public static ItemEntry CONVEYOR_MODULE_ZPM = REGISTRATE + .item("zpm_conveyor_module", ComponentItem::create) .lang("ZPM Conveyor Module") .onRegister(attach(new CoverPlaceBehavior(GTCovers.CONVEYORS[6]))) .onRegister(attach(new TooltipBehavior(lines -> { @@ -958,7 +1255,8 @@ public Component getItemName(ItemStack stack) { }))) .onRegister(compassNodeExist(GTCompassSections.COVERS, "conveyor", GTCompassNodes.COVER)) .register(); - public static ItemEntry CONVEYOR_MODULE_UV = REGISTRATE.item("uv_conveyor_module", ComponentItem::create) + public static ItemEntry CONVEYOR_MODULE_UV = REGISTRATE + .item("uv_conveyor_module", ComponentItem::create) .lang("UV Conveyor Module") .onRegister(attach(new CoverPlaceBehavior(GTCovers.CONVEYORS[7]))) .onRegister(attach(new TooltipBehavior(lines -> { @@ -967,69 +1265,105 @@ public Component getItemName(ItemStack stack) { }))) .onRegister(compassNodeExist(GTCompassSections.COVERS, "conveyor", GTCompassNodes.COVER)) .register(); - public static ItemEntry CONVEYOR_MODULE_UHV = GTCEuAPI.isHighTier() ? REGISTRATE.item("uhv_conveyor_module", ComponentItem::create) - .lang("UHV Conveyor Module") - .onRegister(attach(new CoverPlaceBehavior(GTCovers.CONVEYORS[8]))) - .onRegister(attach(new TooltipBehavior(lines -> { - lines.add(Component.translatable("item.gtceu.conveyor.module.tooltip")); - lines.add(Component.translatable("gtceu.universal.tooltip.item_transfer_rate_stacks", 16)); - }))) - .onRegister(compassNodeExist(GTCompassSections.COVERS, "conveyor", GTCompassNodes.COVER)) - .register() : null; - public static ItemEntry CONVEYOR_MODULE_UEV = GTCEuAPI.isHighTier() ? REGISTRATE.item("uev_conveyor_module", ComponentItem::create) - .lang("UEV Conveyor Module") - .onRegister(attach(new CoverPlaceBehavior(GTCovers.CONVEYORS[9]))) - .onRegister(attach(new TooltipBehavior(lines -> { - lines.add(Component.translatable("item.gtceu.conveyor.module.tooltip")); - lines.add(Component.translatable("gtceu.universal.tooltip.item_transfer_rate_stacks", 16)); - }))) - .onRegister(compassNodeExist(GTCompassSections.COVERS, "conveyor", GTCompassNodes.COVER)) - .register() : null; - public static ItemEntry CONVEYOR_MODULE_UIV = GTCEuAPI.isHighTier() ? REGISTRATE.item("uiv_conveyor_module", ComponentItem::create) - .lang("UIV Conveyor Module") - .onRegister(attach(new CoverPlaceBehavior(GTCovers.CONVEYORS[10]))) - .onRegister(attach(new TooltipBehavior(lines -> { - lines.add(Component.translatable("item.gtceu.conveyor.module.tooltip")); - lines.add(Component.translatable("gtceu.universal.tooltip.item_transfer_rate_stacks", 16)); - }))) - .onRegister(compassNodeExist(GTCompassSections.COVERS, "conveyor", GTCompassNodes.COVER)) - .register() : null; - public static ItemEntry CONVEYOR_MODULE_UXV = GTCEuAPI.isHighTier() ? REGISTRATE.item("uxv_conveyor_module", ComponentItem::create) - .lang("UXV Conveyor Module") - .onRegister(attach(new CoverPlaceBehavior(GTCovers.CONVEYORS[11]))) - .onRegister(attach(new TooltipBehavior(lines -> { - lines.add(Component.translatable("item.gtceu.conveyor.module.tooltip")); - lines.add(Component.translatable("gtceu.universal.tooltip.item_transfer_rate_stacks", 16)); - }))) - .onRegister(compassNodeExist(GTCompassSections.COVERS, "conveyor", GTCompassNodes.COVER)) - .register() : null; - public static ItemEntry CONVEYOR_MODULE_OpV = GTCEuAPI.isHighTier() ? REGISTRATE.item("opv_conveyor_module", ComponentItem::create) - .lang("OpV Conveyor Module") - .onRegister(attach(new CoverPlaceBehavior(GTCovers.CONVEYORS[12]))) - .onRegister(attach(new TooltipBehavior(lines -> { - lines.add(Component.translatable("item.gtceu.conveyor.module.tooltip")); - lines.add(Component.translatable("gtceu.universal.tooltip.item_transfer_rate_stacks", 16)); - }))) - .onRegister(compassNodeExist(GTCompassSections.COVERS, "conveyor", GTCompassNodes.COVER)) - .register() : null; - - public static ItemEntry ELECTRIC_PISTON_LV = REGISTRATE.item("lv_electric_piston", Item::new).lang("LV Electric Piston").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "piston")).register(); - public static ItemEntry ELECTRIC_PISTON_MV = REGISTRATE.item("mv_electric_piston", Item::new).lang("MV Electric Piston").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "piston")).register(); - public static ItemEntry ELECTRIC_PISTON_HV = REGISTRATE.item("hv_electric_piston", Item::new).lang("HV Electric Piston").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "piston")).register(); - public static ItemEntry ELECTRIC_PISTON_EV = REGISTRATE.item("ev_electric_piston", Item::new).lang("EV Electric Piston").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "piston")).register(); - public static ItemEntry ELECTRIC_PISTON_IV = REGISTRATE.item("iv_electric_piston", Item::new).lang("IV Electric Piston").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "piston")).register(); - public static ItemEntry ELECTRIC_PISTON_LUV = REGISTRATE.item("luv_electric_piston", Item::new).lang("LuV Electric Piston").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "piston")).register(); - public static ItemEntry ELECTRIC_PISTON_ZPM = REGISTRATE.item("zpm_electric_piston", Item::new).lang("ZPM Electric Piston").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "piston")).register(); - public static ItemEntry ELECTRIC_PISTON_UV = REGISTRATE.item("uv_electric_piston", Item::new).lang("UV Electric Piston").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "piston")).register(); - public static ItemEntry ELECTRIC_PISTON_UHV = GTCEuAPI.isHighTier() ? REGISTRATE.item("uhv_electric_piston", Item::new).lang("UHV Electric Piston").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "piston")).register() : null; - public static ItemEntry ELECTRIC_PISTON_UEV = GTCEuAPI.isHighTier() ? REGISTRATE.item("uev_electric_piston", Item::new).lang("UEV Electric Piston").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "piston")).register() : null; - public static ItemEntry ELECTRIC_PISTON_UIV = GTCEuAPI.isHighTier() ? REGISTRATE.item("uiv_electric_piston", Item::new).lang("UIV Electric Piston").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "piston")).register() : null; - public static ItemEntry ELECTRIC_PISTON_UXV = GTCEuAPI.isHighTier() ? REGISTRATE.item("uxv_electric_piston", Item::new).lang("UXV Electric Piston").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "piston")).register() : null; - public static ItemEntry ELECTRIC_PISTON_OpV = GTCEuAPI.isHighTier() ? REGISTRATE.item("opv_electric_piston", Item::new).lang("OpV Electric Piston").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "piston")).register() : null; + public static ItemEntry CONVEYOR_MODULE_UHV = GTCEuAPI.isHighTier() ? + REGISTRATE.item("uhv_conveyor_module", ComponentItem::create) + .lang("UHV Conveyor Module") + .onRegister(attach(new CoverPlaceBehavior(GTCovers.CONVEYORS[8]))) + .onRegister(attach(new TooltipBehavior(lines -> { + lines.add(Component.translatable("item.gtceu.conveyor.module.tooltip")); + lines.add(Component.translatable("gtceu.universal.tooltip.item_transfer_rate_stacks", 16)); + }))) + .onRegister(compassNodeExist(GTCompassSections.COVERS, "conveyor", GTCompassNodes.COVER)) + .register() : + null; + public static ItemEntry CONVEYOR_MODULE_UEV = GTCEuAPI.isHighTier() ? + REGISTRATE.item("uev_conveyor_module", ComponentItem::create) + .lang("UEV Conveyor Module") + .onRegister(attach(new CoverPlaceBehavior(GTCovers.CONVEYORS[9]))) + .onRegister(attach(new TooltipBehavior(lines -> { + lines.add(Component.translatable("item.gtceu.conveyor.module.tooltip")); + lines.add(Component.translatable("gtceu.universal.tooltip.item_transfer_rate_stacks", 16)); + }))) + .onRegister(compassNodeExist(GTCompassSections.COVERS, "conveyor", GTCompassNodes.COVER)) + .register() : + null; + public static ItemEntry CONVEYOR_MODULE_UIV = GTCEuAPI.isHighTier() ? + REGISTRATE.item("uiv_conveyor_module", ComponentItem::create) + .lang("UIV Conveyor Module") + .onRegister(attach(new CoverPlaceBehavior(GTCovers.CONVEYORS[10]))) + .onRegister(attach(new TooltipBehavior(lines -> { + lines.add(Component.translatable("item.gtceu.conveyor.module.tooltip")); + lines.add(Component.translatable("gtceu.universal.tooltip.item_transfer_rate_stacks", 16)); + }))) + .onRegister(compassNodeExist(GTCompassSections.COVERS, "conveyor", GTCompassNodes.COVER)) + .register() : + null; + public static ItemEntry CONVEYOR_MODULE_UXV = GTCEuAPI.isHighTier() ? + REGISTRATE.item("uxv_conveyor_module", ComponentItem::create) + .lang("UXV Conveyor Module") + .onRegister(attach(new CoverPlaceBehavior(GTCovers.CONVEYORS[11]))) + .onRegister(attach(new TooltipBehavior(lines -> { + lines.add(Component.translatable("item.gtceu.conveyor.module.tooltip")); + lines.add(Component.translatable("gtceu.universal.tooltip.item_transfer_rate_stacks", 16)); + }))) + .onRegister(compassNodeExist(GTCompassSections.COVERS, "conveyor", GTCompassNodes.COVER)) + .register() : + null; + public static ItemEntry CONVEYOR_MODULE_OpV = GTCEuAPI.isHighTier() ? + REGISTRATE.item("opv_conveyor_module", ComponentItem::create) + .lang("OpV Conveyor Module") + .onRegister(attach(new CoverPlaceBehavior(GTCovers.CONVEYORS[12]))) + .onRegister(attach(new TooltipBehavior(lines -> { + lines.add(Component.translatable("item.gtceu.conveyor.module.tooltip")); + lines.add(Component.translatable("gtceu.universal.tooltip.item_transfer_rate_stacks", 16)); + }))) + .onRegister(compassNodeExist(GTCompassSections.COVERS, "conveyor", GTCompassNodes.COVER)) + .register() : + null; + + public static ItemEntry ELECTRIC_PISTON_LV = REGISTRATE.item("lv_electric_piston", Item::new) + .lang("LV Electric Piston").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "piston")).register(); + public static ItemEntry ELECTRIC_PISTON_MV = REGISTRATE.item("mv_electric_piston", Item::new) + .lang("MV Electric Piston").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "piston")).register(); + public static ItemEntry ELECTRIC_PISTON_HV = REGISTRATE.item("hv_electric_piston", Item::new) + .lang("HV Electric Piston").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "piston")).register(); + public static ItemEntry ELECTRIC_PISTON_EV = REGISTRATE.item("ev_electric_piston", Item::new) + .lang("EV Electric Piston").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "piston")).register(); + public static ItemEntry ELECTRIC_PISTON_IV = REGISTRATE.item("iv_electric_piston", Item::new) + .lang("IV Electric Piston").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "piston")).register(); + public static ItemEntry ELECTRIC_PISTON_LUV = REGISTRATE.item("luv_electric_piston", Item::new) + .lang("LuV Electric Piston").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "piston")) + .register(); + public static ItemEntry ELECTRIC_PISTON_ZPM = REGISTRATE.item("zpm_electric_piston", Item::new) + .lang("ZPM Electric Piston").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "piston")) + .register(); + public static ItemEntry ELECTRIC_PISTON_UV = REGISTRATE.item("uv_electric_piston", Item::new) + .lang("UV Electric Piston").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "piston")).register(); + public static ItemEntry ELECTRIC_PISTON_UHV = GTCEuAPI.isHighTier() ? + REGISTRATE.item("uhv_electric_piston", Item::new).lang("UHV Electric Piston") + .onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "piston")).register() : + null; + public static ItemEntry ELECTRIC_PISTON_UEV = GTCEuAPI.isHighTier() ? + REGISTRATE.item("uev_electric_piston", Item::new).lang("UEV Electric Piston") + .onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "piston")).register() : + null; + public static ItemEntry ELECTRIC_PISTON_UIV = GTCEuAPI.isHighTier() ? + REGISTRATE.item("uiv_electric_piston", Item::new).lang("UIV Electric Piston") + .onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "piston")).register() : + null; + public static ItemEntry ELECTRIC_PISTON_UXV = GTCEuAPI.isHighTier() ? + REGISTRATE.item("uxv_electric_piston", Item::new).lang("UXV Electric Piston") + .onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "piston")).register() : + null; + public static ItemEntry ELECTRIC_PISTON_OpV = GTCEuAPI.isHighTier() ? + REGISTRATE.item("opv_electric_piston", Item::new).lang("OpV Electric Piston") + .onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "piston")).register() : + null; public static ItemEntry ROBOT_ARM_LV = REGISTRATE.item("lv_robot_arm", ComponentItem::create) .lang("LV Robot Arm") - .onRegister(attach(new CoverPlaceBehavior(GTCovers.ROBOT_ARMS[0]))).onRegister(attach(new TooltipBehavior(lines -> { + .onRegister(attach(new CoverPlaceBehavior(GTCovers.ROBOT_ARMS[0]))) + .onRegister(attach(new TooltipBehavior(lines -> { lines.add(Component.translatable("item.gtceu.robot.arm.tooltip")); lines.add(Component.translatable("gtceu.universal.tooltip.item_transfer_rate", 8)); }))) @@ -1037,7 +1371,8 @@ public Component getItemName(ItemStack stack) { .register(); public static ItemEntry ROBOT_ARM_MV = REGISTRATE.item("mv_robot_arm", ComponentItem::create) .lang("MV Robot Arm") - .onRegister(attach(new CoverPlaceBehavior(GTCovers.ROBOT_ARMS[1]))).onRegister(attach(new TooltipBehavior(lines -> { + .onRegister(attach(new CoverPlaceBehavior(GTCovers.ROBOT_ARMS[1]))) + .onRegister(attach(new TooltipBehavior(lines -> { lines.add(Component.translatable("item.gtceu.robot.arm.tooltip")); lines.add(Component.translatable("gtceu.universal.tooltip.item_transfer_rate", 32)); }))) @@ -1045,7 +1380,8 @@ public Component getItemName(ItemStack stack) { .register(); public static ItemEntry ROBOT_ARM_HV = REGISTRATE.item("hv_robot_arm", ComponentItem::create) .lang("HV Robot Arm") - .onRegister(attach(new CoverPlaceBehavior(GTCovers.ROBOT_ARMS[2]))).onRegister(attach(new TooltipBehavior(lines -> { + .onRegister(attach(new CoverPlaceBehavior(GTCovers.ROBOT_ARMS[2]))) + .onRegister(attach(new TooltipBehavior(lines -> { lines.add(Component.translatable("item.gtceu.robot.arm.tooltip")); lines.add(Component.translatable("gtceu.universal.tooltip.item_transfer_rate", 64)); }))) @@ -1053,7 +1389,8 @@ public Component getItemName(ItemStack stack) { .register(); public static ItemEntry ROBOT_ARM_EV = REGISTRATE.item("ev_robot_arm", ComponentItem::create) .lang("EV Robot Arm") - .onRegister(attach(new CoverPlaceBehavior(GTCovers.ROBOT_ARMS[3]))).onRegister(attach(new TooltipBehavior(lines -> { + .onRegister(attach(new CoverPlaceBehavior(GTCovers.ROBOT_ARMS[3]))) + .onRegister(attach(new TooltipBehavior(lines -> { lines.add(Component.translatable("item.gtceu.robot.arm.tooltip")); lines.add(Component.translatable("gtceu.universal.tooltip.item_transfer_rate_stacks", 3)); }))) @@ -1061,7 +1398,8 @@ public Component getItemName(ItemStack stack) { .register(); public static ItemEntry ROBOT_ARM_IV = REGISTRATE.item("iv_robot_arm", ComponentItem::create) .lang("IV Robot Arm") - .onRegister(attach(new CoverPlaceBehavior(GTCovers.ROBOT_ARMS[4]))).onRegister(attach(new TooltipBehavior(lines -> { + .onRegister(attach(new CoverPlaceBehavior(GTCovers.ROBOT_ARMS[4]))) + .onRegister(attach(new TooltipBehavior(lines -> { lines.add(Component.translatable("item.gtceu.robot.arm.tooltip")); lines.add(Component.translatable("gtceu.universal.tooltip.item_transfer_rate_stacks", 8)); }))) @@ -1069,7 +1407,8 @@ public Component getItemName(ItemStack stack) { .register(); public static ItemEntry ROBOT_ARM_LuV = REGISTRATE.item("luv_robot_arm", ComponentItem::create) .lang("LuV Robot Arm") - .onRegister(attach(new CoverPlaceBehavior(GTCovers.ROBOT_ARMS[5]))).onRegister(attach(new TooltipBehavior(lines -> { + .onRegister(attach(new CoverPlaceBehavior(GTCovers.ROBOT_ARMS[5]))) + .onRegister(attach(new TooltipBehavior(lines -> { lines.add(Component.translatable("item.gtceu.robot.arm.tooltip")); lines.add(Component.translatable("gtceu.universal.tooltip.item_transfer_rate_stacks", 16)); }))) @@ -1077,7 +1416,8 @@ public Component getItemName(ItemStack stack) { .register(); public static ItemEntry ROBOT_ARM_ZPM = REGISTRATE.item("zpm_robot_arm", ComponentItem::create) .lang("ZPM Robot Arm") - .onRegister(attach(new CoverPlaceBehavior(GTCovers.ROBOT_ARMS[6]))).onRegister(attach(new TooltipBehavior(lines -> { + .onRegister(attach(new CoverPlaceBehavior(GTCovers.ROBOT_ARMS[6]))) + .onRegister(attach(new TooltipBehavior(lines -> { lines.add(Component.translatable("item.gtceu.robot.arm.tooltip")); lines.add(Component.translatable("gtceu.universal.tooltip.item_transfer_rate_stacks", 16)); }))) @@ -1085,99 +1425,182 @@ public Component getItemName(ItemStack stack) { .register(); public static ItemEntry ROBOT_ARM_UV = REGISTRATE.item("uv_robot_arm", ComponentItem::create) .lang("UV Robot Arm") - .onRegister(attach(new CoverPlaceBehavior(GTCovers.ROBOT_ARMS[7]))).onRegister(attach(new TooltipBehavior(lines -> { + .onRegister(attach(new CoverPlaceBehavior(GTCovers.ROBOT_ARMS[7]))) + .onRegister(attach(new TooltipBehavior(lines -> { lines.add(Component.translatable("item.gtceu.robot.arm.tooltip")); lines.add(Component.translatable("gtceu.universal.tooltip.item_transfer_rate_stacks", 16)); }))) .onRegister(compassNodeExist(GTCompassSections.COVERS, "robot_arm", GTCompassNodes.COVER)) .register(); - public static ItemEntry ROBOT_ARM_UHV = GTCEuAPI.isHighTier() ? REGISTRATE.item("uhv_robot_arm", ComponentItem::create) - .lang("UHV Robot Arm") - .onRegister(attach(new CoverPlaceBehavior(GTCovers.ROBOT_ARMS[8]))).onRegister(attach(new TooltipBehavior(lines -> { - lines.add(Component.translatable("item.gtceu.robot.arm.tooltip")); - lines.add(Component.translatable("gtceu.universal.tooltip.item_transfer_rate_stacks", 16)); - }))) - .onRegister(compassNodeExist(GTCompassSections.COVERS, "robot_arm", GTCompassNodes.COVER)) - .register() : null; - public static ItemEntry ROBOT_ARM_UEV = GTCEuAPI.isHighTier() ? REGISTRATE.item("uev_robot_arm", ComponentItem::create) - .lang("UEV Robot Arm") - .onRegister(attach(new CoverPlaceBehavior(GTCovers.ROBOT_ARMS[9]))).onRegister(attach(new TooltipBehavior(lines -> { - lines.add(Component.translatable("item.gtceu.robot.arm.tooltip")); - lines.add(Component.translatable("gtceu.universal.tooltip.item_transfer_rate_stacks", 16)); - }))) - .onRegister(compassNodeExist(GTCompassSections.COVERS, "robot_arm", GTCompassNodes.COVER)) - .register() : null; - public static ItemEntry ROBOT_ARM_UIV = GTCEuAPI.isHighTier() ? REGISTRATE.item("uiv_robot_arm", ComponentItem::create) - .lang("UIV Robot Arm") - .onRegister(attach(new CoverPlaceBehavior(GTCovers.ROBOT_ARMS[10]))).onRegister(attach(new TooltipBehavior(lines -> { - lines.add(Component.translatable("item.gtceu.robot.arm.tooltip")); - lines.add(Component.translatable("gtceu.universal.tooltip.item_transfer_rate_stacks", 16)); - }))) - .onRegister(compassNodeExist(GTCompassSections.COVERS, "robot_arm", GTCompassNodes.COVER)) - .register() : null; - public static ItemEntry ROBOT_ARM_UXV = GTCEuAPI.isHighTier() ? REGISTRATE.item("uxv_robot_arm", ComponentItem::create) - .lang("UXV Robot Arm") - .onRegister(attach(new CoverPlaceBehavior(GTCovers.ROBOT_ARMS[11]))).onRegister(attach(new TooltipBehavior(lines -> { - lines.add(Component.translatable("item.gtceu.robot.arm.tooltip")); - lines.add(Component.translatable("gtceu.universal.tooltip.item_transfer_rate_stacks", 16)); - }))) - .onRegister(compassNodeExist(GTCompassSections.COVERS, "robot_arm", GTCompassNodes.COVER)) - .register() : null; - public static ItemEntry ROBOT_ARM_OpV = GTCEuAPI.isHighTier() ? REGISTRATE.item("opv_robot_arm", ComponentItem::create) - .lang("OpV Robot Arm") - .onRegister(attach(new CoverPlaceBehavior(GTCovers.ROBOT_ARMS[12]))).onRegister(attach(new TooltipBehavior(lines -> { - lines.add(Component.translatable("item.gtceu.robot.arm.tooltip")); - lines.add(Component.translatable("gtceu.universal.tooltip.item_transfer_rate_stacks", 16)); - }))) - .onRegister(compassNodeExist(GTCompassSections.COVERS, "robot_arm", GTCompassNodes.COVER)) - .register() : null; - - public static ItemEntry FIELD_GENERATOR_LV = REGISTRATE.item("lv_field_generator", Item::new).lang("LV Field Generator").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "field_generator")).register(); - public static ItemEntry FIELD_GENERATOR_MV = REGISTRATE.item("mv_field_generator", Item::new).lang("MV Field Generator").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "field_generator")).register(); - public static ItemEntry FIELD_GENERATOR_HV = REGISTRATE.item("hv_field_generator", Item::new).lang("HV Field Generator").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "field_generator")).register(); - public static ItemEntry FIELD_GENERATOR_EV = REGISTRATE.item("ev_field_generator", Item::new).lang("EV Field Generator").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "field_generator")).register(); - public static ItemEntry FIELD_GENERATOR_IV = REGISTRATE.item("iv_field_generator", Item::new).lang("IV Field Generator").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "field_generator")).register(); - public static ItemEntry FIELD_GENERATOR_LuV = REGISTRATE.item("luv_field_generator", Item::new).lang("LuV Field Generator").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "field_generator")).register(); - public static ItemEntry FIELD_GENERATOR_ZPM = REGISTRATE.item("zpm_field_generator", Item::new).lang("ZPM Field Generator").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "field_generator")).register(); - public static ItemEntry FIELD_GENERATOR_UV = REGISTRATE.item("uv_field_generator", Item::new).lang("UV Field Generator").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "field_generator")).register(); - public static ItemEntry FIELD_GENERATOR_UHV = GTCEuAPI.isHighTier() ? REGISTRATE.item("uhv_field_generator", Item::new).lang("UHV Field Generator").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "field_generator")).register() : null; - public static ItemEntry FIELD_GENERATOR_UEV = GTCEuAPI.isHighTier() ? REGISTRATE.item("uev_field_generator", Item::new).lang("UEV Field Generator").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "field_generator")).register() : null; - public static ItemEntry FIELD_GENERATOR_UIV = GTCEuAPI.isHighTier() ? REGISTRATE.item("uiv_field_generator", Item::new).lang("UIV Field Generator").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "field_generator")).register() : null; - public static ItemEntry FIELD_GENERATOR_UXV = GTCEuAPI.isHighTier() ? REGISTRATE.item("uxv_field_generator", Item::new).lang("UXV Field Generator").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "field_generator")).register() : null; - public static ItemEntry FIELD_GENERATOR_OpV = GTCEuAPI.isHighTier() ? REGISTRATE.item("opv_field_generator", Item::new).lang("OpV Field Generator").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "field_generator")).register() : null; - - public static ItemEntry EMITTER_LV = REGISTRATE.item("lv_emitter", Item::new).lang("LV Emitter").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "emitter")).register(); - public static ItemEntry EMITTER_MV = REGISTRATE.item("mv_emitter", Item::new).lang("MV Emitter").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "emitter")).register(); - public static ItemEntry EMITTER_HV = REGISTRATE.item("hv_emitter", Item::new).lang("HV Emitter").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "emitter")).register(); - public static ItemEntry EMITTER_EV = REGISTRATE.item("ev_emitter", Item::new).lang("EV Emitter").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "emitter")).register(); - public static ItemEntry EMITTER_IV = REGISTRATE.item("iv_emitter", Item::new).lang("IV Emitter").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "emitter")).register(); - public static ItemEntry EMITTER_LuV = REGISTRATE.item("luv_emitter", Item::new).lang("LuV Emitter").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "emitter")).register(); - public static ItemEntry EMITTER_ZPM = REGISTRATE.item("zpm_emitter", Item::new).lang("ZPM Emitter").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "emitter")).register(); - public static ItemEntry EMITTER_UV = REGISTRATE.item("uv_emitter", Item::new).lang("UV Emitter").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "emitter")).register(); - public static ItemEntry EMITTER_UHV = GTCEuAPI.isHighTier() ? REGISTRATE.item("uhv_emitter", Item::new).lang("UHV Emitter").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "emitter")).register() : null; - public static ItemEntry EMITTER_UEV = GTCEuAPI.isHighTier() ? REGISTRATE.item("uev_emitter", Item::new).lang("UEV Emitter").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "emitter")).register() : null; - public static ItemEntry EMITTER_UIV = GTCEuAPI.isHighTier() ? REGISTRATE.item("uiv_emitter", Item::new).lang("UIV Emitter").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "emitter")).register() : null; - public static ItemEntry EMITTER_UXV = GTCEuAPI.isHighTier() ? REGISTRATE.item("uxv_emitter", Item::new).lang("UXV Emitter").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "emitter")).register() : null; - public static ItemEntry EMITTER_OpV = GTCEuAPI.isHighTier() ? REGISTRATE.item("opv_emitter", Item::new).lang("OpV Emitter").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "emitter")).register() : null; - - public static ItemEntry SENSOR_LV = REGISTRATE.item("lv_sensor", Item::new).lang("LV Sensor").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "sensor")).register(); - public static ItemEntry SENSOR_MV = REGISTRATE.item("mv_sensor", Item::new).lang("MV Sensor").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "sensor")).register(); - public static ItemEntry SENSOR_HV = REGISTRATE.item("hv_sensor", Item::new).lang("HV Sensor").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "sensor")).register(); - public static ItemEntry SENSOR_EV = REGISTRATE.item("ev_sensor", Item::new).lang("EV Sensor").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "sensor")).register(); - public static ItemEntry SENSOR_IV = REGISTRATE.item("iv_sensor", Item::new).lang("IV Sensor").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "sensor")).register(); - public static ItemEntry SENSOR_LuV = REGISTRATE.item("luv_sensor", Item::new).lang("LuV Sensor").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "sensor")).register(); - public static ItemEntry SENSOR_ZPM = REGISTRATE.item("zpm_sensor", Item::new).lang("ZPM Sensor").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "sensor")).register(); - public static ItemEntry SENSOR_UV = REGISTRATE.item("uv_sensor", Item::new).lang("UV Sensor").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "sensor")).register(); - public static ItemEntry SENSOR_UHV = GTCEuAPI.isHighTier() ? REGISTRATE.item("uhv_sensor", Item::new).lang("UHV Sensor").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "sensor")).register() : null; - public static ItemEntry SENSOR_UEV = GTCEuAPI.isHighTier() ? REGISTRATE.item("uev_sensor", Item::new).lang("UEV Sensor").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "sensor")).register() : null; - public static ItemEntry SENSOR_UIV = GTCEuAPI.isHighTier() ? REGISTRATE.item("uiv_sensor", Item::new).lang("UIV Sensor").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "sensor")).register() : null; - public static ItemEntry SENSOR_UXV = GTCEuAPI.isHighTier() ? REGISTRATE.item("uxv_sensor", Item::new).lang("UXV Sensor").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "sensor")).register() : null; - public static ItemEntry SENSOR_OpV = GTCEuAPI.isHighTier() ? REGISTRATE.item("opv_sensor", Item::new).lang("OpV Sensor").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "sensor")).register() : null; - - - public static ItemEntry TOOL_DATA_STICK = REGISTRATE.item("data_stick", ComponentItem::create).lang("Data Stick").onRegister(attach(new DataItemBehavior())).onRegister(compassNode(GTCompassSections.COMPONENTS)).register(); - public static ItemEntry TOOL_DATA_ORB = REGISTRATE.item("data_orb", ComponentItem::create).lang("Data Orb").onRegister(attach(new DataItemBehavior())).onRegister(compassNode(GTCompassSections.COMPONENTS)).register(); - public static ItemEntry TOOL_DATA_MODULE = REGISTRATE.item("data_module", ComponentItem::create).lang("Data Module").onRegister(attach(new DataItemBehavior(true))).onRegister(compassNode(GTCompassSections.COMPONENTS)).register(); + public static ItemEntry ROBOT_ARM_UHV = GTCEuAPI.isHighTier() ? + REGISTRATE.item("uhv_robot_arm", ComponentItem::create) + .lang("UHV Robot Arm") + .onRegister(attach(new CoverPlaceBehavior(GTCovers.ROBOT_ARMS[8]))) + .onRegister(attach(new TooltipBehavior(lines -> { + lines.add(Component.translatable("item.gtceu.robot.arm.tooltip")); + lines.add(Component.translatable("gtceu.universal.tooltip.item_transfer_rate_stacks", 16)); + }))) + .onRegister(compassNodeExist(GTCompassSections.COVERS, "robot_arm", GTCompassNodes.COVER)) + .register() : + null; + public static ItemEntry ROBOT_ARM_UEV = GTCEuAPI.isHighTier() ? + REGISTRATE.item("uev_robot_arm", ComponentItem::create) + .lang("UEV Robot Arm") + .onRegister(attach(new CoverPlaceBehavior(GTCovers.ROBOT_ARMS[9]))) + .onRegister(attach(new TooltipBehavior(lines -> { + lines.add(Component.translatable("item.gtceu.robot.arm.tooltip")); + lines.add(Component.translatable("gtceu.universal.tooltip.item_transfer_rate_stacks", 16)); + }))) + .onRegister(compassNodeExist(GTCompassSections.COVERS, "robot_arm", GTCompassNodes.COVER)) + .register() : + null; + public static ItemEntry ROBOT_ARM_UIV = GTCEuAPI.isHighTier() ? + REGISTRATE.item("uiv_robot_arm", ComponentItem::create) + .lang("UIV Robot Arm") + .onRegister(attach(new CoverPlaceBehavior(GTCovers.ROBOT_ARMS[10]))) + .onRegister(attach(new TooltipBehavior(lines -> { + lines.add(Component.translatable("item.gtceu.robot.arm.tooltip")); + lines.add(Component.translatable("gtceu.universal.tooltip.item_transfer_rate_stacks", 16)); + }))) + .onRegister(compassNodeExist(GTCompassSections.COVERS, "robot_arm", GTCompassNodes.COVER)) + .register() : + null; + public static ItemEntry ROBOT_ARM_UXV = GTCEuAPI.isHighTier() ? + REGISTRATE.item("uxv_robot_arm", ComponentItem::create) + .lang("UXV Robot Arm") + .onRegister(attach(new CoverPlaceBehavior(GTCovers.ROBOT_ARMS[11]))) + .onRegister(attach(new TooltipBehavior(lines -> { + lines.add(Component.translatable("item.gtceu.robot.arm.tooltip")); + lines.add(Component.translatable("gtceu.universal.tooltip.item_transfer_rate_stacks", 16)); + }))) + .onRegister(compassNodeExist(GTCompassSections.COVERS, "robot_arm", GTCompassNodes.COVER)) + .register() : + null; + public static ItemEntry ROBOT_ARM_OpV = GTCEuAPI.isHighTier() ? + REGISTRATE.item("opv_robot_arm", ComponentItem::create) + .lang("OpV Robot Arm") + .onRegister(attach(new CoverPlaceBehavior(GTCovers.ROBOT_ARMS[12]))) + .onRegister(attach(new TooltipBehavior(lines -> { + lines.add(Component.translatable("item.gtceu.robot.arm.tooltip")); + lines.add(Component.translatable("gtceu.universal.tooltip.item_transfer_rate_stacks", 16)); + }))) + .onRegister(compassNodeExist(GTCompassSections.COVERS, "robot_arm", GTCompassNodes.COVER)) + .register() : + null; + + public static ItemEntry FIELD_GENERATOR_LV = REGISTRATE.item("lv_field_generator", Item::new) + .lang("LV Field Generator").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "field_generator")) + .register(); + public static ItemEntry FIELD_GENERATOR_MV = REGISTRATE.item("mv_field_generator", Item::new) + .lang("MV Field Generator").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "field_generator")) + .register(); + public static ItemEntry FIELD_GENERATOR_HV = REGISTRATE.item("hv_field_generator", Item::new) + .lang("HV Field Generator").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "field_generator")) + .register(); + public static ItemEntry FIELD_GENERATOR_EV = REGISTRATE.item("ev_field_generator", Item::new) + .lang("EV Field Generator").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "field_generator")) + .register(); + public static ItemEntry FIELD_GENERATOR_IV = REGISTRATE.item("iv_field_generator", Item::new) + .lang("IV Field Generator").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "field_generator")) + .register(); + public static ItemEntry FIELD_GENERATOR_LuV = REGISTRATE.item("luv_field_generator", Item::new) + .lang("LuV Field Generator").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "field_generator")) + .register(); + public static ItemEntry FIELD_GENERATOR_ZPM = REGISTRATE.item("zpm_field_generator", Item::new) + .lang("ZPM Field Generator").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "field_generator")) + .register(); + public static ItemEntry FIELD_GENERATOR_UV = REGISTRATE.item("uv_field_generator", Item::new) + .lang("UV Field Generator").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "field_generator")) + .register(); + public static ItemEntry FIELD_GENERATOR_UHV = GTCEuAPI.isHighTier() ? + REGISTRATE.item("uhv_field_generator", Item::new).lang("UHV Field Generator") + .onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "field_generator")).register() : + null; + public static ItemEntry FIELD_GENERATOR_UEV = GTCEuAPI.isHighTier() ? + REGISTRATE.item("uev_field_generator", Item::new).lang("UEV Field Generator") + .onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "field_generator")).register() : + null; + public static ItemEntry FIELD_GENERATOR_UIV = GTCEuAPI.isHighTier() ? + REGISTRATE.item("uiv_field_generator", Item::new).lang("UIV Field Generator") + .onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "field_generator")).register() : + null; + public static ItemEntry FIELD_GENERATOR_UXV = GTCEuAPI.isHighTier() ? + REGISTRATE.item("uxv_field_generator", Item::new).lang("UXV Field Generator") + .onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "field_generator")).register() : + null; + public static ItemEntry FIELD_GENERATOR_OpV = GTCEuAPI.isHighTier() ? + REGISTRATE.item("opv_field_generator", Item::new).lang("OpV Field Generator") + .onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "field_generator")).register() : + null; + + public static ItemEntry EMITTER_LV = REGISTRATE.item("lv_emitter", Item::new).lang("LV Emitter") + .onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "emitter")).register(); + public static ItemEntry EMITTER_MV = REGISTRATE.item("mv_emitter", Item::new).lang("MV Emitter") + .onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "emitter")).register(); + public static ItemEntry EMITTER_HV = REGISTRATE.item("hv_emitter", Item::new).lang("HV Emitter") + .onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "emitter")).register(); + public static ItemEntry EMITTER_EV = REGISTRATE.item("ev_emitter", Item::new).lang("EV Emitter") + .onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "emitter")).register(); + public static ItemEntry EMITTER_IV = REGISTRATE.item("iv_emitter", Item::new).lang("IV Emitter") + .onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "emitter")).register(); + public static ItemEntry EMITTER_LuV = REGISTRATE.item("luv_emitter", Item::new).lang("LuV Emitter") + .onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "emitter")).register(); + public static ItemEntry EMITTER_ZPM = REGISTRATE.item("zpm_emitter", Item::new).lang("ZPM Emitter") + .onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "emitter")).register(); + public static ItemEntry EMITTER_UV = REGISTRATE.item("uv_emitter", Item::new).lang("UV Emitter") + .onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "emitter")).register(); + public static ItemEntry EMITTER_UHV = GTCEuAPI.isHighTier() ? REGISTRATE.item("uhv_emitter", Item::new) + .lang("UHV Emitter").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "emitter")).register() : + null; + public static ItemEntry EMITTER_UEV = GTCEuAPI.isHighTier() ? REGISTRATE.item("uev_emitter", Item::new) + .lang("UEV Emitter").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "emitter")).register() : + null; + public static ItemEntry EMITTER_UIV = GTCEuAPI.isHighTier() ? REGISTRATE.item("uiv_emitter", Item::new) + .lang("UIV Emitter").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "emitter")).register() : + null; + public static ItemEntry EMITTER_UXV = GTCEuAPI.isHighTier() ? REGISTRATE.item("uxv_emitter", Item::new) + .lang("UXV Emitter").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "emitter")).register() : + null; + public static ItemEntry EMITTER_OpV = GTCEuAPI.isHighTier() ? REGISTRATE.item("opv_emitter", Item::new) + .lang("OpV Emitter").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "emitter")).register() : + null; + + public static ItemEntry SENSOR_LV = REGISTRATE.item("lv_sensor", Item::new).lang("LV Sensor") + .onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "sensor")).register(); + public static ItemEntry SENSOR_MV = REGISTRATE.item("mv_sensor", Item::new).lang("MV Sensor") + .onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "sensor")).register(); + public static ItemEntry SENSOR_HV = REGISTRATE.item("hv_sensor", Item::new).lang("HV Sensor") + .onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "sensor")).register(); + public static ItemEntry SENSOR_EV = REGISTRATE.item("ev_sensor", Item::new).lang("EV Sensor") + .onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "sensor")).register(); + public static ItemEntry SENSOR_IV = REGISTRATE.item("iv_sensor", Item::new).lang("IV Sensor") + .onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "sensor")).register(); + public static ItemEntry SENSOR_LuV = REGISTRATE.item("luv_sensor", Item::new).lang("LuV Sensor") + .onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "sensor")).register(); + public static ItemEntry SENSOR_ZPM = REGISTRATE.item("zpm_sensor", Item::new).lang("ZPM Sensor") + .onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "sensor")).register(); + public static ItemEntry SENSOR_UV = REGISTRATE.item("uv_sensor", Item::new).lang("UV Sensor") + .onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "sensor")).register(); + public static ItemEntry SENSOR_UHV = GTCEuAPI.isHighTier() ? REGISTRATE.item("uhv_sensor", Item::new) + .lang("UHV Sensor").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "sensor")).register() : null; + public static ItemEntry SENSOR_UEV = GTCEuAPI.isHighTier() ? REGISTRATE.item("uev_sensor", Item::new) + .lang("UEV Sensor").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "sensor")).register() : null; + public static ItemEntry SENSOR_UIV = GTCEuAPI.isHighTier() ? REGISTRATE.item("uiv_sensor", Item::new) + .lang("UIV Sensor").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "sensor")).register() : null; + public static ItemEntry SENSOR_UXV = GTCEuAPI.isHighTier() ? REGISTRATE.item("uxv_sensor", Item::new) + .lang("UXV Sensor").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "sensor")).register() : null; + public static ItemEntry SENSOR_OpV = GTCEuAPI.isHighTier() ? REGISTRATE.item("opv_sensor", Item::new) + .lang("OpV Sensor").onRegister(compassNodeExist(GTCompassSections.COMPONENTS, "sensor")).register() : null; + + public static ItemEntry TOOL_DATA_STICK = REGISTRATE.item("data_stick", ComponentItem::create) + .lang("Data Stick").onRegister(attach(new DataItemBehavior())) + .onRegister(compassNode(GTCompassSections.COMPONENTS)).register(); + public static ItemEntry TOOL_DATA_ORB = REGISTRATE.item("data_orb", ComponentItem::create) + .lang("Data Orb").onRegister(attach(new DataItemBehavior())) + .onRegister(compassNode(GTCompassSections.COMPONENTS)).register(); + public static ItemEntry TOOL_DATA_MODULE = REGISTRATE.item("data_module", ComponentItem::create) + .lang("Data Module").onRegister(attach(new DataItemBehavior(true))) + .onRegister(compassNode(GTCompassSections.COMPONENTS)).register(); public static final Map> GLASS_LENSES = new HashMap<>(); @@ -1194,277 +1617,466 @@ public Component getItemName(ItemStack stack) { } } - public static ItemEntry SILICON_BOULE = REGISTRATE.item("silicon_boule", Item::new).lang("Monocrystalline Silicon Boule").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "silicon_boule")).register(); - public static ItemEntry PHOSPHORUS_BOULE = REGISTRATE.item("phosphorus_boule", Item::new).lang("Phosphorus-doped Monocrystalline Silicon Boule").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "silicon_boule")).register(); - public static ItemEntry NAQUADAH_BOULE = REGISTRATE.item("naquadah_boule", Item::new).lang("Naquadah-doped Monocrystalline Silicon Boule").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "silicon_boule")).register(); - public static ItemEntry NEUTRONIUM_BOULE = REGISTRATE.item("neutronium_boule", Item::new).lang("Neutronium-doped Monocrystalline Silicon Boule").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "silicon_boule")).register(); - public static ItemEntry SILICON_WAFER = REGISTRATE.item("silicon_wafer", Item::new).lang("Silicon Wafer").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "wafer")).register(); - public static ItemEntry PHOSPHORUS_WAFER = REGISTRATE.item("phosphorus_wafer", Item::new).lang("Phosphorus-doped Wafer").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "wafer")).register(); - public static ItemEntry NAQUADAH_WAFER = REGISTRATE.item("naquadah_wafer", Item::new).lang("Naquadah-doped Wafer").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "wafer")).register(); - public static ItemEntry NEUTRONIUM_WAFER = REGISTRATE.item("neutronium_wafer", Item::new).lang("Neutronium-doped Wafer").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "wafer")).register(); - - public static ItemEntry CENTRAL_PROCESSING_UNIT_WAFER = REGISTRATE.item("cpu_wafer", Item::new).lang("CPU Wafer").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "wafer")).register(); - public static ItemEntry RANDOM_ACCESS_MEMORY_WAFER = REGISTRATE.item("ram_wafer", Item::new).lang("RAM Wafer").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "wafer")).register(); - public static ItemEntry INTEGRATED_LOGIC_CIRCUIT_WAFER = REGISTRATE.item("ilc_wafer", Item::new).lang("ILC Wafer").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "wafer")).register(); - public static ItemEntry NANO_CENTRAL_PROCESSING_UNIT_WAFER = REGISTRATE.item("nano_cpu_wafer", Item::new).lang("Nano CPU Wafer").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "wafer")).register(); - public static ItemEntry QUBIT_CENTRAL_PROCESSING_UNIT_WAFER = REGISTRATE.item("qbit_cpu_wafer", Item::new).lang("Qubit CPU Wafer").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "wafer")).register(); - public static ItemEntry SIMPLE_SYSTEM_ON_CHIP_WAFER = REGISTRATE.item("simple_soc_wafer", Item::new).lang("Simple SoC Wafer").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "wafer")).register(); - public static ItemEntry SYSTEM_ON_CHIP_WAFER = REGISTRATE.item("soc_wafer", Item::new).lang("SoC Wafer").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "wafer")).register(); - public static ItemEntry ADVANCED_SYSTEM_ON_CHIP_WAFER = REGISTRATE.item("advanced_soc_wafer", Item::new).lang("ASoC Wafer").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "wafer")).register(); - public static ItemEntry HIGHLY_ADVANCED_SOC_WAFER = REGISTRATE.item("highly_advanced_soc_wafer", Item::new).lang("HASoC Wafer").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "wafer")).register(); - public static ItemEntry NAND_MEMORY_CHIP_WAFER = REGISTRATE.item("nand_memory_wafer", Item::new).lang("NAND Memory Wafer").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "wafer")).register(); - public static ItemEntry NOR_MEMORY_CHIP_WAFER = REGISTRATE.item("nor_memory_wafer", Item::new).lang("NOR Memory Wafer").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "wafer")).register(); - public static ItemEntry ULTRA_LOW_POWER_INTEGRATED_CIRCUIT_WAFER = REGISTRATE.item("ulpic_wafer", Item::new).lang("ULPIC Wafer").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "wafer")).register(); - public static ItemEntry LOW_POWER_INTEGRATED_CIRCUIT_WAFER = REGISTRATE.item("lpic_wafer", Item::new).lang("LPIC Wafer").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "wafer")).register(); - public static ItemEntry POWER_INTEGRATED_CIRCUIT_WAFER = REGISTRATE.item("mpic_wafer", Item::new).lang("MPIC Wafer").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "wafer")).register(); - public static ItemEntry HIGH_POWER_INTEGRATED_CIRCUIT_WAFER = REGISTRATE.item("hpic_wafer", Item::new).lang("HPIC Wafer").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "wafer")).register(); - public static ItemEntry ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT_WAFER = REGISTRATE.item("uhpic_wafer", Item::new).lang("UHPIC Wafer").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "wafer")).register(); - - public static ItemEntry ENGRAVED_CRYSTAL_CHIP = REGISTRATE.item("engraved_crystal_chip", Item::new).lang("Engraved Crystal Chip").onRegister(compassNode(GTCompassSections.MISC)).register(); - public static ItemEntry ENGRAVED_LAPOTRON_CHIP = REGISTRATE.item("engraved_lapotron_crystal_chip", Item::new).lang("Engraved Lapotron Crystal Chip").onRegister(compassNode(GTCompassSections.MISC)).register(); - - public static ItemEntry CENTRAL_PROCESSING_UNIT = REGISTRATE.item( "cpu_chip", Item::new).lang("CPU Chip").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "cpus")).register(); - public static ItemEntry RANDOM_ACCESS_MEMORY = REGISTRATE.item( "ram_chip", Item::new).lang("RAM Chip").register(); - public static ItemEntry INTEGRATED_LOGIC_CIRCUIT = REGISTRATE.item( "ilc_chip", Item::new).lang("IC Chip").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "cpus")).register(); - public static ItemEntry NANO_CENTRAL_PROCESSING_UNIT = REGISTRATE.item( "nano_cpu_chip", Item::new).lang("Nano CPU Chip").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "cpus")).register(); - public static ItemEntry QUBIT_CENTRAL_PROCESSING_UNIT = REGISTRATE.item( "qbit_cpu_chip", Item::new).lang("Qubit CPU Chip").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "cpus")).register(); - public static ItemEntry SIMPLE_SYSTEM_ON_CHIP = REGISTRATE.item( "simple_soc", Item::new).lang("Simple SoC").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "socs")).register(); - public static ItemEntry SYSTEM_ON_CHIP = REGISTRATE.item( "soc", Item::new).lang("SoC").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "socs")).register(); - public static ItemEntry ADVANCED_SYSTEM_ON_CHIP = REGISTRATE.item( "advanced_soc", Item::new).lang("ASoC").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "socs")).register(); - public static ItemEntry HIGHLY_ADVANCED_SOC = REGISTRATE.item( "highly_advanced_soc", Item::new).lang("HASoC").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "socs")).register(); - public static ItemEntry NAND_MEMORY_CHIP = REGISTRATE.item( "nand_memory_chip", Item::new).lang("NAND Memory Chip").register(); - public static ItemEntry NOR_MEMORY_CHIP = REGISTRATE.item( "nor_memory_chip", Item::new).lang("NOR Memory Chip").register(); - public static ItemEntry ULTRA_LOW_POWER_INTEGRATED_CIRCUIT = REGISTRATE.item( "ulpic_chip", Item::new).lang("ULPIC Chip").register(); - public static ItemEntry LOW_POWER_INTEGRATED_CIRCUIT = REGISTRATE.item( "lpic_chip", Item::new).lang("LPIC Chip").register(); - public static ItemEntry POWER_INTEGRATED_CIRCUIT = REGISTRATE.item( "mpic_chip", Item::new).lang("MPIC Chip").register(); - public static ItemEntry HIGH_POWER_INTEGRATED_CIRCUIT = REGISTRATE.item( "hpic_chip", Item::new).lang("HPIC Chip").register(); - public static ItemEntry ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT = REGISTRATE.item( "uhpic_chip", Item::new).lang("UHPIC Chip").register(); - - - public static ItemEntry RAW_CRYSTAL_CHIP = REGISTRATE.item("raw_crystal_chip", Item::new).lang("Raw Crystal Chip").onRegister(compassNode(GTCompassSections.MISC)).register(); - public static ItemEntry RAW_CRYSTAL_CHIP_PART = REGISTRATE.item("raw_crystal_chip_parts", Item::new).lang("Raw Crystal Chip Parts").onRegister(compassNode(GTCompassSections.MISC)).register(); - public static ItemEntry CRYSTAL_CENTRAL_PROCESSING_UNIT = REGISTRATE.item("crystal_cpu", Item::new).lang("Crystal CPU").onRegister(compassNode(GTCompassSections.MISC)).onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "cpus")).register(); - public static ItemEntry CRYSTAL_SYSTEM_ON_CHIP = REGISTRATE.item("crystal_soc", Item::new).lang("Crystal SoC").onRegister(compassNode(GTCompassSections.MISC)).onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "socs")).register(); - - public static ItemEntry COATED_BOARD = REGISTRATE.item("resin_circuit_board", Item::new).lang("Resin Circuit Board").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "circuit_board")).register(); - public static ItemEntry PHENOLIC_BOARD = REGISTRATE.item("phenolic_circuit_board", Item::new).lang("Phenolic Circuit Board").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "circuit_board")).register(); - public static ItemEntry PLASTIC_BOARD = REGISTRATE.item("plastic_circuit_board", Item::new).lang("Plastic Circuit Board").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "circuit_board")).register(); - public static ItemEntry EPOXY_BOARD = REGISTRATE.item("epoxy_circuit_board", Item::new).lang("Epoxy Circuit Board").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "circuit_board")).register(); - public static ItemEntry FIBER_BOARD = REGISTRATE.item("fiber_reinforced_circuit_board", Item::new).lang("Fiber-Reinforced Circuit Board").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "circuit_board")).register(); - public static ItemEntry MULTILAYER_FIBER_BOARD = REGISTRATE.item("multilayer_fiber_reinforced_circuit_board", Item::new).lang("Multi-layer Fiber-Reinforced Circuit Board").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "circuit_board")).register(); - public static ItemEntry WETWARE_BOARD = REGISTRATE.item("wetware_circuit_board", Item::new).lang("Wetware Circuit Board").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "circuit_board")).register(); - - public static ItemEntry BASIC_CIRCUIT_BOARD = REGISTRATE.item("resin_printed_circuit_board", Item::new).lang("Resin Printed Circuit Board").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "circuit_board")).register(); - public static ItemEntry GOOD_CIRCUIT_BOARD = REGISTRATE.item("phenolic_printed_circuit_board", Item::new).lang("Phenolic Printed Circuit Board").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "circuit_board")).register(); - public static ItemEntry PLASTIC_CIRCUIT_BOARD = REGISTRATE.item("plastic_printed_circuit_board", Item::new).lang("Plastic Printed Circuit Board").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "circuit_board")).register(); - public static ItemEntry ADVANCED_CIRCUIT_BOARD = REGISTRATE.item("epoxy_printed_circuit_board", Item::new).lang("Epoxy Printed Circuit Board").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "circuit_board")).register(); - public static ItemEntry EXTREME_CIRCUIT_BOARD = REGISTRATE.item("fiber_reinforced_printed_circuit_board", Item::new).lang("Fiber-Reinforced Printed Circuit Board").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "circuit_board")).register(); - public static ItemEntry ELITE_CIRCUIT_BOARD = REGISTRATE.item("multilayer_fiber_reinforced_printed_circuit_board", Item::new).lang("Multi-layer Fiber-Reinforced Printed Circuit Board").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "circuit_board")).register(); - public static ItemEntry WETWARE_CIRCUIT_BOARD = REGISTRATE.item("wetware_printed_circuit_board", Item::new).lang("Wetware Printed Circuit Board").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "circuit_board")).register(); - - public static ItemEntry VACUUM_TUBE = REGISTRATE.item("vacuum_tube", Item::new).lang("Vacuum Tube").tag(CustomTags.ULV_CIRCUITS).onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); - public static ItemEntry GLASS_TUBE = REGISTRATE.item("glass_tube", Item::new).lang("Glass Tube").onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); - public static ItemEntry TRANSISTOR = REGISTRATE.item("transistor", Item::new).lang("Transistor").tag(CustomTags.TRANSISTORS).onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "components")).register(); - public static ItemEntry RESISTOR = REGISTRATE.item("resistor", Item::new).lang("Resistor").tag(CustomTags.RESISTORS).onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "components")).register(); - public static ItemEntry CAPACITOR = REGISTRATE.item("capacitor", Item::new).lang("Capacitor").tag(CustomTags.CAPACITORS).onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "components")).register(); - public static ItemEntry DIODE = REGISTRATE.item("diode", Item::new).lang("Diode").tag(CustomTags.DIODES).onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "components")).register(); - public static ItemEntry INDUCTOR = REGISTRATE.item("inductor", Item::new).lang("Inductor").tag(CustomTags.INDUCTORS).onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "components")).register(); - public static ItemEntry SMD_TRANSISTOR = REGISTRATE.item("smd_transistor", Item::new).lang("SMD Transistor").tag(CustomTags.TRANSISTORS).onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "smd")).register(); - public static ItemEntry SMD_RESISTOR = REGISTRATE.item("smd_resistor", Item::new).lang("SMD Resistor").tag(CustomTags.RESISTORS).onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "smd")).register(); - public static ItemEntry SMD_CAPACITOR = REGISTRATE.item("smd_capacitor", Item::new).lang("SMD Capacitor").tag(CustomTags.CAPACITORS).onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "smd")).register(); - public static ItemEntry SMD_DIODE = REGISTRATE.item("smd_diode", Item::new).lang("SMD Diode").tag(CustomTags.DIODES).onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "smd")).register(); - public static ItemEntry SMD_INDUCTOR = REGISTRATE.item("smd_inductor", Item::new).lang("SMD Inductor").tag(CustomTags.INDUCTORS).onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "smd")).register(); - public static ItemEntry ADVANCED_SMD_TRANSISTOR = REGISTRATE.item("advanced_smd_transistor", Item::new).lang("Advanced SMD Transistor").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "smd")).register(); - public static ItemEntry ADVANCED_SMD_RESISTOR = REGISTRATE.item("advanced_smd_resistor", Item::new).lang("Advanced SMD Resistor").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "smd")).register(); - public static ItemEntry ADVANCED_SMD_CAPACITOR = REGISTRATE.item("advanced_smd_capacitor", Item::new).lang("Advanced SMD Capacitor").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "smd")).register(); - public static ItemEntry ADVANCED_SMD_DIODE = REGISTRATE.item("advanced_smd_diode", Item::new).lang("Advanced SMD Diode").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "smd")).register(); - public static ItemEntry ADVANCED_SMD_INDUCTOR = REGISTRATE.item("advanced_smd_inductor", Item::new).lang("Advanced SMD Inductor").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "smd")).register(); + public static ItemEntry SILICON_BOULE = REGISTRATE.item("silicon_boule", Item::new) + .lang("Monocrystalline Silicon Boule") + .onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "silicon_boule")).register(); + public static ItemEntry PHOSPHORUS_BOULE = REGISTRATE.item("phosphorus_boule", Item::new) + .lang("Phosphorus-doped Monocrystalline Silicon Boule") + .onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "silicon_boule")).register(); + public static ItemEntry NAQUADAH_BOULE = REGISTRATE.item("naquadah_boule", Item::new) + .lang("Naquadah-doped Monocrystalline Silicon Boule") + .onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "silicon_boule")).register(); + public static ItemEntry NEUTRONIUM_BOULE = REGISTRATE.item("neutronium_boule", Item::new) + .lang("Neutronium-doped Monocrystalline Silicon Boule") + .onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "silicon_boule")).register(); + public static ItemEntry SILICON_WAFER = REGISTRATE.item("silicon_wafer", Item::new).lang("Silicon Wafer") + .onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "wafer")).register(); + public static ItemEntry PHOSPHORUS_WAFER = REGISTRATE.item("phosphorus_wafer", Item::new) + .lang("Phosphorus-doped Wafer").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "wafer")) + .register(); + public static ItemEntry NAQUADAH_WAFER = REGISTRATE.item("naquadah_wafer", Item::new) + .lang("Naquadah-doped Wafer").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "wafer")).register(); + public static ItemEntry NEUTRONIUM_WAFER = REGISTRATE.item("neutronium_wafer", Item::new) + .lang("Neutronium-doped Wafer").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "wafer")) + .register(); + + public static ItemEntry CENTRAL_PROCESSING_UNIT_WAFER = REGISTRATE.item("cpu_wafer", Item::new) + .lang("CPU Wafer").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "wafer")).register(); + public static ItemEntry RANDOM_ACCESS_MEMORY_WAFER = REGISTRATE.item("ram_wafer", Item::new).lang("RAM Wafer") + .onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "wafer")).register(); + public static ItemEntry INTEGRATED_LOGIC_CIRCUIT_WAFER = REGISTRATE.item("ilc_wafer", Item::new) + .lang("ILC Wafer").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "wafer")).register(); + public static ItemEntry NANO_CENTRAL_PROCESSING_UNIT_WAFER = REGISTRATE.item("nano_cpu_wafer", Item::new) + .lang("Nano CPU Wafer").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "wafer")).register(); + public static ItemEntry QUBIT_CENTRAL_PROCESSING_UNIT_WAFER = REGISTRATE.item("qbit_cpu_wafer", Item::new) + .lang("Qubit CPU Wafer").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "wafer")).register(); + public static ItemEntry SIMPLE_SYSTEM_ON_CHIP_WAFER = REGISTRATE.item("simple_soc_wafer", Item::new) + .lang("Simple SoC Wafer").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "wafer")).register(); + public static ItemEntry SYSTEM_ON_CHIP_WAFER = REGISTRATE.item("soc_wafer", Item::new).lang("SoC Wafer") + .onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "wafer")).register(); + public static ItemEntry ADVANCED_SYSTEM_ON_CHIP_WAFER = REGISTRATE.item("advanced_soc_wafer", Item::new) + .lang("ASoC Wafer").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "wafer")).register(); + public static ItemEntry HIGHLY_ADVANCED_SOC_WAFER = REGISTRATE.item("highly_advanced_soc_wafer", Item::new) + .lang("HASoC Wafer").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "wafer")).register(); + public static ItemEntry NAND_MEMORY_CHIP_WAFER = REGISTRATE.item("nand_memory_wafer", Item::new) + .lang("NAND Memory Wafer").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "wafer")).register(); + public static ItemEntry NOR_MEMORY_CHIP_WAFER = REGISTRATE.item("nor_memory_wafer", Item::new) + .lang("NOR Memory Wafer").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "wafer")).register(); + public static ItemEntry ULTRA_LOW_POWER_INTEGRATED_CIRCUIT_WAFER = REGISTRATE.item("ulpic_wafer", Item::new) + .lang("ULPIC Wafer").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "wafer")).register(); + public static ItemEntry LOW_POWER_INTEGRATED_CIRCUIT_WAFER = REGISTRATE.item("lpic_wafer", Item::new) + .lang("LPIC Wafer").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "wafer")).register(); + public static ItemEntry POWER_INTEGRATED_CIRCUIT_WAFER = REGISTRATE.item("mpic_wafer", Item::new) + .lang("MPIC Wafer").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "wafer")).register(); + public static ItemEntry HIGH_POWER_INTEGRATED_CIRCUIT_WAFER = REGISTRATE.item("hpic_wafer", Item::new) + .lang("HPIC Wafer").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "wafer")).register(); + public static ItemEntry ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT_WAFER = REGISTRATE.item("uhpic_wafer", Item::new) + .lang("UHPIC Wafer").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "wafer")).register(); + + public static ItemEntry ENGRAVED_CRYSTAL_CHIP = REGISTRATE.item("engraved_crystal_chip", Item::new) + .lang("Engraved Crystal Chip").onRegister(compassNode(GTCompassSections.MISC)).register(); + public static ItemEntry ENGRAVED_LAPOTRON_CHIP = REGISTRATE.item("engraved_lapotron_crystal_chip", Item::new) + .lang("Engraved Lapotron Crystal Chip").onRegister(compassNode(GTCompassSections.MISC)).register(); + + public static ItemEntry CENTRAL_PROCESSING_UNIT = REGISTRATE.item("cpu_chip", Item::new).lang("CPU Chip") + .onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "cpus")).register(); + public static ItemEntry RANDOM_ACCESS_MEMORY = REGISTRATE.item("ram_chip", Item::new).lang("RAM Chip") + .register(); + public static ItemEntry INTEGRATED_LOGIC_CIRCUIT = REGISTRATE.item("ilc_chip", Item::new).lang("IC Chip") + .onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "cpus")).register(); + public static ItemEntry NANO_CENTRAL_PROCESSING_UNIT = REGISTRATE.item("nano_cpu_chip", Item::new) + .lang("Nano CPU Chip").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "cpus")).register(); + public static ItemEntry QUBIT_CENTRAL_PROCESSING_UNIT = REGISTRATE.item("qbit_cpu_chip", Item::new) + .lang("Qubit CPU Chip").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "cpus")).register(); + public static ItemEntry SIMPLE_SYSTEM_ON_CHIP = REGISTRATE.item("simple_soc", Item::new).lang("Simple SoC") + .onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "socs")).register(); + public static ItemEntry SYSTEM_ON_CHIP = REGISTRATE.item("soc", Item::new).lang("SoC") + .onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "socs")).register(); + public static ItemEntry ADVANCED_SYSTEM_ON_CHIP = REGISTRATE.item("advanced_soc", Item::new).lang("ASoC") + .onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "socs")).register(); + public static ItemEntry HIGHLY_ADVANCED_SOC = REGISTRATE.item("highly_advanced_soc", Item::new).lang("HASoC") + .onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "socs")).register(); + public static ItemEntry NAND_MEMORY_CHIP = REGISTRATE.item("nand_memory_chip", Item::new) + .lang("NAND Memory Chip").register(); + public static ItemEntry NOR_MEMORY_CHIP = REGISTRATE.item("nor_memory_chip", Item::new) + .lang("NOR Memory Chip").register(); + public static ItemEntry ULTRA_LOW_POWER_INTEGRATED_CIRCUIT = REGISTRATE.item("ulpic_chip", Item::new) + .lang("ULPIC Chip").register(); + public static ItemEntry LOW_POWER_INTEGRATED_CIRCUIT = REGISTRATE.item("lpic_chip", Item::new) + .lang("LPIC Chip").register(); + public static ItemEntry POWER_INTEGRATED_CIRCUIT = REGISTRATE.item("mpic_chip", Item::new).lang("MPIC Chip") + .register(); + public static ItemEntry HIGH_POWER_INTEGRATED_CIRCUIT = REGISTRATE.item("hpic_chip", Item::new) + .lang("HPIC Chip").register(); + public static ItemEntry ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT = REGISTRATE.item("uhpic_chip", Item::new) + .lang("UHPIC Chip").register(); + + public static ItemEntry RAW_CRYSTAL_CHIP = REGISTRATE.item("raw_crystal_chip", Item::new) + .lang("Raw Crystal Chip").onRegister(compassNode(GTCompassSections.MISC)).register(); + public static ItemEntry RAW_CRYSTAL_CHIP_PART = REGISTRATE.item("raw_crystal_chip_parts", Item::new) + .lang("Raw Crystal Chip Parts").onRegister(compassNode(GTCompassSections.MISC)).register(); + public static ItemEntry CRYSTAL_CENTRAL_PROCESSING_UNIT = REGISTRATE.item("crystal_cpu", Item::new) + .lang("Crystal CPU").onRegister(compassNode(GTCompassSections.MISC)) + .onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "cpus")).register(); + public static ItemEntry CRYSTAL_SYSTEM_ON_CHIP = REGISTRATE.item("crystal_soc", Item::new).lang("Crystal SoC") + .onRegister(compassNode(GTCompassSections.MISC)) + .onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "socs")).register(); + + public static ItemEntry COATED_BOARD = REGISTRATE.item("resin_circuit_board", Item::new) + .lang("Resin Circuit Board").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "circuit_board")) + .register(); + public static ItemEntry PHENOLIC_BOARD = REGISTRATE.item("phenolic_circuit_board", Item::new) + .lang("Phenolic Circuit Board").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "circuit_board")) + .register(); + public static ItemEntry PLASTIC_BOARD = REGISTRATE.item("plastic_circuit_board", Item::new) + .lang("Plastic Circuit Board").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "circuit_board")) + .register(); + public static ItemEntry EPOXY_BOARD = REGISTRATE.item("epoxy_circuit_board", Item::new) + .lang("Epoxy Circuit Board").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "circuit_board")) + .register(); + public static ItemEntry FIBER_BOARD = REGISTRATE.item("fiber_reinforced_circuit_board", Item::new) + .lang("Fiber-Reinforced Circuit Board") + .onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "circuit_board")).register(); + public static ItemEntry MULTILAYER_FIBER_BOARD = REGISTRATE + .item("multilayer_fiber_reinforced_circuit_board", Item::new) + .lang("Multi-layer Fiber-Reinforced Circuit Board") + .onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "circuit_board")).register(); + public static ItemEntry WETWARE_BOARD = REGISTRATE.item("wetware_circuit_board", Item::new) + .lang("Wetware Circuit Board").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "circuit_board")) + .register(); + + public static ItemEntry BASIC_CIRCUIT_BOARD = REGISTRATE.item("resin_printed_circuit_board", Item::new) + .lang("Resin Printed Circuit Board") + .onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "circuit_board")).register(); + public static ItemEntry GOOD_CIRCUIT_BOARD = REGISTRATE.item("phenolic_printed_circuit_board", Item::new) + .lang("Phenolic Printed Circuit Board") + .onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "circuit_board")).register(); + public static ItemEntry PLASTIC_CIRCUIT_BOARD = REGISTRATE.item("plastic_printed_circuit_board", Item::new) + .lang("Plastic Printed Circuit Board") + .onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "circuit_board")).register(); + public static ItemEntry ADVANCED_CIRCUIT_BOARD = REGISTRATE.item("epoxy_printed_circuit_board", Item::new) + .lang("Epoxy Printed Circuit Board") + .onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "circuit_board")).register(); + public static ItemEntry EXTREME_CIRCUIT_BOARD = REGISTRATE + .item("fiber_reinforced_printed_circuit_board", Item::new).lang("Fiber-Reinforced Printed Circuit Board") + .onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "circuit_board")).register(); + public static ItemEntry ELITE_CIRCUIT_BOARD = REGISTRATE + .item("multilayer_fiber_reinforced_printed_circuit_board", Item::new) + .lang("Multi-layer Fiber-Reinforced Printed Circuit Board") + .onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "circuit_board")).register(); + public static ItemEntry WETWARE_CIRCUIT_BOARD = REGISTRATE.item("wetware_printed_circuit_board", Item::new) + .lang("Wetware Printed Circuit Board") + .onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "circuit_board")).register(); + + public static ItemEntry VACUUM_TUBE = REGISTRATE.item("vacuum_tube", Item::new).lang("Vacuum Tube") + .tag(CustomTags.ULV_CIRCUITS).onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); + public static ItemEntry GLASS_TUBE = REGISTRATE.item("glass_tube", Item::new).lang("Glass Tube") + .onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); + public static ItemEntry TRANSISTOR = REGISTRATE.item("transistor", Item::new).lang("Transistor") + .tag(CustomTags.TRANSISTORS).onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "components")) + .register(); + public static ItemEntry RESISTOR = REGISTRATE.item("resistor", Item::new).lang("Resistor") + .tag(CustomTags.RESISTORS).onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "components")) + .register(); + public static ItemEntry CAPACITOR = REGISTRATE.item("capacitor", Item::new).lang("Capacitor") + .tag(CustomTags.CAPACITORS).onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "components")) + .register(); + public static ItemEntry DIODE = REGISTRATE.item("diode", Item::new).lang("Diode").tag(CustomTags.DIODES) + .onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "components")).register(); + public static ItemEntry INDUCTOR = REGISTRATE.item("inductor", Item::new).lang("Inductor") + .tag(CustomTags.INDUCTORS).onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "components")) + .register(); + public static ItemEntry SMD_TRANSISTOR = REGISTRATE.item("smd_transistor", Item::new).lang("SMD Transistor") + .tag(CustomTags.TRANSISTORS).onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "smd")).register(); + public static ItemEntry SMD_RESISTOR = REGISTRATE.item("smd_resistor", Item::new).lang("SMD Resistor") + .tag(CustomTags.RESISTORS).onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "smd")).register(); + public static ItemEntry SMD_CAPACITOR = REGISTRATE.item("smd_capacitor", Item::new).lang("SMD Capacitor") + .tag(CustomTags.CAPACITORS).onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "smd")).register(); + public static ItemEntry SMD_DIODE = REGISTRATE.item("smd_diode", Item::new).lang("SMD Diode") + .tag(CustomTags.DIODES).onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "smd")).register(); + public static ItemEntry SMD_INDUCTOR = REGISTRATE.item("smd_inductor", Item::new).lang("SMD Inductor") + .tag(CustomTags.INDUCTORS).onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "smd")).register(); + public static ItemEntry ADVANCED_SMD_TRANSISTOR = REGISTRATE.item("advanced_smd_transistor", Item::new) + .lang("Advanced SMD Transistor").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "smd")).register(); + public static ItemEntry ADVANCED_SMD_RESISTOR = REGISTRATE.item("advanced_smd_resistor", Item::new) + .lang("Advanced SMD Resistor").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "smd")).register(); + public static ItemEntry ADVANCED_SMD_CAPACITOR = REGISTRATE.item("advanced_smd_capacitor", Item::new) + .lang("Advanced SMD Capacitor").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "smd")).register(); + public static ItemEntry ADVANCED_SMD_DIODE = REGISTRATE.item("advanced_smd_diode", Item::new) + .lang("Advanced SMD Diode").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "smd")).register(); + public static ItemEntry ADVANCED_SMD_INDUCTOR = REGISTRATE.item("advanced_smd_inductor", Item::new) + .lang("Advanced SMD Inductor").onRegister(compassNodeExist(GTCompassSections.CIRCUITS, "smd")).register(); // T1: Electronic - public static ItemEntry ELECTRONIC_CIRCUIT_LV = REGISTRATE.item("basic_electronic_circuit", Item::new).lang("Basic Electronic Circuit").tag(CustomTags.LV_CIRCUITS).onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); - public static ItemEntry ELECTRONIC_CIRCUIT_MV = REGISTRATE.item("good_electronic_circuit", Item::new).lang("Good Electronic Circuit").tag(CustomTags.MV_CIRCUITS).onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); + public static ItemEntry ELECTRONIC_CIRCUIT_LV = REGISTRATE.item("basic_electronic_circuit", Item::new) + .lang("Basic Electronic Circuit").tag(CustomTags.LV_CIRCUITS) + .onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); + public static ItemEntry ELECTRONIC_CIRCUIT_MV = REGISTRATE.item("good_electronic_circuit", Item::new) + .lang("Good Electronic Circuit").tag(CustomTags.MV_CIRCUITS) + .onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); // T2: Integrated - public static ItemEntry INTEGRATED_CIRCUIT_LV = REGISTRATE.item("basic_integrated_circuit", Item::new).lang("Basic Integrated Circuit").tag(CustomTags.LV_CIRCUITS).onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); - public static ItemEntry INTEGRATED_CIRCUIT_MV = REGISTRATE.item("good_integrated_circuit", Item::new).lang("Good Integrated Circuit").tag(CustomTags.MV_CIRCUITS).onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); - public static ItemEntry INTEGRATED_CIRCUIT_HV = REGISTRATE.item("advanced_integrated_circuit", Item::new).lang("Advanced Integrated Circuit").tag(CustomTags.HV_CIRCUITS).onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); + public static ItemEntry INTEGRATED_CIRCUIT_LV = REGISTRATE.item("basic_integrated_circuit", Item::new) + .lang("Basic Integrated Circuit").tag(CustomTags.LV_CIRCUITS) + .onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); + public static ItemEntry INTEGRATED_CIRCUIT_MV = REGISTRATE.item("good_integrated_circuit", Item::new) + .lang("Good Integrated Circuit").tag(CustomTags.MV_CIRCUITS) + .onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); + public static ItemEntry INTEGRATED_CIRCUIT_HV = REGISTRATE.item("advanced_integrated_circuit", Item::new) + .lang("Advanced Integrated Circuit").tag(CustomTags.HV_CIRCUITS) + .onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); // ULV/LV easier circuits - public static ItemEntry NAND_CHIP_ULV = REGISTRATE.item("nand_chip", Item::new).lang("NAND Chip").tag(CustomTags.ULV_CIRCUITS).onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); - public static ItemEntry MICROPROCESSOR_LV = REGISTRATE.item("microchip_processor", Item::new).lang("Microchip Processor").tag(CustomTags.LV_CIRCUITS).onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); + public static ItemEntry NAND_CHIP_ULV = REGISTRATE.item("nand_chip", Item::new).lang("NAND Chip") + .tag(CustomTags.ULV_CIRCUITS).onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); + public static ItemEntry MICROPROCESSOR_LV = REGISTRATE.item("microchip_processor", Item::new) + .lang("Microchip Processor").tag(CustomTags.LV_CIRCUITS).onRegister(compassNode(GTCompassSections.CIRCUITS)) + .register(); // T3: Processor - public static ItemEntry PROCESSOR_MV = REGISTRATE.item("micro_processor", Item::new).lang("Microprocessor").tag(CustomTags.MV_CIRCUITS).onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); - public static ItemEntry PROCESSOR_ASSEMBLY_HV = REGISTRATE.item("micro_processor_assembly", Item::new).lang("Microprocessor Assembly").tag(CustomTags.HV_CIRCUITS).onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); - public static ItemEntry WORKSTATION_EV = REGISTRATE.item("micro_processor_computer", Item::new).lang("Microprocessor Supercomputer").tag(CustomTags.EV_CIRCUITS).onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); - public static ItemEntry MAINFRAME_IV = REGISTRATE.item("micro_processor_mainframe", Item::new).lang("Microprocessor Mainframe").tag(CustomTags.IV_CIRCUITS).onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); + public static ItemEntry PROCESSOR_MV = REGISTRATE.item("micro_processor", Item::new).lang("Microprocessor") + .tag(CustomTags.MV_CIRCUITS).onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); + public static ItemEntry PROCESSOR_ASSEMBLY_HV = REGISTRATE.item("micro_processor_assembly", Item::new) + .lang("Microprocessor Assembly").tag(CustomTags.HV_CIRCUITS) + .onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); + public static ItemEntry WORKSTATION_EV = REGISTRATE.item("micro_processor_computer", Item::new) + .lang("Microprocessor Supercomputer").tag(CustomTags.EV_CIRCUITS) + .onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); + public static ItemEntry MAINFRAME_IV = REGISTRATE.item("micro_processor_mainframe", Item::new) + .lang("Microprocessor Mainframe").tag(CustomTags.IV_CIRCUITS) + .onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); // T4: Nano - public static ItemEntry NANO_PROCESSOR_HV = REGISTRATE.item("nano_processor", Item::new).lang("Nanoprocessor").tag(CustomTags.HV_CIRCUITS).onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); - public static ItemEntry NANO_PROCESSOR_ASSEMBLY_EV = REGISTRATE.item("nano_processor_assembly", Item::new).lang("Nanoprocessor Assembly").tag(CustomTags.EV_CIRCUITS).onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); - public static ItemEntry NANO_COMPUTER_IV = REGISTRATE.item("nano_processor_computer", Item::new).lang("Nanoprocessor Supercomputer").tag(CustomTags.IV_CIRCUITS).onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); - public static ItemEntry NANO_MAINFRAME_LUV = REGISTRATE.item("nano_processor_mainframe", Item::new).lang("Nanoprocessor Mainframe").tag(CustomTags.LuV_CIRCUITS).onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); + public static ItemEntry NANO_PROCESSOR_HV = REGISTRATE.item("nano_processor", Item::new).lang("Nanoprocessor") + .tag(CustomTags.HV_CIRCUITS).onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); + public static ItemEntry NANO_PROCESSOR_ASSEMBLY_EV = REGISTRATE.item("nano_processor_assembly", Item::new) + .lang("Nanoprocessor Assembly").tag(CustomTags.EV_CIRCUITS) + .onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); + public static ItemEntry NANO_COMPUTER_IV = REGISTRATE.item("nano_processor_computer", Item::new) + .lang("Nanoprocessor Supercomputer").tag(CustomTags.IV_CIRCUITS) + .onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); + public static ItemEntry NANO_MAINFRAME_LUV = REGISTRATE.item("nano_processor_mainframe", Item::new) + .lang("Nanoprocessor Mainframe").tag(CustomTags.LuV_CIRCUITS) + .onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); // T5: Quantum - public static ItemEntry QUANTUM_PROCESSOR_EV = REGISTRATE.item("quantum_processor", Item::new).lang("Quantum Processor").tag(CustomTags.EV_CIRCUITS).onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); - public static ItemEntry QUANTUM_ASSEMBLY_IV = REGISTRATE.item("quantum_processor_assembly", Item::new).lang("Quantum Processor Assembly").tag(CustomTags.IV_CIRCUITS).onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); - public static ItemEntry QUANTUM_COMPUTER_LUV = REGISTRATE.item("quantum_processor_computer", Item::new).lang("Quantum Processor Supercomputer").tag(CustomTags.LuV_CIRCUITS).onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); - public static ItemEntry QUANTUM_MAINFRAME_ZPM = REGISTRATE.item("quantum_processor_mainframe", Item::new).lang("Quantum Processor Mainframe").tag(CustomTags.ZPM_CIRCUITS).onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); + public static ItemEntry QUANTUM_PROCESSOR_EV = REGISTRATE.item("quantum_processor", Item::new) + .lang("Quantum Processor").tag(CustomTags.EV_CIRCUITS).onRegister(compassNode(GTCompassSections.CIRCUITS)) + .register(); + public static ItemEntry QUANTUM_ASSEMBLY_IV = REGISTRATE.item("quantum_processor_assembly", Item::new) + .lang("Quantum Processor Assembly").tag(CustomTags.IV_CIRCUITS) + .onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); + public static ItemEntry QUANTUM_COMPUTER_LUV = REGISTRATE.item("quantum_processor_computer", Item::new) + .lang("Quantum Processor Supercomputer").tag(CustomTags.LuV_CIRCUITS) + .onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); + public static ItemEntry QUANTUM_MAINFRAME_ZPM = REGISTRATE.item("quantum_processor_mainframe", Item::new) + .lang("Quantum Processor Mainframe").tag(CustomTags.ZPM_CIRCUITS) + .onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); // T6: Crystal - public static ItemEntry CRYSTAL_PROCESSOR_IV = REGISTRATE.item("crystal_processor", Item::new).lang("Crystal Processor").tag(CustomTags.IV_CIRCUITS).onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); - public static ItemEntry CRYSTAL_ASSEMBLY_LUV = REGISTRATE.item("crystal_processor_assembly", Item::new).lang("Crystal Processor Assembly").tag(CustomTags.LuV_CIRCUITS).onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); - public static ItemEntry CRYSTAL_COMPUTER_ZPM = REGISTRATE.item("crystal_processor_computer", Item::new).lang("Crystal Processor Supercomputer").tag(CustomTags.ZPM_CIRCUITS).onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); - public static ItemEntry CRYSTAL_MAINFRAME_UV = REGISTRATE.item("crystal_processor_mainframe", Item::new).lang("Crystal Processor Mainframe").tag(CustomTags.UV_CIRCUITS).onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); + public static ItemEntry CRYSTAL_PROCESSOR_IV = REGISTRATE.item("crystal_processor", Item::new) + .lang("Crystal Processor").tag(CustomTags.IV_CIRCUITS).onRegister(compassNode(GTCompassSections.CIRCUITS)) + .register(); + public static ItemEntry CRYSTAL_ASSEMBLY_LUV = REGISTRATE.item("crystal_processor_assembly", Item::new) + .lang("Crystal Processor Assembly").tag(CustomTags.LuV_CIRCUITS) + .onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); + public static ItemEntry CRYSTAL_COMPUTER_ZPM = REGISTRATE.item("crystal_processor_computer", Item::new) + .lang("Crystal Processor Supercomputer").tag(CustomTags.ZPM_CIRCUITS) + .onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); + public static ItemEntry CRYSTAL_MAINFRAME_UV = REGISTRATE.item("crystal_processor_mainframe", Item::new) + .lang("Crystal Processor Mainframe").tag(CustomTags.UV_CIRCUITS) + .onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); // T7: Wetware - public static ItemEntry WETWARE_PROCESSOR_LUV = REGISTRATE.item("wetware_processor", Item::new).lang("Wetware Processor").tag(CustomTags.LuV_CIRCUITS).onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); - public static ItemEntry WETWARE_PROCESSOR_ASSEMBLY_ZPM = REGISTRATE.item("wetware_processor_assembly", Item::new).lang("Wetware Processor Assembly").tag(CustomTags.ZPM_CIRCUITS).onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); - public static ItemEntry WETWARE_SUPER_COMPUTER_UV = REGISTRATE.item("wetware_processor_computer", Item::new).lang("Wetware Processor Supercomputer").tag(CustomTags.UV_CIRCUITS).onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); - public static ItemEntry WETWARE_MAINFRAME_UHV = REGISTRATE.item("wetware_processor_mainframe", Item::new).lang("Wetware Processor Mainframe").tag(CustomTags.UHV_CIRCUITS).onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); - - public static ItemEntry COMPONENT_GRINDER_DIAMOND = REGISTRATE.item("diamond_grinding_head", Item::new).lang("Diamond Grinding Head").onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 8), new MaterialStack(GTMaterials.Diamond, GTValues.M * 5)))).onRegister(compassNode(GTCompassSections.MISC)).register(); - public static ItemEntry COMPONENT_GRINDER_TUNGSTEN = REGISTRATE.item("tungsten_grinding_head", Item::new).lang("Tungsten Grinding Head").onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Tungsten, GTValues.M * 4), new MaterialStack(GTMaterials.VanadiumSteel, GTValues.M * 8), new MaterialStack(GTMaterials.Diamond, GTValues.M)))).onRegister(compassNode(GTCompassSections.MISC)).register(); + public static ItemEntry WETWARE_PROCESSOR_LUV = REGISTRATE.item("wetware_processor", Item::new) + .lang("Wetware Processor").tag(CustomTags.LuV_CIRCUITS).onRegister(compassNode(GTCompassSections.CIRCUITS)) + .register(); + public static ItemEntry WETWARE_PROCESSOR_ASSEMBLY_ZPM = REGISTRATE + .item("wetware_processor_assembly", Item::new).lang("Wetware Processor Assembly") + .tag(CustomTags.ZPM_CIRCUITS).onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); + public static ItemEntry WETWARE_SUPER_COMPUTER_UV = REGISTRATE.item("wetware_processor_computer", Item::new) + .lang("Wetware Processor Supercomputer").tag(CustomTags.UV_CIRCUITS) + .onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); + public static ItemEntry WETWARE_MAINFRAME_UHV = REGISTRATE.item("wetware_processor_mainframe", Item::new) + .lang("Wetware Processor Mainframe").tag(CustomTags.UHV_CIRCUITS) + .onRegister(compassNode(GTCompassSections.CIRCUITS)).register(); + + public static ItemEntry COMPONENT_GRINDER_DIAMOND = REGISTRATE.item("diamond_grinding_head", Item::new) + .lang("Diamond Grinding Head") + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 8), + new MaterialStack(GTMaterials.Diamond, GTValues.M * 5)))) + .onRegister(compassNode(GTCompassSections.MISC)).register(); + public static ItemEntry COMPONENT_GRINDER_TUNGSTEN = REGISTRATE.item("tungsten_grinding_head", Item::new) + .lang("Tungsten Grinding Head") + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Tungsten, GTValues.M * 4), + new MaterialStack(GTMaterials.VanadiumSteel, GTValues.M * 8), + new MaterialStack(GTMaterials.Diamond, GTValues.M)))) + .onRegister(compassNode(GTCompassSections.MISC)).register(); public static ItemEntry IRON_MINECART_WHEELS = REGISTRATE.item("iron_minecart_wheels", Item::new) - .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, GTValues.M)))) - .register(); + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, GTValues.M)))) + .register(); public static ItemEntry STEEL_MINECART_WHEELS = REGISTRATE.item("steel_minecart_wheels", Item::new) - .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M)))) - .register(); - - public static ItemEntry QUANTUM_EYE = REGISTRATE.item("quantum_eye", Item::new).lang("Quantum Eye").onRegister(compassNode(GTCompassSections.MISC)).register(); - public static ItemEntry QUANTUM_STAR = REGISTRATE.item("quantum_star", Item::new).lang("Quantum Star").onRegister(compassNode(GTCompassSections.MISC)).register(); - public static ItemEntry GRAVI_STAR = REGISTRATE.item("gravi_star", Item::new).lang("Gravi-Star").onRegister(compassNode(GTCompassSections.MISC)).register(); + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M)))) + .register(); + public static ItemEntry QUANTUM_EYE = REGISTRATE.item("quantum_eye", Item::new).lang("Quantum Eye") + .onRegister(compassNode(GTCompassSections.MISC)).register(); + public static ItemEntry QUANTUM_STAR = REGISTRATE.item("quantum_star", Item::new).lang("Quantum Star") + .onRegister(compassNode(GTCompassSections.MISC)).register(); + public static ItemEntry GRAVI_STAR = REGISTRATE.item("gravi_star", Item::new).lang("Gravi-Star") + .onRegister(compassNode(GTCompassSections.MISC)).register(); ///////////////////////////////////////// - //*********** COVERS ***********// + // *********** COVERS ***********// ///////////////////////////////////////// - public static ItemEntry ITEM_FILTER = REGISTRATE.item("item_filter", ComponentItem::create) - .onRegister(attach(new ItemFilterBehaviour(SimpleItemFilter::loadFilter), new CoverPlaceBehavior(GTCovers.ITEM_FILTER))) - .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Zinc, GTValues.M * 2), new MaterialStack(GTMaterials.Steel, GTValues.M)))) + .onRegister(attach(new ItemFilterBehaviour(SimpleItemFilter::loadFilter), + new CoverPlaceBehavior(GTCovers.ITEM_FILTER))) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Zinc, GTValues.M * 2), + new MaterialStack(GTMaterials.Steel, GTValues.M)))) .onRegister(compassNode(GTCompassSections.COVERS, GTCompassNodes.COVER)).register(); - public static ItemEntry ORE_DICTIONARY_FILTER = REGISTRATE.item("item_tag_filter", ComponentItem::create) + public static ItemEntry ORE_DICTIONARY_FILTER = REGISTRATE + .item("item_tag_filter", ComponentItem::create) .lang("Item Tag Filter") - .onRegister(attach(new ItemFilterBehaviour(TagItemFilter::loadFilter), new CoverPlaceBehavior(GTCovers.ITEM_FILTER))) + .onRegister(attach(new ItemFilterBehaviour(TagItemFilter::loadFilter), + new CoverPlaceBehavior(GTCovers.ITEM_FILTER))) .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Zinc, GTValues.M * 2)))) .onRegister(compassNode(GTCompassSections.COVERS, GTCompassNodes.COVER)).register(); public static ItemEntry FLUID_FILTER = REGISTRATE.item("fluid_filter", ComponentItem::create) - .onRegister(attach(new FluidFilterBehaviour(SimpleFluidFilter::loadFilter), new CoverPlaceBehavior(GTCovers.FLUID_FILTER))) + .onRegister(attach(new FluidFilterBehaviour(SimpleFluidFilter::loadFilter), + new CoverPlaceBehavior(GTCovers.FLUID_FILTER))) .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Zinc, GTValues.M * 2)))) .onRegister(compassNode(GTCompassSections.COVERS, GTCompassNodes.COVER)).register(); public static ItemEntry TAG_FLUID_FILTER = REGISTRATE.item("fluid_tag_filter", ComponentItem::create) .lang("Fluid Tag Filter") - .onRegister(attach(new FluidFilterBehaviour(TagFluidFilter::loadFilter), new CoverPlaceBehavior(GTCovers.FLUID_FILTER))) + .onRegister(attach(new FluidFilterBehaviour(TagFluidFilter::loadFilter), + new CoverPlaceBehavior(GTCovers.FLUID_FILTER))) .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Zinc, GTValues.M * 3 / 2)))) .onRegister(compassNode(GTCompassSections.COVERS, GTCompassNodes.COVER)).register(); - - public static ItemEntry COVER_MACHINE_CONTROLLER = REGISTRATE.item("machine_controller_cover", ComponentItem::create) + public static ItemEntry COVER_MACHINE_CONTROLLER = REGISTRATE + .item("machine_controller_cover", ComponentItem::create) .lang("Machine Controller") .onRegister(attach(new CoverPlaceBehavior(GTCovers.MACHINE_CONTROLLER))) .onRegister(compassNode(GTCompassSections.COVERS, GTCompassNodes.COVER)) .register(); - - public static ItemEntry COVER_ACTIVITY_DETECTOR = REGISTRATE.item("activity_detector_cover", ComponentItem::create) + public static ItemEntry COVER_ACTIVITY_DETECTOR = REGISTRATE + .item("activity_detector_cover", ComponentItem::create) .lang("Activity Detector") .onRegister(attach(new CoverPlaceBehavior(GTCovers.ACTIVITY_DETECTOR))) .onRegister(compassNode(GTCompassSections.COVERS, GTCompassNodes.COVER)) .register(); - public static ItemEntry COVER_ACTIVITY_DETECTOR_ADVANCED = REGISTRATE.item("advanced_activity_detector_cover", ComponentItem::create) + public static ItemEntry COVER_ACTIVITY_DETECTOR_ADVANCED = REGISTRATE + .item("advanced_activity_detector_cover", ComponentItem::create) .lang("Advanced Activity Detector") .onRegister(attach(new CoverPlaceBehavior(GTCovers.ACTIVITY_DETECTOR_ADVANCED))) .onRegister(compassNode(GTCompassSections.COVERS, GTCompassNodes.COVER)) .register(); - public static ItemEntry COVER_FLUID_DETECTOR = REGISTRATE.item("fluid_detector_cover", ComponentItem::create) + public static ItemEntry COVER_FLUID_DETECTOR = REGISTRATE + .item("fluid_detector_cover", ComponentItem::create) .lang("Fluid Detector") .onRegister(attach(new CoverPlaceBehavior(GTCovers.FLUID_DETECTOR))) .onRegister(compassNode(GTCompassSections.COVERS, GTCompassNodes.COVER)) .register(); - public static ItemEntry COVER_FLUID_DETECTOR_ADVANCED = REGISTRATE.item("advanced_fluid_detector_cover", ComponentItem::create) + public static ItemEntry COVER_FLUID_DETECTOR_ADVANCED = REGISTRATE + .item("advanced_fluid_detector_cover", ComponentItem::create) .lang("Advanced Fluid Detector") .onRegister(attach(new CoverPlaceBehavior(GTCovers.FLUID_DETECTOR_ADVANCED))) .onRegister(compassNode(GTCompassSections.COVERS, GTCompassNodes.COVER)) .register(); - public static ItemEntry COVER_ITEM_DETECTOR = REGISTRATE.item("item_detector_cover", ComponentItem::create) + public static ItemEntry COVER_ITEM_DETECTOR = REGISTRATE + .item("item_detector_cover", ComponentItem::create) .lang("Item Detector") .onRegister(attach(new CoverPlaceBehavior(GTCovers.ITEM_DETECTOR))) .onRegister(compassNode(GTCompassSections.COVERS, GTCompassNodes.COVER)) .register(); - public static ItemEntry COVER_ITEM_DETECTOR_ADVANCED = REGISTRATE.item("advanced_item_detector_cover", ComponentItem::create) + public static ItemEntry COVER_ITEM_DETECTOR_ADVANCED = REGISTRATE + .item("advanced_item_detector_cover", ComponentItem::create) .lang("Advanced Item Detector") .onRegister(attach(new CoverPlaceBehavior(GTCovers.ITEM_DETECTOR_ADVANCED))) .onRegister(compassNode(GTCompassSections.COVERS, GTCompassNodes.COVER)) .register(); - public static ItemEntry COVER_ENERGY_DETECTOR = REGISTRATE.item("energy_detector_cover", ComponentItem::create) + public static ItemEntry COVER_ENERGY_DETECTOR = REGISTRATE + .item("energy_detector_cover", ComponentItem::create) .lang("Energy Detector") .onRegister(attach(new CoverPlaceBehavior(GTCovers.ENERGY_DETECTOR))) .onRegister(compassNode(GTCompassSections.COVERS, GTCompassNodes.COVER)) .register(); - public static ItemEntry COVER_ENERGY_DETECTOR_ADVANCED = REGISTRATE.item("advanced_energy_detector_cover", ComponentItem::create) + public static ItemEntry COVER_ENERGY_DETECTOR_ADVANCED = REGISTRATE + .item("advanced_energy_detector_cover", ComponentItem::create) .lang("Advanced Energy Detector") .onRegister(attach(new CoverPlaceBehavior(GTCovers.ENERGY_DETECTOR_ADVANCED))) .onRegister(compassNode(GTCompassSections.COVERS, GTCompassNodes.COVER)) .register(); - public static ItemEntry COVER_MAINTENANCE_DETECTOR = REGISTRATE.item("maintenance_detector_cover", ComponentItem::create) + public static ItemEntry COVER_MAINTENANCE_DETECTOR = REGISTRATE + .item("maintenance_detector_cover", ComponentItem::create) .lang("Maintenance Detector") .onRegister(attach(new CoverPlaceBehavior(GTCovers.MAINTENANCE_DETECTOR))) .onRegister(compassNode(GTCompassSections.COVERS, GTCompassNodes.COVER)) .register(); - - public static ItemEntry COVER_SCREEN = REGISTRATE.item("computer_monitor_cover", ComponentItem::create) + public static ItemEntry COVER_SCREEN = REGISTRATE + .item("computer_monitor_cover", ComponentItem::create) .lang("Computer Monitor") .onRegister(attach(new CoverPlaceBehavior(GTCovers.COMPUTER_MONITOR))) .onRegister(compassNode(GTCompassSections.COVERS, GTCompassNodes.COVER)) .register(); - public static ItemEntry COVER_CRAFTING = REGISTRATE.item("crafting_table_cover", ComponentItem::create) + public static ItemEntry COVER_CRAFTING = REGISTRATE + .item("crafting_table_cover", ComponentItem::create) .lang("Crafting Table Cover") .onRegister(compassNode(GTCompassSections.COVERS, GTCompassNodes.COVER)) .register(); - public static ItemEntry COVER_SHUTTER = REGISTRATE.item("shutter_module_cover", ComponentItem::create) + public static ItemEntry COVER_SHUTTER = REGISTRATE + .item("shutter_module_cover", ComponentItem::create) .lang("Shutter Module") .onRegister(compassNode(GTCompassSections.COVERS, GTCompassNodes.COVER)) .onRegister(attach(new CoverPlaceBehavior(GTCovers.SHUTTER))) .register(); - public static ItemEntry COVER_INFINITE_WATER = REGISTRATE.item("infinite_water_cover", ComponentItem::create) + public static ItemEntry COVER_INFINITE_WATER = REGISTRATE + .item("infinite_water_cover", ComponentItem::create) .lang("Infinite Water Cover") .onRegister(compassNode(GTCompassSections.COVERS, GTCompassNodes.COVER)) .onRegister(attach(new TooltipBehavior(lines -> { lines.add(Component.translatable("gtceu.universal.tooltip.produces_fluid", 16_000 / 20)); }), new CoverPlaceBehavior(GTCovers.INFINITE_WATER))).register(); - public static ItemEntry COVER_ENDER_FLUID_LINK = REGISTRATE.item("ender_fluid_link_cover", ComponentItem::create) + public static ItemEntry COVER_ENDER_FLUID_LINK = REGISTRATE + .item("ender_fluid_link_cover", ComponentItem::create) .lang("Ender Fluid Link") .onRegister(compassNode(GTCompassSections.COVERS, GTCompassNodes.COVER)) .register(); - public static ItemEntry COVER_DIGITAL_INTERFACE = REGISTRATE.item("digital_interface_cover", ComponentItem::create) + public static ItemEntry COVER_DIGITAL_INTERFACE = REGISTRATE + .item("digital_interface_cover", ComponentItem::create) .lang("Digital Interface") .register(); - public static ItemEntry COVER_DIGITAL_INTERFACE_WIRELESS = REGISTRATE.item("wireless_digital_interface_cover", ComponentItem::create) + public static ItemEntry COVER_DIGITAL_INTERFACE_WIRELESS = REGISTRATE + .item("wireless_digital_interface_cover", ComponentItem::create) .lang("Wireless Digital Interface") .register(); - public static ItemEntry COVER_FLUID_VOIDING = REGISTRATE.item("fluid_voiding_cover", ComponentItem::create) + public static ItemEntry COVER_FLUID_VOIDING = REGISTRATE + .item("fluid_voiding_cover", ComponentItem::create) .lang("Fluid Voiding Cover") .onRegister(attach(new CoverPlaceBehavior(GTCovers.FLUID_VOIDING))) .onRegister(compassNode(GTCompassSections.COVERS, GTCompassNodes.COVER)) .register(); - public static ItemEntry COVER_FLUID_VOIDING_ADVANCED = REGISTRATE.item("advanced_fluid_voiding_cover", ComponentItem::create) + public static ItemEntry COVER_FLUID_VOIDING_ADVANCED = REGISTRATE + .item("advanced_fluid_voiding_cover", ComponentItem::create) .lang("Advanced Fluid Voiding Cover") .onRegister(attach(new CoverPlaceBehavior(GTCovers.FLUID_VOIDING_ADVANCED))) .onRegister(compassNode(GTCompassSections.COVERS, GTCompassNodes.COVER)) .register(); - public static ItemEntry COVER_ITEM_VOIDING = REGISTRATE.item("item_voiding_cover", ComponentItem::create) + public static ItemEntry COVER_ITEM_VOIDING = REGISTRATE + .item("item_voiding_cover", ComponentItem::create) .lang("Item Voiding Cover") .onRegister(attach(new CoverPlaceBehavior(GTCovers.ITEM_VOIDING))) .onRegister(compassNode(GTCompassSections.COVERS, GTCompassNodes.COVER)) .register(); - public static ItemEntry COVER_ITEM_VOIDING_ADVANCED = REGISTRATE.item("advanced_item_voiding_cover", ComponentItem::create) + public static ItemEntry COVER_ITEM_VOIDING_ADVANCED = REGISTRATE + .item("advanced_item_voiding_cover", ComponentItem::create) .lang("Advanced Item Voiding Cover") .onRegister(attach(new CoverPlaceBehavior(GTCovers.ITEM_VOIDING_ADVANCED))) .onRegister(compassNode(GTCompassSections.COVERS, GTCompassNodes.COVER)) @@ -1478,46 +2090,83 @@ public Component getItemName(ItemStack stack) { .register(); // Solar Panels: ID 331-346 - public static ItemEntry COVER_SOLAR_PANEL = REGISTRATE.item("solar_panel", ComponentItem::create).lang("Solar Panel").onRegister(attach(new TooltipBehavior(lines -> { - lines.addAll(LangHandler.getMultiLang("metaitem.cover.solar.panel.tooltip")); - lines.add(Component.translatable("gtceu.universal.tooltip.voltage_out", 1, GTValues.VNF[GTValues.ULV])); - }))).onRegister(compassNode(GTCompassSections.COVERS, GTCompassNodes.COVER)).register(); - public static ItemEntry COVER_SOLAR_PANEL_ULV = REGISTRATE.item("ulv_solar_panel", ComponentItem::create).lang("Ultra Low Voltage Solar Panel").onRegister(attach(new TooltipBehavior(lines -> { - lines.addAll(LangHandler.getMultiLang("metaitem.cover.solar.panel.tooltip")); - lines.add(Component.translatable("gtceu.universal.tooltip.voltage_out", GTValues.V[GTValues.ULV], GTValues.VNF[GTValues.ULV])); - }))).onRegister(attach(new CoverPlaceBehavior(GTCovers.SOLAR_PANEL[0]))).onRegister(compassNodeExist(GTCompassSections.COVERS, "solar_panel", GTCompassNodes.COVER)).register(); - public static ItemEntry COVER_SOLAR_PANEL_LV = REGISTRATE.item("lv_solar_panel", ComponentItem::create).lang("Low Voltage Solar Panel").onRegister(attach(new TooltipBehavior(lines -> { - lines.addAll(LangHandler.getMultiLang("metaitem.cover.solar.panel.tooltip")); - lines.add(Component.translatable("gtceu.universal.tooltip.voltage_out", GTValues.V[GTValues.LV], GTValues.VNF[GTValues.LV])); - }))).onRegister(attach(new CoverPlaceBehavior(GTCovers.SOLAR_PANEL[1]))).onRegister(compassNodeExist(GTCompassSections.COVERS, "solar_panel", GTCompassNodes.COVER)).register(); - public static ItemEntry COVER_SOLAR_PANEL_MV = REGISTRATE.item("mv_solar_panel", ComponentItem::create).lang("Medium Voltage Solar Panel").onRegister(attach(new TooltipBehavior(lines -> { - lines.addAll(LangHandler.getMultiLang("metaitem.cover.solar.panel.tooltip")); - lines.add(Component.translatable("gtceu.universal.tooltip.voltage_out", GTValues.V[GTValues.MV], GTValues.VNF[GTValues.MV])); - }))).onRegister(attach(new CoverPlaceBehavior(GTCovers.SOLAR_PANEL[2]))).onRegister(compassNodeExist(GTCompassSections.COVERS, "solar_panel", GTCompassNodes.COVER)).register(); - public static ItemEntry COVER_SOLAR_PANEL_HV = REGISTRATE.item("hv_solar_panel", ComponentItem::create).lang("High Voltage Solar Panel").onRegister(attach(new TooltipBehavior(lines -> { - lines.addAll(LangHandler.getMultiLang("metaitem.cover.solar.panel.tooltip")); - lines.add(Component.translatable("gtceu.universal.tooltip.voltage_out", GTValues.V[GTValues.HV], GTValues.VNF[GTValues.HV])); - }))).onRegister(attach(new CoverPlaceBehavior(GTCovers.SOLAR_PANEL[3]))).onRegister(compassNodeExist(GTCompassSections.COVERS, "solar_panel", GTCompassNodes.COVER)).register(); - public static ItemEntry COVER_SOLAR_PANEL_EV = REGISTRATE.item("ev_solar_panel", ComponentItem::create).lang("Extreme Voltage Solar Panel").onRegister(attach(new TooltipBehavior(lines -> { - lines.addAll(LangHandler.getMultiLang("metaitem.cover.solar.panel.tooltip")); - lines.add(Component.translatable("gtceu.universal.tooltip.voltage_out", GTValues.V[GTValues.EV], GTValues.VNF[GTValues.EV])); - }))).onRegister(attach(new CoverPlaceBehavior(GTCovers.SOLAR_PANEL[4]))).onRegister(compassNodeExist(GTCompassSections.COVERS, "solar_panel", GTCompassNodes.COVER)).register(); - public static ItemEntry COVER_SOLAR_PANEL_IV = REGISTRATE.item("iv_solar_panel", ComponentItem::create).lang("Insane Voltage Solar Panel").onRegister(attach(new TooltipBehavior(lines -> { - lines.addAll(LangHandler.getMultiLang("metaitem.cover.solar.panel.tooltip")); - lines.add(Component.translatable("gtceu.universal.tooltip.voltage_out", GTValues.V[GTValues.IV], GTValues.VNF[GTValues.IV])); - }))).onRegister(attach(new CoverPlaceBehavior(GTCovers.SOLAR_PANEL[5]))).onRegister(compassNodeExist(GTCompassSections.COVERS, "solar_panel", GTCompassNodes.COVER)).register(); - public static ItemEntry COVER_SOLAR_PANEL_LUV = REGISTRATE.item("luv_solar_panel", ComponentItem::create).lang("Ludicrous Voltage Solar Panel").onRegister(attach(new TooltipBehavior(lines -> { - lines.addAll(LangHandler.getMultiLang("metaitem.cover.solar.panel.tooltip")); - lines.add(Component.translatable("gtceu.universal.tooltip.voltage_out", GTValues.V[GTValues.LuV], GTValues.VNF[GTValues.LuV])); - }))).onRegister(attach(new CoverPlaceBehavior(GTCovers.SOLAR_PANEL[6]))).onRegister(compassNodeExist(GTCompassSections.COVERS, "solar_panel", GTCompassNodes.COVER)).register(); - public static ItemEntry COVER_SOLAR_PANEL_ZPM = REGISTRATE.item("zpm_solar_panel", ComponentItem::create).lang("Zero Point Module Solar Panel").onRegister(attach(new TooltipBehavior(lines -> { - lines.addAll(LangHandler.getMultiLang("metaitem.cover.solar.panel.tooltip")); - lines.add(Component.translatable("gtceu.universal.tooltip.voltage_out", GTValues.V[GTValues.ZPM], GTValues.VNF[GTValues.ZPM])); - }))).onRegister(attach(new CoverPlaceBehavior(GTCovers.SOLAR_PANEL[7]))).onRegister(compassNodeExist(GTCompassSections.COVERS, "solar_panel", GTCompassNodes.COVER)).register(); - public static ItemEntry COVER_SOLAR_PANEL_UV = REGISTRATE.item("uv_solar_panel", ComponentItem::create).lang("Ultimate Voltage Solar Panel").onRegister(attach(new TooltipBehavior(lines -> { - lines.addAll(LangHandler.getMultiLang("metaitem.cover.solar.panel.tooltip")); - lines.add(Component.translatable("gtceu.universal.tooltip.voltage_out", GTValues.V[GTValues.UV], GTValues.VNF[GTValues.UV])); - }))).onRegister(attach(new CoverPlaceBehavior(GTCovers.SOLAR_PANEL[8]))).onRegister(compassNodeExist(GTCompassSections.COVERS, "solar_panel", GTCompassNodes.COVER)).register(); + public static ItemEntry COVER_SOLAR_PANEL = REGISTRATE.item("solar_panel", ComponentItem::create) + .lang("Solar Panel").onRegister(attach(new TooltipBehavior(lines -> { + lines.addAll(LangHandler.getMultiLang("metaitem.cover.solar.panel.tooltip")); + lines.add(Component.translatable("gtceu.universal.tooltip.voltage_out", 1, GTValues.VNF[GTValues.ULV])); + }))).onRegister(compassNode(GTCompassSections.COVERS, GTCompassNodes.COVER)).register(); + public static ItemEntry COVER_SOLAR_PANEL_ULV = REGISTRATE + .item("ulv_solar_panel", ComponentItem::create).lang("Ultra Low Voltage Solar Panel") + .onRegister(attach(new TooltipBehavior(lines -> { + lines.addAll(LangHandler.getMultiLang("metaitem.cover.solar.panel.tooltip")); + lines.add(Component.translatable("gtceu.universal.tooltip.voltage_out", GTValues.V[GTValues.ULV], + GTValues.VNF[GTValues.ULV])); + }))).onRegister(attach(new CoverPlaceBehavior(GTCovers.SOLAR_PANEL[0]))) + .onRegister(compassNodeExist(GTCompassSections.COVERS, "solar_panel", GTCompassNodes.COVER)).register(); + public static ItemEntry COVER_SOLAR_PANEL_LV = REGISTRATE + .item("lv_solar_panel", ComponentItem::create).lang("Low Voltage Solar Panel") + .onRegister(attach(new TooltipBehavior(lines -> { + lines.addAll(LangHandler.getMultiLang("metaitem.cover.solar.panel.tooltip")); + lines.add(Component.translatable("gtceu.universal.tooltip.voltage_out", GTValues.V[GTValues.LV], + GTValues.VNF[GTValues.LV])); + }))).onRegister(attach(new CoverPlaceBehavior(GTCovers.SOLAR_PANEL[1]))) + .onRegister(compassNodeExist(GTCompassSections.COVERS, "solar_panel", GTCompassNodes.COVER)).register(); + public static ItemEntry COVER_SOLAR_PANEL_MV = REGISTRATE + .item("mv_solar_panel", ComponentItem::create).lang("Medium Voltage Solar Panel") + .onRegister(attach(new TooltipBehavior(lines -> { + lines.addAll(LangHandler.getMultiLang("metaitem.cover.solar.panel.tooltip")); + lines.add(Component.translatable("gtceu.universal.tooltip.voltage_out", GTValues.V[GTValues.MV], + GTValues.VNF[GTValues.MV])); + }))).onRegister(attach(new CoverPlaceBehavior(GTCovers.SOLAR_PANEL[2]))) + .onRegister(compassNodeExist(GTCompassSections.COVERS, "solar_panel", GTCompassNodes.COVER)).register(); + public static ItemEntry COVER_SOLAR_PANEL_HV = REGISTRATE + .item("hv_solar_panel", ComponentItem::create).lang("High Voltage Solar Panel") + .onRegister(attach(new TooltipBehavior(lines -> { + lines.addAll(LangHandler.getMultiLang("metaitem.cover.solar.panel.tooltip")); + lines.add(Component.translatable("gtceu.universal.tooltip.voltage_out", GTValues.V[GTValues.HV], + GTValues.VNF[GTValues.HV])); + }))).onRegister(attach(new CoverPlaceBehavior(GTCovers.SOLAR_PANEL[3]))) + .onRegister(compassNodeExist(GTCompassSections.COVERS, "solar_panel", GTCompassNodes.COVER)).register(); + public static ItemEntry COVER_SOLAR_PANEL_EV = REGISTRATE + .item("ev_solar_panel", ComponentItem::create).lang("Extreme Voltage Solar Panel") + .onRegister(attach(new TooltipBehavior(lines -> { + lines.addAll(LangHandler.getMultiLang("metaitem.cover.solar.panel.tooltip")); + lines.add(Component.translatable("gtceu.universal.tooltip.voltage_out", GTValues.V[GTValues.EV], + GTValues.VNF[GTValues.EV])); + }))).onRegister(attach(new CoverPlaceBehavior(GTCovers.SOLAR_PANEL[4]))) + .onRegister(compassNodeExist(GTCompassSections.COVERS, "solar_panel", GTCompassNodes.COVER)).register(); + public static ItemEntry COVER_SOLAR_PANEL_IV = REGISTRATE + .item("iv_solar_panel", ComponentItem::create).lang("Insane Voltage Solar Panel") + .onRegister(attach(new TooltipBehavior(lines -> { + lines.addAll(LangHandler.getMultiLang("metaitem.cover.solar.panel.tooltip")); + lines.add(Component.translatable("gtceu.universal.tooltip.voltage_out", GTValues.V[GTValues.IV], + GTValues.VNF[GTValues.IV])); + }))).onRegister(attach(new CoverPlaceBehavior(GTCovers.SOLAR_PANEL[5]))) + .onRegister(compassNodeExist(GTCompassSections.COVERS, "solar_panel", GTCompassNodes.COVER)).register(); + public static ItemEntry COVER_SOLAR_PANEL_LUV = REGISTRATE + .item("luv_solar_panel", ComponentItem::create).lang("Ludicrous Voltage Solar Panel") + .onRegister(attach(new TooltipBehavior(lines -> { + lines.addAll(LangHandler.getMultiLang("metaitem.cover.solar.panel.tooltip")); + lines.add(Component.translatable("gtceu.universal.tooltip.voltage_out", GTValues.V[GTValues.LuV], + GTValues.VNF[GTValues.LuV])); + }))).onRegister(attach(new CoverPlaceBehavior(GTCovers.SOLAR_PANEL[6]))) + .onRegister(compassNodeExist(GTCompassSections.COVERS, "solar_panel", GTCompassNodes.COVER)).register(); + public static ItemEntry COVER_SOLAR_PANEL_ZPM = REGISTRATE + .item("zpm_solar_panel", ComponentItem::create).lang("Zero Point Module Solar Panel") + .onRegister(attach(new TooltipBehavior(lines -> { + lines.addAll(LangHandler.getMultiLang("metaitem.cover.solar.panel.tooltip")); + lines.add(Component.translatable("gtceu.universal.tooltip.voltage_out", GTValues.V[GTValues.ZPM], + GTValues.VNF[GTValues.ZPM])); + }))).onRegister(attach(new CoverPlaceBehavior(GTCovers.SOLAR_PANEL[7]))) + .onRegister(compassNodeExist(GTCompassSections.COVERS, "solar_panel", GTCompassNodes.COVER)).register(); + public static ItemEntry COVER_SOLAR_PANEL_UV = REGISTRATE + .item("uv_solar_panel", ComponentItem::create).lang("Ultimate Voltage Solar Panel") + .onRegister(attach(new TooltipBehavior(lines -> { + lines.addAll(LangHandler.getMultiLang("metaitem.cover.solar.panel.tooltip")); + lines.add(Component.translatable("gtceu.universal.tooltip.voltage_out", GTValues.V[GTValues.UV], + GTValues.VNF[GTValues.UV])); + }))).onRegister(attach(new CoverPlaceBehavior(GTCovers.SOLAR_PANEL[8]))) + .onRegister(compassNodeExist(GTCompassSections.COVERS, "solar_panel", GTCompassNodes.COVER)).register(); // Plugin public static ItemEntry PLUGIN_TEXT; @@ -1525,92 +2174,121 @@ public Component getItemName(ItemStack stack) { public static ItemEntry PLUGIN_FAKE_GUI; public static ItemEntry PLUGIN_ADVANCED_MONITOR; - public static ItemEntry INTEGRATED_CIRCUIT = REGISTRATE.item("programmed_circuit", ComponentItem::create) + public static ItemEntry INTEGRATED_CIRCUIT = REGISTRATE + .item("programmed_circuit", ComponentItem::create) .lang("Programmed Circuit") .model(overrideModel(GTCEu.id("circuit"), 33)) - .onRegister(modelPredicate(GTCEu.id("circuit"), (itemStack) -> IntCircuitBehaviour.getCircuitConfiguration(itemStack) / 100f)) + .onRegister(modelPredicate(GTCEu.id("circuit"), + (itemStack) -> IntCircuitBehaviour.getCircuitConfiguration(itemStack) / 100f)) .onRegister(attach(new IntCircuitBehaviour())) .onRegister(compassNode(GTCompassSections.MISC)) .register(); - - // public static ItemEntry FOAM_SPRAYER = REGISTRATE.item("foam_sprayer", ComponentItem::create).onRegister(attach(new FoamSprayerBehavior()).setMaxStackSize(1); - public static ItemEntry GELLED_TOLUENE = REGISTRATE.item("gelled_toluene", Item::new).onRegister(compassNode(GTCompassSections.MISC)).register(); + // public static ItemEntry FOAM_SPRAYER = REGISTRATE.item("foam_sprayer", + // ComponentItem::create).onRegister(attach(new FoamSprayerBehavior()).setMaxStackSize(1); + public static ItemEntry GELLED_TOLUENE = REGISTRATE.item("gelled_toluene", Item::new) + .onRegister(compassNode(GTCompassSections.MISC)).register(); public static ItemEntry BOTTLE_PURPLE_DRINK = REGISTRATE.item("purple_drink", Item::new) .lang("Purple Drink") .properties(p -> p.food(GTFoods.DRINK)) .onRegister(compassNode(GTCompassSections.MISC)) .register(); - public static ItemEntry PLANT_BALL = REGISTRATE.item("plant_ball", ComponentItem::create).onRegister(compassNode(GTCompassSections.MISC)).onRegister(burnTime(75)).register(); - public static ItemEntry STICKY_RESIN = REGISTRATE.item("sticky_resin", ComponentItem::create).lang("Sticky Resin").onRegister(compassNode(GTCompassSections.MISC)).onRegister(burnTime(200)).register(); - public static ItemEntry BIO_CHAFF = REGISTRATE.item("bio_chaff", ComponentItem::create).onRegister(compassNode(GTCompassSections.MISC)).onRegister(burnTime(200)).register(); - public static ItemEntry ENERGIUM_DUST = REGISTRATE.item("energium_dust", Item::new).onRegister(compassNode(GTCompassSections.MISC)).register(); + public static ItemEntry PLANT_BALL = REGISTRATE.item("plant_ball", ComponentItem::create) + .onRegister(compassNode(GTCompassSections.MISC)).onRegister(burnTime(75)).register(); + public static ItemEntry STICKY_RESIN = REGISTRATE.item("sticky_resin", ComponentItem::create) + .lang("Sticky Resin").onRegister(compassNode(GTCompassSections.MISC)).onRegister(burnTime(200)).register(); + public static ItemEntry BIO_CHAFF = REGISTRATE.item("bio_chaff", ComponentItem::create) + .onRegister(compassNode(GTCompassSections.MISC)).onRegister(burnTime(200)).register(); + public static ItemEntry ENERGIUM_DUST = REGISTRATE.item("energium_dust", Item::new) + .onRegister(compassNode(GTCompassSections.MISC)).register(); public static ItemEntry POWER_UNIT_LV = REGISTRATE.item("lv_power_unit", ComponentItem::create) - .lang("LV Power Unit") - .properties(p -> p.stacksTo(8)) - .model((ctx, prov) -> prov.generated(ctx, prov.modLoc("item/tools/power_unit_lv"))) - .onRegister(attach(ElectricStats.createElectricItem(100000L, GTValues.LV))) - .register(); + .lang("LV Power Unit") + .properties(p -> p.stacksTo(8)) + .model((ctx, prov) -> prov.generated(ctx, prov.modLoc("item/tools/power_unit_lv"))) + .onRegister(attach(ElectricStats.createElectricItem(100000L, GTValues.LV))) + .register(); public static ItemEntry POWER_UNIT_MV = REGISTRATE.item("mv_power_unit", ComponentItem::create) - .lang("MV Power Unit") - .properties(p -> p.stacksTo(8)) - .model((ctx, prov) -> prov.generated(ctx, prov.modLoc("item/tools/power_unit_mv"))) - .onRegister(attach(ElectricStats.createElectricItem(400000L, GTValues.MV))) - .register(); + .lang("MV Power Unit") + .properties(p -> p.stacksTo(8)) + .model((ctx, prov) -> prov.generated(ctx, prov.modLoc("item/tools/power_unit_mv"))) + .onRegister(attach(ElectricStats.createElectricItem(400000L, GTValues.MV))) + .register(); public static ItemEntry POWER_UNIT_HV = REGISTRATE.item("hv_power_unit", ComponentItem::create) - .lang("HV Power Unit") - .properties(p -> p.stacksTo(8)) - .model((ctx, prov) -> prov.generated(ctx, prov.modLoc("item/tools/power_unit_hv"))) - .onRegister(attach(ElectricStats.createElectricItem(1600000L, GTValues.HV))) - .register(); + .lang("HV Power Unit") + .properties(p -> p.stacksTo(8)) + .model((ctx, prov) -> prov.generated(ctx, prov.modLoc("item/tools/power_unit_hv"))) + .onRegister(attach(ElectricStats.createElectricItem(1600000L, GTValues.HV))) + .register(); public static ItemEntry POWER_UNIT_EV = REGISTRATE.item("ev_power_unit", ComponentItem::create) - .lang("EV Power Unit") - .properties(p -> p.stacksTo(8)) - .model((ctx, prov) -> prov.generated(ctx, prov.modLoc("item/tools/power_unit_ev"))) - .onRegister(attach(ElectricStats.createElectricItem(6400000L, GTValues.EV))) - .register(); + .lang("EV Power Unit") + .properties(p -> p.stacksTo(8)) + .model((ctx, prov) -> prov.generated(ctx, prov.modLoc("item/tools/power_unit_ev"))) + .onRegister(attach(ElectricStats.createElectricItem(6400000L, GTValues.EV))) + .register(); public static ItemEntry POWER_UNIT_IV = REGISTRATE.item("iv_power_unit", ComponentItem::create) - .lang("IV Power Unit") - .properties(p -> p.stacksTo(8)) - .model((ctx, prov) -> prov.generated(ctx, prov.modLoc("item/tools/power_unit_iv"))) - .onRegister(attach(ElectricStats.createElectricItem(25600000L, GTValues.IV))) - .register(); - - public static ItemEntry MASK_FILTER = REGISTRATE.item("mask_filter", ComponentItem::create) - .lang("Gas Mask Filter") - .properties(p -> p.stacksTo(1)) - .register(); + .lang("IV Power Unit") + .properties(p -> p.stacksTo(8)) + .model((ctx, prov) -> prov.generated(ctx, prov.modLoc("item/tools/power_unit_iv"))) + .onRegister(attach(ElectricStats.createElectricItem(25600000L, GTValues.IV))) + .register(); + public static ItemEntry MASK_FILTER = REGISTRATE.item("mask_filter", Item::new) + .lang("Gas Mask Filter") + .properties(p -> p.stacksTo(1)) + .register(); + public static ItemEntry PARACETAMOL_PILL = REGISTRATE.item("paracetamol_pill", ComponentItem::create) + .lang("Paracetamol Pill") + .properties(p -> p.food(GTFoods.ANTIDOTE)) + .onRegister(attach(new AntidoteBehavior(15, + HazardProperty.HazardType.CONTACT_POISON, + HazardProperty.HazardType.INHALATION_POISON, + HazardProperty.HazardType.CORROSIVE))) + .register(); + public static ItemEntry RAD_AWAY_PILL = REGISTRATE.item("rad_away_pill", ComponentItem::create) + .lang("RadAway™ Pill") + .properties(p -> p.food(GTFoods.ANTIDOTE)) + .onRegister(attach(new AntidoteBehavior(75, HazardProperty.HazardType.RADIOACTIVE))) + .register(); public static ItemEntry NANO_SABER; public static ItemEntry PROSPECTOR_LV = REGISTRATE.item("prospector.lv", ComponentItem::create) .lang("Ore Prospector (LV)") .properties(p -> p.stacksTo(1)) .onRegister(compassNodeExist(GTCompassSections.ITEMS, "prospector")) - .onRegister(attach(ElectricStats.createElectricItem(100_000L, GTValues.LV), new ProspectorScannerBehavior(2, GTValues.V[GTValues.LV] / 16L, ProspectorMode.ORE))).register(); + .onRegister(attach(ElectricStats.createElectricItem(100_000L, GTValues.LV), + new ProspectorScannerBehavior(2, GTValues.V[GTValues.LV] / 16L, ProspectorMode.ORE))) + .register(); public static ItemEntry PROSPECTOR_HV = REGISTRATE.item("prospector.hv", ComponentItem::create) .lang("Advanced Prospector (HV)") .properties(p -> p.stacksTo(1)) .onRegister(compassNodeExist(GTCompassSections.ITEMS, "prospector")) - .onRegister(attach(ElectricStats.createElectricItem(1_600_000L, GTValues.HV), new ProspectorScannerBehavior(3, GTValues.V[GTValues.HV] / 16L, ProspectorMode.ORE, ProspectorMode.FLUID, ConfigHolder.INSTANCE.machines.doBedrockOres ? ProspectorMode.BEDROCK_ORE : null))).register(); + .onRegister(attach(ElectricStats.createElectricItem(1_600_000L, GTValues.HV), + new ProspectorScannerBehavior(3, GTValues.V[GTValues.HV] / 16L, ProspectorMode.ORE, + ProspectorMode.FLUID, + ConfigHolder.INSTANCE.machines.doBedrockOres ? ProspectorMode.BEDROCK_ORE : null))) + .register(); public static ItemEntry PROSPECTOR_LUV = REGISTRATE.item("prospector.luv", ComponentItem::create) .lang("Super Prospector (LuV)") .properties(p -> p.stacksTo(1)) .onRegister(compassNodeExist(GTCompassSections.ITEMS, "prospector")) - .onRegister(attach(ElectricStats.createElectricItem(1_000_000_000L, GTValues.LuV), new ProspectorScannerBehavior(5, GTValues.V[GTValues.LuV] / 16L, ProspectorMode.ORE, ProspectorMode.FLUID, ConfigHolder.INSTANCE.machines.doBedrockOres ? ProspectorMode.BEDROCK_ORE : null))).register(); + .onRegister(attach(ElectricStats.createElectricItem(1_000_000_000L, GTValues.LuV), + new ProspectorScannerBehavior(5, GTValues.V[GTValues.LuV] / 16L, ProspectorMode.ORE, + ProspectorMode.FLUID, + ConfigHolder.INSTANCE.machines.doBedrockOres ? ProspectorMode.BEDROCK_ORE : null))) + .register(); public static ItemEntry ITEM_MAGNET_LV = REGISTRATE.item("lv_item_magnet", ComponentItem::create) - .lang("LV Item Magnet") - .properties(p -> p.stacksTo(1)) - .onRegister(attach(ElectricStats.createElectricItem(100_000L, GTValues.LV), new ItemMagnetBehavior(8))) - .register(); + .lang("LV Item Magnet") + .properties(p -> p.stacksTo(1)) + .onRegister(attach(ElectricStats.createElectricItem(100_000L, GTValues.LV), new ItemMagnetBehavior(8))) + .register(); public static ItemEntry ITEM_MAGNET_HV = REGISTRATE.item("hv_item_magnet", ComponentItem::create) - .lang("HV Item Magnet") - .properties(p -> p.stacksTo(1)) - .onRegister(attach(ElectricStats.createElectricItem(1_600_000L, GTValues.HV), new ItemMagnetBehavior(32))) - .register(); + .lang("HV Item Magnet") + .properties(p -> p.stacksTo(1)) + .onRegister(attach(ElectricStats.createElectricItem(1_600_000L, GTValues.HV), new ItemMagnetBehavior(32))) + .register(); public static ItemEntry WIRELESS; public static ItemEntry CAMERA; @@ -1653,165 +2331,283 @@ public Component getItemName(ItemStack stack) { .onRegister(compassNode(GTCompassSections.MISC)) .onRegister(attach(new TurbineRotorBehaviour())).register(); - public static ItemEntry NEURO_PROCESSOR = REGISTRATE.item("neuro_processing_unit", Item::new).lang("Neuro Processing Unit").onRegister(compassNode(GTCompassSections.MISC)).register(); - public static ItemEntry STEM_CELLS = REGISTRATE.item("stem_cells", Item::new).onRegister(compassNode(GTCompassSections.MISC)).register(); - public static ItemEntry PETRI_DISH = REGISTRATE.item("petri_dish", Item::new).onRegister(compassNode(GTCompassSections.MISC)).register(); + public static ItemEntry NEURO_PROCESSOR = REGISTRATE.item("neuro_processing_unit", Item::new) + .lang("Neuro Processing Unit").onRegister(compassNode(GTCompassSections.MISC)).register(); + public static ItemEntry STEM_CELLS = REGISTRATE.item("stem_cells", Item::new) + .onRegister(compassNode(GTCompassSections.MISC)).register(); + public static ItemEntry PETRI_DISH = REGISTRATE.item("petri_dish", Item::new) + .onRegister(compassNode(GTCompassSections.MISC)).register(); - public static ItemEntry VOLTAGE_COIL_ULV = REGISTRATE.item("ulv_voltage_coil", ComponentItem::create).lang("Ultra Low Voltage Coil").onRegister(compassNodeExist(GTCompassSections.MISC, "coil")).onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Lead, GTValues.M * 2), new MaterialStack(GTMaterials.IronMagnetic, GTValues.M / 2)))).register(); - public static ItemEntry VOLTAGE_COIL_LV = REGISTRATE.item("lv_voltage_coil", ComponentItem::create).lang("Low Voltage Coil").onRegister(compassNodeExist(GTCompassSections.MISC, "coil")).onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 2), new MaterialStack(GTMaterials.IronMagnetic, GTValues.M / 2)))).register(); - public static ItemEntry VOLTAGE_COIL_MV = REGISTRATE.item("mv_voltage_coil", ComponentItem::create).lang("Medium Voltage Coil").onRegister(compassNodeExist(GTCompassSections.MISC, "coil")).onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Aluminium, GTValues.M * 2), new MaterialStack(GTMaterials.SteelMagnetic, GTValues.M / 2)))).register(); - public static ItemEntry VOLTAGE_COIL_HV = REGISTRATE.item("hv_voltage_coil", ComponentItem::create).lang("High Voltage Coil").onRegister(compassNodeExist(GTCompassSections.MISC, "coil")).onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.BlackSteel, GTValues.M * 2), new MaterialStack(GTMaterials.SteelMagnetic, GTValues.M / 2)))).register(); - public static ItemEntry VOLTAGE_COIL_EV = REGISTRATE.item("ev_voltage_coil", ComponentItem::create).lang("Extreme Voltage Coil").onRegister(compassNodeExist(GTCompassSections.MISC, "coil")).onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.TungstenSteel, GTValues.M * 2), new MaterialStack(GTMaterials.NeodymiumMagnetic, GTValues.M / 2)))).register(); - public static ItemEntry VOLTAGE_COIL_IV = REGISTRATE.item("iv_voltage_coil", ComponentItem::create).lang("Insane Voltage Coil").onRegister(compassNodeExist(GTCompassSections.MISC, "coil")).onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Iridium, GTValues.M * 2), new MaterialStack(GTMaterials.NeodymiumMagnetic, GTValues.M / 2)))).register(); - public static ItemEntry VOLTAGE_COIL_LuV = REGISTRATE.item("luv_voltage_coil", ComponentItem::create).lang("Ludicrous Voltage Coil").onRegister(compassNodeExist(GTCompassSections.MISC, "coil")).onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Osmiridium, GTValues.M * 2), new MaterialStack(GTMaterials.SamariumMagnetic, GTValues.M / 2)))).register(); - public static ItemEntry VOLTAGE_COIL_ZPM = REGISTRATE.item("zpm_voltage_coil", ComponentItem::create).lang("Zero Point Module Voltage Coil").onRegister(compassNodeExist(GTCompassSections.MISC, "coil")).onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Europium, GTValues.M * 2), new MaterialStack(GTMaterials.SamariumMagnetic, GTValues.M / 2)))).register(); - public static ItemEntry VOLTAGE_COIL_UV = REGISTRATE.item("uv_voltage_coil", ComponentItem::create).lang("Ultimate Voltage Coil").onRegister(compassNodeExist(GTCompassSections.MISC, "coil")).onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Tritanium, GTValues.M * 2), new MaterialStack(GTMaterials.SamariumMagnetic, GTValues.M / 2)))).register(); + public static ItemEntry VOLTAGE_COIL_ULV = REGISTRATE.item("ulv_voltage_coil", ComponentItem::create) + .lang("Ultra Low Voltage Coil").onRegister(compassNodeExist(GTCompassSections.MISC, "coil")) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Lead, GTValues.M * 2), + new MaterialStack(GTMaterials.IronMagnetic, GTValues.M / 2)))) + .register(); + public static ItemEntry VOLTAGE_COIL_LV = REGISTRATE.item("lv_voltage_coil", ComponentItem::create) + .lang("Low Voltage Coil").onRegister(compassNodeExist(GTCompassSections.MISC, "coil")) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Steel, GTValues.M * 2), + new MaterialStack(GTMaterials.IronMagnetic, GTValues.M / 2)))) + .register(); + public static ItemEntry VOLTAGE_COIL_MV = REGISTRATE.item("mv_voltage_coil", ComponentItem::create) + .lang("Medium Voltage Coil").onRegister(compassNodeExist(GTCompassSections.MISC, "coil")) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Aluminium, GTValues.M * 2), + new MaterialStack(GTMaterials.SteelMagnetic, GTValues.M / 2)))) + .register(); + public static ItemEntry VOLTAGE_COIL_HV = REGISTRATE.item("hv_voltage_coil", ComponentItem::create) + .lang("High Voltage Coil").onRegister(compassNodeExist(GTCompassSections.MISC, "coil")) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.BlackSteel, GTValues.M * 2), + new MaterialStack(GTMaterials.SteelMagnetic, GTValues.M / 2)))) + .register(); + public static ItemEntry VOLTAGE_COIL_EV = REGISTRATE.item("ev_voltage_coil", ComponentItem::create) + .lang("Extreme Voltage Coil").onRegister(compassNodeExist(GTCompassSections.MISC, "coil")) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.TungstenSteel, GTValues.M * 2), + new MaterialStack(GTMaterials.NeodymiumMagnetic, GTValues.M / 2)))) + .register(); + public static ItemEntry VOLTAGE_COIL_IV = REGISTRATE.item("iv_voltage_coil", ComponentItem::create) + .lang("Insane Voltage Coil").onRegister(compassNodeExist(GTCompassSections.MISC, "coil")) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Iridium, GTValues.M * 2), + new MaterialStack(GTMaterials.NeodymiumMagnetic, GTValues.M / 2)))) + .register(); + public static ItemEntry VOLTAGE_COIL_LuV = REGISTRATE.item("luv_voltage_coil", ComponentItem::create) + .lang("Ludicrous Voltage Coil").onRegister(compassNodeExist(GTCompassSections.MISC, "coil")) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Osmiridium, GTValues.M * 2), + new MaterialStack(GTMaterials.SamariumMagnetic, GTValues.M / 2)))) + .register(); + public static ItemEntry VOLTAGE_COIL_ZPM = REGISTRATE.item("zpm_voltage_coil", ComponentItem::create) + .lang("Zero Point Module Voltage Coil").onRegister(compassNodeExist(GTCompassSections.MISC, "coil")) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Europium, GTValues.M * 2), + new MaterialStack(GTMaterials.SamariumMagnetic, GTValues.M / 2)))) + .register(); + public static ItemEntry VOLTAGE_COIL_UV = REGISTRATE.item("uv_voltage_coil", ComponentItem::create) + .lang("Ultimate Voltage Coil").onRegister(compassNodeExist(GTCompassSections.MISC, "coil")) + .onRegister(materialInfo(new ItemMaterialInfo(new MaterialStack(GTMaterials.Tritanium, GTValues.M * 2), + new MaterialStack(GTMaterials.SamariumMagnetic, GTValues.M / 2)))) + .register(); public static ItemEntry CLIPBOARD; - public static ItemEntry NIGHTVISION_GOGGLES = REGISTRATE.item("nightvision_goggles", (p) -> new ArmorComponentItem(GTArmorMaterials.GOGGLES, ArmorItem.Type.HELMET, p) - .setArmorLogic(new NightvisionGoggles(2, - 80_000L * (long) Math.max(1, Math.pow(1, ConfigHolder.INSTANCE.tools.voltageTierNightVision - 1)), - ConfigHolder.INSTANCE.tools.voltageTierNightVision, ArmorItem.Type.HELMET))) - .lang("Nightvision Goggles") - .register(); - - public static ItemEntry NANO_CHESTPLATE = REGISTRATE.item("nanomuscle_chestplate", (p) -> new ArmorComponentItem(GTArmorMaterials.ARMOR, ArmorItem.Type.CHESTPLATE, p) - .setArmorLogic(new NanoMuscleSuite(ArmorItem.Type.CHESTPLATE, - 512, - 6_400_000L * (long) Math.max(1, Math.pow(4, ConfigHolder.INSTANCE.tools.voltageTierNanoSuit - 3)), - ConfigHolder.INSTANCE.tools.voltageTierNanoSuit))) - .lang("NanoMuscle™ Suite Chestplate") - .properties(p -> p.rarity(Rarity.UNCOMMON)) - .register(); - public static ItemEntry NANO_LEGGINGS = REGISTRATE.item("nanomuscle_leggings", (p) -> new ArmorComponentItem(GTArmorMaterials.ARMOR, ArmorItem.Type.LEGGINGS, p) - .setArmorLogic(new NanoMuscleSuite(ArmorItem.Type.LEGGINGS, - 512, - 6_400_000L * (long) Math.max(1, Math.pow(4, ConfigHolder.INSTANCE.tools.voltageTierNanoSuit - 3)), - ConfigHolder.INSTANCE.tools.voltageTierNanoSuit))) - .lang("NanoMuscle™ Suite Leggings") - .properties(p -> p.rarity(Rarity.UNCOMMON)) - .register(); - public static ItemEntry NANO_BOOTS = REGISTRATE.item("nanomuscle_boots", (p) -> new ArmorComponentItem(GTArmorMaterials.ARMOR, ArmorItem.Type.BOOTS, p) - .setArmorLogic(new NanoMuscleSuite(ArmorItem.Type.BOOTS, - 512, - 6_400_000L * (long) Math.max(1, Math.pow(4, ConfigHolder.INSTANCE.tools.voltageTierNanoSuit - 3)), - ConfigHolder.INSTANCE.tools.voltageTierNanoSuit))) - .lang("NanoMuscle™ Suite Boots") - .properties(p -> p.rarity(Rarity.UNCOMMON)) - .register(); - public static ItemEntry NANO_HELMET = REGISTRATE.item("nanomuscle_helmet", (p) -> new ArmorComponentItem(GTArmorMaterials.ARMOR, ArmorItem.Type.HELMET, p) - .setArmorLogic(new NanoMuscleSuite(ArmorItem.Type.HELMET, - 512, - 6_400_000L * (long) Math.max(1, Math.pow(4, ConfigHolder.INSTANCE.tools.voltageTierNanoSuit - 3)), - ConfigHolder.INSTANCE.tools.voltageTierNanoSuit))) - .lang("NanoMuscle™ Suite Helmet") - .properties(p -> p.rarity(Rarity.UNCOMMON)) - .register(); - - public static ItemEntry HAZMAT_CHESTPLATE = REGISTRATE.item("hazmat_chestpiece", (p) -> new ArmorComponentItem(GTArmorMaterials.ARMOR, ArmorItem.Type.CHESTPLATE, p) - .setArmorLogic(new HazmatSuit(ArmorItem.Type.CHESTPLATE))) - .lang("Hazardous Materials Suit Chestpiece") - .properties(p -> p.rarity(Rarity.UNCOMMON)) - .register(); - public static ItemEntry HAZMAT_LEGGINGS = REGISTRATE.item("hazmat_leggings", (p) -> new ArmorComponentItem(GTArmorMaterials.ARMOR, ArmorItem.Type.LEGGINGS, p) - .setArmorLogic(new HazmatSuit(ArmorItem.Type.LEGGINGS))) - .lang("Hazardous Materials Suit Leggings") - .properties(p -> p.rarity(Rarity.UNCOMMON)) - .register(); - public static ItemEntry HAZMAT_BOOTS = REGISTRATE.item("hazmat_boots", (p) -> new ArmorComponentItem(GTArmorMaterials.ARMOR, ArmorItem.Type.BOOTS, p) - .setArmorLogic(new HazmatSuit(ArmorItem.Type.BOOTS))) - .lang("Hazardous Materials Suit Boots") - .properties(p -> p.rarity(Rarity.UNCOMMON)) - .register(); - public static ItemEntry HAZMAT_HELMET = REGISTRATE.item("hazmat_headpiece", (p) -> new ArmorComponentItem(GTArmorMaterials.ARMOR, ArmorItem.Type.HELMET, p) - .setArmorLogic(new HazmatSuit(ArmorItem.Type.HELMET))) - .lang("Hazardous Materials Suit Headpiece") - .properties(p -> p.rarity(Rarity.UNCOMMON)) - .register(); - - public static ItemEntry QUANTUM_CHESTPLATE = REGISTRATE.item("quarktech_chestplate", (p) -> new ArmorComponentItem(GTArmorMaterials.ARMOR, ArmorItem.Type.CHESTPLATE, p) - .setArmorLogic(new QuarkTechSuite(ArmorItem.Type.CHESTPLATE, - 8192, - 100_000_000L * (long) Math.max(1, Math.pow(4, ConfigHolder.INSTANCE.tools.voltageTierQuarkTech - 5)), - ConfigHolder.INSTANCE.tools.voltageTierQuarkTech))) - .lang("QuarkTech™ Suite Chestplate") - .properties(p -> p.rarity(Rarity.RARE)) - .register(); - public static ItemEntry QUANTUM_LEGGINGS = REGISTRATE.item("quarktech_leggings", (p) -> new ArmorComponentItem(GTArmorMaterials.ARMOR, ArmorItem.Type.LEGGINGS, p) - .setArmorLogic(new QuarkTechSuite(ArmorItem.Type.LEGGINGS, - 8192, - 100_000_000L * (long) Math.max(1, Math.pow(4, ConfigHolder.INSTANCE.tools.voltageTierQuarkTech - 5)), - ConfigHolder.INSTANCE.tools.voltageTierQuarkTech))) - .lang("QuarkTech™ Suite Leggings") - .properties(p -> p.rarity(Rarity.RARE)) - .register(); - public static ItemEntry QUANTUM_BOOTS = REGISTRATE.item("quarktech_boots", (p) -> new ArmorComponentItem(GTArmorMaterials.ARMOR, ArmorItem.Type.BOOTS, p) - .setArmorLogic(new QuarkTechSuite(ArmorItem.Type.BOOTS, - 8192, - 100_000_000L * (long) Math.max(1, Math.pow(4, ConfigHolder.INSTANCE.tools.voltageTierQuarkTech - 5)), - ConfigHolder.INSTANCE.tools.voltageTierQuarkTech))) - .lang("QuarkTech™ Suite Leggings") - .properties(p -> p.rarity(Rarity.RARE)) - .register(); - public static ItemEntry QUANTUM_HELMET = REGISTRATE.item("quarktech_helmet", (p) -> new ArmorComponentItem(GTArmorMaterials.ARMOR, ArmorItem.Type.HELMET, p) - .setArmorLogic(new QuarkTechSuite(ArmorItem.Type.HELMET, - 8192, - 100_000_000L * (long) Math.max(1, Math.pow(4, ConfigHolder.INSTANCE.tools.voltageTierQuarkTech - 5)), - ConfigHolder.INSTANCE.tools.voltageTierQuarkTech))) - .lang("QuarkTech™ Suite Helmet") - .properties(p -> p.rarity(Rarity.RARE)) - .register(); - - public static ItemEntry LIQUID_FUEL_JETPACK = REGISTRATE.item("liquid_fuel_jetpack", (p) -> new ArmorComponentItem(GTArmorMaterials.JETPACK, ArmorItem.Type.CHESTPLATE, p) - .setArmorLogic(new PowerlessJetpack())) - .lang("Liquid Fuel Jetpack") - .setData(ProviderType.ITEM_MODEL, NonNullBiConsumer.noop()) - .register(); - public static ItemEntry ELECTRIC_JETPACK = REGISTRATE.item("electric_jetpack", (p) -> new ArmorComponentItem(GTArmorMaterials.JETPACK, ArmorItem.Type.CHESTPLATE, p) - .setArmorLogic(new Jetpack(30, - 1_000_000L * (long) Math.max(1, Math.pow(4, ConfigHolder.INSTANCE.tools.voltageTierImpeller - 2)), - ConfigHolder.INSTANCE.tools.voltageTierImpeller))) - .lang("Electric Jetpack") - .properties(p -> p.rarity(Rarity.UNCOMMON)) - .model(overrideModel(GTCEu.id("electric_jetpack"), 8)) - .onRegister(modelPredicate(GTCEu.id("electric_jetpack"), ElectricStats::getStoredPredicate)) - .register(); - - public static ItemEntry ELECTRIC_JETPACK_ADVANCED = REGISTRATE.item("advanced_electric_jetpack", (p) -> new ArmorComponentItem(GTArmorMaterials.JETPACK, ArmorItem.Type.CHESTPLATE, p) - .setArmorLogic(new AdvancedJetpack(512, - 6_400_000L * (long) Math.max(1, Math.pow(4, ConfigHolder.INSTANCE.tools.voltageTierAdvImpeller - 4)), - ConfigHolder.INSTANCE.tools.voltageTierAdvImpeller))) - .lang("Advanced Electric Jetpack") - .properties(p -> p.rarity(Rarity.RARE)) - .register(); - public static ItemEntry NANO_CHESTPLATE_ADVANCED = REGISTRATE.item("avanced_nanomuscle_chestplate", (p) -> new ArmorComponentItem(GTArmorMaterials.ARMOR, ArmorItem.Type.CHESTPLATE, p) - .setArmorLogic(new AdvancedNanoMuscleSuite(512, - 12_800_000L * (long) Math.max(1, Math.pow(4, ConfigHolder.INSTANCE.tools.voltageTierAdvNanoSuit - 3)), - ConfigHolder.INSTANCE.tools.voltageTierAdvNanoSuit))) - .lang("Advanced NanoMuscle™ Suite Chestplate") - .properties(p -> p.rarity(Rarity.RARE)) - .register(); - public static ItemEntry QUANTUM_CHESTPLATE_ADVANCED = REGISTRATE.item("advanced_quarktech_chestplate", (p) -> new ArmorComponentItem(GTArmorMaterials.ARMOR, ArmorItem.Type.CHESTPLATE, p) - .setArmorLogic(new AdvancedQuarkTechSuite(8192, - 1_000_000_000L * - (long) Math.max(1, Math.pow(4, ConfigHolder.INSTANCE.tools.voltageTierAdvQuarkTech - 6)), - ConfigHolder.INSTANCE.tools.voltageTierAdvQuarkTech))) - .lang("Advanced QuarkTech™ Suite Chestplate") - .properties(p -> p.rarity(Rarity.EPIC)) - .register(); - - public static ItemEntry POWER_THRUSTER = REGISTRATE.item("power_thruster", Item::new).properties(p -> p.rarity(Rarity.UNCOMMON)).onRegister(compassNode(GTCompassSections.MISC)).register(); - public static ItemEntry POWER_THRUSTER_ADVANCED = REGISTRATE.item("advanced_power_thruster", Item::new).lang("Advanced Power Thruster").properties(p -> p.rarity(Rarity.RARE)).onRegister(compassNode(GTCompassSections.MISC)).register(); - public static ItemEntry GRAVITATION_ENGINE = REGISTRATE.item("gravitation_engine_unit", Item::new).lang("Gravitation Engine Unit").properties(p -> p.rarity(Rarity.EPIC)).onRegister(compassNode(GTCompassSections.MISC)).register(); - - public static ItemEntry SUS_RECORD = REGISTRATE.item("sus_record", p -> new RecordItem(15, () -> GTSoundEntries.SUS_RECORD.getMainEvent(), p, 820)) - .lang("Music Disc") - .register(); - public static ItemEntry NAN_CERTIFICATE = REGISTRATE.item("nan_certificate", Item::new).lang("Certificate of Not Being a Noob Anymore").properties(p -> p.rarity(Rarity.EPIC)).onRegister(compassNodeExist(GTCompassSections.MISC, "certificate_of_not_being_a_noob_anymore")).register(); - - public static ItemEntry FERTILIZER = REGISTRATE.item("fertilizer", ComponentItem::create).onRegister(attach(new FertilizerBehavior())).onRegister(compassNode(GTCompassSections.MISC)).register(); - public static ItemEntry BLACKLIGHT = REGISTRATE.item("blacklight", Item::new).onRegister(compassNode(GTCompassSections.MISC)).register(); + public static ItemEntry NIGHTVISION_GOGGLES = REGISTRATE + .item("nightvision_goggles", + (p) -> new ArmorComponentItem(GTArmorMaterials.GOGGLES, ArmorItem.Type.HELMET, p) + .setArmorLogic(new NightvisionGoggles(2, + 80_000L * (long) Math.max(1, + Math.pow(1, ConfigHolder.INSTANCE.tools.voltageTierNightVision - 1)), + ConfigHolder.INSTANCE.tools.voltageTierNightVision, ArmorItem.Type.HELMET))) + .lang("Nightvision Goggles") + .register(); + + public static ItemEntry NANO_CHESTPLATE = REGISTRATE + .item("nanomuscle_chestplate", + (p) -> new ArmorComponentItem(GTArmorMaterials.ARMOR, ArmorItem.Type.CHESTPLATE, p) + .setArmorLogic(new NanoMuscleSuite(ArmorItem.Type.CHESTPLATE, + 512, + 6_400_000L * (long) Math.max(1, + Math.pow(4, ConfigHolder.INSTANCE.tools.voltageTierNanoSuit - 3)), + ConfigHolder.INSTANCE.tools.voltageTierNanoSuit))) + .lang("NanoMuscle™ Suite Chestplate") + .properties(p -> p.rarity(Rarity.UNCOMMON)) + .register(); + public static ItemEntry NANO_LEGGINGS = REGISTRATE + .item("nanomuscle_leggings", + (p) -> new ArmorComponentItem(GTArmorMaterials.ARMOR, ArmorItem.Type.LEGGINGS, p) + .setArmorLogic(new NanoMuscleSuite(ArmorItem.Type.LEGGINGS, + 512, + 6_400_000L * (long) Math.max(1, + Math.pow(4, ConfigHolder.INSTANCE.tools.voltageTierNanoSuit - 3)), + ConfigHolder.INSTANCE.tools.voltageTierNanoSuit))) + .lang("NanoMuscle™ Suite Leggings") + .properties(p -> p.rarity(Rarity.UNCOMMON)) + .register(); + public static ItemEntry NANO_BOOTS = REGISTRATE + .item("nanomuscle_boots", (p) -> new ArmorComponentItem(GTArmorMaterials.ARMOR, ArmorItem.Type.BOOTS, p) + .setArmorLogic(new NanoMuscleSuite(ArmorItem.Type.BOOTS, + 512, + 6_400_000L * (long) Math.max(1, + Math.pow(4, ConfigHolder.INSTANCE.tools.voltageTierNanoSuit - 3)), + ConfigHolder.INSTANCE.tools.voltageTierNanoSuit))) + .lang("NanoMuscle™ Suite Boots") + .properties(p -> p.rarity(Rarity.UNCOMMON)) + .register(); + public static ItemEntry NANO_HELMET = REGISTRATE + .item("nanomuscle_helmet", (p) -> new ArmorComponentItem(GTArmorMaterials.ARMOR, ArmorItem.Type.HELMET, p) + .setArmorLogic(new NanoMuscleSuite(ArmorItem.Type.HELMET, + 512, + 6_400_000L * (long) Math.max(1, + Math.pow(4, ConfigHolder.INSTANCE.tools.voltageTierNanoSuit - 3)), + ConfigHolder.INSTANCE.tools.voltageTierNanoSuit))) + .lang("NanoMuscle™ Suite Helmet") + .properties(p -> p.rarity(Rarity.UNCOMMON)) + .register(); + + public static ItemEntry FACE_MASK = REGISTRATE + .item("face_mask", + (p) -> new ArmorComponentItem(GTArmorMaterials.BAD_PPE_EQUIPMENT, ArmorItem.Type.HELMET, p) + .setArmorLogic(new HazmatSuit(ArmorItem.Type.HELMET, "bad_hazmat"))) + .lang("Face Mask") + .tag(CustomTags.PPE_ARMOR) + .register(); + public static ItemEntry RUBBER_GLOVES = REGISTRATE + .item("rubber_gloves", + (p) -> new ArmorComponentItem(GTArmorMaterials.BAD_PPE_EQUIPMENT, ArmorItem.Type.HELMET, p) + .setArmorLogic(new HazmatSuit(ArmorItem.Type.CHESTPLATE, "bad_hazmat"))) + .lang("Rubber Gloves") + .tag(CustomTags.PPE_ARMOR) + .register(); + public static ItemEntry HAZMAT_CHESTPLATE = REGISTRATE + .item("hazmat_chestpiece", + (p) -> new ArmorComponentItem(GTArmorMaterials.GOOD_PPE_EQUIPMENT, ArmorItem.Type.CHESTPLATE, p) + .setArmorLogic(new HazmatSuit(ArmorItem.Type.CHESTPLATE, "hazmat"))) + .lang("Hazardous Materials Suit Chestpiece") + .properties(p -> p.rarity(Rarity.UNCOMMON)) + .tag(CustomTags.PPE_ARMOR) + .register(); + public static ItemEntry HAZMAT_LEGGINGS = REGISTRATE + .item("hazmat_leggings", + (p) -> new ArmorComponentItem(GTArmorMaterials.GOOD_PPE_EQUIPMENT, ArmorItem.Type.LEGGINGS, p) + .setArmorLogic(new HazmatSuit(ArmorItem.Type.LEGGINGS, "hazmat"))) + .lang("Hazardous Materials Suit Leggings") + .properties(p -> p.rarity(Rarity.UNCOMMON)) + .tag(CustomTags.PPE_ARMOR) + .register(); + public static ItemEntry HAZMAT_BOOTS = REGISTRATE + .item("hazmat_boots", + (p) -> new ArmorComponentItem(GTArmorMaterials.GOOD_PPE_EQUIPMENT, ArmorItem.Type.BOOTS, p) + .setArmorLogic(new HazmatSuit(ArmorItem.Type.BOOTS, "hazmat"))) + .lang("Hazardous Materials Suit Boots") + .properties(p -> p.rarity(Rarity.UNCOMMON)) + .tag(CustomTags.PPE_ARMOR) + .register(); + public static ItemEntry HAZMAT_HELMET = REGISTRATE + .item("hazmat_headpiece", + (p) -> new ArmorComponentItem(GTArmorMaterials.GOOD_PPE_EQUIPMENT, ArmorItem.Type.HELMET, p) + .setArmorLogic(new HazmatSuit(ArmorItem.Type.HELMET, "hazmat"))) + .lang("Hazardous Materials Suit Headpiece") + .properties(p -> p.rarity(Rarity.UNCOMMON)) + .tag(CustomTags.PPE_ARMOR) + .register(); + + public static ItemEntry QUANTUM_CHESTPLATE = REGISTRATE + .item("quarktech_chestplate", + (p) -> new ArmorComponentItem(GTArmorMaterials.ARMOR, ArmorItem.Type.CHESTPLATE, p) + .setArmorLogic(new QuarkTechSuite(ArmorItem.Type.CHESTPLATE, + 8192, + 100_000_000L * (long) Math.max(1, + Math.pow(4, ConfigHolder.INSTANCE.tools.voltageTierQuarkTech - 5)), + ConfigHolder.INSTANCE.tools.voltageTierQuarkTech))) + .lang("QuarkTech™ Suite Chestplate") + .properties(p -> p.rarity(Rarity.RARE)) + .tag(CustomTags.PPE_ARMOR) + .register(); + public static ItemEntry QUANTUM_LEGGINGS = REGISTRATE + .item("quarktech_leggings", + (p) -> new ArmorComponentItem(GTArmorMaterials.ARMOR, ArmorItem.Type.LEGGINGS, p) + .setArmorLogic(new QuarkTechSuite(ArmorItem.Type.LEGGINGS, + 8192, + 100_000_000L * (long) Math.max(1, + Math.pow(4, ConfigHolder.INSTANCE.tools.voltageTierQuarkTech - 5)), + ConfigHolder.INSTANCE.tools.voltageTierQuarkTech))) + .lang("QuarkTech™ Suite Leggings") + .properties(p -> p.rarity(Rarity.RARE)) + .tag(CustomTags.PPE_ARMOR) + .register(); + public static ItemEntry QUANTUM_BOOTS = REGISTRATE + .item("quarktech_boots", (p) -> new ArmorComponentItem(GTArmorMaterials.ARMOR, ArmorItem.Type.BOOTS, p) + .setArmorLogic(new QuarkTechSuite(ArmorItem.Type.BOOTS, + 8192, + 100_000_000L * (long) Math.max(1, + Math.pow(4, ConfigHolder.INSTANCE.tools.voltageTierQuarkTech - 5)), + ConfigHolder.INSTANCE.tools.voltageTierQuarkTech))) + .lang("QuarkTech™ Suite Leggings") + .properties(p -> p.rarity(Rarity.RARE)) + .tag(CustomTags.PPE_ARMOR) + .register(); + public static ItemEntry QUANTUM_HELMET = REGISTRATE + .item("quarktech_helmet", (p) -> new ArmorComponentItem(GTArmorMaterials.ARMOR, ArmorItem.Type.HELMET, p) + .setArmorLogic(new QuarkTechSuite(ArmorItem.Type.HELMET, + 8192, + 100_000_000L * (long) Math.max(1, + Math.pow(4, ConfigHolder.INSTANCE.tools.voltageTierQuarkTech - 5)), + ConfigHolder.INSTANCE.tools.voltageTierQuarkTech))) + .lang("QuarkTech™ Suite Helmet") + .properties(p -> p.rarity(Rarity.RARE)) + .tag(CustomTags.PPE_ARMOR) + .register(); + + public static ItemEntry LIQUID_FUEL_JETPACK = REGISTRATE + .item("liquid_fuel_jetpack", + (p) -> new ArmorComponentItem(GTArmorMaterials.JETPACK, ArmorItem.Type.CHESTPLATE, p) + .setArmorLogic(new PowerlessJetpack())) + .lang("Liquid Fuel Jetpack") + .setData(ProviderType.ITEM_MODEL, NonNullBiConsumer.noop()) + .register(); + public static ItemEntry ELECTRIC_JETPACK = REGISTRATE + .item("electric_jetpack", + (p) -> new ArmorComponentItem(GTArmorMaterials.JETPACK, ArmorItem.Type.CHESTPLATE, p) + .setArmorLogic(new Jetpack(30, + 1_000_000L * (long) Math.max(1, + Math.pow(4, ConfigHolder.INSTANCE.tools.voltageTierImpeller - 2)), + ConfigHolder.INSTANCE.tools.voltageTierImpeller))) + .lang("Electric Jetpack") + .properties(p -> p.rarity(Rarity.UNCOMMON)) + .model(overrideModel(GTCEu.id("electric_jetpack"), 8)) + .onRegister(modelPredicate(GTCEu.id("electric_jetpack"), ElectricStats::getStoredPredicate)) + .register(); + + public static ItemEntry ELECTRIC_JETPACK_ADVANCED = REGISTRATE + .item("advanced_electric_jetpack", + (p) -> new ArmorComponentItem(GTArmorMaterials.JETPACK, ArmorItem.Type.CHESTPLATE, p) + .setArmorLogic(new AdvancedJetpack(512, + 6_400_000L * (long) Math.max(1, + Math.pow(4, ConfigHolder.INSTANCE.tools.voltageTierAdvImpeller - 4)), + ConfigHolder.INSTANCE.tools.voltageTierAdvImpeller))) + .lang("Advanced Electric Jetpack") + .properties(p -> p.rarity(Rarity.RARE)) + .register(); + public static ItemEntry NANO_CHESTPLATE_ADVANCED = REGISTRATE + .item("avanced_nanomuscle_chestplate", + (p) -> new ArmorComponentItem(GTArmorMaterials.ARMOR, ArmorItem.Type.CHESTPLATE, p) + .setArmorLogic(new AdvancedNanoMuscleSuite(512, + 12_800_000L * (long) Math.max(1, + Math.pow(4, ConfigHolder.INSTANCE.tools.voltageTierAdvNanoSuit - 3)), + ConfigHolder.INSTANCE.tools.voltageTierAdvNanoSuit))) + .lang("Advanced NanoMuscle™ Suite Chestplate") + .properties(p -> p.rarity(Rarity.RARE)) + .tag(CustomTags.PPE_ARMOR) + .register(); + public static ItemEntry QUANTUM_CHESTPLATE_ADVANCED = REGISTRATE + .item("advanced_quarktech_chestplate", (p) -> new ArmorComponentItem(GTArmorMaterials.ARMOR, + ArmorItem.Type.CHESTPLATE, p) + .setArmorLogic(new AdvancedQuarkTechSuite(8192, + 1_000_000_000L * + (long) Math.max(1, + Math.pow(4, ConfigHolder.INSTANCE.tools.voltageTierAdvQuarkTech - 6)), + ConfigHolder.INSTANCE.tools.voltageTierAdvQuarkTech))) + .lang("Advanced QuarkTech™ Suite Chestplate") + .properties(p -> p.rarity(Rarity.EPIC)) + .tag(CustomTags.PPE_ARMOR) + .register(); + + public static ItemEntry POWER_THRUSTER = REGISTRATE.item("power_thruster", Item::new) + .properties(p -> p.rarity(Rarity.UNCOMMON)).onRegister(compassNode(GTCompassSections.MISC)).register(); + public static ItemEntry POWER_THRUSTER_ADVANCED = REGISTRATE.item("advanced_power_thruster", Item::new) + .lang("Advanced Power Thruster").properties(p -> p.rarity(Rarity.RARE)) + .onRegister(compassNode(GTCompassSections.MISC)).register(); + public static ItemEntry GRAVITATION_ENGINE = REGISTRATE.item("gravitation_engine_unit", Item::new) + .lang("Gravitation Engine Unit").properties(p -> p.rarity(Rarity.EPIC)) + .onRegister(compassNode(GTCompassSections.MISC)).register(); + + public static ItemEntry SUS_RECORD = REGISTRATE + .item("sus_record", p -> new RecordItem(15, () -> GTSoundEntries.SUS_RECORD.getMainEvent(), p, 820)) + .lang("Music Disc") + .register(); + public static ItemEntry NAN_CERTIFICATE = REGISTRATE.item("nan_certificate", Item::new) + .lang("Certificate of Not Being a Noob Anymore").properties(p -> p.rarity(Rarity.EPIC)) + .onRegister(compassNodeExist(GTCompassSections.MISC, "certificate_of_not_being_a_noob_anymore")).register(); + + public static ItemEntry FERTILIZER = REGISTRATE.item("fertilizer", ComponentItem::create) + .onRegister(attach(new FertilizerBehavior())).onRegister(compassNode(GTCompassSections.MISC)).register(); + public static ItemEntry BLACKLIGHT = REGISTRATE.item("blacklight", Item::new) + .onRegister(compassNode(GTCompassSections.MISC)).register(); public static void init() { generateMaterialItems(); @@ -1822,7 +2618,8 @@ public static NonNullConsumer compassNode(CompassSection return item -> CompassNode.getOrCreate(section, item::asItem).addPreNode(preNodes); } - public static NonNullConsumer compassNodeExist(CompassSection section, String node, CompassNode... preNodes) { + public static NonNullConsumer compassNodeExist(CompassSection section, String node, + CompassNode... preNodes) { return item -> CompassNode.getOrCreate(section, node).addPreNode(preNodes).addItem(item::asItem); } @@ -1830,7 +2627,9 @@ public static NonNullConsumer materialInfo(ItemMaterialI return item -> ChemicalHelper.registerMaterialInfo(item, materialInfo); } - public static > NonNullFunction unificationItem(@NotNull TagPrefix tagPrefix, @NotNull Material mat) { + public static > NonNullFunction unificationItem(@NotNull TagPrefix tagPrefix, + @NotNull Material mat) { return builder -> { builder.onRegister(item -> { Supplier supplier = SupplierMemoizer.memoize(() -> item); @@ -1858,7 +2657,8 @@ public static void cauldronInteraction(T item) { if (level == 0) return InteractionResult.PASS; - player.setItemInHand(hand, ChemicalHelper.get(purifyMap.get(prefixItem.tagPrefix), prefixItem.material, stack.getCount())); + player.setItemInHand(hand, ChemicalHelper.get(purifyMap.get(prefixItem.tagPrefix), + prefixItem.material, stack.getCount())); player.awardStat(Stats.USE_CAULDRON); player.awardStat(Stats.ITEM_USED.get(stackItem)); LayeredCauldronBlock.lowerFillLevel(state, world, pos); @@ -1866,7 +2666,6 @@ public static void cauldronInteraction(T item) { } } - return InteractionResult.sidedSuccess(world.isClientSide); }); @@ -1885,7 +2684,8 @@ public static NonNullConsumer attach(IItemComponent return item -> item.attachComponents(components); } - public static NonNullConsumer modelPredicate(ResourceLocation predicate, Function property) { + public static NonNullConsumer modelPredicate(ResourceLocation predicate, + Function property) { return item -> { if (LDLib.isClient()) { ItemProperties.register(item, predicate, (itemStack, c, l, i) -> property.apply(itemStack)); @@ -1893,8 +2693,10 @@ public static NonNullConsumer modelPredicate(ResourceLocatio }; } - public static void registerToolTier(MaterialToolTier tier, ResourceLocation id, Collection before, Collection after) { - TierSortingRegistry.registerTier(tier, id, Arrays.asList((Object[]) before.toArray(ResourceLocation[]::new)), Arrays.asList((Object[]) after.toArray(ResourceLocation[]::new))); + public static void registerToolTier(MaterialToolTier tier, ResourceLocation id, Collection before, + Collection after) { + TierSortingRegistry.registerTier(tier, id, Arrays.asList((Object[]) before.toArray(ResourceLocation[]::new)), + Arrays.asList((Object[]) after.toArray(ResourceLocation[]::new))); } public static ResourceLocation getTierName(Tier tier) { @@ -1902,12 +2704,12 @@ public static ResourceLocation getTierName(Tier tier) { } @NotNull - private static NonNullBiConsumer, RegistrateLangProvider> reverseLangValue() { + private static < + T extends Item> NonNullBiConsumer, RegistrateLangProvider> reverseLangValue() { return (ctx, prov) -> { var names = Arrays.stream(ctx.getName().split("/.")).collect(Collectors.toList()); Collections.reverse(names); prov.add(ctx.get(), names.stream().map(StringUtils::capitalize).collect(Collectors.joining(" "))); }; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTMachines.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTMachines.java index 134a780e35..e4af3417c5 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTMachines.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTMachines.java @@ -1,8 +1,5 @@ package com.gregtechceu.gtceu.common.data; -import appeng.api.networking.pathing.ChannelMode; -import appeng.core.AEConfig; -import com.google.common.math.IntMath; import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.GTCEuAPI; import com.gregtechceu.gtceu.api.GTValues; @@ -53,8 +50,8 @@ import com.gregtechceu.gtceu.common.machine.multiblock.steam.SteamParallelMultiblockMachine; import com.gregtechceu.gtceu.common.machine.steam.SteamLiquidBoilerMachine; import com.gregtechceu.gtceu.common.machine.steam.SteamMinerMachine; -import com.gregtechceu.gtceu.common.machine.steam.SteamSolidBoilerMachine; import com.gregtechceu.gtceu.common.machine.steam.SteamSolarBoiler; +import com.gregtechceu.gtceu.common.machine.steam.SteamSolidBoilerMachine; import com.gregtechceu.gtceu.common.machine.storage.*; import com.gregtechceu.gtceu.common.pipelike.fluidpipe.longdistance.LDFluidEndpointMachine; import com.gregtechceu.gtceu.common.pipelike.item.longdistance.LDItemEndpointMachine; @@ -63,14 +60,12 @@ import com.gregtechceu.gtceu.integration.kjs.GTRegistryInfo; import com.gregtechceu.gtceu.utils.FormattingUtil; import com.gregtechceu.gtceu.utils.GTUtil; + import com.lowdragmc.lowdraglib.Platform; import com.lowdragmc.lowdraglib.side.fluid.FluidHelper; import com.lowdragmc.lowdraglib.side.fluid.FluidStack; import com.lowdragmc.lowdraglib.utils.BlockInfo; -import it.unimi.dsi.fastutil.Pair; -import it.unimi.dsi.fastutil.ints.Int2LongFunction; -import it.unimi.dsi.fastutil.objects.Object2IntArrayMap; -import it.unimi.dsi.fastutil.objects.Object2IntMap; + import net.minecraft.ChatFormatting; import net.minecraft.core.Direction; import net.minecraft.network.chat.Component; @@ -85,6 +80,14 @@ import net.minecraft.world.level.block.state.properties.DoubleBlockHalf; import net.minecraft.world.phys.shapes.Shapes; import net.minecraftforge.fml.ModLoader; + +import appeng.api.networking.pathing.ChannelMode; +import appeng.core.AEConfig; +import com.google.common.math.IntMath; +import it.unimi.dsi.fastutil.Pair; +import it.unimi.dsi.fastutil.ints.Int2LongFunction; +import it.unimi.dsi.fastutil.objects.Object2IntArrayMap; +import it.unimi.dsi.fastutil.objects.Object2IntMap; import org.jetbrains.annotations.Nullable; import java.util.ArrayList; @@ -99,12 +102,12 @@ import static com.gregtechceu.gtceu.api.GTValues.*; import static com.gregtechceu.gtceu.api.pattern.Predicates.*; import static com.gregtechceu.gtceu.api.pattern.util.RelativeDirection.*; -import static com.gregtechceu.gtceu.common.registry.GTRegistration.REGISTRATE; import static com.gregtechceu.gtceu.common.data.GTBlocks.*; import static com.gregtechceu.gtceu.common.data.GTCreativeModeTabs.MACHINE; import static com.gregtechceu.gtceu.common.data.GTMaterials.DrillingFluid; import static com.gregtechceu.gtceu.common.data.GTRecipeTypes.DUMMY_RECIPES; import static com.gregtechceu.gtceu.common.data.GTRecipeTypes.STEAM_BOILER_RECIPES; +import static com.gregtechceu.gtceu.common.registry.GTRegistration.REGISTRATE; import static com.gregtechceu.gtceu.utils.FormattingUtil.toEnglishName; import static com.gregtechceu.gtceu.utils.FormattingUtil.toRomanNumeral; @@ -114,17 +117,24 @@ * @implNote GTMachines */ public class GTMachines { + public static final int[] ALL_TIERS = GTValues.tiersBetween(ULV, GTCEuAPI.isHighTier() ? MAX : UHV); public static final int[] ELECTRIC_TIERS = GTValues.tiersBetween(LV, GTCEuAPI.isHighTier() ? OpV : UV); public static final int[] LOW_TIERS = GTValues.tiersBetween(LV, EV); public static final int[] HIGH_TIERS = GTValues.tiersBetween(IV, GTCEuAPI.isHighTier() ? OpV : UHV); public static final int[] MULTI_HATCH_TIERS = GTValues.tiersBetween(EV, GTCEuAPI.isHighTier() ? MAX : UHV); - public static final Int2LongFunction defaultTankSizeFunction = tier -> (tier <= GTValues.LV ? 8 : tier == GTValues.MV ? 12 : tier == GTValues.HV ? 16 : tier == GTValues.EV ? 32 : 64) * FluidHelper.getBucket(); - public static final Int2LongFunction hvCappedTankSizeFunction = tier -> (tier <= GTValues.LV ? 8: tier == GTValues.MV ? 12 : 16) * FluidHelper.getBucket(); - public static final Int2LongFunction largeTankSizeFunction = tier -> (tier <= GTValues.LV ? 32 : tier == GTValues.MV ? 48 : 64) * FluidHelper.getBucket(); - public static final Int2LongFunction steamGeneratorTankSizeFunction = tier -> Math.min(16 * (1 << (tier - 1)), 64) * FluidHelper.getBucket(); - public static final Int2LongFunction genericGeneratorTankSizeFunction = tier -> Math.min(4 * (1 << (tier - 1)), 16) * FluidHelper.getBucket(); + public static final Int2LongFunction defaultTankSizeFunction = tier -> (tier <= GTValues.LV ? 8 : + tier == GTValues.MV ? 12 : tier == GTValues.HV ? 16 : tier == GTValues.EV ? 32 : 64) * + FluidHelper.getBucket(); + public static final Int2LongFunction hvCappedTankSizeFunction = tier -> (tier <= GTValues.LV ? 8 : + tier == GTValues.MV ? 12 : 16) * FluidHelper.getBucket(); + public static final Int2LongFunction largeTankSizeFunction = tier -> (tier <= GTValues.LV ? 32 : + tier == GTValues.MV ? 48 : 64) * FluidHelper.getBucket(); + public static final Int2LongFunction steamGeneratorTankSizeFunction = tier -> Math.min(16 * (1 << (tier - 1)), 64) * + FluidHelper.getBucket(); + public static final Int2LongFunction genericGeneratorTankSizeFunction = tier -> Math.min(4 * (1 << (tier - 1)), + 16) * FluidHelper.getBucket(); public static Object2IntMap DRUM_CAPACITY = new Object2IntArrayMap<>(); @@ -133,54 +143,69 @@ public class GTMachines { GTRegistries.MACHINES.unfreeze(); } ////////////////////////////////////// - //****** Steam Machine ******// + // ****** Steam Machine ******// ////////////////////////////////////// - public static final Pair STEAM_SOLID_BOILER = registerSteamMachines("steam_solid_boiler", + public static final Pair STEAM_SOLID_BOILER = registerSteamMachines( + "steam_solid_boiler", SteamSolidBoilerMachine::new, (pressure, builder) -> builder.rotationState(RotationState.NON_Y_AXIS) .recipeType(STEAM_BOILER_RECIPES) .recipeModifier(SteamBoilerMachine::recipeModifier) .workableSteamHullRenderer(pressure, GTCEu.id("block/generators/boiler/coal")) - .tooltips(Component.translatable("gtceu.universal.tooltip.produces_fluid", (pressure ? 300 : 120) * FluidHelper.getBucket() / 20000)) + .tooltips(Component.translatable("gtceu.universal.tooltip.produces_fluid", + (pressure ? 300 : 120) * FluidHelper.getBucket() / 20000)) .register()); - public static final Pair STEAM_LIQUID_BOILER = registerSteamMachines("steam_liquid_boiler", + public static final Pair STEAM_LIQUID_BOILER = registerSteamMachines( + "steam_liquid_boiler", SteamLiquidBoilerMachine::new, (pressure, builder) -> builder.rotationState(RotationState.NON_Y_AXIS) .recipeType(STEAM_BOILER_RECIPES) .recipeModifier(SteamBoilerMachine::recipeModifier) .workableSteamHullRenderer(pressure, GTCEu.id("block/generators/boiler/lava")) - .tooltips(Component.translatable("gtceu.universal.tooltip.produces_fluid", (pressure ? 600 : 240) * FluidHelper.getBucket() / 20000)) + .tooltips(Component.translatable("gtceu.universal.tooltip.produces_fluid", + (pressure ? 600 : 240) * FluidHelper.getBucket() / 20000)) .register()); - public static final Pair STEAM_SOLAR_BOILER = registerSteamMachines("steam_solar_boiler", + public static final Pair STEAM_SOLAR_BOILER = registerSteamMachines( + "steam_solar_boiler", SteamSolarBoiler::new, (pressure, builder) -> builder.rotationState(RotationState.NON_Y_AXIS) .recipeType(STEAM_BOILER_RECIPES) .recipeModifier(SteamBoilerMachine::recipeModifier) .workableSteamHullRenderer(pressure, GTCEu.id("block/generators/boiler/solar")) - .tooltips(Component.translatable("gtceu.universal.tooltip.produces_fluid", (pressure ? 360 : 120) * FluidHelper.getBucket() / 20000)) + .tooltips(Component.translatable("gtceu.universal.tooltip.produces_fluid", + (pressure ? 360 : 120) * FluidHelper.getBucket() / 20000)) .register()); - public static final Pair STEAM_EXTRACTOR = registerSimpleSteamMachines("extractor", GTRecipeTypes.EXTRACTOR_RECIPES); - public static final Pair STEAM_MACERATOR = registerSteamMachines("steam_macerator", SimpleSteamMachine::new, (pressure, builder) -> builder - .rotationState(RotationState.NON_Y_AXIS) - .recipeType(GTRecipeTypes.MACERATOR_RECIPES) - .recipeModifier(SimpleSteamMachine::recipeModifier) - .addOutputLimit(ItemRecipeCapability.CAP, 1) - .renderer(() -> new WorkableSteamMachineRenderer(pressure, GTCEu.id("block/machines/macerator"))) - .register()); - public static final Pair STEAM_COMPRESSOR = registerSimpleSteamMachines("compressor", GTRecipeTypes.COMPRESSOR_RECIPES); - public static final Pair STEAM_HAMMER = registerSimpleSteamMachines("forge_hammer", GTRecipeTypes.FORGE_HAMMER_RECIPES); - public static final Pair STEAM_FURNACE = registerSimpleSteamMachines("furnace", GTRecipeTypes.FURNACE_RECIPES); - public static final Pair STEAM_ALLOY_SMELTER = registerSimpleSteamMachines("alloy_smelter", GTRecipeTypes.ALLOY_SMELTER_RECIPES); - public static final Pair STEAM_ROCK_CRUSHER = registerSimpleSteamMachines("rock_crusher", GTRecipeTypes.ROCK_BREAKER_RECIPES); - public static final MachineDefinition STEAM_MINER = REGISTRATE.machine("steam_miner", holder -> new SteamMinerMachine(holder, 320, 4, 0)) + public static final Pair STEAM_EXTRACTOR = registerSimpleSteamMachines( + "extractor", GTRecipeTypes.EXTRACTOR_RECIPES); + public static final Pair STEAM_MACERATOR = registerSteamMachines( + "steam_macerator", SimpleSteamMachine::new, (pressure, builder) -> builder + .rotationState(RotationState.NON_Y_AXIS) + .recipeType(GTRecipeTypes.MACERATOR_RECIPES) + .recipeModifier(SimpleSteamMachine::recipeModifier) + .addOutputLimit(ItemRecipeCapability.CAP, 1) + .renderer(() -> new WorkableSteamMachineRenderer(pressure, GTCEu.id("block/machines/macerator"))) + .register()); + public static final Pair STEAM_COMPRESSOR = registerSimpleSteamMachines( + "compressor", GTRecipeTypes.COMPRESSOR_RECIPES); + public static final Pair STEAM_HAMMER = registerSimpleSteamMachines( + "forge_hammer", GTRecipeTypes.FORGE_HAMMER_RECIPES); + public static final Pair STEAM_FURNACE = registerSimpleSteamMachines( + "furnace", GTRecipeTypes.FURNACE_RECIPES); + public static final Pair STEAM_ALLOY_SMELTER = registerSimpleSteamMachines( + "alloy_smelter", GTRecipeTypes.ALLOY_SMELTER_RECIPES); + public static final Pair STEAM_ROCK_CRUSHER = registerSimpleSteamMachines( + "rock_crusher", GTRecipeTypes.ROCK_BREAKER_RECIPES); + public static final MachineDefinition STEAM_MINER = REGISTRATE + .machine("steam_miner", holder -> new SteamMinerMachine(holder, 320, 4, 0)) .rotationState(RotationState.NON_Y_AXIS) .langValue("Steam Miner") .recipeType(DUMMY_RECIPES) .tier(0) - .tooltips(Component.translatable("gtceu.universal.tooltip.uses_per_tick_steam", 16).append(ChatFormatting.GRAY + ", ") + .tooltips(Component.translatable("gtceu.universal.tooltip.uses_per_tick_steam", 16) + .append(ChatFormatting.GRAY + ", ") .append(Component.translatable("gtceu.machine.miner.per_block", 320 / 20))) .tooltipBuilder((item, tooltip) -> { int maxArea = IMiner.getWorkingArea(4); @@ -191,89 +216,130 @@ public class GTMachines { .register(); ////////////////////////////////////// - //*** SimpleTieredMachine ***// + // *** SimpleTieredMachine ***// ////////////////////////////////////// - public static final MachineDefinition[] HULL = registerTieredMachines("machine_hull", HullMachine::new, (tier, builder) -> builder - .rotationState(RotationState.ALL) - .overlayTieredHullRenderer("hull") - .abilities(PartAbility.PASSTHROUGH_HATCH) - .langValue("%s Machine Hull".formatted(VN[tier])) - .tooltips(Component.translatable("gtceu.machine.hull.tooltip")) - .compassNode("machine_hull") - .register(), ALL_TIERS); - - public static final MachineDefinition[] ELECTRIC_FURNACE = registerSimpleMachines("electric_furnace", GTRecipeTypes.FURNACE_RECIPES); - public static final MachineDefinition[] ALLOY_SMELTER = registerSimpleMachines("alloy_smelter", GTRecipeTypes.ALLOY_SMELTER_RECIPES); - public static final MachineDefinition[] ARC_FURNACE = registerSimpleMachines("arc_furnace", GTRecipeTypes.ARC_FURNACE_RECIPES, hvCappedTankSizeFunction); - public static final MachineDefinition[] ASSEMBLER = registerSimpleMachines("assembler", GTRecipeTypes.ASSEMBLER_RECIPES, hvCappedTankSizeFunction); - public static final MachineDefinition[] AUTOCLAVE = registerSimpleMachines("autoclave", GTRecipeTypes.AUTOCLAVE_RECIPES, hvCappedTankSizeFunction); + public static final MachineDefinition[] HULL = registerTieredMachines("machine_hull", HullMachine::new, + (tier, builder) -> builder + .rotationState(RotationState.ALL) + .overlayTieredHullRenderer("hull") + .abilities(PartAbility.PASSTHROUGH_HATCH) + .langValue("%s Machine Hull".formatted(VN[tier])) + .tooltips(Component.translatable("gtceu.machine.hull.tooltip")) + .compassNode("machine_hull") + .register(), + ALL_TIERS); + + public static final MachineDefinition[] ELECTRIC_FURNACE = registerSimpleMachines("electric_furnace", + GTRecipeTypes.FURNACE_RECIPES); + public static final MachineDefinition[] ALLOY_SMELTER = registerSimpleMachines("alloy_smelter", + GTRecipeTypes.ALLOY_SMELTER_RECIPES); + public static final MachineDefinition[] ARC_FURNACE = registerSimpleMachines("arc_furnace", + GTRecipeTypes.ARC_FURNACE_RECIPES, hvCappedTankSizeFunction); + public static final MachineDefinition[] ASSEMBLER = registerSimpleMachines("assembler", + GTRecipeTypes.ASSEMBLER_RECIPES, hvCappedTankSizeFunction); + public static final MachineDefinition[] AUTOCLAVE = registerSimpleMachines("autoclave", + GTRecipeTypes.AUTOCLAVE_RECIPES, hvCappedTankSizeFunction); public static final MachineDefinition[] BENDER = registerSimpleMachines("bender", GTRecipeTypes.BENDER_RECIPES); - public static final MachineDefinition[] BREWERY = registerSimpleMachines("brewery", GTRecipeTypes.BREWING_RECIPES, hvCappedTankSizeFunction); + public static final MachineDefinition[] BREWERY = registerSimpleMachines("brewery", GTRecipeTypes.BREWING_RECIPES, + hvCappedTankSizeFunction); public static final MachineDefinition[] CANNER = registerSimpleMachines("canner", GTRecipeTypes.CANNER_RECIPES); - public static final MachineDefinition[] CENTRIFUGE = registerSimpleMachines("centrifuge", GTRecipeTypes.CENTRIFUGE_RECIPES, largeTankSizeFunction); - public static final MachineDefinition[] CHEMICAL_BATH = registerSimpleMachines("chemical_bath", GTRecipeTypes.CHEMICAL_BATH_RECIPES, hvCappedTankSizeFunction); - public static final MachineDefinition[] CHEMICAL_REACTOR = registerSimpleMachines("chemical_reactor", GTRecipeTypes.CHEMICAL_RECIPES, tier -> 16 * FluidHelper.getBucket()); - public static final MachineDefinition[] COMPRESSOR = registerSimpleMachines("compressor", GTRecipeTypes.COMPRESSOR_RECIPES); + public static final MachineDefinition[] CENTRIFUGE = registerSimpleMachines("centrifuge", + GTRecipeTypes.CENTRIFUGE_RECIPES, largeTankSizeFunction); + public static final MachineDefinition[] CHEMICAL_BATH = registerSimpleMachines("chemical_bath", + GTRecipeTypes.CHEMICAL_BATH_RECIPES, hvCappedTankSizeFunction); + public static final MachineDefinition[] CHEMICAL_REACTOR = registerSimpleMachines("chemical_reactor", + GTRecipeTypes.CHEMICAL_RECIPES, tier -> 16 * FluidHelper.getBucket()); + public static final MachineDefinition[] COMPRESSOR = registerSimpleMachines("compressor", + GTRecipeTypes.COMPRESSOR_RECIPES); public static final MachineDefinition[] CUTTER = registerSimpleMachines("cutter", GTRecipeTypes.CUTTER_RECIPES); - public static final MachineDefinition[] DISTILLERY = registerSimpleMachines("distillery", GTRecipeTypes.DISTILLERY_RECIPES, hvCappedTankSizeFunction); - public static final MachineDefinition[] ELECTROLYZER = registerSimpleMachines("electrolyzer", GTRecipeTypes.ELECTROLYZER_RECIPES, largeTankSizeFunction); - public static final MachineDefinition[] ELECTROMAGNETIC_SEPARATOR = registerSimpleMachines("electromagnetic_separator", GTRecipeTypes.ELECTROMAGNETIC_SEPARATOR_RECIPES); - public static final MachineDefinition[] EXTRACTOR = registerSimpleMachines("extractor", GTRecipeTypes.EXTRACTOR_RECIPES); - public static final MachineDefinition[] EXTRUDER = registerSimpleMachines("extruder", GTRecipeTypes.EXTRUDER_RECIPES); - public static final MachineDefinition[] FERMENTER = registerSimpleMachines("fermenter", GTRecipeTypes.FERMENTING_RECIPES, hvCappedTankSizeFunction); - public static final MachineDefinition[] FLUID_HEATER = registerSimpleMachines("fluid_heater", GTRecipeTypes.FLUID_HEATER_RECIPES, hvCappedTankSizeFunction); - public static final MachineDefinition[] FLUID_SOLIDIFIER = registerSimpleMachines("fluid_solidifier", GTRecipeTypes.FLUID_SOLIDFICATION_RECIPES, hvCappedTankSizeFunction); - public static final MachineDefinition[] FORGE_HAMMER = registerSimpleMachines("forge_hammer", GTRecipeTypes.FORGE_HAMMER_RECIPES); - public static final MachineDefinition[] FORMING_PRESS = registerSimpleMachines("forming_press", GTRecipeTypes.FORMING_PRESS_RECIPES); + public static final MachineDefinition[] DISTILLERY = registerSimpleMachines("distillery", + GTRecipeTypes.DISTILLERY_RECIPES, hvCappedTankSizeFunction); + public static final MachineDefinition[] ELECTROLYZER = registerSimpleMachines("electrolyzer", + GTRecipeTypes.ELECTROLYZER_RECIPES, largeTankSizeFunction); + public static final MachineDefinition[] ELECTROMAGNETIC_SEPARATOR = registerSimpleMachines( + "electromagnetic_separator", GTRecipeTypes.ELECTROMAGNETIC_SEPARATOR_RECIPES); + public static final MachineDefinition[] EXTRACTOR = registerSimpleMachines("extractor", + GTRecipeTypes.EXTRACTOR_RECIPES); + public static final MachineDefinition[] EXTRUDER = registerSimpleMachines("extruder", + GTRecipeTypes.EXTRUDER_RECIPES); + public static final MachineDefinition[] FERMENTER = registerSimpleMachines("fermenter", + GTRecipeTypes.FERMENTING_RECIPES, hvCappedTankSizeFunction); + public static final MachineDefinition[] FLUID_HEATER = registerSimpleMachines("fluid_heater", + GTRecipeTypes.FLUID_HEATER_RECIPES, hvCappedTankSizeFunction); + public static final MachineDefinition[] FLUID_SOLIDIFIER = registerSimpleMachines("fluid_solidifier", + GTRecipeTypes.FLUID_SOLIDFICATION_RECIPES, hvCappedTankSizeFunction); + public static final MachineDefinition[] FORGE_HAMMER = registerSimpleMachines("forge_hammer", + GTRecipeTypes.FORGE_HAMMER_RECIPES); + public static final MachineDefinition[] FORMING_PRESS = registerSimpleMachines("forming_press", + GTRecipeTypes.FORMING_PRESS_RECIPES); public static final MachineDefinition[] LATHE = registerSimpleMachines("lathe", GTRecipeTypes.LATHE_RECIPES); public static final MachineDefinition[] SCANNER = registerSimpleMachines("scanner", GTRecipeTypes.SCANNER_RECIPES); - public static final MachineDefinition[] MIXER = registerSimpleMachines("mixer", GTRecipeTypes.MIXER_RECIPES, hvCappedTankSizeFunction); - public static final MachineDefinition[] ORE_WASHER = registerSimpleMachines("ore_washer", GTRecipeTypes.ORE_WASHER_RECIPES); + public static final MachineDefinition[] MIXER = registerSimpleMachines("mixer", GTRecipeTypes.MIXER_RECIPES, + hvCappedTankSizeFunction); + public static final MachineDefinition[] ORE_WASHER = registerSimpleMachines("ore_washer", + GTRecipeTypes.ORE_WASHER_RECIPES); public static final MachineDefinition[] PACKER = registerSimpleMachines("packer", GTRecipeTypes.PACKER_RECIPES); - public static final MachineDefinition[] POLARIZER = registerSimpleMachines("polarizer", GTRecipeTypes.POLARIZER_RECIPES); - public static final MachineDefinition[] LASER_ENGRAVER = registerSimpleMachines("laser_engraver", GTRecipeTypes.LASER_ENGRAVER_RECIPES); + public static final MachineDefinition[] POLARIZER = registerSimpleMachines("polarizer", + GTRecipeTypes.POLARIZER_RECIPES); + public static final MachineDefinition[] LASER_ENGRAVER = registerSimpleMachines("laser_engraver", + GTRecipeTypes.LASER_ENGRAVER_RECIPES); public static final MachineDefinition[] SIFTER = registerSimpleMachines("sifter", GTRecipeTypes.SIFTER_RECIPES); - public static final MachineDefinition[] THERMAL_CENTRIFUGE = registerSimpleMachines("thermal_centrifuge", GTRecipeTypes.THERMAL_CENTRIFUGE_RECIPES); - public static final MachineDefinition[] WIREMILL = registerSimpleMachines("wiremill", GTRecipeTypes.WIREMILL_RECIPES); - public static final MachineDefinition[] CIRCUIT_ASSEMBLER = registerSimpleMachines("circuit_assembler", GTRecipeTypes.CIRCUIT_ASSEMBLER_RECIPES, hvCappedTankSizeFunction); - public static final MachineDefinition[] MACERATOR = registerTieredMachines("macerator", (holder, tier) -> new SimpleTieredMachine(holder, tier, defaultTankSizeFunction), (tier, builder) -> builder - .langValue("%s Macerator %s".formatted(VLVH[tier], VLVT[tier])) - .editableUI(SimpleTieredMachine.EDITABLE_UI_CREATOR.apply(GTCEu.id("macerator"), GTRecipeTypes.MACERATOR_RECIPES)) - .rotationState(RotationState.NON_Y_AXIS) - .recipeType(GTRecipeTypes.MACERATOR_RECIPES) - .addOutputLimit(ItemRecipeCapability.CAP, switch (tier) { - case 1, 2 -> 1; - case 3 -> 3; - default -> 4; - }) - .recipeModifier(GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) - .workableTieredHullRenderer(GTCEu.id("block/machines/macerator")) - .tooltips(workableTiered(tier, GTValues.V[tier], GTValues.V[tier] * 64, GTRecipeTypes.MACERATOR_RECIPES, defaultTankSizeFunction.apply(tier), true)) - .compassNode("macerator") - .register(), ELECTRIC_TIERS); - public static final MachineDefinition[] GAS_COLLECTOR = registerSimpleMachines("gas_collector", GTRecipeTypes.GAS_COLLECTOR_RECIPES, largeTankSizeFunction); - public static final MachineDefinition[] ROCK_CRUSHER = registerTieredMachines("rock_crusher", RockCrusherMachine::new, (tier, builder) -> builder - .langValue("%s Rock Crusher %s".formatted(VLVH[tier], VLVT[tier])) - .editableUI(SimpleTieredMachine.EDITABLE_UI_CREATOR.apply(GTCEu.id("rock_crusher"), GTRecipeTypes.ROCK_BREAKER_RECIPES)) - .rotationState(RotationState.NON_Y_AXIS) - .recipeType(GTRecipeTypes.ROCK_BREAKER_RECIPES) - .recipeModifier(GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) - .workableTieredHullRenderer(GTCEu.id("block/machines/rock_crusher")) - .tooltips(workableTiered(tier, GTValues.V[tier], GTValues.V[tier] * 64, GTRecipeTypes.ROCK_BREAKER_RECIPES, defaultTankSizeFunction.apply(tier), true)) - .tooltips(explosion()) - .compassNode("rock_crusher") - .register(), ELECTRIC_TIERS); + public static final MachineDefinition[] THERMAL_CENTRIFUGE = registerSimpleMachines("thermal_centrifuge", + GTRecipeTypes.THERMAL_CENTRIFUGE_RECIPES); + public static final MachineDefinition[] WIREMILL = registerSimpleMachines("wiremill", + GTRecipeTypes.WIREMILL_RECIPES); + public static final MachineDefinition[] CIRCUIT_ASSEMBLER = registerSimpleMachines("circuit_assembler", + GTRecipeTypes.CIRCUIT_ASSEMBLER_RECIPES, hvCappedTankSizeFunction); + public static final MachineDefinition[] MACERATOR = registerTieredMachines("macerator", + (holder, tier) -> new SimpleTieredMachine(holder, tier, defaultTankSizeFunction), (tier, builder) -> builder + .langValue("%s Macerator %s".formatted(VLVH[tier], VLVT[tier])) + .editableUI(SimpleTieredMachine.EDITABLE_UI_CREATOR.apply(GTCEu.id("macerator"), + GTRecipeTypes.MACERATOR_RECIPES)) + .rotationState(RotationState.NON_Y_AXIS) + .recipeType(GTRecipeTypes.MACERATOR_RECIPES) + .addOutputLimit(ItemRecipeCapability.CAP, switch (tier) { + case 1, 2 -> 1; + case 3 -> 3; + default -> 4; + }) + .recipeModifier(GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) + .workableTieredHullRenderer(GTCEu.id("block/machines/macerator")) + .tooltips(workableTiered(tier, GTValues.V[tier], GTValues.V[tier] * 64, + GTRecipeTypes.MACERATOR_RECIPES, defaultTankSizeFunction.apply(tier), true)) + .compassNode("macerator") + .register(), + ELECTRIC_TIERS); + public static final MachineDefinition[] GAS_COLLECTOR = registerSimpleMachines("gas_collector", + GTRecipeTypes.GAS_COLLECTOR_RECIPES, largeTankSizeFunction); + public static final MachineDefinition[] ROCK_CRUSHER = registerTieredMachines("rock_crusher", + RockCrusherMachine::new, (tier, builder) -> builder + .langValue("%s Rock Crusher %s".formatted(VLVH[tier], VLVT[tier])) + .editableUI(SimpleTieredMachine.EDITABLE_UI_CREATOR.apply(GTCEu.id("rock_crusher"), + GTRecipeTypes.ROCK_BREAKER_RECIPES)) + .rotationState(RotationState.NON_Y_AXIS) + .recipeType(GTRecipeTypes.ROCK_BREAKER_RECIPES) + .recipeModifier(GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) + .workableTieredHullRenderer(GTCEu.id("block/machines/rock_crusher")) + .tooltips(workableTiered(tier, GTValues.V[tier], GTValues.V[tier] * 64, + GTRecipeTypes.ROCK_BREAKER_RECIPES, defaultTankSizeFunction.apply(tier), true)) + .tooltips(explosion()) + .compassNode("rock_crusher") + .register(), + ELECTRIC_TIERS); ////////////////////////////////////// - //**** Simple Generator ****// + // **** Simple Generator ****// ////////////////////////////////////// - public static final MachineDefinition[] COMBUSTION = registerSimpleGenerator("combustion", GTRecipeTypes.COMBUSTION_GENERATOR_FUELS, genericGeneratorTankSizeFunction, GTValues.LV, GTValues.MV, GTValues.HV); - public static final MachineDefinition[] STEAM_TURBINE = registerSimpleGenerator("steam_turbine", GTRecipeTypes.STEAM_TURBINE_FUELS, steamGeneratorTankSizeFunction, GTValues.LV, GTValues.MV, GTValues.HV); - public static final MachineDefinition[] GAS_TURBINE = registerSimpleGenerator("gas_turbine", GTRecipeTypes.GAS_TURBINE_FUELS, genericGeneratorTankSizeFunction, GTValues.LV, GTValues.MV, GTValues.HV); - + public static final MachineDefinition[] COMBUSTION = registerSimpleGenerator("combustion", + GTRecipeTypes.COMBUSTION_GENERATOR_FUELS, genericGeneratorTankSizeFunction, GTValues.LV, GTValues.MV, + GTValues.HV); + public static final MachineDefinition[] STEAM_TURBINE = registerSimpleGenerator("steam_turbine", + GTRecipeTypes.STEAM_TURBINE_FUELS, steamGeneratorTankSizeFunction, GTValues.LV, GTValues.MV, GTValues.HV); + public static final MachineDefinition[] GAS_TURBINE = registerSimpleGenerator("gas_turbine", + GTRecipeTypes.GAS_TURBINE_FUELS, genericGeneratorTankSizeFunction, GTValues.LV, GTValues.MV, GTValues.HV); ////////////////////////////////////// - //******** Electric ********// + // ******** Electric ********// ////////////////////////////////////// public static final MachineDefinition[] TRANSFORMER = registerTransformerMachines("", 1); public static final MachineDefinition[] HI_AMP_TRANSFORMER_2A = registerTransformerMachines("Hi-Amp (2x) ", 2); @@ -285,7 +351,8 @@ public class GTMachines { public static final MachineDefinition[] ENERGY_CONVERTER_8A = registerConverter(8); public static final MachineDefinition[] ENERGY_CONVERTER_16A = registerConverter(16); - public static final MachineDefinition LONG_DIST_ITEM_ENDPOINT = REGISTRATE.machine("long_distance_item_pipeline_endpoint", LDItemEndpointMachine::new) + public static final MachineDefinition LONG_DIST_ITEM_ENDPOINT = REGISTRATE + .machine("long_distance_item_pipeline_endpoint", LDItemEndpointMachine::new) .langValue("Long Distance Item Pipeline Endpoint") .rotationState(RotationState.ALL) .tier(LV) @@ -293,13 +360,15 @@ public class GTMachines { .tooltips(LangHandler.getMultiLang("gtceu.machine.endpoint.tooltip").toArray(Component[]::new)) .tooltipBuilder((stack, tooltip) -> { if (ConfigHolder.INSTANCE.machines.ldItemPipeMinDistance > 0) { - tooltip.add(Component.translatable("gtceu.machine.endpoint.tooltip.min_length", ConfigHolder.INSTANCE.machines.ldItemPipeMinDistance)); + tooltip.add(Component.translatable("gtceu.machine.endpoint.tooltip.min_length", + ConfigHolder.INSTANCE.machines.ldItemPipeMinDistance)); } }) .compassNode("ld_item_pipeline") .register(); - public static final MachineDefinition LONG_DIST_FLUID_ENDPOINT = REGISTRATE.machine("long_distance_fluid_pipeline_endpoint", LDFluidEndpointMachine::new) + public static final MachineDefinition LONG_DIST_FLUID_ENDPOINT = REGISTRATE + .machine("long_distance_fluid_pipeline_endpoint", LDFluidEndpointMachine::new) .langValue("Long Distance Fluid Pipeline Endpoint") .rotationState(RotationState.ALL) .tier(LV) @@ -309,7 +378,8 @@ public class GTMachines { Component.translatable("gtceu.machine.endpoint.tooltip.2")) .tooltipBuilder((stack, tooltip) -> { if (ConfigHolder.INSTANCE.machines.ldFluidPipeMinDistance > 0) { - tooltip.add(Component.translatable("gtceu.machine.endpoint.tooltip.min_length", ConfigHolder.INSTANCE.machines.ldItemPipeMinDistance)); + tooltip.add(Component.translatable("gtceu.machine.endpoint.tooltip.min_length", + ConfigHolder.INSTANCE.machines.ldItemPipeMinDistance)); } }) .compassNode("ld_fluid_pipeline") @@ -329,10 +399,15 @@ public class GTMachines { .renderer(() -> new TieredHullMachineRenderer(tier, GTCEu.id("block/machine/pump_machine"))) .langValue("%s Pump %s".formatted(VLVH[tier], VLVT[tier])) .tooltips(Component.translatable("gtceu.machine.pump.tooltip"), - Component.translatable("gtceu.universal.tooltip.voltage_in", GTValues.V[tier], GTValues.VNF[tier]), - Component.translatable("gtceu.universal.tooltip.energy_storage_capacity", GTValues.V[tier] * 64), - Component.translatable("gtceu.universal.tooltip.fluid_storage_capacity", 16 * FluidHelper.getBucket() * Math.max(1, tier)), - Component.translatable("gtceu.universal.tooltip.working_area", PumpMachine.BASE_PUMP_RANGE + PumpMachine.EXTRA_PUMP_RANGE * tier, PumpMachine.BASE_PUMP_RANGE + PumpMachine.EXTRA_PUMP_RANGE * tier)) + Component.translatable("gtceu.universal.tooltip.voltage_in", GTValues.V[tier], + GTValues.VNF[tier]), + Component.translatable("gtceu.universal.tooltip.energy_storage_capacity", + GTValues.V[tier] * 64), + Component.translatable("gtceu.universal.tooltip.fluid_storage_capacity", + 16 * FluidHelper.getBucket() * Math.max(1, tier)), + Component.translatable("gtceu.universal.tooltip.working_area", + PumpMachine.BASE_PUMP_RANGE + PumpMachine.EXTRA_PUMP_RANGE * tier, + PumpMachine.BASE_PUMP_RANGE + PumpMachine.EXTRA_PUMP_RANGE * tier)) .compassNode("pump") .register(), LV, MV, HV, EV); @@ -345,29 +420,38 @@ public class GTMachines { .langValue("%s Fisher %s".formatted(VLVH[tier], VLVT[tier])) .tooltips(Component.translatable("gtceu.machine.fisher.tooltip"), Component.translatable("gtceu.machine.fisher.speed", 1000 - tier * 200L), - Component.translatable("gtceu.machine.fisher.requirement", FisherMachine.WATER_CHECK_SIZE,FisherMachine.WATER_CHECK_SIZE), - Component.translatable("gtceu.universal.tooltip.voltage_in", GTValues.V[tier], GTValues.VNF[tier]), - Component.translatable("gtceu.universal.tooltip.energy_storage_capacity", GTValues.V[tier] * 64)) + Component.translatable("gtceu.machine.fisher.requirement", FisherMachine.WATER_CHECK_SIZE, + FisherMachine.WATER_CHECK_SIZE), + Component.translatable("gtceu.universal.tooltip.voltage_in", GTValues.V[tier], + GTValues.VNF[tier]), + Component.translatable("gtceu.universal.tooltip.energy_storage_capacity", + GTValues.V[tier] * 64)) .compassNode("fisher") .register(), LV, MV, HV, EV); - public static final MachineDefinition[] BLOCK_BREAKER = registerTieredMachines("block_breaker", BlockBreakerMachine::new, + public static final MachineDefinition[] BLOCK_BREAKER = registerTieredMachines("block_breaker", + BlockBreakerMachine::new, (tier, builder) -> builder .rotationState(RotationState.NON_Y_AXIS) - .editableUI(BlockBreakerMachine.EDITABLE_UI_CREATOR.apply(GTCEu.id("block_breaker"), (tier + 1) * (tier + 1))) - .renderer(() -> new TieredHullMachineRenderer(tier, GTCEu.id("block/machine/block_breaker_machine"))) + .editableUI(BlockBreakerMachine.EDITABLE_UI_CREATOR.apply(GTCEu.id("block_breaker"), + (tier + 1) * (tier + 1))) + .renderer( + () -> new TieredHullMachineRenderer(tier, GTCEu.id("block/machine/block_breaker_machine"))) .langValue("%s Block Breaker %s".formatted(VLVH[tier], VLVT[tier])) .tooltips(Component.translatable("gtceu.machine.block_breaker.tooltip"), - Component.translatable("gtceu.machine.block_breaker.speed_bonus", (int) (BlockBreakerMachine.getEfficiencyMultiplier(tier) * 100)), - Component.translatable("gtceu.universal.tooltip.voltage_in", GTValues.V[tier], GTValues.VNF[tier]), - Component.translatable("gtceu.universal.tooltip.energy_storage_capacity", GTValues.V[tier] * 64)) + Component.translatable("gtceu.machine.block_breaker.speed_bonus", + (int) (BlockBreakerMachine.getEfficiencyMultiplier(tier) * 100)), + Component.translatable("gtceu.universal.tooltip.voltage_in", GTValues.V[tier], + GTValues.VNF[tier]), + Component.translatable("gtceu.universal.tooltip.energy_storage_capacity", + GTValues.V[tier] * 64)) .compassNode("block_breaker") .register(), LV, MV, HV, EV); - - public static final MachineDefinition[] MINER = registerTieredMachines("miner", (holder, tier) -> new MinerMachine(holder, tier, 320 / (tier * 2), tier * 8, tier), + public static final MachineDefinition[] MINER = registerTieredMachines("miner", + (holder, tier) -> new MinerMachine(holder, tier, 320 / (tier * 2), tier * 8, tier), (tier, builder) -> builder .rotationState(RotationState.NON_Y_AXIS) .langValue("%s Miner %s".formatted(VLVH[tier], VLVT[tier])) @@ -382,85 +466,102 @@ public class GTMachines { tooltip.add(Component.translatable("gtceu.universal.tooltip.uses_per_tick", energyPerTick) .append(Component.literal(", ").withStyle(ChatFormatting.GRAY)) .append(Component.translatable("gtceu.machine.miner.per_block", tickSpeed / 20))); - tooltip.add(Component.translatable("gtceu.universal.tooltip.voltage_in", GTValues.V[tier], GTValues.VNF[tier])); - tooltip.add(Component.translatable("gtceu.universal.tooltip.energy_storage_capacity", GTValues.V[tier] * 64L)); + tooltip.add(Component.translatable("gtceu.universal.tooltip.voltage_in", GTValues.V[tier], + GTValues.VNF[tier])); + tooltip.add(Component.translatable("gtceu.universal.tooltip.energy_storage_capacity", + GTValues.V[tier] * 64L)); - tooltip.add(Component.translatable("gtceu.universal.tooltip.working_area_max", maxArea, maxArea)); + tooltip.add( + Component.translatable("gtceu.universal.tooltip.working_area_max", maxArea, maxArea)); }) .compassNode("miner") .register(), LV, MV, HV); - public static final MachineDefinition[] WORLD_ACCELERATOR = registerTieredMachines("world_accelerator", WorldAcceleratorMachine::new, - (tier, builder) -> builder - .rotationState(RotationState.NONE) - .langValue("%s World Accelerator %s".formatted(VLVH[tier], VLVT[tier])) - .recipeType(DUMMY_RECIPES) - .renderer(() -> new WorldAcceleratorRenderer(tier, GTCEu.id("block/machines/world_accelerator_te"),GTCEu.id("block/machines/world_accelerator"))) - .tooltipBuilder((stack, tooltip) -> { - int randTickWorkingArea = 3+(tier-1)*2; - tooltip.add(Component.translatable("gtceu.machine.world_accelerator.description")); - - tooltip.add(Component.translatable("gtceu.universal.tooltip.voltage_in", GTValues.V[tier], GTValues.VNF[tier])); - tooltip.add(Component.translatable("gtceu.universal.tooltip.energy_storage_capacity", GTValues.V[tier] * 64L)); - - tooltip.add(Component.translatable("gtceu.machine.world_accelerator.working_area")); - tooltip.add(Component.translatable("gtceu.machine.world_accelerator.working_area_tile")); - tooltip.add(Component.translatable("gtceu.machine.world_accelerator.working_area_random",randTickWorkingArea,randTickWorkingArea)); - }) - .compassNode("world_accelerator") - .register(), - LV, MV, HV, EV, IV, LuV, ZPM, UV); - + public static final MachineDefinition[] WORLD_ACCELERATOR = registerTieredMachines("world_accelerator", + WorldAcceleratorMachine::new, + (tier, builder) -> builder + .rotationState(RotationState.NONE) + .langValue("%s World Accelerator %s".formatted(VLVH[tier], VLVT[tier])) + .recipeType(DUMMY_RECIPES) + .renderer(() -> new WorldAcceleratorRenderer(tier, GTCEu.id("block/machines/world_accelerator_te"), + GTCEu.id("block/machines/world_accelerator"))) + .tooltipBuilder((stack, tooltip) -> { + int randTickWorkingArea = 3 + (tier - 1) * 2; + tooltip.add(Component.translatable("gtceu.machine.world_accelerator.description")); + + tooltip.add(Component.translatable("gtceu.universal.tooltip.voltage_in", GTValues.V[tier], + GTValues.VNF[tier])); + tooltip.add(Component.translatable("gtceu.universal.tooltip.energy_storage_capacity", + GTValues.V[tier] * 64L)); + + tooltip.add(Component.translatable("gtceu.machine.world_accelerator.working_area")); + tooltip.add(Component.translatable("gtceu.machine.world_accelerator.working_area_tile")); + tooltip.add(Component.translatable("gtceu.machine.world_accelerator.working_area_random", + randTickWorkingArea, randTickWorkingArea)); + }) + .compassNode("world_accelerator") + .register(), + LV, MV, HV, EV, IV, LuV, ZPM, UV); - public static final MachineDefinition[] ITEM_COLLECTOR = registerTieredMachines("item_collector", ItemCollectorMachine::new, - (tier, builder) -> builder - .rotationState(RotationState.NONE) - .langValue("%s Item Collector %s".formatted(VLVH[tier], VLVT[tier])) - .recipeType(DUMMY_RECIPES) - .editableUI(ItemCollectorMachine.EDITABLE_UI_CREATOR.apply(GTCEu.id("item_collector"), ItemCollectorMachine.getINVENTORY_SIZES()[tier])) - .renderer(() -> new WorkableTieredHullMachineRenderer(tier,GTCEu.id("block/machines/item_collector"))) - .tooltips( - Component.translatable("gtceu.machine.item_collector.tooltip"), - Component.translatable("gtceu.machine.item_collector.gui.collect_range", IntMath.pow(2, tier + 2), IntMath.pow(2, tier + 2)), - Component.translatable("gtceu.universal.tooltip.voltage_in", GTValues.V[tier], GTValues.VNF[tier]), - Component.translatable("gtceu.universal.tooltip.energy_storage_capacity", GTValues.V[tier] * 64L) - ) - .compassNode("item_collector") - .register(), - LV, MV, HV, EV); + public static final MachineDefinition[] ITEM_COLLECTOR = registerTieredMachines("item_collector", + ItemCollectorMachine::new, + (tier, builder) -> builder + .rotationState(RotationState.NONE) + .langValue("%s Item Collector %s".formatted(VLVH[tier], VLVT[tier])) + .recipeType(DUMMY_RECIPES) + .editableUI(ItemCollectorMachine.EDITABLE_UI_CREATOR.apply(GTCEu.id("item_collector"), + ItemCollectorMachine.getINVENTORY_SIZES()[tier])) + .renderer(() -> new WorkableTieredHullMachineRenderer(tier, + GTCEu.id("block/machines/item_collector"))) + .tooltips( + Component.translatable("gtceu.machine.item_collector.tooltip"), + Component.translatable("gtceu.machine.item_collector.gui.collect_range", + IntMath.pow(2, tier + 2), IntMath.pow(2, tier + 2)), + Component.translatable("gtceu.universal.tooltip.voltage_in", GTValues.V[tier], + GTValues.VNF[tier]), + Component.translatable("gtceu.universal.tooltip.energy_storage_capacity", + GTValues.V[tier] * 64L)) + .compassNode("item_collector") + .register(), + LV, MV, HV, EV); ////////////////////////////////////// - //********* Storage *********// + // ********* Storage *********// ////////////////////////////////////// - public static final MachineDefinition CREATIVE_ENERGY = REGISTRATE.machine("creative_energy", CreativeEnergyContainerMachine::new) - .rotationState(RotationState.NONE) - .tooltips(Component.translatable("gtceu.creative_tooltip.1"), - Component.translatable("gtceu.creative_tooltip.2").withStyle(style -> style.withColor(TooltipHelper.RAINBOW_SLOW.getCurrent())), - Component.translatable("gtceu.creative_tooltip.3")) - .compassNodeSelf() - .register(); + public static final MachineDefinition CREATIVE_ENERGY = REGISTRATE + .machine("creative_energy", CreativeEnergyContainerMachine::new) + .rotationState(RotationState.NONE) + .tooltips(Component.translatable("gtceu.creative_tooltip.1"), + Component.translatable("gtceu.creative_tooltip.2") + .withStyle(style -> style.withColor(TooltipHelper.RAINBOW_SLOW.getCurrent())), + Component.translatable("gtceu.creative_tooltip.3")) + .compassNodeSelf() + .register(); public static final MachineDefinition CREATIVE_FLUID = REGISTRATE.machine("creative_tank", CreativeTankMachine::new) - .rotationState(RotationState.ALL) - .tooltips(Component.translatable("gtceu.creative_tooltip.1"), - Component.translatable("gtceu.creative_tooltip.2").withStyle(style -> style.withColor(TooltipHelper.RAINBOW_SLOW.getCurrent())), - Component.translatable("gtceu.creative_tooltip.3")) - .compassNodeSelf() - .register(); - public static final MachineDefinition CREATIVE_ITEM = REGISTRATE.machine("creative_chest", CreativeChestMachine::new) - .rotationState(RotationState.ALL) - .tooltips(Component.translatable("gtceu.creative_tooltip.1"), - Component.translatable("gtceu.creative_tooltip.2").withStyle(style -> style.withColor(TooltipHelper.RAINBOW_SLOW.getCurrent())), - Component.translatable("gtceu.creative_tooltip.3")) - .compassNodeSelf() - .register(); - + .rotationState(RotationState.ALL) + .tooltips(Component.translatable("gtceu.creative_tooltip.1"), + Component.translatable("gtceu.creative_tooltip.2") + .withStyle(style -> style.withColor(TooltipHelper.RAINBOW_SLOW.getCurrent())), + Component.translatable("gtceu.creative_tooltip.3")) + .compassNodeSelf() + .register(); + public static final MachineDefinition CREATIVE_ITEM = REGISTRATE + .machine("creative_chest", CreativeChestMachine::new) + .rotationState(RotationState.ALL) + .tooltips(Component.translatable("gtceu.creative_tooltip.1"), + Component.translatable("gtceu.creative_tooltip.2") + .withStyle(style -> style.withColor(TooltipHelper.RAINBOW_SLOW.getCurrent())), + Component.translatable("gtceu.creative_tooltip.3")) + .compassNodeSelf() + .register(); public static BiConsumer> CHEST_TOOLTIPS = (stack, list) -> { if (stack.hasTag()) { ItemStack itemStack = ItemStack.of(stack.getOrCreateTagElement("stored")); int storedAmount = stack.getOrCreateTag().getInt("storedAmount"); - list.add(1, Component.translatable("gtceu.universal.tooltip.item_stored", itemStack.getDescriptionId(), storedAmount)); + list.add(1, Component.translatable("gtceu.universal.tooltip.item_stored", itemStack.getDescriptionId(), + storedAmount)); } }; @@ -473,13 +574,16 @@ public class GTMachines { .renderer(() -> new QuantumChestRenderer(tier)) .hasTESR(true) .tooltipBuilder(CHEST_TOOLTIPS) - .tooltips(Component.translatable("gtceu.machine.quantum_chest.tooltip"), Component.translatable("gtceu.universal.tooltip.item_storage_total", 4000000 * (int) Math.pow(2, tier))) + .tooltips(Component.translatable("gtceu.machine.quantum_chest.tooltip"), + Component.translatable("gtceu.universal.tooltip.item_storage_total", + 4000000 * (int) Math.pow(2, tier))) .compassNode("super_chest") .register(), LOW_TIERS); public static final MachineDefinition[] QUANTUM_CHEST = registerTieredMachines("quantum_chest", - (holder, tier) -> new QuantumChestMachine(holder, tier, tier == GTValues.UHV ? Integer.MAX_VALUE : 4000000 * (int) Math.pow(2, tier)), + (holder, tier) -> new QuantumChestMachine(holder, tier, + tier == GTValues.UHV ? Integer.MAX_VALUE : 4000000 * (int) Math.pow(2, tier)), (tier, builder) -> builder .langValue("Quantum Chest " + LVT[tier + 1 - LOW_TIERS[0]]) .blockProp(BlockBehaviour.Properties::dynamicShape) @@ -487,7 +591,9 @@ public class GTMachines { .renderer(() -> new QuantumChestRenderer(tier)) .hasTESR(true) .tooltipBuilder(CHEST_TOOLTIPS) - .tooltips(Component.translatable("gtceu.machine.quantum_chest.tooltip"), Component.translatable("gtceu.universal.tooltip.item_storage_total", /*tier == GTValues.UHV ? Integer.MAX_VALUE :*/ 4000000 * (int) Math.pow(2, tier))) + .tooltips(Component.translatable("gtceu.machine.quantum_chest.tooltip"), + Component.translatable("gtceu.universal.tooltip.item_storage_total", + /* tier == GTValues.UHV ? Integer.MAX_VALUE : */ 4000000 * (int) Math.pow(2, tier))) .compassNode("super_chest") .register(), HIGH_TIERS); @@ -496,13 +602,15 @@ public static BiConsumer> createTankTooltips(String n return (stack, list) -> { if (stack.hasTag()) { FluidStack tank = FluidStack.loadFromTag(stack.getOrCreateTagElement(nbtName)); - list.add(1, Component.translatable("gtceu.universal.tooltip.fluid_stored", tank.getDisplayName(), tank.getAmount())); + list.add(1, Component.translatable("gtceu.universal.tooltip.fluid_stored", tank.getDisplayName(), + tank.getAmount())); } }; } public static final MachineDefinition[] SUPER_TANK = registerTieredMachines("super_tank", - (holder, tier) -> new QuantumTankMachine(holder, tier, 4000 * FluidHelper.getBucket() * (int) Math.pow(2, tier)), + (holder, tier) -> new QuantumTankMachine(holder, tier, + 4000 * FluidHelper.getBucket() * (int) Math.pow(2, tier)), (tier, builder) -> builder .langValue("Super Tank " + LVT[tier + 1 - LOW_TIERS[0]]) .blockProp(BlockBehaviour.Properties::dynamicShape) @@ -510,13 +618,17 @@ public static BiConsumer> createTankTooltips(String n .renderer(() -> new QuantumTankRenderer(tier)) .hasTESR(true) .tooltipBuilder(createTankTooltips("stored")) - .tooltips(Component.translatable("gtceu.machine.quantum_tank.tooltip"), Component.translatable("gtceu.universal.tooltip.fluid_storage_capacity",4000000 * (int) Math.pow(2, tier))) + .tooltips(Component.translatable("gtceu.machine.quantum_tank.tooltip"), + Component.translatable("gtceu.universal.tooltip.fluid_storage_capacity", + 4000000 * (int) Math.pow(2, tier))) .compassNode("super_tank") .register(), LOW_TIERS); public static final MachineDefinition[] QUANTUM_TANK = registerTieredMachines("quantum_tank", - (holder, tier) -> new QuantumTankMachine(holder, tier, tier == GTValues.UHV ? Integer.MAX_VALUE : 4000 * FluidHelper.getBucket() * (int) Math.pow(2, tier)), + (holder, tier) -> new QuantumTankMachine(holder, tier, + tier == GTValues.UHV ? Integer.MAX_VALUE : + 4000 * FluidHelper.getBucket() * (int) Math.pow(2, tier)), (tier, builder) -> builder .langValue("Quantum Tank " + LVT[tier + 1 - LOW_TIERS[0]]) .blockProp(BlockBehaviour.Properties::dynamicShape) @@ -524,65 +636,76 @@ public static BiConsumer> createTankTooltips(String n .renderer(() -> new QuantumTankRenderer(tier)) .hasTESR(true) .tooltipBuilder(createTankTooltips("stored")) - .tooltips(Component.translatable("gtceu.machine.quantum_tank.tooltip"), Component.translatable("gtceu.universal.tooltip.fluid_storage_capacity", /*tier == GTValues.UHV ? Integer.MAX_VALUE :*/ 4000000 * (int) Math.pow(2, tier))) + .tooltips(Component.translatable("gtceu.machine.quantum_tank.tooltip"), + Component.translatable("gtceu.universal.tooltip.fluid_storage_capacity", + /* tier == GTValues.UHV ? Integer.MAX_VALUE : */ 4000000 * (int) Math.pow(2, tier))) .compassNode("super_tank") .register(), HIGH_TIERS); - // Multiblock Tanks public static final MachineDefinition WOODEN_TANK_VALVE = registerTankValve( - "wooden_tank_valve", "Wooden Tank Valve", false, - (builder, overlay) -> builder.sidedWorkableCasingRenderer("block/casings/wood_wall", overlay, false) - ); + "wooden_tank_valve", "Wooden Tank Valve", false, + (builder, overlay) -> builder.sidedWorkableCasingRenderer("block/casings/wood_wall", overlay, false)); public static final MultiblockMachineDefinition WOODEN_MULTIBLOCK_TANK = registerMultiblockTank( - "wooden_multiblock_tank", "Wooden Multiblock Tank", 250 * 1000, - CASING_WOOD_WALL, WOODEN_TANK_VALVE::getBlock, - new PropertyFluidFilter(340, false, false, false, false), - (builder, overlay) -> builder.sidedWorkableCasingRenderer("block/casings/wood_wall", overlay, false) - ); + "wooden_multiblock_tank", "Wooden Multiblock Tank", 250 * 1000, + CASING_WOOD_WALL, WOODEN_TANK_VALVE::getBlock, + new PropertyFluidFilter(340, false, false, false, false), + (builder, overlay) -> builder.sidedWorkableCasingRenderer("block/casings/wood_wall", overlay, false)); public static final MachineDefinition STEEL_TANK_VALVE = registerTankValve( - "steel_tank_valve", "Steel Tank Valve", true, - (builder, overlay) -> builder.workableCasingRenderer(GTCEu.id("block/casings/solid/machine_casing_solid_steel"), overlay, false) - ); + "steel_tank_valve", "Steel Tank Valve", true, + (builder, overlay) -> builder.workableCasingRenderer( + GTCEu.id("block/casings/solid/machine_casing_solid_steel"), overlay, false)); public static final MultiblockMachineDefinition STEEL_MULTIBLOCK_TANK = registerMultiblockTank( - "steel_multiblock_tank", "Steel Multiblock Tank", 1000 * 1000, - CASING_STEEL_SOLID, STEEL_TANK_VALVE::getBlock, - null, - (builder, overlay) -> builder.workableCasingRenderer(GTCEu.id("block/casings/solid/machine_casing_solid_steel"), overlay, false) - ); + "steel_multiblock_tank", "Steel Multiblock Tank", 1000 * 1000, + CASING_STEEL_SOLID, STEEL_TANK_VALVE::getBlock, + null, + (builder, overlay) -> builder.workableCasingRenderer( + GTCEu.id("block/casings/solid/machine_casing_solid_steel"), overlay, false)); public static MachineDefinition WOODEN_CRATE = registerCrate(GTMaterials.Wood, 27, "Wooden Crate"); public static MachineDefinition BRONZE_CRATE = registerCrate(GTMaterials.Bronze, 54, "Bronze Crate"); public static MachineDefinition STEEL_CRATE = registerCrate(GTMaterials.Steel, 72, "Steel Crate"); public static MachineDefinition ALUMINIUM_CRATE = registerCrate(GTMaterials.Aluminium, 90, "Aluminium Crate"); - public static MachineDefinition STAINLESS_STEEL_CRATE = registerCrate(GTMaterials.StainlessSteel, 108, "Stainless Steel Crate"); + public static MachineDefinition STAINLESS_STEEL_CRATE = registerCrate(GTMaterials.StainlessSteel, 108, + "Stainless Steel Crate"); public static MachineDefinition TITANIUM_CRATE = registerCrate(GTMaterials.Titanium, 126, "Titanium Crate"); - public static MachineDefinition TUNGSTENSTEEL_CRATE = registerCrate(GTMaterials.TungstenSteel, 144, "Tungstensteel Crate"); - - public static MachineDefinition WOODEN_DRUM = registerDrum(GTMaterials.Wood, (int) (16 * FluidHelper.getBucket()), "Wooden Barrel"); - public static MachineDefinition BRONZE_DRUM = registerDrum(GTMaterials.Bronze, (int) (32 * FluidHelper.getBucket()), "Bronze Drum"); - public static MachineDefinition STEEL_DRUM = registerDrum(GTMaterials.Steel, (int) (64 * FluidHelper.getBucket()), "Steel Drum"); - public static MachineDefinition ALUMINIUM_DRUM = registerDrum(GTMaterials.Aluminium, (int) (128 * FluidHelper.getBucket()), "Aluminium Drum"); - public static MachineDefinition STAINLESS_STEEL_DRUM = registerDrum(GTMaterials.StainlessSteel, (int) (256 * FluidHelper.getBucket()), "Stainless Steel Drum"); - public static MachineDefinition GOLD_DRUM = registerDrum(GTMaterials.Gold, (int) (32 * FluidHelper.getBucket()), "Gold Drum"); - public static MachineDefinition TITANIUM_DRUM = registerDrum(GTMaterials.Titanium, (int) (512 * FluidHelper.getBucket()), "Titanium Drum"); - public static MachineDefinition TUNGSTENSTEEL_DRUM = registerDrum(GTMaterials.TungstenSteel, (int) (1024 * FluidHelper.getBucket()), "Tungstensteel Drum"); - + public static MachineDefinition TUNGSTENSTEEL_CRATE = registerCrate(GTMaterials.TungstenSteel, 144, + "Tungstensteel Crate"); + + public static MachineDefinition WOODEN_DRUM = registerDrum(GTMaterials.Wood, (int) (16 * FluidHelper.getBucket()), + "Wooden Barrel"); + public static MachineDefinition BRONZE_DRUM = registerDrum(GTMaterials.Bronze, (int) (32 * FluidHelper.getBucket()), + "Bronze Drum"); + public static MachineDefinition STEEL_DRUM = registerDrum(GTMaterials.Steel, (int) (64 * FluidHelper.getBucket()), + "Steel Drum"); + public static MachineDefinition ALUMINIUM_DRUM = registerDrum(GTMaterials.Aluminium, + (int) (128 * FluidHelper.getBucket()), "Aluminium Drum"); + public static MachineDefinition STAINLESS_STEEL_DRUM = registerDrum(GTMaterials.StainlessSteel, + (int) (256 * FluidHelper.getBucket()), "Stainless Steel Drum"); + public static MachineDefinition GOLD_DRUM = registerDrum(GTMaterials.Gold, (int) (32 * FluidHelper.getBucket()), + "Gold Drum"); + public static MachineDefinition TITANIUM_DRUM = registerDrum(GTMaterials.Titanium, + (int) (512 * FluidHelper.getBucket()), "Titanium Drum"); + public static MachineDefinition TUNGSTENSTEEL_DRUM = registerDrum(GTMaterials.TungstenSteel, + (int) (1024 * FluidHelper.getBucket()), "Tungstensteel Drum"); ////////////////////////////////////// - //********** Part **********// + // ********** Part **********// ////////////////////////////////////// public static final MachineDefinition[] ITEM_IMPORT_BUS = registerTieredMachines("input_bus", (holder, tier) -> new ItemBusPartMachine(holder, tier, IO.IN), (tier, builder) -> builder .langValue(VNF[tier] + " Input Bus") .rotationState(RotationState.ALL) - .abilities(tier == 0 ? new PartAbility[] {PartAbility.IMPORT_ITEMS, PartAbility.STEAM_IMPORT_ITEMS} : new PartAbility[]{PartAbility.IMPORT_ITEMS}) + .abilities( + tier == 0 ? new PartAbility[] { PartAbility.IMPORT_ITEMS, PartAbility.STEAM_IMPORT_ITEMS } : + new PartAbility[] { PartAbility.IMPORT_ITEMS }) .overlayTieredHullRenderer("item_bus.import") .tooltips(Component.translatable("gtceu.machine.item_bus.import.tooltip"), - Component.translatable("gtceu.universal.tooltip.item_storage_capacity", (1 + Math.min(9, tier))*(1 + Math.min(9, tier)))) + Component.translatable("gtceu.universal.tooltip.item_storage_capacity", + (1 + Math.min(9, tier)) * (1 + Math.min(9, tier)))) .compassNode("item_bus") .register(), ALL_TIERS); @@ -592,51 +715,52 @@ public static BiConsumer> createTankTooltips(String n (tier, builder) -> builder .langValue(VNF[tier] + " Output Bus") .rotationState(RotationState.ALL) - .abilities(tier == 0 ? new PartAbility[] {PartAbility.EXPORT_ITEMS, PartAbility.STEAM_EXPORT_ITEMS} : new PartAbility[]{PartAbility.EXPORT_ITEMS}) + .abilities( + tier == 0 ? new PartAbility[] { PartAbility.EXPORT_ITEMS, PartAbility.STEAM_EXPORT_ITEMS } : + new PartAbility[] { PartAbility.EXPORT_ITEMS }) .overlayTieredHullRenderer("item_bus.export") .tooltips(Component.translatable("gtceu.machine.item_bus.export.tooltip"), - Component.translatable("gtceu.universal.tooltip.item_storage_capacity", (1 + Math.min(9, tier))*(1 + Math.min(9, tier)))) + Component.translatable("gtceu.universal.tooltip.item_storage_capacity", + (1 + Math.min(9, tier)) * (1 + Math.min(9, tier)))) .compassNode("item_bus") .register(), ALL_TIERS); public final static MachineDefinition[] FLUID_IMPORT_HATCH = registerFluidHatches( "input_hatch", "Input Hatch", "fluid_hatch.import", "fluid_hatch.import", - IO.IN, FluidHatchPartMachine.INITIAL_TANK_CAPACITY_1X, 1, - ALL_TIERS, PartAbility.IMPORT_FLUIDS, - PartAbility.IMPORT_FLUIDS_1X); + IO.IN, FluidHatchPartMachine.INITIAL_TANK_CAPACITY_1X, 1, + ALL_TIERS, PartAbility.IMPORT_FLUIDS, + PartAbility.IMPORT_FLUIDS_1X); public final static MachineDefinition[] FLUID_IMPORT_HATCH_4X = registerFluidHatches( "input_hatch_4x", "Quadruple Input Hatch", "fluid_hatch.import_4x", "fluid_hatch.import", - IO.IN, FluidHatchPartMachine.INITIAL_TANK_CAPACITY_4X, 4, - MULTI_HATCH_TIERS, PartAbility.IMPORT_FLUIDS, - PartAbility.IMPORT_FLUIDS_4X); + IO.IN, FluidHatchPartMachine.INITIAL_TANK_CAPACITY_4X, 4, + MULTI_HATCH_TIERS, PartAbility.IMPORT_FLUIDS, + PartAbility.IMPORT_FLUIDS_4X); public final static MachineDefinition[] FLUID_IMPORT_HATCH_9X = registerFluidHatches( "input_hatch_9x", "Nonuple Input Hatch", "fluid_hatch.import_9x", "fluid_hatch.import", - IO.IN, FluidHatchPartMachine.INITIAL_TANK_CAPACITY_9X, 9, - MULTI_HATCH_TIERS, PartAbility.IMPORT_FLUIDS, - PartAbility.IMPORT_FLUIDS_9X); - + IO.IN, FluidHatchPartMachine.INITIAL_TANK_CAPACITY_9X, 9, + MULTI_HATCH_TIERS, PartAbility.IMPORT_FLUIDS, + PartAbility.IMPORT_FLUIDS_9X); public final static MachineDefinition[] FLUID_EXPORT_HATCH = registerFluidHatches( "output_hatch", "Output Hatch", "fluid_hatch.export", "fluid_hatch.export", - IO.OUT, FluidHatchPartMachine.INITIAL_TANK_CAPACITY_1X, 1, - ALL_TIERS, PartAbility.EXPORT_FLUIDS, - PartAbility.EXPORT_FLUIDS_1X); - + IO.OUT, FluidHatchPartMachine.INITIAL_TANK_CAPACITY_1X, 1, + ALL_TIERS, PartAbility.EXPORT_FLUIDS, + PartAbility.EXPORT_FLUIDS_1X); public final static MachineDefinition[] FLUID_EXPORT_HATCH_4X = registerFluidHatches( "output_hatch_4x", "Quadruple Output Hatch", "fluid_hatch.export_4x", "fluid_hatch.export", - IO.OUT, FluidHatchPartMachine.INITIAL_TANK_CAPACITY_4X, 4, - MULTI_HATCH_TIERS, PartAbility.EXPORT_FLUIDS, - PartAbility.EXPORT_FLUIDS_4X); + IO.OUT, FluidHatchPartMachine.INITIAL_TANK_CAPACITY_4X, 4, + MULTI_HATCH_TIERS, PartAbility.EXPORT_FLUIDS, + PartAbility.EXPORT_FLUIDS_4X); public final static MachineDefinition[] FLUID_EXPORT_HATCH_9X = registerFluidHatches( "output_hatch_9x", "Nonuple Output Hatch", "fluid_hatch.export_9x", "fluid_hatch.export", - IO.OUT, FluidHatchPartMachine.INITIAL_TANK_CAPACITY_9X, 9, - MULTI_HATCH_TIERS, PartAbility.EXPORT_FLUIDS, - PartAbility.EXPORT_FLUIDS_9X); + IO.OUT, FluidHatchPartMachine.INITIAL_TANK_CAPACITY_9X, 9, + MULTI_HATCH_TIERS, PartAbility.EXPORT_FLUIDS, + PartAbility.EXPORT_FLUIDS_9X); public static final MachineDefinition[] ENERGY_INPUT_HATCH = registerTieredMachines("energy_input_hatch", (holder, tier) -> new EnergyHatchPartMachine(holder, tier, IO.IN, 2), @@ -672,7 +796,7 @@ public static BiConsumer> createTankTooltips(String n .overlayTieredHullRenderer("energy_hatch.input_4a") .compassNode("energy_hatch") .register(), - GTValues.tiersBetween(EV,GTCEuAPI.isHighTier() ? MAX : UHV)); + GTValues.tiersBetween(EV, GTCEuAPI.isHighTier() ? MAX : UHV)); public static final MachineDefinition[] ENERGY_OUTPUT_HATCH_4A = registerTieredMachines("energy_output_hatch_4a", (holder, tier) -> new EnergyHatchPartMachine(holder, tier, IO.OUT, 4), @@ -684,7 +808,7 @@ public static BiConsumer> createTankTooltips(String n .overlayTieredHullRenderer("energy_hatch.output_4a") .compassNode("energy_hatch") .register(), - GTValues.tiersBetween(EV,GTCEuAPI.isHighTier() ? MAX : UHV)); + GTValues.tiersBetween(EV, GTCEuAPI.isHighTier() ? MAX : UHV)); public static final MachineDefinition[] ENERGY_INPUT_HATCH_16A = registerTieredMachines("energy_input_hatch_16a", (holder, tier) -> new EnergyHatchPartMachine(holder, tier, IO.IN, 16), @@ -696,7 +820,7 @@ public static BiConsumer> createTankTooltips(String n .overlayTieredHullRenderer("energy_hatch.input_16a") .compassNode("energy_hatch") .register(), - GTValues.tiersBetween(EV,GTCEuAPI.isHighTier() ? MAX : UHV)); + GTValues.tiersBetween(EV, GTCEuAPI.isHighTier() ? MAX : UHV)); public static final MachineDefinition[] ENERGY_OUTPUT_HATCH_16A = registerTieredMachines("energy_output_hatch_16a", (holder, tier) -> new EnergyHatchPartMachine(holder, tier, IO.OUT, 16), @@ -708,9 +832,10 @@ public static BiConsumer> createTankTooltips(String n .overlayTieredHullRenderer("energy_hatch.output_16a") .compassNode("energy_hatch") .register(), - GTValues.tiersBetween(EV,GTCEuAPI.isHighTier() ? MAX : UHV)); + GTValues.tiersBetween(EV, GTCEuAPI.isHighTier() ? MAX : UHV)); - public static final MachineDefinition[] SUBSTATION_ENERGY_INPUT_HATCH = registerTieredMachines("substation_input_hatch_64a", + public static final MachineDefinition[] SUBSTATION_ENERGY_INPUT_HATCH = registerTieredMachines( + "substation_input_hatch_64a", (holder, tier) -> new EnergyHatchPartMachine(holder, tier, IO.IN, 64), (tier, builder) -> builder .langValue(VNF[tier] + " 64A Substation Energy Hatch") @@ -720,9 +845,10 @@ public static BiConsumer> createTankTooltips(String n .overlayTieredHullRenderer("energy_hatch.input_16a") .compassNode("energy_hatch") .register(), - GTValues.tiersBetween(EV,GTCEuAPI.isHighTier() ? MAX : UHV)); + GTValues.tiersBetween(EV, GTCEuAPI.isHighTier() ? MAX : UHV)); - public static final MachineDefinition[] SUBSTATION_ENERGY_OUTPUT_HATCH = registerTieredMachines("substation_output_hatch_64a", + public static final MachineDefinition[] SUBSTATION_ENERGY_OUTPUT_HATCH = registerTieredMachines( + "substation_output_hatch_64a", (holder, tier) -> new EnergyHatchPartMachine(holder, tier, IO.OUT, 64), (tier, builder) -> builder .langValue(VNF[tier] + " 64A Substation Dynamo Hatch") @@ -732,7 +858,7 @@ public static BiConsumer> createTankTooltips(String n .overlayTieredHullRenderer("energy_hatch.output_16a") .compassNode("energy_hatch") .register(), - GTValues.tiersBetween(EV,GTCEuAPI.isHighTier() ? MAX : UHV)); + GTValues.tiersBetween(EV, GTCEuAPI.isHighTier() ? MAX : UHV)); public static final MachineDefinition[] MUFFLER_HATCH = registerTieredMachines("muffler_hatch", MufflerPartMachine::new, @@ -744,12 +870,14 @@ public static BiConsumer> createTankTooltips(String n .tooltips(LangHandler.getFromMultiLang("gtceu.machine.muffler_hatch.tooltip", 0), Component.translatable("gtceu.muffler.recovery_tooltip", Math.max(1, tier * 10)), Component.translatable("gtceu.universal.enabled"), - LangHandler.getFromMultiLang("gtceu.machine.muffler_hatch.tooltip", 1).withStyle(ChatFormatting.DARK_RED)) + LangHandler.getFromMultiLang("gtceu.machine.muffler_hatch.tooltip", 1) + .withStyle(ChatFormatting.DARK_RED)) .compassNode("muffler_hatch") .register(), ELECTRIC_TIERS); - public static final MachineDefinition STEAM_IMPORT_BUS = REGISTRATE.machine("steam_input_bus", holder -> new SteamItemBusPartMachine(holder, IO.IN)) + public static final MachineDefinition STEAM_IMPORT_BUS = REGISTRATE + .machine("steam_input_bus", holder -> new SteamItemBusPartMachine(holder, IO.IN)) .rotationState(RotationState.ALL) .abilities(PartAbility.STEAM_IMPORT_ITEMS) .overlaySteamHullRenderer("item_bus.import") @@ -758,7 +886,8 @@ public static BiConsumer> createTankTooltips(String n .compassNode("item_bus") .register(); - public static final MachineDefinition STEAM_EXPORT_BUS = REGISTRATE.machine("steam_output_bus", holder -> new SteamItemBusPartMachine(holder, IO.OUT)) + public static final MachineDefinition STEAM_EXPORT_BUS = REGISTRATE + .machine("steam_output_bus", holder -> new SteamItemBusPartMachine(holder, IO.OUT)) .rotationState(RotationState.ALL) .abilities(PartAbility.STEAM_EXPORT_ITEMS) .overlaySteamHullRenderer("item_bus.export") @@ -767,11 +896,14 @@ public static BiConsumer> createTankTooltips(String n .compassNode("item_bus") .register(); - public static final MachineDefinition STEAM_HATCH = REGISTRATE.machine("steam_input_hatch", SteamHatchPartMachine::new) + public static final MachineDefinition STEAM_HATCH = REGISTRATE + .machine("steam_input_hatch", SteamHatchPartMachine::new) .rotationState(RotationState.ALL) .abilities(PartAbility.STEAM) .overlaySteamHullRenderer("steam_hatch") - .tooltips(Component.translatable("gtceu.universal.tooltip.fluid_storage_capacity", SteamHatchPartMachine.INITIAL_TANK_CAPACITY), + .tooltips( + Component.translatable("gtceu.universal.tooltip.fluid_storage_capacity", + SteamHatchPartMachine.INITIAL_TANK_CAPACITY), Component.translatable("gtceu.machine.steam.steam_hatch.tooltip")) .compassSections(GTCompassSections.STEAM) .compassNode("steam_hatch") @@ -792,7 +924,8 @@ public static BiConsumer> createTankTooltips(String n .compassNode("pump_hatch") .register(); - public static final MachineDefinition MAINTENANCE_HATCH = REGISTRATE.machine("maintenance_hatch", (blockEntity) -> new MaintenanceHatchPartMachine(blockEntity, false)) + public static final MachineDefinition MAINTENANCE_HATCH = REGISTRATE + .machine("maintenance_hatch", (blockEntity) -> new MaintenanceHatchPartMachine(blockEntity, false)) .rotationState(RotationState.ALL) .abilities(PartAbility.MAINTENANCE) .tooltips(Component.translatable("gtceu.universal.disabled")) @@ -800,15 +933,19 @@ public static BiConsumer> createTankTooltips(String n .compassNodeSelf() .register(); - public static final MachineDefinition CONFIGURABLE_MAINTENANCE_HATCH = REGISTRATE.machine("configurable_maintenance_hatch", (blockEntity) -> new MaintenanceHatchPartMachine(blockEntity, true)) + public static final MachineDefinition CONFIGURABLE_MAINTENANCE_HATCH = REGISTRATE + .machine("configurable_maintenance_hatch", + (blockEntity) -> new MaintenanceHatchPartMachine(blockEntity, true)) .rotationState(RotationState.ALL) .abilities(PartAbility.MAINTENANCE) .tooltips(Component.translatable("gtceu.universal.disabled")) - .renderer(() -> new MaintenanceHatchPartRenderer(3, GTCEu.id("block/machine/part/maintenance.configurable"))) + .renderer( + () -> new MaintenanceHatchPartRenderer(3, GTCEu.id("block/machine/part/maintenance.configurable"))) .compassNodeSelf() .register(); - public static final MachineDefinition CLEANING_MAINTENANCE_HATCH = REGISTRATE.machine("cleaning_maintenance_hatch", CleaningMaintenanceHatchPartMachine::new) + public static final MachineDefinition CLEANING_MAINTENANCE_HATCH = REGISTRATE + .machine("cleaning_maintenance_hatch", CleaningMaintenanceHatchPartMachine::new) .rotationState(RotationState.ALL) .abilities(PartAbility.MAINTENANCE) .tooltips(Component.translatable("gtceu.universal.disabled"), @@ -816,14 +953,16 @@ public static BiConsumer> createTankTooltips(String n Component.translatable("gtceu.machine.maintenance_hatch_cleanroom_auto.tooltip.1")) .tooltipBuilder((stack, tooltips) -> { for (CleanroomType type : CleaningMaintenanceHatchPartMachine.getCleanroomTypes()) { - tooltips.add(Component.literal(String.format(" %s%s", ChatFormatting.GREEN, Component.translatable(type.getTranslationKey()).getString()))); + tooltips.add(Component.literal(String.format(" %s%s", ChatFormatting.GREEN, + Component.translatable(type.getTranslationKey()).getString()))); } }) .renderer(() -> new MaintenanceHatchPartRenderer(3, GTCEu.id("block/machine/part/maintenance.cleaning"))) .compassNodeSelf() .register(); - public static final MachineDefinition AUTO_MAINTENANCE_HATCH = REGISTRATE.machine("auto_maintenance_hatch", AutoMaintenanceHatchPartMachine::new) + public static final MachineDefinition AUTO_MAINTENANCE_HATCH = REGISTRATE + .machine("auto_maintenance_hatch", AutoMaintenanceHatchPartMachine::new) .rotationState(RotationState.ALL) .abilities(PartAbility.MAINTENANCE) .tooltips(Component.translatable("gtceu.universal.disabled")) @@ -831,7 +970,6 @@ public static BiConsumer> createTankTooltips(String n .compassNodeSelf() .register(); - public static final MachineDefinition[] ITEM_PASSTHROUGH_HATCH = registerTieredMachines("item_passthrough_hatch", (holder, tier) -> new ItemBusPartMachine(holder, tier, IO.BOTH), (tier, builder) -> builder @@ -839,20 +977,25 @@ public static BiConsumer> createTankTooltips(String n .rotationState(RotationState.ALL) .abilities(PartAbility.PASSTHROUGH_HATCH) .overlayTieredHullRenderer("item_passthrough_hatch") - .tooltips(Component.translatable("gtceu.universal.tooltip.item_storage_capacity", (1 + Math.min(9, tier)) * (1 + Math.min(9, tier))), + .tooltips( + Component.translatable("gtceu.universal.tooltip.item_storage_capacity", + (1 + Math.min(9, tier)) * (1 + Math.min(9, tier))), Component.translatable("gtceu.universal.enabled")) .compassNode("item_passthrough_hatch") .register(), ELECTRIC_TIERS); public static final MachineDefinition[] FLUID_PASSTHROUGH_HATCH = registerTieredMachines("fluid_passthrough_hatch", - (holder, tier) -> new FluidHatchPartMachine(holder, tier, IO.BOTH, FluidHatchPartMachine.INITIAL_TANK_CAPACITY_1X, 1), + (holder, tier) -> new FluidHatchPartMachine(holder, tier, IO.BOTH, + FluidHatchPartMachine.INITIAL_TANK_CAPACITY_1X, 1), (tier, builder) -> builder .langValue("%s Fluid Passthrough Hatch".formatted(VNF[tier])) .rotationState(RotationState.ALL) .abilities(PartAbility.PASSTHROUGH_HATCH) .overlayTieredHullRenderer("fluid_passthrough_hatch") - .tooltips(Component.translatable("gtceu.universal.tooltip.fluid_storage_capacity_mult", tier + 1, 16 * FluidHelper.getBucket()), + .tooltips( + Component.translatable("gtceu.universal.tooltip.fluid_storage_capacity_mult", tier + 1, + 16 * FluidHelper.getBucket()), Component.translatable("gtceu.universal.enabled")) .compassNode("fluid_passthrough_hatch") .register(), @@ -867,8 +1010,10 @@ public static BiConsumer> createTankTooltips(String n .overlayTieredHullRenderer("diode") .tooltips(Component.translatable("gtceu.machine.diode.tooltip_general"), Component.translatable("gtceu.machine.diode.tooltip_starts_at"), - Component.translatable("gtceu.universal.tooltip.voltage_in_out", GTValues.V[tier], GTValues.VNF[tier]), - Component.translatable("gtceu.universal.tooltip.amperage_in_out_till", DiodePartMachine.MAX_AMPS)) + Component.translatable("gtceu.universal.tooltip.voltage_in_out", GTValues.V[tier], + GTValues.VNF[tier]), + Component.translatable("gtceu.universal.tooltip.amperage_in_out_till", + DiodePartMachine.MAX_AMPS)) .compassNode("diode") .register(), ELECTRIC_TIERS); @@ -887,24 +1032,37 @@ public static BiConsumer> createTankTooltips(String n .register(), HV, EV, IV, LuV, ZPM, UV); - public static final MachineDefinition[] LASER_INPUT_HATCH_256 = registerLaserHatch(IO.IN, 256, PartAbility.INPUT_LASER); - public static final MachineDefinition[] LASER_OUTPUT_HATCH_256 = registerLaserHatch(IO.OUT, 256, PartAbility.OUTPUT_LASER); - public static final MachineDefinition[] LASER_INPUT_HATCH_1024 = registerLaserHatch(IO.IN, 1024, PartAbility.INPUT_LASER); - public static final MachineDefinition[] LASER_OUTPUT_HATCH_1024 = registerLaserHatch(IO.OUT, 1024, PartAbility.OUTPUT_LASER); - public static final MachineDefinition[] LASER_INPUT_HATCH_4096 = registerLaserHatch(IO.IN, 4096, PartAbility.INPUT_LASER); - public static final MachineDefinition[] LASER_OUTPUT_HATCH_4096 = registerLaserHatch(IO.OUT, 4096, PartAbility.OUTPUT_LASER); + public static final MachineDefinition[] LASER_INPUT_HATCH_256 = registerLaserHatch(IO.IN, 256, + PartAbility.INPUT_LASER); + public static final MachineDefinition[] LASER_OUTPUT_HATCH_256 = registerLaserHatch(IO.OUT, 256, + PartAbility.OUTPUT_LASER); + public static final MachineDefinition[] LASER_INPUT_HATCH_1024 = registerLaserHatch(IO.IN, 1024, + PartAbility.INPUT_LASER); + public static final MachineDefinition[] LASER_OUTPUT_HATCH_1024 = registerLaserHatch(IO.OUT, 1024, + PartAbility.OUTPUT_LASER); + public static final MachineDefinition[] LASER_INPUT_HATCH_4096 = registerLaserHatch(IO.IN, 4096, + PartAbility.INPUT_LASER); + public static final MachineDefinition[] LASER_OUTPUT_HATCH_4096 = registerLaserHatch(IO.OUT, 4096, + PartAbility.OUTPUT_LASER); ////////////////////////////////////// - //******* Multiblock *******// + // ******* Multiblock *******// ////////////////////////////////////// - public static final MultiblockMachineDefinition LARGE_BOILER_BRONZE = registerLargeBoiler("bronze", CASING_BRONZE_BRICKS, CASING_BRONZE_PIPE, FIREBOX_BRONZE, - GTCEu.id("block/casings/solid/machine_casing_bronze_plated_bricks"), BoilerFireboxType.BRONZE_FIREBOX, 800, 1); - public static final MultiblockMachineDefinition LARGE_BOILER_STEEL = registerLargeBoiler("steel", CASING_STEEL_SOLID, CASING_STEEL_PIPE, FIREBOX_STEEL, + public static final MultiblockMachineDefinition LARGE_BOILER_BRONZE = registerLargeBoiler("bronze", + CASING_BRONZE_BRICKS, CASING_BRONZE_PIPE, FIREBOX_BRONZE, + GTCEu.id("block/casings/solid/machine_casing_bronze_plated_bricks"), BoilerFireboxType.BRONZE_FIREBOX, 800, + 1); + public static final MultiblockMachineDefinition LARGE_BOILER_STEEL = registerLargeBoiler("steel", + CASING_STEEL_SOLID, CASING_STEEL_PIPE, FIREBOX_STEEL, GTCEu.id("block/casings/solid/machine_casing_solid_steel"), BoilerFireboxType.STEEL_FIREBOX, 1800, 1); - public static final MultiblockMachineDefinition LARGE_BOILER_TITANIUM = registerLargeBoiler("titanium", CASING_TITANIUM_STABLE, CASING_TITANIUM_PIPE, FIREBOX_TITANIUM, - GTCEu.id("block/casings/solid/machine_casing_stable_titanium"), BoilerFireboxType.TITANIUM_FIREBOX, 3200, 1); - public static final MultiblockMachineDefinition LARGE_BOILER_TUNGSTENSTEEL = registerLargeBoiler("tungstensteel", CASING_TUNGSTENSTEEL_ROBUST, CASING_TUNGSTENSTEEL_PIPE, FIREBOX_TUNGSTENSTEEL, - GTCEu.id("block/casings/solid/machine_casing_robust_tungstensteel"), BoilerFireboxType.TUNGSTENSTEEL_FIREBOX, 6400, 2); + public static final MultiblockMachineDefinition LARGE_BOILER_TITANIUM = registerLargeBoiler("titanium", + CASING_TITANIUM_STABLE, CASING_TITANIUM_PIPE, FIREBOX_TITANIUM, + GTCEu.id("block/casings/solid/machine_casing_stable_titanium"), BoilerFireboxType.TITANIUM_FIREBOX, 3200, + 1); + public static final MultiblockMachineDefinition LARGE_BOILER_TUNGSTENSTEEL = registerLargeBoiler("tungstensteel", + CASING_TUNGSTENSTEEL_ROBUST, CASING_TUNGSTENSTEEL_PIPE, FIREBOX_TUNGSTENSTEEL, + GTCEu.id("block/casings/solid/machine_casing_robust_tungstensteel"), + BoilerFireboxType.TUNGSTENSTEEL_FIREBOX, 6400, 2); public static final MultiblockMachineDefinition COKE_OVEN = REGISTRATE.multiblock("coke_oven", CokeOvenMachine::new) .rotationState(RotationState.NON_Y_AXIS) @@ -914,7 +1072,8 @@ public static BiConsumer> createTankTooltips(String n .aisle("XXX", "XXX", "XXX") .aisle("XXX", "X#X", "XXX") .aisle("XXX", "XYX", "XXX") - .where('X', blocks(CASING_COKE_BRICKS.get()).or(blocks(COKE_OVEN_HATCH.get()).setMaxGlobalLimited(5))) + .where('X', + blocks(CASING_COKE_BRICKS.get()).or(blocks(COKE_OVEN_HATCH.get()).setMaxGlobalLimited(5))) .where('#', Predicates.air()) .where('Y', Predicates.controller(blocks(definition.getBlock()))) .build()) @@ -924,7 +1083,8 @@ public static BiConsumer> createTankTooltips(String n .compassNodeSelf() .register(); - public static final MultiblockMachineDefinition PRIMITIVE_BLAST_FURNACE = REGISTRATE.multiblock("primitive_blast_furnace", PrimitiveBlastFurnaceMachine::new) + public static final MultiblockMachineDefinition PRIMITIVE_BLAST_FURNACE = REGISTRATE + .multiblock("primitive_blast_furnace", PrimitiveBlastFurnaceMachine::new) .rotationState(RotationState.NON_Y_AXIS) .recipeType(GTRecipeTypes.PRIMITIVE_BLAST_FURNACE_RECIPES) .appearanceBlock(CASING_PRIMITIVE_BRICKS) @@ -942,7 +1102,8 @@ public static BiConsumer> createTankTooltips(String n .compassNodeSelf() .register(); - public static final MultiblockMachineDefinition ELECTRIC_BLAST_FURNACE = REGISTRATE.multiblock("electric_blast_furnace", CoilWorkableElectricMultiblockMachine::new) + public static final MultiblockMachineDefinition ELECTRIC_BLAST_FURNACE = REGISTRATE + .multiblock("electric_blast_furnace", CoilWorkableElectricMultiblockMachine::new) .rotationState(RotationState.NON_Y_AXIS) .recipeType(GTRecipeTypes.BLAST_RECIPES) .recipeModifier(GTRecipeModifiers::ebfOverclock) @@ -977,10 +1138,12 @@ public static BiConsumer> createTankTooltips(String n .where('M', MAINTENANCE_HATCH, Direction.NORTH); GTCEuAPI.HEATING_COILS.entrySet().stream() .sorted(Comparator.comparingInt(entry -> entry.getKey().getTier())) - .forEach(coil -> shapeInfo.add(builder.shallowCopy().where('C', coil.getValue().get()).build())); + .forEach( + coil -> shapeInfo.add(builder.shallowCopy().where('C', coil.getValue().get()).build())); return shapeInfo; }) - .recoveryItems(() -> new ItemLike[]{GTItems.MATERIAL_ITEMS.get(TagPrefix.dustTiny, GTMaterials.Ash).get()}) + .recoveryItems( + () -> new ItemLike[] { GTItems.MATERIAL_ITEMS.get(TagPrefix.dustTiny, GTMaterials.Ash).get() }) .workableCasingRenderer(GTCEu.id("block/casings/solid/machine_casing_heatproof"), GTCEu.id("block/multiblock/electric_blast_furnace"), false) .tooltips(Component.translatable("gtceu.machine.electric_blast_furnace.tooltip.0"), @@ -989,14 +1152,21 @@ public static BiConsumer> createTankTooltips(String n .additionalDisplay((controller, components) -> { if (controller instanceof CoilWorkableElectricMultiblockMachine coilMachine && controller.isFormed()) { components.add(Component.translatable("gtceu.multiblock.blast_furnace.max_temperature", - Component.translatable(FormattingUtil.formatNumbers(coilMachine.getCoilType().getCoilTemperature() + 100L * Math.max(0, coilMachine.getTier() - GTValues.MV)) + "K").setStyle(Style.EMPTY.withColor(ChatFormatting.RED)))); + Component + .translatable( + FormattingUtil + .formatNumbers(coilMachine.getCoilType().getCoilTemperature() + + 100L * Math.max(0, coilMachine.getTier() - GTValues.MV)) + + "K") + .setStyle(Style.EMPTY.withColor(ChatFormatting.RED)))); } }) .compassSections(GTCompassSections.TIER[MV]) .compassNodeSelf() .register(); - public static final MultiblockMachineDefinition LARGE_CHEMICAL_REACTOR = REGISTRATE.multiblock("large_chemical_reactor", WorkableElectricMultiblockMachine::new) + public static final MultiblockMachineDefinition LARGE_CHEMICAL_REACTOR = REGISTRATE + .multiblock("large_chemical_reactor", WorkableElectricMultiblockMachine::new) .rotationState(RotationState.NON_Y_AXIS) .recipeType(GTRecipeTypes.LARGE_CHEMICAL_RECIPES) .recipeModifier(GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.PERFECT_OVERCLOCK)) @@ -1034,32 +1204,27 @@ public static BiConsumer> createTankTooltips(String n .aisle("IXO", "FSH", "XMX") .aisle("XXX", "XPX", "XXX") .aisle("XEX", "XCX", "XXX") - .build() - ); + .build()); shapeInfo.add(baseBuilder.shallowCopy() .aisle("IXO", "FSH", "XMX") .aisle("XXX", "XPX", "XCX") .aisle("XEX", "XXX", "XXX") - .build() - ); + .build()); shapeInfo.add(baseBuilder.shallowCopy() .aisle("IXO", "FSH", "XMX") .aisle("XCX", "XPX", "XXX") .aisle("XEX", "XXX", "XXX") - .build() - ); + .build()); shapeInfo.add(baseBuilder.shallowCopy() .aisle("IXO", "FSH", "XMX") .aisle("XXX", "CPX", "XXX") .aisle("XEX", "XXX", "XXX") - .build() - ); + .build()); shapeInfo.add(baseBuilder.shallowCopy() .aisle("IXO", "FSH", "XMX") .aisle("XXX", "XPC", "XXX") .aisle("XEX", "XXX", "XXX") - .build() - ); + .build()); return shapeInfo; }) .workableCasingRenderer(GTCEu.id("block/casings/solid/machine_casing_inert_ptfe"), @@ -1068,7 +1233,8 @@ public static BiConsumer> createTankTooltips(String n .compassNodeSelf() .register(); - public static final MultiblockMachineDefinition IMPLOSION_COMPRESSOR = REGISTRATE.multiblock("implosion_compressor", WorkableElectricMultiblockMachine::new) + public static final MultiblockMachineDefinition IMPLOSION_COMPRESSOR = REGISTRATE + .multiblock("implosion_compressor", WorkableElectricMultiblockMachine::new) .rotationState(RotationState.NON_Y_AXIS) .recipeType(GTRecipeTypes.IMPLOSION_RECIPES) .recipeModifier(GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) @@ -1089,7 +1255,8 @@ public static BiConsumer> createTankTooltips(String n .compassNodeSelf() .register(); - public static final MultiblockMachineDefinition PYROLYSE_OVEN = REGISTRATE.multiblock("pyrolyse_oven", CoilWorkableElectricMultiblockMachine::new) + public static final MultiblockMachineDefinition PYROLYSE_OVEN = REGISTRATE + .multiblock("pyrolyse_oven", CoilWorkableElectricMultiblockMachine::new) .rotationState(RotationState.NON_Y_AXIS) .recipeType(GTRecipeTypes.PYROLYSE_RECIPES) .recipeModifier(GTRecipeModifiers::pyrolyseOvenOverclock) @@ -1100,52 +1267,59 @@ public static BiConsumer> createTankTooltips(String n .aisle("CCC", "C#C", "CCC") .aisle("XXX", "XSX", "XXX") .where('S', Predicates.controller(blocks(definition.get()))) - .where('X', blocks(MACHINE_CASING_ULV.get()).setMinGlobalLimited(6).or(Predicates.autoAbilities(definition.getRecipeTypes())) - .or(Predicates.autoAbilities(true, true, false))) + .where('X', + blocks(MACHINE_CASING_ULV.get()).setMinGlobalLimited(6) + .or(Predicates.autoAbilities(definition.getRecipeTypes())) + .or(Predicates.autoAbilities(true, true, false))) .where('C', Predicates.heatingCoils()) .where('#', Predicates.air()) .build()) .shapeInfos(definition -> { List shapeInfo = new ArrayList<>(); - var builder = MultiblockShapeInfo.builder() - .aisle("IXO", "XSX", "FMD") - .aisle("CCC", "C#C", "CCC") - .aisle("CCC", "C#C", "CCC") - .aisle("EEX", "XHX", "XXX") - .where('S', definition, Direction.NORTH) - .where('X', MACHINE_CASING_ULV.getDefaultState()) - .where('E', ENERGY_INPUT_HATCH[GTValues.LV], Direction.SOUTH) - .where('I', ITEM_IMPORT_BUS[GTValues.LV], Direction.NORTH) - .where('O', ITEM_EXPORT_BUS[GTValues.LV], Direction.NORTH) - .where('F', FLUID_IMPORT_HATCH[GTValues.LV], Direction.NORTH) - .where('D', FLUID_EXPORT_HATCH[GTValues.LV], Direction.NORTH) - .where('H', MUFFLER_HATCH[GTValues.LV], Direction.SOUTH) - .where('M', MAINTENANCE_HATCH, Direction.NORTH) - .where('#', Blocks.AIR.defaultBlockState()); + var builder = MultiblockShapeInfo.builder() + .aisle("IXO", "XSX", "FMD") + .aisle("CCC", "C#C", "CCC") + .aisle("CCC", "C#C", "CCC") + .aisle("EEX", "XHX", "XXX") + .where('S', definition, Direction.NORTH) + .where('X', MACHINE_CASING_ULV.getDefaultState()) + .where('E', ENERGY_INPUT_HATCH[GTValues.LV], Direction.SOUTH) + .where('I', ITEM_IMPORT_BUS[GTValues.LV], Direction.NORTH) + .where('O', ITEM_EXPORT_BUS[GTValues.LV], Direction.NORTH) + .where('F', FLUID_IMPORT_HATCH[GTValues.LV], Direction.NORTH) + .where('D', FLUID_EXPORT_HATCH[GTValues.LV], Direction.NORTH) + .where('H', MUFFLER_HATCH[GTValues.LV], Direction.SOUTH) + .where('M', MAINTENANCE_HATCH, Direction.NORTH) + .where('#', Blocks.AIR.defaultBlockState()); GTCEuAPI.HEATING_COILS.entrySet().stream() .sorted(Comparator.comparingInt(entry -> entry.getKey().getTier())) - .forEach(coil -> shapeInfo.add(builder.shallowCopy().where('C', coil.getValue().get()).build())); + .forEach( + coil -> shapeInfo.add(builder.shallowCopy().where('C', coil.getValue().get()).build())); return shapeInfo; }) .workableCasingRenderer(GTCEu.id("block/casings/voltage/ulv/side"), GTCEu.id("block/multiblock/pyrolyse_oven"), false) .tooltips(Component.translatable("gtceu.machine.pyrolyse_oven.tooltip"), - Component.translatable("gtceu.machine.pyrolyse_oven.tooltip.1")) + Component.translatable("gtceu.machine.pyrolyse_oven.tooltip.1")) .additionalDisplay((controller, components) -> { if (controller instanceof CoilWorkableElectricMultiblockMachine coilMachine && controller.isFormed()) { - components.add(Component.translatable("gtceu.multiblock.pyrolyse_oven.speed", coilMachine.getCoilTier() == 0 ? 75 : 50 * (coilMachine.getCoilTier() + 1))); + components.add(Component.translatable("gtceu.multiblock.pyrolyse_oven.speed", + coilMachine.getCoilTier() == 0 ? 75 : 50 * (coilMachine.getCoilTier() + 1))); } }) .compassSections(GTCompassSections.TIER[MV]) .compassNodeSelf() .register(); - public static final MultiblockMachineDefinition MULTI_SMELTER = REGISTRATE.multiblock("multi_smelter", CoilWorkableElectricMultiblockMachine::new) + public static final MultiblockMachineDefinition MULTI_SMELTER = REGISTRATE + .multiblock("multi_smelter", CoilWorkableElectricMultiblockMachine::new) .rotationState(RotationState.NON_Y_AXIS) .recipeTypes(GTRecipeTypes.FURNACE_RECIPES, GTRecipeTypes.ALLOY_SMELTER_RECIPES) - .recipeModifiers(GTRecipeModifiers::multiSmelterParallel, GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) + .recipeModifiers(GTRecipeModifiers::multiSmelterParallel, + GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) .appearanceBlock(CASING_INVAR_HEATPROOF) - .tooltips(Component.translatable("gtceu.machine.available_recipe_map_2.tooltip", Component.translatable("gtceu.electric_furnace"), Component.translatable("gtceu.alloy_smelter"))) + .tooltips(Component.translatable("gtceu.machine.available_recipe_map_2.tooltip", + Component.translatable("gtceu.electric_furnace"), Component.translatable("gtceu.alloy_smelter"))) .pattern(definition -> FactoryBlockPattern.start() .aisle("XXX", "CCC", "XXX") .aisle("XXX", "C#C", "XMX") @@ -1161,36 +1335,41 @@ public static BiConsumer> createTankTooltips(String n .shapeInfos(definition -> { List shapeInfo = new ArrayList<>(); var builder = MultiblockShapeInfo.builder() - .aisle("ISO", "CCC", "XMX") - .aisle("XXX", "C#C", "XHX") - .aisle("EEX", "CCC", "XXX") - .where('S', definition, Direction.NORTH) - .where('X', CASING_INVAR_HEATPROOF.getDefaultState()) - .where('E', ENERGY_INPUT_HATCH[GTValues.LV], Direction.SOUTH) - .where('I', ITEM_IMPORT_BUS[GTValues.LV], Direction.NORTH) - .where('O', ITEM_EXPORT_BUS[GTValues.LV], Direction.NORTH) - .where('H', MUFFLER_HATCH[GTValues.LV], Direction.SOUTH) - .where('M', MAINTENANCE_HATCH, Direction.NORTH) - .where('#', Blocks.AIR.defaultBlockState()); + .aisle("ISO", "CCC", "XMX") + .aisle("XXX", "C#C", "XHX") + .aisle("EEX", "CCC", "XXX") + .where('S', definition, Direction.NORTH) + .where('X', CASING_INVAR_HEATPROOF.getDefaultState()) + .where('E', ENERGY_INPUT_HATCH[GTValues.LV], Direction.SOUTH) + .where('I', ITEM_IMPORT_BUS[GTValues.LV], Direction.NORTH) + .where('O', ITEM_EXPORT_BUS[GTValues.LV], Direction.NORTH) + .where('H', MUFFLER_HATCH[GTValues.LV], Direction.SOUTH) + .where('M', MAINTENANCE_HATCH, Direction.NORTH) + .where('#', Blocks.AIR.defaultBlockState()); GTCEuAPI.HEATING_COILS.entrySet().stream() .sorted(Comparator.comparingInt(entry -> entry.getKey().getTier())) - .forEach(coil -> shapeInfo.add(builder.shallowCopy().where('C', coil.getValue().get()).build())); + .forEach( + coil -> shapeInfo.add(builder.shallowCopy().where('C', coil.getValue().get()).build())); return shapeInfo; }) - .recoveryItems(() -> new ItemLike[]{GTItems.MATERIAL_ITEMS.get(TagPrefix.dustTiny, GTMaterials.Ash).get()}) + .recoveryItems( + () -> new ItemLike[] { GTItems.MATERIAL_ITEMS.get(TagPrefix.dustTiny, GTMaterials.Ash).get() }) .workableCasingRenderer(GTCEu.id("block/casings/solid/machine_casing_heatproof"), GTCEu.id("block/multiblock/multi_furnace"), false) .additionalDisplay((controller, components) -> { if (controller instanceof CoilWorkableElectricMultiblockMachine coilMachine && controller.isFormed()) { - components.add(Component.translatable("gtceu.multiblock.multi_furnace.heating_coil_level", coilMachine.getCoilType().getLevel())); - components.add(Component.translatable("gtceu.multiblock.multi_furnace.heating_coil_discount", coilMachine.getCoilType().getEnergyDiscount())); + components.add(Component.translatable("gtceu.multiblock.multi_furnace.heating_coil_level", + coilMachine.getCoilType().getLevel())); + components.add(Component.translatable("gtceu.multiblock.multi_furnace.heating_coil_discount", + coilMachine.getCoilType().getEnergyDiscount())); } }) .compassSections(GTCompassSections.TIER[MV]) .compassNodeSelf() .register(); - public static final MultiblockMachineDefinition CRACKER = REGISTRATE.multiblock("cracker", CoilWorkableElectricMultiblockMachine::new) + public static final MultiblockMachineDefinition CRACKER = REGISTRATE + .multiblock("cracker", CoilWorkableElectricMultiblockMachine::new) .rotationState(RotationState.NON_Y_AXIS) .recipeType(GTRecipeTypes.CRACKING_RECIPES) .recipeModifier(GTRecipeModifiers::crackerOverclock) @@ -1209,21 +1388,22 @@ public static BiConsumer> createTankTooltips(String n .shapeInfos(definition -> { List shapeInfo = new ArrayList<>(); var builder = MultiblockShapeInfo.builder() - .aisle("FCICD", "HCSCH", "HCMCH") - .aisle("ECHCH", "H###H", "HCHCH") - .aisle("ECHCH", "HCXCH", "HCHCH") - .where('S', definition, Direction.NORTH) - .where('H', CASING_STAINLESS_CLEAN.getDefaultState()) - .where('E', ENERGY_INPUT_HATCH[GTValues.LV], Direction.WEST) - .where('I', ITEM_IMPORT_BUS[GTValues.LV], Direction.NORTH) - .where('F', FLUID_IMPORT_HATCH[GTValues.LV], Direction.NORTH) - .where('D', FLUID_EXPORT_HATCH[GTValues.LV], Direction.NORTH) - .where('M', MAINTENANCE_HATCH, Direction.NORTH) - .where('X', MUFFLER_HATCH[GTValues.LV], Direction.SOUTH) - .where('#', Blocks.AIR.defaultBlockState()); + .aisle("FCICD", "HCSCH", "HCMCH") + .aisle("ECHCH", "H###H", "HCHCH") + .aisle("ECHCH", "HCXCH", "HCHCH") + .where('S', definition, Direction.NORTH) + .where('H', CASING_STAINLESS_CLEAN.getDefaultState()) + .where('E', ENERGY_INPUT_HATCH[GTValues.LV], Direction.WEST) + .where('I', ITEM_IMPORT_BUS[GTValues.LV], Direction.NORTH) + .where('F', FLUID_IMPORT_HATCH[GTValues.LV], Direction.NORTH) + .where('D', FLUID_EXPORT_HATCH[GTValues.LV], Direction.NORTH) + .where('M', MAINTENANCE_HATCH, Direction.NORTH) + .where('X', MUFFLER_HATCH[GTValues.LV], Direction.SOUTH) + .where('#', Blocks.AIR.defaultBlockState()); GTCEuAPI.HEATING_COILS.entrySet().stream() .sorted(Comparator.comparingInt(entry -> entry.getKey().getTier())) - .forEach(coil -> shapeInfo.add(builder.shallowCopy().where('C', coil.getValue().get()).build())); + .forEach( + coil -> shapeInfo.add(builder.shallowCopy().where('C', coil.getValue().get()).build())); return shapeInfo; }) .workableCasingRenderer(GTCEu.id("block/casings/solid/machine_casing_clean_stainless_steel"), @@ -1231,14 +1411,16 @@ public static BiConsumer> createTankTooltips(String n .tooltips(Component.translatable("gtceu.machine.cracker.tooltip.1")) .additionalDisplay((controller, components) -> { if (controller instanceof CoilWorkableElectricMultiblockMachine coilMachine && controller.isFormed()) { - components.add(Component.translatable("gtceu.multiblock.cracking_unit.energy",100 - 10 * coilMachine.getCoilTier())); + components.add(Component.translatable("gtceu.multiblock.cracking_unit.energy", + 100 - 10 * coilMachine.getCoilTier())); } }) .compassSections(GTCompassSections.TIER[EV]) .compassNodeSelf() .register(); - public static final MultiblockMachineDefinition DISTILLATION_TOWER = REGISTRATE.multiblock("distillation_tower", WorkableElectricMultiblockMachine::new) + public static final MultiblockMachineDefinition DISTILLATION_TOWER = REGISTRATE + .multiblock("distillation_tower", WorkableElectricMultiblockMachine::new) .rotationState(RotationState.NON_Y_AXIS) .recipeType(GTRecipeTypes.DISTILLATION_RECIPES) .recipeModifier(GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) @@ -1250,10 +1432,12 @@ public static BiConsumer> createTankTooltips(String n .where('S', Predicates.controller(blocks(definition.getBlock()))) .where('Y', blocks(CASING_STAINLESS_CLEAN.get()) .or(Predicates.abilities(PartAbility.EXPORT_ITEMS).setMaxGlobalLimited(1)) - .or(Predicates.abilities(PartAbility.INPUT_ENERGY).setMinGlobalLimited(1).setMaxGlobalLimited(2)) + .or(Predicates.abilities(PartAbility.INPUT_ENERGY).setMinGlobalLimited(1) + .setMaxGlobalLimited(2)) .or(Predicates.abilities(PartAbility.IMPORT_FLUIDS).setExactLimit(1))) .where('X', blocks(CASING_STAINLESS_CLEAN.get()) - .or(Predicates.abilities(PartAbility.EXPORT_FLUIDS_1X).setMinLayerLimited(1).setMaxLayerLimited(1))) + .or(Predicates.abilities(PartAbility.EXPORT_FLUIDS_1X).setMinLayerLimited(1) + .setMaxLayerLimited(1))) .where('#', Predicates.air()) .build()) .partSorter(Comparator.comparingInt(a -> a.self().getPos().getY())) @@ -1263,7 +1447,35 @@ public static BiConsumer> createTankTooltips(String n .compassNodeSelf() .register(); - public static final MultiblockMachineDefinition VACUUM_FREEZER = REGISTRATE.multiblock("vacuum_freezer", WorkableElectricMultiblockMachine::new) + public static final MachineDefinition EVAPORATION_PLANT = REGISTRATE + .multiblock("evaporation_plant", WorkableElectricMultiblockMachine::new) + .langValue("Evaporation Tower") + .rotationState(RotationState.NON_Y_AXIS) + .recipeType(GTRecipeTypes.EVAPORATION_RECIPES) + .recipeModifier(GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) + .appearanceBlock(CASING_STAINLESS_EVAPORATION) + .pattern(definition -> FactoryBlockPattern.start(RIGHT, BACK, UP) + .aisle("YSYY", "YYYY", "YYYY", "YYYY") + .aisle("XXXX", "X##X", "X##X", "XXXX").setRepeatable(3, 5) + .aisle(" XX ", "X##X", "X##X", " XX ") + .where('S', Predicates.controller(blocks(definition.getBlock()))) + .where('Y', blocks(CASING_STAINLESS_EVAPORATION.get()) + .or(Predicates.abilities(PartAbility.INPUT_ENERGY).setMinGlobalLimited(1) + .setMaxGlobalLimited(2)) + .or(Predicates.abilities(PartAbility.IMPORT_FLUIDS).setExactLimit(1)) + .or(Predicates.abilities(PartAbility.EXPORT_ITEMS).setMaxGlobalLimited(1))) + .where('X', blocks(CASING_STAINLESS_EVAPORATION.get()) + .or(Predicates.abilities(PartAbility.EXPORT_FLUIDS_1X).setMaxLayerLimited(1))) + .where('#', Predicates.air()) + .where(' ', Predicates.any()) + .build()) + .partSorter(Comparator.comparingInt(a -> a.self().getPos().getY())) + .workableCasingRenderer(GTCEu.id("block/casings/solid/machine_casing_stainless_evaporation"), + GTCEu.id("block/multiblock/distillation_tower"), false) + .register(); + + public static final MultiblockMachineDefinition VACUUM_FREEZER = REGISTRATE + .multiblock("vacuum_freezer", WorkableElectricMultiblockMachine::new) .rotationState(RotationState.NON_Y_AXIS) .recipeType(GTRecipeTypes.VACUUM_RECIPES) .recipeModifier(GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) @@ -1284,7 +1496,8 @@ public static BiConsumer> createTankTooltips(String n .compassNodeSelf() .register(); - public static final MultiblockMachineDefinition ASSEMBLY_LINE = REGISTRATE.multiblock("assembly_line", WorkableElectricMultiblockMachine::new) + public static final MultiblockMachineDefinition ASSEMBLY_LINE = REGISTRATE + .multiblock("assembly_line", WorkableElectricMultiblockMachine::new) .rotationState(RotationState.NON_Y_AXIS) .recipeType(GTRecipeTypes.ASSEMBLY_LINE_RECIPES) .alwaysTryModifyRecipe(true) @@ -1297,8 +1510,12 @@ public static BiConsumer> createTankTooltips(String n .where('S', Predicates.controller(blocks(definition.getBlock()))) .where('F', blocks(CASING_STEEL_SOLID.get()) .or(Predicates.abilities(PartAbility.IMPORT_FLUIDS).setMaxGlobalLimited(4))) - .where('O', Predicates.abilities(PartAbility.EXPORT_ITEMS).addTooltips(Component.translatable("gtceu.multiblock.pattern.location_end"))) - .where('Y', blocks(CASING_STEEL_SOLID.get()).or(Predicates.abilities(PartAbility.INPUT_ENERGY).setMinGlobalLimited(1).setMaxGlobalLimited(2))) + .where('O', + Predicates.abilities(PartAbility.EXPORT_ITEMS) + .addTooltips(Component.translatable("gtceu.multiblock.pattern.location_end"))) + .where('Y', + blocks(CASING_STEEL_SOLID.get()).or(Predicates.abilities(PartAbility.INPUT_ENERGY) + .setMinGlobalLimited(1).setMaxGlobalLimited(2))) .where('I', blocks(ITEM_IMPORT_BUS[0].getBlock())) .where('G', blocks(CASING_GRATE.get())) .where('A', blocks(CASING_ASSEMBLY_CONTROL.get())) @@ -1313,7 +1530,8 @@ public static BiConsumer> createTankTooltips(String n .compassNodeSelf() .register(); - public static final MultiblockMachineDefinition PRIMITIVE_PUMP = REGISTRATE.multiblock("primitive_pump", PrimitivePumpMachine::new) + public static final MultiblockMachineDefinition PRIMITIVE_PUMP = REGISTRATE + .multiblock("primitive_pump", PrimitivePumpMachine::new) .rotationState(RotationState.NON_Y_AXIS) .appearanceBlock(CASING_PUMP_DECK) .pattern(definition -> FactoryBlockPattern.start() @@ -1323,7 +1541,9 @@ public static BiConsumer> createTankTooltips(String n .where('S', Predicates.controller(blocks(definition.getBlock()))) .where('X', blocks(CASING_PUMP_DECK.get())) .where('F', blocks(MATERIAL_BLOCKS.get(TagPrefix.frameGt, GTMaterials.TreatedWood).get())) - .where('H', Predicates.abilities(PartAbility.PUMP_FLUID_HATCH).or(blocks(FLUID_EXPORT_HATCH[LV].get(), FLUID_EXPORT_HATCH[MV].get()))) + .where('H', + Predicates.abilities(PartAbility.PUMP_FLUID_HATCH) + .or(blocks(FLUID_EXPORT_HATCH[LV].get(), FLUID_EXPORT_HATCH[MV].get()))) .where('#', Predicates.any()) .build()) .sidedWorkableCasingRenderer("block/casings/pump_deck", GTCEu.id("block/multiblock/primitive_pump"), false) @@ -1331,7 +1551,8 @@ public static BiConsumer> createTankTooltips(String n .compassNodeSelf() .register(); - public static final MultiblockMachineDefinition STEAM_GRINDER = REGISTRATE.multiblock("steam_grinder", SteamParallelMultiblockMachine::new) + public static final MultiblockMachineDefinition STEAM_GRINDER = REGISTRATE + .multiblock("steam_grinder", SteamParallelMultiblockMachine::new) .rotationState(RotationState.NON_Y_AXIS) .appearanceBlock(CASING_BRONZE_BRICKS) .recipeType(GTRecipeTypes.MACERATOR_RECIPES) @@ -1354,7 +1575,8 @@ public static BiConsumer> createTankTooltips(String n .compassNodeSelf() .register(); - public static final MultiblockMachineDefinition STEAM_OVEN = REGISTRATE.multiblock("steam_oven", SteamParallelMultiblockMachine::new) + public static final MultiblockMachineDefinition STEAM_OVEN = REGISTRATE + .multiblock("steam_oven", SteamParallelMultiblockMachine::new) .rotationState(RotationState.NON_Y_AXIS) .appearanceBlock(CASING_BRONZE_BRICKS) .recipeType(GTRecipeTypes.FURNACE_RECIPES) @@ -1373,21 +1595,25 @@ public static BiConsumer> createTankTooltips(String n .where('F', blocks(FIREBOX_BRONZE.get()) .or(Predicates.abilities(PartAbility.STEAM).setExactLimit(1))) .build()) - .renderer(() -> new LargeBoilerRenderer(GTCEu.id("block/casings/solid/machine_casing_bronze_plated_bricks"), BoilerFireboxType.BRONZE_FIREBOX, + .renderer(() -> new LargeBoilerRenderer(GTCEu.id("block/casings/solid/machine_casing_bronze_plated_bricks"), + BoilerFireboxType.BRONZE_FIREBOX, GTCEu.id("block/multiblock/steam_oven"))) .compassSections(GTCompassSections.STEAM) .compassNodeSelf() .register(); - public static final MultiblockMachineDefinition[] FUSION_REACTOR = registerTieredMultis("fusion_reactor", FusionReactorMachine::new, (tier, builder) -> builder + public static final MultiblockMachineDefinition[] FUSION_REACTOR = registerTieredMultis("fusion_reactor", + FusionReactorMachine::new, (tier, builder) -> builder .rotationState(RotationState.NON_Y_AXIS) .langValue("Fusion Reactor Computer MK %s".formatted(toRomanNumeral(tier - 5))) .recipeType(GTRecipeTypes.FUSION_RECIPES) .recipeModifier(FusionReactorMachine::recipeModifier) .tooltips( - Component.translatable("gtceu.machine.fusion_reactor.capacity", FusionReactorMachine.calculateEnergyStorageFactor(tier, 16) / 1000000L), + Component.translatable("gtceu.machine.fusion_reactor.capacity", + FusionReactorMachine.calculateEnergyStorageFactor(tier, 16) / 1000000L), Component.translatable("gtceu.machine.fusion_reactor.overclocking"), - Component.translatable("gtceu.multiblock.%s_fusion_reactor.description".formatted(VN[tier].toLowerCase(Locale.ROOT)))) + Component.translatable("gtceu.multiblock.%s_fusion_reactor.description" + .formatted(VN[tier].toLowerCase(Locale.ROOT)))) .appearanceBlock(() -> FusionReactorMachine.getCasingState(tier)) .pattern((definition) -> { var casing = blocks(FusionReactorMachine.getCasingState(tier)); @@ -1409,8 +1635,9 @@ public static BiConsumer> createTankTooltips(String n .aisle("###############", "######OSO######", "###############") .where('S', controller(blocks(definition.get()))) .where('G', blocks(FUSION_GLASS.get()).or(casing)) - .where('E', casing.or(blocks(PartAbility.INPUT_ENERGY.getBlockRange(tier, UV).toArray(Block[]::new)) - .setMinGlobalLimited(1).setPreviewCount(16))) + .where('E', casing.or( + blocks(PartAbility.INPUT_ENERGY.getBlockRange(tier, UV).toArray(Block[]::new)) + .setMinGlobalLimited(1).setPreviewCount(16))) .where('C', casing) .where('K', blocks(FusionReactorMachine.getCoilState(tier))) .where('O', casing.or(abilities(PartAbility.EXPORT_FLUIDS))) @@ -1456,8 +1683,7 @@ public static BiConsumer> createTankTooltips(String n shapeInfos.add(baseBuilder.shallowCopy() .where('G', FusionReactorMachine.getCasingState(tier)) - .build() - ); + .build()); shapeInfos.add(baseBuilder.build()); return shapeInfos; }) @@ -1468,15 +1694,20 @@ public static BiConsumer> createTankTooltips(String n .register(), LuV, ZPM, UV); - public static final MultiblockMachineDefinition[] FLUID_DRILLING_RIG = registerTieredMultis("fluid_drilling_rig", FluidDrillMachine::new, (tier, builder) -> builder + public static final MultiblockMachineDefinition[] FLUID_DRILLING_RIG = registerTieredMultis( + "fluid_drilling_rig", FluidDrillMachine::new, (tier, builder) -> builder .rotationState(RotationState.NON_Y_AXIS) .langValue("%s Fluid Drilling Rig %s".formatted(VLVH[tier], VLVT[tier])) .recipeType(DUMMY_RECIPES) .tooltips( Component.translatable("gtceu.machine.fluid_drilling_rig.description"), - Component.translatable("gtceu.machine.fluid_drilling_rig.depletion", FormattingUtil.formatNumbers(100.0 / FluidDrillMachine.getDepletionChance(tier))), - Component.translatable("gtceu.universal.tooltip.energy_tier_range", GTValues.VNF[tier], GTValues.VNF[tier + 1]), - Component.translatable("gtceu.machine.fluid_drilling_rig.production", FluidDrillMachine.getRigMultiplier(tier), FormattingUtil.formatNumbers(FluidDrillMachine.getRigMultiplier(tier) * 1.5))) + Component.translatable("gtceu.machine.fluid_drilling_rig.depletion", + FormattingUtil.formatNumbers(100.0 / FluidDrillMachine.getDepletionChance(tier))), + Component.translatable("gtceu.universal.tooltip.energy_tier_range", GTValues.VNF[tier], + GTValues.VNF[tier + 1]), + Component.translatable("gtceu.machine.fluid_drilling_rig.production", + FluidDrillMachine.getRigMultiplier(tier), + FormattingUtil.formatNumbers(FluidDrillMachine.getRigMultiplier(tier) * 1.5))) .appearanceBlock(() -> FluidDrillMachine.getCasingState(tier)) .pattern((definition) -> FactoryBlockPattern.start() .aisle("XXX", "#F#", "#F#", "#F#", "###", "###", "###") @@ -1484,19 +1715,22 @@ public static BiConsumer> createTankTooltips(String n .aisle("XSX", "#F#", "#F#", "#F#", "###", "###", "###") .where('S', controller(blocks(definition.get()))) .where('X', blocks(FluidDrillMachine.getCasingState(tier)).setMinGlobalLimited(3) - .or(abilities(PartAbility.INPUT_ENERGY).setMinGlobalLimited(1).setMaxGlobalLimited(2)) + .or(abilities(PartAbility.INPUT_ENERGY).setMinGlobalLimited(1) + .setMaxGlobalLimited(2)) .or(abilities(PartAbility.EXPORT_FLUIDS).setMaxGlobalLimited(1))) .where('C', blocks(FluidDrillMachine.getCasingState(tier))) .where('F', blocks(FluidDrillMachine.getFrameState(tier))) .where('#', any()) .build()) - .workableCasingRenderer(FluidDrillMachine.getBaseTexture(tier), GTCEu.id("block/multiblock/fluid_drilling_rig"), false) + .workableCasingRenderer(FluidDrillMachine.getBaseTexture(tier), + GTCEu.id("block/multiblock/fluid_drilling_rig"), false) .compassSections(GTCompassSections.TIER[MV]) .compassNode("fluid_drilling_rig") .register(), MV, HV, EV); - public static final MultiblockMachineDefinition[] LARGE_MINER = registerTieredMultis("large_miner", (holder, tier) -> new LargeMinerMachine(holder, tier, 64 / tier, 2 * tier - 5, tier, 8 - (tier - 5)), + public static final MultiblockMachineDefinition[] LARGE_MINER = registerTieredMultis("large_miner", + (holder, tier) -> new LargeMinerMachine(holder, tier, 64 / tier, 2 * tier - 5, tier, 8 - (tier - 5)), (tier, builder) -> builder .rotationState(RotationState.NON_Y_AXIS) .langValue("%s Large Miner %s".formatted(VLVH[tier], VLVT[tier])) @@ -1510,22 +1744,29 @@ public static BiConsumer> createTankTooltips(String n .where('X', blocks(LargeMinerMachine.getCasingState(tier)) .or(abilities(PartAbility.EXPORT_ITEMS).setMaxGlobalLimited(1).setPreviewCount(1)) .or(abilities(PartAbility.IMPORT_FLUIDS).setExactLimit(1).setPreviewCount(1)) - .or(abilities(PartAbility.INPUT_ENERGY).setMinGlobalLimited(1).setMaxGlobalLimited(2).setPreviewCount(1))) + .or(abilities(PartAbility.INPUT_ENERGY).setMinGlobalLimited(1) + .setMaxGlobalLimited(2).setPreviewCount(1))) .where('C', blocks(LargeMinerMachine.getCasingState(tier))) .where('F', frames(LargeMinerMachine.getMaterial(tier))) .where('#', any()) .build()) - .renderer(() -> new LargeMinerRenderer(MinerRenderer.MATERIALS_TO_CASING_MODELS.get(LargeMinerMachine.getMaterial(tier)), + .renderer(() -> new LargeMinerRenderer( + MinerRenderer.MATERIALS_TO_CASING_MODELS.get(LargeMinerMachine.getMaterial(tier)), GTCEu.id("block/multiblock/large_miner"))) - .tooltips(Component.translatable("gtceu.machine.large_miner.%s.tooltip".formatted(VN[tier].toLowerCase(Locale.ROOT))), + .tooltips( + Component.translatable("gtceu.machine.large_miner.%s.tooltip" + .formatted(VN[tier].toLowerCase(Locale.ROOT))), Component.translatable("gtceu.machine.miner.multi.description")) .tooltipBuilder((stack, tooltip) -> { int workingAreaChunks = (2 * tier - 5) * 2 / LargeMinerMachine.CHUNK_LENGTH; tooltip.add(Component.translatable("gtceu.machine.miner.multi.modes")); tooltip.add(Component.translatable("gtceu.machine.miner.multi.production")); - tooltip.add(Component.translatable("gtceu.machine.miner.fluid_usage", 8 - (tier - 5), DrillingFluid.getLocalizedName())); - tooltip.add(Component.translatable("gtceu.universal.tooltip.working_area_chunks", workingAreaChunks, workingAreaChunks)); - tooltip.add(Component.translatable("gtceu.universal.tooltip.energy_tier_range", GTValues.VNF[tier], GTValues.VNF[tier + 1])); + tooltip.add(Component.translatable("gtceu.machine.miner.fluid_usage", 8 - (tier - 5), + DrillingFluid.getLocalizedName())); + tooltip.add(Component.translatable("gtceu.universal.tooltip.working_area_chunks", + workingAreaChunks, workingAreaChunks)); + tooltip.add(Component.translatable("gtceu.universal.tooltip.energy_tier_range", + GTValues.VNF[tier], GTValues.VNF[tier + 1])); }) .compassSections(GTCompassSections.TIER[EV]) .compassNode("large_miner") @@ -1534,7 +1775,8 @@ public static BiConsumer> createTankTooltips(String n public static MultiblockMachineDefinition[] BEDROCK_ORE_MINER; - public static final MultiblockMachineDefinition CLEANROOM = REGISTRATE.multiblock("cleanroom", CleanroomMachine::new) + public static final MultiblockMachineDefinition CLEANROOM = REGISTRATE + .multiblock("cleanroom", CleanroomMachine::new) .rotationState(RotationState.NONE) .recipeType(DUMMY_RECIPES) .appearanceBlock(PLASTCRETE) @@ -1549,9 +1791,12 @@ public static BiConsumer> createTankTooltips(String n tooltip.add(Component.translatable("gtceu.machine.cleanroom.tooltip.5")); tooltip.add(Component.translatable("gtceu.machine.cleanroom.tooltip.6")); tooltip.add(Component.translatable("gtceu.machine.cleanroom.tooltip.7")); - //tooltip.add(Component.translatable("gtceu.machine.cleanroom.tooltip.8")); + // tooltip.add(Component.translatable("gtceu.machine.cleanroom.tooltip.8")); if (GTCEu.isAE2Loaded()) { - tooltip.add(Component.translatable(AEConfig.instance().getChannelMode() == ChannelMode.INFINITE ? "gtceu.machine.cleanroom.tooltip.ae2.no_channels" : "gtceu.machine.cleanroom.tooltip.ae2.channels")); + tooltip.add( + Component.translatable(AEConfig.instance().getChannelMode() == ChannelMode.INFINITE ? + "gtceu.machine.cleanroom.tooltip.ae2.no_channels" : + "gtceu.machine.cleanroom.tooltip.ae2.channels")); } tooltip.add(Component.empty()); } else { @@ -1568,15 +1813,15 @@ public static BiConsumer> createTankTooltips(String n .or(blocks(GTBlocks.CLEANROOM_GLASS.get())) .or(abilities(PartAbility.PASSTHROUGH_HATCH).setMaxGlobalLimited(30, 3)) .or(abilities(PartAbility.INPUT_ENERGY).setMinGlobalLimited(1).setMaxGlobalLimited(3, 2)) - .or(blocks(ConfigHolder.INSTANCE.machines.enableMaintenance ? GTMachines.MAINTENANCE_HATCH.getBlock() : PLASTCRETE.get()).setExactLimit(1)) + .or(blocks(ConfigHolder.INSTANCE.machines.enableMaintenance ? + GTMachines.MAINTENANCE_HATCH.getBlock() : PLASTCRETE.get()).setExactLimit(1)) .or(blocks(Blocks.IRON_DOOR).setMaxGlobalLimited(8))) .where('S', controller(blocks(definition.getBlock()))) .where(' ', any()) .where('E', abilities(PartAbility.INPUT_ENERGY)) .where('F', cleanroomFilters()) .where('I', abilities(PartAbility.PASSTHROUGH_HATCH)) - .build() - ) + .build()) .shapeInfos((controller) -> { ArrayList shapeInfo = new ArrayList<>(); MultiblockShapeInfo.ShapeInfoBuilder builder = MultiblockShapeInfo.builder() @@ -1594,14 +1839,18 @@ public static BiConsumer> createTankTooltips(String n .where('L', GTMachines.FLUID_PASSTHROUGH_HATCH[GTValues.LV], Direction.NORTH) .where('H', GTMachines.HULL[GTValues.HV], Direction.NORTH) .where('D', GTMachines.DIODE[GTValues.HV], Direction.NORTH) - .where('O', Blocks.IRON_DOOR.defaultBlockState().setValue(DoorBlock.FACING, Direction.NORTH).setValue(DoorBlock.HALF, DoubleBlockHalf.LOWER)) - .where('R', Blocks.IRON_DOOR.defaultBlockState().setValue(DoorBlock.FACING, Direction.NORTH).setValue(DoorBlock.HALF, DoubleBlockHalf.UPPER)); + .where('O', + Blocks.IRON_DOOR.defaultBlockState().setValue(DoorBlock.FACING, Direction.NORTH) + .setValue(DoorBlock.HALF, DoubleBlockHalf.LOWER)) + .where('R', Blocks.IRON_DOOR.defaultBlockState().setValue(DoorBlock.FACING, Direction.NORTH) + .setValue(DoorBlock.HALF, DoubleBlockHalf.UPPER)); if (ConfigHolder.INSTANCE.machines.enableMaintenance) { builder.where('M', GTMachines.MAINTENANCE_HATCH, Direction.SOUTH); } else { - builder.where('M',GTBlocks.PLASTCRETE.get()); + builder.where('M', GTBlocks.PLASTCRETE.get()); } - GTCEuAPI.CLEANROOM_FILTERS.values().forEach(block -> shapeInfo.add(builder.where('F', block.get()).build())); + GTCEuAPI.CLEANROOM_FILTERS.values() + .forEach(block -> shapeInfo.add(builder.where('F', block.get()).build())); return shapeInfo; }) .workableCasingRenderer(GTCEu.id("block/casings/cleanroom/plascrete"), @@ -1610,17 +1859,20 @@ public static BiConsumer> createTankTooltips(String n .compassNodeSelf() .register(); - public static final MultiblockMachineDefinition LARGE_COMBUSTION_ENGINE = registerLargeCombustionEngine("large_combustion_engine", EV, + public static final MultiblockMachineDefinition LARGE_COMBUSTION_ENGINE = registerLargeCombustionEngine( + "large_combustion_engine", EV, CASING_TITANIUM_STABLE, CASING_TITANIUM_GEARBOX, CASING_ENGINE_INTAKE, GTCEu.id("block/casings/solid/machine_casing_stable_titanium"), GTCEu.id("block/multiblock/generator/large_combustion_engine")); - public static final MultiblockMachineDefinition EXTREME_COMBUSTION_ENGINE = registerLargeCombustionEngine("extreme_combustion_engine", IV, + public static final MultiblockMachineDefinition EXTREME_COMBUSTION_ENGINE = registerLargeCombustionEngine( + "extreme_combustion_engine", IV, CASING_TUNGSTENSTEEL_ROBUST, CASING_TUNGSTENSTEEL_GEARBOX, CASING_EXTREME_ENGINE_INTAKE, GTCEu.id("block/casings/solid/machine_casing_robust_tungstensteel"), GTCEu.id("block/multiblock/generator/extreme_combustion_engine")); - public static final MultiblockMachineDefinition LARGE_STEAM_TURBINE = registerLargeTurbine("steam_large_turbine", HV, + public static final MultiblockMachineDefinition LARGE_STEAM_TURBINE = registerLargeTurbine("steam_large_turbine", + HV, GTRecipeTypes.STEAM_TURBINE_FUELS, CASING_STEEL_TURBINE, CASING_STEEL_GEARBOX, GTCEu.id("block/casings/solid/machine_casing_solid_steel"), @@ -1632,49 +1884,55 @@ public static BiConsumer> createTankTooltips(String n GTCEu.id("block/casings/mechanic/machine_casing_turbine_stainless_steel"), GTCEu.id("block/multiblock/generator/large_gas_turbine")); - public static final MultiblockMachineDefinition LARGE_PLASMA_TURBINE = registerLargeTurbine("plasma_large_turbine", IV, + public static final MultiblockMachineDefinition LARGE_PLASMA_TURBINE = registerLargeTurbine("plasma_large_turbine", + IV, GTRecipeTypes.PLASMA_GENERATOR_FUELS, CASING_TUNGSTENSTEEL_TURBINE, CASING_TUNGSTENSTEEL_GEARBOX, GTCEu.id("block/casings/solid/machine_casing_robust_tungstensteel"), GTCEu.id("block/multiblock/generator/large_plasma_turbine")); @SuppressWarnings("removal") - public static final MultiblockMachineDefinition[] PROCESSING_ARRAY = ConfigHolder.INSTANCE.machines.doProcessingArray ? registerTieredMultis("processing_array", ProcessingArrayMachine::new, - (tier, builder) -> builder - .langValue(VNF[tier] + " Processing Array") - .rotationState(RotationState.NON_Y_AXIS) - .blockProp(p -> p.noOcclusion().isViewBlocking((state, level, pos) -> false)) - .shape(Shapes.box(0.001, 0.001, 0.001, 0.999, 0.999, 0.999)) - .appearanceBlock(() -> ProcessingArrayMachine.getCasingState(tier)) - .recipeType(DUMMY_RECIPES) - .recipeModifier(ProcessingArrayMachine::recipeModifier, true) - .pattern(definition -> FactoryBlockPattern.start() - .aisle("XXX", "CCC", "XXX") - .aisle("XXX", "C#C", "XXX") - .aisle("XSX", "CCC", "XXX") - .where('S', Predicates.controller(blocks(definition.getBlock()))) - .where('X', blocks(ProcessingArrayMachine.getCasingState(tier)) - .or(Predicates.abilities(PartAbility.IMPORT_ITEMS).setPreviewCount(1)) - .or(Predicates.abilities(PartAbility.EXPORT_ITEMS).setPreviewCount(1)) - .or(Predicates.abilities(PartAbility.IMPORT_FLUIDS).setPreviewCount(1)) - .or(Predicates.abilities(PartAbility.EXPORT_FLUIDS).setPreviewCount(1)) - .or(Predicates.abilities(PartAbility.INPUT_ENERGY).setMinGlobalLimited(1).setMaxGlobalLimited(4).setPreviewCount(1)) - .or(Predicates.autoAbilities(true, false, false))) - .where('C', blocks(CLEANROOM_GLASS.get())) - .where('#', Predicates.air()) - .build()) - .tooltips(Component.translatable("gtceu.universal.tooltip.parallel", ProcessingArrayMachine.getMachineLimit(tier))) - .workableCasingRenderer(tier == IV ? - GTCEu.id("block/casings/solid/machine_casing_robust_tungstensteel") : - GTCEu.id("block/casings/solid/machine_casing_sturdy_hsse"), - GTCEu.id("block/multiblock/processing_array")) - .compassSections(GTCompassSections.TIER[IV]) - .compassNode("processing_array") - .tooltips(Component.translatable("gtceu.universal.tooltip.deprecated")) - .register(), - IV, LuV) : null; + public static final MultiblockMachineDefinition[] PROCESSING_ARRAY = ConfigHolder.INSTANCE.machines.doProcessingArray ? + registerTieredMultis("processing_array", ProcessingArrayMachine::new, + (tier, builder) -> builder + .langValue(VNF[tier] + " Processing Array") + .rotationState(RotationState.NON_Y_AXIS) + .blockProp(p -> p.noOcclusion().isViewBlocking((state, level, pos) -> false)) + .shape(Shapes.box(0.001, 0.001, 0.001, 0.999, 0.999, 0.999)) + .appearanceBlock(() -> ProcessingArrayMachine.getCasingState(tier)) + .recipeType(DUMMY_RECIPES) + .recipeModifier(ProcessingArrayMachine::recipeModifier, true) + .pattern(definition -> FactoryBlockPattern.start() + .aisle("XXX", "CCC", "XXX") + .aisle("XXX", "C#C", "XXX") + .aisle("XSX", "CCC", "XXX") + .where('S', Predicates.controller(blocks(definition.getBlock()))) + .where('X', blocks(ProcessingArrayMachine.getCasingState(tier)) + .or(Predicates.abilities(PartAbility.IMPORT_ITEMS).setPreviewCount(1)) + .or(Predicates.abilities(PartAbility.EXPORT_ITEMS).setPreviewCount(1)) + .or(Predicates.abilities(PartAbility.IMPORT_FLUIDS).setPreviewCount(1)) + .or(Predicates.abilities(PartAbility.EXPORT_FLUIDS).setPreviewCount(1)) + .or(Predicates.abilities(PartAbility.INPUT_ENERGY).setMinGlobalLimited(1) + .setMaxGlobalLimited(4).setPreviewCount(1)) + .or(Predicates.autoAbilities(true, false, false))) + .where('C', blocks(CLEANROOM_GLASS.get())) + .where('#', Predicates.air()) + .build()) + .tooltips(Component.translatable("gtceu.universal.tooltip.parallel", + ProcessingArrayMachine.getMachineLimit(tier))) + .workableCasingRenderer(tier == IV ? + GTCEu.id("block/casings/solid/machine_casing_robust_tungstensteel") : + GTCEu.id("block/casings/solid/machine_casing_sturdy_hsse"), + GTCEu.id("block/multiblock/processing_array")) + .compassSections(GTCompassSections.TIER[IV]) + .compassNode("processing_array") + .tooltips(Component.translatable("gtceu.universal.tooltip.deprecated")) + .register(), + IV, LuV) : + null; - public static final MultiblockMachineDefinition ACTIVE_TRANSFORMER = REGISTRATE.multiblock("active_transformer", ActiveTransformerMachine::new) + public static final MultiblockMachineDefinition ACTIVE_TRANSFORMER = REGISTRATE + .multiblock("active_transformer", ActiveTransformerMachine::new) .rotationState(RotationState.NON_Y_AXIS) .recipeType(GTRecipeTypes.DUMMY_RECIPES) .appearanceBlock(HIGH_POWER_CASING) @@ -1696,27 +1954,37 @@ public static BiConsumer> createTankTooltips(String n GTCEu.id("block/multiblock/data_bank"), false) .register(); - public static final MultiblockMachineDefinition POWER_SUBSTATION = REGISTRATE.multiblock("power_substation", PowerSubstationMachine::new) + public static final MultiblockMachineDefinition POWER_SUBSTATION = REGISTRATE + .multiblock("power_substation", PowerSubstationMachine::new) .rotationState(RotationState.NON_Y_AXIS) .recipeType(GTRecipeTypes.DUMMY_RECIPES) .tooltips(Component.translatable("gtceu.machine.power_substation.tooltip.0"), Component.translatable("gtceu.machine.power_substation.tooltip.1"), - Component.translatable("gtceu.machine.power_substation.tooltip.2", PowerSubstationMachine.MAX_BATTERY_LAYERS), + Component.translatable("gtceu.machine.power_substation.tooltip.2", + PowerSubstationMachine.MAX_BATTERY_LAYERS), Component.translatable("gtceu.machine.power_substation.tooltip.3"), - Component.translatable("gtceu.machine.power_substation.tooltip.4", PowerSubstationMachine.PASSIVE_DRAIN_MAX_PER_STORAGE / 1000), - Component.translatable("gtceu.machine.power_substation.tooltip.5").append(Component.translatable("gtceu.machine.power_substation.tooltip.6").withStyle(style -> style.withColor(TooltipHelper.RAINBOW_SLOW.getCurrent())))) + Component.translatable("gtceu.machine.power_substation.tooltip.4", + PowerSubstationMachine.PASSIVE_DRAIN_MAX_PER_STORAGE / 1000), + Component.translatable("gtceu.machine.power_substation.tooltip.5") + .append(Component.translatable("gtceu.machine.power_substation.tooltip.6") + .withStyle(style -> style.withColor(TooltipHelper.RAINBOW_SLOW.getCurrent())))) .appearanceBlock(CASING_PALLADIUM_SUBSTATION) .pattern(definition -> FactoryBlockPattern.start(RIGHT, BACK, UP) .aisle("XXSXX", "XXXXX", "XXXXX", "XXXXX", "XXXXX") .aisle("XXXXX", "XCCCX", "XCCCX", "XCCCX", "XXXXX") - .aisle("GGGGG", "GBBBG", "GBBBG", "GBBBG", "GGGGG").setRepeatable(1, PowerSubstationMachine.MAX_BATTERY_LAYERS) + .aisle("GGGGG", "GBBBG", "GBBBG", "GBBBG", "GGGGG") + .setRepeatable(1, PowerSubstationMachine.MAX_BATTERY_LAYERS) .aisle("GGGGG", "GGGGG", "GGGGG", "GGGGG", "GGGGG") .where('S', controller(blocks(definition.getBlock()))) .where('C', blocks(CASING_PALLADIUM_SUBSTATION.get())) - .where('X', blocks(CASING_PALLADIUM_SUBSTATION.get()).setMinGlobalLimited(PowerSubstationMachine.MIN_CASINGS) - .or(autoAbilities(true, false, false)) - .or(abilities(PartAbility.INPUT_ENERGY, PartAbility.SUBSTATION_INPUT_ENERGY, PartAbility.INPUT_LASER).setMinGlobalLimited(1)) - .or(abilities(PartAbility.OUTPUT_ENERGY, PartAbility.SUBSTATION_OUTPUT_ENERGY, PartAbility.OUTPUT_LASER).setMinGlobalLimited(1))) + .where('X', + blocks(CASING_PALLADIUM_SUBSTATION.get()) + .setMinGlobalLimited(PowerSubstationMachine.MIN_CASINGS) + .or(autoAbilities(true, false, false)) + .or(abilities(PartAbility.INPUT_ENERGY, PartAbility.SUBSTATION_INPUT_ENERGY, + PartAbility.INPUT_LASER).setMinGlobalLimited(1)) + .or(abilities(PartAbility.OUTPUT_ENERGY, PartAbility.SUBSTATION_OUTPUT_ENERGY, + PartAbility.OUTPUT_LASER).setMinGlobalLimited(1))) .where('G', blocks(CASING_LAMINATED_GLASS.get())) .where('B', Predicates.powerSubstationBatteries()) .build()) @@ -1735,9 +2003,12 @@ public static BiConsumer> createTankTooltips(String n .where('N', GTMachines.SUBSTATION_ENERGY_INPUT_HATCH[EV], Direction.SOUTH) .where('O', GTMachines.ENERGY_OUTPUT_HATCH[HV], Direction.SOUTH) .where('T', GTMachines.SUBSTATION_ENERGY_OUTPUT_HATCH[EV], Direction.SOUTH) - .where('M', ConfigHolder.INSTANCE.machines.enableMaintenance - ? GTMachines.MAINTENANCE_HATCH.getBlock().defaultBlockState().setValue(GTMachines.MAINTENANCE_HATCH.get().getRotationState().property, Direction.SOUTH) - : CASING_PALLADIUM_SUBSTATION.get().defaultBlockState()); + .where('M', + ConfigHolder.INSTANCE.machines.enableMaintenance ? + GTMachines.MAINTENANCE_HATCH.getBlock().defaultBlockState().setValue( + GTMachines.MAINTENANCE_HATCH.get().getRotationState().property, + Direction.SOUTH) : + CASING_PALLADIUM_SUBSTATION.get().defaultBlockState()); GTCEuAPI.PSS_BATTERIES.entrySet().stream() // filter out empty batteries in example structures, though they are still @@ -1753,22 +2024,25 @@ public static BiConsumer> createTankTooltips(String n .register(); ////////////////////////////////////// - //********** Misc **********// + // ********** Misc **********// ////////////////////////////////////// - public static Pair registerSteamMachines(String name, BiFunction factory, + public static Pair registerSteamMachines(String name, + BiFunction factory, BiFunction, MachineDefinition> builder) { - MachineDefinition lowTier = builder.apply(false, REGISTRATE.machine("lp_%s".formatted(name), holder -> factory.apply(holder, false)) - .langValue("Low Pressure " + FormattingUtil.toEnglishName(name)) - .compassSections(GTCompassSections.STEAM) - .compassNode(name) - .compassPreNodes(GTCompassNodes.STEAM) - .tier(0)); - MachineDefinition highTier = builder.apply(true, REGISTRATE.machine("hp_%s".formatted(name), holder -> factory.apply(holder, true)) - .langValue("High Pressure " + FormattingUtil.toEnglishName(name)) - .compassSections(GTCompassSections.STEAM) - .compassNode(name) - .compassPreNodes(GTCompassNodes.STEAM) - .tier(1)); + MachineDefinition lowTier = builder.apply(false, + REGISTRATE.machine("lp_%s".formatted(name), holder -> factory.apply(holder, false)) + .langValue("Low Pressure " + FormattingUtil.toEnglishName(name)) + .compassSections(GTCompassSections.STEAM) + .compassNode(name) + .compassPreNodes(GTCompassNodes.STEAM) + .tier(0)); + MachineDefinition highTier = builder.apply(true, + REGISTRATE.machine("hp_%s".formatted(name), holder -> factory.apply(holder, true)) + .langValue("High Pressure " + FormattingUtil.toEnglishName(name)) + .compassSections(GTCompassSections.STEAM) + .compassNode(name) + .compassPreNodes(GTCompassNodes.STEAM) + .tier(1)); return Pair.of(lowTier, highTier); } @@ -1778,14 +2052,18 @@ public static MachineDefinition[] registerTieredMachines(String name, 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)) + 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; } - private static MachineDefinition[] registerFluidHatches(String name, String displayname, String model, String tooltip, IO io, long initialCapacity, int slots, int[] tiers, PartAbility... abilities) { + private static MachineDefinition[] registerFluidHatches(String name, String displayname, String model, + String tooltip, IO io, long initialCapacity, int slots, + int[] tiers, PartAbility... abilities) { return registerTieredMachines(name, (holder, tier) -> new FluidHatchPartMachine(holder, tier, io, initialCapacity, slots), (tier, builder) -> { @@ -1797,9 +2075,11 @@ private static MachineDefinition[] registerFluidHatches(String name, String disp .tooltips(Component.translatable("gtceu.machine." + tooltip + ".tooltip")); if (slots == 1) { - builder.tooltips(Component.translatable("gtceu.universal.tooltip.fluid_storage_capacity", FluidHatchPartMachine.getTankCapacity(initialCapacity, tier))); + builder.tooltips(Component.translatable("gtceu.universal.tooltip.fluid_storage_capacity", + FluidHatchPartMachine.getTankCapacity(initialCapacity, tier))); } else { - builder.tooltips(Component.translatable("gtceu.universal.tooltip.fluid_storage_capacity_mult", slots, FluidHatchPartMachine.getTankCapacity(initialCapacity, tier))); + builder.tooltips(Component.translatable("gtceu.universal.tooltip.fluid_storage_capacity_mult", + slots, FluidHatchPartMachine.getTankCapacity(initialCapacity, tier))); } return builder.register(); @@ -1808,39 +2088,52 @@ private static MachineDefinition[] registerFluidHatches(String name, String disp } public static MachineDefinition[] registerTransformerMachines(String langName, int baseAmp) { - return registerTieredMachines("transformer_%da".formatted(baseAmp), (holder, tier) -> new TransformerMachine(holder, tier, baseAmp), + return registerTieredMachines("transformer_%da".formatted(baseAmp), + (holder, tier) -> new TransformerMachine(holder, tier, baseAmp), (tier, builder) -> builder .rotationState(RotationState.ALL) - .itemColor((itemStack, index) -> index == 2 ? GTValues.VC[tier + 1] : index == 3 ? GTValues.VC[tier] : index == 1 ? Long.decode(ConfigHolder.INSTANCE.client.defaultPaintingColor).intValue() : -1) + .itemColor((itemStack, index) -> index == 2 ? GTValues.VC[tier + 1] : + index == 3 ? GTValues.VC[tier] : + index == 1 ? Long.decode(ConfigHolder.INSTANCE.client.defaultPaintingColor) + .intValue() : -1) .renderer(() -> new TransformerRenderer(tier, baseAmp)) .langValue("%s %sTransformer".formatted(VOLTAGE_NAMES[tier], langName)) .tooltips(Component.translatable("gtceu.machine.transformer.description"), Component.translatable("gtceu.machine.transformer.tooltip_tool_usage"), - Component.translatable("gtceu.machine.transformer.tooltip_transform_down", baseAmp, GTValues.V[tier + 1], GTValues.VNF[tier + 1], baseAmp * 4, GTValues.V[tier], GTValues.VNF[tier]), - Component.translatable("gtceu.machine.transformer.tooltip_transform_up", baseAmp * 4, GTValues.V[tier], GTValues.VNF[tier], baseAmp, GTValues.V[tier + 1], GTValues.VNF[tier + 1])) + Component.translatable("gtceu.machine.transformer.tooltip_transform_down", baseAmp, + GTValues.V[tier + 1], GTValues.VNF[tier + 1], baseAmp * 4, GTValues.V[tier], + GTValues.VNF[tier]), + Component.translatable("gtceu.machine.transformer.tooltip_transform_up", baseAmp * 4, + GTValues.V[tier], GTValues.VNF[tier], baseAmp, GTValues.V[tier + 1], + GTValues.VNF[tier + 1])) .compassNode("transformer") .register(), - GTValues.ULV, GTValues.LV, GTValues.MV, GTValues.HV, GTValues.EV, GTValues.IV, GTValues.LuV, GTValues.ZPM, GTValues.UV); // UHV not needed, as a UV transformer transforms up to UHV + GTValues.ULV, GTValues.LV, GTValues.MV, GTValues.HV, GTValues.EV, GTValues.IV, GTValues.LuV, + GTValues.ZPM, GTValues.UV); // UHV not needed, as a UV transformer transforms up to UHV } - public static MachineDefinition[] registerSimpleMachines(String name, GTRecipeType recipeType, Int2LongFunction tankScalingFunction, int... tiers) { - return registerTieredMachines(name, (holder, tier) -> new SimpleTieredMachine(holder, tier, tankScalingFunction), (tier, builder) -> builder - .langValue("%s %s %s".formatted(VLVH[tier], toEnglishName(name), VLVT[tier])) - .editableUI(SimpleTieredMachine.EDITABLE_UI_CREATOR.apply(GTCEu.id(name), recipeType)) - .rotationState(RotationState.NON_Y_AXIS) - .recipeType(recipeType) - .recipeModifier(GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) - .workableTieredHullRenderer(GTCEu.id("block/machines/" + name)) - .tooltips(workableTiered(tier, GTValues.V[tier], GTValues.V[tier] * 64, recipeType, tankScalingFunction.apply(tier), true)) - .compassNode(name) - .register(), tiers); + return registerTieredMachines(name, + (holder, tier) -> new SimpleTieredMachine(holder, tier, tankScalingFunction), (tier, builder) -> builder + .langValue("%s %s %s".formatted(VLVH[tier], toEnglishName(name), VLVT[tier])) + .editableUI(SimpleTieredMachine.EDITABLE_UI_CREATOR.apply(GTCEu.id(name), recipeType)) + .rotationState(RotationState.NON_Y_AXIS) + .recipeType(recipeType) + .recipeModifier( + GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) + .workableTieredHullRenderer(GTCEu.id("block/machines/" + name)) + .tooltips(workableTiered(tier, GTValues.V[tier], GTValues.V[tier] * 64, recipeType, + tankScalingFunction.apply(tier), true)) + .compassNode(name) + .register(), + tiers); } - public static MachineDefinition[] registerSimpleMachines(String name, GTRecipeType recipeType, Int2LongFunction tankScalingFunction) { + public static MachineDefinition[] registerSimpleMachines(String name, GTRecipeType recipeType, + Int2LongFunction tankScalingFunction) { return registerSimpleMachines(name, recipeType, tankScalingFunction, ELECTRIC_TIERS); } @@ -1852,21 +2145,26 @@ public static MachineDefinition[] registerSimpleGenerator(String name, GTRecipeType recipeType, Int2LongFunction tankScalingFunction, int... tiers) { - return registerTieredMachines(name, (holder, tier) -> new SimpleGeneratorMachine(holder, tier, tankScalingFunction), (tier, builder) -> builder - .langValue("%s %s Generator %s".formatted(VLVH[tier], toEnglishName(name), VLVT[tier])) - .editableUI(SimpleGeneratorMachine.EDITABLE_UI_CREATOR.apply(GTCEu.id(name), recipeType)) - .rotationState(RotationState.ALL) - .recipeType(recipeType) - .recipeModifier(SimpleGeneratorMachine::recipeModifier, true) - .addOutputLimit(ItemRecipeCapability.CAP, 0) - .addOutputLimit(FluidRecipeCapability.CAP, 0) - .renderer(() -> new SimpleGeneratorMachineRenderer(tier, GTCEu.id("block/generators/" + name))) - .tooltips(workableTiered(tier, GTValues.V[tier], GTValues.V[tier] * 64, recipeType, tankScalingFunction.apply(tier), false)) - .compassNode(name) - .register(), tiers); + return registerTieredMachines(name, + (holder, tier) -> new SimpleGeneratorMachine(holder, tier, tankScalingFunction), + (tier, builder) -> builder + .langValue("%s %s Generator %s".formatted(VLVH[tier], toEnglishName(name), VLVT[tier])) + .editableUI(SimpleGeneratorMachine.EDITABLE_UI_CREATOR.apply(GTCEu.id(name), recipeType)) + .rotationState(RotationState.ALL) + .recipeType(recipeType) + .recipeModifier(SimpleGeneratorMachine::recipeModifier, true) + .addOutputLimit(ItemRecipeCapability.CAP, 0) + .addOutputLimit(FluidRecipeCapability.CAP, 0) + .renderer(() -> new SimpleGeneratorMachineRenderer(tier, GTCEu.id("block/generators/" + name))) + .tooltips(workableTiered(tier, GTValues.V[tier], GTValues.V[tier] * 64, recipeType, + tankScalingFunction.apply(tier), false)) + .compassNode(name) + .register(), + tiers); } - public static Pair registerSimpleSteamMachines(String name, GTRecipeType recipeType) { + public static Pair registerSimpleSteamMachines(String name, + GTRecipeType recipeType) { return registerSteamMachines("steam_" + name, SimpleSteamMachine::new, (pressure, builder) -> builder .rotationState(RotationState.NON_Y_AXIS) .recipeType(recipeType) @@ -1875,16 +2173,20 @@ public static Pair registerSimpleSteamMach .register()); } - public static MachineDefinition[] registerBatteryBuffer(int batterySlotSize){ + public static MachineDefinition[] registerBatteryBuffer(int batterySlotSize) { return registerTieredMachines("battery_buffer_" + batterySlotSize + "x", (holder, tier) -> new BatteryBufferMachine(holder, tier, batterySlotSize), (tier, builder) -> builder .rotationState(RotationState.ALL) .renderer(() -> new BatteryBufferRenderer(tier, batterySlotSize)) .langValue("%s %s%s".formatted(VOLTAGE_NAMES[tier], batterySlotSize, "x Battery Buffer")) - .tooltips(Component.translatable("gtceu.universal.tooltip.item_storage_capacity", batterySlotSize), - Component.translatable("gtceu.universal.tooltip.voltage_in_out", GTValues.V[tier], GTValues.VNF[tier]), - Component.translatable("gtceu.universal.tooltip.amperage_in_till", batterySlotSize * BatteryBufferMachine.AMPS_PER_BATTERY), + .tooltips( + Component.translatable("gtceu.universal.tooltip.item_storage_capacity", + batterySlotSize), + Component.translatable("gtceu.universal.tooltip.voltage_in_out", GTValues.V[tier], + GTValues.VNF[tier]), + Component.translatable("gtceu.universal.tooltip.amperage_in_till", + batterySlotSize * BatteryBufferMachine.AMPS_PER_BATTERY), Component.translatable("gtceu.universal.tooltip.amperage_out_till", batterySlotSize)) .compassNode("battery_buffer") .register(), @@ -1899,8 +2201,10 @@ public static MachineDefinition[] registerCharger(int itemSlotSize) { .renderer(() -> new ChargerRenderer(tier)) .langValue("%s %s%s".formatted(VOLTAGE_NAMES[tier], itemSlotSize, "x Turbo Charger")) .tooltips(Component.translatable("gtceu.universal.tooltip.item_storage_capacity", itemSlotSize), - Component.translatable("gtceu.universal.tooltip.voltage_in_out", GTValues.V[tier], GTValues.VNF[tier]), - Component.translatable("gtceu.universal.tooltip.amperage_in_till", itemSlotSize * ChargerMachine.AMPS_PER_ITEM)) + Component.translatable("gtceu.universal.tooltip.voltage_in_out", GTValues.V[tier], + GTValues.VNF[tier]), + Component.translatable("gtceu.universal.tooltip.amperage_in_till", + itemSlotSize * ChargerMachine.AMPS_PER_ITEM)) .compassNode("charger") .register(), ALL_TIERS); @@ -1908,24 +2212,29 @@ public static MachineDefinition[] registerCharger(int itemSlotSize) { public static MachineDefinition[] registerLaserHatch(IO io, int amperage, PartAbility ability) { String name = io == IO.IN ? "target" : "source"; - return registerTieredMachines(amperage + "a_laser_" + name + "_hatch", (holder, tier) -> new LaserHatchPartMachine(holder, io, tier, amperage), (tier, builder) -> builder - .langValue(VNF[tier] + " " + FormattingUtil.formatNumbers(amperage) + "A Laser " + FormattingUtil.toEnglishName(name) + " Hatch") - .rotationState(RotationState.ALL) - .tooltips(Component.translatable("gtceu.machine.laser_hatch." + name + ".tooltip"), - Component.translatable("gtceu.machine.laser_hatch.both.tooltip"), - Component.translatable("gtceu.universal.disabled")) - .abilities(ability) - .overlayTieredHullRenderer("laser_hatch." + name) - .register(), HIGH_TIERS); + return registerTieredMachines(amperage + "a_laser_" + name + "_hatch", + (holder, tier) -> new LaserHatchPartMachine(holder, io, tier, amperage), (tier, builder) -> builder + .langValue(VNF[tier] + " " + FormattingUtil.formatNumbers(amperage) + "A Laser " + + FormattingUtil.toEnglishName(name) + " Hatch") + .rotationState(RotationState.ALL) + .tooltips(Component.translatable("gtceu.machine.laser_hatch." + name + ".tooltip"), + Component.translatable("gtceu.machine.laser_hatch.both.tooltip"), + Component.translatable("gtceu.universal.disabled")) + .abilities(ability) + .overlayTieredHullRenderer("laser_hatch." + name) + .register(), + HIGH_TIERS); } public static MultiblockMachineDefinition[] registerTieredMultis(String name, - BiFunction factory, - BiFunction builder, - int... tiers) { + BiFunction factory, + BiFunction builder, + int... tiers) { MultiblockMachineDefinition[] definitions = new MultiblockMachineDefinition[GTValues.TIER_COUNT]; for (int tier : tiers) { - var register = REGISTRATE.multiblock(GTValues.VN[tier].toLowerCase(Locale.ROOT) + "_" + name, holder -> factory.apply(holder, tier)) + var register = REGISTRATE + .multiblock(GTValues.VN[tier].toLowerCase(Locale.ROOT) + "_" + name, + holder -> factory.apply(holder, tier)) .tier(tier); definitions[tier] = builder.apply(tier, register); } @@ -1933,96 +2242,114 @@ public static MultiblockMachineDefinition[] registerTieredMultis(String name, } private static MachineDefinition registerTankValve( - String name, String displayName, boolean isMetal, - BiConsumer rendererSetup - ) { - MachineBuilder builder = REGISTRATE.machine(name, holder -> new TankValvePartMachine(holder, isMetal)) - .langValue(displayName) - .tooltips(Component.translatable("gtceu.machine.tank_valve.tooltip")) - .rotationState(RotationState.ALL) - .compassSections(GTCompassSections.MULTIBLOCK) - .compassNode("tank_valve"); + String name, String displayName, boolean isMetal, + BiConsumer rendererSetup) { + MachineBuilder builder = REGISTRATE + .machine(name, holder -> new TankValvePartMachine(holder, isMetal)) + .langValue(displayName) + .tooltips(Component.translatable("gtceu.machine.tank_valve.tooltip")) + .rotationState(RotationState.ALL) + .compassSections(GTCompassSections.MULTIBLOCK) + .compassNode("tank_valve"); rendererSetup.accept(builder, GTCEu.id("block/multiblock/tank_valve")); return builder.register(); } private static MultiblockMachineDefinition registerMultiblockTank( - String name, String displayName, int capacity, - Supplier casing, Supplier valve, - @Nullable PropertyFluidFilter filter, - BiConsumer rendererSetup - ) { - MultiblockMachineBuilder builder = REGISTRATE.multiblock(name, holder -> new MultiblockTankMachine(holder, capacity, filter)) - .langValue(displayName) - .tooltips( - Component.translatable("gtceu.machine.multiblock.tank.tooltip"), - Component.translatable("gtceu.universal.tooltip.fluid_storage_capacity", capacity) - ) - .rotationState(RotationState.NON_Y_AXIS) - .recipeType(DUMMY_RECIPES) - .pattern(definition -> FactoryBlockPattern.start() - .aisle("CCC", "CCC", "CCC") - .aisle("CCC", "C#C", "CCC") - .aisle("CCC", "CSC", "CCC") - .where('S', controller(blocks(definition.get()))) - .where('C', blocks(casing.get()) - .or(blocks(valve.get()).setMaxGlobalLimited(2, 0)) - ) - .where('#', air()) - .build() - ) - - .appearanceBlock(casing) - .compassSections(GTCompassSections.MULTIBLOCK) - .compassNode("multiblock_tank"); + String name, String displayName, int capacity, + Supplier casing, + Supplier valve, + @Nullable PropertyFluidFilter filter, + BiConsumer rendererSetup) { + MultiblockMachineBuilder builder = REGISTRATE + .multiblock(name, holder -> new MultiblockTankMachine(holder, capacity, filter)) + .langValue(displayName) + .tooltips( + Component.translatable("gtceu.machine.multiblock.tank.tooltip"), + Component.translatable("gtceu.universal.tooltip.fluid_storage_capacity", capacity)) + .rotationState(RotationState.NON_Y_AXIS) + .recipeType(DUMMY_RECIPES) + .pattern(definition -> FactoryBlockPattern.start() + .aisle("CCC", "CCC", "CCC") + .aisle("CCC", "C#C", "CCC") + .aisle("CCC", "CSC", "CCC") + .where('S', controller(blocks(definition.get()))) + .where('C', blocks(casing.get()) + .or(blocks(valve.get()).setMaxGlobalLimited(2, 0))) + .where('#', air()) + .build()) + + .appearanceBlock(casing) + .compassSections(GTCompassSections.MULTIBLOCK) + .compassNode("multiblock_tank"); rendererSetup.accept(builder, GTCEu.id("block/multiblock/multiblock_tank")); return builder.register(); } - - public static MultiblockMachineDefinition registerLargeBoiler(String name, Supplier casing, Supplier pipe, Supplier fireBox, ResourceLocation texture, BoilerFireboxType firebox, int maxTemperature, int heatSpeed) { - return REGISTRATE.multiblock("%s_large_boiler".formatted(name), holder -> new LargeBoilerMachine(holder, maxTemperature, heatSpeed)) + public static MultiblockMachineDefinition registerLargeBoiler(String name, Supplier casing, + Supplier pipe, + Supplier fireBox, + ResourceLocation texture, BoilerFireboxType firebox, + int maxTemperature, int heatSpeed) { + return REGISTRATE + .multiblock("%s_large_boiler".formatted(name), + holder -> new LargeBoilerMachine(holder, maxTemperature, heatSpeed)) .langValue("Large %s Boiler".formatted(FormattingUtil.toEnglishName(name))) .rotationState(RotationState.NON_Y_AXIS) .recipeType(GTRecipeTypes.LARGE_BOILER_RECIPES) .recipeModifier(LargeBoilerMachine::recipeModifier, true) .appearanceBlock(casing) - .partAppearance((controller, part, side) -> controller.self().getPos().below().getY() == part.self().getPos().getY() ? fireBox.get().defaultBlockState() : casing.get().defaultBlockState()) + .partAppearance((controller, part, + side) -> controller.self().getPos().below().getY() == part.self().getPos().getY() ? + fireBox.get().defaultBlockState() : casing.get().defaultBlockState()) .pattern((definition) -> { TraceabilityPredicate fireboxPred = blocks(ALL_FIREBOXES.get(firebox).get()).setMinGlobalLimited(3) - .or(Predicates.abilities(PartAbility.IMPORT_FLUIDS).setMinGlobalLimited(1).setPreviewCount(1)) - .or(Predicates.abilities(PartAbility.IMPORT_ITEMS).setMaxGlobalLimited(1).setPreviewCount(1)) - .or(Predicates.abilities(PartAbility.MUFFLER).setExactLimit(1)); + .or(Predicates.abilities(PartAbility.IMPORT_FLUIDS).setMinGlobalLimited(1) + .setPreviewCount(1)) + .or(Predicates.abilities(PartAbility.IMPORT_ITEMS).setMaxGlobalLimited(1) + .setPreviewCount(1)) + .or(Predicates.abilities(PartAbility.MUFFLER).setExactLimit(1)); if (ConfigHolder.INSTANCE.machines.enableMaintenance) { fireboxPred = fireboxPred.or(Predicates.abilities(PartAbility.MAINTENANCE).setExactLimit(1)); } return FactoryBlockPattern.start() - .aisle("XXX", "CCC", "CCC", "CCC") - .aisle("XXX", "CPC", "CPC", "CCC") - .aisle("XXX", "CSC", "CCC", "CCC") - .where('S', Predicates.controller(blocks(definition.getBlock()))) - .where('P', blocks(pipe.get())) - .where('X', fireboxPred) - .where('C', blocks(casing.get()).setMinGlobalLimited(20) - .or(Predicates.abilities(PartAbility.EXPORT_FLUIDS).setMinGlobalLimited(1).setPreviewCount(1))) - .build(); + .aisle("XXX", "CCC", "CCC", "CCC") + .aisle("XXX", "CPC", "CPC", "CCC") + .aisle("XXX", "CSC", "CCC", "CCC") + .where('S', Predicates.controller(blocks(definition.getBlock()))) + .where('P', blocks(pipe.get())) + .where('X', fireboxPred) + .where('C', blocks(casing.get()).setMinGlobalLimited(20) + .or(Predicates.abilities(PartAbility.EXPORT_FLUIDS).setMinGlobalLimited(1) + .setPreviewCount(1))) + .build(); }) - .recoveryItems(() -> new ItemLike[]{GTItems.MATERIAL_ITEMS.get(TagPrefix.dustTiny, GTMaterials.Ash).get()}) - .renderer(() -> new LargeBoilerRenderer(texture, firebox, GTCEu.id("block/multiblock/generator/large_%s_boiler".formatted(name)))) + .recoveryItems( + () -> new ItemLike[] { GTItems.MATERIAL_ITEMS.get(TagPrefix.dustTiny, GTMaterials.Ash).get() }) + .renderer(() -> new LargeBoilerRenderer(texture, firebox, + GTCEu.id("block/multiblock/generator/large_%s_boiler".formatted(name)))) .tooltips( - Component.translatable("gtceu.multiblock.large_boiler.max_temperature", (int)(maxTemperature + 274.15), maxTemperature), - Component.translatable("gtceu.multiblock.large_boiler.heat_time_tooltip", maxTemperature / heatSpeed / 20), - Component.translatable("gtceu.multiblock.large_boiler.explosion_tooltip").withStyle(ChatFormatting.DARK_RED)) + Component.translatable("gtceu.multiblock.large_boiler.max_temperature", + (int) (maxTemperature + 274.15), maxTemperature), + Component.translatable("gtceu.multiblock.large_boiler.heat_time_tooltip", + maxTemperature / heatSpeed / 20), + Component.translatable("gtceu.multiblock.large_boiler.explosion_tooltip") + .withStyle(ChatFormatting.DARK_RED)) .compassSections(GTCompassSections.STEAM) .compassNode("large_boiler") .register(); } - public static MultiblockMachineDefinition registerLargeCombustionEngine(String name, int tier, Supplier casing, Supplier gear, Supplier intake, ResourceLocation casingTexture, ResourceLocation overlayModel) { + public static MultiblockMachineDefinition registerLargeCombustionEngine(String name, int tier, + Supplier casing, + Supplier gear, + Supplier intake, + ResourceLocation casingTexture, + ResourceLocation overlayModel) { return REGISTRATE.multiblock(name, holder -> new LargeCombustionEngineMachine(holder, tier)) .rotationState(RotationState.NON_Y_AXIS) .recipeType(GTRecipeTypes.COMBUSTION_GENERATOR_FUELS) @@ -2039,23 +2366,39 @@ public static MultiblockMachineDefinition registerLargeCombustionEngine(String n .where('C', blocks(casing.get()).setMinGlobalLimited(3) .or(autoAbilities(definition.getRecipeTypes(), false, false, true, true, true, true)) .or(autoAbilities(true, true, false))) - .where('D', ability(PartAbility.OUTPUT_ENERGY, Stream.of(ULV, LV, MV, HV ,EV ,IV, LuV, ZPM, UV, UHV).filter(t -> t >= tier).mapToInt(Integer::intValue).toArray()).addTooltips(Component.translatable("gtceu.multiblock.pattern.error.limited.1", GTValues.VN[tier]))) - .where('A', blocks(intake.get()).addTooltips(Component.translatable("gtceu.multiblock.pattern.clear_amount_1"))) + .where('D', + ability(PartAbility.OUTPUT_ENERGY, + Stream.of(ULV, LV, MV, HV, EV, IV, LuV, ZPM, UV, UHV).filter(t -> t >= tier) + .mapToInt(Integer::intValue).toArray()) + .addTooltips(Component.translatable("gtceu.multiblock.pattern.error.limited.1", + GTValues.VN[tier]))) + .where('A', + blocks(intake.get()) + .addTooltips(Component.translatable("gtceu.multiblock.pattern.clear_amount_1"))) .where('Y', controller(blocks(definition.getBlock()))) .build()) - .recoveryItems(() -> new ItemLike[]{GTItems.MATERIAL_ITEMS.get(TagPrefix.dustTiny, GTMaterials.Ash).get()}) + .recoveryItems( + () -> new ItemLike[] { GTItems.MATERIAL_ITEMS.get(TagPrefix.dustTiny, GTMaterials.Ash).get() }) .workableCasingRenderer(casingTexture, overlayModel, false) .tooltips( Component.translatable("gtceu.universal.tooltip.base_production_eut", V[tier]), - Component.translatable("gtceu.universal.tooltip.uses_per_hour_lubricant", FluidHelper.getBucket()), - tier > EV ? Component.translatable("gtceu.machine.large_combustion_engine.tooltip.boost_extreme", V[tier] * 4) : - Component.translatable("gtceu.machine.large_combustion_engine.tooltip.boost_regular", V[tier] * 3)) + Component.translatable("gtceu.universal.tooltip.uses_per_hour_lubricant", + FluidHelper.getBucket()), + tier > EV ? + Component.translatable("gtceu.machine.large_combustion_engine.tooltip.boost_extreme", + V[tier] * 4) : + Component.translatable("gtceu.machine.large_combustion_engine.tooltip.boost_regular", + V[tier] * 3)) .compassSections(GTCompassSections.TIER[EV]) .compassNode("large_combustion") .register(); } - public static MultiblockMachineDefinition registerLargeTurbine(String name, int tier, GTRecipeType recipeType, Supplier casing, Supplier gear, ResourceLocation casingTexture, ResourceLocation overlayModel) { + public static MultiblockMachineDefinition registerLargeTurbine(String name, int tier, GTRecipeType recipeType, + Supplier casing, + Supplier gear, + ResourceLocation casingTexture, + ResourceLocation overlayModel) { return REGISTRATE.multiblock(name, holder -> new LargeTurbineMachine(holder, tier)) .rotationState(RotationState.NON_Y_AXIS) .recipeType(recipeType) @@ -2069,18 +2412,28 @@ public static MultiblockMachineDefinition registerLargeTurbine(String name, int .where('S', controller(blocks(definition.getBlock()))) .where('G', blocks(gear.get())) .where('C', blocks(casing.get())) - .where('R', new TraceabilityPredicate(new SimplePredicate(state -> MetaMachine.getMachine(state.getWorld(), state.getPos()) instanceof IRotorHolderMachine rotorHolder && - state.getWorld().getBlockState(state.getPos().relative(rotorHolder.self().getFrontFacing())).isAir(), - () -> PartAbility.ROTOR_HOLDER.getAllBlocks().stream().map(BlockInfo::fromBlock).toArray(BlockInfo[]::new))) - .addTooltips(Component.translatable("gtceu.multiblock.pattern.clear_amount_3")) - .addTooltips(Component.translatable("gtceu.multiblock.pattern.error.limited.1", VN[tier])) - .setExactLimit(1) - .or(abilities(PartAbility.OUTPUT_ENERGY)).setExactLimit(1)) + .where('R', + new TraceabilityPredicate( + new SimplePredicate( + state -> MetaMachine.getMachine(state.getWorld(), + state.getPos()) instanceof IRotorHolderMachine rotorHolder && + state.getWorld() + .getBlockState(state.getPos() + .relative(rotorHolder.self().getFrontFacing())) + .isAir(), + () -> PartAbility.ROTOR_HOLDER.getAllBlocks().stream() + .map(BlockInfo::fromBlock).toArray(BlockInfo[]::new))) + .addTooltips(Component.translatable("gtceu.multiblock.pattern.clear_amount_3")) + .addTooltips(Component.translatable("gtceu.multiblock.pattern.error.limited.1", + VN[tier])) + .setExactLimit(1) + .or(abilities(PartAbility.OUTPUT_ENERGY)).setExactLimit(1)) .where('H', blocks(casing.get()) .or(autoAbilities(definition.getRecipeTypes(), false, false, true, true, true, true)) .or(autoAbilities(true, true, false))) .build()) - .recoveryItems(() -> new ItemLike[]{GTItems.MATERIAL_ITEMS.get(TagPrefix.dustTiny, GTMaterials.Ash).get()}) + .recoveryItems( + () -> new ItemLike[] { GTItems.MATERIAL_ITEMS.get(TagPrefix.dustTiny, GTMaterials.Ash).get() }) .workableCasingRenderer(casingTexture, overlayModel, false) .tooltips( Component.translatable("gtceu.universal.tooltip.base_production_eut", V[tier] * 2), @@ -2097,7 +2450,8 @@ public static MachineDefinition registerCrate(Material material, int capacity, S .langValue(lang) .rotationState(RotationState.NONE) .tooltips(Component.translatable("gtceu.universal.tooltip.item_storage_capacity", capacity)) - .renderer(() -> new MachineRenderer(GTCEu.id("block/machine/crate/" + (wooden ? "wooden" : "metal") + "_crate"))) + .renderer(() -> new MachineRenderer( + GTCEu.id("block/machine/crate/" + (wooden ? "wooden" : "metal") + "_crate"))) .paintingColor(wooden ? 0xFFFFFF : material.getMaterialRGB()) .itemColor((s, t) -> wooden ? 0xFFFFFF : material.getMaterialRGB()) .compassNode("crate") @@ -2106,12 +2460,17 @@ public static MachineDefinition registerCrate(Material material, int capacity, S public static MachineDefinition registerDrum(Material material, int capacity, String lang) { boolean wooden = material.hasProperty(PropertyKey.WOOD); - var definition = REGISTRATE.machine(material.getName() + "_drum", MachineDefinition::createDefinition, holder -> new DrumMachine(holder, material, capacity), MetaMachineBlock::new, DrumMachineItem::create, MetaMachineBlockEntity::createBlockEntity) + var definition = REGISTRATE + .machine(material.getName() + "_drum", MachineDefinition::createDefinition, + holder -> new DrumMachine(holder, material, capacity), MetaMachineBlock::new, + DrumMachineItem::create, MetaMachineBlockEntity::createBlockEntity) .langValue(lang) .rotationState(RotationState.NONE) - .renderer(() -> new MachineRenderer(GTCEu.id("block/machine/" + (wooden ? "wooden" : "metal") + "_drum"))) + .renderer( + () -> new MachineRenderer(GTCEu.id("block/machine/" + (wooden ? "wooden" : "metal") + "_drum"))) .tooltipBuilder(createTankTooltips("Fluid")) - .tooltips(Component.translatable("gtceu.machine.quantum_tank.tooltip"), Component.translatable("gtceu.universal.tooltip.fluid_storage_capacity", capacity)) + .tooltips(Component.translatable("gtceu.machine.quantum_tank.tooltip"), + Component.translatable("gtceu.universal.tooltip.fluid_storage_capacity", capacity)) .paintingColor(wooden ? 0xFFFFFF : material.getMaterialRGB()) .itemColor((s, i) -> wooden ? 0xFFFFFF : material.getMaterialRGB()) .compassNode("drum") @@ -2129,8 +2488,14 @@ public static MachineDefinition[] registerConverter(int amperage) { .renderer(() -> new ConverterRenderer(tier)) .tooltips(Component.translatable("gtceu.machine.energy_converter.description"), Component.translatable("gtceu.machine.energy_converter.tooltip_tool_usage"), - Component.translatable("gtceu.machine.energy_converter.tooltip_conversion_native", PlatformEnergyCompat.toNativeLong(V[tier] * amperage, PlatformEnergyCompat.ratio(true)), amperage, V[tier], GTValues.VNF[tier]), - Component.translatable("gtceu.machine.energy_converter.tooltip_conversion_eu", amperage, V[tier], GTValues.VNF[tier], PlatformEnergyCompat.toNativeLong(V[tier] * amperage, PlatformEnergyCompat.ratio(false)))) + Component.translatable("gtceu.machine.energy_converter.tooltip_conversion_native", + PlatformEnergyCompat.toNativeLong(V[tier] * amperage, + PlatformEnergyCompat.ratio(true)), + amperage, V[tier], GTValues.VNF[tier]), + Component.translatable("gtceu.machine.energy_converter.tooltip_conversion_eu", amperage, + V[tier], GTValues.VNF[tier], + PlatformEnergyCompat.toNativeLong(V[tier] * amperage, + PlatformEnergyCompat.ratio(false)))) .compassNode("converter") .register(), ALL_TIERS); @@ -2142,13 +2507,18 @@ public static Component explosion() { return null; } - public static Component[] workableTiered(int tier, long voltage, long energyCapacity, GTRecipeType recipeType, long tankCapacity, boolean input) { + public static Component[] workableTiered(int tier, long voltage, long energyCapacity, GTRecipeType recipeType, + long tankCapacity, boolean input) { List tooltipComponents = new ArrayList<>(); - tooltipComponents.add(input ? Component.translatable("gtceu.universal.tooltip.voltage_in", voltage, GTValues.VNF[tier]) : - Component.translatable("gtceu.universal.tooltip.voltage_out", voltage, GTValues.VNF[tier])); - tooltipComponents.add(Component.translatable("gtceu.universal.tooltip.energy_storage_capacity", energyCapacity)); - if (recipeType.getMaxInputs(FluidRecipeCapability.CAP) > 0 || recipeType.getMaxOutputs(FluidRecipeCapability.CAP) > 0) - tooltipComponents.add(Component.translatable("gtceu.universal.tooltip.fluid_storage_capacity", tankCapacity)); + tooltipComponents + .add(input ? Component.translatable("gtceu.universal.tooltip.voltage_in", voltage, GTValues.VNF[tier]) : + Component.translatable("gtceu.universal.tooltip.voltage_out", voltage, GTValues.VNF[tier])); + tooltipComponents + .add(Component.translatable("gtceu.universal.tooltip.energy_storage_capacity", energyCapacity)); + if (recipeType.getMaxInputs(FluidRecipeCapability.CAP) > 0 || + recipeType.getMaxOutputs(FluidRecipeCapability.CAP) > 0) + tooltipComponents + .add(Component.translatable("gtceu.universal.tooltip.fluid_storage_capacity", tankCapacity)); return tooltipComponents.toArray(Component[]::new); } @@ -2156,11 +2526,10 @@ private static TraceabilityPredicate dataHatchPredicate(TraceabilityPredicate de // if research is enabled, require the data hatch, otherwise use a grate instead if (ConfigHolder.INSTANCE.machines.enableResearch) { return abilities(PartAbility.DATA_ACCESS, PartAbility.OPTICAL_DATA_RECEPTION) - .setExactLimit(1) - .or(def); + .setExactLimit(1) + .or(def); } return def; - } public static void init() { @@ -2174,29 +2543,39 @@ public static void init() { GTAEMachines.init(); } if (ConfigHolder.INSTANCE.machines.doBedrockOres || Platform.isDevEnv()) { - BEDROCK_ORE_MINER = registerTieredMultis("bedrock_ore_miner", BedrockOreMinerMachine::new, (tier, builder) -> builder + BEDROCK_ORE_MINER = registerTieredMultis( + "bedrock_ore_miner", BedrockOreMinerMachine::new, (tier, builder) -> builder .rotationState(RotationState.NON_Y_AXIS) .langValue("%s Bedrock Ore Miner %s".formatted(VLVH[tier], VLVT[tier])) .recipeType(new GTRecipeType(GTCEu.id("bedrock_ore_miner"), "dummy")) .tooltips( Component.translatable("gtceu.machine.bedrock_ore_miner.description"), - Component.translatable("gtceu.machine.bedrock_ore_miner.depletion", FormattingUtil.formatNumbers(100.0 / BedrockOreMinerMachine.getDepletionChance(tier))), - Component.translatable("gtceu.universal.tooltip.energy_tier_range", GTValues.VNF[tier], GTValues.VNF[tier + 1]), - Component.translatable("gtceu.machine.bedrock_ore_miner.production", BedrockOreMinerMachine.getRigMultiplier(tier), FormattingUtil.formatNumbers(BedrockOreMinerMachine.getRigMultiplier(tier) * 1.5))) + Component.translatable("gtceu.machine.bedrock_ore_miner.depletion", + FormattingUtil.formatNumbers( + 100.0 / BedrockOreMinerMachine.getDepletionChance(tier))), + Component.translatable("gtceu.universal.tooltip.energy_tier_range", + GTValues.VNF[tier], GTValues.VNF[tier + 1]), + Component.translatable("gtceu.machine.bedrock_ore_miner.production", + BedrockOreMinerMachine.getRigMultiplier(tier), + FormattingUtil.formatNumbers( + BedrockOreMinerMachine.getRigMultiplier(tier) * 1.5))) .appearanceBlock(() -> BedrockOreMinerMachine.getCasingState(tier)) .pattern((definition) -> FactoryBlockPattern.start() .aisle("XXX", "#F#", "#F#", "#F#", "###", "###", "###") .aisle("XXX", "FCF", "FCF", "FCF", "#F#", "#F#", "#F#") .aisle("XSX", "#F#", "#F#", "#F#", "###", "###", "###") .where('S', controller(blocks(definition.get()))) - .where('X', blocks(BedrockOreMinerMachine.getCasingState(tier)).setMinGlobalLimited(3) - .or(abilities(PartAbility.INPUT_ENERGY).setMinGlobalLimited(1).setMaxGlobalLimited(2)) - .or(abilities(PartAbility.EXPORT_ITEMS).setMaxGlobalLimited(1))) + .where('X', + blocks(BedrockOreMinerMachine.getCasingState(tier)).setMinGlobalLimited(3) + .or(abilities(PartAbility.INPUT_ENERGY).setMinGlobalLimited(1) + .setMaxGlobalLimited(2)) + .or(abilities(PartAbility.EXPORT_ITEMS).setMaxGlobalLimited(1))) .where('C', blocks(BedrockOreMinerMachine.getCasingState(tier))) .where('F', blocks(BedrockOreMinerMachine.getFrameState(tier))) .where('#', any()) .build()) - .workableCasingRenderer(BedrockOreMinerMachine.getBaseTexture(tier), GTCEu.id("block/multiblock/bedrock_ore_miner"), false) + .workableCasingRenderer(BedrockOreMinerMachine.getBaseTexture(tier), + GTCEu.id("block/multiblock/bedrock_ore_miner"), false) .register(), MV, HV, EV); } @@ -2210,5 +2589,4 @@ public static void init() { public static MachineDefinition get(String name) { return GTRegistries.MACHINES.get(GTCEu.id(name)); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTMaterials.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTMaterials.java index 5322b44d47..aa04916dfe 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTMaterials.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTMaterials.java @@ -10,9 +10,11 @@ import com.gregtechceu.gtceu.api.data.tag.TagPrefix; import com.gregtechceu.gtceu.common.data.materials.*; import com.gregtechceu.gtceu.utils.SupplierMemoizer; + import net.minecraft.world.item.Items; import net.minecraft.world.level.ItemLike; import net.minecraft.world.level.block.Blocks; + import org.jetbrains.annotations.Nullable; import java.util.ArrayList; @@ -22,21 +24,20 @@ import static com.gregtechceu.gtceu.api.data.chemical.material.info.MaterialFlags.*; import static com.gregtechceu.gtceu.api.data.tag.TagPrefix.*; - /** * Material Registration. *

* All Material Builders should follow this general formatting: *

* material = new MaterialBuilder(id, name) - * .ingot().fluid().ore() <--- types - * .color().iconSet() <--- appearance - * .flags() <--- special generation - * .element() / .components() <--- composition - * .toolStats() <--- - * .oreByProducts() | additional properties - * ... <--- - * .blastTemp() <--- blast temperature + * .ingot().fluid().ore() <--- types + * .color().iconSet() <--- appearance + * .flags() <--- special generation + * .element() / .components() <--- composition + * .toolStats() <--- + * .oreByProducts() | additional properties + * ... <--- + * .blastTemp() <--- blast temperature * .build(); *

* Use defaults to your advantage! Some defaults: @@ -47,8 +48,8 @@ public class GTMaterials { public static Material[] CHEMICAL_DYES; public static Material[] VOLTAGE_COMMON_MATERIALS; - public static void init() { + public static void init() { MarkerMaterials.register(); ElementMaterials.register(); @@ -58,7 +59,7 @@ public static void init() { SecondDegreeMaterials.register(); HigherDegreeMaterials.register(); - //Gregicality Multiblocks + // Gregicality Multiblocks GCyMMaterials.register(); /* @@ -66,7 +67,7 @@ public static void init() { */ MaterialFlagAddition.register(); - CHEMICAL_DYES = new Material[]{ + CHEMICAL_DYES = new Material[] { DyeWhite, DyeOrange, DyeMagenta, DyeLightBlue, DyeYellow, DyeLime, @@ -147,8 +148,10 @@ public static void init() { block.setIgnored(Bone, Blocks.BONE_BLOCK); block.setIgnored(NetherQuartz, Blocks.QUARTZ_BLOCK); block.setIgnored(Ice, Blocks.ICE); - block.setIgnored(Concrete, Blocks.WHITE_CONCRETE, Blocks.ORANGE_CONCRETE, Blocks.MAGENTA_CONCRETE, Blocks.LIGHT_BLUE_CONCRETE, Blocks.YELLOW_CONCRETE, Blocks.LIME_CONCRETE, - Blocks.PINK_CONCRETE, Blocks.GRAY_CONCRETE, Blocks.LIGHT_GRAY_CONCRETE, Blocks.CYAN_CONCRETE, Blocks.PURPLE_CONCRETE, Blocks.BLUE_CONCRETE, + block.setIgnored(Concrete, Blocks.WHITE_CONCRETE, Blocks.ORANGE_CONCRETE, Blocks.MAGENTA_CONCRETE, + Blocks.LIGHT_BLUE_CONCRETE, Blocks.YELLOW_CONCRETE, Blocks.LIME_CONCRETE, + Blocks.PINK_CONCRETE, Blocks.GRAY_CONCRETE, Blocks.LIGHT_GRAY_CONCRETE, Blocks.CYAN_CONCRETE, + Blocks.PURPLE_CONCRETE, Blocks.BLUE_CONCRETE, Blocks.BROWN_CONCRETE, Blocks.GREEN_CONCRETE, Blocks.RED_CONCRETE, Blocks.BLACK_CONCRETE); block.setIgnored(Blaze); block.setIgnored(Lapotron); @@ -180,8 +183,10 @@ public static void init() { crushed.addSecondaryMaterial(new MaterialStack(Stone, dust.materialAmount())); toolHeadDrill.addSecondaryMaterial(new MaterialStack(Steel, plate.materialAmount() * 4)); - toolHeadChainsaw.addSecondaryMaterial(new MaterialStack(Steel, plate.materialAmount() * 4 + ring.materialAmount() * 2)); - toolHeadWrench.addSecondaryMaterial(new MaterialStack(Steel, ring.materialAmount() + screw.materialAmount() * 2)); + toolHeadChainsaw + .addSecondaryMaterial(new MaterialStack(Steel, plate.materialAmount() * 4 + ring.materialAmount() * 2)); + toolHeadWrench + .addSecondaryMaterial(new MaterialStack(Steel, ring.materialAmount() + screw.materialAmount() * 2)); pipeTinyFluid.setIgnored(Wood); pipeHugeFluid.setIgnored(Wood); @@ -499,7 +504,6 @@ private static void excludeAllGemsButNormal(Material material) { public static Material Tantalite; public static Material Coke; - public static Material SolderingAlloy; public static Material Spessartine; public static Material Sphalerite; @@ -587,6 +591,7 @@ private static void excludeAllGemsButNormal(Material material) { public static Material HydrofluoricAcid; public static Material NitricOxide; public static Material Iron3Chloride; + public static Material Iron2Chloride; public static Material UraniumHexafluoride; public static Material EnrichedUraniumHexafluoride; public static Material DepletedUraniumHexafluoride; @@ -626,6 +631,29 @@ private static void excludeAllGemsButNormal(Material material) { public static Material EnrichedNaquadahSulfate; public static Material NaquadriaSulfate; public static Material Pyrochlore; + public static Material PotassiumHydroxide; + public static Material PotassiumIodide; + public static Material PotassiumFerrocyanide; + public static Material CalciumFerrocyanide; + public static Material CalciumHydroxide; + public static Material CalciumCarbonate; + public static Material PotassiumCyanide; + public static Material PotassiumCarbonate; + public static Material HydrogenCyanide; + public static Material FormicAcid; + public static Material PotassiumSulfate; + public static Material PrussianBlue; + public static Material Formaldehyde; + public static Material Glycolonitrile; + public static Material DiethylenetriaminePentaacetonitrile; + public static Material DiethylenetriaminepentaaceticAcid; + public static Material SodiumNitrite; + + public static Material AcidicBromineSolution; + public static Material ConcentratedBromineSolution; + public static Material Iodide; + public static Material IodineSolution; + public static Material DiluteIodineSolution; /** * Organic chemistry @@ -709,6 +737,11 @@ private static void excludeAllGemsButNormal(Material material) { public static Material PolyvinylButyral; public static Material Biphenyl; public static Material PolychlorinatedBiphenyl; + public static Material AceticAnhydride; + public static Material AminoPhenol; + public static Material Paracetamol; + public static Material AmmoniumFormate; + public static Material Formamide; /** * Not possible to determine exact Components @@ -899,6 +932,13 @@ private static void excludeAllGemsButNormal(Material material) { public static Material SaltWater; public static Material Clay; public static Material Redstone; + public static Material Dichloroethane; + public static Material Diethylenetriamine; + + public static Material RawBrine; + public static Material DebrominatedBrine; + public static Material BrominatedChlorineVapor; + public static Material AcidicBromineExhaust; /** * Third Degree Materials @@ -919,6 +959,11 @@ private static void excludeAllGemsButNormal(Material material) { public static Material Fireclay; public static Material Diorite; + public static Material HotBrine; + public static Material HotChlorinatedBrominatedBrine; + public static Material HotDebrominatedBrine; + public static Material HotAlkalineDebrominatedBrine; + /** * Fourth Degree Materials */ @@ -927,6 +972,7 @@ private static void excludeAllGemsButNormal(Material material) { public static Material BasalticMineralSand; public static Material HSSE; public static Material HSSS; + public static Material RadAway; /** * GCyM Materials @@ -943,6 +989,4 @@ private static void excludeAllGemsButNormal(Material material) { public static Material TitaniumCarbide; public static Material TitaniumTungstenCarbide; public static Material HastelloyC276; - - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTMobEffects.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTMobEffects.java new file mode 100644 index 0000000000..ea0041cdc4 --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTMobEffects.java @@ -0,0 +1,24 @@ +package com.gregtechceu.gtceu.common.data; + +import com.gregtechceu.gtceu.GTCEu; +import com.gregtechceu.gtceu.common.effect.GTPoisonEffect; + +import net.minecraft.world.effect.MobEffect; +import net.minecraft.world.effect.MobEffectCategory; +import net.minecraftforge.eventbus.api.IEventBus; +import net.minecraftforge.registries.DeferredRegister; +import net.minecraftforge.registries.ForgeRegistries; +import net.minecraftforge.registries.RegistryObject; + +public class GTMobEffects { + + public static final DeferredRegister MOB_EFFECTS = DeferredRegister.create(ForgeRegistries.MOB_EFFECTS, + GTCEu.MOD_ID); + + public static final RegistryObject WEAK_POISON = MOB_EFFECTS.register("weak_poison", + () -> new GTPoisonEffect(MobEffectCategory.HARMFUL, 0x6D7917)); + + public static void init(IEventBus modBus) { + MOB_EFFECTS.register(modBus); + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTModels.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTModels.java index 58cd607d26..1e857a4869 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTModels.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTModels.java @@ -1,6 +1,5 @@ package com.gregtechceu.gtceu.common.data; -import com.google.gson.JsonObject; import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.GTCEuAPI; import com.gregtechceu.gtceu.api.data.chemical.material.info.MaterialIconSet; @@ -10,19 +9,12 @@ import com.gregtechceu.gtceu.api.fluids.store.FluidStorageKey; import com.gregtechceu.gtceu.core.MixinHelpers; import com.gregtechceu.gtceu.data.pack.GTDynamicResourcePack; -import com.lowdragmc.lowdraglib.side.fluid.FluidHelper; -import com.lowdragmc.lowdraglib.side.fluid.FluidStack; -import com.tterrag.registrate.providers.DataGenContext; -import com.tterrag.registrate.providers.RegistrateBlockstateProvider; -import com.tterrag.registrate.providers.RegistrateItemModelProvider; -import com.tterrag.registrate.util.nullness.NonNullBiConsumer; + import net.minecraft.client.Minecraft; import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.data.models.model.DelegatedModel; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.GsonHelper; import net.minecraft.world.item.BlockItem; -import net.minecraft.world.level.block.DoorBlock; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.material.Fluid; @@ -31,6 +23,12 @@ import net.minecraftforge.client.model.generators.ModelProvider; import net.minecraftforge.registries.ForgeRegistries; +import com.google.gson.JsonObject; +import com.tterrag.registrate.providers.DataGenContext; +import com.tterrag.registrate.providers.RegistrateBlockstateProvider; +import com.tterrag.registrate.providers.RegistrateItemModelProvider; +import com.tterrag.registrate.util.nullness.NonNullBiConsumer; + import java.io.BufferedReader; import java.io.IOException; @@ -40,81 +38,99 @@ * @implNote GTModels */ public class GTModels { - public static void createModelBlockState(DataGenContext ctx, RegistrateBlockstateProvider prov, ResourceLocation modelLocation) { + + public static void createModelBlockState(DataGenContext ctx, + RegistrateBlockstateProvider prov, ResourceLocation modelLocation) { prov.simpleBlock(ctx.getEntry(), prov.models().getExistingFile(modelLocation)); } - public static void createCrossBlockState(DataGenContext ctx, RegistrateBlockstateProvider prov) { - prov.simpleBlock(ctx.getEntry(), prov.models().cross(ForgeRegistries.BLOCKS.getKey(ctx.getEntry()).getPath(), prov.blockTexture(ctx.getEntry()))); + public static void createCrossBlockState(DataGenContext ctx, + RegistrateBlockstateProvider prov) { + prov.simpleBlock(ctx.getEntry(), prov.models().cross(ForgeRegistries.BLOCKS.getKey(ctx.getEntry()).getPath(), + prov.blockTexture(ctx.getEntry()))); } public static void cellModel(DataGenContext ctx, RegistrateItemModelProvider prov) { // empty model - prov.getBuilder("item/" + prov.name(ctx::getEntry) + "_empty").parent(new ModelFile.UncheckedModelFile("item/generated")) - .texture("layer0", prov.modLoc("item/%s/base".formatted(prov.name(ctx)))); + prov.getBuilder("item/" + prov.name(ctx::getEntry) + "_empty") + .parent(new ModelFile.UncheckedModelFile("item/generated")) + .texture("layer0", prov.modLoc("item/%s/base".formatted(prov.name(ctx)))); // filled model - prov.getBuilder("item/" + prov.name(ctx::getEntry) + "_filled").parent(new ModelFile.UncheckedModelFile("item/generated")) - .texture("layer0", prov.modLoc("item/%s/base".formatted(prov.name(ctx)))) - .texture("layer1", prov.modLoc("item/%s/overlay".formatted(prov.name(ctx)))); + prov.getBuilder("item/" + prov.name(ctx::getEntry) + "_filled") + .parent(new ModelFile.UncheckedModelFile("item/generated")) + .texture("layer0", prov.modLoc("item/%s/base".formatted(prov.name(ctx)))) + .texture("layer1", prov.modLoc("item/%s/overlay".formatted(prov.name(ctx)))); // root model prov.generated(ctx::getEntry, prov.modLoc("item/%s/base".formatted(prov.name(ctx)))) - .override().predicate(GTCEu.id("fluid_cell"), 0) - .model(new ModelFile.UncheckedModelFile(prov.modLoc("item/%s_empty".formatted(prov.name(ctx))))) - .end() - .override().predicate(GTCEu.id("fluid_cell"), 1) - .model(new ModelFile.UncheckedModelFile(prov.modLoc("item/%s_filled".formatted(prov.name(ctx))))) - .end(); + .override().predicate(GTCEu.id("fluid_cell"), 0) + .model(new ModelFile.UncheckedModelFile(prov.modLoc("item/%s_empty".formatted(prov.name(ctx))))) + .end() + .override().predicate(GTCEu.id("fluid_cell"), 1) + .model(new ModelFile.UncheckedModelFile(prov.modLoc("item/%s_filled".formatted(prov.name(ctx))))) + .end(); } - public static NonNullBiConsumer, RegistrateItemModelProvider> overrideModel(ResourceLocation predicate, int modelNumber) { + public static < + T extends Item> NonNullBiConsumer, RegistrateItemModelProvider> overrideModel(ResourceLocation predicate, + int modelNumber) { if (modelNumber <= 0) return NonNullBiConsumer.noop(); return (ctx, prov) -> { var rootModel = prov.generated(ctx::getEntry, prov.modLoc("item/%s/1".formatted(prov.name(ctx)))); for (int i = 0; i < modelNumber; i++) { - var subModelBuilder = prov.getBuilder("item/" + prov.name(ctx::getEntry) + "/" + i).parent(new ModelFile.UncheckedModelFile("item/generated")); + var subModelBuilder = prov.getBuilder("item/" + prov.name(ctx::getEntry) + "/" + i) + .parent(new ModelFile.UncheckedModelFile("item/generated")); subModelBuilder.texture("layer0", prov.modLoc("item/%s/%d".formatted(prov.name(ctx), i + 1))); - rootModel = rootModel.override().predicate(predicate, i / 100f).model(new ModelFile.UncheckedModelFile(prov.modLoc("item/%s/%d".formatted(prov.name(ctx), i)))).end(); + rootModel = rootModel.override().predicate(predicate, i / 100f) + .model(new ModelFile.UncheckedModelFile(prov.modLoc("item/%s/%d".formatted(prov.name(ctx), i)))) + .end(); } }; } - public static void createTextureModel(DataGenContext ctx, RegistrateItemModelProvider prov, ResourceLocation texture) { + public static void createTextureModel(DataGenContext ctx, RegistrateItemModelProvider prov, + ResourceLocation texture) { prov.generated(ctx, texture); } - public static void rubberTreeSaplingModel(DataGenContext context, RegistrateItemModelProvider provider) { + public static void rubberTreeSaplingModel(DataGenContext context, + RegistrateItemModelProvider provider) { provider.generated(context, provider.modLoc("block/" + provider.name(context))); } - public static void longDistanceItemPipeModel(DataGenContext ctx, RegistrateBlockstateProvider prov) { - prov.simpleBlock(ctx.getEntry(), prov.models().cubeAll("long_distance_item_pipeline", prov.modLoc("block/pipe/ld_item_pipe/block"))); + public static void longDistanceItemPipeModel(DataGenContext ctx, + RegistrateBlockstateProvider prov) { + prov.simpleBlock(ctx.getEntry(), + prov.models().cubeAll("long_distance_item_pipeline", prov.modLoc("block/pipe/ld_item_pipe/block"))); } - public static void longDistanceFluidPipeModel(DataGenContext ctx, RegistrateBlockstateProvider prov) { - prov.simpleBlock(ctx.getEntry(), prov.models().cubeAll("long_distance_fluid_pipeline", prov.modLoc("block/pipe/ld_fluid_pipe/block"))); + public static void longDistanceFluidPipeModel(DataGenContext ctx, + RegistrateBlockstateProvider prov) { + prov.simpleBlock(ctx.getEntry(), + prov.models().cubeAll("long_distance_fluid_pipeline", prov.modLoc("block/pipe/ld_fluid_pipe/block"))); } public static NonNullBiConsumer, RegistrateBlockstateProvider> randomRotatedModel(ResourceLocation texturePath) { return (ctx, prov) -> { Block block = ctx.getEntry(); ModelFile cubeAll = prov.models().cubeAll(ctx.getName(), texturePath); - ModelFile cubeMirroredAll = prov.models().singleTexture(ctx.getName() + "_mirrored", prov.mcLoc(ModelProvider.BLOCK_FOLDER + "/cube_mirrored_all"), "all", texturePath); + ModelFile cubeMirroredAll = prov.models().singleTexture(ctx.getName() + "_mirrored", + prov.mcLoc(ModelProvider.BLOCK_FOLDER + "/cube_mirrored_all"), "all", texturePath); ConfiguredModel[] models = ConfiguredModel.builder() - .modelFile(cubeAll) - .rotationY(0) - .nextModel() - .modelFile(cubeAll) - .rotationY(180) - .nextModel() - .modelFile(cubeMirroredAll) - .rotationY(0) - .nextModel() - .modelFile(cubeMirroredAll) - .rotationY(180) - .build(); + .modelFile(cubeAll) + .rotationY(0) + .nextModel() + .modelFile(cubeAll) + .rotationY(180) + .nextModel() + .modelFile(cubeMirroredAll) + .rotationY(0) + .nextModel() + .modelFile(cubeMirroredAll) + .rotationY(180) + .build(); prov.simpleBlock(block, models); }; } @@ -148,7 +164,8 @@ public static void registerMaterialFluidModels() { if (fluid instanceof GTFluid gtFluid) { // read the base bucket model JSON JsonObject original; - try(BufferedReader reader = Minecraft.getInstance().getResourceManager().openAsReader(GTCEu.id("models/item/bucket/bucket.json"))) { + try (BufferedReader reader = Minecraft.getInstance().getResourceManager() + .openAsReader(GTCEu.id("models/item/bucket/bucket.json"))) { original = GsonHelper.parse(reader, true); } catch (IOException e) { throw new RuntimeException(e); diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTOres.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTOres.java index b1255d2fb9..fb97fd7cfc 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTOres.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTOres.java @@ -9,7 +9,7 @@ import com.gregtechceu.gtceu.api.data.worldgen.generator.VeinGenerators; import com.gregtechceu.gtceu.api.data.worldgen.generator.indicators.SurfaceIndicatorGenerator; import com.gregtechceu.gtceu.api.registry.GTRegistries; -import lombok.Getter; + import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.BiomeTags; @@ -23,6 +23,8 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.RuleTest; import net.minecraft.world.level.levelgen.structure.templatesystem.TagMatchTest; +import lombok.Getter; + import java.util.HashMap; import java.util.Map; import java.util.Set; @@ -42,6 +44,7 @@ */ @SuppressWarnings("unused") public class GTOres { + /** * The size of the largest registered vein. * This becomes available after all veins have been loaded. @@ -61,9 +64,9 @@ public class GTOres { } ////////////////////////////////////// - //******** End Vein *********// + // ******** End Vein *********// ////////////////////////////////////// - public static RuleTest[] END_RULES = new RuleTest[]{WorldGeneratorUtils.END_ORE_REPLACEABLES}; + public static RuleTest[] END_RULES = new RuleTest[] { WorldGeneratorUtils.END_ORE_REPLACEABLES }; public static final GTOreDefinition BAUXITE_VEIN_END = create("bauxite_vein_end", vein -> vein .clusterSize(UniformInt.of(32, 40)).density(0.3f).weight(40) @@ -76,13 +79,10 @@ public class GTOres { .layer(l -> l.weight(2).mat(Bauxite).size(1, 4)) .layer(l -> l.weight(1).mat(Ilmenite).size(1, 2)) .layer(l -> l.weight(1).mat(Aluminium).size(1, 1)) - .build()) - ) + .build())) .surfaceIndicatorGenerator(indicator -> indicator .surfaceRock(Bauxite) - .placement(SurfaceIndicatorGenerator.IndicatorPlacement.ABOVE) - ) - ); + .placement(SurfaceIndicatorGenerator.IndicatorPlacement.ABOVE))); public static final GTOreDefinition MAGNETITE_VEIN_END = create("magnetite_vein_end", vein -> vein .clusterSize(UniformInt.of(38, 44)).density(0.15f).weight(30) @@ -95,13 +95,10 @@ public class GTOres { .layer(l -> l.weight(2).mat(VanadiumMagnetite).size(1, 2)) .layer(l -> l.weight(2).mat(Chromite).size(1, 1)) .layer(l -> l.weight(1).mat(Gold).size(1, 1)) - .build()) - ) + .build())) .surfaceIndicatorGenerator(indicator -> indicator .surfaceRock(Magnetite) - .placement(SurfaceIndicatorGenerator.IndicatorPlacement.ABOVE) - ) - ); + .placement(SurfaceIndicatorGenerator.IndicatorPlacement.ABOVE))); public static final GTOreDefinition NAQUADAH_VEIN = create("naquadah_vein", vein -> vein .clusterSize(UniformInt.of(40, 52)).density(1.0f).weight(30) @@ -112,18 +109,15 @@ public class GTOres { .oreBlock(new VeinBlockDefinition(Naquadah, 3)) .rareBlock(new VeinBlockDefinition(Plutonium239, 1)) .rareBlockChance(0.25f) - .veininessThreshold(0.1f) + .veininessThreshold(0.01f) .maxRichnessThreshold(0.175f) - .minRichness(0.4f) - .maxRichness(0.7f) + .minRichness(0.7f) + .maxRichness(1.0f) .edgeRoundoffBegin(3) - .maxEdgeRoundoff(0.1f) - ) + .maxEdgeRoundoff(0.1f)) .surfaceIndicatorGenerator(indicator -> indicator .surfaceRock(Naquadah) - .placement(SurfaceIndicatorGenerator.IndicatorPlacement.ABOVE) - ) - ); + .placement(SurfaceIndicatorGenerator.IndicatorPlacement.ABOVE))); public static final GTOreDefinition PITCHBLENDE_VEIN = create("pitchblende_vein_end", vein -> vein .clusterSize(UniformInt.of(32, 40)).density(1.0f).weight(30) @@ -134,34 +128,28 @@ public class GTOres { .oreBlock(new VeinBlockDefinition(Pitchblende, 3)) .rareBlock(new VeinBlockDefinition(Uraninite, 2)) .rareBlockChance(0.33f) - .veininessThreshold(0.1f) + .veininessThreshold(0.01f) .maxRichnessThreshold(0.175f) - .minRichness(0.4f) - .maxRichness(0.7f) + .minRichness(0.7f) + .maxRichness(1.0f) .edgeRoundoffBegin(3) - .maxEdgeRoundoff(0.1f) - ) + .maxEdgeRoundoff(0.1f)) .surfaceIndicatorGenerator(indicator -> indicator .surfaceRock(Pitchblende) - .placement(SurfaceIndicatorGenerator.IndicatorPlacement.ABOVE) - ) - ); + .placement(SurfaceIndicatorGenerator.IndicatorPlacement.ABOVE))); public static final GTOreDefinition SCHEELITE_VEIN = create("scheelite_vein", vein -> vein - .clusterSize(UniformInt.of(32, 40)).density(0.2f).weight(20) + .clusterSize(UniformInt.of(32, 40)).density(0.7f).weight(20) .layer(WorldGenLayers.ENDSTONE) .heightRangeUniform(20, 60) .biomes(BiomeTags.IS_END) .dikeVeinGenerator(generator -> generator .withBlock(new DikeBlockDefinition(Scheelite, 3, 20, 60)) .withBlock(new DikeBlockDefinition(Tungstate, 2, 35, 55)) - .withBlock(new DikeBlockDefinition(Lithium, 1, 20, 40)) - ) + .withBlock(new DikeBlockDefinition(Lithium, 1, 20, 40))) .surfaceIndicatorGenerator(indicator -> indicator .surfaceRock(Scheelite) - .placement(SurfaceIndicatorGenerator.IndicatorPlacement.ABOVE) - ) - ); + .placement(SurfaceIndicatorGenerator.IndicatorPlacement.ABOVE))); public static final GTOreDefinition SHELDONITE_VEIN = create("sheldonite_vein", vein -> vein .clusterSize(UniformInt.of(25, 29)).density(0.2f).weight(10) @@ -174,18 +162,15 @@ public class GTOres { .layer(l -> l.weight(2).mat(Cooperite).size(1, 1)) .layer(l -> l.weight(2).mat(Platinum).size(1, 1)) .layer(l -> l.weight(1).mat(Palladium).size(1, 1)) - .build()) - ) + .build())) .surfaceIndicatorGenerator(indicator -> indicator .surfaceRock(Platinum) - .placement(SurfaceIndicatorGenerator.IndicatorPlacement.ABOVE) - ) - ); + .placement(SurfaceIndicatorGenerator.IndicatorPlacement.ABOVE))); ////////////////////////////////////// - //****** Nether Vein *******// + // ****** Nether Vein *******// ////////////////////////////////////// - public static RuleTest[] NETHER_RULES = new RuleTest[]{new TagMatchTest(BlockTags.NETHER_CARVER_REPLACEABLES)}; + public static RuleTest[] NETHER_RULES = new RuleTest[] { new TagMatchTest(BlockTags.NETHER_CARVER_REPLACEABLES) }; public static final GTOreDefinition BANDED_IRON_VEIN = create("banded_iron_vein", vein -> vein .clusterSize(UniformInt.of(40, 52)).density(1.0f).weight(30) @@ -198,34 +183,28 @@ public class GTOres { .oreBlock(new VeinBlockDefinition(Hematite, 2)) .rareBlock(new VeinBlockDefinition(Gold, 1)) .rareBlockChance(0.075f) - .veininessThreshold(0.1f) + .veininessThreshold(0.01f) .maxRichnessThreshold(0.175f) - .minRichness(0.4f) - .maxRichness(0.7f) + .minRichness(0.7f) + .maxRichness(1.0f) .edgeRoundoffBegin(3) - .maxEdgeRoundoff(0.1f) - ) + .maxEdgeRoundoff(0.1f)) .surfaceIndicatorGenerator(indicator -> indicator .surfaceRock(Goethite) - .placement(SurfaceIndicatorGenerator.IndicatorPlacement.ABOVE) - ) - ); + .placement(SurfaceIndicatorGenerator.IndicatorPlacement.ABOVE))); public static final GTOreDefinition BERYLLIUM_VEIN = create("beryllium_vein", vein -> vein - .clusterSize(UniformInt.of(32, 40)).density(0.25f).weight(30) + .clusterSize(UniformInt.of(32, 40)).density(0.75f).weight(30) .layer(WorldGenLayers.NETHERRACK) .heightRangeUniform(5, 30) .biomes(BiomeTags.IS_NETHER) .dikeVeinGenerator(generator -> generator .withBlock(new DikeBlockDefinition(Beryllium, 3, 5, 30)) .withBlock(new DikeBlockDefinition(Emerald, 2, 5, 19)) - .withBlock(new DikeBlockDefinition(Emerald, 2, 16, 30)) - ) + .withBlock(new DikeBlockDefinition(Emerald, 2, 16, 30))) .surfaceIndicatorGenerator(indicator -> indicator .surfaceRock(Beryllium) - .placement(SurfaceIndicatorGenerator.IndicatorPlacement.ABOVE) - ) - ); + .placement(SurfaceIndicatorGenerator.IndicatorPlacement.ABOVE))); public static final GTOreDefinition CERTUS_QUARTZ_VEIN = create("certus_quartz", vein -> vein .clusterSize(UniformInt.of(25, 29)).density(0.25f).weight(40) @@ -237,29 +216,23 @@ public class GTOres { .layer(l -> l.weight(3).mat(Quartzite).size(2, 4)) .layer(l -> l.weight(2).mat(CertusQuartz).size(1, 1)) .layer(l -> l.weight(1).mat(Barite).size(1, 1)) - .build()) - ) + .build())) .surfaceIndicatorGenerator(indicator -> indicator .surfaceRock(CertusQuartz) - .placement(SurfaceIndicatorGenerator.IndicatorPlacement.BELOW) - ) - ); + .placement(SurfaceIndicatorGenerator.IndicatorPlacement.BELOW))); public static final GTOreDefinition MANGANESE_VEIN = create("manganese_vein", vein -> vein - .clusterSize(UniformInt.of(32, 40)).density(0.25f).weight(20) + .clusterSize(UniformInt.of(32, 40)).density(0.75f).weight(20) .layer(WorldGenLayers.NETHERRACK) .heightRangeUniform(20, 30) .biomes(BiomeTags.IS_NETHER) .dikeVeinGenerator(generator -> generator .withBlock(new DikeBlockDefinition(Grossular, 3, 20, 30)) .withBlock(new DikeBlockDefinition(Pyrolusite, 2, 20, 26)) - .withBlock(new DikeBlockDefinition(Tantalite, 1, 24, 30)) - ) + .withBlock(new DikeBlockDefinition(Tantalite, 1, 24, 30))) .surfaceIndicatorGenerator(indicator -> indicator .surfaceRock(Grossular) - .placement(SurfaceIndicatorGenerator.IndicatorPlacement.ABOVE) - ) - ); + .placement(SurfaceIndicatorGenerator.IndicatorPlacement.ABOVE))); public static final GTOreDefinition MOLYBDENUM_VEIN = create("molybdenum_vein", vein -> vein .clusterSize(UniformInt.of(25, 29)).density(0.25f).weight(5) @@ -273,13 +246,10 @@ public class GTOres { .layer(l -> l.weight(2).mat(Molybdenite).size(1, 1)) .layer(l -> l.weight(1).mat(Molybdenum).size(1, 1)) .layer(l -> l.weight(1).mat(Powellite).size(1, 1)) - .build()) - ) + .build())) .surfaceIndicatorGenerator(indicator -> indicator .surfaceRock(Molybdenum) - .placement(SurfaceIndicatorGenerator.IndicatorPlacement.ABOVE) - ) - ); + .placement(SurfaceIndicatorGenerator.IndicatorPlacement.ABOVE))); public static final GTOreDefinition MONAZITE_VEIN = create("monazite_vein", vein -> vein .clusterSize(UniformInt.of(25, 29)).density(0.25f).weight(30) @@ -292,13 +262,10 @@ public class GTOres { .layer(l -> l.weight(3).mat(Bastnasite).size(2, 4)) .layer(l -> l.weight(1).mat(Molybdenum).size(1, 1)) .layer(l -> l.weight(1).mat(Neodymium).size(1, 1)) - .build()) - ) + .build())) .surfaceIndicatorGenerator(indicator -> indicator .surfaceRock(Bastnasite) - .placement(SurfaceIndicatorGenerator.IndicatorPlacement.ABOVE) - ) - ); + .placement(SurfaceIndicatorGenerator.IndicatorPlacement.ABOVE))); public static final GTOreDefinition NETHER_QUARTZ_VEIN = create("nether_quartz_vein", vein -> vein .clusterSize(UniformInt.of(32, 40)).density(0.2f).weight(80) @@ -307,16 +274,13 @@ public class GTOres { .biomes(BiomeTags.IS_NETHER) .layeredVeinGenerator(generator -> generator .withLayerPattern(() -> GTLayerPattern.builder(NETHER_RULES) - .layer(l -> l.weight(2).state(Blocks.NETHERRACK::defaultBlockState).size(2, 4)) + // .layer(l -> l.weight(2).state(Blocks.NETHERRACK::defaultBlockState).size(2, 4)) .layer(l -> l.weight(3).mat(NetherQuartz).size(2, 4)) .layer(l -> l.weight(1).mat(Quartzite).size(1, 1)) - .build()) - ) + .build())) .surfaceIndicatorGenerator(indicator -> indicator .surfaceRock(NetherQuartz) - .placement(SurfaceIndicatorGenerator.IndicatorPlacement.ABOVE) - ) - ); + .placement(SurfaceIndicatorGenerator.IndicatorPlacement.ABOVE))); public static final GTOreDefinition REDSTONE_VEIN = create("redstone_vein", vein -> vein .clusterSize(UniformInt.of(32, 40)).density(0.2f).weight(60) @@ -329,13 +293,10 @@ public class GTOres { .layer(l -> l.weight(3).mat(Redstone).size(2, 4)) .layer(l -> l.weight(2).mat(Ruby).size(1, 1)) .layer(l -> l.weight(1).mat(Cinnabar).size(1, 1)) - .build()) - ) + .build())) .surfaceIndicatorGenerator(indicator -> indicator .surfaceRock(Redstone) - .placement(SurfaceIndicatorGenerator.IndicatorPlacement.ABOVE) - ) - ); + .placement(SurfaceIndicatorGenerator.IndicatorPlacement.ABOVE))); public static final GTOreDefinition SALTPETER_VEIN = create("saltpeter_vein", vein -> vein .clusterSize(UniformInt.of(32, 40)).density(0.25f).weight(40) @@ -349,13 +310,10 @@ public class GTOres { .layer(l -> l.weight(2).mat(Diatomite).size(1, 1)) .layer(l -> l.weight(2).mat(Electrotine).size(1, 1)) .layer(l -> l.weight(1).mat(Alunite).size(1, 1)) - .build()) - ) + .build())) .surfaceIndicatorGenerator(indicator -> indicator .surfaceRock(Saltpeter) - .placement(SurfaceIndicatorGenerator.IndicatorPlacement.ABOVE) - ) - ); + .placement(SurfaceIndicatorGenerator.IndicatorPlacement.ABOVE))); public static final GTOreDefinition SULFUR_VEIN = create("sulfur_vein", vein -> vein .clusterSize(UniformInt.of(32, 40)).density(0.2f).weight(100) @@ -368,13 +326,10 @@ public class GTOres { .layer(l -> l.weight(3).mat(Sulfur).size(2, 4)) .layer(l -> l.weight(2).mat(Pyrite).size(1, 1)) .layer(l -> l.weight(1).mat(Sphalerite).size(1, 1)) - .build()) - ) + .build())) .surfaceIndicatorGenerator(indicator -> indicator .surfaceRock(Sulfur) - .placement(SurfaceIndicatorGenerator.IndicatorPlacement.ABOVE) - ) - ); + .placement(SurfaceIndicatorGenerator.IndicatorPlacement.ABOVE))); public static final GTOreDefinition TETRAHEDRITE_VEIN = create("tetrahedrite_vein", vein -> vein .clusterSize(UniformInt.of(40, 52)).density(1.0f).weight(70) @@ -386,18 +341,15 @@ public class GTOres { .oreBlock(new VeinBlockDefinition(Copper, 2)) .rareBlock(new VeinBlockDefinition(Stibnite, 1)) .rareBlockChance(0.15f) - .veininessThreshold(0.1f) + .veininessThreshold(0.01f) .maxRichnessThreshold(0.175f) - .minRichness(0.4f) - .maxRichness(0.7f) + .minRichness(0.7f) + .maxRichness(1.0f) .edgeRoundoffBegin(3) - .maxEdgeRoundoff(0.1f) - ) + .maxEdgeRoundoff(0.1f)) .surfaceIndicatorGenerator(indicator -> indicator .surfaceRock(Tetrahedrite) - .placement(SurfaceIndicatorGenerator.IndicatorPlacement.BELOW) - ) - ); + .placement(SurfaceIndicatorGenerator.IndicatorPlacement.BELOW))); public static final GTOreDefinition TOPAZ_VEIN = create("topaz_vein", vein -> vein .clusterSize(UniformInt.of(25, 29)).density(0.25f).weight(70) @@ -411,22 +363,19 @@ public class GTOres { .layer(l -> l.weight(2).mat(Topaz).size(1, 1)) .layer(l -> l.weight(2).mat(Chalcocite).size(1, 1)) .layer(l -> l.weight(1).mat(Bornite).size(1, 1)) - .build()) - ) + .build())) .surfaceIndicatorGenerator(indicator -> indicator .surfaceRock(Topaz) - .placement(SurfaceIndicatorGenerator.IndicatorPlacement.BELOW) - ) - ); + .placement(SurfaceIndicatorGenerator.IndicatorPlacement.BELOW))); ////////////////////////////////////// - //***** Overworld Vein *****// + // ***** Overworld Vein *****// ////////////////////////////////////// ////////////////////////////////////// - //***** Stone *****// + // ***** Stone *****// ////////////////////////////////////// - public static RuleTest[] OVERWORLD_RULES = new RuleTest[]{new TagMatchTest(BlockTags.STONE_ORE_REPLACEABLES)}; + public static RuleTest[] OVERWORLD_RULES = new RuleTest[] { new TagMatchTest(BlockTags.STONE_ORE_REPLACEABLES) }; public static final GTOreDefinition APATITE_VEIN = create("apatite_vein", vein -> vein .clusterSize(UniformInt.of(32, 40)).density(0.25f).weight(40) @@ -439,13 +388,10 @@ public class GTOres { .layer(l -> l.weight(3).mat(Apatite).size(2, 4)) .layer(l -> l.weight(2).mat(TricalciumPhosphate).size(1, 1)) .layer(l -> l.weight(1).mat(Pyrochlore).size(1, 1)) - .build()) - ) + .build())) .surfaceIndicatorGenerator(indicator -> indicator .surfaceRock(Apatite) - .placement(SurfaceIndicatorGenerator.IndicatorPlacement.ABOVE) - ) - ); + .placement(SurfaceIndicatorGenerator.IndicatorPlacement.ABOVE))); public static final GTOreDefinition CASSITERITE_VEIN = create("cassiterite_vein", vein -> vein .clusterSize(UniformInt.of(40, 52)).density(1.0f).weight(80) @@ -456,17 +402,14 @@ public class GTOres { .oreBlock(new VeinBlockDefinition(Tin, 4)) .rareBlock(new VeinBlockDefinition(Cassiterite, 2)) .rareBlockChance(0.33f) - .veininessThreshold(0.1f) + .veininessThreshold(0.01f) .maxRichnessThreshold(0.175f) - .minRichness(0.4f) - .maxRichness(0.7f) + .minRichness(0.7f) + .maxRichness(1.0f) .edgeRoundoffBegin(3) - .maxEdgeRoundoff(0.1f) - ) + .maxEdgeRoundoff(0.1f)) .surfaceIndicatorGenerator(indicator -> indicator - .surfaceRock(Cassiterite) - ) - ); + .surfaceRock(Cassiterite))); public static final GTOreDefinition COAL_VEIN = create("coal_vein", vein -> vein .clusterSize(UniformInt.of(38, 44)).density(0.25f).weight(80) @@ -477,12 +420,9 @@ public class GTOres { .withLayerPattern(() -> GTLayerPattern.builder(OVERWORLD_RULES) .layer(l -> l.weight(3).mat(Coal).size(2, 4)) .layer(l -> l.weight(3).mat(Coal).size(2, 4)) - .build()) - ) + .build())) .surfaceIndicatorGenerator(indicator -> indicator - .surfaceRock(Coal) - ) - ); + .surfaceRock(Coal))); public static final GTOreDefinition COPPER_TIN_VEIN = create("copper_tin_vein", vein -> vein .clusterSize(UniformInt.of(40, 52)).density(1.0f).weight(50) @@ -495,17 +435,14 @@ public class GTOres { .oreBlock(new VeinBlockDefinition(Cassiterite, 2)) .rareBlock(new VeinBlockDefinition(Realgar, 1)) .rareBlockChance(0.05f) - .veininessThreshold(0.1f) + .veininessThreshold(0.01f) .maxRichnessThreshold(0.175f) - .minRichness(0.4f) - .maxRichness(0.7f) + .minRichness(0.7f) + .maxRichness(1.0f) .edgeRoundoffBegin(3) - .maxEdgeRoundoff(0.1f) - ) + .maxEdgeRoundoff(0.1f)) .surfaceIndicatorGenerator(indicator -> indicator - .surfaceRock(Chalcopyrite) - ) - ); + .surfaceRock(Chalcopyrite))); public static final GTOreDefinition GALENA_VEIN = create("galena_vein", vein -> vein .clusterSize(UniformInt.of(32, 40)).density(0.25f).weight(40) @@ -518,15 +455,12 @@ public class GTOres { .layer(l -> l.weight(3).mat(Galena).size(2, 4)) .layer(l -> l.weight(2).mat(Silver).size(1, 1)) .layer(l -> l.weight(1).mat(Lead).size(1, 1)) - .build()) - ) + .build())) .surfaceIndicatorGenerator(indicator -> indicator - .surfaceRock(Galena) - ) - ); + .surfaceRock(Galena))); public static final GTOreDefinition GARNET_TIN_VEIN = create("garnet_tin_vein", vein -> vein - .clusterSize(UniformInt.of(32, 40)).density(0.2f).weight(80) + .clusterSize(UniformInt.of(32, 40)).density(0.4f).weight(80) .layer(WorldGenLayers.STONE) .heightRangeUniform(30, 60) .biomes(BiomeTags.IS_OVERWORLD) @@ -537,15 +471,12 @@ public class GTOres { .layer(l -> l.weight(2).mat(GarnetSand).size(1, 1)) .layer(l -> l.weight(2).mat(Asbestos).size(1, 1)) .layer(l -> l.weight(1).mat(Diatomite).size(1, 1)) - .build()) - ) + .build())) .surfaceIndicatorGenerator(indicator -> indicator - .surfaceRock(GarnetSand) - ) - ); + .surfaceRock(GarnetSand))); public static final GTOreDefinition GARNET_VEIN = create("garnet_vein", vein -> vein - .clusterSize(UniformInt.of(32, 40)).density(0.25f).weight(40) + .clusterSize(UniformInt.of(32, 40)).density(0.75f).weight(40) .layer(WorldGenLayers.STONE) .heightRangeUniform(-10, 50) .biomes(BiomeTags.IS_OVERWORLD) @@ -553,13 +484,10 @@ public class GTOres { .withBlock(new DikeBlockDefinition(GarnetRed, 3, -10, 50)) .withBlock(new DikeBlockDefinition(GarnetYellow, 2, -10, 50)) .withBlock(new DikeBlockDefinition(Amethyst, 2, -10, 22)) - .withBlock(new DikeBlockDefinition(Opal, 1, 18, 50)) - ) + .withBlock(new DikeBlockDefinition(Opal, 1, 18, 50))) .surfaceIndicatorGenerator(indicator -> indicator .surfaceRock(GarnetRed) - .placement(SurfaceIndicatorGenerator.IndicatorPlacement.ABOVE) - ) - ); + .placement(SurfaceIndicatorGenerator.IndicatorPlacement.ABOVE))); public static final GTOreDefinition IRON_VEIN = create("iron_vein", vein -> vein .clusterSize(UniformInt.of(40, 52)).density(1.0f).weight(120) @@ -571,17 +499,14 @@ public class GTOres { .oreBlock(new VeinBlockDefinition(YellowLimonite, 2)) .oreBlock(new VeinBlockDefinition(Hematite, 2)) .oreBlock(new VeinBlockDefinition(Malachite, 1)) - .veininessThreshold(0.1f) + .veininessThreshold(0.01f) .maxRichnessThreshold(0.175f) - .minRichness(0.4f) - .maxRichness(0.7f) + .minRichness(0.7f) + .maxRichness(1.0f) .edgeRoundoffBegin(3) - .maxEdgeRoundoff(0.1f) - ) + .maxEdgeRoundoff(0.1f)) .surfaceIndicatorGenerator(indicator -> indicator - .surfaceRock(Goethite) - ) - ); + .surfaceRock(Goethite))); public static final GTOreDefinition LUBRICANT_VEIN = create("lubricant_vein", vein -> vein .clusterSize(UniformInt.of(25, 29)).density(0.25f).weight(40) @@ -594,12 +519,9 @@ public class GTOres { .layer(l -> l.weight(2).mat(Talc).size(1, 1)) .layer(l -> l.weight(2).mat(GlauconiteSand).size(1, 1)) .layer(l -> l.weight(1).mat(Pentlandite).size(1, 1)) - .build()) - ) + .build())) .surfaceIndicatorGenerator(indicator -> indicator - .surfaceRock(Talc) - ) - ); + .surfaceRock(Talc))); public static final GTOreDefinition MAGNETITE_VEIN_OW = create("magnetite_vein_ow", vein -> vein .clusterSize(UniformInt.of(38, 44)).density(0.15f).weight(80) @@ -611,12 +533,9 @@ public class GTOres { .layer(l -> l.weight(3).mat(Magnetite).size(2, 4)) .layer(l -> l.weight(2).mat(VanadiumMagnetite).size(1, 1)) .layer(l -> l.weight(1).mat(Gold).size(1, 1)) - .build()) - ) + .build())) .surfaceIndicatorGenerator(indicator -> indicator - .surfaceRock(Magnetite) - ) - ); + .surfaceRock(Magnetite))); public static final GTOreDefinition MINERAL_SAND_VEIN = create("mineral_sand_vein", vein -> vein .clusterSize(UniformInt.of(32, 40)).density(0.2f).weight(80) @@ -630,12 +549,9 @@ public class GTOres { .layer(l -> l.weight(2).mat(GraniticMineralSand).size(1, 1)) .layer(l -> l.weight(2).mat(FullersEarth).size(1, 1)) .layer(l -> l.weight(1).mat(Gypsum).size(1, 1)) - .build()) - ) + .build())) .surfaceIndicatorGenerator(indicator -> indicator - .surfaceRock(BasalticMineralSand) - ) - ); + .surfaceRock(BasalticMineralSand))); public static final GTOreDefinition NICKEL_VEIN = create("nickel_vein", vein -> vein .clusterSize(UniformInt.of(32, 40)).density(0.25f).weight(40) @@ -649,12 +565,9 @@ public class GTOres { .layer(l -> l.weight(2).mat(Nickel).size(1, 1)) .layer(l -> l.weight(2).mat(Cobaltite).size(1, 1)) .layer(l -> l.weight(1).mat(Pentlandite).size(1, 1)) - .build()) - ) + .build())) .surfaceIndicatorGenerator(indicator -> indicator - .surfaceRock(Nickel) - ) - ); + .surfaceRock(Nickel))); public static final GTOreDefinition SALTS_VEIN = create("salts_vein", vein -> vein .clusterSize(UniformInt.of(32, 40)).density(0.2f).weight(50) @@ -668,13 +581,9 @@ public class GTOres { .layer(l -> l.weight(2).mat(Salt).size(1, 1)) .layer(l -> l.weight(1).mat(Lepidolite).size(1, 1)) .layer(l -> l.weight(1).mat(Spodumene).size(1, 1)) - .build()) - ) + .build())) .surfaceIndicatorGenerator(indicator -> indicator - .surfaceRock(Salt) - ) - ); - + .surfaceRock(Salt))); public static final GTOreDefinition OILSANDS_VEIN = create("oilsands_vein", vein -> vein .clusterSize(UniformInt.of(25, 29)).density(0.3f).weight(40) @@ -687,17 +596,15 @@ public class GTOres { .layer(l -> l.weight(2).mat(Oilsands).size(1, 1)) .layer(l -> l.weight(1).mat(Oilsands).size(1, 1)) .layer(l -> l.weight(1).mat(Oilsands).size(1, 1)) - .build()) - ) + .build())) .surfaceIndicatorGenerator(indicator -> indicator - .surfaceRock(Oilsands) - ) - ); + .surfaceRock(Oilsands))); ////////////////////////////////////// - //***** Deepslate *****// + // ***** Deepslate *****// ////////////////////////////////////// - public static RuleTest[] DEEPSLATE_RULES = new RuleTest[]{new TagMatchTest(BlockTags.DEEPSLATE_ORE_REPLACEABLES)}; + public static RuleTest[] DEEPSLATE_RULES = new RuleTest[] { + new TagMatchTest(BlockTags.DEEPSLATE_ORE_REPLACEABLES) }; public static final GTOreDefinition COPPER_VEIN = create("copper_vein", vein -> vein .clusterSize(UniformInt.of(40, 52)).density(1.0f).weight(80) @@ -709,17 +616,14 @@ public class GTOres { .oreBlock(new VeinBlockDefinition(Iron, 2)) .oreBlock(new VeinBlockDefinition(Pyrite, 2)) .oreBlock(new VeinBlockDefinition(Copper, 2)) - .veininessThreshold(0.1f) + .veininessThreshold(0.01f) .maxRichnessThreshold(0.175f) - .minRichness(0.4f) - .maxRichness(0.7f) + .minRichness(0.7f) + .maxRichness(1.0f) .edgeRoundoffBegin(3) - .maxEdgeRoundoff(0.1f) - ) + .maxEdgeRoundoff(0.1f)) .surfaceIndicatorGenerator(indicator -> indicator - .surfaceRock(Copper) - ) - ); + .surfaceRock(Copper))); public static final GTOreDefinition DIAMOND_VEIN = create("diamond_vein", vein -> vein .clusterSize(UniformInt.of(32, 40)).density(0.25f).weight(40) @@ -731,18 +635,15 @@ public class GTOres { .layer(l -> l.weight(3).mat(Graphite).size(2, 4)) .layer(l -> l.weight(2).mat(Diamond).size(1, 1)) .layer(l -> l.weight(1).mat(Coal).size(1, 1)) - .build()) - ) + .build())) .surfaceIndicatorGenerator(indicator -> indicator .surfaceRock(Diamond) .density(0.1f) .placement(SurfaceIndicatorGenerator.IndicatorPlacement.ABOVE) - .radius(2) - ) - ); + .radius(2))); public static final GTOreDefinition LAPIS_VEIN = create("lapis_vein", vein -> vein - .clusterSize(UniformInt.of(40, 52)).density(0.25f).weight(40) + .clusterSize(UniformInt.of(40, 52)).density(0.75f).weight(40) .layer(WorldGenLayers.DEEPSLATE) .heightRangeUniform(-60, 10) .biomes(BiomeTags.IS_OVERWORLD) @@ -750,18 +651,15 @@ public class GTOres { .withBlock(new DikeBlockDefinition(Lazurite, 3, -60, 10)) .withBlock(new DikeBlockDefinition(Sodalite, 2, -50, 0)) .withBlock(new DikeBlockDefinition(Lapis, 2, -50, 0)) - .withBlock(new DikeBlockDefinition(Calcite, 1, -40, 10)) - ) + .withBlock(new DikeBlockDefinition(Calcite, 1, -40, 10))) .surfaceIndicatorGenerator(indicator -> indicator .surfaceRock(Lapis) .density(0.15f) .placement(SurfaceIndicatorGenerator.IndicatorPlacement.ABOVE) - .radius(3) - ) - ); + .radius(3))); public static final GTOreDefinition MANGANESE_VEIN_OW = create("manganese_vein_ow", vein -> vein - .clusterSize(UniformInt.of(50, 64)).density(0.25f).weight(20) + .clusterSize(UniformInt.of(50, 64)).density(0.75f).weight(20) .layer(WorldGenLayers.DEEPSLATE) .heightRangeUniform(-30, 0) .biomes(BiomeTags.IS_OVERWORLD) @@ -770,13 +668,10 @@ public class GTOres { .withBlock(new DikeBlockDefinition(Spessartine, 2, -40, -15)) .withBlock(new DikeBlockDefinition(Pyrolusite, 2, -40, -15)) .withBlock(new DikeBlockDefinition(Tantalite, 1, -30, -5)) - .minYLevel(-50).maxYLevel(-5) - ) + .minYLevel(-50).maxYLevel(-5)) .surfaceIndicatorGenerator(indicator -> indicator .surfaceRock(Grossular) - .radius(3) - ) - ); + .radius(3))); public static final GTOreDefinition MICA_VEIN = create("mica_vein", vein -> vein .clusterSize(UniformInt.of(32, 40)).density(0.25f).weight(20) @@ -790,13 +685,10 @@ public class GTOres { .layer(l -> l.weight(2).mat(Mica).size(1, 1)) .layer(l -> l.weight(2).mat(Bauxite).size(1, 1)) .layer(l -> l.weight(1).mat(Pollucite).size(1, 1)) - .build()) - ) + .build())) .surfaceIndicatorGenerator(indicator -> indicator .surfaceRock(Mica) - .radius(3) - ) - ); + .radius(3))); public static final GTOreDefinition OLIVINE_VEIN = create("olivine_vein", vein -> vein .clusterSize(UniformInt.of(32, 40)).density(0.25f).weight(20) @@ -810,14 +702,11 @@ public class GTOres { .layer(l -> l.weight(2).mat(Magnetite).size(1, 1)) .layer(l -> l.weight(2).mat(Olivine).size(1, 1)) .layer(l -> l.weight(1).mat(GlauconiteSand).size(1, 1)) - .build()) - ) + .build())) .surfaceIndicatorGenerator(indicator -> indicator .surfaceRock(Olivine) .density(0.15f) - .radius(3) - ) - ); + .radius(3))); public static final GTOreDefinition REDSTONE_VEIN_OW = create("redstone_vein_ow", vein -> vein .clusterSize(UniformInt.of(32, 40)).density(0.2f).weight(60) @@ -829,12 +718,9 @@ public class GTOres { .layer(l -> l.weight(3).mat(Redstone).size(2, 4)) .layer(l -> l.weight(2).mat(Ruby).size(1, 1)) .layer(l -> l.weight(1).mat(Cinnabar).size(1, 1)) - .build()) - ) + .build())) .surfaceIndicatorGenerator(indicator -> indicator - .surfaceRock(Redstone) - ) - ); + .surfaceRock(Redstone))); public static final GTOreDefinition SAPPHIRE_VEIN = create("sapphire_vein", vein -> vein .clusterSize(UniformInt.of(25, 29)).density(0.25f).weight(60) @@ -848,15 +734,12 @@ public class GTOres { .layer(l -> l.weight(2).mat(Pyrope).size(1, 1)) .layer(l -> l.weight(1).mat(Sapphire).size(1, 1)) .layer(l -> l.weight(1).mat(GreenSapphire).size(1, 1)) - .build()) - ) + .build())) .surfaceIndicatorGenerator(indicator -> indicator .surfaceRock(Sapphire) .density(0.15f) .placement(SurfaceIndicatorGenerator.IndicatorPlacement.ABOVE) - .radius(3) - ) - ); + .radius(3))); private static GTOreDefinition create(String name, Consumer config) { return create(GTCEu.id(name), config); @@ -883,7 +766,8 @@ private static Supplier ore(TagPrefix oreTag, Material material } else { oreKey = new ResourceLocation("%s_%s_ore".formatted(oreTag.name, material.getName())); } - return BuiltInRegistries.BLOCK.containsKey(oreKey) ? () -> BuiltInRegistries.BLOCK.get(oreKey) : () -> Blocks.AIR; + return BuiltInRegistries.BLOCK.containsKey(oreKey) ? () -> BuiltInRegistries.BLOCK.get(oreKey) : + () -> Blocks.AIR; } return block; } @@ -894,24 +778,24 @@ public static void init() { public static void updateLargestVeinSize() { GTOres.largestVeinSize = GTRegistries.ORE_VEINS.values().stream() - .map(GTOreDefinition::clusterSize) - .map(intProvider -> (intProvider.getMinValue() + intProvider.getMaxValue()) / 2) // map to average of min & max values. - .max(Integer::compareTo) - .orElse(0); + .map(GTOreDefinition::clusterSize) + .map(intProvider -> (intProvider.getMinValue() + intProvider.getMaxValue()) / 2) // map to average of + // min & max values. + .max(Integer::compareTo) + .orElse(0); GTOres.largestIndicatorOffset = GTRegistries.ORE_VEINS.values().stream() - .flatMap(definition -> definition.indicatorGenerators().stream().map(indicatorGenerator -> - indicatorGenerator.getSearchRadiusModifier((int) Math.ceil(definition.clusterSize().getMinValue() / 2.0)) - )) + .flatMap(definition -> definition.indicatorGenerators().stream() + .map(indicatorGenerator -> indicatorGenerator.getSearchRadiusModifier( + (int) Math.ceil(definition.clusterSize().getMinValue() / 2.0)))) .max(Integer::compareTo) .orElse(0); } public static GTOreDefinition blankOreDefinition() { return new GTOreDefinition( - ConstantInt.of(0), 0, 0, IWorldGenLayer.NOWHERE, Set.of(), - HeightRangePlacement.uniform(VerticalAnchor.absolute(0), VerticalAnchor.absolute(0)), - 0, null, null, null, null - ); + ConstantInt.of(0), 0, 0, IWorldGenLayer.NOWHERE, Set.of(), + HeightRangePlacement.uniform(VerticalAnchor.absolute(0), VerticalAnchor.absolute(0)), + 0, null, null, null, null); } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTPlacements.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTPlacements.java index 244901a31b..69cc76433a 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTPlacements.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTPlacements.java @@ -5,6 +5,7 @@ import com.gregtechceu.gtceu.api.data.worldgen.modifier.BiomePlacement; import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.data.recipe.CustomTags; + import net.minecraft.core.HolderGetter; import net.minecraft.core.registries.Registries; import net.minecraft.data.worldgen.BootstapContext; @@ -23,10 +24,15 @@ * @implNote GTPlacements */ public class GTPlacements { - public static final ResourceKey RUBBER_CHECKED = ResourceKey.create(Registries.PLACED_FEATURE, GTCEu.id("rubber_checked")); - public static final ResourceKey RED_GRANITE_BLOB = ResourceKey.create(Registries.PLACED_FEATURE, GTCEu.id("red_granite_blob")); - public static final ResourceKey MARBLE_BLOB = ResourceKey.create(Registries.PLACED_FEATURE, GTCEu.id("marble_blob")); - public static final ResourceKey RAW_OIL_SPROUT = ResourceKey.create(Registries.PLACED_FEATURE, GTCEu.id("raw_oil_sprout")); + + public static final ResourceKey RUBBER_CHECKED = ResourceKey.create(Registries.PLACED_FEATURE, + GTCEu.id("rubber_checked")); + public static final ResourceKey RED_GRANITE_BLOB = ResourceKey.create(Registries.PLACED_FEATURE, + GTCEu.id("red_granite_blob")); + public static final ResourceKey MARBLE_BLOB = ResourceKey.create(Registries.PLACED_FEATURE, + GTCEu.id("marble_blob")); + public static final ResourceKey RAW_OIL_SPROUT = ResourceKey.create(Registries.PLACED_FEATURE, + GTCEu.id("raw_oil_sprout")); public static void bootstrap(BootstapContext ctx) { HolderGetter> featureLookup = ctx.lookup(Registries.CONFIGURED_FEATURE); @@ -34,33 +40,28 @@ public static void bootstrap(BootstapContext ctx) { PlacementUtils.register(ctx, RUBBER_CHECKED, featureLookup.getOrThrow(GTConfiguredFeatures.RUBBER), new BiomePlacement(List.of( - new BiomeWeightModifier(() -> biomeLookup.getOrThrow(CustomTags.IS_SWAMP), 50) - )), + new BiomeWeightModifier(() -> biomeLookup.getOrThrow(CustomTags.IS_SWAMP), 50))), PlacementUtils.countExtra(0, ConfigHolder.INSTANCE.worldgen.rubberTreeSpawnChance, 1), InSquarePlacement.spread(), SurfaceWaterDepthFilter.forMaxDepth(0), PlacementUtils.HEIGHTMAP_TOP_SOLID, BiomeFilter.biome(), - PlacementUtils.filteredByBlockSurvival(GTBlocks.RUBBER_SAPLING.get()) - ); + PlacementUtils.filteredByBlockSurvival(GTBlocks.RUBBER_SAPLING.get())); PlacementUtils.register(ctx, RED_GRANITE_BLOB, featureLookup.getOrThrow(GTConfiguredFeatures.RED_GRANITE_BLOB), - RarityFilter.onAverageOnceEvery(10), - InSquarePlacement.spread(), - BiomeFilter.biome(), - HeightRangePlacement.uniform(VerticalAnchor.absolute(-8), VerticalAnchor.top()) - ); + RarityFilter.onAverageOnceEvery(10), + InSquarePlacement.spread(), + BiomeFilter.biome(), + HeightRangePlacement.uniform(VerticalAnchor.absolute(-8), VerticalAnchor.top())); PlacementUtils.register(ctx, MARBLE_BLOB, featureLookup.getOrThrow(GTConfiguredFeatures.MARBLE_BLOB), - RarityFilter.onAverageOnceEvery(10), - InSquarePlacement.spread(), - BiomeFilter.biome(), - HeightRangePlacement.uniform(VerticalAnchor.absolute(-8), VerticalAnchor.top()) - ); + RarityFilter.onAverageOnceEvery(10), + InSquarePlacement.spread(), + BiomeFilter.biome(), + HeightRangePlacement.uniform(VerticalAnchor.absolute(-8), VerticalAnchor.top())); PlacementUtils.register(ctx, RAW_OIL_SPROUT, featureLookup.getOrThrow(GTConfiguredFeatures.RAW_OIL_SPROUT), - RarityFilter.onAverageOnceEvery(64), - InSquarePlacement.spread(), - BiomeFilter.biome(), - HeightRangePlacement.uniform(VerticalAnchor.absolute(10), VerticalAnchor.absolute(40)) - ); + RarityFilter.onAverageOnceEvery(64), + InSquarePlacement.spread(), + BiomeFilter.biome(), + HeightRangePlacement.uniform(VerticalAnchor.absolute(10), VerticalAnchor.absolute(40))); } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTPlacerTypes.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTPlacerTypes.java index 8906315e53..c367185a95 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTPlacerTypes.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTPlacerTypes.java @@ -6,13 +6,15 @@ import com.gregtechceu.gtceu.common.worldgen.RubberTrunkPlacer; import com.gregtechceu.gtceu.core.mixins.IFoliagePlacerTypeAccessor; import com.gregtechceu.gtceu.core.mixins.ITrunkPlacerTypeAccessor; -import com.mojang.serialization.Codec; + import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.world.level.levelgen.feature.foliageplacers.FoliagePlacer; import net.minecraft.world.level.levelgen.feature.foliageplacers.FoliagePlacerType; import net.minecraft.world.level.levelgen.feature.trunkplacers.TrunkPlacer; import net.minecraft.world.level.levelgen.feature.trunkplacers.TrunkPlacerType; +import com.mojang.serialization.Codec; + /** * @author KilaBash * @date 2023/3/25 @@ -20,18 +22,20 @@ */ public class GTPlacerTypes { - public static final TrunkPlacerType RUBBER_TRUNK = registerTruckPlacer("rubber", RubberTrunkPlacer.CODEC); - public static final FoliagePlacerType RUBBER_FOLIAGE = registerFoliagePlacer("rubber", RubberFoliagePlacer.CODEC); + public static final TrunkPlacerType RUBBER_TRUNK = registerTruckPlacer("rubber", + RubberTrunkPlacer.CODEC); + public static final FoliagePlacerType RUBBER_FOLIAGE = registerFoliagePlacer("rubber", + RubberFoliagePlacer.CODEC); public static

TrunkPlacerType

registerTruckPlacer(String pKey, Codec

pCodec) { - return GTRegistries.register(BuiltInRegistries.TRUNK_PLACER_TYPE, GTCEu.id(pKey), ITrunkPlacerTypeAccessor.callCtor(pCodec)); + return GTRegistries.register(BuiltInRegistries.TRUNK_PLACER_TYPE, GTCEu.id(pKey), + ITrunkPlacerTypeAccessor.callCtor(pCodec)); } public static

FoliagePlacerType

registerFoliagePlacer(String pKey, Codec

pCodec) { - return GTRegistries.register(BuiltInRegistries.FOLIAGE_PLACER_TYPE, GTCEu.id(pKey), IFoliagePlacerTypeAccessor.callCtor(pCodec)); + return GTRegistries.register(BuiltInRegistries.FOLIAGE_PLACER_TYPE, GTCEu.id(pKey), + IFoliagePlacerTypeAccessor.callCtor(pCodec)); } - public static void init() { - - } + public static void init() {} } diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeCapabilities.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeCapabilities.java index 553ccc1be7..4e24361a11 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeCapabilities.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeCapabilities.java @@ -4,9 +4,9 @@ import com.gregtechceu.gtceu.api.addon.AddonFinder; import com.gregtechceu.gtceu.api.addon.IGTAddon; import com.gregtechceu.gtceu.api.capability.recipe.*; -import com.gregtechceu.gtceu.api.data.chemical.Element; import com.gregtechceu.gtceu.api.recipe.ingredient.FluidIngredient; import com.gregtechceu.gtceu.api.registry.GTRegistries; + import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.fml.ModLoader; @@ -36,7 +36,8 @@ public static void init() { GTRegistries.RECIPE_CAPABILITIES.register(SU.name, SU); AddonFinder.getAddons().forEach(IGTAddon::registerRecipeCapabilities); - ModLoader.get().postEvent(new GTCEuAPI.RegisterEvent<>(GTRegistries.RECIPE_CAPABILITIES, (Class>) (Class) RecipeCapability.class)); + ModLoader.get().postEvent(new GTCEuAPI.RegisterEvent<>(GTRegistries.RECIPE_CAPABILITIES, + (Class>) (Class) RecipeCapability.class)); GTRegistries.RECIPE_CAPABILITIES.freeze(); } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeConditions.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeConditions.java index cfcd6e5cf8..29d1daf2da 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeConditions.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeConditions.java @@ -4,10 +4,10 @@ import com.gregtechceu.gtceu.api.GTCEuAPI; import com.gregtechceu.gtceu.api.addon.AddonFinder; import com.gregtechceu.gtceu.api.addon.IGTAddon; -import com.gregtechceu.gtceu.api.machine.MachineDefinition; import com.gregtechceu.gtceu.api.recipe.RecipeCondition; import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.common.recipe.*; + import net.minecraftforge.fml.ModLoader; /** @@ -36,7 +36,8 @@ public static void init() { } AddonFinder.getAddons().forEach(IGTAddon::registerRecipeConditions); - ModLoader.get().postEvent(new GTCEuAPI.RegisterEvent<>(GTRegistries.RECIPE_CONDITIONS, (Class>) RecipeCondition.class.getClass())); + ModLoader.get().postEvent(new GTCEuAPI.RegisterEvent<>(GTRegistries.RECIPE_CONDITIONS, + (Class>) RecipeCondition.class.getClass())); GTRegistries.RECIPE_CONDITIONS.freeze(); } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeModifiers.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeModifiers.java index f4cd521edf..4f766ac179 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeModifiers.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeModifiers.java @@ -16,18 +16,20 @@ import com.gregtechceu.gtceu.api.recipe.content.ContentModifier; import com.gregtechceu.gtceu.api.recipe.modifier.ParallelLogic; import com.gregtechceu.gtceu.api.recipe.modifier.RecipeModifier; -import com.mojang.datafixers.util.Pair; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.Util; +import com.mojang.datafixers.util.Pair; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.List; import java.util.Optional; import java.util.function.Function; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author KilaBash * @date 2023/7/9 @@ -38,12 +40,15 @@ public class GTRecipeModifiers { /** * Use it if machines are {@link IOverclockMachine}. */ - public static final Function ELECTRIC_OVERCLOCK = Util.memoize(ElectricOverclockModifier::new); - public static final RecipeModifier PARALLEL_HATCH = (machine, recipe) -> GTRecipeModifiers.hatchParallel(machine, recipe, false).getFirst(); + public static final Function ELECTRIC_OVERCLOCK = Util + .memoize(ElectricOverclockModifier::new); + public static final RecipeModifier PARALLEL_HATCH = (machine, recipe) -> GTRecipeModifiers + .hatchParallel(machine, recipe, false).getFirst(); @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault public static class ElectricOverclockModifier implements RecipeModifier { + private final OverclockingLogic overclockingLogic; public ElectricOverclockModifier(OverclockingLogic overclockingLogic) { @@ -53,7 +58,8 @@ public ElectricOverclockModifier(OverclockingLogic overclockingLogic) { @Nullable @Override public GTRecipe apply(MetaMachine machine, @NotNull GTRecipe recipe) { - if (machine instanceof ITieredMachine tieredMachine && RecipeHelper.getRecipeEUtTier(recipe) > tieredMachine.getTier()) { + if (machine instanceof ITieredMachine tieredMachine && + RecipeHelper.getRecipeEUtTier(recipe) > tieredMachine.getTier()) { return null; } if (machine instanceof IOverclockMachine overclockMachine) { @@ -65,13 +71,15 @@ public GTRecipe apply(MetaMachine machine, @NotNull GTRecipe recipe) { /** * Fast parallel, the parallel amount is always the 2 times the divisor of maxParallel。 - * @param machine recipe holder - * @param recipe current recipe - * @param maxParallel max parallel limited + * + * @param machine recipe holder + * @param recipe current recipe + * @param maxParallel max parallel limited * @param modifyDuration should multiply the duration * @return modified recipe and parallel amount */ - public static Pair fastParallel(MetaMachine machine, @NotNull GTRecipe recipe, int maxParallel, boolean modifyDuration) { + public static Pair fastParallel(MetaMachine machine, @NotNull GTRecipe recipe, int maxParallel, + boolean modifyDuration) { if (machine instanceof IRecipeCapabilityHolder holder) { while (maxParallel > 0) { var copied = recipe.copy(ContentModifier.multiplier(maxParallel), modifyDuration); @@ -86,22 +94,26 @@ public static Pair fastParallel(MetaMachine machine, @NotNull /** * Accurate parallel, always look for the maximum parallel value within maxParallel. - * @param machine recipe holder - * @param recipe current recipe - * @param maxParallel max parallel limited + * + * @param machine recipe holder + * @param recipe current recipe + * @param maxParallel max parallel limited * @param modifyDuration should multiply the duration * @return modified recipe and parallel amount */ - public static Pair accurateParallel(MetaMachine machine, @NotNull GTRecipe recipe, int maxParallel, boolean modifyDuration) { + public static Pair accurateParallel(MetaMachine machine, @NotNull GTRecipe recipe, + int maxParallel, boolean modifyDuration) { if (maxParallel == 1) { return Pair.of(recipe, 1); } return ParallelLogic.applyParallel(machine, recipe, maxParallel, modifyDuration); } - public static Pair hatchParallel(MetaMachine machine, @NotNull GTRecipe recipe, boolean modifyDuration) { + public static Pair hatchParallel(MetaMachine machine, @NotNull GTRecipe recipe, + boolean modifyDuration) { if (machine instanceof IMultiController controller && controller.isFormed()) { - Optional optional = controller.getParts().stream().filter(IParallelHatch.class::isInstance).map(IParallelHatch.class::cast).findAny(); + Optional optional = controller.getParts().stream().filter(IParallelHatch.class::isInstance) + .map(IParallelHatch.class::cast).findAny(); if (optional.isPresent()) { IParallelHatch hatch = optional.get(); return ParallelLogic.applyParallel(machine, recipe, hatch.getCurrentParallel(), modifyDuration); @@ -115,35 +127,40 @@ public static GTRecipe crackerOverclock(MetaMachine machine, @NotNull GTRecipe r if (RecipeHelper.getRecipeEUtTier(recipe) > coilMachine.getTier()) { return null; } - return RecipeHelper.applyOverclock(new OverclockingLogic((recipe1, recipeEUt, maxVoltage, duration, amountOC) -> { - var pair = OverclockingLogic.NON_PERFECT_OVERCLOCK.getLogic().runOverclockingLogic(recipe, recipeEUt, maxVoltage, duration, amountOC); - if (coilMachine.getCoilTier() > 0) { - var eu = pair.firstLong() * (1 - coilMachine.getCoilTier() * 0.1); - pair.first((long) Math.max(1, eu)); - } - return pair; - }), recipe, coilMachine.getOverclockVoltage()); + return RecipeHelper + .applyOverclock(new OverclockingLogic((recipe1, recipeEUt, maxVoltage, duration, amountOC) -> { + var pair = OverclockingLogic.NON_PERFECT_OVERCLOCK.getLogic().runOverclockingLogic(recipe, + recipeEUt, maxVoltage, duration, amountOC); + if (coilMachine.getCoilTier() > 0) { + var eu = pair.firstLong() * (1 - coilMachine.getCoilTier() * 0.1); + pair.first((long) Math.max(1, eu)); + } + return pair; + }), recipe, coilMachine.getOverclockVoltage()); } return null; } public static GTRecipe ebfOverclock(MetaMachine machine, @NotNull GTRecipe recipe) { if (machine instanceof CoilWorkableElectricMultiblockMachine coilMachine) { - final var blastFurnaceTemperature = coilMachine.getCoilType().getCoilTemperature() + 100 * Math.max(0, coilMachine.getTier() - GTValues.MV); + final var blastFurnaceTemperature = coilMachine.getCoilType().getCoilTemperature() + + 100 * Math.max(0, coilMachine.getTier() - GTValues.MV); if (!recipe.data.contains("ebf_temp") || recipe.data.getInt("ebf_temp") > blastFurnaceTemperature) { return null; } if (RecipeHelper.getRecipeEUtTier(recipe) > coilMachine.getTier()) { return null; } - return RecipeHelper.applyOverclock(new OverclockingLogic((recipe1, recipeEUt, maxVoltage, duration, amountOC) -> OverclockingLogic.heatingCoilOverclockingLogic( - Math.abs(recipeEUt), - maxVoltage, - duration, - amountOC, - blastFurnaceTemperature, - recipe.data.contains("ebf_temp") ? recipe.data.getInt("ebf_temp") : 0 - )), recipe, coilMachine.getOverclockVoltage()); + return RecipeHelper.applyOverclock( + new OverclockingLogic((recipe1, recipeEUt, maxVoltage, duration, amountOC) -> OverclockingLogic + .heatingCoilOverclockingLogic( + Math.abs(recipeEUt), + maxVoltage, + duration, + amountOC, + blastFurnaceTemperature, + recipe.data.contains("ebf_temp") ? recipe.data.getInt("ebf_temp") : 0)), + recipe, coilMachine.getOverclockVoltage()); } return null; } @@ -153,16 +170,18 @@ public static GTRecipe pyrolyseOvenOverclock(MetaMachine machine, @NotNull GTRec if (RecipeHelper.getRecipeEUtTier(recipe) > coilMachine.getTier()) { return null; } - return RecipeHelper.applyOverclock(new OverclockingLogic((recipe1, recipeEUt, maxVoltage, duration, amountOC) -> { - var pair = OverclockingLogic.NON_PERFECT_OVERCLOCK.getLogic().runOverclockingLogic(recipe1, recipeEUt, maxVoltage, duration, amountOC); - if (coilMachine.getCoilTier() == 0) { - pair.second(pair.secondInt() * 5 / 4); - } else { - pair.second(pair.secondInt() * 2 / (coilMachine.getCoilTier() + 1)); - } - pair.second(Math.max(1, pair.secondInt())); - return pair; - }), recipe, coilMachine.getOverclockVoltage()); + return RecipeHelper + .applyOverclock(new OverclockingLogic((recipe1, recipeEUt, maxVoltage, duration, amountOC) -> { + var pair = OverclockingLogic.NON_PERFECT_OVERCLOCK.getLogic().runOverclockingLogic(recipe1, + recipeEUt, maxVoltage, duration, amountOC); + if (coilMachine.getCoilTier() == 0) { + pair.second(pair.secondInt() * 5 / 4); + } else { + pair.second(pair.secondInt() * 2 / (coilMachine.getCoilTier() + 1)); + } + pair.second(Math.max(1, pair.secondInt())); + return pair; + }), recipe, coilMachine.getOverclockVoltage()); } return null; } @@ -183,5 +202,4 @@ public static GTRecipe multiSmelterParallel(MetaMachine machine, @NotNull GTReci } return null; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeTypes.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeTypes.java index 6c380e0a93..4db1237bda 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeTypes.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeTypes.java @@ -20,6 +20,7 @@ import com.gregtechceu.gtceu.data.recipe.builder.GTRecipeBuilder; import com.gregtechceu.gtceu.integration.kjs.GTRegistryInfo; import com.gregtechceu.gtceu.utils.ResearchManager; + import com.lowdragmc.lowdraglib.gui.widget.SlotWidget; import com.lowdragmc.lowdraglib.gui.widget.TankWidget; import com.lowdragmc.lowdraglib.misc.FluidStorage; @@ -27,7 +28,7 @@ import com.lowdragmc.lowdraglib.side.fluid.FluidStack; import com.lowdragmc.lowdraglib.utils.CycleItemStackHandler; import com.lowdragmc.lowdraglib.utils.LocalizationUtils; -import com.simibubi.create.AllBlocks; + import net.minecraft.client.resources.language.I18n; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceLocation; @@ -37,6 +38,8 @@ import net.minecraft.world.item.crafting.RecipeType; import net.minecraft.world.level.material.Fluids; import net.minecraftforge.fml.ModLoader; + +import com.simibubi.create.AllBlocks; import org.jetbrains.annotations.Nullable; import java.util.ArrayList; @@ -51,6 +54,7 @@ * @implNote GTRecipeTypes */ public class GTRecipeTypes { + public static final String STEAM = "steam"; public static final String ELECTRIC = "electric"; public static final String GENERATOR = "generator"; @@ -63,7 +67,7 @@ public class GTRecipeTypes { } ////////////////////////////////////// - //********* Steam **********// + // ********* Steam **********// ////////////////////////////////////// public final static GTRecipeType STEAM_BOILER_RECIPES = register("steam_boiler", STEAM) .setMaxIOSize(1, 0, 1, 1) @@ -79,65 +83,74 @@ public class GTRecipeTypes { .setSound(GTSoundEntries.FURNACE); ////////////////////////////////////// - //********* Common *********// + // ********* Common *********// ////////////////////////////////////// - public final static GTRecipeType FURNACE_RECIPES = register("electric_furnace", ELECTRIC, RecipeType.SMELTING).setMaxIOSize(1, 1, 0, 0).setEUIO(IO.IN) + public final static GTRecipeType FURNACE_RECIPES = register("electric_furnace", ELECTRIC, RecipeType.SMELTING) + .setMaxIOSize(1, 1, 0, 0).setEUIO(IO.IN) .prepareBuilder(recipeBuilder -> recipeBuilder.EUt(4)) .setSlotOverlay(false, false, GuiTextures.FURNACE_OVERLAY_1) .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, LEFT_TO_RIGHT) .setSteamProgressBar(GuiTextures.PROGRESS_BAR_ARROW_STEAM, LEFT_TO_RIGHT) .setSound(GTSoundEntries.FURNACE); - public final static GTRecipeType ALLOY_SMELTER_RECIPES = register("alloy_smelter", ELECTRIC).setMaxIOSize(2, 1, 0, 0).setEUIO(IO.IN) + public final static GTRecipeType ALLOY_SMELTER_RECIPES = register("alloy_smelter", ELECTRIC) + .setMaxIOSize(2, 1, 0, 0).setEUIO(IO.IN) .setSlotOverlay(false, false, GuiTextures.FURNACE_OVERLAY_1) .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, LEFT_TO_RIGHT) + .setIconSupplier(() -> GTMachines.ALLOY_SMELTER[GTValues.LV].asStack()) .setSteamProgressBar(GuiTextures.PROGRESS_BAR_ARROW_STEAM, LEFT_TO_RIGHT) .setSound(GTSoundEntries.FURNACE); - public final static GTRecipeType ARC_FURNACE_RECIPES = register("arc_furnace", ELECTRIC).setMaxIOSize(1, 4, 1, 1).setEUIO(IO.IN) + public final static GTRecipeType ARC_FURNACE_RECIPES = register("arc_furnace", ELECTRIC).setMaxIOSize(1, 4, 1, 1) + .setEUIO(IO.IN) .setProgressBar(GuiTextures.PROGRESS_BAR_ARC_FURNACE, LEFT_TO_RIGHT) .setSound(GTSoundEntries.ARC) .onRecipeBuild((recipeBuilder, provider) -> { - if (recipeBuilder.input.getOrDefault(FluidRecipeCapability.CAP, Collections.emptyList()).isEmpty() && recipeBuilder.tickInput.getOrDefault(FluidRecipeCapability.CAP, Collections.emptyList()).isEmpty()) { + if (recipeBuilder.input.getOrDefault(FluidRecipeCapability.CAP, Collections.emptyList()).isEmpty() && + recipeBuilder.tickInput.getOrDefault(FluidRecipeCapability.CAP, Collections.emptyList()) + .isEmpty()) { recipeBuilder.inputFluids(GTMaterials.Oxygen.getFluid(recipeBuilder.duration)); } }); - public final static GTRecipeType ASSEMBLER_RECIPES = register("assembler", ELECTRIC).setMaxIOSize(9, 1, 1, 0).setEUIO(IO.IN) + public final static GTRecipeType ASSEMBLER_RECIPES = register("assembler", ELECTRIC).setMaxIOSize(9, 1, 1, 0) + .setEUIO(IO.IN) .setSlotOverlay(false, false, GuiTextures.CIRCUIT_OVERLAY) .setProgressBar(GuiTextures.PROGRESS_BAR_CIRCUIT, LEFT_TO_RIGHT) .setSound(GTSoundEntries.ASSEMBLER); - - public final static GTRecipeType AUTOCLAVE_RECIPES = register("autoclave", ELECTRIC).setMaxIOSize(2, 2, 1, 1).setEUIO(IO.IN) + public final static GTRecipeType AUTOCLAVE_RECIPES = register("autoclave", ELECTRIC).setMaxIOSize(2, 2, 1, 1) + .setEUIO(IO.IN) .setSlotOverlay(false, false, GuiTextures.DUST_OVERLAY) .setSlotOverlay(true, false, GuiTextures.CRYSTAL_OVERLAY) .setProgressBar(GuiTextures.PROGRESS_BAR_CRYSTALLIZATION, LEFT_TO_RIGHT) .setSound(GTSoundEntries.FURNACE); - - public final static GTRecipeType BENDER_RECIPES = register("bender", ELECTRIC).setMaxIOSize(2, 1, 0, 0).setEUIO(IO.IN) + public final static GTRecipeType BENDER_RECIPES = register("bender", ELECTRIC).setMaxIOSize(2, 1, 0, 0) + .setEUIO(IO.IN) .setSlotOverlay(false, false, false, GuiTextures.BENDER_OVERLAY) .setSlotOverlay(false, false, true, GuiTextures.INT_CIRCUIT_OVERLAY) .setProgressBar(GuiTextures.PROGRESS_BAR_BENDING, LEFT_TO_RIGHT) .setSound(GTSoundEntries.MOTOR); - - public final static GTRecipeType BREWING_RECIPES = register("brewery", ELECTRIC).setMaxIOSize(1, 0, 1, 1).setEUIO(IO.IN) + public final static GTRecipeType BREWING_RECIPES = register("brewery", ELECTRIC).setMaxIOSize(1, 0, 1, 1) + .setEUIO(IO.IN) .prepareBuilder(recipeBuilder -> recipeBuilder.duration(128).EUt(4)) .setSlotOverlay(false, false, GuiTextures.BREWER_OVERLAY) .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE, LEFT_TO_RIGHT) .setSound(GTSoundEntries.CHEMICAL); - public final static GTRecipeType MACERATOR_RECIPES = register("macerator", ELECTRIC).setMaxIOSize(1, 4, 0, 0).setEUIO(IO.IN) + public final static GTRecipeType MACERATOR_RECIPES = register("macerator", ELECTRIC).setMaxIOSize(1, 4, 0, 0) + .setEUIO(IO.IN) .setSlotOverlay(false, false, GuiTextures.CRUSHED_ORE_OVERLAY) .setSlotOverlay(true, false, GuiTextures.DUST_OVERLAY) .setProgressBar(GuiTextures.PROGRESS_BAR_MACERATE, LEFT_TO_RIGHT) + .setIconSupplier(() -> GTMachines.MACERATOR[GTValues.LV].asStack()) .setSteamProgressBar(GuiTextures.PROGRESS_BAR_MACERATE_STEAM, LEFT_TO_RIGHT) .setSound(GTSoundEntries.MACERATOR); - - public final static GTRecipeType CANNER_RECIPES = register("canner", ELECTRIC).setMaxIOSize(2, 2, 1, 1).setEUIO(IO.IN) + public final static GTRecipeType CANNER_RECIPES = register("canner", ELECTRIC).setMaxIOSize(2, 2, 1, 1) + .setEUIO(IO.IN) .setSlotOverlay(false, false, false, GuiTextures.CANNER_OVERLAY) .setSlotOverlay(false, false, true, GuiTextures.CANISTER_OVERLAY) .setSlotOverlay(true, false, GuiTextures.CANISTER_OVERLAY) @@ -146,8 +159,8 @@ public class GTRecipeTypes { .setProgressBar(GuiTextures.PROGRESS_BAR_CANNER, LEFT_TO_RIGHT) .setSound(GTSoundEntries.BATH); - - public final static GTRecipeType CENTRIFUGE_RECIPES = register("centrifuge", ELECTRIC).setMaxIOSize(2, 6, 1, 6).setEUIO(IO.IN) + public final static GTRecipeType CENTRIFUGE_RECIPES = register("centrifuge", ELECTRIC).setMaxIOSize(2, 6, 1, 6) + .setEUIO(IO.IN) .prepareBuilder(recipeBuilder -> recipeBuilder.EUt(5)) .setSlotOverlay(false, false, false, GuiTextures.EXTRACTOR_OVERLAY) .setSlotOverlay(false, false, true, GuiTextures.CANISTER_OVERLAY) @@ -155,8 +168,8 @@ public class GTRecipeTypes { .setProgressBar(GuiTextures.PROGRESS_BAR_EXTRACT, LEFT_TO_RIGHT) .setSound(GTSoundEntries.CENTRIFUGE); - - public final static GTRecipeType CHEMICAL_BATH_RECIPES = register("chemical_bath", ELECTRIC).setMaxIOSize(1, 6, 1, 1).setEUIO(IO.IN) + public final static GTRecipeType CHEMICAL_BATH_RECIPES = register("chemical_bath", ELECTRIC) + .setMaxIOSize(1, 6, 1, 1).setEUIO(IO.IN) .prepareBuilder(recipeBuilder -> recipeBuilder.EUt(GTValues.VA[GTValues.LV])) .setSlotOverlay(false, false, true, GuiTextures.BREWER_OVERLAY) .setSlotOverlay(true, false, false, GuiTextures.DUST_OVERLAY) @@ -164,8 +177,8 @@ public class GTRecipeTypes { .setProgressBar(GuiTextures.PROGRESS_BAR_MIXER, LEFT_TO_RIGHT) .setSound(GTSoundEntries.BATH); - - public final static GTRecipeType CHEMICAL_RECIPES = register("chemical_reactor", ELECTRIC).setMaxIOSize(2, 2, 3, 2).setEUIO(IO.IN) + public final static GTRecipeType CHEMICAL_RECIPES = register("chemical_reactor", ELECTRIC).setMaxIOSize(2, 2, 3, 2) + .setEUIO(IO.IN) .prepareBuilder(recipeBuilder -> recipeBuilder.EUt(GTValues.VA[GTValues.LV])) .setSlotOverlay(false, false, false, GuiTextures.MOLECULAR_OVERLAY_1) .setSlotOverlay(false, false, true, GuiTextures.MOLECULAR_OVERLAY_2) @@ -176,17 +189,20 @@ public class GTRecipeTypes { .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE, LEFT_TO_RIGHT) .setSound(GTValues.FOOLS.get() ? GTSoundEntries.SCIENCE : GTSoundEntries.CHEMICAL) .setMaxTooltips(4) - .onRecipeBuild((recipeBuilder, provider) -> GTRecipeTypes.LARGE_CHEMICAL_RECIPES.copyFrom(recipeBuilder).save(provider)); + .onRecipeBuild((recipeBuilder, provider) -> GTRecipeTypes.LARGE_CHEMICAL_RECIPES.copyFrom(recipeBuilder) + .save(provider)); - public final static GTRecipeType COMPRESSOR_RECIPES = register("compressor", ELECTRIC).setMaxIOSize(1, 1, 0, 0).setEUIO(IO.IN) + public final static GTRecipeType COMPRESSOR_RECIPES = register("compressor", ELECTRIC).setMaxIOSize(1, 1, 0, 0) + .setEUIO(IO.IN) .prepareBuilder(recipeBuilder -> recipeBuilder.duration(200).EUt(2)) .setSlotOverlay(false, false, GuiTextures.COMPRESSOR_OVERLAY) .setProgressBar(GuiTextures.PROGRESS_BAR_COMPRESS, LEFT_TO_RIGHT) + .setIconSupplier(() -> GTMachines.COMPRESSOR[GTValues.LV].asStack()) .setSteamProgressBar(GuiTextures.PROGRESS_BAR_COMPRESS_STEAM, LEFT_TO_RIGHT) .setSound(GTSoundEntries.COMPRESSOR); - - public final static GTRecipeType CUTTER_RECIPES = register("cutter", ELECTRIC).setMaxIOSize(1, 2, 1, 0).setEUIO(IO.IN) + public final static GTRecipeType CUTTER_RECIPES = register("cutter", ELECTRIC).setMaxIOSize(1, 2, 1, 0) + .setEUIO(IO.IN) .setSlotOverlay(false, false, GuiTextures.SAWBLADE_OVERLAY) .setSlotOverlay(true, false, false, GuiTextures.CUTTER_OVERLAY) .setSlotOverlay(true, false, true, GuiTextures.DUST_OVERLAY) @@ -194,28 +210,35 @@ public class GTRecipeTypes { .setSound(GTSoundEntries.CUT) .setMaxTooltips(4) .onRecipeBuild((recipeBuilder, provider) -> { - if (recipeBuilder.input.getOrDefault(FluidRecipeCapability.CAP, Collections.emptyList()).isEmpty() && recipeBuilder.tickInput.getOrDefault(FluidRecipeCapability.CAP, Collections.emptyList()).isEmpty()) { + if (recipeBuilder.input.getOrDefault(FluidRecipeCapability.CAP, Collections.emptyList()).isEmpty() && + recipeBuilder.tickInput.getOrDefault(FluidRecipeCapability.CAP, Collections.emptyList()) + .isEmpty()) { recipeBuilder .copy(new ResourceLocation(recipeBuilder.id.toString() + "_water")) - .inputFluids(GTMaterials.Water.getFluid((int) Math.max(4, Math.min(1000, recipeBuilder.duration * recipeBuilder.EUt() / 320)))) + .inputFluids(GTMaterials.Water.getFluid((int) Math.max(4, + Math.min(1000, recipeBuilder.duration * recipeBuilder.EUt() / 320)))) .duration(recipeBuilder.duration * 2) .save(provider); recipeBuilder .copy(new ResourceLocation(recipeBuilder.id.toString() + "_distilled_water")) - .inputFluids(GTMaterials.DistilledWater.getFluid((int) Math.max(3, Math.min(750, recipeBuilder.duration * recipeBuilder.EUt() / 426)))) + .inputFluids(GTMaterials.DistilledWater.getFluid((int) Math.max(3, + Math.min(750, recipeBuilder.duration * recipeBuilder.EUt() / 426)))) .duration((int) (recipeBuilder.duration * 1.5)) .save(provider); - // Don't call buildAndRegister as we are mutating the original recipe and already in the middle of a buildAndRegister call. + // Don't call buildAndRegister as we are mutating the original recipe and already in the middle of a + // buildAndRegister call. // Adding a second call will result in duplicate recipe generation attempts recipeBuilder - .inputFluids(GTMaterials.Lubricant.getFluid((int) Math.max(1, Math.min(250, recipeBuilder.duration * recipeBuilder.EUt() / 1280)))) + .inputFluids(GTMaterials.Lubricant.getFluid((int) Math.max(1, + Math.min(250, recipeBuilder.duration * recipeBuilder.EUt() / 1280)))) .duration(Math.max(1, recipeBuilder.duration)); } }); - public final static GTRecipeType DISTILLERY_RECIPES = register("distillery", ELECTRIC).setMaxIOSize(1, 1, 1, 1).setEUIO(IO.IN) + public final static GTRecipeType DISTILLERY_RECIPES = register("distillery", ELECTRIC).setMaxIOSize(1, 1, 1, 1) + .setEUIO(IO.IN) .setSlotOverlay(false, true, GuiTextures.BEAKER_OVERLAY_1) .setSlotOverlay(true, true, GuiTextures.BEAKER_OVERLAY_4) .setSlotOverlay(true, false, GuiTextures.DUST_OVERLAY) @@ -223,68 +246,70 @@ public class GTRecipeTypes { .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE, LEFT_TO_RIGHT) .setSound(GTSoundEntries.BOILER); - - public final static GTRecipeType ELECTROLYZER_RECIPES = register("electrolyzer", ELECTRIC).setMaxIOSize(2, 6, 1, 6).setEUIO(IO.IN) + public final static GTRecipeType ELECTROLYZER_RECIPES = register("electrolyzer", ELECTRIC).setMaxIOSize(2, 6, 1, 6) + .setEUIO(IO.IN) .setSlotOverlay(false, false, false, GuiTextures.LIGHTNING_OVERLAY_1) .setSlotOverlay(false, false, true, GuiTextures.CANISTER_OVERLAY) .setSlotOverlay(false, true, true, GuiTextures.LIGHTNING_OVERLAY_2) .setProgressBar(GuiTextures.PROGRESS_BAR_EXTRACT, LEFT_TO_RIGHT) .setSound(GTSoundEntries.ELECTROLYZER); - - public final static GTRecipeType ELECTROMAGNETIC_SEPARATOR_RECIPES = register("electromagnetic_separator", ELECTRIC).setMaxIOSize(1, 3, 0, 0).setEUIO(IO.IN) + public final static GTRecipeType ELECTROMAGNETIC_SEPARATOR_RECIPES = register("electromagnetic_separator", ELECTRIC) + .setMaxIOSize(1, 3, 0, 0).setEUIO(IO.IN) .setSlotOverlay(false, false, GuiTextures.CRUSHED_ORE_OVERLAY) .setSlotOverlay(true, false, GuiTextures.DUST_OVERLAY) .setProgressBar(GuiTextures.PROGRESS_BAR_MAGNET, LEFT_TO_RIGHT) .setSound(GTSoundEntries.ARC); - - public final static GTRecipeType EXTRACTOR_RECIPES = register("extractor", ELECTRIC).setMaxIOSize(1, 1, 0, 1).setEUIO(IO.IN) + public final static GTRecipeType EXTRACTOR_RECIPES = register("extractor", ELECTRIC).setMaxIOSize(1, 1, 0, 1) + .setEUIO(IO.IN) .prepareBuilder(recipeBuilder -> recipeBuilder.duration(400).EUt(2)) .setSlotOverlay(false, false, GuiTextures.EXTRACTOR_OVERLAY) .setProgressBar(GuiTextures.PROGRESS_BAR_EXTRACT, LEFT_TO_RIGHT) + .setIconSupplier(() -> GTMachines.EXTRACTOR[GTValues.LV].asStack()) .setSteamProgressBar(GuiTextures.PROGRESS_BAR_EXTRACT_STEAM, LEFT_TO_RIGHT); - public final static GTRecipeType EXTRUDER_RECIPES = register("extruder", ELECTRIC).setMaxIOSize(2, 1, 0, 0).setEUIO(IO.IN) + public final static GTRecipeType EXTRUDER_RECIPES = register("extruder", ELECTRIC).setMaxIOSize(2, 1, 0, 0) + .setEUIO(IO.IN) .setSlotOverlay(false, false, true, GuiTextures.MOLD_OVERLAY) .setProgressBar(GuiTextures.PROGRESS_BAR_EXTRUDER, LEFT_TO_RIGHT) .setSound(GTSoundEntries.COMPRESSOR); - - public final static GTRecipeType FERMENTING_RECIPES = register("fermenter", ELECTRIC).setMaxIOSize(1, 1, 1, 1).setEUIO(IO.IN) + public final static GTRecipeType FERMENTING_RECIPES = register("fermenter", ELECTRIC).setMaxIOSize(1, 1, 1, 1) + .setEUIO(IO.IN) .prepareBuilder(recipeBuilder -> recipeBuilder.EUt(2)) .setSlotOverlay(false, false, true, GuiTextures.DUST_OVERLAY) .setSlotOverlay(true, false, true, GuiTextures.DUST_OVERLAY) .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, LEFT_TO_RIGHT) .setSound(GTSoundEntries.CHEMICAL); - - public final static GTRecipeType FLUID_HEATER_RECIPES = register("fluid_heater", ELECTRIC).setMaxIOSize(1, 0, 1, 1).setEUIO(IO.IN) + public final static GTRecipeType FLUID_HEATER_RECIPES = register("fluid_heater", ELECTRIC).setMaxIOSize(1, 0, 1, 1) + .setEUIO(IO.IN) .setSlotOverlay(false, true, GuiTextures.HEATING_OVERLAY_1) .setSlotOverlay(true, true, GuiTextures.HEATING_OVERLAY_2) .setSlotOverlay(false, false, GuiTextures.INT_CIRCUIT_OVERLAY) .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, LEFT_TO_RIGHT) .setSound(GTSoundEntries.BOILER); - - public final static GTRecipeType FLUID_SOLIDFICATION_RECIPES = register("fluid_solidifier", ELECTRIC).setMaxIOSize(1, 1, 1, 0).setEUIO(IO.IN) + public final static GTRecipeType FLUID_SOLIDFICATION_RECIPES = register("fluid_solidifier", ELECTRIC) + .setMaxIOSize(1, 1, 1, 0).setEUIO(IO.IN) .setSlotOverlay(false, false, GuiTextures.SOLIDIFIER_OVERLAY) .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, LEFT_TO_RIGHT) .setSound(GTSoundEntries.COOLING); - - public final static GTRecipeType FORGE_HAMMER_RECIPES = register("forge_hammer", ELECTRIC).setMaxIOSize(1, 1, 0, 0).setEUIO(IO.IN) + public final static GTRecipeType FORGE_HAMMER_RECIPES = register("forge_hammer", ELECTRIC).setMaxIOSize(1, 1, 0, 0) + .setEUIO(IO.IN) .setSlotOverlay(false, false, GuiTextures.HAMMER_OVERLAY) .setProgressBar(GuiTextures.PROGRESS_BAR_HAMMER, UP_TO_DOWN) + .setIconSupplier(() -> GTMachines.FORGE_HAMMER[GTValues.LV].asStack()) .setSteamProgressBar(GuiTextures.PROGRESS_BAR_HAMMER_STEAM, UP_TO_DOWN) .setSound(GTSoundEntries.FORGE_HAMMER); - - public final static GTRecipeType FORMING_PRESS_RECIPES = register("forming_press", ELECTRIC).setMaxIOSize(6, 1, 0, 0).setEUIO(IO.IN) + public final static GTRecipeType FORMING_PRESS_RECIPES = register("forming_press", ELECTRIC) + .setMaxIOSize(6, 1, 0, 0).setEUIO(IO.IN) .setProgressBar(GuiTextures.PROGRESS_BAR_COMPRESS, LEFT_TO_RIGHT) .setSound(GTSoundEntries.COMPRESSOR); - public final static GTRecipeType LATHE_RECIPES = register("lathe", ELECTRIC).setMaxIOSize(1, 2, 0, 0).setEUIO(IO.IN) .setSlotOverlay(false, false, GuiTextures.PIPE_OVERLAY_1) .setSlotOverlay(true, false, false, GuiTextures.PIPE_OVERLAY_2) @@ -292,78 +317,84 @@ public class GTRecipeTypes { .setProgressBar(GuiTextures.PROGRESS_BAR_LATHE, LEFT_TO_RIGHT) .setSound(GTSoundEntries.CUT); - public final static GTRecipeType MIXER_RECIPES = register("mixer", ELECTRIC).setMaxIOSize(6, 1, 2, 1).setEUIO(IO.IN) .setSlotOverlay(false, false, GuiTextures.DUST_OVERLAY) .setSlotOverlay(true, false, GuiTextures.DUST_OVERLAY) .setProgressBar(GuiTextures.PROGRESS_BAR_MIXER, LEFT_TO_RIGHT) .setSound(GTSoundEntries.MIXER); - - public final static GTRecipeType ORE_WASHER_RECIPES = register("ore_washer", ELECTRIC).setMaxIOSize(2, 3, 1, 0).setEUIO(IO.IN) + public final static GTRecipeType ORE_WASHER_RECIPES = register("ore_washer", ELECTRIC).setMaxIOSize(2, 3, 1, 0) + .setEUIO(IO.IN) .prepareBuilder(recipeBuilder -> recipeBuilder.duration(400).EUt(16)) .setSlotOverlay(false, false, GuiTextures.CRUSHED_ORE_OVERLAY) .setSlotOverlay(true, false, GuiTextures.DUST_OVERLAY) .setProgressBar(GuiTextures.PROGRESS_BAR_BATH, LEFT_TO_RIGHT) .setSound(GTSoundEntries.BATH); - - public final static GTRecipeType PACKER_RECIPES = register("packer", ELECTRIC).setMaxIOSize(2, 2, 0, 0).setEUIO(IO.IN) + public final static GTRecipeType PACKER_RECIPES = register("packer", ELECTRIC).setMaxIOSize(2, 2, 0, 0) + .setEUIO(IO.IN) .prepareBuilder(recipeBuilder -> recipeBuilder.EUt(12).duration(10)) .setSlotOverlay(false, false, true, GuiTextures.BOX_OVERLAY) .setSlotOverlay(true, false, GuiTextures.BOXED_OVERLAY) .setProgressBar(GuiTextures.PROGRESS_BAR_UNPACKER, LEFT_TO_RIGHT) .setSound(GTSoundEntries.ASSEMBLER); - - public final static GTRecipeType POLARIZER_RECIPES = register("polarizer", ELECTRIC).setMaxIOSize(1, 1, 0, 0).setEUIO(IO.IN) + public final static GTRecipeType POLARIZER_RECIPES = register("polarizer", ELECTRIC).setMaxIOSize(1, 1, 0, 0) + .setEUIO(IO.IN) .setProgressBar(GuiTextures.PROGRESS_BAR_MAGNET, LEFT_TO_RIGHT) .setSound(GTSoundEntries.ARC); - - public final static GTRecipeType LASER_ENGRAVER_RECIPES = register("laser_engraver", ELECTRIC).setMaxIOSize(2, 1, 0, 0).setEUIO(IO.IN) + public final static GTRecipeType LASER_ENGRAVER_RECIPES = register("laser_engraver", ELECTRIC) + .setMaxIOSize(2, 1, 0, 0).setEUIO(IO.IN) .setSlotOverlay(false, false, true, GuiTextures.LENS_OVERLAY) .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, LEFT_TO_RIGHT) .setMaxTooltips(4) .setSound(GTSoundEntries.ELECTROLYZER); - - public final static GTRecipeType SIFTER_RECIPES = register("sifter", ELECTRIC).setMaxIOSize(1, 6, 0, 0).setEUIO(IO.IN) + public final static GTRecipeType SIFTER_RECIPES = register("sifter", ELECTRIC).setMaxIOSize(1, 6, 0, 0) + .setEUIO(IO.IN) .setProgressBar(GuiTextures.PROGRESS_BAR_SIFT, UP_TO_DOWN) .setSound(new ExistingSoundEntry(SoundEvents.SAND_PLACE, SoundSource.BLOCKS)); - - public final static GTRecipeType THERMAL_CENTRIFUGE_RECIPES = register("thermal_centrifuge", ELECTRIC).setMaxIOSize(1, 3, 0, 0).setEUIO(IO.IN) + public final static GTRecipeType THERMAL_CENTRIFUGE_RECIPES = register("thermal_centrifuge", ELECTRIC) + .setMaxIOSize(1, 3, 0, 0).setEUIO(IO.IN) .prepareBuilder(recipeBuilder -> recipeBuilder.duration(400).EUt(30)) .setSlotOverlay(false, false, GuiTextures.CRUSHED_ORE_OVERLAY) .setSlotOverlay(true, false, GuiTextures.DUST_OVERLAY) .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, LEFT_TO_RIGHT) .setSound(GTSoundEntries.CENTRIFUGE); - - public final static GTRecipeType WIREMILL_RECIPES = register("wiremill", ELECTRIC).setMaxIOSize(2, 1, 0, 0).setEUIO(IO.IN) + public final static GTRecipeType WIREMILL_RECIPES = register("wiremill", ELECTRIC).setMaxIOSize(2, 1, 0, 0) + .setEUIO(IO.IN) .setSlotOverlay(false, false, GuiTextures.WIREMILL_OVERLAY) .setProgressBar(GuiTextures.PROGRESS_BAR_WIREMILL, LEFT_TO_RIGHT) .setSound(GTSoundEntries.MOTOR); - public final static GTRecipeType CIRCUIT_ASSEMBLER_RECIPES = register("circuit_assembler", ELECTRIC).setMaxIOSize(6, 1, 1, 0).setEUIO(IO.IN) + public final static GTRecipeType CIRCUIT_ASSEMBLER_RECIPES = register("circuit_assembler", ELECTRIC) + .setMaxIOSize(6, 1, 1, 0).setEUIO(IO.IN) .setSlotOverlay(false, false, GuiTextures.CIRCUIT_OVERLAY) .setProgressBar(GuiTextures.PROGRESS_BAR_CIRCUIT_ASSEMBLER, LEFT_TO_RIGHT) .setSound(GTSoundEntries.ASSEMBLER) .setMaxTooltips(4) .onRecipeBuild((recipeBuilder, provider) -> { - if (recipeBuilder.input.getOrDefault(FluidRecipeCapability.CAP, Collections.emptyList()).isEmpty() && recipeBuilder.tickInput.getOrDefault(FluidRecipeCapability.CAP, Collections.emptyList()).isEmpty()) { - recipeBuilder.copy(new ResourceLocation(recipeBuilder.id.toString() + "_soldering_alloy")) - .inputFluids(GTMaterials.SolderingAlloy.getFluid(Math.max(1, (GTValues.L / 2) * recipeBuilder.getSolderMultiplier()))) + if (recipeBuilder.input.getOrDefault(FluidRecipeCapability.CAP, Collections.emptyList()).isEmpty() && + recipeBuilder.tickInput.getOrDefault(FluidRecipeCapability.CAP, Collections.emptyList()) + .isEmpty()) { + recipeBuilder.copy(new ResourceLocation(recipeBuilder.id.toString() + "_soldering_alloy")) + .inputFluids(GTMaterials.SolderingAlloy + .getFluid(Math.max(1, (GTValues.L / 2) * recipeBuilder.getSolderMultiplier()))) .save(provider); - // Don't call buildAndRegister as we are mutating the original recipe and already in the middle of a buildAndRegister call. + // Don't call buildAndRegister as we are mutating the original recipe and already in the middle of a + // buildAndRegister call. // Adding a second call will result in duplicate recipe generation attempts - recipeBuilder.inputFluids(GTMaterials.Tin.getFluid(Math.max(1, GTValues.L * recipeBuilder.getSolderMultiplier()))); + recipeBuilder.inputFluids( + GTMaterials.Tin.getFluid(Math.max(1, GTValues.L * recipeBuilder.getSolderMultiplier()))); } }); - public final static GTRecipeType GAS_COLLECTOR_RECIPES = register("gas_collector", ELECTRIC).setMaxIOSize(1, 0, 0, 1).setEUIO(IO.IN) + public final static GTRecipeType GAS_COLLECTOR_RECIPES = register("gas_collector", ELECTRIC) + .setMaxIOSize(1, 0, 0, 1).setEUIO(IO.IN) .setSlotOverlay(false, false, GuiTextures.INT_CIRCUIT_OVERLAY) .setSlotOverlay(true, true, GuiTextures.CENTRIFUGE_OVERLAY) .setProgressBar(GuiTextures.PROGRESS_BAR_GAS_COLLECTOR, LEFT_TO_RIGHT) @@ -380,21 +411,25 @@ public class GTRecipeTypes { .setMaxTooltips(4) .setSound(GTValues.FOOLS.get() ? GTSoundEntries.SCIENCE : GTSoundEntries.COMPUTATION); - public final static GTRecipeType ROCK_BREAKER_RECIPES = register("rock_breaker", ELECTRIC).setMaxIOSize(1, 4, 0, 0).setEUIO(IO.IN) + public final static GTRecipeType ROCK_BREAKER_RECIPES = register("rock_breaker", ELECTRIC).setMaxIOSize(1, 4, 0, 0) + .setEUIO(IO.IN) .setSlotOverlay(false, false, GuiTextures.DUST_OVERLAY) .setSlotOverlay(true, false, GuiTextures.CRUSHED_ORE_OVERLAY) .setProgressBar(GuiTextures.PROGRESS_BAR_MACERATE, LEFT_TO_RIGHT) + .setIconSupplier(() -> GTMachines.ROCK_CRUSHER[GTValues.LV].asStack()) .setSteamProgressBar(GuiTextures.PROGRESS_BAR_MACERATE_STEAM, LEFT_TO_RIGHT) .prepareBuilder(recipeBuilder -> recipeBuilder.addCondition(RockBreakerCondition.INSTANCE)) .setUiBuilder((recipe, widgetGroup) -> { var fluidA = BuiltInRegistries.FLUID.get(new ResourceLocation(recipe.data.getString("fluidA"))); var fluidB = BuiltInRegistries.FLUID.get(new ResourceLocation(recipe.data.getString("fluidB"))); if (fluidA != Fluids.EMPTY) { - widgetGroup.addWidget(new TankWidget(new FluidStorage(FluidStack.create(fluidA, 1000)), widgetGroup.getSize().width - 30, widgetGroup.getSize().height - 30, false, false) + widgetGroup.addWidget(new TankWidget(new FluidStorage(FluidStack.create(fluidA, 1000)), + widgetGroup.getSize().width - 30, widgetGroup.getSize().height - 30, false, false) .setBackground(GuiTextures.FLUID_SLOT).setShowAmount(false)); } if (fluidB != Fluids.EMPTY) { - widgetGroup.addWidget(new TankWidget(new FluidStorage(FluidStack.create(fluidB, 1000)), widgetGroup.getSize().width - 30 - 20, widgetGroup.getSize().height - 30, false, false) + widgetGroup.addWidget(new TankWidget(new FluidStorage(FluidStack.create(fluidB, 1000)), + widgetGroup.getSize().width - 30 - 20, widgetGroup.getSize().height - 30, false, false) .setBackground(GuiTextures.FLUID_SLOT).setShowAmount(false)); } }) @@ -410,32 +445,37 @@ public class GTRecipeTypes { .setSound(GTSoundEntries.ELECTROLYZER); ////////////////////////////////////// - //******* Generator *******// + // ******* Generator *******// ////////////////////////////////////// - public final static GTRecipeType COMBUSTION_GENERATOR_FUELS = register("combustion_generator", GENERATOR).setMaxIOSize(0, 0, 1, 0).setEUIO(IO.OUT) + public final static GTRecipeType COMBUSTION_GENERATOR_FUELS = register("combustion_generator", GENERATOR) + .setMaxIOSize(0, 0, 1, 0).setEUIO(IO.OUT) .setSlotOverlay(false, true, true, GuiTextures.FURNACE_OVERLAY_2) .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE, LEFT_TO_RIGHT) .setSound(GTSoundEntries.COMBUSTION); - public final static GTRecipeType GAS_TURBINE_FUELS = register("gas_turbine", GENERATOR).setMaxIOSize(0, 0, 1, 0).setEUIO(IO.OUT) + public final static GTRecipeType GAS_TURBINE_FUELS = register("gas_turbine", GENERATOR).setMaxIOSize(0, 0, 1, 0) + .setEUIO(IO.OUT) .setSlotOverlay(false, true, true, GuiTextures.DARK_CANISTER_OVERLAY) .setProgressBar(GuiTextures.PROGRESS_BAR_GAS_COLLECTOR, LEFT_TO_RIGHT) .setSound(GTSoundEntries.TURBINE); - public final static GTRecipeType STEAM_TURBINE_FUELS = register("steam_turbine", GENERATOR).setMaxIOSize(0, 0, 1, 1).setEUIO(IO.OUT) + public final static GTRecipeType STEAM_TURBINE_FUELS = register("steam_turbine", GENERATOR).setMaxIOSize(0, 0, 1, 1) + .setEUIO(IO.OUT) .setSlotOverlay(false, true, true, GuiTextures.CENTRIFUGE_OVERLAY) .setProgressBar(GuiTextures.PROGRESS_BAR_GAS_COLLECTOR, LEFT_TO_RIGHT) .setSound(GTSoundEntries.TURBINE); - public final static GTRecipeType PLASMA_GENERATOR_FUELS = register("plasma_generator", GENERATOR).setMaxIOSize(0, 0, 1, 1).setEUIO(IO.OUT) + public final static GTRecipeType PLASMA_GENERATOR_FUELS = register("plasma_generator", GENERATOR) + .setMaxIOSize(0, 0, 1, 1).setEUIO(IO.OUT) .setSlotOverlay(false, true, true, GuiTextures.CENTRIFUGE_OVERLAY) .setProgressBar(GuiTextures.PROGRESS_BAR_GAS_COLLECTOR, LEFT_TO_RIGHT) .setSound(GTSoundEntries.TURBINE); ////////////////////////////////////// - //******* Multiblock *******// + // ******* Multiblock *******// ////////////////////////////////////// - public final static GTRecipeType LARGE_BOILER_RECIPES = register("large_boiler", MULTIBLOCK).setMaxIOSize(1, 0, 1, 1) + public final static GTRecipeType LARGE_BOILER_RECIPES = register("large_boiler", MULTIBLOCK) + .setMaxIOSize(1, 0, 1, 1) .setProgressBar(GuiTextures.PROGRESS_BAR_BOILER_FUEL.get(true), DOWN_TO_UP) .setMaxTooltips(1) .setSound(GTSoundEntries.FURNACE); @@ -445,12 +485,14 @@ public class GTRecipeTypes { .setMaxTooltips(1) .setSound(GTSoundEntries.FIRE); - public final static GTRecipeType PRIMITIVE_BLAST_FURNACE_RECIPES = register("primitive_blast_furnace", MULTIBLOCK).setMaxIOSize(3, 3, 0, 0) + public final static GTRecipeType PRIMITIVE_BLAST_FURNACE_RECIPES = register("primitive_blast_furnace", MULTIBLOCK) + .setMaxIOSize(3, 3, 0, 0) .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, LEFT_TO_RIGHT) .setMaxTooltips(1) .setSound(GTSoundEntries.FIRE); - public final static GTRecipeType BLAST_RECIPES = register("electric_blast_furnace", MULTIBLOCK).setMaxIOSize(3, 3, 1, 1).setEUIO(IO.IN) + public final static GTRecipeType BLAST_RECIPES = register("electric_blast_furnace", MULTIBLOCK) + .setMaxIOSize(3, 3, 1, 1).setEUIO(IO.IN) .addDataInfo(data -> { int temp = data.getInt("ebf_temp"); return LocalizationUtils.format("gtceu.recipe.temperature", temp); @@ -460,28 +502,38 @@ public class GTRecipeTypes { ICoilType requiredCoil = ICoilType.getMinRequiredType(temp); if (requiredCoil != null && requiredCoil.getMaterial() != null) { - return LocalizationUtils.format("gtceu.recipe.coil.tier", I18n.get(requiredCoil.getMaterial().getUnlocalizedName())); + return LocalizationUtils.format("gtceu.recipe.coil.tier", + I18n.get(requiredCoil.getMaterial().getUnlocalizedName())); } return ""; }) .setUiBuilder((recipe, widgetGroup) -> { int temp = recipe.data.getInt("ebf_temp"); List> items = new ArrayList<>(); - items.add(GTCEuAPI.HEATING_COILS.entrySet().stream().filter(coil -> coil.getKey().getCoilTemperature() >= temp).map(coil -> new ItemStack(coil.getValue().get())).toList()); - widgetGroup.addWidget(new SlotWidget(new CycleItemStackHandler(items), 0, widgetGroup.getSize().width - 25, widgetGroup.getSize().height - 32, false, false)); + items.add(GTCEuAPI.HEATING_COILS.entrySet().stream() + .filter(coil -> coil.getKey().getCoilTemperature() >= temp) + .map(coil -> new ItemStack(coil.getValue().get())).toList()); + widgetGroup.addWidget(new SlotWidget(new CycleItemStackHandler(items), 0, + widgetGroup.getSize().width - 25, widgetGroup.getSize().height - 32, false, false)); }) .setSound(GTSoundEntries.FURNACE); - public final static GTRecipeType DISTILLATION_RECIPES = register("distillation_tower", MULTIBLOCK).setMaxIOSize(0, 1, 1, 12).setEUIO(IO.IN) + public final static GTRecipeType DISTILLATION_RECIPES = register("distillation_tower", MULTIBLOCK) + .setMaxIOSize(0, 1, 1, 12).setEUIO(IO.IN) .setSound(GTSoundEntries.CHEMICAL) .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE, LEFT_TO_RIGHT) .onRecipeBuild((recipeBuilder, provider) -> { if (recipeBuilder.data.getBoolean("disable_distillery")) return; if (recipeBuilder.output.containsKey(FluidRecipeCapability.CAP)) { - long EUt = EURecipeCapability.CAP.of(recipeBuilder.tickInput.get(EURecipeCapability.CAP).get(0).getContent()); + long EUt = EURecipeCapability.CAP + .of(recipeBuilder.tickInput.get(EURecipeCapability.CAP).get(0).getContent()); Content inputContent = recipeBuilder.input.get(FluidRecipeCapability.CAP).get(0); FluidIngredient input = FluidRecipeCapability.CAP.of(inputContent.getContent()); - ItemStack[] outputs = recipeBuilder.output.containsKey(ItemRecipeCapability.CAP) ? ItemRecipeCapability.CAP.of(recipeBuilder.output.get(ItemRecipeCapability.CAP).get(0).getContent()).getItems() : null; + ItemStack[] outputs = recipeBuilder.output.containsKey(ItemRecipeCapability.CAP) ? + ItemRecipeCapability.CAP + .of(recipeBuilder.output.get(ItemRecipeCapability.CAP).get(0).getContent()) + .getItems() : + null; ItemStack outputItem = outputs == null || outputs.length == 0 ? ItemStack.EMPTY : outputs[0]; if (input.isEmpty()) return; List contents = recipeBuilder.output.get(FluidRecipeCapability.CAP); @@ -489,10 +541,14 @@ public class GTRecipeTypes { Content outputContent = contents.get(i); FluidIngredient output = FluidRecipeCapability.CAP.of(outputContent.getContent()); if (output.isEmpty()) continue; - GTRecipeBuilder builder = DISTILLERY_RECIPES.recipeBuilder(recipeBuilder.id.getPath() + "_to_" + BuiltInRegistries.FLUID.getKey(output.getStacks()[0].getFluid()).getPath()).EUt(Math.max(1, EUt / 4)).circuitMeta(i + 1); + GTRecipeBuilder builder = DISTILLERY_RECIPES + .recipeBuilder(recipeBuilder.id.getPath() + "_to_" + + BuiltInRegistries.FLUID.getKey(output.getStacks()[0].getFluid()).getPath()) + .EUt(Math.max(1, EUt / 4)).circuitMeta(i + 1); int ratio = RecipeHelper.getRatioForDistillery(input, output, outputItem); - int recipeDuration = (int) (recipeBuilder.duration * OverclockingLogic.STANDARD_OVERCLOCK_DURATION_DIVISOR); + int recipeDuration = (int) (recipeBuilder.duration * + OverclockingLogic.STANDARD_OVERCLOCK_DURATION_DIVISOR); boolean shouldDivide = ratio != 1; boolean fluidsDivisible = RecipeHelper.isFluidStackDivisibleForDistillery(input, ratio) && @@ -542,35 +598,46 @@ public class GTRecipeTypes { } }); - public final static GTRecipeType PYROLYSE_RECIPES = register("pyrolyse_oven", MULTIBLOCK).setMaxIOSize(2, 1, 1, 1).setEUIO(IO.IN) + public static final GTRecipeType EVAPORATION_RECIPES = register("evaporation", ELECTRIC).setMaxIOSize(0, 1, 1, 6) + .setEUIO(IO.IN) + .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE, LEFT_TO_RIGHT) + .setSound(GTSoundEntries.MOTOR); + + public final static GTRecipeType PYROLYSE_RECIPES = register("pyrolyse_oven", MULTIBLOCK).setMaxIOSize(2, 1, 1, 1) + .setEUIO(IO.IN) .setSound(GTSoundEntries.FIRE); - public final static GTRecipeType CRACKING_RECIPES = register("cracker", MULTIBLOCK).setMaxIOSize(1, 0, 2, 2).setEUIO(IO.IN) + public final static GTRecipeType CRACKING_RECIPES = register("cracker", MULTIBLOCK).setMaxIOSize(1, 0, 2, 2) + .setEUIO(IO.IN) .setSlotOverlay(false, true, GuiTextures.CRACKING_OVERLAY_1) .setSlotOverlay(true, true, GuiTextures.CRACKING_OVERLAY_2) .setSlotOverlay(false, false, GuiTextures.CIRCUIT_OVERLAY) .setProgressBar(GuiTextures.PROGRESS_BAR_CRACKING, LEFT_TO_RIGHT) .setSound(GTSoundEntries.FIRE); - public final static GTRecipeType IMPLOSION_RECIPES = register("implosion_compressor", MULTIBLOCK).setMaxIOSize(3, 2, 0, 0).setEUIO(IO.IN) + public final static GTRecipeType IMPLOSION_RECIPES = register("implosion_compressor", MULTIBLOCK) + .setMaxIOSize(3, 2, 0, 0).setEUIO(IO.IN) .prepareBuilder(recipeBuilder -> recipeBuilder.duration(20).EUt(GTValues.VA[GTValues.LV])) .setSlotOverlay(false, false, true, GuiTextures.IMPLOSION_OVERLAY_1) .setSlotOverlay(false, false, false, GuiTextures.IMPLOSION_OVERLAY_2) .setSlotOverlay(true, false, true, GuiTextures.DUST_OVERLAY) .setSound(new ExistingSoundEntry(SoundEvents.GENERIC_EXPLODE, SoundSource.BLOCKS)); - public final static GTRecipeType VACUUM_RECIPES = register("vacuum_freezer", MULTIBLOCK).setMaxIOSize(1, 1, 2, 1).setEUIO(IO.IN) + public final static GTRecipeType VACUUM_RECIPES = register("vacuum_freezer", MULTIBLOCK).setMaxIOSize(1, 1, 2, 1) + .setEUIO(IO.IN) .prepareBuilder(recipeBuilder -> recipeBuilder.EUt(GTValues.VA[GTValues.MV])) .setSound(GTSoundEntries.COOLING); - public final static GTRecipeType ASSEMBLY_LINE_RECIPES = register("assembly_line", MULTIBLOCK).setMaxIOSize(16, 1, 4, 0).setEUIO(IO.IN) + public final static GTRecipeType ASSEMBLY_LINE_RECIPES = register("assembly_line", MULTIBLOCK) + .setMaxIOSize(16, 1, 4, 0).setEUIO(IO.IN) .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW, LEFT_TO_RIGHT) .setSound(GTSoundEntries.ASSEMBLER) .setHasResearchSlot(true) .setMaxTooltips(4) .onRecipeBuild(ResearchManager::createDefaultResearchRecipe); - public static final GTRecipeType LARGE_CHEMICAL_RECIPES = register("large_chemical_reactor", MULTIBLOCK).setMaxIOSize(3, 3, 5, 4).setEUIO(IO.IN) + public static final GTRecipeType LARGE_CHEMICAL_RECIPES = register("large_chemical_reactor", MULTIBLOCK) + .setMaxIOSize(3, 3, 5, 4).setEUIO(IO.IN) .prepareBuilder(recipeBuilder -> recipeBuilder.EUt(GTValues.VA[GTValues.LV])) .setSlotOverlay(false, false, false, GuiTextures.MOLECULAR_OVERLAY_1) .setSlotOverlay(false, false, true, GuiTextures.MOLECULAR_OVERLAY_2) @@ -582,8 +649,8 @@ public class GTRecipeTypes { .setProgressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE, LEFT_TO_RIGHT) .setSmallRecipeMap(CHEMICAL_RECIPES); - - public static final GTRecipeType FUSION_RECIPES = register("fusion_reactor", MULTIBLOCK).setMaxIOSize(0, 0, 2, 1).setEUIO(IO.IN) + public static final GTRecipeType FUSION_RECIPES = register("fusion_reactor", MULTIBLOCK).setMaxIOSize(0, 0, 2, 1) + .setEUIO(IO.IN) .setProgressBar(GuiTextures.PROGRESS_BAR_FUSION, LEFT_TO_RIGHT) .setSound(GTSoundEntries.ARC) .setOffsetVoltageText(true) @@ -591,14 +658,12 @@ public class GTRecipeTypes { public static final GTRecipeType DUMMY_RECIPES = new GTRecipeType(GTCEu.id("dummy"), DUMMY); - ////////////////////////////////////// - //****** Integration *******// + // ****** Integration *******// ////////////////////////////////////// @Nullable public static GTRecipeType CREATE_MIXER_RECIPES; - public static GTRecipeType register(String name, String group, RecipeType... proxyRecipes) { var recipeType = new GTRecipeType(GTCEu.id(name), group, proxyRecipes); GTRegistries.register(BuiltInRegistries.RECIPE_TYPE, recipeType.registryName, recipeType); @@ -619,7 +684,8 @@ public static void init() { .setUiBuilder((recipe, group) -> { if (!recipe.conditions.isEmpty() && recipe.conditions.get(0) instanceof RPMCondition) { var transfer = new ItemStackTransfer(AllBlocks.SHAFT.asStack()); - group.addWidget(new SlotWidget(transfer, 0, group.getSize().width - 30, group.getSize().height - 30, false, false)); + group.addWidget(new SlotWidget(transfer, 0, group.getSize().width - 30, + group.getSize().height - 30, false, false)); } }); MIXER_RECIPES.onRecipeBuild((builder, provider) -> { @@ -636,11 +702,16 @@ public static void init() { ModLoader.get().postEvent(new GTCEuAPI.RegisterEvent<>(GTRegistries.RECIPE_TYPES, GTRecipeType.class)); GTRegistries.RECIPE_TYPES.freeze(); - GTRegistries.register(BuiltInRegistries.RECIPE_SERIALIZER, GTCEu.id("gt_recipe_serializer"), GTRecipeSerializer.SERIALIZER); - GTRegistries.register(BuiltInRegistries.RECIPE_SERIALIZER, GTCEu.id("facade_cover_serializer"), FacadeCoverRecipe.SERIALIZER); - GTRegistries.register(BuiltInRegistries.RECIPE_SERIALIZER, GTCEu.id("strict_shaped_recipe_serializer"), StrictShapedRecipe.SERIALIZER); - GTRegistries.register(BuiltInRegistries.RECIPE_SERIALIZER, GTCEu.id("shaped_energy_transfer_recipe_serializer"), ShapedEnergyTransferRecipe.SERIALIZER); - GTRegistries.register(BuiltInRegistries.RECIPE_SERIALIZER, GTCEu.id("tool_head_replace_recipe_serializer"), ToolHeadReplaceRecipe.SERIALIZER); + GTRegistries.register(BuiltInRegistries.RECIPE_SERIALIZER, GTCEu.id("gt_recipe_serializer"), + GTRecipeSerializer.SERIALIZER); + GTRegistries.register(BuiltInRegistries.RECIPE_SERIALIZER, GTCEu.id("facade_cover_serializer"), + FacadeCoverRecipe.SERIALIZER); + GTRegistries.register(BuiltInRegistries.RECIPE_SERIALIZER, GTCEu.id("strict_shaped_recipe_serializer"), + StrictShapedRecipe.SERIALIZER); + GTRegistries.register(BuiltInRegistries.RECIPE_SERIALIZER, GTCEu.id("shaped_energy_transfer_recipe_serializer"), + ShapedEnergyTransferRecipe.SERIALIZER); + GTRegistries.register(BuiltInRegistries.RECIPE_SERIALIZER, GTCEu.id("tool_head_replace_recipe_serializer"), + ToolHeadReplaceRecipe.SERIALIZER); } public static GTRecipeType get(String name) { diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipes.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipes.java index 5b9ccf8ddf..a7f66336c1 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipes.java @@ -9,15 +9,18 @@ import com.gregtechceu.gtceu.data.recipe.misc.*; import com.gregtechceu.gtceu.data.recipe.serialized.chemistry.ChemistryRecipes; import com.gregtechceu.gtceu.utils.ResearchManager; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.block.ComposterBlock; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import java.util.Set; import java.util.function.Consumer; public class GTRecipes { + private static final Set RECIPE_FILTERS = new ObjectOpenHashSet<>(); /* @@ -71,7 +74,7 @@ public static void recipeAddition(Consumer originalConsumer) { ComponentRecipes.init(consumer); MetaTileEntityLoader.init(consumer); - //GCyM + // GCyM GCyMRecipes.init(consumer); // Config-dependent recipes diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTSoundEntries.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTSoundEntries.java index 2f12b55d60..58e2efa6cb 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTSoundEntries.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTSoundEntries.java @@ -1,11 +1,11 @@ package com.gregtechceu.gtceu.common.data; - import com.gregtechceu.gtceu.api.GTCEuAPI; import com.gregtechceu.gtceu.api.addon.AddonFinder; import com.gregtechceu.gtceu.api.addon.IGTAddon; import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.api.sound.SoundEntry; + import net.minecraftforge.fml.ModLoader; import net.minecraftforge.registries.ForgeRegistries; @@ -17,6 +17,7 @@ * @implNote GTSounds */ public class GTSoundEntries { + static { GTRegistries.SOUNDS.unfreeze(); } @@ -76,5 +77,4 @@ private static void registerSounds() { entry.register(soundEvent -> ForgeRegistries.SOUND_EVENTS.register(soundEvent.getLocation(), soundEvent)); } } - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTSoundTypes.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTSoundTypes.java index c4ecc88a3b..e8c50eb8a9 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTSoundTypes.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTSoundTypes.java @@ -4,6 +4,7 @@ import net.minecraft.world.level.block.SoundType; public class GTSoundTypes { - public static final SoundType METAL_PIPE = new SoundType(1.0f, 1.0f, GTSoundEntries.METAL_PIPE.getMainEvent(), SoundEvents.STONE_STEP, SoundEvents.STONE_PLACE, SoundEvents.STONE_HIT, SoundEvents.STONE_FALL); + public static final SoundType METAL_PIPE = new SoundType(1.0f, 1.0f, GTSoundEntries.METAL_PIPE.getMainEvent(), + SoundEvents.STONE_STEP, SoundEvents.STONE_PLACE, SoundEvents.STONE_HIT, SoundEvents.STONE_FALL); } diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTSyncedFieldAccessors.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTSyncedFieldAccessors.java index 989a3abe9d..bd5309388c 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTSyncedFieldAccessors.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTSyncedFieldAccessors.java @@ -2,6 +2,7 @@ import com.gregtechceu.gtceu.syncdata.GTRecipeAccessor; import com.gregtechceu.gtceu.syncdata.GTRecipeTypeAccessor; + import com.lowdragmc.lowdraglib.syncdata.IAccessor; import com.lowdragmc.lowdraglib.syncdata.payload.FriendlyBufPayload; @@ -13,6 +14,7 @@ * @implNote GTSyncedFieldAccessors */ public class GTSyncedFieldAccessors { + public static final IAccessor GT_RECIPE_ACCESSOR = new GTRecipeAccessor(); public static final IAccessor GT_RECIPE_TYPE_ACCESSOR = new GTRecipeTypeAccessor(); diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTToolTiers.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTToolTiers.java index e31bbb936c..7de377bf70 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTToolTiers.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTToolTiers.java @@ -4,6 +4,7 @@ import com.gregtechceu.gtceu.api.data.chemical.ChemicalHelper; import com.gregtechceu.gtceu.api.data.tag.TagPrefix; import com.gregtechceu.gtceu.data.recipe.CustomTags; + import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Tier; import net.minecraft.world.item.crafting.Ingredient; @@ -12,7 +13,7 @@ import java.util.List; -@SuppressWarnings({"unused", "FieldCanBeLocal"}) +@SuppressWarnings({ "unused", "FieldCanBeLocal" }) public class GTToolTiers { private static Tier DURANIUM; @@ -23,14 +24,16 @@ public static void init() { var duranium = GTCEu.id("duranium"); var neutronium = GTCEu.id("neutronium"); DURANIUM = TierSortingRegistry.registerTier( - new ForgeTier(5, 8193, 14.0F, 12.0F, 33, CustomTags.NEEDS_DURANIUM_TOOL, () -> Ingredient.of(ChemicalHelper.getTag(TagPrefix.ingot, GTMaterials.Duranium))), - duranium, - List.of(netherite), - List.of(neutronium)); + new ForgeTier(5, 8193, 14.0F, 12.0F, 33, CustomTags.NEEDS_DURANIUM_TOOL, + () -> Ingredient.of(ChemicalHelper.getTag(TagPrefix.ingot, GTMaterials.Duranium))), + duranium, + List.of(netherite), + List.of(neutronium)); NEUTRONIUM = TierSortingRegistry.registerTier( - new ForgeTier(6, 65536, 180.0F, 100.0F, 33, CustomTags.NEEDS_NEUTRONIUM_TOOL, () -> Ingredient.of(ChemicalHelper.getTag(TagPrefix.ingot, GTMaterials.Neutronium))), - neutronium, - List.of(duranium), - List.of()); + new ForgeTier(6, 65536, 180.0F, 100.0F, 33, CustomTags.NEEDS_NEUTRONIUM_TOOL, + () -> Ingredient.of(ChemicalHelper.getTag(TagPrefix.ingot, GTMaterials.Neutronium))), + neutronium, + List.of(duranium), + List.of()); } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTWorldgen.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTWorldgen.java index fb32775937..623d83b2a0 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTWorldgen.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTWorldgen.java @@ -21,9 +21,7 @@ public static void bootstrapDensityFunctions(BootstapContext ct Holder oreVeininess = noises.getOrThrow(Noises.ORE_VEININESS); ctx.register(ResourceKey.create(Registries.DENSITY_FUNCTION, NEW_ORE_VEIN_TOGGLE), DensityFunctions.interpolated( - DensityFunctions.noise(oreVeininess, 1.5f, 1.5f) - ) - ); + DensityFunctions.noise(oreVeininess, 1.5f, 1.5f))); Holder oreVeinA = noises.getOrThrow(Noises.ORE_VEIN_A); Holder oreVeinB = noises.getOrThrow(Noises.ORE_VEIN_B); @@ -32,13 +30,8 @@ public static void bootstrapDensityFunctions(BootstapContext ct DensityFunctions.constant(-0.08f), DensityFunctions.max( DensityFunctions.interpolated( - DensityFunctions.noise(oreVeinA, 4.0f, 4.0f) - ).abs(), + DensityFunctions.noise(oreVeinA, 4.0f, 4.0f)).abs(), DensityFunctions.interpolated( - DensityFunctions.noise(oreVeinB, 4.0f, 4.0f) - ).abs() - ) - ) - ); + DensityFunctions.noise(oreVeinB, 4.0f, 4.0f)).abs()))); } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/forge/GTBiomeModifiers.java b/src/main/java/com/gregtechceu/gtceu/common/data/forge/GTBiomeModifiers.java index 7a253f219b..5503404149 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/forge/GTBiomeModifiers.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/forge/GTBiomeModifiers.java @@ -3,6 +3,7 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.common.data.GTPlacements; import com.gregtechceu.gtceu.data.recipe.CustomTags; + import net.minecraft.core.*; import net.minecraft.core.registries.Registries; import net.minecraft.data.worldgen.BootstapContext; @@ -15,13 +16,14 @@ import net.minecraftforge.common.world.ForgeBiomeModifiers; import net.minecraftforge.registries.ForgeRegistries; -import java.util.concurrent.CompletableFuture; - public class GTBiomeModifiers { - public static final ResourceKey RUBBER = ResourceKey.create(ForgeRegistries.Keys.BIOME_MODIFIERS, GTCEu.id("rubber_tree")); - public static final ResourceKey STONE_BLOB = ResourceKey.create(ForgeRegistries.Keys.BIOME_MODIFIERS, GTCEu.id("stone_blob")); - public static final ResourceKey RAW_OIL_SPROUT = ResourceKey.create(ForgeRegistries.Keys.BIOME_MODIFIERS, GTCEu.id("raw_oil_sprout")); + public static final ResourceKey RUBBER = ResourceKey.create(ForgeRegistries.Keys.BIOME_MODIFIERS, + GTCEu.id("rubber_tree")); + public static final ResourceKey STONE_BLOB = ResourceKey.create(ForgeRegistries.Keys.BIOME_MODIFIERS, + GTCEu.id("stone_blob")); + public static final ResourceKey RAW_OIL_SPROUT = ResourceKey + .create(ForgeRegistries.Keys.BIOME_MODIFIERS, GTCEu.id("raw_oil_sprout")); public static void bootstrap(BootstapContext ctx) { HolderGetter biomeLookup = ctx.lookup(Registries.BIOME); @@ -32,23 +34,20 @@ public static void bootstrap(BootstapContext ctx) { ctx.register(RUBBER, new ForgeBiomeModifiers.AddFeaturesBiomeModifier( biomes, HolderSet.direct(rubberTree), - GenerationStep.Decoration.VEGETAL_DECORATION - )); + GenerationStep.Decoration.VEGETAL_DECORATION)); HolderSet overworld = biomeLookup.getOrThrow(BiomeTags.IS_OVERWORLD); Holder redGraniteBlob = placedFeatureRegistry.getOrThrow(GTPlacements.RED_GRANITE_BLOB); Holder marbleBlob = placedFeatureRegistry.getOrThrow(GTPlacements.MARBLE_BLOB); ctx.register(STONE_BLOB, new ForgeBiomeModifiers.AddFeaturesBiomeModifier( - overworld, - HolderSet.direct(redGraniteBlob, marbleBlob), - GenerationStep.Decoration.UNDERGROUND_ORES - )); + overworld, + HolderSet.direct(redGraniteBlob, marbleBlob), + GenerationStep.Decoration.UNDERGROUND_ORES)); Holder rawOilSprout = placedFeatureRegistry.getOrThrow(GTPlacements.RAW_OIL_SPROUT); ctx.register(RAW_OIL_SPROUT, new ForgeBiomeModifiers.AddFeaturesBiomeModifier( - overworld, - HolderSet.direct(rawOilSprout), - GenerationStep.Decoration.FLUID_SPRINGS - )); + overworld, + HolderSet.direct(rawOilSprout), + GenerationStep.Decoration.FLUID_SPRINGS)); } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/machines/GCyMMachines.java b/src/main/java/com/gregtechceu/gtceu/common/data/machines/GCyMMachines.java index e3a4edcd6c..249aeb4ec3 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/machines/GCyMMachines.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/machines/GCyMMachines.java @@ -21,6 +21,7 @@ import com.gregtechceu.gtceu.common.data.GTRecipeModifiers; import com.gregtechceu.gtceu.common.data.GTRecipeTypes; import com.gregtechceu.gtceu.common.machine.multiblock.part.ParallelHatchPartMachine; + import net.minecraft.core.Direction; import net.minecraft.network.chat.Component; import net.minecraft.world.level.block.Blocks; @@ -33,19 +34,20 @@ import static com.gregtechceu.gtceu.api.machine.multiblock.PartAbility.*; import static com.gregtechceu.gtceu.api.pattern.Predicates.*; import static com.gregtechceu.gtceu.api.pattern.util.RelativeDirection.*; -import static com.gregtechceu.gtceu.common.registry.GTRegistration.REGISTRATE; import static com.gregtechceu.gtceu.common.data.GCyMBlocks.*; import static com.gregtechceu.gtceu.common.data.GCyMRecipeTypes.ALLOY_BLAST_RECIPES; import static com.gregtechceu.gtceu.common.data.GTBlocks.*; import static com.gregtechceu.gtceu.common.data.GTMachines.*; import static com.gregtechceu.gtceu.common.data.GTMaterials.NaquadahAlloy; import static com.gregtechceu.gtceu.common.data.GTRecipeTypes.*; +import static com.gregtechceu.gtceu.common.registry.GTRegistration.REGISTRATE; /** * @author Rundas * @implNote Gregicality Multiblocks */ public class GCyMMachines { + public static void init() {} public static final MachineDefinition[] PARALLEL_HATCH = registerTieredMachines("parallel_hatch", @@ -61,25 +63,28 @@ public static void init() {} .rotationState(RotationState.ALL) .abilities(PartAbility.PARALLEL_HATCH) .workableTieredHullRenderer(GTCEu.id("block/machines/parallel_hatch_mk" + (tier - 4))) - .tooltips(Component.translatable("gtceu.machine.parallel_hatch_mk"+tier+".tooltip")) + .tooltips(Component.translatable("gtceu.machine.parallel_hatch_mk" + tier + ".tooltip")) .compassNode("parallel_hatch") .register(), IV, LuV, ZPM, UV); - public final static MultiblockMachineDefinition LARGE_MACERATION_TOWER = REGISTRATE.multiblock("large_maceration_tower", WorkableElectricMultiblockMachine::new) + public final static MultiblockMachineDefinition LARGE_MACERATION_TOWER = REGISTRATE + .multiblock("large_maceration_tower", WorkableElectricMultiblockMachine::new) .langValue("Large Maceration Tower") .tooltips(Component.translatable("gtceu.multiblock.parallelizable.tooltip")) - .tooltips(Component.translatable("gtceu.machine.available_recipe_map_1.tooltip", Component.translatable("gtceu.macerator"))) + .tooltips(Component.translatable("gtceu.machine.available_recipe_map_1.tooltip", + Component.translatable("gtceu.macerator"))) .rotationState(RotationState.NON_Y_AXIS) .recipeType(MACERATOR_RECIPES) - .recipeModifiers(GTRecipeModifiers.PARALLEL_HATCH, GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) + .recipeModifiers(GTRecipeModifiers.PARALLEL_HATCH, + GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) .appearanceBlock(CASING_SECURE_MACERATION) .pattern(definition -> FactoryBlockPattern.start() - .aisle("XXXXX", "XXXXX","XXXXX", "XXXXX") - .aisle("XXXXX", "XGGGX","XGGGX", "XAAAX") - .aisle("XXXXX", "XGGGX","XGGGX", "XAAAX") - .aisle("XXXXX", "XGGGX","XGGGX", "XAAAX") - .aisle("XXXXX", "XXXXX","XXSXX", "XXXXX") + .aisle("XXXXX", "XXXXX", "XXXXX", "XXXXX") + .aisle("XXXXX", "XGGGX", "XGGGX", "XAAAX") + .aisle("XXXXX", "XGGGX", "XGGGX", "XAAAX") + .aisle("XXXXX", "XGGGX", "XGGGX", "XAAAX") + .aisle("XXXXX", "XXXXX", "XXSXX", "XXXXX") .where('S', controller(blocks(definition.get()))) .where('X', blocks(CASING_SECURE_MACERATION.get()).setMinGlobalLimited(55) .or(Predicates.autoAbilities(definition.getRecipeTypes())) @@ -93,13 +98,16 @@ public static void init() {} .compassNodeSelf() .register(); - public final static MultiblockMachineDefinition LARGE_CHEMICAL_BATH = REGISTRATE.multiblock("large_chemical_bath", WorkableElectricMultiblockMachine::new) + public final static MultiblockMachineDefinition LARGE_CHEMICAL_BATH = REGISTRATE + .multiblock("large_chemical_bath", WorkableElectricMultiblockMachine::new) .langValue("Large Chemical Bath") .tooltips(Component.translatable("gtceu.multiblock.parallelizable.tooltip")) - .tooltips(Component.translatable("gtceu.machine.available_recipe_map_2.tooltip", Component.translatable("gtceu.ore_washer"), Component.translatable("gtceu.chemical_bath"))) + .tooltips(Component.translatable("gtceu.machine.available_recipe_map_2.tooltip", + Component.translatable("gtceu.ore_washer"), Component.translatable("gtceu.chemical_bath"))) .rotationState(RotationState.NON_Y_AXIS) .recipeTypes(CHEMICAL_BATH_RECIPES, ORE_WASHER_RECIPES) - .recipeModifiers(GTRecipeModifiers.PARALLEL_HATCH, GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) + .recipeModifiers(GTRecipeModifiers.PARALLEL_HATCH, + GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) .appearanceBlock(CASING_WATERTIGHT) .pattern(definition -> FactoryBlockPattern.start() .aisle("XXXXX", "XXXXX", "XXXXX") @@ -122,20 +130,23 @@ public static void init() {} .compassNodeSelf() .register(); - public final static MultiblockMachineDefinition LARGE_CENTRIFUGE = REGISTRATE.multiblock("large_centrifuge", WorkableElectricMultiblockMachine::new) + public final static MultiblockMachineDefinition LARGE_CENTRIFUGE = REGISTRATE + .multiblock("large_centrifuge", WorkableElectricMultiblockMachine::new) .langValue("Large Centrifugal Unit") .tooltips(Component.translatable("gtceu.multiblock.parallelizable.tooltip")) - .tooltips(Component.translatable("gtceu.machine.available_recipe_map_2.tooltip", Component.translatable("gtceu.centrifuge"), Component.translatable("gtceu.thermal_centrifuge"))) + .tooltips(Component.translatable("gtceu.machine.available_recipe_map_2.tooltip", + Component.translatable("gtceu.centrifuge"), Component.translatable("gtceu.thermal_centrifuge"))) .rotationState(RotationState.NON_Y_AXIS) .recipeTypes(CENTRIFUGE_RECIPES, THERMAL_CENTRIFUGE_RECIPES) - .recipeModifiers(GTRecipeModifiers.PARALLEL_HATCH, GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) + .recipeModifiers(GTRecipeModifiers.PARALLEL_HATCH, + GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) .appearanceBlock(CASING_VIBRATION_SAFE) .pattern(definition -> FactoryBlockPattern.start() - .aisle("#XXX#","XXXXX","#XXX#") - .aisle("XXXXX","XAPAX","XXXXX") - .aisle("XXXXX","XPAPX","XXXXX") - .aisle("XXXXX","XAPAX","XXXXX") - .aisle("#XXX#","XXSXX","#XXX#") + .aisle("#XXX#", "XXXXX", "#XXX#") + .aisle("XXXXX", "XAPAX", "XXXXX") + .aisle("XXXXX", "XPAPX", "XXXXX") + .aisle("XXXXX", "XAPAX", "XXXXX") + .aisle("#XXX#", "XXSXX", "#XXX#") .where('S', controller(blocks(definition.get()))) .where('X', blocks(CASING_VIBRATION_SAFE.get()).setMinGlobalLimited(40) .or(Predicates.autoAbilities(definition.getRecipeTypes())) @@ -150,20 +161,23 @@ public static void init() {} .compassNodeSelf() .register(); - public final static MultiblockMachineDefinition LARGE_MIXER = REGISTRATE.multiblock("large_mixer", WorkableElectricMultiblockMachine::new) + public final static MultiblockMachineDefinition LARGE_MIXER = REGISTRATE + .multiblock("large_mixer", WorkableElectricMultiblockMachine::new) .langValue("Large Mixing Vessel") .tooltips(Component.translatable("gtceu.multiblock.parallelizable.tooltip")) - .tooltips(Component.translatable("gtceu.machine.available_recipe_map_1.tooltip", Component.translatable("gtceu.mixer"))) + .tooltips(Component.translatable("gtceu.machine.available_recipe_map_1.tooltip", + Component.translatable("gtceu.mixer"))) .rotationState(RotationState.NON_Y_AXIS) .recipeType(MIXER_RECIPES) - .recipeModifiers(GTRecipeModifiers.PARALLEL_HATCH, GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) + .recipeModifiers(GTRecipeModifiers.PARALLEL_HATCH, + GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) .appearanceBlock(CASING_REACTION_SAFE) .pattern(definition -> FactoryBlockPattern.start() - .aisle("#XXX#","#XXX#","#XXX#","#XXX#","#XXX#","##F##") - .aisle("XXXXX","XAPAX","XAAAX","XAPAX","XAAAX","##F##") - .aisle("XXXXX","XPPPX","XAPAX","XPPPX","XAGAX","FFGFF") - .aisle("XXXXX","XAPAX","XAAAX","XAPAX","XAAAX","##F##") - .aisle("#XXX#","#XSX#","#XXX#","#XXX#","#XXX#","##F##") + .aisle("#XXX#", "#XXX#", "#XXX#", "#XXX#", "#XXX#", "##F##") + .aisle("XXXXX", "XAPAX", "XAAAX", "XAPAX", "XAAAX", "##F##") + .aisle("XXXXX", "XPPPX", "XAPAX", "XPPPX", "XAGAX", "FFGFF") + .aisle("XXXXX", "XAPAX", "XAAAX", "XAPAX", "XAAAX", "##F##") + .aisle("#XXX#", "#XSX#", "#XXX#", "#XXX#", "#XXX#", "##F##") .where('S', controller(blocks(definition.get()))) .where('X', blocks(CASING_REACTION_SAFE.get()).setMinGlobalLimited(50) .or(autoAbilities(definition.getRecipeTypes())) @@ -180,19 +194,22 @@ public static void init() {} .compassNodeSelf() .register(); - public final static MultiblockMachineDefinition LARGE_ELECTROLYZER = REGISTRATE.multiblock("large_electrolyzer", WorkableElectricMultiblockMachine::new) + public final static MultiblockMachineDefinition LARGE_ELECTROLYZER = REGISTRATE + .multiblock("large_electrolyzer", WorkableElectricMultiblockMachine::new) .langValue("Large Electrolysis Chamber") .tooltips(Component.translatable("gtceu.multiblock.parallelizable.tooltip")) - .tooltips(Component.translatable("gtceu.machine.available_recipe_map_1.tooltip", Component.translatable("gtceu.electrolyzer"))) + .tooltips(Component.translatable("gtceu.machine.available_recipe_map_1.tooltip", + Component.translatable("gtceu.electrolyzer"))) .rotationState(RotationState.NON_Y_AXIS) .recipeType(ELECTROLYZER_RECIPES) - .recipeModifiers(GTRecipeModifiers.PARALLEL_HATCH, GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) + .recipeModifiers(GTRecipeModifiers.PARALLEL_HATCH, + GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) .appearanceBlock(CASING_NONCONDUCTING) .pattern(definition -> FactoryBlockPattern.start() - .aisle("XXXXX","XXXXX","XXXXX") - .aisle("XXXXX","XCCCX","XCCCX") - .aisle("XXXXX","XCCCX","XCCCX") - .aisle("XXXXX","XXSXX","XXXXX") + .aisle("XXXXX", "XXXXX", "XXXXX") + .aisle("XXXXX", "XCCCX", "XCCCX") + .aisle("XXXXX", "XCCCX", "XCCCX") + .aisle("XXXXX", "XXSXX", "XXXXX") .where('S', controller(blocks(definition.get()))) .where('X', blocks(CASING_NONCONDUCTING.get()).setMinGlobalLimited(30) .or(Predicates.autoAbilities(definition.getRecipeTypes())) @@ -205,19 +222,23 @@ public static void init() {} .compassNodeSelf() .register(); - public final static MultiblockMachineDefinition LARGE_ELECTROMAGNET = REGISTRATE.multiblock("large_electromagnet", WorkableElectricMultiblockMachine::new) + public final static MultiblockMachineDefinition LARGE_ELECTROMAGNET = REGISTRATE + .multiblock("large_electromagnet", WorkableElectricMultiblockMachine::new) .langValue("Large Electromagnet") .tooltips(Component.translatable("gtceu.multiblock.parallelizable.tooltip")) - .tooltips(Component.translatable("gtceu.machine.available_recipe_map_2.tooltip", Component.translatable("gtceu.electromagnetic_separator"), Component.translatable("gtceu.polarizer"))) + .tooltips(Component.translatable("gtceu.machine.available_recipe_map_2.tooltip", + Component.translatable("gtceu.electromagnetic_separator"), + Component.translatable("gtceu.polarizer"))) .rotationState(RotationState.NON_Y_AXIS) .recipeTypes(ELECTROMAGNETIC_SEPARATOR_RECIPES, POLARIZER_RECIPES) - .recipeModifiers(GTRecipeModifiers.PARALLEL_HATCH, GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) + .recipeModifiers(GTRecipeModifiers.PARALLEL_HATCH, + GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) .appearanceBlock(CASING_NONCONDUCTING) .pattern(definition -> FactoryBlockPattern.start() - .aisle("XXXXX","XXXXX","XXXXX") - .aisle("XCXCX","XCXCX","XCXCX") - .aisle("XCXCX","XCXCX","XCXCX") - .aisle("XXXXX","XXSXX","XXXXX") + .aisle("XXXXX", "XXXXX", "XXXXX") + .aisle("XCXCX", "XCXCX", "XCXCX") + .aisle("XCXCX", "XCXCX", "XCXCX") + .aisle("XXXXX", "XXSXX", "XXXXX") .where('S', controller(blocks(definition.get()))) .where('X', blocks(CASING_NONCONDUCTING.get()).setMinGlobalLimited(35) .or(Predicates.autoAbilities(definition.getRecipeTypes())) @@ -230,21 +251,24 @@ public static void init() {} .compassNodeSelf() .register(); - public final static MultiblockMachineDefinition LARGE_PACKER = REGISTRATE.multiblock("large_packer", WorkableElectricMultiblockMachine::new) + public final static MultiblockMachineDefinition LARGE_PACKER = REGISTRATE + .multiblock("large_packer", WorkableElectricMultiblockMachine::new) .langValue("Large Packaging Machine") .tooltips(Component.translatable("gtceu.multiblock.parallelizable.tooltip")) - .tooltips(Component.translatable("gtceu.machine.available_recipe_map_1.tooltip", Component.translatable("gtceu.packer"))) + .tooltips(Component.translatable("gtceu.machine.available_recipe_map_1.tooltip", + Component.translatable("gtceu.packer"))) .rotationState(RotationState.NON_Y_AXIS) .recipeType(GTRecipeTypes.PACKER_RECIPES) - .recipeModifiers(GTRecipeModifiers.PARALLEL_HATCH, GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) + .recipeModifiers(GTRecipeModifiers.PARALLEL_HATCH, + GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) .appearanceBlock(CASING_TUNGSTENSTEEL_ROBUST) .pattern(definition -> FactoryBlockPattern.start() - .aisle("XXX","XXX","XXX") - .aisle("XXX","XAX","XXX") - .aisle("XXX","XAX","XXX") - .aisle("XXX","XAX","XXX") - .aisle("XXX","XAX","XXX") - .aisle("XXX","XSX","XXX") + .aisle("XXX", "XXX", "XXX") + .aisle("XXX", "XAX", "XXX") + .aisle("XXX", "XAX", "XXX") + .aisle("XXX", "XAX", "XXX") + .aisle("XXX", "XAX", "XXX") + .aisle("XXX", "XSX", "XXX") .where('S', controller(blocks(definition.get()))) .where('X', blocks(CASING_TUNGSTENSTEEL_ROBUST.get()).setMinGlobalLimited(30) .or(Predicates.autoAbilities(definition.getRecipeTypes())) @@ -257,21 +281,25 @@ public static void init() {} .compassNodeSelf() .register(); - public final static MultiblockMachineDefinition LARGE_ASSEMBLER = REGISTRATE.multiblock("large_assembler", WorkableElectricMultiblockMachine::new) + public final static MultiblockMachineDefinition LARGE_ASSEMBLER = REGISTRATE + .multiblock("large_assembler", WorkableElectricMultiblockMachine::new) .langValue("Large Assembling Factory") .tooltips(Component.translatable("gtceu.multiblock.parallelizable.tooltip")) - .tooltips(Component.translatable("gtceu.machine.available_recipe_map_1.tooltip", Component.translatable("gtceu.assembler"))) + .tooltips(Component.translatable("gtceu.machine.available_recipe_map_1.tooltip", + Component.translatable("gtceu.assembler"))) .rotationState(RotationState.NON_Y_AXIS) .recipeType(ASSEMBLER_RECIPES) - .recipeModifiers(GTRecipeModifiers.PARALLEL_HATCH, GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) + .recipeModifiers(GTRecipeModifiers.PARALLEL_HATCH, + GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) .appearanceBlock(CASING_LARGE_SCALE_ASSEMBLING) .pattern(definition -> FactoryBlockPattern.start() - .aisle("XXXXXXXXX","XXXXXXXXX","XXXXXXXXX") - .aisle("XXXXXXXXX","XAAAXAAAX","XGGGXXXXX") - .aisle("XXXXXXXXX","XGGGXXSXX","XGGGX###X") + .aisle("XXXXXXXXX", "XXXXXXXXX", "XXXXXXXXX") + .aisle("XXXXXXXXX", "XAAAXAAAX", "XGGGXXXXX") + .aisle("XXXXXXXXX", "XGGGXXSXX", "XGGGX###X") .where('S', controller(blocks(definition.get()))) .where('X', blocks(CASING_LARGE_SCALE_ASSEMBLING.get()).setMinGlobalLimited(40) - .or(Predicates.autoAbilities(definition.getRecipeTypes(), false, false, true, true, true, true)) + .or(Predicates.autoAbilities(definition.getRecipeTypes(), false, false, true, true, true, + true)) .or(Predicates.abilities(INPUT_ENERGY).setExactLimit(1)) .or(Predicates.autoAbilities(true, false, true))) .where('G', Predicates.blocks(CASING_TEMPERED_GLASS.get())) @@ -284,23 +312,27 @@ public static void init() {} .compassNodeSelf() .register(); - public final static MultiblockMachineDefinition LARGE_CIRCUIT_ASSEMBLER = REGISTRATE.multiblock("large_circuit_assembler", WorkableElectricMultiblockMachine::new) + public final static MultiblockMachineDefinition LARGE_CIRCUIT_ASSEMBLER = REGISTRATE + .multiblock("large_circuit_assembler", WorkableElectricMultiblockMachine::new) .langValue("Large Circuit Assembling Facility") .tooltips(Component.translatable("gtceu.multiblock.parallelizable.tooltip")) - .tooltips(Component.translatable("gtceu.machine.available_recipe_map_1.tooltip", Component.translatable("gtceu.circuit_assembler"))) + .tooltips(Component.translatable("gtceu.machine.available_recipe_map_1.tooltip", + Component.translatable("gtceu.circuit_assembler"))) .rotationState(RotationState.NON_Y_AXIS) .recipeType(CIRCUIT_ASSEMBLER_RECIPES) - .recipeModifiers(GTRecipeModifiers.PARALLEL_HATCH, GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) + .recipeModifiers(GTRecipeModifiers.PARALLEL_HATCH, + GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) .appearanceBlock(CASING_LARGE_SCALE_ASSEMBLING) .pattern(definition -> FactoryBlockPattern.start() - .aisle("XXXXXXX","XXXXXXX","XXXXXXX") - .aisle("XXXXXXX","XPPPPPX","XGGGGGX") - .aisle("XXXXXXX","XAAAAPX","XGGGGGX") - .aisle("XXXXXXX","XTTTTXX","XXXXXXX") - .aisle("#####XX","#####SX","#####XX") + .aisle("XXXXXXX", "XXXXXXX", "XXXXXXX") + .aisle("XXXXXXX", "XPPPPPX", "XGGGGGX") + .aisle("XXXXXXX", "XAAAAPX", "XGGGGGX") + .aisle("XXXXXXX", "XTTTTXX", "XXXXXXX") + .aisle("#####XX", "#####SX", "#####XX") .where('S', controller(blocks(definition.get()))) .where('X', blocks(CASING_LARGE_SCALE_ASSEMBLING.get()).setMinGlobalLimited(55) - .or(Predicates.autoAbilities(definition.getRecipeTypes(), false, false, true, true, true, true)) + .or(Predicates.autoAbilities(definition.getRecipeTypes(), false, false, true, true, true, + true)) .or(Predicates.abilities(INPUT_ENERGY).setExactLimit(1)) .or(Predicates.autoAbilities(true, false, true))) .where('T', Predicates.blocks(CASING_TEMPERED_GLASS.get())) @@ -315,20 +347,23 @@ public static void init() {} .compassNodeSelf() .register(); - public final static MultiblockMachineDefinition LARGE_ARC_SMELTER = REGISTRATE.multiblock("large_arc_smelter", WorkableElectricMultiblockMachine::new) + public final static MultiblockMachineDefinition LARGE_ARC_SMELTER = REGISTRATE + .multiblock("large_arc_smelter", WorkableElectricMultiblockMachine::new) .langValue("Large Arc Smelter") .tooltips(Component.translatable("gtceu.multiblock.parallelizable.tooltip")) - .tooltips(Component.translatable("gtceu.machine.available_recipe_map_1.tooltip", Component.translatable("gtceu.arc_furnace"))) + .tooltips(Component.translatable("gtceu.machine.available_recipe_map_1.tooltip", + Component.translatable("gtceu.arc_furnace"))) .rotationState(RotationState.NON_Y_AXIS) .recipeType(ARC_FURNACE_RECIPES) - .recipeModifiers(GTRecipeModifiers.PARALLEL_HATCH, GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) + .recipeModifiers(GTRecipeModifiers.PARALLEL_HATCH, + GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) .appearanceBlock(CASING_HIGH_TEMPERATURE_SMELTING) .pattern(definition -> FactoryBlockPattern.start() - .aisle("#XXX#","#XXX#","#XXX#","#XXX#") - .aisle("XXXXX","XCACX","XCACX","XXXXX") - .aisle("XXXXX","XAAAX","XAAAX","XXMXX") - .aisle("XXXXX","XACAX","XACAX","XXXXX") - .aisle("#XXX#","#XSX#","#XXX#","#XXX#") + .aisle("#XXX#", "#XXX#", "#XXX#", "#XXX#") + .aisle("XXXXX", "XCACX", "XCACX", "XXXXX") + .aisle("XXXXX", "XAAAX", "XAAAX", "XXMXX") + .aisle("XXXXX", "XACAX", "XACAX", "XXXXX") + .aisle("#XXX#", "#XSX#", "#XXX#", "#XXX#") .where('S', controller(blocks(definition.get()))) .where('X', blocks(CASING_HIGH_TEMPERATURE_SMELTING.get()).setMinGlobalLimited(45) .or(Predicates.autoAbilities(definition.getRecipeTypes())) @@ -344,20 +379,23 @@ public static void init() {} .compassNodeSelf() .register(); - public final static MultiblockMachineDefinition LARGE_ENGRAVING_LASER = REGISTRATE.multiblock("large_engraving_laser", WorkableElectricMultiblockMachine::new) + public final static MultiblockMachineDefinition LARGE_ENGRAVING_LASER = REGISTRATE + .multiblock("large_engraving_laser", WorkableElectricMultiblockMachine::new) .langValue("Large Engraving Laser") .tooltips(Component.translatable("gtceu.multiblock.parallelizable.tooltip")) - .tooltips(Component.translatable("gtceu.machine.available_recipe_map_1.tooltip", Component.translatable("gtceu.laser_engraver"))) + .tooltips(Component.translatable("gtceu.machine.available_recipe_map_1.tooltip", + Component.translatable("gtceu.laser_engraver"))) .rotationState(RotationState.NON_Y_AXIS) .recipeType(LASER_ENGRAVER_RECIPES) - .recipeModifiers(GTRecipeModifiers.PARALLEL_HATCH, GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) + .recipeModifiers(GTRecipeModifiers.PARALLEL_HATCH, + GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) .appearanceBlock(CASING_LASER_SAFE_ENGRAVING) .pattern(definition -> FactoryBlockPattern.start() - .aisle("XXXXX","XXGXX","XXGXX","XXXXX") - .aisle("XXXXX","XAAAX","XAAAX","XKKKX") - .aisle("XXXXX","GAAAG","GACAG","XKXKX") - .aisle("XXXXX","XAAAX","XAAAX","XKKKX") - .aisle("XXSXX","XXGXX","XXGXX","XXXXX") + .aisle("XXXXX", "XXGXX", "XXGXX", "XXXXX") + .aisle("XXXXX", "XAAAX", "XAAAX", "XKKKX") + .aisle("XXXXX", "GAAAG", "GACAG", "XKXKX") + .aisle("XXXXX", "XAAAX", "XAAAX", "XKKKX") + .aisle("XXSXX", "XXGXX", "XXGXX", "XXXXX") .where('S', controller(blocks(definition.get()))) .where('C', blocks(CASING_TUNGSTENSTEEL_PIPE.get())) .where('X', blocks(CASING_LASER_SAFE_ENGRAVING.get()).setMinGlobalLimited(50) @@ -373,20 +411,23 @@ public static void init() {} .compassNodeSelf() .register(); - public final static MultiblockMachineDefinition LARGE_SIFTING_FUNNEL = REGISTRATE.multiblock("large_sifting_funnel", WorkableElectricMultiblockMachine::new) + public final static MultiblockMachineDefinition LARGE_SIFTING_FUNNEL = REGISTRATE + .multiblock("large_sifting_funnel", WorkableElectricMultiblockMachine::new) .langValue("Large Sifting Funnel") .tooltips(Component.translatable("gtceu.multiblock.parallelizable.tooltip")) - .tooltips(Component.translatable("gtceu.machine.available_recipe_map_1.tooltip", Component.translatable("gtceu.sifter"))) + .tooltips(Component.translatable("gtceu.machine.available_recipe_map_1.tooltip", + Component.translatable("gtceu.sifter"))) .rotationState(RotationState.NON_Y_AXIS) .recipeType(SIFTER_RECIPES) - .recipeModifiers(GTRecipeModifiers.PARALLEL_HATCH, GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) + .recipeModifiers(GTRecipeModifiers.PARALLEL_HATCH, + GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) .appearanceBlock(CASING_VIBRATION_SAFE) .pattern(definition -> FactoryBlockPattern.start() - .aisle("#X#X#","#X#X#","#XXX#","XXXXX","#XXX#") - .aisle("XXXXX","XAXAX","XKKKX","XKKKX","X###X") - .aisle("#XXX#","#XAX#","XKKKX","XKKKX","X###X") - .aisle("XXXXX","XAXAX","XKKKX","XKKKX","X###X") - .aisle("#X#X#","#X#X#","#XSX#","XXXXX","#XXX#") + .aisle("#X#X#", "#X#X#", "#XXX#", "XXXXX", "#XXX#") + .aisle("XXXXX", "XAXAX", "XKKKX", "XKKKX", "X###X") + .aisle("#XXX#", "#XAX#", "XKKKX", "XKKKX", "X###X") + .aisle("XXXXX", "XAXAX", "XKKKX", "XKKKX", "X###X") + .aisle("#X#X#", "#X#X#", "#XSX#", "XXXXX", "#XXX#") .where('S', controller(blocks(definition.get()))) .where('X', blocks(CASING_VIBRATION_SAFE.get()).setMinGlobalLimited(50) .or(Predicates.autoAbilities(definition.getRecipeTypes())) @@ -401,9 +442,11 @@ public static void init() {} .compassNodeSelf() .register(); - public final static MultiblockMachineDefinition BLAST_ALLOY_SMELTER = REGISTRATE.multiblock("alloy_blast_smelter", CoilWorkableElectricMultiblockMachine::new) + public final static MultiblockMachineDefinition BLAST_ALLOY_SMELTER = REGISTRATE + .multiblock("alloy_blast_smelter", CoilWorkableElectricMultiblockMachine::new) .langValue("Alloy Blast Smelter") - .tooltips(Component.translatable("gtceu.machine.available_recipe_map_1.tooltip", Component.translatable("gtceu.alloy_blast_smelter"))) + .tooltips(Component.translatable("gtceu.machine.available_recipe_map_1.tooltip", + Component.translatable("gtceu.alloy_blast_smelter"))) .rotationState(RotationState.NON_Y_AXIS) .recipeType(ALLOY_BLAST_RECIPES) .recipeModifier(GTRecipeModifiers::ebfOverclock) @@ -427,24 +470,25 @@ public static void init() {} .shapeInfos(definition -> { List shapeInfo = new ArrayList<>(); var builder = MultiblockShapeInfo.builder() - .aisle("#XSX#", "#CCC#", "#GGG#", "#CCC#", "#XMX#") - .aisle("IXXXX", "CAAAC", "GAAAG", "CAAAC", "XXXXX") - .aisle("XXXXD", "CAAAC", "GAAAG", "CAAAC", "XXHXX") - .aisle("FXXXX", "CAAAC", "GAAAG", "CAAAC", "XXXXX") - .aisle("#EXE#", "#CCC#", "#GGG#", "#CCC#", "#XXX#") - .where('X', CASING_HIGH_TEMPERATURE_SMELTING.getDefaultState()) - .where('S', definition, Direction.NORTH) - .where('G', HEAT_VENT.getDefaultState()) - .where('A', Blocks.AIR.defaultBlockState()) - .where('E', ENERGY_INPUT_HATCH[GTValues.LV], Direction.SOUTH) - .where('I', ITEM_IMPORT_BUS[GTValues.LV], Direction.WEST) - .where('F', FLUID_IMPORT_HATCH[GTValues.LV], Direction.WEST) - .where('D', FLUID_EXPORT_HATCH[GTValues.LV], Direction.EAST) - .where('H', MUFFLER_HATCH[GTValues.LV], Direction.UP) - .where('M', MAINTENANCE_HATCH, Direction.NORTH); + .aisle("#XSX#", "#CCC#", "#GGG#", "#CCC#", "#XMX#") + .aisle("IXXXX", "CAAAC", "GAAAG", "CAAAC", "XXXXX") + .aisle("XXXXD", "CAAAC", "GAAAG", "CAAAC", "XXHXX") + .aisle("FXXXX", "CAAAC", "GAAAG", "CAAAC", "XXXXX") + .aisle("#EXE#", "#CCC#", "#GGG#", "#CCC#", "#XXX#") + .where('X', CASING_HIGH_TEMPERATURE_SMELTING.getDefaultState()) + .where('S', definition, Direction.NORTH) + .where('G', HEAT_VENT.getDefaultState()) + .where('A', Blocks.AIR.defaultBlockState()) + .where('E', ENERGY_INPUT_HATCH[GTValues.LV], Direction.SOUTH) + .where('I', ITEM_IMPORT_BUS[GTValues.LV], Direction.WEST) + .where('F', FLUID_IMPORT_HATCH[GTValues.LV], Direction.WEST) + .where('D', FLUID_EXPORT_HATCH[GTValues.LV], Direction.EAST) + .where('H', MUFFLER_HATCH[GTValues.LV], Direction.UP) + .where('M', MAINTENANCE_HATCH, Direction.NORTH); GTCEuAPI.HEATING_COILS.entrySet().stream() .sorted(Comparator.comparingInt(entry -> entry.getKey().getTier())) - .forEach(coil -> shapeInfo.add(builder.shallowCopy().where('C', coil.getValue().get()).build())); + .forEach( + coil -> shapeInfo.add(builder.shallowCopy().where('C', coil.getValue().get()).build())); return shapeInfo; }) .workableCasingRenderer(GTCEu.id("block/casings/gcym/high_temperature_smelting_casing"), @@ -453,13 +497,16 @@ public static void init() {} .compassNodeSelf() .register(); - public final static MultiblockMachineDefinition LARGE_AUTOCLAVE = REGISTRATE.multiblock("large_autoclave", WorkableElectricMultiblockMachine::new) + public final static MultiblockMachineDefinition LARGE_AUTOCLAVE = REGISTRATE + .multiblock("large_autoclave", WorkableElectricMultiblockMachine::new) .langValue("Large Crystallization Chamber") .tooltips(Component.translatable("gtceu.multiblock.parallelizable.tooltip")) - .tooltips(Component.translatable("gtceu.machine.available_recipe_map_1.tooltip", Component.translatable("gtceu.autoclave"))) + .tooltips(Component.translatable("gtceu.machine.available_recipe_map_1.tooltip", + Component.translatable("gtceu.autoclave"))) .rotationState(RotationState.NON_Y_AXIS) .recipeType(AUTOCLAVE_RECIPES) - .recipeModifiers(GTRecipeModifiers.PARALLEL_HATCH, GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) + .recipeModifiers(GTRecipeModifiers.PARALLEL_HATCH, + GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) .appearanceBlock(CASING_WATERTIGHT) .pattern(definition -> FactoryBlockPattern.start() .aisle("XXX", "XXX", "XXX") @@ -480,13 +527,17 @@ public static void init() {} .compassNodeSelf() .register(); - public final static MultiblockMachineDefinition LARGE_MATERIAL_PRESS = REGISTRATE.multiblock("large_material_press", WorkableElectricMultiblockMachine::new) + public final static MultiblockMachineDefinition LARGE_MATERIAL_PRESS = REGISTRATE + .multiblock("large_material_press", WorkableElectricMultiblockMachine::new) .langValue("Large Material Press") .tooltips(Component.translatable("gtceu.multiblock.parallelizable.tooltip")) - .tooltips(Component.translatable("gtceu.machine.available_recipe_map_4.tooltip", Component.translatable("gtceu.bender"), Component.translatable("gtceu.compressor"), Component.translatable("gtceu.forge_hammer"), Component.translatable("gtceu.forming_press"))) + .tooltips(Component.translatable("gtceu.machine.available_recipe_map_4.tooltip", + Component.translatable("gtceu.bender"), Component.translatable("gtceu.compressor"), + Component.translatable("gtceu.forge_hammer"), Component.translatable("gtceu.forming_press"))) .rotationState(RotationState.NON_Y_AXIS) .recipeTypes(BENDER_RECIPES, COMPRESSOR_RECIPES, FORGE_HAMMER_RECIPES, FORMING_PRESS_RECIPES) - .recipeModifiers(GTRecipeModifiers.PARALLEL_HATCH, GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) + .recipeModifiers(GTRecipeModifiers.PARALLEL_HATCH, + GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) .appearanceBlock(CASING_STRESS_PROOF) .pattern(definition -> FactoryBlockPattern.start() .aisle("XXXXXXX", "XXXXXXX", "XXXXXXX") @@ -506,13 +557,17 @@ public static void init() {} .compassNodeSelf() .register(); - public final static MultiblockMachineDefinition LARGE_BREWER = REGISTRATE.multiblock("large_brewer", WorkableElectricMultiblockMachine::new) + public final static MultiblockMachineDefinition LARGE_BREWER = REGISTRATE + .multiblock("large_brewer", WorkableElectricMultiblockMachine::new) .langValue("Large Brewing Vat") .tooltips(Component.translatable("gtceu.multiblock.parallelizable.tooltip")) - .tooltips(Component.translatable("gtceu.machine.available_recipe_map_3.tooltip", Component.translatable("gtceu.brewery"), Component.translatable("gtceu.fermenter"), Component.translatable("gtceu.fluid_heater"))) + .tooltips(Component.translatable("gtceu.machine.available_recipe_map_3.tooltip", + Component.translatable("gtceu.brewery"), Component.translatable("gtceu.fermenter"), + Component.translatable("gtceu.fluid_heater"))) .rotationState(RotationState.NON_Y_AXIS) .recipeTypes(BREWING_RECIPES, FERMENTING_RECIPES, FLUID_HEATER_RECIPES) - .recipeModifiers(GTRecipeModifiers.PARALLEL_HATCH, GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) + .recipeModifiers(GTRecipeModifiers.PARALLEL_HATCH, + GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) .appearanceBlock(CASING_CORROSION_PROOF) .pattern(definition -> FactoryBlockPattern.start() .aisle("#XXX#", "#XXX#", "#XXX#", "#XXX#", "#####") @@ -536,19 +591,22 @@ public static void init() {} .compassNodeSelf() .register(); - public final static MultiblockMachineDefinition LARGE_CUTTER = REGISTRATE.multiblock("large_cutter", WorkableElectricMultiblockMachine::new) + public final static MultiblockMachineDefinition LARGE_CUTTER = REGISTRATE + .multiblock("large_cutter", WorkableElectricMultiblockMachine::new) .langValue("Large Cutting Saw") .tooltips(Component.translatable("gtceu.multiblock.parallelizable.tooltip")) - .tooltips(Component.translatable("gtceu.machine.available_recipe_map_2.tooltip", Component.translatable("gtceu.cutter"), Component.translatable("gtceu.lathe"))) + .tooltips(Component.translatable("gtceu.machine.available_recipe_map_2.tooltip", + Component.translatable("gtceu.cutter"), Component.translatable("gtceu.lathe"))) .rotationState(RotationState.NON_Y_AXIS) .recipeTypes(CUTTER_RECIPES, LATHE_RECIPES) - .recipeModifiers(GTRecipeModifiers.PARALLEL_HATCH, GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) + .recipeModifiers(GTRecipeModifiers.PARALLEL_HATCH, + GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) .appearanceBlock(CASING_SHOCK_PROOF) .pattern(definition -> FactoryBlockPattern.start() - .aisle("XXXXXXX","XXXXXXX","XXXXXXX","##XXXXX") - .aisle("XXXXXXX","XAXCCCX","XXXAAAX","##XXXXX") - .aisle("XXXXXXX","XAXCCCX","XXXAAAX","##XXXXX") - .aisle("XXXXXXX","XSXGGGX","XXXGGGX","##XXXXX") + .aisle("XXXXXXX", "XXXXXXX", "XXXXXXX", "##XXXXX") + .aisle("XXXXXXX", "XAXCCCX", "XXXAAAX", "##XXXXX") + .aisle("XXXXXXX", "XAXCCCX", "XXXAAAX", "##XXXXX") + .aisle("XXXXXXX", "XSXGGGX", "XXXGGGX", "##XXXXX") .where('S', controller(blocks(definition.get()))) .where('X', blocks(CASING_SHOCK_PROOF.get()).setMinGlobalLimited(65) .or(autoAbilities(definition.getRecipeTypes())) @@ -564,13 +622,16 @@ public static void init() {} .compassNodeSelf() .register(); - public final static MultiblockMachineDefinition LARGE_DISTILLERY = REGISTRATE.multiblock("large_distillery", WorkableElectricMultiblockMachine::new) + public final static MultiblockMachineDefinition LARGE_DISTILLERY = REGISTRATE + .multiblock("large_distillery", WorkableElectricMultiblockMachine::new) .langValue("Large Fractionating Distillery") .tooltips(Component.translatable("gtceu.multiblock.parallelizable.tooltip")) - .tooltips(Component.translatable("gtceu.machine.available_recipe_map_2.tooltip", Component.translatable("gtceu.distillation_tower"), Component.translatable("gtceu.distillery"))) + .tooltips(Component.translatable("gtceu.machine.available_recipe_map_2.tooltip", + Component.translatable("gtceu.distillation_tower"), Component.translatable("gtceu.distillery"))) .rotationState(RotationState.NON_Y_AXIS) .recipeTypes(DISTILLATION_RECIPES, DISTILLERY_RECIPES) - .recipeModifiers(GTRecipeModifiers.PARALLEL_HATCH, GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) + .recipeModifiers(GTRecipeModifiers.PARALLEL_HATCH, + GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) .appearanceBlock(CASING_WATERTIGHT) .pattern(definition -> { TraceabilityPredicate casingPredicate = blocks(CASING_WATERTIGHT.get()).setMinGlobalLimited(40); @@ -602,18 +663,21 @@ public static void init() {} .compassNodeSelf() .register(); - public final static MultiblockMachineDefinition LARGE_EXTRACTOR = REGISTRATE.multiblock("large_extractor", WorkableElectricMultiblockMachine::new) + public final static MultiblockMachineDefinition LARGE_EXTRACTOR = REGISTRATE + .multiblock("large_extractor", WorkableElectricMultiblockMachine::new) .langValue("Large Extraction Machine") .tooltips(Component.translatable("gtceu.multiblock.parallelizable.tooltip")) - .tooltips(Component.translatable("gtceu.machine.available_recipe_map_2.tooltip", Component.translatable("gtceu.extractor"), Component.translatable("gtceu.canner"))) + .tooltips(Component.translatable("gtceu.machine.available_recipe_map_2.tooltip", + Component.translatable("gtceu.extractor"), Component.translatable("gtceu.canner"))) .rotationState(RotationState.NON_Y_AXIS) .recipeTypes(EXTRACTOR_RECIPES, CANNER_RECIPES) - .recipeModifiers(GTRecipeModifiers.PARALLEL_HATCH, GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) + .recipeModifiers(GTRecipeModifiers.PARALLEL_HATCH, + GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) .appearanceBlock(CASING_WATERTIGHT) .pattern(definition -> FactoryBlockPattern.start() - .aisle("XXXXX","XXXXX","XXXXX") - .aisle("XXXXX","XCACX","XXXXX") - .aisle("XXXXX","XXSXX","XXXXX") + .aisle("XXXXX", "XXXXX", "XXXXX") + .aisle("XXXXX", "XCACX", "XXXXX") + .aisle("XXXXX", "XXSXX", "XXXXX") .where('S', controller(blocks(definition.get()))) .where('X', blocks(CASING_WATERTIGHT.get()).setMinGlobalLimited(25) .or(autoAbilities(definition.getRecipeTypes())) @@ -627,13 +691,16 @@ public static void init() {} .compassNodeSelf() .register(); - public final static MultiblockMachineDefinition LARGE_EXTRUDER = REGISTRATE.multiblock("large_extruder", WorkableElectricMultiblockMachine::new) + public final static MultiblockMachineDefinition LARGE_EXTRUDER = REGISTRATE + .multiblock("large_extruder", WorkableElectricMultiblockMachine::new) .langValue("Large Extrusion Machine") .tooltips(Component.translatable("gtceu.multiblock.parallelizable.tooltip")) - .tooltips(Component.translatable("gtceu.machine.available_recipe_map_1.tooltip", Component.translatable("gtceu.extruder"))) + .tooltips(Component.translatable("gtceu.machine.available_recipe_map_1.tooltip", + Component.translatable("gtceu.extruder"))) .rotationState(RotationState.NON_Y_AXIS) .recipeType(EXTRUDER_RECIPES) - .recipeModifiers(GTRecipeModifiers.PARALLEL_HATCH, GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) + .recipeModifiers(GTRecipeModifiers.PARALLEL_HATCH, + GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) .appearanceBlock(CASING_STRESS_PROOF) .pattern(definition -> FactoryBlockPattern.start() .aisle("##XXX", "##XXX", "##XXX") @@ -656,20 +723,23 @@ public static void init() {} .compassNodeSelf() .register(); - public final static MultiblockMachineDefinition LARGE_SOLIDIFIER = REGISTRATE.multiblock("large_solidifier", WorkableElectricMultiblockMachine::new) + public final static MultiblockMachineDefinition LARGE_SOLIDIFIER = REGISTRATE + .multiblock("large_solidifier", WorkableElectricMultiblockMachine::new) .langValue("Large Solidification Array") .tooltips(Component.translatable("gtceu.multiblock.parallelizable.tooltip")) - .tooltips(Component.translatable("gtceu.machine.available_recipe_map_1.tooltip", Component.translatable("gtceu.fluid_solidifier"))) + .tooltips(Component.translatable("gtceu.machine.available_recipe_map_1.tooltip", + Component.translatable("gtceu.fluid_solidifier"))) .rotationState(RotationState.NON_Y_AXIS) .recipeType(FLUID_SOLIDFICATION_RECIPES) - .recipeModifiers(GTRecipeModifiers.PARALLEL_HATCH, GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) + .recipeModifiers(GTRecipeModifiers.PARALLEL_HATCH, + GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) .appearanceBlock(CASING_WATERTIGHT) .pattern(definition -> FactoryBlockPattern.start() - .aisle("#XXX#","#XXX#","#XXX#","#XXX#") - .aisle("XXXXX","XCACX","XCACX","XXXXX") - .aisle("XXXXX","XAAAX","XAAAX","XXXXX") - .aisle("XXXXX","XCACX","XCACX","XXXXX") - .aisle("#XXX#","#XSX#","#XXX#","#XXX#") + .aisle("#XXX#", "#XXX#", "#XXX#", "#XXX#") + .aisle("XXXXX", "XCACX", "XCACX", "XXXXX") + .aisle("XXXXX", "XAAAX", "XAAAX", "XXXXX") + .aisle("XXXXX", "XCACX", "XCACX", "XXXXX") + .aisle("#XXX#", "#XSX#", "#XXX#", "#XXX#") .where('S', controller(blocks(definition.get()))) .where('X', blocks(CASING_WATERTIGHT.get()).setMinGlobalLimited(45) .or(autoAbilities(definition.getRecipeTypes())) @@ -684,13 +754,16 @@ public static void init() {} .compassNodeSelf() .register(); - public final static MultiblockMachineDefinition LARGE_WIREMILL = REGISTRATE.multiblock("large_wiremill", WorkableElectricMultiblockMachine::new) + public final static MultiblockMachineDefinition LARGE_WIREMILL = REGISTRATE + .multiblock("large_wiremill", WorkableElectricMultiblockMachine::new) .langValue("Large Wire Factory") .tooltips(Component.translatable("gtceu.multiblock.parallelizable.tooltip")) - .tooltips(Component.translatable("gtceu.machine.available_recipe_map_1.tooltip", Component.translatable("gtceu.wiremill"))) + .tooltips(Component.translatable("gtceu.machine.available_recipe_map_1.tooltip", + Component.translatable("gtceu.wiremill"))) .rotationState(RotationState.NON_Y_AXIS) .recipeType(WIREMILL_RECIPES) - .recipeModifiers(GTRecipeModifiers.PARALLEL_HATCH, GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) + .recipeModifiers(GTRecipeModifiers.PARALLEL_HATCH, + GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) .appearanceBlock(CASING_STRESS_PROOF) .pattern(definition -> FactoryBlockPattern.start() .aisle("XXXXX", "XXXXX", "XXX##") @@ -709,10 +782,12 @@ public static void init() {} .compassNodeSelf() .register(); - public final static MultiblockMachineDefinition MEGA_BLAST_FURNACE = REGISTRATE.multiblock("mega_blast_furnace", CoilWorkableElectricMultiblockMachine::new) + public final static MultiblockMachineDefinition MEGA_BLAST_FURNACE = REGISTRATE + .multiblock("mega_blast_furnace", CoilWorkableElectricMultiblockMachine::new) .langValue("Rotary Hearth Furnace") .tooltips(Component.translatable("gtceu.multiblock.parallelizable.tooltip")) - .tooltips(Component.translatable("gtceu.machine.available_recipe_map_1.tooltip", Component.translatable("gtceu.electric_blast_furnace"))) + .tooltips(Component.translatable("gtceu.machine.available_recipe_map_1.tooltip", + Component.translatable("gtceu.electric_blast_furnace"))) .rotationState(RotationState.NON_Y_AXIS) .recipeType(BLAST_RECIPES) .recipeModifiers(GTRecipeModifiers.PARALLEL_HATCH, GTRecipeModifiers::ebfOverclock) @@ -720,19 +795,58 @@ public static void init() {} .pattern(definition -> { TraceabilityPredicate casing = blocks(CASING_HIGH_TEMPERATURE_SMELTING.get()).setMinGlobalLimited(360); return FactoryBlockPattern.start() - .aisle("##XXXXXXXXX##", "##XXXXXXXXX##", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############") - .aisle("#XXXXXXXXXXX#", "#XXXXXXXXXXX#", "###F#####F###", "###F#####F###", "###FFFFFFF###", "#############", "#############", "#############", "#############", "#############", "####FFFFF####", "#############", "#############", "#############", "#############", "#############", "#############") - .aisle("XXXXXXXXXXXXX", "XXXXVVVVVXXXX", "##F#######F##", "##F#######F##", "##FFFHHHFFF##", "##F#######F##", "##F#######F##", "##F#######F##", "##F#######F##", "##F#######F##", "##FFFHHHFFF##", "#############", "#############", "#############", "#############", "#############", "###TTTTTTT###") - .aisle("XXXXXXXXXXXXX", "XXXXXXXXXXXXX", "#F####P####F#", "#F####P####F#", "#FFHHHPHHHFF#", "######P######", "######P######", "######P######", "######P######", "######P######", "##FHHHPHHHF##", "######P######", "######P######", "######P######", "######P######", "######P######", "##TTTTPTTTT##") - .aisle("XXXXXXXXXXXXX", "XXVXXXXXXXVXX", "####BBPBB####", "####TITIT####", "#FFHHHHHHHFF#", "####BITIB####", "####CCCCC####", "####CCCCC####", "####CCCCC####", "####BITIB####", "#FFHHHHHHHFF#", "####BITIB####", "####CCCCC####", "####CCCCC####", "####CCCCC####", "####BITIB####", "##TTTTPTTTT##") - .aisle("XXXXXXXXXXXXX", "XXVXXXXXXXVXX", "####BAAAB####", "####IAAAI####", "#FHHHAAAHHHF#", "####IAAAI####", "####CAAAC####", "####CAAAC####", "####CAAAC####", "####IAAAI####", "#FHHHAAAHHHF#", "####IAAAI####", "####CAAAC####", "####CAAAC####", "####CAAAC####", "####IAAAI####", "##TTTTPTTTT##") - .aisle("XXXXXXXXXXXXX", "XXVXXXXXXXVXX", "###PPAAAPP###", "###PTAAATP###", "#FHPHAAAHPHF#", "###PTAAATP###", "###PCAAACP###", "###PCAAACP###", "###PCAAACP###", "###PTAAATP###", "#FHPHAAAHPHF#", "###PTAAATP###", "###PCAAACP###", "###PCAAACP###", "###PCAAACP###", "###PTAAATP###", "##TPPPMPPPT##") - .aisle("XXXXXXXXXXXXX", "XXVXXXXXXXVXX", "####BAAAB####", "####IAAAI####", "#FHHHAAAHHHF#", "####IAAAI####", "####CAAAC####", "####CAAAC####", "####CAAAC####", "####IAAAI####", "#FHHHAAAHHHF#", "####IAAAI####", "####CAAAC####", "####CAAAC####", "####CAAAC####", "####IAAAI####", "##TTTTPTTTT##") - .aisle("XXXXXXXXXXXXX", "XXVXXXXXXXVXX", "####BBPBB####", "####TITIT####", "#FFHHHHHHHFF#", "####BITIB####", "####CCCCC####", "####CCCCC####", "####CCCCC####", "####BITIB####", "#FFHHHHHHHFF#", "####BITIB####", "####CCCCC####", "####CCCCC####", "####CCCCC####", "####BITIB####", "##TTTTPTTTT##") - .aisle("XXXXXXXXXXXXX", "XXXXXXXXXXXXX", "#F####P####F#", "#F####P####F#", "#FFHHHPHHHFF#", "######P######", "######P######", "######P######", "######P######", "######P######", "##FHHHPHHHF##", "######P######", "######P######", "######P######", "######P######", "######P######", "##TTTTPTTTT##") - .aisle("XXXXXXXXXXXXX", "XXXXVVVVVXXXX", "##F#######F##", "##F#######F##", "##FFFHHHFFF##", "##F#######F##", "##F#######F##", "##F#######F##", "##F#######F##", "##F#######F##", "##FFFHHHFFF##", "#############", "#############", "#############", "#############", "#############", "###TTTTTTT###") - .aisle("#XXXXXXXXXXX#", "#XXXXXXXXXXX#", "###F#####F###", "###F#####F###", "###FFFFFFF###", "#############", "#############", "#############", "#############", "#############", "####FFFFF####", "#############", "#############", "#############", "#############", "#############", "#############") - .aisle("##XXXXXXXXX##", "##XXXXSXXXX##", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############") + .aisle("##XXXXXXXXX##", "##XXXXXXXXX##", "#############", "#############", "#############", + "#############", "#############", "#############", "#############", "#############", + "#############", "#############", "#############", "#############", "#############", + "#############", "#############") + .aisle("#XXXXXXXXXXX#", "#XXXXXXXXXXX#", "###F#####F###", "###F#####F###", "###FFFFFFF###", + "#############", "#############", "#############", "#############", "#############", + "####FFFFF####", "#############", "#############", "#############", "#############", + "#############", "#############") + .aisle("XXXXXXXXXXXXX", "XXXXVVVVVXXXX", "##F#######F##", "##F#######F##", "##FFFHHHFFF##", + "##F#######F##", "##F#######F##", "##F#######F##", "##F#######F##", "##F#######F##", + "##FFFHHHFFF##", "#############", "#############", "#############", "#############", + "#############", "###TTTTTTT###") + .aisle("XXXXXXXXXXXXX", "XXXXXXXXXXXXX", "#F####P####F#", "#F####P####F#", "#FFHHHPHHHFF#", + "######P######", "######P######", "######P######", "######P######", "######P######", + "##FHHHPHHHF##", "######P######", "######P######", "######P######", "######P######", + "######P######", "##TTTTPTTTT##") + .aisle("XXXXXXXXXXXXX", "XXVXXXXXXXVXX", "####BBPBB####", "####TITIT####", "#FFHHHHHHHFF#", + "####BITIB####", "####CCCCC####", "####CCCCC####", "####CCCCC####", "####BITIB####", + "#FFHHHHHHHFF#", "####BITIB####", "####CCCCC####", "####CCCCC####", "####CCCCC####", + "####BITIB####", "##TTTTPTTTT##") + .aisle("XXXXXXXXXXXXX", "XXVXXXXXXXVXX", "####BAAAB####", "####IAAAI####", "#FHHHAAAHHHF#", + "####IAAAI####", "####CAAAC####", "####CAAAC####", "####CAAAC####", "####IAAAI####", + "#FHHHAAAHHHF#", "####IAAAI####", "####CAAAC####", "####CAAAC####", "####CAAAC####", + "####IAAAI####", "##TTTTPTTTT##") + .aisle("XXXXXXXXXXXXX", "XXVXXXXXXXVXX", "###PPAAAPP###", "###PTAAATP###", "#FHPHAAAHPHF#", + "###PTAAATP###", "###PCAAACP###", "###PCAAACP###", "###PCAAACP###", "###PTAAATP###", + "#FHPHAAAHPHF#", "###PTAAATP###", "###PCAAACP###", "###PCAAACP###", "###PCAAACP###", + "###PTAAATP###", "##TPPPMPPPT##") + .aisle("XXXXXXXXXXXXX", "XXVXXXXXXXVXX", "####BAAAB####", "####IAAAI####", "#FHHHAAAHHHF#", + "####IAAAI####", "####CAAAC####", "####CAAAC####", "####CAAAC####", "####IAAAI####", + "#FHHHAAAHHHF#", "####IAAAI####", "####CAAAC####", "####CAAAC####", "####CAAAC####", + "####IAAAI####", "##TTTTPTTTT##") + .aisle("XXXXXXXXXXXXX", "XXVXXXXXXXVXX", "####BBPBB####", "####TITIT####", "#FFHHHHHHHFF#", + "####BITIB####", "####CCCCC####", "####CCCCC####", "####CCCCC####", "####BITIB####", + "#FFHHHHHHHFF#", "####BITIB####", "####CCCCC####", "####CCCCC####", "####CCCCC####", + "####BITIB####", "##TTTTPTTTT##") + .aisle("XXXXXXXXXXXXX", "XXXXXXXXXXXXX", "#F####P####F#", "#F####P####F#", "#FFHHHPHHHFF#", + "######P######", "######P######", "######P######", "######P######", "######P######", + "##FHHHPHHHF##", "######P######", "######P######", "######P######", "######P######", + "######P######", "##TTTTPTTTT##") + .aisle("XXXXXXXXXXXXX", "XXXXVVVVVXXXX", "##F#######F##", "##F#######F##", "##FFFHHHFFF##", + "##F#######F##", "##F#######F##", "##F#######F##", "##F#######F##", "##F#######F##", + "##FFFHHHFFF##", "#############", "#############", "#############", "#############", + "#############", "###TTTTTTT###") + .aisle("#XXXXXXXXXXX#", "#XXXXXXXXXXX#", "###F#####F###", "###F#####F###", "###FFFFFFF###", + "#############", "#############", "#############", "#############", "#############", + "####FFFFF####", "#############", "#############", "#############", "#############", + "#############", "#############") + .aisle("##XXXXXXXXX##", "##XXXXSXXXX##", "#############", "#############", "#############", + "#############", "#############", "#############", "#############", "#############", + "#############", "#############", "#############", "#############", "#############", + "#############", "#############") .where('S', controller(blocks(definition.get()))) .where('X', casing.or(autoAbilities(definition.getRecipeTypes())) .or(Predicates.autoAbilities(true, false, true))) @@ -752,38 +866,78 @@ public static void init() {} .shapeInfos(definition -> { List shapeInfo = new ArrayList<>(); var builder = MultiblockShapeInfo.builder() - .aisle("##XODXXXQLX##", "##XXXXSXXXX##", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############") - .aisle("#XXXXXXXXXXX#", "#XXXXXXXXXXX#", "###F#####F###", "###F#####F###", "###FFFFFFF###", "#############", "#############", "#############", "#############", "#############", "####FFFFF####", "#############", "#############", "#############", "#############", "#############", "#############") - .aisle("XXXXXXXXXXXXX", "XXXXVVVVVXXXX", "##F#######F##", "##F#######F##", "##FFFXXXFFF##", "##F#######F##", "##F#######F##", "##F#######F##", "##F#######F##", "##F#######F##", "##FFFXXXFFF##", "#############", "#############", "#############", "#############", "#############", "###TTTTTTT###") - .aisle("XXXXXXXXXXXXX", "XXXXXXXXXXXXX", "#F####P####F#", "#F####P####F#", "#FFXXXPXXXFF#", "######P######", "######P######", "######P######", "######P######", "######P######", "##FXXXPXXXF##", "######P######", "######P######", "######P######", "######P######", "######P######", "##TTTTPTTTT##") - .aisle("XXXXXXXXXXXXX", "XXVXXXXXXXVXX", "####BBPBB####", "####TITIT####", "#FFXXXXXXXFF#", "####BITIB####", "####CCCCC####", "####CCCCC####", "####CCCCC####", "####BITIB####", "#FFXXXXXXXFF#", "####BITIB####", "####CCCCC####", "####CCCCC####", "####CCCCC####", "####BITIB####", "##TTTTPTTTT##") - .aisle("XXXXXXXXXXXXX", "XXVXXXXXXXVXX", "####BAAAB####", "####IAAAI####", "#FXXXAAAXXXF#", "####IAAAI####", "####CAAAC####", "####CAAAC####", "####CAAAC####", "####IAAAI####", "#FXXXAAAXXXF#", "####IAAAI####", "####CAAAC####", "####CAAAC####", "####CAAAC####", "####IAAAI####", "##TTTTPTTTT##") - .aisle("XXXXXXXXXXXXX", "XXVXXXXXXXVXX", "###PPAAAPP###", "###PTAAATP###", "#FXPXAAAXPXF#", "###PTAAATP###", "###PCAAACP###", "###PCAAACP###", "###PCAAACP###", "###PTAAATP###", "#FXPXAAAXPXF#", "###PTAAATP###", "###PCAAACP###", "###PCAAACP###", "###PCAAACP###", "###PTAAATP###", "##TPPPHPPPT##") - .aisle("XXXXXXXXXXXXX", "XXVXXXXXXXVXX", "####BAAAB####", "####IAAAI####", "#FXXXAAAXXXF#", "####IAAAI####", "####CAAAC####", "####CAAAC####", "####CAAAC####", "####IAAAI####", "#FXXXAAAXXXF#", "####IAAAI####", "####CAAAC####", "####CAAAC####", "####CAAAC####", "####IAAAI####", "##TTTTPTTTT##") - .aisle("XXXXXXXXXXXXX", "XXVXXXXXXXVXX", "####BBPBB####", "####TITIT####", "#FFXXXXXXXFF#", "####BITIB####", "####CCCCC####", "####CCCCC####", "####CCCCC####", "####BITIB####", "#FFXXXXXXXFF#", "####BITIB####", "####CCCCC####", "####CCCCC####", "####CCCCC####", "####BITIB####", "##TTTTPTTTT##") - .aisle("XXXXXXXXXXXXX", "XXXXXXXXXXXXX", "#F####P####F#", "#F####P####F#", "#FFXXXPXXXFF#", "######P######", "######P######", "######P######", "######P######", "######P######", "##FXXXPXXXF##", "######P######", "######P######", "######P######", "######P######", "######P######", "##TTTTPTTTT##") - .aisle("XXXXXXXXXXXXX", "XXXXVVVVVXXXX", "##F#######F##", "##F#######F##", "##FFFXXXFFF##", "##F#######F##", "##F#######F##", "##F#######F##", "##F#######F##", "##F#######F##", "##FFFXXXFFF##", "#############", "#############", "#############", "#############", "#############", "###TTTTTTT###") - .aisle("#XXXXXXXXXXX#", "#XXXXXXXXXXX#", "###F#####F###", "###F#####F###", "###FFFFFFF###", "#############", "#############", "#############", "#############", "#############", "####FFFFF####", "#############", "#############", "#############", "#############", "#############", "#############") - .aisle("##XXXEMEXXX##", "##XXXXXXXXX##", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############", "#############") - .where('X', CASING_HIGH_TEMPERATURE_SMELTING.getDefaultState()) - .where('S', definition, Direction.NORTH) - .where('A', Blocks.AIR.defaultBlockState()) - .where('T', CASING_TUNGSTENSTEEL_ROBUST.getDefaultState()) - .where('B', FIREBOX_TUNGSTENSTEEL.getDefaultState()) - .where('P', CASING_TUNGSTENSTEEL_PIPE.getDefaultState()) - .where('I', CASING_EXTREME_ENGINE_INTAKE.getDefaultState()) - .where('F', ChemicalHelper.getBlock(TagPrefix.frameGt, NaquadahAlloy)) - .where('V', HEAT_VENT.getDefaultState()) - .where('E', ENERGY_INPUT_HATCH[GTValues.LV], Direction.SOUTH) - .where('L', ITEM_IMPORT_BUS[GTValues.LV], Direction.NORTH) - .where('O', ITEM_EXPORT_BUS[GTValues.LV], Direction.NORTH) - .where('Q', FLUID_IMPORT_HATCH[GTValues.LV], Direction.NORTH) - .where('D', FLUID_EXPORT_HATCH[GTValues.LV], Direction.NORTH) - .where('H', MUFFLER_HATCH[GTValues.LV], Direction.UP) - .where('M', MAINTENANCE_HATCH, Direction.SOUTH); + .aisle("##XODXXXQLX##", "##XXXXSXXXX##", "#############", "#############", "#############", + "#############", "#############", "#############", "#############", "#############", + "#############", "#############", "#############", "#############", "#############", + "#############", "#############") + .aisle("#XXXXXXXXXXX#", "#XXXXXXXXXXX#", "###F#####F###", "###F#####F###", "###FFFFFFF###", + "#############", "#############", "#############", "#############", "#############", + "####FFFFF####", "#############", "#############", "#############", "#############", + "#############", "#############") + .aisle("XXXXXXXXXXXXX", "XXXXVVVVVXXXX", "##F#######F##", "##F#######F##", "##FFFXXXFFF##", + "##F#######F##", "##F#######F##", "##F#######F##", "##F#######F##", "##F#######F##", + "##FFFXXXFFF##", "#############", "#############", "#############", "#############", + "#############", "###TTTTTTT###") + .aisle("XXXXXXXXXXXXX", "XXXXXXXXXXXXX", "#F####P####F#", "#F####P####F#", "#FFXXXPXXXFF#", + "######P######", "######P######", "######P######", "######P######", "######P######", + "##FXXXPXXXF##", "######P######", "######P######", "######P######", "######P######", + "######P######", "##TTTTPTTTT##") + .aisle("XXXXXXXXXXXXX", "XXVXXXXXXXVXX", "####BBPBB####", "####TITIT####", "#FFXXXXXXXFF#", + "####BITIB####", "####CCCCC####", "####CCCCC####", "####CCCCC####", "####BITIB####", + "#FFXXXXXXXFF#", "####BITIB####", "####CCCCC####", "####CCCCC####", "####CCCCC####", + "####BITIB####", "##TTTTPTTTT##") + .aisle("XXXXXXXXXXXXX", "XXVXXXXXXXVXX", "####BAAAB####", "####IAAAI####", "#FXXXAAAXXXF#", + "####IAAAI####", "####CAAAC####", "####CAAAC####", "####CAAAC####", "####IAAAI####", + "#FXXXAAAXXXF#", "####IAAAI####", "####CAAAC####", "####CAAAC####", "####CAAAC####", + "####IAAAI####", "##TTTTPTTTT##") + .aisle("XXXXXXXXXXXXX", "XXVXXXXXXXVXX", "###PPAAAPP###", "###PTAAATP###", "#FXPXAAAXPXF#", + "###PTAAATP###", "###PCAAACP###", "###PCAAACP###", "###PCAAACP###", "###PTAAATP###", + "#FXPXAAAXPXF#", "###PTAAATP###", "###PCAAACP###", "###PCAAACP###", "###PCAAACP###", + "###PTAAATP###", "##TPPPHPPPT##") + .aisle("XXXXXXXXXXXXX", "XXVXXXXXXXVXX", "####BAAAB####", "####IAAAI####", "#FXXXAAAXXXF#", + "####IAAAI####", "####CAAAC####", "####CAAAC####", "####CAAAC####", "####IAAAI####", + "#FXXXAAAXXXF#", "####IAAAI####", "####CAAAC####", "####CAAAC####", "####CAAAC####", + "####IAAAI####", "##TTTTPTTTT##") + .aisle("XXXXXXXXXXXXX", "XXVXXXXXXXVXX", "####BBPBB####", "####TITIT####", "#FFXXXXXXXFF#", + "####BITIB####", "####CCCCC####", "####CCCCC####", "####CCCCC####", "####BITIB####", + "#FFXXXXXXXFF#", "####BITIB####", "####CCCCC####", "####CCCCC####", "####CCCCC####", + "####BITIB####", "##TTTTPTTTT##") + .aisle("XXXXXXXXXXXXX", "XXXXXXXXXXXXX", "#F####P####F#", "#F####P####F#", "#FFXXXPXXXFF#", + "######P######", "######P######", "######P######", "######P######", "######P######", + "##FXXXPXXXF##", "######P######", "######P######", "######P######", "######P######", + "######P######", "##TTTTPTTTT##") + .aisle("XXXXXXXXXXXXX", "XXXXVVVVVXXXX", "##F#######F##", "##F#######F##", "##FFFXXXFFF##", + "##F#######F##", "##F#######F##", "##F#######F##", "##F#######F##", "##F#######F##", + "##FFFXXXFFF##", "#############", "#############", "#############", "#############", + "#############", "###TTTTTTT###") + .aisle("#XXXXXXXXXXX#", "#XXXXXXXXXXX#", "###F#####F###", "###F#####F###", "###FFFFFFF###", + "#############", "#############", "#############", "#############", "#############", + "####FFFFF####", "#############", "#############", "#############", "#############", + "#############", "#############") + .aisle("##XXXEMEXXX##", "##XXXXXXXXX##", "#############", "#############", "#############", + "#############", "#############", "#############", "#############", "#############", + "#############", "#############", "#############", "#############", "#############", + "#############", "#############") + .where('X', CASING_HIGH_TEMPERATURE_SMELTING.getDefaultState()) + .where('S', definition, Direction.NORTH) + .where('A', Blocks.AIR.defaultBlockState()) + .where('T', CASING_TUNGSTENSTEEL_ROBUST.getDefaultState()) + .where('B', FIREBOX_TUNGSTENSTEEL.getDefaultState()) + .where('P', CASING_TUNGSTENSTEEL_PIPE.getDefaultState()) + .where('I', CASING_EXTREME_ENGINE_INTAKE.getDefaultState()) + .where('F', ChemicalHelper.getBlock(TagPrefix.frameGt, NaquadahAlloy)) + .where('V', HEAT_VENT.getDefaultState()) + .where('E', ENERGY_INPUT_HATCH[GTValues.LV], Direction.SOUTH) + .where('L', ITEM_IMPORT_BUS[GTValues.LV], Direction.NORTH) + .where('O', ITEM_EXPORT_BUS[GTValues.LV], Direction.NORTH) + .where('Q', FLUID_IMPORT_HATCH[GTValues.LV], Direction.NORTH) + .where('D', FLUID_EXPORT_HATCH[GTValues.LV], Direction.NORTH) + .where('H', MUFFLER_HATCH[GTValues.LV], Direction.UP) + .where('M', MAINTENANCE_HATCH, Direction.SOUTH); GTCEuAPI.HEATING_COILS.entrySet().stream() .sorted(Comparator.comparingInt(entry -> entry.getKey().getTier())) - .forEach(coil -> shapeInfo.add(builder.shallowCopy().where('C', coil.getValue().get()).build())); + .forEach( + coil -> shapeInfo.add(builder.shallowCopy().where('C', coil.getValue().get()).build())); return shapeInfo; }) .workableCasingRenderer(GTCEu.id("block/casings/gcym/high_temperature_smelting_casing"), @@ -792,21 +946,30 @@ public static void init() {} .compassNodeSelf() .register(); - public final static MultiblockMachineDefinition MEGA_VACUUM_FREEZER = REGISTRATE.multiblock("mega_vacuum_freezer", WorkableElectricMultiblockMachine::new) + public final static MultiblockMachineDefinition MEGA_VACUUM_FREEZER = REGISTRATE + .multiblock("mega_vacuum_freezer", WorkableElectricMultiblockMachine::new) .langValue("Bulk Blast Chiller") .tooltips(Component.translatable("gtceu.multiblock.parallelizable.tooltip")) - .tooltips(Component.translatable("gtceu.machine.available_recipe_map_1.tooltip", Component.translatable("gtceu.vacuum_freezer"))) + .tooltips(Component.translatable("gtceu.machine.available_recipe_map_1.tooltip", + Component.translatable("gtceu.vacuum_freezer"))) .rotationState(RotationState.NON_Y_AXIS) .recipeType(VACUUM_RECIPES) - .recipeModifiers(GTRecipeModifiers.PARALLEL_HATCH, GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) + .recipeModifiers(GTRecipeModifiers.PARALLEL_HATCH, + GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) .appearanceBlock(CASING_ALUMINIUM_FROSTPROOF) .pattern(definition -> FactoryBlockPattern.start() - .aisle("XXXXXXX#KKK", "XXXXXXX#KVK", "XXXXXXX#KVK", "XXXXXXX#KVK", "XXXXXXX#KKK", "XXXXXXX####", "XXXXXXX####") - .aisle("XXXXXXX#KVK", "XPPPPPPPPPV", "XPAPAPX#VPV", "XPPPPPPPPPV", "XPAPAPX#KVK", "XPPPPPX####", "XXXXXXX####") - .aisle("XXXXXXX#KVK", "XPAPAPXAVPV", "XAAAAAX#VPV", "XPAAAPX#VPV", "XAAAAAX#KVK", "XPAPAPX####", "XXXXXXX####") - .aisle("XXXXXXX#KVK", "XPAPAPPPPPV", "XAAAAAX#VPV", "XPAAAPPPPPV", "XAAAAAX#KVK", "XPAPAPX####", "XXXXXXX####") - .aisle("XXXXXXX#KKK", "XPPPPPX#KVK", "XPA#APX#KVK", "XPAAAPX#KVK", "XPAAAPX#KKK", "XPPPPPX####", "XXXXXXX####") - .aisle("#XXXXX#####", "#XXSXX#####", "#XGGGX#####", "#XGGGX#####", "#XGGGX#####", "#XXXXX#####", "###########") + .aisle("XXXXXXX#KKK", "XXXXXXX#KVK", "XXXXXXX#KVK", "XXXXXXX#KVK", "XXXXXXX#KKK", "XXXXXXX####", + "XXXXXXX####") + .aisle("XXXXXXX#KVK", "XPPPPPPPPPV", "XPAPAPX#VPV", "XPPPPPPPPPV", "XPAPAPX#KVK", "XPPPPPX####", + "XXXXXXX####") + .aisle("XXXXXXX#KVK", "XPAPAPXAVPV", "XAAAAAX#VPV", "XPAAAPX#VPV", "XAAAAAX#KVK", "XPAPAPX####", + "XXXXXXX####") + .aisle("XXXXXXX#KVK", "XPAPAPPPPPV", "XAAAAAX#VPV", "XPAAAPPPPPV", "XAAAAAX#KVK", "XPAPAPX####", + "XXXXXXX####") + .aisle("XXXXXXX#KKK", "XPPPPPX#KVK", "XPA#APX#KVK", "XPAAAPX#KVK", "XPAAAPX#KKK", "XPPPPPX####", + "XXXXXXX####") + .aisle("#XXXXX#####", "#XXSXX#####", "#XGGGX#####", "#XGGGX#####", "#XGGGX#####", "#XXXXX#####", + "###########") .where('S', controller(blocks(definition.get()))) .where('X', blocks(CASING_ALUMINIUM_FROSTPROOF.get()).setMinGlobalLimited(140) .or(autoAbilities(definition.getRecipeTypes())) diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/machines/GTAEMachines.java b/src/main/java/com/gregtechceu/gtceu/common/data/machines/GTAEMachines.java index 3da4296032..3267c31313 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/machines/GTAEMachines.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/machines/GTAEMachines.java @@ -7,16 +7,17 @@ import com.gregtechceu.gtceu.integration.ae2.machine.MEInputHatchPartMachine; import com.gregtechceu.gtceu.integration.ae2.machine.MEOutputBusPartMachine; import com.gregtechceu.gtceu.integration.ae2.machine.MEOutputHatchPartMachine; + import net.minecraft.network.chat.Component; import static com.gregtechceu.gtceu.api.GTValues.EV; -import static com.gregtechceu.gtceu.api.GTValues.UHV; import static com.gregtechceu.gtceu.common.registry.GTRegistration.REGISTRATE; @SuppressWarnings("unused") public class GTAEMachines { - public final static MachineDefinition ITEM_IMPORT_BUS = REGISTRATE.machine("me_input_bus", MEInputBusPartMachine::new) + public final static MachineDefinition ITEM_IMPORT_BUS = REGISTRATE + .machine("me_input_bus", MEInputBusPartMachine::new) .langValue("ME Stocking Input Bus") .tier(EV) .rotationState(RotationState.ALL) @@ -26,7 +27,8 @@ public class GTAEMachines { .compassNode("item_bus") .register(); - public final static MachineDefinition ITEM_EXPORT_BUS = REGISTRATE.machine("me_output_bus", MEOutputBusPartMachine::new) + public final static MachineDefinition ITEM_EXPORT_BUS = REGISTRATE + .machine("me_output_bus", MEOutputBusPartMachine::new) .langValue("ME Output Bus") .tier(EV) .rotationState(RotationState.ALL) @@ -39,7 +41,8 @@ public class GTAEMachines { .compassNode("item_bus") .register(); - public final static MachineDefinition FLUID_IMPORT_HATCH = REGISTRATE.machine("me_input_hatch", MEInputHatchPartMachine::new) + public final static MachineDefinition FLUID_IMPORT_HATCH = REGISTRATE + .machine("me_input_hatch", MEInputHatchPartMachine::new) .langValue("ME Stocking Input Hatch") .tier(EV) .rotationState(RotationState.ALL) @@ -49,17 +52,16 @@ public class GTAEMachines { .compassNode("fluid_hatch") .register(); - public final static MachineDefinition FLUID_EXPORT_HATCH = REGISTRATE.machine("me_output_hatch", MEOutputHatchPartMachine::new) + public final static MachineDefinition FLUID_EXPORT_HATCH = REGISTRATE + .machine("me_output_hatch", MEOutputHatchPartMachine::new) .langValue("ME Output Hatch") .tier(EV) .rotationState(RotationState.ALL) - .abilities(PartAbility.EXPORT_FLUIDS) - .overlayTieredHullRenderer("me_fluid_hatch.export") - .tooltips(Component.translatable("gtceu.machine.fluid_hatch.export.tooltip")) + .abilities(PartAbility.EXPORT_FLUIDS) + .overlayTieredHullRenderer("me_fluid_hatch.export") + .tooltips(Component.translatable("gtceu.machine.fluid_hatch.export.tooltip")) .compassNode("fluid_hatch") .register(); - public static void init() { - - } + public static void init() {} } diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/machines/GTCreateMachines.java b/src/main/java/com/gregtechceu/gtceu/common/data/machines/GTCreateMachines.java index 747a06a2fa..a09931e485 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/machines/GTCreateMachines.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/machines/GTCreateMachines.java @@ -24,14 +24,16 @@ import com.gregtechceu.gtceu.common.machine.kinetic.ElectricGearBoxMachine; import com.gregtechceu.gtceu.common.machine.kinetic.SimpleKineticElectricWorkableMachine; import com.gregtechceu.gtceu.common.machine.multiblock.part.KineticPartMachine; + +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockBehaviour; + import com.jozufozu.flywheel.api.MaterialManager; import com.jozufozu.flywheel.backend.instancing.blockentity.BlockEntityInstance; import com.simibubi.create.content.kinetics.BlockStressValues; import com.simibubi.create.foundation.utility.Couple; import com.tterrag.registrate.util.nullness.NonNullSupplier; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.state.BlockBehaviour; import org.jetbrains.annotations.Nullable; import java.util.Locale; @@ -40,8 +42,8 @@ import static com.gregtechceu.gtceu.api.GTValues.VLVH; import static com.gregtechceu.gtceu.api.GTValues.VLVT; -import static com.gregtechceu.gtceu.common.registry.GTRegistration.REGISTRATE; import static com.gregtechceu.gtceu.common.data.GTMachines.*; +import static com.gregtechceu.gtceu.common.registry.GTRegistration.REGISTRATE; import static com.gregtechceu.gtceu.utils.FormattingUtil.toEnglishName; /** @@ -55,65 +57,83 @@ public class GTCreateMachines { public static final KineticMachineDefinition[] ELECTRIC_GEAR_BOX_8A = registerElectricGearBox(8, LOW_TIERS); public static final KineticMachineDefinition[] ELECTRIC_GEAR_BOX_16A = registerElectricGearBox(16, LOW_TIERS); public static final KineticMachineDefinition[] ELECTRIC_GEAR_BOX_32A = registerElectricGearBox(32, LOW_TIERS); - public static final KineticMachineDefinition[] KINETIC_MIXER = registerSimpleKineticElectricMachine("kinetic_mixer", GTRecipeTypes.CREATE_MIXER_RECIPES, LOW_TIERS); - public static final KineticMachineDefinition[] KINETIC_INPUT_BOX = registerTieredMachines("kinetic_input_box", (tier, id) -> new KineticMachineDefinition(id, false, GTValues.V[tier]).setFrontRotation(true), + public static final KineticMachineDefinition[] KINETIC_MIXER = registerSimpleKineticElectricMachine("kinetic_mixer", + GTRecipeTypes.CREATE_MIXER_RECIPES, LOW_TIERS); + public static final KineticMachineDefinition[] KINETIC_INPUT_BOX = registerTieredMachines("kinetic_input_box", + (tier, id) -> new KineticMachineDefinition(id, false, GTValues.V[tier]).setFrontRotation(true), (holder, tier) -> new KineticPartMachine(holder, tier, IO.IN), (tier, builder) -> builder .langValue("%s %s %s".formatted(VLVH[tier], toEnglishName("kinetic_input_box"), VLVT[tier])) .rotationState(RotationState.ALL) .blockProp(BlockBehaviour.Properties::dynamicShape) .blockProp(BlockBehaviour.Properties::noOcclusion) .abilities(PartAbility.INPUT_KINETIC) - .renderer(() -> new SplitShaftTieredHullMachineRenderer(tier, GTCEu.id("block/machine/part/kinetic_input_box"))) - .register() - , () -> SplitShaftInstance::new, false, ELECTRIC_TIERS); - public static final KineticMachineDefinition[] KINETIC_OUTPUT_BOX = registerTieredMachines("kinetic_output_box", (tier, id) -> new KineticMachineDefinition(id, true, GTValues.V[tier]).setFrontRotation(true), + .renderer(() -> new SplitShaftTieredHullMachineRenderer(tier, + GTCEu.id("block/machine/part/kinetic_input_box"))) + .register(), + () -> SplitShaftInstance::new, false, ELECTRIC_TIERS); + public static final KineticMachineDefinition[] KINETIC_OUTPUT_BOX = registerTieredMachines("kinetic_output_box", + (tier, id) -> new KineticMachineDefinition(id, true, GTValues.V[tier]).setFrontRotation(true), (holder, tier) -> new KineticPartMachine(holder, tier, IO.OUT), (tier, builder) -> builder .langValue("%s %s %s".formatted(VLVH[tier], toEnglishName("kinetic_output_box"), VLVT[tier])) .rotationState(RotationState.ALL) .blockProp(BlockBehaviour.Properties::dynamicShape) .blockProp(BlockBehaviour.Properties::noOcclusion) .abilities(PartAbility.OUTPUT_KINETIC) - .renderer(() -> new SplitShaftTieredHullMachineRenderer(tier, GTCEu.id("block/machine/part/kinetic_output_box"))) - .register() - , () -> SplitShaftInstance::new, false, ELECTRIC_TIERS); + .renderer(() -> new SplitShaftTieredHullMachineRenderer(tier, + GTCEu.id("block/machine/part/kinetic_output_box"))) + .register(), + () -> SplitShaftInstance::new, false, ELECTRIC_TIERS); @SuppressWarnings("unchecked") public static KineticMachineDefinition[] registerElectricGearBox(int maxAmps, int... tiers) { - return registerTieredMachines("electric_gear_box_%sa".formatted(maxAmps), (tier, id) -> new KineticMachineDefinition(id, true, GTValues.V[tier]).setFrontRotation(true), + return registerTieredMachines("electric_gear_box_%sa".formatted(maxAmps), + (tier, id) -> new KineticMachineDefinition(id, true, GTValues.V[tier]).setFrontRotation(true), (holder, tier) -> new ElectricGearBoxMachine(holder, tier, maxAmps), (tier, builder) -> builder - .langValue("%s %s %s".formatted(VLVH[tier], "Electric Gearbox %dA".formatted(maxAmps), VLVT[tier])) + .langValue( + "%s %s %s".formatted(VLVH[tier], "Electric Gearbox %dA".formatted(maxAmps), VLVT[tier])) .rotationState(RotationState.ALL) .blockProp(BlockBehaviour.Properties::dynamicShape) .blockProp(BlockBehaviour.Properties::noOcclusion) - .renderer(() -> new SplitShaftTieredHullMachineRenderer(tier, GTCEu.id("block/machine/electric_gear_box_%sa".formatted(maxAmps)))) + .renderer(() -> new SplitShaftTieredHullMachineRenderer(tier, + GTCEu.id("block/machine/electric_gear_box_%sa".formatted(maxAmps)))) .tooltips(explosion()) - .register() - , () -> SplitShaftInstance::new, false, tiers); + .register(), + () -> SplitShaftInstance::new, false, tiers); } - public static KineticMachineDefinition[] registerSimpleKineticElectricMachine(String name, GTRecipeType recipeType, int... tiers) { + public static KineticMachineDefinition[] registerSimpleKineticElectricMachine(String name, GTRecipeType recipeType, + int... tiers) { return registerTieredMachines(name, (tier, id) -> new KineticMachineDefinition(id, false, GTValues.V[tier]), - (holder, tier) -> new SimpleKineticElectricWorkableMachine(holder, tier, defaultTankSizeFunction), (tier, builder) -> builder + (holder, tier) -> new SimpleKineticElectricWorkableMachine(holder, tier, defaultTankSizeFunction), + (tier, builder) -> builder .langValue("%s %s %s".formatted(VLVH[tier], toEnglishName(name), VLVT[tier])) .rotationState(RotationState.NON_Y_AXIS) .editableUI(SimpleTieredMachine.EDITABLE_UI_CREATOR.apply(GTCEu.id(name), recipeType)) .blockProp(BlockBehaviour.Properties::dynamicShape) .blockProp(BlockBehaviour.Properties::noOcclusion) .recipeType(recipeType) - .recipeModifier(GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) - .renderer(() -> new KineticWorkableTieredHullMachineRenderer(tier, GTCEu.id("block/machine/kinetic_electric_machine"), GTCEu.id("block/machines/" + name))) + .recipeModifier( + GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) + .renderer(() -> new KineticWorkableTieredHullMachineRenderer(tier, + GTCEu.id("block/machine/kinetic_electric_machine"), GTCEu.id("block/machines/" + name))) .tooltips(explosion()) - .tooltips(workableTiered(tier, GTValues.V[tier], GTValues.V[tier] * 64, recipeType, defaultTankSizeFunction.apply(tier), true)) - .register() - , () -> SplitShaftInstance::new, false, tiers); + .tooltips(workableTiered(tier, GTValues.V[tier], GTValues.V[tier] * 64, recipeType, + defaultTankSizeFunction.apply(tier), true)) + .register(), + () -> SplitShaftInstance::new, false, tiers); } - public static MachineBuilder registerMachines(String name, Function definitionFactory, Function factory, + public static MachineBuilder registerMachines(String name, + Function definitionFactory, + Function factory, @Nullable NonNullSupplier>> instanceFactory, boolean renderNormally) { - return REGISTRATE.machine(name, definitionFactory, factory, KineticMachineBlock::new, MetaMachineItem::new, KineticMachineBlockEntity::create) + return REGISTRATE + .machine(name, definitionFactory, factory, KineticMachineBlock::new, MetaMachineItem::new, + KineticMachineBlockEntity::create) .hasTESR(instanceFactory != null) - .onBlockEntityRegister(type -> KineticMachineBlockEntity.onBlockEntityRegister(type, instanceFactory, renderNormally)); + .onBlockEntityRegister( + type -> KineticMachineBlockEntity.onBlockEntityRegister(type, instanceFactory, renderNormally)); } public static KineticMachineDefinition[] registerTieredMachines(String name, @@ -126,14 +146,15 @@ public static KineticMachineDefinition[] registerTieredMachines(String name, KineticMachineDefinition[] definitions = new KineticMachineDefinition[GTValues.TIER_COUNT]; for (int tier : tiers) { var register = REGISTRATE.machine(GTValues.VN[tier].toLowerCase(Locale.ROOT) + "_" + name, - id -> definitionFactory.apply(tier, id), - holder -> factory.apply(holder, tier), - KineticMachineBlock::new, - MetaMachineItem::new, - KineticMachineBlockEntity::create) + id -> definitionFactory.apply(tier, id), + holder -> factory.apply(holder, tier), + KineticMachineBlock::new, + MetaMachineItem::new, + KineticMachineBlockEntity::create) .tier(tier) .hasTESR(instanceFactory != null) - .onBlockEntityRegister(type -> KineticMachineBlockEntity.onBlockEntityRegister(type, instanceFactory, renderNormally)); + .onBlockEntityRegister(type -> KineticMachineBlockEntity.onBlockEntityRegister(type, + instanceFactory, renderNormally)); definitions[tier] = builder.apply(tier, register); } return definitions; @@ -141,9 +162,11 @@ public static KineticMachineDefinition[] registerTieredMachines(String name, public static void init() { BlockStressValues.registerProvider(GTCEu.MOD_ID, new BlockStressValues.IStressValueProvider() { + @Override public double getImpact(Block block) { - if (block instanceof IMachineBlock machineBlock && machineBlock.getDefinition() instanceof KineticMachineDefinition definition) { + if (block instanceof IMachineBlock machineBlock && + machineBlock.getDefinition() instanceof KineticMachineDefinition definition) { if (!definition.isSource()) { return definition.getTorque(); } @@ -153,7 +176,8 @@ public double getImpact(Block block) { @Override public double getCapacity(Block block) { - if (block instanceof IMachineBlock machineBlock && machineBlock.getDefinition() instanceof KineticMachineDefinition definition) { + if (block instanceof IMachineBlock machineBlock && + machineBlock.getDefinition() instanceof KineticMachineDefinition definition) { if (definition.isSource()) { return definition.getTorque(); } @@ -163,7 +187,8 @@ public double getCapacity(Block block) { @Override public boolean hasImpact(Block block) { - if (block instanceof IMachineBlock machineBlock && machineBlock.getDefinition() instanceof KineticMachineDefinition definition) { + if (block instanceof IMachineBlock machineBlock && + machineBlock.getDefinition() instanceof KineticMachineDefinition definition) { return !definition.isSource(); } return false; @@ -171,7 +196,8 @@ public boolean hasImpact(Block block) { @Override public boolean hasCapacity(Block block) { - if (block instanceof IMachineBlock machineBlock && machineBlock.getDefinition() instanceof KineticMachineDefinition definition) { + if (block instanceof IMachineBlock machineBlock && + machineBlock.getDefinition() instanceof KineticMachineDefinition definition) { return definition.isSource(); } return false; diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/machines/GTResearchMachines.java b/src/main/java/com/gregtechceu/gtceu/common/data/machines/GTResearchMachines.java index 4ccfd2b335..2eae544768 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/machines/GTResearchMachines.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/machines/GTResearchMachines.java @@ -32,10 +32,11 @@ import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.data.lang.LangHandler; import com.gregtechceu.gtceu.utils.FormattingUtil; + import net.minecraft.core.Direction; import net.minecraft.network.chat.Component; -import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.block.Blocks; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -53,368 +54,380 @@ @javax.annotation.ParametersAreNonnullByDefault public class GTResearchMachines { - public static final MultiblockMachineDefinition RESEARCH_STATION = REGISTRATE.multiblock("research_station", ResearchStationMachine::new) - .rotationState(RotationState.NON_Y_AXIS) - .recipeType(GTRecipeTypes.RESEARCH_STATION_RECIPES) - .appearanceBlock(COMPUTER_CASING) - .tooltips(LangHandler.getMultiLang("gtceu.machine.research_station.tooltip").toArray(Component[]::new)) - .pattern(defintion -> FactoryBlockPattern.start() - .aisle("XXX", "VVV", "PPP", "PPP", "PPP", "VVV", "XXX") - .aisle("XXX", "VAV", "AAA", "AAA", "AAA", "VAV", "XXX") - .aisle("XXX", "VAV", "XAX", "XSX", "XAX", "VAV", "XXX") - .aisle("XXX", "XAX", "---", "---", "---", "XAX", "XXX") - .aisle(" X ", "XAX", "---", "---", "---", "XAX", " X ") - .aisle(" X ", "XAX", "-A-", "-H-", "-A-", "XAX", " X ") - .aisle(" ", "XXX", "---", "---", "---", "XXX", " ") - .where('S', controller(blocks(defintion.getBlock()))) - .where('X', blocks(COMPUTER_CASING.get())) - .where(' ', any()) - .where('-', air()) - .where('V', blocks(COMPUTER_HEAT_VENT.get())) - .where('A', blocks(ADVANCED_COMPUTER_CASING.get())) - .where('P', blocks(COMPUTER_CASING.get()) - .or(abilities(PartAbility.INPUT_ENERGY).setMinGlobalLimited(1)) - .or(abilities(PartAbility.MAINTENANCE) - .setMinGlobalLimited(ConfigHolder.INSTANCE.machines.enableMaintenance ? 1 : 0).setMaxGlobalLimited(1)) - .or(abilities(PartAbility.COMPUTATION_DATA_RECEPTION).setExactLimit(1))) - .where('H', abilities(PartAbility.OBJECT_HOLDER)) - .build()) - .shapeInfo(definition -> MultiblockShapeInfo.builder() - .aisle("XXX", "VVV", "POP", "PEP", "PMP", "VVV", "XXX") - .aisle("XXX", "VAV", "AAA", "AAA", "AAA", "VAV", "XXX") - .aisle("XXX", "VAV", "XAX", "XSX", "XAX", "VAV", "XXX") - .aisle("XXX", "XAX", "---", "---", "---", "XAX", "XXX") - .aisle("-X-", "XAX", "---", "---", "---", "XAX", "-X-") - .aisle("-X-", "XAX", "-A-", "-H-", "-A-", "XAX", "-X-") - .aisle("---", "XXX", "---", "---", "---", "XXX", "---") - .where('S', GTResearchMachines.RESEARCH_STATION, Direction.SOUTH) - .where('X', COMPUTER_CASING.get()) - .where('-', Blocks.AIR) - .where('V', COMPUTER_HEAT_VENT.get()) - .where('A', ADVANCED_COMPUTER_CASING.get()) - .where('P', COMPUTER_CASING.get()) - .where('O', GTResearchMachines.COMPUTATION_HATCH_RECEIVER, Direction.NORTH) - .where('E', GTMachines.ENERGY_INPUT_HATCH[GTValues.LuV], Direction.NORTH) - .where('M', ConfigHolder.INSTANCE.machines.enableMaintenance ? GTMachines.MAINTENANCE_HATCH.getBlock().defaultBlockState().setValue(GTMachines.MAINTENANCE_HATCH.get().getRotationState().property, Direction.NORTH) : COMPUTER_CASING.getDefaultState()) - .where('H', GTResearchMachines.OBJECT_HOLDER, Direction.NORTH) - .build()) - .sidedWorkableCasingRenderer("block/casings/hpca/advanced_computer_casing", - GTCEu.id("block/multiblock/research_station"), false) - .register(); + public static final MultiblockMachineDefinition RESEARCH_STATION = REGISTRATE + .multiblock("research_station", ResearchStationMachine::new) + .rotationState(RotationState.NON_Y_AXIS) + .recipeType(GTRecipeTypes.RESEARCH_STATION_RECIPES) + .appearanceBlock(COMPUTER_CASING) + .tooltips(LangHandler.getMultiLang("gtceu.machine.research_station.tooltip").toArray(Component[]::new)) + .pattern(defintion -> FactoryBlockPattern.start() + .aisle("XXX", "VVV", "PPP", "PPP", "PPP", "VVV", "XXX") + .aisle("XXX", "VAV", "AAA", "AAA", "AAA", "VAV", "XXX") + .aisle("XXX", "VAV", "XAX", "XSX", "XAX", "VAV", "XXX") + .aisle("XXX", "XAX", "---", "---", "---", "XAX", "XXX") + .aisle(" X ", "XAX", "---", "---", "---", "XAX", " X ") + .aisle(" X ", "XAX", "-A-", "-H-", "-A-", "XAX", " X ") + .aisle(" ", "XXX", "---", "---", "---", "XXX", " ") + .where('S', controller(blocks(defintion.getBlock()))) + .where('X', blocks(COMPUTER_CASING.get())) + .where(' ', any()) + .where('-', air()) + .where('V', blocks(COMPUTER_HEAT_VENT.get())) + .where('A', blocks(ADVANCED_COMPUTER_CASING.get())) + .where('P', blocks(COMPUTER_CASING.get()) + .or(abilities(PartAbility.INPUT_ENERGY).setMinGlobalLimited(1)) + .or(abilities(PartAbility.MAINTENANCE) + .setMinGlobalLimited(ConfigHolder.INSTANCE.machines.enableMaintenance ? 1 : 0) + .setMaxGlobalLimited(1)) + .or(abilities(PartAbility.COMPUTATION_DATA_RECEPTION).setExactLimit(1))) + .where('H', abilities(PartAbility.OBJECT_HOLDER)) + .build()) + .shapeInfo(definition -> MultiblockShapeInfo.builder() + .aisle("XXX", "VVV", "POP", "PEP", "PMP", "VVV", "XXX") + .aisle("XXX", "VAV", "AAA", "AAA", "AAA", "VAV", "XXX") + .aisle("XXX", "VAV", "XAX", "XSX", "XAX", "VAV", "XXX") + .aisle("XXX", "XAX", "---", "---", "---", "XAX", "XXX") + .aisle("-X-", "XAX", "---", "---", "---", "XAX", "-X-") + .aisle("-X-", "XAX", "-A-", "-H-", "-A-", "XAX", "-X-") + .aisle("---", "XXX", "---", "---", "---", "XXX", "---") + .where('S', GTResearchMachines.RESEARCH_STATION, Direction.SOUTH) + .where('X', COMPUTER_CASING.get()) + .where('-', Blocks.AIR) + .where('V', COMPUTER_HEAT_VENT.get()) + .where('A', ADVANCED_COMPUTER_CASING.get()) + .where('P', COMPUTER_CASING.get()) + .where('O', GTResearchMachines.COMPUTATION_HATCH_RECEIVER, Direction.NORTH) + .where('E', GTMachines.ENERGY_INPUT_HATCH[GTValues.LuV], Direction.NORTH) + .where('M', ConfigHolder.INSTANCE.machines.enableMaintenance ? + GTMachines.MAINTENANCE_HATCH.getBlock().defaultBlockState().setValue( + GTMachines.MAINTENANCE_HATCH.get().getRotationState().property, Direction.NORTH) : + COMPUTER_CASING.getDefaultState()) + .where('H', GTResearchMachines.OBJECT_HOLDER, Direction.NORTH) + .build()) + .sidedWorkableCasingRenderer("block/casings/hpca/advanced_computer_casing", + GTCEu.id("block/multiblock/research_station"), false) + .register(); public static final MachineDefinition OBJECT_HOLDER = REGISTRATE.machine("object_holder", ObjectHolderMachine::new) - .langValue("Object Holder") - .tier(ZPM) - .rotationState(RotationState.ALL) - .abilities(PartAbility.OBJECT_HOLDER) - .renderer(() -> new OverlayTieredActiveMachineRenderer(ZPM, GTCEu.id("block/machine/part/object_holder"), GTCEu.id("block/machine/part/object_holder_active"))) - .register(); - + .langValue("Object Holder") + .tier(ZPM) + .rotationState(RotationState.ALL) + .abilities(PartAbility.OBJECT_HOLDER) + .renderer(() -> new OverlayTieredActiveMachineRenderer(ZPM, GTCEu.id("block/machine/part/object_holder"), + GTCEu.id("block/machine/part/object_holder_active"))) + .register(); public static final MachineDefinition DATA_BANK = REGISTRATE.multiblock("data_bank", DataBankMachine::new) - .langValue("Data Bank") - .rotationState(RotationState.NON_Y_AXIS) - .appearanceBlock(COMPUTER_CASING) - .recipeType(GTRecipeTypes.DUMMY_RECIPES) - .tooltips(Component.translatable("gtceu.machine.data_bank.tooltip.0"), - Component.translatable("gtceu.machine.data_bank.tooltip.1"), - Component.translatable("gtceu.machine.data_bank.tooltip.2"), - Component.translatable("gtceu.machine.data_bank.tooltip.3", FormattingUtil.formatNumbers(DataBankMachine.EUT_PER_HATCH)), - Component.translatable("gtceu.machine.data_bank.tooltip.4", FormattingUtil.formatNumbers(DataBankMachine.EUT_PER_HATCH_CHAINED))) - .pattern(definition -> FactoryBlockPattern.start() - .aisle("XDDDX", "XDDDX", "XDDDX") - .aisle("XDDDX", "XAAAX", "XDDDX") - .aisle("XCCCX", "XCSCX", "XCCCX") - .where('S', controller(blocks(definition.getBlock()))) - .where('X', blocks(COMPUTER_HEAT_VENT.get())) - .where('D', blocks(COMPUTER_CASING.get()).setMinGlobalLimited(3) - .or(abilities(PartAbility.DATA_ACCESS).setPreviewCount(3)) - .or(abilities(PartAbility.OPTICAL_DATA_TRANSMISSION) - .setMinGlobalLimited(1, 1)) - .or(abilities(PartAbility.OPTICAL_DATA_RECEPTION).setPreviewCount(1))) - .where('A', blocks(COMPUTER_CASING.get())) - .where('C', blocks(HIGH_POWER_CASING.get()) - .setMinGlobalLimited(4) - .or(autoAbilities()) - .or(autoAbilities(true, false, false)) - .or(abilities(PartAbility.INPUT_ENERGY).setMinGlobalLimited(1).setMaxGlobalLimited(2).setPreviewCount(1))) - .build()) - .workableCasingRenderer(GTCEu.id("block/casings/hpca/high_power_casing"), - GTCEu.id("block/multiblock/data_bank"), false) - .register(); - - - public static final MachineDefinition NETWORK_SWITCH = REGISTRATE.multiblock("network_switch", NetworkSwitchMachine::new) - .langValue("Network Switch") - .rotationState(RotationState.NON_Y_AXIS) - .appearanceBlock(COMPUTER_CASING) - .recipeType(GTRecipeTypes.DUMMY_RECIPES) - .tooltips(Component.translatable("gtceu.machine.network_switch.tooltip.0"), - Component.translatable("gtceu.machine.network_switch.tooltip.1"), - Component.translatable("gtceu.machine.network_switch.tooltip.2"), - Component.translatable("gtceu.machine.network_switch.tooltip.3", FormattingUtil.formatNumbers(NetworkSwitchMachine.EUT_PER_HATCH))) - .pattern(definition -> FactoryBlockPattern.start() - .aisle("XXX", "XXX", "XXX") - .aisle("XXX", "XAX", "XXX") - .aisle("XXX", "XSX", "XXX") - .where('S', controller(blocks(definition.getBlock()))) - .where('A', blocks(ADVANCED_COMPUTER_CASING.get())) - .where('X', blocks(COMPUTER_CASING.get()).setMinGlobalLimited(7) - .or(abilities(PartAbility.INPUT_ENERGY).setMinGlobalLimited(1, 1)) - .or(abilities(PartAbility.MAINTENANCE).setExactLimit(1)) - .or(abilities(PartAbility.COMPUTATION_DATA_RECEPTION).setMinGlobalLimited(1, 2)) - .or(abilities(PartAbility.COMPUTATION_DATA_TRANSMISSION).setMinGlobalLimited(1, 1))) - .build()) - .shapeInfo(definition -> MultiblockShapeInfo.builder() - .aisle("XEX", "XXX", "TTT") - .aisle("XXX", "XAX", "XXX") - .aisle("XMX", "XSX", "XRX") - .where('S', GTResearchMachines.NETWORK_SWITCH, Direction.SOUTH) - .where('X', COMPUTER_CASING) - .where('A', ADVANCED_COMPUTER_CASING) - .where('R', GTResearchMachines.COMPUTATION_HATCH_RECEIVER, Direction.SOUTH) - .where('T', GTResearchMachines.COMPUTATION_HATCH_TRANSMITTER, Direction.NORTH) - .where('M', GTMachines.MAINTENANCE_HATCH, Direction.SOUTH) - .where('E', GTMachines.ENERGY_INPUT_HATCH[LuV], Direction.SOUTH) - .build()) - .sidedWorkableCasingRenderer("block/casings/hpca/computer_casing", - GTCEu.id("block/multiblock/network_switch"), false) - .register(); - - - public static final MachineDefinition HIGH_PERFORMANCE_COMPUTING_ARRAY = REGISTRATE.multiblock("high_performance_computation_array", HPCAMachine::new) - .langValue("High Performance Computation Array (HPCA)") - .rotationState(RotationState.NON_Y_AXIS) - .appearanceBlock(ADVANCED_COMPUTER_CASING) - .recipeType(GTRecipeTypes.DUMMY_RECIPES) - .tooltips(LangHandler.getMultiLang("gtceu.machine.high_performance_computation_array.tooltip").toArray(Component[]::new)) - .pattern(definition -> FactoryBlockPattern.start() - .aisle("AA", "CC", "CC", "CC", "AA") - .aisle("VA", "XV", "XV", "XV", "VA") - .aisle("VA", "XV", "XV", "XV", "VA") - .aisle("VA", "XV", "XV", "XV", "VA") - .aisle("SA", "CC", "CC", "CC", "AA") - .where('S', controller(blocks(definition.getBlock()))) - .where('A', blocks(ADVANCED_COMPUTER_CASING.get())) - .where('V', blocks(COMPUTER_HEAT_VENT.get())) - .where('X', abilities(PartAbility.HPCA_COMPONENT)) - .where('C', blocks(COMPUTER_CASING.get()).setMinGlobalLimited(5) - .or(abilities(PartAbility.MAINTENANCE).setExactLimit(1)) - .or(abilities(PartAbility.INPUT_ENERGY).setMinGlobalLimited(1)) - .or(abilities(PartAbility.IMPORT_FLUIDS).setMaxGlobalLimited(1)) - .or(abilities(PartAbility.COMPUTATION_DATA_TRANSMISSION).setExactLimit(1))) - .build()) - .shapeInfos(definition -> { - List shapeInfo = new ArrayList<>(); - MultiblockShapeInfo.ShapeInfoBuilder builder = MultiblockShapeInfo.builder() - .aisle("AA", "EC", "MC", "HC", "AA") - .aisle("VA", "6V", "3V", "0V", "VA") - .aisle("VA", "7V", "4V", "1V", "VA") - .aisle("VA", "8V", "5V", "2V", "VA") - .aisle("SA", "CC", "CC", "OC", "AA") - .where('S', GTResearchMachines.HIGH_PERFORMANCE_COMPUTING_ARRAY, Direction.SOUTH) - .where('A', ADVANCED_COMPUTER_CASING) - .where('V', COMPUTER_HEAT_VENT) - .where('C', COMPUTER_CASING) - .where('E', GTMachines.ENERGY_INPUT_HATCH[GTValues.LuV], Direction.NORTH) - .where('H', GTMachines.FLUID_IMPORT_HATCH[GTValues.LV], Direction.NORTH) - .where('O', GTResearchMachines.COMPUTATION_HATCH_TRANSMITTER, Direction.SOUTH) - .where('M', ConfigHolder.INSTANCE.machines.enableMaintenance ? - GTMachines.MAINTENANCE_HATCH.defaultBlockState().setValue(GTMachines.MAINTENANCE_HATCH.get().getRotationState().property, Direction.NORTH) : - COMPUTER_CASING.getDefaultState()); - - // a few example structures - shapeInfo.add(builder.shallowCopy() - .where('0', GTResearchMachines.HPCA_EMPTY_COMPONENT, Direction.WEST) - .where('1', GTResearchMachines.HPCA_HEAT_SINK_COMPONENT, Direction.WEST) - .where('2', GTResearchMachines.HPCA_EMPTY_COMPONENT, Direction.WEST) - .where('3', GTResearchMachines.HPCA_EMPTY_COMPONENT, Direction.WEST) - .where('4', GTResearchMachines.HPCA_COMPUTATION_COMPONENT, Direction.WEST) - .where('5', GTResearchMachines.HPCA_EMPTY_COMPONENT, Direction.WEST) - .where('6', GTResearchMachines.HPCA_EMPTY_COMPONENT, Direction.WEST) - .where('7', GTResearchMachines.HPCA_HEAT_SINK_COMPONENT, Direction.WEST) - .where('8', GTResearchMachines.HPCA_EMPTY_COMPONENT, Direction.WEST) - .build()); - - shapeInfo.add(builder.shallowCopy() - .where('0', GTResearchMachines.HPCA_HEAT_SINK_COMPONENT, Direction.WEST) - .where('1', GTResearchMachines.HPCA_COMPUTATION_COMPONENT, Direction.WEST) - .where('2', GTResearchMachines.HPCA_HEAT_SINK_COMPONENT, Direction.WEST) - .where('3', GTResearchMachines.HPCA_ACTIVE_COOLER_COMPONENT, Direction.WEST) - .where('4', GTResearchMachines.HPCA_COMPUTATION_COMPONENT, Direction.WEST) - .where('5', GTResearchMachines.HPCA_BRIDGE_COMPONENT, Direction.WEST) - .where('6', GTResearchMachines.HPCA_HEAT_SINK_COMPONENT, Direction.WEST) - .where('7', GTResearchMachines.HPCA_COMPUTATION_COMPONENT, Direction.WEST) - .where('8', GTResearchMachines.HPCA_HEAT_SINK_COMPONENT, Direction.WEST) - .build()); - - shapeInfo.add(builder.shallowCopy() - .where('0', GTResearchMachines.HPCA_HEAT_SINK_COMPONENT, Direction.WEST) - .where('1', GTResearchMachines.HPCA_COMPUTATION_COMPONENT, Direction.WEST) - .where('2', GTResearchMachines.HPCA_HEAT_SINK_COMPONENT, Direction.WEST) - .where('3', GTResearchMachines.HPCA_HEAT_SINK_COMPONENT, Direction.WEST) - .where('4', GTResearchMachines.HPCA_ADVANCED_COMPUTATION_COMPONENT, Direction.WEST) - .where('5', GTResearchMachines.HPCA_HEAT_SINK_COMPONENT, Direction.WEST) - .where('6', GTResearchMachines.HPCA_HEAT_SINK_COMPONENT, Direction.WEST) - .where('7', GTResearchMachines.HPCA_BRIDGE_COMPONENT, Direction.WEST) - .where('8', GTResearchMachines.HPCA_HEAT_SINK_COMPONENT, Direction.WEST) - .build()); - - shapeInfo.add(builder.shallowCopy() - .where('0', GTResearchMachines.HPCA_HEAT_SINK_COMPONENT, Direction.WEST) - .where('1', GTResearchMachines.HPCA_ADVANCED_COMPUTATION_COMPONENT, Direction.WEST) - .where('2', GTResearchMachines.HPCA_HEAT_SINK_COMPONENT, Direction.WEST) - .where('3', GTResearchMachines.HPCA_ACTIVE_COOLER_COMPONENT, Direction.WEST) - .where('4', GTResearchMachines.HPCA_BRIDGE_COMPONENT, Direction.WEST) - .where('5', GTResearchMachines.HPCA_ACTIVE_COOLER_COMPONENT, Direction.WEST) - .where('6', GTResearchMachines.HPCA_HEAT_SINK_COMPONENT, Direction.WEST) - .where('7', GTResearchMachines.HPCA_ADVANCED_COMPUTATION_COMPONENT, Direction.WEST) - .where('8', GTResearchMachines.HPCA_HEAT_SINK_COMPONENT, Direction.WEST) - .build()); - - return shapeInfo; - }) - .sidedWorkableCasingRenderer("block/casings/hpca/computer_casing", - GTCEu.id("block/multiblock/hpca"), false) - .register(); - + .langValue("Data Bank") + .rotationState(RotationState.NON_Y_AXIS) + .appearanceBlock(COMPUTER_CASING) + .recipeType(GTRecipeTypes.DUMMY_RECIPES) + .tooltips(Component.translatable("gtceu.machine.data_bank.tooltip.0"), + Component.translatable("gtceu.machine.data_bank.tooltip.1"), + Component.translatable("gtceu.machine.data_bank.tooltip.2"), + Component.translatable("gtceu.machine.data_bank.tooltip.3", + FormattingUtil.formatNumbers(DataBankMachine.EUT_PER_HATCH)), + Component.translatable("gtceu.machine.data_bank.tooltip.4", + FormattingUtil.formatNumbers(DataBankMachine.EUT_PER_HATCH_CHAINED))) + .pattern(definition -> FactoryBlockPattern.start() + .aisle("XDDDX", "XDDDX", "XDDDX") + .aisle("XDDDX", "XAAAX", "XDDDX") + .aisle("XCCCX", "XCSCX", "XCCCX") + .where('S', controller(blocks(definition.getBlock()))) + .where('X', blocks(COMPUTER_HEAT_VENT.get())) + .where('D', blocks(COMPUTER_CASING.get()).setMinGlobalLimited(3) + .or(abilities(PartAbility.DATA_ACCESS).setPreviewCount(3)) + .or(abilities(PartAbility.OPTICAL_DATA_TRANSMISSION) + .setMinGlobalLimited(1, 1)) + .or(abilities(PartAbility.OPTICAL_DATA_RECEPTION).setPreviewCount(1))) + .where('A', blocks(COMPUTER_CASING.get())) + .where('C', blocks(HIGH_POWER_CASING.get()) + .setMinGlobalLimited(4) + .or(autoAbilities()) + .or(autoAbilities(true, false, false)) + .or(abilities(PartAbility.INPUT_ENERGY).setMinGlobalLimited(1).setMaxGlobalLimited(2) + .setPreviewCount(1))) + .build()) + .workableCasingRenderer(GTCEu.id("block/casings/hpca/high_power_casing"), + GTCEu.id("block/multiblock/data_bank"), false) + .register(); + + public static final MachineDefinition NETWORK_SWITCH = REGISTRATE + .multiblock("network_switch", NetworkSwitchMachine::new) + .langValue("Network Switch") + .rotationState(RotationState.NON_Y_AXIS) + .appearanceBlock(COMPUTER_CASING) + .recipeType(GTRecipeTypes.DUMMY_RECIPES) + .tooltips(Component.translatable("gtceu.machine.network_switch.tooltip.0"), + Component.translatable("gtceu.machine.network_switch.tooltip.1"), + Component.translatable("gtceu.machine.network_switch.tooltip.2"), + Component.translatable("gtceu.machine.network_switch.tooltip.3", + FormattingUtil.formatNumbers(NetworkSwitchMachine.EUT_PER_HATCH))) + .pattern(definition -> FactoryBlockPattern.start() + .aisle("XXX", "XXX", "XXX") + .aisle("XXX", "XAX", "XXX") + .aisle("XXX", "XSX", "XXX") + .where('S', controller(blocks(definition.getBlock()))) + .where('A', blocks(ADVANCED_COMPUTER_CASING.get())) + .where('X', blocks(COMPUTER_CASING.get()).setMinGlobalLimited(7) + .or(abilities(PartAbility.INPUT_ENERGY).setMinGlobalLimited(1, 1)) + .or(abilities(PartAbility.MAINTENANCE).setExactLimit(1)) + .or(abilities(PartAbility.COMPUTATION_DATA_RECEPTION).setMinGlobalLimited(1, 2)) + .or(abilities(PartAbility.COMPUTATION_DATA_TRANSMISSION).setMinGlobalLimited(1, 1))) + .build()) + .shapeInfo(definition -> MultiblockShapeInfo.builder() + .aisle("XEX", "XXX", "TTT") + .aisle("XXX", "XAX", "XXX") + .aisle("XMX", "XSX", "XRX") + .where('S', GTResearchMachines.NETWORK_SWITCH, Direction.SOUTH) + .where('X', COMPUTER_CASING) + .where('A', ADVANCED_COMPUTER_CASING) + .where('R', GTResearchMachines.COMPUTATION_HATCH_RECEIVER, Direction.SOUTH) + .where('T', GTResearchMachines.COMPUTATION_HATCH_TRANSMITTER, Direction.NORTH) + .where('M', GTMachines.MAINTENANCE_HATCH, Direction.SOUTH) + .where('E', GTMachines.ENERGY_INPUT_HATCH[LuV], Direction.SOUTH) + .build()) + .sidedWorkableCasingRenderer("block/casings/hpca/computer_casing", + GTCEu.id("block/multiblock/network_switch"), false) + .register(); + + public static final MachineDefinition HIGH_PERFORMANCE_COMPUTING_ARRAY = REGISTRATE + .multiblock("high_performance_computation_array", HPCAMachine::new) + .langValue("High Performance Computation Array (HPCA)") + .rotationState(RotationState.NON_Y_AXIS) + .appearanceBlock(ADVANCED_COMPUTER_CASING) + .recipeType(GTRecipeTypes.DUMMY_RECIPES) + .tooltips(LangHandler.getMultiLang("gtceu.machine.high_performance_computation_array.tooltip") + .toArray(Component[]::new)) + .pattern(definition -> FactoryBlockPattern.start() + .aisle("AA", "CC", "CC", "CC", "AA") + .aisle("VA", "XV", "XV", "XV", "VA") + .aisle("VA", "XV", "XV", "XV", "VA") + .aisle("VA", "XV", "XV", "XV", "VA") + .aisle("SA", "CC", "CC", "CC", "AA") + .where('S', controller(blocks(definition.getBlock()))) + .where('A', blocks(ADVANCED_COMPUTER_CASING.get())) + .where('V', blocks(COMPUTER_HEAT_VENT.get())) + .where('X', abilities(PartAbility.HPCA_COMPONENT)) + .where('C', blocks(COMPUTER_CASING.get()).setMinGlobalLimited(5) + .or(abilities(PartAbility.MAINTENANCE).setExactLimit(1)) + .or(abilities(PartAbility.INPUT_ENERGY).setMinGlobalLimited(1)) + .or(abilities(PartAbility.IMPORT_FLUIDS).setMaxGlobalLimited(1)) + .or(abilities(PartAbility.COMPUTATION_DATA_TRANSMISSION).setExactLimit(1))) + .build()) + .shapeInfos(definition -> { + List shapeInfo = new ArrayList<>(); + MultiblockShapeInfo.ShapeInfoBuilder builder = MultiblockShapeInfo.builder() + .aisle("AA", "EC", "MC", "HC", "AA") + .aisle("VA", "6V", "3V", "0V", "VA") + .aisle("VA", "7V", "4V", "1V", "VA") + .aisle("VA", "8V", "5V", "2V", "VA") + .aisle("SA", "CC", "CC", "OC", "AA") + .where('S', GTResearchMachines.HIGH_PERFORMANCE_COMPUTING_ARRAY, Direction.SOUTH) + .where('A', ADVANCED_COMPUTER_CASING) + .where('V', COMPUTER_HEAT_VENT) + .where('C', COMPUTER_CASING) + .where('E', GTMachines.ENERGY_INPUT_HATCH[GTValues.LuV], Direction.NORTH) + .where('H', GTMachines.FLUID_IMPORT_HATCH[GTValues.LV], Direction.NORTH) + .where('O', GTResearchMachines.COMPUTATION_HATCH_TRANSMITTER, Direction.SOUTH) + .where('M', ConfigHolder.INSTANCE.machines.enableMaintenance ? + GTMachines.MAINTENANCE_HATCH.defaultBlockState().setValue( + GTMachines.MAINTENANCE_HATCH.get().getRotationState().property, + Direction.NORTH) : + COMPUTER_CASING.getDefaultState()); + + // a few example structures + shapeInfo.add(builder.shallowCopy() + .where('0', GTResearchMachines.HPCA_EMPTY_COMPONENT, Direction.WEST) + .where('1', GTResearchMachines.HPCA_HEAT_SINK_COMPONENT, Direction.WEST) + .where('2', GTResearchMachines.HPCA_EMPTY_COMPONENT, Direction.WEST) + .where('3', GTResearchMachines.HPCA_EMPTY_COMPONENT, Direction.WEST) + .where('4', GTResearchMachines.HPCA_COMPUTATION_COMPONENT, Direction.WEST) + .where('5', GTResearchMachines.HPCA_EMPTY_COMPONENT, Direction.WEST) + .where('6', GTResearchMachines.HPCA_EMPTY_COMPONENT, Direction.WEST) + .where('7', GTResearchMachines.HPCA_HEAT_SINK_COMPONENT, Direction.WEST) + .where('8', GTResearchMachines.HPCA_EMPTY_COMPONENT, Direction.WEST) + .build()); + + shapeInfo.add(builder.shallowCopy() + .where('0', GTResearchMachines.HPCA_HEAT_SINK_COMPONENT, Direction.WEST) + .where('1', GTResearchMachines.HPCA_COMPUTATION_COMPONENT, Direction.WEST) + .where('2', GTResearchMachines.HPCA_HEAT_SINK_COMPONENT, Direction.WEST) + .where('3', GTResearchMachines.HPCA_ACTIVE_COOLER_COMPONENT, Direction.WEST) + .where('4', GTResearchMachines.HPCA_COMPUTATION_COMPONENT, Direction.WEST) + .where('5', GTResearchMachines.HPCA_BRIDGE_COMPONENT, Direction.WEST) + .where('6', GTResearchMachines.HPCA_HEAT_SINK_COMPONENT, Direction.WEST) + .where('7', GTResearchMachines.HPCA_COMPUTATION_COMPONENT, Direction.WEST) + .where('8', GTResearchMachines.HPCA_HEAT_SINK_COMPONENT, Direction.WEST) + .build()); + + shapeInfo.add(builder.shallowCopy() + .where('0', GTResearchMachines.HPCA_HEAT_SINK_COMPONENT, Direction.WEST) + .where('1', GTResearchMachines.HPCA_COMPUTATION_COMPONENT, Direction.WEST) + .where('2', GTResearchMachines.HPCA_HEAT_SINK_COMPONENT, Direction.WEST) + .where('3', GTResearchMachines.HPCA_HEAT_SINK_COMPONENT, Direction.WEST) + .where('4', GTResearchMachines.HPCA_ADVANCED_COMPUTATION_COMPONENT, Direction.WEST) + .where('5', GTResearchMachines.HPCA_HEAT_SINK_COMPONENT, Direction.WEST) + .where('6', GTResearchMachines.HPCA_HEAT_SINK_COMPONENT, Direction.WEST) + .where('7', GTResearchMachines.HPCA_BRIDGE_COMPONENT, Direction.WEST) + .where('8', GTResearchMachines.HPCA_HEAT_SINK_COMPONENT, Direction.WEST) + .build()); + + shapeInfo.add(builder.shallowCopy() + .where('0', GTResearchMachines.HPCA_HEAT_SINK_COMPONENT, Direction.WEST) + .where('1', GTResearchMachines.HPCA_ADVANCED_COMPUTATION_COMPONENT, Direction.WEST) + .where('2', GTResearchMachines.HPCA_HEAT_SINK_COMPONENT, Direction.WEST) + .where('3', GTResearchMachines.HPCA_ACTIVE_COOLER_COMPONENT, Direction.WEST) + .where('4', GTResearchMachines.HPCA_BRIDGE_COMPONENT, Direction.WEST) + .where('5', GTResearchMachines.HPCA_ACTIVE_COOLER_COMPONENT, Direction.WEST) + .where('6', GTResearchMachines.HPCA_HEAT_SINK_COMPONENT, Direction.WEST) + .where('7', GTResearchMachines.HPCA_ADVANCED_COMPUTATION_COMPONENT, Direction.WEST) + .where('8', GTResearchMachines.HPCA_HEAT_SINK_COMPONENT, Direction.WEST) + .build()); + + return shapeInfo; + }) + .sidedWorkableCasingRenderer("block/casings/hpca/computer_casing", + GTCEu.id("block/multiblock/hpca"), false) + .register(); //////////////////////////////////////////// - //******** MULTIBLOCK PARTS ********// + // ******** MULTIBLOCK PARTS ********// //////////////////////////////////////////// public static final MachineDefinition COMPUTATION_HATCH_TRANSMITTER = registerDataHatch( - "computation_transmitter_hatch", "Computation Data Transmission Hatch", - ZPM, (holder) -> new OpticalComputationHatchMachine(holder, true), - "computation_data_hatch", PartAbility.COMPUTATION_DATA_TRANSMISSION - ).register(); + "computation_transmitter_hatch", "Computation Data Transmission Hatch", + ZPM, (holder) -> new OpticalComputationHatchMachine(holder, true), + "computation_data_hatch", PartAbility.COMPUTATION_DATA_TRANSMISSION).register(); public static final MachineDefinition COMPUTATION_HATCH_RECEIVER = registerDataHatch( - "computation_receiver_hatch", "Computation Data Reception Hatch", - ZPM, (holder) -> new OpticalComputationHatchMachine(holder, false), - "computation_data_hatch", PartAbility.COMPUTATION_DATA_RECEPTION - ).register(); - + "computation_receiver_hatch", "Computation Data Reception Hatch", + ZPM, (holder) -> new OpticalComputationHatchMachine(holder, false), + "computation_data_hatch", PartAbility.COMPUTATION_DATA_RECEPTION).register(); public static final MachineDefinition DATA_HATCH_TRANSMITTER = registerDataHatch( - "data_transmitter_hatch", "Optical Data Transmission Hatch", - LuV, (holder) -> new OpticalDataHatchMachine(holder, true), - "optical_data_hatch", PartAbility.OPTICAL_DATA_TRANSMISSION - ).register(); + "data_transmitter_hatch", "Optical Data Transmission Hatch", + LuV, (holder) -> new OpticalDataHatchMachine(holder, true), + "optical_data_hatch", PartAbility.OPTICAL_DATA_TRANSMISSION).register(); public static final MachineDefinition DATA_HATCH_RECEIVER = registerDataHatch( - "data_receiver_hatch", "Optical Data Reception Hatch", - LuV, (holder) -> new OpticalDataHatchMachine(holder, false), - "optical_data_hatch", PartAbility.OPTICAL_DATA_RECEPTION - ).register(); - - - public static final MachineDefinition DATA_ACCESS_HATCH = REGISTRATE.machine("data_access_hatch", (holder) -> new DataAccessHatchMachine(holder, EV, false)) - .langValue("Data Access Hatch") - .tier(EV) - .rotationState(RotationState.ALL) - .abilities(PartAbility.DATA_ACCESS) - .tooltips(Component.translatable("gtceu.machine.data_access_hatch.tooltip.0"), - Component.translatable("gtceu.machine.data_access_hatch.tooltip.1", 9), - Component.translatable("gtceu.universal.disabled")) - .overlayTieredHullRenderer("data_access_hatch") - .register(); - - public static final MachineDefinition ADVANCED_DATA_ACCESS_HATCH = REGISTRATE.machine("advanced_data_access_hatch", (holder) -> new DataAccessHatchMachine(holder, LuV, false)) - .langValue("Advanced Data Access Hatch") - .tier(LuV) - .rotationState(RotationState.ALL) - .abilities(PartAbility.DATA_ACCESS) - .tooltips(Component.translatable("gtceu.machine.data_access_hatch.tooltip.0"), - Component.translatable("gtceu.machine.data_access_hatch.tooltip.1", 16), - Component.translatable("gtceu.universal.disabled")) - .overlayTieredHullRenderer("data_access_hatch") - .register(); - - public static final MachineDefinition CREATIVE_DATA_ACCESS_HATCH = REGISTRATE.machine("creative_data_access_hatch", (holder) -> new DataAccessHatchMachine(holder, MAX, true)) - .langValue("Creative Data Access Hatch") - .tier(MAX) - .rotationState(RotationState.ALL) - .abilities(PartAbility.DATA_ACCESS) - .tooltips(Component.translatable("gtceu.machine.data_access_hatch.tooltip.0"), - Component.translatable("gtceu.creative_tooltip.1") - .append(TooltipHelper.RAINBOW.toString()) - .append(Component.translatable("gtceu.creative_tooltip.2")) - .append(Component.translatable("gtceu.creative_tooltip.3")), - Component.translatable("gtceu.universal.enabled")) - .overlayTieredHullRenderer("data_access_hatch_creative") - .register(); - + "data_receiver_hatch", "Optical Data Reception Hatch", + LuV, (holder) -> new OpticalDataHatchMachine(holder, false), + "optical_data_hatch", PartAbility.OPTICAL_DATA_RECEPTION).register(); + + public static final MachineDefinition DATA_ACCESS_HATCH = REGISTRATE + .machine("data_access_hatch", (holder) -> new DataAccessHatchMachine(holder, EV, false)) + .langValue("Data Access Hatch") + .tier(EV) + .rotationState(RotationState.ALL) + .abilities(PartAbility.DATA_ACCESS) + .tooltips(Component.translatable("gtceu.machine.data_access_hatch.tooltip.0"), + Component.translatable("gtceu.machine.data_access_hatch.tooltip.1", 9), + Component.translatable("gtceu.universal.disabled")) + .overlayTieredHullRenderer("data_access_hatch") + .register(); + + public static final MachineDefinition ADVANCED_DATA_ACCESS_HATCH = REGISTRATE + .machine("advanced_data_access_hatch", (holder) -> new DataAccessHatchMachine(holder, LuV, false)) + .langValue("Advanced Data Access Hatch") + .tier(LuV) + .rotationState(RotationState.ALL) + .abilities(PartAbility.DATA_ACCESS) + .tooltips(Component.translatable("gtceu.machine.data_access_hatch.tooltip.0"), + Component.translatable("gtceu.machine.data_access_hatch.tooltip.1", 16), + Component.translatable("gtceu.universal.disabled")) + .overlayTieredHullRenderer("data_access_hatch") + .register(); + + public static final MachineDefinition CREATIVE_DATA_ACCESS_HATCH = REGISTRATE + .machine("creative_data_access_hatch", (holder) -> new DataAccessHatchMachine(holder, MAX, true)) + .langValue("Creative Data Access Hatch") + .tier(MAX) + .rotationState(RotationState.ALL) + .abilities(PartAbility.DATA_ACCESS) + .tooltips(Component.translatable("gtceu.machine.data_access_hatch.tooltip.0"), + Component.translatable("gtceu.creative_tooltip.1") + .append(TooltipHelper.RAINBOW.toString()) + .append(Component.translatable("gtceu.creative_tooltip.2")) + .append(Component.translatable("gtceu.creative_tooltip.3")), + Component.translatable("gtceu.universal.enabled")) + .overlayTieredHullRenderer("data_access_hatch_creative") + .register(); ////////////////////////////////////// - //*********** HPCA ***********// + // *********** HPCA ***********// ////////////////////////////////////// public static final MachineDefinition HPCA_EMPTY_COMPONENT = registerHPCAPart( - "hpca_empty_component", "Empty HPCA Component", - HPCAEmptyPartMachine::new, "empty", null, null, false - ).register(); + "hpca_empty_component", "Empty HPCA Component", + HPCAEmptyPartMachine::new, "empty", null, null, false).register(); public static final MachineDefinition HPCA_COMPUTATION_COMPONENT = registerHPCAPart( - "hpca_computation_component", "HPCA Computation Component", - holder -> new HPCAComputationPartMachine(holder, false), "computation", false - ).tooltips(Component.translatable("gtceu.machine.hpca.component_general.upkeep_eut", GTValues.VA[GTValues.EV]), - Component.translatable("gtceu.machine.hpca.component_general.max_eut", GTValues.VA[GTValues.LuV]), - Component.translatable("gtceu.machine.hpca.component_type.computation_cwut", 4), - Component.translatable("gtceu.machine.hpca.component_type.computation_cooling", 2), - Component.literal(TooltipHelper.BLINKING_ORANGE.toString()).append(Component.translatable("gtceu.machine.hpca.component_type.damaged"))) - .register(); + "hpca_computation_component", "HPCA Computation Component", + holder -> new HPCAComputationPartMachine(holder, false), "computation", false) + .tooltips( + Component.translatable("gtceu.machine.hpca.component_general.upkeep_eut", GTValues.VA[GTValues.EV]), + Component.translatable("gtceu.machine.hpca.component_general.max_eut", GTValues.VA[GTValues.LuV]), + Component.translatable("gtceu.machine.hpca.component_type.computation_cwut", 4), + Component.translatable("gtceu.machine.hpca.component_type.computation_cooling", 2), + Component.literal(TooltipHelper.BLINKING_ORANGE.toString()) + .append(Component.translatable("gtceu.machine.hpca.component_type.damaged"))) + .register(); public static final MachineDefinition HPCA_ADVANCED_COMPUTATION_COMPONENT = registerHPCAPart( - "hpca_advanced_computation_component", "HPCA Advanced Computation Component", - holder -> new HPCAComputationPartMachine(holder, true), "advanced_computation", true - ).tooltips(Component.translatable("gtceu.machine.hpca.component_general.upkeep_eut", GTValues.VA[GTValues.IV]), - Component.translatable("gtceu.machine.hpca.component_general.max_eut", GTValues.VA[GTValues.ZPM]), - Component.translatable("gtceu.machine.hpca.component_type.computation_cwut", 16), - Component.translatable("gtceu.machine.hpca.component_type.computation_cooling", 4), - Component.literal(TooltipHelper.BLINKING_ORANGE.toString()).append(Component.translatable("gtceu.machine.hpca.component_type.damaged"))) - .register(); + "hpca_advanced_computation_component", "HPCA Advanced Computation Component", + holder -> new HPCAComputationPartMachine(holder, true), "advanced_computation", true) + .tooltips( + Component.translatable("gtceu.machine.hpca.component_general.upkeep_eut", GTValues.VA[GTValues.IV]), + Component.translatable("gtceu.machine.hpca.component_general.max_eut", GTValues.VA[GTValues.ZPM]), + Component.translatable("gtceu.machine.hpca.component_type.computation_cwut", 16), + Component.translatable("gtceu.machine.hpca.component_type.computation_cooling", 4), + Component.literal(TooltipHelper.BLINKING_ORANGE.toString()) + .append(Component.translatable("gtceu.machine.hpca.component_type.damaged"))) + .register(); public static final MachineDefinition HPCA_HEAT_SINK_COMPONENT = registerHPCAPart( - "hpca_heat_sink_component", "HPCA Heat Sink Component", - holder -> new HPCACoolerPartMachine(holder, false), "heat_sink", null, null, false - ).tooltips(Component.translatable("gtceu.machine.hpca.component_type.cooler_passive"), - Component.translatable("gtceu.machine.hpca.component_type.cooler_cooling", 1)) - .register(); + "hpca_heat_sink_component", "HPCA Heat Sink Component", + holder -> new HPCACoolerPartMachine(holder, false), "heat_sink", null, null, false) + .tooltips(Component.translatable("gtceu.machine.hpca.component_type.cooler_passive"), + Component.translatable("gtceu.machine.hpca.component_type.cooler_cooling", 1)) + .register(); public static final MachineDefinition HPCA_ACTIVE_COOLER_COMPONENT = registerHPCAPart( - "hpca_active_cooler_component", "HPCA Active Cooling Component", - holder -> new HPCACoolerPartMachine(holder, true), "active_cooler", true - ).tooltips(Component.translatable("gtceu.machine.hpca.component_general.max_eut", GTValues.VA[GTValues.IV]), - Component.translatable("gtceu.machine.hpca.component_type.cooler_active"), - Component.translatable("gtceu.machine.hpca.component_type.cooler_active_coolant", - 8, GTMaterials.PCBCoolant.getLocalizedName()), - Component.translatable("gtceu.machine.hpca.component_type.cooler_cooling", 2)) - .register(); + "hpca_active_cooler_component", "HPCA Active Cooling Component", + holder -> new HPCACoolerPartMachine(holder, true), "active_cooler", true) + .tooltips(Component.translatable("gtceu.machine.hpca.component_general.max_eut", GTValues.VA[GTValues.IV]), + Component.translatable("gtceu.machine.hpca.component_type.cooler_active"), + Component.translatable("gtceu.machine.hpca.component_type.cooler_active_coolant", + 8, GTMaterials.PCBCoolant.getLocalizedName()), + Component.translatable("gtceu.machine.hpca.component_type.cooler_cooling", 2)) + .register(); public static final MachineDefinition HPCA_BRIDGE_COMPONENT = registerHPCAPart( - "hpca_bridge_component", "HPCA Bridge Component", - HPCABridgePartMachine::new, "bridge", false - ).tooltips(Component.translatable("gtceu.machine.hpca.component_type.bridge"), - Component.translatable("gtceu.machine.hpca.component_general.max_eut", GTValues.VA[GTValues.IV])) - .register(); - + "hpca_bridge_component", "HPCA Bridge Component", + HPCABridgePartMachine::new, "bridge", false) + .tooltips(Component.translatable("gtceu.machine.hpca.component_type.bridge"), + Component.translatable("gtceu.machine.hpca.component_general.max_eut", GTValues.VA[GTValues.IV])) + .register(); @NotNull - private static MachineBuilder registerDataHatch(String name, String displayName, int tier, Function constructor, String model, PartAbility... abilities) { + private static MachineBuilder registerDataHatch(String name, String displayName, int tier, + Function constructor, + String model, PartAbility... abilities) { return REGISTRATE.machine(name, constructor) - .langValue(displayName) - .tier(tier) - .rotationState(RotationState.ALL) - .abilities(abilities) - .overlayTieredHullRenderer(model); + .langValue(displayName) + .tier(tier) + .rotationState(RotationState.ALL) + .abilities(abilities) + .overlayTieredHullRenderer(model); } - private static MachineBuilder registerHPCAPart(String name, String displayName, Function constructor, String texture, boolean isAdvanced) { + private static MachineBuilder registerHPCAPart(String name, String displayName, + Function constructor, + String texture, boolean isAdvanced) { return REGISTRATE.machine(name, constructor) - .langValue(displayName) - .rotationState(RotationState.ALL) - .abilities(PartAbility.HPCA_COMPONENT) - .renderer(() -> new HPCAPartRenderer( - isAdvanced, - GTCEu.id("block/overlay/machine/hpca/" + texture), - GTCEu.id("block/overlay/machine/hpca/" + (isAdvanced ? "damaged_advanced" : "damaged")) - )); + .langValue(displayName) + .rotationState(RotationState.ALL) + .abilities(PartAbility.HPCA_COMPONENT) + .renderer(() -> new HPCAPartRenderer( + isAdvanced, + GTCEu.id("block/overlay/machine/hpca/" + texture), + GTCEu.id("block/overlay/machine/hpca/" + (isAdvanced ? "damaged_advanced" : "damaged")))); } @SuppressWarnings("SameParameterValue") @@ -426,21 +439,21 @@ private static MachineBuilder registerHPCAPart(String name, @Nullable String damagedTexture, boolean isAdvanced) { return REGISTRATE.machine(name, constructor) - .langValue(displayName) - .rotationState(RotationState.ALL) - .abilities(PartAbility.HPCA_COMPONENT) - .renderer(() -> new HPCAPartRenderer( - isAdvanced, - GTCEu.id("block/overlay/machine/hpca/" + texture), - activeTexture == null ? null : GTCEu.id("block/overlay/machine/hpca/" + activeTexture), - activeTexture == null ? null : GTCEu.id("block/overlay/machine/hpca/" + activeTexture + "_emissive"), - damagedTexture == null ? null : GTCEu.id("block/overlay/machine/hpca/" + damagedTexture), - damagedTexture == null ? null : GTCEu.id("block/overlay/machine/hpca/" + damagedTexture + "_active"), - damagedTexture == null ? null : GTCEu.id("block/overlay/machine/hpca/" + damagedTexture + "_emissive") - )); + .langValue(displayName) + .rotationState(RotationState.ALL) + .abilities(PartAbility.HPCA_COMPONENT) + .renderer(() -> new HPCAPartRenderer( + isAdvanced, + GTCEu.id("block/overlay/machine/hpca/" + texture), + activeTexture == null ? null : GTCEu.id("block/overlay/machine/hpca/" + activeTexture), + activeTexture == null ? null : + GTCEu.id("block/overlay/machine/hpca/" + activeTexture + "_emissive"), + damagedTexture == null ? null : GTCEu.id("block/overlay/machine/hpca/" + damagedTexture), + damagedTexture == null ? null : + GTCEu.id("block/overlay/machine/hpca/" + damagedTexture + "_active"), + damagedTexture == null ? null : + GTCEu.id("block/overlay/machine/hpca/" + damagedTexture + "_emissive"))); } - public static void init() { - - } + public static void init() {} } diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/materials/ElementMaterials.java b/src/main/java/com/gregtechceu/gtceu/common/data/materials/ElementMaterials.java index 9645d62786..c3277e6243 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/materials/ElementMaterials.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/materials/ElementMaterials.java @@ -9,17 +9,18 @@ import com.gregtechceu.gtceu.api.data.chemical.material.properties.ToolProperty; import com.gregtechceu.gtceu.api.fluids.FluidBuilder; import com.gregtechceu.gtceu.api.fluids.FluidState; +import com.gregtechceu.gtceu.api.fluids.attribute.FluidAttributes; import com.gregtechceu.gtceu.api.fluids.store.FluidStorageKeys; import com.gregtechceu.gtceu.api.item.tool.GTToolType; import com.gregtechceu.gtceu.common.data.GTElements; -import net.minecraft.world.effect.MobEffects; + +import java.util.List; import static com.gregtechceu.gtceu.api.GTValues.LV; import static com.gregtechceu.gtceu.api.data.chemical.material.info.MaterialFlags.*; import static com.gregtechceu.gtceu.api.data.chemical.material.info.MaterialIconSet.*; import static com.gregtechceu.gtceu.common.data.GTMaterials.*; - public class ElementMaterials { public static void register() { @@ -33,7 +34,8 @@ public static void register() { .liquid(new FluidBuilder().temperature(933)) .ore() .color(0xb6e5ff).secondaryColor(0x7ca29b) - .appendFlags(EXT2_METAL, GENERATE_GEAR, GENERATE_SMALL_GEAR, GENERATE_RING, GENERATE_FRAME, GENERATE_SPRING, GENERATE_SPRING_SMALL, GENERATE_FINE_WIRE) + .appendFlags(EXT2_METAL, GENERATE_GEAR, GENERATE_SMALL_GEAR, GENERATE_RING, GENERATE_FRAME, + GENERATE_SPRING, GENERATE_SPRING_SMALL, GENERATE_FINE_WIRE) .element(GTElements.Al) .toolStats(ToolProperty.Builder.of(6.0F, 7.5F, 768, 2) .enchantability(14).build()) @@ -98,7 +100,7 @@ public static void register() { .ore() .color(0x98d677).secondaryColor(0x254d40).iconSet(METALLIC) .appendFlags(STD_METAL) - .hazard(HazardProperty.HazardType.CONTACT_POISON,false) + .hazard(HazardProperty.HazardType.CONTACT_POISON, false) .element(GTElements.Be) .buildAndRegister(); @@ -121,6 +123,7 @@ public static void register() { .buildAndRegister(); Bromine = new Material.Builder(GTCEu.id("bromine")) + .liquid(new FluidBuilder().attribute(FluidAttributes.ACID)) .color(0x912200).secondaryColor(0x080101).iconSet(SHINY) .element(GTElements.Br) .buildAndRegister(); @@ -166,7 +169,10 @@ public static void register() { Chlorine = new Material.Builder(GTCEu.id("chlorine")) .gas(new FluidBuilder().state(FluidState.GAS).customStill()) .element(GTElements.Cl) - .hazard(HazardProperty.HazardType.INHALATION_POISON, new HazardProperty.HazardEffect(500, MobEffects.BLINDNESS), new HazardProperty.HazardDamage(2, 1), false) + .hazard(HazardProperty.HazardType.INHALATION_POISON, + List.of(HazardProperty.blindnessEffect(2000, 1000, 3), + HazardProperty.poisonEffect(2000, 1000, 3)), + false) .buildAndRegister(); Chromium = new Material.Builder(GTCEu.id("chromium")) @@ -178,7 +184,7 @@ public static void register() { .rotorStats(130, 155, 3.0f, 512) .fluidPipeProperties(2180, 35, true, true, false, false) .blastTemp(1700, GasTier.LOW) - .hazard(HazardProperty.HazardType.INHALATION_POISON,false) + .irritantHazard(false) .buildAndRegister(); Cobalt = new Material.Builder(GTCEu.id("cobalt")) @@ -195,7 +201,7 @@ public static void register() { Copernicium = new Material.Builder(GTCEu.id("copernicium")) .color(0x565c5d).secondaryColor(0xffd34b).iconSet(RADIOACTIVE) .element(GTElements.Cn) - // .hazard(HazardProperty.HazardType.RADIOACTIVE) + // .radioactiveHazard(1) .buildAndRegister(); Copper = new Material.Builder(GTCEu.id("copper")) @@ -212,7 +218,7 @@ public static void register() { Curium = new Material.Builder(GTCEu.id("curium")) .color(0x7B544E).iconSet(RADIOACTIVE) .element(GTElements.Cm) - //.hazard(HazardProperty.HazardType.RADIOACTIVE) + // .radioactiveHazard(1) .buildAndRegister(); Darmstadtium = new Material.Builder(GTCEu.id("darmstadtium")) @@ -253,7 +259,8 @@ public static void register() { .ingot() .liquid(new FluidBuilder().temperature(1099)) .color(0x988b33).secondaryColor(0x032a52).iconSet(METALLIC) - .appendFlags(STD_METAL, GENERATE_LONG_ROD, GENERATE_FINE_WIRE, GENERATE_SPRING, GENERATE_FOIL, GENERATE_FRAME) + .appendFlags(STD_METAL, GENERATE_LONG_ROD, GENERATE_FINE_WIRE, GENERATE_SPRING, GENERATE_FOIL, + GENERATE_FRAME) .element(GTElements.Eu) .cableProperties(GTValues.V[GTValues.UHV], 2, 32) .fluidPipeProperties(7750, 300, true) @@ -263,7 +270,7 @@ public static void register() { Fermium = new Material.Builder(GTCEu.id("fermium")) .color(0xc99fe7).secondaryColor(0x3e0022).iconSet(METALLIC) .element(GTElements.Fm) - // .hazard(HazardProperty.HazardType.RADIOACTIVE) + // .radioactiveHazard(1) .buildAndRegister(); Flerovium = new Material.Builder(GTCEu.id("flerovium")) @@ -306,7 +313,8 @@ public static void register() { .liquid(new FluidBuilder().temperature(1337)) .ore() .color(0xfdf55f).secondaryColor(0xf25833).iconSet(SHINY) - .appendFlags(EXT2_METAL, GENERATE_RING, MORTAR_GRINDABLE, EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES, GENERATE_SPRING, GENERATE_SPRING_SMALL, GENERATE_FINE_WIRE, GENERATE_FOIL) + .appendFlags(EXT2_METAL, GENERATE_RING, MORTAR_GRINDABLE, EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES, + GENERATE_SPRING, GENERATE_SPRING_SMALL, GENERATE_FINE_WIRE, GENERATE_FOIL) .element(GTElements.Au) .cableProperties(GTValues.V[3], 3, 2) .fluidPipeProperties(1671, 25, true, true, false, false) @@ -362,6 +370,7 @@ public static void register() { .buildAndRegister(); Iodine = new Material.Builder(GTCEu.id("iodine")) + .dust() .color(0x67686d).secondaryColor(0x773000).iconSet(SHINY) .element(GTElements.I) .buildAndRegister(); @@ -383,7 +392,9 @@ public static void register() { .plasma() .ore() .color(0xeeeeee).secondaryColor(0x979797).iconSet(METALLIC) - .appendFlags(EXT2_METAL, MORTAR_GRINDABLE, GENERATE_ROTOR, GENERATE_SMALL_GEAR, GENERATE_GEAR, GENERATE_SPRING_SMALL, GENERATE_SPRING, EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES, BLAST_FURNACE_CALCITE_TRIPLE) + .appendFlags(EXT2_METAL, MORTAR_GRINDABLE, GENERATE_ROTOR, GENERATE_SMALL_GEAR, GENERATE_GEAR, + GENERATE_SPRING_SMALL, GENERATE_SPRING, EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES, + BLAST_FURNACE_CALCITE_TRIPLE) .element(GTElements.Fe) .toolStats(ToolProperty.Builder.of(2.0F, 2.0F, 256, 2) .enchantability(14).addTypes(GTToolType.MORTAR).build()) @@ -417,7 +428,8 @@ public static void register() { .liquid(new FluidBuilder().temperature(600)) .ore() .color(0x7e6f82).secondaryColor(0x290633) - .appendFlags(EXT2_METAL, MORTAR_GRINDABLE, GENERATE_ROTOR, GENERATE_SPRING, GENERATE_SPRING_SMALL, GENERATE_FINE_WIRE) + .appendFlags(EXT2_METAL, MORTAR_GRINDABLE, GENERATE_ROTOR, GENERATE_SPRING, GENERATE_SPRING_SMALL, + GENERATE_FINE_WIRE) .element(GTElements.Pb) .cableProperties(GTValues.V[0], 2, 2) .fluidPipeProperties(1200, 32, true) @@ -497,7 +509,7 @@ public static void register() { .color(0x9a8b94).secondaryColor(0x2c2c2c).iconSet(METALLIC) .appendFlags(STD_METAL, GENERATE_ROD, GENERATE_BOLT_SCREW) .element(GTElements.Nd) - .rotorStats(100, 115,2.0f, 512) + .rotorStats(100, 115, 2.0f, 512) .blastTemp(1297, GasTier.MID) .buildAndRegister(); @@ -510,7 +522,7 @@ public static void register() { Neptunium = new Material.Builder(GTCEu.id("neptunium")) .color(0x284D7B).iconSet(RADIOACTIVE) .element(GTElements.Np) - // .hazard(HazardProperty.HazardType.RADIOACTIVE) + // .radioactiveHazard(1) .buildAndRegister(); Nickel = new Material.Builder(GTCEu.id("nickel")) @@ -597,7 +609,7 @@ public static void register() { .color(0x163b27).secondaryColor(0x00ff78) .iconSet(RADIOACTIVE) .element(GTElements.Po) - // .hazard(HazardProperty.HazardType.RADIOACTIVE) + // .radioactiveHazard(1) .buildAndRegister(); Platinum = new Material.Builder(GTCEu.id("platinum")) @@ -617,7 +629,7 @@ public static void register() { .ore(true) .color(0xba2727).secondaryColor(0x222730).iconSet(RADIOACTIVE) .element(GTElements.Pu239) - .hazard(HazardProperty.HazardType.RADIOACTIVE) + .radioactiveHazard(1.5f) .buildAndRegister(); Plutonium241 = new Material.Builder(GTCEu.id("plutonium_241")) @@ -626,7 +638,7 @@ public static void register() { .color(0xfa7272).secondaryColor(0x222730).iconSet(RADIOACTIVE) .appendFlags(EXT_METAL) .element(GTElements.Pu241) - .hazard(HazardProperty.HazardType.RADIOACTIVE) + .radioactiveHazard(1.5f) .buildAndRegister(); Potassium = new Material.Builder(GTCEu.id("potassium")) @@ -645,26 +657,26 @@ public static void register() { .color(0x786160).secondaryColor(0xe7ffb8) .iconSet(RADIOACTIVE) .element(GTElements.Pm) - // .hazard(HazardProperty.HazardType.RADIOACTIVE) + // .radioactiveHazard(1) .buildAndRegister(); Protactinium = new Material.Builder(GTCEu.id("protactinium")) .color(0xA78B6D).iconSet(RADIOACTIVE) .element(GTElements.Pa) - //.hazard(HazardProperty.HazardType.RADIOACTIVE) + // .radioactiveHazard(1) .buildAndRegister(); Radon = new Material.Builder(GTCEu.id("radon")) .gas() .color(0xFF39FF) .element(GTElements.Rn) - .hazard(HazardProperty.HazardType.RADIOACTIVE) + .radioactiveHazard(1) .buildAndRegister(); Radium = new Material.Builder(GTCEu.id("radium")) .color(0x838361).secondaryColor(0x90ff2d).iconSet(RADIOACTIVE) .element(GTElements.Ra) - //.hazard(HazardProperty.HazardType.RADIOACTIVE) + // .radioactiveHazard(1) .buildAndRegister(); Rhenium = new Material.Builder(GTCEu.id("rhenium")) @@ -775,7 +787,7 @@ public static void register() { Technetium = new Material.Builder(GTCEu.id("technetium")) .color(0xb1d0d8).secondaryColor(0xd7fce2).iconSet(RADIOACTIVE) .element(GTElements.Tc) - // .hazard(HazardProperty.HazardType.RADIOACTIVE) + // .radioactiveHazard(1) .buildAndRegister(); Tellurium = new Material.Builder(GTCEu.id("tellurium")) @@ -807,7 +819,7 @@ public static void register() { Thallium = new Material.Builder(GTCEu.id("thallium")) .color(0xc1c9de).secondaryColor(0x1e576a).iconSet(SHINY) .element(GTElements.Tl) - //.poison(PoisonProperty.PoisonType.CONTACT) + // .poison(PoisonProperty.PoisonType.CONTACT) .buildAndRegister(); Thulium = new Material.Builder(GTCEu.id("thulium")) @@ -821,7 +833,8 @@ public static void register() { .liquid(new FluidBuilder().temperature(505)) .ore() .color(0xfafeff).secondaryColor(0x4e676c) - .appendFlags(EXT2_METAL, MORTAR_GRINDABLE, GENERATE_ROTOR, GENERATE_SPRING, GENERATE_SPRING_SMALL, GENERATE_FINE_WIRE) + .appendFlags(EXT2_METAL, MORTAR_GRINDABLE, GENERATE_ROTOR, GENERATE_SPRING, GENERATE_SPRING_SMALL, + GENERATE_FINE_WIRE) .element(GTElements.Sn) .cableProperties(GTValues.V[1], 1, 1) .itemPipeProperties(4096, 0.5f) @@ -844,14 +857,15 @@ public static void register() { .color(0xff316b).secondaryColor(0xd00000) .iconSet(METALLIC) .element(GTElements.T) - .hazard(HazardProperty.HazardType.RADIOACTIVE) + .radioactiveHazard(1) .buildAndRegister(); Tungsten = new Material.Builder(GTCEu.id("tungsten")) .ingot(3) .liquid(new FluidBuilder().temperature(3695)) .color(0x3b3a32).secondaryColor(0x2a2800).iconSet(METALLIC) - .appendFlags(EXT2_METAL, GENERATE_SPRING, GENERATE_SPRING_SMALL, GENERATE_FOIL, GENERATE_GEAR, GENERATE_FRAME) + .appendFlags(EXT2_METAL, GENERATE_SPRING, GENERATE_SPRING_SMALL, GENERATE_FOIL, GENERATE_GEAR, + GENERATE_FRAME) .element(GTElements.W) .rotorStats(130, 115, 3.0f, 2560) .cableProperties(GTValues.V[5], 2, 2) @@ -865,7 +879,7 @@ public static void register() { .color(0x1d891d).secondaryColor(0x33342c).iconSet(RADIOACTIVE) .appendFlags(EXT_METAL) .element(GTElements.U238) - .hazard(HazardProperty.HazardType.RADIOACTIVE) + .radioactiveHazard(1) .buildAndRegister(); Uranium235 = new Material.Builder(GTCEu.id("uranium_235")) @@ -874,7 +888,7 @@ public static void register() { .color(0x46FA46).secondaryColor(0x33342c).iconSet(RADIOACTIVE) .appendFlags(EXT_METAL) .element(GTElements.U235) - .hazard(HazardProperty.HazardType.RADIOACTIVE) + .radioactiveHazard(1) .buildAndRegister(); Vanadium = new Material.Builder(GTCEu.id("vanadium")) @@ -926,6 +940,7 @@ public static void register() { .cableProperties(GTValues.V[7], 2, 2) .fluidPipeProperties(3776, 200, true, false, true, true) .blastTemp(5000, GasTier.HIGH, GTValues.VA[GTValues.IV], 600) + .radioactiveHazard(2) .buildAndRegister(); NaquadahEnriched = new Material.Builder(GTCEu.id("enriched_naquadah")) @@ -935,6 +950,7 @@ public static void register() { .appendFlags(EXT_METAL, GENERATE_FOIL) .element(GTElements.Nq1) .blastTemp(7000, GasTier.HIGH, GTValues.VA[GTValues.IV], 1000) + .radioactiveHazard(2.5f) .buildAndRegister(); Naquadria = new Material.Builder(GTCEu.id("naquadria")) @@ -944,6 +960,7 @@ public static void register() { .appendFlags(EXT_METAL, GENERATE_FOIL, GENERATE_GEAR, GENERATE_FINE_WIRE, GENERATE_BOLT_SCREW) .element(GTElements.Nq2) .blastTemp(9000, GasTier.HIGH, GTValues.VA[GTValues.ZPM], 1200) + .radioactiveHazard(3) .buildAndRegister(); Neutronium = new Material.Builder(GTCEu.id("neutronium")) @@ -956,16 +973,18 @@ public static void register() { .attackSpeed(0.5F).enchantability(33).magnetic().unbreakable().build()) .rotorStats(400, 250, 12.0f, 655360) .fluidPipeProperties(100_000, 5000, true, true, true, true) + .radioactiveHazard(10) .buildAndRegister(); Tritanium = new Material.Builder(GTCEu.id("tritanium")) .ingot(6) .liquid(new FluidBuilder().temperature(25_000)) .color(0xc35769).secondaryColor(0x210840).iconSet(METALLIC) - .appendFlags(EXT2_METAL, GENERATE_FRAME, GENERATE_RING, GENERATE_SMALL_GEAR, GENERATE_ROUND, GENERATE_FOIL, GENERATE_FINE_WIRE, GENERATE_GEAR) + .appendFlags(EXT2_METAL, GENERATE_FRAME, GENERATE_RING, GENERATE_SMALL_GEAR, GENERATE_ROUND, + GENERATE_FOIL, GENERATE_FINE_WIRE, GENERATE_GEAR) .element(GTElements.Tr) .cableProperties(GTValues.V[8], 1, 8) - .rotorStats(220,220, 6.0f, 10240) + .rotorStats(220, 220, 6.0f, 10240) .buildAndRegister(); Duranium = new Material.Builder(GTCEu.id("duranium")) @@ -987,6 +1006,5 @@ public static void register() { .cableProperties(GTValues.V[7], 6, 4) .blastTemp(7200, GasTier.HIGH, GTValues.VA[GTValues.LuV], 1500) .buildAndRegister(); - } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/materials/FirstDegreeMaterials.java b/src/main/java/com/gregtechceu/gtceu/common/data/materials/FirstDegreeMaterials.java index b352942510..d3396a9741 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/materials/FirstDegreeMaterials.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/materials/FirstDegreeMaterials.java @@ -11,6 +11,8 @@ import com.gregtechceu.gtceu.api.fluids.FluidState; import com.gregtechceu.gtceu.api.fluids.attribute.FluidAttributes; import com.gregtechceu.gtceu.api.item.tool.GTToolType; + +import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.item.enchantment.Enchantments; @@ -100,7 +102,8 @@ public static void register() { .ingot() .liquid(new FluidBuilder().temperature(1357)) .color(0xffc370).secondaryColor(0x806752).iconSet(METALLIC) - .appendFlags(EXT2_METAL, MORTAR_GRINDABLE, GENERATE_ROTOR, GENERATE_FRAME, GENERATE_SMALL_GEAR, GENERATE_FOIL, GENERATE_GEAR) + .appendFlags(EXT2_METAL, MORTAR_GRINDABLE, GENERATE_ROTOR, GENERATE_FRAME, GENERATE_SMALL_GEAR, + GENERATE_FOIL, GENERATE_GEAR) .components(Tin, 1, Copper, 3) .toolStats(ToolProperty.Builder.of(3.0F, 2.0F, 192, 2) .enchantability(18).addTypes(GTToolType.MORTAR).build()) @@ -140,7 +143,7 @@ public static void register() { .buildAndRegister(); Charcoal = new Material.Builder(GTCEu.id("charcoal")) - .gem(1, 1600) //default charcoal burn time in vanilla + .gem(1, 1600) // default charcoal burn time in vanilla .color(0x7d6f58).secondaryColor(0x13110d).iconSet(FINE) .flags(FLAMMABLE, NO_SMELTING, NO_SMASHING, MORTAR_GRINDABLE) .components(Carbon, 1) @@ -167,9 +170,10 @@ public static void register() { .buildAndRegister(); Coal = new Material.Builder(GTCEu.id("coal")) - .gem(1, 1600).ore(2, 1) //default coal burn time in vanilla + .gem(1, 1600).ore(2, 1) // default coal burn time in vanilla .color(0x393e41).secondaryColor(0x101015).iconSet(LIGNITE) - .flags(FLAMMABLE, NO_SMELTING, NO_SMASHING, MORTAR_GRINDABLE, EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES, DISABLE_DECOMPOSITION) + .flags(FLAMMABLE, NO_SMELTING, NO_SMASHING, MORTAR_GRINDABLE, EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES, + DISABLE_DECOMPOSITION) .components(Carbon, 1) .buildAndRegister(); @@ -225,7 +229,8 @@ public static void register() { Emerald = new Material.Builder(GTCEu.id("emerald")) .gem().ore(2, 1) .color(0x17ff6c).secondaryColor(0x003f00).iconSet(EMERALD) - .appendFlags(EXT_METAL, NO_SMASHING, NO_SMELTING, HIGH_SIFTER_OUTPUT, EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES, GENERATE_LENS) + .appendFlags(EXT_METAL, NO_SMASHING, NO_SMELTING, HIGH_SIFTER_OUTPUT, + EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES, GENERATE_LENS) .components(Beryllium, 3, Aluminium, 2, Silicon, 6, Oxygen, 18) .buildAndRegister(); @@ -313,7 +318,8 @@ public static void register() { Lazurite = new Material.Builder(GTCEu.id("lazurite")) .gem(1).ore(6, 4) .color(0x2836f1).secondaryColor(0x183ca3).iconSet(LAPIS) - .flags(GENERATE_PLATE, NO_SMASHING, NO_SMELTING, CRYSTALLIZABLE, GENERATE_ROD, DECOMPOSITION_BY_ELECTROLYZING) + .flags(GENERATE_PLATE, NO_SMASHING, NO_SMELTING, CRYSTALLIZABLE, GENERATE_ROD, + DECOMPOSITION_BY_ELECTROLYZING) .components(Aluminium, 6, Silicon, 6, Calcium, 8, Sodium, 8) .buildAndRegister(); @@ -484,13 +490,13 @@ public static void register() { .buildAndRegister(); RTMAlloy = new Material.Builder(GTCEu.id("rtm_alloy")) - .ingot().fluid() - .color(0x30306B).iconSet(SHINY) - .components(Ruthenium, 4, Tungsten, 2, Molybdenum, 1) - .flags(GENERATE_SPRING) - .cableProperties(V[EV],6,2) - .blastTemp(3000, GasTier.MID, GTValues.VA[GTValues.EV], 1400) - .buildAndRegister(); + .ingot().fluid() + .color(0x30306B).iconSet(SHINY) + .components(Ruthenium, 4, Tungsten, 2, Molybdenum, 1) + .flags(GENERATE_SPRING) + .cableProperties(V[EV], 6, 2) + .blastTemp(3000, GasTier.MID, GTValues.VA[GTValues.EV], 1400) + .buildAndRegister(); Ruridit = new Material.Builder(GTCEu.id("ruridit")) .ingot(3) @@ -539,7 +545,8 @@ public static void register() { Sodalite = new Material.Builder(GTCEu.id("sodalite")) .gem(1).ore(6, 4) .color(0x3d54ff).secondaryColor(0x210d78).iconSet(LAPIS) - .flags(GENERATE_PLATE, GENERATE_ROD, NO_SMASHING, NO_SMELTING, CRYSTALLIZABLE, DECOMPOSITION_BY_ELECTROLYZING) + .flags(GENERATE_PLATE, GENERATE_ROD, NO_SMASHING, NO_SMELTING, CRYSTALLIZABLE, + DECOMPOSITION_BY_ELECTROLYZING) .components(Aluminium, 3, Silicon, 3, Sodium, 4, Chlorine, 1) .buildAndRegister(); @@ -586,7 +593,8 @@ public static void register() { .ingot(3) .liquid(new FluidBuilder().temperature(2011)) .color(0xededfd).secondaryColor(0x19191d).iconSet(SHINY) - .appendFlags(EXT2_METAL, GENERATE_ROTOR, GENERATE_SMALL_GEAR, GENERATE_FRAME, GENERATE_LONG_ROD, GENERATE_FOIL, GENERATE_GEAR) + .appendFlags(EXT2_METAL, GENERATE_ROTOR, GENERATE_SMALL_GEAR, GENERATE_FRAME, GENERATE_LONG_ROD, + GENERATE_FOIL, GENERATE_GEAR) .components(Iron, 6, Chromium, 1, Manganese, 1, Nickel, 1) .toolStats(ToolProperty.Builder.of(7.0F, 5.0F, 1024, 3) .enchantability(14).build()) @@ -689,7 +697,8 @@ public static void register() { .ingot() .liquid(new FluidBuilder().temperature(2011)) .color(0xbcbcbc).secondaryColor(0x521c0b).iconSet(METALLIC) - .appendFlags(EXT_METAL, GENERATE_GEAR, GENERATE_FOIL, MORTAR_GRINDABLE, GENERATE_RING, GENERATE_LONG_ROD, GENERATE_BOLT_SCREW, DISABLE_DECOMPOSITION, BLAST_FURNACE_CALCITE_TRIPLE) + .appendFlags(EXT_METAL, GENERATE_GEAR, GENERATE_FOIL, MORTAR_GRINDABLE, GENERATE_RING, + GENERATE_LONG_ROD, GENERATE_BOLT_SCREW, DISABLE_DECOMPOSITION, BLAST_FURNACE_CALCITE_TRIPLE) .components(Iron, 1) .toolStats(ToolProperty.Builder.of(2.0F, 2.0F, 384, 2) .addTypes(GTToolType.MORTAR) @@ -716,7 +725,8 @@ public static void register() { .ingot() .liquid(new FluidBuilder().temperature(1799)) .color(0x796d72).secondaryColor(0x260a3a).iconSet(METALLIC) - .appendFlags(EXT_METAL, GENERATE_FINE_WIRE, GENERATE_SPRING, GENERATE_SPRING_SMALL, GENERATE_FOIL, GENERATE_BOLT_SCREW) + .appendFlags(EXT_METAL, GENERATE_FINE_WIRE, GENERATE_SPRING, GENERATE_SPRING_SMALL, GENERATE_FOIL, + GENERATE_BOLT_SCREW) .components(Yttrium, 1, Barium, 2, Copper, 3, Oxygen, 7) .cableProperties(GTValues.V[8], 4, 4) .blastTemp(4500, GasTier.HIGH) // todo redo this EBF process @@ -725,7 +735,8 @@ public static void register() { NetherQuartz = new Material.Builder(GTCEu.id("nether_quartz")) .gem(1).ore(2, 1) .color(0xf8efe3).secondaryColor(0xe6c1bb).iconSet(QUARTZ) - .flags(GENERATE_PLATE, NO_SMELTING, CRYSTALLIZABLE, EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES, DISABLE_DECOMPOSITION) + .flags(GENERATE_PLATE, NO_SMELTING, CRYSTALLIZABLE, EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES, + DISABLE_DECOMPOSITION) .components(Silicon, 1, Oxygen, 2) .buildAndRegister(); @@ -769,7 +780,8 @@ public static void register() { .ingot(3) .liquid(new FluidBuilder().temperature(3012)) .color(0xe5dcef).secondaryColor(0x241a44).iconSet(METALLIC) - .appendFlags(EXT2_METAL, GENERATE_SMALL_GEAR, GENERATE_RING, GENERATE_ROTOR, GENERATE_ROUND, GENERATE_FINE_WIRE, GENERATE_GEAR) + .appendFlags(EXT2_METAL, GENERATE_SMALL_GEAR, GENERATE_RING, GENERATE_ROTOR, GENERATE_ROUND, + GENERATE_FINE_WIRE, GENERATE_GEAR) .components(Iridium, 3, Osmium, 1) .rotorStats(130, 130, 3.0f, 3152) .itemPipeProperties(64, 32) @@ -867,7 +879,9 @@ public static void register() { .dust(1) .color(0xecfff3).secondaryColor(0x7d8e83) .components(Calcium, 1, Oxygen, 1) - .hazard(HazardProperty.HazardType.CORROSIVE,new HazardProperty.HazardEffect(5000, MobEffects.WEAKNESS, MobEffects.DIG_SLOWDOWN), new HazardProperty.HazardDamage(2,1)) + .hazard(HazardProperty.HazardType.CORROSIVE, + new HazardProperty.HazardEffect(5000, () -> new MobEffectInstance(MobEffects.WEAKNESS, 1), + () -> new MobEffectInstance(MobEffects.DIG_SLOWDOWN, 1))) .buildAndRegister(); SodiumBisulfate = new Material.Builder(GTCEu.id("sodium_bisulfate")) @@ -920,7 +934,7 @@ public static void register() { .dust(1) .color(0xFFE4E1) .components(Chromium, 1, Oxygen, 3) - .hazard(HazardProperty.HazardType.CONTACT_POISON) + .irritantHazard(true) .buildAndRegister(); AntimonyTrioxide = new Material.Builder(GTCEu.id("antimony_trioxide")) @@ -976,7 +990,9 @@ public static void register() { .color(0xf5feff).secondaryColor(0xa4ebf1) .flags(DISABLE_DECOMPOSITION) .components(Sodium, 1, Oxygen, 1, Hydrogen, 1) - .hazard(HazardProperty.HazardType.CORROSIVE, new HazardProperty.HazardEffect(5000, MobEffects.WEAKNESS, MobEffects.DIG_SLOWDOWN), new HazardProperty.HazardDamage(2, 1)) + .hazard(HazardProperty.HazardType.CORROSIVE, + new HazardProperty.HazardEffect(5000, () -> new MobEffectInstance(MobEffects.WEAKNESS, 1), + () -> new MobEffectInstance(MobEffects.DIG_SLOWDOWN, 1))) .buildAndRegister(); SodiumPersulfate = new Material.Builder(GTCEu.id("sodium_persulfate")) @@ -1070,7 +1086,8 @@ public static void register() { TungstenCarbide = new Material.Builder(GTCEu.id("tungsten_carbide")) .ingot(4).fluid() .color(0x6b6478).secondaryColor(0x392e44).iconSet(METALLIC) - .appendFlags(EXT2_METAL, GENERATE_FOIL, GENERATE_GEAR, GENERATE_SMALL_GEAR, GENERATE_FRAME, DECOMPOSITION_BY_CENTRIFUGING) + .appendFlags(EXT2_METAL, GENERATE_FOIL, GENERATE_GEAR, GENERATE_SMALL_GEAR, GENERATE_FRAME, + DECOMPOSITION_BY_CENTRIFUGING) .components(Tungsten, 1, Carbon, 1) .toolStats(ToolProperty.Builder.of(60.0F, 2.0F, 1024, 4) .enchantability(21).build()) @@ -1179,6 +1196,13 @@ public static void register() { .components(Iron, 1, Chlorine, 3) .buildAndRegister(); + Iron2Chloride = new Material.Builder(GTCEu.id("iron_ii_chloride")) + .fluid() + .color(0xe8e0be) + .flags(DECOMPOSITION_BY_ELECTROLYZING) + .components(Iron, 1, Chlorine, 2) + .buildAndRegister(); + UraniumHexafluoride = new Material.Builder(GTCEu.id("uranium_hexafluoride")) .gas() .color(0x42D126) @@ -1344,7 +1368,8 @@ public static void register() { .buildAndRegister() .setFormula("URhNq2", true); - EnrichedNaquadahTriniumEuropiumDuranide = new Material.Builder(GTCEu.id("enriched_naquadah_trinium_europium_duranide")) + EnrichedNaquadahTriniumEuropiumDuranide = new Material.Builder( + GTCEu.id("enriched_naquadah_trinium_europium_duranide")) .ingot() .liquid(new FluidBuilder().temperature(5930)) .color(0xc5c1a4).secondaryColor(0x2b0645).iconSet(METALLIC) @@ -1475,8 +1500,162 @@ public static void register() { Pyrochlore = new Material.Builder(GTCEu.id("pyrochlore")) .dust().ore() .color(0x5b4838).secondaryColor(0x331400).iconSet(METALLIC) - .flags() .components(Calcium, 2, Niobium, 2, Oxygen, 7) .buildAndRegister(); + + PotassiumHydroxide = new Material.Builder(GTCEu.id("potassium_hydroxide")) + .dust(1) + .color(0xd1c299).secondaryColor(0x85623a).iconSet(METALLIC) + .hazard(HazardProperty.HazardType.CORROSIVE, + new HazardProperty.HazardEffect(5000, () -> new MobEffectInstance(MobEffects.WEAKNESS, 1), + () -> new MobEffectInstance(MobEffects.DIG_SLOWDOWN, 1))) + .components(Potassium, 1, Oxygen, 1, Hydrogen, 1) + .buildAndRegister(); + + PotassiumIodide = new Material.Builder(GTCEu.id("potassium_iodide")) + .dust() + .color(0xa66c71).secondaryColor(0x802d67).iconSet(METALLIC) + .components(Potassium, 1, Iodine, 1) + .buildAndRegister(); + + PotassiumCarbonate = new Material.Builder(GTCEu.id("potassium_carbonate")) + .dust() + .color(0xa66c71).secondaryColor(0x802d67).iconSet(METALLIC) + .components(Potassium, 2, Carbon, 1, Oxygen, 3) + .buildAndRegister(); + + PotassiumFerrocyanide = new Material.Builder(GTCEu.id("potassium_ferrocyanide")) + .dust() + .color(0xc9a842).secondaryColor(0x947110).iconSet(DULL) + .components(Potassium, 4, Iron, 1, Carbon, 6, Nitrogen, 6) + .buildAndRegister() + .setFormula("K4[Fe(CN)6]", true); + + CalciumFerrocyanide = new Material.Builder(GTCEu.id("calcium_ferrocyanide")) + .dust() + .color(0xc9a842).secondaryColor(0x947110).iconSet(DULL) + .components(Calcium, 2, Iron, 1, Carbon, 6, Nitrogen, 6) + .buildAndRegister() + .setFormula("Ca2[Fe(CN)6]", true); + + CalciumHydroxide = new Material.Builder(GTCEu.id("calcium_hydroxide")) + .dust() + .color(0x72dbd4).secondaryColor(0x138a80).iconSet(ROUGH) + .components(Calcium, 1, Oxygen, 2, Hydrogen, 2) + .buildAndRegister() + .setFormula("Ca(OH)2", true); + + CalciumCarbonate = new Material.Builder(GTCEu.id("calcium_carbonate")) + .dust() + .color(0xd9ca9c).secondaryColor(0xad913b) + .components(Calcium, 2, Carbon, 1, Oxygen, 3) + .buildAndRegister(); + + PotassiumCyanide = new Material.Builder(GTCEu.id("potassium_cyanide")) + .dust() + .color(0x93badb).secondaryColor(0x0c5696).iconSet(ROUGH) + .components(Potassium, 1, Carbon, 1, Nitrogen, 1) + .hazard(HazardProperty.HazardType.INHALATION_POISON, HazardProperty.poisonEffect(100, 0, 4), true) + .buildAndRegister(); + + HydrogenCyanide = new Material.Builder(GTCEu.id("hydrogen_cyanide")) + .gas() + .color(0x72dbd4) + .components(Hydrogen, 1, Carbon, 1, Nitrogen, 1) + .hazard(HazardProperty.HazardType.INHALATION_POISON, HazardProperty.poisonEffect(100, 0, 4), true) + .buildAndRegister(); + + FormicAcid = new Material.Builder(GTCEu.id("formic_acid")) + .gas() + .color(0xa6a6a6) + .components(Carbon, 1, Hydrogen, 2, Oxygen, 2) + .hazard(HazardProperty.HazardType.INHALATION_POISON) + .buildAndRegister(); + + PotassiumSulfate = new Material.Builder(GTCEu.id("potassium_sulfate")) + .dust() + .color(0xebab34).secondaryColor(0xb5570e) + .flags(DECOMPOSITION_BY_ELECTROLYZING) + .components(Potassium, 1, Sulfur, 1, Oxygen, 4) + .buildAndRegister(); + + PrussianBlue = new Material.Builder(GTCEu.id("prussian_blue")) + .dust() + .color(0x102e5e).secondaryColor(0x010c42) + .flags(DISABLE_DECOMPOSITION) + .components(Iron, 7, Carbon, 18, Nitrogen, 18) + .buildAndRegister() + .setFormula("Fe4[Fe(CN)6]3", true); + + Formaldehyde = new Material.Builder(GTCEu.id("formaldehyde")) + .liquid() + .color(0xddeced) + .flags(DECOMPOSITION_BY_ELECTROLYZING) + .components(Carbon, 1, Hydrogen, 2, Oxygen, 1) + .hazard(HazardProperty.HazardType.INHALATION_POISON) + .buildAndRegister(); + + Glycolonitrile = new Material.Builder(GTCEu.id("glycolonitrile")) + .liquid() + .color(0x5b8c8f) + .flags(DISABLE_DECOMPOSITION) + .components(Carbon, 2, Hydrogen, 3, Nitrogen, 1, Oxygen, 1) + .buildAndRegister(); + + AcidicBromineSolution = new Material.Builder(GTCEu.id("acidic_bromine_solution")) + .liquid() + .color(0xc49b52) + .components(Chlorine, 1, Bromine, 1) + .flags(DISABLE_DECOMPOSITION) + .buildAndRegister(); + + ConcentratedBromineSolution = new Material.Builder(GTCEu.id("concentrated_bromine_solution")) + .liquid() + .color(0x91481e) + .components(Bromine, 2, Chlorine, 1) + .flags(DISABLE_DECOMPOSITION) + .buildAndRegister(); + + Iodide = new Material.Builder(GTCEu.id("iodide")) + .liquid() + .color(0x5f6173) + .components(Iodine, 2) + .flags(DISABLE_DECOMPOSITION) + .buildAndRegister(); + + IodineSolution = new Material.Builder(GTCEu.id("iodine_solution")) + .liquid() + .color(0x9194a3) + .components(Hydrogen, 1, Iodine, 1) + .flags(DISABLE_DECOMPOSITION) + .buildAndRegister(); + + DiluteIodineSolution = new Material.Builder(GTCEu.id("dilute_iodine_solution")) + .liquid() + .color(0x8187a6) + .components(Hydrogen, 1, Iodine, 1) + .flags(DISABLE_DECOMPOSITION) + .buildAndRegister(); + + DiethylenetriaminePentaacetonitrile = new Material.Builder(GTCEu.id("diethylenetriamine_pentaacetonitrile")) + .liquid() + .color(0xcbbfd6) + .flags(DISABLE_DECOMPOSITION) + .components(Carbon, 14, Hydrogen, 18, Nitrogen, 8) + .buildAndRegister(); + + DiethylenetriaminepentaaceticAcid = new Material.Builder(GTCEu.id("diethylenetriaminepentaacetic_acid")) + .dust() + .color(0xe8c93c).secondaryColor(0xc99118) + .flags(DISABLE_DECOMPOSITION) + .components(Carbon, 14, Hydrogen, 23, Nitrogen, 3, Oxygen, 10) + .buildAndRegister(); + + SodiumNitrite = new Material.Builder(GTCEu.id("sodium_nitrite")) + .dust() + .color(0xcfbf65).secondaryColor(0x85600b) + .flags(DECOMPOSITION_BY_ELECTROLYZING) + .components(Sodium, 1, Nitrogen, 1, Oxygen, 2) + .buildAndRegister(); } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/materials/GCyMMaterials.java b/src/main/java/com/gregtechceu/gtceu/common/data/materials/GCyMMaterials.java index 73a5427213..258f7f9554 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/materials/GCyMMaterials.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/materials/GCyMMaterials.java @@ -12,7 +12,6 @@ public class GCyMMaterials { public static void register() { - TantalumCarbide = new Material.Builder(GTCEu.id("tantalum_carbide")) .ingot(4).fluid() .color(0x999900).iconSet(METALLIC) @@ -72,7 +71,7 @@ public static void register() { HastelloyX = new Material.Builder(GTCEu.id("hastelloy_x")) .ingot(5).fluid() .color(0x5784B8).iconSet(METALLIC) - .appendFlags(STD_METAL, GENERATE_PLATE, GENERATE_FRAME) + .appendFlags(STD_METAL, GENERATE_PLATE, GENERATE_FRAME) .components(Nickel, 8, Iron, 3, Tungsten, 4, Molybdenum, 2, Chromium, 1, Niobium, 1) .blastTemp(4200, GasTier.HIGH, GTValues.VA[GTValues.EV], 900) .buildAndRegister(); diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/materials/GTFoods.java b/src/main/java/com/gregtechceu/gtceu/common/data/materials/GTFoods.java index ed5d37f573..b75bbadea5 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/materials/GTFoods.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/materials/GTFoods.java @@ -10,6 +10,7 @@ * @implNote GTFoods */ public class GTFoods { + public final static FoodProperties CHOCOLATE = new FoodProperties.Builder() .effect(() -> new MobEffectInstance(MobEffects.MOVEMENT_SPEED, 200, 1), 0.1f) .alwaysEat().nutrition(4).saturationMod(0.3F).build(); @@ -18,8 +19,8 @@ public class GTFoods { .effect(() -> new MobEffectInstance(MobEffects.HEAL, 200, 1), 0.1f) .alwaysEat().nutrition(4).saturationMod(0.3F).build(); - public static void init() { - - } + public static final FoodProperties ANTIDOTE = new FoodProperties.Builder() + .alwaysEat().fast().build(); + public static void init() {} } diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/materials/HigherDegreeMaterials.java b/src/main/java/com/gregtechceu/gtceu/common/data/materials/HigherDegreeMaterials.java index ed950c3039..aa1874e643 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/materials/HigherDegreeMaterials.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/materials/HigherDegreeMaterials.java @@ -6,7 +6,6 @@ import com.gregtechceu.gtceu.api.data.chemical.material.properties.BlastProperty.GasTier; import com.gregtechceu.gtceu.api.data.chemical.material.properties.ToolProperty; import com.gregtechceu.gtceu.api.fluids.FluidBuilder; -import com.gregtechceu.gtceu.api.fluids.store.FluidStorageKeys; import static com.gregtechceu.gtceu.api.data.chemical.material.info.MaterialFlags.*; import static com.gregtechceu.gtceu.api.data.chemical.material.info.MaterialIconSet.*; @@ -15,7 +14,6 @@ public class HigherDegreeMaterials { public static void register() { - Electrotine = new Material.Builder(GTCEu.id("electrotine")) .dust().ore(5, 1, true) .color(0x83cbf5).secondaryColor(0x004585).iconSet(SHINY) @@ -86,7 +84,8 @@ public static void register() { HSSG = new Material.Builder(GTCEu.id("hssg")) .ingot(3).fluid() .color(0x9cbabe).secondaryColor(0x032550).iconSet(METALLIC) - .appendFlags(EXT2_METAL, GENERATE_SMALL_GEAR, GENERATE_FRAME, GENERATE_SPRING, GENERATE_FINE_WIRE, GENERATE_FOIL, GENERATE_GEAR) + .appendFlags(EXT2_METAL, GENERATE_SMALL_GEAR, GENERATE_FRAME, GENERATE_SPRING, GENERATE_FINE_WIRE, + GENERATE_FOIL, GENERATE_GEAR) .components(TungstenSteel, 5, Chromium, 1, Molybdenum, 2, Vanadium, 1) .rotorStats(205, 140, 5.5f, 4000) .cableProperties(GTValues.V[6], 4, 2) @@ -123,7 +122,8 @@ public static void register() { HSSS = new Material.Builder(GTCEu.id("hsss")) .ingot(4).fluid() .color(0xae9abe).secondaryColor(0x66000e).iconSet(METALLIC) - .appendFlags(EXT2_METAL, GENERATE_SMALL_GEAR, GENERATE_RING, GENERATE_FRAME, GENERATE_ROTOR, GENERATE_ROUND, GENERATE_FOIL, GENERATE_GEAR) + .appendFlags(EXT2_METAL, GENERATE_SMALL_GEAR, GENERATE_RING, GENERATE_FRAME, GENERATE_ROTOR, + GENERATE_ROUND, GENERATE_FOIL, GENERATE_GEAR) .components(HSSG, 6, Iridium, 2, Osmium, 1) .rotorStats(250, 180, 7.0f, 3000) .blastTemp(5000, GasTier.HIGH, GTValues.VA[GTValues.EV], 1500) @@ -165,6 +165,34 @@ public static void register() { .components(Mirabilite, 2, Clay, 7) .buildAndRegister(); + HotBrine = new Material.Builder(GTCEu.id("hot_brine")) + .liquid(320) + .color(0xbe6026) + .components(RawBrine, 1) + .flags(DISABLE_DECOMPOSITION) + .buildAndRegister(); + + HotChlorinatedBrominatedBrine = new Material.Builder(GTCEu.id("hot_chlorinated_brominated_brine")) + .liquid(320) + .color(0xab765d) + .components(HotBrine, 1, Chlorine, 1) + .flags(DISABLE_DECOMPOSITION) + .buildAndRegister(); + + HotDebrominatedBrine = new Material.Builder(GTCEu.id("hot_debrominated_brine")) + .liquid(320) + .color(0xab896d) + .components(DebrominatedBrine, 1) + .flags(DISABLE_DECOMPOSITION) + .buildAndRegister(); + + HotAlkalineDebrominatedBrine = new Material.Builder(GTCEu.id("hot_alkaline_debrominated_brine")) + .liquid(320) + .color(0xbe8938) + .components(HotDebrominatedBrine, 2, Chlorine, 1) + .flags(DISABLE_DECOMPOSITION) + .buildAndRegister(); + BlueAlloy = new Material.Builder(GTCEu.id("blue_alloy")) .ingot() .liquid(new FluidBuilder().temperature(1400)) @@ -173,5 +201,12 @@ public static void register() { .components(Electrotine, 4, Silver, 1) .cableProperties(GTValues.V[GTValues.HV], 2, 1) .buildAndRegister(); + + RadAway = new Material.Builder(GTCEu.id("rad_away")) + .dust() + .color(0xe3a1d7).secondaryColor(0x9845a3).iconSet(ROUGH) + .flags(DECOMPOSITION_BY_CENTRIFUGING) + .components(PotassiumIodide, 5, PrussianBlue, 3, DiethylenetriaminepentaaceticAcid, 5) + .buildAndRegister(); } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/materials/MaterialFlagAddition.java b/src/main/java/com/gregtechceu/gtceu/common/data/materials/MaterialFlagAddition.java index 2fda96dbfb..733f32db73 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/materials/MaterialFlagAddition.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/materials/MaterialFlagAddition.java @@ -40,12 +40,12 @@ public static void register() { oreProp = Molybdenum.getProperty(PropertyKey.ORE); oreProp.setOreByProducts(Molybdenum); - //oreProp = Magnesium.getProperty(PropertyKey.ORE); - //oreProp.setOreByProducts(Olivine); + // oreProp = Magnesium.getProperty(PropertyKey.ORE); + // oreProp.setOreByProducts(Olivine); - //oreProp = Manganese.getProperty(PropertyKey.ORE); - //oreProp.setOreByProducts(Chrome, Iron); - //oreProp.setSeparatedInto(Iron); + // oreProp = Manganese.getProperty(PropertyKey.ORE); + // oreProp.setOreByProducts(Chrome, Iron); + // oreProp.setSeparatedInto(Iron); oreProp = Neodymium.getProperty(PropertyKey.ORE); oreProp.setOreByProducts(RareEarth); @@ -62,8 +62,8 @@ public static void register() { oreProp = Plutonium239.getProperty(PropertyKey.ORE); oreProp.setOreByProducts(Uraninite, Lead, Uraninite); - //oreProp = Silicon.getProperty(PropertyKey.ORE); - //oreProp.setOreByProducts(SiliconDioxide); + // oreProp = Silicon.getProperty(PropertyKey.ORE); + // oreProp.setOreByProducts(SiliconDioxide); oreProp = Silver.getProperty(PropertyKey.ORE); oreProp.setOreByProducts(Lead, Sulfur, Sulfur, Gold); @@ -80,11 +80,11 @@ public static void register() { oreProp.setSeparatedInto(Iron); oreProp.setWashedIn(SodiumPersulfate); - //oreProp = Titanium.getProperty(PropertyKey.ORE); - //oreProp.setOreByProducts(Almandine); + // oreProp = Titanium.getProperty(PropertyKey.ORE); + // oreProp.setOreByProducts(Almandine); - //oreProp = Tungsten.getProperty(PropertyKey.ORE); - //oreProp.setOreByProducts(Manganese, Molybdenum); + // oreProp = Tungsten.getProperty(PropertyKey.ORE); + // oreProp.setOreByProducts(Manganese, Molybdenum); oreProp = Naquadah.getProperty(PropertyKey.ORE); oreProp.setOreByProducts(Sulfur, Barite, NaquadahEnriched); diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/materials/OrganicChemistryMaterials.java b/src/main/java/com/gregtechceu/gtceu/common/data/materials/OrganicChemistryMaterials.java index a141c6ff9c..0d1b1dcd9c 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/materials/OrganicChemistryMaterials.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/materials/OrganicChemistryMaterials.java @@ -7,6 +7,8 @@ import com.gregtechceu.gtceu.api.fluids.FluidBuilder; import com.gregtechceu.gtceu.api.fluids.attribute.FluidAttributes; import com.gregtechceu.gtceu.api.item.tool.GTToolType; + +import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffects; import static com.gregtechceu.gtceu.api.data.chemical.material.info.MaterialFlags.*; @@ -15,6 +17,7 @@ import static com.gregtechceu.gtceu.common.data.GTMaterials.*; public class OrganicChemistryMaterials { + /** * ID RANGE: 1000-1068 (incl.) */ @@ -101,7 +104,8 @@ public static void register() { .liquid(new FluidBuilder().temperature(1450)) .color(0x464441).secondaryColor(0x382e1b) .flags(EXCLUDE_BLOCK_CRAFTING_RECIPES, GENERATE_FOIL) - .toolStats(ToolProperty.Builder.of(1.0F, 1.0F, 128, 1, GTToolType.SOFT_MALLET, GTToolType.PLUNGER).build()) + .toolStats( + ToolProperty.Builder.of(1.0F, 1.0F, 128, 1, GTToolType.SOFT_MALLET, GTToolType.PLUNGER).build()) .components(Carbon, 20, Hydrogen, 12, Nitrogen, 4) .fluidPipeProperties(1000, 350, true) .buildAndRegister(); @@ -118,7 +122,8 @@ public static void register() { .liquid(new FluidBuilder().temperature(408)) .color(0xC8C8C8) .flags(GENERATE_FOIL) - .toolStats(ToolProperty.Builder.of(1.0F, 1.0F, 128, 1, GTToolType.SOFT_MALLET, GTToolType.PLUNGER).build()) + .toolStats( + ToolProperty.Builder.of(1.0F, 1.0F, 128, 1, GTToolType.SOFT_MALLET, GTToolType.PLUNGER).build()) .components(Carbon, 2, Hydrogen, 4) .fluidPipeProperties(370, 60, true) .buildAndRegister(); @@ -144,7 +149,8 @@ public static void register() { .liquid(new FluidBuilder().temperature(600)) .color(0xFFFFFF).secondaryColor(0x919187) .appendFlags(STD_METAL, GENERATE_FRAME, GENERATE_FOIL) - .toolStats(ToolProperty.Builder.of(1.0F, 1.0F, 128, 1, GTToolType.SOFT_MALLET, GTToolType.PLUNGER).build()) + .toolStats( + ToolProperty.Builder.of(1.0F, 1.0F, 128, 1, GTToolType.SOFT_MALLET, GTToolType.PLUNGER).build()) .components(Carbon, 2, Fluorine, 4) .fluidPipeProperties(600, 100, true, true, false, false) .buildAndRegister(); @@ -158,7 +164,7 @@ public static void register() { Methane = new Material.Builder(GTCEu.id("methane")) .gas(new FluidBuilder() - .translation("gtceu.fluid.gas_generic")) + .translation("gtceu.fluid.gas_generic")) .color(0xFF0078) .components(Carbon, 1, Hydrogen, 4) .buildAndRegister(); @@ -396,13 +402,14 @@ public static void register() { .fluid() .color(0xAA8800) .components(Carbon, 1, Hydrogen, 4, Oxygen, 1) - .hazard(HazardProperty.HazardType.INHALATION_POISON, new HazardProperty.HazardEffect(200,MobEffects.BLINDNESS)) + .hazard(HazardProperty.HazardType.INHALATION_POISON, HazardProperty.blindnessEffect(200, 200, 3)) .buildAndRegister(); Ethanol = new Material.Builder(GTCEu.id("ethanol")) .liquid(new FluidBuilder().customStill()) .flags(DISABLE_DECOMPOSITION) - .hazard(HazardProperty.HazardType.INHALATION_POISON, new HazardProperty.HazardEffect(200,MobEffects.CONFUSION)) + .hazard(HazardProperty.HazardType.INHALATION_POISON, + new HazardProperty.HazardEffect(200, () -> new MobEffectInstance(MobEffects.CONFUSION, 1))) .components(Carbon, 2, Hydrogen, 6, Oxygen, 1) .buildAndRegister(); @@ -498,7 +505,8 @@ public static void register() { .polymer(0) .liquid(new FluidBuilder().temperature(400)) .color(0x353529).secondaryColor(0x080808) - .toolStats(ToolProperty.Builder.of(1.0F, 1.0F, 128, 1, GTToolType.SOFT_MALLET, GTToolType.PLUNGER).build()) + .toolStats( + ToolProperty.Builder.of(1.0F, 1.0F, 128, 1, GTToolType.SOFT_MALLET, GTToolType.PLUNGER).build()) .flags(GENERATE_GEAR, GENERATE_RING, GENERATE_FOIL, GENERATE_BOLT_SCREW) .components(Carbon, 5, Hydrogen, 8) .buildAndRegister(); @@ -563,5 +571,42 @@ public static void register() { .hazard(HazardProperty.HazardType.INHALATION_POISON) .buildAndRegister() .setFormula("(C6H4Cl)2", true); + + AceticAnhydride = new Material.Builder(GTCEu.id("acetic_anhydride")) + .fluid() + .color(0xE0D182) + .flags(DISABLE_DECOMPOSITION) + .components(Carbon, 4, Hydrogen, 6, Oxygen, 3) + .buildAndRegister() + .setFormula("(CH3CO)2O", true); + + AminoPhenol = new Material.Builder(GTCEu.id("aminophenol")) + .fluid() + .color(0x784421) + .flags(DISABLE_DECOMPOSITION) + .components(Carbon, 6, Hydrogen, 7, Nitrogen, 1, Oxygen, 1) + .buildAndRegister() + .setFormula("H2NC6H4OH", true); + + Paracetamol = new Material.Builder(GTCEu.id("paracetamol")) + .dust() + .color(0xF2EDCB) + .flags(DISABLE_DECOMPOSITION) + .components(Carbon, 8, Hydrogen, 9, Nitrogen, 1, Oxygen, 2) + .buildAndRegister(); + + AmmoniumFormate = new Material.Builder(GTCEu.id("ammonium_formate")) + .gas() + .color(0x93badb) + .components(Carbon, 1, Hydrogen, 5, Nitrogen, 1, Oxygen, 2) + .hazard(HazardProperty.HazardType.INHALATION_POISON) + .buildAndRegister(); + + Formamide = new Material.Builder(GTCEu.id("formamide")) + .liquid() + .color(0x5cccb6) + .components(Carbon, 1, Hydrogen, 3, Nitrogen, 1, Oxygen, 1) + .hazard(HazardProperty.HazardType.INHALATION_POISON) + .buildAndRegister(); } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/materials/SecondDegreeMaterials.java b/src/main/java/com/gregtechceu/gtceu/common/data/materials/SecondDegreeMaterials.java index 9dda806b44..e60d37b4a4 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/materials/SecondDegreeMaterials.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/materials/SecondDegreeMaterials.java @@ -10,6 +10,7 @@ import com.gregtechceu.gtceu.api.fluids.FluidBuilder; import com.gregtechceu.gtceu.api.fluids.attribute.FluidAttributes; import com.gregtechceu.gtceu.api.item.tool.GTToolType; + import net.minecraft.world.item.enchantment.Enchantments; import static com.gregtechceu.gtceu.api.data.chemical.material.info.MaterialFlags.*; @@ -19,7 +20,6 @@ public class SecondDegreeMaterials { public static void register() { - Glass = new Material.Builder(GTCEu.id("glass")) .gem(0) .liquid(new FluidBuilder() @@ -37,11 +37,11 @@ public static void register() { .buildAndRegister(); ActivatedCarbon = new Material.Builder(GTCEu.id("activated_carbon")) - .dust(1) - .color(0x212125).secondaryColor(0x15151a) - .components(Carbon, 1) - .flags(DECOMPOSITION_BY_CENTRIFUGING) - .buildAndRegister(); + .dust(1) + .color(0x212125).secondaryColor(0x15151a) + .components(Carbon, 1) + .flags(DECOMPOSITION_BY_CENTRIFUGING) + .buildAndRegister(); Borax = new Material.Builder(GTCEu.id("borax")) .dust(1) @@ -80,7 +80,8 @@ public static void register() { Lapis = new Material.Builder(GTCEu.id("lapis")) .gem(1).ore(6, 4) .color(0x85a9ff).secondaryColor(0x2a7fff).iconSet(LAPIS) - .flags(NO_SMASHING, NO_SMELTING, CRYSTALLIZABLE, NO_WORKING, DECOMPOSITION_BY_ELECTROLYZING, EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES, + .flags(NO_SMASHING, NO_SMELTING, CRYSTALLIZABLE, NO_WORKING, DECOMPOSITION_BY_ELECTROLYZING, + EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES, GENERATE_PLATE, GENERATE_ROD) .components(Lazurite, 12, Sodalite, 2, Pyrite, 1, Calcite, 1) .buildAndRegister(); @@ -91,7 +92,7 @@ public static void register() { .temperature(4000) .customStill()) .color(0xfff94d, false).secondaryColor(0xff330c).iconSet(FINE) - .flags(NO_SMELTING, MORTAR_GRINDABLE, DECOMPOSITION_BY_CENTRIFUGING) //todo burning flag + .flags(NO_SMELTING, MORTAR_GRINDABLE, DECOMPOSITION_BY_CENTRIFUGING) // todo burning flag .components(DarkAsh, 1, Sulfur, 1) .buildAndRegister(); @@ -127,7 +128,8 @@ public static void register() { TungstenSteel = new Material.Builder(GTCEu.id("tungsten_steel")) .ingot(4).fluid() .color(0xadb8df).secondaryColor(0x03192f).iconSet(METALLIC) - .appendFlags(EXT2_METAL, GENERATE_ROTOR, GENERATE_SMALL_GEAR, GENERATE_DENSE, GENERATE_FRAME, GENERATE_SPRING, GENERATE_FOIL, GENERATE_FINE_WIRE, GENERATE_GEAR) + .appendFlags(EXT2_METAL, GENERATE_ROTOR, GENERATE_SMALL_GEAR, GENERATE_DENSE, GENERATE_FRAME, + GENERATE_SPRING, GENERATE_FOIL, GENERATE_FINE_WIRE, GENERATE_GEAR) .components(Steel, 1, Tungsten, 1) .toolStats(ToolProperty.Builder.of(9.0F, 7.0F, 2048, 4) .enchantability(14).build()) @@ -320,12 +322,14 @@ public static void register() { .color(0xa8aa9a).iconSet(ROUGH) .flags(DECOMPOSITION_BY_CENTRIFUGING) .components(Asbestos, 4, Saltpeter, 1) + .hazard(HazardProperty.HazardType.NONE) .buildAndRegister(); NaquadahAlloy = new Material.Builder(GTCEu.id("naquadah_alloy")) .ingot(5).fluid() .color(0x323232).secondaryColor(0x301131).iconSet(METALLIC) - .appendFlags(EXT2_METAL, GENERATE_SPRING, GENERATE_RING, GENERATE_ROTOR, GENERATE_SMALL_GEAR, GENERATE_FRAME, GENERATE_DENSE, GENERATE_FOIL, GENERATE_GEAR) + .appendFlags(EXT2_METAL, GENERATE_SPRING, GENERATE_RING, GENERATE_ROTOR, GENERATE_SMALL_GEAR, + GENERATE_FRAME, GENERATE_DENSE, GENERATE_FOIL, GENERATE_GEAR) .components(Naquadah, 2, Osmiridium, 1, Trinium, 1) .toolStats(ToolProperty.Builder.of(40.0F, 12.0F, 3072, 5) .attackSpeed(0.3F).enchantability(33).magnetic().build()) @@ -379,7 +383,8 @@ public static void register() { .flags(NO_SMASHING, MORTAR_GRINDABLE, DECOMPOSITION_BY_CENTRIFUGING) .components(SiliconDioxide, 1) .toolStats(ToolProperty.Builder.of(1.5F, 1.0F, 64, 2) - .types(GTToolType.MORTAR, GTToolType.KNIFE, GTToolType.AXE, GTToolType.PICKAXE, GTToolType.HOE, GTToolType.SWORD, GTToolType.SHOVEL) + .types(GTToolType.MORTAR, GTToolType.KNIFE, GTToolType.AXE, GTToolType.PICKAXE, GTToolType.HOE, + GTToolType.SWORD, GTToolType.SHOVEL) .enchantability(5).ignoreCraftingTools() .enchantment(Enchantments.FIRE_ASPECT, 2).build()) .buildAndRegister(); @@ -410,7 +415,8 @@ public static void register() { .liquid(new FluidBuilder().temperature(58)) .color(0x4C3434) .flags(DISABLE_DECOMPOSITION) - .components(CarbonMonoxide, 144, CoalGas, 20, HydrogenSulfide, 15, SulfurDioxide, 15, Helium3, 5, Neon, 1, Ash, 1) + .components(CarbonMonoxide, 144, CoalGas, 20, HydrogenSulfide, 15, SulfurDioxide, 15, Helium3, 5, Neon, + 1, Ash, 1) .buildAndRegister(); EnderAir = new Material.Builder(GTCEu.id("ender_air")) @@ -424,7 +430,8 @@ public static void register() { .liquid(new FluidBuilder().temperature(36)) .color(0x283454) .flags(DISABLE_DECOMPOSITION) - .components(NitrogenDioxide, 122, Deuterium, 50, Helium, 15, Tritium, 10, Krypton, 1, Xenon, 1, Radon, 1, EnderPearl, 1) + .components(NitrogenDioxide, 122, Deuterium, 50, Helium, 15, Tritium, 10, Krypton, 1, Xenon, 1, Radon, + 1, EnderPearl, 1) .buildAndRegister(); AquaRegia = new Material.Builder(GTCEu.id("aqua_regia")) @@ -494,5 +501,47 @@ public static void register() { .components(Silicon, 1, Pyrite, 5, Ruby, 1, Mercury, 3) .hazard(HazardProperty.HazardType.NONE) .buildAndRegister(); + + Dichloroethane = new Material.Builder(GTCEu.id("dichloroethane")) + .liquid() + .color(0xafc979) + .flags(DECOMPOSITION_BY_ELECTROLYZING) + .components(Carbon, 2, Hydrogen, 4, Chlorine, 2) + .buildAndRegister(); + + Diethylenetriamine = new Material.Builder(GTCEu.id("diethylenetriamine")) + .liquid() + .color(0xa9d9a7) + .flags(DISABLE_DECOMPOSITION) + .components(Carbon, 4, Hydrogen, 13, Nitrogen, 3) + .hazard(HazardProperty.HazardType.CONTACT_POISON) + .buildAndRegister(); + + RawBrine = new Material.Builder(GTCEu.id("raw_brine")) + .liquid() + .color(0x9f6b26) + .components(Water, 4, Salt, 20, Magnesium, 3, Lithium, 2, Bromine, 1) + .flags(DISABLE_DECOMPOSITION) + .buildAndRegister(); + + DebrominatedBrine = new Material.Builder(GTCEu.id("debrominated_brine")) + .liquid() + .color(0xab8c6d) + .components(Water, 4, Salt, 20, Magnesium, 3, Lithium, 2) + .flags(DECOMPOSITION_BY_ELECTROLYZING) + .buildAndRegister(); + + BrominatedChlorineVapor = new Material.Builder(GTCEu.id("brominated_chlorine_vapor")) + .gas() + .color(0xbb9b72) + .components(Chlorine, 1, Bromine, 1, Steam, 1) + .flags(DISABLE_DECOMPOSITION) + .buildAndRegister(); + + AcidicBromineExhaust = new Material.Builder(GTCEu.id("acidic_bromine_exhaust")) + .gas() + .color(0x8f681e) + .components(Steam, 3, Chlorine, 1) + .buildAndRegister(); } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/materials/UnknownCompositionMaterials.java b/src/main/java/com/gregtechceu/gtceu/common/data/materials/UnknownCompositionMaterials.java index 5aefc69536..3daa931ec7 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/materials/UnknownCompositionMaterials.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/materials/UnknownCompositionMaterials.java @@ -15,7 +15,6 @@ public class UnknownCompositionMaterials { public static void register() { - WoodGas = new Material.Builder(GTCEu.id("wood_gas")) .gas() .color(0xDECD87).secondaryColor(0xdeb287) @@ -365,7 +364,8 @@ public static void register() { .dust(1) .liquid(new FluidBuilder().temperature(500)) .color(0xfcb34c).secondaryColor(0xce7533).iconSet(SHINY) - .flags(NO_SMASHING, GENERATE_PLATE, EXCLUDE_PLATE_COMPRESSOR_RECIPE, EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES) + .flags(NO_SMASHING, GENERATE_PLATE, EXCLUDE_PLATE_COMPRESSOR_RECIPE, + EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES) .buildAndRegister(); NetherStar = new Material.Builder(GTCEu.id("nether_star")) @@ -435,7 +435,8 @@ public static void register() { .color(0xc29f6d).secondaryColor(0x643200).iconSet(WOOD) .fluidPipeProperties(340, 5, false) .toolStats(ToolProperty.Builder.of(1.0F, 1.0F, 128, 1, GTToolType.SOFT_MALLET).build()) - .flags(GENERATE_PLATE, GENERATE_ROD, GENERATE_BOLT_SCREW, GENERATE_LONG_ROD, FLAMMABLE, GENERATE_GEAR, GENERATE_FRAME) + .flags(GENERATE_PLATE, GENERATE_ROD, GENERATE_BOLT_SCREW, GENERATE_LONG_ROD, FLAMMABLE, GENERATE_GEAR, + GENERATE_FRAME) .buildAndRegister(); Paper = new Material.Builder(GTCEu.id("paper")) @@ -556,6 +557,7 @@ public static void register() { PCBCoolant = new Material.Builder(GTCEu.id("pcb_coolant")) .fluid().color(0xD5D69C) - .hazard(HazardProperty.HazardType.INHALATION_POISON).buildAndRegister(); + .hazard(HazardProperty.HazardType.INHALATION_POISON) + .buildAndRegister(); } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/effect/GTPoisonEffect.java b/src/main/java/com/gregtechceu/gtceu/common/effect/GTPoisonEffect.java new file mode 100644 index 0000000000..ed0185175f --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/common/effect/GTPoisonEffect.java @@ -0,0 +1,29 @@ +package com.gregtechceu.gtceu.common.effect; + +import net.minecraft.world.effect.MobEffect; +import net.minecraft.world.effect.MobEffectCategory; +import net.minecraft.world.entity.LivingEntity; + +public class GTPoisonEffect extends MobEffect { + + public GTPoisonEffect(MobEffectCategory category, int color) { + super(category, color); + } + + @Override + public void applyEffectTick(LivingEntity livingEntity, int amplifier) { + if (livingEntity.getHealth() > 1.0F) { + livingEntity.hurt(livingEntity.damageSources().magic(), amplifier / 10.0F); + } + } + + @Override + public boolean isDurationEffectTick(int duration, int amplifier) { + int j = 25 >> amplifier; + if (j > 0) { + return duration % j == 0; + } else { + return true; + } + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/entity/DynamiteEntity.java b/src/main/java/com/gregtechceu/gtceu/common/entity/DynamiteEntity.java index 4791402c18..5d0587d16c 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/entity/DynamiteEntity.java +++ b/src/main/java/com/gregtechceu/gtceu/common/entity/DynamiteEntity.java @@ -2,9 +2,8 @@ import com.gregtechceu.gtceu.common.data.GTEntityTypes; import com.gregtechceu.gtceu.common.data.GTItems; -import net.minecraft.core.Direction; + import net.minecraft.core.particles.ParticleTypes; -import net.minecraft.util.Mth; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; @@ -13,6 +12,7 @@ import net.minecraft.world.level.Level; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.Vec3; + import org.jetbrains.annotations.NotNull; public class DynamiteEntity extends ThrowableItemProjectile { @@ -57,17 +57,19 @@ public void tick() { ticksUntilExplosion--; if (level().random.nextInt(3) == 2) { - level().addParticle(ParticleTypes.SMOKE, this.getX(), this.getY(), this.getZ(), -this.getDeltaMovement().x * 0.05f, - this.onGround() ? 0.05f : -this.getDeltaMovement().y * 0.05f, -this.getDeltaMovement().z * 0.05f); + level().addParticle(ParticleTypes.SMOKE, this.getX(), this.getY(), this.getZ(), + -this.getDeltaMovement().x * 0.05f, + this.onGround() ? 0.05f : -this.getDeltaMovement().y * 0.05f, -this.getDeltaMovement().z * 0.05f); } if (ticksUntilExplosion < 0 && !level().isClientSide) { Entity thrower = getOwner(); - level().explode(thrower == null ? this : thrower, this.getX(), this.getY(), this.getZ(), 1.5f, Level.ExplosionInteraction.TNT); + level().explode(thrower == null ? this : thrower, this.getX(), this.getY(), this.getZ(), 1.5f, + Level.ExplosionInteraction.TNT); this.discard(); return; } super.tick(); } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/entity/GTExplosiveEntity.java b/src/main/java/com/gregtechceu/gtceu/common/entity/GTExplosiveEntity.java index 564253182e..478b669124 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/entity/GTExplosiveEntity.java +++ b/src/main/java/com/gregtechceu/gtceu/common/entity/GTExplosiveEntity.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.common.entity; import com.gregtechceu.gtceu.core.mixins.PrimedTntAccessor; + import net.minecraft.network.protocol.game.ClientboundExplodePacket; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; @@ -12,11 +13,14 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockState; import net.minecraftforge.event.ForgeEventFactory; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public abstract class GTExplosiveEntity extends PrimedTnt { - public GTExplosiveEntity(EntityType type, Level level, double x, double y, double z, @Nullable LivingEntity owner) { + + public GTExplosiveEntity(EntityType type, Level level, double x, double y, double z, + @Nullable LivingEntity owner) { this(type, level); this.setPos(x, y, z); double d = level.random.nextDouble() * (float) (Math.PI * 2); @@ -25,7 +29,7 @@ public GTExplosiveEntity(EntityType type, Level lev this.xo = x; this.yo = y; this.zo = z; - ((PrimedTntAccessor)this).setOwner(owner); + ((PrimedTntAccessor) this).setOwner(owner); } public GTExplosiveEntity(EntityType type, Level world) { @@ -60,26 +64,26 @@ protected void explode() { } protected void explode( - Level level, @Nullable Entity source, - double x, double y, double z, float radius, boolean dropBlocks) { + Level level, @Nullable Entity source, + double x, double y, double z, float radius, boolean dropBlocks) { Explosion explosion = new Explosion( - level, source, - x, y, z, - radius, - false, - dropBlocks ? Explosion.BlockInteraction.DESTROY_WITH_DECAY : Explosion.BlockInteraction.DESTROY - ); + level, source, + x, y, z, + radius, + false, + dropBlocks ? Explosion.BlockInteraction.DESTROY_WITH_DECAY : Explosion.BlockInteraction.DESTROY); if (!ForgeEventFactory.onExplosionStart(level, explosion)) { explosion.explode(); explosion.finalizeExplosion(false); } if (level instanceof ServerLevel serverLevel) { - for(ServerPlayer serverplayer : serverLevel.players()) { + for (ServerPlayer serverplayer : serverLevel.players()) { if (serverplayer.distanceToSqr(x, y, z) < 4096.0) { - serverplayer.connection.send(new ClientboundExplodePacket(x, y, z, radius, explosion.getToBlow(), explosion.getHitPlayers().get(serverplayer))); + serverplayer.connection.send(new ClientboundExplodePacket(x, y, z, radius, explosion.getToBlow(), + explosion.getHitPlayers().get(serverplayer))); } } } } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/entity/IndustrialTNTEntity.java b/src/main/java/com/gregtechceu/gtceu/common/entity/IndustrialTNTEntity.java index 300cafd237..a8a0a1903a 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/entity/IndustrialTNTEntity.java +++ b/src/main/java/com/gregtechceu/gtceu/common/entity/IndustrialTNTEntity.java @@ -2,14 +2,17 @@ import com.gregtechceu.gtceu.common.data.GTBlocks; import com.gregtechceu.gtceu.common.data.GTEntityTypes; + import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockState; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class IndustrialTNTEntity extends GTExplosiveEntity { + public IndustrialTNTEntity(Level world, double x, double y, double z, @Nullable LivingEntity owner) { super(GTEntityTypes.INDUSTRIAL_TNT.get(), world, x, y, z, owner); } diff --git a/src/main/java/com/gregtechceu/gtceu/common/entity/PowderbarrelEntity.java b/src/main/java/com/gregtechceu/gtceu/common/entity/PowderbarrelEntity.java index ec0ceace4a..94873878c9 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/entity/PowderbarrelEntity.java +++ b/src/main/java/com/gregtechceu/gtceu/common/entity/PowderbarrelEntity.java @@ -2,14 +2,17 @@ import com.gregtechceu.gtceu.common.data.GTBlocks; import com.gregtechceu.gtceu.common.data.GTEntityTypes; + import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockState; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class PowderbarrelEntity extends GTExplosiveEntity { + public PowderbarrelEntity(Level world, double x, double y, double z, @Nullable LivingEntity owner) { super(GTEntityTypes.POWDERBARREL.get(), world, x, y, z, owner); } diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/AntidoteBehavior.java b/src/main/java/com/gregtechceu/gtceu/common/item/AntidoteBehavior.java new file mode 100644 index 0000000000..1f152f64e3 --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/common/item/AntidoteBehavior.java @@ -0,0 +1,104 @@ +package com.gregtechceu.gtceu.common.item; + +import com.gregtechceu.gtceu.api.capability.GTCapabilityHelper; +import com.gregtechceu.gtceu.api.capability.IHazardEffectTracker; +import com.gregtechceu.gtceu.api.data.chemical.material.Material; +import com.gregtechceu.gtceu.api.data.chemical.material.properties.HazardProperty; +import com.gregtechceu.gtceu.api.data.chemical.material.properties.PropertyKey; +import com.gregtechceu.gtceu.api.item.component.IAddInformation; +import com.gregtechceu.gtceu.api.item.component.IInteractionItem; +import com.gregtechceu.gtceu.config.ConfigHolder; +import com.gregtechceu.gtceu.utils.GTUtil; + +import net.minecraft.network.chat.Component; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.level.Level; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +/** + * Defines an antidote for a hazard (e.g. poisoning) + * + * @param types the type of the hazard to remove + * @param removePercent the time to remove from the chosen hazard, as a percentage of the current time [0, 100]. + * -1 for all. + */ +public record AntidoteBehavior(Set types, int removePercent) + implements IInteractionItem, IAddInformation { + + public AntidoteBehavior(int timeToRemove, HazardProperty.HazardType... types) { + this(new HashSet<>(), timeToRemove); + this.types.addAll(Arrays.asList(types)); + } + + @Override + public ItemStack finishUsingItem(ItemStack stack, Level level, LivingEntity livingEntity) { + ItemStack itemstack = IInteractionItem.super.finishUsingItem(stack, level, livingEntity); + IHazardEffectTracker tracker = GTCapabilityHelper.getHazardEffectTracker(livingEntity); + if (tracker == null) { + return itemstack; + } + var iterator = tracker.getCurrentHazards().object2IntEntrySet().iterator(); + while (iterator.hasNext()) { + var entry = iterator.next(); + if (entry.getKey() == null) { + continue; + } + HazardProperty.HazardType type = getHazardTypeFromMaterial(entry.getKey()); + if (type == null || !this.types.contains(type)) { + continue; + } + if (removePercent == -1) { + iterator.remove(); + } else { + int time = entry.getIntValue(); + float timeToRemove = time * (removePercent / 100.0f); + if (timeToRemove > 0.05f * time) { + iterator.remove(); + continue; + } + entry.setValue((int) (time - timeToRemove)); + } + } + return itemstack; + } + + @Nullable + public static HazardProperty.HazardType getHazardTypeFromMaterial(@NotNull Material material) { + HazardProperty property = material.getProperty(PropertyKey.HAZARD); + if (property == null) { + return null; + } + return property.getHazardType(); + } + + @Override + public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltipComponents, + TooltipFlag isAdvanced) { + if (!ConfigHolder.INSTANCE.gameplay.hazardsEnabled) return; + + if (GTUtil.isShiftDown()) { + tooltipComponents.add(Component.translatable("gtceu.hazard.antidote.description_shift")); + for (var type : types) { + tooltipComponents.add(Component + .translatable("gtceu.hazard." + type.getSerializedName())); + } + if (removePercent == -1) { + tooltipComponents.add(Component.translatable("gtceu.hazard.antidote.description.effect_removed.all")); + } else { + tooltipComponents + .add(Component.translatable("gtceu.hazard.antidote.description.effect_removed", removePercent)); + } + return; + } + tooltipComponents.add(Component.translatable("gtceu.hazard.antidote.description")); + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/ColorSprayBehaviour.java b/src/main/java/com/gregtechceu/gtceu/common/item/ColorSprayBehaviour.java index ce41846f28..10d75c431d 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/ColorSprayBehaviour.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/ColorSprayBehaviour.java @@ -1,13 +1,10 @@ package com.gregtechceu.gtceu.common.item; -import appeng.api.util.AEColor; -import appeng.blockentity.networking.CableBusBlockEntity; -import com.google.common.collect.ImmutableMap; import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.blockentity.PipeBlockEntity; -import com.gregtechceu.gtceu.api.item.component.IDurabilityBar; import com.gregtechceu.gtceu.api.item.component.IAddInformation; +import com.gregtechceu.gtceu.api.item.component.IDurabilityBar; import com.gregtechceu.gtceu.api.item.component.IInteractionItem; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; import com.gregtechceu.gtceu.api.machine.MetaMachine; @@ -15,7 +12,9 @@ import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.data.recipe.CustomTags; import com.gregtechceu.gtceu.utils.GradientUtil; + import com.lowdragmc.lowdraglib.Platform; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.registries.BuiltInRegistries; @@ -40,6 +39,10 @@ import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.Property; + +import appeng.api.util.AEColor; +import appeng.blockentity.networking.CableBusBlockEntity; +import com.google.common.collect.ImmutableMap; import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.Nullable; @@ -53,6 +56,7 @@ * @implNote ColorSprayBehaviour */ public class ColorSprayBehaviour implements IDurabilityBar, IInteractionItem, IAddInformation { + // vanilla private static final ImmutableMap GLASS_MAP; private static final ImmutableMap GLASS_PANE_MAP; @@ -87,30 +91,40 @@ private static ResourceLocation getId(String modid, DyeColor color, String postf for (DyeColor color : DyeColor.values()) { // if there are > 16 colors (vanilla end) & tinted is loaded, use tinted blocks if (color.ordinal() > 15 && Platform.isModLoaded(GTValues.MODID_TINTED)) { - glassBuilder.put(color, BuiltInRegistries.BLOCK.get(getId(GTValues.MODID_TINTED, color, "stained_glass"))); - glassPaneBuilder.put(color, BuiltInRegistries.BLOCK.get(getId(GTValues.MODID_TINTED, color, "stained_glass_pane"))); - terracottaBuilder.put(color, BuiltInRegistries.BLOCK.get(getId(GTValues.MODID_TINTED, color, "terracotta"))); + glassBuilder.put(color, + BuiltInRegistries.BLOCK.get(getId(GTValues.MODID_TINTED, color, "stained_glass"))); + glassPaneBuilder.put(color, + BuiltInRegistries.BLOCK.get(getId(GTValues.MODID_TINTED, color, "stained_glass_pane"))); + terracottaBuilder.put(color, + BuiltInRegistries.BLOCK.get(getId(GTValues.MODID_TINTED, color, "terracotta"))); woolBuilder.put(color, BuiltInRegistries.BLOCK.get(getId(GTValues.MODID_TINTED, color, "wool"))); carpetBuilder.put(color, BuiltInRegistries.BLOCK.get(getId(GTValues.MODID_TINTED, color, "carpet"))); - concreteBuilder.put(color, BuiltInRegistries.BLOCK.get(getId(GTValues.MODID_TINTED, color, "concrete"))); - concretePowderBuilder.put(color, BuiltInRegistries.BLOCK.get(getId(GTValues.MODID_TINTED, color, "concrete_powder"))); - shulkerBoxBuilder.put(color, BuiltInRegistries.BLOCK.get(getId(GTValues.MODID_TINTED, color, "shulker_box"))); + concreteBuilder.put(color, + BuiltInRegistries.BLOCK.get(getId(GTValues.MODID_TINTED, color, "concrete"))); + concretePowderBuilder.put(color, + BuiltInRegistries.BLOCK.get(getId(GTValues.MODID_TINTED, color, "concrete_powder"))); + shulkerBoxBuilder.put(color, + BuiltInRegistries.BLOCK.get(getId(GTValues.MODID_TINTED, color, "shulker_box"))); candleBuilder.put(color, BuiltInRegistries.BLOCK.get(getId(GTValues.MODID_TINTED, color, "candle"))); } else { glassBuilder.put(color, BuiltInRegistries.BLOCK.get(getId("minecraft", color, "stained_glass"))); - glassPaneBuilder.put(color, BuiltInRegistries.BLOCK.get(getId("minecraft", color, "stained_glass_pane"))); + glassPaneBuilder.put(color, + BuiltInRegistries.BLOCK.get(getId("minecraft", color, "stained_glass_pane"))); terracottaBuilder.put(color, BuiltInRegistries.BLOCK.get(getId("minecraft", color, "terracotta"))); woolBuilder.put(color, BuiltInRegistries.BLOCK.get(getId("minecraft", color, "wool"))); carpetBuilder.put(color, BuiltInRegistries.BLOCK.get(getId("minecraft", color, "carpet"))); concreteBuilder.put(color, BuiltInRegistries.BLOCK.get(getId("minecraft", color, "concrete"))); - concretePowderBuilder.put(color, BuiltInRegistries.BLOCK.get(getId("minecraft", color, "concrete_powder"))); + concretePowderBuilder.put(color, + BuiltInRegistries.BLOCK.get(getId("minecraft", color, "concrete_powder"))); shulkerBoxBuilder.put(color, BuiltInRegistries.BLOCK.get(getId("minecraft", color, "shulker_box"))); candleBuilder.put(color, BuiltInRegistries.BLOCK.get(getId("minecraft", color, "candle"))); - /* somehow didn't want to work, it seems registry isn't fully loaded yet (forge) so `BuiltInRegistries.BLOCK.getId` returns air for modded blocks - if (GTCEu.isCreateLoaded()) { - seatBuilder.put(color, BuiltInRegistries.BLOCK.get(getId(GTValues.MODID_CREATE, color, "seat"))); - } + /* + * somehow didn't want to work, it seems registry isn't fully loaded yet (forge) so + * `BuiltInRegistries.BLOCK.getId` returns air for modded blocks + * if (GTCEu.isCreateLoaded()) { + * seatBuilder.put(color, BuiltInRegistries.BLOCK.get(getId(GTValues.MODID_CREATE, color, "seat"))); + * } */ } } @@ -127,13 +141,11 @@ private static ResourceLocation getId(String modid, DyeColor color, String postf SEAT_MAP = seatBuilder.build(); } - private final Supplier empty; private final DyeColor color; public final int totalUses; private final Pair durabilityBarColors; - public ColorSprayBehaviour(Supplier empty, int totalUses, int color) { this.empty = empty; DyeColor[] colors = DyeColor.values(); @@ -178,10 +190,12 @@ private static int mixColors(float ratio, int... colors) { } @Override - public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltipComponents, TooltipFlag isAdvanced) { + public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltipComponents, + TooltipFlag isAdvanced) { int remainingUses = getUsesLeft(stack); if (color != null) { - tooltipComponents.add(Component.translatable("behaviour.paintspray." + this.color.getSerializedName() + ".tooltip")); + tooltipComponents + .add(Component.translatable("behaviour.paintspray." + this.color.getSerializedName() + ".tooltip")); } else { tooltipComponents.add(Component.translatable("behaviour.paintspray.solvent.tooltip")); } @@ -197,7 +211,8 @@ public InteractionResult useOn(UseOnContext context) { var stack = context.getItemInHand(); var block = level.getBlockState(pos).getBlock(); - int maxBlocksToRecolor = Math.max(1, player != null && player.isShiftKeyDown() ? ConfigHolder.INSTANCE.tools.sprayCanChainLength : 1); + int maxBlocksToRecolor = Math.max(1, + player != null && player.isShiftKeyDown() ? ConfigHolder.INSTANCE.tools.sprayCanChainLength : 1); if (player != null) { for (int i = 0; i < maxBlocksToRecolor; i++) { @@ -243,7 +258,7 @@ private boolean tryPaintBlock(Player player, Level world, BlockPos pos, Directio return recolorBlockState(world, pos, side, this.color) || tryPaintSpecialBlock(player, world, pos, block); } - @SuppressWarnings({"rawtypes", "unchecked"}) + @SuppressWarnings({ "rawtypes", "unchecked" }) private static boolean recolorBlockState(Level level, BlockPos pos, Direction side, DyeColor color) { BlockState state = level.getBlockState(pos); for (Property property : state.getProperties()) { @@ -302,12 +317,13 @@ private boolean tryPaintSpecialBlock(Player player, Level world, BlockPos pos, B } } - /* somehow didn't want to work - if (GTCEu.isCreateLoaded() && block.defaultBlockState().is(CustomTags.CREATE_SEATS)) { - if (recolorBlockNoState(SEAT_MAP, this.color, world, pos)) { - return true; - } - } + /* + * somehow didn't want to work + * if (GTCEu.isCreateLoaded() && block.defaultBlockState().is(CustomTags.CREATE_SEATS)) { + * if (recolorBlockNoState(SEAT_MAP, this.color, world, pos)) { + * return true; + * } + * } */ // MTE special case @@ -346,8 +362,9 @@ private static boolean recolorBlockNoState(Map map, DyeColor co return recolorBlockNoState(map, color, world, pos, null); } - @SuppressWarnings({"rawtypes", "unchecked"}) - private static boolean recolorBlockNoState(Map map, DyeColor color, Level world, BlockPos pos, Block _default) { + @SuppressWarnings({ "rawtypes", "unchecked" }) + private static boolean recolorBlockNoState(Map map, DyeColor color, Level world, BlockPos pos, + Block _default) { Block newBlock = map.getOrDefault(color, _default); BlockState old = world.getBlockState(pos); if (newBlock == Blocks.AIR) newBlock = _default; @@ -363,7 +380,7 @@ private static boolean recolorBlockNoState(Map map, DyeColor co return false; } - @SuppressWarnings({"rawtypes", "unchecked"}) + @SuppressWarnings({ "rawtypes", "unchecked" }) private static boolean tryStripBlockColor(Player player, Level world, BlockPos pos, Block block, Direction side) { // MC special cases if (block instanceof StainedGlassBlock) { @@ -403,12 +420,13 @@ private static boolean tryStripBlockColor(Player player, Level world, BlockPos p return true; } - /* somehow didn't want to work - if (GTCEu.isCreateLoaded() && block.defaultBlockState().is(CustomTags.CREATE_SEATS)) { - if (recolorBlockNoState(SEAT_MAP, DyeColor.WHITE, world, pos, AllBlocks.SEATS.get(DyeColor.WHITE).get())) { - return true; - } - } + /* + * somehow didn't want to work + * if (GTCEu.isCreateLoaded() && block.defaultBlockState().is(CustomTags.CREATE_SEATS)) { + * if (recolorBlockNoState(SEAT_MAP, DyeColor.WHITE, world, pos, AllBlocks.SEATS.get(DyeColor.WHITE).get())) { + * return true; + * } + * } */ // MTE special case @@ -470,10 +488,10 @@ public boolean useItemDurability(Player player, InteractionHand hand, ItemStack if (!player.isCreative()) { if (--usesLeft <= 0) { if (replacementStack.isEmpty()) { - //if replacement stack is empty, just shrink resulting stack + // if replacement stack is empty, just shrink resulting stack stack.shrink(1); } else { - //otherwise, update held item to replacement stack + // otherwise, update held item to replacement stack player.setItemInHand(hand, replacementStack); } return false; diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/ConsumedBehaviour.java b/src/main/java/com/gregtechceu/gtceu/common/item/ConsumedBehaviour.java index 6a3b355b77..8c9affd49d 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/ConsumedBehaviour.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/ConsumedBehaviour.java @@ -12,6 +12,7 @@ * @implNote ConsumedBehaviour */ public abstract class ConsumedBehaviour { + public final int totalUses; public ConsumedBehaviour(int totalUses) { @@ -23,10 +24,10 @@ public boolean useItemDurability(Player player, InteractionHand hand, ItemStack if (!player.isCreative()) { if (--usesLeft <= 0) { if (replacementStack.isEmpty()) { - //if replacement stack is empty, just shrink resulting stack + // if replacement stack is empty, just shrink resulting stack stack.shrink(1); } else { - //otherwise, update held item to replacement stack + // otherwise, update held item to replacement stack player.setItemInHand(hand, replacementStack); } return true; @@ -51,5 +52,4 @@ public static void setUsesLeft(ItemStack itemStack, int usesLeft) { } tagCompound.putInt("GT.UsesLeft", usesLeft); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/CoverPlaceBehavior.java b/src/main/java/com/gregtechceu/gtceu/common/item/CoverPlaceBehavior.java index 4f2badbd03..dc67b2d6a0 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/CoverPlaceBehavior.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/CoverPlaceBehavior.java @@ -7,6 +7,7 @@ import com.gregtechceu.gtceu.api.item.component.IInteractionItem; import com.gregtechceu.gtceu.api.item.component.IItemComponent; import com.gregtechceu.gtceu.api.item.tool.GTToolType; + import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.InteractionResult; import net.minecraft.world.item.Item; @@ -14,6 +15,7 @@ import net.minecraft.world.item.context.UseOnContext; import org.jetbrains.annotations.Nullable; + import java.util.function.BooleanSupplier; import java.util.function.Predicate; @@ -33,7 +35,8 @@ public InteractionResult onItemUseFirst(ItemStack itemStack, UseOnContext contex ICoverable coverable = GTCapabilityHelper.getCoverable(level, pos, face); if (coverable != null) { var coverSide = ICoverable.rayTraceCoverableSide(coverable, player); - if (coverSide != null && coverable.getCoverAtSide(coverSide) == null && coverable.canPlaceCoverOnSide(coverDefinition, coverSide)) { + if (coverSide != null && coverable.getCoverAtSide(coverSide) == null && + coverable.canPlaceCoverOnSide(coverDefinition, coverSide)) { if (player instanceof ServerPlayer serverPlayer) { boolean result = coverable.placeCoverOnSide(coverSide, itemStack, coverDefinition, serverPlayer); if (result && !player.isCreative()) { @@ -47,7 +50,8 @@ public InteractionResult onItemUseFirst(ItemStack itemStack, UseOnContext contex return InteractionResult.PASS; } - public static boolean isCoverBehaviorItem(ItemStack itemStack, @Nullable BooleanSupplier hasCoverSupplier, @Nullable Predicate canPlaceCover) { + public static boolean isCoverBehaviorItem(ItemStack itemStack, @Nullable BooleanSupplier hasCoverSupplier, + @Nullable Predicate canPlaceCover) { Item item = itemStack.getItem(); if (item instanceof IComponentItem componentItem) { for (IItemComponent component : componentItem.getComponents()) { @@ -57,10 +61,11 @@ public static boolean isCoverBehaviorItem(ItemStack itemStack, @Nullable Boolean } } } - } else if (GTToolType.CROWBAR.itemTags.stream().anyMatch(itemStack::is) || GTToolType.SOFT_MALLET.itemTags.stream().anyMatch(itemStack::is) || GTToolType.SCREWDRIVER.itemTags.stream().anyMatch(itemStack::is)) { - return hasCoverSupplier == null || hasCoverSupplier.getAsBoolean(); - } + } else if (GTToolType.CROWBAR.itemTags.stream().anyMatch(itemStack::is) || + GTToolType.SOFT_MALLET.itemTags.stream().anyMatch(itemStack::is) || + GTToolType.SCREWDRIVER.itemTags.stream().anyMatch(itemStack::is)) { + return hasCoverSupplier == null || hasCoverSupplier.getAsBoolean(); + } return false; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/DataItemBehavior.java b/src/main/java/com/gregtechceu/gtceu/common/item/DataItemBehavior.java index 97a3c20e6c..908dfc3e93 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/DataItemBehavior.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/DataItemBehavior.java @@ -6,12 +6,14 @@ import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.GTRecipeType; import com.gregtechceu.gtceu.utils.ResearchManager; -import com.mojang.datafixers.util.Pair; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import net.minecraft.network.chat.Component; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.level.Level; + +import com.mojang.datafixers.util.Pair; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import org.jetbrains.annotations.Nullable; import java.util.Collection; @@ -35,7 +37,8 @@ public boolean requireDataBank() { } @Override - public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltipComponents, TooltipFlag isAdvanced) { + public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltipComponents, + TooltipFlag isAdvanced) { Pair researchData = ResearchManager.readResearchId(stack); if (researchData == null) return; Collection recipes = researchData.getFirst().getDataStickEntry(researchData.getSecond()); @@ -43,11 +46,13 @@ public void appendHoverText(ItemStack stack, @Nullable Level level, List added = new ObjectOpenHashSet<>(); for (GTRecipe recipe : recipes) { - ItemStack output = ItemRecipeCapability.CAP.of(recipe.getOutputContents(ItemRecipeCapability.CAP).get(0).content).getItems()[0]; + ItemStack output = ItemRecipeCapability.CAP + .of(recipe.getOutputContents(ItemRecipeCapability.CAP).get(0).content).getItems()[0]; if (added.add(output)) { - tooltipComponents.add(Component.translatable("behavior.data_item.assemblyline.data", output.getDisplayName())); + tooltipComponents.add( + Component.translatable("behavior.data_item.assemblyline.data", output.getDisplayName())); } } } } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/DynamiteBehaviour.java b/src/main/java/com/gregtechceu/gtceu/common/item/DynamiteBehaviour.java index 574fab0577..f4bcff2055 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/DynamiteBehaviour.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/DynamiteBehaviour.java @@ -2,6 +2,7 @@ import com.gregtechceu.gtceu.api.item.component.IInteractionItem; import com.gregtechceu.gtceu.common.entity.DynamiteEntity; + import net.minecraft.Util; import net.minecraft.core.Position; import net.minecraft.core.dispenser.AbstractProjectileDispenseBehavior; @@ -19,9 +20,11 @@ public class DynamiteBehaviour implements IInteractionItem { @Override public void onAttached(Item item) { DispenserBlock.registerBehavior(item, new AbstractProjectileDispenseBehavior() { + @Override protected Projectile getProjectile(Level level, Position position, ItemStack stack) { - return Util.make(new DynamiteEntity(position.x(), position.y(), position.z(), level), entity -> entity.setItem(stack)); + return Util.make(new DynamiteEntity(position.x(), position.y(), position.z(), level), + entity -> entity.setItem(stack)); } }); } @@ -45,4 +48,4 @@ public InteractionResultHolder use(Item item, Level level, Player pla return InteractionResultHolder.success(itemstack); } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/FacadeItemBehaviour.java b/src/main/java/com/gregtechceu/gtceu/common/item/FacadeItemBehaviour.java index cfdfdc82fa..91250c341a 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/FacadeItemBehaviour.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/FacadeItemBehaviour.java @@ -1,12 +1,13 @@ package com.gregtechceu.gtceu.common.item; -import com.google.common.collect.ImmutableList; -import com.gregtechceu.gtceu.client.renderer.cover.FacadeCoverRenderer; -import com.gregtechceu.gtceu.common.data.GTBlocks; import com.gregtechceu.gtceu.api.item.component.ICustomDescriptionId; import com.gregtechceu.gtceu.api.item.component.ICustomRenderer; import com.gregtechceu.gtceu.api.item.component.ISubItemHandler; +import com.gregtechceu.gtceu.client.renderer.cover.FacadeCoverRenderer; +import com.gregtechceu.gtceu.common.data.GTBlocks; + import com.lowdragmc.lowdraglib.client.renderer.IRenderer; + import net.minecraft.core.NonNullList; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.Tag; @@ -17,9 +18,11 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.RenderShape; -import org.jetbrains.annotations.NotNull; +import com.google.common.collect.ImmutableList; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; + import java.util.List; import java.util.Objects; @@ -44,7 +47,8 @@ public IRenderer getRenderer() { @Override public void fillItemCategory(Item item, CreativeModeTab category, NonNullList items) { - List validFacades = ImmutableList.of(new ItemStack(Blocks.STONE), GTBlocks.COIL_CUPRONICKEL.asStack(), new ItemStack(Blocks.GLASS)); + List validFacades = ImmutableList.of(new ItemStack(Blocks.STONE), + GTBlocks.COIL_CUPRONICKEL.asStack(), new ItemStack(Blocks.GLASS)); for (ItemStack facadeStack : validFacades) { ItemStack resultStack = item.getDefaultInstance(); setFacadeStack(resultStack, facadeStack); @@ -93,5 +97,4 @@ private static ItemStack getFacadeStackUnsafe(ItemStack itemStack) { } return facadeStack; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/FertilizerBehavior.java b/src/main/java/com/gregtechceu/gtceu/common/item/FertilizerBehavior.java index 92f530ad62..be549e15dd 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/FertilizerBehavior.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/FertilizerBehavior.java @@ -1,7 +1,7 @@ package com.gregtechceu.gtceu.common.item; - import com.gregtechceu.gtceu.api.item.component.IInteractionItem; + import net.minecraft.core.BlockPos; import net.minecraft.world.InteractionResult; import net.minecraft.world.item.BoneMealItem; @@ -24,7 +24,8 @@ public InteractionResult useOn(UseOnContext context) { } else { BlockState blockState = level.getBlockState(blockPos); boolean bl = blockState.isFaceSturdy(level, blockPos, context.getClickedFace()); - if (bl && BoneMealItem.growWaterPlant(context.getItemInHand(), level, blockPos2, context.getClickedFace())) { + if (bl && + BoneMealItem.growWaterPlant(context.getItemInHand(), level, blockPos2, context.getClickedFace())) { if (!level.isClientSide) { level.levelEvent(1505, blockPos2, 0); } @@ -35,5 +36,4 @@ public InteractionResult useOn(UseOnContext context) { } } } - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/FluidFilterBehaviour.java b/src/main/java/com/gregtechceu/gtceu/common/item/FluidFilterBehaviour.java index 22705c642c..14caeddfa6 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/FluidFilterBehaviour.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/FluidFilterBehaviour.java @@ -3,11 +3,12 @@ import com.gregtechceu.gtceu.api.cover.filter.FluidFilter; import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.api.gui.UITemplate; -import com.gregtechceu.gtceu.api.item.IComponentItem; import com.gregtechceu.gtceu.api.item.component.IItemUIFactory; + import com.lowdragmc.lowdraglib.gui.factory.HeldItemUIFactory; import com.lowdragmc.lowdraglib.gui.modular.ModularUI; import com.lowdragmc.lowdraglib.gui.widget.LabelWidget; + import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; @@ -36,5 +37,4 @@ public ModularUI createUI(HeldItemUIFactory.HeldItemHolder holder, Player entity .widget(FluidFilter.loadFilter(held).openConfigurator((176 - 80) / 2, (60 - 55) / 2 + 15)) .widget(UITemplate.bindPlayerInventory(entityPlayer.getInventory(), GuiTextures.SLOT, 7, 75, true)); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/IntCircuitBehaviour.java b/src/main/java/com/gregtechceu/gtceu/common/item/IntCircuitBehaviour.java index 57c03550c4..f3bba2abf2 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/IntCircuitBehaviour.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/IntCircuitBehaviour.java @@ -1,9 +1,10 @@ package com.gregtechceu.gtceu.common.item; -import com.gregtechceu.gtceu.api.item.component.IItemUIFactory; import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.api.item.component.IAddInformation; +import com.gregtechceu.gtceu.api.item.component.IItemUIFactory; import com.gregtechceu.gtceu.common.data.GTItems; + import com.lowdragmc.lowdraglib.gui.factory.HeldItemUIFactory; import com.lowdragmc.lowdraglib.gui.modular.ModularUI; import com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup; @@ -12,6 +13,7 @@ import com.lowdragmc.lowdraglib.gui.widget.LabelWidget; import com.lowdragmc.lowdraglib.gui.widget.SlotWidget; import com.lowdragmc.lowdraglib.misc.ItemStackTransfer; + import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; import net.minecraft.util.Mth; @@ -19,6 +21,7 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.level.Level; + import org.jetbrains.annotations.Nullable; import java.util.List; @@ -29,6 +32,7 @@ * @implNote IntCircuitBehaviour */ public class IntCircuitBehaviour implements IItemUIFactory, IAddInformation { + public static final int CIRCUIT_MAX = 32; public static ItemStack stack(int configuration) { @@ -85,14 +89,13 @@ public static void adjustConfiguration(ItemStack stack, int amount) { setCircuitConfiguration(stack, configuration); } - @Override - public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltipComponents, TooltipFlag isAdvanced) { + public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltipComponents, + TooltipFlag isAdvanced) { int configuration = getCircuitConfiguration(stack); tooltipComponents.add(Component.translatable("metaitem.int_circuit.configuration", configuration)); } - @Override public ModularUI createUI(HeldItemUIFactory.HeldItemHolder holder, Player entityPlayer) { LabelWidget label = new LabelWidget(9, 8, "Programmed Circuit Configuration"); @@ -100,22 +103,31 @@ public ModularUI createUI(HeldItemUIFactory.HeldItemHolder holder, Player entity label.setTextColor(0x404040); var modular = new ModularUI(184, 132, holder, entityPlayer) .widget(label); - SlotWidget slotwidget = new SlotWidget(new ItemStackTransfer(stack(getCircuitConfiguration(holder.getHeld()))), 0, 82, 20, false, false); + SlotWidget slotwidget = new SlotWidget(new ItemStackTransfer(stack(getCircuitConfiguration(holder.getHeld()))), + 0, 82, 20, false, false); slotwidget.setBackground(GuiTextures.SLOT); modular.widget(slotwidget); int idx = 0; - for(int x = 0; x <= 2; x++) { - for(int y = 0; y <= 8; y++) { + for (int x = 0; x <= 2; x++) { + for (int y = 0; y <= 8; y++) { int finalIdx = idx; - modular.widget(new ButtonWidget(10 + (18 * y), 48 + (18 * x), 18, 18, new GuiTextureGroup(GuiTextures.SLOT, new ItemStackTexture(stack(finalIdx)).scale(16f / 18)), - data -> { setCircuitConfiguration(holder, finalIdx); slotwidget.setHandlerSlot(new ItemStackTransfer(stack(finalIdx)), 0); })); + modular.widget(new ButtonWidget(10 + (18 * y), 48 + (18 * x), 18, 18, + new GuiTextureGroup(GuiTextures.SLOT, new ItemStackTexture(stack(finalIdx)).scale(16f / 18)), + data -> { + setCircuitConfiguration(holder, finalIdx); + slotwidget.setHandlerSlot(new ItemStackTransfer(stack(finalIdx)), 0); + })); idx++; } } - for(int x = 0; x <= 5; x++) { + for (int x = 0; x <= 5; x++) { int finalIdx = x + 27; - modular.widget(new ButtonWidget(10 + (18 * x), 102, 18, 18, new GuiTextureGroup(GuiTextures.SLOT, new ItemStackTexture(stack(finalIdx)).scale(16f / 18)), - data -> { setCircuitConfiguration(holder, finalIdx); slotwidget.setHandlerSlot(new ItemStackTransfer(stack(finalIdx)), 0); })); + modular.widget(new ButtonWidget(10 + (18 * x), 102, 18, 18, + new GuiTextureGroup(GuiTextures.SLOT, new ItemStackTexture(stack(finalIdx)).scale(16f / 18)), + data -> { + setCircuitConfiguration(holder, finalIdx); + slotwidget.setHandlerSlot(new ItemStackTransfer(stack(finalIdx)), 0); + })); } modular.mainGroup.setBackground(GuiTextures.BACKGROUND); return modular; diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/ItemFilterBehaviour.java b/src/main/java/com/gregtechceu/gtceu/common/item/ItemFilterBehaviour.java index 54dfe3f6af..b2ff12f83f 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/ItemFilterBehaviour.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/ItemFilterBehaviour.java @@ -1,13 +1,14 @@ package com.gregtechceu.gtceu.common.item; -import com.gregtechceu.gtceu.api.item.IComponentItem; -import com.gregtechceu.gtceu.api.item.component.IItemUIFactory; import com.gregtechceu.gtceu.api.cover.filter.ItemFilter; import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.api.gui.UITemplate; +import com.gregtechceu.gtceu.api.item.component.IItemUIFactory; + import com.lowdragmc.lowdraglib.gui.factory.HeldItemUIFactory; import com.lowdragmc.lowdraglib.gui.modular.ModularUI; import com.lowdragmc.lowdraglib.gui.widget.LabelWidget; + import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; @@ -36,5 +37,4 @@ public ModularUI createUI(HeldItemUIFactory.HeldItemHolder holder, Player entity .widget(ItemFilter.loadFilter(held).openConfigurator((176 - 80) / 2, (60 - 55) / 2 + 15)) .widget(UITemplate.bindPlayerInventory(entityPlayer.getInventory(), GuiTextures.SLOT, 7, 75, true)); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/ItemFluidContainer.java b/src/main/java/com/gregtechceu/gtceu/common/item/ItemFluidContainer.java index 880bf1e9ea..bccafad419 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/ItemFluidContainer.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/ItemFluidContainer.java @@ -1,10 +1,11 @@ package com.gregtechceu.gtceu.common.item; import com.gregtechceu.gtceu.api.item.component.IRecipeRemainder; + import com.lowdragmc.lowdraglib.misc.ItemStackTransfer; import com.lowdragmc.lowdraglib.side.fluid.FluidHelper; import com.lowdragmc.lowdraglib.side.fluid.FluidTransferHelper; -import net.minecraft.world.item.Item; + import net.minecraft.world.item.ItemStack; /** @@ -13,6 +14,7 @@ * @implNote ItemFluidContainer */ public class ItemFluidContainer implements IRecipeRemainder { + @Override public ItemStack getRecipeRemained(ItemStack itemStack) { var storage = new ItemStackTransfer(itemStack); @@ -27,5 +29,4 @@ public ItemStack getRecipeRemained(ItemStack itemStack) { } return storage.getStackInSlot(0); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/ItemMagnetBehavior.java b/src/main/java/com/gregtechceu/gtceu/common/item/ItemMagnetBehavior.java index 5e2e35f45e..77cc797b4b 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/ItemMagnetBehavior.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/ItemMagnetBehavior.java @@ -7,6 +7,7 @@ import com.gregtechceu.gtceu.api.item.component.IAddInformation; import com.gregtechceu.gtceu.api.item.component.IInteractionItem; import com.gregtechceu.gtceu.api.item.component.IItemLifeCycle; + import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; import net.minecraft.sounds.SoundEvents; @@ -27,6 +28,7 @@ import net.minecraftforge.event.entity.item.ItemTossEvent; import net.minecraftforge.event.entity.player.PlayerXpEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -44,7 +46,8 @@ public ItemMagnetBehavior(int range) { } @Override - public InteractionResultHolder use(Item item, Level world, @NotNull Player player, InteractionHand hand) { + public InteractionResultHolder use(Item item, Level world, @NotNull Player player, + InteractionHand hand) { if (!player.level().isClientSide && player.isShiftKeyDown()) { player.displayClientMessage(Component.translatable(toggleActive(player.getItemInHand(hand)) ? "behavior.item_magnet.enabled" : "behavior.item_magnet.disabled"), true); @@ -77,7 +80,8 @@ private static boolean toggleActive(ItemStack stack) { public void inventoryTick(ItemStack stack, Level level, Entity entity, int slotId, boolean isSelected) { // Adapted logic from Draconic Evolution // https://github.com/Draconic-Inc/Draconic-Evolution/blob/1.12.2/src/main/java/com/brandon3055/draconicevolution/items/tools/Magnet.java - if (!entity.isShiftKeyDown() && entity.tickCount % 10 == 0 && isActive(stack) && entity instanceof Player player) { + if (!entity.isShiftKeyDown() && entity.tickCount % 10 == 0 && isActive(stack) && + entity instanceof Player player) { Level world = entity.level(); if (!drainEnergy(true, stack, energyDraw)) { return; @@ -85,7 +89,7 @@ public void inventoryTick(ItemStack stack, Level level, Entity entity, int slotI List items = world.getEntitiesOfClass(ItemEntity.class, new AABB(entity.getX(), entity.getY(), entity.getZ(), entity.getX(), entity.getY(), entity.getZ()) - .inflate(range, range, range)); + .inflate(range, range, range)); boolean didMoveEntity = false; for (ItemEntity itemEntity : items) { @@ -158,9 +162,9 @@ public void onItemToss(@NotNull ItemTossEvent event) { Inventory inventory = event.getPlayer().getInventory(); // TODO work out curios compat -// if (Platform.isModLoaded(GTValues.MODID_CURIOS)) { -// inventory = BaublesModule.getBaublesWrappedInventory(event.getPlayer()); -// } + // if (Platform.isModLoaded(GTValues.MODID_CURIOS)) { + // inventory = BaublesModule.getBaublesWrappedInventory(event.getPlayer()); + // } for (int i = 0; i < inventory.getContainerSize(); i++) { ItemStack stackInSlot = inventory.getItem(i); @@ -191,7 +195,9 @@ private static boolean drainEnergy(boolean simulate, @NotNull ItemStack stack, l } @Override - public void appendHoverText(ItemStack itemStack, @Nullable Level level, List lines, TooltipFlag isAdvanced) { - lines.add(Component.translatable(isActive(itemStack) ? "behavior.item_magnet.enabled" : "behavior.item_magnet.disabled")); + public void appendHoverText(ItemStack itemStack, @Nullable Level level, List lines, + TooltipFlag isAdvanced) { + lines.add(Component + .translatable(isActive(itemStack) ? "behavior.item_magnet.enabled" : "behavior.item_magnet.disabled")); } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/PortableScannerBehavior.java b/src/main/java/com/gregtechceu/gtceu/common/item/PortableScannerBehavior.java index fd9085553d..b1f53a2b69 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/PortableScannerBehavior.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/PortableScannerBehavior.java @@ -8,10 +8,8 @@ import com.gregtechceu.gtceu.api.capability.IWorkable; import com.gregtechceu.gtceu.api.capability.forge.GTCapability; import com.gregtechceu.gtceu.api.data.worldgen.bedrockfluid.BedrockFluidVeinSavedData; -import com.gregtechceu.gtceu.api.gui.misc.ProspectorMode; import com.gregtechceu.gtceu.api.item.component.IAddInformation; import com.gregtechceu.gtceu.api.item.component.IInteractionItem; -import com.gregtechceu.gtceu.api.item.component.IItemUIFactory; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; import com.gregtechceu.gtceu.api.machine.MetaMachine; import com.gregtechceu.gtceu.api.machine.feature.IDataInfoProvider; @@ -23,7 +21,7 @@ import com.gregtechceu.gtceu.common.data.GTSoundEntries; import com.gregtechceu.gtceu.utils.FormattingUtil; import com.gregtechceu.gtceu.utils.GTUtil; -import lombok.Getter; + import net.minecraft.ChatFormatting; import net.minecraft.core.BlockPos; import net.minecraft.network.chat.Component; @@ -44,19 +42,23 @@ import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.capability.IFluidHandler; + +import lombok.Getter; import org.jetbrains.annotations.Nullable; -import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.List; import java.util.Optional; +import javax.annotation.Nonnull; + public class PortableScannerBehavior implements IInteractionItem, IAddInformation { private int debugLevel = 0; @Getter public enum DisplayMode { + SHOW_ALL("behavior.portable_scanner.mode.show_all_info"), SHOW_BLOCK_INFO("behavior.portable_scanner.mode.show_block_info"), SHOW_MACHINE_INFO("behavior.portable_scanner.mode.show_machine_info"), @@ -116,7 +118,8 @@ public InteractionResultHolder use(Item item, Level level, Player pla if (!level.isClientSide) { setNextMode(heldItem); var mode = getMode(heldItem); - player.sendSystemMessage(Component.translatable("behavior.portable_scanner.mode.caption", Component.translatable(mode.getLangKey()))); + player.sendSystemMessage(Component.translatable("behavior.portable_scanner.mode.caption", + Component.translatable(mode.getLangKey()))); } return InteractionResultHolder.success(heldItem); } @@ -144,11 +147,9 @@ protected DisplayMode getMode(ItemStack stack) { return DisplayMode.SHOW_ALL; } return DisplayMode.values()[tag.getInt("Mode") % DisplayMode.values().length]; - } public int addScannerInfo(Player player, Level level, BlockPos pos, DisplayMode mode, List list) { - BlockEntity tileEntity = level.getBlockEntity(pos); int energyCost = 0; @@ -160,30 +161,30 @@ public int addScannerInfo(Player player, Level level, BlockPos pos, DisplayMode // Coordinates of the block list.add(Component.translatable("behavior.portable_scanner.position", - Component.translatable(FormattingUtil.formatNumbers(pos.getX())) - .withStyle(ChatFormatting.AQUA), - Component.translatable(FormattingUtil.formatNumbers(pos.getY())) - .withStyle(ChatFormatting.AQUA), - Component.translatable(FormattingUtil.formatNumbers(pos.getZ())) - .withStyle(ChatFormatting.AQUA), - Component.translatable(level.dimension().location().toString()) - .withStyle(ChatFormatting.AQUA))); + Component.translatable(FormattingUtil.formatNumbers(pos.getX())) + .withStyle(ChatFormatting.AQUA), + Component.translatable(FormattingUtil.formatNumbers(pos.getY())) + .withStyle(ChatFormatting.AQUA), + Component.translatable(FormattingUtil.formatNumbers(pos.getZ())) + .withStyle(ChatFormatting.AQUA), + Component.translatable(level.dimension().location().toString()) + .withStyle(ChatFormatting.AQUA))); // Hardness and blast resistance list.add(Component.translatable("behavior.portable_scanner.block_hardness", - Component.translatable( - FormattingUtil.formatNumbers(block.defaultDestroyTime())) - .withStyle(ChatFormatting.YELLOW), - Component.translatable(FormattingUtil.formatNumbers(block.getExplosionResistance())) - .withStyle(ChatFormatting.YELLOW))); + Component.translatable( + FormattingUtil.formatNumbers(block.defaultDestroyTime())) + .withStyle(ChatFormatting.YELLOW), + Component.translatable(FormattingUtil.formatNumbers(block.getExplosionResistance())) + .withStyle(ChatFormatting.YELLOW))); // Possible block states if (debugLevel > 2) { state.getProperties().forEach((property) -> { list.add(Component.translatable("behavior.portable_scanner.state", - Component.translatable(property.getName()), - Component.translatable(state.getValue(property).toString()) - .withStyle(ChatFormatting.AQUA))); + Component.translatable(property.getName()), + Component.translatable(state.getValue(property).toString()) + .withStyle(ChatFormatting.AQUA))); }); } } @@ -213,12 +214,12 @@ public int addScannerInfo(Player player, Level level, BlockPos pos, DisplayMode energyCost += 500; allTanksEmpty = false; list.add(Component.translatable("behavior.portable_scanner.tank", i, - Component.translatable(FormattingUtil.formatNumbers(fluidStack.getAmount())) - .withStyle(ChatFormatting.GREEN), - Component.translatable(FormattingUtil.formatNumbers(fluidHandler.getTankCapacity(i))) - .withStyle(ChatFormatting.YELLOW), - Component.translatable(fluidStack.getTranslationKey()) - .withStyle(ChatFormatting.GOLD))); + Component.translatable(FormattingUtil.formatNumbers(fluidStack.getAmount())) + .withStyle(ChatFormatting.GREEN), + Component.translatable(FormattingUtil.formatNumbers(fluidHandler.getTankCapacity(i))) + .withStyle(ChatFormatting.YELLOW), + Component.translatable(fluidStack.getTranslationKey()) + .withStyle(ChatFormatting.GOLD))); } if (allTanksEmpty) { @@ -232,7 +233,7 @@ public int addScannerInfo(Player player, Level level, BlockPos pos, DisplayMode if (mufflableMachine.isMuffled()) { list.add(Component.translatable("behavior.portable_scanner.divider")); list.add(Component.translatable("behavior.portable_scanner.muffled") - .withStyle(ChatFormatting.GREEN)); + .withStyle(ChatFormatting.GREEN)); } } } @@ -241,37 +242,38 @@ public int addScannerInfo(Player player, Level level, BlockPos pos, DisplayMode if (mode == DisplayMode.SHOW_ALL || mode == DisplayMode.SHOW_ELECTRICAL_INFO) { // Energy container - Optional energyCap = tileEntity.getCapability(GTCapability.CAPABILITY_ENERGY_CONTAINER).resolve(); + Optional energyCap = tileEntity + .getCapability(GTCapability.CAPABILITY_ENERGY_CONTAINER).resolve(); if (energyCap.isPresent()) { IEnergyContainer energyContainer = energyCap.get(); if (energyContainer.getInputVoltage() > 0) { list.add(Component.translatable("behavior.portable_scanner.divider")); list.add(Component.translatable("behavior.portable_scanner.energy_container_in", - Component.translatable(FormattingUtil.formatNumbers(energyContainer.getInputVoltage())) - .withStyle(ChatFormatting.RED), - Component.translatable( - GTValues.VN[GTUtil.getTierByVoltage(energyContainer.getInputVoltage())]) - .withStyle(ChatFormatting.RED), - Component.translatable(FormattingUtil.formatNumbers(energyContainer.getInputAmperage())) - .withStyle(ChatFormatting.RED))); + Component.translatable(FormattingUtil.formatNumbers(energyContainer.getInputVoltage())) + .withStyle(ChatFormatting.RED), + Component.translatable( + GTValues.VN[GTUtil.getTierByVoltage(energyContainer.getInputVoltage())]) + .withStyle(ChatFormatting.RED), + Component.translatable(FormattingUtil.formatNumbers(energyContainer.getInputAmperage())) + .withStyle(ChatFormatting.RED))); } if (energyContainer.getOutputVoltage() > 0) { list.add(Component.translatable("behavior.portable_scanner.divider")); list.add(Component.translatable("behavior.portable_scanner.energy_container_out", - Component.translatable(FormattingUtil.formatNumbers(energyContainer.getOutputVoltage())) - .withStyle(ChatFormatting.RED), - Component.translatable( - GTValues.VN[GTUtil.getTierByVoltage(energyContainer.getOutputVoltage())]) - .withStyle(ChatFormatting.RED), - Component.translatable( - FormattingUtil.formatNumbers(energyContainer.getOutputAmperage())) - .withStyle(ChatFormatting.RED))); + Component.translatable(FormattingUtil.formatNumbers(energyContainer.getOutputVoltage())) + .withStyle(ChatFormatting.RED), + Component.translatable( + GTValues.VN[GTUtil.getTierByVoltage(energyContainer.getOutputVoltage())]) + .withStyle(ChatFormatting.RED), + Component.translatable( + FormattingUtil.formatNumbers(energyContainer.getOutputAmperage())) + .withStyle(ChatFormatting.RED))); } list.add(Component.translatable("behavior.portable_scanner.energy_container_storage", - Component.translatable(FormattingUtil.formatNumbers(energyContainer.getEnergyStored())) - .withStyle(ChatFormatting.GREEN), - Component.translatable(FormattingUtil.formatNumbers(energyContainer.getEnergyCapacity())) - .withStyle(ChatFormatting.YELLOW))); + Component.translatable(FormattingUtil.formatNumbers(energyContainer.getEnergyStored())) + .withStyle(ChatFormatting.GREEN), + Component.translatable(FormattingUtil.formatNumbers(energyContainer.getEnergyCapacity())) + .withStyle(ChatFormatting.YELLOW))); } } @@ -284,20 +286,21 @@ public int addScannerInfo(Player player, Level level, BlockPos pos, DisplayMode if (!workableMachine.isWorkingEnabled()) { list.add(Component.translatable("behavior.portable_scanner.divider")); list.add(Component.translatable("behavior.portable_scanner.machine_disabled") - .withStyle(ChatFormatting.RED)); + .withStyle(ChatFormatting.RED)); } if (workableMachine.getMaxProgress() > 0) { list.add(Component.translatable("behavior.portable_scanner.divider")); list.add(Component.translatable("behavior.portable_scanner.machine_progress", - Component.translatable(FormattingUtil.formatNumbers(workableMachine.getProgress())) - .withStyle(ChatFormatting.GREEN), - Component.translatable(FormattingUtil.formatNumbers(workableMachine.getMaxProgress())) - .withStyle(ChatFormatting.YELLOW))); + Component.translatable(FormattingUtil.formatNumbers(workableMachine.getProgress())) + .withStyle(ChatFormatting.GREEN), + Component.translatable(FormattingUtil.formatNumbers(workableMachine.getMaxProgress())) + .withStyle(ChatFormatting.YELLOW))); } } // Recipe logic for EU production/consumption - Optional recipeLogicCap = tileEntity.getCapability(GTCapability.CAPABILITY_RECIPE_LOGIC).resolve(); + Optional recipeLogicCap = tileEntity.getCapability(GTCapability.CAPABILITY_RECIPE_LOGIC) + .resolve(); if (recipeLogicCap.isPresent()) { RecipeLogic recipeLogic = recipeLogicCap.get(); GTRecipe recipe = recipeLogic.getLastRecipe(); @@ -314,13 +317,15 @@ public int addScannerInfo(Player player, Level level, BlockPos pos, DisplayMode EUt = RecipeHelper.getOutputEUt(recipe); } - list.add(Component.translatable(isInput ? "behavior.portable_scanner.workable_consumption" : "behavior.portable_scanner.workable_production", - Component.translatable(FormattingUtil.formatNumbers(EUt)) - .withStyle(ChatFormatting.RED), - // TODO: Change number once there is multi amp behavior - Component.translatable( - FormattingUtil.formatNumbers(1)) - .withStyle(ChatFormatting.RED))); + list.add(Component.translatable( + isInput ? "behavior.portable_scanner.workable_consumption" : + "behavior.portable_scanner.workable_production", + Component.translatable(FormattingUtil.formatNumbers(EUt)) + .withStyle(ChatFormatting.RED), + // TODO: Change number once there is multi amp behavior + Component.translatable( + FormattingUtil.formatNumbers(1)) + .withStyle(ChatFormatting.RED))); } } } @@ -337,7 +342,7 @@ else if (machine instanceof IDataInfoProvider) list.addAll(provider.getDataInfo(mode)); } - } else if (tileEntity instanceof PipeBlockEntity pipe) { + } else if (tileEntity instanceof PipeBlockEntity pipe) { // Pipes need special name handling list.add(pipe.getPipeBlock().getName().withStyle(ChatFormatting.BLUE)); @@ -370,22 +375,22 @@ else if (machine instanceof IDataInfoProvider) if (fluid != null) { FluidStack stack = new FluidStack(fluid, - veinData.getOperationsRemaining(pos.getX() / 16, pos.getZ() / 16)); + veinData.getOperationsRemaining(pos.getX() / 16, pos.getZ() / 16)); double fluidPercent = stack.getAmount() * 100.0 / BedrockFluidVeinSavedData.MAXIMUM_VEIN_OPERATIONS; if (player.isCreative()) { list.add(Component.translatable("behavior.portable_scanner.bedrock_fluid.amount", - Component.translatable(stack.getTranslationKey()) - .withStyle(ChatFormatting.GOLD), - Component.translatable(String.valueOf( - veinData.getFluidYield(pos.getX() / 16, pos.getZ() / 16))) - .withStyle(ChatFormatting.GOLD), - Component.translatable(String.valueOf(fluidPercent)) - .withStyle(ChatFormatting.YELLOW))); + Component.translatable(stack.getTranslationKey()) + .withStyle(ChatFormatting.GOLD), + Component.translatable(String.valueOf( + veinData.getFluidYield(pos.getX() / 16, pos.getZ() / 16))) + .withStyle(ChatFormatting.GOLD), + Component.translatable(String.valueOf(fluidPercent)) + .withStyle(ChatFormatting.YELLOW))); } else { list.add(Component.translatable("behavior.portable_scanner.bedrock_fluid.amount_unknown", - Component.translatable(String.valueOf(fluidPercent)) - .withStyle(ChatFormatting.YELLOW))); + Component.translatable(String.valueOf(fluidPercent)) + .withStyle(ChatFormatting.YELLOW))); } } else { list.add(Component.translatable("behavior.portable_scanner.bedrock_fluid.nothing")); @@ -414,8 +419,10 @@ else if (machine instanceof IDataInfoProvider) } @Override - public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltipComponents, TooltipFlag isAdvanced) { + public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltipComponents, + TooltipFlag isAdvanced) { tooltipComponents.add(Component.translatable("metaitem.behavior.mode_switch.tooltip")); - tooltipComponents.add(Component.translatable("behavior.portable_scanner.mode.caption", Component.translatable(getMode(stack).getLangKey()).withStyle(ChatFormatting.AQUA))); + tooltipComponents.add(Component.translatable("behavior.portable_scanner.mode.caption", + Component.translatable(getMode(stack).getLangKey()).withStyle(ChatFormatting.AQUA))); } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/ProspectorScannerBehavior.java b/src/main/java/com/gregtechceu/gtceu/common/item/ProspectorScannerBehavior.java index a461ea5756..76f94969e9 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/ProspectorScannerBehavior.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/ProspectorScannerBehavior.java @@ -1,6 +1,5 @@ package com.gregtechceu.gtceu.common.item; -import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.capability.GTCapabilityHelper; import com.gregtechceu.gtceu.api.capability.IElectricItem; import com.gregtechceu.gtceu.api.gui.GuiTextures; @@ -10,10 +9,12 @@ import com.gregtechceu.gtceu.api.item.component.IInteractionItem; import com.gregtechceu.gtceu.api.item.component.IItemUIFactory; import com.gregtechceu.gtceu.config.ConfigHolder; + import com.lowdragmc.lowdraglib.gui.factory.HeldItemUIFactory; import com.lowdragmc.lowdraglib.gui.modular.ModularUI; import com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup; import com.lowdragmc.lowdraglib.gui.widget.SwitchWidget; + import net.minecraft.ChatFormatting; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Style; @@ -24,9 +25,10 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.level.Level; -import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + import java.util.Arrays; import java.util.List; import java.util.Objects; @@ -37,6 +39,7 @@ * @implNote ProspectorScannerBehavior */ public class ProspectorScannerBehavior implements IItemUIFactory, IInteractionItem, IAddInformation { + private final int radius; private final long cost; private final ProspectorMode[] modes; @@ -57,7 +60,6 @@ public ProspectorMode getMode(ItemStack stack) { return modes[0]; } return modes[tag.getInt("Mode") % modes.length]; - } public void setNextMode(ItemStack stack) { @@ -102,16 +104,21 @@ public ModularUI createUI(HeldItemUIFactory.HeldItemHolder holder, Player entity .widget(new SwitchWidget(-20, 4, 18, 18, (cd, pressed) -> map.setDarkMode(pressed)) .setSupplier(map::isDarkMode) .setTexture( - new GuiTextureGroup(GuiTextures.BUTTON, GuiTextures.PROGRESS_BAR_SOLAR_STEAM.get(true).copy().getSubTexture(0, 0.5, 1, 0.5).scale(0.8f)), - new GuiTextureGroup(GuiTextures.BUTTON, GuiTextures.PROGRESS_BAR_SOLAR_STEAM.get(true).copy().getSubTexture(0, 0, 1, 0.5).scale(0.8f)))); + new GuiTextureGroup(GuiTextures.BUTTON, + GuiTextures.PROGRESS_BAR_SOLAR_STEAM.get(true).copy() + .getSubTexture(0, 0.5, 1, 0.5).scale(0.8f)), + new GuiTextureGroup(GuiTextures.BUTTON, GuiTextures.PROGRESS_BAR_SOLAR_STEAM.get(true) + .copy().getSubTexture(0, 0, 1, 0.5).scale(0.8f)))); } @Override - public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltipComponents, TooltipFlag isAdvanced) { + public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltipComponents, + TooltipFlag isAdvanced) { tooltipComponents.add(Component.translatable("metaitem.prospector.tooltip.radius", radius)); tooltipComponents.add(Component.translatable("metaitem.prospector.tooltip.modes")); for (ProspectorMode mode : modes) { - tooltipComponents.add(Component.literal(" -").append(Component.translatable(mode.unlocalizedName)).withStyle(Style.EMPTY.withColor(ChatFormatting.RED))); + tooltipComponents.add(Component.literal(" -").append(Component.translatable(mode.unlocalizedName)) + .withStyle(Style.EMPTY.withColor(ChatFormatting.RED))); } } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/TerminalBehavior.java b/src/main/java/com/gregtechceu/gtceu/common/item/TerminalBehavior.java index d34684dfbe..14b6b7c997 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/TerminalBehavior.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/TerminalBehavior.java @@ -4,9 +4,11 @@ import com.gregtechceu.gtceu.api.item.component.IItemUIFactory; import com.gregtechceu.gtceu.api.machine.MetaMachine; import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiController; + import com.lowdragmc.lowdraglib.gui.compass.CompassView; import com.lowdragmc.lowdraglib.gui.factory.HeldItemUIFactory; import com.lowdragmc.lowdraglib.gui.modular.ModularUI; + import net.minecraft.core.BlockPos; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; @@ -20,7 +22,8 @@ public InteractionResult useOn(UseOnContext context) { if (context.getPlayer() != null && context.getPlayer().isShiftKeyDown()) { Level level = context.getLevel(); BlockPos blockPos = context.getClickedPos(); - if (context.getPlayer() != null && MetaMachine.getMachine(level, blockPos) instanceof IMultiController controller) { + if (context.getPlayer() != null && + MetaMachine.getMachine(level, blockPos) instanceof IMultiController controller) { if (!controller.isFormed()) { if (!level.isClientSide) { controller.getPattern().autoBuild(context.getPlayer(), controller.getMultiblockState()); @@ -36,5 +39,4 @@ public InteractionResult useOn(UseOnContext context) { public ModularUI createUI(HeldItemUIFactory.HeldItemHolder holder, Player entityPlayer) { return new ModularUI(holder, entityPlayer).widget(new CompassView(GTCEu.MOD_ID)); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/TooltipBehavior.java b/src/main/java/com/gregtechceu/gtceu/common/item/TooltipBehavior.java index ff8461dc52..2224b110a7 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/TooltipBehavior.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/TooltipBehavior.java @@ -1,13 +1,15 @@ package com.gregtechceu.gtceu.common.item; import com.gregtechceu.gtceu.api.item.component.IAddInformation; + import net.minecraft.network.chat.Component; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.level.Level; -import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + import java.util.List; import java.util.function.Consumer; @@ -17,6 +19,7 @@ * @implNote TooltipBehavior */ public class TooltipBehavior implements IAddInformation { + private final Consumer> tooltips; /** @@ -25,8 +28,10 @@ public class TooltipBehavior implements IAddInformation { public TooltipBehavior(@NotNull Consumer> tooltips) { this.tooltips = tooltips; } + @Override - public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltipComponents, TooltipFlag isAdvanced) { + public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltipComponents, + TooltipFlag isAdvanced) { tooltips.accept(tooltipComponents); } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/TurbineRotorBehaviour.java b/src/main/java/com/gregtechceu/gtceu/common/item/TurbineRotorBehaviour.java index 07b4e965e2..58cab4b9e1 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/TurbineRotorBehaviour.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/TurbineRotorBehaviour.java @@ -1,26 +1,21 @@ package com.gregtechceu.gtceu.common.item; - import com.gregtechceu.gtceu.api.data.chemical.material.properties.PropertyKey; import com.gregtechceu.gtceu.api.item.IComponentItem; import com.gregtechceu.gtceu.api.item.component.IMaterialPartItem; import com.gregtechceu.gtceu.api.item.component.ISubItemHandler; -import net.minecraft.core.BlockPos; + import net.minecraft.core.NonNullList; import net.minecraft.network.chat.Component; -import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResult; -import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.phys.BlockHitResult; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; + import java.util.List; import static com.gregtechceu.gtceu.api.data.tag.TagPrefix.turbineBlade; @@ -60,16 +55,16 @@ public int getPartMaxDurability(ItemStack itemStack) { return property == null ? -1 : 800 * (int) Math.pow(property.getDurability(), 0.65); } - //TODO : getDamage() and Hurt Player + // TODO : getDamage() and Hurt Player public float getDamage(ItemStack itemStack) { var property = getPartMaterial(itemStack).getProperty(PropertyKey.ROTOR); return property == null ? -1 : property.getDamage(); } - public int getRotorDurabilityPercent(ItemStack itemStack) { return 100 - 100 * getPartDamage(itemStack) / getPartMaxDurability(itemStack); } + public void applyRotorDamage(ItemStack itemStack, int damageApplied) { int rotorDurability = getPartMaxDurability(itemStack); int resultDamage = getPartDamage(itemStack) + damageApplied; @@ -80,12 +75,12 @@ public void applyRotorDamage(ItemStack itemStack, int damageApplied) { } } - - @Override - public void appendHoverText(ItemStack stack, @org.jetbrains.annotations.Nullable Level level, List tooltipComponents, TooltipFlag isAdvanced) { + public void appendHoverText(ItemStack stack, @org.jetbrains.annotations.Nullable Level level, + List tooltipComponents, TooltipFlag isAdvanced) { IMaterialPartItem.super.appendHoverText(stack, level, tooltipComponents, isAdvanced); - tooltipComponents.add(Component.translatable("metaitem.tool.tooltip.rotor.efficiency", getRotorEfficiency(stack))); + tooltipComponents + .add(Component.translatable("metaitem.tool.tooltip.rotor.efficiency", getRotorEfficiency(stack))); tooltipComponents.add(Component.translatable("metaitem.tool.tooltip.rotor.power", getRotorPower(stack))); } diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/armor/AdvancedJetpack.java b/src/main/java/com/gregtechceu/gtceu/common/item/armor/AdvancedJetpack.java index 69362d276e..ff7f2f4991 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/armor/AdvancedJetpack.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/armor/AdvancedJetpack.java @@ -4,6 +4,7 @@ import com.gregtechceu.gtceu.api.capability.GTCapabilityHelper; import com.gregtechceu.gtceu.api.capability.IElectricItem; import com.gregtechceu.gtceu.utils.input.KeyBind; + import net.minecraft.core.particles.ParticleOptions; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.nbt.CompoundTag; @@ -14,6 +15,7 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; + import org.jetbrains.annotations.NotNull; public class AdvancedJetpack extends Jetpack { @@ -101,4 +103,4 @@ public float getFallDamageReduction() { public ResourceLocation getArmorTexture(ItemStack stack, Entity entity, EquipmentSlot slot, String type) { return GTCEu.id("textures/armor/advanced_jetpack.png"); } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/armor/AdvancedNanoMuscleSuite.java b/src/main/java/com/gregtechceu/gtceu/common/item/armor/AdvancedNanoMuscleSuite.java index c72e602e65..07b9a86b2e 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/armor/AdvancedNanoMuscleSuite.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/armor/AdvancedNanoMuscleSuite.java @@ -6,7 +6,7 @@ import com.gregtechceu.gtceu.api.item.armor.ArmorComponentItem; import com.gregtechceu.gtceu.api.item.armor.ArmorUtils; import com.gregtechceu.gtceu.utils.input.KeyBind; -import com.mojang.datafixers.util.Pair; + import net.minecraft.client.gui.GuiGraphics; import net.minecraft.core.NonNullList; import net.minecraft.core.particles.ParticleOptions; @@ -23,6 +23,8 @@ import net.minecraft.world.level.Level; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + +import com.mojang.datafixers.util.Pair; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -297,4 +299,4 @@ public float getFallDamageReduction() { public boolean isPPE() { return true; } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/armor/AdvancedQuarkTechSuite.java b/src/main/java/com/gregtechceu/gtceu/common/item/armor/AdvancedQuarkTechSuite.java index 33f732b951..74b831e82d 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/armor/AdvancedQuarkTechSuite.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/armor/AdvancedQuarkTechSuite.java @@ -6,7 +6,7 @@ import com.gregtechceu.gtceu.api.item.armor.ArmorComponentItem; import com.gregtechceu.gtceu.api.item.armor.ArmorUtils; import com.gregtechceu.gtceu.utils.input.KeyBind; -import com.mojang.datafixers.util.Pair; + import net.minecraft.client.gui.GuiGraphics; import net.minecraft.core.NonNullList; import net.minecraft.core.particles.ParticleOptions; @@ -23,6 +23,8 @@ import net.minecraft.world.level.Level; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + +import com.mojang.datafixers.util.Pair; import org.jetbrains.annotations.NotNull; import java.util.Iterator; @@ -215,26 +217,26 @@ public void drawHUD(ItemStack item, GuiGraphics guiGraphics) { } /* - @Override - public ArmorProperties getProperties(EntityLivingBase player, @NotNull ItemStack armor, DamageSource source, - double damage, EntityEquipmentSlot equipmentSlot) { - int damageLimit = Integer.MAX_VALUE; - IElectricItem item = armor.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); - if (item == null) { - return new ArmorProperties(0, 0, damageLimit); - } - if (energyPerUse > 0) { - damageLimit = (int) Math.min(damageLimit, 25.0D * item.getCharge() / (energyPerUse * 250.0D)); - } - return new ArmorProperties(8, getDamageAbsorption() * getAbsorption(armor), damageLimit); - } - - @Override - public boolean handleUnblockableDamage(EntityLivingBase entity, @NotNull ItemStack armor, DamageSource source, - double damage, EntityEquipmentSlot equipmentSlot) { - return source != DamageSource.FALL && source != DamageSource.DROWN && source != DamageSource.STARVE; - } - */ + * @Override + * public ArmorProperties getProperties(EntityLivingBase player, @NotNull ItemStack armor, DamageSource source, + * double damage, EntityEquipmentSlot equipmentSlot) { + * int damageLimit = Integer.MAX_VALUE; + * IElectricItem item = armor.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); + * if (item == null) { + * return new ArmorProperties(0, 0, damageLimit); + * } + * if (energyPerUse > 0) { + * damageLimit = (int) Math.min(damageLimit, 25.0D * item.getCharge() / (energyPerUse * 250.0D)); + * } + * return new ArmorProperties(8, getDamageAbsorption() * getAbsorption(armor), damageLimit); + * } + * + * @Override + * public boolean handleUnblockableDamage(EntityLivingBase entity, @NotNull ItemStack armor, DamageSource source, + * double damage, EntityEquipmentSlot equipmentSlot) { + * return source != DamageSource.FALL && source != DamageSource.DROWN && source != DamageSource.STARVE; + * } + */ @Override public ResourceLocation getArmorTexture(ItemStack stack, Entity entity, EquipmentSlot slot, String type) { @@ -318,5 +320,4 @@ public ParticleOptions getParticle() { public float getFallDamageReduction() { return 8f; } - -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/armor/GTArmorMaterials.java b/src/main/java/com/gregtechceu/gtceu/common/item/armor/GTArmorMaterials.java index b450cda737..f8717cd8d2 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/armor/GTArmorMaterials.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/armor/GTArmorMaterials.java @@ -1,8 +1,5 @@ package com.gregtechceu.gtceu.common.item.armor; -import com.mojang.serialization.Codec; -import lombok.AllArgsConstructor; -import lombok.Getter; import net.minecraft.Util; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; @@ -12,10 +9,15 @@ import net.minecraft.world.item.crafting.Ingredient; import net.minecraftforge.common.util.Lazy; +import com.mojang.serialization.Codec; +import lombok.AllArgsConstructor; +import lombok.Getter; + import java.util.EnumMap; @AllArgsConstructor public enum GTArmorMaterials implements ArmorMaterial, StringRepresentable { + GOGGLES("goggles", 0, Util.make(new EnumMap<>(ArmorItem.Type.class), map -> { map.put(ArmorItem.Type.BOOTS, 0); map.put(ArmorItem.Type.LEGGINGS, 0); @@ -34,15 +36,28 @@ public enum GTArmorMaterials implements ArmorMaterial, StringRepresentable { map.put(ArmorItem.Type.CHESTPLATE, 0); map.put(ArmorItem.Type.HELMET, 0); }), 50, SoundEvents.ARMOR_EQUIP_GENERIC, 5.0F, 0.0F, () -> Ingredient.EMPTY), + BAD_PPE_EQUIPMENT("bad_ppe_equipment", 10, Util.make(new EnumMap<>(ArmorItem.Type.class), map -> { + map.put(ArmorItem.Type.BOOTS, 1); + map.put(ArmorItem.Type.LEGGINGS, 2); + map.put(ArmorItem.Type.CHESTPLATE, 3); + map.put(ArmorItem.Type.HELMET, 1); + }), 10, SoundEvents.ARMOR_EQUIP_GENERIC, 0.0F, 0.0F, () -> Ingredient.EMPTY), + GOOD_PPE_EQUIPMENT("good_ppe_equipment", 20, Util.make(new EnumMap<>(ArmorItem.Type.class), map -> { + map.put(ArmorItem.Type.BOOTS, 2); + map.put(ArmorItem.Type.LEGGINGS, 5); + map.put(ArmorItem.Type.CHESTPLATE, 6); + map.put(ArmorItem.Type.HELMET, 2); + }), 10, SoundEvents.ARMOR_EQUIP_GENERIC, 0.0F, 0.0F, () -> Ingredient.EMPTY), ; public static final Codec CODEC = StringRepresentable.fromEnum(GTArmorMaterials::values); - private static final EnumMap HEALTH_FUNCTION_FOR_TYPE = Util.make(new EnumMap<>(ArmorItem.Type.class), map -> { - map.put(ArmorItem.Type.BOOTS, 13); - map.put(ArmorItem.Type.LEGGINGS, 15); - map.put(ArmorItem.Type.CHESTPLATE, 16); - map.put(ArmorItem.Type.HELMET, 11); - }); + private static final EnumMap HEALTH_FUNCTION_FOR_TYPE = Util + .make(new EnumMap<>(ArmorItem.Type.class), map -> { + map.put(ArmorItem.Type.BOOTS, 13); + map.put(ArmorItem.Type.LEGGINGS, 15); + map.put(ArmorItem.Type.CHESTPLATE, 16); + map.put(ArmorItem.Type.HELMET, 11); + }); private final String name; private final int durabilityMultiplier; diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/armor/HazmatSuit.java b/src/main/java/com/gregtechceu/gtceu/common/item/armor/HazmatSuit.java index e170f47c6e..e6c015ff69 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/armor/HazmatSuit.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/armor/HazmatSuit.java @@ -2,21 +2,25 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.item.armor.IArmorLogic; + import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ArmorItem; import net.minecraft.world.item.ItemStack; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class HazmatSuit implements IArmorLogic { private final ArmorItem.Type type; + private final String armorTexture; - public HazmatSuit(ArmorItem.Type type) { + public HazmatSuit(ArmorItem.Type type, String armorTexture) { this.type = type; + this.armorTexture = armorTexture; } @Override @@ -31,10 +35,9 @@ public int getArmorDisplay(Player player, @NotNull ItemStack armor, EquipmentSlo @Override public @Nullable ResourceLocation getArmorTexture(ItemStack stack, Entity entity, EquipmentSlot slot, String type) { - String armorTexture = "hazmat"; return slot != EquipmentSlot.LEGS ? - GTCEu.id(String.format("textures/armor/%s_1.png", armorTexture)) : - GTCEu.id(String.format("textures/armor/%s_2.png", armorTexture)); + GTCEu.id(String.format("textures/armor/%s_1.png", armorTexture)) : + GTCEu.id(String.format("textures/armor/%s_2.png", armorTexture)); } @Override diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/armor/IJetpack.java b/src/main/java/com/gregtechceu/gtceu/common/item/armor/IJetpack.java index 9e510d1dc1..80ba86dddf 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/armor/IJetpack.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/armor/IJetpack.java @@ -2,17 +2,20 @@ import com.gregtechceu.gtceu.api.item.armor.ArmorUtils; import com.gregtechceu.gtceu.utils.input.KeyBind; + import net.minecraft.core.particles.ParticleOptions; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.phys.Vec3; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; /** * Logic from - * SimplyJetpacks2 + * SimplyJetpacks2 */ public interface IJetpack { @@ -76,18 +79,23 @@ default void performFlying(@NotNull Player player, boolean hover, ItemStack stac Vec3 delta = player.getDeltaMovement(); if (flyKeyDown) { if (!hover) { - player.setDeltaMovement(delta.x, Math.min(delta.y + currentAccel, currentSpeedVertical), delta.z); + player.setDeltaMovement(delta.x, Math.min(delta.y + currentAccel, currentSpeedVertical), + delta.z); } else { if (descendKeyDown) { - player.setDeltaMovement(delta.x, Math.min(delta.y + currentAccel, getVerticalHoverSlowSpeed()), delta.z); + player.setDeltaMovement(delta.x, + Math.min(delta.y + currentAccel, getVerticalHoverSlowSpeed()), delta.z); } else { - player.setDeltaMovement(delta.x, Math.min(delta.y + currentAccel, getVerticalHoverSpeed()), delta.z); + player.setDeltaMovement(delta.x, + Math.min(delta.y + currentAccel, getVerticalHoverSpeed()), delta.z); } } } else if (descendKeyDown) { - player.setDeltaMovement(delta.x, Math.min(delta.y + currentAccel, -getVerticalHoverSpeed()), delta.z); + player.setDeltaMovement(delta.x, Math.min(delta.y + currentAccel, -getVerticalHoverSpeed()), + delta.z); } else { - player.setDeltaMovement(delta.x, Math.min(delta.y + currentAccel, -getVerticalHoverSlowSpeed()), delta.z); + player.setDeltaMovement(delta.x, Math.min(delta.y + currentAccel, -getVerticalHoverSlowSpeed()), + delta.z); } float speedSideways = (float) (player.isShiftKeyDown() ? getSidewaysSpeed() * 0.5f : getSidewaysSpeed()); @@ -112,4 +120,4 @@ default void performFlying(@NotNull Player player, boolean hover, ItemStack stac } } } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/armor/IStepAssist.java b/src/main/java/com/gregtechceu/gtceu/common/item/armor/IStepAssist.java index 88a057565b..0d134773af 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/armor/IStepAssist.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/armor/IStepAssist.java @@ -1,12 +1,13 @@ - package com.gregtechceu.gtceu.common.item.armor; import net.minecraft.world.entity.player.Player; + import org.jetbrains.annotations.NotNull; /** * Logic from - * EnderIO + * EnderIO */ public interface IStepAssist { @@ -21,4 +22,4 @@ default void updateStepHeight(@NotNull Player player) { player.setMaxUpStep(0.6F); } } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/armor/Jetpack.java b/src/main/java/com/gregtechceu/gtceu/common/item/armor/Jetpack.java index de76f2a116..2acc3c58b1 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/armor/Jetpack.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/armor/Jetpack.java @@ -6,7 +6,9 @@ import com.gregtechceu.gtceu.api.item.armor.ArmorLogicSuite; import com.gregtechceu.gtceu.api.item.armor.ArmorUtils; import com.gregtechceu.gtceu.utils.input.KeyBind; + import com.lowdragmc.lowdraglib.Platform; + import net.minecraft.client.gui.GuiGraphics; import net.minecraft.core.particles.ParticleOptions; import net.minecraft.core.particles.ParticleTypes; @@ -21,6 +23,7 @@ import net.minecraft.world.level.Level; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -100,12 +103,12 @@ public ResourceLocation getArmorTexture(ItemStack stack, Entity entity, Equipmen } /* - @Override - public ArmorProperties getProperties(EntityLivingBase player, @NotNull ItemStack armor, DamageSource source, - double damage, ArmorItem.Type equipmentSlot) { - return new ArmorProperties(0, 0, 0); - } - */ + * @Override + * public ArmorProperties getProperties(EntityLivingBase player, @NotNull ItemStack armor, DamageSource source, + * double damage, ArmorItem.Type equipmentSlot) { + * return new ArmorProperties(0, 0, 0); + * } + */ @OnlyIn(Dist.CLIENT) @Override @@ -115,7 +118,7 @@ public void drawHUD(ItemStack item, GuiGraphics guiGraphics) { if (data != null) { if (data.contains("hover")) { Component status = (data.getBoolean("hover") ? Component.translatable("metaarmor.hud.status.enabled") : - Component.translatable("metaarmor.hud.status.disabled")); + Component.translatable("metaarmor.hud.status.disabled")); Component result = Component.translatable("metaarmor.hud.hover_mode", status); this.HUD.newString(result); } @@ -162,4 +165,4 @@ public double getSidewaysSpeed() { public ParticleOptions getParticle() { return ParticleTypes.SMOKE; } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/armor/NanoMuscleSuite.java b/src/main/java/com/gregtechceu/gtceu/common/item/armor/NanoMuscleSuite.java index d7d05fcfc5..26f4c9fb49 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/armor/NanoMuscleSuite.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/armor/NanoMuscleSuite.java @@ -7,7 +7,9 @@ import com.gregtechceu.gtceu.api.item.armor.ArmorUtils; import com.gregtechceu.gtceu.common.data.GTItems; import com.gregtechceu.gtceu.utils.input.KeyBind; + import com.lowdragmc.lowdraglib.Platform; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.nbt.CompoundTag; @@ -26,6 +28,7 @@ import net.minecraft.world.level.Level; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + import org.jetbrains.annotations.NotNull; import java.util.List; @@ -91,7 +94,8 @@ public void onArmorTick(Level world, Player player, ItemStack itemStack) { public static void disableNightVision(@NotNull Level world, Player player, boolean sendMsg) { if (!world.isClientSide) { player.removeEffect(MobEffects.NIGHT_VISION); - if (sendMsg) player.displayClientMessage(Component.translatable("metaarmor.nms.nightvision.disabled"), true); + if (sendMsg) + player.displayClientMessage(Component.translatable("metaarmor.nms.nightvision.disabled"), true); } } @@ -101,23 +105,24 @@ public boolean handleUnblockableDamage(LivingEntity entity, @NotNull ItemStack a } /* - @Override - public ArmorProperties getProperties(EntityLivingBase player, @NotNull ItemStack armor, DamageSource source, - double damage, ArmorItem.Type equipmentSlot) { - IElectricItem container = armor.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); - int damageLimit = Integer.MAX_VALUE; - if (source == DamageSource.FALL && this.getEquipmentSlot(armor) == ArmorItem.Type.FEET) { - if (energyPerUse > 0 && container != null) { - damageLimit = (int) Math.min(damageLimit, 25.0 * container.getCharge() / (energyPerUse * 10.0D)); - } - return new ArmorProperties(10, (damage < 8.0) ? 1.0 : 0.875, damageLimit); - } - return super.getProperties(player, armor, source, damage, equipmentSlot); - } - */ + * @Override + * public ArmorProperties getProperties(EntityLivingBase player, @NotNull ItemStack armor, DamageSource source, + * double damage, ArmorItem.Type equipmentSlot) { + * IElectricItem container = armor.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); + * int damageLimit = Integer.MAX_VALUE; + * if (source == DamageSource.FALL && this.getEquipmentSlot(armor) == ArmorItem.Type.FEET) { + * if (energyPerUse > 0 && container != null) { + * damageLimit = (int) Math.min(damageLimit, 25.0 * container.getCharge() / (energyPerUse * 10.0D)); + * } + * return new ArmorProperties(10, (damage < 8.0) ? 1.0 : 0.875, damageLimit); + * } + * return super.getProperties(player, armor, source, damage, equipmentSlot); + * } + */ @Override - public void damageArmor(LivingEntity entity, ItemStack itemStack, DamageSource source, int damage, EquipmentSlot equipmentSlot) { + public void damageArmor(LivingEntity entity, ItemStack itemStack, DamageSource source, int damage, + EquipmentSlot equipmentSlot) { IElectricItem item = GTCapabilityHelper.getElectricItem(itemStack); if (item != null) { item.discharge((long) energyPerUse / 10 * damage, item.getTier(), true, false, false); @@ -132,7 +137,7 @@ public ResourceLocation getArmorTexture(ItemStack stack, Entity entity, Equipmen String armorTexture = "nano_muscule_suite"; if (advancedChest.is(currentChest.getItem())) armorTexture = "advanced_nano_muscle_suite"; return slot != EquipmentSlot.LEGS ? - GTCEu.id(String.format("textures/armor/%s_1.png", armorTexture)) : + GTCEu.id(String.format("textures/armor/%s_1.png", armorTexture)) : GTCEu.id(String.format("textures/armor/%s_2.png", armorTexture)); } @@ -170,5 +175,4 @@ public void addInfo(ItemStack itemStack, List lines) { lines.add(Component.translatable("metaarmor.tooltip.falldamage")); } } - -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/armor/NightvisionGoggles.java b/src/main/java/com/gregtechceu/gtceu/common/item/armor/NightvisionGoggles.java index 1af3f4778e..ba9409cf93 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/armor/NightvisionGoggles.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/armor/NightvisionGoggles.java @@ -5,6 +5,7 @@ import com.gregtechceu.gtceu.api.capability.IElectricItem; import com.gregtechceu.gtceu.api.item.armor.ArmorLogicSuite; import com.gregtechceu.gtceu.utils.input.KeyBind; + import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; @@ -16,6 +17,7 @@ import net.minecraft.world.item.ArmorItem; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; + import org.jetbrains.annotations.NotNull; import java.util.List; @@ -44,13 +46,15 @@ public void onArmorTick(Level world, @NotNull Player player, @NotNull ItemStack if (!nightvision && item.getCharge() >= energyPerUse) { nightvision = true; if (!world.isClientSide) - player.displayClientMessage(Component.translatable("metaarmor.message.nightvision.enabled"), true); + player.displayClientMessage(Component.translatable("metaarmor.message.nightvision.enabled"), + true); } else if (nightvision) { nightvision = false; disableNightVision(world, player, true); } else { if (!world.isClientSide) { - player.displayClientMessage(Component.translatable("metaarmor.message.nightvision.error"), true); + player.displayClientMessage(Component.translatable("metaarmor.message.nightvision.error"), + true); } } @@ -97,4 +101,4 @@ public void addInfo(ItemStack itemStack, List lines) { } } } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/armor/PowerlessJetpack.java b/src/main/java/com/gregtechceu/gtceu/common/item/armor/PowerlessJetpack.java index 29167bfa04..ae4f1a6dc9 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/armor/PowerlessJetpack.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/armor/PowerlessJetpack.java @@ -1,7 +1,5 @@ package com.gregtechceu.gtceu.common.item.armor; -import com.google.common.collect.Table; -import com.google.common.collect.Tables; import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.capability.recipe.*; import com.gregtechceu.gtceu.api.item.armor.ArmorComponentItem; @@ -16,11 +14,14 @@ import com.gregtechceu.gtceu.common.data.GTRecipeTypes; import com.gregtechceu.gtceu.utils.GradientUtil; import com.gregtechceu.gtceu.utils.input.KeyBind; + import com.lowdragmc.lowdraglib.Platform; import com.lowdragmc.lowdraglib.misc.ItemStackTransfer; +import com.lowdragmc.lowdraglib.side.fluid.FluidStack; import com.lowdragmc.lowdraglib.side.fluid.FluidTransferHelper; import com.lowdragmc.lowdraglib.side.fluid.IFluidTransfer; import com.lowdragmc.lowdraglib.side.fluid.forge.FluidHelperImpl; + import net.minecraft.client.gui.GuiGraphics; import net.minecraft.core.NonNullList; import net.minecraft.nbt.CompoundTag; @@ -35,9 +36,11 @@ import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.ForgeCapabilities; -import com.lowdragmc.lowdraglib.side.fluid.FluidStack; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.fluids.capability.templates.FluidHandlerItemStack; + +import com.google.common.collect.Table; +import com.google.common.collect.Tables; import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -129,14 +132,15 @@ public void drawHUD(@NotNull ItemStack item, GuiGraphics guiGraphics) { if (tank != null) { if (tank.getFluidInTank(0).getAmount() == 0) return; String formated = String.format("%.1f", - (tank.getFluidInTank(0).getAmount() * 100.0F / tank.getTankCapacity(0))); + (tank.getFluidInTank(0).getAmount() * 100.0F / tank.getTankCapacity(0))); this.HUD.newString(Component.translatable("metaarmor.hud.fuel_lvl", formated + "%")); CompoundTag data = item.getTag(); if (data != null) { if (data.contains("hover")) { - Component status = (data.getBoolean("hover") ? Component.translatable("metaarmor.hud.status.enabled") : - Component.translatable("metaarmor.hud.status.disabled")); + Component status = (data.getBoolean("hover") ? + Component.translatable("metaarmor.hud.status.enabled") : + Component.translatable("metaarmor.hud.status.disabled")); Component result = Component.translatable("metaarmor.hud.hover_mode", status); this.HUD.newString(result); } @@ -194,15 +198,18 @@ public void findNewRecipe(@NotNull ItemStack stack) { if (internalTank != null) { com.lowdragmc.lowdraglib.side.fluid.FluidStack fluidStack = internalTank.drain(1, false); if (previousRecipe != null && fluidStack != null && - FluidRecipeCapability.CAP.of(previousRecipe.getInputContents(FluidRecipeCapability.CAP).get(0)).test(fluidStack) && + FluidRecipeCapability.CAP.of(previousRecipe.getInputContents(FluidRecipeCapability.CAP).get(0)) + .test(fluidStack) && fluidStack.getAmount() > 0) { currentRecipe = previousRecipe; return; } else if (fluidStack != null) { - Table, List>> table = Tables.newCustomTable(new EnumMap<>(IO.class), IdentityHashMap::new); + Table, List>> table = Tables + .newCustomTable(new EnumMap<>(IO.class), IdentityHashMap::new); FluidRecipeHandler handler = new FluidRecipeHandler(IO.IN, 1, Long.MAX_VALUE); table.put(IO.IN, FluidRecipeCapability.CAP, Collections.singletonList(handler)); IRecipeCapabilityHolder holder = new IRecipeCapabilityHolder() { + @Override public @NotNull Table, List>> getCapabilitiesProxy() { return table; @@ -230,32 +237,37 @@ public void resetRecipe() { public FluidStack getFuel() { if (currentRecipe != null) { - return FluidRecipeCapability.CAP.of(currentRecipe.getInputContents(FluidRecipeCapability.CAP).get(0)).getStacks()[0]; + return FluidRecipeCapability.CAP.of(currentRecipe.getInputContents(FluidRecipeCapability.CAP).get(0)) + .getStacks()[0]; } return FluidStack.empty(); } /* - @Override - public ISpecialArmor.ArmorProperties getProperties(EntityLivingBase player, @NotNull ItemStack armor, - @NotNull DamageSource source, double damage, - EntityEquipmentSlot equipmentSlot) { - int damageLimit = (int) Math.min(Integer.MAX_VALUE, burnTimer * 1.0 / 32 * 25.0); - if (source.isUnblockable()) return new ISpecialArmor.ArmorProperties(0, 0.0, 0); - return new ISpecialArmor.ArmorProperties(0, 0, damageLimit); - } - */ - - public static class Behaviour implements IDurabilityBar, IItemComponent, ISubItemHandler, IAddInformation, IInteractionItem, IComponentCapability { + * @Override + * public ISpecialArmor.ArmorProperties getProperties(EntityLivingBase player, @NotNull ItemStack armor, + * + * @NotNull DamageSource source, double damage, + * EntityEquipmentSlot equipmentSlot) { + * int damageLimit = (int) Math.min(Integer.MAX_VALUE, burnTimer * 1.0 / 32 * 25.0); + * if (source.isUnblockable()) return new ISpecialArmor.ArmorProperties(0, 0.0, 0); + * return new ISpecialArmor.ArmorProperties(0, 0, damageLimit); + * } + */ + + public static class Behaviour implements IDurabilityBar, IItemComponent, ISubItemHandler, IAddInformation, + IInteractionItem, IComponentCapability { private static final Predicate JETPACK_FUEL_FILTER = fluidStack -> { - Table, List>> table = Tables.newCustomTable(new EnumMap<>(IO.class), IdentityHashMap::new); + Table, List>> table = Tables + .newCustomTable(new EnumMap<>(IO.class), IdentityHashMap::new); FluidRecipeHandler handler = new FluidRecipeHandler(IO.IN, 1, Long.MAX_VALUE); handler.getStorages()[0].setFluid(fluidStack); table.put(IO.IN, FluidRecipeCapability.CAP, Collections.singletonList(handler)); table.put(IO.OUT, EURecipeCapability.CAP, Collections.singletonList(new IgnoreEnergyRecipeHandler())); IRecipeCapabilityHolder holder = new IRecipeCapabilityHolder() { + @Override public @NotNull Table, List>> getCapabilitiesProxy() { return table; @@ -278,7 +290,8 @@ public float getDurabilityForDisplay(@NotNull ItemStack itemStack) { IFluidTransfer fluidHandlerItem = FluidTransferHelper.getFluidTransfer(new ItemStackTransfer(itemStack), 0); if (fluidHandlerItem == null) return 0; FluidStack fluidStack = fluidHandlerItem.getFluidInTank(0); - return fluidStack.isEmpty() ? 0 : (float) fluidStack.getAmount() / (float) fluidHandlerItem.getTankCapacity(0); + return fluidStack.isEmpty() ? 0 : + (float) fluidStack.getAmount() / (float) fluidHandlerItem.getTankCapacity(0); } @Nullable @@ -289,16 +302,19 @@ public Pair getDurabilityColorsForDisplay(ItemStack itemStack) @Override public @NotNull LazyOptional getCapability(ItemStack itemStack, @NotNull Capability cap) { - return ForgeCapabilities.FLUID_HANDLER_ITEM.orEmpty(cap, LazyOptional.of(() -> new FluidHandlerItemStack(itemStack, maxCapacity) { - @Override - public boolean canFillFluidType(net.minecraftforge.fluids.FluidStack fluid) { - return JETPACK_FUEL_FILTER.test(FluidHelperImpl.toFluidStack(fluid)); - } - })); + return ForgeCapabilities.FLUID_HANDLER_ITEM.orEmpty(cap, + LazyOptional.of(() -> new FluidHandlerItemStack(itemStack, maxCapacity) { + + @Override + public boolean canFillFluidType(net.minecraftforge.fluids.FluidStack fluid) { + return JETPACK_FUEL_FILTER.test(FluidHelperImpl.toFluidStack(fluid)); + } + })); } @Override - public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltipComponents, TooltipFlag isAdvanced) { + public void appendHoverText(ItemStack stack, @Nullable Level level, List tooltipComponents, + TooltipFlag isAdvanced) { CompoundTag data = stack.getOrCreateTag(); Component status = Component.translatable("metaarmor.hud.status.disabled"); if (data.contains("hover")) { @@ -320,4 +336,4 @@ public void fillItemCategory(Item item, CreativeModeTab category, NonNullList -1) { - ItemStack stack = player.getInventory().items.get(slotId); - InteractionResultHolder result = ArmorUtils.eat(player, stack); - stack = result.getObject(); - if (stack.isEmpty()) - player.getInventory().items.set(slotId, ItemStack.EMPTY); + if (slotId > -1) { + ItemStack stack = items.getStackInSlot(slotId); + InteractionResultHolder result = ArmorUtils.eat(player, stack); + stack = result.getObject(); + if (stack.isEmpty()) + items.setStackInSlot(slotId, ItemStack.EMPTY); - if (result.getResult() == InteractionResult.SUCCESS) - item.discharge(energyPerUse / 10, item.getTier(), true, false, false); + if (result.getResult() == InteractionResult.SUCCESS) + item.discharge(energyPerUse / 10, item.getTier(), true, false, false); + + ret = true; + } - ret = true; } } @@ -148,7 +158,7 @@ public void onArmorTick(Level world, Player player, ItemStack itemStack) { data.putByte("toggleTimer", toggleTimer); } } else if (type == ArmorItem.Type.CHESTPLATE && !player.fireImmune()) { - ((IFireImmuneEntity)player).gtceu$setFireImmune(true); + ((IFireImmuneEntity) player).gtceu$setFireImmune(true); if (player.isOnFire()) player.extinguishFire(); } else if (type == ArmorItem.Type.LEGGINGS) { @@ -172,21 +182,21 @@ public void onArmorTick(Level world, Player player, ItemStack itemStack) { } player.moveRelative(speed, new Vec3(0, 0, 1)); } else if (item.canUse(energyPerUse / 100) && player.isInWater() && - (KeyBind.VANILLA_SNEAK.isKeyDown(player) || KeyBind.VANILLA_JUMP.isKeyDown(player))) { - byte consumerTicks = data.getByte("consumerTicks"); - ++consumerTicks; - if (consumerTicks >= 10) { - consumerTicks = 0; - item.discharge(energyPerUse / 100, item.getTier(), true, false, false); - ret = true; - } - data.putByte("consumerTicks", consumerTicks); - double acceleration = 0.085D; - if (KeyBind.VANILLA_SNEAK.isKeyDown(player)) - player.push(0.0, -acceleration, 0.0); - if (KeyBind.VANILLA_JUMP.isKeyDown(player)) - player.push(0.0, acceleration, 0.0); - } + (KeyBind.VANILLA_SNEAK.isKeyDown(player) || KeyBind.VANILLA_JUMP.isKeyDown(player))) { + byte consumerTicks = data.getByte("consumerTicks"); + ++consumerTicks; + if (consumerTicks >= 10) { + consumerTicks = 0; + item.discharge(energyPerUse / 100, item.getTier(), true, false, false); + ret = true; + } + data.putByte("consumerTicks", consumerTicks); + double acceleration = 0.085D; + if (KeyBind.VANILLA_SNEAK.isKeyDown(player)) + player.push(0.0, -acceleration, 0.0); + if (KeyBind.VANILLA_JUMP.isKeyDown(player)) + player.push(0.0, acceleration, 0.0); + } } else if (type == ArmorItem.Type.BOOTS) { if (!world.isClientSide) { boolean onGround = !data.contains("onGround") || data.getBoolean("onGround"); @@ -234,40 +244,41 @@ public static void disableNightVision(@NotNull Level world, Player player, boole } /* - @Override - public ArmorProperties getProperties(EntityLivingBase player, @NotNull ItemStack armor, DamageSource source, - double damage, EntityEquipmentSlot equipmentSlot) { - int damageLimit = Integer.MAX_VALUE; - IElectricItem item = armor.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); - if (item == null) { - return new ArmorProperties(0, 0, damageLimit); - } - if (energyPerUse > 0) { - damageLimit = (int) Math.min(damageLimit, 25.0D * item.getCharge() / (energyPerUse * 100.0D)); - } - - if (source == DamageSource.FALL) { - if (SLOT == EntityEquipmentSlot.FEET) { - return new ArmorProperties(10, 1.0D, damageLimit); - } - - if (SLOT == EntityEquipmentSlot.LEGS) { - return new ArmorProperties(9, 0.8D, damageLimit); - } - } - return new ArmorProperties(8, getDamageAbsorption() * getAbsorption(armor), damageLimit); - } - - @Override - public boolean handleUnblockableDamage(EntityLivingBase entity, @NotNull ItemStack armor, DamageSource source, - double damage, EntityEquipmentSlot equipmentSlot) { - return source != DamageSource.FALL && source != DamageSource.DROWN && source != DamageSource.STARVE && - source != DamageSource.OUT_OF_WORLD; - } - */ + * @Override + * public ArmorProperties getProperties(EntityLivingBase player, @NotNull ItemStack armor, DamageSource source, + * double damage, EntityEquipmentSlot equipmentSlot) { + * int damageLimit = Integer.MAX_VALUE; + * IElectricItem item = armor.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); + * if (item == null) { + * return new ArmorProperties(0, 0, damageLimit); + * } + * if (energyPerUse > 0) { + * damageLimit = (int) Math.min(damageLimit, 25.0D * item.getCharge() / (energyPerUse * 100.0D)); + * } + * + * if (source == DamageSource.FALL) { + * if (SLOT == EntityEquipmentSlot.FEET) { + * return new ArmorProperties(10, 1.0D, damageLimit); + * } + * + * if (SLOT == EntityEquipmentSlot.LEGS) { + * return new ArmorProperties(9, 0.8D, damageLimit); + * } + * } + * return new ArmorProperties(8, getDamageAbsorption() * getAbsorption(armor), damageLimit); + * } + * + * @Override + * public boolean handleUnblockableDamage(EntityLivingBase entity, @NotNull ItemStack armor, DamageSource source, + * double damage, EntityEquipmentSlot equipmentSlot) { + * return source != DamageSource.FALL && source != DamageSource.DROWN && source != DamageSource.STARVE && + * source != DamageSource.OUT_OF_WORLD; + * } + */ @Override - public void damageArmor(LivingEntity entity, ItemStack itemStack, DamageSource source, int damage, EquipmentSlot equipmentSlot) { + public void damageArmor(LivingEntity entity, ItemStack itemStack, DamageSource source, int damage, + EquipmentSlot equipmentSlot) { IElectricItem item = GTCapabilityHelper.getElectricItem(itemStack); if (item == null) { return; @@ -277,13 +288,13 @@ public void damageArmor(LivingEntity entity, ItemStack itemStack, DamageSource s @Override public ResourceLocation getArmorTexture(ItemStack stack, Entity entity, EquipmentSlot slot, String type) { - ItemStack currentChest = Minecraft.getInstance().player.getInventory() - .armor.get(EquipmentSlot.CHEST.getIndex()); + ItemStack currentChest = Minecraft.getInstance().player.getInventory().armor + .get(EquipmentSlot.CHEST.getIndex()); String armorTexture = "quark_tech_suite"; if (currentChest.is(GTItems.QUANTUM_CHESTPLATE_ADVANCED.get())) armorTexture = "advanced_quark_tech_suite"; return slot != EquipmentSlot.LEGS ? - GTCEu.id(String.format("textures/armor/%s_1.png", armorTexture)) : - GTCEu.id(String.format("textures/armor/%s_2.png", armorTexture)); + GTCEu.id(String.format("textures/armor/%s_1.png", armorTexture)) : + GTCEu.id(String.format("textures/armor/%s_2.png", armorTexture)); } @Override @@ -333,4 +344,4 @@ public void addInfo(ItemStack itemStack, List lines) { public boolean isPPE() { return true; } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/tool/ToolEventHandlers.java b/src/main/java/com/gregtechceu/gtceu/common/item/tool/ToolEventHandlers.java index de53f0f23d..6ad6003fbe 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/tool/ToolEventHandlers.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/tool/ToolEventHandlers.java @@ -6,7 +6,7 @@ import com.gregtechceu.gtceu.api.item.IGTTool; import com.gregtechceu.gtceu.api.item.capability.ElectricItem; import com.gregtechceu.gtceu.api.item.tool.ToolHelper; -import it.unimi.dsi.fastutil.objects.ObjectArrayList; + import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.server.TickTask; @@ -33,6 +33,8 @@ import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; + +import it.unimi.dsi.fastutil.objects.ObjectArrayList; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -59,7 +61,8 @@ public static void onPlayerDestroyItem(ItemStack original, InteractionHand hand, electricItem.setMaxChargeOverride(def.getMaxCharge(original)); } - electricStack.charge(Math.min(remainingCharge, def.getMaxCharge(original)), def.getElectricTier(), true, false); + electricStack.charge(Math.min(remainingCharge, def.getMaxCharge(original)), def.getElectricTier(), + true, false); } } if (!brokenStack.isEmpty()) { @@ -99,13 +102,17 @@ public static InteractionResult onPlayerEntityInteract(Player player, Interactio * Handles mined blocks teleporting straight into inventory * Handles drop conversion when a hammer tool (or tool with hard hammer enchantment) is used */ - public static ObjectArrayList onHarvestDrops(@Nullable Player player, ItemStack tool, Level world, BlockPos pos, BlockState state, boolean isSilkTouch, int fortuneLevel, ObjectArrayList drops, float dropChance) { + public static ObjectArrayList onHarvestDrops(@Nullable Player player, ItemStack tool, Level world, + BlockPos pos, BlockState state, boolean isSilkTouch, + int fortuneLevel, ObjectArrayList drops, + float dropChance) { if (player != null && world instanceof ServerLevel serverLevel) { if (tool.isEmpty() || !tool.hasTag() || !(tool.getItem() instanceof IGTTool)) { return drops; } if (!isSilkTouch) { - ToolHelper.applyHammerDropConversion(serverLevel, pos, tool, state, drops, fortuneLevel, dropChance, player.getRandom()); + ToolHelper.applyHammerDropConversion(serverLevel, pos, tool, state, drops, fortuneLevel, dropChance, + player.getRandom()); } if (!ToolHelper.hasBehaviorsTag(tool)) return drops; @@ -168,7 +175,8 @@ public static void onPlayerDestroyItem(@NotNull PlayerDestroyItemEvent event) { @SubscribeEvent public static void onPlayerEntityInteract(@NotNull PlayerInteractEvent.EntityInteract event) { - InteractionResult result = ToolEventHandlers.onPlayerEntityInteract(event.getEntity(), event.getHand(), event.getTarget()); + InteractionResult result = ToolEventHandlers.onPlayerEntityInteract(event.getEntity(), event.getHand(), + event.getTarget()); if (result != InteractionResult.PASS) { event.setCanceled(true); event.setCancellationResult(result); diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/BlockRotatingBehavior.java b/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/BlockRotatingBehavior.java index ba990ab2cd..7d645ec0a3 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/BlockRotatingBehavior.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/BlockRotatingBehavior.java @@ -5,7 +5,9 @@ import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; import com.gregtechceu.gtceu.common.item.tool.rotation.CustomBlockRotations; import com.gregtechceu.gtceu.common.item.tool.rotation.ICustomRotationBehavior; + import com.lowdragmc.lowdraglib.utils.RayTraceHelper; + import net.minecraft.core.BlockPos; import net.minecraft.network.chat.Component; import net.minecraft.world.InteractionResult; @@ -24,6 +26,7 @@ import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -62,10 +65,11 @@ public InteractionResult onItemUseFirst(ItemStack stack, UseOnContext context) { ToolHelper.onActionDone(player, level, context.getHand()); return InteractionResult.SUCCESS; } - } else if (state.rotate(player.getDirection().getClockWise() == context.getClickedFace() ? Rotation.CLOCKWISE_90 : Rotation.COUNTERCLOCKWISE_90) != state) { - ToolHelper.onActionDone(player, level, context.getHand()); - return InteractionResult.SUCCESS; - } + } else if (state.rotate(player.getDirection().getClockWise() == context.getClickedFace() ? + Rotation.CLOCKWISE_90 : Rotation.COUNTERCLOCKWISE_90) != state) { + ToolHelper.onActionDone(player, level, context.getHand()); + return InteractionResult.SUCCESS; + } } return InteractionResult.PASS; } @@ -83,11 +87,12 @@ public static BlockHitResult retraceBlock(BlockGetter level, Player player, Bloc VoxelShape baseShape = state.getShape(level, pos); BlockHitResult baseTraceResult = baseShape.clip(startVec, endVec, pos); if (baseTraceResult != null) { - BlockHitResult raytraceTraceShape = state.getVisualShape(level, pos, CollisionContext.of(player)).clip(startVec, endVec, pos); + BlockHitResult raytraceTraceShape = state.getVisualShape(level, pos, CollisionContext.of(player)) + .clip(startVec, endVec, pos); if (raytraceTraceShape != null) { return raytraceTraceShape; } } return baseTraceResult; } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/DisableShieldBehavior.java b/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/DisableShieldBehavior.java index e06dc956f1..acfe15fe54 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/DisableShieldBehavior.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/DisableShieldBehavior.java @@ -2,12 +2,14 @@ import com.gregtechceu.gtceu.api.item.tool.ToolHelper; import com.gregtechceu.gtceu.api.item.tool.behavior.IToolBehavior; + import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.level.Level; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -30,7 +32,8 @@ public void addBehaviorNBT(@NotNull ItemStack stack, @NotNull CompoundTag tag) { } @Override - public void addInformation(@NotNull ItemStack stack, @Nullable Level world, @NotNull List tooltip, @NotNull TooltipFlag flag) { + public void addInformation(@NotNull ItemStack stack, @Nullable Level world, @NotNull List tooltip, + @NotNull TooltipFlag flag) { tooltip.add(Component.translatable("item.gtceu.tool.behavior.shield_disable")); } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/EntityDamageBehavior.java b/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/EntityDamageBehavior.java index 6663575177..6f6eea4f41 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/EntityDamageBehavior.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/EntityDamageBehavior.java @@ -1,15 +1,15 @@ package com.gregtechceu.gtceu.common.item.tool.behavior; import com.gregtechceu.gtceu.api.item.tool.behavior.IToolBehavior; + import net.minecraft.network.chat.Component; import net.minecraft.world.damagesource.DamageSource; -import net.minecraft.world.damagesource.DamageSources; -import net.minecraft.world.damagesource.DamageTypes; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.level.Level; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -71,4 +71,4 @@ public void addInformation(@NotNull ItemStack stack, @Nullable Level world, @Not Component.translatable("item.gtceu.tool.behavior.damage_boost_" + mobType))); } } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/GrassPathBehavior.java b/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/GrassPathBehavior.java index 189ece4f50..9714f106d8 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/GrassPathBehavior.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/GrassPathBehavior.java @@ -1,9 +1,9 @@ package com.gregtechceu.gtceu.common.item.tool.behavior; -import com.google.common.collect.ImmutableSet; import com.gregtechceu.gtceu.api.item.tool.ToolHelper; import com.gregtechceu.gtceu.api.item.tool.aoe.AoESymmetrical; import com.gregtechceu.gtceu.api.item.tool.behavior.IToolBehavior; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.network.chat.Component; @@ -21,6 +21,8 @@ import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.HitResult; import net.minecraftforge.common.ToolActions; + +import com.google.common.collect.ImmutableSet; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -76,7 +78,8 @@ public InteractionResult onItemUse(UseOnContext context) { boolean pathed = false; for (BlockPos blockPos : blocks) { - BlockState newState = getFlattened(level.getBlockState(blockPos), new UseOnContext(player, hand, context.getHitResult().withPosition(blockPos))); + BlockState newState = getFlattened(level.getBlockState(blockPos), + new UseOnContext(player, hand, context.getHitResult().withPosition(blockPos))); if (newState == null) { continue; } @@ -100,10 +103,12 @@ public InteractionResult onItemUse(UseOnContext context) { public static Set getPathConvertibleBlocks(ItemStack stack, AoESymmetrical aoeDefinition, Level world, Player player, HitResult rayTraceResult) { - return ToolHelper.iterateAoE(stack, aoeDefinition, world, player, rayTraceResult, GrassPathBehavior.INSTANCE::isBlockPathConvertible); + return ToolHelper.iterateAoE(stack, aoeDefinition, world, player, rayTraceResult, + GrassPathBehavior.INSTANCE::isBlockPathConvertible); } - protected boolean isBlockPathConvertible(ItemStack stack, Level level, Player player, BlockPos pos, UseOnContext context) { + protected boolean isBlockPathConvertible(ItemStack stack, Level level, Player player, BlockPos pos, + UseOnContext context) { if (level.getBlockState(pos.above()).isAir()) { BlockState state = level.getBlockState(pos); BlockState newState = state.getToolModifiedState(context, ToolActions.SHOVEL_FLATTEN, false); @@ -117,7 +122,8 @@ protected BlockState getFlattened(BlockState unFlattenedState, UseOnContext cont } @Override - public void addInformation(@NotNull ItemStack stack, @Nullable Level Level, @NotNull List tooltip, @NotNull TooltipFlag flag) { + public void addInformation(@NotNull ItemStack stack, @Nullable Level Level, @NotNull List tooltip, + @NotNull TooltipFlag flag) { tooltip.add(Component.translatable("item.gtceu.tool.behavior.grass_path")); } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/HarvestCropsBehavior.java b/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/HarvestCropsBehavior.java index 68037b2baa..3eabef59a3 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/HarvestCropsBehavior.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/HarvestCropsBehavior.java @@ -1,10 +1,10 @@ package com.gregtechceu.gtceu.common.item.tool.behavior; -import com.google.common.collect.ImmutableSet; import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.item.tool.ToolHelper; import com.gregtechceu.gtceu.api.item.tool.aoe.AoESymmetrical; import com.gregtechceu.gtceu.api.item.tool.behavior.IToolBehavior; + import net.minecraft.core.BlockPos; import net.minecraft.core.NonNullList; import net.minecraft.network.chat.Component; @@ -23,6 +23,8 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.HitResult; + +import com.google.common.collect.ImmutableSet; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -64,7 +66,8 @@ public InteractionResult onItemUse(UseOnContext context) { if (blockHitResult.getDirection() == null) return InteractionResult.PASS; - blocks = ToolHelper.iterateAoE(stack, aoeDefinition, player.level(), player, rayTraceResult, HarvestCropsBehavior::isBlockCrops); + blocks = ToolHelper.iterateAoE(stack, aoeDefinition, player.level(), player, rayTraceResult, + HarvestCropsBehavior::isBlockCrops); if (isBlockCrops(stack, context.getLevel(), player, blockHitResult.getBlockPos(), context)) { blocks.add(blockHitResult.getBlockPos()); } @@ -80,7 +83,8 @@ public InteractionResult onItemUse(UseOnContext context) { return harvested ? InteractionResult.SUCCESS : InteractionResult.PASS; } - private static boolean isBlockCrops(ItemStack stack, Level world, Player player, BlockPos pos, @Nullable UseOnContext context) { + private static boolean isBlockCrops(ItemStack stack, Level world, Player player, BlockPos pos, + @Nullable UseOnContext context) { if (world.getBlockState(pos.above()).isAir()) { Block block = world.getBlockState(pos).getBlock(); return block instanceof CropBlock; @@ -125,4 +129,4 @@ public void addInformation(@NotNull ItemStack stack, @Nullable Level world, @Not @NotNull TooltipFlag flag) { tooltip.add(Component.translatable("item.gtceu.tool.behavior.crop_harvesting")); } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/HarvestIceBehavior.java b/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/HarvestIceBehavior.java index c0c7189941..c6adf80744 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/HarvestIceBehavior.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/HarvestIceBehavior.java @@ -2,11 +2,13 @@ import com.gregtechceu.gtceu.api.item.tool.ToolHelper; import com.gregtechceu.gtceu.api.item.tool.behavior.IToolBehavior; + import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.level.Level; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -33,4 +35,4 @@ public void addInformation(@NotNull ItemStack stack, @Nullable Level world, @Not @NotNull TooltipFlag flag) { tooltip.add(Component.translatable("item.gtceu.tool.behavior.silk_ice")); } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/HoeGroundBehavior.java b/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/HoeGroundBehavior.java index 85d319ab5c..b43c0e319c 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/HoeGroundBehavior.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/HoeGroundBehavior.java @@ -1,9 +1,9 @@ package com.gregtechceu.gtceu.common.item.tool.behavior; -import com.google.common.collect.ImmutableSet; import com.gregtechceu.gtceu.api.item.tool.ToolHelper; import com.gregtechceu.gtceu.api.item.tool.aoe.AoESymmetrical; import com.gregtechceu.gtceu.api.item.tool.behavior.IToolBehavior; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.network.chat.Component; @@ -12,7 +12,6 @@ import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.HoeItem; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.item.context.UseOnContext; @@ -23,6 +22,8 @@ import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.HitResult; import net.minecraftforge.common.ToolActions; + +import com.google.common.collect.ImmutableSet; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -30,7 +31,8 @@ import java.util.Set; /** - * Used to allow a tool to hoe the ground, only if it cannot extend the {@link com.gregtechceu.gtceu.api.item.tool.GTHoeItem} + * Used to allow a tool to hoe the ground, only if it cannot extend the + * {@link com.gregtechceu.gtceu.api.item.tool.GTHoeItem} * class. */ public class HoeGroundBehavior implements IToolBehavior { @@ -99,8 +101,10 @@ public InteractionResult onItemUse(UseOnContext context) { return InteractionResult.PASS; } - public static Set getTillableBlocks(ItemStack stack, AoESymmetrical aoeDefinition, Level world, Player player, HitResult rayTraceResult) { - return ToolHelper.iterateAoE(stack, aoeDefinition, world, player, rayTraceResult, HoeGroundBehavior.INSTANCE::isBlockTillable); + public static Set getTillableBlocks(ItemStack stack, AoESymmetrical aoeDefinition, Level world, + Player player, HitResult rayTraceResult) { + return ToolHelper.iterateAoE(stack, aoeDefinition, world, player, rayTraceResult, + HoeGroundBehavior.INSTANCE::isBlockTillable); } protected boolean isBlockTillable(ItemStack stack, Level world, Player player, BlockPos pos, UseOnContext context) { @@ -115,14 +119,16 @@ protected boolean isBlockTillable(ItemStack stack, Level world, Player player, B protected boolean tillGround(UseOnContext context, BlockState state) { BlockState newState = state.getToolModifiedState(context, ToolActions.HOE_TILL, false); if (newState != null && newState != state) { - context.getLevel().gameEvent(GameEvent.BLOCK_CHANGE, context.getClickedPos(), GameEvent.Context.of(context.getPlayer(), state)); + context.getLevel().gameEvent(GameEvent.BLOCK_CHANGE, context.getClickedPos(), + GameEvent.Context.of(context.getPlayer(), state)); return context.getLevel().setBlock(context.getClickedPos(), newState, Block.UPDATE_ALL_IMMEDIATE); } return false; } @Override - public void addInformation(@NotNull ItemStack stack, @Nullable Level world, @NotNull List tooltip, @NotNull TooltipFlag flag) { + public void addInformation(@NotNull ItemStack stack, @Nullable Level world, @NotNull List tooltip, + @NotNull TooltipFlag flag) { tooltip.add(Component.translatable("item.gtceu.tool.behavior.ground_tilling")); } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/LogStripBehavior.java b/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/LogStripBehavior.java index cd15221872..9c03bf4d06 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/LogStripBehavior.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/LogStripBehavior.java @@ -1,9 +1,9 @@ package com.gregtechceu.gtceu.common.item.tool.behavior; -import com.google.common.collect.ImmutableSet; import com.gregtechceu.gtceu.api.item.tool.ToolHelper; import com.gregtechceu.gtceu.api.item.tool.aoe.AoESymmetrical; import com.gregtechceu.gtceu.api.item.tool.behavior.IToolBehavior; + import net.minecraft.core.BlockPos; import net.minecraft.network.chat.Component; import net.minecraft.sounds.SoundEvents; @@ -20,6 +20,8 @@ import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.HitResult; import net.minecraftforge.common.ToolActions; + +import com.google.common.collect.ImmutableSet; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -72,7 +74,10 @@ public InteractionResult onItemUse(UseOnContext context) { boolean stripped = false; for (BlockPos blockPos : blocks) { - stripped |= level.setBlock(blockPos, getStripped(level.getBlockState(blockPos), new UseOnContext(player, hand, context.getHitResult().withPosition(blockPos))), Block.UPDATE_ALL); + stripped |= level.setBlock(blockPos, + getStripped(level.getBlockState(blockPos), + new UseOnContext(player, hand, context.getHitResult().withPosition(blockPos))), + Block.UPDATE_ALL); if (!player.isCreative()) { ToolHelper.damageItem(context.getItemInHand(), context.getPlayer()); } @@ -92,10 +97,12 @@ public InteractionResult onItemUse(UseOnContext context) { public static Set getStrippableBlocks(ItemStack stack, AoESymmetrical aoeDefinition, Level Level, Player player, HitResult rayTraceResult) { - return ToolHelper.iterateAoE(stack, aoeDefinition, Level, player, rayTraceResult, LogStripBehavior.INSTANCE::isBlockStrippable); + return ToolHelper.iterateAoE(stack, aoeDefinition, Level, player, rayTraceResult, + LogStripBehavior.INSTANCE::isBlockStrippable); } - protected boolean isBlockStrippable(ItemStack stack, Level level, Player player, BlockPos pos, UseOnContext context) { + protected boolean isBlockStrippable(ItemStack stack, Level level, Player player, BlockPos pos, + UseOnContext context) { BlockState state = level.getBlockState(pos); BlockState newState = state.getToolModifiedState(context, ToolActions.AXE_STRIP, false); return newState != null && newState != state; @@ -110,4 +117,4 @@ public void addInformation(@NotNull ItemStack stack, @Nullable Level Level, @Not @NotNull TooltipFlag flag) { tooltip.add(Component.translatable("item.gtceu.tool.behavior.strip_log")); } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/PlungerBehavior.java b/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/PlungerBehavior.java index 979659d88f..1ea15684a6 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/PlungerBehavior.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/PlungerBehavior.java @@ -1,15 +1,16 @@ package com.gregtechceu.gtceu.common.item.tool.behavior; -import com.gregtechceu.gtceu.api.blockentity.MetaMachineBlockEntity; import com.gregtechceu.gtceu.api.item.component.IInteractionItem; import com.gregtechceu.gtceu.api.item.component.forge.IComponentCapability; import com.gregtechceu.gtceu.api.item.tool.ToolHelper; import com.gregtechceu.gtceu.api.item.tool.behavior.IToolBehavior; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; import com.gregtechceu.gtceu.api.misc.forge.VoidFluidHandlerItemStack; + import com.lowdragmc.lowdraglib.side.fluid.FluidHelper; import com.lowdragmc.lowdraglib.side.fluid.FluidTransferHelper; import com.lowdragmc.lowdraglib.side.fluid.IFluidTransfer; + import net.minecraft.network.chat.Component; import net.minecraft.world.InteractionResult; import net.minecraft.world.item.ItemStack; @@ -20,6 +21,7 @@ import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.fluids.FluidStack; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -42,17 +44,18 @@ public boolean shouldOpenUIAfterUse(UseOnContext context) { @Override public InteractionResult onItemUseFirst(ItemStack stack, UseOnContext context) { - if (context.getPlayer() == null || !context.getPlayer().isShiftKeyDown()) { return InteractionResult.PASS; } IFluidTransfer fluidHandler; - if (context.getLevel().getBlockEntity(context.getClickedPos()) instanceof IMachineBlockEntity metaMachineBlockEntity) { + if (context.getLevel() + .getBlockEntity(context.getClickedPos()) instanceof IMachineBlockEntity metaMachineBlockEntity) { fluidHandler = metaMachineBlockEntity.getMetaMachine().getFluidTransferCap(context.getClickedFace(), false); } else { - fluidHandler = FluidTransferHelper.getFluidTransfer(context.getLevel(), context.getClickedPos(), context.getClickedFace()); + fluidHandler = FluidTransferHelper.getFluidTransfer(context.getLevel(), context.getClickedPos(), + context.getClickedFace()); } if (fluidHandler == null) { @@ -77,17 +80,19 @@ public void addInformation(@NotNull ItemStack stack, @Nullable Level world, @Not @Override public @NotNull LazyOptional getCapability(ItemStack itemStack, @NotNull Capability cap) { if (cap == ForgeCapabilities.FLUID_HANDLER_ITEM) { - return ForgeCapabilities.FLUID_HANDLER_ITEM.orEmpty(cap, LazyOptional.of(() -> new VoidFluidHandlerItemStack(itemStack) { - @Override - public int fill(FluidStack resource, FluidAction doFill) { - int result = super.fill(resource, doFill); - if (result > 0) { - ToolHelper.damageItem(getContainer(), null); - } - return result; - } - })); + return ForgeCapabilities.FLUID_HANDLER_ITEM.orEmpty(cap, + LazyOptional.of(() -> new VoidFluidHandlerItemStack(itemStack) { + + @Override + public int fill(FluidStack resource, FluidAction doFill) { + int result = super.fill(resource, doFill); + if (result > 0) { + ToolHelper.damageItem(getContainer(), null); + } + return result; + } + })); } return LazyOptional.empty(); } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/RotateRailBehavior.java b/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/RotateRailBehavior.java index 09a0a3612e..0132624f36 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/RotateRailBehavior.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/RotateRailBehavior.java @@ -2,6 +2,7 @@ import com.gregtechceu.gtceu.api.item.tool.ToolHelper; import com.gregtechceu.gtceu.api.item.tool.behavior.IToolBehavior; + import net.minecraft.network.chat.Component; import net.minecraft.world.InteractionResult; import net.minecraft.world.item.ItemStack; @@ -10,9 +11,9 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.BaseRailBlock; import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.RailBlock; import net.minecraft.world.level.block.Rotation; import net.minecraft.world.level.block.state.BlockState; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -29,7 +30,8 @@ protected RotateRailBehavior() {/**/} public InteractionResult onItemUseFirst(ItemStack stack, UseOnContext context) { BlockState state = context.getLevel().getBlockState(context.getClickedPos()); if (state.getBlock() instanceof BaseRailBlock) { - if (context.getLevel().setBlock(context.getClickedPos(), state.rotate(Rotation.CLOCKWISE_90), Block.UPDATE_ALL)) { + if (context.getLevel().setBlock(context.getClickedPos(), state.rotate(Rotation.CLOCKWISE_90), + Block.UPDATE_ALL)) { ToolHelper.onActionDone(context.getPlayer(), context.getLevel(), context.getHand()); return InteractionResult.SUCCESS; } @@ -42,4 +44,4 @@ public void addInformation(@NotNull ItemStack stack, @Nullable Level world, @Not @NotNull TooltipFlag flag) { tooltip.add(Component.translatable("item.gtceu.tool.behavior.rail_rotation")); } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/ScrapeBehavior.java b/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/ScrapeBehavior.java index e1051473ef..b6ef0098ea 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/ScrapeBehavior.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/ScrapeBehavior.java @@ -1,9 +1,9 @@ package com.gregtechceu.gtceu.common.item.tool.behavior; -import com.google.common.collect.ImmutableSet; import com.gregtechceu.gtceu.api.item.tool.ToolHelper; import com.gregtechceu.gtceu.api.item.tool.aoe.AoESymmetrical; import com.gregtechceu.gtceu.api.item.tool.behavior.IToolBehavior; + import net.minecraft.core.BlockPos; import net.minecraft.network.chat.Component; import net.minecraft.sounds.SoundEvents; @@ -21,6 +21,8 @@ import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.HitResult; import net.minecraftforge.common.ToolActions; + +import com.google.common.collect.ImmutableSet; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -73,7 +75,10 @@ public InteractionResult onItemUse(UseOnContext context) { boolean pathed = false; for (BlockPos blockPos : blocks) { - pathed |= level.setBlock(blockPos, getScraped(level.getBlockState(blockPos), new UseOnContext(player, hand, context.getHitResult().withPosition(blockPos))), Block.UPDATE_ALL); + pathed |= level.setBlock(blockPos, + getScraped(level.getBlockState(blockPos), + new UseOnContext(player, hand, context.getHitResult().withPosition(blockPos))), + Block.UPDATE_ALL); level.levelEvent(player, LevelEvent.PARTICLES_SCRAPE, blockPos, 0); if (!player.isCreative()) { ToolHelper.damageItem(context.getItemInHand(), context.getPlayer()); @@ -92,12 +97,14 @@ public InteractionResult onItemUse(UseOnContext context) { return InteractionResult.PASS; } - public static Set getScrapableBlocks(ItemStack stack, AoESymmetrical aoeDefinition, Level Level, Player player, HitResult rayTraceResult) { + public static Set getScrapableBlocks(ItemStack stack, AoESymmetrical aoeDefinition, Level Level, + Player player, HitResult rayTraceResult) { return ToolHelper.iterateAoE(stack, aoeDefinition, Level, player, rayTraceResult, ScrapeBehavior.INSTANCE::isBlockScrapable); } - protected boolean isBlockScrapable(ItemStack stack, Level level, Player player, BlockPos pos, UseOnContext context) { + protected boolean isBlockScrapable(ItemStack stack, Level level, Player player, BlockPos pos, + UseOnContext context) { BlockState state = level.getBlockState(pos); BlockState newState = state.getToolModifiedState(context, ToolActions.AXE_SCRAPE, false); return newState != null && newState != state; @@ -114,4 +121,4 @@ public void addInformation(@NotNull ItemStack stack, @Nullable Level Level, @Not @NotNull TooltipFlag flag) { tooltip.add(Component.translatable("item.gtceu.tool.behavior.scrape")); } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/ToolModeSwitchBehavior.java b/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/ToolModeSwitchBehavior.java index b0ec716e38..91573808dd 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/ToolModeSwitchBehavior.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/ToolModeSwitchBehavior.java @@ -1,7 +1,7 @@ package com.gregtechceu.gtceu.common.item.tool.behavior; import com.gregtechceu.gtceu.api.item.tool.behavior.IToolBehavior; -import lombok.Getter; + import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; import net.minecraft.world.InteractionHand; @@ -10,6 +10,8 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.level.Level; + +import lombok.Getter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -18,24 +20,27 @@ import static com.gregtechceu.gtceu.api.item.tool.ToolHelper.getBehaviorsTag; public class ToolModeSwitchBehavior implements IToolBehavior { + public static final ToolModeSwitchBehavior INSTANCE = new ToolModeSwitchBehavior(); - protected ToolModeSwitchBehavior () {} + protected ToolModeSwitchBehavior() {} @Override public void addBehaviorNBT(@NotNull ItemStack stack, @NotNull CompoundTag tag) { - tag.putByte("Mode", (byte)ModeType.BOTH.ordinal()); + tag.putByte("Mode", (byte) ModeType.BOTH.ordinal()); IToolBehavior.super.addBehaviorNBT(stack, tag); } @Override - public @NotNull InteractionResultHolder onItemRightClick(@NotNull Level world, @NotNull Player player, @NotNull InteractionHand hand) { + public @NotNull InteractionResultHolder onItemRightClick(@NotNull Level world, @NotNull Player player, + @NotNull InteractionHand hand) { var itemStack = player.getItemInHand(hand); var tagCompound = getBehaviorsTag(itemStack); - if(player.isShiftKeyDown()) { + if (player.isShiftKeyDown()) { tagCompound.putByte("Mode", (byte) ((tagCompound.getByte("Mode") + 1) % ModeType.values().length)); - player.displayClientMessage(Component.translatable("metaitem.machine_configuration.mode", ModeType.values()[tagCompound.getByte("Mode")].getName()), true); + player.displayClientMessage(Component.translatable("metaitem.machine_configuration.mode", + ModeType.values()[tagCompound.getByte("Mode")].getName()), true); return InteractionResultHolder.success(itemStack); } @@ -43,12 +48,15 @@ public void addBehaviorNBT(@NotNull ItemStack stack, @NotNull CompoundTag tag) { } @Override - public void addInformation(@NotNull ItemStack stack, @Nullable Level world, @NotNull List tooltip, @NotNull TooltipFlag flag) { + public void addInformation(@NotNull ItemStack stack, @Nullable Level world, @NotNull List tooltip, + @NotNull TooltipFlag flag) { var tagCompound = getBehaviorsTag(stack); - tooltip.add(Component.translatable("metaitem.machine_configuration.mode", ModeType.values()[tagCompound.getByte("Mode")].getName())); + tooltip.add(Component.translatable("metaitem.machine_configuration.mode", + ModeType.values()[tagCompound.getByte("Mode")].getName())); } public static enum ModeType { + ITEM(Component.translatable("gtceu.mode.item")), FLUID(Component.translatable("gtceu.mode.fluid")), BOTH(Component.translatable("gtceu.mode.both")); diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/TorchPlaceBehavior.java b/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/TorchPlaceBehavior.java index cc69516ae1..fed5c13a0f 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/TorchPlaceBehavior.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/TorchPlaceBehavior.java @@ -3,6 +3,7 @@ import com.gregtechceu.gtceu.api.data.tag.TagUtil; import com.gregtechceu.gtceu.api.item.tool.ToolHelper; import com.gregtechceu.gtceu.api.item.tool.behavior.IToolBehavior; + import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; @@ -21,6 +22,7 @@ import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.block.state.BlockState; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -92,7 +94,8 @@ private static boolean checkAndPlaceTorch(UseOnContext context, ItemStack slotSt if (slotItemBlock.place(blockPlaceContext).consumesAction()) { slotState = context.getLevel().getBlockState(pos); SoundType soundtype = slotState.getBlock().getSoundType(slotState); - context.getLevel().playSound(context.getPlayer(), pos, soundtype.getPlaceSound(), SoundSource.BLOCKS, + context.getLevel().playSound(context.getPlayer(), pos, soundtype.getPlaceSound(), + SoundSource.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F); if (!context.getPlayer().isCreative()) slotStack.shrink(1); return true; @@ -114,4 +117,4 @@ public void addInformation(@NotNull ItemStack stack, @Nullable Level Level, @Not @NotNull TooltipFlag flag) { tooltip.add(Component.translatable("item.gtceu.tool.behavior.torch_place")); } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/TreeFellingBehavior.java b/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/TreeFellingBehavior.java index 4d2c702b3c..12228fd18c 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/TreeFellingBehavior.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/TreeFellingBehavior.java @@ -3,6 +3,7 @@ import com.gregtechceu.gtceu.api.item.IGTTool; import com.gregtechceu.gtceu.api.item.tool.ToolHelper; import com.gregtechceu.gtceu.api.item.tool.behavior.IToolBehavior; + import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; @@ -10,6 +11,7 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.level.Level; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -35,4 +37,4 @@ public void addInformation(@NotNull ItemStack stack, @Nullable Level world, @Not @NotNull TooltipFlag flag) { tooltip.add(Component.translatable("item.gtceu.tool.behavior.tree_felling")); } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/WaxOffBehavior.java b/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/WaxOffBehavior.java index ef25dc8ca5..325be349a0 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/WaxOffBehavior.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/tool/behavior/WaxOffBehavior.java @@ -1,9 +1,9 @@ package com.gregtechceu.gtceu.common.item.tool.behavior; -import com.google.common.collect.ImmutableSet; import com.gregtechceu.gtceu.api.item.tool.ToolHelper; import com.gregtechceu.gtceu.api.item.tool.aoe.AoESymmetrical; import com.gregtechceu.gtceu.api.item.tool.behavior.IToolBehavior; + import net.minecraft.core.BlockPos; import net.minecraft.network.chat.Component; import net.minecraft.sounds.SoundEvents; @@ -21,6 +21,8 @@ import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.HitResult; import net.minecraftforge.common.ToolActions; + +import com.google.common.collect.ImmutableSet; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -73,7 +75,10 @@ public InteractionResult onItemUse(UseOnContext context) { boolean pathed = false; for (BlockPos blockPos : blocks) { - pathed |= level.setBlock(blockPos, getUnWaxed(level.getBlockState(blockPos), new UseOnContext(player, hand, context.getHitResult().withPosition(blockPos))), Block.UPDATE_ALL); + pathed |= level.setBlock(blockPos, + getUnWaxed(level.getBlockState(blockPos), + new UseOnContext(player, hand, context.getHitResult().withPosition(blockPos))), + Block.UPDATE_ALL); level.levelEvent(player, LevelEvent.PARTICLES_WAX_OFF, blockPos, 0); if (!player.isCreative()) { ToolHelper.damageItem(context.getItemInHand(), context.getPlayer()); @@ -83,7 +88,8 @@ public InteractionResult onItemUse(UseOnContext context) { } if (pathed) { - level.playSound(null, player.getX(), player.getY(), player.getZ(), SoundEvents.AXE_WAX_OFF, SoundSource.PLAYERS, 1.0F, 1.0F); + level.playSound(null, player.getX(), player.getY(), player.getZ(), SoundEvents.AXE_WAX_OFF, + SoundSource.PLAYERS, 1.0F, 1.0F); player.swing(hand); return InteractionResult.SUCCESS; } @@ -91,12 +97,14 @@ public InteractionResult onItemUse(UseOnContext context) { return InteractionResult.PASS; } - public static Set getUnWaxableBlocks(ItemStack stack, AoESymmetrical aoeDefinition, Level Level, Player player, HitResult rayTraceResult) { + public static Set getUnWaxableBlocks(ItemStack stack, AoESymmetrical aoeDefinition, Level Level, + Player player, HitResult rayTraceResult) { return ToolHelper.iterateAoE(stack, aoeDefinition, Level, player, rayTraceResult, WaxOffBehavior.INSTANCE::isBlockUnWaxable); } - protected boolean isBlockUnWaxable(ItemStack stack, Level level, Player player, BlockPos pos, UseOnContext context) { + protected boolean isBlockUnWaxable(ItemStack stack, Level level, Player player, BlockPos pos, + UseOnContext context) { BlockState state = level.getBlockState(pos); BlockState newState = state.getToolModifiedState(context, ToolActions.AXE_WAX_OFF, false); return newState != null && newState != state; @@ -111,4 +119,4 @@ public void addInformation(@NotNull ItemStack stack, @Nullable Level Level, @Not @NotNull TooltipFlag flag) { tooltip.add(Component.translatable("item.gtceu.tool.behavior.remove_wax")); } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/tool/forge/ToolLootModifier.java b/src/main/java/com/gregtechceu/gtceu/common/item/tool/forge/ToolLootModifier.java index 205c116230..d0700a1d70 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/tool/forge/ToolLootModifier.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/tool/forge/ToolLootModifier.java @@ -1,8 +1,7 @@ package com.gregtechceu.gtceu.common.item.tool.forge; import com.gregtechceu.gtceu.common.item.tool.ToolEventHandlers; -import com.mojang.serialization.Codec; -import it.unimi.dsi.fastutil.objects.ObjectArrayList; + import net.minecraft.core.BlockPos; import net.minecraft.util.Mth; import net.minecraft.world.entity.player.Player; @@ -13,9 +12,13 @@ import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.phys.Vec3; import net.minecraftforge.common.loot.IGlobalLootModifier; + +import com.mojang.serialization.Codec; +import it.unimi.dsi.fastutil.objects.ObjectArrayList; import org.jetbrains.annotations.NotNull; public class ToolLootModifier implements IGlobalLootModifier { + public static final ToolLootModifier INSTANCE = new ToolLootModifier(); public static final Codec CODEC = Codec.unit(() -> INSTANCE); @@ -23,13 +26,15 @@ private ToolLootModifier() {/**/} @Override public @NotNull ObjectArrayList apply(ObjectArrayList objectArrayList, LootContext context) { - if (context.getParamOrNull(LootContextParams.THIS_ENTITY) instanceof Player player && context.hasParam(LootContextParams.TOOL) && context.hasParam(LootContextParams.BLOCK_STATE)) { + if (context.getParamOrNull(LootContextParams.THIS_ENTITY) instanceof Player player && + context.hasParam(LootContextParams.TOOL) && context.hasParam(LootContextParams.BLOCK_STATE)) { Vec3 pos = context.getParam(LootContextParams.ORIGIN); BlockPos blockPos = new BlockPos(Mth.floor(pos.x), Mth.floor(pos.y), Mth.floor(pos.z)); ItemStack tool = context.getParam(LootContextParams.TOOL); boolean isSilktouch = EnchantmentHelper.hasSilkTouch(tool); int fortuneLevel = tool.getEnchantmentLevel(Enchantments.BLOCK_FORTUNE); - return ToolEventHandlers.onHarvestDrops(player, tool, context.getLevel(), blockPos, context.getParam(LootContextParams.BLOCK_STATE), isSilktouch, fortuneLevel, objectArrayList, 1); + return ToolEventHandlers.onHarvestDrops(player, tool, context.getLevel(), blockPos, + context.getParam(LootContextParams.BLOCK_STATE), isSilktouch, fortuneLevel, objectArrayList, 1); } else { return objectArrayList; } diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/tool/rotation/CustomBlockRotations.java b/src/main/java/com/gregtechceu/gtceu/common/item/tool/rotation/CustomBlockRotations.java index cffe67b2a6..7b8a784bde 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/tool/rotation/CustomBlockRotations.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/tool/rotation/CustomBlockRotations.java @@ -1,13 +1,15 @@ package com.gregtechceu.gtceu.common.item.tool.rotation; import com.gregtechceu.gtceu.api.capability.ICoverable; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.*; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.BlockHitResult; + +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import org.jetbrains.annotations.ApiStatus; import java.util.Map; @@ -122,4 +124,4 @@ public boolean showXOnSide(BlockState state, Direction facing) { private static void init() {} } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/tool/rotation/ICustomRotationBehavior.java b/src/main/java/com/gregtechceu/gtceu/common/item/tool/rotation/ICustomRotationBehavior.java index fc5dbc5b52..c9ad8e703c 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/tool/rotation/ICustomRotationBehavior.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/tool/rotation/ICustomRotationBehavior.java @@ -24,4 +24,4 @@ default boolean showGrid() { default boolean showXOnSide(BlockState state, Direction facing) { return false; } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/KineticMachineDefinition.java b/src/main/java/com/gregtechceu/gtceu/common/machine/KineticMachineDefinition.java index 129ea4b807..ab5a410e21 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/KineticMachineDefinition.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/KineticMachineDefinition.java @@ -1,10 +1,12 @@ package com.gregtechceu.gtceu.common.machine; import com.gregtechceu.gtceu.api.machine.MachineDefinition; + +import net.minecraft.resources.ResourceLocation; + import lombok.Getter; import lombok.Setter; import lombok.experimental.Accessors; -import net.minecraft.resources.ResourceLocation; /** * @author KilaBash @@ -13,6 +15,7 @@ */ @Accessors(chain = true) public class KineticMachineDefinition extends MachineDefinition { + @Getter public final boolean isSource; @Getter @@ -31,5 +34,4 @@ public KineticMachineDefinition(ResourceLocation id, boolean isSource, float tor this.isSource = isSource; this.torque = torque; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/BatteryBufferMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/BatteryBufferMachine.java index 2e47cb5f80..d5f918ecff 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/BatteryBufferMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/BatteryBufferMachine.java @@ -12,6 +12,7 @@ import com.gregtechceu.gtceu.api.machine.feature.IMachineModifyDrops; import com.gregtechceu.gtceu.api.machine.trait.NotifiableEnergyContainer; import com.gregtechceu.gtceu.utils.GTUtil; + import com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup; import com.lowdragmc.lowdraglib.gui.widget.SlotWidget; import com.lowdragmc.lowdraglib.gui.widget.Widget; @@ -20,18 +21,21 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; import com.lowdragmc.lowdraglib.utils.Position; -import lombok.Getter; -import lombok.Setter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; +import lombok.Getter; +import lombok.Setter; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; + import java.util.ArrayList; import java.util.List; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author KilaBash * @date 2023/3/10 @@ -39,17 +43,24 @@ */ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault -public class BatteryBufferMachine extends TieredEnergyMachine implements IControllable, IFancyUIMachine, IMachineModifyDrops { +public class BatteryBufferMachine extends TieredEnergyMachine + implements IControllable, IFancyUIMachine, IMachineModifyDrops { + public static final long AMPS_PER_BATTERY = 2L; - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(BatteryBufferMachine.class, TieredEnergyMachine.MANAGED_FIELD_HOLDER); + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(BatteryBufferMachine.class, + TieredEnergyMachine.MANAGED_FIELD_HOLDER); - @Persisted @Getter @Setter + @Persisted + @Getter + @Setter private boolean isWorkingEnabled; @Getter private final int inventorySize; - @Getter @Persisted + @Getter + @Persisted protected final ItemStackTransfer batteryInventory; + public BatteryBufferMachine(IMachineBlockEntity holder, int tier, int inventorySize, Object... args) { super(holder, tier, inventorySize); this.isWorkingEnabled = true; @@ -59,7 +70,7 @@ public BatteryBufferMachine(IMachineBlockEntity holder, int tier, int inventoryS } ////////////////////////////////////// - //***** Initialization ******// + // ***** Initialization ******// ////////////////////////////////////// @Override public ManagedFieldHolder getFieldHolder() { @@ -68,11 +79,12 @@ public ManagedFieldHolder getFieldHolder() { @Override protected NotifiableEnergyContainer createEnergyContainer(Object... args) { - return new EnergyBatteryTrait((int)args[0]); + return new EnergyBatteryTrait((int) args[0]); } protected ItemStackTransfer createBatteryInventory(Object... ignoredArgs) { - var itemTransfer = new ItemStackTransfer(this.inventorySize){ + var itemTransfer = new ItemStackTransfer(this.inventorySize) { + @Override public int getSlotLimit(int slot) { return 1; @@ -91,7 +103,7 @@ public int tintColor(int index) { } ////////////////////////////////////// - //********** GUI ***********// + // ********** GUI ***********// ////////////////////////////////////// @Override @@ -121,7 +133,8 @@ public Widget createUIWidget() { 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.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); @@ -130,7 +143,7 @@ public Widget createUIWidget() { } ////////////////////////////////////// - //****** Battery Logic ******// + // ****** Battery Logic ******// ////////////////////////////////////// private List getNonFullBatteries() { @@ -181,7 +194,8 @@ public void onDrops(List drops, Player entity) { protected class EnergyBatteryTrait extends NotifiableEnergyContainer { protected EnergyBatteryTrait(int inventorySize) { - super(BatteryBufferMachine.this, GTValues.V[tier] * inventorySize * 32L, GTValues.V[tier], inventorySize * AMPS_PER_BATTERY, GTValues.V[tier], inventorySize); + super(BatteryBufferMachine.this, GTValues.V[tier] * inventorySize * 32L, GTValues.V[tier], + inventorySize * AMPS_PER_BATTERY, GTValues.V[tier], inventorySize); this.setSideInputCondition(side -> side != getFrontFacing() && isWorkingEnabled()); this.setSideOutputCondition(side -> side == getFrontFacing() && isWorkingEnabled()); } @@ -189,7 +203,8 @@ protected EnergyBatteryTrait(int inventorySize) { @Override public void serverTick() { var outFacing = getFrontFacing(); - var energyContainer = GTCapabilityHelper.getEnergyContainer(getLevel(), getPos().relative(outFacing), outFacing.getOpposite()); + var energyContainer = GTCapabilityHelper.getEnergyContainer(getLevel(), getPos().relative(outFacing), + outFacing.getOpposite()); if (energyContainer == null) { return; } @@ -197,7 +212,7 @@ public void serverTick() { var voltage = getOutputVoltage(); var batteries = getNonEmptyBatteries(); if (!batteries.isEmpty()) { - //Prioritize as many packets as available of energy created + // Prioritize as many packets as available of energy created long internalAmps = Math.abs(Math.min(0, getInternalStorage() / voltage)); long genAmps = Math.max(0, batteries.size() - internalAmps); long outAmps = 0L; @@ -225,7 +240,7 @@ public void serverTick() { checkOutputSubscription(); } - //Subtract energy created out of thin air from the buffer + // Subtract energy created out of thin air from the buffer setEnergyStored(getInternalStorage() + internalAmps * voltage - energy); } } @@ -252,7 +267,7 @@ public long acceptEnergyFromNetwork(@Nullable Direction side, long voltage, long return usedAmps; } - //Prioritizes as many packets as available from the buffer + // Prioritizes as many packets as available from the buffer long internalAmps = Math.min(leftAmps, Math.max(0, getInternalStorage() / voltage)); usedAmps = Math.min(usedAmps, leftAmps - internalAmps); @@ -263,7 +278,9 @@ public long acceptEnergyFromNetwork(@Nullable Direction side, long voltage, long boolean changed = false; for (var battery : batteries) { - var charged = battery.charge(Math.min(distributed, GTValues.V[battery.getTier()] * AMPS_PER_BATTERY), getTier(), true, false); + var charged = battery.charge( + Math.min(distributed, GTValues.V[battery.getTier()] * AMPS_PER_BATTERY), getTier(), true, + false); if (charged > 0) { changed = true; } @@ -275,7 +292,7 @@ public long acceptEnergyFromNetwork(@Nullable Direction side, long voltage, long checkOutputSubscription(); } - //Remove energy used and then transfer overflow energy into the internal buffer + // Remove energy used and then transfer overflow energy into the internal buffer setEnergyStored(getInternalStorage() - internalAmps * voltage + energy); return usedAmps; } @@ -303,6 +320,5 @@ public long getEnergyStored() { private long getInternalStorage() { return energyStored; } - } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/BlockBreakerMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/BlockBreakerMachine.java index 8b34800aff..c5d58231c9 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/BlockBreakerMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/BlockBreakerMachine.java @@ -16,8 +16,8 @@ import com.gregtechceu.gtceu.api.machine.feature.IFancyUIMachine; import com.gregtechceu.gtceu.api.machine.feature.IMachineModifyDrops; import com.gregtechceu.gtceu.api.machine.trait.NotifiableItemStackHandler; -import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; import com.gregtechceu.gtceu.data.lang.LangHandler; + import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; import com.lowdragmc.lowdraglib.gui.widget.SlotWidget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; @@ -26,9 +26,10 @@ import com.lowdragmc.lowdraglib.syncdata.ISubscription; 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 lombok.Getter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.Util; import net.minecraft.core.BlockPos; @@ -46,13 +47,16 @@ import net.minecraft.world.phys.BlockHitResult; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + +import lombok.Getter; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.List; import java.util.Set; import java.util.function.BiFunction; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author h3tr * @date 2023/7/15 @@ -60,8 +64,11 @@ */ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault -public class BlockBreakerMachine extends TieredEnergyMachine implements IAutoOutputItem, IFancyUIMachine, IMachineModifyDrops, IControllable { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(BlockBreakerMachine.class, TieredEnergyMachine.MANAGED_FIELD_HOLDER); +public class BlockBreakerMachine extends TieredEnergyMachine + implements IAutoOutputItem, IFancyUIMachine, IMachineModifyDrops, IControllable { + + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(BlockBreakerMachine.class, + TieredEnergyMachine.MANAGED_FIELD_HOLDER); @Getter @Persisted @@ -102,12 +109,11 @@ public BlockBreakerMachine(IMachineBlockEntity holder, int tier, Object... ignor this.energyPerTick = GTValues.V[tier - 1]; setOutputFacingItems(getFrontFacing().getOpposite()); this.efficiencyMultiplier = 1.0f - getEfficiencyMultiplier(tier); - } public static float getEfficiencyMultiplier(int tier) { float efficiencyMultiplier = 1.0f - 0.2f * (tier - 1.0f); - //Clamp efficiencyMultiplier + // Clamp efficiencyMultiplier if (efficiencyMultiplier > 1.0f) efficiencyMultiplier = 1.0f; else if (efficiencyMultiplier < .1f) @@ -117,7 +123,7 @@ else if (efficiencyMultiplier < .1f) } ////////////////////////////////////// - //***** Initialization *****// + // ***** Initialization *****// ////////////////////////////////////// @Override @@ -179,11 +185,12 @@ public void onNeighborChanged(Block block, BlockPos fromPos, boolean isMoving) { } ////////////////////////////////////// - //********* Logic **********// + // ********* Logic **********// ////////////////////////////////////// public void updateBreakerSubscription() { - if (drainEnergy(true) && !getLevel().getBlockState(getPos().relative(getFrontFacing())).isAir() && isWorkingEnabled) { + if (drainEnergy(true) && !getLevel().getBlockState(getPos().relative(getFrontFacing())).isAir() && + isWorkingEnabled) { breakerSubs = subscribeServerTick(breakerSubs, this::breakerUpdate); } else if (breakerSubs != null) { blockBreakProgress = 0; @@ -246,7 +253,8 @@ public void clientTick() { } private List tryDestroyBlockAndGetDrops(BlockPos pos) { - List drops = Block.getDrops(getLevel().getBlockState(pos), (ServerLevel) getLevel(), pos, null, null, ItemStack.EMPTY); + List drops = Block.getDrops(getLevel().getBlockState(pos), (ServerLevel) getLevel(), pos, null, null, + ItemStack.EMPTY); getLevel().destroyBlock(pos, false); return drops; } @@ -271,7 +279,7 @@ public boolean drainEnergy(boolean simulate) { } ////////////////////////////////////// - //******* Auto Output *******// + // ******* Auto Output *******// ////////////////////////////////////// @Override public void setAutoOutputItems(boolean allow) { @@ -285,8 +293,7 @@ public boolean isAllowInputFromOutputSideItems() { } @Override - public void setAllowInputFromOutputSideItems(boolean allow) { - } + public void setAllowInputFromOutputSideItems(boolean allow) {} @Override public void setOutputFacingItems(@Nullable Direction outputFacing) { @@ -296,8 +303,9 @@ public void setOutputFacingItems(@Nullable Direction outputFacing) { protected void updateAutoOutputSubscription() { var outputFacing = getOutputFacingItems(); - if ((isAutoOutputItems() && !cache.isEmpty()) && outputFacing != null - && ItemTransferHelper.getItemTransfer(getLevel(), getPos().relative(outputFacing), outputFacing.getOpposite()) != null) + if ((isAutoOutputItems() && !cache.isEmpty()) && outputFacing != null && + ItemTransferHelper.getItemTransfer(getLevel(), getPos().relative(outputFacing), + outputFacing.getOpposite()) != null) autoOutputSubs = subscribeServerTick(autoOutputSubs, this::checkAutoOutput); else if (autoOutputSubs != null) { autoOutputSubs.unsubscribe(); @@ -346,36 +354,38 @@ public void setWorkingEnabled(boolean workingEnabled) { } ////////////////////////////////////// - //********** GUI ***********// + // ********** GUI ***********// ////////////////////////////////////// - public static BiFunction EDITABLE_UI_CREATOR = Util.memoize((path, inventorySize) -> new EditableMachineUI("misc", path, () -> { - var template = createTemplate(inventorySize).createDefault(); - var energyBar = createEnergyBar().createDefault(); - var batterySlot = createBatterySlot().createDefault(); - var energyGroup = new WidgetGroup(0, 0, energyBar.getSize().width, energyBar.getSize().height + 20); - batterySlot.setSelfPosition(new Position((energyBar.getSize().width - 18) / 2, energyBar.getSize().height + 1)); - energyGroup.addWidget(energyBar); - energyGroup.addWidget(batterySlot); - var group = new WidgetGroup(0, 0, - Math.max(energyGroup.getSize().width + template.getSize().width + 4 + 8, 172), - Math.max(template.getSize().height + 8, energyGroup.getSize().height + 8)); - var size = group.getSize(); - energyGroup.setSelfPosition(new Position(3, (size.height - energyGroup.getSize().height) / 2)); - - template.setSelfPosition(new Position( - (size.width - 4 - template.getSize().width) / 2 + 4, - (size.height - template.getSize().height) / 2)); - - group.addWidget(energyGroup); - group.addWidget(template); - return group; - }, (template, machine) -> { - if (machine instanceof BlockBreakerMachine blockBreakerMachine) { - createTemplate(inventorySize).setupUI(template, blockBreakerMachine); - createEnergyBar().setupUI(template, blockBreakerMachine); - createBatterySlot().setupUI(template, blockBreakerMachine); - } - })); + public static BiFunction EDITABLE_UI_CREATOR = Util + .memoize((path, inventorySize) -> new EditableMachineUI("misc", path, () -> { + var template = createTemplate(inventorySize).createDefault(); + var energyBar = createEnergyBar().createDefault(); + var batterySlot = createBatterySlot().createDefault(); + var energyGroup = new WidgetGroup(0, 0, energyBar.getSize().width, energyBar.getSize().height + 20); + batterySlot.setSelfPosition( + new Position((energyBar.getSize().width - 18) / 2, energyBar.getSize().height + 1)); + energyGroup.addWidget(energyBar); + energyGroup.addWidget(batterySlot); + var group = new WidgetGroup(0, 0, + Math.max(energyGroup.getSize().width + template.getSize().width + 4 + 8, 172), + Math.max(template.getSize().height + 8, energyGroup.getSize().height + 8)); + var size = group.getSize(); + energyGroup.setSelfPosition(new Position(3, (size.height - energyGroup.getSize().height) / 2)); + + template.setSelfPosition(new Position( + (size.width - 4 - template.getSize().width) / 2 + 4, + (size.height - template.getSize().height) / 2)); + + group.addWidget(energyGroup); + group.addWidget(template); + return group; + }, (template, machine) -> { + if (machine instanceof BlockBreakerMachine blockBreakerMachine) { + createTemplate(inventorySize).setupUI(template, blockBreakerMachine); + createEnergyBar().setupUI(template, blockBreakerMachine); + createBatterySlot().setupUI(template, blockBreakerMachine); + } + })); protected static EditableUI createBatterySlot() { return new EditableUI<>("battery_slot", SlotWidget.class, () -> { @@ -386,7 +396,8 @@ protected static EditableUI createBatterySlot() slotWidget.setHandlerSlot(machine.chargerInventory, 0); slotWidget.setCanPutItems(true); slotWidget.setCanTakeItems(true); - slotWidget.setHoverTooltips(LangHandler.getMultiLang("gtceu.gui.charger_slot.tooltip", GTValues.VNF[machine.getTier()], GTValues.VNF[machine.getTier()]).toArray(new MutableComponent[0])); + slotWidget.setHoverTooltips(LangHandler.getMultiLang("gtceu.gui.charger_slot.tooltip", + GTValues.VNF[machine.getTier()], GTValues.VNF[machine.getTier()]).toArray(new MutableComponent[0])); }); } @@ -420,7 +431,7 @@ protected static EditableUI createTemplate(int } ////////////////////////////////////// - //******* Rendering ********// + // ******* Rendering ********// ////////////////////////////////////// @Override public ResourceTexture sideTips(Player player, Set toolTypes, Direction side) { @@ -437,10 +448,11 @@ public ResourceTexture sideTips(Player player, Set toolTypes, Direct } ////////////////////////////////////// - //******* Interactions ********// + // ******* Interactions ********// ////////////////////////////////////// @Override - protected InteractionResult onWrenchClick(Player playerIn, InteractionHand hand, Direction gridSide, BlockHitResult hitResult) { + protected InteractionResult onWrenchClick(Player playerIn, InteractionHand hand, Direction gridSide, + BlockHitResult hitResult) { if (!playerIn.isShiftKeyDown() && !isRemote()) { var tool = playerIn.getItemInHand(hand); if (tool.getDamageValue() >= tool.getMaxDamage()) return InteractionResult.PASS; @@ -464,13 +476,14 @@ protected InteractionResult onWrenchClick(Player playerIn, InteractionHand hand, } @Override - protected InteractionResult onSoftMalletClick(Player playerIn, InteractionHand hand, Direction gridSide, BlockHitResult hitResult) { + protected InteractionResult onSoftMalletClick(Player playerIn, InteractionHand hand, Direction gridSide, + BlockHitResult hitResult) { var controllable = GTCapabilityHelper.getControllable(getLevel(), getPos(), gridSide); if (controllable != null) { if (!isRemote()) { controllable.setWorkingEnabled(!controllable.isWorkingEnabled()); playerIn.sendSystemMessage(Component.translatable(controllable.isWorkingEnabled() ? - "behaviour.soft_hammer.enabled" : "behaviour.soft_hammer.disabled")); + "behaviour.soft_hammer.enabled" : "behaviour.soft_hammer.disabled")); } return InteractionResult.CONSUME; } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/ChargerMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/ChargerMachine.java index aa44f7d93a..b9edd17363 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/ChargerMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/ChargerMachine.java @@ -8,9 +8,9 @@ import com.gregtechceu.gtceu.api.machine.feature.IFancyUIMachine; import com.gregtechceu.gtceu.api.machine.feature.IMachineModifyDrops; import com.gregtechceu.gtceu.api.machine.trait.NotifiableEnergyContainer; -import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.utils.GTUtil; + import com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup; import com.lowdragmc.lowdraglib.gui.widget.SlotWidget; import com.lowdragmc.lowdraglib.gui.widget.Widget; @@ -18,20 +18,24 @@ import com.lowdragmc.lowdraglib.misc.ItemStackTransfer; 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 lombok.Getter; -import lombok.Setter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; +import lombok.Getter; +import lombok.Setter; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; + import java.util.ArrayList; import java.util.List; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author lucifer_ll * @date 2023/7/12 @@ -40,9 +44,11 @@ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class ChargerMachine extends TieredEnergyMachine implements IControllable, IFancyUIMachine, IMachineModifyDrops { + public static final long AMPS_PER_ITEM = 4L; - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(ChargerMachine.class, TieredEnergyMachine.MANAGED_FIELD_HOLDER); + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(ChargerMachine.class, + TieredEnergyMachine.MANAGED_FIELD_HOLDER); public enum State { IDLE, @@ -74,7 +80,7 @@ public ChargerMachine(IMachineBlockEntity holder, int tier, int inventorySize, O } ////////////////////////////////////// - //***** Initialization ******// + // ***** Initialization ******// ////////////////////////////////////// @Override public ManagedFieldHolder getFieldHolder() { @@ -88,7 +94,8 @@ protected NotifiableEnergyContainer createEnergyContainer(Object... args) { protected ItemStackTransfer createChargerInventory(Object... args) { var itemTransfer = new ItemStackTransfer(this.inventorySize); - itemTransfer.setFilter(item -> GTCapabilityHelper.getElectricItem(item) != null || GTCapabilityHelper.getPlatformEnergyItem(item) != null); + itemTransfer.setFilter(item -> GTCapabilityHelper.getElectricItem(item) != null || + GTCapabilityHelper.getPlatformEnergyItem(item) != null); return itemTransfer; } @@ -106,7 +113,7 @@ public void onDrops(List drops, Player entity) { } ////////////////////////////////////// - //********** GUI ***********// + // ********** GUI ***********// ////////////////////////////////////// @Override @@ -136,7 +143,8 @@ public Widget createUIWidget() { 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.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); @@ -145,7 +153,7 @@ public Widget createUIWidget() { } ////////////////////////////////////// - //****** Charger Logic ******// + // ****** Charger Logic ******// ////////////////////////////////////// private List getNonFullElectricItem() { @@ -178,7 +186,8 @@ private void changeState(State newState) { protected class EnergyBatteryTrait extends NotifiableEnergyContainer { protected EnergyBatteryTrait(int inventorySize) { - super(ChargerMachine.this, GTValues.V[tier] * inventorySize * 32L, GTValues.V[tier], inventorySize * AMPS_PER_ITEM, 0L, 0L); + super(ChargerMachine.this, GTValues.V[tier] * inventorySize * 32L, GTValues.V[tier], + inventorySize * AMPS_PER_ITEM, 0L, 0L); this.setSideInputCondition(side -> isWorkingEnabled()); this.setSideOutputCondition(side -> false); } @@ -208,7 +217,7 @@ public long acceptEnergyFromNetwork(@Nullable Direction side, long voltage, long return usedAmps; } - //Prioritizes as many packets as available from the buffer + // Prioritizes as many packets as available from the buffer long internalAmps = Math.min(maxAmps, Math.max(0, getInternalStorage() / voltage)); usedAmps = Math.min(usedAmps, maxAmps - internalAmps); @@ -221,9 +230,11 @@ public long acceptEnergyFromNetwork(@Nullable Direction side, long voltage, long var charged = 0L; for (var electricItem : electricItems) { if (electricItem instanceof IElectricItem item) { - charged += item.charge(Math.min(distributed, GTValues.V[item.getTier()] * AMPS_PER_ITEM), getTier(), true, false); + charged += item.charge(Math.min(distributed, GTValues.V[item.getTier()] * AMPS_PER_ITEM), + getTier(), true, false); } else if (electricItem instanceof IPlatformEnergyStorage energyStorage) { - energy += PlatformEnergyCompat.insertEu(energyStorage, Math.min(distributed, GTValues.V[getTier()] * AMPS_PER_ITEM)); + energy += PlatformEnergyCompat.insertEu(energyStorage, + Math.min(distributed, GTValues.V[getTier()] * AMPS_PER_ITEM)); } if (charged > 0) { changed = true; @@ -236,7 +247,7 @@ public long acceptEnergyFromNetwork(@Nullable Direction side, long voltage, long changeState(State.RUNNING); } - //Remove energy used and then transfer overflow energy into the internal buffer + // Remove energy used and then transfer overflow energy into the internal buffer setEnergyStored(getInternalStorage() - internalAmps * voltage + energy); return usedAmps; } @@ -254,7 +265,8 @@ public long getEnergyCapacity() { } else if (ConfigHolder.INSTANCE.compat.energy.nativeEUToPlatformNative) { var energyStorage = GTCapabilityHelper.getPlatformEnergyItem(electricItemStack); if (energyStorage != null) { - energyCapacity += PlatformEnergyCompat.toEu(energyStorage.getCapacity(), PlatformEnergyCompat.ratio(false)); + energyCapacity += PlatformEnergyCompat.toEu(energyStorage.getCapacity(), + PlatformEnergyCompat.ratio(false)); } } } @@ -277,7 +289,8 @@ public long getEnergyStored() { } else if (ConfigHolder.INSTANCE.compat.energy.nativeEUToPlatformNative) { var energyStorage = GTCapabilityHelper.getPlatformEnergyItem(electricItemStack); if (energyStorage != null) { - energyStored += PlatformEnergyCompat.toEu(energyStorage.getAmount(), PlatformEnergyCompat.ratio(false)); + energyStored += PlatformEnergyCompat.toEu(energyStorage.getAmount(), + PlatformEnergyCompat.ratio(false)); } } } @@ -294,6 +307,5 @@ public long getEnergyStored() { private long getInternalStorage() { return energyStored; } - } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/ConverterMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/ConverterMachine.java index c67cbc61fa..e57cea6247 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/ConverterMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/ConverterMachine.java @@ -7,8 +7,10 @@ import com.gregtechceu.gtceu.api.machine.TieredEnergyMachine; import com.gregtechceu.gtceu.api.machine.trait.NotifiableEnergyContainer; import com.gregtechceu.gtceu.common.machine.trait.ConverterTrait; + import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.network.chat.Component; @@ -17,20 +19,23 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.phys.BlockHitResult; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.Set; +import javax.annotation.ParametersAreNonnullByDefault; + @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class ConverterMachine extends TieredEnergyMachine { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(ConverterMachine.class, TieredEnergyMachine.MANAGED_FIELD_HOLDER); + + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(ConverterMachine.class, + TieredEnergyMachine.MANAGED_FIELD_HOLDER); public ConverterMachine(IMachineBlockEntity holder, int tier, int amps, Object... args) { super(holder, tier, args, amps); } ////////////////////////////////////// - //***** Initialization ******// + // ***** Initialization ******// ////////////////////////////////////// @Override public ManagedFieldHolder getFieldHolder() { @@ -46,25 +51,32 @@ protected NotifiableEnergyContainer createEnergyContainer(Object... args) { } public ConverterTrait getConverterTrait() { - return (ConverterTrait)energyContainer; + return (ConverterTrait) energyContainer; } ////////////////////////////////////// - //****** Interaction ******// + // ****** Interaction ******// ////////////////////////////////////// @Override - public InteractionResult onSoftMalletClick(Player playerIn, InteractionHand hand, Direction facing, BlockHitResult hitResult) { + public InteractionResult onSoftMalletClick(Player playerIn, InteractionHand hand, Direction facing, + BlockHitResult hitResult) { if (!isRemote()) { if (getConverterTrait().isFeToEu()) { setFeToEu(false); - playerIn.sendSystemMessage(Component.translatable("gtceu.machine.energy_converter.message_conversion_eu", - getConverterTrait().getAmps(), getConverterTrait().getVoltage(), - PlatformEnergyCompat.toNativeLong(getConverterTrait().getVoltage() * getConverterTrait().getAmps(), PlatformEnergyCompat.ratio(false)))); + playerIn.sendSystemMessage( + Component.translatable("gtceu.machine.energy_converter.message_conversion_eu", + getConverterTrait().getAmps(), getConverterTrait().getVoltage(), + PlatformEnergyCompat.toNativeLong( + getConverterTrait().getVoltage() * getConverterTrait().getAmps(), + PlatformEnergyCompat.ratio(false)))); } else { setFeToEu(true); - playerIn.sendSystemMessage(Component.translatable("gtceu.machine.energy_converter.message_conversion_native", - PlatformEnergyCompat.toNativeLong(getConverterTrait().getVoltage() * getConverterTrait().getAmps(), PlatformEnergyCompat.ratio(true)), - getConverterTrait().getAmps(), getConverterTrait().getVoltage())); + playerIn.sendSystemMessage( + Component.translatable("gtceu.machine.energy_converter.message_conversion_native", + PlatformEnergyCompat.toNativeLong( + getConverterTrait().getVoltage() * getConverterTrait().getAmps(), + PlatformEnergyCompat.ratio(true)), + getConverterTrait().getAmps(), getConverterTrait().getVoltage())); } } return InteractionResult.CONSUME; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/FisherMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/FisherMachine.java index fe816b1178..dec42c8cae 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/FisherMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/FisherMachine.java @@ -16,8 +16,8 @@ import com.gregtechceu.gtceu.api.machine.feature.IFancyUIMachine; import com.gregtechceu.gtceu.api.machine.feature.IMachineModifyDrops; import com.gregtechceu.gtceu.api.machine.trait.NotifiableItemStackHandler; -import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; import com.gregtechceu.gtceu.data.lang.LangHandler; + import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; import com.lowdragmc.lowdraglib.gui.widget.*; import com.lowdragmc.lowdraglib.misc.ItemStackTransfer; @@ -25,16 +25,15 @@ import com.lowdragmc.lowdraglib.syncdata.ISubscription; 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 lombok.Getter; -import lombok.Setter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.Util; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.NonNullList; -import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.TickTask; @@ -55,13 +54,17 @@ import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.Vec3; + +import lombok.Getter; +import lombok.Setter; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.List; import java.util.Set; import java.util.function.BiFunction; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author h3tr * @date 2023/7/13 @@ -69,8 +72,11 @@ */ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault -public class FisherMachine extends TieredEnergyMachine implements IAutoOutputItem, IFancyUIMachine, IMachineModifyDrops, IWorkable { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(FisherMachine.class, TieredEnergyMachine.MANAGED_FIELD_HOLDER); +public class FisherMachine extends TieredEnergyMachine + implements IAutoOutputItem, IFancyUIMachine, IMachineModifyDrops, IWorkable { + + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(FisherMachine.class, + TieredEnergyMachine.MANAGED_FIELD_HOLDER); @Getter @Persisted @@ -120,7 +126,8 @@ public class FisherMachine extends TieredEnergyMachine implements IAutoOutputIte private boolean active = false; public static final int WATER_CHECK_SIZE = 5; private static final ItemStack fishingRod = new ItemStack(Items.FISHING_ROD); - private boolean hasWater=false; + private boolean hasWater = false; + public FisherMachine(IMachineBlockEntity holder, int tier, Object... ignoredArgs) { super(holder, tier); this.inventorySize = (tier + 1) * (tier + 1); @@ -133,7 +140,7 @@ public FisherMachine(IMachineBlockEntity holder, int tier, Object... ignoredArgs } ////////////////////////////////////// - //***** Initialization *****// + // ***** Initialization *****// ////////////////////////////////////// protected ItemStackTransfer createChargerItemHandler() { @@ -173,7 +180,6 @@ public void onLoad() { baitSubs = baitHandler.addChangedListener(this::updateFishingUpdateSubscription); chargerInventory.setOnContentsChanged(this::updateBatterySubscription); this.updateFishingUpdateSubscription(); - } @Override @@ -206,11 +212,10 @@ public void onDrops(List drops, Player entity) { } ////////////////////////////////////// - //********* Logic **********// + // ********* Logic **********// ////////////////////////////////////// public void updateFishingUpdateSubscription() { - if (drainEnergy(true) && this.baitHandler.getStackInSlot(0).is(Items.STRING) && isWorkingEnabled) { fishingSubs = subscribeServerTick(fishingSubs, this::fishingUpdate); active = true; @@ -223,11 +228,11 @@ public void updateFishingUpdateSubscription() { progress = 0; } - private void updateHasWater(){ + private void updateHasWater() { for (int x = 0; x < WATER_CHECK_SIZE; x++) for (int z = 0; z < WATER_CHECK_SIZE; z++) { BlockPos waterCheckPos = getPos().below().offset(x - WATER_CHECK_SIZE / 2, 0, z - WATER_CHECK_SIZE / 2); - if (!getLevel().getBlockState(waterCheckPos).getFluidState().is(Fluids.WATER)){ + if (!getLevel().getBlockState(waterCheckPos).getFluidState().is(Fluids.WATER)) { hasWater = false; return; } @@ -236,18 +241,18 @@ private void updateHasWater(){ } public void fishingUpdate() { - if(this.getOffsetTimer() % maxProgress == 0L) + if (this.getOffsetTimer() % maxProgress == 0L) updateHasWater(); - - if(!hasWater) return; + + if (!hasWater) return; drainEnergy(false); if (progress >= maxProgress) { - LootTable lootTable = getLevel().getServer().getLootData().getLootTable(BuiltInLootTables.FISHING); FishingHook simulatedHook = new FishingHook(EntityType.FISHING_BOBBER, getLevel()) { + public boolean isOpenWaterFishing() { return true; } @@ -256,10 +261,10 @@ public boolean isOpenWaterFishing() { LootParams lootContext = new LootParams.Builder((ServerLevel) getLevel()) .withOptionalParameter(LootContextParams.THIS_ENTITY, simulatedHook) .withParameter(LootContextParams.TOOL, fishingRod) - .withParameter(LootContextParams.ORIGIN, new Vec3(getPos().getX(), getPos().getY(), getPos().getZ())) + .withParameter(LootContextParams.ORIGIN, + new Vec3(getPos().getX(), getPos().getY(), getPos().getZ())) .create(LootContextParamSets.FISHING); - NonNullList generatedLoot = NonNullList.create(); generatedLoot.addAll(lootTable.getRandomItems(lootContext)); @@ -270,7 +275,7 @@ public boolean isOpenWaterFishing() { if (useBait) this.baitHandler.extractItem(0, 1, false); updateFishingUpdateSubscription(); - progress=-1; + progress = -1; } progress++; } @@ -294,9 +299,8 @@ public boolean drainEnergy(boolean simulate) { return false; } - ////////////////////////////////////// - //******* Auto Output *******// + // ******* Auto Output *******// ////////////////////////////////////// @Override public void setAutoOutputItems(boolean allow) { @@ -321,8 +325,9 @@ else if (batterySubs != null) { protected void updateAutoOutputSubscription() { var outputFacing = getOutputFacingItems(); - if ((isAutoOutputItems() && !cache.isEmpty()) && outputFacing != null - && ItemTransferHelper.getItemTransfer(getLevel(), getPos().relative(outputFacing), outputFacing.getOpposite()) != null) + if ((isAutoOutputItems() && !cache.isEmpty()) && outputFacing != null && + ItemTransferHelper.getItemTransfer(getLevel(), getPos().relative(outputFacing), + outputFacing.getOpposite()) != null) autoOutputSubs = subscribeServerTick(autoOutputSubs, this::checkAutoOutput); else if (autoOutputSubs != null) { autoOutputSubs.unsubscribe(); @@ -358,37 +363,40 @@ public void onNeighborChanged(Block block, BlockPos fromPos, boolean isMoving) { } ////////////////////////////////////// - //********** GUI ***********// + // ********** GUI ***********// ////////////////////////////////////// - public static BiFunction EDITABLE_UI_CREATOR = Util.memoize((path, inventorySize) -> new EditableMachineUI("misc", path, () -> { - var template = createTemplate(inventorySize).createDefault(); - var energyBar = createEnergyBar().createDefault(); - var batterySlot = createBatterySlot().createDefault(); - var energyGroup = new WidgetGroup(0, 0, energyBar.getSize().width, energyBar.getSize().height + 20); - batterySlot.setSelfPosition(new Position((energyBar.getSize().width - 18) / 2, energyBar.getSize().height + 1)); - energyGroup.addWidget(energyBar); - energyGroup.addWidget(batterySlot); - var group = new WidgetGroup(0, 0, - Math.max(energyGroup.getSize().width + template.getSize().width + 4 + 8, 172), - Math.max(template.getSize().height + 8, energyGroup.getSize().height + 8)); - var size = group.getSize(); - energyGroup.setSelfPosition(new Position(3, (size.height - energyGroup.getSize().height) / 2)); - - template.setSelfPosition(new Position( - (size.width - energyGroup.getSize().width - 4 - template.getSize().width) / 2 + 2 + energyGroup.getSize().width + 2, - (size.height - template.getSize().height) / 2)); - - group.addWidget(energyGroup); - group.addWidget(template); - return group; - }, (template, machine) -> { - if (machine instanceof FisherMachine fisherMachine) { - createTemplate(inventorySize).setupUI(template, fisherMachine); - createEnergyBar().setupUI(template, fisherMachine); - createBatterySlot().setupUI(template, fisherMachine); - } - })); + public static BiFunction EDITABLE_UI_CREATOR = Util + .memoize((path, inventorySize) -> new EditableMachineUI("misc", path, () -> { + var template = createTemplate(inventorySize).createDefault(); + var energyBar = createEnergyBar().createDefault(); + var batterySlot = createBatterySlot().createDefault(); + var energyGroup = new WidgetGroup(0, 0, energyBar.getSize().width, energyBar.getSize().height + 20); + batterySlot.setSelfPosition( + new Position((energyBar.getSize().width - 18) / 2, energyBar.getSize().height + 1)); + energyGroup.addWidget(energyBar); + energyGroup.addWidget(batterySlot); + var group = new WidgetGroup(0, 0, + Math.max(energyGroup.getSize().width + template.getSize().width + 4 + 8, 172), + Math.max(template.getSize().height + 8, energyGroup.getSize().height + 8)); + var size = group.getSize(); + energyGroup.setSelfPosition(new Position(3, (size.height - energyGroup.getSize().height) / 2)); + + template.setSelfPosition(new Position( + (size.width - energyGroup.getSize().width - 4 - template.getSize().width) / 2 + 2 + + energyGroup.getSize().width + 2, + (size.height - template.getSize().height) / 2)); + + group.addWidget(energyGroup); + group.addWidget(template); + return group; + }, (template, machine) -> { + if (machine instanceof FisherMachine fisherMachine) { + createTemplate(inventorySize).setupUI(template, fisherMachine); + createEnergyBar().setupUI(template, fisherMachine); + createBatterySlot().setupUI(template, fisherMachine); + } + })); protected static EditableUI createBatterySlot() { return new EditableUI<>("battery_slot", SlotWidget.class, () -> { @@ -399,7 +407,8 @@ protected static EditableUI createBatterySlot() { slotWidget.setHandlerSlot(machine.chargerInventory, 0); slotWidget.setCanPutItems(true); slotWidget.setCanTakeItems(true); - slotWidget.setHoverTooltips(LangHandler.getMultiLang("gtceu.gui.charger_slot.tooltip", GTValues.VNF[machine.getTier()], GTValues.VNF[machine.getTier()]).toArray(new MutableComponent[0])); + slotWidget.setHoverTooltips(LangHandler.getMultiLang("gtceu.gui.charger_slot.tooltip", + GTValues.VNF[machine.getTier()], GTValues.VNF[machine.getTier()]).toArray(new MutableComponent[0])); }); } @@ -422,7 +431,8 @@ protected static EditableUI createTemplate(int inven SlotWidget baitSlotWidget = new SlotWidget(); baitSlotWidget.initTemplate(); - baitSlotWidget.setSelfPosition(new Position(4, (main.getSize().height - baitSlotWidget.getSize().height) / 2)); + baitSlotWidget + .setSelfPosition(new Position(4, (main.getSize().height - baitSlotWidget.getSize().height) / 2)); baitSlotWidget.setBackground(GuiTextures.SLOT, GuiTextures.STRING_SLOT_OVERLAY); baitSlotWidget.setId("bait_slot"); main.addWidget(baitSlotWidget); @@ -446,7 +456,7 @@ protected static EditableUI createTemplate(int inven } ////////////////////////////////////// - //******* Rendering ********// + // ******* Rendering ********// ////////////////////////////////////// @Override public ResourceTexture sideTips(Player player, Set toolTypes, Direction side) { @@ -467,10 +477,11 @@ public ResourceTexture sideTips(Player player, Set toolTypes, Direct } ////////////////////////////////////// - //******* Interactions ********// + // ******* Interactions ********// ////////////////////////////////////// @Override - protected InteractionResult onWrenchClick(Player playerIn, InteractionHand hand, Direction gridSide, BlockHitResult hitResult) { + protected InteractionResult onWrenchClick(Player playerIn, InteractionHand hand, Direction gridSide, + BlockHitResult hitResult) { if (!playerIn.isShiftKeyDown() && !isRemote()) { var tool = playerIn.getItemInHand(hand); if (tool.getDamageValue() >= tool.getMaxDamage()) return InteractionResult.PASS; @@ -492,5 +503,4 @@ protected InteractionResult onWrenchClick(Player playerIn, InteractionHand hand, return super.onWrenchClick(playerIn, hand, gridSide, hitResult); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/HullMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/HullMachine.java index 83b2f96bc6..f0a14a93de 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/HullMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/HullMachine.java @@ -1,6 +1,5 @@ package com.gregtechceu.gtceu.common.machine.electric; -import appeng.me.helpers.IGridConnectedBlockEntity; import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; @@ -8,22 +7,26 @@ import com.gregtechceu.gtceu.api.machine.multiblock.part.TieredPartMachine; import com.gregtechceu.gtceu.api.machine.trait.NotifiableEnergyContainer; import com.gregtechceu.gtceu.integration.ae2.machine.trait.GridNodeHostTrait; -import com.lowdragmc.lowdraglib.LDLib; + import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; import net.minecraft.server.TickTask; import net.minecraft.server.level.ServerLevel; +import appeng.me.helpers.IGridConnectedBlockEntity; + import javax.annotation.ParametersAreNonnullByDefault; -import java.util.EnumSet; @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class HullMachine extends TieredPartMachine { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(HullMachine.class, MultiblockPartMachine.MANAGED_FIELD_HOLDER); + + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(HullMachine.class, + MultiblockPartMachine.MANAGED_FIELD_HOLDER); private final Object gridNodeHost; @Persisted @@ -48,7 +51,8 @@ protected void reinitializeEnergyContainer() { @Override public void onLoad() { super.onLoad(); - if (GTCEu.isAE2Loaded() && gridNodeHost instanceof GridNodeHostTrait connectedBlockEntity && getLevel() instanceof ServerLevel level) { + if (GTCEu.isAE2Loaded() && gridNodeHost instanceof GridNodeHostTrait connectedBlockEntity && + getLevel() instanceof ServerLevel level) { level.getServer().tell(new TickTask(0, connectedBlockEntity::init)); } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/ItemCollectorMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/ItemCollectorMachine.java index 302befe53c..f4c032703a 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/ItemCollectorMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/ItemCollectorMachine.java @@ -20,6 +20,7 @@ import com.gregtechceu.gtceu.api.machine.trait.NotifiableItemStackHandler; import com.gregtechceu.gtceu.common.data.GTItems; import com.gregtechceu.gtceu.data.lang.LangHandler; + import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; import com.lowdragmc.lowdraglib.gui.widget.SlotWidget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; @@ -31,7 +32,7 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; import com.lowdragmc.lowdraglib.utils.Position; -import lombok.Getter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.Util; import net.minecraft.core.BlockPos; @@ -52,13 +53,16 @@ import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.Vec3; + +import lombok.Getter; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.List; import java.util.Set; import java.util.function.BiFunction; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author h3tr * @date 2023/7/13 @@ -66,8 +70,11 @@ */ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault -public class ItemCollectorMachine extends TieredEnergyMachine implements IAutoOutputItem, IFancyUIMachine, IMachineModifyDrops, IWorkable { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(ItemCollectorMachine.class, TieredEnergyMachine.MANAGED_FIELD_HOLDER); +public class ItemCollectorMachine extends TieredEnergyMachine + implements IAutoOutputItem, IFancyUIMachine, IMachineModifyDrops, IWorkable { + + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(ItemCollectorMachine.class, + TieredEnergyMachine.MANAGED_FIELD_HOLDER); @Getter private static final int[] INVENTORY_SIZES = { 4, 9, 16, 25, 25 }; @@ -137,7 +144,7 @@ public ItemCollectorMachine(IMachineBlockEntity holder, int tier, Object... igno } ////////////////////////////////////// - //***** Initialization *****// + // ***** Initialization *****// ////////////////////////////////////// protected ItemStackTransfer createChargerItemHandler() { @@ -148,7 +155,8 @@ protected ItemStackTransfer createChargerItemHandler() { protected ItemStackTransfer createFilterItemHandler() { var transfer = new ItemStackTransfer(); - transfer.setFilter(item -> item.is(GTItems.ITEM_FILTER.asItem())||item.is(GTItems.ORE_DICTIONARY_FILTER.asItem())); + transfer.setFilter( + item -> item.is(GTItems.ITEM_FILTER.asItem()) || item.is(GTItems.ORE_DICTIONARY_FILTER.asItem())); return transfer; } @@ -207,7 +215,7 @@ public void onDrops(List drops, Player entity) { } ////////////////////////////////////// - //********* Logic **********// + // ********* Logic **********// ////////////////////////////////////// public void updateCollectionSubscription() { @@ -225,10 +233,10 @@ public void update() { if (drainEnergy(false)) { if (aabb == null || rangeDirty) { rangeDirty = false; - BlockPos pos1,pos2; + BlockPos pos1, pos2; pos1 = getPos().offset(-range, 0, -range); pos2 = getPos().offset(range, 2, range); - this.aabb = AABB.of(BoundingBox.fromCorners(pos1,pos2)); + this.aabb = AABB.of(BoundingBox.fromCorners(pos1, pos2)); } moveItemsInRange(); updateCollectionSubscription(); @@ -236,31 +244,31 @@ public void update() { } public void moveItemsInRange() { - ItemFilter filter = null; - if(!filterInventory.getStackInSlot(0).isEmpty()) + ItemFilter filter = null; + if (!filterInventory.getStackInSlot(0).isEmpty()) filter = ItemFilter.loadFilter(filterInventory.getStackInSlot(0)); BlockPos centerPos = self().getPos().above(); List itemEntities = getLevel().getEntitiesOfClass(ItemEntity.class, aabb); - for(ItemEntity itemEntity : itemEntities) { - if(!itemEntity.isAlive()) continue; - if(filter != null && !filter.test(itemEntity.getItem())) continue; + for (ItemEntity itemEntity : itemEntities) { + if (!itemEntity.isAlive()) continue; + if (filter != null && !filter.test(itemEntity.getItem())) continue; double distX = (centerPos.getX() + 0.5) - itemEntity.position().x; double distZ = (centerPos.getZ() + 0.5) - itemEntity.position().z; double dist = Math.sqrt(Math.pow(distX, 2) + Math.pow(distZ, 2)); - if(dist >= 0.7f) { - if(itemEntity.pickupDelay == 32767) continue; //INFINITE_PICKUP_DELAY = 32767 - double dirX = distX/dist; - double dirZ = distZ/dist; + if (dist >= 0.7f) { + if (itemEntity.pickupDelay == 32767) continue; // INFINITE_PICKUP_DELAY = 32767 + double dirX = distX / dist; + double dirZ = distZ / dist; Vec3 delta = itemEntity.getDeltaMovement(); itemEntity.setDeltaMovement(dirX * MOTION_MULTIPLIER * tier, delta.y, dirZ * MOTION_MULTIPLIER * tier); itemEntity.setPickUpDelay(1); } else { ItemStack stack = itemEntity.getItem(); - if(!canFillOutput(stack)) continue; + if (!canFillOutput(stack)) continue; ItemStack remainder = fillOutput(stack); - if(remainder.isEmpty()) + if (remainder.isEmpty()) itemEntity.kill(); else if (stack.getCount() > remainder.getCount()) itemEntity.setItem(remainder); @@ -296,9 +304,8 @@ public boolean drainEnergy(boolean simulate) { return false; } - ////////////////////////////////////// - //******* Auto Output *******// + // ******* Auto Output *******// ////////////////////////////////////// @Override public void setAutoOutputItems(boolean allow) { @@ -312,9 +319,7 @@ public boolean isAllowInputFromOutputSideItems() { } @Override - public void setAllowInputFromOutputSideItems(boolean allow) { - - } + public void setAllowInputFromOutputSideItems(boolean allow) {} @Override public void setOutputFacingItems(@Nullable Direction outputFacing) { @@ -333,8 +338,9 @@ else if (batterySubs != null) { protected void updateAutoOutputSubscription() { var outputFacing = getOutputFacingItems(); - if ((isAutoOutputItems() && !output.isEmpty()) && outputFacing != null - && ItemTransferHelper.getItemTransfer(getLevel(), getPos().relative(outputFacing), outputFacing.getOpposite()) != null) + if ((isAutoOutputItems() && !output.isEmpty()) && outputFacing != null && + ItemTransferHelper.getItemTransfer(getLevel(), getPos().relative(outputFacing), + outputFacing.getOpposite()) != null) autoOutputSubs = subscribeServerTick(autoOutputSubs, this::autoOutput); else if (autoOutputSubs != null) { autoOutputSubs.unsubscribe(); @@ -391,43 +397,46 @@ public void setWorkingEnabled(boolean workingEnabled) { } ////////////////////////////////////// - //********** GUI ***********// + // ********** GUI ***********// ////////////////////////////////////// - public static BiFunction EDITABLE_UI_CREATOR = Util.memoize((path, inventorySize) -> new EditableMachineUI("misc", path, () -> { - var template = createTemplate(inventorySize).createDefault(); - var energyBar = createEnergyBar().createDefault(); - var batterySlot = createBatterySlot().createDefault(); - - var energyGroup = new WidgetGroup(0, 0, energyBar.getSize().width, energyBar.getSize().height + 20); - batterySlot.setSelfPosition(new Position((energyBar.getSize().width - 18) / 2, energyBar.getSize().height + 1)); - energyGroup.addWidget(energyBar); - energyGroup.addWidget(batterySlot); - var group = new WidgetGroup(0, 0, - Math.max(energyGroup.getSize().width + template.getSize().width + 4 + 8, 172), - Math.max(template.getSize().height + 8 + 30, energyGroup.getSize().height + 8)); - var size = group.getSize(); - energyGroup.setSelfPosition(new Position(3, (size.height - energyGroup.getSize().height) / 2)); - - template.setSelfPosition(new Position( - (size.width - energyGroup.getSize().width - 4 - template.getSize().width) / 2 + 2 + energyGroup.getSize().width + 2, - (size.height - template.getSize().height) / 2+15 - )); - - group.addWidget(energyGroup); - group.addWidget(template); - return group; - }, (template, machine) -> { - if (machine instanceof ItemCollectorMachine itemCollectorMachine) { - createTemplate(inventorySize).setupUI(template, itemCollectorMachine); - createEnergyBar().setupUI(template, itemCollectorMachine); - createBatterySlot().setupUI(template, itemCollectorMachine); - var rangeSelector = new IntInputWidget((template.getSize().width-80)/2,5,80,20, itemCollectorMachine::getRange, itemCollectorMachine::setRange); - rangeSelector.setMin(1); - rangeSelector.setMax(itemCollectorMachine.maxRange); - template.addWidget(rangeSelector); - } - })); + public static BiFunction EDITABLE_UI_CREATOR = Util + .memoize((path, inventorySize) -> new EditableMachineUI("misc", path, () -> { + var template = createTemplate(inventorySize).createDefault(); + var energyBar = createEnergyBar().createDefault(); + var batterySlot = createBatterySlot().createDefault(); + + var energyGroup = new WidgetGroup(0, 0, energyBar.getSize().width, energyBar.getSize().height + 20); + batterySlot.setSelfPosition( + new Position((energyBar.getSize().width - 18) / 2, energyBar.getSize().height + 1)); + energyGroup.addWidget(energyBar); + energyGroup.addWidget(batterySlot); + var group = new WidgetGroup(0, 0, + Math.max(energyGroup.getSize().width + template.getSize().width + 4 + 8, 172), + Math.max(template.getSize().height + 8 + 30, energyGroup.getSize().height + 8)); + var size = group.getSize(); + energyGroup.setSelfPosition(new Position(3, (size.height - energyGroup.getSize().height) / 2)); + + template.setSelfPosition(new Position( + (size.width - energyGroup.getSize().width - 4 - template.getSize().width) / 2 + 2 + + energyGroup.getSize().width + 2, + (size.height - template.getSize().height) / 2 + 15)); + + group.addWidget(energyGroup); + group.addWidget(template); + return group; + }, (template, machine) -> { + if (machine instanceof ItemCollectorMachine itemCollectorMachine) { + createTemplate(inventorySize).setupUI(template, itemCollectorMachine); + createEnergyBar().setupUI(template, itemCollectorMachine); + createBatterySlot().setupUI(template, itemCollectorMachine); + var rangeSelector = new IntInputWidget((template.getSize().width - 80) / 2, 5, 80, 20, + itemCollectorMachine::getRange, itemCollectorMachine::setRange); + rangeSelector.setMin(1); + rangeSelector.setMax(itemCollectorMachine.maxRange); + template.addWidget(rangeSelector); + } + })); protected static EditableUI createBatterySlot() { return new EditableUI<>("battery_slot", SlotWidget.class, () -> { @@ -438,14 +447,15 @@ protected static EditableUI createBatterySlot( slotWidget.setHandlerSlot(machine.chargerInventory, 0); slotWidget.setCanPutItems(true); slotWidget.setCanTakeItems(true); - slotWidget.setHoverTooltips(LangHandler.getMultiLang("gtceu.gui.charger_slot.tooltip", GTValues.VNF[machine.getTier()], GTValues.VNF[machine.getTier()]).toArray(new MutableComponent[0])); + slotWidget.setHoverTooltips(LangHandler.getMultiLang("gtceu.gui.charger_slot.tooltip", + GTValues.VNF[machine.getTier()], GTValues.VNF[machine.getTier()]).toArray(new MutableComponent[0])); }); } protected static EditableUI createTemplate(int inventorySize) { return new EditableUI<>("functional_container", WidgetGroup.class, () -> { int rowSize = (int) Math.sqrt(inventorySize); - WidgetGroup main = new WidgetGroup(0, 0, rowSize * 18 + 8+ 25, rowSize * 18 + 8); + WidgetGroup main = new WidgetGroup(0, 0, rowSize * 18 + 8 + 25, rowSize * 18 + 8); for (int y = 0; y < rowSize; y++) { for (int x = 0; x < rowSize; x++) { @@ -461,7 +471,8 @@ protected static EditableUI createTemplate(in SlotWidget filterSlotWidget = new SlotWidget(); filterSlotWidget.initTemplate(); - filterSlotWidget.setSelfPosition(new Position(4, (main.getSize().height - filterSlotWidget.getSize().height) / 2)); + filterSlotWidget + .setSelfPosition(new Position(4, (main.getSize().height - filterSlotWidget.getSize().height) / 2)); filterSlotWidget.setBackground(GuiTextures.SLOT, GuiTextures.FILTER_SLOT_OVERLAY); filterSlotWidget.setId("filter_slot"); main.addWidget(filterSlotWidget); @@ -486,7 +497,7 @@ protected static EditableUI createTemplate(in } ////////////////////////////////////// - //******* Rendering ********// + // ******* Rendering ********// ////////////////////////////////////// @Override public ResourceTexture sideTips(Player player, Set toolTypes, Direction side) { @@ -508,10 +519,11 @@ public ResourceTexture sideTips(Player player, Set toolTypes, Direct } ////////////////////////////////////// - //******* Interactions ********// + // ******* Interactions ********// ////////////////////////////////////// @Override - protected InteractionResult onWrenchClick(Player playerIn, InteractionHand hand, Direction gridSide, BlockHitResult hitResult) { + protected InteractionResult onWrenchClick(Player playerIn, InteractionHand hand, Direction gridSide, + BlockHitResult hitResult) { if (!playerIn.isShiftKeyDown() && !isRemote()) { var tool = playerIn.getItemInHand(hand); if (tool.getDamageValue() >= tool.getMaxDamage()) return InteractionResult.PASS; @@ -535,18 +547,17 @@ protected InteractionResult onWrenchClick(Player playerIn, InteractionHand hand, } @Override - protected InteractionResult onSoftMalletClick(Player playerIn, InteractionHand hand, Direction gridSide, BlockHitResult hitResult) { + protected InteractionResult onSoftMalletClick(Player playerIn, InteractionHand hand, Direction gridSide, + BlockHitResult hitResult) { var controllable = GTCapabilityHelper.getControllable(getLevel(), getPos(), gridSide); if (controllable != null) { if (!isRemote()) { controllable.setWorkingEnabled(!controllable.isWorkingEnabled()); playerIn.sendSystemMessage(Component.translatable(controllable.isWorkingEnabled() ? - "behaviour.soft_hammer.enabled" : "behaviour.soft_hammer.disabled")); + "behaviour.soft_hammer.enabled" : "behaviour.soft_hammer.disabled")); } return InteractionResult.CONSUME; } return InteractionResult.PASS; } - - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/MinerMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/MinerMachine.java index ea28f26036..c086fdf04c 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/MinerMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/MinerMachine.java @@ -20,6 +20,7 @@ import com.gregtechceu.gtceu.common.item.PortableScannerBehavior; import com.gregtechceu.gtceu.common.machine.trait.miner.MinerLogic; import com.gregtechceu.gtceu.data.lang.LangHandler; + import com.lowdragmc.lowdraglib.gui.widget.ComponentPanelWidget; import com.lowdragmc.lowdraglib.gui.widget.DraggableScrollableWidgetGroup; import com.lowdragmc.lowdraglib.gui.widget.SlotWidget; @@ -31,8 +32,7 @@ import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; import com.lowdragmc.lowdraglib.utils.Position; import com.lowdragmc.lowdraglib.utils.Size; -import com.mojang.blaze3d.MethodsReturnNonnullByDefault; -import lombok.Getter; + import net.minecraft.ChatFormatting; import net.minecraft.Util; import net.minecraft.core.BlockPos; @@ -49,20 +49,26 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.Block; import net.minecraft.world.phys.BlockHitResult; + +import com.mojang.blaze3d.MethodsReturnNonnullByDefault; +import lombok.Getter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.jetbrains.annotations.NotNull; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.function.BiFunction; +import javax.annotation.ParametersAreNonnullByDefault; + @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault -public class MinerMachine extends WorkableTieredMachine implements IMiner, IControllable, IFancyUIMachine, IDataInfoProvider { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(MinerMachine.class, WorkableTieredMachine.MANAGED_FIELD_HOLDER); +public class MinerMachine extends WorkableTieredMachine + implements IMiner, IControllable, IFancyUIMachine, IDataInfoProvider { + + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(MinerMachine.class, + WorkableTieredMachine.MANAGED_FIELD_HOLDER); @Getter @Persisted @@ -73,14 +79,16 @@ public class MinerMachine extends WorkableTieredMachine implements IMiner, ICont @Nullable protected ISubscription exportItemSubs, energySubs; - public MinerMachine(IMachineBlockEntity holder, int tier, int speed, int maximumRadius, int fortune, Object... args) { - super(holder, tier, GTMachines.defaultTankSizeFunction, args, (tier + 1) * (tier + 1), fortune, speed, maximumRadius); + public MinerMachine(IMachineBlockEntity holder, int tier, int speed, int maximumRadius, int fortune, + Object... args) { + super(holder, tier, GTMachines.defaultTankSizeFunction, args, (tier + 1) * (tier + 1), fortune, speed, + maximumRadius); this.energyPerTick = GTValues.V[tier - 1]; this.chargerInventory = createChargerItemHandler(); } ////////////////////////////////////// - //***** Initialization ******// + // ***** Initialization ******// ////////////////////////////////////// protected ItemStackTransfer createChargerItemHandler(Object... args) { @@ -99,15 +107,18 @@ protected NotifiableItemStackHandler createExportItemHandler(Object... args) { if (args.length > 3 && args[args.length - 4] instanceof Integer invSize) { return new NotifiableItemStackHandler(this, invSize, IO.OUT, IO.BOTH); } - throw new IllegalArgumentException("MinerMachine need args [inventorySize, fortune, speed, maximumRadius] for initialization"); + throw new IllegalArgumentException( + "MinerMachine need args [inventorySize, fortune, speed, maximumRadius] for initialization"); } @Override protected RecipeLogic createRecipeLogic(Object... args) { - if (args.length > 2 && args[args.length - 3] instanceof Integer fortune && args[args.length - 2] instanceof Integer speed && args[args.length - 1] instanceof Integer maxRadius) { + if (args.length > 2 && args[args.length - 3] instanceof Integer fortune && + args[args.length - 2] instanceof Integer speed && args[args.length - 1] instanceof Integer maxRadius) { return new MinerLogic(this, fortune, speed, maxRadius); } - throw new IllegalArgumentException("MinerMachine need args [inventorySize, fortune, speed, maximumRadius] for initialization"); + throw new IllegalArgumentException( + "MinerMachine need args [inventorySize, fortune, speed, maximumRadius] for initialization"); } @Override @@ -156,11 +167,12 @@ public void onUnload() { } ////////////////////////////////////// - //********** LOGIC **********// + // ********** LOGIC **********// ////////////////////////////////////// protected void updateAutoOutputSubscription() { var outputFacingItems = getFrontFacing(); - if (!exportItems.isEmpty() && ItemTransferHelper.getItemTransfer(getLevel(), getPos().relative(outputFacingItems), outputFacingItems.getOpposite()) != null) { + if (!exportItems.isEmpty() && ItemTransferHelper.getItemTransfer(getLevel(), + getPos().relative(outputFacingItems), outputFacingItems.getOpposite()) != null) { autoOutputSubs = subscribeServerTick(autoOutputSubs, this::autoOutput); } else if (autoOutputSubs != null) { autoOutputSubs.unsubscribe(); @@ -191,30 +203,32 @@ protected void chargeBattery() { } ////////////////////////////////////// - //*********** GUI ***********// + // *********** GUI ***********// ////////////////////////////////////// - public static BiFunction EDITABLE_UI_CREATOR = Util.memoize((path, inventorySize) -> new EditableMachineUI("misc", path, () -> { - WidgetGroup template = createTemplate(inventorySize).createDefault(); - SlotWidget batterySlot = createBatterySlot().createDefault(); - batterySlot.setSelfPosition(new Position(79, 62)); - WidgetGroup group = new WidgetGroup(0, 0, Math.max(template.getSize().width + 12, 172), template.getSize().height + 8); - group.addWidget(batterySlot); - Size size = group.getSize(); - - template.setSelfPosition(new Position( - (size.width - 4 - template.getSize().width) / 2 + 4, - (size.height - template.getSize().height) / 2)); - - group.addWidget(template); - return group; - }, (template, machine) -> { - if (machine instanceof MinerMachine minerMachine) { - createTemplate(inventorySize).setupUI(template, minerMachine); - createEnergyBar().setupUI(template, minerMachine); - createBatterySlot().setupUI(template, minerMachine); - } - })); + public static BiFunction EDITABLE_UI_CREATOR = Util + .memoize((path, inventorySize) -> new EditableMachineUI("misc", path, () -> { + WidgetGroup template = createTemplate(inventorySize).createDefault(); + SlotWidget batterySlot = createBatterySlot().createDefault(); + batterySlot.setSelfPosition(new Position(79, 62)); + WidgetGroup group = new WidgetGroup(0, 0, Math.max(template.getSize().width + 12, 172), + template.getSize().height + 8); + group.addWidget(batterySlot); + Size size = group.getSize(); + + template.setSelfPosition(new Position( + (size.width - 4 - template.getSize().width) / 2 + 4, + (size.height - template.getSize().height) / 2)); + + group.addWidget(template); + return group; + }, (template, machine) -> { + if (machine instanceof MinerMachine minerMachine) { + createTemplate(inventorySize).setupUI(template, minerMachine); + createEnergyBar().setupUI(template, minerMachine); + createBatterySlot().setupUI(template, minerMachine); + } + })); protected static EditableUI createTemplate(int inventorySize) { return new EditableUI<>("miner", WidgetGroup.class, () -> { @@ -241,7 +255,8 @@ protected static EditableUI createTemplate(int invent componentPanel.setId("component_panel"); var container = new WidgetGroup(0, 0, 117, height); - container.addWidget(new DraggableScrollableWidgetGroup(4, 4, container.getSize().width - 8, container.getSize().height - 8) + container.addWidget(new DraggableScrollableWidgetGroup(4, 4, container.getSize().width - 8, + container.getSize().height - 8) .setBackground(GuiTextures.DISPLAY) .addWidget(componentPanel)); container.setBackground(GuiTextures.BACKGROUND_INVERSE); @@ -275,26 +290,34 @@ protected static EditableUI createBatterySlot() { slotWidget.setHandlerSlot(machine.chargerInventory, 0); slotWidget.setCanPutItems(true); slotWidget.setCanTakeItems(true); - slotWidget.setHoverTooltips(LangHandler.getMultiLang("gtceu.gui.charger_slot.tooltip", GTValues.VNF[machine.getTier()], GTValues.VNF[machine.getTier()]).toArray(new MutableComponent[0])); + slotWidget.setHoverTooltips(LangHandler.getMultiLang("gtceu.gui.charger_slot.tooltip", + GTValues.VNF[machine.getTier()], GTValues.VNF[machine.getTier()]).toArray(new MutableComponent[0])); }); } private void addDisplayText(@NotNull List textList) { int workingArea = IMiner.getWorkingArea(getRecipeLogic().getCurrentRadius()); - textList.add(Component.translatable("gtceu.machine.miner.startx", getRecipeLogic().getX()).append(" ").append(Component.translatable("gtceu.machine.miner.minex", getRecipeLogic().getMineX()))); - textList.add(Component.translatable("gtceu.machine.miner.starty", getRecipeLogic().getY()).append(" ").append(Component.translatable("gtceu.machine.miner.miney", getRecipeLogic().getMineY()))); - textList.add(Component.translatable("gtceu.machine.miner.startz", getRecipeLogic().getZ()).append(" ").append(Component.translatable("gtceu.machine.miner.minez", getRecipeLogic().getMineZ()))); + textList.add(Component.translatable("gtceu.machine.miner.startx", getRecipeLogic().getX()).append(" ") + .append(Component.translatable("gtceu.machine.miner.minex", getRecipeLogic().getMineX()))); + textList.add(Component.translatable("gtceu.machine.miner.starty", getRecipeLogic().getY()).append(" ") + .append(Component.translatable("gtceu.machine.miner.miney", getRecipeLogic().getMineY()))); + textList.add(Component.translatable("gtceu.machine.miner.startz", getRecipeLogic().getZ()).append(" ") + .append(Component.translatable("gtceu.machine.miner.minez", getRecipeLogic().getMineZ()))); textList.add(Component.translatable("gtceu.universal.tooltip.working_area", workingArea, workingArea)); if (getRecipeLogic().isDone()) - textList.add(Component.translatable("gtceu.multiblock.large_miner.done").setStyle(Style.EMPTY.withColor(ChatFormatting.GREEN))); + textList.add(Component.translatable("gtceu.multiblock.large_miner.done") + .setStyle(Style.EMPTY.withColor(ChatFormatting.GREEN))); else if (getRecipeLogic().isWorking()) - textList.add(Component.translatable("gtceu.multiblock.large_miner.working").setStyle(Style.EMPTY.withColor(ChatFormatting.GOLD))); + textList.add(Component.translatable("gtceu.multiblock.large_miner.working") + .setStyle(Style.EMPTY.withColor(ChatFormatting.GOLD))); else if (!this.isWorkingEnabled()) textList.add(Component.translatable("gtceu.multiblock.work_paused")); if (getRecipeLogic().isInventoryFull()) - textList.add(Component.translatable("gtceu.multiblock.large_miner.invfull").setStyle(Style.EMPTY.withColor(ChatFormatting.RED))); + textList.add(Component.translatable("gtceu.multiblock.large_miner.invfull") + .setStyle(Style.EMPTY.withColor(ChatFormatting.RED))); if (!drainInput(true)) - textList.add(Component.translatable("gtceu.multiblock.large_miner.needspower").setStyle(Style.EMPTY.withColor(ChatFormatting.RED))); + textList.add(Component.translatable("gtceu.multiblock.large_miner.needspower") + .setStyle(Style.EMPTY.withColor(ChatFormatting.RED))); } @Override @@ -308,12 +331,12 @@ public boolean drainInput(boolean simulate) { return false; } - ////////////////////////////////////// - //******* Interaction *******// + // ******* Interaction *******// ////////////////////////////////////// @Override - protected InteractionResult onScrewdriverClick(Player playerIn, InteractionHand hand, Direction gridSide, BlockHitResult hitResult) { + protected InteractionResult onScrewdriverClick(Player playerIn, InteractionHand hand, Direction gridSide, + BlockHitResult hitResult) { if (isRemote()) return InteractionResult.SUCCESS; if (!this.isActive()) { @@ -328,7 +351,8 @@ else if (playerIn.isShiftKeyDown()) getRecipeLogic().resetArea(true); int workingArea = IMiner.getWorkingArea(getRecipeLogic().getCurrentRadius()); - playerIn.sendSystemMessage(Component.translatable("gtceu.universal.tooltip.working_area", workingArea, workingArea)); + playerIn.sendSystemMessage( + Component.translatable("gtceu.universal.tooltip.working_area", workingArea, workingArea)); } else { playerIn.sendSystemMessage(Component.translatable("gtceu.multiblock.large_miner.errorradius")); } @@ -338,10 +362,11 @@ else if (playerIn.isShiftKeyDown()) @NotNull @Override public List getDataInfo(PortableScannerBehavior.DisplayMode mode) { - if (mode == PortableScannerBehavior.DisplayMode.SHOW_ALL || mode == PortableScannerBehavior.DisplayMode.SHOW_MACHINE_INFO) { + if (mode == PortableScannerBehavior.DisplayMode.SHOW_ALL || + mode == PortableScannerBehavior.DisplayMode.SHOW_MACHINE_INFO) { int workingArea = IMiner.getWorkingArea(getRecipeLogic().getCurrentRadius()); return Collections.singletonList( - Component.translatable("gtceu.universal.tooltip.working_area", workingArea, workingArea)); + Component.translatable("gtceu.universal.tooltip.working_area", workingArea, workingArea)); } return new ArrayList<>(); } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/PumpMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/PumpMachine.java index 3f9e6edd98..f0b93f2bea 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/PumpMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/PumpMachine.java @@ -12,9 +12,9 @@ import com.gregtechceu.gtceu.api.machine.feature.IMachineLife; import com.gregtechceu.gtceu.api.machine.feature.IUIMachine; import com.gregtechceu.gtceu.api.machine.trait.NotifiableFluidTank; -import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; import com.gregtechceu.gtceu.common.data.GTBlocks; import com.gregtechceu.gtceu.utils.GTUtil; + import com.lowdragmc.lowdraglib.gui.modular.ModularUI; import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; import com.lowdragmc.lowdraglib.gui.widget.*; @@ -24,9 +24,9 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.DropSaved; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; +import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import lombok.Getter; -import lombok.Setter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -35,11 +35,15 @@ import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.LiquidBlock; -import javax.annotation.ParametersAreNonnullByDefault; +import lombok.Getter; +import lombok.Setter; + import java.util.ArrayDeque; import java.util.Deque; import java.util.Set; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author KilaBash * @date 2023/3/22 @@ -48,18 +52,26 @@ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class PumpMachine extends TieredEnergyMachine implements IAutoOutputFluid, IUIMachine, IMachineLife { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(PumpMachine.class, TieredEnergyMachine.MANAGED_FIELD_HOLDER); + + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(PumpMachine.class, + TieredEnergyMachine.MANAGED_FIELD_HOLDER); public static final int BASE_PUMP_RANGE = 32; public static final int EXTRA_PUMP_RANGE = 8; public static final int PUMP_SPEED_BASE = 80; private final Deque fluidSourceBlocks = new ArrayDeque<>(); private final Deque blocksToCheck = new ArrayDeque<>(); private boolean initializedQueue = false; - @Getter @Persisted + @Getter + @Persisted private int pumpHeadY; - @Getter @Setter @Persisted @DescSynced @RequireRerender + @Getter + @Setter + @Persisted + @DescSynced + @RequireRerender protected boolean autoOutputFluids; - @Persisted @DropSaved + @Persisted + @DropSaved protected final NotifiableFluidTank cache; public PumpMachine(IMachineBlockEntity holder, int tier, Object... args) { @@ -68,7 +80,7 @@ public PumpMachine(IMachineBlockEntity holder, int tier, Object... args) { } ////////////////////////////////////// - //***** Initialization *****// + // ***** Initialization *****// ////////////////////////////////////// @Override public ManagedFieldHolder getFieldHolder() { @@ -85,8 +97,7 @@ public boolean isAllowInputFromOutputSideFluids() { } @Override - public void setAllowInputFromOutputSideFluids(boolean allow) { - } + public void setAllowInputFromOutputSideFluids(boolean allow) {} @Override public Direction getOutputFacingFluids() { @@ -110,7 +121,7 @@ public boolean shouldWeatherOrTerrainExplosion() { } ////////////////////////////////////// - //********* Logic **********// + // ********* Logic **********// ////////////////////////////////////// private int getMaxPumpRange() { return BASE_PUMP_RANGE + EXTRA_PUMP_RANGE * getTier(); @@ -152,19 +163,20 @@ private void updateQueueState(int blocksToCheckAmount) { var downBlock = getLevel().getBlockState(downPos); if (downBlock.getBlock() instanceof LiquidBlock) { this.pumpHeadY++; - if (getLevel() instanceof ServerLevel serverLevel && serverLevel.getBlockState(selfPos).isAir()) { + if (getLevel() instanceof ServerLevel serverLevel && + serverLevel.getBlockState(selfPos).isAir()) { serverLevel.setBlockAndUpdate(selfPos, GTBlocks.MINER_PIPE.getDefaultState()); } } } - //schedule queue rebuild because we changed our position and no fluid is available + // schedule queue rebuild because we changed our position and no fluid is available this.initializedQueue = false; } if (!initializedQueue || getOffsetTimer() % 6000 == 0) { this.initializedQueue = true; - //just add ourselves to check list and see how this will go + // just add ourselves to check list and see how this will go this.blocksToCheck.add(selfPos); } } @@ -185,7 +197,8 @@ private void checkFluidBlockAt(BlockPos pumpHeadPos, BlockPos checkPos) { var blockHere = getLevel().getBlockState(checkPos); boolean shouldCheckNeighbours = isStraightInPumpRange(checkPos); - if (blockHere.getBlock() instanceof LiquidBlock liquidBlock && liquidBlock.getFluidState(blockHere).isSource()) { + if (blockHere.getBlock() instanceof LiquidBlock liquidBlock && + liquidBlock.getFluidState(blockHere).isSource()) { var fluidHandler = new FluidBlockTransfer(liquidBlock, getLevel(), checkPos); FluidStack drainStack = fluidHandler.drain(Integer.MAX_VALUE, true); if (!drainStack.isEmpty()) { @@ -199,7 +212,7 @@ private void checkFluidBlockAt(BlockPos pumpHeadPos, BlockPos checkPos) { for (var facing : GTUtil.DIRECTIONS) { BlockPos offsetPos = checkPos.relative(facing); if (offsetPos.distSqr(pumpHeadPos) > maxPumpRange * maxPumpRange) - continue; //do not add blocks outside bounds + continue; // do not add blocks outside bounds if (!fluidSourceBlocks.contains(offsetPos) && !blocksToCheck.contains(offsetPos)) { this.blocksToCheck.add(offsetPos); @@ -212,7 +225,8 @@ private void tryPumpFirstBlock() { BlockPos fluidBlockPos = fluidSourceBlocks.poll(); if (fluidBlockPos == null) return; var blockHere = getLevel().getBlockState(fluidBlockPos); - if (blockHere.getBlock() instanceof LiquidBlock liquidBlock && liquidBlock.getFluidState(blockHere).isSource()) { + if (blockHere.getBlock() instanceof LiquidBlock liquidBlock && + liquidBlock.getFluidState(blockHere).isSource()) { var fluidHandler = new FluidBlockTransfer(liquidBlock, getLevel(), fluidBlockPos); FluidStack drainStack = fluidHandler.drain(Integer.MAX_VALUE, true); if (!drainStack.isEmpty() && cache.fillInternal(drainStack, true) == drainStack.getAmount()) { @@ -230,7 +244,7 @@ public void update() { cache.exportToNearby(getOutputFacingFluids()); } - //do not do anything without enough energy supplied + // do not do anything without enough energy supplied if (energyContainer.getEnergyStored() < GTValues.V[getTier()] * 2) { return; } @@ -245,7 +259,7 @@ private int getPumpingCycleLength() { } ////////////////////////////////////// - //********** Gui ***********// + // ********** Gui ***********// ////////////////////////////////////// @Override public ModularUI createUI(Player entityPlayer) { @@ -253,7 +267,8 @@ public ModularUI createUI(Player entityPlayer) { .background(GuiTextures.BACKGROUND) .widget(new ImageWidget(7, 16, 81, 55, GuiTextures.DISPLAY)) .widget(new LabelWidget(11, 20, "gtceu.gui.fluid_amount")) - .widget(new LabelWidget(11, 30, () -> cache.getFluidInTank(0).getAmount() + "").setTextColor(-1).setDropShadow(true)) + .widget(new LabelWidget(11, 30, () -> cache.getFluidInTank(0).getAmount() + "").setTextColor(-1) + .setDropShadow(true)) .widget(new LabelWidget(6, 6, getBlockState().getBlock().getDescriptionId())) .widget(new TankWidget(cache.getStorages()[0], 90, 35, true, true) .setBackground(GuiTextures.FLUID_SLOT)) @@ -265,7 +280,7 @@ public ModularUI createUI(Player entityPlayer) { } ////////////////////////////////////// - //******* Rendering ********// + // ******* Rendering ********// ////////////////////////////////////// @Override public ResourceTexture sideTips(Player player, Set toolTypes, Direction side) { @@ -278,5 +293,4 @@ public ResourceTexture sideTips(Player player, Set toolTypes, Direct } return super.sideTips(player, toolTypes, side); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/RockCrusherMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/RockCrusherMachine.java index 63a2b3df5e..4c1052994b 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/RockCrusherMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/RockCrusherMachine.java @@ -5,6 +5,7 @@ import com.gregtechceu.gtceu.common.data.GTMachines; public class RockCrusherMachine extends SimpleTieredMachine { + public RockCrusherMachine(IMachineBlockEntity holder, int tier, Object... args) { super(holder, tier, GTMachines.defaultTankSizeFunction, args); } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/TransformerMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/TransformerMachine.java index ec2a5bc37f..789f3b7018 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/TransformerMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/TransformerMachine.java @@ -1,16 +1,16 @@ package com.gregtechceu.gtceu.common.machine.electric; -import com.gregtechceu.gtceu.api.machine.TieredEnergyMachine; import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.capability.IControllable; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; +import com.gregtechceu.gtceu.api.machine.TieredEnergyMachine; import com.gregtechceu.gtceu.api.machine.trait.NotifiableEnergyContainer; -import com.lowdragmc.lowdraglib.syncdata.annotation.UpdateListener; + import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; +import com.lowdragmc.lowdraglib.syncdata.annotation.UpdateListener; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import lombok.Getter; -import lombok.Setter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.network.chat.Component; @@ -19,6 +19,9 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.phys.BlockHitResult; +import lombok.Getter; +import lombok.Setter; + import javax.annotation.ParametersAreNonnullByDefault; /** @@ -29,10 +32,17 @@ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class TransformerMachine extends TieredEnergyMachine implements IControllable { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(TransformerMachine.class, TieredEnergyMachine.MANAGED_FIELD_HOLDER); - @Persisted @DescSynced @Getter @UpdateListener(methodName = "onTransformUpdated") + + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(TransformerMachine.class, + TieredEnergyMachine.MANAGED_FIELD_HOLDER); + @Persisted + @DescSynced + @Getter + @UpdateListener(methodName = "onTransformUpdated") private boolean isTransformUp; - @Persisted @Getter @Setter + @Persisted + @Getter + @Setter private boolean isWorkingEnabled; @Getter private final int baseAmp; @@ -44,7 +54,7 @@ public TransformerMachine(IMachineBlockEntity holder, int tier, int baseAmp, Obj } ////////////////////////////////////// - //***** Initialization ******// + // ***** Initialization ******// ////////////////////////////////////// @Override public ManagedFieldHolder getFieldHolder() { @@ -63,7 +73,8 @@ protected NotifiableEnergyContainer createEnergyContainer(Object... args) { NotifiableEnergyContainer energyContainer; long tierVoltage = GTValues.V[getTier()]; // Since this.baseAmp is not yet initialized, we substitute with 1A as default - energyContainer = new NotifiableEnergyContainer(this, tierVoltage * 8L, tierVoltage * 4, amp, tierVoltage, 4L * amp); + energyContainer = new NotifiableEnergyContainer(this, tierVoltage * 8L, tierVoltage * 4, amp, tierVoltage, + 4L * amp); energyContainer.setSideInputCondition(s -> s == getFrontFacing() && isWorkingEnabled()); energyContainer.setSideOutputCondition(s -> s != getFrontFacing() && isWorkingEnabled()); return energyContainer; @@ -79,13 +90,15 @@ public void updateEnergyContainer(boolean isTransformUp) { long tierVoltage = GTValues.V[getTier()]; int lowAmperage = baseAmp * 4; if (isTransformUp) { - //storage = n amp high; input = tier / 4; amperage = 4n; output = tier; amperage = n - this.energyContainer.resetBasicInfo(tierVoltage * 8L * lowAmperage, tierVoltage, lowAmperage, tierVoltage * 4, baseAmp); + // storage = n amp high; input = tier / 4; amperage = 4n; output = tier; amperage = n + this.energyContainer.resetBasicInfo(tierVoltage * 8L * lowAmperage, tierVoltage, lowAmperage, + tierVoltage * 4, baseAmp); energyContainer.setSideInputCondition(s -> s != getFrontFacing() && isWorkingEnabled()); energyContainer.setSideOutputCondition(s -> s == getFrontFacing() && isWorkingEnabled()); } else { - //storage = n amp high; input = tier; amperage = n; output = tier / 4; amperage = 4n - this.energyContainer.resetBasicInfo(tierVoltage * 8L * lowAmperage, tierVoltage * 4, baseAmp, tierVoltage, lowAmperage); + // storage = n amp high; input = tier; amperage = n; output = tier / 4; amperage = 4n + this.energyContainer.resetBasicInfo(tierVoltage * 8L * lowAmperage, tierVoltage * 4, baseAmp, tierVoltage, + lowAmperage); energyContainer.setSideInputCondition(s -> s == getFrontFacing() && isWorkingEnabled()); energyContainer.setSideOutputCondition(s -> s != getFrontFacing() && isWorkingEnabled()); } @@ -102,7 +115,7 @@ public int tintColor(int index) { } ////////////////////////////////////// - //****** Interaction *******// + // ****** Interaction *******// ////////////////////////////////////// public void setTransformUp(boolean isTransformUp) { @@ -113,13 +126,16 @@ public void setTransformUp(boolean isTransformUp) { } @Override - protected InteractionResult onScrewdriverClick(Player playerIn, InteractionHand hand, Direction gridSide, BlockHitResult hitResult) { + protected InteractionResult onScrewdriverClick(Player playerIn, InteractionHand hand, Direction gridSide, + BlockHitResult hitResult) { if (!isRemote()) { setTransformUp(!isTransformUp()); - playerIn.sendSystemMessage(Component.translatable(isTransformUp()?"gtceu.machine.transformer.message_transform_up":"gtceu.machine.transformer.message_transform_down", - energyContainer.getInputVoltage(), energyContainer.getInputAmperage(), energyContainer.getOutputVoltage(), energyContainer.getOutputAmperage())); + playerIn.sendSystemMessage(Component.translatable( + isTransformUp() ? "gtceu.machine.transformer.message_transform_up" : + "gtceu.machine.transformer.message_transform_down", + energyContainer.getInputVoltage(), energyContainer.getInputAmperage(), + energyContainer.getOutputVoltage(), energyContainer.getOutputAmperage())); } return InteractionResult.CONSUME; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/WorldAcceleratorMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/WorldAcceleratorMachine.java index 25a48c2cfb..04572fc501 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/electric/WorldAcceleratorMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/electric/WorldAcceleratorMachine.java @@ -13,15 +13,13 @@ import com.gregtechceu.gtceu.api.machine.trait.NotifiableEnergyContainer; import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.utils.GTUtil; + import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; 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 it.unimi.dsi.fastutil.objects.Object2BooleanFunction; -import it.unimi.dsi.fastutil.objects.Object2BooleanOpenHashMap; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; -import lombok.Getter; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.network.chat.Component; @@ -33,6 +31,11 @@ import net.minecraft.world.level.block.entity.BlockEntityTicker; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.phys.BlockHitResult; + +import it.unimi.dsi.fastutil.objects.Object2BooleanFunction; +import it.unimi.dsi.fastutil.objects.Object2BooleanOpenHashMap; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import lombok.Getter; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; @@ -42,7 +45,6 @@ import static com.gregtechceu.gtceu.common.data.GTMachines.defaultTankSizeFunction; - /** * @author h3tr * @date 2024/2/08 @@ -50,15 +52,16 @@ */ public class WorldAcceleratorMachine extends TieredEnergyMachine implements IControllable { + private static final Map> blacklistedClasses = new Object2ObjectOpenHashMap<>(); private static final Object2BooleanFunction> blacklistCache = new Object2BooleanOpenHashMap<>(); private static boolean gatheredClasses = false; - //Hard-coded blacklist for blockentities + // Hard-coded blacklist for blockentities private static final List blockEntityClassNamesBlackList = new ArrayList<>(); - - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(WorldAcceleratorMachine.class, TieredEnergyMachine.MANAGED_FIELD_HOLDER); + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( + WorldAcceleratorMachine.class, TieredEnergyMachine.MANAGED_FIELD_HOLDER); private static final long blockEntityAmperage = 6; private static final long randomTickAmperage = 3; // Variables for Random Tick mode optimization @@ -69,13 +72,17 @@ public class WorldAcceleratorMachine extends TieredEnergyMachine implements ICon private final int successLimit; private final int randRange; @Getter - @Persisted @DescSynced + @Persisted + @DescSynced private boolean isWorkingEnabled = true; @Getter - @Persisted @DescSynced + @Persisted + @DescSynced private boolean isRandomTickMode = true; @Getter - @Persisted @DescSynced @RequireRerender + @Persisted + @DescSynced + @RequireRerender private boolean active = false; private TickableSubscription tickSubs; @@ -86,9 +93,8 @@ public WorldAcceleratorMachine(IMachineBlockEntity holder, int tier, Object... a this.randRange = (getTier() << 1) + 1; } - @Override - protected @NotNull NotifiableEnergyContainer createEnergyContainer(Object @NotNull ... args) { + protected @NotNull NotifiableEnergyContainer createEnergyContainer(Object @NotNull... args) { long tierVoltage = GTValues.V[getTier()]; return new NotifiableEnergyContainer(this, tierVoltage * 256L, tierVoltage, 8, 0L, 0L); } @@ -111,22 +117,26 @@ public void updateSubscription() { public void update() { drainEnergy(false); - //handle random tick mode - if(isRandomTickMode) { + // handle random tick mode + if (isRandomTickMode) { BlockPos cornerPos = new BlockPos( - getPos().getX() - getTier(), - getPos().getY() - getTier(), - getPos().getZ() - getTier()); + getPos().getX() - getTier(), + getPos().getY() - getTier(), + getPos().getZ() - getTier()); int attempts = successLimit * 3; for (int i = 0, j = 0; i < successLimit && j < attempts; j++) { BlockPos randomPos = cornerPos.offset( - GTValues.RNG.nextInt(randRange), - GTValues.RNG.nextInt(randRange), - GTValues.RNG.nextInt(randRange)); - if(randomPos.getY() > getLevel().getMaxBuildHeight() || randomPos.getY() < getLevel().getMinBuildHeight() || !getLevel().isLoaded(randomPos) || randomPos.equals(getPos())) continue; - if(getLevel().getBlockState(randomPos).isRandomlyTicking()) { - getLevel().getBlockState(randomPos).randomTick((ServerLevel) this.getLevel(), randomPos,GTValues.RNG); + GTValues.RNG.nextInt(randRange), + GTValues.RNG.nextInt(randRange), + GTValues.RNG.nextInt(randRange)); + if (randomPos.getY() > getLevel().getMaxBuildHeight() || + randomPos.getY() < getLevel().getMinBuildHeight() || !getLevel().isLoaded(randomPos) || + randomPos.equals(getPos())) + continue; + if (getLevel().getBlockState(randomPos).isRandomlyTicking()) { + getLevel().getBlockState(randomPos).randomTick((ServerLevel) this.getLevel(), randomPos, + GTValues.RNG); } i++; } @@ -134,7 +144,7 @@ public void update() { // else handle block entity mode for (Direction dir : GTUtil.DIRECTIONS) { BlockEntity blockEntity = this.getLevel().getBlockEntity(this.getPos().relative(dir)); - if(blockEntity != null && canAccelerate(blockEntity)) { + if (blockEntity != null && canAccelerate(blockEntity)) { tickBlockEntity(blockEntity); } } @@ -146,7 +156,7 @@ public boolean drainEnergy(boolean simulate) { long toDrain = (isRandomTickMode ? randomTickAmperage : blockEntityAmperage) * GTValues.V[tier]; long resultEnergy = energyContainer.getEnergyStored() - toDrain; if (resultEnergy >= 0L && resultEnergy <= energyContainer.getEnergyCapacity()) { - if(!simulate) { + if (!simulate) { energyContainer.removeEnergy(toDrain); } return true; @@ -156,16 +166,18 @@ public boolean drainEnergy(boolean simulate) { private void tickBlockEntity(@NotNull T blockEntity) { BlockPos pos = blockEntity.getBlockPos(); - //noinspection unchecked - BlockEntityTicker blockEntityTicker = this.getLevel().getBlockState(pos).getTicker(this.getLevel(), (BlockEntityType) blockEntity.getType()); - if(blockEntityTicker == null) return; - for (int i = 0; i < speed-1; i++) { - blockEntityTicker.tick(blockEntity.getLevel(), blockEntity.getBlockPos(), blockEntity.getBlockState(), blockEntity); + // noinspection unchecked + BlockEntityTicker blockEntityTicker = this.getLevel().getBlockState(pos).getTicker(this.getLevel(), + (BlockEntityType) blockEntity.getType()); + if (blockEntityTicker == null) return; + for (int i = 0; i < speed - 1; i++) { + blockEntityTicker.tick(blockEntity.getLevel(), blockEntity.getBlockPos(), blockEntity.getBlockState(), + blockEntity); } } private boolean canAccelerate(BlockEntity blockEntity) { - if(blockEntity instanceof PipeBlockEntity || blockEntity instanceof IMachineBlockEntity) return false; + if (blockEntity instanceof PipeBlockEntity || blockEntity instanceof IMachineBlockEntity) return false; generateWorldAcceleratorBlacklist(); final Class blockEntityClass = blockEntity.getClass(); @@ -188,7 +200,7 @@ private boolean canAccelerate(BlockEntity blockEntity) { @Override public void onLoad() { super.onLoad(); - if(!isRemote()) { + if (!isRemote()) { energyContainer.addChangedListener(this::updateSubscription); } } @@ -196,7 +208,7 @@ public void onLoad() { @Override public void onUnload() { super.onUnload(); - if(tickSubs != null) { + if (tickSubs != null) { tickSubs.unsubscribe(); tickSubs = null; } @@ -215,13 +227,14 @@ public ResourceTexture sideTips(Player player, Set toolTypes, Direct return super.sideTips(player, toolTypes, side); } - protected InteractionResult onSoftMalletClick(Player playerIn, InteractionHand hand, Direction gridSide, BlockHitResult hitResult) { + protected InteractionResult onSoftMalletClick(Player playerIn, InteractionHand hand, Direction gridSide, + BlockHitResult hitResult) { var controllable = GTCapabilityHelper.getControllable(getLevel(), getPos(), gridSide); if (controllable != null) { if (!isRemote()) { controllable.setWorkingEnabled(!controllable.isWorkingEnabled()); playerIn.sendSystemMessage(Component.translatable(controllable.isWorkingEnabled() ? - "behaviour.soft_hammer.enabled" : "behaviour.soft_hammer.disabled")); + "behaviour.soft_hammer.enabled" : "behaviour.soft_hammer.disabled")); } return InteractionResult.CONSUME; } @@ -229,10 +242,12 @@ protected InteractionResult onSoftMalletClick(Player playerIn, InteractionHand h } @Override - protected @NotNull InteractionResult onScrewdriverClick(Player playerIn, InteractionHand hand, Direction gridSide, BlockHitResult hitResult) { + protected @NotNull InteractionResult onScrewdriverClick(Player playerIn, InteractionHand hand, Direction gridSide, + BlockHitResult hitResult) { if (!isRemote()) { isRandomTickMode = !isRandomTickMode; - playerIn.sendSystemMessage(Component.translatable(isRandomTickMode ? "gtceu.machine.world_accelerator.mode_entity" : "gtceu.machine.world_accelerator.mode_tile")); + playerIn.sendSystemMessage(Component.translatable(isRandomTickMode ? + "gtceu.machine.world_accelerator.mode_entity" : "gtceu.machine.world_accelerator.mode_tile")); scheduleRenderUpdate(); } return InteractionResult.CONSUME; @@ -250,7 +265,7 @@ private static void generateWorldAcceleratorBlacklist() { } } - for(String className: blockEntityClassNamesBlackList) { + for (String className : blockEntityClassNamesBlackList) { try { blacklistedClasses.put(className, Class.forName(className)); } catch (ClassNotFoundException ignored) {} @@ -259,5 +274,4 @@ private static void generateWorldAcceleratorBlacklist() { gatheredClasses = true; } } - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/kinetic/ElectricGearBoxMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/kinetic/ElectricGearBoxMachine.java index d55dc14e4d..e10339ada3 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/kinetic/ElectricGearBoxMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/kinetic/ElectricGearBoxMachine.java @@ -6,6 +6,7 @@ import com.gregtechceu.gtceu.api.machine.TieredEnergyMachine; import com.gregtechceu.gtceu.api.machine.feature.IFancyUIMachine; import com.gregtechceu.gtceu.api.machine.trait.NotifiableEnergyContainer; + import com.lowdragmc.lowdraglib.gui.texture.ColorBorderTexture; import com.lowdragmc.lowdraglib.gui.texture.ColorRectTexture; import com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup; @@ -17,11 +18,13 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import lombok.Getter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.util.Mth; +import lombok.Getter; + import javax.annotation.ParametersAreNonnullByDefault; /** @@ -32,10 +35,13 @@ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class ElectricGearBoxMachine extends TieredEnergyMachine implements IKineticMachine, IFancyUIMachine { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(ElectricGearBoxMachine.class, TieredEnergyMachine.MANAGED_FIELD_HOLDER); + + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( + ElectricGearBoxMachine.class, TieredEnergyMachine.MANAGED_FIELD_HOLDER); public final int maxAmps; @Getter - @Persisted @DescSynced + @Persisted + @DescSynced protected int currentAmps; public ElectricGearBoxMachine(IMachineBlockEntity holder, int tier, int maxAmps) { @@ -45,7 +51,7 @@ public ElectricGearBoxMachine(IMachineBlockEntity holder, int tier, int maxAmps) } ////////////////////////////////////// - //***** Initialization *****// + // ***** Initialization *****// ////////////////////////////////////// @Override @@ -56,7 +62,7 @@ public ManagedFieldHolder getFieldHolder() { @Override protected NotifiableEnergyContainer createEnergyContainer(Object... args) { var tierVoltage = GTValues.V[tier]; - var amps = (int)args[0]; + var amps = (int) args[0]; NotifiableEnergyContainer container; if (isEnergyEmitter()) { container = NotifiableEnergyContainer.emitterContainer(this, tierVoltage * 64L, tierVoltage, amps); @@ -80,7 +86,7 @@ protected long getMaxInputOutputAmperage() { } public void setCurrentAmps(int currentAmps) { - this.currentAmps = Mth.clamp(currentAmps, 0 , maxAmps); + this.currentAmps = Mth.clamp(currentAmps, 0, maxAmps); } public float getCurrentRPM() { @@ -109,10 +115,9 @@ public void onRotated(Direction oldFacing, Direction newFacing) { } ////////////////////////////////////// - //***** Rotation Logic *****// + // ***** Rotation Logic *****// ////////////////////////////////////// - @Override public float getRotationSpeedModifier(Direction direction) { if (direction == getRotationFacing().getOpposite()) @@ -126,9 +131,10 @@ protected void outputRotation() { getKineticHolder().stopWorking(); } var maxCharged = getCurrentAmps() * energyContainer.getInputVoltage(); - var charged = energyContainer.removeEnergy( maxCharged); + var charged = energyContainer.removeEnergy(maxCharged); if (charged > 0) { - getKineticHolder().scheduleWorking(getCurrentRPM() * getKineticDefinition().getTorque() * charged / maxCharged); + getKineticHolder() + .scheduleWorking(getCurrentRPM() * getKineticDefinition().getTorque() * charged / maxCharged); } else { getKineticHolder().stopWorking(); } @@ -138,23 +144,26 @@ protected void outputRotation() { @Override public Widget createUIWidget() { var group = new WidgetGroup(0, 0, 164, 48); - group.addWidget(new ImageWidget(36, 4, 92, 20, new TextTexture("").setWidth(92).setType(TextTexture.TextType.ROLL).setSupplier(() -> "Speed: " + getKineticHolder().workingSpeed))) + group.addWidget(new ImageWidget(36, 4, 92, 20, + new TextTexture("").setWidth(92).setType(TextTexture.TextType.ROLL) + .setSupplier(() -> "Speed: " + getKineticHolder().workingSpeed))) .addWidget(new ButtonWidget(4, 24, 30, 20, new GuiTextureGroup(GuiTextures.VANILLA_BUTTON, new TextTexture("-8rpm")), cd -> { - if (!cd.isRemote) { - int amount = cd.isCtrlClick ? cd.isShiftClick ? 32 : 16 : cd.isShiftClick ? 4 : 1; - setCurrentAmps(currentAmps - amount); - } - }).setHoverTooltips("gui.widget.incrementButton.default_tooltip")) + if (!cd.isRemote) { + int amount = cd.isCtrlClick ? cd.isShiftClick ? 32 : 16 : cd.isShiftClick ? 4 : 1; + setCurrentAmps(currentAmps - amount); + } + }).setHoverTooltips("gui.widget.incrementButton.default_tooltip")) .addWidget(new ButtonWidget(130, 24, 30, 20, new GuiTextureGroup(GuiTextures.VANILLA_BUTTON, new TextTexture("+8rpm")), cd -> { - if (!cd.isRemote) { - int amount = cd.isCtrlClick ? cd.isShiftClick ? 32 : 16 : cd.isShiftClick ? 4 : 1; - setCurrentAmps(currentAmps + amount); - } - }).setHoverTooltips("gui.widget.incrementButton.default_tooltip")) + if (!cd.isRemote) { + int amount = cd.isCtrlClick ? cd.isShiftClick ? 32 : 16 : cd.isShiftClick ? 4 : 1; + setCurrentAmps(currentAmps + amount); + } + }).setHoverTooltips("gui.widget.incrementButton.default_tooltip")) .addWidget(new ImageWidget(36, 24, 92, 20, new GuiTextureGroup(new ColorRectTexture(0xff000000), - new ColorBorderTexture(1, -1), new TextTexture("").setWidth(92).setType(TextTexture.TextType.ROLL).setSupplier(() -> getCurrentRPM() + "rpm")))); + new ColorBorderTexture(1, -1), new TextTexture("").setWidth(92) + .setType(TextTexture.TextType.ROLL).setSupplier(() -> getCurrentRPM() + "rpm")))); group.setBackground(GuiTextures.BACKGROUND_INVERSE); return group; } @@ -163,5 +172,4 @@ public Widget createUIWidget() { public boolean hasPlayerInventory() { return false; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/kinetic/IKineticMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/kinetic/IKineticMachine.java index 262fef87b7..adf6d046d4 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/kinetic/IKineticMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/kinetic/IKineticMachine.java @@ -3,6 +3,7 @@ import com.gregtechceu.gtceu.api.machine.feature.IMachineFeature; import com.gregtechceu.gtceu.common.blockentity.KineticMachineBlockEntity; import com.gregtechceu.gtceu.common.machine.KineticMachineDefinition; + import net.minecraft.core.Direction; /** @@ -11,8 +12,9 @@ * @implNote IKineticMachine */ public interface IKineticMachine extends IMachineFeature { + default KineticMachineBlockEntity getKineticHolder() { - return (KineticMachineBlockEntity)self().getHolder(); + return (KineticMachineBlockEntity) self().getHolder(); } default KineticMachineDefinition getKineticDefinition() { @@ -25,7 +27,8 @@ default float getRotationSpeedModifier(Direction direction) { default Direction getRotationFacing() { var frontFacing = self().getFrontFacing(); - return getKineticDefinition().isFrontRotation() ? frontFacing : (frontFacing.getAxis() == Direction.Axis.Y ? Direction.NORTH : frontFacing.getClockWise()); + return getKineticDefinition().isFrontRotation() ? frontFacing : + (frontFacing.getAxis() == Direction.Axis.Y ? Direction.NORTH : frontFacing.getClockWise()); } default boolean hasShaftTowards(Direction face) { diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/kinetic/SimpleKineticElectricWorkableMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/kinetic/SimpleKineticElectricWorkableMachine.java index a51ae8983b..20019fd387 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/kinetic/SimpleKineticElectricWorkableMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/kinetic/SimpleKineticElectricWorkableMachine.java @@ -5,12 +5,15 @@ import com.gregtechceu.gtceu.api.machine.SimpleTieredMachine; import com.gregtechceu.gtceu.api.machine.trait.NotifiableEnergyContainer; import com.gregtechceu.gtceu.common.machine.trait.NotifiableStressTrait; + import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; + +import net.minecraft.core.Direction; + import com.mojang.blaze3d.MethodsReturnNonnullByDefault; import it.unimi.dsi.fastutil.ints.Int2LongFunction; import lombok.Getter; -import net.minecraft.core.Direction; import javax.annotation.ParametersAreNonnullByDefault; @@ -22,19 +25,22 @@ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class SimpleKineticElectricWorkableMachine extends SimpleTieredMachine implements IKineticMachine { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(SimpleKineticElectricWorkableMachine.class, SimpleTieredMachine.MANAGED_FIELD_HOLDER); + + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( + SimpleKineticElectricWorkableMachine.class, SimpleTieredMachine.MANAGED_FIELD_HOLDER); @Getter @Persisted protected final NotifiableStressTrait stressTrait; - public SimpleKineticElectricWorkableMachine(IMachineBlockEntity holder, int tier, Int2LongFunction tankScalingFunction, Object... args) { + public SimpleKineticElectricWorkableMachine(IMachineBlockEntity holder, int tier, + Int2LongFunction tankScalingFunction, Object... args) { super(holder, tier, tankScalingFunction, args); this.stressTrait = createStressTrait(args); } ////////////////////////////////////// - //***** Initialization *****// + // ***** Initialization *****// ////////////////////////////////////// @Override public ManagedFieldHolder getFieldHolder() { diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/ActiveTransformerMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/ActiveTransformerMachine.java index bc9af0d4ee..8af96ca79e 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/ActiveTransformerMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/ActiveTransformerMachine.java @@ -15,8 +15,10 @@ import com.gregtechceu.gtceu.api.misc.EnergyContainerList; import com.gregtechceu.gtceu.api.pattern.TraceabilityPredicate; import com.gregtechceu.gtceu.config.ConfigHolder; -import it.unimi.dsi.fastutil.longs.Long2ObjectMaps; + import net.minecraft.world.level.block.Block; + +import it.unimi.dsi.fastutil.longs.Long2ObjectMaps; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; @@ -26,8 +28,8 @@ import static com.gregtechceu.gtceu.api.pattern.Predicates.abilities; -public class ActiveTransformerMachine extends WorkableElectricMultiblockMachine implements IControllable, IExplosionMachine { - +public class ActiveTransformerMachine extends WorkableElectricMultiblockMachine + implements IControllable, IExplosionMachine { private IEnergyContainer powerOutput; private IEnergyContainer powerInput; @@ -38,12 +40,14 @@ public ActiveTransformerMachine(IMachineBlockEntity holder) { this.powerOutput = new EnergyContainerList(new ArrayList<>()); this.powerInput = new EnergyContainerList(new ArrayList<>()); - this.converterSubscription = new ConditionalSubscriptionHandler(this, this::convertEnergyTick, this::isSubscriptionActive); + this.converterSubscription = new ConditionalSubscriptionHandler(this, this::convertEnergyTick, + this::isSubscriptionActive); } public void convertEnergyTick() { - if(isWorkingEnabled()){ - getRecipeLogic().setStatus(isSubscriptionActive() ? RecipeLogic.Status.WORKING : RecipeLogic.Status.SUSPEND); + if (isWorkingEnabled()) { + getRecipeLogic() + .setStatus(isSubscriptionActive() ? RecipeLogic.Status.WORKING : RecipeLogic.Status.SUSPEND); } if (isWorkingEnabled()) { long canDrain = powerInput.getEnergyStored(); @@ -62,7 +66,6 @@ protected boolean isSubscriptionActive() { if (powerOutput.getEnergyStored() >= powerOutput.getEnergyCapacity()) return false; return true; - } @Override @@ -80,7 +83,8 @@ public void onStructureFormed() { var handlerIO = handler.getHandlerIO(); // If IO not compatible if (io != IO.BOTH && handlerIO != IO.BOTH && io != handlerIO) continue; - if (handler.getCapability() == EURecipeCapability.CAP && handler instanceof IEnergyContainer container) { + if (handler.getCapability() == EURecipeCapability.CAP && + handler instanceof IEnergyContainer container) { if (handlerIO == IO.IN) { powerInput.add(container); } else if (handlerIO == IO.OUT) { @@ -124,7 +128,8 @@ private List getPrioritySortedParts() { @Override public void onStructureInvalid() { - if((isWorkingEnabled() && recipeLogic.getStatus() == RecipeLogic.Status.WORKING) && !ConfigHolder.INSTANCE.machines.harmlessActiveTransformers){ + if ((isWorkingEnabled() && recipeLogic.getStatus() == RecipeLogic.Status.WORKING) && + !ConfigHolder.INSTANCE.machines.harmlessActiveTransformers) { doExplosion(6f + getTier()); } super.onStructureInvalid(); @@ -136,10 +141,10 @@ public void onStructureInvalid() { public static TraceabilityPredicate getHatchPredicates() { return abilities(PartAbility.INPUT_ENERGY).setPreviewCount(1) - .or(abilities(PartAbility.OUTPUT_ENERGY).setPreviewCount(2)) - .or(abilities(PartAbility.SUBSTATION_INPUT_ENERGY).setPreviewCount(1)) - .or(abilities(PartAbility.SUBSTATION_OUTPUT_ENERGY).setPreviewCount(1)) - .or(abilities(PartAbility.INPUT_LASER).setPreviewCount(1)) - .or(abilities(PartAbility.OUTPUT_LASER).setPreviewCount(1)); + .or(abilities(PartAbility.OUTPUT_ENERGY).setPreviewCount(2)) + .or(abilities(PartAbility.SUBSTATION_INPUT_ENERGY).setPreviewCount(1)) + .or(abilities(PartAbility.SUBSTATION_OUTPUT_ENERGY).setPreviewCount(1)) + .or(abilities(PartAbility.INPUT_LASER).setPreviewCount(1)) + .or(abilities(PartAbility.OUTPUT_LASER).setPreviewCount(1)); } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/BedrockOreMinerMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/BedrockOreMinerMachine.java index 425bfcc523..8e979812d5 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/BedrockOreMinerMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/BedrockOreMinerMachine.java @@ -12,7 +12,7 @@ import com.gregtechceu.gtceu.common.data.GTMaterials; import com.gregtechceu.gtceu.common.machine.trait.BedrockOreMinerLogic; import com.gregtechceu.gtceu.utils.FormattingUtil; -import lombok.Getter; + import net.minecraft.ChatFormatting; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.network.chat.Component; @@ -21,10 +21,13 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.block.Block; -import javax.annotation.ParametersAreNonnullByDefault; +import lombok.Getter; + import java.util.List; import java.util.Map; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author Screret * @date 2023/7/12 @@ -53,7 +56,7 @@ public BedrockOreMinerLogic getRecipeLogic() { } public int getEnergyTier() { - return Math.min(this.tier + 1 , Math.max(this.tier, getOverclockTier())); + return Math.min(this.tier + 1, Math.max(this.tier, getOverclockTier())); } @Override @@ -66,28 +69,35 @@ public void addDisplayText(List textList) { if (getRecipeLogic().getVeinMaterials() != null) { // Ore names - textList.add(Component.translatable("gtceu.multiblock.ore_rig.drilled_ores_list").withStyle(ChatFormatting.GREEN)); + textList.add(Component.translatable("gtceu.multiblock.ore_rig.drilled_ores_list") + .withStyle(ChatFormatting.GREEN)); List> drilledOres = getRecipeLogic().getVeinMaterials(); for (var entry : drilledOres) { Component fluidInfo = entry.getValue().getLocalizedName().withStyle(ChatFormatting.GREEN); - textList.add(Component.translatable("gtceu.multiblock.ore_rig.drilled_ore_entry", fluidInfo).withStyle(ChatFormatting.GRAY)); + textList.add(Component.translatable("gtceu.multiblock.ore_rig.drilled_ore_entry", fluidInfo) + .withStyle(ChatFormatting.GRAY)); } // Ore amount Component amountInfo = Component.literal(FormattingUtil.formatNumbers( - getRecipeLogic().getOreToProduce() * 20L / BedrockOreMinerLogic.MAX_PROGRESS) + - "/s").withStyle(ChatFormatting.BLUE); - textList.add(Component.translatable("gtceu.multiblock.ore_rig.ore_amount", amountInfo).withStyle(ChatFormatting.GRAY)); + getRecipeLogic().getOreToProduce() * 20L / BedrockOreMinerLogic.MAX_PROGRESS) + + "/s").withStyle(ChatFormatting.BLUE); + textList.add(Component.translatable("gtceu.multiblock.ore_rig.ore_amount", amountInfo) + .withStyle(ChatFormatting.GRAY)); } else { - Component noOre = Component.translatable("gtceu.multiblock.fluid_rig.no_fluid_in_area").withStyle(ChatFormatting.RED); - textList.add(Component.translatable("gtceu.multiblock.ore_rig.drilled_ores_list").withStyle(ChatFormatting.GREEN)); - textList.add(Component.translatable("gtceu.multiblock.ore_rig.drilled_ore_entry", noOre).withStyle(ChatFormatting.GRAY)); + Component noOre = Component.translatable("gtceu.multiblock.fluid_rig.no_fluid_in_area") + .withStyle(ChatFormatting.RED); + textList.add(Component.translatable("gtceu.multiblock.ore_rig.drilled_ores_list") + .withStyle(ChatFormatting.GREEN)); + textList.add(Component.translatable("gtceu.multiblock.ore_rig.drilled_ore_entry", noOre) + .withStyle(ChatFormatting.GRAY)); } } else { - Component tooltip = Component.translatable("gtceu.multiblock.invalid_structure.tooltip").withStyle(ChatFormatting.GRAY); + Component tooltip = Component.translatable("gtceu.multiblock.invalid_structure.tooltip") + .withStyle(ChatFormatting.GRAY); textList.add(Component.translatable("gtceu.multiblock.invalid_structure") - .withStyle(Style.EMPTY.withColor(ChatFormatting.RED) - .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, tooltip)))); + .withStyle(Style.EMPTY.withColor(ChatFormatting.RED) + .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, tooltip)))); } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/CleanroomMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/CleanroomMachine.java index 45f772a471..560a41dd59 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/CleanroomMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/CleanroomMachine.java @@ -1,7 +1,5 @@ package com.gregtechceu.gtceu.common.machine.multiblock.electric; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Sets; import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.block.IFilterType; import com.gregtechceu.gtceu.api.capability.GTCapabilityHelper; @@ -37,11 +35,11 @@ import com.gregtechceu.gtceu.common.machine.multiblock.primitive.PrimitivePumpMachine; import com.gregtechceu.gtceu.common.machine.trait.CleanroomLogic; import com.gregtechceu.gtceu.utils.GTUtil; + import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; import com.lowdragmc.lowdraglib.utils.BlockInfo; -import it.unimi.dsi.fastutil.longs.Long2ObjectMaps; -import lombok.Getter; + import net.minecraft.ChatFormatting; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; @@ -57,18 +55,27 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.DoubleBlockHalf; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Sets; +import it.unimi.dsi.fastutil.longs.Long2ObjectMaps; +import lombok.Getter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; + import java.util.*; +import javax.annotation.ParametersAreNonnullByDefault; + import static com.gregtechceu.gtceu.api.pattern.Predicates.abilities; import static com.gregtechceu.gtceu.api.pattern.Predicates.states; @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault -public class CleanroomMachine extends WorkableElectricMultiblockMachine implements ICleanroomProvider, IDisplayUIMachine, IDataInfoProvider { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(CleanroomMachine.class, WorkableMultiblockMachine.MANAGED_FIELD_HOLDER); +public class CleanroomMachine extends WorkableElectricMultiblockMachine + implements ICleanroomProvider, IDisplayUIMachine, IDataInfoProvider { + + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(CleanroomMachine.class, + WorkableMultiblockMachine.MANAGED_FIELD_HOLDER); public static final int CLEAN_AMOUNT_THRESHOLD = 90; public static final int MIN_CLEAN_AMOUNT = 0; @@ -82,19 +89,20 @@ public class CleanroomMachine extends WorkableElectricMultiblockMachine implemen private CleanroomType cleanroomType = null; @Persisted private int cleanAmount; - //runtime - @Getter @Nullable + // runtime + @Getter + @Nullable private EnergyContainerList inputEnergyContainers; - @Getter @Nullable + @Getter + @Nullable private Collection cleanroomReceivers; - public CleanroomMachine(IMachineBlockEntity metaTileEntityId) { super(metaTileEntityId); } ////////////////////////////////////// - //****** Initialization ******// + // ****** Initialization ******// ////////////////////////////////////// @Override @@ -113,7 +121,7 @@ public CleanroomLogic getRecipeLogic() { } ////////////////////////////////////// - //*** Multiblock LifeCycle ***// + // *** Multiblock LifeCycle ***// ////////////////////////////////////// @Override @@ -132,14 +140,16 @@ public void onStructureFormed() { this.cleanroomReceivers.forEach(receiver -> receiver.setCleanroom(null)); this.cleanroomReceivers = null; } - Set receivers = getMultiblockState().getMatchContext().getOrCreate("cleanroomReceiver", Sets::newHashSet); + Set receivers = getMultiblockState().getMatchContext().getOrCreate("cleanroomReceiver", + Sets::newHashSet); this.cleanroomReceivers = ImmutableSet.copyOf(receivers); this.cleanroomReceivers.forEach(receiver -> receiver.setCleanroom(this)); // max progress is based on the dimensions of the structure: (x^3)-(x^2) // taller cleanrooms take longer than wider ones // minimum of 100 is a 5x5x5 cleanroom: 125-25=100 ticks - this.getRecipeLogic().setDuration((Math.max(100, ((lDist + rDist + 1) * (bDist + fDist + 1) * hDist) - ((lDist + rDist + 1) * (bDist + fDist + 1))))); + this.getRecipeLogic().setDuration((Math.max(100, + ((lDist + rDist + 1) * (bDist + fDist + 1) * hDist) - ((lDist + rDist + 1) * (bDist + fDist + 1))))); } @Override @@ -174,7 +184,8 @@ protected void initializeAbilities() { for (var handler : part.getRecipeHandlers()) { // If IO not compatible if (io != IO.BOTH && handler.getHandlerIO() != IO.BOTH && io != handler.getHandlerIO()) continue; - if (handler.getCapability() == EURecipeCapability.CAP && handler instanceof IEnergyContainer container) { + if (handler.getCapability() == EURecipeCapability.CAP && + handler instanceof IEnergyContainer container) { energyContainers.add(container); } } @@ -252,7 +263,8 @@ public void updateStructureDimensions() { * @param direction the direction to move * @return if a block is a valid wall block at pos moved in direction */ - public boolean isBlockEdge(@NotNull Level world, @NotNull BlockPos.MutableBlockPos pos, @NotNull Direction direction) { + public boolean isBlockEdge(@NotNull Level world, @NotNull BlockPos.MutableBlockPos pos, + @NotNull Direction direction) { return world.getBlockState(pos.move(direction)) == GTBlocks.PLASTCRETE.getDefaultState(); } @@ -262,8 +274,10 @@ public boolean isBlockEdge(@NotNull Level world, @NotNull BlockPos.MutableBlockP * @param direction the direction to move * @return if a block is a valid floor block at pos moved in direction */ - public boolean isBlockFloor(@NotNull Level world, @NotNull BlockPos.MutableBlockPos pos, @NotNull Direction direction) { - return isBlockEdge(world, pos, direction) || world.getBlockState(pos) == GTBlocks.CLEANROOM_GLASS.getDefaultState(); + public boolean isBlockFloor(@NotNull Level world, @NotNull BlockPos.MutableBlockPos pos, + @NotNull Direction direction) { + return isBlockEdge(world, pos, direction) || + world.getBlockState(pos) == GTBlocks.CLEANROOM_GLASS.getDefaultState(); } @NotNull @@ -289,7 +303,7 @@ public BlockPattern getPattern() { // build each row of the structure StringBuilder borderBuilder = new StringBuilder(); // BBBBB StringBuilder wallBuilder = new StringBuilder(); // BXXXB - StringBuilder insideBuilder = new StringBuilder(); // X X + StringBuilder insideBuilder = new StringBuilder(); // X X StringBuilder roofBuilder = new StringBuilder(); // BFFFB StringBuilder controllerBuilder = new StringBuilder(); // BFSFB StringBuilder centerBuilder = new StringBuilder(); // BXKXB @@ -344,12 +358,12 @@ public BlockPattern getPattern() { wall[0] = borderBuilder.toString(); wall[wall.length - 1] = borderBuilder.toString(); - String[] slice = new String[hDist + 1]; // "BXXXB", "X X", "X X", "X X", "BFFFB" + String[] slice = new String[hDist + 1]; // "BXXXB", "X X", "X X", "X X", "BFFFB" Arrays.fill(slice, insideBuilder.toString()); slice[0] = wallBuilder.toString(); slice[slice.length - 1] = roofBuilder.toString(); - String[] center = Arrays.copyOf(slice, slice.length); // "BXKXB", "X X", "X X", "X X", "BFSFB" + String[] center = Arrays.copyOf(slice, slice.length); // "BXKXB", "X X", "X X", "X X", "BFSFB" if (this.getFrontFacing() == Direction.NORTH || this.getFrontFacing() == Direction.SOUTH) { center[0] = centerBuilder.reverse().toString(); center[center.length - 1] = controllerBuilder.reverse().toString(); @@ -374,7 +388,8 @@ public BlockPattern getPattern() { .where('X', wallPredicate.or(basePredicate) .or(doorPredicate().setMaxGlobalLimited(8)) .or(abilities(PartAbility.PASSTHROUGH_HATCH).setMaxGlobalLimited(30))) - .where('K', wallPredicate) // the block beneath the controller must only be a casing for structure dimension checks + .where('K', wallPredicate) // the block beneath the controller must only be a casing for structure + // dimension checks .where('F', Predicates.cleanroomFilters()) .where(' ', innerPredicate()) .build(); @@ -394,13 +409,15 @@ protected BlockState getGlassState() { @NotNull protected static TraceabilityPredicate doorPredicate() { return Predicates.custom(blockWorldState -> blockWorldState.getBlockState().getBlock() instanceof DoorBlock, - () -> new BlockInfo[]{new BlockInfo(Blocks.IRON_DOOR.defaultBlockState()), new BlockInfo(Blocks.IRON_DOOR.defaultBlockState().setValue(DoorBlock.HALF, DoubleBlockHalf.UPPER))}); + () -> new BlockInfo[] { new BlockInfo(Blocks.IRON_DOOR.defaultBlockState()), new BlockInfo( + Blocks.IRON_DOOR.defaultBlockState().setValue(DoorBlock.HALF, DoubleBlockHalf.UPPER)) }); } @NotNull protected TraceabilityPredicate innerPredicate() { return new TraceabilityPredicate(blockWorldState -> { - Set receivers = blockWorldState.getMatchContext().getOrCreate("cleanroomReceiver", Sets::newHashSet); + Set receivers = blockWorldState.getMatchContext().getOrCreate("cleanroomReceiver", + Sets::newHashSet); // all non-GTMachines are allowed inside by default BlockEntity blockEntity = blockWorldState.getTileEntity(); if (blockEntity instanceof IMachineBlockEntity machineBlockEntity) { @@ -410,13 +427,15 @@ protected TraceabilityPredicate innerPredicate() { } } if (blockEntity != null) { - var receiver = GTCapabilityHelper.getCleanroomReceiver(blockWorldState.getWorld(), blockWorldState.getPos(), null); + var receiver = GTCapabilityHelper.getCleanroomReceiver(blockWorldState.getWorld(), + blockWorldState.getPos(), null); if (receiver != null) { receivers.add(receiver); } } return true; }, null) { + @Override public boolean isAny() { return true; @@ -435,10 +454,10 @@ protected boolean isMachineBanned(MetaMachine metaTileEntity) { if (metaTileEntity instanceof IMufflerMachine) return true; if (metaTileEntity instanceof SimpleGeneratorMachine) return true; // todo: enable checks when these are added? -// if (metaTileEntity instanceof FuelMultiblockController) return true; + // if (metaTileEntity instanceof FuelMultiblockController) return true; if (metaTileEntity instanceof LargeMinerMachine) return true; if (metaTileEntity instanceof FluidDrillMachine) return true; -// if (metaTileEntity instanceof MetaTileEntityCentralMonitor) return true; + // if (metaTileEntity instanceof MetaTileEntityCentralMonitor) return true; if (metaTileEntity instanceof CokeOvenMachine) return true; if (metaTileEntity instanceof PrimitiveBlastFurnaceMachine) return true; return metaTileEntity instanceof PrimitivePumpMachine; @@ -469,14 +488,16 @@ public void addDisplayText(List textList) { } if (recipeLogic.isWaiting()) { - textList.add(Component.translatable("gtceu.multiblock.waiting").setStyle(Style.EMPTY.withColor(ChatFormatting.RED))); + textList.add(Component.translatable("gtceu.multiblock.waiting") + .setStyle(Style.EMPTY.withColor(ChatFormatting.RED))); } if (isClean()) textList.add(Component.translatable("gtceu.multiblock.cleanroom.clean_state")); else textList.add(Component.translatable("gtceu.multiblock.cleanroom.dirty_state")); textList.add(Component.translatable("gtceu.multiblock.cleanroom.clean_amount", this.cleanAmount)); } else { - Component tooltip = Component.translatable("gtceu.multiblock.invalid_structure.tooltip").withStyle(ChatFormatting.GRAY); + Component tooltip = Component.translatable("gtceu.multiblock.invalid_structure.tooltip") + .withStyle(ChatFormatting.GRAY); textList.add(Component.translatable("gtceu.multiblock.invalid_structure") .withStyle(Style.EMPTY.withColor(ChatFormatting.RED) .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, tooltip)))); @@ -506,8 +527,10 @@ public boolean isClean() { @NotNull @Override public List getDataInfo(PortableScannerBehavior.DisplayMode mode) { - if (mode == PortableScannerBehavior.DisplayMode.SHOW_ALL || mode == PortableScannerBehavior.DisplayMode.SHOW_MACHINE_INFO) { - return Collections.singletonList(Component.translatable(isClean() ? "gtceu.multiblock.cleanroom.clean_state" : "gtceu.multiblock.cleanroom.dirty_state")); + if (mode == PortableScannerBehavior.DisplayMode.SHOW_ALL || + mode == PortableScannerBehavior.DisplayMode.SHOW_MACHINE_INFO) { + return Collections.singletonList(Component.translatable( + isClean() ? "gtceu.multiblock.cleanroom.clean_state" : "gtceu.multiblock.cleanroom.dirty_state")); } return new ArrayList<>(); } @@ -517,5 +540,4 @@ public long getMaxVoltage() { if (inputEnergyContainers == null) return GTValues.LV; return inputEnergyContainers.getInputVoltage(); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/FluidDrillMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/FluidDrillMachine.java index 70c7915d38..9ee7a09b0d 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/FluidDrillMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/FluidDrillMachine.java @@ -16,7 +16,7 @@ import com.gregtechceu.gtceu.common.machine.trait.FluidDrillLogic; import com.gregtechceu.gtceu.utils.FormattingUtil; import com.gregtechceu.gtceu.utils.GTUtil; -import lombok.Getter; + import net.minecraft.ChatFormatting; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.network.chat.Component; @@ -25,11 +25,14 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.material.Fluid; + +import lombok.Getter; import org.jetbrains.annotations.NotNull; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.List; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author KilaBash * @date 2023/7/12 @@ -61,7 +64,8 @@ public FluidDrillLogic getRecipeLogic() { public int getEnergyTier() { var energyContainer = this.getCapabilitiesProxy().get(IO.IN, EURecipeCapability.CAP); if (energyContainer == null) return this.tier; - var energyCont = new EnergyContainerList(energyContainer.stream().filter(IEnergyContainer.class::isInstance).map(IEnergyContainer.class::cast).toList()); + var energyCont = new EnergyContainerList(energyContainer.stream().filter(IEnergyContainer.class::isInstance) + .map(IEnergyContainer.class::cast).toList()); return Math.min(this.tier + 1, Math.max(this.tier, GTUtil.getFloorTierByVoltage(energyCont.getInputVoltage()))); } @@ -77,23 +81,29 @@ public void addDisplayText(List textList) { if (getRecipeLogic().getVeinFluid() != null) { // Fluid name Fluid drilledFluid = getRecipeLogic().getVeinFluid(); - Component fluidInfo = drilledFluid.getFluidType().getDescription().copy().withStyle(ChatFormatting.GREEN); - textList.add(Component.translatable("gtceu.multiblock.fluid_rig.drilled_fluid", fluidInfo).withStyle(ChatFormatting.GRAY)); + Component fluidInfo = drilledFluid.getFluidType().getDescription().copy() + .withStyle(ChatFormatting.GREEN); + textList.add(Component.translatable("gtceu.multiblock.fluid_rig.drilled_fluid", fluidInfo) + .withStyle(ChatFormatting.GRAY)); // Fluid amount Component amountInfo = Component.literal(FormattingUtil.formatNumbers( - getRecipeLogic().getFluidToProduce() * 20L / FluidDrillLogic.MAX_PROGRESS) + - " mB/s").withStyle(ChatFormatting.BLUE); - textList.add(Component.translatable("gtceu.multiblock.fluid_rig.fluid_amount", amountInfo).withStyle(ChatFormatting.GRAY)); + getRecipeLogic().getFluidToProduce() * 20L / FluidDrillLogic.MAX_PROGRESS) + + " mB/s").withStyle(ChatFormatting.BLUE); + textList.add(Component.translatable("gtceu.multiblock.fluid_rig.fluid_amount", amountInfo) + .withStyle(ChatFormatting.GRAY)); } else { - Component noFluid = Component.translatable("gtceu.multiblock.fluid_rig.no_fluid_in_area").withStyle(ChatFormatting.RED); - textList.add(Component.translatable("gtceu.multiblock.fluid_rig.drilled_fluid", noFluid).withStyle(ChatFormatting.GRAY)); + Component noFluid = Component.translatable("gtceu.multiblock.fluid_rig.no_fluid_in_area") + .withStyle(ChatFormatting.RED); + textList.add(Component.translatable("gtceu.multiblock.fluid_rig.drilled_fluid", noFluid) + .withStyle(ChatFormatting.GRAY)); } } else { - Component tooltip = Component.translatable("gtceu.multiblock.invalid_structure.tooltip").withStyle(ChatFormatting.GRAY); + Component tooltip = Component.translatable("gtceu.multiblock.invalid_structure.tooltip") + .withStyle(ChatFormatting.GRAY); textList.add(Component.translatable("gtceu.multiblock.invalid_structure") - .withStyle(Style.EMPTY.withColor(ChatFormatting.RED) - .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, tooltip)))); + .withStyle(Style.EMPTY.withColor(ChatFormatting.RED) + .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, tooltip)))); } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/FusionReactorMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/FusionReactorMachine.java index 6682c8057f..e5168810bb 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/FusionReactorMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/FusionReactorMachine.java @@ -18,22 +18,26 @@ import com.gregtechceu.gtceu.api.recipe.OverclockingLogic; import com.gregtechceu.gtceu.api.recipe.RecipeHelper; import com.gregtechceu.gtceu.common.block.FusionCasingBlock; + import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import it.unimi.dsi.fastutil.longs.Long2ObjectMaps; -import lombok.Getter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.network.chat.Component; import net.minecraft.world.level.block.Block; -import org.jetbrains.annotations.Nullable; +import it.unimi.dsi.fastutil.longs.Long2ObjectMaps; +import lombok.Getter; import org.jetbrains.annotations.NotNull; -import javax.annotation.ParametersAreNonnullByDefault; +import org.jetbrains.annotations.Nullable; + import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Objects; +import javax.annotation.ParametersAreNonnullByDefault; + import static com.gregtechceu.gtceu.api.GTValues.*; import static com.gregtechceu.gtceu.common.data.GTBlocks.*; @@ -41,7 +45,8 @@ @MethodsReturnNonnullByDefault public class FusionReactorMachine extends WorkableElectricMultiblockMachine implements ITieredMachine { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(FusionReactorMachine.class, WorkableMultiblockMachine.MANAGED_FIELD_HOLDER); + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(FusionReactorMachine.class, + WorkableMultiblockMachine.MANAGED_FIELD_HOLDER); @Getter private final int tier; @@ -51,10 +56,10 @@ public class FusionReactorMachine extends WorkableElectricMultiblockMachine impl protected long heat = 0; @Persisted protected final NotifiableEnergyContainer energyContainer; - //TODO implement it when we do fancy effect again. -// @Getter -// @DescSynced -// private Integer color = -1; + // TODO implement it when we do fancy effect again. + // @Getter + // @DescSynced + // private Integer color = -1; @Nullable protected TickableSubscription preHeatSubs; @@ -65,7 +70,7 @@ public FusionReactorMachine(IMachineBlockEntity holder, int tier) { } ////////////////////////////////////// - //***** Initialization ******// + // ***** Initialization ******// ////////////////////////////////////// @Override public ManagedFieldHolder getFieldHolder() { @@ -96,11 +101,12 @@ public void onStructureFormed() { Map ioMap = getMultiblockState().getMatchContext().getOrCreate("ioMap", Long2ObjectMaps::emptyMap); for (IMultiPart part : getParts()) { IO io = ioMap.getOrDefault(part.self().getPos().asLong(), IO.BOTH); - if(io == IO.NONE || io == IO.OUT) continue; + if (io == IO.NONE || io == IO.OUT) continue; for (var handler : part.getRecipeHandlers()) { // If IO not compatible if (io != IO.BOTH && handler.getHandlerIO() != IO.BOTH && io != handler.getHandlerIO()) continue; - if (handler.getCapability() == EURecipeCapability.CAP && handler instanceof IEnergyContainer container) { + if (handler.getCapability() == EURecipeCapability.CAP && + handler instanceof IEnergyContainer container) { energyContainers.add(container); traitSubscriptions.add(handler.addChangedListener(this::updatePreHeatSubscription)); } @@ -122,11 +128,12 @@ public void onStructureInvalid() { } ////////////////////////////////////// - //***** Recipe Logic ******// + // ***** Recipe Logic ******// ////////////////////////////////////// protected void updatePreHeatSubscription() { // do preheat logic for heat cool down and charge internal energy container - if (heat > 0 || (inputEnergyContainers != null && inputEnergyContainers.getEnergyStored() > 0 && energyContainer.getEnergyStored() < energyContainer.getEnergyCapacity())) { + if (heat > 0 || (inputEnergyContainers != null && inputEnergyContainers.getEnergyStored() > 0 && + energyContainer.getEnergyStored() < energyContainer.getEnergyCapacity())) { preHeatSubs = subscribeServerTick(preHeatSubs, this::updateHeat); } else if (preHeatSubs != null) { preHeatSubs.unsubscribe(); @@ -147,7 +154,8 @@ public static GTRecipe recipeModifier(MetaMachine machine, @NotNull GTRecipe rec // if the stored heat is >= required energy, recipe is okay to run if (heatDiff <= 0) { - return RecipeHelper.applyOverclock(new OverclockingLogic(2, 2), recipe, fusionReactorMachine.getMaxVoltage()); + return RecipeHelper.applyOverclock(new OverclockingLogic(2, 2), recipe, + fusionReactorMachine.getMaxVoltage()); } // if the remaining energy needed is more than stored, do not run if (fusionReactorMachine.energyContainer.getEnergyStored() < heatDiff) @@ -158,7 +166,8 @@ public static GTRecipe recipeModifier(MetaMachine machine, @NotNull GTRecipe rec // increase the stored heat fusionReactorMachine.heat += heatDiff; fusionReactorMachine.updatePreHeatSubscription(); - return RecipeHelper.applyOverclock(new OverclockingLogic(2, 2), recipe, fusionReactorMachine.getMaxVoltage()); + return RecipeHelper.applyOverclock(new OverclockingLogic(2, 2), recipe, + fusionReactorMachine.getMaxVoltage()); } return null; } @@ -191,10 +200,13 @@ public boolean onWorking() { } public void updateHeat() { - // Drain heat when the reactor is not active, is paused via soft mallet, or does not have enough energy and has fully wiped recipe progress - // Don't drain heat when there is not enough energy and there is still some recipe progress, as that makes it doubly hard to complete the recipe + // Drain heat when the reactor is not active, is paused via soft mallet, or does not have enough energy and has + // fully wiped recipe progress + // Don't drain heat when there is not enough energy and there is still some recipe progress, as that makes it + // doubly hard to complete the recipe // (Will have to recover heat and recipe progress) - if ((getRecipeLogic().isIdle() || !isWorkingEnabled() || (getRecipeLogic().isWaiting() && getRecipeLogic().getProgress() == 0)) && heat > 0) { + if ((getRecipeLogic().isIdle() || !isWorkingEnabled() || + (getRecipeLogic().isWaiting() && getRecipeLogic().getProgress() == 0)) && heat > 0) { heat = heat <= 10000 ? 0 : (heat - 10000); } // charge the internal energy storage @@ -205,30 +217,31 @@ public void updateHeat() { updatePreHeatSubscription(); } -// @Override -// public void onWorking() { -// super.onWorking(); -// if (color == -1) { -// var lastRecipe = recipeLogic.getLastRecipe(); -// if (lastRecipe != null && !lastRecipe.getOutputContents(FluidRecipeCapability.CAP).isEmpty()) { -// int newColor = 0xFF000000 | FluidHelper.getColor(FluidRecipeCapability.CAP.of(lastRecipe.getOutputContents(FluidRecipeCapability.CAP).get(0).getContent())); -// if (!Objects.equals(color, newColor)) { -// color = newColor; -// } -// } -// } -// } - -// @Override -// public void onWaiting() { -// super.onWaiting(); -// color = -1; -// } + // @Override + // public void onWorking() { + // super.onWorking(); + // if (color == -1) { + // var lastRecipe = recipeLogic.getLastRecipe(); + // if (lastRecipe != null && !lastRecipe.getOutputContents(FluidRecipeCapability.CAP).isEmpty()) { + // int newColor = 0xFF000000 | + // FluidHelper.getColor(FluidRecipeCapability.CAP.of(lastRecipe.getOutputContents(FluidRecipeCapability.CAP).get(0).getContent())); + // if (!Objects.equals(color, newColor)) { + // color = newColor; + // } + // } + // } + // } + + // @Override + // public void onWaiting() { + // super.onWaiting(); + // color = -1; + // } @Override public void afterWorking() { super.afterWorking(); -// color = -1; + // color = -1; } @Override @@ -237,20 +250,21 @@ public long getMaxVoltage() { } ////////////////////////////////////// - //******** GUI *********// + // ******** GUI *********// ////////////////////////////////////// @Override public void addDisplayText(List textList) { super.addDisplayText(textList); if (isFormed()) { - textList.add(Component.translatable("gtceu.multiblock.fusion_reactor.energy", this.energyContainer.getEnergyStored(), this.energyContainer.getEnergyCapacity())); + textList.add(Component.translatable("gtceu.multiblock.fusion_reactor.energy", + this.energyContainer.getEnergyStored(), this.energyContainer.getEnergyCapacity())); textList.add(Component.translatable("gtceu.multiblock.fusion_reactor.heat", heat)); } } ////////////////////////////////////// - //******** MISC *********// + // ******** MISC *********// ////////////////////////////////////// public static long calculateEnergyStorageFactor(int tier, int energyInputAmount) { return energyInputAmount * (long) Math.pow(2, tier - LuV) * 10000000L; @@ -279,5 +293,4 @@ public static IFusionCasingType getCasingType(int tier) { default -> FusionCasingBlock.CasingType.FUSION_CASING; }; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/LargeMinerMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/LargeMinerMachine.java index a87c68d005..9dd535aea6 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/LargeMinerMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/LargeMinerMachine.java @@ -21,14 +21,14 @@ import com.gregtechceu.gtceu.common.machine.trait.miner.LargeMinerLogic; import com.gregtechceu.gtceu.utils.GTTransferUtils; import com.gregtechceu.gtceu.utils.GTUtil; + import com.lowdragmc.lowdraglib.gui.util.ClickData; import com.lowdragmc.lowdraglib.gui.widget.ComponentPanelWidget; import com.lowdragmc.lowdraglib.misc.FluidTransferList; import com.lowdragmc.lowdraglib.side.fluid.FluidStack; import com.lowdragmc.lowdraglib.side.fluid.IFluidTransfer; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import it.unimi.dsi.fastutil.longs.Long2ObjectMaps; -import lombok.Getter; + import net.minecraft.ChatFormatting; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; @@ -39,21 +39,28 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.block.Block; import net.minecraft.world.phys.BlockHitResult; + +import it.unimi.dsi.fastutil.longs.Long2ObjectMaps; +import lombok.Getter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; +import javax.annotation.ParametersAreNonnullByDefault; + import static com.gregtechceu.gtceu.common.data.GTMaterials.DrillingFluid; @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault -public class LargeMinerMachine extends WorkableElectricMultiblockMachine implements IMiner, IControllable, IDataInfoProvider { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(LargeMinerMachine.class, WorkableMultiblockMachine.MANAGED_FIELD_HOLDER); +public class LargeMinerMachine extends WorkableElectricMultiblockMachine + implements IMiner, IControllable, IDataInfoProvider { + + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(LargeMinerMachine.class, + WorkableMultiblockMachine.MANAGED_FIELD_HOLDER); public static final int CHUNK_LENGTH = 16; @Getter private final int tier; @@ -63,21 +70,24 @@ public class LargeMinerMachine extends WorkableElectricMultiblockMachine impleme protected FluidTransferList inputFluidInventory; private final int drillingFluidConsumePerTick; - public LargeMinerMachine(IMachineBlockEntity holder, int tier, int speed, int maximumChunkDiameter, int fortune, int drillingFluidConsumePerTick) { + public LargeMinerMachine(IMachineBlockEntity holder, int tier, int speed, int maximumChunkDiameter, int fortune, + int drillingFluidConsumePerTick) { super(holder, fortune, speed, maximumChunkDiameter); this.tier = tier; this.drillingFluidConsumePerTick = drillingFluidConsumePerTick; } ////////////////////////////////////// - //***** Initialization ******// + // ***** Initialization ******// ////////////////////////////////////// @Override protected @NotNull RecipeLogic createRecipeLogic(Object... args) { - if ( args[args.length - 3] instanceof Integer fortune && args[args.length - 2] instanceof Integer speed && args[args.length - 1] instanceof Integer maxRadius) { + if (args[args.length - 3] instanceof Integer fortune && args[args.length - 2] instanceof Integer speed && + args[args.length - 1] instanceof Integer maxRadius) { return new LargeMinerLogic(this, fortune, speed, maxRadius * CHUNK_LENGTH / 2); } - throw new IllegalArgumentException("MinerMachine need args [inventorySize, fortune, speed, maximumRadius] for initialization"); + throw new IllegalArgumentException( + "MinerMachine need args [inventorySize, fortune, speed, maximumRadius] for initialization"); } @Override @@ -105,9 +115,8 @@ public long getMaxVoltage() { return GTValues.V[getEnergyTier()]; } - ////////////////////////////////////// - //******* Logic *********// + // ******* Logic *********// ////////////////////////////////////// @Override public void onStructureFormed() { @@ -121,29 +130,33 @@ private void initializeAbilities() { Map ioMap = getMultiblockState().getMatchContext().getOrCreate("ioMap", Long2ObjectMaps::emptyMap); for (IMultiPart part : getParts()) { IO io = ioMap.getOrDefault(part.self().getPos().asLong(), IO.BOTH); - if(io == IO.NONE) continue; + if (io == IO.NONE) continue; for (var handler : part.getRecipeHandlers()) { // If IO not compatible if (io != IO.BOTH && handler.getHandlerIO() != IO.BOTH && io != handler.getHandlerIO()) continue; var handlerIO = io == IO.BOTH ? handler.getHandlerIO() : io; - if (handlerIO == IO.IN && handler.getCapability() == EURecipeCapability.CAP && handler instanceof IEnergyContainer container) { + if (handlerIO == IO.IN && handler.getCapability() == EURecipeCapability.CAP && + handler instanceof IEnergyContainer container) { energyContainers.add(container); - } else if (handlerIO == IO.IN && handler.getCapability() == FluidRecipeCapability.CAP && handler instanceof IFluidTransfer fluidTransfer) { - fluidTanks.add(fluidTransfer); - } + } else if (handlerIO == IO.IN && handler.getCapability() == FluidRecipeCapability.CAP && + handler instanceof IFluidTransfer fluidTransfer) { + fluidTanks.add(fluidTransfer); + } } } this.energyContainer = new EnergyContainerList(energyContainers); this.inputFluidInventory = new FluidTransferList(fluidTanks); getRecipeLogic().setVoltageTier(GTUtil.getTierByVoltage(this.energyContainer.getInputVoltage())); - getRecipeLogic().setOverclockAmount(Math.max(1, GTUtil.getTierByVoltage(this.energyContainer.getInputVoltage()) - this.tier)); + getRecipeLogic().setOverclockAmount( + Math.max(1, GTUtil.getTierByVoltage(this.energyContainer.getInputVoltage()) - this.tier)); getRecipeLogic().initPos(getPos(), getRecipeLogic().getCurrentRadius()); } public int getEnergyTier() { if (energyContainer == null) return this.tier; - return Math.min(this.tier + 1, Math.max(this.tier, GTUtil.getFloorTierByVoltage(energyContainer.getInputVoltage()))); + return Math.min(this.tier + 1, + Math.max(this.tier, GTUtil.getFloorTierByVoltage(energyContainer.getInputVoltage()))); } @Override @@ -165,9 +178,11 @@ public boolean drainInput(boolean simulate) { // drain fluid if (inputFluidInventory != null && inputFluidInventory.transfers.length > 0) { - FluidStack drillingFluid = DrillingFluid.getFluid((long) this.drillingFluidConsumePerTick * getRecipeLogic().getOverclockAmount()); + FluidStack drillingFluid = DrillingFluid + .getFluid((long) this.drillingFluidConsumePerTick * getRecipeLogic().getOverclockAmount()); FluidStack fluidStack = inputFluidInventory.getFluidInTank(0); - if (fluidStack != FluidStack.empty() && fluidStack.isFluidEqual(DrillingFluid.getFluid(1)) && fluidStack.getAmount() >= drillingFluid.getAmount()) { + if (fluidStack != FluidStack.empty() && fluidStack.isFluidEqual(DrillingFluid.getFluid(1)) && + fluidStack.getAmount() >= drillingFluid.getAmount()) { if (!simulate) { GTTransferUtils.drainFluidAccountNotifiableList(inputFluidInventory, drillingFluid, false); } @@ -179,7 +194,7 @@ public boolean drainInput(boolean simulate) { } ////////////////////////////////////// - //*********** GUI ***********// + // *********** GUI ***********// ////////////////////////////////////// @Override public void addDisplayText(List textList) { @@ -187,9 +202,12 @@ public void addDisplayText(List textList) { if (this.isFormed()) { int workingAreaChunks = getRecipeLogic().getCurrentRadius() * 2 / CHUNK_LENGTH; int workingArea = IMiner.getWorkingArea(getRecipeLogic().getCurrentRadius()); - textList.add(Component.translatable("gtceu.machine.miner.startx", getRecipeLogic().getX() == Integer.MAX_VALUE ? 0 : getRecipeLogic().getX())); - textList.add(Component.translatable("gtceu.machine.miner.starty", getRecipeLogic().getY() == Integer.MAX_VALUE ? 0 : getRecipeLogic().getY())); - textList.add(Component.translatable("gtceu.machine.miner.startz", getRecipeLogic().getZ() == Integer.MAX_VALUE ? 0 : getRecipeLogic().getZ())); + textList.add(Component.translatable("gtceu.machine.miner.startx", + getRecipeLogic().getX() == Integer.MAX_VALUE ? 0 : getRecipeLogic().getX())); + textList.add(Component.translatable("gtceu.machine.miner.starty", + getRecipeLogic().getY() == Integer.MAX_VALUE ? 0 : getRecipeLogic().getY())); + textList.add(Component.translatable("gtceu.machine.miner.startz", + getRecipeLogic().getZ() == Integer.MAX_VALUE ? 0 : getRecipeLogic().getZ())); textList.add(Component.translatable("gtceu.universal.tooltip.silk_touch") .append(ComponentPanelWidget.withButton(Component.literal("[") .append(getRecipeLogic().isSilkTouchMode() ? @@ -203,12 +221,14 @@ public void addDisplayText(List textList) { Component.translatable("gtceu.creative.activity.off")) .append(Component.literal("]")), "chunk_mode"))); if (getRecipeLogic().isChunkMode()) { - textList.add(Component.translatable("gtceu.universal.tooltip.working_area_chunks", workingAreaChunks, workingAreaChunks)); + textList.add(Component.translatable("gtceu.universal.tooltip.working_area_chunks", workingAreaChunks, + workingAreaChunks)); } else { textList.add(Component.translatable("gtceu.universal.tooltip.working_area", workingArea, workingArea)); } if (getRecipeLogic().isDone()) { - textList.add(Component.translatable("gtceu.multiblock.large_miner.done").setStyle(Style.EMPTY.withColor(ChatFormatting.GREEN))); + textList.add(Component.translatable("gtceu.multiblock.large_miner.done") + .setStyle(Style.EMPTY.withColor(ChatFormatting.GREEN))); } } } @@ -226,10 +246,11 @@ public void handleDisplayClick(String componentData, ClickData clickData) { } ////////////////////////////////////// - //******* Interaction *******// + // ******* Interaction *******// ////////////////////////////////////// @Override - public InteractionResult onScrewdriverClick(Player playerIn, InteractionHand hand, Direction facing, BlockHitResult hitResult) { + public InteractionResult onScrewdriverClick(Player playerIn, InteractionHand hand, Direction facing, + BlockHitResult hitResult) { if (isRemote() || !this.isFormed()) return InteractionResult.SUCCESS; @@ -242,7 +263,8 @@ public InteractionResult onScrewdriverClick(Player playerIn, InteractionHand han getRecipeLogic().setCurrentRadius(currentRadius - CHUNK_LENGTH); } int workingAreaChunks = getRecipeLogic().getCurrentRadius() * 2 / CHUNK_LENGTH; - playerIn.sendSystemMessage(Component.translatable("gtceu.universal.tooltip.working_area_chunks", workingAreaChunks, workingAreaChunks)); + playerIn.sendSystemMessage(Component.translatable("gtceu.universal.tooltip.working_area_chunks", + workingAreaChunks, workingAreaChunks)); } else { if (currentRadius - CHUNK_LENGTH / 2 <= 0) { getRecipeLogic().setCurrentRadius(getRecipeLogic().getMaximumRadius()); @@ -250,7 +272,8 @@ public InteractionResult onScrewdriverClick(Player playerIn, InteractionHand han getRecipeLogic().setCurrentRadius(currentRadius - CHUNK_LENGTH / 2); } int workingArea = IMiner.getWorkingArea(getRecipeLogic().getCurrentRadius()); - playerIn.sendSystemMessage(Component.translatable("gtceu.universal.tooltip.working_area", workingArea, workingArea)); + playerIn.sendSystemMessage( + Component.translatable("gtceu.universal.tooltip.working_area", workingArea, workingArea)); } getRecipeLogic().resetArea(true); } else { @@ -262,10 +285,11 @@ public InteractionResult onScrewdriverClick(Player playerIn, InteractionHand han @NotNull @Override public List getDataInfo(PortableScannerBehavior.DisplayMode mode) { - if (mode == PortableScannerBehavior.DisplayMode.SHOW_ALL || mode == PortableScannerBehavior.DisplayMode.SHOW_MACHINE_INFO) { + if (mode == PortableScannerBehavior.DisplayMode.SHOW_ALL || + mode == PortableScannerBehavior.DisplayMode.SHOW_MACHINE_INFO) { int workingArea = IMiner.getWorkingArea(getRecipeLogic().getCurrentRadius()); return Collections.singletonList( - Component.translatable("gtceu.universal.tooltip.working_area", workingArea, workingArea)); + Component.translatable("gtceu.universal.tooltip.working_area", workingArea, workingArea)); } return new ArrayList<>(); } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/MultiblockTankMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/MultiblockTankMachine.java index 28df9f2c25..b6f3308ac4 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/MultiblockTankMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/MultiblockTankMachine.java @@ -7,11 +7,12 @@ import com.gregtechceu.gtceu.api.machine.feature.IFancyUIMachine; import com.gregtechceu.gtceu.api.machine.multiblock.MultiblockControllerMachine; import com.gregtechceu.gtceu.api.machine.trait.NotifiableFluidTank; + import com.lowdragmc.lowdraglib.gui.widget.*; import com.lowdragmc.lowdraglib.side.fluid.FluidHelper; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import lombok.Getter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.world.InteractionHand; @@ -20,6 +21,8 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.BlockHitResult; + +import lombok.Getter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -28,10 +31,14 @@ @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault public class MultiblockTankMachine extends MultiblockControllerMachine implements IFancyUIMachine { - @Persisted @Getter @NotNull + + @Persisted + @Getter + @NotNull private final NotifiableFluidTank tank; - public MultiblockTankMachine(IMachineBlockEntity holder, int capacity, @Nullable PropertyFluidFilter filter, Object... args) { + public MultiblockTankMachine(IMachineBlockEntity holder, int capacity, @Nullable PropertyFluidFilter filter, + Object... args) { super(holder); this.tank = createTank(capacity, filter, args); @@ -47,7 +54,8 @@ protected NotifiableFluidTank createTank(int capacity, @Nullable PropertyFluidFi } @Override - public InteractionResult onUse(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { + public InteractionResult onUse(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, + BlockHitResult hit) { var superResult = super.onUse(state, world, pos, player, hand, hit); if (superResult != InteractionResult.PASS) return superResult; @@ -57,7 +65,7 @@ public InteractionResult onUse(BlockState state, Level world, BlockPos pos, Play } ///////////////////////////////////// - //*********** GUI ***********// + // *********** GUI ***********// ///////////////////////////////////// @Override @@ -69,8 +77,7 @@ public Widget createUIWidget() { group.addWidget(new LabelWidget(8, 8, "gtceu.gui.fluid_amount")); group.addWidget(new LabelWidget(8, 18, this::getFluidLabel).setTextColor(-1).setDropShadow(true)); group.addWidget(new TankWidget(tank.getStorages()[0], 68, 23, true, true) - .setBackground(GuiTextures.FLUID_SLOT) - ); + .setBackground(GuiTextures.FLUID_SLOT)); return group; } @@ -80,10 +87,11 @@ private String getFluidLabel() { } ////////////////////////////////////// - //***** LDLib SyncData ******// + // ***** LDLib SyncData ******// ////////////////////////////////////// - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(MultiblockTankMachine.class, MultiblockControllerMachine.MANAGED_FIELD_HOLDER); + public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(MultiblockTankMachine.class, + MultiblockControllerMachine.MANAGED_FIELD_HOLDER); @Override public ManagedFieldHolder getFieldHolder() { diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/PowerSubstationMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/PowerSubstationMachine.java index d7841f3ac0..1233967d16 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/PowerSubstationMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/PowerSubstationMachine.java @@ -1,11 +1,9 @@ package com.gregtechceu.gtceu.common.machine.multiblock.electric; -import com.google.common.annotations.VisibleForTesting; import com.gregtechceu.gtceu.api.capability.IEnergyContainer; import com.gregtechceu.gtceu.api.capability.IEnergyInfoProvider; import com.gregtechceu.gtceu.api.capability.recipe.EURecipeCapability; import com.gregtechceu.gtceu.api.capability.recipe.IO; -import com.gregtechceu.gtceu.api.capability.recipe.RecipeCapability; import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.api.gui.fancy.FancyMachineUIWidget; import com.gregtechceu.gtceu.api.gui.fancy.IFancyUIProvider; @@ -24,17 +22,21 @@ import com.gregtechceu.gtceu.api.misc.EnergyContainerList; import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.utils.FormattingUtil; + import com.lowdragmc.lowdraglib.gui.modular.ModularUI; import com.lowdragmc.lowdraglib.gui.widget.*; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import it.unimi.dsi.fastutil.longs.Long2ObjectMaps; -import lombok.Getter; + import net.minecraft.ChatFormatting; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.HoverEvent; import net.minecraft.network.chat.Style; import net.minecraft.world.entity.player.Player; + +import com.google.common.annotations.VisibleForTesting; +import it.unimi.dsi.fastutil.longs.Long2ObjectMaps; +import lombok.Getter; import org.jetbrains.annotations.NotNull; import java.math.BigInteger; @@ -44,8 +46,11 @@ import java.util.List; import java.util.Map; -public class PowerSubstationMachine extends WorkableMultiblockMachine implements IEnergyInfoProvider, IFancyUIMachine, IDisplayUIMachine { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(PowerSubstationMachine.class, WorkableMultiblockMachine.MANAGED_FIELD_HOLDER); +public class PowerSubstationMachine extends WorkableMultiblockMachine + implements IEnergyInfoProvider, IFancyUIMachine, IDisplayUIMachine { + + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( + PowerSubstationMachine.class, WorkableMultiblockMachine.MANAGED_FIELD_HOLDER); // Structure Constants public static final int MAX_BATTERY_LAYERS = 18; @@ -99,7 +104,8 @@ public void onStructureFormed() { var handlerIO = handler.getHandlerIO(); // If IO not compatible if (io != IO.BOTH && handlerIO != IO.BOTH && io != handlerIO) continue; - if (handler.getCapability() == EURecipeCapability.CAP && handler instanceof IEnergyContainer container) { + if (handler.getCapability() == EURecipeCapability.CAP && + handler instanceof IEnergyContainer container) { if (handlerIO == IO.IN) { inputs.add(container); } else if (handlerIO == IO.OUT) { @@ -114,7 +120,8 @@ public void onStructureFormed() { List batteries = new ArrayList<>(); for (Map.Entry battery : getMultiblockState().getMatchContext().entrySet()) { - if (battery.getKey().startsWith(PMC_BATTERY_HEADER) && battery.getValue() instanceof BatteryMatchWrapper wrapper) { + if (battery.getKey().startsWith(PMC_BATTERY_HEADER) && + battery.getValue() instanceof BatteryMatchWrapper wrapper) { for (int i = 0; i < wrapper.amount; i++) { batteries.add(wrapper.partType); } @@ -152,7 +159,8 @@ protected void transferEnergyTick() { if (!getLevel().isClientSide) { if (getOffsetTimer() % 20 == 0) { // active here is just used for rendering - getRecipeLogic().setStatus(energyBank.hasEnergy() ? RecipeLogic.Status.WORKING : RecipeLogic.Status.IDLE); + getRecipeLogic() + .setStatus(energyBank.hasEnergy() ? RecipeLogic.Status.WORKING : RecipeLogic.Status.IDLE); averageInLastSec = netInLastSec / 20; averageOutLastSec = netOutLastSec / 20; netInLastSec = 0; @@ -170,7 +178,8 @@ protected void transferEnergyTick() { netOutLastSec -= energyPassiveDrained; // Debank to Dynamo Hatches - long energyDebanked = energyBank.drain(outputHatches.getEnergyCapacity() - outputHatches.getEnergyStored()); + long energyDebanked = energyBank + .drain(outputHatches.getEnergyCapacity() - outputHatches.getEnergyStored()); outputHatches.changeEnergy(energyDebanked); netOutLastSec += energyDebanked; } @@ -187,37 +196,50 @@ public void addDisplayText(List textList) { } else if (isActive()) { textList.add(Component.translatable("gtceu.multiblock.running")); int currentProgress = (int) (recipeLogic.getProgressPercent() * 100); -// if (this.recipeMapWorkable.getParallelLimit() != 1) { -// textList.add(Component.translatable("gtceu.multiblock.parallel", this.recipeMapWorkable.getParallelLimit())); -// } + // if (this.recipeMapWorkable.getParallelLimit() != 1) { + // textList.add(Component.translatable("gtceu.multiblock.parallel", + // this.recipeMapWorkable.getParallelLimit())); + // } textList.add(Component.translatable("gtceu.multiblock.progress", currentProgress)); } else { textList.add(Component.translatable("gtceu.multiblock.idling")); } if (recipeLogic.isWaiting()) { - textList.add(Component.translatable("gtceu.multiblock.waiting").setStyle(Style.EMPTY.withColor(ChatFormatting.RED))); + textList.add(Component.translatable("gtceu.multiblock.waiting") + .setStyle(Style.EMPTY.withColor(ChatFormatting.RED))); } if (energyBank != null) { BigInteger energyStored = energyBank.getStored(); BigInteger energyCapacity = energyBank.getCapacity(); - textList.add(Component.translatable("gtceu.multiblock.power_substation.stored", FormattingUtil.formatNumbers(energyStored))); - textList.add(Component.translatable("gtceu.multiblock.power_substation.capacity", FormattingUtil.formatNumbers(energyCapacity))); - textList.add(Component.translatable("gtceu.multiblock.power_substation.passive_drain", FormattingUtil.formatNumbers(getPassiveDrain()))); - textList.add(Component.translatable("gtceu.multiblock.power_substation.average_in", FormattingUtil.formatNumbers(averageInLastSec)) + textList.add(Component.translatable("gtceu.multiblock.power_substation.stored", + FormattingUtil.formatNumbers(energyStored))); + textList.add(Component.translatable("gtceu.multiblock.power_substation.capacity", + FormattingUtil.formatNumbers(energyCapacity))); + textList.add(Component.translatable("gtceu.multiblock.power_substation.passive_drain", + FormattingUtil.formatNumbers(getPassiveDrain()))); + textList.add(Component + .translatable("gtceu.multiblock.power_substation.average_in", + FormattingUtil.formatNumbers(averageInLastSec)) .withStyle(Style.EMPTY.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.translatable("gtceu.multiblock.power_substation.average_in_hover"))))); - textList.add(Component.translatable("gtceu.multiblock.power_substation.average_out", FormattingUtil.formatNumbers(Math.abs(averageOutLastSec))) - .withStyle(Style.EMPTY.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, - Component.translatable("gtceu.multiblock.power_substation.average_out_hover"))))); + textList.add(Component + .translatable("gtceu.multiblock.power_substation.average_out", + FormattingUtil.formatNumbers(Math.abs(averageOutLastSec))) + .withStyle(Style.EMPTY.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, + Component.translatable("gtceu.multiblock.power_substation.average_out_hover"))))); if (averageInLastSec > averageOutLastSec) { - BigInteger timeToFillSeconds = energyCapacity.subtract(energyStored).divide(BigInteger.valueOf((averageInLastSec-averageOutLastSec) * 20)); - textList.add(Component.translatable("gtceu.multiblock.power_substation.time_to_fill", getTimeToFillDrainText(timeToFillSeconds))); + BigInteger timeToFillSeconds = energyCapacity.subtract(energyStored) + .divide(BigInteger.valueOf((averageInLastSec - averageOutLastSec) * 20)); + textList.add(Component.translatable("gtceu.multiblock.power_substation.time_to_fill", + getTimeToFillDrainText(timeToFillSeconds))); } else if (averageInLastSec < averageOutLastSec) { - BigInteger timeToDrainSeconds = energyStored.divide(BigInteger.valueOf((averageOutLastSec - averageInLastSec) * 20)); - textList.add(Component.translatable("gtceu.multiblock.power_substation.time_to_drain", getTimeToFillDrainText(timeToDrainSeconds))); + BigInteger timeToDrainSeconds = energyStored + .divide(BigInteger.valueOf((averageOutLastSec - averageInLastSec) * 20)); + textList.add(Component.translatable("gtceu.multiblock.power_substation.time_to_drain", + getTimeToFillDrainText(timeToDrainSeconds))); } } } @@ -255,7 +277,6 @@ private static Component getTimeToFillDrainText(BigInteger timeToFillSeconds) { return Component.translatable(key, FormattingUtil.formatNumbers(fillTime)); } - public long getPassiveDrain() { if (ConfigHolder.INSTANCE.machines.enableMaintenance) { if (maintenance == null) { @@ -306,10 +327,10 @@ public boolean supportsBigIntEnergyValues() { public Widget createUIWidget() { var group = new WidgetGroup(0, 0, 182 + 8, 117 + 8); group.addWidget(new DraggableScrollableWidgetGroup(4, 4, 182, 117).setBackground(getScreenTexture()) - .addWidget(new LabelWidget(4, 5, self().getBlockState().getBlock().getDescriptionId())) - .addWidget(new ComponentPanelWidget(4, 17, this::addDisplayText) - .setMaxWidthLimit(150) - .clickHandler(this::handleDisplayClick))); + .addWidget(new LabelWidget(4, 5, self().getBlockState().getBlock().getDescriptionId())) + .addWidget(new ComponentPanelWidget(4, 17, this::addDisplayText) + .setMaxWidthLimit(150) + .clickHandler(this::handleDisplayClick))); group.setBackground(GuiTextures.BACKGROUND_INVERSE); return group; } @@ -321,7 +342,8 @@ public ModularUI createUI(Player entityPlayer) { @Override public List getSubTabs() { - return getParts().stream().filter(IFancyUIProvider.class::isInstance).map(IFancyUIProvider.class::cast).toList(); + return getParts().stream().filter(IFancyUIProvider.class::isInstance).map(IFancyUIProvider.class::cast) + .toList(); } @Override @@ -345,14 +367,16 @@ public void loadCustomPersistedData(CompoundTag tag) { } public static class PowerStationEnergyBank extends MachineTrait { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(PowerSubstationMachine.PowerStationEnergyBank.class); + + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( + PowerSubstationMachine.PowerStationEnergyBank.class); private static final String NBT_SIZE = "Size"; private static final String NBT_STORED = "Stored"; private static final String NBT_MAX = "Max"; - //@Persisted(key = NBT_STORED) + // @Persisted(key = NBT_STORED) private long[] storage; - //@Persisted(key = NBT_MAX) + // @Persisted(key = NBT_MAX) private long[] maximums; @Getter private BigInteger capacity; @@ -526,7 +550,6 @@ public ManagedFieldHolder getFieldHolder() { } } - public static class BatteryMatchWrapper { private final IBatteryData partType; @@ -541,4 +564,4 @@ public BatteryMatchWrapper increment() { return this; } } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/ProcessingArrayMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/ProcessingArrayMachine.java index 4a0a9c5c14..a5fc87dd98 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/ProcessingArrayMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/ProcessingArrayMachine.java @@ -10,7 +10,6 @@ import com.gregtechceu.gtceu.api.machine.MetaMachine; import com.gregtechceu.gtceu.api.machine.MultiblockMachineDefinition; import com.gregtechceu.gtceu.api.machine.feature.IMachineModifyDrops; -import com.gregtechceu.gtceu.api.machine.multiblock.MultiblockDisplayText; import com.gregtechceu.gtceu.api.machine.multiblock.TieredWorkableElectricMultiblockMachine; import com.gregtechceu.gtceu.api.machine.trait.NotifiableItemStackHandler; import com.gregtechceu.gtceu.api.recipe.GTRecipe; @@ -22,6 +21,7 @@ import com.gregtechceu.gtceu.common.data.GTRecipeModifiers; import com.gregtechceu.gtceu.common.data.GTRecipeTypes; import com.gregtechceu.gtceu.utils.GTUtil; + import com.lowdragmc.lowdraglib.gui.widget.SlotWidget; import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; @@ -29,6 +29,7 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; + import net.minecraft.ChatFormatting; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.network.chat.Component; @@ -36,17 +37,18 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.Block; -import org.jetbrains.annotations.ApiStatus; -import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; + import java.util.List; import java.util.Map; import java.util.Objects; import java.util.stream.Collectors; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author KilaBash * @date 2023/7/23 @@ -58,11 +60,13 @@ @ApiStatus.ScheduledForRemoval(inVersion = "1.3.0") public class ProcessingArrayMachine extends TieredWorkableElectricMultiblockMachine implements IMachineModifyDrops { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(ProcessingArrayMachine.class, TieredWorkableElectricMultiblockMachine.MANAGED_FIELD_HOLDER); + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( + ProcessingArrayMachine.class, TieredWorkableElectricMultiblockMachine.MANAGED_FIELD_HOLDER); - @Persisted @DescSynced + @Persisted + @DescSynced public final NotifiableItemStackHandler machineStorage; - //runtime + // runtime @Nullable private GTRecipeType[] recipeTypeCache; @@ -72,7 +76,7 @@ public ProcessingArrayMachine(IMachineBlockEntity holder, int tier, Object... ar } ////////////////////////////////////// - //***** Initialization ******// + // ***** Initialization ******// ////////////////////////////////////// @Override public ManagedFieldHolder getFieldHolder() { @@ -81,6 +85,7 @@ public ManagedFieldHolder getFieldHolder() { protected NotifiableItemStackHandler createMachineStorage(Object... args) { var storage = new NotifiableItemStackHandler(this, 1, IO.NONE, IO.NONE, slots -> new ItemStackTransfer(1) { + @Override public int getSlotLimit(int slot) { return getMachineLimit(getDefinition().getTier()); @@ -99,11 +104,11 @@ protected boolean isMachineStack(ItemStack itemStack) { } var recipeTypes = definition.getRecipeTypes(); - if(recipeTypes == null){ + if (recipeTypes == null) { return false; } - for(GTRecipeType type : recipeTypes){ - if(type != GTRecipeTypes.DUMMY_RECIPES){ + for (GTRecipeType type : recipeTypes) { + if (type != GTRecipeTypes.DUMMY_RECIPES) { return true; } } @@ -127,7 +132,7 @@ public GTRecipeType[] getRecipeTypes() { recipeTypeCache = definition == null ? null : definition.getRecipeTypes(); } if (recipeTypeCache == null) { - recipeTypeCache = new GTRecipeType[]{GTRecipeTypes.DUMMY_RECIPES}; + recipeTypeCache = new GTRecipeType[] { GTRecipeTypes.DUMMY_RECIPES }; } return recipeTypeCache; } @@ -162,7 +167,7 @@ public void onDrops(List drops, Player entity) { } ////////////////////////////////////// - //******* Recipe Logic *******// + // ******* Recipe Logic *******// ////////////////////////////////////// /** @@ -177,7 +182,8 @@ public int getTier() { @Override public int getOverclockTier() { MachineDefinition machineDefinition = getMachineDefinition(); - int machineTier = machineDefinition == null ? getDefinition().getTier() : Math.min(getDefinition().getTier(), machineDefinition.getTier()); + int machineTier = machineDefinition == null ? getDefinition().getTier() : + Math.min(getDefinition().getTier(), machineDefinition.getTier()); return Math.min(machineTier, GTUtil.getTierByVoltage(getMaxVoltage())); } @@ -193,27 +199,28 @@ public int getMaxOverclockTier() { @Nullable public static GTRecipe recipeModifier(MetaMachine machine, @NotNull GTRecipe recipe) { - if (machine instanceof ProcessingArrayMachine processingArray && processingArray.machineStorage.storage.getStackInSlot(0).getCount() > 0) { + if (machine instanceof ProcessingArrayMachine processingArray && + processingArray.machineStorage.storage.getStackInSlot(0).getCount() > 0) { if (RecipeHelper.getRecipeEUtTier(recipe) > processingArray.getTier()) return null; int parallelLimit = Math.min( - processingArray.machineStorage.storage.getStackInSlot(0).getCount(), - (int) (processingArray.getMaxVoltage() / RecipeHelper.getInputEUt(recipe)) - ); + processingArray.machineStorage.storage.getStackInSlot(0).getCount(), + (int) (processingArray.getMaxVoltage() / RecipeHelper.getInputEUt(recipe))); if (parallelLimit <= 0) return null; // apply parallel first var parallel = Objects.requireNonNull(GTRecipeModifiers.accurateParallel( - machine, recipe, Math.min(parallelLimit, getMachineLimit(machine.getDefinition().getTier())), false - )); + machine, recipe, Math.min(parallelLimit, getMachineLimit(machine.getDefinition().getTier())), + false)); int parallelCount = parallel.getSecond(); recipe = parallel.getFirst(); // apply overclock afterward - long maxVoltage = Math.min(processingArray.getOverclockVoltage() * parallelCount, processingArray.getMaxVoltage()); + long maxVoltage = Math.min(processingArray.getOverclockVoltage() * parallelCount, + processingArray.getMaxVoltage()); recipe = RecipeHelper.applyOverclock(OverclockingLogic.NON_PERFECT_OVERCLOCK, recipe, maxVoltage); return recipe; @@ -226,11 +233,12 @@ public Map, Integer> getOutputLimits() { if (getMachineDefinition() != null) { return getMachineDefinition().getRecipeOutputLimits(); } - return GTRegistries.RECIPE_CAPABILITIES.values().stream().map(key -> Map.entry(key, 0)).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); + return GTRegistries.RECIPE_CAPABILITIES.values().stream().map(key -> Map.entry(key, 0)) + .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); } ////////////////////////////////////// - //******** Gui ********// + // ******** Gui ********// ////////////////////////////////////// @Override @@ -238,23 +246,24 @@ public void addDisplayText(List textList) { textList.add(Component.translatable("gtceu.universal.tooltip.deprecated")); super.addDisplayText(textList); if (isActive()) { - textList.add(Component.translatable("gtceu.machine.machine_hatch.locked").withStyle(Style.EMPTY.withColor(ChatFormatting.RED))); + textList.add(Component.translatable("gtceu.machine.machine_hatch.locked") + .withStyle(Style.EMPTY.withColor(ChatFormatting.RED))); } } @Override public Widget createUIWidget() { - var widget = super.createUIWidget(); + var widget = super.createUIWidget(); if (widget instanceof WidgetGroup group) { var size = group.getSize(); group.addWidget(new SlotWidget(machineStorage.storage, 0, size.width - 30, size.height - 30, true, true) - .setBackground(GuiTextures.SLOT)); + .setBackground(GuiTextures.SLOT)); } return widget; } ////////////////////////////////////// - //******** Structure ********// + // ******** Structure ********// ////////////////////////////////////// public static Block getCasingState(int tier) { if (tier <= GTValues.IV) { @@ -267,5 +276,4 @@ public static Block getCasingState(int tier) { public static int getMachineLimit(Integer tier) { return tier <= GTValues.IV ? 16 : 64; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/research/DataBankMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/research/DataBankMachine.java index 9e4ac4460e..60bf7592ba 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/research/DataBankMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/research/DataBankMachine.java @@ -5,10 +5,6 @@ import com.gregtechceu.gtceu.api.capability.IEnergyContainer; import com.gregtechceu.gtceu.api.capability.recipe.EURecipeCapability; import com.gregtechceu.gtceu.api.capability.recipe.IO; -import com.gregtechceu.gtceu.api.gui.GuiTextures; -import com.gregtechceu.gtceu.api.gui.fancy.FancyMachineUIWidget; -import com.gregtechceu.gtceu.api.gui.fancy.IFancyUIProvider; -import com.gregtechceu.gtceu.api.gui.fancy.TooltipsPanel; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; import com.gregtechceu.gtceu.api.machine.TickableSubscription; import com.gregtechceu.gtceu.api.machine.feature.IFancyUIMachine; @@ -21,27 +17,29 @@ import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; import com.gregtechceu.gtceu.api.misc.EnergyContainerList; import com.gregtechceu.gtceu.config.ConfigHolder; -import com.lowdragmc.lowdraglib.gui.modular.ModularUI; + import com.lowdragmc.lowdraglib.gui.widget.*; -import it.unimi.dsi.fastutil.longs.Long2ObjectMaps; -import lombok.Getter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.network.chat.Component; import net.minecraft.server.TickTask; import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.block.Block; + +import it.unimi.dsi.fastutil.longs.Long2ObjectMaps; +import lombok.Getter; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.ArrayList; import java.util.List; import java.util.Map; -import java.util.Objects; + +import javax.annotation.ParametersAreNonnullByDefault; @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault -public class DataBankMachine extends WorkableElectricMultiblockMachine implements IFancyUIMachine, IDisplayUIMachine, IControllable { +public class DataBankMachine extends WorkableElectricMultiblockMachine + implements IFancyUIMachine, IDisplayUIMachine, IControllable { public static final int EUT_PER_HATCH = GTValues.VA[GTValues.EV]; public static final int EUT_PER_HATCH_CHAINED = GTValues.VA[GTValues.LuV]; @@ -70,11 +68,12 @@ public void onStructureFormed() { if (part instanceof IMaintenanceMachine maintenanceMachine) { this.maintenance = maintenanceMachine; } - if(io == IO.NONE || io == IO.OUT) continue; + if (io == IO.NONE || io == IO.OUT) continue; for (var handler : part.getRecipeHandlers()) { // If IO not compatible if (io != IO.BOTH && handler.getHandlerIO() != IO.BOTH && io != handler.getHandlerIO()) continue; - if (handler.getCapability() == EURecipeCapability.CAP && handler instanceof IEnergyContainer container) { + if (handler.getCapability() == EURecipeCapability.CAP && + handler instanceof IEnergyContainer container) { energyContainers.add(container); } } @@ -91,7 +90,7 @@ public void onStructureFormed() { serverLevel.getServer().tell(new TickTask(0, this::updateTickSubscription)); } } - + protected int calculateEnergyUsage() { int receivers = 0; int transmitters = 0; @@ -165,11 +164,13 @@ public void tick() { if (consumed == energyToConsume) { getRecipeLogic().setStatus(RecipeLogic.Status.WORKING); } else { - getRecipeLogic().setWaiting(Component.translatable("gtceu.recipe_logic.insufficient_in").append(": ").append(EURecipeCapability.CAP.getName())); + getRecipeLogic().setWaiting(Component.translatable("gtceu.recipe_logic.insufficient_in") + .append(": ").append(EURecipeCapability.CAP.getName())); } } } else { - getRecipeLogic().setWaiting(Component.translatable("gtceu.recipe_logic.insufficient_in").append(": ").append(EURecipeCapability.CAP.getName())); + getRecipeLogic().setWaiting(Component.translatable("gtceu.recipe_logic.insufficient_in").append(": ") + .append(EURecipeCapability.CAP.getName())); } updateTickSubscription(); } @@ -177,23 +178,23 @@ public void tick() { @Override public void addDisplayText(List textList) { MultiblockDisplayText.builder(textList, isFormed()) - .setWorkingStatus(true, isActive() && isWorkingEnabled()) // transform into two-state system for display - .setWorkingStatusKeys( - "gtceu.multiblock.idling", - "gtceu.multiblock.idling", - "gtceu.multiblock.data_bank.providing") - .addEnergyUsageExactLine(getEnergyUsage()) - .addWorkingStatusLine(); + .setWorkingStatus(true, isActive() && isWorkingEnabled()) // transform into two-state system for display + .setWorkingStatusKeys( + "gtceu.multiblock.idling", + "gtceu.multiblock.idling", + "gtceu.multiblock.data_bank.providing") + .addEnergyUsageExactLine(getEnergyUsage()) + .addWorkingStatusLine(); } /* - @Override - protected void addWarningText(List textList) { - MultiblockDisplayText.builder(textList, isFormed(), false) - .addLowPowerLine(hasNotEnoughEnergy) - .addMaintenanceProblemLines(maintenance.getMaintenanceProblems()); - } - */ + * @Override + * protected void addWarningText(List textList) { + * MultiblockDisplayText.builder(textList, isFormed(), false) + * .addLowPowerLine(hasNotEnoughEnergy) + * .addMaintenanceProblemLines(maintenance.getMaintenanceProblems()); + * } + */ @Override public int getProgress() { diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/research/HPCAMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/research/HPCAMachine.java index 991863342e..a0c343c9b2 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/research/HPCAMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/research/HPCAMachine.java @@ -23,6 +23,7 @@ import com.gregtechceu.gtceu.utils.FormattingUtil; import com.gregtechceu.gtceu.utils.GTTransferUtils; import com.gregtechceu.gtceu.utils.GTUtil; + import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.texture.ProgressTexture; import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; @@ -37,10 +38,7 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.FieldManagedStorage; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import it.unimi.dsi.fastutil.longs.Long2ObjectMaps; -import it.unimi.dsi.fastutil.objects.ObjectArrayList; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; -import lombok.Getter; + import net.minecraft.ChatFormatting; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; @@ -52,16 +50,23 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.material.Fluid; + +import it.unimi.dsi.fastutil.longs.Long2ObjectMaps; +import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; +import lombok.Getter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.*; import java.util.function.Supplier; +import javax.annotation.ParametersAreNonnullByDefault; + @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault -public class HPCAMachine extends WorkableElectricMultiblockMachine implements IOpticalComputationProvider, IControllable { +public class HPCAMachine extends WorkableElectricMultiblockMachine + implements IOpticalComputationProvider, IControllable { private static final double IDLE_TEMPERATURE = 200; private static final double DAMAGE_TEMPERATURE = 1000; @@ -69,7 +74,8 @@ public class HPCAMachine extends WorkableElectricMultiblockMachine implements IO private IMaintenanceMachine maintenance; private IEnergyContainer energyContainer; private IFluidTransfer coolantHandler; - @Persisted @DescSynced + @Persisted + @DescSynced private final HPCAGridHandler hpcaHandler; private boolean hasNotEnoughEnergy; @@ -104,15 +110,17 @@ public void onStructureFormed() { if (part instanceof IMaintenanceMachine maintenanceMachine) { this.maintenance = maintenanceMachine; } - if(io == IO.NONE || io == IO.OUT) continue; + if (io == IO.NONE || io == IO.OUT) continue; for (var handler : part.getRecipeHandlers()) { // If IO not compatible if (io != IO.BOTH && handler.getHandlerIO() != IO.BOTH && io != handler.getHandlerIO()) continue; - if (handler.getCapability() == EURecipeCapability.CAP && handler instanceof IEnergyContainer container) { + if (handler.getCapability() == EURecipeCapability.CAP && + handler instanceof IEnergyContainer container) { energyContainers.add(container); - } else if (handler.getCapability() == FluidRecipeCapability.CAP && handler instanceof IFluidTransfer fluidHandler) { - coolantContainers.add(fluidHandler); - } + } else if (handler.getCapability() == FluidRecipeCapability.CAP && + handler instanceof IFluidTransfer fluidHandler) { + coolantContainers.add(fluidHandler); + } } } this.energyContainer = new EnergyContainerList(energyContainers); @@ -182,7 +190,7 @@ public void tick() { // forcibly use active coolers at full rate if temperature is half-way to damaging temperature double midpoint = (DAMAGE_TEMPERATURE - IDLE_TEMPERATURE) / 2; double temperatureChange = hpcaHandler.calculateTemperatureChange(coolantHandler, temperature >= midpoint) / - 2.0; + 2.0; if (temperature + temperatureChange <= IDLE_TEMPERATURE) { temperature = IDLE_TEMPERATURE; } else { @@ -232,10 +240,10 @@ public Widget createUIWidget() { WidgetGroup builder = (WidgetGroup) super.createUIWidget(); // Create the hover grid builder.addWidget(new ExtendedProgressWidget( - () -> hpcaHandler.getAllocatedCWUt() > 0 ? progressSupplier.getAsDouble() : 0, - 74, 57, 47, 47, GuiTextures.HPCA_COMPONENT_OUTLINE) - .setServerTooltipSupplier(hpcaHandler::addInfo) - .setFillDirection(ProgressTexture.FillDirection.LEFT_TO_RIGHT)); + () -> hpcaHandler.getAllocatedCWUt() > 0 ? progressSupplier.getAsDouble() : 0, + 74, 57, 47, 47, GuiTextures.HPCA_COMPONENT_OUTLINE) + .setServerTooltipSupplier(hpcaHandler::addInfo) + .setFillDirection(ProgressTexture.FillDirection.LEFT_TO_RIGHT)); int startX = 76; int startY = 59; @@ -243,7 +251,8 @@ public Widget createUIWidget() { if (getLevel().isClientSide) { // TODO swap Direction.NORTH to getUpwardsFacing() when free multiblock rotation is added if (isFormed) { - hpcaHandler.tryGatherClientComponents(this.getLevel(), this.getPos(), this.getFrontFacing(), Direction.NORTH, false); + hpcaHandler.tryGatherClientComponents(this.getLevel(), this.getPos(), this.getFrontFacing(), + Direction.NORTH, false); } else { hpcaHandler.clearClientComponents(); } @@ -261,32 +270,32 @@ public Widget createUIWidget() { @Override public void addDisplayText(List textList) { MultiblockDisplayText.builder(textList, isFormed()) - .setWorkingStatus(true, hpcaHandler.getAllocatedCWUt() > 0) // transform into two-state system for - // display - .setWorkingStatusKeys( - "gtceu.multiblock.idling", - "gtceu.multiblock.idling", - "gtceu.multiblock.data_bank.providing") - .addCustom(tl -> { - if (isFormed()) { - // Energy Usage - tl.add(Component.translatable( - "gtceu.multiblock.hpca.energy", - FormattingUtil.formatNumbers(hpcaHandler.cachedEUt), - FormattingUtil.formatNumbers(hpcaHandler.getMaxEUt()), - GTValues.VNF[GTUtil.getTierByVoltage(hpcaHandler.getMaxEUt())]) - .withStyle(ChatFormatting.GRAY)); - - // Provided Computation - Component cwutInfo = Component.literal( - hpcaHandler.cachedCWUt + " / " + hpcaHandler.getMaxCWUt() + " CWU/t") - .withStyle(ChatFormatting.AQUA); - tl.add(Component.translatable( - "gtceu.multiblock.hpca.computation", - cwutInfo).withStyle(ChatFormatting.GRAY)); - } - }) - .addWorkingStatusLine(); + .setWorkingStatus(true, hpcaHandler.getAllocatedCWUt() > 0) // transform into two-state system for + // display + .setWorkingStatusKeys( + "gtceu.multiblock.idling", + "gtceu.multiblock.idling", + "gtceu.multiblock.data_bank.providing") + .addCustom(tl -> { + if (isFormed()) { + // Energy Usage + tl.add(Component.translatable( + "gtceu.multiblock.hpca.energy", + FormattingUtil.formatNumbers(hpcaHandler.cachedEUt), + FormattingUtil.formatNumbers(hpcaHandler.getMaxEUt()), + GTValues.VNF[GTUtil.getTierByVoltage(hpcaHandler.getMaxEUt())]) + .withStyle(ChatFormatting.GRAY)); + + // Provided Computation + Component cwutInfo = Component.literal( + hpcaHandler.cachedCWUt + " / " + hpcaHandler.getMaxCWUt() + " CWU/t") + .withStyle(ChatFormatting.AQUA); + tl.add(Component.translatable( + "gtceu.multiblock.hpca.computation", + cwutInfo).withStyle(ChatFormatting.GRAY)); + } + }) + .addWorkingStatusLine(); } private ChatFormatting getDisplayTemperatureColor() { @@ -299,67 +308,68 @@ private ChatFormatting getDisplayTemperatureColor() { } /* - @Override - protected void addWarningText(List textList) { - MultiblockDisplayText.builder(textList, isFormed(), false) - .addLowPowerLine(hasNotEnoughEnergy) - .addCustom(tl -> { - if (isStructureFormed()) { - if (temperature > 500) { - // Temperature warning - tl.add(TextComponentUtil.translationWithColor( - TextFormatting.YELLOW, - "gtceu.multiblock.hpca.warning_temperature")); - - // Active cooler overdrive warning - tl.add(TextComponentUtil.translationWithColor( - TextFormatting.GRAY, - "gtceu.multiblock.hpca.warning_temperature_active_cool")); - } - - // Structure warnings - hpcaHandler.addWarnings(tl); - } - }) - .addMaintenanceProblemLines(getMaintenanceProblems()); - } - - @Override - protected void addErrorText(List textList) { - super.addErrorText(textList); - if (isFormed()) { - if (temperature > 1000) { - textList.add(Component.translatable("gtceu.multiblock.hpca.error_temperature").withStyle(ChatFormatting.RED)); - } - hpcaHandler.addErrors(textList); - } - } - - @Override - public void addBarHoverText(List hoverList, int index) { - if (index == 0) { - Component cwutInfo = Component.literal( - hpcaHandler.cachedCWUt + " / " + hpcaHandler.getMaxCWUt() + " CWU/t").withStyle(ChatFormatting.AQUA); - hoverList.add(Component.translatable( - "gtceu.multiblock.hpca.computation", - cwutInfo).withStyle(ChatFormatting.GRAY)); - } else { - Component tempInfo = Component.literal(, - Math.round(temperature / 10.0D) + "°C").withStyle(getDisplayTemperatureColor()); - hoverList.add(TextComponentUtil.translationWithColor( - TextFormatting.GRAY, - "gtceu.multiblock.hpca.temperature", - tempInfo)); - } - } - */ + * @Override + * protected void addWarningText(List textList) { + * MultiblockDisplayText.builder(textList, isFormed(), false) + * .addLowPowerLine(hasNotEnoughEnergy) + * .addCustom(tl -> { + * if (isStructureFormed()) { + * if (temperature > 500) { + * // Temperature warning + * tl.add(TextComponentUtil.translationWithColor( + * TextFormatting.YELLOW, + * "gtceu.multiblock.hpca.warning_temperature")); + * + * // Active cooler overdrive warning + * tl.add(TextComponentUtil.translationWithColor( + * TextFormatting.GRAY, + * "gtceu.multiblock.hpca.warning_temperature_active_cool")); + * } + * + * // Structure warnings + * hpcaHandler.addWarnings(tl); + * } + * }) + * .addMaintenanceProblemLines(getMaintenanceProblems()); + * } + * + * @Override + * protected void addErrorText(List textList) { + * super.addErrorText(textList); + * if (isFormed()) { + * if (temperature > 1000) { + * textList.add(Component.translatable("gtceu.multiblock.hpca.error_temperature").withStyle(ChatFormatting.RED)); + * } + * hpcaHandler.addErrors(textList); + * } + * } + * + * @Override + * public void addBarHoverText(List hoverList, int index) { + * if (index == 0) { + * Component cwutInfo = Component.literal( + * hpcaHandler.cachedCWUt + " / " + hpcaHandler.getMaxCWUt() + " CWU/t").withStyle(ChatFormatting.AQUA); + * hoverList.add(Component.translatable( + * "gtceu.multiblock.hpca.computation", + * cwutInfo).withStyle(ChatFormatting.GRAY)); + * } else { + * Component tempInfo = Component.literal(, + * Math.round(temperature / 10.0D) + "°C").withStyle(getDisplayTemperatureColor()); + * hoverList.add(TextComponentUtil.translationWithColor( + * TextFormatting.GRAY, + * "gtceu.multiblock.hpca.temperature", + * tempInfo)); + * } + * } + */ // Handles the logic of this structure's specific HPCA component grid public static class HPCAGridHandler implements IManaged { + public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(HPCAGridHandler.class); @Getter private final FieldManagedStorage syncStorage = new FieldManagedStorage(this); - + @Nullable // for testing private final HPCAMachine controller; @@ -465,7 +475,8 @@ public double calculateTemperatureChange(IFluidTransfer coolantTank, boolean for } if (forceCoolWithActive || maxActiveCooling <= temperatureChange) { // try to fully utilize active coolers - FluidStack coolantStack = GTTransferUtils.drainFluidAccountNotifiableList(coolantTank, getCoolantStack(maxCoolantDrain), false); + FluidStack coolantStack = GTTransferUtils.drainFluidAccountNotifiableList(coolantTank, + getCoolantStack(maxCoolantDrain), false); if (!coolantStack.isEmpty()) { long coolantDrained = coolantStack.getAmount(); if (coolantDrained == maxCoolantDrain) { @@ -481,7 +492,8 @@ public double calculateTemperatureChange(IFluidTransfer coolantTank, boolean for // try to partially utilize active coolers to stabilize to zero double temperatureToDecrease = Math.min(temperatureChange, maxActiveCooling); long coolantToDrain = Math.max(1, (int) (maxCoolantDrain * (temperatureToDecrease / maxActiveCooling))); - FluidStack coolantStack = GTTransferUtils.drainFluidAccountNotifiableList(coolantTank, getCoolantStack(coolantToDrain), false); + FluidStack coolantStack = GTTransferUtils.drainFluidAccountNotifiableList(coolantTank, + getCoolantStack(coolantToDrain), false); if (!coolantStack.isEmpty()) { long coolantDrained = coolantStack.getAmount(); if (coolantDrained == coolantToDrain) { @@ -625,54 +637,68 @@ public int getMaxCoolantDemand() { public void addInfo(List textList) { // Max Computation MutableComponent data = Component.literal(Integer.toString(getMaxCWUt())).withStyle(ChatFormatting.AQUA); - textList.add(Component.translatable("gtceu.multiblock.hpca.info_max_computation", data).withStyle(ChatFormatting.GRAY)); + textList.add(Component.translatable("gtceu.multiblock.hpca.info_max_computation", data) + .withStyle(ChatFormatting.GRAY)); // Cooling - ChatFormatting coolingColor = getMaxCoolingAmount() < getMaxCoolingDemand() ? ChatFormatting.RED : ChatFormatting.GREEN; + ChatFormatting coolingColor = getMaxCoolingAmount() < getMaxCoolingDemand() ? ChatFormatting.RED : + ChatFormatting.GREEN; data = Component.literal(Integer.toString(getMaxCoolingDemand())).withStyle(coolingColor); - textList.add(Component.translatable("gtceu.multiblock.hpca.info_max_cooling_demand", data).withStyle(ChatFormatting.GRAY)); + textList.add(Component.translatable("gtceu.multiblock.hpca.info_max_cooling_demand", data) + .withStyle(ChatFormatting.GRAY)); data = Component.literal(Integer.toString(getMaxCoolingAmount())).withStyle(coolingColor); - textList.add(Component.translatable("gtceu.multiblock.hpca.info_max_cooling_available", data).withStyle(ChatFormatting.GRAY)); + textList.add(Component.translatable("gtceu.multiblock.hpca.info_max_cooling_available", data) + .withStyle(ChatFormatting.GRAY)); // Coolant Required if (getMaxCoolantDemand() > 0) { - data = Component.translatable("gtceu.universal.liters", getMaxCoolantDemand()).withStyle(ChatFormatting.YELLOW).append(" "); - Component coolantName = Component.translatable("gtceu.multiblock.hpca.info_coolant_name").withStyle(ChatFormatting.YELLOW); + data = Component.translatable("gtceu.universal.liters", getMaxCoolantDemand()) + .withStyle(ChatFormatting.YELLOW).append(" "); + Component coolantName = Component.translatable("gtceu.multiblock.hpca.info_coolant_name") + .withStyle(ChatFormatting.YELLOW); data.append(coolantName); } else { data = Component.literal("0").withStyle(ChatFormatting.GREEN); } - textList.add(Component.translatable("gtceu.multiblock.hpca.info_max_coolant_required", data).withStyle(ChatFormatting.GRAY)); + textList.add(Component.translatable("gtceu.multiblock.hpca.info_max_coolant_required", data) + .withStyle(ChatFormatting.GRAY)); // Bridging if (numBridges > 0) { - textList.add(Component.translatable("gtceu.multiblock.hpca.info_bridging_enabled").withStyle(ChatFormatting.GREEN)); + textList.add(Component.translatable("gtceu.multiblock.hpca.info_bridging_enabled") + .withStyle(ChatFormatting.GREEN)); } else { - textList.add(Component.translatable("gtceu.multiblock.hpca.info_bridging_disabled").withStyle(ChatFormatting.RED)); + textList.add(Component.translatable("gtceu.multiblock.hpca.info_bridging_disabled") + .withStyle(ChatFormatting.RED)); } } public void addWarnings(List textList) { List warnings = new ArrayList<>(); if (numBridges > 1) { - warnings.add(Component.translatable("gtceu.multiblock.hpca.warning_multiple_bridges").withStyle(ChatFormatting.GRAY)); + warnings.add(Component.translatable("gtceu.multiblock.hpca.warning_multiple_bridges") + .withStyle(ChatFormatting.GRAY)); } if (computationProviders.isEmpty()) { - warnings.add(Component.translatable("gtceu.multiblock.hpca.warning_no_computation").withStyle(ChatFormatting.GRAY)); + warnings.add(Component.translatable("gtceu.multiblock.hpca.warning_no_computation") + .withStyle(ChatFormatting.GRAY)); } if (getMaxCoolingDemand() > getMaxCoolingAmount()) { - warnings.add(Component.translatable("gtceu.multiblock.hpca.warning_low_cooling").withStyle(ChatFormatting.GRAY)); + warnings.add(Component.translatable("gtceu.multiblock.hpca.warning_low_cooling") + .withStyle(ChatFormatting.GRAY)); } if (!warnings.isEmpty()) { - textList.add(Component.translatable("gtceu.multiblock.hpca.warning_structure_header").withStyle(ChatFormatting.YELLOW)); + textList.add(Component.translatable("gtceu.multiblock.hpca.warning_structure_header") + .withStyle(ChatFormatting.YELLOW)); textList.addAll(warnings); } } public void addErrors(List textList) { if (components.stream().anyMatch(IHPCAComponentHatch::isDamaged)) { - textList.add(Component.translatable("gtceu.multiblock.hpca.error_damaged").withStyle(ChatFormatting.RED)); + textList.add( + Component.translatable("gtceu.multiblock.hpca.error_damaged").withStyle(ChatFormatting.RED)); } } @@ -689,8 +715,8 @@ public void tryGatherClientComponents(Level world, BlockPos pos, Direction front if (components.isEmpty()) { BlockPos testPos = pos - .relative(frontFacing.getOpposite(), 3) - .relative(relativeUp, 3); + .relative(frontFacing.getOpposite(), 3) + .relative(relativeUp, 3); for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/research/NetworkSwitchMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/research/NetworkSwitchMachine.java index ddc6457ca5..f402658b8a 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/research/NetworkSwitchMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/research/NetworkSwitchMachine.java @@ -9,20 +9,23 @@ import com.gregtechceu.gtceu.api.machine.multiblock.MultiblockDisplayText; import com.gregtechceu.gtceu.api.machine.multiblock.PartAbility; import com.gregtechceu.gtceu.api.machine.trait.NotifiableComputationContainer; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; -import lombok.AccessLevel; -import lombok.Getter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.network.chat.Component; import net.minecraft.world.level.block.Block; + +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; +import lombok.AccessLevel; +import lombok.Getter; import org.jetbrains.annotations.NotNull; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Set; +import javax.annotation.ParametersAreNonnullByDefault; + @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault public class NetworkSwitchMachine extends DataBankMachine implements IOpticalComputationProvider { @@ -66,7 +69,8 @@ public void onStructureFormed() { transmitters.add(hatch); } } else if (part.getRecipeHandlers().stream().anyMatch(IOpticalComputationHatch.class::isInstance)) { - var hatch = part.getRecipeHandlers().stream().filter(IOpticalComputationHatch.class::isInstance).map(IOpticalComputationHatch.class::cast).findFirst().orElse(null); + var hatch = part.getRecipeHandlers().stream().filter(IOpticalComputationHatch.class::isInstance) + .map(IOpticalComputationHatch.class::cast).findFirst().orElse(null); if (hatch != null) { Block block = part.self().getBlockState().getBlock(); if (PartAbility.COMPUTATION_DATA_RECEPTION.isApplicable(block)) { @@ -114,28 +118,30 @@ public boolean canBridge(@NotNull Collection seen) @Override public void addDisplayText(List textList) { MultiblockDisplayText.builder(textList, isFormed()) - .setWorkingStatus(true, isActive() && isWorkingEnabled()) // transform into two-state system for display - .setWorkingStatusKeys( - "gtceu.multiblock.idling", - "gtceu.multiblock.idling", - "gtceu.multiblock.data_bank.providing") - .addEnergyUsageExactLine(getEnergyUsage()) - .addComputationUsageLine(computationHandler.getMaxCWUtForDisplay()) - .addWorkingStatusLine(); + .setWorkingStatus(true, isActive() && isWorkingEnabled()) // transform into two-state system for display + .setWorkingStatusKeys( + "gtceu.multiblock.idling", + "gtceu.multiblock.idling", + "gtceu.multiblock.data_bank.providing") + .addEnergyUsageExactLine(getEnergyUsage()) + .addComputationUsageLine(computationHandler.getMaxCWUtForDisplay()) + .addWorkingStatusLine(); } /* - @Override - protected void addWarningText(List textList) { - super.addWarningText(textList); - if (isFormed() && computationHandler.hasNonBridgingConnections()) { - textList.add(Component.translatable("gtceu.multiblock.computation.non_bridging.detailed").withStyle(ChatFormatting.YELLOW)); - } - } - */ + * @Override + * protected void addWarningText(List textList) { + * super.addWarningText(textList); + * if (isFormed() && computationHandler.hasNonBridgingConnections()) { + * textList.add(Component.translatable("gtceu.multiblock.computation.non_bridging.detailed").withStyle( + * ChatFormatting.YELLOW)); + * } + * } + */ /** Handles computation load across multiple receivers and to multiple transmitters. */ private static class MultipleComputationHandler extends NotifiableComputationContainer { + // providers in the NS provide distributable computation to the NS private final Set providers = new ObjectOpenHashSet<>(); // transmitters in the NS give computation to other multis diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/research/ResearchStationMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/research/ResearchStationMachine.java index aefa0c3a4f..5319754f5c 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/research/ResearchStationMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/research/ResearchStationMachine.java @@ -14,19 +14,23 @@ import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.GTRecipeType; -import lombok.Getter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.world.item.ItemStack; + +import lombok.Getter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.Collections; import java.util.Iterator; +import javax.annotation.ParametersAreNonnullByDefault; + @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault public class ResearchStationMachine extends WorkableElectricMultiblockMachine implements IOpticalComputationReceiver { + @Getter private IOpticalComputationProvider computationProvider; @Getter @@ -50,13 +54,15 @@ public ResearchStationRecipeLogic getRecipeLogic() { public void onStructureFormed() { super.onStructureFormed(); for (IMultiPart part : getParts()) { - IOpticalComputationProvider provider = part.self().holder.self().getCapability(GTCapability.CAPABILITY_COMPUTATION_PROVIDER).resolve().orElse(null); + IOpticalComputationProvider provider = part.self().holder.self() + .getCapability(GTCapability.CAPABILITY_COMPUTATION_PROVIDER).resolve().orElse(null); if (provider != null) { this.computationProvider = provider; } if (part instanceof IObjectHolder objectHolder) { this.objectHolder = objectHolder; - this.getCapabilitiesProxy().put(IO.IN, ItemRecipeCapability.CAP, Collections.singletonList(objectHolder.getAsHandler())); + this.getCapabilitiesProxy().put(IO.IN, ItemRecipeCapability.CAP, + Collections.singletonList(objectHolder.getAsHandler())); } } @@ -147,7 +153,8 @@ protected Iterator searchRecipe() { protected boolean checkMatchedRecipeAvailable(GTRecipe match) { var modified = machine.fullModifyRecipe(match); if (modified != null) { - if (!modified.inputs.containsKey(CWURecipeCapability.CAP) && !modified.tickInputs.containsKey(CWURecipeCapability.CAP)) { + if (!modified.inputs.containsKey(CWURecipeCapability.CAP) && + !modified.tickInputs.containsKey(CWURecipeCapability.CAP)) { return true; } // skip "can fit" checks, it can always fit @@ -213,7 +220,8 @@ public void onRecipeFinish() { ItemStack outputItem = ItemStack.EMPTY; if (lastRecipe.getOutputContents(ItemRecipeCapability.CAP).size() >= 1) { - outputItem = ItemRecipeCapability.CAP.of(getLastRecipe().getOutputContents(ItemRecipeCapability.CAP).get(0).content).getItems()[0]; + outputItem = ItemRecipeCapability.CAP + .of(getLastRecipe().getOutputContents(ItemRecipeCapability.CAP).get(0).content).getItems()[0]; } holder.setDataItem(outputItem); holder.setLocked(false); diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/generator/LargeCombustionEngineMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/generator/LargeCombustionEngineMachine.java index aaec491731..f9dd58c69f 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/generator/LargeCombustionEngineMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/generator/LargeCombustionEngineMachine.java @@ -17,21 +17,25 @@ import com.gregtechceu.gtceu.common.data.GTMaterials; import com.gregtechceu.gtceu.common.data.GTRecipeModifiers; import com.gregtechceu.gtceu.data.recipe.builder.GTRecipeBuilder; + import com.lowdragmc.lowdraglib.side.fluid.FluidHelper; import com.lowdragmc.lowdraglib.side.fluid.FluidStack; -import lombok.Getter; -import lombok.val; + import net.minecraft.ChatFormatting; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Style; +import lombok.Getter; +import lombok.val; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; + import java.util.List; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author KilaBash * @date 2023/7/9 @@ -40,8 +44,10 @@ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class LargeCombustionEngineMachine extends WorkableElectricMultiblockMachine implements ITieredMachine { + private static final FluidStack OXYGEN_STACK = GTMaterials.Oxygen.getFluid(20 * FluidHelper.getBucket() / 1000); - private static final FluidStack LIQUID_OXYGEN_STACK = GTMaterials.Oxygen.getFluid(FluidStorageKeys.LIQUID, 80 * FluidHelper.getBucket() / 1000); + private static final FluidStack LIQUID_OXYGEN_STACK = GTMaterials.Oxygen.getFluid(FluidStorageKeys.LIQUID, + 80 * FluidHelper.getBucket() / 1000); private static final FluidStack LUBRICANT_STACK = GTMaterials.Lubricant.getFluid(FluidHelper.getBucket() / 1000); @Getter @@ -60,7 +66,7 @@ private boolean isIntakesObstructed() { var centerPos = this.getPos().relative(facing); for (int x = -1; x < 2; x++) { for (int y = -1; y < 2; y++) { - //Skip the controller block itself + // Skip the controller block itself if (x == 0 && y == 0) continue; var blockPos = centerPos.offset(permuteXZ ? x : 0, y, permuteXZ ? 0 : x); @@ -81,7 +87,7 @@ public boolean isBoostAllowed() { } ////////////////////////////////////// - //****** Recipe Logic *******// + // ****** Recipe Logic *******// ////////////////////////////////////// @Override @@ -105,7 +111,8 @@ public static GTRecipe recipeModifier(MetaMachine machine, @NotNull GTRecipe rec if (machine instanceof LargeCombustionEngineMachine engineMachine) { var EUt = RecipeHelper.getOutputEUt(recipe); // has lubricant - if (EUt > 0 && engineMachine.getLubricantRecipe().matchRecipe(engineMachine).isSuccess() && !engineMachine.isIntakesObstructed()) { + if (EUt > 0 && engineMachine.getLubricantRecipe().matchRecipe(engineMachine).isSuccess() && + !engineMachine.isIntakesObstructed()) { var maxParallel = (int) (engineMachine.getOverclockVoltage() / EUt); // get maximum parallel var parallelResult = GTRecipeModifiers.fastParallel(engineMachine, recipe, maxParallel, false); if (engineMachine.isOxygenBoosted) { // boost production @@ -136,7 +143,8 @@ public boolean onWorking() { // check boost fluid if ((totalContinuousRunningTime == 1 || totalContinuousRunningTime % 20 == 0) && isBoostAllowed()) { var boosterRecipe = getBoostRecipe(); - this.isOxygenBoosted = boosterRecipe.matchRecipe(this).isSuccess() && boosterRecipe.handleRecipeIO(IO.IN, this); + this.isOxygenBoosted = boosterRecipe.matchRecipe(this).isSuccess() && + boosterRecipe.handleRecipeIO(IO.IN, this); } return value; } @@ -147,7 +155,7 @@ public boolean dampingWhenWaiting() { } ////////////////////////////////////// - //******* GUI ********// + // ******* GUI ********// ////////////////////////////////////// @Override @@ -159,14 +167,16 @@ public void addDisplayText(List textList) { if (isOxygenBoosted) { textList.add(Component.translatable("gtceu.multiblock.large_combustion_engine.oxygen_boosted")); } else { - textList.add(Component.translatable("gtceu.multiblock.large_combustion_engine.supply_oxygen_to_boost")); + textList.add(Component + .translatable("gtceu.multiblock.large_combustion_engine.supply_oxygen_to_boost")); } - } - else { + } else { if (isOxygenBoosted) { - textList.add(Component.translatable("gtceu.multiblock.large_combustion_engine.liquid_oxygen_boosted")); + textList.add(Component + .translatable("gtceu.multiblock.large_combustion_engine.liquid_oxygen_boosted")); } else { - textList.add(Component.translatable("gtceu.multiblock.large_combustion_engine.supply_liquid_oxygen_to_boost")); + textList.add(Component.translatable( + "gtceu.multiblock.large_combustion_engine.supply_liquid_oxygen_to_boost")); } } } else { @@ -180,7 +190,8 @@ public void attachTooltips(TooltipsPanel tooltipsPanel) { super.attachTooltips(tooltipsPanel); tooltipsPanel.attachTooltips(new IFancyTooltip.Basic( () -> GuiTextures.INDICATOR_NO_STEAM.get(false), - () -> List.of(Component.translatable("gtceu.multiblock.large_combustion_engine.obstructed").setStyle(Style.EMPTY.withColor(ChatFormatting.RED))), + () -> List.of(Component.translatable("gtceu.multiblock.large_combustion_engine.obstructed") + .setStyle(Style.EMPTY.withColor(ChatFormatting.RED))), this::isIntakesObstructed, () -> null)); } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/generator/LargeTurbineMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/generator/LargeTurbineMachine.java index 855211fc0a..03d42a737f 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/generator/LargeTurbineMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/generator/LargeTurbineMachine.java @@ -2,7 +2,6 @@ import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.capability.recipe.EURecipeCapability; -import com.gregtechceu.gtceu.api.capability.recipe.IO; import com.gregtechceu.gtceu.api.capability.recipe.RecipeCapability; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; import com.gregtechceu.gtceu.api.machine.MetaMachine; @@ -14,20 +13,22 @@ import com.gregtechceu.gtceu.api.recipe.RecipeHelper; import com.gregtechceu.gtceu.api.recipe.content.Content; import com.gregtechceu.gtceu.common.data.GTRecipeModifiers; -import com.gregtechceu.gtceu.common.machine.multiblock.part.EnergyHatchPartMachine; import com.gregtechceu.gtceu.utils.FormattingUtil; import com.gregtechceu.gtceu.utils.GTUtil; -import lombok.Getter; + import net.minecraft.ChatFormatting; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Style; +import lombok.Getter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; + import java.util.List; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author KilaBash * @date 2023/7/9 @@ -36,6 +37,7 @@ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class LargeTurbineMachine extends WorkableElectricMultiblockMachine implements ITieredMachine { + public static final int MIN_DURABILITY_TO_WARN = 10; private final int BASE_EU_OUTPUT; @@ -80,7 +82,7 @@ protected long boostProduction(long production) { } ////////////////////////////////////// - //****** Recipe Logic *******// + // ****** Recipe Logic *******// ////////////////////////////////////// @Nullable public static GTRecipe recipeModifier(MetaMachine machine, @NotNull GTRecipe recipe) { @@ -93,7 +95,7 @@ public static GTRecipe recipeModifier(MetaMachine machine, @NotNull GTRecipe rec if (rotorHolder == null || EUt <= 0) return null; - var turbineMaxVoltage = (int)turbineMachine.getOverclockVoltage(); + var turbineMaxVoltage = (int) turbineMachine.getOverclockVoltage(); if (turbineMachine.excessVoltage >= turbineMaxVoltage) { turbineMachine.excessVoltage -= turbineMaxVoltage; return null; @@ -101,10 +103,10 @@ public static GTRecipe recipeModifier(MetaMachine machine, @NotNull GTRecipe rec double holderEfficiency = rotorHolder.getTotalEfficiency() / 100.0; - //get the amount of parallel required to match the desired output voltage + // get the amount of parallel required to match the desired output voltage var maxParallel = (int) ((turbineMaxVoltage - turbineMachine.excessVoltage) / (EUt * holderEfficiency)); - //this is necessary to prevent over-consumption of fuel + // this is necessary to prevent over-consumption of fuel turbineMachine.excessVoltage += (int) (maxParallel * EUt * holderEfficiency - turbineMaxVoltage); var parallelResult = GTRecipeModifiers.fastParallel(turbineMachine, recipe, Math.max(1, maxParallel), false); recipe = parallelResult.getFirst() == recipe ? recipe.copy() : parallelResult.getFirst(); @@ -126,7 +128,7 @@ public boolean canVoidRecipeOutputs(RecipeCapability capability) { } ////////////////////////////////////// - //******* GUI ********// + // ******* GUI ********// ////////////////////////////////////// @Override @@ -136,26 +138,29 @@ public void addDisplayText(List textList) { var rotorHolder = getRotorHolder(); if (rotorHolder != null && rotorHolder.getRotorEfficiency() > 0) { - textList.add(Component.translatable("gtceu.multiblock.turbine.rotor_speed", FormattingUtil.formatNumbers(rotorHolder.getRotorSpeed()), FormattingUtil.formatNumbers(rotorHolder.getMaxRotorHolderSpeed()))); - textList.add(Component.translatable("gtceu.multiblock.turbine.efficiency", rotorHolder.getTotalEfficiency())); + textList.add(Component.translatable("gtceu.multiblock.turbine.rotor_speed", + FormattingUtil.formatNumbers(rotorHolder.getRotorSpeed()), + FormattingUtil.formatNumbers(rotorHolder.getMaxRotorHolderSpeed()))); + textList.add(Component.translatable("gtceu.multiblock.turbine.efficiency", + rotorHolder.getTotalEfficiency())); long maxProduction = getOverclockVoltage(); long currentProduction = isActive() ? boostProduction((int) maxProduction) : 0; String voltageName = GTValues.VNF[GTUtil.getTierByVoltage(currentProduction)]; if (isActive()) { - textList.add(3, Component.translatable("gtceu.multiblock.turbine.energy_per_tick", FormattingUtil.formatNumbers(currentProduction), voltageName)); + textList.add(3, Component.translatable("gtceu.multiblock.turbine.energy_per_tick", + FormattingUtil.formatNumbers(currentProduction), voltageName)); } int rotorDurability = rotorHolder.getRotorDurabilityPercent(); if (rotorDurability > MIN_DURABILITY_TO_WARN) { textList.add(Component.translatable("gtceu.multiblock.turbine.rotor_durability", rotorDurability)); } else { - textList.add(Component.translatable("gtceu.multiblock.turbine.rotor_durability", rotorDurability).setStyle(Style.EMPTY.withColor(ChatFormatting.RED))); + textList.add(Component.translatable("gtceu.multiblock.turbine.rotor_durability", rotorDurability) + .setStyle(Style.EMPTY.withColor(ChatFormatting.RED))); } } } } - - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/AutoMaintenanceHatchPartMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/AutoMaintenanceHatchPartMachine.java index 28379da01e..08e2990813 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/AutoMaintenanceHatchPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/AutoMaintenanceHatchPartMachine.java @@ -1,7 +1,7 @@ package com.gregtechceu.gtceu.common.machine.multiblock.part; -import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMaintenanceMachine; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; +import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMaintenanceMachine; import com.gregtechceu.gtceu.api.machine.multiblock.part.TieredPartMachine; public class AutoMaintenanceHatchPartMachine extends TieredPartMachine implements IMaintenanceMachine { @@ -11,8 +11,7 @@ public AutoMaintenanceHatchPartMachine(IMachineBlockEntity blockEntity) { } @Override - public void setTaped(boolean ignored) { - } + public void setTaped(boolean ignored) {} @Override public boolean isTaped() { @@ -35,9 +34,7 @@ public byte getMaintenanceProblems() { } @Override - public void setMaintenanceProblems(byte problems) { - - } + public void setMaintenanceProblems(byte problems) {} @Override public int getTimeActive() { @@ -45,8 +42,5 @@ public int getTimeActive() { } @Override - public void setTimeActive(int time) { - - } - + public void setTimeActive(int time) {} } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/CleaningMaintenanceHatchPartMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/CleaningMaintenanceHatchPartMachine.java index 40ff36372b..0258c429e9 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/CleaningMaintenanceHatchPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/CleaningMaintenanceHatchPartMachine.java @@ -1,23 +1,27 @@ package com.gregtechceu.gtceu.common.machine.multiblock.part; -import com.google.common.collect.ImmutableSet; import com.gregtechceu.gtceu.api.GTValues; +import com.gregtechceu.gtceu.api.capability.ICleanroomReceiver; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; import com.gregtechceu.gtceu.api.machine.feature.ICleanroomProvider; -import com.gregtechceu.gtceu.api.capability.ICleanroomReceiver; import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiController; import com.gregtechceu.gtceu.api.machine.multiblock.CleanroomType; import com.gregtechceu.gtceu.api.machine.multiblock.DummyCleanroom; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; + import net.minecraft.MethodsReturnNonnullByDefault; +import com.google.common.collect.ImmutableSet; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import org.jetbrains.annotations.NotNull; -import javax.annotation.ParametersAreNonnullByDefault; + import java.util.Set; +import javax.annotation.ParametersAreNonnullByDefault; + @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class CleaningMaintenanceHatchPartMachine extends AutoMaintenanceHatchPartMachine { + protected static final Set CLEANED_TYPES = new ObjectOpenHashSet<>(); static { @@ -69,5 +73,4 @@ public static void addCleanroomType(@NotNull CleanroomType type) { public static ImmutableSet getCleanroomTypes() { return ImmutableSet.copyOf(CLEANED_TYPES); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/CokeOvenHatch.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/CokeOvenHatch.java index 6c43b95491..3d25ef3bd4 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/CokeOvenHatch.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/CokeOvenHatch.java @@ -8,10 +8,12 @@ import com.gregtechceu.gtceu.api.machine.trait.FluidTankProxyTrait; import com.gregtechceu.gtceu.api.machine.trait.ItemHandlerProxyTrait; import com.gregtechceu.gtceu.common.machine.multiblock.primitive.CokeOvenMachine; + import com.lowdragmc.lowdraglib.side.fluid.FluidTransferHelper; import com.lowdragmc.lowdraglib.side.item.ItemTransferHelper; import com.lowdragmc.lowdraglib.syncdata.ISubscription; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -19,6 +21,7 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.block.Block; import net.minecraft.world.phys.BlockHitResult; + import org.jetbrains.annotations.Nullable; import javax.annotation.ParametersAreNonnullByDefault; @@ -31,7 +34,9 @@ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class CokeOvenHatch extends MultiblockPartMachine { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(CokeOvenHatch.class, MultiblockPartMachine.MANAGED_FIELD_HOLDER); + + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(CokeOvenHatch.class, + MultiblockPartMachine.MANAGED_FIELD_HOLDER); public final ItemHandlerProxyTrait inputInventory, outputInventory; public final FluidTankProxyTrait tank; @@ -40,7 +45,6 @@ public class CokeOvenHatch extends MultiblockPartMachine { @Nullable protected ISubscription outputInventorySubs, outputTankSubs; - public CokeOvenHatch(IMachineBlockEntity holder, Object... args) { super(holder); this.inputInventory = new ItemHandlerProxyTrait(this, IO.IN); @@ -49,7 +53,7 @@ public CokeOvenHatch(IMachineBlockEntity holder, Object... args) { } ////////////////////////////////////// - //***** Initialization ******// + // ***** Initialization ******// ////////////////////////////////////// @Override public ManagedFieldHolder getFieldHolder() { @@ -111,7 +115,7 @@ public boolean replacePartModelWhenFormed() { } ////////////////////////////////////// - //******** Auto IO *********// + // ******** Auto IO *********// ////////////////////////////////////// @Override @@ -127,8 +131,10 @@ public void onRotated(Direction oldFacing, Direction newFacing) { } protected void updateAutoIOSubscription() { - if ((!outputInventory.isEmpty() && ItemTransferHelper.getItemTransfer(getLevel(), getPos().relative(getFrontFacing()), getFrontFacing().getOpposite()) != null) || - (!tank.isEmpty() && FluidTransferHelper.getFluidTransfer(getLevel(), getPos().relative(getFrontFacing()), getFrontFacing().getOpposite()) != null)) { + if ((!outputInventory.isEmpty() && ItemTransferHelper.getItemTransfer(getLevel(), + getPos().relative(getFrontFacing()), getFrontFacing().getOpposite()) != null) || + (!tank.isEmpty() && FluidTransferHelper.getFluidTransfer(getLevel(), + getPos().relative(getFrontFacing()), getFrontFacing().getOpposite()) != null)) { autoIOSubs = subscribeServerTick(autoIOSubs, this::autoIO); } else if (autoIOSubs != null) { autoIOSubs.unsubscribe(); @@ -145,7 +151,7 @@ protected void autoIO() { } ////////////////////////////////////// - //********* GUI *********// + // ********* GUI *********// ////////////////////////////////////// @Override public boolean shouldOpenUI(Player player, InteractionHand hand, BlockHitResult hit) { diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/DataAccessHatchMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/DataAccessHatchMachine.java index 2e46caf5f7..17655fbed5 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/DataAccessHatchMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/DataAccessHatchMachine.java @@ -17,32 +17,39 @@ import com.gregtechceu.gtceu.common.item.PortableScannerBehavior; import com.gregtechceu.gtceu.common.machine.multiblock.electric.research.DataBankMachine; import com.gregtechceu.gtceu.common.recipe.ResearchCondition; -import com.gregtechceu.gtceu.utils.ResearchManager; import com.gregtechceu.gtceu.utils.ItemStackHashStrategy; +import com.gregtechceu.gtceu.utils.ResearchManager; + import com.lowdragmc.lowdraglib.gui.widget.SlotWidget; import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import com.mojang.datafixers.util.Pair; -import it.unimi.dsi.fastutil.objects.ObjectOpenCustomHashSet; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; -import lombok.Getter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.network.chat.Component; import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.phys.BlockHitResult; + +import com.mojang.datafixers.util.Pair; +import it.unimi.dsi.fastutil.objects.ObjectOpenCustomHashSet; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; +import lombok.Getter; import org.jetbrains.annotations.NotNull; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.*; +import javax.annotation.ParametersAreNonnullByDefault; + @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault -public class DataAccessHatchMachine extends TieredPartMachine implements IMachineModifyDrops, IDataAccessHatch, IDataInfoProvider { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(DataAccessHatchMachine.class, MultiblockPartMachine.MANAGED_FIELD_HOLDER); +public class DataAccessHatchMachine extends TieredPartMachine + implements IMachineModifyDrops, IDataAccessHatch, IDataInfoProvider { + + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( + DataAccessHatchMachine.class, MultiblockPartMachine.MANAGED_FIELD_HOLDER); private final Set recipes; @Getter @@ -70,10 +77,11 @@ public void onContentsChanged() { @NotNull @Override public ItemStack insertItem(int slot, @NotNull ItemStack stack, boolean simulate) { - var controller = DataAccessHatchMachine.this.getControllers().isEmpty() ? null : DataAccessHatchMachine.this.getControllers().get(0); + var controller = DataAccessHatchMachine.this.getControllers().isEmpty() ? null : + DataAccessHatchMachine.this.getControllers().get(0); boolean isDataBank = controller instanceof DataBankMachine; if (ResearchManager.isStackDataItem(stack, isDataBank) && - ResearchManager.hasResearchTag(stack)) { + ResearchManager.hasResearchTag(stack)) { return super.insertItem(slot, stack, simulate); } return stack; @@ -86,13 +94,13 @@ public Widget createUIWidget() { int rowSize = (int) Math.sqrt(getInventorySize()); int xOffset = 18 * rowSize / 2; WidgetGroup group = new WidgetGroup(0, 0, 18 * rowSize, 18 * rowSize); - + for (int y = 0; y < rowSize; y++) { for (int x = 0; x < rowSize; x++) { int index = y * rowSize + x; group.addWidget(new SlotWidget(importItems, index, - rowSize * 9 + x * 18 - xOffset, y * 18, true, true) - .setBackgroundTexture(GuiTextures.SLOT)); + rowSize * 9 + x * 18 - xOffset, y * 18, true, true) + .setBackgroundTexture(GuiTextures.SLOT)); } } return group; @@ -137,7 +145,8 @@ public boolean isRecipeAvailable(@NotNull GTRecipe recipe, @NotNull Collection getDataInfo(PortableScannerBehavior.DisplayMode mode) { - if (mode == PortableScannerBehavior.DisplayMode.SHOW_ALL || mode == PortableScannerBehavior.DisplayMode.SHOW_RECIPE_INFO) { + if (mode == PortableScannerBehavior.DisplayMode.SHOW_ALL || + mode == PortableScannerBehavior.DisplayMode.SHOW_RECIPE_INFO) { if (recipes.isEmpty()) return Collections.emptyList(); List list = new ArrayList<>(); @@ -146,7 +155,8 @@ public List getDataInfo(PortableScannerBehavior.DisplayMode mode) { list.add(Component.empty()); Collection itemsAdded = new ObjectOpenCustomHashSet<>(ItemStackHashStrategy.comparingAll()); for (GTRecipe recipe : recipes) { - ItemStack stack = ItemRecipeCapability.CAP.of(recipe.getOutputContents(ItemRecipeCapability.CAP).get(0).content).getItems()[0]; + ItemStack stack = ItemRecipeCapability.CAP + .of(recipe.getOutputContents(ItemRecipeCapability.CAP).get(0).content).getItems()[0]; if (!itemsAdded.contains(stack)) { itemsAdded.add(stack); list.add(Component.translatable("behavior.data_item.assemblyline.data", stack.getDisplayName())); diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/DiodePartMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/DiodePartMachine.java index 969ba66eff..2c1a80dd03 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/DiodePartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/DiodePartMachine.java @@ -5,9 +5,11 @@ import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; import com.gregtechceu.gtceu.api.machine.multiblock.part.TieredIOPartMachine; import com.gregtechceu.gtceu.api.machine.trait.NotifiableEnergyContainer; + import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.network.chat.Component; @@ -21,7 +23,9 @@ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class DiodePartMachine extends TieredIOPartMachine { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(DiodePartMachine.class, TieredIOPartMachine.MANAGED_FIELD_HOLDER); + + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(DiodePartMachine.class, + TieredIOPartMachine.MANAGED_FIELD_HOLDER); public static int MAX_AMPS = 16; @@ -36,7 +40,8 @@ public DiodePartMachine(IMachineBlockEntity holder, int tier) { long tierVoltage = GTValues.V[getTier()]; this.amps = 1; - this.energyContainer = new NotifiableEnergyContainer(this, tierVoltage * MAX_AMPS * 2, tierVoltage, MAX_AMPS, tierVoltage, MAX_AMPS); + this.energyContainer = new NotifiableEnergyContainer(this, tierVoltage * MAX_AMPS * 2, tierVoltage, MAX_AMPS, + tierVoltage, MAX_AMPS); reinitializeEnergyContainer(); } @@ -77,7 +82,8 @@ public boolean isFacingValid(Direction facing) { } @Override - protected InteractionResult onSoftMalletClick(Player playerIn, InteractionHand hand, Direction gridSide, BlockHitResult hitResult) { + protected InteractionResult onSoftMalletClick(Player playerIn, InteractionHand hand, Direction gridSide, + BlockHitResult hitResult) { if (getLevel().isClientSide) { scheduleRenderUpdate(); return InteractionResult.CONSUME; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/EnergyHatchPartMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/EnergyHatchPartMachine.java index 96f081126c..fc668b1721 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/EnergyHatchPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/EnergyHatchPartMachine.java @@ -1,21 +1,24 @@ package com.gregtechceu.gtceu.common.machine.multiblock.part; import com.gregtechceu.gtceu.api.GTValues; -import com.gregtechceu.gtceu.api.machine.feature.IExplosionMachine; -import com.gregtechceu.gtceu.api.machine.multiblock.part.TieredIOPartMachine; import com.gregtechceu.gtceu.api.capability.recipe.IO; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; import com.gregtechceu.gtceu.api.machine.TickableSubscription; +import com.gregtechceu.gtceu.api.machine.feature.IExplosionMachine; +import com.gregtechceu.gtceu.api.machine.multiblock.part.TieredIOPartMachine; import com.gregtechceu.gtceu.api.machine.trait.NotifiableEnergyContainer; import com.gregtechceu.gtceu.config.ConfigHolder; + import com.lowdragmc.lowdraglib.syncdata.ISubscription; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import lombok.Getter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.player.Player; import net.minecraft.world.phys.BlockHitResult; + +import lombok.Getter; import org.jetbrains.annotations.Nullable; import javax.annotation.ParametersAreNonnullByDefault; @@ -29,7 +32,8 @@ @MethodsReturnNonnullByDefault public class EnergyHatchPartMachine extends TieredIOPartMachine implements IExplosionMachine { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(EnergyHatchPartMachine.class, TieredIOPartMachine.MANAGED_FIELD_HOLDER); + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( + EnergyHatchPartMachine.class, TieredIOPartMachine.MANAGED_FIELD_HOLDER); @Persisted public final NotifiableEnergyContainer energyContainer; @@ -46,7 +50,7 @@ public EnergyHatchPartMachine(IMachineBlockEntity holder, int tier, IO io, int a } ////////////////////////////////////// - //***** Initialization ******// + // ***** Initialization ******// ////////////////////////////////////// @Override public ManagedFieldHolder getFieldHolder() { @@ -56,11 +60,13 @@ public ManagedFieldHolder getFieldHolder() { protected NotifiableEnergyContainer createEnergyContainer(Object... args) { NotifiableEnergyContainer container; if (io == IO.OUT) { - container = NotifiableEnergyContainer.emitterContainer(this, GTValues.V[tier] * 64L * amperage, GTValues.V[tier], amperage); + container = NotifiableEnergyContainer.emitterContainer(this, GTValues.V[tier] * 64L * amperage, + GTValues.V[tier], amperage); container.setSideOutputCondition(s -> s == getFrontFacing() && isWorkingEnabled()); container.setCapabilityValidator(s -> s == null || s == getFrontFacing()); } else { - container = NotifiableEnergyContainer.receiverContainer(this, GTValues.V[tier] * 16L * amperage, GTValues.V[tier], amperage); + container = NotifiableEnergyContainer.receiverContainer(this, GTValues.V[tier] * 16L * amperage, + GTValues.V[tier], amperage); container.setSideInputCondition(s -> s == getFrontFacing() && isWorkingEnabled()); container.setCapabilityValidator(s -> s == null || s == getFrontFacing()); } @@ -92,11 +98,12 @@ public void onUnload() { } ////////////////////////////////////// - //******** Explosion ********// + // ******** Explosion ********// ////////////////////////////////////// protected void updateExplosionSubscription() { - if (ConfigHolder.INSTANCE.machines.doTerrainExplosion && shouldWeatherOrTerrainExplosion() && energyContainer.getEnergyStored() > 0) { + if (ConfigHolder.INSTANCE.machines.doTerrainExplosion && shouldWeatherOrTerrainExplosion() && + energyContainer.getEnergyStored() > 0) { explosionSubs = subscribeServerTick(explosionSubs, this::checkExplosion); } else if (explosionSubs != null) { explosionSubs.unsubscribe(); @@ -109,9 +116,8 @@ protected void checkExplosion() { updateExplosionSubscription(); } - ////////////////////////////////////// - //********** Misc **********// + // ********** Misc **********// ////////////////////////////////////// @Override diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/FluidHatchPartMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/FluidHatchPartMachine.java index fdb72e5417..c5d45cbb4b 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/FluidHatchPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/FluidHatchPartMachine.java @@ -7,6 +7,7 @@ import com.gregtechceu.gtceu.api.machine.TickableSubscription; import com.gregtechceu.gtceu.api.machine.multiblock.part.TieredIOPartMachine; import com.gregtechceu.gtceu.api.machine.trait.NotifiableFluidTank; + import com.lowdragmc.lowdraglib.gui.widget.*; import com.lowdragmc.lowdraglib.side.fluid.FluidHelper; import com.lowdragmc.lowdraglib.side.fluid.FluidStack; @@ -14,6 +15,7 @@ import com.lowdragmc.lowdraglib.syncdata.ISubscription; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -21,6 +23,7 @@ import net.minecraft.server.TickTask; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.block.Block; + import org.jetbrains.annotations.Nullable; import javax.annotation.ParametersAreNonnullByDefault; @@ -34,7 +37,8 @@ @MethodsReturnNonnullByDefault public class FluidHatchPartMachine extends TieredIOPartMachine { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(FluidHatchPartMachine.class, TieredIOPartMachine.MANAGED_FIELD_HOLDER); + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(FluidHatchPartMachine.class, + TieredIOPartMachine.MANAGED_FIELD_HOLDER); public static final long INITIAL_TANK_CAPACITY_1X = 8 * FluidHelper.getBucket(); public static final long INITIAL_TANK_CAPACITY_4X = 2 * FluidHelper.getBucket(); @@ -50,14 +54,15 @@ public class FluidHatchPartMachine extends TieredIOPartMachine { // The `Object... args` parameter is necessary in case a superclass needs to pass any args along to createTank(). // We can't use fields here because those won't be available while createTank() is called. - public FluidHatchPartMachine(IMachineBlockEntity holder, int tier, IO io, long initialCapacity, int slots, Object... args) { + public FluidHatchPartMachine(IMachineBlockEntity holder, int tier, IO io, long initialCapacity, int slots, + Object... args) { super(holder, tier, io); this.slots = slots; this.tank = createTank(initialCapacity, slots, args); } ////////////////////////////////////// - //***** Initialization ******// + // ***** Initialization ******// ////////////////////////////////////// @Override public ManagedFieldHolder getFieldHolder() { @@ -91,7 +96,7 @@ public void onUnload() { } ////////////////////////////////////// - //******** Auto IO *********// + // ******** Auto IO *********// ////////////////////////////////////// @Override @@ -107,8 +112,9 @@ public void onRotated(Direction oldFacing, Direction newFacing) { } protected void updateTankSubscription() { - if (isWorkingEnabled() && ((io == IO.OUT && !tank.isEmpty()) || io == IO.IN) - && FluidTransferHelper.getFluidTransfer(getLevel(), getPos().relative(getFrontFacing()), getFrontFacing().getOpposite()) != null) { + if (isWorkingEnabled() && ((io == IO.OUT && !tank.isEmpty()) || io == IO.IN) && + FluidTransferHelper.getFluidTransfer(getLevel(), getPos().relative(getFrontFacing()), + getFrontFacing().getOpposite()) != null) { autoIOSubs = subscribeServerTick(autoIOSubs, this::autoIO); } else if (autoIOSubs != null) { autoIOSubs.unsubscribe(); @@ -121,7 +127,7 @@ protected void autoIO() { if (isWorkingEnabled()) { if (io == IO.OUT) { tank.exportToNearby(getFrontFacing()); - } else if (io == IO.IN){ + } else if (io == IO.IN) { tank.importFromNearby(getFrontFacing()); } } @@ -136,7 +142,7 @@ public void setWorkingEnabled(boolean workingEnabled) { } ////////////////////////////////////// - //********** GUI ***********// + // ********** GUI ***********// ////////////////////////////////////// @Override public Widget createUIWidget() { @@ -156,34 +162,34 @@ protected Widget createSingleSlotGUI() { if (this.io == IO.OUT) { // if this is an output hatch, assign tankWidget to the phantom widget displaying the locked fluid... group.addWidget(tankWidget = new PhantomFluidWidget(this.tank.getLockedFluid(), 0, 67, 40, 18, 18, - () -> this.tank.getLockedFluid().getFluid(), f -> { - if (!this.tank.getFluidInTank(0).isEmpty()) { - return; - } - if (f == null || f.isEmpty()) { - this.tank.setLocked(false); - } else { - FluidStack newFluid = f.copy(); - newFluid.setAmount(1); - this.tank.setLocked(true, newFluid); - } - }).setShowAmount(true).setDrawHoverTips(true).setBackground(GuiTextures.FLUID_SLOT)); + () -> this.tank.getLockedFluid().getFluid(), f -> { + if (!this.tank.getFluidInTank(0).isEmpty()) { + return; + } + if (f == null || f.isEmpty()) { + this.tank.setLocked(false); + } else { + FluidStack newFluid = f.copy(); + newFluid.setAmount(1); + this.tank.setLocked(true, newFluid); + } + }).setShowAmount(true).setDrawHoverTips(true).setBackground(GuiTextures.FLUID_SLOT)); group.addWidget(new ToggleButtonWidget(7, 40, 18, 18, GuiTextures.BUTTON_LOCK, this.tank::isLocked, this.tank::setLocked) .setTooltipText("gtceu.gui.fluid_lock.tooltip") .setShouldUseBaseBackground()) - // ...and add the actual tank widget separately. - .addWidget(new TankWidget(tank.getStorages()[0], 67, 22, 18, 18, true, io.support(IO.IN)) - .setShowAmount(true).setDrawHoverTips(true).setBackground(GuiTextures.FLUID_SLOT)); + // ...and add the actual tank widget separately. + .addWidget(new TankWidget(tank.getStorages()[0], 67, 22, 18, 18, true, io.support(IO.IN)) + .setShowAmount(true).setDrawHoverTips(true).setBackground(GuiTextures.FLUID_SLOT)); } else { group.addWidget(tankWidget = new TankWidget(tank.getStorages()[0], 67, 22, 18, 18, true, io.support(IO.IN)) .setShowAmount(true).setDrawHoverTips(true).setBackground(GuiTextures.FLUID_SLOT)); } group.addWidget(new LabelWidget(8, 8, "gtceu.gui.fluid_amount")) - .addWidget(new LabelWidget(8, 18, () -> getFluidAmountText(tankWidget))) - .addWidget(new LabelWidget(8, 28, () -> getFluidNameText(tankWidget).getString())); + .addWidget(new LabelWidget(8, 18, () -> getFluidAmountText(tankWidget))) + .addWidget(new LabelWidget(8, 28, () -> getFluidNameText(tankWidget).getString())); group.setBackground(GuiTextures.BACKGROUND_INVERSE); return group; @@ -230,7 +236,9 @@ protected Widget createMultiSlotGUI() { int index = 0; for (int y = 0; y < colSize; y++) { for (int x = 0; x < rowSize; x++) { - container.addWidget(new TankWidget(tank.getStorages()[index++], 4 + x * 18, 4 + y * 18, true, io.support(IO.IN)).setBackground(GuiTextures.FLUID_SLOT)); + container.addWidget( + new TankWidget(tank.getStorages()[index++], 4 + x * 18, 4 + y * 18, true, io.support(IO.IN)) + .setBackground(GuiTextures.FLUID_SLOT)); } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/ItemBusPartMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/ItemBusPartMachine.java index caecf8cebe..f9258c7b3f 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/ItemBusPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/ItemBusPartMachine.java @@ -13,6 +13,7 @@ import com.gregtechceu.gtceu.api.machine.trait.NotifiableItemStackHandler; import com.gregtechceu.gtceu.common.item.IntCircuitBehaviour; import com.gregtechceu.gtceu.config.ConfigHolder; + import com.lowdragmc.lowdraglib.gui.widget.SlotWidget; import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; @@ -21,22 +22,24 @@ import com.lowdragmc.lowdraglib.syncdata.ISubscription; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import lombok.Getter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; -import net.minecraft.network.chat.Component; import net.minecraft.server.TickTask; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.Block; + +import lombok.Getter; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.List; import java.util.Set; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author KilaBash * @date 2023/3/4 @@ -46,7 +49,8 @@ @MethodsReturnNonnullByDefault public class ItemBusPartMachine extends TieredIOPartMachine implements IDistinctPart, IMachineModifyDrops { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(ItemBusPartMachine.class, TieredIOPartMachine.MANAGED_FIELD_HOLDER); + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(ItemBusPartMachine.class, + TieredIOPartMachine.MANAGED_FIELD_HOLDER); @Getter @Persisted private final NotifiableItemStackHandler inventory; @@ -68,7 +72,7 @@ public ItemBusPartMachine(IMachineBlockEntity holder, int tier, IO io, Object... } ////////////////////////////////////// - //***** Initialization ******// + // ***** Initialization ******// ////////////////////////////////////// @Override public ManagedFieldHolder getFieldHolder() { @@ -86,7 +90,8 @@ protected NotifiableItemStackHandler createInventory(Object... args) { protected NotifiableItemStackHandler createCircuitItemHandler(Object... args) { if (args.length > 0 && args[0] instanceof IO io && io == IO.IN) { - return new NotifiableItemStackHandler(this, 1, IO.IN, IO.NONE).setFilter(IntCircuitBehaviour::isIntegratedCircuit); + return new NotifiableItemStackHandler(this, 1, IO.IN, IO.NONE) + .setFilter(IntCircuitBehaviour::isIntegratedCircuit); } else { return new NotifiableItemStackHandler(this, 0, IO.NONE); } @@ -142,7 +147,7 @@ public void setDistinct(boolean isDistinct) { } ////////////////////////////////////// - //******** Auto IO *********// + // ******** Auto IO *********// ////////////////////////////////////// @Override @@ -158,8 +163,9 @@ public void onRotated(Direction oldFacing, Direction newFacing) { } protected void updateInventorySubscription() { - if (isWorkingEnabled() && ((io == IO.OUT && !getInventory().isEmpty()) || io == IO.IN) - && ItemTransferHelper.getItemTransfer(getLevel(), getPos().relative(getFrontFacing()), getFrontFacing().getOpposite()) != null) { + if (isWorkingEnabled() && ((io == IO.OUT && !getInventory().isEmpty()) || io == IO.IN) && + ItemTransferHelper.getItemTransfer(getLevel(), getPos().relative(getFrontFacing()), + getFrontFacing().getOpposite()) != null) { autoIOSubs = subscribeServerTick(autoIOSubs, this::autoIO); } else if (autoIOSubs != null) { autoIOSubs.unsubscribe(); @@ -187,7 +193,7 @@ public void setWorkingEnabled(boolean workingEnabled) { } ////////////////////////////////////// - //********** GUI ***********// + // ********** GUI ***********// ////////////////////////////////////// public void attachConfigurators(ConfiguratorPanel configuratorPanel) { @@ -210,8 +216,10 @@ public Widget createUIWidget() { int index = 0; for (int y = 0; y < colSize; y++) { for (int x = 0; x < rowSize; x++) { - container.addWidget(new SlotWidget(getInventory().storage, index++, 4 + x * 18, 4 + y * 18, true, io.support(IO.IN)) - .setBackgroundTexture(GuiTextures.SLOT).setIngredientIO(this.io == IO.IN ? IngredientIO.INPUT : IngredientIO.OUTPUT)); + container.addWidget( + new SlotWidget(getInventory().storage, index++, 4 + x * 18, 4 + y * 18, true, io.support(IO.IN)) + .setBackgroundTexture(GuiTextures.SLOT) + .setIngredientIO(this.io == IO.IN ? IngredientIO.INPUT : IngredientIO.OUTPUT)); } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/KineticPartMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/KineticPartMachine.java index a177f68116..79f59a1b28 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/KineticPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/KineticPartMachine.java @@ -7,15 +7,18 @@ import com.gregtechceu.gtceu.api.machine.multiblock.part.TieredIOPartMachine; import com.gregtechceu.gtceu.common.machine.kinetic.IKineticMachine; import com.gregtechceu.gtceu.common.machine.trait.NotifiableStressTrait; + import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import lombok.Getter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.player.Player; import net.minecraft.world.phys.BlockHitResult; +import lombok.Getter; + import javax.annotation.ParametersAreNonnullByDefault; /** @@ -26,7 +29,9 @@ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class KineticPartMachine extends TieredIOPartMachine implements IKineticMachine { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(KineticPartMachine.class, TieredIOPartMachine.MANAGED_FIELD_HOLDER); + + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(KineticPartMachine.class, + TieredIOPartMachine.MANAGED_FIELD_HOLDER); @Getter @Persisted @@ -38,7 +43,7 @@ public KineticPartMachine(IMachineBlockEntity holder, int tier, IO io, Object... } ////////////////////////////////////// - //***** Initialization *****// + // ***** Initialization *****// ////////////////////////////////////// @Override public ManagedFieldHolder getFieldHolder() { @@ -91,7 +96,7 @@ public void setWorkingEnabled(boolean workingEnabled) { } ////////////////////////////////////// - //********* GUI *********// + // ********* GUI *********// ////////////////////////////////////// @Override public boolean shouldOpenUI(Player player, InteractionHand hand, BlockHitResult hit) { diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/LaserHatchPartMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/LaserHatchPartMachine.java index ed9947d91b..e1acd5cf67 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/LaserHatchPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/LaserHatchPartMachine.java @@ -1,40 +1,34 @@ package com.gregtechceu.gtceu.common.machine.multiblock.part; import com.gregtechceu.gtceu.api.GTValues; -import com.gregtechceu.gtceu.api.capability.GTCapabilityHelper; -import com.gregtechceu.gtceu.api.capability.ILaserContainer; import com.gregtechceu.gtceu.api.capability.recipe.IO; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; -import com.gregtechceu.gtceu.api.machine.MetaMachine; import com.gregtechceu.gtceu.api.machine.feature.IDataInfoProvider; -import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiController; -import com.gregtechceu.gtceu.api.machine.multiblock.part.MultiblockPartMachine; import com.gregtechceu.gtceu.api.machine.multiblock.part.TieredIOPartMachine; import com.gregtechceu.gtceu.api.machine.trait.NotifiableLaserContainer; import com.gregtechceu.gtceu.common.item.PortableScannerBehavior; -import com.gregtechceu.gtceu.common.machine.multiblock.electric.ActiveTransformerMachine; + import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import lombok.Setter; -import net.minecraft.core.Direction; + import net.minecraft.network.chat.Component; import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.player.Player; import net.minecraft.world.phys.BlockHitResult; -import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; + import java.util.ArrayList; -import java.util.Collection; import java.util.Collections; import java.util.List; -import java.util.function.Supplier; + +import javax.annotation.ParametersAreNonnullByDefault; @ParametersAreNonnullByDefault public class LaserHatchPartMachine extends TieredIOPartMachine implements IDataInfoProvider { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(LaserHatchPartMachine.class, TieredIOPartMachine.MANAGED_FIELD_HOLDER); + + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(LaserHatchPartMachine.class, + TieredIOPartMachine.MANAGED_FIELD_HOLDER); @Persisted private NotifiableLaserContainer buffer; @@ -42,10 +36,12 @@ public class LaserHatchPartMachine extends TieredIOPartMachine implements IDataI public LaserHatchPartMachine(IMachineBlockEntity holder, IO io, int tier, int amperage) { super(holder, tier, io); if (io == IO.OUT) { - this.buffer = NotifiableLaserContainer.emitterContainer(this, GTValues.V[tier] * 64L * amperage, GTValues.V[tier], amperage); + this.buffer = NotifiableLaserContainer.emitterContainer(this, GTValues.V[tier] * 64L * amperage, + GTValues.V[tier], amperage); this.buffer.setSideOutputCondition(s -> s == getFrontFacing()); } else { - this.buffer = NotifiableLaserContainer.receiverContainer(this, GTValues.V[tier] * 64L * amperage, GTValues.V[tier], amperage); + this.buffer = NotifiableLaserContainer.receiverContainer(this, GTValues.V[tier] * 64L * amperage, + GTValues.V[tier], amperage); this.buffer.setSideInputCondition(s -> s == getFrontFacing()); } } @@ -69,9 +65,10 @@ public ManagedFieldHolder getFieldHolder() { @NotNull @Override public List getDataInfo(PortableScannerBehavior.DisplayMode mode) { - if (mode == PortableScannerBehavior.DisplayMode.SHOW_ALL || mode == PortableScannerBehavior.DisplayMode.SHOW_ELECTRICAL_INFO) { + if (mode == PortableScannerBehavior.DisplayMode.SHOW_ALL || + mode == PortableScannerBehavior.DisplayMode.SHOW_ELECTRICAL_INFO) { return Collections.singletonList(Component.translatable( - String.format("%d/%d EU", buffer.getEnergyStored(), buffer.getEnergyCapacity()))); + String.format("%d/%d EU", buffer.getEnergyStored(), buffer.getEnergyCapacity()))); } return new ArrayList<>(); } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/MaintenanceHatchPartMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/MaintenanceHatchPartMachine.java index c4a1f26d70..04d29fe5f8 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/MaintenanceHatchPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/MaintenanceHatchPartMachine.java @@ -1,29 +1,28 @@ package com.gregtechceu.gtceu.common.machine.multiblock.part; -import com.gregtechceu.gtceu.api.GTValues; -import com.gregtechceu.gtceu.api.machine.TickableSubscription; -import com.gregtechceu.gtceu.api.machine.feature.IInteractedMachine; -import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMaintenanceMachine; import com.gregtechceu.gtceu.api.capability.recipe.IO; import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.api.item.tool.GTToolType; import com.gregtechceu.gtceu.api.item.tool.ToolHelper; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; +import com.gregtechceu.gtceu.api.machine.TickableSubscription; +import com.gregtechceu.gtceu.api.machine.feature.IInteractedMachine; import com.gregtechceu.gtceu.api.machine.feature.IMachineModifyDrops; +import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMaintenanceMachine; import com.gregtechceu.gtceu.api.machine.multiblock.part.MultiblockPartMachine; import com.gregtechceu.gtceu.api.machine.multiblock.part.TieredPartMachine; import com.gregtechceu.gtceu.api.machine.trait.NotifiableItemStackHandler; -import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; import com.gregtechceu.gtceu.common.data.GTItems; + import com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup; import com.lowdragmc.lowdraglib.gui.widget.*; import com.lowdragmc.lowdraglib.misc.ContainerTransfer; import com.lowdragmc.lowdraglib.side.item.IItemTransfer; 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 lombok.Getter; -import lombok.Setter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.network.chat.Component; @@ -37,9 +36,11 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.BlockHitResult; + +import lombok.Getter; +import lombok.Setter; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; import java.math.BigDecimal; import java.math.RoundingMode; import java.util.Arrays; @@ -47,10 +48,15 @@ import java.util.Objects; import java.util.function.Supplier; +import javax.annotation.ParametersAreNonnullByDefault; + @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault -public class MaintenanceHatchPartMachine extends TieredPartMachine implements IMachineModifyDrops, IMaintenanceMachine, IInteractedMachine { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(MaintenanceHatchPartMachine.class, MultiblockPartMachine.MANAGED_FIELD_HOLDER); +public class MaintenanceHatchPartMachine extends TieredPartMachine + implements IMachineModifyDrops, IMaintenanceMachine, IInteractedMachine { + + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( + MaintenanceHatchPartMachine.class, MultiblockPartMachine.MANAGED_FIELD_HOLDER); private static final float MAX_DURATION_MULTIPLIER = 1.1f; private static final float MIN_DURATION_MULTIPLIER = 0.9f; private static final float DURATION_ACTION_AMOUNT = 0.01f; @@ -59,18 +65,26 @@ public class MaintenanceHatchPartMachine extends TieredPartMachine implements IM private final boolean isConfigurable; @Persisted private final NotifiableItemStackHandler itemStackHandler; - @Getter @Setter @Persisted @DescSynced @RequireRerender + @Getter + @Setter + @Persisted + @DescSynced + @RequireRerender private boolean isTaped; - @Getter @Setter @Persisted + @Getter + @Setter + @Persisted protected int timeActive; - @Getter @Persisted @DescSynced + @Getter + @Persisted + @DescSynced protected byte maintenanceProblems = startProblems(); - @Getter @Persisted + @Getter + @Persisted private float durationMultiplier = 1f; @Nullable protected TickableSubscription maintenanceSubs; - public MaintenanceHatchPartMachine(IMachineBlockEntity metaTileEntityId, boolean isConfigurable) { super(metaTileEntityId, isConfigurable ? 3 : 1); this.isConfigurable = isConfigurable; @@ -79,7 +93,7 @@ public MaintenanceHatchPartMachine(IMachineBlockEntity metaTileEntityId, boolean } ////////////////////////////////////// - //****** Initialization ******// + // ****** Initialization ******// ////////////////////////////////////// protected NotifiableItemStackHandler createInventory() { return new NotifiableItemStackHandler(this, 1, IO.BOTH, IO.IN); @@ -101,7 +115,7 @@ public byte startProblems() { } ////////////////////////////////////// - //********* Logic **********// + // ********* Logic **********// ////////////////////////////////////// @Override public void setMaintenanceProblems(byte problems) { @@ -141,6 +155,7 @@ public void update() { /** * Fixes the maintenance problems of this hatch's Multiblock Controller + * * @param entityPlayer the player performing the fixing */ private void fixMaintenanceProblems(@Nullable Player entityPlayer) { @@ -171,7 +186,7 @@ private void fixMaintenanceProblems(@Nullable Player entityPlayer) { * Handles duct taping for manual and auto-taping use * * @param handler is the handler to get duct tape from - * @param slot is the inventory slot to check for tape + * @param slot is the inventory slot to check for tape * @return true if tape was consumed, else false */ private boolean consumeDuctTape(IItemTransfer handler, int slot) { @@ -197,7 +212,7 @@ private boolean consumeDuctTape(Player player, InteractionHand hand) { * Attempts to fix a provided maintenance problem with a tool in the player's * inventory, if the tool exists. * - * @param problems Problem Flags + * @param problems Problem Flags * @param entityPlayer Target Player which their inventory would be scanned for tools to fix */ private void fixProblemsWithTools(byte problems, Player entityPlayer) { @@ -309,10 +324,11 @@ private void decInternalMultiplier() { } ////////////////////////////////////// - //******* INTERACTION *******// + // ******* INTERACTION *******// ////////////////////////////////////// @Override - public InteractionResult onUse(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { + public InteractionResult onUse(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, + BlockHitResult hit) { if (hasMaintenanceProblems()) { if (consumeDuctTape(player, hand)) { fixAllMaintenanceProblems(); @@ -324,7 +340,7 @@ public InteractionResult onUse(BlockState state, Level world, BlockPos pos, Play } ////////////////////////////////////// - //******** GUI *********// + // ******** GUI *********// ////////////////////////////////////// @Override public Widget createUIWidget() { @@ -369,9 +385,10 @@ private static Component getTextWidgetText(String type, Supplier multipli if (multiplier.get() == 1.0) { tooltip = Component.translatable("gtceu.maintenance.configurable_" + type + ".unchanged_description"); } else { - tooltip = Component.translatable("gtceu.maintenance.configurable_" + type + ".changed_description", multiplier.get()); + tooltip = Component.translatable("gtceu.maintenance.configurable_" + type + ".changed_description", + multiplier.get()); } - return Component.translatable("gtceu.maintenance.configurable_" + type, multiplier.get()).setStyle(Style.EMPTY.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, tooltip))); + return Component.translatable("gtceu.maintenance.configurable_" + type, multiplier.get()) + .setStyle(Style.EMPTY.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, tooltip))); } - -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/MufflerPartMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/MufflerPartMachine.java index 0bd5f49c11..df10d9f1be 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/MufflerPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/MufflerPartMachine.java @@ -1,15 +1,16 @@ package com.gregtechceu.gtceu.common.machine.multiblock.part; import com.gregtechceu.gtceu.api.GTValues; -import com.gregtechceu.gtceu.api.machine.feature.IUIMachine; -import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMufflerMachine; import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.api.gui.UITemplate; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; import com.gregtechceu.gtceu.api.machine.feature.IRecipeLogicMachine; +import com.gregtechceu.gtceu.api.machine.feature.IUIMachine; +import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMufflerMachine; import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiController; import com.gregtechceu.gtceu.api.machine.multiblock.part.MultiblockPartMachine; import com.gregtechceu.gtceu.api.machine.multiblock.part.TieredPartMachine; + import com.lowdragmc.lowdraglib.gui.modular.ModularUI; import com.lowdragmc.lowdraglib.gui.widget.LabelWidget; import com.lowdragmc.lowdraglib.gui.widget.SlotWidget; @@ -17,16 +18,19 @@ import com.lowdragmc.lowdraglib.side.item.ItemTransferHelper; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import lombok.Getter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import javax.annotation.ParametersAreNonnullByDefault; +import lombok.Getter; + import java.util.stream.IntStream; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author KilaBash * @date 2023/3/8 @@ -36,10 +40,12 @@ @MethodsReturnNonnullByDefault public class MufflerPartMachine extends TieredPartMachine implements IMufflerMachine, IUIMachine { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(MufflerPartMachine.class, MultiblockPartMachine.MANAGED_FIELD_HOLDER); + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(MufflerPartMachine.class, + MultiblockPartMachine.MANAGED_FIELD_HOLDER); @Getter private final int recoveryChance; - @Getter @Persisted + @Getter + @Persisted private final ItemStackTransfer inventory; public MufflerPartMachine(IMachineBlockEntity holder, int tier) { @@ -49,7 +55,7 @@ public MufflerPartMachine(IMachineBlockEntity holder, int tier) { } ////////////////////////////////////// - //***** Initialization ******// + // ***** Initialization ******// ////////////////////////////////////// @Override public ManagedFieldHolder getFieldHolder() { @@ -57,7 +63,7 @@ public ManagedFieldHolder getFieldHolder() { } ////////////////////////////////////// - //******** Muffler *********// + // ******** Muffler *********// ////////////////////////////////////// @Override @@ -79,7 +85,8 @@ private boolean calculateChance() { public void clientTick() { super.clientTick(); for (IMultiController controller : getControllers()) { - if (controller instanceof IRecipeLogicMachine recipeLogicMachine && recipeLogicMachine.getRecipeLogic().isWorking()) { + if (controller instanceof IRecipeLogicMachine recipeLogicMachine && + recipeLogicMachine.getRecipeLogic().isWorking()) { emitPollutionParticles(); break; } @@ -87,7 +94,7 @@ public void clientTick() { } ////////////////////////////////////// - //********** GUI ***********// + // ********** GUI ***********// ////////////////////////////////////// @Override public ModularUI createUI(Player entityPlayer) { @@ -97,7 +104,8 @@ public ModularUI createUI(Player entityPlayer) { 18 + 18 * rowSize + 94, this, entityPlayer) .background(GuiTextures.BACKGROUND) .widget(new LabelWidget(10, 5, getBlockState().getBlock().getDescriptionId())) - .widget(UITemplate.bindPlayerInventory(entityPlayer.getInventory(), GuiTextures.SLOT, 7 + xOffset, 18 + 18 * rowSize + 12, true)); + .widget(UITemplate.bindPlayerInventory(entityPlayer.getInventory(), GuiTextures.SLOT, 7 + xOffset, + 18 + 18 * rowSize + 12, true)); for (int y = 0; y < rowSize; y++) { for (int x = 0; x < rowSize; x++) { @@ -109,5 +117,4 @@ public ModularUI createUI(Player entityPlayer) { } return modular; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/ObjectHolderMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/ObjectHolderMachine.java index 88a32b9f05..31eb8c9781 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/ObjectHolderMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/ObjectHolderMachine.java @@ -12,8 +12,8 @@ import com.gregtechceu.gtceu.api.machine.feature.IMachineModifyDrops; import com.gregtechceu.gtceu.api.machine.multiblock.part.MultiblockPartMachine; import com.gregtechceu.gtceu.api.machine.trait.NotifiableItemStackHandler; + import com.lowdragmc.lowdraglib.gui.widget.ImageWidget; -import com.lowdragmc.lowdraglib.gui.widget.LabelWidget; import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.misc.ItemStackTransfer; @@ -21,27 +21,34 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; import com.lowdragmc.lowdraglib.utils.Position; -import lombok.Getter; -import lombok.Setter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; + +import lombok.Getter; +import lombok.Setter; import org.jetbrains.annotations.NotNull; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.List; +import javax.annotation.ParametersAreNonnullByDefault; + @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class ObjectHolderMachine extends MultiblockPartMachine implements IObjectHolder, IMachineModifyDrops { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(ObjectHolderMachine.class, MultiblockPartMachine.MANAGED_FIELD_HOLDER); + + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(ObjectHolderMachine.class, + MultiblockPartMachine.MANAGED_FIELD_HOLDER); // purposefully not exposed to automation or capabilities @Persisted private final ObjectHolderHandler heldItems; - @Getter @Setter - @Persisted @DescSynced + @Getter + @Setter + @Persisted + @DescSynced private boolean isLocked; public ObjectHolderMachine(IMachineBlockEntity holder) { @@ -120,6 +127,7 @@ private class ObjectHolderHandler extends NotifiableItemStackHandler { public ObjectHolderHandler(MetaMachine metaTileEntity) { super(metaTileEntity, 2, IO.IN, IO.BOTH, size -> new ItemStackTransfer(size) { + @Override public int getSlotLimit(int slot) { return 1; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/OpticalComputationHatchMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/OpticalComputationHatchMachine.java index c65c115db9..ebd6f03658 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/OpticalComputationHatchMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/OpticalComputationHatchMachine.java @@ -1,26 +1,18 @@ package com.gregtechceu.gtceu.common.machine.multiblock.part; -import com.gregtechceu.gtceu.GTCEu; -import com.gregtechceu.gtceu.api.capability.IOpticalComputationHatch; -import com.gregtechceu.gtceu.api.capability.IOpticalComputationProvider; -import com.gregtechceu.gtceu.api.capability.forge.GTCapability; import com.gregtechceu.gtceu.api.capability.recipe.IO; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; -import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiController; import com.gregtechceu.gtceu.api.machine.multiblock.part.MultiblockPartMachine; import com.gregtechceu.gtceu.api.machine.trait.NotifiableComputationContainer; -import com.gregtechceu.gtceu.common.blockentity.OpticalPipeBlockEntity; -import lombok.Getter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.phys.BlockHitResult; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; + +import lombok.Getter; import javax.annotation.ParametersAreNonnullByDefault; -import java.util.Collection; @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/OpticalDataHatchMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/OpticalDataHatchMachine.java index a96aae70b2..8f9719c6b0 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/OpticalDataHatchMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/OpticalDataHatchMachine.java @@ -10,20 +10,23 @@ import com.gregtechceu.gtceu.api.machine.multiblock.part.MultiblockPartMachine; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.common.blockentity.OpticalPipeBlockEntity; -import lombok.Getter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.phys.BlockHitResult; + +import lombok.Getter; import org.jetbrains.annotations.NotNull; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.ArrayList; import java.util.Collection; import java.util.List; +import javax.annotation.ParametersAreNonnullByDefault; + @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault public class OpticalDataHatchMachine extends MultiblockPartMachine implements IOpticalDataAccessHatch { @@ -51,22 +54,23 @@ public boolean isRecipeAvailable(@NotNull GTRecipe recipe, @NotNull Collection fluidStack.getFluid().is(GTMaterials.Water.getFluidTag())); + return super.createTank(initialCapacity, slots) + .setFilter(fluidStack -> fluidStack.getFluid().is(GTMaterials.Water.getFluidTag())); } @Override @@ -36,7 +39,8 @@ public ModularUI createUI(Player entityPlayer) { .background(GuiTextures.BACKGROUND) .widget(new ImageWidget(7, 16, 81, 55, GuiTextures.DISPLAY)) .widget(new LabelWidget(11, 20, "gtceu.gui.fluid_amount")) - .widget(new LabelWidget(11, 30, () -> String.valueOf(tank.getFluidInTank(0).getAmount())).setTextColor(-1).setDropShadow(true)) + .widget(new LabelWidget(11, 30, () -> String.valueOf(tank.getFluidInTank(0).getAmount())) + .setTextColor(-1).setDropShadow(true)) .widget(new LabelWidget(6, 6, getBlockState().getBlock().getDescriptionId())) .widget(new TankWidget(tank.getStorages()[0], 90, 35, true, io.support(IO.IN)) .setBackground(GuiTextures.FLUID_SLOT)) diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/RotorHolderPartMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/RotorHolderPartMachine.java index 2460361236..2ef829fbd8 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/RotorHolderPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/RotorHolderPartMachine.java @@ -1,7 +1,6 @@ package com.gregtechceu.gtceu.common.machine.multiblock.part; import com.gregtechceu.gtceu.api.capability.recipe.IO; -import com.gregtechceu.gtceu.api.data.chemical.material.properties.RotorProperty; import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; import com.gregtechceu.gtceu.api.machine.TickableSubscription; @@ -12,17 +11,17 @@ import com.gregtechceu.gtceu.api.machine.multiblock.part.TieredPartMachine; import com.gregtechceu.gtceu.api.machine.trait.NotifiableItemStackHandler; import com.gregtechceu.gtceu.common.data.GTDamageTypes; -import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; import com.gregtechceu.gtceu.common.item.TurbineRotorBehaviour; + import com.lowdragmc.lowdraglib.gui.widget.SlotWidget; import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.syncdata.ISubscription; 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 lombok.Getter; -import lombok.Setter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.world.InteractionHand; @@ -32,11 +31,15 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.BlockHitResult; + +import lombok.Getter; +import lombok.Setter; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.List; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author KilaBash * @date 2023/7/10 @@ -44,17 +47,26 @@ */ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault -public class RotorHolderPartMachine extends TieredPartMachine implements IMachineModifyDrops, IRotorHolderMachine, IInteractedMachine { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(RotorHolderPartMachine.class, TieredPartMachine.MANAGED_FIELD_HOLDER); +public class RotorHolderPartMachine extends TieredPartMachine + implements IMachineModifyDrops, IRotorHolderMachine, IInteractedMachine { + + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( + RotorHolderPartMachine.class, TieredPartMachine.MANAGED_FIELD_HOLDER); @Persisted public final NotifiableItemStackHandler inventory; @Getter public final int maxRotorHolderSpeed; - @Getter @Setter - @Persisted @DescSynced @RequireRerender + @Getter + @Setter + @Persisted + @DescSynced + @RequireRerender public int rotorSpeed; - @Setter @Persisted @DescSynced @RequireRerender + @Setter + @Persisted + @DescSynced + @RequireRerender public int rotorColor; // 0 - no rotor @Nullable protected TickableSubscription rotorSpeedSubs; @@ -68,7 +80,7 @@ public RotorHolderPartMachine(IMachineBlockEntity holder, int tier) { } ////////////////////////////////////// - //***** Initialization ******// + // ***** Initialization ******// ////////////////////////////////////// @Override public ManagedFieldHolder getFieldHolder() { @@ -106,7 +118,7 @@ public void onUnload() { } ////////////////////////////////////// - //****** Rotor Holder ******// + // ****** Rotor Holder ******// ////////////////////////////////////// private void onRotorInventoryChanged() { @@ -187,16 +199,19 @@ public void setRotorStack(ItemStack rotorStack) { inventory.setStackInSlot(0, rotorStack); inventory.onContentsChanged(); } - public InteractionResult onUse(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { + + public InteractionResult onUse(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, + BlockHitResult hit) { if (!isRemote() && getRotorSpeed() > 0 && !player.isCreative()) { - player.hurt(GTDamageTypes.TURBINE.source(level), TurbineRotorBehaviour.getBehaviour(getRotorStack()).getDamage(getRotorStack())); - return InteractionResult.FAIL; + player.hurt(GTDamageTypes.TURBINE.source(level), + TurbineRotorBehaviour.getBehaviour(getRotorStack()).getDamage(getRotorStack())); + return InteractionResult.FAIL; } return InteractionResult.PASS; } ////////////////////////////////////// - //********** GUI ***********// + // ********** GUI ***********// ////////////////////////////////////// @Override public Widget createUIWidget() { @@ -208,5 +223,4 @@ public Widget createUIWidget() { group.addWidget(container); return group; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/SteamHatchPartMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/SteamHatchPartMachine.java index d929521962..073045b5e0 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/SteamHatchPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/SteamHatchPartMachine.java @@ -5,15 +5,15 @@ import com.gregtechceu.gtceu.api.gui.UITemplate; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; import com.gregtechceu.gtceu.api.machine.trait.NotifiableFluidTank; -import com.gregtechceu.gtceu.api.recipe.ingredient.FluidIngredient; import com.gregtechceu.gtceu.common.data.GTMaterials; import com.gregtechceu.gtceu.config.ConfigHolder; -import com.gregtechceu.gtceu.data.recipe.CustomTags; + import com.lowdragmc.lowdraglib.gui.modular.ModularUI; import com.lowdragmc.lowdraglib.gui.widget.ImageWidget; import com.lowdragmc.lowdraglib.gui.widget.LabelWidget; import com.lowdragmc.lowdraglib.gui.widget.TankWidget; import com.lowdragmc.lowdraglib.side.fluid.FluidHelper; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.world.entity.player.Player; @@ -27,6 +27,7 @@ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class SteamHatchPartMachine extends FluidHatchPartMachine { + public static final long INITIAL_TANK_CAPACITY = 64 * FluidHelper.getBucket(); public static final boolean IS_STEEL = ConfigHolder.INSTANCE.machines.steelSteamMultiblocks; @@ -36,20 +37,22 @@ public SteamHatchPartMachine(IMachineBlockEntity holder, Object... args) { @Override protected NotifiableFluidTank createTank(long initialCapacity, int slots, Object... args) { - return super.createTank(initialCapacity, slots).setFilter(fluidStack -> fluidStack.getFluid().is(GTMaterials.Steam.getFluidTag())); + return super.createTank(initialCapacity, slots) + .setFilter(fluidStack -> fluidStack.getFluid().is(GTMaterials.Steam.getFluidTag())); } - @Override public ModularUI createUI(Player entityPlayer) { return new ModularUI(176, 166, this, entityPlayer) .background(GuiTextures.BACKGROUND_STEAM.get(IS_STEEL)) .widget(new ImageWidget(7, 16, 81, 55, GuiTextures.DISPLAY_STEAM.get(IS_STEEL))) .widget(new LabelWidget(11, 20, "gtceu.gui.fluid_amount")) - .widget(new LabelWidget(11, 30, () -> tank.getFluidInTank(0).getAmount() + "").setTextColor(-1).setDropShadow(true)) + .widget(new LabelWidget(11, 30, () -> tank.getFluidInTank(0).getAmount() + "").setTextColor(-1) + .setDropShadow(true)) .widget(new LabelWidget(6, 6, getBlockState().getBlock().getDescriptionId())) .widget(new TankWidget(tank.getStorages()[0], 90, 35, true, true) .setBackground(GuiTextures.FLUID_SLOT)) - .widget(UITemplate.bindPlayerInventory(entityPlayer.getInventory(), GuiTextures.SLOT_STEAM.get(IS_STEEL), 7, 84, true)); + .widget(UITemplate.bindPlayerInventory(entityPlayer.getInventory(), + GuiTextures.SLOT_STEAM.get(IS_STEEL), 7, 84, true)); } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/SteamItemBusPartMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/SteamItemBusPartMachine.java index e617fddbd4..fd763a9b7c 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/SteamItemBusPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/SteamItemBusPartMachine.java @@ -6,9 +6,11 @@ import com.gregtechceu.gtceu.api.gui.widget.ToggleButtonWidget; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; import com.gregtechceu.gtceu.config.ConfigHolder; + import com.lowdragmc.lowdraglib.gui.modular.ModularUI; import com.lowdragmc.lowdraglib.gui.widget.LabelWidget; import com.lowdragmc.lowdraglib.gui.widget.SlotWidget; + import net.minecraft.world.entity.player.Player; import org.jetbrains.annotations.NotNull; @@ -29,10 +31,12 @@ public ModularUI createUI(@NotNull Player entityPlayer) { .background(GuiTextures.BACKGROUND_STEAM.get(ConfigHolder.INSTANCE.machines.steelSteamMultiblocks)) .widget(new LabelWidget(10, 5, getBlockState().getBlock().getDescriptionId())) .widget(new ToggleButtonWidget(2, 18 + 18 * rowSize + 12 - 20, 18, 18, - GuiTextures.BUTTON_ITEM_OUTPUT, this::isWorkingEnabled, this::setWorkingEnabled) // todo steamify? + GuiTextures.BUTTON_ITEM_OUTPUT, this::isWorkingEnabled, this::setWorkingEnabled) // todo + // steamify? .setShouldUseBaseBackground() .setTooltipText("gtceu.gui.item_auto_input.tooltip")) - .widget(UITemplate.bindPlayerInventory(entityPlayer.getInventory(), GuiTextures.SLOT_STEAM.get(ConfigHolder.INSTANCE.machines.steelSteamMultiblocks), + .widget(UITemplate.bindPlayerInventory(entityPlayer.getInventory(), + GuiTextures.SLOT_STEAM.get(ConfigHolder.INSTANCE.machines.steelSteamMultiblocks), 7 + xOffset, 18 + 18 * rowSize + 12, true)); for (int y = 0; y < rowSize; y++) { diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/TankValvePartMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/TankValvePartMachine.java index 67986ab361..1ab8b25aea 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/TankValvePartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/TankValvePartMachine.java @@ -7,13 +7,16 @@ import com.gregtechceu.gtceu.api.machine.multiblock.part.MultiblockPartMachine; import com.gregtechceu.gtceu.api.machine.trait.FluidTankProxyTrait; import com.gregtechceu.gtceu.common.machine.multiblock.electric.MultiblockTankMachine; + import com.lowdragmc.lowdraglib.side.fluid.FluidTransferHelper; import com.lowdragmc.lowdraglib.side.fluid.IFluidTransfer; import com.lowdragmc.lowdraglib.syncdata.ISubscription; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.level.block.Block; + import org.jetbrains.annotations.Nullable; import javax.annotation.ParametersAreNonnullByDefault; @@ -21,6 +24,7 @@ @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault public class TankValvePartMachine extends MultiblockPartMachine { + private FluidTankProxyTrait tankProxy; private ConditionalSubscriptionHandler autoIOSubscription; private ISubscription tankChangeListener; @@ -87,7 +91,8 @@ public void onNeighborChanged(Block block, BlockPos fromPos, boolean isMoving) { @Nullable private IFluidTransfer getTargetTank() { - return FluidTransferHelper.getFluidTransfer(getLevel(), getPos().relative(getFrontFacing()), getFrontFacing().getOpposite()); + return FluidTransferHelper.getFluidTransfer(getLevel(), getPos().relative(getFrontFacing()), + getFrontFacing().getOpposite()); } private void autoIO() { diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/hpca/HPCABridgePartMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/hpca/HPCABridgePartMachine.java index 9c2a23a834..2578adca2f 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/hpca/HPCABridgePartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/hpca/HPCABridgePartMachine.java @@ -3,9 +3,10 @@ import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; + import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; + import net.minecraft.MethodsReturnNonnullByDefault; -import net.minecraft.resources.ResourceLocation; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/hpca/HPCAComponentPartMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/hpca/HPCAComponentPartMachine.java index 6cae3e1227..6e3b355f01 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/hpca/HPCAComponentPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/hpca/HPCAComponentPartMachine.java @@ -5,25 +5,33 @@ import com.gregtechceu.gtceu.api.machine.feature.IMachineModifyDrops; import com.gregtechceu.gtceu.api.machine.multiblock.part.MultiblockPartMachine; import com.gregtechceu.gtceu.common.data.GTBlocks; + 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 net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.phys.BlockHitResult; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.List; +import javax.annotation.ParametersAreNonnullByDefault; + @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault -public abstract class HPCAComponentPartMachine extends MultiblockPartMachine implements IHPCAComponentHatch, IMachineModifyDrops { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(HPCAComponentPartMachine.class, MultiblockPartMachine.MANAGED_FIELD_HOLDER); +public abstract class HPCAComponentPartMachine extends MultiblockPartMachine + implements IHPCAComponentHatch, IMachineModifyDrops { - @Persisted @DescSynced @RequireRerender + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( + HPCAComponentPartMachine.class, MultiblockPartMachine.MANAGED_FIELD_HOLDER); + + @Persisted + @DescSynced + @RequireRerender private boolean damaged; public HPCAComponentPartMachine(IMachineBlockEntity holder) { @@ -93,15 +101,18 @@ public void onDrops(List drops, Player entity) { } } } -/* // TODO add some way to show a custom display name for machines - @Override - public String getMetaName() { - if (canBeDamaged() && isDamaged()) { - return super.getMetaName() + ".damaged"; - } - return super.getMetaName(); - } -*/ + + /* + * // TODO add some way to show a custom display name for machines + * + * @Override + * public String getMetaName() { + * if (canBeDamaged() && isDamaged()) { + * return super.getMetaName() + ".damaged"; + * } + * return super.getMetaName(); + * } + */ @Override public ManagedFieldHolder getFieldHolder() { return MANAGED_FIELD_HOLDER; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/hpca/HPCAComputationPartMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/hpca/HPCAComputationPartMachine.java index e45d7f5de7..69bb815771 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/hpca/HPCAComputationPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/hpca/HPCAComputationPartMachine.java @@ -4,10 +4,12 @@ import com.gregtechceu.gtceu.api.capability.IHPCAComputationProvider; import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; + import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; -import lombok.Getter; + import net.minecraft.MethodsReturnNonnullByDefault; -import net.minecraft.resources.ResourceLocation; + +import lombok.Getter; import javax.annotation.ParametersAreNonnullByDefault; @@ -27,10 +29,10 @@ public HPCAComputationPartMachine(IMachineBlockEntity holder, boolean advanced) public ResourceTexture getComponentIcon() { if (isDamaged()) { return advanced ? GuiTextures.HPCA_ICON_DAMAGED_ADVANCED_COMPUTATION_COMPONENT : - GuiTextures.HPCA_ICON_DAMAGED_COMPUTATION_COMPONENT; + GuiTextures.HPCA_ICON_DAMAGED_COMPUTATION_COMPONENT; } return advanced ? GuiTextures.HPCA_ICON_ADVANCED_COMPUTATION_COMPONENT : - GuiTextures.HPCA_ICON_COMPUTATION_COMPONENT; + GuiTextures.HPCA_ICON_COMPUTATION_COMPONENT; } @Override diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/hpca/HPCACoolerPartMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/hpca/HPCACoolerPartMachine.java index 1f63ac2359..007095b2eb 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/hpca/HPCACoolerPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/hpca/HPCACoolerPartMachine.java @@ -4,10 +4,12 @@ import com.gregtechceu.gtceu.api.capability.IHPCACoolantProvider; import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; + import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; -import lombok.Getter; + import net.minecraft.MethodsReturnNonnullByDefault; -import net.minecraft.resources.ResourceLocation; + +import lombok.Getter; import javax.annotation.ParametersAreNonnullByDefault; @@ -52,4 +54,4 @@ public boolean isActiveCooler() { public int getMaxCoolantPerTick() { return advanced ? 8 : 0; } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/hpca/HPCAEmptyPartMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/hpca/HPCAEmptyPartMachine.java index df14f6dd0c..132929c7b9 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/hpca/HPCAEmptyPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/hpca/HPCAEmptyPartMachine.java @@ -2,9 +2,10 @@ import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; + import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; + import net.minecraft.MethodsReturnNonnullByDefault; -import net.minecraft.resources.ResourceLocation; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/primitive/CokeOvenMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/primitive/CokeOvenMachine.java index 1ecc6a18a9..197860ddde 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/primitive/CokeOvenMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/primitive/CokeOvenMachine.java @@ -6,10 +6,12 @@ import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; import com.gregtechceu.gtceu.api.machine.feature.IUIMachine; import com.gregtechceu.gtceu.config.ConfigHolder; + import com.lowdragmc.lowdraglib.gui.modular.ModularUI; import com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup; import com.lowdragmc.lowdraglib.gui.texture.ProgressTexture; import com.lowdragmc.lowdraglib.gui.widget.*; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -40,16 +42,20 @@ public ModularUI createUI(Player entityPlayer) { .background(GuiTextures.PRIMITIVE_BACKGROUND) .widget(new LabelWidget(5, 5, getBlockState().getBlock().getDescriptionId())) .widget(new SlotWidget(importItems.storage, 0, 52, 30, true, true) - .setBackgroundTexture(new GuiTextureGroup(GuiTextures.PRIMITIVE_SLOT, GuiTextures.PRIMITIVE_FURNACE_OVERLAY))) - .widget(new ProgressWidget(recipeLogic::getProgressPercent, 76, 32, 20, 15, GuiTextures.PRIMITIVE_BLAST_FURNACE_PROGRESS_BAR)) + .setBackgroundTexture( + new GuiTextureGroup(GuiTextures.PRIMITIVE_SLOT, GuiTextures.PRIMITIVE_FURNACE_OVERLAY))) + .widget(new ProgressWidget(recipeLogic::getProgressPercent, 76, 32, 20, 15, + GuiTextures.PRIMITIVE_BLAST_FURNACE_PROGRESS_BAR)) .widget(new SlotWidget(exportItems.storage, 0, 103, 30, true, false) - .setBackgroundTexture(new GuiTextureGroup(GuiTextures.PRIMITIVE_SLOT, GuiTextures.PRIMITIVE_FURNACE_OVERLAY))) + .setBackgroundTexture( + new GuiTextureGroup(GuiTextures.PRIMITIVE_SLOT, GuiTextures.PRIMITIVE_FURNACE_OVERLAY))) .widget(new TankWidget(exportFluids.getStorages()[0], 134, 13, 20, 58, true, false) .setBackground(GuiTextures.PRIMITIVE_LARGE_FLUID_TANK) .setFillDirection(ProgressTexture.FillDirection.DOWN_TO_UP) .setShowAmount(false) .setOverlay(GuiTextures.PRIMITIVE_LARGE_FLUID_TANK_OVERLAY)) - .widget(UITemplate.bindPlayerInventory(entityPlayer.getInventory(), GuiTextures.PRIMITIVE_SLOT, 7, 84, true)); + .widget(UITemplate.bindPlayerInventory(entityPlayer.getInventory(), GuiTextures.PRIMITIVE_SLOT, 7, 84, + true)); } @Override @@ -73,7 +79,8 @@ public void animateTick(RandomSource random) { x += horizontalOffset; } if (ConfigHolder.INSTANCE.machines.machineSounds && GTValues.RNG.nextDouble() < 0.1) { - getLevel().playLocalSound(x, y, z, SoundEvents.FURNACE_FIRE_CRACKLE, SoundSource.BLOCKS, 1.0F, 1.0F, false); + getLevel().playLocalSound(x, y, z, SoundEvents.FURNACE_FIRE_CRACKLE, SoundSource.BLOCKS, 1.0F, 1.0F, + false); } getLevel().addParticle(ParticleTypes.LARGE_SMOKE, x, y, z, 0, 0, 0); getLevel().addParticle(ParticleTypes.FLAME, x, y, z, 0, 0, 0); diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/primitive/PrimitiveBlastFurnaceMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/primitive/PrimitiveBlastFurnaceMachine.java index 1996d26eb3..6c465dcbcb 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/primitive/PrimitiveBlastFurnaceMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/primitive/PrimitiveBlastFurnaceMachine.java @@ -1,16 +1,18 @@ package com.gregtechceu.gtceu.common.machine.multiblock.primitive; import com.gregtechceu.gtceu.api.GTValues; -import com.gregtechceu.gtceu.api.machine.feature.IUIMachine; import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.api.gui.UITemplate; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; +import com.gregtechceu.gtceu.api.machine.feature.IUIMachine; import com.gregtechceu.gtceu.config.ConfigHolder; + import com.lowdragmc.lowdraglib.gui.modular.ModularUI; import com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup; import com.lowdragmc.lowdraglib.gui.widget.LabelWidget; import com.lowdragmc.lowdraglib.gui.widget.ProgressWidget; import com.lowdragmc.lowdraglib.gui.widget.SlotWidget; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -59,19 +61,27 @@ public ModularUI createUI(Player entityPlayer) { .background(GuiTextures.PRIMITIVE_BACKGROUND) .widget(new LabelWidget(5, 5, getBlockState().getBlock().getDescriptionId())) .widget(new SlotWidget(importItems.storage, 0, 52, 20, true, true) - .setBackgroundTexture(new GuiTextureGroup(GuiTextures.PRIMITIVE_SLOT, GuiTextures.PRIMITIVE_INGOT_OVERLAY))) + .setBackgroundTexture( + new GuiTextureGroup(GuiTextures.PRIMITIVE_SLOT, GuiTextures.PRIMITIVE_INGOT_OVERLAY))) .widget(new SlotWidget(importItems.storage, 1, 52, 38, true, true) - .setBackgroundTexture(new GuiTextureGroup(GuiTextures.PRIMITIVE_SLOT, GuiTextures.PRIMITIVE_DUST_OVERLAY))) + .setBackgroundTexture( + new GuiTextureGroup(GuiTextures.PRIMITIVE_SLOT, GuiTextures.PRIMITIVE_DUST_OVERLAY))) .widget(new SlotWidget(importItems.storage, 2, 52, 56, true, true) - .setBackgroundTexture(new GuiTextureGroup(GuiTextures.PRIMITIVE_SLOT, GuiTextures.PRIMITIVE_FURNACE_OVERLAY))) - .widget(new ProgressWidget(recipeLogic::getProgressPercent, 77, 39, 20, 15, GuiTextures.PRIMITIVE_BLAST_FURNACE_PROGRESS_BAR)) + .setBackgroundTexture( + new GuiTextureGroup(GuiTextures.PRIMITIVE_SLOT, GuiTextures.PRIMITIVE_FURNACE_OVERLAY))) + .widget(new ProgressWidget(recipeLogic::getProgressPercent, 77, 39, 20, 15, + GuiTextures.PRIMITIVE_BLAST_FURNACE_PROGRESS_BAR)) .widget(new SlotWidget(exportItems.storage, 0, 104, 38, true, false) - .setBackgroundTexture(new GuiTextureGroup(GuiTextures.PRIMITIVE_SLOT, GuiTextures.PRIMITIVE_INGOT_OVERLAY))) + .setBackgroundTexture( + new GuiTextureGroup(GuiTextures.PRIMITIVE_SLOT, GuiTextures.PRIMITIVE_INGOT_OVERLAY))) .widget(new SlotWidget(exportItems.storage, 1, 122, 38, true, false) - .setBackgroundTexture(new GuiTextureGroup(GuiTextures.PRIMITIVE_SLOT, GuiTextures.PRIMITIVE_DUST_OVERLAY))) + .setBackgroundTexture( + new GuiTextureGroup(GuiTextures.PRIMITIVE_SLOT, GuiTextures.PRIMITIVE_DUST_OVERLAY))) .widget(new SlotWidget(exportItems.storage, 2, 140, 38, true, false) - .setBackgroundTexture(new GuiTextureGroup(GuiTextures.PRIMITIVE_SLOT, GuiTextures.PRIMITIVE_DUST_OVERLAY))) - .widget(UITemplate.bindPlayerInventory(entityPlayer.getInventory(), GuiTextures.PRIMITIVE_SLOT, 7, 84, true)); + .setBackgroundTexture( + new GuiTextureGroup(GuiTextures.PRIMITIVE_SLOT, GuiTextures.PRIMITIVE_DUST_OVERLAY))) + .widget(UITemplate.bindPlayerInventory(entityPlayer.getInventory(), GuiTextures.PRIMITIVE_SLOT, 7, 84, + true)); } @Override @@ -95,7 +105,8 @@ public void animateTick(RandomSource random) { x += horizontalOffset; } if (ConfigHolder.INSTANCE.machines.machineSounds && GTValues.RNG.nextDouble() < 0.1) { - getLevel().playLocalSound(x, y, z, SoundEvents.FURNACE_FIRE_CRACKLE, SoundSource.BLOCKS, 1.0F, 1.0F, false); + getLevel().playLocalSound(x, y, z, SoundEvents.FURNACE_FIRE_CRACKLE, SoundSource.BLOCKS, 1.0F, 1.0F, + false); } getLevel().addParticle(ParticleTypes.LARGE_SMOKE, x, y, z, 0, 0, 0); getLevel().addParticle(ParticleTypes.FLAME, x, y, z, 0, 0, 0); diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/primitive/PrimitivePumpMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/primitive/PrimitivePumpMachine.java index a71e51b5e2..3a6b2db8ce 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/primitive/PrimitivePumpMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/primitive/PrimitivePumpMachine.java @@ -10,19 +10,23 @@ import com.gregtechceu.gtceu.api.recipe.ingredient.FluidIngredient; import com.gregtechceu.gtceu.common.data.GTMaterials; import com.gregtechceu.gtceu.utils.GTUtil; + import com.lowdragmc.lowdraglib.side.fluid.FluidHelper; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.world.level.biome.Biome.Precipitation; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.List; +import javax.annotation.ParametersAreNonnullByDefault; + @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class PrimitivePumpMachine extends MultiblockControllerMachine { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(PrimitivePumpMachine.class, MultiblockControllerMachine.MANAGED_FIELD_HOLDER); + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(PrimitivePumpMachine.class, + MultiblockControllerMachine.MANAGED_FIELD_HOLDER); private long biomeModifier = 0; private int hatchModifier = 0; @@ -96,7 +100,8 @@ private void produceWater() { } else if (biomeModifier > 0) { if (fluidTank == null) initializeTank(); if (fluidTank != null) { - fluidTank.handleRecipe(IO.OUT, null, List.of(FluidIngredient.of(GTMaterials.Water.getFluid(getFluidProduction()))), null, false); + fluidTank.handleRecipe(IO.OUT, null, + List.of(FluidIngredient.of(GTMaterials.Water.getFluid(getFluidProduction()))), null, false); } } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/primitive/PrimitiveWorkableMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/primitive/PrimitiveWorkableMachine.java index 0e4b41c407..66f25d89fc 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/primitive/PrimitiveWorkableMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/primitive/PrimitiveWorkableMachine.java @@ -1,24 +1,27 @@ package com.gregtechceu.gtceu.common.machine.multiblock.primitive; +import com.gregtechceu.gtceu.api.capability.recipe.FluidRecipeCapability; +import com.gregtechceu.gtceu.api.capability.recipe.IO; import com.gregtechceu.gtceu.api.capability.recipe.ItemRecipeCapability; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; import com.gregtechceu.gtceu.api.machine.MetaMachine; import com.gregtechceu.gtceu.api.machine.feature.IMachineModifyDrops; import com.gregtechceu.gtceu.api.machine.multiblock.WorkableMultiblockMachine; -import com.gregtechceu.gtceu.api.capability.recipe.FluidRecipeCapability; -import com.gregtechceu.gtceu.api.capability.recipe.IO; import com.gregtechceu.gtceu.api.machine.trait.NotifiableFluidTank; import com.gregtechceu.gtceu.api.machine.trait.NotifiableItemStackHandler; + import com.lowdragmc.lowdraglib.side.fluid.FluidHelper; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.List; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author KilaBash * @date 2023/3/16 @@ -27,7 +30,9 @@ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class PrimitiveWorkableMachine extends WorkableMultiblockMachine implements IMachineModifyDrops { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(PrimitiveWorkableMachine.class, WorkableMultiblockMachine.MANAGED_FIELD_HOLDER); + + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( + PrimitiveWorkableMachine.class, WorkableMultiblockMachine.MANAGED_FIELD_HOLDER); @Persisted public final NotifiableItemStackHandler importItems; @@ -47,7 +52,7 @@ public PrimitiveWorkableMachine(IMachineBlockEntity holder, Object... args) { } ////////////////////////////////////// - //***** Initialization ******// + // ***** Initialization ******// ////////////////////////////////////// @Override public ManagedFieldHolder getFieldHolder() { @@ -63,11 +68,13 @@ protected NotifiableItemStackHandler createExportItemHandler(Object... args) { } protected NotifiableFluidTank createImportFluidHandler(Object... args) { - return new NotifiableFluidTank(this, getRecipeType().getMaxInputs(FluidRecipeCapability.CAP), 32 * FluidHelper.getBucket(), IO.IN); + return new NotifiableFluidTank(this, getRecipeType().getMaxInputs(FluidRecipeCapability.CAP), + 32 * FluidHelper.getBucket(), IO.IN); } protected NotifiableFluidTank createExportFluidHandler(Object... args) { - return new NotifiableFluidTank(this, getRecipeType().getMaxOutputs(FluidRecipeCapability.CAP), 32 * FluidHelper.getBucket(), IO.OUT); + return new NotifiableFluidTank(this, getRecipeType().getMaxOutputs(FluidRecipeCapability.CAP), + 32 * FluidHelper.getBucket(), IO.OUT); } @Override diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/steam/BoilerType.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/steam/BoilerType.java index 47991ba574..3fd7c2f9e7 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/steam/BoilerType.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/steam/BoilerType.java @@ -39,7 +39,6 @@ public enum BoilerType { BlockState casingState, BlockState fireboxState, BlockState pipeState) { - this.steamPerTick = steamPerTick; this.ticksToBoiling = ticksToBoiling; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/steam/LargeBoilerMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/steam/LargeBoilerMachine.java index 73763be437..cbb2788dac 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/steam/LargeBoilerMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/steam/LargeBoilerMachine.java @@ -14,13 +14,14 @@ import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.ingredient.FluidIngredient; import com.gregtechceu.gtceu.common.data.GTMaterials; + import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.util.ClickData; import com.lowdragmc.lowdraglib.gui.widget.ComponentPanelWidget; import com.lowdragmc.lowdraglib.side.fluid.FluidHelper; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import lombok.Getter; + import net.minecraft.ChatFormatting; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; @@ -31,14 +32,16 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.util.Mth; import net.minecraft.world.level.material.Fluids; -import org.jetbrains.annotations.Nullable; +import lombok.Getter; import org.jetbrains.annotations.NotNull; -import javax.annotation.ParametersAreNonnullByDefault; +import org.jetbrains.annotations.Nullable; + import java.util.ArrayList; import java.util.List; import java.util.Objects; +import javax.annotation.ParametersAreNonnullByDefault; /** * @author KilaBash @@ -48,13 +51,16 @@ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class LargeBoilerMachine extends WorkableMultiblockMachine implements IExplosionMachine, IDisplayUIMachine { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(LargeBoilerMachine.class, WorkableMultiblockMachine.MANAGED_FIELD_HOLDER); + + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(LargeBoilerMachine.class, + WorkableMultiblockMachine.MANAGED_FIELD_HOLDER); private static final long STEAM_PER_WATER = 160; public static final int TICKS_PER_STEAM_GENERATION = 5; @Getter public final int maxTemperature, heatSpeed; - @Persisted @Getter + @Persisted + @Getter private int currentTemperature, throttle; @Getter private boolean hasNoWater; @@ -75,10 +81,9 @@ public ManagedFieldHolder getFieldHolder() { } ////////////////////////////////////// - //****** Recipe Logic ******// + // ****** Recipe Logic ******// ////////////////////////////////////// - @Override public void onLoad() { super.onLoad(); @@ -110,20 +115,23 @@ protected void updateCurrentTemperature() { if (currentTemperature >= 100 && getOffsetTimer() % TICKS_PER_STEAM_GENERATION == 0) { // drain water - var maxDrain = currentTemperature * throttle * TICKS_PER_STEAM_GENERATION * FluidHelper.getBucket() / (STEAM_PER_WATER * 100000); + var maxDrain = currentTemperature * throttle * TICKS_PER_STEAM_GENERATION * FluidHelper.getBucket() / + (STEAM_PER_WATER * 100000); var drainWater = List.of(FluidIngredient.of(maxDrain, Fluids.WATER)); List> inputTanks = new ArrayList<>(); if (getCapabilitiesProxy().contains(IO.IN, FluidRecipeCapability.CAP)) { inputTanks.addAll(Objects.requireNonNull(getCapabilitiesProxy().get(IO.IN, FluidRecipeCapability.CAP))); } if (getCapabilitiesProxy().contains(IO.BOTH, FluidRecipeCapability.CAP)) { - inputTanks.addAll(Objects.requireNonNull(getCapabilitiesProxy().get(IO.BOTH, FluidRecipeCapability.CAP))); + inputTanks + .addAll(Objects.requireNonNull(getCapabilitiesProxy().get(IO.BOTH, FluidRecipeCapability.CAP))); } for (IRecipeHandler tank : inputTanks) { drainWater = (List) tank.handleRecipe(IO.IN, null, drainWater, null, false); if (drainWater == null) break; } - var drained = (drainWater == null || drainWater.isEmpty()) ? maxDrain : maxDrain - drainWater.get(0).getAmount(); + var drained = (drainWater == null || drainWater.isEmpty()) ? maxDrain : + maxDrain - drainWater.get(0).getAmount(); boolean hasDrainedWater = drained > 0; steamGenerated = drained * STEAM_PER_WATER; @@ -133,10 +141,12 @@ protected void updateCurrentTemperature() { var fillSteam = List.of(FluidIngredient.of(GTMaterials.Steam.getFluid(steamGenerated))); List> outputTanks = new ArrayList<>(); if (getCapabilitiesProxy().contains(IO.OUT, FluidRecipeCapability.CAP)) { - outputTanks.addAll(Objects.requireNonNull(getCapabilitiesProxy().get(IO.OUT, FluidRecipeCapability.CAP))); + outputTanks.addAll( + Objects.requireNonNull(getCapabilitiesProxy().get(IO.OUT, FluidRecipeCapability.CAP))); } if (getCapabilitiesProxy().contains(IO.BOTH, FluidRecipeCapability.CAP)) { - outputTanks.addAll(Objects.requireNonNull(getCapabilitiesProxy().get(IO.BOTH, FluidRecipeCapability.CAP))); + outputTanks.addAll( + Objects.requireNonNull(getCapabilitiesProxy().get(IO.BOTH, FluidRecipeCapability.CAP))); } for (IRecipeHandler tank : outputTanks) { fillSteam = (List) tank.handleRecipe(IO.OUT, null, fillSteam, null, false); @@ -199,12 +209,14 @@ public static GTRecipe recipeModifier(MetaMachine machine, @NotNull GTRecipe rec public void addDisplayText(List textList) { IDisplayUIMachine.super.addDisplayText(textList); - if (isFormed()){ - textList.add(Component.translatable("gtceu.multiblock.large_boiler.temperature", (int) (currentTemperature + 274.15), (int) (maxTemperature + 274.15))); - textList.add(Component.translatable("gtceu.multiblock.large_boiler.steam_output", steamGenerated / TICKS_PER_STEAM_GENERATION)); + if (isFormed()) { + textList.add(Component.translatable("gtceu.multiblock.large_boiler.temperature", + (int) (currentTemperature + 274.15), (int) (maxTemperature + 274.15))); + textList.add(Component.translatable("gtceu.multiblock.large_boiler.steam_output", + steamGenerated / TICKS_PER_STEAM_GENERATION)); var throttleText = Component.translatable("gtceu.multiblock.large_boiler.throttle", - ChatFormatting.AQUA.toString() + getThrottle() + "%") + ChatFormatting.AQUA.toString() + getThrottle() + "%") .withStyle(Style.EMPTY.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.translatable("gtceu.multiblock.large_boiler.throttle.tooltip")))); textList.add(throttleText); @@ -229,5 +241,4 @@ public void handleDisplayClick(String componentData, ClickData clickData) { public IGuiTexture getScreenTexture() { return GuiTextures.DISPLAY_STEAM.get(maxTemperature > 800); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/steam/SteamParallelMultiblockMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/steam/SteamParallelMultiblockMachine.java index 5a7549e43e..235fc8bcbb 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/steam/SteamParallelMultiblockMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/steam/SteamParallelMultiblockMachine.java @@ -17,12 +17,14 @@ import com.gregtechceu.gtceu.common.data.GTMaterials; import com.gregtechceu.gtceu.common.data.GTRecipeModifiers; import com.gregtechceu.gtceu.config.ConfigHolder; + import com.lowdragmc.lowdraglib.gui.modular.ModularUI; import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.widget.ComponentPanelWidget; import com.lowdragmc.lowdraglib.gui.widget.DraggableScrollableWidgetGroup; import com.lowdragmc.lowdraglib.gui.widget.LabelWidget; import com.lowdragmc.lowdraglib.side.fluid.FluidHelper; + import net.minecraft.ChatFormatting; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.network.chat.Component; @@ -30,10 +32,12 @@ import net.minecraft.world.entity.player.Player; import org.jetbrains.annotations.NotNull; -import javax.annotation.ParametersAreNonnullByDefault; + import java.util.ArrayList; import java.util.List; +import javax.annotation.ParametersAreNonnullByDefault; + @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class SteamParallelMultiblockMachine extends WorkableMultiblockMachine implements IDisplayUIMachine { @@ -61,7 +65,8 @@ public void onStructureFormed() { if (!capabilitiesProxy.contains(IO.IN, EURecipeCapability.CAP)) { capabilitiesProxy.put(IO.IN, EURecipeCapability.CAP, new ArrayList<>()); } - capabilitiesProxy.get(IO.IN, EURecipeCapability.CAP).add(new SteamEnergyRecipeHandler(tank, CONVERSION_RATE)); + capabilitiesProxy.get(IO.IN, EURecipeCapability.CAP) + .add(new SteamEnergyRecipeHandler(tank, CONVERSION_RATE)); return; } } @@ -87,10 +92,12 @@ public void addDisplayText(List textList) { IDisplayUIMachine.super.addDisplayText(textList); if (isFormed()) { var handlers = capabilitiesProxy.get(IO.IN, EURecipeCapability.CAP); - if (handlers != null && handlers.size() > 0 && handlers.get(0) instanceof SteamEnergyRecipeHandler steamHandler) { + if (handlers != null && handlers.size() > 0 && + handlers.get(0) instanceof SteamEnergyRecipeHandler steamHandler) { if (steamHandler.getCapacity() > 0) { long steamStored = steamHandler.getStored(); - textList.add(Component.translatable("gtceu.multiblock.steam.steam_stored", steamStored, steamHandler.getCapacity())); + textList.add(Component.translatable("gtceu.multiblock.steam.steam_stored", steamStored, + steamHandler.getCapacity())); } } @@ -107,7 +114,8 @@ public void addDisplayText(List textList) { } if (recipeLogic.isWaiting()) { - textList.add(Component.translatable("gtceu.multiblock.steam.low_steam").setStyle(Style.EMPTY.withColor(ChatFormatting.RED))); + textList.add(Component.translatable("gtceu.multiblock.steam.low_steam") + .setStyle(Style.EMPTY.withColor(ChatFormatting.RED))); } } } @@ -127,6 +135,8 @@ public ModularUI createUI(Player entityPlayer) { return new ModularUI(176, 216, this, entityPlayer) .background(GuiTextures.BACKGROUND_STEAM.get(ConfigHolder.INSTANCE.machines.steelSteamMultiblocks)) .widget(screen) - .widget(UITemplate.bindPlayerInventory(entityPlayer.getInventory(), GuiTextures.SLOT_STEAM.get(ConfigHolder.INSTANCE.machines.steelSteamMultiblocks), 7, 134, true)); + .widget(UITemplate.bindPlayerInventory(entityPlayer.getInventory(), + GuiTextures.SLOT_STEAM.get(ConfigHolder.INSTANCE.machines.steelSteamMultiblocks), 7, 134, + true)); } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/steam/SteamLiquidBoilerMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/steam/SteamLiquidBoilerMachine.java index d4857f5e1a..cd7d714100 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/steam/SteamLiquidBoilerMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/steam/SteamLiquidBoilerMachine.java @@ -1,29 +1,33 @@ package com.gregtechceu.gtceu.common.machine.steam; -import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; -import com.gregtechceu.gtceu.api.machine.steam.SteamBoilerMachine; -import com.gregtechceu.gtceu.api.machine.trait.NotifiableFluidTank; import com.gregtechceu.gtceu.api.capability.recipe.FluidRecipeCapability; import com.gregtechceu.gtceu.api.capability.recipe.IO; import com.gregtechceu.gtceu.api.gui.GuiTextures; +import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; +import com.gregtechceu.gtceu.api.machine.steam.SteamBoilerMachine; +import com.gregtechceu.gtceu.api.machine.trait.NotifiableFluidTank; + import com.lowdragmc.lowdraglib.gui.modular.ModularUI; import com.lowdragmc.lowdraglib.gui.texture.ProgressTexture; import com.lowdragmc.lowdraglib.gui.widget.TankWidget; import com.lowdragmc.lowdraglib.side.fluid.FluidHelper; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import it.unimi.dsi.fastutil.objects.Object2BooleanMap; -import it.unimi.dsi.fastutil.objects.Object2BooleanOpenHashMap; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.particles.ParticleTypes; import net.minecraft.util.RandomSource; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.material.Fluid; -import javax.annotation.ParametersAreNonnullByDefault; +import it.unimi.dsi.fastutil.objects.Object2BooleanMap; +import it.unimi.dsi.fastutil.objects.Object2BooleanOpenHashMap; + import java.util.Arrays; import java.util.Collections; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author KilaBash * @date 2023/3/15 @@ -32,7 +36,9 @@ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class SteamLiquidBoilerMachine extends SteamBoilerMachine { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(SteamLiquidBoilerMachine.class, SteamBoilerMachine.MANAGED_FIELD_HOLDER); + + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( + SteamLiquidBoilerMachine.class, SteamBoilerMachine.MANAGED_FIELD_HOLDER); public static final Object2BooleanMap FUEL_CACHE = new Object2BooleanOpenHashMap<>(); @Persisted @@ -41,11 +47,12 @@ public class SteamLiquidBoilerMachine extends SteamBoilerMachine { public SteamLiquidBoilerMachine(IMachineBlockEntity holder, boolean isHighPressure, Object... args) { super(holder, isHighPressure, args); this.fuelTank = createFuelTank(args).setFilter(fluid -> FUEL_CACHE.computeIfAbsent(fluid.getFluid(), f -> { - if (isRemote()) return true; + if (isRemote()) return true; return recipeLogic.getRecipeManager().getAllRecipesFor(getRecipeType()).stream().anyMatch(recipe -> { var list = recipe.inputs.getOrDefault(FluidRecipeCapability.CAP, Collections.emptyList()); if (!list.isEmpty()) { - return Arrays.stream(FluidRecipeCapability.CAP.of(list.get(0).content).getStacks()).anyMatch(stack -> stack.getFluid() == f); + return Arrays.stream(FluidRecipeCapability.CAP.of(list.get(0).content).getStacks()) + .anyMatch(stack -> stack.getFluid() == f); } return false; }); @@ -53,7 +60,7 @@ public SteamLiquidBoilerMachine(IMachineBlockEntity holder, boolean isHighPressu } ////////////////////////////////////// - //***** Initialization *****// + // ***** Initialization *****// ////////////////////////////////////// @Override public ManagedFieldHolder getFieldHolder() { @@ -82,7 +89,8 @@ public ModularUI createUI(Player entityPlayer) { protected void randomDisplayTick(RandomSource random, float x, float y, float z) { super.randomDisplayTick(random, x, y, z); if (random.nextFloat() < 0.3F) { - getLevel().addParticle(ParticleTypes.LAVA, x + random.nextFloat(), y, z + random.nextFloat(), 0.0F, 0.0F, 0.0F); + getLevel().addParticle(ParticleTypes.LAVA, x + random.nextFloat(), y, z + random.nextFloat(), 0.0F, 0.0F, + 0.0F); } } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/steam/SteamMinerMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/steam/SteamMinerMachine.java index 0dea0c83ee..c9aa0bc96f 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/steam/SteamMinerMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/steam/SteamMinerMachine.java @@ -16,10 +16,9 @@ import com.gregtechceu.gtceu.api.machine.trait.NotifiableFluidTank; import com.gregtechceu.gtceu.api.machine.trait.NotifiableItemStackHandler; import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; -import com.gregtechceu.gtceu.common.data.GTMaterials; import com.gregtechceu.gtceu.common.item.PortableScannerBehavior; import com.gregtechceu.gtceu.common.machine.trait.miner.SteamMinerLogic; -import com.gregtechceu.gtceu.data.recipe.CustomTags; + import com.lowdragmc.lowdraglib.gui.modular.ModularUI; import com.lowdragmc.lowdraglib.gui.widget.ComponentPanelWidget; import com.lowdragmc.lowdraglib.gui.widget.ImageWidget; @@ -30,8 +29,7 @@ import com.lowdragmc.lowdraglib.syncdata.ISubscription; import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; -import lombok.Getter; -import lombok.Setter; + import net.minecraft.ChatFormatting; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; @@ -43,19 +41,27 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.Block; + +import lombok.Getter; +import lombok.Setter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import javax.annotation.ParametersAreNonnullByDefault; + @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault -public class SteamMinerMachine extends SteamWorkableMachine implements IMiner, IControllable, IExhaustVentMachine, IUIMachine, IMachineModifyDrops, IDataInfoProvider { - @Getter @Setter - @Persisted @DescSynced +public class SteamMinerMachine extends SteamWorkableMachine implements IMiner, IControllable, IExhaustVentMachine, + IUIMachine, IMachineModifyDrops, IDataInfoProvider { + + @Getter + @Setter + @Persisted + @DescSynced private boolean needsVenting; @Persisted public final NotifiableItemStackHandler importItems; @@ -77,14 +83,16 @@ public SteamMinerMachine(IMachineBlockEntity holder, int speed, int maximumRadiu } ////////////////////////////////////// - //***** Initialization ******// + // ***** Initialization ******// ////////////////////////////////////// @Override protected @NotNull RecipeLogic createRecipeLogic(Object... args) { - if (args.length > 2 && args[args.length - 3] instanceof Integer fortune && args[args.length - 2] instanceof Integer speed && args[args.length - 1] instanceof Integer maxRadius) { + if (args.length > 2 && args[args.length - 3] instanceof Integer fortune && + args[args.length - 2] instanceof Integer speed && args[args.length - 1] instanceof Integer maxRadius) { return new SteamMinerLogic(this, fortune, speed, maxRadius); } - throw new IllegalArgumentException("MinerMachine need args [inventorySize, fortune, speed, maximumRadius] for initialization"); + throw new IllegalArgumentException( + "MinerMachine need args [inventorySize, fortune, speed, maximumRadius] for initialization"); } @Override @@ -137,11 +145,12 @@ public void onUnload() { } ////////////////////////////////////// - //********** LOGIC **********// + // ********** LOGIC **********// ////////////////////////////////////// protected void updateAutoOutputSubscription() { var outputFacingItems = getFrontFacing(); - if (!exportItems.isEmpty() && ItemTransferHelper.getItemTransfer(getLevel(), getPos().relative(outputFacingItems), outputFacingItems.getOpposite()) != null) { + if (!exportItems.isEmpty() && ItemTransferHelper.getItemTransfer(getLevel(), + getPos().relative(outputFacingItems), outputFacingItems.getOpposite()) != null) { autoOutputSubs = subscribeServerTick(autoOutputSubs, this::autoOutput); } else if (autoOutputSubs != null) { autoOutputSubs.unsubscribe(); @@ -157,7 +166,7 @@ protected void autoOutput() { } ////////////////////////////////////// - //*********** GUI ***********// + // *********** GUI ***********// ////////////////////////////////////// @Override public ModularUI createUI(Player entityPlayer) { @@ -165,7 +174,8 @@ public ModularUI createUI(Player entityPlayer) { ModularUI builder = new ModularUI(175, 176, this, entityPlayer) .background(GuiTextures.BACKGROUND_STEAM.get(false)); - builder.widget(UITemplate.bindPlayerInventory(entityPlayer.getInventory(), GuiTextures.SLOT_STEAM.get(false), 7, 94, true)); + builder.widget(UITemplate.bindPlayerInventory(entityPlayer.getInventory(), GuiTextures.SLOT_STEAM.get(false), 7, + 94, true)); for (int y = 0; y < rowSize; y++) { for (int x = 0; x < rowSize; x++) { @@ -184,7 +194,6 @@ public ModularUI createUI(Player entityPlayer) { builder.widget(new ComponentPanelWidget(70, 19, this::addDisplayText2) .setMaxWidthLimit(84)); - return builder; } @@ -195,13 +204,16 @@ void addDisplayText(List textList) { textList.add(Component.translatable("gtceu.machine.miner.startz", this.getRecipeLogic().getZ())); textList.add(Component.translatable("gtceu.universal.tooltip.working_area", workingArea, workingArea)); if (this.getRecipeLogic().isDone()) - textList.add(Component.translatable("gtceu.multiblock.large_miner.done").setStyle(Style.EMPTY.withColor(ChatFormatting.GREEN))); + textList.add(Component.translatable("gtceu.multiblock.large_miner.done") + .setStyle(Style.EMPTY.withColor(ChatFormatting.GREEN))); else if (this.getRecipeLogic().isWorking()) - textList.add(Component.translatable("gtceu.multiblock.large_miner.working").setStyle(Style.EMPTY.withColor(ChatFormatting.GOLD))); + textList.add(Component.translatable("gtceu.multiblock.large_miner.working") + .setStyle(Style.EMPTY.withColor(ChatFormatting.GOLD))); else if (!this.isWorkingEnabled()) textList.add(Component.translatable("gtceu.multiblock.work_paused")); if (getRecipeLogic().isInventoryFull()) - textList.add(Component.translatable("gtceu.multiblock.large_miner.invfull").setStyle(Style.EMPTY.withColor(ChatFormatting.RED))); + textList.add(Component.translatable("gtceu.multiblock.large_miner.invfull") + .setStyle(Style.EMPTY.withColor(ChatFormatting.RED))); } void addDisplayText2(List textList) { @@ -238,10 +250,11 @@ public float getVentingDamage() { @NotNull @Override public List getDataInfo(PortableScannerBehavior.DisplayMode mode) { - if (mode == PortableScannerBehavior.DisplayMode.SHOW_ALL || mode == PortableScannerBehavior.DisplayMode.SHOW_MACHINE_INFO) { + if (mode == PortableScannerBehavior.DisplayMode.SHOW_ALL || + mode == PortableScannerBehavior.DisplayMode.SHOW_MACHINE_INFO) { int workingArea = IMiner.getWorkingArea(getRecipeLogic().getCurrentRadius()); return Collections.singletonList( - Component.translatable("gtceu.universal.tooltip.working_area", workingArea, workingArea)); + Component.translatable("gtceu.universal.tooltip.working_area", workingArea, workingArea)); } return new ArrayList<>(); } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/steam/SteamSolarBoiler.java b/src/main/java/com/gregtechceu/gtceu/common/machine/steam/SteamSolarBoiler.java index 2c137dc3a4..9d9bbf28b1 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/steam/SteamSolarBoiler.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/steam/SteamSolarBoiler.java @@ -5,8 +5,10 @@ import com.gregtechceu.gtceu.api.machine.steam.SteamBoilerMachine; import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; import com.gregtechceu.gtceu.utils.GTUtil; + import com.lowdragmc.lowdraglib.gui.modular.ModularUI; import com.lowdragmc.lowdraglib.gui.widget.ProgressWidget; + import net.minecraft.core.Direction; import net.minecraft.util.RandomSource; import net.minecraft.world.entity.player.Player; @@ -36,9 +38,9 @@ protected void updateSteamSubscription() { @Override protected void updateCurrentTemperature() { - if (GTUtil.canSeeSunClearly(getLevel(), getPos())){ + if (GTUtil.canSeeSunClearly(getLevel(), getPos())) { recipeLogic.setStatus(RecipeLogic.Status.WORKING); - }else { + } else { recipeLogic.setStatus(RecipeLogic.Status.IDLE); } super.updateCurrentTemperature(); @@ -57,13 +59,14 @@ protected int getCoolDownRate() { @Override public ModularUI createUI(Player entityPlayer) { return super.createUI(entityPlayer) - .widget(new ProgressWidget(() -> GTUtil.canSeeSunClearly(getLevel(), getPos()) ? 1.0 : 0.0, 114, 44, 20, 20) - .setProgressTexture(GuiTextures.PROGRESS_BAR_SOLAR_STEAM.get(isHighPressure).getSubTexture(0, 0, 1, 0.5), - GuiTextures.PROGRESS_BAR_SOLAR_STEAM.get(isHighPressure).getSubTexture(0, 0.5, 1, 0.5))); + .widget(new ProgressWidget(() -> GTUtil.canSeeSunClearly(getLevel(), getPos()) ? 1.0 : 0.0, 114, 44, 20, + 20) + .setProgressTexture( + GuiTextures.PROGRESS_BAR_SOLAR_STEAM.get(isHighPressure).getSubTexture(0, 0, 1, 0.5), + GuiTextures.PROGRESS_BAR_SOLAR_STEAM.get(isHighPressure).getSubTexture(0, 0.5, 1, + 0.5))); } @Override - protected void randomDisplayTick(RandomSource random, float x, float y, float z) { - - } + protected void randomDisplayTick(RandomSource random, float x, float y, float z) {} } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/steam/SteamSolidBoilerMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/steam/SteamSolidBoilerMachine.java index e9f1c74e2a..7418dfc0dd 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/steam/SteamSolidBoilerMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/steam/SteamSolidBoilerMachine.java @@ -1,37 +1,40 @@ package com.gregtechceu.gtceu.common.machine.steam; import com.gregtechceu.gtceu.api.GTValues; -import com.gregtechceu.gtceu.api.machine.feature.IMachineModifyDrops; import com.gregtechceu.gtceu.api.capability.recipe.IO; import com.gregtechceu.gtceu.api.capability.recipe.ItemRecipeCapability; import com.gregtechceu.gtceu.api.data.chemical.ChemicalHelper; +import com.gregtechceu.gtceu.api.data.tag.TagPrefix; import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; +import com.gregtechceu.gtceu.api.machine.feature.IMachineModifyDrops; import com.gregtechceu.gtceu.api.machine.steam.SteamBoilerMachine; import com.gregtechceu.gtceu.api.machine.trait.NotifiableItemStackHandler; -import com.gregtechceu.gtceu.api.data.tag.TagPrefix; import com.gregtechceu.gtceu.common.data.GTMaterials; + import com.lowdragmc.lowdraglib.gui.modular.ModularUI; import com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup; import com.lowdragmc.lowdraglib.gui.texture.ProgressTexture; import com.lowdragmc.lowdraglib.gui.widget.ProgressWidget; import com.lowdragmc.lowdraglib.gui.widget.SlotWidget; import com.lowdragmc.lowdraglib.side.fluid.FluidTransferHelper; -import com.lowdragmc.lowdraglib.side.fluid.forge.FluidTransferHelperImpl; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import it.unimi.dsi.fastutil.objects.Object2BooleanMap; -import it.unimi.dsi.fastutil.objects.Object2BooleanOpenHashMap; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; -import javax.annotation.ParametersAreNonnullByDefault; +import it.unimi.dsi.fastutil.objects.Object2BooleanMap; +import it.unimi.dsi.fastutil.objects.Object2BooleanOpenHashMap; + import java.util.Arrays; import java.util.Collections; import java.util.List; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author KilaBash * @date 2023/3/15 @@ -40,7 +43,9 @@ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class SteamSolidBoilerMachine extends SteamBoilerMachine implements IMachineModifyDrops { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(SteamSolidBoilerMachine.class, SteamBoilerMachine.MANAGED_FIELD_HOLDER); + + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( + SteamSolidBoilerMachine.class, SteamBoilerMachine.MANAGED_FIELD_HOLDER); public static final Object2BooleanMap FUEL_CACHE = new Object2BooleanOpenHashMap<>(); @Persisted @@ -57,7 +62,8 @@ public SteamSolidBoilerMachine(IMachineBlockEntity holder, boolean isHighPressur return recipeLogic.getRecipeManager().getAllRecipesFor(getRecipeType()).stream().anyMatch(recipe -> { var list = recipe.inputs.getOrDefault(ItemRecipeCapability.CAP, Collections.emptyList()); if (!list.isEmpty()) { - return Arrays.stream(ItemRecipeCapability.CAP.of(list.get(0).content).getItems()).map(ItemStack::getItem).anyMatch(i -> i == item); + return Arrays.stream(ItemRecipeCapability.CAP.of(list.get(0).content).getItems()) + .map(ItemStack::getItem).anyMatch(i -> i == item); } return false; }); @@ -67,7 +73,7 @@ public SteamSolidBoilerMachine(IMachineBlockEntity holder, boolean isHighPressur } ////////////////////////////////////// - //***** Initialization *****// + // ***** Initialization *****// ////////////////////////////////////// @Override public ManagedFieldHolder getFieldHolder() { @@ -91,7 +97,8 @@ protected long getBaseSteamOutput() { public void afterWorking() { super.afterWorking(); if (recipeLogic.getLastRecipe() != null) { - var inputs = recipeLogic.getLastRecipe().inputs.getOrDefault(ItemRecipeCapability.CAP, Collections.emptyList()); + var inputs = recipeLogic.getLastRecipe().inputs.getOrDefault(ItemRecipeCapability.CAP, + Collections.emptyList()); if (!inputs.isEmpty()) { var input = ItemRecipeCapability.CAP.of(inputs.get(0).content).getItems(); if (input.length > 0) { @@ -127,11 +134,14 @@ else if (materialStack.material() == GTMaterials.Charcoal) { public ModularUI createUI(Player entityPlayer) { return super.createUI(entityPlayer) .widget(new SlotWidget(this.fuelHandler.storage, 0, 115, 62) - .setBackgroundTexture(new GuiTextureGroup(GuiTextures.SLOT_STEAM.get(isHighPressure), GuiTextures.COAL_OVERLAY_STEAM.get(isHighPressure)))) - .widget(new SlotWidget(this.ashHandler.storage, 0, 115, 26, true, false) - .setBackgroundTexture(new GuiTextureGroup(GuiTextures.SLOT_STEAM.get(isHighPressure), GuiTextures.DUST_OVERLAY_STEAM.get(isHighPressure)))) + .setBackgroundTexture(new GuiTextureGroup(GuiTextures.SLOT_STEAM.get(isHighPressure), + GuiTextures.COAL_OVERLAY_STEAM.get(isHighPressure)))) + .widget(new SlotWidget(this.ashHandler.storage, 0, 115, 26, true, false) + .setBackgroundTexture(new GuiTextureGroup(GuiTextures.SLOT_STEAM.get(isHighPressure), + GuiTextures.DUST_OVERLAY_STEAM.get(isHighPressure)))) .widget(new ProgressWidget(recipeLogic::getProgressPercent, 115, 44, 18, 18) - .setProgressTexture(GuiTextures.PROGRESS_BAR_BOILER_FUEL.get(isHighPressure).getSubTexture(0, 0, 1, 0.5), + .setProgressTexture( + GuiTextures.PROGRESS_BAR_BOILER_FUEL.get(isHighPressure).getSubTexture(0, 0, 1, 0.5), GuiTextures.PROGRESS_BAR_BOILER_FUEL.get(isHighPressure).getSubTexture(0, 0.5, 1, 0.5)) .setFillDirection(ProgressTexture.FillDirection.DOWN_TO_UP)); } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CrateMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CrateMachine.java index 74d2e94374..d409ac0c1c 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CrateMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CrateMachine.java @@ -9,19 +9,23 @@ import com.gregtechceu.gtceu.api.machine.feature.IMachineModifyDrops; import com.gregtechceu.gtceu.api.machine.feature.IUIMachine; import com.gregtechceu.gtceu.api.machine.trait.NotifiableItemStackHandler; + import com.lowdragmc.lowdraglib.gui.modular.ModularUI; import com.lowdragmc.lowdraglib.gui.widget.LabelWidget; import com.lowdragmc.lowdraglib.gui.widget.SlotWidget; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import lombok.Getter; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; -import javax.annotation.ParametersAreNonnullByDefault; +import lombok.Getter; + import java.util.List; +import javax.annotation.ParametersAreNonnullByDefault; + /** * @author h3tR * @date 2023/3/27 @@ -30,7 +34,10 @@ @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class CrateMachine extends MetaMachine implements IUIMachine, IMachineModifyDrops { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(CrateMachine.class, MetaMachine.MANAGED_FIELD_HOLDER); + + public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(CrateMachine.class, + MetaMachine.MANAGED_FIELD_HOLDER); + @Override public ManagedFieldHolder getFieldHolder() { return MANAGED_FIELD_HOLDER; @@ -55,11 +62,13 @@ public CrateMachine(IMachineBlockEntity holder, Material material, int inventory public ModularUI createUI(Player entityPlayer) { int xOffset = inventorySize >= 90 ? 162 : 0; int yOverflow = xOffset > 0 ? 18 : 9; - int yOffset = inventorySize > 3 * yOverflow ? (inventorySize - 3 * yOverflow - (inventorySize - 3 * yOverflow) % yOverflow) / yOverflow * 18 : 0; + int yOffset = inventorySize > 3 * yOverflow ? + (inventorySize - 3 * yOverflow - (inventorySize - 3 * yOverflow) % yOverflow) / yOverflow * 18 : 0; var modularUI = new ModularUI(176 + xOffset, 166 + yOffset, this, entityPlayer) .background(GuiTextures.BACKGROUND) .widget(new LabelWidget(5, 5, getBlockState().getBlock().getDescriptionId())) - .widget(UITemplate.bindPlayerInventory(entityPlayer.getInventory(), GuiTextures.SLOT, 7 + xOffset / 2, 82 + yOffset, true)); + .widget(UITemplate.bindPlayerInventory(entityPlayer.getInventory(), GuiTextures.SLOT, 7 + xOffset / 2, + 82 + yOffset, true)); int x = 0; int y = 0; for (int slot = 0; slot < inventorySize; slot++) { diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CreativeChestMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CreativeChestMachine.java index 79b194b5bf..8f30d6047f 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CreativeChestMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CreativeChestMachine.java @@ -5,9 +5,9 @@ import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; import com.gregtechceu.gtceu.api.machine.trait.NotifiableItemStackHandler; -import com.gregtechceu.gtceu.api.transfer.fluid.InfiniteFluidTransferProxy; import com.gregtechceu.gtceu.api.transfer.item.InfiniteItemTransferProxy; import com.gregtechceu.gtceu.utils.GTTransferUtils; + import com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup; import com.lowdragmc.lowdraglib.gui.texture.ResourceBorderTexture; import com.lowdragmc.lowdraglib.gui.texture.TextTexture; @@ -17,6 +17,7 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DropSaved; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.InteractionHand; @@ -27,14 +28,19 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.BlockHitResult; + import org.jetbrains.annotations.Nullable; public class CreativeChestMachine extends QuantumChestMachine { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(CreativeChestMachine.class, QuantumChestMachine.MANAGED_FIELD_HOLDER); - @Persisted @DropSaved + public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(CreativeChestMachine.class, + QuantumChestMachine.MANAGED_FIELD_HOLDER); + + @Persisted + @DropSaved private int itemsPerCycle = 1; - @Persisted @DropSaved + @Persisted + @DropSaved private int ticksPerCycle = 1; private final InfiniteItemTransferProxy capabilityTransferProxy; @@ -57,6 +63,7 @@ public IItemTransfer getItemTransferCap(@Nullable Direction side, boolean useCov @Override protected NotifiableItemStackHandler createCacheItemHandler(Object... args) { return new NotifiableItemStackHandler(this, 1, IO.BOTH, IO.NONE) { + @Override public int getSlotLimit(int slot) { return 1; @@ -94,9 +101,9 @@ protected void checkAutoOutput() { public Widget createUIWidget() { var group = new WidgetGroup(0, 0, 176, 131); group.addWidget(new PhantomSlotWidget(cache, 0, 36, 6) - .setClearSlotOnRightClick(true) - .setBackgroundTexture(GuiTextures.SLOT) - .setChangeListener(this::markDirty)); + .setClearSlotOnRightClick(true) + .setBackgroundTexture(GuiTextures.SLOT) + .setChangeListener(this::markDirty)); group.addWidget(new LabelWidget(7, 9, "gtceu.creative.chest.item")); group.addWidget(new ImageWidget(7, 48, 154, 14, GuiTextures.DISPLAY)); group.addWidget(new TextFieldWidget(9, 50, 152, 10, () -> String.valueOf(itemsPerCycle), value -> { @@ -115,10 +122,12 @@ public Widget createUIWidget() { group.addWidget(new LabelWidget(7, 65, "gtceu.creative.chest.tpc")); group.addWidget(new SwitchWidget(7, 101, 162, 20, (clickData, value) -> setWorkingEnabled(value)) - .setTexture( - new GuiTextureGroup(ResourceBorderTexture.BUTTON_COMMON, new TextTexture("gtceu.creative.activity.off")), - new GuiTextureGroup(ResourceBorderTexture.BUTTON_COMMON, new TextTexture("gtceu.creative.activity.on"))) - .setPressed(isWorkingEnabled())); + .setTexture( + new GuiTextureGroup(ResourceBorderTexture.BUTTON_COMMON, + new TextTexture("gtceu.creative.activity.off")), + new GuiTextureGroup(ResourceBorderTexture.BUTTON_COMMON, + new TextTexture("gtceu.creative.activity.on"))) + .setPressed(isWorkingEnabled())); return group; } @@ -129,7 +138,8 @@ public void updateItemTick() { if (ticksPerCycle == 0 || getOffsetTimer() % ticksPerCycle != 0) return; if (getLevel().isClientSide || !isWorkingEnabled() || stack.isEmpty()) return; - IItemTransfer transfer = ItemTransferHelper.getItemTransfer(getLevel(), getPos().relative(getOutputFacingItems()), getOutputFacingItems().getOpposite()); + IItemTransfer transfer = ItemTransferHelper.getItemTransfer(getLevel(), + getPos().relative(getOutputFacingItems()), getOutputFacingItems().getOpposite()); if (transfer != null) { stack.setCount(itemsPerCycle); @@ -142,7 +152,8 @@ public void updateItemTick() { } @Override - public InteractionResult onUse(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { + public InteractionResult onUse(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, + BlockHitResult hit) { if (hit.getDirection() == getFrontFacing()) { var held = player.getMainHandItem(); if (!held.isEmpty() && (ItemTransferHelper.canItemStacksStack(held, stored) || stored.isEmpty())) { // push @@ -160,7 +171,8 @@ public InteractionResult onUse(BlockState state, Level world, BlockPos pos, Play public boolean onLeftClick(Player player, Level world, InteractionHand hand, BlockPos pos, Direction direction) { if (direction == getFrontFacing() && !isRemote()) { if (!stored.isEmpty()) { // pull - var drained = cache.extractItem(0, player.isShiftKeyDown() ? stored.getItem().getMaxStackSize() : 1, false); + var drained = cache.extractItem(0, player.isShiftKeyDown() ? stored.getItem().getMaxStackSize() : 1, + false); if (!drained.isEmpty()) { if (player.addItem(drained)) { Block.popResource(world, getPos().relative(getFrontFacing()), drained); diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CreativeEnergyContainerMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CreativeEnergyContainerMachine.java index a32051e679..98f5aa3cfb 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CreativeEnergyContainerMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CreativeEnergyContainerMachine.java @@ -9,6 +9,7 @@ import com.gregtechceu.gtceu.api.machine.MetaMachine; import com.gregtechceu.gtceu.api.machine.feature.IUIMachine; import com.gregtechceu.gtceu.utils.GTUtil; + import com.lowdragmc.lowdraglib.gui.editor.ColorPattern; import com.lowdragmc.lowdraglib.gui.modular.ModularUI; import com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup; @@ -17,18 +18,24 @@ import com.lowdragmc.lowdraglib.gui.widget.*; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; + import org.apache.commons.lang3.ArrayUtils; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.Arrays; + +import javax.annotation.ParametersAreNonnullByDefault; + @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class CreativeEnergyContainerMachine extends MetaMachine implements ILaserContainer, IUIMachine { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(CreativeEnergyContainerMachine.class, MetaMachine.MANAGED_FIELD_HOLDER); + + public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( + CreativeEnergyContainerMachine.class, MetaMachine.MANAGED_FIELD_HOLDER); @Persisted private long voltage = 0; @@ -51,7 +58,7 @@ public CreativeEnergyContainerMachine(IMachineBlockEntity holder) { } ////////////////////////////////////// - //***** Initialization ******// + // ***** Initialization ******// ////////////////////////////////////// @Override public ManagedFieldHolder getFieldHolder() { @@ -65,7 +72,7 @@ public void onLoad() { } ////////////////////////////////////// - //********** MISC ***********// + // ********** MISC ***********// ////////////////////////////////////// protected void updateEnergyTick() { @@ -83,7 +90,8 @@ protected void updateEnergyTick() { int ampsUsed = 0; for (var facing : GTUtil.DIRECTIONS) { var opposite = facing.getOpposite(); - IEnergyContainer container = GTCapabilityHelper.getEnergyContainer(getLevel(), getPos().relative(facing), opposite); + IEnergyContainer container = GTCapabilityHelper.getEnergyContainer(getLevel(), getPos().relative(facing), + opposite); // Try to get laser capability if (container == null) container = GTCapabilityHelper.getLaser(getLevel(), getPos().relative(facing), opposite); @@ -174,7 +182,7 @@ public void setIOSpeed(long energyIOPerSec) { } ////////////////////////////////////// - //*********** GUI ***********// + // *********** GUI ***********// ////////////////////////////////////// @Override @@ -188,21 +196,26 @@ public ModularUI createUI(Player entityPlayer) { setTier = GTUtil.getTierByVoltage(voltage); }).setNumbersOnly(0L, Long.MAX_VALUE)) .widget(new LabelWidget(7, 74, "gtceu.creative.energy.amperage")) - .widget(new ButtonWidget(7, 87, 20, 20, new GuiTextureGroup(ResourceBorderTexture.BUTTON_COMMON, new TextTexture("-")), + .widget(new ButtonWidget(7, 87, 20, 20, + new GuiTextureGroup(ResourceBorderTexture.BUTTON_COMMON, new TextTexture("-")), cd -> amps = --amps == -1 ? 0 : amps)) .widget(new TextFieldWidget(31, 89, 114, 16, () -> String.valueOf(amps), value -> amps = Integer.parseInt(value)).setNumbersOnly(0, Integer.MAX_VALUE)) - .widget(new ButtonWidget(149, 87, 20, 20, new GuiTextureGroup(ResourceBorderTexture.BUTTON_COMMON, new TextTexture("+")), + .widget(new ButtonWidget(149, 87, 20, 20, + new GuiTextureGroup(ResourceBorderTexture.BUTTON_COMMON, new TextTexture("+")), cd -> { if (amps < Integer.MAX_VALUE) { amps++; } })) - .widget(new LabelWidget(7, 110, () -> "Average Energy I/O per tick: " + this.lastAverageEnergyIOPerTick)) + .widget(new LabelWidget(7, 110, + () -> "Average Energy I/O per tick: " + this.lastAverageEnergyIOPerTick)) .widget(new SwitchWidget(7, 139, 77, 20, (clickData, value) -> active = value) .setTexture( - new GuiTextureGroup(ResourceBorderTexture.BUTTON_COMMON, new TextTexture("gtceu.creative.activity.off")), - new GuiTextureGroup(ResourceBorderTexture.BUTTON_COMMON, new TextTexture("gtceu.creative.activity.on"))) + new GuiTextureGroup(ResourceBorderTexture.BUTTON_COMMON, + new TextTexture("gtceu.creative.activity.off")), + new GuiTextureGroup(ResourceBorderTexture.BUTTON_COMMON, + new TextTexture("gtceu.creative.activity.on"))) .setPressed(active)) .widget(new SwitchWidget(85, 139, 77, 20, (clickData, value) -> { source = value; @@ -215,8 +228,11 @@ public ModularUI createUI(Player entityPlayer) { amps = Integer.MAX_VALUE; setTier = 14; } - }).setTexture(new GuiTextureGroup(ResourceBorderTexture.BUTTON_COMMON, new TextTexture("gtceu.creative.energy.sink")), - new GuiTextureGroup(ResourceBorderTexture.BUTTON_COMMON, new TextTexture("gtceu.creative.energy.source"))) + }).setTexture( + new GuiTextureGroup(ResourceBorderTexture.BUTTON_COMMON, + new TextTexture("gtceu.creative.energy.sink")), + new GuiTextureGroup(ResourceBorderTexture.BUTTON_COMMON, + new TextTexture("gtceu.creative.energy.source"))) .setPressed(source)) .widget(new SelectorWidget(7, 7, 30, 20, Arrays.stream(GTValues.VNF).toList(), -1) .setOnChanged(tier -> { @@ -227,7 +243,5 @@ public ModularUI createUI(Player entityPlayer) { .setButtonBackground(ResourceBorderTexture.BUTTON_COMMON) .setBackground(ColorPattern.BLACK.rectTexture()) .setValue(GTValues.VNF[setTier])); - } - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CreativeTankMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CreativeTankMachine.java index caf7b6648f..d7ae641dd9 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CreativeTankMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/CreativeTankMachine.java @@ -4,10 +4,9 @@ import com.gregtechceu.gtceu.api.capability.recipe.IO; import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; -import com.gregtechceu.gtceu.api.machine.MetaMachine; -import com.gregtechceu.gtceu.api.machine.trait.ICapabilityTrait; import com.gregtechceu.gtceu.api.machine.trait.NotifiableFluidTank; import com.gregtechceu.gtceu.api.transfer.fluid.InfiniteFluidTransferProxy; + import com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup; import com.lowdragmc.lowdraglib.gui.texture.ResourceBorderTexture; import com.lowdragmc.lowdraglib.gui.texture.TextTexture; @@ -18,17 +17,21 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DropSaved; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; + import net.minecraft.core.Direction; -import net.minecraftforge.fluids.capability.IFluidHandler; -import org.jetbrains.annotations.NotNull; + import org.jetbrains.annotations.Nullable; public class CreativeTankMachine extends QuantumTankMachine { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(CreativeTankMachine.class, QuantumTankMachine.MANAGED_FIELD_HOLDER); - @Persisted @DropSaved + public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(CreativeTankMachine.class, + QuantumTankMachine.MANAGED_FIELD_HOLDER); + + @Persisted + @DropSaved private int mBPerCycle = 1; - @Persisted @DropSaved + @Persisted + @DropSaved private int ticksPerCycle = 1; private final InfiniteFluidTransferProxy capabilityTransferProxy; @@ -52,12 +55,11 @@ protected NotifiableFluidTank createCacheFluidHandler(Object... args) { return new NotifiableFluidTank(this, 1, 1000, IO.BOTH, IO.NONE); } - @Override protected void updateAutoOutputSubscription() { var outputFacing = getOutputFacingFluids(); - if ((isAutoOutputFluids() && !cache.isEmpty()) && outputFacing != null - && FluidTransferHelper.getFluidTransfer(getLevel(), getPos().relative(outputFacing), outputFacing.getOpposite()) != null) { + if ((isAutoOutputFluids() && !cache.isEmpty()) && outputFacing != null && FluidTransferHelper + .getFluidTransfer(getLevel(), getPos().relative(outputFacing), outputFacing.getOpposite()) != null) { autoOutputSubs = subscribeServerTick(autoOutputSubs, this::checkAutoOutput); } else if (autoOutputSubs != null) { autoOutputSubs.unsubscribe(); @@ -77,8 +79,9 @@ protected void checkAutoOutput() { @Override public WidgetGroup createUIWidget() { var group = new WidgetGroup(0, 0, 176, 131); - group.addWidget(new PhantomFluidWidget(this.cache.getStorages()[0], 0, 36, 6, 18, 18, () -> this.cache.getStorages()[0].getFluid(), (fluid) -> this.cache.getStorages()[0].setFluid(fluid)) - .setShowAmount(false).setBackground(GuiTextures.FLUID_SLOT)); + group.addWidget(new PhantomFluidWidget(this.cache.getStorages()[0], 0, 36, 6, 18, 18, + () -> this.cache.getStorages()[0].getFluid(), (fluid) -> this.cache.getStorages()[0].setFluid(fluid)) + .setShowAmount(false).setBackground(GuiTextures.FLUID_SLOT)); group.addWidget(new LabelWidget(7, 9, "gtceu.creative.tank.fluid")); group.addWidget(new ImageWidget(7, 45, 154, 14, GuiTextures.DISPLAY)); group.addWidget(new TextFieldWidget(9, 47, 152, 10, () -> String.valueOf(mBPerCycle), value -> { @@ -97,19 +100,23 @@ public WidgetGroup createUIWidget() { group.addWidget(new LabelWidget(7, 65, "gtceu.creative.tank.tpc")); group.addWidget(new SwitchWidget(7, 101, 162, 20, (clickData, value) -> setWorkingEnabled(value)) - .setTexture( - new GuiTextureGroup(ResourceBorderTexture.BUTTON_COMMON, new TextTexture("gtceu.creative.activity.off")), - new GuiTextureGroup(ResourceBorderTexture.BUTTON_COMMON, new TextTexture("gtceu.creative.activity.on"))) - .setPressed(isWorkingEnabled())); + .setTexture( + new GuiTextureGroup(ResourceBorderTexture.BUTTON_COMMON, + new TextTexture("gtceu.creative.activity.off")), + new GuiTextureGroup(ResourceBorderTexture.BUTTON_COMMON, + new TextTexture("gtceu.creative.activity.on"))) + .setPressed(isWorkingEnabled())); return group; } public void updateFluidTick() { - if (ticksPerCycle == 0 || getOffsetTimer() % ticksPerCycle != 0 || cache.getStorages()[0].getFluid().isEmpty() || getLevel().isClientSide || !isWorkingEnabled()) + if (ticksPerCycle == 0 || getOffsetTimer() % ticksPerCycle != 0 || + cache.getStorages()[0].getFluid().isEmpty() || getLevel().isClientSide || !isWorkingEnabled()) return; - IFluidTransfer transfer = FluidTransferHelper.getFluidTransfer(getLevel(), getPos().relative(getOutputFacingFluids()), getOutputFacingFluids().getOpposite()); + IFluidTransfer transfer = FluidTransferHelper.getFluidTransfer(getLevel(), + getPos().relative(getOutputFacingFluids()), getOutputFacingFluids().getOpposite()); if (transfer != null) { FluidStack stack = cache.getStorages()[0].getFluid().copy(); stack.setAmount(mBPerCycle); diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/DrumMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/DrumMachine.java index 2d35827425..e142bdf2e0 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/DrumMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/DrumMachine.java @@ -12,7 +12,7 @@ import com.gregtechceu.gtceu.api.machine.feature.IDropSaveMachine; import com.gregtechceu.gtceu.api.machine.feature.IInteractedMachine; import com.gregtechceu.gtceu.api.machine.trait.NotifiableFluidTank; -import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; + import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; import com.lowdragmc.lowdraglib.side.fluid.FluidActionResult; import com.lowdragmc.lowdraglib.side.fluid.FluidHelper; @@ -22,9 +22,9 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.DropSaved; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; +import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import com.mojang.blaze3d.MethodsReturnNonnullByDefault; -import lombok.Getter; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; @@ -41,19 +41,26 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.BlockHitResult; + +import com.mojang.blaze3d.MethodsReturnNonnullByDefault; +import lombok.Getter; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.Set; +import javax.annotation.ParametersAreNonnullByDefault; @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class DrumMachine extends MetaMachine implements IAutoOutputFluid, IDropSaveMachine, IInteractedMachine { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(DrumMachine.class, MetaMachine.MANAGED_FIELD_HOLDER); + public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(DrumMachine.class, + MetaMachine.MANAGED_FIELD_HOLDER); - @Getter @Persisted @DescSynced @RequireRerender + @Getter + @Persisted + @DescSynced + @RequireRerender protected boolean autoOutputFluids; @Getter private final int maxStoredFluids; @@ -63,7 +70,10 @@ public class DrumMachine extends MetaMachine implements IAutoOutputFluid, IDropS protected TickableSubscription autoOutputSubs; @Nullable protected ISubscription exportFluidSubs; - @Persisted(key = "Fluid") @DescSynced @Getter @DropSaved // rename "Fluid" for Item capability + @Persisted(key = "Fluid") + @DescSynced + @Getter + @DropSaved // rename "Fluid" for Item capability protected FluidStack stored = FluidStack.empty(); @Getter protected final Material material; @@ -76,7 +86,7 @@ public DrumMachine(IMachineBlockEntity holder, Material material, int maxStoredF } ////////////////////////////////////// - //***** Initialization *****// + // ***** Initialization *****// ////////////////////////////////////// @Override public ManagedFieldHolder getFieldHolder() { @@ -120,7 +130,7 @@ public void onUnload() { } ////////////////////////////////////// - //****** Fluid Logic *******// + // ****** Fluid Logic *******// ////////////////////////////////////// @Override @@ -150,8 +160,11 @@ public boolean isAllowInputFromOutputSideFluids() { } // always is facing down, and can never accept fluids from output side - @Override public void setAllowInputFromOutputSideFluids(boolean allow) {} - @Override public void setOutputFacingFluids(@Nullable Direction outputFacing) { + @Override + public void setAllowInputFromOutputSideFluids(boolean allow) {} + + @Override + public void setOutputFacingFluids(@Nullable Direction outputFacing) { updateAutoOutputSubscription(); } @@ -168,8 +181,8 @@ public void onNeighborChanged(Block block, BlockPos fromPos, boolean isMoving) { protected void updateAutoOutputSubscription() { var outputFacing = getOutputFacingFluids(); - if ((isAutoOutputFluids() && !cache.isEmpty()) && outputFacing != null - && FluidTransferHelper.getFluidTransfer(getLevel(), getPos().relative(outputFacing), outputFacing.getOpposite()) != null) { + if ((isAutoOutputFluids() && !cache.isEmpty()) && outputFacing != null && FluidTransferHelper + .getFluidTransfer(getLevel(), getPos().relative(outputFacing), outputFacing.getOpposite()) != null) { autoOutputSubs = subscribeServerTick(autoOutputSubs, this::checkAutoOutput); } else if (autoOutputSubs != null) { autoOutputSubs.unsubscribe(); @@ -188,7 +201,8 @@ protected void checkAutoOutput() { @SuppressWarnings("resource") @Override - public InteractionResult onUse(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { + public InteractionResult onUse(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, + BlockHitResult hit) { var currentStack = player.getMainHandItem(); if (!currentStack.isEmpty()) { var handler = FluidTransferHelper.getFluidTransfer(player, InteractionHand.MAIN_HAND); @@ -196,13 +210,16 @@ public InteractionResult onUse(BlockState state, Level world, BlockPos pos, Play if (handler != null && !isRemote()) { if (cache.getStorages()[0].getFluidAmount() > 0) { FluidStack initialFluid = fluidTank.getFluid(); - FluidActionResult result = FluidTransferHelper.tryFillContainer(currentStack, fluidTank, Integer.MAX_VALUE, null, false); + FluidActionResult result = FluidTransferHelper.tryFillContainer(currentStack, fluidTank, + Integer.MAX_VALUE, null, false); if (result.isSuccess()) { - ItemStack remainingStack = FluidTransferHelper.tryFillContainer(currentStack, fluidTank, Integer.MAX_VALUE, null, true).getResult(); + ItemStack remainingStack = FluidTransferHelper + .tryFillContainer(currentStack, fluidTank, Integer.MAX_VALUE, null, true).getResult(); currentStack.shrink(1); SoundEvent soundevent = FluidHelper.getFillSound(initialFluid); if (soundevent != null) { - player.level().playSound(null, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, soundevent, SoundSource.BLOCKS, 1.0F, 1.0F); + player.level().playSound(null, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, + soundevent, SoundSource.BLOCKS, 1.0F, 1.0F); } if (!remainingStack.isEmpty() && !player.addItem(remainingStack)) { Block.popResource(player.level(), player.getOnPos(), remainingStack); @@ -211,13 +228,16 @@ public InteractionResult onUse(BlockState state, Level world, BlockPos pos, Play } } - FluidActionResult result = FluidTransferHelper.tryEmptyContainer(currentStack, fluidTank, Integer.MAX_VALUE, null, false); + FluidActionResult result = FluidTransferHelper.tryEmptyContainer(currentStack, fluidTank, + Integer.MAX_VALUE, null, false); if (result.isSuccess()) { - ItemStack remainingStack = FluidTransferHelper.tryEmptyContainer(currentStack, fluidTank, Integer.MAX_VALUE, null, true).getResult(); + ItemStack remainingStack = FluidTransferHelper + .tryEmptyContainer(currentStack, fluidTank, Integer.MAX_VALUE, null, true).getResult(); currentStack.shrink(1); SoundEvent soundevent = FluidHelper.getEmptySound(fluidTank.getFluid()); if (soundevent != null) { - player.level().playSound(null, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, soundevent, SoundSource.BLOCKS, 1.0F, 1.0F); + player.level().playSound(null, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, soundevent, + SoundSource.BLOCKS, 1.0F, 1.0F); } if (!remainingStack.isEmpty() && !player.getInventory().add(remainingStack)) { Block.popResource(player.level(), player.getOnPos(), remainingStack); @@ -230,11 +250,13 @@ public InteractionResult onUse(BlockState state, Level world, BlockPos pos, Play } @Override - protected InteractionResult onScrewdriverClick(Player playerIn, InteractionHand hand, Direction gridSide, BlockHitResult hitResult) { + protected InteractionResult onScrewdriverClick(Player playerIn, InteractionHand hand, Direction gridSide, + BlockHitResult hitResult) { if (!isRemote()) { if (!playerIn.isShiftKeyDown()) { setAutoOutputFluids(!isAutoOutputFluids()); - playerIn.sendSystemMessage(Component.translatable("gtceu.machine.drum." + (autoOutputFluids ? "enable" : "disable") + "_output")); + playerIn.sendSystemMessage(Component + .translatable("gtceu.machine.drum." + (autoOutputFluids ? "enable" : "disable") + "_output")); return InteractionResult.SUCCESS; } } @@ -242,7 +264,7 @@ protected InteractionResult onScrewdriverClick(Player playerIn, InteractionHand } ////////////////////////////////////// - //******* Rendering ********// + // ******* Rendering ********// ////////////////////////////////////// @Override public ResourceTexture sideTips(Player player, Set toolTypes, Direction side) { diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/LongDistanceEndpointMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/LongDistanceEndpointMachine.java index 0b28a81b01..9ba9c782c7 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/LongDistanceEndpointMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/LongDistanceEndpointMachine.java @@ -9,28 +9,36 @@ import com.gregtechceu.gtceu.api.pipenet.longdistance.LongDistancePipeType; import com.gregtechceu.gtceu.common.item.PortableScannerBehavior; import com.gregtechceu.gtceu.utils.FormattingUtil; + import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import lombok.Getter; -import lombok.Setter; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.network.chat.Component; import net.minecraft.world.level.block.Block; + +import lombok.Getter; +import lombok.Setter; import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.List; import java.util.Objects; +import javax.annotation.Nonnull; + public abstract class LongDistanceEndpointMachine extends MetaMachine implements ILDEndpoint, IDataInfoProvider { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(LongDistanceEndpointMachine.class, MetaMachine.MANAGED_FIELD_HOLDER); + + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( + LongDistanceEndpointMachine.class, MetaMachine.MANAGED_FIELD_HOLDER); @NotNull @Getter private final LongDistancePipeType pipeType; - @Persisted @Getter @Setter + @Persisted + @Getter + @Setter private IO ioType = IO.NONE; private ILDEndpoint link; private boolean placed = false; @@ -190,16 +198,20 @@ public ManagedFieldHolder getFieldHolder() { public List getDataInfo(PortableScannerBehavior.DisplayMode mode) { List textComponents = new ArrayList<>(); - if (mode == PortableScannerBehavior.DisplayMode.SHOW_ALL || mode == PortableScannerBehavior.DisplayMode.SHOW_MACHINE_INFO) { + if (mode == PortableScannerBehavior.DisplayMode.SHOW_ALL || + mode == PortableScannerBehavior.DisplayMode.SHOW_MACHINE_INFO) { LongDistanceNetwork network = LongDistanceNetwork.get(getLevel(), getPos()); if (network == null) { textComponents.add(Component.translatable("block.gtceu.long_distance_item_pipeline_no_network")); } else { textComponents.add(Component.translatable("block.gtceu.long_distance_item_pipeline_network_header")); - textComponents.add(Component.translatable("block.gtceu.long_distance_item_pipeline_pipe_count", FormattingUtil.formatNumbers(network.getTotalSize()))); + textComponents.add(Component.translatable("block.gtceu.long_distance_item_pipeline_pipe_count", + FormattingUtil.formatNumbers(network.getTotalSize()))); ILDEndpoint in = network.getActiveInputIndex(), out = network.getActiveOutputIndex(); - textComponents.add(Component.translatable("block.gtceu.long_distance_item_pipeline_input_pos", Component.literal(in == null ? "none" : in.getPos().toString()))); - textComponents.add(Component.translatable("block.gtceu.long_distance_item_pipeline_output_pos", Component.literal(out == null ? "none" : out.getPos().toString()))); + textComponents.add(Component.translatable("block.gtceu.long_distance_item_pipeline_input_pos", + Component.literal(in == null ? "none" : in.getPos().toString()))); + textComponents.add(Component.translatable("block.gtceu.long_distance_item_pipeline_output_pos", + Component.literal(out == null ? "none" : out.getPos().toString()))); } if (isInput()) { textComponents.add(Component.translatable("block.gtceu.long_distance_item_pipeline_input_endpoint")); @@ -211,4 +223,4 @@ public List getDataInfo(PortableScannerBehavior.DisplayMode mode) { return textComponents; } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/QuantumChestMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/QuantumChestMachine.java index 0ea7a7c345..988fcc086e 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/QuantumChestMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/QuantumChestMachine.java @@ -14,7 +14,7 @@ import com.gregtechceu.gtceu.api.machine.feature.IFancyUIMachine; import com.gregtechceu.gtceu.api.machine.feature.IInteractedMachine; import com.gregtechceu.gtceu.api.machine.trait.NotifiableItemStackHandler; -import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; + import com.lowdragmc.lowdraglib.gui.editor.Icons; import com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup; import com.lowdragmc.lowdraglib.gui.texture.ResourceBorderTexture; @@ -26,10 +26,9 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.DropSaved; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; +import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import com.mojang.blaze3d.MethodsReturnNonnullByDefault; -import lombok.Getter; -import lombok.Setter; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.network.chat.Component; @@ -43,42 +42,70 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.BlockHitResult; + +import com.mojang.blaze3d.MethodsReturnNonnullByDefault; +import lombok.Getter; +import lombok.Setter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.jetbrains.annotations.NotNull; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.Set; +import javax.annotation.ParametersAreNonnullByDefault; + @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault -public class QuantumChestMachine extends TieredMachine implements IAutoOutputItem, IInteractedMachine, IControllable, IDropSaveMachine, IFancyUIMachine { +public class QuantumChestMachine extends TieredMachine implements IAutoOutputItem, IInteractedMachine, IControllable, + IDropSaveMachine, IFancyUIMachine { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(QuantumChestMachine.class, MetaMachine.MANAGED_FIELD_HOLDER); + public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(QuantumChestMachine.class, + MetaMachine.MANAGED_FIELD_HOLDER); - @Getter @Persisted @DescSynced @RequireRerender + @Getter + @Persisted + @DescSynced + @RequireRerender protected Direction outputFacingItems; - @Getter @Persisted @DescSynced @RequireRerender + @Getter + @Persisted + @DescSynced + @RequireRerender protected boolean autoOutputItems; - @Getter @Setter @Persisted + @Getter + @Setter + @Persisted protected boolean allowInputFromOutputSideItems; @Getter private final int maxStoredItems; - @Persisted @DescSynced @DropSaved + @Persisted + @DescSynced + @DropSaved protected int itemsStoredInside = 0; - @Getter @Persisted @DescSynced @DropSaved + @Getter + @Persisted + @DescSynced + @DropSaved protected int storedAmount = 0; - @Getter @Persisted @DescSynced @DropSaved @NotNull + @Getter + @Persisted + @DescSynced + @DropSaved + @NotNull protected ItemStack stored = ItemStack.EMPTY; - @Persisted @DropSaved + @Persisted + @DropSaved protected final NotifiableItemStackHandler cache; @Nullable protected TickableSubscription autoOutputSubs; @Nullable protected ISubscription exportItemSubs; - @Persisted @Getter @Setter + @Persisted + @Getter + @Setter private boolean isVoiding; - @Persisted @DescSynced @Getter + @Persisted + @DescSynced + @Getter private final ItemStackTransfer lockedItem; public QuantumChestMachine(IMachineBlockEntity holder, int tier, int maxStoredItems, Object... args) { @@ -90,7 +117,7 @@ public QuantumChestMachine(IMachineBlockEntity holder, int tier, int maxStoredIt } ////////////////////////////////////// - //***** Initialization ******// + // ***** Initialization ******// ////////////////////////////////////// @Override @@ -116,7 +143,8 @@ public int getSlotLimit(int slot) { } @Override - public @NotNull ItemStack insertItem(int slot, @NotNull ItemStack stack, boolean simulate, boolean notifyChanges) { + public @NotNull ItemStack insertItem(int slot, @NotNull ItemStack stack, boolean simulate, + boolean notifyChanges) { var remained = super.insertItem(slot, stack, simulate, notifyChanges).copy(); if (!remained.isEmpty()) { if (ItemTransferHelper.canItemStacksStack(getStackInSlot(0), remained)) { @@ -144,7 +172,8 @@ public int getSlotLimit(int slot) { itemsStoredInside -= additional; if (getStackInSlot(0).isEmpty() && itemsStoredInside > 0) { var copied = extracted.copy(); - copied.setCount(Math.min(itemsStoredInside, Math.min(64, copied.getItem().getMaxStackSize()))); + copied.setCount( + Math.min(itemsStoredInside, Math.min(64, copied.getItem().getMaxStackSize()))); itemsStoredInside -= copied.getCount(); setStackInSlot(0, copied); } @@ -163,9 +192,8 @@ public void onContentsChanged() { stored.setCount(1); } } - - }.setFilter(itemStack -> !isLocked() || ItemTransferHelper.canItemStacksStack(lockedItem.getStackInSlot(0), itemStack)); - + }.setFilter(itemStack -> !isLocked() || + ItemTransferHelper.canItemStacksStack(lockedItem.getStackInSlot(0), itemStack)); } @Override @@ -192,7 +220,7 @@ public boolean savePickClone() { } ////////////////////////////////////// - //******* Auto Output *******// + // ******* Auto Output *******// ////////////////////////////////////// @Override @@ -225,8 +253,8 @@ public void setWorkingEnabled(boolean isWorkingAllowed) { protected void updateAutoOutputSubscription() { var outputFacing = getOutputFacingItems(); - if ((isAutoOutputItems() && !cache.isEmpty()) && outputFacing != null - && ItemTransferHelper.getItemTransfer(getLevel(), getPos().relative(outputFacing), outputFacing.getOpposite()) != null) { + if ((isAutoOutputItems() && !cache.isEmpty()) && outputFacing != null && ItemTransferHelper + .getItemTransfer(getLevel(), getPos().relative(outputFacing), outputFacing.getOpposite()) != null) { autoOutputSubs = subscribeServerTick(autoOutputSubs, this::checkAutoOutput); } else if (autoOutputSubs != null) { autoOutputSubs.unsubscribe(); @@ -244,7 +272,7 @@ protected void checkAutoOutput() { } ////////////////////////////////////// - //******* Interaction *******// + // ******* Interaction *******// ////////////////////////////////////// @Override @@ -254,7 +282,8 @@ public boolean isFacingValid(Direction facing) { } @Override - public InteractionResult onUse(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { + public InteractionResult onUse(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, + BlockHitResult hit) { if (hit.getDirection() == getFrontFacing()) { var held = player.getMainHandItem(); if (!held.isEmpty() && (ItemTransferHelper.canItemStacksStack(held, stored) || stored.isEmpty())) { // push @@ -272,7 +301,8 @@ public InteractionResult onUse(BlockState state, Level world, BlockPos pos, Play public boolean onLeftClick(Player player, Level world, InteractionHand hand, BlockPos pos, Direction direction) { if (direction == getFrontFacing() && !isRemote()) { if (!stored.isEmpty()) { // pull - var drained = cache.extractItem(0, player.isShiftKeyDown() ? stored.getItem().getMaxStackSize() : 1, false); + var drained = cache.extractItem(0, player.isShiftKeyDown() ? stored.getItem().getMaxStackSize() : 1, + false); if (!drained.isEmpty()) { if (player.addItem(drained)) { Block.popResource(world, getPos().relative(getFrontFacing()), drained); @@ -284,7 +314,8 @@ public boolean onLeftClick(Player player, Level world, InteractionHand hand, Blo } @Override - protected InteractionResult onWrenchClick(Player playerIn, InteractionHand hand, Direction gridSide, BlockHitResult hitResult) { + protected InteractionResult onWrenchClick(Player playerIn, InteractionHand hand, Direction gridSide, + BlockHitResult hitResult) { if (!playerIn.isShiftKeyDown() && !isRemote()) { var tool = playerIn.getItemInHand(hand); if (tool.getDamageValue() >= tool.getMaxDamage()) return InteractionResult.PASS; @@ -302,15 +333,20 @@ protected InteractionResult onWrenchClick(Player playerIn, InteractionHand hand, } @Override - protected InteractionResult onScrewdriverClick(Player playerIn, InteractionHand hand, Direction gridSide, BlockHitResult hitResult) { + protected InteractionResult onScrewdriverClick(Player playerIn, InteractionHand hand, Direction gridSide, + BlockHitResult hitResult) { if (!isRemote()) { if (gridSide == getOutputFacingItems()) { if (isAllowInputFromOutputSideItems()) { setAllowInputFromOutputSideItems(false); - playerIn.sendSystemMessage(Component.translatable("gtceu.machine.basic.input_from_output_side.disallow").append(Component.translatable("gtceu.creative.chest.item"))); + playerIn.sendSystemMessage( + Component.translatable("gtceu.machine.basic.input_from_output_side.disallow") + .append(Component.translatable("gtceu.creative.chest.item"))); } else { setAllowInputFromOutputSideItems(true); - playerIn.sendSystemMessage(Component.translatable("gtceu.machine.basic.input_from_output_side.allow").append(Component.translatable("gtceu.creative.chest.item"))); + playerIn.sendSystemMessage( + Component.translatable("gtceu.machine.basic.input_from_output_side.allow") + .append(Component.translatable("gtceu.creative.chest.item"))); } } return InteractionResult.SUCCESS; @@ -334,7 +370,7 @@ protected void setLocked(boolean locked) { } ////////////////////////////////////// - //*********** GUI ***********// + // *********** GUI ***********// ////////////////////////////////////// public Widget createUIWidget() { @@ -343,8 +379,9 @@ public Widget createUIWidget() { importItems.setFilter(itemStack -> { var item = cache.getStackInSlot(0); return (maxStoredItems - storedAmount) > itemStack.getCount() && - ((item.isEmpty() && (!isLocked() || ItemTransferHelper.canItemStacksStack(itemStack, getLockedItem().getStackInSlot(0)))) - || ItemTransferHelper.canItemStacksStack(itemStack, item)); + ((item.isEmpty() && (!isLocked() || + ItemTransferHelper.canItemStacksStack(itemStack, getLockedItem().getStackInSlot(0)))) || + ItemTransferHelper.canItemStacksStack(itemStack, item)); }); importItems.setOnContentsChanged(() -> { var item = importItems.getStackInSlot(0).copy(); @@ -373,17 +410,19 @@ public Widget createUIWidget() { }) .setBackgroundTexture(GuiTextures.SLOT)) .addWidget(new ButtonWidget(87, 42, 18, 18, - new GuiTextureGroup(ResourceBorderTexture.BUTTON_COMMON, Icons.DOWN.scale(0.7f)),cd -> { - if (!cd.isRemote) { - var stored = cache.getStackInSlot(0); - if (!stored.isEmpty()) { - var extracted = cache.extractItem(0, Math.min(stored.getCount(), stored.getItem().getMaxStackSize()), false); - if (!group.getGui().entityPlayer.addItem(extracted)) { - Block.popResource(group.getGui().entityPlayer.level(), group.getGui().entityPlayer.getOnPos(), extracted); + new GuiTextureGroup(ResourceBorderTexture.BUTTON_COMMON, Icons.DOWN.scale(0.7f)), cd -> { + if (!cd.isRemote) { + var stored = cache.getStackInSlot(0); + if (!stored.isEmpty()) { + var extracted = cache.extractItem(0, + Math.min(stored.getCount(), stored.getItem().getMaxStackSize()), false); + if (!group.getGui().entityPlayer.addItem(extracted)) { + Block.popResource(group.getGui().entityPlayer.level(), + group.getGui().entityPlayer.getOnPos(), extracted); + } + } } - } - } - })) + })) .addWidget(new PhantomSlotWidget(lockedItem, 0, 58, 41)) .addWidget(new ToggleButtonWidget(4, 41, 18, 18, GuiTextures.BUTTON_ITEM_OUTPUT, this::isAutoOutputItems, this::setAutoOutputItems) @@ -402,7 +441,7 @@ public Widget createUIWidget() { } ////////////////////////////////////// - //******* Rendering ********// + // ******* Rendering ********// ////////////////////////////////////// @Override public ResourceTexture sideTips(Player player, Set toolTypes, Direction side) { diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/QuantumTankMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/QuantumTankMachine.java index eddc2189f9..f49cbf5d7c 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/storage/QuantumTankMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/storage/QuantumTankMachine.java @@ -14,11 +14,10 @@ import com.gregtechceu.gtceu.api.machine.feature.IFancyUIMachine; import com.gregtechceu.gtceu.api.machine.feature.IInteractedMachine; import com.gregtechceu.gtceu.api.machine.trait.NotifiableFluidTank; -import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; + import com.lowdragmc.lowdraglib.gui.editor.ColorPattern; import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; import com.lowdragmc.lowdraglib.gui.widget.*; -import com.lowdragmc.lowdraglib.misc.FluidStorage; import com.lowdragmc.lowdraglib.side.fluid.FluidActionResult; import com.lowdragmc.lowdraglib.side.fluid.FluidHelper; import com.lowdragmc.lowdraglib.side.fluid.FluidStack; @@ -27,10 +26,9 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.DropSaved; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; +import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import com.mojang.blaze3d.MethodsReturnNonnullByDefault; -import lombok.Getter; -import lombok.Setter; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.network.chat.Component; @@ -46,35 +44,56 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.BlockHitResult; + +import com.mojang.blaze3d.MethodsReturnNonnullByDefault; +import lombok.Getter; +import lombok.Setter; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.Set; +import javax.annotation.ParametersAreNonnullByDefault; + @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault -public class QuantumTankMachine extends TieredMachine implements IAutoOutputFluid, IInteractedMachine, IControllable, IDropSaveMachine, IFancyUIMachine { +public class QuantumTankMachine extends TieredMachine implements IAutoOutputFluid, IInteractedMachine, IControllable, + IDropSaveMachine, IFancyUIMachine { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(QuantumTankMachine.class, MetaMachine.MANAGED_FIELD_HOLDER); + public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(QuantumTankMachine.class, + MetaMachine.MANAGED_FIELD_HOLDER); - @Getter @Persisted @DescSynced @RequireRerender + @Getter + @Persisted + @DescSynced + @RequireRerender protected Direction outputFacingFluids; - @Getter @Persisted @DescSynced @RequireRerender + @Getter + @Persisted + @DescSynced + @RequireRerender protected boolean autoOutputFluids; - @Getter @Setter @Persisted + @Getter + @Setter + @Persisted protected boolean allowInputFromOutputSideFluids; @Getter private final long maxStoredFluids; @Getter - @Persisted @DropSaved + @Persisted + @DropSaved protected final NotifiableFluidTank cache; @Nullable protected TickableSubscription autoOutputSubs; @Nullable protected ISubscription exportFluidSubs; - @Persisted @DescSynced @Getter @DropSaved + @Persisted + @DescSynced + @Getter + @DropSaved protected FluidStack stored = FluidStack.empty(); - @Persisted @Getter @Setter + @Persisted + @Getter + @Setter private boolean isVoiding; public QuantumTankMachine(IMachineBlockEntity holder, int tier, long maxStoredFluids, Object... args) { @@ -85,7 +104,7 @@ public QuantumTankMachine(IMachineBlockEntity holder, int tier, long maxStoredFl } ////////////////////////////////////// - //***** Initialization ******// + // ***** Initialization ******// ////////////////////////////////////// @Override @@ -95,6 +114,7 @@ public ManagedFieldHolder getFieldHolder() { protected NotifiableFluidTank createCacheFluidHandler(Object... args) { return new NotifiableFluidTank(this, 1, maxStoredFluids, IO.BOTH) { + @Override public long fill(FluidStack resource, boolean simulate, boolean notifyChanges) { return handleVoiding(super.fill(resource, simulate, notifyChanges), resource); @@ -108,7 +128,6 @@ public long fill(int tank, FluidStack resource, boolean simulate, boolean notify @Override public long fill(FluidStack resource, boolean simulate) { return handleVoiding(super.fill(resource, simulate), resource); - } private long handleVoiding(long filled, FluidStack resource) { @@ -153,7 +172,7 @@ public boolean savePickClone() { } ////////////////////////////////////// - //******* Auto Output *******// + // ******* Auto Output *******// ////////////////////////////////////// @Override @@ -186,8 +205,8 @@ public void onNeighborChanged(Block block, BlockPos fromPos, boolean isMoving) { protected void updateAutoOutputSubscription() { var outputFacing = getOutputFacingFluids(); - if ((isAutoOutputFluids() && !cache.isEmpty()) && outputFacing != null - && FluidTransferHelper.getFluidTransfer(getLevel(), getPos().relative(outputFacing), outputFacing.getOpposite()) != null) { + if ((isAutoOutputFluids() && !cache.isEmpty()) && outputFacing != null && FluidTransferHelper + .getFluidTransfer(getLevel(), getPos().relative(outputFacing), outputFacing.getOpposite()) != null) { autoOutputSubs = subscribeServerTick(autoOutputSubs, this::checkAutoOutput); } else if (autoOutputSubs != null) { autoOutputSubs.unsubscribe(); @@ -205,7 +224,7 @@ protected void checkAutoOutput() { } ////////////////////////////////////// - //******* Interaction *******// + // ******* Interaction *******// ////////////////////////////////////// @Override @@ -215,7 +234,8 @@ public boolean isFacingValid(Direction facing) { } @Override - public InteractionResult onUse(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { + public InteractionResult onUse(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, + BlockHitResult hit) { var currentStack = player.getMainHandItem(); if (hit.getDirection() == getFrontFacing() && !currentStack.isEmpty()) { var handler = FluidTransferHelper.getFluidTransfer(player, InteractionHand.MAIN_HAND); @@ -223,13 +243,16 @@ public InteractionResult onUse(BlockState state, Level world, BlockPos pos, Play if (handler != null && !isRemote()) { if (cache.getStorages()[0].getFluidAmount() > 0) { FluidStack initialFluid = fluidTank.getFluid(); - FluidActionResult result = FluidTransferHelper.tryFillContainer(currentStack, fluidTank, Integer.MAX_VALUE, null, false); + FluidActionResult result = FluidTransferHelper.tryFillContainer(currentStack, fluidTank, + Integer.MAX_VALUE, null, false); if (result.isSuccess()) { - ItemStack remainingStack = FluidTransferHelper.tryFillContainer(currentStack, fluidTank, Integer.MAX_VALUE, null, true).getResult(); + ItemStack remainingStack = FluidTransferHelper + .tryFillContainer(currentStack, fluidTank, Integer.MAX_VALUE, null, true).getResult(); currentStack.shrink(1); SoundEvent soundevent = FluidHelper.getFillSound(initialFluid); if (soundevent != null) { - player.level().playSound(null, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, soundevent, SoundSource.BLOCKS, 1.0F, 1.0F); + player.level().playSound(null, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, + soundevent, SoundSource.BLOCKS, 1.0F, 1.0F); } if (!remainingStack.isEmpty() && !player.addItem(remainingStack)) { Block.popResource(player.level(), player.getOnPos(), remainingStack); @@ -238,13 +261,16 @@ public InteractionResult onUse(BlockState state, Level world, BlockPos pos, Play } } - FluidActionResult result = FluidTransferHelper.tryEmptyContainer(currentStack, fluidTank, Integer.MAX_VALUE, null, false); + FluidActionResult result = FluidTransferHelper.tryEmptyContainer(currentStack, fluidTank, + Integer.MAX_VALUE, null, false); if (result.isSuccess()) { - ItemStack remainingStack = FluidTransferHelper.tryEmptyContainer(currentStack, fluidTank, Integer.MAX_VALUE, null, true).getResult(); + ItemStack remainingStack = FluidTransferHelper + .tryEmptyContainer(currentStack, fluidTank, Integer.MAX_VALUE, null, true).getResult(); currentStack.shrink(1); SoundEvent soundevent = FluidHelper.getEmptySound(fluidTank.getFluid()); if (soundevent != null) { - player.level().playSound(null, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, soundevent, SoundSource.BLOCKS, 1.0F, 1.0F); + player.level().playSound(null, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, soundevent, + SoundSource.BLOCKS, 1.0F, 1.0F); } if (!remainingStack.isEmpty() && !player.getInventory().add(remainingStack)) { Block.popResource(player.level(), player.getOnPos(), remainingStack); @@ -257,7 +283,8 @@ public InteractionResult onUse(BlockState state, Level world, BlockPos pos, Play } @Override - protected InteractionResult onWrenchClick(Player playerIn, InteractionHand hand, Direction gridSide, BlockHitResult hitResult) { + protected InteractionResult onWrenchClick(Player playerIn, InteractionHand hand, Direction gridSide, + BlockHitResult hitResult) { if (!playerIn.isShiftKeyDown() && !isRemote()) { var tool = playerIn.getItemInHand(hand); if (tool.getDamageValue() >= tool.getMaxDamage()) return InteractionResult.PASS; @@ -274,15 +301,20 @@ protected InteractionResult onWrenchClick(Player playerIn, InteractionHand hand, } @Override - protected InteractionResult onScrewdriverClick(Player playerIn, InteractionHand hand, Direction gridSide, BlockHitResult hitResult) { + protected InteractionResult onScrewdriverClick(Player playerIn, InteractionHand hand, Direction gridSide, + BlockHitResult hitResult) { if (!isRemote()) { if (gridSide == getOutputFacingFluids()) { if (isAllowInputFromOutputSideFluids()) { setAllowInputFromOutputSideFluids(false); - playerIn.sendSystemMessage(Component.translatable("gtceu.machine.basic.input_from_output_side.disallow").append(Component.translatable("gtceu.creative.chest.fluid"))); + playerIn.sendSystemMessage( + Component.translatable("gtceu.machine.basic.input_from_output_side.disallow") + .append(Component.translatable("gtceu.creative.chest.fluid"))); } else { setAllowInputFromOutputSideFluids(true); - playerIn.sendSystemMessage(Component.translatable("gtceu.machine.basic.input_from_output_side.allow").append(Component.translatable("gtceu.creative.chest.fluid"))); + playerIn.sendSystemMessage( + Component.translatable("gtceu.machine.basic.input_from_output_side.allow") + .append(Component.translatable("gtceu.creative.chest.fluid"))); } } return InteractionResult.SUCCESS; @@ -305,18 +337,19 @@ protected void setLocked(boolean locked) { } ////////////////////////////////////// - //*********** GUI ***********// + // *********** GUI ***********// ////////////////////////////////////// public Widget createUIWidget() { var group = new WidgetGroup(0, 0, 90, 63); group.addWidget(new ImageWidget(4, 4, 82, 55, GuiTextures.DISPLAY)) .addWidget(new LabelWidget(8, 8, "gtceu.gui.fluid_amount")) - .addWidget(new LabelWidget(8, 18, () -> - String.valueOf(cache.getFluidInTank(0).getAmount() / (FluidHelper.getBucket() / 1000)) - ).setTextColor(-1).setDropShadow(true)) + .addWidget(new LabelWidget(8, 18, + () -> String.valueOf(cache.getFluidInTank(0).getAmount() / (FluidHelper.getBucket() / 1000))) + .setTextColor(-1).setDropShadow(true)) .addWidget(new TankWidget(cache.getStorages()[0], 68, 23, true, true) .setBackground(GuiTextures.FLUID_SLOT)) - .addWidget(new PhantomFluidWidget(cache.getLockedFluid(), 0, 68, 41, 18, 18, () -> cache.getLockedFluid().getFluid(), (fluid) -> cache.getLockedFluid().setFluid(fluid)) + .addWidget(new PhantomFluidWidget(cache.getLockedFluid(), 0, 68, 41, 18, 18, + () -> cache.getLockedFluid().getFluid(), (fluid) -> cache.getLockedFluid().setFluid(fluid)) .setShowAmount(false) .setBackground(ColorPattern.T_GRAY.rectTexture())) .addWidget(new ToggleButtonWidget(4, 41, 18, 18, @@ -336,7 +369,7 @@ public Widget createUIWidget() { } ////////////////////////////////////// - //******* Rendering ********// + // ******* Rendering ********// ////////////////////////////////////// @Override public ResourceTexture sideTips(Player player, Set toolTypes, Direction side) { diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/trait/BedrockOreMinerLogic.java b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/BedrockOreMinerLogic.java index 313bc18bd8..10a4f40d2c 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/trait/BedrockOreMinerLogic.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/BedrockOreMinerLogic.java @@ -14,12 +14,14 @@ import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.data.recipe.builder.GTRecipeBuilder; import com.gregtechceu.gtceu.utils.GTUtil; -import lombok.Getter; + import net.minecraft.core.SectionPos; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.item.ItemStack; +import lombok.Getter; import org.jetbrains.annotations.Nullable; + import java.util.List; import java.util.Map; @@ -29,9 +31,11 @@ * @implNote FluidDrillLogic */ public class BedrockOreMinerLogic extends RecipeLogic { + public static final int MAX_PROGRESS = 20; - @Getter @Nullable + @Getter + @Nullable private List> veinMaterials; public BedrockOreMinerLogic(BedrockOreMinerMachine machine) { @@ -40,7 +44,7 @@ public BedrockOreMinerLogic(BedrockOreMinerMachine machine) { @Override public BedrockOreMinerMachine getMachine() { - return (BedrockOreMinerMachine)super.getMachine(); + return (BedrockOreMinerMachine) super.getMachine(); } @Override @@ -71,12 +75,30 @@ public void findAndHandleRecipe() { @Nullable private GTRecipe getOreMinerRecipe() { if (getMachine().getLevel() instanceof ServerLevel serverLevel && veinMaterials != null) { - Material material = veinMaterials.get(GTUtil.getRandomItem(serverLevel.random, veinMaterials, veinMaterials.size())).getValue(); - ItemStack stack = ChemicalHelper.get(TagPrefix.get(ConfigHolder.INSTANCE.machines.bedrockOreDropTagPrefix), material, getOreToProduce()); - if (stack.isEmpty()) stack = ChemicalHelper.get(TagPrefix.crushed, material, getOreToProduce()); // backup 1: crushed; if raw ore doesn't exist - if (stack.isEmpty()) stack = ChemicalHelper.get(TagPrefix.gem, material, getOreToProduce()); // backup 2: gem; if crushed ore doesn't exist - if (stack.isEmpty()) stack = ChemicalHelper.get(TagPrefix.ore, material, getOreToProduce()); // backup 3: normal ore; if gem doesn't exist. - if (stack.isEmpty()) stack = ChemicalHelper.get(TagPrefix.dust, material, getOreToProduce()); // backup 4: fallback to dust + Material material = veinMaterials + .get(GTUtil.getRandomItem(serverLevel.random, veinMaterials, veinMaterials.size())).getValue(); + ItemStack stack = ChemicalHelper.get(TagPrefix.get(ConfigHolder.INSTANCE.machines.bedrockOreDropTagPrefix), + material, getOreToProduce()); + if (stack.isEmpty()) stack = ChemicalHelper.get(TagPrefix.crushed, material, getOreToProduce()); // backup + // 1: + // crushed; + // if raw + // ore + // doesn't + // exist + if (stack.isEmpty()) stack = ChemicalHelper.get(TagPrefix.gem, material, getOreToProduce()); // backup 2: + // gem; if + // crushed ore + // doesn't + // exist + if (stack.isEmpty()) stack = ChemicalHelper.get(TagPrefix.ore, material, getOreToProduce()); // backup 3: + // normal ore; + // if gem + // doesn't + // exist. + if (stack.isEmpty()) stack = ChemicalHelper.get(TagPrefix.dust, material, getOreToProduce()); // backup 4: + // fallback to + // dust if (stack.isEmpty()) { return null; } @@ -99,7 +121,8 @@ private int getOreToProduce(OreVeinWorldEntry entry) { int regularYield = entry.getOreYield(); int remainingOperations = entry.getOperationsRemaining(); - int produced = Math.max(depletedYield, regularYield * remainingOperations / BedrockOreVeinSavedData.MAXIMUM_VEIN_OPERATIONS); + int produced = Math.max(depletedYield, + regularYield * remainingOperations / BedrockOreVeinSavedData.MAXIMUM_VEIN_OPERATIONS); produced *= BedrockOreMinerMachine.getRigMultiplier(getMachine().getTier()); // Overclocks produce 50% more ore @@ -163,5 +186,4 @@ private int getChunkX() { private int getChunkZ() { return SectionPos.blockToSectionCoord(getMachine().getPos().getZ()); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/trait/CleanroomLogic.java b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/CleanroomLogic.java index 7fc38464d5..01cd101387 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/trait/CleanroomLogic.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/CleanroomLogic.java @@ -8,25 +8,33 @@ import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; import com.gregtechceu.gtceu.common.machine.multiblock.electric.CleanroomMachine; import com.gregtechceu.gtceu.config.ConfigHolder; + import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; + +import net.minecraft.network.chat.Component; + import lombok.Getter; import lombok.Setter; -import net.minecraft.network.chat.Component; import org.jetbrains.annotations.Nullable; public class CleanroomLogic extends RecipeLogic implements IWorkable { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(CleanroomLogic.class, RecipeLogic.MANAGED_FIELD_HOLDER); + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(CleanroomLogic.class, + RecipeLogic.MANAGED_FIELD_HOLDER); public static final int BASE_CLEAN_AMOUNT = 5; - @Setter @Nullable + @Setter + @Nullable private IMaintenanceMachine maintenanceMachine; - @Setter @Nullable + @Setter + @Nullable private IEnergyContainer energyContainer; /** * whether the cleanroom was active and needs an update */ - @Getter @Setter @Persisted + @Getter + @Setter + @Persisted private boolean isActiveAndNeedsUpdate; public CleanroomLogic(CleanroomMachine machine) { @@ -66,7 +74,8 @@ public void serverTick() { adjustCleanAmount(true); } - setWaiting(Component.translatable("gtceu.recipe_logic.insufficient_in").append(": ").append(EURecipeCapability.CAP.getName())); + setWaiting(Component.translatable("gtceu.recipe_logic.insufficient_in").append(": ") + .append(EURecipeCapability.CAP.getName())); return; } // increase progress @@ -85,7 +94,7 @@ public void serverTick() { } else { // has all maintenance problems if (progress > 0) { - progress --; + progress--; } if (machine.self().getOffsetTimer() % duration == 0) { adjustCleanAmount(true); @@ -117,7 +126,8 @@ protected void adjustCleanAmount(boolean declined) { protected boolean consumeEnergy() { var cleanroom = getMachine(); - long energyToDrain = cleanroom.isClean() ? (long) Math.min(4, Math.pow(4, cleanroom.getTier())) : GTValues.VA[cleanroom.getTier()]; + long energyToDrain = cleanroom.isClean() ? (long) Math.min(4, Math.pow(4, cleanroom.getTier())) : + GTValues.VA[cleanroom.getTier()]; if (energyContainer != null) { long resultEnergy = energyContainer.getEnergyStored() - energyToDrain; if (resultEnergy >= 0L && resultEnergy <= energyContainer.getEnergyCapacity()) { @@ -133,10 +143,11 @@ protected int getTierDifference() { return getMachine().getTier() - minEnergyTier; } - /** max progress is based on the dimensions of the structure: (x^3)-(x^2) - /* taller cleanrooms take longer than wider ones - /* minimum of 100 is a 5x5x5 cleanroom: 125-25=100 ticks - **/ + /** + * max progress is based on the dimensions of the structure: (x^3)-(x^2) + * /* taller cleanrooms take longer than wider ones + * /* minimum of 100 is a 5x5x5 cleanroom: 125-25=100 ticks + **/ public void setDuration(int max) { this.duration = max; } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/trait/ConverterTrait.java b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/ConverterTrait.java index 3ef5a25909..503d071cf7 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/trait/ConverterTrait.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/ConverterTrait.java @@ -5,22 +5,28 @@ import com.gregtechceu.gtceu.api.capability.IPlatformEnergyStorage; import com.gregtechceu.gtceu.api.capability.PlatformEnergyCompat; import com.gregtechceu.gtceu.api.machine.trait.NotifiableEnergyContainer; -import com.lowdragmc.lowdraglib.syncdata.annotation.RequireRerender; import com.gregtechceu.gtceu.common.machine.electric.ConverterMachine; + 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 lombok.Getter; public class ConverterTrait extends NotifiableEnergyContainer implements IPlatformEnergyStorage { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(ConverterTrait.class, NotifiableEnergyContainer.MANAGED_FIELD_HOLDER); + public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(ConverterTrait.class, + NotifiableEnergyContainer.MANAGED_FIELD_HOLDER); /** * If TRUE, the front facing of the machine will OUTPUT EU, other sides INPUT FE. * If FALSE, the front facing of the machine will OUTPUT FE, other sides INPUT EU. */ - @Getter @Persisted @DescSynced @RequireRerender + @Getter + @Persisted + @DescSynced + @RequireRerender private boolean feToEu; @Getter private final int amps; @@ -28,7 +34,8 @@ public class ConverterTrait extends NotifiableEnergyContainer implements IPlatfo private final long voltage; public ConverterTrait(ConverterMachine machine, int amps) { - super(machine, GTValues.V[machine.getTier()] * 16 * amps, GTValues.V[machine.getTier()], amps, GTValues.V[machine.getTier()], amps); + super(machine, GTValues.V[machine.getTier()] * 16 * amps, GTValues.V[machine.getTier()], amps, + GTValues.V[machine.getTier()], amps); this.amps = amps; this.voltage = GTValues.V[machine.getTier()]; setSideInputCondition(side -> !this.feToEu && side != this.getMachine().getFrontFacing()); @@ -36,7 +43,7 @@ public ConverterTrait(ConverterMachine machine, int amps) { } ////////////////////////////////////// - //***** Initialization ******// + // ***** Initialization ******// ////////////////////////////////////// @Override public ManagedFieldHolder getFieldHolder() { @@ -49,7 +56,7 @@ public void setFeToEu(boolean feToEu) { } ////////////////////////////////////// - //********* logic *********// + // ********* logic *********// ////////////////////////////////////// public void checkOutputSubscription() { outputSubs = getMachine().subscribeServerTick(outputSubs, this::serverTick); @@ -61,9 +68,11 @@ public void serverTick() { super.serverTick(); } else { // output fe var fontFacing = machine.getFrontFacing(); - var energyContainer = GTCapabilityHelper.getPlatformEnergy(machine.getLevel(), machine.getPos().relative(fontFacing), fontFacing.getOpposite()); + var energyContainer = GTCapabilityHelper.getPlatformEnergy(machine.getLevel(), + machine.getPos().relative(fontFacing), fontFacing.getOpposite()); if (energyContainer != null && energyContainer.supportsInsertion()) { - var energyUsed = PlatformEnergyCompat.insertEu(energyContainer, Math.min(getEnergyStored(), voltage * amps)); + var energyUsed = PlatformEnergyCompat.insertEu(energyContainer, + Math.min(getEnergyStored(), voltage * amps)); if (energyUsed > 0) { setEnergyStored(getEnergyStored() - energyUsed); } @@ -72,7 +81,7 @@ public void serverTick() { } ////////////////////////////////////// - //**** PlatformEnergy *****// + // **** PlatformEnergy *****// ////////////////////////////////////// @Override public boolean supportsInsertion() { diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/trait/FluidDrillLogic.java b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/FluidDrillLogic.java index 6915649e2a..9ce99dc2b3 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/trait/FluidDrillLogic.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/FluidDrillLogic.java @@ -9,13 +9,15 @@ import com.gregtechceu.gtceu.api.recipe.content.ContentModifier; import com.gregtechceu.gtceu.common.machine.multiblock.electric.FluidDrillMachine; import com.gregtechceu.gtceu.data.recipe.builder.GTRecipeBuilder; + import com.lowdragmc.lowdraglib.side.fluid.FluidHelper; import com.lowdragmc.lowdraglib.side.fluid.FluidStack; -import lombok.Getter; + import net.minecraft.core.SectionPos; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.material.Fluid; +import lombok.Getter; import org.jetbrains.annotations.Nullable; /** @@ -24,9 +26,11 @@ * @implNote FluidDrillLogic */ public class FluidDrillLogic extends RecipeLogic { + public static final int MAX_PROGRESS = 20; - @Getter @Nullable + @Getter + @Nullable private Fluid veinFluid; public FluidDrillLogic(FluidDrillMachine machine) { @@ -35,7 +39,7 @@ public FluidDrillLogic(FluidDrillMachine machine) { @Override public FluidDrillMachine getMachine() { - return (FluidDrillMachine)super.getMachine(); + return (FluidDrillMachine) super.getMachine(); } @Override @@ -70,7 +74,8 @@ private GTRecipe getFluidDrillRecipe() { var recipe = GTRecipeBuilder.ofRaw() .duration(MAX_PROGRESS) .EUt(GTValues.VA[getMachine().getEnergyTier()]) - .outputFluids(FluidStack.create(veinFluid, getFluidToProduce(data.getFluidVeinWorldEntry(getChunkX(), getChunkZ())))) + .outputFluids(FluidStack.create(veinFluid, + getFluidToProduce(data.getFluidVeinWorldEntry(getChunkX(), getChunkZ())))) .buildRawRecipe(); if (recipe.matchRecipe(getMachine()).isSuccess() && recipe.matchTickRecipe(getMachine()).isSuccess()) { return recipe; @@ -94,7 +99,8 @@ private long getFluidToProduce(FluidVeinWorldEntry entry) { int regularYield = entry.getFluidYield(); int remainingOperations = entry.getOperationsRemaining(); - int produced = Math.max(depletedYield, regularYield * remainingOperations / BedrockFluidVeinSavedData.MAXIMUM_VEIN_OPERATIONS); + int produced = Math.max(depletedYield, + regularYield * remainingOperations / BedrockFluidVeinSavedData.MAXIMUM_VEIN_OPERATIONS); produced *= FluidDrillMachine.getRigMultiplier(getMachine().getTier()); // Overclocks produce 50% more fluid @@ -150,5 +156,4 @@ private int getChunkX() { private int getChunkZ() { return SectionPos.blockToSectionCoord(getMachine().getPos().getZ()); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/trait/NotifiableStressTrait.java b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/NotifiableStressTrait.java index 9905c424d7..a8b00997f1 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/trait/NotifiableStressTrait.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/NotifiableStressTrait.java @@ -9,10 +9,13 @@ import com.gregtechceu.gtceu.api.machine.trait.NotifiableRecipeHandlerTrait; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.common.machine.kinetic.IKineticMachine; + import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; + +import net.minecraft.util.Mth; + import lombok.Getter; import lombok.Setter; -import net.minecraft.util.Mth; import org.jetbrains.annotations.Nullable; import java.util.Collections; @@ -25,7 +28,8 @@ */ public class NotifiableStressTrait extends NotifiableRecipeHandlerTrait implements ICapabilityTrait { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(NotifiableStressTrait.class, NotifiableRecipeHandlerTrait.MANAGED_FIELD_HOLDER); + public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(NotifiableStressTrait.class, + NotifiableRecipeHandlerTrait.MANAGED_FIELD_HOLDER); @Getter @Setter @@ -58,7 +62,8 @@ public void onMachineLoad() { } @Override - public List handleRecipeInner(IO io, GTRecipe recipe, List left, @Nullable String slotName, boolean simulate) { + public List handleRecipeInner(IO io, GTRecipe recipe, List left, @Nullable String slotName, + boolean simulate) { if (machine instanceof IKineticMachine kineticMachine) { float sum = left.stream().reduce(0f, Float::sum); var kineticDefinition = kineticMachine.getKineticDefinition(); diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/trait/miner/LargeMinerLogic.java b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/miner/LargeMinerLogic.java index 1b1f63eb09..cd645a87eb 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/trait/miner/LargeMinerLogic.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/miner/LargeMinerLogic.java @@ -3,10 +3,10 @@ import com.gregtechceu.gtceu.api.data.chemical.ChemicalHelper; import com.gregtechceu.gtceu.api.data.tag.TagPrefix; import com.gregtechceu.gtceu.api.machine.feature.IRecipeLogicMachine; + import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import lombok.Getter; -import lombok.Setter; + import net.minecraft.core.BlockPos; import net.minecraft.core.NonNullList; import net.minecraft.server.level.ServerLevel; @@ -21,16 +21,23 @@ import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; +import lombok.Getter; +import lombok.Setter; import org.jetbrains.annotations.NotNull; + import java.util.List; public class LargeMinerLogic extends MinerLogic { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(LargeMinerLogic.class, MinerLogic.MANAGED_FIELD_HOLDER); + + public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(LargeMinerLogic.class, + MinerLogic.MANAGED_FIELD_HOLDER); private static final int CHUNK_LENGTH = 16; - @Setter @Getter + @Setter + @Getter private int voltageTier; - @Getter @Setter + @Getter + @Setter private int overclockAmount = 0; @Getter @@ -43,10 +50,10 @@ public class LargeMinerLogic extends MinerLogic { /** * Creates the logic for multiblock ore block miners * - * @param machine the {@link IRecipeLogicMachine} this logic belongs to - * @param fortune the fortune amount to apply when mining ores - * @param speed the speed in ticks per block mined - * @param maximumRadius the maximum radius (square shaped) the miner can mine in + * @param machine the {@link IRecipeLogicMachine} this logic belongs to + * @param fortune the fortune amount to apply when mining ores + * @param speed the speed in ticks per block mined + * @param maximumRadius the maximum radius (square shaped) the miner can mine in */ public LargeMinerLogic(IRecipeLogicMachine machine, int fortune, int speed, int maximumRadius) { super(machine, fortune, speed, maximumRadius); @@ -64,7 +71,8 @@ public void initPos(@NotNull BlockPos pos, int currentRadius) { } else { ServerLevel world = (ServerLevel) this.getMachine().getLevel(); ChunkAccess origin = world.getChunk(pos); - ChunkPos startPos = (world.getChunk(origin.getPos().x - currentRadius / CHUNK_LENGTH, origin.getPos().z - currentRadius / CHUNK_LENGTH)).getPos(); + ChunkPos startPos = (world.getChunk(origin.getPos().x - currentRadius / CHUNK_LENGTH, + origin.getPos().z - currentRadius / CHUNK_LENGTH)).getPos(); x = startPos.getMinBlockX(); y = pos.getY() - 1; z = startPos.getMinBlockZ(); @@ -108,14 +116,17 @@ protected boolean hasPostProcessing() { } @Override - protected void dropPostProcessing(NonNullList blockDrops, List outputs, BlockState blockState, LootParams.Builder builder) { + protected void dropPostProcessing(NonNullList blockDrops, List outputs, BlockState blockState, + LootParams.Builder builder) { for (ItemStack outputStack : outputs) { if (ChemicalHelper.getPrefix(outputStack.getItem()) == TagPrefix.crushed) { if (getDropCountMultiplier() > 0) { ItemStack fortunePick = pickaxeTool.copy(); fortunePick.enchant(Enchantments.BLOCK_FORTUNE, getDropCountMultiplier()); - outputStack = ApplyBonusCount.addOreBonusCount(Enchantments.BLOCK_FORTUNE).build().apply(outputStack, - new LootContext.Builder(builder.withParameter(LootContextParams.TOOL, fortunePick).create(LootContextParamSets.BLOCK)).create(null)); + outputStack = ApplyBonusCount.addOreBonusCount(Enchantments.BLOCK_FORTUNE).build().apply( + outputStack, + new LootContext.Builder(builder.withParameter(LootContextParams.TOOL, fortunePick) + .create(LootContextParamSets.BLOCK)).create(null)); } } blockDrops.add(outputStack); @@ -123,7 +134,8 @@ protected void dropPostProcessing(NonNullList blockDrops, List blockDrops, BlockState blockState, LootParams.Builder builder) { + protected boolean doPostProcessing(NonNullList blockDrops, BlockState blockState, + LootParams.Builder builder) { if (!super.doPostProcessing(blockDrops, blockState, builder) && getDropCountMultiplier() > 0) { for (ItemStack drop : blockDrops) { drop.setCount(drop.getCount() * getDropCountMultiplier()); diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/trait/miner/MinerLogic.java b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/miner/MinerLogic.java index ea3f486acf..5ecb1e9538 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/trait/miner/MinerLogic.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/miner/MinerLogic.java @@ -1,7 +1,5 @@ package com.gregtechceu.gtceu.common.machine.trait.miner; -import com.google.common.collect.Table; -import com.google.common.collect.Tables; import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.capability.IMiner; import com.gregtechceu.gtceu.api.capability.recipe.*; @@ -20,13 +18,12 @@ import com.gregtechceu.gtceu.data.recipe.CustomTags; import com.gregtechceu.gtceu.utils.GTTransferUtils; import com.gregtechceu.gtceu.utils.GTUtil; + import com.lowdragmc.lowdraglib.misc.ItemTransferList; import com.lowdragmc.lowdraglib.side.item.IItemTransfer; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import com.mojang.brigadier.exceptions.CommandSyntaxException; -import lombok.Getter; -import lombok.Setter; + import net.minecraft.commands.arguments.blocks.BlockStateParser; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -42,13 +39,21 @@ import net.minecraft.world.level.storage.loot.LootParams; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.phys.Vec3; -import org.jetbrains.annotations.Nullable; +import com.google.common.collect.Table; +import com.google.common.collect.Tables; +import com.mojang.brigadier.exceptions.CommandSyntaxException; +import lombok.Getter; +import lombok.Setter; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + import java.util.*; public class MinerLogic extends RecipeLogic implements IRecipeCapabilityHolder { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(MinerLogic.class, RecipeLogic.MANAGED_FIELD_HOLDER); + + public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(MinerLogic.class, + RecipeLogic.MANAGED_FIELD_HOLDER); private static final short MAX_SPEED = Short.MAX_VALUE; private static final byte POWER = 5; private static final byte TICK_TOLERANCE = 20; @@ -117,10 +122,10 @@ public class MinerLogic extends RecipeLogic implements IRecipeCapabilityHolder { /** * Creates the general logic for all in-world ore block miners * - * @param machine the {@link MetaMachine} this logic belongs to - * @param fortune the fortune amount to apply when mining ores - * @param speed the speed in ticks per block mined - * @param maximumRadius the maximum radius (square shaped) the miner can mine in + * @param machine the {@link MetaMachine} this logic belongs to + * @param fortune the fortune amount to apply when mining ores + * @param speed the speed in ticks per block mined + * @param maximumRadius the maximum radius (square shaped) the miner can mine in */ public MinerLogic(@NotNull IRecipeLogicMachine machine, int fortune, int speed, int maximumRadius) { super(machine); @@ -133,8 +138,10 @@ public MinerLogic(@NotNull IRecipeLogicMachine machine, int fortune, int speed, this.pickaxeTool = GTItems.TOOL_ITEMS.get(GTMaterials.Neutronium, GTToolType.PICKAXE).get().get(); this.pickaxeTool.enchant(Enchantments.BLOCK_FORTUNE, fortune); this.capabilitiesProxy = Tables.newCustomTable(new EnumMap<>(IO.class), IdentityHashMap::new); - this.inputItemHandler = new ItemRecipeHandler(IO.IN, machine.getRecipeType().getMaxInputs(ItemRecipeCapability.CAP)); - this.outputItemHandler = new ItemRecipeHandler(IO.OUT, machine.getRecipeType().getMaxOutputs(ItemRecipeCapability.CAP)); + this.inputItemHandler = new ItemRecipeHandler(IO.IN, + machine.getRecipeType().getMaxInputs(ItemRecipeCapability.CAP)); + this.outputItemHandler = new ItemRecipeHandler(IO.OUT, + machine.getRecipeType().getMaxOutputs(ItemRecipeCapability.CAP)); this.inputEnergyHandler = new IgnoreEnergyRecipeHandler(); this.capabilitiesProxy.put(IO.IN, inputItemHandler.getCapability(), List.of(inputItemHandler)); this.capabilitiesProxy.put(IO.IN, inputEnergyHandler.getCapability(), List.of(inputEnergyHandler)); @@ -163,9 +170,11 @@ public void inValid() { private static BlockState findMiningReplacementBlock(Level level) { try { - return BlockStateParser.parseForBlock(level.holderLookup(Registries.BLOCK), ConfigHolder.INSTANCE.machines.replaceMinedBlocksWith, false).blockState(); + return BlockStateParser.parseForBlock(level.holderLookup(Registries.BLOCK), + ConfigHolder.INSTANCE.machines.replaceMinedBlocksWith, false).blockState(); } catch (CommandSyntaxException ignored) { - GTCEu.LOGGER.error("failed to parse replaceMinedBlocksWith, invalid BlockState: {}", ConfigHolder.INSTANCE.machines.replaceMinedBlocksWith); + GTCEu.LOGGER.error("failed to parse replaceMinedBlocksWith, invalid BlockState: {}", + ConfigHolder.INSTANCE.machines.replaceMinedBlocksWith); return Blocks.COBBLESTONE.defaultBlockState(); } } @@ -186,7 +195,8 @@ public void serverTick() { } else { // the miner cannot drain, therefore it is inactive if (this.isWorking()) { - setWaiting(Component.translatable("gtceu.recipe_logic.insufficient_out").append(": ").append(ItemRecipeCapability.CAP.getName())); + setWaiting(Component.translatable("gtceu.recipe_logic.insufficient_out").append(": ") + .append(ItemRecipeCapability.CAP.getName())); } } @@ -274,24 +284,24 @@ protected boolean checkCanMine() { /** * Called after each block is mined, used to perform additional actions afterwards */ - protected void onMineOperation() { - - } + protected void onMineOperation() {} /** * called to handle mining small ores * - * @param blockDrops the List of items to fill after the operation - * @param blockState the {@link BlockState} of the block being mined + * @param blockDrops the List of items to fill after the operation + * @param blockState the {@link BlockState} of the block being mined */ // todo implement small ores - protected void getSmallOreBlockDrops(NonNullList blockDrops, BlockState blockState, LootParams.Builder builder) { - /*small ores - if orePrefix of block in blockPos is small - applyTieredHammerNoRandomDrops... - else - current code... - */ + protected void getSmallOreBlockDrops(NonNullList blockDrops, BlockState blockState, + LootParams.Builder builder) { + /* + * small ores + * if orePrefix of block in blockPos is small + * applyTieredHammerNoRandomDrops... + * else + * current code... + */ } /** @@ -308,10 +318,11 @@ protected boolean isSilkTouchMode() { /** * called to handle mining regular ores and blocks * - * @param blockDrops the List of items to fill after the operation - * @param blockState the {@link BlockState} of the block being mined + * @param blockDrops the List of items to fill after the operation + * @param blockState the {@link BlockState} of the block being mined */ - protected void getRegularBlockDrops(NonNullList blockDrops, BlockState blockState, LootParams.Builder builder) { + protected void getRegularBlockDrops(NonNullList blockDrops, BlockState blockState, + LootParams.Builder builder) { blockDrops.addAll(blockState.getDrops(builder)); } @@ -319,7 +330,8 @@ protected int getVoltageTier() { return 0; } - protected boolean doPostProcessing(NonNullList blockDrops, BlockState blockState, LootParams.Builder builder) { + protected boolean doPostProcessing(NonNullList blockDrops, BlockState blockState, + LootParams.Builder builder) { ItemStack oreDrop = blockDrops.get(0); // create dummy recipe handler @@ -354,23 +366,26 @@ protected boolean doPostProcessing(NonNullList blockDrops, BlockState return false; } - protected void dropPostProcessing(NonNullList blockDrops, List outputs, BlockState blockState, LootParams.Builder builder) { + protected void dropPostProcessing(NonNullList blockDrops, List outputs, BlockState blockState, + LootParams.Builder builder) { blockDrops.addAll(outputs); } /** * called to handle mining regular ores and blocks with silk touch * - * @param blockDrops the List of items to fill after the operation - * @param blockState the {@link BlockState} of the block being mined + * @param blockDrops the List of items to fill after the operation + * @param blockState the {@link BlockState} of the block being mined */ - protected void getSilkTouchDrops(NonNullList blockDrops, BlockState blockState, LootParams.Builder builder) { + protected void getSilkTouchDrops(NonNullList blockDrops, BlockState blockState, + LootParams.Builder builder) { blockDrops.add(new ItemStack(blockState.getBlock())); } protected ItemTransferList getCachedItemTransfer() { if (cachedItemTransfer == null) { - cachedItemTransfer = new ItemTransferList(machine.getCapabilitiesProxy().get(IO.OUT, ItemRecipeCapability.CAP).stream().map(IItemTransfer.class::cast).toList()); + cachedItemTransfer = new ItemTransferList(machine.getCapabilitiesProxy() + .get(IO.OUT, ItemRecipeCapability.CAP).stream().map(IItemTransfer.class::cast).toList()); } return cachedItemTransfer; } @@ -404,7 +419,6 @@ private void mineAndInsertItems(NonNullList blockDrops, ServerLevel w isInventoryFull = true; } } - } /** @@ -470,7 +484,8 @@ private LinkedList getBlocksToMine() { int calcAmount = quotient < 1 ? 1 : (int) (Math.min(quotient, Short.MAX_VALUE)); int calculated = 0; - if (this.minBuildHeight == Integer.MAX_VALUE) this.minBuildHeight = this.getMachine().getLevel().getMinBuildHeight(); + if (this.minBuildHeight == Integer.MAX_VALUE) + this.minBuildHeight = this.getMachine().getLevel().getMinBuildHeight(); // keep getting blocks until the target amount is reached while (calculated < calcAmount) { @@ -482,7 +497,9 @@ private LinkedList getBlocksToMine() { if (x <= startX + currentRadius * 2) { BlockPos blockPos = new BlockPos(x, y, z); BlockState state = getMachine().getLevel().getBlockState(blockPos); - if (state.getBlock().defaultDestroyTime() >= 0 && getMachine().getLevel().getBlockEntity(blockPos) == null && state.is(CustomTags.ORE_BLOCKS)) { + if (state.getBlock().defaultDestroyTime() >= 0 && + getMachine().getLevel().getBlockEntity(blockPos) == null && + state.is(CustomTags.ORE_BLOCKS)) { blocks.addLast(blockPos); } // move to the next x position diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/trait/miner/SteamMinerLogic.java b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/miner/SteamMinerLogic.java index f25145e551..e06945ab6c 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/trait/miner/SteamMinerLogic.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/trait/miner/SteamMinerLogic.java @@ -2,7 +2,6 @@ import com.gregtechceu.gtceu.api.machine.feature.IExhaustVentMachine; import com.gregtechceu.gtceu.api.machine.feature.IRecipeLogicMachine; -import com.lowdragmc.lowdraglib.client.renderer.impl.IModelRenderer; public class SteamMinerLogic extends MinerLogic { diff --git a/src/main/java/com/gregtechceu/gtceu/common/network/GTNetwork.java b/src/main/java/com/gregtechceu/gtceu/common/network/GTNetwork.java index 10017400cd..94d78664bf 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/network/GTNetwork.java +++ b/src/main/java/com/gregtechceu/gtceu/common/network/GTNetwork.java @@ -2,6 +2,7 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.common.network.packets.CPacketKeysPressed; + import com.lowdragmc.lowdraglib.networking.INetworking; import com.lowdragmc.lowdraglib.networking.forge.LDLNetworkingImpl; @@ -12,5 +13,4 @@ public class GTNetwork { public static void init() { NETWORK.registerC2S(CPacketKeysPressed.class); } - -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/network/packets/CPacketKeysPressed.java b/src/main/java/com/gregtechceu/gtceu/common/network/packets/CPacketKeysPressed.java index 946e60e127..2b3cd3db0f 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/network/packets/CPacketKeysPressed.java +++ b/src/main/java/com/gregtechceu/gtceu/common/network/packets/CPacketKeysPressed.java @@ -1,16 +1,20 @@ package com.gregtechceu.gtceu.common.network.packets; import com.gregtechceu.gtceu.utils.input.KeyBind; + import com.lowdragmc.lowdraglib.networking.IHandlerContext; import com.lowdragmc.lowdraglib.networking.IPacket; + +import net.minecraft.network.FriendlyByteBuf; + import com.mojang.datafixers.util.Pair; import lombok.NoArgsConstructor; -import net.minecraft.network.FriendlyByteBuf; import java.util.List; @NoArgsConstructor public class CPacketKeysPressed implements IPacket { + private Object updateKeys; public CPacketKeysPressed(List updateKeys) { @@ -51,4 +55,4 @@ public void execute(IHandlerContext handler) { } } } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/pipelike/cable/AveragingPerTickCounter.java b/src/main/java/com/gregtechceu/gtceu/common/pipelike/cable/AveragingPerTickCounter.java index a3fdbc1a07..41fac33087 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/pipelike/cable/AveragingPerTickCounter.java +++ b/src/main/java/com/gregtechceu/gtceu/common/pipelike/cable/AveragingPerTickCounter.java @@ -84,4 +84,4 @@ public void set(Level world, long value) { checkValueState(world); values[currentIndex] = value; } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/pipelike/cable/CableData.java b/src/main/java/com/gregtechceu/gtceu/common/pipelike/cable/CableData.java index 7df2f32999..e45ef0c9b7 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/pipelike/cable/CableData.java +++ b/src/main/java/com/gregtechceu/gtceu/common/pipelike/cable/CableData.java @@ -2,9 +2,11 @@ import com.gregtechceu.gtceu.api.data.chemical.material.properties.WireProperties; import com.gregtechceu.gtceu.api.pipenet.IAttachData; + +import net.minecraft.core.Direction; + import lombok.Getter; import lombok.experimental.Accessors; -import net.minecraft.core.Direction; import java.util.Objects; diff --git a/src/main/java/com/gregtechceu/gtceu/common/pipelike/cable/EnergyNet.java b/src/main/java/com/gregtechceu/gtceu/common/pipelike/cable/EnergyNet.java index a2dca06492..98852c3e1c 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/pipelike/cable/EnergyNet.java +++ b/src/main/java/com/gregtechceu/gtceu/common/pipelike/cable/EnergyNet.java @@ -1,10 +1,10 @@ package com.gregtechceu.gtceu.common.pipelike.cable; - import com.gregtechceu.gtceu.api.data.chemical.material.properties.WireProperties; import com.gregtechceu.gtceu.api.pipenet.LevelPipeNet; import com.gregtechceu.gtceu.api.pipenet.Node; import com.gregtechceu.gtceu.api.pipenet.PipeNet; + import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.world.level.Level; @@ -12,6 +12,7 @@ import java.util.*; public class EnergyNet extends PipeNet { + private final Map> NET_DATA = new HashMap<>(); private long lastEnergyFluxPerSec; @@ -47,7 +48,8 @@ public void onPipeConnectionsUpdate() { } @Override - protected void transferNodeData(Map> transferredNodes, PipeNet parentNet) { + protected void transferNodeData(Map> transferredNodes, + PipeNet parentNet) { super.transferNodeData(transferredNodes, parentNet); NET_DATA.clear(); ((EnergyNet) parentNet).NET_DATA.clear(); @@ -68,9 +70,8 @@ protected WireProperties readNodeData(CompoundTag tagCompound) { return new WireProperties(voltage, amperage, lossPerBlock); } - ////////////////////////////////////// - //******* Pipe Status *******// + // ******* Pipe Status *******// ////////////////////////////////////// public long getEnergyFluxPerSec() { diff --git a/src/main/java/com/gregtechceu/gtceu/common/pipelike/cable/EnergyNetHandler.java b/src/main/java/com/gregtechceu/gtceu/common/pipelike/cable/EnergyNetHandler.java index 3484431cea..5501d80610 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/pipelike/cable/EnergyNetHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/common/pipelike/cable/EnergyNetHandler.java @@ -4,6 +4,7 @@ import com.gregtechceu.gtceu.api.capability.IEnergyContainer; import com.gregtechceu.gtceu.common.blockentity.CableBlockEntity; import com.gregtechceu.gtceu.utils.GTUtil; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.particles.ParticleTypes; @@ -69,8 +70,8 @@ public long acceptEnergyFromNetwork(Direction side, long voltage, long amperage) for (CableBlockEntity cable : path.getPath()) { if (cable.getMaxVoltage() < voltage) { int heat = (int) (Math.log( - GTUtil.getTierByVoltage(voltage) - GTUtil.getTierByVoltage(cable.getMaxVoltage())) * - 45 + 36.5); + GTUtil.getTierByVoltage(voltage) - GTUtil.getTierByVoltage(cable.getMaxVoltage())) * + 45 + 36.5); cable.applyHeat(heat); cableBroken = cable.isInValid(); @@ -113,8 +114,8 @@ private void burnCable(ServerLevel serverLevel, BlockPos pos) { serverLevel.setBlockAndUpdate(pos, Blocks.FIRE.defaultBlockState()); if (!getNet().getLevel().isClientSide) { getNet().getLevel().sendParticles(ParticleTypes.LARGE_SMOKE, - pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, - 5 + getNet().getLevel().random.nextInt(3), 0.0, 0.0, 0.0, 0.1); + pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, + 5 + getNet().getLevel().random.nextInt(3), 0.0, 0.0, 0.0, 0.1); } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/pipelike/cable/EnergyNetWalker.java b/src/main/java/com/gregtechceu/gtceu/common/pipelike/cable/EnergyNetWalker.java index 443961840f..6f1b5fd9cf 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/pipelike/cable/EnergyNetWalker.java +++ b/src/main/java/com/gregtechceu/gtceu/common/pipelike/cable/EnergyNetWalker.java @@ -5,14 +5,17 @@ import com.gregtechceu.gtceu.api.data.chemical.material.properties.WireProperties; import com.gregtechceu.gtceu.api.pipenet.PipeNetWalker; import com.gregtechceu.gtceu.common.blockentity.CableBlockEntity; -import com.llamalad7.mixinextras.lib.apache.commons.ArrayUtils; + import com.lowdragmc.lowdraglib.LDLib; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.level.block.entity.BlockEntity; -import org.jetbrains.annotations.NotNull; +import com.llamalad7.mixinextras.lib.apache.commons.ArrayUtils; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; + import java.util.ArrayList; import java.util.List; @@ -24,7 +27,7 @@ public static List createNetData(EnergyNet pipeNet, BlockPos so EnergyNetWalker walker = new EnergyNetWalker(pipeNet, sourcePipe, 1, new ArrayList<>()); walker.traversePipeNet(); return walker.routes; - } catch (Exception e){ + } catch (Exception e) { LDLib.LOGGER.error("error while create net data for energynet", e); } return null; @@ -41,7 +44,10 @@ public EnergyNetWalker(EnergyNet pipeNet, BlockPos sourcePipe, int walkedBlocks, @NotNull @Override - protected PipeNetWalker createSubWalker(EnergyNet pipeNet, Direction facingToNextPos, BlockPos nextPos, int walkedBlocks) { + protected PipeNetWalker createSubWalker(EnergyNet pipeNet, + Direction facingToNextPos, + BlockPos nextPos, + int walkedBlocks) { EnergyNetWalker walker = new EnergyNetWalker(pipeNet, nextPos, walkedBlocks, routes); walker.loss = loss; walker.pipes = pipes; @@ -55,13 +61,16 @@ protected void checkPipe(CableBlockEntity pipeTile, BlockPos pos) { } @Override - protected void checkNeighbour(CableBlockEntity pipeTile, BlockPos pipePos, Direction faceToNeighbour, @Nullable BlockEntity neighbourTile) { + protected void checkNeighbour(CableBlockEntity pipeTile, BlockPos pipePos, Direction faceToNeighbour, + @Nullable BlockEntity neighbourTile) { // assert that the last added pipe is the current pipe if (pipeTile != pipes[pipes.length - 1]) throw new IllegalStateException( - "The current pipe is not the last added pipe. Something went seriously wrong!"); + "The current pipe is not the last added pipe. Something went seriously wrong!"); if (neighbourTile != null) { - IEnergyContainer container = neighbourTile.getCapability(GTCapability.CAPABILITY_ENERGY_CONTAINER, faceToNeighbour.getOpposite()).resolve().orElse(null); + IEnergyContainer container = neighbourTile + .getCapability(GTCapability.CAPABILITY_ENERGY_CONTAINER, faceToNeighbour.getOpposite()).resolve() + .orElse(null); if (container != null) { routes.add(new EnergyRoutePath(pipePos.immutable(), faceToNeighbour, pipes, getWalkedBlocks(), loss)); } diff --git a/src/main/java/com/gregtechceu/gtceu/common/pipelike/cable/EnergyRoutePath.java b/src/main/java/com/gregtechceu/gtceu/common/pipelike/cable/EnergyRoutePath.java index e4aec02271..c74b197643 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/pipelike/cable/EnergyRoutePath.java +++ b/src/main/java/com/gregtechceu/gtceu/common/pipelike/cable/EnergyRoutePath.java @@ -4,14 +4,16 @@ import com.gregtechceu.gtceu.api.capability.IEnergyContainer; import com.gregtechceu.gtceu.api.pipenet.IRoutePath; import com.gregtechceu.gtceu.common.blockentity.CableBlockEntity; -import lombok.Getter; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.level.Level; +import lombok.Getter; import org.jetbrains.annotations.Nullable; public class EnergyRoutePath implements IRoutePath { + private final CableBlockEntity targetPipe; @Getter private final BlockPos targetPipePos; @@ -24,7 +26,8 @@ public class EnergyRoutePath implements IRoutePath { @Getter private final long maxLoss; - public EnergyRoutePath(BlockPos targetPipePos, Direction targetFacing, CableBlockEntity[] path, int distance, long maxLoss) { + public EnergyRoutePath(BlockPos targetPipePos, Direction targetFacing, CableBlockEntity[] path, int distance, + long maxLoss) { this.targetPipe = path[path.length - 1]; this.targetPipePos = targetPipePos; this.targetFacing = targetFacing; @@ -35,6 +38,7 @@ public EnergyRoutePath(BlockPos targetPipePos, Direction targetFacing, CableBloc @Nullable public IEnergyContainer getHandler(Level world) { - return GTCapabilityHelper.getEnergyContainer(world, getTargetPipePos().relative(targetFacing), targetFacing.getOpposite()); + return GTCapabilityHelper.getEnergyContainer(world, getTargetPipePos().relative(targetFacing), + targetFacing.getOpposite()); } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/pipelike/cable/Insulation.java b/src/main/java/com/gregtechceu/gtceu/common/pipelike/cable/Insulation.java index ad30d7bc2f..56ecba27f8 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/pipelike/cable/Insulation.java +++ b/src/main/java/com/gregtechceu/gtceu/common/pipelike/cable/Insulation.java @@ -1,14 +1,16 @@ package com.gregtechceu.gtceu.common.pipelike.cable; import com.gregtechceu.gtceu.GTCEu; -import com.gregtechceu.gtceu.api.data.chemical.material.info.MaterialIconType; -import com.gregtechceu.gtceu.api.pipenet.IMaterialPipeType; -import com.gregtechceu.gtceu.client.model.PipeModel; import com.gregtechceu.gtceu.api.data.chemical.material.Material; +import com.gregtechceu.gtceu.api.data.chemical.material.info.MaterialIconType; import com.gregtechceu.gtceu.api.data.chemical.material.properties.WireProperties; import com.gregtechceu.gtceu.api.data.tag.TagPrefix; -import lombok.Getter; +import com.gregtechceu.gtceu.api.pipenet.IMaterialPipeType; +import com.gregtechceu.gtceu.client.model.PipeModel; + import net.minecraft.resources.ResourceLocation; + +import lombok.Getter; import org.jetbrains.annotations.Nullable; import java.util.function.Supplier; @@ -16,6 +18,7 @@ import static com.gregtechceu.gtceu.api.data.tag.TagPrefix.*; public enum Insulation implements IMaterialPipeType { + WIRE_SINGLE("single_wire", 0.125f, 1, 2, wireGtSingle, -1, false), WIRE_DOUBLE("double_wire", 0.25f, 2, 2, wireGtDouble, -1, false), WIRE_QUADRUPLE("quadruple_wire", 0.375f, 4, 3, wireGtQuadruple, -1, false), @@ -39,7 +42,8 @@ public enum Insulation implements IMaterialPipeType { public final int insulationLevel; public final boolean isCable; - Insulation(String name, float thickness, int amperage, int lossMultiplier, TagPrefix TagPrefix, int insulated, boolean isCable) { + Insulation(String name, float thickness, int amperage, int lossMultiplier, TagPrefix TagPrefix, int insulated, + boolean isCable) { this.name = name; this.thickness = thickness; this.amperage = amperage; @@ -61,7 +65,8 @@ public WireProperties modifyProperties(WireProperties baseProperties) { lossPerBlock = (int) (0.75 * lossMultiplier); else lossPerBlock = baseProperties.getLossPerBlock() * lossMultiplier; - return new WireProperties(baseProperties.getVoltage(), baseProperties.getAmperage() * amperage, lossPerBlock, baseProperties.isSuperconductor()); + return new WireProperties(baseProperties.getVoltage(), baseProperties.getAmperage() * amperage, lossPerBlock, + baseProperties.isSuperconductor()); } public boolean isCable() { @@ -79,15 +84,20 @@ public ResourceLocation type() { } public PipeModel createPipeModel(Material material) { - Supplier wireSideTexturePath = () -> MaterialIconType.wire.getBlockTexturePath(material.getMaterialIconSet(), true).withSuffix("_side"); - Supplier wireEndTexturePath = () -> MaterialIconType.wire.getBlockTexturePath(material.getMaterialIconSet(), true).withSuffix("_end"); - Supplier<@Nullable ResourceLocation> wireSideOverlayTexturePath = () -> MaterialIconType.wire.getBlockTexturePath(material.getMaterialIconSet(), "side_overlay", true); - Supplier<@Nullable ResourceLocation> wireEndOverlayTexturePath = () -> MaterialIconType.wire.getBlockTexturePath(material.getMaterialIconSet(), "end_overlay", true); - PipeModel model = new PipeModel(thickness, isCable ? () -> GTCEu.id("block/cable/insulation_5") : wireSideTexturePath, wireEndTexturePath, wireSideOverlayTexturePath, wireEndOverlayTexturePath); + Supplier wireSideTexturePath = () -> MaterialIconType.wire + .getBlockTexturePath(material.getMaterialIconSet(), true).withSuffix("_side"); + Supplier wireEndTexturePath = () -> MaterialIconType.wire + .getBlockTexturePath(material.getMaterialIconSet(), true).withSuffix("_end"); + Supplier<@Nullable ResourceLocation> wireSideOverlayTexturePath = () -> MaterialIconType.wire + .getBlockTexturePath(material.getMaterialIconSet(), "side_overlay", true); + Supplier<@Nullable ResourceLocation> wireEndOverlayTexturePath = () -> MaterialIconType.wire + .getBlockTexturePath(material.getMaterialIconSet(), "end_overlay", true); + PipeModel model = new PipeModel(thickness, + isCable ? () -> GTCEu.id("block/cable/insulation_5") : wireSideTexturePath, wireEndTexturePath, + wireSideOverlayTexturePath, wireEndOverlayTexturePath); if (isCable) { model.setEndOverlayTexture(GTCEu.id("block/cable/insulation_%s".formatted(insulationLevel))); } return model; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/pipelike/cable/LevelEnergyNet.java b/src/main/java/com/gregtechceu/gtceu/common/pipelike/cable/LevelEnergyNet.java index 35edafd24d..799e65281b 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/pipelike/cable/LevelEnergyNet.java +++ b/src/main/java/com/gregtechceu/gtceu/common/pipelike/cable/LevelEnergyNet.java @@ -2,13 +2,15 @@ import com.gregtechceu.gtceu.api.data.chemical.material.properties.WireProperties; import com.gregtechceu.gtceu.api.pipenet.LevelPipeNet; + import net.minecraft.nbt.CompoundTag; import net.minecraft.server.level.ServerLevel; public class LevelEnergyNet extends LevelPipeNet { public static LevelEnergyNet getOrCreate(ServerLevel serverLevel) { - return serverLevel.getDataStorage().computeIfAbsent(tag -> new LevelEnergyNet(serverLevel, tag), () -> new LevelEnergyNet(serverLevel), "gtcue_energy_net"); + return serverLevel.getDataStorage().computeIfAbsent(tag -> new LevelEnergyNet(serverLevel, tag), + () -> new LevelEnergyNet(serverLevel), "gtcue_energy_net"); } public LevelEnergyNet(ServerLevel serverLevel) { @@ -23,5 +25,4 @@ public LevelEnergyNet(ServerLevel serverLevel, CompoundTag tag) { protected EnergyNet createNetInstance() { return new EnergyNet(this); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/pipelike/cable/PerTickLongCounter.java b/src/main/java/com/gregtechceu/gtceu/common/pipelike/cable/PerTickLongCounter.java index 1dae072641..72f0d8bdb5 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/pipelike/cable/PerTickLongCounter.java +++ b/src/main/java/com/gregtechceu/gtceu/common/pipelike/cable/PerTickLongCounter.java @@ -55,4 +55,4 @@ public void set(Level world, long value) { checkValueState(world); this.currentValue = value; } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/pipelike/fluidpipe/FluidPipeData.java b/src/main/java/com/gregtechceu/gtceu/common/pipelike/fluidpipe/FluidPipeData.java index 93e7b7960b..faa0980a9b 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/pipelike/fluidpipe/FluidPipeData.java +++ b/src/main/java/com/gregtechceu/gtceu/common/pipelike/fluidpipe/FluidPipeData.java @@ -2,9 +2,11 @@ import com.gregtechceu.gtceu.api.data.chemical.material.properties.FluidPipeProperties; import com.gregtechceu.gtceu.api.pipenet.IAttachData; + +import net.minecraft.core.Direction; + import lombok.Getter; import lombok.experimental.Accessors; -import net.minecraft.core.Direction; import java.util.Objects; diff --git a/src/main/java/com/gregtechceu/gtceu/common/pipelike/fluidpipe/FluidPipeNet.java b/src/main/java/com/gregtechceu/gtceu/common/pipelike/fluidpipe/FluidPipeNet.java index 3358740ebd..5b9702e48d 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/pipelike/fluidpipe/FluidPipeNet.java +++ b/src/main/java/com/gregtechceu/gtceu/common/pipelike/fluidpipe/FluidPipeNet.java @@ -3,6 +3,7 @@ import com.gregtechceu.gtceu.api.data.chemical.material.properties.FluidPipeProperties; import com.gregtechceu.gtceu.api.pipenet.LevelPipeNet; import com.gregtechceu.gtceu.api.pipenet.PipeNet; + import net.minecraft.nbt.CompoundTag; /** @@ -17,7 +18,7 @@ public FluidPipeNet(LevelPipeNet world) { } ///////////////////////////////////// - //*********** NBT ***********// + // *********** NBT ***********// ///////////////////////////////////// @Override @@ -40,6 +41,7 @@ protected FluidPipeProperties readNodeData(CompoundTag tagCompound) { boolean cryoProof = tagCompound.getBoolean("cryo_proof"); boolean plasmaProof = tagCompound.getBoolean("plasma_proof"); int channels = tagCompound.getInt("channels"); - return new FluidPipeProperties(maxTemperature, throughput, gasProof, acidProof, cryoProof, plasmaProof, channels); + return new FluidPipeProperties(maxTemperature, throughput, gasProof, acidProof, cryoProof, plasmaProof, + channels); } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/pipelike/fluidpipe/FluidPipeType.java b/src/main/java/com/gregtechceu/gtceu/common/pipelike/fluidpipe/FluidPipeType.java index cd0d269c95..73abe9df8d 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/pipelike/fluidpipe/FluidPipeType.java +++ b/src/main/java/com/gregtechceu/gtceu/common/pipelike/fluidpipe/FluidPipeType.java @@ -1,15 +1,17 @@ package com.gregtechceu.gtceu.common.pipelike.fluidpipe; import com.gregtechceu.gtceu.GTCEu; -import com.gregtechceu.gtceu.api.data.chemical.material.properties.PropertyKey; -import com.gregtechceu.gtceu.api.pipenet.IMaterialPipeType; import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.api.data.chemical.material.properties.FluidPipeProperties; +import com.gregtechceu.gtceu.api.data.chemical.material.properties.PropertyKey; import com.gregtechceu.gtceu.api.data.tag.TagPrefix; +import com.gregtechceu.gtceu.api.pipenet.IMaterialPipeType; import com.gregtechceu.gtceu.client.model.PipeModel; -import lombok.Getter; + import net.minecraft.resources.ResourceLocation; +import lombok.Getter; + import static com.gregtechceu.gtceu.api.data.tag.TagPrefix.*; public enum FluidPipeType implements IMaterialPipeType { @@ -57,8 +59,7 @@ public FluidPipeProperties modifyProperties(FluidPipeProperties fluidPipeData) { fluidPipeData.isAcidProof(), fluidPipeData.isCryoProof(), fluidPipeData.isPlasmaProof(), - channels - ); + channels); } @Override @@ -73,9 +74,15 @@ public ResourceLocation type() { public PipeModel createPipeModel(Material material) { if (material.hasProperty(PropertyKey.WOOD)) { - return new PipeModel(thickness, () -> GTCEu.id("block/pipe/pipe_side_wood"), () -> GTCEu.id("block/pipe/pipe_%s_in_wood".formatted(name)), null, null); + return new PipeModel(thickness, () -> GTCEu.id("block/pipe/pipe_side_wood"), + () -> GTCEu.id("block/pipe/pipe_%s_in_wood".formatted(name)), null, null); } - return new PipeModel(thickness, () -> GTCEu.id("block/pipe/pipe_side"), () -> GTCEu.id("block/pipe/pipe_%s_in".formatted(name)), - null, null/*() -> GTCEu.id("block/pipe/pipe_side_secondary"), () -> GTCEu.id("block/pipe/pipe_%s_in_secondary".formatted(name)) TODO enable once the textures are added*/); + return new PipeModel(thickness, () -> GTCEu.id("block/pipe/pipe_side"), + () -> GTCEu.id("block/pipe/pipe_%s_in".formatted(name)), + null, null/* + * () -> GTCEu.id("block/pipe/pipe_side_secondary"), () -> + * GTCEu.id("block/pipe/pipe_%s_in_secondary".formatted(name)) TODO enable once the textures + * are added + */); } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/pipelike/fluidpipe/FluidTransferHandler.java b/src/main/java/com/gregtechceu/gtceu/common/pipelike/fluidpipe/FluidTransferHandler.java index 1396e1b79a..92c507e549 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/pipelike/fluidpipe/FluidTransferHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/common/pipelike/fluidpipe/FluidTransferHandler.java @@ -1,157 +1,161 @@ -//package com.gregtechceu.gtceu.common.pipelike.fluidpipe; -// -//import com.gregtechceu.gtceu.api.capability.GTCapabilityHelper; -//import com.gregtechceu.gtceu.common.blockentity.FluidPipeBlockEntity; -//import com.gregtechceu.gtceu.common.cover.FluidFilterCover; -//import com.lowdragmc.lowdraglib.side.fluid.FluidStack; -//import com.lowdragmc.lowdraglib.side.fluid.IFluidTransfer; -//import it.unimi.dsi.fastutil.objects.Object2LongMap; -//import it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap; -//import lombok.Setter; -//import net.minecraft.core.BlockPos; -//import net.minecraft.core.Direction; -//import net.minecraft.world.level.material.Fluid; -//import org.jetbrains.annotations.NotNull; -//import org.jetbrains.annotations.Nullable; -//import oshi.util.tuples.Pair; -// -//import java.util.*; -//import java.util.function.Predicate; -// -///** +// package com.gregtechceu.gtceu.common.pipelike.fluidpipe; +// +// import com.gregtechceu.gtceu.api.capability.GTCapabilityHelper; +// import com.gregtechceu.gtceu.common.blockentity.FluidPipeBlockEntity; +// import com.gregtechceu.gtceu.common.cover.FluidFilterCover; +// import com.lowdragmc.lowdraglib.side.fluid.FluidStack; +// import com.lowdragmc.lowdraglib.side.fluid.IFluidTransfer; +// import it.unimi.dsi.fastutil.objects.Object2LongMap; +// import it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap; +// import lombok.Setter; +// import net.minecraft.core.BlockPos; +// import net.minecraft.core.Direction; +// import net.minecraft.world.level.material.Fluid; +// import org.jetbrains.annotations.NotNull; +// import org.jetbrains.annotations.Nullable; +// import oshi.util.tuples.Pair; +// +// import java.util.*; +// import java.util.function.Predicate; +// +/// ** // * @author KilaBash // * @date 2023/3/11 // * @implNote FluidTransferHandler // */ -//public class FluidTransferHandler implements IFluidTransfer { -// -// private final FluidPipeNet net; -// private final FluidPipeBlockEntity pipe; -// private final List paths; -// @Nullable -// private final Direction side; -// @Setter -// private Predicate filter = fluid -> true; -// -// public FluidTransferHandler(FluidPipeNet net, FluidPipeBlockEntity pipe, @Nullable Direction side) { -// this.net = Objects.requireNonNull(net); -// this.pipe = Objects.requireNonNull(pipe); -// this.paths = net.getNetData(pipe.getPipePos()); -// this.side = side; -// } -// -// @Override -// public int getTanks() { -// return 1; -// } -// -// @NotNull -// @Override -// public FluidStack getFluidInTank(int tank) { -// return FluidStack.empty(); -// } -// -// @Override -// public long getTankCapacity(int tank) { -// return tank == 0 ? net.getNodeAt(pipe.getPipePos()).data.properties.getPlatformThroughput() - net.getThroughputUsed(pipe.getPipePos()) : 0; -// } -// -// @Override -// public boolean isFluidValid(int tank, @NotNull FluidStack stack) { -// return filter.test(stack); -// } -// -// /** -// * check path. how much fluid can be transferred. -// * @return amount -// */ -// private long checkPathAvailable(FluidStack stack, PipeNetRoutePath routePath, Map> simulateChannelUsed, Object2LongMap simulateThroughputUsed) { -// if (stack.isEmpty()) return 0; -// var amount = stack.getAmount(); -// for (Pair node : routePath.getPath()) { -// var properties = node.getB().properties; -// var pos = node.getA(); -// if (!properties.acceptFluid(stack)) { -// return 0; -// } -// var channels = net.getChannelUsed(pos); -// var simulateChannels = simulateChannelUsed.getOrDefault(pos, Collections.emptySet()); -// -// if (!channels.contains(stack.getFluid()) && !simulateChannels.contains(stack.getFluid()) -// && (channels.size() + simulateChannels.size()) >= properties.getChannels()) return 0; -// -// var left = properties.getPlatformThroughput() - net.getThroughputUsed(pos) - simulateThroughputUsed.getOrDefault(pos, 0); -// amount = Math.min(amount, left); -// if (amount == 0) return 0; -// } -// return amount; -// } -// -// @Override -// public long fill(FluidStack resource, boolean simulate) { -// if (resource.isEmpty() || !filter.test(resource)) return 0; -// var left = resource.copy(); -// Map> simulateChannelUsed = new HashMap<>(); -// Object2LongMap simulateThroughputUsed = new Object2LongOpenHashMap<>(); -// for (PipeNetRoutePath path : paths) { -// if (Objects.equals(pipe.getPipePos(), path.getPipePos()) && (side == path.getFaceToHandler() || side == null)) { -// //Do not insert into source handler -// continue; -// } -// var handler = path.getHandler(pipe.getPipeLevel()); -// if (handler != null) { -// var coverable = GTCapabilityHelper.getCoverable(net.getLevel(), path.getPipePos(), null); -// if (coverable != null) { -// if (coverable.getCoverAtSide(path.getFaceToHandler()) instanceof FluidFilterCover cover && !cover.getFluidFilter().test(resource)) { -// return 0; -// } -// } -// var accepted = checkPathAvailable(left, path, simulateChannelUsed, simulateThroughputUsed); -// if (accepted <= 0) continue; -// var copied = left.copy(); -// copied.setAmount(accepted); -// var filled = handler.fill(copied, simulate); -// if (filled > 0) { // occupy capacity + channel -// for (Pair node : path.getPath()) { -// var pos = node.getA(); -// if (simulate) { -// simulateThroughputUsed.put(pos, simulateThroughputUsed.getOrDefault(pos, 0) + filled); -// simulateChannelUsed.computeIfAbsent(pos, p -> new HashSet<>()).add(resource.getFluid()); -// } else { -// net.useThroughput(pos, filled); -// net.useChannel(pos, resource.getFluid()); -// } -// } -// -// } -// left.shrink(filled); -// if (left.isEmpty()) { -// break; -// } -// } -// } -// return resource.getAmount() - left.getAmount(); -// } -// -// @NotNull -// @Override -// public FluidStack drain(FluidStack resource, boolean simulate) { -// return FluidStack.empty(); -// } -// -// @NotNull -// @Override -// public FluidStack drain(long maxDrain, boolean simulate) { -// return FluidStack.empty(); -// } -// -// @Override -// public boolean supportsFill(int i) { -// return true; -// } -// -// @Override -// public boolean supportsDrain(int i) { -// return false; -// } -//} +// public class FluidTransferHandler implements IFluidTransfer { +// +// private final FluidPipeNet net; +// private final FluidPipeBlockEntity pipe; +// private final List paths; +// @Nullable +// private final Direction side; +// @Setter +// private Predicate filter = fluid -> true; +// +// public FluidTransferHandler(FluidPipeNet net, FluidPipeBlockEntity pipe, @Nullable Direction side) { +// this.net = Objects.requireNonNull(net); +// this.pipe = Objects.requireNonNull(pipe); +// this.paths = net.getNetData(pipe.getPipePos()); +// this.side = side; +// } +// +// @Override +// public int getTanks() { +// return 1; +// } +// +// @NotNull +// @Override +// public FluidStack getFluidInTank(int tank) { +// return FluidStack.empty(); +// } +// +// @Override +// public long getTankCapacity(int tank) { +// return tank == 0 ? net.getNodeAt(pipe.getPipePos()).data.properties.getPlatformThroughput() - +// net.getThroughputUsed(pipe.getPipePos()) : 0; +// } +// +// @Override +// public boolean isFluidValid(int tank, @NotNull FluidStack stack) { +// return filter.test(stack); +// } +// +// /** +// * check path. how much fluid can be transferred. +// * @return amount +// */ +// private long checkPathAvailable(FluidStack stack, PipeNetRoutePath routePath, Map> +// simulateChannelUsed, Object2LongMap simulateThroughputUsed) { +// if (stack.isEmpty()) return 0; +// var amount = stack.getAmount(); +// for (Pair node : routePath.getPath()) { +// var properties = node.getB().properties; +// var pos = node.getA(); +// if (!properties.acceptFluid(stack)) { +// return 0; +// } +// var channels = net.getChannelUsed(pos); +// var simulateChannels = simulateChannelUsed.getOrDefault(pos, Collections.emptySet()); +// +// if (!channels.contains(stack.getFluid()) && !simulateChannels.contains(stack.getFluid()) +// && (channels.size() + simulateChannels.size()) >= properties.getChannels()) return 0; +// +// var left = properties.getPlatformThroughput() - net.getThroughputUsed(pos) - simulateThroughputUsed.getOrDefault(pos, +// 0); +// amount = Math.min(amount, left); +// if (amount == 0) return 0; +// } +// return amount; +// } +// +// @Override +// public long fill(FluidStack resource, boolean simulate) { +// if (resource.isEmpty() || !filter.test(resource)) return 0; +// var left = resource.copy(); +// Map> simulateChannelUsed = new HashMap<>(); +// Object2LongMap simulateThroughputUsed = new Object2LongOpenHashMap<>(); +// for (PipeNetRoutePath path : paths) { +// if (Objects.equals(pipe.getPipePos(), path.getPipePos()) && (side == path.getFaceToHandler() || side == null)) { +// //Do not insert into source handler +// continue; +// } +// var handler = path.getHandler(pipe.getPipeLevel()); +// if (handler != null) { +// var coverable = GTCapabilityHelper.getCoverable(net.getLevel(), path.getPipePos(), null); +// if (coverable != null) { +// if (coverable.getCoverAtSide(path.getFaceToHandler()) instanceof FluidFilterCover cover && +// !cover.getFluidFilter().test(resource)) { +// return 0; +// } +// } +// var accepted = checkPathAvailable(left, path, simulateChannelUsed, simulateThroughputUsed); +// if (accepted <= 0) continue; +// var copied = left.copy(); +// copied.setAmount(accepted); +// var filled = handler.fill(copied, simulate); +// if (filled > 0) { // occupy capacity + channel +// for (Pair node : path.getPath()) { +// var pos = node.getA(); +// if (simulate) { +// simulateThroughputUsed.put(pos, simulateThroughputUsed.getOrDefault(pos, 0) + filled); +// simulateChannelUsed.computeIfAbsent(pos, p -> new HashSet<>()).add(resource.getFluid()); +// } else { +// net.useThroughput(pos, filled); +// net.useChannel(pos, resource.getFluid()); +// } +// } +// +// } +// left.shrink(filled); +// if (left.isEmpty()) { +// break; +// } +// } +// } +// return resource.getAmount() - left.getAmount(); +// } +// +// @NotNull +// @Override +// public FluidStack drain(FluidStack resource, boolean simulate) { +// return FluidStack.empty(); +// } +// +// @NotNull +// @Override +// public FluidStack drain(long maxDrain, boolean simulate) { +// return FluidStack.empty(); +// } +// +// @Override +// public boolean supportsFill(int i) { +// return true; +// } +// +// @Override +// public boolean supportsDrain(int i) { +// return false; +// } +// } diff --git a/src/main/java/com/gregtechceu/gtceu/common/pipelike/fluidpipe/LevelFluidPipeNet.java b/src/main/java/com/gregtechceu/gtceu/common/pipelike/fluidpipe/LevelFluidPipeNet.java index 7ca30a2584..5e9b8084a4 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/pipelike/fluidpipe/LevelFluidPipeNet.java +++ b/src/main/java/com/gregtechceu/gtceu/common/pipelike/fluidpipe/LevelFluidPipeNet.java @@ -2,13 +2,15 @@ import com.gregtechceu.gtceu.api.data.chemical.material.properties.FluidPipeProperties; import com.gregtechceu.gtceu.api.pipenet.LevelPipeNet; + import net.minecraft.nbt.CompoundTag; import net.minecraft.server.level.ServerLevel; public class LevelFluidPipeNet extends LevelPipeNet { public static LevelFluidPipeNet getOrCreate(ServerLevel serverLevel) { - return serverLevel.getDataStorage().computeIfAbsent(tag -> new LevelFluidPipeNet(serverLevel, tag), () -> new LevelFluidPipeNet(serverLevel), "gtcue_fluid_pipe_net"); + return serverLevel.getDataStorage().computeIfAbsent(tag -> new LevelFluidPipeNet(serverLevel, tag), + () -> new LevelFluidPipeNet(serverLevel), "gtcue_fluid_pipe_net"); } public LevelFluidPipeNet(ServerLevel serverLevel) { @@ -23,5 +25,4 @@ public LevelFluidPipeNet(ServerLevel serverLevel, CompoundTag tag) { protected FluidPipeNet createNetInstance() { return new FluidPipeNet(this); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/pipelike/fluidpipe/PipeNetRoutePath.java b/src/main/java/com/gregtechceu/gtceu/common/pipelike/fluidpipe/PipeNetRoutePath.java index 66c4aaae10..1777dfdf63 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/pipelike/fluidpipe/PipeNetRoutePath.java +++ b/src/main/java/com/gregtechceu/gtceu/common/pipelike/fluidpipe/PipeNetRoutePath.java @@ -1,18 +1,21 @@ package com.gregtechceu.gtceu.common.pipelike.fluidpipe; import com.gregtechceu.gtceu.api.pipenet.IRoutePath; + import com.lowdragmc.lowdraglib.side.fluid.FluidTransferHelper; import com.lowdragmc.lowdraglib.side.fluid.IFluidTransfer; -import lombok.Getter; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.level.Level; -import org.jetbrains.annotations.NotNull; -import oshi.util.tuples.Pair; +import lombok.Getter; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import oshi.util.tuples.Pair; public class PipeNetRoutePath implements IRoutePath { + @Getter private final BlockPos pipePos; @Getter @@ -21,7 +24,8 @@ public class PipeNetRoutePath implements IRoutePath { private final int distance; private final Pair[] path; - public PipeNetRoutePath(BlockPos pipePos, Direction targetFacing, Pair[] path, int distance) { + public PipeNetRoutePath(BlockPos pipePos, Direction targetFacing, Pair[] path, + int distance) { this.pipePos = pipePos; this.targetFacing = targetFacing; this.path = path; diff --git a/src/main/java/com/gregtechceu/gtceu/common/pipelike/fluidpipe/PipeTankList.java b/src/main/java/com/gregtechceu/gtceu/common/pipelike/fluidpipe/PipeTankList.java index 132c14739f..270748eb2c 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/pipelike/fluidpipe/PipeTankList.java +++ b/src/main/java/com/gregtechceu/gtceu/common/pipelike/fluidpipe/PipeTankList.java @@ -1,10 +1,13 @@ package com.gregtechceu.gtceu.common.pipelike.fluidpipe; import com.gregtechceu.gtceu.common.blockentity.FluidPipeBlockEntity; + import com.lowdragmc.lowdraglib.misc.FluidStorage; import com.lowdragmc.lowdraglib.side.fluid.FluidStack; import com.lowdragmc.lowdraglib.side.fluid.IFluidTransfer; + import net.minecraft.core.Direction; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -94,7 +97,8 @@ public boolean supportsDrain(int tank) { @Override public long fill(FluidStack resource, boolean simulate, boolean notifyChanges) { int channel; - if (pipe.isBlocked(facing) || resource == null || resource.getAmount() <= 0 || (channel = findChannel(resource)) < 0) + if (pipe.isBlocked(facing) || resource == null || resource.getAmount() <= 0 || + (channel = findChannel(resource)) < 0) return 0; return fill(resource, simulate, channel); @@ -152,9 +156,7 @@ public Object createSnapshot() { } @Override - public void restoreFromSnapshot(Object snapshot) { - - } + public void restoreFromSnapshot(Object snapshot) {} @Nullable @Override @@ -173,4 +175,4 @@ public FluidStack drain(FluidStack fluidStack, boolean doDrain) { public Iterator iterator() { return Arrays.stream(tanks).iterator(); } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/pipelike/fluidpipe/longdistance/LDFluidEndpointMachine.java b/src/main/java/com/gregtechceu/gtceu/common/pipelike/fluidpipe/longdistance/LDFluidEndpointMachine.java index 0e860e040c..485c9763aa 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/pipelike/fluidpipe/longdistance/LDFluidEndpointMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/pipelike/fluidpipe/longdistance/LDFluidEndpointMachine.java @@ -2,8 +2,10 @@ import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; import com.gregtechceu.gtceu.common.machine.storage.LongDistanceEndpointMachine; + import com.lowdragmc.lowdraglib.side.fluid.FluidStack; import com.lowdragmc.lowdraglib.side.fluid.IFluidTransfer; + import org.jetbrains.annotations.NotNull; public class LDFluidEndpointMachine extends LongDistanceEndpointMachine { @@ -78,4 +80,4 @@ public void restoreFromSnapshot(Object snapshot) { delegate.restoreFromSnapshot(snapshot); } } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/pipelike/fluidpipe/longdistance/LDFluidPipeType.java b/src/main/java/com/gregtechceu/gtceu/common/pipelike/fluidpipe/longdistance/LDFluidPipeType.java index a6ff968a55..c4ef7baeb5 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/pipelike/fluidpipe/longdistance/LDFluidPipeType.java +++ b/src/main/java/com/gregtechceu/gtceu/common/pipelike/fluidpipe/longdistance/LDFluidPipeType.java @@ -1,10 +1,7 @@ package com.gregtechceu.gtceu.common.pipelike.fluidpipe.longdistance; -import com.gregtechceu.gtceu.api.pipenet.longdistance.ILDEndpoint; import com.gregtechceu.gtceu.api.pipenet.longdistance.LongDistancePipeType; -import com.gregtechceu.gtceu.common.data.GTBlocks; import com.gregtechceu.gtceu.config.ConfigHolder; -import net.minecraft.world.level.block.state.BlockState; public class LDFluidPipeType extends LongDistancePipeType { @@ -18,4 +15,4 @@ private LDFluidPipeType() { public int getMinLength() { return ConfigHolder.INSTANCE.machines.ldFluidPipeMinDistance; } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/pipelike/item/ItemNetHandler.java b/src/main/java/com/gregtechceu/gtceu/common/pipelike/item/ItemNetHandler.java index b33d3afb62..1887123061 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/pipelike/item/ItemNetHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/common/pipelike/item/ItemNetHandler.java @@ -13,19 +13,21 @@ import com.gregtechceu.gtceu.utils.FacingPos; import com.gregtechceu.gtceu.utils.GTTransferUtils; import com.gregtechceu.gtceu.utils.ItemStackHashStrategy; + import com.lowdragmc.lowdraglib.misc.ItemStackTransfer; import com.lowdragmc.lowdraglib.side.item.IItemTransfer; -import it.unimi.dsi.fastutil.ints.IntArrayList; -import it.unimi.dsi.fastutil.ints.IntList; -import lombok.Getter; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; -import org.jetbrains.annotations.NotNull; +import it.unimi.dsi.fastutil.ints.IntArrayList; +import it.unimi.dsi.fastutil.ints.IntList; +import lombok.Getter; import org.jetbrains.annotations.NotNull; + import java.util.*; public class ItemNetHandler implements IItemTransfer { @@ -104,7 +106,8 @@ public static boolean checkImportCover(CoverBehavior cover, boolean onPipe, Item if (cover instanceof ItemFilterCover filter) { return (filter.getFilterMode() != ItemFilterMode.FILTER_BOTH && (filter.getFilterMode() != ItemFilterMode.FILTER_INSERT || !onPipe) && - (filter.getFilterMode() != ItemFilterMode.FILTER_EXTRACT || onPipe)) || filter.getItemFilter().test(stack); + (filter.getFilterMode() != ItemFilterMode.FILTER_EXTRACT || onPipe)) || + filter.getItemFilter().test(stack); } return true; } @@ -300,18 +303,20 @@ public ItemStack insert(ItemRoutePath handler, ItemStack stack, boolean simulate public ItemStack insert(ItemRoutePath routePath, ItemStack stack, boolean simulate, boolean ignoreLimit) { int allowed = ignoreLimit ? stack.getCount() : - checkTransferable(routePath.getProperties().getTransferRate(), stack.getCount(), simulate); + checkTransferable(routePath.getProperties().getTransferRate(), stack.getCount(), simulate); if (allowed == 0 || !routePath.matchesFilters(stack)) { return stack; } - CoverBehavior pipeCover = routePath.getTargetPipe().getCoverContainer().getCoverAtSide(routePath.getTargetFacing()); - CoverBehavior tileCover = getCoverOnNeighbour(routePath.getTargetPipe().getPipePos(), routePath.getTargetFacing()); + CoverBehavior pipeCover = routePath.getTargetPipe().getCoverContainer() + .getCoverAtSide(routePath.getTargetFacing()); + CoverBehavior tileCover = getCoverOnNeighbour(routePath.getTargetPipe().getPipePos(), + routePath.getTargetFacing()); if (pipeCover != null) { testHandler.setStackInSlot(0, stack.copy()); IItemTransfer itemHandler = pipeCover.getItemTransferCap(testHandler); if (itemHandler == null || (itemHandler != testHandler && - (allowed = itemHandler.extractItem(0, allowed, true).getCount()) <= 0)) { + (allowed = itemHandler.extractItem(0, allowed, true).getCount()) <= 0)) { testHandler.setStackInSlot(0, ItemStack.EMPTY); return stack; } @@ -349,14 +354,16 @@ private ItemStack insert(IItemTransfer handler, ItemStack stack, boolean simulat public CoverBehavior getCoverOnNeighbour(BlockPos pos, Direction handlerFacing) { BlockEntity tile = pipe.getLevel().getBlockEntity(pos.relative(handlerFacing)); if (tile != null) { - ICoverable coverable = GTCapabilityHelper.getCoverable(pipe.getLevel(), pos.relative(handlerFacing), handlerFacing.getOpposite()); + ICoverable coverable = GTCapabilityHelper.getCoverable(pipe.getLevel(), pos.relative(handlerFacing), + handlerFacing.getOpposite()); if (coverable == null) return null; return coverable.getCoverAtSide(handlerFacing.getOpposite()); } return null; } - public ItemStack insertOverRobotArm(IItemTransfer handler, RobotArmCover arm, ItemStack stack, boolean simulate, int allowed, boolean ignoreLimit) { + public ItemStack insertOverRobotArm(IItemTransfer handler, RobotArmCover arm, ItemStack stack, boolean simulate, + int allowed, boolean ignoreLimit) { int rate; boolean isStackSpecific = false; rate = arm.getFilterHandler().getFilter().testItemCount(stack); @@ -449,20 +456,18 @@ public Object createSnapshot() { } @Override - public void restoreFromSnapshot(Object snapshot) { - - } + public void restoreFromSnapshot(Object snapshot) {} private void transferTo(ItemRoutePath handler, boolean simulate, int amount) { if (simulate) simulatedTransfersGlobalRoundRobin.merge(handler.toFacingPos(), amount, Integer::sum); else pipe.getTransferred().merge(handler.toFacingPos(), amount, Integer::sum); - } private boolean contains(ItemRoutePath handler, boolean simulate) { - return simulate ? simulatedTransfersGlobalRoundRobin.containsKey(handler.toFacingPos()) : pipe.getTransferred().containsKey(handler.toFacingPos()); + return simulate ? simulatedTransfersGlobalRoundRobin.containsKey(handler.toFacingPos()) : + pipe.getTransferred().containsKey(handler.toFacingPos()); } private int didTransferTo(ItemRoutePath handler, boolean simulate) { @@ -485,6 +490,7 @@ private void decrementBy(int amount) { } private static class EnhancedRoundRobinData { + private final ItemRoutePath routePath; private final int maxInsertable; private int transferred; diff --git a/src/main/java/com/gregtechceu/gtceu/common/pipelike/item/ItemNetWalker.java b/src/main/java/com/gregtechceu/gtceu/common/pipelike/item/ItemNetWalker.java index 6f5d922254..b70324fefc 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/pipelike/item/ItemNetWalker.java +++ b/src/main/java/com/gregtechceu/gtceu/common/pipelike/item/ItemNetWalker.java @@ -8,6 +8,7 @@ import com.gregtechceu.gtceu.common.cover.ItemFilterCover; import com.gregtechceu.gtceu.common.cover.ShutterCover; import com.gregtechceu.gtceu.common.cover.data.ItemFilterMode; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.item.ItemStack; @@ -15,6 +16,7 @@ import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.items.IItemHandler; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -35,7 +37,7 @@ public static List createNetData(ItemPipeNet pipeNet, BlockPos so walker.facingToHandler = sourceFacing; walker.traversePipeNet(); return walker.inventories; - } catch (Exception e){ + } catch (Exception e) { GTCEu.LOGGER.error("error while create net data for ItemPipeNet", e); } return null; @@ -48,7 +50,8 @@ public static List createNetData(ItemPipeNet pipeNet, BlockPos so private BlockPos sourcePipe; private Direction facingToHandler; - protected ItemNetWalker(ItemPipeNet world, BlockPos sourcePipe, int distance, List inventories, ItemPipeProperties properties) { + protected ItemNetWalker(ItemPipeNet world, BlockPos sourcePipe, int distance, List inventories, + ItemPipeProperties properties) { super(world, sourcePipe, distance); this.inventories = inventories; this.minProperties = properties; @@ -56,7 +59,10 @@ protected ItemNetWalker(ItemPipeNet world, BlockPos sourcePipe, int distance, Li @NotNull @Override - protected PipeNetWalker createSubWalker(ItemPipeNet pipeNet, Direction facingToNextPos, BlockPos nextPos, int walkedBlocks) { + protected PipeNetWalker createSubWalker(ItemPipeNet pipeNet, + Direction facingToNextPos, + BlockPos nextPos, + int walkedBlocks) { ItemNetWalker walker = new ItemNetWalker(pipeNet, nextPos, walkedBlocks, inventories, minProperties); walker.facingToHandler = facingToHandler; walker.sourcePipe = sourcePipe; @@ -86,16 +92,18 @@ protected void checkPipe(ItemPipeBlockEntity pipeTile, BlockPos pos) { minProperties = pipeProperties; } else { minProperties = new ItemPipeProperties(minProperties.getPriority() + pipeProperties.getPriority(), - Math.min(minProperties.getTransferRate(), pipeProperties.getTransferRate())); + Math.min(minProperties.getTransferRate(), pipeProperties.getTransferRate())); } } @Override - protected void checkNeighbour(ItemPipeBlockEntity pipeTile, BlockPos pipePos, Direction faceToNeighbour, @Nullable BlockEntity neighbourTile) { + protected void checkNeighbour(ItemPipeBlockEntity pipeTile, BlockPos pipePos, Direction faceToNeighbour, + @Nullable BlockEntity neighbourTile) { if (neighbourTile == null || (pipePos.equals(sourcePipe) && faceToNeighbour == facingToHandler)) { return; } - LazyOptional handler = neighbourTile.getCapability(ForgeCapabilities.ITEM_HANDLER, faceToNeighbour.getOpposite()); + LazyOptional handler = neighbourTile.getCapability(ForgeCapabilities.ITEM_HANDLER, + faceToNeighbour.getOpposite()); if (handler.isPresent()) { List> filters = new ArrayList<>(this.filters); List> moreFilters = nextFilters.get(faceToNeighbour); @@ -107,22 +115,23 @@ protected void checkNeighbour(ItemPipeBlockEntity pipeTile, BlockPos pipePos, Di } @Override - protected boolean isValidPipe(ItemPipeBlockEntity currentPipe, ItemPipeBlockEntity neighbourPipe, BlockPos pipePos, Direction faceToNeighbour) { + protected boolean isValidPipe(ItemPipeBlockEntity currentPipe, ItemPipeBlockEntity neighbourPipe, BlockPos pipePos, + Direction faceToNeighbour) { CoverBehavior thisCover = currentPipe.getCoverContainer().getCoverAtSide(faceToNeighbour); CoverBehavior neighbourCover = neighbourPipe.getCoverContainer().getCoverAtSide(faceToNeighbour.getOpposite()); List> filters = new ArrayList<>(); if (thisCover instanceof ShutterCover shutter) { filters.add(stack -> !shutter.isWorkingEnabled()); } else if (thisCover instanceof ItemFilterCover itemFilterCover && - itemFilterCover.getFilterMode() != ItemFilterMode.FILTER_INSERT) { - filters.add(itemFilterCover.getItemFilter()); - } + itemFilterCover.getFilterMode() != ItemFilterMode.FILTER_INSERT) { + filters.add(itemFilterCover.getItemFilter()); + } if (neighbourCover instanceof ShutterCover shutter) { filters.add(stack -> !shutter.isWorkingEnabled()); } else if (neighbourCover instanceof ItemFilterCover itemFilterCover && - itemFilterCover.getFilterMode() != ItemFilterMode.FILTER_EXTRACT) { - filters.add(itemFilterCover.getItemFilter()); - } + itemFilterCover.getFilterMode() != ItemFilterMode.FILTER_EXTRACT) { + filters.add(itemFilterCover.getItemFilter()); + } if (!filters.isEmpty()) { nextFilters.put(faceToNeighbour, filters); } diff --git a/src/main/java/com/gregtechceu/gtceu/common/pipelike/item/ItemPipeData.java b/src/main/java/com/gregtechceu/gtceu/common/pipelike/item/ItemPipeData.java index 4b926f063b..97f9e0a8e7 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/pipelike/item/ItemPipeData.java +++ b/src/main/java/com/gregtechceu/gtceu/common/pipelike/item/ItemPipeData.java @@ -2,11 +2,12 @@ import com.gregtechceu.gtceu.api.data.chemical.material.properties.ItemPipeProperties; import com.gregtechceu.gtceu.api.pipenet.IAttachData; -import com.gregtechceu.gtceu.common.pipelike.fluidpipe.FluidPipeData; + +import net.minecraft.core.Direction; + import lombok.AllArgsConstructor; import lombok.Getter; import lombok.experimental.Accessors; -import net.minecraft.core.Direction; import java.util.Objects; diff --git a/src/main/java/com/gregtechceu/gtceu/common/pipelike/item/ItemPipeNet.java b/src/main/java/com/gregtechceu/gtceu/common/pipelike/item/ItemPipeNet.java index 9b44be100e..ef5f1d9206 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/pipelike/item/ItemPipeNet.java +++ b/src/main/java/com/gregtechceu/gtceu/common/pipelike/item/ItemPipeNet.java @@ -4,19 +4,12 @@ import com.gregtechceu.gtceu.api.pipenet.LevelPipeNet; import com.gregtechceu.gtceu.api.pipenet.Node; import com.gregtechceu.gtceu.api.pipenet.PipeNet; -import com.gregtechceu.gtceu.utils.FacingPos; -import com.lowdragmc.lowdraglib.side.item.IItemTransfer; -import com.lowdragmc.lowdraglib.side.item.ItemTransferHelper; -import lombok.Getter; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.entity.BlockEntity; import java.util.*; -import java.util.function.Predicate; public class ItemPipeNet extends PipeNet { @@ -51,7 +44,8 @@ public void onPipeConnectionsUpdate() { } @Override - protected void transferNodeData(Map> transferredNodes, PipeNet parentNet) { + protected void transferNodeData(Map> transferredNodes, + PipeNet parentNet) { super.transferNodeData(transferredNodes, parentNet); NET_DATA.clear(); ((ItemPipeNet) parentNet).NET_DATA.clear(); @@ -67,4 +61,4 @@ protected void writeNodeData(ItemPipeProperties nodeData, CompoundTag tagCompoun protected ItemPipeProperties readNodeData(CompoundTag tagCompound) { return new ItemPipeProperties(tagCompound.getInt("Resistance"), tagCompound.getFloat("Rate")); } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/pipelike/item/ItemPipeType.java b/src/main/java/com/gregtechceu/gtceu/common/pipelike/item/ItemPipeType.java index 5d5893cc47..e37dd7286a 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/pipelike/item/ItemPipeType.java +++ b/src/main/java/com/gregtechceu/gtceu/common/pipelike/item/ItemPipeType.java @@ -7,10 +7,13 @@ import com.gregtechceu.gtceu.api.data.tag.TagPrefix; import com.gregtechceu.gtceu.api.pipenet.IMaterialPipeType; import com.gregtechceu.gtceu.client.model.PipeModel; -import lombok.Getter; + import net.minecraft.resources.ResourceLocation; +import lombok.Getter; + public enum ItemPipeType implements IMaterialPipeType { + SMALL("small", 0.375f, TagPrefix.pipeSmallItem, 0.5f, 1.5f), NORMAL("normal", 0.5f, TagPrefix.pipeNormalItem, 1f, 1f), LARGE("large", 0.75f, TagPrefix.pipeLargeItem, 2f, 0.75f), @@ -55,7 +58,8 @@ public String getSizeForTexture() { @Override public ItemPipeProperties modifyProperties(ItemPipeProperties baseProperties) { - return new ItemPipeProperties((int) ((baseProperties.getPriority() * resistanceMultiplier) + 0.5), baseProperties.getTransferRate() * rateMultiplier); + return new ItemPipeProperties((int) ((baseProperties.getPriority() * resistanceMultiplier) + 0.5), + baseProperties.getTransferRate() * rateMultiplier); } @Override @@ -71,10 +75,19 @@ public ResourceLocation type() { public PipeModel createPipeModel(Material material) { PipeModel model; if (material.hasProperty(PropertyKey.WOOD)) { - model = new PipeModel(thickness, () -> GTCEu.id("block/pipe/pipe_side_wood"), () -> GTCEu.id("block/pipe/pipe_%s_in_wood".formatted(this.isRestrictive() ? values()[this.ordinal() - 4].name : name)), null, null); + model = new PipeModel(thickness, () -> GTCEu.id("block/pipe/pipe_side_wood"), + () -> GTCEu.id("block/pipe/pipe_%s_in_wood" + .formatted(this.isRestrictive() ? values()[this.ordinal() - 4].name : name)), + null, null); } else { - model = new PipeModel(thickness, () -> GTCEu.id("block/pipe/pipe_side"), () -> GTCEu.id("block/pipe/pipe_%s_in".formatted(this.isRestrictive() ? values()[this.ordinal() - 4].name : name)), - null, null/*() -> GTCEu.id("block/pipe/pipe_side_secondary"), () -> GTCEu.id("block/pipe/pipe_%s_in_secondary".formatted(this.isRestrictive() ? values()[this.ordinal() - 4].name : name)) TODO enable once the textures are added*/); + model = new PipeModel(thickness, () -> GTCEu.id("block/pipe/pipe_side"), + () -> GTCEu.id("block/pipe/pipe_%s_in" + .formatted(this.isRestrictive() ? values()[this.ordinal() - 4].name : name)), + null, null/* + * () -> GTCEu.id("block/pipe/pipe_side_secondary"), () -> + * GTCEu.id("block/pipe/pipe_%s_in_secondary".formatted(this.isRestrictive() ? + * values()[this.ordinal() - 4].name : name)) TODO enable once the textures are added + */); } if (isRestrictive()) { model.setSideOverlayTexture(GTCEu.id("block/pipe/pipe_restrictive")); diff --git a/src/main/java/com/gregtechceu/gtceu/common/pipelike/item/ItemRoutePath.java b/src/main/java/com/gregtechceu/gtceu/common/pipelike/item/ItemRoutePath.java index e1ba3593d6..2fd14ffb01 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/pipelike/item/ItemRoutePath.java +++ b/src/main/java/com/gregtechceu/gtceu/common/pipelike/item/ItemRoutePath.java @@ -4,13 +4,16 @@ import com.gregtechceu.gtceu.api.pipenet.IRoutePath; import com.gregtechceu.gtceu.common.blockentity.ItemPipeBlockEntity; import com.gregtechceu.gtceu.utils.FacingPos; + import com.lowdragmc.lowdraglib.side.item.IItemTransfer; import com.lowdragmc.lowdraglib.side.item.ItemTransferHelper; -import lombok.Getter; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; + +import lombok.Getter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -30,7 +33,8 @@ public class ItemRoutePath implements IRoutePath { private final ItemPipeProperties properties; private final Predicate filters; - public ItemRoutePath(ItemPipeBlockEntity targetPipe, @NotNull Direction facing, int distance, ItemPipeProperties properties, + public ItemRoutePath(ItemPipeBlockEntity targetPipe, @NotNull Direction facing, int distance, + ItemPipeProperties properties, List> filters) { this.targetPipe = targetPipe; this.targetFacing = facing; @@ -50,7 +54,8 @@ public ItemRoutePath(ItemPipeBlockEntity targetPipe, @NotNull Direction facing, @Override public @Nullable IItemTransfer getHandler(Level world) { - return ItemTransferHelper.getItemTransfer(world, getTargetPipePos().relative(targetFacing), targetFacing.getOpposite()); + return ItemTransferHelper.getItemTransfer(world, getTargetPipePos().relative(targetFacing), + targetFacing.getOpposite()); } public boolean matchesFilters(ItemStack stack) { @@ -60,4 +65,4 @@ public boolean matchesFilters(ItemStack stack) { public FacingPos toFacingPos() { return new FacingPos(getTargetPipePos(), targetFacing); } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/pipelike/item/LevelItemPipeNet.java b/src/main/java/com/gregtechceu/gtceu/common/pipelike/item/LevelItemPipeNet.java index bac15549ca..b15987806c 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/pipelike/item/LevelItemPipeNet.java +++ b/src/main/java/com/gregtechceu/gtceu/common/pipelike/item/LevelItemPipeNet.java @@ -2,13 +2,15 @@ import com.gregtechceu.gtceu.api.data.chemical.material.properties.ItemPipeProperties; import com.gregtechceu.gtceu.api.pipenet.LevelPipeNet; + import net.minecraft.nbt.CompoundTag; import net.minecraft.server.level.ServerLevel; public class LevelItemPipeNet extends LevelPipeNet { public static LevelItemPipeNet getOrCreate(ServerLevel serverLevel) { - return serverLevel.getDataStorage().computeIfAbsent(tag -> new LevelItemPipeNet(serverLevel, tag), () -> new LevelItemPipeNet(serverLevel), "gtceu_item_pipe_net"); + return serverLevel.getDataStorage().computeIfAbsent(tag -> new LevelItemPipeNet(serverLevel, tag), + () -> new LevelItemPipeNet(serverLevel), "gtceu_item_pipe_net"); } public LevelItemPipeNet(ServerLevel serverLevel) { diff --git a/src/main/java/com/gregtechceu/gtceu/common/pipelike/item/longdistance/LDItemEndpointMachine.java b/src/main/java/com/gregtechceu/gtceu/common/pipelike/item/longdistance/LDItemEndpointMachine.java index 6367486513..62ea6868ec 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/pipelike/item/longdistance/LDItemEndpointMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/pipelike/item/longdistance/LDItemEndpointMachine.java @@ -2,8 +2,11 @@ import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; import com.gregtechceu.gtceu.common.machine.storage.LongDistanceEndpointMachine; + import com.lowdragmc.lowdraglib.side.item.IItemTransfer; + import net.minecraft.world.item.ItemStack; + import org.jetbrains.annotations.NotNull; public class LDItemEndpointMachine extends LongDistanceEndpointMachine { @@ -65,4 +68,4 @@ public void restoreFromSnapshot(Object snapshot) { delegate.restoreFromSnapshot(snapshot); } } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/pipelike/item/longdistance/LDItemPipeType.java b/src/main/java/com/gregtechceu/gtceu/common/pipelike/item/longdistance/LDItemPipeType.java index 670d705522..cedcb69abf 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/pipelike/item/longdistance/LDItemPipeType.java +++ b/src/main/java/com/gregtechceu/gtceu/common/pipelike/item/longdistance/LDItemPipeType.java @@ -1,10 +1,7 @@ package com.gregtechceu.gtceu.common.pipelike.item.longdistance; -import com.gregtechceu.gtceu.api.pipenet.longdistance.ILDEndpoint; import com.gregtechceu.gtceu.api.pipenet.longdistance.LongDistancePipeType; -import com.gregtechceu.gtceu.common.data.GTBlocks; import com.gregtechceu.gtceu.config.ConfigHolder; -import net.minecraft.world.level.block.state.BlockState; public class LDItemPipeType extends LongDistancePipeType { @@ -18,4 +15,4 @@ private LDItemPipeType() { public int getMinLength() { return ConfigHolder.INSTANCE.machines.ldItemPipeMinDistance; } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/pipelike/laser/LaserNetHandler.java b/src/main/java/com/gregtechceu/gtceu/common/pipelike/laser/LaserNetHandler.java index e51cd8b531..c83c66c836 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/pipelike/laser/LaserNetHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/common/pipelike/laser/LaserNetHandler.java @@ -2,6 +2,7 @@ import com.gregtechceu.gtceu.api.capability.ILaserContainer; import com.gregtechceu.gtceu.common.blockentity.LaserPipeBlockEntity; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.level.Level; @@ -10,6 +11,7 @@ import org.jetbrains.annotations.Nullable; public class LaserNetHandler implements ILaserContainer { + private LaserPipeNet net; private final LaserPipeBlockEntity pipe; private final Direction facing; @@ -110,4 +112,4 @@ public LaserPipeNet getNet() { public boolean isOneProbeHidden() { return true; } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/pipelike/laser/LaserNetWalker.java b/src/main/java/com/gregtechceu/gtceu/common/pipelike/laser/LaserNetWalker.java index 3664562a8b..1dc939e15e 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/pipelike/laser/LaserNetWalker.java +++ b/src/main/java/com/gregtechceu/gtceu/common/pipelike/laser/LaserNetWalker.java @@ -4,11 +4,12 @@ import com.gregtechceu.gtceu.api.capability.forge.GTCapability; import com.gregtechceu.gtceu.api.pipenet.PipeNetWalker; import com.gregtechceu.gtceu.common.blockentity.LaserPipeBlockEntity; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.level.block.entity.BlockEntity; -import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class LaserNetWalker extends PipeNetWalker { @@ -44,7 +45,10 @@ protected LaserNetWalker(LaserPipeNet world, BlockPos sourcePipe, int distance) @NotNull @Override - protected PipeNetWalker createSubWalker(LaserPipeNet net, Direction direction, BlockPos nextPos, int walkedBlocks) { + protected PipeNetWalker createSubWalker(LaserPipeNet net, + Direction direction, + BlockPos nextPos, + int walkedBlocks) { LaserNetWalker walker = new LaserNetWalker(net, nextPos, walkedBlocks); walker.facingToHandler = facingToHandler; walker.sourcePipe = sourcePipe; @@ -58,9 +62,7 @@ protected Class getBasePipeClass() { } @Override - protected void checkPipe(LaserPipeBlockEntity pipeTile, BlockPos pos) { - - } + protected void checkPipe(LaserPipeBlockEntity pipeTile, BlockPos pos) {} @Override protected Direction[] getSurroundingPipeSides() { @@ -72,15 +74,18 @@ protected Direction[] getSurroundingPipeSides() { } @Override - protected void checkNeighbour(LaserPipeBlockEntity pipeNode, BlockPos pipePos, Direction faceToNeighbour, @org.jetbrains.annotations.Nullable BlockEntity neighbourTile) { + protected void checkNeighbour(LaserPipeBlockEntity pipeNode, BlockPos pipePos, Direction faceToNeighbour, + @org.jetbrains.annotations.Nullable BlockEntity neighbourTile) { if (neighbourTile == null || (pipePos.equals(sourcePipe) && faceToNeighbour == facingToHandler)) { return; } if (((LaserNetWalker) root).routePath == null) { - ILaserContainer handler = neighbourTile.getCapability(GTCapability.CAPABILITY_LASER, faceToNeighbour.getOpposite()).resolve().orElse(null); + ILaserContainer handler = neighbourTile + .getCapability(GTCapability.CAPABILITY_LASER, faceToNeighbour.getOpposite()).resolve().orElse(null); if (handler != null) { - ((LaserNetWalker) root).routePath = new LaserRoutePath(pipePos.immutable(), faceToNeighbour, getWalkedBlocks()); + ((LaserNetWalker) root).routePath = new LaserRoutePath(pipePos.immutable(), faceToNeighbour, + getWalkedBlocks()); stop(); } } diff --git a/src/main/java/com/gregtechceu/gtceu/common/pipelike/laser/LaserPipeNet.java b/src/main/java/com/gregtechceu/gtceu/common/pipelike/laser/LaserPipeNet.java index 395c592ea3..65c0358977 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/pipelike/laser/LaserPipeNet.java +++ b/src/main/java/com/gregtechceu/gtceu/common/pipelike/laser/LaserPipeNet.java @@ -4,16 +4,18 @@ import com.gregtechceu.gtceu.api.capability.ILaserContainer; import com.gregtechceu.gtceu.api.pipenet.IAttachData; import com.gregtechceu.gtceu.api.pipenet.PipeNet; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; -import lombok.AllArgsConstructor; -import lombok.Getter; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; import net.minecraft.world.level.Level; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import lombok.AllArgsConstructor; +import lombok.Getter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; + import java.util.Map; public class LaserPipeNet extends PipeNet { @@ -50,8 +52,7 @@ public void onPipeConnectionsUpdate() { } @Override - protected void writeNodeData(LaserPipeProperties laserPipeProperties, CompoundTag compoundTag) { - } + protected void writeNodeData(LaserPipeProperties laserPipeProperties, CompoundTag compoundTag) {} @Override protected LaserPipeProperties readNodeData(CompoundTag tagCompound) { @@ -60,6 +61,7 @@ protected LaserPipeProperties readNodeData(CompoundTag tagCompound) { @AllArgsConstructor public static class LaserData implements IAttachData { + /** * The current position of the pipe */ @@ -111,6 +113,7 @@ public BlockPos getHandlerPos() { /** * Gets the handler if it exists + * * @param world the world to get the handler from * @return the handler */ diff --git a/src/main/java/com/gregtechceu/gtceu/common/pipelike/laser/LaserPipeProperties.java b/src/main/java/com/gregtechceu/gtceu/common/pipelike/laser/LaserPipeProperties.java index 460017fff9..ec8daffb2b 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/pipelike/laser/LaserPipeProperties.java +++ b/src/main/java/com/gregtechceu/gtceu/common/pipelike/laser/LaserPipeProperties.java @@ -1,12 +1,9 @@ package com.gregtechceu.gtceu.common.pipelike.laser; import lombok.NoArgsConstructor; -import lombok.RequiredArgsConstructor; -import net.minecraft.core.Direction; - -import org.jetbrains.annotations.NotNull; @NoArgsConstructor public class LaserPipeProperties { + public static final LaserPipeProperties INSTANCE = new LaserPipeProperties(); } diff --git a/src/main/java/com/gregtechceu/gtceu/common/pipelike/laser/LaserPipeType.java b/src/main/java/com/gregtechceu/gtceu/common/pipelike/laser/LaserPipeType.java index f26d9154ee..18fafe18fb 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/pipelike/laser/LaserPipeType.java +++ b/src/main/java/com/gregtechceu/gtceu/common/pipelike/laser/LaserPipeType.java @@ -2,12 +2,14 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.pipenet.IPipeType; + import net.minecraft.resources.ResourceLocation; import net.minecraft.util.StringRepresentable; import java.util.Locale; public enum LaserPipeType implements IPipeType, StringRepresentable { + NORMAL; public static final ResourceLocation TYPE_ID = GTCEu.id("laser"); diff --git a/src/main/java/com/gregtechceu/gtceu/common/pipelike/laser/LaserRoutePath.java b/src/main/java/com/gregtechceu/gtceu/common/pipelike/laser/LaserRoutePath.java index 90a3c1410c..8b2f095df3 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/pipelike/laser/LaserRoutePath.java +++ b/src/main/java/com/gregtechceu/gtceu/common/pipelike/laser/LaserRoutePath.java @@ -4,10 +4,12 @@ import com.gregtechceu.gtceu.api.capability.ILaserContainer; import com.gregtechceu.gtceu.api.pipenet.IAttachData; import com.gregtechceu.gtceu.api.pipenet.IRoutePath; -import lombok.Getter; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.level.Level; + +import lombok.Getter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -42,7 +44,8 @@ public LaserRoutePath(BlockPos targetPipePos, Direction targetFacing, int distan */ @Nullable public ILaserContainer getHandler(Level level) { - return GTCapabilityHelper.getLaser(level, getTargetPipePos().relative(targetFacing), targetFacing.getOpposite()); + return GTCapabilityHelper.getLaser(level, getTargetPipePos().relative(targetFacing), + targetFacing.getOpposite()); } @Override @@ -62,4 +65,4 @@ public boolean setAttached(Direction side, boolean attach) { } return result != attach; } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/pipelike/laser/LevelLaserPipeNet.java b/src/main/java/com/gregtechceu/gtceu/common/pipelike/laser/LevelLaserPipeNet.java index 08b350ed5e..a7164186f9 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/pipelike/laser/LevelLaserPipeNet.java +++ b/src/main/java/com/gregtechceu/gtceu/common/pipelike/laser/LevelLaserPipeNet.java @@ -1,14 +1,17 @@ package com.gregtechceu.gtceu.common.pipelike.laser; import com.gregtechceu.gtceu.api.pipenet.LevelPipeNet; + import net.minecraft.nbt.CompoundTag; import net.minecraft.server.level.ServerLevel; public class LevelLaserPipeNet extends LevelPipeNet { + private static final String DATA_ID = "gtceu_laser_pipe_net"; public static LevelLaserPipeNet getOrCreate(ServerLevel serverLevel) { - return serverLevel.getDataStorage().computeIfAbsent(tag -> new LevelLaserPipeNet(serverLevel, tag), () -> new LevelLaserPipeNet(serverLevel), DATA_ID); + return serverLevel.getDataStorage().computeIfAbsent(tag -> new LevelLaserPipeNet(serverLevel, tag), + () -> new LevelLaserPipeNet(serverLevel), DATA_ID); } public LevelLaserPipeNet(ServerLevel serverLevel) { diff --git a/src/main/java/com/gregtechceu/gtceu/common/pipelike/optical/LevelOpticalPipeNet.java b/src/main/java/com/gregtechceu/gtceu/common/pipelike/optical/LevelOpticalPipeNet.java index 93d4ba967b..b3f35e4a7f 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/pipelike/optical/LevelOpticalPipeNet.java +++ b/src/main/java/com/gregtechceu/gtceu/common/pipelike/optical/LevelOpticalPipeNet.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.common.pipelike.optical; import com.gregtechceu.gtceu.api.pipenet.LevelPipeNet; + import net.minecraft.nbt.CompoundTag; import net.minecraft.server.level.ServerLevel; @@ -9,7 +10,8 @@ public class LevelOpticalPipeNet extends LevelPipeNet new LevelOpticalPipeNet(serverLevel, tag), () -> new LevelOpticalPipeNet(serverLevel), DATA_ID); + return serverLevel.getDataStorage().computeIfAbsent(tag -> new LevelOpticalPipeNet(serverLevel, tag), + () -> new LevelOpticalPipeNet(serverLevel), DATA_ID); } public LevelOpticalPipeNet(ServerLevel level) { @@ -24,4 +26,4 @@ public LevelOpticalPipeNet(ServerLevel serverLevel, CompoundTag tag) { protected OpticalPipeNet createNetInstance() { return new OpticalPipeNet(this); } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/pipelike/optical/OpticalNetHandler.java b/src/main/java/com/gregtechceu/gtceu/common/pipelike/optical/OpticalNetHandler.java index bf6592aa37..9ea4e426f2 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/pipelike/optical/OpticalNetHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/common/pipelike/optical/OpticalNetHandler.java @@ -5,9 +5,11 @@ import com.gregtechceu.gtceu.api.capability.IOpticalDataAccessHatch; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.common.blockentity.OpticalPipeBlockEntity; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.level.Level; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -121,4 +123,4 @@ private IOpticalComputationProvider getComputationProvider(@NotNull Collection { @@ -13,7 +15,8 @@ public class OpticalNetWalker extends PipeNetWalker createSubWalker(OpticalPipeNet world, Direction facingToNextPos, - BlockPos nextPos, int walkedBlocks) { + protected PipeNetWalker createSubWalker(OpticalPipeNet world, + Direction facingToNextPos, + BlockPos nextPos, + int walkedBlocks) { OpticalNetWalker walker = new OpticalNetWalker(world, nextPos, walkedBlocks); walker.facingToHandler = facingToHandler; walker.sourcePipe = sourcePipe; @@ -65,4 +70,4 @@ protected void checkNeighbour(OpticalPipeBlockEntity pipeTile, BlockPos pipePos, protected Class getBasePipeClass() { return OpticalPipeBlockEntity.class; } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/pipelike/optical/OpticalPipeNet.java b/src/main/java/com/gregtechceu/gtceu/common/pipelike/optical/OpticalPipeNet.java index 4e6331baf6..f4b52a2a06 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/pipelike/optical/OpticalPipeNet.java +++ b/src/main/java/com/gregtechceu/gtceu/common/pipelike/optical/OpticalPipeNet.java @@ -3,10 +3,12 @@ import com.gregtechceu.gtceu.api.pipenet.LevelPipeNet; import com.gregtechceu.gtceu.api.pipenet.Node; import com.gregtechceu.gtceu.api.pipenet.PipeNet; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; + +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import org.jetbrains.annotations.Nullable; import java.util.Map; @@ -59,4 +61,4 @@ protected void writeNodeData(OpticalPipeProperties nodeData, CompoundTag tagComp protected OpticalPipeProperties readNodeData(CompoundTag tagCompound) { return OpticalPipeProperties.INSTANCE; } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/pipelike/optical/OpticalPipeProperties.java b/src/main/java/com/gregtechceu/gtceu/common/pipelike/optical/OpticalPipeProperties.java index 5462d63c02..8bdd971470 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/pipelike/optical/OpticalPipeProperties.java +++ b/src/main/java/com/gregtechceu/gtceu/common/pipelike/optical/OpticalPipeProperties.java @@ -3,4 +3,4 @@ public class OpticalPipeProperties { public static final OpticalPipeProperties INSTANCE = new OpticalPipeProperties(); -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/pipelike/optical/OpticalPipeType.java b/src/main/java/com/gregtechceu/gtceu/common/pipelike/optical/OpticalPipeType.java index c22857475b..bb64d6a98e 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/pipelike/optical/OpticalPipeType.java +++ b/src/main/java/com/gregtechceu/gtceu/common/pipelike/optical/OpticalPipeType.java @@ -2,13 +2,14 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.pipenet.IPipeType; + import net.minecraft.resources.ResourceLocation; import net.minecraft.util.StringRepresentable; -import org.jetbrains.annotations.NotNull; import java.util.Locale; public enum OpticalPipeType implements IPipeType, StringRepresentable { + NORMAL; public static final ResourceLocation TYPE = GTCEu.id("optical"); @@ -37,4 +38,4 @@ public ResourceLocation type() { public String getSerializedName() { return name().toLowerCase(Locale.ROOT); } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/pipelike/optical/OpticalRoutePath.java b/src/main/java/com/gregtechceu/gtceu/common/pipelike/optical/OpticalRoutePath.java index 80706cb662..07ccff2fe6 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/pipelike/optical/OpticalRoutePath.java +++ b/src/main/java/com/gregtechceu/gtceu/common/pipelike/optical/OpticalRoutePath.java @@ -7,14 +7,17 @@ import com.gregtechceu.gtceu.api.capability.forge.GTCapability; import com.gregtechceu.gtceu.api.pipenet.IRoutePath; import com.gregtechceu.gtceu.common.blockentity.OpticalPipeBlockEntity; -import lombok.Getter; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.level.Level; + +import lombok.Getter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class OpticalRoutePath implements IRoutePath { + @Getter private final OpticalPipeBlockEntity targetPipe; @Getter @@ -30,7 +33,8 @@ public OpticalRoutePath(OpticalPipeBlockEntity targetPipe, Direction targetFacin @Nullable public IOpticalDataAccessHatch getDataHatch() { - IDataAccessHatch dataAccessHatch = getTargetCapability(GTCapability.CAPABILITY_DATA_ACCESS, targetPipe.getPipeLevel()); + IDataAccessHatch dataAccessHatch = getTargetCapability(GTCapability.CAPABILITY_DATA_ACCESS, + targetPipe.getPipeLevel()); return dataAccessHatch instanceof IOpticalDataAccessHatch opticalHatch ? opticalHatch : null; } @@ -47,6 +51,7 @@ public IOpticalComputationProvider getComputationHatch() { @Nullable @Override public IOpticalComputationProvider getHandler(Level world) { - return GTCapabilityHelper.getOpticalComputationProvider(world, getTargetPipePos().relative(targetFacing), targetFacing.getOpposite()); + return GTCapabilityHelper.getOpticalComputationProvider(world, getTargetPipePos().relative(targetFacing), + targetFacing.getOpposite()); } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/recipe/BiomeCondition.java b/src/main/java/com/gregtechceu/gtceu/common/recipe/BiomeCondition.java index b5fd8ae481..6293fee73d 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/recipe/BiomeCondition.java +++ b/src/main/java/com/gregtechceu/gtceu/common/recipe/BiomeCondition.java @@ -1,11 +1,11 @@ package com.gregtechceu.gtceu.common.recipe; -import com.google.gson.JsonObject; +import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.RecipeCondition; -import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; + import com.lowdragmc.lowdraglib.utils.LocalizationUtils; -import lombok.NoArgsConstructor; + import net.minecraft.core.Holder; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; @@ -14,6 +14,8 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.biome.Biome; +import com.google.gson.JsonObject; +import lombok.NoArgsConstructor; import org.jetbrains.annotations.NotNull; /** @@ -43,7 +45,8 @@ public boolean isOr() { @Override public Component getTooltips() { - return Component.translatable("recipe.condition.biome.tooltip", LocalizationUtils.format("biome.%s.%s", biome.getNamespace(), biome.getPath())); + return Component.translatable("recipe.condition.biome.tooltip", + LocalizationUtils.format("biome.%s.%s", biome.getNamespace(), biome.getPath())); } public ResourceLocation getBiome() { @@ -91,5 +94,4 @@ public void toNetwork(FriendlyByteBuf buf) { super.toNetwork(buf); buf.writeUtf(biome.toString()); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/recipe/CleanroomCondition.java b/src/main/java/com/gregtechceu/gtceu/common/recipe/CleanroomCondition.java index c83bf416ac..2040782aea 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/recipe/CleanroomCondition.java +++ b/src/main/java/com/gregtechceu/gtceu/common/recipe/CleanroomCondition.java @@ -1,26 +1,29 @@ package com.gregtechceu.gtceu.common.recipe; -import com.google.gson.JsonObject; +import com.gregtechceu.gtceu.api.capability.ICleanroomReceiver; import com.gregtechceu.gtceu.api.machine.MetaMachine; import com.gregtechceu.gtceu.api.machine.feature.ICleanroomProvider; -import com.gregtechceu.gtceu.api.capability.ICleanroomReceiver; import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiController; import com.gregtechceu.gtceu.api.machine.multiblock.CleanroomType; import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.RecipeCondition; import com.gregtechceu.gtceu.config.ConfigHolder; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; + import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; import net.minecraft.util.GsonHelper; + +import com.google.gson.JsonObject; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; import org.jetbrains.annotations.NotNull; @AllArgsConstructor @NoArgsConstructor public class CleanroomCondition extends RecipeCondition { + public final static CleanroomCondition INSTANCE = new CleanroomCondition(); @Getter @@ -33,7 +36,8 @@ public String getType() { @Override public Component getTooltips() { - return cleanroom == null ? null : Component.translatable("gtceu.recipe.cleanroom", Component.translatable(cleanroom.getTranslationKey())); + return cleanroom == null ? null : + Component.translatable("gtceu.recipe.cleanroom", Component.translatable(cleanroom.getTranslationKey())); } @Override @@ -62,7 +66,7 @@ public JsonObject serialize() { @Override public RecipeCondition deserialize(@NotNull JsonObject config) { super.deserialize(config); - this. cleanroom = CleanroomType.getByNameOrDefault(GsonHelper.getAsString(config, "cleanroom", "cleanroom")); + this.cleanroom = CleanroomType.getByNameOrDefault(GsonHelper.getAsString(config, "cleanroom", "cleanroom")); return this; } diff --git a/src/main/java/com/gregtechceu/gtceu/common/recipe/DimensionCondition.java b/src/main/java/com/gregtechceu/gtceu/common/recipe/DimensionCondition.java index e44a9ba8af..8dd0bdc9b5 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/recipe/DimensionCondition.java +++ b/src/main/java/com/gregtechceu/gtceu/common/recipe/DimensionCondition.java @@ -1,16 +1,17 @@ package com.gregtechceu.gtceu.common.recipe; -import com.google.gson.JsonObject; +import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.RecipeCondition; -import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; -import lombok.NoArgsConstructor; + import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.GsonHelper; import net.minecraft.world.level.Level; +import com.google.gson.JsonObject; +import lombok.NoArgsConstructor; import org.jetbrains.annotations.NotNull; /** @@ -86,5 +87,4 @@ public void toNetwork(FriendlyByteBuf buf) { super.toNetwork(buf); buf.writeUtf(dimension.toString()); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/recipe/EUToStartCondition.java b/src/main/java/com/gregtechceu/gtceu/common/recipe/EUToStartCondition.java index bb6bc8387f..063324e118 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/recipe/EUToStartCondition.java +++ b/src/main/java/com/gregtechceu/gtceu/common/recipe/EUToStartCondition.java @@ -1,16 +1,16 @@ package com.gregtechceu.gtceu.common.recipe; -import com.google.gson.JsonObject; import com.gregtechceu.gtceu.api.capability.IEnergyContainer; import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.RecipeCondition; -import lombok.NoArgsConstructor; + import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; import net.minecraft.util.GsonHelper; -import org.jetbrains.annotations.NotNull; +import com.google.gson.JsonObject; +import lombok.NoArgsConstructor; import org.jetbrains.annotations.NotNull; /** @@ -20,6 +20,7 @@ */ @NoArgsConstructor public class EUToStartCondition extends RecipeCondition { + public static final EUToStartCondition INSTANCE = new EUToStartCondition(); private long euToStart; diff --git a/src/main/java/com/gregtechceu/gtceu/common/recipe/PositionYCondition.java b/src/main/java/com/gregtechceu/gtceu/common/recipe/PositionYCondition.java index ede6fbdd32..5b5dfd7e15 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/recipe/PositionYCondition.java +++ b/src/main/java/com/gregtechceu/gtceu/common/recipe/PositionYCondition.java @@ -1,14 +1,15 @@ package com.gregtechceu.gtceu.common.recipe; -import com.google.gson.JsonObject; +import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.RecipeCondition; -import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; -import lombok.NoArgsConstructor; + import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; import net.minecraft.util.GsonHelper; +import com.google.gson.JsonObject; +import lombok.NoArgsConstructor; import org.jetbrains.annotations.NotNull; /** @@ -88,5 +89,4 @@ public void toNetwork(FriendlyByteBuf buf) { buf.writeVarInt(min); buf.writeVarInt(max); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/recipe/RPMCondition.java b/src/main/java/com/gregtechceu/gtceu/common/recipe/RPMCondition.java index 48e992d13c..71883ca34e 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/recipe/RPMCondition.java +++ b/src/main/java/com/gregtechceu/gtceu/common/recipe/RPMCondition.java @@ -1,17 +1,18 @@ package com.gregtechceu.gtceu.common.recipe; -import com.google.gson.JsonObject; import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiController; import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiPart; import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.RecipeCondition; import com.gregtechceu.gtceu.common.machine.kinetic.IKineticMachine; -import lombok.NoArgsConstructor; + import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; import net.minecraft.util.GsonHelper; +import com.google.gson.JsonObject; +import lombok.NoArgsConstructor; import org.jetbrains.annotations.NotNull; /** @@ -45,12 +46,14 @@ public float getRpm() { @Override public boolean test(@NotNull GTRecipe recipe, @NotNull RecipeLogic recipeLogic) { - if (recipeLogic.machine instanceof IKineticMachine kineticMachine && Math.abs(kineticMachine.getKineticHolder().getSpeed()) >= rpm) { + if (recipeLogic.machine instanceof IKineticMachine kineticMachine && + Math.abs(kineticMachine.getKineticHolder().getSpeed()) >= rpm) { return true; } if (recipeLogic.machine instanceof IMultiController controller) { for (IMultiPart part : controller.getParts()) { - if (part instanceof IKineticMachine kineticMachine && Math.abs(kineticMachine.getKineticHolder().getSpeed()) >= rpm) { + if (part instanceof IKineticMachine kineticMachine && + Math.abs(kineticMachine.getKineticHolder().getSpeed()) >= rpm) { return true; } } @@ -90,5 +93,4 @@ public void toNetwork(FriendlyByteBuf buf) { super.toNetwork(buf); buf.writeFloat(rpm); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/recipe/RainingCondition.java b/src/main/java/com/gregtechceu/gtceu/common/recipe/RainingCondition.java index 078bd621d2..789e747cec 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/recipe/RainingCondition.java +++ b/src/main/java/com/gregtechceu/gtceu/common/recipe/RainingCondition.java @@ -1,15 +1,16 @@ package com.gregtechceu.gtceu.common.recipe; -import com.google.gson.JsonObject; +import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.RecipeCondition; -import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; -import lombok.NoArgsConstructor; + import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; import net.minecraft.util.GsonHelper; import net.minecraft.world.level.Level; +import com.google.gson.JsonObject; +import lombok.NoArgsConstructor; import org.jetbrains.annotations.NotNull; /** @@ -79,5 +80,4 @@ public void toNetwork(FriendlyByteBuf buf) { super.toNetwork(buf); buf.writeFloat(level); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/recipe/ResearchCondition.java b/src/main/java/com/gregtechceu/gtceu/common/recipe/ResearchCondition.java index f91fcd5722..f3ea02cb8a 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/recipe/ResearchCondition.java +++ b/src/main/java/com/gregtechceu/gtceu/common/recipe/ResearchCondition.java @@ -1,17 +1,20 @@ package com.gregtechceu.gtceu.common.recipe; -import com.google.gson.JsonObject; import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.RecipeCondition; import com.gregtechceu.gtceu.api.recipe.ResearchData; -import lombok.AllArgsConstructor; + import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; + +import com.google.gson.JsonObject; +import lombok.AllArgsConstructor; import org.jetbrains.annotations.NotNull; @AllArgsConstructor public class ResearchCondition extends RecipeCondition { + public final static ResearchCondition INSTANCE = new ResearchCondition(); public ResearchData data; diff --git a/src/main/java/com/gregtechceu/gtceu/common/recipe/RockBreakerCondition.java b/src/main/java/com/gregtechceu/gtceu/common/recipe/RockBreakerCondition.java index 505eea0db8..c12afa914c 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/recipe/RockBreakerCondition.java +++ b/src/main/java/com/gregtechceu/gtceu/common/recipe/RockBreakerCondition.java @@ -4,11 +4,13 @@ import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.RecipeCondition; import com.gregtechceu.gtceu.utils.GTUtil; -import lombok.NoArgsConstructor; + import net.minecraft.core.Direction; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; + +import lombok.NoArgsConstructor; import org.jetbrains.annotations.NotNull; /** @@ -18,7 +20,9 @@ */ @NoArgsConstructor public class RockBreakerCondition extends RecipeCondition { + public final static RockBreakerCondition INSTANCE = new RockBreakerCondition(); + @Override public String getType() { return "rock_breaker"; diff --git a/src/main/java/com/gregtechceu/gtceu/common/recipe/ThunderCondition.java b/src/main/java/com/gregtechceu/gtceu/common/recipe/ThunderCondition.java index 2981e9e9e3..743616338b 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/recipe/ThunderCondition.java +++ b/src/main/java/com/gregtechceu/gtceu/common/recipe/ThunderCondition.java @@ -1,15 +1,16 @@ package com.gregtechceu.gtceu.common.recipe; -import com.google.gson.JsonObject; +import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.RecipeCondition; -import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; -import lombok.NoArgsConstructor; + import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; import net.minecraft.util.GsonHelper; import net.minecraft.world.level.Level; +import com.google.gson.JsonObject; +import lombok.NoArgsConstructor; import org.jetbrains.annotations.NotNull; /** @@ -79,5 +80,4 @@ public void toNetwork(FriendlyByteBuf buf) { super.toNetwork(buf); buf.writeFloat(level); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/recipe/VentCondition.java b/src/main/java/com/gregtechceu/gtceu/common/recipe/VentCondition.java index 7897187b30..f15a83e872 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/recipe/VentCondition.java +++ b/src/main/java/com/gregtechceu/gtceu/common/recipe/VentCondition.java @@ -4,8 +4,10 @@ import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.RecipeCondition; -import lombok.NoArgsConstructor; + import net.minecraft.network.chat.Component; + +import lombok.NoArgsConstructor; import org.jetbrains.annotations.NotNull; /** @@ -15,7 +17,9 @@ */ @NoArgsConstructor public class VentCondition extends RecipeCondition { + public final static VentCondition INSTANCE = new VentCondition(); + @Override public String getType() { return "steam_vent"; @@ -38,4 +42,4 @@ public boolean test(@NotNull GTRecipe recipe, @NotNull RecipeLogic recipeLogic) public RecipeCondition createTemplate() { return new VentCondition(); } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/registry/GTRegistration.java b/src/main/java/com/gregtechceu/gtceu/common/registry/GTRegistration.java index 51b9fdd2d5..fc5a4cd7b5 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/registry/GTRegistration.java +++ b/src/main/java/com/gregtechceu/gtceu/common/registry/GTRegistration.java @@ -2,6 +2,7 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.registry.registrate.GTRegistrate; + import net.minecraft.resources.ResourceKey; import net.minecraft.world.item.CreativeModeTab; @@ -13,6 +14,4 @@ public class GTRegistration { } private GTRegistration() {/**/} - - } diff --git a/src/main/java/com/gregtechceu/gtceu/common/unification/material/MaterialRegistryImpl.java b/src/main/java/com/gregtechceu/gtceu/common/unification/material/MaterialRegistryImpl.java index 1a87c82ce6..d8bafbe58b 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/unification/material/MaterialRegistryImpl.java +++ b/src/main/java/com/gregtechceu/gtceu/common/unification/material/MaterialRegistryImpl.java @@ -3,6 +3,7 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.api.data.chemical.material.registry.MaterialRegistry; + import org.jetbrains.annotations.NotNull; import java.util.Collection; @@ -73,4 +74,4 @@ public java.lang.String getModid() { public void closeRegistry() { this.isRegistryClosed = true; } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/unification/material/MaterialRegistryManager.java b/src/main/java/com/gregtechceu/gtceu/common/unification/material/MaterialRegistryManager.java index 18db1b2251..738b291199 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/unification/material/MaterialRegistryManager.java +++ b/src/main/java/com/gregtechceu/gtceu/common/unification/material/MaterialRegistryManager.java @@ -1,15 +1,17 @@ package com.gregtechceu.gtceu.common.unification.material; -import com.google.common.base.Preconditions; import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.data.chemical.material.IMaterialRegistryManager; import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.api.data.chemical.material.registry.MaterialRegistry; + +import net.minecraft.resources.ResourceLocation; + +import com.google.common.base.Preconditions; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.Object2ObjectMap; import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; -import net.minecraft.resources.ResourceLocation; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -149,4 +151,4 @@ private MaterialRegistryImpl createInternalRegistry() { public Material getDefaultFallback() { return gregtechRegistry.getFallbackMaterial(); } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/common/worldgen/RubberFoliagePlacer.java b/src/main/java/com/gregtechceu/gtceu/common/worldgen/RubberFoliagePlacer.java index 546b63b044..f962268322 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/worldgen/RubberFoliagePlacer.java +++ b/src/main/java/com/gregtechceu/gtceu/common/worldgen/RubberFoliagePlacer.java @@ -1,26 +1,28 @@ package com.gregtechceu.gtceu.common.worldgen; import com.gregtechceu.gtceu.common.data.GTPlacerTypes; -import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.util.valueproviders.IntProvider; import net.minecraft.world.level.LevelSimulatedReader; -import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.levelgen.feature.configurations.TreeConfiguration; import net.minecraft.world.level.levelgen.feature.foliageplacers.FoliagePlacer; import net.minecraft.world.level.levelgen.feature.foliageplacers.FoliagePlacerType; +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; + import javax.annotation.ParametersAreNonnullByDefault; -import java.util.function.BiConsumer; @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault public class RubberFoliagePlacer extends FoliagePlacer { - public static final Codec CODEC = RecordCodecBuilder.create((p_68473_) -> foliagePlacerParts(p_68473_).apply(p_68473_, RubberFoliagePlacer::new)); + + public static final Codec CODEC = RecordCodecBuilder + .create((p_68473_) -> foliagePlacerParts(p_68473_).apply(p_68473_, RubberFoliagePlacer::new)); public RubberFoliagePlacer(IntProvider pRadius, IntProvider pOffset) { super(pRadius, pOffset); @@ -32,11 +34,14 @@ protected FoliagePlacerType type() { } @Override - protected void createFoliage(LevelSimulatedReader level, FoliageSetter blockSetter, RandomSource random, TreeConfiguration config, int maxFreeTreeHeight, FoliageAttachment attachment, int foliageHeight, int foliageRadius, int offset) { + protected void createFoliage(LevelSimulatedReader level, FoliageSetter blockSetter, RandomSource random, + TreeConfiguration config, int maxFreeTreeHeight, FoliageAttachment attachment, + int foliageHeight, int foliageRadius, int offset) { BlockPos blockpos = attachment.pos(); int end = offset - foliageRadius; - for(int l = offset; l >= end; --l) { - this.placeLeavesRow(level, blockSetter, random, config, blockpos, foliageRadius, l, attachment.doubleTrunk()); + for (int l = offset; l >= end; --l) { + this.placeLeavesRow(level, blockSetter, random, config, blockpos, foliageRadius, l, + attachment.doubleTrunk()); } } @@ -46,7 +51,8 @@ public int foliageHeight(RandomSource random, int height, TreeConfiguration conf } @Override - protected boolean shouldSkipLocation(RandomSource random, int localX, int localY, int localZ, int range, boolean large) { + protected boolean shouldSkipLocation(RandomSource random, int localX, int localY, int localZ, int range, + boolean large) { int yOff = localY - Mth.clamp(localY, -5, -2); return localX * localX + localZ * localZ + yOff * yOff > 10 + random.nextInt(8); } diff --git a/src/main/java/com/gregtechceu/gtceu/common/worldgen/RubberTrunkPlacer.java b/src/main/java/com/gregtechceu/gtceu/common/worldgen/RubberTrunkPlacer.java index 2437838035..02154956c5 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/worldgen/RubberTrunkPlacer.java +++ b/src/main/java/com/gregtechceu/gtceu/common/worldgen/RubberTrunkPlacer.java @@ -1,9 +1,7 @@ package com.gregtechceu.gtceu.common.worldgen; -import com.google.common.collect.ImmutableList; import com.gregtechceu.gtceu.common.data.GTPlacerTypes; -import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.util.RandomSource; @@ -14,14 +12,21 @@ import net.minecraft.world.level.levelgen.feature.trunkplacers.TrunkPlacer; import net.minecraft.world.level.levelgen.feature.trunkplacers.TrunkPlacerType; -import javax.annotation.ParametersAreNonnullByDefault; +import com.google.common.collect.ImmutableList; +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; + import java.util.List; import java.util.function.BiConsumer; +import javax.annotation.ParametersAreNonnullByDefault; + @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault public class RubberTrunkPlacer extends TrunkPlacer { - public static final Codec CODEC = RecordCodecBuilder.create((p_70206_) -> trunkPlacerParts(p_70206_).apply(p_70206_, RubberTrunkPlacer::new)); + + public static final Codec CODEC = RecordCodecBuilder + .create((p_70206_) -> trunkPlacerParts(p_70206_).apply(p_70206_, RubberTrunkPlacer::new)); public RubberTrunkPlacer(int pBaseHeight, int pHeightRandA, int pHeightRandB) { super(pBaseHeight, pHeightRandA, pHeightRandB); @@ -33,7 +38,10 @@ protected TrunkPlacerType type() { } @Override - public List placeTrunk(LevelSimulatedReader level, BiConsumer blockSetter, RandomSource random, int freeTreeHeight, BlockPos pos, TreeConfiguration config) { + public List placeTrunk(LevelSimulatedReader level, + BiConsumer blockSetter, + RandomSource random, int freeTreeHeight, BlockPos pos, + TreeConfiguration config) { BlockPos blockpos = pos.below(); setDirtAt(level, blockSetter, random, blockpos, config); setDirtAt(level, blockSetter, random, blockpos.east(), config); @@ -60,22 +68,31 @@ public List placeTrunk(LevelSimulatedReader lev placeLogIfFreeWithOffset(level, blockSetter, random, mutableBlockPos, config, pos, 0, i, -2); } if (i == 1 || i == freeTreeHeight - 7) { - placeLogIfFreeWithOffsetAndChance(0.33f, level, blockSetter, random, mutableBlockPos, config, pos, 1, i, 1); - placeLogIfFreeWithOffsetAndChance(0.33f, level, blockSetter, random, mutableBlockPos, config, pos, 1, i, -1); - placeLogIfFreeWithOffsetAndChance(0.33f, level, blockSetter, random, mutableBlockPos, config, pos, -1, i, 1); - placeLogIfFreeWithOffsetAndChance(0.33f, level, blockSetter, random, mutableBlockPos, config, pos, -1, i, -1); + placeLogIfFreeWithOffsetAndChance(0.33f, level, blockSetter, random, mutableBlockPos, config, pos, 1, i, + 1); + placeLogIfFreeWithOffsetAndChance(0.33f, level, blockSetter, random, mutableBlockPos, config, pos, 1, i, + -1); + placeLogIfFreeWithOffsetAndChance(0.33f, level, blockSetter, random, mutableBlockPos, config, pos, -1, + i, 1); + placeLogIfFreeWithOffsetAndChance(0.33f, level, blockSetter, random, mutableBlockPos, config, pos, -1, + i, -1); } } return ImmutableList.of(new FoliagePlacer.FoliageAttachment(pos.above(freeTreeHeight), 0, false)); } - private void placeLogIfFreeWithOffset(LevelSimulatedReader level, BiConsumer blockSetter, RandomSource random, BlockPos.MutableBlockPos pos, TreeConfiguration config, BlockPos pOffsetPos, int pOffsetX, int pOffsetY, int pOffsetZ) { + private void placeLogIfFreeWithOffset(LevelSimulatedReader level, BiConsumer blockSetter, + RandomSource random, BlockPos.MutableBlockPos pos, TreeConfiguration config, + BlockPos pOffsetPos, int pOffsetX, int pOffsetY, int pOffsetZ) { pos.setWithOffset(pOffsetPos, pOffsetX, pOffsetY, pOffsetZ); placeLogIfFree(level, blockSetter, random, pos, config); } - private void placeLogIfFreeWithOffsetAndChance(float pChance, LevelSimulatedReader level, BiConsumer blockSetter, RandomSource random, BlockPos.MutableBlockPos pos, TreeConfiguration config, BlockPos pOffsetPos, int pOffsetX, int pOffsetY, int pOffsetZ) { + private void placeLogIfFreeWithOffsetAndChance(float pChance, LevelSimulatedReader level, + BiConsumer blockSetter, RandomSource random, + BlockPos.MutableBlockPos pos, TreeConfiguration config, + BlockPos pOffsetPos, int pOffsetX, int pOffsetY, int pOffsetZ) { if (random.nextFloat() > pChance) { return; } diff --git a/src/main/java/com/gregtechceu/gtceu/common/worldgen/feature/FluidSproutFeature.java b/src/main/java/com/gregtechceu/gtceu/common/worldgen/feature/FluidSproutFeature.java index 0b009c42e5..be3a4ccadd 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/worldgen/feature/FluidSproutFeature.java +++ b/src/main/java/com/gregtechceu/gtceu/common/worldgen/feature/FluidSproutFeature.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.common.worldgen.feature; import com.gregtechceu.gtceu.common.worldgen.feature.configurations.FluidSproutConfiguration; + import net.minecraft.core.BlockPos; import net.minecraft.core.SectionPos; import net.minecraft.util.Mth; @@ -14,11 +15,13 @@ import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext; import net.minecraft.world.level.levelgen.structure.templatesystem.RuleTest; import net.minecraft.world.level.material.Fluids; + import org.apache.commons.lang3.mutable.MutableInt; import java.util.function.Function; public class FluidSproutFeature extends Feature { + public FluidSproutFeature() { super(FluidSproutConfiguration.CODEC); } @@ -72,8 +75,8 @@ public boolean place(FeaturePlaceContext context) { final int currentZ = z0 + z; setBlock(mutablePos, currentX, currentY, currentZ, - bulkSectionAccess, level, - config, placedAmount); + bulkSectionAccess, level, + config, placedAmount); } } } @@ -85,21 +88,21 @@ public boolean place(FeaturePlaceContext context) { int springHeight = surfaceHeight + config.surfaceOffset().sample(random); for (int currentY = blockpos.getY(); currentY <= springHeight; ++currentY) { setBlock(mutablePos, currentX, currentY, currentZ, - bulkSectionAccess, level, - config, placedAmount); - if (currentY <= surfaceHeight) { - setBlock(mutablePos, currentX + 1, currentY, currentZ, bulkSectionAccess, level, config, placedAmount); + if (currentY <= surfaceHeight) { + setBlock(mutablePos, currentX + 1, currentY, currentZ, + bulkSectionAccess, level, + config, placedAmount); setBlock(mutablePos, currentX - 1, currentY, currentZ, - bulkSectionAccess, level, - config, placedAmount); + bulkSectionAccess, level, + config, placedAmount); setBlock(mutablePos, currentX, currentY, currentZ + 1, - bulkSectionAccess, level, - config, placedAmount); + bulkSectionAccess, level, + config, placedAmount); setBlock(mutablePos, currentX, currentY, currentZ - 1, - bulkSectionAccess, level, - config, placedAmount); + bulkSectionAccess, level, + config, placedAmount); } } } @@ -121,7 +124,8 @@ public void setBlock(BlockPos.MutableBlockPos mutablePos, int currentX, int curr int sectionX = SectionPos.sectionRelative(currentX); int sectionY = SectionPos.sectionRelative(currentY); int sectionZ = SectionPos.sectionRelative(currentZ); - levelchunksection.setBlockState(sectionX, sectionY, sectionZ, config.fluid().defaultFluidState().createLegacyBlock(), false); + levelchunksection.setBlockState(sectionX, sectionY, sectionZ, + config.fluid().defaultFluidState().createLegacyBlock(), false); placedAmount.add(1); } diff --git a/src/main/java/com/gregtechceu/gtceu/common/worldgen/feature/StoneBlobFeature.java b/src/main/java/com/gregtechceu/gtceu/common/worldgen/feature/StoneBlobFeature.java index 34c14c6a19..816680fdc7 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/worldgen/feature/StoneBlobFeature.java +++ b/src/main/java/com/gregtechceu/gtceu/common/worldgen/feature/StoneBlobFeature.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.common.worldgen.feature; import com.gregtechceu.gtceu.common.worldgen.feature.configurations.StoneBlobConfiguration; + import net.minecraft.core.BlockPos; import net.minecraft.core.SectionPos; import net.minecraft.util.Mth; @@ -17,6 +18,7 @@ import java.util.function.Function; public class StoneBlobFeature extends Feature { + public StoneBlobFeature() { super(StoneBlobConfiguration.CODEC); } @@ -78,7 +80,8 @@ public boolean place(FeaturePlaceContext context) { int sectionZ = SectionPos.sectionRelative(currentZ); BlockState blockstate = levelchunksection.getBlockState(sectionX, sectionY, sectionZ); - if (!canPlaceOre(blockstate, bulkSectionAccess::getBlockState, random, config.state(), mutablePos)) + if (!canPlaceOre(blockstate, bulkSectionAccess::getBlockState, random, config.state(), + mutablePos)) continue; if (config.state().state.isAir()) continue; diff --git a/src/main/java/com/gregtechceu/gtceu/common/worldgen/feature/configurations/FluidSproutConfiguration.java b/src/main/java/com/gregtechceu/gtceu/common/worldgen/feature/configurations/FluidSproutConfiguration.java index 2fbae7342b..866f87e664 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/worldgen/feature/configurations/FluidSproutConfiguration.java +++ b/src/main/java/com/gregtechceu/gtceu/common/worldgen/feature/configurations/FluidSproutConfiguration.java @@ -1,18 +1,22 @@ package com.gregtechceu.gtceu.common.worldgen.feature.configurations; -import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.util.valueproviders.IntProvider; import net.minecraft.world.level.levelgen.feature.configurations.FeatureConfiguration; import net.minecraft.world.level.material.Fluid; -public record FluidSproutConfiguration(Fluid fluid, IntProvider size, IntProvider surfaceOffset, float sproutChance) implements FeatureConfiguration { +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; + +public record FluidSproutConfiguration(Fluid fluid, IntProvider size, IntProvider surfaceOffset, float sproutChance) + implements FeatureConfiguration { + public static final Codec CODEC = RecordCodecBuilder.create( - instance -> instance.group( - BuiltInRegistries.FLUID.byNameCodec().fieldOf("fluid").forGetter(FluidSproutConfiguration::fluid), - IntProvider.codec(1, 64).fieldOf("size").forGetter(FluidSproutConfiguration::size), - IntProvider.codec(0, 24).fieldOf("surface_offset").forGetter(FluidSproutConfiguration::surfaceOffset), - Codec.FLOAT.fieldOf("sprout_chance").forGetter(FluidSproutConfiguration::sproutChance) - ).apply(instance, FluidSproutConfiguration::new)); + instance -> instance.group( + BuiltInRegistries.FLUID.byNameCodec().fieldOf("fluid").forGetter(FluidSproutConfiguration::fluid), + IntProvider.codec(1, 64).fieldOf("size").forGetter(FluidSproutConfiguration::size), + IntProvider.codec(0, 24).fieldOf("surface_offset") + .forGetter(FluidSproutConfiguration::surfaceOffset), + Codec.FLOAT.fieldOf("sprout_chance").forGetter(FluidSproutConfiguration::sproutChance)) + .apply(instance, FluidSproutConfiguration::new)); } diff --git a/src/main/java/com/gregtechceu/gtceu/common/worldgen/feature/configurations/StoneBlobConfiguration.java b/src/main/java/com/gregtechceu/gtceu/common/worldgen/feature/configurations/StoneBlobConfiguration.java index 20337c452d..c5733b8383 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/worldgen/feature/configurations/StoneBlobConfiguration.java +++ b/src/main/java/com/gregtechceu/gtceu/common/worldgen/feature/configurations/StoneBlobConfiguration.java @@ -1,15 +1,18 @@ package com.gregtechceu.gtceu.common.worldgen.feature.configurations; -import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; import net.minecraft.util.valueproviders.IntProvider; import net.minecraft.world.level.levelgen.feature.configurations.FeatureConfiguration; import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration; -public record StoneBlobConfiguration(OreConfiguration.TargetBlockState state, IntProvider size) implements FeatureConfiguration { +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; + +public record StoneBlobConfiguration(OreConfiguration.TargetBlockState state, IntProvider size) + implements FeatureConfiguration { + public static final Codec CODEC = RecordCodecBuilder.create( - instance -> instance.group( - OreConfiguration.TargetBlockState.CODEC.fieldOf("state").forGetter(StoneBlobConfiguration::state), - IntProvider.codec(1, 64).fieldOf("size").forGetter(StoneBlobConfiguration::size) - ).apply(instance, StoneBlobConfiguration::new)); + instance -> instance.group( + OreConfiguration.TargetBlockState.CODEC.fieldOf("state").forGetter(StoneBlobConfiguration::state), + IntProvider.codec(1, 64).fieldOf("size").forGetter(StoneBlobConfiguration::size)) + .apply(instance, StoneBlobConfiguration::new)); } diff --git a/src/main/java/com/gregtechceu/gtceu/config/ConfigHolder.java b/src/main/java/com/gregtechceu/gtceu/config/ConfigHolder.java index f45dbae2dc..7a80a8cf70 100644 --- a/src/main/java/com/gregtechceu/gtceu/config/ConfigHolder.java +++ b/src/main/java/com/gregtechceu/gtceu/config/ConfigHolder.java @@ -2,6 +2,7 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.GTCEuAPI; + import dev.toma.configuration.Configuration; import dev.toma.configuration.config.Config; import dev.toma.configuration.config.Configurable; @@ -14,6 +15,7 @@ */ @Config(id = GTCEu.MOD_ID) public class ConfigHolder { + public static ConfigHolder INSTANCE; public static void init() { @@ -43,62 +45,72 @@ public static void init() { public DeveloperConfigs dev = new DeveloperConfigs(); public static class RecipeConfigs { + @Configurable - @Configurable.Comment({"Whether to generate Flawed and Chipped Gems for materials and recipes involving them.", - "Useful for mods like TerraFirmaCraft.", "Default: false"}) + @Configurable.Comment({ "Whether to generate Flawed and Chipped Gems for materials and recipes involving them.", + "Useful for mods like TerraFirmaCraft.", "Default: false" }) public boolean generateLowQualityGems = false; // default false @Configurable - @Configurable.Comment({"Whether to remove Block/Ingot compression and decompression in the Crafting Table.", "Default: true"}) + @Configurable.Comment({ "Whether to remove Block/Ingot compression and decompression in the Crafting Table.", + "Default: true" }) public boolean disableManualCompression = true; // default true @Configurable - @Configurable.Comment({"Change the recipe of Rods in the Lathe to 1 Rod and 2 Small Piles of Dust, instead of 2 Rods.", "Default: false"}) + @Configurable.Comment({ + "Change the recipe of Rods in the Lathe to 1 Rod and 2 Small Piles of Dust, instead of 2 Rods.", + "Default: false" }) public boolean harderRods = false; // default false @Configurable - @Configurable.Comment({"Whether to make crafting recipes for Bricks, Firebricks, Nether Bricks, and Coke Bricks harder.", "Default: false"}) + @Configurable.Comment({ + "Whether to make crafting recipes for Bricks, Firebricks, Nether Bricks, and Coke Bricks harder.", + "Default: false" }) public boolean harderBrickRecipes = false; // default false @Configurable - @Configurable.Comment({"Whether to nerf Wood crafting to 2 Planks from 1 Log, and 2 Sticks from 2 Planks.", "Default: false"}) + @Configurable.Comment({ "Whether to nerf Wood crafting to 2 Planks from 1 Log, and 2 Sticks from 2 Planks.", + "Default: false" }) public boolean nerfWoodCrafting = false; // default false @Configurable - @Configurable.Comment({"Whether to make Wood related recipes harder.", "Excludes sticks and planks.", "Default: false"}) + @Configurable.Comment({ "Whether to make Wood related recipes harder.", "Excludes sticks and planks.", + "Default: false" }) public boolean hardWoodRecipes = false; // default false @Configurable - @Configurable.Comment({"Recipes for Buckets, Cauldrons, Hoppers, and Iron Bars" + - " require Iron Plates, Rods, and more.", "Default: true"}) + @Configurable.Comment({ "Recipes for Buckets, Cauldrons, Hoppers, and Iron Bars" + + " require Iron Plates, Rods, and more.", "Default: true" }) public boolean hardIronRecipes = true; // default true @Configurable - @Configurable.Comment({"Whether to make Redstone related recipes harder.", "Default: false"}) + @Configurable.Comment({ "Whether to make Redstone related recipes harder.", "Default: false" }) public boolean hardRedstoneRecipes = false; // default false @Configurable - @Configurable.Comment({"Whether to make Vanilla Tools and Armor recipes harder.", "Excludes Flint and Steel, and Buckets.", "Default: false"}) + @Configurable.Comment({ "Whether to make Vanilla Tools and Armor recipes harder.", + "Excludes Flint and Steel, and Buckets.", "Default: false" }) public boolean hardToolArmorRecipes = false; // default false @Configurable - @Configurable.Comment({"Whether to make miscellaneous recipes harder.", "Default: false"}) + @Configurable.Comment({ "Whether to make miscellaneous recipes harder.", "Default: false" }) public boolean hardMiscRecipes = false; // default false @Configurable - @Configurable.Comment({"Whether to make Glass related recipes harder. Default: true"}) + @Configurable.Comment({ "Whether to make Glass related recipes harder. Default: true" }) public boolean hardGlassRecipes = true; // default true @Configurable - @Configurable.Comment({"Whether to nerf the Paper crafting recipe.", "Default: true"}) + @Configurable.Comment({ "Whether to nerf the Paper crafting recipe.", "Default: true" }) public boolean nerfPaperCrafting = true; // default true @Configurable - @Configurable.Comment({"Recipes for items like Iron Doors, Trapdoors, Anvil" + - " require Iron Plates, Rods, and more.", "Default: false"}) + @Configurable.Comment({ "Recipes for items like Iron Doors, Trapdoors, Anvil" + + " require Iron Plates, Rods, and more.", "Default: false" }) public boolean hardAdvancedIronRecipes = false; // default false @Configurable - @Configurable.Comment({"Whether to make coloring blocks like Concrete or Glass harder.", "Default: false"}) + @Configurable.Comment({ "Whether to make coloring blocks like Concrete or Glass harder.", "Default: false" }) public boolean hardDyeRecipes = false; // default false @Configurable - @Configurable.Comment({"Whether to remove charcoal smelting recipes from the vanilla furnace.", "Default: true"}) + @Configurable.Comment({ "Whether to remove charcoal smelting recipes from the vanilla furnace.", + "Default: true" }) public boolean harderCharcoalRecipe = true; // default true @Configurable - @Configurable.Comment({"Whether to make the Flint and Steel recipe require steel parts.", "Default: true."}) + @Configurable.Comment({ "Whether to make the Flint and Steel recipe require steel parts.", "Default: true." }) public boolean flintAndSteelRequireSteel = true; // default true @Configurable - @Configurable.Comment({"Whether to remove Vanilla Block Recipes from the Crafting Table.", "Default: false"}) + @Configurable.Comment({ "Whether to remove Vanilla Block Recipes from the Crafting Table.", "Default: false" }) public boolean removeVanillaBlockRecipes = false; // default false @Configurable - @Configurable.Comment({"Whether to remove Vanilla TNT Recipe from the Crafting Table.", "Default: true"}) + @Configurable.Comment({ "Whether to remove Vanilla TNT Recipe from the Crafting Table.", "Default: true" }) public boolean removeVanillaTNTRecipe = true; // default true @Configurable @Configurable.Comment({ "How many Multiblock Casings to make per craft. Either 1, 2, or 3.", "Default: 2" }) @@ -106,8 +118,8 @@ public static class RecipeConfigs { public int casingsPerCraft = 2; @Configurable @Configurable.Comment({ - "Whether to nerf the output amounts of the first circuit in a set to 1 (from 2) and SoC to 2 (from 4).", - "Default: false" }) + "Whether to nerf the output amounts of the first circuit in a set to 1 (from 2) and SoC to 2 (from 4).", + "Default: false" }) public boolean harderCircuitRecipes = false; } @@ -117,77 +129,98 @@ public static class CompatibilityConfigs { @Configurable.Comment("Config options regarding GTEU compatibility with other energy systems") public EnergyCompatConfig energy = new EnergyCompatConfig(); + @Configurable @Configurable.Comment("Config options regarding GTCEu compatibility with AE2") public AE2CompatConfig ae2 = new AE2CompatConfig(); @Configurable - @Configurable.Comment({"Whether to hide facades of all blocks in JEI and creative search menu.", "Default: true"}) + @Configurable.Comment({ "Whether to hide facades of all blocks in JEI and creative search menu.", + "Default: true" }) public boolean hideFacadesInJEI = true; @Configurable - @Configurable.Comment({"Whether to hide filled cells in JEI and creative search menu.", "Default: true"}) + @Configurable.Comment({ "Whether to hide filled cells in JEI and creative search menu.", "Default: true" }) public boolean hideFilledCellsInJEI = true; @Configurable - @Configurable.Comment({"Whether Gregtech should remove smelting recipes from the vanilla furnace for ingots requiring the Electric Blast Furnace.", "Default: true"}) + @Configurable.Comment({ "Whether to hide the ore processing diagrams in JEI", "Default: false" }) + public boolean hideOreProcessingDiagrams = false; + + @Configurable + @Configurable.Comment({ + "Whether Gregtech should remove smelting recipes from the vanilla furnace for ingots requiring the Electric Blast Furnace.", + "Default: true" }) public boolean removeSmeltingForEBFMetals = true; public static class EnergyCompatConfig { @Configurable - @Configurable.Comment({"Enable Native GTEU to Platform native Energy (RF and alike) on GT Cables and Wires.", "This does not enable nor disable Converters.", "Default: true"}) + @Configurable.Comment({ + "Enable Native GTEU to Platform native Energy (RF and alike) on GT Cables and Wires.", + "This does not enable nor disable Converters.", "Default: true" }) public boolean nativeEUToPlatformNative = true; @Configurable - @Configurable.Comment({"Enable GTEU to Platform native (and vice versa) Converters.", "Default: false"}) + @Configurable.Comment({ "Enable GTEU to Platform native (and vice versa) Converters.", "Default: false" }) public boolean enablePlatformConverters = false; @Configurable - @Configurable.Comment({"Platform native Energy to GTEU ratio for converting FE to EU.", "Only affects converters.", "Default: 4 FE/Energy == 1 EU"}) + @Configurable.Comment({ "Platform native Energy to GTEU ratio for converting FE to EU.", + "Only affects converters.", "Default: 4 FE/Energy == 1 EU" }) @Configurable.Range(min = 1, max = 16) public int platformToEuRatio = 4; @Configurable - @Configurable.Comment({"GTEU to Platform native Energy ratio for converting EU to FE.", "Affects native conversion and Converters.", "Default: 4 FE/Energy == 1 EU"}) + @Configurable.Comment({ "GTEU to Platform native Energy ratio for converting EU to FE.", + "Affects native conversion and Converters.", "Default: 4 FE/Energy == 1 EU" }) @Configurable.Range(min = 1, max = 16) public int euToPlatformRatio = 4; } public static class AE2CompatConfig { - @Configurable.Comment({"The interval between ME Hatch/Bus interact ME network.", "It may cause lag if the interval is too small.", "Default: 2 sec"}) + + @Configurable.Comment({ "The interval between ME Hatch/Bus interact ME network.", + "It may cause lag if the interval is too small.", "Default: 2 sec" }) @Configurable.Range(min = 1, max = 80) public int updateIntervals = 40; - @Configurable.Comment({"The energy consumption of ME Hatch/Bus.", "Default: 1.0AE/t"}) + @Configurable.Comment({ "The energy consumption of ME Hatch/Bus.", "Default: 1.0AE/t" }) @Configurable.DecimalRange(min = 0.0, max = 10.0) public double meHatchEnergyUsage = 1.0; } } public static class WorldGenConfigs { + @Configurable - @Configurable.Comment({"Rubber Tree spawn chance (% per chunk)", "Default: 0.5"}) + @Configurable.Comment({ "Rubber Tree spawn chance (% per chunk)", "Default: 0.5" }) public float rubberTreeSpawnChance = 0.5f; @Configurable - @Configurable.Comment({"Should all Stone Types drop unique Ore Item Blocks?", "Default: false (meaning only Stone, Netherrack, and Endstone)"}) + @Configurable.Comment({ "Should all Stone Types drop unique Ore Item Blocks?", + "Default: false (meaning only Stone, Netherrack, and Endstone)" }) public boolean allUniqueStoneTypes = false; @Configurable - @Configurable.Comment({"Should Sand-like ores fall?", "This includes gravel, sand, and red sand ores.", "Default: false (no falling ores)"}) + @Configurable.Comment({ "Should Sand-like ores fall?", "This includes gravel, sand, and red sand ores.", + "Default: false (no falling ores)" }) public boolean sandOresFall = false; @Configurable - @Configurable.Comment({ "Whether to increase number of rolls for dungeon chests. Increases dungeon loot drastically.", "Default: true", "WARNING: Currently unimplemented." }) + @Configurable.Comment({ + "Whether to increase number of rolls for dungeon chests. Increases dungeon loot drastically.", + "Default: true", "WARNING: Currently unimplemented." }) public boolean increaseDungeonLoot = true; @Configurable - @Configurable.Comment({ "Allow GregTech to add additional GregTech Items as loot in various structures.", "Default: true" }) + @Configurable.Comment({ "Allow GregTech to add additional GregTech Items as loot in various structures.", + "Default: true" }) public boolean addLoot = true; @Configurable public OreVeinConfigs oreVeins = new OreVeinConfigs(); public static class OreVeinConfigs { + @Configurable @Configurable.Range(min = 1, max = 32) @Configurable.Comment({ @@ -203,16 +236,17 @@ public static class OreVeinConfigs { }) public int oreVeinRandomOffset = 12; @Configurable - @Configurable.Comment({"Prevents regular vanilla ores from being generated outside GregTech ore veins", "Default: true"}) + @Configurable.Comment({ "Prevents regular vanilla ores from being generated outside GregTech ore veins", + "Default: true" }) public boolean removeVanillaOreGen = true; @Configurable - @Configurable.Comment({"Prevents vanilla's large ore veins from being generated", "Default: true"}) + @Configurable.Comment({ "Prevents vanilla's large ore veins from being generated", "Default: true" }) public boolean removeVanillaLargeOreVeins = true; @Configurable - @Configurable.Comment({"Distance between bedrock ore veins in chunks, if enabled.", "Default: 16"}) + @Configurable.Comment({ "Distance between bedrock ore veins in chunks, if enabled.", "Default: 16" }) public int bedrockOreDistance = 16; @Configurable - @Configurable.Comment({"Make bedrock ore/fluid veins infinite?", "Default: false"}) + @Configurable.Comment({ "Make bedrock ore/fluid veins infinite?", "Default: false" }) public boolean infiniteBedrockOresFluids = false; @Configurable @Configurable.Comment({ @@ -233,96 +267,111 @@ public static class OreVeinConfigs { } public static class MachineConfigs { + @Configurable - @Configurable.Comment({"Whether insufficient energy supply should reset Machine recipe progress to zero.", - "If true, progress will reset.", "If false, progress will decrease to zero with 2x speed", "Default: false"}) + @Configurable.Comment({ "Whether insufficient energy supply should reset Machine recipe progress to zero.", + "If true, progress will reset.", "If false, progress will decrease to zero with 2x speed", + "Default: false" }) public boolean recipeProgressLowEnergy = false; @Configurable - @Configurable.Comment({"Whether to require a Wrench, Wirecutter, or other GregTech tools to break machines, casings, wires, and more.", "Default: false"}) + @Configurable.Comment({ + "Whether to require a Wrench, Wirecutter, or other GregTech tools to break machines, casings, wires, and more.", + "Default: false" }) public boolean requireGTToolsForBlocks = false; @Configurable - @Configurable.Comment({"Whether machines explode in rainy weather or when placed next to certain terrain, such as fire or lava", "Default: false"}) + @Configurable.Comment({ + "Whether machines explode in rainy weather or when placed next to certain terrain, such as fire or lava", + "Default: false" }) public boolean doTerrainExplosion = false; @Configurable @Configurable.Comment({ "Energy use multiplier for electric items.", "Default: 100" }) public int energyUsageMultiplier = 100; @Configurable - @Configurable.Comment({ "Energy use multiplier for prospectors.", "Default: 100"}) + @Configurable.Comment({ "Energy use multiplier for prospectors.", "Default: 100" }) public int prospectorEnergyUseMultiplier = 100; @Configurable - @Configurable.Comment({"Whether machines or boilers damage the terrain when they explode.", - "Note machines and boilers always explode when overloaded with power or met with special conditions, regardless of this config.", "Default: true"}) + @Configurable.Comment({ "Whether machines or boilers damage the terrain when they explode.", + "Note machines and boilers always explode when overloaded with power or met with special conditions, regardless of this config.", + "Default: true" }) public boolean doesExplosionDamagesTerrain = true; @Configurable - @Configurable.Comment({"Enables Safe Active Transformers, removing their ability to explode if unformed while transmitting/receiving power.", "Default: false"}) + @Configurable.Comment({ + "Enables Safe Active Transformers, removing their ability to explode if unformed while transmitting/receiving power.", + "Default: false" }) public boolean harmlessActiveTransformers = false; @Configurable - @Configurable.Comment({"Divisor for Recipe Duration per Overclock.", "Default: 2.0"}) + @Configurable.Comment({ "Divisor for Recipe Duration per Overclock.", "Default: 2.0" }) @Configurable.DecimalRange(min = 2.0, max = 3.0) @Configurable.Gui.NumberFormat("0.0#") public double overclockDivisor = 2.0; @Configurable - @Configurable.Comment({"Whether to play machine sounds while machines are active.", "Default: true"}) + @Configurable.Comment({ "Whether to play machine sounds while machines are active.", "Default: true" }) public boolean machineSounds = true; @Configurable - @Configurable.Comment({"Whether Steam Multiblocks should use Steel instead of Bronze.", "Default: false"}) + @Configurable.Comment({ "Whether Steam Multiblocks should use Steel instead of Bronze.", "Default: false" }) public boolean steelSteamMultiblocks = false; @Configurable - @Configurable.Comment({"Whether to enable the cleanroom, required for various recipes.", "Default: true"}) + @Configurable.Comment({ "Whether to enable the cleanroom, required for various recipes.", "Default: true" }) public boolean enableCleanroom = true; @Configurable - @Configurable.Comment({"Whether multiblocks should ignore all cleanroom requirements.", "This does nothing if enableCleanroom is false.", "Default: false"}) + @Configurable.Comment({ "Whether multiblocks should ignore all cleanroom requirements.", + "This does nothing if enableCleanroom is false.", "Default: false" }) public boolean cleanMultiblocks = false; @Configurable - @Configurable.Comment({"Block to replace mined ores with in the miner and multiblock miner.", "Default: minecraft:cobblestone"}) + @Configurable.Comment({ "Block to replace mined ores with in the miner and multiblock miner.", + "Default: minecraft:cobblestone" }) public String replaceMinedBlocksWith = "minecraft:cobblestone"; @Configurable - @Configurable.Comment({"Whether to enable Assembly Line research for recipes.", "Default: true"}) + @Configurable.Comment({ "Whether to enable Assembly Line research for recipes.", "Default: true" }) public boolean enableResearch = true; @Configurable - @Configurable.Comment({"Whether to enable the Maintenance Hatch, required for Multiblocks.", "Default: true"}) + @Configurable.Comment({ "Whether to enable the Maintenance Hatch, required for Multiblocks.", "Default: true" }) public boolean enableMaintenance = true; - @Configurable @Configurable.Comment({ - "Whether to enable World Accelerators, which accelerate ticks for surrounding Tile Entities, Crops, etc.", - "Default: true" }) + "Whether to enable World Accelerators, which accelerate ticks for surrounding Tile Entities, Crops, etc.", + "Default: true" }) public boolean enableWorldAccelerators = true; @Configurable @Configurable.Comment({ "List of TileEntities that the World Accelerator should not accelerate.", - "GregTech TileEntities are always blocked.", - "Entries must be in a fully qualified format. For example: appeng.tile.networking.TileController", - "Default: none" }) + "GregTech TileEntities are always blocked.", + "Entries must be in a fully qualified format. For example: appeng.tile.networking.TileController", + "Default: none" }) public String[] worldAcceleratorBlacklist = new String[0]; @Configurable - @Configurable.Comment({ "Whether to use GT6-style pipe and cable connections, meaning they will not auto-connect " + - "unless placed directly onto another pipe or cable.", "Default: true" }) + @Configurable.Comment({ + "Whether to use GT6-style pipe and cable connections, meaning they will not auto-connect " + + "unless placed directly onto another pipe or cable.", + "Default: true" }) public boolean gt6StylePipesCables = true; @Configurable - @Configurable.Comment({"Whether the machine's circuit slot need to be inserted a real circuit."}) + @Configurable.Comment({ "Whether the machine's circuit slot need to be inserted a real circuit." }) public boolean ghostCircuit = true; @Configurable - @Configurable.Comment({"Wether to add a \"Bedrock Ore Miner\" (also enables bedrock ore generation)", "Default: false"}) + @Configurable.Comment({ "Wether to add a \"Bedrock Ore Miner\" (also enables bedrock ore generation)", + "Default: false" }) public boolean doBedrockOres = false; @Configurable - @Configurable.Comment({"What Kind of material should the bedrock ore miner output?", "Default: \"raw\""}) + @Configurable.Comment({ "What Kind of material should the bedrock ore miner output?", "Default: \"raw\"" }) public String bedrockOreDropTagPrefix = "raw"; @Configurable - @Configurable.Comment({"WARNING: THIS IS NO LONGER SUPPORTED AND WILL BE REMOVED!", "This option only exists to provide backwards compatibility until the Processing Array will be removed in 1.3.0", "Default: false"}) + @Configurable.Comment({ "WARNING: THIS IS NO LONGER SUPPORTED AND WILL BE REMOVED!", + "This option only exists to provide backwards compatibility until the Processing Array will be removed in 1.3.0", + "Default: false" }) public boolean doProcessingArray = false; @Configurable - @Configurable.Comment({"Makes nearly every GCYM Multiblock require blocks which set their maximum voltages.", - "Default: false"}) + @Configurable.Comment({ "Makes nearly every GCYM Multiblock require blocks which set their maximum voltages.", + "Default: false" }) public boolean enableTieredCasings = false; @Configurable - @Configurable.Comment({"Minimum distance between Long Distance Item Pipe Endpoints", "Default: 50"}) + @Configurable.Comment({ "Minimum distance between Long Distance Item Pipe Endpoints", "Default: 50" }) public int ldItemPipeMinDistance = 50; @Configurable - @Configurable.Comment({"Minimum distance betweeb Long Distance Fluid Pipe Endpoints", "Default: 50"}) + @Configurable.Comment({ "Minimum distance betweeb Long Distance Fluid Pipe Endpoints", "Default: 50" }) public int ldFluidPipeMinDistance = 50; /** @@ -330,15 +379,16 @@ public static class MachineConfigs { * Use {@link GTCEuAPI#isHighTier()} instead. */ @Configurable - @Configurable.Comment({"If High Tier (>UV-tier) GT content should be registered.", + @Configurable.Comment({ "If High Tier (>UV-tier) GT content should be registered.", "Items and Machines enabled with this config will have missing recipes by default.", "This is intended for modpack developers only, and is not playable without custom tweaks or addons.", "Other mods can override this to true, regardless of the config file.", - "Default: false"}) + "Default: false" }) public boolean highTierContent = false; } public static class ToolConfigs { + @Configurable @Configurable.Comment({ "Random chance for electric tools to take actual damage", "Default: 10%" }) @Configurable.Range(min = 0, max = 100) @@ -347,130 +397,144 @@ public static class ToolConfigs { @Configurable.Comment({ "Amount of blocks that can be spray painted at once", "Default: 16" }) @Configurable.Range(min = 1, max = 512) public int sprayCanChainLength = 16; + @Configurable @Configurable.Comment("NanoSaber Options") public NanoSaber nanoSaber = new NanoSaber(); + @Configurable @Configurable.Comment("NightVision Goggles Voltage Tier. Default: 1 (LV)") @Configurable.Range(min = 0, max = 14) public int voltageTierNightVision = 1; + @Configurable @Configurable.Comment("NanoSuit Voltage Tier. Default: 3 (HV)") @Configurable.Range(min = 0, max = 14) public int voltageTierNanoSuit = 3; + @Configurable @Configurable.Comment({ "Advanced NanoSuit Chestplate Voltage Tier.", "Default: 3 (HV)" }) @Configurable.Range(min = 0, max = 14) public int voltageTierAdvNanoSuit = 3; + @Configurable @Configurable.Comment({ "QuarkTech Suit Voltage Tier.", "Default: 5 (IV)" }) @Configurable.Range(min = 0, max = 14) public int voltageTierQuarkTech = 5; + @Configurable @Configurable.Comment({ "Advanced QuarkTech Suit Chestplate Voltage Tier.", "Default: 5 (LuV)" }) @Configurable.Range(min = 0, max = 14) public int voltageTierAdvQuarkTech = 6; + @Configurable @Configurable.Comment({ "Electric Impeller Jetpack Voltage Tier.", "Default: 2 (MV)" }) @Configurable.Range(min = 0, max = 14) public int voltageTierImpeller = 2; + @Configurable @Configurable.Comment({ "Advanced Electric Jetpack Voltage Tier.", "Default: 3 (HV)" }) @Configurable.Range(min = 0, max = 14) public int voltageTierAdvImpeller = 3; - @Configurable.Comment("Armor HUD Location") - public ArmorHud armorHud = new ArmorHud(); - - public static class ArmorHud { - @Configurable.Comment({ "Sets HUD location", "1 - left-upper corner", "2 - right-upper corner", - "3 - left-bottom corner", "4 - right-bottom corner" }) - public byte hudLocation = 1; - @Configurable.Comment("Horizontal offset of HUD [0 ~ 100)") - public byte hudOffsetX = 0; - @Configurable.Comment("Vertical offset of HUD [0 ~ 100)") - public byte hudOffsetY = 0; - } public static class NanoSaber { + + @Configurable @Configurable.DecimalRange(min = 0, max = 100) @Configurable.Comment({ "The additional damage added when the NanoSaber is powered.", "Default: 20.0" }) public double nanoSaberDamageBoost = 20; + @Configurable @Configurable.DecimalRange(min = 0, max = 100) @Configurable.Comment({ "The base damage of the NanoSaber.", "Default: 5.0" }) public double nanoSaberBaseDamage = 5; - @Configurable.Comment({ "Should Zombies spawn with charged, active NanoSabers on hard difficulty?", "Default: true" }) + @Configurable + @Configurable.Comment({ "Should Zombies spawn with charged, active NanoSabers on hard difficulty?", + "Default: true" }) public boolean zombieSpawnWithSabers = true; + @Configurable @Configurable.Range(min = 1, max = 512) @Configurable.Comment({ "The EU/t consumption of the NanoSaber.", "Default: 64" }) public int energyConsumption = 64; } } - public static class GameplayConfigs{ + public static class GameplayConfigs { + @Configurable @Configurable.Comment({ "Enable hazardous materials", "Default: true" }) public boolean hazardsEnabled = true; + @Configurable + @Configurable.Comment({ "Whether hazards are applied to all valid items, or just GT's.", + "true = all, false = GT only.", "Default: true" }) + public boolean universalHazards = true; } public static class ClientConfigs { + @Configurable - @Configurable.Comment({"Whether or not to enable Emissive Textures for GregTech Machines.", "Default: true"}) + @Configurable.Comment({ "Whether or not to enable Emissive Textures for GregTech Machines.", "Default: true" }) public boolean machinesEmissiveTextures = true; @Configurable - @Configurable.Comment({ "Whether or not sounds should be played when using tools outside of crafting.", "Default: true" }) + @Configurable.Comment({ "Whether or not sounds should be played when using tools outside of crafting.", + "Default: true" }) public boolean toolUseSounds = true; @Configurable @Configurable.Comment({ "Whether or not sounds should be played when crafting with tools.", "Default: true" }) public boolean toolCraftingSounds = true; @Configurable @Configurable.Comment({ "The default color to overlay onto machines.", - "#FFFFFF is no coloring (default).", - "#D2DCFF is the classic blue from GT5." }) + "#FFFFFF is no coloring (default).", + "#D2DCFF is the classic blue from GT5." }) @Configurable.StringPattern(value = "#[0-9a-fA-F]{1,6}") @Configurable.Gui.ColorValue public String defaultPaintingColor = "#FFFFFF"; @Configurable @Configurable.Comment({ "The default color to overlay onto Machine (and other) UIs.", - "16777215 (#FFFFFF) is no coloring (like GTCE).", - "13819135 (#D2DCFF in decimal) is the classic blue from GT5 (default)." }) + "16777215 (#FFFFFF) is no coloring (like GTCE) (default).", + "13819135 (#D2DCFF in decimal) is the classic blue from GT5." }) @Configurable.StringPattern(value = "#[0-9a-fA-F]{1,6}") @Configurable.Gui.ColorValue public String defaultUIColor = "#FFFFFF"; @Configurable - @Configurable.Comment({"Use VBO cache for multiblock preview.", "Disable it if you have issues with rendering multiblocks.", "Default: true"}) - @Configurable.Gui.ColorValue + @Configurable.Comment({ "Use VBO cache for multiblock preview.", + "Disable if you have issues with rendering multiblocks.", "Default: true" }) public boolean useVBO = true; @Configurable - @Configurable.Comment({"Duration of the multiblock in-world preview (s)", "Default: 10"}) + @Configurable.Comment({ "Duration of the multiblock in-world preview (s)", "Default: 10" }) @Configurable.Range(min = 1, max = 999) public int inWorldPreviewDuration = 10; @Configurable - @Configurable.Comment({"Duration of UI animations in ms", "Default: 300"}) + @Configurable.Comment({ "Duration of UI animations in ms", "Default: 300" }) @Configurable.Range(min = 1) public int animationTime = 300; @Configurable public ArmorHud armorHud = new ArmorHud(); public static class ArmorHud { + @Configurable - @Configurable.Comment({"Sets HUD location", "1 - left-upper corner", "2 - right-upper corner", "3 - left-bottom corner", "4 - right-bottom corner", "Default: 1"}) + @Configurable.Comment({ "Sets HUD location", "1 - left-upper corner", "2 - right-upper corner", + "3 - left-bottom corner", "4 - right-bottom corner", "Default: 1" }) @Configurable.Range(min = 1, max = 4) public int hudLocation = 1; @Configurable - @Configurable.Comment({"Horizontal offset of HUD.", "Default: 0"}) + @Configurable.Comment({ "Horizontal offset of HUD.", "Default: 0" }) @Configurable.Range(min = 0, max = 100) public int hudOffsetX = 0; @Configurable - @Configurable.Comment({"Vertical offset of HUD.", "Default: 0"}) + @Configurable.Comment({ "Vertical offset of HUD.", "Default: 0" }) @Configurable.Range(min = 0, max = 100) public int hudOffsetY = 0; } } public static class DeveloperConfigs { + @Configurable - @Configurable.Comment({"Debug general events? (will print placed veins to server's debug.log)", "Default: false"}) + @Configurable.Comment({ "Debug general events? (will print recipe conficts etc. to server's debug.log)", + "Default: false" }) public boolean debug = false; @Configurable - @Configurable.Comment({"Debug ore vein placement? (will print placed veins to server's debug.log)", "Default: false (no placement printout in debug.log)"}) + @Configurable.Comment({ "Debug ore vein placement? (will print placed veins to server's debug.log)", + "Default: false (no placement printout in debug.log)" }) public boolean debugWorldgen = false; @Configurable - @Configurable.Comment({"Dump all registered GT recipes?", "Default: false"}) + @Configurable.Comment({ "Dump all registered GT recipes?", "Default: false" }) public boolean dumpRecipes = false; @Configurable - @Configurable.Comment({"Dump all registered GT models/blockstates/etc?", "Default: false"}) + @Configurable.Comment({ "Dump all registered GT models/blockstates/etc?", "Default: false" }) public boolean dumpAssets = false; } } diff --git a/src/main/java/com/gregtechceu/gtceu/core/IGTTagLoader.java b/src/main/java/com/gregtechceu/gtceu/core/IGTTagLoader.java index c361e0e267..3d6c903d4b 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/IGTTagLoader.java +++ b/src/main/java/com/gregtechceu/gtceu/core/IGTTagLoader.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.core; import net.minecraft.core.Registry; + import org.jetbrains.annotations.Nullable; public interface IGTTagLoader { @@ -9,5 +10,4 @@ public interface IGTTagLoader { @Nullable Registry gtceu$getRegistry(); - } diff --git a/src/main/java/com/gregtechceu/gtceu/core/MixinHelpers.java b/src/main/java/com/gregtechceu/gtceu/core/MixinHelpers.java index 0726f5d5b5..cd4cdf1db0 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/MixinHelpers.java +++ b/src/main/java/com/gregtechceu/gtceu/core/MixinHelpers.java @@ -1,10 +1,7 @@ package com.gregtechceu.gtceu.core; -import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.GTCEuAPI; import com.gregtechceu.gtceu.api.GTValues; -import com.gregtechceu.gtceu.api.addon.AddonFinder; -import com.gregtechceu.gtceu.api.addon.IGTAddon; import com.gregtechceu.gtceu.api.data.chemical.ChemicalHelper; import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.api.data.chemical.material.properties.FluidProperty; @@ -19,20 +16,15 @@ import com.gregtechceu.gtceu.api.registry.registrate.forge.GTClientFluidTypeExtensions; import com.gregtechceu.gtceu.common.data.GTBlocks; import com.gregtechceu.gtceu.common.data.GTItems; -import com.gregtechceu.gtceu.common.data.GTRecipes; import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.core.mixins.BlockBehaviourAccessor; -import com.gregtechceu.gtceu.data.loot.DungeonLootLoader; -import com.gregtechceu.gtceu.data.pack.GTDynamicDataPack; -import com.gregtechceu.gtceu.data.pack.GTDynamicResourcePack; import com.gregtechceu.gtceu.data.recipe.CustomTags; -import com.tterrag.registrate.util.entry.BlockEntry; + import net.minecraft.core.Registry; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.data.loot.BlockLootSubProvider; import net.minecraft.data.loot.packs.VanillaBlockLoot; import net.minecraft.resources.ResourceLocation; -import net.minecraft.server.packs.PackResources; import net.minecraft.tags.BlockTags; import net.minecraft.tags.TagEntry; import net.minecraft.tags.TagKey; @@ -54,16 +46,17 @@ import net.minecraft.world.level.storage.loot.providers.number.UniformGenerator; import net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions; +import com.tterrag.registrate.util.entry.BlockEntry; + import java.util.ArrayList; -import java.util.Collection; import java.util.List; import java.util.Map; import java.util.function.Supplier; -import java.util.stream.Collectors; public class MixinHelpers { - public static void generateGTDynamicTags(Map> tagMap, Registry registry) { + public static void generateGTDynamicTags(Map> tagMap, + Registry registry) { if (registry == BuiltInRegistries.ITEM) { ChemicalHelper.UNIFICATION_ENTRY_ITEM.forEach((entry, itemLikes) -> { if (itemLikes.isEmpty()) return; @@ -72,7 +65,9 @@ public static void generateGTDynamicTags(Map materialTag : materialTags) { List tags = new ArrayList<>(); - itemLikes.forEach(item -> tags.add(new TagLoader.EntryWithSource(TagEntry.element(BuiltInRegistries.ITEM.getKey(item.get().asItem())), GTValues.CUSTOM_TAG_SOURCE))); + itemLikes.forEach(item -> tags.add(new TagLoader.EntryWithSource( + TagEntry.element(BuiltInRegistries.ITEM.getKey(item.get().asItem())), + GTValues.CUSTOM_TAG_SOURCE))); tagMap.computeIfAbsent(materialTag.location(), path -> new ArrayList<>()).addAll(tags); } @@ -82,7 +77,8 @@ public static void generateGTDynamicTags(Map { map.forEach((type, item) -> { if (item != null) { - var entry = new TagLoader.EntryWithSource(TagEntry.element(item.getId()), GTValues.CUSTOM_TAG_SOURCE); + var entry = new TagLoader.EntryWithSource(TagEntry.element(item.getId()), + GTValues.CUSTOM_TAG_SOURCE); for (TagKey tag : type.itemTags) { tagMap.computeIfAbsent(tag.location(), path -> new ArrayList<>()).add(entry); } @@ -105,17 +101,18 @@ public static void generateGTDynamicTags(Map { ResourceLocation id = machine.getId(); tagMap.computeIfAbsent(GTToolType.WRENCH.harvestTags.get(0).location(), path -> new ArrayList<>()) - .add(new TagLoader.EntryWithSource(TagEntry.element(id), GTValues.CUSTOM_TAG_SOURCE)); + .add(new TagLoader.EntryWithSource(TagEntry.element(id), GTValues.CUSTOM_TAG_SOURCE)); if (!ConfigHolder.INSTANCE.machines.requireGTToolsForBlocks) { tagMap.computeIfAbsent(BlockTags.MINEABLE_WITH_PICKAXE.location(), path -> new ArrayList<>()) - .add(new TagLoader.EntryWithSource(TagEntry.element(id), GTValues.CUSTOM_TAG_SOURCE)); + .add(new TagLoader.EntryWithSource(TagEntry.element(id), GTValues.CUSTOM_TAG_SOURCE)); } }); GTBlocks.ALL_FUSION_CASINGS.forEach((casingType, block) -> { ResourceLocation blockId = BuiltInRegistries.BLOCK.getKey(block.get()); - tagMap.computeIfAbsent(CustomTags.TOOL_TIERS[casingType.getHarvestLevel()].location(), path -> new ArrayList<>()) - .add(new TagLoader.EntryWithSource(TagEntry.element(blockId), GTValues.CUSTOM_TAG_SOURCE)); + tagMap.computeIfAbsent(CustomTags.TOOL_TIERS[casingType.getHarvestLevel()].location(), + path -> new ArrayList<>()) + .add(new TagLoader.EntryWithSource(TagEntry.element(blockId), GTValues.CUSTOM_TAG_SOURCE)); }); } else if (registry == BuiltInRegistries.FLUID) { for (Material material : GTCEuAPI.materialManager.getRegisteredMaterials()) { @@ -127,8 +124,10 @@ public static void generateGTDynamicTags(Map new ArrayList<>()) - .add(new TagLoader.EntryWithSource(TagEntry.element(fluidId), GTValues.CUSTOM_TAG_SOURCE)); + tagMap.computeIfAbsent(TagUtil.createFluidTag(fluidId.getPath()).location(), + path -> new ArrayList<>()) + .add(new TagLoader.EntryWithSource(TagEntry.element(fluidId), + GTValues.CUSTOM_TAG_SOURCE)); } } } @@ -136,22 +135,28 @@ public static void generateGTDynamicTags(Map> tagMap, TagPrefix prefix, Map> map) { + public static void addMaterialBlockTags(Map> tagMap, + TagPrefix prefix, + Map> map) { // Add tool tags if (!prefix.miningToolTag().isEmpty()) { map.forEach((material, block) -> { - tagMap.computeIfAbsent(CustomTags.TOOL_TIERS[material.getBlockHarvestLevel()].location(), path -> new ArrayList<>()) - .add(new TagLoader.EntryWithSource(TagEntry.element(block.getId()), GTValues.CUSTOM_TAG_SOURCE)); + tagMap.computeIfAbsent(CustomTags.TOOL_TIERS[material.getBlockHarvestLevel()].location(), + path -> new ArrayList<>()) + .add(new TagLoader.EntryWithSource(TagEntry.element(block.getId()), + GTValues.CUSTOM_TAG_SOURCE)); var entry = new TagLoader.EntryWithSource(TagEntry.element(block.getId()), GTValues.CUSTOM_TAG_SOURCE); if (material.hasProperty(PropertyKey.WOOD)) { - tagMap.computeIfAbsent(BlockTags.MINEABLE_WITH_AXE.location(), path -> new ArrayList<>()).add(entry); + tagMap.computeIfAbsent(BlockTags.MINEABLE_WITH_AXE.location(), path -> new ArrayList<>()) + .add(entry); } else { for (var tag : prefix.miningToolTag()) { tagMap.computeIfAbsent(tag.location(), path -> new ArrayList<>()).add(entry); } if (!ConfigHolder.INSTANCE.machines.requireGTToolsForBlocks) { - tagMap.computeIfAbsent(BlockTags.MINEABLE_WITH_PICKAXE.location(), path -> new ArrayList<>()).add(entry); + tagMap.computeIfAbsent(BlockTags.MINEABLE_WITH_PICKAXE.location(), path -> new ArrayList<>()) + .add(entry); } } }); @@ -160,7 +165,8 @@ public static void addMaterialBlockTags(Map { for (TagKey blockTag : prefix.getAllBlockTags(material)) { tagMap.computeIfAbsent(blockTag.location(), path -> new ArrayList<>()) - .add(new TagLoader.EntryWithSource(TagEntry.element(block.getId()), GTValues.CUSTOM_TAG_SOURCE)); + .add(new TagLoader.EntryWithSource(TagEntry.element(block.getId()), + GTValues.CUSTOM_TAG_SOURCE)); } }); } @@ -172,7 +178,8 @@ public static void generateGTDynamicLoot(Map lootTa if (TagPrefix.ORES.containsKey(prefix)) { final TagPrefix.OreType type = TagPrefix.ORES.get(prefix); map.forEach((material, blockEntry) -> { - ResourceLocation lootTableId = new ResourceLocation(blockEntry.getId().getNamespace(), "blocks/" + blockEntry.getId().getPath()); + ResourceLocation lootTableId = new ResourceLocation(blockEntry.getId().getNamespace(), + "blocks/" + blockEntry.getId().getPath()); Block block = blockEntry.get(); if (!type.shouldDropAsItem() && !ConfigHolder.INSTANCE.worldgen.allUniqueStoneTypes) { @@ -186,10 +193,12 @@ public static void generateGTDynamicLoot(Map lootTa int oreMultiplier = type.isDoubleDrops() ? 2 : 1; LootTable.Builder builder = BlockLootSubProvider.createSilkTouchDispatchTable(block, - BLOCK_LOOT.applyExplosionDecay(block, - LootItem.lootTableItem(dropItem.getItem()) - .apply(SetItemCountFunction.setCount(UniformGenerator.between(1, Math.max(1, material.getProperty(PropertyKey.ORE).getOreMultiplier() * oreMultiplier)))))); - //.apply(ApplyBonusCount.addOreBonusCount(Enchantments.BLOCK_FORTUNE)))); //disable fortune for balance reasons. (for now, until we can think of a better solution.) + BLOCK_LOOT.applyExplosionDecay(block, + LootItem.lootTableItem(dropItem.getItem()) + .apply(SetItemCountFunction.setCount( + UniformGenerator.between(1, Math.max(1, oreMultiplier)))))); + // .apply(ApplyBonusCount.addOreBonusCount(Enchantments.BLOCK_FORTUNE)))); //disable fortune for + // balance reasons. (for now, until we can think of a better solution.) Supplier outputDustMat = type.material(); LootPool.Builder pool = LootPool.lootPool(); @@ -198,11 +207,11 @@ public static void generateGTDynamicLoot(Map lootTa if (secondaryMaterial.material().hasProperty(PropertyKey.DUST)) { ItemStack dustStack = ChemicalHelper.getGem(secondaryMaterial); pool.add(LootItem.lootTableItem(dustStack.getItem()) - .when(BlockLootSubProvider.HAS_NO_SILK_TOUCH) - .apply(SetItemCountFunction.setCount(UniformGenerator.between(0, 1))) - .apply(ApplyBonusCount.addUniformBonusCount(Enchantments.BLOCK_FORTUNE)) - .apply(LimitCount.limitCount(IntRange.range(0, 2))) - .apply(ApplyExplosionDecay.explosionDecay())); + .when(BlockLootSubProvider.HAS_NO_SILK_TOUCH) + .apply(SetItemCountFunction.setCount(UniformGenerator.between(0, 1))) + .apply(ApplyBonusCount.addUniformBonusCount(Enchantments.BLOCK_FORTUNE)) + .apply(LimitCount.limitCount(IntRange.range(0, 2))) + .apply(ApplyExplosionDecay.explosionDecay())); isEmpty = false; } } @@ -210,7 +219,7 @@ public static void generateGTDynamicLoot(Map lootTa builder.withPool(pool); } lootTables.put(lootTableId, builder.setParamSet(LootContextParamSets.BLOCK).build()); - ((BlockBehaviourAccessor)blockEntry.get()).setDrops(lootTableId); + ((BlockBehaviourAccessor) blockEntry.get()).setDrops(lootTableId); }); } else { MixinHelpers.addMaterialBlockLootTables(lootTables, prefix, map); @@ -226,9 +235,12 @@ public static void generateGTDynamicLoot(Map lootTa MixinHelpers.addMaterialBlockLootTables(lootTables, prefix, map); }); GTBlocks.SURFACE_ROCK_BLOCKS.forEach((material, blockEntry) -> { - ResourceLocation lootTableId = new ResourceLocation(blockEntry.getId().getNamespace(), "blocks/" + blockEntry.getId().getPath()); - LootTable.Builder builder = BLOCK_LOOT.createSingleItemTable(ChemicalHelper.get(TagPrefix.dustTiny, material).getItem(), UniformGenerator.between(3, 5)) - .apply(ApplyBonusCount.addUniformBonusCount(Enchantments.BLOCK_FORTUNE)); + ResourceLocation lootTableId = new ResourceLocation(blockEntry.getId().getNamespace(), + "blocks/" + blockEntry.getId().getPath()); + LootTable.Builder builder = BLOCK_LOOT + .createSingleItemTable(ChemicalHelper.get(TagPrefix.dustTiny, material).getItem(), + UniformGenerator.between(3, 5)) + .apply(ApplyBonusCount.addUniformBonusCount(Enchantments.BLOCK_FORTUNE)); lootTables.put(lootTableId, builder.setParamSet(LootContextParamSets.BLOCK).build()); ((BlockBehaviourAccessor) blockEntry.get()).setDrops(lootTableId); }); @@ -236,16 +248,20 @@ public static void generateGTDynamicLoot(Map lootTa Block block = machine.getBlock(); ResourceLocation id = machine.getId(); ResourceLocation lootTableId = new ResourceLocation(id.getNamespace(), "blocks/" + id.getPath()); - ((BlockBehaviourAccessor)block).setDrops(lootTableId); - lootTables.put(lootTableId, BLOCK_LOOT.createSingleItemTable(block).setParamSet(LootContextParamSets.BLOCK).build()); + ((BlockBehaviourAccessor) block).setDrops(lootTableId); + lootTables.put(lootTableId, + BLOCK_LOOT.createSingleItemTable(block).setParamSet(LootContextParamSets.BLOCK).build()); }); } - public static void addMaterialBlockLootTables(Map lootTables, TagPrefix prefix, Map> map) { + public static void addMaterialBlockLootTables(Map lootTables, TagPrefix prefix, + Map> map) { map.forEach((material, blockEntry) -> { - ResourceLocation lootTableId = new ResourceLocation(blockEntry.getId().getNamespace(), "blocks/" + blockEntry.getId().getPath()); - ((BlockBehaviourAccessor)blockEntry.get()).setDrops(lootTableId); - lootTables.put(lootTableId, BLOCK_LOOT.createSingleItemTable(blockEntry.get()).setParamSet(LootContextParamSets.BLOCK).build()); + ResourceLocation lootTableId = new ResourceLocation(blockEntry.getId().getNamespace(), + "blocks/" + blockEntry.getId().getPath()); + ((BlockBehaviourAccessor) blockEntry.get()).setDrops(lootTableId); + lootTables.put(lootTableId, + BLOCK_LOOT.createSingleItemTable(blockEntry.get()).setParamSet(LootContextParamSets.BLOCK).build()); }); } diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/AbstractRegistrateAccessor.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/AbstractRegistrateAccessor.java index 62605a2bda..801fa24fc6 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/AbstractRegistrateAccessor.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/AbstractRegistrateAccessor.java @@ -12,8 +12,10 @@ @Mixin(value = AbstractRegistrate.class, remap = false) public interface AbstractRegistrateAccessor { + @Accessor ListMultimap, @NonnullType NonNullConsumer> getDatagens(); + @Accessor NonNullSupplier getDoDatagen(); } diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/BlockBehaviourAccessor.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/BlockBehaviourAccessor.java index 5a0b474dae..5cd7f8d76b 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/BlockBehaviourAccessor.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/BlockBehaviourAccessor.java @@ -2,11 +2,13 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.block.state.BlockBehaviour; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; @Mixin(BlockBehaviour.class) public interface BlockBehaviourAccessor { + @Accessor("properties") BlockBehaviour.Properties getBlockProperties(); diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/BlockModelMixin.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/BlockModelMixin.java index 6f109a4838..e027ca9ed0 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/BlockModelMixin.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/BlockModelMixin.java @@ -1,12 +1,15 @@ package com.gregtechceu.gtceu.core.mixins; import com.gregtechceu.gtceu.client.model.SpriteOverrider; + import com.lowdragmc.lowdraglib.client.model.ModelFactory; -import com.mojang.datafixers.util.Either; + import net.minecraft.client.renderer.block.model.BlockModel; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.resources.model.*; import net.minecraft.resources.ResourceLocation; + +import com.mojang.datafixers.util.Either; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -22,31 +25,34 @@ */ @Mixin(BlockModel.class) public class BlockModelMixin { - @Shadow public String name; + + @Shadow + public String name; ThreadLocal spriteOverriderThreadLocal = ThreadLocal.withInitial(() -> null); // We want to remap our materials @Inject(method = "bake(Lnet/minecraft/client/resources/model/ModelBaker;Lnet/minecraft/client/renderer/block/model/BlockModel;Ljava/util/function/Function;Lnet/minecraft/client/resources/model/ModelState;Lnet/minecraft/resources/ResourceLocation;Z)Lnet/minecraft/client/resources/model/BakedModel;", - at =@At(value = "HEAD") - ) - private void beforeBake(ModelBaker baker, BlockModel model, Function spriteGetter, ModelState state, ResourceLocation location, boolean guiLight3d, CallbackInfoReturnable cir) { + at = @At(value = "HEAD")) + private void beforeBake(ModelBaker baker, BlockModel model, Function spriteGetter, + ModelState state, ResourceLocation location, boolean guiLight3d, + CallbackInfoReturnable cir) { if (spriteGetter instanceof SpriteOverrider spriteOverrider) { spriteOverriderThreadLocal.set(spriteOverrider); } } @Inject(method = "bake(Lnet/minecraft/client/resources/model/ModelBaker;Lnet/minecraft/client/renderer/block/model/BlockModel;Ljava/util/function/Function;Lnet/minecraft/client/resources/model/ModelState;Lnet/minecraft/resources/ResourceLocation;Z)Lnet/minecraft/client/resources/model/BakedModel;", - at =@At(value = "RETURN") - ) - private void afterBake(ModelBaker baker, BlockModel model, Function spriteGetter, ModelState state, ResourceLocation location, boolean guiLight3d, CallbackInfoReturnable cir) { + at = @At(value = "RETURN")) + private void afterBake(ModelBaker baker, BlockModel model, Function spriteGetter, + ModelState state, ResourceLocation location, boolean guiLight3d, + CallbackInfoReturnable cir) { if (spriteGetter instanceof SpriteOverrider) { spriteOverriderThreadLocal.remove(); } } - // We want to remap our materials - @Inject(method = "findTextureEntry", at =@At(value = "HEAD"), cancellable = true) + @Inject(method = "findTextureEntry", at = @At(value = "HEAD"), cancellable = true) private void remapTextureEntry(String name, CallbackInfoReturnable> cir) { SpriteOverrider overrider = spriteOverriderThreadLocal.get(); if (overrider != null && overrider.override().containsKey(name)) { @@ -56,5 +62,4 @@ private void remapTextureEntry(String name, CallbackInfoReturnable getLightEmission(); + @Accessor Function getMapColor(); + @Accessor SoundType getSoundType(); + @Accessor float getFriction(); + @Accessor float getSpeedFactor(); + @Accessor boolean isDynamicShape(); + @Accessor boolean isCanOcclude(); + @Accessor boolean isIsAir(); + @Accessor boolean isIgnitedByLava(); + @Accessor boolean isLiquid(); + @Accessor boolean isForceSolidOff(); + @Accessor boolean isForceSolidOn(); + @Accessor PushReaction getPushReaction(); + @Accessor boolean isRequiresCorrectToolForDrops(); + @Accessor Optional getOffsetFunction(); + @SuppressWarnings("OptionalUsedAsFieldOrParameterType") @Accessor void setOffsetFunction(Optional function); + @Accessor boolean isSpawnParticlesOnBreak(); + @Accessor FeatureFlagSet getRequiredFeatures(); + @Accessor void setRequiredFeatures(FeatureFlagSet set); + @Accessor BlockBehaviour.StatePredicate getEmissiveRendering(); + @Accessor NoteBlockInstrument getInstrument(); + @Accessor boolean isReplaceable(); } diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/ChunkGeneratorMixin.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/ChunkGeneratorMixin.java index e2c53cecbd..384ffe1a72 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/ChunkGeneratorMixin.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/ChunkGeneratorMixin.java @@ -1,24 +1,27 @@ package com.gregtechceu.gtceu.core.mixins; import com.gregtechceu.gtceu.api.data.worldgen.ores.OrePlacer; + import net.minecraft.world.level.StructureManager; import net.minecraft.world.level.WorldGenLevel; import net.minecraft.world.level.chunk.ChunkAccess; import net.minecraft.world.level.chunk.ChunkGenerator; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - @Mixin(ChunkGenerator.class) public class ChunkGeneratorMixin { + @Unique private final OrePlacer orePlacer = new OrePlacer(); @Inject(method = "applyBiomeDecoration", at = @At("TAIL")) - private void gtceu$applyBiomeDecoration(WorldGenLevel level, ChunkAccess chunk, StructureManager structureManager, CallbackInfo ci) { + private void gtceu$applyBiomeDecoration(WorldGenLevel level, ChunkAccess chunk, StructureManager structureManager, + CallbackInfo ci) { orePlacer.placeOres(level, (ChunkGenerator) ((Object) this), chunk); } } diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/ChunkMixin.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/ChunkMixin.java index a01e254864..7fc95725e4 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/ChunkMixin.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/ChunkMixin.java @@ -1,12 +1,14 @@ package com.gregtechceu.gtceu.core.mixins; import com.gregtechceu.gtceu.api.pattern.MultiblockWorldSavedData; + import net.minecraft.core.BlockPos; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.LevelChunk; + import org.objectweb.asm.Opcodes; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; @@ -17,16 +19,23 @@ @Mixin(LevelChunk.class) public class ChunkMixin { - @Final @Shadow Level level; + + @Final + @Shadow + Level level; // We want to be as quick as possible here - @Inject(method = "setBlockState", at = @At(value = "INVOKE", opcode = Opcodes.GETFIELD, target = "Lnet/minecraft/world/level/block/state/BlockState;onPlace(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Z)V")) - private void gtceu$onChunkChanged(BlockPos pos, BlockState state, boolean isMoving, CallbackInfoReturnable cir) { + @Inject(method = "setBlockState", + at = @At(value = "INVOKE", + opcode = Opcodes.GETFIELD, + target = "Lnet/minecraft/world/level/block/state/BlockState;onPlace(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Z)V")) + private void gtceu$onChunkChanged(BlockPos pos, BlockState state, boolean isMoving, + CallbackInfoReturnable cir) { MinecraftServer server = level.getServer(); if (server != null) { if (level instanceof ServerLevel serverLevel) { for (var structure : MultiblockWorldSavedData.getOrCreate(serverLevel) - .getControllerInChunk(((LevelChunk)(Object)this).getPos())) { + .getControllerInChunk(((LevelChunk) (Object) this).getPos())) { if (structure.isPosInCache(pos)) { server.executeBlocking(() -> structure.onBlockStateChanged(pos, state)); } @@ -34,5 +43,4 @@ public class ChunkMixin { } } } - } diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/EntityMixin.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/EntityMixin.java index 98aac5709c..d068c1e940 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/EntityMixin.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/EntityMixin.java @@ -1,13 +1,20 @@ package com.gregtechceu.gtceu.core.mixins; +import com.gregtechceu.gtceu.api.capability.GTCapabilityHelper; +import com.gregtechceu.gtceu.api.capability.IHazardEffectTracker; import com.gregtechceu.gtceu.core.IFireImmuneEntity; + import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; +import net.minecraft.world.level.Level; + +import com.llamalad7.mixinextras.injector.ModifyReturnValue; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(Entity.class) @@ -18,13 +25,33 @@ public abstract class EntityMixin implements IFireImmuneEntity { @Unique private boolean gtceu$fireImmune = false; + @Unique + private boolean gtceu$isEntityInit = false; @Inject(method = "fireImmune", at = @At("RETURN"), cancellable = true) private void gtceu$changeFireImmune(CallbackInfoReturnable cir) { cir.setReturnValue(gtceu$fireImmune || cir.getReturnValueZ()); } + @Inject(method = "", at = @At("TAIL")) + private void gtceu$onEntityInit(EntityType entityType, Level level, CallbackInfo ci) { + gtceu$isEntityInit = true; + } + public void gtceu$setFireImmune(boolean isImmune) { this.gtceu$fireImmune = isImmune; } + + @SuppressWarnings("UnreachableCode") // it doesn't like the cast because mixin. + @ModifyReturnValue(method = "getMaxAirSupply", at = @At("RETURN")) + private int gtceu$hazardModifyMaxAir(int original) { + if (!gtceu$isEntityInit) { + return original; + } + IHazardEffectTracker tracker = GTCapabilityHelper.getHazardEffectTracker((Entity) (Object) this); + if (tracker != null && tracker.getMaxAirSupply() != -1) { + return tracker.getMaxAirSupply(); + } + return original; + } } diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/GregTechMixinPlugin.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/GregTechMixinPlugin.java index bfd442d487..0ad2923f28 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/GregTechMixinPlugin.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/GregTechMixinPlugin.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.core.mixins; import com.lowdragmc.lowdraglib.core.mixins.MixinPluginShared; + import org.objectweb.asm.tree.ClassNode; import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin; import org.spongepowered.asm.mixin.extensibility.IMixinInfo; @@ -9,10 +10,9 @@ import java.util.Set; public class GregTechMixinPlugin implements IMixinConfigPlugin { - @Override - public void onLoad(String mixinPackage) { - } + @Override + public void onLoad(String mixinPackage) {} @Override public String getRefMapperConfig() { @@ -36,9 +36,7 @@ public boolean shouldApplyMixin(String targetClassName, String mixinClassName) { } @Override - public void acceptTargets(Set myTargets, Set otherTargets) { - - } + public void acceptTargets(Set myTargets, Set otherTargets) {} @Override public List getMixins() { @@ -46,12 +44,8 @@ public List getMixins() { } @Override - public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) { - - } + public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {} @Override - public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) { - - } + public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {} } diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/GuiGraphicsAccessor.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/GuiGraphicsAccessor.java index 44a18e22d5..a391fc22c6 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/GuiGraphicsAccessor.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/GuiGraphicsAccessor.java @@ -1,9 +1,10 @@ package com.gregtechceu.gtceu.core.mixins; -import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.renderer.MultiBufferSource; + +import com.mojang.blaze3d.vertex.PoseStack; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Invoker; @@ -14,8 +15,10 @@ */ @Mixin(GuiGraphics.class) public interface GuiGraphicsAccessor { + @Invoker("") - static GuiGraphics create(Minecraft client, PoseStack matrices, MultiBufferSource.BufferSource vertexConsumerProvider) { + static GuiGraphics create(Minecraft client, PoseStack matrices, + MultiBufferSource.BufferSource vertexConsumerProvider) { return null; } } diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/GuiGraphicsMixin.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/GuiGraphicsMixin.java index 6236a51baf..d5d8bc11e1 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/GuiGraphicsMixin.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/GuiGraphicsMixin.java @@ -1,15 +1,13 @@ package com.gregtechceu.gtceu.core.mixins; -import com.gregtechceu.gtceu.api.item.ComponentItem; import com.gregtechceu.gtceu.api.item.IComponentItem; import com.gregtechceu.gtceu.api.item.IGTTool; import com.gregtechceu.gtceu.client.util.ToolChargeBarRenderer; -import com.llamalad7.mixinextras.injector.ModifyExpressionValue; -import com.llamalad7.mixinextras.sugar.Share; -import com.llamalad7.mixinextras.sugar.ref.LocalBooleanRef; + import net.minecraft.client.gui.Font; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.world.item.ItemStack; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -19,13 +17,14 @@ public class GuiGraphicsMixin { @Inject( - method = "renderItemDecorations(Lnet/minecraft/client/gui/Font;Lnet/minecraft/world/item/ItemStack;IILjava/lang/String;)V", - at = @At( - value = "FIELD", - target = "Lnet/minecraft/client/gui/GuiGraphics;minecraft:Lnet/minecraft/client/Minecraft;", - shift = At.Shift.BEFORE, - ordinal = 0)) - private void gtceu$renderCustomDurabilityBars(Font font, ItemStack stack, int x, int y, String text, CallbackInfo ci) { + method = "renderItemDecorations(Lnet/minecraft/client/gui/Font;Lnet/minecraft/world/item/ItemStack;IILjava/lang/String;)V", + at = @At( + value = "FIELD", + target = "Lnet/minecraft/client/gui/GuiGraphics;minecraft:Lnet/minecraft/client/Minecraft;", + shift = At.Shift.BEFORE, + ordinal = 0)) + private void gtceu$renderCustomDurabilityBars(Font font, ItemStack stack, int x, int y, String text, + CallbackInfo ci) { if (stack.getItem() instanceof IGTTool toolItem) { ToolChargeBarRenderer.renderBarsTool((GuiGraphics) (Object) this, toolItem, stack, x, y); } else if (stack.getItem() instanceof IComponentItem componentItem) { diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/GuiHeartTypeMixin.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/GuiHeartTypeMixin.java new file mode 100644 index 0000000000..d50077288c --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/GuiHeartTypeMixin.java @@ -0,0 +1,21 @@ +package com.gregtechceu.gtceu.core.mixins; + +import com.gregtechceu.gtceu.common.data.GTMobEffects; + +import net.minecraft.world.entity.player.Player; + +import com.llamalad7.mixinextras.injector.ModifyExpressionValue; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; + +@Mixin(targets = "net.minecraft.client.gui.Gui$HeartType") +public class GuiHeartTypeMixin { + + @ModifyExpressionValue(method = "forPlayer", + at = @At(value = "INVOKE", + target = "Lnet/minecraft/world/entity/player/Player;hasEffect(Lnet/minecraft/world/effect/MobEffect;)Z", + ordinal = 0)) + private static boolean gtceu$isPoisoned(boolean original, Player player) { + return original || player.hasEffect(GTMobEffects.WEAK_POISON.get()); + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/IFoliagePlacerTypeAccessor.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/IFoliagePlacerTypeAccessor.java index 3e400e1f24..0e10bfda2b 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/IFoliagePlacerTypeAccessor.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/IFoliagePlacerTypeAccessor.java @@ -1,10 +1,9 @@ package com.gregtechceu.gtceu.core.mixins; -import com.mojang.serialization.Codec; import net.minecraft.world.level.levelgen.feature.foliageplacers.FoliagePlacer; import net.minecraft.world.level.levelgen.feature.foliageplacers.FoliagePlacerType; -import net.minecraft.world.level.levelgen.feature.trunkplacers.TrunkPlacer; -import net.minecraft.world.level.levelgen.feature.trunkplacers.TrunkPlacerType; + +import com.mojang.serialization.Codec; import org.apache.commons.lang3.NotImplementedException; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Invoker; diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/IHolderReferenceAccessor.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/IHolderReferenceAccessor.java index ef73d50cd5..3a2bc3bdbe 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/IHolderReferenceAccessor.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/IHolderReferenceAccessor.java @@ -1,13 +1,12 @@ package com.gregtechceu.gtceu.core.mixins; import net.minecraft.core.Holder; -import net.minecraft.resources.ResourceKey; + import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Invoker; @Mixin(Holder.Reference.class) public interface IHolderReferenceAccessor extends Holder { -// @Invoker -// void invokeBind(ResourceKey key, T value); + // @Invoker + // void invokeBind(ResourceKey key, T value); } diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/ITrunkPlacerTypeAccessor.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/ITrunkPlacerTypeAccessor.java index b04bf92f74..736d111b32 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/ITrunkPlacerTypeAccessor.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/ITrunkPlacerTypeAccessor.java @@ -1,8 +1,9 @@ package com.gregtechceu.gtceu.core.mixins; -import com.mojang.serialization.Codec; import net.minecraft.world.level.levelgen.feature.trunkplacers.TrunkPlacer; import net.minecraft.world.level.levelgen.feature.trunkplacers.TrunkPlacerType; + +import com.mojang.serialization.Codec; import org.apache.commons.lang3.NotImplementedException; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Invoker; diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/IngredientAccessor.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/IngredientAccessor.java index 4913514d02..62624edba0 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/IngredientAccessor.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/IngredientAccessor.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.core.mixins; import net.minecraft.world.item.crafting.Ingredient; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; import org.spongepowered.asm.mixin.gen.Invoker; @@ -14,6 +15,7 @@ */ @Mixin(Ingredient.class) public interface IngredientAccessor { + @Accessor Ingredient.Value[] getValues(); diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/IntersectionIngredientAccessor.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/IntersectionIngredientAccessor.java index b37f924dbd..f7edb4daf2 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/IntersectionIngredientAccessor.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/IntersectionIngredientAccessor.java @@ -2,6 +2,7 @@ import net.minecraft.world.item.crafting.Ingredient; import net.minecraftforge.common.crafting.IntersectionIngredient; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/InventoryMixin.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/InventoryMixin.java index 1a15afe018..c59d0e6183 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/InventoryMixin.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/InventoryMixin.java @@ -1,19 +1,31 @@ package com.gregtechceu.gtceu.core.mixins; import com.gregtechceu.gtceu.api.item.IGTTool; -import com.llamalad7.mixinextras.injector.wrapoperation.Operation; -import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; -import net.minecraft.core.NonNullList; + import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; + +import com.llamalad7.mixinextras.injector.wrapoperation.Operation; +import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @Mixin(Inventory.class) -public class InventoryMixin { - @WrapOperation(method = "findSlotMatchingUnusedItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/item/ItemStack;isSameItemSameTags(Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/item/ItemStack;)Z")) +public abstract class InventoryMixin { + + @Shadow + public abstract ItemStack getItem(int slot); + + @Shadow + @Final + public Player player; + + @WrapOperation(method = "findSlotMatchingUnusedItem", + at = @At(value = "INVOKE", + target = "Lnet/minecraft/world/item/ItemStack;isSameItemSameTags(Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/item/ItemStack;)Z")) private boolean gtceu$modifyFindSlotMatcher(ItemStack stack, ItemStack other, Operation original) { if (stack.getItem() instanceof IGTTool) { return ItemStack.isSameItem(stack, other); @@ -21,7 +33,9 @@ public class InventoryMixin { return original.call(stack, other); } - @WrapOperation(method = "findSlotMatchingUnusedItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/item/ItemStack;isDamaged()Z", remap = true)) + @WrapOperation(method = "findSlotMatchingUnusedItem", + at = @At(value = "INVOKE", + target = "Lnet/minecraft/world/item/ItemStack;isDamaged()Z")) private boolean gtceu$damagedToolBypass(ItemStack instance, Operation original) { if (instance.getItem() instanceof IGTTool) { return false; @@ -29,7 +43,9 @@ public class InventoryMixin { return original.call(instance); } - @WrapOperation(method = "findSlotMatchingUnusedItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/item/ItemStack;isEnchanted()Z", remap = true)) + @WrapOperation(method = "findSlotMatchingUnusedItem", + at = @At(value = "INVOKE", + target = "Lnet/minecraft/world/item/ItemStack;isEnchanted()Z")) private boolean gtceu$enchantedToolBypass(ItemStack instance, Operation original) { if (instance.getItem() instanceof IGTTool) { return false; diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/ItemValueAccessor.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/ItemValueAccessor.java index 72bcd346f0..c74e0d1afd 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/ItemValueAccessor.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/ItemValueAccessor.java @@ -2,11 +2,13 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.Ingredient; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; @Mixin(Ingredient.ItemValue.class) public interface ItemValueAccessor { + @Accessor ItemStack getItem(); } diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/LevelMixin.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/LevelMixin.java index b376e9c4fc..2d80a249d7 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/LevelMixin.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/LevelMixin.java @@ -1,7 +1,9 @@ package com.gregtechceu.gtceu.core.mixins; import com.gregtechceu.gtceu.api.pattern.MultiblockWorldSavedData; + import com.lowdragmc.lowdraglib.async.AsyncThreadData; + import net.minecraft.core.BlockPos; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; @@ -9,6 +11,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.chunk.ChunkAccess; import net.minecraft.world.level.chunk.LevelChunk; + import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -19,11 +22,16 @@ @Mixin(Level.class) public abstract class LevelMixin implements LevelAccessor { - @Shadow @Final public boolean isClientSide; + @Shadow + @Final + public boolean isClientSide; - @Shadow @Final private Thread thread; + @Shadow + @Final + private Thread thread; - @Shadow public abstract boolean isLoaded(BlockPos pPos); + @Shadow + public abstract boolean isLoaded(BlockPos pPos); private ChunkAccess getChunkNow(int pX, int pZ) { return this.getChunkSource().getChunkNow(pX, pZ); @@ -31,7 +39,8 @@ private ChunkAccess getChunkNow(int pX, int pZ) { @Inject(method = "getBlockEntity", at = @At(value = "HEAD"), cancellable = true) private void getTileEntity(BlockPos pos, CallbackInfoReturnable cir) { - if (!this.isClientSide && Thread.currentThread() != this.thread && (MultiblockWorldSavedData.isThreadService() || AsyncThreadData.isThreadService()) && isLoaded(pos)) { + if (!this.isClientSide && Thread.currentThread() != this.thread && + (MultiblockWorldSavedData.isThreadService() || AsyncThreadData.isThreadService()) && isLoaded(pos)) { ChunkAccess chunk = this.getChunkNow(pos.getX() >> 4, pos.getZ() >> 4); if (chunk instanceof LevelChunk levelChunk) { cir.setReturnValue(levelChunk.getBlockEntities().get(pos)); @@ -41,12 +50,12 @@ private void getTileEntity(BlockPos pos, CallbackInfoReturnable cir @Inject(method = "getBlockState", at = @At(value = "HEAD"), cancellable = true) private void getBlockState(BlockPos pos, CallbackInfoReturnable cir) { - if (!this.isClientSide && Thread.currentThread() != this.thread && (MultiblockWorldSavedData.isThreadService() || AsyncThreadData.isThreadService()) && isLoaded(pos)) { + if (!this.isClientSide && Thread.currentThread() != this.thread && + (MultiblockWorldSavedData.isThreadService() || AsyncThreadData.isThreadService()) && isLoaded(pos)) { ChunkAccess chunk = this.getChunkNow(pos.getX() >> 4, pos.getZ() >> 4); if (chunk != null) { cir.setReturnValue(chunk.getBlockState(pos)); } } } - } diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/LevelRendererMixin.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/LevelRendererMixin.java index 345c2a1773..875e9169ea 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/LevelRendererMixin.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/LevelRendererMixin.java @@ -2,10 +2,7 @@ import com.gregtechceu.gtceu.api.item.tool.ToolHelper; import com.gregtechceu.gtceu.api.item.tool.aoe.AoESymmetrical; -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.SheetedDecalTextureGenerator; -import com.mojang.blaze3d.vertex.VertexConsumer; -import it.unimi.dsi.fastutil.longs.Long2ObjectMap; + import net.minecraft.client.Camera; import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.ClientLevel; @@ -21,6 +18,11 @@ import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.SheetedDecalTextureGenerator; +import com.mojang.blaze3d.vertex.VertexConsumer; +import it.unimi.dsi.fastutil.longs.Long2ObjectMap; import org.jetbrains.annotations.Nullable; import org.joml.Matrix4f; import org.spongepowered.asm.mixin.Final; @@ -37,23 +39,34 @@ @OnlyIn(Dist.CLIENT) public abstract class LevelRendererMixin { - @Shadow @Final private Minecraft minecraft; + @Shadow + @Final + private Minecraft minecraft; - @Shadow @Final private Long2ObjectMap> destructionProgress; + @Shadow + @Final + private Long2ObjectMap> destructionProgress; - @Shadow @Final private RenderBuffers renderBuffers; + @Shadow + @Final + private RenderBuffers renderBuffers; - @Shadow private @Nullable ClientLevel level; + @Shadow + private @Nullable ClientLevel level; @Inject( - method = {"renderLevel"}, - at = {@At("HEAD")} - ) - private void renderLevel(PoseStack poseStack, float partialTick, long finishNanoTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, CallbackInfo ci) { + method = { "renderLevel" }, + at = { @At("HEAD") }) + private void renderLevel(PoseStack poseStack, float partialTick, long finishNanoTime, boolean renderBlockOutline, + Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, + Matrix4f projectionMatrix, CallbackInfo ci) { if (minecraft.player == null || minecraft.level == null) return; ItemStack mainHandItem = minecraft.player.getMainHandItem(); - if (!ToolHelper.hasBehaviorsTag(mainHandItem) || ToolHelper.getAoEDefinition(mainHandItem) == AoESymmetrical.none() || !(minecraft.hitResult instanceof BlockHitResult result) || minecraft.player.isShiftKeyDown()) return; + if (!ToolHelper.hasBehaviorsTag(mainHandItem) || + ToolHelper.getAoEDefinition(mainHandItem) == AoESymmetrical.none() || + !(minecraft.hitResult instanceof BlockHitResult result) || minecraft.player.isShiftKeyDown()) + return; BlockPos hitResultPos = result.getBlockPos(); BlockState hitResultState = minecraft.level.getBlockState(hitResultPos); @@ -62,7 +75,8 @@ private void renderLevel(PoseStack poseStack, float partialTick, long finishNano if (progresses == null || progresses.isEmpty() || !mainHandItem.isCorrectToolForDrops(hitResultState)) return; BlockDestructionProgress progress = progresses.last(); - Set positions = ToolHelper.getHarvestableBlocks(mainHandItem, ToolHelper.getAoEDefinition(mainHandItem), level, minecraft.player, result); + Set positions = ToolHelper.getHarvestableBlocks(mainHandItem, + ToolHelper.getAoEDefinition(mainHandItem), level, minecraft.player, result); Vec3 vec3 = camera.getPosition(); double camX = vec3.x(); @@ -71,40 +85,47 @@ private void renderLevel(PoseStack poseStack, float partialTick, long finishNano for (BlockPos pos : positions) { poseStack.pushPose(); - poseStack.translate((double)pos.getX() - camX, (double)pos.getY() - camY, (double)pos.getZ() - camZ); + poseStack.translate((double) pos.getX() - camX, (double) pos.getY() - camY, (double) pos.getZ() - camZ); PoseStack.Pose last = poseStack.last(); VertexConsumer breakProgressDecal = new SheetedDecalTextureGenerator( - this.renderBuffers.crumblingBufferSource().getBuffer(ModelBakery.DESTROY_TYPES.get(progress.getProgress())), + this.renderBuffers.crumblingBufferSource() + .getBuffer(ModelBakery.DESTROY_TYPES.get(progress.getProgress())), last.pose(), last.normal(), - 1.0f - ); - this.minecraft.getBlockRenderer().renderBreakingTexture(minecraft.level.getBlockState(pos), pos, minecraft.level, poseStack, breakProgressDecal); + 1.0f); + this.minecraft.getBlockRenderer().renderBreakingTexture(minecraft.level.getBlockState(pos), pos, + minecraft.level, poseStack, breakProgressDecal); poseStack.popPose(); } } @Invoker("renderShape") - public static void renderShape(PoseStack poseStack, VertexConsumer consumer, VoxelShape shape, double x, double y, double z, float red, float green, float blue, float alpha) { + public static void renderShape(PoseStack poseStack, VertexConsumer consumer, VoxelShape shape, double x, double y, + double z, float red, float green, float blue, float alpha) { throw new AssertionError(); } @Inject(method = "renderHitOutline", at = @At("HEAD")) - private void renderHitOutline(PoseStack poseStack, VertexConsumer consumer, Entity entity, double camX, double camY, double camZ, BlockPos pos, BlockState state, CallbackInfo ci) { + private void renderHitOutline(PoseStack poseStack, VertexConsumer consumer, Entity entity, double camX, double camY, + double camZ, BlockPos pos, BlockState state, CallbackInfo ci) { if (minecraft.player == null || minecraft.level == null) return; ItemStack mainHandItem = minecraft.player.getMainHandItem(); - if (state.isAir() || !minecraft.level.isInWorldBounds(pos) || !mainHandItem.isCorrectToolForDrops(state) || minecraft.player.isShiftKeyDown() || !ToolHelper.hasBehaviorsTag(mainHandItem)) return; + if (state.isAir() || !minecraft.level.isInWorldBounds(pos) || !mainHandItem.isCorrectToolForDrops(state) || + minecraft.player.isShiftKeyDown() || !ToolHelper.hasBehaviorsTag(mainHandItem)) + return; - Set blockPositions = ToolHelper.getHarvestableBlocks(mainHandItem, ToolHelper.getAoEDefinition(mainHandItem), level, minecraft.player, minecraft.hitResult); + Set blockPositions = ToolHelper.getHarvestableBlocks(mainHandItem, + ToolHelper.getAoEDefinition(mainHandItem), level, minecraft.player, minecraft.hitResult); Set outlineShapes = new HashSet<>(); for (BlockPos position : blockPositions) { BlockPos diffPos = position.subtract(pos); BlockState offsetState = minecraft.level.getBlockState(position); - outlineShapes.add(offsetState.getShape(minecraft.level, position).move(diffPos.getX(), diffPos.getY(), diffPos.getZ())); + outlineShapes.add(offsetState.getShape(minecraft.level, position).move(diffPos.getX(), diffPos.getY(), + diffPos.getZ())); } outlineShapes.forEach(shape -> { @@ -120,6 +141,5 @@ private void renderHitOutline(PoseStack poseStack, VertexConsumer consumer, Enti 0.0F, 0.4F); }); - } } diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/LivingEntityMixin.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/LivingEntityMixin.java index 4047b408a4..f78855b433 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/LivingEntityMixin.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/LivingEntityMixin.java @@ -1,10 +1,12 @@ package com.gregtechceu.gtceu.core.mixins; import com.gregtechceu.gtceu.api.item.armor.ArmorComponentItem; + import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.item.ItemStack; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -13,19 +15,24 @@ @Mixin(LivingEntity.class) public abstract class LivingEntityMixin { + @Shadow public abstract Iterable getArmorSlots(); + @Shadow public abstract void setItemSlot(EquipmentSlot slot, ItemStack stack); - @Inject(method = "getDamageAfterArmorAbsorb", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/damagesource/CombatRules;getDamageAfterAbsorb(FFF)F")) - private void gtceu$adjustArmorAbsorption(DamageSource damageSource, float damageAmount, CallbackInfoReturnable cir) { + @Inject(method = "getDamageAfterArmorAbsorb", + at = @At(value = "INVOKE", + target = "Lnet/minecraft/world/damagesource/CombatRules;getDamageAfterAbsorb(FFF)F")) + private void gtceu$adjustArmorAbsorption(DamageSource damageSource, float damageAmount, + CallbackInfoReturnable cir) { float armorDamage = Math.max(1.0F, damageAmount / 4.0F); int i = 0; for (ItemStack itemStack : this.getArmorSlots()) { if (itemStack.getItem() instanceof ArmorComponentItem armorItem) { EquipmentSlot slot = EquipmentSlot.byTypeAndIndex(EquipmentSlot.Type.ARMOR, i); - armorItem.damageArmor((LivingEntity)(Object)this, itemStack, damageSource, (int) armorDamage, slot); + armorItem.damageArmor((LivingEntity) (Object) this, itemStack, damageSource, (int) armorDamage, slot); if (itemStack.getCount() == 0) { this.setItemSlot(slot, ItemStack.EMPTY); } diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/LootDataManagerMixin.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/LootDataManagerMixin.java index 5edf5148eb..60798c0805 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/LootDataManagerMixin.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/LootDataManagerMixin.java @@ -1,11 +1,14 @@ package com.gregtechceu.gtceu.core.mixins; import com.gregtechceu.gtceu.core.MixinHelpers; + import com.lowdragmc.lowdraglib.Platform; + import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.storage.loot.LootDataManager; import net.minecraft.world.level.storage.loot.LootDataType; import net.minecraft.world.level.storage.loot.LootTable; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -21,7 +24,8 @@ public abstract class LootDataManagerMixin { public void gtceu$injectLootTables(Map, Map> allElements, CallbackInfo ci) { if (Platform.isDatagen()) return; - Map lootTables = (Map) allElements.get(LootDataType.TABLE); + Map lootTables = (Map) allElements + .get(LootDataType.TABLE); MixinHelpers.generateGTDynamicLoot(lootTables); } } diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/LootPoolAccessor.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/LootPoolAccessor.java index 3ec5585e9b..71a4219f54 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/LootPoolAccessor.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/LootPoolAccessor.java @@ -2,12 +2,14 @@ import net.minecraft.world.level.storage.loot.LootPool; import net.minecraft.world.level.storage.loot.entries.LootPoolEntryContainer; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mutable; import org.spongepowered.asm.mixin.gen.Accessor; @Mixin(LootPool.class) public interface LootPoolAccessor { + @Accessor LootPoolEntryContainer[] getEntries(); diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/ModelManagerMixin.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/ModelManagerMixin.java index 6e65713bea..af815c8acd 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/ModelManagerMixin.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/ModelManagerMixin.java @@ -7,11 +7,13 @@ import com.gregtechceu.gtceu.client.renderer.item.TagPrefixItemRenderer; import com.gregtechceu.gtceu.client.renderer.item.ToolItemRenderer; import com.gregtechceu.gtceu.common.data.GTModels; + import net.minecraft.client.resources.model.ModelManager; import net.minecraft.server.packs.resources.PreparableReloadListener; import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.util.profiling.ProfilerFiller; import net.minecraftforge.fml.ModLoader; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -22,8 +24,12 @@ @Mixin(value = ModelManager.class) public abstract class ModelManagerMixin { + @Inject(method = "reload", at = @At(value = "HEAD")) - private void gtceu$loadDynamicModels(PreparableReloadListener.PreparationBarrier preparationBarrier, ResourceManager resourceManager, ProfilerFiller preparationsProfiler, ProfilerFiller reloadProfiler, Executor backgroundExecutor, Executor gameExecutor, CallbackInfoReturnable> cir) { + private void gtceu$loadDynamicModels(PreparableReloadListener.PreparationBarrier preparationBarrier, + ResourceManager resourceManager, ProfilerFiller preparationsProfiler, + ProfilerFiller reloadProfiler, Executor backgroundExecutor, + Executor gameExecutor, CallbackInfoReturnable> cir) { if (!ModLoader.isLoadingStateValid()) return; long startTime = System.currentTimeMillis(); diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/MultiPlayerGameModeMixin.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/MultiPlayerGameModeMixin.java index 6962c9ecd0..e5f333ba5a 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/MultiPlayerGameModeMixin.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/MultiPlayerGameModeMixin.java @@ -2,12 +2,14 @@ import com.gregtechceu.gtceu.api.item.tool.ToolHelper; import com.gregtechceu.gtceu.api.item.tool.aoe.AoESymmetrical; + import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.MultiPlayerGameMode; import net.minecraft.core.BlockPos; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockState; + import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -22,7 +24,10 @@ */ @Mixin(MultiPlayerGameMode.class) public class MultiPlayerGameModeMixin { - @Shadow @Final private Minecraft minecraft; + + @Shadow + @Final + private Minecraft minecraft; @Inject(method = "destroyBlock", at = @At("HEAD"), cancellable = true) private void gtceu$destroyBlock(BlockPos pos, CallbackInfoReturnable cir) { @@ -32,8 +37,8 @@ public class MultiPlayerGameModeMixin { !ToolHelper.hasBehaviorsTag(mainHandItem) || ToolHelper.getAoEDefinition(mainHandItem) == AoESymmetrical.none() || minecraft.player.isShiftKeyDown() || - !mainHandItem.isCorrectToolForDrops(minecraft.level.getBlockState(pos)) - ) return; + !mainHandItem.isCorrectToolForDrops(minecraft.level.getBlockState(pos))) + return; cir.setReturnValue(false); Level level = minecraft.level; diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/OreConfigurationMixin.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/OreConfigurationMixin.java index 0bcbaf6f72..57184b52d8 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/OreConfigurationMixin.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/OreConfigurationMixin.java @@ -1,10 +1,12 @@ package com.gregtechceu.gtceu.core.mixins; import com.gregtechceu.gtceu.config.ConfigHolder; + import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration; import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration.TargetBlockState; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; @@ -14,6 +16,7 @@ @Mixin(OreConfiguration.class) public class OreConfigurationMixin { + @Unique private static final List EXCLUDED_BLOCKS = List.of( Blocks.COAL_ORE, Blocks.DEEPSLATE_COAL_ORE, @@ -24,8 +27,7 @@ public class OreConfigurationMixin { Blocks.EMERALD_ORE, Blocks.DEEPSLATE_EMERALD_ORE, Blocks.LAPIS_ORE, Blocks.DEEPSLATE_LAPIS_ORE, Blocks.REDSTONE_ORE, Blocks.DEEPSLATE_REDSTONE_ORE, - Blocks.NETHER_QUARTZ_ORE - ); + Blocks.NETHER_QUARTZ_ORE); @ModifyVariable(method = "(Ljava/util/List;IF)V", at = @At("HEAD"), index = 1, argsOnly = true) private static List gtceu$init(List targetStates) { diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/OreVeinifierMixin.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/OreVeinifierMixin.java index 62752f0a04..f671a6e532 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/OreVeinifierMixin.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/OreVeinifierMixin.java @@ -1,10 +1,12 @@ package com.gregtechceu.gtceu.core.mixins; import com.gregtechceu.gtceu.config.ConfigHolder; + import net.minecraft.world.level.levelgen.DensityFunction; import net.minecraft.world.level.levelgen.NoiseChunk; import net.minecraft.world.level.levelgen.OreVeinifier; import net.minecraft.world.level.levelgen.PositionalRandomFactory; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -12,11 +14,14 @@ @Mixin(OreVeinifier.class) public class OreVeinifierMixin { + @Inject( method = "create(Lnet/minecraft/world/level/levelgen/DensityFunction;Lnet/minecraft/world/level/levelgen/DensityFunction;Lnet/minecraft/world/level/levelgen/DensityFunction;Lnet/minecraft/world/level/levelgen/PositionalRandomFactory;)Lnet/minecraft/world/level/levelgen/NoiseChunk$BlockStateFiller;", - at = @At("HEAD"), cancellable = true - ) - private static void gtceu$create(DensityFunction function1, DensityFunction function2, DensityFunction function3, PositionalRandomFactory random, CallbackInfoReturnable cir) { + at = @At("HEAD"), + cancellable = true) + private static void gtceu$create(DensityFunction function1, DensityFunction function2, DensityFunction function3, + PositionalRandomFactory random, + CallbackInfoReturnable cir) { if (ConfigHolder.INSTANCE != null && ConfigHolder.INSTANCE.worldgen.oreVeins.removeVanillaLargeOreVeins) cir.setReturnValue(functionContext -> null); } diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/PrimedTntAccessor.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/PrimedTntAccessor.java index b97082aba5..0045f4cb20 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/PrimedTntAccessor.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/PrimedTntAccessor.java @@ -2,11 +2,13 @@ import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.item.PrimedTnt; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; @Mixin(PrimedTnt.class) public interface PrimedTntAccessor { + @Accessor void setOwner(LivingEntity owner); } diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/RecipeManagerAccessor.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/RecipeManagerAccessor.java index bf15d71bc3..29d13c1a76 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/RecipeManagerAccessor.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/RecipeManagerAccessor.java @@ -4,6 +4,7 @@ import net.minecraft.world.item.crafting.Recipe; import net.minecraft.world.item.crafting.RecipeManager; import net.minecraft.world.item.crafting.RecipeType; + import org.jetbrains.annotations.VisibleForTesting; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; @@ -17,6 +18,7 @@ */ @Mixin(RecipeManager.class) public interface RecipeManagerAccessor { + @Accessor("recipes") Map, Map>> getRawRecipes(); diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/RecipeManagerInvoker.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/RecipeManagerInvoker.java index b1ed0b1d3d..74dcee4fae 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/RecipeManagerInvoker.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/RecipeManagerInvoker.java @@ -5,6 +5,7 @@ import net.minecraft.world.item.crafting.Recipe; import net.minecraft.world.item.crafting.RecipeManager; import net.minecraft.world.item.crafting.RecipeType; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Invoker; @@ -12,6 +13,7 @@ @Mixin(RecipeManager.class) public interface RecipeManagerInvoker { + @Invoker("byType") > Map> getRecipeFromType(RecipeType type); } diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/RecipeManagerMixin.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/RecipeManagerMixin.java index 335eb0d543..16a62f0d93 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/RecipeManagerMixin.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/RecipeManagerMixin.java @@ -1,8 +1,8 @@ package com.gregtechceu.gtceu.core.mixins; -import com.google.gson.JsonElement; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.GTRecipeType; + import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.resources.ResourceManager; @@ -10,6 +10,8 @@ import net.minecraft.world.item.crafting.Recipe; import net.minecraft.world.item.crafting.RecipeManager; import net.minecraft.world.item.crafting.RecipeType; + +import com.google.gson.JsonElement; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -24,10 +26,13 @@ @Mixin(RecipeManager.class) public abstract class RecipeManagerMixin { - @Shadow private Map, Map>> recipes; + @Shadow + private Map, Map>> recipes; - @Inject(method = "apply(Ljava/util/Map;Lnet/minecraft/server/packs/resources/ResourceManager;Lnet/minecraft/util/profiling/ProfilerFiller;)V", at = @At(value = "TAIL")) - private void gtceu$cloneVanillaRecipes(Map map, ResourceManager resourceManager, ProfilerFiller profiler, CallbackInfo ci) { + @Inject(method = "apply(Ljava/util/Map;Lnet/minecraft/server/packs/resources/ResourceManager;Lnet/minecraft/util/profiling/ProfilerFiller;)V", + at = @At(value = "TAIL")) + private void gtceu$cloneVanillaRecipes(Map map, ResourceManager resourceManager, + ProfilerFiller profiler, CallbackInfo ci) { for (RecipeType recipeType : BuiltInRegistries.RECIPE_TYPE) { if (recipeType instanceof GTRecipeType gtRecipeType) { gtRecipeType.getLookup().removeAllRecipes(); @@ -48,14 +53,14 @@ public abstract class RecipeManagerMixin { Stream.concat( this.recipes.get(gtRecipeType).values().stream(), proxyRecipes.entrySet().stream() - .flatMap(entry -> entry.getValue().stream())) - .filter(GTRecipe.class::isInstance) - .map(GTRecipe.class::cast) - .forEach(gtRecipe -> gtRecipeType.getLookup().addRecipe(gtRecipe)); + .flatMap(entry -> entry.getValue().stream())) + .filter(GTRecipe.class::isInstance) + .map(GTRecipe.class::cast) + .forEach(gtRecipe -> gtRecipeType.getLookup().addRecipe(gtRecipe)); } else if (!proxyRecipes.isEmpty()) { proxyRecipes.values().stream() - .flatMap(List::stream) - .forEach(gtRecipe -> gtRecipeType.getLookup().addRecipe(gtRecipe)); + .flatMap(List::stream) + .forEach(gtRecipe -> gtRecipeType.getLookup().addRecipe(gtRecipe)); } } } diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/RepairItemRecipeMixin.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/RepairItemRecipeMixin.java index ad14ab53fa..b60ed1acd4 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/RepairItemRecipeMixin.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/RepairItemRecipeMixin.java @@ -1,8 +1,7 @@ package com.gregtechceu.gtceu.core.mixins; import com.gregtechceu.gtceu.api.item.IGTTool; -import com.llamalad7.mixinextras.sugar.Local; -import com.llamalad7.mixinextras.sugar.ref.LocalRef; + import net.minecraft.core.NonNullList; import net.minecraft.core.RegistryAccess; import net.minecraft.resources.ResourceLocation; @@ -13,6 +12,9 @@ import net.minecraft.world.item.crafting.RepairItemRecipe; import net.minecraft.world.item.enchantment.Enchantment; import net.minecraft.world.level.Level; + +import com.llamalad7.mixinextras.sugar.Local; +import com.llamalad7.mixinextras.sugar.ref.LocalRef; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -29,6 +31,7 @@ public RepairItemRecipeMixin(ResourceLocation id, CraftingBookCategory category) /** * It's a hack to prevent the tool from being returned + * * @param container the input inventory */ @Override @@ -43,10 +46,11 @@ public NonNullList getRemainingItems(CraftingContainer container) { } @Inject( - method = "matches(Lnet/minecraft/world/inventory/CraftingContainer;Lnet/minecraft/world/level/Level;)Z", - at = @At(value = "INVOKE", target = "Lnet/minecraft/world/item/ItemStack;getItem()Lnet/minecraft/world/item/Item;", ordinal = 0), - cancellable = true - ) + method = "matches(Lnet/minecraft/world/inventory/CraftingContainer;Lnet/minecraft/world/level/Level;)Z", + at = @At(value = "INVOKE", + target = "Lnet/minecraft/world/item/ItemStack;getItem()Lnet/minecraft/world/item/Item;", + ordinal = 0), + cancellable = true) public void gtceu$matches(CraftingContainer inv, Level worldIn, CallbackInfoReturnable cir, @Local(ordinal = 0) ItemStack itemstack, @Local(ordinal = 1) ItemStack itemstack1) { @@ -63,10 +67,11 @@ public NonNullList getRemainingItems(CraftingContainer container) { } @Inject( - method = "assemble(Lnet/minecraft/world/inventory/CraftingContainer;Lnet/minecraft/core/RegistryAccess;)Lnet/minecraft/world/item/ItemStack;", - at = @At(value = "RETURN", ordinal = 1), cancellable = true - ) - public void gtceu$assemble(CraftingContainer container, RegistryAccess registryAccess, CallbackInfoReturnable cir, + method = "assemble(Lnet/minecraft/world/inventory/CraftingContainer;Lnet/minecraft/core/RegistryAccess;)Lnet/minecraft/world/item/ItemStack;", + at = @At(value = "RETURN", ordinal = 1), + cancellable = true) + public void gtceu$assemble(CraftingContainer container, RegistryAccess registryAccess, + CallbackInfoReturnable cir, @Local(ordinal = 1) ItemStack itemstack3, @Local(ordinal = 2) LocalRef itemstack2, @Local(ordinal = 3) int i1, diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/ServerChunkProviderMixin.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/ServerChunkProviderMixin.java index b296e0dcb4..45bb8c8542 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/ServerChunkProviderMixin.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/ServerChunkProviderMixin.java @@ -1,14 +1,18 @@ package com.gregtechceu.gtceu.core.mixins; import com.gregtechceu.gtceu.api.pattern.MultiblockWorldSavedData; + import com.lowdragmc.lowdraglib.async.AsyncThreadData; -import com.mojang.datafixers.util.Either; + import net.minecraft.server.level.ChunkHolder; import net.minecraft.server.level.ServerChunkCache; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.chunk.ChunkAccess; import net.minecraft.world.level.chunk.ChunkStatus; import net.minecraft.world.level.chunk.LevelChunk; + +import com.mojang.datafixers.util.Either; +import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -17,23 +21,26 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import org.jetbrains.annotations.Nullable; import java.util.Arrays; @Mixin(ServerChunkCache.class) public abstract class ServerChunkProviderMixin { - @Shadow @Final Thread mainThread; + @Shadow + @Final + Thread mainThread; private final long[] mbdLastChunkPos = new long[4]; private final LevelChunk[] mbdLastChunk = new LevelChunk[4]; - @Shadow @Nullable protected abstract ChunkHolder getVisibleChunkIfPresent(long p_217213_1_); + @Shadow + @Nullable + protected abstract ChunkHolder getVisibleChunkIfPresent(long p_217213_1_); private void storeInCache(long pos, LevelChunk chunkAccess) { synchronized (this.mbdLastChunkPos) { - for(int i = 3; i > 0; --i) { + for (int i = 3; i > 0; --i) { this.mbdLastChunkPos[i] = this.mbdLastChunkPos[i - 1]; this.mbdLastChunk[i] = this.mbdLastChunk[i - 1]; } @@ -53,10 +60,11 @@ private void injectClearCache(CallbackInfo ci) { @Inject(method = "getChunkNow", at = @At(value = "HEAD"), cancellable = true) private void getTileEntity(int pChunkX, int pChunkZ, CallbackInfoReturnable cir) { - if (Thread.currentThread() != this.mainThread && (MultiblockWorldSavedData.isThreadService() || AsyncThreadData.isThreadService())) { + if (Thread.currentThread() != this.mainThread && + (MultiblockWorldSavedData.isThreadService() || AsyncThreadData.isThreadService())) { long i = ChunkPos.asLong(pChunkX, pChunkZ); - for(int j = 0; j < 4; ++j) { + for (int j = 0; j < 4; ++j) { if (i == this.mbdLastChunkPos[j]) { cir.setReturnValue(this.mbdLastChunk[j]); return; @@ -65,7 +73,8 @@ private void getTileEntity(int pChunkX, int pChunkZ, CallbackInfoReturnable either = chunkholder.getFutureIfPresent(ChunkStatus.FULL).getNow(null); + Either either = chunkholder + .getFutureIfPresent(ChunkStatus.FULL).getNow(null); if (either != null) { ChunkAccess chunk = either.left().orElse(null); if (chunk instanceof LevelChunk levelChunk) { @@ -78,5 +87,4 @@ private void getTileEntity(int pChunkX, int pChunkZ, CallbackInfoReturnable callKeyFromJson(JsonObject keyEntry) { return null; @@ -30,7 +32,8 @@ static String[] callPatternFromJson(JsonArray patternArray) { } @Invoker - static NonNullList callDissolvePattern(String[] pattern, Map keys, int patternWidth, int patternHeight) { + static NonNullList callDissolvePattern(String[] pattern, Map keys, int patternWidth, + int patternHeight) { return null; } diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/SidedRedstoneConnectivityMixin.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/SidedRedstoneConnectivityMixin.java index aa0068dff9..b9eddd551f 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/SidedRedstoneConnectivityMixin.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/SidedRedstoneConnectivityMixin.java @@ -1,12 +1,14 @@ package com.gregtechceu.gtceu.core.mixins; import com.gregtechceu.gtceu.api.block.MetaMachineBlock; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.block.RedStoneWireBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.RedstoneSide; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -14,12 +16,13 @@ @Mixin(RedStoneWireBlock.class) public class SidedRedstoneConnectivityMixin { + @Inject( method = "getConnectingSide(Lnet/minecraft/world/level/BlockGetter;Lnet/minecraft/core/BlockPos;Lnet/minecraft/core/Direction;Z)Lnet/minecraft/world/level/block/state/properties/RedstoneSide;", at = @At("RETURN"), - cancellable = true - ) - private void gtceu$getConnectingSide(BlockGetter level, BlockPos ownPos, Direction direction, boolean nonNormalCubeAbove, CallbackInfoReturnable cir) { + cancellable = true) + private void gtceu$getConnectingSide(BlockGetter level, BlockPos ownPos, Direction direction, + boolean nonNormalCubeAbove, CallbackInfoReturnable cir) { BlockPos blockPos = ownPos.relative(direction); BlockState blockState = level.getBlockState(blockPos); diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/StrictNBTIngredientAccessor.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/StrictNBTIngredientAccessor.java index 48c03944f1..c91752b250 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/StrictNBTIngredientAccessor.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/StrictNBTIngredientAccessor.java @@ -2,11 +2,13 @@ import net.minecraft.world.item.ItemStack; import net.minecraftforge.common.crafting.StrictNBTIngredient; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; @Mixin(value = StrictNBTIngredient.class, remap = false) public interface StrictNBTIngredientAccessor { + @Accessor ItemStack getStack(); } diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/TagLoaderMixin.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/TagLoaderMixin.java index d974f1c3c6..e34dd0d7c7 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/TagLoaderMixin.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/TagLoaderMixin.java @@ -2,10 +2,12 @@ import com.gregtechceu.gtceu.core.IGTTagLoader; import com.gregtechceu.gtceu.core.MixinHelpers; + import net.minecraft.core.Registry; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.tags.TagLoader; + import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Unique; @@ -24,7 +26,8 @@ public class TagLoaderMixin implements IGTTagLoader { private Registry gtceu$storedRegistry; @Inject(method = "load", at = @At(value = "RETURN")) - public void gtceu$load(ResourceManager resourceManager, CallbackInfoReturnable>> cir) { + public void gtceu$load(ResourceManager resourceManager, + CallbackInfoReturnable>> cir) { var tagMap = cir.getReturnValue(); if (gtceu$getRegistry() == null) return; MixinHelpers.generateGTDynamicTags(tagMap, gtceu$getRegistry()); @@ -40,5 +43,4 @@ public class TagLoaderMixin implements IGTTagLoader { public void gtceu$setRegistry(Registry registry) { this.gtceu$storedRegistry = registry; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/TagManagerMixin.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/TagManagerMixin.java index 8dab852316..c9a0d31293 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/TagManagerMixin.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/TagManagerMixin.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.core.mixins; import com.gregtechceu.gtceu.core.IGTTagLoader; + import net.minecraft.core.Holder; import net.minecraft.core.Registry; import net.minecraft.core.RegistryAccess; @@ -8,6 +9,7 @@ import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.tags.TagLoader; import net.minecraft.tags.TagManager; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -20,15 +22,19 @@ @Mixin(TagManager.class) public class TagManagerMixin { - @Inject(method = "createLoader", at = @At( - value = "INVOKE", - target = "Lnet/minecraft/tags/TagLoader;(Ljava/util/function/Function;Ljava/lang/String;)V", - shift = At.Shift.BY, - by = 2 - ), locals = LocalCapture.CAPTURE_FAILHARD) - private void gtceu$saveRegistryToTagLoader(ResourceManager rm, Executor executor, RegistryAccess.RegistryEntry reg, - CallbackInfoReturnable>> cir, - ResourceKey> key, Registry registry, TagLoader> loader) { + @Inject(method = "createLoader", + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/tags/TagLoader;(Ljava/util/function/Function;Ljava/lang/String;)V", + shift = At.Shift.BY, + by = 2), + locals = LocalCapture.CAPTURE_FAILHARD) + private < + T> void gtceu$saveRegistryToTagLoader(ResourceManager rm, Executor executor, + RegistryAccess.RegistryEntry reg, + CallbackInfoReturnable>> cir, + ResourceKey> key, Registry registry, + TagLoader> loader) { ((IGTTagLoader) loader).gtceu$setRegistry(registry); } } diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/TagValueAccessor.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/TagValueAccessor.java index 39fb0bbe0c..ab5de00c0b 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/TagValueAccessor.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/TagValueAccessor.java @@ -3,11 +3,13 @@ import net.minecraft.tags.TagKey; import net.minecraft.world.item.Item; import net.minecraft.world.item.crafting.Ingredient; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; @Mixin(Ingredient.TagValue.class) public interface TagValueAccessor { + @Accessor TagKey getTag(); } diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/ae2/GenericStackInvAccessor.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/ae2/GenericStackInvAccessor.java index b0af55a8a0..0a5dfe6974 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/ae2/GenericStackInvAccessor.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/ae2/GenericStackInvAccessor.java @@ -11,6 +11,7 @@ public interface GenericStackInvAccessor { @Accessor Runnable getListener(); - @Accessor @Mutable + @Accessor + @Mutable void setListener(Runnable listener); } diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/create/RotationPropagatorMixin.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/create/RotationPropagatorMixin.java index 446781b6f8..3bd9ef4790 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/create/RotationPropagatorMixin.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/create/RotationPropagatorMixin.java @@ -2,9 +2,11 @@ import com.gregtechceu.gtceu.common.blockentity.KineticMachineBlockEntity; import com.gregtechceu.gtceu.common.machine.kinetic.IKineticMachine; + +import net.minecraft.core.Direction; + import com.simibubi.create.content.kinetics.RotationPropagator; import com.simibubi.create.content.kinetics.base.KineticBlockEntity; -import net.minecraft.core.Direction; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -17,13 +19,14 @@ */ @Mixin(RotationPropagator.class) public abstract class RotationPropagatorMixin { + @Inject(method = "getAxisModifier", at = @At(value = "RETURN"), remap = false, cancellable = true) - private static void injectAxisModifier(KineticBlockEntity te, Direction direction, CallbackInfoReturnable cir) { + private static void injectAxisModifier(KineticBlockEntity te, Direction direction, + CallbackInfoReturnable cir) { if ((te.hasSource() || te.isSource()) && te instanceof KineticMachineBlockEntity kineticMachineBlockEntity) { if (kineticMachineBlockEntity.getMetaMachine() instanceof IKineticMachine kineticMachine) { cir.setReturnValue(kineticMachine.getRotationSpeedModifier(direction)); } } } - } diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/emi/EmiRecipeHandlerMixin.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/emi/EmiRecipeHandlerMixin.java index 3f3057a626..b7e0eb84f0 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/emi/EmiRecipeHandlerMixin.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/emi/EmiRecipeHandlerMixin.java @@ -1,12 +1,15 @@ package com.gregtechceu.gtceu.core.mixins.emi; import com.gregtechceu.gtceu.integration.emi.recipe.GTEmiRecipeHandler; + import com.lowdragmc.lowdraglib.gui.modular.ModularUIContainer; -import dev.emi.emi.api.recipe.handler.EmiRecipeHandler; -import dev.emi.emi.registry.EmiRecipeFiller; + import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.InventoryMenu; + +import dev.emi.emi.api.recipe.handler.EmiRecipeHandler; +import dev.emi.emi.registry.EmiRecipeFiller; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -16,8 +19,11 @@ @Mixin(EmiRecipeFiller.class) public class EmiRecipeHandlerMixin { + @Inject(method = "getAllHandlers", at = @At("HEAD"), cancellable = true, remap = false) - private static void AddGTEmiRecipeHandler(AbstractContainerScreen screen, CallbackInfoReturnable>> cir){ + private static < + T extends AbstractContainerMenu> void AddGTEmiRecipeHandler(AbstractContainerScreen screen, + CallbackInfoReturnable>> cir) { if (screen != null && !(screen.getMenu() instanceof InventoryMenu)) { if (screen.getMenu() instanceof ModularUIContainer) { cir.setReturnValue((List>) (List) List.of(new GTEmiRecipeHandler())); diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/emi/FluidEmiStackMixin.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/emi/FluidEmiStackMixin.java index 294d77414a..8d79c6c4a7 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/emi/FluidEmiStackMixin.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/emi/FluidEmiStackMixin.java @@ -1,20 +1,21 @@ package com.gregtechceu.gtceu.core.mixins.emi; -import com.google.common.collect.Lists; import com.gregtechceu.gtceu.client.TooltipsHandler; -import dev.emi.emi.api.stack.FluidEmiStack; + import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.ComponentContents; import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.level.material.Fluid; + +import com.google.common.collect.Lists; +import dev.emi.emi.api.stack.FluidEmiStack; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import org.spongepowered.asm.mixin.injection.callback.LocalCapture; import java.util.List; import java.util.Map; @@ -22,7 +23,9 @@ @Mixin(value = FluidEmiStack.class, remap = false) public class FluidEmiStackMixin { - @Shadow @Final private Fluid fluid; + @Shadow + @Final + private Fluid fluid; @Inject(method = "getTooltip", at = @At("TAIL"), remap = false) private void gtceu$addFluidTooltip(CallbackInfoReturnable> cir) { @@ -32,7 +35,8 @@ public class FluidEmiStackMixin { List list = cir.getReturnValue(); tooltips.stream() .filter(component -> component.getContents() != ComponentContents.EMPTY) - .map(component -> Map.entry(tooltips.indexOf(component), ClientTooltipComponent.create(component.getVisualOrderText()))) + .map(component -> Map.entry(tooltips.indexOf(component), + ClientTooltipComponent.create(component.getVisualOrderText()))) .forEach(component -> list.add(component.getKey(), component.getValue())); } } diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/jei/FluidHelperMixin.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/jei/FluidHelperMixin.java index ddcac43790..295d256c2a 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/jei/FluidHelperMixin.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/jei/FluidHelperMixin.java @@ -1,10 +1,12 @@ package com.gregtechceu.gtceu.core.mixins.jei; import com.gregtechceu.gtceu.client.TooltipsHandler; -import mezz.jei.forge.platform.FluidHelper; + import net.minecraft.network.chat.Component; import net.minecraft.world.item.TooltipFlag; import net.minecraftforge.fluids.FluidStack; + +import mezz.jei.forge.platform.FluidHelper; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -16,7 +18,8 @@ public class FluidHelperMixin { @Inject(method = "getTooltip*", at = @At("TAIL"), remap = false) - private void gtceu$injectFluidTooltips(FluidStack ingredient, TooltipFlag tooltipFlag, CallbackInfoReturnable> cir) { + private void gtceu$injectFluidTooltips(FluidStack ingredient, TooltipFlag tooltipFlag, + CallbackInfoReturnable> cir) { var tooltip = cir.getReturnValue(); TooltipsHandler.appendFluidTooltips(ingredient.getFluid(), tooltip, tooltipFlag); } diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/rei/FluidEntryRendererMixin.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/rei/FluidEntryRendererMixin.java index ea79b197b4..6b522df5b9 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/rei/FluidEntryRendererMixin.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/rei/FluidEntryRendererMixin.java @@ -1,12 +1,14 @@ package com.gregtechceu.gtceu.core.mixins.rei; import com.gregtechceu.gtceu.client.TooltipsHandler; + +import net.minecraft.network.chat.Component; + import dev.architectury.fluid.FluidStack; import me.shedaniel.rei.api.client.gui.widgets.Tooltip; import me.shedaniel.rei.api.client.gui.widgets.TooltipContext; import me.shedaniel.rei.api.common.entry.EntryStack; import me.shedaniel.rei.plugin.client.entry.FluidEntryDefinition; -import net.minecraft.network.chat.Component; import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -19,8 +21,12 @@ @Mixin(FluidEntryDefinition.FluidEntryRenderer.class) public class FluidEntryRendererMixin { - @Inject(method = "getTooltip", at = @At(value = "TAIL", shift = At.Shift.BEFORE), remap = false, locals = LocalCapture.CAPTURE_FAILHARD) - private void gtceu$addMaterialTooltip(EntryStack entry, TooltipContext context, CallbackInfoReturnable<@Nullable Tooltip> cir, + @Inject(method = "getTooltip", + at = @At(value = "TAIL", shift = At.Shift.BEFORE), + remap = false, + locals = LocalCapture.CAPTURE_FAILHARD) + private void gtceu$addMaterialTooltip(EntryStack entry, TooltipContext context, + CallbackInfoReturnable<@Nullable Tooltip> cir, List tooltip, long amount) { TooltipsHandler.appendFluidTooltips(entry.getValue().getFluid(), tooltip, context.getFlag()); } diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/rei/InputSlotCrafterMixin.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/rei/InputSlotCrafterMixin.java index aad7e68ef9..eea2f07c4d 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/rei/InputSlotCrafterMixin.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/rei/InputSlotCrafterMixin.java @@ -1,25 +1,34 @@ package com.gregtechceu.gtceu.core.mixins.rei; import com.gregtechceu.gtceu.api.item.IGTTool; -import com.llamalad7.mixinextras.injector.ModifyExpressionValue; + +import net.minecraft.world.item.ItemStack; + import com.llamalad7.mixinextras.injector.wrapoperation.Operation; import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; import me.shedaniel.rei.impl.common.transfer.InputSlotCrafter; -import net.minecraft.world.item.ItemStack; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @Mixin(value = InputSlotCrafter.class, remap = false) public class InputSlotCrafterMixin { - @WrapOperation(method = "areItemsEqual", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/item/ItemStack;isSameItemSameTags(Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/item/ItemStack;)Z", remap = true)) - private static boolean gtceu$modifyFindSlotMatcherREI(ItemStack stack, ItemStack other, Operation original) { + + @WrapOperation(method = "areItemsEqual", + at = @At(value = "INVOKE", + target = "Lnet/minecraft/world/item/ItemStack;isSameItemSameTags(Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/item/ItemStack;)Z", + remap = true)) + private static boolean gtceu$modifyFindSlotMatcherREI(ItemStack stack, ItemStack other, + Operation original) { if (stack.getItem() instanceof IGTTool) { return ItemStack.isSameItem(stack, other); } return original.call(stack, other); } - @WrapOperation(method = "takeInventoryStack", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/item/ItemStack;isDamaged()Z", remap = true)) + @WrapOperation(method = "takeInventoryStack", + at = @At(value = "INVOKE", + target = "Lnet/minecraft/world/item/ItemStack;isDamaged()Z", + remap = true)) private boolean gtceu$damagedToolBypass(ItemStack instance, Operation original) { if (instance.getItem() instanceof IGTTool) { return false; @@ -27,7 +36,10 @@ public class InputSlotCrafterMixin { return original.call(instance); } - @WrapOperation(method = "takeInventoryStack", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/item/ItemStack;isEnchanted()Z", remap = true)) + @WrapOperation(method = "takeInventoryStack", + at = @At(value = "INVOKE", + target = "Lnet/minecraft/world/item/ItemStack;isEnchanted()Z", + remap = true)) private boolean gtceu$enchantedToolBypass(ItemStack instance, Operation original) { if (instance.getItem() instanceof IGTTool) { return false; diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/rei/RecipeFinderMixin.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/rei/RecipeFinderMixin.java index 91459e03e6..fdb18e8243 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/rei/RecipeFinderMixin.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/rei/RecipeFinderMixin.java @@ -1,16 +1,22 @@ package com.gregtechceu.gtceu.core.mixins.rei; import com.gregtechceu.gtceu.api.item.IGTTool; + +import net.minecraft.world.item.ItemStack; + import com.llamalad7.mixinextras.injector.wrapoperation.Operation; import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; import me.shedaniel.rei.api.common.transfer.RecipeFinder; -import net.minecraft.world.item.ItemStack; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @Mixin(value = RecipeFinder.class, remap = false) public class RecipeFinderMixin { - @WrapOperation(method = "addNormalItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/item/ItemStack;isDamaged()Z", remap = true)) + + @WrapOperation(method = "addNormalItem", + at = @At(value = "INVOKE", + target = "Lnet/minecraft/world/item/ItemStack;isDamaged()Z", + remap = true)) private boolean gtceu$damagedToolBypass(ItemStack instance, Operation original) { if (instance.getItem() instanceof IGTTool) { return false; @@ -18,7 +24,10 @@ public class RecipeFinderMixin { return original.call(instance); } - @WrapOperation(method = "addNormalItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/item/ItemStack;isEnchanted()Z", remap = true)) + @WrapOperation(method = "addNormalItem", + at = @At(value = "INVOKE", + target = "Lnet/minecraft/world/item/ItemStack;isEnchanted()Z", + remap = true)) private boolean gtceu$enchantedToolBypass(ItemStack instance, Operation original) { if (instance.getItem() instanceof IGTTool) { return false; diff --git a/src/main/java/com/gregtechceu/gtceu/core/mixins/top/ConfigMixin.java b/src/main/java/com/gregtechceu/gtceu/core/mixins/top/ConfigMixin.java index 697a5c7a6e..6d846a6207 100644 --- a/src/main/java/com/gregtechceu/gtceu/core/mixins/top/ConfigMixin.java +++ b/src/main/java/com/gregtechceu/gtceu/core/mixins/top/ConfigMixin.java @@ -5,15 +5,15 @@ import com.gregtechceu.gtceu.api.data.chemical.material.properties.PropertyKey; import com.gregtechceu.gtceu.api.item.tool.GTToolType; import com.gregtechceu.gtceu.api.item.tool.MaterialToolTier; -import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.data.recipe.CustomTags; -import mcjty.theoneprobe.config.Config; -import net.minecraft.client.resources.language.I18n; + import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.TagKey; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; + +import mcjty.theoneprobe.config.Config; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -27,19 +27,24 @@ @Mixin(value = Config.class, remap = false) public class ConfigMixin { - @Shadow private static Map tooltypeTagsSet; - @Shadow private static Map harvestabilityTagsSet; + @Shadow + private static Map tooltypeTagsSet; + @Shadow + private static Map harvestabilityTagsSet; - @Inject(method = "getTooltypeTags", at = @At(value = "INVOKE", target = "Ljava/util/List;iterator()Ljava/util/Iterator;")) + @Inject(method = "getTooltypeTags", + at = @At(value = "INVOKE", target = "Ljava/util/List;iterator()Ljava/util/Iterator;")) private static void gtceu$injectToolTags(CallbackInfoReturnable> cir) { for (GTToolType type : GTToolType.getTypes().values()) { for (TagKey tag : type.itemTags) { - if (!tooltypeTagsSet.containsKey(tag.location())) tooltypeTagsSet.put(tag.location(), Component.translatable("gtceu.tool.class." + type.name).getString()); + if (!tooltypeTagsSet.containsKey(tag.location())) tooltypeTagsSet.put(tag.location(), + Component.translatable("gtceu.tool.class." + type.name).getString()); } } } - @Inject(method = "getHarvestabilityTags", at = @At(value = "INVOKE", target = "Ljava/util/List;iterator()Ljava/util/Iterator;")) + @Inject(method = "getHarvestabilityTags", + at = @At(value = "INVOKE", target = "Ljava/util/List;iterator()Ljava/util/Iterator;")) private static void gtceu$injectHarvestTags(CallbackInfoReturnable> cir) { Set passedTiers = new HashSet<>(); for (Material mat : GTCEuAPI.materialManager.getRegisteredMaterials()) { @@ -49,7 +54,8 @@ public class ConfigMixin { if (!passedTiers.contains(harvestLevel)) { passedTiers.add(harvestLevel); TagKey tag = CustomTags.TOOL_TIERS[harvestLevel]; - if (!harvestabilityTagsSet.containsKey(tag.location())) harvestabilityTagsSet.put(tag.location(), mat.getLocalizedName().getString()); + if (!harvestabilityTagsSet.containsKey(tag.location())) + harvestabilityTagsSet.put(tag.location(), mat.getLocalizedName().getString()); } } } diff --git a/src/main/java/com/gregtechceu/gtceu/data/GregTechDatagen.java b/src/main/java/com/gregtechceu/gtceu/data/GregTechDatagen.java index 7f95078d7d..3552b0994e 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/GregTechDatagen.java +++ b/src/main/java/com/gregtechceu/gtceu/data/GregTechDatagen.java @@ -3,6 +3,7 @@ import com.gregtechceu.gtceu.common.registry.GTRegistration; import com.gregtechceu.gtceu.data.lang.LangHandler; import com.gregtechceu.gtceu.data.tags.TagsHandler; + import com.tterrag.registrate.providers.ProviderType; /** @@ -11,6 +12,7 @@ * @implNote GregTechDatagen */ public class GregTechDatagen { + public static void init() { GTRegistration.REGISTRATE.addDataGenerator(ProviderType.ITEM_TAGS, TagsHandler::initItem); GTRegistration.REGISTRATE.addDataGenerator(ProviderType.BLOCK_TAGS, TagsHandler::initBlock); diff --git a/src/main/java/com/gregtechceu/gtceu/data/forge/DataGenerators.java b/src/main/java/com/gregtechceu/gtceu/data/forge/DataGenerators.java index 5336985637..94d0319a71 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/forge/DataGenerators.java +++ b/src/main/java/com/gregtechceu/gtceu/data/forge/DataGenerators.java @@ -10,13 +10,11 @@ import com.gregtechceu.gtceu.common.data.GTWorldgen; import com.gregtechceu.gtceu.common.data.forge.GTBiomeModifiers; import com.gregtechceu.gtceu.data.tags.BiomeTagsLoader; -import com.gregtechceu.gtceu.data.tags.EntityTypeTagLoader; + import net.minecraft.core.RegistrySetBuilder; import net.minecraft.core.registries.Registries; import net.minecraft.data.DataGenerator; import net.minecraft.data.PackOutput; -import net.minecraft.data.worldgen.biome.BiomeData; -import net.minecraft.world.level.biome.BiomeSources; import net.minecraftforge.common.data.DatapackBuiltinEntriesProvider; import net.minecraftforge.common.data.ExistingFileHelper; import net.minecraftforge.data.event.GatherDataEvent; @@ -44,13 +42,14 @@ public static void gatherData(GatherDataEvent event) { var set = Set.of(GTCEu.MOD_ID); generator.addProvider(true, new BiomeTagsLoader(packOutput, registries, existingFileHelper)); generator.addProvider(true, new DatapackBuiltinEntriesProvider( - packOutput, registries, new RegistrySetBuilder() - .add(Registries.DAMAGE_TYPE, GTDamageTypes::bootstrap) + packOutput, registries, new RegistrySetBuilder() + .add(Registries.DAMAGE_TYPE, GTDamageTypes::bootstrap) - .add(Registries.CONFIGURED_FEATURE, GTConfiguredFeatures::bootstrap) - .add(Registries.PLACED_FEATURE, GTPlacements::bootstrap) - .add(Registries.DENSITY_FUNCTION, GTWorldgen::bootstrapDensityFunctions) - .add(ForgeRegistries.Keys.BIOME_MODIFIERS, GTBiomeModifiers::bootstrap), set)); + .add(Registries.CONFIGURED_FEATURE, GTConfiguredFeatures::bootstrap) + .add(Registries.PLACED_FEATURE, GTPlacements::bootstrap) + .add(Registries.DENSITY_FUNCTION, GTWorldgen::bootstrapDensityFunctions) + .add(ForgeRegistries.Keys.BIOME_MODIFIERS, GTBiomeModifiers::bootstrap), + set)); } } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/data/lang/AdvancementLang.java b/src/main/java/com/gregtechceu/gtceu/data/lang/AdvancementLang.java index 061d1a7a28..e459867837 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/lang/AdvancementLang.java +++ b/src/main/java/com/gregtechceu/gtceu/data/lang/AdvancementLang.java @@ -7,202 +7,231 @@ public class AdvancementLang { public static void init(RegistrateLangProvider provider) { // todo advancements /* - provider.add("gtceu.advancement.root_steam.name", "Steam Age"); - provider.add("gtceu.advancement.root_steam.desc", "Welcome to GregTech! Everything begins with your first copper ingots."); - provider.add("gtceu.advancement.steam.1_first_tools.name", "First Tools"); - provider.add("gtceu.advancement.steam.1_first_tools.desc", "Craft a Hammer."); - provider.add("gtceu.advancement.steam.2_more_tools.name", "More Tools"); - provider.add("gtceu.advancement.steam.2_more_tools.desc", "Craft a Wrench."); - provider.add("gtceu.advancement.steam.3_bronze_dust.name", "Bronze"); - provider.add("gtceu.advancement.steam.3_bronze_dust.desc", "Craft bronze dust."); - provider.add("gtceu.advancement.steam.4_bronze_boiler.name", "First Steam"); - provider.add("gtceu.advancement.steam.4_bronze_boiler.desc", "Craft a Bronze Boiler."); - provider.add("gtceu.advancement.steam.5_bronze_forge_hammer.name", "Cheaper than a Macerator"); - provider.add("gtceu.advancement.steam.5_bronze_forge_hammer.desc", "Craft a Steam Forge Hammer."); - provider.add("gtceu.advancement.steam.6_bronze_alloy_smelter.name", "Alloy Smelter"); - provider.add("gtceu.advancement.steam.6_bronze_alloy_smelter.desc", "Craft a Steam Alloy Smelter."); - provider.add("gtceu.advancement.steam.7_bronze_extractor.name", "Extract"); - provider.add("gtceu.advancement.steam.7_bronze_extractor.desc", "Craft a Steam Extractor."); - provider.add("gtceu.advancement.steam.8_bronze_solar_boiler.name", "Simply Eco"); - provider.add("gtceu.advancement.steam.8_bronze_solar_boiler.desc", "Craft a Solar Boiler."); - provider.add("gtceu.advancement.steam.9_coke_oven.name", "Coke Oven"); - provider.add("gtceu.advancement.steam.9_coke_oven.desc", "Craft a Coke Oven."); - provider.add("gtceu.advancement.steam.10_vacuum_tube.name", "Tubes"); - provider.add("gtceu.advancement.steam.10_vacuum_tube.desc", "Craft a Vacuum Tube."); - provider.add("gtceu.advancement.steam.11_rubber.name", "Rubber"); - provider.add("gtceu.advancement.steam.11_rubber.desc", "Make Rubber in an alloy smelter using Sulfur and Raw Rubber Pulp, obtained from Rubber Trees."); - provider.add("gtceu.advancement.steam.12_electronic_circuit.name", "Basic Circuit"); - provider.add("gtceu.advancement.steam.12_electronic_circuit.desc", "Craft an Electronic Circuit."); - provider.add("gtceu.advancement.steam.13_steel.name", "Steel"); - provider.add("gtceu.advancement.steam.13_steel.desc", "Produce Steel in a Primitive Blast Furnace."); - provider.add("gtceu.advancement.steam.14_magnetic_iron.name", "Magnetic Iron"); - provider.add("gtceu.advancement.steam.14_magnetic_iron.desc", "Craft a Magnetic Iron Rod with 4 Redstone."); - provider.add("gtceu.advancement.steam.15_lv_motor.name", "Low Voltage Motor"); - provider.add("gtceu.advancement.steam.15_lv_motor.desc", "Craft a Low Voltage Motor."); - provider.add("gtceu.advancement.steam.16_steel_boiler.name", "High Pressure"); - provider.add("gtceu.advancement.steam.16_steel_boiler.desc", "Craft a High Pressure Boiler."); - provider.add("gtceu.advancement.steam.81_crafting_station.name", "Crafting Station"); - provider.add("gtceu.advancement.steam.81_crafting_station.desc", "Craft a Crafting Station to make complex crafts much more manageable."); - provider.add("gtceu.advancement.steam.83_hp_solar_boiler.name", "Solar OP Pls Nerf"); - provider.add("gtceu.advancement.steam.83_hp_solar_boiler.desc", "Craft a High Pressure Solar Boiler."); - provider.add("gtceu.advancement.steam.85_steam_vent_death.name", "Get out of the way!"); - provider.add("gtceu.advancement.steam.85_steam_vent_death.desc", "Die to a venting Steam Machine."); - provider.add("gtceu.advancement.steam.87_fluid_pipe_death_heat.name", "Boiling Hot!"); - provider.add("gtceu.advancement.steam.87_fluid_pipe_death_heat.desc", "Die to a Fluid Pipe full of Hot Fluid."); - provider.add("gtceu.advancement.steam.90_primitive_pump.name", "Primitive Water Pump"); - provider.add("gtceu.advancement.steam.90_primitive_pump.desc", "Craft a Primitive Water Pump for early water gathering."); - provider.add("gtceu.advancement.root_lv.name", "Low Voltage"); - provider.add("gtceu.advancement.root_lv.desc", "Craft a Basic Steam Turbine"); - provider.add("gtceu.advancement.low_voltage.17_lv_pump.name", "Pump"); - provider.add("gtceu.advancement.low_voltage.17_lv_pump.desc", "Craft an LV Pump."); - provider.add("gtceu.advancement.low_voltage.18_shutter_cover.name", "Close it!"); - provider.add("gtceu.advancement.low_voltage.18_shutter_cover.desc", "Get a Shutter Cover."); - provider.add("gtceu.advancement.low_voltage.19_lv_pump_block.name", "Slurp"); - provider.add("gtceu.advancement.low_voltage.19_lv_pump_block.desc", "Craft a Basic Pump."); - provider.add("gtceu.advancement.low_voltage.20_lv_conveyor.name", "Transport"); - provider.add("gtceu.advancement.low_voltage.20_lv_conveyor.desc", "Craft an LV Conveyor."); - provider.add("gtceu.advancement.low_voltage.21_machine_controller_cover.name", "Manipulation"); - provider.add("gtceu.advancement.low_voltage.21_machine_controller_cover.desc", "Get a Machine Controller."); - provider.add("gtceu.advancement.low_voltage.22_lv_robot_arm.name", "Complex Machines"); - provider.add("gtceu.advancement.low_voltage.22_lv_robot_arm.desc", "Craft an LV Robot Arm."); - provider.add("gtceu.advancement.low_voltage.23_lv_assembler.name", "Avengers, Assemble!"); - provider.add("gtceu.advancement.low_voltage.23_lv_assembler.desc", "Craft an LV Assembler."); - provider.add("gtceu.advancement.low_voltage.24_smart_filter.name", "Filter and Regulate"); - provider.add("gtceu.advancement.low_voltage.24_smart_filter.desc", "Get a Smart Filter."); - provider.add("gtceu.advancement.low_voltage.25_large_boiler.name", "Extreme Pressure"); - provider.add("gtceu.advancement.low_voltage.25_large_boiler.desc", "Set up a Large Boiler."); - provider.add("gtceu.advancement.low_voltage.26_arc_furnace.name", "Recycling"); - provider.add("gtceu.advancement.low_voltage.26_arc_furnace.desc", "Craft an Arc Furnace."); - provider.add("gtceu.advancement.low_voltage.27_electric_blast_furnace.name", "Electric Blast Furnace"); - provider.add("gtceu.advancement.low_voltage.27_electric_blast_furnace.desc", "Craft an Electric Blast Furnace."); - provider.add("gtceu.advancement.low_voltage.28_lv_energy_hatch.name", "You Need Two Of Them"); - provider.add("gtceu.advancement.low_voltage.28_lv_energy_hatch.desc", "Craft an LV Energy Hatch."); - provider.add("gtceu.advancement.low_voltage.29_lv_battery_buffer.name", "Batteries"); - provider.add("gtceu.advancement.low_voltage.29_lv_battery_buffer.desc", "Craft an LV 4A Battery Buffer."); - provider.add("gtceu.advancement.low_voltage.30_good_electronic_circuit.name", "Better Circuits"); - provider.add("gtceu.advancement.low_voltage.30_good_electronic_circuit.desc", "Get Good Circuits."); - provider.add("gtceu.advancement.low_voltage.86_electrocution_death.name", "Shoulda Covered your Wires!"); - provider.add("gtceu.advancement.low_voltage.86_electrocution_death.desc", "Die to an Uninsulated Wire."); - provider.add("gtceu.advancement.low_voltage.88_first_cover_place.name", "The First of Many"); - provider.add("gtceu.advancement.low_voltage.88_first_cover_place.desc", "Place your first Machine Cover."); - provider.add("gtceu.advancement.root_mv.name", "Medium Voltage"); - provider.add("gtceu.advancement.root_mv.desc", "Produce an Aluminium Ingot."); - provider.add("gtceu.advancement.medium_voltage.31_mv_energy_hatch.name", "Upgrade Your EBF"); - provider.add("gtceu.advancement.medium_voltage.31_mv_energy_hatch.desc", "Craft an MV Energy Hatch."); - provider.add("gtceu.advancement.medium_voltage.32_electric_drill.name", "Drill Time"); - provider.add("gtceu.advancement.medium_voltage.32_electric_drill.desc", "Craft a Drill."); - provider.add("gtceu.advancement.medium_voltage.33_chainsaw.name", "Brrrr..."); - provider.add("gtceu.advancement.medium_voltage.33_chainsaw.desc", "Craft a Chainsaw."); - provider.add("gtceu.advancement.medium_voltage.34_silicon_boule.name", "Monocrystalline Silicon Boule"); - provider.add("gtceu.advancement.medium_voltage.34_silicon_boule.desc", "Produce a Monocrystalline Silicon Boule."); - provider.add("gtceu.advancement.medium_voltage.35_logic_circuit_wafer.name", "Logic Circuit Wafer"); - provider.add("gtceu.advancement.medium_voltage.35_logic_circuit_wafer.desc", "Produce a Logic Circuit Wafer."); - provider.add("gtceu.advancement.medium_voltage.36_integrated_logic_circuit.name", "Integrated Logic Circuit"); - provider.add("gtceu.advancement.medium_voltage.36_integrated_logic_circuit.desc", "Produce an Integrated Logic Circuit."); - provider.add("gtceu.advancement.medium_voltage.37_advanced_integrated_logic_circuit.name", "Step Forward"); - provider.add("gtceu.advancement.medium_voltage.37_advanced_integrated_logic_circuit.desc", "Obtain Advanced Circuits."); - provider.add("gtceu.advancement.medium_voltage.38_super_chest.name", "New Storage"); - provider.add("gtceu.advancement.medium_voltage.38_super_chest.desc", "Craft a Super Chest I."); - provider.add("gtceu.advancement.medium_voltage.39_super_tank.name", "Where is the Ocean?"); - provider.add("gtceu.advancement.medium_voltage.39_super_tank.desc", "Build a Super Tank I."); - provider.add("gtceu.advancement.root_hv.name", "High Voltage"); - provider.add("gtceu.advancement.root_hv.desc", "Produce a Stainless Steel Ingot."); - provider.add("gtceu.advancement.high_voltage.40_workstation.name", "Workstations"); - provider.add("gtceu.advancement.high_voltage.40_workstation.desc", "Get Workstations."); - provider.add("gtceu.advancement.high_voltage.41_vacuum_freezer.name", "Vacuum Freezer"); - provider.add("gtceu.advancement.high_voltage.41_vacuum_freezer.desc", "Set up a Vacuum Freezer."); - provider.add("gtceu.advancement.high_voltage.42_kanthal_coil.name", "Upgrade your Coils to Level II"); - provider.add("gtceu.advancement.high_voltage.42_kanthal_coil.desc", "Craft a Kanthal Heating Coil."); - provider.add("gtceu.advancement.high_voltage.43_multi_smelter.name", "High Power Smelter"); - provider.add("gtceu.advancement.high_voltage.43_multi_smelter.desc", "Set up a Multi Smelter."); - provider.add("gtceu.advancement.high_voltage.44_distillation_tower.name", "Oil Plant"); - provider.add("gtceu.advancement.high_voltage.44_distillation_tower.desc", "Start up a Distillation Tower."); - provider.add("gtceu.advancement.high_voltage.45_large_steam_turbine.name", "So Much Steam"); - provider.add("gtceu.advancement.high_voltage.45_large_steam_turbine.desc", "Start up a Large Steam Turbine."); - provider.add("gtceu.advancement.high_voltage.46_hv_macerator.name", "Universal Macerator"); - provider.add("gtceu.advancement.high_voltage.46_hv_macerator.desc", "Craft an HV Macerator for ore byproducts."); - provider.add("gtceu.advancement.high_voltage.82_large_chemical_reactor.name", "Large Chemical Reactor"); - provider.add("gtceu.advancement.high_voltage.82_large_chemical_reactor.desc", "Set up a Large Chemical Reactor for more efficient chemistry."); - provider.add("gtceu.advancement.high_voltage.84_rotor_holder_open.name", "A Painful Way to Go Out"); - provider.add("gtceu.advancement.high_voltage.84_rotor_holder_open.desc", "Die by opening a spinning Rotor Holder."); - provider.add("gtceu.advancement.high_voltage.89_fluid_pipe_death_cold.name", "Freezing Cold!"); - provider.add("gtceu.advancement.high_voltage.89_fluid_pipe_death_cold.desc", "Die to a Fluid Pipe full of Cold Fluid."); - provider.add("gtceu.advancement.root_ev.name", "Extreme Voltage"); - provider.add("gtceu.advancement.root_ev.desc", "Cool down a Hot Titanium Ingot."); - provider.add("gtceu.advancement.extreme_voltage.47_nichrome_coil.name", "Upgrade your Coils to Level III"); - provider.add("gtceu.advancement.extreme_voltage.47_nichrome_coil.desc", "Craft a Nichrome Heating Coil."); - provider.add("gtceu.advancement.extreme_voltage.48_osmium.name", "Osmium"); - provider.add("gtceu.advancement.extreme_voltage.48_osmium.desc", "Cool down a Hot Osmium Ingot."); - provider.add("gtceu.advancement.extreme_voltage.49_nano_cpu_wafer.name", "Nano CPU Wafer"); - provider.add("gtceu.advancement.extreme_voltage.49_nano_cpu_wafer.desc", "Produce a Nano CPU Wafer."); - provider.add("gtceu.advancement.extreme_voltage.50_nano_processor.name", "Nano Processor"); - provider.add("gtceu.advancement.extreme_voltage.50_nano_processor.desc", "Get Nano Processors."); - provider.add("gtceu.advancement.extreme_voltage.51_large_combustion_engine.name", "Large Combustion Engine"); - provider.add("gtceu.advancement.extreme_voltage.51_large_combustion_engine.desc", "Set up a Large Combustion Engine, supply it with Lubricant, and boost it with Oxygen."); - provider.add("gtceu.advancement.extreme_voltage.52_soc_wafer.name", "SoC Wafer"); - provider.add("gtceu.advancement.extreme_voltage.52_soc_wafer.desc", "Produce an SoC Wafer to make cheaper Basic and Good Circuits."); - provider.add("gtceu.advancement.root_iv.name", "Insane Voltage"); - provider.add("gtceu.advancement.root_iv.desc", "Cool down a Hot Tungstensteel Ingot."); - provider.add("gtceu.advancement.insane_voltage.53_plutonium_239.name", "Plutonium 239"); - provider.add("gtceu.advancement.insane_voltage.53_plutonium_239.desc", "Obtain Plutonium 239 for a source of radon."); - provider.add("gtceu.advancement.insane_voltage.54_indium.name", "Indium"); - provider.add("gtceu.advancement.insane_voltage.54_indium.desc", "Obtain Indium from Sphalerite and Galena."); - provider.add("gtceu.advancement.insane_voltage.55_qbit_cpu_wafer.name", "QBit CPU Wafer"); - provider.add("gtceu.advancement.insane_voltage.55_qbit_cpu_wafer.desc", "Produce a QBit CPU Wafer."); - provider.add("gtceu.advancement.insane_voltage.56_quantum_processor.name", "Quantum Processor"); - provider.add("gtceu.advancement.insane_voltage.56_quantum_processor.desc", "Get Quantum Processors."); - provider.add("gtceu.advancement.insane_voltage.57_tungstensteel_coil.name", "Upgrade your Coils to Level IV"); - provider.add("gtceu.advancement.insane_voltage.57_tungstensteel_coil.desc", "Craft an RTM Alloy Heating Coil."); - provider.add("gtceu.advancement.insane_voltage.58_hss_g_coil.name", "Upgrade your Coils to Level V"); - provider.add("gtceu.advancement.insane_voltage.58_hss_g_coil.desc", "Craft an HSS-G Heating Coil."); - provider.add("gtceu.advancement.root_luv.name", "Ludicrous Voltage"); - provider.add("gtceu.advancement.root_luv.desc", "Set up an Assembly Line."); - provider.add("gtceu.advancement.ludicrous_voltage.59_superconducting_coil.name", "Conducting"); - provider.add("gtceu.advancement.ludicrous_voltage.59_superconducting_coil.desc", "Craft a Superconducting Coil."); - provider.add("gtceu.advancement.ludicrous_voltage.60_fusion.name", "Fusion Reactor"); - provider.add("gtceu.advancement.ludicrous_voltage.60_fusion.desc", "Set up a Fusion Reactor Mark 1."); - provider.add("gtceu.advancement.ludicrous_voltage.61_europium.name", "Advancement in Technology"); - provider.add("gtceu.advancement.ludicrous_voltage.61_europium.desc", "Produce Europium."); - provider.add("gtceu.advancement.ludicrous_voltage.62_raw_crystal_chip.name", "Raw Crystal Chip"); - provider.add("gtceu.advancement.ludicrous_voltage.62_raw_crystal_chip.desc", "Produce a Raw Crystal Chip."); - provider.add("gtceu.advancement.ludicrous_voltage.63_crystal_processing_unit.name", "Crystal Processing Unit"); - provider.add("gtceu.advancement.ludicrous_voltage.63_crystal_processing_unit.desc", "Produce a Crystal Processing Unit."); - provider.add("gtceu.advancement.ludicrous_voltage.64_crystal_processor.name", "Crystal Processor"); - provider.add("gtceu.advancement.ludicrous_voltage.64_crystal_processor.desc", "Get Crystal Processors."); - provider.add("gtceu.advancement.ludicrous_voltage.65_naquadah.name", "Stargate Material"); - provider.add("gtceu.advancement.ludicrous_voltage.65_naquadah.desc", "Cool down a Hot Naquadah Ingot."); - provider.add("gtceu.advancement.ludicrous_voltage.66_naquadah_coil.name", "Upgrade your Coils to Level VI"); - provider.add("gtceu.advancement.ludicrous_voltage.66_naquadah_coil.desc", "Craft a Naquadah Heating Coil."); - provider.add("gtceu.advancement.ludicrous_voltage.67_asoc_wafer.name", "ASoC Wafer"); - provider.add("gtceu.advancement.ludicrous_voltage.67_asoc_wafer.desc", "Produce an ASoC Wafer to make cheaper Extreme and Advanced Circuits."); - provider.add("gtceu.advancement.ludicrous_voltage.68_large_plasma_turbine.name", "Large Plasma Turbine"); - provider.add("gtceu.advancement.ludicrous_voltage.68_large_plasma_turbine.desc", "Craft a Plasma Turbine to turn Plasma into Usable Fluid."); - provider.add("gtceu.advancement.root_zpm.name", "Zero Point Module"); - provider.add("gtceu.advancement.root_zpm.desc", "Set up a Fusion Reactor Mark 2."); - provider.add("gtceu.advancement.zero_point_module.69_americium.name", "Going for the Limit"); - provider.add("gtceu.advancement.zero_point_module.69_americium.desc", "Produce Americium."); - provider.add("gtceu.advancement.zero_point_module.70_stem_cells.name", "Stem Cells"); - provider.add("gtceu.advancement.zero_point_module.70_stem_cells.desc", "Produce Stem Cells."); - provider.add("gtceu.advancement.zero_point_module.71_neuro_processing_unit.name", "Neuro Processing Unit"); - provider.add("gtceu.advancement.zero_point_module.71_neuro_processing_unit.desc", "Produce a Neuro Processing Unit."); - provider.add("gtceu.advancement.zero_point_module.72_wetware_processor.name", "Wetware Processor"); - provider.add("gtceu.advancement.zero_point_module.72_wetware_processor.desc", "Get Wetware Processors."); - provider.add("gtceu.advancement.zero_point_module.73_trinium_coil.name", "Over 9000!"); - provider.add("gtceu.advancement.zero_point_module.73_trinium_coil.desc", "Craft a Trinium Heating Coil."); - provider.add("gtceu.advancement.root_uv.name", "Ultimate Voltage"); - provider.add("gtceu.advancement.root_uv.desc", "Produce Tritanium."); - provider.add("gtceu.advancement.ultimate_voltage.74_wetware_mainframe.name", "Wetware Mainframe"); - provider.add("gtceu.advancement.ultimate_voltage.74_wetware_mainframe.desc", "Get a Wetware Mainframe."); - provider.add("gtceu.advancement.ultimate_voltage.75_fusion_reactor_3.name", "A Sun Down on Earth"); - provider.add("gtceu.advancement.ultimate_voltage.75_fusion_reactor_3.desc", "Set up a Fusion Reactor Mark 3."); - provider.add("gtceu.advancement.ultimate_voltage.76_neutronium.name", "As Dense As Possible"); - provider.add("gtceu.advancement.ultimate_voltage.76_neutronium.desc", "Produce Neutronium."); - provider.add("gtceu.advancement.ultimate_voltage.77_ultimate_battery.name", "What Now?"); - provider.add("gtceu.advancement.ultimate_voltage.77_ultimate_battery.desc", "Craft an Ultimate Battery."); - provider.add("gtceu.advancement.ultimate_voltage.78_hasoc_wafer.name", "HASoC Wafer"); - provider.add("gtceu.advancement.ultimate_voltage.78_hasoc_wafer.desc", "Produce an HASoC Wafer to make cheaper Master Circuits."); - provider.add("gtceu.advancement.ultimate_voltage.79_tritanium_coil.name", "The Final Coil"); - provider.add("gtceu.advancement.ultimate_voltage.79_tritanium_coil.desc", "Craft a Tritanium Heating Coil."); + * provider.add("gtceu.advancement.root_steam.name", "Steam Age"); + * provider.add("gtceu.advancement.root_steam.desc", + * "Welcome to GregTech! Everything begins with your first copper ingots."); + * provider.add("gtceu.advancement.steam.1_first_tools.name", "First Tools"); + * provider.add("gtceu.advancement.steam.1_first_tools.desc", "Craft a Hammer."); + * provider.add("gtceu.advancement.steam.2_more_tools.name", "More Tools"); + * provider.add("gtceu.advancement.steam.2_more_tools.desc", "Craft a Wrench."); + * provider.add("gtceu.advancement.steam.3_bronze_dust.name", "Bronze"); + * provider.add("gtceu.advancement.steam.3_bronze_dust.desc", "Craft bronze dust."); + * provider.add("gtceu.advancement.steam.4_bronze_boiler.name", "First Steam"); + * provider.add("gtceu.advancement.steam.4_bronze_boiler.desc", "Craft a Bronze Boiler."); + * provider.add("gtceu.advancement.steam.5_bronze_forge_hammer.name", "Cheaper than a Macerator"); + * provider.add("gtceu.advancement.steam.5_bronze_forge_hammer.desc", "Craft a Steam Forge Hammer."); + * provider.add("gtceu.advancement.steam.6_bronze_alloy_smelter.name", "Alloy Smelter"); + * provider.add("gtceu.advancement.steam.6_bronze_alloy_smelter.desc", "Craft a Steam Alloy Smelter."); + * provider.add("gtceu.advancement.steam.7_bronze_extractor.name", "Extract"); + * provider.add("gtceu.advancement.steam.7_bronze_extractor.desc", "Craft a Steam Extractor."); + * provider.add("gtceu.advancement.steam.8_bronze_solar_boiler.name", "Simply Eco"); + * provider.add("gtceu.advancement.steam.8_bronze_solar_boiler.desc", "Craft a Solar Boiler."); + * provider.add("gtceu.advancement.steam.9_coke_oven.name", "Coke Oven"); + * provider.add("gtceu.advancement.steam.9_coke_oven.desc", "Craft a Coke Oven."); + * provider.add("gtceu.advancement.steam.10_vacuum_tube.name", "Tubes"); + * provider.add("gtceu.advancement.steam.10_vacuum_tube.desc", "Craft a Vacuum Tube."); + * provider.add("gtceu.advancement.steam.11_rubber.name", "Rubber"); + * provider.add("gtceu.advancement.steam.11_rubber.desc", + * "Make Rubber in an alloy smelter using Sulfur and Raw Rubber Pulp, obtained from Rubber Trees."); + * provider.add("gtceu.advancement.steam.12_electronic_circuit.name", "Basic Circuit"); + * provider.add("gtceu.advancement.steam.12_electronic_circuit.desc", "Craft an Electronic Circuit."); + * provider.add("gtceu.advancement.steam.13_steel.name", "Steel"); + * provider.add("gtceu.advancement.steam.13_steel.desc", "Produce Steel in a Primitive Blast Furnace."); + * provider.add("gtceu.advancement.steam.14_magnetic_iron.name", "Magnetic Iron"); + * provider.add("gtceu.advancement.steam.14_magnetic_iron.desc", "Craft a Magnetic Iron Rod with 4 Redstone."); + * provider.add("gtceu.advancement.steam.15_lv_motor.name", "Low Voltage Motor"); + * provider.add("gtceu.advancement.steam.15_lv_motor.desc", "Craft a Low Voltage Motor."); + * provider.add("gtceu.advancement.steam.16_steel_boiler.name", "High Pressure"); + * provider.add("gtceu.advancement.steam.16_steel_boiler.desc", "Craft a High Pressure Boiler."); + * provider.add("gtceu.advancement.steam.81_crafting_station.name", "Crafting Station"); + * provider.add("gtceu.advancement.steam.81_crafting_station.desc", + * "Craft a Crafting Station to make complex crafts much more manageable."); + * provider.add("gtceu.advancement.steam.83_hp_solar_boiler.name", "Solar OP Pls Nerf"); + * provider.add("gtceu.advancement.steam.83_hp_solar_boiler.desc", "Craft a High Pressure Solar Boiler."); + * provider.add("gtceu.advancement.steam.85_steam_vent_death.name", "Get out of the way!"); + * provider.add("gtceu.advancement.steam.85_steam_vent_death.desc", "Die to a venting Steam Machine."); + * provider.add("gtceu.advancement.steam.87_fluid_pipe_death_heat.name", "Boiling Hot!"); + * provider.add("gtceu.advancement.steam.87_fluid_pipe_death_heat.desc", + * "Die to a Fluid Pipe full of Hot Fluid."); + * provider.add("gtceu.advancement.steam.90_primitive_pump.name", "Primitive Water Pump"); + * provider.add("gtceu.advancement.steam.90_primitive_pump.desc", + * "Craft a Primitive Water Pump for early water gathering."); + * provider.add("gtceu.advancement.root_lv.name", "Low Voltage"); + * provider.add("gtceu.advancement.root_lv.desc", "Craft a Basic Steam Turbine"); + * provider.add("gtceu.advancement.low_voltage.17_lv_pump.name", "Pump"); + * provider.add("gtceu.advancement.low_voltage.17_lv_pump.desc", "Craft an LV Pump."); + * provider.add("gtceu.advancement.low_voltage.18_shutter_cover.name", "Close it!"); + * provider.add("gtceu.advancement.low_voltage.18_shutter_cover.desc", "Get a Shutter Cover."); + * provider.add("gtceu.advancement.low_voltage.19_lv_pump_block.name", "Slurp"); + * provider.add("gtceu.advancement.low_voltage.19_lv_pump_block.desc", "Craft a Basic Pump."); + * provider.add("gtceu.advancement.low_voltage.20_lv_conveyor.name", "Transport"); + * provider.add("gtceu.advancement.low_voltage.20_lv_conveyor.desc", "Craft an LV Conveyor."); + * provider.add("gtceu.advancement.low_voltage.21_machine_controller_cover.name", "Manipulation"); + * provider.add("gtceu.advancement.low_voltage.21_machine_controller_cover.desc", "Get a Machine Controller."); + * provider.add("gtceu.advancement.low_voltage.22_lv_robot_arm.name", "Complex Machines"); + * provider.add("gtceu.advancement.low_voltage.22_lv_robot_arm.desc", "Craft an LV Robot Arm."); + * provider.add("gtceu.advancement.low_voltage.23_lv_assembler.name", "Avengers, Assemble!"); + * provider.add("gtceu.advancement.low_voltage.23_lv_assembler.desc", "Craft an LV Assembler."); + * provider.add("gtceu.advancement.low_voltage.24_smart_filter.name", "Filter and Regulate"); + * provider.add("gtceu.advancement.low_voltage.24_smart_filter.desc", "Get a Smart Filter."); + * provider.add("gtceu.advancement.low_voltage.25_large_boiler.name", "Extreme Pressure"); + * provider.add("gtceu.advancement.low_voltage.25_large_boiler.desc", "Set up a Large Boiler."); + * provider.add("gtceu.advancement.low_voltage.26_arc_furnace.name", "Recycling"); + * provider.add("gtceu.advancement.low_voltage.26_arc_furnace.desc", "Craft an Arc Furnace."); + * provider.add("gtceu.advancement.low_voltage.27_electric_blast_furnace.name", "Electric Blast Furnace"); + * provider.add("gtceu.advancement.low_voltage.27_electric_blast_furnace.desc", + * "Craft an Electric Blast Furnace."); + * provider.add("gtceu.advancement.low_voltage.28_lv_energy_hatch.name", "You Need Two Of Them"); + * provider.add("gtceu.advancement.low_voltage.28_lv_energy_hatch.desc", "Craft an LV Energy Hatch."); + * provider.add("gtceu.advancement.low_voltage.29_lv_battery_buffer.name", "Batteries"); + * provider.add("gtceu.advancement.low_voltage.29_lv_battery_buffer.desc", "Craft an LV 4A Battery Buffer."); + * provider.add("gtceu.advancement.low_voltage.30_good_electronic_circuit.name", "Better Circuits"); + * provider.add("gtceu.advancement.low_voltage.30_good_electronic_circuit.desc", "Get Good Circuits."); + * provider.add("gtceu.advancement.low_voltage.86_electrocution_death.name", "Shoulda Covered your Wires!"); + * provider.add("gtceu.advancement.low_voltage.86_electrocution_death.desc", "Die to an Uninsulated Wire."); + * provider.add("gtceu.advancement.low_voltage.88_first_cover_place.name", "The First of Many"); + * provider.add("gtceu.advancement.low_voltage.88_first_cover_place.desc", "Place your first Machine Cover."); + * provider.add("gtceu.advancement.root_mv.name", "Medium Voltage"); + * provider.add("gtceu.advancement.root_mv.desc", "Produce an Aluminium Ingot."); + * provider.add("gtceu.advancement.medium_voltage.31_mv_energy_hatch.name", "Upgrade Your EBF"); + * provider.add("gtceu.advancement.medium_voltage.31_mv_energy_hatch.desc", "Craft an MV Energy Hatch."); + * provider.add("gtceu.advancement.medium_voltage.32_electric_drill.name", "Drill Time"); + * provider.add("gtceu.advancement.medium_voltage.32_electric_drill.desc", "Craft a Drill."); + * provider.add("gtceu.advancement.medium_voltage.33_chainsaw.name", "Brrrr..."); + * provider.add("gtceu.advancement.medium_voltage.33_chainsaw.desc", "Craft a Chainsaw."); + * provider.add("gtceu.advancement.medium_voltage.34_silicon_boule.name", "Monocrystalline Silicon Boule"); + * provider.add("gtceu.advancement.medium_voltage.34_silicon_boule.desc", + * "Produce a Monocrystalline Silicon Boule."); + * provider.add("gtceu.advancement.medium_voltage.35_logic_circuit_wafer.name", "Logic Circuit Wafer"); + * provider.add("gtceu.advancement.medium_voltage.35_logic_circuit_wafer.desc", + * "Produce a Logic Circuit Wafer."); + * provider.add("gtceu.advancement.medium_voltage.36_integrated_logic_circuit.name", + * "Integrated Logic Circuit"); + * provider.add("gtceu.advancement.medium_voltage.36_integrated_logic_circuit.desc", + * "Produce an Integrated Logic Circuit."); + * provider.add("gtceu.advancement.medium_voltage.37_advanced_integrated_logic_circuit.name", "Step Forward"); + * provider.add("gtceu.advancement.medium_voltage.37_advanced_integrated_logic_circuit.desc", + * "Obtain Advanced Circuits."); + * provider.add("gtceu.advancement.medium_voltage.38_super_chest.name", "New Storage"); + * provider.add("gtceu.advancement.medium_voltage.38_super_chest.desc", "Craft a Super Chest I."); + * provider.add("gtceu.advancement.medium_voltage.39_super_tank.name", "Where is the Ocean?"); + * provider.add("gtceu.advancement.medium_voltage.39_super_tank.desc", "Build a Super Tank I."); + * provider.add("gtceu.advancement.root_hv.name", "High Voltage"); + * provider.add("gtceu.advancement.root_hv.desc", "Produce a Stainless Steel Ingot."); + * provider.add("gtceu.advancement.high_voltage.40_workstation.name", "Workstations"); + * provider.add("gtceu.advancement.high_voltage.40_workstation.desc", "Get Workstations."); + * provider.add("gtceu.advancement.high_voltage.41_vacuum_freezer.name", "Vacuum Freezer"); + * provider.add("gtceu.advancement.high_voltage.41_vacuum_freezer.desc", "Set up a Vacuum Freezer."); + * provider.add("gtceu.advancement.high_voltage.42_kanthal_coil.name", "Upgrade your Coils to Level II"); + * provider.add("gtceu.advancement.high_voltage.42_kanthal_coil.desc", "Craft a Kanthal Heating Coil."); + * provider.add("gtceu.advancement.high_voltage.43_multi_smelter.name", "High Power Smelter"); + * provider.add("gtceu.advancement.high_voltage.43_multi_smelter.desc", "Set up a Multi Smelter."); + * provider.add("gtceu.advancement.high_voltage.44_distillation_tower.name", "Oil Plant"); + * provider.add("gtceu.advancement.high_voltage.44_distillation_tower.desc", "Start up a Distillation Tower."); + * provider.add("gtceu.advancement.high_voltage.45_large_steam_turbine.name", "So Much Steam"); + * provider.add("gtceu.advancement.high_voltage.45_large_steam_turbine.desc", + * "Start up a Large Steam Turbine."); + * provider.add("gtceu.advancement.high_voltage.46_hv_macerator.name", "Universal Macerator"); + * provider.add("gtceu.advancement.high_voltage.46_hv_macerator.desc", + * "Craft an HV Macerator for ore byproducts."); + * provider.add("gtceu.advancement.high_voltage.82_large_chemical_reactor.name", "Large Chemical Reactor"); + * provider.add("gtceu.advancement.high_voltage.82_large_chemical_reactor.desc", + * "Set up a Large Chemical Reactor for more efficient chemistry."); + * provider.add("gtceu.advancement.high_voltage.84_rotor_holder_open.name", "A Painful Way to Go Out"); + * provider.add("gtceu.advancement.high_voltage.84_rotor_holder_open.desc", + * "Die by opening a spinning Rotor Holder."); + * provider.add("gtceu.advancement.high_voltage.89_fluid_pipe_death_cold.name", "Freezing Cold!"); + * provider.add("gtceu.advancement.high_voltage.89_fluid_pipe_death_cold.desc", + * "Die to a Fluid Pipe full of Cold Fluid."); + * provider.add("gtceu.advancement.root_ev.name", "Extreme Voltage"); + * provider.add("gtceu.advancement.root_ev.desc", "Cool down a Hot Titanium Ingot."); + * provider.add("gtceu.advancement.extreme_voltage.47_nichrome_coil.name", "Upgrade your Coils to Level III"); + * provider.add("gtceu.advancement.extreme_voltage.47_nichrome_coil.desc", "Craft a Nichrome Heating Coil."); + * provider.add("gtceu.advancement.extreme_voltage.48_osmium.name", "Osmium"); + * provider.add("gtceu.advancement.extreme_voltage.48_osmium.desc", "Cool down a Hot Osmium Ingot."); + * provider.add("gtceu.advancement.extreme_voltage.49_nano_cpu_wafer.name", "Nano CPU Wafer"); + * provider.add("gtceu.advancement.extreme_voltage.49_nano_cpu_wafer.desc", "Produce a Nano CPU Wafer."); + * provider.add("gtceu.advancement.extreme_voltage.50_nano_processor.name", "Nano Processor"); + * provider.add("gtceu.advancement.extreme_voltage.50_nano_processor.desc", "Get Nano Processors."); + * provider.add("gtceu.advancement.extreme_voltage.51_large_combustion_engine.name", "Large Combustion Engine"); + * provider.add("gtceu.advancement.extreme_voltage.51_large_combustion_engine.desc", + * "Set up a Large Combustion Engine, supply it with Lubricant, and boost it with Oxygen."); + * provider.add("gtceu.advancement.extreme_voltage.52_soc_wafer.name", "SoC Wafer"); + * provider.add("gtceu.advancement.extreme_voltage.52_soc_wafer.desc", + * "Produce an SoC Wafer to make cheaper Basic and Good Circuits."); + * provider.add("gtceu.advancement.root_iv.name", "Insane Voltage"); + * provider.add("gtceu.advancement.root_iv.desc", "Cool down a Hot Tungstensteel Ingot."); + * provider.add("gtceu.advancement.insane_voltage.53_plutonium_239.name", "Plutonium 239"); + * provider.add("gtceu.advancement.insane_voltage.53_plutonium_239.desc", + * "Obtain Plutonium 239 for a source of radon."); + * provider.add("gtceu.advancement.insane_voltage.54_indium.name", "Indium"); + * provider.add("gtceu.advancement.insane_voltage.54_indium.desc", "Obtain Indium from Sphalerite and Galena."); + * provider.add("gtceu.advancement.insane_voltage.55_qbit_cpu_wafer.name", "QBit CPU Wafer"); + * provider.add("gtceu.advancement.insane_voltage.55_qbit_cpu_wafer.desc", "Produce a QBit CPU Wafer."); + * provider.add("gtceu.advancement.insane_voltage.56_quantum_processor.name", "Quantum Processor"); + * provider.add("gtceu.advancement.insane_voltage.56_quantum_processor.desc", "Get Quantum Processors."); + * provider.add("gtceu.advancement.insane_voltage.57_tungstensteel_coil.name", + * "Upgrade your Coils to Level IV"); + * provider.add("gtceu.advancement.insane_voltage.57_tungstensteel_coil.desc", + * "Craft an RTM Alloy Heating Coil."); + * provider.add("gtceu.advancement.insane_voltage.58_hss_g_coil.name", "Upgrade your Coils to Level V"); + * provider.add("gtceu.advancement.insane_voltage.58_hss_g_coil.desc", "Craft an HSS-G Heating Coil."); + * provider.add("gtceu.advancement.root_luv.name", "Ludicrous Voltage"); + * provider.add("gtceu.advancement.root_luv.desc", "Set up an Assembly Line."); + * provider.add("gtceu.advancement.ludicrous_voltage.59_superconducting_coil.name", "Conducting"); + * provider.add("gtceu.advancement.ludicrous_voltage.59_superconducting_coil.desc", + * "Craft a Superconducting Coil."); + * provider.add("gtceu.advancement.ludicrous_voltage.60_fusion.name", "Fusion Reactor"); + * provider.add("gtceu.advancement.ludicrous_voltage.60_fusion.desc", "Set up a Fusion Reactor Mark 1."); + * provider.add("gtceu.advancement.ludicrous_voltage.61_europium.name", "Advancement in Technology"); + * provider.add("gtceu.advancement.ludicrous_voltage.61_europium.desc", "Produce Europium."); + * provider.add("gtceu.advancement.ludicrous_voltage.62_raw_crystal_chip.name", "Raw Crystal Chip"); + * provider.add("gtceu.advancement.ludicrous_voltage.62_raw_crystal_chip.desc", "Produce a Raw Crystal Chip."); + * provider.add("gtceu.advancement.ludicrous_voltage.63_crystal_processing_unit.name", + * "Crystal Processing Unit"); + * provider.add("gtceu.advancement.ludicrous_voltage.63_crystal_processing_unit.desc", + * "Produce a Crystal Processing Unit."); + * provider.add("gtceu.advancement.ludicrous_voltage.64_crystal_processor.name", "Crystal Processor"); + * provider.add("gtceu.advancement.ludicrous_voltage.64_crystal_processor.desc", "Get Crystal Processors."); + * provider.add("gtceu.advancement.ludicrous_voltage.65_naquadah.name", "Stargate Material"); + * provider.add("gtceu.advancement.ludicrous_voltage.65_naquadah.desc", "Cool down a Hot Naquadah Ingot."); + * provider.add("gtceu.advancement.ludicrous_voltage.66_naquadah_coil.name", "Upgrade your Coils to Level VI"); + * provider.add("gtceu.advancement.ludicrous_voltage.66_naquadah_coil.desc", "Craft a Naquadah Heating Coil."); + * provider.add("gtceu.advancement.ludicrous_voltage.67_asoc_wafer.name", "ASoC Wafer"); + * provider.add("gtceu.advancement.ludicrous_voltage.67_asoc_wafer.desc", + * "Produce an ASoC Wafer to make cheaper Extreme and Advanced Circuits."); + * provider.add("gtceu.advancement.ludicrous_voltage.68_large_plasma_turbine.name", "Large Plasma Turbine"); + * provider.add("gtceu.advancement.ludicrous_voltage.68_large_plasma_turbine.desc", + * "Craft a Plasma Turbine to turn Plasma into Usable Fluid."); + * provider.add("gtceu.advancement.root_zpm.name", "Zero Point Module"); + * provider.add("gtceu.advancement.root_zpm.desc", "Set up a Fusion Reactor Mark 2."); + * provider.add("gtceu.advancement.zero_point_module.69_americium.name", "Going for the Limit"); + * provider.add("gtceu.advancement.zero_point_module.69_americium.desc", "Produce Americium."); + * provider.add("gtceu.advancement.zero_point_module.70_stem_cells.name", "Stem Cells"); + * provider.add("gtceu.advancement.zero_point_module.70_stem_cells.desc", "Produce Stem Cells."); + * provider.add("gtceu.advancement.zero_point_module.71_neuro_processing_unit.name", "Neuro Processing Unit"); + * provider.add("gtceu.advancement.zero_point_module.71_neuro_processing_unit.desc", + * "Produce a Neuro Processing Unit."); + * provider.add("gtceu.advancement.zero_point_module.72_wetware_processor.name", "Wetware Processor"); + * provider.add("gtceu.advancement.zero_point_module.72_wetware_processor.desc", "Get Wetware Processors."); + * provider.add("gtceu.advancement.zero_point_module.73_trinium_coil.name", "Over 9000!"); + * provider.add("gtceu.advancement.zero_point_module.73_trinium_coil.desc", "Craft a Trinium Heating Coil."); + * provider.add("gtceu.advancement.root_uv.name", "Ultimate Voltage"); + * provider.add("gtceu.advancement.root_uv.desc", "Produce Tritanium."); + * provider.add("gtceu.advancement.ultimate_voltage.74_wetware_mainframe.name", "Wetware Mainframe"); + * provider.add("gtceu.advancement.ultimate_voltage.74_wetware_mainframe.desc", "Get a Wetware Mainframe."); + * provider.add("gtceu.advancement.ultimate_voltage.75_fusion_reactor_3.name", "A Sun Down on Earth"); + * provider.add("gtceu.advancement.ultimate_voltage.75_fusion_reactor_3.desc", + * "Set up a Fusion Reactor Mark 3."); + * provider.add("gtceu.advancement.ultimate_voltage.76_neutronium.name", "As Dense As Possible"); + * provider.add("gtceu.advancement.ultimate_voltage.76_neutronium.desc", "Produce Neutronium."); + * provider.add("gtceu.advancement.ultimate_voltage.77_ultimate_battery.name", "What Now?"); + * provider.add("gtceu.advancement.ultimate_voltage.77_ultimate_battery.desc", "Craft an Ultimate Battery."); + * provider.add("gtceu.advancement.ultimate_voltage.78_hasoc_wafer.name", "HASoC Wafer"); + * provider.add("gtceu.advancement.ultimate_voltage.78_hasoc_wafer.desc", + * "Produce an HASoC Wafer to make cheaper Master Circuits."); + * provider.add("gtceu.advancement.ultimate_voltage.79_tritanium_coil.name", "The Final Coil"); + * provider.add("gtceu.advancement.ultimate_voltage.79_tritanium_coil.desc", "Craft a Tritanium Heating Coil."); */ } } diff --git a/src/main/java/com/gregtechceu/gtceu/data/lang/BlockLang.java b/src/main/java/com/gregtechceu/gtceu/data/lang/BlockLang.java index cca5d3ca78..b294e0ed4e 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/lang/BlockLang.java +++ b/src/main/java/com/gregtechceu/gtceu/data/lang/BlockLang.java @@ -11,9 +11,6 @@ public static void init(RegistrateLangProvider provider) { } private static void initCasingLang(RegistrateLangProvider provider) { - - - // Coils replace(provider, "block.gtceu.hssg_coil_block", "HSS-G Coil Block"); replace(provider, "block.gtceu.rtm_alloy_coil_block", "RTM Alloy Coil Block"); @@ -65,14 +62,14 @@ private static void initCasingLang(RegistrateLangProvider provider) { replace(provider, "block.gtceu.steam_casing_bricked_steel", "Bricked Wrought Iron Hull"); provider.add("block.gtceu.steam_casing_bricked_steel.tooltip", "§7For improved Steam Machines"); - //GCyM Casings + // GCyM Casings replace(provider, "block.gtceu.laser_safe_engraving_casing", "Laser-Safe Engraving Casing"); replace(provider, "block.gtceu.large_scale_assembler_casing", "Large-Scale Assembler Casing"); replace(provider, "block.gtceu.reaction_safe_mixing_casing", "Reaction-Safe Mixing Casing"); replace(provider, "block.gtceu.vibration_safe_casing", "Vibration-Safe Casing"); // todo multiblock tanks - //replace(provider, "tile.steam_casing.wood_wall.name", "Wooden Wall"); + // replace(provider, "tile.steam_casing.wood_wall.name", "Wooden Wall"); // todo fusion replace(provider, "block.gtceu.superconducting_coil", "Superconducting Coil Block"); @@ -84,9 +81,11 @@ private static void initCasingLang(RegistrateLangProvider provider) { provider.add("block.filter_casing.tooltip", "Creates a §aParticle-Free§7 environment"); provider.add("block.sterilizing_filter_casing.tooltip", "Creates a §aSterilized§7 environment"); - provider.add("block.gtceu.explosive.breaking_tooltip", "Primes explosion when mined, sneak mine to pick back up"); + provider.add("block.gtceu.explosive.breaking_tooltip", + "Primes explosion when mined, sneak mine to pick back up"); provider.add("block.gtceu.explosive.lighting_tooltip", "Cannot be lit with Redstone"); - provider.add("block.gtceu.powderbarrel.drops_tooltip", "Slightly larger than TNT, drops all destroyed Blocks as Items"); + provider.add("block.gtceu.powderbarrel.drops_tooltip", + "Slightly larger than TNT, drops all destroyed Blocks as Items"); provider.add("block.gtceu.itnt.drops_tooltip", "Much larger than TNT, drops all destroyed Blocks as Items"); } } diff --git a/src/main/java/com/gregtechceu/gtceu/data/lang/CompassLang.java b/src/main/java/com/gregtechceu/gtceu/data/lang/CompassLang.java index 6acb86deec..fd9c9cf5d4 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/lang/CompassLang.java +++ b/src/main/java/com/gregtechceu/gtceu/data/lang/CompassLang.java @@ -1,7 +1,7 @@ package com.gregtechceu.gtceu.data.lang; import com.gregtechceu.gtceu.api.registry.GTRegistries; -import com.gregtechceu.gtceu.api.registry.registrate.CompassSection; + import com.tterrag.registrate.providers.RegistrateLangProvider; /** @@ -10,6 +10,7 @@ * @implNote CompassLang */ public class CompassLang { + public static void init(RegistrateLangProvider provider) { for (var section : GTRegistries.COMPASS_SECTIONS) { provider.add(section.getUnlocalizedKey(), section.lang()); diff --git a/src/main/java/com/gregtechceu/gtceu/data/lang/ConfigurationLang.java b/src/main/java/com/gregtechceu/gtceu/data/lang/ConfigurationLang.java index 7032e1a989..d24677602c 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/lang/ConfigurationLang.java +++ b/src/main/java/com/gregtechceu/gtceu/data/lang/ConfigurationLang.java @@ -2,6 +2,7 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.config.ConfigHolder; + import com.tterrag.registrate.providers.RegistrateLangProvider; import dev.toma.configuration.Configuration; import dev.toma.configuration.config.format.ConfigFormats; @@ -15,7 +16,8 @@ public class ConfigurationLang { public static void init(RegistrateLangProvider provider) { - dfs(provider, new HashSet<>(), Configuration.registerConfig(ConfigHolder.class, ConfigFormats.yaml()).getValueMap()); + dfs(provider, new HashSet<>(), + Configuration.registerConfig(ConfigHolder.class, ConfigFormats.yaml()).getValueMap()); } private static void dfs(RegistrateLangProvider provider, Set added, Map> map) { diff --git a/src/main/java/com/gregtechceu/gtceu/data/lang/IntegrationLang.java b/src/main/java/com/gregtechceu/gtceu/data/lang/IntegrationLang.java index 49a97e9cd7..48ac3f8533 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/lang/IntegrationLang.java +++ b/src/main/java/com/gregtechceu/gtceu/data/lang/IntegrationLang.java @@ -5,6 +5,7 @@ import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.common.data.GTBedrockFluids; import com.gregtechceu.gtceu.common.data.GTOres; + import com.tterrag.registrate.providers.RegistrateLangProvider; public class IntegrationLang { diff --git a/src/main/java/com/gregtechceu/gtceu/data/lang/ItemLang.java b/src/main/java/com/gregtechceu/gtceu/data/lang/ItemLang.java index a85dda5acb..4da1e238d8 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/lang/ItemLang.java +++ b/src/main/java/com/gregtechceu/gtceu/data/lang/ItemLang.java @@ -3,6 +3,7 @@ import com.gregtechceu.gtceu.api.data.tag.TagPrefix; import com.gregtechceu.gtceu.api.item.tool.GTToolType; import com.gregtechceu.gtceu.api.registry.GTRegistries; + import com.tterrag.registrate.providers.RegistrateLangProvider; import static com.gregtechceu.gtceu.data.lang.LangHandler.multilineLang; @@ -41,9 +42,7 @@ private static void initGeneratedNames(RegistrateLangProvider provider) { provider.add("tagprefix.polymer.ingot", "%s Ingot"); } - private static void initItemNames(RegistrateLangProvider provider) { - - } + private static void initItemNames(RegistrateLangProvider provider) {} private static void initItemTooltips(RegistrateLangProvider provider) { provider.add("item.gtceu.copper_credit.tooltip", "§70.125 Credits"); @@ -55,7 +54,8 @@ private static void initItemTooltips(RegistrateLangProvider provider) { provider.add("item.gtceu.naquadah_credit.tooltip", "§732768 Credits"); provider.add("item.gtceu.neutronium_credit.tooltip", "§7262144 Credits"); provider.add("item.gtceu.ancient_gold_coin.tooltip", "§7Found in ancient Ruins"); - provider.add("item.gtceu.doge_coin.tooltip", "§7wow much coin how monyey so cwypto pwz minye v wich vewy cuwwency wow"); + provider.add("item.gtceu.doge_coin.tooltip", + "§7wow much coin how monyey so cwypto pwz minye v wich vewy cuwwency wow"); provider.add("item.gtceu.chocolate_coin.tooltip", "§7Wrapped in Gold"); provider.add("item.gtceu.empty_mold.tooltip", "§7Raw Plate to make Molds and Extrude Shapes"); provider.add("item.gtceu.nano_saber.tooltip", "§7Ryujin no ken wo kurae!"); @@ -70,7 +70,8 @@ private static void initItemTooltips(RegistrateLangProvider provider) { provider.add("item.gtceu.nugget_casting_mold.tooltip", "§7Mold for making Nuggets"); provider.add("item.gtceu.cylinder_casting_mold.tooltip", "§7Mold for shaping Cylinders"); provider.add("item.gtceu.anvil_casting_mold.tooltip", "§7Mold for shaping Anvils"); - provider.add("item.gtceu.name_casting_mold.tooltip", "§7Mold for naming Items in the Forming Press (rename Mold with Anvil)"); + provider.add("item.gtceu.name_casting_mold.tooltip", + "§7Mold for naming Items in the Forming Press (rename Mold with Anvil)"); provider.add("item.gtceu.gear_casting_mold.small.tooltip", "§7Mold for making small Gears"); provider.add("item.gtceu.rotor_casting_mold.tooltip", "§7Mold for making Rotors"); provider.add("item.gtceu.plate_extruder_mold.tooltip", "§7Extruder Shape for making Plates"); @@ -78,7 +79,8 @@ private static void initItemTooltips(RegistrateLangProvider provider) { provider.add("item.gtceu.bolt_extruder_mold.tooltip", "§7Extruder Shape for making Bolts"); provider.add("item.gtceu.ring_extruder_mold.tooltip", "§7Extruder Shape for making Rings"); provider.add("item.gtceu.cell_extruder_mold.tooltip", "§7Extruder Shape for making Cells"); - provider.add("item.gtceu.ingot_extruder_mold.tooltip", "§7Extruder Shape for, wait, can't we just use a Furnace?"); + provider.add("item.gtceu.ingot_extruder_mold.tooltip", + "§7Extruder Shape for, wait, can't we just use a Furnace?"); provider.add("item.gtceu.wire_extruder_mold.tooltip", "§7Extruder Shape for making Wires"); provider.add("item.gtceu.casing_extruder_mold.tooltip", "§7Extruder Shape for making Item Casings"); provider.add("item.gtceu.pipe.tiny_extruder_mold.tooltip", "§7Extruder Shape for making tiny Pipes"); @@ -148,7 +150,8 @@ private static void initItemTooltips(RegistrateLangProvider provider) { provider.add("item.gtceu.data_orb.tooltip", "§7A High Capacity Data Storage"); provider.add("item.gtceu.programmed_circuit.tooltip", "§7Use to open configuration GUI"); provider.add("item.gtceu.circuit.integrated.gui", "§7Programmed Circuit Configuration"); - //multilineLang(provider, "item.gtceu.circuit.integrated.jei_description", "JEI is only showing recipes for the given configuration.\n\nYou can select a configuration in the Programmed Circuit configuration tab."); + // multilineLang(provider, "item.gtceu.circuit.integrated.jei_description", "JEI is only showing recipes for the + // given configuration.\n\nYou can select a configuration in the Programmed Circuit configuration tab."); provider.add("item.glass_lens", "Glass Lens (White)"); // todo move to material overrides provider.add("item.gtceu.silicon_boule.tooltip", "§7Raw Circuit"); provider.add("item.gtceu.phosphorus_boule.tooltip", "§7Raw Circuit"); @@ -170,7 +173,8 @@ private static void initItemTooltips(RegistrateLangProvider provider) { provider.add("item.gtceu.plastic_printed_circuit_board.tooltip", "§7A Good Circuit Board"); provider.add("item.gtceu.epoxy_printed_circuit_board.tooltip", "§7An Advanced Circuit Board"); provider.add("item.gtceu.fiber_reinforced_printed_circuit_board.tooltip", "§7A More Advanced Circuit Board"); - provider.add("item.gtceu.multilayer_fiber_reinforced_printed_circuit_board.tooltip", "§7An Elite Circuit Board"); + provider.add("item.gtceu.multilayer_fiber_reinforced_printed_circuit_board.tooltip", + "§7An Elite Circuit Board"); provider.add("item.gtceu.wetware_printed_circuit_board.tooltip", "§7The Board that keeps life"); multilineLang(provider, "item.gtceu.vacuum_tube.tooltip", "§7Technically a Diode\n§cULV-tier"); provider.add("item.gtceu.diode.tooltip", "§7Basic Electronic Component"); @@ -225,33 +229,56 @@ private static void initItemTooltips(RegistrateLangProvider provider) { provider.add("item.gtceu.ram_chip.tooltip", "§7Random Access Memory"); provider.add("item.gtceu.soc.tooltip", "§7System on Chip"); provider.add("item.gtceu.simple_soc.tooltip", "§7Simple System on Chip"); - multilineLang(provider, "item.gtceu.basic_electronic_circuit.tooltip", "§7Your First Circuit\n§cLV-Tier Circuit"); - multilineLang(provider, "item.gtceu.good_electronic_circuit.tooltip", "§7Your Second Circuit\n§cMV-Tier Circuit"); - multilineLang(provider, "item.gtceu.basic_integrated_circuit.tooltip", "§7Smaller and more powerful\n§6LV-Tier Circuit"); - multilineLang(provider, "item.gtceu.good_integrated_circuit.tooltip", "§7Smaller and more powerful\n§6MV-Tier Circuit"); - multilineLang(provider, "item.gtceu.advanced_integrated_circuit.tooltip", "§7Smaller and more powerful\n§6HV-Tier Circuit"); + multilineLang(provider, "item.gtceu.basic_electronic_circuit.tooltip", + "§7Your First Circuit\n§cLV-Tier Circuit"); + multilineLang(provider, "item.gtceu.good_electronic_circuit.tooltip", + "§7Your Second Circuit\n§cMV-Tier Circuit"); + multilineLang(provider, "item.gtceu.basic_integrated_circuit.tooltip", + "§7Smaller and more powerful\n§6LV-Tier Circuit"); + multilineLang(provider, "item.gtceu.good_integrated_circuit.tooltip", + "§7Smaller and more powerful\n§6MV-Tier Circuit"); + multilineLang(provider, "item.gtceu.advanced_integrated_circuit.tooltip", + "§7Smaller and more powerful\n§6HV-Tier Circuit"); multilineLang(provider, "item.gtceu.nand_chip.tooltip", "§7A Superior Simple Circuit\n§6ULV-Tier Circuit"); - multilineLang(provider, "item.gtceu.microchip_processor.tooltip", "§7A Superior Basic Circuit\n§eLV-Tier Circuit"); - multilineLang(provider, "item.gtceu.micro_processor.tooltip", "§7Amazing Computation Speed!\n§eMV-Tier Circuit"); - multilineLang(provider, "item.gtceu.micro_processor_assembly.tooltip", "§7Amazing Computation Speed!\n§eHV-Tier Circuit"); - multilineLang(provider, "item.gtceu.micro_processor_computer.tooltip", "§7Amazing Computation Speed!\n§eEV-Tier Circuit"); - multilineLang(provider, "item.gtceu.micro_processor_mainframe.tooltip", "§7Amazing Computation Speed!\n§eIV-Tier Circuit"); + multilineLang(provider, "item.gtceu.microchip_processor.tooltip", + "§7A Superior Basic Circuit\n§eLV-Tier Circuit"); + multilineLang(provider, "item.gtceu.micro_processor.tooltip", + "§7Amazing Computation Speed!\n§eMV-Tier Circuit"); + multilineLang(provider, "item.gtceu.micro_processor_assembly.tooltip", + "§7Amazing Computation Speed!\n§eHV-Tier Circuit"); + multilineLang(provider, "item.gtceu.micro_processor_computer.tooltip", + "§7Amazing Computation Speed!\n§eEV-Tier Circuit"); + multilineLang(provider, "item.gtceu.micro_processor_mainframe.tooltip", + "§7Amazing Computation Speed!\n§eIV-Tier Circuit"); multilineLang(provider, "item.gtceu.nano_processor.tooltip", "§7Smaller than ever\n§bHV-Tier Circuit"); multilineLang(provider, "item.gtceu.nano_processor_assembly.tooltip", "§7Smaller than ever\n§bEV-Tier Circuit"); multilineLang(provider, "item.gtceu.nano_processor_computer.tooltip", "§7Smaller than ever\n§bIV-Tier Circuit"); - multilineLang(provider, "item.gtceu.nano_processor_mainframe.tooltip", "§7Smaller than ever\n§bLuV-Tier Circuit"); - multilineLang(provider, "item.gtceu.quantum_processor.tooltip", "§7Quantum Computing comes to life!\n§aEV-Tier Circuit"); - multilineLang(provider, "item.gtceu.quantum_processor_assembly.tooltip", "§7Quantum Computing comes to life!\n§aIV-Tier Circuit"); - multilineLang(provider, "item.gtceu.quantum_processor_computer.tooltip", "§7Quantum Computing comes to life!\n§aLuV-Tier Circuit"); - multilineLang(provider, "item.gtceu.quantum_processor_mainframe.tooltip", "§7Quantum Computing comes to life!\n§aZPM-Tier Circuit"); - multilineLang(provider, "item.gtceu.crystal_processor.tooltip", "§7Taking Advantage of Crystal Engraving\n§9IV-Tier Circuit"); - multilineLang(provider, "item.gtceu.crystal_processor_assembly.tooltip", "§7Taking Advantage of Crystal Engraving\n§9LuV-Tier Circuit"); - multilineLang(provider, "item.gtceu.crystal_processor_computer.tooltip", "§7Taking Advantage of Crystal Engraving\n§9ZPM-Tier Circuit"); - multilineLang(provider, "item.gtceu.crystal_processor_mainframe.tooltip", "§7Taking Advantage of Crystal Engraving\n§9UV-Tier Circuit"); - multilineLang(provider, "item.gtceu.wetware_processor.tooltip", "§7You have a feeling like it's watching you\n§4LuV-Tier Circuit"); - multilineLang(provider, "item.gtceu.wetware_processor_assembly.tooltip", "§7Can run Minecraft\n§4ZPM-tier Circuit"); - multilineLang(provider, "item.gtceu.wetware_processor_computer.tooltip", "§7Ultimate fusion of Flesh and Machine\n§4UV-Tier Circuit"); - multilineLang(provider, "item.gtceu.wetware_processor_mainframe.tooltip", "§7The best Man has ever seen\n§4UHV-Tier Circuit"); + multilineLang(provider, "item.gtceu.nano_processor_mainframe.tooltip", + "§7Smaller than ever\n§bLuV-Tier Circuit"); + multilineLang(provider, "item.gtceu.quantum_processor.tooltip", + "§7Quantum Computing comes to life!\n§aEV-Tier Circuit"); + multilineLang(provider, "item.gtceu.quantum_processor_assembly.tooltip", + "§7Quantum Computing comes to life!\n§aIV-Tier Circuit"); + multilineLang(provider, "item.gtceu.quantum_processor_computer.tooltip", + "§7Quantum Computing comes to life!\n§aLuV-Tier Circuit"); + multilineLang(provider, "item.gtceu.quantum_processor_mainframe.tooltip", + "§7Quantum Computing comes to life!\n§aZPM-Tier Circuit"); + multilineLang(provider, "item.gtceu.crystal_processor.tooltip", + "§7Taking Advantage of Crystal Engraving\n§9IV-Tier Circuit"); + multilineLang(provider, "item.gtceu.crystal_processor_assembly.tooltip", + "§7Taking Advantage of Crystal Engraving\n§9LuV-Tier Circuit"); + multilineLang(provider, "item.gtceu.crystal_processor_computer.tooltip", + "§7Taking Advantage of Crystal Engraving\n§9ZPM-Tier Circuit"); + multilineLang(provider, "item.gtceu.crystal_processor_mainframe.tooltip", + "§7Taking Advantage of Crystal Engraving\n§9UV-Tier Circuit"); + multilineLang(provider, "item.gtceu.wetware_processor.tooltip", + "§7You have a feeling like it's watching you\n§4LuV-Tier Circuit"); + multilineLang(provider, "item.gtceu.wetware_processor_assembly.tooltip", + "§7Can run Minecraft\n§4ZPM-tier Circuit"); + multilineLang(provider, "item.gtceu.wetware_processor_computer.tooltip", + "§7Ultimate fusion of Flesh and Machine\n§4UV-Tier Circuit"); + multilineLang(provider, "item.gtceu.wetware_processor_mainframe.tooltip", + "§7The best Man has ever seen\n§4UHV-Tier Circuit"); provider.add("item.gtceu.stem_cells.tooltip", "§7Raw Intelligence"); provider.add("item.gtceu.neuro_processing_unit.tooltip", "§7Neuro CPU"); provider.add("item.gtceu.petri_dish.tooltip", "§7For cultivating Cells"); @@ -260,35 +287,58 @@ private static void initItemTooltips(RegistrateLangProvider provider) { provider.add("item.gtceu.quantum_eye.tooltip", "§7Improved Ender Eye"); provider.add("item.gtceu.quantum_star.tooltip", "§7Improved Nether Star"); provider.add("item.gtceu.gravi_star.tooltip", "§7Ultimate Nether Star"); - multilineLang(provider, "item.gtceu.item_filter.tooltip", "§7Filters §fItem§7 I/O as §fCover§7.\nCan be used as a §fConveyor Module§7 and §fRobotic Arm§7 upgrade."); - multilineLang(provider, "item.gtceu.item_tag_filter.tooltip", "§7Filters §fItem§7 I/O with §fItem Tags§7 as §fCover§7.\nCan be used as a §fConveyor Module§7 and §fRobotic Arm§7 upgrade."); - multilineLang(provider, "item.gtceu.ore_dictionary_filter.tooltip", "§7Filters §fItem§7 I/O with §fOre Dictionary§7 as §fCover§7.\nCan be used as a §fConveyor Module§7 and §fRobotic Arm§7 upgrade."); - multilineLang(provider, "item.gtceu.fluid_filter.tooltip", "§7Filters §fFluid§7 I/O as §fCover§7.\nCan be used as an §fElectric Pump§7 and §fFluid Regulator§7 upgrade."); - multilineLang(provider, "item.gtceu.fluid_tag_filter.tooltip", "§7Filters §fFluid§7 I/O with §fFluid Tags§7 as §fCover§7.\nCan be used as an §fElectric Pump§7 and §fFluid Regulator§7 upgrade."); - multilineLang(provider, "item.gtceu.smart_item_filter.tooltip", "§7Filters §fItem§7 I/O with §fMachine Recipes§7 as §fCover§7.\nCan be used as a §fConveyor Module§7 and §fRobotic Arm§7 upgrade."); + multilineLang(provider, "item.gtceu.item_filter.tooltip", + "§7Filters §fItem§7 I/O as §fCover§7.\nCan be used as a §fConveyor Module§7 and §fRobotic Arm§7 upgrade."); + multilineLang(provider, "item.gtceu.item_tag_filter.tooltip", + "§7Filters §fItem§7 I/O with §fItem Tags§7 as §fCover§7.\nCan be used as a §fConveyor Module§7 and §fRobotic Arm§7 upgrade."); + multilineLang(provider, "item.gtceu.ore_dictionary_filter.tooltip", + "§7Filters §fItem§7 I/O with §fOre Dictionary§7 as §fCover§7.\nCan be used as a §fConveyor Module§7 and §fRobotic Arm§7 upgrade."); + multilineLang(provider, "item.gtceu.fluid_filter.tooltip", + "§7Filters §fFluid§7 I/O as §fCover§7.\nCan be used as an §fElectric Pump§7 and §fFluid Regulator§7 upgrade."); + multilineLang(provider, "item.gtceu.fluid_tag_filter.tooltip", + "§7Filters §fFluid§7 I/O with §fFluid Tags§7 as §fCover§7.\nCan be used as an §fElectric Pump§7 and §fFluid Regulator§7 upgrade."); + multilineLang(provider, "item.gtceu.smart_item_filter.tooltip", + "§7Filters §fItem§7 I/O with §fMachine Recipes§7 as §fCover§7.\nCan be used as a §fConveyor Module§7 and §fRobotic Arm§7 upgrade."); provider.add("item.gtceu.machine_controller.tooltip", "§7Turns Machines §fON/OFF§7 as §fCover§7."); - provider.add("item.gtceu.activity_detector_cover.tooltip", "§7Gives out §fActivity Status§7 as Redstone as §fCover§7."); - provider.add("item.gtceu.advanced_activity_detector_cover.tooltip", "§7Gives out §fMachine Progress§7 as Redstone as §fCover§7."); - provider.add("item.gtceu.fluid_detector_cover.tooltip", "§7Gives out §fFluid Amount§7 as Redstone as §fCover§7."); - provider.add("item.gtceu.advanced_fluid_detector_cover.tooltip", "§7Gives §fRS-Latch§7 controlled §fFluid Storage Status§7 as Redstone as §fCover§7."); + provider.add("item.gtceu.activity_detector_cover.tooltip", + "§7Gives out §fActivity Status§7 as Redstone as §fCover§7."); + provider.add("item.gtceu.advanced_activity_detector_cover.tooltip", + "§7Gives out §fMachine Progress§7 as Redstone as §fCover§7."); + provider.add("item.gtceu.fluid_detector_cover.tooltip", + "§7Gives out §fFluid Amount§7 as Redstone as §fCover§7."); + provider.add("item.gtceu.advanced_fluid_detector_cover.tooltip", + "§7Gives §fRS-Latch§7 controlled §fFluid Storage Status§7 as Redstone as §fCover§7."); provider.add("item.gtceu.item_detector_cover.tooltip", "§7Gives out §fItem Amount§7 as Redstone as §fCover§7."); - provider.add("item.gtceu.advanced_item_detector_cover.tooltip", "§7Gives §fRS-Latch§7 controlled §fItem Storage Status§7 as Redstone as §fCover§7."); - provider.add("item.gtceu.energy_detector_cover.tooltip", "§7Gives out §fEnergy Amount§7 as Redstone as §fCover§7."); - provider.add("item.gtceu.advanced_energy_detector_cover.tooltip", "§7Gives §fRS-Latch§7 controlled §fEnergy Status§7 as Redstone as §fCover§7."); - multilineLang(provider, "item.gtceu.fluid_voiding_cover.tooltip", "§7Voids §fFluids§7 as §fCover§7.\nActivate with §fSoft Mallet§7 after placement."); - multilineLang(provider, "item.gtceu.advanced_fluid_voiding_cover.tooltip", "§7Voids §fFluids§7 with amount control as §fCover§7.\nActivate with §fSoft Mallet§7 after placement."); - multilineLang(provider, "item.gtceu.item_voiding_cover.tooltip", "§7Voids §fItems§7 as §fCover§7.\nActivate with §fSoft Mallet§7 after placement."); - multilineLang(provider, "item.gtceu.advanced_item_voiding_cover.tooltip", "§7Voids §fItems§7 with amount control as §fCover§7.\nActivate with §fSoft Mallet§7 after placement."); + provider.add("item.gtceu.advanced_item_detector_cover.tooltip", + "§7Gives §fRS-Latch§7 controlled §fItem Storage Status§7 as Redstone as §fCover§7."); + provider.add("item.gtceu.energy_detector_cover.tooltip", + "§7Gives out §fEnergy Amount§7 as Redstone as §fCover§7."); + provider.add("item.gtceu.advanced_energy_detector_cover.tooltip", + "§7Gives §fRS-Latch§7 controlled §fEnergy Status§7 as Redstone as §fCover§7."); + multilineLang(provider, "item.gtceu.fluid_voiding_cover.tooltip", + "§7Voids §fFluids§7 as §fCover§7.\nActivate with §fSoft Mallet§7 after placement."); + multilineLang(provider, "item.gtceu.advanced_fluid_voiding_cover.tooltip", + "§7Voids §fFluids§7 with amount control as §fCover§7.\nActivate with §fSoft Mallet§7 after placement."); + multilineLang(provider, "item.gtceu.item_voiding_cover.tooltip", + "§7Voids §fItems§7 as §fCover§7.\nActivate with §fSoft Mallet§7 after placement."); + multilineLang(provider, "item.gtceu.advanced_item_voiding_cover.tooltip", + "§7Voids §fItems§7 with amount control as §fCover§7.\nActivate with §fSoft Mallet§7 after placement."); provider.add("item.gtceu.facade_cover.tooltip", "§7Decorative Outfit §fCover§7."); provider.add("item.gtceu.computer_monitor_cover.tooltip", "§7Displays §fData§7 as §fCover§7."); provider.add("item.gtceu.crafting_table_cover.tooltip", "§fAdvanced Workbench§7 on a Machine as §fCover§7."); - provider.add("item.gtceu.shutter_module_cover.tooltip", "§fBlocks Transfer§7 through attached Side as §fCover§7."); - multilineLang(provider, "item.gtceu.solar_panel.tooltip", "§7May the Sun be with you.\nProduces §fEnergy§7 from the §eSun§7 as §fCover§7."); - provider.add("item.gtceu.infinite_water_cover.tooltip", "§7Fills attached containers with §9Water§7 as §fCover§7."); - provider.add("item.gtceu.ender_fluid_link_cover.tooltip", "§7Transports §fFluids§7 with a §fWireless §dEnder§f Connection§7 as §fCover§7."); + provider.add("item.gtceu.shutter_module_cover.tooltip", + "§fBlocks Transfer§7 through attached Side as §fCover§7."); + multilineLang(provider, "item.gtceu.solar_panel.tooltip", + "§7May the Sun be with you.\nProduces §fEnergy§7 from the §eSun§7 as §fCover§7."); + provider.add("item.gtceu.infinite_water_cover.tooltip", + "§7Fills attached containers with §9Water§7 as §fCover§7."); + provider.add("item.gtceu.ender_fluid_link_cover.tooltip", + "§7Transports §fFluids§7 with a §fWireless §dEnder§f Connection§7 as §fCover§7."); provider.add("item.gtceu.gelled_toluene.tooltip", "§7Raw Explosive"); - provider.add("item.gtceu.bottle.purple.drink.tooltip", "§7How about Lemonade. Or some Ice Tea? I got Purple Drink!"); - multilineLang(provider, "item.gtceu.foam_sprayer.tooltip", "§7Sprays Construction Foam\nUse on a frame to foam connected frames\nFoam can be colored"); + provider.add("item.gtceu.bottle.purple.drink.tooltip", + "§7How about Lemonade. Or some Ice Tea? I got Purple Drink!"); + multilineLang(provider, "item.gtceu.foam_sprayer.tooltip", + "§7Sprays Construction Foam\nUse on a frame to foam connected frames\nFoam can be colored"); provider.add("item.gtceu.firebrick.tooltip", "§7Heat resistant"); provider.add("item.gtceu.sus_record.desc", "sussy!"); diff --git a/src/main/java/com/gregtechceu/gtceu/data/lang/LangHandler.java b/src/main/java/com/gregtechceu/gtceu/data/lang/LangHandler.java index 1c352b0bf1..0e5003de7d 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/lang/LangHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/data/lang/LangHandler.java @@ -2,11 +2,14 @@ import com.gregtechceu.gtceu.common.data.GTBlocks; import com.gregtechceu.gtceu.common.data.GTMaterials; + import com.lowdragmc.lowdraglib.utils.LocalizationUtils; -import com.tterrag.registrate.providers.RegistrateLangProvider; + import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraftforge.common.data.LanguageProvider; + +import com.tterrag.registrate.providers.RegistrateLangProvider; import org.jetbrains.annotations.NotNull; import java.lang.reflect.Field; @@ -25,7 +28,6 @@ public class LangHandler { public static void init(RegistrateLangProvider provider) { - AdvancementLang.init(provider); BlockLang.init(provider); IntegrationLang.init(provider); @@ -42,13 +44,13 @@ public static void init(RegistrateLangProvider provider) { provider.add("ldlib.gui.editor.register.editor.gtceu.template_tab", "templates"); provider.add("curios.identifier.gtceu_magnet", "GTCEu Magnet"); - //capabilities + // capabilities provider.add("recipe.capability.eu.name", "GTCEu Energy"); provider.add("recipe.capability.fluid.name", "Fluid"); provider.add("recipe.capability.item.name", "Item"); provider.add("recipe.capability.su.name", "Create Stress"); multiLang(provider, "gtceu.oc.tooltip", "Min: %s", "Left click to increase the OC", - "Right click to decrease the OC", "Middle click to reset the OC", "Hold Shift to change by Perfect OC"); + "Right click to decrease the OC", "Middle click to reset the OC", "Hold Shift to change by Perfect OC"); provider.add("recipe.condition.rpm.tooltip", "RPM: %d"); provider.add("recipe.condition.thunder.tooltip", "Thunder Level: %d"); @@ -91,7 +93,6 @@ public static void init(RegistrateLangProvider provider) { provider.add("gtceu.mode.item", "§6Item§r"); provider.add("gtceu.mode.both", "§dBoth (Fluid And Item)§r"); - provider.add("gtceu.tool.class.sword", "Sword"); provider.add("gtceu.tool.class.pickaxe", "Pickaxe"); provider.add("gtceu.tool.class.shovel", "Shovel"); @@ -122,7 +123,12 @@ public static void init(RegistrateLangProvider provider) { provider.add("gtceu.hazard.inhalation_poison", "§2Poisonous when inhaled"); provider.add("gtceu.hazard.corrosive", "§6Corrosive"); provider.add("gtceu.hazard.radioactive", "§eRadioactive"); - + provider.add("gtceu.hazard.none", "§2Not Dangerous"); + provider.add("gtceu.hazard.antidote.description", "§aAntidote §7Hold Shift to show details"); + provider.add("gtceu.hazard.antidote.description_shift", "§aCures types:"); + provider.add("gtceu.hazard.antidote.description.effect_removed", "Removes %s%% of current ailments' effects"); + provider.add("gtceu.hazard.antidote.description.effect_removed.all", + "Removes all of current ailments' effects"); provider.add("item.gtceu.tool.replace_tool_head", "Craft with a new Tool Head to replace it"); provider.add("item.gtceu.tool.usable_as", "§8Usable as: §f%s"); @@ -199,14 +205,16 @@ public static void init(RegistrateLangProvider provider) { provider.add("item.gtceu.tool.tooltip.mining_speed", "%s §dMining Speed"); provider.add("item.gtceu.tool.tooltip.harvest_level", "§eHarvest Level %s"); provider.add("item.gtceu.tool.tooltip.harvest_level_extra", "§eHarvest Level %s §f(%s§f)"); - multiLang(provider, "item.gtceu.tool.harvest_level", "§8Wood", "§7Stone", "§aIron", "§bDiamond", "§dNetherite", "§9Duranium", "§cNeutronium"); + multiLang(provider, "item.gtceu.tool.harvest_level", "§8Wood", "§7Stone", "§aIron", "§bDiamond", "§dNetherite", + "§9Duranium", "§cNeutronium"); provider.add("item.gtceu.tool.tooltip.repair_info", "§8Hold SHIFT to show Repair Info"); provider.add("item.gtceu.tool.tooltip.repair_material", "§8Repair with: §f§a%s"); provider.add("item.gtceu.tool.aoe.rows", "Rows"); provider.add("item.gtceu.tool.aoe.columns", "Columns"); provider.add("item.gtceu.tool.aoe.layers", "Layers"); provider.add("item.gtceu.turbine_rotor.tooltip", "Turbine Rotors for your power station"); - provider.add("metaitem.clipboard.tooltip", "Can be written on (without any writing Instrument). Right-click on Wall to place, and Shift-Right-Click to remove"); + provider.add("metaitem.clipboard.tooltip", + "Can be written on (without any writing Instrument). Right-click on Wall to place, and Shift-Right-Click to remove"); provider.add("metaitem.behavior.mode_switch.tooltip", "Use while sneaking to switch mode"); provider.add("metaitem.behavior.mode_switch.mode_switched", "§eMode Set to: %s"); provider.add("metaitem.behavior.mode_switch.current_mode", "Mode: %s"); @@ -273,16 +281,20 @@ public static void init(RegistrateLangProvider provider) { provider.add("item.gtceu.blacklight.tooltip", "Long-Wave §dUltraviolet§7 light source"); provider.add("gui.widget.incrementButton.default_tooltip", "Hold Shift, Ctrl or both to change the amount"); provider.add("gui.widget.recipeProgressWidget.default_tooltip", "Show Recipes"); - multilineLang(provider, "gtceu.recipe_memory_widget.tooltip", "§7Left click to automatically input this recipe into the crafting grid\n§7Shift click to lock/unlock this recipe"); + multilineLang(provider, "gtceu.recipe_memory_widget.tooltip", + "§7Left click to automatically input this recipe into the crafting grid\n§7Shift click to lock/unlock this recipe"); provider.add("cover.filter.blacklist.disabled", "Whitelist"); provider.add("cover.filter.blacklist.enabled", "Blacklist"); provider.add("cover.ore_dictionary_filter.title", "Ore Dictionary Filter"); - multilineLang(provider, "cover.ore_dictionary_filter.info", "§bAccepts complex expressions\n& = AND\n| = OR\n^ = XOR\n! = NOT\n( ) for priority\n* for wildcard\n§bExample:\n§6dust*Gold | (plate* & !*Double*)\nWill match all gold dusts of all sizes or all plates, but not double plates"); - provider.add("cover.ore_dictionary_filter.test_slot.info", "Insert a item to test if it matches the filter expression"); + multilineLang(provider, "cover.ore_dictionary_filter.info", + "§bAccepts complex expressions\n& = AND\n| = OR\n^ = XOR\n! = NOT\n( ) for priority\n* for wildcard\n§bExample:\n§6dust*Gold | (plate* & !*Double*)\nWill match all gold dusts of all sizes or all plates, but not double plates"); + provider.add("cover.ore_dictionary_filter.test_slot.info", + "Insert a item to test if it matches the filter expression"); provider.add("cover.ore_dictionary_filter.matches", "Item matches"); provider.add("cover.ore_dictionary_filter.matches_not", "Item does not match"); provider.add("cover.fluid_filter.title", "Fluid Filter"); - multilineLang(provider, "cover.fluid_filter.config_amount", "Scroll wheel up increases amount, down decreases.\nShift[§6x10§r],Ctrl[§ex100§r],Shift+Ctrl[§ax1000§r]\nRight click increases amount, left click decreases.\nHold shift to double/halve.\nMiddle click to clear"); + multilineLang(provider, "cover.fluid_filter.config_amount", + "Scroll wheel up increases amount, down decreases.\nShift[§6x10§r],Ctrl[§ex100§r],Shift+Ctrl[§ax1000§r]\nRight click increases amount, left click decreases.\nHold shift to double/halve.\nMiddle click to clear"); provider.add("cover.fluid_filter.mode.filter_fill", "Filter Fill"); provider.add("cover.fluid_filter.mode.filter_drain", "Filter Drain"); provider.add("cover.fluid_filter.mode.filter_both", "Filter Fill & Drain"); @@ -296,42 +308,55 @@ public static void init(RegistrateLangProvider provider) { provider.add("cover.item_filter.ignore_nbt.disabled", "Respect NBT"); provider.add("cover.voiding.voiding_mode.void_any", "Void Matching"); provider.add("cover.voiding.voiding_mode.void_overflow", "Void Overflow"); - multilineLang(provider, "cover.voiding.voiding_mode.description", "§eVoid Matching§r will void anything matching the filter. \n§eVoid Overflow§r will void anything matching the filter, up to the specified amount."); + multilineLang(provider, "cover.voiding.voiding_mode.description", + "§eVoid Matching§r will void anything matching the filter. \n§eVoid Overflow§r will void anything matching the filter, up to the specified amount."); provider.add("cover.fluid.voiding.title", "Fluid Voiding Settings"); provider.add("cover.fluid.voiding.advanced.title", "Advanced Fluid Voiding Settings"); provider.add("cover.item.voiding.title", "Item Voiding Settings"); provider.add("cover.item.voiding.advanced.title", "Advanced Item Voiding Settings"); provider.add("cover.voiding.label.disabled", "Disabled"); provider.add("cover.voiding.label.enabled", "Enabled"); - provider.add("cover.voiding.tooltip", "§cWARNING!§7 Setting this to \"Enabled\" means that fluids or items WILL be voided."); + provider.add("cover.voiding.tooltip", + "§cWARNING!§7 Setting this to \"Enabled\" means that fluids or items WILL be voided."); provider.add("cover.voiding.message.disabled", "Voiding Cover Disabled"); provider.add("cover.voiding.message.enabled", "Voiding Cover Enabled"); provider.add("cover.smart_item_filter.title", "Smart Item Filter"); provider.add("cover.smart_item_filter.filtering_mode.electrolyzer", "Electrolyzer"); provider.add("cover.smart_item_filter.filtering_mode.centrifuge", "Centrifuge"); provider.add("cover.smart_item_filter.filtering_mode.sifter", "Sifter"); - multilineLang(provider, "cover.smart_item_filter.filtering_mode.description", "Select Machine this Smart Filter will use for filtering.\nIt will automatically pick right portions of items for robotic arm."); + multilineLang(provider, "cover.smart_item_filter.filtering_mode.description", + "Select Machine this Smart Filter will use for filtering.\nIt will automatically pick right portions of items for robotic arm."); provider.add("cover.conveyor.title", "Conveyor Cover Settings (%s)"); provider.add("cover.conveyor.transfer_rate", "§7items/sec"); provider.add("cover.conveyor.mode", "Mode: %s"); provider.add("cover.conveyor.mode.export", "Mode: Export"); provider.add("cover.conveyor.mode.import", "Mode: Import"); - multilineLang(provider, "cover.conveyor.distribution.round_robin_global", "Distribution Mode: §bRound Robin\n§7Splits items equally across connected inventories"); - multilineLang(provider, "cover.conveyor.distribution.round_robin_prio", "Distribution Mode: §bRound Robin with Priority\n§7Tries to split items across connected inventories and considers higher priorities first.\n§7Restrictive item pipes lower the priority of a path."); - multilineLang(provider, "cover.conveyor.distribution.insert_first", "Distribution Mode: §bPriority\n§7Will insert into the first inventory with the highest priority it can find.\n§7Restrictive item pipes lower the priority of a path."); - multilineLang(provider, "cover.conveyor.blocks_input.enabled", "If enabled, items will not be inserted when cover is set to pull items from the inventory into pipe.\n§aEnabled"); - multilineLang(provider, "cover.conveyor.blocks_input.disabled", "If enabled, items will not be inserted when cover is set to pull items from the inventory into pipe.\n§cDisabled"); - provider.add("cover.universal.manual_import_export.mode.disabled", "Manual I/O: §bDisabled\n§7Items / Fluids will only move as specified by the cover and its filter."); - provider.add("cover.universal.manual_import_export.mode.filtered", "Manual I/O: §bFiltered\n§7Items / Fluids can be extracted and inserted independently of the cover mode, as long as its filter matches (if any)"); - provider.add("cover.universal.manual_import_export.mode.unfiltered", "Manual I/O: §bUnfiltered\n§7Items / Fluids can be moved independently of the cover mode. The filter only applies to what is inserted or extracted by this cover itself."); - multilineLang(provider, "cover.universal.manual_import_export.mode.description", "§eDisabled§r - Items/fluids will only move as specified by the cover and its filter. \n§eAllow Filtered§r - Items/fluids can be extracted and inserted independently of the cover mode, as long as its filter matches (if any). \n§eAllow Unfiltered§r - Items/fluids can be moved independently of the cover mode. Filter applies to the items inserted or extracted by this cover"); + multilineLang(provider, "cover.conveyor.distribution.round_robin_global", + "Distribution Mode: §bRound Robin\n§7Splits items equally across connected inventories"); + multilineLang(provider, "cover.conveyor.distribution.round_robin_prio", + "Distribution Mode: §bRound Robin with Priority\n§7Tries to split items across connected inventories and considers higher priorities first.\n§7Restrictive item pipes lower the priority of a path."); + multilineLang(provider, "cover.conveyor.distribution.insert_first", + "Distribution Mode: §bPriority\n§7Will insert into the first inventory with the highest priority it can find.\n§7Restrictive item pipes lower the priority of a path."); + multilineLang(provider, "cover.conveyor.blocks_input.enabled", + "If enabled, items will not be inserted when cover is set to pull items from the inventory into pipe.\n§aEnabled"); + multilineLang(provider, "cover.conveyor.blocks_input.disabled", + "If enabled, items will not be inserted when cover is set to pull items from the inventory into pipe.\n§cDisabled"); + provider.add("cover.universal.manual_import_export.mode.disabled", + "Manual I/O: §bDisabled\n§7Items / Fluids will only move as specified by the cover and its filter."); + provider.add("cover.universal.manual_import_export.mode.filtered", + "Manual I/O: §bFiltered\n§7Items / Fluids can be extracted and inserted independently of the cover mode, as long as its filter matches (if any)"); + provider.add("cover.universal.manual_import_export.mode.unfiltered", + "Manual I/O: §bUnfiltered\n§7Items / Fluids can be moved independently of the cover mode. The filter only applies to what is inserted or extracted by this cover itself."); + multilineLang(provider, "cover.universal.manual_import_export.mode.description", + "§eDisabled§r - Items/fluids will only move as specified by the cover and its filter. \n§eAllow Filtered§r - Items/fluids can be extracted and inserted independently of the cover mode, as long as its filter matches (if any). \n§eAllow Unfiltered§r - Items/fluids can be moved independently of the cover mode. Filter applies to the items inserted or extracted by this cover"); provider.add("cover.conveyor.item_filter.title", "Item Filter"); multiLang(provider, "cover.conveyor.ore_dictionary.title", "Ore Dictionary Name", "(use * for wildcard)"); provider.add("cover.robotic_arm.title", "Robotic Arm Settings (%s)"); provider.add("cover.robotic_arm.transfer_mode.transfer_any", "Transfer Any"); provider.add("cover.robotic_arm.transfer_mode.transfer_exact", "Supply Exact"); provider.add("cover.robotic_arm.transfer_mode.keep_exact", "Keep Exact"); - multilineLang(provider, "cover.robotic_arm.transfer_mode.description", "§eTransfer Any§r - in this mode, cover will transfer as many items matching its filter as possible.\n§eSupply Exact§r - in this mode, cover will supply items in portions specified in item filter slots (or variable under this button for ore dictionary filter). If amount of items is less than portion size, items won't be moved.\n§eKeep Exact§r - in this mode, cover will keep specified amount of items in the destination inventory, supplying additional amount of items if required.\n§7Tip: left/right click on filter slots to change item amount, use shift clicking to change amount faster."); + multilineLang(provider, "cover.robotic_arm.transfer_mode.description", + "§eTransfer Any§r - in this mode, cover will transfer as many items matching its filter as possible.\n§eSupply Exact§r - in this mode, cover will supply items in portions specified in item filter slots (or variable under this button for ore dictionary filter). If amount of items is less than portion size, items won't be moved.\n§eKeep Exact§r - in this mode, cover will keep specified amount of items in the destination inventory, supplying additional amount of items if required.\n§7Tip: left/right click on filter slots to change item amount, use shift clicking to change amount faster."); provider.add("cover.pump.title", "Pump Cover Settings (%s)"); provider.add("cover.pump.transfer_rate", "%s"); provider.add("cover.pump.mode.export", "Mode: Export"); @@ -340,14 +365,17 @@ public static void init(RegistrateLangProvider provider) { provider.add("cover.bucket.mode.bucket", "kL"); provider.add("cover.bucket.mode.milli_bucket", "L"); provider.add("cover.fluid_regulator.title", "Fluid Regulator Settings (%s)"); - multilineLang(provider, "cover.fluid_regulator.transfer_mode.description", "§eTransfer Any§r - in this mode, cover will transfer as many fluids matching its filter as possible.\n§eSupply Exact§r - in this mode, cover will supply fluids in portions specified in the window underneath this button. If amount of fluids is less than portion size, fluids won't be moved.\n§eKeep Exact§r - in this mode, cover will keep specified amount of fluids in the destination inventory, supplying additional amount of fluids if required.\n§7Tip: shift click will multiply increase/decrease amounts by 10 and ctrl click will multiply by 100."); + multilineLang(provider, "cover.fluid_regulator.transfer_mode.description", + "§eTransfer Any§r - in this mode, cover will transfer as many fluids matching its filter as possible.\n§eSupply Exact§r - in this mode, cover will supply fluids in portions specified in the window underneath this button. If amount of fluids is less than portion size, fluids won't be moved.\n§eKeep Exact§r - in this mode, cover will keep specified amount of fluids in the destination inventory, supplying additional amount of fluids if required.\n§7Tip: shift click will multiply increase/decrease amounts by 10 and ctrl click will multiply by 100."); provider.add("cover.fluid_regulator.supply_exact", "Supply Exact: %s"); provider.add("cover.fluid_regulator.keep_exact", "Keep Exact: %s"); provider.add("cover.machine_controller.title", "Machine Controller Settings"); provider.add("cover.machine_controller.normal", "Normal"); provider.add("cover.machine_controller.inverted", "Inverted"); - multilineLang(provider, "cover.machine_controller.invert.enabled", "§eInverted§r - in this mode, the cover will require a signal stronger than the set redstone level to run"); - multilineLang(provider, "cover.machine_controller.invert.disabled", "§eNormal§r - in this mode, the cover will require a signal weaker than the set redstone level to run"); + multilineLang(provider, "cover.machine_controller.invert.enabled", + "§eInverted§r - in this mode, the cover will require a signal stronger than the set redstone level to run"); + multilineLang(provider, "cover.machine_controller.invert.disabled", + "§eNormal§r - in this mode, the cover will require a signal weaker than the set redstone level to run"); provider.add("cover.machine_controller.redstone", "Min Redstone Strength: %d"); provider.add("cover.machine_controller.mode.machine", "Control Machine"); provider.add("cover.machine_controller.mode.cover_up", "Control Cover (Top)"); @@ -359,9 +387,11 @@ public static void init(RegistrateLangProvider provider) { provider.add("cover.ender_fluid_link.title", "Ender Fluid Link"); provider.add("cover.ender_fluid_link.iomode.enabled", "I/O Enabled"); provider.add("cover.ender_fluid_link.iomode.disabled", "I/O Disabled"); - multilineLang(provider, "cover.ender_fluid_link.private.tooltip.disabled", "Switch to private tank mode\nPrivate mode uses the player who originally placed the cover"); + multilineLang(provider, "cover.ender_fluid_link.private.tooltip.disabled", + "Switch to private tank mode\nPrivate mode uses the player who originally placed the cover"); provider.add("cover.ender_fluid_link.private.tooltip.enabled", "Switch to public tank mode"); - multilineLang(provider, "cover.ender_fluid_link.incomplete_hex", "Inputted color is incomplete!\nIt will be applied once complete (all 8 hex digits)\nClosing the gui will lose edits!"); + multilineLang(provider, "cover.ender_fluid_link.incomplete_hex", + "Inputted color is incomplete!\nIt will be applied once complete (all 8 hex digits)\nClosing the gui will lose edits!"); provider.add("cover.detector_base.message_normal_state", "Monitoring Status: Normal"); provider.add("cover.detector_base.message_inverted_state", "Monitoring Status: Inverted"); @@ -370,29 +400,37 @@ public static void init(RegistrateLangProvider provider) { provider.add("cover.advanced_energy_detector.max", "Max"); var advancedEnergyDetectorInvertDescription = "Toggle to invert the redstone logic\nBy default, redstone is emitted when less than the minimum EU, and stops emitting when greater than the max EU"; - multilineLang(provider, "cover.advanced_energy_detector.invert.enabled", "Output: Inverted\n\n" + advancedEnergyDetectorInvertDescription); - multilineLang(provider, "cover.advanced_energy_detector.invert.disabled", "Output: Normal\n\n" + advancedEnergyDetectorInvertDescription); + multilineLang(provider, "cover.advanced_energy_detector.invert.enabled", + "Output: Inverted\n\n" + advancedEnergyDetectorInvertDescription); + multilineLang(provider, "cover.advanced_energy_detector.invert.disabled", + "Output: Normal\n\n" + advancedEnergyDetectorInvertDescription); var advancedEnergyDetectorModeDescription = "Change between using discrete EU values or percentages for comparing min/max against an attached energy storage."; - multilineLang(provider, "cover.advanced_energy_detector.use_percent.enabled", "Mode: Percentage\n\n" + advancedEnergyDetectorModeDescription); - multilineLang(provider, "cover.advanced_energy_detector.use_percent.disabled", "Mode: Discrete EU\n\n" + advancedEnergyDetectorModeDescription); + multilineLang(provider, "cover.advanced_energy_detector.use_percent.enabled", + "Mode: Percentage\n\n" + advancedEnergyDetectorModeDescription); + multilineLang(provider, "cover.advanced_energy_detector.use_percent.disabled", + "Mode: Discrete EU\n\n" + advancedEnergyDetectorModeDescription); provider.add("cover.advanced_fluid_detector.label", "Advanced Fluid Detector"); var advancedFluidDetectorInvertDescription = "Toggle to invert the redstone logic\nBy default, redstone stops emitting when less than the minimum L of fluid, and starts emitting when greater than the min L of fluid up to the set maximum"; - multilineLang(provider, "cover.advanced_fluid_detector.invert.enabled", "Output: Inverted\n\n" + advancedFluidDetectorInvertDescription); - multilineLang(provider, "cover.advanced_fluid_detector.invert.disabled", "Output: Normal\n\n" + advancedFluidDetectorInvertDescription); + multilineLang(provider, "cover.advanced_fluid_detector.invert.enabled", + "Output: Inverted\n\n" + advancedFluidDetectorInvertDescription); + multilineLang(provider, "cover.advanced_fluid_detector.invert.disabled", + "Output: Normal\n\n" + advancedFluidDetectorInvertDescription); provider.add("cover.advanced_fluid_detector.max", "Max Fluid (L)"); provider.add("cover.advanced_fluid_detector.min", "Min Fluid (L)"); provider.add("cover.advanced_item_detector.label", "Advanced Item Detector"); var advancedItemDetectorInvertDescription = "Toggle to invert the redstone logic\nBy default, redstone stops emitting when less than the minimum amount of items, and starts emitting when greater than the min amount of items up to the set maximum"; - multilineLang(provider, "cover.advanced_item_detector.invert.enabled", "Output: Inverted\n\n" + advancedItemDetectorInvertDescription); - multilineLang(provider, "cover.advanced_item_detector.invert.disabled", "Output: Normal\n\n" + advancedItemDetectorInvertDescription); + multilineLang(provider, "cover.advanced_item_detector.invert.enabled", + "Output: Inverted\n\n" + advancedItemDetectorInvertDescription); + multilineLang(provider, "cover.advanced_item_detector.invert.disabled", + "Output: Normal\n\n" + advancedItemDetectorInvertDescription); provider.add("cover.advanced_item_detector.max", "Max Items"); provider.add("cover.advanced_item_detector.min", "Min Items"); replace(provider, "item.gtceu.bucket", "%s Bucket"); replace(provider, GTMaterials.FullersEarth.getUnlocalizedName(), "Fuller's Earth"); - replace(provider, GTMaterials.Cooperite.getUnlocalizedName(), "Sheldonite"); //greg's humor is now on 1.19... + replace(provider, GTMaterials.Cooperite.getUnlocalizedName(), "Sheldonite"); // greg's humor is now on 1.19... replace(provider, GTMaterials.HSSG.getUnlocalizedName(), "HSS-G"); replace(provider, GTMaterials.HSSE.getUnlocalizedName(), "HSS-E"); replace(provider, GTMaterials.HSSS.getUnlocalizedName(), "HSS-S"); @@ -402,6 +440,7 @@ public static void init(RegistrateLangProvider provider) { replace(provider, GTMaterials.PCBCoolant.getUnlocalizedName(), "PCB Coolant"); replace(provider, GTMaterials.TungstenSteel.getUnlocalizedName(), "Tungstensteel"); replace(provider, GTMaterials.Iron3Chloride.getUnlocalizedName(), "Iron III Chloride"); + replace(provider, GTMaterials.Iron2Chloride.getUnlocalizedName(), "Iron II Chloride"); replace(provider, GTMaterials.OilHeavy.getUnlocalizedName(), "Heavy Oil"); replace(provider, "block.gtceu.oil_heavy", "Heavy Oil"); replace(provider, GTMaterials.OilLight.getUnlocalizedName(), "Light Oil"); @@ -426,21 +465,31 @@ public static void init(RegistrateLangProvider provider) { replace(provider, GTMaterials.SteamCrackedPropane.getUnlocalizedName(), "Steam-Cracked Propane"); replace(provider, GTMaterials.SteamCrackedPropene.getUnlocalizedName(), "Steam-Cracked Propene"); replace(provider, GTMaterials.LightlyHydroCrackedGas.getUnlocalizedName(), "Lightly Hydro-Cracked Gas"); - replace(provider, GTMaterials.LightlyHydroCrackedHeavyFuel.getUnlocalizedName(), "Lightly Hydro-Cracked Heavy Fuel"); - replace(provider, GTMaterials.LightlyHydroCrackedLightFuel.getUnlocalizedName(), "Lightly Hydro-Cracked Light Fuel"); + replace(provider, GTMaterials.LightlyHydroCrackedHeavyFuel.getUnlocalizedName(), + "Lightly Hydro-Cracked Heavy Fuel"); + replace(provider, GTMaterials.LightlyHydroCrackedLightFuel.getUnlocalizedName(), + "Lightly Hydro-Cracked Light Fuel"); replace(provider, GTMaterials.LightlyHydroCrackedNaphtha.getUnlocalizedName(), "Lightly Hydro-Cracked Naphtha"); replace(provider, GTMaterials.LightlySteamCrackedGas.getUnlocalizedName(), "Lightly Steam-Cracked Gas"); - replace(provider, GTMaterials.LightlySteamCrackedHeavyFuel.getUnlocalizedName(), "Lightly Steam-Cracked Heavy Fuel"); - replace(provider, GTMaterials.LightlySteamCrackedLightFuel.getUnlocalizedName(), "Lightly Steam-Cracked Light Fuel"); + replace(provider, GTMaterials.LightlySteamCrackedHeavyFuel.getUnlocalizedName(), + "Lightly Steam-Cracked Heavy Fuel"); + replace(provider, GTMaterials.LightlySteamCrackedLightFuel.getUnlocalizedName(), + "Lightly Steam-Cracked Light Fuel"); replace(provider, GTMaterials.LightlySteamCrackedNaphtha.getUnlocalizedName(), "Lightly Steam-Cracked Naphtha"); replace(provider, GTMaterials.SeverelyHydroCrackedGas.getUnlocalizedName(), "Severely Hydro-Cracked Gas"); - replace(provider, GTMaterials.SeverelyHydroCrackedHeavyFuel.getUnlocalizedName(), "Severely Hydro-Cracked Heavy Fuel"); - replace(provider, GTMaterials.SeverelyHydroCrackedLightFuel.getUnlocalizedName(), "Severely Hydro-Cracked Light Fuel"); - replace(provider, GTMaterials.SeverelyHydroCrackedNaphtha.getUnlocalizedName(), "Severely Hydro-Cracked Naphtha"); + replace(provider, GTMaterials.SeverelyHydroCrackedHeavyFuel.getUnlocalizedName(), + "Severely Hydro-Cracked Heavy Fuel"); + replace(provider, GTMaterials.SeverelyHydroCrackedLightFuel.getUnlocalizedName(), + "Severely Hydro-Cracked Light Fuel"); + replace(provider, GTMaterials.SeverelyHydroCrackedNaphtha.getUnlocalizedName(), + "Severely Hydro-Cracked Naphtha"); replace(provider, GTMaterials.SeverelySteamCrackedGas.getUnlocalizedName(), "Severely Steam-Cracked Gas"); - replace(provider, GTMaterials.SeverelySteamCrackedHeavyFuel.getUnlocalizedName(), "Severely Steam-Cracked Heavy Fuel"); - replace(provider, GTMaterials.SeverelySteamCrackedLightFuel.getUnlocalizedName(), "Severely Steam-Cracked Light Fuel"); - replace(provider, GTMaterials.SeverelySteamCrackedNaphtha.getUnlocalizedName(), "Severely Steam-Cracked Naphtha"); + replace(provider, GTMaterials.SeverelySteamCrackedHeavyFuel.getUnlocalizedName(), + "Severely Steam-Cracked Heavy Fuel"); + replace(provider, GTMaterials.SeverelySteamCrackedLightFuel.getUnlocalizedName(), + "Severely Steam-Cracked Light Fuel"); + replace(provider, GTMaterials.SeverelySteamCrackedNaphtha.getUnlocalizedName(), + "Severely Steam-Cracked Naphtha"); replace(provider, GTMaterials.Zeron100.getUnlocalizedName(), "Zeron-100"); replace(provider, GTMaterials.IncoloyMA956.getUnlocalizedName(), "Incoloy MA-956"); @@ -629,14 +678,16 @@ public static void init(RegistrateLangProvider provider) { provider.add("enchantment.damage.disjunction", "Disjunction"); provider.add("enchantment.gtceu.disjunction.desc", "Applies Weakness and Slowness to Ender-related mobs."); provider.add("enchantment.hard_hammer", "Hammering"); - provider.add("enchantment.gtceu.hard_hammer.desc", "Breaks blocks as if they were mined with a GregTech Hammer."); + provider.add("enchantment.gtceu.hard_hammer.desc", + "Breaks blocks as if they were mined with a GregTech Hammer."); provider.add("tile.gtceu.seal.name", "Sealed Block"); provider.add("tile.gtceu.foam.name", "Foam"); provider.add("tile.gtceu.reinforced_foam.name", "Reinforced Foam"); provider.add("tile.gtceu.petrified_foam.name", "Petrified Foam"); provider.add("tile.gtceu.reinforced_stone.name", "Reinforced Stone"); provider.add("tile.brittle_charcoal.name", "Brittle Charcoal"); - multilineLang(provider, "tile.brittle_charcoal.tooltip", "Produced by the Charcoal Pile Igniter.\nMine this to get Charcoal."); + multilineLang(provider, "tile.brittle_charcoal.tooltip", + "Produced by the Charcoal Pile Igniter.\nMine this to get Charcoal."); provider.add("metaitem.prospector.mode.ores", "§aOre Prospection Mode§r"); provider.add("metaitem.prospector.mode.fluid", "§bFluid Prospection Mode§r"); provider.add("metaitem.prospector.mode.bedrock_ore", "§bBedrock Ore Prospection Mode§r"); @@ -650,9 +701,11 @@ public static void init(RegistrateLangProvider provider) { provider.add("behavior.portable_scanner.bedrock_fluid.nothing", "Fluid In Deposit: §6Nothing§r"); provider.add("behavior.portable_scanner.block_hardness", "Hardness: %s Blast Resistance: %s"); provider.add("behavior.portable_scanner.block_name", "Name: %s MetaData: %s"); - provider.add("behavior.portable_scanner.debug_cpu_load", "Average CPU load of ~%sns over %s ticks with worst time of %sns."); + provider.add("behavior.portable_scanner.debug_cpu_load", + "Average CPU load of ~%sns over %s ticks with worst time of %sns."); provider.add("behavior.portable_scanner.debug_cpu_load_seconds", "This is %s seconds."); - provider.add("behavior.portable_scanner.debug_lag_count", "Caused %s Lag Spike Warnings (anything taking longer than %sms) on the Server."); + provider.add("behavior.portable_scanner.debug_lag_count", + "Caused %s Lag Spike Warnings (anything taking longer than %sms) on the Server."); provider.add("behavior.portable_scanner.debug_machine", "Meta-ID: %s"); provider.add("behavior.portable_scanner.debug_machine_invalid", " invalid!"); provider.add("behavior.portable_scanner.debug_machine_invalid_null=invalid! MetaTileEntity =", " null!"); @@ -696,18 +749,20 @@ public static void init(RegistrateLangProvider provider) { provider.add("metaitem.terminal.tooltip.hardware", "§aHardware: %d"); provider.add("metaitem.plugin.tooltips.1", "Plugins can be added to the screen for more functionality."); provider.add("metaitem.plugin.proxy.tooltips.1", "(Please adjust to proxy mode in the screen)"); - provider.add("metaitem.cover.digital.tooltip", "Connects machines over §fPower Cables§7 to the §fCentral Monitor§7 as §fCover§7."); - + provider.add("metaitem.cover.digital.tooltip", + "Connects machines over §fPower Cables§7 to the §fCentral Monitor§7 as §fCover§7."); provider.add("gtceu.machine.drum.enable_output", "Will drain Fluid to downward adjacent Tanks"); provider.add("gtceu.machine.drum.disable_output", "Will not drain Fluid"); provider.add("gtceu.machine.locked_safe.malfunctioning", "§cMalfunctioning!"); provider.add("gtceu.machine.locked_safe.requirements", "§7Replacements required:"); - multilineLang(provider, "gtceu.machine.workbench.tooltip", "Better than Forestry\nHas Item Storage, Tool Storage, pulls from adjacent Inventories, and saves Recipes."); + multilineLang(provider, "gtceu.machine.workbench.tooltip", + "Better than Forestry\nHas Item Storage, Tool Storage, pulls from adjacent Inventories, and saves Recipes."); provider.add("gtceu.machine.workbench.tab.workbench", "Crafting"); provider.add("gtceu.machine.workbench.tab.item_list", "Storage"); - multilineLang(provider, "gtceu.machine.workbench.storage_note", "(Available items from connected\ninventories usable for crafting)"); + multilineLang(provider, "gtceu.machine.workbench.storage_note", + "(Available items from connected\ninventories usable for crafting)"); provider.add("gtceu.item_list.item_stored", "§7Stored: %d"); provider.add("gtceu.machine.workbench.tab.crafting", "Crafting"); provider.add("gtceu.machine.workbench.tab.container", "Container"); @@ -721,7 +776,8 @@ public static void init(RegistrateLangProvider provider) { provider.add("gtceu.machine.parallel_limit", "Can run up to §b%d§r§7 Recipes at once."); provider.add("gtceu.machine.multiblock.tank.tooltip", "Fill and drain through the controller or tank valves."); - provider.add("gtceu.machine.tank_valve.tooltip", "Use to fill and drain multiblock tanks. Auto outputs when facing down."); + provider.add("gtceu.machine.tank_valve.tooltip", + "Use to fill and drain multiblock tanks. Auto outputs when facing down."); provider.add("metaitem.cover.digital.mode.proxy.disabled", "Click to enable Proxy Mode"); provider.add("metaitem.cover.digital.mode.proxy.enabled", "Proxy Mode enabled"); @@ -758,7 +814,8 @@ public static void init(RegistrateLangProvider provider) { provider.add("gtceu.universal.tooltip.item_transfer_rate", "§bTransfer Rate: §f%d items/s"); provider.add("gtceu.universal.tooltip.item_transfer_rate_stacks", "§bTransfer Rate: §f%d stacks/s"); provider.add("gtceu.universal.tooltip.fluid_storage_capacity", "§9Fluid Capacity: §f%d L"); - provider.add("gtceu.universal.tooltip.fluid_storage_capacity_mult", "§9Fluid Capacity: §f%d §7Tanks, §f%d L §7each"); + provider.add("gtceu.universal.tooltip.fluid_storage_capacity_mult", + "§9Fluid Capacity: §f%d §7Tanks, §f%d L §7each"); provider.add("gtceu.universal.tooltip.fluid_stored", "§dFluid Stored: §f%s, %d L"); provider.add("gtceu.universal.tooltip.fluid_transfer_rate", "§bTransfer Rate: §f%d L/t"); provider.add("gtceu.universal.tooltip.parallel", "§dMax Parallel: §f%d"); @@ -776,9 +833,11 @@ public static void init(RegistrateLangProvider provider) { provider.add("gtceu.universal.tooltip.base_production_eut", "§eBase Production: §f%d EU/t"); provider.add("gtceu.universal.tooltip.base_production_fluid", "§eBase Production: §f%d L/t"); provider.add("gtceu.universal.tooltip.produces_fluid", "§eProduces: §f%d L/t"); - provider.add("gtceu.universal.tooltip.terrain_resist", "This Machine will not explode when exposed to the Elements"); + provider.add("gtceu.universal.tooltip.terrain_resist", + "This Machine will not explode when exposed to the Elements"); provider.add("gtceu.universal.tooltip.requires_redstone", "§4Requires Redstone power"); - provider.add("gtceu.universal.tooltip.deprecated", "§4§lWARNING:§r§4 DEPRECATED. WILL BE REMOVED IN A FUTURE VERSION.§r"); + provider.add("gtceu.universal.tooltip.deprecated", + "§4§lWARNING:§r§4 DEPRECATED. WILL BE REMOVED IN A FUTURE VERSION.§r"); provider.add("gtceu.recipe.total", "Total: %s EU"); provider.add("gtceu.recipe.max_eu", "Max. EU: %s EU"); provider.add("gtceu.recipe.eu", "Usage: %s EU/t"); @@ -798,12 +857,18 @@ public static void init(RegistrateLangProvider provider) { provider.add("gtceu.recipe.research", "Requires Research"); provider.add("gtceu.recipe.scan_for_research", "Scan for Assembly Line"); provider.add("gtceu.recipe.computation_per_tick", "Min. Computation: %s CWU/t"); - provider.add("gtceu.fluid.click_to_fill", "§7Click with a Fluid Container to §bfill §7the tank (Shift-click for a full stack)."); - provider.add("gtceu.fluid.click_combined", "§7Click with a Fluid Container to §cempty §7or §bfill §7the tank (Shift-click for a full stack)."); - provider.add("gtceu.fluid.click_to_empty", "§7Click with a Fluid Container to §cempty §7the tank (Shift-click for a full stack)."); + provider.add("gtceu.recipe.total_computation", "Computation: %s CWU"); + provider.add("gtceu.fluid.click_to_fill", + "§7Click with a Fluid Container to §bfill §7the tank (Shift-click for a full stack)."); + provider.add("gtceu.fluid.click_combined", + "§7Click with a Fluid Container to §cempty §7or §bfill §7the tank (Shift-click for a full stack)."); + provider.add("gtceu.fluid.click_to_empty", + "§7Click with a Fluid Container to §cempty §7the tank (Shift-click for a full stack)."); provider.add("gtceu.tool_action.show_tooltips", "Hold SHIFT to show Tool Info"); - provider.add("gtceu.tool_action.screwdriver.auto_output_covers", "§8Use Screwdriver to Allow Input from Output Side or access Covers"); - provider.add("gtceu.tool_action.screwdriver.toggle_mode_covers", "§8Use Screwdriver to toggle Modes or access Covers"); + provider.add("gtceu.tool_action.screwdriver.auto_output_covers", + "§8Use Screwdriver to Allow Input from Output Side or access Covers"); + provider.add("gtceu.tool_action.screwdriver.toggle_mode_covers", + "§8Use Screwdriver to toggle Modes or access Covers"); provider.add("gtceu.tool_action.screwdriver.access_covers", "§8Use Screwdriver to access Covers"); provider.add("gtceu.tool_action.screwdriver.auto_collapse", "§8Use Screwdriver to toggle Item collapsing"); provider.add("gtceu.tool_action.screwdriver.auto_output", "§8Use Screwdriver to toggle Auto-Output"); @@ -838,7 +903,8 @@ public static void init(RegistrateLangProvider provider) { provider.add("gtceu.gui.toggle_view.enabled", "Toggle View (Items)"); multilineLang(provider, "gtceu.gui.overclock.enabled", "Overclocking Enabled.\nClick to Disable"); multilineLang(provider, "gtceu.gui.overclock.disabled", "Overclocking Disabled.\nClick to Enable"); - multilineLang(provider, "gtceu.gui.overclock.description", "Overclock Button\n§7Recipes can overclock up to the set tier"); + multilineLang(provider, "gtceu.gui.overclock.description", + "Overclock Button\n§7Recipes can overclock up to the set tier"); provider.add("gtceu.gui.overclock.off", "X"); provider.add("gtceu.gui.sort", "Sort"); provider.add("gtceu.gui.fluid_auto_output.tooltip.enabled", "Fluid Auto-Output Enabled"); @@ -849,8 +915,10 @@ public static void init(RegistrateLangProvider provider) { provider.add("gtceu.gui.item_auto_output.tooltip.disabled", "Item Auto-Output Disabled"); provider.add("gtceu.gui.item_auto_input.tooltip.enabled", "Item Auto-Output Enabled"); provider.add("gtceu.gui.item_auto_input.tooltip.disabled", "Item Auto-Output Disabled"); - multilineLang(provider, "gtceu.gui.charger_slot.tooltip", "§fCharger Slot§r\n§7Draws power from %s batteries§r\n§7Charges %s tools and batteries"); - multilineLang(provider, "gtceu.gui.configurator_slot.tooltip", "§fConfigurator Slot§r\n§7Place a §6Programmed Circuit§7 in this slot to\n§7change its configured value.\n§7Hold §6Shift§7 when clicking buttons to change by §65.\n§aA Programmed Circuit in this slot is also valid for recipe inputs.§r"); + multilineLang(provider, "gtceu.gui.charger_slot.tooltip", + "§fCharger Slot§r\n§7Draws power from %s batteries§r\n§7Charges %s tools and batteries"); + multilineLang(provider, "gtceu.gui.configurator_slot.tooltip", + "§fConfigurator Slot§r\n§7Place a §6Programmed Circuit§7 in this slot to\n§7change its configured value.\n§7Hold §6Shift§7 when clicking buttons to change by §65.\n§aA Programmed Circuit in this slot is also valid for recipe inputs.§r"); provider.add("gtceu.gui.fluid_lock.tooltip.enabled", "Fluid Locking Enabled"); provider.add("gtceu.gui.fluid_lock.tooltip.disabled", "Fluid Locking Disabled"); provider.add("gtceu.gui.fluid_voiding_partial.tooltip.enabled", "Fluid Voiding Enabled"); @@ -859,23 +927,31 @@ public static void init(RegistrateLangProvider provider) { provider.add("gtceu.gui.item_lock.tooltip.disabled", "Item Locking Disabled"); provider.add("gtceu.gui.item_voiding_partial.tooltip.enabled", "Item Voiding Enabled"); provider.add("gtceu.gui.item_voiding_partial.tooltip.disabled", "Item Voiding Disabled"); - multilineLang(provider, "gtceu.gui.silktouch.enabled", "Silk Touch Enabled: Click to Disable.\n§7Switching requires an idle machine."); - multilineLang(provider, "gtceu.gui.silktouch.disabled", "Silk Touch Disabled: Click to Enable.\n§7Switching requires an idle machine."); - multilineLang(provider, "gtceu.gui.chunkmode.enabled", "Chunk Mode Enabled: Click to Disable.\n§7Switching requires an idle machine."); - multilineLang(provider, "gtceu.gui.chunkmode.disabled", "Chunk Mode Disabled: Click to Enable.\n§7Switching requires an idle machine."); + multilineLang(provider, "gtceu.gui.silktouch.enabled", + "Silk Touch Enabled: Click to Disable.\n§7Switching requires an idle machine."); + multilineLang(provider, "gtceu.gui.silktouch.disabled", + "Silk Touch Disabled: Click to Enable.\n§7Switching requires an idle machine."); + multilineLang(provider, "gtceu.gui.chunkmode.enabled", + "Chunk Mode Enabled: Click to Disable.\n§7Switching requires an idle machine."); + multilineLang(provider, "gtceu.gui.chunkmode.disabled", + "Chunk Mode Disabled: Click to Enable.\n§7Switching requires an idle machine."); multilineLang(provider, "gtceu.gui.multiblock_item_voiding", "Voiding Mode\n§7Voiding §6Items"); multilineLang(provider, "gtceu.gui.multiblock_fluid_voiding", "Voiding Mode\n§7Voiding §9Fluids"); - multilineLang(provider, "gtceu.gui.multiblock_item_fluid_voiding", "Voiding Mode\n§7Voiding §6Items §7and §9Fluids"); + multilineLang(provider, "gtceu.gui.multiblock_item_fluid_voiding", + "Voiding Mode\n§7Voiding §6Items §7and §9Fluids"); multilineLang(provider, "gtceu.gui.multiblock_no_voiding", "Voiding Mode\n§7Voiding Nothing"); provider.add("ore.spawnlocation.name", "Ore Spawn Information"); - multiLang(provider, "gtceu.jei.ore.surface_rock", "Surface Rocks with this material denote vein spawn locations.", "They can be broken for 3 Tiny Piles of the dust, with Fortune giving a bonus."); + multiLang(provider, "gtceu.jei.ore.surface_rock", + "Surface Rocks with this material denote vein spawn locations.", + "They can be broken for 3 Tiny Piles of the dust, with Fortune giving a bonus."); provider.add("gtceu.jei.ore.biome_weighting_title", "§dModified Biome Total Weights:"); provider.add("gtceu.jei.ore.biome_weighting", "§d%s Weight: §3%d"); provider.add("gtceu.jei.ore.biome_weighting_no_spawn", "§d%s Weight: §cCannot Spawn"); provider.add("gtceu.jei.ore.ore_weight", "Weight in vein: %d%%"); multiLang(provider, "gtceu.jei.ore.primary", "Top Ore", "Spawns in the top %d layers of the vein"); multiLang(provider, "gtceu.jei.ore.secondary", "Bottom Ore", "Spawns in the bottom %d layers of the vein"); - multiLang(provider, "gtceu.jei.ore.between", "Between Ore", "Spawns in the middle %d layers of the vein, with other ores"); + multiLang(provider, "gtceu.jei.ore.between", "Between Ore", + "Spawns in the middle %d layers of the vein, with other ores"); multiLang(provider, "gtceu.jei.ore.sporadic", "Sporadic Ore", "Spawns anywhere in the vein"); provider.add("fluid.spawnlocation.name", "Fluid Vein Information"); provider.add("gtceu.jei.fluid.vein_weight", "Vein Weight: %d"); @@ -885,10 +961,12 @@ public static void init(RegistrateLangProvider provider) { provider.add("gtceu.jei.fluid.depletion_amount", "Depletion Amount: %d"); provider.add("gtceu.jei.fluid.depleted_rate", "Depleted Yield: %d"); provider.add("gtceu.jei.fluid.dimension", "Dimensions:"); - provider.add("gtceu.jei.fluid.weight_hover", "The Weight of the vein. Hover over the fluid to see any possible biome modifications"); + provider.add("gtceu.jei.fluid.weight_hover", + "The Weight of the vein. Hover over the fluid to see any possible biome modifications"); provider.add("gtceu.jei.fluid.min_hover", "The minimum yield that any fluid vein of this fluid can have"); provider.add("gtceu.jei.fluid.max_hover", "The maximum yield that any fluid vein of this fluid can have"); - provider.add("gtceu.jei.fluid.dep_chance_hover", "The percentage chance for the vein to be depleted upon harvest"); + provider.add("gtceu.jei.fluid.dep_chance_hover", + "The percentage chance for the vein to be depleted upon harvest"); provider.add("gtceu.jei.fluid.dep_amount_hover", "The amount the vein will be depleted by"); provider.add("gtceu.jei.fluid.dep_yield_hover", "The maximum yield of the vein when it is fully depleted"); provider.add("gtceu.jei.materials.average_mass", "Average mass: %d"); @@ -917,18 +995,21 @@ public static void init(RegistrateLangProvider provider) { provider.add("gtceu.multiblock.waiting", "WARNING: Machine is waiting."); provider.add("gtceu.multiblock.progress", "Progress: %s%%"); provider.add("gtceu.multiblock.invalid_structure", "Invalid structure."); - provider.add("gtceu.multiblock.invalid_structure.tooltip", "This block is a controller of the multiblock structure. For building help, see structure template in JEI."); + provider.add("gtceu.multiblock.invalid_structure.tooltip", + "This block is a controller of the multiblock structure. For building help, see structure template in JEI."); provider.add("gtceu.multiblock.validation_failed", "Invalid amount of inputs/outputs."); provider.add("gtceu.multiblock.max_recipe_tier", "Max Recipe Tier: %s"); provider.add("gtceu.multiblock.max_recipe_tier_hover", "The maximum tier of recipes that can be run"); provider.add("gtceu.multiblock.max_energy_per_tick", "Max EU/t: §a%s (%s§r)"); - provider.add("gtceu.multiblock.max_energy_per_tick_hover", "The maximum EU/t available for running recipes or overclocking"); + provider.add("gtceu.multiblock.max_energy_per_tick_hover", + "The maximum EU/t available for running recipes or overclocking"); provider.add("gtceu.multiblock.max_energy_per_tick_amps", "Max EU/t: %s (%sA %s)"); provider.add("gtceu.multiblock.energy_consumption", "Energy Usage: %s EU/t (%s)"); provider.add("gtceu.multiblock.generation_eu", "Outputting: §a%s EU/t"); provider.add("gtceu.multiblock.universal.no_problems", "No Maintenance Problems!"); provider.add("gtceu.multiblock.universal.has_problems", "Has Maintenance Problems!"); - provider.add("gtceu.multiblock.universal.has_problems_header", "Fix the following issues in a Maintenance Hatch:"); + provider.add("gtceu.multiblock.universal.has_problems_header", + "Fix the following issues in a Maintenance Hatch:"); provider.add("gtceu.multiblock.universal.problem.wrench", "%s§7Pipe is loose. (§aWrench§7)"); provider.add("gtceu.multiblock.universal.problem.screwdriver", "%s§7Screws are loose. (§aScrewdriver§7)"); provider.add("gtceu.multiblock.universal.problem.soft_mallet", "%s§7Something is stuck. (§aSoft Mallet§7)"); @@ -936,14 +1017,17 @@ public static void init(RegistrateLangProvider provider) { provider.add("gtceu.multiblock.universal.problem.wire_cutter", "%s§7Wires burned out. (§aWire Cutter§7)"); provider.add("gtceu.multiblock.universal.problem.crowbar", "%s§7That doesn't belong there. (§aCrowbar§7)"); provider.add("gtceu.multiblock.universal.muffler_obstructed", "Muffler Hatch is Obstructed!"); - provider.add("gtceu.multiblock.universal.muffler_obstructed.tooltip", "Muffler Hatch must have a block of airspace in front of it."); + provider.add("gtceu.multiblock.universal.muffler_obstructed.tooltip", + "Muffler Hatch must have a block of airspace in front of it."); provider.add("gtceu.multiblock.universal.distinct", "Distinct Buses:"); provider.add("gtceu.multiblock.universal.distinct.no", "No"); provider.add("gtceu.multiblock.universal.distinct.yes", "Yes"); - provider.add("gtceu.multiblock.universal.distinct.info", "If enabled, each Item Input Bus will be treated as fully distinct from each other for recipe lookup. Useful for things like Programmed Circuits, Extruder Shapes, etc."); + provider.add("gtceu.multiblock.universal.distinct.info", + "If enabled, each Item Input Bus will be treated as fully distinct from each other for recipe lookup. Useful for things like Programmed Circuits, Extruder Shapes, etc."); provider.add("gtceu.multiblock.parallel", "Performing up to %d Recipes in Parallel"); provider.add("gtceu.multiblock.multiple_recipemaps.header", "Machine Mode:"); - provider.add("gtceu.multiblock.multiple_recipemaps.tooltip", "Screwdriver the controller to change which machine mode to use."); + provider.add("gtceu.multiblock.multiple_recipemaps.tooltip", + "Screwdriver the controller to change which machine mode to use."); provider.add("gtceu.multiblock.multiple_recipemaps_recipes.tooltip", "Machine Modes: §e%s§r"); provider.add("gtceu.multiblock.multiple_recipemaps.switch_message", "The machine must be off to switch modes!"); provider.add("gtceu.multiblock.preview.zoom", "Use mousewheel or right-click + drag to zoom"); @@ -952,7 +1036,8 @@ public static void init(RegistrateLangProvider provider) { provider.add("gtceu.multiblock.pattern.error", "Expected components (%s) at (%s)."); provider.add("gtceu.multiblock.pattern.error.limited_exact", "§cExactly: %d§r"); provider.add("gtceu.multiblock.pattern.error.limited_within", "§cBetween %d and %d§r"); - multiLang(provider, "gtceu.multiblock.pattern.error.limited", "§cMaximum: %d§r", "§cMinimum: %d§r", "§cMaximum: %d per layer§r", "§cMinimum: %d per layer§r"); + multiLang(provider, "gtceu.multiblock.pattern.error.limited", "§cMaximum: %d§r", "§cMinimum: %d§r", + "§cMaximum: %d per layer§r", "§cMinimum: %d per layer§r"); provider.add("gtceu.multiblock.pattern.error.coils", "§cAll heating coils must be the same§r"); provider.add("gtceu.multiblock.pattern.error.filters", "§cAll filters must be the same§r"); provider.add("gtceu.multiblock.pattern.error.batteries", "§cAll batteries must be the same§r"); @@ -965,7 +1050,8 @@ public static void init(RegistrateLangProvider provider) { provider.add("gtceu.multiblock.computation.max", "Max CWU/t: %s"); provider.add("gtceu.multiblock.computation.usage", "Using: %s"); provider.add("gtceu.multiblock.computation.non_bridging", "Non-bridging connection found"); - provider.add("gtceu.multiblock.computation.non_bridging.detailed", "A Reception Hatch is linked to a machine which cannot bridge"); + provider.add("gtceu.multiblock.computation.non_bridging.detailed", + "A Reception Hatch is linked to a machine which cannot bridge"); provider.add("gtceu.multiblock.computation.not_enough_computation", "Machine needs more computation!"); provider.add("gtceu.command.usage", "Usage: /gtceu "); @@ -985,27 +1071,34 @@ public static void init(RegistrateLangProvider provider) { provider.add("gtceu.command.hand.ore_dict_entries", "§3Ore dictionary entries:"); provider.add("gtceu.command.hand.tool_stats", "Tool Stats Class: %s"); provider.add("gtceu.command.hand.not_a_player", "This command is only usable by a player."); - provider.add("gtceu.command.hand.no_item", "You must hold something in main hand or off hand before executing this command."); + provider.add("gtceu.command.hand.no_item", + "You must hold something in main hand or off hand before executing this command."); provider.add("gtceu.command.recipecheck.usage", "Usage: /gtceu recipecheck"); provider.add("gtceu.command.recipecheck.begin", "Starting recipe conflict check..."); - provider.add("gtceu.command.recipecheck.end", "Recipe conflict check found %d possible conflicts. Check the server log for more info"); + provider.add("gtceu.command.recipecheck.end", + "Recipe conflict check found %d possible conflicts. Check the server log for more info"); provider.add("gtceu.command.recipecheck.end_no_conflicts", "No recipe conflicts found!"); provider.add("gtceu.command.copy.copied_and_click", "copied to clipboard. Click to copy again"); provider.add("gtceu.command.copy.click_to_copy", "Click to copy"); provider.add("gtceu.command.copy.copied_start", "Copied ["); provider.add("gtceu.command.copy.copied_end", "] to the clipboard"); - provider.add("gtceu.chat.cape", "§5Congrats: you just unlocked a new cape! See the Cape Selector terminal app to use it.§r"); + provider.add("gtceu.chat.cape", + "§5Congrats: you just unlocked a new cape! See the Cape Selector terminal app to use it.§r"); provider.add("gtceu.universal.clear_nbt_recipe.tooltip", "§cThis will destroy all contents!"); - provider.add("gtceu.cover.energy_detector.message_electricity_storage_normal", "Monitoring Normal Electricity Storage"); - provider.add("gtceu.cover.energy_detector.message_electricity_storage_inverted", "Monitoring Inverted Electricity Storage"); + provider.add("gtceu.cover.energy_detector.message_electricity_storage_normal", + "Monitoring Normal Electricity Storage"); + provider.add("gtceu.cover.energy_detector.message_electricity_storage_inverted", + "Monitoring Inverted Electricity Storage"); provider.add("gtceu.cover.fluid_detector.message_fluid_storage_normal", "Monitoring Normal Fluid Storage"); provider.add("gtceu.cover.fluid_detector.message_fluid_storage_inverted", "Monitoring Inverted Fluid Storage"); provider.add("gtceu.cover.item_detector.message_item_storage_normal", "Monitoring Normal Item Storage"); provider.add("gtceu.cover.item_detector.message_item_storage_inverted", "Monitoring Inverted Item Storage"); provider.add("gtceu.cover.activity_detector.message_activity_normal", "Monitoring Normal Activity Status"); provider.add("gtceu.cover.activity_detector.message_activity_inverted", "Monitoring Inverted Activity Status"); - provider.add("gtceu.cover.activity_detector_advanced.message_activity_normal", "Monitoring Normal Progress Status"); - provider.add("gtceu.cover.activity_detector_advanced.message_activity_inverted", "Monitoring Inverted Progress Status"); + provider.add("gtceu.cover.activity_detector_advanced.message_activity_normal", + "Monitoring Normal Progress Status"); + provider.add("gtceu.cover.activity_detector_advanced.message_activity_inverted", + "Monitoring Inverted Progress Status"); multiLang(provider, "metaitem.cover.digital.wireless.tooltip", "§fWirelessly§7 connects machines to the §fCentral Monitor§7 as §fCover§7.", @@ -1024,7 +1117,8 @@ public static void init(RegistrateLangProvider provider) { provider.add("gtceu.key.armor_hover", "Armor Hover Toggle"); provider.add("gtceu.key.armor_charging", "Armor Charging to Inventory Toggle"); provider.add("gtceu.key.tool_aoe_change", "Tool AoE Mode Switch"); - provider.add("gtceu.debug.f3_h.enabled", "GregTech has modified the debug info! For Developers: enable the misc:debug config option in the GregTech config file to see more"); + provider.add("gtceu.debug.f3_h.enabled", + "GregTech has modified the debug info! For Developers: enable the misc:debug config option in the GregTech config file to see more"); provider.add("config.jade.plugin_gtceu.controllable_provider", "[GTCEu] Controllable"); provider.add("config.jade.plugin_gtceu.workable_provider", "[GTCEu] Workable"); provider.add("config.jade.plugin_gtceu.electric_container_provider", "[GTCEu] Electric Container"); @@ -1038,7 +1132,8 @@ public static void init(RegistrateLangProvider provider) { provider.add("gtceu.gui.cover_setting.title", "Cover Settings"); provider.add("gtceu.gui.output_setting.title", "Output Settings"); provider.add("gtceu.gui.circuit.title", "Circuit Settings"); - multiLang(provider, "gtceu.gui.output_setting.tooltips", "left-click to tune the item auto output", "right-click to tune the fluid auto output."); + multiLang(provider, "gtceu.gui.output_setting.tooltips", "left-click to tune the item auto output", + "right-click to tune the fluid auto output."); provider.add("gtceu.gui.item_auto_output.allow_input.enabled", "allow items input from the output side"); provider.add("gtceu.gui.item_auto_output.allow_input.disabled", "disable items input from the output side"); provider.add("gtceu.gui.fluid_auto_output.allow_input.enabled", "allow fluids input from the output side"); @@ -1074,21 +1169,28 @@ public static void init(RegistrateLangProvider provider) { provider.add("gtceu.gui.config_slot.remove", "§7Right click to §4clear§7 config slot.§r"); // Decor Stuff - replace(provider,"block.gtceu.yellow_stripes_block.a", "Yellow Stripes Block"); - replace(provider,"block.gtceu.yellow_stripes_block.b", "Yellow Stripes Block"); - replace(provider,"block.gtceu.yellow_stripes_block.c", "Yellow Stripes Block"); - replace(provider,"block.gtceu.yellow_stripes_block.d", "Yellow Stripes Block"); + replace(provider, "block.gtceu.yellow_stripes_block.a", "Yellow Stripes Block"); + replace(provider, "block.gtceu.yellow_stripes_block.b", "Yellow Stripes Block"); + replace(provider, "block.gtceu.yellow_stripes_block.c", "Yellow Stripes Block"); + replace(provider, "block.gtceu.yellow_stripes_block.d", "Yellow Stripes Block"); + + provider.add("effect.gtceu.weak_poison", "Weak Poison"); } /** * Returns the sub-key consisting of the given key plus the given index.
* E.g.,
+ * *
-     * getSubKey("terminal.fluid_prospector.tier", 0)
+ * getSubKey("terminal.fluid_prospector.tier", 0) + * + * * returns the String: + * *
      * 
-     * "terminal.fluid_prospector.tier.0"
+ * "terminal.fluid_prospector.tier.0" + * * * @param key Base key of the sub-key. * @param index Index of the sub-key. @@ -1099,25 +1201,36 @@ protected static String getSubKey(String key, int index) { } /** - * Registers multiple values under the same key with a given provider.

+ * Registers multiple values under the same key with a given provider.
+ *
* For example, a cumbersome way to add translations would be the following:
+ * *
      * provider.add("terminal.fluid_prospector.tier.0", "radius size 1");
      * provider.add("terminal.fluid_prospector.tier.1", "radius size 2");
-     * provider.add("terminal.fluid_prospector.tier.2", "radius size 3");
+ * provider.add("terminal.fluid_prospector.tier.2", "radius size 3"); + * + * * Instead, multiLang can be used for the same result: + * *
-     * multiLang(provider, "terminal.fluid_prospector.tier", "radius size 1", "radius size 2", "radius size 3");
- * In situations requiring a large number of generated translations, the following could be used instead, which generates translations for 100 tiers: + * multiLang(provider, "terminal.fluid_prospector.tier", "radius size 1", "radius size 2", "radius size 3"); + * + * + * In situations requiring a large number of generated translations, the following could be used instead, which + * generates translations for 100 tiers: + * *
      * multiLang(provider, "terminal.fluid_prospector.tier", IntStream.of(100)
      *                 .map(i -> i + 1)
      *                 .mapToObj(Integer::toString)
      *                 .map(i -> "radius size " + i)
-     *                 .toArray(String[]::new));
+ * .toArray(String[]::new)); + * * * @param provider The provider to add to. - * @param key Base key of the key-value-pairs. The real key for each translation will be appended by ".0" for the first, ".1" for the second, etc. This ensures that the keys are unique. + * @param key Base key of the key-value-pairs. The real key for each translation will be appended by ".0" for + * the first, ".1" for the second, etc. This ensures that the keys are unique. * @param values All translation values. */ protected static void multiLang(RegistrateLangProvider provider, String key, String... values) { @@ -1129,18 +1242,26 @@ protected static void multiLang(RegistrateLangProvider provider, String key, Str /** * Gets all translation components from a multi lang's sub-keys.
* E.g., given a multi lang: + * *
-     * multiLang(provider, "terminal.fluid_prospector.tier", "radius size 1", "radius size 2", "radius size 3");
+ * multiLang(provider, "terminal.fluid_prospector.tier", "radius size 1", "radius size 2", "radius size 3"); + * + * * The following code can be used to print out the translations: + * *
      * for (var component : getMultiLang("terminal.fluid_prospector.tier")) {
      *     System.out.println(component.getString());
-     * }
+ * } + * + * * Result: + * *
      * radius size 1
      * radius size 2
-     * radius size 3
+ * radius size 3 + * * * @param key Base key of the multi lang. E.g. "terminal.fluid_prospector.tier". * @return Returns all translation components from a multi lang's sub-keys @@ -1157,20 +1278,29 @@ public static List getMultiLang(String key) { } /** - * Gets all translation components from a multi lang's sub-keys. Supports additional arguments for the translation components.
+ * Gets all translation components from a multi lang's sub-keys. Supports additional arguments for the translation + * components.
* E.g., given a multi lang: + * *
-     * multiLang(provider, "terminal.fluid_prospector.tier", "radius size 1", "radius size 2", "radius size 3");
+ * multiLang(provider, "terminal.fluid_prospector.tier", "radius size 1", "radius size 2", "radius size 3"); + * + * * The following code can be used to print out the translations: + * *
      * for (var component : getMultiLang("terminal.fluid_prospector.tier")) {
      *     System.out.println(component.getString());
-     * }
+ * } + * + * * Result: + * *
      * radius size 1
      * radius size 2
-     * radius size 3
+ * radius size 3 + * * * @param key Base key of the multi lang. E.g. "terminal.fluid_prospector.tier". * @return Returns all translation components from a multi lang's sub-keys. @@ -1199,7 +1329,6 @@ public static List getSingleOrMultiLang(String key) { return multiLang; } - return List.of(Component.translatable(key)); } @@ -1226,17 +1355,24 @@ public static MutableComponent getFromMultiLang(String key, int index, Object... } /** - * Adds one key-value-pair to the given lang provider per line in the given multiline (a multiline is a String containing newline characters).
+ * Adds one key-value-pair to the given lang provider per line in the given multiline (a multiline is a String + * containing newline characters).
* Example: + * *
-     * multilineLang(provider, "gtceu.gui.overclock.enabled", "Overclocking Enabled.\nClick to Disable");
+ * multilineLang(provider, "gtceu.gui.overclock.enabled", "Overclocking Enabled.\nClick to Disable"); + * + * * This results in the following translations:
+ * *
      * "gtceu.gui.overclock.enabled.0": "Overclocking Enabled.",
-     * "gtceu.gui.overclock.enabled.1": "Click to Disable",
+ * "gtceu.gui.overclock.enabled.1": "Click to Disable", + * * * @param provider The provider to add to. - * @param key Base key of the key-value-pair. The real key for each line will be appended by ".0" for the first line, ".1" for the second, etc. This ensures that the keys are unique. + * @param key Base key of the key-value-pair. The real key for each line will be appended by ".0" for the + * first line, ".1" for the second, etc. This ensures that the keys are unique. * @param multiline The multiline string. It is a multiline because it contains at least one newline character '\n'. */ protected static void multilineLang(RegistrateLangProvider provider, String key, String multiline) { @@ -1248,8 +1384,8 @@ protected static void multilineLang(RegistrateLangProvider provider, String key, * Replace a value in a language provider's mappings * * @param provider the provider whose mappings should be modified - * @param key the key for the value - * @param value the value to use in place of the old one + * @param key the key for the value + * @param value the value to use in place of the old one */ public static void replace(@NotNull RegistrateLangProvider provider, @NotNull String key, @NotNull String value) { try { diff --git a/src/main/java/com/gregtechceu/gtceu/data/lang/MachineLang.java b/src/main/java/com/gregtechceu/gtceu/data/lang/MachineLang.java index 5df52da312..8383bae1fd 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/lang/MachineLang.java +++ b/src/main/java/com/gregtechceu/gtceu/data/lang/MachineLang.java @@ -44,12 +44,11 @@ protected static void init(RegistrateLangProvider provider) { provider.add("gtceu.machine.steam_turbine.tooltip", "§7Converts Steam into EU"); provider.add("gtceu.machine.gas_turbine.tooltip", "§7Requires flammable Gases"); - provider.add("gtceu.machine.block_breaker.tooltip", "§7Mines block on front face and collects its drops"); provider.add("gtceu.machine.block_breaker.speed_bonus", "§eSpeed Bonus: §f%d%%"); /////////////////////////////////////////////////// - // Standard Machines // + // Standard Machines // // Ones done with more unique tooltips are first / /////////////////////////////////////////////////// @@ -303,22 +302,32 @@ protected static void init(RegistrateLangProvider provider) { provider.add("gtceu.battery_buffer.average_input", "Average input: %s EU/t"); provider.add("gtceu.battery_buffer.average_output", "Average output: %s EU/t"); provider.add("gtceu.machine.transformer.description", "§7Transforms Energy between voltage tiers"); - provider.add("gtceu.machine.transformer.tooltip_tool_usage", "Starts as §fTransform Down§7, use Screwdriver to change"); - provider.add("gtceu.machine.transformer.tooltip_transform_down", "§aTransform Down: §f%dA %d EU (%s§f) -> %dA %d EU (%s§f)"); - provider.add("gtceu.machine.transformer.message_transform_down", "Transforming Down, In: %d EU %dA, Out: %d EU %dA"); - provider.add("gtceu.machine.transformer.tooltip_transform_up", "§cTransform Up: §f%dA %d EU (%s§f) -> %dA %d EU (%s§f)"); - provider.add("gtceu.machine.transformer.message_transform_up", "Transforming Up, In: %d EU %dA, Out: %d EU %dA"); + provider.add("gtceu.machine.transformer.tooltip_tool_usage", + "Starts as §fTransform Down§7, use Screwdriver to change"); + provider.add("gtceu.machine.transformer.tooltip_transform_down", + "§aTransform Down: §f%dA %d EU (%s§f) -> %dA %d EU (%s§f)"); + provider.add("gtceu.machine.transformer.message_transform_down", + "Transforming Down, In: %d EU %dA, Out: %d EU %dA"); + provider.add("gtceu.machine.transformer.tooltip_transform_up", + "§cTransform Up: §f%dA %d EU (%s§f) -> %dA %d EU (%s§f)"); + provider.add("gtceu.machine.transformer.message_transform_up", + "Transforming Up, In: %d EU %dA, Out: %d EU %dA"); provider.add("gtceu.machine.diode.message", "Max Amperage throughput: %s"); provider.add("gtceu.machine.diode.tooltip_tool_usage", "Hit with a Soft Mallet to change Amperage flow."); provider.add("gtceu.machine.diode.tooltip_general", "Allows Energy Flow in one direction and limits Amperage"); provider.add("gtceu.machine.diode.tooltip_starts_at", "Starts as §f1A§7, use Soft Mallet to change"); provider.add("gtceu.machine.energy_converter.description", "Converts Energy between EU and FE"); - provider.add("gtceu.machine.energy_converter.tooltip_tool_usage", "Starts as §fFE Converter§7, use Soft Mallet to change"); - provider.add("gtceu.machine.energy_converter.tooltip_conversion_native", "§cNative Conversion: §f%d FE -> %dA %d EU (%s§f)"); - provider.add("gtceu.machine.energy_converter.message_conversion_native", "Converting Native Energy, In: %d FE, Out: %dA %d EU"); - provider.add("gtceu.machine.energy_converter.tooltip_conversion_eu", "§aEU Conversion: §f%dA %d EU (%s§f) -> %d Native"); - provider.add("gtceu.machine.energy_converter.message_conversion_eu", "Converting EU, In: %dA %d EU, Out: %d Native"); + provider.add("gtceu.machine.energy_converter.tooltip_tool_usage", + "Starts as §fFE Converter§7, use Soft Mallet to change"); + provider.add("gtceu.machine.energy_converter.tooltip_conversion_native", + "§cNative Conversion: §f%d FE -> %dA %d EU (%s§f)"); + provider.add("gtceu.machine.energy_converter.message_conversion_native", + "Converting Native Energy, In: %d FE, Out: %dA %d EU"); + provider.add("gtceu.machine.energy_converter.tooltip_conversion_eu", + "§aEU Conversion: §f%dA %d EU (%s§f) -> %d Native"); + provider.add("gtceu.machine.energy_converter.message_conversion_eu", + "Converting EU, In: %dA %d EU, Out: %d Native"); provider.add("gtceu.machine.pump.tooltip", "§7The best way to empty Oceans!"); provider.add("gtceu.machine.pump.tooltip_buckets", "§f%d §7ticks per Bucket"); provider.add("gtceu.machine.item_collector.gui.collect_range", "Collect within an area of %sx%s blocks"); @@ -326,22 +335,35 @@ protected static void init(RegistrateLangProvider provider) { provider.add("gtceu.machine.quantum_chest.tooltip", "§7Better than Storage Drawers"); provider.add("gtceu.machine.quantum_chest.items_stored", "Item Amount:"); provider.add("gtceu.machine.quantum_tank.tooltip", "§7Compact place to store all your fluids"); - + provider.add("gtceu.machine.buffer.tooltip", "A Small Buffer to store Items and Fluids"); // Gas Collector - provider.add("gtceu.machine.lv_gas_collector.tooltip", "§7Collects Gas from the air depending on the dimension"); - provider.add("gtceu.machine.mv_gas_collector.tooltip", "§7Collects Gas from the air depending on the dimension"); - provider.add("gtceu.machine.hv_gas_collector.tooltip", "§7Collects Gas from the air depending on the dimension"); - provider.add("gtceu.machine.ev_gas_collector.tooltip", "§7Collects Gas from the air depending on the dimension"); - provider.add("gtceu.machine.iv_gas_collector.tooltip", "§7Collects Gas from the atmosphere depending on the dimension"); - provider.add("gtceu.machine.luv_gas_collector.tooltip", "§7Collects Gas from the atmosphere depending on the dimension"); - provider.add("gtceu.machine.zpm_gas_collector.tooltip", "§7Collects Gas from the atmosphere depending on the dimension"); - provider.add("gtceu.machine.uv_gas_collector.tooltip", "§7Collects Gas from the solar system depending on the dimension"); - provider.add("gtceu.machine.uhv_gas_collector.tooltip", "§7Collects Gas from the solar system depending on the dimension"); - provider.add("gtceu.machine.uev_gas_collector.tooltip", "§7Collects Gas from the solar system depending on the dimension"); - provider.add("gtceu.machine.uiv_gas_collector.tooltip", "§7Collects Gas from the solar system depending on the dimension"); - provider.add("gtceu.machine.uxv_gas_collector.tooltip", "§7Collects Gas from the solar system depending on the dimension"); - provider.add("gtceu.machine.opv_gas_collector.tooltip", "§7Collects Gas from the universe depending on the dimension"); + provider.add("gtceu.machine.lv_gas_collector.tooltip", + "§7Collects Gas from the air depending on the dimension"); + provider.add("gtceu.machine.mv_gas_collector.tooltip", + "§7Collects Gas from the air depending on the dimension"); + provider.add("gtceu.machine.hv_gas_collector.tooltip", + "§7Collects Gas from the air depending on the dimension"); + provider.add("gtceu.machine.ev_gas_collector.tooltip", + "§7Collects Gas from the air depending on the dimension"); + provider.add("gtceu.machine.iv_gas_collector.tooltip", + "§7Collects Gas from the atmosphere depending on the dimension"); + provider.add("gtceu.machine.luv_gas_collector.tooltip", + "§7Collects Gas from the atmosphere depending on the dimension"); + provider.add("gtceu.machine.zpm_gas_collector.tooltip", + "§7Collects Gas from the atmosphere depending on the dimension"); + provider.add("gtceu.machine.uv_gas_collector.tooltip", + "§7Collects Gas from the solar system depending on the dimension"); + provider.add("gtceu.machine.uhv_gas_collector.tooltip", + "§7Collects Gas from the solar system depending on the dimension"); + provider.add("gtceu.machine.uev_gas_collector.tooltip", + "§7Collects Gas from the solar system depending on the dimension"); + provider.add("gtceu.machine.uiv_gas_collector.tooltip", + "§7Collects Gas from the solar system depending on the dimension"); + provider.add("gtceu.machine.uxv_gas_collector.tooltip", + "§7Collects Gas from the solar system depending on the dimension"); + provider.add("gtceu.machine.opv_gas_collector.tooltip", + "§7Collects Gas from the universe depending on the dimension"); // Rock Breaker provider.add("gtceu.machine.lv_rock_crusher.tooltip", "§7Place Water and Lava horizontally adjacent"); provider.add("gtceu.machine.mv_rock_crusher.tooltip", "§7Place Water and Lava horizontally adjacent"); @@ -361,7 +383,8 @@ protected static void init(RegistrateLangProvider provider) { provider.add("gtceu.machine.fisher.speed", "Catches something every %d ticks"); provider.add("gtceu.machine.fisher.requirement", "Requires a %dx%d centered square of water directly below."); // World Accelerator - provider.add("gtceu.machine.world_accelerator.description", "Tick accelerates nearby blocks in one of 2 modes: §fTile Entity§7 or §fRandom Tick§7. Use Screwdriver to change mode."); + provider.add("gtceu.machine.world_accelerator.description", + "Tick accelerates nearby blocks in one of 2 modes: §fTile Entity§7 or §fRandom Tick§7. Use Screwdriver to change mode."); provider.add("gtceu.machine.world_accelerator.working_area", "§bWorking Area:"); provider.add("gtceu.machine.world_accelerator.working_area_tile", " Block Entity Mode:§f Adjacent Blocks"); provider.add("gtceu.machine.world_accelerator.working_area_random", " Random Tick Mode:§f %dx%d"); @@ -378,8 +401,10 @@ protected static void init(RegistrateLangProvider provider) { provider.add("gtceu.machine.hpca.computation_component.damaged.name", "Damaged HPCA Computation Component"); provider.add("gtceu.machine.hpca.computation_component.damaged.tooltip", "Free recyclable materials"); - provider.add("gtceu.machine.hpca.advanced_computation_component.damaged.name", "Damaged HPCA Advanced Computation Component"); - provider.add("gtceu.machine.hpca.advanced_computation_component.damaged.tooltip", "It only cost an arm and a leg"); + provider.add("gtceu.machine.hpca.advanced_computation_component.damaged.name", + "Damaged HPCA Advanced Computation Component"); + provider.add("gtceu.machine.hpca.advanced_computation_component.damaged.tooltip", + "It only cost an arm and a leg"); provider.add("gtceu.machine.hpca.component_general.upkeep_eut", "§eUpkeep Energy: §f%d EU/t"); provider.add("gtceu.machine.hpca.component_general.max_eut", "§6Max Energy: §f%d EU/t"); @@ -393,17 +418,19 @@ protected static void init(RegistrateLangProvider provider) { provider.add("gtceu.machine.hpca.component_type.damaged", "Can be damaged by HPCA overheating!"); multiLang(provider, "gtceu.machine.electric_blast_furnace.tooltip", - "For every §f900K§7 above the recipe temperature, a multiplicative §f95%%§7 energy multiplier is applied pre-overclocking.", - "For every §f1800K§7 above the recipe temperature, one overclock becomes §f100%% efficient§7 (perfect overclock).", - "For every voltage tier above §bMV§7, temperature is increased by §f100K§7."); - + "For every §f900K§7 above the recipe temperature, a multiplicative §f95%%§7 energy multiplier is applied pre-overclocking.", + "For every §f1800K§7 above the recipe temperature, one overclock becomes §f100%% efficient§7 (perfect overclock).", + "For every voltage tier above §bMV§7, temperature is increased by §f100K§7."); provider.add("gtceu.machine.coke_oven_hatch.tooltip", "§7Allows automation access for the Coke Oven."); - provider.add("gtceu.machine.canner.jei_description", "You can fill and empty any fluid containers with the Fluid Canner (e.g. Buckets or Fluid Cells)"); + provider.add("gtceu.machine.canner.jei_description", + "You can fill and empty any fluid containers with the Fluid Canner (e.g. Buckets or Fluid Cells)"); - provider.add("gtceu.machine.large_combustion_engine.tooltip.boost_regular", "Supply §f20 L/s§7 of Oxygen to produce up to §f%s EU/t§7 at §f2x§7 fuel consumption."); - provider.add("gtceu.machine.large_combustion_engine.tooltip.boost_extreme", "Supply §f80 L/s§7 of Liquid Oxygen to produce up to §f%s EU/t§7 at §f2x§7 fuel consumption."); + provider.add("gtceu.machine.large_combustion_engine.tooltip.boost_regular", + "Supply §f20 L/s§7 of Oxygen to produce up to §f%s EU/t§7 at §f2x§7 fuel consumption."); + provider.add("gtceu.machine.large_combustion_engine.tooltip.boost_extreme", + "Supply §f80 L/s§7 of Liquid Oxygen to produce up to §f%s EU/t§7 at §f2x§7 fuel consumption."); provider.add("gtceu.machine.fusion_reactor.capacity", "§7Maximum Energy Storage: §e%sM EU"); provider.add("gtceu.machine.fusion_reactor.overclocking", "Overclocks double energy and halve duration."); @@ -413,7 +440,8 @@ protected static void init(RegistrateLangProvider provider) { provider.add("gtceu.machine.miner.multi.modes", "Has Silk Touch and Chunk Aligned Modes."); provider.add("gtceu.machine.miner.multi.production", "Produces §f3x§7 more crushed ore than a §fMacerator§7."); provider.add("gtceu.machine.miner.fluid_usage", "Uses §f%d L/t §7of §f%s§7, doubled per overclock."); - provider.add("gtceu.machine.miner.multi.description", "A multiblock mining machine that covers a large area and produces huge quantity of ore."); + provider.add("gtceu.machine.miner.multi.description", + "A multiblock mining machine that covers a large area and produces huge quantity of ore."); provider.add("gtceu.machine.miner.startx", "sX: %d"); provider.add("gtceu.machine.miner.starty", "sY: %d"); provider.add("gtceu.machine.miner.startz", "sZ: %d"); @@ -442,59 +470,97 @@ protected static void init(RegistrateLangProvider provider) { "Generators, Mufflers, Drills, and Primitive Machines are too dirty for the cleanroom!", "Send power through §fHulls §7or §fDiodes §7in the walls."); provider.add("gtceu.machine.cleanroom.tooltip.hold_ctrl", "Hold CTRL to show additional Structure Information"); - provider.add("gtceu.machine.cleanroom.tooltip.ae2.channels", "Send up to §f8 AE2 Channels §7through §fHulls§7 in the walls."); - provider.add("gtceu.machine.cleanroom.tooltip.ae2.no_channels", "Send §aAE2 Networks§7 through §fHulls§7 in the walls."); + provider.add("gtceu.machine.cleanroom.tooltip.ae2.channels", + "Send up to §f8 AE2 Channels §7through §fHulls§7 in the walls."); + provider.add("gtceu.machine.cleanroom.tooltip.ae2.no_channels", + "Send §aAE2 Networks§7 through §fHulls§7 in the walls."); provider.add("gtceu.multiblock.cleanroom.clean_state", "Status: §aCLEAN"); provider.add("gtceu.multiblock.cleanroom.dirty_state", "Status: §4CONTAMINATED"); provider.add("gtceu.multiblock.cleanroom.clean_amount", "Cleanliness: §a%s%%"); - multiLang(provider, "gtceu.machine.charcoal_pile.tooltip", "Turns Logs into §aCharcoal§7 when §cignited§7.", "Right Click with fire-starting items to start.", "Pyrolysis occurs in up to a §b9x4x9§7 space beneath.", "Logs must be not be exposed to §eAir§7!"); - multilineLang(provider, "gtceu.multiblock.charcoal_pile.description", "Converts logs into Brittle Charcoal in a 9x4x9 area beneath it.\n\nThe floor of the pit must be made from bricks, and any ground-related block can be used for the walls and roof. No air can be inside the pit.\n\nLarger pits take more time to process logs, but are more efficient."); + multiLang(provider, "gtceu.machine.charcoal_pile.tooltip", "Turns Logs into §aCharcoal§7 when §cignited§7.", + "Right Click with fire-starting items to start.", + "Pyrolysis occurs in up to a §b9x4x9§7 space beneath.", "Logs must be not be exposed to §eAir§7!"); + multilineLang(provider, "gtceu.multiblock.charcoal_pile.description", + "Converts logs into Brittle Charcoal in a 9x4x9 area beneath it.\n\nThe floor of the pit must be made from bricks, and any ground-related block can be used for the walls and roof. No air can be inside the pit.\n\nLarger pits take more time to process logs, but are more efficient."); provider.add("gtceu.multiblock.central_monitor.low_power", "Low Power"); provider.add("gtceu.multiblock.central_monitor.height", "Screen Height:"); provider.add("gtceu.multiblock.central_monitor.width", "Screen Width: %d"); provider.add("gtceu.multiblock.central_monitor.height_modify", "Modify Height: %d"); - multiLang(provider, "gtceu.multiblock.central_monitor.tooltip", "This is a machine that monitors machines proxied by the Digital Interface Cover. You can easily monitor the Fluids, Items, Energy, and States of machines proxied in Energy Network.", "You can build the central monitor screen from 3X2 to %dX%d (width X height).", "The default height is 3. You can adjust the screen height in the GUI before the structure is formed.", "Energy consumption: %d EU/s for each screen."); - multiLang(provider, "gtceu.multiblock.monitor_screen.tooltip", "The GUI can be opened with a right-click of a screwdriver.", "The proxy mode of Digital Interface Cover can delegate machines' capabilities and GUI. (Yes, you can connect pipes directly on the screen.)", "The screen also supports plugins."); - - provider.add("gtceu.multiblock.steam_grinder.description", "A Multiblock Macerator at the Steam Age. Requires at least 14 Bronze Casings to form. Cannot use normal Input/Output busses, nor Fluid Hatches other than the Steam Hatch."); + multiLang(provider, "gtceu.multiblock.central_monitor.tooltip", + "This is a machine that monitors machines proxied by the Digital Interface Cover. You can easily monitor the Fluids, Items, Energy, and States of machines proxied in Energy Network.", + "You can build the central monitor screen from 3X2 to %dX%d (width X height).", + "The default height is 3. You can adjust the screen height in the GUI before the structure is formed.", + "Energy consumption: %d EU/s for each screen."); + multiLang(provider, "gtceu.multiblock.monitor_screen.tooltip", + "The GUI can be opened with a right-click of a screwdriver.", + "The proxy mode of Digital Interface Cover can delegate machines' capabilities and GUI. (Yes, you can connect pipes directly on the screen.)", + "The screen also supports plugins."); + + provider.add("gtceu.multiblock.steam_grinder.description", + "A Multiblock Macerator at the Steam Age. Requires at least 14 Bronze Casings to form. Cannot use normal Input/Output busses, nor Fluid Hatches other than the Steam Hatch."); provider.add("gtceu.multiblock.steam.low_steam", "Not enough Steam to run!"); provider.add("gtceu.multiblock.steam.steam_stored", "Steam: %s / %s mb"); - provider.add("gtceu.multiblock.steam.duration_modifier", "Takes §f1.5x §7base duration to process, not affected by number of items."); + provider.add("gtceu.multiblock.steam.duration_modifier", + "Takes §f1.5x §7base duration to process, not affected by number of items."); provider.add("gtceu.machine.steam.steam_hatch.tooltip", "§eAccepted Fluid: §fSteam"); provider.add("gtceu.machine.steam_bus.tooltip", "Does not work with non-steam multiblocks"); - provider.add("gtceu.multiblock.steam_oven.description", "A Multi Smelter at the Steam Age. Requires at least 6 Bronze Casings to form. Cannot use normal Input/Output busses, nor Fluid Hatches other than the Steam Hatch. Steam Hatch must be on the bottom layer, no more than one."); + provider.add("gtceu.multiblock.steam_oven.description", + "A Multi Smelter at the Steam Age. Requires at least 6 Bronze Casings to form. Cannot use normal Input/Output busses, nor Fluid Hatches other than the Steam Hatch. Steam Hatch must be on the bottom layer, no more than one."); provider.add("gtceu.multiblock.require_steam_parts", "Requires Steam Hatches and Buses!"); provider.add("gtceu.multiblock.title", "Multiblock Pattern"); // Misc multiblock descriptions - provider.add("gtceu.multiblock.primitive_blast_furnace.bronze.description", "The Primitive Blast Furnace (PBF) is a multiblock structure used for cooking steel in the early game. Although not very fast, it will provide you with steel for your first setups."); - provider.add("gtceu.multiblock.coke_oven.description", "The Coke Oven is a multiblock structure used for getting coke and creosote in the early game. It doesn't require fuel and has an internal tank of 32 buckets for creosote. Its inventory can be accessed via its Coke Oven Hatch."); - provider.add("gtceu.multiblock.vacuum_freezer.description", "The Vacuum Freezer is a multiblock structure mainly used for freezing Hot Ingots into regular Ingots. However, it can also freeze other substances, such as Water."); - provider.add("gtceu.multiblock.implosion_compressor.description", "The Implosion Compressor is a multiblock structure that uses explosives to turn gem dusts into their corresponding gems."); - provider.add("gtceu.multiblock.pyrolyse_oven.description", "The Pyrolyse Oven is a multiblock structure used for turning Logs into Charcoal and Creosote Oil, or Ash and Heavy Oil."); - provider.add("gtceu.multiblock.cracker.description", "The Oil Cracking Unit is a multiblock structure used for turning Light and Heavy Fuel into their Cracked variants."); - provider.add("gtceu.multiblock.large_combustion_engine.description", "The Large Combustion Engine is a multiblock structure that acts as a Combustion Generator for EV power."); - provider.add("gtceu.multiblock.extreme_combustion_engine.description", "The Extreme Combustion Engine is a multiblock structure that acts as a Combustion Generator for IV power."); - provider.add("gtceu.multiblock.distillation_tower.description", "The Distillation Tower is a multiblock structure used for distilling the various types of Oil and some of their byproducts. Each layer must have exactly one output hatch, starting from the second one. The bottom layer can output items and insert fluids in any position."); - provider.add("gtceu.multiblock.electric_blast_furnace.description", "The Electric Blast Furnace (EBF) is a multiblock structure used for smelting alloys, cooking metals and refining ores. It is required for obtaining high-tier alloys and metals, such as aluminium, stainless steel, titanium, and naquadah alloy."); - provider.add("gtceu.multiblock.multi_furnace.description", "The Multi Smelter is a multiblock structure used for smelting massive amounts of items at once. Different tiers of coils provide a speed boost and energy efficiency gain. 32 is the base value of items smelted per operation, and can be multiplied by using higher level coils."); - provider.add("gtceu.multiblock.large_boiler.description", "Large Boilers are multiblocks that generate steam from an energy source and water. Said energy source is either any Solid Fuel with a Burn Time, or a Diesel/Semi-Fluid Fuel. Can be throttled back in increments of 5%% to reduce Steam output and Fuel consumption."); - provider.add("gtceu.multiblock.large_turbine.description", "Large Turbines are multiblocks that generate power from steam, gases, and plasma by having them spin the turbine's rotor. Energy output is based on rotor efficiency and current speed of turbine. Gearbox casings are used in the center of the structure."); - provider.add("gtceu.multiblock.assembly_line.description", "The Assembly Line is a large multiblock structure consisting of 5 to 16 \"slices\". In theory, it's large Assembling Machine, used for creating advanced crafting components."); - provider.add("gtceu.multiblock.luv_fusion_reactor.description", "The Fusion Reactor MK 1 is a large multiblock structure used for fusing elements into heavier ones. It can only use LuV, ZPM, and UV Energy Hatches. For every Hatch it has, its buffer increases by 10M EU, and has a maximum of 160M."); - provider.add("gtceu.multiblock.zpm_fusion_reactor.description", "The Fusion Reactor MK 2 is a large multiblock structure used for fusing elements into heavier ones. It can only use ZPM and UV Energy Hatches. For every Hatch it has, its buffer increases by 20M EU, and has a maximum of 320M."); - provider.add("gtceu.multiblock.uv_fusion_reactor.description", "The Fusion Reactor MK 3 is a large multiblock structure used for fusing elements into heavier ones. It can only use UV Energy Hatches. For every Hatch it has, its buffer increases by 40M EU, and has a maximum of 640M."); + provider.add("gtceu.multiblock.primitive_blast_furnace.bronze.description", + "The Primitive Blast Furnace (PBF) is a multiblock structure used for cooking steel in the early game. Although not very fast, it will provide you with steel for your first setups."); + provider.add("gtceu.multiblock.coke_oven.description", + "The Coke Oven is a multiblock structure used for getting coke and creosote in the early game. It doesn't require fuel and has an internal tank of 32 buckets for creosote. Its inventory can be accessed via its Coke Oven Hatch."); + provider.add("gtceu.multiblock.vacuum_freezer.description", + "The Vacuum Freezer is a multiblock structure mainly used for freezing Hot Ingots into regular Ingots. However, it can also freeze other substances, such as Water."); + provider.add("gtceu.multiblock.implosion_compressor.description", + "The Implosion Compressor is a multiblock structure that uses explosives to turn gem dusts into their corresponding gems."); + provider.add("gtceu.multiblock.pyrolyse_oven.description", + "The Pyrolyse Oven is a multiblock structure used for turning Logs into Charcoal and Creosote Oil, or Ash and Heavy Oil."); + provider.add("gtceu.multiblock.cracker.description", + "The Oil Cracking Unit is a multiblock structure used for turning Light and Heavy Fuel into their Cracked variants."); + provider.add("gtceu.multiblock.large_combustion_engine.description", + "The Large Combustion Engine is a multiblock structure that acts as a Combustion Generator for EV power."); + provider.add("gtceu.multiblock.extreme_combustion_engine.description", + "The Extreme Combustion Engine is a multiblock structure that acts as a Combustion Generator for IV power."); + provider.add("gtceu.multiblock.distillation_tower.description", + "The Distillation Tower is a multiblock structure used for distilling the various types of Oil and some of their byproducts. Each layer must have exactly one output hatch, starting from the second one. The bottom layer can output items and insert fluids in any position."); + provider.add("gtceu.multiblock.electric_blast_furnace.description", + "The Electric Blast Furnace (EBF) is a multiblock structure used for smelting alloys, cooking metals and refining ores. It is required for obtaining high-tier alloys and metals, such as aluminium, stainless steel, titanium, and naquadah alloy."); + provider.add("gtceu.multiblock.multi_furnace.description", + "The Multi Smelter is a multiblock structure used for smelting massive amounts of items at once. Different tiers of coils provide a speed boost and energy efficiency gain. 32 is the base value of items smelted per operation, and can be multiplied by using higher level coils."); + provider.add("gtceu.multiblock.large_boiler.description", + "Large Boilers are multiblocks that generate steam from an energy source and water. Said energy source is either any Solid Fuel with a Burn Time, or a Diesel/Semi-Fluid Fuel. Can be throttled back in increments of 5%% to reduce Steam output and Fuel consumption."); + provider.add("gtceu.multiblock.large_turbine.description", + "Large Turbines are multiblocks that generate power from steam, gases, and plasma by having them spin the turbine's rotor. Energy output is based on rotor efficiency and current speed of turbine. Gearbox casings are used in the center of the structure."); + provider.add("gtceu.multiblock.assembly_line.description", + "The Assembly Line is a large multiblock structure consisting of 5 to 16 \"slices\". In theory, it's large Assembling Machine, used for creating advanced crafting components."); + provider.add("gtceu.multiblock.luv_fusion_reactor.description", + "The Fusion Reactor MK 1 is a large multiblock structure used for fusing elements into heavier ones. It can only use LuV, ZPM, and UV Energy Hatches. For every Hatch it has, its buffer increases by 10M EU, and has a maximum of 160M."); + provider.add("gtceu.multiblock.zpm_fusion_reactor.description", + "The Fusion Reactor MK 2 is a large multiblock structure used for fusing elements into heavier ones. It can only use ZPM and UV Energy Hatches. For every Hatch it has, its buffer increases by 20M EU, and has a maximum of 320M."); + provider.add("gtceu.multiblock.uv_fusion_reactor.description", + "The Fusion Reactor MK 3 is a large multiblock structure used for fusing elements into heavier ones. It can only use UV Energy Hatches. For every Hatch it has, its buffer increases by 40M EU, and has a maximum of 640M."); provider.add("gtceu.multiblock.fusion_reactor.energy", "EU: %d / %d"); provider.add("gtceu.multiblock.fusion_reactor.heat", "Heat: %d"); - provider.add("gtceu.multiblock.large_chemical_reactor.description", "The Large Chemical Reactor performs chemical reactions at 100%% energy efficiency. Overclocks multiply both speed and energy by 4. The multiblock requires exactly 1 Cupronickel Coil Block, which must be placed adjacent to the PTFE Pipe casing located in the center."); + provider.add("gtceu.multiblock.large_chemical_reactor.description", + "The Large Chemical Reactor performs chemical reactions at 100%% energy efficiency. Overclocks multiply both speed and energy by 4. The multiblock requires exactly 1 Cupronickel Coil Block, which must be placed adjacent to the PTFE Pipe casing located in the center."); // Primitive pump - provider.add("gtceu.multiblock.primitive_water_pump.description", "The Primitive Water Pump is a pre-Steam Era multiblock that collects water once per second, depending on the Biome it is in. It can use a Pump, ULV, or LV Output Hatch, increasing the amount of water per tier. Follows the formula: Biome Coefficient * Hatch Multiplier."); - multilineLang(provider, "gtceu.multiblock.primitive_water_pump.extra1", "Biome Coefficient:\n Ocean, River: 1000 L/s\n Swamp: 800 L/s\n Jungle: 350 L/s\n Snowy: 300 L/s\n Plains, Forest: 250 L/s\n Taiga: 175 L/s\n Beach: 170 L/s\n Other: 100 L/s"); - multilineLang(provider, "gtceu.multiblock.primitive_water_pump.extra2", "Hatch Multipliers:\n Pump Hatch: 1x\n ULV Output Hatch: 2x\n LV Output Hatch: 4x\n\nWhile raining in the Pump's Biome, the total water production will be increased by 50%%."); - provider.add("gtceu.multiblock.processing_array.description", "The Processing Array combines up to 16 single block machine(s) in a single multiblock, effectively easing automation."); - provider.add("gtceu.multiblock.advanced_processing_array.description", "The Processing Array combines up to 64 single block machine(s) in a single multiblock, effectively easing automation."); + provider.add("gtceu.multiblock.primitive_water_pump.description", + "The Primitive Water Pump is a pre-Steam Era multiblock that collects water once per second, depending on the Biome it is in. It can use a Pump, ULV, or LV Output Hatch, increasing the amount of water per tier. Follows the formula: Biome Coefficient * Hatch Multiplier."); + multilineLang(provider, "gtceu.multiblock.primitive_water_pump.extra1", + "Biome Coefficient:\n Ocean, River: 1000 L/s\n Swamp: 800 L/s\n Jungle: 350 L/s\n Snowy: 300 L/s\n Plains, Forest: 250 L/s\n Taiga: 175 L/s\n Beach: 170 L/s\n Other: 100 L/s"); + multilineLang(provider, "gtceu.multiblock.primitive_water_pump.extra2", + "Hatch Multipliers:\n Pump Hatch: 1x\n ULV Output Hatch: 2x\n LV Output Hatch: 4x\n\nWhile raining in the Pump's Biome, the total water production will be increased by 50%%."); + provider.add("gtceu.multiblock.processing_array.description", + "The Processing Array combines up to 16 single block machine(s) in a single multiblock, effectively easing automation."); + provider.add("gtceu.multiblock.advanced_processing_array.description", + "The Processing Array combines up to 64 single block machine(s) in a single multiblock, effectively easing automation."); // Parallel provider.add("gtceu.multiblock.parallelizable.tooltip", "Can parallelize with Parallel Control Hatches."); provider.add("gtceu.machine.parallel_hatch_mk5.tooltip", "Allows to run up to 4 recipes in parallel."); @@ -509,13 +575,15 @@ protected static void init(RegistrateLangProvider provider) { provider.add("gtceu.machine.vacuum_freezer.tooltip", "Aluminium Ice Box"); provider.add("gtceu.machine.implosion_compressor.tooltip", "The only Machine you want to go Boom"); provider.add("gtceu.machine.pyrolyse_oven.tooltip", "Electric Coke Oven"); - provider.add("gtceu.machine.pyrolyse_oven.tooltip.1", "§6Cupronickel §7coils are §f25%%§7 slower. Every coil after §bKanthal§7 increases speed by §f50%%§7."); + provider.add("gtceu.machine.pyrolyse_oven.tooltip.1", + "§6Cupronickel §7coils are §f25%%§7 slower. Every coil after §bKanthal§7 increases speed by §f50%%§7."); provider.add("gtceu.machine.distillation_tower.tooltip", "Fluid Refinery"); provider.add("gtceu.machine.multi_furnace.tooltip", "Just like the Oven at Home"); provider.add("gtceu.machine.large_combustion_engine.tooltip", "Fuel Ignition Chamber"); provider.add("gtceu.machine.extreme_combustion_engine.tooltip", "Extreme Chemical Energy Releaser"); provider.add("gtceu.machine.cracker.tooltip", "Makes Oil useful"); - provider.add("gtceu.machine.cracker.tooltip.1", "Every coil after §6Cupronickel§7 reduces energy usage by §f10%%§7."); + provider.add("gtceu.machine.cracker.tooltip.1", + "Every coil after §6Cupronickel§7 reduces energy usage by §f10%%§7."); provider.add("gtceu.machine.large_turbine.steam.tooltip", "Do not put your Head in it"); provider.add("gtceu.machine.large_turbine.gas.tooltip", "Not a Jet Engine"); provider.add("gtceu.machine.large_turbine.plasma.tooltip", "Plasma Energy Siphon"); @@ -544,73 +612,69 @@ protected static void init(RegistrateLangProvider provider) { provider.add("gtceu.machine.charcoal_pile.tooltip", "Underground fuel bakery"); multiLang(provider, "gtceu.machine.data_bank.tooltip", - "Your Personal NAS", - "Bulk Data Storage. Transfer with Optical Cables.", - "Data Banks can be chained together.", - "Uses §f%s EU/t§7 per Data/Optical Hatch normally.", - "Uses §f%s EU/t§7 per Data/Optical Hatch when chained." - ); - provider.add("gtceu.multiblock.data_bank.description", "The Data Bank is a multiblock structure used for sharing Assembly Line Research Data between multiple Assembly Lines. Additionally, it enables Assembly Lines to read more complex research data on Data Modules."); + "Your Personal NAS", + "Bulk Data Storage. Transfer with Optical Cables.", + "Data Banks can be chained together.", + "Uses §f%s EU/t§7 per Data/Optical Hatch normally.", + "Uses §f%s EU/t§7 per Data/Optical Hatch when chained."); + provider.add("gtceu.multiblock.data_bank.description", + "The Data Bank is a multiblock structure used for sharing Assembly Line Research Data between multiple Assembly Lines. Additionally, it enables Assembly Lines to read more complex research data on Data Modules."); multiLang(provider, "gtceu.machine.power_substation.tooltip", - "The heart of a centralized power grid", - "§fCapacitors§7 do not need to be all the same tier.", - "Allows up to §f%d Capacitor Layers§7.", - "Loses energy equal to §f1%%§7 of total capacity every §f24 hours§7.", - "Capped at §f%d kEU/t§7 passive loss per Capacitor Block.", - "Can use", - " Laser Hatches§7." - ); + "The heart of a centralized power grid", + "§fCapacitors§7 do not need to be all the same tier.", + "Allows up to §f%d Capacitor Layers§7.", + "Loses energy equal to §f1%%§7 of total capacity every §f24 hours§7.", + "Capped at §f%d kEU/t§7 passive loss per Capacitor Block.", + "Can use", + " Laser Hatches§7."); multiLang(provider, "gtceu.machine.active_transformer.tooltip", - "§7Transformers: Lasers in Disguise", - "§7Can combine any number of Energy §fInputs§7 into any number of Energy §fOutputs§7.", - "§7Can transmit power at incredible distance with", - " Lasers§7." - ); + "§7Transformers: Lasers in Disguise", + "§7Can combine any number of Energy §fInputs§7 into any number of Energy §fOutputs§7.", + "§7Can transmit power at incredible distance with", + " Lasers§7."); provider.add("gtceu.machine.laser_hatch.source.tooltip", "§7Transmitting power at distance"); provider.add("gtceu.machine.laser_hatch.target.tooltip", "§7Receiving power from distance"); provider.add("gtceu.machine.laser_hatch.both.tooltip", "§cLaser Cables must be in a straight line!§7"); multiLang(provider, "gtceu.machine.research_station.tooltip", - "More than just a Multiblock Scanner", - "Used to scan onto §fData Orbs§7 and §fData Modules§7.", - "Requires §fComputation§7 to work.", - "Providing more Computation allows the recipe to run faster." - ); - provider.add("gtceu.multiblock.research_station.description", "The Research Station is a multiblock structure used for researching much more complex Assembly Line Research Data. Any Research requiring a Data Orb or Data Module must be scanned in the Research Station. Requires Compute Work Units (CWU/t) to research recipes, which is supplied by High Performance Computing Arrays (HPCAs)."); + "More than just a Multiblock Scanner", + "Used to scan onto §fData Orbs§7 and §fData Modules§7.", + "Requires §fComputation§7 to work.", + "Providing more Computation allows the recipe to run faster."); + provider.add("gtceu.multiblock.research_station.description", + "The Research Station is a multiblock structure used for researching much more complex Assembly Line Research Data. Any Research requiring a Data Orb or Data Module must be scanned in the Research Station. Requires Compute Work Units (CWU/t) to research recipes, which is supplied by High Performance Computing Arrays (HPCAs)."); provider.add("gtceu.machine.research_station.researching", "Researching."); multiLang(provider, "gtceu.machine.network_switch.tooltip", - "Ethernet Hub", - "Used to route and distribute §fComputation§7.", - "Can combine any number of Computation §fReceivers§7 into any number of Computation §fTransmitters§7.", - "Uses §f%s EU/t§7 per Computation Data Hatch." - ); - provider.add("gtceu.multiblock.network_switch.description", "The Network Switch is a multiblock structure used for distributing Computation from many sources to many destinations. It can accept any number of Computation Data Reception or Transmission Hatches. It is necessary for Research Data which requires much higher Computation, as the Research Station can only accept one Computation Data Reception Hatch. HPCAs must have a Bridge Component for the Network Switch to be able to access their Computation."); + "Ethernet Hub", + "Used to route and distribute §fComputation§7.", + "Can combine any number of Computation §fReceivers§7 into any number of Computation §fTransmitters§7.", + "Uses §f%s EU/t§7 per Computation Data Hatch."); + provider.add("gtceu.multiblock.network_switch.description", + "The Network Switch is a multiblock structure used for distributing Computation from many sources to many destinations. It can accept any number of Computation Data Reception or Transmission Hatches. It is necessary for Research Data which requires much higher Computation, as the Research Station can only accept one Computation Data Reception Hatch. HPCAs must have a Bridge Component for the Network Switch to be able to access their Computation."); multiLang(provider, "gtceu.machine.high_performance_computation_array.tooltip", - "Just your average Supercomputer", - "Used to generate §fComputation§7 (and heat).", - "Requires HPCA components to generate §fCWU/t§7 (Compute Work Units)." - ); - provider.add("gtceu.multiblock.hpca.description", "The High Performance Computing Array (HPCA) is a multiblock structure used for creating Compute Work Units (CWU/t) for more complex Assembly Line Research Data. The structure has a flexible 3x3 area which can be filled in any way with HPCA components. Different components can provide different amounts of Computation, Cooling, as well as Energy Cost, Coolant Cost, and Heat Production. When used with a Bridge Component, the HPCA can connect to Network Switches for combining and routing Computation from multiple sources to one or more destinations."); + "Just your average Supercomputer", + "Used to generate §fComputation§7 (and heat).", + "Requires HPCA components to generate §fCWU/t§7 (Compute Work Units)."); + provider.add("gtceu.multiblock.hpca.description", + "The High Performance Computing Array (HPCA) is a multiblock structure used for creating Compute Work Units (CWU/t) for more complex Assembly Line Research Data. The structure has a flexible 3x3 area which can be filled in any way with HPCA components. Different components can provide different amounts of Computation, Cooling, as well as Energy Cost, Coolant Cost, and Heat Production. When used with a Bridge Component, the HPCA can connect to Network Switches for combining and routing Computation from multiple sources to one or more destinations."); multiLang(provider, "gtceu.machine.laser_source_hatch.tooltip", - "Transmitting power at distance", - "§cLaser cables must be in a straight line!§7" - ); + "Transmitting power at distance", + "§cLaser cables must be in a straight line!§7"); multiLang(provider, "gtceu.machine.laser_target_hatch.tooltip", - "Receiving power from distance", - "§cLaser cables must be in a straight line!§7" - ); + "Receiving power from distance", + "§cLaser cables must be in a straight line!§7"); multiLang(provider, "gtceu.machine.endpoint.tooltip", - "Connect with §fLong Distance Pipe§7 blocks to create a pipeline.", - "Pipelines must have exactly §f1 Input§7 and §f1 Output§7 endpoint.", - "Only pipeline endpoints need to be §fchunk-loaded§7."); + "Connect with §fLong Distance Pipe§7 blocks to create a pipeline.", + "Pipelines must have exactly §f1 Input§7 and §f1 Output§7 endpoint.", + "Only pipeline endpoints need to be §fchunk-loaded§7."); provider.add("block.gtceu.long_distance_item_pipeline_no_network", "No network found"); provider.add("block.gtceu.long_distance_item_pipeline_input_endpoint", "Input Endpoint"); provider.add("block.gtceu.long_distance_item_pipeline_output_endpoint", "Output Endpoint"); @@ -633,7 +697,8 @@ protected static void init(RegistrateLangProvider provider) { provider.add("gtceu.machine.energy_hatch.input_hi_amp.tooltip", "Multiple Ampere Energy Input for Multiblocks"); provider.add("gtceu.machine.substation_hatch.input.tooltip", "Energy Input for the Power Substation"); provider.add("gtceu.machine.energy_hatch.output.tooltip", "Energy Output for Multiblocks"); - provider.add("gtceu.machine.energy_hatch.output_hi_amp.tooltip", "Multiple Ampere Energy Output for Multiblocks"); + provider.add("gtceu.machine.energy_hatch.output_hi_amp.tooltip", + "Multiple Ampere Energy Output for Multiblocks"); provider.add("gtceu.machine.substation_hatch.output.tooltip", "Energy Output for the Power Substation"); // ME parts @@ -643,35 +708,46 @@ protected static void init(RegistrateLangProvider provider) { provider.add("gtceu.machine.me.item_import.tooltip", "Fetches items from an ME network automatically."); provider.add("gtceu.machine.me.export.tooltip", "Has infinite capacity before connecting to ME network."); - multiLang(provider, "gtceu.machine.rotor_holder.tooltip", "Rotor Holder for Multiblocks", "Holds Rotor in place so it will not fly away"); + multiLang(provider, "gtceu.machine.rotor_holder.tooltip", "Rotor Holder for Multiblocks", + "Holds Rotor in place so it will not fly away"); // Maintenance tooltips provider.add("gtceu.machine.maintenance_hatch.tooltip", "For maintaining Multiblocks"); - multilineLang(provider, "gtceu.machine.maintenance_hatch_configurable.tooltip", "For finer control over Multiblocks\nStarts with no Maintenance problems!"); + multilineLang(provider, "gtceu.machine.maintenance_hatch_configurable.tooltip", + "For finer control over Multiblocks\nStarts with no Maintenance problems!"); provider.add("gtceu.machine.maintenance_hatch_full_auto.tooltip", "For automatically maintaining Multiblocks"); - multiLang(provider, "gtceu.machine.maintenance_hatch_cleanroom_auto.tooltip", "For automatically maintaining Multiblocks with Cleaning!", "Cleans as:"); - provider.add("gtceu.machine.maintenance_hatch_tool_slot.tooltip", "Click slot with empty hand when required tools are in inventory to solve problems"); + multiLang(provider, "gtceu.machine.maintenance_hatch_cleanroom_auto.tooltip", + "For automatically maintaining Multiblocks with Cleaning!", "Cleans as:"); + provider.add("gtceu.machine.maintenance_hatch_tool_slot.tooltip", + "Click slot with empty hand when required tools are in inventory to solve problems"); provider.add("gtceu.machine.maintenance_hatch_tape_slot.tooltip", "Insert Tape to prevent problems"); provider.add("gtceu.maintenance.configurable_duration", "Duration: %fx"); - provider.add("gtceu.maintenance.configurable_duration.unchanged_description", "Recipes will run at normal speed. Change configuration to update."); - provider.add("gtceu.maintenance.configurable_duration.changed_description", "Recipes will run with %fx duration, applied before overclocking."); + provider.add("gtceu.maintenance.configurable_duration.unchanged_description", + "Recipes will run at normal speed. Change configuration to update."); + provider.add("gtceu.maintenance.configurable_duration.changed_description", + "Recipes will run with %fx duration, applied before overclocking."); provider.add("gtceu.maintenance.configurable_duration.modify", "Modify Duration:"); provider.add("gtceu.maintenance.configurable_time", "Time: %fx"); - provider.add("gtceu.maintenance.configurable_time.unchanged_description", "Maintenance problems will occur at normal rate. Change configuration to update."); - provider.add("gtceu.maintenance.configurable_time.changed_description", "Maintenance problems will occur at %fx the normal rate."); + provider.add("gtceu.maintenance.configurable_time.unchanged_description", + "Maintenance problems will occur at normal rate. Change configuration to update."); + provider.add("gtceu.maintenance.configurable_time.changed_description", + "Maintenance problems will occur at %fx the normal rate."); - multiLang(provider, "gtceu.machine.muffler_hatch.tooltip", "Recovers waste from machines", "DO NOT OBSTRUCT THE OUTPUT!"); + multiLang(provider, "gtceu.machine.muffler_hatch.tooltip", "Recovers waste from machines", + "DO NOT OBSTRUCT THE OUTPUT!"); provider.add("gtceu.muffler.recovery_tooltip", "§bRecovery Chance: §f%d%%"); provider.add("gtceu.machine.pump_hatch.tooltip", "Primitive Fluid Output for Water Pump"); provider.add("gtceu.machine.machine_hatch.locked", "Machine Interface Locked"); provider.add("gtceu.machine.machine_hatch.tooltip", "Specialized Access Bus that only holds valid items"); - provider.add("gtceu.machine.machine_hatch.processing_array", "When in the §eProcessing Array§7, only holds machines that work in the §eProcessing Array"); + provider.add("gtceu.machine.machine_hatch.processing_array", + "When in the §eProcessing Array§7, only holds machines that work in the §eProcessing Array"); provider.add("gtceu.machine.passthrough_hatch_item.tooltip", "Sends Items from one Side to the other"); provider.add("gtceu.machine.passthrough_hatch_fluid.tooltip", "Sends Fluids from one Side to the other"); provider.add("gtceu.machine.fluid_tank.max_multiblock", "Max Multiblock Size: %dx%dx%d"); provider.add("gtceu.machine.fluid_tank.fluid", "Contains %s L of %s"); - multiLang(provider, "gtceu.machine.data_access_hatch.tooltip", "Data Access for Multiblocks", "Adds §a%s§7 slots for Data Items"); + multiLang(provider, "gtceu.machine.data_access_hatch.tooltip", "Data Access for Multiblocks", + "Adds §a%s§7 slots for Data Items"); provider.add("gtceu.machine.data_receiver_hatch.tooltip", "Research Data Input for Multiblocks"); provider.add("gtceu.machine.data_transmitter_hatch.tooltip", "Research Data Output for Multiblocks"); provider.add("gtceu.machine.computation_transmitter_hatch.tooltip", "Computation Data Output for Multiblocks"); @@ -688,9 +764,11 @@ protected static void init(RegistrateLangProvider provider) { provider.add("gtceu.multiblock.large_combustion_engine.liquid_oxygen_amount", "Liquid Oxygen Amount: %sL"); provider.add("gtceu.multiblock.large_combustion_engine.oxygen_boosted", "§bOxygen boosted."); provider.add("gtceu.multiblock.large_combustion_engine.liquid_oxygen_boosted", "§bLiquid Oxygen boosted."); - provider.add("gtceu.multiblock.large_combustion_engine.boost_disallowed", "§bUpgrade the Dynamo Hatch to enable Oxygen Boosting."); + provider.add("gtceu.multiblock.large_combustion_engine.boost_disallowed", + "§bUpgrade the Dynamo Hatch to enable Oxygen Boosting."); provider.add("gtceu.multiblock.large_combustion_engine.supply_oxygen_to_boost", "Supply Oxygen to boost."); - provider.add("gtceu.multiblock.large_combustion_engine.supply_liquid_oxygen_to_boost", "Supply Liquid Oxygen to boost."); + provider.add("gtceu.multiblock.large_combustion_engine.supply_liquid_oxygen_to_boost", + "Supply Liquid Oxygen to boost."); provider.add("gtceu.multiblock.large_combustion_engine.obstructed", "Engine Intakes Obstructed."); provider.add("gtceu.multiblock.turbine.fuel_amount", "Fuel Amount: %sL (%s)"); provider.add("gtceu.multiblock.turbine.rotor_speed", "Rotor Speed: %s/%s RPM"); @@ -699,14 +777,16 @@ protected static void init(RegistrateLangProvider provider) { provider.add("gtceu.multiblock.turbine.energy_per_tick", "Energy Output: %s/%s EU/t"); provider.add("gtceu.multiblock.turbine.energy_per_tick_maxed", "Energy Output: %s EU/t"); provider.add("gtceu.multiblock.turbine.obstructed", "Turbine Face Obstructed"); - provider.add("gtceu.multiblock.turbine.efficiency_tooltip", "Each Rotor Holder above %s§7 adds §f10%% efficiency§7."); + provider.add("gtceu.multiblock.turbine.efficiency_tooltip", + "Each Rotor Holder above %s§7 adds §f10%% efficiency§7."); provider.add("gtceu.multiblock.turbine.fuel_needed", "Consumes %s per %s ticks"); provider.add("gtceu.multiblock.large_boiler.max_temperature", "Max Temperature: %dK, Steam Production: %dmB/t"); provider.add("gtceu.multiblock.large_boiler.efficiency", "Efficiency: %s"); provider.add("gtceu.multiblock.large_boiler.temperature", "Temperature: %sK / %sK"); provider.add("gtceu.multiblock.large_boiler.steam_output", "Steam Output: %s L/t"); provider.add("gtceu.multiblock.large_boiler.throttle", "Throttle: %d"); - provider.add("gtceu.multiblock.large_boiler.throttle.tooltip", "Boiler can output less Steam and consume less fuel (efficiency is not lost, does not affect heat-up time)"); + provider.add("gtceu.multiblock.large_boiler.throttle.tooltip", + "Boiler can output less Steam and consume less fuel (efficiency is not lost, does not affect heat-up time)"); provider.add("gtceu.multiblock.large_boiler.throttle_modify", "Modify Throttle:"); provider.add("gtceu.multiblock.large_boiler.rate_tooltip", "§7Produces §f%d L §7of Steam with §f1 Coal"); provider.add("gtceu.multiblock.large_boiler.heat_time_tooltip", "§7Takes §f%d seconds §7to boiling up"); @@ -734,9 +814,11 @@ protected static void init(RegistrateLangProvider provider) { provider.add("gtceu.multiblock.power_substation.capacity", "Capacity: %s EU"); provider.add("gtceu.multiblock.power_substation.passive_drain", "Passive Drain: %s EU/t"); provider.add("gtceu.multiblock.power_substation.average_in", "Avg. Input: %s EU/t"); - provider.add("gtceu.multiblock.power_substation.average_in_hover", "The average inserted EU into the Power Substation's internal energy bank"); + provider.add("gtceu.multiblock.power_substation.average_in_hover", + "The average inserted EU into the Power Substation's internal energy bank"); provider.add("gtceu.multiblock.power_substation.average_out", "Avg. Output: %s EU/t"); - provider.add("gtceu.multiblock.power_substation.average_out_hover", "The average extracted EU out of the Power Substation's internal energy bank"); + provider.add("gtceu.multiblock.power_substation.average_out_hover", + "The average extracted EU out of the Power Substation's internal energy bank"); provider.add("gtceu.multiblock.power_substation.time_to_fill", "Time to fill: %s"); provider.add("gtceu.multiblock.power_substation.time_to_drain", "Time to drain: %s"); provider.add("gtceu.multiblock.power_substation.time_seconds", "%s Seconds"); @@ -753,10 +835,12 @@ protected static void init(RegistrateLangProvider provider) { provider.add("gtceu.multiblock.hpca.hover_for_info", "Hover for details"); provider.add("gtceu.multiblock.hpca.error_damaged", "Damaged component in structure!"); provider.add("gtceu.multiblock.hpca.error_temperature", "Temperature above 100C, components may be damaged!"); - provider.add("gtceu.multiblock.hpca.warning_temperature", "Temperature above 50C, components may be damaged at 100C!"); + provider.add("gtceu.multiblock.hpca.warning_temperature", + "Temperature above 50C, components may be damaged at 100C!"); provider.add("gtceu.multiblock.hpca.warning_temperature_active_cool", "Fully utilizing active coolers"); provider.add("gtceu.multiblock.hpca.warning_structure_header", "Structure Warnings:"); - provider.add("gtceu.multiblock.hpca.warning_multiple_bridges", "- Multiple bridges in structure (provides no additional benefit)"); + provider.add("gtceu.multiblock.hpca.warning_multiple_bridges", + "- Multiple bridges in structure (provides no additional benefit)"); provider.add("gtceu.multiblock.hpca.warning_no_computation", "- No computation providers"); provider.add("gtceu.multiblock.hpca.warning_low_cooling", "- Not enough cooling"); provider.add("gtceu.multiblock.hpca.info_max_computation", "Max CWU/t: %s"); @@ -781,7 +865,8 @@ protected static void init(RegistrateLangProvider provider) { provider.add("gtceu.creative.activity.off", "Not active"); } - public static void standardTooltips(RegistrateLangProvider provider, String root, String machine, String lowTier, String midTier, String highTier) { + public static void standardTooltips(RegistrateLangProvider provider, String root, String machine, String lowTier, + String midTier, String highTier) { provider.add("%s.%s_%s.tooltip".formatted(root, "lv", machine), "§7%s".formatted(lowTier)); provider.add("%s.%s_%s.tooltip".formatted(root, "mv", machine), "§7%s".formatted(lowTier)); provider.add("%s.%s_%s.tooltip".formatted(root, "hv", machine), "§7%s".formatted(lowTier)); diff --git a/src/main/java/com/gregtechceu/gtceu/data/lang/MaterialLangGenerator.java b/src/main/java/com/gregtechceu/gtceu/data/lang/MaterialLangGenerator.java index 150061009a..f6d18864b8 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/lang/MaterialLangGenerator.java +++ b/src/main/java/com/gregtechceu/gtceu/data/lang/MaterialLangGenerator.java @@ -2,6 +2,7 @@ import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.api.data.chemical.material.registry.MaterialRegistry; + import com.tterrag.registrate.providers.RegistrateLangProvider; import static com.gregtechceu.gtceu.utils.FormattingUtil.toEnglishName; diff --git a/src/main/java/com/gregtechceu/gtceu/data/lang/ToolLang.java b/src/main/java/com/gregtechceu/gtceu/data/lang/ToolLang.java index 5a67b71614..e1c31ee892 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/lang/ToolLang.java +++ b/src/main/java/com/gregtechceu/gtceu/data/lang/ToolLang.java @@ -1,7 +1,5 @@ package com.gregtechceu.gtceu.data.lang; -import com.gregtechceu.gtceu.common.data.GTItems; -import com.lowdragmc.lowdraglib.utils.LocalizationUtils; import com.tterrag.registrate.providers.RegistrateLangProvider; public class ToolLang { @@ -51,7 +49,5 @@ private static void initDeathMessages(RegistrateLangProvider provider) { provider.add("death.attack.gtceu.screwdriver_lv", "%s had their screws removed by %s"); } - private static void initToolInfo(RegistrateLangProvider provider) { - - } + private static void initToolInfo(RegistrateLangProvider provider) {} } diff --git a/src/main/java/com/gregtechceu/gtceu/data/loader/BedrockOreLoader.java b/src/main/java/com/gregtechceu/gtceu/data/loader/BedrockOreLoader.java index 5fd4614e08..fe5090086e 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/loader/BedrockOreLoader.java +++ b/src/main/java/com/gregtechceu/gtceu/data/loader/BedrockOreLoader.java @@ -1,9 +1,5 @@ package com.gregtechceu.gtceu.data.loader; -import com.google.gson.Gson; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.GTCEuAPI; import com.gregtechceu.gtceu.api.addon.AddonFinder; @@ -13,8 +9,7 @@ import com.gregtechceu.gtceu.common.data.GTOres; import com.gregtechceu.gtceu.integration.kjs.GTCEuServerEvents; import com.gregtechceu.gtceu.integration.kjs.events.GTBedrockOreVeinEventJS; -import com.mojang.serialization.JsonOps; -import dev.latvian.mods.kubejs.script.ScriptType; + import net.minecraft.resources.RegistryOps; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.resources.ResourceManager; @@ -23,14 +18,23 @@ import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.level.storage.loot.Deserializers; import net.minecraftforge.fml.ModLoader; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.mojang.serialization.JsonOps; +import dev.latvian.mods.kubejs.script.ScriptType; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.Map; +import javax.annotation.ParametersAreNonnullByDefault; + @ParametersAreNonnullByDefault public class BedrockOreLoader extends SimpleJsonResourceReloadListener { + public static BedrockOreLoader INSTANCE; public static final Gson GSON_INSTANCE = Deserializers.createFunctionSerializer().create(); private static final String FOLDER = "gtceu/bedrock_ore_veins"; @@ -42,7 +46,8 @@ public BedrockOreLoader() { } @Override - protected void apply(Map resourceList, ResourceManager resourceManager, ProfilerFiller profiler) { + protected void apply(Map resourceList, ResourceManager resourceManager, + ProfilerFiller profiler) { if (GTRegistries.BEDROCK_ORE_DEFINITIONS.isFrozen()) { GTRegistries.BEDROCK_ORE_DEFINITIONS.unfreeze(); } @@ -50,16 +55,18 @@ protected void apply(Map resourceList, ResourceMa GTOres.toReRegisterBedrock.forEach(GTRegistries.BEDROCK_ORE_DEFINITIONS::registerOrOverride); AddonFinder.getAddons().forEach(IGTAddon::registerBedrockOreVeins); - ModLoader.get().postEvent(new GTCEuAPI.RegisterEvent<>(GTRegistries.BEDROCK_ORE_DEFINITIONS, BedrockOreDefinition.class)); + ModLoader.get().postEvent( + new GTCEuAPI.RegisterEvent<>(GTRegistries.BEDROCK_ORE_DEFINITIONS, BedrockOreDefinition.class)); if (GTCEu.isKubeJSLoaded()) { RunKJSEventInSeparateClassBecauseForgeIsDumb.fireKJSEvent(); } RegistryOps ops = RegistryOps.create(JsonOps.INSTANCE, GTRegistries.builtinRegistry()); - for(Map.Entry entry : resourceList.entrySet()) { + for (Map.Entry entry : resourceList.entrySet()) { ResourceLocation location = entry.getKey(); try { - BedrockOreDefinition bedrockOre = fromJson(location, GsonHelper.convertToJsonObject(entry.getValue(), "top element"), ops); + BedrockOreDefinition bedrockOre = fromJson(location, + GsonHelper.convertToJsonObject(entry.getValue(), "top element"), ops); if (bedrockOre == null) { LOGGER.info("Skipping loading bedrock ore vein {} as it's serializer returned null", location); } @@ -82,9 +89,9 @@ public static BedrockOreDefinition fromJson(ResourceLocation id, JsonObject json * Holy shit this is dumb, thanks forge for trying to classload things that are never called! */ public static final class RunKJSEventInSeparateClassBecauseForgeIsDumb { + public static void fireKJSEvent() { GTCEuServerEvents.BEDROCK_ORE_VEIN_MODIFICATION.post(ScriptType.SERVER, new GTBedrockOreVeinEventJS()); } } } - diff --git a/src/main/java/com/gregtechceu/gtceu/data/loader/FluidVeinLoader.java b/src/main/java/com/gregtechceu/gtceu/data/loader/FluidVeinLoader.java index 98b2d58fef..0f50dce622 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/loader/FluidVeinLoader.java +++ b/src/main/java/com/gregtechceu/gtceu/data/loader/FluidVeinLoader.java @@ -1,22 +1,15 @@ package com.gregtechceu.gtceu.data.loader; -import com.google.gson.Gson; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.GTCEuAPI; import com.gregtechceu.gtceu.api.addon.AddonFinder; import com.gregtechceu.gtceu.api.addon.IGTAddon; import com.gregtechceu.gtceu.api.data.worldgen.bedrockfluid.BedrockFluidDefinition; -import com.gregtechceu.gtceu.api.machine.MachineDefinition; import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.common.data.GTBedrockFluids; import com.gregtechceu.gtceu.integration.kjs.GTCEuServerEvents; import com.gregtechceu.gtceu.integration.kjs.events.GTFluidVeinEventJS; -import com.mojang.datafixers.util.Pair; -import com.mojang.serialization.JsonOps; -import dev.latvian.mods.kubejs.script.ScriptType; + import net.minecraft.resources.RegistryOps; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.resources.ResourceManager; @@ -25,12 +18,20 @@ import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.level.storage.loot.Deserializers; import net.minecraftforge.fml.ModLoader; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.mojang.serialization.JsonOps; +import dev.latvian.mods.kubejs.script.ScriptType; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import java.util.Map; public class FluidVeinLoader extends SimpleJsonResourceReloadListener { + public static FluidVeinLoader INSTANCE; public static final Gson GSON_INSTANCE = Deserializers.createFunctionSerializer().create(); private static final String FOLDER = "gtceu/fluid_veins"; @@ -42,7 +43,8 @@ public FluidVeinLoader() { } @Override - protected void apply(Map resourceList, ResourceManager resourceManager, ProfilerFiller profiler) { + protected void apply(Map resourceList, ResourceManager resourceManager, + ProfilerFiller profiler) { if (GTRegistries.BEDROCK_FLUID_DEFINITIONS.isFrozen()) { GTRegistries.BEDROCK_FLUID_DEFINITIONS.unfreeze(); } @@ -50,16 +52,18 @@ protected void apply(Map resourceList, ResourceMa GTBedrockFluids.init(); AddonFinder.getAddons().forEach(IGTAddon::registerFluidVeins); - ModLoader.get().postEvent(new GTCEuAPI.RegisterEvent<>(GTRegistries.BEDROCK_FLUID_DEFINITIONS, BedrockFluidDefinition.class)); + ModLoader.get().postEvent( + new GTCEuAPI.RegisterEvent<>(GTRegistries.BEDROCK_FLUID_DEFINITIONS, BedrockFluidDefinition.class)); if (GTCEu.isKubeJSLoaded()) { RunKJSEventInSeparateClassBecauseForgeIsDumb.fireKJSEvent(); } RegistryOps ops = RegistryOps.create(JsonOps.INSTANCE, GTRegistries.builtinRegistry()); - for(Map.Entry entry : resourceList.entrySet()) { + for (Map.Entry entry : resourceList.entrySet()) { ResourceLocation location = entry.getKey(); try { - BedrockFluidDefinition fluid = fromJson(location, GsonHelper.convertToJsonObject(entry.getValue(), "top element"), ops); + BedrockFluidDefinition fluid = fromJson(location, + GsonHelper.convertToJsonObject(entry.getValue(), "top element"), ops); if (fluid == null) { LOGGER.info("Skipping loading fluid vein {} as it's serializer returned null", location); } @@ -82,9 +86,9 @@ public static BedrockFluidDefinition fromJson(ResourceLocation id, JsonObject js * Holy shit this is dumb, thanks forge for trying to classload things that are never called! */ public static final class RunKJSEventInSeparateClassBecauseForgeIsDumb { + public static void fireKJSEvent() { GTCEuServerEvents.FLUID_VEIN_MODIFICATION.post(ScriptType.SERVER, new GTFluidVeinEventJS()); } } } - diff --git a/src/main/java/com/gregtechceu/gtceu/data/loader/OreDataLoader.java b/src/main/java/com/gregtechceu/gtceu/data/loader/OreDataLoader.java index d1e0d9e4e3..c6d7d25416 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/loader/OreDataLoader.java +++ b/src/main/java/com/gregtechceu/gtceu/data/loader/OreDataLoader.java @@ -1,9 +1,5 @@ package com.gregtechceu.gtceu.data.loader; -import com.google.gson.Gson; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParseException; import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.GTCEuAPI; import com.gregtechceu.gtceu.api.addon.AddonFinder; @@ -14,9 +10,7 @@ import com.gregtechceu.gtceu.common.data.GTOres; import com.gregtechceu.gtceu.integration.kjs.GTCEuServerEvents; import com.gregtechceu.gtceu.integration.kjs.events.GTOreVeinEventJS; -import com.mojang.datafixers.util.Pair; -import com.mojang.serialization.JsonOps; -import dev.latvian.mods.kubejs.script.ScriptType; + import net.minecraft.resources.RegistryOps; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.resources.ResourceManager; @@ -25,6 +19,13 @@ import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.level.storage.loot.Deserializers; import net.minecraftforge.fml.ModLoader; + +import com.google.gson.Gson; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.mojang.serialization.JsonOps; +import dev.latvian.mods.kubejs.script.ScriptType; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -32,6 +33,7 @@ import java.util.Map; public class OreDataLoader extends SimpleJsonResourceReloadListener { + public static OreDataLoader INSTANCE; public static final Gson GSON_INSTANCE = Deserializers.createFunctionSerializer().create(); private static final String FOLDER = "gtceu/ore_veins"; @@ -43,7 +45,8 @@ public OreDataLoader() { } @Override - protected void apply(Map resourceList, ResourceManager resourceManager, ProfilerFiller profiler) { + protected void apply(Map resourceList, ResourceManager resourceManager, + ProfilerFiller profiler) { // Check condition in cause of reload failing which makes the registry not freeze. if (GTRegistries.ORE_VEINS.isFrozen()) { GTRegistries.ORE_VEINS.unfreeze(); @@ -58,11 +61,12 @@ protected void apply(Map resourceList, ResourceMa } RegistryOps ops = RegistryOps.create(JsonOps.INSTANCE, GTRegistries.builtinRegistry()); - for(Map.Entry entry : resourceList.entrySet()) { + for (Map.Entry entry : resourceList.entrySet()) { ResourceLocation location = entry.getKey(); try { - GTOreDefinition ore = fromJson(location, GsonHelper.convertToJsonObject(entry.getValue(), "top element"), ops); + GTOreDefinition ore = fromJson(location, + GsonHelper.convertToJsonObject(entry.getValue(), "top element"), ops); if (ore == null) { LOGGER.info("Skipping loading ore vein {} as it's serializer returned null", location); } else if (ore.veinGenerator() instanceof NoopVeinGenerator) { @@ -105,6 +109,7 @@ public static GTOreDefinition fromJson(ResourceLocation id, JsonObject json, Reg * Holy shit this is dumb, thanks forge for trying to classload things that are never called! */ public static final class RunKJSEventInSeparateClassBecauseForgeIsDumb { + public static void fireKJSEvent() { GTCEuServerEvents.ORE_VEIN_MODIFICATION.post(ScriptType.SERVER, new GTOreVeinEventJS()); } diff --git a/src/main/java/com/gregtechceu/gtceu/data/loot/ChestGenHooks.java b/src/main/java/com/gregtechceu/gtceu/data/loot/ChestGenHooks.java index eb132bd5ba..357be21399 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/loot/ChestGenHooks.java +++ b/src/main/java/com/gregtechceu/gtceu/data/loot/ChestGenHooks.java @@ -1,24 +1,16 @@ package com.gregtechceu.gtceu.data.loot; -import com.google.common.base.Preconditions; -import com.google.common.collect.Lists; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonObject; -import com.google.gson.JsonSerializationContext; import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.core.mixins.LootPoolAccessor; -import com.gregtechceu.gtceu.utils.GTUtil; import com.gregtechceu.gtceu.utils.ItemStackHashStrategy; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; -import lombok.Getter; + import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.nbt.CompoundTag; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.GsonHelper; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.storage.loot.IntRange; import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootPool; import net.minecraft.world.level.storage.loot.entries.LootItem; @@ -35,6 +27,13 @@ import net.minecraftforge.event.LootTableLoadEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.registries.ForgeRegistries; + +import com.google.common.base.Preconditions; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonObject; +import com.google.gson.JsonSerializationContext; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import lombok.Getter; import org.apache.commons.lang3.ArrayUtils; import org.jetbrains.annotations.NotNull; @@ -71,7 +70,7 @@ public static void onWorldLoad(@NotNull LootTableLoadEvent event) { } try { - LootPoolEntryContainer[] entries = ((LootPoolAccessor)mainPool).getEntries(); + LootPoolEntryContainer[] entries = ((LootPoolAccessor) mainPool).getEntries(); entries = ArrayUtils.add(entries, entry); ((LootPoolAccessor) mainPool).setEntries(entries); } catch (RuntimeException e) { @@ -83,7 +82,8 @@ public static void onWorldLoad(@NotNull LootTableLoadEvent event) { if (rollValues.containsKey(event.getName())) { NumberProvider rangeAdd = rollValues.get(event.getName()); NumberProvider range = mainPool.getRolls(); - //mainPool.setRolls(UniformGenerator.between(range.getMin() + rangeAdd.getMin(), range.getMax() + rangeAdd.getMax())); TODO additional rolls + // mainPool.setRolls(UniformGenerator.between(range.getMin() + rangeAdd.getMin(), range.getMax() + + // rangeAdd.getMax())); TODO additional rolls } } @@ -132,7 +132,9 @@ public void createItemStack(Consumer stackConsumer, LootContext lootC } public static class RandomWeightLootFunction extends LootItemConditionalFunction implements LootItemFunction { - public static final LootItemFunctionType TYPE = GTRegistries.register(BuiltInRegistries.LOOT_FUNCTION_TYPE, GTCEu.id("random_weight"), new LootItemFunctionType(new Serializer())); + + public static final LootItemFunctionType TYPE = GTRegistries.register(BuiltInRegistries.LOOT_FUNCTION_TYPE, + GTCEu.id("random_weight"), new LootItemFunctionType(new Serializer())); private final ItemStack stack; @Getter @@ -172,28 +174,34 @@ protected ItemStack run(ItemStack itemStack, LootContext context) { return itemStack; } - int count = Math.min(minAmount + context.getRandom().nextInt(maxAmount - minAmount + 1), stack.getMaxStackSize()); + int count = Math.min(minAmount + context.getRandom().nextInt(maxAmount - minAmount + 1), + stack.getMaxStackSize()); itemStack.setCount(count); return itemStack; } public static class Serializer extends LootItemConditionalFunction.Serializer { + /** * Serialize the {@link SetItemCountFunction} by putting its data into the JsonObject. */ - public void serialize(JsonObject json, RandomWeightLootFunction setItemCountFunction, JsonSerializationContext serializationContext) { + public void serialize(JsonObject json, RandomWeightLootFunction setItemCountFunction, + JsonSerializationContext serializationContext) { super.serialize(json, setItemCountFunction, serializationContext); json.add("min", serializationContext.serialize(setItemCountFunction.minAmount)); json.add("max", serializationContext.serialize(setItemCountFunction.maxAmount)); JsonObject stack = new JsonObject(); - stack.addProperty("item", ForgeRegistries.ITEMS.getKey(setItemCountFunction.stack.getItem()).toString()); + stack.addProperty("item", + ForgeRegistries.ITEMS.getKey(setItemCountFunction.stack.getItem()).toString()); stack.addProperty("count", setItemCountFunction.stack.getCount()); if (setItemCountFunction.stack.hasTag()) stack.addProperty("nbt", setItemCountFunction.stack.getTag().toString()); json.add("stack", stack); } - public RandomWeightLootFunction deserialize(JsonObject object, JsonDeserializationContext deserializationContext, LootItemCondition[] conditions) { + public RandomWeightLootFunction deserialize(JsonObject object, + JsonDeserializationContext deserializationContext, + LootItemCondition[] conditions) { ItemStack stack = CraftingHelper.getItemStack(object.getAsJsonObject("stack"), true); int min = GsonHelper.getAsInt(object, "min"); int max = GsonHelper.getAsInt(object, "max"); @@ -201,4 +209,4 @@ public RandomWeightLootFunction deserialize(JsonObject object, JsonDeserializati } } } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/data/loot/DungeonLootLoader.java b/src/main/java/com/gregtechceu/gtceu/data/loot/DungeonLootLoader.java index 478bf1bc93..985d0126bb 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/loot/DungeonLootLoader.java +++ b/src/main/java/com/gregtechceu/gtceu/data/loot/DungeonLootLoader.java @@ -6,6 +6,7 @@ import com.gregtechceu.gtceu.common.data.GTItems; import com.gregtechceu.gtceu.common.data.GTMaterials; import com.gregtechceu.gtceu.config.ConfigHolder; + import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.storage.loot.BuiltInLootTables; @@ -23,74 +24,134 @@ public static void init() { ChestGenHooks.addItem(BuiltInLootTables.SPAWN_BONUS_CHEST, GTItems.BOTTLE_PURPLE_DRINK.asStack(), 8, 16, 2); ChestGenHooks.addItem(BuiltInLootTables.SIMPLE_DUNGEON, GTItems.BOTTLE_PURPLE_DRINK.asStack(), 4, 8, 80); - ChestGenHooks.addItem(BuiltInLootTables.SIMPLE_DUNGEON, ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Silver), 1, 6, 120); - ChestGenHooks.addItem(BuiltInLootTables.SIMPLE_DUNGEON, ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Lead), 1, 6, 30); - ChestGenHooks.addItem(BuiltInLootTables.SIMPLE_DUNGEON, ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Steel), 1, 6, 60); - ChestGenHooks.addItem(BuiltInLootTables.SIMPLE_DUNGEON, ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Bronze), 1, 6, 60); - ChestGenHooks.addItem(BuiltInLootTables.SIMPLE_DUNGEON, ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Manganese), 1, 6, 60); - ChestGenHooks.addItem(BuiltInLootTables.SIMPLE_DUNGEON, ChemicalHelper.get(TagPrefix.ingot, GTMaterials.DamascusSteel), 1, 6, 10); - ChestGenHooks.addItem(BuiltInLootTables.SIMPLE_DUNGEON, ChemicalHelper.get(TagPrefix.gem, GTMaterials.Emerald), 1, 6, 20); - ChestGenHooks.addItem(BuiltInLootTables.SIMPLE_DUNGEON, ChemicalHelper.get(TagPrefix.gem, GTMaterials.Ruby), 1, 6, 20); - ChestGenHooks.addItem(BuiltInLootTables.SIMPLE_DUNGEON, ChemicalHelper.get(TagPrefix.gem, GTMaterials.Sapphire), 1, 6, 20); - ChestGenHooks.addItem(BuiltInLootTables.SIMPLE_DUNGEON, ChemicalHelper.get(TagPrefix.gem, GTMaterials.GreenSapphire), 1, 6, 20); - ChestGenHooks.addItem(BuiltInLootTables.SIMPLE_DUNGEON, ChemicalHelper.get(TagPrefix.gem, GTMaterials.Olivine), 1, 6, 20); - ChestGenHooks.addItem(BuiltInLootTables.SIMPLE_DUNGEON, ChemicalHelper.get(TagPrefix.gem, GTMaterials.GarnetRed), 1, 6, 40); - ChestGenHooks.addItem(BuiltInLootTables.SIMPLE_DUNGEON, ChemicalHelper.get(TagPrefix.gem, GTMaterials.GarnetYellow), 1, 6, 40); - ChestGenHooks.addItem(BuiltInLootTables.SIMPLE_DUNGEON, ChemicalHelper.get(TagPrefix.dust, GTMaterials.Neodymium), 1, 6, 40); - ChestGenHooks.addItem(BuiltInLootTables.SIMPLE_DUNGEON, ChemicalHelper.get(TagPrefix.dust, GTMaterials.Chromium), 1, 3, 40); + ChestGenHooks.addItem(BuiltInLootTables.SIMPLE_DUNGEON, + ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Silver), 1, 6, 120); + ChestGenHooks.addItem(BuiltInLootTables.SIMPLE_DUNGEON, + ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Lead), 1, 6, 30); + ChestGenHooks.addItem(BuiltInLootTables.SIMPLE_DUNGEON, + ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Steel), 1, 6, 60); + ChestGenHooks.addItem(BuiltInLootTables.SIMPLE_DUNGEON, + ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Bronze), 1, 6, 60); + ChestGenHooks.addItem(BuiltInLootTables.SIMPLE_DUNGEON, + ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Manganese), 1, 6, 60); + ChestGenHooks.addItem(BuiltInLootTables.SIMPLE_DUNGEON, + ChemicalHelper.get(TagPrefix.ingot, GTMaterials.DamascusSteel), 1, 6, 10); + ChestGenHooks.addItem(BuiltInLootTables.SIMPLE_DUNGEON, + ChemicalHelper.get(TagPrefix.gem, GTMaterials.Emerald), 1, 6, 20); + ChestGenHooks.addItem(BuiltInLootTables.SIMPLE_DUNGEON, ChemicalHelper.get(TagPrefix.gem, GTMaterials.Ruby), + 1, 6, 20); + ChestGenHooks.addItem(BuiltInLootTables.SIMPLE_DUNGEON, + ChemicalHelper.get(TagPrefix.gem, GTMaterials.Sapphire), 1, 6, 20); + ChestGenHooks.addItem(BuiltInLootTables.SIMPLE_DUNGEON, + ChemicalHelper.get(TagPrefix.gem, GTMaterials.GreenSapphire), 1, 6, 20); + ChestGenHooks.addItem(BuiltInLootTables.SIMPLE_DUNGEON, + ChemicalHelper.get(TagPrefix.gem, GTMaterials.Olivine), 1, 6, 20); + ChestGenHooks.addItem(BuiltInLootTables.SIMPLE_DUNGEON, + ChemicalHelper.get(TagPrefix.gem, GTMaterials.GarnetRed), 1, 6, 40); + ChestGenHooks.addItem(BuiltInLootTables.SIMPLE_DUNGEON, + ChemicalHelper.get(TagPrefix.gem, GTMaterials.GarnetYellow), 1, 6, 40); + ChestGenHooks.addItem(BuiltInLootTables.SIMPLE_DUNGEON, + ChemicalHelper.get(TagPrefix.dust, GTMaterials.Neodymium), 1, 6, 40); + ChestGenHooks.addItem(BuiltInLootTables.SIMPLE_DUNGEON, + ChemicalHelper.get(TagPrefix.dust, GTMaterials.Chromium), 1, 3, 40); - ChestGenHooks.addItem(BuiltInLootTables.DESERT_PYRAMID, ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Silver), 4, 16, 12); - ChestGenHooks.addItem(BuiltInLootTables.DESERT_PYRAMID, ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Platinum), 2, 8, 4); - ChestGenHooks.addItem(BuiltInLootTables.DESERT_PYRAMID, ChemicalHelper.get(TagPrefix.gem, GTMaterials.Ruby), 2, 8, 2); - ChestGenHooks.addItem(BuiltInLootTables.DESERT_PYRAMID, ChemicalHelper.get(TagPrefix.gem, GTMaterials.Sapphire), 2, 8, 2); - ChestGenHooks.addItem(BuiltInLootTables.DESERT_PYRAMID, ChemicalHelper.get(TagPrefix.gem, GTMaterials.GreenSapphire), 2, 8, 2); - ChestGenHooks.addItem(BuiltInLootTables.DESERT_PYRAMID, ChemicalHelper.get(TagPrefix.gem, GTMaterials.Olivine), 2, 8, 2); - ChestGenHooks.addItem(BuiltInLootTables.DESERT_PYRAMID, ChemicalHelper.get(TagPrefix.gem, GTMaterials.GarnetRed), 2, 8, 4); - ChestGenHooks.addItem(BuiltInLootTables.DESERT_PYRAMID, ChemicalHelper.get(TagPrefix.gem, GTMaterials.GarnetYellow), 2, 8, 4); + ChestGenHooks.addItem(BuiltInLootTables.DESERT_PYRAMID, + ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Silver), 4, 16, 12); + ChestGenHooks.addItem(BuiltInLootTables.DESERT_PYRAMID, + ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Platinum), 2, 8, 4); + ChestGenHooks.addItem(BuiltInLootTables.DESERT_PYRAMID, ChemicalHelper.get(TagPrefix.gem, GTMaterials.Ruby), + 2, 8, 2); + ChestGenHooks.addItem(BuiltInLootTables.DESERT_PYRAMID, + ChemicalHelper.get(TagPrefix.gem, GTMaterials.Sapphire), 2, 8, 2); + ChestGenHooks.addItem(BuiltInLootTables.DESERT_PYRAMID, + ChemicalHelper.get(TagPrefix.gem, GTMaterials.GreenSapphire), 2, 8, 2); + ChestGenHooks.addItem(BuiltInLootTables.DESERT_PYRAMID, + ChemicalHelper.get(TagPrefix.gem, GTMaterials.Olivine), 2, 8, 2); + ChestGenHooks.addItem(BuiltInLootTables.DESERT_PYRAMID, + ChemicalHelper.get(TagPrefix.gem, GTMaterials.GarnetRed), 2, 8, 4); + ChestGenHooks.addItem(BuiltInLootTables.DESERT_PYRAMID, + ChemicalHelper.get(TagPrefix.gem, GTMaterials.GarnetYellow), 2, 8, 4); ChestGenHooks.addItem(BuiltInLootTables.JUNGLE_TEMPLE, GTItems.COIN_GOLD_ANCIENT.asStack(), 16, 64, 10); - ChestGenHooks.addItem(BuiltInLootTables.JUNGLE_TEMPLE, GTItems.ZERO_POINT_MODULE.get().getChargedStack(Long.MAX_VALUE), 1, 1, 1); - ChestGenHooks.addItem(BuiltInLootTables.JUNGLE_TEMPLE, ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Bronze), 4, 16, 12); - ChestGenHooks.addItem(BuiltInLootTables.JUNGLE_TEMPLE, ChemicalHelper.get(TagPrefix.gem, GTMaterials.Ruby), 2, 8, 2); - ChestGenHooks.addItem(BuiltInLootTables.JUNGLE_TEMPLE, ChemicalHelper.get(TagPrefix.gem, GTMaterials.Sapphire), 2, 8, 2); - ChestGenHooks.addItem(BuiltInLootTables.JUNGLE_TEMPLE, ChemicalHelper.get(TagPrefix.gem, GTMaterials.GreenSapphire), 2, 8, 2); - ChestGenHooks.addItem(BuiltInLootTables.JUNGLE_TEMPLE, ChemicalHelper.get(TagPrefix.gem, GTMaterials.Olivine), 2, 8, 2); - ChestGenHooks.addItem(BuiltInLootTables.JUNGLE_TEMPLE, ChemicalHelper.get(TagPrefix.gem, GTMaterials.GarnetRed), 2, 8, 4); - ChestGenHooks.addItem(BuiltInLootTables.JUNGLE_TEMPLE, ChemicalHelper.get(TagPrefix.gem, GTMaterials.GarnetYellow), 2, 8, 4); + ChestGenHooks.addItem(BuiltInLootTables.JUNGLE_TEMPLE, + GTItems.ZERO_POINT_MODULE.get().getChargedStack(Long.MAX_VALUE), 1, 1, 1); + ChestGenHooks.addItem(BuiltInLootTables.JUNGLE_TEMPLE, + ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Bronze), 4, 16, 12); + ChestGenHooks.addItem(BuiltInLootTables.JUNGLE_TEMPLE, ChemicalHelper.get(TagPrefix.gem, GTMaterials.Ruby), + 2, 8, 2); + ChestGenHooks.addItem(BuiltInLootTables.JUNGLE_TEMPLE, + ChemicalHelper.get(TagPrefix.gem, GTMaterials.Sapphire), 2, 8, 2); + ChestGenHooks.addItem(BuiltInLootTables.JUNGLE_TEMPLE, + ChemicalHelper.get(TagPrefix.gem, GTMaterials.GreenSapphire), 2, 8, 2); + ChestGenHooks.addItem(BuiltInLootTables.JUNGLE_TEMPLE, + ChemicalHelper.get(TagPrefix.gem, GTMaterials.Olivine), 2, 8, 2); + ChestGenHooks.addItem(BuiltInLootTables.JUNGLE_TEMPLE, + ChemicalHelper.get(TagPrefix.gem, GTMaterials.GarnetRed), 2, 8, 4); + ChestGenHooks.addItem(BuiltInLootTables.JUNGLE_TEMPLE, + ChemicalHelper.get(TagPrefix.gem, GTMaterials.GarnetYellow), 2, 8, 4); - ChestGenHooks.addItem(BuiltInLootTables.JUNGLE_TEMPLE_DISPENSER, new ItemStack(Items.FIRE_CHARGE, 1), 2, 8, 30); + ChestGenHooks.addItem(BuiltInLootTables.JUNGLE_TEMPLE_DISPENSER, new ItemStack(Items.FIRE_CHARGE, 1), 2, 8, + 30); - ChestGenHooks.addItem(BuiltInLootTables.ABANDONED_MINESHAFT, ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Silver), 1, 4, 12); - ChestGenHooks.addItem(BuiltInLootTables.ABANDONED_MINESHAFT, ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Lead), 1, 4, 3); - ChestGenHooks.addItem(BuiltInLootTables.ABANDONED_MINESHAFT, ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Steel), 1, 4, 6); - ChestGenHooks.addItem(BuiltInLootTables.ABANDONED_MINESHAFT, ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Bronze), 1, 4, 6); - ChestGenHooks.addItem(BuiltInLootTables.ABANDONED_MINESHAFT, ChemicalHelper.get(TagPrefix.gem, GTMaterials.Sapphire), 1, 4, 2); - ChestGenHooks.addItem(BuiltInLootTables.ABANDONED_MINESHAFT, ChemicalHelper.get(TagPrefix.gem, GTMaterials.GreenSapphire), 1, 4, 2); - ChestGenHooks.addItem(BuiltInLootTables.ABANDONED_MINESHAFT, ChemicalHelper.get(TagPrefix.gem, GTMaterials.Olivine), 1, 4, 2); - ChestGenHooks.addItem(BuiltInLootTables.ABANDONED_MINESHAFT, ChemicalHelper.get(TagPrefix.gem, GTMaterials.GarnetRed), 1, 4, 4); - ChestGenHooks.addItem(BuiltInLootTables.ABANDONED_MINESHAFT, ChemicalHelper.get(TagPrefix.gem, GTMaterials.GarnetYellow), 1, 4, 4); - ChestGenHooks.addItem(BuiltInLootTables.ABANDONED_MINESHAFT, ChemicalHelper.get(TagPrefix.gem, GTMaterials.Ruby), 1, 4, 2); - ChestGenHooks.addItem(BuiltInLootTables.ABANDONED_MINESHAFT, ChemicalHelper.get(TagPrefix.gem, GTMaterials.Emerald), 1, 4, 2); - ChestGenHooks.addItem(BuiltInLootTables.ABANDONED_MINESHAFT, ChemicalHelper.get(TagPrefix.ingot, GTMaterials.DamascusSteel), 3, 12, 1); - ChestGenHooks.addItem(BuiltInLootTables.ABANDONED_MINESHAFT, ChemicalHelper.get(TagPrefix.ingot, GTMaterials.DamascusSteel), 1, 4, 1); + ChestGenHooks.addItem(BuiltInLootTables.ABANDONED_MINESHAFT, + ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Silver), 1, 4, 12); + ChestGenHooks.addItem(BuiltInLootTables.ABANDONED_MINESHAFT, + ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Lead), 1, 4, 3); + ChestGenHooks.addItem(BuiltInLootTables.ABANDONED_MINESHAFT, + ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Steel), 1, 4, 6); + ChestGenHooks.addItem(BuiltInLootTables.ABANDONED_MINESHAFT, + ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Bronze), 1, 4, 6); + ChestGenHooks.addItem(BuiltInLootTables.ABANDONED_MINESHAFT, + ChemicalHelper.get(TagPrefix.gem, GTMaterials.Sapphire), 1, 4, 2); + ChestGenHooks.addItem(BuiltInLootTables.ABANDONED_MINESHAFT, + ChemicalHelper.get(TagPrefix.gem, GTMaterials.GreenSapphire), 1, 4, 2); + ChestGenHooks.addItem(BuiltInLootTables.ABANDONED_MINESHAFT, + ChemicalHelper.get(TagPrefix.gem, GTMaterials.Olivine), 1, 4, 2); + ChestGenHooks.addItem(BuiltInLootTables.ABANDONED_MINESHAFT, + ChemicalHelper.get(TagPrefix.gem, GTMaterials.GarnetRed), 1, 4, 4); + ChestGenHooks.addItem(BuiltInLootTables.ABANDONED_MINESHAFT, + ChemicalHelper.get(TagPrefix.gem, GTMaterials.GarnetYellow), 1, 4, 4); + ChestGenHooks.addItem(BuiltInLootTables.ABANDONED_MINESHAFT, + ChemicalHelper.get(TagPrefix.gem, GTMaterials.Ruby), 1, 4, 2); + ChestGenHooks.addItem(BuiltInLootTables.ABANDONED_MINESHAFT, + ChemicalHelper.get(TagPrefix.gem, GTMaterials.Emerald), 1, 4, 2); + ChestGenHooks.addItem(BuiltInLootTables.ABANDONED_MINESHAFT, + ChemicalHelper.get(TagPrefix.ingot, GTMaterials.DamascusSteel), 3, 12, 1); + ChestGenHooks.addItem(BuiltInLootTables.ABANDONED_MINESHAFT, + ChemicalHelper.get(TagPrefix.ingot, GTMaterials.DamascusSteel), 1, 4, 1); - ChestGenHooks.addItem(BuiltInLootTables.VILLAGE_WEAPONSMITH, ChemicalHelper.get(TagPrefix.dust, GTMaterials.Chromium), 1, 4, 6); - ChestGenHooks.addItem(BuiltInLootTables.VILLAGE_WEAPONSMITH, ChemicalHelper.get(TagPrefix.dust, GTMaterials.Neodymium), 2, 8, 6); - ChestGenHooks.addItem(BuiltInLootTables.VILLAGE_WEAPONSMITH, ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Manganese), 2, 8, 12); - ChestGenHooks.addItem(BuiltInLootTables.VILLAGE_WEAPONSMITH, ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Steel), 4, 12, 12); - ChestGenHooks.addItem(BuiltInLootTables.VILLAGE_WEAPONSMITH, ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Bronze), 4, 12, 12); - ChestGenHooks.addItem(BuiltInLootTables.VILLAGE_WEAPONSMITH, ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Brass), 4, 12, 12); - ChestGenHooks.addItem(BuiltInLootTables.VILLAGE_WEAPONSMITH, ChemicalHelper.get(TagPrefix.ingot, GTMaterials.DamascusSteel), 4, 12, 1); + ChestGenHooks.addItem(BuiltInLootTables.VILLAGE_WEAPONSMITH, + ChemicalHelper.get(TagPrefix.dust, GTMaterials.Chromium), 1, 4, 6); + ChestGenHooks.addItem(BuiltInLootTables.VILLAGE_WEAPONSMITH, + ChemicalHelper.get(TagPrefix.dust, GTMaterials.Neodymium), 2, 8, 6); + ChestGenHooks.addItem(BuiltInLootTables.VILLAGE_WEAPONSMITH, + ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Manganese), 2, 8, 12); + ChestGenHooks.addItem(BuiltInLootTables.VILLAGE_WEAPONSMITH, + ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Steel), 4, 12, 12); + ChestGenHooks.addItem(BuiltInLootTables.VILLAGE_WEAPONSMITH, + ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Bronze), 4, 12, 12); + ChestGenHooks.addItem(BuiltInLootTables.VILLAGE_WEAPONSMITH, + ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Brass), 4, 12, 12); + ChestGenHooks.addItem(BuiltInLootTables.VILLAGE_WEAPONSMITH, + ChemicalHelper.get(TagPrefix.ingot, GTMaterials.DamascusSteel), 4, 12, 1); - ChestGenHooks.addItem(BuiltInLootTables.STRONGHOLD_CROSSING, ChemicalHelper.get(TagPrefix.ingot, GTMaterials.DamascusSteel), 4, 8, 6); - ChestGenHooks.addItem(BuiltInLootTables.STRONGHOLD_CROSSING, ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Steel), 8, 16, 12); - ChestGenHooks.addItem(BuiltInLootTables.STRONGHOLD_CROSSING, ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Bronze), 8, 16, 12); - ChestGenHooks.addItem(BuiltInLootTables.STRONGHOLD_CROSSING, ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Manganese), 4, 8, 12); - ChestGenHooks.addItem(BuiltInLootTables.STRONGHOLD_CROSSING, ChemicalHelper.get(TagPrefix.dust, GTMaterials.Neodymium), 4, 8, 6); - ChestGenHooks.addItem(BuiltInLootTables.STRONGHOLD_CROSSING, ChemicalHelper.get(TagPrefix.dust, GTMaterials.Chromium), 2, 4, 6); + ChestGenHooks.addItem(BuiltInLootTables.STRONGHOLD_CROSSING, + ChemicalHelper.get(TagPrefix.ingot, GTMaterials.DamascusSteel), 4, 8, 6); + ChestGenHooks.addItem(BuiltInLootTables.STRONGHOLD_CROSSING, + ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Steel), 8, 16, 12); + ChestGenHooks.addItem(BuiltInLootTables.STRONGHOLD_CROSSING, + ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Bronze), 8, 16, 12); + ChestGenHooks.addItem(BuiltInLootTables.STRONGHOLD_CROSSING, + ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Manganese), 4, 8, 12); + ChestGenHooks.addItem(BuiltInLootTables.STRONGHOLD_CROSSING, + ChemicalHelper.get(TagPrefix.dust, GTMaterials.Neodymium), 4, 8, 6); + ChestGenHooks.addItem(BuiltInLootTables.STRONGHOLD_CROSSING, + ChemicalHelper.get(TagPrefix.dust, GTMaterials.Chromium), 2, 4, 6); - ChestGenHooks.addItem(BuiltInLootTables.STRONGHOLD_CORRIDOR, ChemicalHelper.get(TagPrefix.ingot, GTMaterials.DamascusSteel), 2, 8, 6); - ChestGenHooks.addItem(BuiltInLootTables.STRONGHOLD_CORRIDOR, ChemicalHelper.get(TagPrefix.ingot, GTMaterials.DamascusSteel), 3, 12, 6); + ChestGenHooks.addItem(BuiltInLootTables.STRONGHOLD_CORRIDOR, + ChemicalHelper.get(TagPrefix.ingot, GTMaterials.DamascusSteel), 2, 8, 6); + ChestGenHooks.addItem(BuiltInLootTables.STRONGHOLD_CORRIDOR, + ChemicalHelper.get(TagPrefix.ingot, GTMaterials.DamascusSteel), 3, 12, 6); } if (ConfigHolder.INSTANCE.worldgen.increaseDungeonLoot) { ChestGenHooks.addRolls(BuiltInLootTables.SPAWN_BONUS_CHEST, 2, 4); @@ -105,4 +166,4 @@ public static void init() { ChestGenHooks.addRolls(BuiltInLootTables.STRONGHOLD_LIBRARY, 4, 8); } } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/data/pack/GTDynamicDataPack.java b/src/main/java/com/gregtechceu/gtceu/data/pack/GTDynamicDataPack.java index 8f24ef2f28..cd1bfc2cd0 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/pack/GTDynamicDataPack.java +++ b/src/main/java/com/gregtechceu/gtceu/data/pack/GTDynamicDataPack.java @@ -1,17 +1,13 @@ package com.gregtechceu.gtceu.data.pack; -import com.google.common.collect.Sets; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.addon.AddonFinder; import com.gregtechceu.gtceu.api.addon.IGTAddon; import com.gregtechceu.gtceu.common.data.GTRecipes; import com.gregtechceu.gtceu.config.ConfigHolder; + import com.lowdragmc.lowdraglib.Platform; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; -import it.unimi.dsi.fastutil.objects.ObjectSet; + import net.minecraft.SharedConstants; import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.network.chat.Component; @@ -21,10 +17,16 @@ import net.minecraft.server.packs.metadata.MetadataSectionSerializer; import net.minecraft.server.packs.metadata.pack.PackMetadataSection; import net.minecraft.server.packs.resources.IoSupplier; + +import com.google.common.collect.Sets; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; +import it.unimi.dsi.fastutil.objects.ObjectSet; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; @@ -35,6 +37,8 @@ import java.util.*; import java.util.stream.Collectors; +import javax.annotation.ParametersAreNonnullByDefault; + @ParametersAreNonnullByDefault public class GTDynamicDataPack implements PackResources { @@ -76,16 +80,18 @@ public static void addRecipe(FinishedRecipe recipe) { if (ConfigHolder.INSTANCE.dev.dumpRecipes) { writeJson(recipe.getAdvancementId(), "advancements", parent, advancement); } - DATA.put(getAdvancementLocation(Objects.requireNonNull(recipe.getAdvancementId())), advancement.toString().getBytes(StandardCharsets.UTF_8)); + DATA.put(getAdvancementLocation(Objects.requireNonNull(recipe.getAdvancementId())), + advancement.toString().getBytes(StandardCharsets.UTF_8)); } } /** * if subdir is null, no file ending is appended. - * @param id the resource location of the file to be written. + * + * @param id the resource location of the file to be written. * @param subdir a nullable subdirectory for the data. * @param parent the parent folder where to write data to. - * @param json the json to write. + * @param json the json to write. */ @ApiStatus.Internal public static void writeJson(ResourceLocation id, @Nullable String subdir, Path parent, JsonElement json) { @@ -94,10 +100,11 @@ public static void writeJson(ResourceLocation id, @Nullable String subdir, Path if (subdir != null) { file = parent.resolve(id.getNamespace()).resolve(subdir).resolve(id.getPath() + ".json"); // assume JSON } else { - file = parent.resolve(id.getNamespace()).resolve(id.getPath()); // assume the file type is also appended if a full path is given. + file = parent.resolve(id.getNamespace()).resolve(id.getPath()); // assume the file type is also appended + // if a full path is given. } Files.createDirectories(file.getParent()); - try(OutputStream output = Files.newOutputStream(file)) { + try (OutputStream output = Files.newOutputStream(file)) { output.write(json.toString().getBytes()); } } catch (IOException e) { @@ -135,12 +142,13 @@ public void listResources(PackType packType, String namespace, String path, Reso if (packType == PackType.SERVER_DATA) { if (!path.endsWith("/")) path += "/"; final String finalPath = path; - DATA.keySet().stream().filter(Objects::nonNull).filter(loc -> loc.getPath().startsWith(finalPath)).forEach((id) -> { - IoSupplier resource = this.getResource(packType, id); - if (resource != null) { - resourceOutput.accept(id, resource); - } - }); + DATA.keySet().stream().filter(Objects::nonNull).filter(loc -> loc.getPath().startsWith(finalPath)) + .forEach((id) -> { + IoSupplier resource = this.getResource(packType, id); + if (resource != null) { + resourceOutput.accept(id, resource); + } + }); } } @@ -152,8 +160,9 @@ public Set getNamespaces(PackType type) { @Nullable @Override public T getMetadataSection(MetadataSectionSerializer metaReader) { - if(metaReader == PackMetadataSection.TYPE) { - return (T) new PackMetadataSection(Component.literal("GTCEu dynamic data"), SharedConstants.getCurrentVersion().getPackVersion(PackType.SERVER_DATA)); + if (metaReader == PackMetadataSection.TYPE) { + return (T) new PackMetadataSection(Component.literal("GTCEu dynamic data"), + SharedConstants.getCurrentVersion().getPackVersion(PackType.SERVER_DATA)); } else if (metaReader.getMetadataSectionName().equals("filter")) { JsonObject filter = new JsonObject(); JsonArray block = new JsonArray(); @@ -176,7 +185,7 @@ public String packId() { @Override public void close() { - //NOOP + // NOOP } public static ResourceLocation getRecipeLocation(ResourceLocation recipeId) { @@ -184,10 +193,12 @@ public static ResourceLocation getRecipeLocation(ResourceLocation recipeId) { } public static ResourceLocation getAdvancementLocation(ResourceLocation advancementId) { - return new ResourceLocation(advancementId.getNamespace(), String.join("", "advancements/", advancementId.getPath(), ".json")); + return new ResourceLocation(advancementId.getNamespace(), + String.join("", "advancements/", advancementId.getPath(), ".json")); } public static ResourceLocation getTagLocation(String identifier, ResourceLocation tagId) { - return new ResourceLocation(tagId.getNamespace(), String.join("", "tags/", identifier, "/", tagId.getPath(), ".json")); + return new ResourceLocation(tagId.getNamespace(), + String.join("", "tags/", identifier, "/", tagId.getPath(), ".json")); } } diff --git a/src/main/java/com/gregtechceu/gtceu/data/pack/GTDynamicResourcePack.java b/src/main/java/com/gregtechceu/gtceu/data/pack/GTDynamicResourcePack.java index 364b4cd3f2..7265b1f989 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/pack/GTDynamicResourcePack.java +++ b/src/main/java/com/gregtechceu/gtceu/data/pack/GTDynamicResourcePack.java @@ -1,14 +1,12 @@ package com.gregtechceu.gtceu.data.pack; -import com.google.common.collect.Sets; -import com.google.gson.JsonElement; import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.addon.AddonFinder; import com.gregtechceu.gtceu.api.addon.IGTAddon; import com.gregtechceu.gtceu.config.ConfigHolder; + import com.lowdragmc.lowdraglib.Platform; -import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; -import it.unimi.dsi.fastutil.objects.ObjectSet; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.SharedConstants; import net.minecraft.network.chat.Component; @@ -18,10 +16,14 @@ import net.minecraft.server.packs.metadata.MetadataSectionSerializer; import net.minecraft.server.packs.metadata.pack.PackMetadataSection; import net.minecraft.server.packs.resources.IoSupplier; + +import com.google.common.collect.Sets; +import com.google.gson.JsonElement; +import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; +import it.unimi.dsi.fastutil.objects.ObjectSet; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; @@ -37,6 +39,8 @@ import java.util.function.Supplier; import java.util.stream.Collectors; +import javax.annotation.ParametersAreNonnullByDefault; + import static com.gregtechceu.gtceu.data.pack.GTDynamicDataPack.writeJson; @MethodsReturnNonnullByDefault @@ -130,10 +134,11 @@ public static void writeByteArray(ResourceLocation id, @Nullable String subdir, if (subdir != null) { file = parent.resolve(id.getNamespace()).resolve(subdir).resolve(id.getPath() + ".png"); // assume PNG } else { - file = parent.resolve(id.getNamespace()).resolve(id.getPath()); // assume the file type is also appended if a full path is given. + file = parent.resolve(id.getNamespace()).resolve(id.getPath()); // assume the file type is also appended + // if a full path is given. } Files.createDirectories(file.getParent()); - try(OutputStream output = Files.newOutputStream(file)) { + try (OutputStream output = Files.newOutputStream(file)) { output.write(data); } } catch (IOException e) { @@ -161,12 +166,13 @@ public void listResources(PackType packType, String namespace, String path, Reso if (packType == PackType.CLIENT_RESOURCES) { if (!path.endsWith("/")) path += "/"; final String finalPath = path; - DATA.keySet().stream().filter(Objects::nonNull).filter(loc -> loc.getPath().startsWith(finalPath)).forEach((id) -> { - IoSupplier resource = this.getResource(packType, id); - if (resource != null) { - resourceOutput.accept(id, resource); - } - }); + DATA.keySet().stream().filter(Objects::nonNull).filter(loc -> loc.getPath().startsWith(finalPath)) + .forEach((id) -> { + IoSupplier resource = this.getResource(packType, id); + if (resource != null) { + resourceOutput.accept(id, resource); + } + }); } } @@ -178,8 +184,9 @@ public Set getNamespaces(PackType type) { @Nullable @Override public T getMetadataSection(MetadataSectionSerializer metaReader) { - if(metaReader == PackMetadataSection.TYPE) { - return (T) new PackMetadataSection(Component.literal("GTCEu dynamic assets"), SharedConstants.getCurrentVersion().getPackVersion(PackType.CLIENT_RESOURCES)); + if (metaReader == PackMetadataSection.TYPE) { + return (T) new PackMetadataSection(Component.literal("GTCEu dynamic assets"), + SharedConstants.getCurrentVersion().getPackVersion(PackType.CLIENT_RESOURCES)); } return null; } @@ -191,11 +198,12 @@ public String packId() { @Override public void close() { - //NOOP + // NOOP } public static ResourceLocation getBlockStateLocation(ResourceLocation blockId) { - return new ResourceLocation(blockId.getNamespace(), String.join("", "blockstates/", blockId.getPath(), ".json")); + return new ResourceLocation(blockId.getNamespace(), + String.join("", "blockstates/", blockId.getPath(), ".json")); } public static ResourceLocation getModelLocation(ResourceLocation blockId) { @@ -210,6 +218,7 @@ public static ResourceLocation getTextureLocation(@Nullable String path, Resourc if (path == null) { return new ResourceLocation(tagId.getNamespace(), String.join("", "textures/", tagId.getPath(), ".png")); } - return new ResourceLocation(tagId.getNamespace(), String.join("", "textures/", path, "/", tagId.getPath(), ".png")); + return new ResourceLocation(tagId.getNamespace(), + String.join("", "textures/", path, "/", tagId.getPath(), ".png")); } } diff --git a/src/main/java/com/gregtechceu/gtceu/data/pack/GTPackSource.java b/src/main/java/com/gregtechceu/gtceu/data/pack/GTPackSource.java index 44f20a116c..93a1b1ba63 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/pack/GTPackSource.java +++ b/src/main/java/com/gregtechceu/gtceu/data/pack/GTPackSource.java @@ -1,6 +1,5 @@ package com.gregtechceu.gtceu.data.pack; -import lombok.RequiredArgsConstructor; import net.minecraft.network.chat.Component; import net.minecraft.server.packs.PackResources; import net.minecraft.server.packs.PackType; @@ -8,6 +7,8 @@ import net.minecraft.server.packs.repository.PackSource; import net.minecraft.server.packs.repository.RepositorySource; +import lombok.RequiredArgsConstructor; + import java.util.function.Consumer; import java.util.function.Function; @@ -22,12 +23,11 @@ public class GTPackSource implements RepositorySource { @Override public void loadPacks(Consumer onLoad) { onLoad.accept(Pack.readMetaAndCreate(name, - Component.literal(name), - true, - resources::apply, - type, - position, - PackSource.BUILT_IN) - ); + Component.literal(name), + true, + resources::apply, + type, + position, + PackSource.BUILT_IN)); } } diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/CraftingComponent.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/CraftingComponent.java index a89ce20918..ccec9429d8 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/CraftingComponent.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/CraftingComponent.java @@ -11,6 +11,7 @@ import com.gregtechceu.gtceu.common.data.GTItems; import com.gregtechceu.gtceu.common.data.GTMachines; import com.gregtechceu.gtceu.common.data.GTMaterials; + import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.Blocks; @@ -69,7 +70,8 @@ public class CraftingComponent { public static Component VOLTAGE_COIL; public static Component SPRING; - public static final Map EBF_GASES = new EnumMap<>(BlastProperty.GasTier.class); + public static final Map EBF_GASES = new EnumMap<>( + BlastProperty.GasTier.class); static { EBF_GASES.put(BlastProperty.GasTier.LOW, FluidIngredient.of(1000, GTMaterials.Nitrogen.getFluid())); @@ -80,745 +82,741 @@ public class CraftingComponent { } public static void initializeComponents() { - /* * GTCEu must supply values for at least tiers 1 through 8 (through UV) */ - CIRCUIT = new Component(Stream.of(new Object[][]{ - - {0, CustomTags.ULV_CIRCUITS}, - {1, CustomTags.LV_CIRCUITS}, - {2, CustomTags.MV_CIRCUITS}, - {3, CustomTags.HV_CIRCUITS}, - {4, CustomTags.EV_CIRCUITS}, - {5, CustomTags.IV_CIRCUITS}, - {6, CustomTags.LuV_CIRCUITS}, - {7, CustomTags.ZPM_CIRCUITS}, - {8, CustomTags.UV_CIRCUITS}, - {9, CustomTags.UHV_CIRCUITS}, - {10, CustomTags.UEV_CIRCUITS}, - {11, CustomTags.UIV_CIRCUITS}, - {12, CustomTags.UXV_CIRCUITS}, - {13, CustomTags.OpV_CIRCUITS}, - {14, CustomTags.MAX_CIRCUITS}, - - }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - - BETTER_CIRCUIT = new Component(Stream.of(new Object[][]{ - - {0, CustomTags.LV_CIRCUITS}, - {1, CustomTags.MV_CIRCUITS}, - {2, CustomTags.HV_CIRCUITS}, - {3, CustomTags.EV_CIRCUITS}, - {4, CustomTags.IV_CIRCUITS}, - {5, CustomTags.LuV_CIRCUITS}, - {6, CustomTags.ZPM_CIRCUITS}, - {7, CustomTags.UV_CIRCUITS}, - {8, CustomTags.UHV_CIRCUITS}, - {10, CustomTags.UEV_CIRCUITS}, - {11, CustomTags.UIV_CIRCUITS}, - {12, CustomTags.UXV_CIRCUITS}, - {13, CustomTags.OpV_CIRCUITS}, - {14, CustomTags.MAX_CIRCUITS}, - - }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - - PUMP = new Component(Stream.of(new Object[][]{ - - {1, GTItems.ELECTRIC_PUMP_LV.asStack()}, - {2, GTItems.ELECTRIC_PUMP_MV.asStack()}, - {3, GTItems.ELECTRIC_PUMP_HV.asStack()}, - {4, GTItems.ELECTRIC_PUMP_EV.asStack()}, - {5, GTItems.ELECTRIC_PUMP_IV.asStack()}, - {6, GTItems.ELECTRIC_PUMP_LuV.asStack()}, - {7, GTItems.ELECTRIC_PUMP_ZPM.asStack()}, - {8, GTItems.ELECTRIC_PUMP_UV.asStack()}, + CIRCUIT = new Component(Stream.of(new Object[][] { + + { 0, CustomTags.ULV_CIRCUITS }, + { 1, CustomTags.LV_CIRCUITS }, + { 2, CustomTags.MV_CIRCUITS }, + { 3, CustomTags.HV_CIRCUITS }, + { 4, CustomTags.EV_CIRCUITS }, + { 5, CustomTags.IV_CIRCUITS }, + { 6, CustomTags.LuV_CIRCUITS }, + { 7, CustomTags.ZPM_CIRCUITS }, + { 8, CustomTags.UV_CIRCUITS }, + { 9, CustomTags.UHV_CIRCUITS }, + { 10, CustomTags.UEV_CIRCUITS }, + { 11, CustomTags.UIV_CIRCUITS }, + { 12, CustomTags.UXV_CIRCUITS }, + { 13, CustomTags.OpV_CIRCUITS }, + { 14, CustomTags.MAX_CIRCUITS }, + + }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); + + BETTER_CIRCUIT = new Component(Stream.of(new Object[][] { + + { 0, CustomTags.LV_CIRCUITS }, + { 1, CustomTags.MV_CIRCUITS }, + { 2, CustomTags.HV_CIRCUITS }, + { 3, CustomTags.EV_CIRCUITS }, + { 4, CustomTags.IV_CIRCUITS }, + { 5, CustomTags.LuV_CIRCUITS }, + { 6, CustomTags.ZPM_CIRCUITS }, + { 7, CustomTags.UV_CIRCUITS }, + { 8, CustomTags.UHV_CIRCUITS }, + { 10, CustomTags.UEV_CIRCUITS }, + { 11, CustomTags.UIV_CIRCUITS }, + { 12, CustomTags.UXV_CIRCUITS }, + { 13, CustomTags.OpV_CIRCUITS }, + { 14, CustomTags.MAX_CIRCUITS }, + + }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); + + PUMP = new Component(Stream.of(new Object[][] { + + { 1, GTItems.ELECTRIC_PUMP_LV.asStack() }, + { 2, GTItems.ELECTRIC_PUMP_MV.asStack() }, + { 3, GTItems.ELECTRIC_PUMP_HV.asStack() }, + { 4, GTItems.ELECTRIC_PUMP_EV.asStack() }, + { 5, GTItems.ELECTRIC_PUMP_IV.asStack() }, + { 6, GTItems.ELECTRIC_PUMP_LuV.asStack() }, + { 7, GTItems.ELECTRIC_PUMP_ZPM.asStack() }, + { 8, GTItems.ELECTRIC_PUMP_UV.asStack() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); if (GTCEuAPI.isHighTier()) { - PUMP.appendIngredients(Stream.of(new Object[][]{ - {9, GTItems.ELECTRIC_PUMP_UHV.asStack()}, - {10, GTItems.ELECTRIC_PUMP_UEV.asStack()}, - {11, GTItems.ELECTRIC_PUMP_UIV.asStack()}, - {12, GTItems.ELECTRIC_PUMP_UXV.asStack()}, - {13, GTItems.ELECTRIC_PUMP_OpV.asStack()}, + PUMP.appendIngredients(Stream.of(new Object[][] { + { 9, GTItems.ELECTRIC_PUMP_UHV.asStack() }, + { 10, GTItems.ELECTRIC_PUMP_UEV.asStack() }, + { 11, GTItems.ELECTRIC_PUMP_UIV.asStack() }, + { 12, GTItems.ELECTRIC_PUMP_UXV.asStack() }, + { 13, GTItems.ELECTRIC_PUMP_OpV.asStack() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); } - WIRE_ELECTRIC = new Component(Stream.of(new Object[][]{ + WIRE_ELECTRIC = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(TagPrefix.wireGtSingle, GTMaterials.Gold)}, - {1, new UnificationEntry(TagPrefix.wireGtSingle, GTMaterials.Gold)}, - {2, new UnificationEntry(TagPrefix.wireGtSingle, GTMaterials.Silver)}, - {3, new UnificationEntry(TagPrefix.wireGtSingle, GTMaterials.Electrum)}, - {4, new UnificationEntry(TagPrefix.wireGtSingle, GTMaterials.Platinum)}, - {5, new UnificationEntry(TagPrefix.wireGtSingle, GTMaterials.Osmium)}, - {6, new UnificationEntry(TagPrefix.wireGtSingle, GTMaterials.Osmium)}, - {7, new UnificationEntry(TagPrefix.wireGtSingle, GTMaterials.Osmium)}, - {8, new UnificationEntry(TagPrefix.wireGtSingle, GTMaterials.Osmium)}, + { 0, new UnificationEntry(TagPrefix.wireGtSingle, GTMaterials.Gold) }, + { 1, new UnificationEntry(TagPrefix.wireGtSingle, GTMaterials.Gold) }, + { 2, new UnificationEntry(TagPrefix.wireGtSingle, GTMaterials.Silver) }, + { 3, new UnificationEntry(TagPrefix.wireGtSingle, GTMaterials.Electrum) }, + { 4, new UnificationEntry(TagPrefix.wireGtSingle, GTMaterials.Platinum) }, + { 5, new UnificationEntry(TagPrefix.wireGtSingle, GTMaterials.Osmium) }, + { 6, new UnificationEntry(TagPrefix.wireGtSingle, GTMaterials.Osmium) }, + { 7, new UnificationEntry(TagPrefix.wireGtSingle, GTMaterials.Osmium) }, + { 8, new UnificationEntry(TagPrefix.wireGtSingle, GTMaterials.Osmium) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - WIRE_QUAD = new Component(Stream.of(new Object[][]{ + WIRE_QUAD = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(TagPrefix.wireGtQuadruple, GTMaterials.Lead)}, - {1, new UnificationEntry(TagPrefix.wireGtQuadruple, GTMaterials.Tin)}, - {2, new UnificationEntry(TagPrefix.wireGtQuadruple, GTMaterials.Copper)}, - {3, new UnificationEntry(TagPrefix.wireGtQuadruple, GTMaterials.Gold)}, - {4, new UnificationEntry(TagPrefix.wireGtQuadruple, GTMaterials.Aluminium)}, - {5, new UnificationEntry(TagPrefix.wireGtQuadruple, GTMaterials.Tungsten)}, - {6, new UnificationEntry(TagPrefix.wireGtQuadruple, GTMaterials.NiobiumTitanium)}, - {7, new UnificationEntry(TagPrefix.wireGtQuadruple, GTMaterials.VanadiumGallium)}, - {8, new UnificationEntry(TagPrefix.wireGtQuadruple, GTMaterials.YttriumBariumCuprate)}, + { 0, new UnificationEntry(TagPrefix.wireGtQuadruple, GTMaterials.Lead) }, + { 1, new UnificationEntry(TagPrefix.wireGtQuadruple, GTMaterials.Tin) }, + { 2, new UnificationEntry(TagPrefix.wireGtQuadruple, GTMaterials.Copper) }, + { 3, new UnificationEntry(TagPrefix.wireGtQuadruple, GTMaterials.Gold) }, + { 4, new UnificationEntry(TagPrefix.wireGtQuadruple, GTMaterials.Aluminium) }, + { 5, new UnificationEntry(TagPrefix.wireGtQuadruple, GTMaterials.Tungsten) }, + { 6, new UnificationEntry(TagPrefix.wireGtQuadruple, GTMaterials.NiobiumTitanium) }, + { 7, new UnificationEntry(TagPrefix.wireGtQuadruple, GTMaterials.VanadiumGallium) }, + { 8, new UnificationEntry(TagPrefix.wireGtQuadruple, GTMaterials.YttriumBariumCuprate) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - WIRE_OCT = new Component(Stream.of(new Object[][]{ + WIRE_OCT = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(TagPrefix.wireGtOctal, GTMaterials.Lead)}, - {1, new UnificationEntry(TagPrefix.wireGtOctal, GTMaterials.Tin)}, - {2, new UnificationEntry(TagPrefix.wireGtOctal, GTMaterials.Copper)}, - {3, new UnificationEntry(TagPrefix.wireGtOctal, GTMaterials.Gold)}, - {4, new UnificationEntry(TagPrefix.wireGtOctal, GTMaterials.Aluminium)}, - {5, new UnificationEntry(TagPrefix.wireGtOctal, GTMaterials.Tungsten)}, - {6, new UnificationEntry(TagPrefix.wireGtOctal, GTMaterials.NiobiumTitanium)}, - {7, new UnificationEntry(TagPrefix.wireGtOctal, GTMaterials.VanadiumGallium)}, - {8, new UnificationEntry(TagPrefix.wireGtOctal, GTMaterials.YttriumBariumCuprate)}, + { 0, new UnificationEntry(TagPrefix.wireGtOctal, GTMaterials.Lead) }, + { 1, new UnificationEntry(TagPrefix.wireGtOctal, GTMaterials.Tin) }, + { 2, new UnificationEntry(TagPrefix.wireGtOctal, GTMaterials.Copper) }, + { 3, new UnificationEntry(TagPrefix.wireGtOctal, GTMaterials.Gold) }, + { 4, new UnificationEntry(TagPrefix.wireGtOctal, GTMaterials.Aluminium) }, + { 5, new UnificationEntry(TagPrefix.wireGtOctal, GTMaterials.Tungsten) }, + { 6, new UnificationEntry(TagPrefix.wireGtOctal, GTMaterials.NiobiumTitanium) }, + { 7, new UnificationEntry(TagPrefix.wireGtOctal, GTMaterials.VanadiumGallium) }, + { 8, new UnificationEntry(TagPrefix.wireGtOctal, GTMaterials.YttriumBariumCuprate) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - WIRE_HEX = new Component(Stream.of(new Object[][]{ + WIRE_HEX = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(TagPrefix.wireGtHex, GTMaterials.Lead)}, - {1, new UnificationEntry(TagPrefix.wireGtHex, GTMaterials.Tin)}, - {2, new UnificationEntry(TagPrefix.wireGtHex, GTMaterials.Copper)}, - {3, new UnificationEntry(TagPrefix.wireGtHex, GTMaterials.Gold)}, - {4, new UnificationEntry(TagPrefix.wireGtHex, GTMaterials.Aluminium)}, - {5, new UnificationEntry(TagPrefix.wireGtHex, GTMaterials.Tungsten)}, - {6, new UnificationEntry(TagPrefix.wireGtHex, GTMaterials.NiobiumTitanium)}, - {7, new UnificationEntry(TagPrefix.wireGtHex, GTMaterials.VanadiumGallium)}, - {8, new UnificationEntry(TagPrefix.wireGtHex, GTMaterials.YttriumBariumCuprate)}, + { 0, new UnificationEntry(TagPrefix.wireGtHex, GTMaterials.Lead) }, + { 1, new UnificationEntry(TagPrefix.wireGtHex, GTMaterials.Tin) }, + { 2, new UnificationEntry(TagPrefix.wireGtHex, GTMaterials.Copper) }, + { 3, new UnificationEntry(TagPrefix.wireGtHex, GTMaterials.Gold) }, + { 4, new UnificationEntry(TagPrefix.wireGtHex, GTMaterials.Aluminium) }, + { 5, new UnificationEntry(TagPrefix.wireGtHex, GTMaterials.Tungsten) }, + { 6, new UnificationEntry(TagPrefix.wireGtHex, GTMaterials.NiobiumTitanium) }, + { 7, new UnificationEntry(TagPrefix.wireGtHex, GTMaterials.VanadiumGallium) }, + { 8, new UnificationEntry(TagPrefix.wireGtHex, GTMaterials.YttriumBariumCuprate) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - CABLE = new Component(Stream.of(new Object[][]{ + CABLE = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.RedAlloy)}, - {1, new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Tin)}, - {2, new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Copper)}, - {3, new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Gold)}, - {4, new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Aluminium)}, - {5, new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Platinum)}, - {6, new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.NiobiumTitanium)}, - {7, new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.VanadiumGallium)}, - {8, new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.YttriumBariumCuprate)}, - {9, new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Europium)}, + { 0, new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.RedAlloy) }, + { 1, new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Tin) }, + { 2, new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Copper) }, + { 3, new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Gold) }, + { 4, new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Aluminium) }, + { 5, new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Platinum) }, + { 6, new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.NiobiumTitanium) }, + { 7, new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.VanadiumGallium) }, + { 8, new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.YttriumBariumCuprate) }, + { 9, new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Europium) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - CABLE_DOUBLE = new Component(Stream.of(new Object[][]{ + CABLE_DOUBLE = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(TagPrefix.cableGtDouble, GTMaterials.RedAlloy)}, - {1, new UnificationEntry(TagPrefix.cableGtDouble, GTMaterials.Tin)}, - {2, new UnificationEntry(TagPrefix.cableGtDouble, GTMaterials.Copper)}, - {3, new UnificationEntry(TagPrefix.cableGtDouble, GTMaterials.Gold)}, - {4, new UnificationEntry(TagPrefix.cableGtDouble, GTMaterials.Aluminium)}, - {5, new UnificationEntry(TagPrefix.cableGtDouble, GTMaterials.Platinum)}, - {6, new UnificationEntry(TagPrefix.cableGtDouble, GTMaterials.NiobiumTitanium)}, - {7, new UnificationEntry(TagPrefix.cableGtDouble, GTMaterials.VanadiumGallium)}, - {8, new UnificationEntry(TagPrefix.cableGtDouble, GTMaterials.YttriumBariumCuprate)}, - {9, new UnificationEntry(TagPrefix.cableGtDouble, GTMaterials.Europium)}, + { 0, new UnificationEntry(TagPrefix.cableGtDouble, GTMaterials.RedAlloy) }, + { 1, new UnificationEntry(TagPrefix.cableGtDouble, GTMaterials.Tin) }, + { 2, new UnificationEntry(TagPrefix.cableGtDouble, GTMaterials.Copper) }, + { 3, new UnificationEntry(TagPrefix.cableGtDouble, GTMaterials.Gold) }, + { 4, new UnificationEntry(TagPrefix.cableGtDouble, GTMaterials.Aluminium) }, + { 5, new UnificationEntry(TagPrefix.cableGtDouble, GTMaterials.Platinum) }, + { 6, new UnificationEntry(TagPrefix.cableGtDouble, GTMaterials.NiobiumTitanium) }, + { 7, new UnificationEntry(TagPrefix.cableGtDouble, GTMaterials.VanadiumGallium) }, + { 8, new UnificationEntry(TagPrefix.cableGtDouble, GTMaterials.YttriumBariumCuprate) }, + { 9, new UnificationEntry(TagPrefix.cableGtDouble, GTMaterials.Europium) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - CABLE_QUAD = new Component(Stream.of(new Object[][]{ + CABLE_QUAD = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(TagPrefix.cableGtQuadruple, GTMaterials.RedAlloy)}, - {1, new UnificationEntry(TagPrefix.cableGtQuadruple, GTMaterials.Tin)}, - {2, new UnificationEntry(TagPrefix.cableGtQuadruple, GTMaterials.Copper)}, - {3, new UnificationEntry(TagPrefix.cableGtQuadruple, GTMaterials.Gold)}, - {4, new UnificationEntry(TagPrefix.cableGtQuadruple, GTMaterials.Aluminium)}, - {5, new UnificationEntry(TagPrefix.cableGtQuadruple, GTMaterials.Platinum)}, - {6, new UnificationEntry(TagPrefix.cableGtQuadruple, GTMaterials.NiobiumTitanium)}, - {7, new UnificationEntry(TagPrefix.cableGtQuadruple, GTMaterials.VanadiumGallium)}, - {8, new UnificationEntry(TagPrefix.cableGtQuadruple, GTMaterials.YttriumBariumCuprate)}, - {9, new UnificationEntry(TagPrefix.cableGtQuadruple, GTMaterials.Europium)}, + { 0, new UnificationEntry(TagPrefix.cableGtQuadruple, GTMaterials.RedAlloy) }, + { 1, new UnificationEntry(TagPrefix.cableGtQuadruple, GTMaterials.Tin) }, + { 2, new UnificationEntry(TagPrefix.cableGtQuadruple, GTMaterials.Copper) }, + { 3, new UnificationEntry(TagPrefix.cableGtQuadruple, GTMaterials.Gold) }, + { 4, new UnificationEntry(TagPrefix.cableGtQuadruple, GTMaterials.Aluminium) }, + { 5, new UnificationEntry(TagPrefix.cableGtQuadruple, GTMaterials.Platinum) }, + { 6, new UnificationEntry(TagPrefix.cableGtQuadruple, GTMaterials.NiobiumTitanium) }, + { 7, new UnificationEntry(TagPrefix.cableGtQuadruple, GTMaterials.VanadiumGallium) }, + { 8, new UnificationEntry(TagPrefix.cableGtQuadruple, GTMaterials.YttriumBariumCuprate) }, + { 9, new UnificationEntry(TagPrefix.cableGtQuadruple, GTMaterials.Europium) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - CABLE_OCT = new Component(Stream.of(new Object[][]{ + CABLE_OCT = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(TagPrefix.cableGtOctal, GTMaterials.RedAlloy)}, - {1, new UnificationEntry(TagPrefix.cableGtOctal, GTMaterials.Tin)}, - {2, new UnificationEntry(TagPrefix.cableGtOctal, GTMaterials.Copper)}, - {3, new UnificationEntry(TagPrefix.cableGtOctal, GTMaterials.Gold)}, - {4, new UnificationEntry(TagPrefix.cableGtOctal, GTMaterials.Aluminium)}, - {5, new UnificationEntry(TagPrefix.cableGtOctal, GTMaterials.Platinum)}, - {6, new UnificationEntry(TagPrefix.cableGtOctal, GTMaterials.NiobiumTitanium)}, - {7, new UnificationEntry(TagPrefix.cableGtOctal, GTMaterials.VanadiumGallium)}, - {8, new UnificationEntry(TagPrefix.cableGtOctal, GTMaterials.YttriumBariumCuprate)}, - {9, new UnificationEntry(TagPrefix.cableGtOctal, GTMaterials.Europium)}, + { 0, new UnificationEntry(TagPrefix.cableGtOctal, GTMaterials.RedAlloy) }, + { 1, new UnificationEntry(TagPrefix.cableGtOctal, GTMaterials.Tin) }, + { 2, new UnificationEntry(TagPrefix.cableGtOctal, GTMaterials.Copper) }, + { 3, new UnificationEntry(TagPrefix.cableGtOctal, GTMaterials.Gold) }, + { 4, new UnificationEntry(TagPrefix.cableGtOctal, GTMaterials.Aluminium) }, + { 5, new UnificationEntry(TagPrefix.cableGtOctal, GTMaterials.Platinum) }, + { 6, new UnificationEntry(TagPrefix.cableGtOctal, GTMaterials.NiobiumTitanium) }, + { 7, new UnificationEntry(TagPrefix.cableGtOctal, GTMaterials.VanadiumGallium) }, + { 8, new UnificationEntry(TagPrefix.cableGtOctal, GTMaterials.YttriumBariumCuprate) }, + { 9, new UnificationEntry(TagPrefix.cableGtOctal, GTMaterials.Europium) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - CABLE_HEX = new Component(Stream.of(new Object[][]{ + CABLE_HEX = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(TagPrefix.cableGtHex, GTMaterials.RedAlloy)}, - {1, new UnificationEntry(TagPrefix.cableGtHex, GTMaterials.Tin)}, - {2, new UnificationEntry(TagPrefix.cableGtHex, GTMaterials.Copper)}, - {3, new UnificationEntry(TagPrefix.cableGtHex, GTMaterials.Gold)}, - {4, new UnificationEntry(TagPrefix.cableGtHex, GTMaterials.Aluminium)}, - {5, new UnificationEntry(TagPrefix.cableGtHex, GTMaterials.Platinum)}, - {6, new UnificationEntry(TagPrefix.cableGtHex, GTMaterials.NiobiumTitanium)}, - {7, new UnificationEntry(TagPrefix.cableGtHex, GTMaterials.VanadiumGallium)}, - {8, new UnificationEntry(TagPrefix.cableGtHex, GTMaterials.YttriumBariumCuprate)}, - {9, new UnificationEntry(TagPrefix.cableGtHex, GTMaterials.Europium)}, + { 0, new UnificationEntry(TagPrefix.cableGtHex, GTMaterials.RedAlloy) }, + { 1, new UnificationEntry(TagPrefix.cableGtHex, GTMaterials.Tin) }, + { 2, new UnificationEntry(TagPrefix.cableGtHex, GTMaterials.Copper) }, + { 3, new UnificationEntry(TagPrefix.cableGtHex, GTMaterials.Gold) }, + { 4, new UnificationEntry(TagPrefix.cableGtHex, GTMaterials.Aluminium) }, + { 5, new UnificationEntry(TagPrefix.cableGtHex, GTMaterials.Platinum) }, + { 6, new UnificationEntry(TagPrefix.cableGtHex, GTMaterials.NiobiumTitanium) }, + { 7, new UnificationEntry(TagPrefix.cableGtHex, GTMaterials.VanadiumGallium) }, + { 8, new UnificationEntry(TagPrefix.cableGtHex, GTMaterials.YttriumBariumCuprate) }, + { 9, new UnificationEntry(TagPrefix.cableGtHex, GTMaterials.Europium) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - CABLE_TIER_UP = new Component(Stream.of(new Object[][]{ + CABLE_TIER_UP = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Tin)}, - {1, new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Copper)}, - {2, new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Gold)}, - {3, new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Aluminium)}, - {4, new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Platinum)}, - {5, new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.NiobiumTitanium)}, - {6, new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.VanadiumGallium)}, - {7, new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.YttriumBariumCuprate)}, - {8, new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Europium)}, - {FALLBACK, new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Europium)}, + { 0, new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Tin) }, + { 1, new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Copper) }, + { 2, new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Gold) }, + { 3, new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Aluminium) }, + { 4, new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Platinum) }, + { 5, new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.NiobiumTitanium) }, + { 6, new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.VanadiumGallium) }, + { 7, new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.YttriumBariumCuprate) }, + { 8, new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Europium) }, + { FALLBACK, new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Europium) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - CABLE_TIER_UP_DOUBLE = new Component(Stream.of(new Object[][]{ + CABLE_TIER_UP_DOUBLE = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(TagPrefix.cableGtDouble, GTMaterials.Tin)}, - {1, new UnificationEntry(TagPrefix.cableGtDouble, GTMaterials.Copper)}, - {2, new UnificationEntry(TagPrefix.cableGtDouble, GTMaterials.Gold)}, - {3, new UnificationEntry(TagPrefix.cableGtDouble, GTMaterials.Aluminium)}, - {4, new UnificationEntry(TagPrefix.cableGtDouble, GTMaterials.Platinum)}, - {5, new UnificationEntry(TagPrefix.cableGtDouble, GTMaterials.NiobiumTitanium)}, - {6, new UnificationEntry(TagPrefix.cableGtDouble, GTMaterials.VanadiumGallium)}, - {7, new UnificationEntry(TagPrefix.cableGtDouble, GTMaterials.YttriumBariumCuprate)}, - {8, new UnificationEntry(TagPrefix.cableGtDouble, GTMaterials.Europium)}, - {FALLBACK, new UnificationEntry(TagPrefix.cableGtDouble, GTMaterials.Europium)}, + { 0, new UnificationEntry(TagPrefix.cableGtDouble, GTMaterials.Tin) }, + { 1, new UnificationEntry(TagPrefix.cableGtDouble, GTMaterials.Copper) }, + { 2, new UnificationEntry(TagPrefix.cableGtDouble, GTMaterials.Gold) }, + { 3, new UnificationEntry(TagPrefix.cableGtDouble, GTMaterials.Aluminium) }, + { 4, new UnificationEntry(TagPrefix.cableGtDouble, GTMaterials.Platinum) }, + { 5, new UnificationEntry(TagPrefix.cableGtDouble, GTMaterials.NiobiumTitanium) }, + { 6, new UnificationEntry(TagPrefix.cableGtDouble, GTMaterials.VanadiumGallium) }, + { 7, new UnificationEntry(TagPrefix.cableGtDouble, GTMaterials.YttriumBariumCuprate) }, + { 8, new UnificationEntry(TagPrefix.cableGtDouble, GTMaterials.Europium) }, + { FALLBACK, new UnificationEntry(TagPrefix.cableGtDouble, GTMaterials.Europium) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - CABLE_TIER_UP_QUAD = new Component(Stream.of(new Object[][]{ + CABLE_TIER_UP_QUAD = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(TagPrefix.cableGtQuadruple, GTMaterials.Tin)}, - {1, new UnificationEntry(TagPrefix.cableGtQuadruple, GTMaterials.Copper)}, - {2, new UnificationEntry(TagPrefix.cableGtQuadruple, GTMaterials.Gold)}, - {3, new UnificationEntry(TagPrefix.cableGtQuadruple, GTMaterials.Aluminium)}, - {4, new UnificationEntry(TagPrefix.cableGtQuadruple, GTMaterials.Platinum)}, - {5, new UnificationEntry(TagPrefix.cableGtQuadruple, GTMaterials.NiobiumTitanium)}, - {6, new UnificationEntry(TagPrefix.cableGtQuadruple, GTMaterials.VanadiumGallium)}, - {7, new UnificationEntry(TagPrefix.cableGtQuadruple, GTMaterials.YttriumBariumCuprate)}, - {8, new UnificationEntry(TagPrefix.cableGtQuadruple, GTMaterials.Europium)}, - {FALLBACK, new UnificationEntry(TagPrefix.cableGtQuadruple, GTMaterials.Europium)}, + { 0, new UnificationEntry(TagPrefix.cableGtQuadruple, GTMaterials.Tin) }, + { 1, new UnificationEntry(TagPrefix.cableGtQuadruple, GTMaterials.Copper) }, + { 2, new UnificationEntry(TagPrefix.cableGtQuadruple, GTMaterials.Gold) }, + { 3, new UnificationEntry(TagPrefix.cableGtQuadruple, GTMaterials.Aluminium) }, + { 4, new UnificationEntry(TagPrefix.cableGtQuadruple, GTMaterials.Platinum) }, + { 5, new UnificationEntry(TagPrefix.cableGtQuadruple, GTMaterials.NiobiumTitanium) }, + { 6, new UnificationEntry(TagPrefix.cableGtQuadruple, GTMaterials.VanadiumGallium) }, + { 7, new UnificationEntry(TagPrefix.cableGtQuadruple, GTMaterials.YttriumBariumCuprate) }, + { 8, new UnificationEntry(TagPrefix.cableGtQuadruple, GTMaterials.Europium) }, + { FALLBACK, new UnificationEntry(TagPrefix.cableGtQuadruple, GTMaterials.Europium) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - CABLE_TIER_UP_HEX = new Component(Stream.of(new Object[][]{ + CABLE_TIER_UP_HEX = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(TagPrefix.cableGtHex, GTMaterials.Tin)}, - {1, new UnificationEntry(TagPrefix.cableGtHex, GTMaterials.Copper)}, - {2, new UnificationEntry(TagPrefix.cableGtHex, GTMaterials.Gold)}, - {3, new UnificationEntry(TagPrefix.cableGtHex, GTMaterials.Aluminium)}, - {4, new UnificationEntry(TagPrefix.cableGtHex, GTMaterials.Platinum)}, - {5, new UnificationEntry(TagPrefix.cableGtHex, GTMaterials.NiobiumTitanium)}, - {6, new UnificationEntry(TagPrefix.cableGtHex, GTMaterials.VanadiumGallium)}, - {7, new UnificationEntry(TagPrefix.cableGtHex, GTMaterials.YttriumBariumCuprate)}, - {8, new UnificationEntry(TagPrefix.cableGtHex, GTMaterials.Europium)}, - {FALLBACK, new UnificationEntry(TagPrefix.cableGtHex, GTMaterials.Europium)}, + { 0, new UnificationEntry(TagPrefix.cableGtHex, GTMaterials.Tin) }, + { 1, new UnificationEntry(TagPrefix.cableGtHex, GTMaterials.Copper) }, + { 2, new UnificationEntry(TagPrefix.cableGtHex, GTMaterials.Gold) }, + { 3, new UnificationEntry(TagPrefix.cableGtHex, GTMaterials.Aluminium) }, + { 4, new UnificationEntry(TagPrefix.cableGtHex, GTMaterials.Platinum) }, + { 5, new UnificationEntry(TagPrefix.cableGtHex, GTMaterials.NiobiumTitanium) }, + { 6, new UnificationEntry(TagPrefix.cableGtHex, GTMaterials.VanadiumGallium) }, + { 7, new UnificationEntry(TagPrefix.cableGtHex, GTMaterials.YttriumBariumCuprate) }, + { 8, new UnificationEntry(TagPrefix.cableGtHex, GTMaterials.Europium) }, + { FALLBACK, new UnificationEntry(TagPrefix.cableGtHex, GTMaterials.Europium) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - HULL = new Component(Stream.of(new Object[][]{ + HULL = new Component(Stream.of(new Object[][] { - {0, GTMachines.HULL[0].asStack()}, - {1, GTMachines.HULL[1].asStack()}, - {2, GTMachines.HULL[2].asStack()}, - {3, GTMachines.HULL[3].asStack()}, - {4, GTMachines.HULL[4].asStack()}, - {5, GTMachines.HULL[5].asStack()}, - {6, GTMachines.HULL[6].asStack()}, - {7, GTMachines.HULL[7].asStack()}, - {8, GTMachines.HULL[8].asStack()}, - {9, GTMachines.HULL[9].asStack()}, + { 0, GTMachines.HULL[0].asStack() }, + { 1, GTMachines.HULL[1].asStack() }, + { 2, GTMachines.HULL[2].asStack() }, + { 3, GTMachines.HULL[3].asStack() }, + { 4, GTMachines.HULL[4].asStack() }, + { 5, GTMachines.HULL[5].asStack() }, + { 6, GTMachines.HULL[6].asStack() }, + { 7, GTMachines.HULL[7].asStack() }, + { 8, GTMachines.HULL[8].asStack() }, + { 9, GTMachines.HULL[9].asStack() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); if (GTCEuAPI.isHighTier()) { - HULL.appendIngredients(Stream.of(new Object[][]{ - {10, GTMachines.HULL[10].asStack()}, - {11, GTMachines.HULL[11].asStack()}, - {12, GTMachines.HULL[12].asStack()}, - {13, GTMachines.HULL[13].asStack()}, - {14, GTMachines.HULL[14].asStack()}, + HULL.appendIngredients(Stream.of(new Object[][] { + { 10, GTMachines.HULL[10].asStack() }, + { 11, GTMachines.HULL[11].asStack() }, + { 12, GTMachines.HULL[12].asStack() }, + { 13, GTMachines.HULL[13].asStack() }, + { 14, GTMachines.HULL[14].asStack() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); } - CASING = new Component(Stream.of(new Object[][]{ + CASING = new Component(Stream.of(new Object[][] { - {0, GTBlocks.MACHINE_CASING_ULV.asStack()}, - {1, GTBlocks.MACHINE_CASING_LV.asStack()}, - {2, GTBlocks.MACHINE_CASING_MV.asStack()}, - {3, GTBlocks.MACHINE_CASING_HV.asStack()}, - {4, GTBlocks.MACHINE_CASING_EV.asStack()}, - {5, GTBlocks.MACHINE_CASING_IV.asStack()}, - {6, GTBlocks.MACHINE_CASING_LuV.asStack()}, - {7, GTBlocks.MACHINE_CASING_ZPM.asStack()}, - {8, GTBlocks.MACHINE_CASING_UV.asStack()}, - {9, GTBlocks.MACHINE_CASING_UHV.asStack()}, + { 0, GTBlocks.MACHINE_CASING_ULV.asStack() }, + { 1, GTBlocks.MACHINE_CASING_LV.asStack() }, + { 2, GTBlocks.MACHINE_CASING_MV.asStack() }, + { 3, GTBlocks.MACHINE_CASING_HV.asStack() }, + { 4, GTBlocks.MACHINE_CASING_EV.asStack() }, + { 5, GTBlocks.MACHINE_CASING_IV.asStack() }, + { 6, GTBlocks.MACHINE_CASING_LuV.asStack() }, + { 7, GTBlocks.MACHINE_CASING_ZPM.asStack() }, + { 8, GTBlocks.MACHINE_CASING_UV.asStack() }, + { 9, GTBlocks.MACHINE_CASING_UHV.asStack() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); if (GTCEuAPI.isHighTier()) { - CASING.appendIngredients(Stream.of(new Object[][]{ - {10, GTBlocks.MACHINE_CASING_UEV.asStack()}, - {11, GTBlocks.MACHINE_CASING_UIV.asStack()}, - {12, GTBlocks.MACHINE_CASING_UXV.asStack()}, - {13, GTBlocks.MACHINE_CASING_OpV.asStack()}, - {14, GTBlocks.MACHINE_CASING_MAX.asStack()}, + CASING.appendIngredients(Stream.of(new Object[][] { + { 10, GTBlocks.MACHINE_CASING_UEV.asStack() }, + { 11, GTBlocks.MACHINE_CASING_UIV.asStack() }, + { 12, GTBlocks.MACHINE_CASING_UXV.asStack() }, + { 13, GTBlocks.MACHINE_CASING_OpV.asStack() }, + { 14, GTBlocks.MACHINE_CASING_MAX.asStack() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); } - PIPE_NORMAL = new Component(Stream.of(new Object[][]{ + PIPE_NORMAL = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.Bronze)}, - {1, new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.Bronze)}, - {2, new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.Steel)}, - {3, new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.StainlessSteel)}, - {4, new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.Titanium)}, - {5, new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.TungstenSteel)}, - {6, new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.NiobiumTitanium)}, - {7, new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.Iridium)}, - {8, new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.Naquadah)}, + { 0, new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.Bronze) }, + { 1, new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.Bronze) }, + { 2, new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.Steel) }, + { 3, new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.StainlessSteel) }, + { 4, new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.Titanium) }, + { 5, new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.TungstenSteel) }, + { 6, new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.NiobiumTitanium) }, + { 7, new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.Iridium) }, + { 8, new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.Naquadah) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - PIPE_LARGE = new Component(Stream.of(new Object[][]{ + PIPE_LARGE = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(TagPrefix.pipeLargeFluid, GTMaterials.Bronze)}, - {1, new UnificationEntry(TagPrefix.pipeLargeFluid, GTMaterials.Bronze)}, - {2, new UnificationEntry(TagPrefix.pipeLargeFluid, GTMaterials.Steel)}, - {3, new UnificationEntry(TagPrefix.pipeLargeFluid, GTMaterials.StainlessSteel)}, - {4, new UnificationEntry(TagPrefix.pipeLargeFluid, GTMaterials.Titanium)}, - {5, new UnificationEntry(TagPrefix.pipeLargeFluid, GTMaterials.TungstenSteel)}, - {6, new UnificationEntry(TagPrefix.pipeLargeFluid, GTMaterials.NiobiumTitanium)}, - {7, new UnificationEntry(TagPrefix.pipeLargeFluid, GTMaterials.Ultimet)}, - {8, new UnificationEntry(TagPrefix.pipeLargeFluid, GTMaterials.Naquadah)}, + { 0, new UnificationEntry(TagPrefix.pipeLargeFluid, GTMaterials.Bronze) }, + { 1, new UnificationEntry(TagPrefix.pipeLargeFluid, GTMaterials.Bronze) }, + { 2, new UnificationEntry(TagPrefix.pipeLargeFluid, GTMaterials.Steel) }, + { 3, new UnificationEntry(TagPrefix.pipeLargeFluid, GTMaterials.StainlessSteel) }, + { 4, new UnificationEntry(TagPrefix.pipeLargeFluid, GTMaterials.Titanium) }, + { 5, new UnificationEntry(TagPrefix.pipeLargeFluid, GTMaterials.TungstenSteel) }, + { 6, new UnificationEntry(TagPrefix.pipeLargeFluid, GTMaterials.NiobiumTitanium) }, + { 7, new UnificationEntry(TagPrefix.pipeLargeFluid, GTMaterials.Ultimet) }, + { 8, new UnificationEntry(TagPrefix.pipeLargeFluid, GTMaterials.Naquadah) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - /* - Glass: Steam-MV - Tempered: HV, EV - Laminated Glass: IV, LuV - Fusion: ZPM, UV + * Glass: Steam-MV + * Tempered: HV, EV + * Laminated Glass: IV, LuV + * Fusion: ZPM, UV */ - GLASS = new Component(Stream.of(new Object[][]{ + GLASS = new Component(Stream.of(new Object[][] { - {GTValues.FALLBACK, CustomTags.GLASS_BLOCKS}, - {ULV, CustomTags.GLASS_BLOCKS}, - {LV, CustomTags.GLASS_BLOCKS}, - {MV, CustomTags.GLASS_BLOCKS}, - {HV, GTBlocks.CASING_TEMPERED_GLASS.asStack()}, - {EV, GTBlocks.CASING_TEMPERED_GLASS.asStack()}, - {IV, GTBlocks.CASING_LAMINATED_GLASS.asStack()}, - {LuV, GTBlocks.CASING_LAMINATED_GLASS.asStack()}, - {ZPM, GTBlocks.FUSION_GLASS.asStack()}, - {UV, GTBlocks.FUSION_GLASS.asStack()} + { GTValues.FALLBACK, CustomTags.GLASS_BLOCKS }, + { ULV, CustomTags.GLASS_BLOCKS }, + { LV, CustomTags.GLASS_BLOCKS }, + { MV, CustomTags.GLASS_BLOCKS }, + { HV, GTBlocks.CASING_TEMPERED_GLASS.asStack() }, + { EV, GTBlocks.CASING_TEMPERED_GLASS.asStack() }, + { IV, GTBlocks.CASING_LAMINATED_GLASS.asStack() }, + { LuV, GTBlocks.CASING_LAMINATED_GLASS.asStack() }, + { ZPM, GTBlocks.FUSION_GLASS.asStack() }, + { UV, GTBlocks.FUSION_GLASS.asStack() } }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - PLATE = new Component(Stream.of(new Object[][]{ + PLATE = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(TagPrefix.plate, GTMaterials.WroughtIron)}, - {1, new UnificationEntry(TagPrefix.plate, GTMaterials.Steel)}, - {2, new UnificationEntry(TagPrefix.plate, GTMaterials.Aluminium)}, - {3, new UnificationEntry(TagPrefix.plate, GTMaterials.StainlessSteel)}, - {4, new UnificationEntry(TagPrefix.plate, GTMaterials.Titanium)}, - {5, new UnificationEntry(TagPrefix.plate, GTMaterials.TungstenSteel)}, - {6, new UnificationEntry(TagPrefix.plate, GTMaterials.RhodiumPlatedPalladium)}, - {7, new UnificationEntry(TagPrefix.plate, GTMaterials.NaquadahAlloy)}, - {8, new UnificationEntry(TagPrefix.plate, GTMaterials.Darmstadtium)}, - {9, new UnificationEntry(TagPrefix.plate, GTMaterials.Neutronium)}, + { 0, new UnificationEntry(TagPrefix.plate, GTMaterials.WroughtIron) }, + { 1, new UnificationEntry(TagPrefix.plate, GTMaterials.Steel) }, + { 2, new UnificationEntry(TagPrefix.plate, GTMaterials.Aluminium) }, + { 3, new UnificationEntry(TagPrefix.plate, GTMaterials.StainlessSteel) }, + { 4, new UnificationEntry(TagPrefix.plate, GTMaterials.Titanium) }, + { 5, new UnificationEntry(TagPrefix.plate, GTMaterials.TungstenSteel) }, + { 6, new UnificationEntry(TagPrefix.plate, GTMaterials.RhodiumPlatedPalladium) }, + { 7, new UnificationEntry(TagPrefix.plate, GTMaterials.NaquadahAlloy) }, + { 8, new UnificationEntry(TagPrefix.plate, GTMaterials.Darmstadtium) }, + { 9, new UnificationEntry(TagPrefix.plate, GTMaterials.Neutronium) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - HULL_PLATE = new Component(Stream.of(new Object[][]{ + HULL_PLATE = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(TagPrefix.plate, GTMaterials.Wood)}, - {1, new UnificationEntry(TagPrefix.plate, GTMaterials.WroughtIron)}, - {2, new UnificationEntry(TagPrefix.plate, GTMaterials.WroughtIron)}, - {3, new UnificationEntry(TagPrefix.plate, GTMaterials.Polyethylene)}, - {4, new UnificationEntry(TagPrefix.plate, GTMaterials.Polyethylene)}, - {5, new UnificationEntry(TagPrefix.plate, GTMaterials.Polytetrafluoroethylene)}, - {6, new UnificationEntry(TagPrefix.plate, GTMaterials.Polytetrafluoroethylene)}, - {7, new UnificationEntry(TagPrefix.plate, GTMaterials.Polybenzimidazole)}, - {8, new UnificationEntry(TagPrefix.plate, GTMaterials.Polybenzimidazole)}, - {GTValues.FALLBACK, new UnificationEntry(TagPrefix.plate, GTMaterials.Polybenzimidazole)}, + { 0, new UnificationEntry(TagPrefix.plate, GTMaterials.Wood) }, + { 1, new UnificationEntry(TagPrefix.plate, GTMaterials.WroughtIron) }, + { 2, new UnificationEntry(TagPrefix.plate, GTMaterials.WroughtIron) }, + { 3, new UnificationEntry(TagPrefix.plate, GTMaterials.Polyethylene) }, + { 4, new UnificationEntry(TagPrefix.plate, GTMaterials.Polyethylene) }, + { 5, new UnificationEntry(TagPrefix.plate, GTMaterials.Polytetrafluoroethylene) }, + { 6, new UnificationEntry(TagPrefix.plate, GTMaterials.Polytetrafluoroethylene) }, + { 7, new UnificationEntry(TagPrefix.plate, GTMaterials.Polybenzimidazole) }, + { 8, new UnificationEntry(TagPrefix.plate, GTMaterials.Polybenzimidazole) }, + { GTValues.FALLBACK, new UnificationEntry(TagPrefix.plate, GTMaterials.Polybenzimidazole) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - MOTOR = new Component(Stream.of(new Object[][]{ + MOTOR = new Component(Stream.of(new Object[][] { - {1, GTItems.ELECTRIC_MOTOR_LV.asStack()}, - {2, GTItems.ELECTRIC_MOTOR_MV.asStack()}, - {3, GTItems.ELECTRIC_MOTOR_HV.asStack()}, - {4, GTItems.ELECTRIC_MOTOR_EV.asStack()}, - {5, GTItems.ELECTRIC_MOTOR_IV.asStack()}, - {6, GTItems.ELECTRIC_MOTOR_LuV.asStack()}, - {7, GTItems.ELECTRIC_MOTOR_ZPM.asStack()}, - {8, GTItems.ELECTRIC_MOTOR_UV.asStack()}, + { 1, GTItems.ELECTRIC_MOTOR_LV.asStack() }, + { 2, GTItems.ELECTRIC_MOTOR_MV.asStack() }, + { 3, GTItems.ELECTRIC_MOTOR_HV.asStack() }, + { 4, GTItems.ELECTRIC_MOTOR_EV.asStack() }, + { 5, GTItems.ELECTRIC_MOTOR_IV.asStack() }, + { 6, GTItems.ELECTRIC_MOTOR_LuV.asStack() }, + { 7, GTItems.ELECTRIC_MOTOR_ZPM.asStack() }, + { 8, GTItems.ELECTRIC_MOTOR_UV.asStack() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); if (GTCEuAPI.isHighTier()) { - MOTOR.appendIngredients(Stream.of(new Object[][]{ - { 9, GTItems.ELECTRIC_MOTOR_UHV.asStack()}, - {10, GTItems.ELECTRIC_MOTOR_UEV.asStack()}, - {11, GTItems.ELECTRIC_MOTOR_UIV.asStack()}, - {12, GTItems.ELECTRIC_MOTOR_UXV.asStack()}, - {13, GTItems.ELECTRIC_MOTOR_OpV.asStack()}, + MOTOR.appendIngredients(Stream.of(new Object[][] { + { 9, GTItems.ELECTRIC_MOTOR_UHV.asStack() }, + { 10, GTItems.ELECTRIC_MOTOR_UEV.asStack() }, + { 11, GTItems.ELECTRIC_MOTOR_UIV.asStack() }, + { 12, GTItems.ELECTRIC_MOTOR_UXV.asStack() }, + { 13, GTItems.ELECTRIC_MOTOR_OpV.asStack() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); } - ROTOR = new Component(Stream.of(new Object[][]{ + ROTOR = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(TagPrefix.rotor, GTMaterials.Tin)}, - {1, new UnificationEntry(TagPrefix.rotor, GTMaterials.Tin)}, - {2, new UnificationEntry(TagPrefix.rotor, GTMaterials.Bronze)}, - {3, new UnificationEntry(TagPrefix.rotor, GTMaterials.Steel)}, - {4, new UnificationEntry(TagPrefix.rotor, GTMaterials.StainlessSteel)}, - {5, new UnificationEntry(TagPrefix.rotor, GTMaterials.TungstenSteel)}, - {6, new UnificationEntry(TagPrefix.rotor, GTMaterials.RhodiumPlatedPalladium)}, - {7, new UnificationEntry(TagPrefix.rotor, GTMaterials.NaquadahAlloy)}, - {8, new UnificationEntry(TagPrefix.rotor, GTMaterials.Darmstadtium)}, + { 0, new UnificationEntry(TagPrefix.rotor, GTMaterials.Tin) }, + { 1, new UnificationEntry(TagPrefix.rotor, GTMaterials.Tin) }, + { 2, new UnificationEntry(TagPrefix.rotor, GTMaterials.Bronze) }, + { 3, new UnificationEntry(TagPrefix.rotor, GTMaterials.Steel) }, + { 4, new UnificationEntry(TagPrefix.rotor, GTMaterials.StainlessSteel) }, + { 5, new UnificationEntry(TagPrefix.rotor, GTMaterials.TungstenSteel) }, + { 6, new UnificationEntry(TagPrefix.rotor, GTMaterials.RhodiumPlatedPalladium) }, + { 7, new UnificationEntry(TagPrefix.rotor, GTMaterials.NaquadahAlloy) }, + { 8, new UnificationEntry(TagPrefix.rotor, GTMaterials.Darmstadtium) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - SENSOR = new Component(Stream.of(new Object[][]{ + SENSOR = new Component(Stream.of(new Object[][] { - {1, GTItems.SENSOR_LV.asStack()}, - {2, GTItems.SENSOR_MV.asStack()}, - {3, GTItems.SENSOR_HV.asStack()}, - {4, GTItems.SENSOR_EV.asStack()}, - {5, GTItems.SENSOR_IV.asStack()}, - {6, GTItems.SENSOR_LuV.asStack()}, - {7, GTItems.SENSOR_ZPM.asStack()}, - {8, GTItems.SENSOR_UV.asStack()}, + { 1, GTItems.SENSOR_LV.asStack() }, + { 2, GTItems.SENSOR_MV.asStack() }, + { 3, GTItems.SENSOR_HV.asStack() }, + { 4, GTItems.SENSOR_EV.asStack() }, + { 5, GTItems.SENSOR_IV.asStack() }, + { 6, GTItems.SENSOR_LuV.asStack() }, + { 7, GTItems.SENSOR_ZPM.asStack() }, + { 8, GTItems.SENSOR_UV.asStack() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); if (GTCEuAPI.isHighTier()) { - SENSOR.appendIngredients(Stream.of(new Object[][]{ - { 9, GTItems.SENSOR_UHV.asStack()}, - {10, GTItems.SENSOR_UEV.asStack()}, - {11, GTItems.SENSOR_UIV.asStack()}, - {12, GTItems.SENSOR_UXV.asStack()}, - {13, GTItems.SENSOR_OpV.asStack()}, + SENSOR.appendIngredients(Stream.of(new Object[][] { + { 9, GTItems.SENSOR_UHV.asStack() }, + { 10, GTItems.SENSOR_UEV.asStack() }, + { 11, GTItems.SENSOR_UIV.asStack() }, + { 12, GTItems.SENSOR_UXV.asStack() }, + { 13, GTItems.SENSOR_OpV.asStack() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); } - GRINDER = new Component(Stream.of(new Object[][]{ + GRINDER = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(TagPrefix.gem, GTMaterials.Diamond)}, - {1, new UnificationEntry(TagPrefix.gem, GTMaterials.Diamond)}, - {2, new UnificationEntry(TagPrefix.gem, GTMaterials.Diamond)}, - {3, GTItems.COMPONENT_GRINDER_DIAMOND.asStack()}, - {4, GTItems.COMPONENT_GRINDER_DIAMOND.asStack()}, - {5, GTItems.COMPONENT_GRINDER_TUNGSTEN.asStack()}, - {GTValues.FALLBACK, GTItems.COMPONENT_GRINDER_TUNGSTEN.asStack()}, + { 0, new UnificationEntry(TagPrefix.gem, GTMaterials.Diamond) }, + { 1, new UnificationEntry(TagPrefix.gem, GTMaterials.Diamond) }, + { 2, new UnificationEntry(TagPrefix.gem, GTMaterials.Diamond) }, + { 3, GTItems.COMPONENT_GRINDER_DIAMOND.asStack() }, + { 4, GTItems.COMPONENT_GRINDER_DIAMOND.asStack() }, + { 5, GTItems.COMPONENT_GRINDER_TUNGSTEN.asStack() }, + { GTValues.FALLBACK, GTItems.COMPONENT_GRINDER_TUNGSTEN.asStack() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - SAWBLADE = new Component(Stream.of(new Object[][]{ + SAWBLADE = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(TagPrefix.toolHeadBuzzSaw, GTMaterials.Bronze)}, - {1, new UnificationEntry(TagPrefix.toolHeadBuzzSaw, GTMaterials.CobaltBrass)}, - {2, new UnificationEntry(TagPrefix.toolHeadBuzzSaw, GTMaterials.VanadiumSteel)}, - {3, new UnificationEntry(TagPrefix.toolHeadBuzzSaw, GTMaterials.BlueSteel)}, - {4, new UnificationEntry(TagPrefix.toolHeadBuzzSaw, GTMaterials.Ultimet)}, - {5, new UnificationEntry(TagPrefix.toolHeadBuzzSaw, GTMaterials.TungstenCarbide)}, - {6, new UnificationEntry(TagPrefix.toolHeadBuzzSaw, GTMaterials.HSSE)}, - {7, new UnificationEntry(TagPrefix.toolHeadBuzzSaw, GTMaterials.NaquadahAlloy)}, - {8, new UnificationEntry(TagPrefix.toolHeadBuzzSaw, GTMaterials.Duranium)}, - {GTValues.FALLBACK, new UnificationEntry(TagPrefix.toolHeadBuzzSaw, GTMaterials.Duranium)}, + { 0, new UnificationEntry(TagPrefix.toolHeadBuzzSaw, GTMaterials.Bronze) }, + { 1, new UnificationEntry(TagPrefix.toolHeadBuzzSaw, GTMaterials.CobaltBrass) }, + { 2, new UnificationEntry(TagPrefix.toolHeadBuzzSaw, GTMaterials.VanadiumSteel) }, + { 3, new UnificationEntry(TagPrefix.toolHeadBuzzSaw, GTMaterials.BlueSteel) }, + { 4, new UnificationEntry(TagPrefix.toolHeadBuzzSaw, GTMaterials.Ultimet) }, + { 5, new UnificationEntry(TagPrefix.toolHeadBuzzSaw, GTMaterials.TungstenCarbide) }, + { 6, new UnificationEntry(TagPrefix.toolHeadBuzzSaw, GTMaterials.HSSE) }, + { 7, new UnificationEntry(TagPrefix.toolHeadBuzzSaw, GTMaterials.NaquadahAlloy) }, + { 8, new UnificationEntry(TagPrefix.toolHeadBuzzSaw, GTMaterials.Duranium) }, + { GTValues.FALLBACK, new UnificationEntry(TagPrefix.toolHeadBuzzSaw, GTMaterials.Duranium) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - DIAMOND = new Component(Stream.of(new Object[][]{ + DIAMOND = new Component(Stream.of(new Object[][] { - {GTValues.FALLBACK, new UnificationEntry(TagPrefix.gem, GTMaterials.Diamond)}, + { GTValues.FALLBACK, new UnificationEntry(TagPrefix.gem, GTMaterials.Diamond) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - PISTON = new Component(Stream.of(new Object[][]{ + PISTON = new Component(Stream.of(new Object[][] { - {1, GTItems.ELECTRIC_PISTON_LV.asStack()}, - {2, GTItems.ELECTRIC_PISTON_MV.asStack()}, - {3, GTItems.ELECTRIC_PISTON_HV.asStack()}, - {4, GTItems.ELECTRIC_PISTON_EV.asStack()}, - {5, GTItems.ELECTRIC_PISTON_IV.asStack()}, - {6, GTItems.ELECTRIC_PISTON_LUV.asStack()}, - {7, GTItems.ELECTRIC_PISTON_ZPM.asStack()}, - {8, GTItems.ELECTRIC_PISTON_UV.asStack()}, + { 1, GTItems.ELECTRIC_PISTON_LV.asStack() }, + { 2, GTItems.ELECTRIC_PISTON_MV.asStack() }, + { 3, GTItems.ELECTRIC_PISTON_HV.asStack() }, + { 4, GTItems.ELECTRIC_PISTON_EV.asStack() }, + { 5, GTItems.ELECTRIC_PISTON_IV.asStack() }, + { 6, GTItems.ELECTRIC_PISTON_LUV.asStack() }, + { 7, GTItems.ELECTRIC_PISTON_ZPM.asStack() }, + { 8, GTItems.ELECTRIC_PISTON_UV.asStack() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); if (GTCEuAPI.isHighTier()) { - PISTON.appendIngredients(Stream.of(new Object[][]{ - { 9, GTItems.ELECTRIC_PISTON_UHV.asStack()}, - {10, GTItems.ELECTRIC_PISTON_UEV.asStack()}, - {11, GTItems.ELECTRIC_PISTON_UIV.asStack()}, - {12, GTItems.ELECTRIC_PISTON_UXV.asStack()}, - {13, GTItems.ELECTRIC_PISTON_OpV.asStack()}, + PISTON.appendIngredients(Stream.of(new Object[][] { + { 9, GTItems.ELECTRIC_PISTON_UHV.asStack() }, + { 10, GTItems.ELECTRIC_PISTON_UEV.asStack() }, + { 11, GTItems.ELECTRIC_PISTON_UIV.asStack() }, + { 12, GTItems.ELECTRIC_PISTON_UXV.asStack() }, + { 13, GTItems.ELECTRIC_PISTON_OpV.asStack() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); } - EMITTER = new Component(Stream.of(new Object[][]{ + EMITTER = new Component(Stream.of(new Object[][] { - {1, GTItems.EMITTER_LV.asStack()}, - {2, GTItems.EMITTER_MV.asStack()}, - {3, GTItems.EMITTER_HV.asStack()}, - {4, GTItems.EMITTER_EV.asStack()}, - {5, GTItems.EMITTER_IV.asStack()}, - {6, GTItems.EMITTER_LuV.asStack()}, - {7, GTItems.EMITTER_ZPM.asStack()}, - {8, GTItems.EMITTER_UV.asStack()}, + { 1, GTItems.EMITTER_LV.asStack() }, + { 2, GTItems.EMITTER_MV.asStack() }, + { 3, GTItems.EMITTER_HV.asStack() }, + { 4, GTItems.EMITTER_EV.asStack() }, + { 5, GTItems.EMITTER_IV.asStack() }, + { 6, GTItems.EMITTER_LuV.asStack() }, + { 7, GTItems.EMITTER_ZPM.asStack() }, + { 8, GTItems.EMITTER_UV.asStack() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - CONVEYOR = new Component(Stream.of(new Object[][]{ + CONVEYOR = new Component(Stream.of(new Object[][] { - {1, GTItems.CONVEYOR_MODULE_LV.asStack()}, - {2, GTItems.CONVEYOR_MODULE_MV.asStack()}, - {3, GTItems.CONVEYOR_MODULE_HV.asStack()}, - {4, GTItems.CONVEYOR_MODULE_EV.asStack()}, - {5, GTItems.CONVEYOR_MODULE_IV.asStack()}, - {6, GTItems.CONVEYOR_MODULE_LuV.asStack()}, - {7, GTItems.CONVEYOR_MODULE_ZPM.asStack()}, - {8, GTItems.CONVEYOR_MODULE_UV.asStack()}, + { 1, GTItems.CONVEYOR_MODULE_LV.asStack() }, + { 2, GTItems.CONVEYOR_MODULE_MV.asStack() }, + { 3, GTItems.CONVEYOR_MODULE_HV.asStack() }, + { 4, GTItems.CONVEYOR_MODULE_EV.asStack() }, + { 5, GTItems.CONVEYOR_MODULE_IV.asStack() }, + { 6, GTItems.CONVEYOR_MODULE_LuV.asStack() }, + { 7, GTItems.CONVEYOR_MODULE_ZPM.asStack() }, + { 8, GTItems.CONVEYOR_MODULE_UV.asStack() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); if (GTCEuAPI.isHighTier()) { - CONVEYOR.appendIngredients(Stream.of(new Object[][]{ - { 9, GTItems.CONVEYOR_MODULE_UHV.asStack()}, - {10, GTItems.CONVEYOR_MODULE_UEV.asStack()}, - {11, GTItems.CONVEYOR_MODULE_UIV.asStack()}, - {12, GTItems.CONVEYOR_MODULE_UXV.asStack()}, - {13, GTItems.CONVEYOR_MODULE_OpV.asStack()}, + CONVEYOR.appendIngredients(Stream.of(new Object[][] { + { 9, GTItems.CONVEYOR_MODULE_UHV.asStack() }, + { 10, GTItems.CONVEYOR_MODULE_UEV.asStack() }, + { 11, GTItems.CONVEYOR_MODULE_UIV.asStack() }, + { 12, GTItems.CONVEYOR_MODULE_UXV.asStack() }, + { 13, GTItems.CONVEYOR_MODULE_OpV.asStack() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); } - ROBOT_ARM = new Component(Stream.of(new Object[][]{ + ROBOT_ARM = new Component(Stream.of(new Object[][] { - {1, GTItems.ROBOT_ARM_LV.asStack()}, - {2, GTItems.ROBOT_ARM_MV.asStack()}, - {3, GTItems.ROBOT_ARM_HV.asStack()}, - {4, GTItems.ROBOT_ARM_EV.asStack()}, - {5, GTItems.ROBOT_ARM_IV.asStack()}, - {6, GTItems.ROBOT_ARM_LuV.asStack()}, - {7, GTItems.ROBOT_ARM_ZPM.asStack()}, - {8, GTItems.ROBOT_ARM_UV.asStack()}, + { 1, GTItems.ROBOT_ARM_LV.asStack() }, + { 2, GTItems.ROBOT_ARM_MV.asStack() }, + { 3, GTItems.ROBOT_ARM_HV.asStack() }, + { 4, GTItems.ROBOT_ARM_EV.asStack() }, + { 5, GTItems.ROBOT_ARM_IV.asStack() }, + { 6, GTItems.ROBOT_ARM_LuV.asStack() }, + { 7, GTItems.ROBOT_ARM_ZPM.asStack() }, + { 8, GTItems.ROBOT_ARM_UV.asStack() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); if (GTCEuAPI.isHighTier()) { - ROBOT_ARM.appendIngredients(Stream.of(new Object[][]{ - { 9, GTItems.ROBOT_ARM_UHV.asStack()}, - {10, GTItems.ROBOT_ARM_UEV.asStack()}, - {11, GTItems.ROBOT_ARM_UIV.asStack()}, - {12, GTItems.ROBOT_ARM_UXV.asStack()}, - {13, GTItems.ROBOT_ARM_OpV.asStack()}, + ROBOT_ARM.appendIngredients(Stream.of(new Object[][] { + { 9, GTItems.ROBOT_ARM_UHV.asStack() }, + { 10, GTItems.ROBOT_ARM_UEV.asStack() }, + { 11, GTItems.ROBOT_ARM_UIV.asStack() }, + { 12, GTItems.ROBOT_ARM_UXV.asStack() }, + { 13, GTItems.ROBOT_ARM_OpV.asStack() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); } - COIL_HEATING = new Component(Stream.of(new Object[][]{ + COIL_HEATING = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(TagPrefix.wireGtDouble, GTMaterials.Copper)}, - {1, new UnificationEntry(TagPrefix.wireGtDouble, GTMaterials.Copper)}, - {2, new UnificationEntry(TagPrefix.wireGtDouble, GTMaterials.Cupronickel)}, - {3, new UnificationEntry(TagPrefix.wireGtDouble, GTMaterials.Kanthal)}, - {4, new UnificationEntry(TagPrefix.wireGtDouble, GTMaterials.Nichrome)}, - {5, new UnificationEntry(TagPrefix.wireGtDouble, GTMaterials.TungstenSteel)}, - {6, new UnificationEntry(TagPrefix.wireGtDouble, GTMaterials.HSSG)}, - {7, new UnificationEntry(TagPrefix.wireGtDouble, GTMaterials.Naquadah)}, - {8, new UnificationEntry(TagPrefix.wireGtDouble, GTMaterials.NaquadahAlloy)}, + { 0, new UnificationEntry(TagPrefix.wireGtDouble, GTMaterials.Copper) }, + { 1, new UnificationEntry(TagPrefix.wireGtDouble, GTMaterials.Copper) }, + { 2, new UnificationEntry(TagPrefix.wireGtDouble, GTMaterials.Cupronickel) }, + { 3, new UnificationEntry(TagPrefix.wireGtDouble, GTMaterials.Kanthal) }, + { 4, new UnificationEntry(TagPrefix.wireGtDouble, GTMaterials.Nichrome) }, + { 5, new UnificationEntry(TagPrefix.wireGtDouble, GTMaterials.TungstenSteel) }, + { 6, new UnificationEntry(TagPrefix.wireGtDouble, GTMaterials.HSSG) }, + { 7, new UnificationEntry(TagPrefix.wireGtDouble, GTMaterials.Naquadah) }, + { 8, new UnificationEntry(TagPrefix.wireGtDouble, GTMaterials.NaquadahAlloy) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - COIL_HEATING_DOUBLE = new Component(Stream.of(new Object[][]{ + COIL_HEATING_DOUBLE = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(TagPrefix.wireGtQuadruple, GTMaterials.Copper)}, - {1, new UnificationEntry(TagPrefix.wireGtQuadruple, GTMaterials.Copper)}, - {2, new UnificationEntry(TagPrefix.wireGtQuadruple, GTMaterials.Cupronickel)}, - {3, new UnificationEntry(TagPrefix.wireGtQuadruple, GTMaterials.Kanthal)}, - {4, new UnificationEntry(TagPrefix.wireGtQuadruple, GTMaterials.Nichrome)}, - {5, new UnificationEntry(TagPrefix.wireGtQuadruple, GTMaterials.TungstenSteel)}, - {6, new UnificationEntry(TagPrefix.wireGtQuadruple, GTMaterials.HSSG)}, - {7, new UnificationEntry(TagPrefix.wireGtQuadruple, GTMaterials.Naquadah)}, - {8, new UnificationEntry(TagPrefix.wireGtQuadruple, GTMaterials.NaquadahAlloy)}, + { 0, new UnificationEntry(TagPrefix.wireGtQuadruple, GTMaterials.Copper) }, + { 1, new UnificationEntry(TagPrefix.wireGtQuadruple, GTMaterials.Copper) }, + { 2, new UnificationEntry(TagPrefix.wireGtQuadruple, GTMaterials.Cupronickel) }, + { 3, new UnificationEntry(TagPrefix.wireGtQuadruple, GTMaterials.Kanthal) }, + { 4, new UnificationEntry(TagPrefix.wireGtQuadruple, GTMaterials.Nichrome) }, + { 5, new UnificationEntry(TagPrefix.wireGtQuadruple, GTMaterials.TungstenSteel) }, + { 6, new UnificationEntry(TagPrefix.wireGtQuadruple, GTMaterials.HSSG) }, + { 7, new UnificationEntry(TagPrefix.wireGtQuadruple, GTMaterials.Naquadah) }, + { 8, new UnificationEntry(TagPrefix.wireGtQuadruple, GTMaterials.NaquadahAlloy) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); + COIL_ELECTRIC = new Component(Stream.of(new Object[][] { - COIL_ELECTRIC = new Component(Stream.of(new Object[][]{ - - {0, new UnificationEntry(TagPrefix.wireGtSingle, GTMaterials.Tin)}, - {1, new UnificationEntry(TagPrefix.wireGtDouble, GTMaterials.Tin)}, - {2, new UnificationEntry(TagPrefix.wireGtDouble, GTMaterials.Copper)}, - {3, new UnificationEntry(TagPrefix.wireGtDouble, GTMaterials.Silver)}, - {4, new UnificationEntry(TagPrefix.wireGtQuadruple, GTMaterials.Steel)}, - {5, new UnificationEntry(TagPrefix.wireGtQuadruple, GTMaterials.Graphene)}, - {6, new UnificationEntry(TagPrefix.wireGtQuadruple, GTMaterials.NiobiumNitride)}, - {7, new UnificationEntry(TagPrefix.wireGtOctal, GTMaterials.VanadiumGallium)}, - {8, new UnificationEntry(TagPrefix.wireGtOctal, GTMaterials.YttriumBariumCuprate)}, + { 0, new UnificationEntry(TagPrefix.wireGtSingle, GTMaterials.Tin) }, + { 1, new UnificationEntry(TagPrefix.wireGtDouble, GTMaterials.Tin) }, + { 2, new UnificationEntry(TagPrefix.wireGtDouble, GTMaterials.Copper) }, + { 3, new UnificationEntry(TagPrefix.wireGtDouble, GTMaterials.Silver) }, + { 4, new UnificationEntry(TagPrefix.wireGtQuadruple, GTMaterials.Steel) }, + { 5, new UnificationEntry(TagPrefix.wireGtQuadruple, GTMaterials.Graphene) }, + { 6, new UnificationEntry(TagPrefix.wireGtQuadruple, GTMaterials.NiobiumNitride) }, + { 7, new UnificationEntry(TagPrefix.wireGtOctal, GTMaterials.VanadiumGallium) }, + { 8, new UnificationEntry(TagPrefix.wireGtOctal, GTMaterials.YttriumBariumCuprate) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - STICK_MAGNETIC = new Component(Stream.of(new Object[][]{ + STICK_MAGNETIC = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(TagPrefix.rod, GTMaterials.IronMagnetic)}, - {1, new UnificationEntry(TagPrefix.rod, GTMaterials.IronMagnetic)}, - {2, new UnificationEntry(TagPrefix.rod, GTMaterials.SteelMagnetic)}, - {3, new UnificationEntry(TagPrefix.rod, GTMaterials.SteelMagnetic)}, - {4, new UnificationEntry(TagPrefix.rod, GTMaterials.NeodymiumMagnetic)}, - {5, new UnificationEntry(TagPrefix.rod, GTMaterials.NeodymiumMagnetic)}, - {6, new UnificationEntry(TagPrefix.rodLong, GTMaterials.NeodymiumMagnetic)}, - {7, new UnificationEntry(TagPrefix.rodLong, GTMaterials.NeodymiumMagnetic)}, - {8, new UnificationEntry(TagPrefix.block, GTMaterials.NeodymiumMagnetic)}, + { 0, new UnificationEntry(TagPrefix.rod, GTMaterials.IronMagnetic) }, + { 1, new UnificationEntry(TagPrefix.rod, GTMaterials.IronMagnetic) }, + { 2, new UnificationEntry(TagPrefix.rod, GTMaterials.SteelMagnetic) }, + { 3, new UnificationEntry(TagPrefix.rod, GTMaterials.SteelMagnetic) }, + { 4, new UnificationEntry(TagPrefix.rod, GTMaterials.NeodymiumMagnetic) }, + { 5, new UnificationEntry(TagPrefix.rod, GTMaterials.NeodymiumMagnetic) }, + { 6, new UnificationEntry(TagPrefix.rodLong, GTMaterials.NeodymiumMagnetic) }, + { 7, new UnificationEntry(TagPrefix.rodLong, GTMaterials.NeodymiumMagnetic) }, + { 8, new UnificationEntry(TagPrefix.block, GTMaterials.NeodymiumMagnetic) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - STICK_DISTILLATION = new Component(Stream.of(new Object[][]{ + STICK_DISTILLATION = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(TagPrefix.rod, GTMaterials.Blaze)}, - {1, new UnificationEntry(TagPrefix.spring, GTMaterials.Copper)}, - {2, new UnificationEntry(TagPrefix.spring, GTMaterials.Cupronickel)}, - {3, new UnificationEntry(TagPrefix.spring, GTMaterials.Kanthal)}, - {4, new UnificationEntry(TagPrefix.spring, GTMaterials.Nichrome)}, - {5, new UnificationEntry(TagPrefix.spring, GTMaterials.TungstenSteel)}, - {6, new UnificationEntry(TagPrefix.spring, GTMaterials.HSSG)}, - {7, new UnificationEntry(TagPrefix.spring, GTMaterials.Naquadah)}, - {8, new UnificationEntry(TagPrefix.spring, GTMaterials.NaquadahAlloy)}, - {GTValues.FALLBACK, new UnificationEntry(TagPrefix.rod, GTMaterials.Blaze)}, + { 0, new UnificationEntry(TagPrefix.rod, GTMaterials.Blaze) }, + { 1, new UnificationEntry(TagPrefix.spring, GTMaterials.Copper) }, + { 2, new UnificationEntry(TagPrefix.spring, GTMaterials.Cupronickel) }, + { 3, new UnificationEntry(TagPrefix.spring, GTMaterials.Kanthal) }, + { 4, new UnificationEntry(TagPrefix.spring, GTMaterials.Nichrome) }, + { 5, new UnificationEntry(TagPrefix.spring, GTMaterials.TungstenSteel) }, + { 6, new UnificationEntry(TagPrefix.spring, GTMaterials.HSSG) }, + { 7, new UnificationEntry(TagPrefix.spring, GTMaterials.Naquadah) }, + { 8, new UnificationEntry(TagPrefix.spring, GTMaterials.NaquadahAlloy) }, + { GTValues.FALLBACK, new UnificationEntry(TagPrefix.rod, GTMaterials.Blaze) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - FIELD_GENERATOR = new Component(Stream.of(new Object[][]{ + FIELD_GENERATOR = new Component(Stream.of(new Object[][] { - {1, GTItems.FIELD_GENERATOR_LV.asStack()}, - {2, GTItems.FIELD_GENERATOR_MV.asStack()}, - {3, GTItems.FIELD_GENERATOR_HV.asStack()}, - {4, GTItems.FIELD_GENERATOR_EV.asStack()}, - {5, GTItems.FIELD_GENERATOR_IV.asStack()}, - {6, GTItems.FIELD_GENERATOR_LuV.asStack()}, - {7, GTItems.FIELD_GENERATOR_ZPM.asStack()}, - {8, GTItems.FIELD_GENERATOR_UV.asStack()}, + { 1, GTItems.FIELD_GENERATOR_LV.asStack() }, + { 2, GTItems.FIELD_GENERATOR_MV.asStack() }, + { 3, GTItems.FIELD_GENERATOR_HV.asStack() }, + { 4, GTItems.FIELD_GENERATOR_EV.asStack() }, + { 5, GTItems.FIELD_GENERATOR_IV.asStack() }, + { 6, GTItems.FIELD_GENERATOR_LuV.asStack() }, + { 7, GTItems.FIELD_GENERATOR_ZPM.asStack() }, + { 8, GTItems.FIELD_GENERATOR_UV.asStack() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); if (GTCEuAPI.isHighTier()) { - FIELD_GENERATOR.appendIngredients(Stream.of(new Object[][]{ - { 9, GTItems.FIELD_GENERATOR_UHV.asStack()}, - {10, GTItems.FIELD_GENERATOR_UEV.asStack()}, - {11, GTItems.FIELD_GENERATOR_UIV.asStack()}, - {12, GTItems.FIELD_GENERATOR_UXV.asStack()}, - {13, GTItems.FIELD_GENERATOR_OpV.asStack()}, + FIELD_GENERATOR.appendIngredients(Stream.of(new Object[][] { + { 9, GTItems.FIELD_GENERATOR_UHV.asStack() }, + { 10, GTItems.FIELD_GENERATOR_UEV.asStack() }, + { 11, GTItems.FIELD_GENERATOR_UIV.asStack() }, + { 12, GTItems.FIELD_GENERATOR_UXV.asStack() }, + { 13, GTItems.FIELD_GENERATOR_OpV.asStack() }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); } - STICK_ELECTROMAGNETIC = new Component(Stream.of(new Object[][]{ + STICK_ELECTROMAGNETIC = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(TagPrefix.rod, GTMaterials.Iron)}, - {1, new UnificationEntry(TagPrefix.rod, GTMaterials.Iron)}, - {2, new UnificationEntry(TagPrefix.rod, GTMaterials.Steel)}, - {3, new UnificationEntry(TagPrefix.rod, GTMaterials.Steel)}, - {4, new UnificationEntry(TagPrefix.rod, GTMaterials.Neodymium)}, - {GTValues.FALLBACK, new UnificationEntry(TagPrefix.rod, GTMaterials.VanadiumGallium)}, + { 0, new UnificationEntry(TagPrefix.rod, GTMaterials.Iron) }, + { 1, new UnificationEntry(TagPrefix.rod, GTMaterials.Iron) }, + { 2, new UnificationEntry(TagPrefix.rod, GTMaterials.Steel) }, + { 3, new UnificationEntry(TagPrefix.rod, GTMaterials.Steel) }, + { 4, new UnificationEntry(TagPrefix.rod, GTMaterials.Neodymium) }, + { GTValues.FALLBACK, new UnificationEntry(TagPrefix.rod, GTMaterials.VanadiumGallium) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - STICK_RADIOACTIVE = new Component(Stream.of(new Object[][]{ + STICK_RADIOACTIVE = new Component(Stream.of(new Object[][] { - {4, new UnificationEntry(TagPrefix.rod, GTMaterials.Uranium235)}, - {5, new UnificationEntry(TagPrefix.rod, GTMaterials.Plutonium241)}, - {6, new UnificationEntry(TagPrefix.rod, GTMaterials.NaquadahEnriched)}, - {7, new UnificationEntry(TagPrefix.rod, GTMaterials.Americium)}, - {GTValues.FALLBACK, new UnificationEntry(TagPrefix.rod, GTMaterials.Tritanium)}, + { 4, new UnificationEntry(TagPrefix.rod, GTMaterials.Uranium235) }, + { 5, new UnificationEntry(TagPrefix.rod, GTMaterials.Plutonium241) }, + { 6, new UnificationEntry(TagPrefix.rod, GTMaterials.NaquadahEnriched) }, + { 7, new UnificationEntry(TagPrefix.rod, GTMaterials.Americium) }, + { GTValues.FALLBACK, new UnificationEntry(TagPrefix.rod, GTMaterials.Tritanium) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - PIPE_REACTOR = new Component(Stream.of(new Object[][]{ + PIPE_REACTOR = new Component(Stream.of(new Object[][] { - {0, new ItemStack(Blocks.GLASS, 1)}, - {1, new ItemStack(Blocks.GLASS, 1)}, - {2, new ItemStack(Blocks.GLASS, 1)}, - {3, new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.Polyethylene)}, - {4, new UnificationEntry(TagPrefix.pipeLargeFluid, GTMaterials.Polyethylene)}, - {5, new UnificationEntry(TagPrefix.pipeHugeFluid, GTMaterials.Polyethylene)}, - {6, new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.Polytetrafluoroethylene)}, - {7, new UnificationEntry(TagPrefix.pipeLargeFluid, GTMaterials.Polytetrafluoroethylene)}, - {8, new UnificationEntry(TagPrefix.pipeHugeFluid, GTMaterials.Polytetrafluoroethylene)}, - {GTValues.FALLBACK, new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.Polyethylene)}, + { 0, new ItemStack(Blocks.GLASS, 1) }, + { 1, new ItemStack(Blocks.GLASS, 1) }, + { 2, new ItemStack(Blocks.GLASS, 1) }, + { 3, new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.Polyethylene) }, + { 4, new UnificationEntry(TagPrefix.pipeLargeFluid, GTMaterials.Polyethylene) }, + { 5, new UnificationEntry(TagPrefix.pipeHugeFluid, GTMaterials.Polyethylene) }, + { 6, new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.Polytetrafluoroethylene) }, + { 7, new UnificationEntry(TagPrefix.pipeLargeFluid, GTMaterials.Polytetrafluoroethylene) }, + { 8, new UnificationEntry(TagPrefix.pipeHugeFluid, GTMaterials.Polytetrafluoroethylene) }, + { GTValues.FALLBACK, new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.Polyethylene) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - POWER_COMPONENT = new Component(Stream.of(new Object[][]{ + POWER_COMPONENT = new Component(Stream.of(new Object[][] { - {2, GTItems.ULTRA_LOW_POWER_INTEGRATED_CIRCUIT.asStack()}, - {3, GTItems.LOW_POWER_INTEGRATED_CIRCUIT.asStack()}, - {4, GTItems.POWER_INTEGRATED_CIRCUIT.asStack()}, - {5, GTItems.HIGH_POWER_INTEGRATED_CIRCUIT.asStack()}, - {6, GTItems.HIGH_POWER_INTEGRATED_CIRCUIT.asStack()}, - {7, GTItems.ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT.asStack()}, - {8, GTItems.ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT.asStack()}, - {9, GTItems.ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT.asStack()}, - {GTValues.FALLBACK, GTItems.ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT}, + { 2, GTItems.ULTRA_LOW_POWER_INTEGRATED_CIRCUIT.asStack() }, + { 3, GTItems.LOW_POWER_INTEGRATED_CIRCUIT.asStack() }, + { 4, GTItems.POWER_INTEGRATED_CIRCUIT.asStack() }, + { 5, GTItems.HIGH_POWER_INTEGRATED_CIRCUIT.asStack() }, + { 6, GTItems.HIGH_POWER_INTEGRATED_CIRCUIT.asStack() }, + { 7, GTItems.ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT.asStack() }, + { 8, GTItems.ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT.asStack() }, + { 9, GTItems.ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT.asStack() }, + { GTValues.FALLBACK, GTItems.ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - VOLTAGE_COIL = new Component(Stream.of(new Object[][]{ + VOLTAGE_COIL = new Component(Stream.of(new Object[][] { - {0, GTItems.VOLTAGE_COIL_ULV.asStack()}, - {1, GTItems.VOLTAGE_COIL_LV.asStack()}, - {2, GTItems.VOLTAGE_COIL_MV.asStack()}, - {3, GTItems.VOLTAGE_COIL_HV.asStack()}, - {4, GTItems.VOLTAGE_COIL_EV.asStack()}, - {5, GTItems.VOLTAGE_COIL_IV.asStack()}, - {6, GTItems.VOLTAGE_COIL_LuV.asStack()}, - {7, GTItems.VOLTAGE_COIL_ZPM.asStack()}, - {8, GTItems.VOLTAGE_COIL_UV.asStack()}, - {GTValues.FALLBACK, GTItems.VOLTAGE_COIL_UV}, + { 0, GTItems.VOLTAGE_COIL_ULV.asStack() }, + { 1, GTItems.VOLTAGE_COIL_LV.asStack() }, + { 2, GTItems.VOLTAGE_COIL_MV.asStack() }, + { 3, GTItems.VOLTAGE_COIL_HV.asStack() }, + { 4, GTItems.VOLTAGE_COIL_EV.asStack() }, + { 5, GTItems.VOLTAGE_COIL_IV.asStack() }, + { 6, GTItems.VOLTAGE_COIL_LuV.asStack() }, + { 7, GTItems.VOLTAGE_COIL_ZPM.asStack() }, + { 8, GTItems.VOLTAGE_COIL_UV.asStack() }, + { GTValues.FALLBACK, GTItems.VOLTAGE_COIL_UV }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); - SPRING = new Component(Stream.of(new Object[][]{ + SPRING = new Component(Stream.of(new Object[][] { - {0, new UnificationEntry(TagPrefix.spring, GTMaterials.Lead)}, - {1, new UnificationEntry(TagPrefix.spring, GTMaterials.Tin)}, - {2, new UnificationEntry(TagPrefix.spring, GTMaterials.Copper)}, - {3, new UnificationEntry(TagPrefix.spring, GTMaterials.Gold)}, - {4, new UnificationEntry(TagPrefix.spring, GTMaterials.Aluminium)}, - {5, new UnificationEntry(TagPrefix.spring, GTMaterials.Tungsten)}, - {6, new UnificationEntry(TagPrefix.spring, GTMaterials.NiobiumTitanium)}, - {7, new UnificationEntry(TagPrefix.spring, GTMaterials.VanadiumGallium)}, - {8, new UnificationEntry(TagPrefix.spring, GTMaterials.YttriumBariumCuprate)}, - {9, new UnificationEntry(TagPrefix.spring, GTMaterials.Europium)}, + { 0, new UnificationEntry(TagPrefix.spring, GTMaterials.Lead) }, + { 1, new UnificationEntry(TagPrefix.spring, GTMaterials.Tin) }, + { 2, new UnificationEntry(TagPrefix.spring, GTMaterials.Copper) }, + { 3, new UnificationEntry(TagPrefix.spring, GTMaterials.Gold) }, + { 4, new UnificationEntry(TagPrefix.spring, GTMaterials.Aluminium) }, + { 5, new UnificationEntry(TagPrefix.spring, GTMaterials.Tungsten) }, + { 6, new UnificationEntry(TagPrefix.spring, GTMaterials.NiobiumTitanium) }, + { 7, new UnificationEntry(TagPrefix.spring, GTMaterials.VanadiumGallium) }, + { 8, new UnificationEntry(TagPrefix.spring, GTMaterials.YttriumBariumCuprate) }, + { 9, new UnificationEntry(TagPrefix.spring, GTMaterials.Europium) }, }).collect(Collectors.toMap(data -> (Integer) data[0], data -> data[1]))); } - public static class Component { private final Map ingredients; @@ -846,10 +844,7 @@ public Object getIngredient(int tier) { @SuppressWarnings("unused") public void appendIngredients(Map newIngredients) { ingredients.remove(GTValues.FALLBACK); - newIngredients.forEach((key, value) -> - ingredients.merge(key, value, (v1, v2) -> v2) - ); + newIngredients.forEach((key, value) -> ingredients.merge(key, value, (v1, v2) -> v2)); } } } - diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/CustomTags.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/CustomTags.java index 38efc1bcca..08e9d79cca 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/CustomTags.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/CustomTags.java @@ -2,6 +2,7 @@ import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.data.tag.TagUtil; + import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.BlockTags; @@ -81,7 +82,8 @@ public class CustomTags { public static final TagKey CONCRETE_POWDER_BLOCK = TagUtil.createBlockTag("concrete_powder"); public static final TagKey GLASS_BLOCKS_BLOCK = TagUtil.createBlockTag("glass"); public static final TagKey GLASS_PANES_BLOCK = TagUtil.createBlockTag("glass_panes"); - public static final TagKey CREATE_SEATS = TagUtil.optionalTag(Registries.BLOCK, new ResourceLocation(GTValues.MODID_CREATE, "seats")); + public static final TagKey CREATE_SEATS = TagUtil.optionalTag(Registries.BLOCK, + new ResourceLocation(GTValues.MODID_CREATE, "seats")); public static final TagKey ORE_BLOCKS = TagUtil.createBlockTag("ores"); public static final TagKey RUBBER_LOGS_BLOCK = TagUtil.createModBlockTag("logs/rubber"); @@ -91,7 +93,7 @@ public class CustomTags { public static final TagKey IS_SANDY = TagUtil.createModTag(Registries.BIOME, "is_sandy"); public static final TagKey HAS_RUBBER_TREE = TagUtil.createModTag(Registries.BIOME, "has_rubber_tree"); - public static final TagKey> HEAT_IMMUNE = TagUtil.createModTag(Registries.ENTITY_TYPE, "heat_immune"); - public static final TagKey> CHEMICAL_IMMUNE = TagUtil.createModTag(Registries.ENTITY_TYPE, "chemical_immune"); + public static final TagKey> CHEMICAL_IMMUNE = TagUtil.createModTag(Registries.ENTITY_TYPE, + "chemical_immune"); } diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/MaterialInfoLoader.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/MaterialInfoLoader.java index ebccd6161b..c6061f7995 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/MaterialInfoLoader.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/MaterialInfoLoader.java @@ -7,7 +7,7 @@ import com.gregtechceu.gtceu.common.data.GTMachines; import com.gregtechceu.gtceu.common.data.GTMaterials; import com.gregtechceu.gtceu.config.ConfigHolder; -import net.minecraft.world.item.ItemStack; + import net.minecraft.world.item.Items; import net.minecraft.world.level.block.Blocks; @@ -107,7 +107,6 @@ public static void init() { new MaterialStack(GTMaterials.Europium, M), // single cable new MaterialStack(GTMaterials.Rubber, M * 2))); // plate - ChemicalHelper.registerMaterialInfo(GTMachines.ENERGY_INPUT_HATCH[3].getItem(), new ItemMaterialInfo( new MaterialStack(GTMaterials.StainlessSteel, M * 8), // plate new MaterialStack(GTMaterials.Gold, M * 2), // single cable @@ -168,251 +167,447 @@ public static void init() { new MaterialStack(GTMaterials.Glass, M / 2) // 1 block / 2 )); - ChemicalHelper.registerMaterialInfo(Blocks.TERRACOTTA, new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); - ChemicalHelper.registerMaterialInfo(Blocks.WHITE_TERRACOTTA, new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); - ChemicalHelper.registerMaterialInfo(Blocks.ORANGE_TERRACOTTA, new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); - ChemicalHelper.registerMaterialInfo(Blocks.MAGENTA_TERRACOTTA, new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); - ChemicalHelper.registerMaterialInfo(Blocks.LIGHT_BLUE_TERRACOTTA, new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); - ChemicalHelper.registerMaterialInfo(Blocks.YELLOW_TERRACOTTA, new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); - ChemicalHelper.registerMaterialInfo(Blocks.LIME_TERRACOTTA, new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); - ChemicalHelper.registerMaterialInfo(Blocks.PINK_TERRACOTTA, new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); - ChemicalHelper.registerMaterialInfo(Blocks.GRAY_TERRACOTTA, new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); - ChemicalHelper.registerMaterialInfo(Blocks.LIGHT_GRAY_TERRACOTTA, new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); - ChemicalHelper.registerMaterialInfo(Blocks.CYAN_TERRACOTTA, new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); - ChemicalHelper.registerMaterialInfo(Blocks.PURPLE_TERRACOTTA, new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); - ChemicalHelper.registerMaterialInfo(Blocks.BLUE_TERRACOTTA, new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); - ChemicalHelper.registerMaterialInfo(Blocks.BROWN_TERRACOTTA, new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); - ChemicalHelper.registerMaterialInfo(Blocks.GREEN_TERRACOTTA, new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); - ChemicalHelper.registerMaterialInfo(Blocks.RED_TERRACOTTA, new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); - ChemicalHelper.registerMaterialInfo(Blocks.BLACK_TERRACOTTA, new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); - - ChemicalHelper.registerMaterialInfo(Blocks.WHITE_GLAZED_TERRACOTTA, new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); - ChemicalHelper.registerMaterialInfo(Blocks.ORANGE_GLAZED_TERRACOTTA, new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); - ChemicalHelper.registerMaterialInfo(Blocks.MAGENTA_GLAZED_TERRACOTTA, new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); - ChemicalHelper.registerMaterialInfo(Blocks.LIGHT_BLUE_GLAZED_TERRACOTTA, new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); - ChemicalHelper.registerMaterialInfo(Blocks.YELLOW_GLAZED_TERRACOTTA, new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); - ChemicalHelper.registerMaterialInfo(Blocks.LIME_GLAZED_TERRACOTTA, new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); - ChemicalHelper.registerMaterialInfo(Blocks.PINK_GLAZED_TERRACOTTA, new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); - ChemicalHelper.registerMaterialInfo(Blocks.GRAY_GLAZED_TERRACOTTA, new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); - ChemicalHelper.registerMaterialInfo(Blocks.LIGHT_GRAY_GLAZED_TERRACOTTA, new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); - ChemicalHelper.registerMaterialInfo(Blocks.CYAN_GLAZED_TERRACOTTA, new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); - ChemicalHelper.registerMaterialInfo(Blocks.PURPLE_GLAZED_TERRACOTTA, new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); - ChemicalHelper.registerMaterialInfo(Blocks.BLUE_GLAZED_TERRACOTTA, new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); - ChemicalHelper.registerMaterialInfo(Blocks.BROWN_GLAZED_TERRACOTTA, new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); - ChemicalHelper.registerMaterialInfo(Blocks.GREEN_GLAZED_TERRACOTTA, new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); - ChemicalHelper.registerMaterialInfo(Blocks.RED_GLAZED_TERRACOTTA, new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); - ChemicalHelper.registerMaterialInfo(Blocks.BLACK_GLAZED_TERRACOTTA, new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); - - ChemicalHelper.registerMaterialInfo(GTBlocks.CASING_PRIMITIVE_BRICKS.get(), new ItemMaterialInfo(new MaterialStack(GTMaterials.Fireclay, M * 4))); + ChemicalHelper.registerMaterialInfo(Blocks.TERRACOTTA, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); + ChemicalHelper.registerMaterialInfo(Blocks.WHITE_TERRACOTTA, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); + ChemicalHelper.registerMaterialInfo(Blocks.ORANGE_TERRACOTTA, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); + ChemicalHelper.registerMaterialInfo(Blocks.MAGENTA_TERRACOTTA, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); + ChemicalHelper.registerMaterialInfo(Blocks.LIGHT_BLUE_TERRACOTTA, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); + ChemicalHelper.registerMaterialInfo(Blocks.YELLOW_TERRACOTTA, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); + ChemicalHelper.registerMaterialInfo(Blocks.LIME_TERRACOTTA, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); + ChemicalHelper.registerMaterialInfo(Blocks.PINK_TERRACOTTA, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); + ChemicalHelper.registerMaterialInfo(Blocks.GRAY_TERRACOTTA, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); + ChemicalHelper.registerMaterialInfo(Blocks.LIGHT_GRAY_TERRACOTTA, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); + ChemicalHelper.registerMaterialInfo(Blocks.CYAN_TERRACOTTA, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); + ChemicalHelper.registerMaterialInfo(Blocks.PURPLE_TERRACOTTA, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); + ChemicalHelper.registerMaterialInfo(Blocks.BLUE_TERRACOTTA, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); + ChemicalHelper.registerMaterialInfo(Blocks.BROWN_TERRACOTTA, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); + ChemicalHelper.registerMaterialInfo(Blocks.GREEN_TERRACOTTA, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); + ChemicalHelper.registerMaterialInfo(Blocks.RED_TERRACOTTA, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); + ChemicalHelper.registerMaterialInfo(Blocks.BLACK_TERRACOTTA, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); + + ChemicalHelper.registerMaterialInfo(Blocks.WHITE_GLAZED_TERRACOTTA, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); + ChemicalHelper.registerMaterialInfo(Blocks.ORANGE_GLAZED_TERRACOTTA, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); + ChemicalHelper.registerMaterialInfo(Blocks.MAGENTA_GLAZED_TERRACOTTA, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); + ChemicalHelper.registerMaterialInfo(Blocks.LIGHT_BLUE_GLAZED_TERRACOTTA, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); + ChemicalHelper.registerMaterialInfo(Blocks.YELLOW_GLAZED_TERRACOTTA, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); + ChemicalHelper.registerMaterialInfo(Blocks.LIME_GLAZED_TERRACOTTA, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); + ChemicalHelper.registerMaterialInfo(Blocks.PINK_GLAZED_TERRACOTTA, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); + ChemicalHelper.registerMaterialInfo(Blocks.GRAY_GLAZED_TERRACOTTA, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); + ChemicalHelper.registerMaterialInfo(Blocks.LIGHT_GRAY_GLAZED_TERRACOTTA, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); + ChemicalHelper.registerMaterialInfo(Blocks.CYAN_GLAZED_TERRACOTTA, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); + ChemicalHelper.registerMaterialInfo(Blocks.PURPLE_GLAZED_TERRACOTTA, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); + ChemicalHelper.registerMaterialInfo(Blocks.BLUE_GLAZED_TERRACOTTA, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); + ChemicalHelper.registerMaterialInfo(Blocks.BROWN_GLAZED_TERRACOTTA, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); + ChemicalHelper.registerMaterialInfo(Blocks.GREEN_GLAZED_TERRACOTTA, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); + ChemicalHelper.registerMaterialInfo(Blocks.RED_GLAZED_TERRACOTTA, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); + ChemicalHelper.registerMaterialInfo(Blocks.BLACK_GLAZED_TERRACOTTA, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Clay, M * 4))); + + ChemicalHelper.registerMaterialInfo(GTBlocks.CASING_PRIMITIVE_BRICKS.get(), + new ItemMaterialInfo(new MaterialStack(GTMaterials.Fireclay, M * 4))); if (ConfigHolder.INSTANCE.recipes.hardWoodRecipes) { - ChemicalHelper.registerMaterialInfo(Items.ACACIA_DOOR, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 2), new MaterialStack(GTMaterials.Iron, M / 9))); // screw - ChemicalHelper.registerMaterialInfo(Items.BIRCH_DOOR, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 2), new MaterialStack(GTMaterials.Iron, M / 9))); // screw - ChemicalHelper.registerMaterialInfo(Items.JUNGLE_DOOR, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 2), new MaterialStack(GTMaterials.Iron, M / 9))); // screw - ChemicalHelper.registerMaterialInfo(Items.OAK_DOOR, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 2), new MaterialStack(GTMaterials.Iron, M / 9))); // screw - ChemicalHelper.registerMaterialInfo(Items.SPRUCE_DOOR, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 2), new MaterialStack(GTMaterials.Iron, M / 9))); // screw - ChemicalHelper.registerMaterialInfo(Items.DARK_OAK_DOOR, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 2), new MaterialStack(GTMaterials.Iron, M / 9))); // screw - ChemicalHelper.registerMaterialInfo(Items.MANGROVE_DOOR, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 2), new MaterialStack(GTMaterials.Iron, M / 9))); // screw - ChemicalHelper.registerMaterialInfo(Items.CRIMSON_DOOR, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 2), new MaterialStack(GTMaterials.Iron, M / 9))); // screw - ChemicalHelper.registerMaterialInfo(Items.WARPED_DOOR, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 2), new MaterialStack(GTMaterials.Iron, M / 9))); // screw - ChemicalHelper.registerMaterialInfo(Items.BAMBOO_DOOR, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 2), new MaterialStack(GTMaterials.Iron, M / 9))); // screw - ChemicalHelper.registerMaterialInfo(Items.CHERRY_DOOR, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 2), new MaterialStack(GTMaterials.Iron, M / 9))); // screw + ChemicalHelper.registerMaterialInfo(Items.ACACIA_DOOR, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Wood, M * 2), new MaterialStack(GTMaterials.Iron, M / 9))); // screw + ChemicalHelper.registerMaterialInfo(Items.BIRCH_DOOR, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Wood, M * 2), new MaterialStack(GTMaterials.Iron, M / 9))); // screw + ChemicalHelper.registerMaterialInfo(Items.JUNGLE_DOOR, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Wood, M * 2), new MaterialStack(GTMaterials.Iron, M / 9))); // screw + ChemicalHelper.registerMaterialInfo(Items.OAK_DOOR, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Wood, M * 2), new MaterialStack(GTMaterials.Iron, M / 9))); // screw + ChemicalHelper.registerMaterialInfo(Items.SPRUCE_DOOR, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Wood, M * 2), new MaterialStack(GTMaterials.Iron, M / 9))); // screw + ChemicalHelper.registerMaterialInfo(Items.DARK_OAK_DOOR, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Wood, M * 2), new MaterialStack(GTMaterials.Iron, M / 9))); // screw + ChemicalHelper.registerMaterialInfo(Items.MANGROVE_DOOR, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Wood, M * 2), new MaterialStack(GTMaterials.Iron, M / 9))); // screw + ChemicalHelper.registerMaterialInfo(Items.CRIMSON_DOOR, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Wood, M * 2), new MaterialStack(GTMaterials.Iron, M / 9))); // screw + ChemicalHelper.registerMaterialInfo(Items.WARPED_DOOR, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Wood, M * 2), new MaterialStack(GTMaterials.Iron, M / 9))); // screw + ChemicalHelper.registerMaterialInfo(Items.BAMBOO_DOOR, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Wood, M * 2), new MaterialStack(GTMaterials.Iron, M / 9))); // screw + ChemicalHelper.registerMaterialInfo(Items.CHERRY_DOOR, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Wood, M * 2), new MaterialStack(GTMaterials.Iron, M / 9))); // screw } else { - ChemicalHelper.registerMaterialInfo(Items.ACACIA_DOOR, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 2))); - ChemicalHelper.registerMaterialInfo(Items.BIRCH_DOOR, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 2))); - ChemicalHelper.registerMaterialInfo(Items.JUNGLE_DOOR, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 2))); - ChemicalHelper.registerMaterialInfo(Items.OAK_DOOR, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 2))); - ChemicalHelper.registerMaterialInfo(Items.SPRUCE_DOOR, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 2))); - ChemicalHelper.registerMaterialInfo(Items.DARK_OAK_DOOR, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 2))); - ChemicalHelper.registerMaterialInfo(Items.MANGROVE_DOOR, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 2))); - ChemicalHelper.registerMaterialInfo(Items.CRIMSON_DOOR, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 2))); - ChemicalHelper.registerMaterialInfo(Items.WARPED_DOOR, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 2))); - ChemicalHelper.registerMaterialInfo(Items.BAMBOO_DOOR, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 2))); - ChemicalHelper.registerMaterialInfo(Items.CHERRY_DOOR, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 2))); + ChemicalHelper.registerMaterialInfo(Items.ACACIA_DOOR, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 2))); + ChemicalHelper.registerMaterialInfo(Items.BIRCH_DOOR, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 2))); + ChemicalHelper.registerMaterialInfo(Items.JUNGLE_DOOR, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 2))); + ChemicalHelper.registerMaterialInfo(Items.OAK_DOOR, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 2))); + ChemicalHelper.registerMaterialInfo(Items.SPRUCE_DOOR, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 2))); + ChemicalHelper.registerMaterialInfo(Items.DARK_OAK_DOOR, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 2))); + ChemicalHelper.registerMaterialInfo(Items.MANGROVE_DOOR, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 2))); + ChemicalHelper.registerMaterialInfo(Items.CRIMSON_DOOR, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 2))); + ChemicalHelper.registerMaterialInfo(Items.WARPED_DOOR, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 2))); + ChemicalHelper.registerMaterialInfo(Items.BAMBOO_DOOR, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 2))); + ChemicalHelper.registerMaterialInfo(Items.CHERRY_DOOR, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 2))); } - ChemicalHelper.registerMaterialInfo(Blocks.ACACIA_PLANKS, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M))); - ChemicalHelper.registerMaterialInfo(Blocks.BIRCH_PLANKS, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M))); - ChemicalHelper.registerMaterialInfo(Blocks.JUNGLE_PLANKS, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M))); - ChemicalHelper.registerMaterialInfo(Blocks.OAK_PLANKS, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M))); - ChemicalHelper.registerMaterialInfo(Blocks.SPRUCE_PLANKS, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M))); - ChemicalHelper.registerMaterialInfo(Blocks.DARK_OAK_PLANKS, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M))); - ChemicalHelper.registerMaterialInfo(Blocks.MANGROVE_PLANKS, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M))); - ChemicalHelper.registerMaterialInfo(Blocks.CRIMSON_PLANKS, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M))); - ChemicalHelper.registerMaterialInfo(Blocks.WARPED_PLANKS, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M))); - ChemicalHelper.registerMaterialInfo(Blocks.BAMBOO_PLANKS, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M))); - ChemicalHelper.registerMaterialInfo(Blocks.CHERRY_PLANKS, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M))); - + ChemicalHelper.registerMaterialInfo(Blocks.ACACIA_PLANKS, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M))); + ChemicalHelper.registerMaterialInfo(Blocks.BIRCH_PLANKS, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M))); + ChemicalHelper.registerMaterialInfo(Blocks.JUNGLE_PLANKS, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M))); + ChemicalHelper.registerMaterialInfo(Blocks.OAK_PLANKS, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M))); + ChemicalHelper.registerMaterialInfo(Blocks.SPRUCE_PLANKS, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M))); + ChemicalHelper.registerMaterialInfo(Blocks.DARK_OAK_PLANKS, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M))); + ChemicalHelper.registerMaterialInfo(Blocks.MANGROVE_PLANKS, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M))); + ChemicalHelper.registerMaterialInfo(Blocks.CRIMSON_PLANKS, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M))); + ChemicalHelper.registerMaterialInfo(Blocks.WARPED_PLANKS, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M))); + ChemicalHelper.registerMaterialInfo(Blocks.BAMBOO_PLANKS, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M))); + ChemicalHelper.registerMaterialInfo(Blocks.CHERRY_PLANKS, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M))); if (ConfigHolder.INSTANCE.recipes.hardAdvancedIronRecipes) { ChemicalHelper.registerMaterialInfo(Items.IRON_DOOR, new ItemMaterialInfo( - new MaterialStack(GTMaterials.Iron, M * 4 + (M * 3 / 16)), // 4 iron plates + 1 iron bars - new MaterialStack(GTMaterials.Steel, M / 9))); // tiny steel dust - } - else { - ChemicalHelper.registerMaterialInfo(Items.IRON_DOOR, new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M * 2))); + new MaterialStack(GTMaterials.Iron, M * 4 + (M * 3 / 16)), // 4 iron plates + 1 iron bars + new MaterialStack(GTMaterials.Steel, M / 9))); // tiny steel dust + } else { + ChemicalHelper.registerMaterialInfo(Items.IRON_DOOR, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M * 2))); } - ChemicalHelper.registerMaterialInfo(Blocks.OAK_FENCE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M))); // dust - ChemicalHelper.registerMaterialInfo(Blocks.BIRCH_FENCE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M))); // dust - ChemicalHelper.registerMaterialInfo(Blocks.SPRUCE_FENCE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M))); // dust - ChemicalHelper.registerMaterialInfo(Blocks.JUNGLE_FENCE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M))); // dust - ChemicalHelper.registerMaterialInfo(Blocks.DARK_OAK_FENCE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M))); // dust - ChemicalHelper.registerMaterialInfo(Blocks.ACACIA_FENCE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M))); // dust - ChemicalHelper.registerMaterialInfo(Blocks.MANGROVE_FENCE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M))); // dust - ChemicalHelper.registerMaterialInfo(Blocks.CRIMSON_FENCE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M))); // dust - ChemicalHelper.registerMaterialInfo(Blocks.WARPED_FENCE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M))); // dust - ChemicalHelper.registerMaterialInfo(Blocks.BAMBOO_FENCE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M))); // dust - ChemicalHelper.registerMaterialInfo(Blocks.CHERRY_FENCE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M))); // dust - - ChemicalHelper.registerMaterialInfo(Blocks.OAK_FENCE_GATE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 3))); // dust - ChemicalHelper.registerMaterialInfo(Blocks.BIRCH_FENCE_GATE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 3))); // dust - ChemicalHelper.registerMaterialInfo(Blocks.SPRUCE_FENCE_GATE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 3))); // dust - ChemicalHelper.registerMaterialInfo(Blocks.JUNGLE_FENCE_GATE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 3))); // dust - ChemicalHelper.registerMaterialInfo(Blocks.DARK_OAK_FENCE_GATE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 3))); // dust - ChemicalHelper.registerMaterialInfo(Blocks.ACACIA_FENCE_GATE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 3))); // dust - ChemicalHelper.registerMaterialInfo(Blocks.MANGROVE_FENCE_GATE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 3))); // dust - ChemicalHelper.registerMaterialInfo(Blocks.CRIMSON_FENCE_GATE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 3))); // dust - ChemicalHelper.registerMaterialInfo(Blocks.WARPED_FENCE_GATE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 3))); // dust - ChemicalHelper.registerMaterialInfo(Blocks.BAMBOO_FENCE_GATE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 3))); // dust - ChemicalHelper.registerMaterialInfo(Blocks.CHERRY_FENCE_GATE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 3))); // dust - - ChemicalHelper.registerMaterialInfo(Blocks.OAK_STAIRS, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, (3 * M) / 2))); // dust small - ChemicalHelper.registerMaterialInfo(Blocks.BIRCH_STAIRS, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, (3 * M) / 2))); // dust small - ChemicalHelper.registerMaterialInfo(Blocks.SPRUCE_STAIRS, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, (3 * M) / 2))); // dust small - ChemicalHelper.registerMaterialInfo(Blocks.JUNGLE_STAIRS, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, (3 * M) / 2))); // dust small - ChemicalHelper.registerMaterialInfo(Blocks.DARK_OAK_STAIRS, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, (3 * M) / 2))); // dust small - ChemicalHelper.registerMaterialInfo(Blocks.ACACIA_STAIRS, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, (3 * M) / 2))); // dust small - ChemicalHelper.registerMaterialInfo(Blocks.MANGROVE_STAIRS, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, (3 * M) / 2))); // dust small - ChemicalHelper.registerMaterialInfo(Blocks.CRIMSON_STAIRS, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, (3 * M) / 2))); // dust small - ChemicalHelper.registerMaterialInfo(Blocks.WARPED_STAIRS, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, (3 * M) / 2))); // dust small - ChemicalHelper.registerMaterialInfo(Blocks.BAMBOO_STAIRS, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, (3 * M) / 2))); // dust small - ChemicalHelper.registerMaterialInfo(Blocks.BAMBOO_MOSAIC_STAIRS, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, (3 * M) / 2))); // dust small - ChemicalHelper.registerMaterialInfo(Blocks.CHERRY_STAIRS, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, (3 * M) / 2))); // dust small - - ChemicalHelper.registerMaterialInfo(Items.OAK_BOAT, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 5))); - ChemicalHelper.registerMaterialInfo(Items.BIRCH_BOAT, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 5))); - ChemicalHelper.registerMaterialInfo(Items.SPRUCE_BOAT, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 5))); - ChemicalHelper.registerMaterialInfo(Items.JUNGLE_BOAT, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 5))); - ChemicalHelper.registerMaterialInfo(Items.DARK_OAK_BOAT, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 5))); - ChemicalHelper.registerMaterialInfo(Items.ACACIA_BOAT, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 5))); - ChemicalHelper.registerMaterialInfo(Items.MANGROVE_BOAT, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 5))); - ChemicalHelper.registerMaterialInfo(Items.BAMBOO_RAFT, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 5))); - ChemicalHelper.registerMaterialInfo(Items.CHERRY_BOAT, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 5))); - - ChemicalHelper.registerMaterialInfo(Blocks.STONE_STAIRS, new ItemMaterialInfo(new MaterialStack(GTMaterials.Stone, (3 * M) / 2))); // dust small - ChemicalHelper.registerMaterialInfo(Blocks.SANDSTONE_STAIRS, new ItemMaterialInfo(new MaterialStack(GTMaterials.Stone, (3 * M) / 2))); // dust small - ChemicalHelper.registerMaterialInfo(Blocks.RED_SANDSTONE_STAIRS, new ItemMaterialInfo(new MaterialStack(GTMaterials.Stone, (3 * M) / 2))); // dust small - ChemicalHelper.registerMaterialInfo(Blocks.STONE_BRICK_STAIRS, new ItemMaterialInfo(new MaterialStack(GTMaterials.Stone, (3 * M) / 2))); // dust small - ChemicalHelper.registerMaterialInfo(Blocks.QUARTZ_STAIRS, new ItemMaterialInfo(new MaterialStack(GTMaterials.NetherQuartz, M * 4))); // dust - ChemicalHelper.registerMaterialInfo(Blocks.BRICK_STAIRS, new ItemMaterialInfo(new MaterialStack(GTMaterials.Brick, M * 4))); // dust - ChemicalHelper.registerMaterialInfo(Blocks.NETHER_BRICK_STAIRS, new ItemMaterialInfo(new MaterialStack(GTMaterials.Netherrack, M * 4))); // dust - - ChemicalHelper.registerMaterialInfo(Blocks.STONE_SLAB, new ItemMaterialInfo(new MaterialStack(GTMaterials.Stone, M / 2))); - ChemicalHelper.registerMaterialInfo(Blocks.SANDSTONE_SLAB, new ItemMaterialInfo(new MaterialStack(GTMaterials.Stone, M / 2))); - ChemicalHelper.registerMaterialInfo(Blocks.RED_SANDSTONE_SLAB, new ItemMaterialInfo(new MaterialStack(GTMaterials.Stone, M / 2))); - ChemicalHelper.registerMaterialInfo(Blocks.COBBLESTONE_SLAB, new ItemMaterialInfo(new MaterialStack(GTMaterials.Stone, M / 2))); - ChemicalHelper.registerMaterialInfo(Blocks.BRICK_SLAB, new ItemMaterialInfo(new MaterialStack(GTMaterials.Brick, M * 2))); - ChemicalHelper.registerMaterialInfo(Blocks.STONE_BRICK_SLAB, new ItemMaterialInfo(new MaterialStack(GTMaterials.Stone, M / 2))); - ChemicalHelper.registerMaterialInfo(Blocks.NETHER_BRICK_SLAB, new ItemMaterialInfo(new MaterialStack(GTMaterials.Netherrack, M * 2))); - ChemicalHelper.registerMaterialInfo(Blocks.QUARTZ_SLAB, new ItemMaterialInfo(new MaterialStack(GTMaterials.NetherQuartz, M * 2))); - ChemicalHelper.registerMaterialInfo(Blocks.SMOOTH_QUARTZ_SLAB, new ItemMaterialInfo(new MaterialStack(GTMaterials.NetherQuartz, M * 2))); - - ChemicalHelper.registerMaterialInfo(Blocks.OAK_SLAB, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M / 2))); - ChemicalHelper.registerMaterialInfo(Blocks.BIRCH_SLAB, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M / 2))); - ChemicalHelper.registerMaterialInfo(Blocks.SPRUCE_SLAB, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M / 2))); - ChemicalHelper.registerMaterialInfo(Blocks.JUNGLE_SLAB, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M / 2))); - ChemicalHelper.registerMaterialInfo(Blocks.DARK_OAK_SLAB, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M / 2))); - ChemicalHelper.registerMaterialInfo(Blocks.ACACIA_SLAB, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M / 2))); - ChemicalHelper.registerMaterialInfo(Blocks.MANGROVE_SLAB, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M / 2))); - ChemicalHelper.registerMaterialInfo(Blocks.CRIMSON_SLAB, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M / 2))); - ChemicalHelper.registerMaterialInfo(Blocks.WARPED_SLAB, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M / 2))); - ChemicalHelper.registerMaterialInfo(Blocks.BAMBOO_SLAB, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M / 2))); - ChemicalHelper.registerMaterialInfo(Blocks.BAMBOO_MOSAIC_SLAB, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M / 2))); - ChemicalHelper.registerMaterialInfo(Blocks.CHERRY_SLAB, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M / 2))); - - ChemicalHelper.registerMaterialInfo(Blocks.LEVER, new ItemMaterialInfo(new MaterialStack(GTMaterials.Stone, M / 9), new MaterialStack(GTMaterials.Wood, 1814400L))); - - ChemicalHelper.registerMaterialInfo(Blocks.OAK_BUTTON, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M / 9))); - ChemicalHelper.registerMaterialInfo(Blocks.BIRCH_BUTTON, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M / 9))); - ChemicalHelper.registerMaterialInfo(Blocks.SPRUCE_BUTTON, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M / 9))); - ChemicalHelper.registerMaterialInfo(Blocks.JUNGLE_BUTTON, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M / 9))); - ChemicalHelper.registerMaterialInfo(Blocks.DARK_OAK_BUTTON, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M / 9))); - ChemicalHelper.registerMaterialInfo(Blocks.ACACIA_BUTTON, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M / 9))); - ChemicalHelper.registerMaterialInfo(Blocks.MANGROVE_BUTTON, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M / 9))); - ChemicalHelper.registerMaterialInfo(Blocks.CRIMSON_BUTTON, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M / 9))); - ChemicalHelper.registerMaterialInfo(Blocks.WARPED_BUTTON, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M / 9))); - ChemicalHelper.registerMaterialInfo(Blocks.BAMBOO_BUTTON, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M / 9))); - ChemicalHelper.registerMaterialInfo(Blocks.CHERRY_BUTTON, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M / 9))); - - ChemicalHelper.registerMaterialInfo(Blocks.STONE_BUTTON, new ItemMaterialInfo(new MaterialStack(GTMaterials.Stone, M / 9))); - ChemicalHelper.registerMaterialInfo(Blocks.REDSTONE_TORCH, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M / 2), new MaterialStack(GTMaterials.Redstone, M))); - - ChemicalHelper.registerMaterialInfo(Blocks.RAIL, new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M * 3 / 16))); - ChemicalHelper.registerMaterialInfo(Blocks.POWERED_RAIL, new ItemMaterialInfo(new MaterialStack(GTMaterials.Gold, M / 2))); - ChemicalHelper.registerMaterialInfo(Blocks.DETECTOR_RAIL, new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M / 2))); - ChemicalHelper.registerMaterialInfo(Blocks.ACTIVATOR_RAIL, new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M / 2))); + ChemicalHelper.registerMaterialInfo(Blocks.OAK_FENCE, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M))); // dust + ChemicalHelper.registerMaterialInfo(Blocks.BIRCH_FENCE, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M))); // dust + ChemicalHelper.registerMaterialInfo(Blocks.SPRUCE_FENCE, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M))); // dust + ChemicalHelper.registerMaterialInfo(Blocks.JUNGLE_FENCE, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M))); // dust + ChemicalHelper.registerMaterialInfo(Blocks.DARK_OAK_FENCE, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M))); // dust + ChemicalHelper.registerMaterialInfo(Blocks.ACACIA_FENCE, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M))); // dust + ChemicalHelper.registerMaterialInfo(Blocks.MANGROVE_FENCE, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M))); // dust + ChemicalHelper.registerMaterialInfo(Blocks.CRIMSON_FENCE, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M))); // dust + ChemicalHelper.registerMaterialInfo(Blocks.WARPED_FENCE, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M))); // dust + ChemicalHelper.registerMaterialInfo(Blocks.BAMBOO_FENCE, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M))); // dust + ChemicalHelper.registerMaterialInfo(Blocks.CHERRY_FENCE, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M))); // dust + + ChemicalHelper.registerMaterialInfo(Blocks.OAK_FENCE_GATE, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 3))); // dust + ChemicalHelper.registerMaterialInfo(Blocks.BIRCH_FENCE_GATE, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 3))); // dust + ChemicalHelper.registerMaterialInfo(Blocks.SPRUCE_FENCE_GATE, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 3))); // dust + ChemicalHelper.registerMaterialInfo(Blocks.JUNGLE_FENCE_GATE, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 3))); // dust + ChemicalHelper.registerMaterialInfo(Blocks.DARK_OAK_FENCE_GATE, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 3))); // dust + ChemicalHelper.registerMaterialInfo(Blocks.ACACIA_FENCE_GATE, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 3))); // dust + ChemicalHelper.registerMaterialInfo(Blocks.MANGROVE_FENCE_GATE, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 3))); // dust + ChemicalHelper.registerMaterialInfo(Blocks.CRIMSON_FENCE_GATE, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 3))); // dust + ChemicalHelper.registerMaterialInfo(Blocks.WARPED_FENCE_GATE, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 3))); // dust + ChemicalHelper.registerMaterialInfo(Blocks.BAMBOO_FENCE_GATE, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 3))); // dust + ChemicalHelper.registerMaterialInfo(Blocks.CHERRY_FENCE_GATE, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 3))); // dust + + ChemicalHelper.registerMaterialInfo(Blocks.OAK_STAIRS, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, (3 * M) / 2))); // dust small + ChemicalHelper.registerMaterialInfo(Blocks.BIRCH_STAIRS, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, (3 * M) / 2))); // dust small + ChemicalHelper.registerMaterialInfo(Blocks.SPRUCE_STAIRS, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, (3 * M) / 2))); // dust small + ChemicalHelper.registerMaterialInfo(Blocks.JUNGLE_STAIRS, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, (3 * M) / 2))); // dust small + ChemicalHelper.registerMaterialInfo(Blocks.DARK_OAK_STAIRS, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, (3 * M) / 2))); // dust small + ChemicalHelper.registerMaterialInfo(Blocks.ACACIA_STAIRS, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, (3 * M) / 2))); // dust small + ChemicalHelper.registerMaterialInfo(Blocks.MANGROVE_STAIRS, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, (3 * M) / 2))); // dust small + ChemicalHelper.registerMaterialInfo(Blocks.CRIMSON_STAIRS, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, (3 * M) / 2))); // dust small + ChemicalHelper.registerMaterialInfo(Blocks.WARPED_STAIRS, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, (3 * M) / 2))); // dust small + ChemicalHelper.registerMaterialInfo(Blocks.BAMBOO_STAIRS, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, (3 * M) / 2))); // dust small + ChemicalHelper.registerMaterialInfo(Blocks.BAMBOO_MOSAIC_STAIRS, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, (3 * M) / 2))); // dust small + ChemicalHelper.registerMaterialInfo(Blocks.CHERRY_STAIRS, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, (3 * M) / 2))); // dust small + + ChemicalHelper.registerMaterialInfo(Items.OAK_BOAT, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 5))); + ChemicalHelper.registerMaterialInfo(Items.BIRCH_BOAT, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 5))); + ChemicalHelper.registerMaterialInfo(Items.SPRUCE_BOAT, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 5))); + ChemicalHelper.registerMaterialInfo(Items.JUNGLE_BOAT, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 5))); + ChemicalHelper.registerMaterialInfo(Items.DARK_OAK_BOAT, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 5))); + ChemicalHelper.registerMaterialInfo(Items.ACACIA_BOAT, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 5))); + ChemicalHelper.registerMaterialInfo(Items.MANGROVE_BOAT, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 5))); + ChemicalHelper.registerMaterialInfo(Items.BAMBOO_RAFT, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 5))); + ChemicalHelper.registerMaterialInfo(Items.CHERRY_BOAT, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 5))); + + ChemicalHelper.registerMaterialInfo(Blocks.STONE_STAIRS, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Stone, (3 * M) / 2))); // dust small + ChemicalHelper.registerMaterialInfo(Blocks.SANDSTONE_STAIRS, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Stone, (3 * M) / 2))); // dust small + ChemicalHelper.registerMaterialInfo(Blocks.RED_SANDSTONE_STAIRS, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Stone, (3 * M) / 2))); // dust small + ChemicalHelper.registerMaterialInfo(Blocks.STONE_BRICK_STAIRS, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Stone, (3 * M) / 2))); // dust small + ChemicalHelper.registerMaterialInfo(Blocks.QUARTZ_STAIRS, + new ItemMaterialInfo(new MaterialStack(GTMaterials.NetherQuartz, M * 4))); // dust + ChemicalHelper.registerMaterialInfo(Blocks.BRICK_STAIRS, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Brick, M * 4))); // dust + ChemicalHelper.registerMaterialInfo(Blocks.NETHER_BRICK_STAIRS, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Netherrack, M * 4))); // dust + + ChemicalHelper.registerMaterialInfo(Blocks.STONE_SLAB, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Stone, M / 2))); + ChemicalHelper.registerMaterialInfo(Blocks.SANDSTONE_SLAB, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Stone, M / 2))); + ChemicalHelper.registerMaterialInfo(Blocks.RED_SANDSTONE_SLAB, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Stone, M / 2))); + ChemicalHelper.registerMaterialInfo(Blocks.COBBLESTONE_SLAB, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Stone, M / 2))); + ChemicalHelper.registerMaterialInfo(Blocks.BRICK_SLAB, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Brick, M * 2))); + ChemicalHelper.registerMaterialInfo(Blocks.STONE_BRICK_SLAB, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Stone, M / 2))); + ChemicalHelper.registerMaterialInfo(Blocks.NETHER_BRICK_SLAB, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Netherrack, M * 2))); + ChemicalHelper.registerMaterialInfo(Blocks.QUARTZ_SLAB, + new ItemMaterialInfo(new MaterialStack(GTMaterials.NetherQuartz, M * 2))); + ChemicalHelper.registerMaterialInfo(Blocks.SMOOTH_QUARTZ_SLAB, + new ItemMaterialInfo(new MaterialStack(GTMaterials.NetherQuartz, M * 2))); + + ChemicalHelper.registerMaterialInfo(Blocks.OAK_SLAB, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M / 2))); + ChemicalHelper.registerMaterialInfo(Blocks.BIRCH_SLAB, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M / 2))); + ChemicalHelper.registerMaterialInfo(Blocks.SPRUCE_SLAB, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M / 2))); + ChemicalHelper.registerMaterialInfo(Blocks.JUNGLE_SLAB, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M / 2))); + ChemicalHelper.registerMaterialInfo(Blocks.DARK_OAK_SLAB, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M / 2))); + ChemicalHelper.registerMaterialInfo(Blocks.ACACIA_SLAB, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M / 2))); + ChemicalHelper.registerMaterialInfo(Blocks.MANGROVE_SLAB, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M / 2))); + ChemicalHelper.registerMaterialInfo(Blocks.CRIMSON_SLAB, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M / 2))); + ChemicalHelper.registerMaterialInfo(Blocks.WARPED_SLAB, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M / 2))); + ChemicalHelper.registerMaterialInfo(Blocks.BAMBOO_SLAB, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M / 2))); + ChemicalHelper.registerMaterialInfo(Blocks.BAMBOO_MOSAIC_SLAB, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M / 2))); + ChemicalHelper.registerMaterialInfo(Blocks.CHERRY_SLAB, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M / 2))); + + ChemicalHelper.registerMaterialInfo(Blocks.LEVER, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Stone, M / 9), new MaterialStack(GTMaterials.Wood, 1814400L))); + + ChemicalHelper.registerMaterialInfo(Blocks.OAK_BUTTON, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M / 9))); + ChemicalHelper.registerMaterialInfo(Blocks.BIRCH_BUTTON, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M / 9))); + ChemicalHelper.registerMaterialInfo(Blocks.SPRUCE_BUTTON, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M / 9))); + ChemicalHelper.registerMaterialInfo(Blocks.JUNGLE_BUTTON, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M / 9))); + ChemicalHelper.registerMaterialInfo(Blocks.DARK_OAK_BUTTON, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M / 9))); + ChemicalHelper.registerMaterialInfo(Blocks.ACACIA_BUTTON, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M / 9))); + ChemicalHelper.registerMaterialInfo(Blocks.MANGROVE_BUTTON, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M / 9))); + ChemicalHelper.registerMaterialInfo(Blocks.CRIMSON_BUTTON, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M / 9))); + ChemicalHelper.registerMaterialInfo(Blocks.WARPED_BUTTON, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M / 9))); + ChemicalHelper.registerMaterialInfo(Blocks.BAMBOO_BUTTON, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M / 9))); + ChemicalHelper.registerMaterialInfo(Blocks.CHERRY_BUTTON, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M / 9))); + + ChemicalHelper.registerMaterialInfo(Blocks.STONE_BUTTON, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Stone, M / 9))); + ChemicalHelper.registerMaterialInfo(Blocks.REDSTONE_TORCH, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Wood, M / 2), new MaterialStack(GTMaterials.Redstone, M))); + + ChemicalHelper.registerMaterialInfo(Blocks.RAIL, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M * 3 / 16))); + ChemicalHelper.registerMaterialInfo(Blocks.POWERED_RAIL, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Gold, M / 2))); + ChemicalHelper.registerMaterialInfo(Blocks.DETECTOR_RAIL, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M / 2))); + ChemicalHelper.registerMaterialInfo(Blocks.ACTIVATOR_RAIL, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M / 2))); if (ConfigHolder.INSTANCE.recipes.hardRedstoneRecipes) { - //ChemicalHelper.registerMaterialInfo(new ItemStack(Blocks.WOODEN_PRESSURE_PLATE, 1, W), new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M), new MaterialStack(GTMaterials.Iron, M / 2))); - ChemicalHelper.registerMaterialInfo(Blocks.STONE_PRESSURE_PLATE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Stone, M), new MaterialStack(GTMaterials.Iron, M * 6 / 8))); - ChemicalHelper.registerMaterialInfo(Blocks.LIGHT_WEIGHTED_PRESSURE_PLATE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Gold, M), new MaterialStack(GTMaterials.Steel, M))); - ChemicalHelper.registerMaterialInfo(Blocks.HEAVY_WEIGHTED_PRESSURE_PLATE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M), new MaterialStack(GTMaterials.Steel, M))); + // ChemicalHelper.registerMaterialInfo(new ItemStack(Blocks.WOODEN_PRESSURE_PLATE, 1, W), new + // ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M), new MaterialStack(GTMaterials.Iron, M / 2))); + ChemicalHelper.registerMaterialInfo(Blocks.STONE_PRESSURE_PLATE, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Stone, M), new MaterialStack(GTMaterials.Iron, M * 6 / 8))); + ChemicalHelper.registerMaterialInfo(Blocks.LIGHT_WEIGHTED_PRESSURE_PLATE, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Gold, M), new MaterialStack(GTMaterials.Steel, M))); + ChemicalHelper.registerMaterialInfo(Blocks.HEAVY_WEIGHTED_PRESSURE_PLATE, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Iron, M), new MaterialStack(GTMaterials.Steel, M))); } else { - //ChemicalHelper.registerMaterialInfo(new ItemStack(Blocks.WOODEN_PRESSURE_PLATE, 1, W), new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 2))); - ChemicalHelper.registerMaterialInfo(Blocks.STONE_PRESSURE_PLATE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Stone, M * 2))); - ChemicalHelper.registerMaterialInfo(Blocks.LIGHT_WEIGHTED_PRESSURE_PLATE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Gold, M * 2))); - ChemicalHelper.registerMaterialInfo(Blocks.HEAVY_WEIGHTED_PRESSURE_PLATE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M * 2))); + // ChemicalHelper.registerMaterialInfo(new ItemStack(Blocks.WOODEN_PRESSURE_PLATE, 1, W), new + // ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 2))); + ChemicalHelper.registerMaterialInfo(Blocks.STONE_PRESSURE_PLATE, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Stone, M * 2))); + ChemicalHelper.registerMaterialInfo(Blocks.LIGHT_WEIGHTED_PRESSURE_PLATE, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Gold, M * 2))); + ChemicalHelper.registerMaterialInfo(Blocks.HEAVY_WEIGHTED_PRESSURE_PLATE, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M * 2))); } ChemicalHelper.registerMaterialInfo(Items.WHEAT, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wheat, M))); - ChemicalHelper.registerMaterialInfo(Blocks.HAY_BLOCK, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wheat, M * 9))); + ChemicalHelper.registerMaterialInfo(Blocks.HAY_BLOCK, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wheat, M * 9))); - ChemicalHelper.registerMaterialInfo(Items.SNOWBALL, new ItemMaterialInfo(new MaterialStack(GTMaterials.Water, M / 4))); + ChemicalHelper.registerMaterialInfo(Items.SNOWBALL, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Water, M / 4))); ChemicalHelper.registerMaterialInfo(Blocks.SNOW, new ItemMaterialInfo(new MaterialStack(GTMaterials.Water, M))); ChemicalHelper.registerMaterialInfo(Blocks.ICE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Ice, M))); - ChemicalHelper.registerMaterialInfo(Blocks.PACKED_ICE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Ice, M * 9))); - ChemicalHelper.registerMaterialInfo(Blocks.BLUE_ICE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Ice, M * 81))); - - ChemicalHelper.registerMaterialInfo(Items.BOOK, new ItemMaterialInfo(new MaterialStack(GTMaterials.Paper, M * 3))); - ChemicalHelper.registerMaterialInfo(Items.WRITABLE_BOOK, new ItemMaterialInfo(new MaterialStack(GTMaterials.Paper, M * 3))); - ChemicalHelper.registerMaterialInfo(Items.ENCHANTED_BOOK, new ItemMaterialInfo(new MaterialStack(GTMaterials.Paper, M * 3))); - ChemicalHelper.registerMaterialInfo(Blocks.BOOKSHELF, new ItemMaterialInfo(new MaterialStack(GTMaterials.Paper, M * 9), new MaterialStack(GTMaterials.Wood, M * 6))); - ChemicalHelper.registerMaterialInfo(Items.ENCHANTED_GOLDEN_APPLE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Gold, M * 72))); // block - ChemicalHelper.registerMaterialInfo(Items.GOLDEN_APPLE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Gold, M * 8))); // ingot - - ChemicalHelper.registerMaterialInfo(Items.MINECART, new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M * 5))); - ChemicalHelper.registerMaterialInfo(Items.CHEST_MINECART, new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M * 5), new MaterialStack(GTMaterials.Wood, M * 8))); - ChemicalHelper.registerMaterialInfo(Items.FURNACE_MINECART, new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M * 5), new MaterialStack(GTMaterials.Stone, M * 8))); - ChemicalHelper.registerMaterialInfo(Items.TNT_MINECART, new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M * 5))); - ChemicalHelper.registerMaterialInfo(Items.HOPPER_MINECART, new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M * 10), new MaterialStack(GTMaterials.Wood, M * 8))); - - ChemicalHelper.registerMaterialInfo(Items.CAULDRON, new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M * 7))); - ChemicalHelper.registerMaterialInfo(Blocks.IRON_BARS, new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M * 3 / 16))); // todo is this accurate - ChemicalHelper.registerMaterialInfo(Blocks.IRON_TRAPDOOR, new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M * 4))); - ChemicalHelper.registerMaterialInfo(Items.BUCKET, new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M * 3))); - - ChemicalHelper.registerMaterialInfo(Blocks.ANVIL, new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M * 31))); - ChemicalHelper.registerMaterialInfo(Blocks.CHIPPED_ANVIL, new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M * 22))); - ChemicalHelper.registerMaterialInfo(Blocks.DAMAGED_ANVIL, new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M * 13))); - ChemicalHelper.registerMaterialInfo(Blocks.HOPPER, new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M * 5), new MaterialStack(GTMaterials.Wood, M * 8))); - - ChemicalHelper.registerMaterialInfo(Items.GLASS_BOTTLE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Glass, M))); - //ChemicalHelper.registerMaterialInfo(new ItemStack(Blocks.STAINED_GLASS, 1, W), new ItemMaterialInfo(new MaterialStack(GTMaterials.Glass, M))); - ChemicalHelper.registerMaterialInfo(Blocks.GLASS, new ItemMaterialInfo(new MaterialStack(GTMaterials.Glass, M))); - //ChemicalHelper.registerMaterialInfo(new ItemStack(Blocks.STAINED_GLASS_PANE, 1, W), new ItemMaterialInfo(new MaterialStack(GTMaterials.Glass, M / 3))); // dust tiny - ChemicalHelper.registerMaterialInfo(Blocks.GLASS_PANE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Glass, M / 3))); // dust tiny - - ChemicalHelper.registerMaterialInfo(Items.FLOWER_POT, new ItemMaterialInfo(new MaterialStack(GTMaterials.Brick, M * 3))); - ChemicalHelper.registerMaterialInfo(Items.PAINTING, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 2))); - ChemicalHelper.registerMaterialInfo(Items.ITEM_FRAME, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 2))); - ChemicalHelper.registerMaterialInfo(Blocks.COBBLESTONE_WALL, new ItemMaterialInfo(new MaterialStack(GTMaterials.Stone, M))); - ChemicalHelper.registerMaterialInfo(Items.END_CRYSTAL, new ItemMaterialInfo(new MaterialStack(GTMaterials.Glass, M * 7), new MaterialStack(GTMaterials.EnderEye, M))); + ChemicalHelper.registerMaterialInfo(Blocks.PACKED_ICE, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Ice, M * 9))); + ChemicalHelper.registerMaterialInfo(Blocks.BLUE_ICE, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Ice, M * 81))); + + ChemicalHelper.registerMaterialInfo(Items.BOOK, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Paper, M * 3))); + ChemicalHelper.registerMaterialInfo(Items.WRITABLE_BOOK, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Paper, M * 3))); + ChemicalHelper.registerMaterialInfo(Items.ENCHANTED_BOOK, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Paper, M * 3))); + ChemicalHelper.registerMaterialInfo(Blocks.BOOKSHELF, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Paper, M * 9), new MaterialStack(GTMaterials.Wood, M * 6))); + ChemicalHelper.registerMaterialInfo(Items.ENCHANTED_GOLDEN_APPLE, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Gold, M * 72))); // block + ChemicalHelper.registerMaterialInfo(Items.GOLDEN_APPLE, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Gold, M * 8))); // ingot + + ChemicalHelper.registerMaterialInfo(Items.MINECART, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M * 5))); + ChemicalHelper.registerMaterialInfo(Items.CHEST_MINECART, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Iron, M * 5), new MaterialStack(GTMaterials.Wood, M * 8))); + ChemicalHelper.registerMaterialInfo(Items.FURNACE_MINECART, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Iron, M * 5), new MaterialStack(GTMaterials.Stone, M * 8))); + ChemicalHelper.registerMaterialInfo(Items.TNT_MINECART, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M * 5))); + ChemicalHelper.registerMaterialInfo(Items.HOPPER_MINECART, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Iron, M * 10), new MaterialStack(GTMaterials.Wood, M * 8))); + + ChemicalHelper.registerMaterialInfo(Items.CAULDRON, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M * 7))); + ChemicalHelper.registerMaterialInfo(Blocks.IRON_BARS, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M * 3 / 16))); // todo is this accurate + ChemicalHelper.registerMaterialInfo(Blocks.IRON_TRAPDOOR, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M * 4))); + ChemicalHelper.registerMaterialInfo(Items.BUCKET, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M * 3))); + + ChemicalHelper.registerMaterialInfo(Blocks.ANVIL, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M * 31))); + ChemicalHelper.registerMaterialInfo(Blocks.CHIPPED_ANVIL, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M * 22))); + ChemicalHelper.registerMaterialInfo(Blocks.DAMAGED_ANVIL, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M * 13))); + ChemicalHelper.registerMaterialInfo(Blocks.HOPPER, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Iron, M * 5), new MaterialStack(GTMaterials.Wood, M * 8))); + + ChemicalHelper.registerMaterialInfo(Items.GLASS_BOTTLE, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Glass, M))); + // ChemicalHelper.registerMaterialInfo(new ItemStack(Blocks.STAINED_GLASS, 1, W), new ItemMaterialInfo(new + // MaterialStack(GTMaterials.Glass, M))); + ChemicalHelper.registerMaterialInfo(Blocks.GLASS, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Glass, M))); + // ChemicalHelper.registerMaterialInfo(new ItemStack(Blocks.STAINED_GLASS_PANE, 1, W), new ItemMaterialInfo(new + // MaterialStack(GTMaterials.Glass, M / 3))); // dust tiny + ChemicalHelper.registerMaterialInfo(Blocks.GLASS_PANE, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Glass, M / 3))); // dust tiny + + ChemicalHelper.registerMaterialInfo(Items.FLOWER_POT, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Brick, M * 3))); + ChemicalHelper.registerMaterialInfo(Items.PAINTING, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 2))); + ChemicalHelper.registerMaterialInfo(Items.ITEM_FRAME, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 2))); + ChemicalHelper.registerMaterialInfo(Blocks.COBBLESTONE_WALL, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Stone, M))); + ChemicalHelper.registerMaterialInfo(Items.END_CRYSTAL, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Glass, M * 7), new MaterialStack(GTMaterials.EnderEye, M))); if (ConfigHolder.INSTANCE.recipes.hardToolArmorRecipes) { - ChemicalHelper.registerMaterialInfo(Items.CLOCK, new ItemMaterialInfo - (new MaterialStack(GTMaterials.Gold, (13 * M) / 8), // M + ring + 3 * bolt + ChemicalHelper.registerMaterialInfo(Items.CLOCK, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Gold, (13 * M) / 8), // M + ring + 3 * bolt new MaterialStack(GTMaterials.Redstone, M))); ChemicalHelper.registerMaterialInfo(Items.COMPASS, new ItemMaterialInfo( @@ -420,8 +615,10 @@ public static void init() { new MaterialStack(GTMaterials.RedAlloy, M / 8), // bolt new MaterialStack(GTMaterials.Zinc, M / 4))); // ring } else { - ChemicalHelper.registerMaterialInfo(Items.CLOCK, new ItemMaterialInfo(new MaterialStack(GTMaterials.Gold, M * 4), new MaterialStack(GTMaterials.Redstone, M))); - ChemicalHelper.registerMaterialInfo(Items.COMPASS, new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M * 4), new MaterialStack(GTMaterials.Redstone, M))); + ChemicalHelper.registerMaterialInfo(Items.CLOCK, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Gold, M * 4), new MaterialStack(GTMaterials.Redstone, M))); + ChemicalHelper.registerMaterialInfo(Items.COMPASS, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Iron, M * 4), new MaterialStack(GTMaterials.Redstone, M))); } if (ConfigHolder.INSTANCE.recipes.hardMiscRecipes) { @@ -431,103 +628,179 @@ public static void init() { new MaterialStack(GTMaterials.Glass, M * 4))); ChemicalHelper.registerMaterialInfo(Blocks.ENCHANTING_TABLE, new ItemMaterialInfo( - new MaterialStack(GTMaterials.Diamond, M * 4), - new MaterialStack(GTMaterials.Obsidian, M * 3), - new MaterialStack(GTMaterials.Paper, M * 9))); + new MaterialStack(GTMaterials.Diamond, M * 4), + new MaterialStack(GTMaterials.Obsidian, M * 3), + new MaterialStack(GTMaterials.Paper, M * 9))); ChemicalHelper.registerMaterialInfo(Blocks.ENDER_CHEST, new ItemMaterialInfo( - new MaterialStack(GTMaterials.Wood, M * 8), // chest - new MaterialStack(GTMaterials.Obsidian, M * 9 * 6), // 6 dense plates - new MaterialStack(GTMaterials.EnderEye, M))); + new MaterialStack(GTMaterials.Wood, M * 8), // chest + new MaterialStack(GTMaterials.Obsidian, M * 9 * 6), // 6 dense plates + new MaterialStack(GTMaterials.EnderEye, M))); } else { - ChemicalHelper.registerMaterialInfo(Blocks.BEACON, new ItemMaterialInfo(new MaterialStack(GTMaterials.NetherStar, M), new MaterialStack(GTMaterials.Obsidian, M * 3), new MaterialStack(GTMaterials.Glass, M * 5))); - ChemicalHelper.registerMaterialInfo(Blocks.ENCHANTING_TABLE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Diamond, M * 2), new MaterialStack(GTMaterials.Obsidian, M * 4), new MaterialStack(GTMaterials.Paper, M * 3))); - ChemicalHelper.registerMaterialInfo(Blocks.ENDER_CHEST, new ItemMaterialInfo(new MaterialStack(GTMaterials.EnderEye, M), new MaterialStack(GTMaterials.Obsidian, M * 8))); + ChemicalHelper.registerMaterialInfo(Blocks.BEACON, + new ItemMaterialInfo(new MaterialStack(GTMaterials.NetherStar, M), + new MaterialStack(GTMaterials.Obsidian, M * 3), + new MaterialStack(GTMaterials.Glass, M * 5))); + ChemicalHelper.registerMaterialInfo(Blocks.ENCHANTING_TABLE, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Diamond, M * 2), + new MaterialStack(GTMaterials.Obsidian, M * 4), + new MaterialStack(GTMaterials.Paper, M * 3))); + ChemicalHelper.registerMaterialInfo(Blocks.ENDER_CHEST, new ItemMaterialInfo( + new MaterialStack(GTMaterials.EnderEye, M), new MaterialStack(GTMaterials.Obsidian, M * 8))); } - ChemicalHelper.registerMaterialInfo(Blocks.ENDER_CHEST, new ItemMaterialInfo(new MaterialStack(GTMaterials.EnderEye, M), new MaterialStack(GTMaterials.Obsidian, M * 8))); - - ChemicalHelper.registerMaterialInfo(Blocks.FURNACE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Stone, M * 8))); - ChemicalHelper.registerMaterialInfo(Blocks.STONE_BRICKS, new ItemMaterialInfo(new MaterialStack(GTMaterials.Stone, M))); - ChemicalHelper.registerMaterialInfo(Blocks.COBBLESTONE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Stone, M))); - ChemicalHelper.registerMaterialInfo(Blocks.MOSSY_COBBLESTONE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Stone, M))); - ChemicalHelper.registerMaterialInfo(Blocks.LADDER, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M))); - - ChemicalHelper.registerMaterialInfo(Items.BOWL, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M / 4))); - //ChemicalHelper.registerMaterialInfo(new ItemStack(Items.SIGN, 1, W), new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 2))); - ChemicalHelper.registerMaterialInfo(Blocks.CHEST, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 8))); - ChemicalHelper.registerMaterialInfo(Blocks.TRAPPED_CHEST, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 8), new MaterialStack(GTMaterials.Iron, M / 2))); // ring + ChemicalHelper.registerMaterialInfo(Blocks.ENDER_CHEST, new ItemMaterialInfo( + new MaterialStack(GTMaterials.EnderEye, M), new MaterialStack(GTMaterials.Obsidian, M * 8))); + + ChemicalHelper.registerMaterialInfo(Blocks.FURNACE, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Stone, M * 8))); + ChemicalHelper.registerMaterialInfo(Blocks.STONE_BRICKS, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Stone, M))); + ChemicalHelper.registerMaterialInfo(Blocks.COBBLESTONE, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Stone, M))); + ChemicalHelper.registerMaterialInfo(Blocks.MOSSY_COBBLESTONE, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Stone, M))); + ChemicalHelper.registerMaterialInfo(Blocks.LADDER, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M))); + + ChemicalHelper.registerMaterialInfo(Items.BOWL, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M / 4))); + // ChemicalHelper.registerMaterialInfo(new ItemStack(Items.SIGN, 1, W), new ItemMaterialInfo(new + // MaterialStack(GTMaterials.Wood, M * 2))); + ChemicalHelper.registerMaterialInfo(Blocks.CHEST, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 8))); + ChemicalHelper.registerMaterialInfo(Blocks.TRAPPED_CHEST, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Wood, M * 8), new MaterialStack(GTMaterials.Iron, M / 2))); // ring if (ConfigHolder.INSTANCE.recipes.hardMiscRecipes) { - ChemicalHelper.registerMaterialInfo(Blocks.NOTE_BLOCK, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 8), new MaterialStack(GTMaterials.RedAlloy, M / 2))); // rod + ChemicalHelper.registerMaterialInfo(Blocks.NOTE_BLOCK, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Wood, M * 8), new MaterialStack(GTMaterials.RedAlloy, M / 2))); // rod ChemicalHelper.registerMaterialInfo(Blocks.JUKEBOX, new ItemMaterialInfo( new MaterialStack(GTMaterials.Diamond, M / 8), // bolt new MaterialStack(GTMaterials.Iron, (17 * M) / 4), // gear + ring new MaterialStack(GTMaterials.RedAlloy, M))); } else { - ChemicalHelper.registerMaterialInfo(Blocks.NOTE_BLOCK, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 8), new MaterialStack(GTMaterials.Redstone, M))); - ChemicalHelper.registerMaterialInfo(Blocks.JUKEBOX, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 8), new MaterialStack(GTMaterials.Diamond, M))); + ChemicalHelper.registerMaterialInfo(Blocks.NOTE_BLOCK, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Wood, M * 8), new MaterialStack(GTMaterials.Redstone, M))); + ChemicalHelper.registerMaterialInfo(Blocks.JUKEBOX, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Wood, M * 8), new MaterialStack(GTMaterials.Diamond, M))); } - ChemicalHelper.registerMaterialInfo(Blocks.REDSTONE_LAMP, new ItemMaterialInfo(new MaterialStack(GTMaterials.Glowstone, M * 4), new MaterialStack(GTMaterials.Redstone, M * 4))); // dust - ChemicalHelper.registerMaterialInfo(Blocks.CRAFTING_TABLE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 2))); - ChemicalHelper.registerMaterialInfo(Blocks.PISTON, new ItemMaterialInfo(new MaterialStack(GTMaterials.Stone, M * 4), new MaterialStack(GTMaterials.Wood, M * 3))); - ChemicalHelper.registerMaterialInfo(Blocks.STICKY_PISTON, new ItemMaterialInfo(new MaterialStack(GTMaterials.Stone, M * 4), new MaterialStack(GTMaterials.Wood, M * 3))); + ChemicalHelper.registerMaterialInfo(Blocks.REDSTONE_LAMP, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Glowstone, M * 4), new MaterialStack(GTMaterials.Redstone, M * 4))); // dust + ChemicalHelper.registerMaterialInfo(Blocks.CRAFTING_TABLE, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 2))); + ChemicalHelper.registerMaterialInfo(Blocks.PISTON, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Stone, M * 4), new MaterialStack(GTMaterials.Wood, M * 3))); + ChemicalHelper.registerMaterialInfo(Blocks.STICKY_PISTON, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Stone, M * 4), new MaterialStack(GTMaterials.Wood, M * 3))); if (ConfigHolder.INSTANCE.recipes.hardRedstoneRecipes) { - ChemicalHelper.registerMaterialInfo(Blocks.DISPENSER, new ItemMaterialInfo(new MaterialStack(GTMaterials.Stone, M * 2), new MaterialStack(GTMaterials.RedAlloy, M / 2), new MaterialStack(GTMaterials.Iron, M * 4 + M / 4))); - ChemicalHelper.registerMaterialInfo(Blocks.DROPPER, new ItemMaterialInfo(new MaterialStack(GTMaterials.Stone, M * 2), new MaterialStack(GTMaterials.RedAlloy, M / 2), new MaterialStack(GTMaterials.Iron, M * 2 + M * 3 / 4))); + ChemicalHelper.registerMaterialInfo(Blocks.DISPENSER, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Stone, M * 2), + new MaterialStack(GTMaterials.RedAlloy, M / 2), + new MaterialStack(GTMaterials.Iron, M * 4 + M / 4))); + ChemicalHelper.registerMaterialInfo(Blocks.DROPPER, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Stone, M * 2), + new MaterialStack(GTMaterials.RedAlloy, M / 2), + new MaterialStack(GTMaterials.Iron, M * 2 + M * 3 / 4))); } else { - ChemicalHelper.registerMaterialInfo(Blocks.DISPENSER, new ItemMaterialInfo(new MaterialStack(GTMaterials.Stone, M * 2), new MaterialStack(GTMaterials.Redstone, M))); - ChemicalHelper.registerMaterialInfo(Blocks.DROPPER, new ItemMaterialInfo(new MaterialStack(GTMaterials.Stone, M * 2), new MaterialStack(GTMaterials.Redstone, M))); + ChemicalHelper.registerMaterialInfo(Blocks.DISPENSER, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Stone, M * 2), new MaterialStack(GTMaterials.Redstone, M))); + ChemicalHelper.registerMaterialInfo(Blocks.DROPPER, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Stone, M * 2), new MaterialStack(GTMaterials.Redstone, M))); } - ChemicalHelper.registerMaterialInfo(Items.IRON_HELMET, new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M * 5))); - ChemicalHelper.registerMaterialInfo(Items.IRON_CHESTPLATE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M * 8))); - ChemicalHelper.registerMaterialInfo(Items.IRON_LEGGINGS, new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M * 7))); - ChemicalHelper.registerMaterialInfo(Items.IRON_BOOTS, new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M * 4))); - ChemicalHelper.registerMaterialInfo(Items.IRON_HORSE_ARMOR, new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M * 8))); - ChemicalHelper.registerMaterialInfo(Items.IRON_SHOVEL, new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M), new MaterialStack(GTMaterials.Wood, M / 2))); - ChemicalHelper.registerMaterialInfo(Items.IRON_PICKAXE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M * 3), new MaterialStack(GTMaterials.Wood, M / 2))); - ChemicalHelper.registerMaterialInfo(Items.IRON_AXE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M * 3), new MaterialStack(GTMaterials.Wood, M / 2))); - ChemicalHelper.registerMaterialInfo(Items.IRON_SWORD, new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M * 2), new MaterialStack(GTMaterials.Wood, M / 2))); - ChemicalHelper.registerMaterialInfo(Items.IRON_HOE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M * 2), new MaterialStack(GTMaterials.Wood, M / 2))); - - ChemicalHelper.registerMaterialInfo(Items.GOLDEN_HELMET, new ItemMaterialInfo(new MaterialStack(GTMaterials.Gold, M * 5))); - ChemicalHelper.registerMaterialInfo(Items.GOLDEN_CHESTPLATE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Gold, M * 8))); - ChemicalHelper.registerMaterialInfo(Items.GOLDEN_LEGGINGS, new ItemMaterialInfo(new MaterialStack(GTMaterials.Gold, M * 7))); - ChemicalHelper.registerMaterialInfo(Items.GOLDEN_BOOTS, new ItemMaterialInfo(new MaterialStack(GTMaterials.Gold, M * 4))); - ChemicalHelper.registerMaterialInfo(Items.GOLDEN_HORSE_ARMOR, new ItemMaterialInfo(new MaterialStack(GTMaterials.Gold, M * 8))); - ChemicalHelper.registerMaterialInfo(Items.GOLDEN_SHOVEL, new ItemMaterialInfo(new MaterialStack(GTMaterials.Gold, M), new MaterialStack(GTMaterials.Wood, M / 2))); - ChemicalHelper.registerMaterialInfo(Items.GOLDEN_PICKAXE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Gold, M * 3), new MaterialStack(GTMaterials.Wood, M / 2))); - ChemicalHelper.registerMaterialInfo(Items.GOLDEN_AXE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Gold, M * 3), new MaterialStack(GTMaterials.Wood, M / 2))); - ChemicalHelper.registerMaterialInfo(Items.GOLDEN_SWORD, new ItemMaterialInfo(new MaterialStack(GTMaterials.Gold, M * 2), new MaterialStack(GTMaterials.Wood, M / 2))); - ChemicalHelper.registerMaterialInfo(Items.GOLDEN_HOE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Gold, M * 2), new MaterialStack(GTMaterials.Wood, M / 2))); - - ChemicalHelper.registerMaterialInfo(Items.DIAMOND_HELMET, new ItemMaterialInfo(new MaterialStack(GTMaterials.Diamond, M * 5))); - ChemicalHelper.registerMaterialInfo(Items.DIAMOND_CHESTPLATE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Diamond, M * 8))); - ChemicalHelper.registerMaterialInfo(Items.DIAMOND_LEGGINGS, new ItemMaterialInfo(new MaterialStack(GTMaterials.Diamond, M * 7))); - ChemicalHelper.registerMaterialInfo(Items.DIAMOND_BOOTS, new ItemMaterialInfo(new MaterialStack(GTMaterials.Diamond, M * 4))); - ChemicalHelper.registerMaterialInfo(Items.DIAMOND_HORSE_ARMOR, new ItemMaterialInfo(new MaterialStack(GTMaterials.Diamond, M * 8))); - ChemicalHelper.registerMaterialInfo(Items.DIAMOND_SHOVEL, new ItemMaterialInfo(new MaterialStack(GTMaterials.Diamond, M), new MaterialStack(GTMaterials.Wood, M / 2))); - ChemicalHelper.registerMaterialInfo(Items.DIAMOND_PICKAXE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Diamond, M * 3), new MaterialStack(GTMaterials.Wood, M / 2))); - ChemicalHelper.registerMaterialInfo(Items.DIAMOND_AXE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Diamond, M * 3), new MaterialStack(GTMaterials.Wood, M / 2))); - ChemicalHelper.registerMaterialInfo(Items.DIAMOND_SWORD, new ItemMaterialInfo(new MaterialStack(GTMaterials.Diamond, M * 2), new MaterialStack(GTMaterials.Wood, M / 2))); - ChemicalHelper.registerMaterialInfo(Items.DIAMOND_HOE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Diamond, M * 2), new MaterialStack(GTMaterials.Wood, M / 2))); - - ChemicalHelper.registerMaterialInfo(Items.CHAINMAIL_HELMET, new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M * 5 / 4))); - ChemicalHelper.registerMaterialInfo(Items.CHAINMAIL_CHESTPLATE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M * 2))); - ChemicalHelper.registerMaterialInfo(Items.CHAINMAIL_LEGGINGS, new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M * 7 / 4))); - ChemicalHelper.registerMaterialInfo(Items.CHAINMAIL_BOOTS, new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M))); - - ChemicalHelper.registerMaterialInfo(Items.WOODEN_SHOVEL, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M + M / 2))); - ChemicalHelper.registerMaterialInfo(Items.WOODEN_PICKAXE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 3 + M / 2))); - ChemicalHelper.registerMaterialInfo(Items.WOODEN_AXE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 3 + M / 2))); - ChemicalHelper.registerMaterialInfo(Items.WOODEN_HOE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 2 + M / 2))); - ChemicalHelper.registerMaterialInfo(Items.WOODEN_SWORD, new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 2 + M / 4))); - - ChemicalHelper.registerMaterialInfo(Items.STONE_SHOVEL, new ItemMaterialInfo(new MaterialStack(GTMaterials.Stone, M), new MaterialStack(GTMaterials.Wood, M / 2))); - ChemicalHelper.registerMaterialInfo(Items.STONE_PICKAXE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Stone, M * 3), new MaterialStack(GTMaterials.Wood, M / 2))); - ChemicalHelper.registerMaterialInfo(Items.STONE_AXE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Stone, M * 3), new MaterialStack(GTMaterials.Wood, M / 2))); - ChemicalHelper.registerMaterialInfo(Items.STONE_HOE, new ItemMaterialInfo(new MaterialStack(GTMaterials.Stone, M * 2), new MaterialStack(GTMaterials.Wood, M / 2))); - ChemicalHelper.registerMaterialInfo(Items.STONE_SWORD, new ItemMaterialInfo(new MaterialStack(GTMaterials.Stone, M * 2), new MaterialStack(GTMaterials.Wood, M / 4))); + ChemicalHelper.registerMaterialInfo(Items.IRON_HELMET, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M * 5))); + ChemicalHelper.registerMaterialInfo(Items.IRON_CHESTPLATE, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M * 8))); + ChemicalHelper.registerMaterialInfo(Items.IRON_LEGGINGS, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M * 7))); + ChemicalHelper.registerMaterialInfo(Items.IRON_BOOTS, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M * 4))); + ChemicalHelper.registerMaterialInfo(Items.IRON_HORSE_ARMOR, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M * 8))); + ChemicalHelper.registerMaterialInfo(Items.IRON_SHOVEL, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Iron, M), new MaterialStack(GTMaterials.Wood, M / 2))); + ChemicalHelper.registerMaterialInfo(Items.IRON_PICKAXE, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Iron, M * 3), new MaterialStack(GTMaterials.Wood, M / 2))); + ChemicalHelper.registerMaterialInfo(Items.IRON_AXE, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Iron, M * 3), new MaterialStack(GTMaterials.Wood, M / 2))); + ChemicalHelper.registerMaterialInfo(Items.IRON_SWORD, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Iron, M * 2), new MaterialStack(GTMaterials.Wood, M / 2))); + ChemicalHelper.registerMaterialInfo(Items.IRON_HOE, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Iron, M * 2), new MaterialStack(GTMaterials.Wood, M / 2))); + + ChemicalHelper.registerMaterialInfo(Items.GOLDEN_HELMET, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Gold, M * 5))); + ChemicalHelper.registerMaterialInfo(Items.GOLDEN_CHESTPLATE, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Gold, M * 8))); + ChemicalHelper.registerMaterialInfo(Items.GOLDEN_LEGGINGS, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Gold, M * 7))); + ChemicalHelper.registerMaterialInfo(Items.GOLDEN_BOOTS, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Gold, M * 4))); + ChemicalHelper.registerMaterialInfo(Items.GOLDEN_HORSE_ARMOR, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Gold, M * 8))); + ChemicalHelper.registerMaterialInfo(Items.GOLDEN_SHOVEL, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Gold, M), new MaterialStack(GTMaterials.Wood, M / 2))); + ChemicalHelper.registerMaterialInfo(Items.GOLDEN_PICKAXE, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Gold, M * 3), new MaterialStack(GTMaterials.Wood, M / 2))); + ChemicalHelper.registerMaterialInfo(Items.GOLDEN_AXE, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Gold, M * 3), new MaterialStack(GTMaterials.Wood, M / 2))); + ChemicalHelper.registerMaterialInfo(Items.GOLDEN_SWORD, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Gold, M * 2), new MaterialStack(GTMaterials.Wood, M / 2))); + ChemicalHelper.registerMaterialInfo(Items.GOLDEN_HOE, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Gold, M * 2), new MaterialStack(GTMaterials.Wood, M / 2))); + + ChemicalHelper.registerMaterialInfo(Items.DIAMOND_HELMET, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Diamond, M * 5))); + ChemicalHelper.registerMaterialInfo(Items.DIAMOND_CHESTPLATE, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Diamond, M * 8))); + ChemicalHelper.registerMaterialInfo(Items.DIAMOND_LEGGINGS, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Diamond, M * 7))); + ChemicalHelper.registerMaterialInfo(Items.DIAMOND_BOOTS, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Diamond, M * 4))); + ChemicalHelper.registerMaterialInfo(Items.DIAMOND_HORSE_ARMOR, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Diamond, M * 8))); + ChemicalHelper.registerMaterialInfo(Items.DIAMOND_SHOVEL, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Diamond, M), new MaterialStack(GTMaterials.Wood, M / 2))); + ChemicalHelper.registerMaterialInfo(Items.DIAMOND_PICKAXE, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Diamond, M * 3), new MaterialStack(GTMaterials.Wood, M / 2))); + ChemicalHelper.registerMaterialInfo(Items.DIAMOND_AXE, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Diamond, M * 3), new MaterialStack(GTMaterials.Wood, M / 2))); + ChemicalHelper.registerMaterialInfo(Items.DIAMOND_SWORD, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Diamond, M * 2), new MaterialStack(GTMaterials.Wood, M / 2))); + ChemicalHelper.registerMaterialInfo(Items.DIAMOND_HOE, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Diamond, M * 2), new MaterialStack(GTMaterials.Wood, M / 2))); + + ChemicalHelper.registerMaterialInfo(Items.CHAINMAIL_HELMET, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M * 5 / 4))); + ChemicalHelper.registerMaterialInfo(Items.CHAINMAIL_CHESTPLATE, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M * 2))); + ChemicalHelper.registerMaterialInfo(Items.CHAINMAIL_LEGGINGS, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M * 7 / 4))); + ChemicalHelper.registerMaterialInfo(Items.CHAINMAIL_BOOTS, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Iron, M))); + + ChemicalHelper.registerMaterialInfo(Items.WOODEN_SHOVEL, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M + M / 2))); + ChemicalHelper.registerMaterialInfo(Items.WOODEN_PICKAXE, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 3 + M / 2))); + ChemicalHelper.registerMaterialInfo(Items.WOODEN_AXE, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 3 + M / 2))); + ChemicalHelper.registerMaterialInfo(Items.WOODEN_HOE, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 2 + M / 2))); + ChemicalHelper.registerMaterialInfo(Items.WOODEN_SWORD, + new ItemMaterialInfo(new MaterialStack(GTMaterials.Wood, M * 2 + M / 4))); + + ChemicalHelper.registerMaterialInfo(Items.STONE_SHOVEL, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Stone, M), new MaterialStack(GTMaterials.Wood, M / 2))); + ChemicalHelper.registerMaterialInfo(Items.STONE_PICKAXE, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Stone, M * 3), new MaterialStack(GTMaterials.Wood, M / 2))); + ChemicalHelper.registerMaterialInfo(Items.STONE_AXE, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Stone, M * 3), new MaterialStack(GTMaterials.Wood, M / 2))); + ChemicalHelper.registerMaterialInfo(Items.STONE_HOE, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Stone, M * 2), new MaterialStack(GTMaterials.Wood, M / 2))); + ChemicalHelper.registerMaterialInfo(Items.STONE_SWORD, new ItemMaterialInfo( + new MaterialStack(GTMaterials.Stone, M * 2), new MaterialStack(GTMaterials.Wood, M / 4))); } } diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/RecipeHelper.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/RecipeHelper.java index d957eb3d6e..cfc1794779 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/RecipeHelper.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/RecipeHelper.java @@ -1,13 +1,16 @@ package com.gregtechceu.gtceu.data.recipe; import com.gregtechceu.gtceu.api.recipe.ingredient.FluidIngredient; + import net.minecraft.world.item.ItemStack; + import org.jetbrains.annotations.Nullable; public class RecipeHelper { - public static int getRatioForDistillery(FluidIngredient fluidInput, FluidIngredient fluidOutput, @Nullable ItemStack output) { - int[] divisors = new int[]{2, 5, 10, 25, 50}; + public static int getRatioForDistillery(FluidIngredient fluidInput, FluidIngredient fluidOutput, + @Nullable ItemStack output) { + int[] divisors = new int[] { 2, 5, 10, 25, 50 }; int ratio = -1; for (int divisor : divisors) { @@ -30,5 +33,4 @@ public static int getRatioForDistillery(FluidIngredient fluidInput, FluidIngredi public static boolean isFluidStackDivisibleForDistillery(FluidIngredient fluidStack, int divisor) { return fluidStack.getAmount() % divisor == 0 && fluidStack.getAmount() / divisor >= 25; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/VanillaRecipeHelper.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/VanillaRecipeHelper.java index 84ddab9eca..e08d67aaa8 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/VanillaRecipeHelper.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/VanillaRecipeHelper.java @@ -11,10 +11,7 @@ import com.gregtechceu.gtceu.api.data.tag.TagPrefix; import com.gregtechceu.gtceu.api.item.tool.ToolHelper; import com.gregtechceu.gtceu.data.recipe.builder.*; -import com.tterrag.registrate.util.entry.ItemProviderEntry; -import it.unimi.dsi.fastutil.chars.*; -import it.unimi.dsi.fastutil.objects.Object2LongMap; -import it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap; + import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.TagKey; @@ -22,12 +19,15 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.level.ItemLike; + +import com.tterrag.registrate.util.entry.ItemProviderEntry; +import it.unimi.dsi.fastutil.chars.*; +import it.unimi.dsi.fastutil.objects.Object2LongMap; +import it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.jetbrains.annotations.NotNull; import java.util.Comparator; -import java.util.Locale; import java.util.function.Consumer; import java.util.stream.Collectors; @@ -38,87 +38,114 @@ */ public class VanillaRecipeHelper { - public static void addSmeltingRecipe(Consumer provider, @NotNull String regName, TagKey input, ItemStack output) { + public static void addSmeltingRecipe(Consumer provider, @NotNull String regName, TagKey input, + ItemStack output) { addSmeltingRecipe(provider, GTCEu.id(regName), input, output); } - public static void addSmeltingRecipe(Consumer provider, @NotNull ResourceLocation regName, TagKey input, ItemStack output) { + public static void addSmeltingRecipe(Consumer provider, @NotNull ResourceLocation regName, + TagKey input, ItemStack output) { addSmeltingRecipe(provider, regName, input, output, 0.0f); } - public static void addSmeltingRecipe(Consumer provider, @NotNull String regName, TagKey input, ItemStack output, float experience) { + public static void addSmeltingRecipe(Consumer provider, @NotNull String regName, TagKey input, + ItemStack output, float experience) { addSmeltingRecipe(provider, GTCEu.id(regName), input, output, experience); } - public static void addSmeltingRecipe(Consumer provider, @NotNull String regName, Ingredient input, ItemStack output, float experience) { + public static void addSmeltingRecipe(Consumer provider, @NotNull String regName, Ingredient input, + ItemStack output, float experience) { addSmeltingRecipe(provider, GTCEu.id(regName), input, output, experience); } - public static void addSmeltingRecipe(Consumer provider, @NotNull ResourceLocation regName, Ingredient input, ItemStack output, float experience) { - new SmeltingRecipeBuilder(regName).input(input).output(output).cookingTime(200).experience(experience).save(provider); + public static void addSmeltingRecipe(Consumer provider, @NotNull ResourceLocation regName, + Ingredient input, ItemStack output, float experience) { + new SmeltingRecipeBuilder(regName).input(input).output(output).cookingTime(200).experience(experience) + .save(provider); } - public static void addSmeltingRecipe(Consumer provider, @NotNull ResourceLocation regName, TagKey input, ItemStack output, float experience) { - new SmeltingRecipeBuilder(regName).input(input).output(output).cookingTime(200).experience(experience).save(provider); + public static void addSmeltingRecipe(Consumer provider, @NotNull ResourceLocation regName, + TagKey input, ItemStack output, float experience) { + new SmeltingRecipeBuilder(regName).input(input).output(output).cookingTime(200).experience(experience) + .save(provider); } - public static void addBlastingRecipe(Consumer provider, @NotNull String regName, TagKey input, ItemStack output, float experience) { + public static void addBlastingRecipe(Consumer provider, @NotNull String regName, TagKey input, + ItemStack output, float experience) { addBlastingRecipe(provider, GTCEu.id(regName), input, output, experience); } - public static void addBlastingRecipe(Consumer provider, @NotNull String regName, Ingredient input, ItemStack output, float experience) { + public static void addBlastingRecipe(Consumer provider, @NotNull String regName, Ingredient input, + ItemStack output, float experience) { addBlastingRecipe(provider, GTCEu.id(regName), input, output, experience); } - public static void addBlastingRecipe(Consumer provider, @NotNull ResourceLocation regName, Ingredient input, ItemStack output, float experience) { - new BlastingRecipeBuilder(regName).input(input).output(output).cookingTime(100).experience(experience).save(provider); + public static void addBlastingRecipe(Consumer provider, @NotNull ResourceLocation regName, + Ingredient input, ItemStack output, float experience) { + new BlastingRecipeBuilder(regName).input(input).output(output).cookingTime(100).experience(experience) + .save(provider); } - public static void addBlastingRecipe(Consumer provider, @NotNull ResourceLocation regName, TagKey input, ItemStack output, float experience) { - new BlastingRecipeBuilder(regName).input(input).output(output).cookingTime(100).experience(experience).save(provider); + public static void addBlastingRecipe(Consumer provider, @NotNull ResourceLocation regName, + TagKey input, ItemStack output, float experience) { + new BlastingRecipeBuilder(regName).input(input).output(output).cookingTime(100).experience(experience) + .save(provider); } - public static void addSmokingRecipe(Consumer provider, @NotNull String regName, TagKey input, ItemStack output, float experience) { + public static void addSmokingRecipe(Consumer provider, @NotNull String regName, TagKey input, + ItemStack output, float experience) { addSmokingRecipe(provider, GTCEu.id(regName), input, output, experience); } - public static void addSmokingRecipe(Consumer provider, @NotNull ResourceLocation regName, TagKey input, ItemStack output, float experience) { - new SmokingRecipeBuilder(regName).input(input).output(output).cookingTime(100).experience(experience).save(provider); + public static void addSmokingRecipe(Consumer provider, @NotNull ResourceLocation regName, + TagKey input, ItemStack output, float experience) { + new SmokingRecipeBuilder(regName).input(input).output(output).cookingTime(100).experience(experience) + .save(provider); } - public static void addSmeltingRecipe(Consumer provider, @NotNull String regName, ItemStack input, ItemStack output) { + public static void addSmeltingRecipe(Consumer provider, @NotNull String regName, ItemStack input, + ItemStack output) { addSmeltingRecipe(provider, GTCEu.id(regName), input, output, 0.0f); } - public static void addSmeltingRecipe(Consumer provider, @NotNull String regName, ItemStack input, ItemStack output, float experience) { + public static void addSmeltingRecipe(Consumer provider, @NotNull String regName, ItemStack input, + ItemStack output, float experience) { addSmeltingRecipe(provider, GTCEu.id(regName), input, output, experience); } - public static void addSmeltingRecipe(Consumer provider, @NotNull ResourceLocation regName, ItemStack input, ItemStack output, float experience) { - new SmeltingRecipeBuilder(regName).input(input).output(output).cookingTime(200).experience(experience).save(provider); + public static void addSmeltingRecipe(Consumer provider, @NotNull ResourceLocation regName, + ItemStack input, ItemStack output, float experience) { + new SmeltingRecipeBuilder(regName).input(input).output(output).cookingTime(200).experience(experience) + .save(provider); } + /** * Adds a shaped recipe which clears the nbt of the outputs * * @see VanillaRecipeHelper#addShapedRecipe(Consumer, String, ItemStack, Object...) */ - public static void addShapedNBTClearingRecipe(Consumer provider, String regName, ItemStack result, Object... recipe) { + public static void addShapedNBTClearingRecipe(Consumer provider, String regName, ItemStack result, + Object... recipe) { addStrictShapedRecipe(provider, regName, result, recipe); } - public static void addShapedRecipe(Consumer provider, @NotNull String regName, @NotNull ItemStack result, @NotNull Object... recipe) { + public static void addShapedRecipe(Consumer provider, @NotNull String regName, + @NotNull ItemStack result, @NotNull Object... recipe) { addShapedRecipe(provider, GTCEu.id(regName), result, recipe); } - public static void addShapedRecipe(Consumer provider, @NotNull ResourceLocation regName, @NotNull ItemStack result, @NotNull Object... recipe) { + public static void addShapedRecipe(Consumer provider, @NotNull ResourceLocation regName, + @NotNull ItemStack result, @NotNull Object... recipe) { addShapedRecipe(provider, false, regName, result, recipe); } - public static void addStrictShapedRecipe(Consumer provider, @NotNull String regName, @NotNull ItemStack result, @NotNull Object... recipe) { + public static void addStrictShapedRecipe(Consumer provider, @NotNull String regName, + @NotNull ItemStack result, @NotNull Object... recipe) { addStrictShapedRecipe(provider, GTCEu.id(regName), result, recipe); } - public static void addStrictShapedRecipe(Consumer provider, @NotNull ResourceLocation regName, @NotNull ItemStack result, @NotNull Object... recipe) { + public static void addStrictShapedRecipe(Consumer provider, @NotNull ResourceLocation regName, + @NotNull ItemStack result, @NotNull Object... recipe) { addStrictShapedRecipe(provider, false, regName, result, recipe); } @@ -131,23 +158,25 @@ public static void addStrictShapedRecipe(Consumer provider, @Not *

* Base tool names are as follows: *

    - *
  • {@code 'c'} - {@code craftingToolCrowbar}
  • - *
  • {@code 'd'} - {@code craftingToolScrewdriver}
  • - *
  • {@code 'f'} - {@code craftingToolFile}
  • - *
  • {@code 'h'} - {@code craftingToolHardHammer}
  • - *
  • {@code 'k'} - {@code craftingToolKnife}
  • - *
  • {@code 'm'} - {@code craftingToolMortar}
  • - *
  • {@code 'r'} - {@code craftingToolSoftHammer}
  • - *
  • {@code 's'} - {@code craftingToolSaw}
  • - *
  • {@code 'w'} - {@code craftingToolWrench}
  • - *
  • {@code 'x'} - {@code craftingToolWireCutter}
  • + *
  • {@code 'c'} - {@code craftingToolCrowbar}
  • + *
  • {@code 'd'} - {@code craftingToolScrewdriver}
  • + *
  • {@code 'f'} - {@code craftingToolFile}
  • + *
  • {@code 'h'} - {@code craftingToolHardHammer}
  • + *
  • {@code 'k'} - {@code craftingToolKnife}
  • + *
  • {@code 'm'} - {@code craftingToolMortar}
  • + *
  • {@code 'r'} - {@code craftingToolSoftHammer}
  • + *
  • {@code 's'} - {@code craftingToolSaw}
  • + *
  • {@code 'w'} - {@code craftingToolWrench}
  • + *
  • {@code 'x'} - {@code craftingToolWireCutter}
  • *
* * @param regName the registry name for the recipe * @param result the output for the recipe * @param recipe the contents of the recipe */ - public static void addShapedRecipe(Consumer provider, boolean withUnificationData, boolean isStrict, @NotNull ResourceLocation regName, @NotNull ItemStack result, @NotNull Object... recipe) { + public static void addShapedRecipe(Consumer provider, boolean withUnificationData, boolean isStrict, + @NotNull ResourceLocation regName, @NotNull ItemStack result, + @NotNull Object... recipe) { var builder = new ShapedRecipeBuilder(regName).output(result); builder.isStrict(isStrict); CharSet set = new CharOpenHashSet(); @@ -206,24 +235,33 @@ public static void addShapedRecipe(Consumer provider, boolean wi } } - - public static void addShapedRecipe(Consumer provider, boolean withUnificationData, @NotNull String regName, @NotNull ItemStack result, @NotNull Object... recipe) { + public static void addShapedRecipe(Consumer provider, boolean withUnificationData, + @NotNull String regName, @NotNull ItemStack result, @NotNull Object... recipe) { addShapedRecipe(provider, withUnificationData, GTCEu.id(regName), result, recipe); } - public static void addShapedRecipe(Consumer provider, boolean withUnificationData, @NotNull ResourceLocation regName, @NotNull ItemStack result, @NotNull Object... recipe) { + public static void addShapedRecipe(Consumer provider, boolean withUnificationData, + @NotNull ResourceLocation regName, @NotNull ItemStack result, + @NotNull Object... recipe) { addShapedRecipe(provider, withUnificationData, false, regName, result, recipe); } - public static void addStrictShapedRecipe(Consumer provider, boolean withUnificationData, @NotNull ResourceLocation regName, @NotNull ItemStack result, @NotNull Object... recipe) { + public static void addStrictShapedRecipe(Consumer provider, boolean withUnificationData, + @NotNull ResourceLocation regName, @NotNull ItemStack result, + @NotNull Object... recipe) { addShapedRecipe(provider, withUnificationData, true, regName, result, recipe); } - public static void addShapelessRecipe(Consumer provider, @NotNull String regName, @NotNull ItemStack result, @NotNull Object... recipe) { + public static void addShapelessRecipe(Consumer provider, @NotNull String regName, + @NotNull ItemStack result, @NotNull Object... recipe) { addShapelessRecipe(provider, GTCEu.id(regName), result, recipe); } - public static void addShapedEnergyTransferRecipe(Consumer provider, boolean withUnificationData, boolean overrideCharge, boolean transferMaxCharge, @NotNull ResourceLocation regName, @NotNull Ingredient chargeIngredient, @NotNull ItemStack result, @NotNull Object... recipe) { + public static void addShapedEnergyTransferRecipe(Consumer provider, boolean withUnificationData, + boolean overrideCharge, boolean transferMaxCharge, + @NotNull ResourceLocation regName, + @NotNull Ingredient chargeIngredient, @NotNull ItemStack result, + @NotNull Object... recipe) { var builder = new ShapedEnergyTransferRecipeBuilder(regName).output(result); builder.chargeIngredient(chargeIngredient).overrideCharge(overrideCharge).transferMaxCharge(transferMaxCharge); CharSet set = new CharOpenHashSet(); @@ -278,8 +316,12 @@ public static void addShapedEnergyTransferRecipe(Consumer provid } } - public static void addShapedEnergyTransferRecipe(Consumer provider, boolean withUnificationData, boolean overrideCharge, boolean transferMaxCharge, @NotNull String regName, @NotNull Ingredient chargeIngredient, @NotNull ItemStack result, @NotNull Object... recipe) { - addShapedEnergyTransferRecipe(provider, withUnificationData, overrideCharge, transferMaxCharge, GTCEu.id(regName), chargeIngredient, result, recipe); + public static void addShapedEnergyTransferRecipe(Consumer provider, boolean withUnificationData, + boolean overrideCharge, boolean transferMaxCharge, + @NotNull String regName, @NotNull Ingredient chargeIngredient, + @NotNull ItemStack result, @NotNull Object... recipe) { + addShapedEnergyTransferRecipe(provider, withUnificationData, overrideCharge, transferMaxCharge, + GTCEu.id(regName), chargeIngredient, result, recipe); } /** @@ -287,12 +329,14 @@ public static void addShapedEnergyTransferRecipe(Consumer provid * * @see VanillaRecipeHelper#addShapelessRecipe(Consumer, String, ItemStack, Object...) */ - public static void addShapelessNBTClearingRecipe(Consumer provider, @NotNull String regName, @NotNull ItemStack result, + public static void addShapelessNBTClearingRecipe(Consumer provider, @NotNull String regName, + @NotNull ItemStack result, @NotNull Object... recipe) { addShapelessRecipe(provider, regName, result, recipe); } - public static void addShapelessRecipe(Consumer provider, @NotNull ResourceLocation regName, @NotNull ItemStack result, @NotNull Object... recipe) { + public static void addShapelessRecipe(Consumer provider, @NotNull ResourceLocation regName, + @NotNull ItemStack result, @NotNull Object... recipe) { var builder = new ShapelessRecipeBuilder(regName).output(result); for (Object content : recipe) { if (content instanceof Ingredient ingredient) { @@ -325,7 +369,6 @@ public static boolean isMaterialWood(@Nullable Material material) { return material != null && material.hasProperty(PropertyKey.WOOD); } - public static ItemMaterialInfo getRecyclingIngredients(int outputCount, @NotNull Object... recipe) { Char2IntOpenHashMap inputCountMap = new Char2IntOpenHashMap(); Object2LongMap materialStacksExploded = new Object2LongOpenHashMap<>(); @@ -376,7 +419,6 @@ public static ItemMaterialInfo getRecyclingIngredients(int outputCount, @NotNull itemLike = entry.asItem(); } else continue; // throw out bad entries - // First try to get ItemMaterialInfo ItemMaterialInfo info = ChemicalHelper.getMaterialInfo(itemLike); if (info != null) { @@ -406,8 +448,7 @@ public static ItemMaterialInfo getRecyclingIngredients(int outputCount, @NotNull return new ItemMaterialInfo(materialStacksExploded.entrySet().stream() .map(e -> new MaterialStack(e.getKey(), e.getValue() / outputCount)) .sorted(Comparator.comparingLong(m -> -m.amount())) - .collect(Collectors.toList()) - ); + .collect(Collectors.toList())); } private static void addMaterialStack(@NotNull Object2LongMap materialStacksExploded, diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/WoodTypeEntry.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/WoodTypeEntry.java index 2797c4190b..e40d2caa66 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/WoodTypeEntry.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/WoodTypeEntry.java @@ -1,13 +1,15 @@ package com.gregtechceu.gtceu.data.recipe; -import com.google.common.base.Preconditions; import com.gregtechceu.gtceu.api.data.chemical.ChemicalHelper; import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.api.data.tag.TagPrefix; import com.gregtechceu.gtceu.common.data.GTMaterials; + import net.minecraft.tags.TagKey; import net.minecraft.world.item.Item; import net.minecraftforge.common.Tags; + +import com.google.common.base.Preconditions; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -102,7 +104,8 @@ private WoodTypeEntry(@NotNull String modid, @NotNull String woodName, @Nullable Item stairs, @Nullable String stairsRecipeName, boolean addStairsCraftingRecipe, @Nullable Item boat, @Nullable String boatRecipeName, @Nullable Material material, - boolean addLogOreDict, boolean addPlanksOreDict, boolean addDoorsOreDict, boolean addSlabsOreDict, + boolean addLogOreDict, boolean addPlanksOreDict, boolean addDoorsOreDict, + boolean addSlabsOreDict, boolean addFencesOreDict, boolean addFenceGatesOreDict, boolean addStairsOreDict, boolean addPlanksUnificationInfo, boolean addDoorsUnificationInfo, boolean addSlabsUnificationInfo, boolean addFencesUnificationInfo, @@ -157,7 +160,7 @@ public TagKey getStick() { if (this.material == GTMaterials.Wood) { return Tags.Items.RODS_WOODEN; } else { - //noinspection DataFlowIssue is valid. + // noinspection DataFlowIssue is valid. return ChemicalHelper.getTag(TagPrefix.rod, this.material); } } @@ -492,19 +495,19 @@ public Builder registerUnificationInfo(boolean planks, boolean door, boolean sla public WoodTypeEntry build() { Preconditions.checkArgument(planks != null, "Planks cannot be empty."); return new WoodTypeEntry(modid, woodName, log, strippedLog, wood, strippedWood, - removeCharcoalRecipe, addCharcoalRecipe, - planks, planksRecipeName, - door, doorRecipeName, - trapdoor, trapdoorRecipeName, - slab, slabRecipeName, addSlabsCraftingRecipe, - fence, fenceRecipeName, fenceGate, fenceGateRecipeName, - stairs, stairsRecipeName, addStairsCraftingRecipe, - boat, boatRecipeName, - material, - addLogOreDict, addPlanksOreDict, addDoorsOreDict, addSlabsOreDict, - addFencesOreDict, addFenceGatesOreDict, addStairsOreDict, addPlanksUnificationInfo, - addDoorsUnificationInfo, addSlabsUnificationInfo, addFencesUnificationInfo, - addFenceGatesUnificationInfo, addStairsUnificationInfo, addBoatsUnificationInfo); + removeCharcoalRecipe, addCharcoalRecipe, + planks, planksRecipeName, + door, doorRecipeName, + trapdoor, trapdoorRecipeName, + slab, slabRecipeName, addSlabsCraftingRecipe, + fence, fenceRecipeName, fenceGate, fenceGateRecipeName, + stairs, stairsRecipeName, addStairsCraftingRecipe, + boat, boatRecipeName, + material, + addLogOreDict, addPlanksOreDict, addDoorsOreDict, addSlabsOreDict, + addFencesOreDict, addFenceGatesOreDict, addStairsOreDict, addPlanksUnificationInfo, + addDoorsUnificationInfo, addSlabsUnificationInfo, addFencesUnificationInfo, + addFenceGatesUnificationInfo, addStairsUnificationInfo, addBoatsUnificationInfo); } } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/BlastingRecipeBuilder.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/BlastingRecipeBuilder.java index af4932daa1..fc9bf7c98e 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/BlastingRecipeBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/BlastingRecipeBuilder.java @@ -1,11 +1,10 @@ package com.gregtechceu.gtceu.data.recipe.builder; -import com.google.gson.JsonObject; import com.gregtechceu.gtceu.api.recipe.ingredient.NBTIngredient; + import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.utils.NBTToJsonConverter; -import lombok.Setter; -import lombok.experimental.Accessors; + import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.nbt.CompoundTag; @@ -16,6 +15,10 @@ import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraft.world.level.ItemLike; + +import com.google.gson.JsonObject; +import lombok.Setter; +import lombok.experimental.Accessors; import org.jetbrains.annotations.Nullable; import java.util.function.Consumer; @@ -27,6 +30,7 @@ */ @Accessors(chain = true, fluent = true) public class BlastingRecipeBuilder { + private Ingredient input; @Setter protected String group; @@ -48,9 +52,9 @@ public BlastingRecipeBuilder input(TagKey itemStack) { } public BlastingRecipeBuilder input(ItemStack itemStack) { - if (itemStack.hasTag() || itemStack.getDamageValue() >0) { + if (itemStack.hasTag() || itemStack.getDamageValue() > 0) { input = NBTIngredient.createNBTIngredient(itemStack); - }else { + } else { input = Ingredient.of(itemStack); } return this; @@ -117,6 +121,7 @@ public void toJson(JsonObject json) { public void save(Consumer consumer) { consumer.accept(new FinishedRecipe() { + @Override public void serializeRecipeData(JsonObject pJson) { toJson(pJson); diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/GTRecipeBuilder.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/GTRecipeBuilder.java index e8f29f2770..c3fb2014ff 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/GTRecipeBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/GTRecipeBuilder.java @@ -1,33 +1,30 @@ package com.gregtechceu.gtceu.data.recipe.builder; -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.capability.recipe.*; import com.gregtechceu.gtceu.api.data.chemical.ChemicalHelper; +import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.api.data.chemical.material.stack.UnificationEntry; +import com.gregtechceu.gtceu.api.data.tag.TagPrefix; import com.gregtechceu.gtceu.api.data.tag.TagUtil; import com.gregtechceu.gtceu.api.item.component.IDataItem; import com.gregtechceu.gtceu.api.machine.MachineDefinition; import com.gregtechceu.gtceu.api.machine.multiblock.CleanroomType; import com.gregtechceu.gtceu.api.recipe.*; +import com.gregtechceu.gtceu.api.recipe.content.Content; import com.gregtechceu.gtceu.api.recipe.ingredient.FluidIngredient; import com.gregtechceu.gtceu.api.recipe.ingredient.IntCircuitIngredient; -import com.gregtechceu.gtceu.common.data.GTRecipeTypes; -import com.gregtechceu.gtceu.common.recipe.*; -import com.gregtechceu.gtceu.api.data.chemical.material.Material; -import com.gregtechceu.gtceu.api.recipe.content.Content; import com.gregtechceu.gtceu.api.recipe.ingredient.SizedIngredient; import com.gregtechceu.gtceu.api.registry.GTRegistries; -import com.gregtechceu.gtceu.api.data.tag.TagPrefix; +import com.gregtechceu.gtceu.common.data.GTRecipeTypes; +import com.gregtechceu.gtceu.common.recipe.*; import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.utils.ResearchManager; + import com.lowdragmc.lowdraglib.Platform; import com.lowdragmc.lowdraglib.side.fluid.FluidStack; import com.lowdragmc.lowdraglib.utils.NBTToJsonConverter; -import lombok.Getter; -import lombok.Setter; -import lombok.experimental.Accessors; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.data.recipes.FinishedRecipe; @@ -42,16 +39,23 @@ import net.minecraft.world.level.ItemLike; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.material.Fluids; -import org.jetbrains.annotations.Nullable; +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import lombok.Getter; +import lombok.Setter; +import lombok.experimental.Accessors; import org.jetbrains.annotations.NotNull; -import javax.annotation.ParametersAreNonnullByDefault; +import org.jetbrains.annotations.Nullable; + import java.util.*; import java.util.function.BiConsumer; import java.util.function.Consumer; import java.util.function.Supplier; import java.util.function.UnaryOperator; +import javax.annotation.ParametersAreNonnullByDefault; + @SuppressWarnings("unchecked") @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault @@ -244,7 +248,8 @@ public GTRecipeBuilder inputItems(ItemStack... inputs) { throw new IllegalArgumentException(id + ": input items is empty"); } } - return input(ItemRecipeCapability.CAP, Arrays.stream(inputs).map(SizedIngredient::create).toArray(Ingredient[]::new)); + return input(ItemRecipeCapability.CAP, + Arrays.stream(inputs).map(SizedIngredient::create).toArray(Ingredient[]::new)); } public GTRecipeBuilder inputItems(TagKey tag, int amount) { @@ -327,7 +332,8 @@ public GTRecipeBuilder outputItems(ItemStack... outputs) { throw new IllegalArgumentException(id + ": output items is empty"); } } - return output(ItemRecipeCapability.CAP, Arrays.stream(outputs).map(SizedIngredient::create).toArray(Ingredient[]::new)); + return output(ItemRecipeCapability.CAP, + Arrays.stream(outputs).map(SizedIngredient::create).toArray(Ingredient[]::new)); } public GTRecipeBuilder outputItems(Item input, int amount) { @@ -393,7 +399,7 @@ public GTRecipeBuilder notConsumable(Supplier item) { this.chance = lastChance; return this; } - + public GTRecipeBuilder notConsumable(TagPrefix orePrefix, Material material) { float lastChance = this.chance; this.chance = 0; @@ -472,15 +478,20 @@ public GTRecipeBuilder chancedOutput(TagPrefix tag, Material mat, int count, int } public GTRecipeBuilder inputFluids(FluidStack input) { - return input(FluidRecipeCapability.CAP, FluidIngredient.of(TagUtil.createFluidTag(BuiltInRegistries.FLUID.getKey(input.getFluid()).getPath()), input.getAmount())); + return input(FluidRecipeCapability.CAP, FluidIngredient.of( + TagUtil.createFluidTag(BuiltInRegistries.FLUID.getKey(input.getFluid()).getPath()), input.getAmount())); } public GTRecipeBuilder inputFluids(FluidStack... inputs) { return input(FluidRecipeCapability.CAP, Arrays.stream(inputs).map(fluid -> { - if (!Platform.isForge() && fluid.getFluid() == Fluids.WATER) { // Special case for fabric, because there all fluids have to be tagged as water to function as water when placed. + if (!Platform.isForge() && fluid.getFluid() == Fluids.WATER) { // Special case for fabric, because there all + // fluids have to be tagged as water to + // function as water when placed. return FluidIngredient.of(fluid); } else { - return FluidIngredient.of(TagUtil.createFluidTag(BuiltInRegistries.FLUID.getKey(fluid.getFluid()).getPath()), fluid.getAmount()); + return FluidIngredient.of( + TagUtil.createFluidTag(BuiltInRegistries.FLUID.getKey(fluid.getFluid()).getPath()), + fluid.getAmount()); } }).toArray(FluidIngredient[]::new)); } @@ -494,7 +505,8 @@ public GTRecipeBuilder outputFluids(FluidStack output) { } public GTRecipeBuilder outputFluids(FluidStack... outputs) { - return output(FluidRecipeCapability.CAP, Arrays.stream(outputs).map(FluidIngredient::of).toArray(FluidIngredient[]::new)); + return output(FluidRecipeCapability.CAP, + Arrays.stream(outputs).map(FluidIngredient::of).toArray(FluidIngredient[]::new)); } public GTRecipeBuilder outputFluids(FluidIngredient... outputs) { @@ -510,7 +522,7 @@ public GTRecipeBuilder outputStress(float stress) { } ////////////////////////////////////// - //********** DATA ***********// + // ********** DATA ***********// ////////////////////////////////////// public GTRecipeBuilder addData(String key, Tag data) { this.data.put(key, data); @@ -579,7 +591,7 @@ public GTRecipeBuilder hideDuration(boolean hideDuration) { } ////////////////////////////////////// - //******* CONDITIONS ********// + // ******* CONDITIONS ********// ////////////////////////////////////// public GTRecipeBuilder cleanroom(CleanroomType cleanroomType) { @@ -642,11 +654,13 @@ private boolean applyResearchProperty(ResearchData.ResearchEntry researchEntry) } if (!generatingRecipes) { - GTCEu.LOGGER.error("Cannot generate recipes when using researchWithoutRecipe()", new IllegalArgumentException()); + GTCEu.LOGGER.error("Cannot generate recipes when using researchWithoutRecipe()", + new IllegalArgumentException()); return false; } - ResearchCondition condition = this.conditions.stream().filter(ResearchCondition.class::isInstance).findAny().map(ResearchCondition.class::cast).orElse(null); + ResearchCondition condition = this.conditions.stream().filter(ResearchCondition.class::isInstance).findAny() + .map(ResearchCondition.class::cast).orElse(null); if (condition != null) { condition.data.add(researchEntry); } else { @@ -671,7 +685,7 @@ public GTRecipeBuilder researchWithoutRecipe(@NotNull String researchId) { * Does not generate a research recipe. * * @param researchId the researchId for the recipe - * @param dataStack the stack to hold the data. Must have the {@link IDataItem} behavior. + * @param dataStack the stack to hold the data. Must have the {@link IDataItem} behavior. * @return this */ public GTRecipeBuilder researchWithoutRecipe(@NotNull String researchId, @NotNull ItemStack dataStack) { @@ -751,6 +765,7 @@ public JsonObject capabilitiesToJson(Map, List> con public FinishedRecipe build() { return new FinishedRecipe() { + @Override public void serializeRecipeData(JsonObject pJson) { toJson(pJson); @@ -784,7 +799,8 @@ public void save(Consumer consumer) { if (onSave != null) { onSave.accept(this, consumer); } - ResearchCondition condition = this.conditions.stream().filter(ResearchCondition.class::isInstance).findAny().map(ResearchCondition.class::cast).orElse(null); + ResearchCondition condition = this.conditions.stream().filter(ResearchCondition.class::isInstance).findAny() + .map(ResearchCondition.class::cast).orElse(null); if (condition != null) { for (ResearchData.ResearchEntry entry : condition.data) { this.recipeType.addDataStickEntry(entry.getResearchId(), buildRawRecipe()); @@ -794,11 +810,12 @@ public void save(Consumer consumer) { } public GTRecipe buildRawRecipe() { - return new GTRecipe(recipeType, id.withPrefix(recipeType.registryName.getPath() + "/"), input, output, tickInput, tickOutput, conditions, List.of(), data, duration, isFuel); + return new GTRecipe(recipeType, id.withPrefix(recipeType.registryName.getPath() + "/"), input, output, + tickInput, tickOutput, conditions, List.of(), data, duration, isFuel); } ////////////////////////////////////// - //******* Quick Query *******// + // ******* Quick Query *******// ////////////////////////////////////// public long EUt() { if (!tickInput.containsKey(EURecipeCapability.CAP)) return 0; @@ -815,6 +832,7 @@ public int getSolderMultiplier() { /** * An entry for an autogenerated research recipe for producing a data item containing research data. + * * @param researchId the id of the research to store * @param researchStack the stack to scan for research * @param dataStack the stack to contain the data @@ -823,12 +841,10 @@ public int getSolderMultiplier() { * @param CWUt how much computation per tick this recipe needs if in Research Station */ public record ResearchRecipeEntry( - @NotNull String researchId, - @NotNull ItemStack researchStack, - @NotNull ItemStack dataStack, - int duration, - int EUt, - int CWUt) { - } - + @NotNull String researchId, + @NotNull ItemStack researchStack, + @NotNull ItemStack dataStack, + int duration, + int EUt, + int CWUt) {} } diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/ShapedEnergyTransferRecipeBuilder.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/ShapedEnergyTransferRecipeBuilder.java index f28c20dd68..55bebdd230 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/ShapedEnergyTransferRecipeBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/ShapedEnergyTransferRecipeBuilder.java @@ -1,12 +1,12 @@ package com.gregtechceu.gtceu.data.recipe.builder; -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.recipe.ShapedEnergyTransferRecipe; import com.gregtechceu.gtceu.api.recipe.ingredient.NBTIngredient; + import com.lowdragmc.lowdraglib.utils.Builder; import com.lowdragmc.lowdraglib.utils.NBTToJsonConverter; + import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.nbt.CompoundTag; @@ -17,17 +17,20 @@ import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraft.world.level.ItemLike; + +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; import org.jetbrains.annotations.Nullable; import java.util.function.Consumer; - /** * @author Irgendwer01 * @date 2023/11/4 * @implNote ShapedEnergyTransferRecipeBuilder */ public class ShapedEnergyTransferRecipeBuilder extends Builder { + protected ItemStack output = ItemStack.EMPTY; protected Ingredient chargeIngredient = Ingredient.EMPTY; protected ResourceLocation id; @@ -52,9 +55,9 @@ public ShapedEnergyTransferRecipeBuilder define(char cha, TagKey itemStack } public ShapedEnergyTransferRecipeBuilder define(char cha, ItemStack itemStack) { - if (itemStack.hasTag() || itemStack.getDamageValue() >0) { + if (itemStack.hasTag() || itemStack.getDamageValue() > 0) { return where(cha, NBTIngredient.createNBTIngredient(itemStack)); - }else { + } else { return where(cha, Ingredient.of(itemStack)); } } @@ -173,6 +176,7 @@ protected ResourceLocation defaultId() { public void save(Consumer consumer) { consumer.accept(new FinishedRecipe() { + @Override public void serializeRecipeData(JsonObject pJson) { toJson(pJson); diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/ShapedRecipeBuilder.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/ShapedRecipeBuilder.java index 5b8c650280..2c08e5c57a 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/ShapedRecipeBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/ShapedRecipeBuilder.java @@ -1,13 +1,12 @@ package com.gregtechceu.gtceu.data.recipe.builder; -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.recipe.StrictShapedRecipe; import com.gregtechceu.gtceu.api.recipe.ingredient.NBTIngredient; -import com.lowdragmc.lowdraglib.LDLib; + import com.lowdragmc.lowdraglib.utils.Builder; import com.lowdragmc.lowdraglib.utils.NBTToJsonConverter; + import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.nbt.CompoundTag; @@ -18,6 +17,9 @@ import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraft.world.level.ItemLike; + +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; import org.jetbrains.annotations.Nullable; import java.util.function.Consumer; @@ -28,6 +30,7 @@ * @implNote ShapedRecipeBuilder */ public class ShapedRecipeBuilder extends Builder { + protected ItemStack output = ItemStack.EMPTY; protected ResourceLocation id; protected String group; @@ -50,9 +53,9 @@ public ShapedRecipeBuilder define(char cha, TagKey itemStack) { } public ShapedRecipeBuilder define(char cha, ItemStack itemStack) { - if (itemStack.hasTag() || itemStack.getDamageValue() >0) { + if (itemStack.hasTag() || itemStack.getDamageValue() > 0) { return where(cha, NBTIngredient.createNBTIngredient(itemStack)); - }else { + } else { return where(cha, Ingredient.of(itemStack)); } } @@ -153,6 +156,7 @@ protected ResourceLocation defaultId() { public void save(Consumer consumer) { consumer.accept(new FinishedRecipe() { + @Override public void serializeRecipeData(JsonObject pJson) { toJson(pJson); diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/ShapelessRecipeBuilder.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/ShapelessRecipeBuilder.java index fca57bdb63..a5d89f33a2 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/ShapelessRecipeBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/ShapelessRecipeBuilder.java @@ -1,12 +1,10 @@ package com.gregtechceu.gtceu.data.recipe.builder; -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; import com.gregtechceu.gtceu.api.recipe.ingredient.NBTIngredient; + import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.utils.NBTToJsonConverter; -import lombok.Setter; -import lombok.experimental.Accessors; + import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.nbt.CompoundTag; @@ -17,6 +15,11 @@ import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraft.world.level.ItemLike; + +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import lombok.Setter; +import lombok.experimental.Accessors; import org.jetbrains.annotations.Nullable; import java.util.ArrayList; @@ -30,6 +33,7 @@ */ @Accessors(chain = true, fluent = true) public class ShapelessRecipeBuilder { + private List ingredients = new ArrayList<>(); @Setter protected String group; @@ -51,9 +55,9 @@ public ShapelessRecipeBuilder requires(TagKey itemStack) { } public ShapelessRecipeBuilder requires(ItemStack itemStack) { - if (itemStack.hasTag() || itemStack.getDamageValue() >0) { + if (itemStack.hasTag() || itemStack.getDamageValue() > 0) { requires(NBTIngredient.createNBTIngredient(itemStack)); - }else { + } else { requires(Ingredient.of(itemStack)); } return this; @@ -115,11 +119,11 @@ public void toJson(JsonObject json) { } json.add("result", result); } - } public void save(Consumer consumer) { consumer.accept(new FinishedRecipe() { + @Override public void serializeRecipeData(JsonObject pJson) { toJson(pJson); diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/SmeltingRecipeBuilder.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/SmeltingRecipeBuilder.java index 1e1bc2674b..1206bfa24f 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/SmeltingRecipeBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/SmeltingRecipeBuilder.java @@ -1,11 +1,10 @@ package com.gregtechceu.gtceu.data.recipe.builder; -import com.google.gson.JsonObject; import com.gregtechceu.gtceu.api.recipe.ingredient.NBTIngredient; + import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.utils.NBTToJsonConverter; -import lombok.Setter; -import lombok.experimental.Accessors; + import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.nbt.CompoundTag; @@ -16,6 +15,10 @@ import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraft.world.level.ItemLike; + +import com.google.gson.JsonObject; +import lombok.Setter; +import lombok.experimental.Accessors; import org.jetbrains.annotations.Nullable; import java.util.function.Consumer; @@ -27,6 +30,7 @@ */ @Accessors(chain = true, fluent = true) public class SmeltingRecipeBuilder { + private Ingredient input; @Setter protected String group; @@ -48,9 +52,9 @@ public SmeltingRecipeBuilder input(TagKey itemStack) { } public SmeltingRecipeBuilder input(ItemStack itemStack) { - if (itemStack.hasTag() || itemStack.getDamageValue() >0) { + if (itemStack.hasTag() || itemStack.getDamageValue() > 0) { input = NBTIngredient.createNBTIngredient(itemStack); - }else { + } else { input = Ingredient.of(itemStack); } return this; @@ -117,6 +121,7 @@ public void toJson(JsonObject json) { public void save(Consumer consumer) { consumer.accept(new FinishedRecipe() { + @Override public void serializeRecipeData(JsonObject pJson) { toJson(pJson); diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/SmokingRecipeBuilder.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/SmokingRecipeBuilder.java index 5adc9dc6ac..1e4d0973ca 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/SmokingRecipeBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/SmokingRecipeBuilder.java @@ -1,11 +1,10 @@ package com.gregtechceu.gtceu.data.recipe.builder; -import com.google.gson.JsonObject; import com.gregtechceu.gtceu.api.recipe.ingredient.NBTIngredient; + import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.utils.NBTToJsonConverter; -import lombok.Setter; -import lombok.experimental.Accessors; + import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.nbt.CompoundTag; @@ -16,6 +15,10 @@ import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraft.world.level.ItemLike; + +import com.google.gson.JsonObject; +import lombok.Setter; +import lombok.experimental.Accessors; import org.jetbrains.annotations.Nullable; import java.util.function.Consumer; @@ -27,6 +30,7 @@ */ @Accessors(chain = true, fluent = true) public class SmokingRecipeBuilder { + private Ingredient input; @Setter protected String group; @@ -48,9 +52,9 @@ public SmokingRecipeBuilder input(TagKey itemStack) { } public SmokingRecipeBuilder input(ItemStack itemStack) { - if (itemStack.hasTag() || itemStack.getDamageValue() >0) { + if (itemStack.hasTag() || itemStack.getDamageValue() > 0) { input = NBTIngredient.createNBTIngredient(itemStack); - }else { + } else { input = Ingredient.of(itemStack); } return this; @@ -117,6 +121,7 @@ public void toJson(JsonObject json) { public void save(Consumer consumer) { consumer.accept(new FinishedRecipe() { + @Override public void serializeRecipeData(JsonObject pJson) { toJson(pJson); diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/configurable/RecipeAddition.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/configurable/RecipeAddition.java index 3185f32d93..d05ee9ddf6 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/configurable/RecipeAddition.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/configurable/RecipeAddition.java @@ -9,6 +9,7 @@ import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.data.recipe.CustomTags; import com.gregtechceu.gtceu.data.recipe.VanillaRecipeHelper; + import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.resources.ResourceLocation; @@ -50,29 +51,55 @@ public static void init(Consumer provider) { private static void steelSteamMultiblocks(Consumer provider) { if (ConfigHolder.INSTANCE.machines.steelSteamMultiblocks) { - VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_oven", GTMachines.STEAM_OVEN.asStack(), "CGC", "FMF", "CGC", 'F', GTBlocks.FIREBOX_STEEL.asStack(), 'C', GTBlocks.CASING_STEEL_SOLID.asStack(), 'M', GTMachines.STEAM_FURNACE.right().asStack(), 'G', new UnificationEntry(TagPrefix.gear, GTMaterials.Invar)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_grinder", GTMachines.STEAM_GRINDER.asStack(), "CGC", "CFC", "CGC", 'G', new UnificationEntry(TagPrefix.gear, GTMaterials.Potin), 'F', GTMachines.STEAM_MACERATOR.right().asStack(), 'C', GTBlocks.CASING_STEEL_SOLID.asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_hatch", GTMachines.STEAM_HATCH.asStack(), "BPB", "BTB", "BPB", 'B', new UnificationEntry(TagPrefix.plate, GTMaterials.Steel), 'P', new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.Steel), 'T', GTMachines.STEEL_DRUM.asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_input_bus", GTMachines.STEAM_IMPORT_BUS.asStack(), "C", "H", 'H', GTBlocks.STEEL_HULL.asStack(), 'C', CustomTags.WOODEN_CHESTS); - VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_output_bus", GTMachines.STEAM_EXPORT_BUS.asStack(), "H", "C", 'H', GTBlocks.STEEL_HULL.asStack(), 'C', CustomTags.WOODEN_CHESTS); + VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_oven", GTMachines.STEAM_OVEN.asStack(), "CGC", + "FMF", "CGC", 'F', GTBlocks.FIREBOX_STEEL.asStack(), 'C', GTBlocks.CASING_STEEL_SOLID.asStack(), + 'M', GTMachines.STEAM_FURNACE.right().asStack(), 'G', + new UnificationEntry(TagPrefix.gear, GTMaterials.Invar)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_grinder", GTMachines.STEAM_GRINDER.asStack(), + "CGC", "CFC", "CGC", 'G', new UnificationEntry(TagPrefix.gear, GTMaterials.Potin), 'F', + GTMachines.STEAM_MACERATOR.right().asStack(), 'C', GTBlocks.CASING_STEEL_SOLID.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_hatch", GTMachines.STEAM_HATCH.asStack(), "BPB", + "BTB", "BPB", 'B', new UnificationEntry(TagPrefix.plate, GTMaterials.Steel), 'P', + new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.Steel), 'T', + GTMachines.STEEL_DRUM.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_input_bus", + GTMachines.STEAM_IMPORT_BUS.asStack(), "C", "H", 'H', GTBlocks.STEEL_HULL.asStack(), 'C', + CustomTags.WOODEN_CHESTS); + VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_output_bus", + GTMachines.STEAM_EXPORT_BUS.asStack(), "H", "C", 'H', GTBlocks.STEEL_HULL.asStack(), 'C', + CustomTags.WOODEN_CHESTS); } else { - VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_oven", GTMachines.STEAM_OVEN.asStack(), "CGC", "FMF", "CGC", 'F', GTBlocks.FIREBOX_BRONZE.asStack(), 'C', GTBlocks.CASING_BRONZE_BRICKS.asStack(), 'M', GTMachines.STEAM_FURNACE.left().asStack(), 'G', new UnificationEntry(TagPrefix.gear, GTMaterials.Invar)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_grinder", GTMachines.STEAM_GRINDER.asStack(), "CGC", "CFC", "CGC", 'G', new UnificationEntry(TagPrefix.gear, GTMaterials.Potin), 'F', GTMachines.STEAM_MACERATOR.left().asStack(), 'C', GTBlocks.CASING_BRONZE_BRICKS.asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_hatch", GTMachines.STEAM_HATCH.asStack(), "BPB", "BTB", "BPB", 'B', new UnificationEntry(TagPrefix.plate, GTMaterials.Bronze), 'P', new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.Bronze), 'T', GTMachines.BRONZE_DRUM.asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_input_bus", GTMachines.STEAM_IMPORT_BUS.asStack(), "C", "H", 'H', GTBlocks.BRONZE_HULL.asStack(), 'C', CustomTags.WOODEN_CHESTS); - VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_output_bus", GTMachines.STEAM_EXPORT_BUS.asStack(), "H", "C", 'H', GTBlocks.BRONZE_HULL.asStack(), 'C', CustomTags.WOODEN_CHESTS); + VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_oven", GTMachines.STEAM_OVEN.asStack(), "CGC", + "FMF", "CGC", 'F', GTBlocks.FIREBOX_BRONZE.asStack(), 'C', GTBlocks.CASING_BRONZE_BRICKS.asStack(), + 'M', GTMachines.STEAM_FURNACE.left().asStack(), 'G', + new UnificationEntry(TagPrefix.gear, GTMaterials.Invar)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_grinder", GTMachines.STEAM_GRINDER.asStack(), + "CGC", "CFC", "CGC", 'G', new UnificationEntry(TagPrefix.gear, GTMaterials.Potin), 'F', + GTMachines.STEAM_MACERATOR.left().asStack(), 'C', GTBlocks.CASING_BRONZE_BRICKS.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_hatch", GTMachines.STEAM_HATCH.asStack(), "BPB", + "BTB", "BPB", 'B', new UnificationEntry(TagPrefix.plate, GTMaterials.Bronze), 'P', + new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.Bronze), 'T', + GTMachines.BRONZE_DRUM.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_input_bus", + GTMachines.STEAM_IMPORT_BUS.asStack(), "C", "H", 'H', GTBlocks.BRONZE_HULL.asStack(), 'C', + CustomTags.WOODEN_CHESTS); + VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_output_bus", + GTMachines.STEAM_EXPORT_BUS.asStack(), "H", "C", 'H', GTBlocks.BRONZE_HULL.asStack(), 'C', + CustomTags.WOODEN_CHESTS); } } private static void disableManualCompression(Consumer provider) { if (!ConfigHolder.INSTANCE.recipes.disableManualCompression) { - VanillaRecipeHelper.addShapelessRecipe(provider, "nether_quartz_block_to_nether_quartz", new ItemStack(Items.QUARTZ, 4), Blocks.QUARTZ_BLOCK); + VanillaRecipeHelper.addShapelessRecipe(provider, "nether_quartz_block_to_nether_quartz", + new ItemStack(Items.QUARTZ, 4), Blocks.QUARTZ_BLOCK); } } private static void harderBrickRecipes(Consumer provider) { if (ConfigHolder.INSTANCE.recipes.harderBrickRecipes) { - VanillaRecipeHelper.addShapedRecipe(provider, "brick_from_water", new ItemStack(Blocks.BRICKS, 2), "BBB", "BWB", "BBB", + VanillaRecipeHelper.addShapedRecipe(provider, "brick_from_water", new ItemStack(Blocks.BRICKS, 2), "BBB", + "BWB", "BBB", 'B', new ItemStack(Items.BRICK), 'W', new ItemStack(Items.WATER_BUCKET)); @@ -85,55 +112,60 @@ private static void harderBrickRecipes(Consumer provider) { 'L', new UnificationEntry(dust, Clay), 'B', new ItemStack(Items.BUCKET)); - VanillaRecipeHelper.addShapedRecipe(provider, "casing_primitive_bricks", GTBlocks.CASING_PRIMITIVE_BRICKS.asStack(), + VanillaRecipeHelper.addShapedRecipe(provider, "casing_primitive_bricks", + GTBlocks.CASING_PRIMITIVE_BRICKS.asStack(), "BGB", "BCB", "BGB", 'B', GTItems.FIRECLAY_BRICK.asStack(), 'G', new UnificationEntry(dust, Gypsum), 'C', new ItemStack(Concrete.getBucket())); - VanillaRecipeHelper.addShapelessRecipe(provider, "compressed_clay", COMPRESSED_CLAY.asStack(), WOODEN_FORM_BRICK.asStack(), new ItemStack(Items.CLAY_BALL)); - VanillaRecipeHelper.addSmeltingRecipe(provider, "brick_from_compressed_clay", COMPRESSED_CLAY.asStack(), new ItemStack(Items.BRICK), 0.3f); + VanillaRecipeHelper.addShapelessRecipe(provider, "compressed_clay", COMPRESSED_CLAY.asStack(), + WOODEN_FORM_BRICK.asStack(), new ItemStack(Items.CLAY_BALL)); + VanillaRecipeHelper.addSmeltingRecipe(provider, "brick_from_compressed_clay", COMPRESSED_CLAY.asStack(), + new ItemStack(Items.BRICK), 0.3f); } else { - VanillaRecipeHelper.addShapedRecipe(provider, "casing_primitive_bricks", GTBlocks.CASING_PRIMITIVE_BRICKS.asStack(), + VanillaRecipeHelper.addShapedRecipe(provider, "casing_primitive_bricks", + GTBlocks.CASING_PRIMITIVE_BRICKS.asStack(), "XX", "XX", 'X', GTItems.FIRECLAY_BRICK); } } private static void hardWoodRecipes(Consumer provider) { - VanillaRecipeHelper.addShapedRecipe(provider, "ladder", new ItemStack(Blocks.LADDER, 2), "SrS", "SRS", "ShS", 'S', new UnificationEntry(TagPrefix.rod, GTMaterials.Wood), 'R', new UnificationEntry(TagPrefix.bolt, GTMaterials.Wood)); + VanillaRecipeHelper.addShapedRecipe(provider, "ladder", new ItemStack(Blocks.LADDER, 2), "SrS", "SRS", "ShS", + 'S', new UnificationEntry(TagPrefix.rod, GTMaterials.Wood), 'R', + new UnificationEntry(TagPrefix.bolt, GTMaterials.Wood)); - VanillaRecipeHelper.addShapedRecipe(provider, "bowl", new ItemStack(Items.BOWL), "k", "X", 'X', ItemTags.PLANKS); + VanillaRecipeHelper.addShapedRecipe(provider, "bowl", new ItemStack(Items.BOWL), "k", "X", 'X', + ItemTags.PLANKS); VanillaRecipeHelper.addShapedRecipe(provider, "chest", new ItemStack(Blocks.CHEST), "LPL", "PFP", "LPL", - 'L', ItemTags.LOGS, - 'P', ItemTags.PLANKS, - 'F', new ItemStack(Items.FLINT)); + 'L', ItemTags.LOGS, + 'P', ItemTags.PLANKS, + 'F', new ItemStack(Items.FLINT)); } private static void hardIronRecipes(Consumer provider) { VanillaRecipeHelper.addShapedRecipe(provider, "cauldron", new ItemStack(Items.CAULDRON), "X X", "XhX", "XXX", - 'X', new UnificationEntry(TagPrefix.plate, GTMaterials.Iron) - ); - + 'X', new UnificationEntry(TagPrefix.plate, GTMaterials.Iron)); VanillaRecipeHelper.addShapedRecipe(provider, "hopper", new ItemStack(Blocks.HOPPER), "XCX", "XGX", "wXh", 'X', new UnificationEntry(TagPrefix.plate, GTMaterials.Iron), - 'C', CustomTags.WOODEN_CHESTS, - 'G', new UnificationEntry(TagPrefix.gearSmall, GTMaterials.Iron) - ); + 'C', CustomTags.WOODEN_CHESTS, + 'G', new UnificationEntry(TagPrefix.gearSmall, GTMaterials.Iron)); + VanillaRecipeHelper.addShapedRecipe(provider, "iron_bars", new ItemStack(Blocks.IRON_BARS, 8), " h ", "XXX", + "XXX", + 'X', new UnificationEntry(TagPrefix.rod, GTMaterials.Iron)); - VanillaRecipeHelper.addShapedRecipe(provider, "iron_bars", new ItemStack(Blocks.IRON_BARS, 8), " h ", "XXX", "XXX", - 'X', new UnificationEntry(TagPrefix.rod, GTMaterials.Iron) - ); - - VanillaRecipeHelper.addShapedRecipe(provider, "iron_bucket", new ItemStack(Items.BUCKET), "XhX", " X ", 'X', new UnificationEntry(TagPrefix.plate, GTMaterials.Iron)); + VanillaRecipeHelper.addShapedRecipe(provider, "iron_bucket", new ItemStack(Items.BUCKET), "XhX", " X ", 'X', + new UnificationEntry(TagPrefix.plate, GTMaterials.Iron)); } private static void hardRedstoneRecipes(Consumer provider) { if (ConfigHolder.INSTANCE.recipes.hardRedstoneRecipes) { - VanillaRecipeHelper.addShapedRecipe(provider, "dispenser", new ItemStack(Blocks.DISPENSER), "CRC", "STS", "GAG", + VanillaRecipeHelper.addShapedRecipe(provider, "dispenser", new ItemStack(Blocks.DISPENSER), "CRC", "STS", + "GAG", 'C', ItemTags.STONE_CRAFTING_MATERIALS, 'R', new UnificationEntry(TagPrefix.ring, GTMaterials.Iron), 'S', new UnificationEntry(TagPrefix.spring, GTMaterials.Iron), @@ -151,18 +183,18 @@ private static void hardRedstoneRecipes(Consumer provider) { .outputItems(new ItemStack(Blocks.DISPENSER)) .save(provider); - VanillaRecipeHelper.addShapedRecipe(provider, "sticky_piston", new ItemStack(Blocks.STICKY_PISTON), "h", "R", "P", + VanillaRecipeHelper.addShapedRecipe(provider, "sticky_piston", new ItemStack(Blocks.STICKY_PISTON), "h", + "R", "P", 'R', new ItemStack(Items.SLIME_BALL), - 'P', new ItemStack(Blocks.PISTON) - ); + 'P', new ItemStack(Blocks.PISTON)); - VanillaRecipeHelper.addShapedRecipe(provider, "piston_iron", new ItemStack(Blocks.PISTON), "WWW", "GFG", "CRC", + VanillaRecipeHelper.addShapedRecipe(provider, "piston_iron", new ItemStack(Blocks.PISTON), "WWW", "GFG", + "CRC", 'W', ItemTags.PLANKS, 'C', ItemTags.STONE_CRAFTING_MATERIALS, 'R', new UnificationEntry(TagPrefix.plate, GTMaterials.RedAlloy), 'G', new UnificationEntry(TagPrefix.gearSmall, GTMaterials.Iron), - 'F', ItemTags.WOODEN_FENCES - ); + 'F', ItemTags.WOODEN_FENCES); GTRecipeTypes.ASSEMBLER_RECIPES.recipeBuilder("piston_iron") .inputItems(TagPrefix.rod, GTMaterials.Iron) @@ -209,77 +241,77 @@ private static void hardRedstoneRecipes(Consumer provider) { .outputItems(new ItemStack(Blocks.PISTON, 16)) .duration(800).EUt(VA[LV]).save(provider); - VanillaRecipeHelper.addShapedRecipe(provider, "stone_pressure_plate", new ItemStack(Blocks.STONE_PRESSURE_PLATE, 2), "ShS", "LCL", "SdS", + VanillaRecipeHelper.addShapedRecipe(provider, "stone_pressure_plate", + new ItemStack(Blocks.STONE_PRESSURE_PLATE, 2), "ShS", "LCL", "SdS", 'S', new UnificationEntry(TagPrefix.screw, GTMaterials.Iron), 'L', new ItemStack(Blocks.STONE_SLAB), - 'C', new UnificationEntry(TagPrefix.spring, GTMaterials.Iron) - ); + 'C', new UnificationEntry(TagPrefix.spring, GTMaterials.Iron)); - VanillaRecipeHelper.addShapedRecipe(provider, "oak_pressure_plate", new ItemStack(Blocks.OAK_PRESSURE_PLATE, 2), "SrS", "LCL", "SdS", + VanillaRecipeHelper.addShapedRecipe(provider, "oak_pressure_plate", + new ItemStack(Blocks.OAK_PRESSURE_PLATE, 2), "SrS", "LCL", "SdS", 'S', new UnificationEntry(TagPrefix.bolt, GTMaterials.Wood), 'L', Blocks.OAK_SLAB.asItem(), - 'C', new UnificationEntry(TagPrefix.spring, GTMaterials.Iron) - ); + 'C', new UnificationEntry(TagPrefix.spring, GTMaterials.Iron)); - VanillaRecipeHelper.addShapedRecipe(provider, "birch_pressure_plate", new ItemStack(Blocks.BIRCH_PRESSURE_PLATE, 2), "SrS", "LCL", "SdS", + VanillaRecipeHelper.addShapedRecipe(provider, "birch_pressure_plate", + new ItemStack(Blocks.BIRCH_PRESSURE_PLATE, 2), "SrS", "LCL", "SdS", 'S', new UnificationEntry(TagPrefix.bolt, GTMaterials.Wood), 'L', Blocks.BIRCH_SLAB.asItem(), - 'C', new UnificationEntry(TagPrefix.spring, GTMaterials.Iron) - ); + 'C', new UnificationEntry(TagPrefix.spring, GTMaterials.Iron)); - VanillaRecipeHelper.addShapedRecipe(provider, "spruce_pressure_plate", new ItemStack(Blocks.SPRUCE_PRESSURE_PLATE, 2), "SrS", "LCL", "SdS", + VanillaRecipeHelper.addShapedRecipe(provider, "spruce_pressure_plate", + new ItemStack(Blocks.SPRUCE_PRESSURE_PLATE, 2), "SrS", "LCL", "SdS", 'S', new UnificationEntry(TagPrefix.bolt, GTMaterials.Wood), 'L', Blocks.SPRUCE_SLAB.asItem(), - 'C', new UnificationEntry(TagPrefix.spring, GTMaterials.Iron) - ); + 'C', new UnificationEntry(TagPrefix.spring, GTMaterials.Iron)); - VanillaRecipeHelper.addShapedRecipe(provider, "jungle_pressure_plate", new ItemStack(Blocks.JUNGLE_PRESSURE_PLATE, 2), "SrS", "LCL", "SdS", + VanillaRecipeHelper.addShapedRecipe(provider, "jungle_pressure_plate", + new ItemStack(Blocks.JUNGLE_PRESSURE_PLATE, 2), "SrS", "LCL", "SdS", 'S', new UnificationEntry(TagPrefix.bolt, GTMaterials.Wood), 'L', Blocks.JUNGLE_SLAB.asItem(), - 'C', new UnificationEntry(TagPrefix.spring, GTMaterials.Iron) - ); + 'C', new UnificationEntry(TagPrefix.spring, GTMaterials.Iron)); - VanillaRecipeHelper.addShapedRecipe(provider, "acacia_pressure_plate", new ItemStack(Blocks.ACACIA_PRESSURE_PLATE, 2), "SrS", "LCL", "SdS", + VanillaRecipeHelper.addShapedRecipe(provider, "acacia_pressure_plate", + new ItemStack(Blocks.ACACIA_PRESSURE_PLATE, 2), "SrS", "LCL", "SdS", 'S', new UnificationEntry(TagPrefix.bolt, GTMaterials.Wood), 'L', Blocks.ACACIA_SLAB.asItem(), - 'C', new UnificationEntry(TagPrefix.spring, GTMaterials.Iron) - ); + 'C', new UnificationEntry(TagPrefix.spring, GTMaterials.Iron)); - VanillaRecipeHelper.addShapedRecipe(provider, "dark_oak_pressure_plate", new ItemStack(Blocks.DARK_OAK_PRESSURE_PLATE, 2), "SrS", "LCL", "SdS", + VanillaRecipeHelper.addShapedRecipe(provider, "dark_oak_pressure_plate", + new ItemStack(Blocks.DARK_OAK_PRESSURE_PLATE, 2), "SrS", "LCL", "SdS", 'S', new UnificationEntry(TagPrefix.bolt, GTMaterials.Wood), 'L', Blocks.DARK_OAK_SLAB.asItem(), - 'C', new UnificationEntry(TagPrefix.spring, GTMaterials.Iron) - ); + 'C', new UnificationEntry(TagPrefix.spring, GTMaterials.Iron)); - VanillaRecipeHelper.addShapedRecipe(provider, "crimson_pressure_plate", new ItemStack(Blocks.CRIMSON_PRESSURE_PLATE, 2), "SrS", "LCL", "SdS", + VanillaRecipeHelper.addShapedRecipe(provider, "crimson_pressure_plate", + new ItemStack(Blocks.CRIMSON_PRESSURE_PLATE, 2), "SrS", "LCL", "SdS", 'S', new UnificationEntry(TagPrefix.bolt, GTMaterials.Wood), 'L', Blocks.CRIMSON_SLAB.asItem(), - 'C', new UnificationEntry(TagPrefix.spring, GTMaterials.Iron) - ); + 'C', new UnificationEntry(TagPrefix.spring, GTMaterials.Iron)); - VanillaRecipeHelper.addShapedRecipe(provider, "warped_pressure_plate", new ItemStack(Blocks.WARPED_PRESSURE_PLATE, 2), "SrS", "LCL", "SdS", + VanillaRecipeHelper.addShapedRecipe(provider, "warped_pressure_plate", + new ItemStack(Blocks.WARPED_PRESSURE_PLATE, 2), "SrS", "LCL", "SdS", 'S', new UnificationEntry(TagPrefix.bolt, GTMaterials.Wood), 'L', Blocks.WARPED_SLAB.asItem(), - 'C', new UnificationEntry(TagPrefix.spring, GTMaterials.Iron) - ); + 'C', new UnificationEntry(TagPrefix.spring, GTMaterials.Iron)); - VanillaRecipeHelper.addShapedRecipe(provider, "mangrove_pressure_plate", new ItemStack(Blocks.MANGROVE_PRESSURE_PLATE, 2), "SrS", "LCL", "SdS", + VanillaRecipeHelper.addShapedRecipe(provider, "mangrove_pressure_plate", + new ItemStack(Blocks.MANGROVE_PRESSURE_PLATE, 2), "SrS", "LCL", "SdS", 'S', new UnificationEntry(TagPrefix.bolt, GTMaterials.Wood), 'L', Blocks.MANGROVE_SLAB.asItem(), - 'C', new UnificationEntry(TagPrefix.spring, GTMaterials.Iron) - ); + 'C', new UnificationEntry(TagPrefix.spring, GTMaterials.Iron)); - VanillaRecipeHelper.addShapedRecipe(provider, "heavy_weighted_pressure_plate", new ItemStack(Blocks.LIGHT_WEIGHTED_PRESSURE_PLATE), "ShS", "LCL", "SdS", + VanillaRecipeHelper.addShapedRecipe(provider, "heavy_weighted_pressure_plate", + new ItemStack(Blocks.LIGHT_WEIGHTED_PRESSURE_PLATE), "ShS", "LCL", "SdS", 'S', new UnificationEntry(TagPrefix.screw, GTMaterials.Steel), 'L', new UnificationEntry(TagPrefix.plate, GTMaterials.Gold), - 'C', new UnificationEntry(TagPrefix.spring, GTMaterials.Steel) - ); + 'C', new UnificationEntry(TagPrefix.spring, GTMaterials.Steel)); - VanillaRecipeHelper.addShapedRecipe(provider, "light_weighted_pressure_plate", new ItemStack(Blocks.HEAVY_WEIGHTED_PRESSURE_PLATE), "ShS", "LCL", "SdS", + VanillaRecipeHelper.addShapedRecipe(provider, "light_weighted_pressure_plate", + new ItemStack(Blocks.HEAVY_WEIGHTED_PRESSURE_PLATE), "ShS", "LCL", "SdS", 'S', new UnificationEntry(TagPrefix.screw, GTMaterials.Steel), 'L', new UnificationEntry(TagPrefix.plate, GTMaterials.Iron), - 'C', new UnificationEntry(TagPrefix.spring, GTMaterials.Steel) - ); + 'C', new UnificationEntry(TagPrefix.spring, GTMaterials.Steel)); GTRecipeTypes.ASSEMBLER_RECIPES.recipeBuilder("stone_pressure_plate") .inputItems(TagPrefix.spring, GTMaterials.Iron) @@ -353,7 +385,6 @@ private static void hardRedstoneRecipes(Consumer provider) { .outputItems(new ItemStack(Blocks.HEAVY_WEIGHTED_PRESSURE_PLATE)) .duration(200).EUt(16).save(provider); - VanillaRecipeHelper.addShapedRecipe(provider, "stone_button", new ItemStack(Blocks.STONE_BUTTON, 6), "sP", 'P', new ItemStack(Blocks.STONE_PRESSURE_PLATE)); @@ -372,23 +403,26 @@ private static void hardRedstoneRecipes(Consumer provider) { VanillaRecipeHelper.addShapedRecipe(provider, "acacia_button", new ItemStack(Blocks.ACACIA_BUTTON, 6), "sP", 'P', new ItemStack(Blocks.ACACIA_PRESSURE_PLATE)); - VanillaRecipeHelper.addShapedRecipe(provider, "dark_oak_button", new ItemStack(Blocks.DARK_OAK_BUTTON, 6), "sP", + VanillaRecipeHelper.addShapedRecipe(provider, "dark_oak_button", new ItemStack(Blocks.DARK_OAK_BUTTON, 6), + "sP", 'P', new ItemStack(Blocks.DARK_OAK_PRESSURE_PLATE)); - VanillaRecipeHelper.addShapedRecipe(provider, "crimson_button", new ItemStack(Blocks.CRIMSON_BUTTON, 6), "sP", + VanillaRecipeHelper.addShapedRecipe(provider, "crimson_button", new ItemStack(Blocks.CRIMSON_BUTTON, 6), + "sP", 'P', new ItemStack(Blocks.CRIMSON_PRESSURE_PLATE)); VanillaRecipeHelper.addShapedRecipe(provider, "warped_button", new ItemStack(Blocks.WARPED_BUTTON, 6), "sP", 'P', new ItemStack(Blocks.WARPED_PRESSURE_PLATE)); - VanillaRecipeHelper.addShapedRecipe(provider, "mangrove_button", new ItemStack(Blocks.MANGROVE_BUTTON, 6), "sP", + VanillaRecipeHelper.addShapedRecipe(provider, "mangrove_button", new ItemStack(Blocks.MANGROVE_BUTTON, 6), + "sP", 'P', new ItemStack(Blocks.MANGROVE_PRESSURE_PLATE)); VanillaRecipeHelper.addShapedRecipe(provider, "cherry_button", new ItemStack(Blocks.CHERRY_BUTTON, 6), "sP", - 'P', new ItemStack(Blocks.CHERRY_PRESSURE_PLATE)); + 'P', new ItemStack(Blocks.CHERRY_PRESSURE_PLATE)); VanillaRecipeHelper.addShapedRecipe(provider, "bamboo_button", new ItemStack(Blocks.BAMBOO_BUTTON, 6), "sP", - 'P', new ItemStack(Blocks.BAMBOO_PRESSURE_PLATE)); + 'P', new ItemStack(Blocks.BAMBOO_PRESSURE_PLATE)); GTRecipeTypes.CUTTER_RECIPES.recipeBuilder("stone_button") .inputItems(new ItemStack(Blocks.STONE_PRESSURE_PLATE)) @@ -442,41 +476,40 @@ private static void hardRedstoneRecipes(Consumer provider) { VanillaRecipeHelper.addShapedRecipe(provider, "lever", new ItemStack(Blocks.LEVER), "B", "S", 'B', new ItemStack(Blocks.STONE_BUTTON), - 'S', new UnificationEntry(TagPrefix.rod, GTMaterials.Wood) - ); + 'S', new UnificationEntry(TagPrefix.rod, GTMaterials.Wood)); - VanillaRecipeHelper.addShapedRecipe(provider, "daylight_detector", new ItemStack(Blocks.DAYLIGHT_DETECTOR), "GGG", "PPP", "SRS", + VanillaRecipeHelper.addShapedRecipe(provider, "daylight_detector", new ItemStack(Blocks.DAYLIGHT_DETECTOR), + "GGG", "PPP", "SRS", 'G', new ItemStack(Blocks.GLASS), 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.NetherQuartz), 'S', ItemTags.WOODEN_SLABS, - 'R', new UnificationEntry(TagPrefix.rod, GTMaterials.RedAlloy) - ); + 'R', new UnificationEntry(TagPrefix.rod, GTMaterials.RedAlloy)); - VanillaRecipeHelper.addShapedRecipe(provider, "daylight_detector_certus", new ItemStack(Blocks.DAYLIGHT_DETECTOR), "GGG", "PPP", "SRS", + VanillaRecipeHelper.addShapedRecipe(provider, "daylight_detector_certus", + new ItemStack(Blocks.DAYLIGHT_DETECTOR), "GGG", "PPP", "SRS", 'G', new ItemStack(Blocks.GLASS), 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.CertusQuartz), 'S', ItemTags.WOODEN_SLABS, - 'R', new UnificationEntry(TagPrefix.rod, GTMaterials.RedAlloy) - ); + 'R', new UnificationEntry(TagPrefix.rod, GTMaterials.RedAlloy)); - VanillaRecipeHelper.addShapedRecipe(provider, "daylight_detector_quartzite", new ItemStack(Blocks.DAYLIGHT_DETECTOR), "GGG", "PPP", "SRS", + VanillaRecipeHelper.addShapedRecipe(provider, "daylight_detector_quartzite", + new ItemStack(Blocks.DAYLIGHT_DETECTOR), "GGG", "PPP", "SRS", 'G', new ItemStack(Blocks.GLASS, 1), 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Quartzite), 'S', ItemTags.WOODEN_SLABS, - 'R', new UnificationEntry(TagPrefix.rod, GTMaterials.RedAlloy) - ); + 'R', new UnificationEntry(TagPrefix.rod, GTMaterials.RedAlloy)); - VanillaRecipeHelper.addShapedRecipe(provider, "redstone_lamp", new ItemStack(Blocks.REDSTONE_LAMP), "PPP", "PGP", "PRP", + VanillaRecipeHelper.addShapedRecipe(provider, "redstone_lamp", new ItemStack(Blocks.REDSTONE_LAMP), "PPP", + "PGP", "PRP", 'P', new ItemStack(Blocks.GLASS_PANE), 'G', new ItemStack(Blocks.GLOWSTONE), - 'R', new UnificationEntry(TagPrefix.rod, GTMaterials.RedAlloy) - ); + 'R', new UnificationEntry(TagPrefix.rod, GTMaterials.RedAlloy)); - VanillaRecipeHelper.addShapedRecipe(provider, "tripwire_hook", new ItemStack(Blocks.TRIPWIRE_HOOK), "IRI", "SRS", " S ", + VanillaRecipeHelper.addShapedRecipe(provider, "tripwire_hook", new ItemStack(Blocks.TRIPWIRE_HOOK), "IRI", + "SRS", " S ", 'I', new UnificationEntry(TagPrefix.ring, GTMaterials.Iron), 'R', new UnificationEntry(TagPrefix.rod, GTMaterials.Wood), - 'S', new ItemStack(Items.STRING) - ); + 'S', new ItemStack(Items.STRING)); VanillaRecipeHelper.addShapedRecipe(provider, "dropper", new ItemStack(Blocks.DROPPER), "CRC", "STS", "GAG", 'C', ItemTags.STONE_CRAFTING_MATERIALS, @@ -484,127 +517,140 @@ private static void hardRedstoneRecipes(Consumer provider) { 'S', new UnificationEntry(TagPrefix.springSmall, GTMaterials.Iron), 'T', new ItemStack(Items.STRING), 'G', new UnificationEntry(TagPrefix.gearSmall, GTMaterials.Iron), - 'A', new UnificationEntry(TagPrefix.rod, GTMaterials.RedAlloy) - ); + 'A', new UnificationEntry(TagPrefix.rod, GTMaterials.RedAlloy)); - VanillaRecipeHelper.addShapedRecipe(provider, "observer", new ItemStack(Blocks.OBSERVER), "RCR", "CQC", "GSG", + VanillaRecipeHelper.addShapedRecipe(provider, "observer", new ItemStack(Blocks.OBSERVER), "RCR", "CQC", + "GSG", 'R', new UnificationEntry(TagPrefix.ring, GTMaterials.Iron), 'C', ItemTags.STONE_CRAFTING_MATERIALS, 'Q', new UnificationEntry(TagPrefix.plate, GTMaterials.NetherQuartz), 'G', new UnificationEntry(TagPrefix.gearSmall, GTMaterials.Iron), - 'S', new UnificationEntry(TagPrefix.rod, GTMaterials.RedAlloy) - ); + 'S', new UnificationEntry(TagPrefix.rod, GTMaterials.RedAlloy)); - VanillaRecipeHelper.addShapedRecipe(provider, "observer_certus", new ItemStack(Blocks.OBSERVER), "RCR", "CQC", "GSG", + VanillaRecipeHelper.addShapedRecipe(provider, "observer_certus", new ItemStack(Blocks.OBSERVER), "RCR", + "CQC", "GSG", 'R', new UnificationEntry(TagPrefix.ring, GTMaterials.Iron), 'C', ItemTags.STONE_CRAFTING_MATERIALS, 'Q', new UnificationEntry(TagPrefix.plate, GTMaterials.CertusQuartz), 'G', new UnificationEntry(TagPrefix.gearSmall, GTMaterials.Iron), - 'S', new UnificationEntry(TagPrefix.rod, GTMaterials.RedAlloy) - ); + 'S', new UnificationEntry(TagPrefix.rod, GTMaterials.RedAlloy)); - VanillaRecipeHelper.addShapedRecipe(provider, "observer_quartzite", new ItemStack(Blocks.OBSERVER), "RCR", "CQC", "GSG", + VanillaRecipeHelper.addShapedRecipe(provider, "observer_quartzite", new ItemStack(Blocks.OBSERVER), "RCR", + "CQC", "GSG", 'R', new UnificationEntry(TagPrefix.ring, GTMaterials.Iron), 'C', ItemTags.STONE_CRAFTING_MATERIALS, 'Q', new UnificationEntry(TagPrefix.plate, GTMaterials.Quartzite), 'G', new UnificationEntry(TagPrefix.gearSmall, GTMaterials.Iron), - 'S', new UnificationEntry(TagPrefix.rod, GTMaterials.RedAlloy) - ); + 'S', new UnificationEntry(TagPrefix.rod, GTMaterials.RedAlloy)); - VanillaRecipeHelper.addShapedRecipe(provider, "repeater", new ItemStack(Items.REPEATER), "S S", "TdT", "PRP", + VanillaRecipeHelper.addShapedRecipe(provider, "repeater", new ItemStack(Items.REPEATER), "S S", "TdT", + "PRP", 'S', new UnificationEntry(TagPrefix.screw, GTMaterials.Iron), 'T', new ItemStack(Blocks.REDSTONE_TORCH), 'P', new ItemStack(Blocks.STONE_PRESSURE_PLATE), - 'R', new UnificationEntry(TagPrefix.rod, GTMaterials.RedAlloy) - ); + 'R', new UnificationEntry(TagPrefix.rod, GTMaterials.RedAlloy)); - VanillaRecipeHelper.addShapedRecipe(provider, "comparator", new ItemStack(Items.COMPARATOR), "STS", "TQT", "PdP", + VanillaRecipeHelper.addShapedRecipe(provider, "comparator", new ItemStack(Items.COMPARATOR), "STS", "TQT", + "PdP", 'S', new UnificationEntry(TagPrefix.screw, GTMaterials.Iron), 'T', new ItemStack(Blocks.REDSTONE_TORCH), 'Q', new UnificationEntry(TagPrefix.plate, GTMaterials.NetherQuartz), - 'P', new ItemStack(Blocks.STONE_PRESSURE_PLATE) - ); + 'P', new ItemStack(Blocks.STONE_PRESSURE_PLATE)); - VanillaRecipeHelper.addShapedRecipe(provider, "comparator_certus", new ItemStack(Items.COMPARATOR), "STS", "TQT", "PdP", + VanillaRecipeHelper.addShapedRecipe(provider, "comparator_certus", new ItemStack(Items.COMPARATOR), "STS", + "TQT", "PdP", 'S', new UnificationEntry(TagPrefix.screw, GTMaterials.Iron), 'T', new ItemStack(Blocks.REDSTONE_TORCH), 'Q', new UnificationEntry(TagPrefix.plate, GTMaterials.CertusQuartz), - 'P', new ItemStack(Blocks.STONE_PRESSURE_PLATE) - ); + 'P', new ItemStack(Blocks.STONE_PRESSURE_PLATE)); - VanillaRecipeHelper.addShapedRecipe(provider, "comparator_quartzite", new ItemStack(Items.COMPARATOR), "STS", "TQT", "PdP", + VanillaRecipeHelper.addShapedRecipe(provider, "comparator_quartzite", new ItemStack(Items.COMPARATOR), + "STS", "TQT", "PdP", 'S', new UnificationEntry(TagPrefix.screw, GTMaterials.Iron), 'T', new ItemStack(Blocks.REDSTONE_TORCH), 'Q', new UnificationEntry(TagPrefix.plate, GTMaterials.Quartzite), - 'P', new ItemStack(Blocks.STONE_PRESSURE_PLATE) - ); + 'P', new ItemStack(Blocks.STONE_PRESSURE_PLATE)); - VanillaRecipeHelper.addShapedRecipe(provider, "powered_rail", new ItemStack(Blocks.POWERED_RAIL, 6), "SPS", "IWI", "GdG", + VanillaRecipeHelper.addShapedRecipe(provider, "powered_rail", new ItemStack(Blocks.POWERED_RAIL, 6), "SPS", + "IWI", "GdG", 'S', new UnificationEntry(TagPrefix.screw, GTMaterials.Steel), 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.RedAlloy), 'I', new UnificationEntry(TagPrefix.rod, GTMaterials.Iron), 'W', new UnificationEntry(TagPrefix.rod, GTMaterials.Wood), - 'G', new UnificationEntry(TagPrefix.rod, GTMaterials.Gold) - ); + 'G', new UnificationEntry(TagPrefix.rod, GTMaterials.Gold)); - VanillaRecipeHelper.addShapedRecipe(provider, "detector_rail", new ItemStack(Blocks.DETECTOR_RAIL, 6), "SPS", "IWI", "IdI", + VanillaRecipeHelper.addShapedRecipe(provider, "detector_rail", new ItemStack(Blocks.DETECTOR_RAIL, 6), + "SPS", "IWI", "IdI", 'S', new UnificationEntry(TagPrefix.screw, GTMaterials.Iron), 'P', new ItemStack(Blocks.HEAVY_WEIGHTED_PRESSURE_PLATE), 'I', new UnificationEntry(TagPrefix.rod, GTMaterials.Iron), - 'W', new UnificationEntry(TagPrefix.rod, GTMaterials.Wood) - ); + 'W', new UnificationEntry(TagPrefix.rod, GTMaterials.Wood)); VanillaRecipeHelper.addShapedRecipe(provider, "rail", new ItemStack(Blocks.RAIL, 8), "ShS", "IWI", "IdI", 'S', new UnificationEntry(TagPrefix.screw, GTMaterials.Iron), 'I', new UnificationEntry(TagPrefix.rod, GTMaterials.Iron), - 'W', new UnificationEntry(TagPrefix.rod, GTMaterials.Wood) - ); + 'W', new UnificationEntry(TagPrefix.rod, GTMaterials.Wood)); - VanillaRecipeHelper.addShapedRecipe(provider, "activator_rail", new ItemStack(Blocks.ACTIVATOR_RAIL, 6), "SPS", "IWI", "IdI", + VanillaRecipeHelper.addShapedRecipe(provider, "activator_rail", new ItemStack(Blocks.ACTIVATOR_RAIL, 6), + "SPS", "IWI", "IdI", 'S', new UnificationEntry(TagPrefix.screw, GTMaterials.Iron), 'P', new ItemStack(Blocks.REDSTONE_TORCH), 'I', new UnificationEntry(TagPrefix.rod, GTMaterials.Iron), - 'W', Tags.Items.RODS_WOODEN - ); + 'W', Tags.Items.RODS_WOODEN); - VanillaRecipeHelper.addShapedRecipe(provider, "redstone_torch", new ItemStack(Blocks.REDSTONE_TORCH), "R", "T", + VanillaRecipeHelper.addShapedRecipe(provider, "redstone_torch", new ItemStack(Blocks.REDSTONE_TORCH), "R", + "T", 'R', new UnificationEntry(TagPrefix.dust, GTMaterials.Redstone), - 'T', new ItemStack(Blocks.TORCH) - ); + 'T', new ItemStack(Blocks.TORCH)); } else { - VanillaRecipeHelper.addShapedRecipe(provider, "piston_bronze", new ItemStack(Blocks.PISTON, 1), "WWW", "CBC", "CRC", + VanillaRecipeHelper.addShapedRecipe(provider, "piston_bronze", new ItemStack(Blocks.PISTON, 1), "WWW", + "CBC", "CRC", 'W', ItemTags.PLANKS, 'C', ItemTags.STONE_CRAFTING_MATERIALS, 'R', new UnificationEntry(dust, Redstone), 'B', new UnificationEntry(ingot, Bronze)); - VanillaRecipeHelper.addShapedRecipe(provider, "piston_steel", new ItemStack(Blocks.PISTON, 2), "WWW", "CBC", "CRC", + VanillaRecipeHelper.addShapedRecipe(provider, "piston_steel", new ItemStack(Blocks.PISTON, 2), "WWW", "CBC", + "CRC", 'W', ItemTags.PLANKS, 'C', ItemTags.STONE_CRAFTING_MATERIALS, 'R', new UnificationEntry(dust, Redstone), 'B', new UnificationEntry(ingot, Steel)); - VanillaRecipeHelper.addShapedRecipe(provider, "piston_aluminium", new ItemStack(Blocks.PISTON, 4), "WWW", "CBC", "CRC", + VanillaRecipeHelper.addShapedRecipe(provider, "piston_aluminium", new ItemStack(Blocks.PISTON, 4), "WWW", + "CBC", "CRC", 'W', ItemTags.PLANKS, 'C', ItemTags.STONE_CRAFTING_MATERIALS, 'R', new UnificationEntry(dust, Redstone), 'B', new UnificationEntry(ingot, Aluminium)); - VanillaRecipeHelper.addShapedRecipe(provider, "piston_titanium", new ItemStack(Blocks.PISTON, 8), "WWW", "CBC", "CRC", + VanillaRecipeHelper.addShapedRecipe(provider, "piston_titanium", new ItemStack(Blocks.PISTON, 8), "WWW", + "CBC", "CRC", 'W', ItemTags.PLANKS, 'C', ItemTags.STONE_CRAFTING_MATERIALS, 'R', new UnificationEntry(dust, Redstone), 'B', new UnificationEntry(ingot, Titanium)); - VanillaRecipeHelper.addShapedRecipe(provider, "sticky_piston_resin", new ItemStack(Blocks.STICKY_PISTON), "h", "R", "P", + VanillaRecipeHelper.addShapedRecipe(provider, "sticky_piston_resin", new ItemStack(Blocks.STICKY_PISTON), + "h", "R", "P", 'R', STICKY_RESIN.asStack(), 'P', new ItemStack(Blocks.PISTON)); - ASSEMBLER_RECIPES.recipeBuilder("piston_iron").duration(100).EUt(16).inputItems(plate, Iron).inputItems(ItemTags.PLANKS, 3).inputItems(ItemTags.STONE_CRAFTING_MATERIALS, 4).inputItems(dust, Redstone).outputItems(new ItemStack(Blocks.PISTON)).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("piston_bronze").duration(100).EUt(16).inputItems(plate, Bronze).inputItems(ItemTags.PLANKS, 3).inputItems(ItemTags.STONE_CRAFTING_MATERIALS, 4).inputItems(dust, Redstone).outputItems(new ItemStack(Blocks.PISTON)).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("piston_steel").duration(100).EUt(16).inputItems(plate, Steel).inputItems(ItemTags.PLANKS, 3).inputItems(ItemTags.STONE_CRAFTING_MATERIALS, 4).inputItems(dust, Redstone).outputItems(new ItemStack(Blocks.PISTON, 2)).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("piston_aluminium").duration(100).EUt(16).inputItems(plate, Aluminium).inputItems(ItemTags.PLANKS, 3).inputItems(ItemTags.STONE_CRAFTING_MATERIALS, 4).inputItems(dust, Redstone).outputItems(new ItemStack(Blocks.PISTON, 4)).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("piston_titanium").duration(100).EUt(16).inputItems(plate, Titanium).inputItems(ItemTags.PLANKS, 3).inputItems(ItemTags.STONE_CRAFTING_MATERIALS, 4).inputItems(dust, Redstone).outputItems(new ItemStack(Blocks.PISTON, 8)).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("piston_iron").duration(100).EUt(16).inputItems(plate, Iron) + .inputItems(ItemTags.PLANKS, 3).inputItems(ItemTags.STONE_CRAFTING_MATERIALS, 4) + .inputItems(dust, Redstone).outputItems(new ItemStack(Blocks.PISTON)).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("piston_bronze").duration(100).EUt(16).inputItems(plate, Bronze) + .inputItems(ItemTags.PLANKS, 3).inputItems(ItemTags.STONE_CRAFTING_MATERIALS, 4) + .inputItems(dust, Redstone).outputItems(new ItemStack(Blocks.PISTON)).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("piston_steel").duration(100).EUt(16).inputItems(plate, Steel) + .inputItems(ItemTags.PLANKS, 3).inputItems(ItemTags.STONE_CRAFTING_MATERIALS, 4) + .inputItems(dust, Redstone).outputItems(new ItemStack(Blocks.PISTON, 2)).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("piston_aluminium").duration(100).EUt(16).inputItems(plate, Aluminium) + .inputItems(ItemTags.PLANKS, 3).inputItems(ItemTags.STONE_CRAFTING_MATERIALS, 4) + .inputItems(dust, Redstone).outputItems(new ItemStack(Blocks.PISTON, 4)).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("piston_titanium").duration(100).EUt(16).inputItems(plate, Titanium) + .inputItems(ItemTags.PLANKS, 3).inputItems(ItemTags.STONE_CRAFTING_MATERIALS, 4) + .inputItems(dust, Redstone).outputItems(new ItemStack(Blocks.PISTON, 8)).save(provider); ASSEMBLER_RECIPES.recipeBuilder("light_weighted_pressure_plate") .inputItems(plate, Gold, 2) @@ -616,32 +662,35 @@ private static void hardRedstoneRecipes(Consumer provider) { .outputItems(new ItemStack(Blocks.HEAVY_WEIGHTED_PRESSURE_PLATE)) .circuitMeta(2).duration(100).EUt(4).save(provider); - VanillaRecipeHelper.addShapedRecipe(provider, "comparator_certus", new ItemStack(Items.COMPARATOR), " T ", "TQT", "SSS", + VanillaRecipeHelper.addShapedRecipe(provider, "comparator_certus", new ItemStack(Items.COMPARATOR), " T ", + "TQT", "SSS", 'T', new ItemStack(Blocks.REDSTONE_TORCH), 'Q', new UnificationEntry(gem, CertusQuartz), - 'S', new ItemStack(Blocks.STONE) - ); + 'S', new ItemStack(Blocks.STONE)); - VanillaRecipeHelper.addShapedRecipe(provider, "comparator_quartzite", new ItemStack(Items.COMPARATOR), " T ", "TQT", "SSS", + VanillaRecipeHelper.addShapedRecipe(provider, "comparator_quartzite", new ItemStack(Items.COMPARATOR), + " T ", "TQT", "SSS", 'T', new ItemStack(Blocks.REDSTONE_TORCH), 'Q', new UnificationEntry(gem, Quartzite), - 'S', new ItemStack(Blocks.STONE) - ); + 'S', new ItemStack(Blocks.STONE)); - VanillaRecipeHelper.addShapedRecipe(provider, "daylight_detector_certus", new ItemStack(Blocks.DAYLIGHT_DETECTOR), "GGG", "CCC", "PPP", + VanillaRecipeHelper.addShapedRecipe(provider, "daylight_detector_certus", + new ItemStack(Blocks.DAYLIGHT_DETECTOR), "GGG", "CCC", "PPP", 'G', new ItemStack(Blocks.GLASS), 'C', new UnificationEntry(gem, CertusQuartz), - 'P', ItemTags.WOODEN_SLABS - ); + 'P', ItemTags.WOODEN_SLABS); - VanillaRecipeHelper.addShapedRecipe(provider, "daylight_detector_quartzite", new ItemStack(Blocks.DAYLIGHT_DETECTOR), "GGG", "CCC", "PPP", + VanillaRecipeHelper.addShapedRecipe(provider, "daylight_detector_quartzite", + new ItemStack(Blocks.DAYLIGHT_DETECTOR), "GGG", "CCC", "PPP", 'G', new ItemStack(Blocks.GLASS), 'C', new UnificationEntry(gem, Quartzite), - 'P', ItemTags.WOODEN_SLABS - ); + 'P', ItemTags.WOODEN_SLABS); - ASSEMBLER_RECIPES.recipeBuilder("note_block").duration(100).EUt(16).inputItems(ItemTags.PLANKS, 8).inputItems(dust, Redstone).circuitMeta(1).outputItems(new ItemStack(Blocks.NOTE_BLOCK)).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("jukebox").duration(100).EUt(16).inputItems(ItemTags.PLANKS, 8).inputItems(gem, Diamond).outputItems(new ItemStack(Blocks.JUKEBOX)).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("note_block").duration(100).EUt(16).inputItems(ItemTags.PLANKS, 8) + .inputItems(dust, Redstone).circuitMeta(1).outputItems(new ItemStack(Blocks.NOTE_BLOCK)) + .save(provider); + ASSEMBLER_RECIPES.recipeBuilder("jukebox").duration(100).EUt(16).inputItems(ItemTags.PLANKS, 8) + .inputItems(gem, Diamond).outputItems(new ItemStack(Blocks.JUKEBOX)).save(provider); } } @@ -663,7 +712,8 @@ private static void hardToolArmorRecipes(Consumer provider) { createSwordRecipe(provider, "golden_sword", new ItemStack(Items.GOLDEN_SWORD), GTMaterials.Gold); createHoeRecipe(provider, "golden_hoe", new ItemStack(Items.GOLDEN_HOE), GTMaterials.Gold); createHelmetRecipe(provider, "golden_helmet", new ItemStack(Items.GOLDEN_HELMET), GTMaterials.Gold); - createChestplateRecipe(provider, "golden_chestplate", new ItemStack(Items.GOLDEN_CHESTPLATE), GTMaterials.Gold); + createChestplateRecipe(provider, "golden_chestplate", new ItemStack(Items.GOLDEN_CHESTPLATE), + GTMaterials.Gold); createLeggingsRecipe(provider, "golden_leggings", new ItemStack(Items.GOLDEN_LEGGINGS), GTMaterials.Gold); createBootsRecipe(provider, "golden_boots", new ItemStack(Items.GOLDEN_BOOTS), GTMaterials.Gold); @@ -673,19 +723,19 @@ private static void hardToolArmorRecipes(Consumer provider) { createSwordRecipe(provider, "diamond_sword", new ItemStack(Items.DIAMOND_SWORD), GTMaterials.Diamond); createHoeRecipe(provider, "diamond_hoe", new ItemStack(Items.DIAMOND_HOE), GTMaterials.Diamond); createHelmetRecipe(provider, "diamond_helmet", new ItemStack(Items.DIAMOND_HELMET), GTMaterials.Diamond); - createChestplateRecipe(provider, "diamond_chestplate", new ItemStack(Items.DIAMOND_CHESTPLATE), GTMaterials.Diamond); - createLeggingsRecipe(provider, "diamond_leggings", new ItemStack(Items.DIAMOND_LEGGINGS), GTMaterials.Diamond); + createChestplateRecipe(provider, "diamond_chestplate", new ItemStack(Items.DIAMOND_CHESTPLATE), + GTMaterials.Diamond); + createLeggingsRecipe(provider, "diamond_leggings", new ItemStack(Items.DIAMOND_LEGGINGS), + GTMaterials.Diamond); createBootsRecipe(provider, "diamond_boots", new ItemStack(Items.DIAMOND_BOOTS), GTMaterials.Diamond); - VanillaRecipeHelper.addShapedRecipe(provider, "compass", new ItemStack(Items.COMPASS), "SGB", "RPR", "AdS", 'S', new UnificationEntry(TagPrefix.screw, GTMaterials.Iron), 'G', new ItemStack(Blocks.GLASS_PANE), 'B', new UnificationEntry(TagPrefix.bolt, GTMaterials.IronMagnetic), 'R', new UnificationEntry(TagPrefix.ring, GTMaterials.Zinc), 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Iron), - 'A', new UnificationEntry(TagPrefix.bolt, GTMaterials.RedAlloy) - ); + 'A', new UnificationEntry(TagPrefix.bolt, GTMaterials.RedAlloy)); GTRecipeTypes.ASSEMBLER_RECIPES.recipeBuilder("compass") .inputItems(TagPrefix.plate, GTMaterials.Iron) @@ -696,21 +746,18 @@ private static void hardToolArmorRecipes(Consumer provider) { .outputItems(new ItemStack(Items.COMPASS)) .duration(100).EUt(16).save(provider); - - VanillaRecipeHelper.addShapedRecipe(provider, "fishing_rod", new ItemStack(Items.FISHING_ROD), " S", " SL", "SxR", + VanillaRecipeHelper.addShapedRecipe(provider, "fishing_rod", new ItemStack(Items.FISHING_ROD), " S", " SL", + "SxR", 'S', new UnificationEntry(TagPrefix.rodLong, GTMaterials.Wood), 'L', new ItemStack(Items.STRING), - 'R', new UnificationEntry(TagPrefix.ring, GTMaterials.Iron) - ); - + 'R', new UnificationEntry(TagPrefix.ring, GTMaterials.Iron)); VanillaRecipeHelper.addShapedRecipe(provider, "clock", new ItemStack(Items.CLOCK), "RPR", "BCB", "dSw", 'R', new UnificationEntry(TagPrefix.ring, GTMaterials.Gold), 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Gold), 'B', new UnificationEntry(TagPrefix.bolt, GTMaterials.Gold), 'C', new ItemStack(Items.COMPARATOR), - 'S', new UnificationEntry(TagPrefix.screw, GTMaterials.Gold) - ); + 'S', new UnificationEntry(TagPrefix.screw, GTMaterials.Gold)); GTRecipeTypes.ASSEMBLER_RECIPES.recipeBuilder("clock") .inputItems(TagPrefix.plate, GTMaterials.Gold) @@ -721,21 +768,17 @@ private static void hardToolArmorRecipes(Consumer provider) { .outputItems(new ItemStack(Items.CLOCK)) .duration(100).EUt(16).save(provider); - VanillaRecipeHelper.addShapedRecipe(provider, "shears", new ItemStack(Items.SHEARS), "PSP", "hRf", "TdT", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Iron), 'S', new UnificationEntry(TagPrefix.screw, GTMaterials.Iron), 'R', new UnificationEntry(TagPrefix.ring, GTMaterials.Iron), - 'T', new UnificationEntry(TagPrefix.rod, GTMaterials.Wood) - ); - + 'T', new UnificationEntry(TagPrefix.rod, GTMaterials.Wood)); VanillaRecipeHelper.addShapedRecipe(provider, "shield", new ItemStack(Items.SHIELD), "BRB", "LPL", "BRB", 'B', new UnificationEntry(TagPrefix.bolt, GTMaterials.Iron), 'R', new UnificationEntry(TagPrefix.rod, GTMaterials.Iron), 'L', new UnificationEntry(TagPrefix.rodLong, GTMaterials.Iron), - 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Wood) - ); + 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Wood)); } else { ASSEMBLER_RECIPES.recipeBuilder("compass") .inputItems(dust, Redstone) @@ -803,44 +846,40 @@ private static void hardMiscRecipes(Consumer provider) { 'G', new ItemStack(Blocks.GLASS), 'L', new UnificationEntry(TagPrefix.lens, GTMaterials.NetherStar), 'S', new ItemStack(Items.NETHER_STAR), - 'O', new UnificationEntry(TagPrefix.plate, GTMaterials.Obsidian) - ); + 'O', new UnificationEntry(TagPrefix.plate, GTMaterials.Obsidian)); - VanillaRecipeHelper.addShapedRecipe(provider, "lit_pumpkin", new ItemStack(Blocks.JACK_O_LANTERN), "PT", "k ", + VanillaRecipeHelper.addShapedRecipe(provider, "lit_pumpkin", new ItemStack(Blocks.JACK_O_LANTERN), "PT", + "k ", 'P', new ItemStack(Blocks.PUMPKIN), - 'T', new ItemStack(Blocks.TORCH) - ); - + 'T', new ItemStack(Blocks.TORCH)); VanillaRecipeHelper.addShapedRecipe(provider, "book", new ItemStack(Items.BOOK), "SPL", "SPG", "SPL", 'S', new ItemStack(Items.STRING), 'P', new ItemStack(Items.PAPER), 'L', new ItemStack(Items.LEATHER), - 'G', GTItems.STICKY_RESIN.asStack() - ); + 'G', GTItems.STICKY_RESIN.asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, "brewing_stand", new ItemStack(Items.BREWING_STAND), "RBR", "ABA", "SCS", + VanillaRecipeHelper.addShapedRecipe(provider, "brewing_stand", new ItemStack(Items.BREWING_STAND), "RBR", + "ABA", "SCS", 'R', new UnificationEntry(TagPrefix.ring, GTMaterials.Aluminium), 'B', new UnificationEntry(TagPrefix.rod, GTMaterials.Blaze), 'A', new UnificationEntry(TagPrefix.rod, GTMaterials.Aluminium), 'S', new UnificationEntry(TagPrefix.screw, GTMaterials.Aluminium), - 'C', new ItemStack(Items.CAULDRON) - ); + 'C', new ItemStack(Items.CAULDRON)); - VanillaRecipeHelper.addShapedRecipe(provider, "enchanting_table", new ItemStack(Blocks.ENCHANTING_TABLE), "DCD", "PBP", "DPD", + VanillaRecipeHelper.addShapedRecipe(provider, "enchanting_table", new ItemStack(Blocks.ENCHANTING_TABLE), + "DCD", "PBP", "DPD", 'D', new UnificationEntry(TagPrefix.gem, GTMaterials.Diamond), 'C', new ItemStack(Blocks.RED_CARPET), 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Obsidian), - 'B', new ItemStack(Blocks.BOOKSHELF) - ); + 'B', new ItemStack(Blocks.BOOKSHELF)); VanillaRecipeHelper.addShapedRecipe(provider, "jukebox", new ItemStack(Blocks.JUKEBOX), "LBL", "NRN", "LGL", 'L', ItemTags.LOGS, 'B', new UnificationEntry(TagPrefix.bolt, GTMaterials.Diamond), 'N', new ItemStack(Blocks.NOTE_BLOCK), 'R', new UnificationEntry(TagPrefix.ring, GTMaterials.Iron), - 'G', new UnificationEntry(TagPrefix.gear, GTMaterials.Iron) - ); + 'G', new UnificationEntry(TagPrefix.gear, GTMaterials.Iron)); GTRecipeTypes.ASSEMBLER_RECIPES.recipeBuilder("jukebox") .inputItems(TagPrefix.bolt, GTMaterials.Diamond) @@ -851,13 +890,12 @@ private static void hardMiscRecipes(Consumer provider) { .outputItems(new ItemStack(Blocks.JUKEBOX)) .duration(100).EUt(16).save(provider); - - VanillaRecipeHelper.addShapedRecipe(provider, "note_block", new ItemStack(Blocks.NOTE_BLOCK), "PPP", "BGB", "PRP", + VanillaRecipeHelper.addShapedRecipe(provider, "note_block", new ItemStack(Blocks.NOTE_BLOCK), "PPP", "BGB", + "PRP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Wood), 'B', new ItemStack(Blocks.IRON_BARS), 'G', new UnificationEntry(TagPrefix.gear, GTMaterials.Wood), - 'R', new UnificationEntry(TagPrefix.rod, GTMaterials.RedAlloy) - ); + 'R', new UnificationEntry(TagPrefix.rod, GTMaterials.RedAlloy)); GTRecipeTypes.ASSEMBLER_RECIPES.recipeBuilder("note_block") .inputItems(TagPrefix.plate, GTMaterials.Wood, 4) @@ -867,11 +905,9 @@ private static void hardMiscRecipes(Consumer provider) { .outputItems(new ItemStack(Blocks.NOTE_BLOCK)) .duration(100).EUt(16).save(provider); - VanillaRecipeHelper.addShapedRecipe(provider, "furnace", new ItemStack(Blocks.FURNACE), "CCC", "FFF", "CCC", 'F', new ItemStack(Items.FLINT), - 'C', ItemTags.STONE_CRAFTING_MATERIALS - ); + 'C', ItemTags.STONE_CRAFTING_MATERIALS); GTRecipeTypes.ASSEMBLER_RECIPES.recipeBuilder("furnace") .circuitMeta(8) @@ -880,11 +916,10 @@ private static void hardMiscRecipes(Consumer provider) { .outputItems(new ItemStack(Blocks.FURNACE)) .duration(100).EUt(VA[ULV]).save(provider); - - VanillaRecipeHelper.addShapedRecipe(provider, "crafting_table", new ItemStack(Blocks.CRAFTING_TABLE), "FF", "WW", + VanillaRecipeHelper.addShapedRecipe(provider, "crafting_table", new ItemStack(Blocks.CRAFTING_TABLE), "FF", + "WW", 'F', new ItemStack(Items.FLINT), - 'W', ItemTags.LOGS - ); + 'W', ItemTags.LOGS); GTRecipeTypes.ASSEMBLER_RECIPES.recipeBuilder("crafting_table").duration(80).EUt(6) .inputItems(ItemTags.LOGS) @@ -894,91 +929,113 @@ private static void hardMiscRecipes(Consumer provider) { VanillaRecipeHelper.addShapedRecipe(provider, "lead", new ItemStack(Items.LEAD), "SSS", "SBS", "SSS", 'S', new ItemStack(Items.STRING), - 'B', new ItemStack(Items.SLIME_BALL) - ); + 'B', new ItemStack(Items.SLIME_BALL)); VanillaRecipeHelper.addShapedRecipe(provider, "bow", new ItemStack(Items.BOW), "hLS", "LRS", "fLS", 'L', new UnificationEntry(TagPrefix.rodLong, GTMaterials.Wood), 'S', new ItemStack(Items.STRING), 'R', new UnificationEntry(TagPrefix.ring, GTMaterials.Iron)); - - VanillaRecipeHelper.addShapedRecipe(provider, "item_frame", new ItemStack(Items.ITEM_FRAME), "SRS", "TLT", "TTT", + VanillaRecipeHelper.addShapedRecipe(provider, "item_frame", new ItemStack(Items.ITEM_FRAME), "SRS", "TLT", + "TTT", 'S', new ItemStack(Items.STRING), 'R', new UnificationEntry(TagPrefix.ring, GTMaterials.Iron), 'T', new UnificationEntry(TagPrefix.rod, GTMaterials.Wood), 'L', new ItemStack(Items.LEATHER)); - - VanillaRecipeHelper.addShapedRecipe(provider, "painting", new ItemStack(Items.PAINTING), "SRS", "TCT", "TTT", + VanillaRecipeHelper.addShapedRecipe(provider, "painting", new ItemStack(Items.PAINTING), "SRS", "TCT", + "TTT", 'S', new ItemStack(Items.STRING), 'R', new UnificationEntry(TagPrefix.ring, GTMaterials.Iron), 'T', new UnificationEntry(TagPrefix.rod, GTMaterials.Wood), 'C', ItemTags.WOOL_CARPETS); - VanillaRecipeHelper.addShapedRecipe(provider, "chest_minecart", new ItemStack(Items.CHEST_MINECART), "hIw", " M ", " d ", 'I', CustomTags.WOODEN_CHESTS, 'M', new ItemStack(Items.MINECART)); - VanillaRecipeHelper.addShapedRecipe(provider, "furnace_minecart", new ItemStack(Items.FURNACE_MINECART), "hIw", " M ", " d ", 'I', new ItemStack(Blocks.FURNACE), 'M', new ItemStack(Items.MINECART)); - VanillaRecipeHelper.addShapedRecipe(provider, "tnt_minecart", new ItemStack(Items.TNT_MINECART), "hIw", " M ", " d ", 'I', new ItemStack(Blocks.TNT), 'M', new ItemStack(Items.MINECART)); - VanillaRecipeHelper.addShapedRecipe(provider, "hopper_minecart", new ItemStack(Items.HOPPER_MINECART), "hIw", " M ", " d ", 'I', new ItemStack(Blocks.HOPPER), 'M', new ItemStack(Items.MINECART)); - + VanillaRecipeHelper.addShapedRecipe(provider, "chest_minecart", new ItemStack(Items.CHEST_MINECART), "hIw", + " M ", " d ", 'I', CustomTags.WOODEN_CHESTS, 'M', new ItemStack(Items.MINECART)); + VanillaRecipeHelper.addShapedRecipe(provider, "furnace_minecart", new ItemStack(Items.FURNACE_MINECART), + "hIw", " M ", " d ", 'I', new ItemStack(Blocks.FURNACE), 'M', new ItemStack(Items.MINECART)); + VanillaRecipeHelper.addShapedRecipe(provider, "tnt_minecart", new ItemStack(Items.TNT_MINECART), "hIw", + " M ", " d ", 'I', new ItemStack(Blocks.TNT), 'M', new ItemStack(Items.MINECART)); + VanillaRecipeHelper.addShapedRecipe(provider, "hopper_minecart", new ItemStack(Items.HOPPER_MINECART), + "hIw", " M ", " d ", 'I', new ItemStack(Blocks.HOPPER), 'M', new ItemStack(Items.MINECART)); VanillaRecipeHelper.addShapedRecipe(provider, "flower_pot", new ItemStack(Items.FLOWER_POT), "BfB", " B ", - 'B', new ItemStack(Items.BRICK)); + 'B', new ItemStack(Items.BRICK)); - VanillaRecipeHelper.addShapedRecipe(provider, "armor_stand", new ItemStack(Items.ARMOR_STAND), "BSB", "hSs", "IPI", - 'B', new UnificationEntry(TagPrefix.bolt, GTMaterials.Wood), - 'S', new UnificationEntry(TagPrefix.rod, GTMaterials.Wood), - 'I', new UnificationEntry(TagPrefix.plate, GTMaterials.Iron), - 'P', new ItemStack(Blocks.STONE_PRESSURE_PLATE)); + VanillaRecipeHelper.addShapedRecipe(provider, "armor_stand", new ItemStack(Items.ARMOR_STAND), "BSB", "hSs", + "IPI", + 'B', new UnificationEntry(TagPrefix.bolt, GTMaterials.Wood), + 'S', new UnificationEntry(TagPrefix.rod, GTMaterials.Wood), + 'I', new UnificationEntry(TagPrefix.plate, GTMaterials.Iron), + 'P', new ItemStack(Blocks.STONE_PRESSURE_PLATE)); ASSEMBLER_RECIPES.recipeBuilder("armor_stand") - .inputItems(Blocks.STONE_PRESSURE_PLATE.asItem()) - .inputItems(TagPrefix.plate, GTMaterials.Iron, 2) - .inputItems(TagPrefix.rod, GTMaterials.Wood, 2) - .outputItems(Items.ARMOR_STAND) - .duration(100).EUt(VA[ULV]).save(provider); - - VanillaRecipeHelper.addShapedRecipe(provider, "trapped_chest", new ItemStack(Blocks.TRAPPED_CHEST), " H ", "SCS", " d ", - 'H', new ItemStack(Blocks.TRIPWIRE_HOOK), - 'S', new UnificationEntry(TagPrefix.screw, GTMaterials.Iron), - 'C', new ItemStack(Blocks.CHEST)); + .inputItems(Blocks.STONE_PRESSURE_PLATE.asItem()) + .inputItems(TagPrefix.plate, GTMaterials.Iron, 2) + .inputItems(TagPrefix.rod, GTMaterials.Wood, 2) + .outputItems(Items.ARMOR_STAND) + .duration(100).EUt(VA[ULV]).save(provider); + + VanillaRecipeHelper.addShapedRecipe(provider, "trapped_chest", new ItemStack(Blocks.TRAPPED_CHEST), " H ", + "SCS", " d ", + 'H', new ItemStack(Blocks.TRIPWIRE_HOOK), + 'S', new UnificationEntry(TagPrefix.screw, GTMaterials.Iron), + 'C', new ItemStack(Blocks.CHEST)); ASSEMBLER_RECIPES.recipeBuilder("ender_chest") - .inputItems(CustomTags.WOODEN_CHESTS) - .inputItems(TagPrefix.plateDense, GTMaterials.Obsidian, 6) - .inputItems(TagPrefix.plate, GTMaterials.EnderEye) - .outputItems(Blocks.ENDER_CHEST.asItem()) - .duration(200).EUt(VA[MV]).save(provider); + .inputItems(CustomTags.WOODEN_CHESTS) + .inputItems(TagPrefix.plateDense, GTMaterials.Obsidian, 6) + .inputItems(TagPrefix.plate, GTMaterials.EnderEye) + .outputItems(Blocks.ENDER_CHEST.asItem()) + .duration(200).EUt(VA[MV]).save(provider); for (DyeColor color : DyeColor.values()) { addBedRecipe(provider, color); } } else { - ASSEMBLER_RECIPES.recipeBuilder("crafting_table").duration(80).EUt(6).circuitMeta(4).inputItems(ItemTags.PLANKS, 4).outputItems(new ItemStack(Blocks.CRAFTING_TABLE)).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("furnace").circuitMeta(8).inputItems(ItemTags.STONE_CRAFTING_MATERIALS, 8).outputItems(new ItemStack(Blocks.FURNACE)).duration(100).EUt(VA[ULV]).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("enchanting_table").inputItems(new ItemStack(Blocks.OBSIDIAN, 4)).inputItems(gem, Diamond, 2).inputItems(new ItemStack(Items.BOOK)).outputItems(new ItemStack(Blocks.ENCHANTING_TABLE)).duration(100).EUt(VA[ULV]).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("dispenser").duration(100).EUt(VA[LV]).circuitMeta(1).inputItems(ItemTags.STONE_CRAFTING_MATERIALS, 7).inputItems(new ItemStack(Items.BOW)).inputItems(dust, Redstone).outputItems(new ItemStack(Blocks.DISPENSER)).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("dropper").duration(100).EUt(VA[LV]).circuitMeta(2).inputItems(ItemTags.STONE_CRAFTING_MATERIALS, 7).inputItems(dust, Redstone).outputItems(new ItemStack(Blocks.DROPPER)).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("observer_nether_quartz").duration(100).EUt(VA[LV]).inputItems(ItemTags.STONE_CRAFTING_MATERIALS, 6).inputItems(dust, Redstone, 2).inputItems(plate, NetherQuartz).outputItems(new ItemStack(Blocks.OBSERVER)).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("observer_certus_quartz").duration(100).EUt(VA[LV]).inputItems(ItemTags.STONE_CRAFTING_MATERIALS, 6).inputItems(dust, Redstone, 2).inputItems(plate, CertusQuartz).outputItems(new ItemStack(Blocks.OBSERVER)).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("observer_quartzite").duration(100).EUt(VA[LV]).inputItems(ItemTags.STONE_CRAFTING_MATERIALS, 6).inputItems(dust, Redstone, 2).inputItems(plate, Quartzite).outputItems(new ItemStack(Blocks.OBSERVER)).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("crafting_table").duration(80).EUt(6).circuitMeta(4) + .inputItems(ItemTags.PLANKS, 4).outputItems(new ItemStack(Blocks.CRAFTING_TABLE)).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("furnace").circuitMeta(8).inputItems(ItemTags.STONE_CRAFTING_MATERIALS, 8) + .outputItems(new ItemStack(Blocks.FURNACE)).duration(100).EUt(VA[ULV]).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("enchanting_table").inputItems(new ItemStack(Blocks.OBSIDIAN, 4)) + .inputItems(gem, Diamond, 2).inputItems(new ItemStack(Items.BOOK)) + .outputItems(new ItemStack(Blocks.ENCHANTING_TABLE)).duration(100).EUt(VA[ULV]).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("dispenser").duration(100).EUt(VA[LV]).circuitMeta(1) + .inputItems(ItemTags.STONE_CRAFTING_MATERIALS, 7).inputItems(new ItemStack(Items.BOW)) + .inputItems(dust, Redstone).outputItems(new ItemStack(Blocks.DISPENSER)).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("dropper").duration(100).EUt(VA[LV]).circuitMeta(2) + .inputItems(ItemTags.STONE_CRAFTING_MATERIALS, 7).inputItems(dust, Redstone) + .outputItems(new ItemStack(Blocks.DROPPER)).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("observer_nether_quartz").duration(100).EUt(VA[LV]) + .inputItems(ItemTags.STONE_CRAFTING_MATERIALS, 6).inputItems(dust, Redstone, 2) + .inputItems(plate, NetherQuartz).outputItems(new ItemStack(Blocks.OBSERVER)).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("observer_certus_quartz").duration(100).EUt(VA[LV]) + .inputItems(ItemTags.STONE_CRAFTING_MATERIALS, 6).inputItems(dust, Redstone, 2) + .inputItems(plate, CertusQuartz).outputItems(new ItemStack(Blocks.OBSERVER)).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("observer_quartzite").duration(100).EUt(VA[LV]) + .inputItems(ItemTags.STONE_CRAFTING_MATERIALS, 6).inputItems(dust, Redstone, 2) + .inputItems(plate, Quartzite).outputItems(new ItemStack(Blocks.OBSERVER)).save(provider); } } private static void addBedRecipe(Consumer provider, DyeColor color) { String colorName = color.getName(); - VanillaRecipeHelper.addShapedRecipe(provider, colorName + "_bed", new ItemStack(BuiltInRegistries.ITEM.get(new ResourceLocation(colorName + "_bed"))), "WWW", "PPP", "FrF", - 'W', BuiltInRegistries.ITEM.get(new ResourceLocation(colorName + "_carpet")), - 'P', ItemTags.PLANKS, - 'F', ItemTags.WOODEN_FENCES); + VanillaRecipeHelper.addShapedRecipe(provider, colorName + "_bed", + new ItemStack(BuiltInRegistries.ITEM.get(new ResourceLocation(colorName + "_bed"))), "WWW", "PPP", + "FrF", + 'W', BuiltInRegistries.ITEM.get(new ResourceLocation(colorName + "_carpet")), + 'P', ItemTags.PLANKS, + 'F', ItemTags.WOODEN_FENCES); } - private static void hardGlassRecipes(Consumer provider) { - } + private static void hardGlassRecipes(Consumer provider) {} private static void nerfPaperCrafting(Consumer provider) { - VanillaRecipeHelper.addShapedRecipe(provider, "paper_dust", ChemicalHelper.get(TagPrefix.dust, GTMaterials.Paper, 2), "SSS", " m ", 'S', new ItemStack(Items.SUGAR_CANE)); - VanillaRecipeHelper.addShapedRecipe(provider, "sugar", ChemicalHelper.get(TagPrefix.dust, GTMaterials.Sugar, 1), "Sm ", 'S', new ItemStack(Items.SUGAR_CANE)); + VanillaRecipeHelper.addShapedRecipe(provider, "paper_dust", + ChemicalHelper.get(TagPrefix.dust, GTMaterials.Paper, 2), "SSS", " m ", 'S', + new ItemStack(Items.SUGAR_CANE)); + VanillaRecipeHelper.addShapedRecipe(provider, "sugar", ChemicalHelper.get(TagPrefix.dust, GTMaterials.Sugar, 1), + "Sm ", 'S', new ItemStack(Items.SUGAR_CANE)); VanillaRecipeHelper.addShapedRecipe(provider, "paper", new ItemStack(Items.PAPER, 2), " r ", "SSS", " B ", 'S', new UnificationEntry(TagPrefix.dust, GTMaterials.Paper), @@ -990,8 +1047,7 @@ private static void hardAdvancedIronRecipes(Consumer provider) { 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Iron), 'T', new ItemStack(Blocks.IRON_BARS), 'R', new UnificationEntry(TagPrefix.ring, GTMaterials.Steel), - 'S', new UnificationEntry(TagPrefix.screw, GTMaterials.Steel) - ); + 'S', new UnificationEntry(TagPrefix.screw, GTMaterials.Steel)); ASSEMBLER_RECIPES.recipeBuilder("iron_door") .inputItems(TagPrefix.plate, GTMaterials.Iron, 4) @@ -1003,131 +1059,173 @@ private static void hardAdvancedIronRecipes(Consumer provider) { VanillaRecipeHelper.addShapedRecipe(provider, "anvil", new ItemStack(Blocks.ANVIL), "BBB", "SBS", "PBP", 'B', new UnificationEntry(TagPrefix.block, GTMaterials.Iron), 'S', new UnificationEntry(TagPrefix.screw, GTMaterials.Iron), - 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Iron) - ); + 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Iron)); - VanillaRecipeHelper.addShapedRecipe(provider, "iron_trapdoor", new ItemStack(Blocks.IRON_TRAPDOOR), "SPS", "PTP", "sPd", + VanillaRecipeHelper.addShapedRecipe(provider, "iron_trapdoor", new ItemStack(Blocks.IRON_TRAPDOOR), "SPS", + "PTP", "sPd", 'S', new UnificationEntry(TagPrefix.screw, GTMaterials.Iron), 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Iron), - 'T', ItemTags.WOODEN_TRAPDOORS - ); - - VanillaRecipeHelper.addShapedRecipe(provider, "minecart_iron", new ItemStack(Items.MINECART), " h ", "PwP", "WPW", - 'W', GTItems.IRON_MINECART_WHEELS.asStack(), - 'P', new UnificationEntry(plate, Iron) - ); - VanillaRecipeHelper.addShapedRecipe(provider, "minecart_steel", new ItemStack(Items.MINECART), " h ", "PwP", "WPW", - 'W', GTItems.STEEL_MINECART_WHEELS.asStack(), - 'P', new UnificationEntry(plate, Steel) - ); + 'T', ItemTags.WOODEN_TRAPDOORS); + + VanillaRecipeHelper.addShapedRecipe(provider, "minecart_iron", new ItemStack(Items.MINECART), " h ", "PwP", + "WPW", + 'W', GTItems.IRON_MINECART_WHEELS.asStack(), + 'P', new UnificationEntry(plate, Iron)); + VanillaRecipeHelper.addShapedRecipe(provider, "minecart_steel", new ItemStack(Items.MINECART), " h ", "PwP", + "WPW", + 'W', GTItems.STEEL_MINECART_WHEELS.asStack(), + 'P', new UnificationEntry(plate, Steel)); } private static void flintAndSteelRequireSteel(Consumer provider) { - VanillaRecipeHelper.addShapedRecipe(provider, "flint_and_steel", new ItemStack(Items.FLINT_AND_STEEL), "G", "F", "S", + VanillaRecipeHelper.addShapedRecipe(provider, "flint_and_steel", new ItemStack(Items.FLINT_AND_STEEL), "G", "F", + "S", 'G', new UnificationEntry(TagPrefix.gearSmall, GTMaterials.Steel), 'F', new ItemStack(Items.FLINT), - 'S', new UnificationEntry(TagPrefix.springSmall, GTMaterials.Steel) - ); + 'S', new UnificationEntry(TagPrefix.springSmall, GTMaterials.Steel)); } private static void removeVanillaBlockRecipes(Consumer provider) { - VanillaRecipeHelper.addShapedRecipe(provider, "stone_slab_saw", new ItemStack(Blocks.STONE_SLAB), "sS", 'S', new ItemStack(Blocks.STONE)); - VanillaRecipeHelper.addShapedRecipe(provider, "smooth_stone_slab_saw", new ItemStack(Blocks.SMOOTH_STONE_SLAB), "sS", 'S', new ItemStack(Blocks.SMOOTH_STONE)); - VanillaRecipeHelper.addShapedRecipe(provider, "andesite_slab_saw", new ItemStack(Blocks.ANDESITE_SLAB), "sS", 'S', new ItemStack(Blocks.ANDESITE)); - VanillaRecipeHelper.addShapedRecipe(provider, "granite_slab_saw", new ItemStack(Blocks.GRANITE_SLAB), "sS", 'S', new ItemStack(Blocks.GRANITE)); - VanillaRecipeHelper.addShapedRecipe(provider, "diorite_slab_saw", new ItemStack(Blocks.DIORITE_SLAB), "sS", 'S', new ItemStack(Blocks.DIORITE)); - VanillaRecipeHelper.addShapedRecipe(provider, "polished_andesite_slab_saw", new ItemStack(Blocks.POLISHED_ANDESITE_SLAB), "sS", 'S', new ItemStack(Blocks.POLISHED_ANDESITE)); - VanillaRecipeHelper.addShapedRecipe(provider, "polished_granite_slab_saw", new ItemStack(Blocks.POLISHED_GRANITE_SLAB), "sS", 'S', new ItemStack(Blocks.POLISHED_GRANITE)); - VanillaRecipeHelper.addShapedRecipe(provider, "polished_diorite_slab_saw", new ItemStack(Blocks.POLISHED_DIORITE_SLAB), "sS", 'S', new ItemStack(Blocks.POLISHED_DIORITE)); - VanillaRecipeHelper.addShapedRecipe(provider, "sandstone_slab_saw", new ItemStack(Blocks.SANDSTONE_SLAB), "sS", 'S', new ItemStack(Blocks.SANDSTONE)); - VanillaRecipeHelper.addShapedRecipe(provider, "smooth_sandstone_slab_saw", new ItemStack(Blocks.SMOOTH_SANDSTONE_SLAB), "sS", 'S', new ItemStack(Blocks.SMOOTH_SANDSTONE)); - VanillaRecipeHelper.addShapedRecipe(provider, "red_sandstone_slab_saw", new ItemStack(Blocks.RED_SANDSTONE_SLAB), "sS", 'S', new ItemStack(Blocks.RED_SANDSTONE)); - VanillaRecipeHelper.addShapedRecipe(provider, "smooth_red_sandstone_slab_saw", new ItemStack(Blocks.SMOOTH_RED_SANDSTONE_SLAB), "sS", 'S', new ItemStack(Blocks.SMOOTH_RED_SANDSTONE)); - VanillaRecipeHelper.addShapedRecipe(provider, "cobblestone_slab_saw", new ItemStack(Blocks.COBBLESTONE_SLAB), "sS", 'S', new ItemStack(Blocks.COBBLESTONE)); - VanillaRecipeHelper.addShapedRecipe(provider, "blackstone_slab_saw", new ItemStack(Blocks.BLACKSTONE_SLAB), "sS", 'S', new ItemStack(Blocks.BLACKSTONE)); - VanillaRecipeHelper.addShapedRecipe(provider, "polished_blackstone_slab_saw", new ItemStack(Blocks.POLISHED_BLACKSTONE_SLAB), "sS", 'S', new ItemStack(Blocks.POLISHED_BLACKSTONE)); - VanillaRecipeHelper.addShapedRecipe(provider, "polished_blackstone_brick_slab_saw", new ItemStack(Blocks.POLISHED_BLACKSTONE_BRICK_SLAB), "sS", 'S', new ItemStack(Blocks.POLISHED_BLACKSTONE_BRICKS)); - VanillaRecipeHelper.addShapedRecipe(provider, "brick_slab_saw", new ItemStack(Blocks.BRICK_SLAB), "sS", 'S', new ItemStack(Blocks.BRICKS)); - VanillaRecipeHelper.addShapedRecipe(provider, "mud_brick_slab_saw", new ItemStack(Blocks.MUD_BRICK_SLAB), "sS", 'S', new ItemStack(Blocks.MUD_BRICKS)); - VanillaRecipeHelper.addShapedRecipe(provider, "stone_brick_slab_saw", new ItemStack(Blocks.STONE_BRICK_SLAB), "sS", 'S', ItemTags.STONE_BRICKS); - VanillaRecipeHelper.addShapedRecipe(provider, "nether_brick_slab_saw", new ItemStack(Blocks.NETHER_BRICK_SLAB), "sS", 'S', new ItemStack(Blocks.NETHER_BRICKS)); - VanillaRecipeHelper.addShapedRecipe(provider, "red_nether_brick_slab_saw", new ItemStack(Blocks.RED_NETHER_BRICK_SLAB), "sS", 'S', new ItemStack(Blocks.RED_NETHER_BRICKS)); - VanillaRecipeHelper.addShapedRecipe(provider, "quartz_slab_saw", new ItemStack(Blocks.QUARTZ_SLAB), "sS", 'S', new ItemStack(Blocks.QUARTZ_BLOCK)); - VanillaRecipeHelper.addShapedRecipe(provider, "smooth_quartz_slab_saw", new ItemStack(Blocks.SMOOTH_QUARTZ_SLAB), "sS", 'S', new ItemStack(Blocks.SMOOTH_QUARTZ)); - VanillaRecipeHelper.addShapedRecipe(provider, "cut_copper_slab_saw", new ItemStack(Blocks.CUT_COPPER_SLAB), "sS", 'S', new ItemStack(Blocks.CUT_COPPER)); - VanillaRecipeHelper.addShapedRecipe(provider, "exposed_cut_copper_slab_saw", new ItemStack(Blocks.EXPOSED_CUT_COPPER_SLAB), "sS", 'S', new ItemStack(Blocks.EXPOSED_CUT_COPPER)); - VanillaRecipeHelper.addShapedRecipe(provider, "oxidized_cut_copper_slab_saw", new ItemStack(Blocks.OXIDIZED_CUT_COPPER_SLAB), "sS", 'S', new ItemStack(Blocks.OXIDIZED_CUT_COPPER)); - VanillaRecipeHelper.addShapedRecipe(provider, "weathered_cut_copper_slab_saw", new ItemStack(Blocks.WEATHERED_CUT_COPPER_SLAB), "sS", 'S', new ItemStack(Blocks.OXIDIZED_CUT_COPPER)); - VanillaRecipeHelper.addShapedRecipe(provider, "waxed_cut_copper_slab_saw", new ItemStack(Blocks.WAXED_CUT_COPPER_SLAB), "sS", 'S', new ItemStack(Blocks.WAXED_CUT_COPPER)); - VanillaRecipeHelper.addShapedRecipe(provider, "waxed_exposed_cut_copper_slab_saw", new ItemStack(Blocks.WAXED_EXPOSED_CUT_COPPER_SLAB), "sS", 'S', new ItemStack(Blocks.WAXED_EXPOSED_CUT_COPPER)); - VanillaRecipeHelper.addShapedRecipe(provider, "waxed_oxidized_cut_copper_slab_saw", new ItemStack(Blocks.WAXED_OXIDIZED_CUT_COPPER_SLAB), "sS", 'S', new ItemStack(Blocks.WAXED_OXIDIZED_CUT_COPPER)); - VanillaRecipeHelper.addShapedRecipe(provider, "waxed_weathered_cut_copper_slab_saw", new ItemStack(Blocks.WAXED_WEATHERED_CUT_COPPER_SLAB), "sS", 'S', new ItemStack(Blocks.WAXED_OXIDIZED_CUT_COPPER)); - VanillaRecipeHelper.addShapedRecipe(provider, "purpur_slab_saw", new ItemStack(Blocks.PURPUR_SLAB), "sS", 'S', new ItemStack(Blocks.PURPUR_BLOCK)); - VanillaRecipeHelper.addShapedRecipe(provider, "end_stone_brick_slab_saw", new ItemStack(Blocks.END_STONE_BRICK_SLAB), "sS", 'S', new ItemStack(Blocks.END_STONE_BRICKS)); - VanillaRecipeHelper.addShapedRecipe(provider, "prismarine_slab_saw", new ItemStack(Blocks.PRISMARINE_SLAB), "sS", 'S', new ItemStack(Blocks.PRISMARINE)); - VanillaRecipeHelper.addShapedRecipe(provider, "prismarine_brick_slab_saw", new ItemStack(Blocks.PRISMARINE_BRICK_SLAB), "sS", 'S', new ItemStack(Blocks.PRISMARINE_BRICKS)); - VanillaRecipeHelper.addShapedRecipe(provider, "dark_prismarine_slab_saw", new ItemStack(Blocks.DARK_PRISMARINE_SLAB), "sS", 'S', new ItemStack(Blocks.DARK_PRISMARINE)); + VanillaRecipeHelper.addShapedRecipe(provider, "stone_slab_saw", new ItemStack(Blocks.STONE_SLAB), "sS", 'S', + new ItemStack(Blocks.STONE)); + VanillaRecipeHelper.addShapedRecipe(provider, "smooth_stone_slab_saw", new ItemStack(Blocks.SMOOTH_STONE_SLAB), + "sS", 'S', new ItemStack(Blocks.SMOOTH_STONE)); + VanillaRecipeHelper.addShapedRecipe(provider, "andesite_slab_saw", new ItemStack(Blocks.ANDESITE_SLAB), "sS", + 'S', new ItemStack(Blocks.ANDESITE)); + VanillaRecipeHelper.addShapedRecipe(provider, "granite_slab_saw", new ItemStack(Blocks.GRANITE_SLAB), "sS", 'S', + new ItemStack(Blocks.GRANITE)); + VanillaRecipeHelper.addShapedRecipe(provider, "diorite_slab_saw", new ItemStack(Blocks.DIORITE_SLAB), "sS", 'S', + new ItemStack(Blocks.DIORITE)); + VanillaRecipeHelper.addShapedRecipe(provider, "polished_andesite_slab_saw", + new ItemStack(Blocks.POLISHED_ANDESITE_SLAB), "sS", 'S', new ItemStack(Blocks.POLISHED_ANDESITE)); + VanillaRecipeHelper.addShapedRecipe(provider, "polished_granite_slab_saw", + new ItemStack(Blocks.POLISHED_GRANITE_SLAB), "sS", 'S', new ItemStack(Blocks.POLISHED_GRANITE)); + VanillaRecipeHelper.addShapedRecipe(provider, "polished_diorite_slab_saw", + new ItemStack(Blocks.POLISHED_DIORITE_SLAB), "sS", 'S', new ItemStack(Blocks.POLISHED_DIORITE)); + VanillaRecipeHelper.addShapedRecipe(provider, "sandstone_slab_saw", new ItemStack(Blocks.SANDSTONE_SLAB), "sS", + 'S', new ItemStack(Blocks.SANDSTONE)); + VanillaRecipeHelper.addShapedRecipe(provider, "smooth_sandstone_slab_saw", + new ItemStack(Blocks.SMOOTH_SANDSTONE_SLAB), "sS", 'S', new ItemStack(Blocks.SMOOTH_SANDSTONE)); + VanillaRecipeHelper.addShapedRecipe(provider, "red_sandstone_slab_saw", + new ItemStack(Blocks.RED_SANDSTONE_SLAB), "sS", 'S', new ItemStack(Blocks.RED_SANDSTONE)); + VanillaRecipeHelper.addShapedRecipe(provider, "smooth_red_sandstone_slab_saw", + new ItemStack(Blocks.SMOOTH_RED_SANDSTONE_SLAB), "sS", 'S', new ItemStack(Blocks.SMOOTH_RED_SANDSTONE)); + VanillaRecipeHelper.addShapedRecipe(provider, "cobblestone_slab_saw", new ItemStack(Blocks.COBBLESTONE_SLAB), + "sS", 'S', new ItemStack(Blocks.COBBLESTONE)); + VanillaRecipeHelper.addShapedRecipe(provider, "blackstone_slab_saw", new ItemStack(Blocks.BLACKSTONE_SLAB), + "sS", 'S', new ItemStack(Blocks.BLACKSTONE)); + VanillaRecipeHelper.addShapedRecipe(provider, "polished_blackstone_slab_saw", + new ItemStack(Blocks.POLISHED_BLACKSTONE_SLAB), "sS", 'S', new ItemStack(Blocks.POLISHED_BLACKSTONE)); + VanillaRecipeHelper.addShapedRecipe(provider, "polished_blackstone_brick_slab_saw", + new ItemStack(Blocks.POLISHED_BLACKSTONE_BRICK_SLAB), "sS", 'S', + new ItemStack(Blocks.POLISHED_BLACKSTONE_BRICKS)); + VanillaRecipeHelper.addShapedRecipe(provider, "brick_slab_saw", new ItemStack(Blocks.BRICK_SLAB), "sS", 'S', + new ItemStack(Blocks.BRICKS)); + VanillaRecipeHelper.addShapedRecipe(provider, "mud_brick_slab_saw", new ItemStack(Blocks.MUD_BRICK_SLAB), "sS", + 'S', new ItemStack(Blocks.MUD_BRICKS)); + VanillaRecipeHelper.addShapedRecipe(provider, "stone_brick_slab_saw", new ItemStack(Blocks.STONE_BRICK_SLAB), + "sS", 'S', ItemTags.STONE_BRICKS); + VanillaRecipeHelper.addShapedRecipe(provider, "nether_brick_slab_saw", new ItemStack(Blocks.NETHER_BRICK_SLAB), + "sS", 'S', new ItemStack(Blocks.NETHER_BRICKS)); + VanillaRecipeHelper.addShapedRecipe(provider, "red_nether_brick_slab_saw", + new ItemStack(Blocks.RED_NETHER_BRICK_SLAB), "sS", 'S', new ItemStack(Blocks.RED_NETHER_BRICKS)); + VanillaRecipeHelper.addShapedRecipe(provider, "quartz_slab_saw", new ItemStack(Blocks.QUARTZ_SLAB), "sS", 'S', + new ItemStack(Blocks.QUARTZ_BLOCK)); + VanillaRecipeHelper.addShapedRecipe(provider, "smooth_quartz_slab_saw", + new ItemStack(Blocks.SMOOTH_QUARTZ_SLAB), "sS", 'S', new ItemStack(Blocks.SMOOTH_QUARTZ)); + VanillaRecipeHelper.addShapedRecipe(provider, "cut_copper_slab_saw", new ItemStack(Blocks.CUT_COPPER_SLAB), + "sS", 'S', new ItemStack(Blocks.CUT_COPPER)); + VanillaRecipeHelper.addShapedRecipe(provider, "exposed_cut_copper_slab_saw", + new ItemStack(Blocks.EXPOSED_CUT_COPPER_SLAB), "sS", 'S', new ItemStack(Blocks.EXPOSED_CUT_COPPER)); + VanillaRecipeHelper.addShapedRecipe(provider, "oxidized_cut_copper_slab_saw", + new ItemStack(Blocks.OXIDIZED_CUT_COPPER_SLAB), "sS", 'S', new ItemStack(Blocks.OXIDIZED_CUT_COPPER)); + VanillaRecipeHelper.addShapedRecipe(provider, "weathered_cut_copper_slab_saw", + new ItemStack(Blocks.WEATHERED_CUT_COPPER_SLAB), "sS", 'S', new ItemStack(Blocks.OXIDIZED_CUT_COPPER)); + VanillaRecipeHelper.addShapedRecipe(provider, "waxed_cut_copper_slab_saw", + new ItemStack(Blocks.WAXED_CUT_COPPER_SLAB), "sS", 'S', new ItemStack(Blocks.WAXED_CUT_COPPER)); + VanillaRecipeHelper.addShapedRecipe(provider, "waxed_exposed_cut_copper_slab_saw", + new ItemStack(Blocks.WAXED_EXPOSED_CUT_COPPER_SLAB), "sS", 'S', + new ItemStack(Blocks.WAXED_EXPOSED_CUT_COPPER)); + VanillaRecipeHelper.addShapedRecipe(provider, "waxed_oxidized_cut_copper_slab_saw", + new ItemStack(Blocks.WAXED_OXIDIZED_CUT_COPPER_SLAB), "sS", 'S', + new ItemStack(Blocks.WAXED_OXIDIZED_CUT_COPPER)); + VanillaRecipeHelper.addShapedRecipe(provider, "waxed_weathered_cut_copper_slab_saw", + new ItemStack(Blocks.WAXED_WEATHERED_CUT_COPPER_SLAB), "sS", 'S', + new ItemStack(Blocks.WAXED_OXIDIZED_CUT_COPPER)); + VanillaRecipeHelper.addShapedRecipe(provider, "purpur_slab_saw", new ItemStack(Blocks.PURPUR_SLAB), "sS", 'S', + new ItemStack(Blocks.PURPUR_BLOCK)); + VanillaRecipeHelper.addShapedRecipe(provider, "end_stone_brick_slab_saw", + new ItemStack(Blocks.END_STONE_BRICK_SLAB), "sS", 'S', new ItemStack(Blocks.END_STONE_BRICKS)); + VanillaRecipeHelper.addShapedRecipe(provider, "prismarine_slab_saw", new ItemStack(Blocks.PRISMARINE_SLAB), + "sS", 'S', new ItemStack(Blocks.PRISMARINE)); + VanillaRecipeHelper.addShapedRecipe(provider, "prismarine_brick_slab_saw", + new ItemStack(Blocks.PRISMARINE_BRICK_SLAB), "sS", 'S', new ItemStack(Blocks.PRISMARINE_BRICKS)); + VanillaRecipeHelper.addShapedRecipe(provider, "dark_prismarine_slab_saw", + new ItemStack(Blocks.DARK_PRISMARINE_SLAB), "sS", 'S', new ItemStack(Blocks.DARK_PRISMARINE)); } - private static void createShovelRecipe(Consumer provider, String regName, ItemStack output, Material material) { + private static void createShovelRecipe(Consumer provider, String regName, ItemStack output, + Material material) { VanillaRecipeHelper.addShapedRecipe(provider, regName, output, "hPf", " S ", " S ", 'P', new UnificationEntry(TagPrefix.plate, material), - 'S', new UnificationEntry(TagPrefix.rod, GTMaterials.Wood) - ); + 'S', new UnificationEntry(TagPrefix.rod, GTMaterials.Wood)); } - private static void createPickaxeRecipe(Consumer provider, String regName, ItemStack output, Material material) { + private static void createPickaxeRecipe(Consumer provider, String regName, ItemStack output, + Material material) { VanillaRecipeHelper.addShapedRecipe(provider, regName, output, "PII", "hSf", " S ", 'P', new UnificationEntry(TagPrefix.plate, material), - 'I', new UnificationEntry(material.equals(GTMaterials.Diamond) ? TagPrefix.gem : TagPrefix.ingot, material), - 'S', new UnificationEntry(TagPrefix.rod, GTMaterials.Wood) - ); + 'I', + new UnificationEntry(material.equals(GTMaterials.Diamond) ? TagPrefix.gem : TagPrefix.ingot, material), + 'S', new UnificationEntry(TagPrefix.rod, GTMaterials.Wood)); } - private static void createAxeRecipe(Consumer provider, String regName, ItemStack output, Material material) { + private static void createAxeRecipe(Consumer provider, String regName, ItemStack output, + Material material) { VanillaRecipeHelper.addShapedRecipe(provider, regName, output, "PIf", "PS ", "hS ", 'P', new UnificationEntry(TagPrefix.plate, material), - 'I', new UnificationEntry(material.equals(GTMaterials.Diamond) ? TagPrefix.gem : TagPrefix.ingot, material), - 'S', new UnificationEntry(TagPrefix.rod, GTMaterials.Wood) - ); + 'I', + new UnificationEntry(material.equals(GTMaterials.Diamond) ? TagPrefix.gem : TagPrefix.ingot, material), + 'S', new UnificationEntry(TagPrefix.rod, GTMaterials.Wood)); } - private static void createSwordRecipe(Consumer provider, String regName, ItemStack output, Material material) { + private static void createSwordRecipe(Consumer provider, String regName, ItemStack output, + Material material) { VanillaRecipeHelper.addShapedRecipe(provider, regName, output, " P ", "hPf", " S ", 'P', new UnificationEntry(TagPrefix.plate, material), - 'S', new UnificationEntry(TagPrefix.rod, GTMaterials.Wood) - ); + 'S', new UnificationEntry(TagPrefix.rod, GTMaterials.Wood)); } - private static void createHoeRecipe(Consumer provider, String regName, ItemStack output, Material material) { + private static void createHoeRecipe(Consumer provider, String regName, ItemStack output, + Material material) { VanillaRecipeHelper.addShapedRecipe(provider, regName, output, "PIf", "hS ", " S ", 'P', new UnificationEntry(TagPrefix.plate, material), - 'I', new UnificationEntry(material.equals(GTMaterials.Diamond) ? TagPrefix.gem : TagPrefix.ingot, material), - 'S', new UnificationEntry(TagPrefix.rod, GTMaterials.Wood) - ); + 'I', + new UnificationEntry(material.equals(GTMaterials.Diamond) ? TagPrefix.gem : TagPrefix.ingot, material), + 'S', new UnificationEntry(TagPrefix.rod, GTMaterials.Wood)); } - private static void createHelmetRecipe(Consumer provider, String regName, ItemStack output, Material material) { + private static void createHelmetRecipe(Consumer provider, String regName, ItemStack output, + Material material) { VanillaRecipeHelper.addShapedRecipe(provider, regName, output, "PPP", "PhP", - 'P', new UnificationEntry(TagPrefix.plate, material) - ); + 'P', new UnificationEntry(TagPrefix.plate, material)); } - private static void createChestplateRecipe(Consumer provider, String regName, ItemStack output, Material material) { + private static void createChestplateRecipe(Consumer provider, String regName, ItemStack output, + Material material) { VanillaRecipeHelper.addShapedRecipe(provider, regName, output, "PhP", "PPP", "PPP", - 'P', new UnificationEntry(TagPrefix.plate, material) - ); + 'P', new UnificationEntry(TagPrefix.plate, material)); } - private static void createLeggingsRecipe(Consumer provider, String regName, ItemStack output, Material material) { + private static void createLeggingsRecipe(Consumer provider, String regName, ItemStack output, + Material material) { VanillaRecipeHelper.addShapedRecipe(provider, regName, output, "PPP", "PhP", "P P", - 'P', new UnificationEntry(TagPrefix.plate, material) - ); + 'P', new UnificationEntry(TagPrefix.plate, material)); } - private static void createBootsRecipe(Consumer provider, String regName, ItemStack output, Material material) { + private static void createBootsRecipe(Consumer provider, String regName, ItemStack output, + Material material) { VanillaRecipeHelper.addShapedRecipe(provider, regName, output, "P P", "PhP", - 'P', new UnificationEntry(TagPrefix.plate, material) - ); + 'P', new UnificationEntry(TagPrefix.plate, material)); } } diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/configurable/RecipeRemoval.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/configurable/RecipeRemoval.java index 27c51a29e8..d93e582c80 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/configurable/RecipeRemoval.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/configurable/RecipeRemoval.java @@ -4,6 +4,7 @@ import com.gregtechceu.gtceu.api.data.chemical.material.MarkerMaterials; import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.data.recipe.misc.WoodMachineRecipes; + import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.DyeColor; @@ -31,42 +32,44 @@ public static void init(Consumer registry) { } private static void generalRemovals(Consumer registry) { - if (ConfigHolder.INSTANCE.recipes.removeVanillaTNTRecipe) registry.accept(new ResourceLocation("minecraft:tnt")); + if (ConfigHolder.INSTANCE.recipes.removeVanillaTNTRecipe) + registry.accept(new ResourceLocation("minecraft:tnt")); // todo /* - // always remove these, GT ore processing changes their output - ModHandler.removeFurnaceSmelting(new ItemStack(Blocks.COAL_ORE)); - ModHandler.removeFurnaceSmelting(new ItemStack(Blocks.IRON_ORE)); - ModHandler.removeFurnaceSmelting(new ItemStack(Blocks.GOLD_ORE)); - ModHandler.removeFurnaceSmelting(new ItemStack(Blocks.DIAMOND_ORE)); - ModHandler.removeFurnaceSmelting(new ItemStack(Blocks.EMERALD_ORE)); - ModHandler.removeFurnaceSmelting(new ItemStack(Blocks.LAPIS_ORE)); - ModHandler.removeFurnaceSmelting(new ItemStack(Blocks.REDSTONE_ORE)); - ModHandler.removeFurnaceSmelting(new ItemStack(Blocks.QUARTZ_ORE)); - - // Remove a bunch of processing recipes for tools and armor, since we have significantly better options - ModHandler.removeFurnaceSmelting(new ItemStack(Items.IRON_HELMET, 1, W)); - ModHandler.removeFurnaceSmelting(new ItemStack(Items.IRON_CHESTPLATE, 1, W)); - ModHandler.removeFurnaceSmelting(new ItemStack(Items.IRON_LEGGINGS, 1, W)); - ModHandler.removeFurnaceSmelting(new ItemStack(Items.IRON_BOOTS, 1, W)); - ModHandler.removeFurnaceSmelting(new ItemStack(Items.IRON_HORSE_ARMOR, 1, W)); - ModHandler.removeFurnaceSmelting(new ItemStack(Items.IRON_PICKAXE, 1, W)); - ModHandler.removeFurnaceSmelting(new ItemStack(Items.IRON_SHOVEL, 1, W)); - ModHandler.removeFurnaceSmelting(new ItemStack(Items.IRON_AXE, 1, W)); - ModHandler.removeFurnaceSmelting(new ItemStack(Items.IRON_SWORD, 1, W)); - ModHandler.removeFurnaceSmelting(new ItemStack(Items.IRON_HOE, 1, W)); - - ModHandler.removeFurnaceSmelting(new ItemStack(Items.GOLDEN_HELMET, 1, W)); - ModHandler.removeFurnaceSmelting(new ItemStack(Items.GOLDEN_CHESTPLATE, 1, W)); - ModHandler.removeFurnaceSmelting(new ItemStack(Items.GOLDEN_LEGGINGS, 1, W)); - ModHandler.removeFurnaceSmelting(new ItemStack(Items.GOLDEN_BOOTS, 1, W)); - ModHandler.removeFurnaceSmelting(new ItemStack(Items.GOLDEN_HORSE_ARMOR, 1, W)); - ModHandler.removeFurnaceSmelting(new ItemStack(Items.GOLDEN_PICKAXE, 1, W)); - ModHandler.removeFurnaceSmelting(new ItemStack(Items.GOLDEN_SHOVEL, 1, W)); - ModHandler.removeFurnaceSmelting(new ItemStack(Items.GOLDEN_AXE, 1, W)); - ModHandler.removeFurnaceSmelting(new ItemStack(Items.GOLDEN_SWORD, 1, W)); - ModHandler.removeFurnaceSmelting(new ItemStack(Items.GOLDEN_HOE, 1, W));*/ + * // always remove these, GT ore processing changes their output + * ModHandler.removeFurnaceSmelting(new ItemStack(Blocks.COAL_ORE)); + * ModHandler.removeFurnaceSmelting(new ItemStack(Blocks.IRON_ORE)); + * ModHandler.removeFurnaceSmelting(new ItemStack(Blocks.GOLD_ORE)); + * ModHandler.removeFurnaceSmelting(new ItemStack(Blocks.DIAMOND_ORE)); + * ModHandler.removeFurnaceSmelting(new ItemStack(Blocks.EMERALD_ORE)); + * ModHandler.removeFurnaceSmelting(new ItemStack(Blocks.LAPIS_ORE)); + * ModHandler.removeFurnaceSmelting(new ItemStack(Blocks.REDSTONE_ORE)); + * ModHandler.removeFurnaceSmelting(new ItemStack(Blocks.QUARTZ_ORE)); + * + * // Remove a bunch of processing recipes for tools and armor, since we have significantly better options + * ModHandler.removeFurnaceSmelting(new ItemStack(Items.IRON_HELMET, 1, W)); + * ModHandler.removeFurnaceSmelting(new ItemStack(Items.IRON_CHESTPLATE, 1, W)); + * ModHandler.removeFurnaceSmelting(new ItemStack(Items.IRON_LEGGINGS, 1, W)); + * ModHandler.removeFurnaceSmelting(new ItemStack(Items.IRON_BOOTS, 1, W)); + * ModHandler.removeFurnaceSmelting(new ItemStack(Items.IRON_HORSE_ARMOR, 1, W)); + * ModHandler.removeFurnaceSmelting(new ItemStack(Items.IRON_PICKAXE, 1, W)); + * ModHandler.removeFurnaceSmelting(new ItemStack(Items.IRON_SHOVEL, 1, W)); + * ModHandler.removeFurnaceSmelting(new ItemStack(Items.IRON_AXE, 1, W)); + * ModHandler.removeFurnaceSmelting(new ItemStack(Items.IRON_SWORD, 1, W)); + * ModHandler.removeFurnaceSmelting(new ItemStack(Items.IRON_HOE, 1, W)); + * + * ModHandler.removeFurnaceSmelting(new ItemStack(Items.GOLDEN_HELMET, 1, W)); + * ModHandler.removeFurnaceSmelting(new ItemStack(Items.GOLDEN_CHESTPLATE, 1, W)); + * ModHandler.removeFurnaceSmelting(new ItemStack(Items.GOLDEN_LEGGINGS, 1, W)); + * ModHandler.removeFurnaceSmelting(new ItemStack(Items.GOLDEN_BOOTS, 1, W)); + * ModHandler.removeFurnaceSmelting(new ItemStack(Items.GOLDEN_HORSE_ARMOR, 1, W)); + * ModHandler.removeFurnaceSmelting(new ItemStack(Items.GOLDEN_PICKAXE, 1, W)); + * ModHandler.removeFurnaceSmelting(new ItemStack(Items.GOLDEN_SHOVEL, 1, W)); + * ModHandler.removeFurnaceSmelting(new ItemStack(Items.GOLDEN_AXE, 1, W)); + * ModHandler.removeFurnaceSmelting(new ItemStack(Items.GOLDEN_SWORD, 1, W)); + * ModHandler.removeFurnaceSmelting(new ItemStack(Items.GOLDEN_HOE, 1, W)); + */ } private static void disableManualCompression(Consumer registry) { @@ -93,8 +96,8 @@ private static void disableManualCompression(Consumer registry registry.accept(new ResourceLocation("minecraft:nether_brick")); registry.accept(new ResourceLocation("minecraft:glowstone")); // TODO netherite material - //registry.accept(new ResourceLocation("minecraft:netherite_block")); - //registry.accept(new ResourceLocation("minecraft:netherite_ingot_from_netherite_block")); + // registry.accept(new ResourceLocation("minecraft:netherite_block")); + // registry.accept(new ResourceLocation("minecraft:netherite_ingot_from_netherite_block")); } private static void harderBrickRecipes(Consumer registry) { @@ -165,7 +168,7 @@ private static void hardToolArmorRecipes(Consumer registry) { registry.accept(new ResourceLocation("minecraft:clock")); registry.accept(new ResourceLocation("minecraft:shears")); registry.accept(new ResourceLocation("minecraft:shield")); - for (String type : new String[]{"iron", "golden", "diamond"}) { + for (String type : new String[] { "iron", "golden", "diamond" }) { registry.accept(new ResourceLocation("minecraft:" + type + "_shovel")); registry.accept(new ResourceLocation("minecraft:" + type + "_pickaxe")); registry.accept(new ResourceLocation("minecraft:" + type + "_axe")); @@ -231,8 +234,10 @@ private static void hardGlassRecipes(Consumer registry) { registry.accept(new ResourceLocation("minecraft:glass_bottle")); registry.accept(new ResourceLocation("minecraft:glass_pane")); for (DyeColor color : DyeColor.values()) { - registry.accept(new ResourceLocation(String.format("minecraft:%s_stained_glass_pane_from_glass_pane", color.name().toLowerCase(Locale.ROOT)))); - registry.accept(new ResourceLocation(String.format("minecraft:%s_stained_glass_pane", color.name().toLowerCase(Locale.ROOT)))); + registry.accept(new ResourceLocation(String.format("minecraft:%s_stained_glass_pane_from_glass_pane", + color.name().toLowerCase(Locale.ROOT)))); + registry.accept(new ResourceLocation( + String.format("minecraft:%s_stained_glass_pane", color.name().toLowerCase(Locale.ROOT)))); } } @@ -250,7 +255,8 @@ private static void hardAdvancedIronRecipes(Consumer registry) private static void hardDyeRecipes(Consumer registry) { for (MarkerMaterial colorMaterial : MarkerMaterials.Color.VALUES) { - registry.accept(new ResourceLocation(String.format("minecraft:%s_concrete_powder", colorMaterial.getName()))); + registry.accept( + new ResourceLocation(String.format("minecraft:%s_concrete_powder", colorMaterial.getName()))); registry.accept(new ResourceLocation(String.format("minecraft:%s_terracotta", colorMaterial.getName()))); registry.accept(new ResourceLocation(String.format("minecraft:%s_stained_glass", colorMaterial.getName()))); if (colorMaterial != MarkerMaterials.Color.White) { diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/DecompositionRecipeHandler.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/DecompositionRecipeHandler.java index 26db168c76..b9e4f2bfc4 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/DecompositionRecipeHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/DecompositionRecipeHandler.java @@ -5,10 +5,11 @@ import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.api.data.chemical.material.properties.PropertyKey; import com.gregtechceu.gtceu.api.data.chemical.material.stack.MaterialStack; -import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.api.data.tag.TagPrefix; import com.gregtechceu.gtceu.data.recipe.builder.GTRecipeBuilder; + import com.lowdragmc.lowdraglib.side.fluid.FluidStack; + import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.world.item.ItemStack; @@ -31,19 +32,21 @@ public static void init(Consumer provider) { } } - private static void processDecomposition(TagPrefix decomposePrefix, Material material, Consumer provider) { + private static void processDecomposition(TagPrefix decomposePrefix, Material material, + Consumer provider) { if (material.getMaterialComponents().isEmpty() || (!material.hasFlag(DECOMPOSITION_BY_ELECTROLYZING) && !material.hasFlag(DECOMPOSITION_BY_CENTRIFUGING)) || - //disable decomposition if explicitly disabled for this material or for one of it's components + // disable decomposition if explicitly disabled for this material or for one of it's components material.hasFlag(DISABLE_DECOMPOSITION) || - material.getMaterialComponents().size() > 6) return; + material.getMaterialComponents().size() > 6) + return; List outputs = new ArrayList<>(); List fluidOutputs = new ArrayList<>(); int totalInputAmount = 0; - //compute outputs + // compute outputs for (MaterialStack component : material.getMaterialComponents()) { totalInputAmount += component.amount(); if (component.material().hasProperty(PropertyKey.DUST)) { @@ -53,9 +56,9 @@ private static void processDecomposition(TagPrefix decomposePrefix, Material mat } } - //only reduce items + // only reduce items if (decomposePrefix != null) { - //calculate lowest common denominator + // calculate lowest common denominator List materialAmounts = new ArrayList<>(); materialAmounts.add(totalInputAmount); outputs.forEach(itemStack -> materialAmounts.add(itemStack.getCount())); @@ -69,7 +72,7 @@ private static void processDecomposition(TagPrefix decomposePrefix, Material mat highestDivisor = i; } - //divide components + // divide components if (highestDivisor != 1) { List reducedOutputs = new ArrayList<>(); @@ -93,8 +96,7 @@ private static void processDecomposition(TagPrefix decomposePrefix, Material mat } } - - //generate builder + // generate builder GTRecipeBuilder builder; if (material.hasFlag(DECOMPOSITION_BY_ELECTROLYZING)) { builder = ELECTROLYZER_RECIPES.recipeBuilder("decomposition_electrolyzing", material.getName()) @@ -108,14 +110,14 @@ private static void processDecomposition(TagPrefix decomposePrefix, Material mat builder.outputItems(outputs.toArray(ItemStack[]::new)); builder.outputFluids(fluidOutputs.toArray(FluidStack[]::new)); - //finish builder + // finish builder if (decomposePrefix != null) { builder.inputItems(decomposePrefix, material, totalInputAmount); } else { builder.inputFluids(material.getFluid(1000)); } - //register recipe + // register recipe builder.save(provider); } @@ -130,5 +132,4 @@ private static boolean isEveryMaterialReducible(int divisor, List mater private static int getSmallestMaterialAmount(List materialAmounts) { return materialAmounts.stream().min(Integer::compare).orElse(0); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/MaterialRecipeHandler.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/MaterialRecipeHandler.java index c72e7e8bb7..6d2d8e6edb 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/MaterialRecipeHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/MaterialRecipeHandler.java @@ -18,6 +18,7 @@ import com.gregtechceu.gtceu.data.recipe.builder.GTRecipeBuilder; import com.gregtechceu.gtceu.utils.FormattingUtil; import com.gregtechceu.gtceu.utils.GTUtil; + import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.util.Mth; import net.minecraft.world.item.ItemStack; @@ -35,8 +36,9 @@ public class MaterialRecipeHandler { - private static final List GEM_ORDER = ConfigHolder.INSTANCE.recipes.generateLowQualityGems ? Arrays.asList( - gemChipped, gemFlawed, gem, gemFlawless, gemExquisite) : + private static final List GEM_ORDER = ConfigHolder.INSTANCE.recipes.generateLowQualityGems ? + Arrays.asList( + gemChipped, gemFlawed, gem, gemFlawless, gemExquisite) : Arrays.asList(gem, gemFlawless, gemExquisite); public static void init(Consumer provider) { @@ -55,10 +57,12 @@ public static void init(Consumer provider) { } } - public static void processDust(TagPrefix dustPrefix, Material mat, DustProperty property, Consumer provider) { - String id = "%s_%s_".formatted(FormattingUtil.toLowerCaseUnder(dustPrefix.name), mat.getName().toLowerCase(Locale.ROOT)); + public static void processDust(TagPrefix dustPrefix, Material mat, DustProperty property, + Consumer provider) { + String id = "%s_%s_".formatted(FormattingUtil.toLowerCaseUnder(dustPrefix.name), + mat.getName().toLowerCase(Locale.ROOT)); ItemStack dustStack = ChemicalHelper.get(dustPrefix, mat); - OreProperty oreProperty = mat.hasProperty(PropertyKey.ORE) ? mat.getProperty(PropertyKey.ORE): null; + OreProperty oreProperty = mat.hasProperty(PropertyKey.ORE) ? mat.getProperty(PropertyKey.ORE) : null; if (mat.hasProperty(PropertyKey.GEM)) { ItemStack gemStack = ChemicalHelper.get(gem, mat); @@ -80,32 +84,32 @@ public static void processDust(TagPrefix dustPrefix, Material mat, DustProperty if (!mat.hasFlag(EXPLOSIVE) && !mat.hasFlag(FLAMMABLE)) { IMPLOSION_RECIPES.recipeBuilder("implode_" + id + "_powderbarrel") - .inputItems(GTUtil.copyAmount(4, dustStack)) - .outputItems(GTUtil.copyAmount(3, gemStack)) - .chancedOutput(dust, GTMaterials.DarkAsh, 2500, 0) - .explosivesType(new ItemStack(GTBlocks.POWDERBARREL, 8)) - .save(provider); + .inputItems(GTUtil.copyAmount(4, dustStack)) + .outputItems(GTUtil.copyAmount(3, gemStack)) + .chancedOutput(dust, GTMaterials.DarkAsh, 2500, 0) + .explosivesType(new ItemStack(GTBlocks.POWDERBARREL, 8)) + .save(provider); IMPLOSION_RECIPES.recipeBuilder("implode_" + id + "_tnt") - .inputItems(GTUtil.copyAmount(4, dustStack)) - .outputItems(GTUtil.copyAmount(3, gemStack)) - .chancedOutput(dust, GTMaterials.DarkAsh, 2500, 0) - .explosivesAmount(4) - .save(provider); + .inputItems(GTUtil.copyAmount(4, dustStack)) + .outputItems(GTUtil.copyAmount(3, gemStack)) + .chancedOutput(dust, GTMaterials.DarkAsh, 2500, 0) + .explosivesAmount(4) + .save(provider); IMPLOSION_RECIPES.recipeBuilder("implode_" + id + "_dynamite") - .inputItems(GTUtil.copyAmount(4, dustStack)) - .outputItems(GTUtil.copyAmount(3, gemStack)) - .chancedOutput(dust, GTMaterials.DarkAsh, 2500, 0) - .explosivesType(GTItems.DYNAMITE.asStack(2)) - .save(provider); + .inputItems(GTUtil.copyAmount(4, dustStack)) + .outputItems(GTUtil.copyAmount(3, gemStack)) + .chancedOutput(dust, GTMaterials.DarkAsh, 2500, 0) + .explosivesType(GTItems.DYNAMITE.asStack(2)) + .save(provider); IMPLOSION_RECIPES.recipeBuilder("implode_" + id + "_itnt") - .inputItems(GTUtil.copyAmount(4, dustStack)) - .outputItems(GTUtil.copyAmount(3, gemStack)) - .chancedOutput(dust, GTMaterials.DarkAsh, 2500, 0) - .explosivesType(new ItemStack(GTBlocks.INDUSTRIAL_TNT)) - .save(provider); + .inputItems(GTUtil.copyAmount(4, dustStack)) + .outputItems(GTUtil.copyAmount(3, gemStack)) + .chancedOutput(dust, GTMaterials.DarkAsh, 2500, 0) + .explosivesType(new ItemStack(GTBlocks.INDUSTRIAL_TNT)) + .save(provider); } if (oreProperty != null) { @@ -169,7 +173,8 @@ public static void processDust(TagPrefix dustPrefix, Material mat, DustProperty } } - private static void processEBFRecipe(Material material, BlastProperty property, ItemStack output, Consumer provider) { + private static void processEBFRecipe(Material material, BlastProperty property, ItemStack output, + Consumer provider) { int blastTemp = property.getBlastTemperature(); BlastProperty.GasTier gasTier = property.getGasTier(); int duration = property.getDurationOverride(); @@ -208,7 +213,7 @@ private static void processEBFRecipe(Material material, BlastProperty property, // Add Vacuum Freezer recipe if required. if (ingotHot.doGenerateItem(material)) { - if(blastTemp < 5000) { + if (blastTemp < 5000) { VACUUM_RECIPES.recipeBuilder("cool_hot_" + material.getName() + "_ingot") .inputItems(ingotHot, material) .outputItems(ingot, material) @@ -226,11 +231,13 @@ private static void processEBFRecipe(Material material, BlastProperty property, } } - public static void processSmallDust(TagPrefix orePrefix, Material material, DustProperty property, Consumer provider) { + public static void processSmallDust(TagPrefix orePrefix, Material material, DustProperty property, + Consumer provider) { ItemStack smallDustStack = ChemicalHelper.get(orePrefix, material); ItemStack dustStack = ChemicalHelper.get(dust, material); - VanillaRecipeHelper.addStrictShapedRecipe(provider, String.format("small_dust_disassembling_%s", material.getName()), + VanillaRecipeHelper.addStrictShapedRecipe(provider, + String.format("small_dust_disassembling_%s", material.getName()), GTUtil.copyAmount(4, smallDustStack), " X ", " ", " ", 'X', new UnificationEntry(dust, material)); VanillaRecipeHelper.addShapedRecipe(provider, String.format("small_dust_assembling_%s", material.getName()), dustStack, "XX", "XX", 'X', new UnificationEntry(orePrefix, material)); @@ -248,11 +255,13 @@ public static void processSmallDust(TagPrefix orePrefix, Material material, Dust .save(provider); } - public static void processTinyDust(TagPrefix orePrefix, Material material, DustProperty property, Consumer provider) { + public static void processTinyDust(TagPrefix orePrefix, Material material, DustProperty property, + Consumer provider) { ItemStack tinyDustStack = ChemicalHelper.get(orePrefix, material); ItemStack dustStack = ChemicalHelper.get(dust, material); - VanillaRecipeHelper.addStrictShapedRecipe(provider, String.format("tiny_dust_disassembling_%s", material.getName()), + VanillaRecipeHelper.addStrictShapedRecipe(provider, + String.format("tiny_dust_disassembling_%s", material.getName()), GTUtil.copyAmount(9, tinyDustStack), "X ", " ", " ", 'X', new UnificationEntry(dust, material)); VanillaRecipeHelper.addShapedRecipe(provider, String.format("tiny_dust_assembling_%s", material.getName()), dustStack, "XXX", "XXX", "XXX", 'X', new UnificationEntry(orePrefix, material)); @@ -270,7 +279,8 @@ public static void processTinyDust(TagPrefix orePrefix, Material material, DustP .save(provider); } - public static void processIngot(TagPrefix ingotPrefix, Material material, IngotProperty property, Consumer provider) { + public static void processIngot(TagPrefix ingotPrefix, Material material, IngotProperty property, + Consumer provider) { if (material.hasFlag(MORTAR_GRINDABLE)) { VanillaRecipeHelper.addShapedRecipe(provider, String.format("mortar_grind_%s", material.getName()), ChemicalHelper.get(dust, material), "X", "m", 'X', new UnificationEntry(ingotPrefix, material)); @@ -377,32 +387,43 @@ public static void processIngot(TagPrefix ingotPrefix, Material material, IngotP } } } - } - public static void processGemConversion(TagPrefix gemPrefix, Material material, GemProperty property, Consumer provider) { + public static void processGemConversion(TagPrefix gemPrefix, Material material, GemProperty property, + Consumer provider) { long materialAmount = gemPrefix.getMaterialAmount(material); ItemStack crushedStack = ChemicalHelper.getDust(material, materialAmount); if (material.hasFlag(MORTAR_GRINDABLE)) { - VanillaRecipeHelper.addShapedRecipe(provider, String.format("gem_to_dust_%s_%s", material.getName(), FormattingUtil.toLowerCaseUnder(gemPrefix.name)), crushedStack, + VanillaRecipeHelper.addShapedRecipe(provider, + String.format("gem_to_dust_%s_%s", material.getName(), + FormattingUtil.toLowerCaseUnder(gemPrefix.name)), + crushedStack, "X", "m", 'X', new UnificationEntry(gemPrefix, material)); } TagPrefix prevPrefix = GTUtil.getItem(GEM_ORDER, GEM_ORDER.indexOf(gemPrefix) - 1, null); ItemStack prevStack = prevPrefix == null ? ItemStack.EMPTY : ChemicalHelper.get(prevPrefix, material, 2); if (!prevStack.isEmpty() && prevPrefix != null) { - VanillaRecipeHelper.addShapelessRecipe(provider, String.format("gem_to_gem_%s_%s", FormattingUtil.toLowerCaseUnder(prevPrefix.name), material.getName()), prevStack, + VanillaRecipeHelper.addShapelessRecipe(provider, + String.format("gem_to_gem_%s_%s", FormattingUtil.toLowerCaseUnder(prevPrefix.name), + material.getName()), + prevStack, "h", new UnificationEntry(gemPrefix, material)); - CUTTER_RECIPES.recipeBuilder("cut_" + material.getName() + "_" + FormattingUtil.toLowerCaseUnder(gemPrefix.name) + "_to_" + FormattingUtil.toLowerCaseUnder(prevPrefix.name)) + CUTTER_RECIPES + .recipeBuilder("cut_" + material.getName() + "_" + FormattingUtil.toLowerCaseUnder(gemPrefix.name) + + "_to_" + FormattingUtil.toLowerCaseUnder(prevPrefix.name)) .inputItems(gemPrefix, material) .outputItems(prevStack) .duration(20) .EUt(16) .save(provider); - LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_" + material.getName() + "_" + FormattingUtil.toLowerCaseUnder(gemPrefix.name) + "_to_" + FormattingUtil.toLowerCaseUnder(prevPrefix.name)) + LASER_ENGRAVER_RECIPES + .recipeBuilder( + "engrave_" + material.getName() + "_" + FormattingUtil.toLowerCaseUnder(gemPrefix.name) + + "_to_" + FormattingUtil.toLowerCaseUnder(prevPrefix.name)) .inputItems(prevStack) .notConsumable(lens, MarkerMaterials.Color.White) .outputItems(gemPrefix, material) @@ -412,19 +433,22 @@ public static void processGemConversion(TagPrefix gemPrefix, Material material, } } - public static void processNugget(TagPrefix orePrefix, Material material, DustProperty property, Consumer provider) { + public static void processNugget(TagPrefix orePrefix, Material material, DustProperty property, + Consumer provider) { ItemStack nuggetStack = ChemicalHelper.get(orePrefix, material); if (material.hasProperty(PropertyKey.INGOT)) { ItemStack ingotStack = ChemicalHelper.get(ingot, material); if (!ConfigHolder.INSTANCE.recipes.disableManualCompression) { if (!ingot.isIgnored(material)) { - VanillaRecipeHelper.addShapelessRecipe(provider, String.format("nugget_disassembling_%s", material.getName()), - GTUtil.copyAmount(9, nuggetStack), new UnificationEntry(ingot, material)); + VanillaRecipeHelper.addShapelessRecipe(provider, + String.format("nugget_disassembling_%s", material.getName()), + GTUtil.copyAmount(9, nuggetStack), new UnificationEntry(ingot, material)); } if (!orePrefix.isIgnored(material)) { - VanillaRecipeHelper.addShapedRecipe(provider, String.format("nugget_assembling_%s", material.getName()), - ingotStack, "XXX", "XXX", "XXX", 'X', new UnificationEntry(orePrefix, material)); + VanillaRecipeHelper.addShapedRecipe(provider, + String.format("nugget_assembling_%s", material.getName()), + ingotStack, "XXX", "XXX", "XXX", 'X', new UnificationEntry(orePrefix, material)); } } @@ -454,18 +478,21 @@ public static void processNugget(TagPrefix orePrefix, Material material, DustPro if (!ConfigHolder.INSTANCE.recipes.disableManualCompression) { if (!gem.isIgnored(material)) { - VanillaRecipeHelper.addShapelessRecipe(provider, String.format("nugget_disassembling_%s", material.getName()), - GTUtil.copyAmount(9, nuggetStack), new UnificationEntry(gem, material)); + VanillaRecipeHelper.addShapelessRecipe(provider, + String.format("nugget_disassembling_%s", material.getName()), + GTUtil.copyAmount(9, nuggetStack), new UnificationEntry(gem, material)); } if (!orePrefix.isIgnored(material)) { - VanillaRecipeHelper.addShapedRecipe(provider, String.format("nugget_assembling_%s", material.getName()), - gemStack, "XXX", "XXX", "XXX", 'X', new UnificationEntry(orePrefix, material)); + VanillaRecipeHelper.addShapedRecipe(provider, + String.format("nugget_assembling_%s", material.getName()), + gemStack, "XXX", "XXX", "XXX", 'X', new UnificationEntry(orePrefix, material)); } } } } - public static void processFrame(TagPrefix framePrefix, Material material, DustProperty property, Consumer provider) { + public static void processFrame(TagPrefix framePrefix, Material material, DustProperty property, + Consumer provider) { if (material.hasFlag(GENERATE_FRAME)) { boolean isWoodenFrame = material.hasProperty(PropertyKey.WOOD); VanillaRecipeHelper.addShapedRecipe(provider, String.format("frame_%s", material.getName()), @@ -482,7 +509,8 @@ public static void processFrame(TagPrefix framePrefix, Material material, DustPr } } - public static void processBlock(TagPrefix blockPrefix, Material material, DustProperty property, Consumer provider) { + public static void processBlock(TagPrefix blockPrefix, Material material, DustProperty property, + Consumer provider) { ItemStack blockStack = ChemicalHelper.get(blockPrefix, material); long materialAmount = blockPrefix.getMaterialAmount(material); if (material.hasFluid()) { @@ -514,20 +542,24 @@ public static void processBlock(TagPrefix blockPrefix, Material material, DustPr blockEntry = new UnificationEntry(dust, material); } - //do not allow handcrafting or uncrafting, extruding or alloy smelting of blacklisted blocks + // do not allow handcrafting or uncrafting, extruding or alloy smelting of blacklisted blocks if (!material.hasFlag(EXCLUDE_BLOCK_CRAFTING_RECIPES)) { - //do not allow non-perfect square root material amounts + // do not allow non-perfect square root material amounts int size = (int) (materialAmount / M); int sizeSqrt = Math.round(Mth.sqrt(size)); - //do not allow handcrafting or uncrafting of blacklisted blocks - if (!material.hasFlag(EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES) && !ConfigHolder.INSTANCE.recipes.disableManualCompression && sizeSqrt*sizeSqrt == size && !block.isIgnored(material)) { + // do not allow handcrafting or uncrafting of blacklisted blocks + if (!material.hasFlag(EXCLUDE_BLOCK_CRAFTING_BY_HAND_RECIPES) && + !ConfigHolder.INSTANCE.recipes.disableManualCompression && sizeSqrt * sizeSqrt == size && + !block.isIgnored(material)) { String patternString = "B".repeat(Math.max(0, sizeSqrt)); String[] pattern = new String[sizeSqrt]; Arrays.fill(pattern, patternString); - VanillaRecipeHelper.addShapedRecipe(provider, String.format("block_compress_%s", material.getName()), blockStack, pattern, 'B', blockEntry); + VanillaRecipeHelper.addShapedRecipe(provider, String.format("block_compress_%s", material.getName()), + blockStack, pattern, 'B', blockEntry); - VanillaRecipeHelper.addShapelessRecipe(provider, String.format("block_decompress_%s", material.getName()), + VanillaRecipeHelper.addShapelessRecipe(provider, + String.format("block_decompress_%s", material.getName()), GTUtil.copyAmount(size, ChemicalHelper.get(blockEntry.tagPrefix, blockEntry.material)), new UnificationEntry(blockPrefix, material)); } diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/OreRecipeHandler.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/OreRecipeHandler.java index 45723db4bd..e3f008c896 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/OreRecipeHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/OreRecipeHandler.java @@ -2,7 +2,6 @@ import com.gregtechceu.gtceu.api.data.chemical.ChemicalHelper; import com.gregtechceu.gtceu.api.data.chemical.material.Material; -import com.gregtechceu.gtceu.api.data.chemical.material.info.MaterialFlag; import com.gregtechceu.gtceu.api.data.chemical.material.info.MaterialFlags; import com.gregtechceu.gtceu.api.data.chemical.material.properties.OreProperty; import com.gregtechceu.gtceu.api.data.chemical.material.properties.PropertyKey; @@ -14,12 +13,14 @@ import com.gregtechceu.gtceu.data.recipe.VanillaRecipeHelper; import com.gregtechceu.gtceu.data.recipe.builder.GTRecipeBuilder; import com.gregtechceu.gtceu.utils.GTUtil; -import com.mojang.datafixers.util.Pair; + import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.Ingredient; import net.minecraftforge.common.crafting.IntersectionIngredient; +import com.mojang.datafixers.util.Pair; + import java.util.List; import java.util.function.Consumer; @@ -49,44 +50,51 @@ public static void init(Consumer provider) { dustPure.executeHandler(provider, PropertyKey.ORE, OreRecipeHandler::processPureDust); } - - private static void processMetalSmelting(TagPrefix crushedPrefix, Material material, OreProperty property, Consumer provider) { + private static void processMetalSmelting(TagPrefix crushedPrefix, Material material, OreProperty property, + Consumer provider) { Material smeltingResult = property.getDirectSmeltResult() != null ? property.getDirectSmeltResult() : material; if (smeltingResult.hasProperty(PropertyKey.INGOT)) { ItemStack ingotStack = ChemicalHelper.get(ingot, smeltingResult); - if (!ingotStack.isEmpty() && doesMaterialUseNormalFurnace(smeltingResult) && !crushedPrefix.isIgnored(material)) { - VanillaRecipeHelper.addSmeltingRecipe(provider, "smelt_" + crushedPrefix.name + "_" + material.getName() + "_to_ingot", + if (!ingotStack.isEmpty() && doesMaterialUseNormalFurnace(smeltingResult) && + !crushedPrefix.isIgnored(material)) { + VanillaRecipeHelper.addSmeltingRecipe(provider, + "smelt_" + crushedPrefix.name + "_" + material.getName() + "_to_ingot", ChemicalHelper.getTag(crushedPrefix, material), ingotStack, 0.5f); } } } - public static void processOreForgeHammer(TagPrefix orePrefix, Material material, OreProperty property, Consumer provider) { + public static void processOreForgeHammer(TagPrefix orePrefix, Material material, OreProperty property, + Consumer provider) { ItemStack crushedStack = ChemicalHelper.get(crushed, material); int amountOfCrushedOre = property.getOreMultiplier(); int oreTypeMultiplier = TagPrefix.ORES.get(orePrefix).isDoubleDrops() ? 2 : 1; crushedStack.setCount(crushedStack.getCount() * property.getOreMultiplier()); String prefixString = orePrefix == ore ? "" : orePrefix.name + "_"; - GTRecipeBuilder builder = FORGE_HAMMER_RECIPES.recipeBuilder("hammer_" + prefixString + material.getName() + "_ore_to_raw_ore") - .inputItems(orePrefix, material) - .duration(10).EUt(16); + GTRecipeBuilder builder = FORGE_HAMMER_RECIPES + .recipeBuilder("hammer_" + prefixString + material.getName() + "_ore_to_raw_ore") + .inputItems(orePrefix, material) + .duration(10).EUt(16); if (material.hasProperty(PropertyKey.GEM) && !gem.isIgnored(material)) { - builder.outputItems(GTUtil.copyAmount(amountOfCrushedOre * oreTypeMultiplier, ChemicalHelper.get(gem, material, crushedStack.getCount()))); + builder.outputItems(GTUtil.copyAmount(amountOfCrushedOre * oreTypeMultiplier, + ChemicalHelper.get(gem, material, crushedStack.getCount()))); } else { builder.outputItems(GTUtil.copyAmount(amountOfCrushedOre * oreTypeMultiplier, crushedStack)); } builder.save(provider); } - public static void processOre(TagPrefix orePrefix, Material material, OreProperty property, Consumer provider) { + public static void processOre(TagPrefix orePrefix, Material material, OreProperty property, + Consumer provider) { Material byproductMaterial = GTUtil.selectItemInList(0, material, property.getOreByProducts(), Material.class); ItemStack ingotStack; ItemStack byproductStack = ChemicalHelper.get(gem, byproductMaterial); if (byproductStack.isEmpty()) byproductStack = ChemicalHelper.get(dust, byproductMaterial); - Material smeltingMaterial = property.getDirectSmeltResult() == null ? material : property.getDirectSmeltResult(); + Material smeltingMaterial = property.getDirectSmeltResult() == null ? material : + property.getDirectSmeltResult(); ItemStack crushedStack = ChemicalHelper.get(crushed, material); int amountOfCrushedOre = property.getOreMultiplier(); if (smeltingMaterial.hasProperty(PropertyKey.INGOT)) { @@ -102,8 +110,10 @@ public static void processOre(TagPrefix orePrefix, Material material, OrePropert String prefixString = orePrefix == ore ? "" : orePrefix.name + "_"; if (!crushedStack.isEmpty()) { - GTRecipeBuilder builder = MACERATOR_RECIPES.recipeBuilder("macerate_" + prefixString + material.getName() + "_ore_to_raw_ore") - .inputItems(IntersectionIngredient.of(Ingredient.of(orePrefix.getItemTags(material)[0]), Ingredient.of(orePrefix.getItemParentTags()[0]))) + GTRecipeBuilder builder = MACERATOR_RECIPES + .recipeBuilder("macerate_" + prefixString + material.getName() + "_ore_to_raw_ore") + .inputItems(IntersectionIngredient.of(Ingredient.of(orePrefix.getItemTags(material)[0]), + Ingredient.of(orePrefix.getItemParentTags()[0]))) .outputItems(GTUtil.copyAmount(amountOfCrushedOre * 2 * oreTypeMultiplier, crushedStack)) .chancedOutput(byproductStack, 1400, 850) .EUt(2) @@ -119,30 +129,43 @@ public static void processOre(TagPrefix orePrefix, Material material, OrePropert builder.save(provider); } - //do not try to add smelting recipes for materials which require blast furnace + // do not try to add smelting recipes for materials which require blast furnace if (!ingotStack.isEmpty() && doesMaterialUseNormalFurnace(smeltingMaterial) && !orePrefix.isIgnored(material)) { float xp = Math.round(((1 + oreTypeMultiplier * 0.5f) * 0.5f - 0.05f) * 10f) / 10f; - VanillaRecipeHelper.addSmeltingRecipe(provider, "smelt_" + prefixString + material.getName() + "_ore_to_ingot", - IntersectionIngredient.of(Ingredient.of(orePrefix.getItemTags(material)[0]), Ingredient.of(orePrefix.getItemParentTags()[0])), ingotStack, xp); - VanillaRecipeHelper.addBlastingRecipe(provider, "smelt_" + prefixString + material.getName() + "_ore_to_ingot", - IntersectionIngredient.of(Ingredient.of(orePrefix.getItemTags(material)[0]), Ingredient.of(orePrefix.getItemParentTags()[0])), ingotStack, xp); + VanillaRecipeHelper.addSmeltingRecipe(provider, + "smelt_" + prefixString + material.getName() + "_ore_to_ingot", + IntersectionIngredient.of(Ingredient.of(orePrefix.getItemTags(material)[0]), + Ingredient.of(orePrefix.getItemParentTags()[0])), + ingotStack, xp); + VanillaRecipeHelper.addBlastingRecipe(provider, + "smelt_" + prefixString + material.getName() + "_ore_to_ingot", + IntersectionIngredient.of(Ingredient.of(orePrefix.getItemTags(material)[0]), + Ingredient.of(orePrefix.getItemParentTags()[0])), + ingotStack, xp); } } - public static void processRawOre(TagPrefix orePrefix, Material material, OreProperty property, Consumer provider) { - ItemStack crushedStack = ChemicalHelper.get(crushed, material); + public static void processRawOre(TagPrefix orePrefix, Material material, OreProperty property, + Consumer provider) { + ItemStack crushedStack = ChemicalHelper.get(crushed, material, + material.getProperty(PropertyKey.ORE).getOreMultiplier()); ItemStack ingotStack; - Material smeltingMaterial = property.getDirectSmeltResult() == null ? material : property.getDirectSmeltResult(); + Material smeltingMaterial = property.getDirectSmeltResult() == null ? material : + property.getDirectSmeltResult(); if (smeltingMaterial.hasProperty(PropertyKey.INGOT)) { - ingotStack = ChemicalHelper.get(ingot, smeltingMaterial); + ingotStack = ChemicalHelper.get(ingot, smeltingMaterial, + material.getProperty(PropertyKey.ORE).getOreMultiplier()); } else if (smeltingMaterial.hasProperty(PropertyKey.GEM)) { - ingotStack = ChemicalHelper.get(gem, smeltingMaterial); + ingotStack = ChemicalHelper.get(gem, smeltingMaterial, + material.getProperty(PropertyKey.ORE).getOreMultiplier()); } else { - ingotStack = ChemicalHelper.get(dust, smeltingMaterial); + ingotStack = ChemicalHelper.get(dust, smeltingMaterial, + material.getProperty(PropertyKey.ORE).getOreMultiplier()); } if (!crushedStack.isEmpty()) { - GTRecipeBuilder builder = FORGE_HAMMER_RECIPES.recipeBuilder("hammer_" + orePrefix.name + "_" + material.getName() + "_to_crushed_ore") + GTRecipeBuilder builder = FORGE_HAMMER_RECIPES + .recipeBuilder("hammer_" + orePrefix.name + "_" + material.getName() + "_to_crushed_ore") .inputItems(orePrefix, material) .duration(10).EUt(16); if (material.hasProperty(PropertyKey.GEM) && !gem.isIgnored(material)) { @@ -152,24 +175,43 @@ public static void processRawOre(TagPrefix orePrefix, Material material, OreProp } builder.save(provider); - MACERATOR_RECIPES.recipeBuilder("macerate_" + orePrefix.name + "_" + material.getName() + "_ore_to_crushed_ore") + GTRecipeBuilder builder2 = MACERATOR_RECIPES + .recipeBuilder("macerate_" + orePrefix.name + "_" + material.getName() + "_ore_to_crushed_ore") .inputItems(orePrefix, material) - .outputItems(crushedStack) - .chancedOutput(crushedStack, 5000, 750) - .chancedOutput(crushedStack, 2500, 500) - .chancedOutput(crushedStack, 1250, 250) + .outputItems(GTUtil.copyAmount(crushedStack.getCount() * 2, crushedStack)) .EUt(2) - .duration(400) - .save(provider); + .duration(400); + + Material byproductMaterial = GTUtil.selectItemInList(0, material, property.getOreByProducts(), + Material.class); + ItemStack byproductStack = ChemicalHelper.get(gem, byproductMaterial); + if (byproductStack.isEmpty()) { + byproductStack = ChemicalHelper.get(dust, byproductMaterial); + } + builder2.chancedOutput(byproductStack, 1000, 300); + + for (MaterialStack secondaryMaterial : ore.secondaryMaterials()) { + if (secondaryMaterial.material().hasProperty(PropertyKey.DUST)) { + ItemStack dustStack = ChemicalHelper.getGem(secondaryMaterial); + builder2.chancedOutput(dustStack, 500, 100); + break; + } + } + builder2.save(provider); } - //do not try to add smelting recipes for materials which require blast furnace, or don't have smelting recipes at all. + // do not try to add smelting recipes for materials which require blast furnace, or don't have smelting recipes + // at all. if (!ingotStack.isEmpty() && doesMaterialUseNormalFurnace(smeltingMaterial) && !orePrefix.isIgnored(material)) { float xp = Math.round(((1 + property.getOreMultiplier() * 0.33f) / 3) * 10f) / 10f; - VanillaRecipeHelper.addSmeltingRecipe(provider, "smelt_" + orePrefix.name + "_" + material.getName() + "_ore_to_ingot", - ChemicalHelper.getTag(orePrefix, material), ingotStack, xp); - VanillaRecipeHelper.addBlastingRecipe(provider, "smelt_" + orePrefix.name + "_" + material.getName() + "_ore_to_ingot", - ChemicalHelper.getTag(orePrefix, material), ingotStack, xp); + VanillaRecipeHelper.addSmeltingRecipe(provider, + "smelt_" + orePrefix.name + "_" + material.getName() + "_ore_to_ingot", + ChemicalHelper.getTag(orePrefix, material), GTUtil.copyAmount(ingotStack.getCount(), ingotStack), + xp); + VanillaRecipeHelper.addBlastingRecipe(provider, + "smelt_" + orePrefix.name + "_" + material.getName() + "_ore_to_ingot", + ChemicalHelper.getTag(orePrefix, material), GTUtil.copyAmount(ingotStack.getCount(), ingotStack), + xp); } if (!ConfigHolder.INSTANCE.recipes.disableManualCompression) { @@ -180,14 +222,15 @@ public static void processRawOre(TagPrefix orePrefix, Material material, OreProp VanillaRecipeHelper.addShapelessRecipe(provider, "decompress_" + material.getName() + "_from_ore_block", ChemicalHelper.get(rawOre, material, 9), ChemicalHelper.getTag(rawOreBlock, material)); - COMPRESSOR_RECIPES.recipeBuilder("compress_" + material.getName() + "to_ore_block") - .inputItems(rawOre, material, 9) - .outputItems(rawOreBlock, material) - .duration(300).EUt(2).save(provider); } + COMPRESSOR_RECIPES.recipeBuilder("compress_" + material.getName() + "to_ore_block") + .inputItems(rawOre, material, 9) + .outputItems(rawOreBlock, material) + .duration(300).EUt(2).save(provider); } - public static void processCrushedOre(TagPrefix crushedPrefix, Material material, OreProperty property, Consumer provider) { + public static void processCrushedOre(TagPrefix crushedPrefix, Material material, OreProperty property, + Consumer provider) { ItemStack impureDustStack = ChemicalHelper.get(dustImpure, material); Material byproductMaterial = GTUtil.selectItemInList(0, material, property.getOreByProducts(), Material.class); @@ -201,7 +244,8 @@ public static void processCrushedOre(TagPrefix crushedPrefix, Material material, .inputItems(crushedPrefix, material) .outputItems(impureDustStack) .duration(400).EUt(2) - .chancedOutput(ChemicalHelper.get(dust, byproductMaterial, property.getByProductMultiplier()), 1400, 850) + .chancedOutput(ChemicalHelper.get(dust, byproductMaterial, property.getByProductMultiplier()), 1400, + 850) .save(provider); ItemStack crushedPurifiedOre = GTUtil.copy( @@ -239,18 +283,21 @@ public static void processCrushedOre(TagPrefix crushedPrefix, Material material, THERMAL_CENTRIFUGE_RECIPES.recipeBuilder("centrifuge_" + material.getName() + "_crushed_ore_to_refined_ore") .inputItems(crushedPrefix, material) .outputItems(crushedCentrifugedOre) - .chancedOutput(TagPrefix.dust, property.getOreByProduct(1, material), property.getByProductMultiplier(), 3333, 0) + .chancedOutput(TagPrefix.dust, property.getOreByProduct(1, material), property.getByProductMultiplier(), + 3333, 0) .outputItems(TagPrefix.dust, GTMaterials.Stone) .save(provider); if (property.getWashedIn().getFirst() != null) { - Material washingByproduct = GTUtil.selectItemInList(3, material, property.getOreByProducts(), Material.class); + Material washingByproduct = GTUtil.selectItemInList(3, material, property.getOreByProducts(), + Material.class); Pair washedInTuple = property.getWashedIn(); CHEMICAL_BATH_RECIPES.recipeBuilder("bathe_" + material.getName() + "_crushed_ore_to_purified_ore") .inputItems(crushedPrefix, material) .inputFluids(washedInTuple.getFirst().getFluid(washedInTuple.getSecond())) .outputItems(crushedPurifiedOre) - .chancedOutput(ChemicalHelper.get(dust, washingByproduct, property.getByProductMultiplier()), 7000, 580) + .chancedOutput(ChemicalHelper.get(dust, washingByproduct, property.getByProductMultiplier()), 7000, + 580) .chancedOutput(ChemicalHelper.get(dust, Stone), 4000, 650) .duration(200).EUt(VA[LV]) .save(provider); @@ -259,11 +306,11 @@ public static void processCrushedOre(TagPrefix crushedPrefix, Material material, VanillaRecipeHelper.addShapelessRecipe(provider, String.format("crushed_ore_to_dust_%s", material.getName()), impureDustStack, 'h', new UnificationEntry(crushedPrefix, material)); - processMetalSmelting(crushedPrefix, material, property, provider); } - public static void processCrushedCentrifuged(TagPrefix centrifugedPrefix, Material material, OreProperty property, Consumer provider) { + public static void processCrushedCentrifuged(TagPrefix centrifugedPrefix, Material material, OreProperty property, + Consumer provider) { ItemStack dustStack = ChemicalHelper.get(dust, material); ItemStack byproductStack = ChemicalHelper.get(dust, GTUtil.selectItemInList(2, material, property.getOreByProducts(), Material.class), 1); @@ -281,13 +328,15 @@ public static void processCrushedCentrifuged(TagPrefix centrifugedPrefix, Materi .duration(400).EUt(2) .save(provider); - VanillaRecipeHelper.addShapelessRecipe(provider, String.format("centrifuged_ore_to_dust_%s", material.getName()), dustStack, + VanillaRecipeHelper.addShapelessRecipe(provider, + String.format("centrifuged_ore_to_dust_%s", material.getName()), dustStack, 'h', new UnificationEntry(centrifugedPrefix, material)); processMetalSmelting(centrifugedPrefix, material, property, provider); } - public static void processCrushedPurified(TagPrefix purifiedPrefix, Material material, OreProperty property, Consumer provider) { + public static void processCrushedPurified(TagPrefix purifiedPrefix, Material material, OreProperty property, + Consumer provider) { ItemStack crushedCentrifugedStack = ChemicalHelper.get(crushedRefined, material); ItemStack dustStack = ChemicalHelper.get(dustPure, material); Material byproductMaterial = GTUtil.selectItemInList( @@ -308,11 +357,13 @@ public static void processCrushedPurified(TagPrefix purifiedPrefix, Material mat .duration(400).EUt(2) .save(provider); - VanillaRecipeHelper.addShapelessRecipe(provider, String.format("purified_ore_to_dust_%s", material.getName()), dustStack, + VanillaRecipeHelper.addShapelessRecipe(provider, String.format("purified_ore_to_dust_%s", material.getName()), + dustStack, 'h', new UnificationEntry(purifiedPrefix, material)); if (!crushedCentrifugedStack.isEmpty()) { - THERMAL_CENTRIFUGE_RECIPES.recipeBuilder("centrifuge_" + material.getName() + "_purified_ore_to_refined_ore") + THERMAL_CENTRIFUGE_RECIPES + .recipeBuilder("centrifuge_" + material.getName() + "_purified_ore_to_refined_ore") .inputItems(purifiedPrefix, material) .outputItems(crushedCentrifugedStack) .chancedOutput(TagPrefix.dust, byproductMaterial, 3333, 0) @@ -327,7 +378,8 @@ public static void processCrushedPurified(TagPrefix purifiedPrefix, Material mat ItemStack chippedStack = ChemicalHelper.get(gemChipped, material); if (material.hasFlag(HIGH_SIFTER_OUTPUT)) { - GTRecipeBuilder builder = SIFTER_RECIPES.recipeBuilder("sift_" + material.getName() + "_purified_ore_to_gems") + GTRecipeBuilder builder = SIFTER_RECIPES + .recipeBuilder("sift_" + material.getName() + "_purified_ore_to_gems") .inputItems(purifiedPrefix, material) .chancedOutput(exquisiteStack, 500, 150) .chancedOutput(flawlessStack, 1500, 200) @@ -342,7 +394,8 @@ public static void processCrushedPurified(TagPrefix purifiedPrefix, Material mat builder.save(provider); } else { - GTRecipeBuilder builder = SIFTER_RECIPES.recipeBuilder("sift_" + material.getName() + "_purified_ore_to_gems") + GTRecipeBuilder builder = SIFTER_RECIPES + .recipeBuilder("sift_" + material.getName() + "_purified_ore_to_gems") .inputItems(purifiedPrefix, material) .chancedOutput(exquisiteStack, 300, 100) .chancedOutput(flawlessStack, 1000, 150) @@ -361,13 +414,15 @@ public static void processCrushedPurified(TagPrefix purifiedPrefix, Material mat processMetalSmelting(purifiedPrefix, material, property, provider); } - public static void processDirtyDust(TagPrefix dustPrefix, Material material, OreProperty property, Consumer provider) { + public static void processDirtyDust(TagPrefix dustPrefix, Material material, OreProperty property, + Consumer provider) { ItemStack dustStack = ChemicalHelper.get(dust, material); Material byproduct = GTUtil.selectItemInList( 0, material, property.getOreByProducts(), Material.class); - GTRecipeBuilder builder = CENTRIFUGE_RECIPES.recipeBuilder("centrifuge_" + material.getName() + "_dirty_dust_to_dust") + GTRecipeBuilder builder = CENTRIFUGE_RECIPES + .recipeBuilder("centrifuge_" + material.getName() + "_dirty_dust_to_dust") .inputItems(dustPrefix, material) .outputItems(dustStack) .duration((int) (material.getMass() * 4)).EUt(24); @@ -387,27 +442,30 @@ public static void processDirtyDust(TagPrefix dustPrefix, Material material, Ore .outputItems(dustStack) .duration(8).EUt(4).save(provider); - //dust gains same amount of material as normal dust + // dust gains same amount of material as normal dust processMetalSmelting(dustPrefix, material, property, provider); } - public static void processPureDust(TagPrefix purePrefix, Material material, OreProperty property, Consumer provider) { + public static void processPureDust(TagPrefix purePrefix, Material material, OreProperty property, + Consumer provider) { Material byproductMaterial = GTUtil.selectItemInList( 1, material, property.getOreByProducts(), Material.class); ItemStack dustStack = ChemicalHelper.get(dust, material); if (property.getSeparatedInto() != null && !property.getSeparatedInto().isEmpty()) { List separatedMaterial = property.getSeparatedInto(); - TagPrefix prefix = (separatedMaterial.get(separatedMaterial.size() - 1).getBlastTemperature() == 0 && separatedMaterial.get(separatedMaterial.size() - 1).hasProperty(PropertyKey.INGOT)) - ? nugget : dust; + TagPrefix prefix = (separatedMaterial.get(separatedMaterial.size() - 1).getBlastTemperature() == 0 && + separatedMaterial.get(separatedMaterial.size() - 1).hasProperty(PropertyKey.INGOT)) ? nugget : dust; - ItemStack separatedStack2 = ChemicalHelper.get(prefix, separatedMaterial.get(separatedMaterial.size() - 1), prefix == nugget ? 2 : 1); + ItemStack separatedStack2 = ChemicalHelper.get(prefix, separatedMaterial.get(separatedMaterial.size() - 1), + prefix == nugget ? 2 : 1); ELECTROMAGNETIC_SEPARATOR_RECIPES.recipeBuilder("separate_" + material.getName() + "_pure_dust_to_dust") .inputItems(purePrefix, material) .outputItems(dustStack) .chancedOutput(TagPrefix.dust, separatedMaterial.get(0), 1000, 250) - .chancedOutput(separatedStack2, prefix == TagPrefix.dust ? 500 : 2000, prefix == TagPrefix.dust ? 150 : 600) + .chancedOutput(separatedStack2, prefix == TagPrefix.dust ? 500 : 2000, + prefix == TagPrefix.dust ? 150 : 600) .duration(200).EUt(24) .save(provider); } @@ -433,6 +491,4 @@ public static void processPureDust(TagPrefix purePrefix, Material material, OreP private static boolean doesMaterialUseNormalFurnace(Material material) { return !material.hasProperty(PropertyKey.BLAST) && !material.hasFlag(MaterialFlags.NO_ORE_SMELTING); } - - } diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/PartsRecipeHandler.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/PartsRecipeHandler.java index f9005fca97..b846c07bbb 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/PartsRecipeHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/PartsRecipeHandler.java @@ -12,6 +12,7 @@ import com.gregtechceu.gtceu.data.recipe.VanillaRecipeHelper; import com.gregtechceu.gtceu.data.recipe.builder.GTRecipeBuilder; import com.gregtechceu.gtceu.utils.GTUtil; + import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.world.item.ItemStack; @@ -24,8 +25,7 @@ public class PartsRecipeHandler { - private PartsRecipeHandler() { - } + private PartsRecipeHandler() {} public static void init(Consumer provider) { rod.executeHandler(provider, PropertyKey.DUST, PartsRecipeHandler::processStick); @@ -50,7 +50,8 @@ public static void init(Consumer provider) { round.executeHandler(provider, PropertyKey.INGOT, PartsRecipeHandler::processRound); } - public static void processBolt(TagPrefix boltPrefix, Material material, DustProperty property, Consumer provider) { + public static void processBolt(TagPrefix boltPrefix, Material material, DustProperty property, + Consumer provider) { ItemStack boltStack = ChemicalHelper.get(boltPrefix, material); ItemStack ingotStack = ChemicalHelper.get(ingot, material); @@ -82,7 +83,8 @@ public static void processBolt(TagPrefix boltPrefix, Material material, DustProp } } - public static void processScrew(TagPrefix screwPrefix, Material material, DustProperty property, Consumer provider) { + public static void processScrew(TagPrefix screwPrefix, Material material, DustProperty property, + Consumer provider) { ItemStack screwStack = ChemicalHelper.get(screwPrefix, material); LATHE_RECIPES.recipeBuilder("lathe_" + material.getName() + "_bolt_to_screw") @@ -97,7 +99,8 @@ public static void processScrew(TagPrefix screwPrefix, Material material, DustPr 'X', new UnificationEntry(bolt, material)); } - public static void processFoil(TagPrefix foilPrefix, Material material, IngotProperty property, Consumer provider) { + public static void processFoil(TagPrefix foilPrefix, Material material, IngotProperty property, + Consumer provider) { if (!material.hasFlag(NO_SMASHING)) VanillaRecipeHelper.addShapedRecipe(provider, String.format("foil_%s", material.getName()), ChemicalHelper.get(foilPrefix, material, 2), @@ -138,7 +141,8 @@ public static void processFoil(TagPrefix foilPrefix, Material material, IngotPro } } - public static void processFineWire(TagPrefix fineWirePrefix, Material material, IngotProperty property, Consumer provider) { + public static void processFineWire(TagPrefix fineWirePrefix, Material material, IngotProperty property, + Consumer provider) { ItemStack fineWireStack = ChemicalHelper.get(fineWirePrefix, material); if (!ChemicalHelper.get(foil, material).isEmpty()) @@ -162,7 +166,8 @@ public static void processFineWire(TagPrefix fineWirePrefix, Material material, } } - public static void processGear(TagPrefix gearPrefix, Material material, DustProperty property, Consumer provider) { + public static void processGear(TagPrefix gearPrefix, Material material, DustProperty property, + Consumer provider) { ItemStack stack = ChemicalHelper.get(gearPrefix, material); if (gearPrefix == gear && material.hasProperty(PropertyKey.INGOT)) { int voltageMultiplier = getVoltageMultiplier(material); @@ -206,8 +211,10 @@ public static void processGear(TagPrefix gearPrefix, Material material, DustProp if (material.hasFlag(GENERATE_PLATE) && material.hasFlag(GENERATE_ROD)) { if (gearPrefix == gearSmall) { - VanillaRecipeHelper.addShapedRecipe(provider, String.format("small_gear_%s", material.getName()), ChemicalHelper.get(gearSmall, material), - " R ", "hPx", " R ", 'R', new UnificationEntry(rod, material), 'P', new UnificationEntry(plate, material)); + VanillaRecipeHelper.addShapedRecipe(provider, String.format("small_gear_%s", material.getName()), + ChemicalHelper.get(gearSmall, material), + " R ", "hPx", " R ", 'R', new UnificationEntry(rod, material), 'P', + new UnificationEntry(plate, material)); EXTRUDER_RECIPES.recipeBuilder("extrude_" + material.getName() + "_ingot_to_small_gear") .inputItems(ingot, material) @@ -242,7 +249,8 @@ public static void processGear(TagPrefix gearPrefix, Material material, DustProp } } - public static void processLens(TagPrefix lensPrefix, Material material, GemProperty property, Consumer provider) { + public static void processLens(TagPrefix lensPrefix, Material material, GemProperty property, + Consumer provider) { ItemStack stack = ChemicalHelper.get(lensPrefix, material); LATHE_RECIPES.recipeBuilder("lathe_" + material.getName() + "_plate_to_lens") @@ -260,7 +268,8 @@ public static void processLens(TagPrefix lensPrefix, Material material, GemPrope } } - public static void processPlate(TagPrefix platePrefix, Material material, DustProperty property, Consumer provider) { + public static void processPlate(TagPrefix platePrefix, Material material, DustProperty property, + Consumer provider) { if (material.hasFluid()) { FLUID_SOLIDFICATION_RECIPES.recipeBuilder("solidify_" + material.getName() + "_to_plate") .notConsumable(GTItems.SHAPE_MOLD_PLATE) @@ -272,7 +281,8 @@ public static void processPlate(TagPrefix platePrefix, Material material, DustPr } } - public static void processPlateDouble(TagPrefix doublePrefix, Material material, IngotProperty property, Consumer provider) { + public static void processPlateDouble(TagPrefix doublePrefix, Material material, IngotProperty property, + Consumer provider) { if (material.hasFlag(GENERATE_PLATE)) { if (!material.hasFlag(NO_SMASHING)) { VanillaRecipeHelper.addShapedRecipe(provider, String.format("plate_double_%s", material.getName()), @@ -297,7 +307,8 @@ public static void processPlateDouble(TagPrefix doublePrefix, Material material, } } - public static void processPlateDense(TagPrefix tagPrefix, Material material, DustProperty property, Consumer provider) { + public static void processPlateDense(TagPrefix tagPrefix, Material material, DustProperty property, + Consumer provider) { BENDER_RECIPES.recipeBuilder("bend_" + material.getName() + "_plate_to_dense_plate") .inputItems(plate, material, 9) .circuitMeta(9) @@ -308,16 +319,17 @@ public static void processPlateDense(TagPrefix tagPrefix, Material material, Dus if (material.hasProperty(PropertyKey.INGOT)) { BENDER_RECIPES.recipeBuilder("bend_" + material.getName() + "_ingot_to_dense_plate") - .inputItems(ingot, material, 9) - .circuitMeta(9) - .outputItems(tagPrefix, material) - .duration((int) Math.max(material.getMass() * 9L, 1L)) - .EUt(96) - .save(provider); + .inputItems(ingot, material, 9) + .circuitMeta(9) + .outputItems(tagPrefix, material) + .duration((int) Math.max(material.getMass() * 9L, 1L)) + .EUt(96) + .save(provider); } } - public static void processRing(TagPrefix ringPrefix, Material material, IngotProperty property, Consumer provider) { + public static void processRing(TagPrefix ringPrefix, Material material, IngotProperty property, + Consumer provider) { EXTRUDER_RECIPES.recipeBuilder("extrude_" + material.getName() + "_ingot_to_ring") .inputItems(ingot, material) .notConsumable(GTItems.SHAPE_EXTRUDER_RING) @@ -342,7 +354,8 @@ public static void processRing(TagPrefix ringPrefix, Material material, IngotPro } } - public static void processSpringSmall(TagPrefix springPrefix, Material material, IngotProperty property, Consumer provider) { + public static void processSpringSmall(TagPrefix springPrefix, Material material, IngotProperty property, + Consumer provider) { VanillaRecipeHelper.addShapedRecipe(provider, String.format("spring_small_%s", material.getName()), ChemicalHelper.get(springSmall, material), " s ", "fRx", 'R', new UnificationEntry(rod, material)); @@ -355,7 +368,8 @@ public static void processSpringSmall(TagPrefix springPrefix, Material material, .save(provider); } - public static void processSpring(TagPrefix springPrefix, Material material, IngotProperty property, Consumer provider) { + public static void processSpring(TagPrefix springPrefix, Material material, IngotProperty property, + Consumer provider) { BENDER_RECIPES.recipeBuilder("bend_" + material.getName() + "_long_rod_to_spring") .inputItems(rodLong, material) .outputItems(spring, material) @@ -369,7 +383,8 @@ public static void processSpring(TagPrefix springPrefix, Material material, Ingo " s ", "fRx", " R ", 'R', new UnificationEntry(rodLong, material)); } - public static void processRotor(TagPrefix rotorPrefix, Material material, IngotProperty property, Consumer provider) { + public static void processRotor(TagPrefix rotorPrefix, Material material, IngotProperty property, + Consumer provider) { ItemStack stack = ChemicalHelper.get(rotorPrefix, material); VanillaRecipeHelper.addShapedRecipe(provider, String.format("rotor_%s", material.getName()), stack, "ChC", "SRf", "CdC", @@ -406,7 +421,8 @@ public static void processRotor(TagPrefix rotorPrefix, Material material, IngotP } } - public static void processStick(TagPrefix stickPrefix, Material material, DustProperty property, Consumer provider) { + public static void processStick(TagPrefix stickPrefix, Material material, DustProperty property, + Consumer provider) { if (material.hasProperty(PropertyKey.GEM) || material.hasProperty(PropertyKey.INGOT)) { GTRecipeBuilder builder = LATHE_RECIPES.recipeBuilder("lathe_" + material.getName() + "_to_rod") .inputItems(material.hasProperty(PropertyKey.GEM) ? gem : ingot, material) @@ -438,7 +454,8 @@ public static void processStick(TagPrefix stickPrefix, Material material, DustPr } } - public static void processLongStick(TagPrefix longStickPrefix, Material material, DustProperty property, Consumer provider) { + public static void processLongStick(TagPrefix longStickPrefix, Material material, DustProperty property, + Consumer provider) { ItemStack stack = ChemicalHelper.get(longStickPrefix, material); ItemStack stickStack = ChemicalHelper.get(rod, material); @@ -452,14 +469,16 @@ public static void processLongStick(TagPrefix longStickPrefix, Material material GTUtil.copyAmount(2, stickStack), "s", "X", 'X', new UnificationEntry(rodLong, material)); - if(material.hasProperty(PropertyKey.GEM)) { - VanillaRecipeHelper.addShapedRecipe(provider, String.format("stick_long_gem_flawless_%s", material.getName()), + if (material.hasProperty(PropertyKey.GEM)) { + VanillaRecipeHelper.addShapedRecipe(provider, + String.format("stick_long_gem_flawless_%s", material.getName()), stickStack, "sf", "G ", 'G', new UnificationEntry(gemFlawless, material)); - VanillaRecipeHelper.addShapedRecipe(provider, String.format("stick_long_gem_exquisite_%s", material.getName()), + VanillaRecipeHelper.addShapedRecipe(provider, + String.format("stick_long_gem_exquisite_%s", material.getName()), GTUtil.copyAmount(2, stickStack), "sf", "G ", 'G', new UnificationEntry(gemExquisite, material)); @@ -498,9 +517,10 @@ public static void processLongStick(TagPrefix longStickPrefix, Material material } } - public static void processTurbine(TagPrefix toolPrefix, Material material, IngotProperty property, Consumer provider) { + public static void processTurbine(TagPrefix toolPrefix, Material material, IngotProperty property, + Consumer provider) { ItemStack rotorStack = GTItems.TURBINE_ROTOR.asStack(); - //noinspection ConstantConditions + // noinspection ConstantConditions TurbineRotorBehaviour.getBehaviour(rotorStack).setPartMaterial(rotorStack, material); ASSEMBLER_RECIPES.recipeBuilder("assemble_" + material.getName() + "_turbine_blade") @@ -526,7 +546,8 @@ public static void processTurbine(TagPrefix toolPrefix, Material material, Ingot 'S', new UnificationEntry(screw, material)); } - public static void processRound(TagPrefix roundPrefix, Material material, IngotProperty property, Consumer provider) { + public static void processRound(TagPrefix roundPrefix, Material material, IngotProperty property, + Consumer provider) { if (!material.hasFlag(NO_SMASHING)) { VanillaRecipeHelper.addShapedRecipe(provider, String.format("round_%s", material.getName()), diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/PipeRecipeHandler.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/PipeRecipeHandler.java index 881a8fd4af..3c16f7fe33 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/PipeRecipeHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/PipeRecipeHandler.java @@ -12,6 +12,7 @@ import com.gregtechceu.gtceu.data.recipe.VanillaRecipeHelper; import com.gregtechceu.gtceu.utils.FormattingUtil; import com.gregtechceu.gtceu.utils.GTUtil; + import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.world.item.ItemStack; @@ -41,12 +42,14 @@ public static void init(Consumer provider) { pipeHugeItem.executeHandler(provider, PropertyKey.ITEM_PIPE, PipeRecipeHandler::processPipeHuge); pipeSmallRestrictive.executeHandler(provider, PropertyKey.ITEM_PIPE, PipeRecipeHandler::processRestrictivePipe); - pipeNormalRestrictive.executeHandler(provider, PropertyKey.ITEM_PIPE, PipeRecipeHandler::processRestrictivePipe); + pipeNormalRestrictive.executeHandler(provider, PropertyKey.ITEM_PIPE, + PipeRecipeHandler::processRestrictivePipe); pipeLargeRestrictive.executeHandler(provider, PropertyKey.ITEM_PIPE, PipeRecipeHandler::processRestrictivePipe); pipeHugeRestrictive.executeHandler(provider, PropertyKey.ITEM_PIPE, PipeRecipeHandler::processRestrictivePipe); } - private static void processRestrictivePipe(TagPrefix pipePrefix, Material material, ItemPipeProperties property, Consumer provider) { + private static void processRestrictivePipe(TagPrefix pipePrefix, Material material, ItemPipeProperties property, + Consumer provider) { TagPrefix unrestrictive; if (pipePrefix == pipeSmallRestrictive) unrestrictive = pipeSmallItem; else if (pipePrefix == pipeNormalRestrictive) unrestrictive = pipeNormalItem; @@ -62,12 +65,14 @@ private static void processRestrictivePipe(TagPrefix pipePrefix, Material materi .EUt(VA[ULV]) .save(provider); - VanillaRecipeHelper.addShapedRecipe(provider, FormattingUtil.toLowerCaseUnder(pipePrefix.toString() + "_" + material.getName()), + VanillaRecipeHelper.addShapedRecipe(provider, + FormattingUtil.toLowerCaseUnder(pipePrefix.toString() + "_" + material.getName()), ChemicalHelper.get(pipePrefix, material), "PR", "Rh", 'P', new UnificationEntry(unrestrictive, material), 'R', ChemicalHelper.get(ring, Iron)); } - private static void processPipeTiny(TagPrefix pipePrefix, Material material, IMaterialProperty property, Consumer provider) { + private static void processPipeTiny(TagPrefix pipePrefix, Material material, IMaterialProperty property, + Consumer provider) { if (material.hasProperty(PropertyKey.WOOD)) return; ItemStack pipeStack = ChemicalHelper.get(pipePrefix, material); EXTRUDER_RECIPES.recipeBuilder("extrude_" + material.getName() + "_tiny_pipe") @@ -93,7 +98,8 @@ private static void processPipeTiny(TagPrefix pipePrefix, Material material, IMa } } - private static void processPipeSmall(TagPrefix pipePrefix, Material material, IMaterialProperty property, Consumer provider) { + private static void processPipeSmall(TagPrefix pipePrefix, Material material, IMaterialProperty property, + Consumer provider) { if (material.hasProperty(PropertyKey.WOOD)) return; ItemStack pipeStack = ChemicalHelper.get(pipePrefix, material); EXTRUDER_RECIPES.recipeBuilder("extrude_" + material.getName() + "_small_pipe") @@ -119,7 +125,8 @@ private static void processPipeSmall(TagPrefix pipePrefix, Material material, IM } } - private static void processPipeNormal(TagPrefix pipePrefix, Material material, IMaterialProperty property, Consumer provider) { + private static void processPipeNormal(TagPrefix pipePrefix, Material material, IMaterialProperty property, + Consumer provider) { if (material.hasProperty(PropertyKey.WOOD)) return; ItemStack pipeStack = ChemicalHelper.get(pipePrefix, material); EXTRUDER_RECIPES.recipeBuilder("extrude_" + material.getName() + "_pipe") @@ -145,7 +152,8 @@ private static void processPipeNormal(TagPrefix pipePrefix, Material material, I } } - private static void processPipeLarge(TagPrefix pipePrefix, Material material, IMaterialProperty property, Consumer provider) { + private static void processPipeLarge(TagPrefix pipePrefix, Material material, IMaterialProperty property, + Consumer provider) { if (material.hasProperty(PropertyKey.WOOD)) return; ItemStack pipeStack = ChemicalHelper.get(pipePrefix, material); EXTRUDER_RECIPES.recipeBuilder("extrude_" + material.getName() + "_large_pipe") @@ -171,7 +179,8 @@ private static void processPipeLarge(TagPrefix pipePrefix, Material material, IM } } - private static void processPipeHuge(TagPrefix pipePrefix, Material material, IMaterialProperty property, Consumer provider) { + private static void processPipeHuge(TagPrefix pipePrefix, Material material, IMaterialProperty property, + Consumer provider) { if (material.hasProperty(PropertyKey.WOOD)) return; ItemStack pipeStack = ChemicalHelper.get(pipePrefix, material); EXTRUDER_RECIPES.recipeBuilder("extrude_" + material.getName() + "_huge_pipe") @@ -197,7 +206,8 @@ private static void processPipeHuge(TagPrefix pipePrefix, Material material, IMa } } - private static void processPipeQuadruple(TagPrefix pipePrefix, Material material, FluidPipeProperties property, Consumer provider) { + private static void processPipeQuadruple(TagPrefix pipePrefix, Material material, FluidPipeProperties property, + Consumer provider) { if (material.hasProperty(PropertyKey.WOOD)) return; ItemStack smallPipe = ChemicalHelper.get(pipeSmallFluid, material); ItemStack quadPipe = ChemicalHelper.get(pipePrefix, material); @@ -214,7 +224,8 @@ private static void processPipeQuadruple(TagPrefix pipePrefix, Material material .save(provider); } - private static void processPipeNonuple(TagPrefix pipePrefix, Material material, FluidPipeProperties property, Consumer provider) { + private static void processPipeNonuple(TagPrefix pipePrefix, Material material, FluidPipeProperties property, + Consumer provider) { if (material.hasProperty(PropertyKey.WOOD)) return; ItemStack smallPipe = ChemicalHelper.get(pipeSmallFluid, material); ItemStack nonuplePipe = ChemicalHelper.get(pipePrefix, material); diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/PolarizingRecipeHandler.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/PolarizingRecipeHandler.java index a12c96f2b3..4e47200bb7 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/PolarizingRecipeHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/PolarizingRecipeHandler.java @@ -6,6 +6,7 @@ import com.gregtechceu.gtceu.api.data.chemical.material.properties.PropertyKey; import com.gregtechceu.gtceu.api.data.tag.TagPrefix; import com.gregtechceu.gtceu.data.recipe.VanillaRecipeHelper; + import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.world.item.ItemStack; @@ -17,9 +18,9 @@ public class PolarizingRecipeHandler { - private static final TagPrefix[] POLARIZING_PREFIXES = new TagPrefix[]{ + private static final TagPrefix[] POLARIZING_PREFIXES = new TagPrefix[] { rod, rodLong, plate, ingot, plateDense, rotor, - bolt, screw, wireFine, foil, ring}; + bolt, screw, wireFine, foil, ring }; public static void init(Consumer provider) { for (TagPrefix orePrefix : POLARIZING_PREFIXES) { @@ -27,21 +28,23 @@ public static void init(Consumer provider) { } } - public static void processPolarizing(TagPrefix polarizingPrefix, Material material, IngotProperty property, Consumer provider) { + public static void processPolarizing(TagPrefix polarizingPrefix, Material material, IngotProperty property, + Consumer provider) { Material magneticMaterial = property.getMagneticMaterial(); if (magneticMaterial != null && polarizingPrefix.doGenerateItem(magneticMaterial)) { ItemStack magneticStack = ChemicalHelper.get(polarizingPrefix, magneticMaterial); - POLARIZER_RECIPES.recipeBuilder("polarize_" + material.getName() + "_" + polarizingPrefix.name) //polarizing + POLARIZER_RECIPES.recipeBuilder("polarize_" + material.getName() + "_" + polarizingPrefix.name) // polarizing .inputItems(polarizingPrefix, material) .outputItems(magneticStack) .duration((int) ((int) material.getMass() * polarizingPrefix.getMaterialAmount(material) / M)) .EUt(8L * getVoltageMultiplier(material)) .save(provider); - VanillaRecipeHelper.addSmeltingRecipe(provider, "demagnetize_" + magneticMaterial.getName() + "_" + polarizingPrefix, + VanillaRecipeHelper.addSmeltingRecipe(provider, + "demagnetize_" + magneticMaterial.getName() + "_" + polarizingPrefix, ChemicalHelper.getTag(polarizingPrefix, magneticMaterial), - ChemicalHelper.get(polarizingPrefix, material)); //de-magnetizing + ChemicalHelper.get(polarizingPrefix, material)); // de-magnetizing } } diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/RecyclingRecipeHandler.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/RecyclingRecipeHandler.java index cd4605f631..4e06306dce 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/RecyclingRecipeHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/RecyclingRecipeHandler.java @@ -7,6 +7,7 @@ import com.gregtechceu.gtceu.api.data.chemical.material.stack.MaterialStack; import com.gregtechceu.gtceu.api.data.tag.TagPrefix; import com.gregtechceu.gtceu.data.recipe.misc.RecyclingRecipes; + import net.minecraft.data.recipes.FinishedRecipe; import java.util.ArrayList; @@ -27,13 +28,12 @@ public class RecyclingRecipeHandler { (Predicate) orePrefix -> orePrefix.name().startsWith("gem"), (Predicate) orePrefix -> orePrefix.name().startsWith("cableGt"), (Predicate) orePrefix -> orePrefix.name().startsWith("wireGt"), - (Predicate) orePrefix -> orePrefix.name().startsWith("pipe") - ); + (Predicate) orePrefix -> orePrefix.name().startsWith("pipe")); private static final List IGNORE_ARC_SMELTING = Arrays.asList(ingot, gem, nugget); public static void init(Consumer provider) { - //registers universal maceration recipes for specified ore prefixes + // registers universal maceration recipes for specified ore prefixes for (TagPrefix orePrefix : TagPrefix.values()) { if (CRUSHING_PREFIXES.stream().anyMatch(object -> { if (object instanceof TagPrefix) @@ -45,15 +45,17 @@ else if (object instanceof Predicate) } } - public static void processCrushing(TagPrefix thingPrefix, Material material, DustProperty property, Consumer provider) { + public static void processCrushing(TagPrefix thingPrefix, Material material, DustProperty property, + Consumer provider) { ArrayList materialStacks = new ArrayList<>(); materialStacks.add(new MaterialStack(material, thingPrefix.getMaterialAmount(material))); materialStacks.addAll(thingPrefix.secondaryMaterials()); - //only ignore arc smelting for blacklisted prefixes if yielded material is the same as input material - //if arc smelting gives different material, allow it - boolean ignoreArcSmelting = IGNORE_ARC_SMELTING.contains(thingPrefix) && !( - material.hasProperty(PropertyKey.INGOT) - && material.getProperty(PropertyKey.INGOT).getArcSmeltingInto() != material); - RecyclingRecipes.registerRecyclingRecipes(provider, ChemicalHelper.get(thingPrefix, material), materialStacks, ignoreArcSmelting, thingPrefix); + // only ignore arc smelting for blacklisted prefixes if yielded material is the same as input material + // if arc smelting gives different material, allow it + boolean ignoreArcSmelting = IGNORE_ARC_SMELTING.contains(thingPrefix) && + !(material.hasProperty(PropertyKey.INGOT) && + material.getProperty(PropertyKey.INGOT).getArcSmeltingInto() != material); + RecyclingRecipes.registerRecyclingRecipes(provider, ChemicalHelper.get(thingPrefix, material), materialStacks, + ignoreArcSmelting, thingPrefix); } } diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/ToolRecipeHandler.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/ToolRecipeHandler.java index b265af05ab..564b1daa5a 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/ToolRecipeHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/ToolRecipeHandler.java @@ -1,6 +1,5 @@ package com.gregtechceu.gtceu.data.recipe.generated; -import com.google.common.collect.ImmutableList; import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.capability.GTCapabilityHelper; import com.gregtechceu.gtceu.api.capability.IElectricItem; @@ -20,7 +19,7 @@ import com.gregtechceu.gtceu.data.recipe.CustomTags; import com.gregtechceu.gtceu.data.recipe.VanillaRecipeHelper; import com.gregtechceu.gtceu.utils.ToolItemHelper; -import com.tterrag.registrate.util.entry.ItemEntry; + import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.data.recipes.SpecialRecipeBuilder; @@ -30,9 +29,12 @@ import net.minecraft.world.item.Items; import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.level.block.Blocks; -import org.apache.commons.lang3.ArrayUtils; +import com.google.common.collect.ImmutableList; +import com.tterrag.registrate.util.entry.ItemEntry; +import org.apache.commons.lang3.ArrayUtils; import org.jetbrains.annotations.NotNull; + import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -78,12 +80,16 @@ public static void initializeGTItems() { powerUnitItems.put(GTValues.IV, GTItems.POWER_UNIT_IV); batteryItems.put(GTValues.ULV, Collections.singletonList(GTItems.BATTERY_ULV_TANTALUM)); - batteryItems.put(GTValues.LV, ImmutableList.of(GTItems.BATTERY_LV_LITHIUM, GTItems.BATTERY_LV_CADMIUM, GTItems.BATTERY_LV_SODIUM)); - batteryItems.put(GTValues.MV, ImmutableList.of(GTItems.BATTERY_MV_LITHIUM, GTItems.BATTERY_MV_CADMIUM, GTItems.BATTERY_MV_SODIUM)); - batteryItems.put(GTValues.HV, ImmutableList.of(GTItems.BATTERY_HV_LITHIUM, GTItems.BATTERY_HV_CADMIUM, GTItems.BATTERY_HV_SODIUM, GTItems.ENERGIUM_CRYSTAL)); + batteryItems.put(GTValues.LV, + ImmutableList.of(GTItems.BATTERY_LV_LITHIUM, GTItems.BATTERY_LV_CADMIUM, GTItems.BATTERY_LV_SODIUM)); + batteryItems.put(GTValues.MV, + ImmutableList.of(GTItems.BATTERY_MV_LITHIUM, GTItems.BATTERY_MV_CADMIUM, GTItems.BATTERY_MV_SODIUM)); + batteryItems.put(GTValues.HV, ImmutableList.of(GTItems.BATTERY_HV_LITHIUM, GTItems.BATTERY_HV_CADMIUM, + GTItems.BATTERY_HV_SODIUM, GTItems.ENERGIUM_CRYSTAL)); batteryItems.put(GTValues.EV, ImmutableList.of(GTItems.BATTERY_EV_VANADIUM, GTItems.LAPOTRON_CRYSTAL)); batteryItems.put(GTValues.IV, ImmutableList.of(GTItems.BATTERY_IV_VANADIUM, GTItems.ENERGY_LAPOTRONIC_ORB)); - batteryItems.put(GTValues.LuV, ImmutableList.of(GTItems.BATTERY_LUV_VANADIUM, GTItems.ENERGY_LAPOTRONIC_ORB_CLUSTER)); + batteryItems.put(GTValues.LuV, + ImmutableList.of(GTItems.BATTERY_LUV_VANADIUM, GTItems.ENERGY_LAPOTRONIC_ORB_CLUSTER)); batteryItems.put(GTValues.ZPM, ImmutableList.of(GTItems.BATTERY_ZPM_NAQUADRIA, GTItems.ENERGY_MODULE)); batteryItems.put(GTValues.UV, ImmutableList.of(GTItems.BATTERY_UV_NAQUADRIA, GTItems.ENERGY_CLUSTER)); @@ -107,8 +113,11 @@ public static void registerPowerUnitRecipes(Consumer provider) { if (powerUnitItems.get(tier) != null) { ItemStack batteryStack = batteryItem.asStack(); long maxCharge = GTCapabilityHelper.getElectricItem(batteryStack).getMaxCharge(); - ItemStack powerUnitStack = ToolItemHelper.getMaxChargeOverrideStack(powerUnitItems.get(tier).get(), maxCharge); - String recipeName = String.format("%s_%s", BuiltInRegistries.ITEM.getKey(powerUnitItems.get(tier).get()).getPath(), BuiltInRegistries.ITEM.getKey(batteryItem.get()).getPath()); + ItemStack powerUnitStack = ToolItemHelper.getMaxChargeOverrideStack(powerUnitItems.get(tier).get(), + maxCharge); + String recipeName = String.format("%s_%s", + BuiltInRegistries.ITEM.getKey(powerUnitItems.get(tier).get()).getPath(), + BuiltInRegistries.ITEM.getKey(batteryItem.get()).getPath()); VanillaRecipeHelper.addShapedEnergyTransferRecipe(provider, true, false, true, recipeName, Ingredient.of(batteryStack), powerUnitStack, @@ -121,13 +130,14 @@ public static void registerPowerUnitRecipes(Consumer provider) { } } } - } - private static void processTool(TagPrefix prefix, Material material, ToolProperty property, Consumer provider) { + private static void processTool(TagPrefix prefix, Material material, ToolProperty property, + Consumer provider) { ItemStack stick = new ItemStack(Items.STICK); UnificationEntry plate = new UnificationEntry(TagPrefix.plate, material); - UnificationEntry ingot = new UnificationEntry(material.hasProperty(PropertyKey.GEM) ? TagPrefix.gem : TagPrefix.ingot, material); + UnificationEntry ingot = new UnificationEntry( + material.hasProperty(PropertyKey.GEM) ? TagPrefix.gem : TagPrefix.ingot, material); if (material.hasFlag(GENERATE_PLATE)) { @@ -186,7 +196,7 @@ private static void processTool(TagPrefix prefix, Material material, ToolPropert 'S', stick); addToolRecipe(provider, material, GTToolType.FILE, true, - " P ", " P " , " S ", + " P ", " P ", " S ", 'P', plate, 'S', stick); @@ -229,8 +239,10 @@ private static void processTool(TagPrefix prefix, Material material, ToolPropert } } - private static void processElectricTool(TagPrefix prefix, Material material, ToolProperty property, Consumer provider) { - final int voltageMultiplier = material.getBlastTemperature() > 2800 ? GTValues.VA[GTValues.LV] : GTValues.VA[GTValues.ULV]; + private static void processElectricTool(TagPrefix prefix, Material material, ToolProperty property, + Consumer provider) { + final int voltageMultiplier = material.getBlastTemperature() > 2800 ? GTValues.VA[GTValues.LV] : + GTValues.VA[GTValues.ULV]; TagPrefix toolPrefix; if (material.hasFlag(GENERATE_PLATE)) { @@ -242,58 +254,60 @@ private static void processElectricTool(TagPrefix prefix, Material material, Too if (property.hasType(GTToolType.DRILL_LV)) { toolPrefix = TagPrefix.toolHeadDrill; VanillaRecipeHelper.addShapedRecipe(provider, String.format("drill_head_%s", material.getName()), - ChemicalHelper.get(toolPrefix, material), - "XSX", "XSX", "ShS", - 'X', plate, - 'S', steelPlate); + ChemicalHelper.get(toolPrefix, material), + "XSX", "XSX", "ShS", + 'X', plate, + 'S', steelPlate); - addElectricToolRecipe(toolPrefix, material, new GTToolType[]{GTToolType.DRILL_LV, GTToolType.DRILL_MV, GTToolType.DRILL_HV, GTToolType.DRILL_EV, GTToolType.DRILL_IV}, provider); + addElectricToolRecipe(toolPrefix, material, new GTToolType[] { GTToolType.DRILL_LV, GTToolType.DRILL_MV, + GTToolType.DRILL_HV, GTToolType.DRILL_EV, GTToolType.DRILL_IV }, provider); } - // chainsaw if (property.hasType(GTToolType.CHAINSAW_LV)) { toolPrefix = TagPrefix.toolHeadChainsaw; VanillaRecipeHelper.addShapedRecipe(provider, String.format("chainsaw_head_%s", material.getName()), - ChemicalHelper.get(toolPrefix, material), - "SRS", "XhX", "SRS", - 'X', plate, - 'S', steelPlate, - 'R', steelRing); + ChemicalHelper.get(toolPrefix, material), + "SRS", "XhX", "SRS", + 'X', plate, + 'S', steelPlate, + 'R', steelRing); - addElectricToolRecipe(toolPrefix, material, new GTToolType[]{GTToolType.CHAINSAW_LV}, provider); + addElectricToolRecipe(toolPrefix, material, new GTToolType[] { GTToolType.CHAINSAW_LV }, provider); } // wrench if (property.hasType(GTToolType.WRENCH_LV)) { toolPrefix = TagPrefix.toolHeadWrench; - addElectricToolRecipe(toolPrefix, material, new GTToolType[]{GTToolType.WRENCH_LV, GTToolType.WRENCH_HV, GTToolType.WRENCH_IV}, provider); + addElectricToolRecipe(toolPrefix, material, + new GTToolType[] { GTToolType.WRENCH_LV, GTToolType.WRENCH_HV, GTToolType.WRENCH_IV }, + provider); VanillaRecipeHelper.addShapedRecipe(provider, String.format("wrench_head_%s", material.getName()), - ChemicalHelper.get(toolPrefix, material), - "hXW", "XRX", "WXd", - 'X', plate, - 'R', steelRing, - 'W', new UnificationEntry(TagPrefix.screw, GTMaterials.Steel)); + ChemicalHelper.get(toolPrefix, material), + "hXW", "XRX", "WXd", + 'X', plate, + 'R', steelRing, + 'W', new UnificationEntry(TagPrefix.screw, GTMaterials.Steel)); } // buzzsaw if (property.hasType(GTToolType.BUZZSAW)) { toolPrefix = TagPrefix.toolHeadBuzzSaw; - addElectricToolRecipe(toolPrefix, material, new GTToolType[]{GTToolType.BUZZSAW}, provider); + addElectricToolRecipe(toolPrefix, material, new GTToolType[] { GTToolType.BUZZSAW }, provider); VanillaRecipeHelper.addShapedRecipe(provider, String.format("buzzsaw_blade_%s", material.getName()), - ChemicalHelper.get(toolPrefix, material), - "sXh", "X X", "fXx", - 'X', plate); + ChemicalHelper.get(toolPrefix, material), + "sXh", "X X", "fXx", + 'X', plate); if (material.hasFlag(GENERATE_GEAR)) { GTRecipeTypes.LATHE_RECIPES.recipeBuilder("buzzsaw_gear_" + material.getName()) - .inputItems(TagPrefix.gear, material) - .outputItems(toolPrefix, material) - .duration((int) material.getMass() * 4) - .EUt(8L * voltageMultiplier) - .save(provider); + .inputItems(TagPrefix.gear, material) + .outputItems(toolPrefix, material) + .duration((int) material.getMass() * 4) + .EUt(8L * voltageMultiplier) + .save(provider); } } } @@ -302,17 +316,18 @@ private static void processElectricTool(TagPrefix prefix, Material material, Too if (property.hasType(GTToolType.SCREWDRIVER_LV)) { if (material.hasFlag(GENERATE_LONG_ROD)) { toolPrefix = TagPrefix.toolHeadScrewdriver; - addElectricToolRecipe(toolPrefix, material, new GTToolType[]{GTToolType.SCREWDRIVER_LV}, provider); + addElectricToolRecipe(toolPrefix, material, new GTToolType[] { GTToolType.SCREWDRIVER_LV }, provider); VanillaRecipeHelper.addShapedRecipe(provider, String.format("screwdriver_tip_%s", material.getName()), - ChemicalHelper.get(toolPrefix, material), - "fR", " h", - 'R', new UnificationEntry(TagPrefix.rodLong, material)); + ChemicalHelper.get(toolPrefix, material), + "fR", " h", + 'R', new UnificationEntry(TagPrefix.rodLong, material)); } } } - public static void addElectricToolRecipe(TagPrefix toolHead, Material material, GTToolType[] toolItems, Consumer provider) { + public static void addElectricToolRecipe(TagPrefix toolHead, Material material, GTToolType[] toolItems, + Consumer provider) { for (GTToolType toolType : toolItems) { if (!material.getProperty(PropertyKey.TOOL).hasType(toolType)) continue; @@ -331,7 +346,8 @@ public static void addElectricToolRecipe(TagPrefix toolHead, Material material, } } - public static void addToolRecipe(Consumer provider, @NotNull Material material, @NotNull GTToolType tool, boolean mirrored, Object... recipe) { + public static void addToolRecipe(Consumer provider, @NotNull Material material, + @NotNull GTToolType tool, boolean mirrored, Object... recipe) { ItemStack toolStack = ToolHelper.get(tool, material); if (toolStack.isEmpty()) return; if (mirrored) { // todo mirrored @@ -346,19 +362,23 @@ public static void addToolRecipe(Consumer provider, @NotNull Mat /** * {@code D} is inferred as the dye key */ - public static void addDyeableToolRecipe(Consumer provider, @NotNull Material material, @NotNull GTToolType tool, boolean mirrored, Object... recipe) { + public static void addDyeableToolRecipe(Consumer provider, @NotNull Material material, + @NotNull GTToolType tool, boolean mirrored, Object... recipe) { ItemStack toolStack = ToolHelper.get(tool, material); if (toolStack.isEmpty()) return; for (var color : MarkerMaterials.Color.COLORS.entrySet()) { ToolHelper.getToolTag(toolStack).putInt(ToolHelper.TINT_COLOR_KEY, color.getKey().getTextColor()); - Object[] recipeWithDye = ArrayUtils.addAll(recipe, 'D', new UnificationEntry(TagPrefix.dye, color.getValue())); + Object[] recipeWithDye = ArrayUtils.addAll(recipe, 'D', + new UnificationEntry(TagPrefix.dye, color.getValue())); if (mirrored) { // todo mirrored - VanillaRecipeHelper.addShapedRecipe(provider, String.format("%s_%s_%s", tool.name, material.getName(), color.getKey().getSerializedName()), - toolStack, recipeWithDye); + VanillaRecipeHelper.addShapedRecipe(provider, + String.format("%s_%s_%s", tool.name, material.getName(), color.getKey().getSerializedName()), + toolStack, recipeWithDye); } else { - VanillaRecipeHelper.addShapedRecipe(provider, String.format("%s_%s_%s", tool.name, material.getName(), color.getKey().getSerializedName()), - toolStack, recipeWithDye); + VanillaRecipeHelper.addShapedRecipe(provider, + String.format("%s_%s_%s", tool.name, material.getName(), color.getKey().getSerializedName()), + toolStack, recipeWithDye); } } } @@ -369,7 +389,8 @@ public static void registerCustomToolRecipes(Consumer provider) registerSoftToolRecipes(provider); registerElectricRecipes(provider); - SpecialRecipeBuilder.special(ToolHeadReplaceRecipe.SERIALIZER).save(provider, "gtceu:crafting/replace_tool_head"); + SpecialRecipeBuilder.special(ToolHeadReplaceRecipe.SERIALIZER).save(provider, + "gtceu:crafting/replace_tool_head"); } private static void registerFlintToolRecipes(Consumer provider) { @@ -413,19 +434,21 @@ private static void registerFlintToolRecipes(Consumer provider) } private static void registerMortarRecipes(Consumer provider) { - for (Material material : new Material[]{ + for (Material material : new Material[] { GTMaterials.Bronze, GTMaterials.Iron, GTMaterials.Invar, GTMaterials.Steel, GTMaterials.DamascusSteel, GTMaterials.CobaltBrass, GTMaterials.WroughtIron }) { addToolRecipe(provider, material, GTToolType.MORTAR, false, " I ", "SIS", "SSS", - 'I', new UnificationEntry(material.hasProperty(PropertyKey.GEM) ? TagPrefix.gem : TagPrefix.ingot, material), + 'I', + new UnificationEntry(material.hasProperty(PropertyKey.GEM) ? TagPrefix.gem : TagPrefix.ingot, + material), 'S', new ItemStack(Blocks.STONE)); } } private static void registerSoftToolRecipes(Consumer provider) { - final Material[] softMaterials = new Material[]{ + final Material[] softMaterials = new Material[] { GTMaterials.Wood, GTMaterials.Rubber, GTMaterials.Polyethylene, GTMaterials.Polytetrafluoroethylene, GTMaterials.Polybenzimidazole }; @@ -459,9 +482,9 @@ private static void registerSoftToolRecipes(Consumer provider) { } private static void registerElectricRecipes(Consumer provider) { - for (ItemEntry batteryItem : batteryItems.get(LV)) { - VanillaRecipeHelper.addShapedEnergyTransferRecipe(provider, true, false, true, "prospector_lv_" + batteryItem.getId().getPath(), + VanillaRecipeHelper.addShapedEnergyTransferRecipe(provider, true, false, true, + "prospector_lv_" + batteryItem.getId().getPath(), Ingredient.of(batteryItem), GTItems.PROSPECTOR_LV.asStack(), "EPS", "CDC", "PBP", 'E', GTItems.EMITTER_LV.asStack(), @@ -471,7 +494,8 @@ private static void registerElectricRecipes(Consumer provider) { 'C', CustomTags.LV_CIRCUITS, 'B', batteryItem.asStack()); - VanillaRecipeHelper.addShapedEnergyTransferRecipe(provider, true, false, true, "lv_magnet_" + batteryItem.getId().getPath(), + VanillaRecipeHelper.addShapedEnergyTransferRecipe(provider, true, false, true, + "lv_magnet_" + batteryItem.getId().getPath(), Ingredient.of(batteryItem), GTItems.ITEM_MAGNET_LV.asStack(), "MwM", "MBM", "CPC", 'M', new UnificationEntry(rod, GTMaterials.SteelMagnetic), @@ -481,8 +505,9 @@ private static void registerElectricRecipes(Consumer provider) { } for (ItemEntry batteryItem : batteryItems.get(MV)) { - VanillaRecipeHelper.addShapedEnergyTransferRecipe(provider, true, false, true, "portable_scanner_" + batteryItem.getId().getPath(), - Ingredient.of(batteryItem), GTItems.PORTABLE_SCANNER.asStack(), + VanillaRecipeHelper.addShapedEnergyTransferRecipe(provider, true, false, true, + "portable_scanner_" + batteryItem.getId().getPath(), + Ingredient.of(batteryItem), GTItems.PORTABLE_SCANNER.asStack(), "EPS", "CDC", "PBP", 'E', GTItems.EMITTER_MV.asStack(), 'P', new UnificationEntry(plate, GTMaterials.Aluminium), @@ -492,9 +517,9 @@ private static void registerElectricRecipes(Consumer provider) { 'B', batteryItem.asStack()); } - for (ItemEntry batteryItem : batteryItems.get(HV)) { - VanillaRecipeHelper.addShapedEnergyTransferRecipe(provider, true, false, true, "prospector_hv_" + batteryItem.getId().getPath(), + VanillaRecipeHelper.addShapedEnergyTransferRecipe(provider, true, false, true, + "prospector_hv_" + batteryItem.getId().getPath(), Ingredient.of(batteryItem), GTItems.PROSPECTOR_HV.asStack(), "EPS", "CDC", "PBP", 'E', GTItems.EMITTER_HV.asStack(), @@ -504,7 +529,8 @@ private static void registerElectricRecipes(Consumer provider) { 'C', CustomTags.HV_CIRCUITS, 'B', batteryItem.asStack()); - VanillaRecipeHelper.addShapedEnergyTransferRecipe(provider, true, false, true, "hv_magnet_" + batteryItem.getId().getPath(), + VanillaRecipeHelper.addShapedEnergyTransferRecipe(provider, true, false, true, + "hv_magnet_" + batteryItem.getId().getPath(), Ingredient.of(batteryItem), GTItems.ITEM_MAGNET_HV.asStack(), "MwM", "MBM", "CPC", 'M', new UnificationEntry(rod, GTMaterials.NeodymiumMagnetic), @@ -514,7 +540,8 @@ private static void registerElectricRecipes(Consumer provider) { } for (ItemEntry batteryItem : batteryItems.get(LuV)) { - VanillaRecipeHelper.addShapedEnergyTransferRecipe(provider, true, false, true, "prospector_luv_" + batteryItem.getId().getPath(), + VanillaRecipeHelper.addShapedEnergyTransferRecipe(provider, true, false, true, + "prospector_luv_" + batteryItem.getId().getPath(), Ingredient.of(batteryItem), GTItems.PROSPECTOR_LUV.asStack(), "EPS", "CDC", "PBP", 'E', GTItems.EMITTER_LuV.asStack(), @@ -525,5 +552,4 @@ private static void registerElectricRecipes(Consumer provider) { 'B', batteryItem.asStack()); } } - } diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/WireCombiningHandler.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/WireCombiningHandler.java index 9b228d934c..7e1ae80325 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/WireCombiningHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/WireCombiningHandler.java @@ -1,6 +1,5 @@ package com.gregtechceu.gtceu.data.recipe.generated; -import com.google.common.collect.ImmutableMap; import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.data.chemical.ChemicalHelper; import com.gregtechceu.gtceu.api.data.chemical.material.Material; @@ -10,7 +9,10 @@ import com.gregtechceu.gtceu.api.data.tag.TagPrefix; import com.gregtechceu.gtceu.common.data.GTMaterials; import com.gregtechceu.gtceu.data.recipe.VanillaRecipeHelper; + import net.minecraft.data.recipes.FinishedRecipe; + +import com.google.common.collect.ImmutableMap; import org.apache.commons.lang3.ArrayUtils; import java.util.Map; @@ -21,7 +23,7 @@ public class WireCombiningHandler { - private static final TagPrefix[] WIRE_DOUBLING_ORDER = new TagPrefix[]{ + private static final TagPrefix[] WIRE_DOUBLING_ORDER = new TagPrefix[] { wireGtSingle, wireGtDouble, wireGtQuadruple, wireGtOctal, wireGtHex }; @@ -30,11 +32,9 @@ public class WireCombiningHandler { cableGtDouble, wireGtDouble, cableGtQuadruple, wireGtQuadruple, cableGtOctal, wireGtOctal, - cableGtHex, wireGtHex - ); + cableGtHex, wireGtHex); public static void init(Consumer provider) { - // Generate Wire Packer/Unpacker recipes wireGtSingle.executeHandler(provider, PropertyKey.WIRE, WireCombiningHandler::processWireCompression); @@ -49,24 +49,28 @@ public static void init(Consumer provider) { } } - private static void generateWireCombiningRecipe(TagPrefix wirePrefix, Material material, WireProperties property, Consumer provider) { + private static void generateWireCombiningRecipe(TagPrefix wirePrefix, Material material, WireProperties property, + Consumer provider) { int wireIndex = ArrayUtils.indexOf(WIRE_DOUBLING_ORDER, wirePrefix); if (wireIndex < WIRE_DOUBLING_ORDER.length - 1) { - VanillaRecipeHelper.addShapelessRecipe(provider, String.format("%s_wire_%s_doubling", material.getName(), wirePrefix), + VanillaRecipeHelper.addShapelessRecipe(provider, + String.format("%s_wire_%s_doubling", material.getName(), wirePrefix), ChemicalHelper.get(WIRE_DOUBLING_ORDER[wireIndex + 1], material), new UnificationEntry(wirePrefix, material), new UnificationEntry(wirePrefix, material)); } if (wireIndex > 0) { - VanillaRecipeHelper.addShapelessRecipe(provider, String.format("%s_wire_%s_splitting", material.getName(), wirePrefix), + VanillaRecipeHelper.addShapelessRecipe(provider, + String.format("%s_wire_%s_splitting", material.getName(), wirePrefix), ChemicalHelper.get(WIRE_DOUBLING_ORDER[wireIndex - 1], material, 2), new UnificationEntry(wirePrefix, material)); } if (wireIndex < 3) { - VanillaRecipeHelper.addShapelessRecipe(provider, String.format("%s_wire_%s_quadrupling", material.getName(), wirePrefix), + VanillaRecipeHelper.addShapelessRecipe(provider, + String.format("%s_wire_%s_quadrupling", material.getName(), wirePrefix), ChemicalHelper.get(WIRE_DOUBLING_ORDER[wireIndex + 2], material), new UnificationEntry(wirePrefix, material), new UnificationEntry(wirePrefix, material), @@ -75,7 +79,8 @@ private static void generateWireCombiningRecipe(TagPrefix wirePrefix, Material m } } - private static void processWireCompression(TagPrefix prefix, Material material, WireProperties property, Consumer provider) { + private static void processWireCompression(TagPrefix prefix, Material material, WireProperties property, + Consumer provider) { for (int startTier = 0; startTier < 4; startTier++) { for (int i = 1; i < 5 - startTier; i++) { PACKER_RECIPES.recipeBuilder("pack_" + material.getName() + "_wires_" + i + "_" + startTier) @@ -95,11 +100,13 @@ private static void processWireCompression(TagPrefix prefix, Material material, } } - private static void processCableStripping(TagPrefix prefix, Material material, WireProperties property, Consumer provider) { + private static void processCableStripping(TagPrefix prefix, Material material, WireProperties property, + Consumer provider) { PACKER_RECIPES.recipeBuilder("strip_" + material.getName() + "_" + prefix.name) .inputItems(prefix, material) .outputItems(cableToWireMap.get(prefix), material) - .outputItems(plate, GTMaterials.Rubber, (int) (prefix.secondaryMaterials().get(0).amount() / GTValues.M)) + .outputItems(plate, GTMaterials.Rubber, + (int) (prefix.secondaryMaterials().get(0).amount() / GTValues.M)) .duration(100).EUt(GTValues.VA[GTValues.ULV]) .save(provider); } diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/WireRecipeHandler.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/WireRecipeHandler.java index b8a148daf1..ca88de6e84 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/WireRecipeHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/WireRecipeHandler.java @@ -1,6 +1,5 @@ package com.gregtechceu.gtceu.data.recipe.generated; -import com.google.common.collect.ImmutableMap; import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.data.chemical.ChemicalHelper; import com.gregtechceu.gtceu.api.data.chemical.material.Material; @@ -12,17 +11,18 @@ import com.gregtechceu.gtceu.data.recipe.VanillaRecipeHelper; import com.gregtechceu.gtceu.data.recipe.builder.GTRecipeBuilder; import com.gregtechceu.gtceu.utils.GTUtil; + import net.minecraft.data.recipes.FinishedRecipe; +import com.google.common.collect.ImmutableMap; + import java.util.Map; import java.util.function.Consumer; import static com.gregtechceu.gtceu.api.GTValues.*; - import static com.gregtechceu.gtceu.api.data.chemical.material.info.MaterialFlags.GENERATE_FINE_WIRE; -import static com.gregtechceu.gtceu.api.data.chemical.material.info.MaterialFlags.NO_WORKING; import static com.gregtechceu.gtceu.api.data.chemical.material.info.MaterialFlags.GENERATE_PLATE; - +import static com.gregtechceu.gtceu.api.data.chemical.material.info.MaterialFlags.NO_WORKING; import static com.gregtechceu.gtceu.api.data.tag.TagPrefix.*; import static com.gregtechceu.gtceu.common.data.GTMaterials.*; import static com.gregtechceu.gtceu.common.data.GTRecipeTypes.*; @@ -34,10 +34,10 @@ * - Rubber: This can be used for any cable EV-tier or lower. After that it is unavailable. *
* - Silicone Rubber: This can be used for any cable tier, saving the amount of fluid needed. However, at IV, - * it will require a Foil of the cable material as well, making it undesirable. + * it will require a Foil of the cable material as well, making it undesirable. *
* - Styrene-Butadiene Rubber (SBR): This can be used for any cable tier, and is the most optimal cable-covering - * fluid available. + * fluid available. *
* Extra Materials for Cable Covering: * - Polyphenylene Sulfide (PPS): At LuV, this foil is required to cover cables. Lower tiers will not use it. @@ -51,13 +51,11 @@ public class WireRecipeHandler { cableGtDouble, 1, cableGtQuadruple, 2, cableGtOctal, 3, - cableGtHex, 5 - ); + cableGtHex, 5); - private static final TagPrefix[] wireSizes = {wireGtDouble, wireGtQuadruple, wireGtOctal, wireGtHex}; + private static final TagPrefix[] wireSizes = { wireGtDouble, wireGtQuadruple, wireGtOctal, wireGtHex }; public static void init(Consumer provider) { - // Generate Wire creation recipes (Wiremill, Extruder, Wire Cutters) // Wiremill: Ingot -> 1x, 2x, 4x, 8x, 16x, Fine // Wiremill: 1x Wire -> Fine @@ -73,9 +71,10 @@ public static void init(Consumer provider) { wireGtHex.executeHandler(provider, PropertyKey.WIRE, WireRecipeHandler::generateCableCovering); } - - public static void processWires(TagPrefix wirePrefix, Material material, WireProperties property, Consumer provider) { - TagPrefix prefix = material.hasProperty(PropertyKey.INGOT) ? ingot : material.hasProperty(PropertyKey.GEM) ? gem : dust; + public static void processWires(TagPrefix wirePrefix, Material material, WireProperties property, + Consumer provider) { + TagPrefix prefix = material.hasProperty(PropertyKey.INGOT) ? ingot : + material.hasProperty(PropertyKey.GEM) ? gem : dust; EXTRUDER_RECIPES.recipeBuilder("extrude_" + material.getName() + "_wire") .inputItems(prefix, material) @@ -86,32 +85,32 @@ public static void processWires(TagPrefix wirePrefix, Material material, WirePro .save(provider); WIREMILL_RECIPES.recipeBuilder("mill_" + material.getName() + "_wire") - .inputItems(prefix, material) - .circuitMeta(1) - .outputItems(wireGtSingle, material, 2) - .duration((int) material.getMass()) - .EUt(getVoltageMultiplier(material)) - .save(provider); + .inputItems(prefix, material) + .circuitMeta(1) + .outputItems(wireGtSingle, material, 2) + .duration((int) material.getMass()) + .EUt(getVoltageMultiplier(material)) + .save(provider); for (TagPrefix wireSize : wireSizes) { final int multiplier = (int) (wireSize.getMaterialAmount(material) / GTValues.M); WIREMILL_RECIPES.recipeBuilder("mill_" + material.getName() + "_wire_" + (multiplier * 2)) - .inputItems(prefix, material, multiplier) - .circuitMeta(multiplier * 2) - .outputItems(wireSize, material) - .duration((int) material.getMass() * multiplier) - .EUt(getVoltageMultiplier(material)) - .save(provider); + .inputItems(prefix, material, multiplier) + .circuitMeta(multiplier * 2) + .outputItems(wireSize, material) + .duration((int) material.getMass() * multiplier) + .EUt(getVoltageMultiplier(material)) + .save(provider); } if (material.hasFlag(GENERATE_FINE_WIRE)) { WIREMILL_RECIPES.recipeBuilder("mill_" + material.getName() + "_wire_fine") - .inputItems(prefix, material, 1) - .circuitMeta(3) - .outputItems(wireFine, material, 8) - .duration((int) material.getMass() * 3) - .EUt(getVoltageMultiplier(material)) - .save(provider); + .inputItems(prefix, material, 1) + .circuitMeta(3) + .outputItems(wireFine, material, 8) + .duration((int) material.getMass() * 3) + .EUt(getVoltageMultiplier(material)) + .save(provider); } if (!material.hasFlag(NO_WORKING) && material.hasFlag(GENERATE_PLATE)) { @@ -121,8 +120,8 @@ public static void processWires(TagPrefix wirePrefix, Material material, WirePro } } - public static void generateCableCovering(TagPrefix wirePrefix, Material material, WireProperties property, Consumer provider) { - + public static void generateCableCovering(TagPrefix wirePrefix, Material material, WireProperties property, + Consumer provider) { // Superconductors have no Cables, so exit early if (property.isSuperconductor()) return; @@ -138,7 +137,8 @@ public static void generateCableCovering(TagPrefix wirePrefix, Material material // Rubber Recipe (ULV-EV cables) if (voltageTier <= EV) { - GTRecipeBuilder builder = ASSEMBLER_RECIPES.recipeBuilder("cover_" + material.getName() + "_" + wirePrefix + "_rubber") + GTRecipeBuilder builder = ASSEMBLER_RECIPES + .recipeBuilder("cover_" + material.getName() + "_" + wirePrefix + "_rubber") .EUt(VA[ULV]).duration(100) .inputItems(wirePrefix, material) .outputItems(cablePrefix, material) @@ -151,7 +151,8 @@ public static void generateCableCovering(TagPrefix wirePrefix, Material material } // Silicone Rubber Recipe (all cables) - GTRecipeBuilder builder = ASSEMBLER_RECIPES.recipeBuilder("cover_" + material.getName() + "_" + wirePrefix + "_silicone") + GTRecipeBuilder builder = ASSEMBLER_RECIPES + .recipeBuilder("cover_" + material.getName() + "_" + wirePrefix + "_silicone") .EUt(VA[ULV]).duration(100) .inputItems(wirePrefix, material) .outputItems(cablePrefix, material); @@ -170,7 +171,8 @@ public static void generateCableCovering(TagPrefix wirePrefix, Material material .save(provider); // Styrene Butadiene Rubber Recipe (all cables) - builder = ASSEMBLER_RECIPES.recipeBuilder("cover_" + material.getName() + "_" + wirePrefix + "_styrene_butadiene") + builder = ASSEMBLER_RECIPES + .recipeBuilder("cover_" + material.getName() + "_" + wirePrefix + "_styrene_butadiene") .EUt(VA[ULV]).duration(100) .inputItems(wirePrefix, material) .outputItems(cablePrefix, material); @@ -189,7 +191,8 @@ public static void generateCableCovering(TagPrefix wirePrefix, Material material .save(provider); } - private static void generateManualRecipe(TagPrefix wirePrefix, Material material, TagPrefix cablePrefix, int cableAmount, Consumer provider) { + private static void generateManualRecipe(TagPrefix wirePrefix, Material material, TagPrefix cablePrefix, + int cableAmount, Consumer provider) { int insulationAmount = INSULATION_AMOUNT.get(cablePrefix); Object[] ingredients = new Object[insulationAmount + 1]; ingredients[0] = new UnificationEntry(wirePrefix, material); @@ -198,8 +201,7 @@ private static void generateManualRecipe(TagPrefix wirePrefix, Material material } VanillaRecipeHelper.addShapelessRecipe(provider, String.format("%s_cable_%d", material.getName(), cableAmount), ChemicalHelper.get(cablePrefix, material), - ingredients - ); + ingredients); PACKER_RECIPES.recipeBuilder("cover_" + material.getName() + "_" + wirePrefix) .inputItems(wirePrefix, material) diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/AssemblerRecipeLoader.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/AssemblerRecipeLoader.java index cf3d0e2d13..3261ef51a4 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/AssemblerRecipeLoader.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/AssemblerRecipeLoader.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.data.recipe.misc; import com.gregtechceu.gtceu.config.ConfigHolder; + import net.minecraft.data.recipes.FinishedRecipe; import java.util.function.Consumer; @@ -15,7 +16,6 @@ public class AssemblerRecipeLoader { public static void init(Consumer provider) { - // Gearbox-like ASSEMBLER_RECIPES.recipeBuilder("bronze_gearbox_casing") .inputItems(plate, Bronze, 4) @@ -79,49 +79,49 @@ public static void init(Consumer provider) { .duration(200).EUt(VA[ULV]).save(provider); // TODO Foam Sprayer - //ASSEMBLER_RECIPES.recipeBuilder("foam_sprayer") - // .inputItems(plate, Tin, 6) - // .inputItems(SPRAY_EMPTY) - // .inputItems(paneGlass.name(), 1) - // .outputItems(FOAM_SPRAYER) - // .duration(200).EUt(VA[ULV]).save(provider); + // ASSEMBLER_RECIPES.recipeBuilder("foam_sprayer") + // .inputItems(plate, Tin, 6) + // .inputItems(SPRAY_EMPTY) + // .inputItems(paneGlass.name(), 1) + // .outputItems(FOAM_SPRAYER) + // .duration(200).EUt(VA[ULV]).save(provider); // TODO Matches/lighters recipes - //ASSEMBLER_RECIPES.recipeBuilder("tool_lighter_invar") - // .inputItems(plate, Invar, 2) - // .inputItems(Items.FLINT) - // .outputItems(TOOL_LIGHTER_INVAR) - // .duration(256).EUt(16).save(provider); - - //ASSEMBLER_RECIPES.recipeBuilder("tool_lighter_platinum") - // .inputItems(plate, Platinum, 2) - // .inputItems(Items.FLINT) - // .outputItems(TOOL_LIGHTER_PLATINUM) - // .duration(256).EUt(256).save(provider); - - //ASSEMBLER_RECIPES.recipeBuilder("tool_matches_0") - // .inputItems(bolt, Wood) - // .inputItems(dustSmall, Phosphorus) - // .outputItems(TOOL_MATCHES) - // .duration(16).EUt(16).save(provider); - - //ASSEMBLER_RECIPES.recipeBuilder("tool_matches_1") - // .inputItems(bolt, Wood) - // .inputItems(dustSmall, TricalciumPhosphate) - // .outputItems(TOOL_MATCHES) - // .duration(16).EUt(16).save(provider); - - //ASSEMBLER_RECIPES.recipeBuilder("tool_matches_2") - // .inputItems(bolt, Wood, 4) - // .inputItems(dust, Phosphorus) - // .outputItems(TOOL_MATCHES, 4) - // .duration(64).EUt(16).save(provider); - - //ASSEMBLER_RECIPES.recipeBuilder("tool_matches_3") - // .inputItems(bolt, Wood, 4) - // .inputItems(dust, TricalciumPhosphate) - // .outputItems(TOOL_MATCHES, 4) - // .duration(64).EUt(16).save(provider); + // ASSEMBLER_RECIPES.recipeBuilder("tool_lighter_invar") + // .inputItems(plate, Invar, 2) + // .inputItems(Items.FLINT) + // .outputItems(TOOL_LIGHTER_INVAR) + // .duration(256).EUt(16).save(provider); + + // ASSEMBLER_RECIPES.recipeBuilder("tool_lighter_platinum") + // .inputItems(plate, Platinum, 2) + // .inputItems(Items.FLINT) + // .outputItems(TOOL_LIGHTER_PLATINUM) + // .duration(256).EUt(256).save(provider); + + // ASSEMBLER_RECIPES.recipeBuilder("tool_matches_0") + // .inputItems(bolt, Wood) + // .inputItems(dustSmall, Phosphorus) + // .outputItems(TOOL_MATCHES) + // .duration(16).EUt(16).save(provider); + + // ASSEMBLER_RECIPES.recipeBuilder("tool_matches_1") + // .inputItems(bolt, Wood) + // .inputItems(dustSmall, TricalciumPhosphate) + // .outputItems(TOOL_MATCHES) + // .duration(16).EUt(16).save(provider); + + // ASSEMBLER_RECIPES.recipeBuilder("tool_matches_2") + // .inputItems(bolt, Wood, 4) + // .inputItems(dust, Phosphorus) + // .outputItems(TOOL_MATCHES, 4) + // .duration(64).EUt(16).save(provider); + + // ASSEMBLER_RECIPES.recipeBuilder("tool_matches_3") + // .inputItems(bolt, Wood, 4) + // .inputItems(dust, TricalciumPhosphate) + // .outputItems(TOOL_MATCHES, 4) + // .duration(64).EUt(16).save(provider); ASSEMBLER_RECIPES.recipeBuilder("small_wood_pipe").duration(200).EUt(VA[LV]) .inputItems(plate, Wood) @@ -166,7 +166,6 @@ public static void init(Consumer provider) { .outputItems(pipeLargeFluid, TreatedWood) .save(provider); - // Voltage Coils ASSEMBLER_RECIPES.recipeBuilder("voltage_coil_ulv").duration(200).EUt(VA[ULV]) .inputItems(rod, IronMagnetic) @@ -240,36 +239,35 @@ public static void init(Consumer provider) { .outputItems(NEUTRON_REFLECTOR) .save(provider); - - //hazmat pieces + // hazmat pieces ASSEMBLER_RECIPES.recipeBuilder("hazmat_boots").duration(200).EUt(VA[LV]) - .inputItems(plate, Rubber,4) - .inputItems(foil, Polyethylene, 2) - .inputItems(plate, PolyvinylChloride, 2) - .outputItems(HAZMAT_BOOTS) - .save(provider); + .inputItems(plate, Rubber, 4) + .inputItems(foil, Polyethylene, 2) + .inputItems(plate, PolyvinylChloride, 2) + .outputItems(HAZMAT_BOOTS) + .save(provider); ASSEMBLER_RECIPES.recipeBuilder("hazmat_chestpiece").duration(200).EUt(VA[LV]) - .inputItems(plate, Rubber,2) - .inputItems(plate, PolyvinylChloride, 7) - .inputItems(plate, Lead, 3) - .outputItems(HAZMAT_CHESTPLATE) - .save(provider); + .inputItems(plate, Rubber, 2) + .inputItems(plate, PolyvinylChloride, 7) + .inputItems(plate, Lead, 3) + .outputItems(HAZMAT_CHESTPLATE) + .save(provider); ASSEMBLER_RECIPES.recipeBuilder("hazmat_leggings").duration(200).EUt(VA[LV]) - .inputItems(plate, Rubber,2) - .inputItems(plate, PolyvinylChloride, 5) - .inputItems(rod, Iron, 2) - .inputItems(ring, Steel, 4) - .outputItems(HAZMAT_LEGGINGS) - .save(provider); + .inputItems(plate, Rubber, 2) + .inputItems(plate, PolyvinylChloride, 5) + .inputItems(rod, Iron, 2) + .inputItems(ring, Steel, 4) + .outputItems(HAZMAT_LEGGINGS) + .save(provider); ASSEMBLER_RECIPES.recipeBuilder("hazmat_headpiece").duration(200).EUt(VA[LV]) - .inputItems(MASK_FILTER) - .inputItems(plate, PolyvinylChloride, 4) - .inputItems(plate, Glass, 2) - .inputItems(ring, PolyvinylChloride, 1) - .outputItems(HAZMAT_HELMET) - .save(provider); + .inputItems(MASK_FILTER) + .inputItems(plate, PolyvinylChloride, 4) + .inputItems(plate, Glass, 2) + .inputItems(ring, PolyvinylChloride, 1) + .outputItems(HAZMAT_HELMET) + .save(provider); } } diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/AssemblyLineLoader.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/AssemblyLineLoader.java index 6ffc4dfb4b..78cc6ef001 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/AssemblyLineLoader.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/AssemblyLineLoader.java @@ -2,6 +2,7 @@ import com.gregtechceu.gtceu.api.data.chemical.ChemicalHelper; import com.gregtechceu.gtceu.data.recipe.CustomTags; + import net.minecraft.data.recipes.FinishedRecipe; import java.util.function.Consumer; @@ -17,7 +18,6 @@ public class AssemblyLineLoader { public static void init(Consumer provider) { - ASSEMBLY_LINE_RECIPES.recipeBuilder("fusion_reactor_mk1") .inputItems(SUPERCONDUCTING_COIL.asStack()) .inputItems(CustomTags.ZPM_CIRCUITS, 4) @@ -70,6 +70,5 @@ public static void init(Consumer provider) { .CWUt(96) .EUt(VA[UV])) .duration(1000).EUt(VA[ZPM]).save(provider); - } } diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/BatteryRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/BatteryRecipes.java index 4f6fea8dae..ae2b330624 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/BatteryRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/BatteryRecipes.java @@ -6,6 +6,7 @@ import com.gregtechceu.gtceu.common.data.GTBlocks; import com.gregtechceu.gtceu.data.recipe.CustomTags; import com.gregtechceu.gtceu.data.recipe.VanillaRecipeHelper; + import net.minecraft.data.recipes.FinishedRecipe; import java.util.function.Consumer; @@ -25,7 +26,6 @@ public static void init(Consumer provider) { } private static void standardBatteries(Consumer provider) { - // Tantalum Battery (since it doesn't fit elsewhere) ASSEMBLER_RECIPES.recipeBuilder("tantalum_capacitor") .inputItems(dust, Tantalum) @@ -218,29 +218,41 @@ private static void standardBatteries(Consumer provider) { .outputItems(BATTERY_UV_NAQUADRIA) .duration(300).EUt(VA[IV]).save(provider); - - EXTRACTOR_RECIPES.recipeBuilder("unpackage_lv_cadmium_battery").inputItems(BATTERY_LV_CADMIUM).outputItems(BATTERY_HULL_LV).save(provider); - EXTRACTOR_RECIPES.recipeBuilder("unpackage_lv_lithium_battery").inputItems(BATTERY_LV_LITHIUM).outputItems(BATTERY_HULL_LV).save(provider); - EXTRACTOR_RECIPES.recipeBuilder("unpackage_lv_sodium_battery").inputItems(BATTERY_LV_SODIUM).outputItems(BATTERY_HULL_LV).save(provider); - - EXTRACTOR_RECIPES.recipeBuilder("unpackage_mv_cadmium_battery").inputItems(BATTERY_MV_CADMIUM).outputItems(BATTERY_HULL_MV).save(provider); - EXTRACTOR_RECIPES.recipeBuilder("unpackage_mv_lithium_battery").inputItems(BATTERY_MV_LITHIUM).outputItems(BATTERY_HULL_MV).save(provider); - EXTRACTOR_RECIPES.recipeBuilder("unpackage_mv_sodium_battery").inputItems(BATTERY_MV_SODIUM).outputItems(BATTERY_HULL_MV).save(provider); - - EXTRACTOR_RECIPES.recipeBuilder("unpackage_hv_cadmium_battery").inputItems(BATTERY_HV_CADMIUM).outputItems(BATTERY_HULL_HV).save(provider); - EXTRACTOR_RECIPES.recipeBuilder("unpackage_hv_lithium_battery").inputItems(BATTERY_HV_LITHIUM).outputItems(BATTERY_HULL_HV).save(provider); - EXTRACTOR_RECIPES.recipeBuilder("unpackage_hv_sodium_battery").inputItems(BATTERY_HV_SODIUM).outputItems(BATTERY_HULL_HV).save(provider); - - EXTRACTOR_RECIPES.recipeBuilder("unpackage_ev_vanadium_battery").inputItems(BATTERY_EV_VANADIUM).outputItems(BATTERY_HULL_SMALL_VANADIUM).save(provider); - EXTRACTOR_RECIPES.recipeBuilder("unpackage_iv_vanadium_battery").inputItems(BATTERY_IV_VANADIUM).outputItems(BATTERY_HULL_MEDIUM_VANADIUM).save(provider); - EXTRACTOR_RECIPES.recipeBuilder("unpackage_luv_vanadium_battery").inputItems(BATTERY_LUV_VANADIUM).outputItems(BATTERY_HULL_LARGE_VANADIUM).save(provider); - - EXTRACTOR_RECIPES.recipeBuilder("unpackage_zpm_naquadria_battery").inputItems(BATTERY_ZPM_NAQUADRIA).outputItems(BATTERY_HULL_MEDIUM_NAQUADRIA).save(provider); - EXTRACTOR_RECIPES.recipeBuilder("unpackage_uv_naquadria_battery").inputItems(BATTERY_UV_NAQUADRIA).outputItems(BATTERY_HULL_LARGE_NAQUADRIA).save(provider); + EXTRACTOR_RECIPES.recipeBuilder("unpackage_lv_cadmium_battery").inputItems(BATTERY_LV_CADMIUM) + .outputItems(BATTERY_HULL_LV).save(provider); + EXTRACTOR_RECIPES.recipeBuilder("unpackage_lv_lithium_battery").inputItems(BATTERY_LV_LITHIUM) + .outputItems(BATTERY_HULL_LV).save(provider); + EXTRACTOR_RECIPES.recipeBuilder("unpackage_lv_sodium_battery").inputItems(BATTERY_LV_SODIUM) + .outputItems(BATTERY_HULL_LV).save(provider); + + EXTRACTOR_RECIPES.recipeBuilder("unpackage_mv_cadmium_battery").inputItems(BATTERY_MV_CADMIUM) + .outputItems(BATTERY_HULL_MV).save(provider); + EXTRACTOR_RECIPES.recipeBuilder("unpackage_mv_lithium_battery").inputItems(BATTERY_MV_LITHIUM) + .outputItems(BATTERY_HULL_MV).save(provider); + EXTRACTOR_RECIPES.recipeBuilder("unpackage_mv_sodium_battery").inputItems(BATTERY_MV_SODIUM) + .outputItems(BATTERY_HULL_MV).save(provider); + + EXTRACTOR_RECIPES.recipeBuilder("unpackage_hv_cadmium_battery").inputItems(BATTERY_HV_CADMIUM) + .outputItems(BATTERY_HULL_HV).save(provider); + EXTRACTOR_RECIPES.recipeBuilder("unpackage_hv_lithium_battery").inputItems(BATTERY_HV_LITHIUM) + .outputItems(BATTERY_HULL_HV).save(provider); + EXTRACTOR_RECIPES.recipeBuilder("unpackage_hv_sodium_battery").inputItems(BATTERY_HV_SODIUM) + .outputItems(BATTERY_HULL_HV).save(provider); + + EXTRACTOR_RECIPES.recipeBuilder("unpackage_ev_vanadium_battery").inputItems(BATTERY_EV_VANADIUM) + .outputItems(BATTERY_HULL_SMALL_VANADIUM).save(provider); + EXTRACTOR_RECIPES.recipeBuilder("unpackage_iv_vanadium_battery").inputItems(BATTERY_IV_VANADIUM) + .outputItems(BATTERY_HULL_MEDIUM_VANADIUM).save(provider); + EXTRACTOR_RECIPES.recipeBuilder("unpackage_luv_vanadium_battery").inputItems(BATTERY_LUV_VANADIUM) + .outputItems(BATTERY_HULL_LARGE_VANADIUM).save(provider); + + EXTRACTOR_RECIPES.recipeBuilder("unpackage_zpm_naquadria_battery").inputItems(BATTERY_ZPM_NAQUADRIA) + .outputItems(BATTERY_HULL_MEDIUM_NAQUADRIA).save(provider); + EXTRACTOR_RECIPES.recipeBuilder("unpackage_uv_naquadria_battery").inputItems(BATTERY_UV_NAQUADRIA) + .outputItems(BATTERY_HULL_LARGE_NAQUADRIA).save(provider); } private static void gemBatteries(Consumer provider) { - // Energy Crystal MIXER_RECIPES.recipeBuilder("energium_dust") .inputItems(dust, Redstone, 5) @@ -424,7 +436,6 @@ private static void gemBatteries(Consumer provider) { } private static void batteryBlocks(Consumer provider) { - // Empty Tier I ASSEMBLER_RECIPES.recipeBuilder("empty_tier_1_battery") .inputItems(frameGt, Ultimet) diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/CircuitRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/CircuitRecipes.java index 97bf7cf82b..836041f762 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/CircuitRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/CircuitRecipes.java @@ -6,6 +6,7 @@ import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.data.recipe.CustomTags; import com.gregtechceu.gtceu.data.recipe.VanillaRecipeHelper; + import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; @@ -28,7 +29,6 @@ public static void init(Consumer provider) { } private static void waferRecipes(Consumer provider) { - // Boules BLAST_RECIPES.recipeBuilder("silicon_boule") .inputItems(dust, Silicon, 32) @@ -71,7 +71,6 @@ private static void waferRecipes(Consumer provider) { .outputItems(SILICON_WAFER, 16) .duration(400).EUt(64).save(provider); - CUTTER_RECIPES.recipeBuilder("cut_phosphorus_boule") .inputItems(PHOSPHORUS_BOULE) .outputItems(PHOSPHORUS_WAFER, 32) @@ -92,57 +91,133 @@ private static void waferRecipes(Consumer provider) { .duration(2400).EUt(VA[IV]).save(provider); // Wafer engraving - LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_ilc_silicon").duration(900).EUt(VA[MV]).inputItems(SILICON_WAFER).notConsumable(lens, Color.Red).outputItems(INTEGRATED_LOGIC_CIRCUIT_WAFER).save(provider); - LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_ilc_phosphorus").duration(500).EUt(VA[HV]).inputItems(PHOSPHORUS_WAFER).notConsumable(lens, Color.Red).outputItems(INTEGRATED_LOGIC_CIRCUIT_WAFER, 4).cleanroom(CleanroomType.CLEANROOM).save(provider); - LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_ilc_naquadah").duration(200).EUt(VA[EV]).inputItems(NAQUADAH_WAFER).notConsumable(lens, Color.Red).outputItems(INTEGRATED_LOGIC_CIRCUIT_WAFER, 8).cleanroom(CleanroomType.CLEANROOM).save(provider); - LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_ilc_neutronium").duration(50).EUt(VA[IV]).inputItems(NEUTRONIUM_WAFER).notConsumable(lens, Color.Red).outputItems(INTEGRATED_LOGIC_CIRCUIT_WAFER, 16).cleanroom(CleanroomType.CLEANROOM).save(provider); - - LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_ram_silicon").duration(900).EUt(VA[MV]).inputItems(SILICON_WAFER).notConsumable(lens, Color.Green).outputItems(RANDOM_ACCESS_MEMORY_WAFER).save(provider); - LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_ram_phosphorus").duration(500).EUt(VA[HV]).inputItems(PHOSPHORUS_WAFER).notConsumable(lens, Color.Green).outputItems(RANDOM_ACCESS_MEMORY_WAFER, 4).cleanroom(CleanroomType.CLEANROOM).save(provider); - LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_ram_naquadah").duration(200).EUt(VA[EV]).inputItems(NAQUADAH_WAFER).notConsumable(lens, Color.Green).outputItems(RANDOM_ACCESS_MEMORY_WAFER, 8).cleanroom(CleanroomType.CLEANROOM).save(provider); - LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_ram_neutronium").duration(50).EUt(VA[IV]).inputItems(NEUTRONIUM_WAFER).notConsumable(lens, Color.Green).outputItems(RANDOM_ACCESS_MEMORY_WAFER, 16).cleanroom(CleanroomType.CLEANROOM).save(provider); - - LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_cpu_silicon").duration(900).EUt(VA[MV]).inputItems(SILICON_WAFER).notConsumable(lens, Color.LightBlue).outputItems(CENTRAL_PROCESSING_UNIT_WAFER).save(provider); - LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_cpu_phosphorus").duration(500).EUt(VA[HV]).inputItems(PHOSPHORUS_WAFER).notConsumable(lens, Color.LightBlue).outputItems(CENTRAL_PROCESSING_UNIT_WAFER, 4).cleanroom(CleanroomType.CLEANROOM).save(provider); - LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_cpu_naquadah").duration(200).EUt(VA[EV]).inputItems(NAQUADAH_WAFER).notConsumable(lens, Color.LightBlue).outputItems(CENTRAL_PROCESSING_UNIT_WAFER, 8).cleanroom(CleanroomType.CLEANROOM).save(provider); - LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_cpu_neutronium").duration(50).EUt(VA[IV]).inputItems(NEUTRONIUM_WAFER).notConsumable(lens, Color.LightBlue).outputItems(CENTRAL_PROCESSING_UNIT_WAFER, 16).cleanroom(CleanroomType.CLEANROOM).save(provider); - - LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_ulpic_silicon").duration(900).EUt(VA[MV]).inputItems(SILICON_WAFER).notConsumable(lens, Color.Blue).outputItems(ULTRA_LOW_POWER_INTEGRATED_CIRCUIT_WAFER).save(provider); - LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_ulpic_phosphorus").duration(500).EUt(VA[HV]).inputItems(PHOSPHORUS_WAFER).notConsumable(lens, Color.Blue).outputItems(ULTRA_LOW_POWER_INTEGRATED_CIRCUIT_WAFER, 4).cleanroom(CleanroomType.CLEANROOM).save(provider); - LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_ulpic_naquadah").duration(200).EUt(VA[EV]).inputItems(NAQUADAH_WAFER).notConsumable(lens, Color.Blue).outputItems(ULTRA_LOW_POWER_INTEGRATED_CIRCUIT_WAFER, 8).cleanroom(CleanroomType.CLEANROOM).save(provider); - LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_ulpic_neutronium").duration(50).EUt(VA[IV]).inputItems(NEUTRONIUM_WAFER).notConsumable(lens, Color.Blue).outputItems(ULTRA_LOW_POWER_INTEGRATED_CIRCUIT_WAFER, 16).cleanroom(CleanroomType.CLEANROOM).save(provider); - - LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_lpic_silicon").duration(900).EUt(VA[MV]).inputItems(SILICON_WAFER).notConsumable(lens, Color.Orange).outputItems(LOW_POWER_INTEGRATED_CIRCUIT_WAFER).save(provider); - LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_lpic_phosphorus").duration(500).EUt(VA[HV]).inputItems(PHOSPHORUS_WAFER).notConsumable(lens, Color.Orange).outputItems(LOW_POWER_INTEGRATED_CIRCUIT_WAFER, 4).cleanroom(CleanroomType.CLEANROOM).save(provider); - LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_lpic_naquadah").duration(200).EUt(VA[EV]).inputItems(NAQUADAH_WAFER).notConsumable(lens, Color.Orange).outputItems(LOW_POWER_INTEGRATED_CIRCUIT_WAFER, 8).cleanroom(CleanroomType.CLEANROOM).save(provider); - LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_lpic_neutronium").duration(50).EUt(VA[IV]).inputItems(NEUTRONIUM_WAFER).notConsumable(lens, Color.Orange).outputItems(LOW_POWER_INTEGRATED_CIRCUIT_WAFER, 16).cleanroom(CleanroomType.CLEANROOM).save(provider); - - LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_ssoc_silicon").duration(900).EUt(VA[MV]).inputItems(SILICON_WAFER).notConsumable(lens, Color.Cyan).outputItems(SIMPLE_SYSTEM_ON_CHIP_WAFER).save(provider); - LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_ssoc_phosphorus").duration(500).EUt(VA[HV]).inputItems(PHOSPHORUS_WAFER).notConsumable(lens, Color.Cyan).outputItems(SIMPLE_SYSTEM_ON_CHIP_WAFER, 4).cleanroom(CleanroomType.CLEANROOM).save(provider); - LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_ssoc_naquadah").duration(200).EUt(VA[EV]).inputItems(NAQUADAH_WAFER).notConsumable(lens, Color.Cyan).outputItems(SIMPLE_SYSTEM_ON_CHIP_WAFER, 8).cleanroom(CleanroomType.CLEANROOM).save(provider); - LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_ssoc_neutronium").duration(50).EUt(VA[IV]).inputItems(NEUTRONIUM_WAFER).notConsumable(lens, Color.Cyan).outputItems(SIMPLE_SYSTEM_ON_CHIP_WAFER, 16).cleanroom(CleanroomType.CLEANROOM).save(provider); - - LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_nand_phosphorus").duration(900).EUt(VA[HV]).inputItems(PHOSPHORUS_WAFER).notConsumable(lens, Color.Gray).outputItems(NAND_MEMORY_CHIP_WAFER).cleanroom(CleanroomType.CLEANROOM).save(provider); - LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_nand_naquadah").duration(500).EUt(VA[EV]).inputItems(NAQUADAH_WAFER).notConsumable(lens, Color.Gray).outputItems(NAND_MEMORY_CHIP_WAFER, 4).cleanroom(CleanroomType.CLEANROOM).save(provider); - LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_nand_neutronium").duration(200).EUt(VA[IV]).inputItems(NEUTRONIUM_WAFER).notConsumable(lens, Color.Gray).outputItems(NAND_MEMORY_CHIP_WAFER, 8).cleanroom(CleanroomType.CLEANROOM).save(provider); - - LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_nor_phosphorus").duration(900).EUt(VA[HV]).inputItems(PHOSPHORUS_WAFER).notConsumable(lens, Color.Pink).outputItems(NOR_MEMORY_CHIP_WAFER).cleanroom(CleanroomType.CLEANROOM).save(provider); - LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_nor_naquadah").duration(500).EUt(VA[EV]).inputItems(NAQUADAH_WAFER).notConsumable(lens, Color.Pink).outputItems(NOR_MEMORY_CHIP_WAFER, 4).cleanroom(CleanroomType.CLEANROOM).save(provider); - LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_nor_neutronium").duration(200).EUt(VA[IV]).inputItems(NEUTRONIUM_WAFER).notConsumable(lens, Color.Pink).outputItems(NOR_MEMORY_CHIP_WAFER, 8).cleanroom(CleanroomType.CLEANROOM).save(provider); - - LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_pic_phosphorus").duration(900).EUt(VA[HV]).inputItems(PHOSPHORUS_WAFER).notConsumable(lens, Color.Brown).outputItems(POWER_INTEGRATED_CIRCUIT_WAFER).cleanroom(CleanroomType.CLEANROOM).save(provider); - LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_pic_naquadah").duration(500).EUt(VA[EV]).inputItems(NAQUADAH_WAFER).notConsumable(lens, Color.Brown).outputItems(POWER_INTEGRATED_CIRCUIT_WAFER, 4).cleanroom(CleanroomType.CLEANROOM).save(provider); - LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_pic_neutronium").duration(200).EUt(VA[IV]).inputItems(NEUTRONIUM_WAFER).notConsumable(lens, Color.Brown).outputItems(POWER_INTEGRATED_CIRCUIT_WAFER, 8).cleanroom(CleanroomType.CLEANROOM).save(provider); - - LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_soc_phosphorus").duration(900).EUt(VA[HV]).inputItems(PHOSPHORUS_WAFER).notConsumable(lens, Color.Yellow).outputItems(SYSTEM_ON_CHIP_WAFER).cleanroom(CleanroomType.CLEANROOM).save(provider); - LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_soc_naquadah").duration(500).EUt(VA[EV]).inputItems(NAQUADAH_WAFER).notConsumable(lens, Color.Yellow).outputItems(SYSTEM_ON_CHIP_WAFER, 4).cleanroom(CleanroomType.CLEANROOM).save(provider); - LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_soc_neutronium").duration(200).EUt(VA[IV]).inputItems(NEUTRONIUM_WAFER).notConsumable(lens, Color.Yellow).outputItems(SYSTEM_ON_CHIP_WAFER, 8).cleanroom(CleanroomType.CLEANROOM).save(provider); - - LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_asoc_naquadah").duration(900).EUt(VA[EV]).inputItems(NAQUADAH_WAFER).notConsumable(lens, Color.Purple).outputItems(ADVANCED_SYSTEM_ON_CHIP_WAFER).cleanroom(CleanroomType.CLEANROOM).save(provider); - LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_asoc_neutronium").duration(500).EUt(VA[IV]).inputItems(NEUTRONIUM_WAFER).notConsumable(lens, Color.Purple).outputItems(ADVANCED_SYSTEM_ON_CHIP_WAFER, 2).cleanroom(CleanroomType.CLEANROOM).save(provider); + LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_ilc_silicon").duration(900).EUt(VA[MV]).inputItems(SILICON_WAFER) + .notConsumable(lens, Color.Red).outputItems(INTEGRATED_LOGIC_CIRCUIT_WAFER).save(provider); + LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_ilc_phosphorus").duration(500).EUt(VA[HV]) + .inputItems(PHOSPHORUS_WAFER).notConsumable(lens, Color.Red) + .outputItems(INTEGRATED_LOGIC_CIRCUIT_WAFER, 4).cleanroom(CleanroomType.CLEANROOM).save(provider); + LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_ilc_naquadah").duration(200).EUt(VA[EV]) + .inputItems(NAQUADAH_WAFER).notConsumable(lens, Color.Red) + .outputItems(INTEGRATED_LOGIC_CIRCUIT_WAFER, 8).cleanroom(CleanroomType.CLEANROOM).save(provider); + LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_ilc_neutronium").duration(50).EUt(VA[IV]) + .inputItems(NEUTRONIUM_WAFER).notConsumable(lens, Color.Red) + .outputItems(INTEGRATED_LOGIC_CIRCUIT_WAFER, 16).cleanroom(CleanroomType.CLEANROOM).save(provider); + + LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_ram_silicon").duration(900).EUt(VA[MV]).inputItems(SILICON_WAFER) + .notConsumable(lens, Color.Green).outputItems(RANDOM_ACCESS_MEMORY_WAFER).save(provider); + LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_ram_phosphorus").duration(500).EUt(VA[HV]) + .inputItems(PHOSPHORUS_WAFER).notConsumable(lens, Color.Green) + .outputItems(RANDOM_ACCESS_MEMORY_WAFER, 4).cleanroom(CleanroomType.CLEANROOM).save(provider); + LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_ram_naquadah").duration(200).EUt(VA[EV]) + .inputItems(NAQUADAH_WAFER).notConsumable(lens, Color.Green).outputItems(RANDOM_ACCESS_MEMORY_WAFER, 8) + .cleanroom(CleanroomType.CLEANROOM).save(provider); + LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_ram_neutronium").duration(50).EUt(VA[IV]) + .inputItems(NEUTRONIUM_WAFER).notConsumable(lens, Color.Green) + .outputItems(RANDOM_ACCESS_MEMORY_WAFER, 16).cleanroom(CleanroomType.CLEANROOM).save(provider); + + LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_cpu_silicon").duration(900).EUt(VA[MV]).inputItems(SILICON_WAFER) + .notConsumable(lens, Color.LightBlue).outputItems(CENTRAL_PROCESSING_UNIT_WAFER).save(provider); + LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_cpu_phosphorus").duration(500).EUt(VA[HV]) + .inputItems(PHOSPHORUS_WAFER).notConsumable(lens, Color.LightBlue) + .outputItems(CENTRAL_PROCESSING_UNIT_WAFER, 4).cleanroom(CleanroomType.CLEANROOM).save(provider); + LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_cpu_naquadah").duration(200).EUt(VA[EV]) + .inputItems(NAQUADAH_WAFER).notConsumable(lens, Color.LightBlue) + .outputItems(CENTRAL_PROCESSING_UNIT_WAFER, 8).cleanroom(CleanroomType.CLEANROOM).save(provider); + LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_cpu_neutronium").duration(50).EUt(VA[IV]) + .inputItems(NEUTRONIUM_WAFER).notConsumable(lens, Color.LightBlue) + .outputItems(CENTRAL_PROCESSING_UNIT_WAFER, 16).cleanroom(CleanroomType.CLEANROOM).save(provider); + + LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_ulpic_silicon").duration(900).EUt(VA[MV]) + .inputItems(SILICON_WAFER).notConsumable(lens, Color.Blue) + .outputItems(ULTRA_LOW_POWER_INTEGRATED_CIRCUIT_WAFER).save(provider); + LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_ulpic_phosphorus").duration(500).EUt(VA[HV]) + .inputItems(PHOSPHORUS_WAFER).notConsumable(lens, Color.Blue) + .outputItems(ULTRA_LOW_POWER_INTEGRATED_CIRCUIT_WAFER, 4).cleanroom(CleanroomType.CLEANROOM) + .save(provider); + LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_ulpic_naquadah").duration(200).EUt(VA[EV]) + .inputItems(NAQUADAH_WAFER).notConsumable(lens, Color.Blue) + .outputItems(ULTRA_LOW_POWER_INTEGRATED_CIRCUIT_WAFER, 8).cleanroom(CleanroomType.CLEANROOM) + .save(provider); + LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_ulpic_neutronium").duration(50).EUt(VA[IV]) + .inputItems(NEUTRONIUM_WAFER).notConsumable(lens, Color.Blue) + .outputItems(ULTRA_LOW_POWER_INTEGRATED_CIRCUIT_WAFER, 16).cleanroom(CleanroomType.CLEANROOM) + .save(provider); + + LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_lpic_silicon").duration(900).EUt(VA[MV]).inputItems(SILICON_WAFER) + .notConsumable(lens, Color.Orange).outputItems(LOW_POWER_INTEGRATED_CIRCUIT_WAFER).save(provider); + LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_lpic_phosphorus").duration(500).EUt(VA[HV]) + .inputItems(PHOSPHORUS_WAFER).notConsumable(lens, Color.Orange) + .outputItems(LOW_POWER_INTEGRATED_CIRCUIT_WAFER, 4).cleanroom(CleanroomType.CLEANROOM).save(provider); + LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_lpic_naquadah").duration(200).EUt(VA[EV]) + .inputItems(NAQUADAH_WAFER).notConsumable(lens, Color.Orange) + .outputItems(LOW_POWER_INTEGRATED_CIRCUIT_WAFER, 8).cleanroom(CleanroomType.CLEANROOM).save(provider); + LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_lpic_neutronium").duration(50).EUt(VA[IV]) + .inputItems(NEUTRONIUM_WAFER).notConsumable(lens, Color.Orange) + .outputItems(LOW_POWER_INTEGRATED_CIRCUIT_WAFER, 16).cleanroom(CleanroomType.CLEANROOM).save(provider); + + LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_ssoc_silicon").duration(900).EUt(VA[MV]).inputItems(SILICON_WAFER) + .notConsumable(lens, Color.Cyan).outputItems(SIMPLE_SYSTEM_ON_CHIP_WAFER).save(provider); + LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_ssoc_phosphorus").duration(500).EUt(VA[HV]) + .inputItems(PHOSPHORUS_WAFER).notConsumable(lens, Color.Cyan) + .outputItems(SIMPLE_SYSTEM_ON_CHIP_WAFER, 4).cleanroom(CleanroomType.CLEANROOM).save(provider); + LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_ssoc_naquadah").duration(200).EUt(VA[EV]) + .inputItems(NAQUADAH_WAFER).notConsumable(lens, Color.Cyan).outputItems(SIMPLE_SYSTEM_ON_CHIP_WAFER, 8) + .cleanroom(CleanroomType.CLEANROOM).save(provider); + LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_ssoc_neutronium").duration(50).EUt(VA[IV]) + .inputItems(NEUTRONIUM_WAFER).notConsumable(lens, Color.Cyan) + .outputItems(SIMPLE_SYSTEM_ON_CHIP_WAFER, 16).cleanroom(CleanroomType.CLEANROOM).save(provider); + + LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_nand_phosphorus").duration(900).EUt(VA[HV]) + .inputItems(PHOSPHORUS_WAFER).notConsumable(lens, Color.Gray).outputItems(NAND_MEMORY_CHIP_WAFER) + .cleanroom(CleanroomType.CLEANROOM).save(provider); + LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_nand_naquadah").duration(500).EUt(VA[EV]) + .inputItems(NAQUADAH_WAFER).notConsumable(lens, Color.Gray).outputItems(NAND_MEMORY_CHIP_WAFER, 4) + .cleanroom(CleanroomType.CLEANROOM).save(provider); + LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_nand_neutronium").duration(200).EUt(VA[IV]) + .inputItems(NEUTRONIUM_WAFER).notConsumable(lens, Color.Gray).outputItems(NAND_MEMORY_CHIP_WAFER, 8) + .cleanroom(CleanroomType.CLEANROOM).save(provider); + + LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_nor_phosphorus").duration(900).EUt(VA[HV]) + .inputItems(PHOSPHORUS_WAFER).notConsumable(lens, Color.Pink).outputItems(NOR_MEMORY_CHIP_WAFER) + .cleanroom(CleanroomType.CLEANROOM).save(provider); + LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_nor_naquadah").duration(500).EUt(VA[EV]) + .inputItems(NAQUADAH_WAFER).notConsumable(lens, Color.Pink).outputItems(NOR_MEMORY_CHIP_WAFER, 4) + .cleanroom(CleanroomType.CLEANROOM).save(provider); + LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_nor_neutronium").duration(200).EUt(VA[IV]) + .inputItems(NEUTRONIUM_WAFER).notConsumable(lens, Color.Pink).outputItems(NOR_MEMORY_CHIP_WAFER, 8) + .cleanroom(CleanroomType.CLEANROOM).save(provider); + + LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_pic_phosphorus").duration(900).EUt(VA[HV]) + .inputItems(PHOSPHORUS_WAFER).notConsumable(lens, Color.Brown) + .outputItems(POWER_INTEGRATED_CIRCUIT_WAFER).cleanroom(CleanroomType.CLEANROOM).save(provider); + LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_pic_naquadah").duration(500).EUt(VA[EV]) + .inputItems(NAQUADAH_WAFER).notConsumable(lens, Color.Brown) + .outputItems(POWER_INTEGRATED_CIRCUIT_WAFER, 4).cleanroom(CleanroomType.CLEANROOM).save(provider); + LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_pic_neutronium").duration(200).EUt(VA[IV]) + .inputItems(NEUTRONIUM_WAFER).notConsumable(lens, Color.Brown) + .outputItems(POWER_INTEGRATED_CIRCUIT_WAFER, 8).cleanroom(CleanroomType.CLEANROOM).save(provider); + + LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_soc_phosphorus").duration(900).EUt(VA[HV]) + .inputItems(PHOSPHORUS_WAFER).notConsumable(lens, Color.Yellow).outputItems(SYSTEM_ON_CHIP_WAFER) + .cleanroom(CleanroomType.CLEANROOM).save(provider); + LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_soc_naquadah").duration(500).EUt(VA[EV]) + .inputItems(NAQUADAH_WAFER).notConsumable(lens, Color.Yellow).outputItems(SYSTEM_ON_CHIP_WAFER, 4) + .cleanroom(CleanroomType.CLEANROOM).save(provider); + LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_soc_neutronium").duration(200).EUt(VA[IV]) + .inputItems(NEUTRONIUM_WAFER).notConsumable(lens, Color.Yellow).outputItems(SYSTEM_ON_CHIP_WAFER, 8) + .cleanroom(CleanroomType.CLEANROOM).save(provider); + + LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_asoc_naquadah").duration(900).EUt(VA[EV]) + .inputItems(NAQUADAH_WAFER).notConsumable(lens, Color.Purple).outputItems(ADVANCED_SYSTEM_ON_CHIP_WAFER) + .cleanroom(CleanroomType.CLEANROOM).save(provider); + LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_asoc_neutronium").duration(500).EUt(VA[IV]) + .inputItems(NEUTRONIUM_WAFER).notConsumable(lens, Color.Purple) + .outputItems(ADVANCED_SYSTEM_ON_CHIP_WAFER, 2).cleanroom(CleanroomType.CLEANROOM).save(provider); // Can replace this with a Quantum Star/Eye Lens if desired - LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_hasoc_neutronium").duration(900).EUt(VA[IV]).inputItems(NEUTRONIUM_WAFER).notConsumable(lens, Color.Black).outputItems(HIGHLY_ADVANCED_SOC_WAFER).cleanroom(CleanroomType.CLEANROOM).save(provider); + LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_hasoc_neutronium").duration(900).EUt(VA[IV]) + .inputItems(NEUTRONIUM_WAFER).notConsumable(lens, Color.Black).outputItems(HIGHLY_ADVANCED_SOC_WAFER) + .cleanroom(CleanroomType.CLEANROOM).save(provider); // Wafer chemical refining recipes CHEMICAL_RECIPES.recipeBuilder("hpic_wafer") @@ -186,26 +261,48 @@ private static void waferRecipes(Consumer provider) { .duration(1200).EUt(VA[EV]).save(provider); // Wafer cutting - CUTTER_RECIPES.recipeBuilder("cut_hasoc").duration(900).EUt(VA[IV]).inputItems(HIGHLY_ADVANCED_SOC_WAFER).outputItems(HIGHLY_ADVANCED_SOC, 6)/*.cleanroom(CleanroomType.CLEANROOM)*/.save(provider); - CUTTER_RECIPES.recipeBuilder("cut_asoc").duration(900).EUt(VA[EV]).inputItems(ADVANCED_SYSTEM_ON_CHIP_WAFER).outputItems(ADVANCED_SYSTEM_ON_CHIP, 6)/*.cleanroom(CleanroomType.CLEANROOM)*/.save(provider); - CUTTER_RECIPES.recipeBuilder("cut_soc").duration(900).EUt(VA[HV]).inputItems(SYSTEM_ON_CHIP_WAFER).outputItems(SYSTEM_ON_CHIP, 6)/*.cleanroom(CleanroomType.CLEANROOM)*/.save(provider); - CUTTER_RECIPES.recipeBuilder("cut_ssoc").duration(900).EUt(64).inputItems(SIMPLE_SYSTEM_ON_CHIP_WAFER).outputItems(SIMPLE_SYSTEM_ON_CHIP, 6).save(provider); - CUTTER_RECIPES.recipeBuilder("cut_ram").duration(900).EUt(96).inputItems(RANDOM_ACCESS_MEMORY_WAFER).outputItems(RANDOM_ACCESS_MEMORY, 32).save(provider); - CUTTER_RECIPES.recipeBuilder("cut_qbit_cpu").duration(900).EUt(VA[EV]).inputItems(QUBIT_CENTRAL_PROCESSING_UNIT_WAFER).outputItems(QUBIT_CENTRAL_PROCESSING_UNIT, 4)/*.cleanroom(CleanroomType.CLEANROOM)*/.save(provider); - CUTTER_RECIPES.recipeBuilder("cut_ulpic").duration(900).EUt(VA[MV]).inputItems(ULTRA_LOW_POWER_INTEGRATED_CIRCUIT_WAFER).outputItems(ULTRA_LOW_POWER_INTEGRATED_CIRCUIT, 6).save(provider); - CUTTER_RECIPES.recipeBuilder("cut_lpic").duration(900).EUt(VA[HV]).inputItems(LOW_POWER_INTEGRATED_CIRCUIT_WAFER).outputItems(LOW_POWER_INTEGRATED_CIRCUIT, 4)/*.cleanroom(CleanroomType.CLEANROOM)*/.save(provider); - CUTTER_RECIPES.recipeBuilder("cut_pic").duration(900).EUt(VA[EV]).inputItems(POWER_INTEGRATED_CIRCUIT_WAFER).outputItems(POWER_INTEGRATED_CIRCUIT, 4)/*.cleanroom(CleanroomType.CLEANROOM)*/.save(provider); - CUTTER_RECIPES.recipeBuilder("cut_hpic").duration(900).EUt(VA[IV]).inputItems(HIGH_POWER_INTEGRATED_CIRCUIT_WAFER).outputItems(HIGH_POWER_INTEGRATED_CIRCUIT, 2)/*.cleanroom(CleanroomType.CLEANROOM)*/.save(provider); - CUTTER_RECIPES.recipeBuilder("cut_uhpic").duration(900).EUt(VA[LuV]).inputItems(ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT_WAFER).outputItems(ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT, 2)/*.cleanroom(CleanroomType.CLEANROOM)*/.save(provider); - CUTTER_RECIPES.recipeBuilder("cut_nor").duration(900).EUt(192).inputItems(NOR_MEMORY_CHIP_WAFER).outputItems(NOR_MEMORY_CHIP, 16)/*.cleanroom(CleanroomType.CLEANROOM)*/.save(provider); - CUTTER_RECIPES.recipeBuilder("cut_nand").duration(900).EUt(192).inputItems(NAND_MEMORY_CHIP_WAFER).outputItems(NAND_MEMORY_CHIP, 32)/*.cleanroom(CleanroomType.CLEANROOM)*/.save(provider); - CUTTER_RECIPES.recipeBuilder("cut_cpu").duration(900).EUt(VA[MV]).inputItems(CENTRAL_PROCESSING_UNIT_WAFER).outputItems(CENTRAL_PROCESSING_UNIT, 8).save(provider); - CUTTER_RECIPES.recipeBuilder("cut_ilc").duration(900).EUt(64).inputItems(INTEGRATED_LOGIC_CIRCUIT_WAFER).outputItems(INTEGRATED_LOGIC_CIRCUIT, 8).save(provider); - CUTTER_RECIPES.recipeBuilder("cut_nano_cpu").duration(900).EUt(VA[HV]).inputItems(NANO_CENTRAL_PROCESSING_UNIT_WAFER).outputItems(NANO_CENTRAL_PROCESSING_UNIT, 8)/*.cleanroom(CleanroomType.CLEANROOM)*/.save(provider); + CUTTER_RECIPES.recipeBuilder("cut_hasoc").duration(900).EUt(VA[IV]).inputItems(HIGHLY_ADVANCED_SOC_WAFER) + .outputItems(HIGHLY_ADVANCED_SOC, 6)/* .cleanroom(CleanroomType.CLEANROOM) */.save(provider); + CUTTER_RECIPES.recipeBuilder("cut_asoc").duration(900).EUt(VA[EV]).inputItems(ADVANCED_SYSTEM_ON_CHIP_WAFER) + .outputItems(ADVANCED_SYSTEM_ON_CHIP, 6)/* .cleanroom(CleanroomType.CLEANROOM) */.save(provider); + CUTTER_RECIPES.recipeBuilder("cut_soc").duration(900).EUt(VA[HV]).inputItems(SYSTEM_ON_CHIP_WAFER) + .outputItems(SYSTEM_ON_CHIP, 6)/* .cleanroom(CleanroomType.CLEANROOM) */.save(provider); + CUTTER_RECIPES.recipeBuilder("cut_ssoc").duration(900).EUt(64).inputItems(SIMPLE_SYSTEM_ON_CHIP_WAFER) + .outputItems(SIMPLE_SYSTEM_ON_CHIP, 6).save(provider); + CUTTER_RECIPES.recipeBuilder("cut_ram").duration(900).EUt(96).inputItems(RANDOM_ACCESS_MEMORY_WAFER) + .outputItems(RANDOM_ACCESS_MEMORY, 32).save(provider); + CUTTER_RECIPES.recipeBuilder("cut_qbit_cpu").duration(900).EUt(VA[EV]) + .inputItems(QUBIT_CENTRAL_PROCESSING_UNIT_WAFER).outputItems(QUBIT_CENTRAL_PROCESSING_UNIT, 4) + /* .cleanroom(CleanroomType.CLEANROOM) */.save(provider); + CUTTER_RECIPES.recipeBuilder("cut_ulpic").duration(900).EUt(VA[MV]) + .inputItems(ULTRA_LOW_POWER_INTEGRATED_CIRCUIT_WAFER).outputItems(ULTRA_LOW_POWER_INTEGRATED_CIRCUIT, 6) + .save(provider); + CUTTER_RECIPES.recipeBuilder("cut_lpic").duration(900).EUt(VA[HV]) + .inputItems(LOW_POWER_INTEGRATED_CIRCUIT_WAFER).outputItems(LOW_POWER_INTEGRATED_CIRCUIT, 4) + /* .cleanroom(CleanroomType.CLEANROOM) */.save(provider); + CUTTER_RECIPES.recipeBuilder("cut_pic").duration(900).EUt(VA[EV]).inputItems(POWER_INTEGRATED_CIRCUIT_WAFER) + .outputItems(POWER_INTEGRATED_CIRCUIT, 4)/* .cleanroom(CleanroomType.CLEANROOM) */.save(provider); + CUTTER_RECIPES.recipeBuilder("cut_hpic").duration(900).EUt(VA[IV]) + .inputItems(HIGH_POWER_INTEGRATED_CIRCUIT_WAFER).outputItems(HIGH_POWER_INTEGRATED_CIRCUIT, 2) + /* .cleanroom(CleanroomType.CLEANROOM) */.save(provider); + CUTTER_RECIPES.recipeBuilder("cut_uhpic").duration(900).EUt(VA[LuV]) + .inputItems(ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT_WAFER) + .outputItems(ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT, 2) + /* .cleanroom(CleanroomType.CLEANROOM) */.save(provider); + CUTTER_RECIPES.recipeBuilder("cut_nor").duration(900).EUt(192).inputItems(NOR_MEMORY_CHIP_WAFER) + .outputItems(NOR_MEMORY_CHIP, 16)/* .cleanroom(CleanroomType.CLEANROOM) */.save(provider); + CUTTER_RECIPES.recipeBuilder("cut_nand").duration(900).EUt(192).inputItems(NAND_MEMORY_CHIP_WAFER) + .outputItems(NAND_MEMORY_CHIP, 32)/* .cleanroom(CleanroomType.CLEANROOM) */.save(provider); + CUTTER_RECIPES.recipeBuilder("cut_cpu").duration(900).EUt(VA[MV]).inputItems(CENTRAL_PROCESSING_UNIT_WAFER) + .outputItems(CENTRAL_PROCESSING_UNIT, 8).save(provider); + CUTTER_RECIPES.recipeBuilder("cut_ilc").duration(900).EUt(64).inputItems(INTEGRATED_LOGIC_CIRCUIT_WAFER) + .outputItems(INTEGRATED_LOGIC_CIRCUIT, 8).save(provider); + CUTTER_RECIPES.recipeBuilder("cut_nano_cpu").duration(900).EUt(VA[HV]) + .inputItems(NANO_CENTRAL_PROCESSING_UNIT_WAFER).outputItems(NANO_CENTRAL_PROCESSING_UNIT, 8) + /* .cleanroom(CleanroomType.CLEANROOM) */.save(provider); } private static void componentRecipes(Consumer provider) { - // Vacuum Tube VanillaRecipeHelper.addShapedRecipe(provider, "vacuum_tube", VACUUM_TUBE.asStack(), "PTP", "WWW", @@ -667,7 +764,6 @@ private static void componentRecipes(Consumer provider) { } private static void boardRecipes(Consumer provider) { - // Coated Board VanillaRecipeHelper.addShapedRecipe(provider, "coated_board", COATED_BOARD.asStack(3), "RRR", "PPP", "RRR", @@ -1427,20 +1523,20 @@ private static void circuitRecipes(Consumer provider) { // UV ASSEMBLY_LINE_RECIPES.recipeBuilder("wetware_super_computer_uv").EUt(38400).duration(400) - .inputItems(WETWARE_CIRCUIT_BOARD) - .inputItems(WETWARE_PROCESSOR_ASSEMBLY_ZPM, 2) - .inputItems(ADVANCED_SMD_DIODE, 8) - .inputItems(NOR_MEMORY_CHIP, 16) - .inputItems(RANDOM_ACCESS_MEMORY, 32) - .inputItems(wireFine, YttriumBariumCuprate, 24) - .inputItems(foil, Polybenzimidazole, 32) - .inputItems(plate, Europium, 4) - .inputFluids(SolderingAlloy.getFluid(1152)) - .outputItems(WETWARE_SUPER_COMPUTER_UV) - .stationResearch(b -> b - .researchStack(WETWARE_PROCESSOR_ASSEMBLY_ZPM.asStack()) - .CWUt(16)) - .save(provider); + .inputItems(WETWARE_CIRCUIT_BOARD) + .inputItems(WETWARE_PROCESSOR_ASSEMBLY_ZPM, 2) + .inputItems(ADVANCED_SMD_DIODE, 8) + .inputItems(NOR_MEMORY_CHIP, 16) + .inputItems(RANDOM_ACCESS_MEMORY, 32) + .inputItems(wireFine, YttriumBariumCuprate, 24) + .inputItems(foil, Polybenzimidazole, 32) + .inputItems(plate, Europium, 4) + .inputFluids(SolderingAlloy.getFluid(1152)) + .outputItems(WETWARE_SUPER_COMPUTER_UV) + .stationResearch(b -> b + .researchStack(WETWARE_PROCESSOR_ASSEMBLY_ZPM.asStack()) + .CWUt(16)) + .save(provider); // UHV ASSEMBLY_LINE_RECIPES.recipeBuilder("wetware_mainframe_uhv") @@ -1494,15 +1590,15 @@ private static void circuitRecipes(Consumer provider) { // Data Module CIRCUIT_ASSEMBLER_RECIPES.recipeBuilder("data_module") - .inputItems(WETWARE_CIRCUIT_BOARD) - .inputItems(CustomTags.ZPM_CIRCUITS, 2) - .inputItems(RANDOM_ACCESS_MEMORY, 32) - .inputItems(NOR_MEMORY_CHIP, 64) - .inputItems(NAND_MEMORY_CHIP, 64) - .inputItems(wireFine, YttriumBariumCuprate, 32) - .outputItems(TOOL_DATA_MODULE) - .solderMultiplier(2) - .cleanroom(CleanroomType.STERILE_CLEANROOM) - .duration(400).EUt(38400).save(provider); + .inputItems(WETWARE_CIRCUIT_BOARD) + .inputItems(CustomTags.ZPM_CIRCUITS, 2) + .inputItems(RANDOM_ACCESS_MEMORY, 32) + .inputItems(NOR_MEMORY_CHIP, 64) + .inputItems(NAND_MEMORY_CHIP, 64) + .inputItems(wireFine, YttriumBariumCuprate, 32) + .outputItems(TOOL_DATA_MODULE) + .solderMultiplier(2) + .cleanroom(CleanroomType.STERILE_CLEANROOM) + .duration(400).EUt(38400).save(provider); } } diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/ComponentRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/ComponentRecipes.java index cddde624de..6acc5ab640 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/ComponentRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/ComponentRecipes.java @@ -4,10 +4,12 @@ import com.gregtechceu.gtceu.api.data.chemical.material.stack.UnificationEntry; import com.gregtechceu.gtceu.data.recipe.CustomTags; import com.gregtechceu.gtceu.data.recipe.VanillaRecipeHelper; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.world.item.Items; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; + import java.util.Map; import java.util.function.Consumer; @@ -21,113 +23,130 @@ public class ComponentRecipes { public static void init(Consumer provider) { - - //Motors Start-------------------------------------------------------------------------------------------------- - VanillaRecipeHelper.addShapedRecipe(provider, "electric_motor_lv_steel", ELECTRIC_MOTOR_LV.asStack(), "CWR", "WMW", "RWC", 'C', new UnificationEntry(cableGtSingle, Tin), 'W', new UnificationEntry(wireGtSingle, Copper), 'R', new UnificationEntry(rod, Steel), 'M', new UnificationEntry(rod, SteelMagnetic)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "electric_motor_lv_iron", ELECTRIC_MOTOR_LV.asStack(), "CWR", "WMW", "RWC", 'C', new UnificationEntry(cableGtSingle, Tin), 'W', new UnificationEntry(wireGtSingle, Copper), 'R', new UnificationEntry(rod, Iron), 'M', new UnificationEntry(rod, IronMagnetic)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "electric_motor_mv", ELECTRIC_MOTOR_MV.asStack(), "CWR", "WMW", "RWC", 'C', new UnificationEntry(cableGtSingle, Copper), 'W', new UnificationEntry(wireGtDouble, Cupronickel), 'R', new UnificationEntry(rod, Aluminium), 'M', new UnificationEntry(rod, SteelMagnetic)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "electric_motor_hv", ELECTRIC_MOTOR_HV.asStack(), "CWR", "WMW", "RWC", 'C', new UnificationEntry(cableGtDouble, Silver), 'W', new UnificationEntry(wireGtDouble, Electrum), 'R', new UnificationEntry(rod, StainlessSteel), 'M', new UnificationEntry(rod, SteelMagnetic)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "electric_motor_ev", ELECTRIC_MOTOR_EV.asStack(), "CWR", "WMW", "RWC", 'C', new UnificationEntry(cableGtDouble, Aluminium), 'W', new UnificationEntry(wireGtDouble, Kanthal), 'R', new UnificationEntry(rod, Titanium), 'M', new UnificationEntry(rod, NeodymiumMagnetic)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "electric_motor_iv", ELECTRIC_MOTOR_IV.asStack(), "CWR", "WMW", "RWC", 'C', new UnificationEntry(cableGtDouble, Tungsten), 'W', new UnificationEntry(wireGtDouble, Graphene), 'R', new UnificationEntry(rod, TungstenSteel), 'M', new UnificationEntry(rod, NeodymiumMagnetic)); + // Motors + // Start-------------------------------------------------------------------------------------------------- + VanillaRecipeHelper.addShapedRecipe(provider, "electric_motor_lv_steel", ELECTRIC_MOTOR_LV.asStack(), "CWR", + "WMW", "RWC", 'C', new UnificationEntry(cableGtSingle, Tin), 'W', + new UnificationEntry(wireGtSingle, Copper), 'R', new UnificationEntry(rod, Steel), 'M', + new UnificationEntry(rod, SteelMagnetic)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "electric_motor_lv_iron", ELECTRIC_MOTOR_LV.asStack(), + "CWR", "WMW", "RWC", 'C', new UnificationEntry(cableGtSingle, Tin), 'W', + new UnificationEntry(wireGtSingle, Copper), 'R', new UnificationEntry(rod, Iron), 'M', + new UnificationEntry(rod, IronMagnetic)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "electric_motor_mv", ELECTRIC_MOTOR_MV.asStack(), "CWR", + "WMW", "RWC", 'C', new UnificationEntry(cableGtSingle, Copper), 'W', + new UnificationEntry(wireGtDouble, Cupronickel), 'R', new UnificationEntry(rod, Aluminium), 'M', + new UnificationEntry(rod, SteelMagnetic)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "electric_motor_hv", ELECTRIC_MOTOR_HV.asStack(), "CWR", + "WMW", "RWC", 'C', new UnificationEntry(cableGtDouble, Silver), 'W', + new UnificationEntry(wireGtDouble, Electrum), 'R', new UnificationEntry(rod, StainlessSteel), 'M', + new UnificationEntry(rod, SteelMagnetic)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "electric_motor_ev", ELECTRIC_MOTOR_EV.asStack(), "CWR", + "WMW", "RWC", 'C', new UnificationEntry(cableGtDouble, Aluminium), 'W', + new UnificationEntry(wireGtDouble, Kanthal), 'R', new UnificationEntry(rod, Titanium), 'M', + new UnificationEntry(rod, NeodymiumMagnetic)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "electric_motor_iv", ELECTRIC_MOTOR_IV.asStack(), "CWR", + "WMW", "RWC", 'C', new UnificationEntry(cableGtDouble, Tungsten), 'W', + new UnificationEntry(wireGtDouble, Graphene), 'R', new UnificationEntry(rod, TungstenSteel), 'M', + new UnificationEntry(rod, NeodymiumMagnetic)); ASSEMBLER_RECIPES.recipeBuilder("electric_motor_lv_iron") - .inputItems(cableGtSingle, Tin, 2) - .inputItems(rod, Iron, 2) - .inputItems(rod, IronMagnetic) - .inputItems(wireGtSingle, Copper, 4) - .outputItems(ELECTRIC_MOTOR_LV) - .duration(100).EUt(VA[LV]).save(provider); + .inputItems(cableGtSingle, Tin, 2) + .inputItems(rod, Iron, 2) + .inputItems(rod, IronMagnetic) + .inputItems(wireGtSingle, Copper, 4) + .outputItems(ELECTRIC_MOTOR_LV) + .duration(100).EUt(VA[LV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("electric_motor_lv_steel") - .inputItems(cableGtSingle, Tin, 2) - .inputItems(rod, Steel, 2) - .inputItems(rod, SteelMagnetic) - .inputItems(wireGtSingle, Copper, 4) - .outputItems(ELECTRIC_MOTOR_LV) - .duration(100).EUt(VA[LV]).save(provider); + .inputItems(cableGtSingle, Tin, 2) + .inputItems(rod, Steel, 2) + .inputItems(rod, SteelMagnetic) + .inputItems(wireGtSingle, Copper, 4) + .outputItems(ELECTRIC_MOTOR_LV) + .duration(100).EUt(VA[LV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("electric_motor_mv") - .inputItems(cableGtSingle, Copper, 2) - .inputItems(rod, Aluminium, 2) - .inputItems(rod, SteelMagnetic) - .inputItems(wireGtDouble, Cupronickel, 4) - .outputItems(ELECTRIC_MOTOR_MV) - .duration(100).EUt(VA[LV]).save(provider); + .inputItems(cableGtSingle, Copper, 2) + .inputItems(rod, Aluminium, 2) + .inputItems(rod, SteelMagnetic) + .inputItems(wireGtDouble, Cupronickel, 4) + .outputItems(ELECTRIC_MOTOR_MV) + .duration(100).EUt(VA[LV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("electric_motor_hv") - .inputItems(cableGtDouble, Silver, 2) - .inputItems(rod, StainlessSteel, 2) - .inputItems(rod, SteelMagnetic) - .inputItems(wireGtDouble, Electrum, 4) - .outputItems(ELECTRIC_MOTOR_HV) - .duration(100).EUt(VA[LV]).save(provider); + .inputItems(cableGtDouble, Silver, 2) + .inputItems(rod, StainlessSteel, 2) + .inputItems(rod, SteelMagnetic) + .inputItems(wireGtDouble, Electrum, 4) + .outputItems(ELECTRIC_MOTOR_HV) + .duration(100).EUt(VA[LV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("electric_motor_ev") - .inputItems(cableGtDouble, Aluminium, 2) - .inputItems(rod, Titanium, 2) - .inputItems(rod, NeodymiumMagnetic) - .inputItems(wireGtDouble, Kanthal, 4) - .outputItems(ELECTRIC_MOTOR_EV) - .duration(100).EUt(VA[LV]).save(provider); + .inputItems(cableGtDouble, Aluminium, 2) + .inputItems(rod, Titanium, 2) + .inputItems(rod, NeodymiumMagnetic) + .inputItems(wireGtDouble, Kanthal, 4) + .outputItems(ELECTRIC_MOTOR_EV) + .duration(100).EUt(VA[LV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("electric_motor_iv") - .inputItems(cableGtDouble, Tungsten, 2) - .inputItems(rod, TungstenSteel, 2) - .inputItems(rod, NeodymiumMagnetic) - .inputItems(wireGtDouble, Graphene, 4) - .outputItems(ELECTRIC_MOTOR_IV) - .duration(100).EUt(VA[LV]).save(provider); + .inputItems(cableGtDouble, Tungsten, 2) + .inputItems(rod, TungstenSteel, 2) + .inputItems(rod, NeodymiumMagnetic) + .inputItems(wireGtDouble, Graphene, 4) + .outputItems(ELECTRIC_MOTOR_IV) + .duration(100).EUt(VA[LV]).save(provider); ASSEMBLY_LINE_RECIPES.recipeBuilder("electric_motor_luv") - .inputItems(rodLong, SamariumMagnetic) - .inputItems(rodLong, HSSS, 2) - .inputItems(ring, HSSS, 2) - .inputItems(round, HSSS, 4) - .inputItems(wireFine, Ruridit, 64) - .inputItems(cableGtSingle, NiobiumTitanium, 2) - .inputFluids(SolderingAlloy.getFluid(L)) - .inputFluids(Lubricant.getFluid(250)) - .outputItems(ELECTRIC_MOTOR_LuV) - .duration(600).EUt(6000).save(provider); + .inputItems(rodLong, SamariumMagnetic) + .inputItems(rodLong, HSSS, 2) + .inputItems(ring, HSSS, 2) + .inputItems(round, HSSS, 4) + .inputItems(wireFine, Ruridit, 64) + .inputItems(cableGtSingle, NiobiumTitanium, 2) + .inputFluids(SolderingAlloy.getFluid(L)) + .inputFluids(Lubricant.getFluid(250)) + .outputItems(ELECTRIC_MOTOR_LuV) + .duration(600).EUt(6000).save(provider); ASSEMBLY_LINE_RECIPES.recipeBuilder("electric_motor_zpm") - .inputItems(rodLong, SamariumMagnetic) - .inputItems(rodLong, Osmiridium, 4) - .inputItems(ring, Osmiridium, 4) - .inputItems(round, Osmiridium, 8) - .inputItems(wireFine, Europium, 64) - .inputItems(wireFine, Europium, 32) - .inputItems(cableGtSingle, VanadiumGallium, 2) - .inputFluids(SolderingAlloy.getFluid(L * 2)) - .inputFluids(Lubricant.getFluid(500)) - .outputItems(ELECTRIC_MOTOR_ZPM) - .scannerResearch(b -> b - .researchStack(ELECTRIC_MOTOR_LuV.asStack()) - .duration(1200) - .EUt(VA[IV])) - .duration(600).EUt(24000).save(provider); + .inputItems(rodLong, SamariumMagnetic) + .inputItems(rodLong, Osmiridium, 4) + .inputItems(ring, Osmiridium, 4) + .inputItems(round, Osmiridium, 8) + .inputItems(wireFine, Europium, 64) + .inputItems(wireFine, Europium, 32) + .inputItems(cableGtSingle, VanadiumGallium, 2) + .inputFluids(SolderingAlloy.getFluid(L * 2)) + .inputFluids(Lubricant.getFluid(500)) + .outputItems(ELECTRIC_MOTOR_ZPM) + .scannerResearch(b -> b + .researchStack(ELECTRIC_MOTOR_LuV.asStack()) + .duration(1200) + .EUt(VA[IV])) + .duration(600).EUt(24000).save(provider); ASSEMBLY_LINE_RECIPES.recipeBuilder("electric_motor_uv") - .inputItems(rodLong, SamariumMagnetic) - .inputItems(rodLong, Tritanium, 4) - .inputItems(ring, Tritanium, 4) - .inputItems(round, Tritanium, 8) - .inputItems(wireFine, Americium, 64) - .inputItems(wireFine, Americium, 64) - .inputItems(cableGtSingle, YttriumBariumCuprate, 2) - .inputFluids(SolderingAlloy.getFluid(L * 4)) - .inputFluids(Lubricant.getFluid(1000)) - .inputFluids(Naquadria.getFluid(L * 4)) - .outputItems(ELECTRIC_MOTOR_UV) - .stationResearch(b -> b - .researchStack(ELECTRIC_MOTOR_ZPM.asStack()) - .CWUt(32) - .EUt(VA[ZPM])) - .duration(600).EUt(100000).save(provider); - - - - //Conveyors Start----------------------------------------------------------------------------------------------- + .inputItems(rodLong, SamariumMagnetic) + .inputItems(rodLong, Tritanium, 4) + .inputItems(ring, Tritanium, 4) + .inputItems(round, Tritanium, 8) + .inputItems(wireFine, Americium, 64) + .inputItems(wireFine, Americium, 64) + .inputItems(cableGtSingle, YttriumBariumCuprate, 2) + .inputFluids(SolderingAlloy.getFluid(L * 4)) + .inputFluids(Lubricant.getFluid(1000)) + .inputFluids(Naquadria.getFluid(L * 4)) + .outputItems(ELECTRIC_MOTOR_UV) + .stationResearch(b -> b + .researchStack(ELECTRIC_MOTOR_ZPM.asStack()) + .CWUt(32) + .EUt(VA[ZPM])) + .duration(600).EUt(100000).save(provider); + + // Conveyors + // Start----------------------------------------------------------------------------------------------- final Map rubberMaterials = new Object2ObjectOpenHashMap<>(); rubberMaterials.put("rubber", Rubber); rubberMaterials.put("silicone_rubber", SiliconeRubber); @@ -137,830 +156,927 @@ public static void init(Consumer provider) { Material material = materialEntry.getValue(); String name = materialEntry.getKey(); - VanillaRecipeHelper.addShapedRecipe(provider, material.equals(Rubber), String.format("conveyor_module_lv_%s", name), CONVEYOR_MODULE_LV.asStack(), "RRR", "MCM", "RRR", 'R', new UnificationEntry(plate, material), 'C', new UnificationEntry(cableGtSingle, Tin), 'M', ELECTRIC_MOTOR_LV.asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, material.equals(Rubber), String.format("conveyor_module_mv_%s", name), CONVEYOR_MODULE_MV.asStack(), "RRR", "MCM", "RRR", 'R', new UnificationEntry(plate, material), 'C', new UnificationEntry(cableGtSingle, Copper), 'M', ELECTRIC_MOTOR_MV.asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, material.equals(Rubber), String.format("conveyor_module_hv_%s", name), CONVEYOR_MODULE_HV.asStack(), "RRR", "MCM", "RRR", 'R', new UnificationEntry(plate, material), 'C', new UnificationEntry(cableGtSingle, Gold), 'M', ELECTRIC_MOTOR_HV.asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, material.equals(Rubber), String.format("conveyor_module_ev_%s", name), CONVEYOR_MODULE_EV.asStack(), "RRR", "MCM", "RRR", 'R', new UnificationEntry(plate, material), 'C', new UnificationEntry(cableGtSingle, Aluminium), 'M', ELECTRIC_MOTOR_EV.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, material.equals(Rubber), + String.format("conveyor_module_lv_%s", name), CONVEYOR_MODULE_LV.asStack(), "RRR", "MCM", "RRR", + 'R', new UnificationEntry(plate, material), 'C', new UnificationEntry(cableGtSingle, Tin), 'M', + ELECTRIC_MOTOR_LV.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, material.equals(Rubber), + String.format("conveyor_module_mv_%s", name), CONVEYOR_MODULE_MV.asStack(), "RRR", "MCM", "RRR", + 'R', new UnificationEntry(plate, material), 'C', new UnificationEntry(cableGtSingle, Copper), 'M', + ELECTRIC_MOTOR_MV.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, material.equals(Rubber), + String.format("conveyor_module_hv_%s", name), CONVEYOR_MODULE_HV.asStack(), "RRR", "MCM", "RRR", + 'R', new UnificationEntry(plate, material), 'C', new UnificationEntry(cableGtSingle, Gold), 'M', + ELECTRIC_MOTOR_HV.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, material.equals(Rubber), + String.format("conveyor_module_ev_%s", name), CONVEYOR_MODULE_EV.asStack(), "RRR", "MCM", "RRR", + 'R', new UnificationEntry(plate, material), 'C', new UnificationEntry(cableGtSingle, Aluminium), + 'M', ELECTRIC_MOTOR_EV.asStack()); if (!materialEntry.getValue().equals(Rubber)) - VanillaRecipeHelper.addShapedRecipe(provider, material.equals(SiliconeRubber), String.format("conveyor_module_iv_%s", materialEntry.getKey()), CONVEYOR_MODULE_IV.asStack(), "RRR", "MCM", "RRR", 'R', new UnificationEntry(plate, material), 'C', new UnificationEntry(cableGtSingle, Tungsten), 'M', ELECTRIC_MOTOR_IV.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, material.equals(SiliconeRubber), + String.format("conveyor_module_iv_%s", materialEntry.getKey()), CONVEYOR_MODULE_IV.asStack(), + "RRR", "MCM", "RRR", 'R', new UnificationEntry(plate, material), 'C', + new UnificationEntry(cableGtSingle, Tungsten), 'M', ELECTRIC_MOTOR_IV.asStack()); ASSEMBLER_RECIPES.recipeBuilder("conveyor_module_lv_" + name) - .inputItems(cableGtSingle, Tin) - .inputItems(ELECTRIC_MOTOR_LV, 2) - .inputFluids(materialEntry.getValue().getFluid(L * 6)) - .circuitMeta(1) - .outputItems(CONVEYOR_MODULE_LV) - .duration(100).EUt(VA[LV]).save(provider); + .inputItems(cableGtSingle, Tin) + .inputItems(ELECTRIC_MOTOR_LV, 2) + .inputFluids(materialEntry.getValue().getFluid(L * 6)) + .circuitMeta(1) + .outputItems(CONVEYOR_MODULE_LV) + .duration(100).EUt(VA[LV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("conveyor_module_mv_" + name) - .inputItems(cableGtSingle, Copper) - .inputItems(ELECTRIC_MOTOR_MV, 2) - .inputFluids(materialEntry.getValue().getFluid(L * 6)) - .circuitMeta(1) - .outputItems(CONVEYOR_MODULE_MV) - .duration(100).EUt(VA[LV]).save(provider); + .inputItems(cableGtSingle, Copper) + .inputItems(ELECTRIC_MOTOR_MV, 2) + .inputFluids(materialEntry.getValue().getFluid(L * 6)) + .circuitMeta(1) + .outputItems(CONVEYOR_MODULE_MV) + .duration(100).EUt(VA[LV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("conveyor_module_hv_" + name) - .inputItems(cableGtSingle, Gold) - .inputItems(ELECTRIC_MOTOR_HV, 2) - .inputFluids(materialEntry.getValue().getFluid(L * 6)) - .circuitMeta(1) - .outputItems(CONVEYOR_MODULE_HV) - .duration(100).EUt(VA[LV]).save(provider); + .inputItems(cableGtSingle, Gold) + .inputItems(ELECTRIC_MOTOR_HV, 2) + .inputFluids(materialEntry.getValue().getFluid(L * 6)) + .circuitMeta(1) + .outputItems(CONVEYOR_MODULE_HV) + .duration(100).EUt(VA[LV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("conveyor_module_ev_" + name) - .inputItems(cableGtSingle, Aluminium) - .inputItems(ELECTRIC_MOTOR_EV, 2) - .inputFluids(materialEntry.getValue().getFluid(L * 6)) - .circuitMeta(1) - .outputItems(CONVEYOR_MODULE_EV) - .duration(100).EUt(VA[LV]).save(provider); - - if (!materialEntry.getValue().equals(Rubber)) - ASSEMBLER_RECIPES.recipeBuilder("conveyor_module_iv_" + name) - .inputItems(cableGtSingle, Tungsten) - .inputItems(ELECTRIC_MOTOR_IV, 2) + .inputItems(cableGtSingle, Aluminium) + .inputItems(ELECTRIC_MOTOR_EV, 2) .inputFluids(materialEntry.getValue().getFluid(L * 6)) .circuitMeta(1) - .outputItems(CONVEYOR_MODULE_IV) + .outputItems(CONVEYOR_MODULE_EV) .duration(100).EUt(VA[LV]).save(provider); - - //Pumps Start--------------------------------------------------------------------------------------------------- - VanillaRecipeHelper.addShapedRecipe(provider, material.equals(Rubber), String.format("electric_pump_lv_%s", name), ELECTRIC_PUMP_LV.asStack(), "SXR", "dPw", "RMC", 'S', new UnificationEntry(screw, Tin), 'X', new UnificationEntry(rotor, Tin), 'P', new UnificationEntry(pipeNormalFluid, Bronze), 'R', new UnificationEntry(ring, material), 'C', new UnificationEntry(cableGtSingle, Tin), 'M', ELECTRIC_MOTOR_LV.asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, material.equals(Rubber), String.format("electric_pump_mv_%s", name), ELECTRIC_PUMP_MV.asStack(), "SXR", "dPw", "RMC", 'S', new UnificationEntry(screw, Bronze), 'X', new UnificationEntry(rotor, Bronze), 'P', new UnificationEntry(pipeNormalFluid, Steel), 'R', new UnificationEntry(ring, material), 'C', new UnificationEntry(cableGtSingle, Copper), 'M', ELECTRIC_MOTOR_MV.asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, material.equals(Rubber), String.format("electric_pump_hv_%s", name), ELECTRIC_PUMP_HV.asStack(), "SXR", "dPw", "RMC", 'S', new UnificationEntry(screw, Steel), 'X', new UnificationEntry(rotor, Steel), 'P', new UnificationEntry(pipeNormalFluid, StainlessSteel), 'R', new UnificationEntry(ring, material), 'C', new UnificationEntry(cableGtSingle, Gold), 'M', ELECTRIC_MOTOR_HV.asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, material.equals(Rubber), String.format("electric_pump_ev_%s", name), ELECTRIC_PUMP_EV.asStack(), "SXR", "dPw", "RMC", 'S', new UnificationEntry(screw, StainlessSteel), 'X', new UnificationEntry(rotor, StainlessSteel), 'P', new UnificationEntry(pipeNormalFluid, Titanium), 'R', new UnificationEntry(ring, material), 'C', new UnificationEntry(cableGtSingle, Aluminium), 'M', ELECTRIC_MOTOR_EV.asStack()); + if (!materialEntry.getValue().equals(Rubber)) + ASSEMBLER_RECIPES.recipeBuilder("conveyor_module_iv_" + name) + .inputItems(cableGtSingle, Tungsten) + .inputItems(ELECTRIC_MOTOR_IV, 2) + .inputFluids(materialEntry.getValue().getFluid(L * 6)) + .circuitMeta(1) + .outputItems(CONVEYOR_MODULE_IV) + .duration(100).EUt(VA[LV]).save(provider); + + // Pumps + // Start--------------------------------------------------------------------------------------------------- + VanillaRecipeHelper.addShapedRecipe(provider, material.equals(Rubber), + String.format("electric_pump_lv_%s", name), ELECTRIC_PUMP_LV.asStack(), "SXR", "dPw", "RMC", 'S', + new UnificationEntry(screw, Tin), 'X', new UnificationEntry(rotor, Tin), 'P', + new UnificationEntry(pipeNormalFluid, Bronze), 'R', new UnificationEntry(ring, material), 'C', + new UnificationEntry(cableGtSingle, Tin), 'M', ELECTRIC_MOTOR_LV.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, material.equals(Rubber), + String.format("electric_pump_mv_%s", name), ELECTRIC_PUMP_MV.asStack(), "SXR", "dPw", "RMC", 'S', + new UnificationEntry(screw, Bronze), 'X', new UnificationEntry(rotor, Bronze), 'P', + new UnificationEntry(pipeNormalFluid, Steel), 'R', new UnificationEntry(ring, material), 'C', + new UnificationEntry(cableGtSingle, Copper), 'M', ELECTRIC_MOTOR_MV.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, material.equals(Rubber), + String.format("electric_pump_hv_%s", name), ELECTRIC_PUMP_HV.asStack(), "SXR", "dPw", "RMC", 'S', + new UnificationEntry(screw, Steel), 'X', new UnificationEntry(rotor, Steel), 'P', + new UnificationEntry(pipeNormalFluid, StainlessSteel), 'R', new UnificationEntry(ring, material), + 'C', new UnificationEntry(cableGtSingle, Gold), 'M', ELECTRIC_MOTOR_HV.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, material.equals(Rubber), + String.format("electric_pump_ev_%s", name), ELECTRIC_PUMP_EV.asStack(), "SXR", "dPw", "RMC", 'S', + new UnificationEntry(screw, StainlessSteel), 'X', new UnificationEntry(rotor, StainlessSteel), 'P', + new UnificationEntry(pipeNormalFluid, Titanium), 'R', new UnificationEntry(ring, material), 'C', + new UnificationEntry(cableGtSingle, Aluminium), 'M', ELECTRIC_MOTOR_EV.asStack()); if (!material.equals(Rubber)) - VanillaRecipeHelper.addShapedRecipe(provider, material.equals(SiliconeRubber), String.format("electric_pump_iv_%s", name), ELECTRIC_PUMP_IV.asStack(), "SXR", "dPw", "RMC", 'S', new UnificationEntry(screw, TungstenSteel), 'X', new UnificationEntry(rotor, TungstenSteel), 'P', new UnificationEntry(pipeNormalFluid, TungstenSteel), 'R', new UnificationEntry(ring, material), 'C', new UnificationEntry(cableGtSingle, Tungsten), 'M', ELECTRIC_MOTOR_IV.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, material.equals(SiliconeRubber), + String.format("electric_pump_iv_%s", name), ELECTRIC_PUMP_IV.asStack(), "SXR", "dPw", "RMC", + 'S', new UnificationEntry(screw, TungstenSteel), 'X', + new UnificationEntry(rotor, TungstenSteel), 'P', + new UnificationEntry(pipeNormalFluid, TungstenSteel), 'R', new UnificationEntry(ring, material), + 'C', new UnificationEntry(cableGtSingle, Tungsten), 'M', ELECTRIC_MOTOR_IV.asStack()); ASSEMBLER_RECIPES.recipeBuilder("electric_pump_lv_" + name) - .inputItems(cableGtSingle, Tin) - .inputItems(pipeNormalFluid, Bronze) - .inputItems(screw, Tin) - .inputItems(rotor, Tin) - .inputItems(ring, materialEntry.getValue(), 2) - .inputItems(ELECTRIC_MOTOR_LV) - .outputItems(ELECTRIC_PUMP_LV) - .duration(100).EUt(VA[LV]).save(provider); + .inputItems(cableGtSingle, Tin) + .inputItems(pipeNormalFluid, Bronze) + .inputItems(screw, Tin) + .inputItems(rotor, Tin) + .inputItems(ring, materialEntry.getValue(), 2) + .inputItems(ELECTRIC_MOTOR_LV) + .outputItems(ELECTRIC_PUMP_LV) + .duration(100).EUt(VA[LV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("electric_pump_mv_" + name) - .inputItems(cableGtSingle, Copper) - .inputItems(pipeNormalFluid, Steel) - .inputItems(screw, Bronze) - .inputItems(rotor, Bronze) - .inputItems(ring, materialEntry.getValue(), 2) - .inputItems(ELECTRIC_MOTOR_MV) - .outputItems(ELECTRIC_PUMP_MV) - .duration(100).EUt(VA[LV]).save(provider); + .inputItems(cableGtSingle, Copper) + .inputItems(pipeNormalFluid, Steel) + .inputItems(screw, Bronze) + .inputItems(rotor, Bronze) + .inputItems(ring, materialEntry.getValue(), 2) + .inputItems(ELECTRIC_MOTOR_MV) + .outputItems(ELECTRIC_PUMP_MV) + .duration(100).EUt(VA[LV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("electric_pump_hv_" + name) - .inputItems(cableGtSingle, Gold) - .inputItems(pipeNormalFluid, StainlessSteel) - .inputItems(screw, Steel) - .inputItems(rotor, Steel) - .inputItems(ring, materialEntry.getValue(), 2) - .inputItems(ELECTRIC_MOTOR_HV) - .outputItems(ELECTRIC_PUMP_HV) - .duration(100).EUt(VA[LV]).save(provider); + .inputItems(cableGtSingle, Gold) + .inputItems(pipeNormalFluid, StainlessSteel) + .inputItems(screw, Steel) + .inputItems(rotor, Steel) + .inputItems(ring, materialEntry.getValue(), 2) + .inputItems(ELECTRIC_MOTOR_HV) + .outputItems(ELECTRIC_PUMP_HV) + .duration(100).EUt(VA[LV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("electric_pump_ev_" + name) - .inputItems(cableGtSingle, Aluminium) - .inputItems(pipeNormalFluid, Titanium) - .inputItems(screw, StainlessSteel) - .inputItems(rotor, StainlessSteel) - .inputItems(ring, materialEntry.getValue(), 2) - .inputItems(ELECTRIC_MOTOR_EV) - .outputItems(ELECTRIC_PUMP_EV) - .duration(100).EUt(VA[LV]).save(provider); + .inputItems(cableGtSingle, Aluminium) + .inputItems(pipeNormalFluid, Titanium) + .inputItems(screw, StainlessSteel) + .inputItems(rotor, StainlessSteel) + .inputItems(ring, materialEntry.getValue(), 2) + .inputItems(ELECTRIC_MOTOR_EV) + .outputItems(ELECTRIC_PUMP_EV) + .duration(100).EUt(VA[LV]).save(provider); if (!materialEntry.getValue().equals(Rubber)) ASSEMBLER_RECIPES.recipeBuilder("electric_pump_iv_" + name) - .inputItems(cableGtSingle, Tungsten) - .inputItems(pipeNormalFluid, TungstenSteel) - .inputItems(screw, TungstenSteel) - .inputItems(rotor, TungstenSteel) - .inputItems(ring, materialEntry.getValue(), 2) - .inputItems(ELECTRIC_MOTOR_IV) - .outputItems(ELECTRIC_PUMP_IV) - .duration(100).EUt(VA[LV]).save(provider); + .inputItems(cableGtSingle, Tungsten) + .inputItems(pipeNormalFluid, TungstenSteel) + .inputItems(screw, TungstenSteel) + .inputItems(rotor, TungstenSteel) + .inputItems(ring, materialEntry.getValue(), 2) + .inputItems(ELECTRIC_MOTOR_IV) + .outputItems(ELECTRIC_PUMP_IV) + .duration(100).EUt(VA[LV]).save(provider); } ASSEMBLY_LINE_RECIPES.recipeBuilder("conveyor_module_luv") - .inputItems(ELECTRIC_MOTOR_LuV, 2) - .inputItems(plate, HSSS, 2) - .inputItems(ring, HSSS, 4) - .inputItems(round, HSSS, 16) - .inputItems(screw, HSSS, 4) - .inputItems(cableGtSingle, NiobiumTitanium, 2) - .inputFluids(SolderingAlloy.getFluid(L)) - .inputFluids(Lubricant.getFluid(250)) - .inputFluids(StyreneButadieneRubber.getFluid(L * 8)) - .outputItems(CONVEYOR_MODULE_LuV) - .duration(600).EUt(6000).save(provider); + .inputItems(ELECTRIC_MOTOR_LuV, 2) + .inputItems(plate, HSSS, 2) + .inputItems(ring, HSSS, 4) + .inputItems(round, HSSS, 16) + .inputItems(screw, HSSS, 4) + .inputItems(cableGtSingle, NiobiumTitanium, 2) + .inputFluids(SolderingAlloy.getFluid(L)) + .inputFluids(Lubricant.getFluid(250)) + .inputFluids(StyreneButadieneRubber.getFluid(L * 8)) + .outputItems(CONVEYOR_MODULE_LuV) + .duration(600).EUt(6000).save(provider); ASSEMBLY_LINE_RECIPES.recipeBuilder("conveyor_module_zpm") - .inputItems(ELECTRIC_MOTOR_ZPM, 2) - .inputItems(plate, Osmiridium, 2) - .inputItems(ring, Osmiridium, 4) - .inputItems(round, Osmiridium, 16) - .inputItems(screw, Osmiridium, 4) - .inputItems(cableGtSingle, VanadiumGallium, 2) - .inputFluids(SolderingAlloy.getFluid(L * 2)) - .inputFluids(Lubricant.getFluid(500)) - .inputFluids(StyreneButadieneRubber.getFluid(L * 16)) - .outputItems(CONVEYOR_MODULE_ZPM) - .scannerResearch(b -> b - .researchStack(CONVEYOR_MODULE_LuV.asStack()) - .duration(1200) - .EUt(VA[IV])) - .duration(600).EUt(24000).save(provider); + .inputItems(ELECTRIC_MOTOR_ZPM, 2) + .inputItems(plate, Osmiridium, 2) + .inputItems(ring, Osmiridium, 4) + .inputItems(round, Osmiridium, 16) + .inputItems(screw, Osmiridium, 4) + .inputItems(cableGtSingle, VanadiumGallium, 2) + .inputFluids(SolderingAlloy.getFluid(L * 2)) + .inputFluids(Lubricant.getFluid(500)) + .inputFluids(StyreneButadieneRubber.getFluid(L * 16)) + .outputItems(CONVEYOR_MODULE_ZPM) + .scannerResearch(b -> b + .researchStack(CONVEYOR_MODULE_LuV.asStack()) + .duration(1200) + .EUt(VA[IV])) + .duration(600).EUt(24000).save(provider); ASSEMBLY_LINE_RECIPES.recipeBuilder("conveyor_module_uv") - .inputItems(ELECTRIC_MOTOR_UV, 2) - .inputItems(plate, Tritanium, 2) - .inputItems(ring, Tritanium, 4) - .inputItems(round, Tritanium, 16) - .inputItems(screw, Tritanium, 4) - .inputItems(cableGtSingle, YttriumBariumCuprate, 2) - .inputFluids(SolderingAlloy.getFluid(L * 4)) - .inputFluids(Lubricant.getFluid(1000)) - .inputFluids(StyreneButadieneRubber.getFluid(L * 24)) - .inputFluids(Naquadria.getFluid(L * 4)) - .outputItems(CONVEYOR_MODULE_UV) - .stationResearch(b -> b - .researchStack(CONVEYOR_MODULE_ZPM.asStack()) - .CWUt(32) - .EUt(VA[ZPM])) - .duration(600).EUt(100000).save(provider); + .inputItems(ELECTRIC_MOTOR_UV, 2) + .inputItems(plate, Tritanium, 2) + .inputItems(ring, Tritanium, 4) + .inputItems(round, Tritanium, 16) + .inputItems(screw, Tritanium, 4) + .inputItems(cableGtSingle, YttriumBariumCuprate, 2) + .inputFluids(SolderingAlloy.getFluid(L * 4)) + .inputFluids(Lubricant.getFluid(1000)) + .inputFluids(StyreneButadieneRubber.getFluid(L * 24)) + .inputFluids(Naquadria.getFluid(L * 4)) + .outputItems(CONVEYOR_MODULE_UV) + .stationResearch(b -> b + .researchStack(CONVEYOR_MODULE_ZPM.asStack()) + .CWUt(32) + .EUt(VA[ZPM])) + .duration(600).EUt(100000).save(provider); ASSEMBLY_LINE_RECIPES.recipeBuilder("electric_pump_luv") - .inputItems(ELECTRIC_MOTOR_LuV) - .inputItems(pipeSmallFluid, NiobiumTitanium) - .inputItems(plate, HSSS, 2) - .inputItems(screw, HSSS, 8) - .inputItems(ring, SiliconeRubber, 4) - .inputItems(rotor, HSSS) - .inputItems(cableGtSingle, NiobiumTitanium, 2) - .inputFluids(SolderingAlloy.getFluid(L)) - .inputFluids(Lubricant.getFluid(250)) - .outputItems(ELECTRIC_PUMP_LuV) - .duration(600).EUt(6000).save(provider); + .inputItems(ELECTRIC_MOTOR_LuV) + .inputItems(pipeSmallFluid, NiobiumTitanium) + .inputItems(plate, HSSS, 2) + .inputItems(screw, HSSS, 8) + .inputItems(ring, SiliconeRubber, 4) + .inputItems(rotor, HSSS) + .inputItems(cableGtSingle, NiobiumTitanium, 2) + .inputFluids(SolderingAlloy.getFluid(L)) + .inputFluids(Lubricant.getFluid(250)) + .outputItems(ELECTRIC_PUMP_LuV) + .duration(600).EUt(6000).save(provider); ASSEMBLY_LINE_RECIPES.recipeBuilder("electric_pump_zpm") - .inputItems(ELECTRIC_MOTOR_ZPM) - .inputItems(pipeNormalFluid, Polybenzimidazole) - .inputItems(plate, Osmiridium, 2) - .inputItems(screw, Osmiridium, 8) - .inputItems(ring, SiliconeRubber, 8) - .inputItems(rotor, Osmiridium) - .inputItems(cableGtSingle, VanadiumGallium, 2) - .inputFluids(SolderingAlloy.getFluid(L * 2)) - .inputFluids(Lubricant.getFluid(500)) - .outputItems(ELECTRIC_PUMP_ZPM) - .scannerResearch(b -> b - .researchStack(ELECTRIC_PUMP_LuV.asStack()) - .duration(1200) - .EUt(VA[IV])) - .duration(600).EUt(24000).save(provider); + .inputItems(ELECTRIC_MOTOR_ZPM) + .inputItems(pipeNormalFluid, Polybenzimidazole) + .inputItems(plate, Osmiridium, 2) + .inputItems(screw, Osmiridium, 8) + .inputItems(ring, SiliconeRubber, 8) + .inputItems(rotor, Osmiridium) + .inputItems(cableGtSingle, VanadiumGallium, 2) + .inputFluids(SolderingAlloy.getFluid(L * 2)) + .inputFluids(Lubricant.getFluid(500)) + .outputItems(ELECTRIC_PUMP_ZPM) + .scannerResearch(b -> b + .researchStack(ELECTRIC_PUMP_LuV.asStack()) + .duration(1200) + .EUt(VA[IV])) + .duration(600).EUt(24000).save(provider); ASSEMBLY_LINE_RECIPES.recipeBuilder("electric_pump_uv") - .inputItems(ELECTRIC_MOTOR_UV) - .inputItems(pipeLargeFluid, Naquadah) - .inputItems(plate, Tritanium, 2) - .inputItems(screw, Tritanium, 8) - .inputItems(ring, SiliconeRubber, 16) - .inputItems(rotor, NaquadahAlloy) - .inputItems(cableGtSingle, YttriumBariumCuprate, 2) - .inputFluids(SolderingAlloy.getFluid(L * 4)) - .inputFluids(Lubricant.getFluid(1000)) - .inputFluids(Naquadria.getFluid(L * 4)) - .outputItems(ELECTRIC_PUMP_UV) - .stationResearch(b -> b - .researchStack(ELECTRIC_PUMP_ZPM.asStack()) - .CWUt(32) - .EUt(VA[ZPM])) - .duration(600).EUt(100000).save(provider); - - //Fluid Regulators---------------------------------------------------------------------------------------------- + .inputItems(ELECTRIC_MOTOR_UV) + .inputItems(pipeLargeFluid, Naquadah) + .inputItems(plate, Tritanium, 2) + .inputItems(screw, Tritanium, 8) + .inputItems(ring, SiliconeRubber, 16) + .inputItems(rotor, NaquadahAlloy) + .inputItems(cableGtSingle, YttriumBariumCuprate, 2) + .inputFluids(SolderingAlloy.getFluid(L * 4)) + .inputFluids(Lubricant.getFluid(1000)) + .inputFluids(Naquadria.getFluid(L * 4)) + .outputItems(ELECTRIC_PUMP_UV) + .stationResearch(b -> b + .researchStack(ELECTRIC_PUMP_ZPM.asStack()) + .CWUt(32) + .EUt(VA[ZPM])) + .duration(600).EUt(100000).save(provider); + + // Fluid + // Regulators---------------------------------------------------------------------------------------------- ASSEMBLER_RECIPES.recipeBuilder("fluid_regulator_lv") - .inputItems(ELECTRIC_PUMP_LV) - .inputItems(CustomTags.LV_CIRCUITS, 2) - .circuitMeta(1) - .outputItems(FLUID_REGULATOR_LV) - .EUt(VA[LV]) - .duration(400) - .save(provider); + .inputItems(ELECTRIC_PUMP_LV) + .inputItems(CustomTags.LV_CIRCUITS, 2) + .circuitMeta(1) + .outputItems(FLUID_REGULATOR_LV) + .EUt(VA[LV]) + .duration(400) + .save(provider); ASSEMBLER_RECIPES.recipeBuilder("fluid_regulator_mv") - .inputItems(ELECTRIC_PUMP_MV) - .inputItems(CustomTags.MV_CIRCUITS, 2) - .circuitMeta(1) - .outputItems(FLUID_REGULATOR_MV) - .EUt(VA[MV]) - .duration(350) - .save(provider); + .inputItems(ELECTRIC_PUMP_MV) + .inputItems(CustomTags.MV_CIRCUITS, 2) + .circuitMeta(1) + .outputItems(FLUID_REGULATOR_MV) + .EUt(VA[MV]) + .duration(350) + .save(provider); ASSEMBLER_RECIPES.recipeBuilder("fluid_regulator_hv") - .inputItems(ELECTRIC_PUMP_HV) - .inputItems(CustomTags.HV_CIRCUITS, 2) - .circuitMeta(1) - .outputItems(FLUID_REGULATOR_HV) - .EUt(VA[HV]) - .duration(300) - .save(provider); + .inputItems(ELECTRIC_PUMP_HV) + .inputItems(CustomTags.HV_CIRCUITS, 2) + .circuitMeta(1) + .outputItems(FLUID_REGULATOR_HV) + .EUt(VA[HV]) + .duration(300) + .save(provider); ASSEMBLER_RECIPES.recipeBuilder("fluid_regulator_ev") - .inputItems(ELECTRIC_PUMP_EV) - .inputItems(CustomTags.EV_CIRCUITS, 2) - .circuitMeta(1) - .outputItems(FLUID_REGULATOR_EV) - .EUt(VA[EV]) - .duration(250) - .save(provider); + .inputItems(ELECTRIC_PUMP_EV) + .inputItems(CustomTags.EV_CIRCUITS, 2) + .circuitMeta(1) + .outputItems(FLUID_REGULATOR_EV) + .EUt(VA[EV]) + .duration(250) + .save(provider); ASSEMBLER_RECIPES.recipeBuilder("fluid_regulator_iv") - .inputItems(ELECTRIC_PUMP_IV) - .inputItems(CustomTags.IV_CIRCUITS, 2) - .circuitMeta(1) - .outputItems(FLUID_REGULATOR_IV) - .EUt(VA[IV]) - .duration(200) - .save(provider); + .inputItems(ELECTRIC_PUMP_IV) + .inputItems(CustomTags.IV_CIRCUITS, 2) + .circuitMeta(1) + .outputItems(FLUID_REGULATOR_IV) + .EUt(VA[IV]) + .duration(200) + .save(provider); ASSEMBLER_RECIPES.recipeBuilder("fluid_regulator_luv") - .inputItems(ELECTRIC_PUMP_LuV) - .inputItems(CustomTags.LuV_CIRCUITS, 2) - .circuitMeta(1) - .outputItems(FLUID_REGULATOR_LUV) - .EUt(VA[LuV]) - .duration(150) - .save(provider); + .inputItems(ELECTRIC_PUMP_LuV) + .inputItems(CustomTags.LuV_CIRCUITS, 2) + .circuitMeta(1) + .outputItems(FLUID_REGULATOR_LUV) + .EUt(VA[LuV]) + .duration(150) + .save(provider); ASSEMBLER_RECIPES.recipeBuilder("fluid_regulator_zpm") - .inputItems(ELECTRIC_PUMP_ZPM) - .inputItems(CustomTags.ZPM_CIRCUITS, 2) - .circuitMeta(1) - .outputItems(FLUID_REGULATOR_ZPM) - .EUt(VA[ZPM]) - .duration(100) - .save(provider); + .inputItems(ELECTRIC_PUMP_ZPM) + .inputItems(CustomTags.ZPM_CIRCUITS, 2) + .circuitMeta(1) + .outputItems(FLUID_REGULATOR_ZPM) + .EUt(VA[ZPM]) + .duration(100) + .save(provider); ASSEMBLER_RECIPES.recipeBuilder("fluid_regulator_uv") - .inputItems(ELECTRIC_PUMP_UV) - .inputItems(CustomTags.UV_CIRCUITS, 2) - .circuitMeta(1) - .outputItems(FLUID_REGULATOR_UV) - .EUt(VA[UV]) - .duration(50) - .save(provider); + .inputItems(ELECTRIC_PUMP_UV) + .inputItems(CustomTags.UV_CIRCUITS, 2) + .circuitMeta(1) + .outputItems(FLUID_REGULATOR_UV) + .EUt(VA[UV]) + .duration(50) + .save(provider); - //Voiding Covers Start----------------------------------------------------------------------------------------- + // Voiding Covers Start----------------------------------------------------------------------------------------- - VanillaRecipeHelper.addShapedRecipe(provider, true, "cover_item_voiding", COVER_ITEM_VOIDING.asStack(), "SDS", "dPw", " E ", 'S', new UnificationEntry(screw, Steel), 'D', COVER_ITEM_DETECTOR.asStack(), 'P', new UnificationEntry(pipeNormalItem, Brass), 'E', Items.ENDER_PEARL); + VanillaRecipeHelper.addShapedRecipe(provider, true, "cover_item_voiding", COVER_ITEM_VOIDING.asStack(), "SDS", + "dPw", " E ", 'S', new UnificationEntry(screw, Steel), 'D', COVER_ITEM_DETECTOR.asStack(), 'P', + new UnificationEntry(pipeNormalItem, Brass), 'E', Items.ENDER_PEARL); ASSEMBLER_RECIPES.recipeBuilder("cover_item_voiding") - .inputItems(screw, Steel, 2) - .inputItems(COVER_ITEM_DETECTOR) - .inputItems(pipeNormalItem, Brass) - .inputItems(Items.ENDER_PEARL) - .outputItems(COVER_ITEM_VOIDING) - .duration(100).EUt(VA[LV]).save(provider); + .inputItems(screw, Steel, 2) + .inputItems(COVER_ITEM_DETECTOR) + .inputItems(pipeNormalItem, Brass) + .inputItems(Items.ENDER_PEARL) + .outputItems(COVER_ITEM_VOIDING) + .duration(100).EUt(VA[LV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("cover_item_voiding_advanced") - .inputItems(COVER_ITEM_VOIDING) - .inputItems(CustomTags.MV_CIRCUITS, 1) - .outputItems(COVER_ITEM_VOIDING_ADVANCED) - .duration(100).EUt(VA[LV]).save(provider); + .inputItems(COVER_ITEM_VOIDING) + .inputItems(CustomTags.MV_CIRCUITS, 1) + .outputItems(COVER_ITEM_VOIDING_ADVANCED) + .duration(100).EUt(VA[LV]).save(provider); - VanillaRecipeHelper.addShapedRecipe(provider, true, "cover_fluid_voiding", COVER_FLUID_VOIDING.asStack(), "SDS", "dPw", " E ", 'S', new UnificationEntry(screw, Steel), 'D', COVER_FLUID_DETECTOR.asStack(), 'P', new UnificationEntry(pipeNormalFluid, Bronze), 'E', Items.ENDER_PEARL); + VanillaRecipeHelper.addShapedRecipe(provider, true, "cover_fluid_voiding", COVER_FLUID_VOIDING.asStack(), "SDS", + "dPw", " E ", 'S', new UnificationEntry(screw, Steel), 'D', COVER_FLUID_DETECTOR.asStack(), 'P', + new UnificationEntry(pipeNormalFluid, Bronze), 'E', Items.ENDER_PEARL); ASSEMBLER_RECIPES.recipeBuilder("cover_fluid_voiding") - .inputItems(screw, Steel, 2) - .inputItems(COVER_FLUID_DETECTOR) - .inputItems(pipeNormalFluid, Bronze) - .inputItems(Items.ENDER_PEARL) - .outputItems(COVER_FLUID_VOIDING) - .duration(100).EUt(VA[LV]).save(provider); + .inputItems(screw, Steel, 2) + .inputItems(COVER_FLUID_DETECTOR) + .inputItems(pipeNormalFluid, Bronze) + .inputItems(Items.ENDER_PEARL) + .outputItems(COVER_FLUID_VOIDING) + .duration(100).EUt(VA[LV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("cover_fluid_voiding_advanced") - .inputItems(COVER_FLUID_VOIDING) - .inputItems(CustomTags.MV_CIRCUITS, 1) - .outputItems(COVER_FLUID_VOIDING_ADVANCED) - .duration(100).EUt(VA[LV]).save(provider); - - //Pistons Start------------------------------------------------------------------------------------------------- - VanillaRecipeHelper.addShapedRecipe(provider, true, "electric_piston_lv", ELECTRIC_PISTON_LV.asStack(), "PPP", "CRR", "CMG", 'P', new UnificationEntry(plate, Steel), 'C', new UnificationEntry(cableGtSingle, Tin), 'R', new UnificationEntry(rod, Steel), 'G', new UnificationEntry(gearSmall, Steel), 'M', ELECTRIC_MOTOR_LV.asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, true, "electric_piston_mv", ELECTRIC_PISTON_MV.asStack(), "PPP", "CRR", "CMG", 'P', new UnificationEntry(plate, Aluminium), 'C', new UnificationEntry(cableGtSingle, Copper), 'R', new UnificationEntry(rod, Aluminium), 'G', new UnificationEntry(gearSmall, Aluminium), 'M', ELECTRIC_MOTOR_MV.asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, true, "electric_piston_hv", ELECTRIC_PISTON_HV.asStack(), "PPP", "CRR", "CMG", 'P', new UnificationEntry(plate, StainlessSteel), 'C', new UnificationEntry(cableGtSingle, Gold), 'R', new UnificationEntry(rod, StainlessSteel), 'G', new UnificationEntry(gearSmall, StainlessSteel), 'M', ELECTRIC_MOTOR_HV.asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, true, "electric_piston_ev", ELECTRIC_PISTON_EV.asStack(), "PPP", "CRR", "CMG", 'P', new UnificationEntry(plate, Titanium), 'C', new UnificationEntry(cableGtSingle, Aluminium), 'R', new UnificationEntry(rod, Titanium), 'G', new UnificationEntry(gearSmall, Titanium), 'M', ELECTRIC_MOTOR_EV.asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, true, "electric_piston_iv", ELECTRIC_PISTON_IV.asStack(), "PPP", "CRR", "CMG", 'P', new UnificationEntry(plate, TungstenSteel), 'C', new UnificationEntry(cableGtSingle, Tungsten), 'R', new UnificationEntry(rod, TungstenSteel), 'G', new UnificationEntry(gearSmall, TungstenSteel), 'M', ELECTRIC_MOTOR_IV.asStack()); + .inputItems(COVER_FLUID_VOIDING) + .inputItems(CustomTags.MV_CIRCUITS, 1) + .outputItems(COVER_FLUID_VOIDING_ADVANCED) + .duration(100).EUt(VA[LV]).save(provider); + + // Pistons + // Start------------------------------------------------------------------------------------------------- + VanillaRecipeHelper.addShapedRecipe(provider, true, "electric_piston_lv", ELECTRIC_PISTON_LV.asStack(), "PPP", + "CRR", "CMG", 'P', new UnificationEntry(plate, Steel), 'C', new UnificationEntry(cableGtSingle, Tin), + 'R', new UnificationEntry(rod, Steel), 'G', new UnificationEntry(gearSmall, Steel), 'M', + ELECTRIC_MOTOR_LV.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, true, "electric_piston_mv", ELECTRIC_PISTON_MV.asStack(), "PPP", + "CRR", "CMG", 'P', new UnificationEntry(plate, Aluminium), 'C', + new UnificationEntry(cableGtSingle, Copper), 'R', new UnificationEntry(rod, Aluminium), 'G', + new UnificationEntry(gearSmall, Aluminium), 'M', ELECTRIC_MOTOR_MV.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, true, "electric_piston_hv", ELECTRIC_PISTON_HV.asStack(), "PPP", + "CRR", "CMG", 'P', new UnificationEntry(plate, StainlessSteel), 'C', + new UnificationEntry(cableGtSingle, Gold), 'R', new UnificationEntry(rod, StainlessSteel), 'G', + new UnificationEntry(gearSmall, StainlessSteel), 'M', ELECTRIC_MOTOR_HV.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, true, "electric_piston_ev", ELECTRIC_PISTON_EV.asStack(), "PPP", + "CRR", "CMG", 'P', new UnificationEntry(plate, Titanium), 'C', + new UnificationEntry(cableGtSingle, Aluminium), 'R', new UnificationEntry(rod, Titanium), 'G', + new UnificationEntry(gearSmall, Titanium), 'M', ELECTRIC_MOTOR_EV.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, true, "electric_piston_iv", ELECTRIC_PISTON_IV.asStack(), "PPP", + "CRR", "CMG", 'P', new UnificationEntry(plate, TungstenSteel), 'C', + new UnificationEntry(cableGtSingle, Tungsten), 'R', new UnificationEntry(rod, TungstenSteel), 'G', + new UnificationEntry(gearSmall, TungstenSteel), 'M', ELECTRIC_MOTOR_IV.asStack()); ASSEMBLER_RECIPES.recipeBuilder("electric_piston_lv") - .inputItems(rod, Steel, 2) - .inputItems(cableGtSingle, Tin, 2) - .inputItems(plate, Steel, 3) - .inputItems(gearSmall, Steel) - .inputItems(ELECTRIC_MOTOR_LV) - .outputItems(ELECTRIC_PISTON_LV) - .duration(100).EUt(VA[LV]).save(provider); + .inputItems(rod, Steel, 2) + .inputItems(cableGtSingle, Tin, 2) + .inputItems(plate, Steel, 3) + .inputItems(gearSmall, Steel) + .inputItems(ELECTRIC_MOTOR_LV) + .outputItems(ELECTRIC_PISTON_LV) + .duration(100).EUt(VA[LV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("electric_piston_mv") - .inputItems(rod, Aluminium, 2) - .inputItems(cableGtSingle, Copper, 2) - .inputItems(plate, Aluminium, 3) - .inputItems(gearSmall, Aluminium) - .inputItems(ELECTRIC_MOTOR_MV) - .outputItems(ELECTRIC_PISTON_MV) - .duration(100).EUt(VA[LV]).save(provider); + .inputItems(rod, Aluminium, 2) + .inputItems(cableGtSingle, Copper, 2) + .inputItems(plate, Aluminium, 3) + .inputItems(gearSmall, Aluminium) + .inputItems(ELECTRIC_MOTOR_MV) + .outputItems(ELECTRIC_PISTON_MV) + .duration(100).EUt(VA[LV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("electric_piston_hv") - .inputItems(rod, StainlessSteel, 2) - .inputItems(cableGtSingle, Gold, 2) - .inputItems(plate, StainlessSteel, 3) - .inputItems(gearSmall, StainlessSteel) - .inputItems(ELECTRIC_MOTOR_HV) - .outputItems(ELECTRIC_PISTON_HV) - .duration(100).EUt(VA[LV]).save(provider); + .inputItems(rod, StainlessSteel, 2) + .inputItems(cableGtSingle, Gold, 2) + .inputItems(plate, StainlessSteel, 3) + .inputItems(gearSmall, StainlessSteel) + .inputItems(ELECTRIC_MOTOR_HV) + .outputItems(ELECTRIC_PISTON_HV) + .duration(100).EUt(VA[LV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("electric_piston_ev") - .inputItems(rod, Titanium, 2) - .inputItems(cableGtSingle, Aluminium, 2) - .inputItems(plate, Titanium, 3) - .inputItems(gearSmall, Titanium) - .inputItems(ELECTRIC_MOTOR_EV) - .outputItems(ELECTRIC_PISTON_EV) - .duration(100).EUt(VA[LV]).save(provider); + .inputItems(rod, Titanium, 2) + .inputItems(cableGtSingle, Aluminium, 2) + .inputItems(plate, Titanium, 3) + .inputItems(gearSmall, Titanium) + .inputItems(ELECTRIC_MOTOR_EV) + .outputItems(ELECTRIC_PISTON_EV) + .duration(100).EUt(VA[LV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("electric_piston_iv") - .inputItems(rod, TungstenSteel, 2) - .inputItems(cableGtSingle, Tungsten, 2) - .inputItems(plate, TungstenSteel, 3) - .inputItems(gearSmall, TungstenSteel) - .inputItems(ELECTRIC_MOTOR_IV) - .outputItems(ELECTRIC_PISTON_IV) - .duration(100).EUt(VA[LV]).save(provider); - + .inputItems(rod, TungstenSteel, 2) + .inputItems(cableGtSingle, Tungsten, 2) + .inputItems(plate, TungstenSteel, 3) + .inputItems(gearSmall, TungstenSteel) + .inputItems(ELECTRIC_MOTOR_IV) + .outputItems(ELECTRIC_PISTON_IV) + .duration(100).EUt(VA[LV]).save(provider); ASSEMBLY_LINE_RECIPES.recipeBuilder("electric_piston_luv") - .inputItems(ELECTRIC_MOTOR_LuV) - .inputItems(plate, HSSS, 4) - .inputItems(ring, HSSS, 4) - .inputItems(round, HSSS, 16) - .inputItems(rod, HSSS, 4) - .inputItems(gear, HSSS) - .inputItems(gearSmall, HSSS, 2) - .inputItems(cableGtSingle, NiobiumTitanium, 2) - .inputFluids(SolderingAlloy.getFluid(L)) - .inputFluids(Lubricant.getFluid(250)) - .outputItems(ELECTRIC_PISTON_LUV) - .duration(600).EUt(6000).save(provider); + .inputItems(ELECTRIC_MOTOR_LuV) + .inputItems(plate, HSSS, 4) + .inputItems(ring, HSSS, 4) + .inputItems(round, HSSS, 16) + .inputItems(rod, HSSS, 4) + .inputItems(gear, HSSS) + .inputItems(gearSmall, HSSS, 2) + .inputItems(cableGtSingle, NiobiumTitanium, 2) + .inputFluids(SolderingAlloy.getFluid(L)) + .inputFluids(Lubricant.getFluid(250)) + .outputItems(ELECTRIC_PISTON_LUV) + .duration(600).EUt(6000).save(provider); ASSEMBLY_LINE_RECIPES.recipeBuilder("electric_piston_zpm") - .inputItems(ELECTRIC_MOTOR_ZPM) - .inputItems(plate, Osmiridium, 4) - .inputItems(ring, Osmiridium, 4) - .inputItems(round, Osmiridium, 16) - .inputItems(rod, Osmiridium, 4) - .inputItems(gear, Osmiridium) - .inputItems(gearSmall, Osmiridium, 2) - .inputItems(cableGtSingle, VanadiumGallium, 2) - .inputFluids(SolderingAlloy.getFluid(L * 2)) - .inputFluids(Lubricant.getFluid(500)) - .outputItems(ELECTRIC_PISTON_ZPM) - .scannerResearch(b -> b - .researchStack(ELECTRIC_PISTON_LUV.asStack()) - .duration(1200) - .EUt(VA[IV])) - .duration(600).EUt(24000).save(provider); + .inputItems(ELECTRIC_MOTOR_ZPM) + .inputItems(plate, Osmiridium, 4) + .inputItems(ring, Osmiridium, 4) + .inputItems(round, Osmiridium, 16) + .inputItems(rod, Osmiridium, 4) + .inputItems(gear, Osmiridium) + .inputItems(gearSmall, Osmiridium, 2) + .inputItems(cableGtSingle, VanadiumGallium, 2) + .inputFluids(SolderingAlloy.getFluid(L * 2)) + .inputFluids(Lubricant.getFluid(500)) + .outputItems(ELECTRIC_PISTON_ZPM) + .scannerResearch(b -> b + .researchStack(ELECTRIC_PISTON_LUV.asStack()) + .duration(1200) + .EUt(VA[IV])) + .duration(600).EUt(24000).save(provider); ASSEMBLY_LINE_RECIPES.recipeBuilder("electric_piston_uv") - .inputItems(ELECTRIC_MOTOR_UV) - .inputItems(plate, Tritanium, 4) - .inputItems(ring, Tritanium, 4) - .inputItems(round, Tritanium, 16) - .inputItems(rod, Tritanium, 4) - .inputItems(gear, NaquadahAlloy) - .inputItems(gearSmall, NaquadahAlloy, 2) - .inputItems(cableGtSingle, YttriumBariumCuprate, 2) - .inputFluids(SolderingAlloy.getFluid(L * 4)) - .inputFluids(Lubricant.getFluid(1000)) - .inputFluids(Naquadria.getFluid(L * 4)) - .outputItems(ELECTRIC_PISTON_UV) - .stationResearch(b -> b - .researchStack(ELECTRIC_PISTON_ZPM.asStack()) - .CWUt(32) - .EUt(VA[ZPM])) - .duration(600).EUt(100000).save(provider); - - - - //Robot Arms Start --------------------------------------------------------------------------------------------- - VanillaRecipeHelper.addShapedRecipe(provider, true, "robot_arm_lv", ROBOT_ARM_LV.asStack(), "CCC", "MRM", "PXR", 'C', new UnificationEntry(cableGtSingle, Tin), 'R', new UnificationEntry(rod, Steel), 'M', ELECTRIC_MOTOR_LV.asStack(), 'P', ELECTRIC_PISTON_LV.asStack(), 'X', CustomTags.LV_CIRCUITS); - VanillaRecipeHelper.addShapedRecipe(provider, true, "robot_arm_mv", ROBOT_ARM_MV.asStack(), "CCC", "MRM", "PXR", 'C', new UnificationEntry(cableGtSingle, Copper), 'R', new UnificationEntry(rod, Aluminium), 'M', ELECTRIC_MOTOR_MV.asStack(), 'P', ELECTRIC_PISTON_MV.asStack(), 'X', CustomTags.MV_CIRCUITS); - VanillaRecipeHelper.addShapedRecipe(provider, true, "robot_arm_hv", ROBOT_ARM_HV.asStack(), "CCC", "MRM", "PXR", 'C', new UnificationEntry(cableGtSingle, Gold), 'R', new UnificationEntry(rod, StainlessSteel), 'M', ELECTRIC_MOTOR_HV.asStack(), 'P', ELECTRIC_PISTON_HV.asStack(), 'X', CustomTags.HV_CIRCUITS); - VanillaRecipeHelper.addShapedRecipe(provider, true, "robot_arm_ev", ROBOT_ARM_EV.asStack(), "CCC", "MRM", "PXR", 'C', new UnificationEntry(cableGtSingle, Aluminium), 'R', new UnificationEntry(rod, Titanium), 'M', ELECTRIC_MOTOR_EV.asStack(), 'P', ELECTRIC_PISTON_EV.asStack(), 'X', CustomTags.EV_CIRCUITS); - VanillaRecipeHelper.addShapedRecipe(provider, true, "robot_arm_iv", ROBOT_ARM_IV.asStack(), "CCC", "MRM", "PXR", 'C', new UnificationEntry(cableGtSingle, Tungsten), 'R', new UnificationEntry(rod, TungstenSteel), 'M', ELECTRIC_MOTOR_IV.asStack(), 'P', ELECTRIC_PISTON_IV.asStack(), 'X', CustomTags.IV_CIRCUITS); + .inputItems(ELECTRIC_MOTOR_UV) + .inputItems(plate, Tritanium, 4) + .inputItems(ring, Tritanium, 4) + .inputItems(round, Tritanium, 16) + .inputItems(rod, Tritanium, 4) + .inputItems(gear, NaquadahAlloy) + .inputItems(gearSmall, NaquadahAlloy, 2) + .inputItems(cableGtSingle, YttriumBariumCuprate, 2) + .inputFluids(SolderingAlloy.getFluid(L * 4)) + .inputFluids(Lubricant.getFluid(1000)) + .inputFluids(Naquadria.getFluid(L * 4)) + .outputItems(ELECTRIC_PISTON_UV) + .stationResearch(b -> b + .researchStack(ELECTRIC_PISTON_ZPM.asStack()) + .CWUt(32) + .EUt(VA[ZPM])) + .duration(600).EUt(100000).save(provider); + + // Robot Arms Start + // --------------------------------------------------------------------------------------------- + VanillaRecipeHelper.addShapedRecipe(provider, true, "robot_arm_lv", ROBOT_ARM_LV.asStack(), "CCC", "MRM", "PXR", + 'C', new UnificationEntry(cableGtSingle, Tin), 'R', new UnificationEntry(rod, Steel), 'M', + ELECTRIC_MOTOR_LV.asStack(), 'P', ELECTRIC_PISTON_LV.asStack(), 'X', CustomTags.LV_CIRCUITS); + VanillaRecipeHelper.addShapedRecipe(provider, true, "robot_arm_mv", ROBOT_ARM_MV.asStack(), "CCC", "MRM", "PXR", + 'C', new UnificationEntry(cableGtSingle, Copper), 'R', new UnificationEntry(rod, Aluminium), 'M', + ELECTRIC_MOTOR_MV.asStack(), 'P', ELECTRIC_PISTON_MV.asStack(), 'X', CustomTags.MV_CIRCUITS); + VanillaRecipeHelper.addShapedRecipe(provider, true, "robot_arm_hv", ROBOT_ARM_HV.asStack(), "CCC", "MRM", "PXR", + 'C', new UnificationEntry(cableGtSingle, Gold), 'R', new UnificationEntry(rod, StainlessSteel), 'M', + ELECTRIC_MOTOR_HV.asStack(), 'P', ELECTRIC_PISTON_HV.asStack(), 'X', CustomTags.HV_CIRCUITS); + VanillaRecipeHelper.addShapedRecipe(provider, true, "robot_arm_ev", ROBOT_ARM_EV.asStack(), "CCC", "MRM", "PXR", + 'C', new UnificationEntry(cableGtSingle, Aluminium), 'R', new UnificationEntry(rod, Titanium), 'M', + ELECTRIC_MOTOR_EV.asStack(), 'P', ELECTRIC_PISTON_EV.asStack(), 'X', CustomTags.EV_CIRCUITS); + VanillaRecipeHelper.addShapedRecipe(provider, true, "robot_arm_iv", ROBOT_ARM_IV.asStack(), "CCC", "MRM", "PXR", + 'C', new UnificationEntry(cableGtSingle, Tungsten), 'R', new UnificationEntry(rod, TungstenSteel), 'M', + ELECTRIC_MOTOR_IV.asStack(), 'P', ELECTRIC_PISTON_IV.asStack(), 'X', CustomTags.IV_CIRCUITS); ASSEMBLER_RECIPES.recipeBuilder("robot_arm_lv") - .inputItems(cableGtSingle, Tin, 3) - .inputItems(rod, Steel, 2) - .inputItems(ELECTRIC_MOTOR_LV, 2) - .inputItems(ELECTRIC_PISTON_LV) - .inputItems(CustomTags.LV_CIRCUITS) - .outputItems(ROBOT_ARM_LV) - .duration(100).EUt(VA[LV]).save(provider); + .inputItems(cableGtSingle, Tin, 3) + .inputItems(rod, Steel, 2) + .inputItems(ELECTRIC_MOTOR_LV, 2) + .inputItems(ELECTRIC_PISTON_LV) + .inputItems(CustomTags.LV_CIRCUITS) + .outputItems(ROBOT_ARM_LV) + .duration(100).EUt(VA[LV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("robot_arm_mv") - .inputItems(cableGtSingle, Copper, 3) - .inputItems(rod, Aluminium, 2) - .inputItems(ELECTRIC_MOTOR_MV, 2) - .inputItems(ELECTRIC_PISTON_MV) - .inputItems(CustomTags.MV_CIRCUITS) - .outputItems(ROBOT_ARM_MV) - .duration(100).EUt(VA[LV]).save(provider); + .inputItems(cableGtSingle, Copper, 3) + .inputItems(rod, Aluminium, 2) + .inputItems(ELECTRIC_MOTOR_MV, 2) + .inputItems(ELECTRIC_PISTON_MV) + .inputItems(CustomTags.MV_CIRCUITS) + .outputItems(ROBOT_ARM_MV) + .duration(100).EUt(VA[LV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("robot_arm_hv") - .inputItems(cableGtSingle, Gold, 3) - .inputItems(rod, StainlessSteel, 2) - .inputItems(ELECTRIC_MOTOR_HV, 2) - .inputItems(ELECTRIC_PISTON_HV) - .inputItems(CustomTags.HV_CIRCUITS) - .outputItems(ROBOT_ARM_HV) - .duration(100).EUt(VA[LV]).save(provider); + .inputItems(cableGtSingle, Gold, 3) + .inputItems(rod, StainlessSteel, 2) + .inputItems(ELECTRIC_MOTOR_HV, 2) + .inputItems(ELECTRIC_PISTON_HV) + .inputItems(CustomTags.HV_CIRCUITS) + .outputItems(ROBOT_ARM_HV) + .duration(100).EUt(VA[LV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("robot_arm_ev") - .inputItems(cableGtSingle, Aluminium, 3) - .inputItems(rod, Titanium, 2) - .inputItems(ELECTRIC_MOTOR_EV, 2) - .inputItems(ELECTRIC_PISTON_EV) - .inputItems(CustomTags.EV_CIRCUITS) - .outputItems(ROBOT_ARM_EV) - .duration(100).EUt(VA[LV]).save(provider); + .inputItems(cableGtSingle, Aluminium, 3) + .inputItems(rod, Titanium, 2) + .inputItems(ELECTRIC_MOTOR_EV, 2) + .inputItems(ELECTRIC_PISTON_EV) + .inputItems(CustomTags.EV_CIRCUITS) + .outputItems(ROBOT_ARM_EV) + .duration(100).EUt(VA[LV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("robot_arm_iv") - .inputItems(cableGtSingle, Tungsten, 3) - .inputItems(rod, TungstenSteel, 2) - .inputItems(ELECTRIC_MOTOR_IV, 2) - .inputItems(ELECTRIC_PISTON_IV) - .inputItems(CustomTags.IV_CIRCUITS) - .outputItems(ROBOT_ARM_IV) - .duration(100).EUt(VA[LV]).save(provider); + .inputItems(cableGtSingle, Tungsten, 3) + .inputItems(rod, TungstenSteel, 2) + .inputItems(ELECTRIC_MOTOR_IV, 2) + .inputItems(ELECTRIC_PISTON_IV) + .inputItems(CustomTags.IV_CIRCUITS) + .outputItems(ROBOT_ARM_IV) + .duration(100).EUt(VA[LV]).save(provider); ASSEMBLY_LINE_RECIPES.recipeBuilder("robot_arm_luv") - .inputItems(rodLong, HSSS, 4) - .inputItems(gear, HSSS) - .inputItems(gearSmall, HSSS, 3) - .inputItems(ELECTRIC_MOTOR_LuV, 2) - .inputItems(ELECTRIC_PISTON_LUV) - .inputItems(CustomTags.LuV_CIRCUITS) - .inputItems(CustomTags.IV_CIRCUITS, 2) - .inputItems(CustomTags.EV_CIRCUITS, 4) - .inputItems(cableGtSingle, NiobiumTitanium, 4) - .inputFluids(SolderingAlloy.getFluid(L * 4)) - .inputFluids(Lubricant.getFluid(250)) - .outputItems(ROBOT_ARM_LuV) - .duration(600).EUt(6000).save(provider); + .inputItems(rodLong, HSSS, 4) + .inputItems(gear, HSSS) + .inputItems(gearSmall, HSSS, 3) + .inputItems(ELECTRIC_MOTOR_LuV, 2) + .inputItems(ELECTRIC_PISTON_LUV) + .inputItems(CustomTags.LuV_CIRCUITS) + .inputItems(CustomTags.IV_CIRCUITS, 2) + .inputItems(CustomTags.EV_CIRCUITS, 4) + .inputItems(cableGtSingle, NiobiumTitanium, 4) + .inputFluids(SolderingAlloy.getFluid(L * 4)) + .inputFluids(Lubricant.getFluid(250)) + .outputItems(ROBOT_ARM_LuV) + .duration(600).EUt(6000).save(provider); ASSEMBLY_LINE_RECIPES.recipeBuilder("robot_arm_zpm") - .inputItems(rodLong, Osmiridium, 4) - .inputItems(gear, Osmiridium) - .inputItems(gearSmall, Osmiridium, 3) - .inputItems(ELECTRIC_MOTOR_ZPM, 2) - .inputItems(ELECTRIC_PISTON_ZPM) - .inputItems(CustomTags.ZPM_CIRCUITS) - .inputItems(CustomTags.LuV_CIRCUITS, 2) - .inputItems(CustomTags.IV_CIRCUITS, 4) - .inputItems(cableGtSingle, VanadiumGallium, 4) - .inputFluids(SolderingAlloy.getFluid(L * 8)) - .inputFluids(Lubricant.getFluid(500)) - .outputItems(ROBOT_ARM_ZPM) - .scannerResearch(b -> b - .researchStack(ROBOT_ARM_LuV.asStack()) - .duration(1200) - .EUt(VA[IV])) - .duration(600).EUt(24000).save(provider); + .inputItems(rodLong, Osmiridium, 4) + .inputItems(gear, Osmiridium) + .inputItems(gearSmall, Osmiridium, 3) + .inputItems(ELECTRIC_MOTOR_ZPM, 2) + .inputItems(ELECTRIC_PISTON_ZPM) + .inputItems(CustomTags.ZPM_CIRCUITS) + .inputItems(CustomTags.LuV_CIRCUITS, 2) + .inputItems(CustomTags.IV_CIRCUITS, 4) + .inputItems(cableGtSingle, VanadiumGallium, 4) + .inputFluids(SolderingAlloy.getFluid(L * 8)) + .inputFluids(Lubricant.getFluid(500)) + .outputItems(ROBOT_ARM_ZPM) + .scannerResearch(b -> b + .researchStack(ROBOT_ARM_LuV.asStack()) + .duration(1200) + .EUt(VA[IV])) + .duration(600).EUt(24000).save(provider); ASSEMBLY_LINE_RECIPES.recipeBuilder("robot_arm_uv") - .inputItems(rodLong, Tritanium, 4) - .inputItems(gear, Tritanium) - .inputItems(gearSmall, Tritanium, 3) - .inputItems(ELECTRIC_MOTOR_UV, 2) - .inputItems(ELECTRIC_PISTON_UV) - .inputItems(CustomTags.UV_CIRCUITS) - .inputItems(CustomTags.ZPM_CIRCUITS, 2) - .inputItems(CustomTags.LuV_CIRCUITS, 4) - .inputItems(cableGtSingle, YttriumBariumCuprate, 4) - .inputFluids(SolderingAlloy.getFluid(L * 12)) - .inputFluids(Lubricant.getFluid(1000)) - .inputFluids(Naquadria.getFluid(L * 4)) - .outputItems(ROBOT_ARM_UV) - .stationResearch(b -> b - .researchStack(ROBOT_ARM_ZPM.asStack()) - .CWUt(32) - .EUt(VA[ZPM])) - .duration(600).EUt(100000).save(provider); - - - - //Field Generators Start --------------------------------------------------------------------------------------- - VanillaRecipeHelper.addShapedRecipe(provider, true, "field_generator_lv", FIELD_GENERATOR_LV.asStack(), "WPW", "XGX", "WPW", 'W', new UnificationEntry(wireGtQuadruple, ManganesePhosphide), 'P', new UnificationEntry(plate, Steel), 'G', new UnificationEntry(gem, EnderPearl), 'X', CustomTags.LV_CIRCUITS); - VanillaRecipeHelper.addShapedRecipe(provider, true, "field_generator_mv", FIELD_GENERATOR_MV.asStack(), "WPW", "XGX", "WPW", 'W', new UnificationEntry(wireGtQuadruple, MagnesiumDiboride), 'P', new UnificationEntry(plate, Aluminium), 'G', new UnificationEntry(gem, EnderEye), 'X', CustomTags.MV_CIRCUITS); - VanillaRecipeHelper.addShapedRecipe(provider, true, "field_generator_hv", FIELD_GENERATOR_HV.asStack(), "WPW", "XGX", "WPW", 'W', new UnificationEntry(wireGtQuadruple, MercuryBariumCalciumCuprate), 'P', new UnificationEntry(plate, StainlessSteel), 'G', QUANTUM_EYE.asStack(), 'X', CustomTags.HV_CIRCUITS); - VanillaRecipeHelper.addShapedRecipe(provider, true, "field_generator_ev", FIELD_GENERATOR_EV.asStack(), "WPW", "XGX", "WPW", 'W', new UnificationEntry(wireGtQuadruple, UraniumTriplatinum), 'P', new UnificationEntry(plateDouble, Titanium), 'G', new UnificationEntry(gem, NetherStar), 'X', CustomTags.EV_CIRCUITS); - VanillaRecipeHelper.addShapedRecipe(provider, true, "field_generator_iv", FIELD_GENERATOR_IV.asStack(), "WPW", "XGX", "WPW", 'W', new UnificationEntry(wireGtQuadruple, SamariumIronArsenicOxide), 'P', new UnificationEntry(plateDouble, TungstenSteel), 'G', QUANTUM_STAR.asStack(), 'X', CustomTags.IV_CIRCUITS); + .inputItems(rodLong, Tritanium, 4) + .inputItems(gear, Tritanium) + .inputItems(gearSmall, Tritanium, 3) + .inputItems(ELECTRIC_MOTOR_UV, 2) + .inputItems(ELECTRIC_PISTON_UV) + .inputItems(CustomTags.UV_CIRCUITS) + .inputItems(CustomTags.ZPM_CIRCUITS, 2) + .inputItems(CustomTags.LuV_CIRCUITS, 4) + .inputItems(cableGtSingle, YttriumBariumCuprate, 4) + .inputFluids(SolderingAlloy.getFluid(L * 12)) + .inputFluids(Lubricant.getFluid(1000)) + .inputFluids(Naquadria.getFluid(L * 4)) + .outputItems(ROBOT_ARM_UV) + .stationResearch(b -> b + .researchStack(ROBOT_ARM_ZPM.asStack()) + .CWUt(32) + .EUt(VA[ZPM])) + .duration(600).EUt(100000).save(provider); + + // Field Generators Start + // --------------------------------------------------------------------------------------- + VanillaRecipeHelper.addShapedRecipe(provider, true, "field_generator_lv", FIELD_GENERATOR_LV.asStack(), "WPW", + "XGX", "WPW", 'W', new UnificationEntry(wireGtQuadruple, ManganesePhosphide), 'P', + new UnificationEntry(plate, Steel), 'G', new UnificationEntry(gem, EnderPearl), 'X', + CustomTags.LV_CIRCUITS); + VanillaRecipeHelper.addShapedRecipe(provider, true, "field_generator_mv", FIELD_GENERATOR_MV.asStack(), "WPW", + "XGX", "WPW", 'W', new UnificationEntry(wireGtQuadruple, MagnesiumDiboride), 'P', + new UnificationEntry(plate, Aluminium), 'G', new UnificationEntry(gem, EnderEye), 'X', + CustomTags.MV_CIRCUITS); + VanillaRecipeHelper.addShapedRecipe(provider, true, "field_generator_hv", FIELD_GENERATOR_HV.asStack(), "WPW", + "XGX", "WPW", 'W', new UnificationEntry(wireGtQuadruple, MercuryBariumCalciumCuprate), 'P', + new UnificationEntry(plate, StainlessSteel), 'G', QUANTUM_EYE.asStack(), 'X', CustomTags.HV_CIRCUITS); + VanillaRecipeHelper.addShapedRecipe(provider, true, "field_generator_ev", FIELD_GENERATOR_EV.asStack(), "WPW", + "XGX", "WPW", 'W', new UnificationEntry(wireGtQuadruple, UraniumTriplatinum), 'P', + new UnificationEntry(plateDouble, Titanium), 'G', new UnificationEntry(gem, NetherStar), 'X', + CustomTags.EV_CIRCUITS); + VanillaRecipeHelper.addShapedRecipe(provider, true, "field_generator_iv", FIELD_GENERATOR_IV.asStack(), "WPW", + "XGX", "WPW", 'W', new UnificationEntry(wireGtQuadruple, SamariumIronArsenicOxide), 'P', + new UnificationEntry(plateDouble, TungstenSteel), 'G', QUANTUM_STAR.asStack(), 'X', + CustomTags.IV_CIRCUITS); ASSEMBLER_RECIPES.recipeBuilder("field_generator_lv") - .inputItems(gem, EnderPearl) - .inputItems(plate, Steel, 2) - .inputItems(CustomTags.LV_CIRCUITS, 2) - .inputItems(wireGtQuadruple, ManganesePhosphide, 4) - .outputItems(FIELD_GENERATOR_LV) - .duration(100).EUt(VA[LV]).save(provider); + .inputItems(gem, EnderPearl) + .inputItems(plate, Steel, 2) + .inputItems(CustomTags.LV_CIRCUITS, 2) + .inputItems(wireGtQuadruple, ManganesePhosphide, 4) + .outputItems(FIELD_GENERATOR_LV) + .duration(100).EUt(VA[LV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("field_generator_mv") - .inputItems(gem, EnderEye) - .inputItems(plate, Aluminium, 2) - .inputItems(CustomTags.MV_CIRCUITS, 2) - .inputItems(wireGtQuadruple, MagnesiumDiboride, 4) - .outputItems(FIELD_GENERATOR_MV) - .duration(100).EUt(VA[LV]).save(provider); + .inputItems(gem, EnderEye) + .inputItems(plate, Aluminium, 2) + .inputItems(CustomTags.MV_CIRCUITS, 2) + .inputItems(wireGtQuadruple, MagnesiumDiboride, 4) + .outputItems(FIELD_GENERATOR_MV) + .duration(100).EUt(VA[LV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("field_generator_hv") - .inputItems(QUANTUM_EYE) - .inputItems(plate, StainlessSteel, 2) - .inputItems(CustomTags.HV_CIRCUITS, 2) - .inputItems(wireGtQuadruple, MercuryBariumCalciumCuprate, 4) - .outputItems(FIELD_GENERATOR_HV) - .duration(100).EUt(VA[LV]).save(provider); + .inputItems(QUANTUM_EYE) + .inputItems(plate, StainlessSteel, 2) + .inputItems(CustomTags.HV_CIRCUITS, 2) + .inputItems(wireGtQuadruple, MercuryBariumCalciumCuprate, 4) + .outputItems(FIELD_GENERATOR_HV) + .duration(100).EUt(VA[LV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("field_generator_ev") - .inputItems(gem, NetherStar) - .inputItems(plateDouble, Titanium, 2) - .inputItems(CustomTags.EV_CIRCUITS, 2) - .inputItems(wireGtQuadruple, UraniumTriplatinum, 4) - .outputItems(FIELD_GENERATOR_EV) - .duration(100).EUt(VA[LV]).save(provider); + .inputItems(gem, NetherStar) + .inputItems(plateDouble, Titanium, 2) + .inputItems(CustomTags.EV_CIRCUITS, 2) + .inputItems(wireGtQuadruple, UraniumTriplatinum, 4) + .outputItems(FIELD_GENERATOR_EV) + .duration(100).EUt(VA[LV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("field_generator_iv") - .inputItems(QUANTUM_STAR) - .inputItems(plateDouble, TungstenSteel, 2) - .inputItems(CustomTags.IV_CIRCUITS, 2) - .inputItems(wireGtQuadruple, SamariumIronArsenicOxide, 4) - .outputItems(FIELD_GENERATOR_IV) - .duration(100).EUt(VA[LV]).save(provider); + .inputItems(QUANTUM_STAR) + .inputItems(plateDouble, TungstenSteel, 2) + .inputItems(CustomTags.IV_CIRCUITS, 2) + .inputItems(wireGtQuadruple, SamariumIronArsenicOxide, 4) + .outputItems(FIELD_GENERATOR_IV) + .duration(100).EUt(VA[LV]).save(provider); ASSEMBLY_LINE_RECIPES.recipeBuilder("field_generator_luv") - .inputItems(frameGt, HSSS) - .inputItems(plate, HSSS, 6) - .inputItems(QUANTUM_STAR) - .inputItems(EMITTER_LuV, 2) - .inputItems(CustomTags.LuV_CIRCUITS, 2) - .inputItems(wireFine, IndiumTinBariumTitaniumCuprate, 64) - .inputItems(wireFine, IndiumTinBariumTitaniumCuprate, 64) - .inputItems(cableGtSingle, NiobiumTitanium, 4) - .inputFluids(SolderingAlloy.getFluid(L * 4)) - .outputItems(FIELD_GENERATOR_LuV) - .scannerResearch(b -> b - .researchStack(FIELD_GENERATOR_IV.asStack()) - .duration(2400)) - .duration(600).EUt(6000).save(provider); + .inputItems(frameGt, HSSS) + .inputItems(plate, HSSS, 6) + .inputItems(QUANTUM_STAR) + .inputItems(EMITTER_LuV, 2) + .inputItems(CustomTags.LuV_CIRCUITS, 2) + .inputItems(wireFine, IndiumTinBariumTitaniumCuprate, 64) + .inputItems(wireFine, IndiumTinBariumTitaniumCuprate, 64) + .inputItems(cableGtSingle, NiobiumTitanium, 4) + .inputFluids(SolderingAlloy.getFluid(L * 4)) + .outputItems(FIELD_GENERATOR_LuV) + .scannerResearch(b -> b + .researchStack(FIELD_GENERATOR_IV.asStack()) + .duration(2400)) + .duration(600).EUt(6000).save(provider); ASSEMBLY_LINE_RECIPES.recipeBuilder("field_generator_zpm") - .inputItems(frameGt, NaquadahAlloy) - .inputItems(plate, NaquadahAlloy, 6) - .inputItems(QUANTUM_STAR) - .inputItems(EMITTER_ZPM, 2) - .inputItems(CustomTags.ZPM_CIRCUITS, 2) - .inputItems(wireFine, UraniumRhodiumDinaquadide, 64) - .inputItems(wireFine, UraniumRhodiumDinaquadide, 64) - .inputItems(cableGtSingle, VanadiumGallium, 4) - .inputFluids(SolderingAlloy.getFluid(L * 8)) - .outputItems(FIELD_GENERATOR_ZPM) - .stationResearch(b -> b - .researchStack(FIELD_GENERATOR_LuV.asStack()) - .CWUt(4)) - .duration(600).EUt(24000).save(provider); + .inputItems(frameGt, NaquadahAlloy) + .inputItems(plate, NaquadahAlloy, 6) + .inputItems(QUANTUM_STAR) + .inputItems(EMITTER_ZPM, 2) + .inputItems(CustomTags.ZPM_CIRCUITS, 2) + .inputItems(wireFine, UraniumRhodiumDinaquadide, 64) + .inputItems(wireFine, UraniumRhodiumDinaquadide, 64) + .inputItems(cableGtSingle, VanadiumGallium, 4) + .inputFluids(SolderingAlloy.getFluid(L * 8)) + .outputItems(FIELD_GENERATOR_ZPM) + .stationResearch(b -> b + .researchStack(FIELD_GENERATOR_LuV.asStack()) + .CWUt(4)) + .duration(600).EUt(24000).save(provider); ASSEMBLY_LINE_RECIPES.recipeBuilder("field_generator_uv") - .inputItems(frameGt, Tritanium) - .inputItems(plate, Tritanium, 6) - .inputItems(GRAVI_STAR) - .inputItems(EMITTER_UV, 2) - .inputItems(CustomTags.UV_CIRCUITS, 2) - .inputItems(wireFine, EnrichedNaquadahTriniumEuropiumDuranide, 64) - .inputItems(wireFine, EnrichedNaquadahTriniumEuropiumDuranide, 64) - .inputItems(cableGtSingle, YttriumBariumCuprate, 4) - .inputFluids(SolderingAlloy.getFluid(L * 12)) - .inputFluids(Naquadria.getFluid(L * 4)) - .outputItems(FIELD_GENERATOR_UV) - .stationResearch(b -> b - .researchStack(FIELD_GENERATOR_ZPM.asStack()) - .CWUt(48) - .EUt(VA[ZPM])) - .duration(600).EUt(100000).save(provider); - - - - //Sensors Start------------------------------------------------------------------------------------------------- - VanillaRecipeHelper.addShapedRecipe(provider, true, "sensor_lv", SENSOR_LV.asStack(), "P G", "PR ", "XPP", 'P', new UnificationEntry(plate, Steel), 'R', new UnificationEntry(rod, Brass), 'G', new UnificationEntry(gem, Quartzite), 'X', CustomTags.LV_CIRCUITS); - VanillaRecipeHelper.addShapedRecipe(provider, true, "sensor_mv", SENSOR_MV.asStack(), "P G", "PR ", "XPP", 'P', new UnificationEntry(plate, Aluminium), 'R', new UnificationEntry(rod, Electrum), 'G', new UnificationEntry(gemFlawless, Emerald), 'X', CustomTags.MV_CIRCUITS); - VanillaRecipeHelper.addShapedRecipe(provider, true, "sensor_hv", SENSOR_HV.asStack(), "P G", "PR ", "XPP", 'P', new UnificationEntry(plate, StainlessSteel), 'R', new UnificationEntry(rod, Chromium), 'G', new UnificationEntry(gem, EnderEye), 'X', CustomTags.HV_CIRCUITS); - VanillaRecipeHelper.addShapedRecipe(provider, true, "sensor_ev", SENSOR_EV.asStack(), "P G", "PR ", "XPP", 'P', new UnificationEntry(plate, Titanium), 'R', new UnificationEntry(rod, Platinum), 'G', QUANTUM_EYE.asStack(), 'X', CustomTags.EV_CIRCUITS); - VanillaRecipeHelper.addShapedRecipe(provider, true, "sensor_iv", SENSOR_IV.asStack(), "P G", "PR ", "XPP", 'P', new UnificationEntry(plate, TungstenSteel), 'R', new UnificationEntry(rod, Iridium), 'G', QUANTUM_STAR.asStack(), 'X', CustomTags.IV_CIRCUITS); + .inputItems(frameGt, Tritanium) + .inputItems(plate, Tritanium, 6) + .inputItems(GRAVI_STAR) + .inputItems(EMITTER_UV, 2) + .inputItems(CustomTags.UV_CIRCUITS, 2) + .inputItems(wireFine, EnrichedNaquadahTriniumEuropiumDuranide, 64) + .inputItems(wireFine, EnrichedNaquadahTriniumEuropiumDuranide, 64) + .inputItems(cableGtSingle, YttriumBariumCuprate, 4) + .inputFluids(SolderingAlloy.getFluid(L * 12)) + .inputFluids(Naquadria.getFluid(L * 4)) + .outputItems(FIELD_GENERATOR_UV) + .stationResearch(b -> b + .researchStack(FIELD_GENERATOR_ZPM.asStack()) + .CWUt(48) + .EUt(VA[ZPM])) + .duration(600).EUt(100000).save(provider); + + // Sensors + // Start------------------------------------------------------------------------------------------------- + VanillaRecipeHelper.addShapedRecipe(provider, true, "sensor_lv", SENSOR_LV.asStack(), "P G", "PR ", "XPP", 'P', + new UnificationEntry(plate, Steel), 'R', new UnificationEntry(rod, Brass), 'G', + new UnificationEntry(gem, Quartzite), 'X', CustomTags.LV_CIRCUITS); + VanillaRecipeHelper.addShapedRecipe(provider, true, "sensor_mv", SENSOR_MV.asStack(), "P G", "PR ", "XPP", 'P', + new UnificationEntry(plate, Aluminium), 'R', new UnificationEntry(rod, Electrum), 'G', + new UnificationEntry(gemFlawless, Emerald), 'X', CustomTags.MV_CIRCUITS); + VanillaRecipeHelper.addShapedRecipe(provider, true, "sensor_hv", SENSOR_HV.asStack(), "P G", "PR ", "XPP", 'P', + new UnificationEntry(plate, StainlessSteel), 'R', new UnificationEntry(rod, Chromium), 'G', + new UnificationEntry(gem, EnderEye), 'X', CustomTags.HV_CIRCUITS); + VanillaRecipeHelper.addShapedRecipe(provider, true, "sensor_ev", SENSOR_EV.asStack(), "P G", "PR ", "XPP", 'P', + new UnificationEntry(plate, Titanium), 'R', new UnificationEntry(rod, Platinum), 'G', + QUANTUM_EYE.asStack(), 'X', CustomTags.EV_CIRCUITS); + VanillaRecipeHelper.addShapedRecipe(provider, true, "sensor_iv", SENSOR_IV.asStack(), "P G", "PR ", "XPP", 'P', + new UnificationEntry(plate, TungstenSteel), 'R', new UnificationEntry(rod, Iridium), 'G', + QUANTUM_STAR.asStack(), 'X', CustomTags.IV_CIRCUITS); ASSEMBLER_RECIPES.recipeBuilder("sensor_lv") - .inputItems(rod, Brass) - .inputItems(plate, Steel, 4) - .inputItems(CustomTags.LV_CIRCUITS) - .inputItems(gem, Quartzite) - .outputItems(SENSOR_LV) - .duration(100).EUt(VA[LV]).save(provider); + .inputItems(rod, Brass) + .inputItems(plate, Steel, 4) + .inputItems(CustomTags.LV_CIRCUITS) + .inputItems(gem, Quartzite) + .outputItems(SENSOR_LV) + .duration(100).EUt(VA[LV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("sensor_mv") - .inputItems(rod, Electrum) - .inputItems(plate, Aluminium, 4) - .inputItems(CustomTags.MV_CIRCUITS) - .inputItems(gemFlawless, Emerald) - .outputItems(SENSOR_MV) - .duration(100).EUt(VA[LV]).save(provider); + .inputItems(rod, Electrum) + .inputItems(plate, Aluminium, 4) + .inputItems(CustomTags.MV_CIRCUITS) + .inputItems(gemFlawless, Emerald) + .outputItems(SENSOR_MV) + .duration(100).EUt(VA[LV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("sensor_hv") - .inputItems(rod, Chromium) - .inputItems(plate, StainlessSteel, 4) - .inputItems(CustomTags.HV_CIRCUITS) - .inputItems(gem, EnderEye) - .outputItems(SENSOR_HV) - .duration(100).EUt(VA[LV]).save(provider); + .inputItems(rod, Chromium) + .inputItems(plate, StainlessSteel, 4) + .inputItems(CustomTags.HV_CIRCUITS) + .inputItems(gem, EnderEye) + .outputItems(SENSOR_HV) + .duration(100).EUt(VA[LV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("sensor_ev") - .inputItems(rod, Platinum) - .inputItems(plate, Titanium, 4) - .inputItems(CustomTags.EV_CIRCUITS) - .inputItems(QUANTUM_EYE) - .outputItems(SENSOR_EV) - .duration(100).EUt(VA[LV]).save(provider); + .inputItems(rod, Platinum) + .inputItems(plate, Titanium, 4) + .inputItems(CustomTags.EV_CIRCUITS) + .inputItems(QUANTUM_EYE) + .outputItems(SENSOR_EV) + .duration(100).EUt(VA[LV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("sensor_iv") - .inputItems(rod, Iridium) - .inputItems(plate, TungstenSteel, 4) - .inputItems(CustomTags.IV_CIRCUITS) - .inputItems(QUANTUM_STAR) - .outputItems(SENSOR_IV) - .duration(100).EUt(VA[LV]).save(provider); + .inputItems(rod, Iridium) + .inputItems(plate, TungstenSteel, 4) + .inputItems(CustomTags.IV_CIRCUITS) + .inputItems(QUANTUM_STAR) + .outputItems(SENSOR_IV) + .duration(100).EUt(VA[LV]).save(provider); ASSEMBLY_LINE_RECIPES.recipeBuilder("sensor_luv") - .inputItems(frameGt, HSSS) - .inputItems(ELECTRIC_MOTOR_LuV) - .inputItems(plate, Ruridit, 4) - .inputItems(QUANTUM_STAR) - .inputItems(CustomTags.LuV_CIRCUITS, 2) - .inputItems(foil, Palladium, 64) - .inputItems(foil, Palladium, 32) - .inputItems(cableGtSingle, NiobiumTitanium, 4) - .inputFluids(SolderingAlloy.getFluid(L * 2)) - .outputItems(SENSOR_LuV) - .scannerResearch(b -> b - .researchStack(SENSOR_IV.asStack()) - .duration(2400)) - .duration(600).EUt(6000).save(provider); + .inputItems(frameGt, HSSS) + .inputItems(ELECTRIC_MOTOR_LuV) + .inputItems(plate, Ruridit, 4) + .inputItems(QUANTUM_STAR) + .inputItems(CustomTags.LuV_CIRCUITS, 2) + .inputItems(foil, Palladium, 64) + .inputItems(foil, Palladium, 32) + .inputItems(cableGtSingle, NiobiumTitanium, 4) + .inputFluids(SolderingAlloy.getFluid(L * 2)) + .outputItems(SENSOR_LuV) + .scannerResearch(b -> b + .researchStack(SENSOR_IV.asStack()) + .duration(2400)) + .duration(600).EUt(6000).save(provider); ASSEMBLY_LINE_RECIPES.recipeBuilder("sensor_zpm") - .inputItems(frameGt, NaquadahAlloy) - .inputItems(ELECTRIC_MOTOR_ZPM) - .inputItems(plate, Osmiridium, 4) - .inputItems(QUANTUM_STAR, 2) - .inputItems(CustomTags.ZPM_CIRCUITS, 2) - .inputItems(foil, Trinium, 64) - .inputItems(foil, Trinium, 32) - .inputItems(cableGtSingle, VanadiumGallium, 4) - .inputFluids(SolderingAlloy.getFluid(L * 4)) - .outputItems(SENSOR_ZPM) - .stationResearch(b -> b - .researchStack(SENSOR_LuV.asStack()) - .CWUt(4)) - .duration(600).EUt(24000).save(provider); + .inputItems(frameGt, NaquadahAlloy) + .inputItems(ELECTRIC_MOTOR_ZPM) + .inputItems(plate, Osmiridium, 4) + .inputItems(QUANTUM_STAR, 2) + .inputItems(CustomTags.ZPM_CIRCUITS, 2) + .inputItems(foil, Trinium, 64) + .inputItems(foil, Trinium, 32) + .inputItems(cableGtSingle, VanadiumGallium, 4) + .inputFluids(SolderingAlloy.getFluid(L * 4)) + .outputItems(SENSOR_ZPM) + .stationResearch(b -> b + .researchStack(SENSOR_LuV.asStack()) + .CWUt(4)) + .duration(600).EUt(24000).save(provider); ASSEMBLY_LINE_RECIPES.recipeBuilder("sensor_uv") - .inputItems(frameGt, Tritanium) - .inputItems(ELECTRIC_MOTOR_UV) - .inputItems(plate, Tritanium, 4) - .inputItems(GRAVI_STAR) - .inputItems(CustomTags.UV_CIRCUITS, 2) - .inputItems(foil, Naquadria, 64) - .inputItems(foil, Naquadria, 32) - .inputItems(cableGtSingle, YttriumBariumCuprate, 4) - .inputFluids(SolderingAlloy.getFluid(L * 8)) - .inputFluids(Naquadria.getFluid(L * 4)) - .outputItems(SENSOR_UV) - .stationResearch(b -> b - .researchStack(SENSOR_ZPM.asStack()) - .CWUt(48) - .EUt(VA[ZPM])) - .duration(600).EUt(100000).save(provider); - - - //Emitters Start------------------------------------------------------------------------------------------------ - VanillaRecipeHelper.addShapedRecipe(provider, true, "emitter_lv", EMITTER_LV.asStack(), "CRX", "RGR", "XRC", 'R', new UnificationEntry(rod, Brass), 'C', new UnificationEntry(cableGtSingle, Tin), 'G', new UnificationEntry(gem, Quartzite), 'X', CustomTags.LV_CIRCUITS); - VanillaRecipeHelper.addShapedRecipe(provider, true, "emitter_mv", EMITTER_MV.asStack(), "CRX", "RGR", "XRC", 'R', new UnificationEntry(rod, Electrum), 'C', new UnificationEntry(cableGtSingle, Copper), 'G', new UnificationEntry(gemFlawless, Emerald), 'X', CustomTags.MV_CIRCUITS); - VanillaRecipeHelper.addShapedRecipe(provider, true, "emitter_hv", EMITTER_HV.asStack(), "CRX", "RGR", "XRC", 'R', new UnificationEntry(rod, Chromium), 'C', new UnificationEntry(cableGtSingle, Gold), 'G', new UnificationEntry(gem, EnderEye), 'X', CustomTags.HV_CIRCUITS); - VanillaRecipeHelper.addShapedRecipe(provider, true, "emitter_ev", EMITTER_EV.asStack(), "CRX", "RGR", "XRC", 'R', new UnificationEntry(rod, Platinum), 'C', new UnificationEntry(cableGtSingle, Aluminium), 'G', QUANTUM_EYE.asStack(), 'X', CustomTags.EV_CIRCUITS); - VanillaRecipeHelper.addShapedRecipe(provider, true, "emitter_iv", EMITTER_IV.asStack(), "CRX", "RGR", "XRC", 'R', new UnificationEntry(rod, Iridium), 'C', new UnificationEntry(cableGtSingle, Tungsten), 'G', QUANTUM_STAR.asStack(), 'X', CustomTags.IV_CIRCUITS); + .inputItems(frameGt, Tritanium) + .inputItems(ELECTRIC_MOTOR_UV) + .inputItems(plate, Tritanium, 4) + .inputItems(GRAVI_STAR) + .inputItems(CustomTags.UV_CIRCUITS, 2) + .inputItems(foil, Naquadria, 64) + .inputItems(foil, Naquadria, 32) + .inputItems(cableGtSingle, YttriumBariumCuprate, 4) + .inputFluids(SolderingAlloy.getFluid(L * 8)) + .inputFluids(Naquadria.getFluid(L * 4)) + .outputItems(SENSOR_UV) + .stationResearch(b -> b + .researchStack(SENSOR_ZPM.asStack()) + .CWUt(48) + .EUt(VA[ZPM])) + .duration(600).EUt(100000).save(provider); + + // Emitters + // Start------------------------------------------------------------------------------------------------ + VanillaRecipeHelper.addShapedRecipe(provider, true, "emitter_lv", EMITTER_LV.asStack(), "CRX", "RGR", "XRC", + 'R', new UnificationEntry(rod, Brass), 'C', new UnificationEntry(cableGtSingle, Tin), 'G', + new UnificationEntry(gem, Quartzite), 'X', CustomTags.LV_CIRCUITS); + VanillaRecipeHelper.addShapedRecipe(provider, true, "emitter_mv", EMITTER_MV.asStack(), "CRX", "RGR", "XRC", + 'R', new UnificationEntry(rod, Electrum), 'C', new UnificationEntry(cableGtSingle, Copper), 'G', + new UnificationEntry(gemFlawless, Emerald), 'X', CustomTags.MV_CIRCUITS); + VanillaRecipeHelper.addShapedRecipe(provider, true, "emitter_hv", EMITTER_HV.asStack(), "CRX", "RGR", "XRC", + 'R', new UnificationEntry(rod, Chromium), 'C', new UnificationEntry(cableGtSingle, Gold), 'G', + new UnificationEntry(gem, EnderEye), 'X', CustomTags.HV_CIRCUITS); + VanillaRecipeHelper.addShapedRecipe(provider, true, "emitter_ev", EMITTER_EV.asStack(), "CRX", "RGR", "XRC", + 'R', new UnificationEntry(rod, Platinum), 'C', new UnificationEntry(cableGtSingle, Aluminium), 'G', + QUANTUM_EYE.asStack(), 'X', CustomTags.EV_CIRCUITS); + VanillaRecipeHelper.addShapedRecipe(provider, true, "emitter_iv", EMITTER_IV.asStack(), "CRX", "RGR", "XRC", + 'R', new UnificationEntry(rod, Iridium), 'C', new UnificationEntry(cableGtSingle, Tungsten), 'G', + QUANTUM_STAR.asStack(), 'X', CustomTags.IV_CIRCUITS); ASSEMBLER_RECIPES.recipeBuilder("emitter_lv") - .inputItems(rod, Brass, 4) - .inputItems(cableGtSingle, Tin, 2) - .inputItems(CustomTags.LV_CIRCUITS, 2) - .inputItems(gem, Quartzite) - .circuitMeta(1) - .outputItems(EMITTER_LV) - .duration(100).EUt(VA[LV]).save(provider); + .inputItems(rod, Brass, 4) + .inputItems(cableGtSingle, Tin, 2) + .inputItems(CustomTags.LV_CIRCUITS, 2) + .inputItems(gem, Quartzite) + .circuitMeta(1) + .outputItems(EMITTER_LV) + .duration(100).EUt(VA[LV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("emitter_mv") - .inputItems(rod, Electrum, 4) - .inputItems(cableGtSingle, Copper, 2) - .inputItems(CustomTags.MV_CIRCUITS, 2) - .inputItems(gemFlawless, Emerald) - .circuitMeta(1) - .outputItems(EMITTER_MV) - .duration(100).EUt(VA[LV]).save(provider); + .inputItems(rod, Electrum, 4) + .inputItems(cableGtSingle, Copper, 2) + .inputItems(CustomTags.MV_CIRCUITS, 2) + .inputItems(gemFlawless, Emerald) + .circuitMeta(1) + .outputItems(EMITTER_MV) + .duration(100).EUt(VA[LV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("emitter_hv") - .inputItems(rod, Chromium, 4) - .inputItems(cableGtSingle, Gold, 2) - .inputItems(CustomTags.HV_CIRCUITS, 2) - .inputItems(gem, EnderEye) - .circuitMeta(1) - .outputItems(EMITTER_HV) - .duration(100).EUt(VA[LV]).save(provider); + .inputItems(rod, Chromium, 4) + .inputItems(cableGtSingle, Gold, 2) + .inputItems(CustomTags.HV_CIRCUITS, 2) + .inputItems(gem, EnderEye) + .circuitMeta(1) + .outputItems(EMITTER_HV) + .duration(100).EUt(VA[LV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("emitter_ev") - .inputItems(rod, Platinum, 4) - .inputItems(cableGtSingle, Aluminium, 2) - .inputItems(CustomTags.EV_CIRCUITS, 2) - .inputItems(QUANTUM_EYE) - .circuitMeta(1) - .outputItems(EMITTER_EV) - .duration(100).EUt(VA[LV]).save(provider); + .inputItems(rod, Platinum, 4) + .inputItems(cableGtSingle, Aluminium, 2) + .inputItems(CustomTags.EV_CIRCUITS, 2) + .inputItems(QUANTUM_EYE) + .circuitMeta(1) + .outputItems(EMITTER_EV) + .duration(100).EUt(VA[LV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("emitter_iv") - .inputItems(rod, Iridium, 4) - .inputItems(cableGtSingle, Tungsten, 2) - .inputItems(CustomTags.IV_CIRCUITS, 2) - .inputItems(QUANTUM_STAR) - .circuitMeta(1) - .outputItems(EMITTER_IV) - .duration(100).EUt(VA[LV]).save(provider); + .inputItems(rod, Iridium, 4) + .inputItems(cableGtSingle, Tungsten, 2) + .inputItems(CustomTags.IV_CIRCUITS, 2) + .inputItems(QUANTUM_STAR) + .circuitMeta(1) + .outputItems(EMITTER_IV) + .duration(100).EUt(VA[LV]).save(provider); ASSEMBLY_LINE_RECIPES.recipeBuilder("emitter_luv") - .inputItems(frameGt, HSSS) - .inputItems(ELECTRIC_MOTOR_LuV) - .inputItems(rodLong, Ruridit, 4) - .inputItems(QUANTUM_STAR) - .inputItems(CustomTags.LuV_CIRCUITS, 2) - .inputItems(foil, Palladium, 64) - .inputItems(foil, Palladium, 32) - .inputItems(cableGtSingle, NiobiumTitanium, 4) - .inputFluids(SolderingAlloy.getFluid(L * 2)) - .outputItems(EMITTER_LuV) - .scannerResearch(b -> b - .researchStack(EMITTER_IV.asStack()) - .duration(2400)) - .duration(600).EUt(6000).save(provider); + .inputItems(frameGt, HSSS) + .inputItems(ELECTRIC_MOTOR_LuV) + .inputItems(rodLong, Ruridit, 4) + .inputItems(QUANTUM_STAR) + .inputItems(CustomTags.LuV_CIRCUITS, 2) + .inputItems(foil, Palladium, 64) + .inputItems(foil, Palladium, 32) + .inputItems(cableGtSingle, NiobiumTitanium, 4) + .inputFluids(SolderingAlloy.getFluid(L * 2)) + .outputItems(EMITTER_LuV) + .scannerResearch(b -> b + .researchStack(EMITTER_IV.asStack()) + .duration(2400)) + .duration(600).EUt(6000).save(provider); ASSEMBLY_LINE_RECIPES.recipeBuilder("emitter_zpm") - .inputItems(frameGt, NaquadahAlloy) - .inputItems(ELECTRIC_MOTOR_ZPM) - .inputItems(rodLong, Osmiridium, 4) - .inputItems(QUANTUM_STAR, 2) - .inputItems(CustomTags.ZPM_CIRCUITS, 2) - .inputItems(foil, Trinium, 64) - .inputItems(foil, Trinium, 32) - .inputItems(cableGtSingle, VanadiumGallium, 4) - .inputFluids(SolderingAlloy.getFluid(L * 4)) - .outputItems(EMITTER_ZPM) - .stationResearch(b -> b - .researchStack(EMITTER_LuV.asStack()) - .CWUt(8)) - .duration(600).EUt(24000).save(provider); + .inputItems(frameGt, NaquadahAlloy) + .inputItems(ELECTRIC_MOTOR_ZPM) + .inputItems(rodLong, Osmiridium, 4) + .inputItems(QUANTUM_STAR, 2) + .inputItems(CustomTags.ZPM_CIRCUITS, 2) + .inputItems(foil, Trinium, 64) + .inputItems(foil, Trinium, 32) + .inputItems(cableGtSingle, VanadiumGallium, 4) + .inputFluids(SolderingAlloy.getFluid(L * 4)) + .outputItems(EMITTER_ZPM) + .stationResearch(b -> b + .researchStack(EMITTER_LuV.asStack()) + .CWUt(8)) + .duration(600).EUt(24000).save(provider); ASSEMBLY_LINE_RECIPES.recipeBuilder("emitter_uv") - .inputItems(frameGt, Tritanium) - .inputItems(ELECTRIC_MOTOR_UV) - .inputItems(rodLong, Tritanium, 4) - .inputItems(GRAVI_STAR) - .inputItems(CustomTags.UV_CIRCUITS, 2) - .inputItems(foil, Naquadria, 64) - .inputItems(foil, Naquadria, 32) - .inputItems(cableGtSingle, YttriumBariumCuprate, 4) - .inputFluids(SolderingAlloy.getFluid(L * 8)) - .inputFluids(Naquadria.getFluid(L * 4)) - .outputItems(EMITTER_UV) - .stationResearch(b -> b - .researchStack(EMITTER_ZPM.asStack()) - .CWUt(48) - .EUt(VA[ZPM])) - .duration(600).EUt(100000).save(provider); + .inputItems(frameGt, Tritanium) + .inputItems(ELECTRIC_MOTOR_UV) + .inputItems(rodLong, Tritanium, 4) + .inputItems(GRAVI_STAR) + .inputItems(CustomTags.UV_CIRCUITS, 2) + .inputItems(foil, Naquadria, 64) + .inputItems(foil, Naquadria, 32) + .inputItems(cableGtSingle, YttriumBariumCuprate, 4) + .inputFluids(SolderingAlloy.getFluid(L * 8)) + .inputFluids(Naquadria.getFluid(L * 4)) + .outputItems(EMITTER_UV) + .stationResearch(b -> b + .researchStack(EMITTER_ZPM.asStack()) + .CWUt(48) + .EUt(VA[ZPM])) + .duration(600).EUt(100000).save(provider); } } diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/ComposterRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/ComposterRecipes.java index c3d7723a95..3068adf750 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/ComposterRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/ComposterRecipes.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.data.recipe.misc; import com.gregtechceu.gtceu.common.data.GTBlocks; + import net.minecraft.world.level.ItemLike; import java.util.function.BiConsumer; diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/ComputerRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/ComputerRecipes.java index d4bd44fa59..bbef2f22a2 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/ComputerRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/ComputerRecipes.java @@ -3,6 +3,7 @@ import com.gregtechceu.gtceu.api.machine.multiblock.CleanroomType; import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.data.recipe.CustomTags; + import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.world.item.ItemStack; @@ -10,8 +11,8 @@ import static com.gregtechceu.gtceu.api.GTValues.*; import static com.gregtechceu.gtceu.api.data.tag.TagPrefix.*; -import static com.gregtechceu.gtceu.common.data.GTItems.*; import static com.gregtechceu.gtceu.common.data.GTBlocks.*; +import static com.gregtechceu.gtceu.common.data.GTItems.*; import static com.gregtechceu.gtceu.common.data.GTMachines.*; import static com.gregtechceu.gtceu.common.data.GTMaterials.*; import static com.gregtechceu.gtceu.common.data.GTRecipeTypes.*; @@ -21,273 +22,273 @@ public class ComputerRecipes { public static void init(Consumer provider) { ASSEMBLER_RECIPES.recipeBuilder("data_access_hatch") - .inputItems(ITEM_IMPORT_BUS[EV]) - .inputItems(TOOL_DATA_STICK, 4) - .inputItems(CustomTags.EV_CIRCUITS, 4) - .outputItems(DATA_ACCESS_HATCH) - .inputFluids(Polytetrafluoroethylene.getFluid(L * 2)) - .cleanroom(CleanroomType.CLEANROOM) - .duration(200).EUt(VA[EV]).save(provider); + .inputItems(ITEM_IMPORT_BUS[EV]) + .inputItems(TOOL_DATA_STICK, 4) + .inputItems(CustomTags.EV_CIRCUITS, 4) + .outputItems(DATA_ACCESS_HATCH) + .inputFluids(Polytetrafluoroethylene.getFluid(L * 2)) + .cleanroom(CleanroomType.CLEANROOM) + .duration(200).EUt(VA[EV]).save(provider); ASSEMBLY_LINE_RECIPES.recipeBuilder("advanced_data_access_hatch") - .inputItems(ITEM_IMPORT_BUS[LuV]) - .inputItems(TOOL_DATA_ORB, 4) - .inputItems(CustomTags.ZPM_CIRCUITS, 4) - .outputItems(ADVANCED_DATA_ACCESS_HATCH) - .inputFluids(SolderingAlloy.getFluid(L * 4)) - .inputFluids(Polybenzimidazole.getFluid(L * 4)) - .stationResearch(b -> b.researchStack(DATA_BANK.asStack()).CWUt(4)) - .duration(400).EUt(6000).save(provider); + .inputItems(ITEM_IMPORT_BUS[LuV]) + .inputItems(TOOL_DATA_ORB, 4) + .inputItems(CustomTags.ZPM_CIRCUITS, 4) + .outputItems(ADVANCED_DATA_ACCESS_HATCH) + .inputFluids(SolderingAlloy.getFluid(L * 4)) + .inputFluids(Polybenzimidazole.getFluid(L * 4)) + .stationResearch(b -> b.researchStack(DATA_BANK.asStack()).CWUt(4)) + .duration(400).EUt(6000).save(provider); ASSEMBLER_RECIPES.recipeBuilder("high_power_casing") - .inputItems(frameGt, Iridium) - .inputItems(plate, Iridium, 6) - .inputItems(CustomTags.IV_CIRCUITS) - .inputItems(wireFine, Cobalt, 16) - .inputItems(wireFine, Copper, 16) - .inputItems(wireGtSingle, NiobiumTitanium, 2) - .outputItems(HIGH_POWER_CASING, - ConfigHolder.INSTANCE.recipes.casingsPerCraft) - .duration(100).EUt(VA[IV]).save(provider); + .inputItems(frameGt, Iridium) + .inputItems(plate, Iridium, 6) + .inputItems(CustomTags.IV_CIRCUITS) + .inputItems(wireFine, Cobalt, 16) + .inputItems(wireFine, Copper, 16) + .inputItems(wireGtSingle, NiobiumTitanium, 2) + .outputItems(HIGH_POWER_CASING, + ConfigHolder.INSTANCE.recipes.casingsPerCraft) + .duration(100).EUt(VA[IV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("computer_casing") - .inputItems(frameGt, Iridium) - .inputItems(plate, Iridium, 6) - .inputItems(CustomTags.LuV_CIRCUITS) - .inputItems(wireFine, Cobalt, 32) - .inputItems(wireFine, Copper, 32) - .inputItems(wireGtSingle, VanadiumGallium, 2) - .outputItems(COMPUTER_CASING, - ConfigHolder.INSTANCE.recipes.casingsPerCraft) - .duration(200).EUt(VA[LuV]).save(provider); + .inputItems(frameGt, Iridium) + .inputItems(plate, Iridium, 6) + .inputItems(CustomTags.LuV_CIRCUITS) + .inputItems(wireFine, Cobalt, 32) + .inputItems(wireFine, Copper, 32) + .inputItems(wireGtSingle, VanadiumGallium, 2) + .outputItems(COMPUTER_CASING, + ConfigHolder.INSTANCE.recipes.casingsPerCraft) + .duration(200).EUt(VA[LuV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("advanced_computer_casing") - .inputItems(COMPUTER_CASING.asStack()) - .inputItems(CustomTags.ZPM_CIRCUITS) - .inputItems(wireFine, Cobalt, 64) - .inputItems(wireFine, Electrum, 64) - .inputItems(wireGtSingle, IndiumTinBariumTitaniumCuprate, 4) - .outputItems(ADVANCED_COMPUTER_CASING) - .duration(200).EUt(VA[LuV]).save(provider); + .inputItems(COMPUTER_CASING.asStack()) + .inputItems(CustomTags.ZPM_CIRCUITS) + .inputItems(wireFine, Cobalt, 64) + .inputItems(wireFine, Electrum, 64) + .inputItems(wireGtSingle, IndiumTinBariumTitaniumCuprate, 4) + .outputItems(ADVANCED_COMPUTER_CASING) + .duration(200).EUt(VA[LuV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("computer_heat_vent") - .inputItems(frameGt, StainlessSteel) - .inputItems(ELECTRIC_MOTOR_IV, 2) - .inputItems(rotor, StainlessSteel, 2) - .inputItems(pipeTinyFluid, StainlessSteel, 16) - .inputItems(plate, Copper, 16) - .inputItems(wireGtSingle, SamariumIronArsenicOxide) - .outputItems(COMPUTER_HEAT_VENT, - ConfigHolder.INSTANCE.recipes.casingsPerCraft) - .duration(100).EUt(VA[EV]).save(provider); + .inputItems(frameGt, StainlessSteel) + .inputItems(ELECTRIC_MOTOR_IV, 2) + .inputItems(rotor, StainlessSteel, 2) + .inputItems(pipeTinyFluid, StainlessSteel, 16) + .inputItems(plate, Copper, 16) + .inputItems(wireGtSingle, SamariumIronArsenicOxide) + .outputItems(COMPUTER_HEAT_VENT, + ConfigHolder.INSTANCE.recipes.casingsPerCraft) + .duration(100).EUt(VA[EV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("optical_pipe") - .inputItems(wireFine, BorosilicateGlass, 8) - .inputItems(foil, Silver, 8) - .inputFluids(Polytetrafluoroethylene.getFluid(L)) - .cleanroom(CleanroomType.CLEANROOM) - .outputItems(OPTICAL_PIPES[0]) - .duration(100).EUt(VA[IV]).save(provider); + .inputItems(wireFine, BorosilicateGlass, 8) + .inputItems(foil, Silver, 8) + .inputFluids(Polytetrafluoroethylene.getFluid(L)) + .cleanroom(CleanroomType.CLEANROOM) + .outputItems(OPTICAL_PIPES[0]) + .duration(100).EUt(VA[IV]).save(provider); ASSEMBLY_LINE_RECIPES.recipeBuilder("data_bank") - .inputItems(COMPUTER_CASING.asStack()) - .inputItems(CustomTags.LuV_CIRCUITS, 8) - .inputItems(TOOL_DATA_ORB) - .inputItems(wireFine, Cobalt, 64) - .inputItems(wireFine, Copper, 64) - .inputItems(OPTICAL_PIPES[0].asStack(4)) - .inputItems(wireGtDouble, IndiumTinBariumTitaniumCuprate, 16) - .inputFluids(SolderingAlloy.getFluid(L * 2)) - .inputFluids(Lubricant.getFluid(500)) - .outputItems(DATA_BANK) - .scannerResearch(b -> b - .researchStack(DATA_ACCESS_HATCH.asStack()) - .duration(2400) - .EUt(VA[EV])) - .duration(1200).EUt(6000).save(provider); + .inputItems(COMPUTER_CASING.asStack()) + .inputItems(CustomTags.LuV_CIRCUITS, 8) + .inputItems(TOOL_DATA_ORB) + .inputItems(wireFine, Cobalt, 64) + .inputItems(wireFine, Copper, 64) + .inputItems(OPTICAL_PIPES[0].asStack(4)) + .inputItems(wireGtDouble, IndiumTinBariumTitaniumCuprate, 16) + .inputFluids(SolderingAlloy.getFluid(L * 2)) + .inputFluids(Lubricant.getFluid(500)) + .outputItems(DATA_BANK) + .scannerResearch(b -> b + .researchStack(DATA_ACCESS_HATCH.asStack()) + .duration(2400) + .EUt(VA[EV])) + .duration(1200).EUt(6000).save(provider); ASSEMBLY_LINE_RECIPES.recipeBuilder("research_station") - .inputItems(DATA_BANK) - .inputItems(SENSOR_LuV, 8) - .inputItems(CustomTags.ZPM_CIRCUITS, 8) - .inputItems(FIELD_GENERATOR_LuV, 2) - .inputItems(ELECTRIC_MOTOR_ZPM, 2) - .inputItems(wireGtDouble, UraniumRhodiumDinaquadide, 32) - .inputItems(foil, Trinium, 32) - .inputItems(OPTICAL_PIPES[0].asStack(16)) - .inputFluids(SolderingAlloy.getFluid(L * 8)) - .inputFluids(VanadiumGallium.getFluid(L * 8)) - .outputItems(RESEARCH_STATION) - .scannerResearch(b -> b - .researchStack(SCANNER[LuV].asStack()) - .duration(2400) - .EUt(VA[IV])) - .duration(1200).EUt(100000).save(provider); + .inputItems(DATA_BANK) + .inputItems(SENSOR_LuV, 8) + .inputItems(CustomTags.ZPM_CIRCUITS, 8) + .inputItems(FIELD_GENERATOR_LuV, 2) + .inputItems(ELECTRIC_MOTOR_ZPM, 2) + .inputItems(wireGtDouble, UraniumRhodiumDinaquadide, 32) + .inputItems(foil, Trinium, 32) + .inputItems(OPTICAL_PIPES[0].asStack(16)) + .inputFluids(SolderingAlloy.getFluid(L * 8)) + .inputFluids(VanadiumGallium.getFluid(L * 8)) + .outputItems(RESEARCH_STATION) + .scannerResearch(b -> b + .researchStack(SCANNER[LuV].asStack()) + .duration(2400) + .EUt(VA[IV])) + .duration(1200).EUt(100000).save(provider); ASSEMBLY_LINE_RECIPES.recipeBuilder("object_holder") - .inputItems(ITEM_IMPORT_BUS[ZPM]) - .inputItems(EMITTER_LuV, 8) - .inputItems(CustomTags.ZPM_CIRCUITS) - .inputItems(ROBOT_ARM_ZPM, 2) - .inputItems(ELECTRIC_MOTOR_ZPM, 2) - .inputItems(wireGtDouble, UraniumRhodiumDinaquadide, 16) - .inputItems(OPTICAL_PIPES[0].asStack(2)) - .inputFluids(SolderingAlloy.getFluid(L * 4)) - .inputFluids(Polybenzimidazole.getFluid(L * 2)) - .outputItems(OBJECT_HOLDER) - .scannerResearch(b -> b - .researchStack(ITEM_IMPORT_BUS[ZPM].asStack()) - .duration(2400) - .EUt(VA[IV])) - .duration(1200).EUt(100000).save(provider); + .inputItems(ITEM_IMPORT_BUS[ZPM]) + .inputItems(EMITTER_LuV, 8) + .inputItems(CustomTags.ZPM_CIRCUITS) + .inputItems(ROBOT_ARM_ZPM, 2) + .inputItems(ELECTRIC_MOTOR_ZPM, 2) + .inputItems(wireGtDouble, UraniumRhodiumDinaquadide, 16) + .inputItems(OPTICAL_PIPES[0].asStack(2)) + .inputFluids(SolderingAlloy.getFluid(L * 4)) + .inputFluids(Polybenzimidazole.getFluid(L * 2)) + .outputItems(OBJECT_HOLDER) + .scannerResearch(b -> b + .researchStack(ITEM_IMPORT_BUS[ZPM].asStack()) + .duration(2400) + .EUt(VA[IV])) + .duration(1200).EUt(100000).save(provider); ASSEMBLY_LINE_RECIPES.recipeBuilder("network_switch") - .inputItems(COMPUTER_CASING.asStack()) - .inputItems(EMITTER_ZPM, 4) - .inputItems(SENSOR_ZPM, 4) - .inputItems(CustomTags.UV_CIRCUITS, 4) - .inputItems(wireGtDouble, EnrichedNaquadahTriniumEuropiumDuranide, 32) - .inputItems(foil, Tritanium, 64) - .inputItems(foil, Tritanium, 64) - .inputItems(OPTICAL_PIPES[0].asStack(8)) - .inputFluids(SolderingAlloy.getFluid(L * 4)) - .inputFluids(Polybenzimidazole.getFluid(L * 4)) - .outputItems(NETWORK_SWITCH) - .stationResearch(b -> b - .researchStack(new ItemStack(OPTICAL_PIPES[0])) - .CWUt(32) - .EUt(VA[ZPM])) - .duration(1200).EUt(100000).save(provider); + .inputItems(COMPUTER_CASING.asStack()) + .inputItems(EMITTER_ZPM, 4) + .inputItems(SENSOR_ZPM, 4) + .inputItems(CustomTags.UV_CIRCUITS, 4) + .inputItems(wireGtDouble, EnrichedNaquadahTriniumEuropiumDuranide, 32) + .inputItems(foil, Tritanium, 64) + .inputItems(foil, Tritanium, 64) + .inputItems(OPTICAL_PIPES[0].asStack(8)) + .inputFluids(SolderingAlloy.getFluid(L * 4)) + .inputFluids(Polybenzimidazole.getFluid(L * 4)) + .outputItems(NETWORK_SWITCH) + .stationResearch(b -> b + .researchStack(new ItemStack(OPTICAL_PIPES[0])) + .CWUt(32) + .EUt(VA[ZPM])) + .duration(1200).EUt(100000).save(provider); ASSEMBLY_LINE_RECIPES.recipeBuilder("high_performance_computing_array") - .inputItems(DATA_BANK) - .inputItems(CustomTags.ZPM_CIRCUITS, 4) - .inputItems(FIELD_GENERATOR_LuV, 8) - .inputItems(TOOL_DATA_ORB) - .inputItems(COVER_SCREEN) - .inputItems(wireGtDouble, UraniumRhodiumDinaquadide, 64) - .inputItems(OPTICAL_PIPES[0].asStack(16)) - .inputFluids(SolderingAlloy.getFluid(L * 8)) - .inputFluids(VanadiumGallium.getFluid(L * 8)) - .inputFluids(PCBCoolant.getFluid(4000)) - .outputItems(HIGH_PERFORMANCE_COMPUTING_ARRAY) - .scannerResearch(b -> b - .researchStack(COVER_SCREEN.asStack()) - .duration(2400) - .EUt(VA[IV])) - .duration(1200).EUt(100000).save(provider); + .inputItems(DATA_BANK) + .inputItems(CustomTags.ZPM_CIRCUITS, 4) + .inputItems(FIELD_GENERATOR_LuV, 8) + .inputItems(TOOL_DATA_ORB) + .inputItems(COVER_SCREEN) + .inputItems(wireGtDouble, UraniumRhodiumDinaquadide, 64) + .inputItems(OPTICAL_PIPES[0].asStack(16)) + .inputFluids(SolderingAlloy.getFluid(L * 8)) + .inputFluids(VanadiumGallium.getFluid(L * 8)) + .inputFluids(PCBCoolant.getFluid(4000)) + .outputItems(HIGH_PERFORMANCE_COMPUTING_ARRAY) + .scannerResearch(b -> b + .researchStack(COVER_SCREEN.asStack()) + .duration(2400) + .EUt(VA[IV])) + .duration(1200).EUt(100000).save(provider); ASSEMBLER_RECIPES.recipeBuilder("hpca_empty_component") - .inputItems(COMPUTER_CASING.asStack()) - .inputItems(CustomTags.IV_CIRCUITS) - .inputItems(TOOL_DATA_STICK) - .outputItems(HPCA_EMPTY_COMPONENT) - .inputFluids(PCBCoolant.getFluid(1000)) - .cleanroom(CleanroomType.CLEANROOM) - .duration(200).EUt(VA[IV]).save(provider); + .inputItems(COMPUTER_CASING.asStack()) + .inputItems(CustomTags.IV_CIRCUITS) + .inputItems(TOOL_DATA_STICK) + .outputItems(HPCA_EMPTY_COMPONENT) + .inputFluids(PCBCoolant.getFluid(1000)) + .cleanroom(CleanroomType.CLEANROOM) + .duration(200).EUt(VA[IV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("hpca_heat_sink_component") - .inputItems(HPCA_EMPTY_COMPONENT) - .inputItems(plate, Aluminium, 32) - .inputItems(screw, StainlessSteel, 8) - .outputItems(HPCA_HEAT_SINK_COMPONENT) - .inputFluids(PCBCoolant.getFluid(1000)) - .cleanroom(CleanroomType.CLEANROOM) - .duration(200).EUt(VA[IV]).save(provider); + .inputItems(HPCA_EMPTY_COMPONENT) + .inputItems(plate, Aluminium, 32) + .inputItems(screw, StainlessSteel, 8) + .outputItems(HPCA_HEAT_SINK_COMPONENT) + .inputFluids(PCBCoolant.getFluid(1000)) + .cleanroom(CleanroomType.CLEANROOM) + .duration(200).EUt(VA[IV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("hpca_active_cooler_component") - .inputItems(ADVANCED_COMPUTER_CASING.asStack()) - .inputItems(plate, Aluminium, 16) - .inputItems(pipeTinyFluid, StainlessSteel, 16) - .inputItems(screw, StainlessSteel, 8) - .outputItems(HPCA_ACTIVE_COOLER_COMPONENT) - .inputFluids(PCBCoolant.getFluid(1000)) - .cleanroom(CleanroomType.CLEANROOM) - .duration(200).EUt(VA[IV]).save(provider); + .inputItems(ADVANCED_COMPUTER_CASING.asStack()) + .inputItems(plate, Aluminium, 16) + .inputItems(pipeTinyFluid, StainlessSteel, 16) + .inputItems(screw, StainlessSteel, 8) + .outputItems(HPCA_ACTIVE_COOLER_COMPONENT) + .inputFluids(PCBCoolant.getFluid(1000)) + .cleanroom(CleanroomType.CLEANROOM) + .duration(200).EUt(VA[IV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("hpca_bridge_component") - .inputItems(ADVANCED_COMPUTER_CASING.asStack()) - .inputItems(CustomTags.UV_CIRCUITS) - .inputItems(EMITTER_ZPM) - .inputItems(OPTICAL_PIPES[0].asStack(2)) - .outputItems(HPCA_BRIDGE_COMPONENT) - .inputFluids(PCBCoolant.getFluid(1000)) - .cleanroom(CleanroomType.CLEANROOM) - .duration(200).EUt(VA[LuV]).save(provider); + .inputItems(ADVANCED_COMPUTER_CASING.asStack()) + .inputItems(CustomTags.UV_CIRCUITS) + .inputItems(EMITTER_ZPM) + .inputItems(OPTICAL_PIPES[0].asStack(2)) + .outputItems(HPCA_BRIDGE_COMPONENT) + .inputFluids(PCBCoolant.getFluid(1000)) + .cleanroom(CleanroomType.CLEANROOM) + .duration(200).EUt(VA[LuV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("hpca_computation_component") - .inputItems(HPCA_EMPTY_COMPONENT) - .inputItems(CustomTags.ZPM_CIRCUITS, 4) - .inputItems(FIELD_GENERATOR_LuV) - .outputItems(HPCA_COMPUTATION_COMPONENT) - .inputFluids(PCBCoolant.getFluid(1000)) - .cleanroom(CleanroomType.CLEANROOM) - .duration(200).EUt(VA[LuV]).save(provider); + .inputItems(HPCA_EMPTY_COMPONENT) + .inputItems(CustomTags.ZPM_CIRCUITS, 4) + .inputItems(FIELD_GENERATOR_LuV) + .outputItems(HPCA_COMPUTATION_COMPONENT) + .inputFluids(PCBCoolant.getFluid(1000)) + .cleanroom(CleanroomType.CLEANROOM) + .duration(200).EUt(VA[LuV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("hpca_advanced_computation_component") - .inputItems(HPCA_COMPUTATION_COMPONENT) - .inputItems(CustomTags.UV_CIRCUITS, 4) - .inputItems(FIELD_GENERATOR_ZPM) - .outputItems(HPCA_ADVANCED_COMPUTATION_COMPONENT) - .inputFluids(PCBCoolant.getFluid(1000)) - .cleanroom(CleanroomType.CLEANROOM) - .duration(200).EUt(VA[ZPM]).save(provider); + .inputItems(HPCA_COMPUTATION_COMPONENT) + .inputItems(CustomTags.UV_CIRCUITS, 4) + .inputItems(FIELD_GENERATOR_ZPM) + .outputItems(HPCA_ADVANCED_COMPUTATION_COMPONENT) + .inputFluids(PCBCoolant.getFluid(1000)) + .cleanroom(CleanroomType.CLEANROOM) + .duration(200).EUt(VA[ZPM]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("data_receiver_hatch") - .inputItems(COMPUTER_CASING.asStack()) - .inputItems(ITEM_IMPORT_BUS[LuV]) - .inputItems(CustomTags.LuV_CIRCUITS) - .inputItems(SENSOR_IV) - .inputItems(OPTICAL_PIPES[0].asStack(2)) - .inputFluids(Polybenzimidazole.getFluid(L * 2)) - .outputItems(DATA_HATCH_RECEIVER) - .cleanroom(CleanroomType.CLEANROOM) - .duration(200).EUt(VA[LuV]).save(provider); + .inputItems(COMPUTER_CASING.asStack()) + .inputItems(ITEM_IMPORT_BUS[LuV]) + .inputItems(CustomTags.LuV_CIRCUITS) + .inputItems(SENSOR_IV) + .inputItems(OPTICAL_PIPES[0].asStack(2)) + .inputFluids(Polybenzimidazole.getFluid(L * 2)) + .outputItems(DATA_HATCH_RECEIVER) + .cleanroom(CleanroomType.CLEANROOM) + .duration(200).EUt(VA[LuV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("data_transmitter_hatch") - .inputItems(COMPUTER_CASING.asStack()) - .inputItems(ITEM_EXPORT_BUS[LuV]) - .inputItems(CustomTags.LuV_CIRCUITS) - .inputItems(EMITTER_IV) - .inputItems(OPTICAL_PIPES[0].asStack(2)) - .inputFluids(Polybenzimidazole.getFluid(L * 2)) - .outputItems(DATA_HATCH_TRANSMITTER) - .cleanroom(CleanroomType.CLEANROOM) - .duration(200).EUt(VA[LuV]).save(provider); + .inputItems(COMPUTER_CASING.asStack()) + .inputItems(ITEM_EXPORT_BUS[LuV]) + .inputItems(CustomTags.LuV_CIRCUITS) + .inputItems(EMITTER_IV) + .inputItems(OPTICAL_PIPES[0].asStack(2)) + .inputFluids(Polybenzimidazole.getFluid(L * 2)) + .outputItems(DATA_HATCH_TRANSMITTER) + .cleanroom(CleanroomType.CLEANROOM) + .duration(200).EUt(VA[LuV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("computation_receiver_hatch") - .inputItems(DATA_HATCH_RECEIVER) - .inputItems(CustomTags.ZPM_CIRCUITS) - .inputItems(SENSOR_LuV) - .inputFluids(Polybenzimidazole.getFluid(L * 2)) - .outputItems(COMPUTATION_HATCH_RECEIVER) - .cleanroom(CleanroomType.CLEANROOM) - .duration(200).EUt(VA[LuV]).save(provider); + .inputItems(DATA_HATCH_RECEIVER) + .inputItems(CustomTags.ZPM_CIRCUITS) + .inputItems(SENSOR_LuV) + .inputFluids(Polybenzimidazole.getFluid(L * 2)) + .outputItems(COMPUTATION_HATCH_RECEIVER) + .cleanroom(CleanroomType.CLEANROOM) + .duration(200).EUt(VA[LuV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("computation_transmitter_hatch") - .inputItems(DATA_HATCH_TRANSMITTER) - .inputItems(CustomTags.ZPM_CIRCUITS) - .inputItems(EMITTER_LuV) - .inputFluids(Polybenzimidazole.getFluid(L * 2)) - .outputItems(COMPUTATION_HATCH_TRANSMITTER) - .cleanroom(CleanroomType.CLEANROOM) - .duration(200).EUt(VA[LuV]).save(provider); + .inputItems(DATA_HATCH_TRANSMITTER) + .inputItems(CustomTags.ZPM_CIRCUITS) + .inputItems(EMITTER_LuV) + .inputFluids(Polybenzimidazole.getFluid(L * 2)) + .outputItems(COMPUTATION_HATCH_TRANSMITTER) + .cleanroom(CleanroomType.CLEANROOM) + .duration(200).EUt(VA[LuV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("active_transformer") - .inputItems(POWER_TRANSFORMER[LuV]) - .inputItems(CustomTags.LuV_CIRCUITS, 2) - .inputItems(wireGtSingle, IndiumTinBariumTitaniumCuprate, 8) - .inputItems(ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT, 2) - .inputFluids(PCBCoolant.getFluid(1000)) - .outputItems(ACTIVE_TRANSFORMER) - .duration(300).EUt(VA[LuV]).save(provider); + .inputItems(POWER_TRANSFORMER[LuV]) + .inputItems(CustomTags.LuV_CIRCUITS, 2) + .inputItems(wireGtSingle, IndiumTinBariumTitaniumCuprate, 8) + .inputItems(ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT, 2) + .inputFluids(PCBCoolant.getFluid(1000)) + .outputItems(ACTIVE_TRANSFORMER) + .duration(300).EUt(VA[LuV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("laser_cable") - .inputItems(CASING_LAMINATED_GLASS.asStack(1)) - .inputItems(foil, Osmiridium, 2) - .inputFluids(Polytetrafluoroethylene.getFluid(L)) - .outputItems(LASER_PIPES[0]) - .cleanroom(CleanroomType.CLEANROOM) - .duration(100).EUt(VA[IV]).save(provider); + .inputItems(CASING_LAMINATED_GLASS.asStack(1)) + .inputItems(foil, Osmiridium, 2) + .inputFluids(Polytetrafluoroethylene.getFluid(L)) + .outputItems(LASER_PIPES[0]) + .cleanroom(CleanroomType.CLEANROOM) + .duration(100).EUt(VA[IV]).save(provider); } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/CraftingRecipeLoader.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/CraftingRecipeLoader.java index 5c6b7dc21a..3490a81838 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/CraftingRecipeLoader.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/CraftingRecipeLoader.java @@ -7,6 +7,7 @@ import com.gregtechceu.gtceu.common.data.GTItems; import com.gregtechceu.gtceu.data.recipe.CustomTags; import com.gregtechceu.gtceu.data.recipe.VanillaRecipeHelper; + import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.data.recipes.SpecialRecipeBuilder; import net.minecraft.tags.ItemTags; @@ -24,160 +25,315 @@ public class CraftingRecipeLoader { public static void init(Consumer provider) { // todo facades - //registerFacadeRecipe(provider, Iron, 4); - - VanillaRecipeHelper.addShapedRecipe(provider, "small_wooden_pipe", ChemicalHelper.get(pipeSmallFluid, Wood), "sWr", 'W', ItemTags.PLANKS); - VanillaRecipeHelper.addShapedRecipe(provider, "normal_wooden_pipe", ChemicalHelper.get(pipeNormalFluid, Wood), "WWW", "s r", 'W', ItemTags.PLANKS); - VanillaRecipeHelper.addShapedRecipe(provider, "large_wooden_pipe", ChemicalHelper.get(pipeLargeFluid, Wood), "WWW", "s r", "WWW", 'W', ItemTags.PLANKS); - - VanillaRecipeHelper.addShapedRecipe(provider, "small_treated_wooden_pipe", ChemicalHelper.get(pipeSmallFluid, TreatedWood), "sWr", 'W', GTBlocks.TREATED_WOOD_PLANK.asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, "normal_treated_wooden_pipe", ChemicalHelper.get(pipeNormalFluid, TreatedWood), "WWW", "s r", 'W', GTBlocks.TREATED_WOOD_PLANK.asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, "large_treated_wooden_pipe", ChemicalHelper.get(pipeLargeFluid, TreatedWood), "WWW", "s r", "WWW", 'W', GTBlocks.TREATED_WOOD_PLANK.asStack()); - - VanillaRecipeHelper.addShapelessRecipe(provider, "integrated_circuit", INTEGRATED_CIRCUIT.asStack(), CustomTags.LV_CIRCUITS); - - VanillaRecipeHelper.addShapedRecipe(provider, "item_filter", ITEM_FILTER.asStack(), "XXX", "XYX", "XXX", 'X', new UnificationEntry(foil, Zinc), 'Y', new UnificationEntry(plate, Steel)); - VanillaRecipeHelper.addShapedRecipe(provider, "fluid_filter_lapis", FLUID_FILTER.asStack(), "XXX", "XYX", "XXX", 'X', new UnificationEntry(foil, Zinc), 'Y', new UnificationEntry(plate, Lapis)); - VanillaRecipeHelper.addShapedRecipe(provider, "fluid_filter_lazurite", FLUID_FILTER.asStack(), "XXX", "XYX", "XXX", 'X', new UnificationEntry(foil, Zinc), 'Y', new UnificationEntry(plate, Lazurite)); - VanillaRecipeHelper.addShapedRecipe(provider, "fluid_filter_sodalite", FLUID_FILTER.asStack(), "XXX", "XYX", "XXX", 'X', new UnificationEntry(foil, Zinc), 'Y', new UnificationEntry(plate, Sodalite)); - - VanillaRecipeHelper.addShapedRecipe(provider, "ore_dictionary_filter_olivine", ORE_DICTIONARY_FILTER.asStack(), "XXX", "XYX", "XXX", 'X', new UnificationEntry(foil, Zinc), 'Y', new UnificationEntry(plate, Olivine)); - VanillaRecipeHelper.addShapedRecipe(provider, "ore_dictionary_filter_emerald", ORE_DICTIONARY_FILTER.asStack(), "XXX", "XYX", "XXX", 'X', new UnificationEntry(foil, Zinc), 'Y', new UnificationEntry(plate, Emerald)); + // registerFacadeRecipe(provider, Iron, 4); + + VanillaRecipeHelper.addShapedRecipe(provider, "small_wooden_pipe", ChemicalHelper.get(pipeSmallFluid, Wood), + "sWr", 'W', ItemTags.PLANKS); + VanillaRecipeHelper.addShapedRecipe(provider, "normal_wooden_pipe", ChemicalHelper.get(pipeNormalFluid, Wood), + "WWW", "s r", 'W', ItemTags.PLANKS); + VanillaRecipeHelper.addShapedRecipe(provider, "large_wooden_pipe", ChemicalHelper.get(pipeLargeFluid, Wood), + "WWW", "s r", "WWW", 'W', ItemTags.PLANKS); + + VanillaRecipeHelper.addShapedRecipe(provider, "small_treated_wooden_pipe", + ChemicalHelper.get(pipeSmallFluid, TreatedWood), "sWr", 'W', GTBlocks.TREATED_WOOD_PLANK.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, "normal_treated_wooden_pipe", + ChemicalHelper.get(pipeNormalFluid, TreatedWood), "WWW", "s r", 'W', + GTBlocks.TREATED_WOOD_PLANK.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, "large_treated_wooden_pipe", + ChemicalHelper.get(pipeLargeFluid, TreatedWood), "WWW", "s r", "WWW", 'W', + GTBlocks.TREATED_WOOD_PLANK.asStack()); + + VanillaRecipeHelper.addShapelessRecipe(provider, "integrated_circuit", INTEGRATED_CIRCUIT.asStack(), + CustomTags.LV_CIRCUITS); + + VanillaRecipeHelper.addShapedRecipe(provider, "item_filter", ITEM_FILTER.asStack(), "XXX", "XYX", "XXX", 'X', + new UnificationEntry(foil, Zinc), 'Y', new UnificationEntry(plate, Steel)); + VanillaRecipeHelper.addShapedRecipe(provider, "fluid_filter_lapis", FLUID_FILTER.asStack(), "XXX", "XYX", "XXX", + 'X', new UnificationEntry(foil, Zinc), 'Y', new UnificationEntry(plate, Lapis)); + VanillaRecipeHelper.addShapedRecipe(provider, "fluid_filter_lazurite", FLUID_FILTER.asStack(), "XXX", "XYX", + "XXX", 'X', new UnificationEntry(foil, Zinc), 'Y', new UnificationEntry(plate, Lazurite)); + VanillaRecipeHelper.addShapedRecipe(provider, "fluid_filter_sodalite", FLUID_FILTER.asStack(), "XXX", "XYX", + "XXX", 'X', new UnificationEntry(foil, Zinc), 'Y', new UnificationEntry(plate, Sodalite)); + + VanillaRecipeHelper.addShapedRecipe(provider, "ore_dictionary_filter_olivine", ORE_DICTIONARY_FILTER.asStack(), + "XXX", "XYX", "XXX", 'X', new UnificationEntry(foil, Zinc), 'Y', new UnificationEntry(plate, Olivine)); + VanillaRecipeHelper.addShapedRecipe(provider, "ore_dictionary_filter_emerald", ORE_DICTIONARY_FILTER.asStack(), + "XXX", "XYX", "XXX", 'X', new UnificationEntry(foil, Zinc), 'Y', new UnificationEntry(plate, Emerald)); // TODO smart filter - //VanillaRecipeHelper.addShapedRecipe(provider, "smart_item_filter_olivine", SMART_FILTER.asStack(), "XEX", "XCX", "XEX", 'X', new UnificationEntry(foil, Zinc), 'C', new UnificationEntry(circuit, Tier.LV), 'E', new UnificationEntry(plate, Olivine)); - //VanillaRecipeHelper.addShapedRecipe(provider, "smart_item_filter_emerald", SMART_FILTER.asStack(), "XEX", "XCX", "XEX", 'X', new UnificationEntry(foil, Zinc), 'C', new UnificationEntry(circuit, Tier.LV), 'E', new UnificationEntry(plate, Emerald)); - - VanillaRecipeHelper.addShapedRecipe(provider, "plank_to_wooden_shape", WOODEN_FORM_EMPTY.asStack(), " ", " X ", "s ", 'X', ItemTags.PLANKS); - VanillaRecipeHelper.addShapedRecipe(provider, "wooden_shape_brick", WOODEN_FORM_BRICK.asStack(), "k ", " X", 'X', WOODEN_FORM_EMPTY.asStack()); - - VanillaRecipeHelper.addShapedRecipe(provider, "compressed_coke_clay", COMPRESSED_COKE_CLAY.asStack(3), "XXX", "SYS", "SSS", 'Y', WOODEN_FORM_BRICK.asStack(), 'X', new ItemStack(Items.CLAY_BALL), 'S', ItemTags.SAND); - VanillaRecipeHelper.addShapelessRecipe(provider, "fireclay_dust", ChemicalHelper.get(dust, Fireclay, 2), new UnificationEntry(dust, Brick), new UnificationEntry(dust, Clay)); - VanillaRecipeHelper.addSmeltingRecipe(provider, "coke_oven_brick", COMPRESSED_COKE_CLAY.asStack(), COKE_OVEN_BRICK.asStack(), 0.3f); - VanillaRecipeHelper.addSmeltingRecipe(provider, "fireclay_brick", COMPRESSED_FIRECLAY.asStack(), FIRECLAY_BRICK.asStack(), 0.3f); - - VanillaRecipeHelper.addSmeltingRecipe(provider, "wrought_iron_nugget", ChemicalHelper.getTag(nugget, Iron), ChemicalHelper.get(nugget, WroughtIron)); + // VanillaRecipeHelper.addShapedRecipe(provider, "smart_item_filter_olivine", SMART_FILTER.asStack(), "XEX", + // "XCX", "XEX", 'X', new UnificationEntry(foil, Zinc), 'C', new UnificationEntry(circuit, Tier.LV), 'E', new + // UnificationEntry(plate, Olivine)); + // VanillaRecipeHelper.addShapedRecipe(provider, "smart_item_filter_emerald", SMART_FILTER.asStack(), "XEX", + // "XCX", "XEX", 'X', new UnificationEntry(foil, Zinc), 'C', new UnificationEntry(circuit, Tier.LV), 'E', new + // UnificationEntry(plate, Emerald)); + + VanillaRecipeHelper.addShapedRecipe(provider, "plank_to_wooden_shape", WOODEN_FORM_EMPTY.asStack(), " ", + " X ", "s ", 'X', ItemTags.PLANKS); + VanillaRecipeHelper.addShapedRecipe(provider, "wooden_shape_brick", WOODEN_FORM_BRICK.asStack(), "k ", " X", + 'X', WOODEN_FORM_EMPTY.asStack()); + + VanillaRecipeHelper.addShapedRecipe(provider, "compressed_coke_clay", COMPRESSED_COKE_CLAY.asStack(3), "XXX", + "SYS", "SSS", 'Y', WOODEN_FORM_BRICK.asStack(), 'X', new ItemStack(Items.CLAY_BALL), 'S', + ItemTags.SAND); + VanillaRecipeHelper.addShapelessRecipe(provider, "fireclay_dust", ChemicalHelper.get(dust, Fireclay, 2), + new UnificationEntry(dust, Brick), new UnificationEntry(dust, Clay)); + VanillaRecipeHelper.addSmeltingRecipe(provider, "coke_oven_brick", COMPRESSED_COKE_CLAY.asStack(), + COKE_OVEN_BRICK.asStack(), 0.3f); + VanillaRecipeHelper.addSmeltingRecipe(provider, "fireclay_brick", COMPRESSED_FIRECLAY.asStack(), + FIRECLAY_BRICK.asStack(), 0.3f); + + VanillaRecipeHelper.addSmeltingRecipe(provider, "wrought_iron_nugget", ChemicalHelper.getTag(nugget, Iron), + ChemicalHelper.get(nugget, WroughtIron)); // TODO clipboard - //VanillaRecipeHelper.addShapedRecipe(provider, "clipboard", CLIPBOARD.asStack(), " Sd", "BWR", "PPP", 'P', Items.PAPER, 'R', new UnificationEntry(springSmall, Iron), 'B', new UnificationEntry(bolt, Iron), 'S', new UnificationEntry(screw, Iron), 'W', new UnificationEntry(plate, Wood)); - - VanillaRecipeHelper.addShapelessRecipe(provider, "rubber_wood_planks", GTBlocks.RUBBER_PLANK.asStack(4), GTBlocks.RUBBER_LOG.asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, "treated_wood_planks", GTBlocks.TREATED_WOOD_PLANK.asStack(8), "PPP", "PBP", "PPP", 'P', ItemTags.PLANKS, 'B', Creosote.getBucket()); - - VanillaRecipeHelper.addShapedRecipe(provider, "rubber_ring", ChemicalHelper.get(ring, Rubber), "k", "X", 'X', new UnificationEntry(plate, Rubber)); - VanillaRecipeHelper.addShapedRecipe(provider, "silicone_rubber_ring", ChemicalHelper.get(ring, SiliconeRubber), "k", "P", 'P', ChemicalHelper.get(plate, SiliconeRubber)); - VanillaRecipeHelper.addShapedRecipe(provider, "styrene_rubber_ring", ChemicalHelper.get(ring, StyreneButadieneRubber), "k", "P", 'P', ChemicalHelper.get(plate, StyreneButadieneRubber)); - - VanillaRecipeHelper.addShapelessRecipe(provider, "iron_magnetic_stick", ChemicalHelper.get(rod, IronMagnetic), new UnificationEntry(rod, Iron), new UnificationEntry(dust, Redstone), new UnificationEntry(dust, Redstone), new UnificationEntry(dust, Redstone), new UnificationEntry(dust, Redstone)); - - VanillaRecipeHelper.addShapedRecipe(provider, "component_grinder_diamond", COMPONENT_GRINDER_DIAMOND.asStack(), "XSX", "SDS", "XSX", 'X', new UnificationEntry(dust, Diamond), 'S', new UnificationEntry(plateDouble, Steel), 'D', new UnificationEntry(gem, Diamond)); - VanillaRecipeHelper.addShapedRecipe(provider, "component_grinder_tungsten", COMPONENT_GRINDER_TUNGSTEN.asStack(), "WSW", "SDS", "WSW", 'W', new UnificationEntry(plate, Tungsten), 'S', new UnificationEntry(plateDouble, VanadiumSteel), 'D', new UnificationEntry(gem, Diamond)); - - VanillaRecipeHelper.addShapedRecipe(provider, "minecart_wheels_iron", IRON_MINECART_WHEELS.asStack(), " h ", "RSR", " w ", 'R', new UnificationEntry(ring, Iron), 'S', new UnificationEntry(rod, Iron)); - VanillaRecipeHelper.addShapedRecipe(provider, "minecart_wheels_steel", STEEL_MINECART_WHEELS.asStack(), " h ", "RSR", " w ", 'R', new UnificationEntry(ring, Steel), 'S', new UnificationEntry(rod, Steel)); + // VanillaRecipeHelper.addShapedRecipe(provider, "clipboard", CLIPBOARD.asStack(), " Sd", "BWR", "PPP", 'P', + // Items.PAPER, 'R', new UnificationEntry(springSmall, Iron), 'B', new UnificationEntry(bolt, Iron), 'S', new + // UnificationEntry(screw, Iron), 'W', new UnificationEntry(plate, Wood)); + + VanillaRecipeHelper.addShapelessRecipe(provider, "rubber_wood_planks", GTBlocks.RUBBER_PLANK.asStack(4), + GTBlocks.RUBBER_LOG.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, "treated_wood_planks", GTBlocks.TREATED_WOOD_PLANK.asStack(8), + "PPP", "PBP", "PPP", 'P', ItemTags.PLANKS, 'B', Creosote.getBucket()); + + VanillaRecipeHelper.addShapedRecipe(provider, "rubber_ring", ChemicalHelper.get(ring, Rubber), "k", "X", 'X', + new UnificationEntry(plate, Rubber)); + VanillaRecipeHelper.addShapedRecipe(provider, "silicone_rubber_ring", ChemicalHelper.get(ring, SiliconeRubber), + "k", "P", 'P', ChemicalHelper.get(plate, SiliconeRubber)); + VanillaRecipeHelper.addShapedRecipe(provider, "styrene_rubber_ring", + ChemicalHelper.get(ring, StyreneButadieneRubber), "k", "P", 'P', + ChemicalHelper.get(plate, StyreneButadieneRubber)); + + VanillaRecipeHelper.addShapelessRecipe(provider, "iron_magnetic_stick", ChemicalHelper.get(rod, IronMagnetic), + new UnificationEntry(rod, Iron), new UnificationEntry(dust, Redstone), + new UnificationEntry(dust, Redstone), new UnificationEntry(dust, Redstone), + new UnificationEntry(dust, Redstone)); + + VanillaRecipeHelper.addShapedRecipe(provider, "component_grinder_diamond", COMPONENT_GRINDER_DIAMOND.asStack(), + "XSX", "SDS", "XSX", 'X', new UnificationEntry(dust, Diamond), 'S', + new UnificationEntry(plateDouble, Steel), 'D', new UnificationEntry(gem, Diamond)); + VanillaRecipeHelper.addShapedRecipe(provider, "component_grinder_tungsten", + COMPONENT_GRINDER_TUNGSTEN.asStack(), "WSW", "SDS", "WSW", 'W', new UnificationEntry(plate, Tungsten), + 'S', new UnificationEntry(plateDouble, VanadiumSteel), 'D', new UnificationEntry(gem, Diamond)); + + VanillaRecipeHelper.addShapedRecipe(provider, "minecart_wheels_iron", IRON_MINECART_WHEELS.asStack(), " h ", + "RSR", " w ", 'R', new UnificationEntry(ring, Iron), 'S', new UnificationEntry(rod, Iron)); + VanillaRecipeHelper.addShapedRecipe(provider, "minecart_wheels_steel", STEEL_MINECART_WHEELS.asStack(), " h ", + "RSR", " w ", 'R', new UnificationEntry(ring, Steel), 'S', new UnificationEntry(rod, Steel)); // todo nanosaber - //VanillaRecipeHelper.addShapedRecipe(provider, "nano_saber", NANO_SABER.asStack(), "PIC", "PIC", "XEX", 'P', new UnificationEntry(plate, Platinum), 'I', new UnificationEntry(plate, Ruridit), 'C', CARBON_FIBER_PLATE.asStack(), 'X', new UnificationEntry(circuit, Tier.EV), 'E', ENERGIUM_CRYSTAL.asStack()); - - VanillaRecipeHelper.addShapedRecipe(provider, "solar_panel_basic", COVER_SOLAR_PANEL.asStack(), "WGW", "CPC", 'W', SILICON_WAFER.asStack(), 'G', new ItemStack(Blocks.GLASS_PANE), 'C', CustomTags.LV_CIRCUITS, 'P', CARBON_FIBER_PLATE.asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, "solar_panel_ulv", COVER_SOLAR_PANEL_ULV.asStack(), "WGW", "CAC", "P P", 'W', PHOSPHORUS_WAFER.asStack(), 'G', CustomTags.GLASS_PANES, 'C', CustomTags.HV_CIRCUITS, 'P', ChemicalHelper.get(plate, GalliumArsenide), 'A', ChemicalHelper.get(wireGtQuadruple, Graphene)); - VanillaRecipeHelper.addShapedRecipe(provider, "solar_panel_lv", COVER_SOLAR_PANEL_LV.asStack(), "WGW", "CAC", "P P", 'W', NAQUADAH_WAFER.asStack(), 'G', GTBlocks.CASING_TEMPERED_GLASS.asStack(), 'C', CustomTags.LuV_CIRCUITS, 'P', ChemicalHelper.get(plate, IndiumGalliumPhosphide), 'A', ChemicalHelper.get(wireGtHex, Graphene)); - - - VanillaRecipeHelper.addShapedRecipe(provider, "universal_fluid_cell", FLUID_CELL_UNIVERSAL.asStack(), "C ", " ", 'C', FLUID_CELL); - VanillaRecipeHelper.addShapedRecipe(provider, "universal_fluid_cell_revert", FLUID_CELL.asStack(), "C ", " ", 'C', FLUID_CELL_UNIVERSAL); - - VanillaRecipeHelper.addShapedRecipe(provider, "blacklight", BLACKLIGHT.asStack(), "SPS", "GRG", "CPK", 'S', new UnificationEntry(screw, TungstenCarbide), 'P', new UnificationEntry(plate, TungstenCarbide), 'G', GTBlocks.CASING_LAMINATED_GLASS.asStack(), 'R', new UnificationEntry(spring, Europium), 'C', CustomTags.IV_CIRCUITS, 'K', new UnificationEntry(cableGtSingle, Platinum)); - - VanillaRecipeHelper.addShapedRecipe(provider, true, "filter_casing", GTBlocks.FILTER_CASING.asStack(), "BBB", "III", "MFR", 'B', new ItemStack(Blocks.IRON_BARS), 'I', ITEM_FILTER.asStack(), 'M', ELECTRIC_MOTOR_MV.asStack(), 'F', new UnificationEntry(frameGt, Steel), 'R', new UnificationEntry(rotor, Steel)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "filter_casing_sterile", GTBlocks.FILTER_CASING_STERILE.asStack(), "BEB", "ISI", "MFR", 'B', new UnificationEntry(pipeLargeFluid, Polybenzimidazole), 'E', EMITTER_ZPM.asStack(), 'I', ITEM_FILTER.asStack(), 'S', BLACKLIGHT.asStack(), 'M', ELECTRIC_MOTOR_ZPM.asStack(), 'F', new UnificationEntry(frameGt, Tritanium), 'R', new UnificationEntry(rotor, NaquadahAlloy)); + // VanillaRecipeHelper.addShapedRecipe(provider, "nano_saber", NANO_SABER.asStack(), "PIC", "PIC", "XEX", 'P', + // new UnificationEntry(plate, Platinum), 'I', new UnificationEntry(plate, Ruridit), 'C', + // CARBON_FIBER_PLATE.asStack(), 'X', new UnificationEntry(circuit, Tier.EV), 'E', ENERGIUM_CRYSTAL.asStack()); + + VanillaRecipeHelper.addShapedRecipe(provider, "solar_panel_basic", COVER_SOLAR_PANEL.asStack(), "WGW", "CPC", + 'W', SILICON_WAFER.asStack(), 'G', new ItemStack(Blocks.GLASS_PANE), 'C', CustomTags.LV_CIRCUITS, 'P', + CARBON_FIBER_PLATE.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, "solar_panel_ulv", COVER_SOLAR_PANEL_ULV.asStack(), "WGW", "CAC", + "P P", 'W', PHOSPHORUS_WAFER.asStack(), 'G', CustomTags.GLASS_PANES, 'C', CustomTags.HV_CIRCUITS, 'P', + ChemicalHelper.get(plate, GalliumArsenide), 'A', ChemicalHelper.get(wireGtQuadruple, Graphene)); + VanillaRecipeHelper.addShapedRecipe(provider, "solar_panel_lv", COVER_SOLAR_PANEL_LV.asStack(), "WGW", "CAC", + "P P", 'W', NAQUADAH_WAFER.asStack(), 'G', GTBlocks.CASING_TEMPERED_GLASS.asStack(), 'C', + CustomTags.LuV_CIRCUITS, 'P', ChemicalHelper.get(plate, IndiumGalliumPhosphide), 'A', + ChemicalHelper.get(wireGtHex, Graphene)); + + VanillaRecipeHelper.addShapedRecipe(provider, "universal_fluid_cell", FLUID_CELL_UNIVERSAL.asStack(), "C ", + " ", 'C', FLUID_CELL); + VanillaRecipeHelper.addShapedRecipe(provider, "universal_fluid_cell_revert", FLUID_CELL.asStack(), "C ", " ", + 'C', FLUID_CELL_UNIVERSAL); + + VanillaRecipeHelper.addShapedRecipe(provider, "blacklight", BLACKLIGHT.asStack(), "SPS", "GRG", "CPK", 'S', + new UnificationEntry(screw, TungstenCarbide), 'P', new UnificationEntry(plate, TungstenCarbide), 'G', + GTBlocks.CASING_LAMINATED_GLASS.asStack(), 'R', new UnificationEntry(spring, Europium), 'C', + CustomTags.IV_CIRCUITS, 'K', new UnificationEntry(cableGtSingle, Platinum)); + + VanillaRecipeHelper.addShapedRecipe(provider, true, "filter_casing", GTBlocks.FILTER_CASING.asStack(), "BBB", + "III", "MFR", 'B', new ItemStack(Blocks.IRON_BARS), 'I', ITEM_FILTER.asStack(), 'M', + ELECTRIC_MOTOR_MV.asStack(), 'F', new UnificationEntry(frameGt, Steel), 'R', + new UnificationEntry(rotor, Steel)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "filter_casing_sterile", + GTBlocks.FILTER_CASING_STERILE.asStack(), "BEB", "ISI", "MFR", 'B', + new UnificationEntry(pipeLargeFluid, Polybenzimidazole), 'E', EMITTER_ZPM.asStack(), 'I', + ITEM_FILTER.asStack(), 'S', BLACKLIGHT.asStack(), 'M', ELECTRIC_MOTOR_ZPM.asStack(), 'F', + new UnificationEntry(frameGt, Tritanium), 'R', new UnificationEntry(rotor, NaquadahAlloy)); /////////////////////////////////////////////////// - // Shapes and Molds // + // Shapes and Molds // /////////////////////////////////////////////////// - VanillaRecipeHelper.addShapedRecipe(provider, "shape_empty", SHAPE_EMPTY.asStack(), "hf", "PP", "PP", 'P', new UnificationEntry(plate, Steel)); - - VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_extruder_bottle", SHAPE_EXTRUDER_BOTTLE.asStack(), " x", " S ", " ", 'S', SHAPE_EXTRUDER_RING.asStack()); - VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_extruder_gear", SHAPE_EXTRUDER_GEAR.asStack(), "x ", " S ", " ", 'S', SHAPE_EXTRUDER_RING.asStack()); - VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_extruder_block", SHAPE_EXTRUDER_BLOCK.asStack(), "x ", " S ", " ", 'S', SHAPE_EXTRUDER_INGOT.asStack()); - VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_extruder_pipe_huge", SHAPE_EXTRUDER_PIPE_HUGE.asStack(), " ", " S ", " x", 'S', SHAPE_EXTRUDER_BOLT.asStack()); - VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_extruder_pipe_large", SHAPE_EXTRUDER_PIPE_LARGE.asStack(), " ", " Sx", " ", 'S', SHAPE_EXTRUDER_BOLT.asStack()); - VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_extruder_pipe_normal", SHAPE_EXTRUDER_PIPE_NORMAL.asStack(), " x", " S ", " ", 'S', SHAPE_EXTRUDER_BOLT.asStack()); - VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_extruder_pipe_small", SHAPE_EXTRUDER_PIPE_SMALL.asStack(), " x ", " S ", " ", 'S', SHAPE_EXTRUDER_BOLT.asStack()); - VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_extruder_pipe_tiny", SHAPE_EXTRUDER_PIPE_TINY.asStack(), "x ", " S ", " ", 'S', SHAPE_EXTRUDER_BOLT.asStack()); - VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_extruder_wire", SHAPE_EXTRUDER_WIRE.asStack(), " x ", " S ", " ", 'S', SHAPE_EXTRUDER_ROD.asStack()); - VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_extruder_ingot", SHAPE_EXTRUDER_INGOT.asStack(), "x ", " S ", " ", 'S', SHAPE_EMPTY.asStack()); - VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_extruder_cell", SHAPE_EXTRUDER_CELL.asStack(), " ", " Sx", " ", 'S', SHAPE_EXTRUDER_RING.asStack()); - VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_extruder_ring", SHAPE_EXTRUDER_RING.asStack(), " ", " S ", " x ", 'S', SHAPE_EMPTY.asStack()); - VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_extruder_bolt", SHAPE_EXTRUDER_BOLT.asStack(), "x ", " S ", " ", 'S', SHAPE_EXTRUDER_ROD.asStack()); - VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_extruder_rod", SHAPE_EXTRUDER_ROD.asStack(), " ", " Sx", " ", 'S', SHAPE_EMPTY.asStack()); - VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_extruder_rod_long", SHAPE_EXTRUDER_ROD_LONG.asStack(), " x", " S ", " ", 'S', SHAPE_EXTRUDER_ROD.asStack()); - VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_extruder_plate", SHAPE_EXTRUDER_PLATE.asStack(), "x ", " S ", " ", 'S', SHAPE_EXTRUDER_FOIL.asStack()); - VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_extruder_gear_small", SHAPE_EXTRUDER_GEAR_SMALL.asStack(), " x ", " S ", " ", 'S', SHAPE_EXTRUDER_RING.asStack()); - VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_extruder_foil", SHAPE_EXTRUDER_FOIL.asStack(), " ", " S ", " x", 'S', SHAPE_EMPTY.asStack()); - VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_extruder_rotor", SHAPE_EXTRUDER_ROTOR.asStack(), " ", " S ", "x ", 'S', SHAPE_EMPTY.asStack()); - - VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_mold_rotor", SHAPE_MOLD_ROTOR.asStack(), " h", " S ", " ", 'S', SHAPE_EMPTY.asStack()); - VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_mold_gear_small", SHAPE_MOLD_GEAR_SMALL.asStack(), " ", " ", "h S", 'S', SHAPE_EMPTY.asStack()); - VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_mold_name", SHAPE_MOLD_NAME.asStack(), " S", " ", "h ", 'S', SHAPE_EMPTY.asStack()); - VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_mold_anvil", SHAPE_MOLD_ANVIL.asStack(), " S", " ", " h ", 'S', SHAPE_EMPTY.asStack()); - VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_mold_cylinder", SHAPE_MOLD_CYLINDER.asStack(), " S", " ", " h", 'S', SHAPE_EMPTY.asStack()); - VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_mold_nugget", SHAPE_MOLD_NUGGET.asStack(), "S h", " ", " ", 'S', SHAPE_EMPTY.asStack()); - VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_mold_block", SHAPE_MOLD_BLOCK.asStack(), " ", "hS ", " ", 'S', SHAPE_EMPTY.asStack()); - VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_mold_ball", SHAPE_MOLD_BALL.asStack(), " ", " S ", "h ", 'S', SHAPE_EMPTY.asStack()); - VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_mold_ingot", SHAPE_MOLD_INGOT.asStack(), " ", " S ", " h ", 'S', SHAPE_EMPTY.asStack()); - VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_mold_bottle", SHAPE_MOLD_BOTTLE.asStack(), " ", " S ", " h", 'S', SHAPE_EMPTY.asStack()); - VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_mold_credit", SHAPE_MOLD_CREDIT.asStack(), "h ", " S ", " ", 'S', SHAPE_EMPTY.asStack()); - VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_mold_gear", SHAPE_MOLD_GEAR.asStack(), " ", " Sh", " ", 'S', SHAPE_EMPTY.asStack()); - VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_mold_plate", SHAPE_MOLD_PLATE.asStack(), " h ", " S ", " ", 'S', SHAPE_EMPTY.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, "shape_empty", SHAPE_EMPTY.asStack(), "hf", "PP", "PP", 'P', + new UnificationEntry(plate, Steel)); + + VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_extruder_bottle", SHAPE_EXTRUDER_BOTTLE.asStack(), + " x", " S ", " ", 'S', SHAPE_EXTRUDER_RING.asStack()); + VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_extruder_gear", SHAPE_EXTRUDER_GEAR.asStack(), "x ", + " S ", " ", 'S', SHAPE_EXTRUDER_RING.asStack()); + VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_extruder_block", SHAPE_EXTRUDER_BLOCK.asStack(), + "x ", " S ", " ", 'S', SHAPE_EXTRUDER_INGOT.asStack()); + VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_extruder_pipe_huge", + SHAPE_EXTRUDER_PIPE_HUGE.asStack(), " ", " S ", " x", 'S', SHAPE_EXTRUDER_BOLT.asStack()); + VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_extruder_pipe_large", + SHAPE_EXTRUDER_PIPE_LARGE.asStack(), " ", " Sx", " ", 'S', SHAPE_EXTRUDER_BOLT.asStack()); + VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_extruder_pipe_normal", + SHAPE_EXTRUDER_PIPE_NORMAL.asStack(), " x", " S ", " ", 'S', SHAPE_EXTRUDER_BOLT.asStack()); + VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_extruder_pipe_small", + SHAPE_EXTRUDER_PIPE_SMALL.asStack(), " x ", " S ", " ", 'S', SHAPE_EXTRUDER_BOLT.asStack()); + VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_extruder_pipe_tiny", + SHAPE_EXTRUDER_PIPE_TINY.asStack(), "x ", " S ", " ", 'S', SHAPE_EXTRUDER_BOLT.asStack()); + VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_extruder_wire", SHAPE_EXTRUDER_WIRE.asStack(), " x ", + " S ", " ", 'S', SHAPE_EXTRUDER_ROD.asStack()); + VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_extruder_ingot", SHAPE_EXTRUDER_INGOT.asStack(), + "x ", " S ", " ", 'S', SHAPE_EMPTY.asStack()); + VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_extruder_cell", SHAPE_EXTRUDER_CELL.asStack(), " ", + " Sx", " ", 'S', SHAPE_EXTRUDER_RING.asStack()); + VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_extruder_ring", SHAPE_EXTRUDER_RING.asStack(), " ", + " S ", " x ", 'S', SHAPE_EMPTY.asStack()); + VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_extruder_bolt", SHAPE_EXTRUDER_BOLT.asStack(), "x ", + " S ", " ", 'S', SHAPE_EXTRUDER_ROD.asStack()); + VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_extruder_rod", SHAPE_EXTRUDER_ROD.asStack(), " ", + " Sx", " ", 'S', SHAPE_EMPTY.asStack()); + VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_extruder_rod_long", + SHAPE_EXTRUDER_ROD_LONG.asStack(), " x", " S ", " ", 'S', SHAPE_EXTRUDER_ROD.asStack()); + VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_extruder_plate", SHAPE_EXTRUDER_PLATE.asStack(), + "x ", " S ", " ", 'S', SHAPE_EXTRUDER_FOIL.asStack()); + VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_extruder_gear_small", + SHAPE_EXTRUDER_GEAR_SMALL.asStack(), " x ", " S ", " ", 'S', SHAPE_EXTRUDER_RING.asStack()); + VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_extruder_foil", SHAPE_EXTRUDER_FOIL.asStack(), " ", + " S ", " x", 'S', SHAPE_EMPTY.asStack()); + VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_extruder_rotor", SHAPE_EXTRUDER_ROTOR.asStack(), + " ", " S ", "x ", 'S', SHAPE_EMPTY.asStack()); + + VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_mold_pill", SHAPE_MOLD_PILL.asStack(), " h", + " S", " ", 'S', SHAPE_EMPTY.asStack()); + VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_mold_rotor", SHAPE_MOLD_ROTOR.asStack(), " h", + " S ", " ", 'S', SHAPE_EMPTY.asStack()); + VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_mold_gear_small", SHAPE_MOLD_GEAR_SMALL.asStack(), + " ", " ", "h S", 'S', SHAPE_EMPTY.asStack()); + VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_mold_name", SHAPE_MOLD_NAME.asStack(), " S", " ", + "h ", 'S', SHAPE_EMPTY.asStack()); + VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_mold_anvil", SHAPE_MOLD_ANVIL.asStack(), " S", + " ", " h ", 'S', SHAPE_EMPTY.asStack()); + VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_mold_cylinder", SHAPE_MOLD_CYLINDER.asStack(), " S", + " ", " h", 'S', SHAPE_EMPTY.asStack()); + VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_mold_nugget", SHAPE_MOLD_NUGGET.asStack(), "S h", + " ", " ", 'S', SHAPE_EMPTY.asStack()); + VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_mold_block", SHAPE_MOLD_BLOCK.asStack(), " ", + "hS ", " ", 'S', SHAPE_EMPTY.asStack()); + VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_mold_ball", SHAPE_MOLD_BALL.asStack(), " ", " S ", + "h ", 'S', SHAPE_EMPTY.asStack()); + VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_mold_ingot", SHAPE_MOLD_INGOT.asStack(), " ", + " S ", " h ", 'S', SHAPE_EMPTY.asStack()); + VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_mold_bottle", SHAPE_MOLD_BOTTLE.asStack(), " ", + " S ", " h", 'S', SHAPE_EMPTY.asStack()); + VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_mold_credit", SHAPE_MOLD_CREDIT.asStack(), "h ", + " S ", " ", 'S', SHAPE_EMPTY.asStack()); + VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_mold_gear", SHAPE_MOLD_GEAR.asStack(), " ", " Sh", + " ", 'S', SHAPE_EMPTY.asStack()); + VanillaRecipeHelper.addStrictShapedRecipe(provider, "shape_mold_plate", SHAPE_MOLD_PLATE.asStack(), " h ", + " S ", " ", 'S', SHAPE_EMPTY.asStack()); /////////////////////////////////////////////////// - // Credits // + // Credits // /////////////////////////////////////////////////// - VanillaRecipeHelper.addShapelessRecipe(provider, "coin_chocolate", COIN_CHOCOLATE.asStack(), new UnificationEntry(dust, Cocoa), new UnificationEntry(foil, Gold), new ItemStack(Items.MILK_BUCKET), new UnificationEntry(dust, Sugar)); - - VanillaRecipeHelper.addShapelessRecipe(provider, "credit_copper", CREDIT_COPPER.asStack(8), CREDIT_CUPRONICKEL.asStack()); - VanillaRecipeHelper.addShapelessRecipe(provider, "credit_cupronickel_alt", CREDIT_CUPRONICKEL.asStack(), CREDIT_COPPER.asStack(), CREDIT_COPPER.asStack(), CREDIT_COPPER.asStack(), CREDIT_COPPER.asStack(), CREDIT_COPPER.asStack(), CREDIT_COPPER.asStack(), CREDIT_COPPER.asStack(), CREDIT_COPPER.asStack()); - VanillaRecipeHelper.addShapelessRecipe(provider, "credit_cupronickel", CREDIT_CUPRONICKEL.asStack(8), CREDIT_SILVER.asStack()); - VanillaRecipeHelper.addShapelessRecipe(provider, "credit_silver_alt", CREDIT_SILVER.asStack(), CREDIT_CUPRONICKEL.asStack(), CREDIT_CUPRONICKEL.asStack(), CREDIT_CUPRONICKEL.asStack(), CREDIT_CUPRONICKEL.asStack(), CREDIT_CUPRONICKEL.asStack(), CREDIT_CUPRONICKEL.asStack(), CREDIT_CUPRONICKEL.asStack(), CREDIT_CUPRONICKEL.asStack()); - VanillaRecipeHelper.addShapelessRecipe(provider, "credit_silver", CREDIT_SILVER.asStack(8), CREDIT_GOLD.asStack()); - VanillaRecipeHelper.addShapelessRecipe(provider, "credit_gold_alt", CREDIT_GOLD.asStack(), CREDIT_SILVER.asStack(), CREDIT_SILVER.asStack(), CREDIT_SILVER.asStack(), CREDIT_SILVER.asStack(), CREDIT_SILVER.asStack(), CREDIT_SILVER.asStack(), CREDIT_SILVER.asStack(), CREDIT_SILVER.asStack()); - VanillaRecipeHelper.addShapelessRecipe(provider, "credit_gold", CREDIT_GOLD.asStack(8), CREDIT_PLATINUM.asStack()); - VanillaRecipeHelper.addShapelessRecipe(provider, "credit_platinum_alt", CREDIT_PLATINUM.asStack(), CREDIT_GOLD.asStack(), CREDIT_GOLD.asStack(), CREDIT_GOLD.asStack(), CREDIT_GOLD.asStack(), CREDIT_GOLD.asStack(), CREDIT_GOLD.asStack(), CREDIT_GOLD.asStack(), CREDIT_GOLD.asStack()); - VanillaRecipeHelper.addShapelessRecipe(provider, "credit_platinum", CREDIT_PLATINUM.asStack(8), CREDIT_OSMIUM.asStack()); - VanillaRecipeHelper.addShapelessRecipe(provider, "credit_osmium_alt", CREDIT_OSMIUM.asStack(), CREDIT_PLATINUM.asStack(), CREDIT_PLATINUM.asStack(), CREDIT_PLATINUM.asStack(), CREDIT_PLATINUM.asStack(), CREDIT_PLATINUM.asStack(), CREDIT_PLATINUM.asStack(), CREDIT_PLATINUM.asStack(), CREDIT_PLATINUM.asStack()); - VanillaRecipeHelper.addShapelessRecipe(provider, "credit_osmium", CREDIT_OSMIUM.asStack(8), CREDIT_NAQUADAH.asStack()); - VanillaRecipeHelper.addShapelessRecipe(provider, "credit_naquadah_alt", CREDIT_NAQUADAH.asStack(), CREDIT_OSMIUM.asStack(), CREDIT_OSMIUM.asStack(), CREDIT_OSMIUM.asStack(), CREDIT_OSMIUM.asStack(), CREDIT_OSMIUM.asStack(), CREDIT_OSMIUM.asStack(), CREDIT_OSMIUM.asStack(), CREDIT_OSMIUM.asStack()); - VanillaRecipeHelper.addShapelessRecipe(provider, "credit_naquadah", CREDIT_NAQUADAH.asStack(8), CREDIT_NEUTRONIUM.asStack()); - VanillaRecipeHelper.addShapelessRecipe(provider, "credit_darmstadtium", CREDIT_NEUTRONIUM.asStack(), CREDIT_NAQUADAH.asStack(), CREDIT_NAQUADAH.asStack(), CREDIT_NAQUADAH.asStack(), CREDIT_NAQUADAH.asStack(), CREDIT_NAQUADAH.asStack(), CREDIT_NAQUADAH.asStack(), CREDIT_NAQUADAH.asStack(), CREDIT_NAQUADAH.asStack()); + VanillaRecipeHelper.addShapelessRecipe(provider, "coin_chocolate", COIN_CHOCOLATE.asStack(), + new UnificationEntry(dust, Cocoa), new UnificationEntry(foil, Gold), new ItemStack(Items.MILK_BUCKET), + new UnificationEntry(dust, Sugar)); + + VanillaRecipeHelper.addShapelessRecipe(provider, "credit_copper", CREDIT_COPPER.asStack(8), + CREDIT_CUPRONICKEL.asStack()); + VanillaRecipeHelper.addShapelessRecipe(provider, "credit_cupronickel_alt", CREDIT_CUPRONICKEL.asStack(), + CREDIT_COPPER.asStack(), CREDIT_COPPER.asStack(), CREDIT_COPPER.asStack(), CREDIT_COPPER.asStack(), + CREDIT_COPPER.asStack(), CREDIT_COPPER.asStack(), CREDIT_COPPER.asStack(), CREDIT_COPPER.asStack()); + VanillaRecipeHelper.addShapelessRecipe(provider, "credit_cupronickel", CREDIT_CUPRONICKEL.asStack(8), + CREDIT_SILVER.asStack()); + VanillaRecipeHelper.addShapelessRecipe(provider, "credit_silver_alt", CREDIT_SILVER.asStack(), + CREDIT_CUPRONICKEL.asStack(), CREDIT_CUPRONICKEL.asStack(), CREDIT_CUPRONICKEL.asStack(), + CREDIT_CUPRONICKEL.asStack(), CREDIT_CUPRONICKEL.asStack(), CREDIT_CUPRONICKEL.asStack(), + CREDIT_CUPRONICKEL.asStack(), CREDIT_CUPRONICKEL.asStack()); + VanillaRecipeHelper.addShapelessRecipe(provider, "credit_silver", CREDIT_SILVER.asStack(8), + CREDIT_GOLD.asStack()); + VanillaRecipeHelper.addShapelessRecipe(provider, "credit_gold_alt", CREDIT_GOLD.asStack(), + CREDIT_SILVER.asStack(), CREDIT_SILVER.asStack(), CREDIT_SILVER.asStack(), CREDIT_SILVER.asStack(), + CREDIT_SILVER.asStack(), CREDIT_SILVER.asStack(), CREDIT_SILVER.asStack(), CREDIT_SILVER.asStack()); + VanillaRecipeHelper.addShapelessRecipe(provider, "credit_gold", CREDIT_GOLD.asStack(8), + CREDIT_PLATINUM.asStack()); + VanillaRecipeHelper.addShapelessRecipe(provider, "credit_platinum_alt", CREDIT_PLATINUM.asStack(), + CREDIT_GOLD.asStack(), CREDIT_GOLD.asStack(), CREDIT_GOLD.asStack(), CREDIT_GOLD.asStack(), + CREDIT_GOLD.asStack(), CREDIT_GOLD.asStack(), CREDIT_GOLD.asStack(), CREDIT_GOLD.asStack()); + VanillaRecipeHelper.addShapelessRecipe(provider, "credit_platinum", CREDIT_PLATINUM.asStack(8), + CREDIT_OSMIUM.asStack()); + VanillaRecipeHelper.addShapelessRecipe(provider, "credit_osmium_alt", CREDIT_OSMIUM.asStack(), + CREDIT_PLATINUM.asStack(), CREDIT_PLATINUM.asStack(), CREDIT_PLATINUM.asStack(), + CREDIT_PLATINUM.asStack(), CREDIT_PLATINUM.asStack(), CREDIT_PLATINUM.asStack(), + CREDIT_PLATINUM.asStack(), CREDIT_PLATINUM.asStack()); + VanillaRecipeHelper.addShapelessRecipe(provider, "credit_osmium", CREDIT_OSMIUM.asStack(8), + CREDIT_NAQUADAH.asStack()); + VanillaRecipeHelper.addShapelessRecipe(provider, "credit_naquadah_alt", CREDIT_NAQUADAH.asStack(), + CREDIT_OSMIUM.asStack(), CREDIT_OSMIUM.asStack(), CREDIT_OSMIUM.asStack(), CREDIT_OSMIUM.asStack(), + CREDIT_OSMIUM.asStack(), CREDIT_OSMIUM.asStack(), CREDIT_OSMIUM.asStack(), CREDIT_OSMIUM.asStack()); + VanillaRecipeHelper.addShapelessRecipe(provider, "credit_naquadah", CREDIT_NAQUADAH.asStack(8), + CREDIT_NEUTRONIUM.asStack()); + VanillaRecipeHelper.addShapelessRecipe(provider, "credit_darmstadtium", CREDIT_NEUTRONIUM.asStack(), + CREDIT_NAQUADAH.asStack(), CREDIT_NAQUADAH.asStack(), CREDIT_NAQUADAH.asStack(), + CREDIT_NAQUADAH.asStack(), CREDIT_NAQUADAH.asStack(), CREDIT_NAQUADAH.asStack(), + CREDIT_NAQUADAH.asStack(), CREDIT_NAQUADAH.asStack()); /////////////////////////////////////////////////// - // Armors // + // Armors // /////////////////////////////////////////////////// - VanillaRecipeHelper.addShapedRecipe(provider, "nightvision_goggles", GTItems.NIGHTVISION_GOGGLES.asStack(), "CSC", "RBR", "LdL", 'C', CustomTags.ULV_CIRCUITS, 'S', new UnificationEntry(screw, Steel), 'R', new UnificationEntry(ring, Rubber), 'B', GTItems.BATTERY_LV_SODIUM, 'L', new UnificationEntry(lens, Glass)); - VanillaRecipeHelper.addShapedRecipe(provider, "fluid_jetpack", GTItems.LIQUID_FUEL_JETPACK.asStack(), "xCw", "SUS", "RIR", 'C', CustomTags.LV_CIRCUITS, 'S', GTItems.FLUID_CELL_LARGE_STEEL.asStack(), 'U', GTItems.ELECTRIC_PUMP_LV.asStack(), 'R', new UnificationEntry(rotor, Lead), 'I', new UnificationEntry(pipeSmallFluid, Potin)); - VanillaRecipeHelper.addShapedRecipe(provider, "electric_jetpack", GTItems.ELECTRIC_JETPACK.asStack(), "xCd", "TBT", "I I", 'C', CustomTags.MV_CIRCUITS, 'T', GTItems.POWER_THRUSTER.asStack(), 'B', GTItems.BATTERY_MV_LITHIUM.asStack(), 'I', new UnificationEntry(wireGtDouble, AnnealedCopper)); - VanillaRecipeHelper.addShapedRecipe(provider, "electric_jetpack_advanced", GTItems.ELECTRIC_JETPACK_ADVANCED.asStack(), "xJd", "TBT", "WCW", 'J', GTItems.ELECTRIC_JETPACK.asStack(), 'T', GTItems.POWER_THRUSTER_ADVANCED.asStack(), 'B', ENERGIUM_CRYSTAL.asStack(), 'W', new UnificationEntry(wireGtQuadruple, Gold), 'C', CustomTags.HV_CIRCUITS); - VanillaRecipeHelper.addShapedRecipe(provider, "nano_helmet", GTItems.NANO_HELMET.asStack(), "PPP", "PNP", "xEd", 'P', GTItems.CARBON_FIBER_PLATE.asStack(), 'N', GTItems.NIGHTVISION_GOGGLES.asStack(), 'E', GTItems.ENERGIUM_CRYSTAL.asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, "nano_chestplate", GTItems.NANO_CHESTPLATE.asStack(), "PEP", "PPP", "PPP", 'P', GTItems.CARBON_FIBER_PLATE.asStack(), 'E', GTItems.ENERGIUM_CRYSTAL.asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, "nano_leggings", GTItems.NANO_LEGGINGS.asStack(), "PPP", "PEP", "PxP", 'P', GTItems.CARBON_FIBER_PLATE.asStack(), 'E', GTItems.ENERGIUM_CRYSTAL.asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, "nano_boots", GTItems.NANO_BOOTS.asStack(), "PxP", "PEP", 'P', GTItems.CARBON_FIBER_PLATE.asStack(), 'E', GTItems.ENERGIUM_CRYSTAL.asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, "nano_chestplate_advanced", GTItems.NANO_CHESTPLATE_ADVANCED.asStack(), "xJd", "PNP", "WCW", 'J', GTItems.ELECTRIC_JETPACK_ADVANCED.asStack(), 'P', GTItems.LOW_POWER_INTEGRATED_CIRCUIT.asStack(), 'N', GTItems.NANO_CHESTPLATE.asStack(), 'W', new UnificationEntry(wireGtQuadruple, Platinum), 'C', CustomTags.IV_CIRCUITS); - VanillaRecipeHelper.addShapedRecipe(provider, "gravitation_engine", GTItems.GRAVITATION_ENGINE.asStack(), "ESE", "POP", "ESE", 'E', GTItems.EMITTER_LuV.asStack(), 'S', new UnificationEntry(wireGtQuadruple, Osmium), 'P', new UnificationEntry(plateDouble, Iridium), 'O', GTItems.ENERGY_LAPOTRONIC_ORB.asStack()); - - - VanillaRecipeHelper.addShapedRecipe(provider, "powderbarrel", new ItemStack(GTBlocks.POWDERBARREL), "PSP", "GGG", "PGP", - 'P', new UnificationEntry(plate, Wood), - 'S', new ItemStack(Items.STRING), - 'G', new UnificationEntry(dust, Gunpowder)); + VanillaRecipeHelper.addShapedRecipe(provider, "nightvision_goggles", GTItems.NIGHTVISION_GOGGLES.asStack(), + "CSC", "RBR", "LdL", 'C', CustomTags.ULV_CIRCUITS, 'S', new UnificationEntry(screw, Steel), 'R', + new UnificationEntry(ring, Rubber), 'B', GTItems.BATTERY_LV_SODIUM, 'L', + new UnificationEntry(lens, Glass)); + VanillaRecipeHelper.addShapedRecipe(provider, "fluid_jetpack", GTItems.LIQUID_FUEL_JETPACK.asStack(), "xCw", + "SUS", "RIR", 'C', CustomTags.LV_CIRCUITS, 'S', GTItems.FLUID_CELL_LARGE_STEEL.asStack(), 'U', + GTItems.ELECTRIC_PUMP_LV.asStack(), 'R', new UnificationEntry(rotor, Lead), 'I', + new UnificationEntry(pipeSmallFluid, Potin)); + VanillaRecipeHelper.addShapedRecipe(provider, "electric_jetpack", GTItems.ELECTRIC_JETPACK.asStack(), "xCd", + "TBT", "I I", 'C', CustomTags.MV_CIRCUITS, 'T', GTItems.POWER_THRUSTER.asStack(), 'B', + GTItems.BATTERY_MV_LITHIUM.asStack(), 'I', new UnificationEntry(wireGtDouble, AnnealedCopper)); + VanillaRecipeHelper.addShapedRecipe(provider, "electric_jetpack_advanced", + GTItems.ELECTRIC_JETPACK_ADVANCED.asStack(), "xJd", "TBT", "WCW", 'J', + GTItems.ELECTRIC_JETPACK.asStack(), 'T', GTItems.POWER_THRUSTER_ADVANCED.asStack(), 'B', + ENERGIUM_CRYSTAL.asStack(), 'W', new UnificationEntry(wireGtQuadruple, Gold), 'C', + CustomTags.HV_CIRCUITS); + VanillaRecipeHelper.addShapedRecipe(provider, "nano_helmet", GTItems.NANO_HELMET.asStack(), "PPP", "PNP", "xEd", + 'P', GTItems.CARBON_FIBER_PLATE.asStack(), 'N', GTItems.NIGHTVISION_GOGGLES.asStack(), 'E', + GTItems.ENERGIUM_CRYSTAL.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, "nano_chestplate", GTItems.NANO_CHESTPLATE.asStack(), "PEP", + "PPP", "PPP", 'P', GTItems.CARBON_FIBER_PLATE.asStack(), 'E', GTItems.ENERGIUM_CRYSTAL.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, "nano_leggings", GTItems.NANO_LEGGINGS.asStack(), "PPP", "PEP", + "PxP", 'P', GTItems.CARBON_FIBER_PLATE.asStack(), 'E', GTItems.ENERGIUM_CRYSTAL.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, "nano_boots", GTItems.NANO_BOOTS.asStack(), "PxP", "PEP", 'P', + GTItems.CARBON_FIBER_PLATE.asStack(), 'E', GTItems.ENERGIUM_CRYSTAL.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, "nano_chestplate_advanced", + GTItems.NANO_CHESTPLATE_ADVANCED.asStack(), "xJd", "PNP", "WCW", 'J', + GTItems.ELECTRIC_JETPACK_ADVANCED.asStack(), 'P', GTItems.LOW_POWER_INTEGRATED_CIRCUIT.asStack(), 'N', + GTItems.NANO_CHESTPLATE.asStack(), 'W', new UnificationEntry(wireGtQuadruple, Platinum), 'C', + CustomTags.IV_CIRCUITS); + VanillaRecipeHelper.addShapedRecipe(provider, "gravitation_engine", GTItems.GRAVITATION_ENGINE.asStack(), "ESE", + "POP", "ESE", 'E', GTItems.EMITTER_LuV.asStack(), 'S', new UnificationEntry(wireGtQuadruple, Osmium), + 'P', new UnificationEntry(plateDouble, Iridium), 'O', GTItems.ENERGY_LAPOTRONIC_ORB.asStack()); + + VanillaRecipeHelper.addShapedRecipe(provider, "face_mask", FACE_MASK.asStack(), "S S", "PPP", 'S', Items.STRING, + 'P', Items.PAPER); + VanillaRecipeHelper.addShapedRecipe(provider, "rubber_gloves", RUBBER_GLOVES.asStack(), "P P", 'P', + new UnificationEntry(plate, Rubber)); + + VanillaRecipeHelper.addShapedRecipe(provider, "powderbarrel", new ItemStack(GTBlocks.POWDERBARREL), "PSP", + "GGG", "PGP", + 'P', new UnificationEntry(plate, Wood), + 'S', new ItemStack(Items.STRING), + 'G', new UnificationEntry(dust, Gunpowder)); /////////////////////////////////////////////////// - // Special // + // Special // /////////////////////////////////////////////////// SpecialRecipeBuilder.special(FacadeCoverRecipe.SERIALIZER).save(provider, "gtceu:crafting/facade_cover"); } - //private static void registerFacadeRecipe(Consumer provider, Material material, int facadeAmount) { - // OreIngredient ingredient = new OreIngredient(new UnificationEntry(plate, material).toString()); - // ForgeRegistries.RECIPES.register(new FacadeRecipe(null, ingredient, facadeAmount).setRegistryName("facade_" + material)); - //} + // private static void registerFacadeRecipe(Consumer provider, Material material, int facadeAmount) + // { + // OreIngredient ingredient = new OreIngredient(new UnificationEntry(plate, material).toString()); + // ForgeRegistries.RECIPES.register(new FacadeRecipe(null, ingredient, facadeAmount).setRegistryName("facade_" + + // material)); + // } } diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/CreateRecipeLoader.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/CreateRecipeLoader.java index 2a2d5c7593..4c5c987a97 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/CreateRecipeLoader.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/CreateRecipeLoader.java @@ -1,9 +1,11 @@ package com.gregtechceu.gtceu.data.recipe.misc; import com.gregtechceu.gtceu.common.data.machines.GTCreateMachines; + +import net.minecraft.data.recipes.FinishedRecipe; + import com.simibubi.create.AllBlocks; import com.simibubi.create.AllItems; -import net.minecraft.data.recipes.FinishedRecipe; import java.util.function.Consumer; @@ -16,13 +18,21 @@ * @implNote CreateRecipeLoader */ public class CreateRecipeLoader { + public static void init(Consumer provider) { - registerMachineRecipe(provider, false, GTCreateMachines.KINETIC_MIXER, "GRG", "GEG", "CMC", 'M', HULL, 'R', ROTOR, 'C', AllItems.PRECISION_MECHANISM, 'G', GLASS, 'E', AllBlocks.SHAFT); - registerMachineRecipe(provider, false, GTCreateMachines.ELECTRIC_GEAR_BOX_2A, "WMW", "RER", "CHC", 'H', HULL, 'C', CIRCUIT, 'E', AllBlocks.SHAFT.asStack(), 'W', CABLE, 'M', MOTOR, 'R', ROTOR); - registerMachineRecipe(provider, false, GTCreateMachines.ELECTRIC_GEAR_BOX_8A, "WMW", "RER", "CHC", 'H', HULL, 'C', CIRCUIT, 'E', AllBlocks.SHAFT.asStack(), 'W', CABLE_QUAD, 'M', MOTOR, 'R', ROTOR); - registerMachineRecipe(provider, false, GTCreateMachines.ELECTRIC_GEAR_BOX_16A, "WMW", "RER", "CHC", 'H', HULL, 'C', CIRCUIT, 'E', AllBlocks.SHAFT.asStack(), 'W', CABLE_OCT, 'M', MOTOR, 'R', ROTOR); - registerMachineRecipe(provider, false, GTCreateMachines.ELECTRIC_GEAR_BOX_32A, "WMW", "RER", "CHC", 'H', HULL, 'C', CIRCUIT, 'E', AllBlocks.SHAFT.asStack(), 'W', CABLE_HEX, 'M', MOTOR, 'R', ROTOR); - registerMachineRecipe(provider, false, GTCreateMachines.KINETIC_INPUT_BOX, " S ", " H ", " ", 'S', AllBlocks.SHAFT, 'H', HULL); - registerMachineRecipe(provider, false, GTCreateMachines.KINETIC_OUTPUT_BOX, " ", " H ", " S ", 'S', AllBlocks.SHAFT, 'H', HULL); + registerMachineRecipe(provider, false, GTCreateMachines.KINETIC_MIXER, "GRG", "GEG", "CMC", 'M', HULL, 'R', + ROTOR, 'C', AllItems.PRECISION_MECHANISM, 'G', GLASS, 'E', AllBlocks.SHAFT); + registerMachineRecipe(provider, false, GTCreateMachines.ELECTRIC_GEAR_BOX_2A, "WMW", "RER", "CHC", 'H', HULL, + 'C', CIRCUIT, 'E', AllBlocks.SHAFT.asStack(), 'W', CABLE, 'M', MOTOR, 'R', ROTOR); + registerMachineRecipe(provider, false, GTCreateMachines.ELECTRIC_GEAR_BOX_8A, "WMW", "RER", "CHC", 'H', HULL, + 'C', CIRCUIT, 'E', AllBlocks.SHAFT.asStack(), 'W', CABLE_QUAD, 'M', MOTOR, 'R', ROTOR); + registerMachineRecipe(provider, false, GTCreateMachines.ELECTRIC_GEAR_BOX_16A, "WMW", "RER", "CHC", 'H', HULL, + 'C', CIRCUIT, 'E', AllBlocks.SHAFT.asStack(), 'W', CABLE_OCT, 'M', MOTOR, 'R', ROTOR); + registerMachineRecipe(provider, false, GTCreateMachines.ELECTRIC_GEAR_BOX_32A, "WMW", "RER", "CHC", 'H', HULL, + 'C', CIRCUIT, 'E', AllBlocks.SHAFT.asStack(), 'W', CABLE_HEX, 'M', MOTOR, 'R', ROTOR); + registerMachineRecipe(provider, false, GTCreateMachines.KINETIC_INPUT_BOX, " S ", " H ", " ", 'S', + AllBlocks.SHAFT, 'H', HULL); + registerMachineRecipe(provider, false, GTCreateMachines.KINETIC_OUTPUT_BOX, " ", " H ", " S ", 'S', + AllBlocks.SHAFT, 'H', HULL); } } diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/FuelRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/FuelRecipes.java index 83fadb9f2f..4a5177b97d 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/FuelRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/FuelRecipes.java @@ -2,7 +2,9 @@ import com.gregtechceu.gtceu.api.fluids.store.FluidStorageKeys; import com.gregtechceu.gtceu.utils.GTUtil; + import com.lowdragmc.lowdraglib.side.fluid.FluidStack; + import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.world.item.Item; @@ -20,7 +22,6 @@ public class FuelRecipes { public static void init(Consumer provider) { - // TODO this all needs to be cleaned up, but this will make it somewhat work for now // do these first because for some reason vanilla fuels are not set up yet at this phase? Set addedItems = new HashSet<>(); @@ -51,7 +52,7 @@ public static void init(Consumer provider) { .duration(600 * 12) .save(provider); - //semi-fluid fuels, like creosote + // semi-fluid fuels, like creosote LARGE_BOILER_RECIPES.recipeBuilder("creosote") .inputFluids(Creosote.getFluid(160)) .duration(10) @@ -87,7 +88,7 @@ public static void init(Consumer provider) { .duration(10) .save(provider); - //diesel generator fuels + // diesel generator fuels COMBUSTION_GENERATOR_FUELS.recipeBuilder("naphtha") .inputFluids(Naphtha.getFluid(1)) .duration(10) @@ -178,7 +179,7 @@ public static void init(Consumer provider) { .EUt(-V[LV]) .save(provider); - //steam generator fuels + // steam generator fuels STEAM_TURBINE_FUELS.recipeBuilder("steam") .inputFluids(Steam.getFluid(640)) .outputFluids(DistilledWater.getFluid(4)) @@ -186,7 +187,7 @@ public static void init(Consumer provider) { .EUt(-V[LV]) .save(provider); - //gas turbine fuels + // gas turbine fuels GAS_TURBINE_FUELS.recipeBuilder("natural_gas") .inputFluids(NaturalGas.getFluid(8)) .duration(5) @@ -295,7 +296,7 @@ public static void init(Consumer provider) { .EUt(-V[LV]) .save(provider); - //plasma turbine + // plasma turbine PLASMA_GENERATOR_FUELS.recipeBuilder("helium") .inputFluids(Helium.getFluid(FluidStorageKeys.PLASMA, 1)) .outputFluids(Helium.getFluid(1)) @@ -304,28 +305,28 @@ public static void init(Consumer provider) { .save(provider); PLASMA_GENERATOR_FUELS.recipeBuilder("oxygen") - .inputFluids(Oxygen.getFluid(FluidStorageKeys.PLASMA,1)) + .inputFluids(Oxygen.getFluid(FluidStorageKeys.PLASMA, 1)) .outputFluids(Oxygen.getFluid(1)) .duration(48) .EUt(-V[EV]) .save(provider); PLASMA_GENERATOR_FUELS.recipeBuilder("nitrogen") - .inputFluids(Nitrogen.getFluid(FluidStorageKeys.PLASMA,1)) + .inputFluids(Nitrogen.getFluid(FluidStorageKeys.PLASMA, 1)) .outputFluids(Nitrogen.getFluid(1)) .duration(64) .EUt(-V[EV]) .save(provider); PLASMA_GENERATOR_FUELS.recipeBuilder("iron") - .inputFluids(Iron.getFluid(FluidStorageKeys.PLASMA,1)) + .inputFluids(Iron.getFluid(FluidStorageKeys.PLASMA, 1)) .outputFluids(Iron.getFluid(1)) .duration(96) .EUt(-V[EV]) .save(provider); PLASMA_GENERATOR_FUELS.recipeBuilder("nickel") - .inputFluids(Nickel.getFluid(FluidStorageKeys.PLASMA,1)) + .inputFluids(Nickel.getFluid(FluidStorageKeys.PLASMA, 1)) .outputFluids(Nickel.getFluid(1)) .duration(192) .EUt(-V[EV]) diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/FusionLoader.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/FusionLoader.java index 79fe785a7f..71907619b2 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/FusionLoader.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/FusionLoader.java @@ -2,6 +2,7 @@ import com.gregtechceu.gtceu.api.fluids.store.FluidStorageKeys; import com.gregtechceu.gtceu.common.data.GTMaterials; + import net.minecraft.data.recipes.FinishedRecipe; import java.util.function.Consumer; @@ -12,11 +13,10 @@ public class FusionLoader { public static void init(Consumer provider) { - FUSION_RECIPES.recipeBuilder("deuterium_and_tritium_to_helium_plasma") .inputFluids(GTMaterials.Deuterium.getFluid(125)) .inputFluids(GTMaterials.Tritium.getFluid(125)) - .outputFluids(GTMaterials.Helium.getFluid(FluidStorageKeys.PLASMA,125)) + .outputFluids(GTMaterials.Helium.getFluid(FluidStorageKeys.PLASMA, 125)) .duration(16) .EUt(4096) .fusionStartEU(40_000_000) @@ -25,7 +25,7 @@ public static void init(Consumer provider) { FUSION_RECIPES.recipeBuilder("carbon_and_helium_3_to_oxygen_plasma") .inputFluids(GTMaterials.Carbon.getFluid(16)) .inputFluids(GTMaterials.Helium3.getFluid(125)) - .outputFluids(GTMaterials.Oxygen.getFluid(FluidStorageKeys.PLASMA,125)) + .outputFluids(GTMaterials.Oxygen.getFluid(FluidStorageKeys.PLASMA, 125)) .duration(32) .EUt(4096) .fusionStartEU(180_000_000) @@ -34,7 +34,7 @@ public static void init(Consumer provider) { FUSION_RECIPES.recipeBuilder("beryllium_and_deuterium_to_nitrogen_plasma") .inputFluids(GTMaterials.Beryllium.getFluid(16)) .inputFluids(GTMaterials.Deuterium.getFluid(375)) - .outputFluids(GTMaterials.Nitrogen.getFluid(FluidStorageKeys.PLASMA,125)) + .outputFluids(GTMaterials.Nitrogen.getFluid(FluidStorageKeys.PLASMA, 125)) .duration(16) .EUt(16384) .fusionStartEU(280_000_000) @@ -43,7 +43,7 @@ public static void init(Consumer provider) { FUSION_RECIPES.recipeBuilder("silicon_and_magnesium_to_iron_plasma") .inputFluids(GTMaterials.Silicon.getFluid(16)) .inputFluids(GTMaterials.Magnesium.getFluid(16)) - .outputFluids(GTMaterials.Iron.getFluid(FluidStorageKeys.PLASMA,16)) + .outputFluids(GTMaterials.Iron.getFluid(FluidStorageKeys.PLASMA, 16)) .duration(32) .EUt(VA[IV]) .fusionStartEU(360_000_000) @@ -52,7 +52,7 @@ public static void init(Consumer provider) { FUSION_RECIPES.recipeBuilder("potassium_and_fluorine_to_nickel_plasma") .inputFluids(GTMaterials.Potassium.getFluid(16)) .inputFluids(GTMaterials.Fluorine.getFluid(125)) - .outputFluids(GTMaterials.Nickel.getFluid(FluidStorageKeys.PLASMA,16)) + .outputFluids(GTMaterials.Nickel.getFluid(FluidStorageKeys.PLASMA, 16)) .duration(16) .EUt(VA[LuV]) .fusionStartEU(480_000_000) @@ -61,7 +61,7 @@ public static void init(Consumer provider) { FUSION_RECIPES.recipeBuilder("carbon_and_magnesium_to_argon_plasma") .inputFluids(GTMaterials.Carbon.getFluid(16)) .inputFluids(GTMaterials.Magnesium.getFluid(16)) - .outputFluids(GTMaterials.Argon.getFluid(FluidStorageKeys.PLASMA,125)) + .outputFluids(GTMaterials.Argon.getFluid(FluidStorageKeys.PLASMA, 125)) .duration(32) .EUt(24576) .fusionStartEU(180_000_000) @@ -210,6 +210,5 @@ public static void init(Consumer provider) { .EUt(VA[LuV]) .fusionStartEU(200_000_000) .save(provider); - } } diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/GCyMRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/GCyMRecipes.java index ad5fb582f9..451e7e24ad 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/GCyMRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/GCyMRecipes.java @@ -11,11 +11,14 @@ import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.data.recipe.CustomTags; import com.gregtechceu.gtceu.data.recipe.VanillaRecipeHelper; + import com.lowdragmc.lowdraglib.side.fluid.FluidHelper; + import net.minecraft.data.recipes.FinishedRecipe; -import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; + import java.util.function.Consumer; import static com.gregtechceu.gtceu.api.GTValues.*; @@ -54,41 +57,128 @@ private static void registerManualRecipes(Consumer provider) { } private static void registerMultiblockControllerRecipes(Consumer provider) { - VanillaRecipeHelper.addShapedRecipe(provider, true, "large_macerator", LARGE_MACERATION_TOWER.asStack(), "PCP", "BXB", "MKM", 'C', CustomTags.IV_CIRCUITS, 'P', new UnificationEntry(plate, TungstenCarbide), 'B', ELECTRIC_PISTON_IV.asStack(), 'M', ELECTRIC_MOTOR_IV.asStack(), 'X', MACERATOR[IV].asStack(), 'K', new UnificationEntry(cableGtSingle, Platinum)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "large_arc_smelter", LARGE_ARC_SMELTER.asStack(), "KDK", "CXC", "PPP", 'C', CustomTags.IV_CIRCUITS, 'P', new UnificationEntry(plate, TantalumCarbide), 'X', GTMachines.ARC_FURNACE[IV].asStack(), 'D',new UnificationEntry(dust, Graphite) ,'K', new UnificationEntry(cableGtSingle, Platinum)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "large_ore_washer", LARGE_CHEMICAL_BATH.asStack(), "PGP", "CXC", "MKM", 'C', CustomTags.IV_CIRCUITS, 'G',CASING_TEMPERED_GLASS.asStack() ,'P', ELECTRIC_PUMP_IV.asStack(), 'M', CONVEYOR_MODULE_IV.asStack(), 'X', ORE_WASHER[IV].asStack(), 'K', new UnificationEntry(cableGtSingle, Platinum)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "large_sifter", LARGE_SIFTING_FUNNEL.asStack(), "PCP", "EXE", "PKP", 'C', CustomTags.IV_CIRCUITS, 'P', new UnificationEntry(plate, HSLASteel), 'E', ELECTRIC_PISTON_IV.asStack(), 'X', SIFTER[IV].asStack(), 'K', new UnificationEntry(cableGtSingle, Platinum)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "large_engraver", LARGE_ENGRAVING_LASER.asStack(), "ICI", "EXE", "PKP", 'C', CustomTags.IV_CIRCUITS, 'P', new UnificationEntry(plateDouble, TantalumCarbide),'I',EMITTER_IV.asStack() ,'E', ELECTRIC_PISTON_IV.asStack(), 'X', LASER_ENGRAVER[IV].asStack(), 'K', new UnificationEntry(TagPrefix.cableGtSingle, Platinum)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "large_packer", LARGE_PACKER.asStack(), "RCR", "PXP", "KPK", 'C', CustomTags.EV_CIRCUITS, 'P', new UnificationEntry(plate, HSLASteel),'R',ROBOT_ARM_HV.asStack() ,'K', CONVEYOR_MODULE_HV.asStack(), 'X', PACKER[HV].asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, true, "large_mixer", LARGE_MIXER.asStack(), "FCF", "RXR", "MKM", 'C', CustomTags.IV_CIRCUITS, 'F', ChemicalHelper.get(pipeNormalFluid, Polybenzimidazole),'R',ChemicalHelper.get(rotor, Osmiridium) ,'M', ELECTRIC_MOTOR_IV.asStack(), 'X', MIXER[IV].asStack(), 'K', new UnificationEntry(TagPrefix.cableGtSingle, Platinum)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "large_centrifuge", LARGE_CENTRIFUGE.asStack(), "SFS", "CXC", "MKM", 'C', CustomTags.IV_CIRCUITS, 'F', ChemicalHelper.get(pipeHugeFluid, StainlessSteel),'S',ChemicalHelper.get(spring, MolybdenumDisilicide) ,'M', ELECTRIC_MOTOR_IV.asStack(), 'X', CENTRIFUGE[IV].asStack(), 'K', new UnificationEntry(TagPrefix.cableGtSingle, Platinum)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "large_assembler", LARGE_ASSEMBLER.asStack(), "RKR", "CXC", "MKM", 'C', CustomTags.IV_CIRCUITS, 'R', ROBOT_ARM_IV.asStack() ,'M', CONVEYOR_MODULE_IV.asStack(), 'X', ASSEMBLER[IV].asStack(), 'K', new UnificationEntry(cableGtSingle, Platinum)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "large_circuit_assembler", LARGE_CIRCUIT_ASSEMBLER.asStack(), "RKR", "CXC", "MKM", 'C', CustomTags.IV_CIRCUITS, 'R', ROBOT_ARM_IV.asStack() ,'M', CONVEYOR_MODULE_IV.asStack(), 'X', CIRCUIT_ASSEMBLER[IV].asStack(), 'K', new UnificationEntry(cableGtSingle, Platinum)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "large_electrolyzer", LARGE_ELECTROLYZER.asStack(), "PCP", "WXW", "PKP", 'C', CustomTags.IV_CIRCUITS, 'P', new UnificationEntry(plate, BlackSteel) ,'W', new UnificationEntry(cableGtSingle, Platinum), 'X', ELECTROLYZER[IV].asStack(), 'K', new UnificationEntry(cableGtSingle, Platinum)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "large_electromagnet", LARGE_ELECTROMAGNET.asStack(), "PWP", "CXC", "PKP", 'C', CustomTags.IV_CIRCUITS, 'P', new UnificationEntry(plate, BlueSteel) ,'W', new UnificationEntry(wireGtQuadruple, Osmium), 'X', ELECTROMAGNETIC_SEPARATOR[IV].asStack(), 'K', new UnificationEntry(cableGtSingle, Platinum)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "blast_alloy_smelter", BLAST_ALLOY_SMELTER.asStack(), "TCT", "WXW", "TCT", 'C', CustomTags.EV_CIRCUITS, 'T', new UnificationEntry(plate, TantalumCarbide) ,'W', new UnificationEntry(cableGtSingle, Aluminium), 'X', ALLOY_SMELTER[EV].asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, true, "mega_blast_furnace", MEGA_BLAST_FURNACE.asStack(),"PCP", "FSF", "DWD", 'C', ZPM_CIRCUITS,'S', ELECTRIC_BLAST_FURNACE.asStack(), 'F', FIELD_GENERATOR_ZPM.asStack(), 'P', new UnificationEntry(spring, Naquadah), 'D', new UnificationEntry(plateDense, NaquadahAlloy), 'W', new UnificationEntry(wireGtQuadruple, RutheniumTriniumAmericiumNeutronate)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "mega_vacuum_freezer", MEGA_VACUUM_FREEZER.asStack(), "PCP", "FSF", "DWD", 'C', ZPM_CIRCUITS, 'S', VACUUM_FREEZER.asStack(), 'F', FIELD_GENERATOR_ZPM.asStack(), 'P', new UnificationEntry(pipeNormalFluid, NiobiumTitanium), 'D', new UnificationEntry(plateDense, RhodiumPlatedPalladium), 'W', new UnificationEntry(wireGtQuadruple, RutheniumTriniumAmericiumNeutronate)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "large_autoclave", LARGE_AUTOCLAVE.asStack(), "PCP", "PAP", "BKB", 'C', CustomTags.IV_CIRCUITS, 'A', AUTOCLAVE[IV].asStack(), 'P', new UnificationEntry(plateDouble, HSLASteel), 'B', ELECTRIC_PUMP_IV.asStack(), 'K', new UnificationEntry(cableGtSingle, Platinum)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "large_material_press", LARGE_MATERIAL_PRESS.asStack(), "PKP", "BZG", "FKH", 'Z', CustomTags.IV_CIRCUITS, 'B', BENDER[IV].asStack(), 'P', ELECTRIC_PISTON_IV.asStack(), 'G', COMPRESSOR[IV].asStack(), 'F', FORMING_PRESS[IV].asStack(), 'H', FORGE_HAMMER[IV].asStack(), 'K', new UnificationEntry(cableGtSingle, Platinum)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "large_brewer", LARGE_BREWER.asStack(), "SZS", "FBH", "EKE", 'Z', CustomTags.IV_CIRCUITS, 'S', new UnificationEntry(spring, MolybdenumDisilicide), 'F', FERMENTER[IV].asStack(), 'E', ELECTRIC_PUMP_IV.asStack(), 'B', BREWERY[IV].asStack(), 'H', FLUID_HEATER[IV].asStack(), 'K', new UnificationEntry(cableGtSingle, Platinum)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "large_cutter", LARGE_CUTTER.asStack(), "SMS", "CZL", "EKE", 'Z', CustomTags.IV_CIRCUITS, 'L', LATHE[IV].asStack(), 'E', ELECTRIC_MOTOR_IV.asStack(), 'C', CUTTER[IV].asStack(), 'M', CONVEYOR_MODULE_IV.asStack(), 'S', new UnificationEntry(toolHeadBuzzSaw, TungstenCarbide), 'K', new UnificationEntry(cableGtSingle, Platinum)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "large_distillery", LARGE_DISTILLERY.asStack(), "PZP", "EDE", "PZP", 'Z', CustomTags.IV_CIRCUITS, 'D', DISTILLATION_TOWER.asStack(), 'E', ELECTRIC_PUMP_IV.asStack(), 'P', ChemicalHelper.get(pipeLargeFluid, Iridium)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "large_extractor", LARGE_EXTRACTOR.asStack(), "PTP", "EZC", "BKB", 'Z', CustomTags.IV_CIRCUITS, 'B', ELECTRIC_PISTON_IV.asStack(), 'P', ELECTRIC_PUMP_IV.asStack(), 'E', EXTRACTOR[IV].asStack(), 'C', CANNER[IV].asStack(), 'T', CASING_TEMPERED_GLASS.asStack(), 'K', new UnificationEntry(cableGtSingle, Platinum)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "large_extruder", LARGE_EXTRUDER.asStack(), "PZP", "SES", "PKP", 'Z', CustomTags.IV_CIRCUITS, 'E', EXTRUDER[IV].asStack(), 'P', ELECTRIC_PISTON_IV.asStack(), 'S', new UnificationEntry(spring, MolybdenumDisilicide), 'K', new UnificationEntry(cableGtSingle, Platinum)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "large_solidifier", LARGE_SOLIDIFIER.asStack(), "PZP", "ESE", "PKP", 'Z', CustomTags.IV_CIRCUITS, 'S', FLUID_SOLIDIFIER[IV].asStack(), 'E', ELECTRIC_PUMP_IV.asStack(), 'P', ChemicalHelper.get(pipeNormalFluid, Polyethylene), 'K', new UnificationEntry(cableGtSingle, Platinum)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "large_wiremill", LARGE_WIREMILL.asStack(), "PZP", "SWS", "MKM", 'Z', CustomTags.IV_CIRCUITS, 'W', WIREMILL[IV].asStack(), 'P', new UnificationEntry(plate, HSLASteel), 'S', new UnificationEntry(spring, HSLASteel), 'M', ELECTRIC_MOTOR_IV.asStack(), 'K', new UnificationEntry(cableGtSingle, Platinum)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "large_macerator", LARGE_MACERATION_TOWER.asStack(), "PCP", + "BXB", "MKM", 'C', CustomTags.IV_CIRCUITS, 'P', new UnificationEntry(plate, TungstenCarbide), 'B', + ELECTRIC_PISTON_IV.asStack(), 'M', ELECTRIC_MOTOR_IV.asStack(), 'X', MACERATOR[IV].asStack(), 'K', + new UnificationEntry(cableGtSingle, Platinum)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "large_arc_smelter", LARGE_ARC_SMELTER.asStack(), "KDK", + "CXC", "PPP", 'C', CustomTags.IV_CIRCUITS, 'P', new UnificationEntry(plate, TantalumCarbide), 'X', + GTMachines.ARC_FURNACE[IV].asStack(), 'D', new UnificationEntry(dust, Graphite), 'K', + new UnificationEntry(cableGtSingle, Platinum)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "large_ore_washer", LARGE_CHEMICAL_BATH.asStack(), "PGP", + "CXC", "MKM", 'C', CustomTags.IV_CIRCUITS, 'G', CASING_TEMPERED_GLASS.asStack(), 'P', + ELECTRIC_PUMP_IV.asStack(), 'M', CONVEYOR_MODULE_IV.asStack(), 'X', ORE_WASHER[IV].asStack(), 'K', + new UnificationEntry(cableGtSingle, Platinum)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "large_sifter", LARGE_SIFTING_FUNNEL.asStack(), "PCP", + "EXE", "PKP", 'C', CustomTags.IV_CIRCUITS, 'P', new UnificationEntry(plate, HSLASteel), 'E', + ELECTRIC_PISTON_IV.asStack(), 'X', SIFTER[IV].asStack(), 'K', + new UnificationEntry(cableGtSingle, Platinum)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "large_engraver", LARGE_ENGRAVING_LASER.asStack(), "ICI", + "EXE", "PKP", 'C', CustomTags.IV_CIRCUITS, 'P', new UnificationEntry(plateDouble, TantalumCarbide), 'I', + EMITTER_IV.asStack(), 'E', ELECTRIC_PISTON_IV.asStack(), 'X', LASER_ENGRAVER[IV].asStack(), 'K', + new UnificationEntry(TagPrefix.cableGtSingle, Platinum)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "large_packer", LARGE_PACKER.asStack(), "RCR", "PXP", "KPK", + 'C', CustomTags.EV_CIRCUITS, 'P', new UnificationEntry(plate, HSLASteel), 'R', ROBOT_ARM_HV.asStack(), + 'K', CONVEYOR_MODULE_HV.asStack(), 'X', PACKER[HV].asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, true, "large_mixer", LARGE_MIXER.asStack(), "FCF", "RXR", "MKM", + 'C', CustomTags.IV_CIRCUITS, 'F', ChemicalHelper.get(pipeNormalFluid, Polybenzimidazole), 'R', + ChemicalHelper.get(rotor, Osmiridium), 'M', ELECTRIC_MOTOR_IV.asStack(), 'X', MIXER[IV].asStack(), 'K', + new UnificationEntry(TagPrefix.cableGtSingle, Platinum)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "large_centrifuge", LARGE_CENTRIFUGE.asStack(), "SFS", + "CXC", "MKM", 'C', CustomTags.IV_CIRCUITS, 'F', ChemicalHelper.get(pipeHugeFluid, StainlessSteel), 'S', + ChemicalHelper.get(spring, MolybdenumDisilicide), 'M', ELECTRIC_MOTOR_IV.asStack(), 'X', + CENTRIFUGE[IV].asStack(), 'K', new UnificationEntry(TagPrefix.cableGtSingle, Platinum)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "large_assembler", LARGE_ASSEMBLER.asStack(), "RKR", "CXC", + "MKM", 'C', CustomTags.IV_CIRCUITS, 'R', ROBOT_ARM_IV.asStack(), 'M', CONVEYOR_MODULE_IV.asStack(), 'X', + ASSEMBLER[IV].asStack(), 'K', new UnificationEntry(cableGtSingle, Platinum)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "large_circuit_assembler", + LARGE_CIRCUIT_ASSEMBLER.asStack(), "RKR", "CXC", "MKM", 'C', CustomTags.IV_CIRCUITS, 'R', + ROBOT_ARM_IV.asStack(), 'M', CONVEYOR_MODULE_IV.asStack(), 'X', CIRCUIT_ASSEMBLER[IV].asStack(), 'K', + new UnificationEntry(cableGtSingle, Platinum)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "large_electrolyzer", LARGE_ELECTROLYZER.asStack(), "PCP", + "WXW", "PKP", 'C', CustomTags.IV_CIRCUITS, 'P', new UnificationEntry(plate, BlackSteel), 'W', + new UnificationEntry(cableGtSingle, Platinum), 'X', ELECTROLYZER[IV].asStack(), 'K', + new UnificationEntry(cableGtSingle, Platinum)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "large_electromagnet", LARGE_ELECTROMAGNET.asStack(), "PWP", + "CXC", "PKP", 'C', CustomTags.IV_CIRCUITS, 'P', new UnificationEntry(plate, BlueSteel), 'W', + new UnificationEntry(wireGtQuadruple, Osmium), 'X', ELECTROMAGNETIC_SEPARATOR[IV].asStack(), 'K', + new UnificationEntry(cableGtSingle, Platinum)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "blast_alloy_smelter", BLAST_ALLOY_SMELTER.asStack(), "TCT", + "WXW", "TCT", 'C', CustomTags.EV_CIRCUITS, 'T', new UnificationEntry(plate, TantalumCarbide), 'W', + new UnificationEntry(cableGtSingle, Aluminium), 'X', ALLOY_SMELTER[EV].asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, true, "mega_blast_furnace", MEGA_BLAST_FURNACE.asStack(), "PCP", + "FSF", "DWD", 'C', ZPM_CIRCUITS, 'S', ELECTRIC_BLAST_FURNACE.asStack(), 'F', + FIELD_GENERATOR_ZPM.asStack(), 'P', new UnificationEntry(spring, Naquadah), 'D', + new UnificationEntry(plateDense, NaquadahAlloy), 'W', + new UnificationEntry(wireGtQuadruple, RutheniumTriniumAmericiumNeutronate)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "mega_vacuum_freezer", MEGA_VACUUM_FREEZER.asStack(), "PCP", + "FSF", "DWD", 'C', ZPM_CIRCUITS, 'S', VACUUM_FREEZER.asStack(), 'F', FIELD_GENERATOR_ZPM.asStack(), 'P', + new UnificationEntry(pipeNormalFluid, NiobiumTitanium), 'D', + new UnificationEntry(plateDense, RhodiumPlatedPalladium), 'W', + new UnificationEntry(wireGtQuadruple, RutheniumTriniumAmericiumNeutronate)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "large_autoclave", LARGE_AUTOCLAVE.asStack(), "PCP", "PAP", + "BKB", 'C', CustomTags.IV_CIRCUITS, 'A', AUTOCLAVE[IV].asStack(), 'P', + new UnificationEntry(plateDouble, HSLASteel), 'B', ELECTRIC_PUMP_IV.asStack(), 'K', + new UnificationEntry(cableGtSingle, Platinum)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "large_material_press", LARGE_MATERIAL_PRESS.asStack(), + "PKP", "BZG", "FKH", 'Z', CustomTags.IV_CIRCUITS, 'B', BENDER[IV].asStack(), 'P', + ELECTRIC_PISTON_IV.asStack(), 'G', COMPRESSOR[IV].asStack(), 'F', FORMING_PRESS[IV].asStack(), 'H', + FORGE_HAMMER[IV].asStack(), 'K', new UnificationEntry(cableGtSingle, Platinum)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "large_brewer", LARGE_BREWER.asStack(), "SZS", "FBH", "EKE", + 'Z', CustomTags.IV_CIRCUITS, 'S', new UnificationEntry(spring, MolybdenumDisilicide), 'F', + FERMENTER[IV].asStack(), 'E', ELECTRIC_PUMP_IV.asStack(), 'B', BREWERY[IV].asStack(), 'H', + FLUID_HEATER[IV].asStack(), 'K', new UnificationEntry(cableGtSingle, Platinum)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "large_cutter", LARGE_CUTTER.asStack(), "SMS", "CZL", "EKE", + 'Z', CustomTags.IV_CIRCUITS, 'L', LATHE[IV].asStack(), 'E', ELECTRIC_MOTOR_IV.asStack(), 'C', + CUTTER[IV].asStack(), 'M', CONVEYOR_MODULE_IV.asStack(), 'S', + new UnificationEntry(toolHeadBuzzSaw, TungstenCarbide), 'K', + new UnificationEntry(cableGtSingle, Platinum)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "large_distillery", LARGE_DISTILLERY.asStack(), "PZP", + "EDE", "PZP", 'Z', CustomTags.IV_CIRCUITS, 'D', DISTILLATION_TOWER.asStack(), 'E', + ELECTRIC_PUMP_IV.asStack(), 'P', ChemicalHelper.get(pipeLargeFluid, Iridium)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "large_extractor", LARGE_EXTRACTOR.asStack(), "PTP", "EZC", + "BKB", 'Z', CustomTags.IV_CIRCUITS, 'B', ELECTRIC_PISTON_IV.asStack(), 'P', ELECTRIC_PUMP_IV.asStack(), + 'E', EXTRACTOR[IV].asStack(), 'C', CANNER[IV].asStack(), 'T', CASING_TEMPERED_GLASS.asStack(), 'K', + new UnificationEntry(cableGtSingle, Platinum)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "large_extruder", LARGE_EXTRUDER.asStack(), "PZP", "SES", + "PKP", 'Z', CustomTags.IV_CIRCUITS, 'E', EXTRUDER[IV].asStack(), 'P', ELECTRIC_PISTON_IV.asStack(), 'S', + new UnificationEntry(spring, MolybdenumDisilicide), 'K', new UnificationEntry(cableGtSingle, Platinum)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "large_solidifier", LARGE_SOLIDIFIER.asStack(), "PZP", + "ESE", "PKP", 'Z', CustomTags.IV_CIRCUITS, 'S', FLUID_SOLIDIFIER[IV].asStack(), 'E', + ELECTRIC_PUMP_IV.asStack(), 'P', ChemicalHelper.get(pipeNormalFluid, Polyethylene), 'K', + new UnificationEntry(cableGtSingle, Platinum)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "large_wiremill", LARGE_WIREMILL.asStack(), "PZP", "SWS", + "MKM", 'Z', CustomTags.IV_CIRCUITS, 'W', WIREMILL[IV].asStack(), 'P', + new UnificationEntry(plate, HSLASteel), 'S', new UnificationEntry(spring, HSLASteel), 'M', + ELECTRIC_MOTOR_IV.asStack(), 'K', new UnificationEntry(cableGtSingle, Platinum)); } private static void registerPartsRecipes(Consumer provider) { - VanillaRecipeHelper.addShapedRecipe(provider, "crushing_wheels", CRUSHING_WHEELS.asStack(2), "TTT", "UCU","UMU", 'T', new UnificationEntry(gearSmall,TungstenCarbide), 'U', ChemicalHelper.get(gear, Ultimet), 'C', CASING_SECURE_MACERATION.asStack(), 'M', ELECTRIC_MOTOR_IV.asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, "slicing_blades", SLICING_BLADES.asStack(2), "PPP", "UCU","UMU", 'P', new UnificationEntry(plate,TungstenCarbide), 'U', ChemicalHelper.get(gear, Ultimet), 'C', CASING_SHOCK_PROOF.asStack(), 'M', ELECTRIC_MOTOR_IV.asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, "electrolytic_cell", ELECTROLYTIC_CELL.asStack(2), "WWW", "WCW","ZKZ", 'W', new UnificationEntry(wireGtDouble,Platinum), 'Z', CustomTags.IV_CIRCUITS, 'C', CASING_NONCONDUCTING.asStack(), 'K', ChemicalHelper.get(cableGtSingle,Tungsten)); - VanillaRecipeHelper.addShapedRecipe(provider, "heat_vent", HEAT_VENT.asStack(2), "PDP", "RLR","PDP", 'P', new UnificationEntry(plate,TantalumCarbide), 'D', ChemicalHelper.get(plateDouble,MolybdenumDisilicide), 'R', ChemicalHelper.get(rotor,Titanium), 'L', ChemicalHelper.get(rodLong,MolybdenumDisilicide)); - VanillaRecipeHelper.addShapedRecipe(provider, "parallel_hatch_mk1", PARALLEL_HATCH[IV].asStack(1), "SZE", "ZHZ","CZC", 'S', SENSOR_IV.asStack(), 'E', EMITTER_IV.asStack(), 'Z', LuV_CIRCUITS, 'H', HULL[IV].asStack(), 'C', new UnificationEntry(cableGtDouble, Platinum)); - VanillaRecipeHelper.addShapedRecipe(provider, "parallel_hatch_mk2", PARALLEL_HATCH[LuV].asStack(1), "SZE", "ZHZ","CZC", 'S', SENSOR_LuV.asStack(), 'E', EMITTER_LuV.asStack(), 'Z', ZPM_CIRCUITS, 'H', HULL[LuV].asStack(), 'C', new UnificationEntry(cableGtDouble, NiobiumTitanium)); - VanillaRecipeHelper.addShapedRecipe(provider, "parallel_hatch_mk3", PARALLEL_HATCH[ZPM].asStack(1), "SZE", "ZHZ","CZC", 'S', SENSOR_ZPM.asStack(), 'E', EMITTER_ZPM.asStack(), 'Z', UV_CIRCUITS, 'H', HULL[ZPM].asStack(), 'C', new UnificationEntry(cableGtDouble, VanadiumGallium)); - VanillaRecipeHelper.addShapedRecipe(provider, "parallel_hatch_mk4", PARALLEL_HATCH[UV].asStack(1), "SZE", "ZHZ","CZC", 'S', SENSOR_UV.asStack(), 'E', EMITTER_UV.asStack(), 'Z', UHV_CIRCUITS, 'H', HULL[UV].asStack(), 'C', new UnificationEntry(cableGtDouble, YttriumBariumCuprate)); + VanillaRecipeHelper.addShapedRecipe(provider, "crushing_wheels", CRUSHING_WHEELS.asStack(2), "TTT", "UCU", + "UMU", 'T', new UnificationEntry(gearSmall, TungstenCarbide), 'U', ChemicalHelper.get(gear, Ultimet), + 'C', CASING_SECURE_MACERATION.asStack(), 'M', ELECTRIC_MOTOR_IV.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, "slicing_blades", SLICING_BLADES.asStack(2), "PPP", "UCU", "UMU", + 'P', new UnificationEntry(plate, TungstenCarbide), 'U', ChemicalHelper.get(gear, Ultimet), 'C', + CASING_SHOCK_PROOF.asStack(), 'M', ELECTRIC_MOTOR_IV.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, "electrolytic_cell", ELECTROLYTIC_CELL.asStack(2), "WWW", "WCW", + "ZKZ", 'W', new UnificationEntry(wireGtDouble, Platinum), 'Z', CustomTags.IV_CIRCUITS, 'C', + CASING_NONCONDUCTING.asStack(), 'K', ChemicalHelper.get(cableGtSingle, Tungsten)); + VanillaRecipeHelper.addShapedRecipe(provider, "heat_vent", HEAT_VENT.asStack(2), "PDP", "RLR", "PDP", 'P', + new UnificationEntry(plate, TantalumCarbide), 'D', + ChemicalHelper.get(plateDouble, MolybdenumDisilicide), 'R', ChemicalHelper.get(rotor, Titanium), 'L', + ChemicalHelper.get(rodLong, MolybdenumDisilicide)); + VanillaRecipeHelper.addShapedRecipe(provider, "parallel_hatch_mk1", PARALLEL_HATCH[IV].asStack(1), "SZE", "ZHZ", + "CZC", 'S', SENSOR_IV.asStack(), 'E', EMITTER_IV.asStack(), 'Z', LuV_CIRCUITS, 'H', HULL[IV].asStack(), + 'C', new UnificationEntry(cableGtDouble, Platinum)); + VanillaRecipeHelper.addShapedRecipe(provider, "parallel_hatch_mk2", PARALLEL_HATCH[LuV].asStack(1), "SZE", + "ZHZ", "CZC", 'S', SENSOR_LuV.asStack(), 'E', EMITTER_LuV.asStack(), 'Z', ZPM_CIRCUITS, 'H', + HULL[LuV].asStack(), 'C', new UnificationEntry(cableGtDouble, NiobiumTitanium)); + VanillaRecipeHelper.addShapedRecipe(provider, "parallel_hatch_mk3", PARALLEL_HATCH[ZPM].asStack(1), "SZE", + "ZHZ", "CZC", 'S', SENSOR_ZPM.asStack(), 'E', EMITTER_ZPM.asStack(), 'Z', UV_CIRCUITS, 'H', + HULL[ZPM].asStack(), 'C', new UnificationEntry(cableGtDouble, VanadiumGallium)); + VanillaRecipeHelper.addShapedRecipe(provider, "parallel_hatch_mk4", PARALLEL_HATCH[UV].asStack(1), "SZE", "ZHZ", + "CZC", 'S', SENSOR_UV.asStack(), 'E', EMITTER_UV.asStack(), 'Z', UHV_CIRCUITS, 'H', HULL[UV].asStack(), + 'C', new UnificationEntry(cableGtDouble, YttriumBariumCuprate)); } private static void registerMachineRecipes(Consumer provider) { @@ -97,10 +187,10 @@ private static void registerMachineRecipes(Consumer provider) { registerBlastAlloyRecipes(provider); } - private static void registerAssemblerRecipes(Consumer provider){ + private static void registerAssemblerRecipes(Consumer provider) { ASSEMBLER_RECIPES.recipeBuilder("crushing_wheels") - .inputItems(ChemicalHelper.get(gearSmall,TungstenCarbide,2)) - .inputItems(ChemicalHelper.get(gear,Ultimet,3)) + .inputItems(ChemicalHelper.get(gearSmall, TungstenCarbide, 2)) + .inputItems(ChemicalHelper.get(gear, Ultimet, 3)) .inputItems(CASING_SECURE_MACERATION.asStack()) .inputItems(ELECTRIC_MOTOR_IV.asStack()) .outputItems(CRUSHING_WHEELS.asStack(2)) @@ -108,8 +198,8 @@ private static void registerAssemblerRecipes(Consumer provider){ .save(provider); ASSEMBLER_RECIPES.recipeBuilder("slicing_blades") - .inputItems(ChemicalHelper.get(plate,TungstenCarbide,2)) - .inputItems(ChemicalHelper.get(gear,Ultimet,3)) + .inputItems(ChemicalHelper.get(plate, TungstenCarbide, 2)) + .inputItems(ChemicalHelper.get(gear, Ultimet, 3)) .inputItems(CASING_SHOCK_PROOF.asStack()) .inputItems(ELECTRIC_MOTOR_IV.asStack()) .outputItems(SLICING_BLADES.asStack(2)) @@ -117,8 +207,8 @@ private static void registerAssemblerRecipes(Consumer provider){ .save(provider); ASSEMBLER_RECIPES.recipeBuilder("electrolytic_cell") - .inputItems(ChemicalHelper.get(wireGtDouble,Platinum,4)) - .inputItems(ChemicalHelper.get(cableGtSingle,Tungsten,1)) + .inputItems(ChemicalHelper.get(wireGtDouble, Platinum, 4)) + .inputItems(ChemicalHelper.get(cableGtSingle, Tungsten, 1)) .inputItems(CASING_NONCONDUCTING.asStack()) .inputItems(CustomTags.IV_CIRCUITS) .outputItems(ELECTROLYTIC_CELL.asStack(2)) @@ -126,18 +216,18 @@ private static void registerAssemblerRecipes(Consumer provider){ .save(provider); ASSEMBLER_RECIPES.recipeBuilder("mds_coil_block") - .inputItems(ChemicalHelper.get(ring,MolybdenumDisilicide,32)) - .inputItems(ChemicalHelper.get(foil,Graphene,16)) + .inputItems(ChemicalHelper.get(ring, MolybdenumDisilicide, 32)) + .inputItems(ChemicalHelper.get(foil, Graphene, 16)) .inputFluids(HSLASteel.getFluid(144)) .outputItems(MOLYBDENUM_DISILICIDE_COIL_BLOCK.asStack(1)) .duration(500).EUt(1920) .save(provider); ASSEMBLER_RECIPES.recipeBuilder("heat_vent") - .inputItems(ChemicalHelper.get(plate,TantalumCarbide,3)) - .inputItems(ChemicalHelper.get(plateDouble,MolybdenumDisilicide,2)) - .inputItems(ChemicalHelper.get(rotor,Titanium,1)) - .inputItems(ChemicalHelper.get(rodLong,MolybdenumDisilicide,1)) + .inputItems(ChemicalHelper.get(plate, TantalumCarbide, 3)) + .inputItems(ChemicalHelper.get(plateDouble, MolybdenumDisilicide, 2)) + .inputItems(ChemicalHelper.get(rotor, Titanium, 1)) + .inputItems(ChemicalHelper.get(rodLong, MolybdenumDisilicide, 1)) .outputItems(HEAT_VENT.asStack(2)) .duration(50).EUt(16) .save(provider); @@ -167,13 +257,15 @@ private static void registerAssemblerRecipes(Consumer provider){ .save(provider); ASSEMBLER_RECIPES.recipeBuilder("casing_high_temperature_smelting") - .inputItems(plate, TitaniumCarbide, 4).inputItems(plate, HSLASteel, 2).inputItems(frameGt, TungstenCarbide).circuitMeta(6) + .inputItems(plate, TitaniumCarbide, 4).inputItems(plate, HSLASteel, 2) + .inputItems(frameGt, TungstenCarbide).circuitMeta(6) .outputItems(CASING_HIGH_TEMPERATURE_SMELTING.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft)) .duration(50).EUt(16) .save(provider); ASSEMBLER_RECIPES.recipeBuilder("casing_reaction_safe_mixing") - .inputItems(TagPrefix.plate, GTMaterials.HastelloyX, 6).inputItems(TagPrefix.frameGt, GTMaterials.MaragingSteel300).circuitMeta(6) + .inputItems(TagPrefix.plate, GTMaterials.HastelloyX, 6) + .inputItems(TagPrefix.frameGt, GTMaterials.MaragingSteel300).circuitMeta(6) .outputItems(CASING_REACTION_SAFE.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft)) .duration(50).EUt(16) .save(provider); @@ -209,7 +301,7 @@ private static void registerAssemblerRecipes(Consumer provider){ .save(provider); } - private static void registerMixerRecipes(Consumer provider){ + private static void registerMixerRecipes(Consumer provider) { MIXER_RECIPES.recipeBuilder("tantalum_carbide") .inputItems(dust, Tantalum) .inputItems(dust, Carbon) diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MachineRecipeLoader.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MachineRecipeLoader.java index cceafc7479..3b30070b56 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MachineRecipeLoader.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MachineRecipeLoader.java @@ -11,12 +11,14 @@ import com.gregtechceu.gtceu.api.machine.multiblock.CleanroomType; import com.gregtechceu.gtceu.common.block.StoneBlockType; import com.gregtechceu.gtceu.common.data.GTBlocks; +import com.gregtechceu.gtceu.common.data.GTItems; import com.gregtechceu.gtceu.common.data.GTMachines; import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.data.recipe.CustomTags; import com.gregtechceu.gtceu.data.recipe.VanillaRecipeHelper; + import com.lowdragmc.lowdraglib.side.fluid.FluidStack; -import com.tterrag.registrate.util.entry.ItemEntry; + import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.resources.ResourceLocation; @@ -26,6 +28,8 @@ import net.minecraft.world.item.Items; import net.minecraft.world.level.block.Blocks; +import com.tterrag.registrate.util.entry.ItemEntry; + import java.util.List; import java.util.function.Consumer; @@ -38,8 +42,7 @@ public class MachineRecipeLoader { - private MachineRecipeLoader() { - } + private MachineRecipeLoader() {} public static void init(Consumer provider) { ComputerRecipes.init(provider); @@ -60,7 +63,6 @@ public static void init(Consumer provider) { } private static void registerBendingCompressingRecipes(Consumer provider) { - COMPRESSOR_RECIPES.recipeBuilder("compressed_fireclay") .inputItems(dust, Fireclay) .outputItems(COMPRESSED_FIRECLAY) @@ -192,51 +194,103 @@ private static void registerBendingCompressingRecipes(Consumer p } private static void registerPrimitiveBlastFurnaceRecipes(Consumer provider) { - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder("steel_from_coal_gem").inputItems(ingot, Iron).inputItems(gem, Coal, 2).outputItems(ingot, Steel).outputItems(dustTiny, DarkAsh, 2).duration(1800).save(provider); - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder("steel_from_coal_dust").inputItems(ingot, Iron).inputItems(dust, Coal, 2).outputItems(ingot, Steel).outputItems(dustTiny, DarkAsh, 2).duration(1800).save(provider); - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder("steel_from_charcoal_gem").inputItems(ingot, Iron).inputItems(gem, Charcoal, 2).outputItems(ingot, Steel).outputItems(dustTiny, DarkAsh, 2).duration(1800).save(provider); - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder("steel_from_charcoal_dust").inputItems(ingot, Iron).inputItems(dust, Charcoal, 2).outputItems(ingot, Steel).outputItems(dustTiny, DarkAsh, 2).duration(1800).save(provider); - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder("steel_from_coke_gem").inputItems(ingot, Iron).inputItems(gem, Coke).outputItems(ingot, Steel).chancedOutput(dust, Ash, 1111, 0).duration(1500).save(provider); - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder("steel_from_coke_dust").inputItems(ingot, Iron).inputItems(dust, Coke).outputItems(ingot, Steel).chancedOutput(dust, Ash, 1111, 0).duration(1500).save(provider); - - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder("steel_from_coal_block").inputItems(block, Iron).inputItems(block, Coal, 2).outputItems(block, Steel).outputItems(dust, DarkAsh, 2).duration(16200).save(provider); - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder("steel_from_charcoal_block").inputItems(block, Iron).inputItems(block, Charcoal, 2).outputItems(block, Steel).outputItems(dust, DarkAsh, 2).duration(16200).save(provider); - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder("steel_from_coke_block").inputItems(block, Iron).inputItems(block, Coke).outputItems(block, Steel).outputItems(dust, Ash).duration(13500).save(provider); - - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder("steel_from_coal_gem_wrought").inputItems(ingot, WroughtIron).inputItems(gem, Coal, 2).outputItems(ingot, Steel).outputItems(dustTiny, DarkAsh, 2).duration(800).save(provider); - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder("steel_from_coal_dust_wrought").inputItems(ingot, WroughtIron).inputItems(dust, Coal, 2).outputItems(ingot, Steel).outputItems(dustTiny, DarkAsh, 2).duration(800).save(provider); - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder("steel_from_charcoal_gem_wrought").inputItems(ingot, WroughtIron).inputItems(gem, Charcoal, 2).outputItems(ingot, Steel).outputItems(dustTiny, DarkAsh, 2).duration(800).save(provider); - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder("steel_from_charcoal_dust_wrought").inputItems(ingot, WroughtIron).inputItems(dust, Charcoal, 2).outputItems(ingot, Steel).outputItems(dustTiny, DarkAsh, 2).duration(800).save(provider); - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder("steel_from_coke_gem_wrought").inputItems(ingot, WroughtIron).inputItems(gem, Coke).outputItems(ingot, Steel).chancedOutput(dust, Ash, 1111, 0).duration(600).save(provider); - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder("steel_from_coke_dust_wrought").inputItems(ingot, WroughtIron).inputItems(dust, Coke).outputItems(ingot, Steel).chancedOutput(dust, Ash, 1111, 0).duration(600).save(provider); - - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder("steel_from_coal_block_wrought").inputItems(block, WroughtIron).inputItems(block, Coal, 2).outputItems(block, Steel).outputItems(dust, DarkAsh, 2).duration(7200).save(provider); - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder("steel_from_charcoal_block_wrought").inputItems(block, WroughtIron).inputItems(block, Charcoal, 2).outputItems(block, Steel).outputItems(dust, DarkAsh, 2).duration(7200).save(provider); - PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder("steel_from_coke_block_wrought").inputItems(block, WroughtIron).inputItems(block, Coke).outputItems(block, Steel).outputItems(dust, Ash).duration(5400).save(provider); + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder("steel_from_coal_gem").inputItems(ingot, Iron) + .inputItems(gem, Coal, 2).outputItems(ingot, Steel).outputItems(dustTiny, DarkAsh, 2).duration(1800) + .save(provider); + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder("steel_from_coal_dust").inputItems(ingot, Iron) + .inputItems(dust, Coal, 2).outputItems(ingot, Steel).outputItems(dustTiny, DarkAsh, 2).duration(1800) + .save(provider); + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder("steel_from_charcoal_gem").inputItems(ingot, Iron) + .inputItems(gem, Charcoal, 2).outputItems(ingot, Steel).outputItems(dustTiny, DarkAsh, 2).duration(1800) + .save(provider); + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder("steel_from_charcoal_dust").inputItems(ingot, Iron) + .inputItems(dust, Charcoal, 2).outputItems(ingot, Steel).outputItems(dustTiny, DarkAsh, 2) + .duration(1800).save(provider); + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder("steel_from_coke_gem").inputItems(ingot, Iron) + .inputItems(gem, Coke).outputItems(ingot, Steel).chancedOutput(dust, Ash, 1111, 0).duration(1500) + .save(provider); + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder("steel_from_coke_dust").inputItems(ingot, Iron) + .inputItems(dust, Coke).outputItems(ingot, Steel).chancedOutput(dust, Ash, 1111, 0).duration(1500) + .save(provider); + + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder("steel_from_coal_block").inputItems(block, Iron) + .inputItems(block, Coal, 2).outputItems(block, Steel).outputItems(dust, DarkAsh, 2).duration(16200) + .save(provider); + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder("steel_from_charcoal_block").inputItems(block, Iron) + .inputItems(block, Charcoal, 2).outputItems(block, Steel).outputItems(dust, DarkAsh, 2).duration(16200) + .save(provider); + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder("steel_from_coke_block").inputItems(block, Iron) + .inputItems(block, Coke).outputItems(block, Steel).outputItems(dust, Ash).duration(13500) + .save(provider); + + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder("steel_from_coal_gem_wrought").inputItems(ingot, WroughtIron) + .inputItems(gem, Coal, 2).outputItems(ingot, Steel).outputItems(dustTiny, DarkAsh, 2).duration(800) + .save(provider); + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder("steel_from_coal_dust_wrought").inputItems(ingot, WroughtIron) + .inputItems(dust, Coal, 2).outputItems(ingot, Steel).outputItems(dustTiny, DarkAsh, 2).duration(800) + .save(provider); + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder("steel_from_charcoal_gem_wrought").inputItems(ingot, WroughtIron) + .inputItems(gem, Charcoal, 2).outputItems(ingot, Steel).outputItems(dustTiny, DarkAsh, 2).duration(800) + .save(provider); + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder("steel_from_charcoal_dust_wrought").inputItems(ingot, WroughtIron) + .inputItems(dust, Charcoal, 2).outputItems(ingot, Steel).outputItems(dustTiny, DarkAsh, 2).duration(800) + .save(provider); + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder("steel_from_coke_gem_wrought").inputItems(ingot, WroughtIron) + .inputItems(gem, Coke).outputItems(ingot, Steel).chancedOutput(dust, Ash, 1111, 0).duration(600) + .save(provider); + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder("steel_from_coke_dust_wrought").inputItems(ingot, WroughtIron) + .inputItems(dust, Coke).outputItems(ingot, Steel).chancedOutput(dust, Ash, 1111, 0).duration(600) + .save(provider); + + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder("steel_from_coal_block_wrought").inputItems(block, WroughtIron) + .inputItems(block, Coal, 2).outputItems(block, Steel).outputItems(dust, DarkAsh, 2).duration(7200) + .save(provider); + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder("steel_from_charcoal_block_wrought") + .inputItems(block, WroughtIron).inputItems(block, Charcoal, 2).outputItems(block, Steel) + .outputItems(dust, DarkAsh, 2).duration(7200).save(provider); + PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder("steel_from_coke_block_wrought").inputItems(block, WroughtIron) + .inputItems(block, Coke).outputItems(block, Steel).outputItems(dust, Ash).duration(5400).save(provider); } private static void registerCokeOvenRecipes(Consumer provider) { - COKE_OVEN_RECIPES.recipeBuilder("log_to_charcoal").inputItems(ItemTags.LOGS).outputItems(gem, Charcoal).outputFluids(Creosote.getFluid(250)).duration(900).save(provider); - COKE_OVEN_RECIPES.recipeBuilder("coal_to_coke").inputItems(gem, Coal).outputItems(gem, Coke).outputFluids(Creosote.getFluid(500)).duration(900).save(provider); - COKE_OVEN_RECIPES.recipeBuilder("coal_to_coke_block").inputItems(block, Coal).outputItems(block, Coke).outputFluids(Creosote.getFluid(4500)).duration(8100).save(provider); + COKE_OVEN_RECIPES.recipeBuilder("log_to_charcoal").inputItems(ItemTags.LOGS).outputItems(gem, Charcoal) + .outputFluids(Creosote.getFluid(250)).duration(900).save(provider); + COKE_OVEN_RECIPES.recipeBuilder("coal_to_coke").inputItems(gem, Coal).outputItems(gem, Coke) + .outputFluids(Creosote.getFluid(500)).duration(900).save(provider); + COKE_OVEN_RECIPES.recipeBuilder("coal_to_coke_block").inputItems(block, Coal).outputItems(block, Coke) + .outputFluids(Creosote.getFluid(4500)).duration(8100).save(provider); } private static void registerStoneBricksRecipes(Consumer provider) { // normal variant -> cobble variant - List cobbles = GTBlocks.STONE_BLOCKS.row(StoneBlockType.COBBLE).values().stream().map(ItemStack::new).toList(); - List mossCobbles = GTBlocks.STONE_BLOCKS.row(StoneBlockType.COBBLE_MOSSY).values().stream().map(ItemStack::new).toList(); - List stones = GTBlocks.STONE_BLOCKS.row(StoneBlockType.STONE).values().stream().map(ItemStack::new).toList(); - List polisheds = GTBlocks.STONE_BLOCKS.row(StoneBlockType.POLISHED).values().stream().map(ItemStack::new).toList(); - List bricks = GTBlocks.STONE_BLOCKS.row(StoneBlockType.BRICKS).values().stream().map(ItemStack::new).toList(); - List crackedBricks = GTBlocks.STONE_BLOCKS.row(StoneBlockType.BRICKS_CRACKED).values().stream().map(ItemStack::new).toList(); - List mossBricks = GTBlocks.STONE_BLOCKS.row(StoneBlockType.BRICKS_MOSSY).values().stream().map(ItemStack::new).toList(); - List chiseledBricks = GTBlocks.STONE_BLOCKS.row(StoneBlockType.CHISELED).values().stream().map(ItemStack::new).toList(); - List tiledBricks = GTBlocks.STONE_BLOCKS.row(StoneBlockType.TILED).values().stream().map(ItemStack::new).toList(); - List smallTiledBricks = GTBlocks.STONE_BLOCKS.row(StoneBlockType.TILED_SMALL).values().stream().map(ItemStack::new).toList(); - List windmillA = GTBlocks.STONE_BLOCKS.row(StoneBlockType.WINDMILL_A).values().stream().map(ItemStack::new).toList(); - List windmillB = GTBlocks.STONE_BLOCKS.row(StoneBlockType.WINDMILL_B).values().stream().map(ItemStack::new).toList(); - List squareBricks = GTBlocks.STONE_BLOCKS.row(StoneBlockType.BRICKS_SQUARE).values().stream().map(ItemStack::new).toList(); - List smallBricks = GTBlocks.STONE_BLOCKS.row(StoneBlockType.BRICKS_SMALL).values().stream().map(ItemStack::new).toList(); + List cobbles = GTBlocks.STONE_BLOCKS.row(StoneBlockType.COBBLE).values().stream().map(ItemStack::new) + .toList(); + List mossCobbles = GTBlocks.STONE_BLOCKS.row(StoneBlockType.COBBLE_MOSSY).values().stream() + .map(ItemStack::new).toList(); + List stones = GTBlocks.STONE_BLOCKS.row(StoneBlockType.STONE).values().stream().map(ItemStack::new) + .toList(); + List polisheds = GTBlocks.STONE_BLOCKS.row(StoneBlockType.POLISHED).values().stream() + .map(ItemStack::new).toList(); + List bricks = GTBlocks.STONE_BLOCKS.row(StoneBlockType.BRICKS).values().stream().map(ItemStack::new) + .toList(); + List crackedBricks = GTBlocks.STONE_BLOCKS.row(StoneBlockType.BRICKS_CRACKED).values().stream() + .map(ItemStack::new).toList(); + List mossBricks = GTBlocks.STONE_BLOCKS.row(StoneBlockType.BRICKS_MOSSY).values().stream() + .map(ItemStack::new).toList(); + List chiseledBricks = GTBlocks.STONE_BLOCKS.row(StoneBlockType.CHISELED).values().stream() + .map(ItemStack::new).toList(); + List tiledBricks = GTBlocks.STONE_BLOCKS.row(StoneBlockType.TILED).values().stream() + .map(ItemStack::new).toList(); + List smallTiledBricks = GTBlocks.STONE_BLOCKS.row(StoneBlockType.TILED_SMALL).values().stream() + .map(ItemStack::new).toList(); + List windmillA = GTBlocks.STONE_BLOCKS.row(StoneBlockType.WINDMILL_A).values().stream() + .map(ItemStack::new).toList(); + List windmillB = GTBlocks.STONE_BLOCKS.row(StoneBlockType.WINDMILL_B).values().stream() + .map(ItemStack::new).toList(); + List squareBricks = GTBlocks.STONE_BLOCKS.row(StoneBlockType.BRICKS_SQUARE).values().stream() + .map(ItemStack::new).toList(); + List smallBricks = GTBlocks.STONE_BLOCKS.row(StoneBlockType.BRICKS_SMALL).values().stream() + .map(ItemStack::new).toList(); registerSmoothRecipe(provider, cobbles, stones); registerCobbleRecipe(provider, stones, cobbles); @@ -264,19 +318,18 @@ private static void registerStoneBricksRecipes(Consumer provider } private static void registerMixingCrystallizationRecipes(Consumer provider) { - AUTOCLAVE_RECIPES.recipeBuilder("silicon_dioxide_to_quartzite_gem") .inputItems(dust, SiliconDioxide) .inputFluids(DistilledWater.getFluid(250)) .chancedOutput(ChemicalHelper.get(gem, Quartzite), 1000, 1000) .duration(1200).EUt(24).save(provider); - //todo find UU-Matter replacement -// AUTOCLAVE_RECIPES.recipeBuilder() -// .inputItems(dust, NetherStar) -// .inputFluids(UUMatter.getFluid(576)) -// .chancedOutput(new ItemStack(Items.NETHER_STAR), 3333, 3333) -// .duration(72000).EUt(VA[HV]).save(provider); + // todo find UU-Matter replacement + // AUTOCLAVE_RECIPES.recipeBuilder() + // .inputItems(dust, NetherStar) + // .inputFluids(UUMatter.getFluid(576)) + // .chancedOutput(new ItemStack(Items.NETHER_STAR), 3333, 3333) + // .duration(72000).EUt(VA[HV]).save(provider); MIXER_RECIPES.recipeBuilder("indium_concentrate") .inputItems(crushedPurified, Sphalerite) @@ -287,47 +340,48 @@ private static void registerMixingCrystallizationRecipes(Consumer provider) { for (MaterialStack[] stack : alloySmelterList) { - String recipeNape = stack[0].material().getName() + "_%s_and_" + stack[1].material().getName() + "_%s_into_" + stack[2].material().getName(); + String recipeNape = stack[0].material().getName() + "_%s_and_" + stack[1].material().getName() + + "_%s_into_" + stack[2].material().getName(); if (stack[0].material().hasProperty(PropertyKey.INGOT)) { ALLOY_SMELTER_RECIPES.recipeBuilder(String.format(recipeNape, "ingot", "dust")) .duration((int) stack[2].amount() * 50).EUt(16) @@ -344,8 +398,8 @@ private static void registerAlloyRecipes(Consumer provider) { .outputItems(ChemicalHelper.get(ingot, stack[2].material(), (int) stack[2].amount())) .save(provider); } - if (stack[0].material().hasProperty(PropertyKey.INGOT) - && stack[1].material().hasProperty(PropertyKey.INGOT)) { + if (stack[0].material().hasProperty(PropertyKey.INGOT) && + stack[1].material().hasProperty(PropertyKey.INGOT)) { ALLOY_SMELTER_RECIPES.recipeBuilder(String.format(recipeNape, "ingot", "ingot")) .duration((int) stack[2].amount() * 50).EUt(16) .inputItems(ingot, stack[0].material(), (int) stack[0].amount()) @@ -361,14 +415,19 @@ private static void registerAlloyRecipes(Consumer provider) { .save(provider); } - COMPRESSOR_RECIPES.recipeBuilder("carbon_mesh").inputItems(CARBON_FIBERS, 2).outputItems(CARBON_MESH).duration(100).EUt(2).save(provider); - COMPRESSOR_RECIPES.recipeBuilder("carbon_fiber_plate").inputItems(CARBON_MESH).outputItems(CARBON_FIBER_PLATE).duration(200).EUt(2).save(provider); + COMPRESSOR_RECIPES.recipeBuilder("carbon_mesh").inputItems(CARBON_FIBERS, 2).outputItems(CARBON_MESH) + .duration(100).EUt(2).save(provider); + COMPRESSOR_RECIPES.recipeBuilder("carbon_fiber_plate").inputItems(CARBON_MESH).outputItems(CARBON_FIBER_PLATE) + .duration(200).EUt(2).save(provider); - ALLOY_SMELTER_RECIPES.recipeBuilder("rubber_sheet").duration(10).EUt(VA[ULV]).inputItems(ingot, Rubber, 2).notConsumable(SHAPE_MOLD_PLATE).outputItems(plate, Rubber).save(provider); - ALLOY_SMELTER_RECIPES.recipeBuilder("rubber_bar").duration(100).EUt(VA[ULV]).inputItems(dust, Sulfur).inputItems(dust, RawRubber, 3).outputItems(ingot, Rubber).save(provider); + ALLOY_SMELTER_RECIPES.recipeBuilder("rubber_sheet").duration(10).EUt(VA[ULV]).inputItems(ingot, Rubber, 2) + .notConsumable(SHAPE_MOLD_PLATE).outputItems(plate, Rubber).save(provider); + ALLOY_SMELTER_RECIPES.recipeBuilder("rubber_bar").duration(100).EUt(VA[ULV]).inputItems(dust, Sulfur) + .inputItems(dust, RawRubber, 3).outputItems(ingot, Rubber).save(provider); // todo tag stuff - //ALLOY_SMELTER_RECIPES.recipeBuilder("coke_oven_brick").duration(150).EUt(VA[ULV]).inputItems(OreDictUnifier.get("sand")).inputItems(new ItemStack(Items.CLAY_BALL)).outputItems(COKE_OVEN_BRICK, 2).save(provider); + // ALLOY_SMELTER_RECIPES.recipeBuilder("coke_oven_brick").duration(150).EUt(VA[ULV]).inputItems(OreDictUnifier.get("sand")).inputItems(new + // ItemStack(Items.CLAY_BALL)).outputItems(COKE_OVEN_BRICK, 2).save(provider); } private static void registerAssemblerRecipes(Consumer provider) { @@ -389,10 +448,22 @@ private static void registerAssemblerRecipes(Consumer provider) .save(provider); CANNER_RECIPES.recipeBuilder("mask_filter") - .inputItems(plate, Polyethylene,4) - .inputItems(dust, ActivatedCarbon, 2) - .outputItems(MASK_FILTER) - .duration(100).EUt(2).save(provider); + .inputItems(plate, Polyethylene, 4) + .inputItems(dust, ActivatedCarbon, 2) + .outputItems(MASK_FILTER) + .duration(100).EUt(2).save(provider); + + CANNER_RECIPES.recipeBuilder("pack_paracetamol") + .inputItems(dust, Paracetamol, 16) + .notConsumable(GTItems.SHAPE_MOLD_PILL) + .outputItems(GTItems.PARACETAMOL_PILL.asStack(16)) + .duration(60).EUt(VA[LV]).save(provider); + + CANNER_RECIPES.recipeBuilder("pack_rad_away") + .inputItems(dust, RadAway, 16) + .notConsumable(GTItems.SHAPE_MOLD_PILL) + .outputItems(GTItems.RAD_AWAY_PILL.asStack(16)) + .duration(60).EUt(VA[LV]).save(provider); Material material = Iron; @@ -404,12 +475,12 @@ private static void registerAssemblerRecipes(Consumer provider) .save(provider); // TODO Crafting station, crafting cover - //ASSEMBLER_RECIPES.recipeBuilder("cover_crafting") - // .inputItems(WORKBENCH) - // .inputItems(plate, material) - // .outputItems(COVER_CRAFTING) - // .EUt(16).duration(100) - // .save(provider); + // ASSEMBLER_RECIPES.recipeBuilder("cover_crafting") + // .inputItems(WORKBENCH) + // .inputItems(plate, material) + // .outputItems(COVER_CRAFTING) + // .EUt(16).duration(100) + // .save(provider); FluidStack solder = SolderingAlloy.getFluid(L / 2); @@ -524,103 +595,271 @@ private static void registerAssemblerRecipes(Consumer provider) .save(provider); // TODO Storage cover - //ASSEMBLER_RECIPES.recipeBuilder() - // .inputItems(OreDictNames.chestWood.toString()) - // .inputItems(ELECTRIC_PISTON_LV) - // .inputItems(plate, Iron) - // .inputFluids(SolderingAlloy.getFluid(72)) - // .outputItems(COVER_STORAGE) - // .EUt(16) - // .duration(100) - // .save(provider); - - ASSEMBLER_RECIPES.recipeBuilder("casing_ulv").EUt(16).inputItems(plate, WroughtIron, 8).outputItems(GTBlocks.MACHINE_CASING_ULV.asStack()).circuitMeta(8).duration(25).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("casing_lv").EUt(16).inputItems(plate, Steel, 8).outputItems(GTBlocks.MACHINE_CASING_LV.asStack()).circuitMeta(8).duration(50).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("casing_mv").EUt(16).inputItems(plate, Aluminium, 8).outputItems(GTBlocks.MACHINE_CASING_MV.asStack()).circuitMeta(8).duration(50).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("casing_hv").EUt(16).inputItems(plate, StainlessSteel, 8).outputItems(GTBlocks.MACHINE_CASING_HV.asStack()).circuitMeta(8).duration(50).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("casing_ev").EUt(16).inputItems(plate, Titanium, 8).outputItems(GTBlocks.MACHINE_CASING_EV.asStack()).circuitMeta(8).duration(50).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("casing_iv").EUt(16).inputItems(plate, TungstenSteel, 8).outputItems(GTBlocks.MACHINE_CASING_IV.asStack()).circuitMeta(8).duration(50).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("casing_luv").EUt(16).inputItems(plate, RhodiumPlatedPalladium, 8).outputItems(GTBlocks.MACHINE_CASING_LuV.asStack()).circuitMeta(8).duration(50).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("casing_zpm").EUt(16).inputItems(plate, NaquadahAlloy, 8).outputItems(GTBlocks.MACHINE_CASING_ZPM.asStack()).circuitMeta(8).duration(50).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("casing_uv").EUt(16).inputItems(plate, Darmstadtium, 8).outputItems(GTBlocks.MACHINE_CASING_UV.asStack()).circuitMeta(8).duration(50).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("casing_uhv").EUt(16).inputItems(plate, Neutronium, 8).outputItems(GTBlocks.MACHINE_CASING_UHV.asStack()).circuitMeta(8).duration(50).save(provider); - - ASSEMBLER_RECIPES.recipeBuilder("coil_cupronickel").EUt(VA[LV]).inputItems(wireGtDouble, Cupronickel, 8).inputItems(foil, Bronze, 8).inputFluids(TinAlloy.getFluid(GTValues.L)).outputItems(GTBlocks.COIL_CUPRONICKEL.asStack()).duration(200).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("coil_kanthal").EUt(VA[MV]).inputItems(wireGtDouble, Kanthal, 8).inputItems(foil, Aluminium, 8).inputFluids(Copper.getFluid(GTValues.L)).outputItems(GTBlocks.COIL_KANTHAL.asStack()).duration(300).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("coil_nichrome").EUt(VA[HV]).inputItems(wireGtDouble, Nichrome, 8).inputItems(foil, StainlessSteel, 8).inputFluids(Aluminium.getFluid(GTValues.L)).outputItems(GTBlocks.COIL_NICHROME.asStack()).duration(400).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("coil_rtm_alloy").EUt(VA[EV]).inputItems(wireGtDouble, RTMAlloy, 8).inputItems(foil, VanadiumSteel, 8).inputFluids(Nichrome.getFluid(GTValues.L)).outputItems(GTBlocks.COIL_RTMALLOY.asStack()).duration(500).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("coil_hssg").EUt(VA[IV]).inputItems(wireGtDouble, HSSG, 8).inputItems(foil, TungstenCarbide, 8).inputFluids(Tungsten.getFluid(GTValues.L)).outputItems(GTBlocks.COIL_HSSG.asStack()).duration(600).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("coil_naquadah").EUt(VA[LuV]).inputItems(wireGtDouble, Naquadah, 8).inputItems(foil, Osmium, 8).inputFluids(TungstenSteel.getFluid(GTValues.L)).outputItems(GTBlocks.COIL_NAQUADAH.asStack()).duration(700).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("coil_trinium").EUt(VA[ZPM]).inputItems(wireGtDouble, Trinium, 8).inputItems(foil, NaquadahEnriched, 8).inputFluids(Naquadah.getFluid(GTValues.L)).outputItems(GTBlocks.COIL_TRINIUM.asStack()).duration(800).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("coil_tritanium").EUt(VA[UV]).inputItems(wireGtDouble, Tritanium, 8).inputItems(foil, Naquadria, 8).inputFluids(Trinium.getFluid(GTValues.L)).outputItems(GTBlocks.COIL_TRITANIUM.asStack()).duration(900).save(provider); - - ASSEMBLER_RECIPES.recipeBuilder("casing_bronze_bricks").EUt(16).inputItems(plate, Bronze, 6).inputItems(new ItemStack(Blocks.BRICKS)).circuitMeta(6).outputItems(GTBlocks.CASING_BRONZE_BRICKS.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft)).duration(50).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("casing_invar_heatproof").EUt(16).inputItems(plate, Invar, 6).inputItems(frameGt, Invar).circuitMeta(6).outputItems(GTBlocks.CASING_INVAR_HEATPROOF.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft)).duration(50).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("casing_steel_solid").EUt(16).inputItems(plate, Steel, 6).inputItems(frameGt, Steel).circuitMeta(6).outputItems(GTBlocks.CASING_STEEL_SOLID.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft)).duration(50).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("casing_aluminium_frostproof").EUt(16).inputItems(plate, Aluminium, 6).inputItems(frameGt, Aluminium).circuitMeta(6).outputItems(GTBlocks.CASING_ALUMINIUM_FROSTPROOF.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft)).duration(50).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("casing_tungsteensteel_robust").EUt(16).inputItems(plate, TungstenSteel, 6).inputItems(frameGt, TungstenSteel).circuitMeta(6).outputItems(GTBlocks.CASING_TUNGSTENSTEEL_ROBUST.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft)).duration(50).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("casing_stainless_clean").EUt(16).inputItems(plate, StainlessSteel, 6).inputItems(frameGt, StainlessSteel).circuitMeta(6).outputItems(GTBlocks.CASING_STAINLESS_CLEAN.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft)).duration(50).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("casing_titanium_stable").EUt(16).inputItems(plate, Titanium, 6).inputItems(frameGt, Titanium).circuitMeta(6).outputItems(GTBlocks.CASING_TITANIUM_STABLE.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft)).duration(50).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("casing_hsse_sturdy").EUt(16).inputItems(plate, HSSE, 6).inputItems(frameGt, Europium).circuitMeta(6).outputItems(GTBlocks.CASING_HSSE_STURDY.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft)).duration(50).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("casing_palladium_substation").EUt(16).inputItems(plate, Palladium, 6).inputItems(frameGt, Iridium).circuitMeta(6).outputItems(GTBlocks.CASING_PALLADIUM_SUBSTATION.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft)).duration(50).save(provider); - - ASSEMBLER_RECIPES.recipeBuilder("casing_ptfe_inert").EUt(16).inputItems(GTBlocks.CASING_STEEL_SOLID.asStack()).inputFluids(Polytetrafluoroethylene.getFluid(216)).circuitMeta(6).outputItems(GTBlocks.CASING_PTFE_INERT.asStack()).duration(50).save(provider); - - ASSEMBLER_RECIPES.recipeBuilder("superconducting_coil_luv").EUt(VA[LuV]).inputItems(wireGtDouble, IndiumTinBariumTitaniumCuprate, 32).inputItems(foil, NiobiumTitanium, 32).inputFluids(Trinium.getFluid(GTValues.L * 24)).outputItems(GTBlocks.SUPERCONDUCTING_COIL.asStack()).duration(100).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("superconducting_coil_zpm").EUt(VA[ZPM]).inputItems(wireGtDouble, UraniumRhodiumDinaquadide, 16).inputItems(foil, NiobiumTitanium, 16).inputFluids(Trinium.getFluid(GTValues.L * 16)).outputItems(GTBlocks.SUPERCONDUCTING_COIL.asStack()).duration(100).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("superconducting_coil_uv").EUt(VA[UV]).inputItems(wireGtDouble, EnrichedNaquadahTriniumEuropiumDuranide, 8).inputItems(foil, NiobiumTitanium, 8).inputFluids(Trinium.getFluid(GTValues.L * 8)).outputItems(GTBlocks.SUPERCONDUCTING_COIL.asStack()).duration(100).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("fusion_coil").EUt(VA[ZPM]).inputItems(GTBlocks.SUPERCONDUCTING_COIL.asStack()).inputItems(FIELD_GENERATOR_IV.asStack(2)).inputItems(ELECTRIC_PUMP_IV).inputItems(NEUTRON_REFLECTOR.asStack(2)).inputItems(CustomTags.LuV_CIRCUITS, 4).inputItems(pipeSmallFluid, Naquadah, 4).inputItems(plate, Europium, 4).inputFluids(VanadiumGallium.getFluid(GTValues.L * 4)).outputItems(GTBlocks.FUSION_COIL.asStack()).duration(100).cleanroom(CleanroomType.CLEANROOM).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("fusion_glass").EUt(VA[LuV]).inputItems(GTBlocks.CASING_LAMINATED_GLASS.asStack()).inputItems(plate, Naquadah, 4).inputItems(NEUTRON_REFLECTOR.asStack(4)).outputItems(GTBlocks.FUSION_GLASS.asStack(2)).inputFluids(Polybenzimidazole.getFluid(GTValues.L)).duration(50).cleanroom(CleanroomType.CLEANROOM).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("fusion_casing").EUt(VA[LuV]).inputItems(GTBlocks.MACHINE_CASING_LuV.asStack()).inputItems(GTBlocks.SUPERCONDUCTING_COIL.asStack()).inputItems(NEUTRON_REFLECTOR).inputItems(ELECTRIC_PUMP_LuV).inputItems(plate, TungstenSteel, 6).inputFluids(Polybenzimidazole.getFluid(GTValues.L)).outputItems(GTBlocks.FUSION_CASING.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft)).duration(100).cleanroom(CleanroomType.CLEANROOM).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("fusion_casing_mk2").EUt(VA[ZPM]).inputItems(GTBlocks.MACHINE_CASING_ZPM.asStack()).inputItems(GTBlocks.FUSION_COIL.asStack()).inputItems(VOLTAGE_COIL_ZPM.asStack(2)).inputItems(FIELD_GENERATOR_LuV).inputItems(plate, Europium, 6).inputFluids(Polybenzimidazole.getFluid(GTValues.L * 2)).outputItems(GTBlocks.FUSION_CASING_MK2.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft)).duration(100).cleanroom(CleanroomType.CLEANROOM).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("fusion_casing_mk3").EUt(VA[UV]).inputItems(GTBlocks.MACHINE_CASING_UV.asStack()).inputItems(GTBlocks.FUSION_COIL.asStack()).inputItems(VOLTAGE_COIL_UV.asStack(2)).inputItems(FIELD_GENERATOR_ZPM).inputItems(plate, Americium, 6).inputFluids(Polybenzimidazole.getFluid(GTValues.L * 4)).outputItems(GTBlocks.FUSION_CASING_MK3.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft)).duration(100).cleanroom(CleanroomType.CLEANROOM).save(provider); - - ASSEMBLER_RECIPES.recipeBuilder("casing_steel_turbine").EUt(16).inputItems(plate, Magnalium, 6).inputItems(frameGt, BlueSteel, 1).circuitMeta(6).outputItems(GTBlocks.CASING_STEEL_TURBINE.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft)).duration(50).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("casing_stainless_steel_turbine").EUt(16).inputItems(GTBlocks.CASING_STEEL_TURBINE.asStack()).inputItems(plate, StainlessSteel, 6).circuitMeta(6).outputItems(GTBlocks.CASING_STAINLESS_TURBINE.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft)).duration(50).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("casing_titanium_turbine").EUt(16).inputItems(GTBlocks.CASING_STEEL_TURBINE.asStack()).inputItems(plate, Titanium, 6).circuitMeta(6).outputItems(GTBlocks.CASING_TITANIUM_TURBINE.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft)).duration(50).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("casing_tungstensteel_turbine").EUt(16).inputItems(GTBlocks.CASING_STEEL_TURBINE.asStack()).inputItems(plate, TungstenSteel, 6).circuitMeta(6).outputItems(GTBlocks.CASING_TUNGSTENSTEEL_TURBINE.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft)).duration(50).save(provider); - - ASSEMBLER_RECIPES.recipeBuilder("plascrete").EUt(48).inputItems(frameGt, Steel).inputItems(plate, Polyethylene, 6).inputFluids(Concrete.getFluid(L)).outputItems(GTBlocks.PLASTCRETE.asStack(2)).duration(200).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("cleanroom_glass").EUt(48).inputItems(frameGt, Steel).inputItems(plate, Polyethylene, 6).inputFluids(Glass.getFluid(L)).outputItems(GTBlocks.CLEANROOM_GLASS.asStack(2)).duration(200).save(provider); + // ASSEMBLER_RECIPES.recipeBuilder() + // .inputItems(OreDictNames.chestWood.toString()) + // .inputItems(ELECTRIC_PISTON_LV) + // .inputItems(plate, Iron) + // .inputFluids(SolderingAlloy.getFluid(72)) + // .outputItems(COVER_STORAGE) + // .EUt(16) + // .duration(100) + // .save(provider); + + ASSEMBLER_RECIPES.recipeBuilder("casing_ulv").EUt(16).inputItems(plate, WroughtIron, 8) + .outputItems(GTBlocks.MACHINE_CASING_ULV.asStack()).circuitMeta(8).duration(25).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("casing_lv").EUt(16).inputItems(plate, Steel, 8) + .outputItems(GTBlocks.MACHINE_CASING_LV.asStack()).circuitMeta(8).duration(50).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("casing_mv").EUt(16).inputItems(plate, Aluminium, 8) + .outputItems(GTBlocks.MACHINE_CASING_MV.asStack()).circuitMeta(8).duration(50).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("casing_hv").EUt(16).inputItems(plate, StainlessSteel, 8) + .outputItems(GTBlocks.MACHINE_CASING_HV.asStack()).circuitMeta(8).duration(50).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("casing_ev").EUt(16).inputItems(plate, Titanium, 8) + .outputItems(GTBlocks.MACHINE_CASING_EV.asStack()).circuitMeta(8).duration(50).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("casing_iv").EUt(16).inputItems(plate, TungstenSteel, 8) + .outputItems(GTBlocks.MACHINE_CASING_IV.asStack()).circuitMeta(8).duration(50).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("casing_luv").EUt(16).inputItems(plate, RhodiumPlatedPalladium, 8) + .outputItems(GTBlocks.MACHINE_CASING_LuV.asStack()).circuitMeta(8).duration(50).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("casing_zpm").EUt(16).inputItems(plate, NaquadahAlloy, 8) + .outputItems(GTBlocks.MACHINE_CASING_ZPM.asStack()).circuitMeta(8).duration(50).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("casing_uv").EUt(16).inputItems(plate, Darmstadtium, 8) + .outputItems(GTBlocks.MACHINE_CASING_UV.asStack()).circuitMeta(8).duration(50).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("casing_uhv").EUt(16).inputItems(plate, Neutronium, 8) + .outputItems(GTBlocks.MACHINE_CASING_UHV.asStack()).circuitMeta(8).duration(50).save(provider); + + ASSEMBLER_RECIPES.recipeBuilder("coil_cupronickel").EUt(VA[LV]).inputItems(wireGtDouble, Cupronickel, 8) + .inputItems(foil, Bronze, 8).inputFluids(TinAlloy.getFluid(GTValues.L)) + .outputItems(GTBlocks.COIL_CUPRONICKEL.asStack()).duration(200).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("coil_kanthal").EUt(VA[MV]).inputItems(wireGtDouble, Kanthal, 8) + .inputItems(foil, Aluminium, 8).inputFluids(Copper.getFluid(GTValues.L)) + .outputItems(GTBlocks.COIL_KANTHAL.asStack()).duration(300).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("coil_nichrome").EUt(VA[HV]).inputItems(wireGtDouble, Nichrome, 8) + .inputItems(foil, StainlessSteel, 8).inputFluids(Aluminium.getFluid(GTValues.L)) + .outputItems(GTBlocks.COIL_NICHROME.asStack()).duration(400).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("coil_rtm_alloy").EUt(VA[EV]).inputItems(wireGtDouble, RTMAlloy, 8) + .inputItems(foil, VanadiumSteel, 8).inputFluids(Nichrome.getFluid(GTValues.L)) + .outputItems(GTBlocks.COIL_RTMALLOY.asStack()).duration(500).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("coil_hssg").EUt(VA[IV]).inputItems(wireGtDouble, HSSG, 8) + .inputItems(foil, TungstenCarbide, 8).inputFluids(Tungsten.getFluid(GTValues.L)) + .outputItems(GTBlocks.COIL_HSSG.asStack()).duration(600).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("coil_naquadah").EUt(VA[LuV]).inputItems(wireGtDouble, Naquadah, 8) + .inputItems(foil, Osmium, 8).inputFluids(TungstenSteel.getFluid(GTValues.L)) + .outputItems(GTBlocks.COIL_NAQUADAH.asStack()).duration(700).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("coil_trinium").EUt(VA[ZPM]).inputItems(wireGtDouble, Trinium, 8) + .inputItems(foil, NaquadahEnriched, 8).inputFluids(Naquadah.getFluid(GTValues.L)) + .outputItems(GTBlocks.COIL_TRINIUM.asStack()).duration(800).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("coil_tritanium").EUt(VA[UV]).inputItems(wireGtDouble, Tritanium, 8) + .inputItems(foil, Naquadria, 8).inputFluids(Trinium.getFluid(GTValues.L)) + .outputItems(GTBlocks.COIL_TRITANIUM.asStack()).duration(900).save(provider); + + ASSEMBLER_RECIPES.recipeBuilder("casing_bronze_bricks").EUt(16).inputItems(plate, Bronze, 6) + .inputItems(new ItemStack(Blocks.BRICKS)).circuitMeta(6) + .outputItems(GTBlocks.CASING_BRONZE_BRICKS.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft)) + .duration(50).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("casing_invar_heatproof").EUt(16).inputItems(plate, Invar, 6) + .inputItems(frameGt, Invar).circuitMeta(6) + .outputItems(GTBlocks.CASING_INVAR_HEATPROOF.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft)) + .duration(50).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("casing_steel_solid").EUt(16).inputItems(plate, Steel, 6) + .inputItems(frameGt, Steel).circuitMeta(6) + .outputItems(GTBlocks.CASING_STEEL_SOLID.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft)) + .duration(50).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("casing_aluminium_frostproof").EUt(16).inputItems(plate, Aluminium, 6) + .inputItems(frameGt, Aluminium).circuitMeta(6) + .outputItems( + GTBlocks.CASING_ALUMINIUM_FROSTPROOF.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft)) + .duration(50).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("casing_tungsteensteel_robust").EUt(16).inputItems(plate, TungstenSteel, 6) + .inputItems(frameGt, TungstenSteel).circuitMeta(6) + .outputItems( + GTBlocks.CASING_TUNGSTENSTEEL_ROBUST.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft)) + .duration(50).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("casing_stainless_clean").EUt(16).inputItems(plate, StainlessSteel, 6) + .inputItems(frameGt, StainlessSteel).circuitMeta(6) + .outputItems(GTBlocks.CASING_STAINLESS_CLEAN.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft)) + .duration(50).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("casing_titanium_stable").EUt(16).inputItems(plate, Titanium, 6) + .inputItems(frameGt, Titanium).circuitMeta(6) + .outputItems(GTBlocks.CASING_TITANIUM_STABLE.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft)) + .duration(50).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("casing_hsse_sturdy").EUt(16).inputItems(plate, HSSE, 6) + .inputItems(frameGt, Europium).circuitMeta(6) + .outputItems(GTBlocks.CASING_HSSE_STURDY.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft)) + .duration(50).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("casing_palladium_substation").EUt(16).inputItems(plate, Palladium, 6) + .inputItems(frameGt, Iridium).circuitMeta(6) + .outputItems( + GTBlocks.CASING_PALLADIUM_SUBSTATION.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft)) + .duration(50).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("casing_stainless_evaporation") + .inputItems(GTBlocks.CASING_STAINLESS_CLEAN.asStack(1)) + .inputItems(wireGtDouble, AnnealedCopper, 4) + .inputFluids(PolyvinylChloride.getFluid(L * 2)) + .outputItems(GTBlocks.CASING_STAINLESS_EVAPORATION.asStack(1)) + .duration(30).EUt(VA[HV]).save(provider); + + ASSEMBLER_RECIPES.recipeBuilder("casing_ptfe_inert").EUt(16).inputItems(GTBlocks.CASING_STEEL_SOLID.asStack()) + .inputFluids(Polytetrafluoroethylene.getFluid(216)).circuitMeta(6) + .outputItems(GTBlocks.CASING_PTFE_INERT.asStack()).duration(50).save(provider); + + ASSEMBLER_RECIPES.recipeBuilder("superconducting_coil_luv").EUt(VA[LuV]) + .inputItems(wireGtDouble, IndiumTinBariumTitaniumCuprate, 32).inputItems(foil, NiobiumTitanium, 32) + .inputFluids(Trinium.getFluid(GTValues.L * 24)).outputItems(GTBlocks.SUPERCONDUCTING_COIL.asStack()) + .duration(100).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("superconducting_coil_zpm").EUt(VA[ZPM]) + .inputItems(wireGtDouble, UraniumRhodiumDinaquadide, 16).inputItems(foil, NiobiumTitanium, 16) + .inputFluids(Trinium.getFluid(GTValues.L * 16)).outputItems(GTBlocks.SUPERCONDUCTING_COIL.asStack()) + .duration(100).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("superconducting_coil_uv").EUt(VA[UV]) + .inputItems(wireGtDouble, EnrichedNaquadahTriniumEuropiumDuranide, 8) + .inputItems(foil, NiobiumTitanium, 8).inputFluids(Trinium.getFluid(GTValues.L * 8)) + .outputItems(GTBlocks.SUPERCONDUCTING_COIL.asStack()).duration(100).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("fusion_coil").EUt(VA[ZPM]).inputItems(GTBlocks.SUPERCONDUCTING_COIL.asStack()) + .inputItems(FIELD_GENERATOR_IV.asStack(2)).inputItems(ELECTRIC_PUMP_IV) + .inputItems(NEUTRON_REFLECTOR.asStack(2)).inputItems(CustomTags.LuV_CIRCUITS, 4) + .inputItems(pipeSmallFluid, Naquadah, 4).inputItems(plate, Europium, 4) + .inputFluids(VanadiumGallium.getFluid(GTValues.L * 4)).outputItems(GTBlocks.FUSION_COIL.asStack()) + .duration(100).cleanroom(CleanroomType.CLEANROOM).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("fusion_glass").EUt(VA[LuV]) + .inputItems(GTBlocks.CASING_LAMINATED_GLASS.asStack()).inputItems(plate, Naquadah, 4) + .inputItems(NEUTRON_REFLECTOR.asStack(4)).outputItems(GTBlocks.FUSION_GLASS.asStack(2)) + .inputFluids(Polybenzimidazole.getFluid(GTValues.L)).duration(50).cleanroom(CleanroomType.CLEANROOM) + .save(provider); + ASSEMBLER_RECIPES.recipeBuilder("fusion_casing").EUt(VA[LuV]).inputItems(GTBlocks.MACHINE_CASING_LuV.asStack()) + .inputItems(GTBlocks.SUPERCONDUCTING_COIL.asStack()).inputItems(NEUTRON_REFLECTOR) + .inputItems(ELECTRIC_PUMP_LuV).inputItems(plate, TungstenSteel, 6) + .inputFluids(Polybenzimidazole.getFluid(GTValues.L)) + .outputItems(GTBlocks.FUSION_CASING.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft)) + .duration(100).cleanroom(CleanroomType.CLEANROOM).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("fusion_casing_mk2").EUt(VA[ZPM]) + .inputItems(GTBlocks.MACHINE_CASING_ZPM.asStack()).inputItems(GTBlocks.FUSION_COIL.asStack()) + .inputItems(VOLTAGE_COIL_ZPM.asStack(2)).inputItems(FIELD_GENERATOR_LuV).inputItems(plate, Europium, 6) + .inputFluids(Polybenzimidazole.getFluid(GTValues.L * 2)) + .outputItems(GTBlocks.FUSION_CASING_MK2.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft)) + .duration(100).cleanroom(CleanroomType.CLEANROOM).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("fusion_casing_mk3").EUt(VA[UV]) + .inputItems(GTBlocks.MACHINE_CASING_UV.asStack()).inputItems(GTBlocks.FUSION_COIL.asStack()) + .inputItems(VOLTAGE_COIL_UV.asStack(2)).inputItems(FIELD_GENERATOR_ZPM).inputItems(plate, Americium, 6) + .inputFluids(Polybenzimidazole.getFluid(GTValues.L * 4)) + .outputItems(GTBlocks.FUSION_CASING_MK3.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft)) + .duration(100).cleanroom(CleanroomType.CLEANROOM).save(provider); + + ASSEMBLER_RECIPES.recipeBuilder("casing_steel_turbine").EUt(16).inputItems(plate, Magnalium, 6) + .inputItems(frameGt, BlueSteel, 1).circuitMeta(6) + .outputItems(GTBlocks.CASING_STEEL_TURBINE.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft)) + .duration(50).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("casing_stainless_steel_turbine").EUt(16) + .inputItems(GTBlocks.CASING_STEEL_TURBINE.asStack()).inputItems(plate, StainlessSteel, 6).circuitMeta(6) + .outputItems(GTBlocks.CASING_STAINLESS_TURBINE.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft)) + .duration(50).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("casing_titanium_turbine").EUt(16) + .inputItems(GTBlocks.CASING_STEEL_TURBINE.asStack()).inputItems(plate, Titanium, 6).circuitMeta(6) + .outputItems(GTBlocks.CASING_TITANIUM_TURBINE.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft)) + .duration(50).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("casing_tungstensteel_turbine").EUt(16) + .inputItems(GTBlocks.CASING_STEEL_TURBINE.asStack()).inputItems(plate, TungstenSteel, 6).circuitMeta(6) + .outputItems( + GTBlocks.CASING_TUNGSTENSTEEL_TURBINE.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft)) + .duration(50).save(provider); + + ASSEMBLER_RECIPES.recipeBuilder("plascrete").EUt(48).inputItems(frameGt, Steel) + .inputItems(plate, Polyethylene, 6).inputFluids(Concrete.getFluid(L)) + .outputItems(GTBlocks.PLASTCRETE.asStack(2)).duration(200).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("cleanroom_glass").EUt(48).inputItems(frameGt, Steel) + .inputItems(plate, Polyethylene, 6).inputFluids(Glass.getFluid(L)) + .outputItems(GTBlocks.CLEANROOM_GLASS.asStack(2)).duration(200).save(provider); // If these recipes are changed, change the values in MaterialInfoLoader.java - ASSEMBLER_RECIPES.recipeBuilder("hull_ulv").duration(25).EUt(16).inputItems(GTBlocks.MACHINE_CASING_ULV.asStack()).inputItems(cableGtSingle, RedAlloy, 2).inputFluids(Polyethylene.getFluid(L * 2)).outputItems(GTMachines.HULL[0]).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("hull_lv").duration(50).EUt(16).inputItems(GTBlocks.MACHINE_CASING_LV.asStack()).inputItems(cableGtSingle, Tin, 2).inputFluids(Polyethylene.getFluid(L * 2)).outputItems(GTMachines.HULL[1]).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("hull_mv").duration(50).EUt(16).inputItems(GTBlocks.MACHINE_CASING_MV.asStack()).inputItems(cableGtSingle, Copper, 2).inputFluids(Polyethylene.getFluid(L * 2)).outputItems(GTMachines.HULL[2]).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("hull_mv_annealed").duration(50).EUt(16).inputItems(GTBlocks.MACHINE_CASING_MV.asStack()).inputItems(cableGtSingle, AnnealedCopper, 2).inputFluids(Polyethylene.getFluid(L * 2)).outputItems(GTMachines.HULL[2]).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("hull_hv").duration(50).EUt(16).inputItems(GTBlocks.MACHINE_CASING_HV.asStack()).inputItems(cableGtSingle, Gold, 2).inputFluids(Polyethylene.getFluid(L * 2)).outputItems(GTMachines.HULL[3]).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("hull_ev").duration(50).EUt(16).inputItems(GTBlocks.MACHINE_CASING_EV.asStack()).inputItems(cableGtSingle, Aluminium, 2).inputFluids(Polyethylene.getFluid(L * 2)).outputItems(GTMachines.HULL[4]).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("hull_iv").duration(50).EUt(16).inputItems(GTBlocks.MACHINE_CASING_IV.asStack()).inputItems(cableGtSingle, Platinum, 2).inputFluids(Polytetrafluoroethylene.getFluid(L * 2)).outputItems(GTMachines.HULL[5]).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("hull_luv").duration(50).EUt(16).inputItems(GTBlocks.MACHINE_CASING_LuV.asStack()).inputItems(cableGtSingle, NiobiumTitanium, 2).inputFluids(Polytetrafluoroethylene.getFluid(L * 2)).outputItems(GTMachines.HULL[6]).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("hull_zpm").duration(50).EUt(16).inputItems(GTBlocks.MACHINE_CASING_ZPM.asStack()).inputItems(cableGtSingle, VanadiumGallium, 2).inputFluids(Polybenzimidazole.getFluid(L * 2)).outputItems(GTMachines.HULL[7]).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("hull_uv").duration(50).EUt(16).inputItems(GTBlocks.MACHINE_CASING_UV.asStack()).inputItems(cableGtSingle, YttriumBariumCuprate, 2).inputFluids(Polybenzimidazole.getFluid(L * 2)).outputItems(GTMachines.HULL[8]).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("hull_uhv").duration(50).EUt(16).inputItems(GTBlocks.MACHINE_CASING_UHV.asStack()).inputItems(cableGtSingle, Europium, 2).inputFluids(Polybenzimidazole.getFluid(L * 2)).outputItems(GTMachines.HULL[9]).save(provider); - - ASSEMBLER_RECIPES.recipeBuilder("hopper_iron").EUt(2).inputItems(CustomTags.WOODEN_CHESTS).inputItems(plate, Iron, 5).outputItems(new ItemStack(Blocks.HOPPER)).duration(800).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("hopper_wrought_iron").EUt(2).inputItems(CustomTags.WOODEN_CHESTS).inputItems(plate, WroughtIron, 5).outputItems(new ItemStack(Blocks.HOPPER)).duration(800).save(provider); - - ASSEMBLER_RECIPES.recipeBuilder("wooden_crate").EUt(16).inputItems(ItemTags.PLANKS, 4).inputItems(screw, Iron, 4).outputItems(WOODEN_CRATE).duration(100).circuitMeta(5).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("bronze_crate").EUt(16).inputItems(rodLong, Bronze, 4).inputItems(plate, Bronze, 4).outputItems(BRONZE_CRATE).duration(200).circuitMeta(1).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("steel_crate").EUt(16).inputItems(rodLong, Steel, 4).inputItems(plate, Steel, 4).outputItems(STEEL_CRATE).duration(200).circuitMeta(1).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("aluminium_crate").EUt(16).inputItems(rodLong, Aluminium, 4).inputItems(plate, Aluminium, 4).outputItems(ALUMINIUM_CRATE).duration(200).circuitMeta(1).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("stainless_steel_crate").EUt(16).inputItems(rodLong, StainlessSteel, 4).inputItems(plate, StainlessSteel, 4).outputItems(STAINLESS_STEEL_CRATE).circuitMeta(1).duration(200).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("titanium_crate").EUt(16).inputItems(rodLong, Titanium, 4).inputItems(plate, Titanium, 4).outputItems(TITANIUM_CRATE).duration(200).circuitMeta(1).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("tungstensteel_crate").EUt(16).inputItems(rodLong, TungstenSteel, 4).inputItems(plate, TungstenSteel, 4).outputItems(TUNGSTENSTEEL_CRATE).duration(200).circuitMeta(1).save(provider); - - ASSEMBLER_RECIPES.recipeBuilder("wood_barrel").EUt(16).inputItems(ItemTags.PLANKS, 4).inputItems(rodLong, Iron, 2).outputItems(WOODEN_DRUM).duration(200).circuitMeta(2).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("bronze_drum").EUt(16).inputItems(rodLong, Bronze, 2).inputItems(plate, Bronze, 4).outputItems(BRONZE_DRUM).duration(200).circuitMeta(2).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("steel_drum").EUt(16).inputItems(rodLong, Steel, 2).inputItems(plate, Steel, 4).outputItems(STEEL_DRUM).duration(200).circuitMeta(2).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("aluminium_drum").EUt(16).inputItems(rodLong, Aluminium, 2).inputItems(plate, Aluminium, 4).outputItems(ALUMINIUM_DRUM).duration(200).circuitMeta(2).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("stainless_steel_drum").EUt(16).inputItems(rodLong, StainlessSteel, 2).inputItems(plate, StainlessSteel, 4).outputItems(STAINLESS_STEEL_DRUM).duration(200).circuitMeta(2).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("gold_drum").EUt(16).inputItems(rodLong, Gold, 2).inputItems(plate, Gold, 4).outputItems(GOLD_DRUM).duration(200).circuitMeta(2).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("titanium_drum").EUt(16).inputItems(rodLong, Titanium, 2).inputItems(plate, Titanium, 4).outputItems(TITANIUM_DRUM).duration(200).circuitMeta(2).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("tungstensteel_drum").EUt(16).inputItems(rodLong, TungstenSteel, 2).inputItems(plate, TungstenSteel, 4).outputItems(TUNGSTENSTEEL_DRUM).duration(200).circuitMeta(2).save(provider); - - ASSEMBLER_RECIPES.recipeBuilder("duct_tape_polyethylene").EUt(VA[LV]).inputItems(foil, Polyethylene, 4).inputItems(CARBON_MESH).inputFluids(Polyethylene.getFluid(288)).outputItems(DUCT_TAPE).duration(100).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("duct_tape_silicone_rubber").EUt(VA[LV]).inputItems(foil, SiliconeRubber, 2).inputItems(CARBON_MESH).inputFluids(Polyethylene.getFluid(288)).outputItems(DUCT_TAPE, 2).duration(100).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("duct_tape_polycaprolactam").EUt(VA[LV]).inputItems(foil, Polycaprolactam, 2).inputItems(CARBON_MESH).inputFluids(Polyethylene.getFluid(144)).outputItems(DUCT_TAPE, 4).duration(100).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("duct_tape_polybenzimidazole").EUt(VA[LV]).inputItems(foil, Polybenzimidazole).inputItems(CARBON_MESH).inputFluids(Polyethylene.getFluid(72)).outputItems(DUCT_TAPE, 8).duration(100).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("hull_ulv").duration(25).EUt(16) + .inputItems(GTBlocks.MACHINE_CASING_ULV.asStack()).inputItems(cableGtSingle, RedAlloy, 2) + .inputFluids(Polyethylene.getFluid(L * 2)).outputItems(GTMachines.HULL[0]).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("hull_lv").duration(50).EUt(16).inputItems(GTBlocks.MACHINE_CASING_LV.asStack()) + .inputItems(cableGtSingle, Tin, 2).inputFluids(Polyethylene.getFluid(L * 2)) + .outputItems(GTMachines.HULL[1]).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("hull_mv").duration(50).EUt(16).inputItems(GTBlocks.MACHINE_CASING_MV.asStack()) + .inputItems(cableGtSingle, Copper, 2).inputFluids(Polyethylene.getFluid(L * 2)) + .outputItems(GTMachines.HULL[2]).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("hull_mv_annealed").duration(50).EUt(16) + .inputItems(GTBlocks.MACHINE_CASING_MV.asStack()).inputItems(cableGtSingle, AnnealedCopper, 2) + .inputFluids(Polyethylene.getFluid(L * 2)).outputItems(GTMachines.HULL[2]).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("hull_hv").duration(50).EUt(16).inputItems(GTBlocks.MACHINE_CASING_HV.asStack()) + .inputItems(cableGtSingle, Gold, 2).inputFluids(Polyethylene.getFluid(L * 2)) + .outputItems(GTMachines.HULL[3]).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("hull_ev").duration(50).EUt(16).inputItems(GTBlocks.MACHINE_CASING_EV.asStack()) + .inputItems(cableGtSingle, Aluminium, 2).inputFluids(Polyethylene.getFluid(L * 2)) + .outputItems(GTMachines.HULL[4]).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("hull_iv").duration(50).EUt(16).inputItems(GTBlocks.MACHINE_CASING_IV.asStack()) + .inputItems(cableGtSingle, Platinum, 2).inputFluids(Polytetrafluoroethylene.getFluid(L * 2)) + .outputItems(GTMachines.HULL[5]).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("hull_luv").duration(50).EUt(16) + .inputItems(GTBlocks.MACHINE_CASING_LuV.asStack()).inputItems(cableGtSingle, NiobiumTitanium, 2) + .inputFluids(Polytetrafluoroethylene.getFluid(L * 2)).outputItems(GTMachines.HULL[6]).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("hull_zpm").duration(50).EUt(16) + .inputItems(GTBlocks.MACHINE_CASING_ZPM.asStack()).inputItems(cableGtSingle, VanadiumGallium, 2) + .inputFluids(Polybenzimidazole.getFluid(L * 2)).outputItems(GTMachines.HULL[7]).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("hull_uv").duration(50).EUt(16).inputItems(GTBlocks.MACHINE_CASING_UV.asStack()) + .inputItems(cableGtSingle, YttriumBariumCuprate, 2).inputFluids(Polybenzimidazole.getFluid(L * 2)) + .outputItems(GTMachines.HULL[8]).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("hull_uhv").duration(50).EUt(16) + .inputItems(GTBlocks.MACHINE_CASING_UHV.asStack()).inputItems(cableGtSingle, Europium, 2) + .inputFluids(Polybenzimidazole.getFluid(L * 2)).outputItems(GTMachines.HULL[9]).save(provider); + + ASSEMBLER_RECIPES.recipeBuilder("hopper_iron").EUt(2).inputItems(CustomTags.WOODEN_CHESTS) + .inputItems(plate, Iron, 5).outputItems(new ItemStack(Blocks.HOPPER)).duration(800).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("hopper_wrought_iron").EUt(2).inputItems(CustomTags.WOODEN_CHESTS) + .inputItems(plate, WroughtIron, 5).outputItems(new ItemStack(Blocks.HOPPER)).duration(800) + .save(provider); + + ASSEMBLER_RECIPES.recipeBuilder("wooden_crate").EUt(16).inputItems(ItemTags.PLANKS, 4) + .inputItems(screw, Iron, 4).outputItems(WOODEN_CRATE).duration(100).circuitMeta(5).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("bronze_crate").EUt(16).inputItems(rodLong, Bronze, 4) + .inputItems(plate, Bronze, 4).outputItems(BRONZE_CRATE).duration(200).circuitMeta(1).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("steel_crate").EUt(16).inputItems(rodLong, Steel, 4).inputItems(plate, Steel, 4) + .outputItems(STEEL_CRATE).duration(200).circuitMeta(1).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("aluminium_crate").EUt(16).inputItems(rodLong, Aluminium, 4) + .inputItems(plate, Aluminium, 4).outputItems(ALUMINIUM_CRATE).duration(200).circuitMeta(1) + .save(provider); + ASSEMBLER_RECIPES.recipeBuilder("stainless_steel_crate").EUt(16).inputItems(rodLong, StainlessSteel, 4) + .inputItems(plate, StainlessSteel, 4).outputItems(STAINLESS_STEEL_CRATE).circuitMeta(1).duration(200) + .save(provider); + ASSEMBLER_RECIPES.recipeBuilder("titanium_crate").EUt(16).inputItems(rodLong, Titanium, 4) + .inputItems(plate, Titanium, 4).outputItems(TITANIUM_CRATE).duration(200).circuitMeta(1).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("tungstensteel_crate").EUt(16).inputItems(rodLong, TungstenSteel, 4) + .inputItems(plate, TungstenSteel, 4).outputItems(TUNGSTENSTEEL_CRATE).duration(200).circuitMeta(1) + .save(provider); + + ASSEMBLER_RECIPES.recipeBuilder("wood_barrel").EUt(16).inputItems(ItemTags.PLANKS, 4) + .inputItems(rodLong, Iron, 2).outputItems(WOODEN_DRUM).duration(200).circuitMeta(2).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("bronze_drum").EUt(16).inputItems(rodLong, Bronze, 2) + .inputItems(plate, Bronze, 4).outputItems(BRONZE_DRUM).duration(200).circuitMeta(2).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("steel_drum").EUt(16).inputItems(rodLong, Steel, 2).inputItems(plate, Steel, 4) + .outputItems(STEEL_DRUM).duration(200).circuitMeta(2).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("aluminium_drum").EUt(16).inputItems(rodLong, Aluminium, 2) + .inputItems(plate, Aluminium, 4).outputItems(ALUMINIUM_DRUM).duration(200).circuitMeta(2) + .save(provider); + ASSEMBLER_RECIPES.recipeBuilder("stainless_steel_drum").EUt(16).inputItems(rodLong, StainlessSteel, 2) + .inputItems(plate, StainlessSteel, 4).outputItems(STAINLESS_STEEL_DRUM).duration(200).circuitMeta(2) + .save(provider); + ASSEMBLER_RECIPES.recipeBuilder("gold_drum").EUt(16).inputItems(rodLong, Gold, 2).inputItems(plate, Gold, 4) + .outputItems(GOLD_DRUM).duration(200).circuitMeta(2).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("titanium_drum").EUt(16).inputItems(rodLong, Titanium, 2) + .inputItems(plate, Titanium, 4).outputItems(TITANIUM_DRUM).duration(200).circuitMeta(2).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("tungstensteel_drum").EUt(16).inputItems(rodLong, TungstenSteel, 2) + .inputItems(plate, TungstenSteel, 4).outputItems(TUNGSTENSTEEL_DRUM).duration(200).circuitMeta(2) + .save(provider); + + ASSEMBLER_RECIPES.recipeBuilder("duct_tape_polyethylene").EUt(VA[LV]).inputItems(foil, Polyethylene, 4) + .inputItems(CARBON_MESH).inputFluids(Polyethylene.getFluid(288)).outputItems(DUCT_TAPE).duration(100) + .save(provider); + ASSEMBLER_RECIPES.recipeBuilder("duct_tape_silicone_rubber").EUt(VA[LV]).inputItems(foil, SiliconeRubber, 2) + .inputItems(CARBON_MESH).inputFluids(Polyethylene.getFluid(288)).outputItems(DUCT_TAPE, 2).duration(100) + .save(provider); + ASSEMBLER_RECIPES.recipeBuilder("duct_tape_polycaprolactam").EUt(VA[LV]).inputItems(foil, Polycaprolactam, 2) + .inputItems(CARBON_MESH).inputFluids(Polyethylene.getFluid(144)).outputItems(DUCT_TAPE, 4).duration(100) + .save(provider); + ASSEMBLER_RECIPES.recipeBuilder("duct_tape_polybenzimidazole").EUt(VA[LV]).inputItems(foil, Polybenzimidazole) + .inputItems(CARBON_MESH).inputFluids(Polyethylene.getFluid(72)).outputItems(DUCT_TAPE, 8).duration(100) + .save(provider); ASSEMBLER_RECIPES.recipeBuilder("fluid_cell_large_steel") .inputItems(plateDouble, Steel, 2) @@ -654,15 +893,32 @@ private static void registerAssemblerRecipes(Consumer provider) } private static void registerBlastFurnaceRecipes(Consumer provider) { - BLAST_RECIPES.recipeBuilder("aluminium_from_ruby_dust").duration(400).EUt(100).inputItems(dust, Ruby).outputItems(nugget, Aluminium, 3).chancedOutput(dust, Ash, 1111, 0).blastFurnaceTemp(1200).save(provider); - BLAST_RECIPES.recipeBuilder("aluminium_from_ruby_gem").duration(320).EUt(100).inputItems(gem, Ruby).outputItems(nugget, Aluminium, 3).chancedOutput(dust, Ash, 1111, 0).blastFurnaceTemp(1200).save(provider); - BLAST_RECIPES.recipeBuilder("aluminium_from_green_sapphire_dust").duration(400).EUt(100).inputItems(dust, GreenSapphire).outputItems(nugget, Aluminium, 3).chancedOutput(dust, Ash, 1111, 0).blastFurnaceTemp(1200).save(provider); - BLAST_RECIPES.recipeBuilder("aluminium_from_green_sapphire_gem").duration(320).EUt(100).inputItems(gem, GreenSapphire).outputItems(nugget, Aluminium, 3).chancedOutput(dust, Ash, 1111, 0).blastFurnaceTemp(1200).save(provider); - BLAST_RECIPES.recipeBuilder("aluminium_from_sapphire_dust").duration(400).EUt(100).inputItems(dust, Sapphire).outputItems(nugget, Aluminium, 3).blastFurnaceTemp(1200).save(provider); - BLAST_RECIPES.recipeBuilder("aluminium_from_sapphire_gem").duration(320).EUt(100).inputItems(gem, Sapphire).outputItems(nugget, Aluminium, 3).blastFurnaceTemp(1200).save(provider); - BLAST_RECIPES.recipeBuilder("titanium_from_tetrachloride").duration(800).EUt(VA[HV]).inputItems(dust, Magnesium, 2).inputFluids(TitaniumTetrachloride.getFluid(1000)).outputItems(ingotHot, Titanium).outputItems(dust, MagnesiumChloride, 6).blastFurnaceTemp(Titanium.getBlastTemperature() + 200).save(provider); - BLAST_RECIPES.recipeBuilder("steel_from_iron").duration(500).EUt(VA[MV]).inputItems(ingot, Iron).inputFluids(Oxygen.getFluid(200)).outputItems(ingot, Steel).chancedOutput(dust, Ash, 1111, 0).blastFurnaceTemp(1000).save(provider); - BLAST_RECIPES.recipeBuilder("steel_from_wrought_iron").duration(300).EUt(VA[MV]).inputItems(ingot, WroughtIron).inputFluids(Oxygen.getFluid(200)).outputItems(ingot, Steel).chancedOutput(dust, Ash, 1111, 0).blastFurnaceTemp(1000).save(provider); + BLAST_RECIPES.recipeBuilder("aluminium_from_ruby_dust").duration(400).EUt(100).inputItems(dust, Ruby) + .outputItems(nugget, Aluminium, 3).chancedOutput(dust, Ash, 1111, 0).blastFurnaceTemp(1200) + .save(provider); + BLAST_RECIPES.recipeBuilder("aluminium_from_ruby_gem").duration(320).EUt(100).inputItems(gem, Ruby) + .outputItems(nugget, Aluminium, 3).chancedOutput(dust, Ash, 1111, 0).blastFurnaceTemp(1200) + .save(provider); + BLAST_RECIPES.recipeBuilder("aluminium_from_green_sapphire_dust").duration(400).EUt(100) + .inputItems(dust, GreenSapphire).outputItems(nugget, Aluminium, 3).chancedOutput(dust, Ash, 1111, 0) + .blastFurnaceTemp(1200).save(provider); + BLAST_RECIPES.recipeBuilder("aluminium_from_green_sapphire_gem").duration(320).EUt(100) + .inputItems(gem, GreenSapphire).outputItems(nugget, Aluminium, 3).chancedOutput(dust, Ash, 1111, 0) + .blastFurnaceTemp(1200).save(provider); + BLAST_RECIPES.recipeBuilder("aluminium_from_sapphire_dust").duration(400).EUt(100).inputItems(dust, Sapphire) + .outputItems(nugget, Aluminium, 3).blastFurnaceTemp(1200).save(provider); + BLAST_RECIPES.recipeBuilder("aluminium_from_sapphire_gem").duration(320).EUt(100).inputItems(gem, Sapphire) + .outputItems(nugget, Aluminium, 3).blastFurnaceTemp(1200).save(provider); + BLAST_RECIPES.recipeBuilder("titanium_from_tetrachloride").duration(800).EUt(VA[HV]) + .inputItems(dust, Magnesium, 2).inputFluids(TitaniumTetrachloride.getFluid(1000)) + .outputItems(ingotHot, Titanium).outputItems(dust, MagnesiumChloride, 6) + .blastFurnaceTemp(Titanium.getBlastTemperature() + 200).save(provider); + BLAST_RECIPES.recipeBuilder("steel_from_iron").duration(500).EUt(VA[MV]).inputItems(ingot, Iron) + .inputFluids(Oxygen.getFluid(200)).outputItems(ingot, Steel).chancedOutput(dust, Ash, 1111, 0) + .blastFurnaceTemp(1000).save(provider); + BLAST_RECIPES.recipeBuilder("steel_from_wrought_iron").duration(300).EUt(VA[MV]).inputItems(ingot, WroughtIron) + .inputFluids(Oxygen.getFluid(200)).outputItems(ingot, Steel).chancedOutput(dust, Ash, 1111, 0) + .blastFurnaceTemp(1000).save(provider); BLAST_RECIPES.recipeBuilder("rutile_from_ilmenite") .inputItems(dust, Ilmenite, 10) @@ -731,8 +987,10 @@ private static void registerBlastFurnaceMetallurgyRecipes(Consumer provider, Material inputMaterial, Material outputMaterial, int sulfurDioxideAmount) { - BLAST_RECIPES.recipeBuilder(inputMaterial.getName() + "_metallurgy").duration(120).EUt(VA[MV]).blastFurnaceTemp(1200) + private static void createSulfurDioxideRecipe(Consumer provider, Material inputMaterial, + Material outputMaterial, int sulfurDioxideAmount) { + BLAST_RECIPES.recipeBuilder(inputMaterial.getName() + "_metallurgy").duration(120).EUt(VA[MV]) + .blastFurnaceTemp(1200) .inputItems(dust, inputMaterial) .inputFluids(Oxygen.getFluid(3000)) .outputItems(dust, outputMaterial) @@ -742,8 +1000,6 @@ private static void createSulfurDioxideRecipe(Consumer provider, } private static void registerDecompositionRecipes(Consumer provider) { - - EXTRACTOR_RECIPES.recipeBuilder("raw_rubber_from_resin") .inputItems(STICKY_RESIN) .outputItems(dust, RawRubber, 3) @@ -770,28 +1026,45 @@ private static void registerDecompositionRecipes(Consumer provid .outputItems(dust, RawRubber, 2) .save(provider); - COMPRESSOR_RECIPES.recipeBuilder("plant_ball_from_sapling").duration(300).EUt(2).inputItems(ItemTags.SAPLINGS).outputItems(PLANT_BALL).save(provider); - COMPRESSOR_RECIPES.recipeBuilder("plant_ball_from_wheat").duration(300).EUt(2).inputItems(new ItemStack(Items.WHEAT, 8)).outputItems(PLANT_BALL).save(provider); - COMPRESSOR_RECIPES.recipeBuilder("plant_ball_from_potato").duration(300).EUt(2).inputItems(new ItemStack(Items.POTATO, 8)).outputItems(PLANT_BALL).save(provider); - COMPRESSOR_RECIPES.recipeBuilder("plant_ball_from_carrot").duration(300).EUt(2).inputItems(new ItemStack(Items.CARROT, 8)).outputItems(PLANT_BALL).save(provider); - COMPRESSOR_RECIPES.recipeBuilder("plant_ball_from_cactus").duration(300).EUt(2).inputItems(new ItemStack(Blocks.CACTUS, 8)).outputItems(PLANT_BALL).save(provider); - COMPRESSOR_RECIPES.recipeBuilder("plant_ball_from_sugar_cane").duration(300).EUt(2).inputItems(new ItemStack(Items.SUGAR_CANE, 8)).outputItems(PLANT_BALL).save(provider); - COMPRESSOR_RECIPES.recipeBuilder("plant_ball_from_brown_mushroom").duration(300).EUt(2).inputItems(new ItemStack(Blocks.BROWN_MUSHROOM, 8)).outputItems(PLANT_BALL).save(provider); - COMPRESSOR_RECIPES.recipeBuilder("plant_ball_from_red_mushroom").duration(300).EUt(2).inputItems(new ItemStack(Blocks.RED_MUSHROOM, 8)).outputItems(PLANT_BALL).save(provider); - COMPRESSOR_RECIPES.recipeBuilder("plant_ball_from_beetroot").duration(300).EUt(2).inputItems(new ItemStack(Items.BEETROOT, 8)).outputItems(PLANT_BALL).save(provider); - COMPRESSOR_RECIPES.recipeBuilder("plant_ball_from_moss").duration(300).EUt(2).inputItems(new ItemStack(Items.MOSS_BLOCK, 8)).outputItems(PLANT_BALL).save(provider); - COMPRESSOR_RECIPES.recipeBuilder("plant_ball_from_nether_wart").duration(300).EUt(2).inputItems(new ItemStack(Items.NETHER_WART_BLOCK, 8)).outputItems(PLANT_BALL).save(provider); - COMPRESSOR_RECIPES.recipeBuilder("plant_ball_from_crimson_stem").duration(300).EUt(2).inputItems(new ItemStack(Items.CRIMSON_STEM, 8)).outputItems(PLANT_BALL).save(provider); - COMPRESSOR_RECIPES.recipeBuilder("plant_ball_from_warped_stem").duration(300).EUt(2).inputItems(new ItemStack(Items.WARPED_STEM, 8)).outputItems(PLANT_BALL).save(provider); - COMPRESSOR_RECIPES.recipeBuilder("plant_ball_from_brain_coral").duration(300).EUt(2).inputItems(new ItemStack(Items.BRAIN_CORAL, 8)).outputItems(PLANT_BALL).save(provider); - COMPRESSOR_RECIPES.recipeBuilder("plant_ball_from_bubble_coral").duration(300).EUt(2).inputItems(new ItemStack(Items.BUBBLE_CORAL, 8)).outputItems(PLANT_BALL).save(provider); - COMPRESSOR_RECIPES.recipeBuilder("plant_ball_from_fire_coral").duration(300).EUt(2).inputItems(new ItemStack(Items.FIRE_CORAL, 8)).outputItems(PLANT_BALL).save(provider); - COMPRESSOR_RECIPES.recipeBuilder("plant_ball_from_tube_coral").duration(300).EUt(2).inputItems(new ItemStack(Items.TUBE_CORAL, 8)).outputItems(PLANT_BALL).save(provider); - COMPRESSOR_RECIPES.recipeBuilder("plant_ball_from_horn_coral").duration(300).EUt(2).inputItems(new ItemStack(Items.HORN_CORAL, 8)).outputItems(PLANT_BALL).save(provider); + COMPRESSOR_RECIPES.recipeBuilder("plant_ball_from_sapling").duration(300).EUt(2).inputItems(ItemTags.SAPLINGS) + .outputItems(PLANT_BALL).save(provider); + COMPRESSOR_RECIPES.recipeBuilder("plant_ball_from_wheat").duration(300).EUt(2) + .inputItems(new ItemStack(Items.WHEAT, 8)).outputItems(PLANT_BALL).save(provider); + COMPRESSOR_RECIPES.recipeBuilder("plant_ball_from_potato").duration(300).EUt(2) + .inputItems(new ItemStack(Items.POTATO, 8)).outputItems(PLANT_BALL).save(provider); + COMPRESSOR_RECIPES.recipeBuilder("plant_ball_from_carrot").duration(300).EUt(2) + .inputItems(new ItemStack(Items.CARROT, 8)).outputItems(PLANT_BALL).save(provider); + COMPRESSOR_RECIPES.recipeBuilder("plant_ball_from_cactus").duration(300).EUt(2) + .inputItems(new ItemStack(Blocks.CACTUS, 8)).outputItems(PLANT_BALL).save(provider); + COMPRESSOR_RECIPES.recipeBuilder("plant_ball_from_sugar_cane").duration(300).EUt(2) + .inputItems(new ItemStack(Items.SUGAR_CANE, 8)).outputItems(PLANT_BALL).save(provider); + COMPRESSOR_RECIPES.recipeBuilder("plant_ball_from_brown_mushroom").duration(300).EUt(2) + .inputItems(new ItemStack(Blocks.BROWN_MUSHROOM, 8)).outputItems(PLANT_BALL).save(provider); + COMPRESSOR_RECIPES.recipeBuilder("plant_ball_from_red_mushroom").duration(300).EUt(2) + .inputItems(new ItemStack(Blocks.RED_MUSHROOM, 8)).outputItems(PLANT_BALL).save(provider); + COMPRESSOR_RECIPES.recipeBuilder("plant_ball_from_beetroot").duration(300).EUt(2) + .inputItems(new ItemStack(Items.BEETROOT, 8)).outputItems(PLANT_BALL).save(provider); + COMPRESSOR_RECIPES.recipeBuilder("plant_ball_from_moss").duration(300).EUt(2) + .inputItems(new ItemStack(Items.MOSS_BLOCK, 8)).outputItems(PLANT_BALL).save(provider); + COMPRESSOR_RECIPES.recipeBuilder("plant_ball_from_nether_wart").duration(300).EUt(2) + .inputItems(new ItemStack(Items.NETHER_WART_BLOCK, 8)).outputItems(PLANT_BALL).save(provider); + COMPRESSOR_RECIPES.recipeBuilder("plant_ball_from_crimson_stem").duration(300).EUt(2) + .inputItems(new ItemStack(Items.CRIMSON_STEM, 8)).outputItems(PLANT_BALL).save(provider); + COMPRESSOR_RECIPES.recipeBuilder("plant_ball_from_warped_stem").duration(300).EUt(2) + .inputItems(new ItemStack(Items.WARPED_STEM, 8)).outputItems(PLANT_BALL).save(provider); + COMPRESSOR_RECIPES.recipeBuilder("plant_ball_from_brain_coral").duration(300).EUt(2) + .inputItems(new ItemStack(Items.BRAIN_CORAL, 8)).outputItems(PLANT_BALL).save(provider); + COMPRESSOR_RECIPES.recipeBuilder("plant_ball_from_bubble_coral").duration(300).EUt(2) + .inputItems(new ItemStack(Items.BUBBLE_CORAL, 8)).outputItems(PLANT_BALL).save(provider); + COMPRESSOR_RECIPES.recipeBuilder("plant_ball_from_fire_coral").duration(300).EUt(2) + .inputItems(new ItemStack(Items.FIRE_CORAL, 8)).outputItems(PLANT_BALL).save(provider); + COMPRESSOR_RECIPES.recipeBuilder("plant_ball_from_tube_coral").duration(300).EUt(2) + .inputItems(new ItemStack(Items.TUBE_CORAL, 8)).outputItems(PLANT_BALL).save(provider); + COMPRESSOR_RECIPES.recipeBuilder("plant_ball_from_horn_coral").duration(300).EUt(2) + .inputItems(new ItemStack(Items.HORN_CORAL, 8)).outputItems(PLANT_BALL).save(provider); } private static void registerRecyclingRecipes(Consumer provider) { - MACERATOR_RECIPES.recipeBuilder("macerate_end_stone") .inputItems(new ItemStack(Blocks.END_STONE)) .outputItems(dust, Endstone) @@ -807,28 +1080,28 @@ private static void registerRecyclingRecipes(Consumer provider) .save(provider); // TODO Stone-type tags? - //if (!OreDictionary.getOres("stoneSoapstone").isEmpty()) - // MACERATOR_RECIPES.recipeBuilder() - // .inputItems(stone, Soapstone) - // .outputItems(dustImpure, Talc) - // .chancedOutput(dust, Chromite, 111, 30) - // .duration(150).EUt(2) - // .save(provider); - - //if (!OreDictionary.getOres("stoneRedrock").isEmpty()) - // MACERATOR_RECIPES.recipeBuilder() - // .inputItems(stone, Redrock) - // .outputItems(dust, Redrock) - // .chancedOutput(dust, Redrock, 1000, 380) - // .duration(150).EUt(2) - // .save(provider); - -// MACERATOR_RECIPES.recipeBuilder("macerate_marble") -// .inputItems(block, Marble) -// .outputItems(dust, Marble) -// .chancedOutput(dust, Marble, 1000, 380) -// .duration(150).EUt(2) -// .save(provider); + // if (!OreDictionary.getOres("stoneSoapstone").isEmpty()) + // MACERATOR_RECIPES.recipeBuilder() + // .inputItems(stone, Soapstone) + // .outputItems(dustImpure, Talc) + // .chancedOutput(dust, Chromite, 111, 30) + // .duration(150).EUt(2) + // .save(provider); + + // if (!OreDictionary.getOres("stoneRedrock").isEmpty()) + // MACERATOR_RECIPES.recipeBuilder() + // .inputItems(stone, Redrock) + // .outputItems(dust, Redrock) + // .chancedOutput(dust, Redrock, 1000, 380) + // .duration(150).EUt(2) + // .save(provider); + + // MACERATOR_RECIPES.recipeBuilder("macerate_marble") + // .inputItems(block, Marble) + // .outputItems(dust, Marble) + // .chancedOutput(dust, Marble, 1000, 380) + // .duration(150).EUt(2) + // .save(provider); MACERATOR_RECIPES.recipeBuilder("macerate_basalt") .inputItems(Blocks.BASALT.asItem()) @@ -844,12 +1117,12 @@ private static void registerRecyclingRecipes(Consumer provider) .duration(150).EUt(2) .save(provider); -// MACERATOR_RECIPES.recipeBuilder("macerate_red_granite") -// .inputItems(block, GraniteRed) -// .outputItems(dust, GraniteRed) -// .chancedOutput(dust, Uranium238, 10, 5) -// .duration(150).EUt(2) -// .save(provider); + // MACERATOR_RECIPES.recipeBuilder("macerate_red_granite") + // .inputItems(block, GraniteRed) + // .outputItems(dust, GraniteRed) + // .chancedOutput(dust, Uranium238, 10, 5) + // .duration(150).EUt(2) + // .save(provider); MACERATOR_RECIPES.recipeBuilder("macerate_andesite") .inputItems(Blocks.ANDESITE.asItem()) @@ -934,113 +1207,149 @@ private static void registerFluidRecipes(Consumer provider) { .duration(100).EUt(16).save(provider); } - FLUID_HEATER_RECIPES.recipeBuilder("heat_water_to_steam").duration(30).EUt(VA[LV]).inputFluids(Water.getFluid(6)).circuitMeta(1).outputFluids(Steam.getFluid(960)).save(provider); - FLUID_HEATER_RECIPES.recipeBuilder("heat_distilled_to_steam").duration(30).EUt(VA[LV]).inputFluids(DistilledWater.getFluid(6)).circuitMeta(1).outputFluids(Steam.getFluid(960)).save(provider); + FLUID_HEATER_RECIPES.recipeBuilder("heat_water_to_steam").duration(30).EUt(VA[LV]) + .inputFluids(Water.getFluid(6)).circuitMeta(1).outputFluids(Steam.getFluid(960)).save(provider); + FLUID_HEATER_RECIPES.recipeBuilder("heat_distilled_to_steam").duration(30).EUt(VA[LV]) + .inputFluids(DistilledWater.getFluid(6)).circuitMeta(1).outputFluids(Steam.getFluid(960)) + .save(provider); } - private static void registerSmoothRecipe(Consumer provider, List roughStack, List stoneStack) { + private static void registerSmoothRecipe(Consumer provider, List roughStack, + List stoneStack) { for (int i = 0; i < roughStack.size(); i++) { ResourceLocation stoneId = BuiltInRegistries.ITEM.getKey(stoneStack.get(i).getItem()); - VanillaRecipeHelper.addSmeltingRecipe(provider, "smelt_" + stoneId.getPath(), roughStack.get(i), stoneStack.get(i), 0.1f); + VanillaRecipeHelper.addSmeltingRecipe(provider, "smelt_" + stoneId.getPath(), roughStack.get(i), + stoneStack.get(i), 0.1f); EXTRUDER_RECIPES.recipeBuilder("extrude_" + stoneId.getPath()) - .inputItems(roughStack.get(i)) - .notConsumable(SHAPE_EXTRUDER_BLOCK.asStack()) - .outputItems(stoneStack.get(i)) - .duration(24).EUt(8).save(provider); + .inputItems(roughStack.get(i)) + .notConsumable(SHAPE_EXTRUDER_BLOCK.asStack()) + .outputItems(stoneStack.get(i)) + .duration(24).EUt(8).save(provider); } } - private static void registerCobbleRecipe(Consumer provider, List stoneStack, List cobbleStack) { + private static void registerCobbleRecipe(Consumer provider, List stoneStack, + List cobbleStack) { for (int i = 0; i < stoneStack.size(); i++) { ResourceLocation cobbleId = BuiltInRegistries.ITEM.getKey(cobbleStack.get(i).getItem()); FORGE_HAMMER_RECIPES.recipeBuilder("hammer_" + cobbleId.getPath()) - .inputItems(stoneStack.get(i)) - .outputItems(cobbleStack.get(i)) - .duration(12).EUt(4).save(provider); + .inputItems(stoneStack.get(i)) + .outputItems(cobbleStack.get(i)) + .duration(12).EUt(4).save(provider); } } - private static void registerBricksRecipe(Consumer provider, List polishedStack, List brickStack, MarkerMaterial color) { + private static void registerBricksRecipe(Consumer provider, List polishedStack, + List brickStack, MarkerMaterial color) { for (int i = 0; i < polishedStack.size(); i++) { ResourceLocation brickId = BuiltInRegistries.ITEM.getKey(brickStack.get(i).getItem()); LASER_ENGRAVER_RECIPES.recipeBuilder("engrave_" + brickId.getPath()) - .inputItems(polishedStack.get(i)) - .notConsumable(lens, color) - .outputItems(brickStack.get(i)) - .duration(50).EUt(16).save(provider); + .inputItems(polishedStack.get(i)) + .notConsumable(lens, color) + .outputItems(brickStack.get(i)) + .duration(50).EUt(16).save(provider); } } - private static void registerMossRecipe(Consumer provider, List regularStack, List mossStack) { + private static void registerMossRecipe(Consumer provider, List regularStack, + List mossStack) { for (int i = 0; i < regularStack.size(); i++) { ResourceLocation mossId = BuiltInRegistries.ITEM.getKey(mossStack.get(i).getItem()); CHEMICAL_BATH_RECIPES.recipeBuilder("bath_" + mossId.getPath()) - .inputItems(regularStack.get(i)) - .inputFluids(Water.getFluid(100)) - .outputItems(mossStack.get(i)) - .duration(50).EUt(16).save(provider); + .inputItems(regularStack.get(i)) + .inputFluids(Water.getFluid(100)) + .outputItems(mossStack.get(i)) + .duration(50).EUt(16).save(provider); } } private static void registerNBTRemoval(Consumer provider) { for (MachineDefinition chest : GTMachines.QUANTUM_CHEST) { if (chest != null) { - VanillaRecipeHelper.addShapelessNBTClearingRecipe(provider, "quantum_chest_nbt_" + chest.getTier(), chest.asStack(), chest.asStack()); + VanillaRecipeHelper.addShapelessNBTClearingRecipe(provider, "quantum_chest_nbt_" + chest.getTier(), + chest.asStack(), chest.asStack()); } } for (MachineDefinition tank : GTMachines.QUANTUM_TANK) { if (tank != null) { - VanillaRecipeHelper.addShapelessNBTClearingRecipe(provider, "quantum_tank_nbt_" + tank.getTier(), tank.asStack(), tank.asStack()); + VanillaRecipeHelper.addShapelessNBTClearingRecipe(provider, "quantum_tank_nbt_" + tank.getTier(), + tank.asStack(), tank.asStack()); } } - //Drums - VanillaRecipeHelper.addShapelessNBTClearingRecipe(provider, "drum_nbt_wood", GTMachines.WOODEN_DRUM.asStack(), GTMachines.WOODEN_DRUM.asStack()); - VanillaRecipeHelper.addShapelessNBTClearingRecipe(provider, "drum_nbt_bronze", GTMachines.BRONZE_DRUM.asStack(), GTMachines.BRONZE_DRUM.asStack()); - VanillaRecipeHelper.addShapelessNBTClearingRecipe(provider, "drum_nbt_steel", GTMachines.STEEL_DRUM.asStack(), GTMachines.STEEL_DRUM.asStack()); - VanillaRecipeHelper.addShapelessNBTClearingRecipe(provider, "drum_nbt_aluminium", GTMachines.ALUMINIUM_DRUM.asStack(), GTMachines.ALUMINIUM_DRUM.asStack()); - VanillaRecipeHelper.addShapelessNBTClearingRecipe(provider, "drum_nbt_stainless_steel", GTMachines.STAINLESS_STEEL_DRUM.asStack(), GTMachines.STAINLESS_STEEL_DRUM.asStack()); - VanillaRecipeHelper.addShapelessNBTClearingRecipe(provider, "drum_nbt_gold", GTMachines.GOLD_DRUM.asStack(), GTMachines.GOLD_DRUM.asStack()); - VanillaRecipeHelper.addShapelessNBTClearingRecipe(provider, "drum_nbt_titanium", GTMachines.TITANIUM_DRUM.asStack(), GTMachines.TITANIUM_DRUM.asStack()); - VanillaRecipeHelper.addShapelessNBTClearingRecipe(provider, "drum_nbt_tungstensteel", GTMachines.TUNGSTENSTEEL_DRUM.asStack(), GTMachines.TUNGSTENSTEEL_DRUM.asStack()); + // Drums + VanillaRecipeHelper.addShapelessNBTClearingRecipe(provider, "drum_nbt_wood", GTMachines.WOODEN_DRUM.asStack(), + GTMachines.WOODEN_DRUM.asStack()); + VanillaRecipeHelper.addShapelessNBTClearingRecipe(provider, "drum_nbt_bronze", GTMachines.BRONZE_DRUM.asStack(), + GTMachines.BRONZE_DRUM.asStack()); + VanillaRecipeHelper.addShapelessNBTClearingRecipe(provider, "drum_nbt_steel", GTMachines.STEEL_DRUM.asStack(), + GTMachines.STEEL_DRUM.asStack()); + VanillaRecipeHelper.addShapelessNBTClearingRecipe(provider, "drum_nbt_aluminium", + GTMachines.ALUMINIUM_DRUM.asStack(), GTMachines.ALUMINIUM_DRUM.asStack()); + VanillaRecipeHelper.addShapelessNBTClearingRecipe(provider, "drum_nbt_stainless_steel", + GTMachines.STAINLESS_STEEL_DRUM.asStack(), GTMachines.STAINLESS_STEEL_DRUM.asStack()); + VanillaRecipeHelper.addShapelessNBTClearingRecipe(provider, "drum_nbt_gold", GTMachines.GOLD_DRUM.asStack(), + GTMachines.GOLD_DRUM.asStack()); + VanillaRecipeHelper.addShapelessNBTClearingRecipe(provider, "drum_nbt_titanium", + GTMachines.TITANIUM_DRUM.asStack(), GTMachines.TITANIUM_DRUM.asStack()); + VanillaRecipeHelper.addShapelessNBTClearingRecipe(provider, "drum_nbt_tungstensteel", + GTMachines.TUNGSTENSTEEL_DRUM.asStack(), GTMachines.TUNGSTENSTEEL_DRUM.asStack()); // Cells - VanillaRecipeHelper.addShapedNBTClearingRecipe(provider, "cell_nbt_regular", FLUID_CELL.asStack(), " C", " ", 'C', FLUID_CELL.asStack()); - VanillaRecipeHelper.addShapedNBTClearingRecipe(provider, "cell_nbt_universal", FLUID_CELL_UNIVERSAL.asStack(), " C", " ", 'C', FLUID_CELL_UNIVERSAL.asStack()); - VanillaRecipeHelper.addShapelessNBTClearingRecipe(provider, "cell_nbt_steel", FLUID_CELL_LARGE_STEEL.asStack(), FLUID_CELL_LARGE_STEEL.asStack()); - VanillaRecipeHelper.addShapelessNBTClearingRecipe(provider, "cell_nbt_aluminium", FLUID_CELL_LARGE_ALUMINIUM.asStack(), FLUID_CELL_LARGE_ALUMINIUM.asStack()); - VanillaRecipeHelper.addShapelessNBTClearingRecipe(provider, "cell_nbt_stainless_steel", FLUID_CELL_LARGE_STAINLESS_STEEL.asStack(), FLUID_CELL_LARGE_STAINLESS_STEEL.asStack()); - VanillaRecipeHelper.addShapelessNBTClearingRecipe(provider, "cell_nbt_titanium", FLUID_CELL_LARGE_TITANIUM.asStack(), FLUID_CELL_LARGE_TITANIUM.asStack()); - VanillaRecipeHelper.addShapelessNBTClearingRecipe(provider, "cell_nbt_tungstensteel", FLUID_CELL_LARGE_TUNGSTEN_STEEL.asStack(), FLUID_CELL_LARGE_TUNGSTEN_STEEL.asStack()); - VanillaRecipeHelper.addShapelessNBTClearingRecipe(provider, "cell_vial_nbt", FLUID_CELL_GLASS_VIAL.asStack(), FLUID_CELL_GLASS_VIAL.asStack()); + VanillaRecipeHelper.addShapedNBTClearingRecipe(provider, "cell_nbt_regular", FLUID_CELL.asStack(), " C", " ", + 'C', FLUID_CELL.asStack()); + VanillaRecipeHelper.addShapedNBTClearingRecipe(provider, "cell_nbt_universal", FLUID_CELL_UNIVERSAL.asStack(), + " C", " ", 'C', FLUID_CELL_UNIVERSAL.asStack()); + VanillaRecipeHelper.addShapelessNBTClearingRecipe(provider, "cell_nbt_steel", FLUID_CELL_LARGE_STEEL.asStack(), + FLUID_CELL_LARGE_STEEL.asStack()); + VanillaRecipeHelper.addShapelessNBTClearingRecipe(provider, "cell_nbt_aluminium", + FLUID_CELL_LARGE_ALUMINIUM.asStack(), FLUID_CELL_LARGE_ALUMINIUM.asStack()); + VanillaRecipeHelper.addShapelessNBTClearingRecipe(provider, "cell_nbt_stainless_steel", + FLUID_CELL_LARGE_STAINLESS_STEEL.asStack(), FLUID_CELL_LARGE_STAINLESS_STEEL.asStack()); + VanillaRecipeHelper.addShapelessNBTClearingRecipe(provider, "cell_nbt_titanium", + FLUID_CELL_LARGE_TITANIUM.asStack(), FLUID_CELL_LARGE_TITANIUM.asStack()); + VanillaRecipeHelper.addShapelessNBTClearingRecipe(provider, "cell_nbt_tungstensteel", + FLUID_CELL_LARGE_TUNGSTEN_STEEL.asStack(), FLUID_CELL_LARGE_TUNGSTEN_STEEL.asStack()); + VanillaRecipeHelper.addShapelessNBTClearingRecipe(provider, "cell_vial_nbt", FLUID_CELL_GLASS_VIAL.asStack(), + FLUID_CELL_GLASS_VIAL.asStack()); // Data Items - VanillaRecipeHelper.addShapelessNBTClearingRecipe(provider, "data_stick_nbt", TOOL_DATA_STICK.asStack(), TOOL_DATA_STICK.asStack()); - VanillaRecipeHelper.addShapelessNBTClearingRecipe(provider, "data_orb_nbt", TOOL_DATA_ORB.asStack(), TOOL_DATA_ORB.asStack()); - VanillaRecipeHelper.addShapelessNBTClearingRecipe(provider, "data_module_nbt", TOOL_DATA_MODULE.asStack(), TOOL_DATA_MODULE.asStack()); - - //Jetpacks - VanillaRecipeHelper.addShapelessRecipe(provider, "fluid_jetpack_clear", LIQUID_FUEL_JETPACK.asStack(), LIQUID_FUEL_JETPACK.asStack()); + VanillaRecipeHelper.addShapelessNBTClearingRecipe(provider, "data_stick_nbt", TOOL_DATA_STICK.asStack(), + TOOL_DATA_STICK.asStack()); + VanillaRecipeHelper.addShapelessNBTClearingRecipe(provider, "data_orb_nbt", TOOL_DATA_ORB.asStack(), + TOOL_DATA_ORB.asStack()); + VanillaRecipeHelper.addShapelessNBTClearingRecipe(provider, "data_module_nbt", TOOL_DATA_MODULE.asStack(), + TOOL_DATA_MODULE.asStack()); + + // Jetpacks + VanillaRecipeHelper.addShapelessRecipe(provider, "fluid_jetpack_clear", LIQUID_FUEL_JETPACK.asStack(), + LIQUID_FUEL_JETPACK.asStack()); } private static void registerHatchConversion(Consumer provider) { for (int i = 0; i < FLUID_IMPORT_HATCH.length; i++) { if (FLUID_IMPORT_HATCH[i] != null && FLUID_EXPORT_HATCH[i] != null) { - VanillaRecipeHelper.addShapedRecipe(provider, "fluid_hatch_output_to_input_" + FLUID_IMPORT_HATCH[i].getTier(), FLUID_IMPORT_HATCH[i].asStack(), + VanillaRecipeHelper.addShapedRecipe(provider, + "fluid_hatch_output_to_input_" + FLUID_IMPORT_HATCH[i].getTier(), + FLUID_IMPORT_HATCH[i].asStack(), "d", "B", 'B', FLUID_EXPORT_HATCH[i].asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, "fluid_hatch_input_to_output_" + FLUID_EXPORT_HATCH[i].getTier(), FLUID_EXPORT_HATCH[i].asStack(), + VanillaRecipeHelper.addShapedRecipe(provider, + "fluid_hatch_input_to_output_" + FLUID_EXPORT_HATCH[i].getTier(), + FLUID_EXPORT_HATCH[i].asStack(), "d", "B", 'B', FLUID_IMPORT_HATCH[i].asStack()); } } for (int i = 0; i < ITEM_IMPORT_BUS.length; i++) { if (ITEM_IMPORT_BUS[i] != null && ITEM_EXPORT_BUS[i] != null) { - VanillaRecipeHelper.addShapedRecipe(provider, "item_bus_output_to_input_" + ITEM_IMPORT_BUS[i].getTier(), ITEM_IMPORT_BUS[i].asStack(), + VanillaRecipeHelper.addShapedRecipe(provider, + "item_bus_output_to_input_" + ITEM_IMPORT_BUS[i].getTier(), ITEM_IMPORT_BUS[i].asStack(), "d", "B", 'B', ITEM_EXPORT_BUS[i].asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, "item_bus_input_to_output_" + ITEM_EXPORT_BUS[i].getTier(), ITEM_EXPORT_BUS[i].asStack(), + VanillaRecipeHelper.addShapedRecipe(provider, + "item_bus_input_to_output_" + ITEM_EXPORT_BUS[i].getTier(), ITEM_EXPORT_BUS[i].asStack(), "d", "B", 'B', ITEM_IMPORT_BUS[i].asStack()); } } @@ -1056,38 +1365,38 @@ private static void registerHatchConversion(Consumer provider) { VanillaRecipeHelper.addShapedRecipe( provider, "fluid_hatch_4x_output_to_input_" + tierName, importHatch4x.asStack(), "d", "B", - 'B', exportHatch4x.asStack() - ); + 'B', exportHatch4x.asStack()); VanillaRecipeHelper.addShapedRecipe( provider, "fluid_hatch_4x_input_to_output_" + tierName, exportHatch4x.asStack(), "d", "B", - 'B', importHatch4x.asStack() - ); + 'B', importHatch4x.asStack()); VanillaRecipeHelper.addShapedRecipe( provider, "fluid_hatch_9x_output_to_input_" + tierName, importHatch9x.asStack(), "d", "B", - 'B', exportHatch9x.asStack() - ); + 'B', exportHatch9x.asStack()); VanillaRecipeHelper.addShapedRecipe( provider, "fluid_hatch_9x_input_to_output_" + tierName, exportHatch9x.asStack(), "d", "B", - 'B', importHatch9x.asStack() - ); + 'B', importHatch9x.asStack()); } - //Steam + // Steam VanillaRecipeHelper.addShapedRecipe(provider, "steam_bus_output_to_input", STEAM_EXPORT_BUS.asStack(), "d", "B", 'B', STEAM_IMPORT_BUS.asStack()); VanillaRecipeHelper.addShapedRecipe(provider, "steam_bus_input_to_output", STEAM_IMPORT_BUS.asStack(), "d", "B", 'B', STEAM_EXPORT_BUS.asStack()); // TODO fix the ME buses/hatches -// if (GTCEu.isAE2Loaded()) { -// VanillaRecipeHelper.addShapedRecipe(provider, "me_fluid_hatch_output_to_input", GTAEMachines.FLUID_IMPORT_HATCH.asStack(), "d", "B", 'B', GTAEMachines.FLUID_EXPORT_HATCH.asStack()); -// VanillaRecipeHelper.addShapedRecipe(provider, "me_fluid_hatch_input_to_output", GTAEMachines.FLUID_EXPORT_HATCH.asStack(), "d", "B", 'B', GTAEMachines.FLUID_IMPORT_HATCH.asStack()); -// VanillaRecipeHelper.addShapedRecipe(provider, "me_item_bus_output_to_input", GTAEMachines.ITEM_IMPORT_BUS.asStack(), "d", "B", 'B', GTAEMachines.ITEM_EXPORT_BUS.asStack()); -// VanillaRecipeHelper.addShapedRecipe(provider, "me_item_bus_input_to_output", GTAEMachines.ITEM_EXPORT_BUS.asStack(), "d", "B", 'B', GTAEMachines.ITEM_IMPORT_BUS.asStack()); -// } + // if (GTCEu.isAE2Loaded()) { + // VanillaRecipeHelper.addShapedRecipe(provider, "me_fluid_hatch_output_to_input", + // GTAEMachines.FLUID_IMPORT_HATCH.asStack(), "d", "B", 'B', GTAEMachines.FLUID_EXPORT_HATCH.asStack()); + // VanillaRecipeHelper.addShapedRecipe(provider, "me_fluid_hatch_input_to_output", + // GTAEMachines.FLUID_EXPORT_HATCH.asStack(), "d", "B", 'B', GTAEMachines.FLUID_IMPORT_HATCH.asStack()); + // VanillaRecipeHelper.addShapedRecipe(provider, "me_item_bus_output_to_input", + // GTAEMachines.ITEM_IMPORT_BUS.asStack(), "d", "B", 'B', GTAEMachines.ITEM_EXPORT_BUS.asStack()); + // VanillaRecipeHelper.addShapedRecipe(provider, "me_item_bus_input_to_output", + // GTAEMachines.ITEM_EXPORT_BUS.asStack(), "d", "B", 'B', GTAEMachines.ITEM_IMPORT_BUS.asStack()); + // } } } diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MetaTileEntityLoader.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MetaTileEntityLoader.java index 594762b1b6..feb25d0377 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MetaTileEntityLoader.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MetaTileEntityLoader.java @@ -15,7 +15,7 @@ import com.gregtechceu.gtceu.data.recipe.CraftingComponent; import com.gregtechceu.gtceu.data.recipe.CustomTags; import com.gregtechceu.gtceu.data.recipe.VanillaRecipeHelper; -import com.tterrag.registrate.util.entry.ItemProviderEntry; + import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.tags.ItemTags; import net.minecraft.world.item.Item; @@ -24,6 +24,8 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraftforge.common.Tags; + +import com.tterrag.registrate.util.entry.ItemProviderEntry; import org.apache.commons.lang3.ArrayUtils; import java.util.Arrays; @@ -36,109 +38,295 @@ public class MetaTileEntityLoader { public static void init(Consumer provider) { CraftingComponent.initializeComponents(); - - VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_ulv", GTBlocks.MACHINE_CASING_ULV.asStack(), "PPP", "PwP", "PPP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.WroughtIron)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_lv", GTBlocks.MACHINE_CASING_LV.asStack(), "PPP", "PwP", "PPP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Steel)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_mv", GTBlocks.MACHINE_CASING_MV.asStack(), "PPP", "PwP", "PPP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Aluminium)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_hv", GTBlocks.MACHINE_CASING_HV.asStack(), "PPP", "PwP", "PPP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.StainlessSteel)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_ev", GTBlocks.MACHINE_CASING_EV.asStack(), "PPP", "PwP", "PPP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Titanium)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_iv", GTBlocks.MACHINE_CASING_IV.asStack(), "PPP", "PwP", "PPP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.TungstenSteel)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_luv", GTBlocks.MACHINE_CASING_LuV.asStack(), "PPP", "PwP", "PPP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.RhodiumPlatedPalladium)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_zpm", GTBlocks.MACHINE_CASING_ZPM.asStack(), "PPP", "PwP", "PPP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.NaquadahAlloy)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_uv", GTBlocks.MACHINE_CASING_UV.asStack(), "PPP", "PwP", "PPP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Darmstadtium)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_uhv", GTBlocks.MACHINE_CASING_UHV.asStack(), "PPP", "PwP", "PPP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Neutronium)); + + VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_ulv", GTBlocks.MACHINE_CASING_ULV.asStack(), "PPP", + "PwP", "PPP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.WroughtIron)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_lv", GTBlocks.MACHINE_CASING_LV.asStack(), "PPP", + "PwP", "PPP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Steel)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_mv", GTBlocks.MACHINE_CASING_MV.asStack(), "PPP", + "PwP", "PPP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Aluminium)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_hv", GTBlocks.MACHINE_CASING_HV.asStack(), "PPP", + "PwP", "PPP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.StainlessSteel)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_ev", GTBlocks.MACHINE_CASING_EV.asStack(), "PPP", + "PwP", "PPP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Titanium)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_iv", GTBlocks.MACHINE_CASING_IV.asStack(), "PPP", + "PwP", "PPP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.TungstenSteel)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_luv", GTBlocks.MACHINE_CASING_LuV.asStack(), "PPP", + "PwP", "PPP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.RhodiumPlatedPalladium)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_zpm", GTBlocks.MACHINE_CASING_ZPM.asStack(), "PPP", + "PwP", "PPP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.NaquadahAlloy)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_uv", GTBlocks.MACHINE_CASING_UV.asStack(), "PPP", + "PwP", "PPP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Darmstadtium)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_uhv", GTBlocks.MACHINE_CASING_UHV.asStack(), "PPP", + "PwP", "PPP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Neutronium)); // If these recipes are changed, change the values in MaterialInfoLoader.java - registerMachineRecipe(provider, false, GTMachines.HULL, "PLP", "CHC", 'P', HULL_PLATE, 'L', PLATE, 'C', CABLE, 'H', CASING); - - VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_coke_bricks", GTBlocks.CASING_COKE_BRICKS.asStack(), "XX", "XX", 'X', GTItems.COKE_OVEN_BRICK); - VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_bronze_bricks", GTBlocks.CASING_BRONZE_BRICKS.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PhP", "PBP", "PwP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Bronze), 'B', new ItemStack(Blocks.BRICKS)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_steel_solid", GTBlocks.CASING_STEEL_SOLID.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PhP", "PFP", "PwP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Steel), 'F', new UnificationEntry(TagPrefix.frameGt, GTMaterials.Steel)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_titanium_stable", GTBlocks.CASING_TITANIUM_STABLE.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PhP", "PFP", "PwP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Titanium), 'F', new UnificationEntry(TagPrefix.frameGt, GTMaterials.Titanium)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_invar_heatproof", GTBlocks.CASING_INVAR_HEATPROOF.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PhP", "PFP", "PwP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Invar), 'F', new UnificationEntry(TagPrefix.frameGt, GTMaterials.Invar)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_aluminium_frostproof", GTBlocks.CASING_ALUMINIUM_FROSTPROOF.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PhP", "PFP", "PwP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Aluminium), 'F', new UnificationEntry(TagPrefix.frameGt, GTMaterials.Aluminium)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_stainless_clean", GTBlocks.CASING_STAINLESS_CLEAN.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PhP", "PFP", "PwP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.StainlessSteel), 'F', new UnificationEntry(TagPrefix.frameGt, GTMaterials.StainlessSteel)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_tungstensteel_robust", GTBlocks.CASING_TUNGSTENSTEEL_ROBUST.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PhP", "PFP", "PwP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.TungstenSteel), 'F', new UnificationEntry(TagPrefix.frameGt, GTMaterials.TungstenSteel)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_hsse_sturdy", GTBlocks.CASING_HSSE_STURDY.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PhP", "PFP", "PwP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.HSSE), 'F', new UnificationEntry(TagPrefix.frameGt, GTMaterials.Europium)); - - VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_steel_turbine_casing", GTBlocks.CASING_STEEL_TURBINE.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PhP", "PFP", "PwP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Magnalium), 'F', new UnificationEntry(TagPrefix.frameGt, GTMaterials.BlueSteel)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_stainless_turbine_casing", GTBlocks.CASING_STAINLESS_TURBINE.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PhP", "PFP", "PwP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.StainlessSteel), 'F', GTBlocks.CASING_STEEL_TURBINE.asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_titanium_turbine_casing", GTBlocks.CASING_TITANIUM_TURBINE.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PhP", "PFP", "PwP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Titanium), 'F', GTBlocks.CASING_STEEL_TURBINE.asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_tungstensteel_turbine_casing", GTBlocks.CASING_TUNGSTENSTEEL_TURBINE.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PhP", "PFP", "PwP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.TungstenSteel), 'F', GTBlocks.CASING_STEEL_TURBINE.asStack()); - - - VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_bronze_pipe", GTBlocks.CASING_BRONZE_PIPE.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PIP", "IFI", "PIP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Bronze), 'F', new UnificationEntry(TagPrefix.frameGt, GTMaterials.Bronze), 'I', new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.Bronze)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_steel_pipe", GTBlocks.CASING_STEEL_PIPE.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PIP", "IFI", "PIP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Steel), 'F', new UnificationEntry(TagPrefix.frameGt, GTMaterials.Steel), 'I', new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.Steel)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_titanium_pipe", GTBlocks.CASING_TITANIUM_PIPE.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PIP", "IFI", "PIP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Titanium), 'F', new UnificationEntry(TagPrefix.frameGt, GTMaterials.Titanium), 'I', new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.Titanium)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_tungstensteel_pipe", GTBlocks.CASING_TUNGSTENSTEEL_PIPE.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PIP", "IFI", "PIP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.TungstenSteel), 'F', new UnificationEntry(TagPrefix.frameGt, GTMaterials.TungstenSteel), 'I', new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.TungstenSteel)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_ptfe_pipe", GTBlocks.CASING_POLYTETRAFLUOROETHYLENE_PIPE.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PIP", "IFI", "PIP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Polytetrafluoroethylene), 'F', new UnificationEntry(TagPrefix.frameGt, GTMaterials.Polytetrafluoroethylene), 'I', new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.Polytetrafluoroethylene)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_bronze_firebox", GTBlocks.FIREBOX_BRONZE.asStack(2), "PSP", "SFS", "PSP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Bronze), 'F', new UnificationEntry(TagPrefix.frameGt, GTMaterials.Bronze), 'S', new UnificationEntry(TagPrefix.rod, GTMaterials.Bronze)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_steel_firebox", GTBlocks.FIREBOX_STEEL.asStack(2), "PSP", "SFS", "PSP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Steel), 'F', new UnificationEntry(TagPrefix.frameGt, GTMaterials.Steel), 'S', new UnificationEntry(TagPrefix.rod, GTMaterials.Steel)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_titanium_firebox", GTBlocks.FIREBOX_TITANIUM.asStack(2), "PSP", "SFS", "PSP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Titanium), 'F', new UnificationEntry(TagPrefix.frameGt, GTMaterials.Titanium), 'S', new UnificationEntry(TagPrefix.rod, GTMaterials.Titanium)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_tungstensteel_firebox", GTBlocks.FIREBOX_TUNGSTENSTEEL.asStack(2), "PSP", "SFS", "PSP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.TungstenSteel), 'F', new UnificationEntry(TagPrefix.frameGt, GTMaterials.TungstenSteel), 'S', new UnificationEntry(TagPrefix.rod, GTMaterials.TungstenSteel)); - - VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_bronze_gearbox", GTBlocks.CASING_BRONZE_GEARBOX.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PhP", "GFG", "PwP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Bronze), 'F', new UnificationEntry(TagPrefix.frameGt, GTMaterials.Bronze), 'G', new UnificationEntry(TagPrefix.gear, GTMaterials.Bronze)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_steel_gearbox", GTBlocks.CASING_STEEL_GEARBOX.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PhP", "GFG", "PwP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Steel), 'F', new UnificationEntry(TagPrefix.frameGt, GTMaterials.Steel), 'G', new UnificationEntry(TagPrefix.gear, GTMaterials.Steel)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_stainless_steel_gearbox", GTBlocks.CASING_STAINLESS_STEEL_GEARBOX.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PhP", "GFG", "PwP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.StainlessSteel), 'F', new UnificationEntry(TagPrefix.frameGt, GTMaterials.StainlessSteel), 'G', new UnificationEntry(TagPrefix.gear, GTMaterials.StainlessSteel)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_titanium_gearbox", GTBlocks.CASING_TITANIUM_GEARBOX.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PhP", "GFG", "PwP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Titanium), 'F', new UnificationEntry(TagPrefix.frameGt, GTMaterials.Titanium), 'G', new UnificationEntry(TagPrefix.gear, GTMaterials.Titanium)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_tungstensteel_gearbox", GTBlocks.CASING_TUNGSTENSTEEL_GEARBOX.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PhP", "GFG", "PwP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.TungstenSteel), 'F', new UnificationEntry(TagPrefix.frameGt, GTMaterials.TungstenSteel), 'G', new UnificationEntry(TagPrefix.gear, GTMaterials.TungstenSteel)); - - VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_grate_casing", GTBlocks.CASING_GRATE.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PVP", "PFP", "PMP", 'P', new ItemStack(Blocks.IRON_BARS, 1), 'F', new UnificationEntry(TagPrefix.frameGt, GTMaterials.Steel), 'M', GTItems.ELECTRIC_MOTOR_MV, 'V', new UnificationEntry(TagPrefix.rotor, GTMaterials.Steel)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_assembly_control", GTBlocks.CASING_ASSEMBLY_CONTROL.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "CPC", "SFE", "CMC", 'C', CustomTags.EV_CIRCUITS, 'P', GTItems.HIGH_POWER_INTEGRATED_CIRCUIT, 'S', GTItems.SENSOR_IV.asStack(), 'F', new UnificationEntry(TagPrefix.frameGt, GTMaterials.TungstenSteel), 'E', GTItems.EMITTER_IV.asStack(), 'M', GTItems.ELECTRIC_MOTOR_IV); - VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_assembly_line", GTBlocks.CASING_ASSEMBLY_LINE.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PGP", "AFA", "PGP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Steel), 'G', new UnificationEntry(TagPrefix.gear, GTMaterials.Ruridit), 'A', GTItems.ROBOT_ARM_IV.asStack(), 'F', ChemicalHelper.get(TagPrefix.frameGt, GTMaterials.TungstenSteel)); - - VanillaRecipeHelper.addShapedRecipe(provider, true, "warning_sign_yellow_stripes", GTBlocks.YELLOW_STRIPES_BLOCK_A.asStack(), "Y ", " M ", " B", 'M', GTBlocks.CASING_STEEL_SOLID.asStack(), 'Y', Tags.Items.DYES_YELLOW, 'B', Tags.Items.DYES_BLACK); - VanillaRecipeHelper.addShapedRecipe(provider, true, "warning_sign_small_yellow_stripes", GTBlocks.YELLOW_STRIPES_BLOCK_B.asStack(), " Y", " M ", "B ", 'M', GTBlocks.CASING_STEEL_SOLID.asStack(), 'Y', Tags.Items.DYES_YELLOW, 'B', Tags.Items.DYES_BLACK); - VanillaRecipeHelper.addShapedRecipe(provider, true, "warning_sign_radioactive_hazard", GTBlocks.RADIOACTIVE_HAZARD_SIGN_BLOCK.asStack(), " YB", " M ", " ", 'M', GTBlocks.CASING_STEEL_SOLID.asStack(), 'Y', Tags.Items.DYES_YELLOW, 'B', Tags.Items.DYES_BLACK); - VanillaRecipeHelper.addShapedRecipe(provider, true, "warning_sign_bio_hazard", GTBlocks.BIO_HAZARD_SIGN_BLOCK.asStack(), " Y ", " MB", " ", 'M', GTBlocks.CASING_STEEL_SOLID.asStack(), 'Y', Tags.Items.DYES_YELLOW, 'B', Tags.Items.DYES_BLACK); - VanillaRecipeHelper.addShapedRecipe(provider, true, "warning_sign_explosion_hazard", GTBlocks.EXPLOSION_HAZARD_SIGN_BLOCK.asStack(), " Y ", " M ", " B", 'M', GTBlocks.CASING_STEEL_SOLID.asStack(), 'Y', Tags.Items.DYES_YELLOW, 'B', Tags.Items.DYES_BLACK); - VanillaRecipeHelper.addShapedRecipe(provider, true, "warning_sign_fire_hazard", GTBlocks.FIRE_HAZARD_SIGN_BLOCK.asStack(), " Y ", " M ", " B ", 'M', GTBlocks.CASING_STEEL_SOLID.asStack(), 'Y', Tags.Items.DYES_YELLOW, 'B', Tags.Items.DYES_BLACK); - VanillaRecipeHelper.addShapedRecipe(provider, true, "warning_sign_acid_hazard", GTBlocks.ACID_HAZARD_SIGN_BLOCK.asStack(), " Y ", " M ", "B ", 'M', GTBlocks.CASING_STEEL_SOLID.asStack(), 'Y', Tags.Items.DYES_YELLOW, 'B', Tags.Items.DYES_BLACK); - VanillaRecipeHelper.addShapedRecipe(provider, true, "warning_sign_magic_hazard", GTBlocks.MAGIC_HAZARD_SIGN_BLOCK.asStack(), " Y ", "BM ", " ", 'M', GTBlocks.CASING_STEEL_SOLID.asStack(), 'Y', Tags.Items.DYES_YELLOW, 'B', Tags.Items.DYES_BLACK); - VanillaRecipeHelper.addShapedRecipe(provider, true, "warning_sign_frost_hazard", GTBlocks.FROST_HAZARD_SIGN_BLOCK.asStack(), "BY ", " M ", " ", 'M', GTBlocks.CASING_STEEL_SOLID.asStack(), 'Y', Tags.Items.DYES_YELLOW, 'B', Tags.Items.DYES_BLACK); - VanillaRecipeHelper.addShapedRecipe(provider, true, "warning_sign_noise_hazard", GTBlocks.NOISE_HAZARD_SIGN_BLOCK.asStack(), " ", " M ", "BY ", 'M', GTBlocks.CASING_STEEL_SOLID.asStack(), 'Y', Tags.Items.DYES_YELLOW, 'B', Tags.Items.DYES_BLACK); - VanillaRecipeHelper.addShapedRecipe(provider, true, "warning_sign_generic_hazard", GTBlocks.GENERIC_HAZARD_SIGN_BLOCK.asStack(), " ", "BM ", " Y ", 'M', GTBlocks.CASING_STEEL_SOLID.asStack(), 'Y', Tags.Items.DYES_YELLOW, 'B', Tags.Items.DYES_BLACK); - VanillaRecipeHelper.addShapedRecipe(provider, true, "warning_sign_high_voltage_hazard", GTBlocks.HIGH_VOLTAGE_HAZARD_SIGN_BLOCK.asStack(), "B ", " M ", " Y ", 'M', GTBlocks.CASING_STEEL_SOLID.asStack(), 'Y', Tags.Items.DYES_YELLOW, 'B', Tags.Items.DYES_BLACK); - VanillaRecipeHelper.addShapedRecipe(provider, true, "warning_sign_magnetic_hazard", GTBlocks.MAGNETIC_HAZARD_SIGN_BLOCK.asStack(), " B ", " M ", " Y ", 'M', GTBlocks.CASING_STEEL_SOLID.asStack(), 'Y', Tags.Items.DYES_YELLOW, 'B', Tags.Items.DYES_BLACK); - VanillaRecipeHelper.addShapedRecipe(provider, true, "warning_sign_antimatter_hazard", GTBlocks.ANTIMATTER_HAZARD_SIGN_BLOCK.asStack(), " B", " M ", " Y ", 'M', GTBlocks.CASING_STEEL_SOLID.asStack(), 'Y', Tags.Items.DYES_YELLOW, 'B', Tags.Items.DYES_BLACK); - VanillaRecipeHelper.addShapedRecipe(provider, true, "warning_sign_high_temperature_hazard", GTBlocks.HIGH_TEMPERATURE_HAZARD_SIGN_BLOCK.asStack(), " ", " MB", " Y ", 'M', GTBlocks.CASING_STEEL_SOLID.asStack(), 'Y', Tags.Items.DYES_YELLOW, 'B', Tags.Items.DYES_BLACK); - VanillaRecipeHelper.addShapedRecipe(provider, true, "warning_sign_void_hazard", GTBlocks.VOID_HAZARD_SIGN_BLOCK.asStack(), " ", " M ", " YB", 'M', GTBlocks.CASING_STEEL_SOLID.asStack(), 'Y', Tags.Items.DYES_YELLOW, 'B', Tags.Items.DYES_BLACK); - VanillaRecipeHelper.addShapedRecipe(provider, true, "warning_mob_spawner_hazard", GTBlocks.MOB_SPAWNER_HAZARD_SIGN_BLOCK.asStack(), "B ", "YM ", " ", 'M', GTBlocks.CASING_STEEL_SOLID.asStack(), 'Y', Tags.Items.DYES_YELLOW, 'B', Tags.Items.DYES_BLACK); - VanillaRecipeHelper.addShapedRecipe(provider, true, "warning_spatial_storage_hazard", GTBlocks.SPATIAL_STORAGE_HAZARD_SIGN_BLOCK.asStack(), " B ", "YM ", " ", 'M', GTBlocks.CASING_STEEL_SOLID.asStack(), 'Y', Tags.Items.DYES_YELLOW, 'B', Tags.Items.DYES_BLACK); - VanillaRecipeHelper.addShapedRecipe(provider, true, "warning_laser_hazard", GTBlocks.LASER_HAZARD_SIGN_BLOCK.asStack(), " B", "YM ", " ", 'M', GTBlocks.CASING_STEEL_SOLID.asStack(), 'Y', Tags.Items.DYES_YELLOW, 'B', Tags.Items.DYES_BLACK); - VanillaRecipeHelper.addShapedRecipe(provider, true, "warning_mob_hazard", GTBlocks.MOB_INFESTATION_HAZARD_SIGN_BLOCK.asStack(), " ", "YMB", " ", 'M', GTBlocks.CASING_STEEL_SOLID.asStack(), 'Y', Tags.Items.DYES_YELLOW, 'B', Tags.Items.DYES_BLACK); - VanillaRecipeHelper.addShapedRecipe(provider, true, "warning_boss_hazard", GTBlocks.BOSS_HAZARD_SIGN_BLOCK.asStack(), " ", "YM ", " B", 'M', GTBlocks.CASING_STEEL_SOLID.asStack(), 'Y', Tags.Items.DYES_YELLOW, 'B', Tags.Items.DYES_BLACK); - VanillaRecipeHelper.addShapedRecipe(provider, true, "warning_gregification_hazard", GTBlocks.GREGIFICATION_HAZARD_SIGN_BLOCK.asStack(), " ", "YM ", " B ", 'M', GTBlocks.CASING_STEEL_SOLID.asStack(), 'Y', Tags.Items.DYES_YELLOW, 'B', Tags.Items.DYES_BLACK); - VanillaRecipeHelper.addShapedRecipe(provider, true, "warning_causality_hazard", GTBlocks.CAUSALITY_HAZARD_SIGN_BLOCK.asStack(), " ", "YM ", "B ", 'M', GTBlocks.CASING_STEEL_SOLID.asStack(), 'Y', Tags.Items.DYES_YELLOW, 'B', Tags.Items.DYES_BLACK); - VanillaRecipeHelper.addShapedRecipe(provider, true, "warning_turret_hazard", GTBlocks.TURRET_HAZARD_SIGN_BLOCK.asStack(), " ", " MY", " B", 'M', GTBlocks.CASING_STEEL_SOLID.asStack(), 'Y', Tags.Items.DYES_YELLOW, 'B', Tags.Items.DYES_BLACK); - VanillaRecipeHelper.addShapedRecipe(provider, true, "warning_high_pressure_hazard", GTBlocks.HIGH_PRESSURE_HAZARD_SIGN_BLOCK.asStack(), " ", " MY", " B ", 'M', GTBlocks.CASING_STEEL_SOLID.asStack(), 'Y', Tags.Items.DYES_YELLOW, 'B', Tags.Items.DYES_BLACK); - - VanillaRecipeHelper.addShapelessRecipe(provider, "yellow_stripes_to_steel_solid_casing", GTBlocks.CASING_STEEL_SOLID.asStack(), GTBlocks.YELLOW_STRIPES_BLOCK_A.asStack()); - VanillaRecipeHelper.addShapelessRecipe(provider, "small_yellow_stripes_to_steel_solid_casing", GTBlocks.CASING_STEEL_SOLID.asStack(), GTBlocks.YELLOW_STRIPES_BLOCK_B.asStack()); - VanillaRecipeHelper.addShapelessRecipe(provider, "radioactive_hazard_to_steel_solid_casing", GTBlocks.CASING_STEEL_SOLID.asStack(), GTBlocks.RADIOACTIVE_HAZARD_SIGN_BLOCK.asStack()); - VanillaRecipeHelper.addShapelessRecipe(provider, "bio_hazard_to_steel_solid_casing", GTBlocks.CASING_STEEL_SOLID.asStack(), GTBlocks.BIO_HAZARD_SIGN_BLOCK.asStack()); - VanillaRecipeHelper.addShapelessRecipe(provider, "explosion_hazard_to_steel_solid_casing", GTBlocks.CASING_STEEL_SOLID.asStack(), GTBlocks.EXPLOSION_HAZARD_SIGN_BLOCK.asStack()); - VanillaRecipeHelper.addShapelessRecipe(provider, "fire_hazard_to_steel_solid_casing", GTBlocks.CASING_STEEL_SOLID.asStack(), GTBlocks.FIRE_HAZARD_SIGN_BLOCK.asStack()); - VanillaRecipeHelper.addShapelessRecipe(provider, "acid_hazard_to_steel_solid_casing", GTBlocks.CASING_STEEL_SOLID.asStack(), GTBlocks.ACID_HAZARD_SIGN_BLOCK.asStack()); - VanillaRecipeHelper.addShapelessRecipe(provider, "magic_hazard_to_steel_solid_casing", GTBlocks.CASING_STEEL_SOLID.asStack(), GTBlocks.MAGIC_HAZARD_SIGN_BLOCK.asStack()); - VanillaRecipeHelper.addShapelessRecipe(provider, "frost_hazard_to_steel_solid_casing", GTBlocks.CASING_STEEL_SOLID.asStack(), GTBlocks.FROST_HAZARD_SIGN_BLOCK.asStack()); - VanillaRecipeHelper.addShapelessRecipe(provider, "noise_hazard_to_steel_solid_casing", GTBlocks.CASING_STEEL_SOLID.asStack(), GTBlocks.NOISE_HAZARD_SIGN_BLOCK.asStack()); - VanillaRecipeHelper.addShapelessRecipe(provider, "generic_hazard_to_steel_solid_casing", GTBlocks.CASING_STEEL_SOLID.asStack(), GTBlocks.GENERIC_HAZARD_SIGN_BLOCK.asStack()); - VanillaRecipeHelper.addShapelessRecipe(provider, "high_voltage_hazard_to_steel_solid_casing", GTBlocks.CASING_STEEL_SOLID.asStack(), GTBlocks.HIGH_VOLTAGE_HAZARD_SIGN_BLOCK.asStack()); - VanillaRecipeHelper.addShapelessRecipe(provider, "magnetic_hazard_to_steel_solid_casing", GTBlocks.CASING_STEEL_SOLID.asStack(), GTBlocks.MAGNETIC_HAZARD_SIGN_BLOCK.asStack()); - VanillaRecipeHelper.addShapelessRecipe(provider, "antimatter_hazard_to_steel_solid_casing", GTBlocks.CASING_STEEL_SOLID.asStack(), GTBlocks.ANTIMATTER_HAZARD_SIGN_BLOCK.asStack()); - VanillaRecipeHelper.addShapelessRecipe(provider, "high_temperature_hazard_to_steel_solid_casing", GTBlocks.CASING_STEEL_SOLID.asStack(), GTBlocks.HIGH_TEMPERATURE_HAZARD_SIGN_BLOCK.asStack()); - VanillaRecipeHelper.addShapelessRecipe(provider, "void_hazard_to_steel_solid_casing", GTBlocks.CASING_STEEL_SOLID.asStack(), GTBlocks.VOID_HAZARD_SIGN_BLOCK.asStack()); - VanillaRecipeHelper.addShapelessRecipe(provider, "mob_spawner_hazard_to_steel_solid_casing", GTBlocks.CASING_STEEL_SOLID.asStack(), GTBlocks.MOB_SPAWNER_HAZARD_SIGN_BLOCK.asStack()); - VanillaRecipeHelper.addShapelessRecipe(provider, "laser_hazard_to_steel_solid_casing", GTBlocks.CASING_STEEL_SOLID.asStack(), GTBlocks.LASER_HAZARD_SIGN_BLOCK.asStack()); - VanillaRecipeHelper.addShapelessRecipe(provider, "mob_hazard_to_steel_solid_casing", GTBlocks.CASING_STEEL_SOLID.asStack(), GTBlocks.MOB_INFESTATION_HAZARD_SIGN_BLOCK.asStack()); - VanillaRecipeHelper.addShapelessRecipe(provider, "boss_hazard_to_steel_solid_casing", GTBlocks.CASING_STEEL_SOLID.asStack(), GTBlocks.BOSS_HAZARD_SIGN_BLOCK.asStack()); - VanillaRecipeHelper.addShapelessRecipe(provider, "gregification_hazard_to_steel_solid_casing", GTBlocks.CASING_STEEL_SOLID.asStack(), GTBlocks.GREGIFICATION_HAZARD_SIGN_BLOCK.asStack()); - VanillaRecipeHelper.addShapelessRecipe(provider, "causality_hazard_to_steel_solid_casing", GTBlocks.CASING_STEEL_SOLID.asStack(), GTBlocks.CAUSALITY_HAZARD_SIGN_BLOCK.asStack()); - VanillaRecipeHelper.addShapelessRecipe(provider, "turret_hazard_to_steel_solid_casing", GTBlocks.CASING_STEEL_SOLID.asStack(), GTBlocks.TURRET_HAZARD_SIGN_BLOCK.asStack()); - VanillaRecipeHelper.addShapelessRecipe(provider, "high_pressure_to_steel_solid_casing", GTBlocks.CASING_STEEL_SOLID.asStack(), GTBlocks.HIGH_PRESSURE_HAZARD_SIGN_BLOCK.asStack()); - - var multiHatchMaterials = new Material[]{ + registerMachineRecipe(provider, false, GTMachines.HULL, "PLP", "CHC", 'P', HULL_PLATE, 'L', PLATE, 'C', CABLE, + 'H', CASING); + + VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_coke_bricks", GTBlocks.CASING_COKE_BRICKS.asStack(), + "XX", "XX", 'X', GTItems.COKE_OVEN_BRICK); + VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_bronze_bricks", + GTBlocks.CASING_BRONZE_BRICKS.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PhP", "PBP", + "PwP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Bronze), 'B', + new ItemStack(Blocks.BRICKS)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_steel_solid", + GTBlocks.CASING_STEEL_SOLID.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PhP", "PFP", "PwP", + 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Steel), 'F', + new UnificationEntry(TagPrefix.frameGt, GTMaterials.Steel)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_titanium_stable", + GTBlocks.CASING_TITANIUM_STABLE.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PhP", "PFP", + "PwP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Titanium), 'F', + new UnificationEntry(TagPrefix.frameGt, GTMaterials.Titanium)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_invar_heatproof", + GTBlocks.CASING_INVAR_HEATPROOF.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PhP", "PFP", + "PwP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Invar), 'F', + new UnificationEntry(TagPrefix.frameGt, GTMaterials.Invar)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_aluminium_frostproof", + GTBlocks.CASING_ALUMINIUM_FROSTPROOF.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PhP", + "PFP", "PwP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Aluminium), 'F', + new UnificationEntry(TagPrefix.frameGt, GTMaterials.Aluminium)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_stainless_clean", + GTBlocks.CASING_STAINLESS_CLEAN.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PhP", "PFP", + "PwP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.StainlessSteel), 'F', + new UnificationEntry(TagPrefix.frameGt, GTMaterials.StainlessSteel)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_tungstensteel_robust", + GTBlocks.CASING_TUNGSTENSTEEL_ROBUST.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PhP", + "PFP", "PwP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.TungstenSteel), 'F', + new UnificationEntry(TagPrefix.frameGt, GTMaterials.TungstenSteel)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_hsse_sturdy", + GTBlocks.CASING_HSSE_STURDY.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PhP", "PFP", "PwP", + 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.HSSE), 'F', + new UnificationEntry(TagPrefix.frameGt, GTMaterials.Europium)); + + VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_steel_turbine_casing", + GTBlocks.CASING_STEEL_TURBINE.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PhP", "PFP", + "PwP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Magnalium), 'F', + new UnificationEntry(TagPrefix.frameGt, GTMaterials.BlueSteel)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_stainless_turbine_casing", + GTBlocks.CASING_STAINLESS_TURBINE.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PhP", "PFP", + "PwP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.StainlessSteel), 'F', + GTBlocks.CASING_STEEL_TURBINE.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_titanium_turbine_casing", + GTBlocks.CASING_TITANIUM_TURBINE.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PhP", "PFP", + "PwP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Titanium), 'F', + GTBlocks.CASING_STEEL_TURBINE.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_tungstensteel_turbine_casing", + GTBlocks.CASING_TUNGSTENSTEEL_TURBINE.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PhP", + "PFP", "PwP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.TungstenSteel), 'F', + GTBlocks.CASING_STEEL_TURBINE.asStack()); + + VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_bronze_pipe", + GTBlocks.CASING_BRONZE_PIPE.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PIP", "IFI", "PIP", + 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Bronze), 'F', + new UnificationEntry(TagPrefix.frameGt, GTMaterials.Bronze), 'I', + new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.Bronze)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_steel_pipe", + GTBlocks.CASING_STEEL_PIPE.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PIP", "IFI", "PIP", + 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Steel), 'F', + new UnificationEntry(TagPrefix.frameGt, GTMaterials.Steel), 'I', + new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.Steel)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_titanium_pipe", + GTBlocks.CASING_TITANIUM_PIPE.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PIP", "IFI", + "PIP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Titanium), 'F', + new UnificationEntry(TagPrefix.frameGt, GTMaterials.Titanium), 'I', + new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.Titanium)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_tungstensteel_pipe", + GTBlocks.CASING_TUNGSTENSTEEL_PIPE.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PIP", "IFI", + "PIP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.TungstenSteel), 'F', + new UnificationEntry(TagPrefix.frameGt, GTMaterials.TungstenSteel), 'I', + new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.TungstenSteel)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_ptfe_pipe", + GTBlocks.CASING_POLYTETRAFLUOROETHYLENE_PIPE.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), + "PIP", "IFI", "PIP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Polytetrafluoroethylene), + 'F', new UnificationEntry(TagPrefix.frameGt, GTMaterials.Polytetrafluoroethylene), 'I', + new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.Polytetrafluoroethylene)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_bronze_firebox", GTBlocks.FIREBOX_BRONZE.asStack(2), + "PSP", "SFS", "PSP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Bronze), 'F', + new UnificationEntry(TagPrefix.frameGt, GTMaterials.Bronze), 'S', + new UnificationEntry(TagPrefix.rod, GTMaterials.Bronze)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_steel_firebox", GTBlocks.FIREBOX_STEEL.asStack(2), + "PSP", "SFS", "PSP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Steel), 'F', + new UnificationEntry(TagPrefix.frameGt, GTMaterials.Steel), 'S', + new UnificationEntry(TagPrefix.rod, GTMaterials.Steel)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_titanium_firebox", + GTBlocks.FIREBOX_TITANIUM.asStack(2), "PSP", "SFS", "PSP", 'P', + new UnificationEntry(TagPrefix.plate, GTMaterials.Titanium), 'F', + new UnificationEntry(TagPrefix.frameGt, GTMaterials.Titanium), 'S', + new UnificationEntry(TagPrefix.rod, GTMaterials.Titanium)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_tungstensteel_firebox", + GTBlocks.FIREBOX_TUNGSTENSTEEL.asStack(2), "PSP", "SFS", "PSP", 'P', + new UnificationEntry(TagPrefix.plate, GTMaterials.TungstenSteel), 'F', + new UnificationEntry(TagPrefix.frameGt, GTMaterials.TungstenSteel), 'S', + new UnificationEntry(TagPrefix.rod, GTMaterials.TungstenSteel)); + + VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_bronze_gearbox", + GTBlocks.CASING_BRONZE_GEARBOX.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PhP", "GFG", + "PwP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Bronze), 'F', + new UnificationEntry(TagPrefix.frameGt, GTMaterials.Bronze), 'G', + new UnificationEntry(TagPrefix.gear, GTMaterials.Bronze)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_steel_gearbox", + GTBlocks.CASING_STEEL_GEARBOX.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PhP", "GFG", + "PwP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Steel), 'F', + new UnificationEntry(TagPrefix.frameGt, GTMaterials.Steel), 'G', + new UnificationEntry(TagPrefix.gear, GTMaterials.Steel)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_stainless_steel_gearbox", + GTBlocks.CASING_STAINLESS_STEEL_GEARBOX.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PhP", + "GFG", "PwP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.StainlessSteel), 'F', + new UnificationEntry(TagPrefix.frameGt, GTMaterials.StainlessSteel), 'G', + new UnificationEntry(TagPrefix.gear, GTMaterials.StainlessSteel)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_titanium_gearbox", + GTBlocks.CASING_TITANIUM_GEARBOX.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PhP", "GFG", + "PwP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Titanium), 'F', + new UnificationEntry(TagPrefix.frameGt, GTMaterials.Titanium), 'G', + new UnificationEntry(TagPrefix.gear, GTMaterials.Titanium)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_tungstensteel_gearbox", + GTBlocks.CASING_TUNGSTENSTEEL_GEARBOX.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PhP", + "GFG", "PwP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.TungstenSteel), 'F', + new UnificationEntry(TagPrefix.frameGt, GTMaterials.TungstenSteel), 'G', + new UnificationEntry(TagPrefix.gear, GTMaterials.TungstenSteel)); + + VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_grate_casing", + GTBlocks.CASING_GRATE.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PVP", "PFP", "PMP", 'P', + new ItemStack(Blocks.IRON_BARS, 1), 'F', new UnificationEntry(TagPrefix.frameGt, GTMaterials.Steel), + 'M', GTItems.ELECTRIC_MOTOR_MV, 'V', new UnificationEntry(TagPrefix.rotor, GTMaterials.Steel)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_assembly_control", + GTBlocks.CASING_ASSEMBLY_CONTROL.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "CPC", "SFE", + "CMC", 'C', CustomTags.EV_CIRCUITS, 'P', GTItems.HIGH_POWER_INTEGRATED_CIRCUIT, 'S', + GTItems.SENSOR_IV.asStack(), 'F', new UnificationEntry(TagPrefix.frameGt, GTMaterials.TungstenSteel), + 'E', GTItems.EMITTER_IV.asStack(), 'M', GTItems.ELECTRIC_MOTOR_IV); + VanillaRecipeHelper.addShapedRecipe(provider, true, "casing_assembly_line", + GTBlocks.CASING_ASSEMBLY_LINE.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PGP", "AFA", + "PGP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Steel), 'G', + new UnificationEntry(TagPrefix.gear, GTMaterials.Ruridit), 'A', GTItems.ROBOT_ARM_IV.asStack(), 'F', + ChemicalHelper.get(TagPrefix.frameGt, GTMaterials.TungstenSteel)); + + VanillaRecipeHelper.addShapedRecipe(provider, true, "warning_sign_yellow_stripes", + GTBlocks.YELLOW_STRIPES_BLOCK_A.asStack(), "Y ", " M ", " B", 'M', + GTBlocks.CASING_STEEL_SOLID.asStack(), 'Y', Tags.Items.DYES_YELLOW, 'B', Tags.Items.DYES_BLACK); + VanillaRecipeHelper.addShapedRecipe(provider, true, "warning_sign_small_yellow_stripes", + GTBlocks.YELLOW_STRIPES_BLOCK_B.asStack(), " Y", " M ", "B ", 'M', + GTBlocks.CASING_STEEL_SOLID.asStack(), 'Y', Tags.Items.DYES_YELLOW, 'B', Tags.Items.DYES_BLACK); + VanillaRecipeHelper.addShapedRecipe(provider, true, "warning_sign_radioactive_hazard", + GTBlocks.RADIOACTIVE_HAZARD_SIGN_BLOCK.asStack(), " YB", " M ", " ", 'M', + GTBlocks.CASING_STEEL_SOLID.asStack(), 'Y', Tags.Items.DYES_YELLOW, 'B', Tags.Items.DYES_BLACK); + VanillaRecipeHelper.addShapedRecipe(provider, true, "warning_sign_bio_hazard", + GTBlocks.BIO_HAZARD_SIGN_BLOCK.asStack(), " Y ", " MB", " ", 'M', + GTBlocks.CASING_STEEL_SOLID.asStack(), 'Y', Tags.Items.DYES_YELLOW, 'B', Tags.Items.DYES_BLACK); + VanillaRecipeHelper.addShapedRecipe(provider, true, "warning_sign_explosion_hazard", + GTBlocks.EXPLOSION_HAZARD_SIGN_BLOCK.asStack(), " Y ", " M ", " B", 'M', + GTBlocks.CASING_STEEL_SOLID.asStack(), 'Y', Tags.Items.DYES_YELLOW, 'B', Tags.Items.DYES_BLACK); + VanillaRecipeHelper.addShapedRecipe(provider, true, "warning_sign_fire_hazard", + GTBlocks.FIRE_HAZARD_SIGN_BLOCK.asStack(), " Y ", " M ", " B ", 'M', + GTBlocks.CASING_STEEL_SOLID.asStack(), 'Y', Tags.Items.DYES_YELLOW, 'B', Tags.Items.DYES_BLACK); + VanillaRecipeHelper.addShapedRecipe(provider, true, "warning_sign_acid_hazard", + GTBlocks.ACID_HAZARD_SIGN_BLOCK.asStack(), " Y ", " M ", "B ", 'M', + GTBlocks.CASING_STEEL_SOLID.asStack(), 'Y', Tags.Items.DYES_YELLOW, 'B', Tags.Items.DYES_BLACK); + VanillaRecipeHelper.addShapedRecipe(provider, true, "warning_sign_magic_hazard", + GTBlocks.MAGIC_HAZARD_SIGN_BLOCK.asStack(), " Y ", "BM ", " ", 'M', + GTBlocks.CASING_STEEL_SOLID.asStack(), 'Y', Tags.Items.DYES_YELLOW, 'B', Tags.Items.DYES_BLACK); + VanillaRecipeHelper.addShapedRecipe(provider, true, "warning_sign_frost_hazard", + GTBlocks.FROST_HAZARD_SIGN_BLOCK.asStack(), "BY ", " M ", " ", 'M', + GTBlocks.CASING_STEEL_SOLID.asStack(), 'Y', Tags.Items.DYES_YELLOW, 'B', Tags.Items.DYES_BLACK); + VanillaRecipeHelper.addShapedRecipe(provider, true, "warning_sign_noise_hazard", + GTBlocks.NOISE_HAZARD_SIGN_BLOCK.asStack(), " ", " M ", "BY ", 'M', + GTBlocks.CASING_STEEL_SOLID.asStack(), 'Y', Tags.Items.DYES_YELLOW, 'B', Tags.Items.DYES_BLACK); + VanillaRecipeHelper.addShapedRecipe(provider, true, "warning_sign_generic_hazard", + GTBlocks.GENERIC_HAZARD_SIGN_BLOCK.asStack(), " ", "BM ", " Y ", 'M', + GTBlocks.CASING_STEEL_SOLID.asStack(), 'Y', Tags.Items.DYES_YELLOW, 'B', Tags.Items.DYES_BLACK); + VanillaRecipeHelper.addShapedRecipe(provider, true, "warning_sign_high_voltage_hazard", + GTBlocks.HIGH_VOLTAGE_HAZARD_SIGN_BLOCK.asStack(), "B ", " M ", " Y ", 'M', + GTBlocks.CASING_STEEL_SOLID.asStack(), 'Y', Tags.Items.DYES_YELLOW, 'B', Tags.Items.DYES_BLACK); + VanillaRecipeHelper.addShapedRecipe(provider, true, "warning_sign_magnetic_hazard", + GTBlocks.MAGNETIC_HAZARD_SIGN_BLOCK.asStack(), " B ", " M ", " Y ", 'M', + GTBlocks.CASING_STEEL_SOLID.asStack(), 'Y', Tags.Items.DYES_YELLOW, 'B', Tags.Items.DYES_BLACK); + VanillaRecipeHelper.addShapedRecipe(provider, true, "warning_sign_antimatter_hazard", + GTBlocks.ANTIMATTER_HAZARD_SIGN_BLOCK.asStack(), " B", " M ", " Y ", 'M', + GTBlocks.CASING_STEEL_SOLID.asStack(), 'Y', Tags.Items.DYES_YELLOW, 'B', Tags.Items.DYES_BLACK); + VanillaRecipeHelper.addShapedRecipe(provider, true, "warning_sign_high_temperature_hazard", + GTBlocks.HIGH_TEMPERATURE_HAZARD_SIGN_BLOCK.asStack(), " ", " MB", " Y ", 'M', + GTBlocks.CASING_STEEL_SOLID.asStack(), 'Y', Tags.Items.DYES_YELLOW, 'B', Tags.Items.DYES_BLACK); + VanillaRecipeHelper.addShapedRecipe(provider, true, "warning_sign_void_hazard", + GTBlocks.VOID_HAZARD_SIGN_BLOCK.asStack(), " ", " M ", " YB", 'M', + GTBlocks.CASING_STEEL_SOLID.asStack(), 'Y', Tags.Items.DYES_YELLOW, 'B', Tags.Items.DYES_BLACK); + VanillaRecipeHelper.addShapedRecipe(provider, true, "warning_mob_spawner_hazard", + GTBlocks.MOB_SPAWNER_HAZARD_SIGN_BLOCK.asStack(), "B ", "YM ", " ", 'M', + GTBlocks.CASING_STEEL_SOLID.asStack(), 'Y', Tags.Items.DYES_YELLOW, 'B', Tags.Items.DYES_BLACK); + VanillaRecipeHelper.addShapedRecipe(provider, true, "warning_spatial_storage_hazard", + GTBlocks.SPATIAL_STORAGE_HAZARD_SIGN_BLOCK.asStack(), " B ", "YM ", " ", 'M', + GTBlocks.CASING_STEEL_SOLID.asStack(), 'Y', Tags.Items.DYES_YELLOW, 'B', Tags.Items.DYES_BLACK); + VanillaRecipeHelper.addShapedRecipe(provider, true, "warning_laser_hazard", + GTBlocks.LASER_HAZARD_SIGN_BLOCK.asStack(), " B", "YM ", " ", 'M', + GTBlocks.CASING_STEEL_SOLID.asStack(), 'Y', Tags.Items.DYES_YELLOW, 'B', Tags.Items.DYES_BLACK); + VanillaRecipeHelper.addShapedRecipe(provider, true, "warning_mob_hazard", + GTBlocks.MOB_INFESTATION_HAZARD_SIGN_BLOCK.asStack(), " ", "YMB", " ", 'M', + GTBlocks.CASING_STEEL_SOLID.asStack(), 'Y', Tags.Items.DYES_YELLOW, 'B', Tags.Items.DYES_BLACK); + VanillaRecipeHelper.addShapedRecipe(provider, true, "warning_boss_hazard", + GTBlocks.BOSS_HAZARD_SIGN_BLOCK.asStack(), " ", "YM ", " B", 'M', + GTBlocks.CASING_STEEL_SOLID.asStack(), 'Y', Tags.Items.DYES_YELLOW, 'B', Tags.Items.DYES_BLACK); + VanillaRecipeHelper.addShapedRecipe(provider, true, "warning_gregification_hazard", + GTBlocks.GREGIFICATION_HAZARD_SIGN_BLOCK.asStack(), " ", "YM ", " B ", 'M', + GTBlocks.CASING_STEEL_SOLID.asStack(), 'Y', Tags.Items.DYES_YELLOW, 'B', Tags.Items.DYES_BLACK); + VanillaRecipeHelper.addShapedRecipe(provider, true, "warning_causality_hazard", + GTBlocks.CAUSALITY_HAZARD_SIGN_BLOCK.asStack(), " ", "YM ", "B ", 'M', + GTBlocks.CASING_STEEL_SOLID.asStack(), 'Y', Tags.Items.DYES_YELLOW, 'B', Tags.Items.DYES_BLACK); + VanillaRecipeHelper.addShapedRecipe(provider, true, "warning_turret_hazard", + GTBlocks.TURRET_HAZARD_SIGN_BLOCK.asStack(), " ", " MY", " B", 'M', + GTBlocks.CASING_STEEL_SOLID.asStack(), 'Y', Tags.Items.DYES_YELLOW, 'B', Tags.Items.DYES_BLACK); + VanillaRecipeHelper.addShapedRecipe(provider, true, "warning_high_pressure_hazard", + GTBlocks.HIGH_PRESSURE_HAZARD_SIGN_BLOCK.asStack(), " ", " MY", " B ", 'M', + GTBlocks.CASING_STEEL_SOLID.asStack(), 'Y', Tags.Items.DYES_YELLOW, 'B', Tags.Items.DYES_BLACK); + + VanillaRecipeHelper.addShapelessRecipe(provider, "yellow_stripes_to_steel_solid_casing", + GTBlocks.CASING_STEEL_SOLID.asStack(), GTBlocks.YELLOW_STRIPES_BLOCK_A.asStack()); + VanillaRecipeHelper.addShapelessRecipe(provider, "small_yellow_stripes_to_steel_solid_casing", + GTBlocks.CASING_STEEL_SOLID.asStack(), GTBlocks.YELLOW_STRIPES_BLOCK_B.asStack()); + VanillaRecipeHelper.addShapelessRecipe(provider, "radioactive_hazard_to_steel_solid_casing", + GTBlocks.CASING_STEEL_SOLID.asStack(), GTBlocks.RADIOACTIVE_HAZARD_SIGN_BLOCK.asStack()); + VanillaRecipeHelper.addShapelessRecipe(provider, "bio_hazard_to_steel_solid_casing", + GTBlocks.CASING_STEEL_SOLID.asStack(), GTBlocks.BIO_HAZARD_SIGN_BLOCK.asStack()); + VanillaRecipeHelper.addShapelessRecipe(provider, "explosion_hazard_to_steel_solid_casing", + GTBlocks.CASING_STEEL_SOLID.asStack(), GTBlocks.EXPLOSION_HAZARD_SIGN_BLOCK.asStack()); + VanillaRecipeHelper.addShapelessRecipe(provider, "fire_hazard_to_steel_solid_casing", + GTBlocks.CASING_STEEL_SOLID.asStack(), GTBlocks.FIRE_HAZARD_SIGN_BLOCK.asStack()); + VanillaRecipeHelper.addShapelessRecipe(provider, "acid_hazard_to_steel_solid_casing", + GTBlocks.CASING_STEEL_SOLID.asStack(), GTBlocks.ACID_HAZARD_SIGN_BLOCK.asStack()); + VanillaRecipeHelper.addShapelessRecipe(provider, "magic_hazard_to_steel_solid_casing", + GTBlocks.CASING_STEEL_SOLID.asStack(), GTBlocks.MAGIC_HAZARD_SIGN_BLOCK.asStack()); + VanillaRecipeHelper.addShapelessRecipe(provider, "frost_hazard_to_steel_solid_casing", + GTBlocks.CASING_STEEL_SOLID.asStack(), GTBlocks.FROST_HAZARD_SIGN_BLOCK.asStack()); + VanillaRecipeHelper.addShapelessRecipe(provider, "noise_hazard_to_steel_solid_casing", + GTBlocks.CASING_STEEL_SOLID.asStack(), GTBlocks.NOISE_HAZARD_SIGN_BLOCK.asStack()); + VanillaRecipeHelper.addShapelessRecipe(provider, "generic_hazard_to_steel_solid_casing", + GTBlocks.CASING_STEEL_SOLID.asStack(), GTBlocks.GENERIC_HAZARD_SIGN_BLOCK.asStack()); + VanillaRecipeHelper.addShapelessRecipe(provider, "high_voltage_hazard_to_steel_solid_casing", + GTBlocks.CASING_STEEL_SOLID.asStack(), GTBlocks.HIGH_VOLTAGE_HAZARD_SIGN_BLOCK.asStack()); + VanillaRecipeHelper.addShapelessRecipe(provider, "magnetic_hazard_to_steel_solid_casing", + GTBlocks.CASING_STEEL_SOLID.asStack(), GTBlocks.MAGNETIC_HAZARD_SIGN_BLOCK.asStack()); + VanillaRecipeHelper.addShapelessRecipe(provider, "antimatter_hazard_to_steel_solid_casing", + GTBlocks.CASING_STEEL_SOLID.asStack(), GTBlocks.ANTIMATTER_HAZARD_SIGN_BLOCK.asStack()); + VanillaRecipeHelper.addShapelessRecipe(provider, "high_temperature_hazard_to_steel_solid_casing", + GTBlocks.CASING_STEEL_SOLID.asStack(), GTBlocks.HIGH_TEMPERATURE_HAZARD_SIGN_BLOCK.asStack()); + VanillaRecipeHelper.addShapelessRecipe(provider, "void_hazard_to_steel_solid_casing", + GTBlocks.CASING_STEEL_SOLID.asStack(), GTBlocks.VOID_HAZARD_SIGN_BLOCK.asStack()); + VanillaRecipeHelper.addShapelessRecipe(provider, "mob_spawner_hazard_to_steel_solid_casing", + GTBlocks.CASING_STEEL_SOLID.asStack(), GTBlocks.MOB_SPAWNER_HAZARD_SIGN_BLOCK.asStack()); + VanillaRecipeHelper.addShapelessRecipe(provider, "laser_hazard_to_steel_solid_casing", + GTBlocks.CASING_STEEL_SOLID.asStack(), GTBlocks.LASER_HAZARD_SIGN_BLOCK.asStack()); + VanillaRecipeHelper.addShapelessRecipe(provider, "mob_hazard_to_steel_solid_casing", + GTBlocks.CASING_STEEL_SOLID.asStack(), GTBlocks.MOB_INFESTATION_HAZARD_SIGN_BLOCK.asStack()); + VanillaRecipeHelper.addShapelessRecipe(provider, "boss_hazard_to_steel_solid_casing", + GTBlocks.CASING_STEEL_SOLID.asStack(), GTBlocks.BOSS_HAZARD_SIGN_BLOCK.asStack()); + VanillaRecipeHelper.addShapelessRecipe(provider, "gregification_hazard_to_steel_solid_casing", + GTBlocks.CASING_STEEL_SOLID.asStack(), GTBlocks.GREGIFICATION_HAZARD_SIGN_BLOCK.asStack()); + VanillaRecipeHelper.addShapelessRecipe(provider, "causality_hazard_to_steel_solid_casing", + GTBlocks.CASING_STEEL_SOLID.asStack(), GTBlocks.CAUSALITY_HAZARD_SIGN_BLOCK.asStack()); + VanillaRecipeHelper.addShapelessRecipe(provider, "turret_hazard_to_steel_solid_casing", + GTBlocks.CASING_STEEL_SOLID.asStack(), GTBlocks.TURRET_HAZARD_SIGN_BLOCK.asStack()); + VanillaRecipeHelper.addShapelessRecipe(provider, "high_pressure_to_steel_solid_casing", + GTBlocks.CASING_STEEL_SOLID.asStack(), GTBlocks.HIGH_PRESSURE_HAZARD_SIGN_BLOCK.asStack()); + + var multiHatchMaterials = new Material[] { GTMaterials.Titanium, GTMaterials.TungstenSteel, GTMaterials.NiobiumTitanium, GTMaterials.Iridium, GTMaterials.Naquadah, GTMaterials.Neutronium }; @@ -160,277 +348,723 @@ public static void init(Consumer provider) { provider, true, "fluid_import_hatch_4x_" + tierName, importHatch4x.asStack(), "P", "M", 'M', importHatch.asStack(), - 'P', new UnificationEntry(TagPrefix.pipeQuadrupleFluid, material) - ); + 'P', new UnificationEntry(TagPrefix.pipeQuadrupleFluid, material)); VanillaRecipeHelper.addShapedRecipe( provider, true, "fluid_export_hatch_4x_" + tierName, exportHatch4x.asStack(), "M", "P", 'M', exportHatch.asStack(), - 'P', new UnificationEntry(TagPrefix.pipeQuadrupleFluid, material) - ); + 'P', new UnificationEntry(TagPrefix.pipeQuadrupleFluid, material)); VanillaRecipeHelper.addShapedRecipe( provider, true, "fluid_import_hatch_9x_" + tierName, importHatch9x.asStack(), "P", "M", 'M', importHatch.asStack(), - 'P', new UnificationEntry(TagPrefix.pipeNonupleFluid, material) - ); + 'P', new UnificationEntry(TagPrefix.pipeNonupleFluid, material)); VanillaRecipeHelper.addShapedRecipe( provider, true, "fluid_export_hatch_9x_" + tierName, exportHatch9x.asStack(), "M", "P", 'M', exportHatch.asStack(), - 'P', new UnificationEntry(TagPrefix.pipeNonupleFluid, material) - ); + 'P', new UnificationEntry(TagPrefix.pipeNonupleFluid, material)); } - VanillaRecipeHelper.addShapedRecipe(provider, true, "rotor_holder_hv", GTMachines.ROTOR_HOLDER[HV].asStack(), "SGS", "GHG", "SGS", 'H', GTMachines.HULL[HV].asStack(), 'G', new UnificationEntry(TagPrefix.gear, GTMaterials.BlackSteel), 'S', new UnificationEntry(TagPrefix.gearSmall, GTMaterials.StainlessSteel)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "rotor_holder_ev", GTMachines.ROTOR_HOLDER[EV].asStack(), "SGS", "GHG", "SGS", 'H', GTMachines.HULL[GTValues.EV].asStack(), 'G', new UnificationEntry(TagPrefix.gear, GTMaterials.Ultimet), 'S', new UnificationEntry(TagPrefix.gearSmall, GTMaterials.Titanium)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "rotor_holder_iv", GTMachines.ROTOR_HOLDER[IV].asStack(), "SGS", "GHG", "SGS", 'H', GTMachines.HULL[GTValues.IV].asStack(), 'G', new UnificationEntry(TagPrefix.gear, GTMaterials.HSSG), 'S', new UnificationEntry(TagPrefix.gearSmall, GTMaterials.TungstenSteel)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "rotor_holder_luv", GTMachines.ROTOR_HOLDER[LuV].asStack(), "SGS", "GHG", "SGS", 'H', GTMachines.HULL[GTValues.LuV].asStack(), 'G', new UnificationEntry(TagPrefix.gear, GTMaterials.Ruthenium), 'S', new UnificationEntry(TagPrefix.gearSmall, GTMaterials.RhodiumPlatedPalladium)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "rotor_holder_zpm", GTMachines.ROTOR_HOLDER[ZPM].asStack(), "SGS", "GHG", "SGS", 'H', GTMachines.HULL[GTValues.ZPM].asStack(), 'G', new UnificationEntry(TagPrefix.gear, GTMaterials.Trinium), 'S', new UnificationEntry(TagPrefix.gearSmall, GTMaterials.NaquadahAlloy)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "rotor_holder_uv", GTMachines.ROTOR_HOLDER[UV].asStack(), "SGS", "GHG", "SGS", 'H', GTMachines.HULL[GTValues.UV].asStack(), 'G', new UnificationEntry(TagPrefix.gear, GTMaterials.Tritanium), 'S', new UnificationEntry(TagPrefix.gearSmall, GTMaterials.Darmstadtium)); - - VanillaRecipeHelper.addShapedRecipe(provider, true, "maintenance_hatch", GTMachines.MAINTENANCE_HATCH.asStack(), "dwx", "hHc", "fsr", 'H', GTMachines.HULL[GTValues.LV].asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, true, "maintenance_hatch_configurable", GTMachines.CONFIGURABLE_MAINTENANCE_HATCH.asStack(), " ", "CMC", "VHV", 'C', CIRCUIT.getIngredient(HV), 'M', GTMachines.MAINTENANCE_HATCH.asStack(), 'V', CONVEYOR.getIngredient(HV), 'H', GTMachines.HULL[HV].asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, true, "maintenance_hatch_automatic", GTMachines.AUTO_MAINTENANCE_HATCH.asStack(), "CMC", "RHR", "CMC", 'C', CIRCUIT.getIngredient(HV), 'M', GTMachines.MAINTENANCE_HATCH.asStack(), 'R', ROBOT_ARM.getIngredient(HV), 'H', GTMachines.HULL[HV].asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, true, "maintenance_hatch_cleaning", GTMachines.CLEANING_MAINTENANCE_HATCH.asStack(), "CMC", "RHR", "WCW", 'C', CIRCUIT.getIngredient(GTValues.UV), 'M', GTMachines.AUTO_MAINTENANCE_HATCH.asStack(), 'R', ROBOT_ARM.getIngredient(GTValues.UV), 'H', GTMachines.HULL[GTValues.UV].asStack(), 'W', new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.YttriumBariumCuprate)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "rotor_holder_hv", GTMachines.ROTOR_HOLDER[HV].asStack(), + "SGS", "GHG", "SGS", 'H', GTMachines.HULL[HV].asStack(), 'G', + new UnificationEntry(TagPrefix.gear, GTMaterials.BlackSteel), 'S', + new UnificationEntry(TagPrefix.gearSmall, GTMaterials.StainlessSteel)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "rotor_holder_ev", GTMachines.ROTOR_HOLDER[EV].asStack(), + "SGS", "GHG", "SGS", 'H', GTMachines.HULL[GTValues.EV].asStack(), 'G', + new UnificationEntry(TagPrefix.gear, GTMaterials.Ultimet), 'S', + new UnificationEntry(TagPrefix.gearSmall, GTMaterials.Titanium)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "rotor_holder_iv", GTMachines.ROTOR_HOLDER[IV].asStack(), + "SGS", "GHG", "SGS", 'H', GTMachines.HULL[GTValues.IV].asStack(), 'G', + new UnificationEntry(TagPrefix.gear, GTMaterials.HSSG), 'S', + new UnificationEntry(TagPrefix.gearSmall, GTMaterials.TungstenSteel)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "rotor_holder_luv", GTMachines.ROTOR_HOLDER[LuV].asStack(), + "SGS", "GHG", "SGS", 'H', GTMachines.HULL[GTValues.LuV].asStack(), 'G', + new UnificationEntry(TagPrefix.gear, GTMaterials.Ruthenium), 'S', + new UnificationEntry(TagPrefix.gearSmall, GTMaterials.RhodiumPlatedPalladium)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "rotor_holder_zpm", GTMachines.ROTOR_HOLDER[ZPM].asStack(), + "SGS", "GHG", "SGS", 'H', GTMachines.HULL[GTValues.ZPM].asStack(), 'G', + new UnificationEntry(TagPrefix.gear, GTMaterials.Trinium), 'S', + new UnificationEntry(TagPrefix.gearSmall, GTMaterials.NaquadahAlloy)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "rotor_holder_uv", GTMachines.ROTOR_HOLDER[UV].asStack(), + "SGS", "GHG", "SGS", 'H', GTMachines.HULL[GTValues.UV].asStack(), 'G', + new UnificationEntry(TagPrefix.gear, GTMaterials.Tritanium), 'S', + new UnificationEntry(TagPrefix.gearSmall, GTMaterials.Darmstadtium)); + + VanillaRecipeHelper.addShapedRecipe(provider, true, "maintenance_hatch", GTMachines.MAINTENANCE_HATCH.asStack(), + "dwx", "hHc", "fsr", 'H', GTMachines.HULL[GTValues.LV].asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, true, "maintenance_hatch_configurable", + GTMachines.CONFIGURABLE_MAINTENANCE_HATCH.asStack(), " ", "CMC", "VHV", 'C', + CIRCUIT.getIngredient(HV), 'M', GTMachines.MAINTENANCE_HATCH.asStack(), 'V', CONVEYOR.getIngredient(HV), + 'H', GTMachines.HULL[HV].asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, true, "maintenance_hatch_automatic", + GTMachines.AUTO_MAINTENANCE_HATCH.asStack(), "CMC", "RHR", "CMC", 'C', CIRCUIT.getIngredient(HV), 'M', + GTMachines.MAINTENANCE_HATCH.asStack(), 'R', ROBOT_ARM.getIngredient(HV), 'H', + GTMachines.HULL[HV].asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, true, "maintenance_hatch_cleaning", + GTMachines.CLEANING_MAINTENANCE_HATCH.asStack(), "CMC", "RHR", "WCW", 'C', + CIRCUIT.getIngredient(GTValues.UV), 'M', GTMachines.AUTO_MAINTENANCE_HATCH.asStack(), 'R', + ROBOT_ARM.getIngredient(GTValues.UV), 'H', GTMachines.HULL[GTValues.UV].asStack(), 'W', + new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.YttriumBariumCuprate)); // TODO Access Interface - //VanillaRecipeHelper.addShapedRecipe(provider, true, "machine_access_interface", GTMachines.MACHINE_HATCH.getStackForm(), "CHS", 'C', CustomTags.IV), 'H', GTMachines.HULL[GTValues.IV].getStackForm(), 'S', MetaItems.SENSOR_IV.getStackForm()); - - VanillaRecipeHelper.addShapedRecipe(provider, true, "passthrough_hatch_item", GTMachines.ITEM_PASSTHROUGH_HATCH[HV].asStack(), " C ", "GHG", " S ", 'C', GTItems.CONVEYOR_MODULE_HV.asStack(), 'G', new UnificationEntry(TagPrefix.gearSmall, GTMaterials.Steel), 'H', GTMachines.HULL[HV].asStack(), 'S', CustomTags.WOODEN_CHESTS); - VanillaRecipeHelper.addShapedRecipe(provider, true, "passthrough_hatch_fluid", GTMachines.FLUID_PASSTHROUGH_HATCH[HV].asStack(), " C ", "GHG", " S ", 'C', GTItems.ELECTRIC_PUMP_HV.asStack(), 'G', new UnificationEntry(TagPrefix.pipeSmallFluid, GTMaterials.Steel), 'H', GTMachines.HULL[HV].asStack(), 'S', GTBlocks.CASING_TEMPERED_GLASS); + // VanillaRecipeHelper.addShapedRecipe(provider, true, "machine_access_interface", + // GTMachines.MACHINE_HATCH.getStackForm(), "CHS", 'C', CustomTags.IV), 'H', + // GTMachines.HULL[GTValues.IV].getStackForm(), 'S', MetaItems.SENSOR_IV.getStackForm()); + + VanillaRecipeHelper.addShapedRecipe(provider, true, "passthrough_hatch_item", + GTMachines.ITEM_PASSTHROUGH_HATCH[HV].asStack(), " C ", "GHG", " S ", 'C', + GTItems.CONVEYOR_MODULE_HV.asStack(), 'G', new UnificationEntry(TagPrefix.gearSmall, GTMaterials.Steel), + 'H', GTMachines.HULL[HV].asStack(), 'S', CustomTags.WOODEN_CHESTS); + VanillaRecipeHelper.addShapedRecipe(provider, true, "passthrough_hatch_fluid", + GTMachines.FLUID_PASSTHROUGH_HATCH[HV].asStack(), " C ", "GHG", " S ", 'C', + GTItems.ELECTRIC_PUMP_HV.asStack(), 'G', + new UnificationEntry(TagPrefix.pipeSmallFluid, GTMaterials.Steel), 'H', GTMachines.HULL[HV].asStack(), + 'S', GTBlocks.CASING_TEMPERED_GLASS); // TODO Charcoal pile igniter - //VanillaRecipeHelper.addShapedRecipe(provider, true, "charcoal_pile_igniter", GTMachines.CHARCOAL_PILE_IGNITER.getStackForm(), "ERE", "EHE", "FFF", 'E', new UnificationEntry(TagPrefix.plate, GTMaterials.Bronze), 'R', new UnificationEntry(TagPrefix.rotor, GTMaterials.Iron), 'H', MetaBlocks.STEAM_CASING.getItemVariant(BRONZE_BRICKS_HULL), 'F', new ItemStack(Items.FLINT)); + // VanillaRecipeHelper.addShapedRecipe(provider, true, "charcoal_pile_igniter", + // GTMachines.CHARCOAL_PILE_IGNITER.getStackForm(), "ERE", "EHE", "FFF", 'E', new + // UnificationEntry(TagPrefix.plate, GTMaterials.Bronze), 'R', new UnificationEntry(TagPrefix.rotor, + // GTMaterials.Iron), 'H', MetaBlocks.STEAM_CASING.getItemVariant(BRONZE_BRICKS_HULL), 'F', new + // ItemStack(Items.FLINT)); // STEAM MACHINES - VanillaRecipeHelper.addShapedRecipe(provider, true, "bronze_hull", GTBlocks.BRONZE_HULL.asStack(), "PPP", "PhP", "PPP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Bronze)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "bronze_bricks_hull", GTBlocks.BRONZE_BRICKS_HULL.asStack(), "PPP", "PhP", "BBB", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Bronze), 'B', new ItemStack(Blocks.BRICKS)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "steel_hull", GTBlocks.STEEL_HULL.asStack(), "PPP", "PhP", "PPP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Steel)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "steel_bricks_hull", GTBlocks.STEEL_BRICKS_HULL.asStack(), "PPP", "PhP", "BBB", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.WroughtIron), 'B', new ItemStack(Blocks.BRICKS)); - - VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_boiler_coal_bronze", GTMachines.STEAM_SOLID_BOILER.left().asStack(), "PPP", "PwP", "BFB", 'F', Blocks.FURNACE, 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Bronze), 'B', new ItemStack(Blocks.BRICKS)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_boiler_coal_steel", GTMachines.STEAM_SOLID_BOILER.right().asStack(), "PPP", "PwP", "BFB", 'F', Blocks.FURNACE, 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Steel), 'B', new ItemStack(Blocks.BRICKS)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_boiler_lava_bronze", GTMachines.STEAM_LIQUID_BOILER.left().asStack(), "PPP", "PGP", "PMP", 'M', GTBlocks.BRONZE_BRICKS_HULL.asStack(), 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Bronze), 'G', new ItemStack(Blocks.GLASS, 1)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_boiler_lava_steel", GTMachines.STEAM_LIQUID_BOILER.right().asStack(), "PPP", "PGP", "PMP", 'M', GTBlocks.STEEL_BRICKS_HULL.asStack(), 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Steel), 'G', new ItemStack(Blocks.GLASS, 1)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_boiler_solar_bronze", GTMachines.STEAM_SOLAR_BOILER.left().asStack(), "GGG", "SSS", "PMP", 'M', GTBlocks.BRONZE_BRICKS_HULL.asStack(), 'P', new UnificationEntry(TagPrefix.pipeSmallFluid, GTMaterials.Bronze), 'S', new UnificationEntry(TagPrefix.plate, GTMaterials.Silver), 'G', new ItemStack(Blocks.GLASS)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_boiler_solar_steel", GTMachines.STEAM_SOLAR_BOILER.right().asStack(), "GGG", "SSS", "PMP", 'M', GTBlocks.STEEL_BRICKS_HULL.asStack(), 'P', new UnificationEntry(TagPrefix.pipeSmallFluid, GTMaterials.Steel), 'S', new UnificationEntry(TagPrefix.plateDouble, GTMaterials.Silver), 'G', new ItemStack(Blocks.GLASS)); - - VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_furnace_bronze", GTMachines.STEAM_FURNACE.left().asStack(), "XXX", "XMX", "XFX", 'M', GTBlocks.BRONZE_BRICKS_HULL.asStack(), 'X', new UnificationEntry(TagPrefix.pipeSmallFluid, GTMaterials.Bronze), 'F', Blocks.FURNACE); - VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_furnace_steel", GTMachines.STEAM_FURNACE.right().asStack(), "XSX", "PMP", "XXX", 'M', GTMachines.STEAM_FURNACE.left().asStack(), 'X', new UnificationEntry(TagPrefix.pipeSmallFluid, GTMaterials.TinAlloy), 'S', new UnificationEntry(TagPrefix.plate, GTMaterials.Steel), 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.WroughtIron)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_macerator_bronze", GTMachines.STEAM_MACERATOR.left().asStack(), "DXD", "XMX", "PXP", 'M', GTBlocks.BRONZE_HULL.asStack(), 'X', new UnificationEntry(TagPrefix.pipeSmallFluid, GTMaterials.Bronze), 'P', CustomTags.TAG_PISTONS, 'D', new UnificationEntry(TagPrefix.gem, GTMaterials.Diamond)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_macerator_steel", GTMachines.STEAM_MACERATOR.right().asStack(), "WSW", "PMP", "WWW", 'M', GTMachines.STEAM_MACERATOR.left().asStack(), 'W', new UnificationEntry(TagPrefix.plate, GTMaterials.WroughtIron), 'S', new UnificationEntry(TagPrefix.plate, GTMaterials.Steel), 'P', new UnificationEntry(TagPrefix.pipeSmallFluid, GTMaterials.TinAlloy)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_extractor_bronze", GTMachines.STEAM_EXTRACTOR.left().asStack(), "XXX", "PMG", "XXX", 'M', GTBlocks.BRONZE_HULL.asStack(), 'X', new UnificationEntry(TagPrefix.pipeSmallFluid, GTMaterials.Bronze), 'P', CustomTags.TAG_PISTONS, 'G', new ItemStack(Blocks.GLASS)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_extractor_steel", GTMachines.STEAM_EXTRACTOR.right().asStack(), "PSP", "WMW", "PPP", 'M', GTMachines.STEAM_EXTRACTOR.left().asStack(), 'P', new UnificationEntry(TagPrefix.pipeSmallFluid, GTMaterials.TinAlloy), 'S', new UnificationEntry(TagPrefix.plate, GTMaterials.Steel), 'W', new UnificationEntry(TagPrefix.plate, GTMaterials.WroughtIron)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_hammer_bronze", GTMachines.STEAM_HAMMER.left().asStack(), "XPX", "XMX", "XAX", 'M', GTBlocks.BRONZE_HULL.asStack(), 'X', new UnificationEntry(TagPrefix.pipeSmallFluid, GTMaterials.Bronze), 'P', CustomTags.TAG_PISTONS, 'A', Blocks.ANVIL); - VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_hammer_steel", GTMachines.STEAM_HAMMER.right().asStack(), "WSW", "PMP", "WWW", 'M', GTMachines.STEAM_HAMMER.left().asStack(), 'S', new UnificationEntry(TagPrefix.plate, GTMaterials.Steel), 'W', new UnificationEntry(TagPrefix.plate, GTMaterials.WroughtIron), 'P', new UnificationEntry(TagPrefix.pipeSmallFluid, GTMaterials.TinAlloy)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_compressor_bronze", GTMachines.STEAM_COMPRESSOR.left().asStack(), "XXX", "PMP", "XXX", 'M', GTBlocks.BRONZE_HULL.asStack(), 'X', new UnificationEntry(TagPrefix.pipeSmallFluid, GTMaterials.Bronze), 'P', CustomTags.TAG_PISTONS); - VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_compressor_steel", GTMachines.STEAM_COMPRESSOR.right().asStack(), "PSP", "WMW", "PPP", 'M', GTMachines.STEAM_COMPRESSOR.left().asStack(), 'S', new UnificationEntry(TagPrefix.plate, GTMaterials.Steel), 'W', new UnificationEntry(TagPrefix.plate, GTMaterials.WroughtIron), 'P', new UnificationEntry(TagPrefix.pipeSmallFluid, GTMaterials.TinAlloy)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_alloy_smelter_bronze", GTMachines.STEAM_ALLOY_SMELTER.left().asStack(), "XXX", "FMF", "XXX", 'M', GTBlocks.BRONZE_BRICKS_HULL.asStack(), 'X', new UnificationEntry(TagPrefix.pipeSmallFluid, GTMaterials.Bronze), 'F', Blocks.FURNACE); - VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_alloy_smelter_steel", GTMachines.STEAM_ALLOY_SMELTER.right().asStack(), "WSW", "WMW", "WPW", 'M', GTMachines.STEAM_ALLOY_SMELTER.left().asStack(), 'S', new UnificationEntry(TagPrefix.plate, GTMaterials.Steel), 'W', new UnificationEntry(TagPrefix.plate, GTMaterials.WroughtIron), 'P', new UnificationEntry(TagPrefix.pipeSmallFluid, GTMaterials.TinAlloy)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_rock_breaker_bronze", GTMachines.STEAM_ROCK_CRUSHER.left().asStack(), "PXP", "XMX", "DXD", 'M', GTBlocks.BRONZE_HULL.asStack(), 'X', new UnificationEntry(TagPrefix.pipeSmallFluid, GTMaterials.Bronze), 'P', CustomTags.TAG_PISTONS, 'D', new UnificationEntry(TagPrefix.gem, GTMaterials.Diamond)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_rock_breaker_steel", GTMachines.STEAM_ROCK_CRUSHER.right().asStack(), "WSW", "PMP", "WWW", 'M', GTMachines.STEAM_ROCK_CRUSHER.left().asStack(), 'W', new UnificationEntry(TagPrefix.plate, GTMaterials.WroughtIron), 'S', new UnificationEntry(TagPrefix.plate, GTMaterials.Steel), 'P', new UnificationEntry(TagPrefix.pipeSmallFluid, GTMaterials.TinAlloy)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_miner", GTMachines.STEAM_MINER.asStack(), "DSD", "SMS", "GSG", 'M', GTBlocks.BRONZE_BRICKS_HULL.asStack(), 'S', new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.Bronze), 'D', new UnificationEntry(TagPrefix.gem, GTMaterials.Diamond), 'G', new UnificationEntry(TagPrefix.gearSmall, GTMaterials.Bronze)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "bronze_hull", GTBlocks.BRONZE_HULL.asStack(), "PPP", "PhP", + "PPP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Bronze)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "bronze_bricks_hull", GTBlocks.BRONZE_BRICKS_HULL.asStack(), + "PPP", "PhP", "BBB", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Bronze), 'B', + new ItemStack(Blocks.BRICKS)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "steel_hull", GTBlocks.STEEL_HULL.asStack(), "PPP", "PhP", + "PPP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Steel)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "steel_bricks_hull", GTBlocks.STEEL_BRICKS_HULL.asStack(), + "PPP", "PhP", "BBB", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.WroughtIron), 'B', + new ItemStack(Blocks.BRICKS)); + + VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_boiler_coal_bronze", + GTMachines.STEAM_SOLID_BOILER.left().asStack(), "PPP", "PwP", "BFB", 'F', Blocks.FURNACE, 'P', + new UnificationEntry(TagPrefix.plate, GTMaterials.Bronze), 'B', new ItemStack(Blocks.BRICKS)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_boiler_coal_steel", + GTMachines.STEAM_SOLID_BOILER.right().asStack(), "PPP", "PwP", "BFB", 'F', Blocks.FURNACE, 'P', + new UnificationEntry(TagPrefix.plate, GTMaterials.Steel), 'B', new ItemStack(Blocks.BRICKS)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_boiler_lava_bronze", + GTMachines.STEAM_LIQUID_BOILER.left().asStack(), "PPP", "PGP", "PMP", 'M', + GTBlocks.BRONZE_BRICKS_HULL.asStack(), 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Bronze), + 'G', new ItemStack(Blocks.GLASS, 1)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_boiler_lava_steel", + GTMachines.STEAM_LIQUID_BOILER.right().asStack(), "PPP", "PGP", "PMP", 'M', + GTBlocks.STEEL_BRICKS_HULL.asStack(), 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Steel), + 'G', new ItemStack(Blocks.GLASS, 1)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_boiler_solar_bronze", + GTMachines.STEAM_SOLAR_BOILER.left().asStack(), "GGG", "SSS", "PMP", 'M', + GTBlocks.BRONZE_BRICKS_HULL.asStack(), 'P', + new UnificationEntry(TagPrefix.pipeSmallFluid, GTMaterials.Bronze), 'S', + new UnificationEntry(TagPrefix.plate, GTMaterials.Silver), 'G', new ItemStack(Blocks.GLASS)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_boiler_solar_steel", + GTMachines.STEAM_SOLAR_BOILER.right().asStack(), "GGG", "SSS", "PMP", 'M', + GTBlocks.STEEL_BRICKS_HULL.asStack(), 'P', + new UnificationEntry(TagPrefix.pipeSmallFluid, GTMaterials.Steel), 'S', + new UnificationEntry(TagPrefix.plateDouble, GTMaterials.Silver), 'G', new ItemStack(Blocks.GLASS)); + + VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_furnace_bronze", + GTMachines.STEAM_FURNACE.left().asStack(), "XXX", "XMX", "XFX", 'M', + GTBlocks.BRONZE_BRICKS_HULL.asStack(), 'X', + new UnificationEntry(TagPrefix.pipeSmallFluid, GTMaterials.Bronze), 'F', Blocks.FURNACE); + VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_furnace_steel", + GTMachines.STEAM_FURNACE.right().asStack(), "XSX", "PMP", "XXX", 'M', + GTMachines.STEAM_FURNACE.left().asStack(), 'X', + new UnificationEntry(TagPrefix.pipeSmallFluid, GTMaterials.TinAlloy), 'S', + new UnificationEntry(TagPrefix.plate, GTMaterials.Steel), 'P', + new UnificationEntry(TagPrefix.plate, GTMaterials.WroughtIron)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_macerator_bronze", + GTMachines.STEAM_MACERATOR.left().asStack(), "DXD", "XMX", "PXP", 'M', GTBlocks.BRONZE_HULL.asStack(), + 'X', new UnificationEntry(TagPrefix.pipeSmallFluid, GTMaterials.Bronze), 'P', CustomTags.TAG_PISTONS, + 'D', new UnificationEntry(TagPrefix.gem, GTMaterials.Diamond)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_macerator_steel", + GTMachines.STEAM_MACERATOR.right().asStack(), "WSW", "PMP", "WWW", 'M', + GTMachines.STEAM_MACERATOR.left().asStack(), 'W', + new UnificationEntry(TagPrefix.plate, GTMaterials.WroughtIron), 'S', + new UnificationEntry(TagPrefix.plate, GTMaterials.Steel), 'P', + new UnificationEntry(TagPrefix.pipeSmallFluid, GTMaterials.TinAlloy)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_extractor_bronze", + GTMachines.STEAM_EXTRACTOR.left().asStack(), "XXX", "PMG", "XXX", 'M', GTBlocks.BRONZE_HULL.asStack(), + 'X', new UnificationEntry(TagPrefix.pipeSmallFluid, GTMaterials.Bronze), 'P', CustomTags.TAG_PISTONS, + 'G', new ItemStack(Blocks.GLASS)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_extractor_steel", + GTMachines.STEAM_EXTRACTOR.right().asStack(), "PSP", "WMW", "PPP", 'M', + GTMachines.STEAM_EXTRACTOR.left().asStack(), 'P', + new UnificationEntry(TagPrefix.pipeSmallFluid, GTMaterials.TinAlloy), 'S', + new UnificationEntry(TagPrefix.plate, GTMaterials.Steel), 'W', + new UnificationEntry(TagPrefix.plate, GTMaterials.WroughtIron)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_hammer_bronze", + GTMachines.STEAM_HAMMER.left().asStack(), "XPX", "XMX", "XAX", 'M', GTBlocks.BRONZE_HULL.asStack(), 'X', + new UnificationEntry(TagPrefix.pipeSmallFluid, GTMaterials.Bronze), 'P', CustomTags.TAG_PISTONS, 'A', + Blocks.ANVIL); + VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_hammer_steel", + GTMachines.STEAM_HAMMER.right().asStack(), "WSW", "PMP", "WWW", 'M', + GTMachines.STEAM_HAMMER.left().asStack(), 'S', new UnificationEntry(TagPrefix.plate, GTMaterials.Steel), + 'W', new UnificationEntry(TagPrefix.plate, GTMaterials.WroughtIron), 'P', + new UnificationEntry(TagPrefix.pipeSmallFluid, GTMaterials.TinAlloy)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_compressor_bronze", + GTMachines.STEAM_COMPRESSOR.left().asStack(), "XXX", "PMP", "XXX", 'M', GTBlocks.BRONZE_HULL.asStack(), + 'X', new UnificationEntry(TagPrefix.pipeSmallFluid, GTMaterials.Bronze), 'P', CustomTags.TAG_PISTONS); + VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_compressor_steel", + GTMachines.STEAM_COMPRESSOR.right().asStack(), "PSP", "WMW", "PPP", 'M', + GTMachines.STEAM_COMPRESSOR.left().asStack(), 'S', + new UnificationEntry(TagPrefix.plate, GTMaterials.Steel), 'W', + new UnificationEntry(TagPrefix.plate, GTMaterials.WroughtIron), 'P', + new UnificationEntry(TagPrefix.pipeSmallFluid, GTMaterials.TinAlloy)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_alloy_smelter_bronze", + GTMachines.STEAM_ALLOY_SMELTER.left().asStack(), "XXX", "FMF", "XXX", 'M', + GTBlocks.BRONZE_BRICKS_HULL.asStack(), 'X', + new UnificationEntry(TagPrefix.pipeSmallFluid, GTMaterials.Bronze), 'F', Blocks.FURNACE); + VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_alloy_smelter_steel", + GTMachines.STEAM_ALLOY_SMELTER.right().asStack(), "WSW", "WMW", "WPW", 'M', + GTMachines.STEAM_ALLOY_SMELTER.left().asStack(), 'S', + new UnificationEntry(TagPrefix.plate, GTMaterials.Steel), 'W', + new UnificationEntry(TagPrefix.plate, GTMaterials.WroughtIron), 'P', + new UnificationEntry(TagPrefix.pipeSmallFluid, GTMaterials.TinAlloy)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_rock_breaker_bronze", + GTMachines.STEAM_ROCK_CRUSHER.left().asStack(), "PXP", "XMX", "DXD", 'M', + GTBlocks.BRONZE_HULL.asStack(), 'X', new UnificationEntry(TagPrefix.pipeSmallFluid, GTMaterials.Bronze), + 'P', CustomTags.TAG_PISTONS, 'D', new UnificationEntry(TagPrefix.gem, GTMaterials.Diamond)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_rock_breaker_steel", + GTMachines.STEAM_ROCK_CRUSHER.right().asStack(), "WSW", "PMP", "WWW", 'M', + GTMachines.STEAM_ROCK_CRUSHER.left().asStack(), 'W', + new UnificationEntry(TagPrefix.plate, GTMaterials.WroughtIron), 'S', + new UnificationEntry(TagPrefix.plate, GTMaterials.Steel), 'P', + new UnificationEntry(TagPrefix.pipeSmallFluid, GTMaterials.TinAlloy)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_miner", GTMachines.STEAM_MINER.asStack(), "DSD", + "SMS", "GSG", 'M', GTBlocks.BRONZE_BRICKS_HULL.asStack(), 'S', + new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.Bronze), 'D', + new UnificationEntry(TagPrefix.gem, GTMaterials.Diamond), 'G', + new UnificationEntry(TagPrefix.gearSmall, GTMaterials.Bronze)); // MULTI BLOCK CONTROLLERS - VanillaRecipeHelper.addShapedRecipe(provider, true, "bronze_primitive_blast_furnace", GTMachines.PRIMITIVE_BLAST_FURNACE.asStack(), "hRS", "PBR", "dRS", 'R', new UnificationEntry(TagPrefix.rod, GTMaterials.Iron), 'S', new UnificationEntry(TagPrefix.screw, GTMaterials.Iron), 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Iron), 'B', GTBlocks.CASING_PRIMITIVE_BRICKS.asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, true, "coke_oven", GTMachines.COKE_OVEN.asStack(), "PIP", "IwI", "PIP", 'P', GTBlocks.CASING_COKE_BRICKS.asStack(), 'I', new UnificationEntry(TagPrefix.plate, GTMaterials.Iron)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "coke_oven_hatch", GTMachines.COKE_OVEN_HATCH.asStack(), "CD", 'C', GTBlocks.CASING_COKE_BRICKS.asStack(), 'D', GTMachines.WOODEN_DRUM.asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, true, "electric_blast_furnace", GTMachines.ELECTRIC_BLAST_FURNACE.asStack(), "FFF", "CMC", "WCW", 'M', GTBlocks.CASING_INVAR_HEATPROOF.asStack(), 'F', Blocks.FURNACE.asItem(), 'C', CustomTags.LV_CIRCUITS, 'W', new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Tin)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "vacuum_freezer", GTMachines.VACUUM_FREEZER.asStack(), "PPP", "CMC", "WCW", 'M', GTBlocks.CASING_ALUMINIUM_FROSTPROOF.asStack(), 'P', GTItems.ELECTRIC_PUMP_HV, 'C', CustomTags.EV_CIRCUITS, 'W', new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Gold)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "implosion_compressor", GTMachines.IMPLOSION_COMPRESSOR.asStack(), "OOO", "CMC", "WCW", 'M', GTBlocks.CASING_STEEL_SOLID.asStack(), 'O', new UnificationEntry(TagPrefix.rock, GTMaterials.Obsidian), 'C', CustomTags.HV_CIRCUITS, 'W', new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Gold)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "distillation_tower", GTMachines.DISTILLATION_TOWER.asStack(), "CBC", "FMF", "CBC", 'M', GTMachines.HULL[HV].asStack(), 'B', new UnificationEntry(TagPrefix.pipeLargeFluid, GTMaterials.StainlessSteel), 'C', CustomTags.EV_CIRCUITS, 'F', GTItems.ELECTRIC_PUMP_HV); - VanillaRecipeHelper.addShapedRecipe(provider, true, "cracking_unit", GTMachines.CRACKER.asStack(), "CEC", "PHP", "CEC", 'C', GTBlocks.COIL_CUPRONICKEL.asStack(), 'E', GTItems.ELECTRIC_PUMP_HV.asStack(), 'P', CustomTags.HV_CIRCUITS, 'H', GTMachines.HULL[HV].asStack()); - - VanillaRecipeHelper.addShapedRecipe(provider, true, "pyrolyse_oven", GTMachines.PYROLYSE_OVEN.asStack(), "WEP", "EME", "WCP", 'M', GTMachines.HULL[GTValues.MV].asStack(), 'W', GTItems.ELECTRIC_PISTON_MV.asStack(), 'P', new UnificationEntry(TagPrefix.wireGtQuadruple, GTMaterials.Cupronickel), 'E', CustomTags.MV_CIRCUITS, 'C', GTItems.ELECTRIC_PUMP_MV); - VanillaRecipeHelper.addShapedRecipe(provider, true, "large_combustion_engine", GTMachines.LARGE_COMBUSTION_ENGINE.asStack(), "PCP", "EME", "GWG", 'M', GTMachines.HULL[GTValues.EV].asStack(), 'P', GTItems.ELECTRIC_PISTON_EV.asStack(), 'E', GTItems.ELECTRIC_MOTOR_EV.asStack(), 'C', CustomTags.IV_CIRCUITS, 'W', new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Aluminium), 'G', new UnificationEntry(TagPrefix.gear, GTMaterials.Titanium)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "extreme_combustion_engine", GTMachines.EXTREME_COMBUSTION_ENGINE.asStack(), "PCP", "EME", "GWG", 'M', GTMachines.HULL[GTValues.IV].asStack(), 'P', GTItems.ELECTRIC_PISTON_IV.asStack(), 'E', GTItems.ELECTRIC_MOTOR_IV.asStack(), 'C', CustomTags.LuV_CIRCUITS, 'W', new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.HSSG), 'G', new UnificationEntry(TagPrefix.gear, GTMaterials.TungstenSteel)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "engine_intake_casing", GTBlocks.CASING_ENGINE_INTAKE.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PhP", "RFR", "PwP", 'R', new UnificationEntry(TagPrefix.rotor, GTMaterials.Titanium), 'F', GTBlocks.CASING_TITANIUM_STABLE.asStack(), 'P', new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.Titanium)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "extreme_engine_intake_casing", GTBlocks.CASING_EXTREME_ENGINE_INTAKE.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PhP", "RFR", "PwP", 'R', new UnificationEntry(TagPrefix.rotor, GTMaterials.TungstenSteel), 'F',GTBlocks.CASING_TUNGSTENSTEEL_ROBUST.asStack(), 'P', new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.TungstenSteel)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "multi_furnace", GTMachines.MULTI_SMELTER.asStack(), "PPP", "ASA", "CAC", 'P', Blocks.FURNACE, 'A', CustomTags.HV_CIRCUITS, 'S', GTBlocks.CASING_INVAR_HEATPROOF.asStack(), 'C', new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Copper)); - - VanillaRecipeHelper.addShapedRecipe(provider, true, "large_steam_turbine", GTMachines.LARGE_STEAM_TURBINE.asStack(), "PSP", "SAS", "CSC", 'S', new UnificationEntry(TagPrefix.gear, GTMaterials.Steel), 'P', CustomTags.HV_CIRCUITS, 'A', GTMachines.HULL[HV].asStack(), 'C', new UnificationEntry(TagPrefix.pipeLargeFluid, GTMaterials.Steel)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "large_gas_turbine", GTMachines.LARGE_GAS_TURBINE.asStack(), "PSP", "SAS", "CSC", 'S', new UnificationEntry(TagPrefix.gear, GTMaterials.StainlessSteel), 'P', CustomTags.EV_CIRCUITS, 'A', GTMachines.HULL[GTValues.EV].asStack(), 'C', new UnificationEntry(TagPrefix.pipeLargeFluid, GTMaterials.StainlessSteel)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "large_plasma_turbine", GTMachines.LARGE_PLASMA_TURBINE.asStack(), "PSP", "SAS", "CSC", 'S', new UnificationEntry(TagPrefix.gear, GTMaterials.TungstenSteel), 'P', CustomTags.LuV_CIRCUITS, 'A', GTMachines.HULL[GTValues.LuV].asStack(), 'C', new UnificationEntry(TagPrefix.pipeLargeFluid, GTMaterials.TungstenSteel)); - - VanillaRecipeHelper.addShapedRecipe(provider, true, "large_bronze_boiler", GTMachines.LARGE_BOILER_BRONZE.asStack(), "PSP", "SAS", "PSP", 'P', new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Tin), 'S', CustomTags.LV_CIRCUITS, 'A', GTBlocks.FIREBOX_BRONZE.asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, true, "large_steel_boiler", GTMachines.LARGE_BOILER_STEEL.asStack(), "PSP", "SAS", "PSP", 'P', new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Copper), 'S', CustomTags.HV_CIRCUITS, 'A', GTBlocks.FIREBOX_STEEL.asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, true, "large_titanium_boiler", GTMachines.LARGE_BOILER_TITANIUM.asStack(), "PSP", "SAS", "PSP", 'P', new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Gold), 'S', CustomTags.EV_CIRCUITS, 'A', GTBlocks.FIREBOX_TITANIUM.asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, true, "large_tungstensteel_boiler", GTMachines.LARGE_BOILER_TUNGSTENSTEEL.asStack(), "PSP", "SAS", "PSP", 'P', new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Aluminium), 'S', CustomTags.IV_CIRCUITS, 'A', GTBlocks.FIREBOX_TUNGSTENSTEEL.asStack()); - - VanillaRecipeHelper.addShapedRecipe(provider, true, "assembly_line", GTMachines.ASSEMBLY_LINE.asStack(), "CRC", "SAS", "CRC", 'A', GTMachines.HULL[GTValues.IV].asStack(), 'R', GTItems.ROBOT_ARM_IV, 'C', GTBlocks.CASING_ASSEMBLY_CONTROL.asStack(), 'S', CustomTags.IV_CIRCUITS); - - VanillaRecipeHelper.addShapedRecipe(provider, true, "large_chemical_reactor", GTMachines.LARGE_CHEMICAL_REACTOR.asStack(), "CRC", "PMP", "CHC", 'C', CustomTags.HV_CIRCUITS, 'R', ChemicalHelper.get(TagPrefix.rotor, GTMaterials.StainlessSteel), 'P', ChemicalHelper.get(TagPrefix.pipeLargeFluid, GTMaterials.Polytetrafluoroethylene), 'M', GTItems.ELECTRIC_MOTOR_HV.asStack(), 'H', GTMachines.HULL[HV].asStack()); - - VanillaRecipeHelper.addShapedRecipe(provider, true, "power_substation", GTMachines.POWER_SUBSTATION.asStack(), "LPL", "CBC", "LPL", 'L', GTItems.LAPOTRON_CRYSTAL, 'P', GTItems.POWER_INTEGRATED_CIRCUIT, 'C', CustomTags.LuV_CIRCUITS, 'B', GTBlocks.CASING_PALLADIUM_SUBSTATION.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, true, "bronze_primitive_blast_furnace", + GTMachines.PRIMITIVE_BLAST_FURNACE.asStack(), "hRS", "PBR", "dRS", 'R', + new UnificationEntry(TagPrefix.rod, GTMaterials.Iron), 'S', + new UnificationEntry(TagPrefix.screw, GTMaterials.Iron), 'P', + new UnificationEntry(TagPrefix.plate, GTMaterials.Iron), 'B', + GTBlocks.CASING_PRIMITIVE_BRICKS.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, true, "coke_oven", GTMachines.COKE_OVEN.asStack(), "PIP", "IwI", + "PIP", 'P', GTBlocks.CASING_COKE_BRICKS.asStack(), 'I', + new UnificationEntry(TagPrefix.plate, GTMaterials.Iron)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "coke_oven_hatch", GTMachines.COKE_OVEN_HATCH.asStack(), + "CD", 'C', GTBlocks.CASING_COKE_BRICKS.asStack(), 'D', GTMachines.WOODEN_DRUM.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, true, "electric_blast_furnace", + GTMachines.ELECTRIC_BLAST_FURNACE.asStack(), "FFF", "CMC", "WCW", 'M', + GTBlocks.CASING_INVAR_HEATPROOF.asStack(), 'F', Blocks.FURNACE.asItem(), 'C', CustomTags.LV_CIRCUITS, + 'W', new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Tin)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "vacuum_freezer", GTMachines.VACUUM_FREEZER.asStack(), + "PPP", "CMC", "WCW", 'M', GTBlocks.CASING_ALUMINIUM_FROSTPROOF.asStack(), 'P', GTItems.ELECTRIC_PUMP_HV, + 'C', CustomTags.EV_CIRCUITS, 'W', new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Gold)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "implosion_compressor", + GTMachines.IMPLOSION_COMPRESSOR.asStack(), "OOO", "CMC", "WCW", 'M', + GTBlocks.CASING_STEEL_SOLID.asStack(), 'O', new UnificationEntry(TagPrefix.rock, GTMaterials.Obsidian), + 'C', CustomTags.HV_CIRCUITS, 'W', new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Gold)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "distillation_tower", + GTMachines.DISTILLATION_TOWER.asStack(), "CBC", "FMF", "CBC", 'M', GTMachines.HULL[HV].asStack(), 'B', + new UnificationEntry(TagPrefix.pipeLargeFluid, GTMaterials.StainlessSteel), 'C', CustomTags.EV_CIRCUITS, + 'F', GTItems.ELECTRIC_PUMP_HV); + VanillaRecipeHelper.addShapedRecipe(provider, true, "evaporation_plant", + GTMachines.EVAPORATION_PLANT.asStack(), "CBC", "FMF", "CBC", 'M', GTMachines.HULL[HV].asStack(), + 'B', new UnificationEntry(TagPrefix.wireGtDouble, GTMaterials.Kanthal), 'C', CustomTags.HV_CIRCUITS, + 'F', GTItems.ELECTRIC_PUMP_HV); + VanillaRecipeHelper.addShapedRecipe(provider, true, "cracking_unit", GTMachines.CRACKER.asStack(), "CEC", "PHP", + "CEC", 'C', GTBlocks.COIL_CUPRONICKEL.asStack(), 'E', GTItems.ELECTRIC_PUMP_HV.asStack(), 'P', + CustomTags.HV_CIRCUITS, 'H', GTMachines.HULL[HV].asStack()); + + VanillaRecipeHelper.addShapedRecipe(provider, true, "pyrolyse_oven", GTMachines.PYROLYSE_OVEN.asStack(), "WEP", + "EME", "WCP", 'M', GTMachines.HULL[GTValues.MV].asStack(), 'W', GTItems.ELECTRIC_PISTON_MV.asStack(), + 'P', new UnificationEntry(TagPrefix.wireGtQuadruple, GTMaterials.Cupronickel), 'E', + CustomTags.MV_CIRCUITS, 'C', GTItems.ELECTRIC_PUMP_MV); + VanillaRecipeHelper.addShapedRecipe(provider, true, "large_combustion_engine", + GTMachines.LARGE_COMBUSTION_ENGINE.asStack(), "PCP", "EME", "GWG", 'M', + GTMachines.HULL[GTValues.EV].asStack(), 'P', GTItems.ELECTRIC_PISTON_EV.asStack(), 'E', + GTItems.ELECTRIC_MOTOR_EV.asStack(), 'C', CustomTags.IV_CIRCUITS, 'W', + new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Aluminium), 'G', + new UnificationEntry(TagPrefix.gear, GTMaterials.Titanium)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "extreme_combustion_engine", + GTMachines.EXTREME_COMBUSTION_ENGINE.asStack(), "PCP", "EME", "GWG", 'M', + GTMachines.HULL[GTValues.IV].asStack(), 'P', GTItems.ELECTRIC_PISTON_IV.asStack(), 'E', + GTItems.ELECTRIC_MOTOR_IV.asStack(), 'C', CustomTags.LuV_CIRCUITS, 'W', + new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.HSSG), 'G', + new UnificationEntry(TagPrefix.gear, GTMaterials.TungstenSteel)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "engine_intake_casing", + GTBlocks.CASING_ENGINE_INTAKE.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PhP", "RFR", + "PwP", 'R', new UnificationEntry(TagPrefix.rotor, GTMaterials.Titanium), 'F', + GTBlocks.CASING_TITANIUM_STABLE.asStack(), 'P', + new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.Titanium)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "extreme_engine_intake_casing", + GTBlocks.CASING_EXTREME_ENGINE_INTAKE.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "PhP", + "RFR", "PwP", 'R', new UnificationEntry(TagPrefix.rotor, GTMaterials.TungstenSteel), 'F', + GTBlocks.CASING_TUNGSTENSTEEL_ROBUST.asStack(), 'P', + new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.TungstenSteel)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "multi_furnace", GTMachines.MULTI_SMELTER.asStack(), "PPP", + "ASA", "CAC", 'P', Blocks.FURNACE, 'A', CustomTags.HV_CIRCUITS, 'S', + GTBlocks.CASING_INVAR_HEATPROOF.asStack(), 'C', + new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Copper)); + + VanillaRecipeHelper.addShapedRecipe(provider, true, "large_steam_turbine", + GTMachines.LARGE_STEAM_TURBINE.asStack(), "PSP", "SAS", "CSC", 'S', + new UnificationEntry(TagPrefix.gear, GTMaterials.Steel), 'P', CustomTags.HV_CIRCUITS, 'A', + GTMachines.HULL[HV].asStack(), 'C', new UnificationEntry(TagPrefix.pipeLargeFluid, GTMaterials.Steel)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "large_gas_turbine", GTMachines.LARGE_GAS_TURBINE.asStack(), + "PSP", "SAS", "CSC", 'S', new UnificationEntry(TagPrefix.gear, GTMaterials.StainlessSteel), 'P', + CustomTags.EV_CIRCUITS, 'A', GTMachines.HULL[GTValues.EV].asStack(), 'C', + new UnificationEntry(TagPrefix.pipeLargeFluid, GTMaterials.StainlessSteel)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "large_plasma_turbine", + GTMachines.LARGE_PLASMA_TURBINE.asStack(), "PSP", "SAS", "CSC", 'S', + new UnificationEntry(TagPrefix.gear, GTMaterials.TungstenSteel), 'P', CustomTags.LuV_CIRCUITS, 'A', + GTMachines.HULL[GTValues.LuV].asStack(), 'C', + new UnificationEntry(TagPrefix.pipeLargeFluid, GTMaterials.TungstenSteel)); + + VanillaRecipeHelper.addShapedRecipe(provider, true, "large_bronze_boiler", + GTMachines.LARGE_BOILER_BRONZE.asStack(), "PSP", "SAS", "PSP", 'P', + new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Tin), 'S', CustomTags.LV_CIRCUITS, 'A', + GTBlocks.FIREBOX_BRONZE.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, true, "large_steel_boiler", + GTMachines.LARGE_BOILER_STEEL.asStack(), "PSP", "SAS", "PSP", 'P', + new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Copper), 'S', CustomTags.HV_CIRCUITS, 'A', + GTBlocks.FIREBOX_STEEL.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, true, "large_titanium_boiler", + GTMachines.LARGE_BOILER_TITANIUM.asStack(), "PSP", "SAS", "PSP", 'P', + new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Gold), 'S', CustomTags.EV_CIRCUITS, 'A', + GTBlocks.FIREBOX_TITANIUM.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, true, "large_tungstensteel_boiler", + GTMachines.LARGE_BOILER_TUNGSTENSTEEL.asStack(), "PSP", "SAS", "PSP", 'P', + new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Aluminium), 'S', CustomTags.IV_CIRCUITS, 'A', + GTBlocks.FIREBOX_TUNGSTENSTEEL.asStack()); + + VanillaRecipeHelper.addShapedRecipe(provider, true, "assembly_line", GTMachines.ASSEMBLY_LINE.asStack(), "CRC", + "SAS", "CRC", 'A', GTMachines.HULL[GTValues.IV].asStack(), 'R', GTItems.ROBOT_ARM_IV, 'C', + GTBlocks.CASING_ASSEMBLY_CONTROL.asStack(), 'S', CustomTags.IV_CIRCUITS); + + VanillaRecipeHelper.addShapedRecipe(provider, true, "large_chemical_reactor", + GTMachines.LARGE_CHEMICAL_REACTOR.asStack(), "CRC", "PMP", "CHC", 'C', CustomTags.HV_CIRCUITS, 'R', + ChemicalHelper.get(TagPrefix.rotor, GTMaterials.StainlessSteel), 'P', + ChemicalHelper.get(TagPrefix.pipeLargeFluid, GTMaterials.Polytetrafluoroethylene), 'M', + GTItems.ELECTRIC_MOTOR_HV.asStack(), 'H', GTMachines.HULL[HV].asStack()); + + VanillaRecipeHelper.addShapedRecipe(provider, true, "power_substation", GTMachines.POWER_SUBSTATION.asStack(), + "LPL", "CBC", "LPL", 'L', GTItems.LAPOTRON_CRYSTAL, 'P', GTItems.POWER_INTEGRATED_CIRCUIT, 'C', + CustomTags.LuV_CIRCUITS, 'B', GTBlocks.CASING_PALLADIUM_SUBSTATION.asStack()); // GENERATORS - VanillaRecipeHelper.addShapedRecipe(provider, true, "diesel_generator_lv", GTMachines.COMBUSTION[LV].asStack(), "PCP", "EME", "GWG", 'M', GTMachines.HULL[GTValues.LV].asStack(), 'P', GTItems.ELECTRIC_PISTON_LV, 'E', GTItems.ELECTRIC_MOTOR_LV, 'C', CustomTags.LV_CIRCUITS, 'W', new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Tin), 'G', new UnificationEntry(TagPrefix.gear, GTMaterials.Steel)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "diesel_generator_mv", GTMachines.COMBUSTION[MV].asStack(), "PCP", "EME", "GWG", 'M', GTMachines.HULL[GTValues.MV].asStack(), 'P', GTItems.ELECTRIC_PISTON_MV, 'E', GTItems.ELECTRIC_MOTOR_MV, 'C', CustomTags.MV_CIRCUITS, 'W', new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Copper), 'G', new UnificationEntry(TagPrefix.gear, GTMaterials.Aluminium)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "diesel_generator_hv", GTMachines.COMBUSTION[HV].asStack(), "PCP", "EME", "GWG", 'M', GTMachines.HULL[HV].asStack(), 'P', GTItems.ELECTRIC_PISTON_HV, 'E', GTItems.ELECTRIC_MOTOR_HV, 'C', CustomTags.HV_CIRCUITS, 'W', new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Gold), 'G', new UnificationEntry(TagPrefix.gear, GTMaterials.StainlessSteel)); - - VanillaRecipeHelper.addShapedRecipe(provider, true, "gas_turbine_lv", GTMachines.GAS_TURBINE[LV].asStack(), "CRC", "RMR", "EWE", 'M', GTMachines.HULL[GTValues.LV].asStack(), 'E', GTItems.ELECTRIC_MOTOR_LV, 'R', new UnificationEntry(TagPrefix.rotor, GTMaterials.Tin), 'C', CustomTags.LV_CIRCUITS, 'W', new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Tin)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "gas_turbine_mv", GTMachines.GAS_TURBINE[MV].asStack(), "CRC", "RMR", "EWE", 'M', GTMachines.HULL[GTValues.MV].asStack(), 'E', GTItems.ELECTRIC_MOTOR_MV, 'R', new UnificationEntry(TagPrefix.rotor, GTMaterials.Bronze), 'C', CustomTags.MV_CIRCUITS, 'W', new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Copper)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "gas_turbine_hv", GTMachines.GAS_TURBINE[HV].asStack(), "CRC", "RMR", "EWE", 'M', GTMachines.HULL[HV].asStack(), 'E', GTItems.ELECTRIC_MOTOR_HV, 'R', new UnificationEntry(TagPrefix.rotor, GTMaterials.Steel), 'C', CustomTags.HV_CIRCUITS, 'W', new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Gold)); - - VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_turbine_lv", GTMachines.STEAM_TURBINE[LV].asStack(), "PCP", "RMR", "EWE", 'M', GTMachines.HULL[GTValues.LV].asStack(), 'E', GTItems.ELECTRIC_MOTOR_LV, 'R', new UnificationEntry(TagPrefix.rotor, GTMaterials.Tin), 'C', CustomTags.LV_CIRCUITS, 'W', new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Tin), 'P', new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.Bronze)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_turbine_mv", GTMachines.STEAM_TURBINE[MV].asStack(), "PCP", "RMR", "EWE", 'M', GTMachines.HULL[GTValues.MV].asStack(), 'E', GTItems.ELECTRIC_MOTOR_MV, 'R', new UnificationEntry(TagPrefix.rotor, GTMaterials.Bronze), 'C', CustomTags.MV_CIRCUITS, 'W', new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Copper), 'P', new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.Steel)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_turbine_hv", GTMachines.STEAM_TURBINE[HV].asStack(), "PCP", "RMR", "EWE", 'M', GTMachines.HULL[HV].asStack(), 'E', GTItems.ELECTRIC_MOTOR_HV, 'R', new UnificationEntry(TagPrefix.rotor, GTMaterials.Steel), 'C', CustomTags.HV_CIRCUITS, 'W', new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Gold), 'P', new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.StainlessSteel)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "diesel_generator_lv", GTMachines.COMBUSTION[LV].asStack(), + "PCP", "EME", "GWG", 'M', GTMachines.HULL[GTValues.LV].asStack(), 'P', GTItems.ELECTRIC_PISTON_LV, 'E', + GTItems.ELECTRIC_MOTOR_LV, 'C', CustomTags.LV_CIRCUITS, 'W', + new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Tin), 'G', + new UnificationEntry(TagPrefix.gear, GTMaterials.Steel)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "diesel_generator_mv", GTMachines.COMBUSTION[MV].asStack(), + "PCP", "EME", "GWG", 'M', GTMachines.HULL[GTValues.MV].asStack(), 'P', GTItems.ELECTRIC_PISTON_MV, 'E', + GTItems.ELECTRIC_MOTOR_MV, 'C', CustomTags.MV_CIRCUITS, 'W', + new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Copper), 'G', + new UnificationEntry(TagPrefix.gear, GTMaterials.Aluminium)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "diesel_generator_hv", GTMachines.COMBUSTION[HV].asStack(), + "PCP", "EME", "GWG", 'M', GTMachines.HULL[HV].asStack(), 'P', GTItems.ELECTRIC_PISTON_HV, 'E', + GTItems.ELECTRIC_MOTOR_HV, 'C', CustomTags.HV_CIRCUITS, 'W', + new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Gold), 'G', + new UnificationEntry(TagPrefix.gear, GTMaterials.StainlessSteel)); + + VanillaRecipeHelper.addShapedRecipe(provider, true, "gas_turbine_lv", GTMachines.GAS_TURBINE[LV].asStack(), + "CRC", "RMR", "EWE", 'M', GTMachines.HULL[GTValues.LV].asStack(), 'E', GTItems.ELECTRIC_MOTOR_LV, 'R', + new UnificationEntry(TagPrefix.rotor, GTMaterials.Tin), 'C', CustomTags.LV_CIRCUITS, 'W', + new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Tin)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "gas_turbine_mv", GTMachines.GAS_TURBINE[MV].asStack(), + "CRC", "RMR", "EWE", 'M', GTMachines.HULL[GTValues.MV].asStack(), 'E', GTItems.ELECTRIC_MOTOR_MV, 'R', + new UnificationEntry(TagPrefix.rotor, GTMaterials.Bronze), 'C', CustomTags.MV_CIRCUITS, 'W', + new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Copper)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "gas_turbine_hv", GTMachines.GAS_TURBINE[HV].asStack(), + "CRC", "RMR", "EWE", 'M', GTMachines.HULL[HV].asStack(), 'E', GTItems.ELECTRIC_MOTOR_HV, 'R', + new UnificationEntry(TagPrefix.rotor, GTMaterials.Steel), 'C', CustomTags.HV_CIRCUITS, 'W', + new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Gold)); + + VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_turbine_lv", GTMachines.STEAM_TURBINE[LV].asStack(), + "PCP", "RMR", "EWE", 'M', GTMachines.HULL[GTValues.LV].asStack(), 'E', GTItems.ELECTRIC_MOTOR_LV, 'R', + new UnificationEntry(TagPrefix.rotor, GTMaterials.Tin), 'C', CustomTags.LV_CIRCUITS, 'W', + new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Tin), 'P', + new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.Bronze)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_turbine_mv", GTMachines.STEAM_TURBINE[MV].asStack(), + "PCP", "RMR", "EWE", 'M', GTMachines.HULL[GTValues.MV].asStack(), 'E', GTItems.ELECTRIC_MOTOR_MV, 'R', + new UnificationEntry(TagPrefix.rotor, GTMaterials.Bronze), 'C', CustomTags.MV_CIRCUITS, 'W', + new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Copper), 'P', + new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.Steel)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "steam_turbine_hv", GTMachines.STEAM_TURBINE[HV].asStack(), + "PCP", "RMR", "EWE", 'M', GTMachines.HULL[HV].asStack(), 'E', GTItems.ELECTRIC_MOTOR_HV, 'R', + new UnificationEntry(TagPrefix.rotor, GTMaterials.Steel), 'C', CustomTags.HV_CIRCUITS, 'W', + new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.Gold), 'P', + new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.StainlessSteel)); // TODO Crafting station - //VanillaRecipeHelper.addShapedRecipe(provider, true, "workbench_bronze", GTMachines.WORKBENCH.getStackForm(), "CSC", "PWP", "PsP", 'C', OreDictNames.chestWood, 'W', new ItemStack(Blocks.CRAFTING_TABLE), 'S', OreDictUnifier.get("slabWood"), 'P', new UnificationEntry(TagPrefix.plank, GTMaterials.Wood)); - - VanillaRecipeHelper.addShapedRecipe(provider, true, "primitive_pump", GTMachines.PRIMITIVE_PUMP.asStack(), "RGS", "OWd", "CLC", 'R', new UnificationEntry(TagPrefix.ring, GTMaterials.Iron), 'G', new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.Wood), 'S', new UnificationEntry(TagPrefix.screw, GTMaterials.Iron), 'O', new UnificationEntry(TagPrefix.rotor, GTMaterials.Iron), 'W', GTBlocks.TREATED_WOOD_PLANK.asStack(), 'C', new ItemStack(Items.COBBLESTONE_SLAB), 'L', new UnificationEntry(TagPrefix.pipeLargeFluid, GTMaterials.Wood)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "pump_deck", GTBlocks.CASING_PUMP_DECK.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "SWS", "dCh", 'S', new UnificationEntry(TagPrefix.screw, GTMaterials.Iron), 'W', GTBlocks.TREATED_WOOD_PLANK.asStack(), 'C', new ItemStack(Items.COBBLESTONE_SLAB)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "pump_hatch", GTMachines.PUMP_HATCH.asStack(), "SRd", "PLP", "CRC", 'S', new UnificationEntry(TagPrefix.screw, GTMaterials.Iron), 'R', new UnificationEntry(TagPrefix.ring, GTMaterials.Iron), 'P', GTBlocks.TREATED_WOOD_PLANK.asStack(), 'L', new UnificationEntry(TagPrefix.pipeLargeFluid, GTMaterials.Wood), 'C', new ItemStack(Items.COBBLESTONE_SLAB)); - - VanillaRecipeHelper.addShapedRecipe(provider, true, "wood_multiblock_tank", GTMachines.WOODEN_MULTIBLOCK_TANK.asStack(), " R ", "rCs", " R ", 'R', new UnificationEntry(TagPrefix.ring, GTMaterials.Lead), 'C', GTBlocks.CASING_WOOD_WALL.asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, true, "steel_multiblock_tank", GTMachines.STEEL_MULTIBLOCK_TANK.asStack(), " R ", "hCw", " R ", 'R', new UnificationEntry(TagPrefix.ring, GTMaterials.Steel), 'C', GTBlocks.CASING_STEEL_SOLID.asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, true, "wood_tank_valve", GTMachines.WOODEN_TANK_VALVE.asStack(), " R ", "rCs", " O ", 'O', new UnificationEntry(TagPrefix.rotor, GTMaterials.Lead), 'R', new UnificationEntry(TagPrefix.ring, GTMaterials.Lead), 'C', GTBlocks.CASING_WOOD_WALL.asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, true, "steel_tank_valve", GTMachines.STEEL_TANK_VALVE.asStack(), " R ", "hCw", " O ", 'O', new UnificationEntry(TagPrefix.rotor, GTMaterials.Steel), 'R', new UnificationEntry(TagPrefix.ring, GTMaterials.Steel), 'C', GTBlocks.CASING_STEEL_SOLID.asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, true, "wood_wall", GTBlocks.CASING_WOOD_WALL.asStack(), "W W", "sPh", "W W", 'W', GTBlocks.TREATED_WOOD_PLANK.asStack(), 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Lead)); + // VanillaRecipeHelper.addShapedRecipe(provider, true, "workbench_bronze", GTMachines.WORKBENCH.getStackForm(), + // "CSC", "PWP", "PsP", 'C', OreDictNames.chestWood, 'W', new ItemStack(Blocks.CRAFTING_TABLE), 'S', + // OreDictUnifier.get("slabWood"), 'P', new UnificationEntry(TagPrefix.plank, GTMaterials.Wood)); + + VanillaRecipeHelper.addShapedRecipe(provider, true, "primitive_pump", GTMachines.PRIMITIVE_PUMP.asStack(), + "RGS", "OWd", "CLC", 'R', new UnificationEntry(TagPrefix.ring, GTMaterials.Iron), 'G', + new UnificationEntry(TagPrefix.pipeNormalFluid, GTMaterials.Wood), 'S', + new UnificationEntry(TagPrefix.screw, GTMaterials.Iron), 'O', + new UnificationEntry(TagPrefix.rotor, GTMaterials.Iron), 'W', GTBlocks.TREATED_WOOD_PLANK.asStack(), + 'C', new ItemStack(Items.COBBLESTONE_SLAB), 'L', + new UnificationEntry(TagPrefix.pipeLargeFluid, GTMaterials.Wood)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "pump_deck", + GTBlocks.CASING_PUMP_DECK.asStack(ConfigHolder.INSTANCE.recipes.casingsPerCraft), "SWS", "dCh", 'S', + new UnificationEntry(TagPrefix.screw, GTMaterials.Iron), 'W', GTBlocks.TREATED_WOOD_PLANK.asStack(), + 'C', new ItemStack(Items.COBBLESTONE_SLAB)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "pump_hatch", GTMachines.PUMP_HATCH.asStack(), "SRd", "PLP", + "CRC", 'S', new UnificationEntry(TagPrefix.screw, GTMaterials.Iron), 'R', + new UnificationEntry(TagPrefix.ring, GTMaterials.Iron), 'P', GTBlocks.TREATED_WOOD_PLANK.asStack(), 'L', + new UnificationEntry(TagPrefix.pipeLargeFluid, GTMaterials.Wood), 'C', + new ItemStack(Items.COBBLESTONE_SLAB)); + + VanillaRecipeHelper.addShapedRecipe(provider, true, "wood_multiblock_tank", + GTMachines.WOODEN_MULTIBLOCK_TANK.asStack(), " R ", "rCs", " R ", 'R', + new UnificationEntry(TagPrefix.ring, GTMaterials.Lead), 'C', GTBlocks.CASING_WOOD_WALL.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, true, "steel_multiblock_tank", + GTMachines.STEEL_MULTIBLOCK_TANK.asStack(), " R ", "hCw", " R ", 'R', + new UnificationEntry(TagPrefix.ring, GTMaterials.Steel), 'C', GTBlocks.CASING_STEEL_SOLID.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, true, "wood_tank_valve", GTMachines.WOODEN_TANK_VALVE.asStack(), + " R ", "rCs", " O ", 'O', new UnificationEntry(TagPrefix.rotor, GTMaterials.Lead), 'R', + new UnificationEntry(TagPrefix.ring, GTMaterials.Lead), 'C', GTBlocks.CASING_WOOD_WALL.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, true, "steel_tank_valve", GTMachines.STEEL_TANK_VALVE.asStack(), + " R ", "hCw", " O ", 'O', new UnificationEntry(TagPrefix.rotor, GTMaterials.Steel), 'R', + new UnificationEntry(TagPrefix.ring, GTMaterials.Steel), 'C', GTBlocks.CASING_STEEL_SOLID.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, true, "wood_wall", GTBlocks.CASING_WOOD_WALL.asStack(), "W W", + "sPh", "W W", 'W', GTBlocks.TREATED_WOOD_PLANK.asStack(), 'P', + new UnificationEntry(TagPrefix.plate, GTMaterials.Lead)); // MACHINES - registerMachineRecipe(provider, GTMachines.ALLOY_SMELTER, "ECE", "CMC", "WCW", 'M', HULL, 'E', CIRCUIT, 'W', CABLE, 'C', COIL_HEATING_DOUBLE); - registerMachineRecipe(provider, GTMachines.ASSEMBLER, "ACA", "VMV", "WCW", 'M', HULL, 'V', CONVEYOR, 'A', ROBOT_ARM, 'C', CIRCUIT, 'W', CABLE); - registerMachineRecipe(provider, GTMachines.BENDER, "PwP", "CMC", "EWE", 'M', HULL, 'E', MOTOR, 'P', PISTON, 'C', CIRCUIT, 'W', CABLE); - registerMachineRecipe(provider, GTMachines.CANNER, "WPW", "CMC", "GGG", 'M', HULL, 'P', PUMP, 'C', CIRCUIT, 'W', CABLE, 'G', GLASS); - registerMachineRecipe(provider, GTMachines.COMPRESSOR, " C ", "PMP", "WCW", 'M', HULL, 'P', PISTON, 'C', CIRCUIT, 'W', CABLE); - registerMachineRecipe(provider, GTMachines.CUTTER, "WCG", "VMB", "CWE", 'M', HULL, 'E', MOTOR, 'V', CONVEYOR, 'C', CIRCUIT, 'W', CABLE, 'G', GLASS, 'B', SAWBLADE); - registerMachineRecipe(provider, GTMachines.ELECTRIC_FURNACE, "ECE", "CMC", "WCW", 'M', HULL, 'E', CIRCUIT, 'W', CABLE, 'C', COIL_HEATING); - registerMachineRecipe(provider, GTMachines.EXTRACTOR, "GCG", "EMP", "WCW", 'M', HULL, 'E', PISTON, 'P', PUMP, 'C', CIRCUIT, 'W', CABLE, 'G', GLASS); - registerMachineRecipe(provider, GTMachines.EXTRUDER, "CCE", "XMP", "CCE", 'M', HULL, 'X', PISTON, 'E', CIRCUIT, 'P', PIPE_NORMAL, 'C', COIL_HEATING_DOUBLE); - registerMachineRecipe(provider, GTMachines.LATHE, "WCW", "EMD", "CWP", 'M', HULL, 'E', MOTOR, 'P', PISTON, 'C', CIRCUIT, 'W', CABLE, 'D', GRINDER); - registerMachineRecipe(provider, GTMachines.MACERATOR, "PEG", "WWM", "CCW", 'M', HULL, 'E', MOTOR, 'P', PISTON, 'C', CIRCUIT, 'W', CABLE, 'G', GRINDER); - registerMachineRecipe(provider, GTMachines.WIREMILL, "EWE", "CMC", "EWE", 'M', HULL, 'E', MOTOR, 'C', CIRCUIT, 'W', CABLE); - registerMachineRecipe(provider, GTMachines.CENTRIFUGE, "CEC", "WMW", "CEC", 'M', HULL, 'E', MOTOR, 'C', CIRCUIT, 'W', CABLE); - registerMachineRecipe(provider, GTMachines.ELECTROLYZER, "IGI", "IMI", "CWC", 'M', HULL, 'C', CIRCUIT, 'W', CABLE, 'I', WIRE_ELECTRIC, 'G', GLASS); - registerMachineRecipe(provider, GTMachines.THERMAL_CENTRIFUGE, "CEC", "OMO", "WEW", 'M', HULL, 'E', MOTOR, 'C', CIRCUIT, 'W', CABLE, 'O', COIL_HEATING_DOUBLE); - registerMachineRecipe(provider, GTMachines.ORE_WASHER, "RGR", "CEC", "WMW", 'M', HULL, 'R', ROTOR, 'E', MOTOR, 'C', CIRCUIT, 'W', CABLE, 'G', GLASS); - registerMachineRecipe(provider, GTMachines.CHEMICAL_REACTOR, "GRG", "WEW", "CMC", 'M', HULL, 'R', ROTOR, 'E', MOTOR, 'C', CIRCUIT, 'W', CABLE, 'G', PIPE_REACTOR); - registerMachineRecipe(provider, GTMachines.PACKER, "BCB", "RMV", "WCW", 'M', HULL, 'R', ROBOT_ARM, 'V', CONVEYOR, 'C', CIRCUIT, 'W', CABLE, 'B', CustomTags.WOODEN_CHESTS); - registerMachineRecipe(provider, GTMachines.BREWERY, "GPG", "WMW", "CBC", 'M', HULL, 'P', PUMP, 'B', STICK_DISTILLATION, 'C', CIRCUIT, 'W', CABLE, 'G', GLASS); - registerMachineRecipe(provider, GTMachines.FERMENTER, "WPW", "GMG", "WCW", 'M', HULL, 'P', PUMP, 'C', CIRCUIT, 'W', CABLE, 'G', GLASS); - registerMachineRecipe(provider, GTMachines.DISTILLERY, "GBG", "CMC", "WPW", 'M', HULL, 'P', PUMP, 'B', STICK_DISTILLATION, 'C', CIRCUIT, 'W', CABLE, 'G', GLASS); - registerMachineRecipe(provider, GTMachines.FLUID_SOLIDIFIER, "PGP", "WMW", "CBC", 'M', HULL, 'P', PUMP, 'C', CIRCUIT, 'W', CABLE, 'G', GLASS, 'B', CustomTags.WOODEN_CHESTS); - registerMachineRecipe(provider, GTMachines.CHEMICAL_BATH, "VGW", "PGV", "CMC", 'M', HULL, 'P', PUMP, 'V', CONVEYOR, 'C', CIRCUIT, 'W', CABLE, 'G', GLASS); - registerMachineRecipe(provider, GTMachines.POLARIZER, "ZSZ", "WMW", "ZSZ", 'M', HULL, 'S', STICK_ELECTROMAGNETIC, 'Z', COIL_ELECTRIC, 'W', CABLE); - registerMachineRecipe(provider, GTMachines.ELECTROMAGNETIC_SEPARATOR, "VWZ", "WMS", "CWZ", 'M', HULL, 'S', STICK_ELECTROMAGNETIC, 'Z', COIL_ELECTRIC, 'V', CONVEYOR, 'C', CIRCUIT, 'W', CABLE); - registerMachineRecipe(provider, GTMachines.AUTOCLAVE, "IGI", "IMI", "CPC", 'M', HULL, 'P', PUMP, 'C', CIRCUIT, 'I', PLATE, 'G', GLASS); - registerMachineRecipe(provider, GTMachines.MIXER, "GRG", "GEG", "CMC", 'M', HULL, 'E', MOTOR, 'R', ROTOR, 'C', CIRCUIT, 'G', GLASS); - registerMachineRecipe(provider, GTMachines.LASER_ENGRAVER, "PEP", "CMC", "WCW", 'M', HULL, 'E', EMITTER, 'P', PISTON, 'C', CIRCUIT, 'W', CABLE); - registerMachineRecipe(provider, GTMachines.FORMING_PRESS, "WPW", "CMC", "WPW", 'M', HULL, 'P', PISTON, 'C', CIRCUIT, 'W', CABLE); - registerMachineRecipe(provider, GTMachines.FORGE_HAMMER, "WPW", "CMC", "WAW", 'M', HULL, 'P', PISTON, 'C', CIRCUIT, 'W', CABLE, 'A', Blocks.ANVIL); - registerMachineRecipe(provider, GTMachines.FLUID_HEATER, "OGO", "PMP", "WCW", 'M', HULL, 'P', PUMP, 'O', COIL_HEATING_DOUBLE, 'C', CIRCUIT, 'W', CABLE, 'G', GLASS); - registerMachineRecipe(provider, GTMachines.SIFTER, "WFW", "PMP", "CFC", 'M', HULL, 'P', PISTON, 'F', GTItems.ITEM_FILTER, 'C', CIRCUIT, 'W', CABLE); - registerMachineRecipe(provider, GTMachines.ARC_FURNACE, "WGW", "CMC", "PPP", 'M', HULL, 'P', PLATE, 'C', CIRCUIT, 'W', CABLE_QUAD, 'G', new UnificationEntry(TagPrefix.dust, GTMaterials.Graphite)); - registerMachineRecipe(provider, GTMachines.CIRCUIT_ASSEMBLER, "RIE", "CHC", "WIW", 'R', ROBOT_ARM, 'I', BETTER_CIRCUIT, 'E', EMITTER, 'C', CONVEYOR, 'H', HULL, 'W', CABLE); + registerMachineRecipe(provider, GTMachines.ALLOY_SMELTER, "ECE", "CMC", "WCW", 'M', HULL, 'E', CIRCUIT, 'W', + CABLE, 'C', COIL_HEATING_DOUBLE); + registerMachineRecipe(provider, GTMachines.ASSEMBLER, "ACA", "VMV", "WCW", 'M', HULL, 'V', CONVEYOR, 'A', + ROBOT_ARM, 'C', CIRCUIT, 'W', CABLE); + registerMachineRecipe(provider, GTMachines.BENDER, "PwP", "CMC", "EWE", 'M', HULL, 'E', MOTOR, 'P', PISTON, 'C', + CIRCUIT, 'W', CABLE); + registerMachineRecipe(provider, GTMachines.CANNER, "WPW", "CMC", "GGG", 'M', HULL, 'P', PUMP, 'C', CIRCUIT, 'W', + CABLE, 'G', GLASS); + registerMachineRecipe(provider, GTMachines.COMPRESSOR, " C ", "PMP", "WCW", 'M', HULL, 'P', PISTON, 'C', + CIRCUIT, 'W', CABLE); + registerMachineRecipe(provider, GTMachines.CUTTER, "WCG", "VMB", "CWE", 'M', HULL, 'E', MOTOR, 'V', CONVEYOR, + 'C', CIRCUIT, 'W', CABLE, 'G', GLASS, 'B', SAWBLADE); + registerMachineRecipe(provider, GTMachines.ELECTRIC_FURNACE, "ECE", "CMC", "WCW", 'M', HULL, 'E', CIRCUIT, 'W', + CABLE, 'C', COIL_HEATING); + registerMachineRecipe(provider, GTMachines.EXTRACTOR, "GCG", "EMP", "WCW", 'M', HULL, 'E', PISTON, 'P', PUMP, + 'C', CIRCUIT, 'W', CABLE, 'G', GLASS); + registerMachineRecipe(provider, GTMachines.EXTRUDER, "CCE", "XMP", "CCE", 'M', HULL, 'X', PISTON, 'E', CIRCUIT, + 'P', PIPE_NORMAL, 'C', COIL_HEATING_DOUBLE); + registerMachineRecipe(provider, GTMachines.LATHE, "WCW", "EMD", "CWP", 'M', HULL, 'E', MOTOR, 'P', PISTON, 'C', + CIRCUIT, 'W', CABLE, 'D', GRINDER); + registerMachineRecipe(provider, GTMachines.MACERATOR, "PEG", "WWM", "CCW", 'M', HULL, 'E', MOTOR, 'P', PISTON, + 'C', CIRCUIT, 'W', CABLE, 'G', GRINDER); + registerMachineRecipe(provider, GTMachines.WIREMILL, "EWE", "CMC", "EWE", 'M', HULL, 'E', MOTOR, 'C', CIRCUIT, + 'W', CABLE); + registerMachineRecipe(provider, GTMachines.CENTRIFUGE, "CEC", "WMW", "CEC", 'M', HULL, 'E', MOTOR, 'C', CIRCUIT, + 'W', CABLE); + registerMachineRecipe(provider, GTMachines.ELECTROLYZER, "IGI", "IMI", "CWC", 'M', HULL, 'C', CIRCUIT, 'W', + CABLE, 'I', WIRE_ELECTRIC, 'G', GLASS); + registerMachineRecipe(provider, GTMachines.THERMAL_CENTRIFUGE, "CEC", "OMO", "WEW", 'M', HULL, 'E', MOTOR, 'C', + CIRCUIT, 'W', CABLE, 'O', COIL_HEATING_DOUBLE); + registerMachineRecipe(provider, GTMachines.ORE_WASHER, "RGR", "CEC", "WMW", 'M', HULL, 'R', ROTOR, 'E', MOTOR, + 'C', CIRCUIT, 'W', CABLE, 'G', GLASS); + registerMachineRecipe(provider, GTMachines.CHEMICAL_REACTOR, "GRG", "WEW", "CMC", 'M', HULL, 'R', ROTOR, 'E', + MOTOR, 'C', CIRCUIT, 'W', CABLE, 'G', PIPE_REACTOR); + registerMachineRecipe(provider, GTMachines.PACKER, "BCB", "RMV", "WCW", 'M', HULL, 'R', ROBOT_ARM, 'V', + CONVEYOR, 'C', CIRCUIT, 'W', CABLE, 'B', CustomTags.WOODEN_CHESTS); + registerMachineRecipe(provider, GTMachines.BREWERY, "GPG", "WMW", "CBC", 'M', HULL, 'P', PUMP, 'B', + STICK_DISTILLATION, 'C', CIRCUIT, 'W', CABLE, 'G', GLASS); + registerMachineRecipe(provider, GTMachines.FERMENTER, "WPW", "GMG", "WCW", 'M', HULL, 'P', PUMP, 'C', CIRCUIT, + 'W', CABLE, 'G', GLASS); + registerMachineRecipe(provider, GTMachines.DISTILLERY, "GBG", "CMC", "WPW", 'M', HULL, 'P', PUMP, 'B', + STICK_DISTILLATION, 'C', CIRCUIT, 'W', CABLE, 'G', GLASS); + registerMachineRecipe(provider, GTMachines.FLUID_SOLIDIFIER, "PGP", "WMW", "CBC", 'M', HULL, 'P', PUMP, 'C', + CIRCUIT, 'W', CABLE, 'G', GLASS, 'B', CustomTags.WOODEN_CHESTS); + registerMachineRecipe(provider, GTMachines.CHEMICAL_BATH, "VGW", "PGV", "CMC", 'M', HULL, 'P', PUMP, 'V', + CONVEYOR, 'C', CIRCUIT, 'W', CABLE, 'G', GLASS); + registerMachineRecipe(provider, GTMachines.POLARIZER, "ZSZ", "WMW", "ZSZ", 'M', HULL, 'S', + STICK_ELECTROMAGNETIC, 'Z', COIL_ELECTRIC, 'W', CABLE); + registerMachineRecipe(provider, GTMachines.ELECTROMAGNETIC_SEPARATOR, "VWZ", "WMS", "CWZ", 'M', HULL, 'S', + STICK_ELECTROMAGNETIC, 'Z', COIL_ELECTRIC, 'V', CONVEYOR, 'C', CIRCUIT, 'W', CABLE); + registerMachineRecipe(provider, GTMachines.AUTOCLAVE, "IGI", "IMI", "CPC", 'M', HULL, 'P', PUMP, 'C', CIRCUIT, + 'I', PLATE, 'G', GLASS); + registerMachineRecipe(provider, GTMachines.MIXER, "GRG", "GEG", "CMC", 'M', HULL, 'E', MOTOR, 'R', ROTOR, 'C', + CIRCUIT, 'G', GLASS); + registerMachineRecipe(provider, GTMachines.LASER_ENGRAVER, "PEP", "CMC", "WCW", 'M', HULL, 'E', EMITTER, 'P', + PISTON, 'C', CIRCUIT, 'W', CABLE); + registerMachineRecipe(provider, GTMachines.FORMING_PRESS, "WPW", "CMC", "WPW", 'M', HULL, 'P', PISTON, 'C', + CIRCUIT, 'W', CABLE); + registerMachineRecipe(provider, GTMachines.FORGE_HAMMER, "WPW", "CMC", "WAW", 'M', HULL, 'P', PISTON, 'C', + CIRCUIT, 'W', CABLE, 'A', Blocks.ANVIL); + registerMachineRecipe(provider, GTMachines.FLUID_HEATER, "OGO", "PMP", "WCW", 'M', HULL, 'P', PUMP, 'O', + COIL_HEATING_DOUBLE, 'C', CIRCUIT, 'W', CABLE, 'G', GLASS); + registerMachineRecipe(provider, GTMachines.SIFTER, "WFW", "PMP", "CFC", 'M', HULL, 'P', PISTON, 'F', + GTItems.ITEM_FILTER, 'C', CIRCUIT, 'W', CABLE); + registerMachineRecipe(provider, GTMachines.ARC_FURNACE, "WGW", "CMC", "PPP", 'M', HULL, 'P', PLATE, 'C', + CIRCUIT, 'W', CABLE_QUAD, 'G', new UnificationEntry(TagPrefix.dust, GTMaterials.Graphite)); + registerMachineRecipe(provider, GTMachines.CIRCUIT_ASSEMBLER, "RIE", "CHC", "WIW", 'R', ROBOT_ARM, 'I', + BETTER_CIRCUIT, 'E', EMITTER, 'C', CONVEYOR, 'H', HULL, 'W', CABLE); // TODO Replication system - //registerMachineRecipe(GTMachines.MASS_FABRICATOR, "CFC", "QMQ", "CFC", 'M', HULL, 'Q', CABLE_QUAD, 'C', BETTER_CIRCUIT, 'F', FIELD_GENERATOR); - //registerMachineRecipe(GTMachines.REPLICATOR, "EFE", "CMC", "EQE", 'M', HULL, 'Q', CABLE_QUAD, 'C', BETTER_CIRCUIT, 'F', FIELD_GENERATOR, 'E', EMITTER); - registerMachineRecipe(provider, GTMachines.SCANNER, "CEC", "WHW", "CSC", 'C', BETTER_CIRCUIT, 'E', EMITTER, 'W', CABLE, 'H', HULL, 'S', SENSOR); - registerMachineRecipe(provider, GTMachines.GAS_COLLECTOR, "WFW", "PHP", "WCW", 'W', Blocks.IRON_BARS, 'F', GTItems.FLUID_FILTER, 'P', PUMP, 'H', HULL, 'C', CIRCUIT); - registerMachineRecipe(provider, GTMachines.ROCK_CRUSHER, "PMW", "CHC", "GGG", 'P', PISTON, 'M', MOTOR, 'W', GRINDER, 'C', CABLE, 'H', HULL, 'G', GLASS); - registerMachineRecipe(provider, GTMachines.PUMP, "WGW", "GMG", "TGT", 'M', HULL, 'W', CIRCUIT, 'G', PUMP, 'T', PIPE_LARGE); - - registerMachineRecipe(provider, GTMachines.FISHER, "WTW", "PMP", "TGT", 'M', HULL, 'W', CIRCUIT, 'G', PUMP, 'T', MOTOR, 'P', PISTON); - registerMachineRecipe(provider, GTMachines.ITEM_COLLECTOR, "MRM", "RHR", "CWC", 'M', MOTOR, 'R', ROTOR, 'H', HULL, 'C', CIRCUIT, 'W', CABLE); - if(ConfigHolder.INSTANCE.machines.enableWorldAccelerators) - registerMachineRecipe(provider, GTMachines.WORLD_ACCELERATOR, "FSF", "EHE", "FSF", 'F', FIELD_GENERATOR, 'S', SENSOR, 'E', EMITTER, 'H', HULL); - registerMachineRecipe(provider, GTMachines.BLOCK_BREAKER, "MGM", "CHC", "WSW", 'M', MOTOR, 'H', HULL, 'C', CIRCUIT, 'W', CABLE, 'S', CustomTags.WOODEN_CHESTS, 'G', GRINDER); - registerMachineRecipe(provider, GTMachines.MINER, "MMM", "WHW", "CSC", 'M', MOTOR, 'W', CABLE, 'H', HULL, 'C', CIRCUIT, 'S', SENSOR); - - registerMachineRecipe(provider, GTMachines.MUFFLER_HATCH, "HM", "PR", 'H', HULL, 'M', MOTOR, 'P', PIPE_NORMAL, 'R', ROTOR); - - registerMachineRecipe(provider, ArrayUtils.subarray(GTMachines.DIODE, GTValues.ULV, HV), "CDC", "DHD", "PDP", 'H', HULL, 'D', GTItems.DIODE, 'P', PLATE, 'C', CABLE_QUAD); - registerMachineRecipe(provider, ArrayUtils.subarray(GTMachines.DIODE, HV, GTValues.LuV), "CDC", "DHD", "PDP", 'H', HULL, 'D', GTItems.SMD_DIODE, 'P', PLATE, 'C', CABLE_QUAD); - registerMachineRecipe(provider, ArrayUtils.subarray(GTMachines.DIODE, GTValues.LuV, GTMachines.DIODE.length), "CDC", "DHD", "PDP", 'H', HULL, 'D', GTItems.ADVANCED_SMD_DIODE, 'P', PLATE, 'C', CABLE_QUAD); - - registerMachineRecipe(provider, ArrayUtils.subarray(GTMachines.TRANSFORMER, GTValues.ULV, GTValues.MV), " CC", "TH ", " CC", 'C', CABLE, 'T', CABLE_TIER_UP, 'H', HULL); - registerMachineRecipe(provider, ArrayUtils.subarray(GTMachines.TRANSFORMER, GTValues.MV, GTValues.UHV), "WCC", "TH ", "WCC", 'W', POWER_COMPONENT, 'C', CABLE, 'T', CABLE_TIER_UP, 'H', HULL); - registerMachineRecipe(provider, ArrayUtils.subarray(GTMachines.HI_AMP_TRANSFORMER_2A, GTValues.ULV, GTValues.MV), " CC", "TH ", " CC", 'C', CABLE_DOUBLE, 'T', CABLE_TIER_UP_DOUBLE, 'H', HULL); - registerMachineRecipe(provider, ArrayUtils.subarray(GTMachines.HI_AMP_TRANSFORMER_2A, GTValues.MV, GTValues.UHV), "WCC", "TH ", "WCC", 'W', POWER_COMPONENT, 'C', CABLE_DOUBLE, 'T', CABLE_TIER_UP_DOUBLE, 'H', HULL); - registerMachineRecipe(provider, ArrayUtils.subarray(GTMachines.HI_AMP_TRANSFORMER_4A, GTValues.ULV, GTValues.MV), " CC", "TH ", " CC", 'C', CABLE_QUAD, 'T', CABLE_TIER_UP_QUAD, 'H', HULL); - registerMachineRecipe(provider, ArrayUtils.subarray(GTMachines.HI_AMP_TRANSFORMER_4A, GTValues.MV, GTValues.UHV), "WCC", "TH ", "WCC", 'W', POWER_COMPONENT, 'C', CABLE_QUAD, 'T', CABLE_TIER_UP_QUAD, 'H', HULL); - registerMachineRecipe(provider, ArrayUtils.subarray(GTMachines.POWER_TRANSFORMER, GTValues.ULV, GTValues.MV), " CC", "TH ", " CC", 'C', CABLE_HEX, 'T', CABLE_TIER_UP_HEX, 'H', HULL); - registerMachineRecipe(provider, ArrayUtils.subarray(GTMachines.POWER_TRANSFORMER, GTValues.MV, GTValues.UHV), "WCC", "TH ", "WCC", 'W', POWER_COMPONENT, 'C', CABLE_HEX, 'T', CABLE_TIER_UP_HEX, 'H', HULL); - - registerMachineRecipe(provider, GTMachines.BATTERY_BUFFER_4, "WTW", "WMW", 'M', HULL, 'W', WIRE_QUAD, 'T', CustomTags.WOODEN_CHESTS); - registerMachineRecipe(provider, GTMachines.BATTERY_BUFFER_8, "WTW", "WMW", 'M', HULL, 'W', WIRE_OCT, 'T', CustomTags.WOODEN_CHESTS); - registerMachineRecipe(provider, GTMachines.BATTERY_BUFFER_16, "WTW", "WMW", 'M', HULL, 'W', WIRE_HEX, 'T', CustomTags.WOODEN_CHESTS);; - - registerMachineRecipe(provider, GTMachines.CHARGER_4, "WTW", "WMW", "BCB", 'M', HULL, 'W', WIRE_QUAD, 'T', CustomTags.WOODEN_CHESTS, 'B', CABLE, 'C', CIRCUIT); + // registerMachineRecipe(GTMachines.MASS_FABRICATOR, "CFC", "QMQ", "CFC", 'M', HULL, 'Q', CABLE_QUAD, 'C', + // BETTER_CIRCUIT, 'F', FIELD_GENERATOR); + // registerMachineRecipe(GTMachines.REPLICATOR, "EFE", "CMC", "EQE", 'M', HULL, 'Q', CABLE_QUAD, 'C', + // BETTER_CIRCUIT, 'F', FIELD_GENERATOR, 'E', EMITTER); + registerMachineRecipe(provider, GTMachines.SCANNER, "CEC", "WHW", "CSC", 'C', BETTER_CIRCUIT, 'E', EMITTER, 'W', + CABLE, 'H', HULL, 'S', SENSOR); + registerMachineRecipe(provider, GTMachines.GAS_COLLECTOR, "WFW", "PHP", "WCW", 'W', Blocks.IRON_BARS, 'F', + GTItems.FLUID_FILTER, 'P', PUMP, 'H', HULL, 'C', CIRCUIT); + registerMachineRecipe(provider, GTMachines.ROCK_CRUSHER, "PMW", "CHC", "GGG", 'P', PISTON, 'M', MOTOR, 'W', + GRINDER, 'C', CABLE, 'H', HULL, 'G', GLASS); + registerMachineRecipe(provider, GTMachines.PUMP, "WGW", "GMG", "TGT", 'M', HULL, 'W', CIRCUIT, 'G', PUMP, 'T', + PIPE_LARGE); + + registerMachineRecipe(provider, GTMachines.FISHER, "WTW", "PMP", "TGT", 'M', HULL, 'W', CIRCUIT, 'G', PUMP, 'T', + MOTOR, 'P', PISTON); + registerMachineRecipe(provider, GTMachines.ITEM_COLLECTOR, "MRM", "RHR", "CWC", 'M', MOTOR, 'R', ROTOR, 'H', + HULL, 'C', CIRCUIT, 'W', CABLE); + if (ConfigHolder.INSTANCE.machines.enableWorldAccelerators) + registerMachineRecipe(provider, GTMachines.WORLD_ACCELERATOR, "FSF", "EHE", "FSF", 'F', FIELD_GENERATOR, + 'S', SENSOR, 'E', EMITTER, 'H', HULL); + registerMachineRecipe(provider, GTMachines.BLOCK_BREAKER, "MGM", "CHC", "WSW", 'M', MOTOR, 'H', HULL, 'C', + CIRCUIT, 'W', CABLE, 'S', CustomTags.WOODEN_CHESTS, 'G', GRINDER); + registerMachineRecipe(provider, GTMachines.MINER, "MMM", "WHW", "CSC", 'M', MOTOR, 'W', CABLE, 'H', HULL, 'C', + CIRCUIT, 'S', SENSOR); + + registerMachineRecipe(provider, GTMachines.MUFFLER_HATCH, "HM", "PR", 'H', HULL, 'M', MOTOR, 'P', PIPE_NORMAL, + 'R', ROTOR); + + registerMachineRecipe(provider, ArrayUtils.subarray(GTMachines.DIODE, GTValues.ULV, HV), "CDC", "DHD", "PDP", + 'H', HULL, 'D', GTItems.DIODE, 'P', PLATE, 'C', CABLE_QUAD); + registerMachineRecipe(provider, ArrayUtils.subarray(GTMachines.DIODE, HV, GTValues.LuV), "CDC", "DHD", "PDP", + 'H', HULL, 'D', GTItems.SMD_DIODE, 'P', PLATE, 'C', CABLE_QUAD); + registerMachineRecipe(provider, ArrayUtils.subarray(GTMachines.DIODE, GTValues.LuV, GTMachines.DIODE.length), + "CDC", "DHD", "PDP", 'H', HULL, 'D', GTItems.ADVANCED_SMD_DIODE, 'P', PLATE, 'C', CABLE_QUAD); + + registerMachineRecipe(provider, ArrayUtils.subarray(GTMachines.TRANSFORMER, GTValues.ULV, GTValues.MV), " CC", + "TH ", " CC", 'C', CABLE, 'T', CABLE_TIER_UP, 'H', HULL); + registerMachineRecipe(provider, ArrayUtils.subarray(GTMachines.TRANSFORMER, GTValues.MV, GTValues.UHV), "WCC", + "TH ", "WCC", 'W', POWER_COMPONENT, 'C', CABLE, 'T', CABLE_TIER_UP, 'H', HULL); + registerMachineRecipe(provider, + ArrayUtils.subarray(GTMachines.HI_AMP_TRANSFORMER_2A, GTValues.ULV, GTValues.MV), " CC", "TH ", " CC", + 'C', CABLE_DOUBLE, 'T', CABLE_TIER_UP_DOUBLE, 'H', HULL); + registerMachineRecipe(provider, + ArrayUtils.subarray(GTMachines.HI_AMP_TRANSFORMER_2A, GTValues.MV, GTValues.UHV), "WCC", "TH ", "WCC", + 'W', POWER_COMPONENT, 'C', CABLE_DOUBLE, 'T', CABLE_TIER_UP_DOUBLE, 'H', HULL); + registerMachineRecipe(provider, + ArrayUtils.subarray(GTMachines.HI_AMP_TRANSFORMER_4A, GTValues.ULV, GTValues.MV), " CC", "TH ", " CC", + 'C', CABLE_QUAD, 'T', CABLE_TIER_UP_QUAD, 'H', HULL); + registerMachineRecipe(provider, + ArrayUtils.subarray(GTMachines.HI_AMP_TRANSFORMER_4A, GTValues.MV, GTValues.UHV), "WCC", "TH ", "WCC", + 'W', POWER_COMPONENT, 'C', CABLE_QUAD, 'T', CABLE_TIER_UP_QUAD, 'H', HULL); + registerMachineRecipe(provider, ArrayUtils.subarray(GTMachines.POWER_TRANSFORMER, GTValues.ULV, GTValues.MV), + " CC", "TH ", " CC", 'C', CABLE_HEX, 'T', CABLE_TIER_UP_HEX, 'H', HULL); + registerMachineRecipe(provider, ArrayUtils.subarray(GTMachines.POWER_TRANSFORMER, GTValues.MV, GTValues.UHV), + "WCC", "TH ", "WCC", 'W', POWER_COMPONENT, 'C', CABLE_HEX, 'T', CABLE_TIER_UP_HEX, 'H', HULL); + + registerMachineRecipe(provider, GTMachines.BATTERY_BUFFER_4, "WTW", "WMW", 'M', HULL, 'W', WIRE_QUAD, 'T', + CustomTags.WOODEN_CHESTS); + registerMachineRecipe(provider, GTMachines.BATTERY_BUFFER_8, "WTW", "WMW", 'M', HULL, 'W', WIRE_OCT, 'T', + CustomTags.WOODEN_CHESTS); + registerMachineRecipe(provider, GTMachines.BATTERY_BUFFER_16, "WTW", "WMW", 'M', HULL, 'W', WIRE_HEX, 'T', + CustomTags.WOODEN_CHESTS);; + + registerMachineRecipe(provider, GTMachines.CHARGER_4, "WTW", "WMW", "BCB", 'M', HULL, 'W', WIRE_QUAD, 'T', + CustomTags.WOODEN_CHESTS, 'B', CABLE, 'C', CIRCUIT); registerMachineRecipe(provider, GTMachines.FLUID_IMPORT_HATCH, " G", " M", 'M', HULL, 'G', GLASS); registerMachineRecipe(provider, GTMachines.FLUID_EXPORT_HATCH, " M", " G", 'M', HULL, 'G', GLASS); - registerMachineRecipe(provider, GTMachines.ITEM_IMPORT_BUS, " C", " M", 'M', HULL, 'C', CustomTags.WOODEN_CHESTS); - registerMachineRecipe(provider, GTMachines.ITEM_EXPORT_BUS, " M", " C", 'M', HULL, 'C', CustomTags.WOODEN_CHESTS); - - - - VanillaRecipeHelper.addShapedRecipe(provider, true, "wooden_crate", GTMachines.WOODEN_CRATE.asStack(), "RPR", "PsP", "RPR", 'P', ItemTags.PLANKS, 'R', new UnificationEntry(TagPrefix.screw, GTMaterials.Iron)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "bronze_crate", GTMachines.BRONZE_CRATE.asStack(), "RPR", "PhP", "RPR", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Bronze), 'R', new UnificationEntry(TagPrefix.rodLong, GTMaterials.Bronze)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "steel_crate", GTMachines.STEEL_CRATE.asStack(), "RPR", "PhP", "RPR", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Steel), 'R', new UnificationEntry(TagPrefix.rodLong, GTMaterials.Steel)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "aluminium_crate", GTMachines.ALUMINIUM_CRATE.asStack(), "RPR", "PhP", "RPR", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Aluminium), 'R', new UnificationEntry(TagPrefix.rodLong, GTMaterials.Aluminium)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "stainless_steel_crate", GTMachines.STAINLESS_STEEL_CRATE.asStack(), "RPR", "PhP", "RPR", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.StainlessSteel), 'R', new UnificationEntry(TagPrefix.rodLong, GTMaterials.StainlessSteel)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "titanium_crate", GTMachines.TITANIUM_CRATE.asStack(), "RPR", "PhP", "RPR", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Titanium), 'R', new UnificationEntry(TagPrefix.rodLong, GTMaterials.Titanium)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "tungstensteel_crate", GTMachines.TUNGSTENSTEEL_CRATE.asStack(), "RPR", "PhP", "RPR", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.TungstenSteel), 'R', new UnificationEntry(TagPrefix.rodLong, GTMaterials.TungstenSteel)); - - VanillaRecipeHelper.addShapedRecipe(provider, true, "wooden_barrel", GTMachines.WOODEN_DRUM.asStack(), "rSs", "PRP", "PRP", 'S', GTItems.STICKY_RESIN.asStack(), 'P', ItemTags.PLANKS, 'R', new UnificationEntry(TagPrefix.rodLong, GTMaterials.Iron)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "bronze_drum", GTMachines.BRONZE_DRUM.asStack(), " h ", "PRP", "PRP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Bronze), 'R', new UnificationEntry(TagPrefix.rodLong, GTMaterials.Bronze)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "steel_drum", GTMachines.STEEL_DRUM.asStack(), " h ", "PRP", "PRP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Steel), 'R', new UnificationEntry(TagPrefix.rodLong, GTMaterials.Steel)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "aluminium_drum", GTMachines.ALUMINIUM_DRUM.asStack(), " h ", "PRP", "PRP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Aluminium), 'R', new UnificationEntry(TagPrefix.rodLong, GTMaterials.Aluminium)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "stainless_steel_drum", GTMachines.STAINLESS_STEEL_DRUM.asStack(), " h ", "PRP", "PRP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.StainlessSteel), 'R', new UnificationEntry(TagPrefix.rodLong, GTMaterials.StainlessSteel)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "gold_drum", GTMachines.GOLD_DRUM.asStack(), " h ", "PRP", "PRP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Gold), 'R', new UnificationEntry(TagPrefix.rodLong, GTMaterials.Gold)); + registerMachineRecipe(provider, GTMachines.ITEM_IMPORT_BUS, " C", " M", 'M', HULL, 'C', + CustomTags.WOODEN_CHESTS); + registerMachineRecipe(provider, GTMachines.ITEM_EXPORT_BUS, " M", " C", 'M', HULL, 'C', + CustomTags.WOODEN_CHESTS); + + VanillaRecipeHelper.addShapedRecipe(provider, true, "wooden_crate", GTMachines.WOODEN_CRATE.asStack(), "RPR", + "PsP", "RPR", 'P', ItemTags.PLANKS, 'R', new UnificationEntry(TagPrefix.screw, GTMaterials.Iron)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "bronze_crate", GTMachines.BRONZE_CRATE.asStack(), "RPR", + "PhP", "RPR", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Bronze), 'R', + new UnificationEntry(TagPrefix.rodLong, GTMaterials.Bronze)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "steel_crate", GTMachines.STEEL_CRATE.asStack(), "RPR", + "PhP", "RPR", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Steel), 'R', + new UnificationEntry(TagPrefix.rodLong, GTMaterials.Steel)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "aluminium_crate", GTMachines.ALUMINIUM_CRATE.asStack(), + "RPR", "PhP", "RPR", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Aluminium), 'R', + new UnificationEntry(TagPrefix.rodLong, GTMaterials.Aluminium)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "stainless_steel_crate", + GTMachines.STAINLESS_STEEL_CRATE.asStack(), "RPR", "PhP", "RPR", 'P', + new UnificationEntry(TagPrefix.plate, GTMaterials.StainlessSteel), 'R', + new UnificationEntry(TagPrefix.rodLong, GTMaterials.StainlessSteel)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "titanium_crate", GTMachines.TITANIUM_CRATE.asStack(), + "RPR", "PhP", "RPR", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Titanium), 'R', + new UnificationEntry(TagPrefix.rodLong, GTMaterials.Titanium)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "tungstensteel_crate", + GTMachines.TUNGSTENSTEEL_CRATE.asStack(), "RPR", "PhP", "RPR", 'P', + new UnificationEntry(TagPrefix.plate, GTMaterials.TungstenSteel), 'R', + new UnificationEntry(TagPrefix.rodLong, GTMaterials.TungstenSteel)); + + VanillaRecipeHelper.addShapedRecipe(provider, true, "wooden_barrel", GTMachines.WOODEN_DRUM.asStack(), "rSs", + "PRP", "PRP", 'S', GTItems.STICKY_RESIN.asStack(), 'P', ItemTags.PLANKS, 'R', + new UnificationEntry(TagPrefix.rodLong, GTMaterials.Iron)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "bronze_drum", GTMachines.BRONZE_DRUM.asStack(), " h ", + "PRP", "PRP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Bronze), 'R', + new UnificationEntry(TagPrefix.rodLong, GTMaterials.Bronze)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "steel_drum", GTMachines.STEEL_DRUM.asStack(), " h ", "PRP", + "PRP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Steel), 'R', + new UnificationEntry(TagPrefix.rodLong, GTMaterials.Steel)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "aluminium_drum", GTMachines.ALUMINIUM_DRUM.asStack(), + " h ", "PRP", "PRP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Aluminium), 'R', + new UnificationEntry(TagPrefix.rodLong, GTMaterials.Aluminium)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "stainless_steel_drum", + GTMachines.STAINLESS_STEEL_DRUM.asStack(), " h ", "PRP", "PRP", 'P', + new UnificationEntry(TagPrefix.plate, GTMaterials.StainlessSteel), 'R', + new UnificationEntry(TagPrefix.rodLong, GTMaterials.StainlessSteel)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "gold_drum", GTMachines.GOLD_DRUM.asStack(), " h ", "PRP", + "PRP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Gold), 'R', + new UnificationEntry(TagPrefix.rodLong, GTMaterials.Gold)); // Hermetic Casings - VanillaRecipeHelper.addShapedRecipe(provider, true, "hermetic_casing_lv", GTBlocks.HERMETIC_CASING_LV.asStack(), "PPP", "PFP", "PPP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Steel), 'F', new UnificationEntry(TagPrefix.pipeLargeFluid, GTMaterials.Polyethylene)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "hermetic_casing_mv", GTBlocks.HERMETIC_CASING_MV.asStack(), "PPP", "PFP", "PPP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Aluminium), 'F', new UnificationEntry(TagPrefix.pipeLargeItem, GTMaterials.PolyvinylChloride)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "hermetic_casing_hv", GTBlocks.HERMETIC_CASING_HV.asStack(), "PPP", "PFP", "PPP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.StainlessSteel), 'F', new UnificationEntry(TagPrefix.pipeLargeFluid, GTMaterials.Polytetrafluoroethylene)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "hermetic_casing_ev", GTBlocks.HERMETIC_CASING_EV.asStack(), "PPP", "PFP", "PPP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Titanium), 'F', new UnificationEntry(TagPrefix.pipeLargeFluid, GTMaterials.StainlessSteel)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "hermetic_casing_iv", GTBlocks.HERMETIC_CASING_IV.asStack(), "PPP", "PFP", "PPP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.TungstenSteel), 'F', new UnificationEntry(TagPrefix.pipeLargeFluid, GTMaterials.Titanium)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "hermetic_casing_luv", GTBlocks.HERMETIC_CASING_LuV.asStack(), "PPP", "PFP", "PPP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.RhodiumPlatedPalladium), 'F', new UnificationEntry(TagPrefix.pipeLargeFluid, GTMaterials.TungstenSteel)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "hermetic_casing_zpm", GTBlocks.HERMETIC_CASING_ZPM.asStack(), "PPP", "PFP", "PPP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.NaquadahAlloy), 'F', new UnificationEntry(TagPrefix.pipeLargeFluid, GTMaterials.NiobiumTitanium)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "hermetic_casing_uv", GTBlocks.HERMETIC_CASING_UV.asStack(), "PPP", "PFP", "PPP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Darmstadtium), 'F', new UnificationEntry(TagPrefix.pipeLargeFluid, GTMaterials.Naquadah)); - VanillaRecipeHelper.addShapedRecipe(provider, true, "hermetic_casing_max", GTBlocks.HERMETIC_CASING_UHV.asStack(), "PPP", "PFP", "PPP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Neutronium), 'F', new UnificationEntry(TagPrefix.pipeLargeFluid, GTMaterials.Duranium)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "hermetic_casing_lv", GTBlocks.HERMETIC_CASING_LV.asStack(), + "PPP", "PFP", "PPP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Steel), 'F', + new UnificationEntry(TagPrefix.pipeLargeFluid, GTMaterials.Polyethylene)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "hermetic_casing_mv", GTBlocks.HERMETIC_CASING_MV.asStack(), + "PPP", "PFP", "PPP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Aluminium), 'F', + new UnificationEntry(TagPrefix.pipeLargeItem, GTMaterials.PolyvinylChloride)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "hermetic_casing_hv", GTBlocks.HERMETIC_CASING_HV.asStack(), + "PPP", "PFP", "PPP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.StainlessSteel), 'F', + new UnificationEntry(TagPrefix.pipeLargeFluid, GTMaterials.Polytetrafluoroethylene)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "hermetic_casing_ev", GTBlocks.HERMETIC_CASING_EV.asStack(), + "PPP", "PFP", "PPP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Titanium), 'F', + new UnificationEntry(TagPrefix.pipeLargeFluid, GTMaterials.StainlessSteel)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "hermetic_casing_iv", GTBlocks.HERMETIC_CASING_IV.asStack(), + "PPP", "PFP", "PPP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.TungstenSteel), 'F', + new UnificationEntry(TagPrefix.pipeLargeFluid, GTMaterials.Titanium)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "hermetic_casing_luv", + GTBlocks.HERMETIC_CASING_LuV.asStack(), "PPP", "PFP", "PPP", 'P', + new UnificationEntry(TagPrefix.plate, GTMaterials.RhodiumPlatedPalladium), 'F', + new UnificationEntry(TagPrefix.pipeLargeFluid, GTMaterials.TungstenSteel)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "hermetic_casing_zpm", + GTBlocks.HERMETIC_CASING_ZPM.asStack(), "PPP", "PFP", "PPP", 'P', + new UnificationEntry(TagPrefix.plate, GTMaterials.NaquadahAlloy), 'F', + new UnificationEntry(TagPrefix.pipeLargeFluid, GTMaterials.NiobiumTitanium)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "hermetic_casing_uv", GTBlocks.HERMETIC_CASING_UV.asStack(), + "PPP", "PFP", "PPP", 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Darmstadtium), 'F', + new UnificationEntry(TagPrefix.pipeLargeFluid, GTMaterials.Naquadah)); + VanillaRecipeHelper.addShapedRecipe(provider, true, "hermetic_casing_max", + GTBlocks.HERMETIC_CASING_UHV.asStack(), "PPP", "PFP", "PPP", 'P', + new UnificationEntry(TagPrefix.plate, GTMaterials.Neutronium), 'F', + new UnificationEntry(TagPrefix.pipeLargeFluid, GTMaterials.Duranium)); // Super / Quantum Chests - VanillaRecipeHelper.addShapedRecipe(provider, true, "super_chest_lv", GTMachines.SUPER_CHEST[LV].asStack(), "CPC", "PFP", "CPC", 'C', CustomTags.LV_CIRCUITS, 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Steel), 'F', GTMachines.STEEL_CRATE.asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, true, "super_chest_mv", GTMachines.SUPER_CHEST[MV].asStack(), "CPC", "PFP", "CPC", 'C', CustomTags.MV_CIRCUITS, 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Aluminium), 'F', GTMachines.ALUMINIUM_CRATE.asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, true, "super_chest_hv", GTMachines.SUPER_CHEST[HV].asStack(), "CPC", "PFP", "CGC", 'C', CustomTags.HV_CIRCUITS, 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.StainlessSteel), 'F', GTMachines.STAINLESS_STEEL_CRATE.asStack(), 'G', GTItems.FIELD_GENERATOR_LV.asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, true, "super_chest_ev", GTMachines.SUPER_CHEST[EV].asStack(), "CPC", "PFP", "CGC", 'C', CustomTags.EV_CIRCUITS, 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Titanium), 'F', GTMachines.TITANIUM_CRATE.asStack(), 'G', GTItems.FIELD_GENERATOR_MV.asStack()); - - VanillaRecipeHelper.addShapedRecipe(provider, true, "quantum_chest_iv", GTMachines.QUANTUM_CHEST[IV].asStack(), "CPC", "PHP", "CFC", 'C', CustomTags.IV_CIRCUITS, 'P', new UnificationEntry(TagPrefix.plateDense, GTMaterials.TungstenSteel), 'F', GTItems.FIELD_GENERATOR_HV.asStack(), 'H', GTMachines.HULL[5].asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, true, "quantum_chest_luv", GTMachines.QUANTUM_CHEST[LuV].asStack(), "CPC", "PHP", "CFC", 'C', CustomTags.LuV_CIRCUITS, 'P', new UnificationEntry(TagPrefix.plateDense, GTMaterials.RhodiumPlatedPalladium), 'F', GTItems.FIELD_GENERATOR_EV.asStack(), 'H', GTMachines.HULL[6].asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, true, "quantum_chest_zpm", GTMachines.QUANTUM_CHEST[ZPM].asStack(), "CPC", "PHP", "CFC", 'C', CustomTags.ZPM_CIRCUITS, 'P', new UnificationEntry(TagPrefix.plateDense, GTMaterials.NaquadahAlloy), 'F', GTItems.FIELD_GENERATOR_IV.asStack(), 'H', GTMachines.HULL[7].asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, true, "quantum_chest_uv", GTMachines.QUANTUM_CHEST[UV].asStack(), "CPC", "PHP", "CFC", 'C', CustomTags.UV_CIRCUITS, 'P', new UnificationEntry(TagPrefix.plateDense, GTMaterials.Darmstadtium), 'F', GTItems.FIELD_GENERATOR_LuV.asStack(), 'H', GTMachines.HULL[8].asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, true, "quantum_chest_uhv", GTMachines.QUANTUM_CHEST[UHV].asStack(), "CPC", "PHP", "CFC", 'C', CustomTags.UHV_CIRCUITS, 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Neutronium), 'F', GTItems.FIELD_GENERATOR_ZPM.asStack(), 'H', GTMachines.HULL[9].asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, true, "super_chest_lv", GTMachines.SUPER_CHEST[LV].asStack(), + "CPC", "PFP", "CPC", 'C', CustomTags.LV_CIRCUITS, 'P', + new UnificationEntry(TagPrefix.plate, GTMaterials.Steel), 'F', GTMachines.STEEL_CRATE.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, true, "super_chest_mv", GTMachines.SUPER_CHEST[MV].asStack(), + "CPC", "PFP", "CPC", 'C', CustomTags.MV_CIRCUITS, 'P', + new UnificationEntry(TagPrefix.plate, GTMaterials.Aluminium), 'F', + GTMachines.ALUMINIUM_CRATE.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, true, "super_chest_hv", GTMachines.SUPER_CHEST[HV].asStack(), + "CPC", "PFP", "CGC", 'C', CustomTags.HV_CIRCUITS, 'P', + new UnificationEntry(TagPrefix.plate, GTMaterials.StainlessSteel), 'F', + GTMachines.STAINLESS_STEEL_CRATE.asStack(), 'G', GTItems.FIELD_GENERATOR_LV.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, true, "super_chest_ev", GTMachines.SUPER_CHEST[EV].asStack(), + "CPC", "PFP", "CGC", 'C', CustomTags.EV_CIRCUITS, 'P', + new UnificationEntry(TagPrefix.plate, GTMaterials.Titanium), 'F', GTMachines.TITANIUM_CRATE.asStack(), + 'G', GTItems.FIELD_GENERATOR_MV.asStack()); + + VanillaRecipeHelper.addShapedRecipe(provider, true, "quantum_chest_iv", GTMachines.QUANTUM_CHEST[IV].asStack(), + "CPC", "PHP", "CFC", 'C', CustomTags.IV_CIRCUITS, 'P', + new UnificationEntry(TagPrefix.plateDense, GTMaterials.TungstenSteel), 'F', + GTItems.FIELD_GENERATOR_HV.asStack(), 'H', GTMachines.HULL[5].asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, true, "quantum_chest_luv", + GTMachines.QUANTUM_CHEST[LuV].asStack(), "CPC", "PHP", "CFC", 'C', CustomTags.LuV_CIRCUITS, 'P', + new UnificationEntry(TagPrefix.plateDense, GTMaterials.RhodiumPlatedPalladium), 'F', + GTItems.FIELD_GENERATOR_EV.asStack(), 'H', GTMachines.HULL[6].asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, true, "quantum_chest_zpm", + GTMachines.QUANTUM_CHEST[ZPM].asStack(), "CPC", "PHP", "CFC", 'C', CustomTags.ZPM_CIRCUITS, 'P', + new UnificationEntry(TagPrefix.plateDense, GTMaterials.NaquadahAlloy), 'F', + GTItems.FIELD_GENERATOR_IV.asStack(), 'H', GTMachines.HULL[7].asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, true, "quantum_chest_uv", GTMachines.QUANTUM_CHEST[UV].asStack(), + "CPC", "PHP", "CFC", 'C', CustomTags.UV_CIRCUITS, 'P', + new UnificationEntry(TagPrefix.plateDense, GTMaterials.Darmstadtium), 'F', + GTItems.FIELD_GENERATOR_LuV.asStack(), 'H', GTMachines.HULL[8].asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, true, "quantum_chest_uhv", + GTMachines.QUANTUM_CHEST[UHV].asStack(), "CPC", "PHP", "CFC", 'C', CustomTags.UHV_CIRCUITS, 'P', + new UnificationEntry(TagPrefix.plate, GTMaterials.Neutronium), 'F', + GTItems.FIELD_GENERATOR_ZPM.asStack(), 'H', GTMachines.HULL[9].asStack()); // Super / Quantum Tanks - VanillaRecipeHelper.addShapedRecipe(provider, true, "super_tank_lv", GTMachines.SUPER_TANK[LV].asStack(), "CPC", "PHP", "CFC", 'C', CustomTags.LV_CIRCUITS, 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Steel), 'F', GTItems.ELECTRIC_PUMP_LV.asStack(), 'H', GTBlocks.HERMETIC_CASING_LV.asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, true, "super_tank_mv", GTMachines.SUPER_TANK[MV].asStack(), "CPC", "PHP", "CFC", 'C', CustomTags.MV_CIRCUITS, 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Aluminium), 'F', GTItems.ELECTRIC_PUMP_MV.asStack(), 'H', GTBlocks.HERMETIC_CASING_MV.asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, true, "super_tank_hv", GTMachines.SUPER_TANK[HV].asStack(), "CGC", "PHP", "CFC", 'C', CustomTags.HV_CIRCUITS, 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.StainlessSteel), 'F', GTItems.ELECTRIC_PUMP_HV.asStack(), 'H', GTBlocks.HERMETIC_CASING_HV.asStack(), 'G', GTItems.FIELD_GENERATOR_LV.asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, true, "super_tank_ev", GTMachines.SUPER_TANK[EV].asStack(), "CGC", "PHP", "CFC", 'C', CustomTags.EV_CIRCUITS, 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Titanium), 'F', GTItems.ELECTRIC_PUMP_EV.asStack(), 'H', GTBlocks.HERMETIC_CASING_EV.asStack(), 'G', GTItems.FIELD_GENERATOR_MV.asStack()); - - VanillaRecipeHelper.addShapedRecipe(provider, true, "quantum_tank_iv", GTMachines.QUANTUM_TANK[IV].asStack(), "CGC", "PHP", "CUC", 'C', CustomTags.IV_CIRCUITS, 'P', new UnificationEntry(TagPrefix.plateDense, GTMaterials.TungstenSteel), 'U', GTItems.ELECTRIC_PUMP_IV.asStack(), 'G', GTItems.FIELD_GENERATOR_HV.asStack(), 'H', GTBlocks.HERMETIC_CASING_IV.asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, true, "quantum_tank_luv", GTMachines.QUANTUM_TANK[LuV].asStack(), "CGC", "PHP", "CUC", 'C', CustomTags.LuV_CIRCUITS, 'P', new UnificationEntry(TagPrefix.plateDense, GTMaterials.RhodiumPlatedPalladium), 'U', GTItems.ELECTRIC_PUMP_LuV.asStack(), 'G', GTItems.FIELD_GENERATOR_EV.asStack(), 'H', GTBlocks.HERMETIC_CASING_LuV.asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, true, "quantum_tank_zpm", GTMachines.QUANTUM_TANK[ZPM].asStack(), "CGC", "PHP", "CUC", 'C', CustomTags.ZPM_CIRCUITS, 'P', new UnificationEntry(TagPrefix.plateDense, GTMaterials.NaquadahAlloy), 'U', GTItems.ELECTRIC_PUMP_ZPM.asStack(), 'G', GTItems.FIELD_GENERATOR_IV.asStack(), 'H', GTBlocks.HERMETIC_CASING_ZPM.asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, true, "quantum_tank_uv", GTMachines.QUANTUM_TANK[UV].asStack(), "CGC", "PHP", "CUC", 'C', CustomTags.UV_CIRCUITS, 'P', new UnificationEntry(TagPrefix.plateDense, GTMaterials.Darmstadtium), 'U', GTItems.ELECTRIC_PUMP_UV.asStack(), 'G', GTItems.FIELD_GENERATOR_LuV.asStack(), 'H', GTBlocks.HERMETIC_CASING_UV.asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, true, "quantum_tank_uhv", GTMachines.QUANTUM_TANK[UHV].asStack(), "CGC", "PHP", "CUC", 'C', CustomTags.UHV_CIRCUITS, 'P', new UnificationEntry(TagPrefix.plate, GTMaterials.Neutronium), 'U', GTItems.ELECTRIC_PUMP_UV.asStack(), 'G', GTItems.FIELD_GENERATOR_ZPM.asStack(), 'H', GTBlocks.HERMETIC_CASING_UHV.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, true, "super_tank_lv", GTMachines.SUPER_TANK[LV].asStack(), "CPC", + "PHP", "CFC", 'C', CustomTags.LV_CIRCUITS, 'P', + new UnificationEntry(TagPrefix.plate, GTMaterials.Steel), 'F', GTItems.ELECTRIC_PUMP_LV.asStack(), 'H', + GTBlocks.HERMETIC_CASING_LV.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, true, "super_tank_mv", GTMachines.SUPER_TANK[MV].asStack(), "CPC", + "PHP", "CFC", 'C', CustomTags.MV_CIRCUITS, 'P', + new UnificationEntry(TagPrefix.plate, GTMaterials.Aluminium), 'F', GTItems.ELECTRIC_PUMP_MV.asStack(), + 'H', GTBlocks.HERMETIC_CASING_MV.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, true, "super_tank_hv", GTMachines.SUPER_TANK[HV].asStack(), "CGC", + "PHP", "CFC", 'C', CustomTags.HV_CIRCUITS, 'P', + new UnificationEntry(TagPrefix.plate, GTMaterials.StainlessSteel), 'F', + GTItems.ELECTRIC_PUMP_HV.asStack(), 'H', GTBlocks.HERMETIC_CASING_HV.asStack(), 'G', + GTItems.FIELD_GENERATOR_LV.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, true, "super_tank_ev", GTMachines.SUPER_TANK[EV].asStack(), "CGC", + "PHP", "CFC", 'C', CustomTags.EV_CIRCUITS, 'P', + new UnificationEntry(TagPrefix.plate, GTMaterials.Titanium), 'F', GTItems.ELECTRIC_PUMP_EV.asStack(), + 'H', GTBlocks.HERMETIC_CASING_EV.asStack(), 'G', GTItems.FIELD_GENERATOR_MV.asStack()); + + VanillaRecipeHelper.addShapedRecipe(provider, true, "quantum_tank_iv", GTMachines.QUANTUM_TANK[IV].asStack(), + "CGC", "PHP", "CUC", 'C', CustomTags.IV_CIRCUITS, 'P', + new UnificationEntry(TagPrefix.plateDense, GTMaterials.TungstenSteel), 'U', + GTItems.ELECTRIC_PUMP_IV.asStack(), 'G', GTItems.FIELD_GENERATOR_HV.asStack(), 'H', + GTBlocks.HERMETIC_CASING_IV.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, true, "quantum_tank_luv", GTMachines.QUANTUM_TANK[LuV].asStack(), + "CGC", "PHP", "CUC", 'C', CustomTags.LuV_CIRCUITS, 'P', + new UnificationEntry(TagPrefix.plateDense, GTMaterials.RhodiumPlatedPalladium), 'U', + GTItems.ELECTRIC_PUMP_LuV.asStack(), 'G', GTItems.FIELD_GENERATOR_EV.asStack(), 'H', + GTBlocks.HERMETIC_CASING_LuV.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, true, "quantum_tank_zpm", GTMachines.QUANTUM_TANK[ZPM].asStack(), + "CGC", "PHP", "CUC", 'C', CustomTags.ZPM_CIRCUITS, 'P', + new UnificationEntry(TagPrefix.plateDense, GTMaterials.NaquadahAlloy), 'U', + GTItems.ELECTRIC_PUMP_ZPM.asStack(), 'G', GTItems.FIELD_GENERATOR_IV.asStack(), 'H', + GTBlocks.HERMETIC_CASING_ZPM.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, true, "quantum_tank_uv", GTMachines.QUANTUM_TANK[UV].asStack(), + "CGC", "PHP", "CUC", 'C', CustomTags.UV_CIRCUITS, 'P', + new UnificationEntry(TagPrefix.plateDense, GTMaterials.Darmstadtium), 'U', + GTItems.ELECTRIC_PUMP_UV.asStack(), 'G', GTItems.FIELD_GENERATOR_LuV.asStack(), 'H', + GTBlocks.HERMETIC_CASING_UV.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, true, "quantum_tank_uhv", GTMachines.QUANTUM_TANK[UHV].asStack(), + "CGC", "PHP", "CUC", 'C', CustomTags.UHV_CIRCUITS, 'P', + new UnificationEntry(TagPrefix.plate, GTMaterials.Neutronium), 'U', GTItems.ELECTRIC_PUMP_UV.asStack(), + 'G', GTItems.FIELD_GENERATOR_ZPM.asStack(), 'H', GTBlocks.HERMETIC_CASING_UHV.asStack()); // TODO Buffers - //VanillaRecipeHelper.addShapedRecipe(provider, true, "buffer_lv", GTMachines.BUFFER[0].getStackForm(), "HP", "CV", 'H', GTMachines.HULL[GTValues.LV].getStackForm(), 'P', MetaItems.ELECTRIC_PUMP_LV.getStackForm(), 'V', MetaItems.CONVEYOR_MODULE_LV.getStackForm(), 'C', new UnificationEntry(TagPrefix.circuit, MarkerGTMaterials.Tier.LV)); - //VanillaRecipeHelper.addShapedRecipe(provider, true, "buffer_mv", GTMachines.BUFFER[1].getStackForm(), "HP", "CV", 'H', GTMachines.HULL[GTValues.MV].getStackForm(), 'P', MetaItems.ELECTRIC_PUMP_MV.getStackForm(), 'V', MetaItems.CONVEYOR_MODULE_MV.getStackForm(), 'C', new UnificationEntry(TagPrefix.circuit, MarkerGTMaterials.Tier.LV)); - //VanillaRecipeHelper.addShapedRecipe(provider, true, "buffer_hv", GTMachines.BUFFER[2].getStackForm(), "HP", "CV", 'H', GTMachines.HULL[GTValues.HV].getStackForm(), 'P', MetaItems.ELECTRIC_PUMP_HV.getStackForm(), 'V', MetaItems.CONVEYOR_MODULE_HV.getStackForm(), 'C', new UnificationEntry(TagPrefix.circuit, MarkerGTMaterials.Tier.LV)); - - VanillaRecipeHelper.addShapedRecipe(provider, true, "cleanroom", GTMachines.CLEANROOM.asStack(), "FFF", "RHR", "MCM", 'F', GTItems.ITEM_FILTER.asStack(), 'R', new UnificationEntry(TagPrefix.rotor, GTMaterials.StainlessSteel), 'H', HULL.getIngredient(HV), 'M', GTItems.ELECTRIC_MOTOR_HV.asStack(), 'C', CustomTags.HV_CIRCUITS); + // VanillaRecipeHelper.addShapedRecipe(provider, true, "buffer_lv", GTMachines.BUFFER[0].getStackForm(), "HP", + // "CV", 'H', GTMachines.HULL[GTValues.LV].getStackForm(), 'P', MetaItems.ELECTRIC_PUMP_LV.getStackForm(), 'V', + // MetaItems.CONVEYOR_MODULE_LV.getStackForm(), 'C', new UnificationEntry(TagPrefix.circuit, + // MarkerGTMaterials.Tier.LV)); + // VanillaRecipeHelper.addShapedRecipe(provider, true, "buffer_mv", GTMachines.BUFFER[1].getStackForm(), "HP", + // "CV", 'H', GTMachines.HULL[GTValues.MV].getStackForm(), 'P', MetaItems.ELECTRIC_PUMP_MV.getStackForm(), 'V', + // MetaItems.CONVEYOR_MODULE_MV.getStackForm(), 'C', new UnificationEntry(TagPrefix.circuit, + // MarkerGTMaterials.Tier.LV)); + // VanillaRecipeHelper.addShapedRecipe(provider, true, "buffer_hv", GTMachines.BUFFER[2].getStackForm(), "HP", + // "CV", 'H', GTMachines.HULL[GTValues.HV].getStackForm(), 'P', MetaItems.ELECTRIC_PUMP_HV.getStackForm(), 'V', + // MetaItems.CONVEYOR_MODULE_HV.getStackForm(), 'C', new UnificationEntry(TagPrefix.circuit, + // MarkerGTMaterials.Tier.LV)); + + VanillaRecipeHelper.addShapedRecipe(provider, true, "cleanroom", GTMachines.CLEANROOM.asStack(), "FFF", "RHR", + "MCM", 'F', GTItems.ITEM_FILTER.asStack(), 'R', + new UnificationEntry(TagPrefix.rotor, GTMaterials.StainlessSteel), 'H', HULL.getIngredient(HV), 'M', + GTItems.ELECTRIC_MOTOR_HV.asStack(), 'C', CustomTags.HV_CIRCUITS); if (ConfigHolder.INSTANCE.compat.energy.enablePlatformConverters && GTCEu.isRebornEnergyLoaded()) { - registerMachineRecipe(provider, true, GTMachines.ENERGY_CONVERTER_1A, " WW", "RMC", " WW", 'C', CIRCUIT, 'M', HULL, 'W', CABLE, 'R', new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.RedAlloy)); - registerMachineRecipe(provider, true, GTMachines.ENERGY_CONVERTER_4A, " WW", "RMC", " WW", 'C', CIRCUIT, 'M', HULL, 'W', CABLE_QUAD, 'R', new UnificationEntry(TagPrefix.cableGtQuadruple, GTMaterials.RedAlloy)); - registerMachineRecipe(provider, true, GTMachines.ENERGY_CONVERTER_8A, " WW", "RMC", " WW", 'C', CIRCUIT, 'M', HULL, 'W', CABLE_OCT, 'R', new UnificationEntry(TagPrefix.cableGtOctal, GTMaterials.RedAlloy)); - registerMachineRecipe(provider, true, GTMachines.ENERGY_CONVERTER_16A, " WW", "RMC", " WW", 'C', CIRCUIT, 'M', HULL, 'W', CABLE_HEX, 'R', new UnificationEntry(TagPrefix.cableGtHex, GTMaterials.RedAlloy)); + registerMachineRecipe(provider, true, GTMachines.ENERGY_CONVERTER_1A, " WW", "RMC", " WW", 'C', CIRCUIT, + 'M', HULL, 'W', CABLE, 'R', new UnificationEntry(TagPrefix.cableGtSingle, GTMaterials.RedAlloy)); + registerMachineRecipe(provider, true, GTMachines.ENERGY_CONVERTER_4A, " WW", "RMC", " WW", 'C', CIRCUIT, + 'M', HULL, 'W', CABLE_QUAD, 'R', + new UnificationEntry(TagPrefix.cableGtQuadruple, GTMaterials.RedAlloy)); + registerMachineRecipe(provider, true, GTMachines.ENERGY_CONVERTER_8A, " WW", "RMC", " WW", 'C', CIRCUIT, + 'M', HULL, 'W', CABLE_OCT, 'R', new UnificationEntry(TagPrefix.cableGtOctal, GTMaterials.RedAlloy)); + registerMachineRecipe(provider, true, GTMachines.ENERGY_CONVERTER_16A, " WW", "RMC", " WW", 'C', CIRCUIT, + 'M', HULL, 'W', CABLE_HEX, 'R', new UnificationEntry(TagPrefix.cableGtHex, GTMaterials.RedAlloy)); } } @@ -442,7 +1076,8 @@ public static void init(Consumer provider) { // - CraftingComponent.Component // - UnificationEntry // - TagKey - public static void registerMachineRecipe(Consumer provider, boolean withUnificationData, MachineDefinition[] machines, Object... recipe) { + public static void registerMachineRecipe(Consumer provider, boolean withUnificationData, + MachineDefinition[] machines, Object... recipe) { for (MachineDefinition machine : machines) { // Needed to skip certain tiers if not enabled. @@ -452,12 +1087,14 @@ public static void registerMachineRecipe(Consumer provider, bool if (prepRecipe == null) { return; } - VanillaRecipeHelper.addShapedRecipe(provider, withUnificationData, machine.getName(), machine.asStack(), prepRecipe); + VanillaRecipeHelper.addShapedRecipe(provider, withUnificationData, machine.getName(), machine.asStack(), + prepRecipe); } } } - public static void registerMachineRecipe(Consumer provider, MachineDefinition[] machines, Object... recipe) { + public static void registerMachineRecipe(Consumer provider, MachineDefinition[] machines, + Object... recipe) { registerMachineRecipe(provider, true, machines, recipe); } diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MetaTileEntityMachineRecipeLoader.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MetaTileEntityMachineRecipeLoader.java index a8ff444088..ba101eae29 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MetaTileEntityMachineRecipeLoader.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MetaTileEntityMachineRecipeLoader.java @@ -1,15 +1,17 @@ package com.gregtechceu.gtceu.data.recipe.misc; -import appeng.core.definitions.AEItems; -import appeng.core.definitions.AEParts; import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.data.chemical.material.stack.UnificationEntry; import com.gregtechceu.gtceu.common.data.machines.GTAEMachines; import com.gregtechceu.gtceu.data.recipe.CustomTags; import com.gregtechceu.gtceu.data.recipe.VanillaRecipeHelper; + import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.world.item.ItemStack; +import appeng.core.definitions.AEItems; +import appeng.core.definitions.AEParts; + import java.util.function.Consumer; import static com.gregtechceu.gtceu.api.GTValues.*; @@ -30,735 +32,733 @@ public static void init(Consumer provider) { // Energy Output Hatches VanillaRecipeHelper.addShapedRecipe(provider, true, "dynamo_hatch_ulv", ENERGY_OUTPUT_HATCH[ULV].asStack(), - " V ", "SHS", " ", - 'S', new UnificationEntry(spring, Lead), - 'V', VOLTAGE_COIL_ULV.asStack(), - 'H', HULL[ULV].asStack()); + " V ", "SHS", " ", + 'S', new UnificationEntry(spring, Lead), + 'V', VOLTAGE_COIL_ULV.asStack(), + 'H', HULL[ULV].asStack()); ASSEMBLER_RECIPES.recipeBuilder("dynamo_hatch_ulv") - .inputItems(HULL[ULV]) - .inputItems(spring, Lead, 2) - .inputItems(VOLTAGE_COIL_ULV) - .outputItems(ENERGY_OUTPUT_HATCH[ULV]) - .duration(200).EUt(VA[ULV]).save(provider); + .inputItems(HULL[ULV]) + .inputItems(spring, Lead, 2) + .inputItems(VOLTAGE_COIL_ULV) + .outputItems(ENERGY_OUTPUT_HATCH[ULV]) + .duration(200).EUt(VA[ULV]).save(provider); VanillaRecipeHelper.addShapedRecipe(provider, true, "dynamo_hatch_lv", ENERGY_OUTPUT_HATCH[LV].asStack(), - " V ", "SHS", " ", - 'S', new UnificationEntry(spring, Tin), - 'V', VOLTAGE_COIL_LV.asStack(), - 'H', HULL[LV].asStack()); + " V ", "SHS", " ", + 'S', new UnificationEntry(spring, Tin), + 'V', VOLTAGE_COIL_LV.asStack(), + 'H', HULL[LV].asStack()); ASSEMBLER_RECIPES.recipeBuilder("dynamo_hatch_lv") - .inputItems(HULL[LV]) - .inputItems(spring, Tin, 2) - .inputItems(VOLTAGE_COIL_LV) - .outputItems(ENERGY_OUTPUT_HATCH[LV]) - .duration(200).EUt(VA[LV]).save(provider); + .inputItems(HULL[LV]) + .inputItems(spring, Tin, 2) + .inputItems(VOLTAGE_COIL_LV) + .outputItems(ENERGY_OUTPUT_HATCH[LV]) + .duration(200).EUt(VA[LV]).save(provider); VanillaRecipeHelper.addShapedRecipe(provider, true, "dynamo_hatch_mv", ENERGY_OUTPUT_HATCH[MV].asStack(), - " V ", "SHS", " P ", - 'P', ULTRA_LOW_POWER_INTEGRATED_CIRCUIT.asStack(), - 'S', new UnificationEntry(spring, Copper), - 'V', VOLTAGE_COIL_MV.asStack(), - 'H', HULL[MV].asStack()); + " V ", "SHS", " P ", + 'P', ULTRA_LOW_POWER_INTEGRATED_CIRCUIT.asStack(), + 'S', new UnificationEntry(spring, Copper), + 'V', VOLTAGE_COIL_MV.asStack(), + 'H', HULL[MV].asStack()); ASSEMBLER_RECIPES.recipeBuilder("dynamo_hatch_mv") - .inputItems(HULL[MV]) - .inputItems(spring, Copper, 2) - .inputItems(ULTRA_LOW_POWER_INTEGRATED_CIRCUIT) - .inputItems(VOLTAGE_COIL_MV) - .outputItems(ENERGY_OUTPUT_HATCH[MV]) - .duration(200).EUt(VA[MV]).save(provider); + .inputItems(HULL[MV]) + .inputItems(spring, Copper, 2) + .inputItems(ULTRA_LOW_POWER_INTEGRATED_CIRCUIT) + .inputItems(VOLTAGE_COIL_MV) + .outputItems(ENERGY_OUTPUT_HATCH[MV]) + .duration(200).EUt(VA[MV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("dynamo_hatch_hv") - .inputItems(HULL[HV]) - .inputItems(spring, Gold, 2) - .inputItems(LOW_POWER_INTEGRATED_CIRCUIT, 2) - .inputItems(VOLTAGE_COIL_HV) - .inputFluids(SodiumPotassium.getFluid(1000)) - .outputItems(ENERGY_OUTPUT_HATCH[HV]) - .duration(200).EUt(VA[HV]).save(provider); + .inputItems(HULL[HV]) + .inputItems(spring, Gold, 2) + .inputItems(LOW_POWER_INTEGRATED_CIRCUIT, 2) + .inputItems(VOLTAGE_COIL_HV) + .inputFluids(SodiumPotassium.getFluid(1000)) + .outputItems(ENERGY_OUTPUT_HATCH[HV]) + .duration(200).EUt(VA[HV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("dynamo_hatch_ev") - .inputItems(HULL[EV]) - .inputItems(spring, Aluminium, 2) - .inputItems(POWER_INTEGRATED_CIRCUIT, 2) - .inputItems(VOLTAGE_COIL_EV) - .inputFluids(SodiumPotassium.getFluid(2000)) - .outputItems(ENERGY_OUTPUT_HATCH[EV]) - .duration(200).EUt(VA[EV]).save(provider); + .inputItems(HULL[EV]) + .inputItems(spring, Aluminium, 2) + .inputItems(POWER_INTEGRATED_CIRCUIT, 2) + .inputItems(VOLTAGE_COIL_EV) + .inputFluids(SodiumPotassium.getFluid(2000)) + .outputItems(ENERGY_OUTPUT_HATCH[EV]) + .duration(200).EUt(VA[EV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("dynamo_hatch_iv") - .inputItems(HULL[IV]) - .inputItems(spring, Tungsten, 2) - .inputItems(HIGH_POWER_INTEGRATED_CIRCUIT, 2) - .inputItems(VOLTAGE_COIL_IV) - .inputFluids(SodiumPotassium.getFluid(3000)) - .outputItems(ENERGY_OUTPUT_HATCH[IV]) - .duration(200).EUt(VA[IV]).save(provider); + .inputItems(HULL[IV]) + .inputItems(spring, Tungsten, 2) + .inputItems(HIGH_POWER_INTEGRATED_CIRCUIT, 2) + .inputItems(VOLTAGE_COIL_IV) + .inputFluids(SodiumPotassium.getFluid(3000)) + .outputItems(ENERGY_OUTPUT_HATCH[IV]) + .duration(200).EUt(VA[IV]).save(provider); ASSEMBLY_LINE_RECIPES.recipeBuilder("dynamo_hatch_luv") - .inputItems(HULL[LuV]) - .inputItems(spring, NiobiumTitanium, 4) - .inputItems(HIGH_POWER_INTEGRATED_CIRCUIT, 2) - .inputItems(CustomTags.LuV_CIRCUITS) - .inputItems(VOLTAGE_COIL_LuV, 2) - .inputFluids(SodiumPotassium.getFluid(6000)) - .inputFluids(SolderingAlloy.getFluid(720)) - .outputItems(ENERGY_OUTPUT_HATCH[LuV]) - .duration(400).EUt(VA[LuV]).save(provider); + .inputItems(HULL[LuV]) + .inputItems(spring, NiobiumTitanium, 4) + .inputItems(HIGH_POWER_INTEGRATED_CIRCUIT, 2) + .inputItems(CustomTags.LuV_CIRCUITS) + .inputItems(VOLTAGE_COIL_LuV, 2) + .inputFluids(SodiumPotassium.getFluid(6000)) + .inputFluids(SolderingAlloy.getFluid(720)) + .outputItems(ENERGY_OUTPUT_HATCH[LuV]) + .duration(400).EUt(VA[LuV]).save(provider); ASSEMBLY_LINE_RECIPES.recipeBuilder("dynamo_hatch_zpm") - .inputItems(HULL[ZPM]) - .inputItems(spring, VanadiumGallium, 4) - .inputItems(ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT, 2) - .inputItems(CustomTags.ZPM_CIRCUITS) - .inputItems(VOLTAGE_COIL_ZPM, 2) - .inputFluids(SodiumPotassium.getFluid(8000)) - .inputFluids(SolderingAlloy.getFluid(1440)) - .outputItems(ENERGY_OUTPUT_HATCH[ZPM]) - .stationResearch(b -> b - .researchStack(ENERGY_OUTPUT_HATCH[LuV].asStack()) - .CWUt(8)) - .duration(600).EUt(VA[ZPM]).save(provider); + .inputItems(HULL[ZPM]) + .inputItems(spring, VanadiumGallium, 4) + .inputItems(ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT, 2) + .inputItems(CustomTags.ZPM_CIRCUITS) + .inputItems(VOLTAGE_COIL_ZPM, 2) + .inputFluids(SodiumPotassium.getFluid(8000)) + .inputFluids(SolderingAlloy.getFluid(1440)) + .outputItems(ENERGY_OUTPUT_HATCH[ZPM]) + .stationResearch(b -> b + .researchStack(ENERGY_OUTPUT_HATCH[LuV].asStack()) + .CWUt(8)) + .duration(600).EUt(VA[ZPM]).save(provider); ASSEMBLY_LINE_RECIPES.recipeBuilder("dynamo_hatch_uv") - .inputItems(HULL[UV]) - .inputItems(spring, YttriumBariumCuprate, 4) - .inputItems(ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT, 2) - .inputItems(CustomTags.UV_CIRCUITS) - .inputItems(VOLTAGE_COIL_UV, 2) - .inputFluids(SodiumPotassium.getFluid(10000)) - .inputFluids(SolderingAlloy.getFluid(2880)) - .outputItems(ENERGY_OUTPUT_HATCH[UV]) - .stationResearch(b -> b - .researchStack(ENERGY_OUTPUT_HATCH[ZPM].asStack()) - .CWUt(64) - .EUt(VA[ZPM])) - .duration(800).EUt(VA[UV]).save(provider); + .inputItems(HULL[UV]) + .inputItems(spring, YttriumBariumCuprate, 4) + .inputItems(ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT, 2) + .inputItems(CustomTags.UV_CIRCUITS) + .inputItems(VOLTAGE_COIL_UV, 2) + .inputFluids(SodiumPotassium.getFluid(10000)) + .inputFluids(SolderingAlloy.getFluid(2880)) + .outputItems(ENERGY_OUTPUT_HATCH[UV]) + .stationResearch(b -> b + .researchStack(ENERGY_OUTPUT_HATCH[ZPM].asStack()) + .CWUt(64) + .EUt(VA[ZPM])) + .duration(800).EUt(VA[UV]).save(provider); ASSEMBLY_LINE_RECIPES.recipeBuilder("dynamo_hatch_uhv") - .inputItems(HULL[UHV]) - .inputItems(spring, Europium, 4) - .inputItems(ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT, 2) - .inputItems(CustomTags.UHV_CIRCUITS) - .inputItems(wireGtDouble, RutheniumTriniumAmericiumNeutronate, 2) - .inputFluids(SodiumPotassium.getFluid(12000)) - .inputFluids(SolderingAlloy.getFluid(5760)) - .outputItems(ENERGY_OUTPUT_HATCH[UHV]) - .stationResearch(b -> b - .researchStack(ENERGY_OUTPUT_HATCH[UV].asStack()) - .CWUt(128) - .EUt(VA[UV])) - .duration(1000).EUt(VA[UHV]).save(provider); + .inputItems(HULL[UHV]) + .inputItems(spring, Europium, 4) + .inputItems(ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT, 2) + .inputItems(CustomTags.UHV_CIRCUITS) + .inputItems(wireGtDouble, RutheniumTriniumAmericiumNeutronate, 2) + .inputFluids(SodiumPotassium.getFluid(12000)) + .inputFluids(SolderingAlloy.getFluid(5760)) + .outputItems(ENERGY_OUTPUT_HATCH[UHV]) + .stationResearch(b -> b + .researchStack(ENERGY_OUTPUT_HATCH[UV].asStack()) + .CWUt(128) + .EUt(VA[UV])) + .duration(1000).EUt(VA[UHV]).save(provider); // Energy Input Hatches VanillaRecipeHelper.addShapedRecipe(provider, true, "energy_hatch_ulv", ENERGY_INPUT_HATCH[ULV].asStack(), - " V ", "CHC", " ", - 'C', new UnificationEntry(cableGtSingle, RedAlloy), - 'V', VOLTAGE_COIL_ULV.asStack(), - 'H', HULL[ULV].asStack()); + " V ", "CHC", " ", + 'C', new UnificationEntry(cableGtSingle, RedAlloy), + 'V', VOLTAGE_COIL_ULV.asStack(), + 'H', HULL[ULV].asStack()); ASSEMBLER_RECIPES.recipeBuilder("energy_hatch_ulv") - .inputItems(HULL[ULV]) - .inputItems(cableGtSingle, RedAlloy, 2) - .inputItems(VOLTAGE_COIL_ULV) - .outputItems(ENERGY_INPUT_HATCH[ULV]) - .duration(200).EUt(VA[ULV]).save(provider); + .inputItems(HULL[ULV]) + .inputItems(cableGtSingle, RedAlloy, 2) + .inputItems(VOLTAGE_COIL_ULV) + .outputItems(ENERGY_INPUT_HATCH[ULV]) + .duration(200).EUt(VA[ULV]).save(provider); VanillaRecipeHelper.addShapedRecipe(provider, true, "energy_hatch_lv", ENERGY_INPUT_HATCH[LV].asStack(), - " V ", "CHC", " ", - 'C', new UnificationEntry(cableGtSingle, Tin), - 'V', VOLTAGE_COIL_LV.asStack(), - 'H', HULL[LV].asStack()); + " V ", "CHC", " ", + 'C', new UnificationEntry(cableGtSingle, Tin), + 'V', VOLTAGE_COIL_LV.asStack(), + 'H', HULL[LV].asStack()); ASSEMBLER_RECIPES.recipeBuilder("energy_hatch_lv") - .inputItems(HULL[LV]) - .inputItems(cableGtSingle, Tin, 2) - .inputItems(VOLTAGE_COIL_LV) - .outputItems(ENERGY_INPUT_HATCH[LV]) - .duration(200).EUt(VA[LV]).save(provider); + .inputItems(HULL[LV]) + .inputItems(cableGtSingle, Tin, 2) + .inputItems(VOLTAGE_COIL_LV) + .outputItems(ENERGY_INPUT_HATCH[LV]) + .duration(200).EUt(VA[LV]).save(provider); VanillaRecipeHelper.addShapedRecipe(provider, true, "energy_hatch_mv", ENERGY_INPUT_HATCH[MV].asStack(), - " V ", "CHC", " P ", - 'C', new UnificationEntry(cableGtSingle, Copper), - 'P', ULTRA_LOW_POWER_INTEGRATED_CIRCUIT.asStack(), - 'V', VOLTAGE_COIL_MV.asStack(), - 'H', HULL[MV].asStack()); + " V ", "CHC", " P ", + 'C', new UnificationEntry(cableGtSingle, Copper), + 'P', ULTRA_LOW_POWER_INTEGRATED_CIRCUIT.asStack(), + 'V', VOLTAGE_COIL_MV.asStack(), + 'H', HULL[MV].asStack()); ASSEMBLER_RECIPES.recipeBuilder("energy_hatch_mv") - .inputItems(HULL[MV]) - .inputItems(cableGtSingle, Copper, 2) - .inputItems(ULTRA_LOW_POWER_INTEGRATED_CIRCUIT) - .inputItems(VOLTAGE_COIL_MV) - .outputItems(ENERGY_INPUT_HATCH[MV]) - .duration(200).EUt(VA[MV]).save(provider); + .inputItems(HULL[MV]) + .inputItems(cableGtSingle, Copper, 2) + .inputItems(ULTRA_LOW_POWER_INTEGRATED_CIRCUIT) + .inputItems(VOLTAGE_COIL_MV) + .outputItems(ENERGY_INPUT_HATCH[MV]) + .duration(200).EUt(VA[MV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("energy_hatch_hv") - .inputItems(HULL[HV]) - .inputItems(cableGtSingle, Gold, 2) - .inputItems(LOW_POWER_INTEGRATED_CIRCUIT, 2) - .inputItems(VOLTAGE_COIL_HV) - .inputFluids(SodiumPotassium.getFluid(1000)) - .outputItems(ENERGY_INPUT_HATCH[HV]) - .duration(200).EUt(VA[HV]).save(provider); + .inputItems(HULL[HV]) + .inputItems(cableGtSingle, Gold, 2) + .inputItems(LOW_POWER_INTEGRATED_CIRCUIT, 2) + .inputItems(VOLTAGE_COIL_HV) + .inputFluids(SodiumPotassium.getFluid(1000)) + .outputItems(ENERGY_INPUT_HATCH[HV]) + .duration(200).EUt(VA[HV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("energy_hatch_ev") - .inputItems(HULL[EV]) - .inputItems(cableGtSingle, Aluminium, 2) - .inputItems(POWER_INTEGRATED_CIRCUIT, 2) - .inputItems(VOLTAGE_COIL_EV) - .inputFluids(SodiumPotassium.getFluid(2000)) - .outputItems(ENERGY_INPUT_HATCH[EV]) - .duration(200).EUt(VA[EV]).save(provider); + .inputItems(HULL[EV]) + .inputItems(cableGtSingle, Aluminium, 2) + .inputItems(POWER_INTEGRATED_CIRCUIT, 2) + .inputItems(VOLTAGE_COIL_EV) + .inputFluids(SodiumPotassium.getFluid(2000)) + .outputItems(ENERGY_INPUT_HATCH[EV]) + .duration(200).EUt(VA[EV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("energy_hatch_iv") - .inputItems(HULL[IV]) - .inputItems(cableGtSingle, Tungsten, 2) - .inputItems(HIGH_POWER_INTEGRATED_CIRCUIT, 2) - .inputItems(VOLTAGE_COIL_IV) - .inputFluids(SodiumPotassium.getFluid(3000)) - .outputItems(ENERGY_INPUT_HATCH[IV]) - .duration(200).EUt(VA[IV]).save(provider); + .inputItems(HULL[IV]) + .inputItems(cableGtSingle, Tungsten, 2) + .inputItems(HIGH_POWER_INTEGRATED_CIRCUIT, 2) + .inputItems(VOLTAGE_COIL_IV) + .inputFluids(SodiumPotassium.getFluid(3000)) + .outputItems(ENERGY_INPUT_HATCH[IV]) + .duration(200).EUt(VA[IV]).save(provider); ASSEMBLY_LINE_RECIPES.recipeBuilder("energy_hatch_luv") - .inputItems(HULL[LuV]) - .inputItems(cableGtSingle, NiobiumTitanium, 4) - .inputItems(HIGH_POWER_INTEGRATED_CIRCUIT, 2) - .inputItems(CustomTags.LuV_CIRCUITS) - .inputItems(VOLTAGE_COIL_LuV, 2) - .inputFluids(SodiumPotassium.getFluid(6000)) - .inputFluids(SolderingAlloy.getFluid(720)) - .outputItems(ENERGY_INPUT_HATCH[LuV]) - .scannerResearch(b -> b - .researchStack(ENERGY_INPUT_HATCH[IV].asStack()) - .EUt(VA[EV])) - .duration(400).EUt(VA[LuV]).save(provider); + .inputItems(HULL[LuV]) + .inputItems(cableGtSingle, NiobiumTitanium, 4) + .inputItems(HIGH_POWER_INTEGRATED_CIRCUIT, 2) + .inputItems(CustomTags.LuV_CIRCUITS) + .inputItems(VOLTAGE_COIL_LuV, 2) + .inputFluids(SodiumPotassium.getFluid(6000)) + .inputFluids(SolderingAlloy.getFluid(720)) + .outputItems(ENERGY_INPUT_HATCH[LuV]) + .scannerResearch(b -> b + .researchStack(ENERGY_INPUT_HATCH[IV].asStack()) + .EUt(VA[EV])) + .duration(400).EUt(VA[LuV]).save(provider); ASSEMBLY_LINE_RECIPES.recipeBuilder("energy_hatch_zpm") - .inputItems(HULL[ZPM]) - .inputItems(cableGtSingle, VanadiumGallium, 4) - .inputItems(ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT, 2) - .inputItems(CustomTags.ZPM_CIRCUITS) - .inputItems(VOLTAGE_COIL_ZPM, 2) - .inputFluids(SodiumPotassium.getFluid(8000)) - .inputFluids(SolderingAlloy.getFluid(1440)) - .outputItems(ENERGY_INPUT_HATCH[ZPM]) - .stationResearch(b -> b - .researchStack(ENERGY_INPUT_HATCH[LuV].asStack()) - .CWUt(8)) - .duration(600).EUt(VA[ZPM]).save(provider); + .inputItems(HULL[ZPM]) + .inputItems(cableGtSingle, VanadiumGallium, 4) + .inputItems(ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT, 2) + .inputItems(CustomTags.ZPM_CIRCUITS) + .inputItems(VOLTAGE_COIL_ZPM, 2) + .inputFluids(SodiumPotassium.getFluid(8000)) + .inputFluids(SolderingAlloy.getFluid(1440)) + .outputItems(ENERGY_INPUT_HATCH[ZPM]) + .stationResearch(b -> b + .researchStack(ENERGY_INPUT_HATCH[LuV].asStack()) + .CWUt(8)) + .duration(600).EUt(VA[ZPM]).save(provider); ASSEMBLY_LINE_RECIPES.recipeBuilder("energy_hatch_uv") - .inputItems(HULL[UV]) - .inputItems(cableGtSingle, YttriumBariumCuprate, 4) - .inputItems(ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT, 2) - .inputItems(CustomTags.UV_CIRCUITS) - .inputItems(VOLTAGE_COIL_UV, 2) - .inputFluids(SodiumPotassium.getFluid(10000)) - .inputFluids(SolderingAlloy.getFluid(2880)) - .outputItems(ENERGY_INPUT_HATCH[UV]) - .stationResearch(b -> b - .researchStack(ENERGY_INPUT_HATCH[ZPM].asStack()) - .CWUt(64) - .EUt(VA[ZPM])) - .duration(800).EUt(VA[UV]).save(provider); + .inputItems(HULL[UV]) + .inputItems(cableGtSingle, YttriumBariumCuprate, 4) + .inputItems(ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT, 2) + .inputItems(CustomTags.UV_CIRCUITS) + .inputItems(VOLTAGE_COIL_UV, 2) + .inputFluids(SodiumPotassium.getFluid(10000)) + .inputFluids(SolderingAlloy.getFluid(2880)) + .outputItems(ENERGY_INPUT_HATCH[UV]) + .stationResearch(b -> b + .researchStack(ENERGY_INPUT_HATCH[ZPM].asStack()) + .CWUt(64) + .EUt(VA[ZPM])) + .duration(800).EUt(VA[UV]).save(provider); ASSEMBLY_LINE_RECIPES.recipeBuilder("energy_hatch_uhv") - .inputItems(HULL[UHV]) - .inputItems(cableGtSingle, Europium, 4) - .inputItems(ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT, 2) - .inputItems(CustomTags.UHV_CIRCUITS) - .inputItems(wireGtDouble, RutheniumTriniumAmericiumNeutronate, 2) - .inputFluids(SodiumPotassium.getFluid(12000)) - .inputFluids(SolderingAlloy.getFluid(5760)) - .outputItems(ENERGY_INPUT_HATCH[UHV]) - .stationResearch(b -> b - .researchStack(ENERGY_INPUT_HATCH[UV].asStack()) - .CWUt(128) - .EUt(VA[UV])) - .duration(1000).EUt(VA[UHV]).save(provider); - - + .inputItems(HULL[UHV]) + .inputItems(cableGtSingle, Europium, 4) + .inputItems(ULTRA_HIGH_POWER_INTEGRATED_CIRCUIT, 2) + .inputItems(CustomTags.UHV_CIRCUITS) + .inputItems(wireGtDouble, RutheniumTriniumAmericiumNeutronate, 2) + .inputFluids(SodiumPotassium.getFluid(12000)) + .inputFluids(SolderingAlloy.getFluid(5760)) + .outputItems(ENERGY_INPUT_HATCH[UHV]) + .stationResearch(b -> b + .researchStack(ENERGY_INPUT_HATCH[UV].asStack()) + .CWUt(128) + .EUt(VA[UV])) + .duration(1000).EUt(VA[UHV]).save(provider); // Power Transformers ASSEMBLER_RECIPES.recipeBuilder("ulv_power_transformer") - .inputItems(HI_AMP_TRANSFORMER_4A[ULV]) - .inputItems(ELECTRIC_PUMP_LV) - .inputItems(cableGtOctal, Tin) - .inputItems(cableGtHex, Lead, 2) - .inputItems(springSmall, Lead) - .inputItems(spring, Tin) - .inputFluids(Lubricant.getFluid(2000)) - .outputItems(POWER_TRANSFORMER[ULV]) - .duration(200).EUt(VA[ULV]).save(provider); + .inputItems(HI_AMP_TRANSFORMER_4A[ULV]) + .inputItems(ELECTRIC_PUMP_LV) + .inputItems(cableGtOctal, Tin) + .inputItems(cableGtHex, Lead, 2) + .inputItems(springSmall, Lead) + .inputItems(spring, Tin) + .inputFluids(Lubricant.getFluid(2000)) + .outputItems(POWER_TRANSFORMER[ULV]) + .duration(200).EUt(VA[ULV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("lv_power_transformer") - .inputItems(HI_AMP_TRANSFORMER_4A[LV]) - .inputItems(ELECTRIC_PUMP_LV) - .inputItems(cableGtOctal, Copper) - .inputItems(cableGtHex, Tin, 2) - .inputItems(springSmall, Tin) - .inputItems(spring, Copper) - .inputFluids(Lubricant.getFluid(2000)) - .outputItems(POWER_TRANSFORMER[LV]) - .duration(200).EUt(VA[LV]).save(provider); + .inputItems(HI_AMP_TRANSFORMER_4A[LV]) + .inputItems(ELECTRIC_PUMP_LV) + .inputItems(cableGtOctal, Copper) + .inputItems(cableGtHex, Tin, 2) + .inputItems(springSmall, Tin) + .inputItems(spring, Copper) + .inputFluids(Lubricant.getFluid(2000)) + .outputItems(POWER_TRANSFORMER[LV]) + .duration(200).EUt(VA[LV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("mv_power_transformer") - .inputItems(HI_AMP_TRANSFORMER_4A[MV]) - .inputItems(ELECTRIC_PUMP_MV) - .inputItems(cableGtOctal, Gold) - .inputItems(cableGtHex, Copper, 2) - .inputItems(springSmall, Copper) - .inputItems(spring, Gold) - .inputFluids(Lubricant.getFluid(2000)) - .outputItems(POWER_TRANSFORMER[MV]) - .duration(200).EUt(VA[MV]).save(provider); + .inputItems(HI_AMP_TRANSFORMER_4A[MV]) + .inputItems(ELECTRIC_PUMP_MV) + .inputItems(cableGtOctal, Gold) + .inputItems(cableGtHex, Copper, 2) + .inputItems(springSmall, Copper) + .inputItems(spring, Gold) + .inputFluids(Lubricant.getFluid(2000)) + .outputItems(POWER_TRANSFORMER[MV]) + .duration(200).EUt(VA[MV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("hv_power_transformer") - .inputItems(HI_AMP_TRANSFORMER_4A[HV]) - .inputItems(ELECTRIC_PUMP_MV) - .inputItems(cableGtOctal, Aluminium) - .inputItems(cableGtHex, Gold, 2) - .inputItems(springSmall, Gold) - .inputItems(spring, Aluminium) - .inputFluids(Lubricant.getFluid(2000)) - .outputItems(POWER_TRANSFORMER[HV]) - .duration(200).EUt(VA[HV]).save(provider); + .inputItems(HI_AMP_TRANSFORMER_4A[HV]) + .inputItems(ELECTRIC_PUMP_MV) + .inputItems(cableGtOctal, Aluminium) + .inputItems(cableGtHex, Gold, 2) + .inputItems(springSmall, Gold) + .inputItems(spring, Aluminium) + .inputFluids(Lubricant.getFluid(2000)) + .outputItems(POWER_TRANSFORMER[HV]) + .duration(200).EUt(VA[HV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("ev_power_transformer") - .inputItems(HI_AMP_TRANSFORMER_4A[EV]) - .inputItems(ELECTRIC_PUMP_HV) - .inputItems(cableGtOctal, Tungsten) - .inputItems(cableGtHex, Aluminium, 2) - .inputItems(springSmall, Aluminium) - .inputItems(spring, Tungsten) - .inputFluids(Lubricant.getFluid(2000)) - .outputItems(POWER_TRANSFORMER[EV]) - .duration(200).EUt(VA[EV]).save(provider); + .inputItems(HI_AMP_TRANSFORMER_4A[EV]) + .inputItems(ELECTRIC_PUMP_HV) + .inputItems(cableGtOctal, Tungsten) + .inputItems(cableGtHex, Aluminium, 2) + .inputItems(springSmall, Aluminium) + .inputItems(spring, Tungsten) + .inputFluids(Lubricant.getFluid(2000)) + .outputItems(POWER_TRANSFORMER[EV]) + .duration(200).EUt(VA[EV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("iv_power_transformer") - .inputItems(HI_AMP_TRANSFORMER_4A[IV]) - .inputItems(ELECTRIC_PUMP_HV) - .inputItems(cableGtOctal, NiobiumTitanium) - .inputItems(cableGtHex, Tungsten, 2) - .inputItems(springSmall, Tungsten) - .inputItems(spring, NiobiumTitanium) - .inputFluids(Lubricant.getFluid(2000)) - .outputItems(POWER_TRANSFORMER[IV]) - .duration(200).EUt(VA[IV]).save(provider); + .inputItems(HI_AMP_TRANSFORMER_4A[IV]) + .inputItems(ELECTRIC_PUMP_HV) + .inputItems(cableGtOctal, NiobiumTitanium) + .inputItems(cableGtHex, Tungsten, 2) + .inputItems(springSmall, Tungsten) + .inputItems(spring, NiobiumTitanium) + .inputFluids(Lubricant.getFluid(2000)) + .outputItems(POWER_TRANSFORMER[IV]) + .duration(200).EUt(VA[IV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("luv_power_transformer") - .inputItems(HI_AMP_TRANSFORMER_4A[LuV]) - .inputItems(ELECTRIC_PUMP_EV) - .inputItems(cableGtOctal, VanadiumGallium) - .inputItems(cableGtHex, NiobiumTitanium, 2) - .inputItems(springSmall, NiobiumTitanium) - .inputItems(spring, VanadiumGallium) - .inputFluids(Lubricant.getFluid(2000)) - .outputItems(POWER_TRANSFORMER[LuV]) - .duration(200).EUt(VA[LuV]).save(provider); + .inputItems(HI_AMP_TRANSFORMER_4A[LuV]) + .inputItems(ELECTRIC_PUMP_EV) + .inputItems(cableGtOctal, VanadiumGallium) + .inputItems(cableGtHex, NiobiumTitanium, 2) + .inputItems(springSmall, NiobiumTitanium) + .inputItems(spring, VanadiumGallium) + .inputFluids(Lubricant.getFluid(2000)) + .outputItems(POWER_TRANSFORMER[LuV]) + .duration(200).EUt(VA[LuV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("zpm_power_transformer") - .inputItems(HI_AMP_TRANSFORMER_4A[ZPM]) - .inputItems(ELECTRIC_PUMP_EV) - .inputItems(cableGtOctal, YttriumBariumCuprate) - .inputItems(cableGtHex, VanadiumGallium, 2) - .inputItems(springSmall, VanadiumGallium) - .inputItems(spring, YttriumBariumCuprate) - .inputFluids(Lubricant.getFluid(2000)) - .outputItems(POWER_TRANSFORMER[ZPM]) - .duration(200).EUt(VA[ZPM]).save(provider); + .inputItems(HI_AMP_TRANSFORMER_4A[ZPM]) + .inputItems(ELECTRIC_PUMP_EV) + .inputItems(cableGtOctal, YttriumBariumCuprate) + .inputItems(cableGtHex, VanadiumGallium, 2) + .inputItems(springSmall, VanadiumGallium) + .inputItems(spring, YttriumBariumCuprate) + .inputFluids(Lubricant.getFluid(2000)) + .outputItems(POWER_TRANSFORMER[ZPM]) + .duration(200).EUt(VA[ZPM]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("uv_power_transformer") - .inputItems(HI_AMP_TRANSFORMER_4A[UV]) - .inputItems(ELECTRIC_PUMP_IV) - .inputItems(cableGtOctal, Europium) - .inputItems(cableGtHex, YttriumBariumCuprate, 2) - .inputItems(springSmall, YttriumBariumCuprate) - .inputItems(spring, Europium) - .inputFluids(Lubricant.getFluid(2000)) - .outputItems(POWER_TRANSFORMER[UV]) - .duration(200).EUt(VA[UV]).save(provider); + .inputItems(HI_AMP_TRANSFORMER_4A[UV]) + .inputItems(ELECTRIC_PUMP_IV) + .inputItems(cableGtOctal, Europium) + .inputItems(cableGtHex, YttriumBariumCuprate, 2) + .inputItems(springSmall, YttriumBariumCuprate) + .inputItems(spring, Europium) + .inputFluids(Lubricant.getFluid(2000)) + .outputItems(POWER_TRANSFORMER[UV]) + .duration(200).EUt(VA[UV]).save(provider); // 4A Energy Hatches ASSEMBLER_RECIPES.recipeBuilder("energy_hatch_4a_ev") - .inputItems(ENERGY_INPUT_HATCH[EV]) - .inputItems(wireGtQuadruple, Aluminium, 2) - .inputItems(plate, Titanium, 2) - .outputItems(ENERGY_INPUT_HATCH_4A[EV]) - .duration(100).EUt(VA[HV]).save(provider); + .inputItems(ENERGY_INPUT_HATCH[EV]) + .inputItems(wireGtQuadruple, Aluminium, 2) + .inputItems(plate, Titanium, 2) + .outputItems(ENERGY_INPUT_HATCH_4A[EV]) + .duration(100).EUt(VA[HV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("energy_hatch_4a_iv") - .inputItems(ENERGY_INPUT_HATCH[IV]) - .inputItems(wireGtQuadruple, Tungsten, 2) - .inputItems(plate, TungstenSteel, 2) - .outputItems(ENERGY_INPUT_HATCH_4A[IV]) - .duration(100).EUt(VA[EV]).save(provider); + .inputItems(ENERGY_INPUT_HATCH[IV]) + .inputItems(wireGtQuadruple, Tungsten, 2) + .inputItems(plate, TungstenSteel, 2) + .outputItems(ENERGY_INPUT_HATCH_4A[IV]) + .duration(100).EUt(VA[EV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("energy_hatch_4a_luv") - .inputItems(ENERGY_INPUT_HATCH[LuV]) - .inputItems(wireGtQuadruple, NiobiumTitanium, 2) - .inputItems(plate, RhodiumPlatedPalladium, 2) - .outputItems(ENERGY_INPUT_HATCH_4A[LuV]) - .duration(100).EUt(VA[IV]).save(provider); + .inputItems(ENERGY_INPUT_HATCH[LuV]) + .inputItems(wireGtQuadruple, NiobiumTitanium, 2) + .inputItems(plate, RhodiumPlatedPalladium, 2) + .outputItems(ENERGY_INPUT_HATCH_4A[LuV]) + .duration(100).EUt(VA[IV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("energy_hatch_4a_zpm") - .inputItems(ENERGY_INPUT_HATCH[ZPM]) - .inputItems(wireGtQuadruple, VanadiumGallium, 2) - .inputItems(plate, NaquadahAlloy, 2) - .outputItems(ENERGY_INPUT_HATCH_4A[ZPM]) - .duration(100).EUt(VA[LuV]).save(provider); + .inputItems(ENERGY_INPUT_HATCH[ZPM]) + .inputItems(wireGtQuadruple, VanadiumGallium, 2) + .inputItems(plate, NaquadahAlloy, 2) + .outputItems(ENERGY_INPUT_HATCH_4A[ZPM]) + .duration(100).EUt(VA[LuV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("energy_hatch_4a_uv") - .inputItems(ENERGY_INPUT_HATCH[UV]) - .inputItems(wireGtQuadruple, YttriumBariumCuprate, 2) - .inputItems(plate, Darmstadtium, 2) - .outputItems(ENERGY_INPUT_HATCH_4A[UV]) - .duration(100).EUt(VA[ZPM]).save(provider); + .inputItems(ENERGY_INPUT_HATCH[UV]) + .inputItems(wireGtQuadruple, YttriumBariumCuprate, 2) + .inputItems(plate, Darmstadtium, 2) + .outputItems(ENERGY_INPUT_HATCH_4A[UV]) + .duration(100).EUt(VA[ZPM]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("energy_hatch_4a_uhv") - .inputItems(ENERGY_INPUT_HATCH[UHV]) - .inputItems(wireGtQuadruple, Europium, 2) - .inputItems(plate, Neutronium, 2) - .outputItems(ENERGY_INPUT_HATCH_4A[UHV]) - .duration(100).EUt(VA[UV]).save(provider); + .inputItems(ENERGY_INPUT_HATCH[UHV]) + .inputItems(wireGtQuadruple, Europium, 2) + .inputItems(plate, Neutronium, 2) + .outputItems(ENERGY_INPUT_HATCH_4A[UHV]) + .duration(100).EUt(VA[UV]).save(provider); // 16A Energy Hatches ASSEMBLER_RECIPES.recipeBuilder("energy_hatch_16a_ev") - .inputItems(TRANSFORMER[IV]) - .inputItems(ENERGY_INPUT_HATCH_4A[EV]) - .inputItems(wireGtOctal, Tungsten, 2) - .inputItems(plate, TungstenSteel, 4) - .outputItems(ENERGY_INPUT_HATCH_16A[EV]) - .duration(200).EUt(VA[EV]).save(provider); + .inputItems(TRANSFORMER[IV]) + .inputItems(ENERGY_INPUT_HATCH_4A[EV]) + .inputItems(wireGtOctal, Tungsten, 2) + .inputItems(plate, TungstenSteel, 4) + .outputItems(ENERGY_INPUT_HATCH_16A[EV]) + .duration(200).EUt(VA[EV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("energy_hatch_16a_iv") - .inputItems(TRANSFORMER[LuV]) - .inputItems(ENERGY_INPUT_HATCH_4A[IV]) - .inputItems(wireGtOctal, NiobiumTitanium, 2) - .inputItems(plate, RhodiumPlatedPalladium, 4) - .outputItems(ENERGY_INPUT_HATCH_16A[IV]) - .duration(200).EUt(VA[IV]).save(provider); + .inputItems(TRANSFORMER[LuV]) + .inputItems(ENERGY_INPUT_HATCH_4A[IV]) + .inputItems(wireGtOctal, NiobiumTitanium, 2) + .inputItems(plate, RhodiumPlatedPalladium, 4) + .outputItems(ENERGY_INPUT_HATCH_16A[IV]) + .duration(200).EUt(VA[IV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("energy_hatch_16a_luv") - .inputItems(TRANSFORMER[ZPM]) - .inputItems(ENERGY_INPUT_HATCH_4A[LuV]) - .inputItems(wireGtOctal, VanadiumGallium, 2) - .inputItems(plate, NaquadahAlloy, 4) - .outputItems(ENERGY_INPUT_HATCH_16A[LuV]) - .duration(200).EUt(VA[LuV]).save(provider); + .inputItems(TRANSFORMER[ZPM]) + .inputItems(ENERGY_INPUT_HATCH_4A[LuV]) + .inputItems(wireGtOctal, VanadiumGallium, 2) + .inputItems(plate, NaquadahAlloy, 4) + .outputItems(ENERGY_INPUT_HATCH_16A[LuV]) + .duration(200).EUt(VA[LuV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("energy_hatch_16a_zpm") - .inputItems(TRANSFORMER[UV]) - .inputItems(ENERGY_INPUT_HATCH_4A[ZPM]) - .inputItems(wireGtOctal, YttriumBariumCuprate, 2) - .inputItems(plate, Darmstadtium, 4) - .outputItems(ENERGY_INPUT_HATCH_16A[ZPM]) - .duration(200).EUt(VA[ZPM]).save(provider); + .inputItems(TRANSFORMER[UV]) + .inputItems(ENERGY_INPUT_HATCH_4A[ZPM]) + .inputItems(wireGtOctal, YttriumBariumCuprate, 2) + .inputItems(plate, Darmstadtium, 4) + .outputItems(ENERGY_INPUT_HATCH_16A[ZPM]) + .duration(200).EUt(VA[ZPM]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("energy_hatch_16a_uv") - .inputItems(HI_AMP_TRANSFORMER_4A[UV]) - .inputItems(ENERGY_INPUT_HATCH_4A[UV], 2) - .inputItems(wireGtOctal, Europium, 2) - .inputItems(plate, Neutronium, 4) - .outputItems(ENERGY_INPUT_HATCH_16A[UV]) - .duration(200).EUt(VA[UV]).save(provider); + .inputItems(HI_AMP_TRANSFORMER_4A[UV]) + .inputItems(ENERGY_INPUT_HATCH_4A[UV], 2) + .inputItems(wireGtOctal, Europium, 2) + .inputItems(plate, Neutronium, 4) + .outputItems(ENERGY_INPUT_HATCH_16A[UV]) + .duration(200).EUt(VA[UV]).save(provider); // 64A Substation Energy Hatches ASSEMBLER_RECIPES.recipeBuilder("substation_energy_hatch_ev") - .inputItems(POWER_TRANSFORMER[IV]) - .inputItems(ENERGY_INPUT_HATCH_16A[EV]) - .inputItems(wireGtHex, Tungsten, 2) - .inputItems(plate, TungstenSteel, 6) - .outputItems(SUBSTATION_ENERGY_INPUT_HATCH[EV]) - .duration(400).EUt(VA[EV]).save(provider); + .inputItems(POWER_TRANSFORMER[IV]) + .inputItems(ENERGY_INPUT_HATCH_16A[EV]) + .inputItems(wireGtHex, Tungsten, 2) + .inputItems(plate, TungstenSteel, 6) + .outputItems(SUBSTATION_ENERGY_INPUT_HATCH[EV]) + .duration(400).EUt(VA[EV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("substation_energy_hatch_iv") - .inputItems(POWER_TRANSFORMER[LuV]) - .inputItems(ENERGY_INPUT_HATCH_16A[IV]) - .inputItems(wireGtHex, NiobiumTitanium, 2) - .inputItems(plate, RhodiumPlatedPalladium, 6) - .outputItems(SUBSTATION_ENERGY_INPUT_HATCH[IV]) - .duration(400).EUt(VA[IV]).save(provider); + .inputItems(POWER_TRANSFORMER[LuV]) + .inputItems(ENERGY_INPUT_HATCH_16A[IV]) + .inputItems(wireGtHex, NiobiumTitanium, 2) + .inputItems(plate, RhodiumPlatedPalladium, 6) + .outputItems(SUBSTATION_ENERGY_INPUT_HATCH[IV]) + .duration(400).EUt(VA[IV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("substation_energy_hatch_luv") - .inputItems(POWER_TRANSFORMER[ZPM]) - .inputItems(ENERGY_INPUT_HATCH_16A[LuV]) - .inputItems(wireGtHex, VanadiumGallium, 2) - .inputItems(plate, NaquadahAlloy, 6) - .outputItems(SUBSTATION_ENERGY_INPUT_HATCH[LuV]) - .duration(400).EUt(VA[LuV]).save(provider); + .inputItems(POWER_TRANSFORMER[ZPM]) + .inputItems(ENERGY_INPUT_HATCH_16A[LuV]) + .inputItems(wireGtHex, VanadiumGallium, 2) + .inputItems(plate, NaquadahAlloy, 6) + .outputItems(SUBSTATION_ENERGY_INPUT_HATCH[LuV]) + .duration(400).EUt(VA[LuV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("substation_energy_hatch_zpm") - .inputItems(POWER_TRANSFORMER[UV]) - .inputItems(ENERGY_INPUT_HATCH_16A[ZPM]) - .inputItems(wireGtHex, YttriumBariumCuprate, 2) - .inputItems(plate, Darmstadtium, 6) - .outputItems(SUBSTATION_ENERGY_INPUT_HATCH[ZPM]) - .duration(400).EUt(VA[ZPM]).save(provider); + .inputItems(POWER_TRANSFORMER[UV]) + .inputItems(ENERGY_INPUT_HATCH_16A[ZPM]) + .inputItems(wireGtHex, YttriumBariumCuprate, 2) + .inputItems(plate, Darmstadtium, 6) + .outputItems(SUBSTATION_ENERGY_INPUT_HATCH[ZPM]) + .duration(400).EUt(VA[ZPM]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("substation_energy_hatch_uv") - .inputItems(POWER_TRANSFORMER[UV]) - .inputItems(ENERGY_INPUT_HATCH_16A[UV]) - .inputItems(wireGtHex, Europium, 2) - .inputItems(plate, Neutronium, 6) - .outputItems(SUBSTATION_ENERGY_INPUT_HATCH[UV]) - .duration(400).EUt(VA[UV]).save(provider); + .inputItems(POWER_TRANSFORMER[UV]) + .inputItems(ENERGY_INPUT_HATCH_16A[UV]) + .inputItems(wireGtHex, Europium, 2) + .inputItems(plate, Neutronium, 6) + .outputItems(SUBSTATION_ENERGY_INPUT_HATCH[UV]) + .duration(400).EUt(VA[UV]).save(provider); // 4A Dynamo Hatches ASSEMBLER_RECIPES.recipeBuilder("dynamo_hatch_4a_ev") - .inputItems(ENERGY_OUTPUT_HATCH[EV]) - .inputItems(wireGtQuadruple, Aluminium, 2) - .inputItems(plate, Titanium, 2) - .outputItems(ENERGY_OUTPUT_HATCH_4A[EV]) - .duration(100).EUt(VA[HV]).save(provider); + .inputItems(ENERGY_OUTPUT_HATCH[EV]) + .inputItems(wireGtQuadruple, Aluminium, 2) + .inputItems(plate, Titanium, 2) + .outputItems(ENERGY_OUTPUT_HATCH_4A[EV]) + .duration(100).EUt(VA[HV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("dynamo_hatch_4a_iv") - .inputItems(ENERGY_OUTPUT_HATCH[IV]) - .inputItems(wireGtQuadruple, Tungsten, 2) - .inputItems(plate, TungstenSteel, 2) - .outputItems(ENERGY_OUTPUT_HATCH_4A[IV]) - .duration(100).EUt(VA[EV]).save(provider); + .inputItems(ENERGY_OUTPUT_HATCH[IV]) + .inputItems(wireGtQuadruple, Tungsten, 2) + .inputItems(plate, TungstenSteel, 2) + .outputItems(ENERGY_OUTPUT_HATCH_4A[IV]) + .duration(100).EUt(VA[EV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("dynamo_hatch_4a_luv") - .inputItems(ENERGY_OUTPUT_HATCH[LuV]) - .inputItems(wireGtQuadruple, NiobiumTitanium, 2) - .inputItems(plate, RhodiumPlatedPalladium, 2) - .outputItems(ENERGY_OUTPUT_HATCH_4A[LuV]) - .duration(100).EUt(VA[IV]).save(provider); + .inputItems(ENERGY_OUTPUT_HATCH[LuV]) + .inputItems(wireGtQuadruple, NiobiumTitanium, 2) + .inputItems(plate, RhodiumPlatedPalladium, 2) + .outputItems(ENERGY_OUTPUT_HATCH_4A[LuV]) + .duration(100).EUt(VA[IV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("dynamo_hatch_4a_zpm") - .inputItems(TRANSFORMER[ZPM]) - .inputItems(ENERGY_OUTPUT_HATCH[ZPM]) - .inputItems(wireGtQuadruple, VanadiumGallium, 2) - .inputItems(plate, NaquadahAlloy, 2) - .outputItems(ENERGY_OUTPUT_HATCH_4A[ZPM]) - .duration(100).EUt(VA[LuV]).save(provider); + .inputItems(TRANSFORMER[ZPM]) + .inputItems(ENERGY_OUTPUT_HATCH[ZPM]) + .inputItems(wireGtQuadruple, VanadiumGallium, 2) + .inputItems(plate, NaquadahAlloy, 2) + .outputItems(ENERGY_OUTPUT_HATCH_4A[ZPM]) + .duration(100).EUt(VA[LuV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("dynamo_hatch_4a_uv") - .inputItems(ENERGY_OUTPUT_HATCH[UV]) - .inputItems(wireGtQuadruple, YttriumBariumCuprate, 2) - .inputItems(plate, Darmstadtium, 2) - .outputItems(ENERGY_OUTPUT_HATCH_4A[UV]) - .duration(100).EUt(VA[ZPM]).save(provider); + .inputItems(ENERGY_OUTPUT_HATCH[UV]) + .inputItems(wireGtQuadruple, YttriumBariumCuprate, 2) + .inputItems(plate, Darmstadtium, 2) + .outputItems(ENERGY_OUTPUT_HATCH_4A[UV]) + .duration(100).EUt(VA[ZPM]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("dynamo_hatch_4a_uhv") - .inputItems(ENERGY_OUTPUT_HATCH[UHV]) - .inputItems(wireGtQuadruple, Europium, 2) - .inputItems(plate, Neutronium, 2) - .outputItems(ENERGY_OUTPUT_HATCH_4A[UHV]) - .duration(100).EUt(VA[UV]).save(provider); + .inputItems(ENERGY_OUTPUT_HATCH[UHV]) + .inputItems(wireGtQuadruple, Europium, 2) + .inputItems(plate, Neutronium, 2) + .outputItems(ENERGY_OUTPUT_HATCH_4A[UHV]) + .duration(100).EUt(VA[UV]).save(provider); // 16A Dynamo Hatches ASSEMBLER_RECIPES.recipeBuilder("dynamo_hatch_16a_ev") - .inputItems(TRANSFORMER[IV]) - .inputItems(ENERGY_OUTPUT_HATCH_4A[EV]) - .inputItems(wireGtOctal, Tungsten, 2) - .inputItems(plate, TungstenSteel, 4) - .outputItems(ENERGY_OUTPUT_HATCH_16A[EV]) - .duration(200).EUt(VA[EV]).save(provider); + .inputItems(TRANSFORMER[IV]) + .inputItems(ENERGY_OUTPUT_HATCH_4A[EV]) + .inputItems(wireGtOctal, Tungsten, 2) + .inputItems(plate, TungstenSteel, 4) + .outputItems(ENERGY_OUTPUT_HATCH_16A[EV]) + .duration(200).EUt(VA[EV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("dynamo_hatch_16a_iv") - .inputItems(TRANSFORMER[LuV]) - .inputItems(ENERGY_OUTPUT_HATCH_4A[IV]) - .inputItems(wireGtOctal, NiobiumTitanium, 2) - .inputItems(plate, RhodiumPlatedPalladium, 4) - .outputItems(ENERGY_OUTPUT_HATCH_16A[IV]) - .duration(200).EUt(VA[IV]).save(provider); + .inputItems(TRANSFORMER[LuV]) + .inputItems(ENERGY_OUTPUT_HATCH_4A[IV]) + .inputItems(wireGtOctal, NiobiumTitanium, 2) + .inputItems(plate, RhodiumPlatedPalladium, 4) + .outputItems(ENERGY_OUTPUT_HATCH_16A[IV]) + .duration(200).EUt(VA[IV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("dynamo_hatch_16a_luv") - .inputItems(TRANSFORMER[ZPM]) - .inputItems(ENERGY_OUTPUT_HATCH_4A[LuV]) - .inputItems(wireGtOctal, VanadiumGallium, 2) - .inputItems(plate, NaquadahAlloy, 4) - .outputItems(ENERGY_OUTPUT_HATCH_16A[LuV]) - .duration(200).EUt(VA[LuV]).save(provider); + .inputItems(TRANSFORMER[ZPM]) + .inputItems(ENERGY_OUTPUT_HATCH_4A[LuV]) + .inputItems(wireGtOctal, VanadiumGallium, 2) + .inputItems(plate, NaquadahAlloy, 4) + .outputItems(ENERGY_OUTPUT_HATCH_16A[LuV]) + .duration(200).EUt(VA[LuV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("dynamo_hatch_16a_zpm") - .inputItems(TRANSFORMER[UV]) - .inputItems(ENERGY_OUTPUT_HATCH_4A[ZPM]) - .inputItems(wireGtOctal, YttriumBariumCuprate, 2) - .inputItems(plate, Darmstadtium, 4) - .outputItems(ENERGY_OUTPUT_HATCH_16A[ZPM]) - .duration(200).EUt(VA[ZPM]).save(provider); + .inputItems(TRANSFORMER[UV]) + .inputItems(ENERGY_OUTPUT_HATCH_4A[ZPM]) + .inputItems(wireGtOctal, YttriumBariumCuprate, 2) + .inputItems(plate, Darmstadtium, 4) + .outputItems(ENERGY_OUTPUT_HATCH_16A[ZPM]) + .duration(200).EUt(VA[ZPM]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("dynamo_hatch_16a_uv") - .inputItems(HI_AMP_TRANSFORMER_4A[UV]) - .inputItems(ENERGY_OUTPUT_HATCH_4A[5]) - .inputItems(wireGtOctal, Europium, 2) - .inputItems(plate, Neutronium, 4) - .outputItems(ENERGY_OUTPUT_HATCH_16A[4]) - .duration(200).EUt(VA[UV]).save(provider); + .inputItems(HI_AMP_TRANSFORMER_4A[UV]) + .inputItems(ENERGY_OUTPUT_HATCH_4A[5]) + .inputItems(wireGtOctal, Europium, 2) + .inputItems(plate, Neutronium, 4) + .outputItems(ENERGY_OUTPUT_HATCH_16A[4]) + .duration(200).EUt(VA[UV]).save(provider); // 64A Substation Dynamo Hatches ASSEMBLER_RECIPES.recipeBuilder("substation_dynamo_hatch_ev") - .inputItems(POWER_TRANSFORMER[IV]) - .inputItems(ENERGY_OUTPUT_HATCH_16A[EV]) - .inputItems(wireGtHex, Tungsten, 2) - .inputItems(plate, TungstenSteel, 6) - .outputItems(SUBSTATION_ENERGY_OUTPUT_HATCH[EV]) - .duration(400).EUt(VA[EV]).save(provider); + .inputItems(POWER_TRANSFORMER[IV]) + .inputItems(ENERGY_OUTPUT_HATCH_16A[EV]) + .inputItems(wireGtHex, Tungsten, 2) + .inputItems(plate, TungstenSteel, 6) + .outputItems(SUBSTATION_ENERGY_OUTPUT_HATCH[EV]) + .duration(400).EUt(VA[EV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("substation_dynamo_hatch_iv") - .inputItems(POWER_TRANSFORMER[LuV]) - .inputItems(ENERGY_OUTPUT_HATCH_16A[IV]) - .inputItems(wireGtHex, NiobiumTitanium, 2) - .inputItems(plate, RhodiumPlatedPalladium, 6) - .outputItems(SUBSTATION_ENERGY_OUTPUT_HATCH[IV]) - .duration(400).EUt(VA[IV]).save(provider); + .inputItems(POWER_TRANSFORMER[LuV]) + .inputItems(ENERGY_OUTPUT_HATCH_16A[IV]) + .inputItems(wireGtHex, NiobiumTitanium, 2) + .inputItems(plate, RhodiumPlatedPalladium, 6) + .outputItems(SUBSTATION_ENERGY_OUTPUT_HATCH[IV]) + .duration(400).EUt(VA[IV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("substation_dynamo_hatch_luv") - .inputItems(POWER_TRANSFORMER[ZPM]) - .inputItems(ENERGY_OUTPUT_HATCH_16A[LuV]) - .inputItems(wireGtHex, VanadiumGallium, 2) - .inputItems(plate, NaquadahAlloy, 6) - .outputItems(SUBSTATION_ENERGY_OUTPUT_HATCH[LuV]) - .duration(400).EUt(VA[LuV]).save(provider); + .inputItems(POWER_TRANSFORMER[ZPM]) + .inputItems(ENERGY_OUTPUT_HATCH_16A[LuV]) + .inputItems(wireGtHex, VanadiumGallium, 2) + .inputItems(plate, NaquadahAlloy, 6) + .outputItems(SUBSTATION_ENERGY_OUTPUT_HATCH[LuV]) + .duration(400).EUt(VA[LuV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("substation_dynamo_hatch_zpm") - .inputItems(POWER_TRANSFORMER[UV]) - .inputItems(ENERGY_OUTPUT_HATCH_16A[ZPM]) - .inputItems(wireGtHex, YttriumBariumCuprate, 2) - .inputItems(plate, Darmstadtium, 6) - .outputItems(SUBSTATION_ENERGY_OUTPUT_HATCH[ZPM]) - .duration(400).EUt(VA[ZPM]).save(provider); + .inputItems(POWER_TRANSFORMER[UV]) + .inputItems(ENERGY_OUTPUT_HATCH_16A[ZPM]) + .inputItems(wireGtHex, YttriumBariumCuprate, 2) + .inputItems(plate, Darmstadtium, 6) + .outputItems(SUBSTATION_ENERGY_OUTPUT_HATCH[ZPM]) + .duration(400).EUt(VA[ZPM]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("substation_dynamo_hatch_uv") - .inputItems(POWER_TRANSFORMER[UV]) - .inputItems(ENERGY_OUTPUT_HATCH_16A[UV]) - .inputItems(wireGtHex, Europium, 2) - .inputItems(plate, Neutronium, 6) - .outputItems(SUBSTATION_ENERGY_OUTPUT_HATCH[UV]) - .duration(400).EUt(VA[UV]).save(provider); + .inputItems(POWER_TRANSFORMER[UV]) + .inputItems(ENERGY_OUTPUT_HATCH_16A[UV]) + .inputItems(wireGtHex, Europium, 2) + .inputItems(plate, Neutronium, 6) + .outputItems(SUBSTATION_ENERGY_OUTPUT_HATCH[UV]) + .duration(400).EUt(VA[UV]).save(provider); // Maintenance Hatch ASSEMBLER_RECIPES.recipeBuilder("maintenance_hatch") - .inputItems(HULL[LV]) - .circuitMeta(1) - .outputItems(MAINTENANCE_HATCH) - .duration(100).EUt(VA[LV]).save(provider); + .inputItems(HULL[LV]) + .circuitMeta(1) + .outputItems(MAINTENANCE_HATCH) + .duration(100).EUt(VA[LV]).save(provider); // Multiblock Miners ASSEMBLER_RECIPES.recipeBuilder("ev_large_miner") - .inputItems(HULL[EV]) - .inputItems(frameGt, Titanium, 4) - .inputItems(CustomTags.IV_CIRCUITS, 4) - .inputItems(ELECTRIC_MOTOR_EV, 4) - .inputItems(ELECTRIC_PUMP_EV, 4) - .inputItems(CONVEYOR_MODULE_EV, 4) - .inputItems(gear, Tungsten, 4) - .circuitMeta(2) - .outputItems(LARGE_MINER[EV]) - .duration(400).EUt(VA[EV]).save(provider); + .inputItems(HULL[EV]) + .inputItems(frameGt, Titanium, 4) + .inputItems(CustomTags.IV_CIRCUITS, 4) + .inputItems(ELECTRIC_MOTOR_EV, 4) + .inputItems(ELECTRIC_PUMP_EV, 4) + .inputItems(CONVEYOR_MODULE_EV, 4) + .inputItems(gear, Tungsten, 4) + .circuitMeta(2) + .outputItems(LARGE_MINER[EV]) + .duration(400).EUt(VA[EV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("iv_large_miner") - .inputItems(HULL[IV]) - .inputItems(frameGt, TungstenSteel, 4) - .inputItems(CustomTags.IV_CIRCUITS, 4) - .inputItems(ELECTRIC_MOTOR_IV, 4) - .inputItems(ELECTRIC_PUMP_IV, 4) - .inputItems(CONVEYOR_MODULE_IV, 4) - .inputItems(gear, Iridium, 4) - .circuitMeta(2) - .outputItems(LARGE_MINER[IV]) - .duration(400).EUt(VA[IV]).save(provider); + .inputItems(HULL[IV]) + .inputItems(frameGt, TungstenSteel, 4) + .inputItems(CustomTags.IV_CIRCUITS, 4) + .inputItems(ELECTRIC_MOTOR_IV, 4) + .inputItems(ELECTRIC_PUMP_IV, 4) + .inputItems(CONVEYOR_MODULE_IV, 4) + .inputItems(gear, Iridium, 4) + .circuitMeta(2) + .outputItems(LARGE_MINER[IV]) + .duration(400).EUt(VA[IV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("luv_large_miner") - .inputItems(HULL[LuV]) - .inputItems(frameGt, HSSS, 4) - .inputItems(CustomTags.LuV_CIRCUITS, 4) - .inputItems(ELECTRIC_MOTOR_LuV, 4) - .inputItems(ELECTRIC_PUMP_LuV, 4) - .inputItems(CONVEYOR_MODULE_LuV, 4) - .inputItems(gear, Ruridit, 4) - .circuitMeta(2) - .outputItems(LARGE_MINER[LuV]) - .duration(400).EUt(VA[LuV]).save(provider); + .inputItems(HULL[LuV]) + .inputItems(frameGt, HSSS, 4) + .inputItems(CustomTags.LuV_CIRCUITS, 4) + .inputItems(ELECTRIC_MOTOR_LuV, 4) + .inputItems(ELECTRIC_PUMP_LuV, 4) + .inputItems(CONVEYOR_MODULE_LuV, 4) + .inputItems(gear, Ruridit, 4) + .circuitMeta(2) + .outputItems(LARGE_MINER[LuV]) + .duration(400).EUt(VA[LuV]).save(provider); // Multiblock Fluid Drills ASSEMBLER_RECIPES.recipeBuilder("mv_fluid_drilling_rig") - .inputItems(HULL[MV]) - .inputItems(frameGt, Steel, 4) - .inputItems(CustomTags.MV_CIRCUITS, 4) - .inputItems(ELECTRIC_MOTOR_MV, 4) - .inputItems(ELECTRIC_PUMP_MV, 4) - .inputItems(gear, VanadiumSteel, 4) - .circuitMeta(2) - .outputItems(FLUID_DRILLING_RIG[MV]) - .duration(400).EUt(VA[MV]).save(provider); + .inputItems(HULL[MV]) + .inputItems(frameGt, Steel, 4) + .inputItems(CustomTags.MV_CIRCUITS, 4) + .inputItems(ELECTRIC_MOTOR_MV, 4) + .inputItems(ELECTRIC_PUMP_MV, 4) + .inputItems(gear, VanadiumSteel, 4) + .circuitMeta(2) + .outputItems(FLUID_DRILLING_RIG[MV]) + .duration(400).EUt(VA[MV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("hv_fluid_drilling_rig") - .inputItems(HULL[EV]) - .inputItems(frameGt, Titanium, 4) - .inputItems(CustomTags.EV_CIRCUITS, 4) - .inputItems(ELECTRIC_MOTOR_EV, 4) - .inputItems(ELECTRIC_PUMP_EV, 4) - .inputItems(gear, TungstenCarbide, 4) - .circuitMeta(2) - .outputItems(FLUID_DRILLING_RIG[HV]) - .duration(400).EUt(VA[EV]).save(provider); + .inputItems(HULL[EV]) + .inputItems(frameGt, Titanium, 4) + .inputItems(CustomTags.EV_CIRCUITS, 4) + .inputItems(ELECTRIC_MOTOR_EV, 4) + .inputItems(ELECTRIC_PUMP_EV, 4) + .inputItems(gear, TungstenCarbide, 4) + .circuitMeta(2) + .outputItems(FLUID_DRILLING_RIG[HV]) + .duration(400).EUt(VA[EV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("ev_fluid_drilling_rig") - .inputItems(HULL[LuV]) - .inputItems(frameGt, TungstenSteel, 4) - .inputItems(CustomTags.LuV_CIRCUITS, 4) - .inputItems(ELECTRIC_MOTOR_LuV, 4) - .inputItems(ELECTRIC_PUMP_LuV, 4) - .inputItems(gear, Osmiridium, 4) - .circuitMeta(2) - .outputItems(FLUID_DRILLING_RIG[EV]) - .duration(400).EUt(VA[LuV]).save(provider); + .inputItems(HULL[LuV]) + .inputItems(frameGt, TungstenSteel, 4) + .inputItems(CustomTags.LuV_CIRCUITS, 4) + .inputItems(ELECTRIC_MOTOR_LuV, 4) + .inputItems(ELECTRIC_PUMP_LuV, 4) + .inputItems(gear, Osmiridium, 4) + .circuitMeta(2) + .outputItems(FLUID_DRILLING_RIG[EV]) + .duration(400).EUt(VA[LuV]).save(provider); // Long Distance Pipes ASSEMBLER_RECIPES.recipeBuilder("long_distance_item_endpoint") - .inputItems(pipeLargeItem, Tin, 2) - .inputItems(plate, Steel, 8) - .inputItems(gear, Steel, 2) - .circuitMeta(1) - .inputFluids(SolderingAlloy.getFluid(L / 2)) - .outputItems(LONG_DIST_ITEM_ENDPOINT, 2) - .duration(400).EUt(16) - .save(provider); + .inputItems(pipeLargeItem, Tin, 2) + .inputItems(plate, Steel, 8) + .inputItems(gear, Steel, 2) + .circuitMeta(1) + .inputFluids(SolderingAlloy.getFluid(L / 2)) + .outputItems(LONG_DIST_ITEM_ENDPOINT, 2) + .duration(400).EUt(16) + .save(provider); ASSEMBLER_RECIPES.recipeBuilder("long_distance_fluid_endpoint") - .inputItems(pipeLargeFluid, Bronze, 2) - .inputItems(plate, Steel, 8) - .inputItems(gear, Steel, 2) - .circuitMeta(1) - .inputFluids(SolderingAlloy.getFluid(L / 2)) - .outputItems(LONG_DIST_FLUID_ENDPOINT, 2) - .duration(400).EUt(16) - .save(provider); + .inputItems(pipeLargeFluid, Bronze, 2) + .inputItems(plate, Steel, 8) + .inputItems(gear, Steel, 2) + .circuitMeta(1) + .inputFluids(SolderingAlloy.getFluid(L / 2)) + .outputItems(LONG_DIST_FLUID_ENDPOINT, 2) + .duration(400).EUt(16) + .save(provider); ASSEMBLER_RECIPES.recipeBuilder("long_distance_item_pipe") - .inputItems(pipeLargeItem, Tin, 2) - .inputItems(plate, Steel, 8) - .circuitMeta(2) - .inputFluids(SolderingAlloy.getFluid(L / 2)) - .outputItems(LD_ITEM_PIPE, 64) - .duration(600).EUt(24) - .save(provider); + .inputItems(pipeLargeItem, Tin, 2) + .inputItems(plate, Steel, 8) + .circuitMeta(2) + .inputFluids(SolderingAlloy.getFluid(L / 2)) + .outputItems(LD_ITEM_PIPE, 64) + .duration(600).EUt(24) + .save(provider); ASSEMBLER_RECIPES.recipeBuilder("long_distance_fluid_pipe") - .inputItems(pipeLargeFluid, Bronze, 2) - .inputItems(plate, Steel, 8) - .circuitMeta(2) - .inputFluids(SolderingAlloy.getFluid(L / 2)) - .outputItems(LD_FLUID_PIPE, 64) - .duration(600).EUt(24) - .save(provider); + .inputItems(pipeLargeFluid, Bronze, 2) + .inputItems(plate, Steel, 8) + .circuitMeta(2) + .inputFluids(SolderingAlloy.getFluid(L / 2)) + .outputItems(LD_FLUID_PIPE, 64) + .duration(600).EUt(24) + .save(provider); // ME Parts @@ -768,283 +768,281 @@ public static void init(Consumer provider) { ItemStack accelerationCard = AEItems.SPEED_CARD.stack(2); ASSEMBLER_RECIPES.recipeBuilder("me_export_hatch") - .inputItems(FLUID_EXPORT_HATCH[EV]) - .inputItems(meInterface.copy()) - .inputItems(accelerationCard.copy()) - .outputItems(GTAEMachines.FLUID_EXPORT_HATCH.asStack()) - .duration(300).EUt(VA[HV]).save(provider); + .inputItems(FLUID_EXPORT_HATCH[EV]) + .inputItems(meInterface.copy()) + .inputItems(accelerationCard.copy()) + .outputItems(GTAEMachines.FLUID_EXPORT_HATCH.asStack()) + .duration(300).EUt(VA[HV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("me_import_hatch") - .inputItems(FLUID_IMPORT_HATCH[EV]) - .inputItems(meInterface.copy()) - .inputItems(accelerationCard.copy()) - .outputItems(GTAEMachines.FLUID_IMPORT_HATCH.asStack()) - .duration(300).EUt(VA[HV]).save(provider); + .inputItems(FLUID_IMPORT_HATCH[EV]) + .inputItems(meInterface.copy()) + .inputItems(accelerationCard.copy()) + .outputItems(GTAEMachines.FLUID_IMPORT_HATCH.asStack()) + .duration(300).EUt(VA[HV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("me_export_bus") - .inputItems(ITEM_EXPORT_BUS[EV]) - .inputItems(meInterface.copy()) - .inputItems(accelerationCard.copy()) - .outputItems(GTAEMachines.ITEM_EXPORT_BUS.asStack()) - .duration(300).EUt(VA[HV]).save(provider); + .inputItems(ITEM_EXPORT_BUS[EV]) + .inputItems(meInterface.copy()) + .inputItems(accelerationCard.copy()) + .outputItems(GTAEMachines.ITEM_EXPORT_BUS.asStack()) + .duration(300).EUt(VA[HV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("me_import_bus") - .inputItems(ITEM_IMPORT_BUS[EV]) - .inputItems(meInterface.copy()) - .inputItems(accelerationCard.copy()) - .outputItems(GTAEMachines.ITEM_IMPORT_BUS.asStack()) - .duration(300).EUt(VA[HV]).save(provider); + .inputItems(ITEM_IMPORT_BUS[EV]) + .inputItems(meInterface.copy()) + .inputItems(accelerationCard.copy()) + .outputItems(GTAEMachines.ITEM_IMPORT_BUS.asStack()) + .duration(300).EUt(VA[HV]).save(provider); } - } // TODO clean this up with a CraftingComponent rework private static void registerLaserRecipes(Consumer provider) { - // 256A Laser Target Hatches ASSEMBLER_RECIPES.recipeBuilder("iv_256a_laser_target_hatch") - .inputItems(HULL[IV]) - .inputItems(lens, Diamond) - .inputItems(EMITTER_IV) - .inputItems(ELECTRIC_PUMP_IV) - .inputItems(cableGtSingle, Platinum, 4) - .circuitMeta(1) - .outputItems(LASER_INPUT_HATCH_256[IV]) - .duration(300).EUt(VA[IV]).save(provider); + .inputItems(HULL[IV]) + .inputItems(lens, Diamond) + .inputItems(EMITTER_IV) + .inputItems(ELECTRIC_PUMP_IV) + .inputItems(cableGtSingle, Platinum, 4) + .circuitMeta(1) + .outputItems(LASER_INPUT_HATCH_256[IV]) + .duration(300).EUt(VA[IV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("luv_256a_laser_target_hatch") - .inputItems(HULL[LuV]) - .inputItems(lens, Diamond) - .inputItems(EMITTER_LuV) - .inputItems(ELECTRIC_PUMP_LuV) - .inputItems(cableGtSingle, NiobiumTitanium, 4) - .circuitMeta(1) - .outputItems(LASER_INPUT_HATCH_256[LuV]) - .duration(300).EUt(VA[LuV]).save(provider); + .inputItems(HULL[LuV]) + .inputItems(lens, Diamond) + .inputItems(EMITTER_LuV) + .inputItems(ELECTRIC_PUMP_LuV) + .inputItems(cableGtSingle, NiobiumTitanium, 4) + .circuitMeta(1) + .outputItems(LASER_INPUT_HATCH_256[LuV]) + .duration(300).EUt(VA[LuV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("zpm_256a_laser_target_hatch") - .inputItems(HULL[ZPM]) - .inputItems(lens, Diamond) - .inputItems(EMITTER_ZPM) - .inputItems(ELECTRIC_PUMP_ZPM) - .inputItems(cableGtSingle, VanadiumGallium, 4) - .circuitMeta(1) - .outputItems(LASER_INPUT_HATCH_256[ZPM]) - .duration(300).EUt(VA[ZPM]).save(provider); + .inputItems(HULL[ZPM]) + .inputItems(lens, Diamond) + .inputItems(EMITTER_ZPM) + .inputItems(ELECTRIC_PUMP_ZPM) + .inputItems(cableGtSingle, VanadiumGallium, 4) + .circuitMeta(1) + .outputItems(LASER_INPUT_HATCH_256[ZPM]) + .duration(300).EUt(VA[ZPM]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("uv_256a_laser_target_hatch") - .inputItems(HULL[UV]) - .inputItems(lens, Diamond) - .inputItems(EMITTER_UV) - .inputItems(ELECTRIC_PUMP_UV) - .inputItems(cableGtSingle, YttriumBariumCuprate, 4) - .circuitMeta(1) - .outputItems(LASER_INPUT_HATCH_256[UV]) - .duration(300).EUt(VA[UV]).save(provider); + .inputItems(HULL[UV]) + .inputItems(lens, Diamond) + .inputItems(EMITTER_UV) + .inputItems(ELECTRIC_PUMP_UV) + .inputItems(cableGtSingle, YttriumBariumCuprate, 4) + .circuitMeta(1) + .outputItems(LASER_INPUT_HATCH_256[UV]) + .duration(300).EUt(VA[UV]).save(provider); // 256A Laser Source Hatches ASSEMBLER_RECIPES.recipeBuilder("iv_256a_laser_source_hatch") - .inputItems(HULL[IV]) - .inputItems(lens, Diamond) - .inputItems(SENSOR_IV) - .inputItems(ELECTRIC_PUMP_IV) - .inputItems(cableGtSingle, Platinum, 4) - .circuitMeta(1) - .outputItems(LASER_OUTPUT_HATCH_256[IV]) - .duration(300).EUt(VA[IV]).save(provider); + .inputItems(HULL[IV]) + .inputItems(lens, Diamond) + .inputItems(SENSOR_IV) + .inputItems(ELECTRIC_PUMP_IV) + .inputItems(cableGtSingle, Platinum, 4) + .circuitMeta(1) + .outputItems(LASER_OUTPUT_HATCH_256[IV]) + .duration(300).EUt(VA[IV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("luv_256a_laser_source_hatch") - .inputItems(HULL[LuV]) - .inputItems(lens, Diamond) - .inputItems(SENSOR_LuV) - .inputItems(ELECTRIC_PUMP_LuV) - .inputItems(cableGtSingle, NiobiumTitanium, 4) - .circuitMeta(1) - .outputItems(LASER_OUTPUT_HATCH_256[LuV]) - .duration(300).EUt(VA[LuV]).save(provider); + .inputItems(HULL[LuV]) + .inputItems(lens, Diamond) + .inputItems(SENSOR_LuV) + .inputItems(ELECTRIC_PUMP_LuV) + .inputItems(cableGtSingle, NiobiumTitanium, 4) + .circuitMeta(1) + .outputItems(LASER_OUTPUT_HATCH_256[LuV]) + .duration(300).EUt(VA[LuV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("zpm_256a_laser_source_hatch") - .inputItems(HULL[ZPM]) - .inputItems(lens, Diamond) - .inputItems(SENSOR_ZPM) - .inputItems(ELECTRIC_PUMP_ZPM) - .inputItems(cableGtSingle, VanadiumGallium, 4) - .circuitMeta(1) - .outputItems(LASER_OUTPUT_HATCH_256[ZPM]) - .duration(300).EUt(VA[ZPM]).save(provider); + .inputItems(HULL[ZPM]) + .inputItems(lens, Diamond) + .inputItems(SENSOR_ZPM) + .inputItems(ELECTRIC_PUMP_ZPM) + .inputItems(cableGtSingle, VanadiumGallium, 4) + .circuitMeta(1) + .outputItems(LASER_OUTPUT_HATCH_256[ZPM]) + .duration(300).EUt(VA[ZPM]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("uv_256a_laser_source_hatch") - .inputItems(HULL[UV]) - .inputItems(lens, Diamond) - .inputItems(SENSOR_UV) - .inputItems(ELECTRIC_PUMP_UV) - .inputItems(cableGtSingle, YttriumBariumCuprate, 4) - .circuitMeta(1) - .outputItems(LASER_OUTPUT_HATCH_256[UV]) - .duration(300).EUt(VA[UV]).save(provider); + .inputItems(HULL[UV]) + .inputItems(lens, Diamond) + .inputItems(SENSOR_UV) + .inputItems(ELECTRIC_PUMP_UV) + .inputItems(cableGtSingle, YttriumBariumCuprate, 4) + .circuitMeta(1) + .outputItems(LASER_OUTPUT_HATCH_256[UV]) + .duration(300).EUt(VA[UV]).save(provider); // 1024A Laser Target Hatches ASSEMBLER_RECIPES.recipeBuilder("iv_1024a_laser_target_hatch") - .inputItems(HULL[IV]) - .inputItems(lens, Diamond, 2) - .inputItems(EMITTER_IV, 2) - .inputItems(ELECTRIC_PUMP_IV, 2) - .inputItems(cableGtDouble, Platinum, 4) - .circuitMeta(2) - .outputItems(LASER_INPUT_HATCH_1024[IV]) - .duration(600).EUt(VA[IV]).save(provider); + .inputItems(HULL[IV]) + .inputItems(lens, Diamond, 2) + .inputItems(EMITTER_IV, 2) + .inputItems(ELECTRIC_PUMP_IV, 2) + .inputItems(cableGtDouble, Platinum, 4) + .circuitMeta(2) + .outputItems(LASER_INPUT_HATCH_1024[IV]) + .duration(600).EUt(VA[IV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("luv_1024a_laser_target_hatch") - .inputItems(HULL[LuV]) - .inputItems(lens, Diamond, 2) - .inputItems(EMITTER_LuV, 2) - .inputItems(ELECTRIC_PUMP_LuV, 2) - .inputItems(cableGtDouble, NiobiumTitanium, 4) - .circuitMeta(2) - .outputItems(LASER_INPUT_HATCH_1024[LuV]) - .duration(600).EUt(VA[LuV]).save(provider); + .inputItems(HULL[LuV]) + .inputItems(lens, Diamond, 2) + .inputItems(EMITTER_LuV, 2) + .inputItems(ELECTRIC_PUMP_LuV, 2) + .inputItems(cableGtDouble, NiobiumTitanium, 4) + .circuitMeta(2) + .outputItems(LASER_INPUT_HATCH_1024[LuV]) + .duration(600).EUt(VA[LuV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("zpm_1024a_laser_target_hatch") - .inputItems(HULL[ZPM]) - .inputItems(lens, Diamond, 2) - .inputItems(EMITTER_ZPM, 2) - .inputItems(ELECTRIC_PUMP_ZPM, 2) - .inputItems(cableGtDouble, VanadiumGallium, 4) - .circuitMeta(2) - .outputItems(LASER_INPUT_HATCH_1024[ZPM]) - .duration(600).EUt(VA[ZPM]).save(provider); + .inputItems(HULL[ZPM]) + .inputItems(lens, Diamond, 2) + .inputItems(EMITTER_ZPM, 2) + .inputItems(ELECTRIC_PUMP_ZPM, 2) + .inputItems(cableGtDouble, VanadiumGallium, 4) + .circuitMeta(2) + .outputItems(LASER_INPUT_HATCH_1024[ZPM]) + .duration(600).EUt(VA[ZPM]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("uv_1024a_laser_target_hatch") - .inputItems(HULL[UV]) - .inputItems(lens, Diamond, 2) - .inputItems(EMITTER_UV, 2) - .inputItems(ELECTRIC_PUMP_UV, 2) - .inputItems(cableGtDouble, YttriumBariumCuprate, 4) - .circuitMeta(2) - .outputItems(LASER_INPUT_HATCH_1024[UV]) - .duration(600).EUt(VA[UV]).save(provider); + .inputItems(HULL[UV]) + .inputItems(lens, Diamond, 2) + .inputItems(EMITTER_UV, 2) + .inputItems(ELECTRIC_PUMP_UV, 2) + .inputItems(cableGtDouble, YttriumBariumCuprate, 4) + .circuitMeta(2) + .outputItems(LASER_INPUT_HATCH_1024[UV]) + .duration(600).EUt(VA[UV]).save(provider); // 1024A Laser Source Hatches ASSEMBLER_RECIPES.recipeBuilder("iv_1024a_laser_source_hatch") - .inputItems(HULL[IV]) - .inputItems(lens, Diamond, 2) - .inputItems(SENSOR_IV, 2) - .inputItems(ELECTRIC_PUMP_IV, 2) - .inputItems(cableGtDouble, Platinum, 4) - .circuitMeta(2) - .outputItems(LASER_OUTPUT_HATCH_1024[IV]) - .duration(600).EUt(VA[IV]).save(provider); + .inputItems(HULL[IV]) + .inputItems(lens, Diamond, 2) + .inputItems(SENSOR_IV, 2) + .inputItems(ELECTRIC_PUMP_IV, 2) + .inputItems(cableGtDouble, Platinum, 4) + .circuitMeta(2) + .outputItems(LASER_OUTPUT_HATCH_1024[IV]) + .duration(600).EUt(VA[IV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("luv_1024a_laser_source_hatch") - .inputItems(HULL[LuV]) - .inputItems(lens, Diamond, 2) - .inputItems(SENSOR_LuV, 2) - .inputItems(ELECTRIC_PUMP_LuV, 2) - .inputItems(cableGtDouble, NiobiumTitanium, 4) - .circuitMeta(2) - .outputItems(LASER_OUTPUT_HATCH_1024[LuV]) - .duration(600).EUt(VA[LuV]).save(provider); + .inputItems(HULL[LuV]) + .inputItems(lens, Diamond, 2) + .inputItems(SENSOR_LuV, 2) + .inputItems(ELECTRIC_PUMP_LuV, 2) + .inputItems(cableGtDouble, NiobiumTitanium, 4) + .circuitMeta(2) + .outputItems(LASER_OUTPUT_HATCH_1024[LuV]) + .duration(600).EUt(VA[LuV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("zpm_1024a_laser_source_hatch") - .inputItems(HULL[ZPM]) - .inputItems(lens, Diamond, 2) - .inputItems(SENSOR_ZPM, 2) - .inputItems(ELECTRIC_PUMP_ZPM, 2) - .inputItems(cableGtDouble, VanadiumGallium, 4) - .circuitMeta(2) - .outputItems(LASER_OUTPUT_HATCH_1024[ZPM]) - .duration(600).EUt(VA[ZPM]).save(provider); + .inputItems(HULL[ZPM]) + .inputItems(lens, Diamond, 2) + .inputItems(SENSOR_ZPM, 2) + .inputItems(ELECTRIC_PUMP_ZPM, 2) + .inputItems(cableGtDouble, VanadiumGallium, 4) + .circuitMeta(2) + .outputItems(LASER_OUTPUT_HATCH_1024[ZPM]) + .duration(600).EUt(VA[ZPM]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("uv_1024a_laser_source_hatch") - .inputItems(HULL[UV]) - .inputItems(lens, Diamond, 2) - .inputItems(SENSOR_UV, 2) - .inputItems(ELECTRIC_PUMP_UV, 2) - .inputItems(cableGtDouble, YttriumBariumCuprate, 4) - .circuitMeta(2) - .outputItems(LASER_OUTPUT_HATCH_1024[UV]) - .duration(600).EUt(VA[UV]).save(provider); + .inputItems(HULL[UV]) + .inputItems(lens, Diamond, 2) + .inputItems(SENSOR_UV, 2) + .inputItems(ELECTRIC_PUMP_UV, 2) + .inputItems(cableGtDouble, YttriumBariumCuprate, 4) + .circuitMeta(2) + .outputItems(LASER_OUTPUT_HATCH_1024[UV]) + .duration(600).EUt(VA[UV]).save(provider); // 4096A Laser Target Hatches ASSEMBLER_RECIPES.recipeBuilder("iv_4096a_laser_target_hatch") - .inputItems(HULL[IV]) - .inputItems(lens, Diamond, 4) - .inputItems(EMITTER_IV, 4) - .inputItems(ELECTRIC_PUMP_IV, 4) - .inputItems(cableGtQuadruple, Platinum, 4) - .circuitMeta(3) - .outputItems(LASER_INPUT_HATCH_4096[IV]) - .duration(1200).EUt(VA[IV]).save(provider); + .inputItems(HULL[IV]) + .inputItems(lens, Diamond, 4) + .inputItems(EMITTER_IV, 4) + .inputItems(ELECTRIC_PUMP_IV, 4) + .inputItems(cableGtQuadruple, Platinum, 4) + .circuitMeta(3) + .outputItems(LASER_INPUT_HATCH_4096[IV]) + .duration(1200).EUt(VA[IV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("luv_4096a_laser_target_hatch") - .inputItems(HULL[LuV]) - .inputItems(lens, Diamond, 4) - .inputItems(EMITTER_LuV, 4) - .inputItems(ELECTRIC_PUMP_LuV, 4) - .inputItems(cableGtQuadruple, NiobiumTitanium, 4) - .circuitMeta(3) - .outputItems(LASER_INPUT_HATCH_4096[LuV]) - .duration(1200).EUt(VA[LuV]).save(provider); + .inputItems(HULL[LuV]) + .inputItems(lens, Diamond, 4) + .inputItems(EMITTER_LuV, 4) + .inputItems(ELECTRIC_PUMP_LuV, 4) + .inputItems(cableGtQuadruple, NiobiumTitanium, 4) + .circuitMeta(3) + .outputItems(LASER_INPUT_HATCH_4096[LuV]) + .duration(1200).EUt(VA[LuV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("zpm_4096a_laser_target_hatch") - .inputItems(HULL[ZPM]) - .inputItems(lens, Diamond, 4) - .inputItems(EMITTER_ZPM, 4) - .inputItems(ELECTRIC_PUMP_ZPM, 4) - .inputItems(cableGtQuadruple, VanadiumGallium, 4) - .circuitMeta(3) - .outputItems(LASER_INPUT_HATCH_4096[ZPM]) - .duration(1200).EUt(VA[ZPM]).save(provider); + .inputItems(HULL[ZPM]) + .inputItems(lens, Diamond, 4) + .inputItems(EMITTER_ZPM, 4) + .inputItems(ELECTRIC_PUMP_ZPM, 4) + .inputItems(cableGtQuadruple, VanadiumGallium, 4) + .circuitMeta(3) + .outputItems(LASER_INPUT_HATCH_4096[ZPM]) + .duration(1200).EUt(VA[ZPM]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("uv_4096a_laser_target_hatch") - .inputItems(HULL[UV]) - .inputItems(lens, Diamond, 4) - .inputItems(EMITTER_UV, 4) - .inputItems(ELECTRIC_PUMP_UV, 4) - .inputItems(cableGtQuadruple, YttriumBariumCuprate, 4) - .circuitMeta(3) - .outputItems(LASER_INPUT_HATCH_4096[UV]) - .duration(1200).EUt(VA[UV]).save(provider); + .inputItems(HULL[UV]) + .inputItems(lens, Diamond, 4) + .inputItems(EMITTER_UV, 4) + .inputItems(ELECTRIC_PUMP_UV, 4) + .inputItems(cableGtQuadruple, YttriumBariumCuprate, 4) + .circuitMeta(3) + .outputItems(LASER_INPUT_HATCH_4096[UV]) + .duration(1200).EUt(VA[UV]).save(provider); // 4096A Laser Source Hatches ASSEMBLER_RECIPES.recipeBuilder("iv_4096a_laser_source_hatch") - .inputItems(HULL[IV]) - .inputItems(lens, Diamond, 4) - .inputItems(SENSOR_IV, 4) - .inputItems(ELECTRIC_PUMP_IV, 4) - .inputItems(cableGtQuadruple, Platinum, 4) - .circuitMeta(3) - .outputItems(LASER_OUTPUT_HATCH_4096[IV]) - .duration(1200).EUt(VA[IV]).save(provider); + .inputItems(HULL[IV]) + .inputItems(lens, Diamond, 4) + .inputItems(SENSOR_IV, 4) + .inputItems(ELECTRIC_PUMP_IV, 4) + .inputItems(cableGtQuadruple, Platinum, 4) + .circuitMeta(3) + .outputItems(LASER_OUTPUT_HATCH_4096[IV]) + .duration(1200).EUt(VA[IV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("luv_4096a_laser_source_hatch") - .inputItems(HULL[LuV]) - .inputItems(lens, Diamond, 4) - .inputItems(SENSOR_LuV, 4) - .inputItems(ELECTRIC_PUMP_LuV, 4) - .inputItems(cableGtQuadruple, NiobiumTitanium, 4) - .circuitMeta(3) - .outputItems(LASER_OUTPUT_HATCH_4096[LuV]) - .duration(1200).EUt(VA[LuV]).save(provider); + .inputItems(HULL[LuV]) + .inputItems(lens, Diamond, 4) + .inputItems(SENSOR_LuV, 4) + .inputItems(ELECTRIC_PUMP_LuV, 4) + .inputItems(cableGtQuadruple, NiobiumTitanium, 4) + .circuitMeta(3) + .outputItems(LASER_OUTPUT_HATCH_4096[LuV]) + .duration(1200).EUt(VA[LuV]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("zpm_4096a_laser_source_hatch") - .inputItems(HULL[ZPM]) - .inputItems(lens, Diamond, 4) - .inputItems(SENSOR_ZPM, 4) - .inputItems(ELECTRIC_PUMP_ZPM, 4) - .inputItems(cableGtQuadruple, VanadiumGallium, 4) - .circuitMeta(3) - .outputItems(LASER_OUTPUT_HATCH_4096[ZPM]) - .duration(1200).EUt(VA[ZPM]).save(provider); + .inputItems(HULL[ZPM]) + .inputItems(lens, Diamond, 4) + .inputItems(SENSOR_ZPM, 4) + .inputItems(ELECTRIC_PUMP_ZPM, 4) + .inputItems(cableGtQuadruple, VanadiumGallium, 4) + .circuitMeta(3) + .outputItems(LASER_OUTPUT_HATCH_4096[ZPM]) + .duration(1200).EUt(VA[ZPM]).save(provider); ASSEMBLER_RECIPES.recipeBuilder("uv_4096a_laser_source_hatch") - .inputItems(HULL[UV]) - .inputItems(lens, Diamond, 4) - .inputItems(SENSOR_UV, 4) - .inputItems(ELECTRIC_PUMP_UV, 4) - .inputItems(cableGtQuadruple, YttriumBariumCuprate, 4) - .circuitMeta(3) - .outputItems(LASER_OUTPUT_HATCH_4096[UV]) - .duration(1200).EUt(VA[UV]).save(provider); + .inputItems(HULL[UV]) + .inputItems(lens, Diamond, 4) + .inputItems(SENSOR_UV, 4) + .inputItems(ELECTRIC_PUMP_UV, 4) + .inputItems(cableGtQuadruple, YttriumBariumCuprate, 4) + .circuitMeta(3) + .outputItems(LASER_OUTPUT_HATCH_4096[UV]) + .duration(1200).EUt(VA[UV]).save(provider); } } diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MiscRecipeLoader.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MiscRecipeLoader.java index 93be6536c9..38531d1050 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MiscRecipeLoader.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MiscRecipeLoader.java @@ -7,13 +7,15 @@ import com.gregtechceu.gtceu.data.recipe.CustomTags; import com.gregtechceu.gtceu.data.recipe.VanillaRecipeHelper; import com.gregtechceu.gtceu.data.recipe.builder.GTRecipeBuilder; -import com.tterrag.registrate.util.entry.ItemEntry; + import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.block.Blocks; +import com.tterrag.registrate.util.entry.ItemEntry; + import java.util.function.Consumer; import static com.gregtechceu.gtceu.api.GTValues.*; @@ -25,11 +27,11 @@ public class MiscRecipeLoader { public static void init(Consumer provider) { - // Basic Terminal Recipe VanillaRecipeHelper.addShapedRecipe(provider, true, "basic_terminal", TERMINAL.asStack(), - "SGS", "PBP", "PWP", 'S', new UnificationEntry(screw, WroughtIron), 'G', CustomTags.GLASS_PANES, 'B', new ItemStack(Items.BOOK), - 'P', new UnificationEntry(plate, WroughtIron), 'W', new UnificationEntry(wireGtSingle, RedAlloy)); + "SGS", "PBP", "PWP", 'S', new UnificationEntry(screw, WroughtIron), 'G', CustomTags.GLASS_PANES, 'B', + new ItemStack(Items.BOOK), + 'P', new UnificationEntry(plate, WroughtIron), 'W', new UnificationEntry(wireGtSingle, RedAlloy)); // Potin Recipe VanillaRecipeHelper.addShapelessRecipe(provider, "potin_dust", ChemicalHelper.get(dust, Potin, 8), @@ -68,13 +70,13 @@ public static void init(Consumer provider) { .save(provider); // TODO Matchbox - //PACKER_RECIPES.recipeBuilder() - // .inputItems(TOOL_MATCHES, 16) - // .inputItems(plate, Paper) - // .outputItems(TOOL_MATCHBOX) - // .duration(64) - // .EUt(16) - // .save(provider); + // PACKER_RECIPES.recipeBuilder() + // .inputItems(TOOL_MATCHES, 16) + // .inputItems(plate, Paper) + // .outputItems(TOOL_MATCHBOX) + // .duration(64) + // .EUt(16) + // .save(provider); ROCK_BREAKER_RECIPES.recipeBuilder("cobblestone") .notConsumable(Blocks.COBBLESTONE.asItem()) @@ -148,7 +150,6 @@ public static void init(Consumer provider) { .addData("fluidB", "minecraft:water") .save(provider); - ROCK_BREAKER_RECIPES.recipeBuilder("deepslate") .notConsumable(Blocks.DEEPSLATE.asItem()) .outputItems(Blocks.DEEPSLATE.asItem()) @@ -157,7 +158,7 @@ public static void init(Consumer provider) { .addData("fluidA", "minecraft:lava") .addData("fluidB", "minecraft:water") .save(provider); - + ROCK_BREAKER_RECIPES.recipeBuilder("marble") .notConsumable(rock, Marble) .outputItems(rock, Marble) @@ -279,22 +280,22 @@ public static void init(Consumer provider) { // TODO Central monitor /* - ASSEMBLER_RECIPES.recipeBuilder("monitor_screen").duration(80).EUt(VA[HV]) - .inputItems(COVER_SCREEN) - .inputItems((ItemStack) CraftingComponent.HULL.getIngredient(1)) - .inputItems(wireFine, AnnealedCopper, 8) - .inputFluids(Polyethylene.getFluid(L)) - .outputItems(GTMachines.MONITOR_SCREEN) - .save(provider); - - ASSEMBLER_RECIPES.recipeBuilder("central_monitor").duration(100).EUt(VA[HV]) - .inputItems(COVER_SCREEN) - .inputItems((ItemStack) CraftingComponent.HULL.getIngredient(3)) - .inputItems(circuit, Tier.HV, 2) - .inputFluids(Polyethylene.getFluid(L)) - .outputItems(GTMachines.CENTRAL_MONITOR) - .save(provider); - */ + * ASSEMBLER_RECIPES.recipeBuilder("monitor_screen").duration(80).EUt(VA[HV]) + * .inputItems(COVER_SCREEN) + * .inputItems((ItemStack) CraftingComponent.HULL.getIngredient(1)) + * .inputItems(wireFine, AnnealedCopper, 8) + * .inputFluids(Polyethylene.getFluid(L)) + * .outputItems(GTMachines.MONITOR_SCREEN) + * .save(provider); + * + * ASSEMBLER_RECIPES.recipeBuilder("central_monitor").duration(100).EUt(VA[HV]) + * .inputItems(COVER_SCREEN) + * .inputItems((ItemStack) CraftingComponent.HULL.getIngredient(3)) + * .inputItems(circuit, Tier.HV, 2) + * .inputFluids(Polyethylene.getFluid(L)) + * .outputItems(GTMachines.CENTRAL_MONITOR) + * .save(provider); + */ ASSEMBLER_RECIPES.recipeBuilder("cover_digital_interface").duration(100).EUt(VA[HV]) .inputItems(COVER_SCREEN) @@ -307,66 +308,66 @@ public static void init(Consumer provider) { // todo digital interface cover /* - ASSEMBLER_RECIPES.recipeBuilder("cover_wireless_digital_interface").duration(100).EUt(VA[HV]) - .inputItems(COVER_DIGITAL_INTERFACE) - .inputItems(WIRELESS) - .inputFluids(Polyethylene.getFluid(L)) - .outputItems(COVER_DIGITAL_INTERFACE_WIRELESS) - .save(provider); - - ASSEMBLER_RECIPES.recipeBuilder("plugin_text").duration(80).EUt(400) - .inputItems(COVER_SCREEN) - .inputItems(circuit, Tier.LV) - .inputItems(wireFine, Copper, 2) - .inputFluids(Polyethylene.getFluid(L)) - .outputItems(PLUGIN_TEXT) - .save(provider); - - ASSEMBLER_RECIPES.recipeBuilder("plugin_online_pic").duration(80).EUt(400) - .inputItems(COVER_SCREEN) - .inputItems(circuit, Tier.LV) - .inputItems(wireFine, Silver, 2) - .inputFluids(Polyethylene.getFluid(L)) - .outputItems(PLUGIN_ONLINE_PIC) - .save(provider); - - ASSEMBLER_RECIPES.recipeBuilder("plugin_fake_gui").duration(80).EUt(400) - .inputItems(COVER_SCREEN) - .inputItems(circuit, Tier.LV) - .inputItems(wireFine, Gold, 2) - .inputFluids(Polyethylene.getFluid(L)) - .outputItems(PLUGIN_FAKE_GUI) - .save(provider); - - ASSEMBLER_RECIPES.recipeBuilder("plugin_advanced_monitor").duration(80).EUt(400) - .inputItems(COVER_SCREEN) - .inputItems(circuit, Tier.HV) - .inputItems(wireFine, Aluminium, 2) - .inputFluids(Polyethylene.getFluid(L)) - .outputItems(PLUGIN_ADVANCED_MONITOR) - .save(provider); + * ASSEMBLER_RECIPES.recipeBuilder("cover_wireless_digital_interface").duration(100).EUt(VA[HV]) + * .inputItems(COVER_DIGITAL_INTERFACE) + * .inputItems(WIRELESS) + * .inputFluids(Polyethylene.getFluid(L)) + * .outputItems(COVER_DIGITAL_INTERFACE_WIRELESS) + * .save(provider); + * + * ASSEMBLER_RECIPES.recipeBuilder("plugin_text").duration(80).EUt(400) + * .inputItems(COVER_SCREEN) + * .inputItems(circuit, Tier.LV) + * .inputItems(wireFine, Copper, 2) + * .inputFluids(Polyethylene.getFluid(L)) + * .outputItems(PLUGIN_TEXT) + * .save(provider); + * + * ASSEMBLER_RECIPES.recipeBuilder("plugin_online_pic").duration(80).EUt(400) + * .inputItems(COVER_SCREEN) + * .inputItems(circuit, Tier.LV) + * .inputItems(wireFine, Silver, 2) + * .inputFluids(Polyethylene.getFluid(L)) + * .outputItems(PLUGIN_ONLINE_PIC) + * .save(provider); + * + * ASSEMBLER_RECIPES.recipeBuilder("plugin_fake_gui").duration(80).EUt(400) + * .inputItems(COVER_SCREEN) + * .inputItems(circuit, Tier.LV) + * .inputItems(wireFine, Gold, 2) + * .inputFluids(Polyethylene.getFluid(L)) + * .outputItems(PLUGIN_FAKE_GUI) + * .save(provider); + * + * ASSEMBLER_RECIPES.recipeBuilder("plugin_advanced_monitor").duration(80).EUt(400) + * .inputItems(COVER_SCREEN) + * .inputItems(circuit, Tier.HV) + * .inputItems(wireFine, Aluminium, 2) + * .inputFluids(Polyethylene.getFluid(L)) + * .outputItems(PLUGIN_ADVANCED_MONITOR) + * .save(provider); */ // todo terminal /* - ASSEMBLER_RECIPES.recipeBuilder("wireless_upgrade").duration(100).EUt(VA[MV]) - .inputItems(circuit, Tier.MV, 4) - .inputItems(EMITTER_MV, 2) - .inputItems(SENSOR_MV, 2) - .inputItems(plate, StainlessSteel) - .inputFluids(Polyethylene.getFluid(L)) - .outputItems(WIRELESS) - .save(provider); - - ASSEMBLER_RECIPES.recipeBuilder("camera_upgrade").duration(100).EUt(VA[LV]) - .inputItems(ELECTRIC_PISTON_LV, 2) - .inputItems(EMITTER_LV) - .inputItems(lens, Glass) - .inputItems(lens, Diamond) - .inputItems(circuit, Tier.LV, 4) - .inputFluids(SolderingAlloy.getFluid(L)) - .outputItems(CAMERA) - .save(provider); + * ASSEMBLER_RECIPES.recipeBuilder("wireless_upgrade").duration(100).EUt(VA[MV]) + * .inputItems(circuit, Tier.MV, 4) + * .inputItems(EMITTER_MV, 2) + * .inputItems(SENSOR_MV, 2) + * .inputItems(plate, StainlessSteel) + * .inputFluids(Polyethylene.getFluid(L)) + * .outputItems(WIRELESS) + * .save(provider); + * + * ASSEMBLER_RECIPES.recipeBuilder("camera_upgrade").duration(100).EUt(VA[LV]) + * .inputItems(ELECTRIC_PISTON_LV, 2) + * .inputItems(EMITTER_LV) + * .inputItems(lens, Glass) + * .inputItems(lens, Diamond) + * .inputItems(circuit, Tier.LV, 4) + * .inputFluids(SolderingAlloy.getFluid(L)) + * .outputItems(CAMERA) + * .save(provider); */ // Tempered Glass in Arc Furnace @@ -402,25 +403,42 @@ public static void init(Consumer provider) { .duration(40).EUt(6).save(provider); // Dyed Lens Recipes - GTRecipeBuilder builder = CHEMICAL_BATH_RECIPES.recipeBuilder("").EUt(VA[HV]).duration(200).inputItems(lens, Glass); + GTRecipeBuilder builder = CHEMICAL_BATH_RECIPES.recipeBuilder("").EUt(VA[HV]).duration(200).inputItems(lens, + Glass); final int dyeAmount = 288; - builder.copy("colorless_lens") .inputFluids(DyeWhite.getFluid(dyeAmount)) .outputItems(lens, Glass) .save(provider); - builder.copy("orange_lens") .inputFluids(DyeOrange.getFluid(dyeAmount)) .outputItems(GLASS_LENSES.get(Color.Orange)) .save(provider); - builder.copy("magenta_lens") .inputFluids(DyeMagenta.getFluid(dyeAmount)) .outputItems(GLASS_LENSES.get(Color.Magenta)) .save(provider); - builder.copy("light_blue_lens").inputFluids(DyeLightBlue.getFluid(dyeAmount)).outputItems(GLASS_LENSES.get(Color.LightBlue)).save(provider); - builder.copy("yellow_lens") .inputFluids(DyeYellow.getFluid(dyeAmount)) .outputItems(GLASS_LENSES.get(Color.Yellow)) .save(provider); - builder.copy("lime_lens") .inputFluids(DyeLime.getFluid(dyeAmount)) .outputItems(GLASS_LENSES.get(Color.Lime)) .save(provider); - builder.copy("pink_lens") .inputFluids(DyePink.getFluid(dyeAmount)) .outputItems(GLASS_LENSES.get(Color.Pink)) .save(provider); - builder.copy("gray_lens") .inputFluids(DyeGray.getFluid(dyeAmount)) .outputItems(GLASS_LENSES.get(Color.Gray)) .save(provider); - builder.copy("light_gray_lens").inputFluids(DyeLightGray.getFluid(dyeAmount)).outputItems(GLASS_LENSES.get(Color.LightGray)).save(provider); - builder.copy("cyan_lens") .inputFluids(DyeCyan.getFluid(dyeAmount)) .outputItems(GLASS_LENSES.get(Color.Cyan)) .save(provider); - builder.copy("purple_lens") .inputFluids(DyePurple.getFluid(dyeAmount)) .outputItems(GLASS_LENSES.get(Color.Purple)) .save(provider); - builder.copy("blue_lens") .inputFluids(DyeBlue.getFluid(dyeAmount)) .outputItems(GLASS_LENSES.get(Color.Blue)) .save(provider); - builder.copy("brown_lens") .inputFluids(DyeBrown.getFluid(dyeAmount)) .outputItems(GLASS_LENSES.get(Color.Brown)) .save(provider); - builder.copy("green_lens") .inputFluids(DyeGreen.getFluid(dyeAmount)) .outputItems(GLASS_LENSES.get(Color.Green)) .save(provider); - builder.copy("red_lens") .inputFluids(DyeRed.getFluid(dyeAmount)) .outputItems(GLASS_LENSES.get(Color.Red)) .save(provider); - builder.copy("black_lens") .inputFluids(DyeBlack.getFluid(dyeAmount)) .outputItems(GLASS_LENSES.get(Color.Black)) .save(provider); + builder.copy("colorless_lens").inputFluids(DyeWhite.getFluid(dyeAmount)).outputItems(lens, Glass) + .save(provider); + builder.copy("orange_lens").inputFluids(DyeOrange.getFluid(dyeAmount)) + .outputItems(GLASS_LENSES.get(Color.Orange)).save(provider); + builder.copy("magenta_lens").inputFluids(DyeMagenta.getFluid(dyeAmount)) + .outputItems(GLASS_LENSES.get(Color.Magenta)).save(provider); + builder.copy("light_blue_lens").inputFluids(DyeLightBlue.getFluid(dyeAmount)) + .outputItems(GLASS_LENSES.get(Color.LightBlue)).save(provider); + builder.copy("yellow_lens").inputFluids(DyeYellow.getFluid(dyeAmount)) + .outputItems(GLASS_LENSES.get(Color.Yellow)).save(provider); + builder.copy("lime_lens").inputFluids(DyeLime.getFluid(dyeAmount)).outputItems(GLASS_LENSES.get(Color.Lime)) + .save(provider); + builder.copy("pink_lens").inputFluids(DyePink.getFluid(dyeAmount)).outputItems(GLASS_LENSES.get(Color.Pink)) + .save(provider); + builder.copy("gray_lens").inputFluids(DyeGray.getFluid(dyeAmount)).outputItems(GLASS_LENSES.get(Color.Gray)) + .save(provider); + builder.copy("light_gray_lens").inputFluids(DyeLightGray.getFluid(dyeAmount)) + .outputItems(GLASS_LENSES.get(Color.LightGray)).save(provider); + builder.copy("cyan_lens").inputFluids(DyeCyan.getFluid(dyeAmount)).outputItems(GLASS_LENSES.get(Color.Cyan)) + .save(provider); + builder.copy("purple_lens").inputFluids(DyePurple.getFluid(dyeAmount)) + .outputItems(GLASS_LENSES.get(Color.Purple)).save(provider); + builder.copy("blue_lens").inputFluids(DyeBlue.getFluid(dyeAmount)).outputItems(GLASS_LENSES.get(Color.Blue)) + .save(provider); + builder.copy("brown_lens").inputFluids(DyeBrown.getFluid(dyeAmount)).outputItems(GLASS_LENSES.get(Color.Brown)) + .save(provider); + builder.copy("green_lens").inputFluids(DyeGreen.getFluid(dyeAmount)).outputItems(GLASS_LENSES.get(Color.Green)) + .save(provider); + builder.copy("red_lens").inputFluids(DyeRed.getFluid(dyeAmount)).outputItems(GLASS_LENSES.get(Color.Red)) + .save(provider); + builder.copy("black_lens").inputFluids(DyeBlack.getFluid(dyeAmount)).outputItems(GLASS_LENSES.get(Color.Black)) + .save(provider); // NAN Certificate EXTRUDER_RECIPES.recipeBuilder("nan_certificate") @@ -438,26 +456,48 @@ public static void init(Consumer provider) { .outputItems(FERTILIZER, 4) .duration(100).EUt(VA[LV]).save(provider); - CHEMICAL_RECIPES.recipeBuilder("fertilizer_c_s") .inputItems(dust, Calcite) .inputItems(dust, Sulfur) .inputFluids(Water.getFluid(1000)).outputItems(FERTILIZER, 2).duration(200).EUt(VA[LV]).save(provider); - CHEMICAL_RECIPES.recipeBuilder("fertilizer_c_t") .inputItems(dust, Calcite) .inputItems(dust, TricalciumPhosphate).inputFluids(Water.getFluid(1000)).outputItems(FERTILIZER, 3).duration(300).EUt(VA[LV]).save(provider); - CHEMICAL_RECIPES.recipeBuilder("fertilizer_c_p") .inputItems(dust, Calcite) .inputItems(dust, Phosphate) .inputFluids(Water.getFluid(1000)).outputItems(FERTILIZER, 2).duration(200).EUt(VA[LV]).save(provider); - CHEMICAL_RECIPES.recipeBuilder("fertilizer_c_a") .inputItems(dust, Calcite) .inputItems(dust, Ash, 3) .inputFluids(Water.getFluid(1000)).outputItems(FERTILIZER, 1).duration(100).EUt(VA[LV]).save(provider); - CHEMICAL_RECIPES.recipeBuilder("fertilizer_c_d") .inputItems(dust, Calcite) .inputItems(dust, DarkAsh) .inputFluids(Water.getFluid(1000)).outputItems(FERTILIZER, 1).duration(100).EUt(VA[LV]).save(provider); - CHEMICAL_RECIPES.recipeBuilder("fertilizer_ca_s").inputItems(dust, Calcium) .inputItems(dust, Sulfur) .inputFluids(Water.getFluid(1000)).outputItems(FERTILIZER, 3).duration(300).EUt(VA[LV]).save(provider); - CHEMICAL_RECIPES.recipeBuilder("fertilizer_ca_t").inputItems(dust, Calcium) .inputItems(dust, TricalciumPhosphate).inputFluids(Water.getFluid(1000)).outputItems(FERTILIZER, 4).duration(400).EUt(VA[LV]).save(provider); - CHEMICAL_RECIPES.recipeBuilder("fertilizer_ca_p").inputItems(dust, Calcium) .inputItems(dust, Phosphate) .inputFluids(Water.getFluid(1000)).outputItems(FERTILIZER, 3).duration(300).EUt(VA[LV]).save(provider); - CHEMICAL_RECIPES.recipeBuilder("fertilizer_ca_a").inputItems(dust, Calcium) .inputItems(dust, Ash, 3) .inputFluids(Water.getFluid(1000)).outputItems(FERTILIZER, 2).duration(200).EUt(VA[LV]).save(provider); - CHEMICAL_RECIPES.recipeBuilder("fertilizer_ca_d").inputItems(dust, Calcium) .inputItems(dust, DarkAsh) .inputFluids(Water.getFluid(1000)).outputItems(FERTILIZER, 2).duration(200).EUt(VA[LV]).save(provider); - CHEMICAL_RECIPES.recipeBuilder("fertilizer_a_s") .inputItems(dust, Apatite) .inputItems(dust, Sulfur) .inputFluids(Water.getFluid(1000)).outputItems(FERTILIZER, 3).duration(300).EUt(VA[LV]).save(provider); - CHEMICAL_RECIPES.recipeBuilder("fertilizer_a_t") .inputItems(dust, Apatite) .inputItems(dust, TricalciumPhosphate).inputFluids(Water.getFluid(1000)).outputItems(FERTILIZER, 4).duration(400).EUt(VA[LV]).save(provider); - CHEMICAL_RECIPES.recipeBuilder("fertilizer_a_p") .inputItems(dust, Apatite) .inputItems(dust, Phosphate) .inputFluids(Water.getFluid(1000)).outputItems(FERTILIZER, 3).duration(300).EUt(VA[LV]).save(provider); - CHEMICAL_RECIPES.recipeBuilder("fertilizer_a_a") .inputItems(dust, Apatite) .inputItems(dust, Ash, 3) .inputFluids(Water.getFluid(1000)).outputItems(FERTILIZER, 2).duration(200).EUt(VA[LV]).save(provider); - CHEMICAL_RECIPES.recipeBuilder("fertilizer_a_d") .inputItems(dust, Apatite) .inputItems(dust, DarkAsh) .inputFluids(Water.getFluid(1000)).outputItems(FERTILIZER, 2).duration(200).EUt(VA[LV]).save(provider); - CHEMICAL_RECIPES.recipeBuilder("fertilizer_g_s") .inputItems(dust, GlauconiteSand).inputItems(dust, Sulfur) .inputFluids(Water.getFluid(1000)).outputItems(FERTILIZER, 3).duration(300).EUt(VA[LV]).save(provider); - CHEMICAL_RECIPES.recipeBuilder("fertilizer_g_t") .inputItems(dust, GlauconiteSand).inputItems(dust, TricalciumPhosphate).inputFluids(Water.getFluid(1000)).outputItems(FERTILIZER, 4).duration(400).EUt(VA[LV]).save(provider); - CHEMICAL_RECIPES.recipeBuilder("fertilizer_g_p") .inputItems(dust, GlauconiteSand).inputItems(dust, Phosphate) .inputFluids(Water.getFluid(1000)).outputItems(FERTILIZER, 3).duration(300).EUt(VA[LV]).save(provider); - CHEMICAL_RECIPES.recipeBuilder("fertilizer_g_a") .inputItems(dust, GlauconiteSand).inputItems(dust, Ash, 3) .inputFluids(Water.getFluid(1000)).outputItems(FERTILIZER, 2).duration(200).EUt(VA[LV]).save(provider); - CHEMICAL_RECIPES.recipeBuilder("fertilizer_g_d") .inputItems(dust, GlauconiteSand).inputItems(dust, DarkAsh) .inputFluids(Water.getFluid(1000)).outputItems(FERTILIZER, 2).duration(200).EUt(VA[LV]).save(provider); + CHEMICAL_RECIPES.recipeBuilder("fertilizer_c_s").inputItems(dust, Calcite).inputItems(dust, Sulfur) + .inputFluids(Water.getFluid(1000)).outputItems(FERTILIZER, 2).duration(200).EUt(VA[LV]).save(provider); + CHEMICAL_RECIPES.recipeBuilder("fertilizer_c_t").inputItems(dust, Calcite).inputItems(dust, TricalciumPhosphate) + .inputFluids(Water.getFluid(1000)).outputItems(FERTILIZER, 3).duration(300).EUt(VA[LV]).save(provider); + CHEMICAL_RECIPES.recipeBuilder("fertilizer_c_p").inputItems(dust, Calcite).inputItems(dust, Phosphate) + .inputFluids(Water.getFluid(1000)).outputItems(FERTILIZER, 2).duration(200).EUt(VA[LV]).save(provider); + CHEMICAL_RECIPES.recipeBuilder("fertilizer_c_a").inputItems(dust, Calcite).inputItems(dust, Ash, 3) + .inputFluids(Water.getFluid(1000)).outputItems(FERTILIZER, 1).duration(100).EUt(VA[LV]).save(provider); + CHEMICAL_RECIPES.recipeBuilder("fertilizer_c_d").inputItems(dust, Calcite).inputItems(dust, DarkAsh) + .inputFluids(Water.getFluid(1000)).outputItems(FERTILIZER, 1).duration(100).EUt(VA[LV]).save(provider); + CHEMICAL_RECIPES.recipeBuilder("fertilizer_ca_s").inputItems(dust, Calcium).inputItems(dust, Sulfur) + .inputFluids(Water.getFluid(1000)).outputItems(FERTILIZER, 3).duration(300).EUt(VA[LV]).save(provider); + CHEMICAL_RECIPES.recipeBuilder("fertilizer_ca_t").inputItems(dust, Calcium) + .inputItems(dust, TricalciumPhosphate).inputFluids(Water.getFluid(1000)).outputItems(FERTILIZER, 4) + .duration(400).EUt(VA[LV]).save(provider); + CHEMICAL_RECIPES.recipeBuilder("fertilizer_ca_p").inputItems(dust, Calcium).inputItems(dust, Phosphate) + .inputFluids(Water.getFluid(1000)).outputItems(FERTILIZER, 3).duration(300).EUt(VA[LV]).save(provider); + CHEMICAL_RECIPES.recipeBuilder("fertilizer_ca_a").inputItems(dust, Calcium).inputItems(dust, Ash, 3) + .inputFluids(Water.getFluid(1000)).outputItems(FERTILIZER, 2).duration(200).EUt(VA[LV]).save(provider); + CHEMICAL_RECIPES.recipeBuilder("fertilizer_ca_d").inputItems(dust, Calcium).inputItems(dust, DarkAsh) + .inputFluids(Water.getFluid(1000)).outputItems(FERTILIZER, 2).duration(200).EUt(VA[LV]).save(provider); + CHEMICAL_RECIPES.recipeBuilder("fertilizer_a_s").inputItems(dust, Apatite).inputItems(dust, Sulfur) + .inputFluids(Water.getFluid(1000)).outputItems(FERTILIZER, 3).duration(300).EUt(VA[LV]).save(provider); + CHEMICAL_RECIPES.recipeBuilder("fertilizer_a_t").inputItems(dust, Apatite).inputItems(dust, TricalciumPhosphate) + .inputFluids(Water.getFluid(1000)).outputItems(FERTILIZER, 4).duration(400).EUt(VA[LV]).save(provider); + CHEMICAL_RECIPES.recipeBuilder("fertilizer_a_p").inputItems(dust, Apatite).inputItems(dust, Phosphate) + .inputFluids(Water.getFluid(1000)).outputItems(FERTILIZER, 3).duration(300).EUt(VA[LV]).save(provider); + CHEMICAL_RECIPES.recipeBuilder("fertilizer_a_a").inputItems(dust, Apatite).inputItems(dust, Ash, 3) + .inputFluids(Water.getFluid(1000)).outputItems(FERTILIZER, 2).duration(200).EUt(VA[LV]).save(provider); + CHEMICAL_RECIPES.recipeBuilder("fertilizer_a_d").inputItems(dust, Apatite).inputItems(dust, DarkAsh) + .inputFluids(Water.getFluid(1000)).outputItems(FERTILIZER, 2).duration(200).EUt(VA[LV]).save(provider); + CHEMICAL_RECIPES.recipeBuilder("fertilizer_g_s").inputItems(dust, GlauconiteSand).inputItems(dust, Sulfur) + .inputFluids(Water.getFluid(1000)).outputItems(FERTILIZER, 3).duration(300).EUt(VA[LV]).save(provider); + CHEMICAL_RECIPES.recipeBuilder("fertilizer_g_t").inputItems(dust, GlauconiteSand) + .inputItems(dust, TricalciumPhosphate).inputFluids(Water.getFluid(1000)).outputItems(FERTILIZER, 4) + .duration(400).EUt(VA[LV]).save(provider); + CHEMICAL_RECIPES.recipeBuilder("fertilizer_g_p").inputItems(dust, GlauconiteSand).inputItems(dust, Phosphate) + .inputFluids(Water.getFluid(1000)).outputItems(FERTILIZER, 3).duration(300).EUt(VA[LV]).save(provider); + CHEMICAL_RECIPES.recipeBuilder("fertilizer_g_a").inputItems(dust, GlauconiteSand).inputItems(dust, Ash, 3) + .inputFluids(Water.getFluid(1000)).outputItems(FERTILIZER, 2).duration(200).EUt(VA[LV]).save(provider); + CHEMICAL_RECIPES.recipeBuilder("fertilizer_g_d").inputItems(dust, GlauconiteSand).inputItems(dust, DarkAsh) + .inputFluids(Water.getFluid(1000)).outputItems(FERTILIZER, 2).duration(200).EUt(VA[LV]).save(provider); ELECTROLYZER_RECIPES.recipeBuilder("fertilizer_decomposition") .inputItems(FERTILIZER) @@ -491,18 +531,17 @@ public static void init(Consumer provider) { .duration(300).EUt(2) .save(provider); - // Minecart wheels ASSEMBLER_RECIPES.recipeBuilder("iron_minecart_wheels") - .inputItems(rod, Iron) - .inputItems(ring, Iron, 2) - .outputItems(IRON_MINECART_WHEELS) - .duration(100).EUt(20).save(provider); + .inputItems(rod, Iron) + .inputItems(ring, Iron, 2) + .outputItems(IRON_MINECART_WHEELS) + .duration(100).EUt(20).save(provider); ASSEMBLER_RECIPES.recipeBuilder("steel_minecart_wheels") - .inputItems(rod, Steel) - .inputItems(ring, Steel, 2) - .outputItems(STEEL_MINECART_WHEELS) - .duration(60).EUt(20).save(provider); + .inputItems(rod, Steel) + .inputItems(ring, Steel, 2) + .outputItems(STEEL_MINECART_WHEELS) + .duration(60).EUt(20).save(provider); } } diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/RecyclingRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/RecyclingRecipes.java index 7799f64176..d5f92a683c 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/RecyclingRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/RecyclingRecipes.java @@ -1,6 +1,5 @@ package com.gregtechceu.gtceu.data.recipe.misc; -import com.google.common.collect.ImmutableList; import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.capability.recipe.ItemRecipeCapability; import com.gregtechceu.gtceu.api.data.chemical.ChemicalHelper; @@ -15,6 +14,7 @@ import com.gregtechceu.gtceu.common.data.GTRecipeTypes; import com.gregtechceu.gtceu.data.recipe.builder.GTRecipeBuilder; import com.gregtechceu.gtceu.utils.GTUtil; + import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.resources.ResourceLocation; @@ -23,8 +23,10 @@ import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; +import com.google.common.collect.ImmutableList; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; + import java.util.*; import java.util.Map.Entry; import java.util.function.Consumer; @@ -51,8 +53,9 @@ public static void init(Consumer provider) { } } - public static void registerRecyclingRecipes(Consumer provider, ItemStack input, List components, boolean ignoreArcSmelting, @Nullable TagPrefix prefix) { - + public static void registerRecyclingRecipes(Consumer provider, ItemStack input, + List components, boolean ignoreArcSmelting, + @Nullable TagPrefix prefix) { // Gather the valid Materials for use in recycling recipes. // - Filter out Materials that cannot create a Dust // - Filter out Materials that do not equate to at least 1 Nugget worth of Material. @@ -86,26 +89,27 @@ public static void registerRecyclingRecipes(Consumer provider, I } // Skip Ingot -> Ingot Arc Recipes - if (ChemicalHelper.getPrefix(input.getItem()) == TagPrefix.ingot && m.getProperty(PropertyKey.INGOT).getArcSmeltingInto() == m) { + if (ChemicalHelper.getPrefix(input.getItem()) == TagPrefix.ingot && + m.getProperty(PropertyKey.INGOT).getArcSmeltingInto() == m) { return; } // Prevent Magnetic dust -> Regular Ingot Arc Furnacing, avoiding the EBF recipe // "I will rework magnetic materials soon" - DStrand1 - if(prefix == TagPrefix.dust && m.hasFlag(IS_MAGNETIC)) { + if (prefix == TagPrefix.dust && m.hasFlag(IS_MAGNETIC)) { return; } } registerArcRecycling(provider, input, components, prefix); } - private static void registerMaceratorRecycling(Consumer provider, ItemStack input, List materials, int multiplier) { + private static void registerMaceratorRecycling(Consumer provider, ItemStack input, + List materials, int multiplier) { // Finalize the output list. List outputs = finalizeOutputs( materials, GTRecipeTypes.MACERATOR_RECIPES.getMaxOutputs(ItemRecipeCapability.CAP), - ChemicalHelper::getDust - ); + ChemicalHelper::getDust); UnificationEntry entry = ChemicalHelper.getUnificationEntry(input.getItem()); TagKey inputTag = null; @@ -130,8 +134,9 @@ private static void registerMaceratorRecycling(Consumer provider builder.save(provider); } - private static void registerExtractorRecycling(Consumer provider, ItemStack input, List materials, int multiplier, @Nullable TagPrefix prefix) { - + private static void registerExtractorRecycling(Consumer provider, ItemStack input, + List materials, int multiplier, + @Nullable TagPrefix prefix) { UnificationEntry entry = ChemicalHelper.getUnificationEntry(input.getItem()); TagKey inputTag = null; if (entry != null) { @@ -173,14 +178,15 @@ private static void registerExtractorRecycling(Consumer provider // Find the first Material which can create a Fluid. // If no Material in the list can create a Fluid, return. MaterialStack fluidMs = materials.stream() - .filter(ms -> ms.material().hasProperty(PropertyKey.FLUID) && ms.material().getFluid() != null) - .findFirst().orElse(null); + .filter(ms -> ms.material().hasProperty(PropertyKey.FLUID) && ms.material().getFluid() != null) + .findFirst().orElse(null); if (fluidMs == null) return; // Find the next MaterialStack, which will be the Item output. // This can sometimes be before the Fluid output in the list, so we have to // assume it can be anywhere in the list. - MaterialStack itemMs = materials.stream().filter(ms -> !ms.material().equals(fluidMs.material())).findFirst().orElse(null); + MaterialStack itemMs = materials.stream().filter(ms -> !ms.material().equals(fluidMs.material())).findFirst() + .orElse(null); // Calculate the duration based off of those two possible outputs. // - Sum the two Material amounts together (if both exist) @@ -191,7 +197,8 @@ private static void registerExtractorRecycling(Consumer provider // Build the final Recipe. ResourceLocation itemPath = BuiltInRegistries.ITEM.getKey(input.getItem()); - GTRecipeBuilder extractorBuilder = GTRecipeTypes.EXTRACTOR_RECIPES.recipeBuilder("extract_" + itemPath.getPath()) + GTRecipeBuilder extractorBuilder = GTRecipeTypes.EXTRACTOR_RECIPES + .recipeBuilder("extract_" + itemPath.getPath()) .outputFluids(fluidMs.material().getFluid((int) (fluidMs.amount() * L / M))) .duration((int) duration) .EUt((long) GTValues.VA[GTValues.LV] * multiplier); @@ -207,14 +214,16 @@ private static void registerExtractorRecycling(Consumer provider if (itemMs != null) { ItemStack outputStack = ChemicalHelper.getIngotOrDust(itemMs); if (!outputStack.isEmpty()) extractorBuilder.outputItems(outputStack); - //TagPrefix outputPrefix = itemMs.material().hasProperty(PropertyKey.INGOT) ? TagPrefix.ingot : TagPrefix.dust; - //extractorBuilder.outputItems(outputPrefix, itemMs.material(), (int) (itemMs.amount() / M)); + // TagPrefix outputPrefix = itemMs.material().hasProperty(PropertyKey.INGOT) ? TagPrefix.ingot : + // TagPrefix.dust; + // extractorBuilder.outputItems(outputPrefix, itemMs.material(), (int) (itemMs.amount() / M)); } extractorBuilder.save(provider); } - private static void registerArcRecycling(Consumer provider, ItemStack input, List materials, @Nullable TagPrefix prefix) { + private static void registerArcRecycling(Consumer provider, ItemStack input, + List materials, @Nullable TagPrefix prefix) { UnificationEntry entry = ChemicalHelper.getUnificationEntry(input.getItem()); TagKey inputTag = null; if (entry != null) { @@ -227,7 +236,8 @@ private static void registerArcRecycling(Consumer provider, Item return; } else if (prefix == TagPrefix.block) { if (ms != null && !ms.material().hasProperty(PropertyKey.GEM)) { - ItemStack output = ChemicalHelper.get(TagPrefix.ingot, ms.material().getProperty(PropertyKey.INGOT).getArcSmeltingInto(), 9); + ItemStack output = ChemicalHelper.get(TagPrefix.ingot, + ms.material().getProperty(PropertyKey.INGOT).getArcSmeltingInto(), 9); ResourceLocation itemPath = BuiltInRegistries.ITEM.getKey(input.getItem()); GTRecipeBuilder builder = GTRecipeTypes.ARC_FURNACE_RECIPES.recipeBuilder("arc_" + itemPath.getPath()) .outputItems(output) @@ -255,8 +265,7 @@ private static void registerArcRecycling(Consumer provider, Item List outputs = finalizeOutputs( materials, GTRecipeTypes.ARC_FURNACE_RECIPES.getMaxOutputs(ItemRecipeCapability.CAP), - RecyclingRecipes::getArcIngotOrDust - ); + RecyclingRecipes::getArcIngotOrDust); // Exit if no valid outputs exist for this recycling Recipe. if (outputs.size() == 0) return; @@ -299,7 +308,7 @@ private static MaterialStack getArcSmeltingResult(MaterialStack materialStack) { return null; } - // Else if the Material is an Ingot, return the Arc Smelting + // Else if the Material is an Ingot, return the Arc Smelting // result if it exists, otherwise return the Material itself. if (material.hasProperty(PropertyKey.INGOT)) { Material arcSmelt = material.getProperty(PropertyKey.INGOT).getArcSmeltingInto(); @@ -338,7 +347,6 @@ private static MaterialStack getGemArcSmeltResult(MaterialStack materialStack) { } private static int calculateVoltageMultiplier(List materials) { - // Gather the highest blast temperature of any material in the list int highestTemp = 0; for (MaterialStack ms : materials) { @@ -348,13 +356,14 @@ private static int calculateVoltageMultiplier(List materials) { if (prop.getBlastTemperature() > highestTemp) { highestTemp = prop.getBlastTemperature(); } - } - else if(m.hasFlag(IS_MAGNETIC) && m.hasProperty(PropertyKey.INGOT) && m.getProperty(PropertyKey.INGOT).getSmeltingInto().hasProperty(PropertyKey.BLAST)) { - BlastProperty prop = m.getProperty(PropertyKey.INGOT).getSmeltingInto().getProperty(PropertyKey.BLAST); - if (prop.getBlastTemperature() > highestTemp) { - highestTemp = prop.getBlastTemperature(); - } - } + } else if (m.hasFlag(IS_MAGNETIC) && m.hasProperty(PropertyKey.INGOT) && + m.getProperty(PropertyKey.INGOT).getSmeltingInto().hasProperty(PropertyKey.BLAST)) { + BlastProperty prop = m.getProperty(PropertyKey.INGOT).getSmeltingInto() + .getProperty(PropertyKey.BLAST); + if (prop.getBlastTemperature() > highestTemp) { + highestTemp = prop.getBlastTemperature(); + } + } } // No blast temperature in the list means no multiplier @@ -385,7 +394,6 @@ private static int calculateDuration(List materials) { * Combines any matching Materials in the List into one MaterialStack */ private static List combineStacks(List rawList) { - // Combine any stacks in the List that have the same Item. Map materialStacksExploded = new HashMap<>(); for (MaterialStack ms : rawList) { @@ -397,8 +405,8 @@ private static List combineStacks(List rawList) { .collect(Collectors.toList()); } - private static List finalizeOutputs(List materials, int maxOutputs, Function toItemStackMapper) { - + private static List finalizeOutputs(List materials, int maxOutputs, + Function toItemStackMapper) { // Map of ItemStack, Long to properly sort by the true material amount for outputs List> outputs = new ArrayList<>(); @@ -474,23 +482,29 @@ private static List finalizeOutputs(List materials, in return returnValues; } - private static void splitStacks(List> list, ItemStack originalStack, UnificationEntry entry) { + private static void splitStacks(List> list, ItemStack originalStack, + UnificationEntry entry) { int amount = originalStack.getCount(); while (amount > 64) { - list.add(new Tuple<>(GTUtil.copyAmount(64, originalStack), new MaterialStack(entry.material, entry.tagPrefix.getMaterialAmount(entry.material) * 64))); + list.add(new Tuple<>(GTUtil.copyAmount(64, originalStack), + new MaterialStack(entry.material, entry.tagPrefix.getMaterialAmount(entry.material) * 64))); amount -= 64; } - list.add(new Tuple<>(GTUtil.copyAmount(amount, originalStack), new MaterialStack(entry.material, entry.tagPrefix.getMaterialAmount(entry.material) * amount))); + list.add(new Tuple<>(GTUtil.copyAmount(amount, originalStack), + new MaterialStack(entry.material, entry.tagPrefix.getMaterialAmount(entry.material) * amount))); } - private static final List DUST_ORDER = ImmutableList.of(TagPrefix.dust, TagPrefix.dustSmall, TagPrefix.dustTiny); - private static final List INGOT_ORDER = ImmutableList.of(TagPrefix.block, TagPrefix.ingot, TagPrefix.nugget); + private static final List DUST_ORDER = ImmutableList.of(TagPrefix.dust, TagPrefix.dustSmall, + TagPrefix.dustTiny); + private static final List INGOT_ORDER = ImmutableList.of(TagPrefix.block, TagPrefix.ingot, + TagPrefix.nugget); - private static void shrinkStacks(List> list, ItemStack originalStack, UnificationEntry entry) { + private static void shrinkStacks(List> list, ItemStack originalStack, + UnificationEntry entry) { Material material = entry.material; long materialAmount = originalStack.getCount() * entry.tagPrefix.getMaterialAmount(material); - //noinspection ConstantConditions + // noinspection ConstantConditions final List chosenList = material.hasProperty(PropertyKey.INGOT) ? INGOT_ORDER : DUST_ORDER; // Break materialAmount into a maximal stack @@ -510,7 +524,10 @@ private static void shrinkStacks(List> list, Ite if (tempList.containsKey(chosenList.get(0))) { TagPrefix prefix = chosenList.get(0); MaterialStack ms = tempList.get(prefix); - splitStacks(list, ChemicalHelper.get(chosenList.get(0), ms.material(), (int) (ms.amount() / prefix.getMaterialAmount(material))), new UnificationEntry(prefix, material)); + splitStacks(list, + ChemicalHelper.get(chosenList.get(0), ms.material(), + (int) (ms.amount() / prefix.getMaterialAmount(material))), + new UnificationEntry(prefix, material)); } TagPrefix mediumPrefix = chosenList.get(1); // dustSmall or ingot @@ -522,24 +539,28 @@ private static void shrinkStacks(List> list, Ite if (mediumMS != null && smallestMS != null) { long singleStackAmount = mediumMS.amount() + smallestMS.amount(); if (singleStackAmount / smallestPrefix.getMaterialAmount(material) <= 64) { - list.add(new Tuple<>(ChemicalHelper.get(smallestPrefix, material, (int) (singleStackAmount / smallestPrefix.getMaterialAmount(material))), new MaterialStack(material, singleStackAmount))); + list.add(new Tuple<>( + ChemicalHelper.get(smallestPrefix, material, + (int) (singleStackAmount / smallestPrefix.getMaterialAmount(material))), + new MaterialStack(material, singleStackAmount))); return; } } // Otherwise simply add the stacks to the List if they exist if (mediumMS != null) list.add(new Tuple<>( - ChemicalHelper.get(mediumPrefix, material, (int) (mediumMS.amount() / mediumPrefix.getMaterialAmount(material))), - new MaterialStack(material, mediumMS.amount()) - )); + ChemicalHelper.get(mediumPrefix, material, + (int) (mediumMS.amount() / mediumPrefix.getMaterialAmount(material))), + new MaterialStack(material, mediumMS.amount()))); if (smallestMS != null) list.add(new Tuple<>( - ChemicalHelper.get(smallestPrefix, material, (int) (smallestMS.amount() / smallestPrefix.getMaterialAmount(material))), - new MaterialStack(material, smallestMS.amount()) - )); + ChemicalHelper.get(smallestPrefix, material, + (int) (smallestMS.amount() / smallestPrefix.getMaterialAmount(material))), + new MaterialStack(material, smallestMS.amount()))); } private static boolean isAshMaterial(MaterialStack ms) { - return ms.material() == GTMaterials.Ash || ms.material() == GTMaterials.DarkAsh || ms.material() == GTMaterials.Carbon; + return ms.material() == GTMaterials.Ash || ms.material() == GTMaterials.DarkAsh || + ms.material() == GTMaterials.Carbon; } } diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/VanillaStandardRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/VanillaStandardRecipes.java index cad482b7b0..a98775cfec 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/VanillaStandardRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/VanillaStandardRecipes.java @@ -3,15 +3,14 @@ import com.gregtechceu.gtceu.api.data.chemical.ChemicalHelper; import com.gregtechceu.gtceu.api.data.chemical.material.stack.UnificationEntry; import com.gregtechceu.gtceu.api.data.tag.TagPrefix; -import com.gregtechceu.gtceu.common.data.GTItems; import com.gregtechceu.gtceu.common.data.GTMaterials; import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.data.recipe.CustomTags; import com.gregtechceu.gtceu.data.recipe.VanillaRecipeHelper; + import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.resources.ResourceLocation; -import net.minecraft.tags.BlockTags; import net.minecraft.tags.ItemTags; import net.minecraft.world.item.DyeColor; import net.minecraft.world.item.ItemStack; @@ -52,7 +51,7 @@ private static void compressingRecipes(Consumer provider) { .outputItems(new ItemStack(Blocks.STONE)) .save(provider); - //todo autogenerate 2x2 recipes? + // todo autogenerate 2x2 recipes? COMPRESSOR_RECIPES.recipeBuilder("sandstone").duration(300).EUt(2) .inputItems(new ItemStack(Blocks.SAND, 4)) .outputItems(new ItemStack(Blocks.SANDSTONE)) @@ -88,9 +87,12 @@ private static void compressingRecipes(Consumer provider) { .outputItems(new ItemStack(Blocks.GLOWSTONE)) .save(provider); - COMPRESSOR_RECIPES.recipeBuilder("packed_ice").inputItems(new ItemStack(Blocks.ICE, 9)).outputItems(new ItemStack(Blocks.PACKED_ICE)).save(provider); - COMPRESSOR_RECIPES.recipeBuilder("blue_ice").inputItems(new ItemStack(Blocks.PACKED_ICE, 9)).outputItems(new ItemStack(Blocks.BLUE_ICE)).save(provider); - COMPRESSOR_RECIPES.recipeBuilder("ice_from_dust").inputItems(dust, Ice).outputItems(new ItemStack(Blocks.ICE)).save(provider); + COMPRESSOR_RECIPES.recipeBuilder("packed_ice").inputItems(new ItemStack(Blocks.ICE, 9)) + .outputItems(new ItemStack(Blocks.PACKED_ICE)).save(provider); + COMPRESSOR_RECIPES.recipeBuilder("blue_ice").inputItems(new ItemStack(Blocks.PACKED_ICE, 9)) + .outputItems(new ItemStack(Blocks.BLUE_ICE)).save(provider); + COMPRESSOR_RECIPES.recipeBuilder("ice_from_dust").inputItems(dust, Ice).outputItems(new ItemStack(Blocks.ICE)) + .save(provider); PACKER_RECIPES.recipeBuilder("hay_block") .inputItems(new ItemStack(Items.WHEAT, 9)) @@ -113,9 +115,11 @@ private static void compressingRecipes(Consumer provider) { * - Removes some glass related recipes based on configs */ private static void glassRecipes(Consumer provider) { - VanillaRecipeHelper.addShapedRecipe(provider, "glass_dust_hammer", ChemicalHelper.get(dust, Glass), "hG", 'G', new ItemStack(Blocks.GLASS)); + VanillaRecipeHelper.addShapedRecipe(provider, "glass_dust_hammer", ChemicalHelper.get(dust, Glass), "hG", 'G', + new ItemStack(Blocks.GLASS)); - VanillaRecipeHelper.addShapedRecipe(provider, "quartz_sand", ChemicalHelper.get(dust, QuartzSand), "S", "m", 'S', new ItemStack(Blocks.SAND)); + VanillaRecipeHelper.addShapedRecipe(provider, "quartz_sand", ChemicalHelper.get(dust, QuartzSand), "S", "m", + 'S', new ItemStack(Blocks.SAND)); MACERATOR_RECIPES.recipeBuilder("quartz_sand_from_sand") .inputItems(new ItemStack(Blocks.SAND)) @@ -179,17 +183,19 @@ private static void glassRecipes(Consumer provider) { .outputItems(new ItemStack(Blocks.GLASS, 1)) .save(provider); - //for (int i = 0; i < 16; i++) { + // for (int i = 0; i < 16; i++) { - //ModHandler.addShapedRecipe("stained_glass_pane_" + i, new ItemStack(Blocks.STAINED_GLASS_PANE, 2, i), "sG", 'G', new ItemStack(Blocks.STAINED_GLASS, 1, i)); + // ModHandler.addShapedRecipe("stained_glass_pane_" + i, new ItemStack(Blocks.STAINED_GLASS_PANE, 2, i), "sG", + // 'G', new ItemStack(Blocks.STAINED_GLASS, 1, i)); - //CUTTER_RECIPES.recipeBuilder().duration(50).EUt(VA[ULV]) - // .inputItems(new ItemStack(Blocks.STAINED_GLASS, 3, i)) - // .outputItems(new ItemStack(Blocks.STAINED_GLASS_PANE, 8, i)) - // .save(provider); - //} + // CUTTER_RECIPES.recipeBuilder().duration(50).EUt(VA[ULV]) + // .inputItems(new ItemStack(Blocks.STAINED_GLASS, 3, i)) + // .outputItems(new ItemStack(Blocks.STAINED_GLASS_PANE, 8, i)) + // .save(provider); + // } - VanillaRecipeHelper.addShapedRecipe(provider, "glass_pane", new ItemStack(Blocks.GLASS_PANE, 2), "sG", 'G', new ItemStack(Blocks.GLASS)); + VanillaRecipeHelper.addShapedRecipe(provider, "glass_pane", new ItemStack(Blocks.GLASS_PANE, 2), "sG", 'G', + new ItemStack(Blocks.GLASS)); CUTTER_RECIPES.recipeBuilder("cut_glass_panes").duration(50).EUt(VA[ULV]) .inputItems(new ItemStack(Blocks.GLASS, 3)) @@ -201,8 +207,10 @@ private static void glassRecipes(Consumer provider) { * Adds smashing related recipes for vanilla blocks and items */ private static void smashingRecipes(Consumer provider) { - VanillaRecipeHelper.addShapedRecipe(provider, "cobblestone_hammer", new ItemStack(Blocks.COBBLESTONE), "h", "C", 'C', new ItemStack(Blocks.STONE)); - VanillaRecipeHelper.addShapedRecipe(provider, "cobbled_deepslate_hammer", new ItemStack(Blocks.COBBLED_DEEPSLATE), "h", "C", 'C', new ItemStack(Blocks.DEEPSLATE)); + VanillaRecipeHelper.addShapedRecipe(provider, "cobblestone_hammer", new ItemStack(Blocks.COBBLESTONE), "h", "C", + 'C', new ItemStack(Blocks.STONE)); + VanillaRecipeHelper.addShapedRecipe(provider, "cobbled_deepslate_hammer", + new ItemStack(Blocks.COBBLED_DEEPSLATE), "h", "C", 'C', new ItemStack(Blocks.DEEPSLATE)); FORGE_HAMMER_RECIPES.recipeBuilder("stone_to_cobblestone") .inputItems(new ItemStack(Blocks.STONE)) @@ -271,14 +279,22 @@ private static void smashingRecipes(Consumer provider) { .outputItems(new ItemStack(Blocks.CRACKED_STONE_BRICKS)) .EUt(2).duration(400).save(provider); - VanillaRecipeHelper.addShapelessRecipe(provider, "clay_block_to_dust", ChemicalHelper.get(dust, Clay), 'm', Blocks.CLAY); - VanillaRecipeHelper.addShapelessRecipe(provider, "clay_ball_to_dust", ChemicalHelper.get(dustSmall, Clay), 'm', Items.CLAY_BALL); - VanillaRecipeHelper.addShapelessRecipe(provider, "brick_block_to_dust", ChemicalHelper.get(dust, Brick), 'm', Blocks.BRICKS); - VanillaRecipeHelper.addShapelessRecipe(provider, "brick_to_dust", ChemicalHelper.get(dustSmall, Brick), 'm', Items.BRICK); - VanillaRecipeHelper.addShapelessRecipe(provider, "wheat_to_dust", ChemicalHelper.get(dust, Wheat), 'm', Items.WHEAT); - VanillaRecipeHelper.addShapelessRecipe(provider, "gravel_to_flint", new ItemStack(Items.FLINT), 'm', Blocks.GRAVEL); - VanillaRecipeHelper.addShapelessRecipe(provider, "bone_to_bone_meal", new ItemStack(Items.BONE_MEAL), 'm', Items.BONE); - VanillaRecipeHelper.addShapelessRecipe(provider, "blaze_rod_to_powder", new ItemStack(Items.BLAZE_POWDER, 3), 'm', Items.BLAZE_ROD); + VanillaRecipeHelper.addShapelessRecipe(provider, "clay_block_to_dust", ChemicalHelper.get(dust, Clay), 'm', + Blocks.CLAY); + VanillaRecipeHelper.addShapelessRecipe(provider, "clay_ball_to_dust", ChemicalHelper.get(dustSmall, Clay), 'm', + Items.CLAY_BALL); + VanillaRecipeHelper.addShapelessRecipe(provider, "brick_block_to_dust", ChemicalHelper.get(dust, Brick), 'm', + Blocks.BRICKS); + VanillaRecipeHelper.addShapelessRecipe(provider, "brick_to_dust", ChemicalHelper.get(dustSmall, Brick), 'm', + Items.BRICK); + VanillaRecipeHelper.addShapelessRecipe(provider, "wheat_to_dust", ChemicalHelper.get(dust, Wheat), 'm', + Items.WHEAT); + VanillaRecipeHelper.addShapelessRecipe(provider, "gravel_to_flint", new ItemStack(Items.FLINT), 'm', + Blocks.GRAVEL); + VanillaRecipeHelper.addShapelessRecipe(provider, "bone_to_bone_meal", new ItemStack(Items.BONE_MEAL, 4), 'm', + Items.BONE); + VanillaRecipeHelper.addShapelessRecipe(provider, "blaze_rod_to_powder", new ItemStack(Items.BLAZE_POWDER, 3), + 'm', Items.BLAZE_ROD); MACERATOR_RECIPES.recipeBuilder("macerate_cocoa") .inputItems(new ItemStack(Items.COCOA_BEANS)) @@ -367,11 +383,11 @@ private static void woodRecipes(Consumer provider) { .save(provider); // todo trapdoors - //ASSEMBLER_RECIPES.recipeBuilder() - // .inputItems(ItemTags.PLANKS, 3).circuitMeta(3) - // .outputItems(new ItemStack(Blocks.TRAPDOOR, 2)) - // .duration(100).EUt(4) - // .save(provider); + // ASSEMBLER_RECIPES.recipeBuilder() + // .inputItems(ItemTags.PLANKS, 3).circuitMeta(3) + // .outputItems(new ItemStack(Blocks.TRAPDOOR, 2)) + // .duration(100).EUt(4) + // .save(provider); ASSEMBLER_RECIPES.recipeBuilder("chest") .inputItems(ItemTags.PLANKS, 8) @@ -409,7 +425,6 @@ private static void woodRecipes(Consumer provider) { .outputItems(new ItemStack(Blocks.TORCH, 8)) .duration(100).EUt(1).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("oak_fence") .inputItems(new ItemStack(Blocks.OAK_PLANKS, 1)) .outputItems(new ItemStack(Blocks.OAK_FENCE)) @@ -488,32 +503,63 @@ private static void woodRecipes(Consumer provider) { .circuitMeta(2) .duration(100).EUt(4).save(provider); - VanillaRecipeHelper.addShapedRecipe(provider, "sticky_resin_torch", new ItemStack(Blocks.TORCH, 3), "X", "Y", 'X', STICKY_RESIN, 'Y', new ItemStack(Items.STICK)); - VanillaRecipeHelper.addShapedRecipe(provider, "torch_sulfur", new ItemStack(Blocks.TORCH, 2), "C", "S", 'C', new UnificationEntry(dust, Sulfur), 'S', new ItemStack(Items.STICK)); - VanillaRecipeHelper.addShapedRecipe(provider, "torch_phosphorus", new ItemStack(Blocks.TORCH, 6), "C", "S", 'C', new UnificationEntry(dust, Phosphorus), 'S', new ItemStack(Items.STICK)); - VanillaRecipeHelper.addShapedRecipe(provider, "torch_coal_dust", new ItemStack(Blocks.TORCH, 4), "C", "S", 'C', new UnificationEntry(dust, Coal), 'S', new ItemStack(Items.STICK)); - VanillaRecipeHelper.addShapedRecipe(provider, "torch_charcoal_dust", new ItemStack(Blocks.TORCH, 4), "C", "S", 'C', new UnificationEntry(dust, Charcoal), 'S', new ItemStack(Items.STICK)); - VanillaRecipeHelper.addShapedRecipe(provider, "torch_coke", new ItemStack(Blocks.TORCH, 8), "C", "S", 'C', new UnificationEntry(gem, Coke), 'S', new ItemStack(Items.STICK)); - VanillaRecipeHelper.addShapedRecipe(provider, "torch_coke_dust", new ItemStack(Blocks.TORCH, 8), "C", "S", 'C', new UnificationEntry(dust, Coke), 'S', new ItemStack(Items.STICK)); - VanillaRecipeHelper.addShapedRecipe(provider, "torch_creosote", new ItemStack(Blocks.TORCH, 16), "WB", "S ", 'W', ItemTags.WOOL, 'S', new ItemStack(Items.STICK), 'B', Creosote.getBucket()); - - ASSEMBLER_RECIPES.recipeBuilder("redstone_torch").EUt(1).inputItems(dust, Redstone).inputItems(new ItemStack(Items.STICK)).outputItems(new ItemStack(Blocks.REDSTONE_TORCH, 1)).duration(100).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("torch_sulfur").EUt(1).inputItems(new ItemStack(Items.STICK)).inputItems(dust, Sulfur).outputItems(new ItemStack(Blocks.TORCH, 2)).duration(100).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("torch_phosphorus").EUt(1).inputItems(new ItemStack(Items.STICK)).inputItems(dust, Phosphorus).outputItems(new ItemStack(Blocks.TORCH, 6)).duration(100).save(provider); - - ASSEMBLER_RECIPES.recipeBuilder("oak_stairs").EUt(1).duration(100).circuitMeta(7).inputItems(new ItemStack(Blocks.OAK_PLANKS, 6)).outputItems(new ItemStack(Blocks.OAK_STAIRS, 4)).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("spruce_stairs").EUt(1).duration(100).circuitMeta(7).inputItems(new ItemStack(Blocks.SPRUCE_PLANKS, 6)).outputItems(new ItemStack(Blocks.SPRUCE_STAIRS, 4)).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("birch_stairs").EUt(1).duration(100).circuitMeta(7).inputItems(new ItemStack(Blocks.BIRCH_PLANKS, 6)).outputItems(new ItemStack(Blocks.BIRCH_STAIRS, 4)).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("jungle_stairs").EUt(1).duration(100).circuitMeta(7).inputItems(new ItemStack(Blocks.JUNGLE_PLANKS, 6)).outputItems(new ItemStack(Blocks.JUNGLE_STAIRS, 4)).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("acacia_stairs").EUt(1).duration(100).circuitMeta(7).inputItems(new ItemStack(Blocks.ACACIA_PLANKS, 6)).outputItems(new ItemStack(Blocks.ACACIA_STAIRS, 4)).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("dark_oak_stairs").EUt(1).duration(100).circuitMeta(7).inputItems(new ItemStack(Blocks.DARK_OAK_PLANKS, 6)).outputItems(new ItemStack(Blocks.DARK_OAK_STAIRS, 4)).save(provider); - - ASSEMBLER_RECIPES.recipeBuilder("ladder").EUt(1).duration(40).circuitMeta(7).inputItems(new ItemStack(Items.STICK, 7)).outputItems(new ItemStack(Blocks.LADDER, 2)).save(provider); - - ASSEMBLER_RECIPES.recipeBuilder("chest_minecart").EUt(4).duration(100).inputItems(new ItemStack(Items.MINECART)).inputItems(CustomTags.WOODEN_CHESTS).outputItems(new ItemStack(Items.CHEST_MINECART)).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("furnace_minecart").EUt(4).duration(100).inputItems(new ItemStack(Items.MINECART)).inputItems(new ItemStack(Blocks.FURNACE)).outputItems(new ItemStack(Items.FURNACE_MINECART)).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("tnt_minecart").EUt(4).duration(100).inputItems(new ItemStack(Items.MINECART)).inputItems(new ItemStack(Blocks.TNT)).outputItems(new ItemStack(Items.TNT_MINECART)).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("hopper_minecart").EUt(4).duration(100).inputItems(new ItemStack(Items.MINECART)).inputItems(new ItemStack(Blocks.HOPPER)).outputItems(new ItemStack(Items.HOPPER_MINECART)).save(provider); + VanillaRecipeHelper.addShapedRecipe(provider, "sticky_resin_torch", new ItemStack(Blocks.TORCH, 3), "X", "Y", + 'X', STICKY_RESIN, 'Y', new ItemStack(Items.STICK)); + VanillaRecipeHelper.addShapedRecipe(provider, "torch_sulfur", new ItemStack(Blocks.TORCH, 2), "C", "S", 'C', + new UnificationEntry(dust, Sulfur), 'S', new ItemStack(Items.STICK)); + VanillaRecipeHelper.addShapedRecipe(provider, "torch_phosphorus", new ItemStack(Blocks.TORCH, 6), "C", "S", 'C', + new UnificationEntry(dust, Phosphorus), 'S', new ItemStack(Items.STICK)); + VanillaRecipeHelper.addShapedRecipe(provider, "torch_coal_dust", new ItemStack(Blocks.TORCH, 4), "C", "S", 'C', + new UnificationEntry(dust, Coal), 'S', new ItemStack(Items.STICK)); + VanillaRecipeHelper.addShapedRecipe(provider, "torch_charcoal_dust", new ItemStack(Blocks.TORCH, 4), "C", "S", + 'C', new UnificationEntry(dust, Charcoal), 'S', new ItemStack(Items.STICK)); + VanillaRecipeHelper.addShapedRecipe(provider, "torch_coke", new ItemStack(Blocks.TORCH, 8), "C", "S", 'C', + new UnificationEntry(gem, Coke), 'S', new ItemStack(Items.STICK)); + VanillaRecipeHelper.addShapedRecipe(provider, "torch_coke_dust", new ItemStack(Blocks.TORCH, 8), "C", "S", 'C', + new UnificationEntry(dust, Coke), 'S', new ItemStack(Items.STICK)); + VanillaRecipeHelper.addShapedRecipe(provider, "torch_creosote", new ItemStack(Blocks.TORCH, 16), "WB", "S ", + 'W', ItemTags.WOOL, 'S', new ItemStack(Items.STICK), 'B', Creosote.getBucket()); + + ASSEMBLER_RECIPES.recipeBuilder("redstone_torch").EUt(1).inputItems(dust, Redstone) + .inputItems(new ItemStack(Items.STICK)).outputItems(new ItemStack(Blocks.REDSTONE_TORCH, 1)) + .duration(100).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("torch_sulfur").EUt(1).inputItems(new ItemStack(Items.STICK)) + .inputItems(dust, Sulfur).outputItems(new ItemStack(Blocks.TORCH, 2)).duration(100).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("torch_phosphorus").EUt(1).inputItems(new ItemStack(Items.STICK)) + .inputItems(dust, Phosphorus).outputItems(new ItemStack(Blocks.TORCH, 6)).duration(100).save(provider); + + ASSEMBLER_RECIPES.recipeBuilder("oak_stairs").EUt(1).duration(100).circuitMeta(7) + .inputItems(new ItemStack(Blocks.OAK_PLANKS, 6)).outputItems(new ItemStack(Blocks.OAK_STAIRS, 4)) + .save(provider); + ASSEMBLER_RECIPES.recipeBuilder("spruce_stairs").EUt(1).duration(100).circuitMeta(7) + .inputItems(new ItemStack(Blocks.SPRUCE_PLANKS, 6)).outputItems(new ItemStack(Blocks.SPRUCE_STAIRS, 4)) + .save(provider); + ASSEMBLER_RECIPES.recipeBuilder("birch_stairs").EUt(1).duration(100).circuitMeta(7) + .inputItems(new ItemStack(Blocks.BIRCH_PLANKS, 6)).outputItems(new ItemStack(Blocks.BIRCH_STAIRS, 4)) + .save(provider); + ASSEMBLER_RECIPES.recipeBuilder("jungle_stairs").EUt(1).duration(100).circuitMeta(7) + .inputItems(new ItemStack(Blocks.JUNGLE_PLANKS, 6)).outputItems(new ItemStack(Blocks.JUNGLE_STAIRS, 4)) + .save(provider); + ASSEMBLER_RECIPES.recipeBuilder("acacia_stairs").EUt(1).duration(100).circuitMeta(7) + .inputItems(new ItemStack(Blocks.ACACIA_PLANKS, 6)).outputItems(new ItemStack(Blocks.ACACIA_STAIRS, 4)) + .save(provider); + ASSEMBLER_RECIPES.recipeBuilder("dark_oak_stairs").EUt(1).duration(100).circuitMeta(7) + .inputItems(new ItemStack(Blocks.DARK_OAK_PLANKS, 6)) + .outputItems(new ItemStack(Blocks.DARK_OAK_STAIRS, 4)).save(provider); + + ASSEMBLER_RECIPES.recipeBuilder("ladder").EUt(1).duration(40).circuitMeta(7) + .inputItems(new ItemStack(Items.STICK, 7)).outputItems(new ItemStack(Blocks.LADDER, 2)).save(provider); + + ASSEMBLER_RECIPES.recipeBuilder("chest_minecart").EUt(4).duration(100).inputItems(new ItemStack(Items.MINECART)) + .inputItems(CustomTags.WOODEN_CHESTS).outputItems(new ItemStack(Items.CHEST_MINECART)).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("furnace_minecart").EUt(4).duration(100) + .inputItems(new ItemStack(Items.MINECART)).inputItems(new ItemStack(Blocks.FURNACE)) + .outputItems(new ItemStack(Items.FURNACE_MINECART)).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("tnt_minecart").EUt(4).duration(100).inputItems(new ItemStack(Items.MINECART)) + .inputItems(new ItemStack(Blocks.TNT)).outputItems(new ItemStack(Items.TNT_MINECART)).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("hopper_minecart").EUt(4).duration(100) + .inputItems(new ItemStack(Items.MINECART)).inputItems(new ItemStack(Blocks.HOPPER)) + .outputItems(new ItemStack(Items.HOPPER_MINECART)).save(provider); } /** @@ -536,42 +582,48 @@ private static void dyingCleaningRecipes(Consumer provider) { .inputItems(Tags.Items.SAND, 4) .inputItems(Tags.Items.GRAVEL, 4) .inputFluids(CHEMICAL_DYES[color.ordinal()].getFluid(L)) - .outputItems(new ItemStack(BuiltInRegistries.ITEM.get(new ResourceLocation(dyeName + "_concrete_powder")), 8)) + .outputItems(new ItemStack( + BuiltInRegistries.ITEM.get(new ResourceLocation(dyeName + "_concrete_powder")), 8)) .save(provider); CHEMICAL_BATH_RECIPES.recipeBuilder(dyeName + "_concrete").duration(20).EUt(VA[ULV]) - .inputItems(new ItemStack(BuiltInRegistries.ITEM.get(new ResourceLocation(dyeName + "_concrete_powder")))) + .inputItems(new ItemStack( + BuiltInRegistries.ITEM.get(new ResourceLocation(dyeName + "_concrete_powder")))) .inputFluids(Water.getFluid(1000)) .outputItems(new ItemStack(BuiltInRegistries.ITEM.get(new ResourceLocation(dyeName + "_concrete")))) .save(provider); - if(color != DyeColor.WHITE) { + if (color != DyeColor.WHITE) { CHEMICAL_BATH_RECIPES.recipeBuilder("dye_concrete_to_" + dyeName).duration(20).EUt(VA[ULV]) .inputItems(CustomTags.CONCRETE_ITEM) .inputFluids(CHEMICAL_DYES[color.ordinal()].getFluid(L / 8)) - .outputItems(new ItemStack(BuiltInRegistries.ITEM.get(new ResourceLocation(dyeName + "_concrete")))) + .outputItems( + new ItemStack(BuiltInRegistries.ITEM.get(new ResourceLocation(dyeName + "_concrete")))) .save(provider); } CHEMICAL_BATH_RECIPES.recipeBuilder("dye_terracotta_to_" + dyeName).duration(20).EUt(VA[ULV]) .inputItems(new ItemStack(Blocks.TERRACOTTA)) .inputFluids(CHEMICAL_DYES[color.ordinal()].getFluid(L / 8)) - .outputItems(new ItemStack(BuiltInRegistries.ITEM.get(new ResourceLocation(dyeName + "_terracotta")))) + .outputItems( + new ItemStack(BuiltInRegistries.ITEM.get(new ResourceLocation(dyeName + "_terracotta")))) .save(provider); CHEMICAL_BATH_RECIPES.recipeBuilder("dye_glass_to_" + dyeName).duration(20).EUt(VA[ULV]) .inputItems(new ItemStack(Blocks.GLASS)) .inputFluids(CHEMICAL_DYES[color.ordinal()].getFluid(L / 8)) - .outputItems(new ItemStack(BuiltInRegistries.ITEM.get(new ResourceLocation(dyeName + "_stained_glass")))) + .outputItems( + new ItemStack(BuiltInRegistries.ITEM.get(new ResourceLocation(dyeName + "_stained_glass")))) .save(provider); CHEMICAL_BATH_RECIPES.recipeBuilder("dye_glass_pane_to_" + dyeName).duration(20).EUt(VA[ULV]) .inputItems(new ItemStack(Blocks.GLASS_PANE)) .inputFluids(CHEMICAL_DYES[color.ordinal()].getFluid(L / 8)) - .outputItems(new ItemStack(BuiltInRegistries.ITEM.get(new ResourceLocation(dyeName + "_stained_glass_pane")))) + .outputItems(new ItemStack( + BuiltInRegistries.ITEM.get(new ResourceLocation(dyeName + "_stained_glass_pane")))) .save(provider); - if(color != DyeColor.WHITE) { + if (color != DyeColor.WHITE) { CHEMICAL_BATH_RECIPES.recipeBuilder("dye_wool_to_" + dyeName).duration(20).EUt(VA[ULV]) .inputItems(new ItemStack(Blocks.WHITE_WOOL)) .inputFluids(CHEMICAL_DYES[color.ordinal()].getFluid(L)) @@ -581,7 +633,8 @@ private static void dyingCleaningRecipes(Consumer provider) { CUTTER_RECIPES.recipeBuilder("cut_" + dyeName + "_wool_to_carpet").duration(20).EUt(VA[ULV]) .inputItems(new ItemStack(BuiltInRegistries.ITEM.get(new ResourceLocation(dyeName + "_wool")), 1)) - .outputItems(new ItemStack(BuiltInRegistries.ITEM.get(new ResourceLocation(dyeName + "_carpet")), 2)) + .outputItems( + new ItemStack(BuiltInRegistries.ITEM.get(new ResourceLocation(dyeName + "_carpet")), 2)) .save(provider); ASSEMBLER_RECIPES.recipeBuilder(dyeName + "_banner").duration(20).EUt(VA[ULV]) @@ -717,45 +770,45 @@ private static void metalRecipes(Consumer provider) { .duration(100).EUt(4) .save(provider); - VanillaRecipeHelper.addShapedRecipe(provider, "iron_horse_armor", new ItemStack(Items.IRON_HORSE_ARMOR), "hdH", "PCP", "LSL", + VanillaRecipeHelper.addShapedRecipe(provider, "iron_horse_armor", new ItemStack(Items.IRON_HORSE_ARMOR), "hdH", + "PCP", "LSL", 'H', new ItemStack(Items.IRON_HELMET), 'P', new UnificationEntry(plate, Iron), 'C', new ItemStack(Items.IRON_CHESTPLATE), 'L', new ItemStack(Items.IRON_LEGGINGS), - 'S', new UnificationEntry(screw, Iron) - ); + 'S', new UnificationEntry(screw, Iron)); - VanillaRecipeHelper.addShapedRecipe(provider, "golden_horse_armor", new ItemStack(Items.GOLDEN_HORSE_ARMOR), "hdH", "PCP", "LSL", + VanillaRecipeHelper.addShapedRecipe(provider, "golden_horse_armor", new ItemStack(Items.GOLDEN_HORSE_ARMOR), + "hdH", "PCP", "LSL", 'H', new ItemStack(Items.GOLDEN_HELMET), 'P', new UnificationEntry(plate, Gold), 'C', new ItemStack(Items.GOLDEN_CHESTPLATE), 'L', new ItemStack(Items.GOLDEN_LEGGINGS), - 'S', new UnificationEntry(screw, Gold) - ); + 'S', new UnificationEntry(screw, Gold)); - VanillaRecipeHelper.addShapedRecipe(provider, "diamond_horse_armor", new ItemStack(Items.DIAMOND_HORSE_ARMOR), "hdH", "PCP", "LSL", + VanillaRecipeHelper.addShapedRecipe(provider, "diamond_horse_armor", new ItemStack(Items.DIAMOND_HORSE_ARMOR), + "hdH", "PCP", "LSL", 'H', new ItemStack(Items.DIAMOND_HELMET), 'P', new UnificationEntry(plate, Diamond), 'C', new ItemStack(Items.DIAMOND_CHESTPLATE), 'L', new ItemStack(Items.DIAMOND_LEGGINGS), - 'S', new UnificationEntry(bolt, Diamond) - ); + 'S', new UnificationEntry(bolt, Diamond)); - VanillaRecipeHelper.addShapedRecipe(provider, "chainmail_helmet", new ItemStack(Items.CHAINMAIL_HELMET), "PPP", "PhP", - 'P', new UnificationEntry(ring, Iron) - ); + VanillaRecipeHelper.addShapedRecipe(provider, "chainmail_helmet", new ItemStack(Items.CHAINMAIL_HELMET), "PPP", + "PhP", + 'P', new UnificationEntry(ring, Iron)); - VanillaRecipeHelper.addShapedRecipe(provider, "chainmail_chestplate", new ItemStack(Items.CHAINMAIL_CHESTPLATE), "PhP", "PPP", "PPP", - 'P', new UnificationEntry(ring, Iron) - ); + VanillaRecipeHelper.addShapedRecipe(provider, "chainmail_chestplate", new ItemStack(Items.CHAINMAIL_CHESTPLATE), + "PhP", "PPP", "PPP", + 'P', new UnificationEntry(ring, Iron)); - VanillaRecipeHelper.addShapedRecipe(provider, "chainmail_leggings", new ItemStack(Items.CHAINMAIL_LEGGINGS), "PPP", "PhP", "P P", - 'P', new UnificationEntry(ring, Iron) - ); + VanillaRecipeHelper.addShapedRecipe(provider, "chainmail_leggings", new ItemStack(Items.CHAINMAIL_LEGGINGS), + "PPP", "PhP", "P P", + 'P', new UnificationEntry(ring, Iron)); - VanillaRecipeHelper.addShapedRecipe(provider, "chainmail_boots", new ItemStack(Items.CHAINMAIL_BOOTS), "P P", "PhP", - 'P', new UnificationEntry(ring, Iron) - ); + VanillaRecipeHelper.addShapedRecipe(provider, "chainmail_boots", new ItemStack(Items.CHAINMAIL_BOOTS), "P P", + "PhP", + 'P', new UnificationEntry(ring, Iron)); ASSEMBLER_RECIPES.recipeBuilder("cauldron") .inputItems(plate, Iron, 7) @@ -777,10 +830,10 @@ private static void metalRecipes(Consumer provider) { if (!ConfigHolder.INSTANCE.recipes.hardAdvancedIronRecipes) { ASSEMBLER_RECIPES.recipeBuilder("iron_door") - .inputItems(TagPrefix.plate, GTMaterials.Iron, 6) - .circuitMeta(6) - .outputItems(new ItemStack(Items.IRON_DOOR, 3)) - .duration(100).EUt(16).save(provider); + .inputItems(TagPrefix.plate, GTMaterials.Iron, 6) + .circuitMeta(6) + .outputItems(new ItemStack(Items.IRON_DOOR, 3)) + .duration(100).EUt(16).save(provider); } } @@ -844,16 +897,27 @@ private static void miscRecipes(Consumer provider) { .outputItems(new ItemStack(Items.BOW, 1)) .duration(100).EUt(4).save(provider); - FLUID_SOLIDFICATION_RECIPES.recipeBuilder("snowball").duration(128).EUt(4).notConsumable(SHAPE_MOLD_BALL).inputFluids(Water.getFluid(250)).outputItems(new ItemStack(Items.SNOWBALL)).save(provider); - FLUID_SOLIDFICATION_RECIPES.recipeBuilder("snowball_distilled").duration(128).EUt(4).notConsumable(SHAPE_MOLD_BALL).inputFluids(DistilledWater.getFluid(250)).outputItems(new ItemStack(Items.SNOWBALL)).save(provider); - FLUID_SOLIDFICATION_RECIPES.recipeBuilder("snow_block").duration(512).EUt(4).notConsumable(SHAPE_MOLD_BLOCK).inputFluids(Water.getFluid(1000)).outputItems(new ItemStack(Blocks.SNOW_BLOCK)).save(provider); - FLUID_SOLIDFICATION_RECIPES.recipeBuilder("snow_block_distilled").duration(512).EUt(4).notConsumable(SHAPE_MOLD_BLOCK).inputFluids(DistilledWater.getFluid(1000)).outputItems(new ItemStack(Blocks.SNOW_BLOCK)).save(provider); - FLUID_SOLIDFICATION_RECIPES.recipeBuilder("obsidian").duration(1024).EUt(16).notConsumable(SHAPE_MOLD_BLOCK).inputFluids(Lava.getFluid(1000)).outputItems(new ItemStack(Blocks.OBSIDIAN)).save(provider); - - FLUID_SOLIDFICATION_RECIPES.recipeBuilder("solidify_anvil").duration(1680).EUt(16).notConsumable(SHAPE_MOLD_ANVIL).inputFluids(Iron.getFluid(L * 31)).outputItems(new ItemStack(Blocks.ANVIL)).save(provider); - ALLOY_SMELTER_RECIPES.recipeBuilder("anvil").inputItems(ingot, Iron, 31).notConsumable(SHAPE_MOLD_ANVIL).outputItems(new ItemStack(Blocks.ANVIL)).duration(1680).EUt(16).save(provider); - - VanillaRecipeHelper.addSmeltingRecipe(provider, "sticky_resin_from_slime", new ItemStack(Items.SLIME_BALL), STICKY_RESIN.asStack(), 0.3f); + FLUID_SOLIDFICATION_RECIPES.recipeBuilder("snowball").duration(128).EUt(4).notConsumable(SHAPE_MOLD_BALL) + .inputFluids(Water.getFluid(250)).outputItems(new ItemStack(Items.SNOWBALL)).save(provider); + FLUID_SOLIDFICATION_RECIPES.recipeBuilder("snowball_distilled").duration(128).EUt(4) + .notConsumable(SHAPE_MOLD_BALL).inputFluids(DistilledWater.getFluid(250)) + .outputItems(new ItemStack(Items.SNOWBALL)).save(provider); + FLUID_SOLIDFICATION_RECIPES.recipeBuilder("snow_block").duration(512).EUt(4).notConsumable(SHAPE_MOLD_BLOCK) + .inputFluids(Water.getFluid(1000)).outputItems(new ItemStack(Blocks.SNOW_BLOCK)).save(provider); + FLUID_SOLIDFICATION_RECIPES.recipeBuilder("snow_block_distilled").duration(512).EUt(4) + .notConsumable(SHAPE_MOLD_BLOCK).inputFluids(DistilledWater.getFluid(1000)) + .outputItems(new ItemStack(Blocks.SNOW_BLOCK)).save(provider); + FLUID_SOLIDFICATION_RECIPES.recipeBuilder("obsidian").duration(1024).EUt(16).notConsumable(SHAPE_MOLD_BLOCK) + .inputFluids(Lava.getFluid(1000)).outputItems(new ItemStack(Blocks.OBSIDIAN)).save(provider); + + FLUID_SOLIDFICATION_RECIPES.recipeBuilder("solidify_anvil").duration(1680).EUt(16) + .notConsumable(SHAPE_MOLD_ANVIL).inputFluids(Iron.getFluid(L * 31)) + .outputItems(new ItemStack(Blocks.ANVIL)).save(provider); + ALLOY_SMELTER_RECIPES.recipeBuilder("anvil").inputItems(ingot, Iron, 31).notConsumable(SHAPE_MOLD_ANVIL) + .outputItems(new ItemStack(Blocks.ANVIL)).duration(1680).EUt(16).save(provider); + + VanillaRecipeHelper.addSmeltingRecipe(provider, "sticky_resin_from_slime", new ItemStack(Items.SLIME_BALL), + STICKY_RESIN.asStack(), 0.3f); ASSEMBLER_RECIPES.recipeBuilder("wool_from_string") .inputItems(new ItemStack(Items.STRING, 4)) @@ -873,38 +937,68 @@ private static void miscRecipes(Consumer provider) { .outputItems(new ItemStack(Blocks.MOSSY_STONE_BRICKS)) .duration(40).EUt(1).save(provider); + CANNER_RECIPES.recipeBuilder("jack_o_lantern").EUt(4).duration(100).inputItems(new ItemStack(Blocks.PUMPKIN)) + .inputItems(new ItemStack(Blocks.TORCH)).outputItems(new ItemStack(Blocks.JACK_O_LANTERN)) + .save(provider); + ASSEMBLER_RECIPES.recipeBuilder("sea_lantern").EUt(4).duration(40) + .inputItems(new ItemStack(Items.PRISMARINE_CRYSTALS, 5)) + .inputItems(new ItemStack(Items.PRISMARINE_SHARD, 4)).outputItems(new ItemStack(Blocks.SEA_LANTERN)) + .save(provider); - CANNER_RECIPES.recipeBuilder("jack_o_lantern").EUt(4).duration(100).inputItems(new ItemStack(Blocks.PUMPKIN)).inputItems(new ItemStack(Blocks.TORCH)).outputItems(new ItemStack(Blocks.JACK_O_LANTERN)).save(provider); - - ASSEMBLER_RECIPES.recipeBuilder("sea_lantern").EUt(4).duration(40).inputItems(new ItemStack(Items.PRISMARINE_CRYSTALS, 5)).inputItems(new ItemStack(Items.PRISMARINE_SHARD, 4)).outputItems(new ItemStack(Blocks.SEA_LANTERN)).save(provider); - - ALLOY_SMELTER_RECIPES.recipeBuilder("red_nether_bricks").EUt(4).duration(40).inputItems(new ItemStack(Items.NETHER_BRICK, 2)).inputItems(new ItemStack(Items.NETHER_WART, 2)).outputItems(new ItemStack(Blocks.RED_NETHER_BRICKS)).save(provider); - - ASSEMBLER_RECIPES.recipeBuilder("nether_brick_fence").duration(100).EUt(4).circuitMeta(3).inputItems(new ItemStack(Blocks.NETHER_BRICKS)).outputItems(new ItemStack(Blocks.NETHER_BRICK_FENCE)).save(provider); - - ASSEMBLER_RECIPES.recipeBuilder("end_rod").duration(100).EUt(4).inputItems(new ItemStack(Items.POPPED_CHORUS_FRUIT)).inputItems(new ItemStack(Items.BLAZE_ROD)).outputItems(new ItemStack(Blocks.END_ROD, 4)).save(provider); - - ASSEMBLER_RECIPES.recipeBuilder("purple_shulker_box").duration(100).EUt(VA[ULV]).inputItems(CustomTags.WOODEN_CHESTS).inputItems(new ItemStack(Items.SHULKER_SHELL, 2)).outputItems(new ItemStack(Blocks.PURPLE_SHULKER_BOX)).save(provider); + ALLOY_SMELTER_RECIPES.recipeBuilder("red_nether_bricks").EUt(4).duration(40) + .inputItems(new ItemStack(Items.NETHER_BRICK, 2)).inputItems(new ItemStack(Items.NETHER_WART, 2)) + .outputItems(new ItemStack(Blocks.RED_NETHER_BRICKS)).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("painting").duration(100).EUt(4).circuitMeta(1).inputItems(ItemTags.WOOL).inputItems(new ItemStack(Items.STICK, 8)).outputItems(new ItemStack(Items.PAINTING)).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("item_frame").duration(100).EUt(4).inputItems(new ItemStack(Items.LEATHER)).inputItems(new ItemStack(Items.STICK, 8)).outputItems(new ItemStack(Items.ITEM_FRAME)).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("nether_brick_fence").duration(100).EUt(4).circuitMeta(3) + .inputItems(new ItemStack(Blocks.NETHER_BRICKS)).outputItems(new ItemStack(Blocks.NETHER_BRICK_FENCE)) + .save(provider); - ASSEMBLER_RECIPES.recipeBuilder("oak_sign").duration(100).EUt(4).inputItems(Items.OAK_PLANKS, 6).inputItems(new ItemStack(Items.STICK)).circuitMeta(3).outputItems(Items.OAK_SIGN, 3).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("spruce_sign").duration(100).EUt(4).inputItems(Items.SPRUCE_PLANKS, 6).inputItems(new ItemStack(Items.STICK)).circuitMeta(3).outputItems(Items.SPRUCE_SIGN, 3).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("birch_sign").duration(100).EUt(4).inputItems(Items.BIRCH_PLANKS, 6).inputItems(new ItemStack(Items.STICK)).circuitMeta(3).outputItems(Items.BIRCH_SIGN, 3).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("jungle_sign").duration(100).EUt(4).inputItems(Items.JUNGLE_PLANKS, 6).inputItems(new ItemStack(Items.STICK)).circuitMeta(3).outputItems(Items.JUNGLE_SIGN, 3).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("acacia_sign").duration(100).EUt(4).inputItems(Items.ACACIA_PLANKS, 6).inputItems(new ItemStack(Items.STICK)).circuitMeta(3).outputItems(Items.ACACIA_SIGN, 3).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("cherry_sign").duration(100).EUt(4).inputItems(Items.CHERRY_PLANKS, 6).inputItems(new ItemStack(Items.STICK)).circuitMeta(3).outputItems(Items.CHERRY_SIGN, 3).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("dark_oak_sign").duration(100).EUt(4).inputItems(Items.DARK_OAK_PLANKS, 6).inputItems(new ItemStack(Items.STICK)).circuitMeta(3).outputItems(Items.DARK_OAK_SIGN, 3).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("mangrove_sign").duration(100).EUt(4).inputItems(Items.MANGROVE_PLANKS, 6).inputItems(new ItemStack(Items.STICK)).circuitMeta(3).outputItems(Items.MANGROVE_SIGN, 3).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("bamboo_sign").duration(100).EUt(4).inputItems(Items.BAMBOO_PLANKS, 6).inputItems(new ItemStack(Items.STICK)).circuitMeta(3).outputItems(Items.BAMBOO_SIGN, 3).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("crimson_sign").duration(100).EUt(4).inputItems(Items.CRIMSON_PLANKS, 6).inputItems(new ItemStack(Items.STICK)).circuitMeta(3).outputItems(Items.CRIMSON_SIGN, 3).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("warped_sign").duration(100).EUt(4).inputItems(Items.WARPED_PLANKS, 6).inputItems(new ItemStack(Items.STICK)).circuitMeta(3).outputItems(Items.WARPED_SIGN, 3).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("end_rod").duration(100).EUt(4) + .inputItems(new ItemStack(Items.POPPED_CHORUS_FRUIT)).inputItems(new ItemStack(Items.BLAZE_ROD)) + .outputItems(new ItemStack(Blocks.END_ROD, 4)).save(provider); + + ASSEMBLER_RECIPES.recipeBuilder("purple_shulker_box").duration(100).EUt(VA[ULV]) + .inputItems(CustomTags.WOODEN_CHESTS).inputItems(new ItemStack(Items.SHULKER_SHELL, 2)) + .outputItems(new ItemStack(Blocks.PURPLE_SHULKER_BOX)).save(provider); + + ASSEMBLER_RECIPES.recipeBuilder("painting").duration(100).EUt(4).circuitMeta(1).inputItems(ItemTags.WOOL) + .inputItems(new ItemStack(Items.STICK, 8)).outputItems(new ItemStack(Items.PAINTING)).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("item_frame").duration(100).EUt(4).inputItems(new ItemStack(Items.LEATHER)) + .inputItems(new ItemStack(Items.STICK, 8)).outputItems(new ItemStack(Items.ITEM_FRAME)).save(provider); + + ASSEMBLER_RECIPES.recipeBuilder("oak_sign").duration(100).EUt(4).inputItems(Items.OAK_PLANKS, 6) + .inputItems(new ItemStack(Items.STICK)).circuitMeta(3).outputItems(Items.OAK_SIGN, 3).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("spruce_sign").duration(100).EUt(4).inputItems(Items.SPRUCE_PLANKS, 6) + .inputItems(new ItemStack(Items.STICK)).circuitMeta(3).outputItems(Items.SPRUCE_SIGN, 3).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("birch_sign").duration(100).EUt(4).inputItems(Items.BIRCH_PLANKS, 6) + .inputItems(new ItemStack(Items.STICK)).circuitMeta(3).outputItems(Items.BIRCH_SIGN, 3).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("jungle_sign").duration(100).EUt(4).inputItems(Items.JUNGLE_PLANKS, 6) + .inputItems(new ItemStack(Items.STICK)).circuitMeta(3).outputItems(Items.JUNGLE_SIGN, 3).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("acacia_sign").duration(100).EUt(4).inputItems(Items.ACACIA_PLANKS, 6) + .inputItems(new ItemStack(Items.STICK)).circuitMeta(3).outputItems(Items.ACACIA_SIGN, 3).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("cherry_sign").duration(100).EUt(4).inputItems(Items.CHERRY_PLANKS, 6) + .inputItems(new ItemStack(Items.STICK)).circuitMeta(3).outputItems(Items.CHERRY_SIGN, 3).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("dark_oak_sign").duration(100).EUt(4).inputItems(Items.DARK_OAK_PLANKS, 6) + .inputItems(new ItemStack(Items.STICK)).circuitMeta(3).outputItems(Items.DARK_OAK_SIGN, 3) + .save(provider); + ASSEMBLER_RECIPES.recipeBuilder("mangrove_sign").duration(100).EUt(4).inputItems(Items.MANGROVE_PLANKS, 6) + .inputItems(new ItemStack(Items.STICK)).circuitMeta(3).outputItems(Items.MANGROVE_SIGN, 3) + .save(provider); + ASSEMBLER_RECIPES.recipeBuilder("bamboo_sign").duration(100).EUt(4).inputItems(Items.BAMBOO_PLANKS, 6) + .inputItems(new ItemStack(Items.STICK)).circuitMeta(3).outputItems(Items.BAMBOO_SIGN, 3).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("crimson_sign").duration(100).EUt(4).inputItems(Items.CRIMSON_PLANKS, 6) + .inputItems(new ItemStack(Items.STICK)).circuitMeta(3).outputItems(Items.CRIMSON_SIGN, 3) + .save(provider); + ASSEMBLER_RECIPES.recipeBuilder("warped_sign").duration(100).EUt(4).inputItems(Items.WARPED_PLANKS, 6) + .inputItems(new ItemStack(Items.STICK)).circuitMeta(3).outputItems(Items.WARPED_SIGN, 3).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("flower_pot").duration(10).EUt(2).inputItems(new ItemStack(Items.BRICK, 3)).outputItems(new ItemStack(Items.FLOWER_POT)).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("flower_pot").duration(10).EUt(2).inputItems(new ItemStack(Items.BRICK, 3)) + .outputItems(new ItemStack(Items.FLOWER_POT)).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("end_crystal").duration(30).EUt(16).inputItems(new ItemStack(Items.GHAST_TEAR)).inputItems(new ItemStack(Items.ENDER_EYE)).outputItems(new ItemStack(Items.END_CRYSTAL)).inputFluids(Glass.getFluid(L * 7)).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("end_crystal").duration(30).EUt(16).inputItems(new ItemStack(Items.GHAST_TEAR)) + .inputItems(new ItemStack(Items.ENDER_EYE)).outputItems(new ItemStack(Items.END_CRYSTAL)) + .inputFluids(Glass.getFluid(L * 7)).save(provider); ASSEMBLER_RECIPES.recipeBuilder("rail") .inputItems(rod, Iron, 12) @@ -947,8 +1041,7 @@ private static void miscRecipes(Consumer provider) { 'L', new ItemStack(Items.LEATHER), 'C', ItemTags.WOOL_CARPETS, 'R', new UnificationEntry(ring, Iron), - 'S', new ItemStack(Items.STRING) - ); + 'S', new ItemStack(Items.STRING)); AUTOCLAVE_RECIPES.recipeBuilder("clay_from_dust") .inputItems(dust, Clay) @@ -1021,8 +1114,12 @@ private static void miscRecipes(Consumer provider) { .outputItems(Items.CLAY) .duration(40).EUt(VA[LV]).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("ender_chest").duration(100).EUt(4).inputItems(new ItemStack(Blocks.OBSIDIAN, 8)).inputItems(new ItemStack(Items.ENDER_EYE)).outputItems(new ItemStack(Blocks.ENDER_CHEST)).save(provider); - ASSEMBLER_RECIPES.recipeBuilder("armor_stand").duration(30).EUt(VA[ULV]).inputItems(new ItemStack(Blocks.SMOOTH_STONE_SLAB, 1)).inputItems(new ItemStack(Items.STICK, 6)).outputItems(new ItemStack(Items.ARMOR_STAND)).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("ender_chest").duration(100).EUt(4) + .inputItems(new ItemStack(Blocks.OBSIDIAN, 8)).inputItems(new ItemStack(Items.ENDER_EYE)) + .outputItems(new ItemStack(Blocks.ENDER_CHEST)).save(provider); + ASSEMBLER_RECIPES.recipeBuilder("armor_stand").duration(30).EUt(VA[ULV]) + .inputItems(new ItemStack(Blocks.SMOOTH_STONE_SLAB, 1)).inputItems(new ItemStack(Items.STICK, 6)) + .outputItems(new ItemStack(Items.ARMOR_STAND)).save(provider); } /** @@ -1051,7 +1148,6 @@ private static void mixingRecipes(Consumer provider) { } private static void dyeRecipes(Consumer provider) { - EXTRACTOR_RECIPES.recipeBuilder("poppy_dye") .inputItems(new ItemStack(Blocks.POPPY)) .outputItems(new ItemStack(Items.RED_DYE, 2)) diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/WoodMachineRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/WoodMachineRecipes.java index 617946bd35..41100d1ffb 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/WoodMachineRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/WoodMachineRecipes.java @@ -11,7 +11,9 @@ import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.data.recipe.VanillaRecipeHelper; import com.gregtechceu.gtceu.data.recipe.WoodTypeEntry; + import com.lowdragmc.lowdraglib.side.fluid.forge.FluidHelperImpl; + import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.ItemTags; @@ -19,6 +21,7 @@ import net.minecraft.world.item.Items; import net.minecraftforge.common.Tags; import net.minecraftforge.fluids.FluidUtil; + import org.jetbrains.annotations.NotNull; import java.util.Arrays; @@ -45,196 +48,196 @@ private static List getDefaultEntries() { if (DEFAULT_ENTRIES == null) { final String mcModId = "minecraft"; return DEFAULT_ENTRIES = Arrays.asList( - new WoodTypeEntry.Builder(mcModId, "oak") - .planks(Items.OAK_PLANKS, "oak_planks") - .log(Items.OAK_LOG).removeCharcoalRecipe() - .strippedLog(Items.STRIPPED_OAK_LOG) - .wood(Items.OAK_WOOD) - .strippedWood(Items.STRIPPED_OAK_WOOD) - .door(Items.OAK_DOOR, "oak_door") - .trapdoor(Items.OAK_TRAPDOOR, "oak_trapdoor") - .slab(Items.OAK_SLAB, "oak_slab") - .fence(Items.OAK_FENCE, "oak_fence") - .fenceGate(Items.OAK_FENCE_GATE, "oak_fence_gate") - .stairs(Items.OAK_STAIRS, "oak_stairs") - .boat(Items.OAK_BOAT, "oak_boat") - .registerAllUnificationInfo() - .build(), - new WoodTypeEntry.Builder(mcModId, "spruce") - .planks(Items.SPRUCE_PLANKS, "spruce_planks") - .log(Items.SPRUCE_LOG).removeCharcoalRecipe() - .strippedLog(Items.STRIPPED_SPRUCE_LOG) - .wood(Items.SPRUCE_WOOD) - .strippedWood(Items.STRIPPED_SPRUCE_WOOD) - .door(Items.SPRUCE_DOOR, "spruce_door") - .trapdoor(Items.SPRUCE_TRAPDOOR, "spruce_trapdoor") - .slab(Items.SPRUCE_SLAB, "spruce_slab") - .fence(Items.SPRUCE_FENCE, "spruce_fence") - .fenceGate(Items.SPRUCE_FENCE_GATE, "spruce_fence_gate") - .stairs(Items.SPRUCE_STAIRS, "spruce_stairs") - .boat(Items.SPRUCE_BOAT, "spruce_boat") - .registerAllUnificationInfo() - .build(), - new WoodTypeEntry.Builder(mcModId, "birch") - .planks(Items.BIRCH_PLANKS, "birch_planks") - .log(Items.BIRCH_LOG).removeCharcoalRecipe() - .strippedLog(Items.STRIPPED_BIRCH_LOG) - .wood(Items.BIRCH_WOOD) - .strippedWood(Items.STRIPPED_BIRCH_WOOD) - .door(Items.BIRCH_DOOR, "birch_door") - .trapdoor(Items.BIRCH_TRAPDOOR, "birch_trapdoor") - .slab(Items.BIRCH_SLAB, "birch_slab") - .fence(Items.BIRCH_FENCE, "birch_fence") - .fenceGate(Items.BIRCH_FENCE_GATE, "birch_fence_gate") - .stairs(Items.BIRCH_STAIRS, "birch_stairs") - .boat(Items.BIRCH_BOAT, "birch_boat") - .registerAllUnificationInfo() - .build(), - new WoodTypeEntry.Builder(mcModId, "jungle") - .planks(Items.JUNGLE_PLANKS, "jungle_planks") - .log(Items.JUNGLE_LOG).removeCharcoalRecipe() - .strippedLog(Items.STRIPPED_JUNGLE_LOG) - .wood(Items.JUNGLE_WOOD) - .strippedWood(Items.STRIPPED_JUNGLE_WOOD) - .door(Items.JUNGLE_DOOR, "jungle_door") - .trapdoor(Items.JUNGLE_TRAPDOOR, "jungle_trapdoor") - .slab(Items.JUNGLE_SLAB, "jungle_slab") - .fence(Items.JUNGLE_FENCE, "jungle_fence") - .fenceGate(Items.JUNGLE_FENCE_GATE, "jungle_fence_gate") - .stairs(Items.JUNGLE_STAIRS, "jungle_stairs") - .boat(Items.JUNGLE_BOAT, "jungle_boat") - .registerAllUnificationInfo() - .build(), - new WoodTypeEntry.Builder(mcModId, "acacia") - .planks(Items.ACACIA_PLANKS, "acacia_planks") - .log(Items.ACACIA_LOG).removeCharcoalRecipe() - .strippedLog(Items.STRIPPED_ACACIA_LOG) - .wood(Items.ACACIA_WOOD) - .strippedWood(Items.STRIPPED_ACACIA_WOOD) - .door(Items.ACACIA_DOOR, "acacia_door") - .trapdoor(Items.ACACIA_TRAPDOOR, "acacia_trapdoor") - .slab(Items.ACACIA_SLAB, "acacia_slab") - .fence(Items.ACACIA_FENCE, "acacia_fence") - .fenceGate(Items.ACACIA_FENCE_GATE, "acacia_fence_gate") - .stairs(Items.ACACIA_STAIRS, "acacia_stairs") - .boat(Items.ACACIA_BOAT, "acacia_boat") - .registerAllUnificationInfo() - .build(), - new WoodTypeEntry.Builder(mcModId, "dark_oak") - .planks(Items.DARK_OAK_PLANKS, "dark_oak_planks") - .log(Items.DARK_OAK_LOG).removeCharcoalRecipe() - .strippedLog(Items.STRIPPED_DARK_OAK_LOG) - .wood(Items.DARK_OAK_WOOD) - .strippedWood(Items.STRIPPED_DARK_OAK_WOOD) - .door(Items.DARK_OAK_DOOR, "dark_oak_door") - .trapdoor(Items.DARK_OAK_TRAPDOOR, "dark_oak_trapdoor") - .slab(Items.DARK_OAK_SLAB, "dark_oak_slab") - .fence(Items.DARK_OAK_FENCE, "dark_oak_fence") - .fenceGate(Items.DARK_OAK_FENCE_GATE, "dark_oak_fence_gate") - .stairs(Items.DARK_OAK_STAIRS, "dark_oak_stairs") - .boat(Items.DARK_OAK_BOAT, "dark_oak_boat") - .registerAllUnificationInfo() - .build(), - new WoodTypeEntry.Builder(mcModId, "bamboo") - .planks(Items.BAMBOO_PLANKS, "bamboo_planks") - .log(Items.BAMBOO_BLOCK).removeCharcoalRecipe() - .strippedLog(Items.STRIPPED_BAMBOO_BLOCK) - .door(Items.BAMBOO_DOOR, "bamboo_door") - .trapdoor(Items.BAMBOO_TRAPDOOR, "bamboo_trapdoor") - .slab(Items.BAMBOO_SLAB, "bamboo_slab") - .fence(Items.BAMBOO_FENCE, "bamboo_fence") - .fenceGate(Items.BAMBOO_FENCE_GATE, "bamboo_fence_gate") - .stairs(Items.BAMBOO_STAIRS, "bamboo_stairs") - .boat(Items.BAMBOO_RAFT, "bamboo_raft") - .registerAllUnificationInfo() - .build(), - new WoodTypeEntry.Builder(mcModId, "cherry") - .planks(Items.CHERRY_PLANKS, "cherry_planks") - .log(Items.CHERRY_LOG).removeCharcoalRecipe() - .strippedLog(Items.STRIPPED_CHERRY_LOG) - .wood(Items.CHERRY_WOOD) - .strippedWood(Items.STRIPPED_CHERRY_WOOD) - .door(Items.CHERRY_DOOR, "cherry_door") - .trapdoor(Items.CHERRY_TRAPDOOR, "cherry_trapdoor") - .slab(Items.CHERRY_SLAB, "cherry_slab") - .fence(Items.CHERRY_FENCE, "cherry_fence") - .fenceGate(Items.CHERRY_FENCE_GATE, "cherry_fence_gate") - .stairs(Items.CHERRY_STAIRS, "cherry_stairs") - .boat(Items.CHERRY_BOAT, "cherry_boat") - .registerAllUnificationInfo() - .build(), - new WoodTypeEntry.Builder(mcModId, "mangrove") - .planks(Items.MANGROVE_PLANKS, "mangrove_planks") - .log(Items.MANGROVE_LOG).removeCharcoalRecipe() - .strippedLog(Items.STRIPPED_MANGROVE_LOG) - .wood(Items.MANGROVE_WOOD) - .strippedWood(Items.STRIPPED_MANGROVE_WOOD) - .door(Items.MANGROVE_DOOR, "mangrove_door") - .trapdoor(Items.MANGROVE_TRAPDOOR, "mangrove_trapdoor") - .slab(Items.MANGROVE_SLAB, "mangrove_slab") - .fence(Items.MANGROVE_FENCE, "mangrove_fence") - .fenceGate(Items.MANGROVE_FENCE_GATE, "mangrove_fence_gate") - .stairs(Items.MANGROVE_STAIRS, "mangrove_stairs") - .boat(Items.MANGROVE_BOAT, "mangrove_boat") - .registerAllUnificationInfo() - .build(), - new WoodTypeEntry.Builder(mcModId, "crimson") - .planks(Items.CRIMSON_PLANKS, "crimson_planks") - .log(Items.CRIMSON_STEM).removeCharcoalRecipe() - .strippedLog(Items.STRIPPED_CRIMSON_STEM) - .wood(Items.CRIMSON_HYPHAE) - .strippedWood(Items.STRIPPED_CRIMSON_HYPHAE) - .door(Items.CRIMSON_DOOR, "crimson_door") - .trapdoor(Items.CRIMSON_TRAPDOOR, "crimson_trapdoor") - .slab(Items.CRIMSON_SLAB, "crimson_slab") - .fence(Items.CRIMSON_FENCE, "crimson_fence") - .fenceGate(Items.CRIMSON_FENCE_GATE, "crimson_fence_gate") - .stairs(Items.CRIMSON_STAIRS, "crimson_stairs") - .registerAllUnificationInfo() - .build(), - new WoodTypeEntry.Builder(mcModId, "warped") - .planks(Items.WARPED_PLANKS, "warped_planks") - .log(Items.WARPED_STEM).removeCharcoalRecipe() - .strippedLog(Items.STRIPPED_WARPED_STEM) - .wood(Items.WARPED_HYPHAE) - .strippedWood(Items.STRIPPED_WARPED_HYPHAE) - .door(Items.WARPED_DOOR, "warped_door") - .trapdoor(Items.WARPED_TRAPDOOR, "warped_trapdoor") - .slab(Items.WARPED_SLAB, "warped_slab") - .fence(Items.WARPED_FENCE, "warped_fence") - .fenceGate(Items.WARPED_FENCE_GATE, "warped_fence_gate") - .stairs(Items.WARPED_STAIRS, "warped_stairs") - .registerAllUnificationInfo() - .build(), - new WoodTypeEntry.Builder(GTCEu.MOD_ID, "rubber") - .planks(GTBlocks.RUBBER_PLANK.asItem(), null) - .log(GTBlocks.RUBBER_LOG.asItem()).addCharcoalRecipe() - .strippedLog(GTBlocks.STRIPPED_RUBBER_LOG.asItem()) - .wood(GTBlocks.RUBBER_WOOD.asItem()) - .strippedWood(GTBlocks.STRIPPED_RUBBER_WOOD.asItem()) - .door(GTBlocks.RUBBER_DOOR.asItem(), null) - .trapdoor(GTBlocks.RUBBER_TRAPDOOR.asItem(), null) - .slab(GTBlocks.RUBBER_SLAB.asItem(), null).addSlabRecipe() - .fence(GTBlocks.RUBBER_FENCE.asItem(), null) - .fenceGate(GTBlocks.RUBBER_FENCE_GATE.asItem(), null) - .stairs(GTBlocks.RUBBER_STAIRS.asItem(), null).addStairsRecipe() - //.boat(GTItems.RUBBER_BOAT.asItem(), null) // TODO someone forgot boat textures. - .registerAllTags() - .registerAllUnificationInfo() - .build(), - new WoodTypeEntry.Builder(GTCEu.MOD_ID, "treated") - .planks(GTBlocks.TREATED_WOOD_PLANK.asItem(), null) - .door(GTBlocks.TREATED_WOOD_DOOR.asItem(), null) - .trapdoor(GTBlocks.TREATED_WOOD_TRAPDOOR.asItem(), null) - .slab(GTBlocks.TREATED_WOOD_SLAB.asItem(), null).addSlabRecipe() - .fence(GTBlocks.TREATED_WOOD_FENCE.asItem(), null) - .fenceGate(GTBlocks.TREATED_WOOD_FENCE_GATE.asItem(), null) - .stairs(GTBlocks.TREATED_WOOD_STAIRS.asItem(), null).addStairsRecipe() - //.boat(GTItems.TREATED_WOOD_BOAT.asItem(), null) // TODO someone forgot boat textures. - .material(TreatedWood) - .registerAllTags() - .registerAllUnificationInfo() - .build()); + new WoodTypeEntry.Builder(mcModId, "oak") + .planks(Items.OAK_PLANKS, "oak_planks") + .log(Items.OAK_LOG).removeCharcoalRecipe() + .strippedLog(Items.STRIPPED_OAK_LOG) + .wood(Items.OAK_WOOD) + .strippedWood(Items.STRIPPED_OAK_WOOD) + .door(Items.OAK_DOOR, "oak_door") + .trapdoor(Items.OAK_TRAPDOOR, "oak_trapdoor") + .slab(Items.OAK_SLAB, "oak_slab") + .fence(Items.OAK_FENCE, "oak_fence") + .fenceGate(Items.OAK_FENCE_GATE, "oak_fence_gate") + .stairs(Items.OAK_STAIRS, "oak_stairs") + .boat(Items.OAK_BOAT, "oak_boat") + .registerAllUnificationInfo() + .build(), + new WoodTypeEntry.Builder(mcModId, "spruce") + .planks(Items.SPRUCE_PLANKS, "spruce_planks") + .log(Items.SPRUCE_LOG).removeCharcoalRecipe() + .strippedLog(Items.STRIPPED_SPRUCE_LOG) + .wood(Items.SPRUCE_WOOD) + .strippedWood(Items.STRIPPED_SPRUCE_WOOD) + .door(Items.SPRUCE_DOOR, "spruce_door") + .trapdoor(Items.SPRUCE_TRAPDOOR, "spruce_trapdoor") + .slab(Items.SPRUCE_SLAB, "spruce_slab") + .fence(Items.SPRUCE_FENCE, "spruce_fence") + .fenceGate(Items.SPRUCE_FENCE_GATE, "spruce_fence_gate") + .stairs(Items.SPRUCE_STAIRS, "spruce_stairs") + .boat(Items.SPRUCE_BOAT, "spruce_boat") + .registerAllUnificationInfo() + .build(), + new WoodTypeEntry.Builder(mcModId, "birch") + .planks(Items.BIRCH_PLANKS, "birch_planks") + .log(Items.BIRCH_LOG).removeCharcoalRecipe() + .strippedLog(Items.STRIPPED_BIRCH_LOG) + .wood(Items.BIRCH_WOOD) + .strippedWood(Items.STRIPPED_BIRCH_WOOD) + .door(Items.BIRCH_DOOR, "birch_door") + .trapdoor(Items.BIRCH_TRAPDOOR, "birch_trapdoor") + .slab(Items.BIRCH_SLAB, "birch_slab") + .fence(Items.BIRCH_FENCE, "birch_fence") + .fenceGate(Items.BIRCH_FENCE_GATE, "birch_fence_gate") + .stairs(Items.BIRCH_STAIRS, "birch_stairs") + .boat(Items.BIRCH_BOAT, "birch_boat") + .registerAllUnificationInfo() + .build(), + new WoodTypeEntry.Builder(mcModId, "jungle") + .planks(Items.JUNGLE_PLANKS, "jungle_planks") + .log(Items.JUNGLE_LOG).removeCharcoalRecipe() + .strippedLog(Items.STRIPPED_JUNGLE_LOG) + .wood(Items.JUNGLE_WOOD) + .strippedWood(Items.STRIPPED_JUNGLE_WOOD) + .door(Items.JUNGLE_DOOR, "jungle_door") + .trapdoor(Items.JUNGLE_TRAPDOOR, "jungle_trapdoor") + .slab(Items.JUNGLE_SLAB, "jungle_slab") + .fence(Items.JUNGLE_FENCE, "jungle_fence") + .fenceGate(Items.JUNGLE_FENCE_GATE, "jungle_fence_gate") + .stairs(Items.JUNGLE_STAIRS, "jungle_stairs") + .boat(Items.JUNGLE_BOAT, "jungle_boat") + .registerAllUnificationInfo() + .build(), + new WoodTypeEntry.Builder(mcModId, "acacia") + .planks(Items.ACACIA_PLANKS, "acacia_planks") + .log(Items.ACACIA_LOG).removeCharcoalRecipe() + .strippedLog(Items.STRIPPED_ACACIA_LOG) + .wood(Items.ACACIA_WOOD) + .strippedWood(Items.STRIPPED_ACACIA_WOOD) + .door(Items.ACACIA_DOOR, "acacia_door") + .trapdoor(Items.ACACIA_TRAPDOOR, "acacia_trapdoor") + .slab(Items.ACACIA_SLAB, "acacia_slab") + .fence(Items.ACACIA_FENCE, "acacia_fence") + .fenceGate(Items.ACACIA_FENCE_GATE, "acacia_fence_gate") + .stairs(Items.ACACIA_STAIRS, "acacia_stairs") + .boat(Items.ACACIA_BOAT, "acacia_boat") + .registerAllUnificationInfo() + .build(), + new WoodTypeEntry.Builder(mcModId, "dark_oak") + .planks(Items.DARK_OAK_PLANKS, "dark_oak_planks") + .log(Items.DARK_OAK_LOG).removeCharcoalRecipe() + .strippedLog(Items.STRIPPED_DARK_OAK_LOG) + .wood(Items.DARK_OAK_WOOD) + .strippedWood(Items.STRIPPED_DARK_OAK_WOOD) + .door(Items.DARK_OAK_DOOR, "dark_oak_door") + .trapdoor(Items.DARK_OAK_TRAPDOOR, "dark_oak_trapdoor") + .slab(Items.DARK_OAK_SLAB, "dark_oak_slab") + .fence(Items.DARK_OAK_FENCE, "dark_oak_fence") + .fenceGate(Items.DARK_OAK_FENCE_GATE, "dark_oak_fence_gate") + .stairs(Items.DARK_OAK_STAIRS, "dark_oak_stairs") + .boat(Items.DARK_OAK_BOAT, "dark_oak_boat") + .registerAllUnificationInfo() + .build(), + new WoodTypeEntry.Builder(mcModId, "bamboo") + .planks(Items.BAMBOO_PLANKS, "bamboo_planks") + .log(Items.BAMBOO_BLOCK).removeCharcoalRecipe() + .strippedLog(Items.STRIPPED_BAMBOO_BLOCK) + .door(Items.BAMBOO_DOOR, "bamboo_door") + .trapdoor(Items.BAMBOO_TRAPDOOR, "bamboo_trapdoor") + .slab(Items.BAMBOO_SLAB, "bamboo_slab") + .fence(Items.BAMBOO_FENCE, "bamboo_fence") + .fenceGate(Items.BAMBOO_FENCE_GATE, "bamboo_fence_gate") + .stairs(Items.BAMBOO_STAIRS, "bamboo_stairs") + .boat(Items.BAMBOO_RAFT, "bamboo_raft") + .registerAllUnificationInfo() + .build(), + new WoodTypeEntry.Builder(mcModId, "cherry") + .planks(Items.CHERRY_PLANKS, "cherry_planks") + .log(Items.CHERRY_LOG).removeCharcoalRecipe() + .strippedLog(Items.STRIPPED_CHERRY_LOG) + .wood(Items.CHERRY_WOOD) + .strippedWood(Items.STRIPPED_CHERRY_WOOD) + .door(Items.CHERRY_DOOR, "cherry_door") + .trapdoor(Items.CHERRY_TRAPDOOR, "cherry_trapdoor") + .slab(Items.CHERRY_SLAB, "cherry_slab") + .fence(Items.CHERRY_FENCE, "cherry_fence") + .fenceGate(Items.CHERRY_FENCE_GATE, "cherry_fence_gate") + .stairs(Items.CHERRY_STAIRS, "cherry_stairs") + .boat(Items.CHERRY_BOAT, "cherry_boat") + .registerAllUnificationInfo() + .build(), + new WoodTypeEntry.Builder(mcModId, "mangrove") + .planks(Items.MANGROVE_PLANKS, "mangrove_planks") + .log(Items.MANGROVE_LOG).removeCharcoalRecipe() + .strippedLog(Items.STRIPPED_MANGROVE_LOG) + .wood(Items.MANGROVE_WOOD) + .strippedWood(Items.STRIPPED_MANGROVE_WOOD) + .door(Items.MANGROVE_DOOR, "mangrove_door") + .trapdoor(Items.MANGROVE_TRAPDOOR, "mangrove_trapdoor") + .slab(Items.MANGROVE_SLAB, "mangrove_slab") + .fence(Items.MANGROVE_FENCE, "mangrove_fence") + .fenceGate(Items.MANGROVE_FENCE_GATE, "mangrove_fence_gate") + .stairs(Items.MANGROVE_STAIRS, "mangrove_stairs") + .boat(Items.MANGROVE_BOAT, "mangrove_boat") + .registerAllUnificationInfo() + .build(), + new WoodTypeEntry.Builder(mcModId, "crimson") + .planks(Items.CRIMSON_PLANKS, "crimson_planks") + .log(Items.CRIMSON_STEM).removeCharcoalRecipe() + .strippedLog(Items.STRIPPED_CRIMSON_STEM) + .wood(Items.CRIMSON_HYPHAE) + .strippedWood(Items.STRIPPED_CRIMSON_HYPHAE) + .door(Items.CRIMSON_DOOR, "crimson_door") + .trapdoor(Items.CRIMSON_TRAPDOOR, "crimson_trapdoor") + .slab(Items.CRIMSON_SLAB, "crimson_slab") + .fence(Items.CRIMSON_FENCE, "crimson_fence") + .fenceGate(Items.CRIMSON_FENCE_GATE, "crimson_fence_gate") + .stairs(Items.CRIMSON_STAIRS, "crimson_stairs") + .registerAllUnificationInfo() + .build(), + new WoodTypeEntry.Builder(mcModId, "warped") + .planks(Items.WARPED_PLANKS, "warped_planks") + .log(Items.WARPED_STEM).removeCharcoalRecipe() + .strippedLog(Items.STRIPPED_WARPED_STEM) + .wood(Items.WARPED_HYPHAE) + .strippedWood(Items.STRIPPED_WARPED_HYPHAE) + .door(Items.WARPED_DOOR, "warped_door") + .trapdoor(Items.WARPED_TRAPDOOR, "warped_trapdoor") + .slab(Items.WARPED_SLAB, "warped_slab") + .fence(Items.WARPED_FENCE, "warped_fence") + .fenceGate(Items.WARPED_FENCE_GATE, "warped_fence_gate") + .stairs(Items.WARPED_STAIRS, "warped_stairs") + .registerAllUnificationInfo() + .build(), + new WoodTypeEntry.Builder(GTCEu.MOD_ID, "rubber") + .planks(GTBlocks.RUBBER_PLANK.asItem(), null) + .log(GTBlocks.RUBBER_LOG.asItem()).addCharcoalRecipe() + .strippedLog(GTBlocks.STRIPPED_RUBBER_LOG.asItem()) + .wood(GTBlocks.RUBBER_WOOD.asItem()) + .strippedWood(GTBlocks.STRIPPED_RUBBER_WOOD.asItem()) + .door(GTBlocks.RUBBER_DOOR.asItem(), null) + .trapdoor(GTBlocks.RUBBER_TRAPDOOR.asItem(), null) + .slab(GTBlocks.RUBBER_SLAB.asItem(), null).addSlabRecipe() + .fence(GTBlocks.RUBBER_FENCE.asItem(), null) + .fenceGate(GTBlocks.RUBBER_FENCE_GATE.asItem(), null) + .stairs(GTBlocks.RUBBER_STAIRS.asItem(), null).addStairsRecipe() + // .boat(GTItems.RUBBER_BOAT.asItem(), null) // TODO someone forgot boat textures. + .registerAllTags() + .registerAllUnificationInfo() + .build(), + new WoodTypeEntry.Builder(GTCEu.MOD_ID, "treated") + .planks(GTBlocks.TREATED_WOOD_PLANK.asItem(), null) + .door(GTBlocks.TREATED_WOOD_DOOR.asItem(), null) + .trapdoor(GTBlocks.TREATED_WOOD_TRAPDOOR.asItem(), null) + .slab(GTBlocks.TREATED_WOOD_SLAB.asItem(), null).addSlabRecipe() + .fence(GTBlocks.TREATED_WOOD_FENCE.asItem(), null) + .fenceGate(GTBlocks.TREATED_WOOD_FENCE_GATE.asItem(), null) + .stairs(GTBlocks.TREATED_WOOD_STAIRS.asItem(), null).addStairsRecipe() + // .boat(GTItems.TREATED_WOOD_BOAT.asItem(), null) // TODO someone forgot boat textures. + .material(TreatedWood) + .registerAllTags() + .registerAllUnificationInfo() + .build()); } return DEFAULT_ENTRIES; } @@ -250,8 +253,10 @@ public static void registerUnificationInfo() { */ private static void registerWoodRecipes(Consumer provider) { if (ConfigHolder.INSTANCE.recipes.nerfWoodCrafting) { - VanillaRecipeHelper.addShapedRecipe(provider, "stick_saw", new ItemStack(Items.STICK, 4), "s", "P", "P", 'P', ItemTags.PLANKS); - VanillaRecipeHelper.addShapedRecipe(provider, "stick_normal", new ItemStack(Items.STICK, 2), "P", "P", 'P', ItemTags.PLANKS); + VanillaRecipeHelper.addShapedRecipe(provider, "stick_saw", new ItemStack(Items.STICK, 4), "s", "P", "P", + 'P', ItemTags.PLANKS); + VanillaRecipeHelper.addShapedRecipe(provider, "stick_normal", new ItemStack(Items.STICK, 2), "P", "P", 'P', + ItemTags.PLANKS); } for (WoodTypeEntry entry : getDefaultEntries()) { @@ -273,7 +278,8 @@ public static void registerWoodUnificationInfo(@NotNull WoodTypeEntry entry) { ChemicalHelper.registerUnificationItems(planks, entry.material, entry.planks); } if (entry.addPlanksUnificationInfo) { - ChemicalHelper.registerMaterialInfo(entry.planks, new ItemMaterialInfo(new MaterialStack(entry.material, M))); + ChemicalHelper.registerMaterialInfo(entry.planks, + new ItemMaterialInfo(new MaterialStack(entry.material, M))); } if (entry.door != null) { @@ -282,9 +288,9 @@ public static void registerWoodUnificationInfo(@NotNull WoodTypeEntry entry) { } if (entry.addDoorsUnificationInfo) { ChemicalHelper.registerMaterialInfo(entry.door, ConfigHolder.INSTANCE.recipes.hardWoodRecipes ? - new ItemMaterialInfo(new MaterialStack(entry.material, M * 2), - new MaterialStack(GTMaterials.Iron, M / 9)) : // screw - new ItemMaterialInfo(new MaterialStack(entry.material, M * 2))); + new ItemMaterialInfo(new MaterialStack(entry.material, M * 2), + new MaterialStack(GTMaterials.Iron, M / 9)) : // screw + new ItemMaterialInfo(new MaterialStack(entry.material, M * 2))); } } @@ -293,7 +299,8 @@ public static void registerWoodUnificationInfo(@NotNull WoodTypeEntry entry) { ChemicalHelper.registerUnificationItems(slab, entry.material, entry.slab); } if (entry.addSlabsUnificationInfo) { - ChemicalHelper.registerMaterialInfo(entry.slab, new ItemMaterialInfo(new MaterialStack(entry.material, M / 2))); + ChemicalHelper.registerMaterialInfo(entry.slab, + new ItemMaterialInfo(new MaterialStack(entry.material, M / 2))); } } @@ -302,7 +309,8 @@ public static void registerWoodUnificationInfo(@NotNull WoodTypeEntry entry) { ChemicalHelper.registerUnificationItems(fence, entry.material, entry.fence); } if (entry.addFencesUnificationInfo) { - ChemicalHelper.registerMaterialInfo(entry.fence, new ItemMaterialInfo(new MaterialStack(entry.material, M))); + ChemicalHelper.registerMaterialInfo(entry.fence, + new ItemMaterialInfo(new MaterialStack(entry.material, M))); } } @@ -312,7 +320,7 @@ public static void registerWoodUnificationInfo(@NotNull WoodTypeEntry entry) { } if (entry.addFenceGatesUnificationInfo) { ChemicalHelper.registerMaterialInfo(entry.fenceGate, - new ItemMaterialInfo(new MaterialStack(entry.material, M * 3))); + new ItemMaterialInfo(new MaterialStack(entry.material, M * 3))); } } @@ -322,12 +330,13 @@ public static void registerWoodUnificationInfo(@NotNull WoodTypeEntry entry) { } if (entry.addStairsUnificationInfo) { ChemicalHelper.registerMaterialInfo(entry.stairs, - new ItemMaterialInfo(new MaterialStack(entry.material, (3 * M) / 2))); + new ItemMaterialInfo(new MaterialStack(entry.material, (3 * M) / 2))); } } if (entry.boat != null && entry.addBoatsUnificationInfo) { - ChemicalHelper.registerMaterialInfo(entry.boat, new ItemMaterialInfo(new MaterialStack(entry.material, M * 5))); + ChemicalHelper.registerMaterialInfo(entry.boat, + new ItemMaterialInfo(new MaterialStack(entry.material, M * 5))); } } @@ -339,7 +348,7 @@ public static void registerWoodUnificationInfo(@NotNull WoodTypeEntry entry) { public static void registerWoodTypeRecipe(Consumer provider, @NotNull WoodTypeEntry entry) { final String name = entry.woodName; - //noinspection ConstantValue can be null if someone does an oopsie and doesn't set it. + // noinspection ConstantValue can be null if someone does an oopsie and doesn't set it. if (entry.planks == null) { throw new IllegalStateException("Could not find planks form of WoodTypeEntry '" + name + "'."); } @@ -349,27 +358,29 @@ public static void registerWoodTypeRecipe(Consumer provider, @No // nerf regular log -> plank crafting, if enabled boolean hasPlanksRecipe = entry.planksRecipeName != null; if (ConfigHolder.INSTANCE.recipes.nerfWoodCrafting) { - VanillaRecipeHelper.addShapelessRecipe(provider, hasPlanksRecipe ? entry.planksRecipeName : name + "_planks", - new ItemStack(entry.planks, 2), entry.log); + VanillaRecipeHelper.addShapelessRecipe(provider, + hasPlanksRecipe ? entry.planksRecipeName : name + "_planks", + new ItemStack(entry.planks, 2), entry.log); } else { if (!hasPlanksRecipe) { - VanillaRecipeHelper.addShapelessRecipe(provider, name + "_planks", new ItemStack(entry.planks, 4), entry.log); + VanillaRecipeHelper.addShapelessRecipe(provider, name + "_planks", new ItemStack(entry.planks, 4), + entry.log); } } // log -> plank saw crafting VanillaRecipeHelper.addShapedRecipe(provider, name + "_planks_saw", - new ItemStack(entry.planks, ConfigHolder.INSTANCE.recipes.nerfWoodCrafting ? 4 : 6), - "s", "L", 'L', entry.log); + new ItemStack(entry.planks, ConfigHolder.INSTANCE.recipes.nerfWoodCrafting ? 4 : 6), + "s", "L", 'L', entry.log); // log -> plank cutting CUTTER_RECIPES.recipeBuilder(name + "_planks") - .inputItems(entry.log) - .outputItems(new ItemStack(entry.planks, 6)) - .outputItems(dust, Wood, 2) - .duration(200) - .EUt(VA[ULV]) - .save(provider); + .inputItems(entry.log) + .outputItems(new ItemStack(entry.planks, 6)) + .outputItems(dust, Wood, 2) + .duration(200) + .EUt(VA[ULV]) + .save(provider); } // door @@ -379,48 +390,48 @@ public static void registerWoodTypeRecipe(Consumer provider, @No String recipeName = hasDoorRecipe ? entry.doorRecipeName : name + "_door"; if (entry.trapdoor != null) { VanillaRecipeHelper.addShapedRecipe(provider, recipeName, new ItemStack(entry.door), - "PTd", "PRS", "PPs", - 'P', entry.planks, - 'T', entry.trapdoor, - 'R', new UnificationEntry(ring, Iron), - 'S', new UnificationEntry(screw, Iron)); + "PTd", "PRS", "PPs", + 'P', entry.planks, + 'T', entry.trapdoor, + 'R', new UnificationEntry(ring, Iron), + 'S', new UnificationEntry(screw, Iron)); // plank -> door assembling ASSEMBLER_RECIPES.recipeBuilder(name + "_door") - .inputItems(entry.trapdoor) - .inputItems(new ItemStack(entry.planks, 4)) - .inputFluids(Iron.getFluid(GTValues.L / 9)) - .outputItems(entry.door) - .duration(400).EUt(4).save(provider); + .inputItems(entry.trapdoor) + .inputItems(new ItemStack(entry.planks, 4)) + .inputFluids(Iron.getFluid(GTValues.L / 9)) + .outputItems(entry.door) + .duration(400).EUt(4).save(provider); } else { VanillaRecipeHelper.addShapedRecipe(provider, recipeName, new ItemStack(entry.door), - "PTd", "PRS", "PPs", - 'P', entry.planks, - 'T', ItemTags.WOODEN_TRAPDOORS, - 'R', new UnificationEntry(ring, Iron), - 'S', new UnificationEntry(screw, Iron)); + "PTd", "PRS", "PPs", + 'P', entry.planks, + 'T', ItemTags.WOODEN_TRAPDOORS, + 'R', new UnificationEntry(ring, Iron), + 'S', new UnificationEntry(screw, Iron)); // plank -> door assembling ASSEMBLER_RECIPES.recipeBuilder(name + "_door") - .inputItems(ItemTags.WOODEN_TRAPDOORS) - .inputItems(new ItemStack(entry.planks, 4)) - .inputFluids(Iron.getFluid(GTValues.L / 9)) - .outputItems(entry.door) - .duration(400).EUt(4).save(provider); + .inputItems(ItemTags.WOODEN_TRAPDOORS) + .inputItems(new ItemStack(entry.planks, 4)) + .inputFluids(Iron.getFluid(GTValues.L / 9)) + .outputItems(entry.door) + .duration(400).EUt(4).save(provider); } } else { if (!hasDoorRecipe) { VanillaRecipeHelper.addShapedRecipe(provider, name + "_door", new ItemStack(entry.door, 3), - "PP", "PP", "PP", - 'P', entry.planks); + "PP", "PP", "PP", + 'P', entry.planks); } ASSEMBLER_RECIPES.recipeBuilder(name + "_door") - .inputItems(new ItemStack(entry.planks, 6)) - .outputItems(new ItemStack(entry.door, 3)) - .circuitMeta(6) - .duration(600).EUt(4) - .save(provider); + .inputItems(new ItemStack(entry.planks, 6)) + .outputItems(new ItemStack(entry.door, 3)) + .circuitMeta(6) + .duration(600).EUt(4) + .save(provider); } } @@ -428,37 +439,38 @@ public static void registerWoodTypeRecipe(Consumer provider, @No if (entry.stairs != null) { final boolean hasStairRecipe = entry.stairsRecipeName != null; if (entry.addStairsCraftingRecipe) { - VanillaRecipeHelper.addShapedRecipe(provider, hasStairRecipe ? entry.stairsRecipeName : name + "_stairs", - new ItemStack(entry.stairs, 4), - "P ", "PP ", "PPP", - 'P', entry.planks); + VanillaRecipeHelper.addShapedRecipe(provider, + hasStairRecipe ? entry.stairsRecipeName : name + "_stairs", + new ItemStack(entry.stairs, 4), + "P ", "PP ", "PPP", + 'P', entry.planks); } // plank -> stairs assembling ASSEMBLER_RECIPES.recipeBuilder(name + "_stairs") - .inputItems(new ItemStack(entry.planks, 6)) - .outputItems(new ItemStack(entry.stairs, 4)) - .circuitMeta(7) - .EUt(1).duration(100).save(provider); + .inputItems(new ItemStack(entry.planks, 6)) + .outputItems(new ItemStack(entry.stairs, 4)) + .circuitMeta(7) + .EUt(1).duration(100).save(provider); } // slab if (entry.slab != null) { if (entry.addSlabCraftingRecipe && !ConfigHolder.INSTANCE.recipes.hardWoodRecipes) { VanillaRecipeHelper.addShapedRecipe(provider, name + "_slab", new ItemStack(entry.slab, 6), - "PPP", 'P', entry.planks); + "PPP", 'P', entry.planks); } // plank -> slab crafting VanillaRecipeHelper.addShapedRecipe(provider, name + "_slab_saw", new ItemStack(entry.slab, 2), - "sS", 'S', entry.planks); + "sS", 'S', entry.planks); // plank -> slab cutting CUTTER_RECIPES.recipeBuilder(name + "_slab") - .inputItems(entry.planks) - .outputItems(new ItemStack(entry.slab, 2)) - .duration(200).EUt(VA[ULV]) - .save(provider); + .inputItems(entry.planks) + .outputItems(new ItemStack(entry.slab, 2)) + .duration(200).EUt(VA[ULV]) + .save(provider); } // fence @@ -466,26 +478,27 @@ public static void registerWoodTypeRecipe(Consumer provider, @No final boolean hasFenceRecipe = entry.fenceRecipeName != null; if (ConfigHolder.INSTANCE.recipes.hardWoodRecipes) { - VanillaRecipeHelper.addShapedRecipe(provider, hasFenceRecipe ? entry.fenceRecipeName : name + "_fence", new ItemStack(entry.fence), - "PSP", "PSP", "PSP", - 'P', entry.planks, - 'S', entry.getStick()); + VanillaRecipeHelper.addShapedRecipe(provider, hasFenceRecipe ? entry.fenceRecipeName : name + "_fence", + new ItemStack(entry.fence), + "PSP", "PSP", "PSP", + 'P', entry.planks, + 'S', entry.getStick()); } else { if (!hasFenceRecipe) { VanillaRecipeHelper.addShapedRecipe(provider, name + "_fence", new ItemStack(entry.fence, 3), - "PSP", "PSP", - 'P', entry.planks, - 'S', entry.getStick()); + "PSP", "PSP", + 'P', entry.planks, + 'S', entry.getStick()); } } // plank -> fence assembling ASSEMBLER_RECIPES.recipeBuilder(name + "_fence") - .inputItems(entry.planks) - .outputItems(entry.fence) - .circuitMeta(1) - .duration(100).EUt(4) - .save(provider); + .inputItems(entry.planks) + .outputItems(entry.fence) + .circuitMeta(1) + .duration(100).EUt(4) + .save(provider); } // fence gate @@ -493,34 +506,36 @@ public static void registerWoodTypeRecipe(Consumer provider, @No final boolean hasFenceGateRecipe = entry.fenceGateRecipeName != null; if (ConfigHolder.INSTANCE.recipes.hardWoodRecipes) { - VanillaRecipeHelper.addShapedRecipe(provider, hasFenceGateRecipe ? entry.fenceGateRecipeName : name + "_fence_gate", - new ItemStack(entry.fenceGate), - "F F", "SPS", "SPS", - 'P', entry.planks, - 'S', entry.getStick(), - 'F', Items.FLINT); - - VanillaRecipeHelper.addShapedRecipe(provider, name + "_fence_gate_screws", new ItemStack(entry.fenceGate, 2), - "IdI", "SPS", "SPS", - 'P', entry.planks, - 'S', entry.getStick(), - 'I', new UnificationEntry(screw, Iron)); + VanillaRecipeHelper.addShapedRecipe(provider, + hasFenceGateRecipe ? entry.fenceGateRecipeName : name + "_fence_gate", + new ItemStack(entry.fenceGate), + "F F", "SPS", "SPS", + 'P', entry.planks, + 'S', entry.getStick(), + 'F', Items.FLINT); + + VanillaRecipeHelper.addShapedRecipe(provider, name + "_fence_gate_screws", + new ItemStack(entry.fenceGate, 2), + "IdI", "SPS", "SPS", + 'P', entry.planks, + 'S', entry.getStick(), + 'I', new UnificationEntry(screw, Iron)); } else { if (!hasFenceGateRecipe) { VanillaRecipeHelper.addShapedRecipe(provider, name + "_fence_gate", new ItemStack(entry.fenceGate), - "SPS", "SPS", - 'P', entry.planks, - 'S', entry.getStick()); + "SPS", "SPS", + 'P', entry.planks, + 'S', entry.getStick()); } } // plank -> fence gate assembling ASSEMBLER_RECIPES.recipeBuilder(name + "_fence_gate") - .inputItems(new ItemStack(entry.planks, 2)) - .inputItems(Tags.Items.RODS_WOODEN, 2) - .outputItems(entry.fenceGate) - .circuitMeta(2) - .duration(100).EUt(4).save(provider); + .inputItems(new ItemStack(entry.planks, 2)) + .inputItems(Tags.Items.RODS_WOODEN, 2) + .outputItems(entry.fenceGate) + .circuitMeta(2) + .duration(100).EUt(4).save(provider); } // boat @@ -529,26 +544,27 @@ public static void registerWoodTypeRecipe(Consumer provider, @No if (ConfigHolder.INSTANCE.recipes.hardWoodRecipes) { if (entry.slab != null) { - VanillaRecipeHelper.addShapedRecipe(provider, hasBoatRecipe ? entry.boatRecipeName : name + "_boat", new ItemStack(entry.boat), - "PHP", "PkP", "SSS", - 'P', entry.planks, - 'S', entry.slab, - 'H', ItemTags.SHOVELS); + VanillaRecipeHelper.addShapedRecipe(provider, hasBoatRecipe ? entry.boatRecipeName : name + "_boat", + new ItemStack(entry.boat), + "PHP", "PkP", "SSS", + 'P', entry.planks, + 'S', entry.slab, + 'H', ItemTags.SHOVELS); } } else { if (!hasBoatRecipe) { VanillaRecipeHelper.addShapedRecipe(provider, name + "_boat", new ItemStack(entry.boat), - "P P", "PPP", - 'P', entry.planks); + "P P", "PPP", + 'P', entry.planks); } } // plank -> boat assembling ASSEMBLER_RECIPES.recipeBuilder(name + "_boat") - .inputItems(new ItemStack(entry.planks, 5)) - .outputItems(entry.boat) - .circuitMeta(15) - .duration(100).EUt(4).save(provider); + .inputItems(new ItemStack(entry.planks, 5)) + .outputItems(entry.boat) + .circuitMeta(15) + .duration(100).EUt(4).save(provider); } } @@ -557,25 +573,30 @@ public static void registerWoodTypeRecipe(Consumer provider, @No */ private static void registerGTWoodRecipes(Consumer provider) { VanillaRecipeHelper.addShapedRecipe(provider, "treated_wood_planks", - GTBlocks.TREATED_WOOD_PLANK.asStack(8), - "PPP", "PBP", "PPP", - 'P', ItemTags.PLANKS, - 'B', FluidUtil.getFilledBucket(FluidHelperImpl.toFluidStack(Creosote.getFluid(1000)))); + GTBlocks.TREATED_WOOD_PLANK.asStack(8), + "PPP", "PBP", "PPP", + 'P', ItemTags.PLANKS, + 'B', FluidUtil.getFilledBucket(FluidHelperImpl.toFluidStack(Creosote.getFluid(1000)))); VanillaRecipeHelper.addShapedRecipe(provider, "treated_wood_stick", - ChemicalHelper.get(rod, TreatedWood, ConfigHolder.INSTANCE.recipes.nerfWoodCrafting ? 2 : 4), - "L", "L", - 'L', GTBlocks.TREATED_WOOD_PLANK.asItem()); - if (ConfigHolder.INSTANCE.recipes.nerfWoodCrafting) { - VanillaRecipeHelper.addShapedRecipe(provider, "treated_wood_stick_saw", ChemicalHelper.get(rod, TreatedWood, 4), - "s", "L", "L", + ChemicalHelper.get(rod, TreatedWood, ConfigHolder.INSTANCE.recipes.nerfWoodCrafting ? 2 : 4), + "L", "L", 'L', GTBlocks.TREATED_WOOD_PLANK.asItem()); + if (ConfigHolder.INSTANCE.recipes.nerfWoodCrafting) { + VanillaRecipeHelper.addShapedRecipe(provider, "treated_wood_stick_saw", + ChemicalHelper.get(rod, TreatedWood, 4), + "s", "L", "L", + 'L', GTBlocks.TREATED_WOOD_PLANK.asItem()); } - VanillaRecipeHelper.addShapelessRecipe(provider, "rubber_button", GTBlocks.RUBBER_BUTTON.asStack(), GTBlocks.RUBBER_PLANK.asStack()); - VanillaRecipeHelper.addShapelessRecipe(provider, "treated_wood_button", GTBlocks.TREATED_WOOD_BUTTON.asStack(), GTBlocks.TREATED_WOOD_PLANK.asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, "rubber_pressure_plate", GTBlocks.RUBBER_PRESSURE_PLATE.asStack(), "aa", 'a', GTBlocks.RUBBER_PLANK.asStack()); - VanillaRecipeHelper.addShapedRecipe(provider, "treated_wood_plate", GTBlocks.TREATED_WOOD_PRESSURE_PLATE.asStack(), "aa", 'a', GTBlocks.TREATED_WOOD_PLANK.asStack()); + VanillaRecipeHelper.addShapelessRecipe(provider, "rubber_button", GTBlocks.RUBBER_BUTTON.asStack(), + GTBlocks.RUBBER_PLANK.asStack()); + VanillaRecipeHelper.addShapelessRecipe(provider, "treated_wood_button", GTBlocks.TREATED_WOOD_BUTTON.asStack(), + GTBlocks.TREATED_WOOD_PLANK.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, "rubber_pressure_plate", GTBlocks.RUBBER_PRESSURE_PLATE.asStack(), + "aa", 'a', GTBlocks.RUBBER_PLANK.asStack()); + VanillaRecipeHelper.addShapedRecipe(provider, "treated_wood_plate", + GTBlocks.TREATED_WOOD_PRESSURE_PLATE.asStack(), "aa", 'a', GTBlocks.TREATED_WOOD_PLANK.asStack()); } public static void hardWoodRecipes(Consumer registry) { @@ -586,7 +607,7 @@ public static void hardWoodRecipes(Consumer registry) { hardWoodTypeRecipes(registry, entry); } } - + private static void hardWoodTypeRecipes(Consumer registry, @NotNull WoodTypeEntry entry) { if (ConfigHolder.INSTANCE.recipes.nerfWoodCrafting) { if (entry.planksRecipeName != null) { diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/alloyblast/AlloyBlastRecipeProducer.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/alloyblast/AlloyBlastRecipeProducer.java index 6e6168d7e9..43ae5eec28 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/alloyblast/AlloyBlastRecipeProducer.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/alloyblast/AlloyBlastRecipeProducer.java @@ -7,7 +7,6 @@ import com.gregtechceu.gtceu.api.data.chemical.material.properties.PropertyKey; import com.gregtechceu.gtceu.api.data.chemical.material.stack.MaterialStack; import com.gregtechceu.gtceu.api.data.tag.TagPrefix; -import com.gregtechceu.gtceu.api.fluids.store.FluidStorageKey; import com.gregtechceu.gtceu.api.fluids.store.FluidStorageKeys; import com.gregtechceu.gtceu.api.recipe.ingredient.FluidIngredient; import com.gregtechceu.gtceu.common.data.GCyMRecipeTypes; @@ -17,11 +16,14 @@ import com.gregtechceu.gtceu.data.recipe.CraftingComponent; import com.gregtechceu.gtceu.data.recipe.builder.GTRecipeBuilder; import com.gregtechceu.gtceu.utils.GTUtil; + import com.lowdragmc.lowdraglib.side.fluid.FluidStack; + import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.world.level.material.Fluid; import org.jetbrains.annotations.NotNull; + import java.util.function.Consumer; import static com.gregtechceu.gtceu.api.data.tag.TagPrefix.ingotHot; @@ -36,7 +38,8 @@ public class AlloyBlastRecipeProducer { * @param material the material to generate for * @param property the blast property of the material */ - public void produce(@NotNull Material material, @NotNull BlastProperty property, Consumer provider) { + public void produce(@NotNull Material material, @NotNull BlastProperty property, + Consumer provider) { // do not generate for disabled materials if (material.hasFlag(MaterialFlags.DISABLE_ALLOY_BLAST)) return; @@ -50,7 +53,7 @@ public void produce(@NotNull Material material, @NotNull BlastProperty property, if (ingotHot.doGenerateItem(material)) { molten = GTUtil.getMoltenFluid(material); addFreezerRecipes(material, molten, property.getBlastTemperature(), provider); - }else { + } else { molten = material.getFluid(); } if (molten == null) return; @@ -122,7 +125,8 @@ protected int addInputs(@NotNull Material material, @NotNull GTRecipeBuilder bui * @param componentAmount the amount of different components in the material * @param builder the builder to continue */ - protected void buildRecipes(@NotNull BlastProperty property, @NotNull Fluid molten, int outputAmount, int componentAmount, + protected void buildRecipes(@NotNull BlastProperty property, @NotNull Fluid molten, int outputAmount, + int componentAmount, @NotNull GTRecipeBuilder builder, Consumer provider) { // add the fluid output with the correct amount builder.outputFluids(FluidStack.create(molten, (long) GTValues.L * outputAmount)); @@ -171,8 +175,8 @@ protected int getGasCircuitNum(int componentAmount) { * @param temperature the temperature of the material */ @SuppressWarnings("MethodMayBeStatic") - protected void addFreezerRecipes(@NotNull Material material, @NotNull Fluid molten, int temperature, Consumer provider) { - + protected void addFreezerRecipes(@NotNull Material material, @NotNull Fluid molten, int temperature, + Consumer provider) { // build the freezer recipe GTRecipeBuilder freezerBuilder = GTRecipeTypes.VACUUM_RECIPES.recipeBuilder(material.getName()) .inputFluids(FluidStack.create(molten, GTValues.L)) @@ -187,4 +191,4 @@ protected void addFreezerRecipes(@NotNull Material material, @NotNull Fluid molt } freezerBuilder.save(provider); } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/alloyblast/CustomAlloyBlastRecipeProducer.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/alloyblast/CustomAlloyBlastRecipeProducer.java index 2d6bbca169..0be53739d6 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/alloyblast/CustomAlloyBlastRecipeProducer.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/alloyblast/CustomAlloyBlastRecipeProducer.java @@ -1,9 +1,9 @@ package com.gregtechceu.gtceu.data.recipe.misc.alloyblast; -import com.google.common.base.Preconditions; import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.data.recipe.builder.GTRecipeBuilder; +import com.google.common.base.Preconditions; import org.jetbrains.annotations.NotNull; public class CustomAlloyBlastRecipeProducer extends AlloyBlastRecipeProducer { @@ -15,7 +15,8 @@ public class CustomAlloyBlastRecipeProducer extends AlloyBlastRecipeProducer { /** * @param circuitNum the custom circuit number to use * @param gasCircuitNum the custom gas circuit number to use - * @param outputAmount the custom output amount in quantities of {@link com.gregtechceu.gtceu.api.data.tag.TagPrefix#ingot} + * @param outputAmount the custom output amount in quantities of + * {@link com.gregtechceu.gtceu.api.data.tag.TagPrefix#ingot} * / {@link com.gregtechceu.gtceu.api.GTValues#M}) to use */ public CustomAlloyBlastRecipeProducer(int circuitNum, int gasCircuitNum, int outputAmount) { @@ -40,4 +41,4 @@ protected int getCircuitNum(int componentAmount) { protected int getGasCircuitNum(int componentAmount) { return this.gasCircuitNum < 0 ? super.getGasCircuitNum(componentAmount) : this.gasCircuitNum; } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/AcidRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/AcidRecipes.java index 84fab71d5e..7d529f5061 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/AcidRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/AcidRecipes.java @@ -19,7 +19,6 @@ public static void init(Consumer provider) { } private static void sulfuricAcidRecipes(Consumer provider) { - CHEMICAL_RECIPES.recipeBuilder("sulfur_dioxide_from_sulfur") .circuitMeta(2) .inputItems(dust, Sulfur) @@ -65,7 +64,6 @@ private static void sulfuricAcidRecipes(Consumer provider) { } private static void nitricAcidRecipes(Consumer provider) { - CHEMICAL_RECIPES.recipeBuilder("ammonia_from_elements") .circuitMeta(1) .inputFluids(Hydrogen.getFluid(3000)) @@ -130,7 +128,6 @@ private static void nitricAcidRecipes(Consumer provider) { } private static void phosphoricAcidRecipes(Consumer provider) { - CHEMICAL_RECIPES.recipeBuilder("phosphorus_pentoxide_from_elements") .circuitMeta(1) .inputItems(dust, Phosphorus, 4) diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/AntidoteRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/AntidoteRecipes.java new file mode 100644 index 0000000000..7ab4ae3c93 --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/AntidoteRecipes.java @@ -0,0 +1,181 @@ +package com.gregtechceu.gtceu.data.recipe.serialized.chemistry; + +import net.minecraft.data.recipes.FinishedRecipe; + +import java.util.function.Consumer; + +import static com.gregtechceu.gtceu.api.GTValues.*; +import static com.gregtechceu.gtceu.api.GTValues.LV; +import static com.gregtechceu.gtceu.api.data.tag.TagPrefix.dust; +import static com.gregtechceu.gtceu.common.data.GTMaterials.*; +import static com.gregtechceu.gtceu.common.data.GTMaterials.AceticAcid; +import static com.gregtechceu.gtceu.common.data.GTRecipeTypes.*; + +public class AntidoteRecipes { + + public static void init(Consumer provider) { + paracetamolProcess(provider); + potassiumHydroxideProcess(provider); + prussianBlueProcess(provider); + dtpaProcess(provider); + } + + private static void paracetamolProcess(Consumer provider) { + CHEMICAL_RECIPES.recipeBuilder("acetic_anhydride") + .inputFluids(Ethenone.getFluid(1000)) + .inputFluids(AceticAcid.getFluid(1000)) + .outputFluids(AceticAnhydride.getFluid(1000)) + .duration(200).EUt(VH[LV]).save(provider); + + CHEMICAL_RECIPES.recipeBuilder("aminophenol") + .inputFluids(Phenol.getFluid(1000)) + .inputFluids(NitrationMixture.getFluid(1000)) + .notConsumable(dust, Iron) + .outputFluids(AminoPhenol.getFluid(1000)) + .outputFluids(DilutedSulfuricAcid.getFluid(1000)) + .duration(300).EUt(VA[LV]).save(provider); + + CHEMICAL_RECIPES.recipeBuilder("paracetamol") + .inputFluids(AceticAnhydride.getFluid(1000)) + .inputFluids(AminoPhenol.getFluid(1000)) + .outputItems(dust, Paracetamol, 1) + .outputFluids(AceticAcid.getFluid(1000)) + .duration(100).EUt(VA[LV]).save(provider); + } + + private static void potassiumHydroxideProcess(Consumer provider) { + CHEMICAL_RECIPES.recipeBuilder("potassium_hydroxide") + .inputItems(dust, RockSalt, 2) + .inputFluids(Water.getFluid(1000)) + .outputItems(dust, PotassiumHydroxide, 3) + .outputFluids(HydrochloricAcid.getFluid(1000)) + .duration(100).EUt(VA[MV]).save(provider); + + CHEMICAL_RECIPES.recipeBuilder("potassium_iodide") + .inputItems(dust, PotassiumHydroxide, 3) + .inputItems(dust, Iodine, 1) + .outputItems(dust, PotassiumIodide, 1) + .outputFluids(Oxygen.getFluid(1000)) + .outputFluids(Hydrogen.getFluid(1000)) + .duration(100).EUt(VA[MV]).save(provider); + } + + private static void prussianBlueProcess(Consumer provider) { + CHEMICAL_RECIPES.recipeBuilder("calcium_hydroxide") + .inputItems(dust, Quicklime, 2) + .inputFluids(Water.getFluid(1000)) + .outputItems(dust, CalciumHydroxide, 3) + .duration(100).EUt(VHA[MV]).save(provider); + + CHEMICAL_RECIPES.recipeBuilder("formic_acid") + .inputFluids(CarbonDioxide.getFluid(1000)) + .inputFluids(Water.getFluid(1000)) + .outputFluids(FormicAcid.getFluid(1000)) + .outputFluids(Oxygen.getFluid(1000)) + .duration(100).EUt(VA[LV]).save(provider); + + CHEMICAL_RECIPES.recipeBuilder("ammonium_formate") + .inputFluids(Ammonia.getFluid(1000)) + .inputFluids(FormicAcid.getFluid(1000)) + .outputFluids(AmmoniumFormate.getFluid(1000)) + .duration(100).EUt(VA[MV]).save(provider); + + FLUID_HEATER_RECIPES.recipeBuilder("formamide") + .inputFluids(AmmoniumFormate.getFluid(100)) + .outputFluids(Formamide.getFluid(100)) + .duration(16).EUt(VA[LV]).save(provider); + + CHEMICAL_RECIPES.recipeBuilder("potassium_cyanide") + .inputItems(dust, PotassiumHydroxide, 3) + .inputFluids(Formamide.getFluid(1000)) + .outputItems(dust, PotassiumCyanide, 3) + .outputFluids(Water.getFluid(1000)) + .duration(100).EUt(VHA[MV]).save(provider); + + CHEMICAL_RECIPES.recipeBuilder("hydrogen_cyanide") + .inputFluids(Methane.getFluid(1000)) + .inputFluids(Ammonia.getFluid(1000)) + .inputFluids(Oxygen.getFluid(3000)) + .notConsumable(dust, Platinum) + .outputFluids(HydrogenCyanide.getFluid(1000)) + .outputFluids(Water.getFluid(3000)) + .duration(100).EUt(VA[HV]).save(provider); + + CHEMICAL_RECIPES.recipeBuilder("potassium_carbonate") + .inputItems(dust, PotassiumHydroxide, 6) + .inputFluids(CarbonDioxide.getFluid(1000)) + .outputItems(dust, PotassiumCarbonate, 6) + .outputFluids(Water.getFluid(1000)) + .duration(100).EUt(VHA[MV]).save(provider); + + LARGE_CHEMICAL_RECIPES.recipeBuilder("calcium_ferrocyanide") + .inputFluids(HydrogenCyanide.getFluid(6000)) + .inputFluids(Iron2Chloride.getFluid(1000)) + .inputFluids(Water.getFluid(7000)) + .inputItems(dust, CalciumHydroxide, 10) + .outputItems(dust, CalciumFerrocyanide, 15) + .outputFluids(HydrochloricAcid.getFluid(2000)) + .duration(300).EUt(VA[HV]).save(provider); + + LARGE_CHEMICAL_RECIPES.recipeBuilder("potassium_ferrocyanide") + .inputItems(dust, CalciumFerrocyanide, 15) + .inputItems(dust, RockSalt, 8) + .outputItems(dust, PotassiumFerrocyanide, 17) + .outputItems(dust, CalciumHydroxide, 10) + .outputFluids(HydrochloricAcid.getFluid(4000)) + .outputFluids(Water.getFluid(4000)) + .duration(300).EUt(VA[HV]).save(provider); + + CHEMICAL_RECIPES.recipeBuilder("prussian_blue") + .inputItems(dust, PotassiumFerrocyanide, 51) + .inputFluids(Iron3Chloride.getFluid(4000)) + .outputItems(dust, PrussianBlue, 1) + .outputItems(dust, RockSalt, 6) + .duration(500).EUt(VA[HV]).save(provider); + } + + public static void dtpaProcess(Consumer provider) { + CHEMICAL_RECIPES.recipeBuilder("dichloroethane") + .inputFluids(Ethylene.getFluid(1000)) + .inputFluids(Chlorine.getFluid(2000)) + .notConsumableFluid(Iron3Chloride.getFluid(100)) + .outputFluids(Dichloroethane.getFluid(1000)) + .duration(100).EUt(VA[MV]).save(provider); + + CHEMICAL_RECIPES.recipeBuilder("diethylenetriamine") + .inputFluids(Dichloroethane.getFluid(2000)) + .inputFluids(Ammonia.getFluid(3000)) + .outputFluids(Diethylenetriamine.getFluid(1000)) + .outputFluids(HydrochloricAcid.getFluid(4000)) + .duration(100).EUt(VA[MV]).save(provider); + + CHEMICAL_RECIPES.recipeBuilder("formaldehyde") + .inputFluids(Methanol.getFluid(1000)) + .inputFluids(Oxygen.getFluid(1000)) + .notConsumable(dust, Silver) + .outputFluids(Formaldehyde.getFluid(1000)) + .outputFluids(Water.getFluid(1000)) + .duration(100).EUt(VA[HV]).save(provider); + + CHEMICAL_RECIPES.recipeBuilder("glycolonitrile") + .inputFluids(Formaldehyde.getFluid(1000)) + .inputFluids(HydrogenCyanide.getFluid(1000)) + .outputFluids(Glycolonitrile.getFluid(1000)) + .duration(100).EUt(VA[MV]).save(provider); + + CHEMICAL_RECIPES.recipeBuilder("diethylenetriamine_pentaacetonitrile") + .inputFluids(Diethylenetriamine.getFluid(1000)) + .inputFluids(Glycolonitrile.getFluid(5000)) + .outputFluids(DiethylenetriaminePentaacetonitrile.getFluid(1000)) + .outputFluids(Water.getFluid(5000)) + .duration(100).EUt(VA[HV]).save(provider); + + LARGE_CHEMICAL_RECIPES.recipeBuilder("diethylenetriaminepentaacetic_acid") + .inputItems(dust, SodiumHydroxide, 15) + .inputFluids(DiethylenetriaminePentaacetonitrile.getFluid(1000)) + .inputFluids(Oxygen.getFluid(15000)) + .outputItems(dust, DiethylenetriaminepentaaceticAcid, 1) + .outputItems(dust, SodiumNitrite, 20) + .duration(100).EUt(VA[EV]).save(provider); + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/BrewingRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/BrewingRecipes.java index b1887b837c..483f7ba69f 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/BrewingRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/BrewingRecipes.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.data.recipe.serialized.chemistry; import com.gregtechceu.gtceu.api.data.chemical.material.Material; + import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.world.item.Items; import net.minecraft.world.level.block.Blocks; @@ -15,8 +16,7 @@ public class BrewingRecipes { public static void init(Consumer provider) { - - for (Material material : new Material[]{Talc, Soapstone, Redstone}) { + for (Material material : new Material[] { Talc, Soapstone, Redstone }) { BREWING_RECIPES.recipeBuilder("lubricant_from_oil_and_" + material.getName()) .inputItems(dust, material) .inputFluids(Oil.getFluid(1000)) @@ -38,15 +38,26 @@ public static void init(Consumer provider) { // Biomass // todo tag? - //BREWING_RECIPES.recipeBuilder("biomass_from_sapling").duration(800).EUt(3).inputItems("treeSapling", 1).inputFluids(Water.getFluid(100)).outputFluids(Biomass.getFluid(100)).save(provider); - BREWING_RECIPES.recipeBuilder("biomass_from_potato").duration(160).EUt(3).inputItems(Items.POTATO).inputFluids(Water.getFluid(20)).outputFluids(Biomass.getFluid(20)).save(provider); - BREWING_RECIPES.recipeBuilder("biomass_from_carrot").duration(160).EUt(3).inputItems(Items.CARROT).inputFluids(Water.getFluid(20)).outputFluids(Biomass.getFluid(20)).save(provider); - BREWING_RECIPES.recipeBuilder("biomass_from_cactus").duration(160).EUt(3).inputItems(Blocks.CACTUS.asItem()).inputFluids(Water.getFluid(20)).outputFluids(Biomass.getFluid(20)).save(provider); - BREWING_RECIPES.recipeBuilder("biomass_from_sugar_cane").duration(160).EUt(3).inputItems(Items.SUGAR_CANE).inputFluids(Water.getFluid(20)).outputFluids(Biomass.getFluid(20)).save(provider); - BREWING_RECIPES.recipeBuilder("biomass_from_brown_mushroom").duration(160).EUt(3).inputItems(Blocks.BROWN_MUSHROOM.asItem()).inputFluids(Water.getFluid(20)).outputFluids(Biomass.getFluid(20)).save(provider); - BREWING_RECIPES.recipeBuilder("biomass_from_red_mushroom").duration(160).EUt(3).inputItems(Blocks.RED_MUSHROOM.asItem()).inputFluids(Water.getFluid(20)).outputFluids(Biomass.getFluid(20)).save(provider); - BREWING_RECIPES.recipeBuilder("biomass_from_beetroot").duration(160).EUt(3).inputItems(Items.BEETROOT).inputFluids(Water.getFluid(20)).outputFluids(Biomass.getFluid(20)).save(provider); - BREWING_RECIPES.recipeBuilder("biomass_from_bio_chaff").EUt(4).duration(128).inputItems(BIO_CHAFF).inputFluids(Water.getFluid(750)).outputFluids(Biomass.getFluid(750)).save(provider); + // BREWING_RECIPES.recipeBuilder("biomass_from_sapling").duration(800).EUt(3).inputItems("treeSapling", + // 1).inputFluids(Water.getFluid(100)).outputFluids(Biomass.getFluid(100)).save(provider); + BREWING_RECIPES.recipeBuilder("biomass_from_potato").duration(160).EUt(3).inputItems(Items.POTATO) + .inputFluids(Water.getFluid(20)).outputFluids(Biomass.getFluid(20)).save(provider); + BREWING_RECIPES.recipeBuilder("biomass_from_carrot").duration(160).EUt(3).inputItems(Items.CARROT) + .inputFluids(Water.getFluid(20)).outputFluids(Biomass.getFluid(20)).save(provider); + BREWING_RECIPES.recipeBuilder("biomass_from_cactus").duration(160).EUt(3).inputItems(Blocks.CACTUS.asItem()) + .inputFluids(Water.getFluid(20)).outputFluids(Biomass.getFluid(20)).save(provider); + BREWING_RECIPES.recipeBuilder("biomass_from_sugar_cane").duration(160).EUt(3).inputItems(Items.SUGAR_CANE) + .inputFluids(Water.getFluid(20)).outputFluids(Biomass.getFluid(20)).save(provider); + BREWING_RECIPES.recipeBuilder("biomass_from_brown_mushroom").duration(160).EUt(3) + .inputItems(Blocks.BROWN_MUSHROOM.asItem()).inputFluids(Water.getFluid(20)) + .outputFluids(Biomass.getFluid(20)).save(provider); + BREWING_RECIPES.recipeBuilder("biomass_from_red_mushroom").duration(160).EUt(3) + .inputItems(Blocks.RED_MUSHROOM.asItem()).inputFluids(Water.getFluid(20)) + .outputFluids(Biomass.getFluid(20)).save(provider); + BREWING_RECIPES.recipeBuilder("biomass_from_beetroot").duration(160).EUt(3).inputItems(Items.BEETROOT) + .inputFluids(Water.getFluid(20)).outputFluids(Biomass.getFluid(20)).save(provider); + BREWING_RECIPES.recipeBuilder("biomass_from_bio_chaff").EUt(4).duration(128).inputItems(BIO_CHAFF) + .inputFluids(Water.getFluid(750)).outputFluids(Biomass.getFluid(750)).save(provider); // TODO 1.13+ plants } } diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/BrineRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/BrineRecipes.java new file mode 100644 index 0000000000..135ff5772d --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/BrineRecipes.java @@ -0,0 +1,108 @@ +package com.gregtechceu.gtceu.data.recipe.serialized.chemistry; + +import net.minecraft.data.recipes.FinishedRecipe; + +import java.util.function.Consumer; + +import static com.gregtechceu.gtceu.api.GTValues.*; +import static com.gregtechceu.gtceu.api.data.tag.TagPrefix.dust; +import static com.gregtechceu.gtceu.common.data.GTMaterials.*; +import static com.gregtechceu.gtceu.common.data.GTRecipeTypes.*; +import static com.gregtechceu.gtceu.common.data.GTRecipeTypes.CHEMICAL_RECIPES; + +public class BrineRecipes { + + public static void init(Consumer provider) { + bromineProcess(provider); + iodineProcess(provider); + } + + private static void bromineProcess(Consumer provider) { + EVAPORATION_RECIPES.recipeBuilder("brine_evaporation") + .inputFluids(SaltWater.getFluid(20000)) + .outputFluids(RawBrine.getFluid(1000)) + .duration(1000).EUt(VA[HV]).save(provider); + FLUID_HEATER_RECIPES.recipeBuilder("brine_heating") + .inputFluids(RawBrine.getFluid(1000)) + .outputFluids(HotBrine.getFluid(1000)) + .duration(12000).EUt(VA[HV]).save(provider); + + // Main chain + CHEMICAL_RECIPES.recipeBuilder("brine_chlorination") + .inputFluids(HotBrine.getFluid(1000)) + .inputFluids(Chlorine.getFluid(1000)) + .outputFluids(HotChlorinatedBrominatedBrine.getFluid(2000)) + .duration(100).EUt(VA[HV]).save(provider); + CHEMICAL_RECIPES.recipeBuilder("brine_filtration") + .inputFluids(HotChlorinatedBrominatedBrine.getFluid(1000)) + .inputFluids(Chlorine.getFluid(1000)) + .inputFluids(Steam.getFluid(1000)) + .outputFluids(HotAlkalineDebrominatedBrine.getFluid(1000)) + .outputFluids(BrominatedChlorineVapor.getFluid(2000)) + .duration(300).EUt(VA[HV]).save(provider); + FLUID_HEATER_RECIPES.recipeBuilder("brominated_chlorine_vapor_condensation") + .inputFluids(BrominatedChlorineVapor.getFluid(1000)) + .inputFluids(Water.getFluid(1000)) + .outputFluids(AcidicBromineSolution.getFluid(1000)) + .outputFluids(Water.getFluid(1000)) + .duration(200).EUt(VA[HV]).save(provider); + CHEMICAL_RECIPES.recipeBuilder("bromine_vapor_concentration") + .inputFluids(AcidicBromineSolution.getFluid(1000)) + .inputFluids(Steam.getFluid(1000)) + .outputFluids(ConcentratedBromineSolution.getFluid(1000)) + .outputFluids(AcidicBromineExhaust.getFluid(1000)) + .duration(100).EUt(VA[HV]).save(provider); + DISTILLATION_RECIPES.recipeBuilder("bromine_distillation") + .inputFluids(ConcentratedBromineSolution.getFluid(1000)) + .outputFluids(Chlorine.getFluid(500)) + .outputFluids(Bromine.getFluid(1000)) + .duration(500).EUt(VA[HV]).save(provider); + + // byproduct loop + CHEMICAL_RECIPES.recipeBuilder("brine_neutralization") + .inputFluids(HotAlkalineDebrominatedBrine.getFluid(3000)) + .outputFluids(Chlorine.getFluid(1000)) + .outputFluids(HotDebrominatedBrine.getFluid(2000)) + .duration(100).EUt(VA[HV]).save(provider); + FLUID_HEATER_RECIPES.recipeBuilder("debrominated_brine_raw_brine_mixing") + .inputFluids(RawBrine.getFluid(1000)) + .inputFluids(HotDebrominatedBrine.getFluid(1000)) + .outputFluids(HotBrine.getFluid(1000)) + .outputFluids(DebrominatedBrine.getFluid(1000)) + .duration(200).EUt(VA[HV]).save(provider); + CHEMICAL_RECIPES.recipeBuilder("acidic_bromine_exhaust_heating") + .inputFluids(AcidicBromineExhaust.getFluid(1000)) + .inputFluids(HotBrine.getFluid(1000)) + .outputFluids(HotChlorinatedBrominatedBrine.getFluid(1000)) + .outputFluids(Steam.getFluid(3000)) + .duration(100).EUt(VA[HV]).save(provider); + } + + public static void iodineProcess(Consumer provider) { + CHEMICAL_RECIPES.recipeBuilder("brine_acidification") + .inputFluids(HotBrine.getFluid(1000)) + .inputFluids(HydrochloricAcid.getFluid(1000)) + .outputFluids(HotDebrominatedBrine.getFluid(1000)) + .outputFluids(DiluteIodineSolution.getFluid(1000)) + .duration(100).EUt(VHA[HV]).save(provider); + CHEMICAL_RECIPES.recipeBuilder("iodine_solution") + .inputFluids(DiluteIodineSolution.getFluid(1000)) + .inputFluids(Chlorine.getFluid(2000)) + .outputFluids(Iodide.getFluid(1000)) + .outputFluids(HydrochloricAcid.getFluid(2000)) + .duration(1000).EUt(VHA[HV]).save(provider); + CHEMICAL_RECIPES.recipeBuilder("iodine_solution_reduction") + .inputFluids(Iodide.getFluid(1000)) + .inputFluids(Water.getFluid(2000)) + .inputFluids(SulfurDioxide.getFluid(1000)) + .outputFluids(IodineSolution.getFluid(2000)) + .outputFluids(SulfuricAcid.getFluid(1000)) + .duration(1000).EUt(VHA[HV]).save(provider); + CHEMICAL_RECIPES.recipeBuilder("iodine_solution_reduction") + .inputFluids(IodineSolution.getFluid(2000)) + .inputFluids(Chlorine.getFluid(1000)) + .outputItems(dust, Iodine, 1) + .outputFluids(HydrochloricAcid.getFluid(2000)) + .duration(1000).EUt(VHA[HV]).save(provider); + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/ChemicalBathRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/ChemicalBathRecipes.java index ccadfc7825..507c7e6758 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/ChemicalBathRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/ChemicalBathRecipes.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.data.recipe.serialized.chemistry; import com.gregtechceu.gtceu.common.data.GTBlocks; + import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.tags.ItemTags; import net.minecraft.world.item.Items; @@ -15,7 +16,6 @@ public class ChemicalBathRecipes { public static void init(Consumer provider) { - CHEMICAL_BATH_RECIPES.recipeBuilder("paper_from_wood_dust") .inputItems(dust, Wood) .inputFluids(Water.getFluid(100)) @@ -59,11 +59,11 @@ public static void init(Consumer provider) { .duration(100).EUt(VA[ULV]).save(provider); // TODO Concrete - //CHEMICAL_BATH_RECIPES.recipeBuilder() - // .inputs(MetaBlocks.STONE_SMOOTH.getItemVariant(BlockStoneSmooth.BlockType.CONCRETE_LIGHT)) - // .inputFluids(Water.getFluid(100)) - // .outputs(MetaBlocks.STONE_SMOOTH.getItemVariant(BlockStoneSmooth.BlockType.CONCRETE_DARK)) - // .duration(100).EUt(VA[ULV]).save(provider); + // CHEMICAL_BATH_RECIPES.recipeBuilder() + // .inputs(MetaBlocks.STONE_SMOOTH.getItemVariant(BlockStoneSmooth.BlockType.CONCRETE_LIGHT)) + // .inputFluids(Water.getFluid(100)) + // .outputs(MetaBlocks.STONE_SMOOTH.getItemVariant(BlockStoneSmooth.BlockType.CONCRETE_DARK)) + // .duration(100).EUt(VA[ULV]).save(provider); CHEMICAL_BATH_RECIPES.recipeBuilder("tungstic_acid_from_scheelite") .inputItems(dust, Scheelite, 6) diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/ChemistryRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/ChemistryRecipes.java index acf93dfb39..701b29ead6 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/ChemistryRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/ChemistryRecipes.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.data.recipe.serialized.chemistry; import com.gregtechceu.gtceu.api.fluids.store.FluidStorageKeys; + import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Items; @@ -16,7 +17,6 @@ public class ChemistryRecipes { public static void init(Consumer provider) { - AcidRecipes.init(provider); BrewingRecipes.init(provider); ChemicalBathRecipes.init(provider); @@ -33,7 +33,8 @@ public static void init(Consumer provider) { PolymerRecipes.init(provider); ReactorRecipes.init(provider); SeparationRecipes.init(provider); - + BrineRecipes.init(provider); + AntidoteRecipes.init(provider); // A Few Random Recipes FLUID_HEATER_RECIPES.recipeBuilder("ethenone") @@ -132,18 +133,18 @@ public static void init(Consumer provider) { .save(provider); PYROLYSE_RECIPES.recipeBuilder("activated_carbon_from_carbon").circuitMeta(1) - .inputItems(dust, Carbon) - .inputFluids(Nitrogen.getFluid(2000)) - .outputItems(dust,ActivatedCarbon) - .duration(320).EUt(64) - .save(provider); + .inputItems(dust, Carbon) + .inputFluids(Nitrogen.getFluid(2000)) + .outputItems(dust, ActivatedCarbon) + .duration(320).EUt(64) + .save(provider); PYROLYSE_RECIPES.recipeBuilder("activated_carbon_from_charcoal").circuitMeta(1) - .inputItems(dust, Charcoal) - .inputFluids(Nitrogen.getFluid(2000)) - .outputItems(dust,ActivatedCarbon) - .chancedOutput(dust, Ash, 2000, 0) - .duration(640).EUt(64) - .save(provider); + .inputItems(dust, Charcoal) + .inputFluids(Nitrogen.getFluid(2000)) + .outputItems(dust, ActivatedCarbon) + .chancedOutput(dust, Ash, 2000, 0) + .duration(640).EUt(64) + .save(provider); } } diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/DistillationRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/DistillationRecipes.java index a1515248e2..57e19cf9c3 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/DistillationRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/DistillationRecipes.java @@ -14,7 +14,6 @@ public class DistillationRecipes { public static void init(Consumer provider) { - DISTILLATION_RECIPES.recipeBuilder("distill_creosote") .inputFluids(Creosote.getFluid(24)) .outputFluids(Lubricant.getFluid(12)) diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/FuelRecipeChains.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/FuelRecipeChains.java index 0d475560db..f8a9667926 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/FuelRecipeChains.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/FuelRecipeChains.java @@ -12,7 +12,6 @@ public class FuelRecipeChains { public static void init(Consumer provider) { - // High Octane Gasoline LARGE_CHEMICAL_RECIPES.recipeBuilder("raw_gasoline").EUt(VA[HV]).duration(100) .inputFluids(Naphtha.getFluid(16000)) diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/GemSlurryRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/GemSlurryRecipes.java index 5da0e10e62..801caa333a 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/GemSlurryRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/GemSlurryRecipes.java @@ -13,7 +13,6 @@ public class GemSlurryRecipes { public static void init(Consumer provider) { - // Ruby MIXER_RECIPES.recipeBuilder("ruby_slurry").duration(280).EUt(VA[EV]) .inputItems(crushed, Ruby, 2) diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/GrowthMediumRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/GrowthMediumRecipes.java index 0324ccc088..4f79034e33 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/GrowthMediumRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/GrowthMediumRecipes.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.data.recipe.serialized.chemistry; import com.gregtechceu.gtceu.api.machine.multiblock.CleanroomType; + import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.world.item.Items; import net.minecraft.world.level.block.Blocks; @@ -17,7 +18,6 @@ public class GrowthMediumRecipes { public static void init(Consumer provider) { - // Bio Chaff MACERATOR_RECIPES.recipeBuilder("bio_chaff").EUt(4).duration(200) .inputItems(PLANT_BALL, 2) diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/LCRCombined.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/LCRCombined.java index 6621b0fac0..26c9154832 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/LCRCombined.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/LCRCombined.java @@ -12,7 +12,6 @@ public class LCRCombined { public static void init(Consumer provider) { - LARGE_CHEMICAL_RECIPES.recipeBuilder("ammonia_shortcut") .circuitMeta(24) .inputFluids(Methane.getFluid(3000)) diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/MixerRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/MixerRecipes.java index 602e633a38..042ec9dbe9 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/MixerRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/MixerRecipes.java @@ -3,6 +3,7 @@ import com.gregtechceu.gtceu.api.data.chemical.ChemicalHelper; import com.gregtechceu.gtceu.api.data.chemical.material.stack.UnificationEntry; import com.gregtechceu.gtceu.data.recipe.VanillaRecipeHelper; + import net.minecraft.data.recipes.FinishedRecipe; import java.util.function.Consumer; @@ -15,7 +16,6 @@ public class MixerRecipes { public static void init(Consumer provider) { - MIXER_RECIPES.recipeBuilder("nitration_mixture") .inputFluids(NitricAcid.getFluid(1000)) .inputFluids(SulfuricAcid.getFluid(1000)) @@ -493,12 +493,12 @@ public static void init(Consumer provider) { .save(provider); MIXER_RECIPES.recipeBuilder("rtm_alloy").duration(300).EUt(VA[EV]) - .inputItems(dust, Ruthenium,4) - .inputItems(dust, Tungsten,2) - .inputItems(dust, Molybdenum) - .circuitMeta(1) - .outputItems(dust, RTMAlloy, 7) - .save(provider); + .inputItems(dust, Ruthenium, 4) + .inputItems(dust, Tungsten, 2) + .inputItems(dust, Molybdenum) + .circuitMeta(1) + .outputItems(dust, RTMAlloy, 7) + .save(provider); // Superconductor Alloys MIXER_RECIPES.recipeBuilder("manganese_phosphide").duration(400).EUt(24) @@ -578,5 +578,12 @@ public static void init(Consumer provider) { .circuitMeta(4) .outputItems(dust, RutheniumTriniumAmericiumNeutronate, 14) .save(provider); + + MIXER_RECIPES.recipeBuilder("rad_away") + .inputItems(dust, PotassiumIodide, 5) + .inputItems(dust, PrussianBlue, 3) + .inputItems(dust, DiethylenetriaminepentaaceticAcid, 10) + .outputItems(dust, RadAway, 48) + .duration(60).EUt(VA[HV]).save(provider); } } diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/NaquadahRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/NaquadahRecipes.java index 64fabee2ac..654cfcb03e 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/NaquadahRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/NaquadahRecipes.java @@ -25,7 +25,6 @@ public class NaquadahRecipes { // |> 0.25 Barium public static void init(Consumer provider) { - // FLUOROANTIMONIC ACID CHEMICAL_RECIPES.recipeBuilder("antimony_trioxide").EUt(VA[ULV]).duration(60) @@ -48,7 +47,6 @@ public static void init(Consumer provider) { .outputFluids(Hydrogen.getFluid(2000)) .save(provider); - // STARTING POINT LARGE_CHEMICAL_RECIPES.recipeBuilder("naquadah_separation").EUt(VA[LuV]).duration(600) @@ -59,7 +57,6 @@ public static void init(Consumer provider) { .outputItems(dust, TitaniumTrifluoride, 4) .save(provider); - // ENRICHED NAQUADAH PROCESS CENTRIFUGE_RECIPES.recipeBuilder("impure_enriched_naquadah_solution_separation").EUt(VA[EV]).duration(400) @@ -82,7 +79,8 @@ public static void init(Consumer provider) { .outputItems(dust, EnrichedNaquadahSulfate, 6) // Nq+SO4 .save(provider); - BLAST_RECIPES.recipeBuilder("enriched_naquadah_sulfate_separation").EUt(VA[IV]).duration(500).blastFurnaceTemp(7000) + BLAST_RECIPES.recipeBuilder("enriched_naquadah_sulfate_separation").EUt(VA[IV]).duration(500) + .blastFurnaceTemp(7000) .inputItems(dust, EnrichedNaquadahSulfate, 6) .inputFluids(Hydrogen.getFluid(2000)) .outputItems(ingotHot, NaquadahEnriched) @@ -97,7 +95,6 @@ public static void init(Consumer provider) { .outputFluids(NaquadriaSolution.getFluid(100)) .save(provider); - // NAQUADRIA PROCESS CENTRIFUGE_RECIPES.recipeBuilder("impure_naquadria_solution_separation").EUt(VA[EV]).duration(400) @@ -135,17 +132,16 @@ public static void init(Consumer provider) { .outputFluids(EnrichedNaquadahSolution.getFluid(100)) .save(provider); - // TRINIUM - BLAST_RECIPES.recipeBuilder("trinium_sulfide_separation").duration(750).EUt(VA[LuV]).blastFurnaceTemp(Trinium.getBlastTemperature()) + BLAST_RECIPES.recipeBuilder("trinium_sulfide_separation").duration(750).EUt(VA[LuV]) + .blastFurnaceTemp(Trinium.getBlastTemperature()) .inputItems(dust, TriniumSulfide, 2) .inputItems(dust, Zinc) .outputItems(ingotHot, Trinium) .outputItems(dust, ZincSulfide, 2) .save(provider); - // BYPRODUCT PROCESSING // Titanium Trifluoride diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/NuclearRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/NuclearRecipes.java index e87728de52..cbd53b5cba 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/NuclearRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/NuclearRecipes.java @@ -12,7 +12,6 @@ public class NuclearRecipes { public static void init(Consumer provider) { - CHEMICAL_RECIPES.recipeBuilder("uranium_hexafluoride").duration(200).EUt(VA[LV]) .inputItems(dust, Uraninite, 3) .inputFluids(HydrofluoricAcid.getFluid(4000)) @@ -38,6 +37,5 @@ public static void init(Consumer provider) { .outputItems(dust, Uranium238) .outputFluids(Fluorine.getFluid(6000)) .save(provider); - } } diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/PetrochemRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/PetrochemRecipes.java index 82cf671aa8..1d01c5b9b7 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/PetrochemRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/PetrochemRecipes.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.data.recipe.serialized.chemistry; import com.gregtechceu.gtceu.api.data.chemical.material.Material; + import net.minecraft.data.recipes.FinishedRecipe; import java.util.function.Consumer; @@ -68,7 +69,6 @@ public static void init(Consumer provider) { } private static void desulfurizationRecipes(Consumer provider) { - CHEMICAL_RECIPES.recipeBuilder("desulfurize_heavy_fuel") .inputFluids(SulfuricHeavyFuel.getFluid(8000)) .inputFluids(Hydrogen.getFluid(2000)) @@ -106,7 +106,6 @@ private static void desulfurizationRecipes(Consumer provider) { } private static void distillationRecipes(Consumer provider) { - DISTILLATION_RECIPES.recipeBuilder("distill_refinery_gas") .inputFluids(RefineryGas.getFluid(1000)) .outputFluids(Butane.getFluid(60)) @@ -427,7 +426,8 @@ private static void distilleryRecipes(Consumer provider) { .duration(32).EUt(24).save(provider); } - private static void lightlyCrack(Consumer provider, Material raw, Material hydroCracked, Material steamCracked) { + private static void lightlyCrack(Consumer provider, Material raw, Material hydroCracked, + Material steamCracked) { CRACKING_RECIPES.recipeBuilder("lightly_hydro_crack_" + raw.getName()) .circuitMeta(1) .inputFluids(raw.getFluid(1000)) @@ -457,7 +457,8 @@ private static void lightlyCrack(Consumer provider, Material raw .duration(160).duration(VA[LV]).save(provider); } - private static void moderatelyCrack(Consumer provider, Material raw, Material hydroCracked, Material steamCracked) { + private static void moderatelyCrack(Consumer provider, Material raw, Material hydroCracked, + Material steamCracked) { CRACKING_RECIPES.recipeBuilder("hydro_crack_" + raw.getName()) .circuitMeta(2) .inputFluids(raw.getFluid(1000)) @@ -487,7 +488,8 @@ private static void moderatelyCrack(Consumer provider, Material .duration(240).EUt(VA[LV]).save(provider); } - private static void severelyCrack(Consumer provider, Material raw, Material hydroCracked, Material steamCracked) { + private static void severelyCrack(Consumer provider, Material raw, Material hydroCracked, + Material steamCracked) { CRACKING_RECIPES.recipeBuilder("severely_hydro_crack_" + raw.getName()) .circuitMeta(2) .inputFluids(raw.getFluid(1000)) diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/PlatGroupMetalsRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/PlatGroupMetalsRecipes.java index b1c3914f92..89b3a5a9ff 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/PlatGroupMetalsRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/PlatGroupMetalsRecipes.java @@ -12,7 +12,6 @@ public class PlatGroupMetalsRecipes { public static void init(Consumer provider) { - // Primary Chain // Platinum Group Sludge Production @@ -71,16 +70,16 @@ public static void init(Consumer provider) { // MODIFY THIS RECIPE TO RE-BALANCE THE LINE // // Current Losses of Materials per recipe (update this if rebalanced): - // H: Loses - // N: Loses - // O: Loses + // H: Loses + // N: Loses + // O: Loses // Cl: Perfectly Conserved // // If modified, this is how much 1 of each product will change the above losses by: - // Pt: 266L of Cl + // Pt: 266L of Cl // // These numbers are not correct: - // Pd: 200L of N, 600L of H + // Pd: 200L of N, 600L of H // Ru/Rh: 667L of O // Ir/Os: 620L of O, 100L of H // @@ -96,7 +95,6 @@ public static void init(Consumer provider) { .outputItems(dust, PlatinumSludgeResidue, 2) .save(provider); - // PLATINUM ELECTROLYZER_RECIPES.recipeBuilder("raw_platinum_separation").duration(100).EUt(VA[MV]) @@ -105,7 +103,6 @@ public static void init(Consumer provider) { .outputFluids(Chlorine.getFluid(800)) .save(provider); - // PALLADIUM CHEMICAL_RECIPES.recipeBuilder("raw_palladium_separation").duration(200).EUt(VA[MV]) @@ -115,7 +112,6 @@ public static void init(Consumer provider) { .outputItems(dust, AmmoniumChloride, 2) .save(provider); - // RHODIUM / RUTHENIUM CHEMICAL_RECIPES.recipeBuilder("inert_metal_mixture_separation").duration(450).EUt(VA[EV]) @@ -140,7 +136,6 @@ public static void init(Consumer provider) { .outputFluids(CarbonDioxide.getFluid(2000)) .save(provider); - // OSMIUM / IRIDIUM LARGE_CHEMICAL_RECIPES.recipeBuilder("rarest_metal_mixture_separation").duration(400).EUt(VA[IV]) diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/PolymerRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/PolymerRecipes.java index 870dee29d9..dd173dd7ce 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/PolymerRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/PolymerRecipes.java @@ -22,7 +22,6 @@ public static void init(Consumer provider) { } private static void polyethyleneProcess(Consumer provider) { - CHEMICAL_RECIPES.recipeBuilder("ethylene_from_ethanol") .inputFluids(SulfuricAcid.getFluid(1000)) .inputFluids(Ethanol.getFluid(1000)) @@ -69,7 +68,6 @@ private static void polyethyleneProcess(Consumer provider) { } private static void polyvinylChlorideProcess(Consumer provider) { - CHEMICAL_RECIPES.recipeBuilder("vinyl_chloride_from_hydrochloric") .circuitMeta(3) .inputFluids(Oxygen.getFluid(1000)) @@ -125,7 +123,6 @@ private static void polyvinylChlorideProcess(Consumer provider) } private static void ptfeProcess(Consumer provider) { - CHEMICAL_RECIPES.recipeBuilder("chloroform") .circuitMeta(1) .inputFluids(Chlorine.getFluid(6000)) @@ -182,7 +179,6 @@ private static void ptfeProcess(Consumer provider) { } private static void epoxyProcess(Consumer provider) { - CHEMICAL_RECIPES.recipeBuilder("glycerol_from_seed_oil_methanol") .inputItems(dustTiny, SodiumHydroxide) .inputFluids(SeedOil.getFluid(6000)) @@ -330,7 +326,6 @@ private static void epoxyProcess(Consumer provider) { } private static void styreneButadieneProcess(Consumer provider) { - CHEMICAL_RECIPES.recipeBuilder("styrene_from_benzene") .inputFluids(Ethylene.getFluid(1000)) .inputFluids(Benzene.getFluid(1000)) diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/ReactorRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/ReactorRecipes.java index 33ba5a01c0..5b7f0565e0 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/ReactorRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/ReactorRecipes.java @@ -4,6 +4,7 @@ import com.gregtechceu.gtceu.common.data.GTBlocks; import com.gregtechceu.gtceu.common.data.GTItems; import com.gregtechceu.gtceu.common.data.GTMaterials; + import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; @@ -15,13 +16,11 @@ import static com.gregtechceu.gtceu.api.data.tag.TagPrefix.*; import static com.gregtechceu.gtceu.common.data.GTItems.GELLED_TOLUENE; import static com.gregtechceu.gtceu.common.data.GTMaterials.*; -import static com.gregtechceu.gtceu.common.data.GTRecipeTypes.CHEMICAL_RECIPES; -import static com.gregtechceu.gtceu.common.data.GTRecipeTypes.LARGE_CHEMICAL_RECIPES; +import static com.gregtechceu.gtceu.common.data.GTRecipeTypes.*; public class ReactorRecipes { public static void init(Consumer provider) { - CHEMICAL_RECIPES.recipeBuilder("raw_rubber_from_air") .circuitMeta(1) .inputFluids(Isoprene.getFluid(144)) @@ -79,8 +78,6 @@ public static void init(Consumer provider) { .outputFluids(PolyphenyleneSulfide.getFluid(1500)) .duration(240).EUt(360).save(provider); - - CHEMICAL_RECIPES.recipeBuilder("silicone_rubber") .inputItems(dust, Polydimethylsiloxane, 9) .inputItems(dust, Sulfur) @@ -145,6 +142,15 @@ public static void init(Consumer provider) { .duration(400).EUt(VA[LV]) .save(provider); + CHEMICAL_RECIPES.recipeBuilder("iron_2_chloride") + .inputFluids(Iron3Chloride.getFluid(2000)) + .inputFluids(Chlorobenzene.getFluid(1000)) + .outputFluids(Iron2Chloride.getFluid(2000)) + .outputFluids(HydrochloricAcid.getFluid(1000)) + .outputFluids(Dichlorobenzene.getFluid(1000)) + .duration(400).EUt(VA[MV]) + .save(provider); + CHEMICAL_RECIPES.recipeBuilder("chloromethane_from_methane") .circuitMeta(3) .inputFluids(Chlorine.getFluid(2000)) @@ -603,11 +609,11 @@ public static void init(Consumer provider) { .duration(200).EUt(24).save(provider); CHEMICAL_RECIPES.recipeBuilder("itnt_from_toluene") - .inputItems(GELLED_TOLUENE, 4) - .inputFluids(NitrationMixture.getFluid(200)) - .outputItems(new ItemStack(GTBlocks.INDUSTRIAL_TNT)) - .outputFluids(DilutedSulfuricAcid.getFluid(150)) - .duration(80).EUt(VA[HV]).save(provider); + .inputItems(GELLED_TOLUENE, 4) + .inputFluids(NitrationMixture.getFluid(200)) + .outputItems(new ItemStack(GTBlocks.INDUSTRIAL_TNT)) + .outputFluids(DilutedSulfuricAcid.getFluid(150)) + .duration(80).EUt(VA[HV]).save(provider); CHEMICAL_RECIPES.recipeBuilder("phenol_from_dichlorobenzene") .inputItems(dust, SodiumHydroxide, 6) diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/SeparationRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/SeparationRecipes.java index 71700b0ebe..8a14d3d3a6 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/SeparationRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/SeparationRecipes.java @@ -2,8 +2,8 @@ import com.gregtechceu.gtceu.common.data.GTBlocks; import com.gregtechceu.gtceu.data.recipe.CustomTags; + import net.minecraft.data.recipes.FinishedRecipe; -import net.minecraft.tags.ItemTags; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.block.Blocks; @@ -20,7 +20,6 @@ public class SeparationRecipes { public static void init(Consumer provider) { - // Centrifuge CENTRIFUGE_RECIPES.recipeBuilder("refinery_gas_separation") .inputFluids(RefineryGas.getFluid(8000)) @@ -84,25 +83,25 @@ public static void init(Consumer provider) { // TODO Food -> methane stuff /* - for (Item item : ForgeRegistries.ITEMS.getValuesCollection()) { - if (item instanceof ItemFood) { - ItemFood itemFood = (ItemFood) item; - Collection subItems = GTUtility.getAllSubItems(new ItemStack(item, 1, GTValues.W)); - for (ItemStack itemStack : subItems) { - int healAmount = itemFood.getHealAmount(itemStack); - float saturationModifier = itemFood.getSaturationModifier(itemStack); - if (healAmount > 0) { - FluidStack outputStack = Methane.getFluid(Math.round(9 * healAmount * (1.0f + saturationModifier))); - - CENTRIFUGE_RECIPES.recipeBuilder().duration(144).EUt(5) - .inputItems(itemStack) - .outputFluids(outputStack) - .save(provider; - } - } - } - } - */ + * for (Item item : ForgeRegistries.ITEMS.getValuesCollection()) { + * if (item instanceof ItemFood) { + * ItemFood itemFood = (ItemFood) item; + * Collection subItems = GTUtility.getAllSubItems(new ItemStack(item, 1, GTValues.W)); + * for (ItemStack itemStack : subItems) { + * int healAmount = itemFood.getHealAmount(itemStack); + * float saturationModifier = itemFood.getSaturationModifier(itemStack); + * if (healAmount > 0) { + * FluidStack outputStack = Methane.getFluid(Math.round(9 * healAmount * (1.0f + saturationModifier))); + * + * CENTRIFUGE_RECIPES.recipeBuilder().duration(144).EUt(5) + * .inputItems(itemStack) + * .outputFluids(outputStack) + * .save(provider; + * } + * } + * } + * } + */ CENTRIFUGE_RECIPES.recipeBuilder("sticky_resin_separation").duration(400).EUt(5) .inputItems(STICKY_RESIN) @@ -153,7 +152,6 @@ public static void init(Consumer provider) { .chancedOutput(dust, Hematite, 275, 0) .save(provider); - CENTRIFUGE_RECIPES.recipeBuilder("dark_ash_separation").duration(250).EUt(6) .inputItems(dust, DarkAsh) .outputItems(dust, Ash) @@ -469,10 +467,10 @@ public static void init(Consumer provider) { // Thermal Centrifuge // todo whatever this recipe is - //THERMAL_CENTRIFUGE_RECIPES.recipeBuilder() - // .inputItems(new ItemStack(Blocks.COBBLESTONE, 1, GTValues.W)) - // .outputItems(dust, Stone) - // .duration(500).EUt(48).save(provider); + // THERMAL_CENTRIFUGE_RECIPES.recipeBuilder() + // .inputItems(new ItemStack(Blocks.COBBLESTONE, 1, GTValues.W)) + // .outputItems(dust, Stone) + // .duration(500).EUt(48).save(provider); // Extractor EXTRACTOR_RECIPES.recipeBuilder("monazite_extraction") diff --git a/src/main/java/com/gregtechceu/gtceu/data/tags/BiomeTagsLoader.java b/src/main/java/com/gregtechceu/gtceu/data/tags/BiomeTagsLoader.java index 6113d5e837..7630ee0ba6 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/tags/BiomeTagsLoader.java +++ b/src/main/java/com/gregtechceu/gtceu/data/tags/BiomeTagsLoader.java @@ -2,6 +2,7 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.data.recipe.CustomTags; + import net.minecraft.core.HolderLookup; import net.minecraft.data.PackOutput; import net.minecraft.data.tags.BiomeTagsProvider; @@ -9,21 +10,24 @@ import net.minecraft.world.level.biome.Biomes; import net.minecraftforge.common.Tags; import net.minecraftforge.common.data.ExistingFileHelper; + import org.jetbrains.annotations.Nullable; import java.util.concurrent.CompletableFuture; public class BiomeTagsLoader extends BiomeTagsProvider { - - public BiomeTagsLoader(PackOutput arg, CompletableFuture completableFuture, @Nullable ExistingFileHelper existingFileHelper) { + public BiomeTagsLoader(PackOutput arg, CompletableFuture completableFuture, + @Nullable ExistingFileHelper existingFileHelper) { super(arg, completableFuture, GTCEu.MOD_ID, existingFileHelper); } @Override protected void addTags(HolderLookup.Provider provider) { tag(CustomTags.IS_SWAMP).add(Biomes.SWAMP).add(Biomes.MANGROVE_SWAMP); - tag(CustomTags.HAS_RUBBER_TREE).addTag(CustomTags.IS_SWAMP).addTag(BiomeTags.IS_FOREST).addTag(BiomeTags.IS_JUNGLE); - tag(CustomTags.IS_SANDY).addTag(Tags.Biomes.IS_SANDY).add(Biomes.DESERT).add(Biomes.BEACH).add(Biomes.BADLANDS).add(Biomes.WOODED_BADLANDS); + tag(CustomTags.HAS_RUBBER_TREE).addTag(CustomTags.IS_SWAMP).addTag(BiomeTags.IS_FOREST) + .addTag(BiomeTags.IS_JUNGLE); + tag(CustomTags.IS_SANDY).addTag(Tags.Biomes.IS_SANDY).add(Biomes.DESERT).add(Biomes.BEACH).add(Biomes.BADLANDS) + .add(Biomes.WOODED_BADLANDS); } } diff --git a/src/main/java/com/gregtechceu/gtceu/data/tags/BlockTagLoader.java b/src/main/java/com/gregtechceu/gtceu/data/tags/BlockTagLoader.java index 6e10710426..c8ec4b8fc7 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/tags/BlockTagLoader.java +++ b/src/main/java/com/gregtechceu/gtceu/data/tags/BlockTagLoader.java @@ -6,7 +6,7 @@ import com.gregtechceu.gtceu.api.data.tag.TagUtil; import com.gregtechceu.gtceu.common.data.GTMaterials; import com.gregtechceu.gtceu.data.recipe.CustomTags; -import com.tterrag.registrate.providers.RegistrateTagsProvider; + import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.BlockTags; @@ -14,26 +14,38 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; +import com.tterrag.registrate.providers.RegistrateTagsProvider; + public class BlockTagLoader { public static void init(RegistrateTagsProvider provider) { - create(provider, CustomTags.CONCRETE_BLOCK, Blocks.WHITE_CONCRETE, Blocks.ORANGE_CONCRETE, Blocks.MAGENTA_CONCRETE, Blocks.LIGHT_BLUE_CONCRETE, Blocks.YELLOW_CONCRETE, Blocks.LIME_CONCRETE, Blocks.PINK_CONCRETE, Blocks.GRAY_CONCRETE, Blocks.LIGHT_GRAY_CONCRETE, Blocks.CYAN_CONCRETE, Blocks.PURPLE_CONCRETE, Blocks.BLUE_CONCRETE, Blocks.BROWN_CONCRETE, Blocks.GREEN_CONCRETE, Blocks.RED_CONCRETE, Blocks.BLACK_CONCRETE); - create(provider, CustomTags.CONCRETE_POWDER_BLOCK, Blocks.WHITE_CONCRETE_POWDER, Blocks.ORANGE_CONCRETE_POWDER, Blocks.MAGENTA_CONCRETE_POWDER, Blocks.LIGHT_BLUE_CONCRETE_POWDER, Blocks.YELLOW_CONCRETE_POWDER, Blocks.LIME_CONCRETE_POWDER, Blocks.PINK_CONCRETE_POWDER, Blocks.GRAY_CONCRETE_POWDER, Blocks.LIGHT_GRAY_CONCRETE_POWDER, Blocks.CYAN_CONCRETE_POWDER, Blocks.PURPLE_CONCRETE_POWDER, Blocks.BLUE_CONCRETE_POWDER, Blocks.BROWN_CONCRETE_POWDER, Blocks.GREEN_CONCRETE_POWDER, Blocks.RED_CONCRETE_POWDER, Blocks.BLACK_CONCRETE_POWDER); + create(provider, CustomTags.CONCRETE_BLOCK, Blocks.WHITE_CONCRETE, Blocks.ORANGE_CONCRETE, + Blocks.MAGENTA_CONCRETE, Blocks.LIGHT_BLUE_CONCRETE, Blocks.YELLOW_CONCRETE, Blocks.LIME_CONCRETE, + Blocks.PINK_CONCRETE, Blocks.GRAY_CONCRETE, Blocks.LIGHT_GRAY_CONCRETE, Blocks.CYAN_CONCRETE, + Blocks.PURPLE_CONCRETE, Blocks.BLUE_CONCRETE, Blocks.BROWN_CONCRETE, Blocks.GREEN_CONCRETE, + Blocks.RED_CONCRETE, Blocks.BLACK_CONCRETE); + create(provider, CustomTags.CONCRETE_POWDER_BLOCK, Blocks.WHITE_CONCRETE_POWDER, Blocks.ORANGE_CONCRETE_POWDER, + Blocks.MAGENTA_CONCRETE_POWDER, Blocks.LIGHT_BLUE_CONCRETE_POWDER, Blocks.YELLOW_CONCRETE_POWDER, + Blocks.LIME_CONCRETE_POWDER, Blocks.PINK_CONCRETE_POWDER, Blocks.GRAY_CONCRETE_POWDER, + Blocks.LIGHT_GRAY_CONCRETE_POWDER, Blocks.CYAN_CONCRETE_POWDER, Blocks.PURPLE_CONCRETE_POWDER, + Blocks.BLUE_CONCRETE_POWDER, Blocks.BROWN_CONCRETE_POWDER, Blocks.GREEN_CONCRETE_POWDER, + Blocks.RED_CONCRETE_POWDER, Blocks.BLACK_CONCRETE_POWDER); create(provider, CustomTags.ENDSTONE_ORE_REPLACEABLES, Blocks.END_STONE); create(provider, BlockTags.REPLACEABLE, - GTMaterials.Oil.getFluid().defaultFluidState().createLegacyBlock().getBlock(), - GTMaterials.OilLight.getFluid().defaultFluidState().createLegacyBlock().getBlock(), - GTMaterials.OilHeavy.getFluid().defaultFluidState().createLegacyBlock().getBlock(), - GTMaterials.RawOil.getFluid().defaultFluidState().createLegacyBlock().getBlock(), - GTMaterials.NaturalGas.getFluid().defaultFluidState().createLegacyBlock().getBlock()); + GTMaterials.Oil.getFluid().defaultFluidState().createLegacyBlock().getBlock(), + GTMaterials.OilLight.getFluid().defaultFluidState().createLegacyBlock().getBlock(), + GTMaterials.OilHeavy.getFluid().defaultFluidState().createLegacyBlock().getBlock(), + GTMaterials.RawOil.getFluid().defaultFluidState().createLegacyBlock().getBlock(), + GTMaterials.NaturalGas.getFluid().defaultFluidState().createLegacyBlock().getBlock()); } private static void create(RegistrateTagsProvider provider, String tagName, ResourceLocation... rls) { create(provider, TagUtil.createBlockTag(tagName), rls); } - private static void create(RegistrateTagsProvider provider, TagPrefix prefix, Material material, ResourceLocation... rls) { + private static void create(RegistrateTagsProvider provider, TagPrefix prefix, Material material, + ResourceLocation... rls) { create(provider, ChemicalHelper.getBlockTag(prefix, material), rls); } diff --git a/src/main/java/com/gregtechceu/gtceu/data/tags/EntityTypeTagLoader.java b/src/main/java/com/gregtechceu/gtceu/data/tags/EntityTypeTagLoader.java index 9f4f67103e..00567f1f7e 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/tags/EntityTypeTagLoader.java +++ b/src/main/java/com/gregtechceu/gtceu/data/tags/EntityTypeTagLoader.java @@ -1,31 +1,35 @@ package com.gregtechceu.gtceu.data.tags; import com.gregtechceu.gtceu.data.recipe.CustomTags; -import com.tterrag.registrate.providers.RegistrateTagsProvider; + import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.TagKey; import net.minecraft.world.entity.EntityType; +import com.tterrag.registrate.providers.RegistrateTagsProvider; + public class EntityTypeTagLoader { public static void init(RegistrateTagsProvider> provider) { - create(provider, CustomTags.HEAT_IMMUNE, EntityType.BLAZE, EntityType.MAGMA_CUBE, EntityType.WITHER_SKELETON, EntityType.WITHER); + create(provider, CustomTags.HEAT_IMMUNE, EntityType.BLAZE, EntityType.MAGMA_CUBE, EntityType.WITHER_SKELETON, + EntityType.WITHER); create(provider, CustomTags.CHEMICAL_IMMUNE, EntityType.SKELETON, EntityType.STRAY); } - public static void create(RegistrateTagsProvider> provider, TagKey> tagKey, EntityType... rls) { + public static void create(RegistrateTagsProvider> provider, TagKey> tagKey, + EntityType... rls) { var builder = provider.addTag(tagKey); for (EntityType entityType : rls) { builder.add(BuiltInRegistries.ENTITY_TYPE.getResourceKey(entityType).get()); } } - public static void create(RegistrateTagsProvider> provider, TagKey> tagKey, ResourceLocation... rls) { + public static void create(RegistrateTagsProvider> provider, TagKey> tagKey, + ResourceLocation... rls) { var builder = provider.addTag(tagKey); for (ResourceLocation rl : rls) { builder.addOptional(rl); } } - } diff --git a/src/main/java/com/gregtechceu/gtceu/data/tags/FluidTagLoader.java b/src/main/java/com/gregtechceu/gtceu/data/tags/FluidTagLoader.java index 75d7abe36b..67c1605233 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/tags/FluidTagLoader.java +++ b/src/main/java/com/gregtechceu/gtceu/data/tags/FluidTagLoader.java @@ -1,9 +1,10 @@ package com.gregtechceu.gtceu.data.tags; -import com.tterrag.registrate.providers.RegistrateTagsProvider; import net.minecraft.world.level.material.Fluid; +import com.tterrag.registrate.providers.RegistrateTagsProvider; + public class FluidTagLoader { - public static void addPlatformSpecificFluidTags(RegistrateTagsProvider provider) { - } + + public static void addPlatformSpecificFluidTags(RegistrateTagsProvider provider) {} } diff --git a/src/main/java/com/gregtechceu/gtceu/data/tags/ItemTagLoader.java b/src/main/java/com/gregtechceu/gtceu/data/tags/ItemTagLoader.java index 1f75562698..c3a14fa3b6 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/tags/ItemTagLoader.java +++ b/src/main/java/com/gregtechceu/gtceu/data/tags/ItemTagLoader.java @@ -7,7 +7,7 @@ import com.gregtechceu.gtceu.api.data.tag.TagUtil; import com.gregtechceu.gtceu.common.data.GTItems; import com.gregtechceu.gtceu.data.recipe.CustomTags; -import com.tterrag.registrate.providers.RegistrateTagsProvider; + import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.TagEntry; @@ -16,15 +16,27 @@ import net.minecraft.world.item.Items; import net.minecraftforge.common.Tags; +import com.tterrag.registrate.providers.RegistrateTagsProvider; + import static com.gregtechceu.gtceu.api.data.tag.TagPrefix.lens; import static com.gregtechceu.gtceu.common.data.GTMaterials.*; public class ItemTagLoader { public static void init(RegistrateTagsProvider provider) { - create(provider, CustomTags.CONCRETE_ITEM, Items.WHITE_CONCRETE, Items.ORANGE_CONCRETE, Items.MAGENTA_CONCRETE, Items.LIGHT_BLUE_CONCRETE, Items.YELLOW_CONCRETE, Items.LIME_CONCRETE, Items.PINK_CONCRETE, Items.GRAY_CONCRETE, Items.LIGHT_GRAY_CONCRETE, Items.CYAN_CONCRETE, Items.PURPLE_CONCRETE, Items.BLUE_CONCRETE, Items.BROWN_CONCRETE, Items.GREEN_CONCRETE, Items.RED_CONCRETE, Items.BLACK_CONCRETE); - create(provider, CustomTags.CONCRETE_POWDER_ITEM, Items.WHITE_CONCRETE_POWDER, Items.ORANGE_CONCRETE_POWDER, Items.MAGENTA_CONCRETE_POWDER, Items.LIGHT_BLUE_CONCRETE_POWDER, Items.YELLOW_CONCRETE_POWDER, Items.LIME_CONCRETE_POWDER, Items.PINK_CONCRETE_POWDER, Items.GRAY_CONCRETE_POWDER, Items.LIGHT_GRAY_CONCRETE_POWDER, Items.CYAN_CONCRETE_POWDER, Items.PURPLE_CONCRETE_POWDER, Items.BLUE_CONCRETE_POWDER, Items.BROWN_CONCRETE_POWDER, Items.GREEN_CONCRETE_POWDER, Items.RED_CONCRETE_POWDER, Items.BLACK_CONCRETE_POWDER); - create(provider, lens, Color.White, GTItems.MATERIAL_ITEMS.get(lens, Glass).getId(), GTItems.MATERIAL_ITEMS.get(lens, NetherStar).getId()); + create(provider, CustomTags.CONCRETE_ITEM, Items.WHITE_CONCRETE, Items.ORANGE_CONCRETE, Items.MAGENTA_CONCRETE, + Items.LIGHT_BLUE_CONCRETE, Items.YELLOW_CONCRETE, Items.LIME_CONCRETE, Items.PINK_CONCRETE, + Items.GRAY_CONCRETE, Items.LIGHT_GRAY_CONCRETE, Items.CYAN_CONCRETE, Items.PURPLE_CONCRETE, + Items.BLUE_CONCRETE, Items.BROWN_CONCRETE, Items.GREEN_CONCRETE, Items.RED_CONCRETE, + Items.BLACK_CONCRETE); + create(provider, CustomTags.CONCRETE_POWDER_ITEM, Items.WHITE_CONCRETE_POWDER, Items.ORANGE_CONCRETE_POWDER, + Items.MAGENTA_CONCRETE_POWDER, Items.LIGHT_BLUE_CONCRETE_POWDER, Items.YELLOW_CONCRETE_POWDER, + Items.LIME_CONCRETE_POWDER, Items.PINK_CONCRETE_POWDER, Items.GRAY_CONCRETE_POWDER, + Items.LIGHT_GRAY_CONCRETE_POWDER, Items.CYAN_CONCRETE_POWDER, Items.PURPLE_CONCRETE_POWDER, + Items.BLUE_CONCRETE_POWDER, Items.BROWN_CONCRETE_POWDER, Items.GREEN_CONCRETE_POWDER, + Items.RED_CONCRETE_POWDER, Items.BLACK_CONCRETE_POWDER); + create(provider, lens, Color.White, GTItems.MATERIAL_ITEMS.get(lens, Glass).getId(), + GTItems.MATERIAL_ITEMS.get(lens, NetherStar).getId()); create(provider, lens, Color.LightBlue, GTItems.MATERIAL_ITEMS.get(lens, Diamond).getId()); create(provider, lens, Color.Red, GTItems.MATERIAL_ITEMS.get(lens, Ruby).getId()); create(provider, lens, Color.Green, GTItems.MATERIAL_ITEMS.get(lens, Emerald).getId()); @@ -33,25 +45,27 @@ public static void init(RegistrateTagsProvider provider) { create(provider, CustomTags.TAG_PISTONS, Items.PISTON, Items.STICKY_PISTON); // add treated wood stick to vanilla sticks tag - //noinspection DataFlowIssue ChemicalHelper#getTag can't return null with treated wood rod + // noinspection DataFlowIssue ChemicalHelper#getTag can't return null with treated wood rod provider.addTag(Tags.Items.RODS_WOODEN) - .add(TagEntry.element(GTItems.MATERIAL_ITEMS.get(TagPrefix.rod, TreatedWood).getId())); + .add(TagEntry.element(GTItems.MATERIAL_ITEMS.get(TagPrefix.rod, TreatedWood).getId())); // TODO add to planks mc tag? - //for (Material material : new Material[]{GTMaterials.Wood, GTMaterials.TreatedWood}) { - // for (ItemLike woodPlateStack : ChemicalHelper.getItems(new UnificationEntry(TagPrefix.plate, material))) { - // ChemicalHelper.registerUnificationEntry(woodPlateStack, TagPrefix.plank, material); - // } - //} + // for (Material material : new Material[]{GTMaterials.Wood, GTMaterials.TreatedWood}) { + // for (ItemLike woodPlateStack : ChemicalHelper.getItems(new UnificationEntry(TagPrefix.plate, material))) { + // ChemicalHelper.registerUnificationEntry(woodPlateStack, TagPrefix.plank, material); + // } + // } // todo match ae2 certus quartz tag - //OreDictionary.registerUnificationEntry("crystalCertusQuartz", ChemicalHelper.get(TagPrefix.gem, GTMaterials.CertusQuartz)); + // OreDictionary.registerUnificationEntry("crystalCertusQuartz", ChemicalHelper.get(TagPrefix.gem, + // GTMaterials.CertusQuartz)); } private static void create(RegistrateTagsProvider provider, String tagName, ResourceLocation... rls) { create(provider, TagUtil.createItemTag(tagName), rls); } - private static void create(RegistrateTagsProvider provider, TagPrefix prefix, Material material, ResourceLocation... rls) { + private static void create(RegistrateTagsProvider provider, TagPrefix prefix, Material material, + ResourceLocation... rls) { create(provider, ChemicalHelper.getTag(prefix, material), rls); } diff --git a/src/main/java/com/gregtechceu/gtceu/data/tags/TagsHandler.java b/src/main/java/com/gregtechceu/gtceu/data/tags/TagsHandler.java index 47fd001bd0..0f5a52940e 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/tags/TagsHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/data/tags/TagsHandler.java @@ -1,16 +1,17 @@ package com.gregtechceu.gtceu.data.tags; +import com.gregtechceu.gtceu.api.data.chemical.material.MarkerMaterials.Color; import com.gregtechceu.gtceu.common.data.GTItems; -import com.tterrag.registrate.providers.RegistrateTagsProvider; + import net.minecraft.world.entity.EntityType; import net.minecraft.world.item.Item; import net.minecraft.world.item.Items; import net.minecraft.world.level.ItemLike; import net.minecraft.world.level.block.Block; - -import com.gregtechceu.gtceu.api.data.chemical.material.MarkerMaterials.Color; import net.minecraft.world.level.material.Fluid; +import com.tterrag.registrate.providers.RegistrateTagsProvider; + import java.util.function.Supplier; import static com.gregtechceu.gtceu.api.data.chemical.ChemicalHelper.registerUnificationItems; @@ -43,12 +44,17 @@ public static void initEntity(RegistrateTagsProvider> provider) { public static void initExtraUnificationEntries() { registerUnificationItems(ingot, Clay, Items.CLAY_BALL); - registerUnificationItems(lens, Color.White, new Supplier[]{GTItems.MATERIAL_ITEMS.get(lens, Glass), GTItems.MATERIAL_ITEMS.get(lens, NetherStar)}); - registerUnificationItems(lens, Color.LightBlue, (Supplier) GTItems.MATERIAL_ITEMS.get(lens, Diamond)); - registerUnificationItems(lens, Color.Red, (Supplier) GTItems.MATERIAL_ITEMS.get(lens, Ruby)); - registerUnificationItems(lens, Color.Green, (Supplier) GTItems.MATERIAL_ITEMS.get(lens, Emerald)); - registerUnificationItems(lens, Color.Blue, (Supplier) GTItems.MATERIAL_ITEMS.get(lens, Sapphire)); - + registerUnificationItems(lens, Color.White, new Supplier[] { GTItems.MATERIAL_ITEMS.get(lens, Glass), + GTItems.MATERIAL_ITEMS.get(lens, NetherStar) }); + registerUnificationItems(lens, Color.LightBlue, + (Supplier) GTItems.MATERIAL_ITEMS.get(lens, Diamond)); + registerUnificationItems(lens, Color.Red, + (Supplier) GTItems.MATERIAL_ITEMS.get(lens, Ruby)); + registerUnificationItems(lens, Color.Green, + (Supplier) GTItems.MATERIAL_ITEMS.get(lens, Emerald)); + registerUnificationItems(lens, Color.Blue, + (Supplier) GTItems.MATERIAL_ITEMS.get(lens, Sapphire)); + registerUnificationItems(dye, Color.Black, Items.BLACK_DYE); registerUnificationItems(dye, Color.Red, Items.RED_DYE); registerUnificationItems(dye, Color.Green, Items.GREEN_DYE); diff --git a/src/main/java/com/gregtechceu/gtceu/forge/AlloyBlastPropertyAddition.java b/src/main/java/com/gregtechceu/gtceu/forge/AlloyBlastPropertyAddition.java index dba8bc08a2..8876472dc7 100644 --- a/src/main/java/com/gregtechceu/gtceu/forge/AlloyBlastPropertyAddition.java +++ b/src/main/java/com/gregtechceu/gtceu/forge/AlloyBlastPropertyAddition.java @@ -13,16 +13,17 @@ import com.gregtechceu.gtceu.api.fluids.store.FluidStorageKeys; import com.gregtechceu.gtceu.common.data.GTMaterials; import com.gregtechceu.gtceu.data.recipe.misc.alloyblast.CustomAlloyBlastRecipeProducer; + import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.common.Mod; import org.jetbrains.annotations.NotNull; + import java.util.List; /** * Listen to PostMaterialEvent instead of doing this directly because it's a lot cleaner this way. */ -//@Mod.EventBusSubscriber(modid = GTCEu.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) +// @Mod.EventBusSubscriber(modid = GTCEu.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) public class AlloyBlastPropertyAddition { @SubscribeEvent @@ -56,7 +57,8 @@ public static void addAlloyBlastProperty(@NotNull Material material) { } material.setProperty(PropertyKey.ALLOY_BLAST, new AlloyBlastProperty(material.getBlastTemperature())); - material.getProperty(PropertyKey.FLUID).getStorage().enqueueRegistration(FluidStorageKeys.MOLTEN, new FluidBuilder().state(FluidState.LIQUID)); + material.getProperty(PropertyKey.FLUID).getStorage().enqueueRegistration(FluidStorageKeys.MOLTEN, + new FluidBuilder().state(FluidState.LIQUID)); } private static boolean isMaterialStackFluidOnly(@NotNull MaterialStack ms) { diff --git a/src/main/java/com/gregtechceu/gtceu/forge/ForgeCommonEventListener.java b/src/main/java/com/gregtechceu/gtceu/forge/ForgeCommonEventListener.java index 3e6414ad0f..ba55e7d431 100644 --- a/src/main/java/com/gregtechceu/gtceu/forge/ForgeCommonEventListener.java +++ b/src/main/java/com/gregtechceu/gtceu/forge/ForgeCommonEventListener.java @@ -4,32 +4,41 @@ import com.gregtechceu.gtceu.api.GTCEuAPI; import com.gregtechceu.gtceu.api.block.MaterialBlock; import com.gregtechceu.gtceu.api.block.MetaMachineBlock; +import com.gregtechceu.gtceu.api.capability.GTCapabilityHelper; +import com.gregtechceu.gtceu.api.capability.IHazardEffectTracker; +import com.gregtechceu.gtceu.api.capability.forge.GTCapability; import com.gregtechceu.gtceu.api.capability.forge.compat.EUToFEProvider; +import com.gregtechceu.gtceu.api.data.chemical.material.Material; +import com.gregtechceu.gtceu.api.data.chemical.material.properties.HazardProperty; import com.gregtechceu.gtceu.api.data.tag.TagPrefix; import com.gregtechceu.gtceu.api.item.DrumMachineItem; import com.gregtechceu.gtceu.api.item.IComponentItem; import com.gregtechceu.gtceu.api.item.TagPrefixItem; import com.gregtechceu.gtceu.api.item.armor.ArmorComponentItem; import com.gregtechceu.gtceu.api.machine.feature.IInteractedMachine; -import com.gregtechceu.gtceu.common.ServerCommands; +import com.gregtechceu.gtceu.common.capability.HazardEffectTracker; +import com.gregtechceu.gtceu.common.commands.ServerCommands; import com.gregtechceu.gtceu.common.data.GTBlocks; import com.gregtechceu.gtceu.common.data.GTItems; import com.gregtechceu.gtceu.data.loader.BedrockOreLoader; import com.gregtechceu.gtceu.data.loader.FluidVeinLoader; import com.gregtechceu.gtceu.data.loader.OreDataLoader; import com.gregtechceu.gtceu.utils.TaskHandler; -import com.tterrag.registrate.util.entry.BlockEntry; -import com.tterrag.registrate.util.entry.ItemEntry; + import net.minecraft.core.Direction; import net.minecraft.core.registries.Registries; +import net.minecraft.nbt.CompoundTag; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; -import net.minecraft.world.damagesource.DamageSources; +import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.capabilities.ForgeCapabilities; import net.minecraftforge.common.capabilities.ICapabilityProvider; +import net.minecraftforge.common.capabilities.ICapabilitySerializable; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.event.AddReloadListenerEvent; import net.minecraftforge.event.AttachCapabilitiesEvent; @@ -40,8 +49,13 @@ import net.minecraftforge.event.level.LevelEvent; import net.minecraftforge.eventbus.api.EventPriority; import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.LogicalSide; import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.items.IItemHandler; import net.minecraftforge.registries.MissingMappingsEvent; + +import com.tterrag.registrate.util.entry.BlockEntry; +import com.tterrag.registrate.util.entry.ItemEntry; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -61,9 +75,9 @@ public class ForgeCommonEventListener { @SubscribeEvent public static void registerItemStackCapabilities(AttachCapabilitiesEvent event) { if (event.getObject().getItem() instanceof IComponentItem componentItem) { - final ItemStack itemStack = event.getObject(); event.addCapability(GTCEu.id("capability"), new ICapabilityProvider() { + @NotNull @Override public LazyOptional getCapability(@NotNull Capability cap, @Nullable Direction side) { @@ -74,20 +88,76 @@ public LazyOptional getCapability(@NotNull Capability cap, @Nullable D if (event.getObject().getItem() instanceof DrumMachineItem drumMachineItem) { final ItemStack itemStack = event.getObject(); event.addCapability(GTCEu.id("fluid"), new ICapabilityProvider() { + @Override - public @NotNull LazyOptional getCapability(@NotNull Capability capability, @Nullable Direction arg) { + public @NotNull LazyOptional getCapability(@NotNull Capability capability, + @Nullable Direction arg) { return drumMachineItem.getCapability(itemStack, capability); } }); } } + @SubscribeEvent + public static void registerEntityCapabilities(AttachCapabilitiesEvent event) { + if (event.getObject() instanceof Player entity) { + final HazardEffectTracker tracker = new HazardEffectTracker(entity); + event.addCapability(GTCEu.id("hazard_tracker"), new ICapabilitySerializable() { + + @Override + public CompoundTag serializeNBT() { + return tracker.serializeNBT(); + } + + @Override + public void deserializeNBT(CompoundTag arg) { + tracker.deserializeNBT(arg); + } + + @Override + public @NotNull LazyOptional getCapability(@NotNull Capability capability, + @Nullable Direction arg) { + return GTCapability.CAPABILITY_HAZARD_EFFECT_TRACKER.orEmpty(capability, + LazyOptional.of(() -> tracker)); + } + }); + } + } + + @SubscribeEvent + public static void attachCapabilities(AttachCapabilitiesEvent event) { + event.addCapability(GTCEu.id("fe_capability"), new EUToFEProvider(event.getObject())); + } + + @SubscribeEvent + public static void tickPlayerInventoryHazards(TickEvent.PlayerTickEvent event) { + if (event.side == LogicalSide.CLIENT || event.phase != TickEvent.Phase.END) { + return; + } + Player player = event.player; + IHazardEffectTracker tracker = GTCapabilityHelper.getHazardEffectTracker(player); + IItemHandler inventory = player.getCapability(ForgeCapabilities.ITEM_HANDLER, null).resolve().orElse(null); + if (tracker != null && inventory != null) { + tracker.startTick(); + for (int i = 0; i < inventory.getSlots(); ++i) { + ItemStack stack = inventory.getStackInSlot(i); + Material material = HazardProperty.getValidHazardMaterial(stack); + if (material == null) { + continue; + } + tracker.tick(material); + } + tracker.endTick(); + } + } + @SubscribeEvent public static void onLeftClickBlock(PlayerInteractEvent.LeftClickBlock event) { var blockState = event.getLevel().getBlockState(event.getPos()); - if (blockState.hasBlockEntity() && blockState.getBlock() instanceof MetaMachineBlock block - && block.getMachine(event.getLevel(), event.getPos()) instanceof IInteractedMachine machine) { - if (machine.onLeftClick(event.getEntity(), event.getLevel(), event.getHand(), event.getPos(), event.getFace())) { + if (blockState.hasBlockEntity() && blockState.getBlock() instanceof MetaMachineBlock block && + block.getMachine(event.getLevel(), event.getPos()) instanceof IInteractedMachine machine) { + if (machine.onLeftClick(event.getEntity(), event.getLevel(), event.getHand(), event.getPos(), + event.getFace())) { event.setCanceled(true); } } @@ -105,14 +175,9 @@ public static void registerReloadListeners(AddReloadListenerEvent event) { event.addListener(new BedrockOreLoader()); } - @SubscribeEvent - public static void attachCapabilities(AttachCapabilitiesEvent event) { - event.addCapability(GTCEu.id("fe_capability"), new EUToFEProvider(event.getObject())); - } - @SubscribeEvent public static void levelTick(TickEvent.LevelTickEvent event) { - if (event.level instanceof ServerLevel serverLevel && event.phase.equals(TickEvent.Phase.END)) { + if (event.phase == TickEvent.Phase.END && event.level instanceof ServerLevel serverLevel) { TaskHandler.onTickUpdate(serverLevel); } } @@ -135,15 +200,16 @@ public static void onEntityLivingFallEvent(LivingFallEvent event) { if (!armor.isEmpty() && armor.getItem() instanceof ArmorComponentItem valueItem) { valueItem.getArmorLogic().damageArmor(player, armor, player.damageSources().fall(), - (int) (player.fallDistance - 1.2f), EquipmentSlot.FEET); - player.fallDistance = 0; - event.setCanceled(true); - } else if (!jet.isEmpty() && jet.getItem() instanceof ArmorComponentItem valueItem && jet.getOrCreateTag().contains("flyMode")) { - valueItem.getArmorLogic().damageArmor(player, jet, player.damageSources().fall(), - (int) (player.fallDistance - 1.2f), EquipmentSlot.FEET); + (int) (player.fallDistance - 1.2f), EquipmentSlot.FEET); player.fallDistance = 0; event.setCanceled(true); - } + } else if (!jet.isEmpty() && jet.getItem() instanceof ArmorComponentItem valueItem && + jet.getOrCreateTag().contains("flyMode")) { + valueItem.getArmorLogic().damageArmor(player, jet, player.damageSources().fall(), + (int) (player.fallDistance - 1.2f), EquipmentSlot.FEET); + player.fallDistance = 0; + event.setCanceled(true); + } } } @@ -167,7 +233,8 @@ public static void remapIds(MissingMappingsEvent event) { event.getMappings(Registries.BLOCK, GTCEu.MOD_ID).forEach(mapping -> { Matcher matcher = idPattern.matcher(mapping.getKey().getPath()); if (matcher.matches()) { - BlockEntry block = GTBlocks.MATERIAL_BLOCKS.get(prefix, GTCEuAPI.materialManager.getRegistry(GTCEu.MOD_ID).get(matcher.group(1))); + BlockEntry block = GTBlocks.MATERIAL_BLOCKS.get(prefix, + GTCEuAPI.materialManager.getRegistry(GTCEu.MOD_ID).get(matcher.group(1))); if (block != null && block.isPresent()) { mapping.remap(block.get()); } @@ -176,11 +243,13 @@ public static void remapIds(MissingMappingsEvent event) { event.getMappings(Registries.ITEM, GTCEu.MOD_ID).forEach(mapping -> { Matcher matcher = idPattern.matcher(mapping.getKey().getPath()); if (matcher.matches()) { - BlockEntry block = GTBlocks.MATERIAL_BLOCKS.get(prefix, GTCEuAPI.materialManager.getRegistry(GTCEu.MOD_ID).get(matcher.group(1))); + BlockEntry block = GTBlocks.MATERIAL_BLOCKS.get(prefix, + GTCEuAPI.materialManager.getRegistry(GTCEu.MOD_ID).get(matcher.group(1))); if (block != null && block.isPresent()) { mapping.remap(block.asItem()); } else { - ItemEntry item = GTItems.MATERIAL_ITEMS.get(prefix, GTCEuAPI.materialManager.getRegistry(GTCEu.MOD_ID).get(matcher.group(1))); + ItemEntry item = GTItems.MATERIAL_ITEMS.get(prefix, + GTCEuAPI.materialManager.getRegistry(GTCEu.MOD_ID).get(matcher.group(1))); if (item != null && item.isPresent()) { mapping.remap(item.asItem()); } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/GTOreByProduct.java b/src/main/java/com/gregtechceu/gtceu/integration/GTOreByProduct.java index 6719490484..de3c5b9daa 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/GTOreByProduct.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/GTOreByProduct.java @@ -1,6 +1,5 @@ package com.gregtechceu.gtceu.integration; -import com.google.common.collect.ImmutableList; import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.data.chemical.ChemicalHelper; import com.gregtechceu.gtceu.api.data.chemical.material.Material; @@ -12,12 +11,9 @@ import com.gregtechceu.gtceu.common.data.GTMachines; import com.gregtechceu.gtceu.common.data.GTMaterials; import com.gregtechceu.gtceu.utils.FormattingUtil; -import com.lowdragmc.lowdraglib.LDLib; + import com.lowdragmc.lowdraglib.side.fluid.FluidStack; -import com.mojang.datafixers.util.Either; -import com.mojang.datafixers.util.Pair; -import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; + import net.minecraft.core.NonNullList; import net.minecraft.network.chat.Component; import net.minecraft.tags.TagKey; @@ -27,6 +23,12 @@ import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.material.Fluid; +import com.google.common.collect.ImmutableList; +import com.mojang.datafixers.util.Either; +import com.mojang.datafixers.util.Pair; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; + import java.util.ArrayList; import java.util.List; @@ -57,33 +59,32 @@ public static void addOreByProductPrefix(TagPrefix orePrefix) { public GTOreByProduct(Material material) { if (IN_PROCESSING_STEPS == null) { IN_PROCESSING_STEPS = ImmutableList.of( - TagPrefix.crushed, - TagPrefix.crushedPurified, - TagPrefix.dustImpure, - TagPrefix.dustPure, - TagPrefix.crushedRefined - ); + TagPrefix.crushed, + TagPrefix.crushedPurified, + TagPrefix.dustImpure, + TagPrefix.dustPure, + TagPrefix.crushedRefined); } if (ALWAYS_MACHINES == null) { ALWAYS_MACHINES = ImmutableList.of( - GTMachines.MACERATOR[GTValues.LV].asStack(), - GTMachines.MACERATOR[GTValues.LV].asStack(), - GTMachines.CENTRIFUGE[GTValues.LV].asStack(), - GTMachines.ORE_WASHER[GTValues.LV].asStack(), - GTMachines.THERMAL_CENTRIFUGE[GTValues.LV].asStack(), - GTMachines.MACERATOR[GTValues.LV].asStack(), - GTMachines.MACERATOR[GTValues.LV].asStack(), - GTMachines.CENTRIFUGE[GTValues.LV].asStack()); + GTMachines.MACERATOR[GTValues.LV].asStack(), + GTMachines.MACERATOR[GTValues.LV].asStack(), + GTMachines.CENTRIFUGE[GTValues.LV].asStack(), + GTMachines.ORE_WASHER[GTValues.LV].asStack(), + GTMachines.THERMAL_CENTRIFUGE[GTValues.LV].asStack(), + GTMachines.MACERATOR[GTValues.LV].asStack(), + GTMachines.MACERATOR[GTValues.LV].asStack(), + GTMachines.CENTRIFUGE[GTValues.LV].asStack()); } OreProperty property = material.getProperty(PropertyKey.ORE); int oreMultiplier = property.getOreMultiplier(); int byproductMultiplier = property.getByProductMultiplier(); currentSlot = 0; Material[] byproducts = new Material[] { - property.getOreByProduct(0, material), - property.getOreByProduct(1, material), - property.getOreByProduct(2, material), - property.getOreByProduct(3, material) + property.getOreByProduct(0, material), + property.getOreByProduct(1, material), + property.getOreByProduct(2, material), + property.getOreByProduct(3, material) }; // "INPUTS" @@ -154,7 +155,7 @@ public GTOreByProduct(Material material) { if (hasDirectSmelt) { ItemStack smeltingResult; Material smeltingMaterial = property.getDirectSmeltResult() == null ? material : - property.getDirectSmeltResult(); + property.getDirectSmeltResult(); if (smeltingMaterial.hasProperty(PropertyKey.INGOT)) { smeltingResult = ChemicalHelper.get(TagPrefix.ingot, smeltingMaterial); } else if (smeltingMaterial.hasProperty(PropertyKey.GEM)) { @@ -232,7 +233,7 @@ public GTOreByProduct(Material material) { addToOutputs(byproducts[3], TagPrefix.dust, byproductMultiplier); addChance(7000, 580); List, Long>> washedFluid = new ArrayList<>(); - //noinspection DataFlowIssue + // noinspection DataFlowIssue washedFluid.add(Pair.of(washedIn.getFirst().getFluidTag(), (long) washedIn.getSecond())); fluidInputs.add(Either.left(washedFluid)); } else { @@ -243,12 +244,12 @@ public GTOreByProduct(Material material) { // electromagnetic separator if (hasSeparator) { - //noinspection DataFlowIssue + // noinspection DataFlowIssue TagPrefix prefix = (separatedInto.get(separatedInto.size() - 1).getBlastTemperature() == 0 && - separatedInto.get(separatedInto.size() - 1).hasProperty(PropertyKey.INGOT)) ? TagPrefix.nugget : - TagPrefix.dust; + separatedInto.get(separatedInto.size() - 1).hasProperty(PropertyKey.INGOT)) ? TagPrefix.nugget : + TagPrefix.dust; ItemStack separatedStack2 = ChemicalHelper.get(prefix, separatedInto.get(separatedInto.size() - 1), - prefix == TagPrefix.nugget ? 2 : 1); + prefix == TagPrefix.nugget ? 2 : 1); addToOutputs(material, TagPrefix.dust, 1); addToOutputs(separatedInto.get(0), TagPrefix.dust, 1); diff --git a/src/main/java/com/gregtechceu/gtceu/integration/GTOreByProductWidget.java b/src/main/java/com/gregtechceu/gtceu/integration/GTOreByProductWidget.java index 9ae3adaa00..07e640e0ca 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/GTOreByProductWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/GTOreByProductWidget.java @@ -1,9 +1,9 @@ package com.gregtechceu.gtceu.integration; -import com.google.common.collect.ImmutableList; import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.api.recipe.content.Content; + import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.widget.*; import com.lowdragmc.lowdraglib.jei.IngredientIO; @@ -12,14 +12,17 @@ import com.lowdragmc.lowdraglib.side.fluid.FluidStack; import com.lowdragmc.lowdraglib.utils.TagOrCycleFluidTransfer; import com.lowdragmc.lowdraglib.utils.TagOrCycleItemStackTransfer; -import com.mojang.datafixers.util.Either; -import com.mojang.datafixers.util.Pair; + import net.minecraft.core.NonNullList; import net.minecraft.tags.TagKey; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.material.Fluid; +import com.google.common.collect.ImmutableList; +import com.mojang.datafixers.util.Either; +import com.mojang.datafixers.util.Pair; + import java.util.ArrayList; import java.util.List; import java.util.function.Function; @@ -28,63 +31,63 @@ public class GTOreByProductWidget extends WidgetGroup { // XY positions of every item and fluid, in three enormous lists protected final static ImmutableList ITEM_INPUT_LOCATIONS = ImmutableList.of( - 3, 3, // ore - 23, 3, // furnace (direct smelt) - 3, 24, // macerator (ore -> crushed) - 23, 71, // macerator (crushed -> impure) - 50, 80, // centrifuge (impure -> dust) - 24, 25, // ore washer - 97, 71, // thermal centrifuge - 70, 80, // macerator (centrifuged -> dust) - 114, 48, // macerator (crushed purified -> purified) - 133, 71, // centrifuge (purified -> dust) - 3, 123, // cauldron / simple washer (crushed) - 41, 145, // cauldron (impure) - 102, 145, // cauldron (purified) - 24, 48, // chem bath - 155, 71, // electro separator - 101, 25 // sifter + 3, 3, // ore + 23, 3, // furnace (direct smelt) + 3, 24, // macerator (ore -> crushed) + 23, 71, // macerator (crushed -> impure) + 50, 80, // centrifuge (impure -> dust) + 24, 25, // ore washer + 97, 71, // thermal centrifuge + 70, 80, // macerator (centrifuged -> dust) + 114, 48, // macerator (crushed purified -> purified) + 133, 71, // centrifuge (purified -> dust) + 3, 123, // cauldron / simple washer (crushed) + 41, 145, // cauldron (impure) + 102, 145, // cauldron (purified) + 24, 48, // chem bath + 155, 71, // electro separator + 101, 25 // sifter ); protected final static ImmutableList ITEM_OUTPUT_LOCATIONS = ImmutableList.of( - 46, 3, // smelt result - 3, 47, // ore -> crushed - 3, 65, // byproduct - 23, 92, // crushed -> impure - 23, 110, // byproduct - 50, 101, // impure -> dust - 50, 119, // byproduct - 64, 25, // crushed -> crushed purified (wash) - 82, 25, // byproduct - 97, 92, // crushed/crushed purified -> centrifuged - 97, 110, // byproduct - 70, 101, // centrifuged -> dust - 70, 119, // byproduct - 137, 47, // crushed purified -> purified - 155, 47, // byproduct - 133, 92, // purified -> dust - 133, 110, // byproduct - 3, 105, // crushed cauldron - 3, 145, // -> purified crushed - 23, 145, // impure cauldron - 63, 145, // -> dust - 84, 145, // purified cauldron - 124, 145, // -> dust - 64, 48, // crushed -> crushed purified (chem bath) - 82, 48, // byproduct - 155, 92, // purified -> dust (electro separator) - 155, 110, // byproduct 1 - 155, 128, // byproduct 2 - 119, 3, // sifter outputs... - 137, 3, - 155, 3, - 119, 21, - 137, 21, - 155, 21); + 46, 3, // smelt result + 3, 47, // ore -> crushed + 3, 65, // byproduct + 23, 92, // crushed -> impure + 23, 110, // byproduct + 50, 101, // impure -> dust + 50, 119, // byproduct + 64, 25, // crushed -> crushed purified (wash) + 82, 25, // byproduct + 97, 92, // crushed/crushed purified -> centrifuged + 97, 110, // byproduct + 70, 101, // centrifuged -> dust + 70, 119, // byproduct + 137, 47, // crushed purified -> purified + 155, 47, // byproduct + 133, 92, // purified -> dust + 133, 110, // byproduct + 3, 105, // crushed cauldron + 3, 145, // -> purified crushed + 23, 145, // impure cauldron + 63, 145, // -> dust + 84, 145, // purified cauldron + 124, 145, // -> dust + 64, 48, // crushed -> crushed purified (chem bath) + 82, 48, // byproduct + 155, 92, // purified -> dust (electro separator) + 155, 110, // byproduct 1 + 155, 128, // byproduct 2 + 119, 3, // sifter outputs... + 137, 3, + 155, 3, + 119, 21, + 137, 21, + 155, 21); protected final static ImmutableList FLUID_LOCATIONS = ImmutableList.of( - 42, 25, // washer in - 42, 48 // chem bath in + 42, 25, // washer in + 42, 48 // chem bath in ); public GTOreByProductWidget(Material material) { @@ -119,11 +122,12 @@ public void setRecipe(GTOreByProduct recipeWrapper) { WidgetGroup itemStackGroup = new WidgetGroup(); for (int i = 0; i < ITEM_INPUT_LOCATIONS.size(); i += 2) { final int finalI = i; - itemStackGroup.addWidget(new SlotWidget(itemInputsHandler, i / 2, ITEM_INPUT_LOCATIONS.get(i), ITEM_INPUT_LOCATIONS.get(i + 1)) - .setCanTakeItems(false).setCanPutItems(false) - .setIngredientIO(IngredientIO.INPUT) - .setOnAddedTooltips((slot, tooltips) -> recipeWrapper.getTooltip(finalI / 2, tooltips)) - .setBackground((IGuiTexture) null)); + itemStackGroup.addWidget(new SlotWidget(itemInputsHandler, i / 2, ITEM_INPUT_LOCATIONS.get(i), + ITEM_INPUT_LOCATIONS.get(i + 1)) + .setCanTakeItems(false).setCanPutItems(false) + .setIngredientIO(IngredientIO.INPUT) + .setOnAddedTooltips((slot, tooltips) -> recipeWrapper.getTooltip(finalI / 2, tooltips)) + .setBackground((IGuiTexture) null)); } NonNullList itemOutputs = recipeWrapper.itemOutputs; @@ -142,11 +146,13 @@ public void setRecipe(GTOreByProduct recipeWrapper) { continue; } - itemStackGroup.addWidget(new SlotWidget(itemOutputsHandler, slotIndex, ITEM_OUTPUT_LOCATIONS.get(i), ITEM_OUTPUT_LOCATIONS.get(i + 1)) - .setCanTakeItems(false).setCanPutItems(false) - .setIngredientIO(IngredientIO.OUTPUT).setXEIChance(xeiChance) - .setOnAddedTooltips((slot, tooltips) -> recipeWrapper.getTooltip(slotIndex + itemInputs.size(), tooltips)) - .setBackground((IGuiTexture) null).setOverlay(overlay)); + itemStackGroup.addWidget(new SlotWidget(itemOutputsHandler, slotIndex, ITEM_OUTPUT_LOCATIONS.get(i), + ITEM_OUTPUT_LOCATIONS.get(i + 1)) + .setCanTakeItems(false).setCanPutItems(false) + .setIngredientIO(IngredientIO.OUTPUT).setXEIChance(xeiChance) + .setOnAddedTooltips( + (slot, tooltips) -> recipeWrapper.getTooltip(slotIndex + itemInputs.size(), tooltips)) + .setBackground((IGuiTexture) null).setOverlay(overlay)); itemOutputExists.add(true); } @@ -156,8 +162,9 @@ public void setRecipe(GTOreByProduct recipeWrapper) { for (int i = 0; i < FLUID_LOCATIONS.size(); i += 2) { int slotIndex = i / 2; if (!fluidInputs.get(slotIndex).map(Function.identity(), Function.identity()).isEmpty()) { - fluidStackGroup.addWidget(new TankWidget(new FluidStorage(fluidInputsHandler.getFluidInTank(slotIndex)), FLUID_LOCATIONS.get(i), FLUID_LOCATIONS.get(i + 1), false, false) - .setIngredientIO(IngredientIO.INPUT).setBackground(GuiTextures.FLUID_SLOT)); + fluidStackGroup.addWidget(new TankWidget(new FluidStorage(fluidInputsHandler.getFluidInTank(slotIndex)), + FLUID_LOCATIONS.get(i), FLUID_LOCATIONS.get(i + 1), false, false) + .setIngredientIO(IngredientIO.INPUT).setBackground(GuiTextures.FLUID_SLOT)); } } @@ -167,9 +174,9 @@ public void setRecipe(GTOreByProduct recipeWrapper) { for (int i = 0; i < ITEM_OUTPUT_LOCATIONS.size(); i += 2) { // stupid hack to show all sifter slots if the first one exists if (itemOutputExists.get(i / 2) || (i > 28 * 2 && itemOutputExists.get(28) && hasSifter)) { - addWidget(this.widgets.size() - 3, new ImageWidget(ITEM_OUTPUT_LOCATIONS.get(i), ITEM_OUTPUT_LOCATIONS.get(i + 1), 18, 18, GuiTextures.SLOT)); + addWidget(this.widgets.size() - 3, new ImageWidget(ITEM_OUTPUT_LOCATIONS.get(i), + ITEM_OUTPUT_LOCATIONS.get(i + 1), 18, 18, GuiTextures.SLOT)); } } } - } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/GTOreVeinWidget.java b/src/main/java/com/gregtechceu/gtceu/integration/GTOreVeinWidget.java index c68d997cb5..556f765bea 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/GTOreVeinWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/GTOreVeinWidget.java @@ -10,6 +10,7 @@ import com.gregtechceu.gtceu.common.data.GTBedrockFluids; import com.gregtechceu.gtceu.common.data.GTOres; import com.gregtechceu.gtceu.data.loader.OreDataLoader; + import com.lowdragmc.lowdraglib.gui.texture.TextTexture; import com.lowdragmc.lowdraglib.gui.widget.*; import com.lowdragmc.lowdraglib.jei.IngredientIO; @@ -17,7 +18,7 @@ import com.lowdragmc.lowdraglib.misc.ItemStackTransfer; import com.lowdragmc.lowdraglib.side.fluid.FluidStack; import com.lowdragmc.lowdraglib.utils.LocalizationUtils; -import lombok.Getter; + import net.minecraft.core.NonNullList; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceKey; @@ -28,6 +29,8 @@ import net.minecraft.world.level.levelgen.heightproviders.UniformHeight; import net.minecraft.world.level.material.Fluid; +import lombok.Getter; + import java.util.List; import java.util.Set; import java.util.stream.Collectors; @@ -38,6 +41,7 @@ */ @Getter public class GTOreVeinWidget extends WidgetGroup { + private final String name; private final int weight; private final String range; @@ -80,24 +84,25 @@ private String range(GTOreDefinition oreDefinition) { return String.format("%d - %d", minHeight, maxHeight); } - private void setupBaseGui(GTOreDefinition oreDefinition){ + private void setupBaseGui(GTOreDefinition oreDefinition) { NonNullList containedOresAsItemStacks = NonNullList.create(); List chances = oreDefinition.veinGenerator().getAllChances(); containedOresAsItemStacks.addAll(getContainedOresAndBlocks(oreDefinition)); int n = containedOresAsItemStacks.size(); int x = (width - 18 * n) / 2; for (int i = 0; i < n; i++) { - SlotWidget oreSlot = new SlotWidget(new ItemStackTransfer(containedOresAsItemStacks), i, x, 18, false, false); + SlotWidget oreSlot = new SlotWidget(new ItemStackTransfer(containedOresAsItemStacks), i, x, 18, false, + false); int finalI = i; - oreSlot.setOnAddedTooltips((stack, tooltips) -> - tooltips.add(Component.nullToEmpty(LocalizationUtils.format("gtceu.jei.ore_vein_diagram.chance", chances.get(finalI))))); + oreSlot.setOnAddedTooltips((stack, tooltips) -> tooltips.add(Component + .nullToEmpty(LocalizationUtils.format("gtceu.jei.ore_vein_diagram.chance", chances.get(finalI))))); oreSlot.setIngredientIO(IngredientIO.OUTPUT); addWidget(oreSlot); x += 18; } } - private void setupBaseGui(BedrockFluidDefinition fluid){ + private void setupBaseGui(BedrockFluidDefinition fluid) { Fluid storedFluid = fluid.getStoredFluid().get(); TankWidget fluidSlot = new TankWidget( new FluidStorage(FluidStack.create(storedFluid, 1000)), 51, 18, false, false); @@ -105,9 +110,10 @@ private void setupBaseGui(BedrockFluidDefinition fluid){ addWidget(fluidSlot); } - private void setupText(GTOreDefinition ignored){ + private void setupText(GTOreDefinition ignored) { addWidget(new ImageWidget(5, 0, width - 10, 16, - new TextTexture("gtceu.jei.ore_vein." + name).setType(TextTexture.TextType.LEFT_ROLL).setWidth(width - 10))); + new TextTexture("gtceu.jei.ore_vein." + name).setType(TextTexture.TextType.LEFT_ROLL) + .setWidth(width - 10))); addWidget(new LabelWidget(5, 40, LocalizationUtils.format("gtceu.jei.ore_vein_diagram.spawn_range"))); addWidget(new LabelWidget(5, 50, range)); @@ -119,9 +125,10 @@ private void setupText(GTOreDefinition ignored){ addWidget(new LabelWidget(5, 80, dimensions)); } - private void setupText(BedrockFluidDefinition ignored){ + private void setupText(BedrockFluidDefinition ignored) { addWidget(new ImageWidget(5, 0, width - 10, 16, - new TextTexture("gtceu.jei.bedrock_fluid." + name).setType(TextTexture.TextType.LEFT_ROLL).setWidth(width - 10))); + new TextTexture("gtceu.jei.bedrock_fluid." + name).setType(TextTexture.TextType.LEFT_ROLL) + .setWidth(width - 10))); addWidget(new LabelWidget(5, 40, LocalizationUtils.format("gtceu.jei.ore_vein_diagram.weight", weight))); addWidget(new LabelWidget(5, 50, @@ -138,7 +145,8 @@ private String dimensions() { public static List getContainedOresAndBlocks(GTOreDefinition oreDefinition) { return oreDefinition.veinGenerator().getAllEntries().stream() - .map(entry -> entry.getKey().map(state -> state.getBlock().asItem().getDefaultInstance(), material -> ChemicalHelper.get(TagPrefix.rawOre, material))) + .map(entry -> entry.getKey().map(state -> state.getBlock().asItem().getDefaultInstance(), + material -> ChemicalHelper.get(TagPrefix.rawOre, material))) .toList(); } @@ -152,15 +160,15 @@ public String getFluidName(BedrockFluidDefinition fluid) { return id.getPath(); } - public static void init(){ - if (GTRegistries.ORE_VEINS.values().isEmpty()){ + public static void init() { + if (GTRegistries.ORE_VEINS.values().isEmpty()) { GTRegistries.ORE_VEINS.unfreeze(); GTOres.init(); AddonFinder.getAddons().forEach(IGTAddon::registerOreVeins); OreDataLoader.buildVeinGenerator(); GTRegistries.ORE_VEINS.freeze(); } - if (GTRegistries.BEDROCK_FLUID_DEFINITIONS.values().isEmpty()){ + if (GTRegistries.BEDROCK_FLUID_DEFINITIONS.values().isEmpty()) { GTRegistries.BEDROCK_FLUID_DEFINITIONS.unfreeze(); GTBedrockFluids.init(); AddonFinder.getAddons().forEach(IGTAddon::registerFluidVeins); diff --git a/src/main/java/com/gregtechceu/gtceu/integration/GTRecipeWidget.java b/src/main/java/com/gregtechceu/gtceu/integration/GTRecipeWidget.java index 6c61ff8c93..44d6d7b28a 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/GTRecipeWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/GTRecipeWidget.java @@ -1,7 +1,5 @@ package com.gregtechceu.gtceu.integration; -import com.google.common.collect.Table; -import com.google.common.collect.Tables; import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.capability.recipe.CWURecipeCapability; import com.gregtechceu.gtceu.api.capability.recipe.IO; @@ -15,6 +13,7 @@ import com.gregtechceu.gtceu.api.recipe.RecipeHelper; import com.gregtechceu.gtceu.api.recipe.content.Content; import com.gregtechceu.gtceu.utils.FormattingUtil; + import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.gui.compass.CompassManager; import com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup; @@ -23,14 +22,18 @@ import com.lowdragmc.lowdraglib.gui.widget.LabelWidget; import com.lowdragmc.lowdraglib.gui.widget.ProgressWidget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; -import it.unimi.dsi.fastutil.longs.LongIntPair; -import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap; -import lombok.Getter; + import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; import net.minecraft.util.Mth; + +import com.google.common.collect.Table; +import com.google.common.collect.Tables; +import it.unimi.dsi.fastutil.longs.LongIntPair; +import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap; +import lombok.Getter; import org.apache.commons.lang3.mutable.MutableInt; import org.jetbrains.annotations.NotNull; import org.lwjgl.glfw.GLFW; @@ -46,6 +49,7 @@ * @implNote GTRecipeWidget */ public class GTRecipeWidget extends WidgetGroup { + public static final int LINE_HEIGHT = 10; private final int xOffset; @@ -58,7 +62,8 @@ public class GTRecipeWidget extends WidgetGroup { private LabelWidget voltageTextWidget; public GTRecipeWidget(GTRecipe recipe) { - super(getXOffset(recipe), 0, recipe.recipeType.getRecipeUI().getJEISize().width, recipe.recipeType.getRecipeUI().getJEISize().height); + super(getXOffset(recipe), 0, recipe.recipeType.getRecipeUI().getJEISize().width, + recipe.recipeType.getRecipeUI().getJEISize().height); this.recipe = recipe; this.xOffset = getXOffset(recipe); setRecipeWidget(); @@ -69,7 +74,8 @@ public GTRecipeWidget(GTRecipe recipe) { private static int getXOffset(GTRecipe recipe) { if (recipe.recipeType.getRecipeUI().getOriginalWidth() != recipe.recipeType.getRecipeUI().getJEISize().width) { - return (recipe.recipeType.getRecipeUI().getJEISize().width - recipe.recipeType.getRecipeUI().getOriginalWidth()) / 2; + return (recipe.recipeType.getRecipeUI().getJEISize().width - + recipe.recipeType.getRecipeUI().getOriginalWidth()) / 2; } return 0; } @@ -79,10 +85,12 @@ private void setRecipeWidget() { setClientSideWidget(); var storages = Tables.newCustomTable(new EnumMap<>(IO.class), LinkedHashMap, Object>::new); - var contents = Tables.newCustomTable(new EnumMap<>(IO.class), LinkedHashMap, List>::new); + var contents = Tables.newCustomTable(new EnumMap<>(IO.class), + LinkedHashMap, List>::new); collectStorage(storages, contents, recipe); - WidgetGroup group = recipe.recipeType.getRecipeUI().createUITemplate(ProgressWidget.JEIProgress, storages, recipe.data.copy(), recipe.conditions); + WidgetGroup group = recipe.recipeType.getRecipeUI().createUITemplate(ProgressWidget.JEIProgress, storages, + recipe.data.copy(), recipe.conditions); addSlots(contents, group, recipe); var size = group.getSize(); @@ -101,16 +109,16 @@ private void setRecipeWidget() { /// add text based on i/o's MutableInt yOff = new MutableInt(yOffset); for (var capability : recipe.inputs.entrySet()) { - capability.getKey().addXEIInfo(this, xOffset, capability.getValue(), false, true, yOff); + capability.getKey().addXEIInfo(this, xOffset, recipe, capability.getValue(), false, true, yOff); } for (var capability : recipe.tickInputs.entrySet()) { - capability.getKey().addXEIInfo(this, xOffset, capability.getValue(), true, true, yOff); + capability.getKey().addXEIInfo(this, xOffset, recipe, capability.getValue(), true, true, yOff); } for (var capability : recipe.outputs.entrySet()) { - capability.getKey().addXEIInfo(this, xOffset, capability.getValue(), false, false, yOff); + capability.getKey().addXEIInfo(this, xOffset, recipe, capability.getValue(), false, false, yOff); } for (var capability : recipe.tickOutputs.entrySet()) { - capability.getKey().addXEIInfo(this, xOffset, capability.getValue(), true, false, yOff); + capability.getKey().addXEIInfo(this, xOffset, recipe, capability.getValue(), true, false, yOff); } yOffset = yOff.getValue(); @@ -138,21 +146,22 @@ private void initializeRecipeTextWidget() { recipeParaTexts.add(labelWidget); } if (inputEUt > 0) { - LabelWidget voltageTextWidget = new LabelWidget(getVoltageXOffset() - xOffset, getSize().height - 10, tierText).setTextColor(-1).setDropShadow(false); + LabelWidget voltageTextWidget = new LabelWidget(getVoltageXOffset() - xOffset, getSize().height - 10, + tierText).setTextColor(-1).setDropShadow(false); if (recipe.recipeType.isOffsetVoltageText()) { voltageTextWidget.setSelfPositionY(getSize().height - recipe.recipeType.getVoltageTextOffset()); } // make it clickable // voltageTextWidget.setBackground(new GuiTextureGroup(GuiTextures.BUTTON)); addWidget(new ButtonWidget(voltageTextWidget.getPositionX(), voltageTextWidget.getPositionY(), - voltageTextWidget.getSizeWidth(), voltageTextWidget.getSizeHeight(), cd -> setRecipeOC(cd.button, cd.isShiftClick)) - .setHoverTooltips( - Component.translatable("gtceu.oc.tooltip.0", GTValues.VNF[getMinTier()]), - Component.translatable("gtceu.oc.tooltip.1"), - Component.translatable("gtceu.oc.tooltip.2"), - Component.translatable("gtceu.oc.tooltip.3"), - Component.translatable("gtceu.oc.tooltip.4") - )); + voltageTextWidget.getSizeWidth(), voltageTextWidget.getSizeHeight(), + cd -> setRecipeOC(cd.button, cd.isShiftClick)) + .setHoverTooltips( + Component.translatable("gtceu.oc.tooltip.0", GTValues.VNF[getMinTier()]), + Component.translatable("gtceu.oc.tooltip.1"), + Component.translatable("gtceu.oc.tooltip.2"), + Component.translatable("gtceu.oc.tooltip.3"), + Component.translatable("gtceu.oc.tooltip.4"))); addWidget(this.voltageTextWidget = voltageTextWidget); } } @@ -172,13 +181,17 @@ private static List getRecipeParaText(GTRecipe recipe, int duration, if (EUt > 0) { long euTotal = EUt * recipe.duration; // sadly we still need a custom override here, since computation uses duration and EU/t very differently - if (recipe.data.getBoolean("duration_is_total_cwu") && recipe.tickInputs.containsKey(CWURecipeCapability.CAP)) { - int minimumCWUt = Math.min(recipe.tickInputs.get(CWURecipeCapability.CAP).stream().map(Content::getContent).mapToInt(CWURecipeCapability.CAP::of).sum(), 1); - texts.add(Component.translatable("gtceu.recipe.max_eu", FormattingUtil.formatNumbers(euTotal / minimumCWUt))); + if (recipe.data.getBoolean("duration_is_total_cwu") && + recipe.tickInputs.containsKey(CWURecipeCapability.CAP)) { + int minimumCWUt = Math.min(recipe.tickInputs.get(CWURecipeCapability.CAP).stream() + .map(Content::getContent).mapToInt(CWURecipeCapability.CAP::of).sum(), 1); + texts.add(Component.translatable("gtceu.recipe.max_eu", + FormattingUtil.formatNumbers(euTotal / minimumCWUt))); } else { texts.add(Component.translatable("gtceu.recipe.total", FormattingUtil.formatNumbers(euTotal))); } - texts.add(Component.translatable(!isOutput ? "gtceu.recipe.eu" : "gtceu.recipe.eu_inverted", FormattingUtil.formatNumbers(EUt))); + texts.add(Component.translatable(!isOutput ? "gtceu.recipe.eu" : "gtceu.recipe.eu_inverted", + FormattingUtil.formatNumbers(EUt))); } return texts; @@ -191,8 +204,11 @@ private void addButtons() { x = getSize().width - xOffset - 18; y = getSize().height - 30; } - addWidget(new PredicatedButtonWidget(x, y, 15, 15, new GuiTextureGroup(GuiTextures.BUTTON, new TextTexture("ID")), cd -> - Minecraft.getInstance().keyboardHandler.setClipboard(recipe.id.toString()), () -> CompassManager.INSTANCE.devMode, CompassManager.INSTANCE.devMode).setHoverTooltips("click to copy: " + recipe.id)); + addWidget( + new PredicatedButtonWidget(x, y, 15, 15, new GuiTextureGroup(GuiTextures.BUTTON, new TextTexture("ID")), + cd -> Minecraft.getInstance().keyboardHandler.setClipboard(recipe.id.toString()), + () -> CompassManager.INSTANCE.devMode, CompassManager.INSTANCE.devMode) + .setHoverTooltips("click to copy: " + recipe.id)); } private int getVoltageXOffset() { @@ -248,10 +264,11 @@ public static void setConsumedChance(Content content, List tooltips) var chance = content.chance; if (chance < 1) { tooltips.add(chance == 0 ? - Component.translatable("gtceu.gui.content.chance_0") : - FormattingUtil.formatPercentage2Places("gtceu.gui.content.chance_1", chance * 100)); + Component.translatable("gtceu.gui.content.chance_0") : + FormattingUtil.formatPercentage2Places("gtceu.gui.content.chance_1", chance * 100)); if (content.tierChanceBoost != 0) { - tooltips.add(FormattingUtil.formatPercentage2Places("gtceu.gui.content.tier_boost", content.tierChanceBoost * 100)); + tooltips.add(FormattingUtil.formatPercentage2Places("gtceu.gui.content.tier_boost", + content.tierChanceBoost * 100)); } } } @@ -268,7 +285,8 @@ private void setTierToMin() { setTier(getMinTier()); } - public void collectStorage(Table, Object> extraTable, Table, List> extraContents, GTRecipe recipe) { + public void collectStorage(Table, Object> extraTable, + Table, List> extraContents, GTRecipe recipe) { Map, List> inputCapabilities = new Object2ObjectLinkedOpenHashMap<>(); for (var entry : recipe.inputs.entrySet()) { RecipeCapability cap = entry.getKey(); @@ -308,7 +326,8 @@ public void collectStorage(Table, Object> extraTable, Ta outputCapabilities.put(cap, cap.createXEIContainerContents(contents, recipe, IO.OUT)); } for (var entry : outputCapabilities.entrySet()) { - while (entry.getValue().size() < recipe.recipeType.getMaxOutputs(entry.getKey())) entry.getValue().add(null); + while (entry.getValue().size() < recipe.recipeType.getMaxOutputs(entry.getKey())) + entry.getValue().add(null); var container = entry.getKey().createXEIContainer(entry.getValue()); if (container != null) { extraTable.put(IO.OUT, entry.getKey(), container); @@ -316,7 +335,8 @@ public void collectStorage(Table, Object> extraTable, Ta } } - public void addSlots(Table, List> contentTable, WidgetGroup group, GTRecipe recipe) { + public void addSlots(Table, List> contentTable, WidgetGroup group, + GTRecipe recipe) { for (var capabilityEntry : contentTable.rowMap().entrySet()) { IO io = capabilityEntry.getKey(); for (var contentsEntry : capabilityEntry.getValue().entrySet()) { @@ -324,14 +344,16 @@ public void addSlots(Table, List> contentTable, int nonTickCount = (io == IO.IN ? recipe.getInputContents(cap) : recipe.getOutputContents(cap)).size(); List contents = contentsEntry.getValue(); // bind fluid out overlay - WidgetUtils.widgetByIdForEach(group, "^%s_[0-9]+$".formatted(cap.slotName(io)), cap.getWidgetClass(), widget -> { - var index = WidgetUtils.widgetIdIndex(widget); - if (index >= 0 && index < contents.size()) { - var content = contents.get(index); - cap.applyWidgetInfo(widget, index, true, io, null, recipe.getType(), recipe, content, null); - widget.setOverlay(content.createOverlay(index >= nonTickCount)); - } - }); + WidgetUtils.widgetByIdForEach(group, "^%s_[0-9]+$".formatted(cap.slotName(io)), cap.getWidgetClass(), + widget -> { + var index = WidgetUtils.widgetIdIndex(widget); + if (index >= 0 && index < contents.size()) { + var content = contents.get(index); + cap.applyWidgetInfo(widget, index, true, io, null, recipe.getType(), recipe, content, + null); + widget.setOverlay(content.createOverlay(index >= nonTickCount)); + } + }); } } } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/gui/widget/AEConfigWidget.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/gui/widget/AEConfigWidget.java index 23b091b85f..f86a0d9086 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/gui/widget/AEConfigWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/gui/widget/AEConfigWidget.java @@ -1,16 +1,19 @@ package com.gregtechceu.gtceu.integration.ae2.gui.widget; -import appeng.api.stacks.GenericStack; import com.gregtechceu.gtceu.integration.ae2.util.AEConfigSlot; import com.gregtechceu.gtceu.integration.ae2.util.AmountSetSlot; import com.gregtechceu.gtceu.integration.ae2.util.IConfigurableSlot; + import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.utils.Position; import com.lowdragmc.lowdraglib.utils.Size; + +import net.minecraft.network.FriendlyByteBuf; + +import appeng.api.stacks.GenericStack; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; -import net.minecraft.network.FriendlyByteBuf; public abstract class AEConfigWidget extends WidgetGroup { @@ -66,7 +69,7 @@ public boolean mouseClicked(double mouseX, double mouseY, int button) { public void detectAndSendChanges() { super.detectAndSendChanges(); this.changeMap.clear(); - for (int index = 0; index < this.config.length; index ++) { + for (int index = 0; index < this.config.length; index++) { IConfigurableSlot newSlot = this.config[index]; IConfigurableSlot oldSlot = this.cached[index]; GenericStack nConfig = newSlot.getConfig(); @@ -108,7 +111,7 @@ public void readUpdateInfo(int id, FriendlyByteBuf buffer) { super.readUpdateInfo(id, buffer); if (id == UPDATE_ID) { int size = buffer.readVarInt(); - for (int i = 0; i < size; i ++) { + for (int i = 0; i < size; i++) { int index = buffer.readVarInt(); IConfigurableSlot slot = this.displayList[index]; if (buffer.readBoolean()) { @@ -142,5 +145,4 @@ protected final boolean areAEStackCountsEqual(GenericStack s1, GenericStack s2) } return false; } - -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/gui/widget/AEFluidConfigWidget.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/gui/widget/AEFluidConfigWidget.java index 8c253761e7..5ea59bb1be 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/gui/widget/AEFluidConfigWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/gui/widget/AEFluidConfigWidget.java @@ -20,11 +20,11 @@ void init() { int line; this.displayList = new IConfigurableSlot[this.config.length]; this.cached = new IConfigurableSlot[this.config.length]; - for (int index = 0; index < this.config.length; index ++) { + for (int index = 0; index < this.config.length; index++) { this.displayList[index] = new MEInputHatchPartMachine.ExportOnlyAEFluid(); this.cached[index] = new MEInputHatchPartMachine.ExportOnlyAEFluid(); line = index / 8; this.addWidget(new AEFluidConfigSlot((index - line * 8) * 18, line * (18 * 2 + 2), this, index)); } } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/gui/widget/AEFluidDisplayWidget.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/gui/widget/AEFluidDisplayWidget.java index 2d1c8ae88e..973bb2637f 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/gui/widget/AEFluidDisplayWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/gui/widget/AEFluidDisplayWidget.java @@ -1,9 +1,8 @@ package com.gregtechceu.gtceu.integration.ae2.gui.widget; -import appeng.api.stacks.AEFluidKey; -import appeng.api.stacks.GenericStack; import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.client.TooltipsHandler; + import com.lowdragmc.lowdraglib.Platform; import com.lowdragmc.lowdraglib.gui.util.DrawerHelper; import com.lowdragmc.lowdraglib.gui.widget.Widget; @@ -11,10 +10,14 @@ import com.lowdragmc.lowdraglib.side.fluid.FluidStack; import com.lowdragmc.lowdraglib.utils.Position; import com.lowdragmc.lowdraglib.utils.Size; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.world.item.TooltipFlag; + +import appeng.api.stacks.AEFluidKey; +import appeng.api.stacks.GenericStack; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; @@ -50,7 +53,8 @@ public void drawInBackground(@NotNull GuiGraphics graphics, int mouseX, int mous int stackX = position.x + 1; int stackY = position.y + 1; if (fluid != null) { - FluidStack fluidStack = fluid.what() instanceof AEFluidKey key ? FluidStack.create(key.getFluid(), fluid.amount(), key.getTag()) : FluidStack.empty(); + FluidStack fluidStack = fluid.what() instanceof AEFluidKey key ? + FluidStack.create(key.getFluid(), fluid.amount(), key.getTag()) : FluidStack.empty(); DrawerHelper.drawFluidForGui(graphics, fluidStack, fluid.amount(), stackX, stackY, 17, 17); String amountStr = String.format("x%,d", fluid.amount()); drawText(graphics, amountStr, stackX + 20, stackY + 5, 1, 0xFFFFFFFF); @@ -65,17 +69,18 @@ public void drawInForeground(@NotNull GuiGraphics graphics, int mouseX, int mous if (isMouseOverElement(mouseX, mouseY)) { GenericStack fluid = this.gridWidget.getAt(this.index); if (fluid != null) { - FluidStack fluidStack = fluid.what() instanceof AEFluidKey key ? FluidStack.create(key.getFluid(), fluid.amount(), key.getTag()) : FluidStack.empty(); + FluidStack fluidStack = fluid.what() instanceof AEFluidKey key ? + FluidStack.create(key.getFluid(), fluid.amount(), key.getTag()) : FluidStack.empty(); List tooltips = new ArrayList<>(); tooltips.add(fluidStack.getDisplayName()); tooltips.add(Component.literal(String.format("%,d ", fluid.amount())).append(FluidHelper.getUnit())); if (!Platform.isForge()) { - tooltips.add(Component.literal("§6mB:§r %d mB".formatted(fluidStack.getAmount() * 1000 / FluidHelper.getBucket()))); + tooltips.add(Component.literal( + "§6mB:§r %d mB".formatted(fluidStack.getAmount() * 1000 / FluidHelper.getBucket()))); } TooltipsHandler.appendFluidTooltips(fluidStack.getFluid(), tooltips, TooltipFlag.NORMAL); graphics.renderTooltip(Minecraft.getInstance().font, tooltips, Optional.empty(), mouseX, mouseY); } } } - -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/gui/widget/AEFluidGridWidget.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/gui/widget/AEFluidGridWidget.java index 1b0aec3d18..1f95157b4f 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/gui/widget/AEFluidGridWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/gui/widget/AEFluidGridWidget.java @@ -1,15 +1,17 @@ package com.gregtechceu.gtceu.integration.ae2.gui.widget; -import appeng.api.behaviors.GenericInternalInventory; -import appeng.api.config.Actionable; -import appeng.api.stacks.AEFluidKey; -import appeng.api.stacks.GenericStack; import com.gregtechceu.gtceu.integration.ae2.util.ExportOnlyAESlot; + import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.side.fluid.FluidStack; -import it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap; + import net.minecraft.network.FriendlyByteBuf; +import appeng.api.behaviors.GenericInternalInventory; +import appeng.api.config.Actionable; +import appeng.api.stacks.AEFluidKey; +import appeng.api.stacks.GenericStack; + /** * @Author GlodBlock * @Description Display fluid list @@ -84,7 +86,7 @@ protected void writeListChange() { @Override protected void readListChange(FriendlyByteBuf buffer) { int size = buffer.readVarInt(); - for (int i = 0; i < size ; i ++) { + for (int i = 0; i < size; i++) { FluidStack fluid = FluidStack.readFromBuf(buffer); long delta = buffer.readVarLong(); if (fluid != null) { diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/gui/widget/AEItemConfigWidget.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/gui/widget/AEItemConfigWidget.java index 3e5cc082f4..ff8d8af157 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/gui/widget/AEItemConfigWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/gui/widget/AEItemConfigWidget.java @@ -20,12 +20,11 @@ void init() { int line; this.displayList = new IConfigurableSlot[this.config.length]; this.cached = new IConfigurableSlot[this.config.length]; - for (int index = 0; index < this.config.length; index ++) { + for (int index = 0; index < this.config.length; index++) { this.displayList[index] = new MEInputBusPartMachine.ExportOnlyAEItem(); this.cached[index] = new MEInputBusPartMachine.ExportOnlyAEItem(); line = index / 8; this.addWidget(new AEItemConfigSlot((index - line * 8) * 18, line * (18 * 2 + 2), this, index)); } } - -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/gui/widget/AEItemDisplayWidget.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/gui/widget/AEItemDisplayWidget.java index 38e87e0db4..614bec7753 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/gui/widget/AEItemDisplayWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/gui/widget/AEItemDisplayWidget.java @@ -1,14 +1,17 @@ package com.gregtechceu.gtceu.integration.ae2.gui.widget; -import appeng.api.stacks.AEItemKey; -import appeng.api.stacks.GenericStack; import com.gregtechceu.gtceu.api.gui.GuiTextures; + import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.utils.Position; import com.lowdragmc.lowdraglib.utils.Size; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.world.item.ItemStack; + +import appeng.api.stacks.AEItemKey; +import appeng.api.stacks.GenericStack; import org.jetbrains.annotations.NotNull; import static com.gregtechceu.gtceu.integration.ae2.util.AEConfigSlot.drawSelectionOverlay; @@ -41,7 +44,8 @@ public void drawInBackground(@NotNull GuiGraphics graphics, int mouseX, int mous int stackX = position.x + 1; int stackY = position.y + 1; if (item != null) { - ItemStack realStack = item.what() instanceof AEItemKey key ? new ItemStack(key.getItem(), (int) item.amount()) : ItemStack.EMPTY; + ItemStack realStack = item.what() instanceof AEItemKey key ? + new ItemStack(key.getItem(), (int) item.amount()) : ItemStack.EMPTY; realStack.setCount(1); drawItemStack(graphics, realStack, stackX, stackY, -1, null); String amountStr = String.format("x%,d", item.amount()); @@ -57,9 +61,9 @@ public void drawInForeground(@NotNull GuiGraphics graphics, int mouseX, int mous if (isMouseOverElement(mouseX, mouseY)) { GenericStack item = this.gridWidget.getAt(this.index); if (item != null) { - graphics.renderTooltip(Minecraft.getInstance().font, GenericStack.wrapInItemStack(item), mouseX, mouseY); + graphics.renderTooltip(Minecraft.getInstance().font, GenericStack.wrapInItemStack(item), mouseX, + mouseY); } } } - -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/gui/widget/AEItemGridWidget.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/gui/widget/AEItemGridWidget.java index 435f8c000f..006b48f4f4 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/gui/widget/AEItemGridWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/gui/widget/AEItemGridWidget.java @@ -1,18 +1,16 @@ package com.gregtechceu.gtceu.integration.ae2.gui.widget; -import appeng.api.behaviors.GenericInternalInventory; -import appeng.api.config.Actionable; -import appeng.api.stacks.AEItemKey; -import appeng.api.stacks.GenericStack; -import appeng.helpers.externalstorage.GenericStackInv; import com.gregtechceu.gtceu.integration.ae2.util.ExportOnlyAESlot; + import com.lowdragmc.lowdraglib.gui.widget.Widget; -import it.unimi.dsi.fastutil.objects.Object2LongMap; -import it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap; + import net.minecraft.network.FriendlyByteBuf; import net.minecraft.world.item.ItemStack; -import java.io.IOException; +import appeng.api.behaviors.GenericInternalInventory; +import appeng.api.config.Actionable; +import appeng.api.stacks.AEItemKey; +import appeng.api.stacks.GenericStack; /** * @Author GlodBlock @@ -65,7 +63,7 @@ protected void writeListChange() { GenericStack cachedItem = this.cached.getStack(j); if (item.what().matches(cachedItem) && cachedItem.amount() != item.amount()) { this.changeMap.put(ExportOnlyAESlot.copy(item), item.amount() - cachedItem.amount()); - if(item.amount() - cachedItem.amount() <= 0) { + if (item.amount() - cachedItem.amount() <= 0) { this.cached.extract(j, item.what(), item.amount(), Actionable.MODULATE); } this.cached.insert(j, item.what(), item.amount() - cachedItem.amount(), Actionable.MODULATE); @@ -107,4 +105,3 @@ protected void readListChange(FriendlyByteBuf buffer) { } } } - diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/gui/widget/AEListGridWidget.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/gui/widget/AEListGridWidget.java index bbf60b9844..74f20f4730 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/gui/widget/AEListGridWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/gui/widget/AEListGridWidget.java @@ -1,16 +1,15 @@ package com.gregtechceu.gtceu.integration.ae2.gui.widget; +import com.lowdragmc.lowdraglib.gui.widget.DraggableScrollableWidgetGroup; +import com.lowdragmc.lowdraglib.gui.widget.Widget; + +import net.minecraft.network.FriendlyByteBuf; + import appeng.api.behaviors.GenericInternalInventory; -import appeng.api.config.Actionable; import appeng.api.stacks.GenericStack; import appeng.helpers.externalstorage.GenericStackInv; -import com.gregtechceu.gtceu.integration.ae2.util.ExportOnlyAESlot; -import com.lowdragmc.lowdraglib.gui.widget.DraggableScrollableWidgetGroup; -import com.lowdragmc.lowdraglib.gui.widget.Widget; import it.unimi.dsi.fastutil.objects.Object2LongMap; import it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap; -import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.world.item.ItemStack; /** * @Author GlodBlock @@ -112,4 +111,4 @@ public void readInitialData(FriendlyByteBuf buffer) { if (this.list == null) return; this.modifySlotRows(buffer.readVarInt()); } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEBusPartMachine.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEBusPartMachine.java index 652f0722e1..08f1b0c14c 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEBusPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEBusPartMachine.java @@ -1,39 +1,49 @@ package com.gregtechceu.gtceu.integration.ae2.machine; -import appeng.api.networking.*; -import appeng.api.networking.security.IActionSource; -import appeng.me.helpers.BlockEntityNodeListener; -import appeng.me.helpers.IGridConnectedBlockEntity; import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.capability.recipe.IO; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; import com.gregtechceu.gtceu.common.machine.multiblock.part.ItemBusPartMachine; import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.integration.ae2.util.SerializableManagedGridNode; + import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.annotation.ReadOnlyManaged; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import lombok.Getter; + import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; import net.minecraft.server.TickTask; import net.minecraft.server.level.ServerLevel; +import appeng.api.networking.*; +import appeng.api.networking.security.IActionSource; +import appeng.me.helpers.BlockEntityNodeListener; +import appeng.me.helpers.IGridConnectedBlockEntity; +import lombok.Getter; + import java.util.EnumSet; -public abstract class MEBusPartMachine extends ItemBusPartMachine implements IInWorldGridNodeHost, IGridConnectedBlockEntity { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(MEBusPartMachine.class, ItemBusPartMachine.MANAGED_FIELD_HOLDER); +public abstract class MEBusPartMachine extends ItemBusPartMachine + implements IInWorldGridNodeHost, IGridConnectedBlockEntity { + + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(MEBusPartMachine.class, + ItemBusPartMachine.MANAGED_FIELD_HOLDER); public final static int ME_UPDATE_INTERVAL = ConfigHolder.INSTANCE.compat.ae2.updateIntervals; @Getter - @Persisted @ReadOnlyManaged(onDirtyMethod = "onGridNodeDirty", serializeMethod = "serializeGridNode", deserializeMethod = "deserializeGridNode") + @Persisted + @ReadOnlyManaged(onDirtyMethod = "onGridNodeDirty", + serializeMethod = "serializeGridNode", + deserializeMethod = "deserializeGridNode") private final SerializableManagedGridNode mainNode = (SerializableManagedGridNode) createMainNode() .setFlags(GridFlags.REQUIRE_CHANNEL) .setVisualRepresentation(getDefinition().getItem()) .setIdlePowerUsage(ConfigHolder.INSTANCE.compat.ae2.meHatchEnergyUsage) .setInWorldNode(true) - .setExposedOnSides(this.hasFrontFacing() ? EnumSet.of(this.getFrontFacing()) : EnumSet.allOf(Direction.class)) + .setExposedOnSides( + this.hasFrontFacing() ? EnumSet.of(this.getFrontFacing()) : EnumSet.allOf(Direction.class)) .setTagName("proxy"); protected final IActionSource actionSource = IActionSource.ofMachine(mainNode::getNode); @DescSynced @@ -52,13 +62,15 @@ protected boolean shouldSyncME() { public void setFrontFacing(Direction facing) { super.setFrontFacing(facing); if (isFacingValid(facing)) { - this.mainNode.setExposedOnSides(this.hasFrontFacing() ? EnumSet.of(facing) : EnumSet.allOf(Direction.class)); + this.mainNode + .setExposedOnSides(this.hasFrontFacing() ? EnumSet.of(facing) : EnumSet.allOf(Direction.class)); } } protected void updateInventorySubscription() { - if (isWorkingEnabled() && ((io == IO.OUT && !getInventory().isEmpty()) || io == IO.IN) && this.getLevel() != null - && GridHelper.getNodeHost(getLevel(), getPos().relative(getFrontFacing())) != null) { + if (isWorkingEnabled() && ((io == IO.OUT && !getInventory().isEmpty()) || io == IO.IN) && + this.getLevel() != null && + GridHelper.getNodeHost(getLevel(), getPos().relative(getFrontFacing())) != null) { autoIOSubs = subscribeServerTick(autoIOSubs, this::autoIO); } else if (autoIOSubs != null) { autoIOSubs.unsubscribe(); @@ -68,6 +80,7 @@ protected void updateInventorySubscription() { /** * Update me network connection status. + * * @return the updated status. */ public boolean updateMEStatus() { diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEHatchPartMachine.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEHatchPartMachine.java index b55ba0a848..8513ed302d 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEHatchPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEHatchPartMachine.java @@ -1,42 +1,51 @@ package com.gregtechceu.gtceu.integration.ae2.machine; -import appeng.api.networking.*; -import appeng.api.networking.security.IActionSource; -import appeng.me.helpers.BlockEntityNodeListener; -import appeng.me.helpers.IGridConnectedBlockEntity; import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.capability.recipe.IO; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; import com.gregtechceu.gtceu.common.machine.multiblock.part.FluidHatchPartMachine; import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.integration.ae2.util.SerializableManagedGridNode; + import com.lowdragmc.lowdraglib.syncdata.annotation.DescSynced; import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.annotation.ReadOnlyManaged; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import lombok.Getter; + import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; import net.minecraft.server.TickTask; import net.minecraft.server.level.ServerLevel; +import appeng.api.networking.*; +import appeng.api.networking.security.IActionSource; +import appeng.me.helpers.BlockEntityNodeListener; +import appeng.me.helpers.IGridConnectedBlockEntity; +import lombok.Getter; + import java.util.EnumSet; import static com.gregtechceu.gtceu.integration.ae2.machine.MEBusPartMachine.ME_UPDATE_INTERVAL; -public abstract class MEHatchPartMachine extends FluidHatchPartMachine implements IInWorldGridNodeHost, IGridConnectedBlockEntity { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(MEHatchPartMachine.class, FluidHatchPartMachine.MANAGED_FIELD_HOLDER); - protected final static int CONFIG_SIZE = 16; +public abstract class MEHatchPartMachine extends FluidHatchPartMachine + implements IInWorldGridNodeHost, IGridConnectedBlockEntity { + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(MEHatchPartMachine.class, + FluidHatchPartMachine.MANAGED_FIELD_HOLDER); + protected final static int CONFIG_SIZE = 16; @Getter - @Persisted @ReadOnlyManaged(onDirtyMethod = "onGridNodeDirty", serializeMethod = "serializeGridNode", deserializeMethod = "deserializeGridNode") + @Persisted + @ReadOnlyManaged(onDirtyMethod = "onGridNodeDirty", + serializeMethod = "serializeGridNode", + deserializeMethod = "deserializeGridNode") private final SerializableManagedGridNode mainNode = (SerializableManagedGridNode) createMainNode() .setFlags(GridFlags.REQUIRE_CHANNEL) .setVisualRepresentation(getDefinition().getItem()) .setIdlePowerUsage(ConfigHolder.INSTANCE.compat.ae2.meHatchEnergyUsage) .setInWorldNode(true) - .setExposedOnSides(this.hasFrontFacing() ? EnumSet.of(this.getFrontFacing()) : EnumSet.allOf(Direction.class)) + .setExposedOnSides( + this.hasFrontFacing() ? EnumSet.of(this.getFrontFacing()) : EnumSet.allOf(Direction.class)) .setTagName("proxy"); protected final IActionSource actionSource = IActionSource.ofMachine(mainNode::getNode); @DescSynced @@ -55,12 +64,14 @@ protected boolean shouldSyncME() { public void setFrontFacing(Direction facing) { super.setFrontFacing(facing); if (isFacingValid(facing)) { - this.mainNode.setExposedOnSides(this.hasFrontFacing() ? EnumSet.of(facing) : EnumSet.allOf(Direction.class)); + this.mainNode + .setExposedOnSides(this.hasFrontFacing() ? EnumSet.of(facing) : EnumSet.allOf(Direction.class)); } } /** * Update me network connection status. + * * @return the updated status. */ public boolean updateMEStatus() { @@ -80,8 +91,8 @@ protected IManagedGridNode createMainNode() { } protected void updateTankSubscription() { - if (isWorkingEnabled() && ((io == IO.OUT && !tank.isEmpty()) || io == IO.IN) && getLevel() != null - && GridHelper.getNodeHost(getLevel(), getPos().relative(getFrontFacing())) != null) { + if (isWorkingEnabled() && ((io == IO.OUT && !tank.isEmpty()) || io == IO.IN) && getLevel() != null && + GridHelper.getNodeHost(getLevel(), getPos().relative(getFrontFacing())) != null) { autoIOSubs = subscribeServerTick(autoIOSubs, this::autoIO); } else if (autoIOSubs != null) { autoIOSubs.unsubscribe(); diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEInputBusPartMachine.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEInputBusPartMachine.java index 2649183298..824b4e4852 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEInputBusPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEInputBusPartMachine.java @@ -1,22 +1,13 @@ package com.gregtechceu.gtceu.integration.ae2.machine; -import appeng.api.config.Actionable; -import appeng.api.networking.IGrid; -import appeng.api.networking.IInWorldGridNodeHost; -import appeng.api.stacks.AEItemKey; -import appeng.api.stacks.GenericStack; -import appeng.api.storage.MEStorage; -import appeng.me.helpers.IGridConnectedBlockEntity; import com.gregtechceu.gtceu.api.capability.recipe.IO; -import com.gregtechceu.gtceu.api.gui.GuiTextures; -import com.gregtechceu.gtceu.api.gui.UITemplate; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; import com.gregtechceu.gtceu.api.machine.MetaMachine; import com.gregtechceu.gtceu.api.machine.trait.NotifiableItemStackHandler; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.integration.ae2.gui.widget.AEItemConfigWidget; import com.gregtechceu.gtceu.integration.ae2.util.ExportOnlyAESlot; -import com.lowdragmc.lowdraglib.gui.modular.ModularUI; + import com.lowdragmc.lowdraglib.gui.widget.LabelWidget; import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; @@ -25,20 +16,29 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; import com.lowdragmc.lowdraglib.utils.Position; -import com.mojang.datafixers.util.Pair; + import net.minecraft.core.NonNullList; -import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.Ingredient; + +import appeng.api.config.Actionable; +import appeng.api.networking.IGrid; +import appeng.api.networking.IInWorldGridNodeHost; +import appeng.api.stacks.AEItemKey; +import appeng.api.stacks.GenericStack; +import appeng.api.storage.MEStorage; +import appeng.me.helpers.IGridConnectedBlockEntity; +import com.mojang.datafixers.util.Pair; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.jetbrains.annotations.NotNull; import java.util.Arrays; import java.util.List; public class MEInputBusPartMachine extends MEBusPartMachine implements IInWorldGridNodeHost, IGridConnectedBlockEntity { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(MEInputBusPartMachine.class, MEBusPartMachine.MANAGED_FIELD_HOLDER); + + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(MEInputBusPartMachine.class, + MEBusPartMachine.MANAGED_FIELD_HOLDER); private final static int CONFIG_SIZE = 16; private ExportOnlyAEItemList aeItemHandler; @@ -59,7 +59,7 @@ public void autoIO() { if (getLevel().isClientSide) return; if (!this.isWorkingEnabled()) return; if (!this.shouldSyncME()) return; - + if (this.updateMEStatus()) { MEStorage aeNetwork = this.getMainNode().getGrid().getStorageService().getInventory(); for (ExportOnlyAEItem aeSlot : this.aeItemHandler.inventory) { @@ -67,7 +67,8 @@ public void autoIO() { GenericStack exceedItem = aeSlot.exceedStack(); if (exceedItem != null) { long total = exceedItem.amount(); - long inserted = aeNetwork.insert(exceedItem.what(), exceedItem.amount(), Actionable.MODULATE, this.actionSource); + long inserted = aeNetwork.insert(exceedItem.what(), exceedItem.amount(), Actionable.MODULATE, + this.actionSource); if (inserted > 0) { aeSlot.extractItem(0, (int) inserted, false); continue; @@ -78,7 +79,8 @@ public void autoIO() { // Fill it GenericStack reqItem = aeSlot.requestStack(); if (reqItem != null) { - long extracted = aeNetwork.extract(reqItem.what(), reqItem.amount(), Actionable.MODULATE, this.actionSource); + long extracted = aeNetwork.extract(reqItem.what(), reqItem.amount(), Actionable.MODULATE, + this.actionSource); if (extracted != 0) { aeSlot.addStack(new GenericStack(reqItem.what(), extracted)); } @@ -108,7 +110,9 @@ public ManagedFieldHolder getFieldHolder() { } private static class ExportOnlyAEItemList extends NotifiableItemStackHandler { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(ExportOnlyAEItemList.class, NotifiableItemStackHandler.MANAGED_FIELD_HOLDER); + + public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(ExportOnlyAEItemList.class, + NotifiableItemStackHandler.MANAGED_FIELD_HOLDER); @Persisted ExportOnlyAEItem[] inventory; @@ -116,7 +120,7 @@ private static class ExportOnlyAEItemList extends NotifiableItemStackHandler { public ExportOnlyAEItemList(MetaMachine holder, int slots) { super(holder, slots, IO.IN); this.inventory = new ExportOnlyAEItem[CONFIG_SIZE]; - for (int i = 0; i < CONFIG_SIZE; i ++) { + for (int i = 0; i < CONFIG_SIZE; i++) { this.inventory[i] = new ExportOnlyAEItem(null, null); } for (ExportOnlyAEItem slot : this.inventory) { @@ -131,18 +135,22 @@ public void onContentsChanged() { } @Override - public List handleRecipeInner(IO io, GTRecipe recipe, List left, @Nullable String slotName, boolean simulate) { - return handleIngredient(io, recipe, left, simulate, this.handlerIO, new ItemStackTransfer(NonNullList.of(ItemStack.EMPTY, Arrays.stream(inventory).map(item -> item.getStackInSlot(0)).toArray(ItemStack[]::new))) { - @NotNull - @Override - public ItemStack extractItem(int slot, int amount, boolean simulate, boolean notifyChanges) { - ItemStack extracted = super.extractItem(slot, amount, simulate, notifyChanges); - if (!extracted.isEmpty()) { - inventory[slot].extractItem(0, amount, simulate, notifyChanges); - } - return extracted; - } - }); + public List handleRecipeInner(IO io, GTRecipe recipe, List left, + @Nullable String slotName, boolean simulate) { + return handleIngredient(io, recipe, left, simulate, this.handlerIO, + new ItemStackTransfer(NonNullList.of(ItemStack.EMPTY, + Arrays.stream(inventory).map(item -> item.getStackInSlot(0)).toArray(ItemStack[]::new))) { + + @NotNull + @Override + public ItemStack extractItem(int slot, int amount, boolean simulate, boolean notifyChanges) { + ItemStack extracted = super.extractItem(slot, amount, simulate, notifyChanges); + if (!extracted.isEmpty()) { + inventory[slot].extractItem(0, amount, simulate, notifyChanges); + } + return extracted; + } + }); } @Override @@ -189,7 +197,6 @@ public ManagedFieldHolder getFieldHolder() { return MANAGED_FIELD_HOLDER; } - @NotNull @Override public Object createSnapshot() { @@ -220,8 +227,7 @@ public ExportOnlyAEItem() { public ExportOnlyAEItem copy() { return new ExportOnlyAEItem( this.config == null ? null : copy(this.config), - this.stock == null ? null : copy(this.stock) - ); + this.stock == null ? null : copy(this.stock)); } @Override @@ -244,7 +250,8 @@ public int getSlots() { @Override public ItemStack getStackInSlot(int slot) { if (slot == 0 && this.stock != null) { - return this.stock.what() instanceof AEItemKey itemKey ? itemKey.toStack((int) this.stock.amount()) : ItemStack.EMPTY; + return this.stock.what() instanceof AEItemKey itemKey ? itemKey.toStack((int) this.stock.amount()) : + ItemStack.EMPTY; } return ItemStack.EMPTY; } @@ -254,7 +261,8 @@ public ItemStack getStackInSlot(int slot) { public ItemStack extractItem(int slot, int amount, boolean simulate, boolean notifyChanges) { if (slot == 0 && this.stock != null) { int extracted = (int) Math.min(this.stock.amount(), amount); - ItemStack result = this.stock.what() instanceof AEItemKey itemKey ? itemKey.toStack((int) this.stock.amount()) : ItemStack.EMPTY.copy(); + ItemStack result = this.stock.what() instanceof AEItemKey itemKey ? + itemKey.toStack((int) this.stock.amount()) : ItemStack.EMPTY.copy(); result.setCount(extracted); if (!simulate) { this.stock = ExportOnlyAESlot.copy(this.stock, this.stock.amount() - extracted); @@ -298,7 +306,7 @@ public Object createSnapshot() { @Override public void restoreFromSnapshot(Object snapshot) { - if (snapshot instanceof Pair pair) { + if (snapshot instanceof Pair pair) { this.config = (GenericStack) pair.getFirst(); this.stock = (GenericStack) pair.getSecond(); } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEInputHatchPartMachine.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEInputHatchPartMachine.java index 6b13065576..454198dd6d 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEInputHatchPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEInputHatchPartMachine.java @@ -1,11 +1,5 @@ package com.gregtechceu.gtceu.integration.ae2.machine; -import appeng.api.config.Actionable; -import appeng.api.networking.IInWorldGridNodeHost; -import appeng.api.stacks.AEFluidKey; -import appeng.api.stacks.GenericStack; -import appeng.api.storage.MEStorage; -import appeng.me.helpers.IGridConnectedBlockEntity; import com.gregtechceu.gtceu.api.capability.recipe.IO; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; import com.gregtechceu.gtceu.api.machine.MetaMachine; @@ -14,6 +8,7 @@ import com.gregtechceu.gtceu.api.recipe.ingredient.FluidIngredient; import com.gregtechceu.gtceu.integration.ae2.gui.widget.AEFluidConfigWidget; import com.gregtechceu.gtceu.integration.ae2.util.ExportOnlyAESlot; + import com.lowdragmc.lowdraglib.gui.widget.LabelWidget; import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; @@ -24,6 +19,13 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; import com.lowdragmc.lowdraglib.utils.Position; + +import appeng.api.config.Actionable; +import appeng.api.networking.IInWorldGridNodeHost; +import appeng.api.stacks.AEFluidKey; +import appeng.api.stacks.GenericStack; +import appeng.api.storage.MEStorage; +import appeng.me.helpers.IGridConnectedBlockEntity; import com.mojang.datafixers.util.Pair; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -32,8 +34,11 @@ import java.util.List; import java.util.function.Predicate; -public class MEInputHatchPartMachine extends MEHatchPartMachine implements IInWorldGridNodeHost, IGridConnectedBlockEntity { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(MEInputHatchPartMachine.class, MEHatchPartMachine.MANAGED_FIELD_HOLDER); +public class MEInputHatchPartMachine extends MEHatchPartMachine + implements IInWorldGridNodeHost, IGridConnectedBlockEntity { + + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( + MEInputHatchPartMachine.class, MEHatchPartMachine.MANAGED_FIELD_HOLDER); @Persisted private ExportOnlyAEFluidList aeFluidTanks; @@ -83,7 +88,8 @@ protected void autoIO() { GenericStack exceedFluid = aeTank.exceedStack(); if (exceedFluid != null) { long total = exceedFluid.amount(); - long inserted = aeNetwork.insert(exceedFluid.what(), exceedFluid.amount(), Actionable.MODULATE, this.actionSource); + long inserted = aeNetwork.insert(exceedFluid.what(), exceedFluid.amount(), Actionable.MODULATE, + this.actionSource); if (inserted > 0) { aeTank.drain(inserted, false); continue; @@ -94,7 +100,8 @@ protected void autoIO() { // Fill it GenericStack reqFluid = aeTank.requestStack(); if (reqFluid != null) { - long extracted = aeNetwork.extract(reqFluid.what(), reqFluid.amount(), Actionable.MODULATE, this.actionSource); + long extracted = aeNetwork.extract(reqFluid.what(), reqFluid.amount(), Actionable.MODULATE, + this.actionSource); if (extracted > 0) { aeTank.addStack(new GenericStack(reqFluid.what(), extracted)); } @@ -110,17 +117,18 @@ public ManagedFieldHolder getFieldHolder() { } public static class ExportOnlyAEFluidList extends NotifiableFluidTank { - public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(ExportOnlyAEFluidList.class, NotifiableFluidTank.MANAGED_FIELD_HOLDER); + + public static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( + ExportOnlyAEFluidList.class, NotifiableFluidTank.MANAGED_FIELD_HOLDER); @Persisted private final ExportOnlyAEFluid[] tanks; private FluidStorage[] fluidStorages; - public ExportOnlyAEFluidList(MetaMachine machine, int slots, long capacity, IO io) { super(machine, slots, capacity, io); this.tanks = new ExportOnlyAEFluid[slots]; - for (int i = 0; i < slots; i ++) { + for (int i = 0; i < slots; i++) { this.tanks[i] = new ExportOnlyAEFluid(null, null); this.tanks[i].setOnContentsChanged(this::onContentsChanged); } @@ -129,8 +137,9 @@ public ExportOnlyAEFluidList(MetaMachine machine, int slots, long capacity, IO i @Override public FluidStorage[] getStorages() { - if(this.fluidStorages == null) { - this.fluidStorages = Arrays.stream(this.tanks).map(tank -> new WrappingFluidStorage(tank.getCapacity(), tank)).toArray(FluidStorage[]::new); + if (this.fluidStorages == null) { + this.fluidStorages = Arrays.stream(this.tanks) + .map(tank -> new WrappingFluidStorage(tank.getCapacity(), tank)).toArray(FluidStorage[]::new); return this.fluidStorages; } else { return this.fluidStorages; @@ -143,7 +152,8 @@ public long fill(int tank, FluidStack resource, boolean simulate, boolean notify } @Override - public List handleRecipeInner(IO io, GTRecipe recipe, List left, @Nullable String slotName, boolean simulate) { + public List handleRecipeInner(IO io, GTRecipe recipe, List left, + @Nullable String slotName, boolean simulate) { return handleIngredient(io, recipe, left, simulate, this.handlerIO, getStorages()); } @@ -193,6 +203,7 @@ public ManagedFieldHolder getFieldHolder() { } private static class WrappingFluidStorage extends FluidStorage { + private final ExportOnlyAEFluid fluid; public WrappingFluidStorage(long capacity, ExportOnlyAEFluid fluid) { @@ -255,15 +266,14 @@ public void addStack(GenericStack stack) { @NotNull public FluidStack getFluid() { if (this.stock != null && this.stock.what() instanceof AEFluidKey fluidKey) { - return FluidStack.create(fluidKey.getFluid(), this.stock == null ? 0 : this.stock.amount(), fluidKey.getTag()); + return FluidStack.create(fluidKey.getFluid(), this.stock == null ? 0 : this.stock.amount(), + fluidKey.getTag()); } return FluidStack.empty(); } @Override - public void setFluid(FluidStack fluid) { - - } + public void setFluid(FluidStack fluid) {} @Override public long getFluidAmount() { @@ -342,7 +352,7 @@ public Object createSnapshot() { @Override public void restoreFromSnapshot(Object snapshot) { - if (snapshot instanceof Pair pair) { + if (snapshot instanceof Pair pair) { this.config = (GenericStack) pair.getFirst(); this.stock = (GenericStack) pair.getSecond(); } @@ -359,8 +369,7 @@ public void onContentsChanged() { public ExportOnlyAEFluid copy() { return new ExportOnlyAEFluid( this.config == null ? null : ExportOnlyAESlot.copy(this.config), - this.stock == null ? null : ExportOnlyAESlot.copy(this.stock) - ); + this.stock == null ? null : ExportOnlyAESlot.copy(this.stock)); } } } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEOutputBusPartMachine.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEOutputBusPartMachine.java index 5b14d4a15c..7cd5c0279c 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEOutputBusPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEOutputBusPartMachine.java @@ -1,21 +1,13 @@ package com.gregtechceu.gtceu.integration.ae2.machine; -import appeng.api.config.Actionable; -import appeng.api.networking.GridHelper; -import appeng.api.networking.security.IActionSource; -import appeng.api.stacks.GenericStack; -import appeng.api.storage.MEStorage; -import appeng.helpers.externalstorage.GenericStackInv; import com.gregtechceu.gtceu.api.capability.recipe.IO; -import com.gregtechceu.gtceu.api.gui.GuiTextures; -import com.gregtechceu.gtceu.api.gui.UITemplate; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; import com.gregtechceu.gtceu.api.machine.MetaMachine; import com.gregtechceu.gtceu.api.machine.trait.NotifiableItemStackHandler; import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.integration.ae2.gui.widget.AEItemGridWidget; import com.gregtechceu.gtceu.integration.ae2.util.SerializableGenericStackInv; -import com.lowdragmc.lowdraglib.gui.modular.ModularUI; + import com.lowdragmc.lowdraglib.gui.widget.LabelWidget; import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; @@ -24,13 +16,19 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; import com.lowdragmc.lowdraglib.utils.Position; -import net.minecraft.world.entity.player.Player; + import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.Ingredient; + +import appeng.api.config.Actionable; +import appeng.api.networking.GridHelper; +import appeng.api.networking.security.IActionSource; +import appeng.api.stacks.GenericStack; +import appeng.api.storage.MEStorage; +import appeng.helpers.externalstorage.GenericStackInv; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.jetbrains.annotations.NotNull; import java.util.List; /** @@ -39,7 +37,9 @@ * @Date 2023/4/19-20:37 */ public class MEOutputBusPartMachine extends MEBusPartMachine { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(MEOutputBusPartMachine.class, MEBusPartMachine.MANAGED_FIELD_HOLDER); + + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( + MEOutputBusPartMachine.class, MEBusPartMachine.MANAGED_FIELD_HOLDER); @Persisted private SerializableGenericStackInv internalBuffer; @@ -66,7 +66,8 @@ public void autoIO() { for (int slot = 0; slot < this.internalBuffer.size(); ++slot) { GenericStack item = this.internalBuffer.getStack(slot); if (item == null) continue; - long inserted = aeNetwork.insert(item.what(), item.amount(), Actionable.MODULATE, this.actionSource); + long inserted = aeNetwork.insert(item.what(), item.amount(), Actionable.MODULATE, + this.actionSource); if (inserted > 0) { item = new GenericStack(item.what(), (item.amount() - inserted)); } @@ -104,8 +105,8 @@ public Widget createUIWidget() { } protected void updateInventorySubscription() { - if (isWorkingEnabled() && !internalBuffer.isEmpty() && getLevel() != null - && GridHelper.getNodeHost(getLevel(), getPos().relative(getFrontFacing())) != null) { + if (isWorkingEnabled() && !internalBuffer.isEmpty() && getLevel() != null && + GridHelper.getNodeHost(getLevel(), getPos().relative(getFrontFacing())) != null) { autoIOSubs = subscribeServerTick(autoIOSubs, this::autoIO); } else if (autoIOSubs != null) { autoIOSubs.unsubscribe(); @@ -119,7 +120,9 @@ public ManagedFieldHolder getFieldHolder() { } private static class InaccessibleInfiniteSlot extends NotifiableItemStackHandler implements IItemTransfer { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(InaccessibleInfiniteSlot.class); + + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( + InaccessibleInfiniteSlot.class); private final GenericStackInv internalBuffer; @@ -136,11 +139,14 @@ public void setStackInSlot(int slot, @NotNull ItemStack stack) { } @Override - public List handleRecipeInner(IO io, GTRecipe recipe, List left, @Nullable String slotName, boolean simulate) { + public List handleRecipeInner(IO io, GTRecipe recipe, List left, + @Nullable String slotName, boolean simulate) { return handleIngredient(io, recipe, left, simulate, this.handlerIO, new ItemStackTransfer(16) { + @NotNull @Override - public ItemStack insertItem(int slot, @NotNull ItemStack stack, boolean simulate, boolean notifyChanges) { + public ItemStack insertItem(int slot, @NotNull ItemStack stack, boolean simulate, + boolean notifyChanges) { return InaccessibleInfiniteSlot.this.insertItem(slot, stack, simulate, notifyChanges); } }); @@ -154,7 +160,8 @@ public ItemStack insertItem(int slot, @NotNull ItemStack stack, boolean simulate } if (!simulate) { GenericStack stack1 = GenericStack.fromItemStack(stack); - this.internalBuffer.insert(stack1.what(), stack1.amount(), Actionable.MODULATE, this.machine instanceof MEBusPartMachine host ? host.actionSource : IActionSource.empty()); + this.internalBuffer.insert(stack1.what(), stack1.amount(), Actionable.MODULATE, + this.machine instanceof MEBusPartMachine host ? host.actionSource : IActionSource.empty()); this.machine.onChanged(); } return ItemStack.EMPTY; @@ -215,5 +222,4 @@ public ManagedFieldHolder getFieldHolder() { return MANAGED_FIELD_HOLDER; } } - } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEOutputHatchPartMachine.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEOutputHatchPartMachine.java index 0429e2fd65..eab73a2365 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEOutputHatchPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEOutputHatchPartMachine.java @@ -1,13 +1,5 @@ package com.gregtechceu.gtceu.integration.ae2.machine; -import appeng.api.config.Actionable; -import appeng.api.networking.GridHelper; -import appeng.api.networking.IInWorldGridNodeHost; -import appeng.api.networking.security.IActionSource; -import appeng.api.stacks.GenericStack; -import appeng.api.storage.MEStorage; -import appeng.helpers.externalstorage.GenericStackInv; -import appeng.me.helpers.IGridConnectedBlockEntity; import com.gregtechceu.gtceu.api.capability.recipe.IO; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; import com.gregtechceu.gtceu.api.machine.MetaMachine; @@ -16,6 +8,7 @@ import com.gregtechceu.gtceu.api.recipe.ingredient.FluidIngredient; import com.gregtechceu.gtceu.integration.ae2.gui.widget.AEFluidGridWidget; import com.gregtechceu.gtceu.integration.ae2.util.SerializableGenericStackInv; + import com.lowdragmc.lowdraglib.gui.widget.LabelWidget; import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; @@ -25,15 +18,28 @@ import com.lowdragmc.lowdraglib.syncdata.annotation.Persisted; import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; import com.lowdragmc.lowdraglib.utils.Position; + import net.minecraft.world.item.ItemStack; + +import appeng.api.config.Actionable; +import appeng.api.networking.GridHelper; +import appeng.api.networking.IInWorldGridNodeHost; +import appeng.api.networking.security.IActionSource; +import appeng.api.stacks.GenericStack; +import appeng.api.storage.MEStorage; +import appeng.helpers.externalstorage.GenericStackInv; +import appeng.me.helpers.IGridConnectedBlockEntity; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.List; import java.util.stream.Stream; -public class MEOutputHatchPartMachine extends MEHatchPartMachine implements IInWorldGridNodeHost, IGridConnectedBlockEntity { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(MEOutputHatchPartMachine.class, MEHatchPartMachine.MANAGED_FIELD_HOLDER); +public class MEOutputHatchPartMachine extends MEHatchPartMachine + implements IInWorldGridNodeHost, IGridConnectedBlockEntity { + + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( + MEOutputHatchPartMachine.class, MEHatchPartMachine.MANAGED_FIELD_HOLDER); @Persisted private SerializableGenericStackInv internalBuffer; @@ -76,7 +82,8 @@ protected void autoIO() { for (int slot = 0; slot < this.internalBuffer.size(); ++slot) { GenericStack item = this.internalBuffer.getStack(slot); if (item == null) continue; - long inserted = aeNetwork.insert(item.what(), item.amount(), Actionable.MODULATE, this.actionSource); + long inserted = aeNetwork.insert(item.what(), item.amount(), Actionable.MODULATE, + this.actionSource); if (inserted > 0) { item = new GenericStack(item.what(), (item.amount() - inserted)); } @@ -89,8 +96,8 @@ protected void autoIO() { @Override protected void updateTankSubscription() { - if (isWorkingEnabled() && !internalBuffer.isEmpty() && this.getLevel() != null - && GridHelper.getNodeHost(getLevel(), getPos().relative(getFrontFacing())) != null) { + if (isWorkingEnabled() && !internalBuffer.isEmpty() && this.getLevel() != null && + GridHelper.getNodeHost(getLevel(), getPos().relative(getFrontFacing())) != null) { autoIOSubs = subscribeServerTick(autoIOSubs, this::autoIO); } else if (autoIOSubs != null) { autoIOSubs.unsubscribe(); @@ -104,7 +111,9 @@ public ManagedFieldHolder getFieldHolder() { } private static class InaccessibleInfiniteSlot extends NotifiableFluidTank implements IItemTransfer { - protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(InaccessibleInfiniteSlot.class, NotifiableFluidTank.MANAGED_FIELD_HOLDER); + + protected static final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder( + InaccessibleInfiniteSlot.class, NotifiableFluidTank.MANAGED_FIELD_HOLDER); private final GenericStackInv internalBuffer; @@ -121,13 +130,16 @@ public void setStackInSlot(int slot, @NotNull ItemStack stack) { } @Override - public List handleRecipeInner(IO io, GTRecipe recipe, List left, @Nullable String slotName, boolean simulate) { - return handleIngredient(io, recipe, left, simulate, this.handlerIO, Stream.generate(() -> new FluidStorage(0) { - @Override - public long fill(FluidStack resource, boolean simulate, boolean notifyChanges) { - return InaccessibleInfiniteSlot.this.fill(resource, simulate, notifyChanges); - } - }).limit(this.internalBuffer.size()).toArray(FluidStorage[]::new)); + public List handleRecipeInner(IO io, GTRecipe recipe, List left, + @Nullable String slotName, boolean simulate) { + return handleIngredient(io, recipe, left, simulate, this.handlerIO, + Stream.generate(() -> new FluidStorage(0) { + + @Override + public long fill(FluidStack resource, boolean simulate, boolean notifyChanges) { + return InaccessibleInfiniteSlot.this.fill(resource, simulate, notifyChanges); + } + }).limit(this.internalBuffer.size()).toArray(FluidStorage[]::new)); } @NotNull @@ -138,7 +150,8 @@ public ItemStack insertItem(int slot, @NotNull ItemStack stack, boolean simulate } if (!simulate) { GenericStack stack1 = GenericStack.fromItemStack(stack); - this.internalBuffer.insert(stack1.what(), stack1.amount(), Actionable.MODULATE, this.machine instanceof MEBusPartMachine host ? host.actionSource : IActionSource.empty()); + this.internalBuffer.insert(stack1.what(), stack1.amount(), Actionable.MODULATE, + this.machine instanceof MEBusPartMachine host ? host.actionSource : IActionSource.empty()); this.machine.onChanged(); } return ItemStack.EMPTY; diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/trait/GridNodeHostTrait.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/trait/GridNodeHostTrait.java index 1a781b772c..3888cc2cbd 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/trait/GridNodeHostTrait.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/trait/GridNodeHostTrait.java @@ -1,18 +1,21 @@ package com.gregtechceu.gtceu.integration.ae2.machine.trait; +import com.gregtechceu.gtceu.api.machine.MetaMachine; +import com.gregtechceu.gtceu.api.machine.trait.MachineTrait; + +import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; + +import net.minecraft.core.Direction; + import appeng.api.networking.GridHelper; import appeng.api.networking.IInWorldGridNodeHost; import appeng.api.networking.IManagedGridNode; import appeng.api.util.AECableType; import appeng.me.helpers.BlockEntityNodeListener; import appeng.me.helpers.IGridConnectedBlockEntity; -import com.gregtechceu.gtceu.api.machine.MetaMachine; -import com.gregtechceu.gtceu.api.machine.trait.MachineTrait; -import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; -import net.minecraft.core.Direction; -import net.minecraft.world.item.ItemStack; public class GridNodeHostTrait extends MachineTrait implements IInWorldGridNodeHost, IGridConnectedBlockEntity { + protected final ManagedFieldHolder MANAGED_FIELD_HOLDER = new ManagedFieldHolder(GridNodeHostTrait.class); private final IManagedGridNode proxy; diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/util/AEConfigSlot.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/util/AEConfigSlot.java index 2936a9f479..f1c037ed76 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/util/AEConfigSlot.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/util/AEConfigSlot.java @@ -1,18 +1,20 @@ package com.gregtechceu.gtceu.integration.ae2.util; import com.gregtechceu.gtceu.integration.ae2.gui.widget.AEConfigWidget; -import com.gregtechceu.gtceu.integration.ae2.util.IConfigurableSlot; + import com.lowdragmc.lowdraglib.gui.ingredient.IGhostIngredientTarget; import com.lowdragmc.lowdraglib.gui.ingredient.Target; import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.utils.Position; import com.lowdragmc.lowdraglib.utils.Size; -import com.mojang.blaze3d.systems.RenderSystem; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; + +import com.mojang.blaze3d.systems.RenderSystem; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; @@ -85,5 +87,4 @@ public static void drawSelectionOverlay(GuiGraphics graphics, int x, int y, int RenderSystem.enableDepthTest(); RenderSystem.enableBlend(); } - -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/util/AEFluidConfigSlot.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/util/AEFluidConfigSlot.java index 0877605e17..bf06af9cc4 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/util/AEFluidConfigSlot.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/util/AEFluidConfigSlot.java @@ -1,11 +1,9 @@ package com.gregtechceu.gtceu.integration.ae2.util; -import appeng.api.stacks.AEFluidKey; -import appeng.api.stacks.GenericStack; -import com.google.common.collect.Lists; import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.integration.ae2.gui.widget.AEConfigWidget; import com.gregtechceu.gtceu.integration.ae2.machine.MEInputHatchPartMachine; + import com.lowdragmc.lowdraglib.gui.ingredient.Target; import com.lowdragmc.lowdraglib.gui.util.DrawerHelper; import com.lowdragmc.lowdraglib.gui.util.TextFormattingUtil; @@ -15,6 +13,7 @@ import com.lowdragmc.lowdraglib.side.fluid.FluidTransferHelper; import com.lowdragmc.lowdraglib.utils.Position; import com.lowdragmc.lowdraglib.utils.Size; + import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.renderer.Rect2i; import net.minecraft.core.registries.BuiltInRegistries; @@ -25,9 +24,12 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.Block; -import org.jetbrains.annotations.NotNull; +import appeng.api.stacks.AEFluidKey; +import appeng.api.stacks.GenericStack; +import com.google.common.collect.Lists; import org.jetbrains.annotations.NotNull; + import java.util.Collections; import java.util.List; @@ -40,8 +42,8 @@ * @Date 2023/4/21-0:50 */ public class AEFluidConfigSlot extends AEConfigSlot { - public static final int LOAD_PHANTOM_FLUID_STACK_FROM_NBT = 13; + public static final int LOAD_PHANTOM_FLUID_STACK_FROM_NBT = 13; public AEFluidConfigSlot(int x, int y, AEConfigWidget widget, int index) { super(new Position(x, y), new Size(18, 18 * 2), widget, index); @@ -63,14 +65,16 @@ public void drawInBackground(@NotNull GuiGraphics graphics, int mouseX, int mous int stackX = position.x + 1; int stackY = position.y + 1; if (config != null) { - FluidStack stack = config.what() instanceof AEFluidKey key ? FluidStack.create(key.getFluid(), config.amount(), key.getTag()) : FluidStack.empty(); + FluidStack stack = config.what() instanceof AEFluidKey key ? + FluidStack.create(key.getFluid(), config.amount(), key.getTag()) : FluidStack.empty(); DrawerHelper.drawFluidForGui(graphics, stack, config.amount(), stackX, stackY, 17, 17); String amountStr = TextFormattingUtil.formatLongToCompactString(config.amount(), 4) + "mB"; drawStringFixedCorner(graphics, amountStr, stackX + 17, stackY + 17, 16777215, true, 0.5f); } if (stock != null) { - FluidStack stack = stock.what() instanceof AEFluidKey key ? FluidStack.create(key.getFluid(), stock.amount(), key.getTag()) : FluidStack.empty(); + FluidStack stack = stock.what() instanceof AEFluidKey key ? + FluidStack.create(key.getFluid(), stock.amount(), key.getTag()) : FluidStack.empty(); DrawerHelper.drawFluidForGui(graphics, stack, stock.amount(), stackX, stackY + 18, 17, 17); String amountStr = TextFormattingUtil.formatLongToCompactString(stock.amount(), 4) + "mB"; @@ -128,7 +132,8 @@ public void handleClientAction(int id, FriendlyByteBuf buffer) { writeUpdateInfo(REMOVE_ID, buf -> {}); } if (id == UPDATE_ID) { - FluidStack fluid = FluidStack.create(BuiltInRegistries.FLUID.get(buffer.readResourceLocation()), buffer.readVarLong()); + FluidStack fluid = FluidStack.create(BuiltInRegistries.FLUID.get(buffer.readResourceLocation()), + buffer.readVarLong()); slot.setConfig(new GenericStack(AEFluidKey.of(fluid.getFluid()), fluid.getAmount())); this.parentWidget.enableAmount(this.index); if (fluid != FluidStack.empty()) { @@ -175,7 +180,8 @@ public void readUpdateInfo(int id, FriendlyByteBuf buffer) { slot.setConfig(null); } if (id == UPDATE_ID) { - FluidStack fluid = FluidStack.create(BuiltInRegistries.FLUID.get(buffer.readResourceLocation()), buffer.readVarLong()); + FluidStack fluid = FluidStack.create(BuiltInRegistries.FLUID.get(buffer.readResourceLocation()), + buffer.readVarLong()); slot.setConfig(new GenericStack(AEFluidKey.of(fluid.getFluid()), fluid.getAmount())); } if (id == AMOUNT_CHANGE_ID) { @@ -195,7 +201,8 @@ public void readUpdateInfo(int id, FriendlyByteBuf buffer) { if (key.hasTag()) { stack.setTag(key.getTag().copy()); } - GenericStack stack1 = ExportOnlyAESlot.copy(slot.getStock(), Math.max(0, (slot.getStock().amount() - stack.getAmount()))); + GenericStack stack1 = ExportOnlyAESlot.copy(slot.getStock(), + Math.max(0, (slot.getStock().amount() - stack.getAmount()))); slot.setStock(stack1.amount() == 0 ? null : stack1); } } @@ -236,7 +243,9 @@ public boolean mouseWheelMove(double mouseX, double mouseY, double wheelDelta) { if (slot.getConfig() == null || wheelDelta == 0 || !rectangle.contains((int) mouseX, (int) mouseY)) { return false; } - FluidStack fluid = slot.getConfig().what() instanceof AEFluidKey fluidKey ? FluidStack.create(fluidKey.getFluid(), slot.getConfig().amount(), fluidKey.getTag()) : FluidStack.empty(); + FluidStack fluid = slot.getConfig().what() instanceof AEFluidKey fluidKey ? + FluidStack.create(fluidKey.getFluid(), slot.getConfig().amount(), fluidKey.getTag()) : + FluidStack.empty(); long amt; if (isCtrlDown()) { amt = wheelDelta > 0 ? fluid.getAmount() * 2L : fluid.getAmount() / 2L; @@ -253,7 +262,8 @@ public boolean mouseWheelMove(double mouseX, double mouseY, double wheelDelta) { } private int tryClickContainer(boolean isShiftKeyDown) { - MEInputHatchPartMachine.ExportOnlyAEFluid fluidTank = this.parentWidget.getConfig(this.index) instanceof MEInputHatchPartMachine.ExportOnlyAEFluid fluid ? fluid : null; + MEInputHatchPartMachine.ExportOnlyAEFluid fluidTank = this.parentWidget + .getConfig(this.index) instanceof MEInputHatchPartMachine.ExportOnlyAEFluid fluid ? fluid : null; if (fluidTank == null) return -1; Player player = gui.entityPlayer; ItemStack currentStack = gui.getModularUIContainer().getCarried(); @@ -265,9 +275,11 @@ private int tryClickContainer(boolean isShiftKeyDown) { boolean performedFill = false; FluidStack initialFluid = fluidTank.getFluid(); for (int i = 0; i < maxAttempts; i++) { - FluidActionResult result = FluidTransferHelper.tryFillContainer(currentStack, fluidTank, Integer.MAX_VALUE, null, false); + FluidActionResult result = FluidTransferHelper.tryFillContainer(currentStack, fluidTank, + Integer.MAX_VALUE, null, false); if (!result.isSuccess()) break; - ItemStack remainingStack = FluidTransferHelper.tryFillContainer(currentStack, fluidTank, Integer.MAX_VALUE, null, true).getResult(); + ItemStack remainingStack = FluidTransferHelper + .tryFillContainer(currentStack, fluidTank, Integer.MAX_VALUE, null, true).getResult(); currentStack.shrink(1); performedFill = true; if (!remainingStack.isEmpty() && !player.addItem(remainingStack)) { @@ -278,7 +290,8 @@ private int tryClickContainer(boolean isShiftKeyDown) { if (performedFill) { SoundEvent soundevent = FluidHelper.getFillSound(initialFluid); if (soundevent != null) { - player.level().playSound(null, player.position().x, player.position().y + 0.5, player.position().z, soundevent, SoundSource.BLOCKS, 1.0F, 1.0F); + player.level().playSound(null, player.position().x, player.position().y + 0.5, player.position().z, + soundevent, SoundSource.BLOCKS, 1.0F, 1.0F); } gui.getModularUIContainer().setCarried(currentStack); return currentStack.getCount(); @@ -287,5 +300,4 @@ private int tryClickContainer(boolean isShiftKeyDown) { return -1; } - -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/util/AEItemConfigSlot.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/util/AEItemConfigSlot.java index 2a0412f0a3..8b13927c79 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/util/AEItemConfigSlot.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/util/AEItemConfigSlot.java @@ -1,22 +1,24 @@ package com.gregtechceu.gtceu.integration.ae2.util; -import appeng.api.stacks.AEItemKey; -import appeng.api.stacks.GenericStack; -import com.google.common.collect.Lists; import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.integration.ae2.gui.widget.AEConfigWidget; + import com.lowdragmc.lowdraglib.gui.ingredient.Target; import com.lowdragmc.lowdraglib.gui.util.TextFormattingUtil; import com.lowdragmc.lowdraglib.utils.Position; import com.lowdragmc.lowdraglib.utils.Size; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.renderer.Rect2i; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.world.item.ItemStack; -import org.jetbrains.annotations.NotNull; +import appeng.api.stacks.AEItemKey; +import appeng.api.stacks.GenericStack; +import com.google.common.collect.Lists; import org.jetbrains.annotations.NotNull; + import java.util.Collections; import java.util.List; @@ -50,14 +52,16 @@ public void drawInBackground(@NotNull GuiGraphics graphics, int mouseX, int mous int stackX = position.x + 1; int stackY = position.y + 1; if (config != null) { - ItemStack stack = config.what() instanceof AEItemKey key ? new ItemStack(key.getItem(), (int) config.amount()) : ItemStack.EMPTY; + ItemStack stack = config.what() instanceof AEItemKey key ? + new ItemStack(key.getItem(), (int) config.amount()) : ItemStack.EMPTY; stack.setCount(1); drawItemStack(graphics, stack, stackX, stackY, 0xFFFFFFFF, null); String amountStr = TextFormattingUtil.formatLongToCompactString(config.amount(), 4); drawStringFixedCorner(graphics, amountStr, stackX + 17, stackY + 17, 16777215, true, 0.5f); } if (stock != null) { - ItemStack stack = stock.what() instanceof AEItemKey key ? new ItemStack(key.getItem(), (int) stock.amount()) : ItemStack.EMPTY; + ItemStack stack = stock.what() instanceof AEItemKey key ? + new ItemStack(key.getItem(), (int) stock.amount()) : ItemStack.EMPTY; stack.setCount(1); drawItemStack(graphics, stack, stackX, stackY + 18, 0xFFFFFFFF, null); String amountStr = TextFormattingUtil.formatLongToCompactString(stock.amount(), 4); @@ -141,13 +145,16 @@ public void handleClientAction(int id, FriendlyByteBuf buffer) { } } if (id == PICK_UP_ID) { - if (slot.getStock() != null && this.gui.getModularUIContainer().getCarried() == ItemStack.EMPTY && slot.getStock().what() instanceof AEItemKey key) { - ItemStack stack = new ItemStack(key.getItem(), Math.min((int) slot.getStock().amount(), key.getItem().getMaxStackSize())); + if (slot.getStock() != null && this.gui.getModularUIContainer().getCarried() == ItemStack.EMPTY && + slot.getStock().what() instanceof AEItemKey key) { + ItemStack stack = new ItemStack(key.getItem(), + Math.min((int) slot.getStock().amount(), key.getItem().getMaxStackSize())); if (key.hasTag()) { stack.setTag(key.getTag().copy()); } this.gui.getModularUIContainer().setCarried(stack); - GenericStack stack1 = ExportOnlyAESlot.copy(slot.getStock(), Math.max(0, (slot.getStock().amount() - stack.getCount()))); + GenericStack stack1 = ExportOnlyAESlot.copy(slot.getStock(), + Math.max(0, (slot.getStock().amount() - stack.getCount()))); slot.setStock(stack1.amount() == 0 ? null : stack1); writeUpdateInfo(PICK_UP_ID, buf -> {}); } @@ -173,12 +180,14 @@ public void readUpdateInfo(int id, FriendlyByteBuf buffer) { } if (id == PICK_UP_ID) { if (slot.getStock() != null && slot.getStock().what() instanceof AEItemKey key) { - ItemStack stack = new ItemStack(key.getItem(), Math.min((int) slot.getStock().amount(), key.getItem().getMaxStackSize())); + ItemStack stack = new ItemStack(key.getItem(), + Math.min((int) slot.getStock().amount(), key.getItem().getMaxStackSize())); if (key.hasTag()) { stack.setTag(key.getTag().copy()); } this.gui.getModularUIContainer().setCarried(stack); - GenericStack stack1 = ExportOnlyAESlot.copy(slot.getStock(), Math.max(0, (slot.getStock().amount() - stack.getCount()))); + GenericStack stack1 = ExportOnlyAESlot.copy(slot.getStock(), + Math.max(0, (slot.getStock().amount() - stack.getCount()))); slot.setStock(stack1.amount() == 0 ? null : stack1); } } @@ -229,5 +238,4 @@ public boolean mouseWheelMove(double mouseX, double mouseY, double wheelDelta) { } return false; } - -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/util/AmountSetSlot.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/util/AmountSetSlot.java index ddefb2b913..6fae81d253 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/util/AmountSetSlot.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/util/AmountSetSlot.java @@ -1,18 +1,17 @@ package com.gregtechceu.gtceu.integration.ae2.util; -import appeng.api.stacks.GenericStack; -import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.gui.GuiTextures; -import com.gregtechceu.gtceu.api.gui.widget.LongInputWidget; import com.gregtechceu.gtceu.integration.ae2.gui.widget.AEConfigWidget; -import com.gregtechceu.gtceu.integration.ae2.util.IConfigurableSlot; + import com.lowdragmc.lowdraglib.gui.widget.TextFieldWidget; import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.utils.Position; -import io.netty.buffer.Unpooled; -import lombok.Getter; + import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.FriendlyByteBuf; + +import appeng.api.stacks.GenericStack; +import lombok.Getter; import org.jetbrains.annotations.NotNull; import static com.lowdragmc.lowdraglib.gui.util.DrawerHelper.drawStringSized; @@ -47,7 +46,7 @@ public String getAmountStr() { return "0"; } IConfigurableSlot slot = this.parentWidget.getConfig(this.index); - if(slot.getConfig() != null && slot.getConfig().amount() > 1000) { + if (slot.getConfig() != null && slot.getConfig().amount() > 1000) { return "1000"; } if (slot.getConfig() != null) { @@ -60,8 +59,7 @@ public void setNewAmount(String amount) { try { long newAmount = Long.parseLong(amount); writeClientAction(1, buf -> buf.writeVarLong(newAmount)); - } catch (NumberFormatException ignore) { - } + } catch (NumberFormatException ignore) {} } @Override @@ -89,5 +87,4 @@ public void drawInBackground(@NotNull GuiGraphics graphics, int mouseX, int mous drawStringSized(graphics, "Amount", position.x + 3, position.y + 3, 0x404040, false, 1f, false); GuiTextures.DISPLAY.draw(graphics, mouseX, mouseY, position.x + 3, position.y + 11, 65, 14); } - -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/util/ExportOnlyAESlot.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/util/ExportOnlyAESlot.java index 507076d39d..62f3519ea3 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/util/ExportOnlyAESlot.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/util/ExportOnlyAESlot.java @@ -1,13 +1,13 @@ package com.gregtechceu.gtceu.integration.ae2.util; -import appeng.api.stacks.GenericStack; -import com.gregtechceu.gtceu.GTCEu; import com.lowdragmc.lowdraglib.syncdata.IContentChangeAware; import com.lowdragmc.lowdraglib.syncdata.ITagSerializable; -import lombok.Getter; -import lombok.Setter; + import net.minecraft.nbt.CompoundTag; +import appeng.api.stacks.GenericStack; +import lombok.Getter; +import lombok.Setter; import org.jetbrains.annotations.Nullable; /** @@ -15,16 +15,21 @@ * @Description A export only slot to hold {@link appeng.api.stacks.GenericStack} * @date 2023/4/22-13:42 */ -public abstract class ExportOnlyAESlot implements IConfigurableSlot, ITagSerializable, IContentChangeAware { +public abstract class ExportOnlyAESlot implements IConfigurableSlot, ITagSerializable, + IContentChangeAware { + protected final static String CONFIG_TAG = "config"; protected final static String STOCK_TAG = "stock"; - @Getter @Setter + @Getter + @Setter protected Runnable onContentsChanged = () -> {}; - @Getter @Setter + @Getter + @Setter protected GenericStack config; - @Getter @Setter + @Getter + @Setter protected GenericStack stock; public ExportOnlyAESlot(GenericStack config, GenericStack stock) { @@ -96,7 +101,6 @@ public void deserializeNBT(CompoundTag tag) { if (tag.contains(STOCK_TAG)) { this.stock = GenericStack.readTag(tag.getCompound(STOCK_TAG)); } - } public static GenericStack copy(GenericStack stack) { @@ -106,5 +110,4 @@ public static GenericStack copy(GenericStack stack) { public static GenericStack copy(GenericStack stack, long amount) { return new GenericStack(stack.what(), amount); } - -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/util/IConfigurableSlot.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/util/IConfigurableSlot.java index 9b8c7688d5..06e16011e4 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/util/IConfigurableSlot.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/util/IConfigurableSlot.java @@ -19,5 +19,4 @@ public interface IConfigurableSlot { void setStock(GenericStack val); IConfigurableSlot copy(); - -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/util/SerializableGenericStackInv.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/util/SerializableGenericStackInv.java index b1938a2540..3be6d7bbb2 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/util/SerializableGenericStackInv.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/util/SerializableGenericStackInv.java @@ -1,10 +1,13 @@ package com.gregtechceu.gtceu.integration.ae2.util; -import appeng.helpers.externalstorage.GenericStackInv; import com.gregtechceu.gtceu.core.mixins.ae2.GenericStackInvAccessor; + import com.lowdragmc.lowdraglib.syncdata.IContentChangeAware; import com.lowdragmc.lowdraglib.syncdata.ITagSerializable; + import net.minecraft.nbt.ListTag; + +import appeng.helpers.externalstorage.GenericStackInv; import org.jetbrains.annotations.Nullable; /** @@ -12,7 +15,8 @@ * @Description A serializable {@link GenericStackInv} from AE2 * @Date 2023/4/18-23:52 */ -public class SerializableGenericStackInv extends GenericStackInv implements ITagSerializable, IContentChangeAware { +public class SerializableGenericStackInv extends GenericStackInv + implements ITagSerializable, IContentChangeAware { public SerializableGenericStackInv(@Nullable Runnable listener, int size) { super(listener, size); @@ -30,11 +34,11 @@ public void deserializeNBT(ListTag tags) { @Override public void setOnContentsChanged(Runnable runnable) { - ((GenericStackInvAccessor)this).setListener(runnable); + ((GenericStackInvAccessor) this).setListener(runnable); } @Override public Runnable getOnContentsChanged() { - return ((GenericStackInvAccessor)this).getListener(); + return ((GenericStackInvAccessor) this).getListener(); } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/util/SerializableManagedGridNode.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/util/SerializableManagedGridNode.java index 7dc7e39515..97d3a7d383 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/util/SerializableManagedGridNode.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/util/SerializableManagedGridNode.java @@ -1,11 +1,14 @@ package com.gregtechceu.gtceu.integration.ae2.util; -import appeng.api.networking.IGridNodeListener; -import appeng.me.ManagedGridNode; import com.lowdragmc.lowdraglib.syncdata.ITagSerializable; + import net.minecraft.nbt.CompoundTag; +import appeng.api.networking.IGridNodeListener; +import appeng.me.ManagedGridNode; + public class SerializableManagedGridNode extends ManagedGridNode implements ITagSerializable { + public SerializableManagedGridNode(T nodeOwner, IGridNodeListener listener) { super(nodeOwner, listener); } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/emi/GTEMIPlugin.java b/src/main/java/com/gregtechceu/gtceu/integration/emi/GTEMIPlugin.java index 767152ce37..74fa817d2f 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/emi/GTEMIPlugin.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/emi/GTEMIPlugin.java @@ -1,10 +1,11 @@ package com.gregtechceu.gtceu.integration.emi; -import appeng.menu.me.items.PatternEncodingTermMenu; import com.gregtechceu.gtceu.GTCEu; +import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.machine.MachineDefinition; import com.gregtechceu.gtceu.api.recipe.GTRecipeType; import com.gregtechceu.gtceu.common.data.GTMachines; +import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.integration.emi.multipage.MultiblockInfoEmiCategory; import com.gregtechceu.gtceu.integration.emi.oreprocessing.GTOreProcessingEmiCategory; import com.gregtechceu.gtceu.integration.emi.orevein.GTBedrockFluidEmiCategory; @@ -12,14 +13,20 @@ import com.gregtechceu.gtceu.integration.emi.recipe.Ae2PatternTerminalHandler; import com.gregtechceu.gtceu.integration.emi.recipe.GTEmiRecipeHandler; import com.gregtechceu.gtceu.integration.emi.recipe.GTRecipeTypeEmiCategory; + +import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.gui.modular.ModularUIContainer; + +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.world.item.crafting.RecipeType; + +import appeng.menu.me.items.PatternEncodingTermMenu; +import de.mari_023.ae2wtlib.wet.WETMenu; import dev.emi.emi.api.EmiEntrypoint; import dev.emi.emi.api.EmiPlugin; import dev.emi.emi.api.EmiRegistry; import dev.emi.emi.api.recipe.VanillaEmiRecipeCategories; import dev.emi.emi.api.stack.EmiStack; -import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.world.item.crafting.RecipeType; /** * @author KilaBash @@ -32,7 +39,8 @@ public class GTEMIPlugin implements EmiPlugin { @Override public void register(EmiRegistry registry) { registry.addCategory(MultiblockInfoEmiCategory.CATEGORY); - registry.addCategory(GTOreProcessingEmiCategory.CATEGORY); + if (!ConfigHolder.INSTANCE.compat.hideOreProcessingDiagrams) + registry.addCategory(GTOreProcessingEmiCategory.CATEGORY); registry.addCategory(GTOreVeinEmiCategory.CATEGORY); registry.addCategory(GTBedrockFluidEmiCategory.CATEGORY); for (RecipeType recipeType : BuiltInRegistries.RECIPE_TYPE) { @@ -43,22 +51,26 @@ public void register(EmiRegistry registry) { } } registry.addRecipeHandler(ModularUIContainer.MENUTYPE, new GTEmiRecipeHandler()); - if(GTCEu.isAE2Loaded()){ + if (GTCEu.isAE2Loaded()) { registry.addRecipeHandler(PatternEncodingTermMenu.TYPE, new Ae2PatternTerminalHandler<>()); } + if (LDLib.isModLoaded(GTValues.MODID_AE2WTLIB)) { + registry.addRecipeHandler(WETMenu.TYPE, new Ae2PatternTerminalHandler<>()); + } // recipes try { MultiblockInfoEmiCategory.registerDisplays(registry); - } catch (NullPointerException ignored){ - } + } catch (NullPointerException ignored) {} GTRecipeTypeEmiCategory.registerDisplays(registry); - GTOreProcessingEmiCategory.registerDisplays(registry); + if (!ConfigHolder.INSTANCE.compat.hideOreProcessingDiagrams) + GTOreProcessingEmiCategory.registerDisplays(registry); GTOreVeinEmiCategory.registerDisplays(registry); GTBedrockFluidEmiCategory.registerDisplays(registry); // workstations MultiblockInfoEmiCategory.registerWorkStations(registry); GTRecipeTypeEmiCategory.registerWorkStations(registry); - GTOreProcessingEmiCategory.registerWorkStations(registry); + if (!ConfigHolder.INSTANCE.compat.hideOreProcessingDiagrams) + GTOreProcessingEmiCategory.registerWorkStations(registry); GTOreVeinEmiCategory.registerWorkStations(registry); GTBedrockFluidEmiCategory.registerWorkStations(registry); for (MachineDefinition definition : GTMachines.ELECTRIC_FURNACE) { @@ -66,8 +78,10 @@ public void register(EmiRegistry registry) { registry.addWorkstation(VanillaEmiRecipeCategories.SMELTING, EmiStack.of(definition.asStack())); } } - registry.addWorkstation(VanillaEmiRecipeCategories.SMELTING, EmiStack.of(GTMachines.STEAM_FURNACE.left().asStack())); - registry.addWorkstation(VanillaEmiRecipeCategories.SMELTING, EmiStack.of(GTMachines.STEAM_FURNACE.right().asStack())); + registry.addWorkstation(VanillaEmiRecipeCategories.SMELTING, + EmiStack.of(GTMachines.STEAM_FURNACE.left().asStack())); + registry.addWorkstation(VanillaEmiRecipeCategories.SMELTING, + EmiStack.of(GTMachines.STEAM_FURNACE.right().asStack())); registry.addWorkstation(VanillaEmiRecipeCategories.SMELTING, EmiStack.of(GTMachines.STEAM_OVEN.asStack())); registry.addWorkstation(VanillaEmiRecipeCategories.SMELTING, EmiStack.of(GTMachines.MULTI_SMELTER.asStack())); } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/emi/multipage/MultiblockInfoEmiCategory.java b/src/main/java/com/gregtechceu/gtceu/integration/emi/multipage/MultiblockInfoEmiCategory.java index 42808f3e7f..cc5e4452e7 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/emi/multipage/MultiblockInfoEmiCategory.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/emi/multipage/MultiblockInfoEmiCategory.java @@ -4,12 +4,15 @@ import com.gregtechceu.gtceu.api.machine.MultiblockMachineDefinition; import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.common.data.GTMachines; + +import net.minecraft.network.chat.Component; + import dev.emi.emi.api.EmiRegistry; import dev.emi.emi.api.recipe.EmiRecipeCategory; import dev.emi.emi.api.stack.EmiStack; -import net.minecraft.network.chat.Component; public class MultiblockInfoEmiCategory extends EmiRecipeCategory { + public static final MultiblockInfoEmiCategory CATEGORY = new MultiblockInfoEmiCategory(); private MultiblockInfoEmiCategory() { diff --git a/src/main/java/com/gregtechceu/gtceu/integration/emi/multipage/MultiblockInfoEmiRecipe.java b/src/main/java/com/gregtechceu/gtceu/integration/emi/multipage/MultiblockInfoEmiRecipe.java index 8e5cc74d8e..52e17dbfcb 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/emi/multipage/MultiblockInfoEmiRecipe.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/emi/multipage/MultiblockInfoEmiRecipe.java @@ -1,15 +1,18 @@ package com.gregtechceu.gtceu.integration.emi.multipage; - import com.gregtechceu.gtceu.api.gui.widget.PatternPreviewWidget; import com.gregtechceu.gtceu.api.machine.MultiblockMachineDefinition; + import com.lowdragmc.lowdraglib.emi.ModularEmiRecipe; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; -import dev.emi.emi.api.recipe.EmiRecipeCategory; + import net.minecraft.resources.ResourceLocation; + +import dev.emi.emi.api.recipe.EmiRecipeCategory; import org.jetbrains.annotations.Nullable; public class MultiblockInfoEmiRecipe extends ModularEmiRecipe { + public final MultiblockMachineDefinition definition; public MultiblockInfoEmiRecipe(MultiblockMachineDefinition definition) { diff --git a/src/main/java/com/gregtechceu/gtceu/integration/emi/oreprocessing/GTEmiOreProcessing.java b/src/main/java/com/gregtechceu/gtceu/integration/emi/oreprocessing/GTEmiOreProcessing.java index baeb244f5a..6d616ec62a 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/emi/oreprocessing/GTEmiOreProcessing.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/emi/oreprocessing/GTEmiOreProcessing.java @@ -1,15 +1,17 @@ package com.gregtechceu.gtceu.integration.emi.oreprocessing; -import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.integration.GTOreByProductWidget; + import com.lowdragmc.lowdraglib.emi.ModularEmiRecipe; -import dev.emi.emi.api.recipe.EmiRecipeCategory; + import net.minecraft.resources.ResourceLocation; -import org.jetbrains.annotations.Nullable; +import dev.emi.emi.api.recipe.EmiRecipeCategory; +import org.jetbrains.annotations.Nullable; public class GTEmiOreProcessing extends ModularEmiRecipe { + final Material material; public GTEmiOreProcessing(Material material) { diff --git a/src/main/java/com/gregtechceu/gtceu/integration/emi/oreprocessing/GTOreProcessingEmiCategory.java b/src/main/java/com/gregtechceu/gtceu/integration/emi/oreprocessing/GTOreProcessingEmiCategory.java index 1e57a68455..75024805a1 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/emi/oreprocessing/GTOreProcessingEmiCategory.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/emi/oreprocessing/GTOreProcessingEmiCategory.java @@ -6,11 +6,13 @@ import com.gregtechceu.gtceu.api.machine.MachineDefinition; import com.gregtechceu.gtceu.api.recipe.GTRecipeType; import com.gregtechceu.gtceu.api.registry.GTRegistries; + +import net.minecraft.network.chat.Component; +import net.minecraft.world.item.Items; + import dev.emi.emi.api.EmiRegistry; import dev.emi.emi.api.recipe.EmiRecipeCategory; import dev.emi.emi.api.stack.EmiStack; -import net.minecraft.network.chat.Component; -import net.minecraft.world.item.Items; import java.util.ArrayList; import java.util.List; @@ -19,7 +21,9 @@ import static com.gregtechceu.gtceu.common.data.GTRecipeTypes.*; public class GTOreProcessingEmiCategory extends EmiRecipeCategory { + public static final GTOreProcessingEmiCategory CATEGORY = new GTOreProcessingEmiCategory(); + public GTOreProcessingEmiCategory() { super(GTCEu.id("ore_processing_diagram"), EmiStack.of(Items.IRON_ORE)); } @@ -35,12 +39,13 @@ public static void registerDisplays(EmiRegistry registry) { public static void registerWorkStations(EmiRegistry registry) { List registeredMachines = new ArrayList<>(); GTRecipeType[] validTypes = new GTRecipeType[] { - MACERATOR_RECIPES,ORE_WASHER_RECIPES,THERMAL_CENTRIFUGE_RECIPES,CENTRIFUGE_RECIPES,CHEMICAL_BATH_RECIPES,ELECTROMAGNETIC_SEPARATOR_RECIPES,SIFTER_RECIPES + MACERATOR_RECIPES, ORE_WASHER_RECIPES, THERMAL_CENTRIFUGE_RECIPES, CENTRIFUGE_RECIPES, + CHEMICAL_BATH_RECIPES, ELECTROMAGNETIC_SEPARATOR_RECIPES, SIFTER_RECIPES }; for (MachineDefinition machine : GTRegistries.MACHINES) { if (machine.getRecipeTypes() != null) { - for (GTRecipeType type : machine.getRecipeTypes()){ - for (GTRecipeType validType : validTypes){ + for (GTRecipeType type : machine.getRecipeTypes()) { + for (GTRecipeType validType : validTypes) { if (type == validType && !registeredMachines.contains(machine)) { registry.addWorkstation(CATEGORY, EmiStack.of(machine.asStack())); registeredMachines.add(machine); diff --git a/src/main/java/com/gregtechceu/gtceu/integration/emi/orevein/GTBedrockFluid.java b/src/main/java/com/gregtechceu/gtceu/integration/emi/orevein/GTBedrockFluid.java index eb9bda73a1..f2e13ba778 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/emi/orevein/GTBedrockFluid.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/emi/orevein/GTBedrockFluid.java @@ -3,14 +3,19 @@ import com.gregtechceu.gtceu.api.data.worldgen.bedrockfluid.BedrockFluidDefinition; import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.integration.GTOreVeinWidget; + import com.lowdragmc.lowdraglib.emi.ModularEmiRecipe; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; -import dev.emi.emi.api.recipe.EmiRecipeCategory; + import net.minecraft.resources.ResourceLocation; + +import dev.emi.emi.api.recipe.EmiRecipeCategory; import org.jetbrains.annotations.Nullable; public class GTBedrockFluid extends ModularEmiRecipe { + private final BedrockFluidDefinition fluid; + public GTBedrockFluid(BedrockFluidDefinition fluid) { super(() -> new GTOreVeinWidget(fluid)); this.fluid = fluid; diff --git a/src/main/java/com/gregtechceu/gtceu/integration/emi/orevein/GTBedrockFluidEmiCategory.java b/src/main/java/com/gregtechceu/gtceu/integration/emi/orevein/GTBedrockFluidEmiCategory.java index 4fa4f2a46f..dd4770c240 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/emi/orevein/GTBedrockFluidEmiCategory.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/emi/orevein/GTBedrockFluidEmiCategory.java @@ -5,12 +5,15 @@ import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.common.data.GTItems; import com.gregtechceu.gtceu.common.data.GTMaterials; + +import net.minecraft.network.chat.Component; + import dev.emi.emi.api.EmiRegistry; import dev.emi.emi.api.recipe.EmiRecipeCategory; import dev.emi.emi.api.stack.EmiStack; -import net.minecraft.network.chat.Component; public class GTBedrockFluidEmiCategory extends EmiRecipeCategory { + public static final GTBedrockFluidEmiCategory CATEGORY = new GTBedrockFluidEmiCategory(); public GTBedrockFluidEmiCategory() { diff --git a/src/main/java/com/gregtechceu/gtceu/integration/emi/orevein/GTEmiOreVein.java b/src/main/java/com/gregtechceu/gtceu/integration/emi/orevein/GTEmiOreVein.java index a345d9af46..778824db2d 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/emi/orevein/GTEmiOreVein.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/emi/orevein/GTEmiOreVein.java @@ -3,16 +3,20 @@ import com.gregtechceu.gtceu.api.data.worldgen.GTOreDefinition; import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.integration.GTOreVeinWidget; + import com.lowdragmc.lowdraglib.emi.ModularEmiRecipe; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; -import dev.emi.emi.api.recipe.EmiRecipeCategory; + import net.minecraft.resources.ResourceLocation; + +import dev.emi.emi.api.recipe.EmiRecipeCategory; import org.jetbrains.annotations.Nullable; public class GTEmiOreVein extends ModularEmiRecipe { + private final GTOreDefinition oreDefinition; - public GTEmiOreVein(GTOreDefinition oreDefinition){ + public GTEmiOreVein(GTOreDefinition oreDefinition) { super(() -> new GTOreVeinWidget(oreDefinition)); this.oreDefinition = oreDefinition; } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/emi/orevein/GTOreVeinEmiCategory.java b/src/main/java/com/gregtechceu/gtceu/integration/emi/orevein/GTOreVeinEmiCategory.java index ee343dd2ac..7086dbc1c7 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/emi/orevein/GTOreVeinEmiCategory.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/emi/orevein/GTOreVeinEmiCategory.java @@ -4,14 +4,16 @@ import com.gregtechceu.gtceu.api.data.worldgen.GTOreDefinition; import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.common.data.GTItems; -import dev.emi.emi.api.EmiRegistry; -import dev.emi.emi.api.recipe.EmiRecipeCategory; -import dev.emi.emi.api.stack.EmiStack; + import net.minecraft.network.chat.Component; import net.minecraft.world.item.Items; +import dev.emi.emi.api.EmiRegistry; +import dev.emi.emi.api.recipe.EmiRecipeCategory; +import dev.emi.emi.api.stack.EmiStack; public class GTOreVeinEmiCategory extends EmiRecipeCategory { + public static final GTOreVeinEmiCategory CATEGORY = new GTOreVeinEmiCategory(); public GTOreVeinEmiCategory() { @@ -19,7 +21,7 @@ public GTOreVeinEmiCategory() { } public static void registerDisplays(EmiRegistry registry) { - for (GTOreDefinition oreDefinition : GTRegistries.ORE_VEINS){ + for (GTOreDefinition oreDefinition : GTRegistries.ORE_VEINS) { registry.addRecipe(new GTEmiOreVein(oreDefinition)); } } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/emi/recipe/Ae2PatternTerminalHandler.java b/src/main/java/com/gregtechceu/gtceu/integration/emi/recipe/Ae2PatternTerminalHandler.java index 075d90d53c..0f6057453e 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/emi/recipe/Ae2PatternTerminalHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/emi/recipe/Ae2PatternTerminalHandler.java @@ -1,5 +1,12 @@ package com.gregtechceu.gtceu.integration.emi.recipe; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.material.Fluid; + import appeng.api.stacks.AEFluidKey; import appeng.api.stacks.AEItemKey; import appeng.api.stacks.GenericStack; @@ -12,67 +19,71 @@ import dev.emi.emi.api.stack.EmiIngredient; import dev.emi.emi.api.stack.EmiStack; import dev.emi.emi.screen.RecipeScreen; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; -import net.minecraft.world.inventory.Slot; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.material.Fluid; import java.util.ArrayList; import java.util.List; public class Ae2PatternTerminalHandler implements EmiRecipeHandler { + private List getInputSources(T handler) { return handler.slots; } + @Override public EmiPlayerInventory getInventory(AbstractContainerScreen screen) { - return new EmiPlayerInventory(getInputSources(screen.getMenu()).stream().map(Slot::getItem).map(EmiStack::of).toList()); + return new EmiPlayerInventory( + getInputSources(screen.getMenu()).stream().map(Slot::getItem).map(EmiStack::of).toList()); } + @Override public boolean supportsRecipe(EmiRecipe recipe) { return recipe instanceof GTEmiRecipe; } + @Override public boolean canCraft(EmiRecipe recipe, EmiCraftContext context) { return true; } + @Override public boolean craft(EmiRecipe recipe, EmiCraftContext context) { T menu = context.getScreenHandler(); EncodingHelper.encodeProcessingRecipe(menu, ofInputs(recipe), ofOutputs(recipe)); - if (Minecraft.getInstance().screen instanceof RecipeScreen e){ + if (Minecraft.getInstance().screen instanceof RecipeScreen e) { e.onClose(); } return true; } + public static List> ofInputs(EmiRecipe emiRecipe) { return emiRecipe.getInputs() .stream() .map(Ae2PatternTerminalHandler::intoGenericStack) .toList(); } + public static List ofOutputs(EmiRecipe emiRecipe) { return emiRecipe.getOutputs() .stream() .flatMap(slot -> intoGenericStack(slot).stream().limit(1)) .toList(); } + private static List intoGenericStack(EmiIngredient ingredient) { if (ingredient.isEmpty()) { return new ArrayList<>(); } - return ingredient.getEmiStacks().stream().map(Ae2PatternTerminalHandler::fromEmiStack).toList(); + return ingredient.getEmiStacks().stream().map(stack -> fromEmiStack(stack, ingredient.getAmount())).toList(); } - private static GenericStack fromEmiStack(EmiStack stack) { - if (stack.getKey() instanceof Item item){ - return new GenericStack(AEItemKey.of(item.getDefaultInstance()), stack.getItemStack().getCount()); - }else if (stack.getKey() instanceof Fluid fluid){ - return new GenericStack(AEFluidKey.of(fluid), stack.getAmount()); + + private static GenericStack fromEmiStack(EmiStack stack, long amount) { + if (stack.getKey() instanceof Item item) { + return new GenericStack(AEItemKey.of(item.getDefaultInstance()), amount); + } else if (stack.getKey() instanceof Fluid fluid) { + return new GenericStack(AEFluidKey.of(fluid), amount); } - return new GenericStack(AEItemKey.of(ItemStack.EMPTY), ItemStack.EMPTY.getCount()); + return new GenericStack(AEItemKey.of(ItemStack.EMPTY), 0); } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/integration/emi/recipe/GTEmiRecipe.java b/src/main/java/com/gregtechceu/gtceu/integration/emi/recipe/GTEmiRecipe.java index c1791c99e4..6a97f1abc8 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/emi/recipe/GTEmiRecipe.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/emi/recipe/GTEmiRecipe.java @@ -2,13 +2,17 @@ import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.integration.GTRecipeWidget; + import com.lowdragmc.lowdraglib.emi.ModularEmiRecipe; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; -import dev.emi.emi.api.recipe.EmiRecipeCategory; + import net.minecraft.resources.ResourceLocation; + +import dev.emi.emi.api.recipe.EmiRecipeCategory; import org.jetbrains.annotations.Nullable; public class GTEmiRecipe extends ModularEmiRecipe { + final GTRecipeTypeEmiCategory category; final GTRecipe recipe; diff --git a/src/main/java/com/gregtechceu/gtceu/integration/emi/recipe/GTEmiRecipeHandler.java b/src/main/java/com/gregtechceu/gtceu/integration/emi/recipe/GTEmiRecipeHandler.java index d3be2d3f7d..909f27f555 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/emi/recipe/GTEmiRecipeHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/emi/recipe/GTEmiRecipeHandler.java @@ -3,14 +3,16 @@ import com.lowdragmc.lowdraglib.gui.modular.ModularUIContainer; import com.lowdragmc.lowdraglib.gui.widget.SlotWidget; import com.lowdragmc.lowdraglib.jei.IngredientIO; + +import net.minecraft.world.inventory.Slot; + import dev.emi.emi.api.recipe.EmiRecipe; import dev.emi.emi.api.recipe.handler.StandardRecipeHandler; -import net.minecraft.world.inventory.AbstractContainerMenu; -import net.minecraft.world.inventory.Slot; import java.util.List; public class GTEmiRecipeHandler implements StandardRecipeHandler { + @Override public List getInputSources(ModularUIContainer handler) { return handler.getModularUI().getSlotMap().values().stream() @@ -27,7 +29,6 @@ public List getCraftingSlots(ModularUIContainer handler) { .toList(); } - @Override public boolean supportsRecipe(EmiRecipe recipe) { return recipe instanceof GTEmiRecipe; diff --git a/src/main/java/com/gregtechceu/gtceu/integration/emi/recipe/GTRecipeTypeEmiCategory.java b/src/main/java/com/gregtechceu/gtceu/integration/emi/recipe/GTRecipeTypeEmiCategory.java index 215a83a955..70513eda4d 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/emi/recipe/GTRecipeTypeEmiCategory.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/emi/recipe/GTRecipeTypeEmiCategory.java @@ -3,9 +3,7 @@ import com.gregtechceu.gtceu.api.machine.MachineDefinition; import com.gregtechceu.gtceu.api.recipe.GTRecipeType; import com.gregtechceu.gtceu.api.registry.GTRegistries; -import dev.emi.emi.api.EmiRegistry; -import dev.emi.emi.api.recipe.EmiRecipeCategory; -import dev.emi.emi.api.stack.EmiStack; + import net.minecraft.Util; import net.minecraft.client.Minecraft; import net.minecraft.core.registries.BuiltInRegistries; @@ -13,14 +11,21 @@ import net.minecraft.world.item.Items; import net.minecraft.world.item.crafting.RecipeType; +import dev.emi.emi.api.EmiRegistry; +import dev.emi.emi.api.recipe.EmiRecipeCategory; +import dev.emi.emi.api.stack.EmiStack; + import java.util.function.Function; public class GTRecipeTypeEmiCategory extends EmiRecipeCategory { - public static final Function CATEGORIES = Util.memoize(GTRecipeTypeEmiCategory::new); + + public static final Function CATEGORIES = Util + .memoize(GTRecipeTypeEmiCategory::new); public final GTRecipeType recipeType; public GTRecipeTypeEmiCategory(GTRecipeType recipeType) { - super(recipeType.registryName, recipeType.getIconSupplier() != null ? EmiStack.of(recipeType.getIconSupplier().get()) : EmiStack.of(Items.BARRIER)); + super(recipeType.registryName, recipeType.getIconSupplier() != null ? + EmiStack.of(recipeType.getIconSupplier().get()) : EmiStack.of(Items.BARRIER)); this.recipeType = recipeType; } @@ -38,9 +43,10 @@ public static void registerWorkStations(EmiRegistry registry) { for (GTRecipeType gtRecipeType : GTRegistries.RECIPE_TYPES) { for (MachineDefinition machine : GTRegistries.MACHINES) { if (machine.getRecipeTypes() != null) { - for (GTRecipeType type : machine.getRecipeTypes()){ + for (GTRecipeType type : machine.getRecipeTypes()) { if (type == gtRecipeType) { - registry.addWorkstation(GTRecipeTypeEmiCategory.CATEGORIES.apply(gtRecipeType), EmiStack.of(machine.asStack())); + registry.addWorkstation(GTRecipeTypeEmiCategory.CATEGORIES.apply(gtRecipeType), + EmiStack.of(machine.asStack())); } } } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/jade/GTJadePlugin.java b/src/main/java/com/gregtechceu/gtceu/integration/jade/GTJadePlugin.java index 66fb144974..7a3634589e 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/jade/GTJadePlugin.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/jade/GTJadePlugin.java @@ -1,20 +1,16 @@ package com.gregtechceu.gtceu.integration.jade; -import com.gregtechceu.gtceu.api.item.IGTTool; -import com.gregtechceu.gtceu.api.item.tool.GTToolItem; -import com.gregtechceu.gtceu.common.block.FluidPipeBlock; import com.gregtechceu.gtceu.common.blockentity.FluidPipeBlockEntity; import com.gregtechceu.gtceu.common.data.GTItems; import com.gregtechceu.gtceu.integration.jade.provider.*; -import com.tterrag.registrate.util.entry.ItemEntry; -import com.tterrag.registrate.util.entry.ItemProviderEntry; + import net.minecraft.world.item.Item; -import net.minecraft.world.item.TieredItem; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntity; + +import com.tterrag.registrate.util.entry.ItemProviderEntry; import snownee.jade.addon.harvest.HarvestToolProvider; import snownee.jade.addon.harvest.SimpleToolHandler; -import snownee.jade.addon.universal.FluidStorageProvider; import snownee.jade.api.IWailaClientRegistration; import snownee.jade.api.IWailaCommonRegistration; import snownee.jade.api.IWailaPlugin; @@ -24,6 +20,7 @@ @WailaPlugin public class GTJadePlugin implements IWailaPlugin { + @Override public void register(IWailaCommonRegistration registration) { registration.registerBlockDataProvider(new ElectricContainerBlockProvider(), BlockEntity.class); @@ -46,8 +43,11 @@ public void registerClient(IWailaClientRegistration registration) { static { GTItems.TOOL_ITEMS.columnMap().forEach((type, map) -> { - if (type.harvestTags.isEmpty() || type.harvestTags.get(0).location().getNamespace().equals("minecraft")) return; - HarvestToolProvider.registerHandler(new SimpleToolHandler(type.name, type.harvestTags.get(0), map.values().stream().filter(Objects::nonNull).filter(ItemProviderEntry::isPresent).map(ItemProviderEntry::asItem).toArray(Item[]::new))); + if (type.harvestTags.isEmpty() || type.harvestTags.get(0).location().getNamespace().equals("minecraft")) + return; + HarvestToolProvider.registerHandler(new SimpleToolHandler(type.name, type.harvestTags.get(0), + map.values().stream().filter(Objects::nonNull).filter(ItemProviderEntry::isPresent) + .map(ItemProviderEntry::asItem).toArray(Item[]::new))); }); } } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/CapabilityBlockProvider.java b/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/CapabilityBlockProvider.java index 22f652e21e..d22d41778c 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/CapabilityBlockProvider.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/CapabilityBlockProvider.java @@ -1,7 +1,7 @@ package com.gregtechceu.gtceu.integration.jade.provider; import com.gregtechceu.gtceu.utils.GTUtil; -import lombok.Getter; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; @@ -9,15 +9,17 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; + +import lombok.Getter; +import org.jetbrains.annotations.Nullable; import snownee.jade.api.BlockAccessor; import snownee.jade.api.IBlockComponentProvider; import snownee.jade.api.IServerDataProvider; import snownee.jade.api.ITooltip; import snownee.jade.api.config.IPluginConfig; -import org.jetbrains.annotations.Nullable; - -public abstract class CapabilityBlockProvider implements IBlockComponentProvider, IServerDataProvider { +public abstract class CapabilityBlockProvider + implements IBlockComponentProvider, IServerDataProvider { @Getter public final ResourceLocation uid; @@ -31,7 +33,8 @@ protected CapabilityBlockProvider(ResourceLocation uid) { protected abstract void write(CompoundTag data, C capability); - protected abstract void addTooltip(CompoundTag capData, ITooltip tooltip, Player player, BlockAccessor block, BlockEntity blockEntity, IPluginConfig config); + protected abstract void addTooltip(CompoundTag capData, ITooltip tooltip, Player player, BlockAccessor block, + BlockEntity blockEntity, IPluginConfig config); protected boolean allowDisplaying(C capability) { return true; @@ -81,5 +84,4 @@ public void appendServerData(CompoundTag data, BlockAccessor blockAccessor) { protected float getProgress(long progress, long maxProgress) { return maxProgress == 0 ? 0 : (float) ((double) progress / maxProgress); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/ControllableBlockProvider.java b/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/ControllableBlockProvider.java index 4128a8b1d1..f933ffbef3 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/ControllableBlockProvider.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/ControllableBlockProvider.java @@ -3,6 +3,7 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.capability.GTCapabilityHelper; import com.gregtechceu.gtceu.api.capability.IControllable; + import net.minecraft.ChatFormatting; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -11,6 +12,7 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; + import org.jetbrains.annotations.Nullable; import snownee.jade.api.BlockAccessor; import snownee.jade.api.ITooltip; @@ -34,7 +36,8 @@ protected void write(CompoundTag data, IControllable capability) { } @Override - protected void addTooltip(CompoundTag capData, ITooltip tooltip, Player player, BlockAccessor block, BlockEntity blockEntity, IPluginConfig config) { + protected void addTooltip(CompoundTag capData, ITooltip tooltip, Player player, BlockAccessor block, + BlockEntity blockEntity, IPluginConfig config) { if (capData.contains("WorkingEnabled") && !capData.getBoolean("WorkingEnabled")) { tooltip.add(Component.translatable("gtceu.top.working_disabled").withStyle(ChatFormatting.YELLOW)); } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/ElectricContainerBlockProvider.java b/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/ElectricContainerBlockProvider.java index 8c82717f1b..121fc780f4 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/ElectricContainerBlockProvider.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/ElectricContainerBlockProvider.java @@ -3,6 +3,7 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.capability.GTCapabilityHelper; import com.gregtechceu.gtceu.api.capability.IEnergyContainer; + import net.minecraft.Util; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -11,6 +12,7 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; + import org.jetbrains.annotations.Nullable; import snownee.jade.api.BlockAccessor; import snownee.jade.api.ITooltip; @@ -36,7 +38,8 @@ protected void write(CompoundTag data, IEnergyContainer capability) { } @Override - protected void addTooltip(CompoundTag capData, ITooltip tooltip, Player player, BlockAccessor block, BlockEntity blockEntity, IPluginConfig config) { + protected void addTooltip(CompoundTag capData, ITooltip tooltip, Player player, BlockAccessor block, + BlockEntity blockEntity, IPluginConfig config) { long maxStorage = capData.getLong("MaxEnergy"); if (maxStorage == 0) return; // do not add empty max storage progress bar @@ -49,9 +52,7 @@ protected void addTooltip(CompoundTag capData, ITooltip tooltip, Player player, Component.translatable("gtceu.jade.energy_stored", stored, maxStorage), helper.progressStyle().color(0xFFEEE600, 0xFFEEE600).textColor(-1), Util.make(BoxStyle.DEFAULT, style -> style.borderColor = 0xFF555555), - true - ) - ); + true)); } @Override diff --git a/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/FluidPipeStorageProvider.java b/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/FluidPipeStorageProvider.java index cbee8204ef..3c9f4a6ad1 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/FluidPipeStorageProvider.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/FluidPipeStorageProvider.java @@ -1,13 +1,14 @@ package com.gregtechceu.gtceu.integration.jade.provider; import com.gregtechceu.gtceu.GTCEu; -import com.gregtechceu.gtceu.api.GTCEuAPI; import com.gregtechceu.gtceu.common.blockentity.FluidPipeBlockEntity; + import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; + import org.jetbrains.annotations.Nullable; import snownee.jade.api.Accessor; import snownee.jade.api.fluid.JadeFluidObject; @@ -16,13 +17,15 @@ import java.util.ArrayList; import java.util.List; -public enum FluidPipeStorageProvider implements IServerExtensionProvider, IClientExtensionProvider { +public enum FluidPipeStorageProvider implements IServerExtensionProvider, + IClientExtensionProvider { + INSTANCE; @Override public List> getClientGroups(Accessor accessor, List> groups) { return ClientViewGroup.map(groups, FluidView::readDefault, (group, clientGroup) -> { - if(group.id != null) { + if (group.id != null) { clientGroup.title = Component.literal(group.id); } clientGroup.bgColor = 0x55666666; @@ -30,10 +33,14 @@ public List> getClientGroups(Accessor accessor, Li } @Override - public @Nullable List> getGroups(ServerPlayer serverPlayer, ServerLevel serverLevel, FluidPipeBlockEntity pipe, boolean showDetails) { + public @Nullable List> getGroups(ServerPlayer serverPlayer, ServerLevel serverLevel, + FluidPipeBlockEntity pipe, boolean showDetails) { List> tanks = new ArrayList<>(); - for(var tank : pipe.getFluidTanks()) { - tanks.add(new ViewGroup<>(List.of(FluidView.writeDefault(JadeFluidObject.of(tank.getFluid().getFluid(), tank.getFluidAmount()), tank.getCapacity())))); + for (var tank : pipe.getFluidTanks()) { + if (tank.getFluidAmount() > 0) { + tanks.add(new ViewGroup<>(List.of(FluidView.writeDefault( + JadeFluidObject.of(tank.getFluid().getFluid(), tank.getFluidAmount()), tank.getCapacity())))); + } } return tanks; } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/RecipeLogicProvider.java b/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/RecipeLogicProvider.java index a87f246b39..85916115f0 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/RecipeLogicProvider.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/RecipeLogicProvider.java @@ -7,6 +7,7 @@ import com.gregtechceu.gtceu.api.recipe.RecipeHelper; import com.gregtechceu.gtceu.utils.FormattingUtil; import com.gregtechceu.gtceu.utils.GTUtil; + import net.minecraft.ChatFormatting; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -15,6 +16,7 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; + import org.jetbrains.annotations.Nullable; import snownee.jade.api.BlockAccessor; import snownee.jade.api.ITooltip; @@ -58,11 +60,12 @@ protected void write(CompoundTag data, RecipeLogic capability) { var machine = capability.machine; // TODO if(machine instanceof SteamMachine), display steam usage in L/t - // (could probably also be done clientside actually, since we have access to the BlockEntity there) + // (could probably also be done clientside actually, since we have access to the BlockEntity there) } @Override - protected void addTooltip(CompoundTag capData, ITooltip tooltip, Player player, BlockAccessor block, BlockEntity blockEntity, IPluginConfig config) { + protected void addTooltip(CompoundTag capData, ITooltip tooltip, Player player, BlockAccessor block, + BlockEntity blockEntity, IPluginConfig config) { if (capData.getBoolean("Working")) { var recipeInfo = capData.getCompound("Recipe"); if (!recipeInfo.isEmpty()) { @@ -71,12 +74,14 @@ protected void addTooltip(CompoundTag capData, ITooltip tooltip, Player player, long absEUt = Math.abs(EUt); - // Default behavior, if this TE is not a steam machine (or somehow not instanceof IGregTechTileEntity...) + // Default behavior, if this TE is not a steam machine (or somehow not instanceof + // IGregTechTileEntity...) var tier = GTUtil.getTierByVoltage(absEUt); Component text = Component.literal(FormattingUtil.formatNumbers(absEUt)).withStyle(ChatFormatting.RED) .append(Component.literal(" EU/t").withStyle(ChatFormatting.RESET) .append(Component.literal(" (").withStyle(ChatFormatting.GREEN) - .append(Component.literal(GTValues.VNF[tier]).withStyle(style -> style.withColor(GTValues.VC[tier]))) + .append(Component.literal(GTValues.VNF[tier]) + .withStyle(style -> style.withColor(GTValues.VC[tier]))) .append(Component.literal(")").withStyle(ChatFormatting.GREEN)))); if (EUt > 0) { diff --git a/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/WorkableBlockProvider.java b/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/WorkableBlockProvider.java index edba2fbf4c..8c7a890141 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/WorkableBlockProvider.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/WorkableBlockProvider.java @@ -5,6 +5,7 @@ import com.gregtechceu.gtceu.api.capability.IWorkable; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; import com.gregtechceu.gtceu.api.machine.feature.IRecipeLogicMachine; + import net.minecraft.Util; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -13,6 +14,7 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; + import org.jetbrains.annotations.Nullable; import snownee.jade.api.BlockAccessor; import snownee.jade.api.ITooltip; @@ -39,7 +41,8 @@ protected void write(CompoundTag data, IWorkable capability) { } @Override - protected void addTooltip(CompoundTag capData, ITooltip tooltip, Player player, BlockAccessor block, BlockEntity blockEntity, IPluginConfig config) { + protected void addTooltip(CompoundTag capData, ITooltip tooltip, Player player, BlockAccessor block, + BlockEntity blockEntity, IPluginConfig config) { if (!capData.getBoolean("Active")) return; int currentProgress = capData.getInt("Progress"); @@ -47,9 +50,9 @@ protected void addTooltip(CompoundTag capData, ITooltip tooltip, Player player, Component text; if (block.getBlockEntity() instanceof IMachineBlockEntity mbe && - mbe.getMetaMachine() instanceof IRecipeLogicMachine rlm && - rlm.getRecipeLogic().getLastRecipe() != null && - rlm.getRecipeLogic().getLastRecipe().data.getBoolean("duration_is_total_cwu")) { + mbe.getMetaMachine() instanceof IRecipeLogicMachine rlm && + rlm.getRecipeLogic().getLastRecipe() != null && + rlm.getRecipeLogic().getLastRecipe().data.getBoolean("duration_is_total_cwu")) { // show as total computation instead int color = rlm.getRecipeLogic().isWorkingEnabled() ? 0xFF00D4CE : 0xFFBB1C28; tooltip.add(tooltip.getElementHelper().progress( @@ -64,7 +67,8 @@ protected void addTooltip(CompoundTag capData, ITooltip tooltip, Player player, if (maxProgress < 20) { text = Component.translatable("gtceu.jade.progress_tick", currentProgress, maxProgress); } else { - text = Component.translatable("gtceu.jade.progress_sec", Math.round(currentProgress / 20.0F), Math.round(maxProgress / 20.0F)); + text = Component.translatable("gtceu.jade.progress_sec", Math.round(currentProgress / 20.0F), + Math.round(maxProgress / 20.0F)); } if (maxProgress > 0) { @@ -75,9 +79,7 @@ protected void addTooltip(CompoundTag capData, ITooltip tooltip, Player player, text, tooltip.getElementHelper().progressStyle().color(color).textColor(-1), Util.make(BoxStyle.DEFAULT, style -> style.borderColor = 0xFF555555), - true - ) - ); + true)); } } } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/jei/GTJEIPlugin.java b/src/main/java/com/gregtechceu/gtceu/integration/jei/GTJEIPlugin.java index f8ce3e2798..a3c471c589 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/jei/GTJEIPlugin.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/jei/GTJEIPlugin.java @@ -4,12 +4,20 @@ import com.gregtechceu.gtceu.api.machine.MachineDefinition; import com.gregtechceu.gtceu.api.recipe.GTRecipeType; import com.gregtechceu.gtceu.common.data.GTMachines; +import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.integration.jei.multipage.MultiblockInfoCategory; import com.gregtechceu.gtceu.integration.jei.oreprocessing.GTOreProcessingInfoCategory; import com.gregtechceu.gtceu.integration.jei.orevein.GTBedrockFluidInfoCategory; import com.gregtechceu.gtceu.integration.jei.orevein.GTOreVeinInfoCategory; import com.gregtechceu.gtceu.integration.jei.recipe.GTRecipeTypeCategory; + import com.lowdragmc.lowdraglib.LDLib; + +import net.minecraft.MethodsReturnNonnullByDefault; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.crafting.RecipeType; + import mezz.jei.api.IModPlugin; import mezz.jei.api.JeiPlugin; import mezz.jei.api.constants.RecipeTypes; @@ -18,12 +26,8 @@ import mezz.jei.api.registration.IRecipeCatalystRegistration; import mezz.jei.api.registration.IRecipeCategoryRegistration; import mezz.jei.api.registration.IRecipeRegistration; -import net.minecraft.MethodsReturnNonnullByDefault; -import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.item.crafting.RecipeType; - import org.jetbrains.annotations.NotNull; + import javax.annotation.ParametersAreNonnullByDefault; /** @@ -35,6 +39,7 @@ @ParametersAreNonnullByDefault @JeiPlugin public class GTJEIPlugin implements IModPlugin { + @Override public ResourceLocation getPluginUid() { return GTCEu.id("jei_plugin"); @@ -46,7 +51,8 @@ public void registerCategories(@NotNull IRecipeCategoryRegistration registry) { GTCEu.LOGGER.info("JEI register categories"); IJeiHelpers jeiHelpers = registry.getJeiHelpers(); registry.addRecipeCategories(new MultiblockInfoCategory(jeiHelpers)); - registry.addRecipeCategories(new GTOreProcessingInfoCategory(jeiHelpers)); + if (!ConfigHolder.INSTANCE.compat.hideOreProcessingDiagrams) + registry.addRecipeCategories(new GTOreProcessingInfoCategory(jeiHelpers)); registry.addRecipeCategories(new GTOreVeinInfoCategory(jeiHelpers)); registry.addRecipeCategories(new GTBedrockFluidInfoCategory(jeiHelpers)); for (RecipeType recipeType : BuiltInRegistries.RECIPE_TYPE) { @@ -61,7 +67,8 @@ public void registerRecipeCatalysts(@NotNull IRecipeCatalystRegistration registr if (LDLib.isReiLoaded() || LDLib.isEmiLoaded()) return; MultiblockInfoCategory.registerRecipeCatalysts(registration); GTRecipeTypeCategory.registerRecipeCatalysts(registration); - GTOreProcessingInfoCategory.registerRecipeCatalysts(registration); + if (!ConfigHolder.INSTANCE.compat.hideOreProcessingDiagrams) + GTOreProcessingInfoCategory.registerRecipeCatalysts(registration); GTOreVeinInfoCategory.registerRecipeCatalysts(registration); GTBedrockFluidInfoCategory.registerRecipeCatalysts(registration); for (MachineDefinition definition : GTMachines.ELECTRIC_FURNACE) { @@ -81,7 +88,8 @@ public void registerRecipes(@NotNull IRecipeRegistration registration) { GTCEu.LOGGER.info("JEI register"); MultiblockInfoCategory.registerRecipes(registration); GTRecipeTypeCategory.registerRecipes(registration); - GTOreProcessingInfoCategory.registerRecipes(registration); + if (!ConfigHolder.INSTANCE.compat.hideOreProcessingDiagrams) + GTOreProcessingInfoCategory.registerRecipes(registration); GTOreVeinInfoCategory.registerRecipes(registration); GTBedrockFluidInfoCategory.registerRecipes(registration); } @@ -92,4 +100,3 @@ public void registerIngredients(@NotNull IModIngredientRegistration registry) { GTCEu.LOGGER.info("JEI register ingredients"); } } - diff --git a/src/main/java/com/gregtechceu/gtceu/integration/jei/multipage/MultiblockInfoCategory.java b/src/main/java/com/gregtechceu/gtceu/integration/jei/multipage/MultiblockInfoCategory.java index 187798f01f..079fbe158e 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/jei/multipage/MultiblockInfoCategory.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/jei/multipage/MultiblockInfoCategory.java @@ -4,19 +4,23 @@ import com.gregtechceu.gtceu.api.machine.MultiblockMachineDefinition; import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.common.data.GTMachines; + import com.lowdragmc.lowdraglib.jei.ModularUIRecipeCategory; + +import net.minecraft.network.chat.Component; + import mezz.jei.api.gui.drawable.IDrawable; import mezz.jei.api.helpers.IGuiHelper; import mezz.jei.api.helpers.IJeiHelpers; import mezz.jei.api.recipe.RecipeType; import mezz.jei.api.registration.IRecipeCatalystRegistration; import mezz.jei.api.registration.IRecipeRegistration; -import net.minecraft.network.chat.Component; - import org.jetbrains.annotations.NotNull; public class MultiblockInfoCategory extends ModularUIRecipeCategory { - public final static RecipeType RECIPE_TYPE = new RecipeType<>(GTCEu.id("multiblock_info"), MultiblockInfoWrapper.class); + + public final static RecipeType RECIPE_TYPE = new RecipeType<>(GTCEu.id("multiblock_info"), + MultiblockInfoWrapper.class); private final IDrawable background; private final IDrawable icon; @@ -42,7 +46,6 @@ public static void registerRecipeCatalysts(IRecipeCatalystRegistration registrat } } - @Override @NotNull public RecipeType getRecipeType() { @@ -66,5 +69,4 @@ public IDrawable getBackground() { public IDrawable getIcon() { return icon; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/jei/multipage/MultiblockInfoWrapper.java b/src/main/java/com/gregtechceu/gtceu/integration/jei/multipage/MultiblockInfoWrapper.java index 32316cb75b..74dfc3de59 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/jei/multipage/MultiblockInfoWrapper.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/jei/multipage/MultiblockInfoWrapper.java @@ -1,15 +1,16 @@ package com.gregtechceu.gtceu.integration.jei.multipage; -import com.gregtechceu.gtceu.api.machine.MultiblockMachineDefinition; import com.gregtechceu.gtceu.api.gui.widget.PatternPreviewWidget; +import com.gregtechceu.gtceu.api.machine.MultiblockMachineDefinition; + import com.lowdragmc.lowdraglib.jei.ModularWrapper; public class MultiblockInfoWrapper extends ModularWrapper { + public final MultiblockMachineDefinition definition; public MultiblockInfoWrapper(MultiblockMachineDefinition definition) { super(PatternPreviewWidget.getPatternWidget(definition)); this.definition = definition; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/jei/oreprocessing/GTOreProcessingInfoCategory.java b/src/main/java/com/gregtechceu/gtceu/integration/jei/oreprocessing/GTOreProcessingInfoCategory.java index 51127f7edd..85d2a0de49 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/jei/oreprocessing/GTOreProcessingInfoCategory.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/jei/oreprocessing/GTOreProcessingInfoCategory.java @@ -5,16 +5,17 @@ import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.data.chemical.ChemicalHelper; import com.gregtechceu.gtceu.api.data.chemical.material.properties.PropertyKey; -import com.gregtechceu.gtceu.api.registry.GTRegistries; + import com.lowdragmc.lowdraglib.jei.ModularUIRecipeCategory; + +import net.minecraft.network.chat.Component; + import mezz.jei.api.gui.drawable.IDrawable; import mezz.jei.api.helpers.IGuiHelper; import mezz.jei.api.helpers.IJeiHelpers; import mezz.jei.api.recipe.RecipeType; import mezz.jei.api.registration.IRecipeCatalystRegistration; import mezz.jei.api.registration.IRecipeRegistration; -import net.minecraft.network.chat.Component; - import org.jetbrains.annotations.NotNull; import static com.gregtechceu.gtceu.api.data.tag.TagPrefix.ore; @@ -22,14 +23,16 @@ import static com.gregtechceu.gtceu.common.data.GTMaterials.Iron; public class GTOreProcessingInfoCategory extends ModularUIRecipeCategory { - public final static RecipeType RECIPE_TYPE = new RecipeType<>(GTCEu.id("ore_processing_diagram"), GTOreProcessingInfoWrapper.class); + + public final static RecipeType RECIPE_TYPE = new RecipeType<>( + GTCEu.id("ore_processing_diagram"), GTOreProcessingInfoWrapper.class); private final IDrawable background; private final IDrawable icon; public GTOreProcessingInfoCategory(IJeiHelpers helpers) { IGuiHelper guiHelper = helpers.getGuiHelper(); this.background = guiHelper.createBlankDrawable(186, 174); - this.icon = helpers.getGuiHelper().createDrawableItemStack(ChemicalHelper.get(ore,Iron)); + this.icon = helpers.getGuiHelper().createDrawableItemStack(ChemicalHelper.get(ore, Iron)); } public static void registerRecipes(IRecipeRegistration registry) { @@ -72,5 +75,4 @@ public IDrawable getBackground() { public IDrawable getIcon() { return icon; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/jei/oreprocessing/GTOreProcessingInfoWrapper.java b/src/main/java/com/gregtechceu/gtceu/integration/jei/oreprocessing/GTOreProcessingInfoWrapper.java index 881ad66a64..329c3a247f 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/jei/oreprocessing/GTOreProcessingInfoWrapper.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/jei/oreprocessing/GTOreProcessingInfoWrapper.java @@ -2,14 +2,15 @@ import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.integration.GTOreByProductWidget; + import com.lowdragmc.lowdraglib.jei.ModularWrapper; public class GTOreProcessingInfoWrapper extends ModularWrapper { + public final Material material; public GTOreProcessingInfoWrapper(Material mat) { super(new GTOreByProductWidget(mat)); this.material = mat; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/jei/orevein/GTBedrockFluidInfoCategory.java b/src/main/java/com/gregtechceu/gtceu/integration/jei/orevein/GTBedrockFluidInfoCategory.java index 66abda9260..80654d4798 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/jei/orevein/GTBedrockFluidInfoCategory.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/jei/orevein/GTBedrockFluidInfoCategory.java @@ -5,26 +5,31 @@ import com.gregtechceu.gtceu.common.data.GTItems; import com.gregtechceu.gtceu.common.data.GTMaterials; import com.gregtechceu.gtceu.integration.GTOreVeinWidget; + import com.lowdragmc.lowdraglib.jei.ModularUIRecipeCategory; + +import net.minecraft.network.chat.Component; + import mezz.jei.api.gui.drawable.IDrawable; import mezz.jei.api.helpers.IGuiHelper; import mezz.jei.api.helpers.IJeiHelpers; import mezz.jei.api.recipe.RecipeType; import mezz.jei.api.registration.IRecipeCatalystRegistration; import mezz.jei.api.registration.IRecipeRegistration; -import net.minecraft.network.chat.Component; - import org.jetbrains.annotations.NotNull; public class GTBedrockFluidInfoCategory extends ModularUIRecipeCategory { - public final static RecipeType Recipe_Type = new RecipeType<>(GTCEu.id("bedrock_fluid_diagram"), GTBedrockFluidInfoWrapper.class); + + public final static RecipeType Recipe_Type = new RecipeType<>( + GTCEu.id("bedrock_fluid_diagram"), GTBedrockFluidInfoWrapper.class); private final IDrawable background; private final IDrawable icon; public GTBedrockFluidInfoCategory(IJeiHelpers helpers) { IGuiHelper guiHelper = helpers.getGuiHelper(); this.background = guiHelper.createBlankDrawable(GTOreVeinWidget.width, 120); - this.icon = helpers.getGuiHelper().createDrawableItemStack(GTMaterials.Oil.getFluid().getBucket().asItem().getDefaultInstance()); + this.icon = helpers.getGuiHelper() + .createDrawableItemStack(GTMaterials.Oil.getFluid().getBucket().asItem().getDefaultInstance()); } public static void registerRecipes(IRecipeRegistration registry) { diff --git a/src/main/java/com/gregtechceu/gtceu/integration/jei/orevein/GTBedrockFluidInfoWrapper.java b/src/main/java/com/gregtechceu/gtceu/integration/jei/orevein/GTBedrockFluidInfoWrapper.java index 9a71c39eab..23f8ea6a42 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/jei/orevein/GTBedrockFluidInfoWrapper.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/jei/orevein/GTBedrockFluidInfoWrapper.java @@ -2,9 +2,11 @@ import com.gregtechceu.gtceu.api.data.worldgen.bedrockfluid.BedrockFluidDefinition; import com.gregtechceu.gtceu.integration.GTOreVeinWidget; + import com.lowdragmc.lowdraglib.jei.ModularWrapper; public class GTBedrockFluidInfoWrapper extends ModularWrapper { + public final BedrockFluidDefinition fluid; public GTBedrockFluidInfoWrapper(BedrockFluidDefinition fluid) { diff --git a/src/main/java/com/gregtechceu/gtceu/integration/jei/orevein/GTOreVeinInfoCategory.java b/src/main/java/com/gregtechceu/gtceu/integration/jei/orevein/GTOreVeinInfoCategory.java index 2b2a2077e1..f133ebab74 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/jei/orevein/GTOreVeinInfoCategory.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/jei/orevein/GTOreVeinInfoCategory.java @@ -7,26 +7,31 @@ import com.gregtechceu.gtceu.common.data.GTItems; import com.gregtechceu.gtceu.common.data.GTMaterials; import com.gregtechceu.gtceu.integration.GTOreVeinWidget; + import com.lowdragmc.lowdraglib.jei.ModularUIRecipeCategory; + +import net.minecraft.network.chat.Component; + import mezz.jei.api.gui.drawable.IDrawable; import mezz.jei.api.helpers.IGuiHelper; import mezz.jei.api.helpers.IJeiHelpers; import mezz.jei.api.recipe.RecipeType; import mezz.jei.api.registration.IRecipeCatalystRegistration; import mezz.jei.api.registration.IRecipeRegistration; -import net.minecraft.network.chat.Component; - import org.jetbrains.annotations.NotNull; public class GTOreVeinInfoCategory extends ModularUIRecipeCategory { - public final static RecipeType Recipe_Type = new RecipeType<>(GTCEu.id("ore_vein_diagram"), GTOreVeinInfoWrapper.class); + + public final static RecipeType Recipe_Type = new RecipeType<>(GTCEu.id("ore_vein_diagram"), + GTOreVeinInfoWrapper.class); private final IDrawable background; private final IDrawable icon; public GTOreVeinInfoCategory(IJeiHelpers helpers) { IGuiHelper guiHelper = helpers.getGuiHelper(); this.background = guiHelper.createBlankDrawable(GTOreVeinWidget.width, 120); - this.icon = helpers.getGuiHelper().createDrawableItemStack(ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Iron)); + this.icon = helpers.getGuiHelper() + .createDrawableItemStack(ChemicalHelper.get(TagPrefix.ingot, GTMaterials.Iron)); } public static void registerRecipes(IRecipeRegistration registry) { diff --git a/src/main/java/com/gregtechceu/gtceu/integration/jei/orevein/GTOreVeinInfoWrapper.java b/src/main/java/com/gregtechceu/gtceu/integration/jei/orevein/GTOreVeinInfoWrapper.java index b3df70ab56..01734ed98b 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/jei/orevein/GTOreVeinInfoWrapper.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/jei/orevein/GTOreVeinInfoWrapper.java @@ -2,9 +2,11 @@ import com.gregtechceu.gtceu.api.data.worldgen.GTOreDefinition; import com.gregtechceu.gtceu.integration.GTOreVeinWidget; + import com.lowdragmc.lowdraglib.jei.ModularWrapper; public class GTOreVeinInfoWrapper extends ModularWrapper { + public final GTOreDefinition oreDefinition; public GTOreVeinInfoWrapper(GTOreDefinition oreDefinition) { diff --git a/src/main/java/com/gregtechceu/gtceu/integration/jei/recipe/GTRecipeTypeCategory.java b/src/main/java/com/gregtechceu/gtceu/integration/jei/recipe/GTRecipeTypeCategory.java index 48ac9ca7d7..b3ba62fe8f 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/jei/recipe/GTRecipeTypeCategory.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/jei/recipe/GTRecipeTypeCategory.java @@ -4,7 +4,16 @@ import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.GTRecipeType; import com.gregtechceu.gtceu.api.registry.GTRegistries; + import com.lowdragmc.lowdraglib.jei.ModularUIRecipeCategory; + +import net.minecraft.Util; +import net.minecraft.client.Minecraft; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.Items; + import lombok.Getter; import mezz.jei.api.gui.drawable.IDrawable; import mezz.jei.api.helpers.IGuiHelper; @@ -12,22 +21,17 @@ import mezz.jei.api.recipe.RecipeType; import mezz.jei.api.registration.IRecipeCatalystRegistration; import mezz.jei.api.registration.IRecipeRegistration; -import net.minecraft.Util; -import net.minecraft.client.Minecraft; -import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.network.chat.Component; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.item.Items; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.jetbrains.annotations.NotNull; import java.util.List; import java.util.function.Function; import java.util.stream.Collectors; public class GTRecipeTypeCategory extends ModularUIRecipeCategory { - public static final Function> TYPES = Util.memoize(recipeMap -> new RecipeType<>(recipeMap.registryName, GTRecipeWrapper.class)); + + public static final Function> TYPES = Util + .memoize(recipeMap -> new RecipeType<>(recipeMap.registryName, GTRecipeWrapper.class)); private final GTRecipeType recipeType; @Getter @@ -64,18 +68,18 @@ public static void registerRecipes(IRecipeRegistration registration) { if (recipeType instanceof GTRecipeType gtRecipeType) { if (gtRecipeType.getRecipeUI().isJEIVisible()) { registration.addRecipes(GTRecipeTypeCategory.TYPES.apply(gtRecipeType), - Minecraft.getInstance().getConnection().getRecipeManager().getAllRecipesFor(gtRecipeType) - .stream() - .map(GTRecipeWrapper::new) - .collect(Collectors.toList())); + Minecraft.getInstance().getConnection().getRecipeManager().getAllRecipesFor(gtRecipeType) + .stream() + .map(GTRecipeWrapper::new) + .collect(Collectors.toList())); if (gtRecipeType.isScanner()) { List scannerRecipes = gtRecipeType.getRepresentativeRecipes(); if (!scannerRecipes.isEmpty()) { registration.addRecipes(GTRecipeTypeCategory.TYPES.apply(gtRecipeType), - scannerRecipes.stream() - .map(GTRecipeWrapper::new) - .collect(Collectors.toList())); + scannerRecipes.stream() + .map(GTRecipeWrapper::new) + .collect(Collectors.toList())); } } } @@ -87,9 +91,10 @@ public static void registerRecipeCatalysts(IRecipeCatalystRegistration registrat for (GTRecipeType gtRecipeType : GTRegistries.RECIPE_TYPES) { for (MachineDefinition machine : GTRegistries.MACHINES) { if (machine.getRecipeTypes() != null) { - for (GTRecipeType type : machine.getRecipeTypes()){ + for (GTRecipeType type : machine.getRecipeTypes()) { if (type == gtRecipeType) { - registration.addRecipeCatalyst(machine.asStack(), GTRecipeTypeCategory.TYPES.apply(gtRecipeType)); + registration.addRecipeCatalyst(machine.asStack(), + GTRecipeTypeCategory.TYPES.apply(gtRecipeType)); } } } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/jei/recipe/GTRecipeWrapper.java b/src/main/java/com/gregtechceu/gtceu/integration/jei/recipe/GTRecipeWrapper.java index 0ccac833b0..6549223149 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/jei/recipe/GTRecipeWrapper.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/jei/recipe/GTRecipeWrapper.java @@ -2,6 +2,7 @@ import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.integration.GTRecipeWidget; + import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.jei.ModularWrapper; @@ -13,5 +14,4 @@ public GTRecipeWrapper(GTRecipe recipe) { super(new GTRecipeWidget(recipe)); this.recipe = recipe; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/GTCEuServerEvents.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/GTCEuServerEvents.java index 4fd8b8d4d3..5e4823c2dc 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/GTCEuServerEvents.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/GTCEuServerEvents.java @@ -3,10 +3,12 @@ import com.gregtechceu.gtceu.integration.kjs.events.GTBedrockOreVeinEventJS; import com.gregtechceu.gtceu.integration.kjs.events.GTFluidVeinEventJS; import com.gregtechceu.gtceu.integration.kjs.events.GTOreVeinEventJS; + import dev.latvian.mods.kubejs.event.EventGroup; import dev.latvian.mods.kubejs.event.EventHandler; public interface GTCEuServerEvents { + EventGroup GROUP = EventGroup.of("GTCEuServerEvents"); EventHandler ORE_VEIN_MODIFICATION = GROUP.server("oreVeins", () -> GTOreVeinEventJS.class); diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/GTCEuStartupEvents.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/GTCEuStartupEvents.java index 89b7f9f629..e0b9f87a7a 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/GTCEuStartupEvents.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/GTCEuStartupEvents.java @@ -1,18 +1,20 @@ package com.gregtechceu.gtceu.integration.kjs; import com.gregtechceu.gtceu.GTCEu; -import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.api.registry.GTRegistry; import com.gregtechceu.gtceu.integration.kjs.events.GTRegistryEventJS; import com.gregtechceu.gtceu.integration.kjs.events.MaterialModificationEventJS; + import dev.latvian.mods.kubejs.event.EventGroup; import dev.latvian.mods.kubejs.event.EventHandler; import dev.latvian.mods.kubejs.event.Extra; public interface GTCEuStartupEvents { + EventGroup GROUP = EventGroup.of("GTCEuStartupEvents"); Extra REGISTRY_EXTRA = Extra.REQUIRES_STRING.copy().validator(GTCEuStartupEvents::validateRegistry); + private static boolean validateRegistry(Object o) { try { var id = GTCEu.appendId(o.toString()); @@ -24,5 +26,4 @@ private static boolean validateRegistry(Object o) { EventHandler REGISTRY = GROUP.startup("registry", () -> GTRegistryEventJS.class).extra(REGISTRY_EXTRA); EventHandler MATERIAL_MODIFICATION = GROUP.startup("materialModification", () -> MaterialModificationEventJS.class); - -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/GTRegistryInfo.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/GTRegistryInfo.java index 3cf0131d9f..2d262f81e7 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/GTRegistryInfo.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/GTRegistryInfo.java @@ -1,12 +1,10 @@ package com.gregtechceu.gtceu.integration.kjs; import com.gregtechceu.gtceu.GTCEu; -import com.gregtechceu.gtceu.api.GTCEuAPI; import com.gregtechceu.gtceu.api.data.chemical.Element; import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.api.data.chemical.material.info.MaterialIconSet; import com.gregtechceu.gtceu.api.data.chemical.material.info.MaterialIconType; -import com.gregtechceu.gtceu.api.data.chemical.material.registry.MaterialRegistry; import com.gregtechceu.gtceu.api.data.tag.TagPrefix; import com.gregtechceu.gtceu.api.data.worldgen.IWorldGenLayer; import com.gregtechceu.gtceu.api.data.worldgen.SimpleWorldGenLayer; @@ -19,22 +17,27 @@ import com.gregtechceu.gtceu.common.unification.material.MaterialRegistryManager; import com.gregtechceu.gtceu.integration.kjs.built.KJSTagPrefix; import com.gregtechceu.gtceu.integration.kjs.events.GTRegistryEventJS; + +import net.minecraft.resources.ResourceLocation; + import dev.latvian.mods.kubejs.DevProperties; -import dev.latvian.mods.kubejs.KubeJS; import dev.latvian.mods.kubejs.script.ScriptType; import dev.latvian.mods.kubejs.util.ConsoleJS; import dev.latvian.mods.kubejs.util.UtilsJS; -import net.minecraft.resources.ResourceLocation; import java.util.*; import java.util.function.Supplier; public class GTRegistryInfo { + @FunctionalInterface public interface BuilderFactory { + BuilderBase createBuilder(ResourceLocation id, Object... args); } - public record BuilderType(String type, Class> builderClass, BuilderFactory factory) { } + + public record BuilderType(String type, Class> builderClass, + BuilderFactory factory) {} public static final Map> MAP = new LinkedHashMap<>(); public static final Set EXTRA_IDS = new HashSet<>(); @@ -43,16 +46,28 @@ public record BuilderType(String type, Class> ALL_BUILDERS = new ArrayList<>(); public static final GTRegistryInfo ELEMENT = add(GTRegistries.ELEMENTS, Element.class); - public static final GTRegistryInfo MATERIAL = add(MaterialRegistryManager.getInstance().getRegistry(GTCEu.MOD_ID), Material.class); - public static final GTRegistryInfo RECIPE_TYPE = add(GTRegistries.RECIPE_TYPES, GTRecipeType.class); - public static final GTRegistryInfo MACHINE = add(GTRegistries.MACHINES, MachineDefinition.class); - public static final GTRegistryInfo MATERIAL_ICON_SET = add(GTCEu.id("material_icon_set"), () -> MaterialIconSet.ICON_SETS, MaterialIconSet.class); - public static final GTRegistryInfo MATERIAL_ICON_TYPE = add(GTCEu.id("material_icon_type"), () -> MaterialIconType.ICON_TYPES, MaterialIconType.class); - public static final GTRegistryInfo WORLD_GEN_LAYER = add(GTCEu.id("world_gen_layer"), () -> WorldGeneratorUtils.WORLD_GEN_LAYERS, SimpleWorldGenLayer.class); - public static final GTRegistryInfo TAG_PREFIX = add(GTCEu.id("tag_prefix"), () -> TagPrefix.PREFIXES, KJSTagPrefix.class); - /*public static final GTRegistryInfo> RECIPE_CAPABILITY = add(GTRegistries.RECIPE_CAPABILITIES, RecipeCapability.class); - public static final GTRegistryInfo> RECIPE_CONDITION = add(GTRegistries.RECIPE_CONDITIONS, RecipeCondition.class); - public static final GTRegistryInfo SOUND = add(GTRegistries.SOUNDS, SoundEntry.class);*/ + public static final GTRegistryInfo MATERIAL = add( + MaterialRegistryManager.getInstance().getRegistry(GTCEu.MOD_ID), Material.class); + public static final GTRegistryInfo RECIPE_TYPE = add(GTRegistries.RECIPE_TYPES, + GTRecipeType.class); + public static final GTRegistryInfo MACHINE = add(GTRegistries.MACHINES, + MachineDefinition.class); + public static final GTRegistryInfo MATERIAL_ICON_SET = add(GTCEu.id("material_icon_set"), + () -> MaterialIconSet.ICON_SETS, MaterialIconSet.class); + public static final GTRegistryInfo MATERIAL_ICON_TYPE = add( + GTCEu.id("material_icon_type"), () -> MaterialIconType.ICON_TYPES, MaterialIconType.class); + public static final GTRegistryInfo WORLD_GEN_LAYER = add(GTCEu.id("world_gen_layer"), + () -> WorldGeneratorUtils.WORLD_GEN_LAYERS, SimpleWorldGenLayer.class); + public static final GTRegistryInfo TAG_PREFIX = add(GTCEu.id("tag_prefix"), + () -> TagPrefix.PREFIXES, KJSTagPrefix.class); + /* + * public static final GTRegistryInfo> RECIPE_CAPABILITY = + * add(GTRegistries.RECIPE_CAPABILITIES, RecipeCapability.class); + * public static final GTRegistryInfo> RECIPE_CONDITION = + * add(GTRegistries.RECIPE_CONDITIONS, RecipeCondition.class); + * public static final GTRegistryInfo SOUND = add(GTRegistries.SOUNDS, + * SoundEntry.class); + */ public final ResourceLocation registryKey; public final Class objectBaseClass; @@ -71,7 +86,6 @@ private GTRegistryInfo(ResourceLocation key, Supplier> registryValues, current = null; } - public static GTRegistryInfo add(GTRegistry key, Class baseClass) { ResourceLocation id = key.getRegistryName(); var types = new GTRegistryInfo<>(id, key::registry, UtilsJS.cast(baseClass)); @@ -85,7 +99,8 @@ public static GTRegistryInfo add(GTRegistry key, Class bas return types; } - public static GTRegistryInfo add(ResourceLocation id, Supplier> registryValues, Class baseClass) { + public static GTRegistryInfo add(ResourceLocation id, Supplier> registryValues, + Class baseClass) { var types = new GTRegistryInfo<>(id, registryValues, UtilsJS.cast(baseClass)); if (MAP.put(id, types) != null || !EXTRA_IDS.add(id)) { @@ -97,13 +112,15 @@ public static GTRegistryInfo add(ResourceLocation id, Supplier> builderType, BuilderFactory factory, boolean isDefault) { + public void addType(String type, Class> builderType, BuilderFactory factory, + boolean isDefault) { var b = new BuilderType<>(type, builderType, factory); types.put(type, b); if (isDefault) { if (defaultType != null) { - ConsoleJS.STARTUP.warn("Previous default type '" + defaultType.type + "' for registry '" + registryKey + "' replaced with '" + type + "'!"); + ConsoleJS.STARTUP.warn("Previous default type '" + defaultType.type + "' for registry '" + registryKey + + "' replaced with '" + type + "'!"); } defaultType = b; diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/GregTechKubeJSPlugin.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/GregTechKubeJSPlugin.java index 99d97d334a..d672103a44 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/GregTechKubeJSPlugin.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/GregTechKubeJSPlugin.java @@ -11,6 +11,7 @@ import com.gregtechceu.gtceu.api.data.chemical.material.info.MaterialFlags; import com.gregtechceu.gtceu.api.data.chemical.material.info.MaterialIconSet; import com.gregtechceu.gtceu.api.data.chemical.material.info.MaterialIconType; +import com.gregtechceu.gtceu.api.data.chemical.material.properties.HazardProperty; import com.gregtechceu.gtceu.api.data.chemical.material.properties.PropertyKey; import com.gregtechceu.gtceu.api.data.chemical.material.properties.ToolProperty; import com.gregtechceu.gtceu.api.data.chemical.material.stack.MaterialStack; @@ -39,9 +40,9 @@ import com.gregtechceu.gtceu.api.recipe.OverclockingLogic; import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.common.data.*; +import com.gregtechceu.gtceu.common.data.machines.GCyMMachines; import com.gregtechceu.gtceu.common.unification.material.MaterialRegistryManager; import com.gregtechceu.gtceu.data.recipe.builder.GTRecipeBuilder; -import com.gregtechceu.gtceu.common.data.machines.GCyMMachines; import com.gregtechceu.gtceu.integration.kjs.builders.*; import com.gregtechceu.gtceu.integration.kjs.builders.block.CoilBlockBuilder; import com.gregtechceu.gtceu.integration.kjs.builders.block.RendererBlockBuilder; @@ -52,6 +53,16 @@ import com.gregtechceu.gtceu.integration.kjs.helpers.MaterialStackWrapper; import com.gregtechceu.gtceu.integration.kjs.recipe.GTRecipeSchema; import com.gregtechceu.gtceu.integration.kjs.recipe.components.GTRecipeComponents; + +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.nbt.NbtOps; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.crafting.Recipe; +import net.minecraft.world.item.crafting.RecipeManager; +import net.minecraft.world.item.crafting.RecipeType; +import net.minecraft.world.level.block.SoundType; +import net.minecraft.world.level.levelgen.placement.HeightRangePlacement; + import com.mojang.serialization.DataResult; import dev.latvian.mods.kubejs.KubeJSPlugin; import dev.latvian.mods.kubejs.block.state.BlockStatePredicate; @@ -65,14 +76,6 @@ import dev.latvian.mods.rhino.Wrapper; import dev.latvian.mods.rhino.mod.util.NBTUtils; import dev.latvian.mods.rhino.util.wrap.TypeWrappers; -import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.nbt.NbtOps; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.item.crafting.Recipe; -import net.minecraft.world.item.crafting.RecipeManager; -import net.minecraft.world.item.crafting.RecipeType; -import net.minecraft.world.level.block.SoundType; -import net.minecraft.world.level.levelgen.placement.HeightRangePlacement; import java.util.*; import java.util.Map; @@ -96,20 +99,29 @@ public void init() { super.init(); GTRegistryInfo.ELEMENT.addType("basic", ElementBuilder.class, ElementBuilder::new, true); - GTRegistryInfo.MATERIAL_ICON_SET.addType("basic", MaterialIconSetBuilder.class, MaterialIconSetBuilder::new, true); - GTRegistryInfo.MATERIAL_ICON_TYPE.addType("basic", MaterialIconTypeBuilder.class, MaterialIconTypeBuilder::new, true); + GTRegistryInfo.MATERIAL_ICON_SET.addType("basic", MaterialIconSetBuilder.class, MaterialIconSetBuilder::new, + true); + GTRegistryInfo.MATERIAL_ICON_TYPE.addType("basic", MaterialIconTypeBuilder.class, MaterialIconTypeBuilder::new, + true); GTRegistryInfo.MATERIAL.addType("basic", Material.Builder.class, Material.Builder::new, true); GTRegistryInfo.RECIPE_TYPE.addType("basic", GTRecipeTypeBuilder.class, GTRecipeTypeBuilder::new, true); - GTRegistryInfo.MACHINE.addType("simple", SimpleMachineBuilder.class, (id, args) -> SimpleMachineBuilder.create(id.getPath(), args), true); - GTRegistryInfo.MACHINE.addType("custom", CustomTieredMachineBuilder.class, (id, args) -> CustomTieredMachineBuilder.createAll(id.getPath(), args), false); - GTRegistryInfo.MACHINE.addType("steam", SteamMachineBuilder.class, (id, args) -> SteamMachineBuilder.createBoth(id.getPath(), args), false); - GTRegistryInfo.MACHINE.addType("generator", GeneratorBuilder.class, (id, args) -> GeneratorBuilder.createAll(id.getPath(), args), false); - GTRegistryInfo.MACHINE.addType("multiblock", CustomMultiblockBuilder.class, (id, args) -> CustomMultiblockBuilder.createMultiblock(id.getPath(), args), false); - GTRegistryInfo.MACHINE.addType("primitive", CustomMultiblockBuilder.class, (id, args) -> CustomMultiblockBuilder.createPrimitiveMultiblock(id.getPath(), args), false); - GTRegistryInfo.MACHINE.addType("kinetic", KineticMachineBuilder.class, (id, args) -> KineticMachineBuilder.createAll(id.getPath(), args), false); + GTRegistryInfo.MACHINE.addType("simple", SimpleMachineBuilder.class, + (id, args) -> SimpleMachineBuilder.create(id.getPath(), args), true); + GTRegistryInfo.MACHINE.addType("custom", CustomTieredMachineBuilder.class, + (id, args) -> CustomTieredMachineBuilder.createAll(id.getPath(), args), false); + GTRegistryInfo.MACHINE.addType("steam", SteamMachineBuilder.class, + (id, args) -> SteamMachineBuilder.createBoth(id.getPath(), args), false); + GTRegistryInfo.MACHINE.addType("generator", GeneratorBuilder.class, + (id, args) -> GeneratorBuilder.createAll(id.getPath(), args), false); + GTRegistryInfo.MACHINE.addType("multiblock", CustomMultiblockBuilder.class, + (id, args) -> CustomMultiblockBuilder.createMultiblock(id.getPath(), args), false); + GTRegistryInfo.MACHINE.addType("primitive", CustomMultiblockBuilder.class, + (id, args) -> CustomMultiblockBuilder.createPrimitiveMultiblock(id.getPath(), args), false); + GTRegistryInfo.MACHINE.addType("kinetic", KineticMachineBuilder.class, + (id, args) -> KineticMachineBuilder.createAll(id.getPath(), args), false); GTRegistryInfo.WORLD_GEN_LAYER.addType("basic", WorldGenLayerBuilder.class, WorldGenLayerBuilder::new, true); @@ -118,7 +130,8 @@ public void init() { RegistryInfo.BLOCK.addType("gtceu:coil", CoilBlockBuilder.class, CoilBlockBuilder::new); RegistryInfo.BLOCK.addType("gtceu:renderer", RendererBlockBuilder.class, RendererBlockBuilder::new); - RegistryInfo.BLOCK.addType("gtceu:renderer_glass", RendererGlassBlockBuilder.class, RendererGlassBlockBuilder::new); + RegistryInfo.BLOCK.addType("gtceu:renderer_glass", RendererGlassBlockBuilder.class, + RendererGlassBlockBuilder::new); } @Override @@ -191,6 +204,7 @@ public void registerBindings(BindingsEvent event) { event.add("GTFluidState", FluidState.class); event.add("PropertyKey", PropertyKey.class); event.add("ToolProperty", ToolProperty.class); + event.add("HazardProperty", HazardProperty.class); event.add("CleanroomType", CleanroomType.class); event.add("ChemicalHelper", ChemicalHelper.class); @@ -335,16 +349,19 @@ public void registerTypeWrappers(ScriptType type, TypeWrappers typeWrappers) { if (o instanceof IWorldGenLayer.RuleTestSupplier supplier) return supplier; return () -> BlockStatePredicate.ruleTestOf(o); }); - typeWrappers.registerSimple(GTRecipeComponents.FluidIngredientJS.class, GTRecipeComponents.FluidIngredientJS::of); + typeWrappers.registerSimple(GTRecipeComponents.FluidIngredientJS.class, + GTRecipeComponents.FluidIngredientJS::of); } @Override - public void injectRuntimeRecipes(RecipesEventJS event, RecipeManager manager, Map> recipesByName) { + public void injectRuntimeRecipes(RecipesEventJS event, RecipeManager manager, + Map> recipesByName) { // (jankily) parse all GT recipes for extra ones to add, modify RecipesEventJS.runInParallel((() -> event.addedRecipes.forEach(recipe -> { if (recipe instanceof GTRecipeSchema.GTRecipeJS gtRecipe) { // get the recipe ID without the leading type path - GTRecipeBuilder builder = ((GTRecipeType) BuiltInRegistries.RECIPE_TYPE.get(gtRecipe.type.id)).recipeBuilder(gtRecipe.idWithoutType()); + GTRecipeBuilder builder = ((GTRecipeType) BuiltInRegistries.RECIPE_TYPE.get(gtRecipe.type.id)) + .recipeBuilder(gtRecipe.idWithoutType()); if (gtRecipe.getValue(GTRecipeSchema.DURATION) != null) { builder.duration = gtRecipe.getValue(GTRecipeSchema.DURATION).intValue(); @@ -362,34 +379,43 @@ public void injectRuntimeRecipes(RecipesEventJS event, RecipeManager manager, Ma if (gtRecipe.getValue(GTRecipeSchema.ALL_INPUTS) != null) { builder.input.putAll(gtRecipe.getValue(GTRecipeSchema.ALL_INPUTS).entrySet().stream() - .map(entry -> Map.entry(entry.getKey(), Arrays.stream(entry.getValue()) - .map(content -> entry.getKey().serializer.fromJsonContent(GTRecipeComponents.VALID_CAPS.get(entry.getKey()).getFirst().write(gtRecipe, content))) - .toList())) - .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue))); + .map(entry -> Map.entry(entry.getKey(), Arrays.stream(entry.getValue()) + .map(content -> entry.getKey().serializer + .fromJsonContent(GTRecipeComponents.VALID_CAPS.get(entry.getKey()) + .getFirst().write(gtRecipe, content))) + .toList())) + .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue))); } if (gtRecipe.getValue(GTRecipeSchema.ALL_OUTPUTS) != null) { builder.output.putAll(gtRecipe.getValue(GTRecipeSchema.ALL_OUTPUTS).entrySet().stream() - .map(entry -> Map.entry(entry.getKey(), Arrays.stream(entry.getValue()) - .map(content -> entry.getKey().serializer.fromJsonContent(GTRecipeComponents.VALID_CAPS.get(entry.getKey()).getSecond().write(gtRecipe, content))) - .toList())) - .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue))); + .map(entry -> Map.entry(entry.getKey(), Arrays.stream(entry.getValue()) + .map(content -> entry.getKey().serializer + .fromJsonContent(GTRecipeComponents.VALID_CAPS.get(entry.getKey()) + .getSecond().write(gtRecipe, content))) + .toList())) + .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue))); } if (gtRecipe.getValue(GTRecipeSchema.ALL_TICK_INPUTS) != null) { builder.tickInput.putAll(gtRecipe.getValue(GTRecipeSchema.ALL_TICK_INPUTS).entrySet().stream() - .map(entry -> Map.entry(entry.getKey(), Arrays.stream(entry.getValue()) - .map(content -> entry.getKey().serializer.fromJsonContent(GTRecipeComponents.VALID_CAPS.get(entry.getKey()).getFirst().write(gtRecipe, content))) - .toList())) - .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue))); + .map(entry -> Map.entry(entry.getKey(), Arrays.stream(entry.getValue()) + .map(content -> entry.getKey().serializer + .fromJsonContent(GTRecipeComponents.VALID_CAPS.get(entry.getKey()) + .getFirst().write(gtRecipe, content))) + .toList())) + .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue))); } if (gtRecipe.getValue(GTRecipeSchema.ALL_TICK_OUTPUTS) != null) { builder.tickOutput.putAll(gtRecipe.getValue(GTRecipeSchema.ALL_TICK_OUTPUTS).entrySet().stream() - .map(entry -> Map.entry(entry.getKey(), Arrays.stream(entry.getValue()) - .map(content -> entry.getKey().serializer.fromJsonContent(GTRecipeComponents.VALID_CAPS.get(entry.getKey()).getSecond().write(gtRecipe, content))) - .toList())) - .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue))); + .map(entry -> Map.entry(entry.getKey(), Arrays.stream(entry.getValue()) + .map(content -> entry.getKey().serializer + .fromJsonContent(GTRecipeComponents.VALID_CAPS.get(entry.getKey()) + .getSecond().write(gtRecipe, content))) + .toList())) + .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue))); } - builder.save(builtRecipe -> recipesByName.put(builtRecipe.getId(), GTRecipeSerializer.SERIALIZER.fromJson(builtRecipe.getId(), builtRecipe.serializeRecipe()))); + builder.save(builtRecipe -> recipesByName.put(builtRecipe.getId(), + GTRecipeSerializer.SERIALIZER.fromJson(builtRecipe.getId(), builtRecipe.serializeRecipe()))); } }))); @@ -403,19 +429,20 @@ public void injectRuntimeRecipes(RecipesEventJS event, RecipeManager manager, Ma var type = entry.getKey(); var recipes = entry.getValue(); recipes.clear(); - for (var recipe : recipesByName.entrySet().stream().filter(recipe -> recipe.getValue().getType() == type).collect(Collectors.toSet())) { + for (var recipe : recipesByName.entrySet().stream() + .filter(recipe -> recipe.getValue().getType() == type).collect(Collectors.toSet())) { recipes.add(gtRecipeType.toGTrecipe(recipe.getKey(), recipe.getValue())); } } Stream.concat( - recipesByName.values().stream() - .filter(recipe -> recipe.getType() == gtRecipeType), + recipesByName.values().stream() + .filter(recipe -> recipe.getType() == gtRecipeType), proxyRecipes.entrySet().stream() - .flatMap(entry -> entry.getValue().stream())) - .filter(GTRecipe.class::isInstance) - .map(GTRecipe.class::cast) - .forEach(gtRecipe -> gtRecipeType.getLookup().addRecipe(gtRecipe)); + .flatMap(entry -> entry.getValue().stream())) + .filter(GTRecipe.class::isInstance) + .map(GTRecipe.class::cast) + .forEach(gtRecipe -> gtRecipeType.getLookup().addRecipe(gtRecipe)); } } } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/Validator.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/Validator.java index 39240d1340..557738c9a2 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/Validator.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/Validator.java @@ -1,19 +1,21 @@ package com.gregtechceu.gtceu.integration.kjs; -import dev.latvian.mods.kubejs.util.ConsoleJS; -import dev.latvian.mods.rhino.Context; -import io.netty.util.concurrent.SucceededFuture; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.resources.ResourceLocation; +import dev.latvian.mods.kubejs.util.ConsoleJS; +import dev.latvian.mods.rhino.Context; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; + import java.util.Arrays; +import javax.annotation.ParametersAreNonnullByDefault; + @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault @FunctionalInterface public interface Validator { + enum ValidationResult { SUCCESS, SILENT, @@ -25,20 +27,20 @@ enum ValidationResult { static void validate(ResourceLocation id, Validator... validators) { long errors = Arrays.stream(validators) - .map(validator -> validator.run(id)) - .filter(result -> result == ValidationResult.ERROR) - .count(); // Ensure all errors are caught here + .map(validator -> validator.run(id)) + .filter(result -> result == ValidationResult.ERROR) + .count(); // Ensure all errors are caught here if (errors > 0) { ConsoleJS.getCurrent((Context) null).error("VALIDATION FAILED! Cannot build %s".formatted(id)); - throw new IllegalStateException("Validation failed for %s. Please check your KubeJS logs for details.".formatted(id)); + throw new IllegalStateException( + "Validation failed for %s. Please check your KubeJS logs for details.".formatted(id)); } } - //////////////////////////////////////// - //********* VALIDATORS *********// + // ********* VALIDATORS *********// //////////////////////////////////////// static Validator onlySetDefault(@Nullable Object value, Runnable defaultSetter) { @@ -60,7 +62,8 @@ static Validator warnRecommendedIfNull(@Nullable Object value, String name, Runn if (value != null) return ValidationResult.SUCCESS; - ConsoleJS.getCurrent((Context) null).warn("Value %s is not defined in %s. It is recommended to set a value.".formatted(name, id)); + ConsoleJS.getCurrent((Context) null) + .warn("Value %s is not defined in %s. It is recommended to set a value.".formatted(name, id)); defaultSetter.run(); return ValidationResult.WARNING; @@ -71,14 +74,16 @@ static Validator warnDefaultIfNull(@Nullable Object value, String name, Runnable return warnDefaultIfNull(value, name, null, defaultSetter); } - static Validator warnDefaultIfNull(@Nullable Object value, String name, @Nullable String defaultExplanation, Runnable defaultSetter) { + static Validator warnDefaultIfNull(@Nullable Object value, String name, @Nullable String defaultExplanation, + Runnable defaultSetter) { return id -> { if (value != null) return ValidationResult.SUCCESS; var explanation = defaultExplanation != null ? defaultExplanation : "Using a default value."; - ConsoleJS.getCurrent((Context) null).warn("Value %s is not defined in %s. %s".formatted(name, id, explanation)); + ConsoleJS.getCurrent((Context) null) + .warn("Value %s is not defined in %s. %s".formatted(name, id, explanation)); defaultSetter.run(); return ValidationResult.WARNING; diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/ElementBuilder.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/ElementBuilder.java index 86f82feb3b..2a02c08fbe 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/ElementBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/ElementBuilder.java @@ -3,18 +3,31 @@ import com.gregtechceu.gtceu.api.data.chemical.Element; import com.gregtechceu.gtceu.api.registry.registrate.BuilderBase; import com.gregtechceu.gtceu.common.data.GTElements; + import net.minecraft.resources.ResourceLocation; public class ElementBuilder extends BuilderBase { + public transient long protons, neutrons, halfLifeSeconds; public transient String decayTo, name, symbol; public transient boolean isIsotope; public ElementBuilder(ResourceLocation i, Object... args) { super(i); - protons = args[0] instanceof Number number ? number.intValue() : Double.valueOf(args[0].toString()).intValue(); // special handling if somehow called from create(name, type, args...) (it does that) - neutrons = ((Number)args[1]).intValue(); - halfLifeSeconds = ((Number)args[2]).intValue(); + protons = args[0] instanceof Number number ? number.intValue() : Double.valueOf(args[0].toString()).intValue(); // special + // handling + // if + // somehow + // called + // from + // create(name, + // type, + // args...) + // (it + // does + // that) + neutrons = ((Number) args[1]).intValue(); + halfLifeSeconds = ((Number) args[2]).intValue(); decayTo = args[3] == null ? null : args[3].toString(); name = i.getPath(); symbol = args[4] == null ? "" : args[4].toString(); @@ -23,6 +36,7 @@ public ElementBuilder(ResourceLocation i, Object... args) { @Override public Element register() { - return value = GTElements.createAndRegister(protons, neutrons, halfLifeSeconds, decayTo, name, symbol, isIsotope); + return value = GTElements.createAndRegister(protons, neutrons, halfLifeSeconds, decayTo, name, symbol, + isIsotope); } } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/FluidVeinBuilderJS.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/FluidVeinBuilderJS.java index d8ec145eb1..61ed993496 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/FluidVeinBuilderJS.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/FluidVeinBuilderJS.java @@ -1,29 +1,22 @@ package com.gregtechceu.gtceu.integration.kjs.builders; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.data.worldgen.BiomeWeightModifier; import com.gregtechceu.gtceu.api.data.worldgen.bedrockfluid.BedrockFluidDefinition; import com.gregtechceu.gtceu.api.registry.GTRegistries; -import com.lowdragmc.lowdraglib.Platform; -import com.mojang.datafixers.util.Pair; -import com.mojang.serialization.JsonOps; -import dev.latvian.mods.rhino.util.HideFromJS; -import lombok.Setter; -import lombok.experimental.Accessors; + import net.minecraft.core.*; -import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.Registries; -import net.minecraft.resources.RegistryOps; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.TagKey; import net.minecraft.world.level.Level; import net.minecraft.world.level.biome.Biome; -import net.minecraft.world.level.dimension.DimensionType; import net.minecraft.world.level.material.Fluid; +import dev.latvian.mods.rhino.util.HideFromJS; +import lombok.Setter; +import lombok.experimental.Accessors; + import java.util.HashSet; import java.util.LinkedList; import java.util.List; @@ -32,6 +25,7 @@ @Accessors(chain = true, fluent = true) public class FluidVeinBuilderJS { + private final ResourceLocation id; @Setter private int weight; // weight value for determining which vein will appear @@ -57,7 +51,6 @@ public FluidVeinBuilderJS yield(int min, int max) { return minimumYield(min).maximumYield(max); } - public FluidVeinBuilderJS addSpawnDimension(ResourceLocation... dimensions) { for (ResourceLocation dimension : dimensions) { this.dimensions.add(ResourceKey.create(Registries.DIMENSION, dimension)); @@ -69,8 +62,10 @@ public FluidVeinBuilderJS biomes(int weight, String biomes) { Registry registry = GTRegistries.builtinRegistry().registry(Registries.BIOME).get(); this.biomes.add( new BiomeWeightModifier(() -> biomes.startsWith("#") ? - registry.getOrCreateTag(TagKey.create(Registries.BIOME, new ResourceLocation(biomes.substring(1)))) : - (HolderSet.direct(registry.getHolderOrThrow(ResourceKey.create(Registries.BIOME, new ResourceLocation(biomes))))), + registry.getOrCreateTag( + TagKey.create(Registries.BIOME, new ResourceLocation(biomes.substring(1)))) : + (HolderSet.direct(registry + .getHolderOrThrow(ResourceKey.create(Registries.BIOME, new ResourceLocation(biomes))))), weight)); return this; } @@ -81,15 +76,17 @@ public FluidVeinBuilderJS biomes(int weight, String... biomes) { for (String biome : biomes) { biomeKeys.add(biome.startsWith("#") ? registry.getOrCreateTag(TagKey.create(Registries.BIOME, new ResourceLocation(biome.substring(1)))) : - HolderSet.direct(registry.getHolderOrThrow(ResourceKey.create(Registries.BIOME, new ResourceLocation(biome)))) - ); + HolderSet.direct(registry + .getHolderOrThrow(ResourceKey.create(Registries.BIOME, new ResourceLocation(biome))))); } - this.biomes.add(new BiomeWeightModifier(() -> HolderSet.direct(biomeKeys.stream().flatMap(HolderSet::stream).toList()), weight)); + this.biomes.add(new BiomeWeightModifier( + () -> HolderSet.direct(biomeKeys.stream().flatMap(HolderSet::stream).toList()), weight)); return this; } @HideFromJS public BedrockFluidDefinition build() { - return new BedrockFluidDefinition(id, weight, minimumYield, maximumYield, depletionAmount, depletionChance, depletedYield, fluid, biomes, dimensions); + return new BedrockFluidDefinition(id, weight, minimumYield, maximumYield, depletionAmount, depletionChance, + depletedYield, fluid, biomes, dimensions); } } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/GTRecipeTypeBuilder.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/GTRecipeTypeBuilder.java index c8960a797d..0e59b05a47 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/GTRecipeTypeBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/GTRecipeTypeBuilder.java @@ -7,6 +7,7 @@ import com.gregtechceu.gtceu.api.registry.registrate.BuilderBase; import com.gregtechceu.gtceu.api.sound.SoundEntry; import com.gregtechceu.gtceu.common.data.GTRecipeTypes; + import com.lowdragmc.lowdraglib.gui.texture.IGuiTexture; import com.lowdragmc.lowdraglib.gui.texture.ProgressTexture; import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; @@ -14,18 +15,21 @@ import com.lowdragmc.lowdraglib.utils.Position; import com.lowdragmc.lowdraglib.utils.Rect; import com.lowdragmc.lowdraglib.utils.Size; + +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; + import it.unimi.dsi.fastutil.bytes.Byte2ObjectArrayMap; import it.unimi.dsi.fastutil.bytes.Byte2ObjectMap; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.item.ItemStack; import org.jetbrains.annotations.Nullable; import java.util.function.BiConsumer; import java.util.function.Supplier; public class GTRecipeTypeBuilder extends BuilderBase { + public transient String name, category; public transient final Object2IntMap> maxInputs; public transient final Object2IntMap> maxOutputs; @@ -68,8 +72,10 @@ public GTRecipeTypeBuilder category(String category) { } public GTRecipeTypeBuilder setMaxIOSize(int maxInputs, int maxOutputs, int maxFluidInputs, int maxFluidOutputs) { - return setMaxSize(IO.IN, ItemRecipeCapability.CAP, maxInputs).setMaxSize(IO.IN, FluidRecipeCapability.CAP, maxFluidInputs) - .setMaxSize(IO.OUT, ItemRecipeCapability.CAP, maxOutputs).setMaxSize(IO.OUT, FluidRecipeCapability.CAP, maxFluidOutputs); + return setMaxSize(IO.IN, ItemRecipeCapability.CAP, maxInputs) + .setMaxSize(IO.IN, FluidRecipeCapability.CAP, maxFluidInputs) + .setMaxSize(IO.OUT, ItemRecipeCapability.CAP, maxOutputs) + .setMaxSize(IO.OUT, FluidRecipeCapability.CAP, maxFluidOutputs); } public GTRecipeTypeBuilder setEUIO(IO io) { @@ -100,16 +106,19 @@ public GTRecipeTypeBuilder setSpecialTexture(int x, int y, int width, int height } public GTRecipeTypeBuilder setSlotOverlay(boolean isOutput, boolean isFluid, IGuiTexture slotOverlay) { - return this.setSlotOverlay(isOutput, isFluid, false, slotOverlay).setSlotOverlay(isOutput, isFluid, true, slotOverlay); + return this.setSlotOverlay(isOutput, isFluid, false, slotOverlay).setSlotOverlay(isOutput, isFluid, true, + slotOverlay); } - public GTRecipeTypeBuilder setSlotOverlay(boolean isOutput, boolean isFluid, boolean isLast, IGuiTexture slotOverlay) { + public GTRecipeTypeBuilder setSlotOverlay(boolean isOutput, boolean isFluid, boolean isLast, + IGuiTexture slotOverlay) { this.slotOverlays.put((byte) ((isOutput ? 2 : 0) + (isFluid ? 1 : 0) + (isLast ? 4 : 0)), slotOverlay); return this; } public GTRecipeTypeBuilder setProgressBar(ResourceTexture progressBar, ProgressTexture.FillDirection moveType) { - this.progressBarTexture = new ProgressTexture(progressBar.getSubTexture(0, 0, 1, 0.5), progressBar.getSubTexture(0, 0.5, 1, 0.5)).setFillDirection(moveType); + this.progressBarTexture = new ProgressTexture(progressBar.getSubTexture(0, 0, 1, 0.5), + progressBar.getSubTexture(0, 0.5, 1, 0.5)).setFillDirection(moveType); return this; } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/MaterialIconSetBuilder.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/MaterialIconSetBuilder.java index 2c75550f06..f4eb0163ee 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/MaterialIconSetBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/MaterialIconSetBuilder.java @@ -2,9 +2,11 @@ import com.gregtechceu.gtceu.api.data.chemical.material.info.MaterialIconSet; import com.gregtechceu.gtceu.api.registry.registrate.BuilderBase; + import net.minecraft.resources.ResourceLocation; public class MaterialIconSetBuilder extends BuilderBase { + private transient MaterialIconSet parent; public MaterialIconSetBuilder(ResourceLocation id, Object... args) { diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/MaterialIconTypeBuilder.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/MaterialIconTypeBuilder.java index bda15696b6..a8d9b99e2e 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/MaterialIconTypeBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/MaterialIconTypeBuilder.java @@ -2,9 +2,11 @@ import com.gregtechceu.gtceu.api.data.chemical.material.info.MaterialIconType; import com.gregtechceu.gtceu.api.registry.registrate.BuilderBase; + import net.minecraft.resources.ResourceLocation; public class MaterialIconTypeBuilder extends BuilderBase { + public MaterialIconTypeBuilder(ResourceLocation id, Object... args) { super(id, args); } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/RendererBlockItemBuilder.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/RendererBlockItemBuilder.java index 4b14c83020..adad39045d 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/RendererBlockItemBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/RendererBlockItemBuilder.java @@ -1,11 +1,14 @@ package com.gregtechceu.gtceu.integration.kjs.builders; import com.gregtechceu.gtceu.api.item.RendererBlockItem; -import dev.latvian.mods.kubejs.block.BlockItemBuilder; + import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.Item; +import dev.latvian.mods.kubejs.block.BlockItemBuilder; + public class RendererBlockItemBuilder extends BlockItemBuilder { + public RendererBlockItemBuilder(ResourceLocation i) { super(i); } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/WorldGenLayerBuilder.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/WorldGenLayerBuilder.java index 3d23f0307c..2b4e9ca93d 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/WorldGenLayerBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/WorldGenLayerBuilder.java @@ -3,11 +3,12 @@ import com.gregtechceu.gtceu.api.data.worldgen.IWorldGenLayer; import com.gregtechceu.gtceu.api.data.worldgen.SimpleWorldGenLayer; import com.gregtechceu.gtceu.api.registry.registrate.BuilderBase; + +import net.minecraft.resources.ResourceLocation; + import dev.latvian.mods.kubejs.level.gen.ruletest.AnyMatchRuleTest; import it.unimi.dsi.fastutil.objects.ObjectArrayList; import lombok.experimental.Accessors; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.level.levelgen.structure.templatesystem.RuleTest; import java.util.Arrays; import java.util.Collections; @@ -16,6 +17,7 @@ @Accessors(fluent = true, chain = true) public class WorldGenLayerBuilder extends BuilderBase { + public transient List targets = new ObjectArrayList<>(); public transient List dimensions = new ObjectArrayList<>(); diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/block/CoilBlockBuilder.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/block/CoilBlockBuilder.java index 168ffe3e99..125a509e2c 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/block/CoilBlockBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/block/CoilBlockBuilder.java @@ -4,16 +4,16 @@ import com.gregtechceu.gtceu.api.block.SimpleCoilType; import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.common.block.CoilBlock; -import com.gregtechceu.gtceu.common.data.GTBlocks; -import com.gregtechceu.gtceu.common.data.GTMaterials; import com.gregtechceu.gtceu.integration.kjs.builders.RendererBlockItemBuilder; + +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.block.Block; + import dev.latvian.mods.kubejs.block.BlockBuilder; import dev.latvian.mods.kubejs.block.BlockItemBuilder; import dev.latvian.mods.kubejs.generator.AssetJsonGenerator; import lombok.Setter; import lombok.experimental.Accessors; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.level.block.Block; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -21,6 +21,7 @@ @Accessors(chain = true, fluent = true) public class CoilBlockBuilder extends BlockBuilder { + @Setter public transient int temperature = 0, level = 0, energyDiscount = 1, tier = 0; @NotNull @@ -38,9 +39,7 @@ public CoilBlockBuilder coilMaterial(@NotNull Supplier<@Nullable Material> mater } @Override - public void generateAssetJsons(AssetJsonGenerator generator) { - - } + public void generateAssetJsons(AssetJsonGenerator generator) {} @Override protected BlockItemBuilder getOrCreateItemBuilder() { @@ -49,7 +48,8 @@ protected BlockItemBuilder getOrCreateItemBuilder() { @Override public Block createObject() { - SimpleCoilType coilType = new SimpleCoilType(this.id.getPath(), temperature, level, energyDiscount, tier, material, texture); + SimpleCoilType coilType = new SimpleCoilType(this.id.getPath(), temperature, level, energyDiscount, tier, + material, texture); CoilBlock result = new CoilBlock(this.createProperties(), coilType); GTCEuAPI.HEATING_COILS.put(coilType, () -> result); return result; diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/block/RendererBlockBuilder.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/block/RendererBlockBuilder.java index 5ceb2e574f..5a94c23aaf 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/block/RendererBlockBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/block/RendererBlockBuilder.java @@ -4,26 +4,31 @@ import com.gregtechceu.gtceu.client.renderer.block.CTMModelRenderer; import com.gregtechceu.gtceu.client.renderer.block.TextureOverrideRenderer; import com.gregtechceu.gtceu.integration.kjs.builders.RendererBlockItemBuilder; + import com.lowdragmc.lowdraglib.client.renderer.IRenderer; + +import net.minecraft.FieldsAreNonnullByDefault; +import net.minecraft.MethodsReturnNonnullByDefault; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.block.Block; + import dev.latvian.mods.kubejs.block.BlockBuilder; import dev.latvian.mods.kubejs.block.BlockItemBuilder; import dev.latvian.mods.kubejs.client.ModelGenerator; import dev.latvian.mods.kubejs.generator.AssetJsonGenerator; import lombok.Setter; import lombok.experimental.Accessors; -import net.minecraft.FieldsAreNonnullByDefault; -import net.minecraft.MethodsReturnNonnullByDefault; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.level.block.Block; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.Map; +import javax.annotation.ParametersAreNonnullByDefault; + @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault @FieldsAreNonnullByDefault @Accessors(chain = true, fluent = true) public class RendererBlockBuilder extends BlockBuilder { + @Setter public transient IRenderer renderer; @@ -32,16 +37,13 @@ public RendererBlockBuilder(ResourceLocation i) { } @Override - protected void generateItemModelJson(ModelGenerator m) { - - } + protected void generateItemModelJson(ModelGenerator m) {} @Override - protected void generateBlockModelJsons(AssetJsonGenerator generator) { - - } + protected void generateBlockModelJsons(AssetJsonGenerator generator) {} - public RendererBlockBuilder textureOverrideRenderer(ResourceLocation modelPath, Map textures) { + public RendererBlockBuilder textureOverrideRenderer(ResourceLocation modelPath, + Map textures) { this.renderer = new TextureOverrideRenderer(modelPath, textures); return this; } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/block/RendererGlassBlockBuilder.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/block/RendererGlassBlockBuilder.java index 287ec5a64f..a7791019df 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/block/RendererGlassBlockBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/block/RendererGlassBlockBuilder.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.integration.kjs.builders.block; import com.gregtechceu.gtceu.api.block.RendererGlassBlock; + import net.minecraft.FieldsAreNonnullByDefault; import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.resources.ResourceLocation; @@ -8,7 +9,6 @@ import javax.annotation.ParametersAreNonnullByDefault; - @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault @FieldsAreNonnullByDefault diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/machine/CustomMultiblockBuilder.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/machine/CustomMultiblockBuilder.java index 43cfbddee6..f2b09fc227 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/machine/CustomMultiblockBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/machine/CustomMultiblockBuilder.java @@ -8,7 +8,6 @@ import com.gregtechceu.gtceu.api.gui.editor.EditableMachineUI; import com.gregtechceu.gtceu.api.item.MetaMachineItem; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; -import com.gregtechceu.gtceu.api.machine.MetaMachine; import com.gregtechceu.gtceu.api.machine.MultiblockMachineDefinition; import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiController; import com.gregtechceu.gtceu.api.machine.feature.multiblock.IMultiPart; @@ -18,22 +17,15 @@ import com.gregtechceu.gtceu.api.machine.multiblock.WorkableElectricMultiblockMachine; import com.gregtechceu.gtceu.api.pattern.BlockPattern; import com.gregtechceu.gtceu.api.pattern.MultiblockShapeInfo; -import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.GTRecipeType; import com.gregtechceu.gtceu.api.recipe.modifier.RecipeModifier; import com.gregtechceu.gtceu.api.registry.registrate.MachineBuilder; import com.gregtechceu.gtceu.api.registry.registrate.MultiblockMachineBuilder; import com.gregtechceu.gtceu.common.machine.multiblock.primitive.PrimitiveFancyUIWorkableMachine; import com.gregtechceu.gtceu.common.registry.GTRegistration; + import com.lowdragmc.lowdraglib.client.renderer.IRenderer; -import com.tterrag.registrate.builders.BlockBuilder; -import com.tterrag.registrate.builders.ItemBuilder; -import com.tterrag.registrate.util.nullness.NonNullConsumer; -import com.tterrag.registrate.util.nullness.NonNullUnaryOperator; -import dev.latvian.mods.kubejs.script.ScriptType; -import dev.latvian.mods.kubejs.util.UtilsJS; -import dev.latvian.mods.rhino.BaseFunction; -import it.unimi.dsi.fastutil.objects.Object2IntMap; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Direction; import net.minecraft.network.chat.Component; @@ -46,21 +38,34 @@ import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.shapes.VoxelShape; -import org.apache.commons.lang3.function.TriFunction; +import com.tterrag.registrate.builders.BlockBuilder; +import com.tterrag.registrate.builders.ItemBuilder; +import com.tterrag.registrate.util.nullness.NonNullConsumer; +import com.tterrag.registrate.util.nullness.NonNullUnaryOperator; +import dev.latvian.mods.kubejs.script.ScriptType; +import dev.latvian.mods.kubejs.util.UtilsJS; +import dev.latvian.mods.rhino.BaseFunction; +import it.unimi.dsi.fastutil.objects.Object2IntMap; +import org.apache.commons.lang3.function.TriFunction; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; + import java.util.Comparator; import java.util.List; import java.util.Locale; import java.util.function.*; +import javax.annotation.ParametersAreNonnullByDefault; + @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault -@SuppressWarnings({"unused"}) +@SuppressWarnings({ "unused" }) public class CustomMultiblockBuilder extends MultiblockMachineBuilder { - protected CustomMultiblockBuilder(String name, Function metaMachine) { - super(GTRegistration.REGISTRATE, name, metaMachine, MetaMachineBlock::new, MetaMachineItem::new, MetaMachineBlockEntity::createBlockEntity); + + protected CustomMultiblockBuilder(String name, + Function metaMachine) { + super(GTRegistration.REGISTRATE, name, metaMachine, MetaMachineBlock::new, MetaMachineItem::new, + MetaMachineBlockEntity::createBlockEntity); } public static CustomMultiblockBuilder[] tieredMultis(String name, @@ -68,7 +73,8 @@ public static CustomMultiblockBuilder[] tieredMultis(String name, Integer... tiers) { CustomMultiblockBuilder[] builders = new CustomMultiblockBuilder[GTValues.TIER_COUNT]; for (int tier : tiers) { - var builder = new CustomMultiblockBuilder(GTValues.VN[tier].toLowerCase(Locale.ROOT) + "_" + name, holder -> factory.apply(holder, tier)) + var builder = new CustomMultiblockBuilder(GTValues.VN[tier].toLowerCase(Locale.ROOT) + "_" + name, + holder -> factory.apply(holder, tier)) .tier(tier); builders[tier] = builder; } @@ -80,29 +86,33 @@ public CustomMultiblockBuilder tier(int tier) { return (CustomMultiblockBuilder) super.tier(tier); } - @SuppressWarnings("unchecked") public static MachineBuilder createMultiblock(String name, Object... args) { CustomMultiblockBuilder[] builders; int start = 0; - while (start < args.length && (!(args[start] instanceof Number || args[start] instanceof Number[] || args[start] instanceof int[]))) { + while (start < args.length && + (!(args[start] instanceof Number || args[start] instanceof Number[] || args[start] instanceof int[]))) { ++start; } Object[] tierObjects = MachineFunctionPresets.copyArgs(args, start); Integer[] tiers = MachineFunctionPresets.mapTierArray(tierObjects); if (tiers.length > 0) { - if (args.length > 0 && args[0] instanceof BiFunction machineFunction) { - builders = tieredMultis(name, (BiFunction) machineFunction, tiers); + if (args.length > 0 && args[0] instanceof BiFunction machineFunction) { + builders = tieredMultis(name, + (BiFunction) machineFunction, tiers); } else if (args.length > 0 && args[0] instanceof BaseFunction machineFunction) { - builders = tieredMultis(name, UtilsJS.makeFunctionProxy(ScriptType.STARTUP, BiFunction.class, machineFunction), tiers); + builders = tieredMultis(name, + UtilsJS.makeFunctionProxy(ScriptType.STARTUP, BiFunction.class, machineFunction), tiers); } else { builders = tieredMultis(name, TieredWorkableElectricMultiblockMachine::new, tiers); } } else { - if (args.length > 0 && args[0] instanceof Function machineFunction) { - return new CustomMultiblockBuilder(name, (Function)machineFunction); + if (args.length > 0 && args[0] instanceof Function machineFunction) { + return new CustomMultiblockBuilder(name, + (Function) machineFunction); } else if (args.length > 0 && args[0] instanceof BaseFunction machineFunction) { - return new CustomMultiblockBuilder(name, UtilsJS.makeFunctionProxy(ScriptType.STARTUP, Function.class, machineFunction)); + return new CustomMultiblockBuilder(name, + UtilsJS.makeFunctionProxy(ScriptType.STARTUP, Function.class, machineFunction)); } else { return new CustomMultiblockBuilder(name, WorkableElectricMultiblockMachine::new); } @@ -116,6 +126,7 @@ public static MachineBuilder createPrimitiveMultibl public static CustomMultiblockBuilder tieredBuilder(String name, CustomMultiblockBuilder[] builders) { return new CustomMultiblockBuilder(name, holder -> null) { + @Override public MultiblockMachineBuilder pattern(Function pattern) { for (var builder : builders) { @@ -398,7 +409,8 @@ public CustomMultiblockBuilder langValue(String langValue) { return this; } - public CustomMultiblockBuilder recipeModifier(RecipeModifier recipeModifier, boolean alwaysTryModifyRecipe) { + public CustomMultiblockBuilder recipeModifier(RecipeModifier recipeModifier, + boolean alwaysTryModifyRecipe) { recipeModifier(recipeModifier); alwaysTryModifyRecipe(alwaysTryModifyRecipe); return this; @@ -443,11 +455,13 @@ public MultiblockMachineDefinition register() { @FunctionalInterface public interface BuilderConsumer extends Consumer { + void accept(CustomMultiblockBuilder builder); } @FunctionalInterface public interface TieredBuilderConsumer { + void accept(int tier, CustomMultiblockBuilder builder); } } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/machine/CustomTieredMachineBuilder.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/machine/CustomTieredMachineBuilder.java index c8d4ea0f95..b1d9da693d 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/machine/CustomTieredMachineBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/machine/CustomTieredMachineBuilder.java @@ -7,6 +7,7 @@ import com.gregtechceu.gtceu.api.machine.MachineDefinition; import com.gregtechceu.gtceu.api.machine.MetaMachine; import com.gregtechceu.gtceu.api.registry.registrate.MachineBuilder; + import dev.latvian.mods.kubejs.script.ScriptType; import dev.latvian.mods.kubejs.util.UtilsJS; import dev.latvian.mods.rhino.BaseFunction; @@ -16,6 +17,7 @@ import java.util.function.Function; public class CustomTieredMachineBuilder extends SimpleMachineBuilder { + public CustomTieredMachineBuilder(String name, Function machineConstructor) { super(name, machineConstructor); } @@ -26,11 +28,13 @@ public CustomTieredMachineBuilder tier(int tier) { } private static CustomTieredMachineBuilder[] customTiered(String name, - BiFunction machineConstructor, - Integer... tiers) { + BiFunction machineConstructor, + Integer... tiers) { CustomTieredMachineBuilder[] builders = new CustomTieredMachineBuilder[GTValues.TIER_COUNT]; for (int tier : tiers) { - CustomTieredMachineBuilder register = new CustomTieredMachineBuilder(GTValues.VN[tier].toLowerCase(Locale.ROOT) + "_" + name, holder -> machineConstructor.apply(holder, tier)).tier(tier); + CustomTieredMachineBuilder register = new CustomTieredMachineBuilder( + GTValues.VN[tier].toLowerCase(Locale.ROOT) + "_" + name, + holder -> machineConstructor.apply(holder, tier)).tier(tier); builders[tier] = register; } return builders; @@ -41,13 +45,18 @@ public static MachineBuilder createAll(String name, Object... CustomTieredMachineBuilder[] builders = new CustomTieredMachineBuilder[0]; if (args.length > 1) { Integer[] tiers = MachineFunctionPresets.mapTierArray(MachineFunctionPresets.copyArgs(args, 1)); - if (args[0] instanceof BiFunction machineFunction) { - builders = customTiered(name, (BiFunction) machineFunction, tiers); + if (args[0] instanceof BiFunction machineFunction) { + builders = customTiered(name, (BiFunction) machineFunction, + tiers); } else if (args[0] instanceof BaseFunction machineFunction) { - //builders = customTiered(name, (BiFunction) NativeJavaObject.createInterfaceAdapter(ScriptType.STARTUP.manager.get().context, BiFunction.class, machineFunction), MachineFunctionPresets.mapTierArray(tiers)); - builders = customTiered(name, UtilsJS.makeFunctionProxy(ScriptType.STARTUP, BiFunction.class, machineFunction), tiers); + // builders = customTiered(name, (BiFunction) + // NativeJavaObject.createInterfaceAdapter(ScriptType.STARTUP.manager.get().context, BiFunction.class, + // machineFunction), MachineFunctionPresets.mapTierArray(tiers)); + builders = customTiered(name, + UtilsJS.makeFunctionProxy(ScriptType.STARTUP, BiFunction.class, machineFunction), tiers); } } - return MachineFunctionPresets.builder(name, builders, CustomTieredMachineBuilder.class, MachineDefinition::createDefinition, MetaMachineBlock::new, MetaMachineBlockEntity::createBlockEntity); + return MachineFunctionPresets.builder(name, builders, CustomTieredMachineBuilder.class, + MachineDefinition::createDefinition, MetaMachineBlock::new, MetaMachineBlockEntity::createBlockEntity); } } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/machine/GeneratorBuilder.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/machine/GeneratorBuilder.java index a9664d955b..c40ccaeb62 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/machine/GeneratorBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/machine/GeneratorBuilder.java @@ -12,7 +12,6 @@ import com.gregtechceu.gtceu.api.registry.registrate.MachineBuilder; import com.gregtechceu.gtceu.client.renderer.machine.SimpleGeneratorMachineRenderer; -import java.util.Arrays; import java.util.Locale; import java.util.function.BiConsumer; import java.util.function.Function; @@ -29,6 +28,7 @@ * @implNote MachineBuilder */ public class GeneratorBuilder extends SimpleMachineBuilder { + public GeneratorBuilder(String name, Function machineConstructor) { super(name, machineConstructor); } @@ -43,7 +43,8 @@ private static GeneratorBuilder[] tieredMachines(String name, Integer... tiers) { GeneratorBuilder[] builders = new GeneratorBuilder[GTValues.TIER_COUNT]; for (int tier : tiers) { - var register = new GeneratorBuilder(GTValues.VN[tier].toLowerCase(Locale.ROOT) + "_" + name, holder -> new SimpleGeneratorMachine(holder, tier, defaultTankSizeFunction)).tier(tier); + var register = new GeneratorBuilder(GTValues.VN[tier].toLowerCase(Locale.ROOT) + "_" + name, + holder -> new SimpleGeneratorMachine(holder, tier, defaultTankSizeFunction)).tier(tier); builderConsumer.accept(register, tier); builders[tier] = register; } @@ -52,17 +53,22 @@ private static GeneratorBuilder[] tieredMachines(String name, private static void simple(GeneratorBuilder builder, int tier) { builder.langValue("%s %s Generator %s".formatted(VLVH[tier], toEnglishName(builder.id.getPath()), VLVT[tier])) - //.editableUI(SimpleGeneratorMachine.EDITABLE_UI_CREATOR.apply(GTCEu.id(builder.id.getPath()), recipeType)) + // .editableUI(SimpleGeneratorMachine.EDITABLE_UI_CREATOR.apply(GTCEu.id(builder.id.getPath()), + // recipeType)) .rotationState(RotationState.NON_Y_AXIS) - //.recipeType(recipeType) + // .recipeType(recipeType) .recipeModifier(SimpleGeneratorMachine::recipeModifier, true) - .renderer(() -> new SimpleGeneratorMachineRenderer(tier, GTCEu.id("block/generators/" + builder.id.getPath()))) + .renderer(() -> new SimpleGeneratorMachineRenderer(tier, + GTCEu.id("block/generators/" + builder.id.getPath()))) .tooltips(explosion()); - //.tooltips(workableTiered(tier, GTValues.V[tier], GTValues.V[tier] * 64, recipeType, tankScalingFunction.apply(tier), false)) + // .tooltips(workableTiered(tier, GTValues.V[tier], GTValues.V[tier] * 64, recipeType, + // tankScalingFunction.apply(tier), false)) } public static MachineBuilder createAll(String name, Object... args) { - GeneratorBuilder[] builders = tieredMachines(name, GeneratorBuilder::simple, MachineFunctionPresets.mapTierArray(args)); - return MachineFunctionPresets.builder(name, builders, GeneratorBuilder.class, MachineDefinition::createDefinition, MetaMachineBlock::new, MetaMachineBlockEntity::createBlockEntity); + GeneratorBuilder[] builders = tieredMachines(name, GeneratorBuilder::simple, + MachineFunctionPresets.mapTierArray(args)); + return MachineFunctionPresets.builder(name, builders, GeneratorBuilder.class, + MachineDefinition::createDefinition, MetaMachineBlock::new, MetaMachineBlockEntity::createBlockEntity); } } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/machine/KineticMachineBuilder.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/machine/KineticMachineBuilder.java index 154e90d7d8..bd1c0986b8 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/machine/KineticMachineBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/machine/KineticMachineBuilder.java @@ -15,12 +15,14 @@ import com.gregtechceu.gtceu.common.machine.KineticMachineDefinition; import com.gregtechceu.gtceu.common.machine.kinetic.SimpleKineticElectricWorkableMachine; import com.gregtechceu.gtceu.common.registry.GTRegistration; -import com.tterrag.registrate.util.nullness.NonNullConsumer; -import it.unimi.dsi.fastutil.ints.Int2LongFunction; + import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockBehaviour; +import com.tterrag.registrate.util.nullness.NonNullConsumer; +import it.unimi.dsi.fastutil.ints.Int2LongFunction; + import java.util.Locale; import java.util.function.BiConsumer; import java.util.function.Function; @@ -36,11 +38,15 @@ * @implNote MachineBuilder */ public class KineticMachineBuilder extends MachineBuilder { + public transient Int2LongFunction tankScalingFunction; // reflected in MachineFunctionPresets. DO NOT CHANGE! private final Object[] passedArguments; public KineticMachineBuilder(String name, boolean isSource, int tier, Object... args) { - super(GTRegistration.REGISTRATE, name, (id) -> new KineticMachineDefinition(id, isSource, GTValues.V[tier]), (holder) -> new SimpleKineticElectricWorkableMachine(holder, tier, GTMachines.defaultTankSizeFunction, args), KineticMachineBlock::new, MetaMachineItem::new, KineticMachineBlockEntity::create); + super(GTRegistration.REGISTRATE, name, (id) -> new KineticMachineDefinition(id, isSource, GTValues.V[tier]), + (holder) -> new SimpleKineticElectricWorkableMachine(holder, tier, GTMachines.defaultTankSizeFunction, + args), + KineticMachineBlock::new, MetaMachineItem::new, KineticMachineBlockEntity::create); this.tankScalingFunction = GTMachines.defaultTankSizeFunction; this.passedArguments = args; } @@ -53,7 +59,8 @@ public KineticMachineBuilder isSource(boolean isSource) { @SuppressWarnings("unused") // Accessed via reflection public KineticMachineBuilder tankScalingFunction(Function tankScalingFunction) { this.tankScalingFunction = tier -> tankScalingFunction.apply(tier).longValue(); - this.metaMachine((holder) -> new SimpleKineticElectricWorkableMachine(holder, tier(), this.tankScalingFunction, passedArguments)); + this.metaMachine((holder) -> new SimpleKineticElectricWorkableMachine(holder, tier(), this.tankScalingFunction, + passedArguments)); return this; } @@ -77,10 +84,12 @@ private static KineticMachineBuilder[] tieredMachines(String name, Integer... tiers) { KineticMachineBuilder[] builders = new KineticMachineBuilder[GTValues.TIER_COUNT]; for (int tier : tiers) { - var register = new KineticMachineBuilder(GTValues.VN[tier].toLowerCase(Locale.ROOT) + "_" + name, false, tier) + var register = new KineticMachineBuilder(GTValues.VN[tier].toLowerCase(Locale.ROOT) + "_" + name, false, + tier) .tier(tier) .hasTESR(true) - .onBlockEntityRegister(type -> KineticMachineBlockEntity.onBlockEntityRegister(type, () -> SplitShaftInstance::new, false)); + .onBlockEntityRegister(type -> KineticMachineBlockEntity.onBlockEntityRegister(type, + () -> SplitShaftInstance::new, false)); builderConsumer.accept(register, tier); builders[tier] = register; } @@ -90,17 +99,24 @@ private static KineticMachineBuilder[] tieredMachines(String name, private static void simple(MachineBuilder builder, int tier) { builder.langValue("%s %s %s".formatted(VLVH[tier], toEnglishName(builder.id.getPath()), VLVT[tier])) .rotationState(RotationState.NON_Y_AXIS) - //.editableUI(SimpleTieredMachine.EDITABLE_UI_CREATOR.apply(GTCEu.id(builder.id.getPath()), recipeType)) + // .editableUI(SimpleTieredMachine.EDITABLE_UI_CREATOR.apply(GTCEu.id(builder.id.getPath()), + // recipeType)) .blockProp(BlockBehaviour.Properties::dynamicShape) .blockProp(BlockBehaviour.Properties::noOcclusion) .recipeModifier(GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) - .renderer(() -> new KineticWorkableTieredHullMachineRenderer(tier, GTCEu.id("block/machine/kinetic_electric_machine"), GTCEu.id("block/machines/" + builder.id.getPath()))) + .renderer(() -> new KineticWorkableTieredHullMachineRenderer(tier, + GTCEu.id("block/machine/kinetic_electric_machine"), + GTCEu.id("block/machines/" + builder.id.getPath()))) .tooltips(explosion()); - //.tooltips(workableTiered(tier, GTValues.V[tier], GTValues.V[tier] * 64, recipeType, defaultTankSizeFunction.apply(tier), true)); + // .tooltips(workableTiered(tier, GTValues.V[tier], GTValues.V[tier] * 64, recipeType, + // defaultTankSizeFunction.apply(tier), true)); } public static MachineBuilder createAll(String name, Object... args) { - KineticMachineBuilder[] builders = tieredMachines(name, KineticMachineBuilder::simple, MachineFunctionPresets.mapTierArray(args)); - return MachineFunctionPresets.builder(name, builders, KineticMachineBuilder.class, (id) -> new KineticMachineDefinition(id, false, 0), KineticMachineBlock::new, KineticMachineBlockEntity::create); + KineticMachineBuilder[] builders = tieredMachines(name, KineticMachineBuilder::simple, + MachineFunctionPresets.mapTierArray(args)); + return MachineFunctionPresets.builder(name, builders, KineticMachineBuilder.class, + (id) -> new KineticMachineDefinition(id, false, 0), KineticMachineBlock::new, + KineticMachineBlockEntity::create); } } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/machine/MachineFunctionPresets.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/machine/MachineFunctionPresets.java index 3f923ca51a..92a67c92d5 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/machine/MachineFunctionPresets.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/machine/MachineFunctionPresets.java @@ -8,22 +8,16 @@ import com.gregtechceu.gtceu.api.item.MetaMachineItem; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; import com.gregtechceu.gtceu.api.machine.MachineDefinition; -import com.gregtechceu.gtceu.api.machine.MetaMachine; import com.gregtechceu.gtceu.api.machine.SimpleTieredMachine; import com.gregtechceu.gtceu.api.machine.multiblock.PartAbility; -import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.GTRecipeType; import com.gregtechceu.gtceu.api.recipe.modifier.RecipeModifier; import com.gregtechceu.gtceu.api.registry.registrate.MachineBuilder; -import com.gregtechceu.gtceu.api.registry.registrate.MultiblockMachineBuilder; import com.gregtechceu.gtceu.common.data.GTMachines; import com.gregtechceu.gtceu.common.registry.GTRegistration; + import com.lowdragmc.lowdraglib.client.renderer.IRenderer; -import com.tterrag.registrate.builders.BlockBuilder; -import com.tterrag.registrate.builders.ItemBuilder; -import com.tterrag.registrate.util.nullness.NonNullConsumer; -import com.tterrag.registrate.util.nullness.NonNullUnaryOperator; -import it.unimi.dsi.fastutil.objects.Object2IntMap; + import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.BlockPos; import net.minecraft.network.chat.Component; @@ -36,10 +30,15 @@ import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.shapes.VoxelShape; + +import com.tterrag.registrate.builders.BlockBuilder; +import com.tterrag.registrate.builders.ItemBuilder; +import com.tterrag.registrate.util.nullness.NonNullConsumer; +import com.tterrag.registrate.util.nullness.NonNullUnaryOperator; +import it.unimi.dsi.fastutil.objects.Object2IntMap; import org.apache.commons.lang3.function.TriFunction; import org.jetbrains.annotations.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -48,14 +47,20 @@ import java.util.function.*; import java.util.stream.Stream; +import javax.annotation.ParametersAreNonnullByDefault; + @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault -@SuppressWarnings({"unused"}) +@SuppressWarnings({ "unused" }) public class MachineFunctionPresets { public static Integer[] mapTierArray(Object[] tiers) { return Arrays.stream(tiers) - .flatMap(object -> object.getClass().isArray() ? object.getClass().componentType().isPrimitive() ? Arrays.stream((int[]) object).boxed() : Arrays.stream((Object[])object) : Stream.of(object)) + .flatMap( + object -> object.getClass().isArray() ? + object.getClass().componentType().isPrimitive() ? + Arrays.stream((int[]) object).boxed() : Arrays.stream((Object[]) object) : + Stream.of(object)) .filter(Number.class::isInstance) .map(Number.class::cast) .map(Number::intValue) @@ -68,11 +73,14 @@ public static Object[] copyArgs(Object[] original, int offset) { return copy; } - public static > MachineBuilder builder(String name, B[] builders, Class builderClass, - Function definitionFactory, - BiFunction blockFactory, - TriFunction, BlockPos, BlockState, IMachineBlockEntity> blockEntityFactory) { - return new MachineBuilder(GTRegistration.REGISTRATE, name, definitionFactory, holder -> null, blockFactory, MetaMachineItem::new, blockEntityFactory) { + public static > MachineBuilder builder(String name, B[] builders, Class builderClass, + Function definitionFactory, + BiFunction blockFactory, + TriFunction, BlockPos, BlockState, IMachineBlockEntity> blockEntityFactory) { + return new MachineBuilder(GTRegistration.REGISTRATE, name, definitionFactory, holder -> null, blockFactory, + MetaMachineItem::new, blockEntityFactory) { + public MachineBuilder renderer(@Nullable Supplier renderer) { for (var builder : builders) { if (builder == null) continue; @@ -350,7 +358,8 @@ public MachineBuilder workableSteamHullRenderer(boolean isHighPressure, Resou } @Override - public MachineBuilder workableCasingRenderer(ResourceLocation baseCasing, ResourceLocation workableModel) { + public MachineBuilder workableCasingRenderer(ResourceLocation baseCasing, + ResourceLocation workableModel) { for (var builder : builders) { if (builder == null) continue; builder.workableCasingRenderer(baseCasing, workableModel); @@ -359,7 +368,8 @@ public MachineBuilder workableCasingRenderer(ResourceLocation baseCasing, Res } @Override - public MachineBuilder workableCasingRenderer(ResourceLocation baseCasing, ResourceLocation workableModel, boolean tint) { + public MachineBuilder workableCasingRenderer(ResourceLocation baseCasing, ResourceLocation workableModel, + boolean tint) { for (var builder : builders) { if (builder == null) continue; builder.workableCasingRenderer(baseCasing, workableModel, tint); @@ -368,7 +378,8 @@ public MachineBuilder workableCasingRenderer(ResourceLocation baseCasing, Res } @Override - public MachineBuilder sidedWorkableCasingRenderer(String basePath, ResourceLocation overlayModel, boolean tint) { + public MachineBuilder sidedWorkableCasingRenderer(String basePath, ResourceLocation overlayModel, + boolean tint) { for (var builder : builders) { if (builder == null) continue; builder.sidedWorkableCasingRenderer(basePath, overlayModel, tint); @@ -400,14 +411,15 @@ public MachineBuilder recipeModifier(RecipeModifier recipeModifier, boolean a return this; } - // reflect the tankScalingFunction method because I'm a little bitch teehee (and because it's not a common method, but in both SimpleMachineBuilder and KineticMachineBuilder, which can't inherit from each other) + // reflect the tankScalingFunction method because I'm a little bitch teehee (and because it's not a common + // method, but in both SimpleMachineBuilder and KineticMachineBuilder, which can't inherit from each other) // does nothing if not found, or errors otherwise public MachineBuilder tankScalingFunction(Function tankScalingFunction) { try { Method method = builderClass.getDeclaredMethod("tankScalingFunction", Function.class); for (var builder : builders) { - if (builder == null) continue; + if (builder == null) continue; method.invoke(builder, tankScalingFunction); } } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored) { @@ -434,7 +446,10 @@ public MachineBuilder workableTooltip(GTRecipeType recipeType) { if (builder == null) continue; int tier = builder.tier(); Function tankScalingFunction = getTankScalingFunction(builder); - builder.tooltips(GTMachines.workableTiered(tier, GTValues.V[tier], GTValues.V[tier] * 64, recipeType, tankScalingFunction != null ? tankScalingFunction.apply(tier) : GTMachines.defaultTankSizeFunction.apply(tier), true)); + builder.tooltips(GTMachines.workableTiered( + tier, GTValues.V[tier], GTValues.V[tier] * 64, recipeType, tankScalingFunction != null ? + tankScalingFunction.apply(tier) : GTMachines.defaultTankSizeFunction.apply(tier), + true)); } return this; } @@ -447,7 +462,8 @@ public MachineBuilder recipeType(GTRecipeType recipeType, boolean applyWorkab return this; } - public MachineBuilder recipeType(GTRecipeType recipeType, boolean applyWorkableTooltip, boolean applyDefaultGUIFunction) { + public MachineBuilder recipeType(GTRecipeType recipeType, boolean applyWorkableTooltip, + boolean applyDefaultGUIFunction) { this.recipeType(recipeType); if (applyWorkableTooltip) { workableTooltip(recipeType); @@ -481,11 +497,13 @@ public D register() { @FunctionalInterface public interface BuilderConsumer extends Consumer> { + void accept(MachineBuilder builder); } @FunctionalInterface public interface TieredBuilderConsumer { + void accept(int tier, MachineBuilder builder); } } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/machine/SimpleMachineBuilder.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/machine/SimpleMachineBuilder.java index be754a1cf8..f73d0db785 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/machine/SimpleMachineBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/machine/SimpleMachineBuilder.java @@ -12,6 +12,7 @@ import com.gregtechceu.gtceu.common.data.GTMachines; import com.gregtechceu.gtceu.common.data.GTRecipeModifiers; import com.gregtechceu.gtceu.common.registry.GTRegistration; + import it.unimi.dsi.fastutil.ints.Int2LongFunction; import java.util.Locale; @@ -30,10 +31,12 @@ * @implNote MachineBuilder */ public class SimpleMachineBuilder extends MachineBuilder { + public transient Int2LongFunction tankScalingFunction; // reflected in MachineFunctionPresets. DO NOT CHANGE! public SimpleMachineBuilder(String name, Function machineConstructor) { - super(GTRegistration.REGISTRATE, name, MachineDefinition::createDefinition, machineConstructor, MetaMachineBlock::new, MetaMachineItem::new, MetaMachineBlockEntity::createBlockEntity); + super(GTRegistration.REGISTRATE, name, MachineDefinition::createDefinition, machineConstructor, + MetaMachineBlock::new, MetaMachineItem::new, MetaMachineBlockEntity::createBlockEntity); this.tankScalingFunction = GTMachines.defaultTankSizeFunction; } @@ -54,7 +57,9 @@ private static SimpleMachineBuilder[] simpleMachines(String name, Integer... tiers) { SimpleMachineBuilder[] builders = new SimpleMachineBuilder[GTValues.TIER_COUNT]; for (int tier : tiers) { - SimpleMachineBuilder register = new SimpleMachineBuilder(GTValues.VN[tier].toLowerCase(Locale.ROOT) + "_" + name, holder -> new SimpleTieredMachine(holder, tier, defaultTankSizeFunction)).tier(tier); + SimpleMachineBuilder register = new SimpleMachineBuilder( + GTValues.VN[tier].toLowerCase(Locale.ROOT) + "_" + name, + holder -> new SimpleTieredMachine(holder, tier, defaultTankSizeFunction)).tier(tier); builderConsumer.accept(register, tier); builders[tier] = register; } @@ -64,17 +69,21 @@ private static SimpleMachineBuilder[] simpleMachines(String name, public static void simple(SimpleMachineBuilder builder, int tier) { builder.tier(tier) .langValue("%s %s %s".formatted(VLVH[tier], toEnglishName(builder.name), VLVT[tier])) - //.editableUI(SimpleTieredMachine.EDITABLE_UI_CREATOR.apply(GTCEu.id(builder.id.getPath()), recipeType)) + // .editableUI(SimpleTieredMachine.EDITABLE_UI_CREATOR.apply(GTCEu.id(builder.id.getPath()), + // recipeType)) .rotationState(RotationState.NON_Y_AXIS) - //.recipeType(recipeType) + // .recipeType(recipeType) .recipeModifier(GTRecipeModifiers.ELECTRIC_OVERCLOCK.apply(OverclockingLogic.NON_PERFECT_OVERCLOCK)) .workableTieredHullRenderer(GTCEu.id("block/machines/" + builder.name)) .tooltips(explosion()); - //.tooltips(workableTiered(tier, GTValues.V[tier], GTValues.V[tier] * 64, recipeType, tankScalingFunction.apply(tier), true)) + // .tooltips(workableTiered(tier, GTValues.V[tier], GTValues.V[tier] * 64, recipeType, + // tankScalingFunction.apply(tier), true)) } public static MachineBuilder create(String name, Object... args) { - SimpleMachineBuilder[] builders = simpleMachines(name, SimpleMachineBuilder::simple, MachineFunctionPresets.mapTierArray(args)); - return MachineFunctionPresets.builder(name, builders, SimpleMachineBuilder.class, MachineDefinition::createDefinition, MetaMachineBlock::new, MetaMachineBlockEntity::createBlockEntity); + SimpleMachineBuilder[] builders = simpleMachines(name, SimpleMachineBuilder::simple, + MachineFunctionPresets.mapTierArray(args)); + return MachineFunctionPresets.builder(name, builders, SimpleMachineBuilder.class, + MachineDefinition::createDefinition, MetaMachineBlock::new, MetaMachineBlockEntity::createBlockEntity); } } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/machine/SteamMachineBuilder.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/machine/SteamMachineBuilder.java index 6b908c143a..c3d0b322ee 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/machine/SteamMachineBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/machine/SteamMachineBuilder.java @@ -23,20 +23,24 @@ public class SteamMachineBuilder extends MachineBuilder { public SteamMachineBuilder(String id, boolean isHighPressure, Object... args) { - super(GTRegistration.REGISTRATE, id, MachineDefinition::createDefinition, holder -> new SimpleSteamMachine(holder, isHighPressure, args), MetaMachineBlock::new, MetaMachineItem::new, MetaMachineBlockEntity::createBlockEntity); + super(GTRegistration.REGISTRATE, id, MachineDefinition::createDefinition, + holder -> new SimpleSteamMachine(holder, isHighPressure, args), MetaMachineBlock::new, + MetaMachineItem::new, MetaMachineBlockEntity::createBlockEntity); } public static > void simple(T builder, int tier) { builder.langValue("%s %s %s".formatted(VLVH[tier], toEnglishName(builder.id.getPath()), VLVT[tier])) .rotationState(RotationState.NON_Y_AXIS) - //.recipeType(recipeType) + // .recipeType(recipeType) .recipeModifier(SimpleSteamMachine::recipeModifier) - .renderer(() -> new WorkableSteamMachineRenderer(tier > 0, GTCEu.id("block/machines/" + builder.id.getPath()))); + .renderer(() -> new WorkableSteamMachineRenderer(tier > 0, + GTCEu.id("block/machines/" + builder.id.getPath()))); } private static SteamMachineBuilder[] createBuilder(String name, boolean hasHighPressure, Object... args) { SteamMachineBuilder lp = new SteamMachineBuilder("lp_" + name, false, args); - return hasHighPressure ? new SteamMachineBuilder[] { lp, new SteamMachineBuilder("hp_" + name, true, args) } : new SteamMachineBuilder[] { lp }; + return hasHighPressure ? new SteamMachineBuilder[] { lp, new SteamMachineBuilder("hp_" + name, true, args) } : + new SteamMachineBuilder[] { lp }; } public static MachineBuilder createBoth(String name, Object... args) { @@ -56,6 +60,7 @@ public static MachineBuilder createBoth(String name, Object.. builders = createBuilder(name, true, args); } - return MachineFunctionPresets.builder(name, builders, SteamMachineBuilder.class, MachineDefinition::createDefinition, MetaMachineBlock::new, MetaMachineBlockEntity::createBlockEntity); + return MachineFunctionPresets.builder(name, builders, SteamMachineBuilder.class, + MachineDefinition::createDefinition, MetaMachineBlock::new, MetaMachineBlockEntity::createBlockEntity); } } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/prefix/BasicTagPrefixBuilder.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/prefix/BasicTagPrefixBuilder.java index cd7c96302d..2c73a432fe 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/prefix/BasicTagPrefixBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/prefix/BasicTagPrefixBuilder.java @@ -1,9 +1,11 @@ package com.gregtechceu.gtceu.integration.kjs.builders.prefix; import com.gregtechceu.gtceu.integration.kjs.built.KJSTagPrefix; + import net.minecraft.resources.ResourceLocation; public class BasicTagPrefixBuilder extends TagPrefixBuilder { + public BasicTagPrefixBuilder(ResourceLocation id, Object... args) { super(id, args); } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/prefix/OreTagPrefixBuilder.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/prefix/OreTagPrefixBuilder.java index fbfeb5399d..8d57aa176e 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/prefix/OreTagPrefixBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/prefix/OreTagPrefixBuilder.java @@ -3,21 +3,23 @@ import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.api.data.tag.TagPrefix; import com.gregtechceu.gtceu.common.data.GTBlocks; -import com.gregtechceu.gtceu.common.data.GTMaterials; import com.gregtechceu.gtceu.core.mixins.BlockBehaviourAccessor; import com.gregtechceu.gtceu.integration.kjs.built.KJSTagPrefix; -import lombok.Setter; -import lombok.experimental.Accessors; + import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; +import lombok.Setter; +import lombok.experimental.Accessors; + import java.util.function.Supplier; import static com.gregtechceu.gtceu.integration.kjs.Validator.*; @Accessors(fluent = true, chain = true) public class OreTagPrefixBuilder extends TagPrefixBuilder { + @Setter public transient Supplier stateSupplier; @Setter @@ -41,17 +43,19 @@ public OreTagPrefixBuilder(ResourceLocation id, Object... args) { public KJSTagPrefix create(String id) { return KJSTagPrefix.oreTagPrefix(id); } - + @Override public TagPrefix register() { validate(this.id, - errorIfNull(stateSupplier, "stateSupplier"), - onlySetDefault(templateProperties, () -> { - templateProperties = () -> GTBlocks.copy(((BlockBehaviourAccessor) stateSupplier.get().getBlock()).getBlockProperties(), BlockBehaviour.Properties.of()); - }), - errorIfNull(baseModelLocation, "baseModelLocation") - ); - - return value = base.registerOre(stateSupplier, materialSupplier, templateProperties, baseModelLocation, doubleDrops, isSand, shouldDropAsItem); + errorIfNull(stateSupplier, "stateSupplier"), + onlySetDefault(templateProperties, () -> { + templateProperties = () -> GTBlocks.copy( + ((BlockBehaviourAccessor) stateSupplier.get().getBlock()).getBlockProperties(), + BlockBehaviour.Properties.of()); + }), + errorIfNull(baseModelLocation, "baseModelLocation")); + + return value = base.registerOre(stateSupplier, materialSupplier, templateProperties, baseModelLocation, + doubleDrops, isSand, shouldDropAsItem); } } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/prefix/TagPrefixBuilder.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/prefix/TagPrefixBuilder.java index 18f4cd05ea..a22b89bdcc 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/prefix/TagPrefixBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/builders/prefix/TagPrefixBuilder.java @@ -6,8 +6,7 @@ import com.gregtechceu.gtceu.api.data.tag.TagPrefix; import com.gregtechceu.gtceu.api.registry.registrate.BuilderBase; import com.gregtechceu.gtceu.integration.kjs.built.KJSTagPrefix; -import lombok.Getter; -import lombok.experimental.Accessors; + import net.minecraft.core.registries.Registries; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; @@ -16,6 +15,9 @@ import net.minecraft.world.level.ItemLike; import net.minecraft.world.level.block.Block; +import lombok.Getter; +import lombok.experimental.Accessors; + import java.util.ArrayList; import java.util.List; import java.util.function.BiConsumer; @@ -25,6 +27,7 @@ @SuppressWarnings("unused") @Accessors(chain = true) public abstract class TagPrefixBuilder extends BuilderBase { + public final KJSTagPrefix base; @Getter diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/built/KJSTagPrefix.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/built/KJSTagPrefix.java index e436397a8b..d2bf2777f9 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/built/KJSTagPrefix.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/built/KJSTagPrefix.java @@ -4,10 +4,12 @@ import com.gregtechceu.gtceu.api.data.chemical.material.info.MaterialIconType; import com.gregtechceu.gtceu.api.data.tag.TagPrefix; import com.gregtechceu.gtceu.api.data.tag.TagType; -import lombok.experimental.Accessors; + import net.minecraft.tags.TagKey; import net.minecraft.world.item.Item; +import lombok.experimental.Accessors; + import java.util.function.BiFunction; import java.util.function.Predicate; @@ -22,13 +24,13 @@ public KJSTagPrefix(String name) { public static KJSTagPrefix oreTagPrefix(String name) { return new KJSTagPrefix(name) - .prefixTagPath("ores/%s/%s") - .defaultTagPath("ores/%s") - .prefixOnlyTagPath("ores_in_ground/%s") - .unformattedTagPath("ores") - .materialIconType(MaterialIconType.ore) - .unificationEnabled(true) - .generationCondition(hasOreProperty); + .prefixTagPath("ores/%s/%s") + .defaultTagPath("ores/%s") + .prefixOnlyTagPath("ores_in_ground/%s") + .unformattedTagPath("ores") + .materialIconType(MaterialIconType.ore) + .unificationEnabled(true) + .generationCondition(hasOreProperty); } @Override diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/events/GTBedrockOreVeinEventJS.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/events/GTBedrockOreVeinEventJS.java index 6c1f42f27a..afb2134346 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/events/GTBedrockOreVeinEventJS.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/events/GTBedrockOreVeinEventJS.java @@ -1,18 +1,17 @@ package com.gregtechceu.gtceu.integration.kjs.events; -import com.gregtechceu.gtceu.api.data.worldgen.bedrockfluid.BedrockFluidDefinition; import com.gregtechceu.gtceu.api.data.worldgen.bedrockore.BedrockOreDefinition; import com.gregtechceu.gtceu.api.registry.GTRegistries; -import dev.latvian.mods.kubejs.event.EventJS; + import net.minecraft.resources.ResourceLocation; +import dev.latvian.mods.kubejs.event.EventJS; + import java.util.function.Consumer; public class GTBedrockOreVeinEventJS extends EventJS { - public GTBedrockOreVeinEventJS() { - - } + public GTBedrockOreVeinEventJS() {} public void add(ResourceLocation id, Consumer consumer) { BedrockOreDefinition.Builder builder = BedrockOreDefinition.builder(id); diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/events/GTFluidVeinEventJS.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/events/GTFluidVeinEventJS.java index 4d45746832..b0f17b939e 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/events/GTFluidVeinEventJS.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/events/GTFluidVeinEventJS.java @@ -2,16 +2,16 @@ import com.gregtechceu.gtceu.api.data.worldgen.bedrockfluid.BedrockFluidDefinition; import com.gregtechceu.gtceu.api.registry.GTRegistries; -import dev.latvian.mods.kubejs.event.EventJS; + import net.minecraft.resources.ResourceLocation; +import dev.latvian.mods.kubejs.event.EventJS; + import java.util.function.Consumer; public class GTFluidVeinEventJS extends EventJS { - public GTFluidVeinEventJS() { - - } + public GTFluidVeinEventJS() {} public void add(ResourceLocation id, Consumer consumer) { BedrockFluidDefinition.Builder builder = BedrockFluidDefinition.builder(id); diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/events/GTOreVeinEventJS.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/events/GTOreVeinEventJS.java index 8f457c7463..33d0fb2861 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/events/GTOreVeinEventJS.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/events/GTOreVeinEventJS.java @@ -3,9 +3,11 @@ import com.gregtechceu.gtceu.api.data.worldgen.GTOreDefinition; import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.common.data.GTOres; -import dev.latvian.mods.kubejs.event.EventJS; + import net.minecraft.resources.ResourceLocation; +import dev.latvian.mods.kubejs.event.EventJS; + import java.util.Set; import java.util.function.BiConsumer; import java.util.function.BiPredicate; @@ -13,9 +15,7 @@ public class GTOreVeinEventJS extends EventJS { - public GTOreVeinEventJS() { - - } + public GTOreVeinEventJS() {} public void add(ResourceLocation id, Consumer consumer) { var vein = GTOres.blankOreDefinition(); diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/events/GTRegistryEventJS.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/events/GTRegistryEventJS.java index 7f41ca7596..1b01529471 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/events/GTRegistryEventJS.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/events/GTRegistryEventJS.java @@ -3,6 +3,7 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.registry.registrate.BuilderBase; import com.gregtechceu.gtceu.integration.kjs.GTRegistryInfo; + import dev.latvian.mods.kubejs.event.StartupEventJS; import dev.latvian.mods.kubejs.script.ScriptType; import dev.latvian.mods.kubejs.util.UtilsJS; @@ -10,6 +11,7 @@ import java.util.stream.Stream; public class GTRegistryEventJS extends StartupEventJS { + private final GTRegistryInfo registry; public GTRegistryEventJS(GTRegistryInfo r) { @@ -23,7 +25,8 @@ public BuilderBase create(String id, String type) { throw new IllegalArgumentException("Unknown type '" + type + "' for object '" + id + "'!"); } - var b = t.factory().createBuilder(UtilsJS.getMCID(ScriptType.STARTUP.manager.get().context, GTCEu.appendId(id))); + var b = t.factory() + .createBuilder(UtilsJS.getMCID(ScriptType.STARTUP.manager.get().context, GTCEu.appendId(id))); if (b == null) { throw new IllegalArgumentException("Unknown type '" + type + "' for object '" + id + "'!"); @@ -38,10 +41,14 @@ public BuilderBase create(String id, String type, Object... args) { var t = registry.types.get(type); if (t == null) { - return create(id, Stream.of(type, args).flatMap(arg -> arg instanceof Object[] array ? Stream.of(array) : Stream.of(arg)).map(Object.class::cast).toArray()); + return create(id, + Stream.of(type, args) + .flatMap(arg -> arg instanceof Object[] array ? Stream.of(array) : Stream.of(arg)) + .map(Object.class::cast).toArray()); } - var b = t.factory().createBuilder(UtilsJS.getMCID(ScriptType.STARTUP.manager.get().context, GTCEu.appendId(id)), args); + var b = t.factory().createBuilder(UtilsJS.getMCID(ScriptType.STARTUP.manager.get().context, GTCEu.appendId(id)), + args); if (b == null) { throw new IllegalArgumentException("Unknown type '" + type + "' for object '" + id + "'!"); @@ -56,10 +63,12 @@ public BuilderBase create(String id) { var t = registry.getDefaultType(); if (t == null) { - throw new IllegalArgumentException("Registry for type '" + registry.registryKey + "' doesn't have any builders registered!"); + throw new IllegalArgumentException( + "Registry for type '" + registry.registryKey + "' doesn't have any builders registered!"); } - var b = t.factory().createBuilder(UtilsJS.getMCID(ScriptType.STARTUP.manager.get().context, GTCEu.appendId(id))); + var b = t.factory() + .createBuilder(UtilsJS.getMCID(ScriptType.STARTUP.manager.get().context, GTCEu.appendId(id))); if (b == null) { throw new IllegalArgumentException("Unknown type '" + t.type() + "' for object '" + id + "'!"); @@ -74,10 +83,12 @@ public BuilderBase create(String id, Object... args) { var t = registry.getDefaultType(); if (t == null) { - throw new IllegalArgumentException("Registry for type '" + registry.registryKey + "' doesn't have any builders registered!"); + throw new IllegalArgumentException( + "Registry for type '" + registry.registryKey + "' doesn't have any builders registered!"); } - var b = t.factory().createBuilder(UtilsJS.getMCID(ScriptType.STARTUP.manager.get().context, GTCEu.appendIdString(id)), args); + var b = t.factory().createBuilder( + UtilsJS.getMCID(ScriptType.STARTUP.manager.get().context, GTCEu.appendIdString(id)), args); if (b == null) { throw new IllegalArgumentException("Unknown type '" + t.type() + "' for object '" + id + "'!"); diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/events/MaterialModificationEventJS.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/events/MaterialModificationEventJS.java index cd512911cb..c14e8cba6b 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/events/MaterialModificationEventJS.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/events/MaterialModificationEventJS.java @@ -5,5 +5,4 @@ /** * Modify any material here. */ -public class MaterialModificationEventJS extends StartupEventJS { -} +public class MaterialModificationEventJS extends StartupEventJS {} diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/helpers/MaterialStackWrapper.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/helpers/MaterialStackWrapper.java index 0578a8a251..ab7ee8ddac 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/helpers/MaterialStackWrapper.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/helpers/MaterialStackWrapper.java @@ -9,6 +9,7 @@ import java.util.function.Supplier; public record MaterialStackWrapper(Supplier material, long amount) { + private static final Map PARSE_CACHE = new WeakHashMap<>(); public static MaterialStackWrapper fromString(CharSequence str) { diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/GTRecipeSchema.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/GTRecipeSchema.java index bde6700cce..bf266f974d 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/GTRecipeSchema.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/GTRecipeSchema.java @@ -1,7 +1,5 @@ package com.gregtechceu.gtceu.integration.kjs.recipe; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.capability.recipe.*; import com.gregtechceu.gtceu.api.data.chemical.ChemicalHelper; @@ -25,8 +23,20 @@ import com.gregtechceu.gtceu.integration.kjs.recipe.components.CapabilityMap; import com.gregtechceu.gtceu.integration.kjs.recipe.components.GTRecipeComponents; import com.gregtechceu.gtceu.utils.ResearchManager; + import com.lowdragmc.lowdraglib.LDLib; -import com.lowdragmc.lowdraglib.side.fluid.FluidStack; + +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.Tag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.tags.TagKey; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.item.crafting.Recipe; + +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import dev.latvian.mods.kubejs.fluid.FluidStackJS; import dev.latvian.mods.kubejs.fluid.InputFluid; import dev.latvian.mods.kubejs.item.InputItem; @@ -40,14 +50,6 @@ import lombok.Getter; import lombok.Setter; import lombok.experimental.Accessors; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.Tag; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.tags.TagKey; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.crafting.Ingredient; -import net.minecraft.world.item.crafting.Recipe; import org.apache.commons.lang3.ArrayUtils; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -60,10 +62,11 @@ import java.util.function.UnaryOperator; public interface GTRecipeSchema { - - @SuppressWarnings({"unused", "UnusedReturnValue"}) + + @SuppressWarnings({ "unused", "UnusedReturnValue" }) @Accessors(chain = true, fluent = true) class GTRecipeJS extends RecipeJS { + @Setter public boolean perTick; @Setter @@ -83,14 +86,17 @@ class GTRecipeJS extends RecipeJS { @HideFromJS @Override public GTRecipeJS id(ResourceLocation _id) { - this.idWithoutType = new ResourceLocation(_id.getNamespace().equals("minecraft") ? this.type.id.getNamespace() : _id.getNamespace(), _id.getPath()); - this.id = new ResourceLocation(idWithoutType.getNamespace(), "%s/%s".formatted(this.type.id.getPath(), idWithoutType.getPath())); + this.idWithoutType = new ResourceLocation( + _id.getNamespace().equals("minecraft") ? this.type.id.getNamespace() : _id.getNamespace(), + _id.getPath()); + this.id = new ResourceLocation(idWithoutType.getNamespace(), + "%s/%s".formatted(this.type.id.getPath(), idWithoutType.getPath())); return this; } public GTRecipeJS input(RecipeCapability capability, Object... obj) { CapabilityMap map; - if (perTick) { + if (perTick) { if (getValue(ALL_TICK_INPUTS) == null) setValue(ALL_TICK_INPUTS, new CapabilityMap()); map = getValue(ALL_TICK_INPUTS); } else { @@ -108,7 +114,7 @@ public GTRecipeJS input(RecipeCapability capability, Object... obj) { public GTRecipeJS output(RecipeCapability capability, Object... obj) { CapabilityMap map; - if (perTick) { + if (perTick) { if (getValue(ALL_TICK_OUTPUTS) == null) setValue(ALL_TICK_OUTPUTS, new CapabilityMap()); map = getValue(ALL_TICK_OUTPUTS); } else { @@ -201,7 +207,12 @@ public GTRecipeJS inputItems(ItemStack... inputs) { throw new IllegalArgumentException(id + ": input items is empty"); } } - return input(ItemRecipeCapability.CAP, Arrays.stream(inputs).map(stack -> InputItem.of(SizedIngredient.create(stack.hasTag() ? NBTIngredient.createNBTIngredient(stack) : Ingredient.of(stack), stack.getCount()), stack.getCount())).toArray()); + return input(ItemRecipeCapability.CAP, + Arrays.stream(inputs) + .map(stack -> InputItem.of(SizedIngredient.create( + stack.hasTag() ? NBTIngredient.createNBTIngredient(stack) : Ingredient.of(stack), + stack.getCount()), stack.getCount())) + .toArray()); } public GTRecipeJS inputItems(TagKey tag, int amount) { @@ -341,7 +352,8 @@ public GTRecipeJS chancedInput(InputItem stack, int chance, int tierChanceBoost) public GTRecipeJS chancedOutput(OutputItem stack, int chance, int tierChanceBoost) { float lastChance = this.chance; float lastTierChanceBoost = this.tierChanceBoost; - this.chance = stack.hasChance() ? (float) (stack.getChance() > 1 ? stack.getChance() / 10000f : stack.getChance()) : chance / 10000f; + this.chance = stack.hasChance() ? + (float) (stack.getChance() > 1 ? stack.getChance() / 10000f : stack.getChance()) : chance / 10000f; this.tierChanceBoost = tierChanceBoost / 10000f; outputItems(stack); this.chance = lastChance; @@ -349,7 +361,8 @@ public GTRecipeJS chancedOutput(OutputItem stack, int chance, int tierChanceBoos return this; } - public GTRecipeJS chancedFluidInput(GTRecipeComponents.FluidIngredientJS stack, int chance, int tierChanceBoost) { + public GTRecipeJS chancedFluidInput(GTRecipeComponents.FluidIngredientJS stack, int chance, + int tierChanceBoost) { float lastChance = this.chance; float lastTierChanceBoost = this.tierChanceBoost; this.chance = chance / 10000f; @@ -396,7 +409,7 @@ public GTRecipeJS outputStress(float stress) { } ////////////////////////////////////// - //********** DATA ***********// + // ********** DATA ***********// ////////////////////////////////////// public GTRecipeJS addData(String key, Tag data) { if (getValue(DATA) == null) setValue(DATA, new CompoundTag()); @@ -477,7 +490,7 @@ public GTRecipeJS hideDuration(boolean hideDuration) { } ////////////////////////////////////// - //******* CONDITIONS ********// + // ******* CONDITIONS ********// ////////////////////////////////////// public GTRecipeJS cleanroom(CleanroomType cleanroomType) { @@ -540,12 +553,15 @@ private boolean applyResearchProperty(ResearchData.ResearchEntry researchEntry) } if (!generatingRecipes) { - GTCEu.LOGGER.error("Cannot generate recipes when using researchWithoutRecipe()", new IllegalArgumentException()); + GTCEu.LOGGER.error("Cannot generate recipes when using researchWithoutRecipe()", + new IllegalArgumentException()); return false; } if (getValue(CONDITIONS) == null) setValue(CONDITIONS, new RecipeCondition[0]); - ResearchCondition condition = Arrays.stream(this.getValue(CONDITIONS)).filter(ResearchCondition.class::isInstance).findAny().map(ResearchCondition.class::cast).orElse(null); + ResearchCondition condition = Arrays.stream(this.getValue(CONDITIONS)) + .filter(ResearchCondition.class::isInstance).findAny().map(ResearchCondition.class::cast) + .orElse(null); if (condition != null) { condition.data.add(researchEntry); } else { @@ -570,7 +586,7 @@ public GTRecipeJS researchWithoutRecipe(@NotNull String researchId) { * Does not generate a research recipe. * * @param researchId the researchId for the recipe - * @param dataStack the stack to hold the data. Must have the {@link IDataItem} behavior. + * @param dataStack the stack to hold the data. Must have the {@link IDataItem} behavior. * @return this */ public GTRecipeJS researchWithoutRecipe(@NotNull String researchId, @NotNull ItemStack dataStack) { @@ -583,7 +599,8 @@ public GTRecipeJS researchWithoutRecipe(@NotNull String researchId, @NotNull Ite * Generates a research recipe for the Scanner. */ public GTRecipeJS scannerResearch(UnaryOperator research) { - GTRecipeBuilder.ResearchRecipeEntry entry = research.apply(new ResearchRecipeBuilder.ScannerRecipeBuilder()).build(); + GTRecipeBuilder.ResearchRecipeEntry entry = research.apply(new ResearchRecipeBuilder.ScannerRecipeBuilder()) + .build(); if (applyResearchProperty(new ResearchData.ResearchEntry(entry.researchId(), entry.dataStack()))) { this.researchRecipeEntries.add(entry); } @@ -604,7 +621,8 @@ public GTRecipeJS scannerResearch(@NotNull ItemStack researchStack) { * Generates a research recipe for the Research Station. */ public GTRecipeJS stationResearch(UnaryOperator research) { - GTRecipeBuilder.ResearchRecipeEntry entry = research.apply(new ResearchRecipeBuilder.StationRecipeBuilder()).build(); + GTRecipeBuilder.ResearchRecipeEntry entry = research.apply(new ResearchRecipeBuilder.StationRecipeBuilder()) + .build(); if (applyResearchProperty(new ResearchData.ResearchEntry(entry.researchId(), entry.dataStack()))) { this.researchRecipeEntries.add(entry); } @@ -627,7 +645,8 @@ public InputItem readInputItem(Object from) { if (from instanceof SizedIngredient ingr) { return InputItem.of(ingr.getInner(), ingr.getAmount()); } else if (from instanceof JsonObject jsonObject) { - if (!jsonObject.has("type") || !jsonObject.get("type").getAsString().equals(SizedIngredient.TYPE.toString())) { + if (!jsonObject.has("type") || + !jsonObject.get("type").getAsString().equals(SizedIngredient.TYPE.toString())) { return InputItem.of(from); } var sizedIngredient = SizedIngredient.fromJson(jsonObject); @@ -642,9 +661,9 @@ public JsonElement writeInputItem(InputItem value) { @Override public OutputItem readOutputItem(Object from) { - if(from instanceof SizedIngredient ingredient) { + if (from instanceof SizedIngredient ingredient) { return OutputItem.of(ingredient.getInner().getItems()[0], Double.NaN); - } else if(from instanceof JsonObject jsonObject) { + } else if (from instanceof JsonObject jsonObject) { float chance = 1.0f; if (jsonObject.has("chance")) { chance = jsonObject.get("chance").getAsFloat(); @@ -665,7 +684,7 @@ public JsonElement writeOutputItem(OutputItem value) { @Override public JsonElement writeInputFluid(InputFluid value) { - var fluid = ((FluidStackJS)value).getFluidStack(); + var fluid = ((FluidStackJS) value).getFluidStack(); return FluidIngredient.of(fluid.getAmount(), fluid.getFluid()).toJson(); } @@ -678,7 +697,8 @@ public InputFluid readInputFluid(Object from) { RecipeKey ID = GTRecipeComponents.RESOURCE_LOCATION.key("id"); RecipeKey DURATION = TimeComponent.TICKS.key("duration").optional(100L); RecipeKey DATA = GTRecipeComponents.TAG.key("data").optional((CompoundTag) null); - RecipeKey CONDITIONS = GTRecipeComponents.RECIPE_CONDITION.asArray().key("recipeConditions").defaultOptional(); + RecipeKey CONDITIONS = GTRecipeComponents.RECIPE_CONDITION.asArray().key("recipeConditions") + .defaultOptional(); RecipeKey IS_FUEL = BooleanComponent.BOOLEAN.key("isFuel").optional(false); RecipeKey ALL_INPUTS = GTRecipeComponents.IN.key("inputs").defaultOptional(); @@ -687,9 +707,8 @@ public InputFluid readInputFluid(Object from) { RecipeKey ALL_OUTPUTS = GTRecipeComponents.OUT.key("outputs").defaultOptional(); RecipeKey ALL_TICK_OUTPUTS = GTRecipeComponents.TICK_OUT.key("tickOutputs").defaultOptional(); - RecipeSchema SCHEMA = new RecipeSchema(GTRecipeJS.class, GTRecipeJS::new, DURATION, DATA, CONDITIONS, ALL_INPUTS, ALL_TICK_INPUTS, ALL_OUTPUTS, ALL_TICK_OUTPUTS, IS_FUEL) + RecipeSchema SCHEMA = new RecipeSchema(GTRecipeJS.class, GTRecipeJS::new, DURATION, DATA, CONDITIONS, ALL_INPUTS, + ALL_TICK_INPUTS, ALL_OUTPUTS, ALL_TICK_OUTPUTS, IS_FUEL) .constructor((recipe, schemaType, keys, from) -> recipe.id(from.getValue(recipe, ID)), ID) .constructor(DURATION, CONDITIONS, ALL_INPUTS, ALL_OUTPUTS, ALL_TICK_INPUTS, ALL_TICK_OUTPUTS); - } - diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/components/CapabilityMap.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/components/CapabilityMap.java index 0e6fe7b727..3c73036a78 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/components/CapabilityMap.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/components/CapabilityMap.java @@ -2,6 +2,7 @@ import com.gregtechceu.gtceu.api.capability.recipe.RecipeCapability; import com.gregtechceu.gtceu.api.recipe.content.Content; + import dev.latvian.mods.kubejs.recipe.InputReplacement; import dev.latvian.mods.kubejs.recipe.OutputReplacement; import dev.latvian.mods.kubejs.recipe.RecipeJS; @@ -14,7 +15,8 @@ import java.util.concurrent.atomic.AtomicBoolean; @NoArgsConstructor -public class CapabilityMap extends IdentityHashMap, Content[]> implements InputReplacement, OutputReplacement { +public class CapabilityMap extends IdentityHashMap, Content[]> + implements InputReplacement, OutputReplacement { public CapabilityMap(Map, Content[]> m) { super(m); diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/components/CapabilityMapComponent.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/components/CapabilityMapComponent.java index 3b8b9bba19..6c1cb5c50d 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/components/CapabilityMapComponent.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/components/CapabilityMapComponent.java @@ -1,29 +1,31 @@ package com.gregtechceu.gtceu.integration.kjs.recipe.components; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; import com.gregtechceu.gtceu.api.capability.recipe.RecipeCapability; import com.gregtechceu.gtceu.api.recipe.content.Content; import com.gregtechceu.gtceu.api.registry.GTRegistries; + +import net.minecraft.util.GsonHelper; + +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import dev.latvian.mods.kubejs.recipe.InputReplacement; import dev.latvian.mods.kubejs.recipe.OutputReplacement; import dev.latvian.mods.kubejs.recipe.RecipeJS; import dev.latvian.mods.kubejs.recipe.ReplacementMatch; import dev.latvian.mods.kubejs.recipe.component.ComponentRole; import dev.latvian.mods.kubejs.recipe.component.RecipeComponent; -import net.minecraft.util.GsonHelper; import java.util.HashSet; import java.util.Set; public record CapabilityMapComponent(boolean isOutput) implements RecipeComponent { + @Override public ComponentRole role() { return isOutput ? ComponentRole.OUTPUT : ComponentRole.INPUT; } - @Override public boolean isOutput(RecipeJS recipe, CapabilityMap value, ReplacementMatch match) { return isOutput && value.isOutput(recipe, match); @@ -40,12 +42,14 @@ public Class componentClass() { } @Override - public CapabilityMap replaceInput(RecipeJS recipe, CapabilityMap original, ReplacementMatch match, InputReplacement with) { + public CapabilityMap replaceInput(RecipeJS recipe, CapabilityMap original, ReplacementMatch match, + InputReplacement with) { return isInput(recipe, original, match) ? read(recipe, original.replaceInput(recipe, match, with)) : original; } @Override - public CapabilityMap replaceOutput(RecipeJS recipe, CapabilityMap original, ReplacementMatch match, OutputReplacement with) { + public CapabilityMap replaceOutput(RecipeJS recipe, CapabilityMap original, ReplacementMatch match, + OutputReplacement with) { return isOutput(recipe, original, match) ? read(recipe, original.replaceOutput(recipe, match, with)) : original; } @@ -69,7 +73,8 @@ public CapabilityMap read(RecipeJS recipe, Object from) { CapabilityMap map = new CapabilityMap(); if (from instanceof JsonObject json) { for (String key : json.keySet()) { - if (GTRegistries.RECIPE_CAPABILITIES.containKey(key) && GTRegistries.RECIPE_CAPABILITIES.get(key) != null) { + if (GTRegistries.RECIPE_CAPABILITIES.containKey(key) && + GTRegistries.RECIPE_CAPABILITIES.get(key) != null) { RecipeCapability cap = GTRegistries.RECIPE_CAPABILITIES.get(key); var pair = GTRecipeComponents.VALID_CAPS.get(cap); Set result = new HashSet<>(); diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/components/ContentJS.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/components/ContentJS.java index eaf2d7d632..1c682a2f87 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/components/ContentJS.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/components/ContentJS.java @@ -1,19 +1,21 @@ package com.gregtechceu.gtceu.integration.kjs.recipe.components; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; import com.gregtechceu.gtceu.api.capability.recipe.RecipeCapability; import com.gregtechceu.gtceu.api.recipe.content.Content; + +import net.minecraft.util.GsonHelper; + +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import dev.latvian.mods.kubejs.recipe.InputReplacement; import dev.latvian.mods.kubejs.recipe.OutputReplacement; import dev.latvian.mods.kubejs.recipe.RecipeJS; import dev.latvian.mods.kubejs.recipe.ReplacementMatch; import dev.latvian.mods.kubejs.recipe.component.ComponentRole; import dev.latvian.mods.kubejs.recipe.component.RecipeComponent; -import dev.latvian.mods.kubejs.util.UtilsJS; -import net.minecraft.util.GsonHelper; -public record ContentJS(RecipeComponent baseComponent, RecipeCapability capability, boolean isOutput) implements RecipeComponent { +public record ContentJS(RecipeComponent baseComponent, RecipeCapability capability, boolean isOutput) + implements RecipeComponent { @Override public ComponentRole role() { @@ -66,11 +68,14 @@ public boolean isOutput(RecipeJS recipe, Content value, ReplacementMatch match) @Override public Content replaceInput(RecipeJS recipe, Content original, ReplacementMatch match, InputReplacement with) { - return isInput(recipe, original, match) ? new Content(baseComponent.replaceInput(recipe, baseComponent.read(recipe, original.content), match, with), original.chance, original.tierChanceBoost, original.slotName, original.uiName) : original; + return isInput(recipe, original, match) ? new Content( + baseComponent.replaceInput(recipe, baseComponent.read(recipe, original.content), match, with), + original.chance, original.tierChanceBoost, original.slotName, original.uiName) : original; } @Override public Content replaceOutput(RecipeJS recipe, Content original, ReplacementMatch match, OutputReplacement with) { - return isOutput(recipe, original, match) ? new Content(with.replaceOutput(recipe, match, with), original.chance, original.tierChanceBoost, original.slotName, original.uiName) : original; + return isOutput(recipe, original, match) ? new Content(with.replaceOutput(recipe, match, with), original.chance, + original.tierChanceBoost, original.slotName, original.uiName) : original; } } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/components/GTRecipeComponents.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/components/GTRecipeComponents.java index d19d74d388..150a5bae5d 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/components/GTRecipeComponents.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/components/GTRecipeComponents.java @@ -1,8 +1,5 @@ package com.gregtechceu.gtceu.integration.kjs.recipe.components; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonPrimitive; import com.gregtechceu.gtceu.api.addon.AddonFinder; import com.gregtechceu.gtceu.api.addon.events.KJSRecipeKeyEvent; import com.gregtechceu.gtceu.api.capability.recipe.*; @@ -10,7 +7,17 @@ import com.gregtechceu.gtceu.api.recipe.ingredient.FluidIngredient; import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.common.data.GTRecipeCapabilities; + import com.lowdragmc.lowdraglib.side.fluid.FluidStack; + +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.Tag; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.GsonHelper; + +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonPrimitive; import com.mojang.datafixers.util.Pair; import dev.latvian.mods.kubejs.fluid.FluidLike; import dev.latvian.mods.kubejs.fluid.FluidStackJS; @@ -24,16 +31,13 @@ import dev.latvian.mods.kubejs.typings.desc.TypeDescJS; import dev.latvian.mods.kubejs.util.ListJS; import dev.latvian.mods.rhino.mod.util.NBTUtils; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.Tag; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.GsonHelper; -import org.jetbrains.annotations.Nullable; import java.util.*; public class GTRecipeComponents { + public static final RecipeComponent TAG = new RecipeComponent<>() { + @Override public String componentType() { return "nbt"; @@ -55,6 +59,7 @@ public CompoundTag read(RecipeJS recipe, Object from) { } }; public static final RecipeComponent RESOURCE_LOCATION = new RecipeComponent<>() { + @Override public String componentType() { return "resource_location"; @@ -77,7 +82,8 @@ public JsonElement write(RecipeJS recipe, ResourceLocation value) { @Override public ResourceLocation read(RecipeJS recipe, Object from) { - return from instanceof CharSequence c ? ResourceLocation.tryParse(c.toString()) : ResourceLocation.tryParse(String.valueOf(from)); + return from instanceof CharSequence c ? ResourceLocation.tryParse(c.toString()) : + ResourceLocation.tryParse(String.valueOf(from)); } @Override @@ -87,6 +93,7 @@ public String toString() { }; public static final RecipeComponent RECIPE_CONDITION = new RecipeComponent<>() { + @Override public String componentType() { return "recipe_condition"; @@ -113,7 +120,8 @@ public RecipeCondition read(RecipeJS recipe, Object from) { if (clazz != null) { return RecipeCondition.create(clazz); } - } if (from instanceof JsonPrimitive primitive) { + } + if (from instanceof JsonPrimitive primitive) { var conditionKey = primitive.getAsString(); var clazz = GTRegistries.RECIPE_CONDITIONS.get(conditionKey); if (clazz != null) { @@ -140,6 +148,7 @@ public String toString() { } }; public static final RecipeComponent FLUID_INGREDIENT = new RecipeComponent<>() { + @Override public String componentType() { return "input_fluid"; @@ -171,6 +180,7 @@ public FluidIngredientJS read(RecipeJS recipe, Object from) { } }; public static final RecipeComponent FLUID_INGREDIENT_OUT = new RecipeComponent<>() { + @Override public String componentType() { return "output_fluid"; @@ -202,18 +212,26 @@ public FluidIngredientJS read(RecipeJS recipe, Object from) { } }; - - public static final ContentJS ITEM_IN = new ContentJS<>(ItemComponents.INPUT, GTRecipeCapabilities.ITEM, false); - public static final ContentJS ITEM_OUT = new ContentJS<>(ItemComponents.OUTPUT, GTRecipeCapabilities.ITEM, true); - public static final ContentJS FLUID_IN = new ContentJS<>(FLUID_INGREDIENT, GTRecipeCapabilities.FLUID, false); - public static final ContentJS FLUID_OUT = new ContentJS<>(FLUID_INGREDIENT_OUT, GTRecipeCapabilities.FLUID, true); - public static final ContentJS EU_IN = new ContentJS<>(NumberComponent.ANY_LONG, GTRecipeCapabilities.EU, false); - public static final ContentJS EU_OUT = new ContentJS<>(NumberComponent.ANY_LONG, GTRecipeCapabilities.EU, true); - public static final ContentJS SU_IN = new ContentJS<>(NumberComponent.ANY_FLOAT, GTRecipeCapabilities.SU, false); - public static final ContentJS SU_OUT = new ContentJS<>(NumberComponent.ANY_FLOAT, GTRecipeCapabilities.SU, true); - public static final ContentJS CWU_IN = new ContentJS<>(NumberComponent.ANY_INT, GTRecipeCapabilities.CWU, false); - public static final ContentJS CWU_OUT = new ContentJS<>(NumberComponent.ANY_INT, GTRecipeCapabilities.CWU, true); - + public static final ContentJS ITEM_IN = new ContentJS<>(ItemComponents.INPUT, GTRecipeCapabilities.ITEM, + false); + public static final ContentJS ITEM_OUT = new ContentJS<>(ItemComponents.OUTPUT, + GTRecipeCapabilities.ITEM, true); + public static final ContentJS FLUID_IN = new ContentJS<>(FLUID_INGREDIENT, + GTRecipeCapabilities.FLUID, false); + public static final ContentJS FLUID_OUT = new ContentJS<>(FLUID_INGREDIENT_OUT, + GTRecipeCapabilities.FLUID, true); + public static final ContentJS EU_IN = new ContentJS<>(NumberComponent.ANY_LONG, GTRecipeCapabilities.EU, + false); + public static final ContentJS EU_OUT = new ContentJS<>(NumberComponent.ANY_LONG, GTRecipeCapabilities.EU, + true); + public static final ContentJS SU_IN = new ContentJS<>(NumberComponent.ANY_FLOAT, GTRecipeCapabilities.SU, + false); + public static final ContentJS SU_OUT = new ContentJS<>(NumberComponent.ANY_FLOAT, GTRecipeCapabilities.SU, + true); + public static final ContentJS CWU_IN = new ContentJS<>(NumberComponent.ANY_INT, GTRecipeCapabilities.CWU, + false); + public static final ContentJS CWU_OUT = new ContentJS<>(NumberComponent.ANY_INT, GTRecipeCapabilities.CWU, + true); public static final CapabilityMapComponent IN = new CapabilityMapComponent(false); public static final CapabilityMapComponent TICK_IN = new CapabilityMapComponent(false); @@ -237,7 +255,6 @@ public FluidIngredientJS read(RecipeJS recipe, Object from) { VALID_CAPS.putAll(event.getRegisteredKeys()); } - public static class FluidIngredientJS implements InputFluid, OutputFluid { private final FluidIngredient ingredient; @@ -261,7 +278,8 @@ public FluidIngredientJS(FluidIngredient ingredient) { @Override public boolean matches(FluidLike other) { if (other instanceof FluidStackJS fluidStack) { - return ingredient.test(FluidStack.create(fluidStack.getFluid(), fluidStack.getAmount(), fluidStack.getNbt())); + return ingredient + .test(FluidStack.create(fluidStack.getFluid(), fluidStack.getAmount(), fluidStack.getNbt())); } return other.matches(this); } @@ -274,7 +292,8 @@ public static FluidIngredientJS of(Object o) { } else if (o instanceof JsonElement json) { return new FluidIngredientJS(FluidIngredient.fromJson(json)); } else if (o instanceof FluidStackJS fluidStackJS) { - return new FluidIngredientJS(FluidIngredient.of(FluidStack.create(fluidStackJS.getFluid(), fluidStackJS.getAmount(), fluidStackJS.getNbt()))); + return new FluidIngredientJS(FluidIngredient.of( + FluidStack.create(fluidStackJS.getFluid(), fluidStackJS.getAmount(), fluidStackJS.getNbt()))); } var list = ListJS.of(o); @@ -287,7 +306,8 @@ public static FluidIngredientJS of(Object o) { return new FluidIngredientJS(FluidIngredient.of(stacks.toArray(FluidStack[]::new))); } else { FluidStackJS stackJS = FluidStackJS.of(o); - return new FluidIngredientJS(FluidIngredient.of(FluidStack.create(stackJS.getFluid(), stackJS.getAmount(), stackJS.getNbt()))); + return new FluidIngredientJS(FluidIngredient + .of(FluidStack.create(stackJS.getFluid(), stackJS.getAmount(), stackJS.getNbt()))); } } } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ldlib/GTLDLibPlugin.java b/src/main/java/com/gregtechceu/gtceu/integration/ldlib/GTLDLibPlugin.java index 91227ec1b8..567c377850 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ldlib/GTLDLibPlugin.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ldlib/GTLDLibPlugin.java @@ -1,11 +1,13 @@ package com.gregtechceu.gtceu.integration.ldlib; import com.gregtechceu.gtceu.common.data.GTSyncedFieldAccessors; + import com.lowdragmc.lowdraglib.plugin.ILDLibPlugin; import com.lowdragmc.lowdraglib.plugin.LDLibPlugin; @LDLibPlugin public class GTLDLibPlugin implements ILDLibPlugin { + @Override public void onLoad() { GTSyncedFieldAccessors.init(); diff --git a/src/main/java/com/gregtechceu/gtceu/integration/rei/GTREIPlugin.java b/src/main/java/com/gregtechceu/gtceu/integration/rei/GTREIPlugin.java index c2bb578196..5272b725c3 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/rei/GTREIPlugin.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/rei/GTREIPlugin.java @@ -6,23 +6,25 @@ import com.gregtechceu.gtceu.api.machine.MachineDefinition; import com.gregtechceu.gtceu.api.recipe.GTRecipeType; import com.gregtechceu.gtceu.common.data.GTBlocks; -import com.gregtechceu.gtceu.common.data.GTItems; import com.gregtechceu.gtceu.common.data.GTMachines; +import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.integration.rei.multipage.MultiblockInfoDisplayCategory; import com.gregtechceu.gtceu.integration.rei.oreprocessing.GTOreProcessingDisplayCategory; import com.gregtechceu.gtceu.integration.rei.orevein.GTBedrockFluidDisplayCategory; import com.gregtechceu.gtceu.integration.rei.orevein.GTOreVeinDisplayCategory; import com.gregtechceu.gtceu.integration.rei.recipe.GTRecipeTypeDisplayCategory; + +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.network.chat.Component; +import net.minecraft.world.item.crafting.RecipeType; +import net.minecraft.world.level.ItemLike; + import me.shedaniel.rei.api.client.plugins.REIClientPlugin; import me.shedaniel.rei.api.client.registry.category.CategoryRegistry; import me.shedaniel.rei.api.client.registry.display.DisplayRegistry; import me.shedaniel.rei.api.client.registry.entry.CollapsibleEntryRegistry; import me.shedaniel.rei.api.common.util.EntryIngredients; import me.shedaniel.rei.api.common.util.EntryStacks; -import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.network.chat.Component; -import net.minecraft.world.item.crafting.RecipeType; -import net.minecraft.world.level.ItemLike; import java.util.ArrayList; import java.util.List; @@ -36,10 +38,12 @@ * @implNote REIPlugin */ public class GTREIPlugin implements REIClientPlugin { + @Override public void registerCategories(CategoryRegistry registry) { registry.add(new MultiblockInfoDisplayCategory()); - registry.add(new GTOreProcessingDisplayCategory()); + if (!ConfigHolder.INSTANCE.compat.hideOreProcessingDiagrams) + registry.add(new GTOreProcessingDisplayCategory()); registry.add(new GTOreVeinDisplayCategory()); registry.add(new GTBedrockFluidDisplayCategory()); for (RecipeType recipeType : BuiltInRegistries.RECIPE_TYPE) { @@ -52,7 +56,8 @@ public void registerCategories(CategoryRegistry registry) { // workstations MultiblockInfoDisplayCategory.registerWorkStations(registry); GTRecipeTypeDisplayCategory.registerWorkStations(registry); - GTOreProcessingDisplayCategory.registerWorkstations(registry); + if (!ConfigHolder.INSTANCE.compat.hideOreProcessingDiagrams) + GTOreProcessingDisplayCategory.registerWorkstations(registry); GTOreVeinDisplayCategory.registerWorkstations(registry); GTBedrockFluidDisplayCategory.registerWorkstations(registry); for (MachineDefinition definition : GTMachines.ELECTRIC_FURNACE) { @@ -70,7 +75,8 @@ public void registerCategories(CategoryRegistry registry) { public void registerDisplays(DisplayRegistry registry) { GTRecipeTypeDisplayCategory.registerDisplays(registry); MultiblockInfoDisplayCategory.registerDisplays(registry); - GTOreProcessingDisplayCategory.registerDisplays(registry); + if (!ConfigHolder.INSTANCE.compat.hideOreProcessingDiagrams) + GTOreProcessingDisplayCategory.registerDisplays(registry); GTOreVeinDisplayCategory.registerDisplays(registry); GTBedrockFluidDisplayCategory.registerDisplays(registry); } @@ -79,7 +85,9 @@ public void registerDisplays(DisplayRegistry registry) { @SuppressWarnings("UnstableApiUsage") public void registerCollapsibleEntries(CollapsibleEntryRegistry registry) { for (GTToolType toolType : GTToolType.getTypes().values()) { - registry.group(GTCEu.id("tool/" + toolType.name), Component.translatable("gtceu.tool.class." + toolType.name), EntryIngredients.ofItemTag(toolType.itemTags.get(0))); + registry.group(GTCEu.id("tool/" + toolType.name), + Component.translatable("gtceu.tool.class." + toolType.name), + EntryIngredients.ofItemTag(toolType.itemTags.get(0))); // EntryIngredients.ofItemStacks(GTItems.TOOL_ITEMS.column(toolType).values().stream().filter(Objects::nonNull).map(ItemProviderEntry::get).map(IGTTool::get).collect(Collectors.toSet())) } @@ -92,8 +100,8 @@ public void registerCollapsibleEntries(CollapsibleEntryRegistry registry) { for (var t : value.entrySet()) { var name = t.getKey().name; if (Objects.equals(name, TagPrefix.frameGt.name) || - Objects.equals(name, TagPrefix.block.name) || - Objects.equals(name, TagPrefix.rawOreBlock.name)) + Objects.equals(name, TagPrefix.block.name) || + Objects.equals(name, TagPrefix.rawOreBlock.name)) continue; items.add(t.getValue()); @@ -101,7 +109,8 @@ public void registerCollapsibleEntries(CollapsibleEntryRegistry registry) { var name = material.getName(); var label = ToUpperAllWords(name.replace("_", " ")); - registry.group(GTCEu.id("ore/" + name), Component.translatable("tagprefix.stone", label), EntryIngredients.ofItems(items)); + registry.group(GTCEu.id("ore/" + name), Component.translatable("tagprefix.stone", label), + EntryIngredients.ofItems(items)); } } @@ -109,7 +118,7 @@ private static String ToUpperAllWords(String text) { StringBuilder result = new StringBuilder(); result.append(text.substring(0, 1).toUpperCase()); for (int i = 1; i < text.length(); i++) { - if (" ".equals(text.substring(i-1, i))) + if (" ".equals(text.substring(i - 1, i))) result.append(text.substring(i, i + 1).toUpperCase()); else result.append(text.charAt(i)); diff --git a/src/main/java/com/gregtechceu/gtceu/integration/rei/forge/GTREIPluginImpl.java b/src/main/java/com/gregtechceu/gtceu/integration/rei/forge/GTREIPluginImpl.java index 2d28076dbf..709bb65636 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/rei/forge/GTREIPluginImpl.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/rei/forge/GTREIPluginImpl.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.integration.rei.forge; import com.gregtechceu.gtceu.integration.rei.GTREIPlugin; + import me.shedaniel.rei.forge.REIPluginClient; /** @@ -9,5 +10,4 @@ * @implNote REIPlugin */ @REIPluginClient -public class GTREIPluginImpl extends GTREIPlugin { -} +public class GTREIPluginImpl extends GTREIPlugin {} diff --git a/src/main/java/com/gregtechceu/gtceu/integration/rei/multipage/MultiblockInfoDisplay.java b/src/main/java/com/gregtechceu/gtceu/integration/rei/multipage/MultiblockInfoDisplay.java index 40a922aa89..89d21bee0c 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/rei/multipage/MultiblockInfoDisplay.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/rei/multipage/MultiblockInfoDisplay.java @@ -1,15 +1,17 @@ package com.gregtechceu.gtceu.integration.rei.multipage; - -import com.gregtechceu.gtceu.api.machine.MultiblockMachineDefinition; import com.gregtechceu.gtceu.api.gui.widget.PatternPreviewWidget; +import com.gregtechceu.gtceu.api.machine.MultiblockMachineDefinition; + import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.rei.ModularDisplay; + import net.minecraft.resources.ResourceLocation; import java.util.Optional; public class MultiblockInfoDisplay extends ModularDisplay { + public final MultiblockMachineDefinition definition; public MultiblockInfoDisplay(MultiblockMachineDefinition definition) { diff --git a/src/main/java/com/gregtechceu/gtceu/integration/rei/multipage/MultiblockInfoDisplayCategory.java b/src/main/java/com/gregtechceu/gtceu/integration/rei/multipage/MultiblockInfoDisplayCategory.java index a1e49bf8d7..901600477f 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/rei/multipage/MultiblockInfoDisplayCategory.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/rei/multipage/MultiblockInfoDisplayCategory.java @@ -2,20 +2,25 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.machine.MultiblockMachineDefinition; -import com.gregtechceu.gtceu.common.data.GTMachines; import com.gregtechceu.gtceu.api.registry.GTRegistries; +import com.gregtechceu.gtceu.common.data.GTMachines; + import com.lowdragmc.lowdraglib.gui.texture.ItemStackTexture; import com.lowdragmc.lowdraglib.rei.IGui2Renderer; import com.lowdragmc.lowdraglib.rei.ModularUIDisplayCategory; + +import net.minecraft.network.chat.Component; + import me.shedaniel.rei.api.client.gui.Renderer; import me.shedaniel.rei.api.client.registry.category.CategoryRegistry; import me.shedaniel.rei.api.client.registry.display.DisplayRegistry; import me.shedaniel.rei.api.common.category.CategoryIdentifier; import me.shedaniel.rei.api.common.util.EntryStacks; -import net.minecraft.network.chat.Component; public class MultiblockInfoDisplayCategory extends ModularUIDisplayCategory { - public static final CategoryIdentifier CATEGORY = CategoryIdentifier.of(GTCEu.id("multiblock_info")); + + public static final CategoryIdentifier CATEGORY = CategoryIdentifier + .of(GTCEu.id("multiblock_info")); private final Renderer icon; public MultiblockInfoDisplayCategory() { @@ -62,5 +67,4 @@ public Component getTitle() { public Renderer getIcon() { return icon; } - } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/rei/oreprocessing/GTOreProcessingDisplay.java b/src/main/java/com/gregtechceu/gtceu/integration/rei/oreprocessing/GTOreProcessingDisplay.java index ebfc0aa115..7dcbf578e6 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/rei/oreprocessing/GTOreProcessingDisplay.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/rei/oreprocessing/GTOreProcessingDisplay.java @@ -2,8 +2,10 @@ import com.gregtechceu.gtceu.api.data.chemical.material.Material; import com.gregtechceu.gtceu.integration.GTOreByProductWidget; + import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.rei.ModularDisplay; + import net.minecraft.resources.ResourceLocation; import java.util.Optional; diff --git a/src/main/java/com/gregtechceu/gtceu/integration/rei/oreprocessing/GTOreProcessingDisplayCategory.java b/src/main/java/com/gregtechceu/gtceu/integration/rei/oreprocessing/GTOreProcessingDisplayCategory.java index bb93593d9b..7396a3f968 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/rei/oreprocessing/GTOreProcessingDisplayCategory.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/rei/oreprocessing/GTOreProcessingDisplayCategory.java @@ -4,27 +4,30 @@ import com.gregtechceu.gtceu.api.GTCEuAPI; import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.data.chemical.material.Material; -import com.gregtechceu.gtceu.api.registry.GTRegistries; + import com.lowdragmc.lowdraglib.gui.texture.ItemStackTexture; import com.lowdragmc.lowdraglib.rei.IGui2Renderer; import com.lowdragmc.lowdraglib.rei.ModularUIDisplayCategory; import com.lowdragmc.lowdraglib.utils.Size; + +import net.minecraft.network.chat.Component; +import net.minecraft.world.level.block.Blocks; + import lombok.Getter; import me.shedaniel.rei.api.client.gui.Renderer; import me.shedaniel.rei.api.client.registry.category.CategoryRegistry; import me.shedaniel.rei.api.client.registry.display.DisplayRegistry; import me.shedaniel.rei.api.common.category.CategoryIdentifier; import me.shedaniel.rei.api.common.util.EntryStacks; -import net.minecraft.network.chat.Component; -import net.minecraft.world.level.block.Blocks; - import org.jetbrains.annotations.NotNull; import static com.gregtechceu.gtceu.api.data.chemical.material.properties.PropertyKey.ORE; import static com.gregtechceu.gtceu.common.data.GTMachines.*; public class GTOreProcessingDisplayCategory extends ModularUIDisplayCategory { - public static final CategoryIdentifier CATEGORY = CategoryIdentifier.of(GTCEu.id("ore_processing_diagram")); + + public static final CategoryIdentifier CATEGORY = CategoryIdentifier + .of(GTCEu.id("ore_processing_diagram")); @Getter private final Renderer icon; @@ -33,7 +36,7 @@ public class GTOreProcessingDisplayCategory extends ModularUIDisplayCategory { + private final BedrockFluidDefinition fluid; public GTBedrockFluidDisplay(BedrockFluidDefinition fluid) { diff --git a/src/main/java/com/gregtechceu/gtceu/integration/rei/orevein/GTBedrockFluidDisplayCategory.java b/src/main/java/com/gregtechceu/gtceu/integration/rei/orevein/GTBedrockFluidDisplayCategory.java index 4e9c92131a..a9bbdaabd7 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/rei/orevein/GTBedrockFluidDisplayCategory.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/rei/orevein/GTBedrockFluidDisplayCategory.java @@ -6,23 +6,27 @@ import com.gregtechceu.gtceu.common.data.GTItems; import com.gregtechceu.gtceu.common.data.GTMaterials; import com.gregtechceu.gtceu.integration.GTOreVeinWidget; + import com.lowdragmc.lowdraglib.gui.texture.ItemStackTexture; import com.lowdragmc.lowdraglib.rei.IGui2Renderer; import com.lowdragmc.lowdraglib.rei.ModularUIDisplayCategory; import com.lowdragmc.lowdraglib.utils.Size; + +import net.minecraft.network.chat.Component; + import lombok.Getter; import me.shedaniel.rei.api.client.gui.Renderer; import me.shedaniel.rei.api.client.registry.category.CategoryRegistry; import me.shedaniel.rei.api.client.registry.display.DisplayRegistry; import me.shedaniel.rei.api.common.category.CategoryIdentifier; import me.shedaniel.rei.api.common.util.EntryStacks; -import net.minecraft.network.chat.Component; - import org.jetbrains.annotations.NotNull; @Getter public class GTBedrockFluidDisplayCategory extends ModularUIDisplayCategory { - public static final CategoryIdentifier CATEGORY = CategoryIdentifier.of(GTCEu.id("bedrock_fluid_diagram")); + + public static final CategoryIdentifier CATEGORY = CategoryIdentifier + .of(GTCEu.id("bedrock_fluid_diagram")); private final Renderer icon; @@ -61,8 +65,11 @@ public static void registerDisplays(DisplayRegistry registry) { } public static void registerWorkstations(CategoryRegistry registry) { - registry.addWorkstations(GTBedrockFluidDisplayCategory.CATEGORY, EntryStacks.of(GTItems.PROSPECTOR_LV.asStack())); - registry.addWorkstations(GTBedrockFluidDisplayCategory.CATEGORY, EntryStacks.of(GTItems.PROSPECTOR_HV.asStack())); - registry.addWorkstations(GTBedrockFluidDisplayCategory.CATEGORY, EntryStacks.of(GTItems.PROSPECTOR_LUV.asStack())); + registry.addWorkstations(GTBedrockFluidDisplayCategory.CATEGORY, + EntryStacks.of(GTItems.PROSPECTOR_LV.asStack())); + registry.addWorkstations(GTBedrockFluidDisplayCategory.CATEGORY, + EntryStacks.of(GTItems.PROSPECTOR_HV.asStack())); + registry.addWorkstations(GTBedrockFluidDisplayCategory.CATEGORY, + EntryStacks.of(GTItems.PROSPECTOR_LUV.asStack())); } } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/rei/orevein/GTOreVeinDisplay.java b/src/main/java/com/gregtechceu/gtceu/integration/rei/orevein/GTOreVeinDisplay.java index 55536f4311..c509551fc9 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/rei/orevein/GTOreVeinDisplay.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/rei/orevein/GTOreVeinDisplay.java @@ -2,16 +2,20 @@ import com.gregtechceu.gtceu.api.data.worldgen.GTOreDefinition; import com.gregtechceu.gtceu.integration.GTOreVeinWidget; + import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.rei.ModularDisplay; + +import net.minecraft.world.item.ItemStack; + import me.shedaniel.rei.api.common.entry.EntryIngredient; import me.shedaniel.rei.api.common.util.EntryIngredients; -import net.minecraft.world.item.ItemStack; import java.util.ArrayList; import java.util.List; public class GTOreVeinDisplay extends ModularDisplay { + private final GTOreDefinition oreDefinition; public GTOreVeinDisplay(GTOreDefinition oreDefinition) { @@ -22,7 +26,7 @@ public GTOreVeinDisplay(GTOreDefinition oreDefinition) { @Override public List getOutputEntries() { List ingredients = new ArrayList<>(); - for (ItemStack outPut:GTOreVeinWidget.getContainedOresAndBlocks(oreDefinition)) { + for (ItemStack outPut : GTOreVeinWidget.getContainedOresAndBlocks(oreDefinition)) { ingredients.add(EntryIngredients.of(outPut)); } return ingredients; diff --git a/src/main/java/com/gregtechceu/gtceu/integration/rei/orevein/GTOreVeinDisplayCategory.java b/src/main/java/com/gregtechceu/gtceu/integration/rei/orevein/GTOreVeinDisplayCategory.java index 2547c6ff06..249e32df47 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/rei/orevein/GTOreVeinDisplayCategory.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/rei/orevein/GTOreVeinDisplayCategory.java @@ -5,24 +5,28 @@ import com.gregtechceu.gtceu.api.registry.GTRegistries; import com.gregtechceu.gtceu.common.data.GTItems; import com.gregtechceu.gtceu.integration.GTOreVeinWidget; + import com.lowdragmc.lowdraglib.gui.texture.ItemStackTexture; import com.lowdragmc.lowdraglib.rei.IGui2Renderer; import com.lowdragmc.lowdraglib.rei.ModularUIDisplayCategory; import com.lowdragmc.lowdraglib.utils.Size; + +import net.minecraft.network.chat.Component; +import net.minecraft.world.item.Items; + import lombok.Getter; import me.shedaniel.rei.api.client.gui.Renderer; import me.shedaniel.rei.api.client.registry.category.CategoryRegistry; import me.shedaniel.rei.api.client.registry.display.DisplayRegistry; import me.shedaniel.rei.api.common.category.CategoryIdentifier; import me.shedaniel.rei.api.common.util.EntryStacks; -import net.minecraft.network.chat.Component; -import net.minecraft.world.item.Items; - import org.jetbrains.annotations.NotNull; @Getter public class GTOreVeinDisplayCategory extends ModularUIDisplayCategory { - public static final CategoryIdentifier CATEGORY = CategoryIdentifier.of(GTCEu.id("ore_vein_diagram")); + + public static final CategoryIdentifier CATEGORY = CategoryIdentifier + .of(GTCEu.id("ore_vein_diagram")); private final Renderer icon; @@ -55,7 +59,7 @@ public Component getTitle() { } public static void registerDisplays(DisplayRegistry registry) { - for (GTOreDefinition oreDefinition : GTRegistries.ORE_VEINS){ + for (GTOreDefinition oreDefinition : GTRegistries.ORE_VEINS) { registry.add(new GTOreVeinDisplay(oreDefinition)); } } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/rei/recipe/GTRecipeDisplay.java b/src/main/java/com/gregtechceu/gtceu/integration/rei/recipe/GTRecipeDisplay.java index 8fc12f38db..f7acc0429f 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/rei/recipe/GTRecipeDisplay.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/rei/recipe/GTRecipeDisplay.java @@ -2,8 +2,10 @@ import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.integration.GTRecipeWidget; + import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.rei.ModularDisplay; + import net.minecraft.resources.ResourceLocation; import java.util.Optional; diff --git a/src/main/java/com/gregtechceu/gtceu/integration/rei/recipe/GTRecipeTypeDisplayCategory.java b/src/main/java/com/gregtechceu/gtceu/integration/rei/recipe/GTRecipeTypeDisplayCategory.java index 65eb44a466..dbc6e15ce9 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/rei/recipe/GTRecipeTypeDisplayCategory.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/rei/recipe/GTRecipeTypeDisplayCategory.java @@ -4,27 +4,32 @@ import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.GTRecipeType; import com.gregtechceu.gtceu.api.registry.GTRegistries; + import com.lowdragmc.lowdraglib.gui.texture.ItemStackTexture; import com.lowdragmc.lowdraglib.rei.IGui2Renderer; import com.lowdragmc.lowdraglib.rei.ModularUIDisplayCategory; import com.lowdragmc.lowdraglib.utils.Size; -import lombok.Getter; -import me.shedaniel.rei.api.client.gui.Renderer; -import me.shedaniel.rei.api.client.registry.category.CategoryRegistry; -import me.shedaniel.rei.api.client.registry.display.DisplayRegistry; -import me.shedaniel.rei.api.common.category.CategoryIdentifier; -import me.shedaniel.rei.api.common.util.EntryStacks; + import net.minecraft.Util; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.network.chat.Component; import net.minecraft.world.item.Items; import net.minecraft.world.item.crafting.RecipeType; +import lombok.Getter; +import me.shedaniel.rei.api.client.gui.Renderer; +import me.shedaniel.rei.api.client.registry.category.CategoryRegistry; +import me.shedaniel.rei.api.client.registry.display.DisplayRegistry; +import me.shedaniel.rei.api.common.category.CategoryIdentifier; +import me.shedaniel.rei.api.common.util.EntryStacks; import org.jetbrains.annotations.NotNull; + import java.util.function.Function; public class GTRecipeTypeDisplayCategory extends ModularUIDisplayCategory { - public static final Function> CATEGORIES = Util.memoize(recipeType -> CategoryIdentifier.of(recipeType.registryName)); + + public static final Function> CATEGORIES = Util + .memoize(recipeType -> CategoryIdentifier.of(recipeType.registryName)); private final GTRecipeType recipeType; @Getter @@ -76,14 +81,14 @@ public static void registerWorkStations(CategoryRegistry registry) { for (GTRecipeType gtRecipeType : GTRegistries.RECIPE_TYPES) { for (MachineDefinition machine : GTRegistries.MACHINES) { if (machine.getRecipeTypes() != null) { - for (GTRecipeType type : machine.getRecipeTypes()){ + for (GTRecipeType type : machine.getRecipeTypes()) { if (type == gtRecipeType) { - registry.addWorkstations(GTRecipeTypeDisplayCategory.CATEGORIES.apply(gtRecipeType), EntryStacks.of(machine.asStack())); + registry.addWorkstations(GTRecipeTypeDisplayCategory.CATEGORIES.apply(gtRecipeType), + EntryStacks.of(machine.asStack())); } } } } } } - } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/top/TheOneProbePlugin.java b/src/main/java/com/gregtechceu/gtceu/integration/top/TheOneProbePlugin.java index 1b4d77830e..395b7e03da 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/top/TheOneProbePlugin.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/top/TheOneProbePlugin.java @@ -1,25 +1,25 @@ package com.gregtechceu.gtceu.integration.top; import com.gregtechceu.gtceu.integration.top.provider.*; + import mcjty.theoneprobe.api.ITheOneProbe; public class TheOneProbePlugin { public static void init(ITheOneProbe oneProbe) { oneProbe.registerProvider(new ElectricContainerInfoProvider()); -// oneProbe.registerProvider(new FuelableInfoProvider()); + // oneProbe.registerProvider(new FuelableInfoProvider()); oneProbe.registerProvider(new WorkableInfoProvider()); oneProbe.registerProvider(new ControllableInfoProvider()); -// oneProbe.registerProvider(new DebugPipeNetInfoProvider()); -// oneProbe.registerProvider(new TransformerInfoProvider()); -// oneProbe.registerProvider(new DiodeInfoProvider()); -// oneProbe.registerProvider(new MultiblockInfoProvider()); -// oneProbe.registerProvider(new MaintenanceInfoProvider()); -// oneProbe.registerProvider(new MultiRecipeMapInfoProvider()); -// oneProbe.registerProvider(new ConverterInfoProvider()); + // oneProbe.registerProvider(new DebugPipeNetInfoProvider()); + // oneProbe.registerProvider(new TransformerInfoProvider()); + // oneProbe.registerProvider(new DiodeInfoProvider()); + // oneProbe.registerProvider(new MultiblockInfoProvider()); + // oneProbe.registerProvider(new MaintenanceInfoProvider()); + // oneProbe.registerProvider(new MultiRecipeMapInfoProvider()); + // oneProbe.registerProvider(new ConverterInfoProvider()); oneProbe.registerProvider(new RecipeLogicInfoProvider()); -// oneProbe.registerProvider(new PrimitivePumpInfoProvider()); + // oneProbe.registerProvider(new PrimitivePumpInfoProvider()); oneProbe.registerProvider(new CoverProvider()); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/top/forge/TheOneProbePluginImpl.java b/src/main/java/com/gregtechceu/gtceu/integration/top/forge/TheOneProbePluginImpl.java index 642e4bcc58..2790fa9cbf 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/top/forge/TheOneProbePluginImpl.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/top/forge/TheOneProbePluginImpl.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.integration.top.forge; import com.gregtechceu.gtceu.integration.top.TheOneProbePlugin; + import mcjty.theoneprobe.TheOneProbe; /** @@ -9,6 +10,7 @@ * @implNote TheOneProbePluginImpl */ public class TheOneProbePluginImpl { + public static void init() { TheOneProbePlugin.init(TheOneProbe.theOneProbeImp); } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/top/provider/CapabilityInfoProvider.java b/src/main/java/com/gregtechceu/gtceu/integration/top/provider/CapabilityInfoProvider.java index 7070622742..67681ee0dd 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/top/provider/CapabilityInfoProvider.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/top/provider/CapabilityInfoProvider.java @@ -1,9 +1,5 @@ package com.gregtechceu.gtceu.integration.top.provider; -import mcjty.theoneprobe.api.IProbeHitData; -import mcjty.theoneprobe.api.IProbeInfo; -import mcjty.theoneprobe.api.IProbeInfoProvider; -import mcjty.theoneprobe.api.ProbeMode; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.entity.player.Player; @@ -11,6 +7,10 @@ import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; +import mcjty.theoneprobe.api.IProbeHitData; +import mcjty.theoneprobe.api.IProbeInfo; +import mcjty.theoneprobe.api.IProbeInfoProvider; +import mcjty.theoneprobe.api.ProbeMode; import org.jetbrains.annotations.Nullable; public abstract class CapabilityInfoProvider implements IProbeInfoProvider { @@ -18,14 +18,16 @@ public abstract class CapabilityInfoProvider implements IProbeInfoProvider { @Nullable protected abstract T getCapability(Level level, BlockPos pos, @Nullable Direction side); - protected abstract void addProbeInfo(T capability, IProbeInfo probeInfo, Player player, BlockEntity blockEntity, IProbeHitData data); + protected abstract void addProbeInfo(T capability, IProbeInfo probeInfo, Player player, BlockEntity blockEntity, + IProbeHitData data); protected boolean allowDisplaying(T capability) { return true; } @Override - public void addProbeInfo(ProbeMode mode, IProbeInfo probeInfo, Player player, Level world, BlockState blockState, IProbeHitData data) { + public void addProbeInfo(ProbeMode mode, IProbeInfo probeInfo, Player player, Level world, BlockState blockState, + IProbeHitData data) { if (blockState.hasBlockEntity()) { BlockEntity blockEntity = world.getBlockEntity(data.getPos()); if (blockEntity == null) return; diff --git a/src/main/java/com/gregtechceu/gtceu/integration/top/provider/ControllableInfoProvider.java b/src/main/java/com/gregtechceu/gtceu/integration/top/provider/ControllableInfoProvider.java index 167dd0e790..64c7203de9 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/top/provider/ControllableInfoProvider.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/top/provider/ControllableInfoProvider.java @@ -3,20 +3,21 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.capability.GTCapabilityHelper; import com.gregtechceu.gtceu.api.capability.IControllable; -import mcjty.theoneprobe.api.CompoundText; -import mcjty.theoneprobe.api.IProbeHitData; -import mcjty.theoneprobe.api.IProbeInfo; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; + +import mcjty.theoneprobe.api.CompoundText; +import mcjty.theoneprobe.api.IProbeHitData; +import mcjty.theoneprobe.api.IProbeInfo; import org.jetbrains.annotations.Nullable; import static mcjty.theoneprobe.api.TextStyleClass.WARNING; - public class ControllableInfoProvider extends CapabilityInfoProvider { @Override @@ -31,7 +32,9 @@ protected IControllable getCapability(Level level, BlockPos pos, @Nullable Direc } @Override - protected void addProbeInfo(IControllable capability, IProbeInfo probeInfo, Player player, BlockEntity blockEntity, IProbeHitData data) { - if (!capability.isWorkingEnabled()) probeInfo.text(CompoundText.create().text("gtceu.top.working_disabled").style(WARNING)); + protected void addProbeInfo(IControllable capability, IProbeInfo probeInfo, Player player, BlockEntity blockEntity, + IProbeHitData data) { + if (!capability.isWorkingEnabled()) + probeInfo.text(CompoundText.create().text("gtceu.top.working_disabled").style(WARNING)); } } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/top/provider/CoverProvider.java b/src/main/java/com/gregtechceu/gtceu/integration/top/provider/CoverProvider.java index 4e61dae8fe..122960fef7 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/top/provider/CoverProvider.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/top/provider/CoverProvider.java @@ -4,8 +4,7 @@ import com.gregtechceu.gtceu.api.capability.GTCapabilityHelper; import com.gregtechceu.gtceu.api.capability.ICoverable; import com.gregtechceu.gtceu.api.cover.CoverBehavior; -import mcjty.theoneprobe.api.IProbeHitData; -import mcjty.theoneprobe.api.IProbeInfo; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.resources.ResourceLocation; @@ -13,6 +12,8 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; +import mcjty.theoneprobe.api.IProbeHitData; +import mcjty.theoneprobe.api.IProbeInfo; import org.jetbrains.annotations.Nullable; public class CoverProvider extends CapabilityInfoProvider { @@ -22,204 +23,219 @@ public ResourceLocation getID() { return GTCEu.id("coverable_provider"); } -// /** -// * Displays text for {@link CoverConveyor} related covers -// * -// * @param probeInfo the info to add the text to -// * @param conveyor the conveyor to get data from -// */ -// private static void conveyorInfo(@NotNull IProbeInfo probeInfo, @NotNull CoverConveyor conveyor) { -// String rateUnit = " {*cover.conveyor.transfer_rate*}"; -// -// if (conveyor instanceof CoverItemVoiding) { -// itemVoidingInfo(probeInfo, (CoverItemVoiding) conveyor); -// } else if (!(conveyor instanceof CoverRoboticArm) || ((CoverRoboticArm) conveyor).getTransferMode() == TransferMode.TRANSFER_ANY) { -// // only display the regular rate if the cover does not have a specialized rate -// transferRateText(probeInfo, conveyor.getConveyorMode(), rateUnit, conveyor.getTransferRate()); -// } -// -// ItemFilterContainer filter = conveyor.getItemFilterContainer(); -// if (conveyor instanceof CoverRoboticArm) { -// CoverRoboticArm roboticArm = (CoverRoboticArm) conveyor; -// transferModeText(probeInfo, roboticArm.getTransferMode(), rateUnit, filter.getTransferStackSize(), filter.getFilterWrapper().getItemFilter() != null); -// } -// itemFilterText(probeInfo, filter.getFilterWrapper().getItemFilter()); -// } -// -// /** -// * Displays info for {@link CoverItemVoiding} related covers -// * -// * @param probeInfo the info to add the text to -// * @param voiding the voiding cover to get data from -// */ -// private static void itemVoidingInfo(@NotNull IProbeInfo probeInfo, @NotNull CoverItemVoiding voiding) { -// String unit = " {*gtceu.top.unit.items*}"; -// -// ItemFilterContainer container = voiding.getItemFilterContainer(); -// if (voiding instanceof CoverItemVoidingAdvanced) { -// CoverItemVoidingAdvanced advanced = (CoverItemVoidingAdvanced) voiding; -// VoidingMode mode = advanced.getVoidingMode(); -// voidingText(probeInfo, mode, unit, container.getTransferStackSize(), container.getFilterWrapper().getItemFilter() != null); -// } -// } -// -// /** -// * Displays text for {@link CoverPump} related covers -// * -// * @param probeInfo the info to add the text to -// * @param pump the pump to get data from -// */ -// private static void pumpInfo(@NotNull IProbeInfo probeInfo, @NotNull CoverPump pump) { -// String rateUnit = IProbeInfo.STARTLOC + pump.getBucketMode().getName() + IProbeInfo.ENDLOC; -// -// if (pump instanceof CoverFluidVoiding) { -// fluidVoidingInfo(probeInfo, (CoverFluidVoiding) pump); -// } else if (!(pump instanceof CoverFluidRegulator) || ((CoverFluidRegulator) pump).getTransferMode() == TransferMode.TRANSFER_ANY) { -// // do not display the regular rate if the cover has a specialized rate -// transferRateText(probeInfo, pump.getPumpMode(), " " + rateUnit, pump.getBucketMode() == CoverPump.BucketMode.BUCKET ? pump.getTransferRate() / 1000 : pump.getTransferRate()); -// } -// -// FluidFilterContainer filter = pump.getFluidFilterContainer(); -// if (pump instanceof CoverFluidRegulator) { -// CoverFluidRegulator regulator = (CoverFluidRegulator) pump; -// transferModeText(probeInfo, regulator.getTransferMode(), rateUnit, regulator.getTransferAmount(), filter.getFilterWrapper().getFluidFilter() != null); -// } -// fluidFilterText(probeInfo, filter.getFilterWrapper().getFluidFilter()); -// } -// -// /** -// * Displays info for {@link CoverFluidVoiding} related covers -// * -// * @param probeInfo the info to add the text to -// * @param voiding the voiding cover to get data from -// */ -// private static void fluidVoidingInfo(@NotNull IProbeInfo probeInfo, @NotNull CoverFluidVoiding voiding) { -// String unit = voiding.getBucketMode() == CoverPump.BucketMode.BUCKET ? " {*gtceu.top.unit.fluid_buckets*}" : " {*gtceu.top.unit.fluid_milibuckets*}"; -// -// if (voiding instanceof CoverFluidVoidingAdvanced) { -// CoverFluidVoidingAdvanced advanced = (CoverFluidVoidingAdvanced) voiding; -// VoidingMode mode = advanced.getVoidingMode(); -// // do not display amount in overflow when a filter is present -// voidingText(probeInfo, mode, unit, voiding.getBucketMode() == CoverPump.BucketMode.BUCKET ? advanced.getTransferAmount() / 1000 : advanced.getTransferAmount(), voiding.getFluidFilterContainer().getFilterWrapper().getFluidFilter() != null); -// } -// } -// -// /** -// * Displays text for {@link CoverItemFilter} related covers -// * -// * @param probeInfo the info to add the text to -// * @param itemFilter the filter to get data from -// */ -// private static void itemFilterInfo(@NotNull IProbeInfo probeInfo, @NotNull CoverItemFilter itemFilter) { -// filterModeText(probeInfo, itemFilter.getFilterMode()); -// itemFilterText(probeInfo, itemFilter.getItemFilter().getItemFilter()); -// } -// -// /** -// * Displays text for {@link CoverFluidFilter} related covers -// * -// * @param probeInfo the info to add the text to -// * @param fluidFilter the filter to get data from -// */ -// private static void fluidFilterInfo(@NotNull IProbeInfo probeInfo, @NotNull CoverFluidFilter fluidFilter) { -// filterModeText(probeInfo, fluidFilter.getFilterMode()); -// fluidFilterText(probeInfo, fluidFilter.getFluidFilter().getFluidFilter()); -// } -// -// /** -// * Displays text for {@link CoverEnderFluidLink} related covers -// * -// * @param probeInfo the info to add the text to -// * @param enderFluidLink the ender fluid link cover to get data from -// */ -// private static void enderFluidLinkInfo(@NotNull IProbeInfo probeInfo, @NotNull CoverEnderFluidLink enderFluidLink) { -// transferRateText(probeInfo, enderFluidLink.getPumpMode(), " {*cover.bucket.mode.milli_bucket*}", enderFluidLink.isIOEnabled() ? CoverEnderFluidLink.TRANSFER_RATE : 0); -// fluidFilterText(probeInfo, enderFluidLink.getFluidFilterContainer().getFilterWrapper().getFluidFilter()); -// -// if (!enderFluidLink.getColorStr().isEmpty()) { -// probeInfo.text(TextStyleClass.INFO + "{*gtceu.top.link_cover.color*} " + enderFluidLink.getColorStr()); -// } -// } -// -// -// /** -// * Displays text for {@link IIOMode} covers -// * -// * @param probeInfo the info to add the text to -// * @param mode the transfer mode of the cover -// * @param rateUnit the unit of what is transferred -// * @param rate the transfer rate of the mode -// */ -// private static void transferRateText(@NotNull IProbeInfo probeInfo, @NotNull IIOMode mode, @NotNull String rateUnit, int rate) { -// String modeText = mode.isImport() ? "{*gtceu.top.mode.import*} " : "{*gtceu.top.mode.export*} "; -// probeInfo.text(TextStyleClass.OK + modeText + TextStyleClass.LABEL + GTUtility.formatNumbers(rate) + rateUnit); -// } -// -// /** -// * Displays text for {@link TransferMode} covers -// * -// * @param probeInfo the info to add the text to -// * @param mode the transfer mode of the cover -// * @param rateUnit the unit of what is transferred -// * @param rate the transfer rate of the mode -// * @param hasFilter whether the cover has a filter installed -// */ -// private static void transferModeText(@NotNull IProbeInfo probeInfo, @NotNull TransferMode mode, @NotNull String rateUnit, int rate, boolean hasFilter) { -// String text = TextStyleClass.OK + IProbeInfo.STARTLOC + mode.getName() + IProbeInfo.ENDLOC; -// if (!hasFilter && mode != TransferMode.TRANSFER_ANY) text += TextStyleClass.LABEL + " " + rate + rateUnit; -// probeInfo.text(text); -// } -// -// /** -// * Displays text for {@link VoidingMode} covers -// * -// * @param probeInfo the info to add the text to -// * @param mode the transfer mode of the cover -// * @param unit the unit of what is transferred -// * @param amount the transfer rate of the mode -// * @param hasFilter whether the cover has a filter in it or not -// */ -// private static void voidingText(@NotNull IProbeInfo probeInfo, @NotNull VoidingMode mode, @NotNull String unit, int amount, boolean hasFilter) { -// String text = TextFormatting.RED + IProbeInfo.STARTLOC + mode.getName() + IProbeInfo.ENDLOC; -// if (mode != VoidingMode.VOID_ANY && !hasFilter) text += " " + amount + unit; -// probeInfo.text(text); -// } -// -// /** -// * Displays text for {@link IFilterMode} covers -// * -// * @param probeInfo the info to add the text to -// * @param mode the filter mode of the cover -// */ -// private static void filterModeText(@NotNull IProbeInfo probeInfo, @NotNull IFilterMode mode) { -// probeInfo.text(TextStyleClass.WARNING + IProbeInfo.STARTLOC + mode.getName() + IProbeInfo.ENDLOC); -// } -// -// /** -// * Displays text for {@link ItemFilter} covers -// * -// * @param probeInfo the info to add the text to -// * @param filter the filter to display info from -// */ -// private static void itemFilterText(@NotNull IProbeInfo probeInfo, @Nullable ItemFilter filter) { -// String label = TextStyleClass.INFO + "{*gtceu.top.filter.label*} "; -// if (filter instanceof OreDictionaryItemFilter) { -// String expression = ((OreDictionaryItemFilter) filter).getOreDictFilterExpression(); -// if (!expression.isEmpty()) probeInfo.text(label + expression); -// } else if (filter instanceof SmartItemFilter) { -// probeInfo.text(label + IProbeInfo.STARTLOC + ((SmartItemFilter) filter).getFilteringMode().getName() + IProbeInfo.ENDLOC); -// } -// } -// -// /** -// * Displays text for {@link FluidFilter} covers -// * -// * @param probeInfo the info to add the text to -// * @param filter the filter to display info from -// */ -// private static void fluidFilterText(@NotNull IProbeInfo probeInfo, @Nullable FluidFilter filter) { -// // TODO If more unique fluid filtration is added, providers for it go here -// } + // /** + // * Displays text for {@link CoverConveyor} related covers + // * + // * @param probeInfo the info to add the text to + // * @param conveyor the conveyor to get data from + // */ + // private static void conveyorInfo(@NotNull IProbeInfo probeInfo, @NotNull CoverConveyor conveyor) { + // String rateUnit = " {*cover.conveyor.transfer_rate*}"; + // + // if (conveyor instanceof CoverItemVoiding) { + // itemVoidingInfo(probeInfo, (CoverItemVoiding) conveyor); + // } else if (!(conveyor instanceof CoverRoboticArm) || ((CoverRoboticArm) conveyor).getTransferMode() == + // TransferMode.TRANSFER_ANY) { + // // only display the regular rate if the cover does not have a specialized rate + // transferRateText(probeInfo, conveyor.getConveyorMode(), rateUnit, conveyor.getTransferRate()); + // } + // + // ItemFilterContainer filter = conveyor.getItemFilterContainer(); + // if (conveyor instanceof CoverRoboticArm) { + // CoverRoboticArm roboticArm = (CoverRoboticArm) conveyor; + // transferModeText(probeInfo, roboticArm.getTransferMode(), rateUnit, filter.getTransferStackSize(), + // filter.getFilterWrapper().getItemFilter() != null); + // } + // itemFilterText(probeInfo, filter.getFilterWrapper().getItemFilter()); + // } + // + // /** + // * Displays info for {@link CoverItemVoiding} related covers + // * + // * @param probeInfo the info to add the text to + // * @param voiding the voiding cover to get data from + // */ + // private static void itemVoidingInfo(@NotNull IProbeInfo probeInfo, @NotNull CoverItemVoiding voiding) { + // String unit = " {*gtceu.top.unit.items*}"; + // + // ItemFilterContainer container = voiding.getItemFilterContainer(); + // if (voiding instanceof CoverItemVoidingAdvanced) { + // CoverItemVoidingAdvanced advanced = (CoverItemVoidingAdvanced) voiding; + // VoidingMode mode = advanced.getVoidingMode(); + // voidingText(probeInfo, mode, unit, container.getTransferStackSize(), container.getFilterWrapper().getItemFilter() + // != null); + // } + // } + // + // /** + // * Displays text for {@link CoverPump} related covers + // * + // * @param probeInfo the info to add the text to + // * @param pump the pump to get data from + // */ + // private static void pumpInfo(@NotNull IProbeInfo probeInfo, @NotNull CoverPump pump) { + // String rateUnit = IProbeInfo.STARTLOC + pump.getBucketMode().getName() + IProbeInfo.ENDLOC; + // + // if (pump instanceof CoverFluidVoiding) { + // fluidVoidingInfo(probeInfo, (CoverFluidVoiding) pump); + // } else if (!(pump instanceof CoverFluidRegulator) || ((CoverFluidRegulator) pump).getTransferMode() == + // TransferMode.TRANSFER_ANY) { + // // do not display the regular rate if the cover has a specialized rate + // transferRateText(probeInfo, pump.getPumpMode(), " " + rateUnit, pump.getBucketMode() == + // CoverPump.BucketMode.BUCKET ? pump.getTransferRate() / 1000 : pump.getTransferRate()); + // } + // + // FluidFilterContainer filter = pump.getFluidFilterContainer(); + // if (pump instanceof CoverFluidRegulator) { + // CoverFluidRegulator regulator = (CoverFluidRegulator) pump; + // transferModeText(probeInfo, regulator.getTransferMode(), rateUnit, regulator.getTransferAmount(), + // filter.getFilterWrapper().getFluidFilter() != null); + // } + // fluidFilterText(probeInfo, filter.getFilterWrapper().getFluidFilter()); + // } + // + // /** + // * Displays info for {@link CoverFluidVoiding} related covers + // * + // * @param probeInfo the info to add the text to + // * @param voiding the voiding cover to get data from + // */ + // private static void fluidVoidingInfo(@NotNull IProbeInfo probeInfo, @NotNull CoverFluidVoiding voiding) { + // String unit = voiding.getBucketMode() == CoverPump.BucketMode.BUCKET ? " {*gtceu.top.unit.fluid_buckets*}" : " + // {*gtceu.top.unit.fluid_milibuckets*}"; + // + // if (voiding instanceof CoverFluidVoidingAdvanced) { + // CoverFluidVoidingAdvanced advanced = (CoverFluidVoidingAdvanced) voiding; + // VoidingMode mode = advanced.getVoidingMode(); + // // do not display amount in overflow when a filter is present + // voidingText(probeInfo, mode, unit, voiding.getBucketMode() == CoverPump.BucketMode.BUCKET ? + // advanced.getTransferAmount() / 1000 : advanced.getTransferAmount(), + // voiding.getFluidFilterContainer().getFilterWrapper().getFluidFilter() != null); + // } + // } + // + // /** + // * Displays text for {@link CoverItemFilter} related covers + // * + // * @param probeInfo the info to add the text to + // * @param itemFilter the filter to get data from + // */ + // private static void itemFilterInfo(@NotNull IProbeInfo probeInfo, @NotNull CoverItemFilter itemFilter) { + // filterModeText(probeInfo, itemFilter.getFilterMode()); + // itemFilterText(probeInfo, itemFilter.getItemFilter().getItemFilter()); + // } + // + // /** + // * Displays text for {@link CoverFluidFilter} related covers + // * + // * @param probeInfo the info to add the text to + // * @param fluidFilter the filter to get data from + // */ + // private static void fluidFilterInfo(@NotNull IProbeInfo probeInfo, @NotNull CoverFluidFilter fluidFilter) { + // filterModeText(probeInfo, fluidFilter.getFilterMode()); + // fluidFilterText(probeInfo, fluidFilter.getFluidFilter().getFluidFilter()); + // } + // + // /** + // * Displays text for {@link CoverEnderFluidLink} related covers + // * + // * @param probeInfo the info to add the text to + // * @param enderFluidLink the ender fluid link cover to get data from + // */ + // private static void enderFluidLinkInfo(@NotNull IProbeInfo probeInfo, @NotNull CoverEnderFluidLink + // enderFluidLink) { + // transferRateText(probeInfo, enderFluidLink.getPumpMode(), " {*cover.bucket.mode.milli_bucket*}", + // enderFluidLink.isIOEnabled() ? CoverEnderFluidLink.TRANSFER_RATE : 0); + // fluidFilterText(probeInfo, enderFluidLink.getFluidFilterContainer().getFilterWrapper().getFluidFilter()); + // + // if (!enderFluidLink.getColorStr().isEmpty()) { + // probeInfo.text(TextStyleClass.INFO + "{*gtceu.top.link_cover.color*} " + enderFluidLink.getColorStr()); + // } + // } + // + // + // /** + // * Displays text for {@link IIOMode} covers + // * + // * @param probeInfo the info to add the text to + // * @param mode the transfer mode of the cover + // * @param rateUnit the unit of what is transferred + // * @param rate the transfer rate of the mode + // */ + // private static void transferRateText(@NotNull IProbeInfo probeInfo, @NotNull IIOMode mode, @NotNull String + // rateUnit, int rate) { + // String modeText = mode.isImport() ? "{*gtceu.top.mode.import*} " : "{*gtceu.top.mode.export*} "; + // probeInfo.text(TextStyleClass.OK + modeText + TextStyleClass.LABEL + GTUtility.formatNumbers(rate) + rateUnit); + // } + // + // /** + // * Displays text for {@link TransferMode} covers + // * + // * @param probeInfo the info to add the text to + // * @param mode the transfer mode of the cover + // * @param rateUnit the unit of what is transferred + // * @param rate the transfer rate of the mode + // * @param hasFilter whether the cover has a filter installed + // */ + // private static void transferModeText(@NotNull IProbeInfo probeInfo, @NotNull TransferMode mode, @NotNull String + // rateUnit, int rate, boolean hasFilter) { + // String text = TextStyleClass.OK + IProbeInfo.STARTLOC + mode.getName() + IProbeInfo.ENDLOC; + // if (!hasFilter && mode != TransferMode.TRANSFER_ANY) text += TextStyleClass.LABEL + " " + rate + rateUnit; + // probeInfo.text(text); + // } + // + // /** + // * Displays text for {@link VoidingMode} covers + // * + // * @param probeInfo the info to add the text to + // * @param mode the transfer mode of the cover + // * @param unit the unit of what is transferred + // * @param amount the transfer rate of the mode + // * @param hasFilter whether the cover has a filter in it or not + // */ + // private static void voidingText(@NotNull IProbeInfo probeInfo, @NotNull VoidingMode mode, @NotNull String unit, + // int amount, boolean hasFilter) { + // String text = TextFormatting.RED + IProbeInfo.STARTLOC + mode.getName() + IProbeInfo.ENDLOC; + // if (mode != VoidingMode.VOID_ANY && !hasFilter) text += " " + amount + unit; + // probeInfo.text(text); + // } + // + // /** + // * Displays text for {@link IFilterMode} covers + // * + // * @param probeInfo the info to add the text to + // * @param mode the filter mode of the cover + // */ + // private static void filterModeText(@NotNull IProbeInfo probeInfo, @NotNull IFilterMode mode) { + // probeInfo.text(TextStyleClass.WARNING + IProbeInfo.STARTLOC + mode.getName() + IProbeInfo.ENDLOC); + // } + // + // /** + // * Displays text for {@link ItemFilter} covers + // * + // * @param probeInfo the info to add the text to + // * @param filter the filter to display info from + // */ + // private static void itemFilterText(@NotNull IProbeInfo probeInfo, @Nullable ItemFilter filter) { + // String label = TextStyleClass.INFO + "{*gtceu.top.filter.label*} "; + // if (filter instanceof OreDictionaryItemFilter) { + // String expression = ((OreDictionaryItemFilter) filter).getOreDictFilterExpression(); + // if (!expression.isEmpty()) probeInfo.text(label + expression); + // } else if (filter instanceof SmartItemFilter) { + // probeInfo.text(label + IProbeInfo.STARTLOC + ((SmartItemFilter) filter).getFilteringMode().getName() + + // IProbeInfo.ENDLOC); + // } + // } + // + // /** + // * Displays text for {@link FluidFilter} covers + // * + // * @param probeInfo the info to add the text to + // * @param filter the filter to display info from + // */ + // private static void fluidFilterText(@NotNull IProbeInfo probeInfo, @Nullable FluidFilter filter) { + // // TODO If more unique fluid filtration is added, providers for it go here + // } @Nullable @Override @@ -228,18 +244,19 @@ protected ICoverable getCapability(Level level, BlockPos pos, @org.jetbrains.ann } @Override - protected void addProbeInfo(ICoverable capability, IProbeInfo probeInfo, Player player, BlockEntity blockEntity, IProbeHitData data) { + protected void addProbeInfo(ICoverable capability, IProbeInfo probeInfo, Player player, BlockEntity blockEntity, + IProbeHitData data) { CoverBehavior coverBehavior = capability.getCoverAtSide(data.getSideHit()); -// if (coverBehavior instanceof CoverConveyor) { -// conveyorInfo(probeInfo, (CoverConveyor) coverBehavior); -// } else if (coverBehavior instanceof CoverPump) { -// pumpInfo(probeInfo, (CoverPump) coverBehavior); -// } else if (coverBehavior instanceof CoverItemFilter) { -// itemFilterInfo(probeInfo, (CoverItemFilter) coverBehavior); -// } else if (coverBehavior instanceof CoverFluidFilter) { -// fluidFilterInfo(probeInfo, (CoverFluidFilter) coverBehavior); -// } else if (coverBehavior instanceof CoverEnderFluidLink) { -// enderFluidLinkInfo(probeInfo, (CoverEnderFluidLink) coverBehavior); -// } + // if (coverBehavior instanceof CoverConveyor) { + // conveyorInfo(probeInfo, (CoverConveyor) coverBehavior); + // } else if (coverBehavior instanceof CoverPump) { + // pumpInfo(probeInfo, (CoverPump) coverBehavior); + // } else if (coverBehavior instanceof CoverItemFilter) { + // itemFilterInfo(probeInfo, (CoverItemFilter) coverBehavior); + // } else if (coverBehavior instanceof CoverFluidFilter) { + // fluidFilterInfo(probeInfo, (CoverFluidFilter) coverBehavior); + // } else if (coverBehavior instanceof CoverEnderFluidLink) { + // enderFluidLinkInfo(probeInfo, (CoverEnderFluidLink) coverBehavior); + // } } } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/top/provider/ElectricContainerInfoProvider.java b/src/main/java/com/gregtechceu/gtceu/integration/top/provider/ElectricContainerInfoProvider.java index 6e1fdc8846..ca6d2f7888 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/top/provider/ElectricContainerInfoProvider.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/top/provider/ElectricContainerInfoProvider.java @@ -3,8 +3,7 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.capability.GTCapabilityHelper; import com.gregtechceu.gtceu.api.capability.IEnergyContainer; -import mcjty.theoneprobe.api.IProbeHitData; -import mcjty.theoneprobe.api.IProbeInfo; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.network.chat.Component; @@ -12,9 +11,11 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; -import org.jetbrains.annotations.Nullable; +import mcjty.theoneprobe.api.IProbeHitData; +import mcjty.theoneprobe.api.IProbeInfo; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public class ElectricContainerInfoProvider extends CapabilityInfoProvider { @@ -30,7 +31,8 @@ protected IEnergyContainer getCapability(Level level, BlockPos pos, @Nullable Di } @Override - protected void addProbeInfo(IEnergyContainer capability, IProbeInfo probeInfo, Player player, BlockEntity blockEntity, IProbeHitData data) { + protected void addProbeInfo(IEnergyContainer capability, IProbeInfo probeInfo, Player player, + BlockEntity blockEntity, IProbeHitData data) { long maxStorage = capability.getEnergyCapacity(); if (maxStorage == 0) return; // do not add empty max storage progress bar probeInfo.progress(capability.getEnergyStored(), maxStorage, probeInfo.defaultProgressStyle() @@ -44,5 +46,4 @@ protected void addProbeInfo(IEnergyContainer capability, IProbeInfo probeInfo, P protected boolean allowDisplaying(@NotNull IEnergyContainer capability) { return !capability.isOneProbeHidden(); } - } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/top/provider/RecipeLogicInfoProvider.java b/src/main/java/com/gregtechceu/gtceu/integration/top/provider/RecipeLogicInfoProvider.java index a0414dba6f..1d38bd3f33 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/top/provider/RecipeLogicInfoProvider.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/top/provider/RecipeLogicInfoProvider.java @@ -8,11 +8,9 @@ import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; import com.gregtechceu.gtceu.api.recipe.RecipeHelper; import com.gregtechceu.gtceu.utils.GTUtil; + import com.lowdragmc.lowdraglib.utils.LocalizationUtils; -import mcjty.theoneprobe.api.CompoundText; -import mcjty.theoneprobe.api.IProbeHitData; -import mcjty.theoneprobe.api.IProbeInfo; -import mcjty.theoneprobe.api.TextStyleClass; + import net.minecraft.ChatFormatting; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -21,10 +19,12 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; -import org.jetbrains.annotations.Nullable; - -import static mcjty.theoneprobe.api.TextStyleClass.WARNING; +import mcjty.theoneprobe.api.CompoundText; +import mcjty.theoneprobe.api.IProbeHitData; +import mcjty.theoneprobe.api.IProbeInfo; +import mcjty.theoneprobe.api.TextStyleClass; +import org.jetbrains.annotations.Nullable; public class RecipeLogicInfoProvider extends CapabilityInfoProvider { @@ -40,13 +40,14 @@ protected RecipeLogic getCapability(Level level, BlockPos pos, @Nullable Directi } @Override - protected void addProbeInfo(RecipeLogic capability, IProbeInfo probeInfo, Player player, BlockEntity blockEntity, IProbeHitData data) { + protected void addProbeInfo(RecipeLogic capability, IProbeInfo probeInfo, Player player, BlockEntity blockEntity, + IProbeHitData data) { // do not show energy usage on machines that do not use energy if (capability.isWorking()) { // TODO PrimitiveRecipeLogic -// if (capability instanceof PrimitiveRecipeLogic) { -// return; // do not show info for primitive machines, as they are supposed to appear powerless -// } + // if (capability instanceof PrimitiveRecipeLogic) { + // return; // do not show info for primitive machines, as they are supposed to appear powerless + // } var recipe = capability.getLastRecipe(); if (recipe != null) { var EUt = RecipeHelper.getInputEUt(recipe); @@ -61,20 +62,28 @@ protected void addProbeInfo(RecipeLogic capability, IProbeInfo probeInfo, Player if (blockEntity instanceof IMachineBlockEntity machineBlockEntity) { var machine = machineBlockEntity.getMetaMachine(); if (machine instanceof SteamMachine) { - text = ChatFormatting.RED.toString() + absEUt + TextStyleClass.INFO + " L/t " + LocalizationUtils.format("material.steam"); + text = ChatFormatting.RED.toString() + absEUt + TextStyleClass.INFO + " L/t " + + LocalizationUtils.format("material.steam"); } } if (text == null) { - // Default behavior, if this TE is not a steam machine (or somehow not instanceof IGregTechTileEntity...) - text = ChatFormatting.RED.toString() + absEUt + TextStyleClass.INFO + " EU/t" + ChatFormatting.GREEN + " (" + GTValues.VNF[GTUtil.getTierByVoltage(absEUt)] + ChatFormatting.GREEN + ")"; + // Default behavior, if this TE is not a steam machine (or somehow not instanceof + // IGregTechTileEntity...) + text = ChatFormatting.RED.toString() + absEUt + TextStyleClass.INFO + " EU/t" + + ChatFormatting.GREEN + " (" + GTValues.VNF[GTUtil.getTierByVoltage(absEUt)] + + ChatFormatting.GREEN + ")"; } if (EUt > 0) { if (isInput) { - probeInfo.text(CompoundText.create().text(Component.translatable("gtceu.top.energy_consumption").append(" ").append(text)).style(TextStyleClass.INFO)); + probeInfo.text(CompoundText.create() + .text(Component.translatable("gtceu.top.energy_consumption").append(" ").append(text)) + .style(TextStyleClass.INFO)); } else { - probeInfo.text(CompoundText.create().text(Component.translatable("gtceu.top.energy_production").append(" ").append(text)).style(TextStyleClass.INFO)); + probeInfo.text(CompoundText.create() + .text(Component.translatable("gtceu.top.energy_production").append(" ").append(text)) + .style(TextStyleClass.INFO)); } } } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/top/provider/WorkableInfoProvider.java b/src/main/java/com/gregtechceu/gtceu/integration/top/provider/WorkableInfoProvider.java index cdabeb829a..66130a8f78 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/top/provider/WorkableInfoProvider.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/top/provider/WorkableInfoProvider.java @@ -4,8 +4,7 @@ import com.gregtechceu.gtceu.api.capability.GTCapabilityHelper; import com.gregtechceu.gtceu.api.capability.IWorkable; import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic; -import mcjty.theoneprobe.api.IProbeHitData; -import mcjty.theoneprobe.api.IProbeInfo; + import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.network.chat.Component; @@ -13,6 +12,9 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; + +import mcjty.theoneprobe.api.IProbeHitData; +import mcjty.theoneprobe.api.IProbeInfo; import org.jetbrains.annotations.Nullable; public class WorkableInfoProvider extends CapabilityInfoProvider { @@ -29,7 +31,8 @@ protected IWorkable getCapability(Level level, BlockPos pos, @Nullable Direction } @Override - protected void addProbeInfo(IWorkable capability, IProbeInfo probeInfo, Player player, BlockEntity blockEntity, IProbeHitData data) { + protected void addProbeInfo(IWorkable capability, IProbeInfo probeInfo, Player player, BlockEntity blockEntity, + IProbeHitData data) { if (!capability.isActive()) return; int currentProgress = capability.getProgress(); @@ -37,8 +40,8 @@ protected void addProbeInfo(IWorkable capability, IProbeInfo probeInfo, Player p Component text; if (capability instanceof RecipeLogic logic && - logic.getLastRecipe() != null && - logic.getLastRecipe().data.getBoolean("duration_is_total_cwu")) { + logic.getLastRecipe() != null && + logic.getLastRecipe().data.getBoolean("duration_is_total_cwu")) { // show as total computation instead int color = capability.isWorkingEnabled() ? 0xFF00D4CE : 0xFFBB1C28; probeInfo.progress(currentProgress, maxProgress, probeInfo.defaultProgressStyle() diff --git a/src/main/java/com/gregtechceu/gtceu/syncdata/GTRecipeAccessor.java b/src/main/java/com/gregtechceu/gtceu/syncdata/GTRecipeAccessor.java index 89d7d3f211..7f16e440fc 100644 --- a/src/main/java/com/gregtechceu/gtceu/syncdata/GTRecipeAccessor.java +++ b/src/main/java/com/gregtechceu/gtceu/syncdata/GTRecipeAccessor.java @@ -2,14 +2,17 @@ import com.gregtechceu.gtceu.api.recipe.GTRecipe; import com.gregtechceu.gtceu.api.recipe.GTRecipeSerializer; + import com.lowdragmc.lowdraglib.syncdata.AccessorOp; import com.lowdragmc.lowdraglib.syncdata.accessor.CustomObjectAccessor; import com.lowdragmc.lowdraglib.syncdata.payload.FriendlyBufPayload; import com.lowdragmc.lowdraglib.syncdata.payload.ITypedPayload; -import io.netty.buffer.Unpooled; + import net.minecraft.network.FriendlyByteBuf; import net.minecraft.resources.ResourceLocation; +import io.netty.buffer.Unpooled; + /** * @author KilaBash * @date 2023/2/18 diff --git a/src/main/java/com/gregtechceu/gtceu/syncdata/GTRecipeTypeAccessor.java b/src/main/java/com/gregtechceu/gtceu/syncdata/GTRecipeTypeAccessor.java index 4a28460e27..c97eb050d1 100644 --- a/src/main/java/com/gregtechceu/gtceu/syncdata/GTRecipeTypeAccessor.java +++ b/src/main/java/com/gregtechceu/gtceu/syncdata/GTRecipeTypeAccessor.java @@ -2,13 +2,16 @@ import com.gregtechceu.gtceu.api.recipe.GTRecipeType; import com.gregtechceu.gtceu.api.registry.GTRegistries; + import com.lowdragmc.lowdraglib.syncdata.AccessorOp; import com.lowdragmc.lowdraglib.syncdata.accessor.CustomObjectAccessor; import com.lowdragmc.lowdraglib.syncdata.payload.FriendlyBufPayload; import com.lowdragmc.lowdraglib.syncdata.payload.ITypedPayload; -import io.netty.buffer.Unpooled; + import net.minecraft.network.FriendlyByteBuf; +import io.netty.buffer.Unpooled; + /** * @author Screret * @implNote GTRecipeTypeAccessor diff --git a/src/main/java/com/gregtechceu/gtceu/test/GTGameTests.java b/src/main/java/com/gregtechceu/gtceu/test/GTGameTests.java index fb1d9fffea..09b88ed06c 100644 --- a/src/main/java/com/gregtechceu/gtceu/test/GTGameTests.java +++ b/src/main/java/com/gregtechceu/gtceu/test/GTGameTests.java @@ -3,18 +3,21 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.test.api.machine.trait.ParallelLogicTest; import com.gregtechceu.gtceu.test.api.machine.trait.RecipeLogicTest; -import com.mojang.datafixers.util.Pair; + import net.minecraft.gametest.framework.GameTest; import net.minecraft.gametest.framework.GameTestGenerator; import net.minecraft.gametest.framework.TestFunction; import net.minecraft.world.level.block.Rotation; +import com.mojang.datafixers.util.Pair; + import java.lang.reflect.Modifier; import java.util.Collection; import java.util.Comparator; import java.util.stream.Stream; public class GTGameTests { + private static final Class[] testHolders = { RecipeLogicTest.class, ParallelLogicTest.class @@ -33,7 +36,8 @@ public static Collection getTestsFrom(Class... classes) { .map(method -> Pair.of(method, method.getAnnotation(GameTest.class))) .map(method -> new TestFunction( "gtceu", - GTCEu.MOD_ID + "." + method.getFirst().getDeclaringClass().getSimpleName() + "." + method.getFirst().getName(), + GTCEu.MOD_ID + "." + method.getFirst().getDeclaringClass().getSimpleName() + "." + + method.getFirst().getName(), method.getSecond().template(), Rotation.NONE, method.getSecond().timeoutTicks(), diff --git a/src/main/java/com/gregtechceu/gtceu/test/api/machine/trait/ParallelLogicTest.java b/src/main/java/com/gregtechceu/gtceu/test/api/machine/trait/ParallelLogicTest.java index a074f36eac..53ae186f0b 100644 --- a/src/main/java/com/gregtechceu/gtceu/test/api/machine/trait/ParallelLogicTest.java +++ b/src/main/java/com/gregtechceu/gtceu/test/api/machine/trait/ParallelLogicTest.java @@ -10,8 +10,10 @@ import com.gregtechceu.gtceu.common.data.GTMaterials; import com.gregtechceu.gtceu.common.data.GTRecipeModifiers; import com.gregtechceu.gtceu.data.recipe.builder.GTRecipeBuilder; + import com.lowdragmc.lowdraglib.side.fluid.IFluidTransfer; import com.lowdragmc.lowdraglib.side.item.IItemTransfer; + import net.minecraft.core.BlockPos; import net.minecraft.gametest.framework.GameTest; import net.minecraft.gametest.framework.GameTestHelper; @@ -45,12 +47,15 @@ public void getMaxRecipeMultiplier_FluidLimitTest(GameTestHelper helper) { .EUt(30).duration(100) .buildRawRecipe(); - ((IItemTransfer)rlm.getCapabilitiesProxy().get(IO.IN, ItemRecipeCapability.CAP)).insertItem(0, new ItemStack(Blocks.COBBLESTONE, 16), false); - ((IFluidTransfer)rlm.getCapabilitiesProxy().get(IO.IN, FluidRecipeCapability.CAP)).fill(GTMaterials.Acetone.getFluid(8000), false); + ((IItemTransfer) rlm.getCapabilitiesProxy().get(IO.IN, ItemRecipeCapability.CAP)).insertItem(0, + new ItemStack(Blocks.COBBLESTONE, 16), false); + ((IFluidTransfer) rlm.getCapabilitiesProxy().get(IO.IN, FluidRecipeCapability.CAP)) + .fill(GTMaterials.Acetone.getFluid(8000), false); var paralleled = GTRecipeModifiers.accurateParallel(machine, recipe, parallelLimit, false); - helper.assertTrue(paralleled.getSecond() == 2,"Expected Parallel amount to be 2, is %s.".formatted(paralleled.getSecond())); + helper.assertTrue(paralleled.getSecond() == 2, + "Expected Parallel amount to be 2, is %s.".formatted(paralleled.getSecond())); helper.succeed(); } @@ -79,12 +84,15 @@ public void getMaxRecipeMultiplier_LimitFailureTest(GameTestHelper helper) { .EUt(30).duration(100) .buildRawRecipe(); - ((IItemTransfer)rlm.getCapabilitiesProxy().get(IO.IN, ItemRecipeCapability.CAP)).insertItem(0, new ItemStack(Blocks.COBBLESTONE, 16), false); - ((IFluidTransfer)rlm.getCapabilitiesProxy().get(IO.IN, FluidRecipeCapability.CAP)).fill(GTMaterials.Acetone.getFluid(8000), false); + ((IItemTransfer) rlm.getCapabilitiesProxy().get(IO.IN, ItemRecipeCapability.CAP)).insertItem(0, + new ItemStack(Blocks.COBBLESTONE, 16), false); + ((IFluidTransfer) rlm.getCapabilitiesProxy().get(IO.IN, FluidRecipeCapability.CAP)) + .fill(GTMaterials.Acetone.getFluid(8000), false); var paralleled = GTRecipeModifiers.accurateParallel(machine, recipe, parallelLimit, false); - helper.assertTrue(paralleled == null || paralleled.getSecond() == 0, "Parallel is too high, should be 0, is %s.".formatted(paralleled.getSecond())); + helper.assertTrue(paralleled == null || paralleled.getSecond() == 0, + "Parallel is too high, should be 0, is %s.".formatted(paralleled.getSecond())); helper.succeed(); } @@ -113,15 +121,19 @@ public void getMaxRecipeMultiplier_ItemFailureTest(GameTestHelper helper) { .EUt(30).duration(100) .buildRawRecipe(); - ((IItemTransfer)rlm.getCapabilitiesProxy().get(IO.IN, ItemRecipeCapability.CAP)).insertItem(0, new ItemStack(Blocks.COBBLESTONE, 16), false); - ((IFluidTransfer)rlm.getCapabilitiesProxy().get(IO.IN, FluidRecipeCapability.CAP)).fill(GTMaterials.Naphtha.getFluid(8000), false); + ((IItemTransfer) rlm.getCapabilitiesProxy().get(IO.IN, ItemRecipeCapability.CAP)).insertItem(0, + new ItemStack(Blocks.COBBLESTONE, 16), false); + ((IFluidTransfer) rlm.getCapabilitiesProxy().get(IO.IN, FluidRecipeCapability.CAP)) + .fill(GTMaterials.Naphtha.getFluid(8000), false); var paralleled = GTRecipeModifiers.accurateParallel(machine, recipe, parallelLimit, false); - helper.assertTrue(paralleled == null || paralleled.getSecond() == 0, "Parallel is too high, should be 0, is %s.".formatted(paralleled.getSecond())); + helper.assertTrue(paralleled == null || paralleled.getSecond() == 0, + "Parallel is too high, should be 0, is %s.".formatted(paralleled.getSecond())); helper.succeed(); } - // TODO add the rest of https://github.com/GregTechCEu/GregTech/blob/master/src/test/java/gregtech/api/recipes/logic/ParallelLogicTest.java. + // TODO add the rest of + // https://github.com/GregTechCEu/GregTech/blob/master/src/test/java/gregtech/api/recipes/logic/ParallelLogicTest.java. } diff --git a/src/main/java/com/gregtechceu/gtceu/test/api/machine/trait/RecipeLogicTest.java b/src/main/java/com/gregtechceu/gtceu/test/api/machine/trait/RecipeLogicTest.java index cee4b6c7ff..7d9847c43d 100644 --- a/src/main/java/com/gregtechceu/gtceu/test/api/machine/trait/RecipeLogicTest.java +++ b/src/main/java/com/gregtechceu/gtceu/test/api/machine/trait/RecipeLogicTest.java @@ -11,7 +11,9 @@ import com.gregtechceu.gtceu.common.data.GTRecipeTypes; import com.gregtechceu.gtceu.core.mixins.RecipeManagerAccessor; import com.gregtechceu.gtceu.data.recipe.builder.GTRecipeBuilder; + import com.lowdragmc.lowdraglib.side.item.IItemTransfer; + import net.minecraft.core.BlockPos; import net.minecraft.gametest.framework.BeforeBatch; import net.minecraft.gametest.framework.GameTest; @@ -31,7 +33,7 @@ public class RecipeLogicTest { public static void replaceRecipeManagerEntries(ServerLevel level) { if (hasInjectedRecipe) return; var recipes = new HashMap<>(((RecipeManagerAccessor) level.getRecipeManager()).getRawRecipes()); - ((RecipeManagerAccessor)level.getRecipeManager()).setRawRecipes(recipes); + ((RecipeManagerAccessor) level.getRecipeManager()).setRawRecipes(recipes); recipes.replaceAll((k, v) -> new HashMap<>(v)); } @@ -60,7 +62,8 @@ public static void recipeLogicTest(GameTestHelper helper) { // force insert the recipe into the manager. if (!hasInjectedRecipe) { - ((RecipeManagerAccessor) helper.getLevel().getRecipeManager()).getRawRecipes().get(GTRecipeTypes.CHEMICAL_RECIPES).put(GTCEu.id("test"), recipe); + ((RecipeManagerAccessor) helper.getLevel().getRecipeManager()).getRawRecipes() + .get(GTRecipeTypes.CHEMICAL_RECIPES).put(GTCEu.id("test"), recipe); hasInjectedRecipe = true; } @@ -70,16 +73,20 @@ public static void recipeLogicTest(GameTestHelper helper) { // no recipe found helper.assertFalse(arl.isActive(), "Recipe logic is active, even when it shouldn't be"); - helper.assertTrue(arl.getLastRecipe() == null, "Recipe logic has somehow found a recipe, when there should be none"); + helper.assertTrue(arl.getLastRecipe() == null, + "Recipe logic has somehow found a recipe, when there should be none"); // put an item in the inventory that will trigger recipe recheck - ((IItemTransfer)rlm.getCapabilitiesProxy().get(IO.IN, ItemRecipeCapability.CAP).get(0)).insertItem(0, new ItemStack(Blocks.COBBLESTONE, 16), false); + ((IItemTransfer) rlm.getCapabilitiesProxy().get(IO.IN, ItemRecipeCapability.CAP).get(0)).insertItem(0, + new ItemStack(Blocks.COBBLESTONE, 16), false); // Inputs change. did we detect it ? -// helper.assertTrue(arl.isRecipeDirty(), "Recipe is not dirty"); + // helper.assertTrue(arl.isRecipeDirty(), "Recipe is not dirty"); arl.findAndHandleRecipe(); - helper.assertFalse(arl.getLastRecipe() == null, "Last recipe is empty, even though recipe logic should've found a recipe."); + helper.assertFalse(arl.getLastRecipe() == null, + "Last recipe is empty, even though recipe logic should've found a recipe."); helper.assertTrue(arl.isActive(), "Recipelogic is inactive, when it should be active."); - int stackCount = ((IItemTransfer)rlm.getCapabilitiesProxy().get(IO.IN, ItemRecipeCapability.CAP).get(0)).getStackInSlot(0).getCount(); + int stackCount = ((IItemTransfer) rlm.getCapabilitiesProxy().get(IO.IN, ItemRecipeCapability.CAP).get(0)) + .getStackInSlot(0).getCount(); helper.assertTrue(stackCount == 15, "Count is wrong (should be 15, when it's %s".formatted(stackCount)); // Save a reference to the old recipe so we can make sure it's getting reused @@ -88,13 +95,17 @@ public static void recipeLogicTest(GameTestHelper helper) { // Finish the recipe, the output should generate, and the next iteration should begin arl.serverTick(); helper.assertTrue(arl.getLastRecipe() == prev, "lastRecipe is wrong"); - helper.assertTrue(ItemStack.isSameItem(((IItemTransfer)rlm.getCapabilitiesProxy().get(IO.OUT, ItemRecipeCapability.CAP).get(0)).getStackInSlot(0), + helper.assertTrue(ItemStack.isSameItem( + ((IItemTransfer) rlm.getCapabilitiesProxy().get(IO.OUT, ItemRecipeCapability.CAP).get(0)) + .getStackInSlot(0), new ItemStack(Blocks.STONE, 1)), "wrong output stack."); helper.assertTrue(arl.isActive(), "RecipeLogic is not active, when it should be."); // Complete the second iteration, but the machine stops because its output is now full - ((IItemTransfer)rlm.getCapabilitiesProxy().get(IO.OUT, ItemRecipeCapability.CAP).get(0)).setStackInSlot(0, new ItemStack(Blocks.STONE, 63)); - ((IItemTransfer)rlm.getCapabilitiesProxy().get(IO.OUT, ItemRecipeCapability.CAP).get(0)).setStackInSlot(1, new ItemStack(Blocks.STONE, 64)); + ((IItemTransfer) rlm.getCapabilitiesProxy().get(IO.OUT, ItemRecipeCapability.CAP).get(0)).setStackInSlot(0, + new ItemStack(Blocks.STONE, 63)); + ((IItemTransfer) rlm.getCapabilitiesProxy().get(IO.OUT, ItemRecipeCapability.CAP).get(0)).setStackInSlot(1, + new ItemStack(Blocks.STONE, 64)); arl.serverTick(); helper.assertFalse(arl.isActive(), "RecipeLogic is active, when it shouldn't be."); @@ -103,10 +114,14 @@ public static void recipeLogicTest(GameTestHelper helper) { helper.assertFalse(arl.isActive(), "Recipelogic is active, when it shouldn't be."); // Some room is freed in the output bus, so we can continue now. - ((IItemTransfer)rlm.getCapabilitiesProxy().get(IO.OUT, ItemRecipeCapability.CAP).get(0)).setStackInSlot(1, ItemStack.EMPTY); + ((IItemTransfer) rlm.getCapabilitiesProxy().get(IO.OUT, ItemRecipeCapability.CAP).get(0)).setStackInSlot(1, + ItemStack.EMPTY); arl.serverTick(); -// helper.assertTrue(arl.isActive(), "Recipelogic is inactive."); - helper.assertTrue(ItemStack.isSameItem(((IItemTransfer)rlm.getCapabilitiesProxy().get(IO.OUT, ItemRecipeCapability.CAP).get(0)).getStackInSlot(0), new ItemStack(Blocks.STONE, 1)), "Wrong stack."); + // helper.assertTrue(arl.isActive(), "Recipelogic is inactive."); + helper.assertTrue(ItemStack + .isSameItem(((IItemTransfer) rlm.getCapabilitiesProxy().get(IO.OUT, ItemRecipeCapability.CAP).get(0)) + .getStackInSlot(0), new ItemStack(Blocks.STONE, 1)), + "Wrong stack."); // Finish. helper.succeed(); diff --git a/src/main/java/com/gregtechceu/gtceu/test/common/machine/multiblock/PowerSubstationTest.java b/src/main/java/com/gregtechceu/gtceu/test/common/machine/multiblock/PowerSubstationTest.java index 8ab321dbaf..6c0960d4eb 100644 --- a/src/main/java/com/gregtechceu/gtceu/test/common/machine/multiblock/PowerSubstationTest.java +++ b/src/main/java/com/gregtechceu/gtceu/test/common/machine/multiblock/PowerSubstationTest.java @@ -1,417 +1,414 @@ /* -package com.gregtechceu.gtceu.test.common.machine.multiblock; - -import com.gregtechceu.gtceu.api.blockentity.MetaMachineBlockEntity; -import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; -import com.gregtechceu.gtceu.api.machine.MetaMachine; -import com.gregtechceu.gtceu.api.machine.multiblock.IBatteryData; -import com.gregtechceu.gtceu.common.machine.multiblock.electric.PowerSubstationMachine; -import net.minecraft.core.BlockPos; -import net.minecraft.gametest.framework.GameTest; -import net.minecraft.gametest.framework.GameTestHelper; -import net.minecraft.world.level.block.entity.BlockEntity; - -import java.math.BigInteger; -import java.util.ArrayList; -import java.util.List; - -public class PowerSubstationTest { - - @GameTest(template = "gtceu:pss") - public void Test_1_Slot(GameTestHelper helper) { - BlockEntity be = helper.getBlockEntity(new BlockPos(2, 2, 0)); - if (!(be instanceof IMachineBlockEntity mbe)) { - helper.fail("wrong block at pos [2, 2, 0]! (not a machine block entity)"); - return; - } - if (!(mbe.getMetaMachine() instanceof PowerSubstationMachine pss)) { - helper.fail("wrong machine at pos [2, 2, 0]! (not a Power Substation)"); - return; - } - - PowerSubstationMachine.PowerStationEnergyBank storage = createStorage(pss, 100); - helper.assertTrue(storage.getCapacity().equals(BigInteger.valueOf(100)), "Wrong max storage! was" + storage.getCapacity() + ", expected 100"); - - // Random fill and drain tests - long filled = storage.fill(50); - helper.assertTrue(filled == 50, "Expected `fill` to return 50, was" + filled); - helper.assertTrue(storage.getStored().equals(BigInteger.valueOf(50)), "Expected stored energy amount to be 50, was" + storage.getStored()); - filled = storage.fill(100); - helper.assertTrue(filled == 50, "Expected `fill` to return 50, was" + filled); - helper.assertTrue(storage.getStored().equals(BigInteger.valueOf(100)), "Expected stored energy amount to be 100, was" + storage.getStored()); - filled = storage.fill(100); - helper.assertTrue(filled == 0, "Expected `fill` to return 0, was" + filled); - helper.assertTrue(storage.getStored().equals(BigInteger.valueOf(100)), "Expected stored energy amount to be 100, was" + storage.getStored()); - MatcherAssert.assertThat(storage.drain(50), is(50L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(50)); - MatcherAssert.assertThat(storage.drain(100), is(50L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(0)); - MatcherAssert.assertThat(storage.drain(100), is(0L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(0)); - - // Fully fill and drain - MatcherAssert.assertThat(storage.fill(100), is(100L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(100)); - MatcherAssert.assertThat(storage.fill(100), is(0L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(100)); - - MatcherAssert.assertThat(storage.drain(100), is(100L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(0)); - MatcherAssert.assertThat(storage.drain(100), is(0L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(0)); - - // Try to overfill and overdrain - MatcherAssert.assertThat(storage.fill(1000), is(100L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(100)); - - MatcherAssert.assertThat(storage.drain(1000), is(100L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(0)); - } - - @Test - public void Test_4_Slot_Equal_Sizes() { - PowerStationEnergyBank storage = createStorage(100, 100, 100, 100); - MatcherAssert.assertThat(storage.getCapacity(), isBigInt(400)); - - // No overlap of slots - MatcherAssert.assertThat(storage.fill(100), is(100L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(100)); - MatcherAssert.assertThat(storage.fill(100), is(100L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(200)); - MatcherAssert.assertThat(storage.fill(100), is(100L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(300)); - MatcherAssert.assertThat(storage.fill(100), is(100L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(400)); - MatcherAssert.assertThat(storage.fill(100), is(0L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(400)); - - MatcherAssert.assertThat(storage.drain(100), is(100L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(300)); - MatcherAssert.assertThat(storage.drain(100), is(100L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(200)); - MatcherAssert.assertThat(storage.drain(100), is(100L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(100)); - MatcherAssert.assertThat(storage.drain(100), is(100L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(0)); - MatcherAssert.assertThat(storage.drain(100), is(0L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(0)); - - // Overlap slots - MatcherAssert.assertThat(storage.fill(150), is(150L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(150)); - MatcherAssert.assertThat(storage.fill(50), is(50L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(200)); - MatcherAssert.assertThat(storage.fill(200), is(200L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(400)); - MatcherAssert.assertThat(storage.fill(100), is(0L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(400)); - - MatcherAssert.assertThat(storage.drain(150), is(150L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(250)); - MatcherAssert.assertThat(storage.drain(50), is(50L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(200)); - MatcherAssert.assertThat(storage.drain(200), is(200L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(0)); - MatcherAssert.assertThat(storage.drain(100), is(0L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(0)); - - // Fully fill and drain - MatcherAssert.assertThat(storage.fill(400), is(400L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(400)); - MatcherAssert.assertThat(storage.fill(400), is(0L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(400)); - - MatcherAssert.assertThat(storage.drain(400), is(400L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(0)); - MatcherAssert.assertThat(storage.drain(400), is(0L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(0)); - - // Try to overfill and overdrain - MatcherAssert.assertThat(storage.fill(1000), is(400L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(400)); - - MatcherAssert.assertThat(storage.drain(1000), is(400L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(0)); - } - - @Test - public void Test_4_Slot_Different_Sizes() { - PowerStationEnergyBank storage = createStorage(100, 200, 300, 400); - MatcherAssert.assertThat(storage.getCapacity(), isBigInt(1000)); - - // No overlap of slots - MatcherAssert.assertThat(storage.fill(100), is(100L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(100)); - MatcherAssert.assertThat(storage.fill(200), is(200L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(300)); - MatcherAssert.assertThat(storage.fill(300), is(300L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(600)); - MatcherAssert.assertThat(storage.fill(400), is(400L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(1000)); - MatcherAssert.assertThat(storage.fill(100), is(0L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(1000)); - - MatcherAssert.assertThat(storage.drain(400), is(400L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(600)); - MatcherAssert.assertThat(storage.drain(300), is(300L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(300)); - MatcherAssert.assertThat(storage.drain(200), is(200L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(100)); - MatcherAssert.assertThat(storage.drain(100), is(100L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(0)); - MatcherAssert.assertThat(storage.drain(100), is(0L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(0)); - - // Overlap slots - MatcherAssert.assertThat(storage.fill(200), is(200L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(200)); - MatcherAssert.assertThat(storage.fill(100), is(100L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(300)); - MatcherAssert.assertThat(storage.fill(600), is(600L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(900)); - MatcherAssert.assertThat(storage.fill(100), is(100L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(1000)); - MatcherAssert.assertThat(storage.fill(100), is(0L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(1000)); - - MatcherAssert.assertThat(storage.drain(100), is(100L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(900)); - MatcherAssert.assertThat(storage.drain(600), is(600L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(300)); - MatcherAssert.assertThat(storage.drain(100), is(100L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(200)); - MatcherAssert.assertThat(storage.drain(200), is(200L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(0)); - MatcherAssert.assertThat(storage.drain(100), is(0L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(0)); - - // Fully fill and drain - MatcherAssert.assertThat(storage.fill(1000), is(1000L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(1000)); - MatcherAssert.assertThat(storage.fill(1000), is(0L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(1000)); - - MatcherAssert.assertThat(storage.drain(1000), is(1000L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(0)); - MatcherAssert.assertThat(storage.drain(1000), is(0L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(0)); - - // Try to overfill and overdrain - MatcherAssert.assertThat(storage.fill(10000), is(1000L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(1000)); - - MatcherAssert.assertThat(storage.drain(10000), is(1000L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(0)); - } - - @SuppressWarnings("NumericOverflow") - @Test - public void Test_Over_Long() { - PowerStationEnergyBank storage = createStorage(Long.MAX_VALUE, Long.MAX_VALUE, Long.MAX_VALUE); - MatcherAssert.assertThat(storage.getCapacity(), isBigInt(Long.MAX_VALUE, Long.MAX_VALUE, Long.MAX_VALUE)); - - long halfLong = Long.MAX_VALUE / 2; - - MatcherAssert.assertThat(storage.fill(halfLong), is(halfLong)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(halfLong)); - MatcherAssert.assertThat(storage.fill(Long.MAX_VALUE), is(Long.MAX_VALUE)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(halfLong, Long.MAX_VALUE)); - - MatcherAssert.assertThat(storage.drain(halfLong), is(halfLong)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(Long.MAX_VALUE)); - MatcherAssert.assertThat(storage.drain(Long.MAX_VALUE), is(Long.MAX_VALUE)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(0)); - - // Test overflow - Assertions.assertThrows(IllegalArgumentException.class, () -> storage.fill(Long.MAX_VALUE + 1000)); - Assertions.assertThrows(IllegalArgumentException.class, () -> storage.drain(Long.MAX_VALUE + 1000)); - } - - @Test - public void Test_Rebuild_Storage() { - PowerStationEnergyBank storage = createStorage(100, 500, 4000); - MatcherAssert.assertThat(storage.getCapacity(), isBigInt(4600)); - - // Set up the storage with some amount of energy - MatcherAssert.assertThat(storage.fill(3000), is(3000L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(3000)); - - // Rebuild with more storage than needed - storage = rebuildStorage(storage, 1000, 4000, 4000); - MatcherAssert.assertThat(storage.getCapacity(), isBigInt(9000)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(3000)); - - // Reset - storage = createStorage(100, 500, 4000); - MatcherAssert.assertThat(storage.getCapacity(), isBigInt(4600)); - - // Set up storage with energy again - MatcherAssert.assertThat(storage.fill(3000), is(3000L)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(3000)); - - // Rebuild with less storage than needed - storage = rebuildStorage(storage, 100, 100, 400, 500); - MatcherAssert.assertThat(storage.getCapacity(), isBigInt(1100)); - MatcherAssert.assertThat(storage.getStored(), isBigInt(1100)); - } - - @Test - public void Test_Optimized_Big_Integer_Summarize() { - Consumer testRunner = r -> { - BigInteger summation = BigInteger.ZERO; - long[] storageValues = new long[9 * MAX_BATTERY_LAYERS]; - for (int i = 0; i < storageValues.length; i++) { - long randomLong = Math.abs(r.nextLong()); - storageValues[i] = randomLong; - summation = summation.add(BigInteger.valueOf(randomLong)); - } - - PowerStationEnergyBank storage = createStorage(storageValues); - MatcherAssert.assertThat(storage.getCapacity(), is(summation)); - }; - - for (int i = 0; i < 100; i++) { - testRunner.accept(new Random()); - } - } - - @Test - public void Test_Passive_Drain_Calculation() { - // 100kEU/t per storage block "too large" (like max long) - PowerStationEnergyBank storage = createStorage(Long.MAX_VALUE, Long.MAX_VALUE); - MatcherAssert.assertThat(storage.getPassiveDrainPerTick(), - is(2 * PASSIVE_DRAIN_MAX_PER_STORAGE)); - - Consumer testRunner = r -> { - int numTruncated = 0; - BigInteger nonTruncated = BigInteger.ZERO; - - long[] storageValues = new long[9 * MAX_BATTERY_LAYERS]; - for (int i = 0; i < storageValues.length; i++) { - long randomLong = Math.abs(r.nextLong()); - storageValues[i] = randomLong; - if (randomLong / PASSIVE_DRAIN_DIVISOR >= PASSIVE_DRAIN_MAX_PER_STORAGE) { - numTruncated++; - } else { - nonTruncated = nonTruncated.add(BigInteger.valueOf(randomLong)); - } - } - - PowerStationEnergyBank testStorage = createStorage(storageValues); - MatcherAssert.assertThat(testStorage.getPassiveDrainPerTick(), - is(nonTruncated.divide(BigInteger.valueOf(PASSIVE_DRAIN_DIVISOR)) - .add(BigInteger.valueOf(numTruncated * PASSIVE_DRAIN_MAX_PER_STORAGE)) - .longValue())); - }; - - for (int i = 0; i < 100; i++) { - testRunner.accept(new Random()); - } - } - - @Test - public void Test_Fill_Drain_Randomized() { - Consumer testRunner = r -> { - BigInteger totalStorage = BigInteger.ZERO; - long[] storageValues = new long[9 * MAX_BATTERY_LAYERS]; - for (int i = 0; i < storageValues.length; i++) { - long randomLong = Math.abs(r.nextLong()); - storageValues[i] = randomLong; - totalStorage = totalStorage.add(BigInteger.valueOf(randomLong)); - } - - PowerStationEnergyBank storage = createStorage(storageValues); - - // test capacity - MatcherAssert.assertThat(storage.getCapacity(), is(totalStorage)); - - // test fill - BigInteger amountToFill = totalStorage; - do { - long randomLong = Math.abs(r.nextLong()); - BigInteger randomBigInt = BigInteger.valueOf(randomLong); - - if (amountToFill.compareTo(randomBigInt) <= 0) { - MatcherAssert.assertThat(storage.fill(randomLong), is(amountToFill.longValue())); - amountToFill = BigInteger.ZERO; - } else { - MatcherAssert.assertThat(storage.fill(randomLong), is(randomLong)); - amountToFill = amountToFill.subtract(randomBigInt); - } - } while (!amountToFill.equals(BigInteger.ZERO)); - - // test drain - BigInteger amountToDrain = totalStorage; - do { - long randomLong = Math.abs(r.nextLong()); - BigInteger randomBigInt = BigInteger.valueOf(randomLong); - - if (amountToDrain.compareTo(randomBigInt) <= 0) { - MatcherAssert.assertThat(storage.drain(randomLong), is(amountToDrain.longValue())); - amountToDrain = BigInteger.ZERO; - } else { - MatcherAssert.assertThat(storage.drain(randomLong), is(randomLong)); - amountToDrain = amountToDrain.subtract(randomBigInt); - } - } while (!amountToDrain.equals(BigInteger.ZERO)); - }; - - for (int i = 0; i < 100; i++) { - testRunner.accept(new Random()); - } - } - - private static Matcher isBigInt(long value, long... additional) { - BigInteger retVal = BigInteger.valueOf(value); - if (additional != null) { - for (long l : additional) { - retVal = retVal.add(BigInteger.valueOf(l)); - } - } - return is(retVal); - } - - private static PowerSubstationMachine.PowerStationEnergyBank createStorage(MetaMachine machine, long... storageValues) { - List batteries = new ArrayList<>(); - for (long value : storageValues) { - batteries.add(new TestBattery(value)); - } - return new PowerSubstationMachine.PowerStationEnergyBank(machine, batteries); - } - - private static PowerSubstationMachine.PowerStationEnergyBank rebuildStorage(PowerSubstationMachine.PowerStationEnergyBank storage, long... storageValues) { - List batteries = new ArrayList<>(); - for (long value : storageValues) { - batteries.add(new TestBattery(value)); - } - return storage.rebuild(batteries); - } - - private static class TestBattery implements IBatteryData { - - private final long capacity; - - private TestBattery(long capacity) { - this.capacity = capacity; - } - - @Override - public long getCapacity() { - return capacity; - } - - // not used in this test - @Override - public int getTier() { - return 0; - } - - // not used in this test - @NotNull - @Override - public String getBatteryName() { - return ""; - } - } -} -*/ \ No newline at end of file + * package com.gregtechceu.gtceu.test.common.machine.multiblock; + * + * + * public class PowerSubstationTest { + * + * @GameTest(template = "gtceu:pss") + * public void Test_1_Slot(GameTestHelper helper) { + * BlockEntity be = helper.getBlockEntity(new BlockPos(2, 2, 0)); + * if (!(be instanceof IMachineBlockEntity mbe)) { + * helper.fail("wrong block at pos [2, 2, 0]! (not a machine block entity)"); + * return; + * } + * if (!(mbe.getMetaMachine() instanceof PowerSubstationMachine pss)) { + * helper.fail("wrong machine at pos [2, 2, 0]! (not a Power Substation)"); + * return; + * } + * + * PowerSubstationMachine.PowerStationEnergyBank storage = createStorage(pss, 100); + * helper.assertTrue(storage.getCapacity().equals(BigInteger.valueOf(100)), "Wrong max storage! was" + + * storage.getCapacity() + ", expected 100"); + * + * // Random fill and drain tests + * long filled = storage.fill(50); + * helper.assertTrue(filled == 50, "Expected `fill` to return 50, was" + filled); + * helper.assertTrue(storage.getStored().equals(BigInteger.valueOf(50)), "Expected stored energy amount to be 50, was" + + * storage.getStored()); + * filled = storage.fill(100); + * helper.assertTrue(filled == 50, "Expected `fill` to return 50, was" + filled); + * helper.assertTrue(storage.getStored().equals(BigInteger.valueOf(100)), "Expected stored energy amount to be 100, was" + * + storage.getStored()); + * filled = storage.fill(100); + * helper.assertTrue(filled == 0, "Expected `fill` to return 0, was" + filled); + * helper.assertTrue(storage.getStored().equals(BigInteger.valueOf(100)), "Expected stored energy amount to be 100, was" + * + storage.getStored()); + * MatcherAssert.assertThat(storage.drain(50), is(50L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(50)); + * MatcherAssert.assertThat(storage.drain(100), is(50L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(0)); + * MatcherAssert.assertThat(storage.drain(100), is(0L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(0)); + * + * // Fully fill and drain + * MatcherAssert.assertThat(storage.fill(100), is(100L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(100)); + * MatcherAssert.assertThat(storage.fill(100), is(0L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(100)); + * + * MatcherAssert.assertThat(storage.drain(100), is(100L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(0)); + * MatcherAssert.assertThat(storage.drain(100), is(0L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(0)); + * + * // Try to overfill and overdrain + * MatcherAssert.assertThat(storage.fill(1000), is(100L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(100)); + * + * MatcherAssert.assertThat(storage.drain(1000), is(100L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(0)); + * } + * + * @Test + * public void Test_4_Slot_Equal_Sizes() { + * PowerStationEnergyBank storage = createStorage(100, 100, 100, 100); + * MatcherAssert.assertThat(storage.getCapacity(), isBigInt(400)); + * + * // No overlap of slots + * MatcherAssert.assertThat(storage.fill(100), is(100L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(100)); + * MatcherAssert.assertThat(storage.fill(100), is(100L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(200)); + * MatcherAssert.assertThat(storage.fill(100), is(100L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(300)); + * MatcherAssert.assertThat(storage.fill(100), is(100L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(400)); + * MatcherAssert.assertThat(storage.fill(100), is(0L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(400)); + * + * MatcherAssert.assertThat(storage.drain(100), is(100L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(300)); + * MatcherAssert.assertThat(storage.drain(100), is(100L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(200)); + * MatcherAssert.assertThat(storage.drain(100), is(100L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(100)); + * MatcherAssert.assertThat(storage.drain(100), is(100L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(0)); + * MatcherAssert.assertThat(storage.drain(100), is(0L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(0)); + * + * // Overlap slots + * MatcherAssert.assertThat(storage.fill(150), is(150L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(150)); + * MatcherAssert.assertThat(storage.fill(50), is(50L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(200)); + * MatcherAssert.assertThat(storage.fill(200), is(200L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(400)); + * MatcherAssert.assertThat(storage.fill(100), is(0L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(400)); + * + * MatcherAssert.assertThat(storage.drain(150), is(150L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(250)); + * MatcherAssert.assertThat(storage.drain(50), is(50L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(200)); + * MatcherAssert.assertThat(storage.drain(200), is(200L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(0)); + * MatcherAssert.assertThat(storage.drain(100), is(0L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(0)); + * + * // Fully fill and drain + * MatcherAssert.assertThat(storage.fill(400), is(400L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(400)); + * MatcherAssert.assertThat(storage.fill(400), is(0L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(400)); + * + * MatcherAssert.assertThat(storage.drain(400), is(400L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(0)); + * MatcherAssert.assertThat(storage.drain(400), is(0L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(0)); + * + * // Try to overfill and overdrain + * MatcherAssert.assertThat(storage.fill(1000), is(400L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(400)); + * + * MatcherAssert.assertThat(storage.drain(1000), is(400L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(0)); + * } + * + * @Test + * public void Test_4_Slot_Different_Sizes() { + * PowerStationEnergyBank storage = createStorage(100, 200, 300, 400); + * MatcherAssert.assertThat(storage.getCapacity(), isBigInt(1000)); + * + * // No overlap of slots + * MatcherAssert.assertThat(storage.fill(100), is(100L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(100)); + * MatcherAssert.assertThat(storage.fill(200), is(200L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(300)); + * MatcherAssert.assertThat(storage.fill(300), is(300L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(600)); + * MatcherAssert.assertThat(storage.fill(400), is(400L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(1000)); + * MatcherAssert.assertThat(storage.fill(100), is(0L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(1000)); + * + * MatcherAssert.assertThat(storage.drain(400), is(400L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(600)); + * MatcherAssert.assertThat(storage.drain(300), is(300L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(300)); + * MatcherAssert.assertThat(storage.drain(200), is(200L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(100)); + * MatcherAssert.assertThat(storage.drain(100), is(100L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(0)); + * MatcherAssert.assertThat(storage.drain(100), is(0L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(0)); + * + * // Overlap slots + * MatcherAssert.assertThat(storage.fill(200), is(200L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(200)); + * MatcherAssert.assertThat(storage.fill(100), is(100L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(300)); + * MatcherAssert.assertThat(storage.fill(600), is(600L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(900)); + * MatcherAssert.assertThat(storage.fill(100), is(100L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(1000)); + * MatcherAssert.assertThat(storage.fill(100), is(0L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(1000)); + * + * MatcherAssert.assertThat(storage.drain(100), is(100L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(900)); + * MatcherAssert.assertThat(storage.drain(600), is(600L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(300)); + * MatcherAssert.assertThat(storage.drain(100), is(100L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(200)); + * MatcherAssert.assertThat(storage.drain(200), is(200L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(0)); + * MatcherAssert.assertThat(storage.drain(100), is(0L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(0)); + * + * // Fully fill and drain + * MatcherAssert.assertThat(storage.fill(1000), is(1000L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(1000)); + * MatcherAssert.assertThat(storage.fill(1000), is(0L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(1000)); + * + * MatcherAssert.assertThat(storage.drain(1000), is(1000L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(0)); + * MatcherAssert.assertThat(storage.drain(1000), is(0L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(0)); + * + * // Try to overfill and overdrain + * MatcherAssert.assertThat(storage.fill(10000), is(1000L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(1000)); + * + * MatcherAssert.assertThat(storage.drain(10000), is(1000L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(0)); + * } + * + * @SuppressWarnings("NumericOverflow") + * + * @Test + * public void Test_Over_Long() { + * PowerStationEnergyBank storage = createStorage(Long.MAX_VALUE, Long.MAX_VALUE, Long.MAX_VALUE); + * MatcherAssert.assertThat(storage.getCapacity(), isBigInt(Long.MAX_VALUE, Long.MAX_VALUE, Long.MAX_VALUE)); + * + * long halfLong = Long.MAX_VALUE / 2; + * + * MatcherAssert.assertThat(storage.fill(halfLong), is(halfLong)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(halfLong)); + * MatcherAssert.assertThat(storage.fill(Long.MAX_VALUE), is(Long.MAX_VALUE)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(halfLong, Long.MAX_VALUE)); + * + * MatcherAssert.assertThat(storage.drain(halfLong), is(halfLong)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(Long.MAX_VALUE)); + * MatcherAssert.assertThat(storage.drain(Long.MAX_VALUE), is(Long.MAX_VALUE)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(0)); + * + * // Test overflow + * Assertions.assertThrows(IllegalArgumentException.class, () -> storage.fill(Long.MAX_VALUE + 1000)); + * Assertions.assertThrows(IllegalArgumentException.class, () -> storage.drain(Long.MAX_VALUE + 1000)); + * } + * + * @Test + * public void Test_Rebuild_Storage() { + * PowerStationEnergyBank storage = createStorage(100, 500, 4000); + * MatcherAssert.assertThat(storage.getCapacity(), isBigInt(4600)); + * + * // Set up the storage with some amount of energy + * MatcherAssert.assertThat(storage.fill(3000), is(3000L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(3000)); + * + * // Rebuild with more storage than needed + * storage = rebuildStorage(storage, 1000, 4000, 4000); + * MatcherAssert.assertThat(storage.getCapacity(), isBigInt(9000)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(3000)); + * + * // Reset + * storage = createStorage(100, 500, 4000); + * MatcherAssert.assertThat(storage.getCapacity(), isBigInt(4600)); + * + * // Set up storage with energy again + * MatcherAssert.assertThat(storage.fill(3000), is(3000L)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(3000)); + * + * // Rebuild with less storage than needed + * storage = rebuildStorage(storage, 100, 100, 400, 500); + * MatcherAssert.assertThat(storage.getCapacity(), isBigInt(1100)); + * MatcherAssert.assertThat(storage.getStored(), isBigInt(1100)); + * } + * + * @Test + * public void Test_Optimized_Big_Integer_Summarize() { + * Consumer testRunner = r -> { + * BigInteger summation = BigInteger.ZERO; + * long[] storageValues = new long[9 * MAX_BATTERY_LAYERS]; + * for (int i = 0; i < storageValues.length; i++) { + * long randomLong = Math.abs(r.nextLong()); + * storageValues[i] = randomLong; + * summation = summation.add(BigInteger.valueOf(randomLong)); + * } + * + * PowerStationEnergyBank storage = createStorage(storageValues); + * MatcherAssert.assertThat(storage.getCapacity(), is(summation)); + * }; + * + * for (int i = 0; i < 100; i++) { + * testRunner.accept(new Random()); + * } + * } + * + * @Test + * public void Test_Passive_Drain_Calculation() { + * // 100kEU/t per storage block "too large" (like max long) + * PowerStationEnergyBank storage = createStorage(Long.MAX_VALUE, Long.MAX_VALUE); + * MatcherAssert.assertThat(storage.getPassiveDrainPerTick(), + * is(2 * PASSIVE_DRAIN_MAX_PER_STORAGE)); + * + * Consumer testRunner = r -> { + * int numTruncated = 0; + * BigInteger nonTruncated = BigInteger.ZERO; + * + * long[] storageValues = new long[9 * MAX_BATTERY_LAYERS]; + * for (int i = 0; i < storageValues.length; i++) { + * long randomLong = Math.abs(r.nextLong()); + * storageValues[i] = randomLong; + * if (randomLong / PASSIVE_DRAIN_DIVISOR >= PASSIVE_DRAIN_MAX_PER_STORAGE) { + * numTruncated++; + * } else { + * nonTruncated = nonTruncated.add(BigInteger.valueOf(randomLong)); + * } + * } + * + * PowerStationEnergyBank testStorage = createStorage(storageValues); + * MatcherAssert.assertThat(testStorage.getPassiveDrainPerTick(), + * is(nonTruncated.divide(BigInteger.valueOf(PASSIVE_DRAIN_DIVISOR)) + * .add(BigInteger.valueOf(numTruncated * PASSIVE_DRAIN_MAX_PER_STORAGE)) + * .longValue())); + * }; + * + * for (int i = 0; i < 100; i++) { + * testRunner.accept(new Random()); + * } + * } + * + * @Test + * public void Test_Fill_Drain_Randomized() { + * Consumer testRunner = r -> { + * BigInteger totalStorage = BigInteger.ZERO; + * long[] storageValues = new long[9 * MAX_BATTERY_LAYERS]; + * for (int i = 0; i < storageValues.length; i++) { + * long randomLong = Math.abs(r.nextLong()); + * storageValues[i] = randomLong; + * totalStorage = totalStorage.add(BigInteger.valueOf(randomLong)); + * } + * + * PowerStationEnergyBank storage = createStorage(storageValues); + * + * // test capacity + * MatcherAssert.assertThat(storage.getCapacity(), is(totalStorage)); + * + * // test fill + * BigInteger amountToFill = totalStorage; + * do { + * long randomLong = Math.abs(r.nextLong()); + * BigInteger randomBigInt = BigInteger.valueOf(randomLong); + * + * if (amountToFill.compareTo(randomBigInt) <= 0) { + * MatcherAssert.assertThat(storage.fill(randomLong), is(amountToFill.longValue())); + * amountToFill = BigInteger.ZERO; + * } else { + * MatcherAssert.assertThat(storage.fill(randomLong), is(randomLong)); + * amountToFill = amountToFill.subtract(randomBigInt); + * } + * } while (!amountToFill.equals(BigInteger.ZERO)); + * + * // test drain + * BigInteger amountToDrain = totalStorage; + * do { + * long randomLong = Math.abs(r.nextLong()); + * BigInteger randomBigInt = BigInteger.valueOf(randomLong); + * + * if (amountToDrain.compareTo(randomBigInt) <= 0) { + * MatcherAssert.assertThat(storage.drain(randomLong), is(amountToDrain.longValue())); + * amountToDrain = BigInteger.ZERO; + * } else { + * MatcherAssert.assertThat(storage.drain(randomLong), is(randomLong)); + * amountToDrain = amountToDrain.subtract(randomBigInt); + * } + * } while (!amountToDrain.equals(BigInteger.ZERO)); + * }; + * + * for (int i = 0; i < 100; i++) { + * testRunner.accept(new Random()); + * } + * } + * + * private static Matcher isBigInt(long value, long... additional) { + * BigInteger retVal = BigInteger.valueOf(value); + * if (additional != null) { + * for (long l : additional) { + * retVal = retVal.add(BigInteger.valueOf(l)); + * } + * } + * return is(retVal); + * } + * + * private static PowerSubstationMachine.PowerStationEnergyBank createStorage(MetaMachine machine, long... + * storageValues) { + * List batteries = new ArrayList<>(); + * for (long value : storageValues) { + * batteries.add(new TestBattery(value)); + * } + * return new PowerSubstationMachine.PowerStationEnergyBank(machine, batteries); + * } + * + * private static PowerSubstationMachine.PowerStationEnergyBank + * rebuildStorage(PowerSubstationMachine.PowerStationEnergyBank storage, long... storageValues) { + * List batteries = new ArrayList<>(); + * for (long value : storageValues) { + * batteries.add(new TestBattery(value)); + * } + * return storage.rebuild(batteries); + * } + * + * private static class TestBattery implements IBatteryData { + * + * private final long capacity; + * + * private TestBattery(long capacity) { + * this.capacity = capacity; + * } + * + * @Override + * public long getCapacity() { + * return capacity; + * } + * + * // not used in this test + * + * @Override + * public int getTier() { + * return 0; + * } + * + * // not used in this test + * + * @NotNull + * + * @Override + * public String getBatteryName() { + * return ""; + * } + * } + * } + */ diff --git a/src/main/java/com/gregtechceu/gtceu/test/forge/GTGameTestsImpl.java b/src/main/java/com/gregtechceu/gtceu/test/forge/GTGameTestsImpl.java index af5c541317..f1963914c4 100644 --- a/src/main/java/com/gregtechceu/gtceu/test/forge/GTGameTestsImpl.java +++ b/src/main/java/com/gregtechceu/gtceu/test/forge/GTGameTestsImpl.java @@ -2,6 +2,7 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.test.GTGameTests; + import net.minecraftforge.event.RegisterGameTestsEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; diff --git a/src/main/java/com/gregtechceu/gtceu/utils/DummyMachineBlockEntity.java b/src/main/java/com/gregtechceu/gtceu/utils/DummyMachineBlockEntity.java index baf616bc77..cae4a5f400 100644 --- a/src/main/java/com/gregtechceu/gtceu/utils/DummyMachineBlockEntity.java +++ b/src/main/java/com/gregtechceu/gtceu/utils/DummyMachineBlockEntity.java @@ -1,6 +1,5 @@ package com.gregtechceu.gtceu.utils; -import com.google.common.collect.Table; import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.capability.recipe.IO; import com.gregtechceu.gtceu.api.capability.recipe.IRecipeHandler; @@ -8,7 +7,10 @@ import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; import com.gregtechceu.gtceu.api.machine.MachineDefinition; import com.gregtechceu.gtceu.api.recipe.GTRecipeType; + import com.lowdragmc.lowdraglib.syncdata.managed.MultiManagedStorage; + +import com.google.common.collect.Table; import it.unimi.dsi.fastutil.ints.Int2LongFunction; import lombok.Getter; @@ -18,14 +20,17 @@ * Dummy machine BE used for wrapping {@link DummyRecipeLogicMachine}s */ public class DummyMachineBlockEntity implements IMachineBlockEntity { + @Getter public final DummyRecipeLogicMachine metaMachine; @Getter private final MachineDefinition definition; - public DummyMachineBlockEntity(int tier, GTRecipeType type, Int2LongFunction tankScalingFunction, Table, List>> capabilitiesProxy, Object... args) { + public DummyMachineBlockEntity(int tier, GTRecipeType type, Int2LongFunction tankScalingFunction, + Table, List>> capabilitiesProxy, + Object... args) { this.definition = MachineDefinition.createDefinition(GTCEu.id("dummy")); - this.definition.setRecipeTypes(new GTRecipeType[] {type}); + this.definition.setRecipeTypes(new GTRecipeType[] { type }); this.definition.setTier(tier); this.metaMachine = new DummyRecipeLogicMachine(this, tier, tankScalingFunction, capabilitiesProxy, args); diff --git a/src/main/java/com/gregtechceu/gtceu/utils/DummyRecipeLogicMachine.java b/src/main/java/com/gregtechceu/gtceu/utils/DummyRecipeLogicMachine.java index 17595e8637..a7dc991571 100644 --- a/src/main/java/com/gregtechceu/gtceu/utils/DummyRecipeLogicMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/utils/DummyRecipeLogicMachine.java @@ -1,12 +1,13 @@ package com.gregtechceu.gtceu.utils; -import com.google.common.collect.Table; import com.gregtechceu.gtceu.api.capability.recipe.IO; import com.gregtechceu.gtceu.api.capability.recipe.IRecipeHandler; import com.gregtechceu.gtceu.api.capability.recipe.RecipeCapability; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; import com.gregtechceu.gtceu.api.machine.WorkableTieredMachine; import com.gregtechceu.gtceu.api.machine.feature.IRecipeLogicMachine; + +import com.google.common.collect.Table; import it.unimi.dsi.fastutil.ints.Int2LongFunction; import java.util.List; @@ -15,7 +16,10 @@ * Dummy machine used for searching recipes outside of a machine. */ public class DummyRecipeLogicMachine extends WorkableTieredMachine implements IRecipeLogicMachine { - public DummyRecipeLogicMachine(IMachineBlockEntity be, int tier, Int2LongFunction tankScalingFunction, Table, List>> capabilitiesProxy, Object... args) { + + public DummyRecipeLogicMachine(IMachineBlockEntity be, int tier, Int2LongFunction tankScalingFunction, + Table, List>> capabilitiesProxy, + Object... args) { super(be, tier, tankScalingFunction, args); reinitializeCapabilities(capabilitiesProxy); } diff --git a/src/main/java/com/gregtechceu/gtceu/utils/EntityDamageUtil.java b/src/main/java/com/gregtechceu/gtceu/utils/EntityDamageUtil.java index 99ee3eb852..c84a436752 100644 --- a/src/main/java/com/gregtechceu/gtceu/utils/EntityDamageUtil.java +++ b/src/main/java/com/gregtechceu/gtceu/utils/EntityDamageUtil.java @@ -2,20 +2,16 @@ import com.gregtechceu.gtceu.common.data.GTDamageTypes; import com.gregtechceu.gtceu.data.recipe.CustomTags; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.Tag; -import net.minecraft.server.level.ServerPlayer; + import net.minecraft.tags.EntityTypeTags; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffects; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.entity.animal.PolarBear; -import net.minecraft.world.entity.animal.SnowGolem; -import net.minecraft.world.entity.boss.wither.WitherBoss; import net.minecraft.world.entity.monster.*; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.enchantment.Enchantments; + import org.jetbrains.annotations.NotNull; public class EntityDamageUtil { @@ -58,9 +54,9 @@ public static void applyHeatDamage(@NotNull LivingEntity entity, int damage) { if (entity.getEffect(MobEffects.FIRE_RESISTANCE) != null) return; entity.hurt(GTDamageTypes.HEAT.source(entity.level()), damage); - //TODO advancements - //if (entity instanceof ServerPlayer serverPlayer) - // AdvancementTriggers.HEAT_DEATH.trigger(serverPlayer); + // TODO advancements + // if (entity instanceof ServerPlayer serverPlayer) + // AdvancementTriggers.HEAT_DEATH.trigger(serverPlayer); } /** @@ -86,9 +82,9 @@ public static void applyFrostDamage(@NotNull LivingEntity entity, int damage) { entity.hurt(entity.damageSources().freeze(), damage); // TODO advancements - //if (entity instanceof ServerPlayer) { - // AdvancementTriggers.COLD_DEATH.trigger((EntityPlayerMP) entity); - //} + // if (entity instanceof ServerPlayer) { + // AdvancementTriggers.COLD_DEATH.trigger((EntityPlayerMP) entity); + // } } /** @@ -106,6 +102,6 @@ public static void applyChemicalDamage(@NotNull LivingEntity entity, int damage) entity.hurt(GTDamageTypes.CHEMICAL.source(entity.level()), damage); entity.addEffect(new MobEffectInstance(MobEffects.POISON, damage * 100, 1)); // TODO advancements - //if (entity instanceof ServerPlayer) AdvancementTriggers.CHEMICAL_DEATH.trigger((EntityPlayerMP) entity); + // if (entity instanceof ServerPlayer) AdvancementTriggers.CHEMICAL_DEATH.trigger((EntityPlayerMP) entity); } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/utils/FacingPos.java b/src/main/java/com/gregtechceu/gtceu/utils/FacingPos.java index 525c13565a..cc7f5d984c 100644 --- a/src/main/java/com/gregtechceu/gtceu/utils/FacingPos.java +++ b/src/main/java/com/gregtechceu/gtceu/utils/FacingPos.java @@ -1,9 +1,10 @@ package com.gregtechceu.gtceu.utils; -import lombok.Getter; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; +import lombok.Getter; + import java.util.Objects; public class FacingPos { @@ -32,4 +33,4 @@ public boolean equals(Object o) { public int hashCode() { return hashCode; } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/utils/FluidKey.java b/src/main/java/com/gregtechceu/gtceu/utils/FluidKey.java index 23573e7f55..191fb5d93f 100644 --- a/src/main/java/com/gregtechceu/gtceu/utils/FluidKey.java +++ b/src/main/java/com/gregtechceu/gtceu/utils/FluidKey.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.utils; import com.lowdragmc.lowdraglib.side.fluid.FluidStack; + import net.minecraft.nbt.CompoundTag; import net.minecraft.world.level.material.Fluid; @@ -23,7 +24,6 @@ public FluidKey copy() { return new FluidKey(FluidStack.create(getFluid(), this.amount, tag)); } - @Override public boolean equals(Object o) { if (this == o) return true; diff --git a/src/main/java/com/gregtechceu/gtceu/utils/FluidStackHashStrategy.java b/src/main/java/com/gregtechceu/gtceu/utils/FluidStackHashStrategy.java index cba8bbd0b7..0d1c5f93b9 100644 --- a/src/main/java/com/gregtechceu/gtceu/utils/FluidStackHashStrategy.java +++ b/src/main/java/com/gregtechceu/gtceu/utils/FluidStackHashStrategy.java @@ -1,9 +1,10 @@ package com.gregtechceu.gtceu.utils; import com.lowdragmc.lowdraglib.side.fluid.FluidStack; -import it.unimi.dsi.fastutil.Hash; +import it.unimi.dsi.fastutil.Hash; import org.jetbrains.annotations.Nullable; + import java.util.Objects; /** @@ -11,6 +12,7 @@ * considering equality. */ public interface FluidStackHashStrategy extends Hash.Strategy { + /** * @return a builder object for producing a custom FluidStackHashStrategy. */ @@ -46,6 +48,7 @@ static FluidStackHashStrategy comparingAllButAmount() { * Builder pattern class for generating customized FluidStackHashStrategy */ class FluidStackHashStrategyBuilder { + private boolean fluid, amount, damage, tag; /** @@ -86,13 +89,13 @@ public FluidStackHashStrategy.FluidStackHashStrategyBuilder compareTag(boolean c */ public FluidStackHashStrategy build() { return new FluidStackHashStrategy() { + @Override public int hashCode(@Nullable FluidStack o) { return o == null || o.isEmpty() ? 0 : Objects.hash( fluid ? o.getFluid() : null, amount ? o.getAmount() : null, - tag ? o.getTag() : null - ); + tag ? o.getTag() : null); } @Override diff --git a/src/main/java/com/gregtechceu/gtceu/utils/FormattingUtil.java b/src/main/java/com/gregtechceu/gtceu/utils/FormattingUtil.java index 37d3b15572..ea234a64b0 100644 --- a/src/main/java/com/gregtechceu/gtceu/utils/FormattingUtil.java +++ b/src/main/java/com/gregtechceu/gtceu/utils/FormattingUtil.java @@ -1,14 +1,13 @@ package com.gregtechceu.gtceu.utils; -import com.google.common.base.CaseFormat; -import net.minecraft.ChatFormatting; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.ComponentContents; import net.minecraft.network.chat.MutableComponent; + +import com.google.common.base.CaseFormat; import org.apache.commons.lang3.StringUtils; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.NotNull; import java.text.DecimalFormat; import java.text.NumberFormat; import java.util.Arrays; @@ -24,6 +23,7 @@ */ @SuppressWarnings("UnnecessaryUnicodeEscape") public class FormattingUtil { + private static final NumberFormat NUMBER_FORMAT = NumberFormat.getInstance(Locale.ROOT); private static final DecimalFormat TWO_PLACES_FORMAT = new DecimalFormat("#.##"); @@ -49,10 +49,10 @@ private static String checkNumbers(String string, int smallUpNumberBase, boolean int relativeIndex = charArray[i] - NUMBER_BASE; if (relativeIndex >= 0 && relativeIndex <= 9) { if (isUp) { - if (relativeIndex == 1 ) { + if (relativeIndex == 1) { charArray[i] = SMALL_UP_NUMBER_ONE; continue; - } else if (relativeIndex == 2 ) { + } else if (relativeIndex == 2) { charArray[i] = SMALL_UP_NUMBER_TWO; continue; } else if (relativeIndex == 3) { @@ -68,16 +68,18 @@ private static String checkNumbers(String string, int smallUpNumberBase, boolean } /** - * Does almost the same thing as .to(LOWER_UNDERSCORE, string), but it also inserts underscores between words and numbers. + * Does almost the same thing as .to(LOWER_UNDERSCORE, string), but it also inserts underscores between words and + * numbers. * * @param string Any string with ASCII characters. - * @return A string that is all lowercase, with underscores inserted before word/number boundaries: "maragingSteel300" -> "maraging_steel_300" + * @return A string that is all lowercase, with underscores inserted before word/number boundaries: + * "maragingSteel300" -> "maraging_steel_300" */ public static String toLowerCaseUnderscore(String string) { StringBuilder result = new StringBuilder(); for (int i = 0; i < string.length(); i++) { - if (i != 0 && (Character.isUpperCase(string.charAt(i)) || ( - Character.isDigit(string.charAt(i - 1)) ^ Character.isDigit(string.charAt(i))))) + if (i != 0 && (Character.isUpperCase(string.charAt(i)) || + (Character.isDigit(string.charAt(i - 1)) ^ Character.isDigit(string.charAt(i))))) result.append("_"); result.append(Character.toLowerCase(string.charAt(i))); } @@ -85,10 +87,12 @@ public static String toLowerCaseUnderscore(String string) { } /** - * Does almost the same thing as .to(LOWER_UNDERSCORE, string), but it also inserts underscores between words and numbers. + * Does almost the same thing as .to(LOWER_UNDERSCORE, string), but it also inserts underscores between words and + * numbers. * * @param string Any string with ASCII characters. - * @return A string that is all lowercase, with underscores inserted before word/number boundaries: "maragingSteel300" -> "maraging_steel_300" + * @return A string that is all lowercase, with underscores inserted before word/number boundaries: + * "maragingSteel300" -> "maraging_steel_300" */ public static String toLowerCaseUnder(String string) { return CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, string); @@ -124,10 +128,12 @@ public static String toRomanNumeral(int number) { } /** - * Does almost the same thing as LOWER_UNDERSCORE.to(UPPER_CAMEL, string), but it also removes underscores before numbers. + * Does almost the same thing as LOWER_UNDERSCORE.to(UPPER_CAMEL, string), but it also removes underscores before + * numbers. * * @param string Any string with ASCII characters. - * @return A string that is all lowercase, with underscores inserted before word/number boundaries: "maraging_steel_300" -> "maragingSteel300" + * @return A string that is all lowercase, with underscores inserted before word/number boundaries: + * "maraging_steel_300" -> "maragingSteel300" */ public static String lowerUnderscoreToUpperCamel(String string) { StringBuilder result = new StringBuilder(); diff --git a/src/main/java/com/gregtechceu/gtceu/utils/GTHashMaps.java b/src/main/java/com/gregtechceu/gtceu/utils/GTHashMaps.java index 10f3d62468..0cd85697d8 100644 --- a/src/main/java/com/gregtechceu/gtceu/utils/GTHashMaps.java +++ b/src/main/java/com/gregtechceu/gtceu/utils/GTHashMaps.java @@ -3,10 +3,12 @@ import com.lowdragmc.lowdraglib.side.fluid.FluidStack; import com.lowdragmc.lowdraglib.side.fluid.IFluidTransfer; import com.lowdragmc.lowdraglib.side.item.IItemTransfer; -import it.unimi.dsi.fastutil.objects.*; + import net.minecraft.world.item.ItemStack; +import it.unimi.dsi.fastutil.objects.*; import org.jetbrains.annotations.NotNull; + import java.util.Collection; import java.util.Map; import java.util.Set; @@ -50,7 +52,8 @@ public static Object2IntMap fromItemHandler(@NotNull IItemTransfer in } /** - * Maps all items in the {@link ItemStack} {@link Collection} into a {@link ItemStack}, {@link Integer} value as amount + * Maps all items in the {@link ItemStack} {@link Collection} into a {@link ItemStack}, {@link Integer} value as + * amount * * @param inputs The inventory handler of the inventory * @return a {@link Map} of {@link ItemStack} and {@link Integer} as amount on the inventory @@ -61,14 +64,16 @@ public static Object2IntMap fromItemStackCollection(@NotNull Iterable } /** - * Maps all items in the {@link ItemStack} {@link Collection} into a {@link ItemStack}, {@link Integer} value as amount + * Maps all items in the {@link ItemStack} {@link Collection} into a {@link ItemStack}, {@link Integer} value as + * amount * * @param inputs The inventory handler of the inventory * @param linked If the Map should be a Linked Map to preserve insertion order * @return a {@link Map} of {@link ItemStack} and {@link Integer} as amount on the inventory */ @NotNull - public static Object2IntMap fromItemStackCollection(@NotNull Iterable inputs, boolean linked) { + public static Object2IntMap fromItemStackCollection(@NotNull Iterable inputs, + boolean linked) { final Object2IntMap map = createItemStackMap(linked); // Create a single stack of the combined count for each item @@ -92,7 +97,8 @@ private static Object2IntMap createItemStackMap(boolean linked) { * Maps all fluids in the {@link IFluidTransfer} into a {@link FluidKey}, {@link Integer} value as amount * * @param fluidInputs The combined fluid input inventory handler, in the form of an {@link IFluidTransfer} - * @return a {@link Set} of unique {@link FluidKey}s for each fluid in the handler. Will be oversized stacks if required + * @return a {@link Set} of unique {@link FluidKey}s for each fluid in the handler. Will be oversized stacks if + * required */ public static Map fromFluidHandler(IFluidTransfer fluidInputs) { final Object2LongMap map = new Object2LongLinkedOpenHashMap<>(); @@ -111,10 +117,12 @@ public static Map fromFluidHandler(IFluidTransfer fluidInputs) { } /** - * Maps all fluids in the {@link FluidStack} {@link Collection} into a {@link FluidKey}, {@link Integer} value as amount + * Maps all fluids in the {@link FluidStack} {@link Collection} into a {@link FluidKey}, {@link Integer} value as + * amount * * @param fluidInputs The combined fluid input inventory handler, in the form of an {@link IFluidTransfer} - * @return a {@link Set} of unique {@link FluidKey}s for each fluid in the handler. Will be oversized stacks if required + * @return a {@link Set} of unique {@link FluidKey}s for each fluid in the handler. Will be oversized stacks if + * required */ public static Map fromFluidCollection(Collection fluidInputs) { final Object2LongMap map = new Object2LongLinkedOpenHashMap<>(); diff --git a/src/main/java/com/gregtechceu/gtceu/utils/GTMath.java b/src/main/java/com/gregtechceu/gtceu/utils/GTMath.java index 253ef00062..ec661f46fd 100644 --- a/src/main/java/com/gregtechceu/gtceu/utils/GTMath.java +++ b/src/main/java/com/gregtechceu/gtceu/utils/GTMath.java @@ -4,10 +4,10 @@ import javax.annotation.ParametersAreNonnullByDefault; - @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault public class GTMath { + public static long clamp(long value, long min, long max) { return Math.max(min, Math.min(max, value)); } diff --git a/src/main/java/com/gregtechceu/gtceu/utils/GTStringUtils.java b/src/main/java/com/gregtechceu/gtceu/utils/GTStringUtils.java index 3255c52200..8565b27e24 100644 --- a/src/main/java/com/gregtechceu/gtceu/utils/GTStringUtils.java +++ b/src/main/java/com/gregtechceu/gtceu/utils/GTStringUtils.java @@ -8,7 +8,6 @@ public class GTStringUtils { - /** * Better implementation of {@link ItemStack#toString()} which respects the stack-aware * {@link net.minecraft.world.item.Item#getDescriptionId(ItemStack)} method. diff --git a/src/main/java/com/gregtechceu/gtceu/utils/GTTransferUtils.java b/src/main/java/com/gregtechceu/gtceu/utils/GTTransferUtils.java index 58cb60684d..8907c36b98 100644 --- a/src/main/java/com/gregtechceu/gtceu/utils/GTTransferUtils.java +++ b/src/main/java/com/gregtechceu/gtceu/utils/GTTransferUtils.java @@ -1,20 +1,22 @@ package com.gregtechceu.gtceu.utils; - import com.gregtechceu.gtceu.api.machine.trait.NotifiableFluidTank; import com.gregtechceu.gtceu.api.machine.trait.NotifiableItemStackHandler; + import com.lowdragmc.lowdraglib.misc.FluidTransferList; import com.lowdragmc.lowdraglib.misc.ItemHandlerHelper; import com.lowdragmc.lowdraglib.misc.ItemTransferList; import com.lowdragmc.lowdraglib.side.fluid.FluidStack; import com.lowdragmc.lowdraglib.side.fluid.IFluidTransfer; import com.lowdragmc.lowdraglib.side.item.IItemTransfer; + +import net.minecraft.world.item.ItemStack; + import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.ints.IntList; import it.unimi.dsi.fastutil.objects.Object2IntMap; -import net.minecraft.world.item.ItemStack; - import org.jetbrains.annotations.NotNull; + import java.util.List; import java.util.function.Predicate; @@ -24,16 +26,19 @@ public static int transferFluids(@NotNull IFluidTransfer sourceHandler, @NotNull return transferFluids(sourceHandler, destHandler, Integer.MAX_VALUE, fluidStack -> true); } - public static int transferFluids(@NotNull IFluidTransfer sourceHandler, @NotNull IFluidTransfer destHandler, int transferLimit) { + public static int transferFluids(@NotNull IFluidTransfer sourceHandler, @NotNull IFluidTransfer destHandler, + int transferLimit) { return transferFluids(sourceHandler, destHandler, transferLimit, fluidStack -> true); } - public static int transferFluids(@NotNull IFluidTransfer sourceHandler, @NotNull IFluidTransfer destHandler, int transferLimit, @NotNull Predicate fluidFilter) { + public static int transferFluids(@NotNull IFluidTransfer sourceHandler, @NotNull IFluidTransfer destHandler, + int transferLimit, @NotNull Predicate fluidFilter) { int fluidLeftToTransfer = transferLimit; for (int i = 0; i < sourceHandler.getTanks(); ++i) { FluidStack currentFluid = sourceHandler.getFluidInTank(i); - if (currentFluid == FluidStack.empty() || currentFluid.getAmount() == 0 || !fluidFilter.test(currentFluid)) { + if (currentFluid == FluidStack.empty() || currentFluid.getAmount() == 0 || + !fluidFilter.test(currentFluid)) { continue; } @@ -60,7 +65,8 @@ public static int transferFluids(@NotNull IFluidTransfer sourceHandler, @NotNull return transferLimit - fluidLeftToTransfer; } - public static boolean transferExactFluidStack(@NotNull IFluidTransfer sourceHandler, @NotNull IFluidTransfer destHandler, FluidStack fluidStack) { + public static boolean transferExactFluidStack(@NotNull IFluidTransfer sourceHandler, + @NotNull IFluidTransfer destHandler, FluidStack fluidStack) { long amount = fluidStack.getAmount(); FluidStack sourceFluid = sourceHandler.drain(fluidStack, true); if (sourceFluid == FluidStack.empty() || sourceFluid.getAmount() != amount) { @@ -94,7 +100,8 @@ public static void moveInventoryItems(IItemTransfer sourceInventory, IItemTransf /** * Simulates the insertion of items into a target inventory, then optionally performs the insertion. - *

+ *
+ *
* Simulating will not modify any of the input parameters. Insertion will either succeed completely, or fail * without modifying anything. * This method should be called with {@code simulate} {@code true} first, then {@code simulate} {@code false}, @@ -130,7 +137,8 @@ public static boolean addItemsToItemHandler(final IItemTransfer handler, /** * Simulates the insertion of fluid into a target fluid handler, then optionally performs the insertion. - *

+ *
+ *
* Simulating will not modify any of the input parameters. Insertion will either succeed completely, or fail * without modifying anything. * This method should be called with {@code simulate} {@code true} first, then {@code simulate} {@code false}, @@ -179,7 +187,8 @@ public static long fillFluidAccountNotifiableList(IFluidTransfer handler, FluidS return handler.fill(stack, simulate); } - public static FluidStack drainFluidAccountNotifiableList(IFluidTransfer handler, FluidStack stack, boolean simulate) { + public static FluidStack drainFluidAccountNotifiableList(IFluidTransfer handler, FluidStack stack, + boolean simulate) { if (stack.isEmpty()) return FluidStack.empty(); if (handler instanceof FluidTransferList transferList) { var copied = stack.copy(); @@ -233,7 +242,8 @@ public static ItemStack insertItem(IItemTransfer handler, ItemStack stack, boole return stack; } - public static ItemStack insertItemAccountNotifiableList(IItemTransfer handler, int slot, ItemStack stack, boolean simulate) { + public static ItemStack insertItemAccountNotifiableList(IItemTransfer handler, int slot, ItemStack stack, + boolean simulate) { if (handler instanceof ItemTransferList transferList) { int index = 0; for (var transfer : transferList.transfers) { diff --git a/src/main/java/com/gregtechceu/gtceu/utils/GTUtil.java b/src/main/java/com/gregtechceu/gtceu/utils/GTUtil.java index 7dcc4ad4da..3efaf680bb 100644 --- a/src/main/java/com/gregtechceu/gtceu/utils/GTUtil.java +++ b/src/main/java/com/gregtechceu/gtceu/utils/GTUtil.java @@ -2,19 +2,18 @@ import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.data.chemical.material.Material; -import com.gregtechceu.gtceu.api.data.chemical.material.properties.HazardProperty; import com.gregtechceu.gtceu.api.data.chemical.material.properties.PropertyKey; import com.gregtechceu.gtceu.api.data.tag.TagPrefix; import com.gregtechceu.gtceu.api.fluids.store.FluidStorageKeys; -import com.gregtechceu.gtceu.common.data.GTDamageTypes; import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.data.recipe.CustomTags; + import com.lowdragmc.lowdraglib.LDLib; import com.lowdragmc.lowdraglib.side.fluid.FluidHelper; import com.lowdragmc.lowdraglib.side.fluid.FluidStack; import com.lowdragmc.lowdraglib.side.fluid.FluidTransferHelper; import com.lowdragmc.lowdraglib.side.fluid.IFluidTransfer; -import com.mojang.blaze3d.platform.InputConstants; + import net.minecraft.client.Minecraft; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -22,7 +21,6 @@ import net.minecraft.network.chat.Component; import net.minecraft.tags.BiomeTags; import net.minecraft.util.RandomSource; -import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.item.DyeColor; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; @@ -32,10 +30,12 @@ import net.minecraft.world.level.material.Fluid; import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.common.Tags; + +import com.mojang.blaze3d.platform.InputConstants; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import org.lwjgl.glfw.GLFW; -import org.jetbrains.annotations.Nullable; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.util.Collections; @@ -43,7 +43,6 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; -import java.util.function.Supplier; import static com.gregtechceu.gtceu.api.data.chemical.material.properties.PropertyKey.HAZARD; @@ -136,7 +135,6 @@ public static Direction getFacingToNeighbor(@NotNull BlockPos main, @NotNull Blo return null; } - public static float getExplosionPower(long voltage) { return getTierByVoltage(voltage) + 1; } @@ -145,7 +143,7 @@ public static float getExplosionPower(long voltage) { * @param array Array sorted with natural order * @param value Value to search for * @return Index of the nearest value lesser or equal than {@code value}, - * or {@code -1} if there's no entry matching the condition + * or {@code -1} if there's no entry matching the condition */ public static int nearestLesserOrEqual(@NotNull long[] array, long value) { int low = 0, high = array.length - 1; @@ -165,7 +163,7 @@ public static int nearestLesserOrEqual(@NotNull long[] array, long value) { * @param array Array sorted with natural order * @param value Value to search for * @return Index of the nearest value lesser than {@code value}, - * or {@code -1} if there's no entry matching the condition + * or {@code -1} if there's no entry matching the condition */ public static int nearestLesser(@NotNull long[] array, long value) { int low = 0, high = array.length - 1; @@ -183,8 +181,8 @@ public static int nearestLesser(@NotNull long[] array, long value) { /** * @return Lowest tier of the voltage that can handle {@code voltage}; that is, - * a voltage with value greater than equal than {@code voltage}. If there's no - * tier that can handle it, {@code MAX} is returned. + * a voltage with value greater than equal than {@code voltage}. If there's no + * tier that can handle it, {@code MAX} is returned. */ public static byte getTierByVoltage(long voltage) { // Yes, yes we do need UHV+. @@ -195,7 +193,7 @@ public static byte getTierByVoltage(long voltage) { * Ex: This method turns both 1024 and 512 into HV. * * @return the highest voltage tier with value below or equal to {@code voltage}, or - * {@code ULV} if there's no tier below + * {@code ULV} if there's no tier below */ public static byte getFloorTierByVoltage(long voltage) { return (byte) Math.max(GTValues.ULV, nearestLesserOrEqual(GTValues.V, voltage)); @@ -279,7 +277,8 @@ public static Class getActualTypeParameter(Class thisClas public static boolean isShiftDown() { if (LDLib.isClient()) { var id = Minecraft.getInstance().getWindow().getWindow(); - return InputConstants.isKeyDown(id, GLFW.GLFW_KEY_LEFT_SHIFT) || InputConstants.isKeyDown(id, GLFW.GLFW_KEY_LEFT_SHIFT); + return InputConstants.isKeyDown(id, GLFW.GLFW_KEY_LEFT_SHIFT) || + InputConstants.isKeyDown(id, GLFW.GLFW_KEY_LEFT_SHIFT); } return false; } @@ -287,7 +286,8 @@ public static boolean isShiftDown() { public static boolean isCtrlDown() { if (LDLib.isClient()) { var id = Minecraft.getInstance().getWindow().getWindow(); - return InputConstants.isKeyDown(id, GLFW.GLFW_KEY_LEFT_CONTROL) || InputConstants.isKeyDown(id, GLFW.GLFW_KEY_RIGHT_CONTROL); + return InputConstants.isKeyDown(id, GLFW.GLFW_KEY_LEFT_CONTROL) || + InputConstants.isKeyDown(id, GLFW.GLFW_KEY_RIGHT_CONTROL); } return false; } @@ -295,17 +295,20 @@ public static boolean isCtrlDown() { public static boolean isAltDown() { if (LDLib.isClient()) { var id = Minecraft.getInstance().getWindow().getWindow(); - return InputConstants.isKeyDown(id, GLFW.GLFW_KEY_LEFT_ALT) || InputConstants.isKeyDown(id, GLFW.GLFW_KEY_RIGHT_ALT); + return InputConstants.isKeyDown(id, GLFW.GLFW_KEY_LEFT_ALT) || + InputConstants.isKeyDown(id, GLFW.GLFW_KEY_RIGHT_ALT); } return false; } public static boolean isFluidStackAmountDivisible(FluidStack fluidStack, int divisor) { - return fluidStack.getAmount() % divisor == 0 && fluidStack.getAmount() % divisor != fluidStack.getAmount() && fluidStack.getAmount() / divisor != 0; + return fluidStack.getAmount() % divisor == 0 && fluidStack.getAmount() % divisor != fluidStack.getAmount() && + fluidStack.getAmount() / divisor != 0; } public static boolean isItemStackCountDivisible(ItemStack itemStack, int divisor) { - return itemStack.getCount() % divisor == 0 && itemStack.getCount() % divisor != itemStack.getCount() && itemStack.getCount() / divisor != 0; + return itemStack.getCount() % divisor == 0 && itemStack.getCount() % divisor != itemStack.getCount() && + itemStack.getCount() / divisor != 0; } public static int getItemBurnTime(Item item) { @@ -317,20 +320,16 @@ public static long getPumpBiomeModifier(Holder biome) { return -1; } - if (biome.is(BiomeTags.IS_DEEP_OCEAN) - || biome.is(BiomeTags.IS_OCEAN) - || biome.is(BiomeTags.IS_BEACH) - || biome.is(BiomeTags.IS_RIVER)) { + if (biome.is(BiomeTags.IS_DEEP_OCEAN) || biome.is(BiomeTags.IS_OCEAN) || biome.is(BiomeTags.IS_BEACH) || + biome.is(BiomeTags.IS_RIVER)) { return FluidHelper.getBucket(); - } else if (biome.is(Tags.Biomes.IS_SWAMP) - || biome.is(Tags.Biomes.IS_WET)) { + } else if (biome.is(Tags.Biomes.IS_SWAMP) || biome.is(Tags.Biomes.IS_WET)) { return FluidHelper.getBucket() * 4 / 5; } else if (biome.is(BiomeTags.IS_JUNGLE)) { return FluidHelper.getBucket() * 35 / 100; } else if (biome.is(Tags.Biomes.IS_SNOWY)) { return FluidHelper.getBucket() * 3 / 10; - } else if (biome.is(Tags.Biomes.IS_PLAINS) - || biome.is(BiomeTags.IS_FOREST)) { + } else if (biome.is(Tags.Biomes.IS_PLAINS) || biome.is(BiomeTags.IS_FOREST)) { return FluidHelper.getBucket() / 4; } else if (biome.is(Tags.Biomes.IS_COLD)) { return FluidHelper.getBucket() * 175 / 1000; @@ -350,9 +349,8 @@ public static DyeColor determineDyeColor(int rgbColor) { for (DyeColor dyeColor : DyeColor.values()) { float[] c2 = GradientUtil.getRGB(dyeColor.getTextColor()); - double distance = (c[0] - c2[0]) * (c[0] - c2[0]) - + (c[1] - c2[1]) * (c[1] - c2[1]) - + (c[2] - c2[2]) * (c[2] - c2[2]); + double distance = (c[0] - c2[0]) * (c[0] - c2[0]) + (c[1] - c2[1]) * (c[1] - c2[1]) + + (c[2] - c2[2]) * (c[2] - c2[2]); distances.put(distance, dyeColor); } @@ -421,29 +419,15 @@ public static boolean canSeeSunClearly(Level world, BlockPos blockPos) { return world.isDay(); } - public static void appendHazardTooltips(Material material, List tooltipComponents){ + public static void appendHazardTooltips(Material material, List tooltipComponents) { if (!ConfigHolder.INSTANCE.gameplay.hazardsEnabled || !material.hasProperty(HAZARD)) return; if (GTUtil.isShiftDown()) { tooltipComponents.add(Component.translatable("gtceu.hazard.description_shift")); - tooltipComponents.add(Component.translatable("gtceu.hazard." + material.getProperty(HAZARD).getHazardType().name().toLowerCase())); + tooltipComponents.add(Component + .translatable("gtceu.hazard." + material.getProperty(HAZARD).getHazardType().name().toLowerCase())); return; } tooltipComponents.add(Component.translatable("gtceu.hazard.description")); - } - - public static void applyHazardEffects(Material material, LivingEntity livingEntity, Supplier condition){ - if(!ConfigHolder.INSTANCE.gameplay.hazardsEnabled || !material.hasProperty(HAZARD) || !condition.get()) return; - - HazardProperty poisonProperty = material.getProperty(HAZARD); - - if(poisonProperty.getHazardType().getProtectionType().isProtected(livingEntity)) return; //entity has proper safety equipment - if(poisonProperty.getDamage()!=null && livingEntity.tickCount % (20*poisonProperty.getDamage().delay())==0) - livingEntity.hurt(GTDamageTypes.CHEMICAL.source(livingEntity.level()), poisonProperty.getDamage().damage()); - - if(poisonProperty.getEffect()!=null) - poisonProperty.getEffect().apply(livingEntity); - } - } diff --git a/src/main/java/com/gregtechceu/gtceu/utils/GradientUtil.java b/src/main/java/com/gregtechceu/gtceu/utils/GradientUtil.java index 8d912f988a..72daf22570 100644 --- a/src/main/java/com/gregtechceu/gtceu/utils/GradientUtil.java +++ b/src/main/java/com/gregtechceu/gtceu/utils/GradientUtil.java @@ -1,14 +1,12 @@ package com.gregtechceu.gtceu.utils; - import net.minecraft.util.FastColor; -import net.minecraft.util.Tuple; + import org.apache.commons.lang3.tuple.Pair; public class GradientUtil { - private GradientUtil() { - } + private GradientUtil() {} public static int argbToAbgr(int argb) { int r = (argb >> 16) & 0xFF; @@ -17,27 +15,27 @@ public static int argbToAbgr(int argb) { } public static int argbToRgba(int argb) { - return argb << 8 | (argb >>> 24); + return argb << 8 | (argb >>> 24); } public static float[] getRGB(int color) { float r = ((color >> 16) & 0xFF) / 255f; float g = ((color >> 8) & 0xFF) / 255f; - //noinspection PointlessBitwiseExpression + // noinspection PointlessBitwiseExpression float b = ((color >> 0) & 0xFF) / 255f; - return new float[]{r, g, b}; + return new float[] { r, g, b }; } public static int multiplyBlendRGBA(int c1, int c2) { int a1 = (c1 & 0xff); int r1 = ((c1 & 0xff000000) >> 24); int g1 = ((c1 & 0xff0000) >> 16); - int b1 = ((c1 & 0xff00) >> 8); + int b1 = ((c1 & 0xff00) >> 8); int a2 = (c2 & 0xff); int r2 = ((c2 & 0xff000000) >> 24); int g2 = ((c2 & 0xff0000) >> 16); - int b2 = ((c2 & 0xff00) >> 8); + int b2 = ((c2 & 0xff00) >> 8); int a = (a1 * a2) / 255; int r = (r1 * r2) / 255; @@ -48,8 +46,8 @@ public static int multiplyBlendRGBA(int c1, int c2) { } public static int blend(int c1, int c2, float ratio) { - if ( ratio > 1f ) ratio = 1f; - else if ( ratio < 0f ) ratio = 0f; + if (ratio > 1f) ratio = 1f; + else if (ratio < 0f) ratio = 0f; float iRatio = 1.0f - ratio; int a1 = (c1 >> 24 & 0xff); @@ -62,10 +60,10 @@ public static int blend(int c1, int c2, float ratio) { int g2 = ((c2 & 0xff00) >> 8); int b2 = (c2 & 0xff); - int a = (int)((a1 * iRatio) + (a2 * ratio)); - int r = (int)((r1 * iRatio) + (r2 * ratio)); - int g = (int)((g1 * iRatio) + (g2 * ratio)); - int b = (int)((b1 * iRatio) + (b2 * ratio)); + int a = (int) ((a1 * iRatio) + (a2 * ratio)); + int r = (int) ((r1 * iRatio) + (r2 * ratio)); + int g = (int) ((g1 * iRatio) + (g2 * ratio)); + int b = (int) ((b1 * iRatio) + (b2 * ratio)); return a << 24 | r << 16 | g << 8 | b; } @@ -89,7 +87,7 @@ public static float[] RGBtoHSL(int rgbColor) { // Get RGB values in the range 0 - 1 float r = ((rgbColor >> 16) & 0xFF) / 255f; float g = ((rgbColor >> 8) & 0xFF) / 255f; - //noinspection PointlessBitwiseExpression + // noinspection PointlessBitwiseExpression float b = ((rgbColor >> 0) & 0xFF) / 255f; // Minimum and Maximum RGB values are used in the HSL calculations @@ -121,7 +119,7 @@ public static float[] RGBtoHSL(int rgbColor) { s = (max - min) / (2 - max - min); } - return new float[] {h, s * 100, l * 100}; + return new float[] { h, s * 100, l * 100 }; } public static int toRGB(float[] hsv) { @@ -162,10 +160,10 @@ private static float hueToRGB(float p, float q, float h) { return p + ((q - p) * 6 * h); } if (2 * h < 1) { - return q; + return q; } if (3 * h < 2) { - return p + ( (q - p) * 6 * ((2.0F / 3.0F) - h) ); + return p + ((q - p) * 6 * ((2.0F / 3.0F) - h)); } return p; } diff --git a/src/main/java/com/gregtechceu/gtceu/utils/InfiniteEnergyContainer.java b/src/main/java/com/gregtechceu/gtceu/utils/InfiniteEnergyContainer.java index abdc903818..6d01282b78 100644 --- a/src/main/java/com/gregtechceu/gtceu/utils/InfiniteEnergyContainer.java +++ b/src/main/java/com/gregtechceu/gtceu/utils/InfiniteEnergyContainer.java @@ -4,7 +4,9 @@ import com.gregtechceu.gtceu.api.machine.trait.NotifiableEnergyContainer; public class InfiniteEnergyContainer extends NotifiableEnergyContainer { - public InfiniteEnergyContainer(MetaMachine machine, long maxCapacity, long maxInputVoltage, long maxInputAmperage, long maxOutputVoltage, long maxOutputAmperage) { + + public InfiniteEnergyContainer(MetaMachine machine, long maxCapacity, long maxInputVoltage, long maxInputAmperage, + long maxOutputVoltage, long maxOutputAmperage) { super(machine, maxCapacity, maxInputVoltage, maxInputAmperage, maxOutputVoltage, maxOutputAmperage); } diff --git a/src/main/java/com/gregtechceu/gtceu/utils/IngredientEquality.java b/src/main/java/com/gregtechceu/gtceu/utils/IngredientEquality.java index 934c9a4b6d..4e96e9457c 100644 --- a/src/main/java/com/gregtechceu/gtceu/utils/IngredientEquality.java +++ b/src/main/java/com/gregtechceu/gtceu/utils/IngredientEquality.java @@ -1,11 +1,11 @@ package com.gregtechceu.gtceu.utils; -import com.google.common.collect.Lists; import com.gregtechceu.gtceu.api.recipe.ingredient.SizedIngredient; import com.gregtechceu.gtceu.core.mixins.IngredientAccessor; import com.gregtechceu.gtceu.core.mixins.IntersectionIngredientAccessor; import com.gregtechceu.gtceu.core.mixins.StrictNBTIngredientAccessor; import com.gregtechceu.gtceu.core.mixins.TagValueAccessor; + import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.Ingredient; @@ -13,12 +13,17 @@ import net.minecraftforge.common.crafting.PartialNBTIngredient; import net.minecraftforge.common.crafting.StrictNBTIngredient; +import com.google.common.collect.Lists; + import java.util.*; public class IngredientEquality { - public static final Comparator STACK_COMPARATOR = Comparator.comparing(stack -> BuiltInRegistries.ITEM.getKey(stack.getItem())); + + public static final Comparator STACK_COMPARATOR = Comparator + .comparing(stack -> BuiltInRegistries.ITEM.getKey(stack.getItem())); public static final Comparator INGREDIENT_VALUE_COMPARATOR = new Comparator<>() { + @Override public int compare(Ingredient.Value value1, Ingredient.Value value2) { if (value1 instanceof Ingredient.TagValue tagValue) { @@ -46,6 +51,7 @@ public int compare(Ingredient.Value value1, Ingredient.Value value2) { }; public static final Comparator INGREDIENT_COMPARATOR = new Comparator<>() { + @Override public int compare(Ingredient first, Ingredient second) { if (first instanceof StrictNBTIngredient strict1) { @@ -70,8 +76,10 @@ public int compare(Ingredient first, Ingredient second) { if (first instanceof IntersectionIngredient intersection1) { if (second instanceof IntersectionIngredient intersection2) { - List ingredients1 = Lists.newArrayList(((IntersectionIngredientAccessor)intersection1).getChildren()); - List ingredients2 = Lists.newArrayList(((IntersectionIngredientAccessor)intersection2).getChildren()); + List ingredients1 = Lists + .newArrayList(((IntersectionIngredientAccessor) intersection1).getChildren()); + List ingredients2 = Lists + .newArrayList(((IntersectionIngredientAccessor) intersection2).getChildren()); if (ingredients1.size() != ingredients2.size()) return 1; ingredients1.sort(this); @@ -92,8 +100,8 @@ public int compare(Ingredient first, Ingredient second) { if (((IngredientAccessor) first).getValues().length != ((IngredientAccessor) second).getValues().length) return 1; - Ingredient.Value[] values1 = ((IngredientAccessor)first).getValues(); - Ingredient.Value[] values2 = ((IngredientAccessor)second).getValues(); + Ingredient.Value[] values1 = ((IngredientAccessor) first).getValues(); + Ingredient.Value[] values2 = ((IngredientAccessor) second).getValues(); if (values1.length != values2.length) return 1; Arrays.parallelSort(values1, INGREDIENT_VALUE_COMPARATOR); diff --git a/src/main/java/com/gregtechceu/gtceu/utils/ItemStackHashStrategy.java b/src/main/java/com/gregtechceu/gtceu/utils/ItemStackHashStrategy.java index 6bb4f42656..a1e57c66cf 100644 --- a/src/main/java/com/gregtechceu/gtceu/utils/ItemStackHashStrategy.java +++ b/src/main/java/com/gregtechceu/gtceu/utils/ItemStackHashStrategy.java @@ -1,9 +1,10 @@ package com.gregtechceu.gtceu.utils; -import it.unimi.dsi.fastutil.Hash; import net.minecraft.world.item.ItemStack; +import it.unimi.dsi.fastutil.Hash; import org.jetbrains.annotations.Nullable; + import java.util.Objects; /** @@ -11,6 +12,7 @@ * considering equality. */ public interface ItemStackHashStrategy extends Hash.Strategy { + /** * @return a builder object for producing a custom ItemStackHashStrategy. */ @@ -55,6 +57,7 @@ static ItemStackHashStrategy comparingItemDamageCount() { * Builder pattern class for generating customized ItemStackHashStrategy */ class ItemStackHashStrategyBuilder { + private boolean item, count, damage, tag; /** @@ -106,14 +109,14 @@ public ItemStackHashStrategyBuilder compareTag(boolean choice) { */ public ItemStackHashStrategy build() { return new ItemStackHashStrategy() { + @Override public int hashCode(@Nullable ItemStack o) { return o == null || o.isEmpty() ? 0 : Objects.hash( item ? o.getItem() : null, count ? o.getCount() : null, damage ? o.getDamageValue() : null, - tag ? o.getTag() : null - ); + tag ? o.getTag() : null); } @Override diff --git a/src/main/java/com/gregtechceu/gtceu/utils/OreDictExprFilter.java b/src/main/java/com/gregtechceu/gtceu/utils/OreDictExprFilter.java index fe5440f1cb..1c64426af4 100644 --- a/src/main/java/com/gregtechceu/gtceu/utils/OreDictExprFilter.java +++ b/src/main/java/com/gregtechceu/gtceu/utils/OreDictExprFilter.java @@ -1,11 +1,13 @@ package com.gregtechceu.gtceu.utils; import com.lowdragmc.lowdraglib.side.fluid.FluidStack; + import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.TagKey; import net.minecraft.world.item.ItemStack; import org.jetbrains.annotations.Nullable; + import java.util.ArrayList; import java.util.List; import java.util.Set; @@ -90,7 +92,8 @@ public static int parseExpression(List rules, String expression) { * @return if any of the items oreDicts matches the rules */ public static boolean matchesOreDict(List rules, ItemStack stack) { - Set oreDicts = stack.getTags().map(TagKey::location).map(ResourceLocation::getPath).collect(Collectors.toSet()); + Set oreDicts = stack.getTags().map(TagKey::location).map(ResourceLocation::getPath) + .collect(Collectors.toSet()); if (oreDicts.isEmpty()) return false; @@ -105,7 +108,8 @@ public static boolean matchesOreDict(List rules, ItemStack stack) { } public static boolean matchesOreDict(List rules, FluidStack stack) { - Set oreDicts = stack.getFluid().defaultFluidState().getTags().map(TagKey::location).map(ResourceLocation::getPath).collect(Collectors.toSet()); + Set oreDicts = stack.getFluid().defaultFluidState().getTags().map(TagKey::location) + .map(ResourceLocation::getPath).collect(Collectors.toSet()); if (oreDicts.size() == 0) return false; @@ -243,6 +247,7 @@ private static boolean matches(String[] filter, String oreDict, boolean startWil } public static class MatchRule { + public final MatchLogic logic; public final String expression; private final List subRules; @@ -289,6 +294,10 @@ public List getSubRules() { } public enum MatchLogic { - OR, AND, XOR, NOT, ANY + OR, + AND, + XOR, + NOT, + ANY } } diff --git a/src/main/java/com/gregtechceu/gtceu/utils/OverlayedFluidHandler.java b/src/main/java/com/gregtechceu/gtceu/utils/OverlayedFluidHandler.java index 020696fbb8..998a11c4d0 100644 --- a/src/main/java/com/gregtechceu/gtceu/utils/OverlayedFluidHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/utils/OverlayedFluidHandler.java @@ -8,6 +8,7 @@ import com.lowdragmc.lowdraglib.side.fluid.IFluidTransfer; import org.jetbrains.annotations.NotNull; + import java.util.ArrayList; import java.util.List; import java.util.stream.IntStream; @@ -21,7 +22,8 @@ public class OverlayedFluidHandler { public OverlayedFluidHandler(@NotNull FluidTransferList tank) { this.overlayedTanks = new ArrayList<>(); - FluidStack[] entries = IntStream.range(0, tank.getTanks()).mapToObj(tank::getFluidInTank).toArray(FluidStack[]::new); + FluidStack[] entries = IntStream.range(0, tank.getTanks()).mapToObj(tank::getFluidInTank) + .toArray(FluidStack[]::new); for (int i = 0; i < tank.getTanks(); ++i) { FluidStorage storage = new FluidStorage(tank.getTankCapacity(i)); storage.setFluid(entries[i]); diff --git a/src/main/java/com/gregtechceu/gtceu/utils/OverlayedItemHandler.java b/src/main/java/com/gregtechceu/gtceu/utils/OverlayedItemHandler.java index 27fd339978..a7bfbc3427 100644 --- a/src/main/java/com/gregtechceu/gtceu/utils/OverlayedItemHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/utils/OverlayedItemHandler.java @@ -1,11 +1,13 @@ package com.gregtechceu.gtceu.utils; import com.lowdragmc.lowdraglib.side.item.IItemTransfer; + import net.minecraft.world.item.ItemStack; import org.jetbrains.annotations.NotNull; public class OverlayedItemHandler { + private final OverlayedItemHandlerSlot[] originalSlots; private final OverlayedItemHandlerSlot[] slots; private final IItemTransfer overlayedHandler; @@ -38,7 +40,6 @@ public int getSlots() { * @param slot the slot to populate */ - private void initSlot(int slot) { if (this.originalSlots[slot] == null) { ItemStack stackToMirror = overlayedHandler.getStackInSlot(slot); @@ -48,17 +49,16 @@ private void initSlot(int slot) { } } - public int insertStackedItemStack(@NotNull ItemStack stack, int amountToInsert) { int lastKnownPopulatedSlot = 0; - //loop through all slots, looking for ones matching the key + // loop through all slots, looking for ones matching the key for (int i = 0; i < this.slots.length; i++) { - //populate the slot if it's not already populated + // populate the slot if it's not already populated initSlot(i); // if it's the same item or there is no item in the slot ItemStack slotKey = this.slots[i].getItemStack(); if (slotKey.isEmpty() || ItemStackHashStrategy.comparingAllButCount().equals(slotKey, stack)) { - //if the slot is not full + // if the slot is not full int canInsertUpTo = this.slots[i].getSlotLimit() - this.slots[i].getCount(); if (canInsertUpTo > 0) { int insertedAmount = Math.min(canInsertUpTo, amountToInsert); @@ -77,10 +77,10 @@ public int insertStackedItemStack(@NotNull ItemStack stack, int amountToInsert) // if the amountToInsert is still greater than 0, we need to insert it into a new slot if (amountToInsert > 0) { - //loop through all slots, starting from after the last seen slot with items in it, looking for empty ones. + // loop through all slots, starting from after the last seen slot with items in it, looking for empty ones. for (int i = lastKnownPopulatedSlot + 1; i < this.slots.length; i++) { OverlayedItemHandlerSlot slot = this.slots[i]; - //if the slot is empty + // if the slot is empty if (slot.getItemStack().isEmpty()) { int canInsertUpTo = Math.min(stack.getMaxStackSize(), slot.getSlotLimit()); if (canInsertUpTo > 0) { @@ -95,11 +95,12 @@ public int insertStackedItemStack(@NotNull ItemStack stack, int amountToInsert) } } } - //return the amount that wasn't inserted + // return the amount that wasn't inserted return amountToInsert; } private static class OverlayedItemHandlerSlot { + private ItemStack itemStack = ItemStack.EMPTY; private int count = 0; private int slotLimit; @@ -130,6 +131,7 @@ public int getCount() { /** * Storage of this ItemStack elsewhere will require copying it + * * @return the stored ItemStack */ @NotNull diff --git a/src/main/java/com/gregtechceu/gtceu/utils/OverlayingFluidStorage.java b/src/main/java/com/gregtechceu/gtceu/utils/OverlayingFluidStorage.java index 2509084c62..91b136d572 100644 --- a/src/main/java/com/gregtechceu/gtceu/utils/OverlayingFluidStorage.java +++ b/src/main/java/com/gregtechceu/gtceu/utils/OverlayingFluidStorage.java @@ -1,14 +1,17 @@ package com.gregtechceu.gtceu.utils; import com.gregtechceu.gtceu.api.machine.trait.NotifiableFluidTank; + import com.lowdragmc.lowdraglib.side.fluid.FluidStack; import com.lowdragmc.lowdraglib.side.fluid.IFluidStorage; import com.lowdragmc.lowdraglib.side.fluid.IFluidTransfer; + import lombok.RequiredArgsConstructor; import org.jetbrains.annotations.NotNull; @RequiredArgsConstructor public class OverlayingFluidStorage implements IFluidStorage { + private final IFluidTransfer transfer; private final int tank; diff --git a/src/main/java/com/gregtechceu/gtceu/utils/RedstoneUtil.java b/src/main/java/com/gregtechceu/gtceu/utils/RedstoneUtil.java index b6c2214198..4d6c1544d6 100644 --- a/src/main/java/com/gregtechceu/gtceu/utils/RedstoneUtil.java +++ b/src/main/java/com/gregtechceu/gtceu/utils/RedstoneUtil.java @@ -9,7 +9,8 @@ public class RedstoneUtil { * @param maxValue the max that the value can be * @param minValue the min that the value can be * @param isInverted whether to invert the logic of this method - * @return an int from 0 (value <= min) to 15 (value >= max) normally, with a ratio when the value is between min and max + * @return an int from 0 (value <= min) to 15 (value >= max) normally, with a ratio when the value is between min + * and max */ public static int computeRedstoneBetweenValues(long value, float maxValue, float minValue, boolean isInverted) { if (value >= maxValue) { @@ -37,7 +38,8 @@ public static int computeRedstoneBetweenValues(long value, float maxValue, float * @param output the output value the function modifies * @return returns the modified output value */ - public static int computeLatchedRedstoneBetweenValues(float value, float maxValue, float minValue, boolean isInverted, int output) { + public static int computeLatchedRedstoneBetweenValues(float value, float maxValue, float minValue, + boolean isInverted, int output) { if (value >= maxValue) { output = !isInverted ? 0 : 15; // value above maxValue should normally be 0, otherwise 15 } else if (value <= minValue) { diff --git a/src/main/java/com/gregtechceu/gtceu/utils/RegistryUtil.java b/src/main/java/com/gregtechceu/gtceu/utils/RegistryUtil.java index 8ceee7c3c3..41d5ea6df1 100644 --- a/src/main/java/com/gregtechceu/gtceu/utils/RegistryUtil.java +++ b/src/main/java/com/gregtechceu/gtceu/utils/RegistryUtil.java @@ -2,24 +2,24 @@ import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.core.Registry; -import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.level.biome.Biome; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.Arrays; import java.util.List; +import javax.annotation.ParametersAreNonnullByDefault; + @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault public class RegistryUtil { - private RegistryUtil() { - } - public static List> resolveResourceKeys(ResourceKey> registryKey, String... locations) { + private RegistryUtil() {} + + public static List> resolveResourceKeys(ResourceKey> registryKey, + String... locations) { return Arrays.stream(locations) - .map(location -> ResourceKey.create(registryKey, new ResourceLocation(location))) - .toList(); + .map(location -> ResourceKey.create(registryKey, new ResourceLocation(location))) + .toList(); } } diff --git a/src/main/java/com/gregtechceu/gtceu/utils/ResearchManager.java b/src/main/java/com/gregtechceu/gtceu/utils/ResearchManager.java index 0e6cec23f9..efc3dd5df7 100644 --- a/src/main/java/com/gregtechceu/gtceu/utils/ResearchManager.java +++ b/src/main/java/com/gregtechceu/gtceu/utils/ResearchManager.java @@ -3,7 +3,6 @@ import com.gregtechceu.gtceu.api.capability.recipe.IO; import com.gregtechceu.gtceu.api.capability.recipe.IRecipeCapabilityHolder; import com.gregtechceu.gtceu.api.capability.recipe.ItemRecipeCapability; -import com.gregtechceu.gtceu.api.item.ComponentItem; import com.gregtechceu.gtceu.api.item.IComponentItem; import com.gregtechceu.gtceu.api.item.component.IDataItem; import com.gregtechceu.gtceu.api.item.component.IItemComponent; @@ -14,19 +13,22 @@ import com.gregtechceu.gtceu.common.data.GTRecipeTypes; import com.gregtechceu.gtceu.config.ConfigHolder; import com.gregtechceu.gtceu.data.recipe.builder.GTRecipeBuilder; + import com.lowdragmc.lowdraglib.misc.ItemTransferList; import com.lowdragmc.lowdraglib.side.item.IItemTransfer; -import com.mojang.datafixers.util.Pair; + import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.Tag; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; -import org.jetbrains.annotations.ApiStatus; +import com.mojang.datafixers.util.Pair; +import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; + import java.util.Collections; import java.util.List; import java.util.function.Consumer; @@ -61,7 +63,8 @@ public static void registerScannerLogic() { * @param stackCompound the compound contained on the ItemStack to write to * @param researchId the research id */ - public static void writeResearchToNBT(@NotNull CompoundTag stackCompound, @NotNull String researchId, GTRecipeType recipeType) { + public static void writeResearchToNBT(@NotNull CompoundTag stackCompound, @NotNull String researchId, + GTRecipeType recipeType) { CompoundTag compound = new CompoundTag(); compound.putString(RESEARCH_ID_NBT_TAG, researchId); compound.putString(RESEARCH_TYPE_NBT_TAG, recipeType.registryName.toString()); @@ -79,8 +82,10 @@ public static Pair readResearchId(@NotNull ItemStack stack CompoundTag researchCompound = compound.getCompound(RESEARCH_NBT_TAG); String researchId = researchCompound.getString(RESEARCH_ID_NBT_TAG); - ResourceLocation researchRecipeType = ResourceLocation.tryParse(researchCompound.getString(RESEARCH_TYPE_NBT_TAG)); - return researchId.isEmpty() || researchRecipeType == null ? null : Pair.of(GTRegistries.RECIPE_TYPES.get(researchRecipeType), researchId); + ResourceLocation researchRecipeType = ResourceLocation + .tryParse(researchCompound.getString(RESEARCH_TYPE_NBT_TAG)); + return researchId.isEmpty() || researchRecipeType == null ? null : + Pair.of(GTRegistries.RECIPE_TYPES.get(researchRecipeType), researchId); } /** @@ -109,7 +114,7 @@ public static boolean hasResearchTag(@NotNull ItemStack stack) { /** * @param compound the compound to check - * @return if the tag has the research CompoundTag + * @return if the tag has the research CompoundTag */ private static boolean hasResearchTag(@Nullable CompoundTag compound) { if (compound == null || compound.isEmpty()) return false; @@ -121,15 +126,19 @@ private static boolean hasResearchTag(@Nullable CompoundTag compound) { * * @param builder the builder to retrieve recipe info from */ - public static void createDefaultResearchRecipe(@NotNull GTRecipeBuilder builder, Consumer provider) { + public static void createDefaultResearchRecipe(@NotNull GTRecipeBuilder builder, + Consumer provider) { if (!ConfigHolder.INSTANCE.machines.enableResearch) return; for (GTRecipeBuilder.ResearchRecipeEntry entry : builder.researchRecipeEntries()) { - createDefaultResearchRecipe(builder.recipeType, entry.researchId(), entry.researchStack(), entry.dataStack(), entry.duration(), entry.EUt(), entry.CWUt(), provider); + createDefaultResearchRecipe(builder.recipeType, entry.researchId(), entry.researchStack(), + entry.dataStack(), entry.duration(), entry.EUt(), entry.CWUt(), provider); } } - public static void createDefaultResearchRecipe(@NotNull GTRecipeType recipeType, @NotNull String researchId, @NotNull ItemStack researchItem, @NotNull ItemStack dataItem, int duration, int EUt, int CWUt, Consumer provider) { + public static void createDefaultResearchRecipe(@NotNull GTRecipeType recipeType, @NotNull String researchId, + @NotNull ItemStack researchItem, @NotNull ItemStack dataItem, + int duration, int EUt, int CWUt, Consumer provider) { if (!ConfigHolder.INSTANCE.machines.enableResearch) return; CompoundTag compound = dataItem.getOrCreateTag(); @@ -163,7 +172,9 @@ public static class DataStickCopyScannerLogic implements GTRecipeType.ICustomSca @Override public GTRecipe createCustomRecipe(IRecipeCapabilityHolder holder) { - var itemInputs = holder.getCapabilitiesProxy().get(IO.IN, ItemRecipeCapability.CAP).stream().filter(IItemTransfer.class::isInstance).map(IItemTransfer.class::cast).toArray(IItemTransfer[]::new); + var itemInputs = holder.getCapabilitiesProxy().get(IO.IN, ItemRecipeCapability.CAP).stream() + .filter(IItemTransfer.class::isInstance).map(IItemTransfer.class::cast) + .toArray(IItemTransfer[]::new); var inputs = new ItemTransferList(itemInputs); if (inputs.getSlots() > 1) { // try the data recipe both ways, prioritizing overwriting the first @@ -210,4 +221,4 @@ public List getRepresentativeRecipes() { .buildRawRecipe()); } } -} \ No newline at end of file +} diff --git a/src/main/java/com/gregtechceu/gtceu/utils/SupplierMemoizer.java b/src/main/java/com/gregtechceu/gtceu/utils/SupplierMemoizer.java index dfce1a77d3..bfcab67d95 100644 --- a/src/main/java/com/gregtechceu/gtceu/utils/SupplierMemoizer.java +++ b/src/main/java/com/gregtechceu/gtceu/utils/SupplierMemoizer.java @@ -18,6 +18,7 @@ public static Supplier memoizeBlockSupplier(Supplier del } public static class MemoizedSupplier implements Supplier { + transient T value; transient volatile boolean initialized; final Supplier delegate; @@ -44,15 +45,15 @@ public T get() { @Override public String toString() { - return "SupplierMemoizer.memoize(" - + (initialized ? "" : delegate) - + ")"; + return "SupplierMemoizer.memoize(" + (initialized ? "" : delegate) + + ")"; } } /** * A variant of the memoized supplier that stores a block explicitly. - * Use this to save blocks to {@link com.gregtechceu.gtceu.api.data.chemical.ChemicalHelper#registerUnificationItems(com.gregtechceu.gtceu.api.data.chemical.material.stack.UnificationEntry, Supplier[])} + * Use this to save blocks to + * {@link com.gregtechceu.gtceu.api.data.chemical.ChemicalHelper#registerUnificationItems(com.gregtechceu.gtceu.api.data.chemical.material.stack.UnificationEntry, Supplier[])} */ public static class MemoizedBlockSupplier extends MemoizedSupplier { @@ -62,9 +63,8 @@ public static class MemoizedBlockSupplier extends MemoizedSuppl @Override public String toString() { - return "SupplierMemoizer.memoizeBlockSupplier(" - + (initialized ? "" : delegate) - + ")"; + return "SupplierMemoizer.memoizeBlockSupplier(" + + (initialized ? "" : delegate) + ")"; } } } diff --git a/src/main/java/com/gregtechceu/gtceu/utils/TaskHandler.java b/src/main/java/com/gregtechceu/gtceu/utils/TaskHandler.java index 4639851ef9..67d6f4c2e6 100644 --- a/src/main/java/com/gregtechceu/gtceu/utils/TaskHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/utils/TaskHandler.java @@ -1,6 +1,7 @@ package com.gregtechceu.gtceu.utils; import com.gregtechceu.gtceu.GTCEu; + import net.minecraft.resources.ResourceKey; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.Level; @@ -11,6 +12,7 @@ import java.util.Map; public class TaskHandler { + private static final Map, List> serverTasks = new HashMap<>(); private static final Map, List> waitToAddTasks = new HashMap<>(); @@ -55,11 +57,13 @@ private static void execute(List tasks) { public static void enqueueServerTask(ServerLevel level, Runnable task, int delay) { synchronized (waitToAddTasks) { - waitToAddTasks.computeIfAbsent(level.dimension(), key -> new ArrayList<>()).add(new RunnableEntry(task, delay)); + waitToAddTasks.computeIfAbsent(level.dimension(), key -> new ArrayList<>()) + .add(new RunnableEntry(task, delay)); } } private static class RunnableEntry { + Runnable runnable; int delay; @@ -68,5 +72,4 @@ public RunnableEntry(Runnable runnable, int delay) { this.delay = delay; } } - } diff --git a/src/main/java/com/gregtechceu/gtceu/utils/ToolItemHelper.java b/src/main/java/com/gregtechceu/gtceu/utils/ToolItemHelper.java index 1c5c1bb846..46e63cd644 100644 --- a/src/main/java/com/gregtechceu/gtceu/utils/ToolItemHelper.java +++ b/src/main/java/com/gregtechceu/gtceu/utils/ToolItemHelper.java @@ -3,7 +3,7 @@ import com.gregtechceu.gtceu.api.capability.GTCapabilityHelper; import com.gregtechceu.gtceu.api.capability.IElectricItem; import com.gregtechceu.gtceu.api.item.capability.ElectricItem; -import com.tterrag.registrate.util.entry.ItemEntry; + import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; @@ -23,7 +23,8 @@ public static ItemStack getMaxChargeOverrideStack(Item item, long maxCharge) { throw new IllegalStateException("Not an electric item."); } if (!(electricItem instanceof ElectricItem)) { - throw new IllegalStateException("Only standard ElectricItem implementation supported, but this item uses " + electricItem.getClass()); + throw new IllegalStateException("Only standard ElectricItem implementation supported, but this item uses " + + electricItem.getClass()); } ((ElectricItem) electricItem).setMaxChargeOverride(maxCharge); return itemStack; diff --git a/src/main/java/com/gregtechceu/gtceu/utils/forge/GTUtilImpl.java b/src/main/java/com/gregtechceu/gtceu/utils/forge/GTUtilImpl.java deleted file mode 100644 index 7781b22fb9..0000000000 --- a/src/main/java/com/gregtechceu/gtceu/utils/forge/GTUtilImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.gregtechceu.gtceu.utils.forge; - -import com.gregtechceu.gtceu.data.recipe.CustomTags; -import com.lowdragmc.lowdraglib.side.fluid.FluidHelper; -import net.minecraft.core.Holder; -import net.minecraft.tags.BiomeTags; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.crafting.RecipeType; -import net.minecraft.world.level.biome.Biome; -import net.minecraftforge.common.ForgeHooks; -import net.minecraftforge.common.Tags; - -/** - * @author KilaBash - * @date 2023/3/17 - * @implNote GTUtilImpl - */ -public class GTUtilImpl { - -} diff --git a/src/main/java/com/gregtechceu/gtceu/utils/input/KeyBind.java b/src/main/java/com/gregtechceu/gtceu/utils/input/KeyBind.java index 78734f4d01..dff0636290 100644 --- a/src/main/java/com/gregtechceu/gtceu/utils/input/KeyBind.java +++ b/src/main/java/com/gregtechceu/gtceu/utils/input/KeyBind.java @@ -3,8 +3,9 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.common.network.GTNetwork; import com.gregtechceu.gtceu.common.network.packets.CPacketKeysPressed; + import com.lowdragmc.lowdraglib.Platform; -import com.mojang.blaze3d.platform.InputConstants; + import net.minecraft.client.KeyMapping; import net.minecraft.client.Minecraft; import net.minecraft.server.level.ServerPlayer; @@ -18,6 +19,8 @@ import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; + +import com.mojang.blaze3d.platform.InputConstants; import org.apache.commons.lang3.tuple.MutablePair; import java.util.*; @@ -25,6 +28,7 @@ @Mod.EventBusSubscriber(modid = GTCEu.MOD_ID, value = Dist.CLIENT, bus = Mod.EventBusSubscriber.Bus.FORGE) public enum KeyBind { + VANILLA_JUMP(() -> () -> Minecraft.getInstance().options.keyJump), VANILLA_SNEAK(() -> () -> Minecraft.getInstance().options.keyShift), VANILLA_FORWARD(() -> () -> Minecraft.getInstance().options.keyUp), diff --git a/src/main/resources/assets/gtceu/lang/ru_ru.json b/src/main/resources/assets/gtceu/lang/ru_ru.json index 2a6be4ce55..e00b4a1d26 100644 --- a/src/main/resources/assets/gtceu/lang/ru_ru.json +++ b/src/main/resources/assets/gtceu/lang/ru_ru.json @@ -722,64 +722,64 @@ "block.gtceu.oil_heavy": "Тяжелая нефть", "block.gtceu.oil_light": "Легкая нефть", "block.gtceu.oil_medium": "Средняя нефть", - "block.gtceu.opv_1024a_laser_source_hatch": "Люк для Лазерного Источника (1024A §9OpV§r)", - "block.gtceu.opv_1024a_laser_target_hatch": "Люк для Лазерного Приемника (1024A §9OpV§r)", - "block.gtceu.opv_16a_energy_converter": "Преобразователь энергии (16A §9OpV§r)", - "block.gtceu.opv_1a_energy_converter": "Преобразователь энергии (1A §9OpV§r)", - "block.gtceu.opv_256a_laser_source_hatch": "Люк для Лазерного Источника (256A §9OpV§r)", - "block.gtceu.opv_256a_laser_target_hatch": "Люк для Лазерного Приемника (256A §9OpV§r)", - "block.gtceu.opv_4096a_laser_source_hatch": "Люк для Лазерного Источника (4096A §9OpV§r)", - "block.gtceu.opv_4096a_laser_target_hatch": "Люк для Лазерного Приемника (4096A §9OpV§r)", - "block.gtceu.opv_4a_energy_converter": "Преобразователь энергии (4A §9OpV§r)", - "block.gtceu.opv_8a_energy_converter": "Преобразователь энергии (8A §9OpV§r)", + "block.gtceu.opv_1024a_laser_source_hatch": "Люк для Лазерного Источника (1024A §9§lOpV§r)", + "block.gtceu.opv_1024a_laser_target_hatch": "Люк для Лазерного Приемника (1024A §9§lOpV§r)", + "block.gtceu.opv_16a_energy_converter": "Преобразователь энергии (16A §9§lOpV§r)", + "block.gtceu.opv_1a_energy_converter": "Преобразователь энергии (1A §9§lOpV§r)", + "block.gtceu.opv_256a_laser_source_hatch": "Люк для Лазерного Источника (256A §9§lOpV§r)", + "block.gtceu.opv_256a_laser_target_hatch": "Люк для Лазерного Приемника (256A §9§lOpV§r)", + "block.gtceu.opv_4096a_laser_source_hatch": "Люк для Лазерного Источника (4096A §9§lOpV§r)", + "block.gtceu.opv_4096a_laser_target_hatch": "Люк для Лазерного Приемника (4096A §9§lOpV§r)", + "block.gtceu.opv_4a_energy_converter": "Преобразователь энергии (4A §9§lOpV§r)", + "block.gtceu.opv_8a_energy_converter": "Преобразователь энергии (8A §9§lOpV§r)", "block.gtceu.opv_alloy_smelter": "§9Совершенная печь для сплавов §r", "block.gtceu.opv_arc_furnace": "§9Совершенная дуговая печь §r", "block.gtceu.opv_assembler": "§9Совершенная сборочная машина §r", "block.gtceu.opv_autoclave": "§9Совершенный автоклав §r", - "block.gtceu.opv_battery_buffer_16x": "Батарейный буфер (16 ячеек §9OpV§r)", - "block.gtceu.opv_battery_buffer_4x": "Батарейный буфер (4 ячейки §9OpV§r)", - "block.gtceu.opv_battery_buffer_8x": "Батарейный буфер (8 ячеек §9OpV§r)", + "block.gtceu.opv_battery_buffer_16x": "Батарейный буфер (16 ячеек §9§lOpV§r)", + "block.gtceu.opv_battery_buffer_4x": "Батарейный буфер (4 ячейки §9§lOpV§r)", + "block.gtceu.opv_battery_buffer_8x": "Батарейный буфер (8 ячеек §9§lOpV§r)", "block.gtceu.opv_bender": "§9Совершенный гибочный станок §r", "block.gtceu.opv_brewery": "§9Совершенная варочная машина §r", "block.gtceu.opv_canner": "§9Совершенный наполнитель §r", "block.gtceu.opv_centrifuge": "§9Совершенная центрифуга §r", - "block.gtceu.opv_charger_4x": "Зарядное устройство (§9OpV§r)", + "block.gtceu.opv_charger_4x": "Зарядное устройство (§9§lOpV§r)", "block.gtceu.opv_chemical_bath": "§9Совершенная химическая ванна §r", "block.gtceu.opv_chemical_reactor": "§9Совершенный химический реактор §r", "block.gtceu.opv_circuit_assembler": "§9Совершенный сборщик микросхем §r", "block.gtceu.opv_compressor": "§9Совершенный компрессор §r", "block.gtceu.opv_cutter": "§9Совершенная резочная машина §r", - "block.gtceu.opv_diode": "Диод (§9OpV§r)", + "block.gtceu.opv_diode": "Диод (§9§lOpV§r)", "block.gtceu.opv_distillery": "§9Совершенный дистиллятор §r", "block.gtceu.opv_electric_furnace": "§9Совершенная электрическая печь§r", "block.gtceu.opv_electrolyzer": "§9Совершенный электролизер §r", "block.gtceu.opv_electromagnetic_separator": "§9Совершенный электромагнитный сепаратор §r", - "block.gtceu.opv_energy_input_hatch": "Энергетический входной разъем (§9OpV§r)", - "block.gtceu.opv_energy_output_hatch": "Энергетический выходной разъем (§9OpV§r)", + "block.gtceu.opv_energy_input_hatch": "Энергетический входной разъем (§9§lOpV§r)", + "block.gtceu.opv_energy_output_hatch": "Энергетический выходной разъем (§9§lOpV§r)", "block.gtceu.opv_extractor": "§9Совершенный экстрактор §r", "block.gtceu.opv_extruder": "§9Совершенный экструдер §r", "block.gtceu.opv_fermenter": "§9Совершенный ферментатор §r", "block.gtceu.opv_fluid_heater": "§9Совершенный жидкостный нагреватель §r", - "block.gtceu.opv_fluid_passthrough_hatch": "Жидкостный сквозной люк (§9OpV§r)", + "block.gtceu.opv_fluid_passthrough_hatch": "Жидкостный сквозной люк (§9§lOpV§r)", "block.gtceu.opv_fluid_solidifier": "§9Совершенный жидкостный отвердитель §r", "block.gtceu.opv_forge_hammer": "§9Совершенный кузнечный молот §r", "block.gtceu.opv_forming_press": "§9Совершенный формовочный пресс §r", "block.gtceu.opv_gas_collector": "§9Совершенный воздухозаборник §r", - "block.gtceu.opv_input_bus": "Предметный входной люк (§9OpV)", - "block.gtceu.opv_input_hatch": "Жидкостный входной люк (§9OpV§r)", - "block.gtceu.opv_item_passthrough_hatch": "Предметный сквозной люк (§9OpV§r)", + "block.gtceu.opv_input_bus": "Предметный входной люк (§9§lOpV§r)", + "block.gtceu.opv_input_hatch": "Жидкостный входной люк (§9§lOpV§r)", + "block.gtceu.opv_item_passthrough_hatch": "Предметный сквозной люк (§9§lOpV§r)", "block.gtceu.opv_kinetic_input_box": "§9Улучшенный кинетический входной разъем §r", "block.gtceu.opv_kinetic_output_box": "§9Улучшенный кинетический выходной разъем §r", "block.gtceu.opv_laser_engraver": "§9Совершенный лазерный гравировщик §r", "block.gtceu.opv_lathe": "§9Совершенный токарный станок §r", "block.gtceu.opv_macerator": "§9Совершенный измельчитель §r", - "block.gtceu.opv_machine_casing": "Корпус машины (§9OpV§r)", - "block.gtceu.opv_machine_hull": "Оболочка машины (§9OpV§r)", + "block.gtceu.opv_machine_casing": "Корпус машины (§9§lOpV§r)", + "block.gtceu.opv_machine_hull": "Оболочка машины (§9§lOpV§r)", "block.gtceu.opv_mixer": "§9Совершенный смеситель §r", - "block.gtceu.opv_muffler_hatch": "Люк глушителя (§9OpV§r)", + "block.gtceu.opv_muffler_hatch": "Люк глушителя (§9§lOpV§r)", "block.gtceu.opv_ore_washer": "§9Совершенная рудопромывочная машина §r", - "block.gtceu.opv_output_bus": "Предметный выходной люк (§9OpV§r)", - "block.gtceu.opv_output_hatch": "Жидкостный выходной люк (§9OpV§r)", + "block.gtceu.opv_output_bus": "Предметный выходной люк (§9§lOpV§r)", + "block.gtceu.opv_output_hatch": "Жидкостный выходной люк (§9§lOpV§r)", "block.gtceu.opv_packer": "§9Совершенный упаковщик §r", "block.gtceu.opv_polarizer": "§9Совершенный поляризатор §r", "block.gtceu.opv_quantum_chest": "Квантовый сундук XIII", @@ -1862,8 +1862,8 @@ "cover.advanced_fluid_detector.invert.enabled.2": "Переключите, чтобы инвертировать логику красного камня", "cover.advanced_fluid_detector.invert.enabled.3": "По умолчанию красный камень перестает испускать сигнал, когда Л жидкости меньше мин., и начинает испускать сигнал, при превышении мин. кол-ва Л жидкости до установленного макс", "cover.advanced_fluid_detector.label": "Улучшенный детектор жидкости", - "cover.advanced_fluid_detector.max": "Максимум жид.:", - "cover.advanced_fluid_detector.min": "Минимум жид.:", + "cover.advanced_fluid_detector.max": "Макс. жид. (Л)", + "cover.advanced_fluid_detector.min": "Мин. жид. (Л)", "cover.advanced_item_detector.invert.disabled.0": "Вывод: Обычный", "cover.advanced_item_detector.invert.disabled.2": "Переключите, чтобы инвертировать логику красного камня", "cover.advanced_item_detector.invert.disabled.3": "По умолчанию красный камень перестает испускать сигнал, когда кол-во предметов меньше мин., и начинает испускать сигнал, при превышении мин. кол-ва предметов до установленного макс", @@ -1871,8 +1871,8 @@ "cover.advanced_item_detector.invert.enabled.2": "Переключите, чтобы инвертировать логику красного камня", "cover.advanced_item_detector.invert.enabled.3": "По умолчанию красный камень перестает испускать сигнал, когда кол-во предметов меньше мин., и начинает испускать сигнал, при превышении мин. кол-ва предметов до установленного макс", "cover.advanced_item_detector.label": "Улучшенный детектор предметов", - "cover.advanced_item_detector.max": "Максимум предметов:", - "cover.advanced_item_detector.min": "Минимум предметов:", + "cover.advanced_item_detector.max": "Макс. пред.", + "cover.advanced_item_detector.min": "Мин. пред.", "cover.bucket.mode.bucket": "кЛ/с", "cover.bucket.mode.milli_bucket": "Л/c", "cover.conveyor.blocks_input.disabled.0": "Если этот параметр включен, предметы не будут вставляться, когда улучшение настроено на вытягивание предметов из инвентаря в трубу.", @@ -2282,7 +2282,7 @@ "gtceu.jei.ore.between.1": "Спавнится в средних %d слоях жилы", "gtceu.jei.ore.biome_weighting": "§d%s Объем: §3%d", "gtceu.jei.ore.biome_weighting_no_spawn": "%s Объем: Не может появиться", - "gtceu.jei.ore.biome_weighting_title": "§dОбщий вес модифицированного биома", + "gtceu.jei.ore.biome_weighting_title": "§dОбщий вес модифицированного биома:", "gtceu.jei.ore.ore_weight": "Обьём в жиле: %d%%", "gtceu.jei.ore.primary.0": "Верхняя руда", "gtceu.jei.ore.primary.1": "Появляется в верхних %d слоях жилы", @@ -3689,13 +3689,13 @@ "item.gtceu.nor_memory_wafer": "Пластина NOR-Памяти", "item.gtceu.normal_pipe_extruder_mold": "Форма экструдера (Обычная труба)", "item.gtceu.nugget_casting_mold": "Отливная форма (Самородок)", - "item.gtceu.opv_conveyor_module": "Конвейерный модуль (§9OpV§r)", - "item.gtceu.opv_electric_piston": "Электрический поршень (§9OpV§r)", - "item.gtceu.opv_electric_pump": "Электрическая помпа (§9OpV§r)", - "item.gtceu.opv_field_generator": "Генератор поля (§9OpV§r)", - "item.gtceu.opv_fluid_regulator": "Регулятор жидкости (§9OpV§r)", - "item.gtceu.opv_robot_arm": "Роботизированный манипулятор (§9OpV§r)", - "item.gtceu.opv_sensor": "Сенсор (§9OpV§r)", + "item.gtceu.opv_conveyor_module": "Конвейерный модуль (§9§lOpV§r)", + "item.gtceu.opv_electric_piston": "Электрический поршень (§9§lOpV§r)", + "item.gtceu.opv_electric_pump": "Электрическая помпа (§9§lOpV§r)", + "item.gtceu.opv_field_generator": "Генератор поля (§9§lOpV§r)", + "item.gtceu.opv_fluid_regulator": "Регулятор жидкости (§9§lOpV§r)", + "item.gtceu.opv_robot_arm": "Роботизированный манипулятор (§9§lOpV§r)", + "item.gtceu.opv_sensor": "Сенсор (§9§lOpV§r)", "item.gtceu.orange_dye_spray_can": "Аэрозоль (Оранжевый)", "item.gtceu.orange_glass_lens": "Стеклянная линза (Оранжевый)", "item.gtceu.ore_dictionary_filter.tooltip.0": "§7Фильтрует §fПредметы§7 по §fСловарю руд§7 как §fУлучшение механизма§7.", @@ -5057,9 +5057,9 @@ "block.gtceu.iv_output_hatch_9x": "Девятерной выходной люк (§1IV§r)", "block.gtceu.luv_output_hatch_9x": "Девятерной выходной люк (§dLuV§r)", "block.gtceu.luv_output_hatch_4x": "Четверной выходной люк (§dLuV§r)", - "block.gtceu.opv_output_hatch_9x": "Девятерной выходной люк (§9OpV§r)", - "block.gtceu.opv_input_hatch_4x": "Четверной входной люк (§9OpV§r)", - "block.gtceu.opv_output_hatch_4x": "Четверной выходной люк (§9OpV§r)", + "block.gtceu.opv_output_hatch_9x": "Девятерной выходной люк (§9§lOpV§r)", + "block.gtceu.opv_input_hatch_4x": "Четверной входной люк (§9§lOpV§r)", + "block.gtceu.opv_output_hatch_4x": "Четверной выходной люк (§9§lOpV§r)", "block.gtceu.uev_output_hatch_9x": "Девятерной выходной люк (§aUEV§r)", "block.gtceu.uev_output_hatch_4x": "Четверной выходной люк (§aUEV§r)", "block.gtceu.uhv_output_hatch_4x": "Четверной выходной люк (§4UHV§r)", @@ -5177,7 +5177,7 @@ "block.gtceu.luv_input_hatch_9x": "Девятерной входной люк (§dLuV§r)", "block.gtceu.max_input_hatch_9x": "Девятерной входной люк (§c§lMAX§r)", "block.gtceu.max_output_hatch_9x": "Девятерной выходной люк (§c§lMAX§r)", - "block.gtceu.opv_input_hatch_9x": "Девятерной входной люк (§9OpV§r)", + "block.gtceu.opv_input_hatch_9x": "Девятерной входной люк (§9§lOpV§r)", "block.gtceu.uev_input_hatch_9x": "Девятерной входной люк (§aUEV§r)", "block.gtceu.uhv_input_hatch_9x": "Девятерной входной люк (§4UHV§r)", "block.gtceu.uiv_output_hatch_9x": "Девятерной выходной люк (§2UIV§r)", @@ -5489,7 +5489,7 @@ "item.gtceu.energy_detector_cover.tooltip": "§7Выдает §fКол-во энергии§7 Сигналом Красного камня как §fУлучшение механизма§7.", "item.gtceu.fluid_detector_cover.tooltip": "§7Выдает §fЗаполнение жидкостью§7 Сигналом Красного камня как §fУлучшение механизма§7.", "item.gtceu.fluid_voiding_cover.tooltip.0": "§7Удаляет §fЖидкости§7 как §fУлучшение механизма§7.", - "item.gtceu.opv_electric_motor": "Электрический мотор (§9OpV§r)", + "item.gtceu.opv_electric_motor": "Электрический мотор (§9§lOpV§r)", "item.gtceu.uxv_electric_motor": "Электрический мотор (§eUXV§r)", "item.gtceu.micro_processor_assembly.tooltip.1": "§eHV Уровень", "item.gtceu.highly_advanced_soc_wafer.tooltip": "§7Необработанная очень продвинутая микросхема", @@ -6680,7 +6680,7 @@ "gtceu.machine.electric_blast_furnace.tooltip.0": "На каждые §f900K§7, превышающих температуру рецепта, перед разгоном используется §f95%%§7 энергии.", "gtceu.machine.computation_receiver_hatch.tooltip": "Вход Данных Вычислений для многоблочной структуры", "gtceu.machine.data_bank.tooltip.4": "Использует §f%s EU/t§7 для каждого Люка Данных/Опт. Данных когда они в цепочке.", - "item.gtceu.opv_emitter": "Эмиттер (§9OpV§r)", + "item.gtceu.opv_emitter": "Эмиттер (§9§lOpV§r)", "item.gtceu.portable_debug_scanner": "Портативный сканер", "gtceu.machine.high_performance_computation_array.tooltip.2": "Требуются компоненты HPCA для создания §fCWU/t§7 (Вычислительные Рабочие Единицы).", "gtceu.machine.hpca.advanced_computation_component.damaged.tooltip": "Это стоило только руки и ноги", @@ -6735,7 +6735,7 @@ "gtceu.multiblock.hpca.info_max_coolant_required": "Хладогента требуется: %s", "gtceu.multiblock.hpca.info_max_cooling_available": "Хладогента доступно: %s", "gtceu.multiblock.hpca.info_max_cooling_demand": "Потребность в хладогенте: %s", - "gtceu.multiblock.hpca.temperature": "Температура:", + "gtceu.multiblock.hpca.temperature": "Температура: %s", "gtceu.multiblock.hpca.warning_low_cooling": "- Не достаточно хладогента", "gtceu.multiblock.hpca.warning_no_computation": "- Не проводятся вычисления", "gtceu.multiblock.hpca.warning_structure_header": "Подсказки по структуре:", @@ -6969,5 +6969,58 @@ "item.gtceu.quarktech_chestplate": "QuarkTech™ Кираса", "item.gtceu.sus_record": "Музыкальный диск", "material.gtceu.quantum_echo": "Квантовое эхо", - "gtceu.recipe.coil.tier": "Катушка: %s" + "gtceu.recipe.coil.tier": "Катушка: %s", + "gtceu.hazard.inhalation_poison": "§2Ядовито при вдыхании", + "gtceu.hazard.radioactive": "§eРадиоактивно", + "gtceu.mode.both": "§dОба (Жидк. и Предм.)§r", + "gtceu.mode.fluid": "§9Жидкость§r", + "gtceu.mode.item": "§6Предметы§r", + "metaitem.machine_configuration.mode": "§aРежим конфигурации:§r %s", + "config.gtceu.option.harmlessActiveTransformers": "harmlessActiveTransformers", + "gtceu.hazard.description": "§l§cОПАСНО §7Зажмите SHIFT для Деталей", + "config.gtceu.option.gameplay": "gameplay", + "block.gtceu.max_energy_input_hatch_16a": "Энергетический входной разъем (16A §c§lMAX §r)", + "block.gtceu.max_energy_input_hatch_4a": "Энергетический входной разъем (4A §c§lMAX§r)", + "block.gtceu.max_energy_output_hatch_16a": "Энергетический выходной разъем (16A §c§lMAX§r)", + "block.gtceu.max_energy_output_hatch_4a": "Энергетический выходной разъем (4A §c§lMAX§r)", + "block.gtceu.max_substation_input_hatch_64a": "Энергетический входной разъем Подстанции (64A §c§lMAX§r)", + "block.gtceu.max_substation_output_hatch_64a": "Энергетический выходной разъем Подстанции (64A §c§lMAX§r)", + "block.gtceu.opv_energy_input_hatch_16a": "Энергетический входной разъем (16A §9§lOpV§r)", + "block.gtceu.opv_energy_input_hatch_4a": "Энергетический входной разъем (4A §9§lOpV§r)", + "block.gtceu.opv_energy_output_hatch_16a": "Энергетический выходной разъем (16A §9§lOpV§r)", + "block.gtceu.opv_energy_output_hatch_4a": "Энергетический выходной разъем (4A §9§lOpV§r)", + "block.gtceu.opv_substation_input_hatch_64a": "Энергетический входной разъем Подстанции (64A §9§lOpV§r)", + "block.gtceu.opv_substation_output_hatch_64a": "Энергетический выходной разъем Подстанции (64А §9§lOpV§r)", + "block.gtceu.uev_energy_input_hatch_16a": "Энергетический входной разъем (16A §aUEV§r)", + "block.gtceu.uev_energy_input_hatch_4a": "Энергетический входной разъем (4A §aUEV §r)", + "block.gtceu.uev_energy_output_hatch_16a": "Энергетический выходной разъем (16A §aUEV §r)", + "block.gtceu.uev_energy_output_hatch_4a": "Энергетический выходной разъем (4A §aUEV §r)", + "block.gtceu.uev_substation_input_hatch_64a": "Энергетический входной разъем Подстанции (64A §aUEV§r)", + "block.gtceu.uev_substation_output_hatch_64a": "Энергетический выходной разъем Подстанции (64А §aUEV§r)", + "block.gtceu.uiv_energy_input_hatch_16a": "Энергетический входной разъем (16A §2UIV§r)", + "block.gtceu.uiv_energy_input_hatch_4a": "Энергетический входной разъем (4A §2UIV§r)", + "block.gtceu.uiv_energy_output_hatch_16a": "Энергетический выходной разъем (16А §2UIV§r)", + "block.gtceu.uiv_energy_output_hatch_4a": "Энергетический выходной разъем (4А §2UIV§r)", + "block.gtceu.uiv_substation_input_hatch_64a": "Энергетический входной разъем Подстанции (64A §2UIV§r)", + "block.gtceu.uiv_substation_output_hatch_64a": "Энергетический выходной разъем Подстанции (64A §2UIV§r)", + "block.gtceu.uxv_energy_input_hatch_16a": "Энергетический входной разъем (16A §eUXV§r)", + "block.gtceu.uxv_energy_input_hatch_4a": "Энергетический входной разъем (4A §eUXV§r)", + "block.gtceu.uxv_energy_output_hatch_16a": "Энергетический выходной разъем (16A §eUXV§r)", + "block.gtceu.uxv_energy_output_hatch_4a": "Энергетический выходной разъем (4A §eUXV§r)", + "block.gtceu.uxv_substation_input_hatch_64a": "Энергетический входной разъем Подстанции (64A §eUXV§r)", + "block.gtceu.uxv_substation_output_hatch_64a": "Энергетический выходной разъем Подстанции (64А §eUXV§r)", + "config.gtceu.option.prospectorEnergyUseMultiplier": "prospectorEnergyUseMultiplier", + "config.gtceu.option.hazardsEnabled": "hazardsEnabled", + "gtceu.hazard.description_shift": "§l§cОПАСНО:", + "gtceu.machine.laser_hatch.both.tooltip": "§cЛазерные кабели должны быть на одной линии!§7", + "gtceu.machine.laser_hatch.source.tooltip": "§7Передача энергии на расстоянии", + "gtceu.machine.laser_hatch.target.tooltip": "§7Прием энергии на расстоянии", + "item.gtceu.hazmat_boots": "Ботинки защитного костюма", + "item.gtceu.hazmat_chestpiece": "Нагрудник защитного костюма", + "item.gtceu.hazmat_headpiece": "Шлем защитного костюма", + "item.gtceu.hazmat_leggings": "Поножи защитного костюма", + "item.gtceu.mask_filter": "Фильтр противогаза", + "material.gtceu.activated_carbon": "Активированный уголь", + "gtceu.hazard.corrosive": "§6Коррозия", + "gtceu.hazard.contact_poison": "§5Яд" } diff --git a/src/main/resources/assets/gtceu/lang/zh_cn.json b/src/main/resources/assets/gtceu/lang/zh_cn.json index 2bb46d9eff..8aa6f8f37c 100644 --- a/src/main/resources/assets/gtceu/lang/zh_cn.json +++ b/src/main/resources/assets/gtceu/lang/zh_cn.json @@ -3,7 +3,7 @@ "behavior.data_item.assemblyline.title":"§n装配线结构数据:", "behavior.item_magnet.disabled":"§c磁场已禁用", "behavior.item_magnet.enabled":"§a磁场已启用", - "behavior.portable_scanner.amp_per_sec":"最后一秒 %s A", + "behavior.portable_scanner.amp_per_sec":"平均(最后一秒):%s A", "behavior.portable_scanner.bedrock_fluid.amount":"流体储量:%s %s - %s%%", "behavior.portable_scanner.bedrock_fluid.amount_unknown":"流体储量:%s%%", "behavior.portable_scanner.bedrock_fluid.nothing":"流体储量:§6无§r", @@ -20,7 +20,7 @@ "behavior.portable_scanner.energy_container_in":"输入上限:%s(%s)EU,%s A", "behavior.portable_scanner.energy_container_out":"输出上限:%s(%s)EU,%s A", "behavior.portable_scanner.energy_container_storage":"电量:%s EU / %s EU", - "behavior.portable_scanner.eu_per_sec":"最后一秒 %s EU/t", + "behavior.portable_scanner.eu_per_sec":"平均(最后一秒):%s EU/t", "behavior.portable_scanner.machine_disabled":"已停止。", "behavior.portable_scanner.machine_power_loss":"因断电而停止工作。", "behavior.portable_scanner.machine_progress":"处理进度/总计:%s / %s", @@ -142,6 +142,8 @@ "block.gtceu.dark_concrete_cobblestone":"深色混凝土圆石", "block.gtceu.dark_concrete_small_tile":"深色混凝土小片瓦", "block.gtceu.dark_concrete_tile":"深色混凝土瓦", + "block.gtceu.dark_concrete_windmill_a":"深色混凝土风车形瓦 A", + "block.gtceu.dark_concrete_windmill_b":"深色混凝土风车形瓦 B", "block.gtceu.data_access_hatch":"数据访问仓", "block.gtceu.data_bank":"数据库", "block.gtceu.data_receiver_hatch":"光学数据靶仓", @@ -238,6 +240,8 @@ "block.gtceu.ev_wiremill":"§5进阶线材轧机 III§r", "block.gtceu.ev_world_accelerator":"§5进阶世界加速器 III§r", "block.gtceu.explosion_hazard_sign_block":"爆炸危害警示方块", + "block.gtceu.explosive.breaking_tooltip":"破坏它会引爆火药,潜行挖掘以重新拾取", + "block.gtceu.explosive.lighting_tooltip":"无法用红石信号引爆", "block.gtceu.extreme_combustion_engine":"极限内燃引擎", "block.gtceu.extreme_engine_intake_casing":"极限引擎进气机械方块", "block.gtceu.filter_casing":"过滤器机械方块", @@ -360,7 +364,9 @@ "block.gtceu.hv_world_accelerator":"§6进阶世界加速器 II§r", "block.gtceu.implosion_compressor":"聚爆压缩机", "block.gtceu.industrial_steam_casing":"工业蒸汽机械方块", + "block.gtceu.industrial_tnt":"工业TNT", "block.gtceu.inert_machine_casing":"聚四氟乙烯化学惰性机械方块", + "block.gtceu.itnt.drops_tooltip":"爆炸范围比TNT大得多,所有被摧毁的方块都会掉落", "block.gtceu.iv_1024a_laser_source_hatch":"1024安§9IV§r激光源仓", "block.gtceu.iv_1024a_laser_target_hatch":"1024安§9IV§r激光靶仓", "block.gtceu.iv_16a_energy_converter":"16安§9IV§r能量转换器", @@ -481,6 +487,8 @@ "block.gtceu.light_concrete_cobblestone":"淡色混凝土圆石", "block.gtceu.light_concrete_small_tile":"淡色混凝土小片瓦", "block.gtceu.light_concrete_tile":"淡色混凝土瓦", + "block.gtceu.light_concrete_windmill_a":"淡色混凝土风车形瓦 A", + "block.gtceu.light_concrete_windmill_b":"淡色混凝土风车形瓦 B", "block.gtceu.light_gray_lamp":"淡灰色灯", "block.gtceu.lime_lamp":"黄绿色灯", "block.gtceu.long_distance_fluid_pipeline":"长距离流体管道", @@ -673,6 +681,8 @@ "block.gtceu.marble_cobblestone":"大理岩圆石", "block.gtceu.marble_small_tile":"大理岩小片瓦", "block.gtceu.marble_tile":"大理岩瓦", + "block.gtceu.marble_windmill_a":"大理岩风车形瓦 A", + "block.gtceu.marble_windmill_b":"大理岩风车形瓦 B", "block.gtceu.max_16a_energy_converter":"16安§c§lMAX§r能量转换器", "block.gtceu.max_1a_energy_converter":"1安§c§lMAX§r能量转换器", "block.gtceu.max_4a_energy_converter":"4安§c§lMAX§r能量转换器", @@ -682,7 +692,11 @@ "block.gtceu.max_battery_buffer_8x":"8x上限压电池箱(§c§lMAX§r)", "block.gtceu.max_charger_4x":"4x上限压闪聚充电箱(§c§lMAX§r)", "block.gtceu.max_energy_input_hatch":"§c§lMAX§r能源仓", + "block.gtceu.max_energy_input_hatch_16a":"16安§c§lMAX§r能源仓", + "block.gtceu.max_energy_input_hatch_4a":"4安§c§lMAX§r能源仓", "block.gtceu.max_energy_output_hatch":"§c§lMAX§r动力仓", + "block.gtceu.max_energy_output_hatch_16a":"16安§c§lMAX§r动力仓", + "block.gtceu.max_energy_output_hatch_4a":"4安§c§lMAX§r动力仓", "block.gtceu.max_input_bus":"§c§lMAX§r输入总线", "block.gtceu.max_input_hatch":"§c§lMAX§r输入仓", "block.gtceu.max_input_hatch_4x":"§c§lMAX§r四重输入仓", @@ -693,6 +707,8 @@ "block.gtceu.max_output_hatch":"§c§lMAX§r输出仓", "block.gtceu.max_output_hatch_4x":"§c§lMAX§r四重输出仓", "block.gtceu.max_output_hatch_9x":"§c§lMAX§r九重输出仓", + "block.gtceu.max_substation_input_hatch_64a":"64安§c§lMAX§r变电能源仓", + "block.gtceu.max_substation_output_hatch_64a":"64安§c§lMAX§r变电动力仓", "block.gtceu.me_input_bus":"ME库存输入总线", "block.gtceu.me_input_hatch":"ME库存输入仓", "block.gtceu.me_output_bus":"ME输出总线", @@ -831,7 +847,11 @@ "block.gtceu.opv_electrolyzer":"§9§l传奇电解机§r", "block.gtceu.opv_electromagnetic_separator":"§9§l传奇电磁选矿机§r", "block.gtceu.opv_energy_input_hatch":"§9§lOpV§r能源仓", + "block.gtceu.opv_energy_input_hatch_16a":"16安§9§lOpV§r能源仓", + "block.gtceu.opv_energy_input_hatch_4a":"4安§9§lOpV§r能源仓", "block.gtceu.opv_energy_output_hatch":"§9§lOpV§r动力仓", + "block.gtceu.opv_energy_output_hatch_16a":"16安§9§lOpV§r动力仓", + "block.gtceu.opv_energy_output_hatch_4a":"4安§9§lOpV§r动力仓", "block.gtceu.opv_extractor":"§9§l传奇提取机§r", "block.gtceu.opv_extruder":"§9§l传奇压模器§r", "block.gtceu.opv_fermenter":"§9§l传奇发酵槽§r", @@ -865,6 +885,8 @@ "block.gtceu.opv_rock_crusher":"§9§l传奇碎岩机§r", "block.gtceu.opv_scanner":"§9§l传奇扫描仪§r", "block.gtceu.opv_sifter":"§9§l传奇筛选机§r", + "block.gtceu.opv_substation_input_hatch_64a":"64安§9§lOpV§r变电能源仓", + "block.gtceu.opv_substation_output_hatch_64a":"64安§9§lOpV§r变电动力仓", "block.gtceu.opv_thermal_centrifuge":"§9§l传奇热力离心机§r", "block.gtceu.opv_wiremill":"§9§l传奇线材轧机§r", "block.gtceu.orange_lamp":"橙色灯", @@ -877,6 +899,8 @@ "block.gtceu.polished_light_concrete":"磨制淡色混凝土", "block.gtceu.polished_marble":"磨制大理岩", "block.gtceu.polished_red_granite":"磨制红花岗岩", + "block.gtceu.powderbarrel":"火药桶", + "block.gtceu.powderbarrel.drops_tooltip":"爆炸范围略大于TNT,所有被摧毁的方块都会掉落", "block.gtceu.power_substation":"蓄能变电站", "block.gtceu.primitive_blast_furnace":"土高炉", "block.gtceu.primitive_pump":"原始水泵", @@ -892,6 +916,8 @@ "block.gtceu.red_granite_cobblestone":"红花岗岩圆石", "block.gtceu.red_granite_small_tile":"红花岗岩小片瓦", "block.gtceu.red_granite_tile":"红花岗岩瓦", + "block.gtceu.red_granite_windmill_a":"红花岗岩风车形瓦 A", + "block.gtceu.red_granite_windmill_b":"红花岗岩风车形瓦 B", "block.gtceu.red_lamp":"红色灯", "block.gtceu.reinforced_stone":"防爆石", "block.gtceu.research_station":"研究站", @@ -907,6 +933,7 @@ "block.gtceu.rubber_planks":"橡胶木板", "block.gtceu.rubber_pressure_plate":"橡胶木压力板", "block.gtceu.rubber_sapling":"橡胶树苗", + "block.gtceu.rubber_sign":"墙上的橡胶木告示牌", "block.gtceu.rubber_slab":"橡胶木台阶", "block.gtceu.rubber_stairs":"橡胶木楼梯", "block.gtceu.rubber_trapdoor":"橡胶木活板门", @@ -918,10 +945,6 @@ "block.gtceu.small_light_concrete_bricks":"淡色混凝土小块砖", "block.gtceu.small_marble_bricks":"大理岩小块砖", "block.gtceu.small_red_granite_bricks":"红花岗岩小块砖", - "block.gtceu.smooth_dark_concrete":"平滑深色混凝土", - "block.gtceu.smooth_light_concrete":"平滑淡色混凝土", - "block.gtceu.smooth_marble":"平滑大理岩", - "block.gtceu.smooth_red_granite":"平滑红花岗岩", "block.gtceu.solid_machine_casing":"脱氧机械方块", "block.gtceu.spatial_storage_hazard_sign_block":"空间存储危害警示方块", "block.gtceu.square_dark_concrete_bricks":"深色混凝土方形砖", @@ -980,9 +1003,10 @@ "block.gtceu.treated_wood_door":"防腐木门", "block.gtceu.treated_wood_fence":"防腐木栅栏", "block.gtceu.treated_wood_fence_gate":"防腐木栅栏门", - "block.gtceu.treated_wood_hanging_sign":"悬挂式防腐木告示牌", + "block.gtceu.treated_wood_hanging_sign":"墙上的悬挂式防腐木告示牌", "block.gtceu.treated_wood_planks":"防腐木板", "block.gtceu.treated_wood_pressure_plate":"防腐木压力板", + "block.gtceu.treated_wood_sign":"墙上的防腐木告示牌", "block.gtceu.treated_wood_slab":"防腐木台阶", "block.gtceu.treated_wood_stairs":"防腐木楼梯", "block.gtceu.treated_wood_trapdoor":"防腐木活板门", @@ -1029,7 +1053,11 @@ "block.gtceu.uev_electrolyzer":"§a史诗电解机 II§r", "block.gtceu.uev_electromagnetic_separator":"§a史诗电磁选矿机 II§r", "block.gtceu.uev_energy_input_hatch":"§aUEV§r能源仓", + "block.gtceu.uev_energy_input_hatch_16a":"16安§aUEV§r能源仓", + "block.gtceu.uev_energy_input_hatch_4a":"4安§aUEV§r能源仓", "block.gtceu.uev_energy_output_hatch":"§aUEV§r动力仓", + "block.gtceu.uev_energy_output_hatch_16a":"16安§aUEV§r动力仓", + "block.gtceu.uev_energy_output_hatch_4a":"4安§aUEV§r动力仓", "block.gtceu.uev_extractor":"§a史诗提取机 II§r", "block.gtceu.uev_extruder":"§a史诗压模器 II§r", "block.gtceu.uev_fermenter":"§a史诗发酵槽 II§r", @@ -1063,6 +1091,8 @@ "block.gtceu.uev_rock_crusher":"§a史诗碎岩机 II§r", "block.gtceu.uev_scanner":"§a史诗扫描仪 II§r", "block.gtceu.uev_sifter":"§a史诗筛选机 II§r", + "block.gtceu.uev_substation_input_hatch_64a":"64安§aUEV§r变电能源仓", + "block.gtceu.uev_substation_output_hatch_64a":"64安§aUEV§r变电动力仓", "block.gtceu.uev_thermal_centrifuge":"§a史诗热力离心机 II§r", "block.gtceu.uev_wiremill":"§a史诗线材轧机 II§r", "block.gtceu.uhv_1024a_laser_source_hatch":"1024安§4UHV§r激光源仓", @@ -1175,7 +1205,11 @@ "block.gtceu.uiv_electrolyzer":"§2史诗电解机 III§r", "block.gtceu.uiv_electromagnetic_separator":"§2史诗电磁选矿机 III§r", "block.gtceu.uiv_energy_input_hatch":"§2UIV§r能源仓", + "block.gtceu.uiv_energy_input_hatch_16a":"16安§2UIV§r能源仓", + "block.gtceu.uiv_energy_input_hatch_4a":"4安§2UIV§r能源仓", "block.gtceu.uiv_energy_output_hatch":"§2UIV§r动力仓", + "block.gtceu.uiv_energy_output_hatch_16a":"16安§2UIV§r动力仓", + "block.gtceu.uiv_energy_output_hatch_4a":"4安§2UIV§r动力仓", "block.gtceu.uiv_extractor":"§2史诗提取机 III§r", "block.gtceu.uiv_extruder":"§2史诗压模器 III§r", "block.gtceu.uiv_fermenter":"§2史诗发酵槽 III§r", @@ -1209,6 +1243,8 @@ "block.gtceu.uiv_rock_crusher":"§2史诗碎岩机 III§r", "block.gtceu.uiv_scanner":"§2史诗扫描仪 III§r", "block.gtceu.uiv_sifter":"§2史诗筛选机 III§r", + "block.gtceu.uiv_substation_input_hatch_64a":"64安§2UIV§r变电能源仓", + "block.gtceu.uiv_substation_output_hatch_64a":"64安§2UIV§r变电动力仓", "block.gtceu.uiv_thermal_centrifuge":"§2史诗热力离心机 III§r", "block.gtceu.uiv_wiremill":"§2史诗线材轧机 III§r", "block.gtceu.ulv_16a_energy_converter":"16安§8ULV§r能量转换器", @@ -1349,7 +1385,11 @@ "block.gtceu.uxv_electrolyzer":"§e史诗电解机 IV§r", "block.gtceu.uxv_electromagnetic_separator":"§e史诗电磁选矿机 IV§r", "block.gtceu.uxv_energy_input_hatch":"§eUXV§r能源仓", + "block.gtceu.uxv_energy_input_hatch_16a":"16安§eUXV§r能源仓", + "block.gtceu.uxv_energy_input_hatch_4a":"4安§eUXV§r能源仓", "block.gtceu.uxv_energy_output_hatch":"§eUXV§r动力仓", + "block.gtceu.uxv_energy_output_hatch_16a":"16安§eUXV§r动力仓", + "block.gtceu.uxv_energy_output_hatch_4a":"4安§eUXV§r动力仓", "block.gtceu.uxv_extractor":"§e史诗提取机 IV§r", "block.gtceu.uxv_extruder":"§e史诗压模器 IV§r", "block.gtceu.uxv_fermenter":"§e史诗发酵槽 IV§r", @@ -1383,6 +1423,8 @@ "block.gtceu.uxv_rock_crusher":"§e史诗碎岩机 IV§r", "block.gtceu.uxv_scanner":"§e史诗扫描仪 IV§r", "block.gtceu.uxv_sifter":"§e史诗筛选机 IV§r", + "block.gtceu.uxv_substation_input_hatch_64a":"64安§eUXV§r变电能源仓", + "block.gtceu.uxv_substation_output_hatch_64a":"64安§eUXV§r变电动力仓", "block.gtceu.uxv_thermal_centrifuge":"§e史诗热力离心机 IV§r", "block.gtceu.uxv_wiremill":"§e史诗线材轧机 IV§r", "block.gtceu.vacuum_freezer":"真空冷冻机", @@ -1608,8 +1650,10 @@ "compass.node.gtceu.generation/endstone":"末地石", "compass.node.gtceu.generation/granite":"花岗岩", "compass.node.gtceu.generation/gravel":"沙砾", + "compass.node.gtceu.generation/marble":"大理石", "compass.node.gtceu.generation/netherrack":"下界岩", "compass.node.gtceu.generation/ore":"如何找到矿石?", + "compass.node.gtceu.generation/red_granite":"红花岗岩", "compass.node.gtceu.generation/red_sand":"红沙", "compass.node.gtceu.generation/rubber_leaves":"橡胶树叶", "compass.node.gtceu.generation/rubber_log":"橡胶原木", @@ -1966,6 +2010,7 @@ "config.gtceu.option.addLoot":"添加战利品", "config.gtceu.option.allUniqueStoneTypes":"所有独特石头类型", "config.gtceu.option.animationTime":"动画时间", + "config.gtceu.option.armorHud":"盔甲HUD", "config.gtceu.option.bedrockOreDistance":"基岩矿石距离", "config.gtceu.option.bedrockOreDropTagPrefix":"基岩矿石掉落Tag", "config.gtceu.option.casingsPerCraft":"每次合成机械方块数量", @@ -1994,6 +2039,7 @@ "config.gtceu.option.energyUsageMultiplier":"能源消耗倍率", "config.gtceu.option.euToPlatformRatio":"GTEU与加载器原生能量的转换比例", "config.gtceu.option.flintAndSteelRequireSteel":"打火石配方是否需要钢", + "config.gtceu.option.gameplay":"游戏玩法", "config.gtceu.option.generateLowQualityGems":"生成劣质宝石", "config.gtceu.option.ghostCircuit":"虚拟电路", "config.gtceu.option.gt6StylePipesCables":"类GT6管道/线缆", @@ -2009,9 +2055,15 @@ "config.gtceu.option.harderCharcoalRecipe":"更难的木炭配方", "config.gtceu.option.harderCircuitRecipes":"更难的电路板配方", "config.gtceu.option.harderRods":"更难的杆配方", + "config.gtceu.option.harmlessActiveTransformers":"无害的有源变压器", + "config.gtceu.option.hazardsEnabled":"启用危险物质", "config.gtceu.option.hideFacadesInJEI":"在JEI页面隐藏伪装板", "config.gtceu.option.hideFilledCellsInJEI":"在JEI页面隐藏流体单元", + "config.gtceu.option.hideOreProcessingDiagrams":"隐藏矿物处理流程图", "config.gtceu.option.highTierContent":"极高电压内容", + "config.gtceu.option.hudLocation":"HUD位置", + "config.gtceu.option.hudOffsetX":"HUD偏移X", + "config.gtceu.option.hudOffsetY":"HUD偏移Y", "config.gtceu.option.inWorldPreviewDuration":"世界中预览时长", "config.gtceu.option.increaseDungeonLoot":"更多的地牢战利品", "config.gtceu.option.infiniteBedrockOresFluids":"无限基岩矿石流体", @@ -2030,6 +2082,7 @@ "config.gtceu.option.oreVeins":"矿脉", "config.gtceu.option.overclockDivisor":"超频除数", "config.gtceu.option.platformToEuRatio":"GTEU与加载器原生能量之间的转化率(转换器)", + "config.gtceu.option.prospectorEnergyUseMultiplier":"探矿仪能源消耗乘数", "config.gtceu.option.recipeProgressLowEnergy":"跳电时,机器进度将", "config.gtceu.option.recipes":"配方", "config.gtceu.option.removeSmeltingForEBFMetals":"移除需要电力高炉冶炼的金属的熔炉配方", @@ -2260,6 +2313,9 @@ "enchantment.gtceu.disjunction.desc":"对末影生物施加虚弱和缓慢效果。", "enchantment.gtceu.hard_hammer.desc":"像格雷科技的锻造锤一样粉碎所采掘的方块。", "enchantment.hard_hammer":"锤碎", + "entity.gtceu.dynamite":"炸药", + "entity.gtceu.industrial_tnt":"工业TNT", + "entity.gtceu.powderbarrel":"火药桶", "fluid.empty":"空", "fluid.spawnlocation.name":"流体矿脉信息", "fluid.tile.lava":"熔岩", @@ -2471,6 +2527,12 @@ "gtceu.gui.title_bar.page_switcher":"页面", "gtceu.gui.toggle_view.disabled":"切换视图(流体)", "gtceu.gui.toggle_view.enabled":"切换视图(物品)", + "gtceu.hazard.contact_poison":"§5接触性毒物", + "gtceu.hazard.corrosive":"§6腐蚀性", + "gtceu.hazard.description":"§c§l危险物质 §7按住Shift以显示详情", + "gtceu.hazard.description_shift":"§c§l危险物质:", + "gtceu.hazard.inhalation_poison":"§2吸入性毒物", + "gtceu.hazard.radioactive":"§e放射性", "gtceu.implosion_compressor":"聚爆压缩机", "gtceu.io.both":"同时", "gtceu.io.export":"输出", @@ -2579,10 +2641,10 @@ "gtceu.laser_engraver":"激光蚀刻机", "gtceu.lathe":"车床", "gtceu.macerator":"研磨机", - "gtceu.machine.active_transformer.tooltip.0":"变形金刚:伪装的激光", - "gtceu.machine.active_transformer.tooltip.1":"可以将任意数量的能量§f输入§7整合为任意数量的能量§f输出§7。", - "gtceu.machine.active_transformer.tooltip.2":"当你使用§d激光§7进行能量传输时,拥有惊人的传输距离。", - "gtceu.machine.active_transformer.tooltip.3":"Lasers§7.", + "gtceu.machine.active_transformer.tooltip.0":"§7变形金刚:伪装的激光", + "gtceu.machine.active_transformer.tooltip.1":"§7可以将任意数量的能量§f输入§7整合为任意数量的能量§f输出§7。", + "gtceu.machine.active_transformer.tooltip.2":"§7当你使用§d激光§7进行能量传输时,拥有惊人的传输距离。", + "gtceu.machine.active_transformer.tooltip.3":" ", "gtceu.machine.advanced_processing_array.tooltip":"这个世界需要更多并行", "gtceu.machine.assembly_line.tooltip":"真不是什么多方块组装机!", "gtceu.machine.available_recipe_map_1.tooltip":"可用配方类型:%s", @@ -2846,6 +2908,9 @@ "gtceu.machine.large_turbine.gas.tooltip":"并不是喷气发动机", "gtceu.machine.large_turbine.plasma.tooltip":"等离子能量虹吸器", "gtceu.machine.large_turbine.steam.tooltip":"别把头伸进去", + "gtceu.machine.laser_hatch.both.tooltip":"§c激光传导线缆必须直线摆放!§7", + "gtceu.machine.laser_hatch.source.tooltip":"§7远距离发射能量", + "gtceu.machine.laser_hatch.target.tooltip":"§7远距离接收能量", "gtceu.machine.laser_source_hatch.tooltip.0":"远距离发射能量", "gtceu.machine.laser_source_hatch.tooltip.1":"§c激光传导线缆必须直线摆放!§7", "gtceu.machine.laser_target_hatch.tooltip.0":"远距离接收能量", @@ -3182,6 +3247,9 @@ "gtceu.maintenance.configurable_time.changed_description":"故障的发生几率现为正常值的%f倍。", "gtceu.maintenance.configurable_time.unchanged_description":"故障的发生几率为正常值。更改配置以更新。", "gtceu.mixer":"搅拌机", + "gtceu.mode.both":"§d全部(流体和物品)§r", + "gtceu.mode.fluid":"§9流体§r", + "gtceu.mode.item":"§6物品§r", "gtceu.muffler.recovery_tooltip":"§b回收几率:§f%d%%", "gtceu.multiblock.advanced_processing_array.description":"处理阵列可将最多 64 个单方块机器集成在一个多方块结构中,以实现更高效的自动化。", "gtceu.multiblock.assembly_line.description":"装配线是由5到16“片”组成的大型多方块结构。理论上,它是一个大型组装机,用于生产高级元件。", @@ -3418,6 +3486,7 @@ "gtceu.recipe.cleanroom":"需要%s", "gtceu.recipe.cleanroom.display_name":"超净间", "gtceu.recipe.cleanroom_sterile.display_name":"无菌超净间", + "gtceu.recipe.coil.tier":"线圈:%s", "gtceu.recipe.computation_per_tick":"最小算力:%s CWU/t", "gtceu.recipe.dimensions":"维度:%s", "gtceu.recipe.duration":"耗时:%s秒", @@ -3430,7 +3499,6 @@ "gtceu.recipe.research":"需要研究", "gtceu.recipe.scan_for_research":"装配线配方扫描", "gtceu.recipe.temperature":"温度:%sK", - "gtceu.recipe.temperature_and_coil":"温度:%sK(%s)", "gtceu.recipe.total":"总计:%s EU", "gtceu.recipe_logic.condition_fails":"条件不足", "gtceu.recipe_logic.insufficient_fuel":"燃料不足", @@ -3577,6 +3645,7 @@ "item.gtceu.activity_detector_cover.tooltip":"§7作§f覆盖板§7时依照§f机器活跃状态§7发出红石信号。", "item.gtceu.advanced_activity_detector_cover":"进阶活跃状态探测器", "item.gtceu.advanced_activity_detector_cover.tooltip":"§7作§f覆盖板§7时依照§f机器处理进度§7发出红石信号。", + "item.gtceu.advanced_electric_jetpack":"进阶电力喷气背包", "item.gtceu.advanced_energy_detector_cover":"进阶能量探测覆盖板", "item.gtceu.advanced_energy_detector_cover.tooltip":"§7作§f覆盖板§7时依照由§fRS锁存器§7控制的§f能量状态§7发出红石信号。", "item.gtceu.advanced_fluid_detector_cover":"进阶流体探测器", @@ -3593,6 +3662,7 @@ "item.gtceu.advanced_item_voiding_cover.tooltip.0":"§7作§f覆盖板§7时销毁物品。", "item.gtceu.advanced_item_voiding_cover.tooltip.1":"加装后使用§f软锤§7激活", "item.gtceu.advanced_power_thruster":"进阶电力推进器", + "item.gtceu.advanced_quarktech_chestplate":"夸克高科™进阶套装胸甲", "item.gtceu.advanced_smd_capacitor":"高级贴片电容", "item.gtceu.advanced_smd_capacitor.tooltip":"§7高级电子元件", "item.gtceu.advanced_smd_diode":"高级贴片二极管", @@ -3607,12 +3677,13 @@ "item.gtceu.advanced_soc.tooltip":"§7先进系统级芯片", "item.gtceu.advanced_soc_wafer":"ASoC晶圆", "item.gtceu.advanced_soc_wafer.tooltip":"§7高级电路原料", - "item.gtceu.aluminium_fluid_cell":"铝单元", + "item.gtceu.aluminium_fluid_cell":"%s铝单元", "item.gtceu.ancient_gold_coin":"上古金币", "item.gtceu.ancient_gold_coin.tooltip":"§7上古遗迹中发掘出的宝藏", "item.gtceu.anvil_casting_mold":"模具(砧)", "item.gtceu.anvil_casting_mold.tooltip":"§7用来制作砧的模具", "item.gtceu.ash_dust":"灰烬", + "item.gtceu.avanced_nanomuscle_chestplate":"纳米肌体™进阶套装胸甲", "item.gtceu.axe_extruder_mold.tooltip":"§7用来制作斧的模头", "item.gtceu.ball_casting_mold":"模具(球)", "item.gtceu.ball_casting_mold.tooltip":"§7用来制作球的模具", @@ -3741,7 +3812,9 @@ "item.gtceu.doge_coin.tooltip":"§7哇哦多币好钱这加密请挖矿暴富非常货币哇哦", "item.gtceu.duct_tape":"布莱恩科技航空专用强化胶带FAL-84型", "item.gtceu.duct_tape.tooltip":"§7如果一卷修不好,那就再来一卷!", + "item.gtceu.dynamite":"炸药", "item.gtceu.electric.pump.tooltip":"§7作§f覆盖板§7时以特定速率传输§f流体§7。", + "item.gtceu.electric_jetpack":"电力喷气背包", "item.gtceu.empty_mold":"空模板", "item.gtceu.empty_mold.tooltip":"§7用以制作模具与压模器的模头", "item.gtceu.empty_spray_can":"空喷漆罐", @@ -3783,7 +3856,7 @@ "item.gtceu.ev_voltage_coil":"超高压线圈", "item.gtceu.ev_voltage_coil.tooltip":"极限线圈", "item.gtceu.exquisite_glass_gem":"精致的玻璃晶体", - "item.gtceu.facade_cover":"覆盖伪装板", + "item.gtceu.facade_cover":"%s覆盖伪装板", "item.gtceu.facade_cover.tooltip":"§7可作为§f覆盖板§7加装装饰性套壳。", "item.gtceu.fertilizer":"肥料", "item.gtceu.fiber_reinforced_circuit_board":"纤维强化电路基板", @@ -3798,7 +3871,7 @@ "item.gtceu.flawed_sugar_gem":"小颗方糖", "item.gtceu.flawless_glass_gem":"无瑕的玻璃晶体", "item.gtceu.fluid.regulator.tooltip":"§7作§f覆盖板§7时§7限制§f§f流体§7的流量。", - "item.gtceu.fluid_cell":"流体单元", + "item.gtceu.fluid_cell":"%s单元", "item.gtceu.fluid_detector_cover":"流体探测覆盖板", "item.gtceu.fluid_detector_cover.tooltip":"§7作§f覆盖板§7时依照§f流体储量§7发出红石信号。", "item.gtceu.fluid_filter":"流体过滤卡", @@ -3828,7 +3901,7 @@ "item.gtceu.glass_gem":"玻璃晶体", "item.gtceu.glass_plate":"玻璃板", "item.gtceu.glass_tube":"玻璃管", - "item.gtceu.glass_vial":"玻璃试管", + "item.gtceu.glass_vial":"%s玻璃试管", "item.gtceu.glauconite_sand_dust":"海绿石砂", "item.gtceu.gold_credit":"金币", "item.gtceu.gold_credit.tooltip":"§764币值", @@ -3847,6 +3920,10 @@ "item.gtceu.green_dye_spray_can":"喷漆罐(绿色)", "item.gtceu.green_glass_lens":"玻璃透镜(绿色)", "item.gtceu.hammer_extruder_mold.tooltip":"§7用来制作锤的模头", + "item.gtceu.hazmat_boots":"防化靴子", + "item.gtceu.hazmat_chestpiece":"防化胸甲", + "item.gtceu.hazmat_headpiece":"防化头盔", + "item.gtceu.hazmat_leggings":"防化靴子", "item.gtceu.highly_advanced_soc":"HASoC", "item.gtceu.highly_advanced_soc.tooltip":"§7高度先进的系统级芯片", "item.gtceu.highly_advanced_soc_wafer":"HASoC晶圆", @@ -3942,6 +4019,7 @@ "item.gtceu.light_gray_glass_lens":"玻璃透镜(淡灰色)", "item.gtceu.lime_dye_spray_can":"喷漆罐(黄绿色)", "item.gtceu.lime_glass_lens":"玻璃透镜(黄绿色)", + "item.gtceu.liquid_fuel_jetpack":"液体燃料喷气背包", "item.gtceu.long_rod_extruder_mold":"模头(长杆)", "item.gtceu.long_treated_wood_rod":"长防腐木棍", "item.gtceu.long_wood_rod":"长木棍", @@ -3992,6 +4070,7 @@ "item.gtceu.magenta_dye_spray_can":"喷漆罐(品红色)", "item.gtceu.magenta_glass_lens":"玻璃透镜(品红色)", "item.gtceu.maintenance_detector_cover":"维护探测覆盖板", + "item.gtceu.mask_filter":"防毒面具过滤罐", "item.gtceu.max_battery":"终极电池", "item.gtceu.max_battery.tooltip":"§7填满就能通关Minecraft", "item.gtceu.max_voltage_coil.tooltip":"至高线圈", @@ -4068,6 +4147,10 @@ "item.gtceu.nano_processor_mainframe.tooltip.0":"§7比小更小", "item.gtceu.nano_processor_mainframe.tooltip.1":"§bLuV级电路", "item.gtceu.nano_saber.tooltip":"§7尝尝龙神之剑!", + "item.gtceu.nanomuscle_boots":"纳米肌体™套装靴子", + "item.gtceu.nanomuscle_chestplate":"纳米肌体™套装胸甲", + "item.gtceu.nanomuscle_helmet":"纳米肌体™套装头盔", + "item.gtceu.nanomuscle_leggings":"纳米肌体™套装护腿", "item.gtceu.naquadah_boule":"硅岩掺杂的单晶硅", "item.gtceu.naquadah_boule.tooltip":"§7电路原料", "item.gtceu.naquadah_credit":"硅岩币", @@ -4084,6 +4167,7 @@ "item.gtceu.neutronium_credit.tooltip":"§7262144币值", "item.gtceu.neutronium_wafer":"中子素掺杂的晶圆", "item.gtceu.neutronium_wafer.tooltip":"§7电路原料", + "item.gtceu.nightvision_goggles":"夜视护目镜", "item.gtceu.nor_memory_chip":"NOR存储器芯片", "item.gtceu.nor_memory_chip.tooltip":"§7或非逻辑门", "item.gtceu.nor_memory_wafer":"NOR存储器晶圆", @@ -4142,7 +4226,7 @@ "item.gtceu.platinum_group_sludge_dust":"铂系矿泥", "item.gtceu.platinum_raw_dust":"粗铂粉", "item.gtceu.platinum_sludge_residue_dust":"铂泥渣", - "item.gtceu.portable_debug_scanner":"便携式扫描仪", + "item.gtceu.portable_debug_scanner":"便携式调试扫描仪", "item.gtceu.portable_scanner":"便携式扫描仪", "item.gtceu.power_thruster":"电力推进器", "item.gtceu.programmed_circuit":"编程电路", @@ -4183,6 +4267,10 @@ "item.gtceu.quantum_processor_mainframe.tooltip.1":"§aZPM级电路", "item.gtceu.quantum_star":"量子之星", "item.gtceu.quantum_star.tooltip":"§7改良的下界之星", + "item.gtceu.quarktech_boots":"夸克高科™套装靴子", + "item.gtceu.quarktech_chestplate":"夸克高科™套装胸甲", + "item.gtceu.quarktech_helmet":"夸克高科™套装头盔", + "item.gtceu.quarktech_leggings":"夸克高科™套装护腿", "item.gtceu.quartz_sand_dust":"石英砂", "item.gtceu.ram_chip":"RAM芯片", "item.gtceu.ram_chip.tooltip":"§7随机存取存储器", @@ -4287,13 +4375,15 @@ "item.gtceu.solar_panel.tooltip.0":"§7愿太阳与你同在。", "item.gtceu.solar_panel.tooltip.1":"§7作§f覆盖板§7时利用§e太阳§7生产§f能量§7。", "item.gtceu.solvent_spray_can":"喷漆罐(溶剂)", - "item.gtceu.stainless_steel_fluid_cell":"不锈钢单元", - "item.gtceu.steel_fluid_cell":"钢单元", + "item.gtceu.stainless_steel_fluid_cell":"%s不锈钢单元", + "item.gtceu.steel_fluid_cell":"%s钢单元", "item.gtceu.steel_minecart_wheels":"钢矿车车轮", "item.gtceu.stem_cells":"干细胞", "item.gtceu.stem_cells.tooltip":"§7智慧原料", "item.gtceu.sticky_resin":"黏性树脂", "item.gtceu.sugar_gem":"方糖", + "item.gtceu.sus_record":"音乐唱片", + "item.gtceu.sus_record.desc":"可疑!", "item.gtceu.sword_extruder_mold.tooltip":"§7用来制作剑刃的模头", "item.gtceu.talc_dust":"滑石", "item.gtceu.tantalum_capacitor":"钽电容", @@ -4331,7 +4421,7 @@ "item.gtceu.tiny_treated_wood_dust":"小撮防腐木浆", "item.gtceu.tiny_wheat_dust":"小撮面粉", "item.gtceu.tiny_wood_dust":"小撮木浆", - "item.gtceu.titanium_fluid_cell":"钛单元", + "item.gtceu.titanium_fluid_cell":"%s钛单元", "item.gtceu.tool.aoe.columns":"列", "item.gtceu.tool.aoe.layers":"层", "item.gtceu.tool.aoe.rows":"行", @@ -4428,8 +4518,8 @@ "item.gtceu.treated_wood_plate":"防腐木板", "item.gtceu.treated_wood_rod":"防腐木棍", "item.gtceu.tungsten_grinding_head":"钨研磨头", - "item.gtceu.tungstensteel_fluid_cell":"钨钢单元", - "item.gtceu.turbine_rotor":"涡轮转子", + "item.gtceu.tungstensteel_fluid_cell":"%s钨钢单元", + "item.gtceu.turbine_rotor":"%s涡轮转子", "item.gtceu.turbine_rotor.tooltip":"供涡轮机使用的涡轮转子", "item.gtceu.uev_conveyor_module":"§aUEV§r传送带", "item.gtceu.uev_electric_motor":"§aUEV§r电动马达", @@ -4473,7 +4563,7 @@ "item.gtceu.ulv_tantalum_battery.tooltip":"§7可充电电池", "item.gtceu.ulv_voltage_coil":"超低压线圈", "item.gtceu.ulv_voltage_coil.tooltip":"初级线圈", - "item.gtceu.universal_fluid_cell":"通用单元", + "item.gtceu.universal_fluid_cell":"%s通用单元", "item.gtceu.uv_battery_hull":"大型超能硅岩电池外壳", "item.gtceu.uv_battery_hull.tooltip":"§7一个空的§3UV§7电池外壳", "item.gtceu.uv_conveyor_module":"§3UV§r传送带", @@ -4566,6 +4656,7 @@ "material.gtceu.acidic_naquadria_solution":"酸性超能硅岩溶液", "material.gtceu.acidic_osmium_solution":"酸性锇溶液", "material.gtceu.actinium":"锕", + "material.gtceu.activated_carbon":"活性炭", "material.gtceu.agar":"琼脂", "material.gtceu.air":"空气", "material.gtceu.allyl_chloride":"烯丙基氯", @@ -5241,6 +5332,7 @@ "metaitem.generic.fluid_container.tooltip":"%d/%dL %s", "metaitem.int_circuit.configuration":"配置:%d", "metaitem.liquid_fuel_jetpack.tooltip":"利用内燃发电机的燃料来提供推进动力", + "metaitem.machine_configuration.mode":"§a配置模式:§r%s", "metaitem.plugin.proxy.tooltips.1":"(请将屏幕调整为代理模式)", "metaitem.plugin.tooltips.1":"可为屏幕安装插件以实现更多功能。", "metaitem.prospector.mode.bedrock_ore":"§b基岩矿石勘探模式§r", @@ -5317,6 +5409,7 @@ "tagprefix.lens":"%s透镜", "tagprefix.log":"%s原木", "tagprefix.long_rod":"长%s杆", + "tagprefix.marble":"大理岩%s矿石", "tagprefix.netherrack":"下界岩%s矿石", "tagprefix.nugget":"%s粒", "tagprefix.pipe_huge_fluid":"巨型%s流体管道", @@ -5349,6 +5442,7 @@ "tagprefix.purified_ore":"纯净%s矿石", "tagprefix.raw":"粗%s", "tagprefix.raw_ore_block":"粗%s块", + "tagprefix.red_granite":"红花岗岩%s矿石", "tagprefix.red_sand":"红沙%s矿石", "tagprefix.refined_ore":"精炼%s矿石", "tagprefix.ring":"%s环", diff --git a/src/main/resources/assets/gtceu/textures/armor/bad_hazmat_1.png b/src/main/resources/assets/gtceu/textures/armor/bad_hazmat_1.png new file mode 100644 index 0000000000..4b1c6395c5 Binary files /dev/null and b/src/main/resources/assets/gtceu/textures/armor/bad_hazmat_1.png differ diff --git a/src/main/resources/assets/gtceu/textures/block/casings/solid/machine_casing_stainless_evaporation.png b/src/main/resources/assets/gtceu/textures/block/casings/solid/machine_casing_stainless_evaporation.png new file mode 100644 index 0000000000..b8206dba76 Binary files /dev/null and b/src/main/resources/assets/gtceu/textures/block/casings/solid/machine_casing_stainless_evaporation.png differ diff --git a/src/main/resources/assets/gtceu/textures/block/casings/solid/machine_casing_stainless_evaporation.png.mcmeta b/src/main/resources/assets/gtceu/textures/block/casings/solid/machine_casing_stainless_evaporation.png.mcmeta new file mode 100644 index 0000000000..53b118fbef --- /dev/null +++ b/src/main/resources/assets/gtceu/textures/block/casings/solid/machine_casing_stainless_evaporation.png.mcmeta @@ -0,0 +1,5 @@ +{ + "ldlib": { + "connection": "gtceu:block/casings/solid/machine_casing_stainless_evaporation_ctm" + } +} diff --git a/src/main/resources/assets/gtceu/textures/block/casings/solid/machine_casing_stainless_evaporation_ctm.png b/src/main/resources/assets/gtceu/textures/block/casings/solid/machine_casing_stainless_evaporation_ctm.png new file mode 100644 index 0000000000..96ea407376 Binary files /dev/null and b/src/main/resources/assets/gtceu/textures/block/casings/solid/machine_casing_stainless_evaporation_ctm.png differ diff --git a/src/main/resources/assets/gtceu/textures/item/face_mask.png b/src/main/resources/assets/gtceu/textures/item/face_mask.png new file mode 100644 index 0000000000..ab59647b4a Binary files /dev/null and b/src/main/resources/assets/gtceu/textures/item/face_mask.png differ diff --git a/src/main/resources/assets/gtceu/textures/item/paracetamol_pill.png b/src/main/resources/assets/gtceu/textures/item/paracetamol_pill.png new file mode 100644 index 0000000000..46058fbcf7 Binary files /dev/null and b/src/main/resources/assets/gtceu/textures/item/paracetamol_pill.png differ diff --git a/src/main/resources/assets/gtceu/textures/item/pill_casting_mold.png b/src/main/resources/assets/gtceu/textures/item/pill_casting_mold.png new file mode 100644 index 0000000000..fde142fa8a Binary files /dev/null and b/src/main/resources/assets/gtceu/textures/item/pill_casting_mold.png differ diff --git a/src/main/resources/assets/gtceu/textures/item/rad_away_pill.png b/src/main/resources/assets/gtceu/textures/item/rad_away_pill.png new file mode 100644 index 0000000000..e491b22d40 Binary files /dev/null and b/src/main/resources/assets/gtceu/textures/item/rad_away_pill.png differ diff --git a/src/main/resources/assets/gtceu/textures/item/rubber_gloves.png b/src/main/resources/assets/gtceu/textures/item/rubber_gloves.png new file mode 100644 index 0000000000..a1aa190350 Binary files /dev/null and b/src/main/resources/assets/gtceu/textures/item/rubber_gloves.png differ diff --git a/src/main/resources/assets/gtceu/textures/mob_effect/weak_poison.png b/src/main/resources/assets/gtceu/textures/mob_effect/weak_poison.png new file mode 100644 index 0000000000..affdef7f77 Binary files /dev/null and b/src/main/resources/assets/gtceu/textures/mob_effect/weak_poison.png differ diff --git a/src/main/resources/gtceu.mixins.json b/src/main/resources/gtceu.mixins.json index ab70810532..ed7bbb3b6a 100644 --- a/src/main/resources/gtceu.mixins.json +++ b/src/main/resources/gtceu.mixins.json @@ -8,6 +8,7 @@ "BlockModelMixin", "GuiGraphicsAccessor", "GuiGraphicsMixin", + "GuiHeartTypeMixin", "LevelRendererMixin", "ModelManagerMixin", "MultiPlayerGameModeMixin", @@ -58,4 +59,4 @@ "defaultRequire": 1, "maxShiftBy": 5 } -} \ No newline at end of file +}