package com.InfinityRaider.AgriCraft.utility;

import com.InfinityRaider.AgriCraft.utility.interfaces.IDebuggable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.world.World;

import java.util.ArrayList;
import java.util.List;

public abstract class DebugHelper {
    public static void debug(EntityPlayer player, World world, int x, int y, int z) {
        ArrayList<String> list = new ArrayList<String>();
        getDebugData(world, x, y,z, list);
        for(String data:list) {
            LogHelper.debug(data);
            player.addChatComponentMessage(new ChatComponentText(data));
        }
    }

    public static void debug(World world, int x, int y, int z) {
        ArrayList<String> list = new ArrayList<String>();
        getDebugData(world, x, y,z, list);
        for(String data:list) {
            LogHelper.debug(data);
        }
    }

    private static void getDebugData(World world, int x, int y, int z, List<String> list) {
        if (!world.isRemote) {
            list.add("Server debug info:");
            list.add("------------------");
        } else {
            list.add("Client debug info:");
            list.add("------------------");
        }
        TileEntity tile = world.getTileEntity(x, y, z);
        if(tile!=null && tile instanceof IDebuggable) {
            ((IDebuggable) tile).addDebugInfo(list);
        }
        else {
            list.add("not debuggable");
        }
    }
}

@@ -108,16 +108,50 @@
 ggable;%0A
+import net.minecraft.block.Block;%0A
 import n
@@ -1539,23 +1539,143 @@
 dd(%22
-not debuggable%22
+Block: %22+ Block.blockRegistry.getNameForObject(world.getBlock(x, y, z)));%0A            list.add(%22Meta: %22+world.getBlockMetadata(x, y, z)
 );%0A 

Debug method