类net.minecraft.world.WorldType源码实例Demo

下面列出了怎么用net.minecraft.world.WorldType的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: GregTech   文件: SurfaceRockPopulator.java
@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);
        }
    }
}
 
源代码2 项目: GregTech   文件: SurfaceBlockPopulator.java
@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);
        }
    }
}
 
源代码3 项目: GregTech   文件: WorldGenAbandonedBase.java
@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));
    }
}
 
源代码4 项目: AdvancedRocketry   文件: ChunkManagerPlanet.java
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);
	}
 
源代码5 项目: TofuCraftReload   文件: GenLayerTofu.java
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;
}
 
源代码6 项目: TofuCraftReload   文件: BiomeProviderTofu.java
public BiomeProviderTofu(long seed, WorldType worldType)
{
    this();
    GenLayer agenlayer[] = GenLayerTofu.initializeAllBiomeGeneratorsTofu(seed, worldType);
    this.genBiomes = agenlayer[0];
    this.biomeIndexLayer = agenlayer[1];
}
 
源代码7 项目: GregTech   文件: WorldGenRubberTree.java
@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);
        }
    }
}
 
源代码8 项目: litematica   文件: MaterialCache.java
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));
}
 
@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());
}
 
源代码10 项目: malmo   文件: FlatWorldGeneratorImplementation.java
@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());
}
 
源代码11 项目: malmo   文件: BiomeGeneratorImplementation.java
@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());
}
 
源代码12 项目: qcraft-mod   文件: QuantumOreGenerator.java
@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 );
    }
}
 
源代码13 项目: YUNoMakeGoodMap   文件: ChunkGeneratorFlatVoid.java
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.
}
 
源代码14 项目: TofuCraftReload   文件: GenLayerTofu.java
/**
 * 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};
}
 
源代码15 项目: TofuCraftReload   文件: GenLayerBiome.java
public GenLayerBiome(long par1, GenLayerTofu par3GenLayer, WorldType par4WorldType)
{
    super(par1);
    this.allowedBiomes = TofuBiomes.decorationBiomes;
    this.parent = par3GenLayer;
}
 
源代码16 项目: TofuCraftReload   文件: BiomeProviderTofu.java
@Override
public GenLayer[] getModdedBiomeGenerators(WorldType worldType, long seed, GenLayer[] original)
{
    return original;
}
 
源代码17 项目: CommunityMod   文件: ShipStorage.java
@Override
public WorldType getWorldType() {
	return WorldType.DEFAULT;
}
 
源代码18 项目: GregTech   文件: FacadeBlockAccess.java
@Override
public WorldType getWorldType() {
    return world.getWorldType();
}
 
源代码19 项目: ClientBase   文件: WrapperWorldType.java
public WrapperWorldType(WorldType var1) {
    this.real = var1;
}
 
源代码20 项目: ClientBase   文件: WrapperWorldType.java
public static WrapperWorldType parseWorldType(String var0) {
    return new WrapperWorldType(WorldType.parseWorldType(var0));
}
 
源代码21 项目: ClientBase   文件: WrapperWorldType.java
public WorldType unwrap() {
    return this.real;
}
 
源代码22 项目: ClientBase   文件: WrapperWorldType.java
public WorldType[] getWorldTypes() {
    return WorldType.worldTypes;
}
 
源代码23 项目: ClientBase   文件: WrapperWorldType.java
public WrapperWorldType getDEFAULT() {
    return new WrapperWorldType(WorldType.DEFAULT);
}
 
源代码24 项目: ClientBase   文件: WrapperWorldType.java
public WrapperWorldType getFLAT() {
    return new WrapperWorldType(WorldType.FLAT);
}
 
源代码25 项目: ClientBase   文件: WrapperWorldType.java
public WrapperWorldType getLARGE_BIOMES() {
    return new WrapperWorldType(WorldType.LARGE_BIOMES);
}
 
源代码26 项目: ClientBase   文件: WrapperWorldType.java
public WrapperWorldType getAMPLIFIED() {
    return new WrapperWorldType(WorldType.AMPLIFIED);
}
 
源代码27 项目: ClientBase   文件: WrapperWorldType.java
public WrapperWorldType getCUSTOMIZED() {
    return new WrapperWorldType(WorldType.CUSTOMIZED);
}
 
源代码28 项目: ClientBase   文件: WrapperWorldType.java
public WrapperWorldType getDEBUG_WORLD() {
    return new WrapperWorldType(WorldType.DEBUG_WORLD);
}
 
源代码29 项目: ClientBase   文件: WrapperWorldType.java
public WrapperWorldType getDEFAULT_1_1() {
    return new WrapperWorldType(WorldType.DEFAULT_1_1);
}
 
源代码30 项目: Hyperium   文件: HyperiumWorld.java
public double getHorizon(WorldInfo worldInfo) {
    return Settings.VOID_FLICKER_FIX ? 0.0 : worldInfo.getTerrainType() == WorldType.FLAT ? 0.0D : 63.0D;
}
 
 类所在包
 类方法
 同包方法