merlinlikethewizard / Mastermine

A fully automated strip mining network for ComputerCraft turtles!
MIT License
88 stars 23 forks source link

adds detection of ores with block tags #4

Closed RaptorPort closed 3 years ago

RaptorPort commented 3 years ago

Most mods have their items tagged correctlly inside with forge. By checking if the 'forge:ores' Tag is on the inspected block, we can easily detect if it is an ore, regardless of the mods installed, aslong the mods categorize their ore correctly.

I implemented it into the config, like the orenames, which provides an easy way to add more Tags. One point of note is, that a few mods extend the Tag (see AE2 Quartz 'forge:ores/certus_quartz' versus MC Iron which has both 'forge/ores' and 'forge/ores/iron'). This is easily solvable by pattern matching the strings, but could slow down the inspect operation, so I decided against it.

merlinlikethewizard commented 3 years ago

Holy crap I had no idea. This is awesome, thanks! So much more pro to be auto detecting. Also thanks for being my first pull request :)

I feel like if checkTags just did a string match on the word "ores" for each tag that wouldn't be too slow, though I don't know how many tags there are. I suppose we could get an unwanted hit on "minoressence" or "filipinorestaurant" or something.

RaptorPort commented 3 years ago

No problem :) Just thought that it would be really usefull. I'm currently using it in the Direwold20 1.16 Modpack and the items that have tags have between 2 to 10. I timed the string search on items with different amount of tags and the time it took didn't change at all. We are limited by Minecraft tickrate after all. So aslong we don't do anything crazy there won't be any difference. That was overthinking on my part^^

As for checking the Tags for the word "ores": That could turn into a problem, since some mods use the tags to define inputs for machines I think (Mekanism adds the tag 'mekanism:atomic_disassembler_ore' to 'Oak Log' and most of the other Logs). For the modpack I'm playing rn it detects everything except 'Vinteum Ore' from the mod 'Mana and Artific' which doesn't have any block tags at all. Unless you know of any mods with which the current implementation doesn't work, I'd leave it as it is for now.

merlinlikethewizard commented 3 years ago

Cool, that makes sense. If it ain't fix don't broke it :)

Apropos of nothing, playing on 1.16 are you just placing chunk loaders around in lieu of chunky turtles? Only asking out of curiosity.

Eforen commented 3 years ago

For the modpack I'm playing rn it detects everything except 'Vinteum Ore' from the mod 'Mana and Artific' which doesn't have any block tags at all. Unless you know of any mods with which the current implementation doesn't work, I'd leave it as it is for now.

I believe if you want to you could use craft-tweaker or kube-js to add the forge ore tag to Vinteum as long as your the serve owner or playing single player

RaptorPort commented 3 years ago

Cool, that makes sense. If it ain't fix don't broke it :)

Apropos of nothing, playing on 1.16 are you just placing chunk loaders around in lieu of chunky turtles? Only asking out of curiosity.

I setup the mine next to my base, reduced the the trip length of the turtles a bit and added 10 mine levels in the config. Since I spend most time in my base and part of it is chunkloaded with the FTB Utilities chunkloading they usually work most of the time or resume when I get back to the base. So far I didn't have to go out of my way to retrieve a turtle :D This isn't the best, but it helps alot to get started. I would have loved to keep using turtles but since there is no other method of chunkloading probably the only use case, unless you increase the number of chunks you can chunkload with FTB Utilities in the config. But then you would chunkload alot of chunks all the time, which isn't that great. I still got the turtles running, but I mostly rely on a RFtools quarry by now.

merlinlikethewizard commented 3 years ago

I see, that makes sense to make the most out of things. Makes me think it might make sense to add the option of the hub picking between levels based on the one with the closest shaft instead of randomly. Ah well, ces't la vie. Neat you haven't had to go after one yet, maybe they don't just shutdown immediately. Thanks for letting me know, I haven't tested it without the chunk loaders yet.