Skip to content

GregTech 5 Unofficial convenience mod for easy GT Ore Vein and underground fluid tracking. Includes visualization for JourneyMap

License

Notifications You must be signed in to change notification settings

GTNewHorizons/VisualProspecting

 
 

Repository files navigation

GregTech5U Add-On: VisualProspecting

Build and test

For Minecraft 1.7.10

This mod is intended for player convenience, but may also be used as API, since it provides the location of all GT ore veins in a cache. VisualProspecting tracks all GT Ore Veins a player has found and visualizes them in JourneyMap and/or XaeroWorldMap (optional, if installed). It also visualizes tracked Thaumcraft aura nodes if TCNodeTracker if installed. VoxelMap will add waypoints for prospected ore veins and fluids.

VisualProspecting tracks all ores that a player interacted with, by right or by left click. It also integrates prospecting data from GTs Advanced Seismic Prospector, although only books that are created after this mod was added will provide integration. You may share your findings with other players by crafting a Prospector's Log.

This mod is tailored to GregTech: New Horizons 2, but feel free to use it however you like. Even though this mod is build against the custom GT5U from GT:NH, it should still work fine with other GT5U versions.

Underground fluids in JourneyMap overlay
Underground fluids in JourneyMap overlay.

Other Maps

Underground fluids in XaeroWorldMap overlay
Underground fluids in XaeroWorldMap overlay

GregTech ore veins in XaeroWorldMap overlay
GregTech ore veins in XaeroWorldMap overlay. You may double-click an ore vein to toggle it as waypoint.

Other Maps

GregTech ore veins in JourneyMap overlay
GregTech ore veins in JourneyMap overlay

Thaumcraft aura nodes in JourneyMap overlay
Thaumcraft aura nodes in JourneyMap overlay. You may double-click an aura node to toggle it as waypoint.

Other Maps

Thaumcraft aura nodes in XaeroWorldMap overlay
Thaumcraft aura nodes in XaeroWorldMap overlay

Reset Progress

You may use JourneyMap's Actions Menu to achieve this or type /visualprospectingresetprogress in chat. Beware, there are no backups! Please use at your own risk.

Other Maps

Does VisualProspecting run with other maps? - I runs just fine, but it has no visualization or GUI integration. If you like to add integration into other maps yourself, feel free to contact me or open a Pull Request.

Developer overlays

VisualProspecting comes with developer overlays for debugging chunk saving issues, to activate it change the following config setting in config/visualprospecting.cfg to true:

B:enableDeveloperOverlays=true

The dirty chunk overlay works only in singleplayer mode in JourneyMap, and displays which chunks are marked as "dirty" in the game engine. This can be used to debug mods that don't set this flag properly and therefore lose data or duplicate items on world load/unload.

Dirty chunks in JourneyMap developer overlay
Dirty chunks in JourneyMap developer overlay

Dependencies

Required Mods:

Optional Mods:

Add Visual Prospecting as API

You would have a great idea for a new prospecting feature? You may use VPs database as a starting point to save yourself a ton of work. Just add these following changes to your build.gradle and you are ready to develop.

Add jitpack to your repositories:

repositories {
    maven {
        url = "https://jitpack.io"
    }
}

Add Visual Prospecting in your dependencies:

dependencies {
    compile("com.github.SinTh0r4s:VisualProspecting:1.0.10b")  // Adapt 1.0.10b to targeted release
}

In case you do not require any Thaumcraft integration it is recommended to disable it. This will increase your start time of Minecraft in dev:

dependencies {
    compile("com.github.SinTh0r4s:VisualProspecting:1.0.10b") {  // Adapt 1.0.10b to targeted release
        exclude module: "TCNodeTracker"
    }
}

GregTech, JourneyMap and their respective dependencies will be loaded automatically. You are ready to start now.

Usage as API

GT Ore Database

All database access is channeled through the classes ServerCache and ClientCache. Database use is split up into logical sides. You need to determine whether your code is executed on the logical client or logical server. Dependent on your answer you need to use the according database: The client database only knows about ore veins the player has already prospected, while the server database will know about all veins. VisualProspecting_API helps you to clarify which side you are working on. You may add or request the ore vein for a chunk:

VisualProspecting_API.LogicalServer.getOreVein(int dimensionId, int chunkX, int chunkZ);
VisualProspecting_API.LogicalServer.getUndergroundFluid(World world, int blockX, int blockZ);


VisualProspecting_API.LogicalClient.getOreVein(int dimensionId, int chunkX, int chunkZ);
VisualProspecting_API.LogicalClient.getUndergroundFluid(int dimensionId, int blockX, int blockZ);
VisualProspecting_API.LogicalClient.setOreVeinDepleted(int dimensionId, int blockX, int blockZ);
VisualProspecting_API.LogicalClient.putProspectionResults(List<OreVeinPosition> oreVeins, List<UndergroundFluidPosition> undergroundFluids);

The logical server does not store underground fluid information, because GregTech has its own database for it. Instead, it provides a wrapper to access said GT database. You may also use more sophisticated methods to prospect whole areas at once. Take a look at exposed methods in VisualProspecting_API or directly in ServerCache and ClientCache.

Please keep in mind that chunk coordinates are block coordinates divided by 16! When in doubt you may fall back on:

int chunkX = Utils.coordBlockToChunk(blockX);
// blockZ is the lowest block coordinate in a chunk. If you want 
// to iterate over all blocks in that particular chunk you need
// to add [0, ... 15] to it
int blockZ = Utils.coordChunkToBlock(chunkZ);

Whenever you detect a new ore vein you need to add custom network payloads and request the information from the logical server yourself. Please do your best to disallow a logical client from querying the complete server database as it would lead to potential abuse. So, please check if the player is allowed to prospect a dimension and location.

If you simply want to notify a logical client from the logical server you may send a ProspectingNotification to the logical client. It will be handled from the client. For example:

final World world;
final int blockX;
final int blockZ;
final int blockRadius;
final EntityPlayerMP entityPlayer;

if(world.isRemote == false) {
    final List<OreVeinPosition> foundOreVeins = VisualProspecting_API.LogicalServer.prospectOreVeinsWithinRadius(world.provider.dimensionId, blockX, blockZ, blockRadius);
    final List<UndergroundFluidPosition> foundUndergroundFluids = VisualProspecting_API.LogicalServer.prospectUndergroundFluidsWithingRadius(world, blockX, blockZ, VP.undergroundFluidChunkProspectingBlockRadius);

    VisualProspecting_API.LogicalServer.sendProspectionResultsToClient(entityPlayer, foundOreVeins, foundUndergroundFluids);
}

Thank you and happy coding,
SinTh0r4s

About

GregTech 5 Unofficial convenience mod for easy GT Ore Vein and underground fluid tracking. Includes visualization for JourneyMap

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%