當前位置: 首頁>>代碼示例>>Java>>正文


Java MapGenBase類代碼示例

本文整理匯總了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;未經允許,請勿轉載。