diff --git a/CHANGELOG.md b/CHANGELOG.md index 782ce3a0e8..6013af0c2a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # ChangeLog +## Version [v1.5.3](https://github.com/GregTechCEu/GregTech-Modern/compare/v1.5.2-1.20.1...v1.5.3-1.20.1) +### Fixed + + - Fixed recipe deserialization again so that both SP and MP worlds load ([#2376](https://github.com/GregTechCEu/GregTech-Modern/pull/2376)) + ## Version [v1.5.2](https://github.com/GregTechCEu/GregTech-Modern/compare/v1.5.1-1.20.1...v1.5.2-1.20.1) ### Added diff --git a/gradle.properties b/gradle.properties index b26b8cac0d..cf8fdb8e2d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs = -Xmx6G # Mod Info mod_id = gtceu mod_name = GregTech -mod_version = 1.5.3 +mod_version = 1.5.4 mod_description = GregTech CE Unofficial, ported from 1.12.2 mod_license = LGPL-3.0 license mod_url = https://github.com/GregTechCEu/GregTech-Modern/ diff --git a/src/generated/resources/assets/gtceu/compass/nodes/machines/fisher.json b/src/generated/resources/assets/gtceu/compass/nodes/machines/fisher.json index 7cc0aa00a4..d93f54859c 100644 --- a/src/generated/resources/assets/gtceu/compass/nodes/machines/fisher.json +++ b/src/generated/resources/assets/gtceu/compass/nodes/machines/fisher.json @@ -7,7 +7,9 @@ "gtceu:lv_fisher", "gtceu:mv_fisher", "gtceu:hv_fisher", - "gtceu:ev_fisher" + "gtceu:ev_fisher", + "gtceu:iv_fisher", + "gtceu:luv_fisher" ], "page": "gtceu:machines/fisher", "position": [ diff --git a/src/generated/resources/assets/gtceu/lang/en_ud.json b/src/generated/resources/assets/gtceu/lang/en_ud.json index b737761af1..3aae919bf0 100644 --- a/src/generated/resources/assets/gtceu/lang/en_ud.json +++ b/src/generated/resources/assets/gtceu/lang/en_ud.json @@ -466,6 +466,7 @@ "block.gtceu.iv_extractor": "ɹ§ ɹoʇɔɐɹʇxƎ ǝʇıןƎ6§", "block.gtceu.iv_extruder": "ɹ§ ɹǝpnɹʇxƎ ǝʇıןƎ6§", "block.gtceu.iv_fermenter": "ɹ§ ɹǝʇuǝɯɹǝℲ ǝʇıןƎ6§", + "block.gtceu.iv_fisher": "ɹ§ ɹǝɥsıℲ ǝʇıןƎ6§", "block.gtceu.iv_fluid_heater": "ɹ§ ɹǝʇɐǝH pınןℲ ǝʇıןƎ6§", "block.gtceu.iv_fluid_passthrough_hatch": "ɥɔʇɐH ɥbnoɹɥʇssɐԀ pınןℲ ΛI6§", "block.gtceu.iv_fluid_solidifier": "ɹ§ ɹǝıɟıpıןoS pınןℲ ǝʇıןƎ6§", @@ -630,6 +631,7 @@ "block.gtceu.luv_extractor": "ɹ§II ɹoʇɔɐɹʇxƎ ǝʇıןƎp§", "block.gtceu.luv_extruder": "ɹ§II ɹǝpnɹʇxƎ ǝʇıןƎp§", "block.gtceu.luv_fermenter": "ɹ§II ɹǝʇuǝɯɹǝℲ ǝʇıןƎp§", + "block.gtceu.luv_fisher": "ɹ§II ɹǝɥsıℲ ǝʇıןƎp§", "block.gtceu.luv_fluid_heater": "ɹ§II ɹǝʇɐǝH pınןℲ ǝʇıןƎp§", "block.gtceu.luv_fluid_passthrough_hatch": "ɥɔʇɐH ɥbnoɹɥʇssɐԀ pınןℲ ΛnꞀp§", "block.gtceu.luv_fluid_solidifier": "ɹ§II ɹǝıɟıpıןoS pınןℲ ǝʇıןƎp§", @@ -2248,15 +2250,14 @@ "config.gtceu.option.disableManualCompression": "uoıssǝɹdɯoƆןɐnuɐWǝןqɐsıp", "config.gtceu.option.doBedrockOres": "sǝɹOʞɔoɹpǝᗺop", "config.gtceu.option.doSuperflatOres": "sǝɹOʇɐןɟɹǝdnSop", - "config.gtceu.option.doTerrainExplosion": "uoısoןdxƎuıɐɹɹǝ⟘op", "config.gtceu.option.doesExplosionDamagesTerrain": "uıɐɹɹǝ⟘sǝbɐɯɐᗡuoısoןdxƎsǝop", "config.gtceu.option.dumpAssets": "sʇǝssⱯdɯnp", "config.gtceu.option.dumpRecipes": "sǝdıɔǝᴚdɯnp", "config.gtceu.option.enableCleanroom": "ɯooɹuɐǝןƆǝןqɐuǝ", "config.gtceu.option.enableCompass": "ssɐdɯoƆǝןqɐuǝ", + "config.gtceu.option.enableFEConverters": "sɹǝʇɹǝʌuoƆƎℲǝןqɐuǝ", "config.gtceu.option.enableMaintenance": "ǝɔuɐuǝʇuıɐWǝןqɐuǝ", "config.gtceu.option.enableMoreDualHatchAbility": "ʎʇıןıqⱯɥɔʇɐHןɐnᗡǝɹoWǝןqɐuǝ", - "config.gtceu.option.enablePlatformConverters": "sɹǝʇɹǝʌuoƆɯɹoɟʇɐןԀǝןqɐuǝ", "config.gtceu.option.enableResearch": "ɥɔɹɐǝsǝᴚǝןqɐuǝ", "config.gtceu.option.enableTieredCasings": "sbuısɐƆpǝɹǝı⟘ǝןqɐuǝ", "config.gtceu.option.enableWorldAccelerators": "sɹoʇɐɹǝןǝɔɔⱯpןɹoMǝןqɐuǝ", @@ -2266,7 +2267,8 @@ "config.gtceu.option.energyUsageMultiplier": "ɹǝıןdıʇןnWǝbɐs∩ʎbɹǝuǝ", "config.gtceu.option.environmentalHazardDecayRate": "ǝʇɐᴚʎɐɔǝᗡpɹɐzɐHןɐʇuǝɯuoɹıʌuǝ", "config.gtceu.option.environmentalHazards": "spɹɐzɐHןɐʇuǝɯuoɹıʌuǝ", - "config.gtceu.option.euToPlatformRatio": "oıʇɐᴚɯɹoɟʇɐןԀo⟘nǝ", + "config.gtceu.option.euToFeRatio": "oıʇɐᴚǝℲo⟘nǝ", + "config.gtceu.option.feToEuRatio": "oıʇɐᴚnƎo⟘ǝɟ", "config.gtceu.option.flintAndSteelRequireSteel": "ןǝǝʇSǝɹınbǝᴚןǝǝʇSpuⱯʇuıןɟ", "config.gtceu.option.gameplay": "ʎɐןdǝɯɐb", "config.gtceu.option.generateLowQualityGems": "sɯǝ⅁ʎʇıןɐnὉʍoꞀǝʇɐɹǝuǝb", @@ -2287,8 +2289,8 @@ "config.gtceu.option.harderRods": "spoᴚɹǝpɹɐɥ", "config.gtceu.option.harmlessActiveTransformers": "sɹǝɯɹoɟsuɐɹ⟘ǝʌıʇɔⱯssǝןɯɹɐɥ", "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.hideFacadesInRecipeViewer": "ɹǝʍǝıΛǝdıɔǝᴚuIsǝpɐɔɐℲǝpıɥ", + "config.gtceu.option.hideFilledCellsInRecipeViewer": "ɹǝʍǝıΛǝdıɔǝᴚuIsןןǝƆpǝןןıℲǝpıɥ", "config.gtceu.option.hideOreProcessingDiagrams": "sɯɐɹbɐıᗡbuıssǝɔoɹԀǝɹOǝpıɥ", "config.gtceu.option.highTierContent": "ʇuǝʇuoƆɹǝı⟘ɥbıɥ", "config.gtceu.option.hpLiquidBoilerBaseOutput": "ʇndʇnOǝsɐᗺɹǝןıoᗺpınbıꞀdɥ", @@ -2312,7 +2314,7 @@ "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.nativeEUToFE": "ƎℲo⟘∩Ǝǝʌıʇɐu", "config.gtceu.option.nerfPaperCrafting": "buıʇɟɐɹƆɹǝdɐԀɟɹǝu", "config.gtceu.option.nerfWoodCrafting": "buıʇɟɐɹƆpooMɟɹǝu", "config.gtceu.option.onlyOwnerBreak": "ʞɐǝɹᗺɹǝuʍOʎןuo", @@ -2330,7 +2332,6 @@ "config.gtceu.option.oreVeins": "suıǝΛǝɹo", "config.gtceu.option.overclockDivisor": "ɹosıʌıᗡʞɔoןɔɹǝʌo", "config.gtceu.option.ownerOPBypass": "ssɐdʎᗺԀOɹǝuʍo", - "config.gtceu.option.platformToEuRatio": "oıʇɐᴚnƎo⟘ɯɹoɟʇɐןd", "config.gtceu.option.prospectorEnergyUseMultiplier": "ɹǝıןdıʇןnWǝs∩ʎbɹǝuƎɹoʇɔǝdsoɹd", "config.gtceu.option.recipeProgressLowEnergy": "ʎbɹǝuƎʍoꞀssǝɹboɹԀǝdıɔǝɹ", "config.gtceu.option.recipes": "sǝdıɔǝɹ", @@ -2345,6 +2346,7 @@ "config.gtceu.option.rngDamageElectricTools": "sןoo⟘ɔıɹʇɔǝןƎǝbɐɯɐᗡbuɹ", "config.gtceu.option.rubberTreeSpawnChance": "ǝɔuɐɥƆuʍɐdSǝǝɹ⟘ɹǝqqnɹ", "config.gtceu.option.sandOresFall": "ןןɐℲsǝɹOpuɐs", + "config.gtceu.option.shouldWeatherOrTerrainExplosion": "uoısoןdxƎuıɐɹɹǝ⟘ɹOɹǝɥʇɐǝMpןnoɥs", "config.gtceu.option.showDimensionTier": "ɹǝı⟘uoısuǝɯıᗡʍoɥs", "config.gtceu.option.smallBoilers": "sɹǝןıoᗺןןɐɯs", "config.gtceu.option.solarBoilerBaseOutput": "ʇndʇnOǝsɐᗺɹǝןıoᗺɹɐןos", @@ -2797,6 +2799,8 @@ "gtceu.gui.cover_setting.title": "sbuıʇʇǝS ɹǝʌoƆ", "gtceu.gui.editor.group.recipe_type": "dɐɔ", "gtceu.gui.editor.tips.citation": "suoıʇɐʇıɔ ɟo ɹǝqɯnN", + "gtceu.gui.fisher_mode.tooltip.0": "sɯǝʇı ʞunظ ǝןbbo⟘", + "gtceu.gui.fisher_mode.tooltip.1": "uoıʇɐɹǝdo ɹǝd buıɹʇs ᄅ sʇsoɔ ɟɟO", "gtceu.gui.fluid_amount": ":ʇunoɯⱯ pınןℲ", "gtceu.gui.fluid_auto_input.tooltip.disabled": "pǝןqɐsıᗡ ʇnduI-oʇnⱯ pınןℲ", "gtceu.gui.fluid_auto_input.tooltip.enabled": "pǝןqɐuƎ ʇnduI-oʇnⱯ pınןℲ", @@ -4954,7 +4958,8 @@ "item.gtceu.tool.lv_wrench": ")ΛꞀ( ɥɔuǝɹM %s", "item.gtceu.tool.lv_wrench.tooltip": "sǝuıɥɔɐW ǝןʇuɐɯsıp oʇ ʞɔıןɔ ʇɟǝן pןoH8§", "item.gtceu.tool.mallet": "ʇǝןןɐW ʇɟoS %s", - "item.gtceu.tool.mallet.tooltip": "ʎɹǝuıɥɔɐW sʇɹɐʇS/sdoʇS8§", + "item.gtceu.tool.mallet.tooltip.0": "˙ǝdıɔǝᴚ ʇuǝɹɹnƆ ɹǝʇɟⱯ ǝuıɥɔɐW ǝsnɐԀ oʇ ʞɐǝuS8§", + "item.gtceu.tool.mallet.tooltip.1": "sǝuıɥɔɐW sʇɹɐʇS/sdoʇS8§", "item.gtceu.tool.matchbox.tooltip": "ɹɐƆ ɐ ʇou sı sıɥ⟘ㄥ§", "item.gtceu.tool.mining_hammer": "ɹǝɯɯɐH buıuıW %s", "item.gtceu.tool.mining_hammer.tooltip": ")buıɥɔnoɹɔ ǝɹ,noʎ ssǝןun( ǝɔuo ʇɐ ɐǝɹɐ ǝbɹɐן ɐ sǝuıW8§", diff --git a/src/generated/resources/assets/gtceu/lang/en_us.json b/src/generated/resources/assets/gtceu/lang/en_us.json index 6a80439f07..fdbeae1a6f 100644 --- a/src/generated/resources/assets/gtceu/lang/en_us.json +++ b/src/generated/resources/assets/gtceu/lang/en_us.json @@ -466,6 +466,7 @@ "block.gtceu.iv_extractor": "§9Elite Extractor §r", "block.gtceu.iv_extruder": "§9Elite Extruder §r", "block.gtceu.iv_fermenter": "§9Elite Fermenter §r", + "block.gtceu.iv_fisher": "§9Elite Fisher §r", "block.gtceu.iv_fluid_heater": "§9Elite Fluid Heater §r", "block.gtceu.iv_fluid_passthrough_hatch": "§9IV Fluid Passthrough Hatch", "block.gtceu.iv_fluid_solidifier": "§9Elite Fluid Solidifier §r", @@ -630,6 +631,7 @@ "block.gtceu.luv_extractor": "§dElite Extractor II§r", "block.gtceu.luv_extruder": "§dElite Extruder II§r", "block.gtceu.luv_fermenter": "§dElite Fermenter II§r", + "block.gtceu.luv_fisher": "§dElite Fisher II§r", "block.gtceu.luv_fluid_heater": "§dElite Fluid Heater II§r", "block.gtceu.luv_fluid_passthrough_hatch": "§dLuV Fluid Passthrough Hatch", "block.gtceu.luv_fluid_solidifier": "§dElite Fluid Solidifier II§r", @@ -2248,15 +2250,14 @@ "config.gtceu.option.disableManualCompression": "disableManualCompression", "config.gtceu.option.doBedrockOres": "doBedrockOres", "config.gtceu.option.doSuperflatOres": "doSuperflatOres", - "config.gtceu.option.doTerrainExplosion": "doTerrainExplosion", "config.gtceu.option.doesExplosionDamagesTerrain": "doesExplosionDamagesTerrain", "config.gtceu.option.dumpAssets": "dumpAssets", "config.gtceu.option.dumpRecipes": "dumpRecipes", "config.gtceu.option.enableCleanroom": "enableCleanroom", "config.gtceu.option.enableCompass": "enableCompass", + "config.gtceu.option.enableFEConverters": "enableFEConverters", "config.gtceu.option.enableMaintenance": "enableMaintenance", "config.gtceu.option.enableMoreDualHatchAbility": "enableMoreDualHatchAbility", - "config.gtceu.option.enablePlatformConverters": "enablePlatformConverters", "config.gtceu.option.enableResearch": "enableResearch", "config.gtceu.option.enableTieredCasings": "enableTieredCasings", "config.gtceu.option.enableWorldAccelerators": "enableWorldAccelerators", @@ -2266,7 +2267,8 @@ "config.gtceu.option.energyUsageMultiplier": "energyUsageMultiplier", "config.gtceu.option.environmentalHazardDecayRate": "environmentalHazardDecayRate", "config.gtceu.option.environmentalHazards": "environmentalHazards", - "config.gtceu.option.euToPlatformRatio": "euToPlatformRatio", + "config.gtceu.option.euToFeRatio": "euToFeRatio", + "config.gtceu.option.feToEuRatio": "feToEuRatio", "config.gtceu.option.flintAndSteelRequireSteel": "flintAndSteelRequireSteel", "config.gtceu.option.gameplay": "gameplay", "config.gtceu.option.generateLowQualityGems": "generateLowQualityGems", @@ -2287,8 +2289,8 @@ "config.gtceu.option.harderRods": "harderRods", "config.gtceu.option.harmlessActiveTransformers": "harmlessActiveTransformers", "config.gtceu.option.hazardsEnabled": "hazardsEnabled", - "config.gtceu.option.hideFacadesInJEI": "hideFacadesInJEI", - "config.gtceu.option.hideFilledCellsInJEI": "hideFilledCellsInJEI", + "config.gtceu.option.hideFacadesInRecipeViewer": "hideFacadesInRecipeViewer", + "config.gtceu.option.hideFilledCellsInRecipeViewer": "hideFilledCellsInRecipeViewer", "config.gtceu.option.hideOreProcessingDiagrams": "hideOreProcessingDiagrams", "config.gtceu.option.highTierContent": "highTierContent", "config.gtceu.option.hpLiquidBoilerBaseOutput": "hpLiquidBoilerBaseOutput", @@ -2312,7 +2314,7 @@ "config.gtceu.option.nanoSaber": "nanoSaber", "config.gtceu.option.nanoSaberBaseDamage": "nanoSaberBaseDamage", "config.gtceu.option.nanoSaberDamageBoost": "nanoSaberDamageBoost", - "config.gtceu.option.nativeEUToPlatformNative": "nativeEUToPlatformNative", + "config.gtceu.option.nativeEUToFE": "nativeEUToFE", "config.gtceu.option.nerfPaperCrafting": "nerfPaperCrafting", "config.gtceu.option.nerfWoodCrafting": "nerfWoodCrafting", "config.gtceu.option.onlyOwnerBreak": "onlyOwnerBreak", @@ -2330,7 +2332,6 @@ "config.gtceu.option.oreVeins": "oreVeins", "config.gtceu.option.overclockDivisor": "overclockDivisor", "config.gtceu.option.ownerOPBypass": "ownerOPBypass", - "config.gtceu.option.platformToEuRatio": "platformToEuRatio", "config.gtceu.option.prospectorEnergyUseMultiplier": "prospectorEnergyUseMultiplier", "config.gtceu.option.recipeProgressLowEnergy": "recipeProgressLowEnergy", "config.gtceu.option.recipes": "recipes", @@ -2345,6 +2346,7 @@ "config.gtceu.option.rngDamageElectricTools": "rngDamageElectricTools", "config.gtceu.option.rubberTreeSpawnChance": "rubberTreeSpawnChance", "config.gtceu.option.sandOresFall": "sandOresFall", + "config.gtceu.option.shouldWeatherOrTerrainExplosion": "shouldWeatherOrTerrainExplosion", "config.gtceu.option.showDimensionTier": "showDimensionTier", "config.gtceu.option.smallBoilers": "smallBoilers", "config.gtceu.option.solarBoilerBaseOutput": "solarBoilerBaseOutput", @@ -2797,6 +2799,8 @@ "gtceu.gui.cover_setting.title": "Cover Settings", "gtceu.gui.editor.group.recipe_type": "cap", "gtceu.gui.editor.tips.citation": "Number of citations", + "gtceu.gui.fisher_mode.tooltip.0": "Toggle junk items", + "gtceu.gui.fisher_mode.tooltip.1": "Off costs 2 string per operation", "gtceu.gui.fluid_amount": "Fluid Amount:", "gtceu.gui.fluid_auto_input.tooltip.disabled": "Fluid Auto-Input Disabled", "gtceu.gui.fluid_auto_input.tooltip.enabled": "Fluid Auto-Input Enabled", @@ -4954,7 +4958,8 @@ "item.gtceu.tool.lv_wrench": "%s Wrench (LV)", "item.gtceu.tool.lv_wrench.tooltip": "§8Hold left click to dismantle Machines", "item.gtceu.tool.mallet": "%s Soft Mallet", - "item.gtceu.tool.mallet.tooltip": "§8Stops/Starts Machinery", + "item.gtceu.tool.mallet.tooltip.0": "§8Sneak to Pause Machine After Current Recipe.", + "item.gtceu.tool.mallet.tooltip.1": "§8Stops/Starts Machines", "item.gtceu.tool.matchbox.tooltip": "§7This is not a Car", "item.gtceu.tool.mining_hammer": "%s Mining Hammer", "item.gtceu.tool.mining_hammer.tooltip": "§8Mines a large area at once (unless you're crouching)", 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 aaebc50944..ec684acbcb 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/block/MaterialBlock.java +++ b/src/main/java/com/gregtechceu/gtceu/api/block/MaterialBlock.java @@ -22,9 +22,12 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.sounds.SoundSource; +import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.item.FallingBlockEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.BlockItem; @@ -40,6 +43,7 @@ import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; @@ -276,4 +280,28 @@ public boolean replaceWithFramedPipe(Level level, BlockPos pos, BlockState state } return false; } + + @Override + public void entityInside(BlockState state, Level level, BlockPos pos, Entity entity) { + if (this.tagPrefix == TagPrefix.frameGt && entity instanceof LivingEntity livingEntity) { + double currentAccel = 0.15D * (livingEntity.getDeltaMovement().y < 0.3D ? 2.5D : 1.0D); + double currentSpeedVertical = 0.9D * (livingEntity.isInWater() ? 0.4D : 1.0D); + Vec3 deltaMovement = livingEntity.getDeltaMovement(); + livingEntity.resetFallDistance(); + float f = 0.15F; + double d0 = Mth.clamp(deltaMovement.x, -f, f); + double d1 = Mth.clamp(deltaMovement.z, -f, f); + double d2 = Math.max(deltaMovement.y, -f); + if (d2 < 0.0 && !livingEntity.getFeetBlockState().isScaffolding(livingEntity) && + livingEntity.isSuppressingSlidingDownLadder() && + livingEntity instanceof Player) { + d2 = Math.min(deltaMovement.y + currentAccel, 0.0D); + } + if (livingEntity.horizontalCollision) { + d2 = 0.3; + } + deltaMovement = new Vec3(d0, d2, d1); + entity.setDeltaMovement(deltaMovement); + } + } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/compat/EUToFEProvider.java b/src/main/java/com/gregtechceu/gtceu/api/capability/compat/EUToFEProvider.java index c14b7f7291..c5203fce0a 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/compat/EUToFEProvider.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/compat/EUToFEProvider.java @@ -31,7 +31,7 @@ public EUToFEProvider(BlockEntity tileEntity) { @Override public LazyOptional getCapability(@NotNull Capability capability, Direction facing) { - if (!ConfigHolder.INSTANCE.compat.energy.nativeEUToPlatformNative || + if (!ConfigHolder.INSTANCE.compat.energy.nativeEUToFE || capability != GTCapability.CAPABILITY_ENERGY_CONTAINER) return LazyOptional.empty(); diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/compat/FeCompat.java b/src/main/java/com/gregtechceu/gtceu/api/capability/compat/FeCompat.java index c838d60762..1357ca0819 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/compat/FeCompat.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/compat/FeCompat.java @@ -10,8 +10,8 @@ public class FeCompat { * Conversion ratio used by energy converters */ public static int ratio(boolean feToEu) { - return feToEu ? ConfigHolder.INSTANCE.compat.energy.platformToEuRatio : - ConfigHolder.INSTANCE.compat.energy.euToPlatformRatio; + return feToEu ? ConfigHolder.INSTANCE.compat.energy.feToEuRatio : + ConfigHolder.INSTANCE.compat.energy.euToFeRatio; } /** 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 9a5bd0448b..3154341714 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 @@ -185,7 +185,24 @@ public class Tab extends WidgetGroup { public Tab(IFancyConfigurator configurator) { super(0, tabs.size() * (getTabSize() + 2), getTabSize(), getTabSize()); this.configurator = configurator; - this.button = new ButtonWidget(0, 0, getTabSize(), getTabSize(), null, this::onClick); + this.button = new ButtonWidget(0, 0, getTabSize(), getTabSize(), null, this::onClick) { + + @Override + public boolean mouseWheelMove(double mouseX, double mouseY, double wheelDelta) { + if (!(configurator instanceof IFancyCustomMouseWheelAction hasActions)) return false; + if (isMouseOverElement(mouseX, mouseY)) + return hasActions.mouseWheelMove(this::writeClientAction, mouseX, mouseY, wheelDelta); + return false; + } + + @Override + public void handleClientAction(int id, FriendlyByteBuf buffer) { + if (configurator instanceof IFancyCustomClientActionHandler handler && id > 1) + handler.handleClientAction(id, buffer); + else + super.handleClientAction(id, buffer); + } + }; if (configurator instanceof IFancyConfiguratorButton) { this.view = null; this.addWidget(button); @@ -270,7 +287,9 @@ protected void onChildSizeUpdate(Widget child) { } private void onClick(ClickData clickData) { - if (configurator instanceof IFancyConfiguratorButton fancyButton) { + if (clickData.button == 2 && configurator instanceof IFancyCustomMiddleClickAction middleAction) { + middleAction.onMiddleClick(this::writeClientAction); + } else if (configurator instanceof IFancyConfiguratorButton fancyButton) { fancyButton.onClick(clickData); } else { if (expanded == this) { diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/IFancyCustomClientActionHandler.java b/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/IFancyCustomClientActionHandler.java new file mode 100644 index 0000000000..f9b354cf1f --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/IFancyCustomClientActionHandler.java @@ -0,0 +1,8 @@ +package com.gregtechceu.gtceu.api.gui.fancy; + +import net.minecraft.network.FriendlyByteBuf; + +public interface IFancyCustomClientActionHandler { + + default void handleClientAction(int id, FriendlyByteBuf buffer) {} +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/IFancyCustomMiddleClickAction.java b/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/IFancyCustomMiddleClickAction.java new file mode 100644 index 0000000000..489f6e091f --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/IFancyCustomMiddleClickAction.java @@ -0,0 +1,11 @@ +package com.gregtechceu.gtceu.api.gui.fancy; + +import net.minecraft.network.FriendlyByteBuf; + +import java.util.function.BiConsumer; +import java.util.function.Consumer; + +public interface IFancyCustomMiddleClickAction extends IFancyCustomClientActionHandler { + + default void onMiddleClick(BiConsumer> writeClientAction) {} +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/IFancyCustomMouseWheelAction.java b/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/IFancyCustomMouseWheelAction.java new file mode 100644 index 0000000000..fb5213912a --- /dev/null +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/fancy/IFancyCustomMouseWheelAction.java @@ -0,0 +1,14 @@ +package com.gregtechceu.gtceu.api.gui.fancy; + +import net.minecraft.network.FriendlyByteBuf; + +import java.util.function.BiConsumer; +import java.util.function.Consumer; + +public interface IFancyCustomMouseWheelAction extends IFancyCustomClientActionHandler { + + default boolean mouseWheelMove(BiConsumer> writeClientAction, double mouseX, + double mouseY, double wheelDelta) { + return false; + } +} diff --git a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/TankWidget.java b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/TankWidget.java index 1797fe3f79..37ac5c6e3d 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/gui/widget/TankWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/api/gui/widget/TankWidget.java @@ -34,6 +34,7 @@ import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; import net.minecraft.sounds.SoundEvent; +import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.tags.TagKey; import net.minecraft.world.entity.player.Player; @@ -584,9 +585,15 @@ private int tryClickContainer(boolean isShiftKeyDown) { if (performedFill) { SoundEvent soundevent = initialFluid.getFluid().getFluidType().getSound(initialFluid, SoundActions.BUCKET_FILL); + 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); + } else { + + player.level().playSound(player, player.position().x, player.position().y + 0.5, + player.position().z, SoundEvents.BUCKET_EMPTY, SoundSource.BLOCKS, 1.0f, 1.0f); + } gui.getModularUIContainer().setCarried(currentStack); return currentStack.getCount(); 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 3d57a0bbab..f761d775da 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 @@ -109,7 +109,7 @@ public void inventoryTick(ItemStack stack, Level level, Entity entity, int slotI transferLimit -= chargedAmount; if (transferLimit == 0L) break; } - } else if (ConfigHolder.INSTANCE.compat.energy.nativeEUToPlatformNative) { + } else if (ConfigHolder.INSTANCE.compat.energy.nativeEUToFE) { var feEnergyItem = GTCapabilityHelper.getForgeEnergyItem(itemInSlot); if (feEnergyItem != null && feEnergyItem.canReceive() && feEnergyItem.getEnergyStored() < feEnergyItem.getMaxEnergyStored()) { @@ -180,11 +180,11 @@ private static void addCurrentChargeTooltip(List tooltip, long curren long maxChargeTime; String unit; - if (durationMax.getSeconds() <= 180) { + if (durationCurrent.getSeconds() <= 60) { maxChargeTime = durationMax.getSeconds(); currentChargeTime = durationCurrent.toSeconds(); unit = LocalizationUtils.format("item.gtceu.battery.charge_unit.second"); - } else if (durationMax.toMinutes() <= 180) { + } else if (durationCurrent.toMinutes() <= 60) { maxChargeTime = durationMax.toMinutes(); currentChargeTime = durationCurrent.toMinutes(); unit = LocalizationUtils.format("item.gtceu.battery.charge_unit.minute"); 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 34db2b9775..9bf1be500e 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/SimpleTieredMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/SimpleTieredMachine.java @@ -126,7 +126,7 @@ public ManagedFieldHolder getFieldHolder() { protected CustomItemStackHandler createChargerItemHandler(Object... args) { var handler = new CustomItemStackHandler(); handler.setFilter(item -> GTCapabilityHelper.getElectricItem(item) != null || - (ConfigHolder.INSTANCE.compat.energy.nativeEUToPlatformNative && + (ConfigHolder.INSTANCE.compat.energy.nativeEUToFE && GTCapabilityHelper.getForgeEnergyItem(item) != null)); return handler; } 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 bca7399d5e..59b75cbc8a 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/TieredEnergyMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/TieredEnergyMachine.java @@ -64,7 +64,8 @@ protected NotifiableEnergyContainer createEnergyContainer(Object... args) { public void onLoad() { super.onLoad(); // if machine need do check explosion conditions - if (!isRemote() && ConfigHolder.INSTANCE.machines.doTerrainExplosion && shouldWeatherOrTerrainExplosion()) { + if (!isRemote() && ConfigHolder.INSTANCE.machines.shouldWeatherOrTerrainExplosion && + shouldWeatherOrTerrainExplosion()) { energyListener = energyContainer.addChangedListener(this::updateExplosionSubscription); updateExplosionSubscription(); } @@ -84,7 +85,7 @@ public void onUnload() { ////////////////////////////////////// protected void updateExplosionSubscription() { - if (ConfigHolder.INSTANCE.machines.doTerrainExplosion && shouldWeatherOrTerrainExplosion() && + if (ConfigHolder.INSTANCE.machines.shouldWeatherOrTerrainExplosion && shouldWeatherOrTerrainExplosion() && energyContainer.getEnergyStored() > 0) { explosionSubs = subscribeServerTick(explosionSubs, this::checkExplosion); } else if (explosionSubs != null) { 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 174c3030be..f7baa12cc0 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 @@ -2,6 +2,8 @@ import com.gregtechceu.gtceu.api.gui.GuiTextures; import com.gregtechceu.gtceu.api.gui.fancy.IFancyConfigurator; +import com.gregtechceu.gtceu.api.gui.fancy.IFancyCustomMiddleClickAction; +import com.gregtechceu.gtceu.api.gui.fancy.IFancyCustomMouseWheelAction; import com.gregtechceu.gtceu.api.gui.widget.SlotWidget; import com.gregtechceu.gtceu.common.item.IntCircuitBehaviour; import com.gregtechceu.gtceu.config.ConfigHolder; @@ -15,6 +17,8 @@ import com.lowdragmc.lowdraglib.gui.widget.Widget; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; +import net.minecraft.data.models.blockstates.PropertyDispatch; +import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.world.item.ItemStack; @@ -24,13 +28,22 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.function.BiConsumer; +import java.util.function.Consumer; /** * @author KilaBash * @date 2023/6/30 * @implNote CircuitFancyConfigurator */ -public class CircuitFancyConfigurator implements IFancyConfigurator { +public class CircuitFancyConfigurator implements IFancyConfigurator, IFancyCustomMouseWheelAction, + IFancyCustomMiddleClickAction { + + private static final int SET_TO_ZERO = 2; + private static final int SET_TO_EMPTY = 3; + private static final int SET_TO_N = 4; + + private static final int NO_CONFIG = -1; final ItemStackHandler circuitSlot; @@ -52,8 +65,40 @@ public IGuiTexture getIcon() { new ItemStackTexture(Items.BARRIER)); } + @Override + public boolean mouseWheelMove(BiConsumer> writeClientAction, double mouseX, + double mouseY, double wheelDelta) { + if (wheelDelta == 0) return false; + int nextValue = getNextValue(wheelDelta > 0); + if (nextValue == NO_CONFIG) { + circuitSlot.setStackInSlot(0, ItemStack.EMPTY); + writeClientAction.accept(SET_TO_EMPTY, buf -> {}); + } else { + circuitSlot.setStackInSlot(0, IntCircuitBehaviour.stack(nextValue)); + writeClientAction.accept(SET_TO_N, buf -> buf.writeVarInt(nextValue)); + } + return true; + } + + @Override + public void handleClientAction(int id, FriendlyByteBuf buffer) { + switch (id) { + case SET_TO_ZERO -> circuitSlot.setStackInSlot(0, IntCircuitBehaviour.stack(0)); + case SET_TO_EMPTY -> circuitSlot.setStackInSlot(0, ItemStack.EMPTY); + case SET_TO_N -> circuitSlot.setStackInSlot(0, IntCircuitBehaviour.stack(buffer.readVarInt())); + } + } + + @Override + public void onMiddleClick(BiConsumer> writeClientAction) { + circuitSlot.setStackInSlot(0, ItemStack.EMPTY); + writeClientAction.accept(SET_TO_EMPTY, buf -> {}); + } + @Override public Widget createConfigurator() { + BiConsumer handleClientActionMethod = this::handleClientAction; + PropertyDispatch.QuadFunction>, Double, Double, Double, Boolean> mouseWheelMoveMethod = this::mouseWheelMove; 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, @@ -116,4 +161,31 @@ public List getTooltips() { .toList()); return list; } + + private int getNextValue(boolean increment) { + int currentValue = IntCircuitBehaviour.getCircuitConfiguration(circuitSlot.getStackInSlot(0)); + if (increment) { + // if at max, loop around to no circuit + if (currentValue == IntCircuitBehaviour.CIRCUIT_MAX) { + return 0; + } + // if at no circuit, skip 0 and return 1 + if (this.circuitSlot.getStackInSlot(0).isEmpty()) { + return 1; + } + // normal case: increment by 1 + return currentValue + 1; + } else { + // if at no circuit, loop around to max + if (this.circuitSlot.getStackInSlot(0).isEmpty()) { + return IntCircuitBehaviour.CIRCUIT_MAX; + } + // if at 1, skip 0 and return no circuit + if (currentValue == 1) { + return -1; + } + // normal case: decrement by 1 + return currentValue - 1; + } + } } 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 3ff3f7d323..a1b45691fa 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 @@ -23,7 +23,7 @@ public interface IDistinctPart extends IMultiPart { @Override default void attachConfigurators(ConfiguratorPanel configuratorPanel) { - IMultiPart.super.attachConfigurators(configuratorPanel); + superAttachConfigurators(configuratorPanel); configuratorPanel.attachConfigurators(new IFancyConfiguratorButton.Toggle( GuiTextures.BUTTON_DISTINCT_BUSES.getSubTexture(0, 0.5, 1, 0.5), GuiTextures.BUTTON_DISTINCT_BUSES.getSubTexture(0, 0, 1, 0.5), @@ -34,4 +34,8 @@ default void attachConfigurators(ConfiguratorPanel configuratorPanel) { .append(Component.translatable(pressed ? "gtceu.multiblock.universal.distinct.yes" : "gtceu.multiblock.universal.distinct.no"))))); } + + default void superAttachConfigurators(ConfiguratorPanel configuratorPanel) { + IMultiPart.super.attachConfigurators(configuratorPanel); + } } 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 6040893924..3ccf38e7c8 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 @@ -197,7 +197,7 @@ public boolean dischargeOrRechargeEnergyContainers(IItemHandlerModifiable itemHa } return true; } - } else if (ConfigHolder.INSTANCE.compat.energy.nativeEUToPlatformNative) { + } else if (ConfigHolder.INSTANCE.compat.energy.nativeEUToFE) { IEnergyStorage energyStorage = GTCapabilityHelper.getForgeEnergyItem(stackInSlot); if (energyStorage != null && handleForgeEnergyItem(energyStorage, simulate)) { if (!simulate) { 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 b806fd43ac..f266f003c8 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 @@ -1,5 +1,6 @@ package com.gregtechceu.gtceu.api.recipe.content; +import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.capability.recipe.RecipeCapability; import com.gregtechceu.gtceu.api.recipe.chance.logic.ChanceLogic; import com.gregtechceu.gtceu.api.recipe.ingredient.FluidIngredient; @@ -153,7 +154,10 @@ 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); - float chance = 100 * (float) Math.min((this.chance + (this.tierChanceBoost * tier)), maxChance) / maxChance; + float chance = 100 * + (float) Math.min((this.chance + (this.tierChanceBoost * (tier >= GTValues.LV ? tier - 1 : tier))), + maxChance) / + maxChance; String percent = FormattingUtil.formatPercent(chance); String s = chance == 0 ? LocalizationUtils.format("gtceu.gui.content.chance_0_short") : diff --git a/src/main/java/com/gregtechceu/gtceu/common/CommonProxy.java b/src/main/java/com/gregtechceu/gtceu/common/CommonProxy.java index c7f09428d9..d45f3f0515 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/CommonProxy.java +++ b/src/main/java/com/gregtechceu/gtceu/common/CommonProxy.java @@ -93,7 +93,7 @@ public CommonProxy() { GTCEuAPI.initializeHighTier(); if (Platform.isDevEnv()) { ConfigHolder.INSTANCE.recipes.generateLowQualityGems = true; - ConfigHolder.INSTANCE.compat.energy.enablePlatformConverters = true; + ConfigHolder.INSTANCE.compat.energy.enableFEConverters = true; } GTValueProviderTypes.init(eventBus); 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 48fd29709b..9a0be75eaf 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/block/SurfaceRockBlock.java +++ b/src/main/java/com/gregtechceu/gtceu/common/block/SurfaceRockBlock.java @@ -28,6 +28,7 @@ import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.DirectionProperty; +import net.minecraft.world.level.material.FluidState; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; @@ -66,6 +67,19 @@ public SurfaceRockBlock(Properties properties, Material material) { } } + @Override + public boolean onDestroyedByPlayer(BlockState state, Level level, BlockPos pos, Player player, boolean willHarvest, + FluidState fluid) { + if (!level.isClientSide) { + ServerCache.instance.prospectSurfaceRockMaterial( + level.dimension(), + this.material, + pos, + (ServerPlayer) player); + } + return super.onDestroyedByPlayer(state, level, pos, player, willHarvest, fluid); + } + @Override @SuppressWarnings("deprecation") public InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, 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 371a51e7ee..bc8a736453 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTMachines.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTMachines.java @@ -452,7 +452,7 @@ public class GTMachines { .tieredHullRenderer(GTCEu.id("block/machine/fisher_machine")) .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.speed", FisherMachine.calcMaxProgress(tier)), Component.translatable("gtceu.machine.fisher.requirement", FisherMachine.WATER_CHECK_SIZE, FisherMachine.WATER_CHECK_SIZE), Component.translatable("gtceu.universal.tooltip.voltage_in", @@ -462,7 +462,7 @@ public class GTMachines { FormattingUtil.formatNumbers(GTValues.V[tier] * 64))) .compassNode("fisher") .register(), - LV, MV, HV, EV); + LV, MV, HV, EV, IV, LuV); public static final MachineDefinition[] BLOCK_BREAKER = registerTieredMachines("block_breaker", BlockBreakerMachine::new, @@ -1972,7 +1972,7 @@ public static BiConsumer> createTankTooltips(String n .where('F', frames(LargeMinerMachine.getMaterial(tier))) .where('#', any()) .build()) - .allowExtendedFacing(false) + .allowExtendedFacing(true) .renderer(() -> new LargeMinerRenderer( MinerRenderer.MATERIALS_TO_CASING_MODELS.get(LargeMinerMachine.getMaterial(tier)), GTCEu.id("block/multiblock/large_miner"))) @@ -2719,7 +2719,7 @@ public static MachineDefinition registerDrum(Material material, int capacity, St } public static MachineDefinition[] registerConverter(int amperage) { - if (!ConfigHolder.INSTANCE.compat.energy.enablePlatformConverters) { + if (!ConfigHolder.INSTANCE.compat.energy.enableFEConverters) { REGISTRATE.creativeModeTab(() -> null); } @@ -2743,7 +2743,7 @@ public static MachineDefinition[] registerConverter(int amperage) { .register(), ALL_TIERS); - if (!ConfigHolder.INSTANCE.compat.energy.enablePlatformConverters) { + if (!ConfigHolder.INSTANCE.compat.energy.enableFEConverters) { REGISTRATE.creativeModeTab(() -> MACHINE); } @@ -2751,7 +2751,7 @@ public static MachineDefinition[] registerConverter(int amperage) { } public static Component explosion() { - if (ConfigHolder.INSTANCE.machines.doTerrainExplosion) + if (ConfigHolder.INSTANCE.machines.shouldWeatherOrTerrainExplosion) return Component.translatable("gtceu.universal.tooltip.terrain_resist"); return null; } 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 2b039604c9..81a0033b9e 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 @@ -91,7 +91,7 @@ public int getSlotLimit(int slot) { } }; handler.setFilter(item -> GTCapabilityHelper.getElectricItem(item) != null || - (ConfigHolder.INSTANCE.compat.energy.nativeEUToPlatformNative && + (ConfigHolder.INSTANCE.compat.energy.nativeEUToFE && GTCapabilityHelper.getForgeEnergyItem(item) != null)); return handler; } @@ -157,7 +157,7 @@ private List getNonFullBatteries() { if (electricItem.getCharge() < electricItem.getMaxCharge()) { batteries.add(electricItem); } - } else if (ConfigHolder.INSTANCE.compat.energy.nativeEUToPlatformNative) { + } else if (ConfigHolder.INSTANCE.compat.energy.nativeEUToFE) { IEnergyStorage energyStorage = GTCapabilityHelper.getForgeEnergyItem(batteryStack); if (energyStorage != null) { if (energyStorage.getEnergyStored() < energyStorage.getMaxEnergyStored()) { @@ -190,7 +190,7 @@ private List getAllBatteries() { var electricItem = GTCapabilityHelper.getElectricItem(batteryStack); if (electricItem != null) { batteries.add(electricItem); - } else if (ConfigHolder.INSTANCE.compat.energy.nativeEUToPlatformNative) { + } else if (ConfigHolder.INSTANCE.compat.energy.nativeEUToFE) { IEnergyStorage energyStorage = GTCapabilityHelper.getForgeEnergyItem(batteryStack); if (energyStorage != null) { batteries.add(energyStorage); 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 e9dfd6aaf5..5e732b33e5 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 @@ -136,7 +136,7 @@ public ManagedFieldHolder getFieldHolder() { protected CustomItemStackHandler createChargerItemHandler() { var handler = new CustomItemStackHandler(); handler.setFilter(item -> GTCapabilityHelper.getElectricItem(item) != null || - (ConfigHolder.INSTANCE.compat.energy.nativeEUToPlatformNative && + (ConfigHolder.INSTANCE.compat.energy.nativeEUToFE && GTCapabilityHelper.getForgeEnergyItem(item) != null)); return handler; } 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 1464cb24e7..d8a52218e2 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 @@ -95,7 +95,7 @@ protected NotifiableEnergyContainer createEnergyContainer(Object... args) { protected CustomItemStackHandler createChargerInventory(Object... args) { var handler = new CustomItemStackHandler(this.inventorySize); handler.setFilter(item -> GTCapabilityHelper.getElectricItem(item) != null || - (ConfigHolder.INSTANCE.compat.energy.nativeEUToPlatformNative && + (ConfigHolder.INSTANCE.compat.energy.nativeEUToFE && GTCapabilityHelper.getForgeEnergyItem(item) != null)); return handler; } @@ -166,7 +166,7 @@ private List getNonFullElectricItem() { if (electricItem.getCharge() < electricItem.getMaxCharge()) { electricItems.add(electricItem); } - } else if (ConfigHolder.INSTANCE.compat.energy.nativeEUToPlatformNative) { + } else if (ConfigHolder.INSTANCE.compat.energy.nativeEUToFE) { var energyStorage = GTCapabilityHelper.getForgeEnergyItem(electricItemStack); if (energyStorage != null) { if (energyStorage.getEnergyStored() < energyStorage.getMaxEnergyStored()) { @@ -263,7 +263,7 @@ public long getEnergyCapacity() { var electricItem = GTCapabilityHelper.getElectricItem(electricItemStack); if (electricItem != null) { energyCapacity += electricItem.getMaxCharge(); - } else if (ConfigHolder.INSTANCE.compat.energy.nativeEUToPlatformNative) { + } else if (ConfigHolder.INSTANCE.compat.energy.nativeEUToFE) { var energyStorage = GTCapabilityHelper.getForgeEnergyItem(electricItemStack); if (energyStorage != null) { energyCapacity += FeCompat.toEu(energyStorage.getMaxEnergyStored(), @@ -287,7 +287,7 @@ public long getEnergyStored() { var electricItem = GTCapabilityHelper.getElectricItem(electricItemStack); if (electricItem != null) { energyStored += electricItem.getCharge(); - } else if (ConfigHolder.INSTANCE.compat.energy.nativeEUToPlatformNative) { + } else if (ConfigHolder.INSTANCE.compat.energy.nativeEUToFE) { var energyStorage = GTCapabilityHelper.getForgeEnergyItem(electricItemStack); if (energyStorage != null) { energyStored += FeCompat.toEu(energyStorage.getEnergyStored(), 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 769648b479..3dbd0a8248 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 @@ -9,6 +9,7 @@ import com.gregtechceu.gtceu.api.gui.editor.EditableMachineUI; import com.gregtechceu.gtceu.api.gui.editor.EditableUI; import com.gregtechceu.gtceu.api.gui.widget.SlotWidget; +import com.gregtechceu.gtceu.api.gui.widget.ToggleButtonWidget; import com.gregtechceu.gtceu.api.item.tool.GTToolType; import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; import com.gregtechceu.gtceu.api.machine.TickableSubscription; @@ -22,6 +23,7 @@ import com.gregtechceu.gtceu.data.lang.LangHandler; import com.gregtechceu.gtceu.utils.GTTransferUtils; +import com.lowdragmc.lowdraglib.gui.texture.ItemStackTexture; import com.lowdragmc.lowdraglib.gui.texture.ResourceTexture; import com.lowdragmc.lowdraglib.gui.widget.WidgetGroup; import com.lowdragmc.lowdraglib.syncdata.ISubscription; @@ -130,10 +132,14 @@ public class FisherMachine extends TieredEnergyMachine private static final ItemStack fishingRod = new ItemStack(Items.FISHING_ROD); private boolean hasWater = false; + @Getter + @Setter + protected boolean junkEnabled = true; + public FisherMachine(IMachineBlockEntity holder, int tier, Object... ignoredArgs) { super(holder, tier); this.inventorySize = (tier + 1) * (tier + 1); - this.maxProgress = 1000 - tier * 200; + this.maxProgress = calcMaxProgress(tier); this.energyPerTick = GTValues.V[tier - 1]; this.cache = createCacheItemHandler(); this.baitHandler = createBaitItemHandler(); @@ -148,7 +154,7 @@ public FisherMachine(IMachineBlockEntity holder, int tier, Object... ignoredArgs protected CustomItemStackHandler createChargerItemHandler() { var handler = new CustomItemStackHandler(); handler.setFilter(item -> GTCapabilityHelper.getElectricItem(item) != null || - (ConfigHolder.INSTANCE.compat.energy.nativeEUToPlatformNative && + (ConfigHolder.INSTANCE.compat.energy.nativeEUToFE && GTCapabilityHelper.getForgeEnergyItem(item) != null)); return handler; } @@ -215,6 +221,10 @@ public void onMachineRemoved() { clearInventory(cache.storage); } + public static int calcMaxProgress(int tier) { + return (int) (800.0 - 170 * ((double) tier - 1.0) + (((double) Math.max(0, tier - 4) / 0.012))); + } + ////////////////////////////////////// // ********* Logic **********// ////////////////////////////////////// @@ -252,8 +262,10 @@ public void fishingUpdate() { drainEnergy(false); if (progress >= maxProgress) { - LootTable lootTable = getLevel().getServer().getLootData().getLootTable(BuiltInLootTables.FISHING); + if (!this.junkEnabled) { + lootTable = getLevel().getServer().getLootData().getLootTable(BuiltInLootTables.FISHING_FISH); + } FishingHook simulatedHook = new FishingHook(EntityType.FISHING_BOBBER, getLevel()) { @@ -276,8 +288,10 @@ public boolean isOpenWaterFishing() { for (ItemStack itemStack : generatedLoot) useBait |= tryFillCache(itemStack); - if (useBait) + if (useBait && junkEnabled) this.baitHandler.storage.extractItem(0, 1, false); + else if (useBait) + this.baitHandler.storage.extractItem(0, 2, false); updateFishingUpdateSubscription(); progress = -1; } @@ -398,6 +412,7 @@ public void onNeighborChanged(Block block, BlockPos fromPos, boolean isMoving) { createTemplate(inventorySize).setupUI(template, fisherMachine); createEnergyBar().setupUI(template, fisherMachine); createBatterySlot().setupUI(template, fisherMachine); + createJunkButton().setupUI(template, fisherMachine); } })); @@ -415,6 +430,20 @@ protected static EditableUI createBatterySlot() { }); } + protected static EditableUI createJunkButton() { + return new EditableUI<>("junk_button", ToggleButtonWidget.class, () -> { + var toggleButtonWidget = new ToggleButtonWidget(10, 20, 18, 18, + new ItemStackTexture(Items.NAME_TAG).scale(0.9F), () -> false, b -> {}); + toggleButtonWidget.setShouldUseBaseBackground(); + return toggleButtonWidget; + }, (toggleButtonWidget, machine) -> { + toggleButtonWidget.setSupplier(machine::isJunkEnabled); + toggleButtonWidget.setOnPressCallback((data, bool) -> machine.setJunkEnabled(bool)); + toggleButtonWidget.setHoverTooltips(LangHandler.getMultiLang("gtceu.gui.fisher_mode.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); @@ -439,6 +468,10 @@ protected static EditableUI createTemplate(int inven baitSlotWidget.setBackground(GuiTextures.SLOT, GuiTextures.STRING_SLOT_OVERLAY); baitSlotWidget.setId("bait_slot"); main.addWidget(baitSlotWidget); + var junkButton = createJunkButton().createDefault(); + junkButton.setSelfPosition(new Position(4, (main.getSize().height - junkButton.getSize().height) - 4)); + junkButton.setId("junk_button"); + main.addWidget(junkButton); main.setBackground(GuiTextures.BACKGROUND_INVERSE); return main; }, (group, machine) -> { 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 a6a795d447..ba1d1b7dc8 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 @@ -152,7 +152,7 @@ public ItemCollectorMachine(IMachineBlockEntity holder, int tier, Object... igno protected CustomItemStackHandler createChargerItemHandler() { var handler = new CustomItemStackHandler(); handler.setFilter(item -> GTCapabilityHelper.getElectricItem(item) != null || - (ConfigHolder.INSTANCE.compat.energy.nativeEUToPlatformNative && + (ConfigHolder.INSTANCE.compat.energy.nativeEUToFE && GTCapabilityHelper.getForgeEnergyItem(item) != null)); return handler; } 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 ef8e9ddc05..14b7c21f21 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 @@ -99,7 +99,7 @@ public ManagedFieldHolder getFieldHolder() { protected CustomItemStackHandler createChargerItemHandler(Object... args) { var handler = new CustomItemStackHandler(); handler.setFilter(item -> GTCapabilityHelper.getElectricItem(item) != null || - (ConfigHolder.INSTANCE.compat.energy.nativeEUToPlatformNative && + (ConfigHolder.INSTANCE.compat.energy.nativeEUToFE && GTCapabilityHelper.getForgeEnergyItem(item) != null)); return handler; } 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 91b252b827..3f16efe5f8 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 @@ -121,9 +121,17 @@ public long getMaxVoltage() { @Override public void onStructureFormed() { super.onStructureFormed(); + Direction opposite = this.getUpwardsFacing().getOpposite(); + getRecipeLogic().setDir(opposite == Direction.NORTH ? Direction.UP : Direction.DOWN); initializeAbilities(); } + @Override + public boolean checkPattern() { + return super.checkPattern() && + (this.getUpwardsFacing() == Direction.NORTH || this.getUpwardsFacing() == Direction.SOUTH); + } + private void initializeAbilities() { List energyContainers = new ArrayList<>(); List fluidTanks = new ArrayList<>(); diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/DualHatchPartMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/DualHatchPartMachine.java index 22d4397441..3219e93ade 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/DualHatchPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/part/DualHatchPartMachine.java @@ -159,7 +159,7 @@ public Widget createUIWidget() { @Override public boolean isDistinct() { - return super.isDistinct() && tank.isDistinct(); + return io != IO.OUT && super.isDistinct() && tank.isDistinct(); } @Override 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 fc668b1721..f681a3b9c8 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 @@ -82,7 +82,7 @@ public boolean shouldOpenUI(Player player, InteractionHand hand, BlockHitResult public void onLoad() { super.onLoad(); // if machine need do check explosion conditions - if (ConfigHolder.INSTANCE.machines.doTerrainExplosion && shouldWeatherOrTerrainExplosion()) { + if (ConfigHolder.INSTANCE.machines.shouldWeatherOrTerrainExplosion && shouldWeatherOrTerrainExplosion()) { energyListener = energyContainer.addChangedListener(this::updateExplosionSubscription); updateExplosionSubscription(); } @@ -102,7 +102,7 @@ public void onUnload() { ////////////////////////////////////// protected void updateExplosionSubscription() { - if (ConfigHolder.INSTANCE.machines.doTerrainExplosion && shouldWeatherOrTerrainExplosion() && + if (ConfigHolder.INSTANCE.machines.shouldWeatherOrTerrainExplosion && shouldWeatherOrTerrainExplosion() && energyContainer.getEnergyStored() > 0) { explosionSubs = subscribeServerTick(explosionSubs, this::checkExplosion); } else if (explosionSubs != null) { 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 817047e35d..de3eca82e5 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 @@ -133,7 +133,7 @@ public void onUnload() { @Override public boolean isDistinct() { - return getInventory().isDistinct() && circuitInventory.isDistinct(); + return io != IO.OUT && getInventory().isDistinct() && circuitInventory.isDistinct(); } @Override @@ -193,8 +193,10 @@ public void setWorkingEnabled(boolean workingEnabled) { ////////////////////////////////////// public void attachConfigurators(ConfiguratorPanel configuratorPanel) { - IDistinctPart.super.attachConfigurators(configuratorPanel); - if (this.io == IO.IN) { + if (this.io == IO.OUT) { + IDistinctPart.super.superAttachConfigurators(configuratorPanel); + } else if (this.io == IO.IN) { + IDistinctPart.super.attachConfigurators(configuratorPanel); configuratorPanel.attachConfigurators(new CircuitFancyConfigurator(circuitInventory.storage)); } } 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 cd645a87eb..b4638b6e80 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 @@ -8,6 +8,7 @@ import com.lowdragmc.lowdraglib.syncdata.field.ManagedFieldHolder; import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; import net.minecraft.core.NonNullList; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.item.ItemStack; @@ -69,20 +70,33 @@ public void initPos(@NotNull BlockPos pos, int currentRadius) { if (!isChunkMode) { super.initPos(pos, currentRadius); } else { + Direction dir = super.getDir(); 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(); x = startPos.getMinBlockX(); - y = pos.getY() - 1; + if (dir == Direction.UP) { + y = pos.getY() + 1; + } else { + y = pos.getY() - 1; + } z = startPos.getMinBlockZ(); startX = startPos.getMinBlockX(); startY = pos.getY(); startZ = startPos.getMinBlockZ(); mineX = startPos.getMinBlockX(); - mineY = pos.getY() - 1; + if (dir == Direction.UP) { + mineY = pos.getY() + 1; + } else { + mineY = pos.getY() - 1; + } mineZ = startPos.getMinBlockZ(); - pipeY = pos.getY() - 1; + if (dir == Direction.UP) { + pipeY = pos.getY() + 1; + } else { + pipeY = pos.getY() - 1; + } } } 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 8194893219..8a3589df12 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 @@ -103,6 +103,8 @@ public class MinerLogic extends RecipeLogic implements IRecipeCapabilityHolder { @Getter private int minBuildHeight = Integer.MAX_VALUE; @Getter + private int maxBuildHeight = Integer.MAX_VALUE; + @Getter @Persisted private int pipeLength = 0; @Getter @@ -118,6 +120,9 @@ public class MinerLogic extends RecipeLogic implements IRecipeCapabilityHolder { private final Table, List>> capabilitiesProxy; private final ItemRecipeHandler inputItemHandler, outputItemHandler; private final IgnoreEnergyRecipeHandler inputEnergyHandler; + @Setter + @Getter + private Direction dir = Direction.DOWN; /** * Creates the general logic for all in-world ore block miners @@ -201,10 +206,14 @@ public void serverTick() { } // drill a hole beneath the miner and extend the pipe downwards by one - if (mineY < pipeY) { + if ((dir == Direction.DOWN && mineY < pipeY) || (dir == Direction.UP && mineY > pipeY)) { BlockPos miningPos = getMiningPos(); serverLevel.destroyBlock(new BlockPos(miningPos.getX(), pipeY, miningPos.getZ()), false); - --pipeY; + if (dir == Direction.UP) { + ++pipeY; + } else { + --pipeY; + } incrementPipeLength(); } @@ -428,14 +437,26 @@ private void mineAndInsertItems(NonNullList blockDrops, ServerLevel w public void initPos(@NotNull BlockPos pos, int currentRadius) { x = pos.getX() - currentRadius; z = pos.getZ() - currentRadius; - y = pos.getY() - 1; + if (dir == Direction.UP) { + y = pos.getY() + 1; + } else { + y = pos.getY() - 1; + } startX = pos.getX() - currentRadius; startZ = pos.getZ() - currentRadius; startY = pos.getY(); - pipeY = pos.getY() - 1; + if (dir == Direction.UP) { + pipeY = pos.getY() + 1; + } else { + pipeY = pos.getY() - 1; + } mineX = pos.getX() - currentRadius; mineZ = pos.getZ() - currentRadius; - mineY = pos.getY() - 1; + if (dir == Direction.UP) { + mineY = pos.getY() + 1; + } else { + mineY = pos.getY() - 1; + } onRemove(); } @@ -485,10 +506,13 @@ private LinkedList getBlocksToMine() { if (this.minBuildHeight == Integer.MAX_VALUE) this.minBuildHeight = this.getMachine().getLevel().getMinBuildHeight(); + if (this.maxBuildHeight == Integer.MAX_VALUE) + this.maxBuildHeight = this.getMachine().getLevel().getMaxBuildHeight(); + // keep getting blocks until the target amount is reached while (calculated < calcAmount) { // moving down the y-axis - if (y > minBuildHeight) { + if (y > minBuildHeight && y < maxBuildHeight) { // moving across the z-axis if (z <= startZ + currentRadius * 2) { // check every block along the x-axis @@ -510,7 +534,11 @@ private LinkedList getBlocksToMine() { } else { // reset z and move to the next y layer z = startZ; - --y; + if (dir == Direction.UP) { + ++y; + } else { + --y; + } } } else return blocks; @@ -560,7 +588,7 @@ private static double getQuotient(double base) { private void incrementPipeLength() { this.pipeLength++; if (getMachine().getLevel() instanceof ServerLevel serverLevel) { - var pos = getMiningPos().relative(Direction.DOWN, this.pipeLength); + var pos = getMiningPos().relative(dir, this.pipeLength); serverLevel.setBlockAndUpdate(pos, GTBlocks.MINER_PIPE.getDefaultState()); } } @@ -575,10 +603,10 @@ public BlockPos getMiningPos() { public void onRemove() { pipeLength = 0; if (getMachine().getLevel() instanceof ServerLevel serverLevel) { - var pos = getMiningPos().relative(Direction.DOWN); + var pos = getMiningPos().relative(dir); while (serverLevel.getBlockState(pos).is(GTBlocks.MINER_PIPE.get())) { serverLevel.removeBlock(pos, false); - pos = pos.relative(Direction.DOWN); + pos = pos.relative(dir); } } } diff --git a/src/main/java/com/gregtechceu/gtceu/config/ConfigHolder.java b/src/main/java/com/gregtechceu/gtceu/config/ConfigHolder.java index 3becb86590..1c28705895 100644 --- a/src/main/java/com/gregtechceu/gtceu/config/ConfigHolder.java +++ b/src/main/java/com/gregtechceu/gtceu/config/ConfigHolder.java @@ -151,11 +151,11 @@ public static class CompatibilityConfigs { @Configurable @Configurable.Comment({ "Whether to hide facades of all blocks in JEI and creative search menu.", "Default: true" }) - public boolean hideFacadesInJEI = true; + public boolean hideFacadesInRecipeViewer = true; @Configurable @Configurable.Comment({ "Whether to hide filled cells in JEI and creative search menu.", "Default: true" }) - public boolean hideFilledCellsInJEI = true; + public boolean hideFilledCellsInRecipeViewer = true; @Configurable @Configurable.Comment({ "Whether to hide the ore processing diagrams in JEI", "Default: false" }) @@ -168,32 +168,31 @@ public static class CompatibilityConfigs { public boolean removeSmeltingForEBFMetals = true; @Configurable - @Configurable.Comment({ "Whether dimension marker should show dimension tier.", "Default: false" }) + @Configurable.Comment({ "Whether dimension markers should show the dimension tier value.", "Default: false" }) public boolean showDimensionTier = false; public static class EnergyCompatConfig { @Configurable - @Configurable.Comment({ - "Enable Native GTEU to Platform native Energy (RF and alike) on GT Cables and Wires.", + @Configurable.Comment({ "Enable Native GTEU to Forge Energy (RF and alike) on GT Cables and Wires.", "This does not enable nor disable Converters.", "Default: true" }) - public boolean nativeEUToPlatformNative = true; + public boolean nativeEUToFE = true; @Configurable - @Configurable.Comment({ "Enable GTEU to Platform native (and vice versa) Converters.", "Default: false" }) - public boolean enablePlatformConverters = false; + @Configurable.Comment({ "Enable GTEU to FE (and vice versa) Converters.", "Default: false" }) + public boolean enableFEConverters = 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({ "Forge Energy to GTEU ratio for converting FE to EU.", "Only affects converters.", + "Default: 4 FE == 1 EU" }) @Configurable.Range(min = 1, max = 16) - public int platformToEuRatio = 4; + public int feToEuRatio = 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 Forge Energy ratio for converting EU to FE.", + "Affects native conversion and Converters.", "Default: 4 FE == 1 EU" }) @Configurable.Range(min = 1, max = 16) - public int euToPlatformRatio = 4; + public int euToFeRatio = 4; } public static class AE2CompatConfig { @@ -405,7 +404,7 @@ public static class MachineConfigs { @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; + public boolean shouldWeatherOrTerrainExplosion = false; @Configurable @Configurable.Comment({ "Energy use multiplier for electric items.", "Default: 100" }) public int energyUsageMultiplier = 100; 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 af49d3424f..777ccce15c 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/lang/LangHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/data/lang/LangHandler.java @@ -186,7 +186,8 @@ public static void init(RegistrateLangProvider provider) { replace(provider, "item.gtceu.tool.hammer", "%s Hammer"); provider.add("item.gtceu.tool.hammer.tooltip", "§8Crushes Blocks when harvesting them"); replace(provider, "item.gtceu.tool.mallet", "%s Soft Mallet"); - provider.add("item.gtceu.tool.mallet.tooltip", "§8Stops/Starts Machinery"); + multilineLang(provider, "item.gtceu.tool.mallet.tooltip", + "§8Sneak to Pause Machine After Current Recipe.\n§8Stops/Starts Machines"); replace(provider, "item.gtceu.tool.wrench", "%s Wrench"); provider.add("item.gtceu.tool.wrench.tooltip", "§8Hold left click to dismantle Machines"); replace(provider, "item.gtceu.tool.file", "%s File"); @@ -1016,6 +1017,8 @@ public static void init(RegistrateLangProvider provider) { 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"); + multilineLang(provider, "gtceu.gui.fisher_mode.tooltip", + "Toggle junk items\nOff costs 2 string per operation"); provider.add("ore.spawnlocation.name", "Ore Spawn Information"); multiLang(provider, "gtceu.jei.ore.surface_rock", "Surface Rocks with this material denote vein spawn locations.", 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 b146a969ba..9ce65b0371 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 @@ -244,6 +244,7 @@ private static void processEBFRecipe(Material material, BlastProperty property, public static void processSmallDust(TagPrefix orePrefix, Material material, DustProperty property, Consumer provider) { + // small dust retains magnetism ItemStack smallDustStack = ChemicalHelper.get(orePrefix, material); ItemStack dustStack = ChemicalHelper.get(dust, material); @@ -268,6 +269,7 @@ public static void processSmallDust(TagPrefix orePrefix, Material material, Dust public static void processTinyDust(TagPrefix orePrefix, Material material, DustProperty property, Consumer provider) { + // tiny dust retains magnetism ItemStack tinyDustStack = ChemicalHelper.get(orePrefix, material); ItemStack dustStack = ChemicalHelper.get(dust, material); @@ -297,16 +299,19 @@ public static void processIngot(TagPrefix ingotPrefix, Material material, IngotP ChemicalHelper.get(dust, material), "X", "m", 'X', new UnificationEntry(ingotPrefix, material)); } + var magMaterial = material.hasFlag(IS_MAGNETIC) ? + material.getProperty(PropertyKey.INGOT).getMacerateInto() : material; + if (material.hasFlag(GENERATE_ROD)) { VanillaRecipeHelper.addShapedRecipe(provider, String.format("stick_%s", material.getName()), - ChemicalHelper.get(rod, material), + ChemicalHelper.get(rod, magMaterial), "f ", " X", 'X', new UnificationEntry(ingotPrefix, material)); if (!material.hasFlag(NO_WORKING)) { EXTRUDER_RECIPES.recipeBuilder("extrude_" + material.getName() + "_to_rod") .inputItems(ingotPrefix, material) .notConsumable(GTItems.SHAPE_EXTRUDER_ROD) - .outputItems(rod, material, 2) + .outputItems(rod, magMaterial, 2) .duration((int) material.getMass() * 2) .EUt(6L * getVoltageMultiplier(material)) .save(provider); @@ -326,7 +331,7 @@ public static void processIngot(TagPrefix ingotPrefix, Material material, IngotP EXTRUDER_RECIPES.recipeBuilder("extrude_" + material.getName() + "_to_ingot") .inputItems(dust, material) .notConsumable(GTItems.SHAPE_EXTRUDER_INGOT) - .outputItems(ingot, material) + .outputItems(ingot, magMaterial) .duration(10) .EUt(4L * getVoltageMultiplier(material)) .save(provider); @@ -336,7 +341,7 @@ public static void processIngot(TagPrefix ingotPrefix, Material material, IngotP .EUt(VA[ULV]).duration((int) material.getMass()) .inputItems(ingot, material) .notConsumable(GTItems.SHAPE_MOLD_NUGGET) - .outputItems(nugget, material, 9) + .outputItems(nugget, magMaterial, 9) .category(GTRecipeCategories.INGOT_MOLDING) .save(provider); @@ -345,21 +350,22 @@ public static void processIngot(TagPrefix ingotPrefix, Material material, IngotP .EUt(VA[ULV]).duration((int) material.getMass() * (int) (block.getMaterialAmount(material) / M)) .inputItems(block, material) .notConsumable(GTItems.SHAPE_MOLD_INGOT) - .outputItems(ingot, material, (int) (block.getMaterialAmount(material) / M)) + .outputItems(ingot, magMaterial, (int) (block.getMaterialAmount(material) / M)) .category(GTRecipeCategories.INGOT_MOLDING) .save(provider); COMPRESSOR_RECIPES.recipeBuilder("compress_" + material.getName() + "_to_block") .EUt(2).duration(300) .inputItems(ingot, material, (int) (block.getMaterialAmount(material) / M)) - .outputItems(block, material) + .outputItems(block, magMaterial) .save(provider); } if (material.hasFlag(GENERATE_PLATE) && !material.hasFlag(NO_WORKING)) { if (!material.hasFlag(NO_SMASHING)) { - ItemStack plateStack = ChemicalHelper.get(plate, material); + ItemStack plateStack = ChemicalHelper.get(plate, material.hasFlag(IS_MAGNETIC) ? + material.getProperty(PropertyKey.INGOT).getMacerateInto() : material); if (!plateStack.isEmpty()) { BENDER_RECIPES.recipeBuilder("bend_" + material.getName() + "_to_plate") .circuitMeta(1) @@ -384,7 +390,7 @@ public static void processIngot(TagPrefix ingotPrefix, Material material, IngotP EXTRUDER_RECIPES.recipeBuilder("extrude_" + material.getName() + "_to_plate") .inputItems(ingotPrefix, material) .notConsumable(GTItems.SHAPE_EXTRUDER_PLATE) - .outputItems(plate, material) + .outputItems(plate, magMaterial) .duration((int) material.getMass()) .EUt(8L * voltageMultiplier) .save(provider); @@ -393,7 +399,7 @@ public static void processIngot(TagPrefix ingotPrefix, Material material, IngotP EXTRUDER_RECIPES.recipeBuilder("extrude_" + material.getName() + "_dust_to_plate") .inputItems(dust, material) .notConsumable(GTItems.SHAPE_EXTRUDER_PLATE) - .outputItems(plate, material) + .outputItems(plate, magMaterial) .duration((int) material.getMass()) .EUt(8L * voltageMultiplier) .save(provider); @@ -450,7 +456,8 @@ public static void processNugget(TagPrefix orePrefix, Material material, DustPro Consumer provider) { ItemStack nuggetStack = ChemicalHelper.get(orePrefix, material); if (material.hasProperty(PropertyKey.INGOT)) { - ItemStack ingotStack = ChemicalHelper.get(ingot, material); + ItemStack ingotStack = ChemicalHelper.get(ingot, material.hasFlag(IS_MAGNETIC) ? + material.getProperty(PropertyKey.INGOT).getMacerateInto() : material); if (!ConfigHolder.INSTANCE.recipes.disableManualCompression) { if (!ingot.isIgnored(material)) { @@ -467,14 +474,14 @@ public static void processNugget(TagPrefix orePrefix, Material material, DustPro COMPRESSOR_RECIPES.recipeBuilder("compress_" + material.getName() + "_nugget_to_ingot") .inputItems(nugget, material, 9) - .outputItems(ingot, material) + .outputItems(ingotStack) .EUt(2).duration(300).save(provider); ALLOY_SMELTER_RECIPES.recipeBuilder("alloy_smelt_" + material.getName() + "_nugget_to_ingot") .EUt(VA[ULV]).duration((int) material.getMass()) .inputItems(nugget, material, 9) .notConsumable(GTItems.SHAPE_MOLD_INGOT) - .outputItems(ingot, material) + .outputItems(ingotStack) .category(GTRecipeCategories.INGOT_MOLDING) .save(provider); @@ -525,7 +532,8 @@ public static void processFrame(TagPrefix framePrefix, Material material, DustPr public static void processBlock(TagPrefix blockPrefix, Material material, DustProperty property, Consumer provider) { - ItemStack blockStack = ChemicalHelper.get(blockPrefix, material); + ItemStack blockStack = ChemicalHelper.get(blockPrefix, material.hasFlag(IS_MAGNETIC) ? + material.getProperty(PropertyKey.INGOT).getMacerateInto() : material); long materialAmount = blockPrefix.getMaterialAmount(material); if (material.hasFluid()) { FLUID_SOLIDFICATION_RECIPES.recipeBuilder("solidify_" + material.getName() + "_block") @@ -537,7 +545,8 @@ public static void processBlock(TagPrefix blockPrefix, Material material, DustPr } if (material.hasFlag(GENERATE_PLATE)) { - ItemStack plateStack = ChemicalHelper.get(plate, material); + ItemStack plateStack = ChemicalHelper.get(plate, material.hasFlag(IS_MAGNETIC) ? + material.getProperty(PropertyKey.INGOT).getMacerateInto() : material); if (!plateStack.isEmpty()) { CUTTER_RECIPES.recipeBuilder("cut_" + material.getName() + "_block_to_plate") .inputItems(blockPrefix, material) 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 1e5b971327..6594ea680f 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 @@ -53,7 +53,8 @@ public static void init(Consumer provider) { public static void processBolt(TagPrefix boltPrefix, Material material, DustProperty property, Consumer provider) { - ItemStack boltStack = ChemicalHelper.get(boltPrefix, material); + ItemStack boltStack = ChemicalHelper.get(boltPrefix, material.hasFlag(IS_MAGNETIC) ? + material.getProperty(PropertyKey.INGOT).getMacerateInto() : material); ItemStack ingotStack = ChemicalHelper.get(ingot, material); CUTTER_RECIPES.recipeBuilder("cut_" + material.getName() + "_screw_to_bolt") @@ -86,7 +87,8 @@ public static void processBolt(TagPrefix boltPrefix, Material material, DustProp public static void processScrew(TagPrefix screwPrefix, Material material, DustProperty property, Consumer provider) { - ItemStack screwStack = ChemicalHelper.get(screwPrefix, material); + ItemStack screwStack = ChemicalHelper.get(screwPrefix, material.hasFlag(IS_MAGNETIC) ? + material.getProperty(PropertyKey.INGOT).getMacerateInto() : material); LATHE_RECIPES.recipeBuilder("lathe_" + material.getName() + "_bolt_to_screw") .inputItems(bolt, material) @@ -102,14 +104,16 @@ public static void processScrew(TagPrefix screwPrefix, Material material, DustPr public static void processFoil(TagPrefix foilPrefix, Material material, IngotProperty property, Consumer provider) { + var magMaterial = material.hasFlag(IS_MAGNETIC) ? + material.getProperty(PropertyKey.INGOT).getMacerateInto() : material; if (!material.hasFlag(NO_SMASHING)) VanillaRecipeHelper.addShapedRecipe(provider, String.format("foil_%s", material.getName()), ChemicalHelper.get(foilPrefix, material, 2), - "hP ", 'P', new UnificationEntry(plate, material)); + "hP ", 'P', new UnificationEntry(plate, magMaterial)); BENDER_RECIPES.recipeBuilder("bend_" + material.getName() + "_plate_to_foil") .inputItems(plate, material) - .outputItems(foilPrefix, material, 4) + .outputItems(foilPrefix, magMaterial, 4) .duration((int) material.getMass()) .EUt(24) .circuitMeta(1) @@ -117,7 +121,7 @@ public static void processFoil(TagPrefix foilPrefix, Material material, IngotPro BENDER_RECIPES.recipeBuilder("bend_" + material.getName() + "_ingot_to_foil") .inputItems(ingot, material) - .outputItems(foilPrefix, material, 4) + .outputItems(foilPrefix, magMaterial, 4) .duration((int) material.getMass()) .EUt(24) .circuitMeta(10) @@ -127,7 +131,7 @@ public static void processFoil(TagPrefix foilPrefix, Material material, IngotPro EXTRUDER_RECIPES.recipeBuilder("extrude_" + material.getName() + "_ingot_to_foil") .inputItems(ingot, material) .notConsumable(GTItems.SHAPE_EXTRUDER_FOIL) - .outputItems(foilPrefix, material, 4) + .outputItems(foilPrefix, magMaterial, 4) .duration((int) material.getMass()) .EUt(24) .save(provider); @@ -135,7 +139,7 @@ public static void processFoil(TagPrefix foilPrefix, Material material, IngotPro EXTRUDER_RECIPES.recipeBuilder("extrude_" + material.getName() + "_dust_to_foil") .inputItems(dust, material) .notConsumable(GTItems.SHAPE_EXTRUDER_FOIL) - .outputItems(foilPrefix, material, 4) + .outputItems(foilPrefix, magMaterial, 4) .duration((int) material.getMass()) .EUt(24) .save(provider); @@ -144,7 +148,8 @@ public static void processFoil(TagPrefix foilPrefix, Material material, IngotPro public static void processFineWire(TagPrefix fineWirePrefix, Material material, IngotProperty property, Consumer provider) { - ItemStack fineWireStack = ChemicalHelper.get(fineWirePrefix, material); + ItemStack fineWireStack = ChemicalHelper.get(fineWirePrefix, material.hasFlag(IS_MAGNETIC) ? + material.getProperty(PropertyKey.INGOT).getMacerateInto() : material); if (!ChemicalHelper.get(foil, material).isEmpty()) VanillaRecipeHelper.addShapelessRecipe(provider, String.format("fine_wire_%s", material.getName()), @@ -153,14 +158,14 @@ public static void processFineWire(TagPrefix fineWirePrefix, Material material, if (material.hasProperty(PropertyKey.WIRE)) { WIREMILL_RECIPES.recipeBuilder("mill_" + material.getName() + "_wire_to_fine_wire") .inputItems(wireGtSingle, material) - .outputItems(wireFine, material, 4) + .outputItems(GTUtil.copyAmount(4, fineWireStack)) .duration((int) material.getMass() * 3 / 2) .EUt(VA[ULV]) .save(provider); } else { WIREMILL_RECIPES.recipeBuilder("mill_" + material.getName() + "ingot_to_fine_wire") .inputItems(ingot, material) - .outputItems(wireFine, material, 8) + .outputItems(GTUtil.copyAmount(8, fineWireStack)) .duration((int) material.getMass() * 3) .EUt(VA[ULV]) .save(provider); @@ -169,13 +174,14 @@ public static void processFineWire(TagPrefix fineWirePrefix, Material material, public static void processGear(TagPrefix gearPrefix, Material material, DustProperty property, Consumer provider) { - ItemStack stack = ChemicalHelper.get(gearPrefix, material); + ItemStack stack = ChemicalHelper.get(gearPrefix, material.hasFlag(IS_MAGNETIC) ? + material.getProperty(PropertyKey.INGOT).getMacerateInto() : material); if (gearPrefix == gear && material.hasProperty(PropertyKey.INGOT)) { int voltageMultiplier = getVoltageMultiplier(material); EXTRUDER_RECIPES.recipeBuilder("extrude_" + material.getName() + "_ingot_to_gear") .inputItems(ingot, material, 4) .notConsumable(GTItems.SHAPE_EXTRUDER_GEAR) - .outputItems(gearPrefix, material) + .outputItems(stack) .duration((int) material.getMass() * 5) .EUt(8L * voltageMultiplier) .save(provider); @@ -183,7 +189,7 @@ public static void processGear(TagPrefix gearPrefix, Material material, DustProp ALLOY_SMELTER_RECIPES.recipeBuilder("alloy_smelt_" + material.getName() + "_ingot_to_gear") .inputItems(ingot, material, 8) .notConsumable(GTItems.SHAPE_MOLD_GEAR) - .outputItems(gearPrefix, material) + .outputItems(stack) .duration((int) material.getMass() * 10) .EUt(2L * voltageMultiplier) .category(GTRecipeCategories.INGOT_MOLDING) @@ -193,7 +199,7 @@ public static void processGear(TagPrefix gearPrefix, Material material, DustProp EXTRUDER_RECIPES.recipeBuilder("extrude_" + material.getName() + "_dust_to_gear") .inputItems(dust, material, 4) .notConsumable(GTItems.SHAPE_EXTRUDER_GEAR) - .outputItems(gearPrefix, material) + .outputItems(stack) .duration((int) material.getMass() * 5) .EUt(8L * voltageMultiplier) .save(provider); @@ -214,7 +220,7 @@ 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), + stack, " R ", "hPx", " R ", 'R', new UnificationEntry(rod, material), 'P', new UnificationEntry(plate, material)); @@ -230,7 +236,7 @@ public static void processGear(TagPrefix gearPrefix, Material material, DustProp .duration((int) material.getMass()).EUt(VA[LV]) .inputItems(ingot, material, 2) .notConsumable(GTItems.SHAPE_MOLD_GEAR_SMALL) - .outputItems(gearSmall, material) + .outputItems(stack) .category(GTRecipeCategories.INGOT_MOLDING) .save(provider); @@ -286,24 +292,26 @@ public static void processPlate(TagPrefix platePrefix, Material material, DustPr public static void processPlateDouble(TagPrefix doublePrefix, Material material, IngotProperty property, Consumer provider) { + var magMaterial = material.hasFlag(IS_MAGNETIC) ? + material.getProperty(PropertyKey.INGOT).getMacerateInto() : material; if (material.hasFlag(GENERATE_PLATE)) { if (!material.hasFlag(NO_SMASHING)) { VanillaRecipeHelper.addShapedRecipe(provider, String.format("plate_double_%s", material.getName()), - ChemicalHelper.get(doublePrefix, material), + ChemicalHelper.get(doublePrefix, magMaterial), "h", "P", "P", 'P', new UnificationEntry(plate, material)); } BENDER_RECIPES.recipeBuilder("bend_" + material.getName() + "_plate_to_double_plate") .EUt(96).duration((int) material.getMass() * 2) .inputItems(plate, material, 2) - .outputItems(doublePrefix, material) + .outputItems(doublePrefix, magMaterial) .circuitMeta(2) .save(provider); BENDER_RECIPES.recipeBuilder("bend_" + material.getName() + "_ingot_to_double_plate") .inputItems(ingot, material, 2) .circuitMeta(2) - .outputItems(doublePrefix, material) + .outputItems(doublePrefix, magMaterial) .duration((int) material.getMass() * 2) .EUt(96) .save(provider); @@ -312,10 +320,12 @@ public static void processPlateDouble(TagPrefix doublePrefix, Material material, public static void processPlateDense(TagPrefix tagPrefix, Material material, DustProperty property, Consumer provider) { + var magMaterial = material.hasFlag(IS_MAGNETIC) ? + material.getProperty(PropertyKey.INGOT).getMacerateInto() : material; BENDER_RECIPES.recipeBuilder("bend_" + material.getName() + "_plate_to_dense_plate") .inputItems(plate, material, 9) .circuitMeta(9) - .outputItems(tagPrefix, material) + .outputItems(tagPrefix, magMaterial) .duration((int) Math.max(material.getMass() * 9L, 1L)) .EUt(96) .save(provider); @@ -324,7 +334,7 @@ public static void processPlateDense(TagPrefix tagPrefix, Material material, Dus BENDER_RECIPES.recipeBuilder("bend_" + material.getName() + "_ingot_to_dense_plate") .inputItems(ingot, material, 9) .circuitMeta(9) - .outputItems(tagPrefix, material) + .outputItems(tagPrefix, magMaterial) .duration((int) Math.max(material.getMass() * 9L, 1L)) .EUt(96) .save(provider); @@ -432,17 +442,20 @@ public static void processStick(TagPrefix stickPrefix, Material material, DustPr .duration((int) Math.max(material.getMass() * 2, 1)) .EUt(16); + var materialOutput = material.hasFlag(IS_MAGNETIC) ? + material.getProperty(PropertyKey.INGOT).getMacerateInto() : material; if (ConfigHolder.INSTANCE.recipes.harderRods) { - builder.outputItems(rod, material); - builder.outputItems(dustSmall, material, 2); + builder.outputItems(rod, materialOutput); + builder.outputItems(dustSmall, materialOutput, 2); } else { - builder.outputItems(rod, material, 2); + builder.outputItems(rod, materialOutput, 2); } builder.save(provider); } if (material.hasFlag(GENERATE_BOLT_SCREW)) { - ItemStack boltStack = ChemicalHelper.get(bolt, material); + ItemStack boltStack = ChemicalHelper.get(bolt, material.hasFlag(IS_MAGNETIC) ? + material.getProperty(PropertyKey.INGOT).getMacerateInto() : material); CUTTER_RECIPES.recipeBuilder("cut_" + material.getName() + "_rod_to_bolt") .inputItems(stickPrefix, material) .outputItems(GTUtil.copyAmount(4, boltStack)) @@ -459,8 +472,10 @@ public static void processStick(TagPrefix stickPrefix, Material material, DustPr public static void processLongStick(TagPrefix longStickPrefix, Material material, DustProperty property, Consumer provider) { - ItemStack stack = ChemicalHelper.get(longStickPrefix, material); - ItemStack stickStack = ChemicalHelper.get(rod, material); + ItemStack stack = ChemicalHelper.get(longStickPrefix, material.hasFlag(IS_MAGNETIC) ? + material.getProperty(PropertyKey.INGOT).getMacerateInto() : material); + ItemStack stickStack = ChemicalHelper.get(rod, material.hasFlag(IS_MAGNETIC) ? + material.getProperty(PropertyKey.INGOT).getMacerateInto() : material); CUTTER_RECIPES.recipeBuilder("cut_" + material.getName() + "_long_rod_to_rod") .inputItems(longStickPrefix, material) @@ -551,21 +566,23 @@ public static void processTurbine(TagPrefix toolPrefix, Material material, Ingot public static void processRound(TagPrefix roundPrefix, Material material, IngotProperty property, Consumer provider) { + var outputMaterial = material.hasFlag(IS_MAGNETIC) ? + material.getProperty(PropertyKey.INGOT).getMacerateInto() : material; if (!material.hasFlag(NO_SMASHING)) { VanillaRecipeHelper.addShapedRecipe(provider, String.format("round_%s", material.getName()), - ChemicalHelper.get(round, material), + ChemicalHelper.get(round, outputMaterial), "fN", "Nh", 'N', new UnificationEntry(nugget, material)); VanillaRecipeHelper.addShapedRecipe(provider, String.format("round_from_ingot_%s", material.getName()), - ChemicalHelper.get(round, material, 4), + ChemicalHelper.get(round, outputMaterial, 4), "fIh", 'I', new UnificationEntry(ingot, material)); } LATHE_RECIPES.recipeBuilder("lathe_" + material.getName() + "_nugget_to_round") .EUt(VA[ULV]).duration(100) .inputItems(nugget, material) - .outputItems(round, material) + .outputItems(round, outputMaterial) .save(provider); } 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 3eba52ef77..2a127f29af 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 @@ -20,8 +20,9 @@ public class PolarizingRecipeHandler { private static final TagPrefix[] POLARIZING_PREFIXES = new TagPrefix[] { - rod, rodLong, plate, ingot, plateDense, rotor, - bolt, screw, wireFine, foil, ring }; + rod, rodLong, plate, ingot, plateDense, plateDouble, rotor, + bolt, screw, wireFine, foil, ring, dust, nugget, block, + dustTiny, dustSmall }; public static void init(Consumer provider) { for (TagPrefix orePrefix : POLARIZING_PREFIXES) { @@ -33,7 +34,8 @@ public static void processPolarizing(TagPrefix polarizingPrefix, Material materi Consumer provider) { Material magneticMaterial = property.getMagneticMaterial(); - if (magneticMaterial != null && polarizingPrefix.doGenerateItem(magneticMaterial)) { + if (magneticMaterial != null && (polarizingPrefix.doGenerateBlock(magneticMaterial) || + polarizingPrefix.doGenerateItem(magneticMaterial))) { ItemStack magneticStack = ChemicalHelper.get(polarizingPrefix, magneticMaterial); POLARIZER_RECIPES.recipeBuilder("polarize_" + material.getName() + "_" + polarizingPrefix.name) // polarizing .inputItems(polarizingPrefix, material) 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 18a20d08f6..3cf2ba98a4 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 @@ -1167,7 +1167,7 @@ public static void init(Consumer provider) { 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) { + if (ConfigHolder.INSTANCE.compat.energy.enableFEConverters) { 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, 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 17f6b10327..25adab6319 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 @@ -450,6 +450,8 @@ private static List finalizeOutputs(List materials, in List> outputs = new ArrayList<>(); for (MaterialStack ms : materials) { + ms = new MaterialStack(ms.material().hasFlag(IS_MAGNETIC) ? + ms.material().getProperty(PropertyKey.INGOT).getMacerateInto() : ms.material(), ms.amount()); ItemStack stack = toItemStackMapper.apply(ms); if (stack == ItemStack.EMPTY) continue; if (stack.getCount() > 64) { diff --git a/src/main/java/com/gregtechceu/gtceu/integration/GTRecipeWidget.java b/src/main/java/com/gregtechceu/gtceu/integration/GTRecipeWidget.java index 1096694a14..163c2b891c 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/GTRecipeWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/GTRecipeWidget.java @@ -289,7 +289,7 @@ public static void setConsumedChance(Content content, ChanceLogic logic, List= GTValues.LV ? tier - 1 : tier) - minTier), 100.0f); if (logic != ChanceLogic.NONE && logic != ChanceLogic.OR) { tooltips.add(Component.translatable("gtceu.gui.content.chance_1_logic", FormattingUtil.formatNumber2Places(chanceFloat), logic.getTranslation()) diff --git a/src/main/java/com/gregtechceu/gtceu/syncdata/GTRecipePayload.java b/src/main/java/com/gregtechceu/gtceu/syncdata/GTRecipePayload.java index 8163372586..e7b282872d 100644 --- a/src/main/java/com/gregtechceu/gtceu/syncdata/GTRecipePayload.java +++ b/src/main/java/com/gregtechceu/gtceu/syncdata/GTRecipePayload.java @@ -10,9 +10,9 @@ import net.minecraft.nbt.*; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.MinecraftServer; import net.minecraft.world.item.crafting.RecipeManager; import net.minecraft.world.item.crafting.SmeltingRecipe; -import net.minecraftforge.fml.loading.FMLEnvironment; import net.minecraftforge.server.ServerLifecycleHooks; import io.netty.buffer.ByteBuf; @@ -26,6 +26,15 @@ */ public class GTRecipePayload extends ObjectTypedPayload { + private static RecipeManager getRecipeManager() { + MinecraftServer server = ServerLifecycleHooks.getCurrentServer(); + if (server != null && Thread.currentThread() == server.getRunningThread()) { + return server.getRecipeManager(); + } else { + return Client.getRecipeManager(); + } + } + @Nullable @Override public Tag serializeNBT() { @@ -38,9 +47,7 @@ public Tag serializeNBT() { @Override public void deserializeNBT(Tag tag) { - RecipeManager recipeManager; - if (FMLEnvironment.dist.isClient()) recipeManager = Client.getRecipeManager(); - else recipeManager = ServerLifecycleHooks.getCurrentServer().getRecipeManager(); + RecipeManager recipeManager = getRecipeManager(); if (tag instanceof CompoundTag compoundTag) { payload = GTRecipeSerializer.CODEC.parse(NbtOps.INSTANCE, compoundTag.get("recipe")).result().orElse(null); if (payload != null) { @@ -76,9 +83,7 @@ public void readPayload(FriendlyByteBuf buf) { if (buf.isReadable()) { this.payload = GTRecipeSerializer.SERIALIZER.fromNetwork(id, buf); } else { // Backwards Compatibility - RecipeManager recipeManager; - if (FMLEnvironment.dist.isClient()) recipeManager = Client.getRecipeManager(); - else recipeManager = ServerLifecycleHooks.getCurrentServer().getRecipeManager(); + RecipeManager recipeManager = getRecipeManager(); this.payload = (GTRecipe) recipeManager.byKey(id).orElse(null); } }