Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,19 @@ public StarTHellforgeProvider() {
/* Used for storing data for the addTooltip method ? */
@Override
protected void write(CompoundTag data, StarTHellForgeMachine capability) {
data.putInt("temperature", capability.getCrucibleTemperature());
data.putInt("temperature", capability.getTemperature());
data.putString("uiKey", capability.getCrucibleUIKey());
}

/* Adds a new tooltip under the Jade stuff */
@Override
protected void addTooltip(CompoundTag capData, ITooltip tooltip, Player player, BlockAccessor block,
BlockEntity blockEntity, IPluginConfig config) {
if (capData.contains("temperature"))
if (capData.contains("temperature") && capData.contains("uiKey"))
{
Integer temperature = capData.getInt("temperature");
tooltip.add(Component.translatable("ui.start_core.hellforge_crucible", temperature));
String uiKey = capData.getString("uiKey");
tooltip.add(Component.translatable(uiKey, temperature));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.startechnology.start_core.machine.redstone.StarTRedstoneIndicatorRecord;
import com.startechnology.start_core.materials.StarTHellForgeHeatingLiquids;

import lombok.Getter;
import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.Component;
import net.minecraftforge.fluids.FluidStack;
Expand All @@ -32,16 +33,28 @@ public class StarTHellForgeMachine extends WorkableElectricMultiblockMachine imp
WorkableElectricMultiblockMachine.MANAGED_FIELD_HOLDER);

@Persisted
@Getter
protected Integer temperature;

/* The hell forge cannot go below this base Temperature */
@Getter
private Integer baseTemperature;

private Integer baseTempLoss;
private Integer dormantTempLoss;

protected TickableSubscription tryTickSub;
private boolean startHeatLoss;

private boolean isWorking;

public StarTHellForgeMachine(IMachineBlockEntity holder, Object... args) {
public StarTHellForgeMachine(IMachineBlockEntity holder, Integer baseTemperature, Integer baseTempLoss, Integer dormantTempLoss, Object... args) {
super(holder, args);
this.temperature = 0;
this.temperature = baseTemperature;
this.baseTemperature = baseTemperature;
this.baseTempLoss = baseTempLoss;
this.dormantTempLoss = dormantTempLoss;

this.startHeatLoss = false;
this.isWorking = false;
}
Expand Down Expand Up @@ -72,11 +85,21 @@ public void onStructureInvalid() {
this.isWorking = false;
}

public String getCrucibleUIKey() {
String uiKey = "ui.start_core.hellforge_crucible";
if (baseTemperature > 0) {
uiKey = "ui.start_core.fornaxs_crucible";
}

return uiKey;
}

@Override
public void addDisplayText(List<Component> textList) {
super.addDisplayText(textList);

textList.add(
Component.translatable("ui.start_core.hellforge_crucible", this.temperature));
Component.translatable(getCrucibleUIKey(), this.temperature));
}

/**
Expand Down Expand Up @@ -142,9 +165,9 @@ protected void tryRemoveHeat() {
boolean machineActive = getRecipeLogic().isWorking();

if (machineActive) {
this.temperature = Math.max(this.temperature - 5, 0);
this.temperature = Math.max(this.temperature - baseTempLoss, baseTemperature);
} else {
this.temperature = Math.max(this.temperature - 125, 0);
this.temperature = Math.max(this.temperature - dormantTempLoss, baseTemperature);
}

this.temperatureChanged();
Expand Down Expand Up @@ -203,10 +226,6 @@ public void afterWorking() {
}
}

public Integer getCrucibleTemperature() {
return this.temperature;
}

public double redstonePercentageOfTemp(double temperature) {
return Math.min((this.temperature / ((double) temperature)) * 15.0, 15.0);
}
Expand Down
Loading
Loading