Skip to content
4 changes: 3 additions & 1 deletion src/main/java/com/glodblock/github/FluidCraft.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
import com.glodblock.github.loader.ItemAndBlockHolder;
import com.glodblock.github.loader.RecipeLoader;
import com.glodblock.github.proxy.CommonProxy;
import com.glodblock.github.util.FluidCellHandler;
import com.glodblock.github.util.ModAndClassUtil;

import appeng.api.AEApi;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
Expand Down Expand Up @@ -60,7 +62,7 @@ public static void init(FMLInitializationEvent event) {
@Mod.EventHandler
public static void postInit(FMLPostInitializationEvent event) {
NetworkRegistry.INSTANCE.registerGuiHandler(FluidCraft.INSTANCE, new InventoryHandler());

AEApi.instance().registries().cell().addCellHandler(new FluidCellHandler());
ItemAndBlockHolder.loadSetting();

if (!Config.removeRecipe) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ public enum FCPartsTexture {
PartFluidFormationPlane("fluid_formation_plane"),
PartFluidAnnihilationPlane("fluid_annihilation_plane"),
PartFluidFormationPlaneOn("fluid_formation_plane_on"),
PartFluidAnnihilationPlaneOn("fluid_annihilation_plane_on");
PartFluidAnnihilationPlaneOn("fluid_annihilation_plane_on"),
BlockMEChestFluid_Bright("fluid_terminal_light"),
BlockMEChestFluid_Dark("fluid_terminal_dark"),
BlockMEChestFluid_Medium("fluid_terminal_medium");

private final String name;
public net.minecraft.util.IIcon IIcon;
Expand Down
85 changes: 85 additions & 0 deletions src/main/java/com/glodblock/github/util/FluidCellHandler.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
package com.glodblock.github.util;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;

import com.glodblock.github.client.textures.FCPartsTexture;
import com.glodblock.github.common.item.FCBaseItemCell;

import appeng.api.implementations.items.IStorageCell;
import appeng.api.implementations.tiles.IChestOrDrive;
import appeng.api.storage.ICellHandler;
import appeng.api.storage.ICellInventoryHandler;
import appeng.api.storage.IMEInventory;
import appeng.api.storage.IMEInventoryHandler;
import appeng.api.storage.ISaveProvider;
import appeng.api.storage.StorageChannel;
import appeng.api.storage.data.IAEStackType;
import appeng.core.sync.GuiBridge;
import appeng.me.storage.CellInventory;
import appeng.me.storage.FluidCellInventoryHandler;
import appeng.util.Platform;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class FluidCellHandler implements ICellHandler {

@Override
public boolean isCell(final ItemStack is) {
/*
* FCBaseItemCell covers Basic, Multi, and Extreme fluid storage
*/
return is != null && is.getItem() instanceof FCBaseItemCell;
}

/**
* ME Chest icon
*/
@Override
@SideOnly(Side.CLIENT)
public IIcon getTopTexture_Dark() {
return FCPartsTexture.BlockMEChestFluid_Dark.getIcon();
}

@Override
@SideOnly(Side.CLIENT)
public IIcon getTopTexture_Light() {
return FCPartsTexture.BlockMEChestFluid_Bright.getIcon();
}

@Override
@SideOnly(Side.CLIENT)
public IIcon getTopTexture_Medium() {
return FCPartsTexture.BlockMEChestFluid_Medium.getIcon();
}

@Override
public void openChestGui(final EntityPlayer player, final IChestOrDrive chest, final ICellHandler cellHandler,
@SuppressWarnings("rawtypes") final IMEInventoryHandler inv, final ItemStack itemStack,
final StorageChannel channel) {
Platform.openGUI(player, (TileEntity) chest, chest.getUp(), GuiBridge.GUI_ME);
}

@Override
public int getStatusForCell(ItemStack is, IMEInventory handler) {
if (handler instanceof FluidCellInventoryHandler ci) {
return ci.getStatusForCell();
}
return 0;
}

@Override
public double cellIdleDrain(final ItemStack is, @SuppressWarnings("rawtypes") final IMEInventory handler) {
return ((ICellInventoryHandler) handler).getCellInv().getIdleDrain();
}

@Override
public IMEInventoryHandler getCellInventory(ItemStack fluidCell, ISaveProvider saveProvider, IAEStackType<?> type) {
if (fluidCell != null && fluidCell.getItem() instanceof IStorageCell cell && cell.getStackType() == type) {
return CellInventory.getCell(fluidCell, saveProvider, type);
}
return null;
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading