File tree Expand file tree Collapse file tree 2 files changed +14
-36
lines changed
src/main/java/gregtech/api/capability/impl Expand file tree Collapse file tree 2 files changed +14
-36
lines changed Original file line number Diff line number Diff line change @@ -69,22 +69,11 @@ public IFluidTankProperties[] getTankProperties() {
6969 }
7070
7171 @ Override
72- public FluidStack drain (FluidStack resource , boolean doDrain ) {
73- FluidStack drained = super .drain (resource , doDrain );
74- this .removeTagWhenEmpty (doDrain );
75- return drained ;
76- }
77-
78- @ Override
79- public FluidStack drain (int maxDrain , boolean doDrain ) {
80- FluidStack drained = super .drain (maxDrain , doDrain );
81- this .removeTagWhenEmpty (doDrain );
82- return drained ;
83- }
84-
85- private void removeTagWhenEmpty (boolean doDrain ) {
86- if (doDrain && this .getFluid () == null ) {
87- this .container .setTagCompound (null );
72+ protected void setContainerToEmpty () {
73+ super .setContainerToEmpty ();
74+ var tag = container .getTagCompound ();
75+ if (tag != null && tag .isEmpty ()) {
76+ container .setTagCompound (null );
8877 }
8978 }
9079
Original file line number Diff line number Diff line change @@ -68,26 +68,6 @@ public IFluidTankProperties[] getTankProperties() {
6868 return properties ;
6969 }
7070
71- @ Override
72- public FluidStack drain (FluidStack resource , boolean doDrain ) {
73- FluidStack drained = super .drain (resource , doDrain );
74- this .removeTagWhenEmpty (doDrain );
75- return drained ;
76- }
77-
78- @ Override
79- public FluidStack drain (int maxDrain , boolean doDrain ) {
80- FluidStack drained = super .drain (maxDrain , doDrain );
81- this .removeTagWhenEmpty (doDrain );
82- return drained ;
83- }
84-
85- private void removeTagWhenEmpty (boolean doDrain ) {
86- if (doDrain && this .getFluid () == null ) {
87- this .container .setTagCompound (null );
88- }
89- }
90-
9171 @ Override
9272 public boolean canFillFluidType (FluidStack fluid ) {
9373 return canFill () && (this .filter == null || this .filter .test (fluid ));
@@ -98,6 +78,15 @@ public boolean canDrainFluidType(FluidStack fluid) {
9878 return canDrain ();
9979 }
10080
81+ @ Override
82+ protected void setContainerToEmpty () {
83+ super .setContainerToEmpty ();
84+ var tag = container .getTagCompound ();
85+ if (tag != null && tag .isEmpty ()) {
86+ container .setTagCompound (null );
87+ }
88+ }
89+
10190 private final class TankProperties implements IFluidTankProperties {
10291
10392 @ Nullable
You can’t perform that action at this time.
0 commit comments