From 558241ca67933a052bf7ba0aaa73590b86cd3091 Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Tue, 3 May 2022 14:50:11 +0200 Subject: [PATCH] Boiling it down, Part II - Further adjustments to the steam engine's power balance --- .../contraptions/fluids/tank/BoilerData.java | 62 +++++++++--------- .../fluids/tank/BoilerHeaters.java | 4 +- .../assets/create/textures/block/gauge.png | Bin 1055 -> 1628 bytes 3 files changed, 32 insertions(+), 34 deletions(-) diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/BoilerData.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/BoilerData.java index e78955a6b..89d84a53f 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/BoilerData.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/BoilerData.java @@ -31,6 +31,9 @@ public class BoilerData { static final int SAMPLE_RATE = 5; + private static final int waterSupplyPerLevel = 10; + private static final float passiveEngineEfficiency = 1 / 32f; + // pooled water supply int gatheredSupply; float[] supplyOverTime = new float[10]; @@ -67,7 +70,6 @@ public class BoilerData { return; ticksUntilNextSample = SAMPLE_RATE; -// waterSupply -= supplyOverTime[currentIndex] / supplyOverTime.length; supplyOverTime[currentIndex] = gatheredSupply / (float) SAMPLE_RATE; waterSupply = Math.max(waterSupply, supplyOverTime[currentIndex]); currentIndex = (currentIndex + 1) % supplyOverTime.length; @@ -76,7 +78,6 @@ public class BoilerData { if (currentIndex == 0) { waterSupply = 0; for (float i : supplyOverTime) -// waterSupply += i; waterSupply = Math.max(i, waterSupply); } @@ -92,16 +93,16 @@ public class BoilerData { } public int getMaxHeatLevelForWaterSupply() { - return Math.min(activeHeat, (int) Math.min(18, Mth.ceil(waterSupply) / 20)); + return (int) Math.min(18, Mth.ceil(waterSupply) / waterSupplyPerLevel); } public boolean isPassive(int boilerSize) { - return passiveHeat || activeHeat != 0 && getActualHeat(boilerSize) == 0; + return passiveHeat && getMaxHeatLevelForBoilerSize(boilerSize) > 0 && getMaxHeatLevelForWaterSupply() > 0; } public float getEngineEfficiency(int boilerSize) { if (isPassive(boilerSize)) - return 1 / 16f / attachedEngines; + return passiveEngineEfficiency / attachedEngines; if (activeHeat == 0) return 0; int actualHeat = getActualHeat(boilerSize); @@ -126,21 +127,15 @@ public class BoilerData { int forWaterSupply = getMaxHeatLevelForWaterSupply(); int actualHeat = Math.min(activeHeat, Math.min(forWaterSupply, forBoilerSize)); - tooltip.add(componentSpacing.plainCopy() - .append(new TextComponent("Boiler Information:"))); - - Component h = new TextComponent("Heat: ").withStyle(ChatFormatting.GRAY) - .append(new TextComponent(IHaveGoggleInformation.format(activeHeat)).withStyle(ChatFormatting.GOLD)); - Component w = new TextComponent(", Water: ").withStyle(ChatFormatting.GRAY) - .append(new TextComponent(IHaveGoggleInformation.format(forWaterSupply)).withStyle(ChatFormatting.GOLD)); - Component s = new TextComponent(", Size: ").withStyle(ChatFormatting.GRAY) - .append(new TextComponent(IHaveGoggleInformation.format(forBoilerSize)).withStyle(ChatFormatting.GOLD)); - TextComponent heatLevel = isPassive(boilerSize) ? new TextComponent("Passive") - : (activeHeat == 0 ? new TextComponent("No Heat") - : new TextComponent(IHaveGoggleInformation.format(actualHeat))); - MutableComponent heatLabel = heatLevel.withStyle(ChatFormatting.GREEN); - Component level = new TextComponent("Boiler Level: ").append(heatLabel); + : (actualHeat == 0 ? new TextComponent("Idle") + : new TextComponent("Lvl " + IHaveGoggleInformation.format(actualHeat))); + tooltip.add(componentSpacing.plainCopy() + .append(new TextComponent("Boiler Status: ").append(heatLevel.withStyle(ChatFormatting.GREEN)))); + + Component h = levelComponent("Temperature: ", "No heat", passiveHeat ? -1 : activeHeat); + Component w = levelComponent("Water supply: ", "Too slow", forWaterSupply); + Component s = levelComponent("Boiler size: ", "Too small", forBoilerSize); double totalSU = getEngineEfficiency(boilerSize) * 16 * Math.max(actualHeat, attachedEngines) * BlockStressValues.getCapacity(AllBlocks.STEAM_ENGINE.get()); @@ -153,14 +148,14 @@ public class BoilerData { Component indent = new TextComponent(spacing); Component indent2 = new TextComponent(spacing + " "); - Component stats = indent.plainCopy() - .append(h) - .append(w) - .append(s); + tooltip.add(indent.plainCopy() + .append(w)); + tooltip.add(indent.plainCopy() + .append(h)); + tooltip.add(indent.plainCopy() + .append(s)); - if (activeHeat > 0) - tooltip.add(stats); - tooltip.add(new TextComponent(" -> ").append(level)); + tooltip.add(indent); tooltip.add(indent.plainCopy() .append(Lang.translate("tooltip.capacityProvided") .withStyle(ChatFormatting.GRAY))); @@ -171,6 +166,14 @@ public class BoilerData { return true; } + private MutableComponent levelComponent(String text, String whenZero, int level) { + return new TextComponent(text).withStyle(ChatFormatting.GRAY) + .append(level == 0 ? new TextComponent(whenZero).withStyle(ChatFormatting.RED) + : new TextComponent( + level == -1 ? "Passive" : level == 18 ? "Max" : "Lvl " + IHaveGoggleInformation.format(level)) + .withStyle(ChatFormatting.GOLD)); + } + public boolean evaluate(FluidTankTileEntity controller) { BlockPos controllerPos = controller.getBlockPos(); Level level = controller.getLevel(); @@ -297,14 +300,9 @@ public class BoilerData { public int fill(FluidStack resource, FluidAction action) { if (!isFluidValid(0, resource)) return 0; - int maxAccepted = (int) ((passiveHeat ? 1 : activeHeat + 1) * 20) * SAMPLE_RATE; - if (maxAccepted == 0) - return 0; - int amount = Math.min(maxAccepted - gatheredSupply, resource.getAmount()); + int amount = resource.getAmount(); if (action.execute()) gatheredSupply += amount; - if (action.simulate()) - return Math.max(amount, 1); return amount; } diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/BoilerHeaters.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/BoilerHeaters.java index fa8909f32..c2c21e583 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/BoilerHeaters.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/BoilerHeaters.java @@ -10,8 +10,8 @@ import net.minecraft.world.level.block.state.BlockState; public class BoilerHeaters { // API? public static boolean canHeatPassively(BlockState state) { - if (AllBlocks.BLAZE_BURNER.has(state) && state.getValue(BlazeBurnerBlock.HEAT_LEVEL) != HeatLevel.NONE) - return true; + if (AllBlocks.BLAZE_BURNER.has(state)) + return state.getValue(BlazeBurnerBlock.HEAT_LEVEL) != HeatLevel.NONE; if (AllBlockTags.PASSIVE_BOILER_HEATERS.matches(state)) return true; return false; diff --git a/src/main/resources/assets/create/textures/block/gauge.png b/src/main/resources/assets/create/textures/block/gauge.png index 4a5ec0fb4b8ed35c42fab34c3a4f150639101cfc..97957d8bf273ca7a92984a9f2254fdbe4616ad53 100644 GIT binary patch delta 1622 zcmV-c2C4a<2;2;i8Gi-<0047(dh`GQ00DDSM?wIu&K&6g000DMK}|sb0I`n?{9y$E z000SaNLh0L01m?d01m?e$8V@)000H?NklbA#@>yihtEbUA0B9k+w>0iBuBP z6#8;(9y6KOeR;lf=bzlUnM^|UOK$!@|G7EmJJ0!}9h>;nXHd1)AYIqU^L)zo^%CIJ zs<41Qvy8-|bskr=;=zlCSx)+EjLS~NAP z(@fr^zqZ%JaA|Q-(@wsIn$EsvVUU)K@QNc9jetEWY=os^4@JU z__4{Z+d>imVWc3F$&iz~*&(9~W z-!IU_jivS!fCUUE(rJpv<8p*t!&^iL59$Lz9N<03D}V$Zkhp#8R;$VtKmyMVXRu8! zZHQumLZIGoq$s8JSicx&5*imGe0CajG3?kb6Mr@7;`s|yeDFZ>38nBVjQrqWSGo4t z$&-GW4-;{VTgxMt+l#GBh>>%AVFe-70)V~EwUX@VA-7)BKRj|Y$j3U^vuBSVod?>) zi4%UcT;jG0lq0_>u3V2-pK~vH4;e?1q98E`Oiq>O*cm2J7U3g6`{?6Od?<{;TU0lP z7JreDPH5JE?KtGKK`Y7ArCEqL1Btk0rkOzH@Vke758cGN>b1JOql#9cQmN4CZ%(fi z4nvAi0^KS!gACIU!wxH~aqpWvfKY&*&7HvH5CxAXA_y>KUc-2KxlBt-OI$~FdC)!K z2jrrV6VK=N3zTu&xv0IM!lfL7Q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