mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-16 18:44:42 +00:00
Update APIs (#130)
* Add an API to allow other mods to blacklist fluids from this mod. * Removed Thaumic Energistics config setting. This will be handled by Thaumic Energistic's side (which also happens to have a config setting). * Added an API that allows for blacklisting fluids from either the storage or the display individually. * Prevent blacklisted fluids from being discretized * Update API usage - use AE2's new API - use ThE's config setting for aspect -> gas * spotlessApply --------- Co-authored-by: GitHub GTNH Actions <unknown>
This commit is contained in:
1 parent
14853a2481
commit
f87b76347e
19 files changed
+237
-79
No files matched your search
@@ -77,7 +77,7 @@ public class FluidCraft {
|
||||
CalculatorV2PluginLoader.installCalculatorV2Plugins();
|
||||
}
|
||||
if (ModAndClassUtil.isTypeFilter) {
|
||||
FluidFilter.installFilter();
|
||||
AEApi.instance().registries().itemDisplay().addItemFilter(FluidFilter::filter);
|
||||
}
|
||||
|
||||
proxy.postInit(event);
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.glodblock.github.api;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
public final class FluidCraftAPI implements IFluidCraftAPI {
|
||||
|
||||
private static final FluidCraftAPI API = new FluidCraftAPI();
|
||||
|
||||
/**
|
||||
* These fluids will not be allowed to be stored in fluid storage cells.
|
||||
*/
|
||||
private final Set<Class<? extends Fluid>> blacklistedFluids = new HashSet<>();
|
||||
|
||||
/**
|
||||
* These fluids will not be displayed in a fluid terminal.
|
||||
*/
|
||||
private final Set<Class<? extends Fluid>> blacklistedDispFluids = new HashSet<>();
|
||||
|
||||
public static FluidCraftAPI instance() {
|
||||
return API;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void blacklistFluidInStorage(Class<? extends Fluid> fluid) {
|
||||
blacklistedFluids.add(fluid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void blacklistFluidInDisplay(Class<? extends Fluid> fluid) {
|
||||
blacklistedDispFluids.add(fluid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlacklistedInStorage(Class<? extends Fluid> fluid) {
|
||||
return blacklistedFluids.contains(fluid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlacklistedInDisplay(Class<? extends Fluid> fluid) {
|
||||
return blacklistedDispFluids.contains(fluid);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.glodblock.github.api;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public interface IFluidCraftAPI {
|
||||
|
||||
/**
|
||||
* Blacklisted fluids will not be allowed to be added to a storage cell.
|
||||
*/
|
||||
void blacklistFluidInStorage(Class<? extends Fluid> fluid);
|
||||
|
||||
/**
|
||||
* Blacklisted fluids will not be displayed in fluid terminals.
|
||||
*/
|
||||
void blacklistFluidInDisplay(Class<? extends Fluid> fluid);
|
||||
|
||||
/**
|
||||
* Mostly for internal use; queries whether the fluid is blacklisted from storage cells.
|
||||
*/
|
||||
boolean isBlacklistedInStorage(Class<? extends Fluid> fluid);
|
||||
|
||||
/**
|
||||
* Mostly for internal use; queries whether the fluid is blacklisted from being displayed.
|
||||
*/
|
||||
boolean isBlacklistedInDisplay(Class<? extends Fluid> fluid);
|
||||
}
|
||||
@@ -29,11 +29,11 @@ import appeng.api.implementations.tiles.IViewCellStorage;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IDisplayRepo;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.api.util.IConfigurableObject;
|
||||
import appeng.client.gui.widgets.*;
|
||||
import appeng.client.me.InternalSlotME;
|
||||
import appeng.client.me.ItemRepo;
|
||||
import appeng.client.me.SlotDisconnected;
|
||||
import appeng.client.me.SlotME;
|
||||
import appeng.container.AEBaseContainer;
|
||||
@@ -67,7 +67,7 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
|
||||
protected final ItemStack[] myCurrentViewCells = new ItemStack[5];
|
||||
public FCContainerMonitor<T> monitorableContainer;
|
||||
public GuiTabButton craftingStatusBtn;
|
||||
protected ItemRepo repo;
|
||||
protected IDisplayRepo repo;
|
||||
protected GuiImgButton craftingStatusImgBtn;
|
||||
protected FCGuiTextField searchField;
|
||||
protected int perRow = 9;
|
||||
@@ -649,7 +649,7 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
|
||||
|
||||
@Override
|
||||
public void updateScreen() {
|
||||
this.repo.setPower(this.monitorableContainer.isPowered());
|
||||
this.repo.setPowered(this.monitorableContainer.isPowered());
|
||||
super.updateScreen();
|
||||
}
|
||||
|
||||
|
||||
@@ -119,12 +119,6 @@ public class ContainerEssentiaMonitor extends ContainerFluidPortableCell {
|
||||
if (slotIndex == -1) {
|
||||
out.stackSize = fluidContainer.stackSize;
|
||||
} else {
|
||||
if (drainStack != null) {
|
||||
System.out.print("---------\n");
|
||||
System.out.print(drainStack.right + "\n");
|
||||
System.out.print(drainStack.left + "\n");
|
||||
System.out.print(aeFluidStack.getStackSize() + "\n");
|
||||
}
|
||||
out.stackSize = (int) (fluidContainer.stackSize
|
||||
- (aeFluidStack.getStackSize() / drainStack.left));
|
||||
}
|
||||
|
||||
@@ -1,17 +1,25 @@
|
||||
package com.glodblock.github.client.me;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
import com.glodblock.github.crossmod.thaumcraft.AspectUtil;
|
||||
import com.glodblock.github.util.FluidSorters;
|
||||
|
||||
import appeng.api.config.SearchBoxMode;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.SortOrder;
|
||||
import appeng.api.config.ViewItems;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.client.gui.widgets.IScrollSource;
|
||||
import appeng.client.gui.widgets.ISortSource;
|
||||
import appeng.core.AEConfig;
|
||||
|
||||
public class EssentiaRepo extends FluidRepo {
|
||||
|
||||
@@ -21,7 +29,84 @@ public class EssentiaRepo extends FluidRepo {
|
||||
|
||||
@Override
|
||||
public void updateView() {
|
||||
super.updateView();
|
||||
this.view.clear();
|
||||
this.dsp.clear();
|
||||
|
||||
this.view.ensureCapacity(this.list.size());
|
||||
this.dsp.ensureCapacity(this.list.size());
|
||||
|
||||
final Enum<?> viewMode = this.sortSrc.getSortDisplay();
|
||||
final Enum<?> searchMode = AEConfig.instance.settings.getSetting(Settings.SEARCH_MODE);
|
||||
if (searchMode == SearchBoxMode.NEI_AUTOSEARCH || searchMode == SearchBoxMode.NEI_MANUAL_SEARCH) {
|
||||
this.updateNEI(this.searchString);
|
||||
}
|
||||
|
||||
String innerSearch = this.searchString;
|
||||
|
||||
if (innerSearch.startsWith("@")) {
|
||||
innerSearch = innerSearch.substring(1);
|
||||
}
|
||||
|
||||
Pattern m;
|
||||
try {
|
||||
m = Pattern.compile(innerSearch.toLowerCase(), Pattern.CASE_INSENSITIVE);
|
||||
} catch (final Throwable ignore) {
|
||||
try {
|
||||
m = Pattern.compile(Pattern.quote(innerSearch.toLowerCase()), Pattern.CASE_INSENSITIVE);
|
||||
} catch (final Throwable __) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for (IAEItemStack is : this.list) {
|
||||
if (this.myPartitionList != null) {
|
||||
if (!this.myPartitionList.isListed(is)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (viewMode == ViewItems.CRAFTABLE && !is.isCraftable()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (viewMode == ViewItems.CRAFTABLE) {
|
||||
is = is.copy();
|
||||
is.setStackSize(0);
|
||||
}
|
||||
|
||||
if (viewMode == ViewItems.STORED && is.getStackSize() == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Fluid fluid = ItemFluidDrop.getAeFluidStack(is).getFluid();
|
||||
if (!AspectUtil.isEssentiaGas(fluid)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (m.matcher(fluid.getLocalizedName().toLowerCase()).find()) {
|
||||
this.view.add(is);
|
||||
}
|
||||
}
|
||||
|
||||
final Enum<?> SortBy = this.sortSrc.getSortBy();
|
||||
final Enum<?> SortDir = this.sortSrc.getSortDir();
|
||||
|
||||
FluidSorters.setDirection((appeng.api.config.SortDir) SortDir);
|
||||
FluidSorters.init();
|
||||
|
||||
if (SortBy == SortOrder.MOD) {
|
||||
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_MOD);
|
||||
} else if (SortBy == SortOrder.AMOUNT) {
|
||||
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_SIZE);
|
||||
} else if (SortBy == SortOrder.INVTWEAKS) {
|
||||
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_INV_TWEAKS);
|
||||
} else {
|
||||
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_NAME);
|
||||
}
|
||||
|
||||
for (final IAEItemStack is : this.view) {
|
||||
this.dsp.add(is.getItemStack());
|
||||
}
|
||||
Iterator<IAEItemStack> it1 = this.view.iterator();
|
||||
while (it1.hasNext()) {
|
||||
IAEFluidStack fluid = ItemFluidDrop.getAeFluidStack(it1.next());
|
||||
|
||||
@@ -20,6 +20,7 @@ import javax.annotation.Nonnull;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
import com.glodblock.github.api.FluidCraftAPI;
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
import com.glodblock.github.util.FluidSorters;
|
||||
import com.glodblock.github.util.Util;
|
||||
@@ -27,36 +28,36 @@ import com.glodblock.github.util.Util;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.*;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IDisplayRepo;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.client.gui.widgets.IScrollSource;
|
||||
import appeng.client.gui.widgets.ISortSource;
|
||||
import appeng.client.me.ItemRepo;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.items.storage.ItemViewCell;
|
||||
import appeng.util.prioitylist.IPartitionList;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
|
||||
public class FluidRepo extends ItemRepo {
|
||||
public class FluidRepo implements IDisplayRepo {
|
||||
|
||||
private final IItemList<IAEItemStack> list = AEApi.instance().storage().createItemList();
|
||||
protected final IItemList<IAEItemStack> list = AEApi.instance().storage().createItemList();
|
||||
protected final ArrayList<IAEItemStack> view = new ArrayList<>();
|
||||
protected final ArrayList<ItemStack> dsp = new ArrayList<>();
|
||||
private final IScrollSource src;
|
||||
private final ISortSource sortSrc;
|
||||
protected final IScrollSource src;
|
||||
protected final ISortSource sortSrc;
|
||||
|
||||
private int rowSize = 9;
|
||||
protected int rowSize = 9;
|
||||
|
||||
private String searchString = "";
|
||||
private IPartitionList<IAEItemStack> myPartitionList;
|
||||
protected String searchString = "";
|
||||
protected IPartitionList<IAEItemStack> myPartitionList;
|
||||
private String NEIWord = null;
|
||||
private boolean hasPower;
|
||||
|
||||
public FluidRepo(final IScrollSource src, final ISortSource sortSrc) {
|
||||
super(src, sortSrc);
|
||||
this.src = src;
|
||||
this.sortSrc = sortSrc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack getReferenceItem(int idx) {
|
||||
idx += this.src.getCurrentScroll() * this.rowSize;
|
||||
|
||||
@@ -66,6 +67,7 @@ public class FluidRepo extends ItemRepo {
|
||||
return this.view.get(idx);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItem(int idx) {
|
||||
idx += this.src.getCurrentScroll() * this.rowSize;
|
||||
|
||||
@@ -75,10 +77,7 @@ public class FluidRepo extends ItemRepo {
|
||||
return this.dsp.get(idx);
|
||||
}
|
||||
|
||||
void setSearch(final String search) {
|
||||
this.searchString = search == null ? "" : search;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postUpdate(final IAEItemStack is) {
|
||||
final IAEItemStack st = this.list.findPrecise(is);
|
||||
if (st != null) {
|
||||
@@ -89,11 +88,13 @@ public class FluidRepo extends ItemRepo {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setViewCell(final ItemStack[] list) {
|
||||
this.myPartitionList = ItemViewCell.createFilter(list);
|
||||
this.updateView();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateView() {
|
||||
this.view.clear();
|
||||
this.dsp.clear();
|
||||
@@ -145,7 +146,13 @@ public class FluidRepo extends ItemRepo {
|
||||
if (viewMode == ViewItems.STORED && is.getStackSize() == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Fluid fluid = ItemFluidDrop.getAeFluidStack(is).getFluid();
|
||||
|
||||
if (FluidCraftAPI.instance().isBlacklistedInDisplay(fluid.getClass())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (searchMod) {
|
||||
if (m.matcher(Util.getFluidModID(fluid).toLowerCase()).find()
|
||||
|| m.matcher(Util.getFluidModName(fluid).toLowerCase()).find()) {
|
||||
@@ -179,7 +186,7 @@ public class FluidRepo extends ItemRepo {
|
||||
}
|
||||
}
|
||||
|
||||
private void updateNEI(final String filter) {
|
||||
protected void updateNEI(final String filter) {
|
||||
try {
|
||||
if (this.NEIWord == null || !this.NEIWord.equals(filter)) {
|
||||
final Class<?> c = ReflectionHelper
|
||||
@@ -199,19 +206,23 @@ public class FluidRepo extends ItemRepo {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return this.view.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
this.list.resetStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPower() {
|
||||
return this.hasPower;
|
||||
}
|
||||
|
||||
public void setPower(final boolean hasPower) {
|
||||
@Override
|
||||
public void setPowered(final boolean hasPower) {
|
||||
this.hasPower = hasPower;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ public class Config {
|
||||
public static boolean noFluidPacket;
|
||||
public static boolean fluidIOBus;
|
||||
public static boolean removeRecipe;
|
||||
public static boolean blacklistEssentiaGas;
|
||||
public static double portableCellBattery;
|
||||
public static int packetSize;
|
||||
public static int packetRate;
|
||||
@@ -47,11 +46,6 @@ public class Config {
|
||||
"Fluid Craft for AE2",
|
||||
false,
|
||||
"Disable all recipes, for quick tweaker.");
|
||||
blacklistEssentiaGas = Config.getBoolean(
|
||||
"Blacklist Essentia Gas",
|
||||
"Fluid Craft for AE2",
|
||||
true,
|
||||
"Blacklist Essentia Gas from Thaumic Energistics, so they won't be stored in Fluid Storage Cells.");
|
||||
portableCellBattery = Config.get("Fluid Craft for AE2", "Portable Fluid Cell Battery Capacity", 20000D)
|
||||
.getDouble();
|
||||
packetSize = Config.get("Fluid Craft for AE2", "packetSize", 256, "Number of items to be sent per packet")
|
||||
@@ -62,8 +56,8 @@ public class Config {
|
||||
.getInt();
|
||||
if (packetRate <= 0) packetRate = 50;
|
||||
replaceEC2 = Config.getBoolean(
|
||||
"Fluid Craft for AE2",
|
||||
"replaceEC2",
|
||||
"Fluid Craft for AE2",
|
||||
true,
|
||||
"Set true to handle missing item mappings from EC2. Note to work properly, you must have all relevant parts.");
|
||||
if (Config.hasChanged()) Config.save();
|
||||
|
||||
@@ -14,13 +14,12 @@ import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.glodblock.github.common.Config;
|
||||
import com.glodblock.github.api.FluidCraftAPI;
|
||||
import com.glodblock.github.common.storage.CellType;
|
||||
import com.glodblock.github.common.storage.IFluidCellInventory;
|
||||
import com.glodblock.github.common.storage.IFluidCellInventoryHandler;
|
||||
import com.glodblock.github.common.storage.IStorageFluidCell;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
@@ -87,10 +86,13 @@ public abstract class FCBaseItemCell extends AEBaseItem implements IStorageFluid
|
||||
|
||||
@Override
|
||||
public boolean isBlackListed(ItemStack cellItem, IAEFluidStack requestedAddition) {
|
||||
if (Config.blacklistEssentiaGas && ModAndClassUtil.ThE && requestedAddition != null) {
|
||||
return ModAndClassUtil.essentiaGas.isInstance(requestedAddition.getFluid());
|
||||
}
|
||||
return false;
|
||||
// if (Config.blacklistEssentiaGas && ModAndClassUtil.ThE && requestedAddition != null) {
|
||||
// return ModAndClassUtil.essentiaGas.isInstance(requestedAddition.getFluid());
|
||||
// }
|
||||
//
|
||||
// What even is a null fluid
|
||||
return requestedAddition == null || requestedAddition.getFluid() == null
|
||||
|| FluidCraftAPI.instance().isBlacklistedInStorage(requestedAddition.getFluid().getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,13 +10,12 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.common.Config;
|
||||
import com.glodblock.github.api.FluidCraftAPI;
|
||||
import com.glodblock.github.common.storage.IFluidCellInventory;
|
||||
import com.glodblock.github.common.storage.IFluidCellInventoryHandler;
|
||||
import com.glodblock.github.common.storage.IStorageFluidCell;
|
||||
import com.glodblock.github.common.tabs.FluidCraftingTabs;
|
||||
import com.glodblock.github.loader.IRegister;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
@@ -54,10 +53,9 @@ public class ItemCreativeFluidStorageCell extends AEBaseItem
|
||||
|
||||
@Override
|
||||
public boolean isBlackListed(ItemStack cellItem, IAEFluidStack requestedAddition) {
|
||||
if (Config.blacklistEssentiaGas && ModAndClassUtil.ThE && requestedAddition != null) {
|
||||
return ModAndClassUtil.essentiaGas.isInstance(requestedAddition.getFluid());
|
||||
}
|
||||
return false;
|
||||
// What even is a null fluid
|
||||
return requestedAddition == null || requestedAddition.getFluid() == null
|
||||
|| FluidCraftAPI.instance().isBlacklistedInStorage(requestedAddition.getFluid().getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -13,6 +13,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.api.FluidCraftAPI;
|
||||
import com.glodblock.github.common.Config;
|
||||
import com.glodblock.github.common.storage.IFluidCellInventory;
|
||||
import com.glodblock.github.common.storage.IFluidCellInventoryHandler;
|
||||
@@ -24,7 +25,6 @@ import com.glodblock.github.inventory.item.IItemInventory;
|
||||
import com.glodblock.github.inventory.item.PortableFluidCellInventory;
|
||||
import com.glodblock.github.loader.IRegister;
|
||||
import com.glodblock.github.util.BlockPos;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
import com.glodblock.github.util.RenderUtil;
|
||||
import com.google.common.base.Optional;
|
||||
@@ -132,10 +132,9 @@ public class ItemPortableFluidCell extends AEBasePoweredItem
|
||||
|
||||
@Override
|
||||
public boolean isBlackListed(ItemStack cellItem, IAEFluidStack requestedAddition) {
|
||||
if (Config.blacklistEssentiaGas && ModAndClassUtil.ThE && requestedAddition != null) {
|
||||
return ModAndClassUtil.essentiaGas.isInstance(requestedAddition.getFluid());
|
||||
}
|
||||
return false;
|
||||
// What even is a null fluid
|
||||
return requestedAddition == null || requestedAddition.getFluid() == null
|
||||
|| FluidCraftAPI.instance().isBlacklistedInStorage(requestedAddition.getFluid().getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.glodblock.github.api.FluidCraftAPI;
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
@@ -190,7 +191,8 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
|
||||
if (fluidGrid != null) {
|
||||
for (IAEFluidStack fluid : fluidGrid.getStorageList()) {
|
||||
IAEItemStack stack = ItemFluidDrop.newAeStack(fluid);
|
||||
if (stack != null) {
|
||||
if (stack != null
|
||||
&& !FluidCraftAPI.instance().isBlacklistedInDisplay(fluid.getFluid().getClass())) {
|
||||
itemCache.add(stack);
|
||||
}
|
||||
}
|
||||
@@ -221,7 +223,8 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
|
||||
List<IAEItemStack> mappedChanges = new ArrayList<>();
|
||||
for (IAEFluidStack fluidStack : change) {
|
||||
IAEItemStack itemStack = ItemFluidDrop.newAeStack(fluidStack);
|
||||
if (itemStack != null) {
|
||||
if (itemStack != null
|
||||
&& !FluidCraftAPI.instance().isBlacklistedInDisplay(fluidStack.getFluid().getClass())) {
|
||||
mappedChanges.add(itemStack);
|
||||
}
|
||||
}
|
||||
|
||||
+4
-6
@@ -3,10 +3,9 @@ package com.glodblock.github.crossmod.extracells.storage;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.glodblock.github.common.Config;
|
||||
import com.glodblock.github.api.FluidCraftAPI;
|
||||
import com.glodblock.github.common.storage.IStorageFluidCell;
|
||||
import com.glodblock.github.crossmod.extracells.ProxyItem;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
@@ -46,10 +45,9 @@ public class ProxyFluidStorageCell extends ProxyItem implements IStorageFluidCel
|
||||
|
||||
@Override
|
||||
public boolean isBlackListed(ItemStack cellItem, IAEFluidStack requestedAddition) {
|
||||
if (Config.blacklistEssentiaGas && ModAndClassUtil.ThE && requestedAddition != null) {
|
||||
return ModAndClassUtil.essentiaGas.isInstance(requestedAddition.getFluid());
|
||||
}
|
||||
return false;
|
||||
// What even is a null fluid
|
||||
return requestedAddition == null || requestedAddition.getFluid() == null
|
||||
|| FluidCraftAPI.instance().isBlacklistedInStorage(requestedAddition.getFluid().getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.Objects;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
@@ -11,9 +12,11 @@ import org.apache.commons.lang3.tuple.MutablePair;
|
||||
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.util.item.AEFluidStack;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.IEssentiaContainerItem;
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
import thaumicenergistics.api.ThEApi;
|
||||
import thaumicenergistics.api.storage.IAspectStack;
|
||||
import thaumicenergistics.common.fluids.GaseousEssentia;
|
||||
import thaumicenergistics.common.integration.tc.EssentiaItemContainerHelper;
|
||||
@@ -22,7 +25,12 @@ import thaumicenergistics.common.storage.AspectStack;
|
||||
public class AspectUtil {
|
||||
|
||||
public static final EssentiaItemContainerHelper HELPER = EssentiaItemContainerHelper.INSTANCE;
|
||||
public static final int R = 128;
|
||||
public static int R = 128;
|
||||
|
||||
@Optional.Method(modid = "thaumicenergistics")
|
||||
public static void init() {
|
||||
R = ThEApi.instance().config().conversionMultiplier();
|
||||
}
|
||||
|
||||
public static boolean isPlayerDiscoveredAspect(final EntityPlayer player, final Aspect aspect) {
|
||||
if (player != null && aspect != null) {
|
||||
@@ -31,6 +39,10 @@ public class AspectUtil {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isEssentiaGas(Fluid fluid) {
|
||||
return fluid != null && fluid instanceof GaseousEssentia;
|
||||
}
|
||||
|
||||
public static boolean isEssentiaGas(FluidStack fluid) {
|
||||
return fluid != null && fluid.getFluid() instanceof GaseousEssentia;
|
||||
}
|
||||
|
||||
@@ -9,15 +9,10 @@ import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
import appeng.api.config.TypeFilter;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.client.me.ItemRepo;
|
||||
|
||||
public class FluidFilter {
|
||||
|
||||
public static void installFilter() {
|
||||
ItemRepo.registerTypeHandler(FluidFilter::filter, FLUIDS);
|
||||
}
|
||||
|
||||
private static boolean filter(IAEStack<?> stack, TypeFilter typeFilter) {
|
||||
public static boolean filter(TypeFilter typeFilter, IAEStack<?> stack) {
|
||||
if (typeFilter == ALL) return true;
|
||||
if (stack instanceof IAEItemStack) {
|
||||
Item item = ((IAEItemStack) stack).getItem();
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.common.Config;
|
||||
import com.glodblock.github.common.tile.TileWalrus;
|
||||
import com.glodblock.github.crossmod.extracells.EC2Replacer;
|
||||
import com.glodblock.github.crossmod.thaumcraft.AspectUtil;
|
||||
import com.glodblock.github.inventory.external.AEFluidInterfaceHandler;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.network.SPacketMEUpdateBuffer;
|
||||
@@ -30,6 +31,9 @@ public class CommonProxy {
|
||||
public void init(FMLInitializationEvent event) {
|
||||
this.registerMovables();
|
||||
FMLCommonHandler.instance().bus().register(SPacketMEUpdateBuffer.class);
|
||||
if (ModAndClassUtil.ThE) {
|
||||
AspectUtil.init();
|
||||
}
|
||||
}
|
||||
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
|
||||
@@ -40,8 +40,6 @@ public final class ModAndClassUtil {
|
||||
|
||||
public static boolean isBeSubstitutionsButton;
|
||||
|
||||
public static Class<?> essentiaGas;
|
||||
|
||||
@SuppressWarnings("all")
|
||||
public static void init() {
|
||||
|
||||
@@ -115,17 +113,10 @@ public final class ModAndClassUtil {
|
||||
isV2 = false;
|
||||
}
|
||||
try {
|
||||
Field filters = Class.forName("appeng.client.me.ItemRepo").getDeclaredField("filters");
|
||||
if (filters == null) isTypeFilter = false;
|
||||
Class<?> filter = Class.forName("appeng.core.features.registries.ItemDisplayRegistry");
|
||||
isTypeFilter = true;
|
||||
} catch (ClassNotFoundException | NoSuchFieldException e) {
|
||||
isTypeFilter = false;
|
||||
}
|
||||
|
||||
try {
|
||||
essentiaGas = Class.forName("thaumicenergistics.common.fluids.GaseousEssentia");
|
||||
} catch (ClassNotFoundException e) {
|
||||
essentiaGas = null;
|
||||
isTypeFilter = false;
|
||||
}
|
||||
|
||||
if (Loader.isModLoaded("gregtech") && !Loader.isModLoaded("gregapi")) GT5 = true;
|
||||
|
||||
Reference in new issue
Block a user