• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java MapGenBase类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中net.minecraft.world.gen.MapGenBase的典型用法代码示例。如果您正苦于以下问题:Java MapGenBase类的具体用法?Java MapGenBase怎么用?Java MapGenBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MapGenBase类属于net.minecraft.world.gen包,在下文中一共展示了MapGenBase类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onEvent

import net.minecraft.world.gen.MapGenBase; //导入依赖的package包/类
@SubscribeEvent
public void onEvent(ChunkProviderEvent.ReplaceBiomeBlocks event){
	int dim = event.world.provider.getDimensionId();
	if(this.replacedMapGensDimensions.contains(dim)){
		//don't touch, we already replaced it
		return;
	}
	this.replacedMapGensDimensions.add(dim);
	IChunkProvider prov = event.chunkProvider;
	if(!(prov instanceof ChunkProviderGenerate)){
		return;
	}
	List<Field> genFields = ReflectionUtil.getFieldsByType(MapGenBase.class, ChunkProviderGenerate.class, false);
	
	for(Field field : genFields){
		MapGenBase value = ReflectionUtil.getValue(field, prov, MapGenBase.class);
		value = WorldGenUtil.tileableMapGen(value);
		ReflectionUtil.setValue(field, prov, value);
	}
}
 
开发者ID:Barteks2x,项目名称:McWorldGenLoop,代码行数:21,代码来源:EventListener.java


示例2: generateTileable

import net.minecraft.world.gen.MapGenBase; //导入依赖的package包/类
public static void generateTileable(MapGenBase base, IChunkProvider chunkProvider, //
		World worldIn, int chunkX, int chunkZ, ChunkPrimer blocks) {
	// radius is the inly int field in MapGenBase
	int radius = ReflectionUtil.getValueByType(int.class, MapGenBase.class, base, false);

	// set world
	Field worldField = ReflectionUtil.getFieldByType(World.class, MapGenBase.class, false);
	ReflectionUtil.setValue(worldField, base, worldIn);

	// This is the same rand instance that will be used by other generator
	Random rand = ReflectionUtil.getValueByType(Random.class, MapGenBase.class, base, false);
	rand.setSeed(worldIn.getSeed());
	long randX = rand.nextLong();
	long randZ = rand.nextLong();

	int bitmask = Bits.bitmaskClamped(Config.loopBits(worldIn.provider.getDimensionId()) - 4);

	Method meth = ReflectionUtil.findMethod(MapGenBase.class, void.class, false, //
			World.class, int.class, int.class, int.class, int.class, ChunkPrimer.class);

	for (int xOrigin = chunkX - radius; xOrigin <= chunkX + radius; ++xOrigin) {
		for (int zOrigin = chunkZ - radius; zOrigin <= chunkZ + radius; ++zOrigin) {
			int xOriginMod = xOrigin & bitmask;
			int zOriginMod = zOrigin & bitmask;

			long xSeed = (long) xOriginMod * randX;
			long zSeedi2 = (long) zOriginMod * randZ;
			rand.setSeed(xSeed ^ zSeedi2 ^ worldIn.getSeed());

			ReflectionUtil.invokeMethod(void.class, base, meth, //
					worldIn, xOrigin, zOrigin, chunkX, chunkZ, blocks);
		}
	}
}
 
开发者ID:Barteks2x,项目名称:McWorldGenLoop,代码行数:35,代码来源:MapGenTileableUtil.java


示例3: func_191069_a

import net.minecraft.world.gen.MapGenBase; //导入依赖的package包/类
protected static BlockPos func_191069_a(World p_191069_0_, MapGenStructure p_191069_1_, BlockPos p_191069_2_, int p_191069_3_, int p_191069_4_, int p_191069_5_, boolean p_191069_6_, int p_191069_7_, boolean p_191069_8_)
{
    int i = p_191069_2_.getX() >> 4;
    int j = p_191069_2_.getZ() >> 4;
    int k = 0;

    for (Random random = new Random(); k <= p_191069_7_; ++k)
    {
        for (int l = -k; l <= k; ++l)
        {
            boolean flag = l == -k || l == k;

            for (int i1 = -k; i1 <= k; ++i1)
            {
                boolean flag1 = i1 == -k || i1 == k;

                if (flag || flag1)
                {
                    int j1 = i + p_191069_3_ * l;
                    int k1 = j + p_191069_3_ * i1;

                    if (j1 < 0)
                    {
                        j1 -= p_191069_3_ - 1;
                    }

                    if (k1 < 0)
                    {
                        k1 -= p_191069_3_ - 1;
                    }

                    int l1 = j1 / p_191069_3_;
                    int i2 = k1 / p_191069_3_;
                    Random random1 = p_191069_0_.setRandomSeed(l1, i2, p_191069_5_);
                    l1 = l1 * p_191069_3_;
                    i2 = i2 * p_191069_3_;

                    if (p_191069_6_)
                    {
                        l1 = l1 + (random1.nextInt(p_191069_3_ - p_191069_4_) + random1.nextInt(p_191069_3_ - p_191069_4_)) / 2;
                        i2 = i2 + (random1.nextInt(p_191069_3_ - p_191069_4_) + random1.nextInt(p_191069_3_ - p_191069_4_)) / 2;
                    }
                    else
                    {
                        l1 = l1 + random1.nextInt(p_191069_3_ - p_191069_4_);
                        i2 = i2 + random1.nextInt(p_191069_3_ - p_191069_4_);
                    }

                    MapGenBase.func_191068_a(p_191069_0_.getSeed(), random, l1, i2);
                    random.nextInt();

                    if (p_191069_1_.canSpawnStructureAtCoords(l1, i2))
                    {
                        if (!p_191069_8_ || !p_191069_0_.func_190526_b(l1, i2))
                        {
                            return new BlockPos((l1 << 4) + 8, 64, (i2 << 4) + 8);
                        }
                    }
                    else if (k == 0)
                    {
                        break;
                    }
                }
            }

            if (k == 0)
            {
                break;
            }
        }
    }

    return null;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:75,代码来源:MapGenStructure.java


示例4: getModdedMapGen

import net.minecraft.world.gen.MapGenBase; //导入依赖的package包/类
public static MapGenBase getModdedMapGen(MapGenBase original, InitMapGenEvent.EventType type)
{
    InitMapGenEvent event = new InitMapGenEvent(type, original);
    MinecraftForge.TERRAIN_GEN_BUS.post(event);
    return event.getNewGen();
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:7,代码来源:TerrainGen.java


示例5: InitMapGenEvent

import net.minecraft.world.gen.MapGenBase; //导入依赖的package包/类
InitMapGenEvent(EventType type, MapGenBase original)
{
    this.type = type;
    this.originalGen = original;
    this.setNewGen(original);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:7,代码来源:InitMapGenEvent.java


示例6: getModdedMapGen

import net.minecraft.world.gen.MapGenBase; //导入依赖的package包/类
public static MapGenBase getModdedMapGen(MapGenBase original, InitMapGenEvent.EventType type)
{
    InitMapGenEvent event = new InitMapGenEvent(type, original);
    MinecraftForge.TERRAIN_GEN_BUS.post(event);
    return event.newGen;
}
 
开发者ID:SchrodingersSpy,项目名称:TRHS_Club_Mod_2016,代码行数:7,代码来源:TerrainGen.java


示例7: InitMapGenEvent

import net.minecraft.world.gen.MapGenBase; //导入依赖的package包/类
InitMapGenEvent(EventType type, MapGenBase original)
{
    this.type = type;
    this.originalGen = original;
    this.newGen = original;
}
 
开发者ID:SchrodingersSpy,项目名称:TRHS_Club_Mod_2016,代码行数:7,代码来源:InitMapGenEvent.java


示例8: tileableMapGen

import net.minecraft.world.gen.MapGenBase; //导入依赖的package包/类
public static MapGenBase tileableMapGen(MapGenBase originalGen) {
	logger.info("Creating new Generator for typr: " + originalGen.getClass());
	return new MapGenTileable(originalGen);
}
 
开发者ID:Barteks2x,项目名称:McWorldGenLoop,代码行数:5,代码来源:WorldGenUtil.java


示例9: MapGenTileable

import net.minecraft.world.gen.MapGenBase; //导入依赖的package包/类
public MapGenTileable(MapGenBase generator){
	this.generator = generator;
}
 
开发者ID:Barteks2x,项目名称:McWorldGenLoop,代码行数:4,代码来源:MapGenTileable.java


示例10: MapGenDeadzone

import net.minecraft.world.gen.MapGenBase; //导入依赖的package包/类
public MapGenDeadzone(MapGenBase base) {
    this.childGen = base;
}
 
开发者ID:Lumaceon,项目名称:ClockworkPhase2,代码行数:4,代码来源:MapGenDeadzone.java


示例11: InitMapGenEventRunes

import net.minecraft.world.gen.MapGenBase; //导入依赖的package包/类
InitMapGenEventRunes(EventType type, MapGenBase original)
{
    this.type = type;
    this.originalGen = original;
    this.newGen = original;
}
 
开发者ID:MinecraftModArchive,项目名称:Runes-And-Silver,代码行数:7,代码来源:InitMapGenEventRunes.java


示例12: getOriginalGen

import net.minecraft.world.gen.MapGenBase; //导入依赖的package包/类
public MapGenBase getOriginalGen() { return originalGen; } 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:2,代码来源:InitMapGenEvent.java


示例13: getNewGen

import net.minecraft.world.gen.MapGenBase; //导入依赖的package包/类
public MapGenBase getNewGen() { return newGen; } 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:2,代码来源:InitMapGenEvent.java


示例14: setNewGen

import net.minecraft.world.gen.MapGenBase; //导入依赖的package包/类
public void setNewGen(MapGenBase newGen) { this.newGen = newGen; } 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:2,代码来源:InitMapGenEvent.java



注:本文中的net.minecraft.world.gen.MapGenBase类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java BreakEvent类代码示例发布时间:2022-05-21
下一篇:
Java RetriesExhaustedException类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap