Package com.khorn.terraincontrol

Examples of com.khorn.terraincontrol.LocalWorld


        Location location = this.getLocation(sender);
        int x = location.getBlockX();
        int y = location.getBlockY();
        int z = location.getBlockZ();

        LocalWorld world = this.getWorld(sender, "");
       
        if (world == null)
        {
            sender.sendMessage(ERROR_COLOR + "Plugin is not enabled for this world.");
            return true;
        }

        LocalBiome biome = world.getBiome(x, z);
        BiomeIds biomeIds = biome.getIds();

        sender.sendMessage(MESSAGE_COLOR + "According to the biome generator, you are in the " + VALUE_COLOR + biome.getName() + MESSAGE_COLOR + " biome, with id " + VALUE_COLOR
                + biomeIds.getGenerationId());

        if (args.contains("-f"))
        {
            sender.sendMessage(MESSAGE_COLOR + "The base temperature of this biome is " + VALUE_COLOR + biome.getBiomeConfig().biomeTemperature + MESSAGE_COLOR + ", \nat your height it is " + VALUE_COLOR
                    + biome.getTemperatureAt(x, y, z));
        }

        if (args.contains("-s"))
        {
            try
            {
                LocalBiome savedBiome = world.getSavedBiome(x, z);
                BiomeIds savedIds = savedBiome.getIds();
                sender.sendMessage(MESSAGE_COLOR + "According to the world save files, you are in the " + VALUE_COLOR
                        + savedBiome.getName() + MESSAGE_COLOR + " biome, with id " + VALUE_COLOR
                        + savedIds.getSavedId());
            } catch (BiomeNotFoundException e)
View Full Code Here


    public boolean onCommand(CommandSender sender, List<String> args)
    {
        Player me = (Player) sender;
        Random random = new Random();

        LocalWorld bukkitWorld = this.getWorld(me, args.size() > 1 ? args.get(1) : "");

        if (args.isEmpty())
        {
            me.sendMessage(ERROR_COLOR + "You must enter the name of the BO2.");
            return true;
        }
        CustomObject spawnObject = null;

        if (bukkitWorld != null)
            spawnObject = bukkitWorld.getConfigs().getCustomObjects().parseCustomObject(args.get(0));

        if (spawnObject == null)
        {
            sender.sendMessage(ERROR_COLOR + "Object not found, use '/tc list' to list the available ones.");
            return true;
View Full Code Here

                } catch (Exception e)
                {
                    sender.sendMessage(ERROR_COLOR + "Wrong page number " + args.get(2));
                }
            }
            LocalWorld world = this.getWorld(sender, worldName);

            if (world != null)
            {
                if (world.getConfigs().getCustomObjects().isEmpty())
                    sender.sendMessage(MESSAGE_COLOR + "This world does not have custom objects");

                List<String> pluginList = new ArrayList<String>();
                for (CustomObject object : world.getConfigs().getCustomObjects())
                {
                    pluginList.add(VALUE_COLOR + object.getName());
                }

                this.ListMessage(sender, pluginList, page, "World objects");
View Full Code Here

        if (worldName.isEmpty())
        {
            Location location = getLocation(sender);
            if (location != null)
            {
                LocalWorld world = WorldHelper.toLocalWorld(location.getWorld());
                if (world != null)
                {
                    return world;
                }
            }
View Full Code Here

class SaplingListener
{
    void onStructureGrow(StructureGrowEvent event)
    {
        LocalWorld world = WorldHelper.toLocalWorld(event.getWorld());
        if (world == null)
        {
            return;
        }

        Location location = event.getLocation();

        LocalBiome biome;
        try
        {
            biome = world.getSavedBiome(location.getBlockX(), location.getBlockZ());
        } catch (BiomeNotFoundException e)
        {
            return;
        }
View Full Code Here

    }

    @Override
    public int getMinimumSpawnHeight(World mcWorld)
    {
        LocalWorld world = WorldHelper.toLocalWorld(mcWorld);
        if (world == null)
        {
            // MCPC+ has an interesting load order sometimes
            return 64;
        }
        return world.getConfigs().getWorldConfig().waterLevelMax;
    }
View Full Code Here

            return;
        }

        EntityPlayerMP player = (EntityPlayerMP) event.player;
       
        LocalWorld worldTC = WorldHelper.toLocalWorld(player.getEntityWorld());
        if (worldTC == null)
        {
            // World not loaded
            return;
        }
        ConfigProvider configs = worldTC.getConfigs();

        // Serialize it
        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        DataOutputStream stream = new DataOutputStream(outputStream);
        try
View Full Code Here

    }

    @Override
    public LocalWorld getWorld(String name)
    {
        LocalWorld world = worldType.worldTC;
        if (world == null)
        {
            return null;
        }
        if (world.getName().equals(name))
        {
            return world;
        }
        return null;
    }
View Full Code Here

    @SubscribeEvent
    public void onSaplingGrow(SaplingGrowTreeEvent event)
    {
        World world = event.world;
        LocalWorld localWorld = WorldHelper.toLocalWorld(world);

        if (localWorld == null)
        {
            // World not managed by Terrain Control
            return;
        }

        SaplingGrower saplingGrower = new SaplingGrower(localWorld, event.x, event.y, event.z);
       
        if (saplingGrower.saplingType == null)
        {
            // Unsupported sapling
            return;
        }

        // Get the sapling generator
        SaplingGen saplingGen = this.getSaplingGen(localWorld, saplingGrower.saplingType, saplingGrower.x, saplingGrower.z);
        if (saplingGen == null)
        {
            // No sapling generator set for this sapling
            return;
        }

        // When we have reached this point, we know that we have to handle the
        // event ourselves
        // So cancel it
        event.setResult(Result.DENY);

        // Remove saplings
        if (saplingGrower.saplingType.requiresFourSaplings())
        {
            world.setBlock(saplingGrower.x, saplingGrower.y, saplingGrower.z, Blocks.air);
            world.setBlock(saplingGrower.x + 1, saplingGrower.y, saplingGrower.z, Blocks.air);
            world.setBlock(saplingGrower.x, saplingGrower.y, saplingGrower.z + 1, Blocks.air);
            world.setBlock(saplingGrower.x + 1, saplingGrower.y, saplingGrower.z + 1, Blocks.air);
        } else
        {
            world.setBlock(saplingGrower.x, saplingGrower.y, saplingGrower.z, Blocks.air);
        }

        // Try ten times to grow sapling
        boolean saplingGrown = false;
        for (int i = 0; i < 10; i++)
        {
            if (saplingGen.growSapling(localWorld, new Random(), saplingGrower.x, saplingGrower.y, saplingGrower.z))
            {
                saplingGrown = true;
                break;
            }
        }

        if (!saplingGrown)
        {
            // Restore sapling
            if (saplingGrower.saplingType.requiresFourSaplings())
            {
                localWorld.setBlock(saplingGrower.x, saplingGrower.y, saplingGrower.z, saplingGrower.material);
                localWorld.setBlock(saplingGrower.x + 1, saplingGrower.y, saplingGrower.z, saplingGrower.material);
                localWorld.setBlock(saplingGrower.x, saplingGrower.y, saplingGrower.z + 1, saplingGrower.material);
                localWorld.setBlock(saplingGrower.x + 1, saplingGrower.y, saplingGrower.z + 1, saplingGrower.material);
            } else
            {
                localWorld.setBlock(saplingGrower.x, saplingGrower.y, saplingGrower.z, saplingGrower.material);
            }
        }

    }
View Full Code Here

    }

    @SubscribeEvent
    public void onBonemealUse(BonemealEvent event)
    {
        LocalWorld localWorld = WorldHelper.toLocalWorld(event.world);
        if (localWorld == null)
        {
            // World not managed by Terrain Control
            return;
        }
View Full Code Here

TOP

Related Classes of com.khorn.terraincontrol.LocalWorld

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.