Skip to content

Commit

Permalink
Display energy network capacity as FloatingLong
Browse files Browse the repository at this point in the history
  • Loading branch information
pupnewfster committed Mar 26, 2020
1 parent 31dc0c8 commit 05766a7
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public interface IGridTransmitter<ACCEPTOR, NETWORK extends DynamicNetwork<ACCEP

ITextComponent getTransmitterNetworkBuffer();

double getTransmitterNetworkCapacity();
int getTransmitterNetworkCapacity();

@Nonnull
FloatingLong getCapacityAsFloatingLong();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public ITextComponent getTransmitterNetworkBuffer() {
}

@Override
public double getTransmitterNetworkCapacity() {
public int getTransmitterNetworkCapacity() {
return 0;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public ITextComponent getTransmitterNetworkBuffer() {
}

@Override
public double getTransmitterNetworkCapacity() {
public int getTransmitterNetworkCapacity() {
return 0;
}

Expand Down
8 changes: 7 additions & 1 deletion src/main/java/mekanism/common/item/ItemNetworkReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import mekanism.api.transmitters.TransmitterNetworkRegistry;
import mekanism.common.MekanismLang;
import mekanism.common.capabilities.Capabilities;
import mekanism.common.transmitters.grid.EnergyNetwork;
import mekanism.common.util.CapabilityUtils;
import mekanism.common.util.EnumUtils;
import mekanism.common.util.MekanismUtils;
Expand Down Expand Up @@ -67,7 +68,12 @@ public ActionResultType onItemUse(ItemUseContext context) {
player.sendMessage(MekanismLang.NETWORK_READER_NEEDED.translateColored(EnumColor.GRAY, EnumColor.DARK_GRAY, transmitter.getTransmitterNetworkNeeded()));
player.sendMessage(MekanismLang.NETWORK_READER_BUFFER.translateColored(EnumColor.GRAY, EnumColor.DARK_GRAY, transmitter.getTransmitterNetworkBuffer()));
player.sendMessage(MekanismLang.NETWORK_READER_THROUGHPUT.translateColored(EnumColor.GRAY, EnumColor.DARK_GRAY, transmitter.getTransmitterNetworkFlow()));
player.sendMessage(MekanismLang.NETWORK_READER_CAPACITY.translateColored(EnumColor.GRAY, EnumColor.DARK_GRAY, transmitter.getTransmitterNetworkCapacity()));
DynamicNetwork<?, ?, ?> transmitterNetwork = transmitter.getTransmitterNetwork();
if (transmitterNetwork instanceof EnergyNetwork) {
player.sendMessage(MekanismLang.NETWORK_READER_CAPACITY.translateColored(EnumColor.GRAY, EnumColor.DARK_GRAY, ((EnergyNetwork) transmitterNetwork).getCapacityAsFloatingLong()));
} else {
player.sendMessage(MekanismLang.NETWORK_READER_CAPACITY.translateColored(EnumColor.GRAY, EnumColor.DARK_GRAY, transmitter.getTransmitterNetworkCapacity()));
}
CapabilityUtils.getCapability(tileEntity, Capabilities.HEAT_TRANSFER_CAPABILITY, opposite).ifPresent(transfer ->
player.sendMessage(MekanismLang.NETWORK_READER_ABOVE_AMBIENT.translateColored(EnumColor.GRAY, EnumColor.DARK_GRAY, transfer.getTemp())));
player.sendMessage(MekanismLang.NETWORK_READER_BORDER.translateColored(EnumColor.GRAY, "-------------", EnumColor.DARK_BLUE, "[=======]"));
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/mekanism/common/transmitters/Transmitter.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,8 @@ public ITextComponent getTransmitterNetworkBuffer() {
}

@Override
public double getTransmitterNetworkCapacity() {
public int getTransmitterNetworkCapacity() {
//This isn't *fully* accurate as the fluid and gas networks only actually support up to max int currently
//TODO: FIXME - the energy network isn't as Double
return hasTransmitterNetwork() ? getTransmitterNetwork().getCapacity() : getCapacity();
}

Expand Down

0 comments on commit 05766a7

Please sign in to comment.