public interface ILBCommonProxy extends ICommonProxy {

    ILittleWorld getLittleWorld(IBlockAccess world, boolean needsRefresh);

    World getParentWorld(ILittleWorld littleWorld, int realDimension);
} public interface ILittleWorld extends IBlockAccess {

    public World getParentWorld();

    public boolean isOutdated(World world);

    public boolean isOutSideLittleWorld(int x, int y, int z);

    public void activeChunkPosition(ChunkPosition chunkposition, boolean forced);

    public List<TileEntity> getLoadedTileEntities();

    public void addLoadedTileEntity(TileEntity tile);
}
 public class LittleContainerInteract {

    @SubscribeEvent
    public void onInteractEvent(PlayerOpenContainerEvent event) {
        if (!event.canInteractWith) {
            try {
                Field fields[] = event.entityPlayer.openContainer.getClass().getDeclaredFields();
                GenericCanInteract(event,
                                   fields,
                                   event.entityPlayer.openContainer);
            } catch (StackOverflowError s) {
                s.printStackTrace();
            }
        }
    }

    private void GenericCanInteract(PlayerOpenContainerEvent event, Field fields[], Object datasource) {
        for (int i = 0; i < fields.length && event.getResult() != Result.ALLOW; i++) {
            try {
                fields[i].setAccessible(true);
                if (fields[i].get(datasource) instanceof TileEntity) {
                    TileEntity tile = (TileEntity) fields[i].get(datasource);
                    if (tile.hasWorldObj()
                        && tile.getWorldObj() instanceof ILittleWorld) {
                        TileEntityCanInteract(event,
                                              tile);
                        break;

                    }
                } else if (fields[i].get(datasource) instanceof IBlockAccess) {
                    IBlockAccess world = (IBlockAccess) fields[i].get(datasource);
                    WorldCanInteract(event,
                                     fields[i],
                                     world,
                                     fields,
                                     i,
                                     datasource);
                    break;

                } else if (fields[i].get(datasource) instanceof IInventory) {
                    GenericCanInteract(event,
                                       fields[i].get(datasource).getClass().getDeclaredFields(),
                                       fields[i].get(datasource));

                }
            } catch (IllegalArgumentException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
        // last ditch effort
        if (event.getResult() != Result.ALLOW
            && event.getResult() != Result.DENY) {
            FakePlayer fakePlayer = new FakePlayer((WorldServer) event.entityPlayer.worldObj, new GameProfile((UUID)null, CoreLib.MOD_CHANNEL));
            fakePlayer.posX = event.entityPlayer.posX * 8;
            fakePlayer.posY = (event.entityPlayer.posY + (event.entityPlayer.height * 0.9)) * 8;
            fakePlayer.posZ = event.entityPlayer.posZ * 8;
            fakePlayer.openContainer = event.entityPlayer.openContainer;
            if (fakePlayer.openContainer.canInteractWith(fakePlayer)) {
                event.setResult(Result.ALLOW);
            }
        }
    }

    private void TileEntityCanInteract(PlayerOpenContainerEvent event, TileEntity tile) {
        if (Math.pow(Math.pow((tile.xCoord >> 3) - event.entityPlayer.posX,
                              2)
                             + Math.pow((tile.yCoord >> 3)
                                                - event.entityPlayer.posY,
                                        2)
                             + Math.pow((tile.zCoord >> 3)
                                                - event.entityPlayer.posZ,
                                        2),
                     .5) <= 4) {
            FakePlayer fakePlayer = new FakePlayer((WorldServer) event.entityPlayer.worldObj, new GameProfile((UUID)null, CoreLib.MOD_CHANNEL));
            fakePlayer.posX = (tile.xCoord);
            fakePlayer.posY = (tile.yCoord);
            fakePlayer.posZ = (tile.zCoord);

            fakePlayer.openContainer = event.entityPlayer.openContainer;
            if (fakePlayer.openContainer.canInteractWith(fakePlayer)) {
                event.setResult(Result.ALLOW);
            }
        }
    }

    private void WorldCanInteract(PlayerOpenContainerEvent event, Field worldField, IBlockAccess world, Field[] fields, int worldFieldIndex, Object datasource) {
        try {
            boolean checked = false;
            worldField.set(datasource,
                           LittleBlocks.proxy.getLittleWorld(world,
                                                             false));
            FakePlayer fakePlayer = new FakePlayer((WorldServer) event.entityPlayer.worldObj, new GameProfile((UUID)null, CoreLib.MOD_CHANNEL));
            if (fields.length > worldFieldIndex + 3) {
                fields[worldFieldIndex + 1].setAccessible(true);
                fields[worldFieldIndex + 2].setAccessible(true);
                fields[worldFieldIndex + 3].setAccessible(true);

                fakePlayer.openContainer = event.entityPlayer.openContainer;
                if (fields[worldFieldIndex + 1].get(datasource) instanceof Integer
                    && fields[worldFieldIndex + 2].get(datasource) instanceof Integer
                    && fields[worldFieldIndex + 3].get(datasource) instanceof Integer) {
                    if (Math.pow(Math.pow((fields[worldFieldIndex + 1].getInt(datasource) >> 3)
                                                  - event.entityPlayer.posX,
                                          2)
                                         + Math.pow((fields[worldFieldIndex + 2].getInt(datasource) >> 3)
                                                            - event.entityPlayer.posY,
                                                    2)
                                         + Math.pow((fields[worldFieldIndex + 3].getInt(datasource) >> 3)
                                                            - event.entityPlayer.posZ,
                                                    2),
                                 .5) <= 4) {
                        fakePlayer.posX = fields[worldFieldIndex + 1].getInt(datasource);
                        fakePlayer.posY = fields[worldFieldIndex + 2].getInt(datasource);
                        fakePlayer.posZ = fields[worldFieldIndex + 3].getInt(datasource);
                        checked = true;
                    }
                }
            }
            if (!checked) {
                // do this in case the worldobj is the only thing keeping us
                // from interacting
                fakePlayer.posX = event.entityPlayer.posX * 8;
                fakePlayer.posY = (event.entityPlayer.posY + (event.entityPlayer.height * 0.9)) * 8;
                fakePlayer.posZ = event.entityPlayer.posZ * 8;
            }

            if (fakePlayer.openContainer.canInteractWith(fakePlayer)) {
                event.setResult(Result.ALLOW);
            }
            worldField.set(datasource,
                           world);
        } catch (IllegalArgumentException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
} public class ConfigurationLib {

    private static File                     configurationFile;
    private static Configuration            configuration;

    public static LittleWorldClient         littleWorldClient;
    public static HashMap<Integer, Integer> littleWorldServer      = new HashMap<Integer, Integer>();

    public static boolean                   littleBlocksForceUpdate;
    public static String                    loggerLevel            = "INFO";
    public static Block                     littleChunk;
    public static Item                      littleBlocksWand;
    public static int                       littleChunkID;
    public static int                       littleBlocksWandID;
    public static int                       littleBlocksCollectionID;
    public static boolean                   littleBlocksClip;
    public static int                       renderingMethod;
    public static int                       renderType;
    public static int                       littleBlocksSize       = 8;

    private static String                   CATEGORY_OVERRIDES     = "overrides";
    public static int                       pistonStickyIndex      = 50;
    public static int                       pistonBaseIndex        = 54;
    public static int                       doorWoodIndex          = 85;
    public static int                       doorIronIndex          = 92;

    private static List<Integer>            disallowedDimensionIds = new ArrayList<Integer>();

    @SideOnly(Side.CLIENT)
    public static RenderBlocks              littleRenderer;

    public static Configuration getConfiguration() {
        return configuration;
    }

    @SideOnly(Side.CLIENT)
    public static void ClientConfig(File configFile) {
        if (configurationFile == null) {
            configurationFile = configFile;
            configuration = new Configuration(configFile);
        }
    }

    public static void CommonConfig(File configFile) {
        if (configurationFile == null) {
            configurationFile = configFile;
            configuration = new Configuration(configFile);
        }

        configuration.load();

        // Illegal blocks
        // Parse the list of illegal blocks separated by ;
        String disallowedBlockIDs[] = configuration.get(Configuration.CATEGORY_GENERAL,
                                                        "disallowedBlockIDs",
                                                        "").getString().split("\\;",
                                                                              -1);
        for (int i = 0; i < disallowedBlockIDs.length; i++) {
            if (!disallowedBlockIDs[i].isEmpty()) {
                BlockUtil.registerDisallowedBlockID(Integer.valueOf(disallowedBlockIDs[i]));
            }
        }
        String disallowedItemIDs[] = configuration.get(Configuration.CATEGORY_GENERAL,
                                                       "disallowedItemIDs",
                                                       "").getString().split("\\;",
                                                                             -1);
        for (int i = 0; i < disallowedItemIDs.length; i++) {
            if (!disallowedItemIDs[i].isEmpty()) {
                BlockUtil.registerDisallowedItemID(Integer.valueOf(disallowedItemIDs[i]));
            }
        }

        littleChunkID = configuration.get(Configuration.CATEGORY_GENERAL,
                                          "littleChunkID",
                                          1150).getInt();
        littleBlocksWandID = configuration.get(Configuration.CATEGORY_GENERAL,
                                               "littleBlocksWandID",
                                               29999).getInt();
        littleBlocksCollectionID = configuration.get(Configuration.CATEGORY_GENERAL,
                                                     "littleBlocksCollectionID",
                                                     EntityRegistry.findGlobalUniqueEntityId()).getInt();
        littleBlocksClip = configuration.get(Configuration.CATEGORY_GENERAL,
                                             "littleBlocksClip",
                                             true).getBoolean(true);
        littleBlocksForceUpdate = configuration.get(Configuration.CATEGORY_GENERAL,
                                                    "littleBlocksForceUpdate",
                                                    false).getBoolean(false);
        renderingMethod = configuration.get(Configuration.CATEGORY_GENERAL,
                                            "renderingMethod",
                                            0).getInt();
        renderType = RenderingRegistry.getNextAvailableRenderId();
        loggerLevel = configuration.get(Configuration.CATEGORY_GENERAL,
                                        "loggerLevel",
                                        "INFO").getString();

        int[] disallowedIds = configuration.get(Configuration.CATEGORY_GENERAL,
                                                "disallowedLittleDimensionIds",
                                                new int[] { 7, 20 }).getIntList();

        for (int disallowedId : disallowedIds) {
            disallowedDimensionIds.add(disallowedId);
        }

        pistonStickyIndex = configuration.get(CATEGORY_OVERRIDES,
                                              "pistonStickyIndex",
                                              pistonStickyIndex).getInt();
        pistonBaseIndex = configuration.get(CATEGORY_OVERRIDES,
                                            "pistonBaseIndex",
                                            pistonBaseIndex).getInt();

        doorWoodIndex = configuration.get(CATEGORY_OVERRIDES,
                                          "doorWoodIndex",
                                          doorWoodIndex).getInt();
        doorIronIndex = configuration.get(CATEGORY_OVERRIDES,
                                          "doorIronIndex",
                                          doorIronIndex).getInt();

        configuration.save();

        LoggerLittleBlocks.getInstance("LittleBlocksConfig").setFilterLevel(loggerLevel);
    }

    @SideOnly(Side.CLIENT)
    public static RenderBlocks getLittleRenderer(World world) {
        /*
         * if (littleRenderer != null &&
         * !LBCore.littleWorldClient.isOutdated(world)) { return littleRenderer;
         * }
         */
        return setLittleRenderer(world);
    }

    @SideOnly(Side.CLIENT)
    public static RenderBlocks setLittleRenderer(World world) {
        if (world == null) {
            return littleRenderer = null;
        }
        return littleRenderer = new RenderBlocks(littleWorldClient);
    }

    public static int getLittleServerDimension(int dimension) {
        configuration.load();
        int candidateDimensionId = DimensionManager.getNextFreeDimId();
        while (disallowedDimensionIds.contains(candidateDimensionId)
               || DimensionManager.isDimensionRegistered(candidateDimensionId)) {
            candidateDimensionId++;
        }
        int littleDimension = configuration.get(Configuration.CATEGORY_GENERAL,
                                                FMLCommonHandler.instance().getMinecraftServerInstance().getFolderName()
                                                        + "-littleServerDimension["
                                                        + dimension + "]",
                                                candidateDimensionId).getInt();
        configuration.save();
        return littleDimension;
    }

    public static boolean isLittleDimension(int dimension) {
        return configuration.hasKey(Configuration.CATEGORY_GENERAL,
                                    "littleServerDimension[" + dimension + "]");
    }

} public class CoreLib {

    public static final String MOD_ID             = "LittleBlocks";
    public static final String MOD_RESOURCES      = "littleblocks";
    public static final String MOD_NAME           = "Little Blocks";
    public static final String MOD_VERSION        = "@VERSION@";
    public static final String MOD_DEPENDENCIES   = "required-after:SlimevoidLib";
    public static final String MOD_CHANNEL        = "LITTLEBLOCKS";
    public static final String CLIENT_PROXY       = "net.slimevoid.littleblocks.client.proxy.ClientProxy";
    public static final String COMMON_PROXY       = "net.slimevoid.littleblocks.proxy.CommonProxy";
    @SideOnly(Side.CLIENT)
    public static boolean      OPTIFINE_INSTALLED = FMLClientHandler.instance().hasOptifine();
}
 public class PacketLib {

    public final static String   CHANNEL_COMMAND_BLOCK = "MC|AdvCdm";
    public final static String   LITTLEWORLD           = "LW:";
    public final static int      PACKETID_EVENT        = PacketIds.PLAYER + 100;
    public final static int      BLOCK_CLICK           = 0;
    public final static int      DIG_ONGOING           = 1;
    public final static int      DIG_BROKEN            = 2;

    public static PacketPipeline handler               = new PacketPipeline();

    @SideOnly(Side.CLIENT)
    public static void registerClientPacketHandlers() {
        MinecraftForge.EVENT_BUS.register(new ClientNetworkEvent());

        handler.getPacketHandler(PacketIds.LOGIN).registerClientExecutor(CommandLib.SETTINGS,
                                                                         new ClientPacketLittleBlocksLoginExecutor());

        handler.getPacketHandler(PacketIds.UPDATE).registerClientExecutor(CommandLib.UPDATE_CLIENT,
                                                                          new ClientBlockChangeExecutor());

        handler.getPacketHandler(PacketIds.ENTITY).registerClientExecutor(CommandLib.ENTITY_COLLECTION,
                                                                          new ClientLittleCollectionExecutor());

        handler.getPacketHandler(PacketIds.PLAYER).registerClientExecutor(CommandLib.COPIER_MESSAGE,
                                                                          new ClientCopierNotifyExecutor());

        handler.getPacketHandler(PACKETID_EVENT).registerClientExecutor(CommandLib.BLOCK_EVENT,
                                                                        new ClientBlockEventExecutor());
    }

    public static void registerPacketHandlers() {
        MinecraftForge.EVENT_BUS.register(new NetworkEvent());

        PacketLittleNotifyHandler playerHandler = new PacketLittleNotifyHandler();
        playerHandler.registerServerExecutor(CommandLib.WAND_SWITCH,
                                             new PacketLittleWandSwitchExecutor());

        handler.registerPacketHandler(PacketIds.PLAYER,
                                      playerHandler);

        PacketLittleBlockHandler littleBlockHandler = new PacketLittleBlockHandler();
        littleBlockHandler.registerServerExecutor(CommandLib.BLOCK_ACTIVATED,
                                                  new PacketLittleBlockActivatedExecutor());
        littleBlockHandler.registerServerExecutor(CommandLib.BLOCK_CLICKED,
                                                  new PacketLittleBlockClickedExecutor());

        handler.registerPacketHandler(PacketIds.LOGIN,
                                      new PacketLoginHandler());

        handler.registerPacketHandler(PacketIds.TILE,
                                      littleBlockHandler);

        handler.registerPacketHandler(PacketIds.ENTITY,
                                      new PacketLittleBlockCollectionHandler());

        handler.registerPacketHandler(PACKETID_EVENT,
                                      new PacketLittleBlockEventHandler());

        handler.registerPacketHandler(PacketIds.UPDATE,
                                      new PacketLittleBlocksHandler());
    }

    @SideOnly(Side.CLIENT)
    public static void blockActivated(World world, EntityPlayer entityplayer, int x, int y, int z, int q, float a, float b, float c) {
        PacketLittleBlock packetLB = new PacketLittleBlock(x, y, z, q, entityplayer.getCurrentEquippedItem(), a, b, c);
        PacketHelper.sendToServer(packetLB);
    }

    public static void sendBlockEvent(int x, int y, int z, int blockID, int eventID, int eventParameter) {
        PacketLittleBlocksEvents eventPacket = new PacketLittleBlocksEvents(x, y, z, blockID, eventID, eventParameter);
        PacketHelper.broadcastPacket(eventPacket);
    }

    public static void sendBlockClick(int x, int y, int z, int side) {
        PacketLittleBlock clickPacket = new PacketLittleBlock(x, y, z, side);
        PacketHelper.sendToServer(clickPacket);
    }

    public static void sendBlockPlace(World world, EntityPlayer entityplayer, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
        PacketLittleBlock placePacket = new PacketLittleBlock(x, y, z, side, entityplayer.inventory.getCurrentItem(), hitX, hitY, hitZ);
        PacketHelper.sendToServer(placePacket);
    }

    public static void sendItemUse(World world, EntityPlayer entityplayer, int x, int y, int z, int side, ItemStack itemstack) {
        PacketLittleBlock usePacket = new PacketLittleBlock(x, y, z, side, itemstack, 0.0f, 0.0f, 0.0f);
        PacketHelper.sendToServer(usePacket);
    }

    public static void sendBlockChange(World world, EntityPlayer entityplayer, int x, int y, int z) {
        PacketLittleBlockChange changePacket = new PacketLittleBlockChange(x, y, z, world);
        PacketHelper.sendToPlayer(changePacket,
                                  (EntityPlayerMP) entityplayer);
    }

    @SideOnly(Side.CLIENT)
    public static void wandModeSwitched() {
        PacketLittleNotify packet = new PacketLittleNotify(CommandLib.WAND_SWITCH);
        PacketHelper.sendToServer(packet);
    }

    public static void sendWandChange(World world, EntityPlayer entityplayer, int actionID) {
        PacketLittleNotify wandPacket = new PacketLittleNotify(CommandLib.WAND_SWITCH);
        wandPacket.side = actionID;
        PacketHelper.sendToPlayer(wandPacket,
                                  (EntityPlayerMP) entityplayer);
    }

    // public static void tryMinecraftPacket(INetworkManager manager,
    // Packet250CustomPayload packet, Player player) {
    // if (packet.channel.equals(CHANNEL_COMMAND_BLOCK)) {
    // if
    // (!FMLCommonHandler.instance().getMinecraftServerInstance().isCommandBlockEnabled())
    // {
    // ((EntityPlayer)
    // player).sendChatToPlayer(ChatMessageComponent.createFromTranslationKey(MessageLib.COMMAND_BLOCK_DISABLED));
    // } else if (((EntityPlayer) player).canCommandSenderUseCommand(2,
    // "")
    // && ((EntityPlayer) player).capabilities.isCreativeMode) {
    // try {
    // DataInputStream data = new DataInputStream(new
    // ByteArrayInputStream(packet.data));
    // int i = data.readInt();
    // int j = data.readInt();
    // int k = data.readInt();
    // String s = Packet.readString(data,
    // 256);
    // TileEntity realTileEntity = ((EntityPlayer)
    // player).worldObj.getBlockTileEntity(i,
    // j,
    // k);
    // boolean littleCommand = s.startsWith(LITTLEWORLD);
    // if (realTileEntity == null || littleCommand) {
    // TileEntity tileentity =
    // SlimevoidHelper.getBlockTileEntity(((EntityPlayer) player).worldObj,
    // i,
    // j,
    // k);
    //
    // if (tileentity != null
    // && tileentity instanceof TileEntityCommandBlock
    // && tileentity.worldObj instanceof ILittleWorld) {
    // if (littleCommand) {
    // s = s.substring(LITTLEWORLD.length());
    // }
    // ((TileEntityCommandBlock) tileentity).setCommand(s);
    // tileentity.worldObj.markBlockForUpdate(i,
    // j,
    // k);
    // ((EntityPlayer)
    // player).sendChatToPlayer(ChatMessageComponent.createFromTranslationWithSubstitutions(MessageLib.COMMAND_BLOCK_SUCCESS,
    // new Object[] { s }));
    // }
    // }
    // } catch (Exception exception3) {
    // exception3.printStackTrace();
    // }
    // } else {
    // ((EntityPlayer)
    // player).sendChatToPlayer(ChatMessageComponent.createFromTranslationKey(MessageLib.COMMAND_BLOCK_NOT_ALLOWED));
    // }
    // }
    // }
} public class LittleBlocksCollectionPickup {

    @SubscribeEvent
    public void CollectionPickup(EntityItemPickupEvent event) {
        EntityItem item = event.item;
        EntityPlayer entityplayer = event.entityPlayer;
        if (item instanceof EntityItemLittleBlocksCollection) {
            FMLCommonHandler.instance().firePlayerItemPickupEvent(entityplayer,
                                                                  item);

            int size = ((EntityItemLittleBlocksCollection) item).dropItems(entityplayer);
            entityplayer.onItemPickup(event.item,
                                      size);
            event.item.setDead();
            event.setCanceled(true);
        }
    }
} public class LittleChunkEvent {

    @SubscribeEvent
    public void onChunkLoad(Load event) {
        Chunk chunk = event.getChunk();
        for (Object obj : chunk.chunkTileEntityMap.values()) {
            TileEntity tileentity = (TileEntity) obj;
            if (tileentity instanceof TileEntityLittleChunk) {
                ChunkPosition chunkpos = new ChunkPosition(tileentity.xCoord, tileentity.yCoord, tileentity.zCoord);
                this.setActiveChunkPosition(event.world, LittleBlocks.proxy.getLittleWorld(event.world,
                                                                              false),
                                            chunkpos,
                                            true);
            }
        }
    }

    @SubscribeEvent
    public void onChunkUnload(Unload event) {
        Chunk chunk = event.getChunk();
        for (Object obj : chunk.chunkTileEntityMap.values()) {
            TileEntity tileentity = (TileEntity) obj;
            if (tileentity instanceof TileEntityLittleChunk) {
                ChunkPosition chunkpos = new ChunkPosition(tileentity.xCoord, tileentity.yCoord, tileentity.zCoord);
                this.setActiveChunkPosition(event.world, LittleBlocks.proxy.getLittleWorld(event.world,
                                                                              false),
                                            chunkpos,
                                            false);
            }
        }
    }

    private void setActiveChunkPosition(World referenceWorld, ILittleWorld littleworld, ChunkPosition chunkposition, boolean forced) {
        if (littleworld != null) {
            littleworld.activeChunkPosition(chunkposition,
                                            forced);
        } else {
            SlimevoidCore.console(CoreLib.MOD_ID,
                                  "Could not load a little chunk within ["
                                          + referenceWorld != null ? referenceWorld.getWorldInfo().getWorldName() : "Unknown Dimension" + "]",
                                  2);
        }
    }

} public class WorldServerEvent {

    @SubscribeEvent
    public void onWorldUnload(Unload event) {
        if (event.world instanceof WorldServer
            && !(event.world instanceof ILittleWorld)) {
            WorldServer world = (WorldServer) event.world;
            int dimension = world.provider.dimensionId;

            if (ConfigurationLib.littleWorldServer.containsKey(dimension)) {
                int littleDimension = ConfigurationLib.littleWorldServer.remove(dimension);
                if (DimensionManager.isDimensionRegistered(littleDimension)) {
                    DimensionManager.setWorld(littleDimension,
                                              null);
                    DimensionManager.unregisterDimension(littleDimension);
                }
            }
        }
    }

    @SubscribeEvent
    public void onWorldLoad(Load event) {
        if (event.world instanceof ILittleWorld
            && event.world instanceof WorldServer) {
            // System.out.println("ENOUGH WORLD INCEPTION ALREADY!!!!   ");
            WorldServer littleWorldServer = (WorldServer) event.world;
            Chunk chunk = new Chunk(littleWorldServer, new Block[] { Blocks.air }, 0, 0);
            MinecraftForge.EVENT_BUS.post(new ChunkDataEvent.Load(chunk, new NBTTagCompound()));
        } else if (event.world instanceof WorldServer) {
            WorldServer world = (WorldServer) event.world;

            int dimension = world.provider.dimensionId;

            // System.out.println("Loading WorldServer: "
            // + world.getWorldInfo().getWorldName()
            // + " | Dimension: " + dimension);

            int littleDimension = ConfigurationLib.getLittleServerDimension(dimension);

            registerLittleWorldServer(world,
                                      dimension,
                                      littleDimension);
        }
    }

    public void registerLittleWorldServer(WorldServer world, int dimension, int littleDimension) {
        if (!DimensionManager.isDimensionRegistered(littleDimension)) {
            DimensionManager.registerDimension(littleDimension,
                                               0);

            ConfigurationLib.littleWorldServer.put(dimension,
                                                   littleDimension);

            String worldName = world.getWorldInfo().getWorldName()
                               + ".littleWorld";

            WorldSettings worldSettings = new WorldSettings(world.getWorldInfo().getSeed(), world.getWorldInfo().getGameType(), world.getWorldInfo().isMapFeaturesEnabled(), world.getWorldInfo().isHardcoreModeEnabled(), world.getWorldInfo().getTerrainType());

            LittleWorldServer littleWorldServer = new LittleWorldServer(world, FMLCommonHandler.instance().getMinecraftServerInstance(), world.getSaveHandler(), worldName, littleDimension, worldSettings, null);
            MinecraftForge.EVENT_BUS.post(new WorldEvent.Load(littleWorldServer));

            // System.out.println("WorldServer Loaded: "
            // + world.getWorldInfo().getWorldName()
            // + " | Dimension: " + dimension
            // + " | LittleDimension: " + littleDimension);
        }
    }

}
 public class LittleWorldServerTickHandler {

    @SubscribeEvent
    public void onServerTick(ServerTickEvent event) {
        if (event.phase == TickEvent.Phase.START) {
            WorldServer[] worlds = DimensionManager.getWorlds();
            if (worlds != null && worlds.length > 0) {
                for (World world : worlds) {
                    if (world != null && !world.isRemote
                        && !(world instanceof ILittleWorld)) {
                        int dimension = world.provider.dimensionId;
                        if (!ConfigurationLib.littleWorldServer.containsKey(dimension)) {
                            System.out.println("WARNING! No LittleWorld loaded for Dimension "
                                               + dimension);
                        } else {
                            /*
                             * LittleWorldServer worldServer =
                             * (LittleWorldServer) DimensionManager
                             * .getWorld(LBCore
                             * .littleWorldServer.get(dimension)); if
                             * (worldServer != null) { worldServer.littleTick();
                             * worldServer.updateLittleEntities(); }
                             */
                        }
                    }
                }
            }
        }
    }

}
import java.io.File;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.common.ForgeModContainer;
import net.minecraftforge.common.MinecraftForge;
import net.slimevoid.library.core.SlimevoidCore;
import net.slimevoid.littleblocks.api.ILBCommonProxy;
import net.slimevoid.littleblocks.api.ILittleWorld;
import net.slimevoid.littleblocks.blocks.events.LittleContainerInteract;
import net.slimevoid.littleblocks.core.lib.ConfigurationLib;
import net.slimevoid.littleblocks.core.lib.CoreLib;
import net.slimevoid.littleblocks.core.lib.PacketLib;
import net.slimevoid.littleblocks.events.LittleBlocksCollectionPickup;
import net.slimevoid.littleblocks.events.LittleChunkEvent;
import net.slimevoid.littleblocks.events.WorldServerEvent;
import net.slimevoid.littleblocks.tickhandlers.LittleWorldServerTickHandler;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
package net.slimevoid.littleblocks.proxy;



public class CommonProxy implements ILBCommonProxy {

    @Override
    public void preInit() {
        ForgeModContainer.fullBoundingBoxLadders = true;
    }

    @Override
    public void init() {
        PacketLib.registerPacketHandlers();
    }

    @Override
    public void postInit() {

    }

    @Override
    public void registerRenderInformation() {
    }

    @Override
    public void registerTileEntitySpecialRenderer(Class<? extends TileEntity> clazz) {
    }

    @Override
    public String getMinecraftDir() {
        return "./";
    }

    @Override
    public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
        return null;
    }

    @Override
    public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
        return null;
    }

    @Override
    public void registerTickHandlers() {
        MinecraftForge.EVENT_BUS.register(new LittleWorldServerTickHandler());
    }

    @Override
    public void registerEventHandlers() {
        MinecraftForge.EVENT_BUS.register(new LittleChunkEvent());
        MinecraftForge.EVENT_BUS.register(new WorldServerEvent());
        MinecraftForge.EVENT_BUS.register(new LittleBlocksCollectionPickup());