Package com.khorn.terraincontrol.forge

Examples of com.khorn.terraincontrol.forge.ForgeWorld


                    // If the packet wasn't empty, add the new biomes
                    WorldClient worldMC = FMLClientHandler.instance().getClient().theWorld;

                    DataInputStream wrappedStream = new DataInputStream(new ByteBufInputStream(stream));
                    String worldName = ConfigFile.readStringFromStream(wrappedStream);
                    ForgeWorld worldTC = new ForgeWorld(worldName);
                    WorldSettings config = new WorldSettings(wrappedStream, worldTC);
                    wrappedStream.close();

                    worldTC.InitM(worldMC, config);
                    TerrainControl.log(LogMarker.INFO, Arrays.toString(stream.array()));
                }

                TerrainControl.log(LogMarker.INFO, "Config received from server");
            } else
View Full Code Here


    private Map<String, Boolean> hasDecorationBegun = new HashMap<String, Boolean>();

    @Override
    public boolean onResourceProcess(Resource resource, LocalWorld localWorld, Random random, boolean villageInChunk, int chunkX, int chunkZ, boolean isCancelled)
    {
        ForgeWorld world = (ForgeWorld) localWorld;
        int blockX = chunkX * CHUNK_X_SIZE;
        int blockZ = chunkZ * CHUNK_Z_SIZE;

        // Convert to Forge event and fire
        if (resource instanceof DungeonGen ||
                resource instanceof SmallLakeGen ||
                resource instanceof UndergroundLakeGen ||
                resource instanceof LiquidGen ||
                resource instanceof CustomObjectGen)
        {
            // Fire population event
            Populate.EventType forgeEvent = getPopulateEventType(resource.getMaterial());
            return TerrainGen.populate(world.getChunkGenerator(), world.getWorld(), random, blockX, blockZ,
                    villageInChunk, forgeEvent);
        } else if (resource instanceof OreGen || resource instanceof VeinGen)
        {
            if (!hasOreGenerationBegun(world))
            {
                // Fire ore generation start event
                MinecraftForge.ORE_GEN_BUS
                        .post(new OreGenEvent.Pre(world.getWorld(), random, blockX, blockZ));
                setOreGenerationBegun(world, true);
            }
            // Fire ore generation event
            GenerateMinable.EventType forgeEvent = getOreEventType(resource.getMaterial());
            return TerrainGen.generateOre(world.getWorld(), random, null, blockX, blockZ, forgeEvent);
        } else
        {
            if (!hasDecorationBegun(world))
            {
                // Fire decoration start event
                MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Pre(world.getWorld(), random, blockX, chunkZ
                        * CHUNK_Z_SIZE));
                setDecorationBegun(world, true);
            }
            // Fire decoration event
            Decorate.EventType forgeEvent = getDecorateEventType(resource.getMaterial());
            return TerrainGen.decorate(world.getWorld(), random, blockX, blockZ, forgeEvent);
        }
    }
View Full Code Here

    }

    @Override
    public void onPopulateStart(LocalWorld localWorld, Random random, boolean villageInChunk, int chunkX, int chunkZ)
    {
        ForgeWorld world = (ForgeWorld) localWorld;

        // Reset states
        setDecorationBegun(world, false);
        setOreGenerationBegun(world, false);

        // Fire event
        PopulateChunkEvent forgeEvent = new PopulateChunkEvent.Pre(world.getChunkGenerator(), world.getWorld(), random, chunkX
                * CHUNK_X_SIZE, chunkZ * CHUNK_Z_SIZE, villageInChunk);
        MinecraftForge.EVENT_BUS.post(forgeEvent);
    }
View Full Code Here

    }

    @Override
    public void onPopulateEnd(LocalWorld localWorld, Random random, boolean villageInChunk, int chunkX, int chunkZ)
    {
        ForgeWorld world = (ForgeWorld) localWorld;
        int blockX = chunkX * CHUNK_X_SIZE;
        int blockZ = chunkZ * CHUNK_Z_SIZE;

        // Fire all events

        // Decoration close
        if (hasDecorationBegun(world))
        {
            MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Post(world.getWorld(), random, blockX, blockZ));
            setDecorationBegun(world, false);
        }

        // Ore generation close
        if (hasOreGenerationBegun(world))
        {
            MinecraftForge.ORE_GEN_BUS.post(new OreGenEvent.Post(world.getWorld(), random, blockX, blockZ));
            setOreGenerationBegun(world, false);
        }

        // Population close
        final PopulateChunkEvent forgeEvent = new PopulateChunkEvent.Post(world.getChunkGenerator(), world.getWorld(), random, blockX,
                blockZ, villageInChunk);
        MinecraftForge.EVENT_BUS.post(forgeEvent);

        // There is no need to call GameRegistry.generateWorld, because it is done by the Chunk Provider in Forge.
    }
View Full Code Here

TOP

Related Classes of com.khorn.terraincontrol.forge.ForgeWorld

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.