aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dependencies.gradle1
-rw-r--r--src/main/java/gregtech/common/items/GT_AdvancedSensorCard_Item.java5
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java57
-rw-r--r--src/main/java/gregtech/crossmod/visualprospecting/GT_VisualProspecting_Database.java25
-rw-r--r--src/main/java/gregtech/crossmod/visualprospecting/IDatabase.java10
-rw-r--r--src/main/resources/assets/gregtech/lang/en_US.lang1
6 files changed, 94 insertions, 5 deletions
diff --git a/dependencies.gradle b/dependencies.gradle
index b9e9032bfb..79032c5449 100644
--- a/dependencies.gradle
+++ b/dependencies.gradle
@@ -47,6 +47,7 @@ dependencies {
api('com.github.GTNewHorizons:Yamcl:0.6.0:dev')
api('com.github.GTNewHorizons:ThaumicTinkerer:2.10.1:dev')
api("com.github.GTNewHorizons:Mobs-Info:0.3.2-GTNH:dev")
+ api("com.github.GTNewHorizons:Navigator:1.0.5:dev")
devOnlyNonPublishable("com.github.GTNewHorizons:Infernal-Mobs:1.8.1-GTNH:dev")
runtimeOnly("com.github.GTNewHorizons:Draconic-Evolution:1.3.6-GTNH:dev") // needed?
diff --git a/src/main/java/gregtech/common/items/GT_AdvancedSensorCard_Item.java b/src/main/java/gregtech/common/items/GT_AdvancedSensorCard_Item.java
index ae64bea432..723a7ffad5 100644
--- a/src/main/java/gregtech/common/items/GT_AdvancedSensorCard_Item.java
+++ b/src/main/java/gregtech/common/items/GT_AdvancedSensorCard_Item.java
@@ -172,7 +172,10 @@ public class GT_AdvancedSensorCard_Item extends Item implements IPanelDataSource
final List<String> payload = builder.build();
card.setInt(OUTPUT_ENTRY_LENGTH_KEY, payload.size());
for (int i = 0; i < payload.size(); i++) {
- card.setString(String.format(OUTPUT_ENTRY_KEY, i), payload.get(i));
+ final String payloadItem = payload.get(i);
+ if (!payloadItem.isEmpty()) {
+ card.setString(String.format(OUTPUT_ENTRY_KEY, i), payloadItem);
+ }
}
});
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java
index 9c15d2b6eb..b60bac4f84 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OreDrillingPlantBase.java
@@ -59,6 +59,7 @@ import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
import gregtech.common.blocks.GT_Block_Ores_Abstract;
import gregtech.common.blocks.GT_TileEntity_Ores;
+import gregtech.crossmod.visualprospecting.GT_VisualProspecting_Database;
public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTileEntity_DrillerBase
implements IMetricsExporter {
@@ -80,6 +81,9 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile
/** Used to drive the drill's y-level in the UI. */
private int clientYHead = 0;
+ /** Contains the name of the currently mined vein. Used for driving metrics cover output. */
+ private String veinName = null;
+
GT_MetaTileEntity_OreDrillingPlantBase(int aID, String aName, String aNameRegional) {
super(aID, aName, aNameRegional);
}
@@ -93,6 +97,11 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile
super.saveNBTData(aNBT);
aNBT.setInteger("chunkRadiusConfig", chunkRadiusConfig);
aNBT.setBoolean("replaceWithCobblestone", replaceWithCobblestone);
+ if (veinName != null) {
+ aNBT.setString("veinName", veinName);
+ } else if (aNBT.hasKey("veinName")) {
+ aNBT.removeTag("veinName");
+ }
}
@Override
@@ -104,6 +113,11 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile
if (aNBT.hasKey("replaceWithCobblestone")) {
replaceWithCobblestone = aNBT.getBoolean("replaceWithCobblestone");
}
+ if (aNBT.hasKey("veinName")) {
+ veinName = aNBT.getString("veinName");
+ } else {
+ veinName = null;
+ }
}
private void adjustChunkRadius(boolean increase) {
@@ -163,6 +177,10 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile
}
fillMineListIfEmpty(xDrill, yDrill, zDrill, xPipe, zPipe, yHead);
if (oreBlockPositions.isEmpty()) {
+ if (veinName == null) {
+ updateVeinNameFromVP(getDrillCoords());
+ }
+
switch (tryLowerPipeState()) {
case 2 -> {
mMaxProgresstime = 0;
@@ -285,7 +303,10 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile
fillChunkMineList(yHead, yDrill);
if (oreBlockPositions.isEmpty()) {
GT_ChunkManager.releaseChunk((TileEntity) getBaseMetaTileEntity(), mCurrentChunk);
- if (!moveToNextChunk(xDrill >> 4, zDrill >> 4)) workState = STATE_UPWARD;
+ if (!moveToNextChunk(xDrill >> 4, zDrill >> 4)) {
+ workState = STATE_UPWARD;
+ updateVeinNameFromVP();
+ }
return true;
}
}
@@ -294,6 +315,7 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile
private void createInitialWorkingChunk() {
mCurrentChunk = getTopLeftChunkCoords();
+ updateVeinNameFromVP();
if (mChunkLoadingEnabled) {
GT_ChunkManager.requestChunkLoad((TileEntity) getBaseMetaTileEntity(), mCurrentChunk);
mWorkChunkNeedsReload = false;
@@ -394,6 +416,7 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile
GT_ChunkManager.releaseChunk((TileEntity) getBaseMetaTileEntity(), mCurrentChunk);
}
mCurrentChunk = null;
+ updateVeinNameFromVP();
}
private boolean moveToNextChunk(int centerX, int centerZ) {
@@ -425,12 +448,25 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile
mCurrentChunk = null;
return false;
}
+
mCurrentChunk = new ChunkCoordIntPair(nextChunkX, nextChunkZ);
+ updateVeinNameFromVP();
+
GT_ChunkManager
.requestChunkLoad((TileEntity) getBaseMetaTileEntity(), new ChunkCoordIntPair(nextChunkX, nextChunkZ));
return true;
}
+ private void updateVeinNameFromVP() {
+ updateVeinNameFromVP(mCurrentChunk);
+ }
+
+ private void updateVeinNameFromVP(@NotNull ChunkCoordIntPair coords) {
+ veinName = GT_VisualProspecting_Database
+ .getVeinName(getBaseMetaTileEntity().getWorld().provider.dimensionId, coords)
+ .orElse(null);
+ }
+
@Override
protected boolean checkHatches() {
return !mMaintenanceHatches.isEmpty() && !mInputHatches.isEmpty()
@@ -635,11 +671,20 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile
.setEnabled(
widget -> getBaseMetaTileEntity().isActive() && clientCurrentChunk > 0
&& workState == STATE_AT_BOTTOM))
+ .widget(
+ new TextWidget()
+ .setStringSupplier(
+ () -> EnumChatFormatting.GRAY
+ + StatCollector.translateToLocalFormatted("GT5U.gui.text.drill_current_vein", veinName))
+ .setTextAlignment(Alignment.CenterLeft)
+ .setEnabled(
+ widget -> veinName != null && (workState == STATE_AT_BOTTOM || workState == STATE_DOWNWARD)))
.widget(new FakeSyncWidget.IntegerSyncer(oreBlockPositions::size, (newInt) -> clientOreListSize = newInt))
.widget(new FakeSyncWidget.IntegerSyncer(this::getTotalChunkCount, (newInt) -> clientTotalChunks = newInt))
.widget(new FakeSyncWidget.IntegerSyncer(this::getChunkNumber, (newInt) -> clientCurrentChunk = newInt))
.widget(new FakeSyncWidget.IntegerSyncer(() -> workState, (newInt) -> workState = newInt))
- .widget(new FakeSyncWidget.IntegerSyncer(this::getYHead, (newInt) -> clientYHead = newInt));
+ .widget(new FakeSyncWidget.IntegerSyncer(this::getYHead, (newInt) -> clientYHead = newInt))
+ .widget(new FakeSyncWidget.StringSyncer(() -> veinName, (newString) -> veinName = newString));
}
@Override
@@ -719,12 +764,16 @@ public abstract class GT_MetaTileEntity_OreDrillingPlantBase extends GT_MetaTile
StatCollector.translateToLocalFormatted(
"GT5U.gui.text.drill_chunks_left",
GT_Utility.formatNumbers(getChunkNumber()),
- GT_Utility.formatNumbers(getTotalChunkCount())));
+ GT_Utility.formatNumbers(getTotalChunkCount())),
+ veinName == null ? ""
+ : StatCollector.translateToLocalFormatted("GT5U.gui.text.drill_current_vein", veinName));
case STATE_DOWNWARD -> ImmutableList.of(
StatCollector.translateToLocalFormatted(
"GT5U.gui.text.drill_ores_left_layer",
getYHead(),
- GT_Utility.formatNumbers(oreBlockPositions.size())));
+ GT_Utility.formatNumbers(oreBlockPositions.size())),
+ veinName == null ? ""
+ : StatCollector.translateToLocalFormatted("GT5U.gui.text.drill_current_vein", veinName));
case STATE_UPWARD, STATE_ABORT -> ImmutableList
.of(StatCollector.translateToLocal("GT5U.gui.text.retracting_pipe"));
diff --git a/src/main/java/gregtech/crossmod/visualprospecting/GT_VisualProspecting_Database.java b/src/main/java/gregtech/crossmod/visualprospecting/GT_VisualProspecting_Database.java
new file mode 100644
index 0000000000..f18700f9ea
--- /dev/null
+++ b/src/main/java/gregtech/crossmod/visualprospecting/GT_VisualProspecting_Database.java
@@ -0,0 +1,25 @@
+package gregtech.crossmod.visualprospecting;
+
+import java.util.Optional;
+
+import javax.annotation.Nullable;
+
+import net.minecraft.world.ChunkCoordIntPair;
+
+public class GT_VisualProspecting_Database {
+
+ private static IDatabase database;
+
+ @SuppressWarnings("unused")
+ public static void registerDatabase(IDatabase aDatabase) {
+ database = aDatabase;
+ }
+
+ public static Optional<String> getVeinName(int dimensionId, @Nullable ChunkCoordIntPair coordinates) {
+ if (database == null || coordinates == null) {
+ return Optional.empty();
+ }
+
+ return database.getVeinName(dimensionId, coordinates);
+ }
+}
diff --git a/src/main/java/gregtech/crossmod/visualprospecting/IDatabase.java b/src/main/java/gregtech/crossmod/visualprospecting/IDatabase.java
new file mode 100644
index 0000000000..512958c0b2
--- /dev/null
+++ b/src/main/java/gregtech/crossmod/visualprospecting/IDatabase.java
@@ -0,0 +1,10 @@
+package gregtech.crossmod.visualprospecting;
+
+import java.util.Optional;
+
+import net.minecraft.world.ChunkCoordIntPair;
+
+public interface IDatabase {
+
+ Optional<String> getVeinName(int dimensionId, ChunkCoordIntPair coordinates);
+}
diff --git a/src/main/resources/assets/gregtech/lang/en_US.lang b/src/main/resources/assets/gregtech/lang/en_US.lang
index b670a6f8c1..e6b7acac5a 100644
--- a/src/main/resources/assets/gregtech/lang/en_US.lang
+++ b/src/main/resources/assets/gregtech/lang/en_US.lang
@@ -522,6 +522,7 @@ GT5U.gui.text.internal_error=§4Recipe was found, but had internal error
GT5U.gui.text.drill_ores_left_chunk=Ores left in current chunk: §a%s
GT5U.gui.text.drill_ores_left_layer=Ores left at y-level %s: §a%s
GT5U.gui.text.drill_chunks_left=Drilling chunk: §a%s / %s
+GT5U.gui.text.drill_current_vein=Current Vein: §a%s
GT5U.gui.text.drill_offline_reason=Drill Offline: %s
GT5U.gui.text.drill_offline_generic=Drill Offline
GT5U.gui.text.stocking_bus_fail_extraction=§4Failed to extract expected amount of items from stocking bus. This can be caused by attaching multiple storage buses to the same inventory.