Search in sources :

Example 41 with BlockPos

use of net.minecraft.util.math.BlockPos in project Realistic-Terrain-Generation by Team-RTG.

the class DecoCobwebs method generate.

@Override
public void generate(IRealisticBiome biome, RTGWorld rtgWorld, Random rand, int worldX, int worldZ, float strength, float river, boolean hasPlacedVillageBlocks) {
    if (this.allowed) {
        WorldGenerator worldGenerator = new WorldGenBlock(Blocks.WEB.getDefaultState(), Blocks.AIR.getDefaultState(), this.adjacentBlock, this.minAdjacents);
        for (int l1 = 0; l1 < this.strengthFactor * strength; ++l1) {
            // + 8;
            int i1 = worldX + rand.nextInt(16);
            // + 8;
            int j1 = worldZ + rand.nextInt(16);
            int k1 = RandomUtil.getRandomInt(rand, this.minY, this.maxY);
            if (rand.nextInt(this.chance) == 0) {
                worldGenerator.generate(rtgWorld.world, rand, new BlockPos(i1, k1, j1));
            }
        }
    }
}
Also used : WorldGenBlock(rtg.api.world.gen.feature.WorldGenBlock) WorldGenerator(net.minecraft.world.gen.feature.WorldGenerator) BlockPos(net.minecraft.util.math.BlockPos)

Example 42 with BlockPos

use of net.minecraft.util.math.BlockPos in project Realistic-Terrain-Generation by Team-RTG.

the class DecoCrop method generate.

@Override
public void generate(IRealisticBiome biome, RTGWorld rtgWorld, Random rand, int worldX, int worldZ, float strength, float river, boolean hasPlacedVillageBlocks) {
    if (this.allowed) {
        WorldUtil worldUtil = new WorldUtil(rtgWorld.world);
        WorldGenerator worldGenerator = new WorldGenCrops(type, size, density, height, water);
        if (this.chance < 1) {
            return;
        }
        for (int l1 = 0; l1 < this.strengthFactor * strength; ++l1) {
            // + 8;
            int i1 = worldX + rand.nextInt(16);
            // + 8;
            int j1 = worldZ + rand.nextInt(16);
            int k1 = rtgWorld.world.getHeight(new BlockPos(i1, 0, j1)).getY();
            if (k1 >= this.minY && k1 <= this.maxY && rand.nextInt(this.chance) == 0) {
                // If we're in a village, check to make sure the boulder has extra room to grow to avoid corrupting the village.
                if (hasPlacedVillageBlocks) {
                    if (!worldUtil.isSurroundedByBlock(Blocks.AIR.getDefaultState(), 2, WorldUtil.SurroundCheckType.CARDINAL, rand, i1, k1, j1)) {
                        return;
                    }
                }
                worldGenerator.generate(rtgWorld.world, rand, new BlockPos(i1, k1, j1));
            }
        }
    }
}
Also used : WorldGenerator(net.minecraft.world.gen.feature.WorldGenerator) WorldGenCrops(rtg.api.world.gen.feature.WorldGenCrops) BlockPos(net.minecraft.util.math.BlockPos) WorldUtil(rtg.api.util.WorldUtil)

Example 43 with BlockPos

use of net.minecraft.util.math.BlockPos in project Realistic-Terrain-Generation by Team-RTG.

the class DecoDesertWell method generate.

@Override
public void generate(IRealisticBiome biome, RTGWorld rtgWorld, Random rand, int worldX, int worldZ, float strength, float river, boolean hasPlacedVillageBlocks) {
    if (this.allowed) {
        WorldGenerator worldGenerator = new WorldGenDesertWells();
        this.setLoops((this.strengthFactor > 0f) ? (int) (this.strengthFactor * strength) : this.loops);
        for (int i = 0; i < this.loops; i++) {
            if (rand.nextInt(this.chance) == 0) {
                int intX = worldX + rand.nextInt(16) + 8;
                int intY = rand.nextInt(this.maxY);
                int intZ = worldZ + rand.nextInt(16) + 8;
                if (intY <= this.maxY) {
                    worldGenerator.generate(rtgWorld.world, rand, new BlockPos(intX, intY, intZ));
                }
            }
        }
    }
}
Also used : WorldGenerator(net.minecraft.world.gen.feature.WorldGenerator) WorldGenDesertWells(net.minecraft.world.gen.feature.WorldGenDesertWells) BlockPos(net.minecraft.util.math.BlockPos)

Example 44 with BlockPos

use of net.minecraft.util.math.BlockPos in project Realistic-Terrain-Generation by Team-RTG.

the class BlockForcer method placeBlock.

public void placeBlock(World target, int x, int y, int z, IBlockState placed) {
    Chunk chunk = target.getChunkFromBlockCoords(new BlockPos(x, 0, z));
    chunk.setBlockState(new BlockPos(x & 15, y, z & 15), placed);
}
Also used : BlockPos(net.minecraft.util.math.BlockPos) Chunk(net.minecraft.world.chunk.Chunk)

Example 45 with BlockPos

use of net.minecraft.util.math.BlockPos in project Realistic-Terrain-Generation by Team-RTG.

the class BiomeDecoratorRTG method genStandardOre1.

public void genStandardOre1(World worldIn, Random random, int blockCount, WorldGenerator generator, int minHeight, int maxHeight) {
    if (maxHeight < minHeight) {
        int i = minHeight;
        minHeight = maxHeight;
        maxHeight = i;
    } else if (maxHeight == minHeight) {
        if (minHeight < 255) {
            ++maxHeight;
        } else {
            --minHeight;
        }
    }
    for (int j = 0; j < blockCount; ++j) {
        BlockPos blockpos = this.pos.add(random.nextInt(16), random.nextInt(maxHeight - minHeight) + minHeight, random.nextInt(16));
        generator.generate(worldIn, random, blockpos);
    }
}
Also used : BlockPos(net.minecraft.util.math.BlockPos)

Aggregations

BlockPos (net.minecraft.util.math.BlockPos)4488 IBlockState (net.minecraft.block.state.IBlockState)1202 TileEntity (net.minecraft.tileentity.TileEntity)675 ItemStack (net.minecraft.item.ItemStack)577 World (net.minecraft.world.World)550 Block (net.minecraft.block.Block)545 EnumFacing (net.minecraft.util.EnumFacing)517 EntityPlayer (net.minecraft.entity.player.EntityPlayer)257 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)249 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)216 Vec3d (net.minecraft.util.math.Vec3d)216 ArrayList (java.util.ArrayList)211 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)182 Entity (net.minecraft.entity.Entity)176 NBTTagList (net.minecraft.nbt.NBTTagList)139 Random (java.util.Random)130 Biome (net.minecraft.world.biome.Biome)129 Nullable (javax.annotation.Nullable)126 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)126 RayTraceResult (net.minecraft.util.math.RayTraceResult)112