Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- *** MADE BY MRPONYCAPTAIN'S .SCHEMATIC TO .JAVA CONVERTING TOOL v2.0 ***
- */
- package com.crazyhoorse961.core.WorldGen;
- import java.util.Random;
- import net.minecraft.block.Block;
- import net.minecraft.init.Blocks;
- import net.minecraft.world.World;
- import net.minecraft.world.chunk.IChunkProvider;
- import net.minecraft.world.gen.feature.WorldGenerator;
- import net.minecraftforge.fml.common.IWorldGenerator;
- public abstract class Trap extends WorldGenerator implements IWorldGenerator
- {
- protected Block[] getValidSpawnBlocks() {
- return new Block[] {
- Blocks.grass
- };
- }
- public boolean locationIsValidSpawn(World world, int i, int j, int k){
- int distanceToAir = 0;
- Block check = world.getBlock(i, j, k);
- while (check != Blocks.air){
- if (distanceToAir > 3){
- return false;
- }
- distanceToAir++;
- check = world.getBlock(i, j + distanceToAir, k);
- }
- j += distanceToAir - 1;
- Block block = (world).getBlock(i, j, k);
- Block blockAbove = world.getBlock(i, j+1, k);
- Block blockBelow = world.getBlock
- (i, j-1, k);
- for (Block x : getValidSpawnBlocks()){
- if (blockAbove != Blocks.air){
- return false;
- }
- if (block == x){
- return true;
- }else if (block == Blocks.snow && blockBelow == x){
- return true;
- }
- }
- return false;
- }
- public Trap() { }
- @Override
- public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { }
- public void setBlock(World world, int x, int y, int z, Block block, int metadata)
- {
- Block b1 = world.getBlock(x, y, z);
- if(b1.isAir(world, x, y, z) || b1.isLeaves(world, x, y, z))
- {
- (world).setBlockState(x, y, z, block, metadata, 2);
- }
- }
- public boolean generate(World world, Random rand, int i, int j, int k) {
- //check that each corner is one of the valid spawn blocks
- if(!locationIsValidSpawn(world, i, j, k) || !locationIsValidSpawn(world, i + 6, j, k) || !locationIsValidSpawn(world, i + 6, j, k + 5) || !locationIsValidSpawn(world, i, j, k + 5))
- {
- return false;
- }
- k = k - 10;
- i = i - 10;
- this.setBlock(world, i + 0, j + 0, k + 0, Blocks.dirt, 0);
- this.setBlock(world, i + 0, j + 0, k + 1, Blocks.dirt, 0);
- this.setBlock(world, i + 0, j + 0, k + 2, Blocks.dirt, 0);
- this.setBlock(world, i + 0, j + 0, k + 3, Blocks.grass, 0);
- this.setBlock(world, i + 0, j + 0, k + 4, Blocks.dirt, 0);
- this.setBlock(world, i + 0, j + 0, k + 5, Blocks.dirt, 0);
- this.setBlock(world, i + 0, j + 1, k + 0, Blocks.dirt, 0);
- this.setBlock(world, i + 0, j + 1, k + 1, Blocks.dirt, 0);
- this.setBlock(world, i + 0, j + 1, k + 2, Blocks.dirt, 0);
- this.setBlock(world, i + 0, j + 1, k + 3, Blocks.dirt, 0);
- this.setBlock(world, i + 0, j + 1, k + 4, Blocks.dirt, 0);
- this.setBlock(world, i + 0, j + 1, k + 5, Blocks.dirt, 0);
- this.setBlock(world, i + 0, j + 2, k + 0, Blocks.dirt, 0);
- this.setBlock(world, i + 0, j + 2, k + 1, Blocks.dirt, 0);
- this.setBlock(world, i + 0, j + 2, k + 2, Blocks.dirt, 0);
- this.setBlock(world, i + 0, j + 2, k + 3, Blocks.dirt, 0);
- this.setBlock(world, i + 0, j + 2, k + 4, Blocks.dirt, 0);
- this.setBlock(world, i + 0, j + 2, k + 5, Blocks.grass, 0);
- this.setBlock(world, i + 0, j + 3, k + 0, Blocks.stonebrick, 0);
- this.setBlock(world, i + 0, j + 3, k + 1, Blocks.stonebrick, 0);
- this.setBlock(world, i + 0, j + 3, k + 2, Blocks.stone, 0);
- this.setBlock(world, i + 0, j + 3, k + 3, Blocks.stone, 0);
- this.setBlock(world, i + 0, j + 3, k + 4, Blocks.stonebrick, 0);
- this.setBlock(world, i + 0, j + 3, k + 5, Blocks.stonebrick, 0);
- this.setBlock(world, i + 0, j + 4, k + 1, Blocks.stone_slab, 5);
- this.setBlock(world, i + 0, j + 4, k + 4, Blocks.stone_slab, 5);
- this.setBlock(world, i + 1, j + 0, k + 0, Blocks.dirt, 0);
- this.setBlock(world, i + 1, j + 0, k + 1, Blocks.dirt, 0);
- this.setBlock(world, i + 1, j + 0, k + 2, Blocks.grass, 0);
- this.setBlock(world, i + 1, j + 0, k + 3, Blocks.grass, 0);
- this.setBlock(world, i + 1, j + 0, k + 4, Blocks.grass, 0);
- this.setBlock(world, i + 1, j + 0, k + 5, Blocks.dirt, 0);
- this.setBlock(world, i + 1, j + 1, k + 0, Blocks.grass, 0);
- this.setBlock(world, i + 1, j + 1, k + 1, Blocks.grass, 0);
- this.setBlock(world, i + 1, j + 1, k + 5, Blocks.dirt, 0);
- this.setBlock(world, i + 1, j + 2, k + 0, Blocks.dirt, 0);
- this.setBlock(world, i + 1, j + 2, k + 5, Blocks.dirt, 0);
- this.setBlock(world, i + 1, j + 3, k + 0, Blocks.stonebrick, 0);
- this.setBlock(world, i + 1, j + 3, k + 1, Blocks.dirt, 0);
- this.setBlock(world, i + 1, j + 3, k + 2, Blocks.stone, 0);
- this.setBlock(world, i + 1, j + 3, k + 3, Blocks.stone, 0);
- this.setBlock(world, i + 1, j + 3, k + 4, Blocks.dirt, 0);
- this.setBlock(world, i + 1, j + 3, k + 5, Blocks.stonebrick, 0);
- this.setBlock(world, i + 1, j + 4, k + 0, Blocks.stone_slab, 5);
- this.setBlock(world, i + 1, j + 4, k + 1, Blocks.stonebrick, 3);
- this.setBlock(world, i + 1, j + 4, k + 4, Blocks.stonebrick, 1);
- this.setBlock(world, i + 1, j + 4, k + 5, Blocks.stone_slab, 5);
- this.setBlock(world, i + 1, j + 5, k + 1, Blocks.stonebrick, 1);
- this.setBlock(world, i + 1, j + 5, k + 4, Blocks.stonebrick, 3);
- this.setBlock(world, i + 1, j + 6, k + 1, Blocks.stonebrick, 3);
- this.setBlock(world, i + 1, j + 6, k + 4, Blocks.stonebrick, 1);
- this.setBlock(world, i + 1, j + 7, k + 1, Blocks.stone_slab, 0);
- this.setBlock(world, i + 1, j + 7, k + 2, Blocks.stone_slab, 0);
- this.setBlock(world, i + 1, j + 7, k + 3, Blocks.stone_slab, 0);
- this.setBlock(world, i + 1, j + 7, k + 4, Blocks.stone_slab, 0);
- this.setBlock(world, i + 2, j + 0, k + 0, Blocks.dirt, 0);
- this.setBlock(world, i + 2, j + 0, k + 1, Blocks.dirt, 0);
- this.setBlock(world, i + 2, j + 0, k + 2, Blocks.grass, 0);
- this.setBlock(world, i + 2, j + 0, k + 3, Blocks.dirt, 0);
- this.setBlock(world, i + 2, j + 0, k + 4, Blocks.grass, 0);
- this.setBlock(world, i + 2, j + 0, k + 5, Blocks.dirt, 0);
- this.setBlock(world, i + 2, j + 1, k + 0, Blocks.dirt, 0);
- this.setBlock(world, i + 2, j + 1, k + 1, Blocks.grass, 0);
- this.setBlock(world, i + 2, j + 1, k + 2, Blocks.stone, 0);
- this.setBlock(world, i + 2, j + 1, k + 3, Blocks.stone, 0);
- this.setBlock(world, i + 2, j + 1, k + 5, Blocks.dirt, 0);
- this.setBlock(world, i + 2, j + 2, k + 0, Blocks.dirt, 0);
- this.setBlock(world, i + 2, j + 2, k + 2, Blocks.tnt, 0);
- this.setBlock(world, i + 2, j + 2, k + 3, Blocks.tnt, 0);
- this.setBlock(world, i + 2, j + 2, k + 5, Blocks.dirt, 0);
- this.setBlock(world, i + 2, j + 3, k + 0, Blocks.stone, 0);
- this.setBlock(world, i + 2, j + 3, k + 1, Blocks.stone, 0);
- this.setBlock(world, i + 2, j + 3, k + 2, Blocks.stone, 0);
- this.setBlock(world, i + 2, j + 3, k + 3, Blocks.stone, 0);
- this.setBlock(world, i + 2, j + 3, k + 4, Blocks.stone, 0);
- this.setBlock(world, i + 2, j + 3, k + 5, Blocks.stone, 0);
- this.setBlock(world, i + 2, j + 7, k + 1, Blocks.stone_slab, 0);
- this.setBlock(world, i + 2, j + 7, k + 2, Blocks.stonebrick, 5);
- this.setBlock(world, i + 2, j + 7, k + 3, Blocks.double_stone_slab, 5);
- this.setBlock(world, i + 2, j + 7, k + 4, Blocks.stone_slab, 0);
- this.setBlock(world, i + 3, j + 0, k + 0, Blocks.dirt, 0);
- this.setBlock(world, i + 3, j + 0, k + 1, Blocks.grass, 0);
- this.setBlock(world, i + 3, j + 0, k + 2, Blocks.grass, 0);
- this.setBlock(world, i + 3, j + 0, k + 3, Blocks.dirt, 0);
- this.setBlock(world, i + 3, j + 0, k + 4, Blocks.grass, 0);
- this.setBlock(world, i + 3, j + 0, k + 5, Blocks.dirt, 0);
- this.setBlock(world, i + 3, j + 1, k + 0, Blocks.dirt, 0);
- this.setBlock(world, i + 3, j + 1, k + 2, Blocks.dirt, 0);
- this.setBlock(world, i + 3, j + 1, k + 3, Blocks.dirt, 0);
- this.setBlock(world, i + 3, j + 1, k + 5, Blocks.dirt, 0);
- this.setBlock(world, i + 3, j + 2, k + 0, Blocks.dirt, 0);
- this.setBlock(world, i + 3, j + 2, k + 1, Blocks.dirt, 0);
- this.setBlock(world, i + 3, j + 2, k + 2, Blocks.tnt, 0);
- this.setBlock(world, i + 3, j + 2, k + 3, Blocks.tnt, 0);
- this.setBlock(world, i + 3, j + 2, k + 5, Blocks.dirt, 0);
- this.setBlock(world, i + 3, j + 3, k + 0, Blocks.stone, 0);
- this.setBlock(world, i + 3, j + 3, k + 1, Blocks.stone, 0);
- this.setBlock(world, i + 3, j + 3, k + 2, Blocks.grass, 0);
- this.setBlock(world, i + 3, j + 3, k + 3, Blocks.grass, 0);
- this.setBlock(world, i + 3, j + 3, k + 4, Blocks.stone, 0);
- this.setBlock(world, i + 3, j + 3, k + 5, Blocks.stone, 0);
- this.setBlock(world, i + 3, j + 4, k + 2, Blocks.air, 5);
- this.setBlock(world, i + 3, j + 4, k + 3, Blocks.air, 5);
- this.setBlock(world, i + 3, j + 7, k + 1, Blocks.stone_slab, 0);
- this.setBlock(world, i + 3, j + 7, k + 2, Blocks.double_stone_slab, 5);
- this.setBlock(world, i + 3, j + 7, k + 3, Blocks.double_stone_slab, 5);
- this.setBlock(world, i + 3, j + 7, k + 4, Blocks.stone_slab, 0);
- this.setBlock(world, i + 4, j + 0, k + 0, Blocks.dirt, 0);
- this.setBlock(world, i + 4, j + 0, k + 1, Blocks.grass, 0);
- this.setBlock(world, i + 4, j + 0, k + 2, Blocks.dirt, 0);
- this.setBlock(world, i + 4, j + 0, k + 3, Blocks.dirt, 0);
- this.setBlock(world, i + 4, j + 0, k + 4, Blocks.grass, 0);
- this.setBlock(world, i + 4, j + 0, k + 5, Blocks.dirt, 0);
- this.setBlock(world, i + 4, j + 1, k + 0, Blocks.dirt, 0);
- this.setBlock(world, i + 4, j + 1, k + 2, Blocks.stone, 0);
- this.setBlock(world, i + 4, j + 1, k + 3, Blocks.stone, 0);
- this.setBlock(world, i + 4, j + 1, k + 5, Blocks.dirt, 0);
- this.setBlock(world, i + 4, j + 2, k + 0, Blocks.dirt, 0);
- this.setBlock(world, i + 4, j + 2, k + 2, Blocks.tnt, 0);
- this.setBlock(world, i + 4, j + 2, k + 3, Blocks.tnt, 0);
- this.setBlock(world, i + 4, j + 2, k + 5, Blocks.dirt, 0);
- this.setBlock(world, i + 4, j + 3, k + 0, Blocks.stone, 0);
- this.setBlock(world, i + 4, j + 3, k + 1, Blocks.stone, 0);
- this.setBlock(world, i + 4, j + 3, k + 2, Blocks.stone, 0);
- this.setBlock(world, i + 4, j + 3, k + 3, Blocks.stone, 0);
- this.setBlock(world, i + 4, j + 3, k + 4, Blocks.stone, 0);
- this.setBlock(world, i + 4, j + 3, k + 5, Blocks.stone, 0);
- this.setBlock(world, i + 4, j + 7, k + 1, Blocks.stone_slab, 0);
- this.setBlock(world, i + 4, j + 7, k + 2, Blocks.double_stone_slab, 5);
- this.setBlock(world, i + 4, j + 7, k + 3, Blocks.double_stone_slab, 5);
- this.setBlock(world, i + 4, j + 7, k + 4, Blocks.stone_slab, 0);
- this.setBlock(world, i + 5, j + 0, k + 0, Blocks.dirt, 0);
- this.setBlock(world, i + 5, j + 0, k + 1, Blocks.grass, 0);
- this.setBlock(world, i + 5, j + 0, k + 2, Blocks.grass, 0);
- this.setBlock(world, i + 5, j + 0, k + 3, Blocks.grass, 0);
- this.setBlock(world, i + 5, j + 0, k + 4, Blocks.grass, 0);
- this.setBlock(world, i + 5, j + 0, k + 5, Blocks.dirt, 0);
- this.setBlock(world, i + 5, j + 1, k + 0, Blocks.dirt, 0);
- this.setBlock(world, i + 5, j + 1, k + 5, Blocks.dirt, 0);
- this.setBlock(world, i + 5, j + 2, k + 0, Blocks.dirt, 0);
- this.setBlock(world, i + 5, j + 2, k + 5, Blocks.dirt, 0);
- this.setBlock(world, i + 5, j + 3, k + 0, Blocks.stonebrick, 0);
- this.setBlock(world, i + 5, j + 3, k + 1, Blocks.dirt, 0);
- this.setBlock(world, i + 5, j + 3, k + 2, Blocks.stone, 0);
- this.setBlock(world, i + 5, j + 3, k + 3, Blocks.stone, 0);
- this.setBlock(world, i + 5, j + 3, k + 4, Blocks.dirt, 0);
- this.setBlock(world, i + 5, j + 3, k + 5, Blocks.stonebrick, 0);
- this.setBlock(world, i + 5, j + 4, k + 0, Blocks.stone_slab, 5);
- this.setBlock(world, i + 5, j + 4, k + 1, Blocks.stonebrick, 3);
- this.setBlock(world, i + 5, j + 4, k + 4, Blocks.stonebrick, 1);
- this.setBlock(world, i + 5, j + 4, k + 5, Blocks.stone_slab, 5);
- this.setBlock(world, i + 5, j + 5, k + 1, Blocks.stonebrick, 1);
- this.setBlock(world, i + 5, j + 5, k + 4, Blocks.stonebrick, 3);
- this.setBlock(world, i + 5, j + 6, k + 1, Blocks.stonebrick, 3);
- this.setBlock(world, i + 5, j + 6, k + 4, Blocks.stonebrick, 1);
- this.setBlock(world, i + 5, j + 7, k + 1, Blocks.stone_slab, 0);
- this.setBlock(world, i + 5, j + 7, k + 2, Blocks.stone_slab, 0);
- this.setBlock(world, i + 5, j + 7, k + 3, Blocks.stone_slab, 0);
- this.setBlock(world, i + 5, j + 7, k + 4, Blocks.stone_slab, 0);
- this.setBlock(world, i + 6, j + 0, k + 0, Blocks.dirt, 0);
- this.setBlock(world, i + 6, j + 0, k + 1, Blocks.dirt, 0);
- this.setBlock(world, i + 6, j + 0, k + 2, Blocks.dirt, 0);
- this.setBlock(world, i + 6, j + 0, k + 3, Blocks.dirt, 0);
- this.setBlock(world, i + 6, j + 0, k + 4, Blocks.dirt, 0);
- this.setBlock(world, i + 6, j + 0, k + 5, Blocks.dirt, 0);
- this.setBlock(world, i + 6, j + 1, k + 0, Blocks.dirt, 0);
- this.setBlock(world, i + 6, j + 1, k + 1, Blocks.dirt, 0);
- this.setBlock(world, i + 6, j + 1, k + 2, Blocks.dirt, 0);
- this.setBlock(world, i + 6, j + 1, k + 3, Blocks.dirt, 0);
- this.setBlock(world, i + 6, j + 1, k + 4, Blocks.dirt, 0);
- this.setBlock(world, i + 6, j + 1, k + 5, Blocks.grass, 0);
- this.setBlock(world, i + 6, j + 2, k + 0, Blocks.dirt, 0);
- this.setBlock(world, i + 6, j + 2, k + 1, Blocks.dirt, 0);
- this.setBlock(world, i + 6, j + 2, k + 2, Blocks.dirt, 0);
- this.setBlock(world, i + 6, j + 2, k + 3, Blocks.dirt, 0);
- this.setBlock(world, i + 6, j + 2, k + 4, Blocks.dirt, 0);
- this.setBlock(world, i + 6, j + 2, k + 5, Blocks.grass, 0);
- this.setBlock(world, i + 6, j + 3, k + 0, Blocks.stonebrick, 0);
- this.setBlock(world, i + 6, j + 3, k + 1, Blocks.stonebrick, 0);
- this.setBlock(world, i + 6, j + 3, k + 2, Blocks.stone, 0);
- this.setBlock(world, i + 6, j + 3, k + 3, Blocks.stone, 0);
- this.setBlock(world, i + 6, j + 3, k + 4, Blocks.stonebrick, 0);
- this.setBlock(world, i + 6, j + 3, k + 5, Blocks.stonebrick, 0);
- this.setBlock(world, i + 6, j + 4, k + 1, Blocks.stone_slab, 5);
- this.setBlock(world, i + 6, j + 4, k + 4, Blocks.stone_slab, 5);
- this.setBlock(world, i + 2, j + 4, k + 2, Blocks.stone_pressure_plate, 0);
- this.setBlock(world, i + 2, j + 4, k + 3, Blocks.stone_pressure_plate, 0);
- this.setBlock(world, i + 3, j + 4, k + 1, Blocks.stone_pressure_plate, 0);
- this.setBlock(world, i + 3, j + 4, k + 4, Blocks.stone_pressure_plate, 0);
- this.setBlock(world, i + 4, j + 4, k + 2, Blocks.stone_pressure_plate, 0);
- this.setBlock(world, i + 4, j + 4, k + 3, Blocks.stone_pressure_plate, 0);
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment