Search in sources :

Example 1 with WorldType

use of net.minecraft.world.WorldType in project SpongeCommon by SpongePowered.

the class MixinWorldServer method createWorldGenerator.

@Override
public SpongeWorldGenerator createWorldGenerator(String settings) {
    final WorldServer worldServer = (WorldServer) (Object) this;
    final WorldType worldType = worldServer.getWorldType();
    final IChunkGenerator chunkGenerator;
    final BiomeProvider biomeProvider;
    if (worldType instanceof SpongeWorldType) {
        chunkGenerator = ((SpongeWorldType) worldType).getChunkGenerator(worldServer, settings);
        biomeProvider = ((SpongeWorldType) worldType).getBiomeProvider(worldServer);
    } else {
        final IChunkGenerator currentGenerator = this.getChunkProvider().chunkGenerator;
        if (currentGenerator != null) {
            chunkGenerator = currentGenerator;
        } else {
            final WorldProvider worldProvider = worldServer.provider;
            ((IMixinWorldProvider) worldProvider).setGeneratorSettings(settings);
            chunkGenerator = worldProvider.createChunkGenerator();
        }
        biomeProvider = worldServer.provider.biomeProvider;
    }
    return new SpongeWorldGenerator(worldServer, (BiomeGenerator) biomeProvider, SpongeGenerationPopulator.of(worldServer, chunkGenerator));
}
Also used : BiomeProvider(net.minecraft.world.biome.BiomeProvider) IMixinWorldProvider(org.spongepowered.common.interfaces.world.IMixinWorldProvider) SpongeWorldType(org.spongepowered.common.world.type.SpongeWorldType) WorldType(net.minecraft.world.WorldType) IChunkGenerator(net.minecraft.world.gen.IChunkGenerator) IMixinWorldProvider(org.spongepowered.common.interfaces.world.IMixinWorldProvider) WorldProvider(net.minecraft.world.WorldProvider) WorldServer(net.minecraft.world.WorldServer) IMixinWorldServer(org.spongepowered.common.interfaces.world.IMixinWorldServer) SpongeWorldGenerator(org.spongepowered.common.world.gen.SpongeWorldGenerator) SpongeWorldType(org.spongepowered.common.world.type.SpongeWorldType)

Example 2 with WorldType

use of net.minecraft.world.WorldType in project SpongeCommon by SpongePowered.

the class GeneratorTypeRegistryModule method registerDefaults.

@Override
public void registerDefaults() {
    for (WorldType worldType : WorldType.WORLD_TYPES) {
        this.registerAdditionalCatalog((GeneratorType) worldType);
    }
    this.registerAdditionalCatalog((GeneratorType) new SpongeWorldTypeEnd());
    this.registerAdditionalCatalog((GeneratorType) new SpongeWorldTypeNether());
    this.registerAdditionalCatalog((GeneratorType) new SpongeWorldTypeOverworld());
}
Also used : WorldType(net.minecraft.world.WorldType) SpongeWorldTypeOverworld(org.spongepowered.common.world.type.SpongeWorldTypeOverworld) SpongeWorldTypeNether(org.spongepowered.common.world.type.SpongeWorldTypeNether) SpongeWorldTypeEnd(org.spongepowered.common.world.type.SpongeWorldTypeEnd)

Example 3 with WorldType

use of net.minecraft.world.WorldType in project BiomeTweaker by superckl.

the class ScriptCommandRemoveBOPWorldType method perform.

@Override
public void perform() throws Exception {
    final WorldType type = WorldType.parseWorldType(this.name);
    if (type == null)
        throw new IllegalArgumentException("Unable to find world type with name: " + this.name);
    BOPBiomes.excludedDecoratedWorldTypes.remove(type);
}
Also used : WorldType(net.minecraft.world.WorldType)

Example 4 with WorldType

use of net.minecraft.world.WorldType in project BiomeTweaker by superckl.

the class ScriptCommandAverageBiomeSize method perform.

@Override
public void perform() throws Exception {
    if (this.type == null) {
        BiomeEventHandler.globalSize = this.size;
        return;
    }
    WorldType type = null;
    for (final WorldType worldType : WorldType.WORLD_TYPES) if (worldType.getName().equals(this.type)) {
        type = worldType;
        break;
    }
    if (type == null) {
        LogHelper.warn("Failed to retrieve WorldType for '" + this.type + "'!");
        return;
    }
    BiomeEventHandler.sizes.put(type, this.size);
}
Also used : WorldType(net.minecraft.world.WorldType)

Example 5 with WorldType

use of net.minecraft.world.WorldType in project Engine by VoltzEngine-Project.

the class DevWorldLoader method preInit.

@Override
public void preInit() {
    emptyWorldGenerator = new WorldType("voidTestWorld") {

        @Override
        public IChunkProvider getChunkGenerator(World world, String generatorOptions) {
            return new ChunkProviderEmpty(world);
        }

        @Override
        public boolean getCanBeCreated() {
            return true;
        }
    };
    stoneWorldGenerator = new WorldType("stoneTestWorld") {

        @Override
        public IChunkProvider getChunkGenerator(World world, String generatorOptions) {
            return new ChunkProviderStone(world);
        }

        @Override
        public boolean getCanBeCreated() {
            return true;
        }
    };
    stoneWorldGenerator = new WorldType("chessTestWorld") {

        @Override
        public IChunkProvider getChunkGenerator(World world, String generatorOptions) {
            return new ChunkProviderChess(world);
        }

        @Override
        public boolean getCanBeCreated() {
            return true;
        }
    };
    MinecraftForge.EVENT_BUS.register(this);
}
Also used : WorldType(net.minecraft.world.WorldType) IChunkProvider(net.minecraft.world.chunk.IChunkProvider) ChunkProviderEmpty(com.builtbroken.mc.core.content.world.chunks.ChunkProviderEmpty) ChunkProviderStone(com.builtbroken.mc.core.content.world.chunks.ChunkProviderStone) World(net.minecraft.world.World) ChunkProviderChess(com.builtbroken.mc.core.content.world.chunks.ChunkProviderChess)

Aggregations

WorldType (net.minecraft.world.WorldType)6 ChunkProviderChess (com.builtbroken.mc.core.content.world.chunks.ChunkProviderChess)1 ChunkProviderEmpty (com.builtbroken.mc.core.content.world.chunks.ChunkProviderEmpty)1 ChunkProviderStone (com.builtbroken.mc.core.content.world.chunks.ChunkProviderStone)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 ScrollableButtonList (logictechcorp.libraryex.client.gui.ScrollableButtonList)1 CreateWorldScreen (net.minecraft.client.gui.screen.CreateWorldScreen)1 Screen (net.minecraft.client.gui.screen.Screen)1 Button (net.minecraft.client.gui.widget.button.Button)1 I18n (net.minecraft.client.resources.I18n)1 TranslationTextComponent (net.minecraft.util.text.TranslationTextComponent)1 World (net.minecraft.world.World)1 WorldProvider (net.minecraft.world.WorldProvider)1 WorldServer (net.minecraft.world.WorldServer)1 BiomeProvider (net.minecraft.world.biome.BiomeProvider)1 IChunkProvider (net.minecraft.world.chunk.IChunkProvider)1 IChunkGenerator (net.minecraft.world.gen.IChunkGenerator)1 IMixinWorldProvider (org.spongepowered.common.interfaces.world.IMixinWorldProvider)1 IMixinWorldServer (org.spongepowered.common.interfaces.world.IMixinWorldServer)1