Skip to content

Commit

Permalink
consume energy every 10 ticks
Browse files Browse the repository at this point in the history
scale energy usage based on tier
  • Loading branch information
ghzdude committed Dec 21, 2023
1 parent 2350ba0 commit 5619b51
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package gregtech.common.metatileentities.storage;

import gregtech.api.GTValues;
import gregtech.api.capability.GregtechCapabilities;
import gregtech.api.capability.IDualHandler;
import gregtech.api.capability.IEnergyContainer;
Expand All @@ -8,6 +9,7 @@
import gregtech.api.capability.impl.EnergyContainerHandler;
import gregtech.api.capability.impl.FluidTankList;
import gregtech.api.capability.impl.ItemHandlerList;
import gregtech.api.metatileentity.ITieredMetaTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.interfaces.IGregTechTileEntity;
import gregtech.api.util.GTUtility;
Expand Down Expand Up @@ -77,7 +79,7 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) {

@Override
public void update() {
if (isPowered()) {
if (getOffsetTimer() % 10 == 0 && isPowered()) {
energyContainer.removeEnergy(energyConsumption);
}
super.update();
Expand Down Expand Up @@ -207,7 +209,10 @@ public void rebuildNetwork() {
oldPositions.remove(pos);

energyConsumption += switch (storage.getType()) {
case ITEM, FLUID -> 8L;
case ITEM, FLUID -> {
int tier = storage instanceof ITieredMetaTileEntity tieredMTE ? tieredMTE.getTier() : 0;
yield GTValues.V[tier / 2] / 2;
}
case PROXY -> 2L;
case EXTENDER -> 1L;
default -> 0L;
Expand Down

0 comments on commit 5619b51

Please sign in to comment.