Java 类net.minecraft.world.gen.MapGenBase 实例源码

项目:McWorldGenLoop    文件:EventListener.java   
@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);
    }
}
项目:McWorldGenLoop    文件:MapGenTileableUtil.java   
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);
        }
    }
}
项目:Backmemed    文件:MapGenStructure.java   
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;
}
项目:CustomWorldGen    文件:TerrainGen.java   
public static MapGenBase getModdedMapGen(MapGenBase original, InitMapGenEvent.EventType type)
{
    InitMapGenEvent event = new InitMapGenEvent(type, original);
    MinecraftForge.TERRAIN_GEN_BUS.post(event);
    return event.getNewGen();
}
项目:CustomWorldGen    文件:InitMapGenEvent.java   
InitMapGenEvent(EventType type, MapGenBase original)
{
    this.type = type;
    this.originalGen = original;
    this.setNewGen(original);
}
项目:TRHS_Club_Mod_2016    文件:TerrainGen.java   
public static MapGenBase getModdedMapGen(MapGenBase original, InitMapGenEvent.EventType type)
{
    InitMapGenEvent event = new InitMapGenEvent(type, original);
    MinecraftForge.TERRAIN_GEN_BUS.post(event);
    return event.newGen;
}
项目:TRHS_Club_Mod_2016    文件:InitMapGenEvent.java   
InitMapGenEvent(EventType type, MapGenBase original)
{
    this.type = type;
    this.originalGen = original;
    this.newGen = original;
}
项目:McWorldGenLoop    文件:WorldGenUtil.java   
public static MapGenBase tileableMapGen(MapGenBase originalGen) {
    logger.info("Creating new Generator for typr: " + originalGen.getClass());
    return new MapGenTileable(originalGen);
}
项目:McWorldGenLoop    文件:MapGenTileable.java   
public MapGenTileable(MapGenBase generator){
    this.generator = generator;
}
项目:CauldronGit    文件:TerrainGen.java   
public static MapGenBase getModdedMapGen(MapGenBase original, InitMapGenEvent.EventType type)
{
    InitMapGenEvent event = new InitMapGenEvent(type, original);
    MinecraftForge.TERRAIN_GEN_BUS.post(event);
    return event.newGen;
}
项目:CauldronGit    文件:InitMapGenEvent.java   
InitMapGenEvent(EventType type, MapGenBase original)
{
    this.type = type;
    this.originalGen = original;
    this.newGen = original;
}
项目:ClockworkPhase2    文件:MapGenDeadzone.java   
public MapGenDeadzone(MapGenBase base) {
    this.childGen = base;
}
项目:Runes-And-Silver    文件:InitMapGenEventRunes.java   
InitMapGenEventRunes(EventType type, MapGenBase original)
{
    this.type = type;
    this.originalGen = original;
    this.newGen = original;
}
项目:Cauldron    文件:TerrainGen.java   
public static MapGenBase getModdedMapGen(MapGenBase original, InitMapGenEvent.EventType type)
{
    InitMapGenEvent event = new InitMapGenEvent(type, original);
    MinecraftForge.TERRAIN_GEN_BUS.post(event);
    return event.newGen;
}
项目:Cauldron    文件:InitMapGenEvent.java   
InitMapGenEvent(EventType type, MapGenBase original)
{
    this.type = type;
    this.originalGen = original;
    this.newGen = original;
}
项目:Cauldron    文件:TerrainGen.java   
public static MapGenBase getModdedMapGen(MapGenBase original, InitMapGenEvent.EventType type)
{
    InitMapGenEvent event = new InitMapGenEvent(type, original);
    MinecraftForge.TERRAIN_GEN_BUS.post(event);
    return event.newGen;
}
项目:Cauldron    文件:InitMapGenEvent.java   
InitMapGenEvent(EventType type, MapGenBase original)
{
    this.type = type;
    this.originalGen = original;
    this.newGen = original;
}
项目:Cauldron    文件:TerrainGen.java   
public static MapGenBase getModdedMapGen(MapGenBase original, InitMapGenEvent.EventType type)
{
    InitMapGenEvent event = new InitMapGenEvent(type, original);
    MinecraftForge.TERRAIN_GEN_BUS.post(event);
    return event.newGen;
}
项目:Cauldron    文件:InitMapGenEvent.java   
InitMapGenEvent(EventType type, MapGenBase original)
{
    this.type = type;
    this.originalGen = original;
    this.newGen = original;
}
项目:RuneCraftery    文件:TerrainGen.java   
public static MapGenBase getModdedMapGen(MapGenBase original, InitMapGenEvent.EventType type)
{
    InitMapGenEvent event = new InitMapGenEvent(type, original);
    MinecraftForge.TERRAIN_GEN_BUS.post(event);
    return event.newGen;
}
项目:RuneCraftery    文件:InitMapGenEvent.java   
InitMapGenEvent(EventType type, MapGenBase original)
{
    this.type = type;
    this.originalGen = original;
    this.newGen = original;
}
项目:RuneCraftery    文件:TerrainGen.java   
public static MapGenBase getModdedMapGen(MapGenBase original, InitMapGenEvent.EventType type)
{
    InitMapGenEvent event = new InitMapGenEvent(type, original);
    MinecraftForge.TERRAIN_GEN_BUS.post(event);
    return event.newGen;
}
项目:RuneCraftery    文件:InitMapGenEvent.java   
InitMapGenEvent(EventType type, MapGenBase original)
{
    this.type = type;
    this.originalGen = original;
    this.newGen = original;
}
项目:BetterNutritionMod    文件:TerrainGen.java   
public static MapGenBase getModdedMapGen(MapGenBase original, InitMapGenEvent.EventType type)
{
    InitMapGenEvent event = new InitMapGenEvent(type, original);
    MinecraftForge.TERRAIN_GEN_BUS.post(event);
    return event.newGen;
}
项目:BetterNutritionMod    文件:InitMapGenEvent.java   
InitMapGenEvent(EventType type, MapGenBase original)
{
    this.type = type;
    this.originalGen = original;
    this.newGen = original;
}
项目:CustomWorldGen    文件:InitMapGenEvent.java   
public MapGenBase getOriginalGen() { return originalGen; }
项目:CustomWorldGen    文件:InitMapGenEvent.java   
public MapGenBase getNewGen() { return newGen; }
项目:CustomWorldGen    文件:InitMapGenEvent.java   
public void setNewGen(MapGenBase newGen) { this.newGen = newGen; }