Skip to content

Commit cb11e44

Browse files
committed
update lang
1 parent 07bbbae commit cb11e44

File tree

9 files changed

+79
-109
lines changed

9 files changed

+79
-109
lines changed

dependencies.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ dependencies {
1515
shadowImplementation('com.github.GTNewHorizons:Enklume:2.0.0:dev')
1616

1717
implementation('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev')
18-
implementation("gtmega:gt5u-mc1.7.10:5.38.3-mega:dev")
18+
implementation("gtmega:gt5u-mc1.7.10:5.44.10-mega:dev")
1919

2020
implementation("codechicken:notenoughitems-mc1.7.10:2.3.0-mega:dev")
2121
implementation("codechicken:codechickencore-mc1.7.10:1.4.0-mega:dev")

src/main/java/com/sinthoras/visualprospecting/database/ServerCache.java

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,6 @@ public void notifyOreVeinGeneration(int dimensionId, int chunkX, int chunkZ, fin
3535
notifyOreVeinGeneration(dimensionId, chunkX, chunkZ, VeinTypeCaching.getVeinType(veinName));
3636
}
3737

38-
public int notifyOreVeinGeneration(int dimensionId, int chunkX, int chunkZ, final String veinName,
39-
int result, int aSeedX,
40-
int aSeedZ,World aWorld,GT_Worldgen_GT_Ore_Layer instance) {
41-
42-
System.out.println("aSeedX: "+aSeedX+" aSeedZ: "+aSeedZ);
43-
if (result == GT_Worldgen_GT_Ore_Layer.ORE_PLACED && !instance.mWorldGenName.equals("NoOresInVein")) {
44-
System.out.println("gen");
45-
ServerCache.instance.notifyOreVeinGeneration(
46-
aWorld.provider.dimensionId,
47-
Utils.coordBlockToChunk(aSeedX),
48-
Utils.coordBlockToChunk(aSeedZ),
49-
instance.mWorldGenName);
50-
}
51-
return result;
52-
}
53-
5438
public List<OreVeinPosition> prospectOreChunks(
5539
int dimensionId, int minChunkX, int minChunkZ, int maxChunkX, int maxChunkZ) {
5640
minChunkX = Utils.mapToCenterOreChunkCoord(minChunkX);

src/main/java/com/sinthoras/visualprospecting/database/cachebuilder/ChunkAnalysis.java

Lines changed: 0 additions & 49 deletions
This file was deleted.

src/main/java/com/sinthoras/visualprospecting/database/veintypes/VeinType.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import com.sinthoras.visualprospecting.Tags;
44
import gregtech.api.GregTech_API;
5+
6+
import java.util.ArrayList;
57
import java.util.HashSet;
68
import java.util.List;
79
import java.util.Objects;
@@ -93,6 +95,10 @@ static public boolean containsOre(GT_Worldgen_GT_Ore_Layer oreVein, GT_Block_Ore
9395
}
9496

9597
public List<String> getOreMaterialNames() {
98+
if (this == VeinType.NO_VEIN) {
99+
return new ArrayList<>(0);
100+
}
101+
96102
return oresAsSet.stream()
97103
.map(block -> block.material().name())
98104
.filter(Objects::nonNull)

src/main/java/com/sinthoras/visualprospecting/database/veintypes/VeinTypeCaching.java

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,16 @@
88
import com.google.common.collect.HashBiMap;
99
import com.sinthoras.visualprospecting.Tags;
1010
import com.sinthoras.visualprospecting.Utils;
11-
import gregtech.api.GregTech_API;
1211
import gregtech.api.enums.Materials;
13-
import gregtech.api.enums.OrePrefixes;
14-
import gregtech.api.util.GT_OreDictUnificator;
1512
import gregtech.common.GT_Worldgen_GT_Ore_Layer;
1613
import java.io.File;
1714
import java.util.*;
1815
import java.util.regex.Pattern;
1916

2017
import gregtech.common.blocks.GT_Block_Ore;
2118
import gregtech.common.blocks.GT_Block_Ore_Abstract;
22-
import net.minecraft.block.Block;
19+
2320
import net.minecraft.client.resources.I18n;
24-
import net.minecraft.item.ItemStack;
2521
import net.minecraft.util.EnumChatFormatting;
2622

2723
public class VeinTypeCaching implements Runnable {
@@ -33,15 +29,6 @@ public class VeinTypeCaching implements Runnable {
3329
public static Set<GT_Block_Ore> largeVeinOres;
3430
private static int longesOreName = 0;
3531

36-
public static GT_Block_Ore getBlockFromMaterial(Materials material) {
37-
38-
Block block = Block.getBlockFromItem(material.getBlocks(1).getItem());
39-
if (block instanceof GT_Block_Ore) {
40-
return (GT_Block_Ore) block;
41-
}
42-
return null;
43-
}
44-
4532
// BartWorks initializes veins in FML preInit
4633
// GalacticGreg initializes veins in FML postInit, but only copies all base game veins to make them available on all
4734
// planets
@@ -111,18 +98,6 @@ public void run() {
11198
}
11299
}
113100

114-
private Materials getGregTechMaterial(short metaId) {
115-
final Materials material = GregTech_API.sGeneratedMaterials[metaId];
116-
if (material == null) {
117-
// Some materials are not registered in dev when their usage mod is not available.
118-
return Materials.getAll().stream()
119-
.filter(m -> m.mMetaItemSubID == metaId)
120-
.findAny()
121-
.get();
122-
}
123-
return material;
124-
}
125-
126101
public static int getLongesOreNameLength() {
127102
return longesOreName;
128103
}

src/main/java/com/sinthoras/visualprospecting/integration/journeymap/drawsteps/OreVeinDrawStep.java

Lines changed: 53 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.sinthoras.visualprospecting.integration.journeymap.drawsteps;
22

3+
import com.google.common.collect.Table;
34
import com.sinthoras.visualprospecting.Config;
45
import com.sinthoras.visualprospecting.Tags;
56
import com.sinthoras.visualprospecting.integration.DrawUtils;
@@ -8,12 +9,20 @@
89
import java.awt.geom.Point2D;
910
import java.util.ArrayList;
1011
import java.util.List;
12+
13+
import gregtech.api.events.GT_OreVeinLocations;
1114
import journeymap.client.render.draw.DrawUtil;
1215
import journeymap.client.render.map.GridRenderer;
16+
17+
import net.minecraft.client.Minecraft;
1318
import net.minecraft.client.gui.FontRenderer;
1419
import net.minecraft.init.Blocks;
20+
import net.minecraft.util.EnumChatFormatting;
1521
import net.minecraft.util.IIcon;
1622
import net.minecraft.util.ResourceLocation;
23+
import net.minecraft.world.ChunkCoordIntPair;
24+
import net.minecraft.world.World;
25+
import net.minecraft.world.chunk.Chunk;
1726

1827
public class OreVeinDrawStep implements ClickableDrawStep {
1928

@@ -33,17 +42,58 @@ public OreVeinDrawStep(OreVeinLocation oreVeinLocation) {
3342
@Override
3443
public List<String> getTooltip() {
3544
final List<String> tooltip = new ArrayList<>();
45+
46+
int oreMax = 0;
47+
int oreCurrent = 0;
48+
49+
final int chunkX = this.oreVeinLocation.oreVeinPosition.chunkX;
50+
final int chunkZ = this.oreVeinLocation.oreVeinPosition.chunkZ;
51+
52+
Table<Integer, ChunkCoordIntPair, GT_OreVeinLocations.VeinData> map = GT_OreVeinLocations.RecordedOreVeinInChunk.get();
53+
54+
for (int i = chunkX - 1; i < chunkX + 1; i++) {
55+
for (int k = chunkZ - 1; k < chunkZ + 1; k++) {
56+
int dimId = this.oreVeinLocation.oreVeinPosition.dimensionId;
57+
58+
GT_OreVeinLocations.VeinData veinData = map.get(dimId, new ChunkCoordIntPair(i, k));
59+
60+
if (veinData == null) {
61+
continue;
62+
}
63+
64+
oreMax += veinData.oresPlaced;
65+
oreCurrent += veinData.oresCurrent;
66+
}
67+
}
68+
69+
double oreCount = 100D * oreCurrent / oreMax;
70+
3671
if (oreVeinLocation.isDepleted()) {
3772
tooltip.add(oreVeinLocation.getDepletedHint());
3873
}
74+
3975
if (oreVeinLocation.isActiveAsWaypoint()) {
4076
tooltip.add(oreVeinLocation.getActiveWaypointHint());
4177
}
78+
4279
tooltip.add(oreVeinLocation.getName());
43-
if (oreVeinLocation.isDepleted() == false) {
44-
tooltip.addAll(oreVeinLocation.getMaterialNames());
80+
81+
EnumChatFormatting color;
82+
if (oreCount > 50) {
83+
color = EnumChatFormatting.GREEN;
84+
} else if (oreCount > 25) {
85+
color = EnumChatFormatting.YELLOW;
86+
} else if (oreCount > 10) {
87+
color = EnumChatFormatting.GOLD;
88+
} else {
89+
color = EnumChatFormatting.RED;
4590
}
46-
tooltip.add(oreVeinLocation.getToggleDepletedHint());
91+
92+
tooltip.addAll(oreVeinLocation.getMaterialNames());
93+
94+
String format = "Ores: " + color + "%.02f%%";
95+
tooltip.add(String.format(format, oreCount));
96+
4797
return tooltip;
4898
}
4999

src/main/java/com/sinthoras/visualprospecting/integration/model/locations/OreVeinLocation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public class OreVeinLocation implements IWaypointAndLocationProvider {
1919
private static final String toggleDepletedHint = EnumChatFormatting.DARK_GRAY
2020
+ I18n.format("visualprospecting.node.deletehint", Keyboard.getKeyName(VP.keyAction.getKeyCode()));
2121

22-
private final OreVeinPosition oreVeinPosition;
22+
public final OreVeinPosition oreVeinPosition;
2323
private final String name;
2424
private final List<String> materialNames;
2525

src/main/java/com/sinthoras/visualprospecting/mixins/gregtech/GT_MetaTileEntity_AdvSeismicProspectorMixin.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,18 @@ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlaye
8282
provider.loadChunk(chunkCoordX,chunkCoordZ); // we load the chunk to make sure wqe have the data
8383
int dimId = aBaseMetaTileEntity.getWorld().provider.dimensionId;
8484
final GT_Worldgen_GT_Ore_Layer centerOreVeinPosition = GT_OreVeinLocations.getOreVeinInChunk(dimId, new ChunkCoordIntPair(chunkCoordX,chunkCoordZ));
85+
86+
VeinType veinType;
8587
if (centerOreVeinPosition != null) {
86-
VeinType veinType = VeinTypeCaching.getVeinType(centerOreVeinPosition.mWorldGenName);
87-
if (veinType != null) {
88-
if (aPlayer instanceof EntityPlayerMP)
89-
VP.network.sendTo(new ProspectingNotification(new OreVeinPosition(dimId,chunkCoordX,chunkCoordZ,veinType)), (EntityPlayerMP) aPlayer);
90-
}
88+
veinType = VeinTypeCaching.getVeinType(centerOreVeinPosition.mWorldGenName);
89+
} else {
90+
veinType = VeinType.NO_VEIN;
91+
}
92+
93+
if (aPlayer instanceof EntityPlayerMP) {
94+
OreVeinPosition position = new OreVeinPosition(dimId, chunkCoordX, chunkCoordZ, veinType);
95+
96+
VP.network.sendTo(new ProspectingNotification(position), (EntityPlayerMP) aPlayer);
9197
}
9298
}
9399
}

src/main/java/com/sinthoras/visualprospecting/mixins/gregtech/WorldGenContainerMixin.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.sinthoras.visualprospecting.Utils;
44
import com.sinthoras.visualprospecting.database.ServerCache;
5+
import gregtech.api.world.GT_Worldgen;
56
import gregtech.common.GT_Worldgen_GT_Ore_Layer;
67
import gregtech.common.GT_Worldgenerator;
78
import java.util.Random;
@@ -17,14 +18,11 @@ public class WorldGenContainerMixin {
1718
// Redirect both calls to ensure that Bartworks ore veins are captured as well
1819
@Redirect(
1920
method = "worldGenFindVein",
20-
at =
21-
@At(
22-
value = "INVOKE",
23-
target =
24-
"Lgregtech/common/GT_Worldgen_GT_Ore_Layer;executeWorldgenChunkified(Lnet/minecraft/world/World;Ljava/util/Random;Ljava/lang/String;IIIIILnet/minecraft/world/chunk/IChunkProvider;Lnet/minecraft/world/chunk/IChunkProvider;)I"),
21+
at = @At(value = "INVOKE",
22+
target = "Lgregtech/common/GT_Worldgen_GT_Ore_Layer;executeWorldgenChunkified(Lnet/minecraft/world/World;Ljava/util/Random;Ljava/lang/String;IIIIILnet/minecraft/world/chunk/IChunkProvider;Lnet/minecraft/world/chunk/IChunkProvider;)Lgregtech/api/world/GT_Worldgen$WorldGenResult;"),
2523
remap = false,
2624
require = 2)
27-
protected int onOreVeinPlaced(
25+
protected GT_Worldgen.WorldGenResult onOreVeinPlaced(
2826
GT_Worldgen_GT_Ore_Layer instance,
2927
World aWorld,
3028
Random aRandom,
@@ -36,7 +34,7 @@ protected int onOreVeinPlaced(
3634
int aSeedZ,
3735
IChunkProvider aChunkGenerator,
3836
IChunkProvider aChunkProvider) {
39-
final int result = instance.executeWorldgenChunkified(
37+
final GT_Worldgen.WorldGenResult result = instance.executeWorldgenChunkified(
4038
aWorld,
4139
aRandom,
4240
aBiome,
@@ -55,7 +53,7 @@ protected int onOreVeinPlaced(
5553
// instance.mWorldGenName,
5654
// result,aSeedX,aSeedZ,aWorld,instance);
5755
//
58-
if (result == GT_Worldgen_GT_Ore_Layer.ORE_PLACED && !instance.mWorldGenName.equals("NoOresInVein")) {
56+
if (result.status == GT_Worldgen.WorldGenStatus.ORE_PLACED && !instance.mWorldGenName.equals("NoOresInVein")) {
5957
ServerCache.instance.notifyOreVeinGeneration(
6058
aWorld.provider.dimensionId,
6159
Utils.coordBlockToChunk(aSeedX),

0 commit comments

Comments
 (0)