Skip to content

Commit

Permalink
Fixed Throughput monitor always defaulting to per second even if the …
Browse files Browse the repository at this point in the history
…user changed it (#113)
  • Loading branch information
pedroksl committed Feb 11, 2025
1 parent a4a0078 commit af90314
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.mojang.blaze3d.vertex.PoseStack;

import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.core.HolderLookup;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.resources.ResourceLocation;
Expand Down Expand Up @@ -98,6 +99,22 @@ public ThroughputMonitorPart(IPartItem<?> partItem) {
getMainNode().addService(IGridTickable.class, this);
}

@Override
public void writeToNBT(CompoundTag data, HolderLookup.Provider registries) {
super.writeToNBT(data, registries);
data.putLong("lastValue", this.lastReportedValue);
data.putString("throughput", this.lastHumanReadableValue);
data.putInt("routine", this.workRoutine.ordinal());
}

@Override
public void readFromNBT(CompoundTag data, HolderLookup.Provider registries) {
super.readFromNBT(data, registries);
this.lastReportedValue = data.getLong("lastValue");
this.lastHumanReadableValue = data.getString("throughput");
this.workRoutine = WorkRoutine.fromInt(data.getInt("routine"));
}

@Override
public void writeToStream(RegistryFriendlyByteBuf data) {
super.writeToStream(data);
Expand Down

0 comments on commit af90314

Please sign in to comment.