Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# 2.6.2
- Re: Fix DEDA JEI display [#346](https://github.com/GTModpackTeam/GTExpert-Core/pull/346)
- Improve the VOM UI [#347](https://github.com/GTModpackTeam/GTExpert-Core/pull/347)

* * *

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ public class GTEGuiTextures {
.fullImage("textures/gui/icon/gte_logo_blinking_yellow.png");
public static final TextureArea GTE_LOGO_BLINKING_RED = TextureArea
.fullImage("textures/gui/icon/gte_logo_blinking_red.png");
public static final TextureArea PROGRESS_BAR_VOM = TextureArea
.fullImage("textures/gui/progress_bar/progress_bar_vom.png");
public static final TextureArea PROGRESS_BAR_VOM_FUEL = TextureArea
.fullImage("textures/gui/progress_bar/progress_bar_vom_fuel.png");
public static final TextureArea PROGRESS_BAR_VOM_ENDER = TextureArea
.fullImage("textures/gui/progress_bar/progress_bar_vom_ender.png");
public static final TextureArea PROGRESS_BAR_VOID = TextureArea
.fullImage("textures/gui/progress_bar/progress_bar_void.png");
public static final TextureArea PROGRESS_BAR_VOID_FUEL = TextureArea
.fullImage("textures/gui/progress_bar/progress_bar_void_fuel.png");
public static final TextureArea PROGRESS_BAR_VOID_ENDER = TextureArea
.fullImage("textures/gui/progress_bar/progress_bar_void_ender.png");
public static final TextureArea PROGRESS_BAR_CHISEL = TextureArea
.fullImage("textures/gui/progress_bar/progress_bar_chisel.png");
public static final TextureArea SOULVIAL_EMPTY_OVRELAY = TextureArea
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public class GTERecipeMaps {

@ZenProperty
public static final RecipeMap<SimpleRecipeBuilder> VOID_ORE_MINER_RECIPES = new RecipeMap<>(
"void_ore_miner", 1, 1, 2, 0, new SimpleRecipeBuilder(), false)
.setProgressBar(GTEGuiTextures.PROGRESS_BAR_VOM, ProgressWidget.MoveType.VERTICAL)
"void_ore_miner", 1, 1, 2, 0, new SimpleRecipeBuilder(), true)
.setProgressBar(GTEGuiTextures.PROGRESS_BAR_VOID, ProgressWidget.MoveType.VERTICAL)
.setSound(GTSoundEvents.DRILL_TOOL);

@ZenProperty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,29 @@
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import gregtech.api.capability.IMultipleTankHandler;
import gregtech.api.gui.resources.TextureArea;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.interfaces.IGregTechTileEntity;
import gregtech.api.metatileentity.multiblock.IMultiblockPart;
import gregtech.api.metatileentity.multiblock.IProgressBarMultiblock;
import gregtech.api.metatileentity.multiblock.RecipeMapMultiblockController;
import gregtech.api.pattern.BlockPattern;
import gregtech.api.pattern.FactoryBlockPattern;
import gregtech.api.pattern.TraceabilityPredicate;
import gregtech.api.unification.material.Materials;
import gregtech.api.util.TextComponentUtil;
import gregtech.api.util.TextFormattingUtil;
import gregtech.client.renderer.ICubeRenderer;
import gregtech.client.renderer.texture.Textures;
import gregtech.common.blocks.MetaBlocks;
Expand All @@ -34,7 +42,8 @@
import com.github.gtexpert.core.common.blocks.GTEBlockMetalCasing;
import com.github.gtexpert.core.common.blocks.GTEMetaBlocks;

public class MetaTileEntityVoidOreMiner extends RecipeMapMultiblockController {
public class MetaTileEntityVoidOreMiner extends RecipeMapMultiblockController
implements IProgressBarMultiblock {

public MetaTileEntityVoidOreMiner(ResourceLocation metaTileEntityId) {
super(metaTileEntityId, GTERecipeMaps.VOID_ORE_MINER_RECIPES);
Expand Down Expand Up @@ -124,4 +133,92 @@ public void addInformation(ItemStack stack, @Nullable World player, @NotNull Lis
protected ICubeRenderer getFrontOverlay() {
return Textures.ITEM_VOIDING_ADVANCED;
}

// IProgressBarMultiblock implementation
@Override
public boolean showProgressBar() {
return true;
}

@Override
public int getNumProgressBars() {
return 2;
}

@Override
public double getFillPercentage(int index) {
if (!isStructureFormed() || getInputFluidInventory() == null) {
return 0;
}

if (index == 0) {
// EnderPearl fluid
int[] amount = getTotalFluidAmount(Materials.EnderPearl.getFluid(Integer.MAX_VALUE),
getInputFluidInventory());
return amount[1] != 0 ? 1.0 * amount[0] / amount[1] : 0;
} else {
// Drilling Fluid
int[] amount = getTotalFluidAmount(Materials.DrillingFluid.getFluid(Integer.MAX_VALUE),
getInputFluidInventory());
return amount[1] != 0 ? 1.0 * amount[0] / amount[1] : 0;
}
}

@Override
public TextureArea getProgressBarTexture(int index) {
if (index == 0) {
return GTEGuiTextures.PROGRESS_BAR_VOID_ENDER;
} else {
return GTEGuiTextures.PROGRESS_BAR_VOID_FUEL;
}
}

@Override
public void addBarHoverText(List<ITextComponent> hoverList, int index) {
if (!isStructureFormed() || getInputFluidInventory() == null) {
return;
}

if (index == 0) {
// EnderPearl fluid
int[] amount = getTotalFluidAmount(Materials.EnderPearl.getFluid(Integer.MAX_VALUE),
getInputFluidInventory());
ITextComponent fluidInfo = TextComponentUtil.stringWithColor(
TextFormatting.GREEN,
TextFormattingUtil.formatNumbers(amount[0]) + " / " +
TextFormattingUtil.formatNumbers(amount[1]) + " L");
hoverList.add(TextComponentUtil.translationWithColor(
TextFormatting.GRAY,
"gtexpert.multiblock.void_ore_miner.ender_pearl_amount",
fluidInfo));
} else {
// Drilling Fluid
int[] amount = getTotalFluidAmount(Materials.DrillingFluid.getFluid(Integer.MAX_VALUE),
getInputFluidInventory());
ITextComponent fluidInfo = TextComponentUtil.stringWithColor(
TextFormatting.GOLD,
TextFormattingUtil.formatNumbers(amount[0]) + " / " +
TextFormattingUtil.formatNumbers(amount[1]) + " L");
hoverList.add(TextComponentUtil.translationWithColor(
TextFormatting.GRAY,
"gtexpert.multiblock.void_ore_miner.drilling_fluid_amount",
fluidInfo));
}
}

private int[] getTotalFluidAmount(FluidStack testStack, IMultipleTankHandler tanks) {
int stored = 0;
int capacity = 0;
for (var tank : tanks.getFluidTanks()) {
FluidStack contained = tank.getFluid();
if (contained != null && contained.isFluidEqual(testStack)) {
stored += contained.amount;
capacity += tank.getCapacity();
} else if (contained == null) {
// Empty tank that could hold this fluid
capacity += tank.getCapacity();
}
}
return new int[] { stored, capacity };
}
}
2 changes: 2 additions & 0 deletions src/main/resources/assets/gtexpert/lang/en_us.lang
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,8 @@ gtexpert.gui.needs_redstone=Needs Redstone signal to work
gtexpert.multiblock.large_transformer.max_input_energy_per_tick_amps=Max Input: %s EU/t (%s) / %s A
gtexpert.multiblock.large_transformer.max_output_energy_per_tick_amps=Max Output: %s EU/t (%s) / %s A
gtexpert.multiblock.large_transformer.not_enough_input=Max Output exceeds Max Input!
gtexpert.multiblock.void_ore_miner.ender_pearl_amount=Ender Pearl: %s
gtexpert.multiblock.void_ore_miner.drilling_fluid_amount=Drilling Fluid: %s

#config
gtexpert.config.gtexpert=GTExpert-Core
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/assets/gtexpert/lang/ja_jp.lang
Original file line number Diff line number Diff line change
Expand Up @@ -253,3 +253,5 @@ gtexpert.gui.needs_redstone=動作にはレッドストーン入力が必要で
gtexpert.multiblock.large_transformer.max_input_energy_per_tick_amps=最大入力: %s EU/t (%s) / %s A
gtexpert.multiblock.large_transformer.max_output_energy_per_tick_amps=最大出力: %s EU/t (%s) / %s A
gtexpert.multiblock.large_transformer.not_enough_input=最大出力が最大入力を超過している!
gtexpert.multiblock.void_ore_miner.ender_pearl_amount=エンダーパール: %s
gtexpert.multiblock.void_ore_miner.drilling_fluid_amount=採掘油: %s