Skip to content
This repository has been archived by the owner on May 25, 2024. It is now read-only.

Commit

Permalink
Make UCFE use TecTech's new power API (#204)
Browse files Browse the repository at this point in the history
* Make UCFE use TecTech's new power API

* Wrap numbers using formatNumbers
  • Loading branch information
sasha0552 authored Aug 28, 2023
1 parent fcabdab commit 8e6ddec
Showing 1 changed file with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,18 @@ public class UniversalChemicalFuelEngine extends GT_MetaTileEntity_TooltipMultiB
protected final double ROCKET_EFFICIENCY_COEFFICIENT = 0.005D;
protected final double EFFICIENCY_CEILING = 1.5D;

private long lEUt;
private long tEff;

private IStructureDefinition<UniversalChemicalFuelEngine> multiDefinition = null;

public UniversalChemicalFuelEngine(String name) {
super(name);
super.useLongPower = true;
}

public UniversalChemicalFuelEngine(int id, String name, String nameRegional) {
super(id, name, nameRegional);
super.useLongPower = true;
}

public final boolean addMaintenance(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
Expand Down Expand Up @@ -181,7 +182,7 @@ public boolean isCorrectMachinePart(ItemStack aStack) {

@Override
public int getPollutionPerTick(ItemStack aStack) {
return (int) Math.sqrt(this.mEUt) / 20;
return (int) Math.sqrt(this.getPowerFlow()) / 20;
}

@Override
Expand Down Expand Up @@ -228,8 +229,7 @@ protected GT_Multiblock_Tooltip_Builder createTooltip() {
consumeAllLiquid(tFuel);
consumeAllLiquid(getPromoter());

this.mEUt = (int) (FuelAmount * recipe.mSpecialValue / 20.0D);
this.lEUt = (long) ((long) FuelAmount * recipe.mSpecialValue / 20.0D);
this.setPowerFlow((long) ((long) FuelAmount * recipe.mSpecialValue / 20.0D));
this.mMaxProgresstime = 20;
this.updateSlots();
return CheckRecipeResultRegistry.GENERATING;
Expand All @@ -245,8 +245,7 @@ protected GT_Multiblock_Tooltip_Builder createTooltip() {
consumeAllLiquid(tFuel);
consumeAllLiquid(getPromoter());

this.mEUt = (int) (FuelAmount * recipe.mSpecialValue / 20.0D);
this.lEUt = (long) ((long) FuelAmount * recipe.mSpecialValue / 20.0D);
this.setPowerFlow((long) ((long) FuelAmount * recipe.mSpecialValue / 20.0D));
this.mMaxProgresstime = 20;
this.updateSlots();
return CheckRecipeResultRegistry.GENERATING;
Expand All @@ -264,8 +263,7 @@ protected GT_Multiblock_Tooltip_Builder createTooltip() {
consumeAllLiquid(tFuel);
consumeAllLiquid(getPromoter());

this.mEUt = (int) (FuelAmount * recipe.mSpecialValue * 3 / 20.0D);
this.lEUt = (long) ((long) FuelAmount * recipe.mSpecialValue * 3 / 20.0D);
this.setPowerFlow((long) ((long) FuelAmount * recipe.mSpecialValue * 3 / 20.0D));
this.mMaxProgresstime = 20;
this.updateSlots();
return CheckRecipeResultRegistry.GENERATING;
Expand All @@ -287,20 +285,23 @@ public boolean onRunningTick(ItemStack stack) {
@Override
public String[] getInfoData() {
String[] info = super.getInfoData();
info[4] = "Probably makes: " + EnumChatFormatting.RED + this.lEUt + EnumChatFormatting.RESET + " EU/t";
info[4] = "Probably makes: " + EnumChatFormatting.RED
+ GT_Utility.formatNumbers(this.getPowerFlow())
+ EnumChatFormatting.RESET
+ " EU/t";
info[6] = "Problems: " + EnumChatFormatting.RED
+ (this.getIdealStatus() - this.getRepairStatus())
+ GT_Utility.formatNumbers(this.getIdealStatus() - this.getRepairStatus())
+ EnumChatFormatting.RESET
+ " Efficiency: "
+ EnumChatFormatting.YELLOW
+ tEff / 100D
+ GT_Utility.formatNumbers(tEff / 100D)
+ EnumChatFormatting.RESET
+ " %";
return info;
}

void addAutoEnergy() {
long exEU = lEUt * tEff / 10000;
long exEU = this.getPowerFlow() * tEff / 10000;
if (!mDynamoHatches.isEmpty()) {
GT_MetaTileEntity_Hatch_Dynamo tHatch = mDynamoHatches.get(0);
if (tHatch.maxEUOutput() * tHatch.maxAmperesOut() >= exEU) {
Expand Down

0 comments on commit 8e6ddec

Please sign in to comment.