Skip to content

Commit

Permalink
fix energy enough status and flickering indicator
Browse files Browse the repository at this point in the history
  • Loading branch information
Yefancy committed Nov 19, 2021
1 parent 7f048ce commit 2a43b64
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ public AbstractRecipeLogic(MetaTileEntity tileEntity, RecipeMap<?> recipeMap, bo
this.hasPerfectOC = hasPerfectOC;
}

protected abstract long getEnergyInputPerSecond();

protected abstract long getEnergyStored();

protected abstract long getEnergyCapacity();
Expand Down Expand Up @@ -174,6 +176,9 @@ protected void updateRecipeProgress() {
if (++progressTime > maxProgressTime) {
completeRecipe();
}
if (this.hasNotEnoughEnergy && getEnergyInputPerSecond() > 19 * recipeEUt) {
this.hasNotEnoughEnergy = false;
}
} else if (recipeEUt > 0) {
//only set hasNotEnoughEnergy if this recipe is consuming recipe
//generators always have enough energy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,11 @@ protected void completeRecipe() {
super.completeRecipe();
}

@Override
protected long getEnergyInputPerSecond() {
return getEnergyContainer().getInputPerSec();
}

@Override
protected long getEnergyStored() {
return getEnergyContainer().getEnergyStored();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ public PrimitiveRecipeLogic(RecipeMapPrimitiveMultiblockController tileEntity, R
super(tileEntity, recipeMap);
}

@Override
protected long getEnergyInputPerSecond() {
return Integer.MAX_VALUE;
}

@Override
protected long getEnergyStored() {
return Integer.MAX_VALUE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ public RecipeLogicEnergy(MetaTileEntity tileEntity, RecipeMap<?> recipeMap, Supp
this.energyContainer = energyContainer;
}

@Override
protected long getEnergyInputPerSecond() {
return energyContainer.get().getInputPerSec();
}

@Override
protected long getEnergyStored() {
return energyContainer.get().getEnergyStored();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,11 @@ protected int[] calculateOverclock(int EUt, long voltage, int duration) {
};
}

@Override
protected long getEnergyInputPerSecond() {
return 0;
}

@Override
protected long getEnergyStored() {
return (long) Math.ceil(steamFluidTank.getFluidAmount() * conversionRate);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ public void update() {
super.update();
}

@Override
protected long getEnergyInputPerSecond() {
return 0;
}

@Override
protected long getEnergyStored() {
combineSteamTanks();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ public void trySearchNewRecipe() {
.buildAndRegister();

AbstractRecipeLogic arl = new AbstractRecipeLogic(atte, map) {
@Override
protected long getEnergyInputPerSecond() {
return Long.MAX_VALUE;
}

@Override
protected long getEnergyStored() {
return Long.MAX_VALUE;
Expand Down

0 comments on commit 2a43b64

Please sign in to comment.