Skip to content

Commit

Permalink
fix: empty controllers not showing their true colors
Browse files Browse the repository at this point in the history
  • Loading branch information
raoulvdberge committed Jul 3, 2024
1 parent 1bceb44 commit 029c0fd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
class RoundRobinExporterNetworkNodeTest extends AbstractExporterNetworkNodeTest {
private Runnable listener;

@Override
@BeforeEach
void setUp() {
listener = mock(Runnable.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ public float unclampedCall(final ItemStack stack,
@Nullable final LivingEntity entity,
final int seed) {
return PlatformApi.INSTANCE.getEnergyStorage(stack)
.map(energyStorage -> (float) energyStorage.getStored() / (float) energyStorage.getCapacity())
.map(energyStorage -> {
if (energyStorage.getStored() == 0) {
return 1F;
}
return (float) energyStorage.getStored() / (float) energyStorage.getCapacity();
})
.orElse(1F);
}
}
3 changes: 3 additions & 0 deletions refinedstorage2-platform-forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@ archivesBaseName = 'refinedstorage2-platform-forge'

enablePublishing()

// This avoids a build failure when running the "test" task, because there is no JUnit engine
// in this subproject.
// The test source set in this subproject is used for Minecraft game tests, not for JUnit tests.
test.onlyIf { false }

0 comments on commit 029c0fd

Please sign in to comment.