mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-16 01:54:59 +00:00
fc terminal add type filter (#98)
* fc terminal add type filter * Update dependencies.gradle --------- Co-authored-by: Raven Szewczyk <[email protected]>
This commit is contained in:
1 parent
c92f8bdd7c
commit
b9724d9369
10 files changed
+70
-1
No files matched your search
@@ -0,0 +1,34 @@
|
||||
package com.glodblock.github.loader.filter;
|
||||
|
||||
import static appeng.api.config.TypeFilter.*;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
import appeng.api.config.TypeFilter;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.client.me.ItemRepo;
|
||||
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
|
||||
public class FluidFilter {
|
||||
|
||||
public static void installFilter() {
|
||||
ItemRepo.registerTypeHandler(FluidFilter::filter, FLUIDS);
|
||||
}
|
||||
|
||||
private static boolean filter(IAEStack<?> stack, TypeFilter typeFilter) {
|
||||
if (stack instanceof IAEItemStack) {
|
||||
Item item = ((IAEItemStack) stack).getItem();
|
||||
if (item != null) {
|
||||
switch (typeFilter) {
|
||||
case ITEMS:
|
||||
return !(item instanceof ItemFluidDrop);
|
||||
case FLUIDS:
|
||||
return item instanceof ItemFluidDrop;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user