Having an issue with my custom structure spawning slightly above the ground, and inside terrain.
TinkerWagonGeneration.java
package projectmayhem1983.wheeloftime.generation;
import java.util.Random;
import cpw.mods.fml.common.IWorldGenerator;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import projectmayhem1983.wheeloftime.entities.mobs.Aiel.EntityAielMob;
import projectmayhem1983.wheeloftime.structures.tinkerwagon;
public class TinkerWagonGeneration implements IWorldGenerator {
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator,
IChunkProvider chunkProvider) {
switch (world.provider.dimensionId) {
case -1:
generateNether(world, random, chunkX*16, chunkZ*16);
break;
case 0:
generateOverworld(world, random, chunkX*16, chunkZ*16);
break;
case 1:
generateEnd(world, random, chunkX*16, chunkZ*16);
break;
}
}
public void generateNether(World world, Random rand, int x, int z) {
}
public void generateOverworld(World world, Random rand, int x, int z) {
generateStructure(world, rand, x, z, 1, 200);
}
public void generateEnd(World world, Random rand, int x, int z) {
}
public void generateStructure(World world, Random random, int chunkX, int chunkZ, int chance, int height) {
tinkerwagon gen = new tinkerwagon();
int spawnchance = random.nextInt(100);
for(int x = 0; x < 1; x++);
int i = chunkX + random.nextInt(16);
int k = chunkZ + random.nextInt(16);
int j = world.getHeightValue(i, k);
if (spawnchance < 25){
gen.generate(world, random, i, j, k);
}
}
}
TinkerWagon.java
/*
*** MADE BY MRPONYCAPTAIN'S .SCHEMATIC TO .JAVA CONVERTING TOOL v2.0 ***
*/
package projectmayhem1983.wheeloftime.structures;
import java.util.Random;
import cpw.mods.fml.common.IWorldGenerator;
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 projectmayhem1983.wheeloftime.entities.mobs.Aiel.EntityAielMob;
public class tinkerwagon extends WorldGenerator implements IWorldGenerator
{
protected Block[] getValidSpawnBlocks() {
return new Block[] {
Blocks.stone,
Blocks.grass,
Blocks.dirt
};
}
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 > 0){
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 tinkerwagon() { }
@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.setBlock(x, y, z, block, metadata, 3);
}
}
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 + 4, j, k) || !locationIsValidSpawn(world, i + 4, j, k + 11) || !locationIsValidSpawn(world, i, j, k + 11))
{
return false;
}
k = k - 10;
i = i - 10;
this.setBlock(world, i + 0, j + 1, k + 0, Blocks.air, 0);
this.setBlock(world, i + 0, j + 1, k + 1, Blocks.air, 0);
this.setBlock(world, i + 0, j + 1, k + 2, Blocks.wooden_slab, 8);
this.setBlock(world, i + 0, j + 1, k + 3, Blocks.stone, 3);
this.setBlock(world, i + 0, j + 1, k + 4, Blocks.wooden_slab, 8);
this.setBlock(world, i + 0, j + 1, k + 5, Blocks.wooden_slab, 8);
this.setBlock(world, i + 0, j + 1, k + 6, Blocks.wooden_slab, 8);
this.setBlock(world, i + 0, j + 1, k + 7, Blocks.stone, 3);
this.setBlock(world, i + 0, j + 1, k + 8, Blocks.wooden_slab, 8);
this.setBlock(world, i + 0, j + 1, k + 9, Blocks.air, 0);
this.setBlock(world, i + 0, j + 1, k + 10, Blocks.air, 0);
this.setBlock(world, i + 0, j + 1, k + 11, Blocks.air, 0);
this.setBlock(world, i + 0, j + 2, k + 0, Blocks.air, 0);
this.setBlock(world, i + 0, j + 2, k + 1, Blocks.air, 0);
this.setBlock(world, i + 0, j + 2, k + 2, Blocks.planks, 0);
this.setBlock(world, i + 0, j + 2, k + 3, Blocks.planks, 0);
this.setBlock(world, i + 0, j + 2, k + 4, Blocks.planks, 0);
this.setBlock(world, i + 0, j + 2, k + 5, Blocks.planks, 0);
this.setBlock(world, i + 0, j + 2, k + 6, Blocks.planks, 0);
this.setBlock(world, i + 0, j + 2, k + 7, Blocks.planks, 0);
this.setBlock(world, i + 0, j + 2, k + 8, Blocks.planks, 0);
this.setBlock(world, i + 0, j + 2, k + 9, Blocks.air, 0);
this.setBlock(world, i + 0, j + 2, k + 10, Blocks.air, 0);
this.setBlock(world, i + 0, j + 2, k + 11, Blocks.air, 0);
this.setBlock(world, i + 0, j + 3, k + 0, Blocks.air, 0);
this.setBlock(world, i + 0, j + 3, k + 1, Blocks.air, 0);
this.setBlock(world, i + 0, j + 3, k + 2, Blocks.wool, 2);
this.setBlock(world, i + 0, j + 3, k + 3, Blocks.wool, 2);
this.setBlock(world, i + 0, j + 3, k + 4, Blocks.wool, 2);
this.setBlock(world, i + 0, j + 3, k + 5, Blocks.wool, 2);
this.setBlock(world, i + 0, j + 3, k + 6, Blocks.wool, 2);
this.setBlock(world, i + 0, j + 3, k + 7, Blocks.wool, 2);
this.setBlock(world, i + 0, j + 3, k + 8, Blocks.wool, 2);
this.setBlock(world, i + 0, j + 3, k + 9, Blocks.air, 0);
this.setBlock(world, i + 0, j + 3, k + 10, Blocks.air, 0);
this.setBlock(world, i + 0, j + 3, k + 11, Blocks.air, 0);
this.setBlock(world, i + 0, j + 4, k + 0, Blocks.air, 0);
this.setBlock(world, i + 0, j + 4, k + 1, Blocks.air, 0);
this.setBlock(world, i + 0, j + 4, k + 2, Blocks.air, 0);
this.setBlock(world, i + 0, j + 4, k + 3, Blocks.air, 0);
this.setBlock(world, i + 0, j + 4, k + 4, Blocks.air, 0);
this.setBlock(world, i + 0, j + 4, k + 5, Blocks.air, 0);
this.setBlock(world, i + 0, j + 4, k + 6, Blocks.air, 0);
this.setBlock(world, i + 0, j + 4, k + 7, Blocks.air, 0);
this.setBlock(world, i + 0, j + 4, k + 8, Blocks.air, 0);
this.setBlock(world, i + 0, j + 4, k + 9, Blocks.air, 0);
this.setBlock(world, i + 0, j + 4, k + 10, Blocks.air, 0);
this.setBlock(world, i + 0, j + 4, k + 11, Blocks.air, 0);
this.setBlock(world, i + 0, j + 5, k + 0, Blocks.air, 0);
this.setBlock(world, i + 0, j + 5, k + 1, Blocks.air, 0);
this.setBlock(world, i + 0, j + 5, k + 2, Blocks.air, 0);
this.setBlock(world, i + 0, j + 5, k + 3, Blocks.air, 0);
this.setBlock(world, i + 0, j + 5, k + 4, Blocks.air, 0);
this.setBlock(world, i + 0, j + 5, k + 5, Blocks.air, 0);
this.setBlock(world, i + 0, j + 5, k + 6, Blocks.air, 0);
this.setBlock(world, i + 0, j + 5, k + 7, Blocks.air, 0);
this.setBlock(world, i + 0, j + 5, k + 8, Blocks.air, 0);
this.setBlock(world, i + 0, j + 5, k + 9, Blocks.air, 0);
this.setBlock(world, i + 0, j + 5, k + 10, Blocks.air, 0);
this.setBlock(world, i + 0, j + 5, k + 11, Blocks.air, 0);
this.setBlock(world, i + 1, j + 1, k + 0, Blocks.air, 0);
this.setBlock(world, i + 1, j + 1, k + 1, Blocks.wooden_slab, 8);
this.setBlock(world, i + 1, j + 1, k + 2, Blocks.wooden_slab, 8);
this.setBlock(world, i + 1, j + 1, k + 3, Blocks.wooden_slab, 8);
this.setBlock(world, i + 1, j + 1, k + 4, Blocks.wooden_slab, 8);
this.setBlock(world, i + 1, j + 1, k + 5, Blocks.wooden_slab, 8);
this.setBlock(world, i + 1, j + 1, k + 6, Blocks.wooden_slab, 8);
this.setBlock(world, i + 1, j + 1, k + 7, Blocks.wooden_slab, 8);
this.setBlock(world, i + 1, j + 1, k + 8, Blocks.wooden_slab, 8);
this.setBlock(world, i + 1, j + 1, k + 9, Blocks.air, 0);
this.setBlock(world, i + 1, j + 1, k + 10, Blocks.air, 0);
this.setBlock(world, i + 1, j + 1, k + 11, Blocks.air, 0);
this.setBlock(world, i + 1, j + 2, k + 0, Blocks.air, 0);
this.setBlock(world, i + 1, j + 2, k + 1, Blocks.fence, 0);
this.setBlock(world, i + 1, j + 2, k + 2, Blocks.planks, 0);
this.setBlock(world, i + 1, j + 2, k + 3, Blocks.torch, 0);
this.setBlock(world, i + 1, j + 2, k + 4, Blocks.air, 0);
this.setBlock(world, i + 1, j + 2, k + 5, Blocks.air, 0);
this.setBlock(world, i + 1, j + 2, k + 6, Blocks.air, 7);
this.setBlock(world, i + 1, j + 2, k + 7, Blocks.air, 6);
this.setBlock(world, i + 1, j + 2, k + 8, Blocks.planks, 0);
this.setBlock(world, i + 1, j + 2, k + 9, Blocks.fence, 0);
this.setBlock(world, i + 1, j + 2, k + 10, Blocks.fence, 0);
this.setBlock(world, i + 1, j + 2, k + 11, Blocks.fence, 0);
this.setBlock(world, i + 1, j + 3, k + 0, Blocks.air, 0);
this.setBlock(world, i + 1, j + 3, k + 2, Blocks.wool, 2);
this.setBlock(world, i + 1, j + 3, k + 3, Blocks.air, 0);
this.setBlock(world, i + 1, j + 3, k + 4, Blocks.air, 0);
this.setBlock(world, i + 1, j + 3, k + 5, Blocks.air, 0);
this.setBlock(world, i + 1, j + 3, k + 6, Blocks.bookshelf, 0);
this.setBlock(world, i + 1, j + 3, k + 7, Blocks.bookshelf, 0);
this.setBlock(world, i + 1, j + 3, k + 8, Blocks.wool, 2);
this.setBlock(world, i + 1, j + 3, k + 9, Blocks.air, 0);
this.setBlock(world, i + 1, j + 3, k + 10, Blocks.air, 0);
this.setBlock(world, i + 1, j + 3, k + 11, Blocks.air, 0);
this.setBlock(world, i + 1, j + 4, k + 0, Blocks.air, 0);
this.setBlock(world, i + 1, j + 4, k + 1, Blocks.air, 0);
this.setBlock(world, i + 1, j + 4, k + 2, Blocks.wool, 2);
this.setBlock(world, i + 1, j + 4, k + 3, Blocks.wool, 2);
this.setBlock(world, i + 1, j + 4, k + 4, Blocks.wool, 2);
this.setBlock(world, i + 1, j + 4, k + 5, Blocks.wool, 2);
this.setBlock(world, i + 1, j + 4, k + 6, Blocks.wool, 2);
this.setBlock(world, i + 1, j + 4, k + 7, Blocks.wool, 2);
this.setBlock(world, i + 1, j + 4, k + 8, Blocks.wool, 2);
this.setBlock(world, i + 1, j + 4, k + 9, Blocks.air, 0);
this.setBlock(world, i + 1, j + 4, k + 10, Blocks.air, 0);
this.setBlock(world, i + 1, j + 4, k + 11, Blocks.air, 0);
this.setBlock(world, i + 1, j + 5, k + 0, Blocks.air, 0);
this.setBlock(world, i + 1, j + 5, k + 1, Blocks.air, 0);
this.setBlock(world, i + 1, j + 5, k + 2, Blocks.air, 0);
this.setBlock(world, i + 1, j + 5, k + 3, Blocks.air, 0);
this.setBlock(world, i + 1, j + 5, k + 4, Blocks.air, 0);
this.setBlock(world, i + 1, j + 5, k + 5, Blocks.air, 0);
this.setBlock(world, i + 1, j + 5, k + 6, Blocks.air, 0);
this.setBlock(world, i + 1, j + 5, k + 7, Blocks.air, 0);
this.setBlock(world, i + 1, j + 5, k + 8, Blocks.air, 0);
this.setBlock(world, i + 1, j + 5, k + 9, Blocks.air, 0);
this.setBlock(world, i + 1, j + 5, k + 10, Blocks.air, 0);
this.setBlock(world, i + 1, j + 5, k + 11, Blocks.air, 0);
this.setBlock(world, i + 2, j + 1, k + 0, Blocks.wooden_slab, 0);
this.setBlock(world, i + 2, j + 1, k + 1, Blocks.wooden_slab, 8);
this.setBlock(world, i + 2, j + 1, k + 2, Blocks.wooden_slab, 8);
this.setBlock(world, i + 2, j + 1, k + 3, Blocks.wooden_slab, 8);
this.setBlock(world, i + 2, j + 1, k + 4, Blocks.wooden_slab, 8);
this.setBlock(world, i + 2, j + 1, k + 5, Blocks.wooden_slab, 8);
this.setBlock(world, i + 2, j + 1, k + 6, Blocks.wooden_slab, 8);
this.setBlock(world, i + 2, j + 1, k + 7, Blocks.wooden_slab, 8);
this.setBlock(world, i + 2, j + 1, k + 8, Blocks.wooden_slab, 8);
this.setBlock(world, i + 2, j + 1, k + 9, Blocks.air, 0);
this.setBlock(world, i + 2, j + 1, k + 10, Blocks.air, 0);
this.setBlock(world, i + 2, j + 1, k + 11, Blocks.air, 0);
this.setBlock(world, i + 2, j + 2, k + 0, Blocks.air, 0);
this.setBlock(world, i + 2, j + 2, k + 1, Blocks.air, 0);
this.setBlock(world, i + 2, j + 2, k + 3, Blocks.air, 0);
this.setBlock(world, i + 2, j + 2, k + 4, Blocks.air, 0);
this.setBlock(world, i + 2, j + 2, k + 5, Blocks.air, 0);
this.setBlock(world, i + 2, j + 2, k + 6, Blocks.air, 0);
this.setBlock(world, i + 2, j + 2, k + 7, Blocks.air, 0);
this.setBlock(world, i + 2, j + 2, k + 8, Blocks.planks, 0);
this.setBlock(world, i + 2, j + 2, k + 9, Blocks.quartz_stairs, 3);
this.setBlock(world, i + 2, j + 2, k + 10, Blocks.air, 0);
this.setBlock(world, i + 2, j + 2, k + 11, Blocks.air, 0);
this.setBlock(world, i + 2, j + 3, k + 0, Blocks.air, 0);
this.setBlock(world, i + 2, j + 3, k + 1, Blocks.air, 0);
this.setBlock(world, i + 2, j + 3, k + 3, Blocks.air, 0);
this.setBlock(world, i + 2, j + 3, k + 4, Blocks.air, 0);
this.setBlock(world, i + 2, j + 3, k + 5, Blocks.air, 0);
this.setBlock(world, i + 2, j + 3, k + 6, Blocks.air, 0);
this.setBlock(world, i + 2, j + 3, k + 7, Blocks.air, 0);
this.setBlock(world, i + 2, j + 3, k + 8, Blocks.wool, 2);
this.setBlock(world, i + 2, j + 3, k + 9, Blocks.air, 0);
this.setBlock(world, i + 2, j + 3, k + 10, Blocks.air, 0);
this.setBlock(world, i + 2, j + 3, k + 11, Blocks.air, 0);
this.setBlock(world, i + 2, j + 4, k + 0, Blocks.air, 0);
this.setBlock(world, i + 2, j + 4, k + 1, Blocks.air, 0);
this.setBlock(world, i + 2, j + 4, k + 2, Blocks.wool, 2);
this.setBlock(world, i + 2, j + 4, k + 3, Blocks.wool, 2);
this.setBlock(world, i + 2, j + 4, k + 4, Blocks.wool, 2);
this.setBlock(world, i + 2, j + 4, k + 5, Blocks.wool, 2);
this.setBlock(world, i + 2, j + 4, k + 6, Blocks.wool, 2);
this.setBlock(world, i + 2, j + 4, k + 7, Blocks.wool, 2);
this.setBlock(world, i + 2, j + 4, k + 8, Blocks.wool, 2);
this.setBlock(world, i + 2, j + 4, k + 9, Blocks.air, 0);
this.setBlock(world, i + 2, j + 4, k + 10, Blocks.air, 0);
this.setBlock(world, i + 2, j + 4, k + 11, Blocks.air, 0);
this.setBlock(world, i + 2, j + 5, k + 0, Blocks.air, 0);
this.setBlock(world, i + 2, j + 5, k + 1, Blocks.air, 0);
this.setBlock(world, i + 2, j + 5, k + 2, Blocks.wool, 2);
this.setBlock(world, i + 2, j + 5, k + 3, Blocks.wool, 2);
this.setBlock(world, i + 2, j + 5, k + 4, Blocks.wool, 2);
this.setBlock(world, i + 2, j + 5, k + 5, Blocks.wool, 2);
this.setBlock(world, i + 2, j + 5, k + 6, Blocks.wool, 2);
this.setBlock(world, i + 2, j + 5, k + 7, Blocks.wool, 2);
this.setBlock(world, i + 2, j + 5, k + 8, Blocks.wool, 2);
this.setBlock(world, i + 2, j + 5, k + 9, Blocks.air, 0);
this.setBlock(world, i + 2, j + 5, k + 10, Blocks.air, 0);
this.setBlock(world, i + 2, j + 5, k + 11, Blocks.air, 0);
this.setBlock(world, i + 3, j + 0, k + 0, Blocks.grass, 0);
this.setBlock(world, i + 3, j + 0, k + 1, Blocks.grass, 0);
this.setBlock(world, i + 3, j + 0, k + 2, Blocks.dirt, 0);
this.setBlock(world, i + 3, j + 1, k + 0, Blocks.air, 0);
this.setBlock(world, i + 3, j + 1, k + 1, Blocks.wooden_slab, 8);
this.setBlock(world, i + 3, j + 1, k + 2, Blocks.wooden_slab, 8);
this.setBlock(world, i + 3, j + 1, k + 3, Blocks.wooden_slab, 8);
this.setBlock(world, i + 3, j + 1, k + 4, Blocks.wooden_slab, 8);
this.setBlock(world, i + 3, j + 1, k + 5, Blocks.wooden_slab, 8);
this.setBlock(world, i + 3, j + 1, k + 6, Blocks.wooden_slab, 8);
this.setBlock(world, i + 3, j + 1, k + 7, Blocks.wooden_slab, 8);
this.setBlock(world, i + 3, j + 1, k + 8, Blocks.wooden_slab, 8);
this.setBlock(world, i + 3, j + 1, k + 9, Blocks.air, 0);
this.setBlock(world, i + 3, j + 1, k + 10, Blocks.air, 0);
this.setBlock(world, i + 3, j + 1, k + 11, Blocks.air, 0);
this.setBlock(world, i + 3, j + 2, k + 0, Blocks.air, 0);
this.setBlock(world, i + 3, j + 2, k + 1, Blocks.fence, 0);
this.setBlock(world, i + 3, j + 2, k + 2, Blocks.planks, 0);
this.setBlock(world, i + 3, j + 2, k + 3, Blocks.air, 0);
this.setBlock(world, i + 3, j + 2, k + 4, Blocks.air, 0);
this.setBlock(world, i + 3, j + 2, k + 5, Blocks.air, 0);
this.setBlock(world, i + 3, j + 2, k + 6, Blocks.bed, 0);
this.setBlock(world, i + 3, j + 2, k + 7, Blocks.bed, 8);
this.setBlock(world, i + 3, j + 2, k + 8, Blocks.planks, 0);
this.setBlock(world, i + 3, j + 2, k + 9, Blocks.fence, 0);
this.setBlock(world, i + 3, j + 2, k + 10, Blocks.fence, 0);
this.setBlock(world, i + 3, j + 2, k + 11, Blocks.fence, 0);
this.setBlock(world, i + 3, j + 3, k + 0, Blocks.air, 0);
this.setBlock(world, i + 3, j + 3, k + 2, Blocks.wool, 2);
this.setBlock(world, i + 3, j + 3, k + 3, Blocks.air, 0);
this.setBlock(world, i + 3, j + 3, k + 4, Blocks.air, 0);
this.setBlock(world, i + 3, j + 3, k + 5, Blocks.air, 0);
this.setBlock(world, i + 3, j + 3, k + 6, Blocks.air, 0);
this.setBlock(world, i + 3, j + 3, k + 7, Blocks.air, 0);
this.setBlock(world, i + 3, j + 3, k + 8, Blocks.wool, 2);
this.setBlock(world, i + 3, j + 3, k + 9, Blocks.air, 0);
this.setBlock(world, i + 3, j + 3, k + 10, Blocks.air, 0);
this.setBlock(world, i + 3, j + 3, k + 11, Blocks.air, 0);
this.setBlock(world, i + 3, j + 4, k + 0, Blocks.air, 0);
this.setBlock(world, i + 3, j + 4, k + 1, Blocks.air, 0);
this.setBlock(world, i + 3, j + 4, k + 2, Blocks.wool, 2);
this.setBlock(world, i + 3, j + 4, k + 3, Blocks.wool, 2);
this.setBlock(world, i + 3, j + 4, k + 4, Blocks.wool, 2);
this.setBlock(world, i + 3, j + 4, k + 5, Blocks.wool, 2);
this.setBlock(world, i + 3, j + 4, k + 6, Blocks.wool, 2);
this.setBlock(world, i + 3, j + 4, k + 7, Blocks.wool, 2);
this.setBlock(world, i + 3, j + 4, k + 8, Blocks.wool, 2);
this.setBlock(world, i + 3, j + 4, k + 9, Blocks.air, 0);
this.setBlock(world, i + 3, j + 4, k + 10, Blocks.air, 0);
this.setBlock(world, i + 3, j + 4, k + 11, Blocks.air, 0);
this.setBlock(world, i + 3, j + 5, k + 0, Blocks.air, 0);
this.setBlock(world, i + 3, j + 5, k + 1, Blocks.air, 0);
this.setBlock(world, i + 3, j + 5, k + 2, Blocks.air, 0);
this.setBlock(world, i + 3, j + 5, k + 3, Blocks.air, 0);
this.setBlock(world, i + 3, j + 5, k + 4, Blocks.air, 0);
this.setBlock(world, i + 3, j + 5, k + 5, Blocks.air, 0);
this.setBlock(world, i + 3, j + 5, k + 6, Blocks.air, 0);
this.setBlock(world, i + 3, j + 5, k + 7, Blocks.air, 0);
this.setBlock(world, i + 3, j + 5, k + 8, Blocks.air, 0);
this.setBlock(world, i + 3, j + 5, k + 9, Blocks.air, 0);
this.setBlock(world, i + 3, j + 5, k + 10, Blocks.air, 0);
this.setBlock(world, i + 3, j + 5, k + 11, Blocks.air, 0);
this.setBlock(world, i + 4, j + 1, k + 0, Blocks.air, 0);
this.setBlock(world, i + 4, j + 1, k + 1, Blocks.air, 0);
this.setBlock(world, i + 4, j + 1, k + 2, Blocks.wooden_slab, 8);
this.setBlock(world, i + 4, j + 1, k + 3, Blocks.stone, 3);
this.setBlock(world, i + 4, j + 1, k + 4, Blocks.wooden_slab, 8);
this.setBlock(world, i + 4, j + 1, k + 5, Blocks.wooden_slab, 8);
this.setBlock(world, i + 4, j + 1, k + 6, Blocks.wooden_slab, 8);
this.setBlock(world, i + 4, j + 1, k + 7, Blocks.stone, 3);
this.setBlock(world, i + 4, j + 1, k + 8, Blocks.wooden_slab, 8);
this.setBlock(world, i + 4, j + 1, k + 9, Blocks.air, 0);
this.setBlock(world, i + 4, j + 1, k + 10, Blocks.air, 0);
this.setBlock(world, i + 4, j + 1, k + 11, Blocks.air, 0);
this.setBlock(world, i + 4, j + 2, k + 0, Blocks.air, 0);
this.setBlock(world, i + 4, j + 2, k + 1, Blocks.air, 0);
this.setBlock(world, i + 4, j + 2, k + 2, Blocks.planks, 0);
this.setBlock(world, i + 4, j + 2, k + 3, Blocks.planks, 0);
this.setBlock(world, i + 4, j + 2, k + 4, Blocks.planks, 0);
this.setBlock(world, i + 4, j + 2, k + 5, Blocks.planks, 0);
this.setBlock(world, i + 4, j + 2, k + 6, Blocks.planks, 0);
this.setBlock(world, i + 4, j + 2, k + 7, Blocks.planks, 0);
this.setBlock(world, i + 4, j + 2, k + 8, Blocks.planks, 0);
this.setBlock(world, i + 4, j + 2, k + 9, Blocks.air, 0);
this.setBlock(world, i + 4, j + 2, k + 10, Blocks.air, 0);
this.setBlock(world, i + 4, j + 2, k + 11, Blocks.air, 0);
this.setBlock(world, i + 4, j + 3, k + 0, Blocks.air, 0);
this.setBlock(world, i + 4, j + 3, k + 1, Blocks.air, 0);
this.setBlock(world, i + 4, j + 3, k + 2, Blocks.wool, 2);
this.setBlock(world, i + 4, j + 3, k + 3, Blocks.wool, 2);
this.setBlock(world, i + 4, j + 3, k + 4, Blocks.wool, 2);
this.setBlock(world, i + 4, j + 3, k + 5, Blocks.wool, 2);
this.setBlock(world, i + 4, j + 3, k + 6, Blocks.wool, 2);
this.setBlock(world, i + 4, j + 3, k + 7, Blocks.wool, 2);
this.setBlock(world, i + 4, j + 3, k + 8, Blocks.wool, 2);
this.setBlock(world, i + 4, j + 3, k + 9, Blocks.air, 0);
this.setBlock(world, i + 4, j + 3, k + 10, Blocks.air, 0);
this.setBlock(world, i + 4, j + 3, k + 11, Blocks.air, 0);
this.setBlock(world, i + 4, j + 4, k + 0, Blocks.air, 0);
this.setBlock(world, i + 4, j + 4, k + 1, Blocks.air, 0);
this.setBlock(world, i + 4, j + 4, k + 2, Blocks.air, 0);
this.setBlock(world, i + 4, j + 4, k + 3, Blocks.air, 0);
this.setBlock(world, i + 4, j + 4, k + 4, Blocks.air, 0);
this.setBlock(world, i + 4, j + 4, k + 5, Blocks.air, 0);
this.setBlock(world, i + 4, j + 4, k + 6, Blocks.air, 0);
this.setBlock(world, i + 4, j + 4, k + 7, Blocks.air, 0);
this.setBlock(world, i + 4, j + 4, k + 8, Blocks.air, 0);
this.setBlock(world, i + 4, j + 4, k + 9, Blocks.air, 0);
this.setBlock(world, i + 4, j + 4, k + 10, Blocks.air, 0);
this.setBlock(world, i + 4, j + 4, k + 11, Blocks.air, 0);
this.setBlock(world, i + 4, j + 5, k + 0, Blocks.air, 0);
this.setBlock(world, i + 4, j + 5, k + 1, Blocks.air, 0);
this.setBlock(world, i + 4, j + 5, k + 2, Blocks.air, 0);
this.setBlock(world, i + 4, j + 5, k + 3, Blocks.air, 0);
this.setBlock(world, i + 4, j + 5, k + 4, Blocks.air, 0);
this.setBlock(world, i + 4, j + 5, k + 5, Blocks.air, 0);
this.setBlock(world, i + 4, j + 5, k + 6, Blocks.air, 0);
this.setBlock(world, i + 4, j + 5, k + 7, Blocks.air, 0);
this.setBlock(world, i + 4, j + 5, k + 8, Blocks.air, 0);
this.setBlock(world, i + 4, j + 5, k + 9, Blocks.air, 0);
this.setBlock(world, i + 4, j + 5, k + 10, Blocks.air, 0);
this.setBlock(world, i + 4, j + 5, k + 11, Blocks.air, 0);
world.setBlockMetadataWithNotify(i + 1, j + 3, k + 1, 5, 2);
world.setBlockMetadataWithNotify(i + 2, j + 2, k + 2, 1, 2);
world.setBlockMetadataWithNotify(i + 2, j + 3, k + 2, 8, 2);
world.setBlockMetadataWithNotify(i + 3, j + 3, k + 1, 5, 2);
return true;
}
}
Here are some examples.
I recently removed all the grass/dirt blocks to see if that helped, but it still spawns in the air
To fix the floating bugs, you need to check that not only is the block at each corner air to begin with, but also the block below each corner returns true for hasSolidTopOrSurface (or whatever it's called). In other words, check eight blocks to see if the wagon should generate.
Also, why are you subtracting 10 from i and k after checking blocks using those values? That might cause it to generate in invalid locations because it checked a completely different spot.
When you spawn the structure, your setBlock function refuses to place blocks if there happens to be dirt or anything besides leaves and air already there. It's not that dirt replaces your structure, it's that your structure never replaces dirt.
In other words, take out the check for air or leaves to make sure you actually place blocks. The only reason the check is there is to prevent odd looking half-replaced trees or structures, which is not worth the trouble.
Honestly, I gave up on using schematic converters. It always takes too much time to track down and fix bugs. It's easiest to sit down with some graph paper, a pencil, and some patience.
What I do for small structures is make an array of points where the blocks will be placed, one array per section.
I'm not sure about the -10 thing. It was all generated using Schematic Converter. I commented it out, and they seem to be spawning consistently one block higher than the ground, which is understandable because I had a layer of dirt under it that i removed the code for. SO gotta redo it without the lay of dirt, get rid of the -10 thing and see if that fixes it.
Ok, created a new wagon, took the -10 off with a //comment and got rid of the air and leaves check with a //comment. It is reliably spawning on the ground now, thought the doors didnt show up, i gotta work that out, out of 10 spawns, I had 1 spawn with a single leaves blocks in it, where the door was suppose to be. SO thank you very much for the help, I should be able to fix the door issue.
Having an issue with my custom structure spawning slightly above the ground, and inside terrain.
TinkerWagonGeneration.java
TinkerWagon.java
Here are some examples.
I recently removed all the grass/dirt blocks to see if that helped, but it still spawns in the air
To fix the floating bugs, you need to check that not only is the block at each corner air to begin with, but also the block below each corner returns true for hasSolidTopOrSurface (or whatever it's called). In other words, check eight blocks to see if the wagon should generate.
Also, why are you subtracting 10 from i and k after checking blocks using those values? That might cause it to generate in invalid locations because it checked a completely different spot.
When you spawn the structure, your setBlock function refuses to place blocks if there happens to be dirt or anything besides leaves and air already there. It's not that dirt replaces your structure, it's that your structure never replaces dirt.
In other words, take out the check for air or leaves to make sure you actually place blocks. The only reason the check is there is to prevent odd looking half-replaced trees or structures, which is not worth the trouble.
Honestly, I gave up on using schematic converters. It always takes too much time to track down and fix bugs. It's easiest to sit down with some graph paper, a pencil, and some patience.
What I do for small structures is make an array of points where the blocks will be placed, one array per section.
Example:
I'm not sure about the -10 thing. It was all generated using Schematic Converter. I commented it out, and they seem to be spawning consistently one block higher than the ground, which is understandable because I had a layer of dirt under it that i removed the code for. SO gotta redo it without the lay of dirt, get rid of the -10 thing and see if that fixes it.
Ok, created a new wagon, took the -10 off with a //comment and got rid of the air and leaves check with a //comment. It is reliably spawning on the ground now, thought the doors didnt show up, i gotta work that out, out of 10 spawns, I had 1 spawn with a single leaves blocks in it, where the door was suppose to be. SO thank you very much for the help, I should be able to fix the door issue.