mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-14 01:04:25 +00:00
Update ME Chest display for fluid cells (#456)
This commit is contained in:
6 files changed
+92
-2
No files matched your search
@@ -10,8 +10,10 @@ import com.glodblock.github.loader.ChannelLoader;
|
||||
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;
|
||||
@@ -60,7 +62,7 @@ public class FluidCraft {
|
||||
@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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user