VisualOres

VisualOres

236k Downloads

[feature request] Config to allow changing block-to-ore mapping

alfuken opened this issue ยท 6 comments

commented

I'm making a Gregtech modpack with emphasis on Geobotanical prospecting, where, unlike vanilla GT, which spawn dust piles on the surface, I'm using flowers from the Plants mod to indicate ore deposits. For example, beryllium is indicated by a Aloe Ballii plant on the surface:

  "vein_populator": {
    "type": "surface_block",
    "block": {
      "block": "plants2:cosmetic_1",
      "type": "aloe_b"
    },
    "min_amount": 2,
    "max_amount": 4
  },

which looks like this,
and redstone - by Aechmea Amicorum:

  "vein_populator": {
    "type": "surface_block",
    "block": {
      "block": "plants2:cosmetic_0",
      "type": "aechmea_a"
    },
    "min_amount": 2,
    "max_amount": 4
  },

I tried to figure out logic that VisualOres uses to detect deposit type and to add a map icons/waypoints, but my Java knowledge is not that good yet.

It would be awesome if you could add possibility to configure the connection between block clicked and deposit marked. :)

commented

Alright, then, a different question. I now know how to run some code when player clicks an above mentioned flower. I also have a mapping of flower->deposit name. You say it triggers when you right-click an ore block. So my question now is: how do I trigger it from another mod? Let's say I want to achieve the same behaviour as if player would click an ore block. So when player clicks a flower block, I call some method in VisualOres to make it think as if player clicked an actual ore block. How do I do that?

commented

Looks like the best way with code that currently exists is to call ServerCache.instance.prospectOreBlock with the current dimension, the result of material.getResourceLocation().toString() on the GT material you want to simulate an ore block click for, the BlockPos of the position where it was clicked, and the player that clicked on the block.

Best way to make it easier with adding code to VO would be storing the deposit name in OreVeinInfo as well and adding a similar method to prospectOreBlock to ServerCache, which you could then call with the result of looking up what deposit name corresponds with which flower.

commented

That event is actually fired on both client and server side, so you should be able to check which side its being fired on with event.getSide() and only call prospectOreBlock if it is Side.SERVER.

commented

Thanks! Though it seems that ServerCache.instance.prospectOreBlock is expected to be called on the server side, while PlayerInteractEvent.RightClickBlock event is triggered on the client side... I guess I have to now figure out how to work with packets... ๐Ÿ˜… unless there's some other method or trick from VO or GT that I can use?..

commented

Oh, right, that's what I get for blindly following the guides :))
You've been a tremendous help, thanks a lot! I now have it working as planned. :)

commented

VO adds ore veins to the map when you either: pick up a surface rock, r-click an ore block, or use the electric prospector.
The click events are currently handled by mixining block click methods into the appropriate block classes, which isn't very expandable. I might look into being able to specify block -> ore vein mapping on click, though no promises on when that will happen since I haven't had too much motivation to work on VO recently.