-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* style: reformat some code in MetaMachine * refactor: allow covers to override item and fluid transfer capabilities * feat: UI controls for distribution & manual IO mode * feat: handle manual IO mode when transferring through covers * refactor: make previously added @ExpectPlatform method static * refactor: improve tooltip for insert_first distribution mode
- Loading branch information
Showing
35 changed files
with
676 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 99 additions & 0 deletions
99
common/src/main/java/com/gregtechceu/gtceu/api/transfer/fluid/FluidTransferDelegate.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
package com.gregtechceu.gtceu.api.transfer.fluid; | ||
|
||
import com.lowdragmc.lowdraglib.side.fluid.FluidStack; | ||
import com.lowdragmc.lowdraglib.side.fluid.IFluidTransfer; | ||
import net.minecraft.MethodsReturnNonnullByDefault; | ||
import org.jetbrains.annotations.ApiStatus; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import javax.annotation.Nonnull; | ||
import javax.annotation.ParametersAreNonnullByDefault; | ||
|
||
|
||
@MethodsReturnNonnullByDefault | ||
@ParametersAreNonnullByDefault | ||
public abstract class FluidTransferDelegate implements IFluidTransfer { | ||
protected IFluidTransfer delegate; | ||
|
||
public FluidTransferDelegate(IFluidTransfer delegate) { | ||
this.delegate = delegate; | ||
} | ||
|
||
protected void setDelegate(IFluidTransfer delegate) { | ||
this.delegate = delegate; | ||
} | ||
|
||
|
||
////////////////////////////////////// | ||
//****** OVERRIDE THESE ******// | ||
////////////////////////////////////// | ||
|
||
|
||
@Override | ||
public int getTanks() { | ||
return delegate.getTanks(); | ||
} | ||
|
||
@Override | ||
@Nonnull | ||
public FluidStack getFluidInTank(int tank) { | ||
return delegate.getFluidInTank(tank); | ||
} | ||
|
||
@Override | ||
@ApiStatus.Internal | ||
public void setFluidInTank(int tank, @NotNull FluidStack fluidStack) { | ||
delegate.setFluidInTank(tank, fluidStack); | ||
} | ||
|
||
@Override | ||
public long getTankCapacity(int tank) { | ||
return delegate.getTankCapacity(tank); | ||
} | ||
|
||
@Override | ||
public boolean isFluidValid(int tank, @NotNull FluidStack stack) { | ||
return delegate.isFluidValid(tank, stack); | ||
} | ||
|
||
@Override | ||
@ApiStatus.Internal | ||
public long fill(int tank, FluidStack resource, boolean simulate, boolean notifyChanges) { | ||
return delegate.fill(tank, resource, simulate, notifyChanges); | ||
} | ||
|
||
@Override | ||
public boolean supportsFill(int tank) { | ||
return delegate.supportsFill(tank); | ||
} | ||
|
||
@Override | ||
@ApiStatus.Internal | ||
@Nonnull | ||
public FluidStack drain(int tank, FluidStack resource, boolean simulate, boolean notifyChanges) { | ||
return delegate.drain(tank, resource, simulate, notifyChanges); | ||
} | ||
|
||
@Override | ||
public boolean supportsDrain(int tank) { | ||
return delegate.supportsDrain(tank); | ||
} | ||
|
||
@Override | ||
@ApiStatus.Internal | ||
@Nonnull | ||
public Object createSnapshot() { | ||
return delegate.createSnapshot(); | ||
} | ||
|
||
@Override | ||
@ApiStatus.Internal | ||
public void restoreFromSnapshot(Object snapshot) { | ||
delegate.restoreFromSnapshot(snapshot); | ||
} | ||
|
||
@Override | ||
public void onContentsChanged() { | ||
delegate.onContentsChanged(); | ||
} | ||
} |
75 changes: 75 additions & 0 deletions
75
common/src/main/java/com/gregtechceu/gtceu/api/transfer/fluid/NoOpFluidTransfer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
package com.gregtechceu.gtceu.api.transfer.fluid; | ||
|
||
import com.lowdragmc.lowdraglib.side.fluid.FluidStack; | ||
import com.lowdragmc.lowdraglib.side.fluid.IFluidTransfer; | ||
import net.minecraft.MethodsReturnNonnullByDefault; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import javax.annotation.ParametersAreNonnullByDefault; | ||
|
||
|
||
@MethodsReturnNonnullByDefault | ||
@ParametersAreNonnullByDefault | ||
public class NoOpFluidTransfer implements IFluidTransfer { | ||
public static final NoOpFluidTransfer INSTANCE = new NoOpFluidTransfer(); | ||
|
||
private NoOpFluidTransfer() { | ||
} | ||
|
||
@Override | ||
public int getTanks() { | ||
return 0; | ||
} | ||
|
||
@NotNull | ||
@Override | ||
public FluidStack getFluidInTank(int tank) { | ||
return FluidStack.empty(); | ||
} | ||
|
||
@Override | ||
public void setFluidInTank(int tank, @NotNull FluidStack fluidStack) { | ||
} | ||
|
||
@Override | ||
public long getTankCapacity(int tank) { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public boolean isFluidValid(int tank, @NotNull FluidStack stack) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public long fill(int tank, FluidStack resource, boolean simulate, boolean notifyChanges) { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public boolean supportsFill(int tank) { | ||
return false; | ||
} | ||
|
||
@NotNull | ||
@Override | ||
public FluidStack drain(int tank, FluidStack resource, boolean simulate, boolean notifyChanges) { | ||
return FluidStack.empty(); | ||
} | ||
|
||
@Override | ||
public boolean supportsDrain(int tank) { | ||
return false; | ||
} | ||
|
||
@NotNull | ||
@Override | ||
public Object createSnapshot() { | ||
return new Object(); | ||
} | ||
|
||
@Override | ||
public void restoreFromSnapshot(Object snapshot) { | ||
|
||
} | ||
} |
Oops, something went wrong.