net.minecraft.world.WorldType Java Examples

The following examples show how to use net.minecraft.world.WorldType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ChunkManagerPlanet.java    From AdvancedRocketry with MIT License 6 votes vote down vote up
public ChunkManagerPlanet(long seed, WorldType default1, String str, DimensionProperties properties) {

		this.biomeCache = new BiomeCache(this);//new BiomeCacheExtended(this);
		//TODO: more biomes
		//TODO: remove rivers
		GenLayer[] agenlayer = initializeAllBiomeGenerators(seed, default1, str, properties);//GenLayer.initializeAllBiomeGenerators(seed, default1); //;
		agenlayer = getModdedBiomeGenerators(default1, seed, agenlayer);
		this.genBiomes = agenlayer[0];
		this.biomeIndexLayer = agenlayer[1];

		ReflectionHelper.setPrivateValue(BiomeProvider.class, this, this.genBiomes, "genBiomes", "field_76944_d");
		ReflectionHelper.setPrivateValue(BiomeProvider.class, this, this.biomeIndexLayer, "biomeIndexLayer", "field_76945_e");
		
		fBiomeCache = ReflectionHelper.findField(BiomeCache.class, "cache", "field_76841_d");
		fBiomeCache.setAccessible(true);

		fBiomeCacheMap = ReflectionHelper.findField(BiomeCache.class, "cacheMap", "field_76843_c");
		fBiomeCacheMap.setAccessible(true);
	}
 
Example #2
Source File: SurfaceRockPopulator.java    From GregTech with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void populateChunk(World world, int chunkX, int chunkZ, Random random, OreDepositDefinition definition, GridEntryInfo gridEntryInfo) {
    int stonesCount = random.nextInt(2);
    if (world.getWorldType() != WorldType.FLAT && stonesCount > 0) {
        Set<Material> undergroundMaterials = findUndergroundMaterials(gridEntryInfo.getGeneratedBlocks(definition, chunkX, chunkZ));
        if (undergroundMaterials.isEmpty())
            return;

        for (int i = 0; i < stonesCount; i++) {
            int randomX = chunkX * 16 + random.nextInt(16);
            int randomZ = chunkZ * 16 + random.nextInt(16);
            BlockPos topBlockPos = new BlockPos(randomX, 0, randomZ);
            topBlockPos = world.getTopSolidOrLiquidBlock(topBlockPos).down();
            IBlockState blockState = world.getBlockState(topBlockPos);
            if (blockState.getBlockFaceShape(world, topBlockPos, EnumFacing.UP) != BlockFaceShape.SOLID ||
                !blockState.isOpaqueCube() || !blockState.isFullBlock())
                continue;
            BlockPos surfaceRockPos = topBlockPos.up();
            setStoneBlock(world, surfaceRockPos, undergroundMaterials);
        }
    }
}
 
Example #3
Source File: SurfaceBlockPopulator.java    From GregTech with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void populateChunk(World world, int chunkX, int chunkZ, Random random, OreDepositDefinition definition, GridEntryInfo gridEntryInfo) {
    if (world.getWorldType() != WorldType.FLAT) {
        int stonesCount = minIndicatorAmount + (minIndicatorAmount >= maxIndicatorAmount ? 0 : random.nextInt(maxIndicatorAmount - minIndicatorAmount));
        for (int i = 0; i < stonesCount; i++) {
            int randomX = chunkX * 16 + random.nextInt(16);
            int randomZ = chunkZ * 16 + random.nextInt(16);
            BlockPos topBlockPos = new BlockPos(randomX, 0, randomZ);
            topBlockPos = world.getTopSolidOrLiquidBlock(topBlockPos).down();
            IBlockState blockState = world.getBlockState(topBlockPos);
            if (blockState.getBlockFaceShape(world, topBlockPos, EnumFacing.UP) != BlockFaceShape.SOLID ||
                !blockState.isOpaqueCube() || !blockState.isFullBlock())
                continue;
            BlockPos surfaceRockPos = topBlockPos.up();
            world.setBlockState(surfaceRockPos, this.blockState, 16);
        }
    }
}
 
Example #4
Source File: WorldGenAbandonedBase.java    From GregTech with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
    if (ConfigHolder.abandonedBaseRarity == 0 ||
        world.getWorldType() == WorldType.FLAT ||
        world.provider.getDimensionType() != DimensionType.OVERWORLD ||
        !world.getWorldInfo().isMapFeaturesEnabled()) {
        return; //do not generate in flat worlds, or in non-surface worlds
    }
    BlockPos randomPos = new BlockPos(chunkX * 16 + 8, 0, chunkZ * 16 + 8);

    if (random.nextInt(ConfigHolder.abandonedBaseRarity) == 0) {
        int variantNumber = random.nextInt(3);
        Rotation rotation = Rotation.values()[random.nextInt(Rotation.values().length)];
        ResourceLocation templateId = new ResourceLocation(GTValues.MODID, "abandoned_base/abandoned_base_1_" + variantNumber);
        Template template = TemplateManager.getBuiltinTemplate(world, templateId);
        BlockPos originPos = template.getZeroPositionWithTransform(randomPos, Mirror.NONE, rotation);
        originPos = TemplateManager.calculateAverageGroundLevel(world, originPos, template.getSize());
        template.addBlocksToWorld(world, originPos, new PlacementSettings().setRotation(rotation));
    }
}
 
Example #5
Source File: GenLayerTofu.java    From TofuCraftReload with MIT License 5 votes vote down vote up
public static GenLayerTofu getBiomeLayer(long worldSeed, GenLayerTofu parentLayer, WorldType worldType)
{
    GenLayerTofu ret = new GenLayerBiome(200L, parentLayer, worldType);
    ret = GenLayerZoom.magnify(1000L, ret, 2);
    ret = new GenLayerBiomeEdge(1000L, ret);
    return ret;
}
 
Example #6
Source File: MaterialCache.java    From litematica with GNU Lesser General Public License v3.0 5 votes vote down vote up
private MaterialCache()
{
    WorldSettings settings = new WorldSettings(0L, GameType.CREATIVE, false, false, WorldType.FLAT);

    this.tempWorld = new WorldSchematic(null, settings, -1, EnumDifficulty.PEACEFUL, Minecraft.getMinecraft().profiler);
    this.checkPos = new BlockPos(8, 0, 8);

    WorldUtils.loadChunksClientWorld(this.tempWorld, this.checkPos, new Vec3i(1, 1, 1));
}
 
Example #7
Source File: DefaultWorldGeneratorImplementation.java    From malmo with MIT License 5 votes vote down vote up
@Override
public boolean createWorld(MissionInit missionInit)
{
    long seed = getWorldSeedFromString(this.dwparams.getSeed());
    WorldType.WORLD_TYPES[0].onGUICreateWorldPress();
    WorldSettings worldsettings = new WorldSettings(seed, GameType.SURVIVAL, true, false, WorldType.WORLD_TYPES[0]);
    worldsettings.enableCommands();
    // Create a filename for this map - we use the time stamp to make sure it is different from other worlds, otherwise no new world
    // will be created, it will simply load the old one.
    return MapFileHelper.createAndLaunchWorld(worldsettings, this.dwparams.isDestroyAfterUse());
}
 
Example #8
Source File: FlatWorldGeneratorImplementation.java    From malmo with MIT License 5 votes vote down vote up
@Override
public boolean createWorld(MissionInit missionInit)
{
    long seed = DefaultWorldGeneratorImplementation.getWorldSeedFromString(this.fwparams.getSeed());
    WorldSettings worldsettings = new WorldSettings(seed, GameType.SURVIVAL, false, false, WorldType.FLAT);
    // This call to setWorldName allows us to specify the layers of our world, and also the features that will be created.
    // This website provides a handy way to generate these strings: http://chunkbase.com/apps/superflat-generator
    worldsettings.setGeneratorOptions(this.fwparams.getGeneratorString());
    worldsettings.enableCommands(); // Enables cheat commands.
    // Create a filename for this map - we use the time stamp to make sure it is different from other worlds, otherwise no new world
    // will be created, it will simply load the old one.
    return MapFileHelper.createAndLaunchWorld(worldsettings, this.fwparams.isDestroyAfterUse());
}
 
Example #9
Source File: BiomeGeneratorImplementation.java    From malmo with MIT License 5 votes vote down vote up
@Override
public boolean createWorld(MissionInit missionInit) {
	long seed = getWorldSeedFromString();
	WorldType.WORLD_TYPES[0].onGUICreateWorldPress();
	WorldSettings worldsettings = new WorldSettings(seed, GameType.SURVIVAL, true, false, WorldType.WORLD_TYPES[0]);
	worldsettings.enableCommands();
	// Create a filename for this map - we use the time stamp to make sure
	// it is different from other worlds, otherwise no new world
	// will be created, it will simply load the old one.
	return MapFileHelper.createAndLaunchWorld(worldsettings, this.bparams.isDestroyAfterUse());
}
 
Example #10
Source File: QuantumOreGenerator.java    From qcraft-mod with Apache License 2.0 5 votes vote down vote up
@Override
public void generate( Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider )
{
    if( !world.provider.isHellWorld && world.provider.terrainType != WorldType.FLAT )
    {
        generateSurface( world, random, chunkX * 16, chunkZ * 16 );
    }
}
 
Example #11
Source File: WorldGenRubberTree.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
    if (world.getWorldType() == WorldType.FLAT ||
        !world.provider.isSurfaceWorld()) {
        return; //do not generate in flat worlds, or in non-surface worlds
    }
    BlockPos randomPos = new BlockPos(chunkX * 16 + 8, 0, chunkZ * 16 + 8);
    Biome biome = world.getBiome(randomPos);

    if (BiomeDictionary.hasType(biome, Type.COLD) ||
        BiomeDictionary.hasType(biome, Type.HOT) ||
        BiomeDictionary.hasType(biome, Type.DRY) ||
        BiomeDictionary.hasType(biome, Type.DEAD) ||
        BiomeDictionary.hasType(biome, Type.SPOOKY))
        return; //do not generate in inappropriate biomes

    int rubberTreeChance = 6;
    if (BiomeDictionary.hasType(biome, Type.SWAMP) ||
        BiomeDictionary.hasType(biome, Type.WET))
        rubberTreeChance /= 2; //double chance of spawning in swamp or wet biomes

    if (random.nextInt(rubberTreeChance) == 0) {
        randomPos = world.getTopSolidOrLiquidBlock(randomPos).down();
        IBlockState solidBlockState = world.getBlockState(randomPos);
        BlockGregSapling sapling = MetaBlocks.SAPLING;
        if (solidBlockState.getBlock().canSustainPlant(solidBlockState, world, randomPos, EnumFacing.UP, sapling)) {
            BlockPos abovePos = randomPos.up();
            IBlockState saplingState = sapling.getDefaultState()
                .withProperty(BlockGregSapling.VARIANT, LogVariant.RUBBER_WOOD);
            world.setBlockState(abovePos, saplingState);
            sapling.generateTree(world, abovePos, saplingState, random);
        }
    }
}
 
Example #12
Source File: ChunkGeneratorFlatVoid.java    From YUNoMakeGoodMap with Apache License 2.0 5 votes vote down vote up
public ChunkGeneratorFlatVoid(World world)
{
    super(world, world.getSeed(), false, null);
    this.world = world;
    if (this.world.getWorldType() != WorldType.FLAT)
        this.world.setSeaLevel(63); //Fixup sea level as they now calculate it in flat worlds.
}
 
Example #13
Source File: BiomeProviderTofu.java    From TofuCraftReload with MIT License 5 votes vote down vote up
public BiomeProviderTofu(long seed, WorldType worldType)
{
    this();
    GenLayer agenlayer[] = GenLayerTofu.initializeAllBiomeGeneratorsTofu(seed, worldType);
    this.genBiomes = agenlayer[0];
    this.biomeIndexLayer = agenlayer[1];
}
 
Example #14
Source File: StorageChunk.java    From AdvancedRocketry with MIT License 4 votes vote down vote up
@Override
public WorldType getWorldType() {
	return WorldType.CUSTOMIZED;
}
 
Example #15
Source File: ChunkManagerPlanet.java    From AdvancedRocketry with MIT License 4 votes vote down vote up
public static int getModdedBiomeSize(WorldType worldType, int original)
{
	net.minecraftforge.event.terraingen.WorldTypeEvent.BiomeSize event = new net.minecraftforge.event.terraingen.WorldTypeEvent.BiomeSize(worldType, original);
	net.minecraftforge.common.MinecraftForge.TERRAIN_GEN_BUS.post(event);
	return event.getNewSize();
}
 
Example #16
Source File: FakeWorldClient.java    From Framez with GNU General Public License v3.0 4 votes vote down vote up
private FakeWorldClient() {

        super(new NetHandlerPlayClient(Minecraft.getMinecraft(), null, new NetworkManager(true)), new WorldSettings(0, GameType.NOT_SET,
                false, false, WorldType.DEFAULT), 0, EnumDifficulty.PEACEFUL, Minecraft.getMinecraft().theWorld.theProfiler);
    }
 
Example #17
Source File: ProxyWorld.java    From LookingGlass with GNU General Public License v3.0 4 votes vote down vote up
public ProxyWorld(int dimensionID) {
	super(Minecraft.getMinecraft().getNetHandler(), new WorldSettings(0L, GameType.SURVIVAL, true, false, WorldType.DEFAULT), dimensionID, Minecraft.getMinecraft().gameSettings.difficulty, Minecraft.getMinecraft().theWorld.theProfiler);
}
 
Example #18
Source File: GuiEntityRender.java    From WearableBackpacks with MIT License 4 votes vote down vote up
public DummyWorld()
{ this(new WorldSettings(0, GameType.SURVIVAL, false, false, WorldType.DEFAULT)); }
 
Example #19
Source File: GenLayerTofu.java    From TofuCraftReload with MIT License 4 votes vote down vote up
/**
 * the first array item is a linked list of the bioms, the second is the zoom function, the third is the same as the
 * first.
 */
public static GenLayer[] initializeAllBiomeGeneratorsTofu(long seed, WorldType worldType)
{
    byte biomeSize = getModdedBiomeSize(worldType, (byte) (worldType == WorldType.LARGE_BIOMES ? 7 : 5));


    GenLayerIsland genlayerisland = new GenLayerIsland(1L);
    GenLayerFuzzyZoom genlayerfuzzyzoom = new GenLayerFuzzyZoom(2000L, genlayerisland);
    GenLayerAddIsland genlayeraddisland = new GenLayerAddIsland(1L, genlayerfuzzyzoom);
    GenLayerZoom genlayerzoom = new GenLayerZoom(2001L, genlayeraddisland);
    genlayeraddisland = new GenLayerAddIsland(2L, genlayerzoom);
    genlayeraddisland = new GenLayerAddIsland(50L, genlayeraddisland);
    genlayeraddisland = new GenLayerAddIsland(70L, genlayeraddisland);
    genlayeraddisland = new GenLayerAddIsland(3L, genlayeraddisland);
    genlayeraddisland = new GenLayerAddIsland(2L, genlayeraddisland);
    GenLayerEdge genlayeredge = new GenLayerEdge(2L, genlayeraddisland, GenLayerEdge.Mode.COOL_WARM);
    genlayeredge = new GenLayerEdge(2L, genlayeredge, GenLayerEdge.Mode.HEAT_ICE);
    genlayeredge = new GenLayerEdge(3L, genlayeredge, GenLayerEdge.Mode.SPECIAL);
    genlayerzoom = new GenLayerZoom(2002L, genlayeredge);
    genlayerzoom = new GenLayerZoom(2003L, genlayerzoom);
    genlayeraddisland = new GenLayerAddIsland(4L, genlayerzoom);

    GenLayerTofu genlayer3 = GenLayerZoom.magnify(1000L, genlayeraddisland, 0);
    GenLayerTofu genlayer = GenLayerZoom.magnify(1000L, genlayer3, 0);
    GenLayerRiverInit genlayerriverinit = new GenLayerRiverInit(100L, genlayer);
    Object object = GenLayerTofu.getBiomeLayer(seed, genlayer3, worldType);

    GenLayerTofu genlayer1 = GenLayerZoom.magnify(1000L, genlayerriverinit, 2);
    GenLayerHills genlayerhills = new GenLayerHills(1000L, (GenLayerTofu)object, genlayer1);
    genlayer = GenLayerZoom.magnify(1000L, genlayerriverinit, 2);
    genlayer = GenLayerZoom.magnify(1000L, genlayer, biomeSize);
    GenLayerRiver genlayerriver = new GenLayerRiver(1L, genlayer);
    GenLayerSmooth genlayersmooth = new GenLayerSmooth(1000L, genlayerriver);
    object = GenLayerZoom.magnify(1000L, genlayerhills, 2);

    for (int j = 0; j < biomeSize; ++j)
    {
        object = new GenLayerZoom((long)(1000 + j), (GenLayerTofu)object);

        if (j == 0)
        {
            object = new GenLayerAddIsland(3L, (GenLayerTofu)object);
        }
        if (j == 1)
        {
            object = new GenLayerShore(1000L, (GenLayerTofu)object);
        }
    }

    GenLayerSmooth genlayersmooth1 = new GenLayerSmooth(1000L, (GenLayerTofu)object);
    GenLayerRiverMix genlayerrivermix = new GenLayerRiverMix(100L, genlayersmooth1, genlayersmooth);


    GenLayerTofu layerVoronoi = new GenLayerTofuVoronoiZoom(10L, genlayerrivermix);

    genlayerrivermix.initWorldGenSeed(seed);

    layerVoronoi.initWorldGenSeed(seed);

    return new GenLayer[] {genlayerrivermix, layerVoronoi};
}
 
Example #20
Source File: WizardryStructure.java    From Wizardry with GNU Lesser General Public License v3.0 4 votes vote down vote up
@NotNull
@Override
public WorldType getWorldType() {
	return originalAccess.getWorldType();
}
 
Example #21
Source File: ChunkCacheSchematic.java    From litematica with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public WorldType getWorldType()
{
    return this.world.getWorldType();
}
 
Example #22
Source File: FakeBlockAccess.java    From OpenModsLib with MIT License 4 votes vote down vote up
@Override
public WorldType getWorldType() {
	return WorldType.DEFAULT;
}
 
Example #23
Source File: CraftServer.java    From Kettle with GNU General Public License v3.0 4 votes vote down vote up
@Override
public World createWorld(WorldCreator creator) {
    Validate.notNull(creator, "Creator may not be null");

    String name = creator.name();
    ChunkGenerator generator = creator.generator();
    File folder = new File(getWorldContainer(), name);
    World world = getWorld(name);
    WorldType type = WorldType.parseWorldType(creator.type().getName());
    boolean generateStructures = creator.generateStructures();

    if ((folder.exists()) && (!folder.isDirectory())) {
        throw new IllegalArgumentException("File exists with the name '" + name + "' and isn't a folder");
    }

    if (world != null) {
        return world;
    }

    boolean hardcore = false;

    WorldSettings worldSettings = new WorldSettings(creator.seed(), WorldSettings.getGameTypeById(getDefaultGameMode().getValue()), generateStructures, hardcore, type);
    WorldServer internal = DimensionManager.initDimension(creator, worldSettings);

    pluginManager.callEvent(new WorldInitEvent(internal.getWorld()));
    System.out.println("Preparing start region for level " + (console.worldServerList.size() - 1) + " (Seed: " + internal.getSeed() + ")");

    if (internal.getWorld().getKeepSpawnInMemory()) {
        short short1 = 196;
        long i = System.currentTimeMillis();
        for (int j = -short1; j <= short1; j += 16) {
            for (int k = -short1; k <= short1; k += 16) {
                long l = System.currentTimeMillis();

                if (l < i) {
                    i = l;
                }

                if (l > i + 1000L) {
                    int i1 = (short1 * 2 + 1) * (short1 * 2 + 1);
                    int j1 = (j + short1) * (short1 * 2 + 1) + k + 1;

                    System.out.println("Preparing spawn area for " + name + ", " + (j1 * 100 / i1) + "%");
                    i = l;
                }

                BlockPos chunkcoordinates = internal.getSpawnPoint();
                internal.getChunkProvider().loadChunk(chunkcoordinates.getX() + j >> 4, chunkcoordinates.getZ() + k >> 4);
            }
        }
    }
    pluginManager.callEvent(new WorldLoadEvent(internal.getWorld()));
    return internal.getWorld();
}
 
Example #24
Source File: WrapperWorldType.java    From ClientBase with MIT License 4 votes vote down vote up
public WrapperWorldType getDEFAULT_1_1() {
    return new WrapperWorldType(WorldType.DEFAULT_1_1);
}
 
Example #25
Source File: GenLayerBiome.java    From TofuCraftReload with MIT License 4 votes vote down vote up
public GenLayerBiome(long par1, GenLayerTofu par3GenLayer, WorldType par4WorldType)
{
    super(par1);
    this.allowedBiomes = TofuBiomes.decorationBiomes;
    this.parent = par3GenLayer;
}
 
Example #26
Source File: BiomeProviderTofu.java    From TofuCraftReload with MIT License 4 votes vote down vote up
@Override
public GenLayer[] getModdedBiomeGenerators(WorldType worldType, long seed, GenLayer[] original)
{
    return original;
}
 
Example #27
Source File: ShipStorage.java    From CommunityMod with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public WorldType getWorldType() {
	return WorldType.DEFAULT;
}
 
Example #28
Source File: FacadeBlockAccess.java    From GregTech with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public WorldType getWorldType() {
    return world.getWorldType();
}
 
Example #29
Source File: WrapperWorldType.java    From ClientBase with MIT License 4 votes vote down vote up
public WrapperWorldType(WorldType var1) {
    this.real = var1;
}
 
Example #30
Source File: WrapperWorldType.java    From ClientBase with MIT License 4 votes vote down vote up
public static WrapperWorldType parseWorldType(String var0) {
    return new WrapperWorldType(WorldType.parseWorldType(var0));
}