Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Commit

Permalink
fixed drum not trying to output every tick
Browse files Browse the repository at this point in the history
  • Loading branch information
Trinsdar committed May 24, 2024
1 parent e8a5a76 commit 9f911f5
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,23 @@ public FluidTanks getTanks(int tank) {
@Override
public void onUpdate() {
super.onUpdate();
if (tile.getLevel().getGameTime() % 20 == 0 && output){
if (output){
Direction dir = FluidPlatformUtils.INSTANCE.getFluidDensity(getTank(0).getStoredFluid().getFluid()) < 0 ? UP : DOWN;
if (getTank(0).getStoredFluid().getFluidAmount() > 0){
Optional<PlatformFluidHandler> cap = TesseractCapUtils.INSTANCE.getFluidHandler(tile.getLevel(), tile.getBlockPos().relative(dir), dir.getOpposite());
Optional<PlatformFluidHandler> cap = getFluidHandler(dir);
cap.ifPresent(other -> Utils.transferFluids(this, other, 1000));
}
}
}

private Optional<PlatformFluidHandler> getFluidHandler(Direction side){
BlockEntity be = tile.getCachedBlockEntity(side);
if (be == null){
return TesseractCapUtils.INSTANCE.getFluidHandler(tile.getLevel(), tile.getBlockPos().relative(side), side.getOpposite());
}
return FluidHooks.safeGetBlockFluidManager(be, side.getOpposite());
}

@Override
public CompoundTag serialize(CompoundTag nbt) {
super.serialize(nbt);
Expand Down

0 comments on commit 9f911f5

Please sign in to comment.