Skip to content

Commit

Permalink
re-yarn
Browse files Browse the repository at this point in the history
  • Loading branch information
LemmaEOF committed Jun 27, 2019
1 parent d44bef9 commit 5a4ce21
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.github.cottonmc.energy.api;

import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.text.TranslatableText;

public class ElectricalEnergyType implements EnergyType {

Expand All @@ -16,22 +16,22 @@ public int getMaximumTransferSize() {
}

@Override
public TranslatableComponent getDisplayAmount(int amount) {
public TranslatableText getDisplayAmount(int amount) {
//TODO: handle KWU, MWU, and GWU
if (amount < 1000) { // x < 1M
return new TranslatableComponent("info.cotton.energy.electrical.amount", amount);
return new TranslatableText("info.cotton.energy.electrical.amount", amount);
}
else if (amount < 1_000_000) { // 1K < x < 1M
float tAmount = amount / 1000;
return new TranslatableComponent("info.cotton.energy.electrical.amount.k", tAmount);
return new TranslatableText("info.cotton.energy.electrical.amount.k", tAmount);
}
else if (amount < 1_000_000_000) { // 1M < x < 1G
float tAmount = amount / 1_000_1000;
return new TranslatableComponent("info.cotton.energy.electrical.amount.m", tAmount);
return new TranslatableText("info.cotton.energy.electrical.amount.m", tAmount);
}
else { // 1G < x
float tAmount = amount / 1_000_000_000;
return new TranslatableComponent("info.cotton.energy.electrical.amount.g", tAmount);
return new TranslatableText("info.cotton.energy.electrical.amount.g", tAmount);
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/io/github/cottonmc/energy/api/EnergyType.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.github.cottonmc.energy.api;

import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.text.TranslatableText;

import java.util.Optional;

Expand All @@ -14,9 +14,9 @@ public interface EnergyType {
/**
* Gets human-readable text representing an energy value of this type.
* @param amount the total aggregate number of energy units being represented.
* @return a TextComponent representing this quantity and its relevant units, such as "300 WU".
* @return a TextText representing this quantity and its relevant units, such as "300 WU".
*/
TranslatableComponent getDisplayAmount(int amount);
TranslatableText getDisplayAmount(int amount);

/**
* Returns true if this EnergyType knows how to convert energy to and from the specified other
Expand Down

0 comments on commit 5a4ce21

Please sign in to comment.