diff --git a/src/main/generated/assets/galacticraft/lang/en_us.json b/src/main/generated/assets/galacticraft/lang/en_us.json index 91bc9c87e7..22d8eea221 100644 --- a/src/main/generated/assets/galacticraft/lang/en_us.json +++ b/src/main/generated/assets/galacticraft/lang/en_us.json @@ -962,7 +962,7 @@ "ui.galacticraft.lander.controls": "Hold \"%s\" to slow down!", "ui.galacticraft.lander.velocity": "Entry Velocity: %s m/s", "ui.galacticraft.lander.warning": "WARNING", - "ui.galacticraft.machine.collecting": "Collecting: %s/s", + "ui.galacticraft.machine.collecting": "Collecting: %s/t", "ui.galacticraft.machine.current_oxygen": "Oxygen: %s", "ui.galacticraft.machine.gj_per_t": "%s gJ/t", "ui.galacticraft.machine.max_oxygen": "Maximum Oxygen: %s", diff --git a/src/main/java/dev/galacticraft/mod/client/gui/screen/ingame/OxygenCollectorScreen.java b/src/main/java/dev/galacticraft/mod/client/gui/screen/ingame/OxygenCollectorScreen.java index 4e611198a7..96975ea96d 100644 --- a/src/main/java/dev/galacticraft/mod/client/gui/screen/ingame/OxygenCollectorScreen.java +++ b/src/main/java/dev/galacticraft/mod/client/gui/screen/ingame/OxygenCollectorScreen.java @@ -22,8 +22,8 @@ package dev.galacticraft.mod.client.gui.screen.ingame; -import dev.galacticraft.machinelib.api.machine.MachineStatus; import dev.galacticraft.machinelib.client.api.screen.MachineScreen; +import dev.galacticraft.machinelib.client.api.util.DisplayUtil; import dev.galacticraft.mod.Constant; import dev.galacticraft.mod.content.block.entity.machine.OxygenCollectorBlockEntity; import dev.galacticraft.mod.screen.OxygenCollectorMenu; @@ -33,6 +33,8 @@ import net.minecraft.ChatFormatting; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.network.chat.TextColor; import net.minecraft.world.entity.player.Inventory; @Environment(EnvType.CLIENT) @@ -50,8 +52,14 @@ protected void init() { @Override protected void renderMachineBackground(GuiGraphics graphics, int mouseX, int mouseY, float delta) { super.renderMachineBackground(graphics, mouseX, mouseY, delta); - graphics.drawString(this.font, Component.translatable(Translations.Ui.COLLECTING, this.menu.collectionAmount).getString(), this.leftPos + 55, this.topPos + 56, ChatFormatting.DARK_GRAY.getColor(), false); - MachineStatus status = this.menu.state.getStatus(); - graphics.drawString(this.font, Component.translatable(Translations.Ui.MACHINE_STATUS, status != null ? status.getText() : Component.empty()), this.leftPos + 32, this.topPos + 66, ChatFormatting.DARK_GRAY.getColor(), false); + graphics.drawString(this.font, Component.translatable(Translations.Ui.MACHINE_STATUS, Component.empty()), this.leftPos + 60, this.topPos + 19, ChatFormatting.DARK_GRAY.getColor(), false); + + MutableComponent statusText = this.menu.state.getStatusText(this.menu.redstoneMode).copy(); + if (statusText.getStyle().getColor() == TextColor.fromLegacyFormat(ChatFormatting.GREEN)) { + statusText.withStyle(ChatFormatting.DARK_GREEN); + } + graphics.drawString(this.font, statusText, this.leftPos + 60, this.topPos + 29, -1, false); + + graphics.drawString(this.font, Component.translatable(Translations.Ui.COLLECTING, DisplayUtil.formatFluid(this.menu.collectionAmount, false)), this.leftPos + 60, this.topPos + 44, ChatFormatting.DARK_GRAY.getColor(), false); } } diff --git a/src/main/java/dev/galacticraft/mod/content/block/entity/machine/OxygenCollectorBlockEntity.java b/src/main/java/dev/galacticraft/mod/content/block/entity/machine/OxygenCollectorBlockEntity.java index 8008f7c7a3..1ffd78b667 100644 --- a/src/main/java/dev/galacticraft/mod/content/block/entity/machine/OxygenCollectorBlockEntity.java +++ b/src/main/java/dev/galacticraft/mod/content/block/entity/machine/OxygenCollectorBlockEntity.java @@ -97,6 +97,8 @@ public void setLevel(Level level) { } private int collectOxygen(@NotNull ServerLevel level, @NotNull BlockPos pos) { + int millibuckets = 50; + if (!this.oxygenWorld) { int minX = pos.getX() - 5; int minY = pos.getY() - 5; @@ -105,7 +107,7 @@ private int collectOxygen(@NotNull ServerLevel level, @NotNull BlockPos pos) { int maxY = pos.getY() + 5; int maxZ = pos.getZ() + 5; - float leafBlocks = 0; + float leafBlocks = 0.0F; for (BlockPos pos1 : BlockPos.betweenClosed(minX, minY, minZ, maxX, maxY, maxZ)) { BlockState state = level.getBlockState(pos1); @@ -116,12 +118,11 @@ private int collectOxygen(@NotNull ServerLevel level, @NotNull BlockPos pos) { leafBlocks += OxygenBlockDataManager.getOxygen(level, pos1, state); } - if (leafBlocks < 2) return 0; - - double oxyCount = 20 * (leafBlocks / 14.0F); - return (int) Math.ceil(oxyCount) / 20; //every tick + millibuckets = Math.min(millibuckets, (int) Math.floor(leafBlocks / 16.0F)); } - return 183 / 20; + + // Convert to droplets + return millibuckets * 81; } @Override @@ -135,7 +136,11 @@ protected void tickConstant(@NotNull ServerLevel level, @NotNull BlockPos pos, @ profiler.push("transfer"); this.fluidSource.trySpreadFluids(level, pos, state); - if (this.fluidStorage().slot(OXYGEN_TANK).isFull()) return GCMachineStatuses.OXYGEN_TANK_FULL; + if (this.fluidStorage().slot(OXYGEN_TANK).isFull()) { + this.collectionAmount = 0; + return GCMachineStatuses.OXYGEN_TANK_FULL; + } + profiler.popPush("transaction"); try { if (this.energyStorage().canExtract(Galacticraft.CONFIG.oxygenCollectorEnergyConsumptionRate())) { @@ -144,7 +149,7 @@ protected void tickConstant(@NotNull ServerLevel level, @NotNull BlockPos pos, @ profiler.pop(); if (this.collectionAmount > 0) { this.energyStorage().extract(Galacticraft.CONFIG.oxygenCollectorEnergyConsumptionRate()); - this.fluidStorage().slot(OXYGEN_TANK).insert(Gases.OXYGEN, FluidUtil.bucketsToDroplets(this.collectionAmount)); + this.collectionAmount = (int) this.fluidStorage().slot(OXYGEN_TANK).insert(Gases.OXYGEN, this.collectionAmount); return GCMachineStatuses.COLLECTING; } else { return GCMachineStatuses.NOT_ENOUGH_OXYGEN; diff --git a/src/main/java/dev/galacticraft/mod/data/GCTranslationProvider.java b/src/main/java/dev/galacticraft/mod/data/GCTranslationProvider.java index 7337d464ef..42ef8c85ab 100644 --- a/src/main/java/dev/galacticraft/mod/data/GCTranslationProvider.java +++ b/src/main/java/dev/galacticraft/mod/data/GCTranslationProvider.java @@ -1160,7 +1160,7 @@ protected void generateUiTranslations() { this.add(Ui.BUBBLE_TARGET_SIZE, "Target Size: "); this.add(Ui.BUBBLE_VISIBLE, "Bubble Visible"); - this.add(Ui.COLLECTING, "Collecting: %s/s"); + this.add(Ui.COLLECTING, "Collecting: %s/t"); this.add(Ui.CURRENT_OXYGEN, "Oxygen: %s"); this.add(Ui.GJT, "%s gJ/t"); this.add(Ui.MILLIBUCKETS, "mB"); diff --git a/src/main/resources/assets/galacticraft/textures/gui/oxygen_collector_screen.png b/src/main/resources/assets/galacticraft/textures/gui/oxygen_collector_screen.png index 936d96990a..2021da204f 100644 Binary files a/src/main/resources/assets/galacticraft/textures/gui/oxygen_collector_screen.png and b/src/main/resources/assets/galacticraft/textures/gui/oxygen_collector_screen.png differ