Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor FluidTankList and Filtered Handlers #2690

Draft
wants to merge 28 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
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
2 changes: 1 addition & 1 deletion src/main/java/gregtech/api/capability/IDualHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public interface IDualHandler {

boolean hasItemHandlers();

IMultipleTankHandler getFluidTanks();
MultipleTankHandler getFluidTanks();

IItemHandler getItemHandlers();
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,5 @@

import net.minecraftforge.fluids.FluidStack;

import org.jetbrains.annotations.Nullable;

import java.util.Comparator;

/**
* Interface for fluid containers ({@link net.minecraftforge.fluids.IFluidTank IFluidTank} or
* {@link net.minecraftforge.fluids.capability.IFluidHandler IFluidHandler}) associated with {@link IFilter}.
*/
public interface IFilteredFluidContainer {

/**
* Compare logic for filtered instances.
*/
Comparator<IFilteredFluidContainer> COMPARATOR = Comparator.nullsLast(
Comparator.comparing(IFilteredFluidContainer::getFilter, IFilter.FILTER_COMPARATOR));

/**
* @return instance of {@link IFilter} associated to this object, or {@code null} if there's no filter
* associated.
*/
@Nullable
IFilter<FluidStack> getFilter();
}
// for type safe casting
public interface IFilteredFluidContainer extends IFilteredHandler<FluidStack> {}
25 changes: 25 additions & 0 deletions src/main/java/gregtech/api/capability/IFilteredHandler.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package gregtech.api.capability;

import org.jetbrains.annotations.Nullable;

import java.util.Comparator;

/**
* Interface for fluid containers ({@link net.minecraftforge.fluids.IFluidTank IFluidTank} or
* {@link net.minecraftforge.fluids.capability.IFluidHandler IFluidHandler}) associated with {@link IFilter}.
*/
public interface IFilteredHandler<T> {

/**
* Compare logic for filtered instances.
*/
Comparator<IFilteredHandler<?>> COMPARATOR = Comparator.nullsLast(
Comparator.comparing(IFilteredHandler::getFilter, IFilter.FILTER_COMPARATOR));

/**
* @return instance of {@link IFilter} associated to this object, or {@code null} if there's no filter
* associated.
*/
@Nullable
IFilter<T> getFilter();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package gregtech.api.capability;

import net.minecraft.item.ItemStack;

public interface IFilteredItemContainer extends IFilteredHandler<ItemStack> {}
248 changes: 0 additions & 248 deletions src/main/java/gregtech/api/capability/IMultipleTankHandler.java

This file was deleted.

Loading
Loading