Skip to content

Commit

Permalink
fix some issues with fluid drilling rigs (#970) + add extra tooltips (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
screret authored Mar 22, 2024
1 parent 7f93eef commit 3aa61b2
Show file tree
Hide file tree
Showing 15 changed files with 88 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@
],
"page": "gtceu:generation/andesite",
"position": [
-100,
100
-200,
50
],
"pre_nodes": [
"gtceu:generation/ore"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@
],
"page": "gtceu:generation/basalt",
"position": [
-100,
150
-150,
50
],
"pre_nodes": [
"gtceu:generation/ore"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
],
"page": "gtceu:generation/deepslate",
"position": [
-200,
-100,
150
],
"pre_nodes": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
],
"page": "gtceu:generation/diorite",
"position": [
-150,
-200,
100
],
"pre_nodes": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@
],
"page": "gtceu:generation/endstone",
"position": [
-50,
50
-100,
100
],
"pre_nodes": [
"gtceu:generation/ore"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@
],
"page": "gtceu:generation/granite",
"position": [
-200,
100
-150,
150
],
"pre_nodes": [
"gtceu:generation/ore"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@
],
"page": "gtceu:generation/netherrack",
"position": [
-50,
150
-150,
100
],
"pre_nodes": [
"gtceu:generation/ore"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
],
"page": "gtceu:generation/red_sand",
"position": [
-150,
-50,
150
],
"pre_nodes": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
],
"page": "gtceu:generation/sand",
"position": [
-100,
-50,
50
],
"pre_nodes": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
],
"page": "gtceu:generation/stone",
"position": [
-200,
-100,
50
],
"pre_nodes": [
Expand Down
11 changes: 9 additions & 2 deletions src/generated/resources/assets/gtceu/lang/en_ud.json
Original file line number Diff line number Diff line change
Expand Up @@ -1545,12 +1545,14 @@
"compass.node.gtceu.materials/block": "ʞɔoןᗺ",
"compass.node.gtceu.materials/bolt": "ʇןoᗺ",
"compass.node.gtceu.materials/chainsaw_head": "pɐǝH ʍɐsuıɐɥƆ",
"compass.node.gtceu.materials/chipped_gem": "ɯǝ⅁ pǝddıɥƆ",
"compass.node.gtceu.materials/crushed_ore": "ǝɹO pǝɥsnɹƆ",
"compass.node.gtceu.materials/dense_plate": "ǝʇɐןԀ ǝsuǝᗡ",
"compass.node.gtceu.materials/double_plate": "ǝʇɐןԀ ǝןqnoᗡ",
"compass.node.gtceu.materials/dust": "ʇsnᗡ",
"compass.node.gtceu.materials/exquisite_gem": "ɯǝ⅁ ǝʇısınbxƎ",
"compass.node.gtceu.materials/fine_wire": "ǝɹıM ǝuıℲ",
"compass.node.gtceu.materials/flawed_gem": "ɯǝ⅁ pǝʍɐןℲ",
"compass.node.gtceu.materials/flawless_gem": "ɯǝ⅁ ssǝןʍɐןℲ",
"compass.node.gtceu.materials/foil": "ןıoℲ",
"compass.node.gtceu.materials/frame": "ǝɯɐɹℲ",
Expand Down Expand Up @@ -2966,6 +2968,11 @@
"gtceu.multiblock.distillation_tower.distilling_fluid": "%s buıןןıʇsıᗡ",
"gtceu.multiblock.electric_blast_furnace.description": "˙ʎoןןɐ ɥɐpɐnbɐu puɐ 'ɯnıuɐʇıʇ 'ןǝǝʇs ssǝןuıɐʇs 'ɯnıuıɯnןɐ sɐ ɥɔns 'sןɐʇǝɯ puɐ sʎoןןɐ ɹǝıʇ-ɥbıɥ buıuıɐʇqo ɹoɟ pǝɹınbǝɹ sı ʇI ˙sǝɹo buıuıɟǝɹ puɐ sןɐʇǝɯ buıʞooɔ 'sʎoןןɐ buıʇןǝɯs ɹoɟ pǝsn ǝɹnʇɔnɹʇs ʞɔoןqıʇןnɯ ɐ sı )ℲᗺƎ( ǝɔɐuɹnℲ ʇsɐןᗺ ɔıɹʇɔǝןƎ ǝɥ⟘",
"gtceu.multiblock.extreme_combustion_engine.description": "˙ɹǝʍod ΛI ɹoɟ ɹoʇɐɹǝuǝ⅁ uoıʇsnqɯoƆ ɐ sɐ sʇɔɐ ʇɐɥʇ ǝɹnʇɔnɹʇs ʞɔoןqıʇןnɯ ɐ sı ǝuıbuƎ uoıʇsnqɯoƆ ǝɯǝɹʇxƎ ǝɥ⟘",
"gtceu.multiblock.fluid_rig.drilled_fluid": "%s :pınןℲ",
"gtceu.multiblock.fluid_rig.fluid_amount": "%s :ǝʇɐᴚ buıdɯnԀ",
"gtceu.multiblock.fluid_rig.no_fluid_in_area": "˙ɐǝɹⱯ uı ǝuoN",
"gtceu.multiblock.fluid_rig.vein_depleted": "˙pǝʇǝןdǝᗡ uıǝΛ",
"gtceu.multiblock.fluid_rig.vein_depletion": "%s :ǝzıS uıǝΛ",
"gtceu.multiblock.fusion_reactor.energy": "%d / %d :∩Ǝ",
"gtceu.multiblock.fusion_reactor.heat": "%d :ʇɐǝH",
"gtceu.multiblock.fusion_reactor.luv.description": "˙W09Ɩ ɟo ɯnɯıxɐɯ ɐ sɐɥ puɐ '∩Ǝ W0Ɩ ʎq sǝsɐǝɹɔuı ɹǝɟɟnq sʇı 'sɐɥ ʇı ɥɔʇɐH ʎɹǝʌǝ ɹoℲ ˙sǝɥɔʇɐH ʎbɹǝuƎ Λ∩ puɐ 'WԀZ 'ΛnꞀ ǝsn ʎןuo uɐɔ ʇI ˙sǝuo ɹǝıʌɐǝɥ oʇuı sʇuǝɯǝןǝ buısnɟ ɹoɟ pǝsn ǝɹnʇɔnɹʇs ʞɔoןqıʇןnɯ ǝbɹɐן ɐ sı Ɩ ʞW ɹoʇɔɐǝᴚ uoısnℲ ǝɥ⟘",
Expand Down Expand Up @@ -4919,9 +4926,9 @@
"metaitem.cover.digital.wireless.tooltip.1": "˙ʇı oʇ puıq ʎןǝʇoɯǝɹ oʇ ㄥ§ɹoʇıuoW ןɐɹʇuǝƆɟ§ ǝɥʇ uo ㄥ§ʞɔıןƆ ʇɥbıᴚɟ§",
"metaitem.cover.digital.wireless.tooltip.2": "˙buıpuıq ʇuǝɹɹnɔ ǝɥʇ ǝʌoɯǝɹ oʇ ㄥ§ʞɔıןƆ ʇɥbıᴚ ʞɐǝuSɟ§",
"metaitem.cover.digital.wireless.tooltip.3": "%sɟ§ :buıpuıᗺɐ§",
"metaitem.crushed.tooltip.purify": "ǝɹO pǝıɟıɹnԀ ʇǝb oʇ uoɹpןnɐƆ oʇuı ʍoɹɥ⟘",
"metaitem.crushed.tooltip.purify": "ǝɹO pǝıɟıɹnԀ ʇǝb oʇ uoɹpןnɐƆ ɐ ʞɔıןɔ ʇɥbıᴚ",
"metaitem.debug_scanner.tooltip": "ɹǝpɹoɔıɹ⟘",
"metaitem.dust.tooltip.purify": "ʇsnᗡ uɐǝןɔ ʇǝb oʇ uoɹpןnɐƆ oʇuı ʍoɹɥ⟘",
"metaitem.dust.tooltip.purify": "ʇsnᗡ uɐǝןɔ ʇǝb oʇ uoɹpןnɐƆ ɐ ʞɔıןɔ ʇɥbıᴚ",
"metaitem.electric.discharge_mode.disabled": "pǝןqɐsıᗡ ǝpoW ǝbɹɐɥɔsıᗡǝ§",
"metaitem.electric.discharge_mode.enabled": "pǝןqɐuƎ ǝpoW ǝbɹɐɥɔsıᗡǝ§",
"metaitem.electric.discharge_mode.tooltip": "ǝpoɯ ǝbɹɐɥɔsıp ǝןbboʇ oʇ buıʞɐǝus ǝןıɥʍ ǝs∩",
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 @@ -1545,12 +1545,14 @@
"compass.node.gtceu.materials/block": "Block",
"compass.node.gtceu.materials/bolt": "Bolt",
"compass.node.gtceu.materials/chainsaw_head": "Chainsaw Head",
"compass.node.gtceu.materials/chipped_gem": "Chipped Gem",
"compass.node.gtceu.materials/crushed_ore": "Crushed Ore",
"compass.node.gtceu.materials/dense_plate": "Dense Plate",
"compass.node.gtceu.materials/double_plate": "Double Plate",
"compass.node.gtceu.materials/dust": "Dust",
"compass.node.gtceu.materials/exquisite_gem": "Exquisite Gem",
"compass.node.gtceu.materials/fine_wire": "Fine Wire",
"compass.node.gtceu.materials/flawed_gem": "Flawed Gem",
"compass.node.gtceu.materials/flawless_gem": "Flawless Gem",
"compass.node.gtceu.materials/foil": "Foil",
"compass.node.gtceu.materials/frame": "Frame",
Expand Down Expand Up @@ -2966,6 +2968,11 @@
"gtceu.multiblock.distillation_tower.distilling_fluid": "Distilling %s",
"gtceu.multiblock.electric_blast_furnace.description": "The Electric Blast Furnace (EBF) is a multiblock structure used for smelting alloys, cooking metals and refining ores. It is required for obtaining high-tier alloys and metals, such as aluminium, stainless steel, titanium, and naquadah alloy.",
"gtceu.multiblock.extreme_combustion_engine.description": "The Extreme Combustion Engine is a multiblock structure that acts as a Combustion Generator for IV power.",
"gtceu.multiblock.fluid_rig.drilled_fluid": "Fluid: %s",
"gtceu.multiblock.fluid_rig.fluid_amount": "Pumping Rate: %s",
"gtceu.multiblock.fluid_rig.no_fluid_in_area": "None in Area.",
"gtceu.multiblock.fluid_rig.vein_depleted": "Vein Depleted.",
"gtceu.multiblock.fluid_rig.vein_depletion": "Vein Size: %s",
"gtceu.multiblock.fusion_reactor.energy": "EU: %d / %d",
"gtceu.multiblock.fusion_reactor.heat": "Heat: %d",
"gtceu.multiblock.fusion_reactor.luv.description": "The Fusion Reactor MK 1 is a large multiblock structure used for fusing elements into heavier ones. It can only use LuV, ZPM, and UV Energy Hatches. For every Hatch it has, its buffer increases by 10M EU, and has a maximum of 160M.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,30 @@

import com.gregtechceu.gtceu.GTCEu;
import com.gregtechceu.gtceu.api.GTValues;
import com.gregtechceu.gtceu.api.capability.IEnergyContainer;
import com.gregtechceu.gtceu.api.capability.recipe.EURecipeCapability;
import com.gregtechceu.gtceu.api.capability.recipe.IO;
import com.gregtechceu.gtceu.api.data.tag.TagPrefix;
import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity;
import com.gregtechceu.gtceu.api.machine.feature.ITieredMachine;
import com.gregtechceu.gtceu.api.machine.multiblock.WorkableElectricMultiblockMachine;
import com.gregtechceu.gtceu.api.machine.trait.RecipeLogic;
import com.gregtechceu.gtceu.api.misc.EnergyContainerList;
import com.gregtechceu.gtceu.common.data.GTBlocks;
import com.gregtechceu.gtceu.common.data.GTMaterials;
import com.gregtechceu.gtceu.common.machine.trait.FluidDrillLogic;
import com.gregtechceu.gtceu.utils.FormattingUtil;
import com.gregtechceu.gtceu.utils.GTUtil;
import lombok.Getter;
import net.minecraft.ChatFormatting;
import net.minecraft.MethodsReturnNonnullByDefault;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.HoverEvent;
import net.minecraft.network.chat.Style;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.material.Fluid;
import org.jetbrains.annotations.NotNull;

import javax.annotation.ParametersAreNonnullByDefault;
import java.util.List;
Expand All @@ -41,18 +52,48 @@ protected RecipeLogic createRecipeLogic(Object... args) {
return new FluidDrillLogic(this);
}

@NotNull
@Override
public FluidDrillLogic getRecipeLogic() {
return (FluidDrillLogic) super.getRecipeLogic();
}

public int getEnergyTier() {
return Math.min(this.tier + 1 , Math.max(this.tier, getOverclockTier()));
var energyContainer = this.getCapabilitiesProxy().get(IO.IN, EURecipeCapability.CAP);
if (energyContainer == null) return this.tier;
var energyCont = new EnergyContainerList(energyContainer.stream().filter(IEnergyContainer.class::isInstance).map(IEnergyContainer.class::cast).toList());

return Math.min(this.tier + 1, Math.max(this.tier, GTUtil.getFloorTierByVoltage(energyCont.getInputVoltage())));
}

@Override
public void addDisplayText(List<Component> textList) {
super.addDisplayText(textList);
if (isFormed()) {
int energyContainer = getEnergyTier();
long maxVoltage = GTValues.V[energyContainer];
String voltageName = GTValues.VNF[energyContainer];
textList.add(Component.translatable("gtceu.multiblock.max_energy_per_tick", maxVoltage, voltageName));

if (getRecipeLogic().getVeinFluid() != null) {
// Fluid name
Fluid drilledFluid = getRecipeLogic().getVeinFluid();
Component fluidInfo = drilledFluid.getFluidType().getDescription().copy().withStyle(ChatFormatting.GREEN);
textList.add(Component.translatable("gtceu.multiblock.fluid_rig.drilled_fluid", fluidInfo).withStyle(ChatFormatting.GRAY));

// Fluid amount
Component amountInfo = Component.literal(FormattingUtil.formatNumbers(
getRecipeLogic().getFluidToProduce() * 20L / FluidDrillLogic.MAX_PROGRESS) +
" mB/s").withStyle(ChatFormatting.BLUE);
textList.add(Component.translatable("gtceu.multiblock.fluid_rig.fluid_amount", amountInfo).withStyle(ChatFormatting.GRAY));
} else {
Component noFluid = Component.translatable("gtceu.multiblock.fluid_rig.no_fluid_in_area").withStyle(ChatFormatting.RED);
textList.add(Component.translatable("gtceu.multiblock.fluid_rig.drilled_fluid", noFluid).withStyle(ChatFormatting.GRAY));
}
} else {
Component tooltip = Component.translatable("gtceu.multiblock.invalid_structure.tooltip").withStyle(ChatFormatting.GRAY);
textList.add(Component.translatable("gtceu.multiblock.invalid_structure")
.withStyle(Style.EMPTY.withColor(ChatFormatting.RED)
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, tooltip))));
}
}

Expand Down Expand Up @@ -86,6 +127,7 @@ public static Block getCasingState(int tier) {
return GTBlocks.CASING_STEEL_SOLID.get();
}

@SuppressWarnings("DataFlowIssue")
public static Block getFrameState(int tier) {
if (tier == GTValues.MV)
return GTBlocks.MATERIAL_BLOCKS.get(TagPrefix.frameGt, GTMaterials.Steel).get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ private GTRecipe getFluidDrillRecipe() {
return null;
}

public long getFluidToProduce() {
if (getMachine().getLevel() instanceof ServerLevel serverLevel && veinFluid != null) {
var data = BedrockFluidVeinSavedData.getOrCreate(serverLevel);
return getFluidToProduce(data.getFluidVeinWorldEntry(getChunkX(), getChunkZ()));
}
return 0;
}

private long getFluidToProduce(FluidVeinWorldEntry entry) {
var definition = entry.getDefinition();
if (definition != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1119,6 +1119,11 @@ public static void init(RegistrateLangProvider provider) {
provider.add("gtceu.multiblock.large_miner.radius", "Radius: §a%d§r Blocks");
provider.add("gtceu.multiblock.large_miner.errorradius", "§cCannot change radius while working!");
provider.add("gtceu.multiblock.large_miner.needsfluid", "Needs Drilling Fluid");
provider.add("gtceu.multiblock.fluid_rig.drilled_fluid", "Fluid: %s");
provider.add("gtceu.multiblock.fluid_rig.no_fluid_in_area", "None in Area.");
provider.add("gtceu.multiblock.fluid_rig.fluid_amount", "Pumping Rate: %s");
provider.add("gtceu.multiblock.fluid_rig.vein_depletion", "Vein Size: %s");
provider.add("gtceu.multiblock.fluid_rig.vein_depleted", "Vein Depleted.");
provider.add("gtceu.multiblock.pyrolyse_oven.speed", "Processing Speed: %s%%");
provider.add("gtceu.multiblock.cracking_unit.energy", "Energy Usage: %s%%");
provider.add("gtceu.multiblock.power_substation.stored", "Stored: %s EU");
Expand Down

0 comments on commit 3aa61b2

Please sign in to comment.