Search in sources :

Example 1 with RadarMap

use of com.builtbroken.mc.lib.world.radar.RadarMap in project Engine by VoltzEngine-Project.

the class TileMapRegistry method getRadarMapForDim.

/**
     * Gets a radar map for a dimension
     *
     * @param dimID - unique dim id
     * @return existing mpa, or new map if one does not exist
     */
public static RadarMap getRadarMapForDim(int dimID) {
    if (!WORLD_TO_MAP.containsKey(dimID)) {
        RadarMap map = new RadarMap(dimID);
        WORLD_TO_MAP.put(dimID, map);
        return map;
    }
    return WORLD_TO_MAP.get(dimID);
}
Also used : RadarMap(com.builtbroken.mc.lib.world.radar.RadarMap)

Example 2 with RadarMap

use of com.builtbroken.mc.lib.world.radar.RadarMap in project Engine by VoltzEngine-Project.

the class CommandDebugMap method handleEntityPlayerCommand.

@Override
public boolean handleEntityPlayerCommand(EntityPlayer player, String[] args) {
    if (args != null && args.length > 0 && !"help".equalsIgnoreCase(args[0])) {
        if (args[0].equalsIgnoreCase("radar")) {
        } else if (args[0].equalsIgnoreCase("tile") && args.length > 1) {
            if (args[1].equalsIgnoreCase("enableDebug")) {
                if (args.length > 2) {
                    RadarMap map = TileMapRegistry.getRadarMapForWorld(player.worldObj);
                    if (args[2].equalsIgnoreCase("true") || args[2].equalsIgnoreCase("t")) {
                        map.setDebugEnabled(true);
                        player.addChatComponentMessage(new ChatComponentText("Debug enabled for tile map in your world."));
                    } else if (args[2].equalsIgnoreCase("false") || args[2].equalsIgnoreCase("f")) {
                        map.setDebugEnabled(false);
                        player.addChatComponentMessage(new ChatComponentText("Debug disabled for tile map in your world."));
                    } else {
                        player.addChatComponentMessage(new ChatComponentText("Could not parse [" + args[2] + "], enable status can only be true or false"));
                    }
                    return true;
                } else {
                    RadarMap map = TileMapRegistry.getRadarMapForWorld(player.worldObj);
                    if (!map.debugRadarMap) {
                        map.setDebugEnabled(true);
                        player.addChatComponentMessage(new ChatComponentText("Debug enabled for tile map in your world."));
                    } else {
                        map.setDebugEnabled(false);
                        player.addChatComponentMessage(new ChatComponentText("Debug disabled for tile map in your world."));
                    }
                    return true;
                }
            } else if (args[1].equalsIgnoreCase("objects")) {
                RadarMap map = TileMapRegistry.getRadarMapForWorld(player.worldObj);
                if (map.allEntities.size() > 0) {
                    player.addChatComponentMessage(new ChatComponentText("There are " + map.allEntities.size() + " tiles in the map."));
                } else {
                    player.addChatComponentMessage(new ChatComponentText("No tiles detected in global tile list."));
                }
                return true;
            } else if (args[1].equalsIgnoreCase("chunks")) {
                RadarMap map = TileMapRegistry.getRadarMapForWorld(player.worldObj);
                if (map.chunk_to_entities.size() > 0) {
                    player.addChatComponentMessage(new ChatComponentText("There are " + map.chunk_to_entities.size() + " chunk locations in the map."));
                } else {
                    player.addChatComponentMessage(new ChatComponentText("No chunks detected in map."));
                }
                return true;
            } else if (args[1].equalsIgnoreCase("around")) {
                int range = 100;
                if (args.length > 2) {
                    try {
                        range = Integer.parseInt(args[2]);
                    } catch (NumberFormatException e) {
                        player.addChatComponentMessage(new ChatComponentText("Invalid range number"));
                        return true;
                    }
                }
                RadarMap map = TileMapRegistry.getRadarMapForWorld(player.worldObj);
                List<RadarObject> list = map.getRadarObjects(player.posX, player.posZ, range);
                if (list.size() > 0) {
                    player.addChatComponentMessage(new ChatComponentText("There are " + list.size() + " tiles within " + range + " meters"));
                } else {
                    player.addChatComponentMessage(new ChatComponentText("No tiles detected in within " + range + " meters"));
                }
                return true;
            }
            return handleHelp(player, args);
        } else if (args[0].equalsIgnoreCase("heat")) {
        }
    }
    return handleHelp(player, args);
}
Also used : RadarMap(com.builtbroken.mc.lib.world.radar.RadarMap) RadarObject(com.builtbroken.mc.lib.world.radar.data.RadarObject) ChatComponentText(net.minecraft.util.ChatComponentText)

Aggregations

RadarMap (com.builtbroken.mc.lib.world.radar.RadarMap)2 RadarObject (com.builtbroken.mc.lib.world.radar.data.RadarObject)1 ChatComponentText (net.minecraft.util.ChatComponentText)1