Skip to content

Commit

Permalink
Implements shim for the GT5U ore vein database to serve VP's ore info
Browse files Browse the repository at this point in the history
  • Loading branch information
querns committed Jul 29, 2024
1 parent 32bc112 commit 1b4f878
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 17 deletions.
2 changes: 1 addition & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ dependencies {
shadowImplementation('com.github.GTNewHorizons:Enklume:2.1.0:dev')

api('com.github.GTNewHorizons:Navigator:1.0.6:dev')
api('com.github.GTNewHorizons:GT5-Unofficial:5.09.48.92:dev')
api('com.github.GTNewHorizons:GT5-Unofficial:5.09.48.117:dev')

// For debugging
runtimeOnlyNonPublishable('com.github.GTNewHorizons:DetravScannerMod:1.8.1:dev')
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/sinthoras/visualprospecting/VPMod.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.sinthoras.visualprospecting;

import com.sinthoras.visualprospecting.hooks.HooksShared;
import com.sinthoras.visualprospecting.integration.gregtech.VeinDatabase;

import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.SidedProxy;
Expand All @@ -12,6 +13,7 @@
import cpw.mods.fml.common.event.FMLServerStartingEvent;
import cpw.mods.fml.common.event.FMLServerStoppedEvent;
import cpw.mods.fml.common.event.FMLServerStoppingEvent;
import gregtech.crossmod.visualprospecting.GT_VisualProspecting_Database;

@Mod(
modid = Tags.MODID,
Expand Down Expand Up @@ -44,6 +46,8 @@ public void fmlLifeCycleEvent(FMLInitializationEvent event) {
// postInit "Handle interaction with other mods, complete your setup based on this."
public void fmlLifeCycle(FMLPostInitializationEvent event) {
VP.debug("postInit()");
VP.debug("Registering with the GT5U ore vein database");
GT_VisualProspecting_Database.registerDatabase(new VeinDatabase());
proxy.fmlLifeCycleEvent(event);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.sinthoras.visualprospecting.integration.gregtech;

import java.util.Optional;

import net.minecraft.world.ChunkCoordIntPair;

import com.sinthoras.visualprospecting.ServerTranslations;
import com.sinthoras.visualprospecting.database.OreVeinPosition;
import com.sinthoras.visualprospecting.database.ServerCache;
import com.sinthoras.visualprospecting.database.veintypes.VeinType;

import gregtech.crossmod.visualprospecting.IDatabase;

public class VeinDatabase implements IDatabase {

@Override
public Optional<String> getVeinName(int dimensionId, ChunkCoordIntPair coordinates) {
OreVeinPosition oreVein = ServerCache.instance
.getOreVein(dimensionId, coordinates.chunkXPos, coordinates.chunkZPos);
if (oreVein != null && oreVein.veinType != VeinType.NO_VEIN) {
// Unfortunately, there's not a very good way to localize this. This method is used to drive information
// in the Metrics Transmitter cover in GT5U, which operates entirely server-side. At best, we could try to
// capture which language the original cover attaching player is using, maybe. (I think this requires
// reflection, of course. Why should things be easy?) Even then, it wouldn't help in a multiplayer scenario
// with users having different locales.
return Optional.of(ServerTranslations.getEnglishLocalization(oreVein.veinType));
} else {
return Optional.empty();
}
}
}
22 changes: 11 additions & 11 deletions src/main/resources/assets/gregtech/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ ore.mix.terraaer=Terra and Aer
ore.mix.perditioordo=Perdito and Ordo
ore.mix.coppertin=Vermiculite
ore.mix.titaniumchrome=Ilmenite
ore.mix.mineralsand=Mineralsand
ore.mix.garnettin=Garnettin
ore.mix.mineralsand=Mineral Sands
ore.mix.garnettin=Garnet/Tin
ore.mix.kaolinitezeolite=Kaolinite
ore.mix.mica=Mica
ore.mix.dolomite=Dolomite
Expand All @@ -59,7 +59,7 @@ ore.mix.niobium=Niobium
ore.mix.tungstenirons=Tungsten
ore.mix.uraniumgtnh=Thorium
ore.mix.vanadiumgold=Vanadium
ore.mix.netherstar=NetherStar
ore.mix.netherstar=Nether Star
ore.mix.garnet=Garnet
ore.mix.rareearth=Rare Earths
ore.mix.richnuclear=Plutonium
Expand All @@ -72,23 +72,23 @@ ore.mix.rutile=Rutile
ore.mix.tfgalena=Cryolite
ore.mix.luvtantalite=Pyrolusite

ore.mix.ross128.Thorianit=Thorianit
ore.mix.ross128.Thorianit=Thorianite
ore.mix.ross128.carbon=Graphite
ore.mix.ross128.bismuth=Bismuth
ore.mix.ross128.TurmalinAlkali=Olenit
ore.mix.ross128.Roquesit=Roquesit
ore.mix.ross128.TurmalinAlkali=Olenite
ore.mix.ross128.Roquesit=Roquesite
ore.mix.ross128.Tungstate=Scheelite
ore.mix.ross128.CopperSulfits=Djurleit
ore.mix.ross128.Forsterit=Forsterit
ore.mix.ross128.Hedenbergit=Hedenbergit
ore.mix.ross128.CopperSulfits=Djurleite
ore.mix.ross128.Forsterit=Forsterite
ore.mix.ross128.Hedenbergit=Hedenbergite
ore.mix.ross128.RedZircon=Red Zircon

ore.mix.ross128ba.tib=Tiberium
ore.mix.ross128ba.Tungstate=Scheelite
ore.mix.ross128ba.bart=BArTiMaEuSNeK
ore.mix.ross128ba.TurmalinAlkali=Olenit
ore.mix.ross128ba.TurmalinAlkali=Olenite
ore.mix.ross128ba.Amethyst=Amethyst
ore.mix.ross128ba.CopperSulfits=Djurleit
ore.mix.ross128ba.CopperSulfits=Djurleite
ore.mix.ross128ba.RedZircon=Red Zircon
ore.mix.ross128ba.Fluorspar=Fluorspar

Expand Down
10 changes: 5 additions & 5 deletions src/main/resources/assets/visualprospecting/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ visualprospecting.resetprogress.title=Delete VisualProspecting Progress
visualprospecting.resetprogress.confirm=Yes, i am sure!
visualprospecting.resetprogress.cancel=Cancel
visualprospecting.resetprogress.prompt=Delete player progress on ore veins and underground fluids?
visualprospecting.resetprogress.command=Deletes all your progress on ore veins and undergrond fluids
visualprospecting.resetprogress.command=Deletes all your progress on ore veins and underground fluids
visualprospecting.resetprogress.confirmation=Progress deleted!
visualprospecting.redoservercache.command=Redo the GT vein cache on the server
visualprospecting.redoservercache.start=Start redoing the GT vein cache on the server
Expand All @@ -36,16 +36,16 @@ item.visualprospecting.prospectorslog.author=Author: %s
item.visualprospecting.prospectorslog.empty=Use item to fill it.
item.visualprospecting.prospectorslog.creation.begin=A Prospector's Log has been written.
item.visualprospecting.prospectorslog.creation.fail0=[Failed]: Damn! I spilled coffee over it...
item.visualprospecting.prospectorslog.creation.fail1=[Failed]: It seem's that you cannot read your own words...
item.visualprospecting.prospectorslog.creation.fail1=[Failed]: It seems that you cannot read your own words...
item.visualprospecting.prospectorslog.creation.fail2=[Failed]: Why did I write that in eldritch? I cannot read eldritch!
item.visualprospecting.prospectorslog.creation.fail3=[Failed]: Where did I put my glasses? I can't write without!
item.visualprospecting.prospectorslog.creation.fail3=[Failed]: Where did I put my glasses? I can't write without them!
item.visualprospecting.prospectorslog.creation.fail4=[Failed]: Herobrine stole my notes!
item.visualprospecting.prospectorslog.reading.fail0=[Failed]: It smells like good coffee, but i cannot read it!
item.visualprospecting.prospectorslog.reading.fail1=[Failed]: I need to improve my Russian before I can read that!
item.visualprospecting.prospectorslog.reading.fail2=[Failed]: What?!? That was empty?
item.visualprospecting.prospectorslog.reading.fail3=[Failed]: Yeah..No. I can't decipher that!
item.visualprospecting.prospectorslog.reading.fail3=[Failed]: Yeah... No. I can't decipher that!
item.visualprospecting.prospectorslog.reading.fail4=[Failed]: Do I have a Ph.D. in Geography? NOPE!
item.visualprospecting.prospectorslog.reading.begin=Those are quite some pages. It might take some time to fully read it.
item.visualprospecting.prospectorslog.reading.begin=That's quite a lot of pages. It might take some time to fully read it.
item.visualprospecting.prospectorslog.reading.end=I finished the Prospector's Log of %s
visualprospecting.node.deletehint=Mark depleted with %s
visualprospecting.tracked=Tracked: %s

0 comments on commit 1b4f878

Please sign in to comment.