Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,22 +69,11 @@ public IFluidTankProperties[] getTankProperties() {
}

@Override
public FluidStack drain(FluidStack resource, boolean doDrain) {
FluidStack drained = super.drain(resource, doDrain);
this.removeTagWhenEmpty(doDrain);
return drained;
}

@Override
public FluidStack drain(int maxDrain, boolean doDrain) {
FluidStack drained = super.drain(maxDrain, doDrain);
this.removeTagWhenEmpty(doDrain);
return drained;
}

private void removeTagWhenEmpty(boolean doDrain) {
if (doDrain && this.getFluid() == null) {
this.container.setTagCompound(null);
protected void setContainerToEmpty() {
super.setContainerToEmpty();
var tag = container.getTagCompound();
if (tag != null && tag.isEmpty()) {
container.setTagCompound(null);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,26 +68,6 @@ public IFluidTankProperties[] getTankProperties() {
return properties;
}

@Override
public FluidStack drain(FluidStack resource, boolean doDrain) {
FluidStack drained = super.drain(resource, doDrain);
this.removeTagWhenEmpty(doDrain);
return drained;
}

@Override
public FluidStack drain(int maxDrain, boolean doDrain) {
FluidStack drained = super.drain(maxDrain, doDrain);
this.removeTagWhenEmpty(doDrain);
return drained;
}

private void removeTagWhenEmpty(boolean doDrain) {
if (doDrain && this.getFluid() == null) {
this.container.setTagCompound(null);
}
}

@Override
public boolean canFillFluidType(FluidStack fluid) {
return canFill() && (this.filter == null || this.filter.test(fluid));
Expand All @@ -98,6 +78,15 @@ public boolean canDrainFluidType(FluidStack fluid) {
return canDrain();
}

@Override
protected void setContainerToEmpty() {
super.setContainerToEmpty();
var tag = container.getTagCompound();
if (tag != null && tag.isEmpty()) {
container.setTagCompound(null);
}
}

private final class TankProperties implements IFluidTankProperties {

@Nullable
Expand Down
Loading