Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.penumbral.steelworks.world;
- import java.util.Random;
- import net.minecraft.block.Block;
- import net.minecraft.block.material.Material;
- import net.minecraft.init.Blocks;
- import net.minecraft.util.BlockPos;
- import net.minecraft.world.World;
- import net.minecraft.world.gen.feature.WorldGenerator;
- import com.penumbral.steelworks.init.SteelworksBlocks;
- public class FireClayGen extends WorldGenerator{
- private final Block blockToGen;
- private final int numberOfBlocks;
- public FireClayGen(Block block, int p_i2011_1_)
- {
- this.blockToGen = SteelworksBlocks.fire_clayblock;
- this.numberOfBlocks = p_i2011_1_;
- }
- public boolean generateClay(World world1, Random rand, BlockPos pos)
- {
- if (world1.getBlockState(pos).getBlock().getMaterial() != Material.water)
- {
- return false;
- }
- else
- {
- int i = rand.nextInt(this.numberOfBlocks - 2) + 2;
- byte b0 = 1;
- for (int j = pos.getX() - i; j <= pos.getX() + i; ++j)
- {
- for (int k = pos.getZ() - i; k <= pos.getZ() + i; ++k)
- {
- int l = j - pos.getX();
- int i1 = k - pos.getZ();
- if (l * l + i1 * i1 <= i * i)
- {
- for (int j1 = pos.getY() - b0; j1 <= pos.getY() + b0; ++j1)
- {
- BlockPos blockpos1 = new BlockPos(j, j1, k);
- Block block = world1.getBlockState(blockpos1).getBlock();
- if (block == Blocks.dirt || block == blockToGen)
- {
- world1.setBlockState(blockpos1, this.blockToGen.getDefaultState(), 2);
- }
- }
- }
- }
- }
- return false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement