Skip to content

Commit

Permalink
Add FTB Chunks ore prospector compatibility (#2642)
Browse files Browse the repository at this point in the history
Co-authored-by: jtuc <6748724+jtuc@users.noreply.github.com>
  • Loading branch information
omergunr100 and jtuc authored Jan 4, 2025
1 parent a1622c1 commit 2d69fe3
Show file tree
Hide file tree
Showing 30 changed files with 915 additions and 16 deletions.
7 changes: 7 additions & 0 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ dependencies {
// FTB Teams
modCompileOnly(forge.ftbteams)
modCompileOnly(forge.ftblibrary)

// FTB Chunks
modCompileOnly(forge.ftbchunks)

// Argonauts
modCompileOnly(forge.argonauts)
Expand Down Expand Up @@ -101,6 +104,10 @@ dependencies {
modExtraRuntimeOnly(forge.xaerosminimap)
modExtraRuntimeOnly(forge.xaerosworldmap)
modExtraRuntimeOnly(forge.journeymap.forge)

modExtraRuntimeOnly(forge.ftblibrary)
modExtraRuntimeOnly(forge.ftbteams)
modExtraRuntimeOnly(forge.ftbchunks)

modExtraRuntimeOnly("top.theillusivec4.curios:curios-forge:${forge.versions.curios.get()}")
modExtraRuntimeOnly("curse.maven:spark-361579:4738952")
Expand Down
4 changes: 4 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ dependencyResolutionManagement {
def journeyMapApiVersion = "2.0.0"
def ftbteamsForgeFile = "5267190"
def ftblibraryForgeFile = "5567591"
def ftbchunksForgeFile = "5956390"
def argonautsForgeFile = "5263580"
def resourcefulForgeFile = "5659871"
def kffVersion = "4.11.0"
Expand Down Expand Up @@ -134,6 +135,9 @@ dependencyResolutionManagement {

def ftblibrary = version("ftblibrary", ftblibraryForgeFile)
library("ftblibrary", "curse.maven", "ftb-library-forge-404465").versionRef(ftblibrary)

def ftbchunks = version("ftbchunks", ftbchunksForgeFile)
library("ftbchunks", "curse.maven", "ftb-chunks-forge-314906").versionRef(ftbchunks)

def argonautslib = version("argonauts", argonautsForgeFile)
library("argonauts", "curse.maven", "argonauts-845833").versionRef(argonautslib)
Expand Down
7 changes: 7 additions & 0 deletions src/generated/resources/assets/gtceu/lang/en_ud.json
Original file line number Diff line number Diff line change
Expand Up @@ -1755,6 +1755,7 @@
"config.gtceu.option.euToFeRatio": "oıʇɐᴚǝℲo⟘nǝ",
"config.gtceu.option.feToEuRatio": "oıʇɐᴚnƎo⟘ǝɟ",
"config.gtceu.option.flintAndSteelRequireSteel": "ןǝǝʇSǝɹınbǝᴚןǝǝʇSpuⱯʇuıןɟ",
"config.gtceu.option.ftbChunksIntegration": "uoıʇɐɹbǝʇuIsʞunɥƆqʇɟ",
"config.gtceu.option.gameplay": "ʎɐןdǝɯɐb",
"config.gtceu.option.generateLowQualityGems": "sɯǝ⅁ʎʇıןɐnὉʍoꞀǝʇɐɹǝuǝb",
"config.gtceu.option.ghostCircuit": "ʇınɔɹıƆʇsoɥb",
Expand Down Expand Up @@ -1787,6 +1788,7 @@
"config.gtceu.option.inWorldPreviewDuration": "uoıʇɐɹnᗡʍǝıʌǝɹԀpןɹoMuı",
"config.gtceu.option.increaseDungeonLoot": "ʇooꞀuoǝbunᗡǝsɐǝɹɔuı",
"config.gtceu.option.infiniteBedrockOresFluids": "spınןℲsǝɹOʞɔoɹpǝᗺǝʇıuıɟuı",
"config.gtceu.option.journeyMapIntegration": "uoıʇɐɹbǝʇuIdɐWʎǝuɹnoظ",
"config.gtceu.option.largeBoilers": "sɹǝןıoᗺǝbɹɐן",
"config.gtceu.option.ldFluidPipeMinDistance": "ǝɔuɐʇsıᗡuıWǝdıԀpınןℲpן",
"config.gtceu.option.ldItemPipeMinDistance": "ǝɔuɐʇsıᗡuıWǝdıԀɯǝʇIpן",
Expand Down Expand Up @@ -1846,6 +1848,7 @@
"config.gtceu.option.surfaceRockProspectRange": "ǝbuɐᴚʇɔǝdsoɹԀʞɔoᴚǝɔɐɟɹns",
"config.gtceu.option.titaniumBoilerHeatSpeed": "pǝǝdSʇɐǝHɹǝןıoᗺɯnıuɐʇıʇ",
"config.gtceu.option.titaniumBoilerMaxTemperature": "ǝɹnʇɐɹǝdɯǝ⟘xɐWɹǝןıoᗺɯnıuɐʇıʇ",
"config.gtceu.option.toggle": "ǝןbboʇ",
"config.gtceu.option.toolCraftingSounds": "spunoSbuıʇɟɐɹƆןooʇ",
"config.gtceu.option.toolUseSounds": "spunoSǝs∩ןooʇ",
"config.gtceu.option.tools": "sןooʇ",
Expand All @@ -1865,6 +1868,7 @@
"config.gtceu.option.worldAcceleratorBlacklist": "ʇsıןʞɔɐןᗺɹoʇɐɹǝןǝɔɔⱯpןɹoʍ",
"config.gtceu.option.worldgen": "uǝbpןɹoʍ",
"config.gtceu.option.xOffset": "ʇǝsɟɟOx",
"config.gtceu.option.xaerosMapIntegration": "uoıʇɐɹbǝʇuIdɐWsoɹǝɐx",
"config.gtceu.option.yOffset": "ʇǝsɟɟOʎ",
"config.gtceu.option.zombieSpawnWithSabers": "sɹǝqɐSɥʇıMuʍɐdSǝıqɯoz",
"config.jade.plugin_gtceu.auto_output_info": "oɟuI ʇndʇnO oʇnⱯ ]nƎƆ⟘⅁[",
Expand Down Expand Up @@ -2139,7 +2143,9 @@
"gtceu.bus.collapse_false": "sɯǝʇI ǝsdɐןןoɔ ʇou ןןıʍ snᗺ",
"gtceu.bus.collapse_true": "sɯǝʇI ǝsdɐןןoɔ ןןıʍ snᗺ",
"gtceu.button.bedrock_fluids": "suıǝΛ pınןℲ ʞɔoɹpǝᗺ ʍoɥS",
"gtceu.button.hide_depleted": "suıǝΛ pǝʇǝןdǝᗡ ǝpıH",
"gtceu.button.ore_veins": "suıǝΛ ǝɹO ⟘⅁ ʍoɥS",
"gtceu.button.show_depleted": "suıǝΛ pǝʇǝןdǝᗡ ʍoɥS",
"gtceu.cable.amperage": "%dǝ§ :ǝbɐɹǝdɯⱯ xɐW",
"gtceu.cable.loss_per_block": "ʇןoΛ-∩Ǝ ㄥ§%dɔ§ :ǝɹǝdɯⱯ/ɹǝʇǝW/ssoꞀ",
"gtceu.cable.superconductor": "ɹoʇɔnpuoɔɹǝdnS %sp§",
Expand Down Expand Up @@ -2471,6 +2477,7 @@
"gtceu.jei.programmed_circuit": "ǝbɐԀ ʇınɔɹıƆ pǝɯɯɐɹboɹԀ",
"gtceu.journeymap.options.layers": "sɹǝʎɐן uoıʇɔǝdsoɹԀ",
"gtceu.journeymap.options.layers.bedrock_fluids": "suıǝΛ pınןℲ ʞɔoɹpǝᗺ ʍoɥS",
"gtceu.journeymap.options.layers.hide_depleted": "suıǝΛ pǝʇǝןdǝᗡ ǝpıH",
"gtceu.journeymap.options.layers.ore_veins": "suıǝΛ ǝɹO ʍoɥS",
"gtceu.key.armor_charging": "ǝןbbo⟘ ʎɹoʇuǝʌuI oʇ buıbɹɐɥƆ ɹoɯɹⱯ",
"gtceu.key.armor_hover": "ǝןbbo⟘ ɹǝʌoH ɹoɯɹⱯ",
Expand Down
7 changes: 7 additions & 0 deletions src/generated/resources/assets/gtceu/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -1755,6 +1755,7 @@
"config.gtceu.option.euToFeRatio": "euToFeRatio",
"config.gtceu.option.feToEuRatio": "feToEuRatio",
"config.gtceu.option.flintAndSteelRequireSteel": "flintAndSteelRequireSteel",
"config.gtceu.option.ftbChunksIntegration": "ftbChunksIntegration",
"config.gtceu.option.gameplay": "gameplay",
"config.gtceu.option.generateLowQualityGems": "generateLowQualityGems",
"config.gtceu.option.ghostCircuit": "ghostCircuit",
Expand Down Expand Up @@ -1787,6 +1788,7 @@
"config.gtceu.option.inWorldPreviewDuration": "inWorldPreviewDuration",
"config.gtceu.option.increaseDungeonLoot": "increaseDungeonLoot",
"config.gtceu.option.infiniteBedrockOresFluids": "infiniteBedrockOresFluids",
"config.gtceu.option.journeyMapIntegration": "journeyMapIntegration",
"config.gtceu.option.largeBoilers": "largeBoilers",
"config.gtceu.option.ldFluidPipeMinDistance": "ldFluidPipeMinDistance",
"config.gtceu.option.ldItemPipeMinDistance": "ldItemPipeMinDistance",
Expand Down Expand Up @@ -1846,6 +1848,7 @@
"config.gtceu.option.surfaceRockProspectRange": "surfaceRockProspectRange",
"config.gtceu.option.titaniumBoilerHeatSpeed": "titaniumBoilerHeatSpeed",
"config.gtceu.option.titaniumBoilerMaxTemperature": "titaniumBoilerMaxTemperature",
"config.gtceu.option.toggle": "toggle",
"config.gtceu.option.toolCraftingSounds": "toolCraftingSounds",
"config.gtceu.option.toolUseSounds": "toolUseSounds",
"config.gtceu.option.tools": "tools",
Expand All @@ -1865,6 +1868,7 @@
"config.gtceu.option.worldAcceleratorBlacklist": "worldAcceleratorBlacklist",
"config.gtceu.option.worldgen": "worldgen",
"config.gtceu.option.xOffset": "xOffset",
"config.gtceu.option.xaerosMapIntegration": "xaerosMapIntegration",
"config.gtceu.option.yOffset": "yOffset",
"config.gtceu.option.zombieSpawnWithSabers": "zombieSpawnWithSabers",
"config.jade.plugin_gtceu.auto_output_info": "[GTCEu] Auto Output Info",
Expand Down Expand Up @@ -2139,7 +2143,9 @@
"gtceu.bus.collapse_false": "Bus will not collapse Items",
"gtceu.bus.collapse_true": "Bus will collapse Items",
"gtceu.button.bedrock_fluids": "Show Bedrock Fluid Veins",
"gtceu.button.hide_depleted": "Hide Depleted Veins",
"gtceu.button.ore_veins": "Show GT Ore Veins",
"gtceu.button.show_depleted": "Show Depleted Veins",
"gtceu.cable.amperage": "Max Amperage: §e%d",
"gtceu.cable.loss_per_block": "Loss/Meter/Ampere: §c%d§7 EU-Volt",
"gtceu.cable.superconductor": "§d%s Superconductor",
Expand Down Expand Up @@ -2471,6 +2477,7 @@
"gtceu.jei.programmed_circuit": "Programmed Circuit Page",
"gtceu.journeymap.options.layers": "Prospection layers",
"gtceu.journeymap.options.layers.bedrock_fluids": "Show Bedrock Fluid Veins",
"gtceu.journeymap.options.layers.hide_depleted": "Hide Depleted Veins",
"gtceu.journeymap.options.layers.ore_veins": "Show Ore Veins",
"gtceu.key.armor_charging": "Armor Charging to Inventory Toggle",
"gtceu.key.armor_hover": "Armor Hover Toggle",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public static FluidInfo fromNbt(CompoundTag tag) {
Fluid fluid = BuiltInRegistries.FLUID.get(new ResourceLocation(tag.getString("fluid")));
int left = tag.getInt("left");
int yield = tag.getInt("yield");
return new FluidInfo(fluid, left, yield);
return new FluidInfo(fluid, yield, left);
}

public CompoundTag toNbt() {
Expand All @@ -199,8 +199,8 @@ public void scan(FluidInfo[][][] storage, LevelChunk chunk) {
var left = 100 * fluidVein.getOperationsRemaining() /
BedrockFluidVeinSavedData.MAXIMUM_VEIN_OPERATIONS;
storage[0][0] = new FluidInfo[] {
new FluidInfo(fluidVein.getDefinition().getStoredFluid().get(), left,
fluidVein.getFluidYield()),
new FluidInfo(fluidVein.getDefinition().getStoredFluid().get(), fluidVein.getFluidYield(),
left),
};
}
}
Expand Down Expand Up @@ -233,8 +233,8 @@ public String getUniqueID(FluidInfo item) {
@Override
public void serialize(FluidInfo item, FriendlyByteBuf buf) {
buf.writeUtf(BuiltInRegistries.FLUID.getKey(item.fluid).toString());
buf.writeVarInt(item.left);
buf.writeVarInt(item.yield);
buf.writeVarInt(item.left);
}

@Override
Expand Down
12 changes: 12 additions & 0 deletions src/main/java/com/gregtechceu/gtceu/client/ClientProxy.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.gregtechceu.gtceu.client;

import com.gregtechceu.gtceu.api.GTValues;
import com.gregtechceu.gtceu.api.data.worldgen.GTOreDefinition;
import com.gregtechceu.gtceu.api.data.worldgen.bedrockfluid.BedrockFluidDefinition;
import com.gregtechceu.gtceu.api.data.worldgen.bedrockore.BedrockOreDefinition;
Expand All @@ -11,8 +12,10 @@
import com.gregtechceu.gtceu.common.data.GTEntityTypes;
import com.gregtechceu.gtceu.common.data.GTParticleTypes;
import com.gregtechceu.gtceu.common.entity.GTBoat;
import com.gregtechceu.gtceu.config.ConfigHolder;
import com.gregtechceu.gtceu.integration.map.ClientCacheManager;
import com.gregtechceu.gtceu.integration.map.cache.client.GTClientCache;
import com.gregtechceu.gtceu.integration.map.ftbchunks.FTBChunksPlugin;
import com.gregtechceu.gtceu.integration.map.layer.Layers;
import com.gregtechceu.gtceu.integration.map.layer.builtin.FluidRenderLayer;
import com.gregtechceu.gtceu.integration.map.layer.builtin.OreRenderLayer;
Expand All @@ -32,6 +35,7 @@
import net.minecraftforge.client.event.RegisterKeyMappingsEvent;
import net.minecraftforge.client.event.RegisterParticleProvidersEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;

import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
Expand Down Expand Up @@ -93,4 +97,12 @@ public void onRegisterGuiOverlays(RegisterGuiOverlaysEvent event) {
public void onRegisterParticleProviders(RegisterParticleProvidersEvent event) {
event.registerSpriteSet(GTParticleTypes.HAZARD_PARTICLE.get(), HazardParticle.Provider::new);
}

@SubscribeEvent
public void onClientSetup(FMLClientSetupEvent event) {
if (ConfigHolder.INSTANCE.compat.minimap.toggle.ftbChunksIntegration &&
Platform.isModLoaded(GTValues.MODID_FTB_CHUNKS)) {
FTBChunksPlugin.addEventListeners();
}
}
}
21 changes: 20 additions & 1 deletion src/main/java/com/gregtechceu/gtceu/config/ConfigHolder.java
Original file line number Diff line number Diff line change
Expand Up @@ -211,12 +211,16 @@ public static class AE2CompatConfig {

public static class MinimapCompatConfig {

@Configurable
@Configurable.Comment({
"Toggle specific map mod integration on/off (need to restart for this to take effect)" })
public Toggle toggle = new Toggle();

@Configurable
@Configurable.Comment({ "The radius, in blocks, that picking up a surface rock will search for veins in.",
"-1 to disable.", "Default: 24" })
@Configurable.Range(min = 1)
public int surfaceRockProspectRange = 24;

@Configurable
@Configurable.Comment({ "The radius, in blocks, that clicking an ore block will search for veins in.",
"-1 to disable", "Default: 24" })
Expand Down Expand Up @@ -264,6 +268,21 @@ public static class MinimapCompatConfig {
"Default: true" })
public boolean rightToolbar = true;

public static class Toggle {

@Configurable
@Configurable.Comment({ "FTB Chunks integration enabled" })
public boolean ftbChunksIntegration = false;

@Configurable
@Configurable.Comment({ "Journey Map integration enabled" })
public boolean journeyMapIntegration = true;

@Configurable
@Configurable.Comment({ "Xaerox's map integration enabled" })
public boolean xaerosMapIntegration = true;
}

public enum Anchor {

TOP_LEFT,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
package com.gregtechceu.gtceu.core.mixins.ftbchunks;

import com.gregtechceu.gtceu.integration.map.ftbchunks.veins.fluid.FluidVeinIcon;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.world.phys.Vec3;

import com.llamalad7.mixinextras.sugar.Local;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.BufferBuilder;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.Tesselator;
import com.mojang.math.Axis;
import dev.ftb.mods.ftbchunks.api.client.icon.MapIcon;
import dev.ftb.mods.ftbchunks.client.FTBChunksClient;
import dev.ftb.mods.ftbchunks.client.MinimapBlurMode;
import dev.ftb.mods.ftbchunks.client.MinimapPosition;
import dev.ftb.mods.ftbchunks.client.map.MapDimension;
import org.joml.Matrix4f;
import org.lwjgl.opengl.GL11;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyVariable;
import org.spongepowered.asm.mixin.injection.Slice;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;

import java.util.Iterator;

@Mixin(value = FTBChunksClient.class)
public class FTBChunksClientMixin {

@Unique
private boolean gtceu$iconCheck;
@Unique
private double gtceu$d;
@Unique
private float gtceu$minimapRotation;

@Inject(method = "renderHud",
at = @At(value = "INVOKE",
target = "Lcom/mojang/blaze3d/vertex/PoseStack;scale(FFF)V",
shift = At.Shift.AFTER),
slice = @Slice(from = @At(value = "INVOKE",
target = "Ldev/ftb/mods/ftbchunks/api/client/icon/MapIcon;getPos(F)Lnet/minecraft/world/phys/Vec3;"),
to = @At(value = "INVOKE",
target = "Ldev/ftb/mods/ftbchunks/api/client/icon/MapIcon;draw(Ldev/ftb/mods/ftbchunks/api/client/icon/MapType;Lnet/minecraft/client/gui/GuiGraphics;IIIIZI)V")))
private void gtceu$injectRenderHud(GuiGraphics graphics, float tickDelta, CallbackInfo ci, @Local MapIcon icon) {
if (gtceu$iconCheck) {
RenderSystem.enableDepthTest();
RenderSystem.depthFunc(GL11.GL_GEQUAL);
var poseStack = graphics.pose();
poseStack.rotateAround(Axis.ZP.rotationDegrees(gtceu$minimapRotation + 180f), 0.5f, 0.5f, 0);
poseStack.scale(1.143f, 1.143f, 0);
}
}

@Inject(method = "renderHud",
at = @At(value = "INVOKE",
target = "Ldev/ftb/mods/ftbchunks/api/client/icon/MapIcon;isVisible(Ldev/ftb/mods/ftbchunks/api/client/icon/MapType;DZ)Z",
shift = At.Shift.AFTER),
remap = false,
locals = LocalCapture.CAPTURE_FAILSOFT)
private void gtceu$saveLocals(GuiGraphics graphics, float tickDelta, CallbackInfo ci, Minecraft mc,
double playerX, double playerY, double playerZ, double guiScale,
int scaledWidth, int scaledHeight, MapDimension dim, long now, float zoom0,
float zoom, MinimapBlurMode blurMode, boolean minimapBlur, int filter, int cx,
int cz, float scale, boolean rotationLocked, float minimapRotation, int size,
double halfSizeD, float halfSizeF, MinimapPosition minimapPosition, int x,
int y, int offsetX, int offsetY,
MinimapPosition.MinimapOffsetConditional offsetConditional, float border,
int alpha, Tesselator tessellator, BufferBuilder buffer, PoseStack poseStack,
Matrix4f m, float halfSizeBorderF, float offX, float offZ, float zws,
Iterator var47, MapIcon icon, Vec3 pos, double distance, double d) {
gtceu$iconCheck = icon instanceof FluidVeinIcon;
gtceu$d = d;
gtceu$minimapRotation = minimapRotation;
}

@ModifyVariable(method = "renderHud",
name = "d",
at = @At(value = "STORE"),
slice = @Slice(from = @At(value = "INVOKE",
target = "Ldev/ftb/mods/ftbchunks/api/client/icon/MapIcon;isVisible(Ldev/ftb/mods/ftbchunks/api/client/icon/MapType;DZ)Z"),
to = @At(value = "INVOKE",
target = "Ldev/ftb/mods/ftbchunks/api/client/icon/MapIcon;getIconScale(Ldev/ftb/mods/ftbchunks/api/client/icon/MapType;)D")),
remap = false)
private double gtceu$valueLoad(double d) {
if (gtceu$iconCheck) {
return gtceu$d;
}
return d;
}

@Inject(method = "renderHud",
at = @At(value = "INVOKE",
target = "Ldev/ftb/mods/ftbchunks/api/client/icon/MapIcon;draw(Ldev/ftb/mods/ftbchunks/api/client/icon/MapType;Lnet/minecraft/client/gui/GuiGraphics;IIIIZI)V",
shift = At.Shift.AFTER),
remap = false)
private void gtceu$injectRenderHudPost(GuiGraphics graphics, float tickDelta, CallbackInfo ci,
@Local MapIcon icon) {
if (gtceu$iconCheck) {
RenderSystem.disableDepthTest();
RenderSystem.depthFunc(GL11.GL_LEQUAL);
}
}
}
Loading

0 comments on commit 2d69fe3

Please sign in to comment.