diff options
author | minecraft7771 <maxim235@gmx.de> | 2022-08-09 15:14:10 +0200 |
---|---|---|
committer | minecraft7771 <maxim235@gmx.de> | 2022-08-09 15:14:10 +0200 |
commit | 41f917a95588f56813ac381ad0ba28542b159525 (patch) | |
tree | 304947a7b3278dbf0e7b3354ff26f238f3e60bb4 /src | |
parent | e685f5f4853303c1d16dfc61254e4917004cf068 (diff) | |
download | GT5-Unofficial-41f917a95588f56813ac381ad0ba28542b159525.tar.gz GT5-Unofficial-41f917a95588f56813ac381ad0ba28542b159525.tar.bz2 GT5-Unofficial-41f917a95588f56813ac381ad0ba28542b159525.zip |
Moved magic numbers out of code and adjusted repair costs
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java index bf699851df..51262076cd 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java @@ -38,6 +38,11 @@ import static net.minecraft.util.StatCollector.translateToLocal; * Created by danie_000 on 17.12.2016. */ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { + + private static final int maxRepairedDamagePerOperation = 1000; + private static final long usedEuPerDurability = 1000; + private static final int usedUumPerDurability = 1; + //region structure private static final String[] description = new String[]{ EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", @@ -185,12 +190,11 @@ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBa if (item.isRepairable()) { FluidStack uum = getStoredFluids().stream().filter(fluid -> Materials.UUMatter.getFluid(1).isFluidEqual(fluid)).findAny().orElse(null); if (uum != null) { - int maxRepairedDamage = Math.max(item.getDamage(itemStackInBus), 1000); - int actualRepairedDamage = Math.min(item.getDamage(itemStackInBus) - maxRepairedDamage, 0); - if (getEUVar() >= actualRepairedDamage) { - item.setDamage(itemStackInBus, actualRepairedDamage); - depleteInput(new FluidStack(Materials.UUMatter.mFluid, Math.max(actualRepairedDamage / 100, 1))); - setEUVar(Math.min(getEUVar() - actualRepairedDamage, 0)); + int repairedDamage = Math.min(item.getDamage(itemStackInBus), maxRepairedDamagePerOperation); + long euCost = repairedDamage * usedEuPerDurability; + if (getEUVar() >= euCost && depleteInput(new FluidStack(Materials.UUMatter.mFluid,repairedDamage * usedUumPerDurability))) { + item.setDamage(itemStackInBus, Math.max(item.getDamage(itemStackInBus) - repairedDamage, 0)); + setEUVar(Math.min(getEUVar() - euCost, 0)); } } } |