Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/generated/assets/galacticraft/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)
Expand All @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand All @@ -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
Expand All @@ -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())) {
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.