forked from SinTh0r4s/VisualProspecting
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implements shim for the GT5U ore vein database to serve VP's ore info
- Loading branch information
Showing
5 changed files
with
52 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/main/java/com/sinthoras/visualprospecting/integration/gregtech/VeinDatabase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters