Baritone AI pathfinder

Baritone AI pathfinder

72.7k Downloads

Modded mining level tool no work

TheK0tYaRa opened this issue · 8 comments

commented

Some information

Operating system: Linux (amd64) version 5.14.5
Java version: 1.8.0_292, AdoptOpenJDK
Minecraft version: 1.12.2
Baritone version: 1.2.15
Other mods (if used):

 1.12.2Tiered_Hammers_0.0.1.jar                  creativefirework_1.0.1.jar                     ironchest_1.12.2_7.0.48.833.jar
 AdvancedSolarPanels_1.12.2_4.3.0.jar            DynamicSurroundings-1.12.2-3.4.7.2.jar         ItemPhysic_Full_1.4.18_mc1.12.2.jar
 ae2stuff-0.7.0.4-mc1.12.2.jar                   DynamicTrees-1.12.2-0.9.25.jar                 jei_1.12.2-4.14.4.264.jar
 appliedenergistics2_rv6_stable_4.jar            DynamicTreesForestry-1.12.2-1.0.10.jar         Mantle-1.12-1.3.3.55.jar
 baritone-standalone-forge-1.2.15.jar            equivalentstone_1.12.2_1.1.0b.jar              mobends_0.24_for_MC_1.12.jar
 bdlib-1.14.3.12-mc1.12.2.jar                    foamfix-0.10.14-1.12.2.jar                     OptiFine_1.12.2_HD_U_G5.jar
 bettercaves-1.12.2-2.0.2.jar                    forestry_1.12.2-5.8.2.422.jar                  portablecraftbench_1.12.2_1.5.1.jar
 betterfoliage-mc1.12-2.2.0.jar                 'Forgelin_1.8.4.jar'                         redstoneflux-1.12-2.1.1.1-universal.jar
 BetterMineshaftsForge-1.12.2-1.3.jar            grapplemod_v11.1_1.12.2.jar                    RTG-1.12.2-6.1.0.0-snapshot.1.jar
 BiomesOPlenty_1.12.2_7.0.1.2424_universal.jar   gravestone-1.10.3.jar                          SpawnerUpgrade_0.1.jar
 bonsaitrees_1.1.2_b144.jar                     'Gravitation+Suite-3.1.1.jar'                TConstruct-1.12.2-2.13.0.183.jar
 buildcraft_all_1.12_7.99.21.jar                 Hwyla-1.8.26-B41_1.12.2.jar                    tesla-core-lib-1.12.2-1.0.15.jar
 codechickenlib-1.12.2-3.2.3.358-universal.jar   industrialcraft-2-2.8.188-ex112.jar            ThermalDynamics-1.12.2-2.5.6.1-universal.jar
 cofhcore-1.12.2-4.6.6.1-universal.jar           industrialforegoing-1.12.2-1.11.5-215.jar      thermalexpansion-1.12.2-5.5.7.1-universal.jar
 cofhworld-1.12.2-1.4.0.1-universal.jar          InGameAccountSwitcher-Forge-1.12.2-7.1.2.jar   thermalfoundation-1.12.2-2.6.7.1-universal.jar
 CreativeCore_v1.9.36_mc1.12.2.jar               InventoryTweaks_1.64_dev.jar

Exception, error or logs

2021-09-24-1.log.gz
crash when pathing if said tool is placed on toolbar
error spam and no pathing if it was present

How to reproduce

Get Thermal Foundation Copper pickaxe

Modified settings

allow{Diagonal{Ascend,Descend},Parkour,Vines}
assumeExternalAutoTool # tried to fix the issue that way, no change
avoidance
buildInLayers
desktopNotification
layerOrder
renderCachedChunks
shortBaritonePrefix

Final checklist

  • I know how to properly use check boxes
  • I have included the version of Minecraft I'm running, baritone's version and forge mods (if used).
  • I have included logs, exceptions and / or steps to reproduce the issue.
  • I have not used any ⓞ in this issue.
commented

Thermal Foundation seems to just call net.minecraftforge.common.util.EnumHelper.addToolMaterial which in turn looks like it creates a new instance of the enum, injects it into the values array and clears some cache fields.
I thought it was an issue with proguard inlining all of the possible values but afaik the jars in build/libs are unoptimized and the error occurs with those as well.

commented

I think you wanted to try #autoTool false
The problem is the non-vanilla tool type (COPPER), not sure yet whether this happens for all modded materials and whether it's Baritones or the mod's fault.

commented

That's happening for any modded pick currently. But the drill is not spamming errors.

commented

Correction. Having a modded shield in the hotbar makes the error get supressed.

commented

It seems like Thermal Foundation creates a new instance of net.minecraft.item.Item.ToolMaterial which is not inserted into the list of enum values, so when Baritone calls net.minecraft.item.Item.ToolMaterial.valueOf with the new ToolMaterial it throws an error because COPPER is not a value of the enum.
Thermal Foundation is not open source for 1.12 (at least I could only find sources for 1.16), so I can't look at their code to confirm this.

commented
commented

It may be useful to investigate how mods like Waila Harvestability implement things like this, since they function with all modded materials and pickaxes.

commented

Waila Harvestability uses a Forge API (which we can only use via reflection), but when reading through item code and then ThermalFoundation and CoFHCore code I found this stupid line which means this issue is specific to CoFH mods. The function triggering the crash (baritone.utils.ToolSet::getMaterialCost) is not really important (iirc it only affects the ordering of equally fast tools) so as a temporary solution you can just make it return a constant value.
Also I noticed that Baritone should not be checking the material enum index because if mods add new materials they are no longer ordered by rarity/quality/value/whatever. The harvest level seems to be a good alternative, but so far I haven't found a way to access it, other than by retrieving the material name and then looking it up in the enum, which is what Baritone already does and why CoFH breaks it.