Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…into 1.16
  • Loading branch information
DonovanDMC committed Apr 16, 2022
2 parents 8ca6aa6 + b344615 commit e452b37
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public CompoundNBT write(@Nonnull CompoundNBT nbt) {

@Override
public void tick() {
if (world == null || world.isRemote) return;
if (emc <= 0 || world == null || world.isRemote) return;
tick++;

// we can't use a user defined value due to emc duplication possibilities
Expand All @@ -58,7 +58,7 @@ public void tick() {
TileEntity tile = world.getTileEntity(pos.offset(dir));
@Nullable IEmcStorage storage = tile == null ? null : tile.getCapability(ProjectEAPI.EMC_STORAGE_CAPABILITY, dir.getOpposite()).orElse(null);

if(storage != null && storage.insertEmc(1L, EmcAction.SIMULATE) > 0L) {
if(storage != null && !storage.isRelay() && storage.insertEmc(1L, EmcAction.SIMULATE) > 0L) {
temp.add(storage);
}
}
Expand Down Expand Up @@ -103,10 +103,10 @@ public long extractEmc(long emc, EmcAction action) {

@Override
public long insertEmc(long emc, EmcAction action) {
long v = Math.min(this.emc, emc);
long v = Math.min(getMaximumEmc() - this.emc, emc);

if (v < 0L) {
return insertEmc(-v, action);
return extractEmc(-v, action);
} else if (action.execute()) {
this.emc += v;
}
Expand Down

0 comments on commit e452b37

Please sign in to comment.