Skip to content

Commit

Permalink
update multiblock guis
Browse files Browse the repository at this point in the history
  • Loading branch information
TechLord22 committed Nov 26, 2023
1 parent 6e96b9d commit b6f2bca
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@

import java.util.List;

import gregtech.api.metatileentity.multiblock.MultiblockDisplayText;
import gregtech.api.util.GTUtility;
import gregtech.api.util.TextComponentUtil;
import gregtech.api.util.TextFormattingUtil;
import net.minecraft.client.resources.I18n;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;

import org.jetbrains.annotations.NotNull;
Expand Down Expand Up @@ -45,14 +50,25 @@ public void addInformation(ItemStack stack, @Nullable World player, List<String>

@Override
protected void addDisplayText(List<ITextComponent> textList) {
super.addDisplayText(textList);
List<ITieredMetaTileEntity> list = getAbilities(GCYMMultiblockAbility.TIERED_HATCH);
if (GCYMConfigHolder.globalMultiblocks.enableTieredCasings && !list.isEmpty()) {
long maxVoltage = Math.min(GTValues.V[list.get(0).getTier()],
Math.max(energyContainer.getInputVoltage(), energyContainer.getOutputVoltage()));
String voltageName = GTValues.VNF[list.get(0).getTier()];
textList.add(new TextComponentTranslation("gcym.multiblock.tiered_hatch.tooltip", maxVoltage, voltageName));
}
MultiblockDisplayText.builder(textList, isStructureFormed())
.setWorkingStatus(recipeMapWorkable.isWorkingEnabled(), recipeMapWorkable.isActive())
.addEnergyUsageLine(getEnergyContainer())
.addEnergyTierLine(GTUtility.getTierByVoltage(recipeMapWorkable.getMaxVoltage()))
.addCustom(tl -> {
// Tiered Hatch Line
if (isStructureFormed()) {
List<ITieredMetaTileEntity> list = getAbilities(GCYMMultiblockAbility.TIERED_HATCH);
if (GCYMConfigHolder.globalMultiblocks.enableTieredCasings && !list.isEmpty()) {
long maxVoltage = Math.min(GTValues.V[list.get(0).getTier()],
Math.max(energyContainer.getInputVoltage(), energyContainer.getOutputVoltage()));
String voltageName = GTValues.VNF[list.get(0).getTier()];
tl.add(new TextComponentTranslation("gcym.multiblock.tiered_hatch.tooltip", maxVoltage, voltageName));
}
}
})
.addParallelsLine(recipeMapWorkable.getParallelLimit())
.addWorkingStatusLine()
.addProgressLine(recipeMapWorkable.getProgressPercent());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
import java.util.Comparator;
import java.util.List;

import gregtech.api.metatileentity.multiblock.MultiblockDisplayText;
import gregtech.api.util.TextComponentUtil;
import gregtech.api.util.TextFormattingUtil;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.resources.I18n;
import net.minecraft.init.Blocks;
Expand Down Expand Up @@ -65,12 +68,26 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity metaTileEntityHol

@Override
protected void addDisplayText(List<ITextComponent> textList) {
if (isStructureFormed()) {
textList.add(new TextComponentTranslation("gregtech.multiblock.blast_furnace.max_temperature",
blastFurnaceTemperature)
.setStyle(new Style().setColor(TextFormatting.RED)));
}
super.addDisplayText(textList);
MultiblockDisplayText.builder(textList, isStructureFormed())
.setWorkingStatus(recipeMapWorkable.isWorkingEnabled(), recipeMapWorkable.isActive())
.addEnergyUsageLine(getEnergyContainer())
.addEnergyTierLine(GTUtility.getTierByVoltage(recipeMapWorkable.getMaxVoltage()))
.addCustom(tl -> {
// Coil heat capacity line
if (isStructureFormed()) {
ITextComponent heatString = TextComponentUtil.stringWithColor(
TextFormatting.RED,
TextFormattingUtil.formatNumbers(blastFurnaceTemperature) + "K");

tl.add(TextComponentUtil.translationWithColor(
TextFormatting.GRAY,
"gregtech.multiblock.blast_furnace.max_temperature",
heatString));
}
})
.addParallelsLine(recipeMapWorkable.getParallelLimit())
.addWorkingStatusLine()
.addProgressLine(recipeMapWorkable.getProgressPercent());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

import java.util.List;

import gregicality.multiblocks.api.metatileentity.GCYMMultiblockAbility;
import gregicality.multiblocks.common.GCYMConfigHolder;
import gregtech.api.metatileentity.ITieredMetaTileEntity;
import gregtech.api.metatileentity.multiblock.MultiblockDisplayText;
import gregtech.api.util.TextComponentUtil;
import gregtech.api.util.TextFormattingUtil;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.resources.I18n;
import net.minecraft.item.ItemStack;
Expand Down Expand Up @@ -64,20 +70,46 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity metaTileEntityHol

@Override
protected void addDisplayText(List<ITextComponent> textList) {
if (isStructureFormed()) {
textList.add(new TextComponentTranslation("gregtech.multiblock.blast_furnace.max_temperature",
blastFurnaceTemperature)
.setStyle(new Style().setColor(TextFormatting.RED)));
}
super.addDisplayText(textList);
MultiblockDisplayText.builder(textList, isStructureFormed())
.setWorkingStatus(recipeMapWorkable.isWorkingEnabled(), recipeMapWorkable.isActive())
.addEnergyUsageLine(getEnergyContainer())
.addEnergyTierLine(GTUtility.getTierByVoltage(recipeMapWorkable.getMaxVoltage()))
.addCustom(tl -> {
// Tiered Hatch Line
if (isStructureFormed()) {
List<ITieredMetaTileEntity> list = getAbilities(GCYMMultiblockAbility.TIERED_HATCH);
if (GCYMConfigHolder.globalMultiblocks.enableTieredCasings && !list.isEmpty()) {
long maxVoltage = Math.min(GTValues.V[list.get(0).getTier()],
Math.max(energyContainer.getInputVoltage(), energyContainer.getOutputVoltage()));
String voltageName = GTValues.VNF[list.get(0).getTier()];
tl.add(new TextComponentTranslation("gcym.multiblock.tiered_hatch.tooltip", maxVoltage, voltageName));
}
}
})
.addCustom(tl -> {
// Coil heat capacity line
if (isStructureFormed()) {
ITextComponent heatString = TextComponentUtil.stringWithColor(
TextFormatting.RED,
TextFormattingUtil.formatNumbers(blastFurnaceTemperature) + "K");

tl.add(TextComponentUtil.translationWithColor(
TextFormatting.GRAY,
"gregtech.multiblock.blast_furnace.max_temperature",
heatString));
}
})
.addParallelsLine(recipeMapWorkable.getParallelLimit())
.addWorkingStatusLine()
.addProgressLine(recipeMapWorkable.getProgressPercent());
}

@Override
protected void formStructure(PatternMatchContext context) {
super.formStructure(context);
Object type = context.get("CoilType");
if (type instanceof IHeatingCoilBlockStats) {
this.blastFurnaceTemperature = ((IHeatingCoilBlockStats) type).getCoilTemperature();
if (type instanceof IHeatingCoilBlockStats stats) {
this.blastFurnaceTemperature = stats.getCoilTemperature();
} else {
this.blastFurnaceTemperature = BlockWireCoil.CoilType.CUPRONICKEL.getCoilTemperature();
}
Expand Down

0 comments on commit b6f2bca

Please sign in to comment.