package mcjty.rftools.blocks.endergen;

import mcjty.lib.container.EmptyContainer;
import mcjty.rftools.RFTools;
import mcjty.rftools.blocks.logic.generic.LogicSlabBlock;
import mcjty.theoneprobe.api.IProbeHitData;
import mcjty.theoneprobe.api.IProbeInfo;
import mcjty.theoneprobe.api.ProbeMode;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.Optional;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

import java.util.List;

public class EnderMonitorBlock extends LogicSlabBlock<EnderMonitorTileEntity, EmptyContainer> {

    public EnderMonitorBlock() {
        super(Material.IRON, "ender_monitor", EnderMonitorTileEntity.class, EmptyContainer.class);
        setCreativeTab(RFTools.tabRfTools);
    }

    @Override
    public boolean needsRedstoneCheck() {
        return false;
    }

    @Override
    public int getGuiID() {
        return RFTools.GUI_ENDERMONITOR;
    }

    @SideOnly(Side.CLIENT)
    @Override
    public Class<GuiEnderMonitor> getGuiClass() {
        return GuiEnderMonitor.class;
    }

    @SideOnly(Side.CLIENT)
    @Override
    public void addInformation(ItemStack itemStack, World player, List<String> list, ITooltipFlag whatIsThis) {
        super.addInformation(itemStack, player, list, whatIsThis);
        NBTTagCompound tagCompound = itemStack.getTagCompound();
        if (tagCompound != null) {
            int mode = tagCompound.getInteger("mode");
            String smode = EnderMonitorMode.values()[mode].getDescription();
            list.add(TextFormatting.GREEN + "Mode: " + smode);
        }
    }

    @Override
    @Optional.Method(modid = "theoneprobe")
    public void addProbeInfo(ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data) {
        super.addProbeInfo(mode, probeInfo, player, world, blockState, data);
        TileEntity te = world.getTileEntity(data.getPos());
        if (te instanceof EnderMonitorTileEntity) {
            EnderMonitorTileEntity tileEntity = (EnderMonitorTileEntity) te;
            EnderMonitorMode m = tileEntity.getMode();
            probeInfo.text(TextFormatting.GREEN + "Mode: " + m.getDescription());
        }
    }
}

@@ -285,24 +285,121 @@
 .ProbeMode;%0A
+import mcp.mobius.waila.api.IWailaConfigHandler;%0Aimport mcp.mobius.waila.api.IWailaDataAccessor;%0A
 import net.m
@@ -2694,11 +2694,661 @@
  %7D%0A    %7D
+%0A%0A    @SideOnly(Side.CLIENT)%0A    @Override%0A    @Optional.Method(modid = %22waila%22)%0A    public List%3CString%3E getWailaBody(ItemStack itemStack, List%3CString%3E currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) %7B%0A        super.getWailaBody(itemStack, currenttip, accessor, config);%0A        TileEntity te = accessor.getTileEntity();%0A        if (te instanceof EnderMonitorTileEntity) %7B%0A            EnderMonitorTileEntity tileEntity = (EnderMonitorTileEntity) te;%0A            EnderMonitorMode m = tileEntity.getMode();%0A            currenttip.add(TextFormatting.GREEN + %22Mode: %22 + m.getDescription());%0A        %7D%0A        return currenttip;%0A    %7D
 %0A%7D%0A

Add Waila support to the ender monitor